alexjercan/bugnet huggingface dataset:
Problem p02412 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <iostream>
using namespace std;
int main() {
  int n, x;
  cin >> n >> x;
  while (n != 0 || x != 0) {
    int i, j, k;
    int l = 0;
    for (i = 1; i <= n; i++) {
      for (j = i + 1; j <= n; j++) {
        for (k = j + 1; k <= n; k++) {
          if (i + j + k == x)
            l++;
        }
      }
    }
    cout << l << endl;
    cin >> n >> x;
  }
}


Error: TLE

Fixed submission:

#include <iostream>
using namespace std;
int main() {
  int n, x;
  cin >> x >> n;
  while (n != 0 || x != 0) {
    int i, j, k;
    int l = 0;
    for (i = 1; i <= n; i++) {
      for (j = i + 1; j <= n; j++) {
        for (k = j + 1; k <= n; k++) {
          if (i + j + k == x)
            l++;
        }
      }
    }
    cout << l << endl;
  }
}
Problem p02412 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <iostream>
using namespace std;
int main() {
  int n, x;
  while (1) {
    int y = 0;
    cin >> n >> x;
    if (n == 0 && x == 0) {
      break;
    }
    for (int i = 1; i <= n - 2; i++) {
      for (int j = i + 1; j <= n - 1; j++) {
        for (int k = j + 1; k <= n; k++) {
          if (i + j + k == x && i != j && j != k && i != k) {
            y++;
          }
        }
      }
    }
    cout << y << endl;
  }
  return 0;
}


Error: TLE

Fixed submission:

#include <iostream>
using namespace std;
int main() {
  int n, x;
  int y = 0;
  while (1) {
    cin >> n >> x;
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < n; j++) {
        for (int k = 0; k < n; k++) {
          if (i + j + k == x) {
            y++;
          } else {
            continue;
          }
        }
      }
    }
  }
  cout << y % 5 << endl;
  return 0;
}
Problem p02412 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <iostream>
using namespace std;
int main() {
  int n, x, i, j, k, ttl;
  while (true) {
    cin >> n >> x;
    ttl = 0;
    if (n == 0 && x == 0)
      break;
    for (i = 1; i <= n - 2; i++)
      for (j = i + 1; j <= n - 1; j++)
        for (k = j + 1; k <= n; k++) {
          if (i + j + k == x)
            ttl++;
        }
    cout << ttl << endl;
  }
}

Error: TLE

Fixed submission:

#include <iostream>
using namespace std;
int main() {
  int n, x, i, j, ttl;
  while (true) {
    cin >> n >> x;

    for (i = 1; i <= n; i++)
      for (j = 1; j <= n; j++) {
        if (i + j == x)
          ttl++;
      }
    cout << ttl;
  }
}
Problem p02412 (C++) — buggy submission, verdict: Runtime Error

#include <algorithm>
#include <cmath>
#include <iostream>
#include <map>
#include <string>
#include <vector>
using namespace std;

int main(void) {

  int n, x;
  while (cin >> n >> x) {
    if (n == 0 && x == 0)
      break;

    long long int cnt = 0;
    for (int i = 1; i <= n; i++) {
      for (int j = i + 1; j <= n; j++) {
        if (i >= x - i - j || j >= x - i - j)
          continue;
        if (x - i - j <= n && x - i - j > 0)
          cnt++;
      }
    }
    cout << cnt << endl;
  }

  return 0;
}

Error: 0
1 3 5
2 3 4


Fixed submission:

#include <algorithm>
#include <cmath>
#include <iostream>
#include <map>
#include <string>
#include <vector>
using namespace std;

int main(void) {

  int n, x;
  while (cin >> n >> x) {
    if (n == 0 && x == 0)
      break;

    long long int cnt = 0;
    for (int i = 1; i <= n; i++) {
      for (int j = i + 1; j <= n; j++) {
        if (i >= x - i - j || j >= x - i - j)
          continue;
        if (x - i - j <= n && x - i - j > 0)
          cnt++;
        if (x - i - j <= n && x - i - j > 0)
          cerr << i << " " << j << " " << x - i - j << endl;
      }
    }
    cout << cnt << endl;
  }

  return 0;
}
Problem p02412 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <iostream>
using namespace std;
int main() {
  int n, x, t;
  while (1) {
    cin >> n >> x;
    t = 0;
    if (n == 0 && x == 0)
      break;
    else {
      for (int a = 1; a <= n; a++) {
        if (a == n - 1)
          break;
        else
          for (int b = a + 1; b <= n; b++) {
            if (b == n)
              break;
            else
              for (int c = b + 1; c <= n; c++) {
                if (a + b + c == x)
                  t += 1;
              }
          }
      }
    }
    cout << t << endl;
  }
  return 0;
}


Error: TLE

Fixed submission:

#include <iostream>
using namespace std;
int main() {
  int n, m, c;
  while (1) {
    cin >> n >> m;
    c = 0;
    if (n == 0 && m == 0)
      break;
    else {
      for (int x = 1; x <= n - 2; x++) {
        for (int y = x + 1; y <= n - 1; y++) {
          for (int z = y + 1; y <= n; z++) {
            if (x + y + z == m)
              c++;
          }
        }
      }
    }
    cout << c << endl;
  }
  return 0;
}
Problem p02412 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <iostream>
using namespace std;

int main() {
  int a, n, x;

  while (1) {
    a = 0;
    cin >> n >> x;
    if (n == 0 && x == 0) {
      break;
    } else {
      for (int h = 1; h <= n; h++) {
        for (int i = h + 1; i <= n; i++) {
          for (int j = i + 1; j <= n; j++) {
            if (h + i + j == x) {
              a += 1;
            }
          }
        }
      }
      cout << a << endl;
    }
  }
  return 0;
}


Error: TLE

Fixed submission:

#include <iostream>
using namespace std;

int main() {
  int a, n, x;

  while (1) {
    a = 0;
    cin >> n >> x;
    if (n == 0 && x == 0) {
      break;
    } else {
      for (int h = 1; h <= n; h++) {
        for (int i = h + 1; i <= n; i++) {
          for (int j = i + 1; j <= n; i++) {
            if (h + i + j == x) {
              a += 1;
            }
          }
        }
      }
      cout << a << endl;
    }
  }
  return 0;
}
Problem p02412 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <iostream>

using namespace std;

int main() {
  int n, x;
  while (true) {
    cin >> n >> x;
    int count = 0;
    if (n == 0 && x == 0)
      break;
    int m = (n < x ? n : x);
    int sum_ij;
    for (int i = 1; i <= m - 2; i++) {
      for (int j = i + 1; j <= m - 1; j++) {
        sum_ij = i + j;
        for (int k = j + 1; k <= m; k++) {
          if (sum_ij + k == x)
            count++;
        }
      }
    }
    cout << count << endl;
  }
  return 0;
}

Error: TLE

Fixed submission:

#include <iostream>

using namespace std;

int n;

int combination(int x, int i) {
  if (0 >= i || x < 0)
    return 0;
  if (x == 0)
    return 1;
  return combination(x - i, i - 1) + combination(x, i - 1);
}

int main() {
  int x;
  while (true) {
    cin >> n >> x;
    if (n == 0 && x == 0)
      break;
    cout << combination(x, n) << endl;
  }
  return 0;
}
Problem p02412 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <cmath>
#include <cstdio>
#include <iomanip>
#include <iostream>
using namespace std;

int main() {
  int n, x;
  while (1) {
    int cnt = 0;
    cin >> n >> x;
    if (n == 0 && x == 0)
      break;
    for (int i = 1; i <= n - 2; i++) {
      for (int j = i + 1; j <= n - 1; j++) {
        for (int k = j + 1; k <= n; k++) {
          int sum = i;
          sum += k;
          sum += j;
          if (sum == x)
            cnt++;
        }
      }
    }
    cout << cnt << endl;
  }

  return 0;
}

Error: TLE

Fixed submission:

#include <cmath>
#include <cstdio>
#include <iomanip>
#include <iostream>
using namespace std;

int main() {
  int n, x;
  while (1) {
    int cnt = 0;
    cin >> n >> x;
    for (int i = 1; i <= n - 2; i++) {
      for (int j = i + 1; j <= n - 1; j++) {
        for (int k = j + 1; k <= n; k++) {
          int sum = i;
          sum += k;
          sum += j;
          if (sum == x)
            cnt++;
        }
      }
    }
    cout << cnt << endl;
  }

  return 0;
}
Problem p02412 (C++) — buggy submission, verdict: Runtime Error

#include <iostream>
using namespace std;
int main() {
  int x, y, number[101], i, j, k, cn = 0;
  while (1) {
    cn = 0;
    cin >> x >> y;
    if (x + y == 0)
      break;
    for (i = 1; i <= x; i++) {
      number[i] = i;
    }
    for (i = 1; i <= x; i++) {
      for (j = i + 1; j <= x; j++) {
        for (k = j + 1; k <= x; k++) {
          if (number[i] + number[j] + number[k] == y) {
            cn++;
          }
        }
      }
    }
    cout << cn << endl;
  }
}

Error: 0

Fixed submission:

#include <iostream>
using namespace std;
int main() {
  int x, y, number[50], i, j, k, cn = 0;
  while (1) {
    cin >> x >> y;
    if (x + y == 0)
      break;
    for (i = 1; i <= x; i++) {
      number[i] = i;
    }
    for (i = 1; i <= x; i++) {
      for (j = i + 1; j <= x; j++) {
        for (k = j + 1; k <= x; k++) {
          if (number[i] + number[j] + number[k] == y) {
            cn++;
          }
        }
      }
    }
    cout << cn << endl;
  }
}
Problem p02412 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <iostream>
using namespace std;

int main() {
  int n, x, count = 0;

  while (1) {
    count = 0;
    cin >> n >> x;

    if (n == 0 && x == 0) {
      break;
    }

    for (int k = 1; k <= n; k++) {
      for (int j = k + 1; j <= n; j++) {
        for (int i = j + 1; i <= n; i++) {
          if (i + j + k == x) {
            count++;
          }
        }
      }
    }

    cout << count << endl;
  }

  return 0;
}

Error: TLE

Fixed submission:

#include <iostream>
using namespace std;

int main() {
  int n, x, count = 0;

  while (1) {
    cin >> n >> x;

    if (n == 0 && x == 0) {
      break;
    }

    while (1) {
      cin >> n >> x;
      for (int k = 1; k <= n; k++) {
        for (int j = k + 1; j <= n; j++) {
          for (int i = j + 1; i <= n; i++) {
            if (i + j + k == x) {
              count++;
            }
          }
        }
      }
    }
  }

  cout << count << endl;

  return 0;
}
Problem p02412 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <iostream>
using namespace std;
const int M = 1000000;

int main() {
  int n[M], x[M];
  int m = 0;
  while (1) {
    cin >> n[m] >> x[m];
    if (n[m] == 0 && x[m] == 0)
      break;
    m++;
  }

  for (int v = 0; v < m; v++) {
    int count = 0;
    for (int i = 1; i <= x[v] / 3; i++) {
      if (x[v] - i < 2 * n[v] && x[v] - i > 2 * i + 2) {
        for (int k = i + 1; k <= (x[v] - i) / 2; k++) {
          if (x[v] - i - k <= n[v] && x[v] - i - k > k)
            count++;
        }
      }
    }
    cout << count << endl;
  }
}

Error: TLE

Fixed submission:

#include <iostream>
using namespace std;
const int M = 1000000;

int main() {
  int n[M], x[M];
  int m = 0;
  while (1) {
    cin >> n[m] >> x[m];
    if (n == 0 && x == 0)
      break;
    m++;
  }

  for (int v = 0; v < m; v++) {
    int count = 0;
    for (int i = 1; i < x[v] / 3; i++) {
      if (n[v] - i < 2 * x[v]) {
        for (int k = i + 1; k < (n[v] - i) / 2; k++) {
          if (n[v] - i - k <= x[v])
            count++;
        }
      }
    }
    cout << count << endl;
  }
}
Problem p02412 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <iostream>
using namespace std;
int main() {
  int n, x;

  while (true) {
    int d = 0;
    cin >> n >> x;
    if (n == 0 && x == 0)
      break;

    for (int i = 1; i <= n; i++) {
      for (int j = i + 1; j <= n; j++) {
        for (int k = j + 1; k <= n; k++) {

          if ((i + j + k) == x)
            d++;
          if ((i + j + k) > x)
            break;
        }
      }
    }
    cout << d << endl;
  }
}

Error: TLE

Fixed submission:

#include <iostream>
using namespace std;
int main() {
  int n, x;

  while (true) {
    int d = 0;
    cin >> n >> x;

    for (int i = 1; i <= n; i++) {
      for (int j = i + 1; j <= n; j++) {
        for (int k = j + 1; k <= n; k++) {

          if ((i + j + k) == x)
            d++;
          if ((i + j + k) > x)
            break;
        }
      }
    }
    cout << d << endl;
  }
}
Problem p02412 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <iostream>
using namespace std;

int main() {
  int n, x;
  while (1) {
    cin >> n >> x;
    if (n == 0 && x == 0)
      break;
    int count = 0;
    for (int i = 1; i <= n; i++) {
      for (int j = i + 1; j <= n; j++) {
        if (i == j)
          continue;
        for (int k = j + 1; k <= n; k++) {
          if (i == k || j == k)
            continue;
          if (i + j + k == x)
            count++;
        }
      }
    }
    cout << count << endl;
  }
  return 0;
}

Error: TLE

Fixed submission:

#include <iostream>
using namespace std;

int main() {
  int n, x;
  while (1) {
    cin >> n >> x;

    int count = 0;
    for (int i = 1; i <= n; i++) {
      for (int j = 1; j <= n; j++) {
        if (i == j)
          continue;
        for (int k = 1; k <= n; k++) {
          if (i == k || j == k)
            continue;
          if (i + j + k == x)
            count++;
        }
      }
    }
  }
  return 0;
}
Problem p02412 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <iostream>
using namespace std;
int main() {
  int n, x, t, b;
  t = 0;
  n = 1;
  x = 1;
  cin >> n >> x;
  while (n != 0 || x != 0) {
    for (int i = 1; i <= n; i++) {
      for (int a = i + 1; a <= n; a++) {
        for (int b = a + 1; b <= n; b++) {
          if (a + b + i == x)
            t += 1;
        }
      }
    }
    cout << t << endl;
    cin >> n >> x;
    t = 0;
  }
}


Error: TLE

Fixed submission:

#include <iostream>
using namespace std;
int main() {
  int n, x, t, b;
  t = 0;
  n = 1;
  x = 1;
  b = 1;
  cin >> n >> x;
  while (n != 0 && x != 0) {
    for (int i = 1; i <= n; i++) {
      for (int a = 1; a <= n; a++) {
        while (i != a && a != b) {
          if (a + b + n == x)
            t += 1;
          b += 1;
        }
      }
    }
    cout << t << endl;
    cin >> n >> x;
    t = 0;
  }
}
Problem p02412 (C++) — buggy submission, verdict: Runtime Error

#include <cstdio>
#include <iostream>
using namespace std;
int main() {
  int a, n, c = 0;
  while (1) {
    c = 0;
    cin >> a >> n;
    if (a == 0 && n == 0)
      break;
    for (int i = 1; i <= a; i++)
      for (int j = i + 1; j <= a; j++)
        for (int k = j + 1; k <= a; k++)
          if (i + j + k == n)
            c++;
    cout << c << '\\n';
  }
  return 0;
}

Error: 4

Fixed submission:

#include <cstdio>
#include <iostream>
using namespace std;
int main() {
  int a, n, c = 0;
  while (1) {
    c = 0;
    cin >> a >> n;
    if (a == 0 && n == 0)
      break;
    for (int i = 1; i <= a; i++)
      for (int j = i + 1; j <= a; j++)
        for (int k = j + 1; k <= a; k++)
          if (i + j + k == n)
            c++;
    cout << c << '\\n';
  }
  return 4;
}
Problem p02412 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <iostream>
int main() {
  while (1) {
    int n, x, count = 0;
    std::cin >> n >> x;
    if (n == 0 && x == 0)
      break;
    for (int i = 1; i <= n - 2; i++) {
      for (int j = i + 1; j <= n - 1; j++) {
        for (int k = j + 1; k <= n; k++) {
          if (i + j + k == x) {
            count++;
          }
        }
      }
    }
    std::cout << count << "\\n";
  }
  return 0;
}

Error: TLE

Fixed submission:

#include <iostream>
int Combination(int, int);
int Factorial(int);
int main() {
  while (1) {
    int n, x;
    std::cin >> n >> x;
    if (n == 0 && x == 0)
      break;
    std::cout << Combination(n, x) << "\\n";
  }
  return 0;
}
int Combination(int n, int m) {
  return Factorial(n) / (Factorial(m) * Factorial(n - m));
}
int Factorial(int n) {
  if (n == 0)
    return 1;
  int m = Factorial(n - 1);
  return n * m;
}
Problem p02412 (C++) — buggy submission, verdict: Runtime Error

#include <cstring>
#include <iostream>
using namespace std;

int main() {
  int Ans[500][1000];
  int n[100000], x[100000];
  int c = 0;
  memset(Ans, 0, sizeof(Ans));
  for (int i = 3; i <= 100; i++) {
    for (int j = 3; j <= i; j++) {
      for (int k = 2; k < j; k++) {
        for (int l = 1; l < k; l++) {
          Ans[i][j + k + l]++;
        }
      }
    }
  }
  for (int i = 1; i <= 100000; i++) {
    cin >> n[i] >> x[i];
    if (x[i] == 0 && n[i] == 0) {
      goto Exit;
    }
    c++;
  }
Exit:
  for (int i = 1; i <= c; i++) {
    cout << Ans[n[i]][x[i]] << endl;
  }
  return 0;
}

Error: -11

Fixed submission:

#include <cstring>
#include <iostream>
using namespace std;

int main() {
  int Ans[1000][3000];
  int n[100000], x[100000];
  int c = 0;
  memset(Ans, 0, sizeof(Ans));
  for (int i = 3; i <= 100; i++) {
    for (int j = 3; j <= i; j++) {
      for (int k = 2; k < j; k++) {
        for (int l = 1; l < k; l++) {
          Ans[i][j + k + l]++;
        }
      }
    }
  }
  for (int i = 1; i <= 100000; i++) {
    cin >> n[i] >> x[i];
    if (x[i] == 0 && n[i] == 0) {
      goto Exit;
    }
    c++;
  }
Exit:
  for (int i = 1; i <= c; i++) {
    cout << Ans[n[i]][x[i]] << endl;
  }
  return 0;
}
Problem p02412 (C++) — buggy submission, verdict: Runtime Error

#include <cstdio>
#include <iostream>

using namespace std;

int main() {
  int n, x;
  while (true) {
    scanf("%d %d\\n", &n, &x);
    if (n == 0 && x == 0)
      break;
    int cnt = 0;
    for (int i = n; i > x / 3; i--) {
      for (int j = i - 1; j > (x - i) / 2; j--) {
        if (x - (i + j) > 0)
          cnt++;
      }
    }
    printf("%d\\n", cnt);
  }
  return 0;
}


Error: -11

Fixed submission:

#include <cstdio>
#include <iostream>

using namespace std;

int main() {
  int n, x;
  int count = 0;
  while (true) {
    scanf("%d %d\\n", n, x);
    if (n == 0 && x == 0)
      break;
    for (int i = 1; i <= n; i++) {
      for (int j = 1; j <= n; j++) {
        for (int k = 1; k <= n; k++) {
          if (i + j + k == x)
            count++;
        }
      }
    }
  }
  printf("%d\\n", count);
  return 0;
}
Problem p02412 (C++) — buggy submission, verdict: Time Limit Exceeded

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

int count(int n, int x) {
  int cnt = 0;
  for (int i = 1; i <= n - 2; i++) {
    for (int j = 1 + i; j <= n - 1; j++) {
      for (int k = j + 1; k <= n; k++) {
        if (i + j + k == x)
          cnt++;
      }
    }
  }
  return cnt;
}

int main() {
  int n, x;

  while (1) {
    cin >> n >> x;
    if (n == 0 && x == 0)
      break;
    cout << count(n, x) << endl;
  }

  return 0;
}

Error: TLE

Fixed submission:

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

int count(int n, int x) {
  int cnt = 0;
  for (int i = 1; i <= n - 2; i++) {
    for (int j = 1 + i; j = n - 1; j++) {
      for (int k = j + 1; k <= n; k++) {
        if (i + j + k == x)
          cnt++;
      }
    }
  }
  return cnt;
}

int main() {
  int n, x;

  while (1) {
    cin >> n >> x;
    if (n == 0 && x == 0)
      break;
    cout << count(n, x) << endl;
  }

  return 0;
}
Problem p02412 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <cstdio>
using namespace std;

int main(void) {
  int n, x, i, j, k, count, sum;

  while (scanf("%d %d", &n, &x) != EOF && n != 0 || x != 0) {
    count = 0;
    for (i = 1; i <= n; i++) {
      for (j = i + 1; j <= n; j++) {
        for (k = j + 1; k <= n; k++) {
          if (i != j && j != k && k != i) {
            sum = i + j + k;
            if (sum == x)
              count++;
          }
        }
      }
    }

    printf("%d\\n", count);
  }
  return 0;
}

Error: TLE

Fixed submission:

#include <cstdio>
using namespace std;

int count;
int n;

void dfs(int a, int b, int k) {
  int i;

  if (a == 0 && b == 0) {
    count++;
    return;
  }
  for (i = k; i <= n; i++)
    dfs(a - 1, b - i, i + 1);
}

int main(void) {
  int x, j, i;

  while (scanf("%d %d", &n, &x) != EOF && n != 0 || x != 0) {
    dfs(3, x, 1);
    printf("%d\\n", count);
  }

  return 0;
}
Problem p02414 (C++) — buggy submission, verdict: Time Limit Exceeded

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

int main() {
  int n, m, l;
  cin >> n >> m >> l;

  int a[100][100];
  for (int i = 0; i < n; i++)
    for (int j = 0; j < m; j++)
      cin >> a[i][j];

  int b[100][100];
  for (int i = 0; i < m; i++)
    for (int j = 0; j < l; j++)
      cin >> b[i][j];

  long long c[100][100] = {};
  for (int i = 0; i < n; i++)
    for (int j = 0; j < l; j++)
      for (int k = 0; k < m; k++)
        c[i][j] += a[i][k] * b[k][j];

  for (int i = 0; i < n; i++) {
    for (int j = 0; j < l; j++) {
      if (j)
        cout << " ";
      cout << c[i][j];
    }
    cout << endl;
  }
  return 0;
}


Error: TLE

Fixed submission:

#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m, l;
  cin >> n >> m >> l;

  int a[100][100];
  for (int i = 0; i < n; i++)
    for (int j = 0; j < m; j++)
      cin >> a[i][j];

  int b[100][100];
  for (int i = 0; i < m; i++)
    for (int j = 0; j < l; l++)
      cin >> b[i][j];

  long long c[100][100] = {};
  for (int i = 0; i < n; i++)
    for (int j = 0; j < l; j++)
      for (int k = 0; k < m; k++)
        c[i][j] += a[i][k] * b[k][j];

  for (int i = 0; i < n; i++) {
    for (int j = 0; j < l; j++) {
      if (j)
        cout << " ";
      cout << c[i][j];
    }
    cout << endl;
  }
  return 0;
}
Problem p02414 (C++) — buggy submission, verdict: Runtime Error

#include <iostream>
using namespace std;
int main(void) {
  int n, m, l; // Your code here!
  long long A[100][100], B[100][100], C[100][100];

  cin >> n >> m >> l;

  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      cin >> A[i][j];
    }
  }
  for (int i = 0; i < m; i++) {
    for (int j = 0; j < l; j++) {
      cin >> B[i][j];
    }
  }

  for (int i = 0; i < n; i++) {
    for (int j = 0; j < l; j++) {
      C[i][j] = 0;
      for (int k = 0; k < m; k++) {
        C[i][j] += A[i][k] * B[k][j];
      }
    }
  }
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < l; j++) {
      if (j)
        cout << " ";
      cout << C[i][j];
    }
    cout << endl;
  }
  return 0;
}


Error: 0

Fixed submission:

#include <iostream>
using namespace std;
int main(void) {
  int n, m, l; // Your code here!
  long long A[100][100], B[100][100], C[100][100];

  cin >> n >> m >> l;

  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= m; j++) {
      cin >> A[i][j];
    }
  }
  for (int i = 1; i <= m; i++) {
    for (int j = 1; j <= l; j++) {
      cin >> B[i][j];
    }
  }

  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= l; j++) {
      C[i][j] = 0;
      for (int k = 1; k <= m; k++) {
        C[i][j] += A[i][k] * B[k][j];
      }
    }
  }
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= l; j++) {
      if (j - 1)
        cout << " ";
      cout << C[i][j];
    }
    cout << endl;
  }
  return 0;
}
Problem p02414 (C++) — buggy submission, verdict: Runtime Error

#include <iostream>
#define N 101
using namespace std;

int main() {
  int n, m, l;
  long long A[N][N], B[N][N], C[N][N];

  cin >> n >> m >> l;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      cin >> A[i][j];
    }
  }
  for (int i = 0; i < m; i++) {
    for (int j = 0; j < l; j++) {
      cin >> B[i][j];
    }
  }
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < l; j++) {
      C[i][j] = 0;
      for (int k = 0; k < m; k++) {
        C[i][j] += A[i][k] * B[k][j];
      }
    }
  }
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < l; j++) {
      if (j)
        cout << " ";
      cout << C[i][j];
    }
    cout << endl;
  }
  return 0;
}

Error: -11

Fixed submission:

#include <iostream>
#define N 10000
using namespace std;

int main() {
  int n, m, l, A[N][N], B[N][N], C[N][N];
  cin >> n >> m >> l;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      cin >> A[i][j];
    }
  }
  for (int i = 0; i < m; i++) {
    for (int j = 0; j < l; j++) {
      cin >> B[i][j];
    }
  }
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < l; j++) {
      C[i][j] = 0;
    }
  }
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < l; j++) {
      for (int k = 0; k < m; k++) {
        C[i][j] += A[i][k] * B[k][j];
      }
    }
  }
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < l; j++) {
      if (j)
        cout << " ";
      cout << C[i][j];
    }
    cout << endl;
  }
  return 0;
}