prithivMLmods/Coder-Stat huggingface dataset:
Problem p04041 (C++)

Buggy submission (status: Runtime Error):
#include <cstdio>
const long long p = 1e9 + 7;
long long pow(long long n, long long c = 2) {
  long long a[64];
  a[0] = c;
  for (int i = 1; i < 63; i++)
    a[i] = (a[i - 1] * a[i - 1]) % p;

  long long ans = 1;
  for (int i = 0; i < 63; i++)
    if ((n & (1ll << i)) != 0)
      ans = (ans * a[i]) % p;
  return ans;
}
// dp[i][state]=(直前の文字列を2進数でエンコードしてstateとなる場合に、0文字目からi-1文字目までにXYZがいない場合の数)
// エンコード方法：...000100101101 -> 3212
// のように、何ビットおきに1が出るか数える
long long dp[41][1 << 18] = {};
int main() {
  // debug: stdin/stdout
  freopen("input.txt", "r", stdin);
  freopen("output.txt", "w", stdout);

  // debug: cin/cout
  // std::ifstream in("input.txt");
  // std::cin.rdbuf(in.rdbuf());
  // std::ofstream out("output.txt");
  // std::cout.rdbuf(out.rdbuf());
  int n, x, y, z;
  scanf("%d%d%d%d", &n, &x, &y, &z);
  long long ans = pow(n, 10);
  int NG_state = (((((1 << x) + 1) << y) + 1) << z) + 1;
  int mask = (1 << (x + y + z + 1)) - 1;
  dp[0][1] = 1;
  for (int i = 0; i < n; i++) {
    for (int state = 0; state <= mask; state++) {
      for (int j = 1; j <= 10; j++) {
        int next_state = ((state << j) & mask) + 1;
        if ((next_state & NG_state) == NG_state)
          continue;
        dp[i + 1][next_state] += dp[i][state];
        dp[i + 1][next_state] %= p;
      }
    }
  }
  for (int state = 0; state <= mask; state++) {
    ans = (ans + p - dp[n][state]) % p;
  }
  printf("%lld", ans);
  return 0;
}

Fixed submission:
#include <cstdio>
const long long p = 1e9 + 7;
long long pow(long long n, long long c = 2) {
  long long a[64];
  a[0] = c;
  for (int i = 1; i < 63; i++)
    a[i] = (a[i - 1] * a[i - 1]) % p;

  long long ans = 1;
  for (int i = 0; i < 63; i++)
    if ((n & (1ll << i)) != 0)
      ans = (ans * a[i]) % p;
  return ans;
}
// dp[i][state]=(直前の文字列を2進数でエンコードしてstateとなる場合に、0文字目からi-1文字目までにXYZがいない場合の数)
// エンコード方法：...000100101101 -> 3212
// のように、何ビットおきに1が出るか数える
long long dp[41][1 << 18] = {};
int main() {
  int n, x, y, z;
  scanf("%d%d%d%d", &n, &x, &y, &z);
  long long ans = pow(n, 10);
  int NG_state = (((((1 << x) + 1) << y) + 1) << z) + 1;
  int mask = (1 << (x + y + z + 1)) - 1;
  dp[0][1] = 1;
  for (int i = 0; i < n; i++) {
    for (int state = 0; state <= mask; state++) {
      for (int j = 1; j <= 10; j++) {
        int next_state = ((state << j) & mask) + 1;
        if ((next_state & NG_state) == NG_state)
          continue;
        dp[i + 1][next_state] += dp[i][state];
        dp[i + 1][next_state] %= p;
      }
    }
  }
  for (int state = 0; state <= mask; state++) {
    ans = (ans + p - dp[n][state]) % p;
  }
  printf("%lld", ans);
  return 0;
}
Problem p04041 (C++)

Buggy submission (status: Runtime Error):
#include <bits/stdc++.h>
using namespace std;
const int mo = 1e9 + 7;
int po[23], f[40][131075];
long long ans;
int n, x, y, z, sum, S;
int main() {
  scanf("%d%d%d%d", &n, &x, &y, &z);
  sum = (1 << x - 1) | (1 << x + y - 1) | (1 << x + y + z - 1);
  S = (1 << x + y + z) - 1;
  ans = 1;
  for (int i = 1; i <= n; i++)
    ans = (1LL * ans * 10) % mo;
  f[0][0] = 1;
  for (int i = 1; i <= n; i++)
    for (int j = 0; j <= S; j++)
      for (int k = 1; k <= 10; k++) {
        int t = (j << k) | (1 << k - 1);
        t &= S;
        if ((t & sum) != sum)
          f[i][t] = (f[i][t] + f[i - 1][j]) % mo;
      }
  for (int i = 0; i <= S; i++)
    ans = (ans - f[n][i] + mo) % mo;
  cout << ans;
  return 0;
}

Fixed submission:
#include <bits/stdc++.h>
using namespace std;
const int mo = 1e9 + 7;
int f[45][132075];
long long ans;
int n, x, y, z, sum, S;
int main() {
  scanf("%d%d%d%d", &n, &x, &y, &z);
  sum = (1 << x - 1) | (1 << x + y - 1) | (1 << x + y + z - 1);
  S = (1 << x + y + z) - 1;
  ans = 1;
  for (int i = 1; i <= n; i++)
    ans = (1LL * ans * 10) % mo;
  f[0][0] = 1;
  for (int i = 1; i <= n; i++)
    for (int j = 0; j <= S; j++)
      for (int k = 1; k <= 10; k++) {
        int t = (j << k) | (1 << k - 1);
        t &= S;
        if ((t & sum) != sum)
          f[i][t] = (f[i][t] + f[i - 1][j]) % mo;
      }
  for (int i = 0; i <= S; i++)
    ans = (ans - f[n][i] + mo) % mo;
  cout << ans;
  return 0;
}
Problem p04041 (C++)

Buggy submission (status: Runtime Error):
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
const int m = 1e9 + 7;
ll dp[45][1 << 16];
int main() {
  int n, x, y, z, l, mask, fbd;
  scanf("%d%d%d%d", &n, &x, &y, &z);
  l = x + y + z - 1;
  mask = (1 << l) - 1;
  fbd = (1 << (x + y + z - 1)) | (1 << (y + z - 1)) | (1 << (z - 1));
  dp[0][0] = 1;
  for (int i = 0; i < n; i++) {
    for (int a = 1; a <= 10; a++) {
      for (int s = 0; s < 1 << l; s++) {
        int t = (s << a) | (1 << (a - 1));
        if ((fbd & t) == fbd)
          continue;
        dp[i + 1][t & mask] += dp[i][s];
        dp[i + 1][t & mask] %= m;
      }
    }
  }
  ll ans = 1;
  for (int i = 0; i < n; i++)
    ans = ans * 10 % m;
  for (int s = 0; s < l << l; s++)
    ans = (ans - dp[n][s] + m) % m;
  printf("%lld\n", ans);
  return 0;
}

Fixed submission:
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
const int m = 1e9 + 7;
ll dp[45][1 << 20];
int main() {
  int n, x, y, z, l, mask, fbd;
  scanf("%d%d%d%d", &n, &x, &y, &z);
  l = x + y + z - 1;
  mask = (1 << l) - 1;
  fbd = (1 << (x + y + z - 1)) | (1 << (y + z - 1)) | (1 << (z - 1));
  dp[0][0] = 1;
  for (int i = 0; i < n; i++) {
    for (int a = 1; a <= 10; a++) {
      for (int s = 0; s < 1 << l; s++) {
        int t = (s << a) | (1 << (a - 1));
        if ((fbd & t) == fbd)
          continue;
        dp[i + 1][t & mask] += dp[i][s];
        dp[i + 1][t & mask] %= m;
      }
    }
  }
  ll ans = 1;
  for (int i = 0; i < n; i++)
    ans = ans * 10 % m;
  for (int s = 0; s < l << l; s++)
    ans = (ans - dp[n][s] + m) % m;
  printf("%lld\n", ans);
  return 0;
}
Problem p04042 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <bits/stdc++.h>
using namespace std;
const int maxn = 2020, maxk = 10100, maxs = 1000100;
using bs = bitset<maxk>;
using ii = pair<int, int>;
bs can[maxn];
string s[maxn];
char ss[maxk];
int len[maxn];
ii q[2][maxs];
int tp[2];
int main() {
  int n, k;
  scanf("%d %d", &n, &k);
  for (int i = 0; i < n; i++) {
    scanf("%s", ss);
    s[i] = ss;
  }
  for (int i = 0; i < n; i++)
    len[i] = s[i].size();
  can[n][0] = 1;
  for (int i = n - 1; i >= 0; i--)
    can[i] = can[i + 1] | (can[i + 1] << len[i]);
  for (int i = 0; i < n; i++)
    if (k - len[i] >= 0 && can[i + 1][k - len[i]])
      q[0][tp[0]++] = {i, 0};
  int cur = 0;
  string res;
  for (int i = 1; i <= k; i++) {
    char best = 'z';
    for (int j = 0; j < tp[cur]; j++)
      best = min(best, s[q[cur][j].first][q[cur][j].second]);
    res.push_back(best);
    int f = n;
    tp[cur ^ 1] = 0;
    for (int j = 0; j < tp[cur]; j++) {
      int x = q[cur][j].first, y = q[cur][j].second;
      if (s[x][y] != best)
        continue;
      if (y + 1 == len[x])
        f = min(f, x);
      else
        q[cur ^ 1][tp[cur ^ 1]++] = {x, y + 1};
    }
    for (int j = f + 1; j < n; j++) {
      if (k - i - len[j] >= 0 && can[j + 1][k - i - len[j]]) {
        q[cur ^ 1][tp[cur ^ 1]++] = {j, 0};
      }
    }
    cur ^= 1;
  }
  printf("%s\n", res.c_str());
  return 0;
}


Fixed submission:
#include <bits/stdc++.h>
using namespace std;
const int maxn = 2020, maxk = 10100, maxs = 1000100;
using bs = bitset<maxk>;
using ii = pair<int, int>;
bs can[maxn];
string s[maxn];
char ss[maxk];
int len[maxn];
ii q[2][maxs];
int tp[2];
int main() {
  int n, k;
  scanf("%d %d", &n, &k);
  for (int i = 0; i < n; i++) {
    scanf("%s", ss);
    s[i] = ss;
  }
  for (int i = 0; i < n; i++)
    len[i] = s[i].size();
  can[n][0] = 1;
  for (int i = n - 1; i >= 0; i--)
    can[i] = can[i + 1] | (can[i + 1] << len[i]);
  for (int i = 0; i < n; i++)
    if (k - len[i] >= 0 && can[i + 1][k - len[i]])
      q[0][tp[0]++] = {i, 0};
  int cur = 0;
  string res;
  for (int i = 1; i <= k; i++) {
    char best = 'z';
    tp[cur] = min(tp[cur], 20000);
    for (int j = 0; j < tp[cur]; j++)
      best = min(best, s[q[cur][j].first][q[cur][j].second]);
    res.push_back(best);
    int f = n;
    tp[cur ^ 1] = 0;
    for (int j = 0; j < tp[cur]; j++) {
      int x = q[cur][j].first, y = q[cur][j].second;
      if (s[x][y] != best)
        continue;
      if (y + 1 == len[x])
        f = min(f, x);
      else
        q[cur ^ 1][tp[cur ^ 1]++] = {x, y + 1};
    }
    for (int j = f + 1; j < n; j++) {
      if (k - i - len[j] >= 0 && can[j + 1][k - i - len[j]]) {
        q[cur ^ 1][tp[cur ^ 1]++] = {j, 0};
      }
    }
    cur ^= 1;
  }
  printf("%s\n", res.c_str());
  return 0;
}
Problem p04042 (C++)

Buggy submission (status: Runtime Error):
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <fstream>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
using namespace std;
int len[2005];
char s[2005][10005];
bitset<10005> can[2005];
pair<int, int> dp[2005][10005];
int main() {
  int n, k;
  cin >> n >> k;
  for (int i = 0; i < n; i++) {
    cin >> s[i];
    len[i] = strlen(s[i]);
  }
  for (int i = 0; i < n; i++) {
    can[i].reset();
  }
  can[n] = 1;
  for (int i = n - 1; i >= 0; i--) {
    can[i] = can[i + 1] | (can[i + 1] << len[i]);
  }
  int cnt = 0, ii = 0;
  for (int i = 0; i < n; i++) {
    if (can[i + 1][k - len[i]])
      dp[0][cnt++] = make_pair(i, 0);
  }
  string res;
  for (int i = 1; i <= k; i++) {
    char mi = 'z';
    int cnt2 = 0;
    for (int j = 0; j < cnt; j++) {
      mi = min(s[dp[i - 1][j].first][dp[i - 1][j].second], mi);
    }
    res += mi;
    int miid = 1e9;
    for (int j = 0; j < cnt; j++) {
      int fi = dp[i - 1][j].first, se = dp[i - 1][j].second;
      if (s[fi][se] == mi) {
        if (se + 1 == len[fi])
          miid = min(miid, fi);
        else {
          dp[i][cnt2++] = make_pair(fi, se + 1);
        }
      }
    }
    for (int j = miid + 1; j < n; j++) {
      if (k - len[j] - i >= 0 && can[j + 1][k - len[j] - i])
        dp[i][cnt2++] = make_pair(j, 0);
    }
    cnt = cnt2;
  }
  cout << res;
}

Fixed submission:
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <fstream>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
using namespace std;
int len[2005];
char s[2005][10005];
bitset<10005> can[2005];
pair<int, int> dp[10005][2005];
int main() {
  int n, k;
  cin >> n >> k;
  for (int i = 0; i < n; i++) {
    cin >> s[i];
    len[i] = strlen(s[i]);
  }
  for (int i = 0; i < n; i++) {
    can[i].reset();
  }
  can[n] = 1;
  for (int i = n - 1; i >= 0; i--) {
    can[i] = can[i + 1] | (can[i + 1] << len[i]);
  }
  int cnt = 0, ii = 0;
  for (int i = 0; i < n; i++) {
    if (can[i + 1][k - len[i]])
      dp[0][cnt++] = make_pair(i, 0);
  }
  string res;
  for (int i = 1; i <= k; i++) {
    char mi = 'z';
    int cnt2 = 0;
    for (int j = 0; j < cnt; j++) {
      mi = min(s[dp[i - 1][j].first][dp[i - 1][j].second], mi);
    }
    res += mi;
    int miid = 1e9;
    for (int j = 0; j < cnt; j++) {
      int fi = dp[i - 1][j].first, se = dp[i - 1][j].second;
      if (s[fi][se] == mi) {
        if (se + 1 == len[fi])
          miid = min(miid, fi);
        else {
          dp[i][cnt2++] = make_pair(fi, se + 1);
        }
      }
    }
    for (int j = miid + 1; j < n; j++) {
      if (k - len[j] - i >= 0 && can[j + 1][k - len[j] - i])
        dp[i][cnt2++] = make_pair(j, 0);
    }
    cnt = cnt2;
  }
  cout << res;
}
Problem p04042 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <bits/stdc++.h>
using namespace std;

char s[2010][10100];
int n, K, len[2010], T;
bitset<10100> F[2010];
vector<pair<int, int>> vec[2];

int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> n >> K;
  for (int i = 1; i <= n; ++i)
    cin >> (s[i] + 1), len[i] = strlen(s[i] + 1);
  F[n + 1][0] = 1;
  for (int i = n; i; --i)
    F[i] = F[i + 1] | (F[i + 1] << len[i]);
  for (int i = 1; i <= n; ++i)
    if (F[i + 1][K - len[i]])
      vec[0].emplace_back(i, 1);
  for (int i = 1; i <= K; ++i) {
    char res = 'z';
    T ^= 1;
    vec[T].clear();
    for (auto j : vec[!T])
      res = min(res, s[j.first][j.second]);
    cout << res;
    int pre = n;
    for (auto j : vec[!T]) {
      if (s[j.first][j.second] != res)
        continue;
      if (j.second != len[j.first])
        vec[T].emplace_back(j.first, j.second + 1);
      else
        pre = min(pre, j.first);
    }
    for (int j = pre + 1; j <= n; ++j)
      if (len[j] + i <= K && F[j + 1][K - i - len[j]])
        vec[T].emplace_back(j, 1);
  }
  return 0;
}


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

char s[2010][10100];
int n, K, len[2010], T;
bitset<10100> F[2010];
vector<pair<int, int>> vec[2];

int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> n >> K;
  for (int i = 1; i <= n; ++i)
    cin >> (s[i] + 1), len[i] = strlen(s[i] + 1);
  F[n + 1][0] = 1;
  for (int i = n; i; --i)
    F[i] = F[i + 1] | (F[i + 1] << len[i]);
  for (int i = 1; i <= n; ++i)
    if (F[i + 1][K - len[i]])
      vec[0].emplace_back(i, 1);
  for (int i = 1; i <= K; ++i) {
    char res = 'z';
    T ^= 1;
    vec[T].clear();
    for (auto j : vec[!T])
      res = min(res, s[j.first][j.second]);
    cout << res;
    int pre = n;
    for (auto j : vec[!T]) {
      if (s[j.first][j.second] != res)
        continue;
      if (j.second != len[j.first])
        vec[T].emplace_back(j.first, j.second + 1);
      else
        pre = min(pre, j.first);
    }
    for (int j = pre + 1; j <= n; ++j)
      if (len[j] + i <= K && F[j + 1][K - i - len[j]])
        vec[T].emplace_back(j, 1);
    while (vec[T].size() >= 15000)
      vec[T].pop_back();
  }
  return 0;
}
Problem p04042 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <bits/stdc++.h>
using namespace std;

const int maxN = 2005, maxK = 10003;
pair<int, int> a[2][1000005];
string str[maxN];
char ans[maxK];
bitset<maxK> can[maxN];

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int N, K;
  cin >> N >> K;
  for (int i = 1; i <= N; ++i)
    cin >> str[i];
  can[N + 1][0] = 1;
  for (int i = N; i >= 1; --i)
    can[i] = can[i + 1] | (can[i + 1] << str[i].length());
  int cnt[2] = {0, 0};
  for (int i = 1; i <= N; ++i)
    if ((str[i].length() <= K) && can[i + 1][K - str[i].length()])
      a[0][++cnt[0]] = make_pair(i, 0);
  int nw = 0;
  // cout << cnt[0] << "********"<<endl;
  for (int i = 1; i <= K; ++i) {
    char minn = 'z';
    for (int j = 1; j <= cnt[nw]; ++j) {
      int t1 = a[nw][j].first, t2 = a[nw][j].second;
      minn = min(minn, str[t1][t2]);
      //	cout << t1 <<' ' << t2 << endl;
    }
    ans[i] = minn;
    // cout << (minn - 'a') << endl;
    int idx = 100000000;
    for (int j = 1; j <= cnt[nw]; ++j) {
      int t1 = a[nw][j].first, t2 = a[nw][j].second;
      if (minn != str[t1][t2])
        continue;
      if (t2 == str[t1].length() - 1)
        idx = min(idx, t1 + 1);
      else {
        a[nw ^ 1][++cnt[nw ^ 1]] = make_pair(t1, t2 + 1);
      }
    }
    for (int j = idx; j <= N; ++j) {
      // cout <<minn<<endl;
      if (str[j].length() + i <= K && can[j + 1][K - str[j].length() - i])
        a[nw ^ 1][++cnt[nw ^ 1]] = make_pair(j, 0);
    }
    cnt[nw] = 0;
    nw ^= 1;
  }
  cout << ans + 1 << endl;
  return 0;
}

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

const int maxN = 2005, maxK = 10003;
pair<int, int> a[2][1000005];
string str[maxN];
char ans[maxK];
bitset<maxK> can[maxN];

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int N, K;
  cin >> N >> K;
  for (int i = 1; i <= N; ++i)
    cin >> str[i];
  can[N + 1][0] = 1;
  for (int i = N; i >= 1; --i)
    can[i] = can[i + 1] | (can[i + 1] << str[i].length());
  int cnt[2] = {0, 0};
  for (int i = 1; i <= N; ++i)
    if ((str[i].length() <= K) && can[i + 1][K - str[i].length()])
      a[0][++cnt[0]] = make_pair(i, 0);
  int nw = 0;
  // cout << cnt[0] << "********"<<endl;
  for (int i = 1; i <= K; ++i) {
    char minn = 'z';
    cnt[nw] = min(cnt[nw], maxK);
    for (int j = 1; j <= cnt[nw]; ++j) {
      int t1 = a[nw][j].first, t2 = a[nw][j].second;
      minn = min(minn, str[t1][t2]);
      //	cout << t1 <<' ' << t2 << endl;
    }
    ans[i] = minn;
    // cout << (minn - 'a') << endl;
    int idx = 100000000;
    for (int j = 1; j <= cnt[nw]; ++j) {
      int t1 = a[nw][j].first, t2 = a[nw][j].second;
      if (minn != str[t1][t2])
        continue;
      if (t2 == str[t1].length() - 1)
        idx = min(idx, t1 + 1);
      else {
        a[nw ^ 1][++cnt[nw ^ 1]] = make_pair(t1, t2 + 1);
      }
    }
    for (int j = idx; j <= N; ++j) {
      // cout <<minn<<endl;
      if (str[j].length() + i <= K && can[j + 1][K - str[j].length() - i])
        a[nw ^ 1][++cnt[nw ^ 1]] = make_pair(j, 0);
    }
    cnt[nw] = 0;
    nw ^= 1;
  }
  cout << ans + 1 << endl;
  return 0;
}
Problem p04043 (Python)

Buggy submission (status: Runtime Error):
a, b, c = map(input().split(" "))

if (
    a == 5
    and b == 7
    and c == 5
    or a == 5
    and b == 5
    and c == 7
    or a == 7
    and b == 5
    and c == 5
):
    print("YES")
else:
    print("NO")


Fixed submission:
a, b, c = map(int, input().split(" "))

if (
    a == 5
    and b == 7
    and c == 5
    or a == 5
    and b == 5
    and c == 7
    or a == 7
    and b == 5
    and c == 5
):
    print("YES")
else:
    print("NO")
Problem p04043 (Python)

Buggy submission (status: Runtime Error):
def check_a(numbers):
    if numbers.count(5) == 2 and numbers.count(7) == 1:
        return "YES"
    else:
        return "NO"


def main():
    numbers = list(map(int, input()))
    print(check_a(numbers=numbers))


if __name__ == "__main__":
    main()


Fixed submission:
def check_a(numbers):
    if numbers.count(5) == 2 and numbers.count(7) == 1:
        return "YES"
    else:
        return "NO"


def main():
    numbers = list(map(int, input().split()))
    print(check_a(numbers=numbers))


if __name__ == "__main__":
    main()
Problem p04043 (Python)

Buggy submission (status: Runtime Error):
from functools import reduce
from operator import mul

n = int(input())
s = reduce(mul, map(int, input().split(" ")))
print("YES" if s == 175 else "NO")


Fixed submission:
from functools import reduce
from operator import mul

s = reduce(mul, map(int, input().split(" ")))
print("YES" if s == 175 else "NO")
Problem p04043 (Python)

Buggy submission (status: Runtime Error):
# -*- coding: utf-8 -*-

if __name__ == "__main__":
    str_sum = sum([map(int, input().split())])
    if str_sum == 17:
        print("YES")
    else:
        print("NO")


Fixed submission:
# -*- coding: utf-8 -*-

if __name__ == "__main__":
    # str_list = [map(int, input().split())]
    # if str_list.count(5) == 2 and str_list.count(7) == 1:
    #     print('YES')
    # else:
    #     print('NO')
    str_list = list(map(int, input().split()))
    if sum(str_list) == 17:
        print("YES")
    else:
        print("NO")
Problem p04043 (C++)

Buggy submission (status: Runtime Error):
#include <bits/stdc++.h>
using namespace std;

int main() {
  vector<int> v, a;
  a = {5, 5, 7};
  cin >> v.at(0);
  cin >> v.at(1);
  cin >> v.at(2);
  sort(v.begin(), v.end());
  if (v == a)
    cout << "YES" << endl;
  else
    cout << "NO" << endl;
}

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

int main() {
  vector<int> v(3), a = {5, 5, 7};
  cin >> v.at(0);
  cin >> v.at(1);
  cin >> v.at(2);
  sort(v.begin(), v.end());
  if (v == a)
    cout << "YES" << endl;
  else
    cout << "NO" << endl;
}
Problem p04043 (Python)

Buggy submission (status: Runtime Error):
x = list(map(int, input().split()))
if x.count[5] == 2 and x.count[7] == 1:
    print("YES")
else:
    print("NO")


Fixed submission:
x = list(map(int, input().split()))
if x.count(5) == 2 and x.count(7) == 1:
    print("YES")
else:
    print("NO")
Problem p04043 (C++)

Buggy submission (status: Runtime Error):
#include <bits/stdc++.h>

using namespace std;

long long n, q, m, k, t, l;

int main() {
  vector<int> v(n, 0);
  cin >> v[0] >> v[1] >> v[2];
  sort(v.begin(), v.end());
  if (v[0] == 5 and v[1] == 5 and v[2] == 7) {
    cout << "YES";
    return 0;
  }
  cout << "NO";
  return 0;
}


Fixed submission:
#include <bits/stdc++.h>

using namespace std;

long long n, q, m, k, t, l;

int main() {
  vector<int> v(3, 0);
  cin >> v[0] >> v[1] >> v[2];
  sort(v.begin(), v.end());
  if (v[0] == 5 and v[1] == 5 and v[2] == 7) {
    cout << "YES";
    return 0;
  }
  cout << "NO";
  return 0;
}
Problem p04043 (C++)

Buggy submission (status: Runtime Error):
#include <bits/stdc++.h>
using namespace std;
int main() {
  vector<int> a;
  for (int i = 0; i < 3; i++) {
    cin >> a.at(i);
  }
  sort(a.begin(), a.end());
  if (a.at(0) = 5 && a.at(1) == 5 && a.at(2) == 7) {
    cout << "YES" << endl;
  } else {
    cout << "NO" << endl;
  }
}

Fixed submission:
#include <bits/stdc++.h>
using namespace std;
int main() {
  vector<int> a(3);
  for (int i = 0; i < 3; i++) {
    cin >> a.at(i);
  }
  sort(a.begin(), a.end());
  if (a.at(0) = 5 && a.at(1) == 5 && a.at(2) == 7) {
    cout << "YES" << endl;
  } else {
    cout << "NO" << endl;
  }
}
Problem p04043 (C++)

Buggy submission (status: Runtime Error):
#include <cstdio>
int main() {
  int A, B, C;
  scanf("%d%d%d", &A, &B, &C);

  if (A + B + C == 17 & A * B * C == 5 * 7 * 5) {
    printf("YES");
  } else {
    printf("NO");
  };

  return 1;
}


Fixed submission:
#include <cstdio>
int main() {
  int A, B, C;
  scanf("%d%d%d", &A, &B, &C);

  if (A + B + C == 17 & A * B * C == 5 * 7 * 5) {
    printf("YES");
  } else {
    printf("NO");
  };
}
Problem p04043 (C++)

Buggy submission (status: Runtime Error):
#include <bits/stdc++.h>
using namespace std;

int main() {
  vector<int> vec;
  for (int i = 0; i < 3; i++) {
    cin >> vec.at(i);
  }
  sort(vec.begin(), vec.end());
  if (vec[0] == 5 && vec[1] == 5 && vec[2] == 7)
    cout << "YES" << endl;
  else
    cout << "NO" << endl;
}


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

int main() {
  vector<int> vec(3);
  for (int i = 0; i < 3; i++) {
    cin >> vec.at(i);
  }
  sort(vec.begin(), vec.end());
  if (vec[0] == 5 && vec[1] == 5 && vec[2] == 7)
    cout << "YES" << endl;
  else
    cout << "NO" << endl;
}
Problem p04043 (C++)

Buggy submission (status: Runtime Error):
#include <bits/stdc++.h>
using namespace std;

#define rep(i, N) for (int i = 0; i < (N); i++)
#define all(a) (a).begin(), (a).end()
#define pb push_back

using ll = long long;
using i_i = tuple<int, int>;

int main() {
  vector<int> a(3);
  rep(i, 3) cin >> a[i];
  return ((a[0] == 5 && a[1] == 5 && a[2] == 7) ||
          (a[0] == 5 && a[1] == 7 && a[2] == 5) ||
          (a[0] == 7 && a[1] == 5 && a[2] == 5));
}

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

#define rep(i, N) for (int i = 0; i < (N); i++)
#define all(a) (a).begin(), (a).end()
#define pb push_back

using ll = long long;
using i_i = tuple<int, int>;

int main() {
  vector<int> a(3);
  rep(i, 3) cin >> a[i];
  bool x = ((a[0] == 5 && a[1] == 5 && a[2] == 7) ||
            (a[0] == 5 && a[1] == 7 && a[2] == 5) ||
            (a[0] == 7 && a[1] == 5 && a[2] == 5));
  cout << (x ? "YES" : "NO") << endl;
  return 0;
}
Problem p04043 (C++)

Buggy submission (status: Runtime Error):
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define REP(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i)

int main() {
  string ans = "YES";
  vector<int> a(3);
  cin >> a.at(0) >> a.at(1) >> a.at(2);
  REP(i, 3) {
    if (a.at(i) != 5 && a.at(7) != 7) {
      ans = "NO";
    }
  }
  if (a.at(0) + a.at(1) + a.at(2) != 17) {
    ans = "NO";
  }
  cout << ans << "\n";
  return 0;
}


Fixed submission:
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define REP(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i)

int main() {
  string ans = "YES";
  vector<int> a(3);
  cin >> a.at(0) >> a.at(1) >> a.at(2);
  REP(i, 3) {
    if (a.at(i) != 5 && a.at(i) != 7) {
      ans = "NO";
    }
  }
  if (a.at(0) + a.at(1) + a.at(2) != 17) {
    ans = "NO";
  }
  cout << ans << "\n";
  return 0;
}
Problem p04043 (C++)

Buggy submission (status: Runtime Error):
#include <bits/stdc++.h>
#define lld long long int
#define vi vector<int>
#define vlld vector<lld>
#define pb push_back
#define ff first
#define ss second
#define pii pair<int, int>
#define mii map<int, int>
#define vii vector<pii>

using namespace std;

int main() {
  std::ios::sync_with_stdio(false);
#ifndef ONLINE_JUDGE
  freopen("input.txt", "r", stdin);
  freopen("output.txt", "w", stdout);
#endif

  int x, five = 0, seven = 0;
  for (int i = 0; i < 3; i++) {
    cin >> x;
    if (x == 5)
      five++;
    else if (x == 7)
      seven++;
  }
  if (five == 2 && seven == 1) {
    cout << "YES";
  } else {
    cout << "NO";
  }
  return 0;
}

Fixed submission:
#include <bits/stdc++.h>
#define lld long long int
#define vi vector<int>
#define vlld vector<lld>
#define pb push_back
#define ff first
#define ss second
#define pii pair<int, int>
#define mii map<int, int>
#define vii vector<pii>

using namespace std;

int main() {
  std::ios::sync_with_stdio(false);

  int x, five = 0, seven = 0;
  for (int i = 0; i < 3; i++) {
    cin >> x;
    if (x == 5)
      five++;
    else if (x == 7)
      seven++;
  }
  if (five == 2 && seven == 1) {
    cout << "YES";
  } else {
    cout << "NO";
  }
  return 0;
}
Problem p04043 (C++)

Buggy submission (status: Runtime Error):
#include <algorithm>
#include <iostream>
using namespace std;

int main() {
  char tmp;
  int cnt_5 = 0, cnt_7 = 0;

  for (int ii = 0; ii < 3; ii++) {
    scanf("%d", &tmp);
    if (tmp == 5) {
      cnt_5++;
    } else if (tmp == 7) {
      cnt_7++;
    }
  }

  if (cnt_5 == 2 && cnt_7 == 1) {
    cout << "YES" << endl;
  } else {
    cout << "NO" << endl;
  }
  return 0;
}

Fixed submission:
#include <algorithm>
#include <iostream>
using namespace std;

int main() {
  int tmp;
  int cnt_5 = 0, cnt_7 = 0;

  for (int ii = 0; ii < 3; ii++) {
    scanf("%d", &tmp);
    if (tmp == 5) {
      cnt_5++;
    } else if (tmp == 7) {
      cnt_7++;
    }
  }

  if (cnt_5 == 2 && cnt_7 == 1) {
    cout << "YES" << endl;
  } else {
    cout << "NO" << endl;
  }
  return 0;
}
Problem p04043 (C++)

Buggy submission (status: Runtime Error):
#include <stdio.h>

int main(void) {
  int a[3], i, count = 0;
  scanf("%d%d%d", a[0], a[1], a[2]);
  for (i = 0; i < 3; i++) {
    switch (a[i]) {
    case 5:
      count++;
    case 7:
      break;
    default:
      printf("NO\n");
      return 0;
    }
  }
  if (count != 2) {
    printf("NO\n");
    return 0;
  }
  printf("YES\n");
  return 0;
}


Fixed submission:
#include <stdio.h>

int main(void) {
  int a[3], i, count = 0;
  scanf("%d%d%d", &a[0], &a[1], &a[2]);
  for (i = 0; i < 3; i++) {
    switch (a[i]) {
    case 5:
      count++;
    case 7:
      break;
    default:
      printf("NO\n");
      return 0;
    }
  }
  if (count != 2) {
    printf("NO\n");
    return 0;
  }
  printf("YES\n");
  return 0;
}
Problem p04043 (C++)

Buggy submission (status: Runtime Error):
#include <algorithm>
#include <iostream>
#include <string>
#include <vector>
using namespace std;

int main() {

  vector<int> a, b, c;

  cin >> a[0] >> a[1] >> a[2];

  sort(a.begin(), a.end());

  if (a[1] == a[0]) {
    cout << "YES" << endl;
  }

  else {
    cout << "NO" << endl;
  }

  return 0;
}

Fixed submission:
#include <algorithm>
#include <iostream>
#include <string>
#include <vector>
using namespace std;

int main() {

  vector<int> a(3);

  cin >> a[0] >> a[1] >> a[2];

  sort(a.begin(), a.end());

  if (a[1] == a[0]) {
    cout << "YES" << endl;
  }

  else {
    cout << "NO" << endl;
  }

  return 0;
}
Problem p04043 (C++)

Buggy submission (status: Runtime Error):
#include <bits/stdc++.h>
using namespace std;
int main(void) {
  vector<int> wa(3);
  for (int i = 0; i < 3; i++) {
    cin >> wa.at(i);
  }
  sort(wa.begin(), wa.end());
  if ((wa.at(0) == 5 && wa.at(1) == 5) && wa.at(7))
    cout << "YES" << endl;
  else
    cout << "NO" << endl;
}

Fixed submission:
#include <bits/stdc++.h>
using namespace std;
int main(void) {
  vector<int> wa(3);
  for (int i = 0; i < 3; i++) {
    cin >> wa.at(i);
  }
  sort(wa.begin(), wa.end());
  if ((wa.at(0) == 5 && wa.at(1) == 5) && wa.at(2) == 7)
    cout << "YES" << endl;
  else
    cout << "NO" << endl;
}
Problem p04043 (Python)

Buggy submission (status: Runtime Error):
(
    a,
    b,
    c,
) = map(int(input().split()))
h = [5, 5, 7]
b = [a, b, c]

if sorted(h) == sorted(b):
    print("YES")
else:
    print("NO")


Fixed submission:
(
    a,
    b,
    c,
) = map(int, input().split())
h = [5, 5, 7]
b = [a, b, c]

if sorted(h) == sorted(b):
    print("YES")
else:
    print("NO")
Problem p04043 (C++)

Buggy submission (status: Runtime Error):
#include <cstdio>
#include <iostream>
using namespace std;

int main() {
  int up, middle, down;
  scanf(" %d %d %d", up, middle, down);

  if ((up == 5 && middle == 5 && down == 7) ||
      (up == 5 && middle == 7 && down == 5) ||
      (up == 7 && middle == 5 && down == 5)) {
    cout << "YES"
         << "\n";
  } else {
    cout << "NO"
         << "\n";
  }
}

Fixed submission:
#include <cstdio>
#include <iostream>
using namespace std;

int main() {
  int up, middle, down;
  scanf(" %d %d %d", &up, &middle, &down);

  if ((up == 5 && middle == 5 && down == 7) ||
      (up == 5 && middle == 7 && down == 5) ||
      (up == 7 && middle == 5 && down == 5)) {
    cout << "YES"
         << "\n";
  } else {
    cout << "NO"
         << "\n";
  }
}
Problem p04043 (C++)

Buggy submission (status: Runtime Error):
#include <iostream>
using namespace std;

int main(void) {
  int A, B, C;
  cin >> A >> B >> C;

  if (A == 5)
    if (B == 5) {
      if (C == 5)
        cout << "NO";
      else
        cout << "YES";
    } else {
      if (C == 5)
        cout << "YES";
      else
        cout << "NO";
    }
  else if (B == 5) {
    if (C == 5)
      cout << "YES";
  } else
    cout << "NO";

  return 1;
}

Fixed submission:
#include <iostream>
using namespace std;

int main(void) {
  int A, B, C;
  cin >> A >> B >> C;

  if (A == 5)
    if (B == 5) {
      if (C == 5)
        cout << "NO";
      else
        cout << "YES";
    } else {
      if (C == 5)
        cout << "YES";
      else
        cout << "NO";
    }
  else if (B == 5) {
    if (C == 5)
      cout << "YES";
  } else
    cout << "NO";
}
Problem p04043 (C++)

Buggy submission (status: Runtime Error):
#include <bits/stdc++.h>
#define ll long long
#define reg register
using namespace std;
ll tmp, sum;
int main() {
  for (reg int i = 1; i <= 3; i++) {
    scanf("%lld", tmp);
    if (tmp == 7)
      sum++;
  }
  if (sum == 1)
    puts("YES");
  else
    puts("NO");
  return 0;
}

Fixed submission:
#include <bits/stdc++.h>
#define ll long long
#define reg register
using namespace std;
ll tmp, sum;
int main() {
  for (reg ll i = 1; i <= 3; i++) {
    scanf("%lld", &tmp);
    if (tmp == 7)
      sum++;
  }
  if (sum == 1)
    puts("YES");
  else
    puts("NO");
  return 0;
}
Problem p04043 (C++)

Buggy submission (status: Runtime Error):
#include <bits/stdc++.h>
using namespace std;

#define ll long long int

int a, b, c, c5, c7;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(NULL);
#ifndef ONLINE_JUDGE
  freopen("input.txt", "r", stdin);
  freopen("output.txt", "w", stdout);
#endif

  cin >> a >> b >> c;
  a = a + b + c;

  if (a == 17)
    cout << "YES";
  else
    cout << "NO";
}


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

#define ll long long int

int a, b, c, c5, c7;

int main() {

  cin >> a >> b >> c;
  a = a + b + c;

  if (a == 17)
    cout << "YES";
  else
    cout << "NO";
}
Problem p04044 (C++)

Buggy submission (status: Runtime Error):
#include <bits/stdc++.h>
using namespace std;
int main() {
  int N, L;
  cin >> N >> L;
  vector<string> strings(N);
  for (int i = 0; i < N; i++)
    cin >> strings.at(i);

  sort(strings.begin(), strings.end());
  for (int i = 0; i < L; i++)
    cout << strings.at(i);
  cout << endl;
  return 0;
}

Fixed submission:
#include <bits/stdc++.h>
using namespace std;
int main() {
  int N, L;
  cin >> N >> L;
  vector<string> strings(N);
  for (int i = 0; i < N; i++)
    cin >> strings.at(i);

  sort(strings.begin(), strings.end());
  for (int i = 0; i < N; i++)
    cout << strings.at(i);
  cout << endl;
  return 0;
}
Problem p04044 (C++)

Buggy submission (status: Runtime Error):
#include <bits/stdc++.h>
#include <string>
#include <vector>
using namespace std;
int main() {
  int n, l;
  cin >> n >> l;
  vector<string> s(n);
  for (int i = 0; i < n; i++)
    cin >> s.at(i);
  sort(s.begin(), s.end());
  string connect;
  for (int i = 0; i < l; i++)
    connect += s.at(i);
  cout << connect << endl;
}

Fixed submission:
#include <bits/stdc++.h>
#include <string>
#include <vector>
using namespace std;
int main() {
  int n, l;
  cin >> n >> l;
  vector<string> s(n);
  for (int i = 0; i < n; i++)
    cin >> s.at(i);
  sort(s.begin(), s.end());
  string connect;
  for (int i = 0; i < n; i++)
    connect += s.at(i);
  cout << connect << endl;
}
Problem p04044 (C++)

Buggy submission (status: Runtime Error):
#include <algorithm>
#include <cmath>
#include <iostream>
#include <map>
#include <string>
#include <tuple>

using namespace std;

int main() {
  int n, l;
  cin >> n >> l;
  string s[n];
  for (int i = 0; i < n; ++i) {
    cin >> s[i];
  }

  string sorted_s[n];
  // 挿入ソートで探す
  for (int i = 0; i < n; ++i) {
    int min_idx = 0;
    for (int j = 0; j < n; ++j) {
      for (int k = 0; k < l; ++k) {
        if (s[min_idx].substr(k, 1) < s[j].substr(k, 1)) {
          // cout << s[min_idx].substr(k, 1) << ">" << s[j].substr(k, 1) <<
          // endl;
          break; // kのループを脱出, minは維持される
        } else if (s[min_idx].substr(k, 1) > s[j].substr(k, 1)) {
          // cout << s[min_idx].substr(k, 1) << "<" << s[j].substr(k, 1) <<
          // endl;
          min_idx = j;
          break; // kのループを脱出, minは入れ替わる
        } else {
          // cout << s[min_idx].substr(k, 1) << "=" << s[j].substr(k, 1) <<
          // endl;
          // それ以外ならば次の桁へ進む
        }
      }
    }
    sorted_s[i] = s[min_idx];
    s[min_idx] = string(n, 'y');
  }

  for (int i = 0; i < n; ++i) {
    cout << sorted_s[i];
  }
  return 0;
}

Fixed submission:
#include <algorithm>
#include <cmath>
#include <iostream>
#include <map>
#include <string>
#include <tuple>

using namespace std;

int main() {
  int n, l;
  cin >> n >> l;
  string s[n];
  for (int i = 0; i < n; ++i) {
    cin >> s[i];
  }

  string sorted_s[n];
  // 挿入ソートで探す
  for (int i = 0; i < n; ++i) {
    int min_idx = 0;
    for (int j = 0; j < n; ++j) {
      for (int k = 0; k < l; ++k) {
        if (s[min_idx].substr(k, 1) < s[j].substr(k, 1)) {
          // cout << s[min_idx].substr(k, 1) << ">" << s[j].substr(k, 1) <<
          // endl;
          break; // kのループを脱出, minは維持される
        } else if (s[min_idx].substr(k, 1) > s[j].substr(k, 1)) {
          // cout << s[min_idx].substr(k, 1) << "<" << s[j].substr(k, 1) <<
          // endl;
          min_idx = j;
          break; // kのループを脱出, minは入れ替わる
        } else {
          // cout << s[min_idx].substr(k, 1) << "=" << s[j].substr(k, 1) <<
          // endl;
          // それ以外ならば次の桁へ進む
        }
      }
    }
    sorted_s[i] = s[min_idx];
    s[min_idx] = string(l, 'z');
  }

  for (int i = 0; i < n; ++i) {
    cout << sorted_s[i];
  }
  return 0;
}
Problem p04044 (C++)

Buggy submission (status: Runtime Error):
#include <algorithm>
#include <cmath>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <limits>
#include <map>
#include <queue>
#include <set>
#include <vector>
#define rep(i, n) for (int i = 0; i < n; i++)
#define rep1(i, n) for (int i = 1; i <= n; i++)
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> P;
typedef vector<vector<int>> Graph;
const int dx[4] = {0, 1, 0, -1};
const int dy[4] = {1, 0, -1, 0};
template <class T> inline bool chmax(T &a, T &b) {
  if (a < b) {
    a = b;
    return true;
  } else
    return false;
}
template <class T> inline bool chmin(T &a, T &b) {
  if (a > b) {
    a = b;
    return true;
  } else
    return false;
}
// struct area

// function area

// main area
int main() {
  int l, n;
  cin >> l >> n;
  vector<string> iroha(l);
  rep(i, n) cin >> iroha[i];
  sort(iroha.begin(), iroha.end());
  rep(i, n) cout << iroha[i];
  cout << endl;
}
/*



*/

Fixed submission:
#include <algorithm>
#include <cmath>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <limits>
#include <map>
#include <queue>
#include <set>
#include <vector>
#define rep(i, n) for (int i = 0; i < n; i++)
#define rep1(i, n) for (int i = 1; i <= n; i++)
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> P;
typedef vector<vector<int>> Graph;
const int dx[4] = {0, 1, 0, -1};
const int dy[4] = {1, 0, -1, 0};
template <class T> inline bool chmax(T &a, T &b) {
  if (a < b) {
    a = b;
    return true;
  } else
    return false;
}
template <class T> inline bool chmin(T &a, T &b) {
  if (a > b) {
    a = b;
    return true;
  } else
    return false;
}
// struct area

// function area

// main area
int main() {
  int n, l;
  cin >> n >> l;
  string s[n];
  rep(i, n) cin >> s[i];
  sort(s, s + n);
  rep(i, n) cout << s[i];
  cout << endl;
}
/*



*/
Problem p04044 (C++)

Buggy submission (status: Runtime Error):
#include <algorithm>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
using namespace std;
#define dbg(x) cerr << #x " = " << x << endl;

const int MAXN = 1 + 3 + 5;
string a[MAXN];
bool cmp(string a, string b) { return a < b; }

int main() {
  int n, l;
  cin >> n >> l;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  sort(a, a + n);
  for (int i = 0; i < n; i++) {
    cout << a[i];
  }
}

Fixed submission:
#include <algorithm>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
using namespace std;
#define dbg(x) cerr << #x " = " << x << endl;

const int MAXN = 1e3 + 5;
string a[MAXN];
bool cmp(string a, string b) { return a < b; }

int main() {
  int n, l;
  cin >> n >> l;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  sort(a, a + n);
  for (int i = 0; i < n; i++) {
    cout << a[i];
  }
}
Problem p04044 (C++)

Buggy submission (status: Runtime Error):
#include <bits/stdc++.h>
#include <iostream>
#include <string>
#define loop(i, n) for (int i = 0; i < (int)n; i++)

using namespace std;

int main() {
  int n;
  cin >> n;

  int l;
  cin >> l;

  string s[n];

  loop(i, n) cin >> s[i];

  sort(s, s + l);

  string ans;

  loop(i, n) ans = ans + s[i];
  cout << ans;
}


Fixed submission:
#include <bits/stdc++.h>
#include <iostream>
#include <string>
#define loop(i, n) for (int i = 0; i < (int)n; i++)

using namespace std;

int main() {
  int n;
  cin >> n;

  int l;
  cin >> l;

  string s[n];

  loop(i, n) cin >> s[i];

  sort(s, s + n);

  string ans;

  loop(i, n) ans = ans + s[i];
  cout << ans;
}
Problem p04044 (C++)

Buggy submission (status: Runtime Error):
#include <bits/stdc++.h>

using namespace std;

int main(void) {
  cin.tie(0);
  ios_base::sync_with_stdio(0);
  int n, l;
  cin >> n >> l;
  vector<string> vs;
  vs.resize(l);
  for (int i = 0; i < n; i++) {
    cin >> vs[i];
  }
  sort(begin(vs), end(vs));
  for (int i = 0; i < n; i++) {
    cout << vs[i];
  }
  return 0;
}
// created: 20.07.2020 16:50:01 IST


Fixed submission:
#include <bits/stdc++.h>

using namespace std;

int main(void) {
  cin.tie(0);
  ios_base::sync_with_stdio(0);
  int n, l;
  cin >> n >> l;
  vector<string> vs;
  vs.resize(n);
  for (int i = 0; i < n; i++) {
    cin >> vs[i];
  }
  sort(begin(vs), end(vs));
  for (int i = 0; i < n; i++) {
    cout << vs[i];
  }
  return 0;
}
// created: 20.07.2020 16:50:01 IST
Problem p04044 (C++)

Buggy submission (status: Runtime Error):
#include <bits/stdc++.h>
#include <vector>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
int main() {
  int a, c;
  cin >> a >> c;
  vector<string> b(a);
  rep(i, a) cin >> b[i];
  sort(b.begin(), b.end());
  rep(i, c) { cout << b[i]; }
}

Fixed submission:
#include <bits/stdc++.h>
#include <vector>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
int main() {
  int a, c;
  cin >> a >> c;
  vector<string> b(a);
  rep(i, a) cin >> b[i];
  sort(b.begin(), b.end());
  rep(i, a) { cout << b[i]; }
}
Problem p04044 (C++)

Buggy submission (status: Runtime Error):
#include <bits/stdc++.h>
using namespace std;

int main() {
  int n, l;
  cin >> n >> l;
  vector<string> s(n);

  int i;
  for (i = 0; i < n; i++) {
    cin >> s[i];
  }

  sort(s.begin(), s.end());

  string ans = {};
  for (i = 0; i < l; i++) {
    ans += s[i];
  }

  cout << ans << endl;
}


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

int main() {
  int n, l;
  cin >> n >> l;
  vector<string> s(n);

  int i;
  for (i = 0; i < n; i++) {
    cin >> s[i];
  }

  sort(s.begin(), s.end());

  string ans = {};
  for (i = 0; i < n; i++) {
    ans += s[i];
  }

  cout << ans << endl;
}
Problem p04044 (C++)

Buggy submission (status: Runtime Error):
#include <algorithm>
#include <cmath>
#include <cstring>
#include <deque>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <stdio.h>
#include <string>
#include <vector>

using namespace std;

#define f first
#define s second
#define pb push_back
#define mp make_pair
#define ll long long
#define pii pair<int, int>
#define pll pair<long long, long long>
#define ull unsigned long long
#define vi vector<int>
#define vll vector<long long>
#define sz(a) (int)a.size()
#define forit(it, s)                                                           \
  for (__typeof(s.begin()) it = s.begin(); it != s.end(); it++)
#define all(a) a.begin(), a.end()
#define sqr(x) ((x) * (x))
#define fname "searching"

const int inf = (int)1e9;
const ll INF = (ll)1e18;
const double eps = 1e-9;
const double pi = acos(-1.0);
const int mod = (int)1e9 + 7;

int n, l;
string s[110];

string solve() {
  cin >> n >> l;
  for (int i = 0; i < n; ++i)
    cin >> s[i];
  sort(s, s + n);
  string ans = "";
  for (int i = 0; i < n; ++i)
    ans += s[i];
  return ans;
}

int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  freopen("in", "r", stdin);
  // freopen("out", "w", stdout);

  cout << solve();

  return 0;
}

Fixed submission:
#include <algorithm>
#include <cmath>
#include <cstring>
#include <deque>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <stdio.h>
#include <string>
#include <vector>

using namespace std;

#define f first
#define s second
#define pb push_back
#define mp make_pair
#define ll long long
#define pii pair<int, int>
#define pll pair<long long, long long>
#define ull unsigned long long
#define vi vector<int>
#define vll vector<long long>
#define sz(a) (int)a.size()
#define forit(it, s)                                                           \
  for (__typeof(s.begin()) it = s.begin(); it != s.end(); it++)
#define all(a) a.begin(), a.end()
#define sqr(x) ((x) * (x))
#define fname "searching"

const int inf = (int)1e9;
const ll INF = (ll)1e18;
const double eps = 1e-9;
const double pi = acos(-1.0);
const int mod = (int)1e9 + 7;

int n, l;
string s[110];

string solve() {
  cin >> n >> l;
  for (int i = 0; i < n; ++i)
    cin >> s[i];
  sort(s, s + n);
  string ans = "";
  for (int i = 0; i < n; ++i)
    ans += s[i];
  return ans;
}

int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  // freopen("in", "r", stdin);
  // freopen("out", "w", stdout);

  cout << solve();

  return 0;
}
Problem p04044 (C++)

Buggy submission (status: Runtime Error):
/**
 * @author: Jun
 * @date  : 03-17-2019
 **/
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

#define el '\n'
#define MOD 1000000007

int n, l;
string arr[105];

bool comp(string a, string b) {
  for (int i = 0; i < l; i++) {
    if (a[i] != b[i]) {
      return a[i] < b[i];
    }
  }
}

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  cin >> n >> l;
  for (int i = 1; i <= n; i++) {
    cin >> arr[i];
  }
  sort(arr + 1, arr + n + 1, comp);
  for (int i = 1; i <= n; i++) {
    cout << arr[i];
  }
  return 0;
}

Fixed submission:
/**
 * @author: Jun
 * @date  : 03-17-2019
 **/
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

#define el '\n'
#define MOD 1000000007

int n, l;
string arr[105];

bool comp(string a, string b) {
  for (int i = 0; i < l; i++) {
    if (a[i] != b[i]) {
      return a[i] < b[i];
    }
  }
  return a[0] < b[0];
}

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  cin >> n >> l;
  for (int i = 1; i <= n; i++) {
    cin >> arr[i];
  }
  sort(arr + 1, arr + n + 1, comp);
  for (int i = 1; i <= n; i++) {
    cout << arr[i];
  }
  return 0;
}
Problem p04044 (C++)

Buggy submission (status: Runtime Error):
#include <algorithm>
#include <iostream>
#include <string>
#include <vector>

using namespace std;

int main() {
  int n, l;
  cin >> n >> l;
  vector<string> s(l);
  for (int i = 0; i < n; i++) {
    cin >> s[i];
  }

  sort(s.begin(), s.end());

  for (int i = 0; i < n; i++) {
    cout << s[i];
  }
  cout << endl;

  return 0;
}

Fixed submission:
#include <algorithm>
#include <iostream>
#include <string>
#include <vector>

using namespace std;

int main() {
  int n, l;
  cin >> n >> l;
  vector<string> s(n);
  for (int i = 0; i < n; i++) {
    cin >> s[i];
  }

  sort(s.begin(), s.end());

  for (int i = 0; i < n; i++) {
    cout << s[i];
  }
  cout << endl;

  return 0;
}
Problem p04044 (C++)

Buggy submission (status: Runtime Error):
#include <algorithm>
#include <iostream>
using namespace std;

int main() {
  int n, l;
  cin >> n >> l;
  string a[l];

  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }

  sort(a, a + n);

  for (int i = 0; i < n; i++) {
    cout << a[i];
  }
}


Fixed submission:
#include <algorithm>
#include <iostream>
using namespace std;

int main() {
  int n, l;
  cin >> n >> l;
  string a[n];

  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }

  sort(a, a + n);

  for (int i = 0; i < n; i++) {
    cout << a[i];
  }
}
Problem p04044 (C++)

Buggy submission (status: Runtime Error):
#include <bits/stdc++.h>
using namespace std;

int main() {
  int N, L;
  cin >> N >> L;

  vector<string> S;
  for (int i = 0; i < N; i++)
    cin >> S.at(i);

  sort(S.begin(), S.end());
  for (int i = 0; i < N; i++) {
    cout << S.at(i);
  }
}

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

int main() {
  int N, L;
  cin >> N >> L;

  vector<string> S(N);
  for (int i = 0; i < N; i++)
    cin >> S.at(i);

  sort(S.begin(), S.end());
  for (int i = 0; i < N; i++) {
    cout << S.at(i);
  }
}
Problem p04044 (C++)

Buggy submission (status: Runtime Error):
#include <bits/stdc++.h>
using namespace std;

int main() {
  int N, L;
  cin >> N >> L;
  vector<string> S(N);
  for (int i = 0; i < N; i++)
    cin >> S.at(i);
  sort(S.begin(), S.end());
  string ans = "";
  for (int i = 0; i < L; i++)
    ans += S.at(i);
  cout << ans << endl;
}

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

int main() {
  int N, L;
  cin >> N >> L;
  vector<string> S(N);
  for (int i = 0; i < N; i++)
    cin >> S.at(i);
  sort(S.begin(), S.end());
  string ans = "";
  for (int i = 0; i < N; i++)
    ans += S.at(i);
  cout << ans << endl;
}