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

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

using namespace std;
typedef long long ll;
typedef vector<int> vi;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);

  int n, l;
  string a[n];
  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];
  }
  return 0;
}


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

using namespace std;
typedef long long ll;
typedef vector<int> vi;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);

  int n, l;
  string a[101];
  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];
  }
  return 0;
}
Problem p04044 (C++)

Buggy submission (status: Runtime Error):
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
typedef long long ll;
using namespace std;
int main() {
  int N, L;
  cin >> N >> L;
  vector<string> S;
  rep(i, N) { cin >> S[i]; }
  sort(S.begin(), S.end());
  rep(i, N) { cout << S[i]; }
  cout << endl;
  return 0;
}

Fixed submission:
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
typedef long long ll;
using namespace std;
int main() {
  int N, L;
  cin >> N >> L;
  vector<string> S(N);
  rep(i, N) { cin >> S[i]; }
  sort(S.begin(), S.end());
  rep(i, N) { cout << S[i]; }
  cout << endl;
  return 0;
}
Problem p04044 (C++)

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

bool compare(string a, string b) {
  int n = a.size();
  for (int i = 0; i < n; i++)
    if (a[i] != b[i])
      return a[i] < b[i];
  return a[n - 1] <= b[n - 1];
}

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


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

bool compare(string a, string b) {
  int n = a.size();
  for (int i = 0; i < n; i++)
    if (a[i] != b[i])
      return a[i] < b[i];
  return a[n - 1] <= b[n - 1];
}

int main() {
  int n, l;
  cin >> n >> l;
  string s[n];
  for (int i = 0; i < n; i++)
    cin >> s[i];
  sort(s, s + n);
  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 <cstring>
#include <iostream>
using namespace std;
int main() {
  int a, b;
  cin >> a >> b;
  string s[a];
  for (int i = 0; i < a; i++) {
    cin >> s[i];
  }

  sort(s, s + 3);
  cout << s[0] << s[1] << s[2] << endl;
}

Fixed submission:
#include <algorithm>
#include <cstring>
#include <iostream>
using namespace std;
int main() {
  int a, b;
  cin >> a >> b;
  string s[a];
  for (int i = 0; i < a; i++) {
    cin >> s[i];
  }

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

  return 0;
}
Problem p04044 (C++)

Buggy submission (status: Runtime Error):
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vs = vector<string>;
using msi = map<string, int>;
using mii = map<int, int>;
using psi = pair<string, int>;
using pii = pair<int, int>;
using vlai = valarray<int>;
#define rep(i, n) for (int i = 0; i < n; i++)
#define range(i, s, n) for (int i = s; i < n; i++)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define fs first
#define sc second
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define INF 1E9
#define EPS 1E-9
#define MOD (1E9 + 7)
#define PI 3.1415926535897932384

std::ostream &operator<<(std::ostream &out, const vector<int> &tgt) {
  string s;
  for (int i = 0; i < tgt.size(); i++) {
    s += (to_string(tgt[i]) + ((i != tgt.size() - 1) ? " " : ""));
  }
  out << s;
  return out;
}

int main() {
  int n, l;
  string s;
  vector<string> ss;
  cin >> n >> l;
  rep(i, n) {
    cin >> s;
    ss.push_back(s);
  }
  // acsort(all(ss));
  rep(i, l) { cout << ss[i]; }
  cout << endl;
}


Fixed submission:
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vs = vector<string>;
using msi = map<string, int>;
using mii = map<int, int>;
using psi = pair<string, int>;
using pii = pair<int, int>;
using vlai = valarray<int>;
#define rep(i, n) for (int i = 0; i < n; i++)
#define range(i, s, n) for (int i = s; i < n; i++)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define fs first
#define sc second
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define INF 1E9
#define EPS 1E-9
#define MOD (1E9 + 7)
#define PI 3.1415926535897932384

std::ostream &operator<<(std::ostream &out, const vector<int> &tgt) {
  string s;
  for (int i = 0; i < tgt.size(); i++) {
    s += (to_string(tgt[i]) + ((i != tgt.size() - 1) ? " " : ""));
  }
  out << s;
  return out;
}

int main() {
  int n, l;
  string s;
  vector<string> ss;
  cin >> n >> l;
  rep(i, n) {
    cin >> s;
    ss.push_back(s);
  }
  sort(all(ss));
  rep(i, n) { cout << ss[i]; }
  cout << endl;
}
Problem p04044 (C++)

Buggy submission (status: Runtime Error):
// RAM RAM

#include <bits/stdc++.h>
#define int long long
#define pb push_back
#define ppb pop_back
#define vi vector<int>
#define mp make_pair

using namespace std;

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

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

  sort(s, s + n);
  for (string x : s) {
    cout << x;
  }
  cout << endl;
}

Fixed submission:
// RAM RAM

#include <bits/stdc++.h>
#define int long long
#define pb push_back
#define ppb pop_back
#define vi vector<int>
#define mp make_pair

using namespace std;

int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);

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

  sort(s, s + n);
  for (string x : s) {
    cout << x;
  }
  cout << endl;
}
Problem p04044 (C++)

Buggy submission (status: Runtime Error):
#include <stdio.h>
#include <string.h>
int main(void) {
  int n, l, j, i;
  char s[100][100];
  char t[100];
  scanf("%d %d", &n, &l);
  for (i = 0; i < n; i++) {
    scanf("%s", &s[i]);
  }
  for (i = 0; i < n - 1; i++) {
    for (j = i + 1; j < n; j++) {
      if (strcmp(s[i], s[j]) > 0) {
        strcpy(t, s[i]);
        strcpy(s[i], s[j]);
        strcpy(s[j], t);
      }
    }
  }
  for (i = 0; i < n; i++) {
    printf("%s", s[i]);
  }
  printf("\n");
  return 0;
}


Fixed submission:
#include <stdio.h>
#include <string.h>
int main(void) {
  int n, l, j, i;
  char s[100][101];
  char t[101];
  scanf("%d %d", &n, &l);
  for (i = 0; i < n; i++) {
    scanf("%s", &s[i]);
  }
  for (i = 0; i < n - 1; i++) {
    for (j = i + 1; j < n; j++) {
      if (strcmp(s[i], s[j]) > 0) {
        strcpy(t, s[i]);
        strcpy(s[i], s[j]);
        strcpy(s[j], t);
      }
    }
  }
  for (i = 0; i < n; i++) {
    printf("%s", s[i]);
  }
  printf("\n");
  return 0;
}
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(l);
  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);
  cout << 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());
  for (int i = 0; i < n; i++)
    cout << s.at(i);
  cout << endl;
}
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> data(N);
  for (int i = 0; i < N; i++) {
    cin >> data[i];
  }
  sort(data.begin(), data.end());

  string s = "";

  for (int i = 0; i < L; i++) {
    s += data[i];
  }

  cout << s << endl;
}


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

int main() {
  int N, L;
  cin >> N >> L;
  vector<string> data(N);
  for (int i = 0; i < N; i++) {
    cin >> data[i];
  }
  sort(data.begin(), data.end());

  string s = "";

  for (int i = 0; i < N; i++) {
    s += data[i];
  }

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

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

using namespace std;

int main() {
  vector<string> v;
  int n, l;
  cin >> n >> l;
  for (int i = 0; i < 3; ++i) {
    string s;
    cin >> s;
    v.push_back(s);
  }
  sort(v.begin(), v.end());
  for (int i = 0; i < n; ++i) {
    cout << v[i];
  }
  return 0;
}


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

using namespace std;

int main() {
  vector<string> v;
  int n, l;
  cin >> n >> l;
  for (int i = 0; i < n; ++i) {
    string s;
    cin >> s;
    v.push_back(s);
  }
  sort(v.begin(), v.end());
  for (int i = 0; i < n; ++i) {
    cout << v[i];
  }
  return 0;
}
Problem p04044 (C++)

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

int main() {
  string str[10], temp;

  int n, l;
  scanf("%d%d", &n, &l);
  for (int i = 0; i < n; ++i) {
    cin >> str[i];
  }

  for (int i = 0; i < n; ++i)
    for (int j = i + 1; j < n; ++j) {
      if (str[i] > str[j]) {
        temp = str[i];
        str[i] = str[j];
        str[j] = temp;
      }
    }

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


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

int main() {
  string str[108], temp;

  int n, l;
  scanf("%d%d", &n, &l);
  for (int i = 0; i < n; ++i) {
    cin >> str[i];
  }

  for (int i = 0; i < n; ++i)
    for (int j = i + 1; j < n; ++j) {
      if (str[i] > str[j]) {
        temp = str[i];
        str[i] = str[j];
        str[j] = temp;
      }
    }

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

Buggy submission (status: Runtime Error):
#include <bits/stdc++.h>
using namespace std;
#define MOD (long long int)(1e9 + 7)
#define ll long long int
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define reps(i, n) for (int i = 1; i <= (int)(n); i++)
#define REP(i, n) for (int i = n - 1; i >= 0; i--)
#define REPS(i, n) for (int i = n; i > 0; i--)
#define FOR(i, a, b) for (int i = a; i < (int)(b); i++)
#define ALL(x) (x).begin(), (x).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define CLR(a) memset((a), 0, sizeof(a))
#define PB push_back
#define MP make_pair
#define SP << " " <<
const int INF = 1001001001;
const ll LINF = 100100100100100100;
#define EPS (1e-10)
const long double PI = acos(-1.0L);
typedef pair<int, int> PII;
typedef pair<ll, ll> PLL;
typedef pair<double, double> PDD;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<ll> VL;
#define chmax(a, b) a = (((a) < (b)) ? (b) : (a))
#define chmin(a, b) a = (((a) > (b)) ? (b) : (a))

__attribute__((constructor)) void initial() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(15);
}

signed main() {
  int n, l;
  cin >> n >> l;
  vector<string> s;
  rep(i, n) cin >> s[i];
  sort(ALL(s));
  rep(i, n) cout << s[i];
  cout << endl;
  return 0;
}


Fixed submission:
#include <bits/stdc++.h>
using namespace std;
#define MOD (long long int)(1e9 + 7)
#define ll long long int
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define reps(i, n) for (int i = 1; i <= (int)(n); i++)
#define REP(i, n) for (int i = n - 1; i >= 0; i--)
#define REPS(i, n) for (int i = n; i > 0; i--)
#define FOR(i, a, b) for (int i = a; i < (int)(b); i++)
#define ALL(x) (x).begin(), (x).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define CLR(a) memset((a), 0, sizeof(a))
#define PB push_back
#define MP make_pair
#define SP << " " <<
const int INF = 1001001001;
const ll LINF = 100100100100100100;
#define EPS (1e-10)
const long double PI = acos(-1.0L);
typedef pair<int, int> PII;
typedef pair<ll, ll> PLL;
typedef pair<double, double> PDD;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<ll> VL;
#define chmax(a, b) a = (((a) < (b)) ? (b) : (a))
#define chmin(a, b) a = (((a) > (b)) ? (b) : (a))

__attribute__((constructor)) void initial() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(15);
}

signed main() {
  int n, l;
  cin >> n >> l;
  vector<string> s(n);
  rep(i, n) cin >> s[i];
  sort(ALL(s));
  rep(i, n) cout << s[i];
  cout << endl;
  return 0;
}
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(l);

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

  sort(s.begin(), s.end());
  string a;
  for (int i = 0; i < n; i++) {
    a += s.at(i);
  }
  cout << a << endl;
  return 0;
}

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 a;
  for (int i = 0; i < n; i++) {
    a += s.at(i);
  }
  cout << a << endl;
  return 0;
}
Problem p04044 (C++)

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

int main() {
  int n, l;
  std::cin >> n >> l;
  std::vector<string> s;
  for (int i = 0; i < (int)(n); i++)
    std::cin >> s[i];
  sort(s.begin(), s.end());
  for (int i = 0; i < (int)(n); i++)
    std::cout << s[i];
  std::cout << std::endl;
}


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

int main() {
  int n, l;
  std::cin >> n >> l;
  std::vector<string> s(n);
  for (int i = 0; i < (int)(n); i++)
    std::cin >> s[i];
  sort(s.begin(), s.end());
  for (int i = 0; i < (int)(n); i++)
    std::cout << s[i];
  std::cout << std::endl;
}
Problem p04044 (C++)

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

int main() {
  int n, l;
  cin >> n >> l;
  vector<string> s;
  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];
  }
}

Fixed submission:
#include <algorithm>
#include <iostream>
#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];
  }
}
Problem p04044 (Python)

Buggy submission (status: Runtime Error):
N = list(map(int, input().split()))
string = [input() for s in range(N[1])]
string.sort()
print("".join(string))


Fixed submission:
N = list(map(int, input().split()))
string = [input() for s in range(N[0])]
string.sort()
print("".join(string))
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[i];
  }

  sort(S.begin(), S.end());
  reverse(S.begin(), S.end());

  string answer = 0;
  for (int i = 0; i < N; i++) {
    answer += S[i];
  }
  cout << answer << 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[i];
  }

  sort(S.begin(), S.end());
  string answer;
  for (int i = 0; i < N; i++) {
    answer += S[i];
  }
  cout << answer << endl;
}
Problem p04044 (C++)

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

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


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

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

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

using namespace std;
typedef vector<string> vs;
bool later(string a, string b) {
  for (int i = 0; i < a.size(); i++) {
    if ((int)a[i] < (int)b[i])
      return true;
    if ((int)a[i] > (int)b[i])
      return false;
  }
  return true;
}

int main() {
  int n, l;
  cin >> n >> l;
  vs s(n);
  for (int i = 0; i < n; i++) {
    cin >> s[i];
  }
  sort(s.begin(), s.end(), later);
  for (int i = 0; i < n; i++) {
    cout << s[i];
  }
  cout << endl;
}

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

using namespace std;
typedef vector<string> vs;
bool later(string a, string b) {
  for (int i = 0; i < a.size(); i++) {
    if ((int)a[i] < (int)b[i])
      return true;
    if ((int)a[i] > (int)b[i])
      return false;
  }
  return false;
}

int main() {
  int n, l;
  cin >> n >> l;
  vs s(n);
  for (int i = 0; i < n; i++) {
    cin >> s[i];
  }
  sort(s.begin(), s.end(), later);
  for (int i = 0; i < n; i++) {
    cout << s[i];
  }
  cout << endl;
}
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());

  string str;
  for (int i = 0; i < n; i++) {
    str += s.at(i);
  }

  cout << str << endl;
  return 0;
}


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 str;
  for (int i = 0; i < n; i++) {
    str += s.at(i);
  }

  cout << str << endl;
  return 0;
}
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(l);
  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);
  }
  cout << 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());
  for (int i = 0; i < n; i++) {
    cout << s.at(i);
  }
  cout << endl;
}
Problem p04044 (C++)

Buggy submission (status: Runtime Error):
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define repi(i, a, b) for (int i = int(a); i < int(b); ++i)
#define all(x) (x).begin(), (x).end()
#define PI 3.14159265358979323846264338327950L
using namespace std;
typedef long long ll;
typedef long double ld;
int main() {
  int n, l;
  cin >> n >> l;
  vector<string> s;
  rep(i, n) cin >> s[i];
  sort(all(s));
  rep(i, n) cout << s[i];
}

Fixed submission:
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define repi(i, a, b) for (int i = int(a); i < int(b); ++i)
#define all(x) (x).begin(), (x).end()
#define PI 3.14159265358979323846264338327950L
using namespace std;
typedef long long ll;
typedef long double ld;
int main() {
  int n, l;
  cin >> n >> l;
  vector<string> s(n);
  rep(i, n) cin >> s[i];
  sort(all(s));
  rep(i, n) cout << s[i];
}
Problem p04044 (C++)

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

auto clk = clock();
typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> pi;
#define F first
#define S second
#define PB push_back
#define MP make_pair
#define Mod 1000000007
#define REP(i, a, b) for (int i = a; i <= b; i++)

bool comp(string s1, string s2) { return (s1 + s2 <= s2 + s1); }

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n, l;
  cin >> n >> l;
  vector<string> v(n);
  for (int i = 0; i < n; i++)
    cin >> v[i];
  sort(v.begin(), v.end(), comp);
  for (int i = 0; i < n; i++)
    cout << v[i];
  cerr << "\n"
       << "Time elapsed: " << (double)(clock() - clk) / CLOCKS_PER_SEC << "\n";
  return 0;
}


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

auto clk = clock();
typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> pi;
#define F first
#define S second
#define PB push_back
#define MP make_pair
#define Mod 1000000007
#define REP(i, a, b) for (int i = a; i <= b; i++)

bool comp(string s1, string s2) { return (s1 + s2 <= s2 + s1); }

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n, l;
  cin >> n >> l;
  vector<string> v(n);
  for (int i = 0; i < n; i++)
    cin >> v[i];
  sort(v.begin(), v.end());
  for (int i = 0; i < n; i++)
    cout << v[i];
  cerr << "\n"
       << "Time elapsed: " << (double)(clock() - clk) / CLOCKS_PER_SEC << "\n";
  return 0;
}
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(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];
  }

  return 0;
}

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[i];
  }

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

  for (int i = 0; i < N; i++) {
    cout << S[i];
  }

  return 0;
}
Problem p04044 (C++)

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

int n, l;

bool comp(string x, string y) {
  rep(i, l) {
    if (x.at(i) != y.at(i))
      return x.at(i) < y.at(i);
  }
  return true;
}

int main() {
  cin >> n >> l;
  vector<string> s(n);
  rep(i, n) cin >> s.at(i);

  sort(s.begin(), s.end(), comp);
  string ans = "";
  ans.reserve(n * l);
  rep(i, n) ans += s.at(i);
  cout << ans << endl;

  return 0;
}

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

int n, l;

bool comp(string x, string y) { return x + y < y + x; }

int main() {
  cin >> n >> l;
  vector<string> s(n);
  rep(i, n) cin >> s.at(i);

  sort(s.begin(), s.end(), comp);
  string ans = "";
  ans.reserve(n * l);
  rep(i, n) ans += s.at(i);
  cout << ans << endl;

  return 0;
}
Problem p04044 (C++)

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

typedef long int lint;
typedef long long int llint;

#define EACH(i, c)                                                             \
  for (__typeof((c).begin()) i = (c).begin(); i != (c).end(); ++i)
#define ALL(c) (c).begin(), (c).end()
#define FOR(i, s, e) for (int i = (s); i < (int)(e); ++i)
#define REP(i, n) FOR(i, 0, n)

template <typename T> void print(const std::vector<T> &v, char sep = ' ') {
  for (int i = 0; i < (int)v.size(); i++) {
    if (i != 0)
      cout << sep;
    cout << v[i];
  }
  cout << endl;
}

int main() {
  int n, l;
  cin >> n >> l;
  string str[l + 1], res;

  REP(i, n) cin >> str[i];
  sort(str, str + n);

  REP(i, n) res += str[i];
  cout << res << endl;
}


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

typedef long int lint;
typedef long long int llint;

#define EACH(i, c)                                                             \
  for (__typeof((c).begin()) i = (c).begin(); i != (c).end(); ++i)
#define ALL(c) (c).begin(), (c).end()
#define FOR(i, s, e) for (int i = (s); i < (int)(e); ++i)
#define REP(i, n) FOR(i, 0, n)

template <typename T> void print(const std::vector<T> &v, char sep = ' ') {
  for (int i = 0; i < (int)v.size(); i++) {
    if (i != 0)
      cout << sep;
    cout << v[i];
  }
  cout << endl;
}

int main() {
  int n, l;
  cin >> n >> l;
  string str[101], res;

  REP(i, n) cin >> str[i];
  sort(str, str + n);

  REP(i, n) res += str[i];
  cout << res << endl;
}
Problem p04044 (C++)

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

#define sws                                                                    \
  ios_base::sync_with_stdio(0);                                                \
  cin.tie(0);                                                                  \
  cout.tie(0)
#define INFINITO 1000000000
#define ll long long
#define vi vector<int>
#define pb push_back
#define pii pair<int, int>
#define mp make_pair
#define ff first
#define ss second
#define all(x) x.begin(), x.end()
#define fo(i, n) for (int i = 0; i < n; i++)

int main() {

  int n, l;
  cin >> n >> l;
  vector<string> vs;
  fo(i, n) cin >> vs[i];

  sort(all(vs));
  fo(i, n) cout << vs[i];
  cout << endl;

  return 0;
}

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

#define sws                                                                    \
  ios_base::sync_with_stdio(0);                                                \
  cin.tie(0);                                                                  \
  cout.tie(0)
#define INFINITO 1000000000
#define ll long long
#define vi vector<int>
#define pb push_back
#define pii pair<int, int>
#define mp make_pair
#define ff first
#define ss second
#define all(x) x.begin(), x.end()
#define fo(i, n) for (int i = 0; i < n; i++)

int main() {

  int n, l;
  cin >> n >> l;
  vector<string> vs(n);
  fo(i, n) cin >> vs[i];

  sort(all(vs));
  fo(i, n) cout << vs[i];
  cout << endl;

  return 0;
}
Problem p04044 (C++)

Buggy submission (status: Runtime Error):
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <bitset>    // bitset
#include <cctype>    // isupper, islower, isdigit, toupper, tolower
#include <cmath>
#include <cstdint>       // int64_t, int*_t
#include <cstdio>        // printf
#include <deque>         // deque
#include <iostream>      // cout, endl, cin
#include <map>           // map
#include <queue>         // queue, priority_queue
#include <set>           // set
#include <stack>         // stack
#include <string>        // string, to_string, stoi
#include <tuple>         // tuple, make_tuple
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <utility>       // pair, make_pair
#include <vector>        // vector

using namespace std;
typedef long long ll;

#define rep(i, n) for (int i = 0; i < (n); i++)
#define rep2(i, a, b) for (int i = (a); i < (b); ++i)
#define all(a) (a).begin(), (a).end()

int count(int N) {
  int cnt = 0;
  while (N) {
    cnt += N % 10;
    N /= 10;
  }
  return cnt;
}

int main() {
  int N, K;
  cin >> N >> K;
  vector<string> l(N + 1);
  rep(i, N) cin >> l[i];
  sort(l.begin(), l.begin() + N);

  string ans = "";
  rep(i, K) { ans += l[i]; }
  cout << ans << endl;
  return 0;
}


Fixed submission:
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <bitset>    // bitset
#include <cctype>    // isupper, islower, isdigit, toupper, tolower
#include <cmath>
#include <cstdint>       // int64_t, int*_t
#include <cstdio>        // printf
#include <deque>         // deque
#include <iostream>      // cout, endl, cin
#include <map>           // map
#include <queue>         // queue, priority_queue
#include <set>           // set
#include <stack>         // stack
#include <string>        // string, to_string, stoi
#include <tuple>         // tuple, make_tuple
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <utility>       // pair, make_pair
#include <vector>        // vector

using namespace std;
typedef long long ll;

#define rep(i, n) for (int i = 0; i < (n); i++)
#define rep2(i, a, b) for (int i = (a); i < (b); ++i)
#define all(a) (a).begin(), (a).end()

int count(int N) {
  int cnt = 0;
  while (N) {
    cnt += N % 10;
    N /= 10;
  }
  return cnt;
}

int main() {
  int N, K;
  cin >> N >> K;
  vector<string> l(N + 1);
  rep(i, N) cin >> l[i];
  sort(l.begin(), l.begin() + N);

  string ans = "";
  rep(i, N) { ans += l[i]; }
  cout << ans << endl;
  return 0;
}
Problem p04044 (C++)

Buggy submission (status: Runtime Error):
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
int main() {
  int N, L;
  cin >> N >> L;
  string C;
  vector<string> vec;
  rep(i, N) {
    cin >> C;
    vec.at(i) = C;
  }
  sort(vec.begin(), vec.end());
  rep(i, N) { cout << vec.at(i); }
}


Fixed submission:
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
int main() {
  int N, L;
  cin >> N >> L;
  string C;
  vector<string> vec(N);
  rep(i, N) {
    cin >> C;
    vec.at(i) = C;
  }
  sort(vec.begin(), vec.end());
  rep(i, N) { cout << vec.at(i); }
}
Problem p04044 (C++)

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

int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  int n, l;
  string ans = "";
  cin >> n >> l;
  vector<string> v;
  for (auto &x : v)
    cin >> x;
  sort(v.begin(), v.end());
  for (int i = 0; i < n; i++)
    ans += v[i];
  cout << ans << "\n";
  return 0;
}

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

int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  int n, l;
  string ans = "";
  cin >> n >> l;
  vector<string> v(n);
  for (auto &x : v)
    cin >> x;
  sort(v.begin(), v.end());
  for (int i = 0; i < n; i++)
    ans += v[i];
  cout << ans << "\n";
  return 0;
}
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());

  string ss;
  for (int i = 0; i < n; i++)
    ss += s.at(i);

  cout << ss << endl;

  return 0;
}


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 ss;
  for (int i = 0; i < n; i++)
    ss += s.at(i);

  cout << ss << endl;

  return 0;
}
Problem p04044 (C++)

Buggy submission (status: Runtime Error):
#include <bits/stdc++.h>
using namespace std;
int main() {
  long n, m, i;
  string a[100];
  cin >> n >> m;
  for (i = 1; i <= n; i++)
    cin >> a[i];
  sort(a, a + n + 1);
  for (i = 1; i <= n; i++)
    cout << a[i];
  cout << endl;
  return 0;
}

Fixed submission:
#include <bits/stdc++.h>
using namespace std;
int main() {
  long n, m, i;
  string a[1000];
  cin >> n >> m;
  for (i = 1; i <= n; i++)
    cin >> a[i];
  sort(a, a + n + 1);
  for (i = 1; i <= n; i++)
    cout << a[i];
  cout << endl;
  return 0;
}
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> vec(L);
  for (int i = 0; i < N; i++) {
    cin >> vec.at(i);
  }
  sort(vec.begin(), vec.end());

  for (int i = 0; i < N; i++) {
    cout << vec.at(i);
  }
  cout << endl;
}

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

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

  vector<string> vec(N);
  for (int i = 0; i < N; i++) {
    cin >> vec.at(i);
  }
  sort(vec.begin(), vec.end());

  for (int i = 0; i < N; i++) {
    cout << vec.at(i);
  }
  cout << endl;
}
Problem p04044 (Python)

Buggy submission (status: Runtime Error):
L, N = map(int, input().split())
S = [input() for _ in range(N)]
S.sort()
print("".join(S))


Fixed submission:
N, L = map(int, input().split())
S = [input() for _ in range(N)]
S.sort()
print("".join(S))
Problem p04044 (C++)

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

Fixed submission:
#include <bits/stdc++.h>
using namespace std;
int main(void) {
  int n, l;
  cin >> n >> l;
  vector<string> input(n);
  for (int i = 0; i < n; i++) {
    cin >> input[i];
  }
  sort(input.begin(), input.end());
  for (int i = 0; i < n; i++) {
    cout << input[i];
  }
  cout << endl;
  return 0;
}
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 out = "";
  for (int i = 0; i < N; i++) {
    out += S.at(i);
    S.erase(S.begin());
  }
  cout << out << 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 out = "";
  for (int i = 0; i < N; i++) {
    out += S.at(i);
  }
  cout << out << endl;
}
Problem p04044 (C++)

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

int main() {
  int N;
  cin >> N;
  int L;
  cin >> L;
  vector<string> x(N);
  for (int i = 0; i < N; ++i) {
    cin >> x[i];
  }
  sort(x.begin(), x.end());
  cout << x[0] << x[1] << x[2] << endl;
  return 0;
}

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

int main() {
  int N;
  cin >> N;
  int L;
  cin >> L;
  vector<string> x(N);
  for (int i = 0; i < N; ++i) {
    cin >> x[i];
  }
  sort(x.begin(), x.end());
  for (int i = 0; i < N; ++i) {
    cout << x[i];
  }
  cout << endl;
  return 0;
}
Problem p04044 (C++)

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

int main() {
  ll n, l;
  cin >> n >> l;
  string s[n];
  rep(i, n) { cin >> s[i]; }
  sort(s[n].begin(), s[n].end());
  rep(i, n) { cout << s[i]; }
  cout << endl;
}

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

int main() {
  ll 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 <bitset>
#include <cassert>
#include <functional>
#include <iomanip>
#include <iostream>
#include <limits.h>
#include <map>
#include <math.h>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <vector>
using namespace std;
long long MOD = 1e9 + 7;

int N, L;
vector<string> S;

int main() {
  cin >> N >> L;
  S.resize(N);
  for (int n = 0; n < N; n++) {
    cin >> S[n];
  }
  sort(S.begin(), S.end(), [](string a, string b) {
    for (int l = 0; l < L; l++) {
      if (a[l] != b[l])
        return a[l] < b[l];
    }
    return true;
  });
  for (int n = 0; n < N; n++) {
    cout << S[n];
  }
  cout << endl;
  return 0;
}

Fixed submission:
#include <algorithm>
#include <bitset>
#include <cassert>
#include <functional>
#include <iomanip>
#include <iostream>
#include <limits.h>
#include <map>
#include <math.h>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <vector>
using namespace std;
long long MOD = 1e9 + 7;

int N, L;
vector<string> S;

int main() {
  cin >> N >> L;
  S.resize(N);
  for (int n = 0; n < N; n++) {
    cin >> S[n];
  }
  sort(S.begin(), S.end());
  for (int n = 0; n < N; n++) {
    cout << S[n];
  }
  cout << endl;
  return 0;
}
Problem p04044 (C++)

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

#define IOS                                                                    \
  ios::sync_with_stdio(0);                                                     \
  cin.tie(0);                                                                  \
  cout.tie(0);
#define endl "\n"
#define ll long long
#define pii pair<int, int>
#define all(x) begin(x), end(x)
#define loop(i, n) for (int i = 0; i < n; i++)
#define rep(i, a, b, c) for (int i = a; i < b; i += c)
#define brep(i, a, b, c) for (int i = a; i > b; i -= c)
#define tc(t)                                                                  \
  int t;                                                                       \
  cin >> t;                                                                    \
  while (t--)
#define sz(v) int((v).size())
#define pb push_back

const int N = 2e5 + 10;

using namespace std;

int main() {

#ifndef ONLINE_JUDGE
  freopen("input.txt", "r", stdin);
  freopen("output.txt", "w", stdout);
#endif

  IOS;

  int n, l;
  cin >> n >> l;

  vector<string> s(n);

  loop(i, n) { cin >> s.at(i); }

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

  loop(i, n) { cout << s.at(i); }

  return 0;
}


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

#define IOS                                                                    \
  ios::sync_with_stdio(0);                                                     \
  cin.tie(0);                                                                  \
  cout.tie(0);
#define endl "\n"
#define ll long long
#define pii pair<int, int>
#define all(x) begin(x), end(x)
#define loop(i, n) for (int i = 0; i < n; i++)
#define rep(i, a, b, c) for (int i = a; i < b; i += c)
#define brep(i, a, b, c) for (int i = a; i > b; i -= c)
#define tc(t)                                                                  \
  int t;                                                                       \
  cin >> t;                                                                    \
  while (t--)
#define sz(v) int((v).size())
#define pb push_back

const int N = 2e5 + 10;

using namespace std;

int main() {

  IOS;

  int n, l;
  cin >> n >> l;

  vector<string> s(n);

  loop(i, n) { cin >> s.at(i); }

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

  loop(i, n) { cout << s.at(i); }

  return 0;
}
Problem p04044 (C++)

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

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

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

#define rep(i, n) for (int i = 0; i < n; i++)

int main() {
  int N, L;
  cin >> N >> L;
  vector<string> a(L);

  rep(i, N) {
    string S;
    cin >> S;
    a.at(i) = S;
  }

  string lib;
  rep(i, N) {
    sort(a.begin(), a.end());
    lib += a.at(i);
  }
  cout << lib << endl;

  return 0;
}

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

#define rep(i, n) for (int i = 0; i < n; i++)

int main() {
  int N, L;
  cin >> N >> L;
  vector<string> a(N);

  rep(i, N) {
    string S;
    cin >> S;
    a.at(i) = S;
  }

  string lib;
  rep(i, N) {
    sort(a.begin(), a.end());
    lib += a.at(i);
  }
  cout << lib << endl;

  return 0;
}
Problem p04044 (C++)

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

int main(void) {
  int n, l;
  cin >> n >> l;
  int i;
  string s[3];

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

  sort(s, s + n);

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

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

int main(void) {
  int n, l;
  cin >> n >> l;
  int i;
  string s[n];

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

  sort(s, s + n);

  for (i = 0; i < n; i++) {
    cout << s[i];
  }
  return 0;
}
Problem p04044 (Python)

Buggy submission (status: Runtime Error):
[
    print("".join(sorted(input() for _ in range(l))))
    for n, l in [map(int, input().split())]
]


Fixed submission:
[
    print("".join(sorted(input() for _ in range(n))))
    for n, l in [map(int, input().split())]
]
Problem p04044 (C++)

Buggy submission (status: Runtime Error):
#include "bits/stdc++.h"
#define rep(i, n) for (int i = 0; i < n; i++)
#define mrep(p, mp) for (auto p : mp)
using namespace std;
using ll = long long;
using P = pair<int, int>;

int main() {
  int n, l;
  cin >> n >> l;
  vector<string> s(n);
  rep(i, n) cin >> s[i];
  string sum;
  sort(s.begin(), s.end());
  rep(i, l) sum += s[i];
  cout << sum << endl;
}

Fixed submission:
#include "bits/stdc++.h"
#define rep(i, n) for (int i = 0; i < n; i++)
#define mrep(p, mp) for (auto p : mp)
using namespace std;
using ll = long long;
using P = pair<int, int>;

int main() {
  int n, l;
  cin >> n >> l;
  vector<string> s(n);
  rep(i, n) cin >> s[i];
  string sum;
  sort(s.begin(), s.end());
  rep(i, n) sum += s[i];
  cout << sum << endl;
}
Problem p04044 (C++)

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

int main() {
  int n, l;
  cin >> n >> l;
  string s[l];
  rep(i, n) cin >> s[i];
  sort(s, s + n);
  rep(i, n) cout << s[i];
  return 0;
}


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

int main() {
  int n, l;
  cin >> n >> l;
  string s[100];
  rep(i, n) cin >> s[i];
  sort(s, s + n);
  rep(i, n) cout << s[i];
  return 0;
}
Problem p04044 (C++)

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

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

  vector<string> vec(n);

  rep(i, m) { cin >> vec.at(i); }

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

  rep(i, n) { cout << vec.at(i); }
}

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

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

  vector<string> vec(n);

  rep(i, n) { cin >> vec.at(i); }

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

  rep(i, n) { cout << vec.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(L);
  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);
  }
  cout << 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());
  for (int i = 0; i < N; i++) {
    cout << S.at(i);
  }
  cout << endl;
}
Problem p04044 (C++)

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

#define MAX_N (3)
#define MAX_L (3)

int compare(const void *p1, const void *p2) {
  const char *s1 = (const char *)p1, *s2 = (const char *)p2;
  return strcmp(s1, s2);
}

int main(int argc, char *argv[]) {
  int N, L;
  char s[MAX_N][MAX_L + 2];
  scanf("%d %d", &N, &L);
  fgets(s[0], MAX_L, stdin); // get rid of newline
  for (int i = 0; i < N; i++) {
    fgets(s[i], MAX_L + 2, stdin);
    s[i][L] = '\0';
  }
  qsort(s, N, MAX_L + 2, compare);
  for (int i = 0; i < N; i++)
    printf("%s", s[i]);
  printf("\n");

  return 0;
}


Fixed submission:
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#define MAX_N (100)
#define MAX_L (100)

int compare(const void *p1, const void *p2) {
  const char *s1 = (const char *)p1, *s2 = (const char *)p2;
  return strcmp(s1, s2);
}

int main(int argc, char *argv[]) {
  int N, L;
  char s[MAX_N][MAX_L + 2];
  scanf("%d %d", &N, &L);
  fgets(s[0], MAX_L, stdin); // get rid of newline
  for (int i = 0; i < N; i++) {
    fgets(s[i], MAX_L + 2, stdin);
    s[i][L] = '\0';
  }
  qsort(s, N, MAX_L + 2, compare);
  for (int i = 0; i < N; i++)
    printf("%s", s[i]);
  printf("\n");

  return 0;
}
Problem p04044 (C++)

Buggy submission (status: Runtime Error):
#include <algorithm>
#include <iostream>
#include <string>
using namespace std;
string s[101];
static bool cmp(string s1, string s2) { return s1 <= s2 ? true : false; }
int main() {
  int n, m, count = 0, i, j;
  cin >> n >> m;

  for (i = 0; i < n; i++) {
    cin >> s[i];
    count++;
  }
  sort(s, s + n, cmp);
  for (i = 0; i < n; i++) {
    cout << s[i];
  }
  cout << endl;
  return 0;
}

Fixed submission:
#include <algorithm>
#include <iostream>
#include <string>
using namespace std;
string s[1001];
bool cmp(string s1, string s2) { return (s1 + s2) < (s2 + s1) ? true : false; }
int main() {
  int n, m, count = 0, i, j;
  cin >> n >> m;

  for (i = 0; i < n; i++) {
    cin >> s[i];
    count++;
  }
  sort(s, s + n, cmp);
  for (i = 0; i < n; i++) {
    cout << s[i];
  }
  cout << endl;
  return 0;
}
Problem p04044 (C++)

Buggy submission (status: Runtime Error):
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define ll long long
#define ull unsigned long long
#define F first
#define S second
#define eps 1e-6
#define mp make_pair
const long long INF = 1e18 + 2;
const int MX = 103;
int N, M, k;
int arr[MX];
string s[MX];
bool cmp(string &a, string &b) { return a + b <= b + a; }
int main() {
  int L;
  cin >> N >> L;
  for (int i = 0; i < N; i++) {
    cin >> s[i];
  }
  if (N > 1)
    sort(s, s + N, cmp);
  for (int i = 0; i < N; i++)
    cout << s[i];
  return 0;
}


Fixed submission:
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define ll long long
#define ull unsigned long long
#define F first
#define S second
#define eps 1e-6
#define mp make_pair
const long long INF = 1e18 + 2;
const int MX = 103;
int N, M, k;
int arr[MX];
string s[MX];
bool cmp(string &a, string &b) { return a + b <= b + a; }
int main() {
  int L;
  cin >> N >> L;
  for (int i = 0; i < N; i++) {
    cin >> s[i];
  }
  if (N > 1)
    sort(s, s + N);
  for (int i = 0; i < N; i++)
    cout << s[i];
  return 0;
}
Problem p04044 (C++)

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

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

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

#define REP(i, n) for (int i = 0; i < n; i++)
using namespace std;

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

  vector<string> s(N);

  REP(i, N)
  cin >> s[i];

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

  string len = "";

  REP(i, N + 1)
  len += s[i];

  cout << len << endl;
}

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

#define REP(i, n) for (int i = 0; i < n; i++)
using namespace std;

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

  vector<string> s(N);

  REP(i, N)
  cin >> s[i];

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

  string len = "";

  REP(i, N)
  len += s[i];

  cout << len << endl;
}