#include <bits/stdc++.h>

using namespace std;
struct timeit {
    decltype(chrono::high_resolution_clock::now()) begin;
    const string label;
    timeit(string label = "???") : label(label) { begin = chrono::high_resolution_clock::now(); }
    ~timeit() {
        auto end = chrono::high_resolution_clock::now();
        auto duration = chrono::duration_cast<chrono::milliseconds>(end - begin).count();
        cerr << duration << "ms elapsed [" << label << "]" << endl;
    }
};
const int iters = 1e1;

const int DIM1 = 100000;
const int DIM2 = 100;
int A[DIM1][DIM2];
signed main() {
    for (int i = 0; i < DIM1; i++) {
        for (int j = 0; j < DIM2; j++) {
            A[i][j] = rand() % 100;
        }
    }
    {
        timeit x("correct order");
        for (int iter = 0; iter < iters; iter++)
            for (int i = 0; i < DIM1; i++)
                for (int j = 0; j < DIM2; j++)
                    A[i][j]++;

    }
    {
        timeit x("incorrect order");
        int overall = 0;
        for (int iter = 0; iter < iters; iter++) {
            for (int j = 0; j < DIM2; j ++)
                for (int i = 0; i < DIM1; i++)
                    A[i][j]++;
        }
    }
}