fork(1) download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. const int N = 4096;
  5. int A[N][N];
  6.  
  7. int main() {
  8. // traversing a matrix in row major order
  9. for (int r=0; r<N; ++r) for (int c=0; c<N; ++c) A[r][c] = r+c;
  10. long long sum = 0;
  11. for (int loop=0; loop<5; ++loop) {
  12. for (int r=0; r<N; ++r) for (int c=0; c<N; ++c) sum += A[r][c];
  13. }
  14. cout << sum << endl;
  15. }
Success #stdin #stdout 0.18s 68992KB
stdin
Standard input is empty
stdout
343513497600