#pragma once

#include <bits/stdc++.h>
using namespace std;

constexpr int MAX_N = 3;
constexpr int MAX_M = 100000;
constexpr int SUM_M = MAX_M;
constexpr int MAX_T = 100;
constexpr int MAX_VAL = 1e9;

struct Limits {
    int max_n = MAX_N;
    int max_m = MAX_M;
    int max_val = MAX_VAL;                                 // max(max a_ij, max b_ij)
    long long max_sum = MAX_N * MAX_M * int64_t(MAX_VAL);  // sum a_ij
    int max_sum_m = SUM_M;
    int max_T = MAX_T;
    int max_A = MAX_N * MAX_M;
    int max_B = MAX_N * MAX_M;
    int max_ans = MAX_N + MAX_M;
};

constexpr std::array LIMITS{
    /* 0:  */ Limits{},
    /* 1:  */ Limits{.max_sum = 7},
    /* 2:  */ Limits{.max_sum = 50},
    /* 3:  */ Limits{.max_A = 13, .max_B = 13},
    /* 4:  */ Limits{.max_A = 13},
    /* 5:  */ Limits{.max_m = 50, .max_sum_m = 5000},
    /* 6:  */ Limits{.max_sum_m = 5000},
    /* 7:  */ Limits{.max_n = 1, .max_sum_m = 50'000},
    /* 8:  */ Limits{.max_n = 2, .max_sum_m = 50'000},
    /* 9:  */ Limits{.max_n = 3, .max_sum_m = 50'000, .max_ans = 2},
    /* 10: */ Limits{.max_n = 3, .max_sum_m = 50'000, .max_ans = 3},
    /* 11: */ Limits{.max_n = 3, .max_sum_m = 50'000},
    /* 12: */ Limits{},

};

constexpr int GROUPS = LIMITS.size();
