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

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

#define IOS                                                                    \\
  ios_base::sync_with_stdio(0);                                                \\
  cin.tie(0);                                                                  \\
  cout.tie(0);
#define deb(x) cout << #x << " " << x << endl;

typedef long long int ll;
typedef map<pair<int, int>, ll> mpi;

long shUtils(int cnt, int curr, int a[], int n, mpi &dp) {

  if (cnt >= n / 2) {
    return 0;
  }

  if (curr >= n) {
    return LONG_MIN;
  }

  if (n / 2 - cnt > (n - curr + 1) / 2)
    return LONG_MIN;

  pair<int, int> p = {cnt, n / 2 - curr};

  if (dp.find(p) != dp.end()) {
    // deb(dp[p]);
    return dp[p];
  }

  ll tmp = shUtils(cnt + 1, curr + 2, a, n, dp);
  ll choice1;

  if (tmp == LONG_MIN)
    choice1 = tmp;
  else
    choice1 = a[curr] + tmp;

  ll choice2 = shUtils(cnt, curr + 1, a, n, dp);

  ll ans = max(choice1, choice2);
  dp[p] = ans;

  return ans;
}

ll selectHalf(int a[], int n) {

  mpi dp;

  ll ans = shUtils(0, 0, a, n, dp); // cnt and index passed
  return ans;
}

int main() {

  IOS

      int n;
  cin >> n;

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

  cout << selectHalf(a, n) << endl;

  return 0;
}

Error: TLE

Fixed submission:

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

#define IOS                                                                    \\
  ios_base::sync_with_stdio(0);                                                \\
  cin.tie(0);                                                                  \\
  cout.tie(0);
#define deb(x) cout << #x << " " << x << endl;

typedef long long int ll;
typedef map<pair<int, int>, ll> mpi;

long shUtils(int cnt, int curr, int a[], int n, mpi &dp) {

  if (cnt >= n / 2) {
    return 0;
  }

  if (curr >= n) {
    return LONG_MIN;
  }

  pair<int, int> p = {cnt, n / 2 - curr};

  if (dp.find(p) != dp.end())
    return dp[p];

  ll tmp = shUtils(cnt + 1, curr + 2, a, n, dp);
  ll choice1;

  if (tmp == LONG_MIN)
    choice1 = tmp;
  else
    choice1 = a[curr] + tmp;

  ll choice2 = shUtils(cnt, curr + 1, a, n, dp);

  ll ans = max(choice1, choice2);
  dp[p] = ans;

  return ans;
}

ll selectHalf(int a[], int n) {

  mpi dp;

  ll ans = shUtils(0, 0, a, n, dp); // cnt and index passed
  return ans;
}

int main() {

  IOS

      int n;
  cin >> n;

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

  cout << selectHalf(a, n) << endl;

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

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

#define IOS                                                                    \\
  ios_base::sync_with_stdio(0);                                                \\
  cin.tie(0);                                                                  \\
  cout.tie(0);
#define deb(x) cout << #x << " " << x << endl;

typedef long long int ll;

#define N 200001
ll ans = 0;
ll a[N];
int choose, n;
unordered_map<int, unordered_map<int, ll>> dp;
unordered_map<int, unordered_map<int, bool>> can_find;

bool haveProcessed(int cur, int more) {
  return can_find.find(cur) != can_find.end() &&
         can_find[cur].find(more) != can_find[cur].end();
}

bool calc(int cur, int more, ll *max_val) {

  if (more == 0) {
    *max_val = 0;
    return true;
  }

  int rest_arr_size = n - cur;

  if (more > (rest_arr_size - rest_arr_size / 2))
    return false;

  if (cur >= n) {
    return false;
  }

  if (haveProcessed(cur, more)) {
    *max_val = dp[cur][more];
    return can_find[cur][more];
  }

  ll val_with_rest, val_with = LONG_MIN;
  ll val_without_rest, val_without = LONG_MIN;

  bool can_find_with = calc(cur + 2, more - 1, &val_with_rest);
  if (can_find_with) {
    val_with = a[cur] + val_with_rest;
  }

  bool can_find_without = calc(cur + 1, more, &val_without_rest);
  if (can_find_without) {
    val_without = val_without_rest;
  }

  *max_val = max(val_with, val_without);

  can_find[cur][more] = can_find_with || can_find_without;
  dp[cur][more] = *max_val;

  return can_find[cur][more];
}

int main() {

  IOS

          cin >>
      n;

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

  choose = n / 2;

  ll max_val = 0;
  calc(0, choose, &max_val);

  cout << max_val;

  return 0;
}

Error: TLE

Fixed submission:

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

#define IOS                                                                    \\
  ios_base::sync_with_stdio(0);                                                \\
  cin.tie(0);                                                                  \\
  cout.tie(0);
#define deb(x) cout << #x << " " << x << endl;

typedef long long int ll;

#define N 200001
ll dp[N];
ll ans = 0;
ll a[N];
int choose, n;

void calc(int cur, int count, ll sum) {
  if (count == choose) {
    ans = max(ans, sum);
    return;
  }

  if (cur >= n)
    return;

  calc(cur + 1, count, sum);

  sum = sum + a[cur];

  calc(cur + 2, count + 1, sum);
}

int main() {

  IOS

          cin >>
      n;

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

  choose = n / 2;
  // memset(dp, -1, sizeof(dp))

  calc(0, 0, 0);

  cout << ans;

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

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
#define rep(i, n) for (ll i = 0; i < (n); ++i)
#define vcout(v)                                                               \\
  rep(i, v.size()) cout << v[i] << " ";                                        \\
  cout << endl
#define mcout(m)                                                               \\
  rep(j, m.size()) { vcout(m[j]); }
const ll MOD = 1e9 + 7;

int mainsolve() {

  ll n;
  cin >> n;
  vector<ll> a(n);
  rep(i, n) cin >> a[i];

  map<P, ll> dp; // dp[P(now,cnt)] = val : nowから始めてcnt個とるときの最大値val
  dp[P(n - 1, 1)] = a[n - 1];
  if (n - 2 >= 0)
    dp[P(n - 2, 1)] = max(a[n - 1], a[n - 2]);

  for (ll now = n - 3; now >= 0; now--) {

    ll tmp;
    if ((n - now) % 2 == 0)
      tmp = (n - now) / 2;
    else
      tmp = (n - now) / 2 + 1;

    for (ll cnt = max(1ll, tmp - 2); tmp >= cnt; cnt++) {
      ll dpUse, dpNotUse;
      if (!dp.count(P(now + 1, cnt)))
        dpNotUse = -1e18;
      else
        dpNotUse = dp[P(now + 1, cnt)];
      if (!dp.count(P(now + 2, cnt - 1)))
        dpUse = -1e18;
      else
        dpUse = dp[P(now + 2, cnt - 1)];

      // dp[P(now,cnt)] = max(dp[P(now+1,cnt)], dp[P(now+2,cnt-1)] + a[now]);
      dp[P(now, cnt)] = max(dpNotUse, dpUse + a[now]);
    }
  }

  cout << dp[P(0, n / 2)] << endl;
  return 0;
}

int main() {

  // ll TC;cin>>TC;rep(I,TC){cout<<"case:"<<I+1<<"---"<<endl; // comment out!
  mainsolve();
  //} // comment out!
  return 0;
}


Error: TLE

Fixed submission:

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
#define rep(i, n) for (ll i = 0; i < (n); ++i)
#define vcout(v)                                                               \\
  rep(i, v.size()) cout << v[i] << " ";                                        \\
  cout << endl
#define mcout(m)                                                               \\
  rep(j, m.size()) { vcout(m[j]); }
const ll MOD = 1e9 + 7;

int mainsolve() {

  ll n;
  cin >> n;
  vector<ll> a(n);
  rep(i, n) cin >> a[i];

  map<P, ll> dp; // dp[P(now,cnt)] = val : nowから始めてcnt個とるときの最大値val
  dp[P(n - 1, 1)] = a[n - 1];
  if (n - 2 >= 0)
    dp[P(n - 2, 1)] = max(a[n - 1], a[n - 2]);

  for (ll now = n - 3; now >= 0; now--) {

    ll tmp;
    if ((n - now) % 2 == 0)
      tmp = (n - now) / 2;
    else
      tmp = (n - now) / 2 + 1;

    for (ll cnt = max(0ll, tmp - 30); tmp >= cnt; cnt++) {
      if (cnt == 0)
        dp[P(now, cnt)] = dp[P(now + 1, cnt)];
      else
        dp[P(now, cnt)] =
            max(dp[P(now + 1, cnt)], dp[P(now + 2, cnt - 1)] + a[now]);
    }
  }

  cout << dp[P(0, n / 2)] << endl;
  return 0;
}

int main() {

  // ll TC;cin>>TC;rep(I,TC){cout<<"case:"<<I+1<<"---"<<endl; // comment out!
  mainsolve();
  //} // comment out!
  return 0;
}
Problem p02717 (C++) — buggy submission, verdict: Runtime Error

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

void swap(int &x, int &y) {

  int temp;
  temp = x;
  x = y;
  y = temp;
}
int main() {

  int x, y, z;
  cin >> x >> y >> z;
  swap(x, y);
  swap(x, z);
  cout << x << " " << y << " " << z;

  return 0;
}

Error: WA

Fixed submission:

/*ctrl+shift+D =?repeat line
ctrl+x delete a line
*/
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;

#define ff first
#define ss second
#define int long long
#define pb push_back
#define mp make_pair
#define pii pair<int, int>
#define vi vector<int>
#define mii map<int, int>
#define pqb priority_queue<int>
#define pqs priority_queue<int, vi, greater<int>>
#define setbits(x) __builtin_popcountll(x)
#define zrobits(x) __builtin_ctzll(x)
#define mod 1000000007
#define inf 1e18
#define ps(x, y) fixed << setprecision(y) << x
#define mk(arr, n, type) type *arr = new type[n];
#define w(x)                                                                   \\
  int x;                                                                       \\
  cin >> x;                                                                    \\
  while (x--)
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

typedef tree<int, null_type, less<int>, rb_tree_tag,
             tree_order_statistics_node_update>
    pbds;

void c_p_c() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
#ifndef ONLINE_JUDGE
  freopen("input.txt", "r", stdin);
  freopen("output.txt", "w", stdout);
#endif
}
void swap(int &x, int &y) {

  int temp;
  temp = x;
  x = y;
  y = temp;
}

int32_t main() {
  c_p_c();
  int x, y, z;
  cin >> x >> y >> z;
  swap(x, y);
  swap(x, z);
  cout << x << " " << y << " " << z;
}
Problem p02717 (C++) — buggy submission, verdict: Runtime Error

#include <bits/stdc++.h>
#include <iostream>
using namespace std;
#define fastio                                                                 \\
  ios_base::sync_with_stdio(false);                                            \\
  cin.tie(NULL);

#define ull unsigned long long int
#define ll long long int
#define ld double
#define ui unsigned int
#define pb push_back
#define mp make_pair
#define ff first
#define ss second

#define fr(i, a, b) for (int i = (a), _b = (b); i <= _b; i++)
#define frr(i, a, b) for (int i = (a), _b = (b); i >= _b; i--)
#define rep(i, n) for (int i = 0, _n = (n); i < _n; i++)
#define repr(i, n) for (long long i = (n)-1; i >= 0; i--)

ll gcd(ll a, ll b) {
  if (a == 0)
    return b;
  return gcd(b % a, a);
}

int main() {

  fastio;

  ll t;
  t = 1;
  while (t--) {
    ll x, y, z;
    cin >> x >> y >> z;
    cout << z << " " << x << " " << y;
  }
  return 0;
}

Error: WA

Fixed submission:

#include <bits/stdc++.h>
#include <iostream>
using namespace std;
#define fastio                                                                 \\
  ios_base::sync_with_stdio(false);                                            \\
  cin.tie(NULL);

#define ull unsigned long long int
#define ll long long int
#define ld double
#define ui unsigned int
#define pb push_back
#define mp make_pair
#define ff first
#define ss second

#define fr(i, a, b) for (int i = (a), _b = (b); i <= _b; i++)
#define frr(i, a, b) for (int i = (a), _b = (b); i >= _b; i--)
#define rep(i, n) for (int i = 0, _n = (n); i < _n; i++)
#define repr(i, n) for (long long i = (n)-1; i >= 0; i--)

ll gcd(ll a, ll b) {
  if (a == 0)
    return b;
  return gcd(b % a, a);
}

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

  ll t;
  t = 1;
  while (t--) {
    ll x, y, z;
    cin >> x >> y >> z;
    cout << z << " " << x << " " << y;
  }
  return 0;
}
Problem p02717 (C++) — buggy submission, verdict: Runtime Error

#include <bits/stdc++.h>

using namespace std;
using ll = long long int;
constexpr ll M = 1e9 + 7;
inline ll sum_1(const ll n) { return ((n * (n + 1)) / 2) % M; }
inline ll sum_2(const ll n) { return ((n * (n + 1) * (2 * n + 1)) / 6) % M; }
inline ll sum_3(const ll n) {
  return (((n * (n + 1)) / 2) % M * ((n * (n + 1)) / 2) % M) % M;
}
inline ll sum_1(const ll i, const ll j) {
  return (sum_1(j) - sum_1(i - 1) + M) % M;
}
inline ll sum_2(const ll i, const ll j) {
  return (sum_2(j) - sum_2(i - 1) + M) % M;
}
inline ll sum_3(const ll i, const ll j) {
  return (sum_3(j) - sum_3(i - 1) + M) % M;
}

void solve() {
  int x, y, z;
  cin >> x >> y >> z;
  swap(x, y);
  swap(x, z);
  cout << x << " " << y << " " << z << endl;
}

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

  solve();

  return 0;
}

Error: WA

Fixed submission:

#include <bits/stdc++.h>

using namespace std;
using ll = long long int;
constexpr ll M = 1e9 + 7;
inline ll sum_1(const ll n) { return ((n * (n + 1)) / 2) % M; }
inline ll sum_2(const ll n) { return ((n * (n + 1) * (2 * n + 1)) / 6) % M; }
inline ll sum_3(const ll n) {
  return (((n * (n + 1)) / 2) % M * ((n * (n + 1)) / 2) % M) % M;
}
inline ll sum_1(const ll i, const ll j) {
  return (sum_1(j) - sum_1(i - 1) + M) % M;
}
inline ll sum_2(const ll i, const ll j) {
  return (sum_2(j) - sum_2(i - 1) + M) % M;
}
inline ll sum_3(const ll i, const ll j) {
  return (sum_3(j) - sum_3(i - 1) + M) % M;
}

void solve() {
  int x, y, z;
  cin >> x >> y >> z;
  swap(x, y);
  swap(x, z);
  cout << x << " " << y << " " << z << endl;
}

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
#ifndef ONLINE_JUDGE
  freopen("in.in", "r", stdin);
  freopen("out.out", "w", stdout);
#endif

  solve();

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

#include <bits/stdc++.h>
using namespace std;
int main() {
  int x, y, z;
  cin >> x >> y >> z;
  swap(x, y);
  swap(x, z);
  cout << x << " " << y << " " << z;
}


Error: -11

Fixed submission:

#include <bits/stdc++.h>
using namespace std;
void S(int *p) {
  swap(*p, *(p + 1));
  swap(*(p + 1), *(p + 2));
}
int main() {
  int a[3];
  for (int i : a)
    cin >> a[i];
  S(a);
  for (int i : a)
    cout << a[i] << " ";
}
Problem p02717 (C++) — buggy submission, verdict: Runtime Error

#include <bits/stdc++.h>
#define ll long long int
#define IOS                                                                    \\
  ios_base::sync_with_stdio(false);                                            \\
  cin.tie(NULL);                                                               \\
  cout.tie(NULL);
#define pb emplace_back
#define vi vector<int>
#define all(x) (x).begin(), (x).end()
#define pb emplace_back
#define deb(x) cout << #x << " - " << x << endl;

using namespace std;

int main() {
  IOS;
  // #ifndef ONLINE_JUDGE
  // 	freopen("input.txt", "r", stdin);
  // 	freopen("output.txt", "w", stdout);
  // #endif
  int x, y, z;
  cin >> x >> y >> z;
  cout << z << " " << x << " " << y;

  return 0;
}

Error: WA

Fixed submission:

#include <bits/stdc++.h>
#define ll long long int
#define IOS                                                                    \\
  ios_base::sync_with_stdio(false);                                            \\
  cin.tie(NULL);                                                               \\
  cout.tie(NULL);
#define pb emplace_back
#define vi vector<int>
#define all(x) (x).begin(), (x).end()
#define pb emplace_back
#define deb(x) cout << #x << " - " << x << endl;

using namespace std;

int main() {
  IOS;
#ifndef ONLINE_JUDGE
  freopen("input.txt", "r", stdin);
  freopen("output.txt", "w", stdout);
#endif
  int x, y, z;
  cin >> x >> y >> z;
  cout << z << " " << x << " " << y;

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

#include <bits/stdc++.h>

using namespace std;

int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);

  // freopen("input.txt", "r" , stdin);
  // freopen("output.txt", "w", stdout);

  int x, y, z;
  cin >> x >> y >> z;

  cout << z << " " << x << " " << y;

  return 0;
}


Error: WA

Fixed submission:

#include <bits/stdc++.h>

using namespace std;

int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);

  freopen("input.txt", "r", stdin);
  freopen("output.txt", "w", stdout);

  int x, y, z;
  cin >> x >> y >> z;

  cout << z << " " << x << " " << y;

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


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

typedef long long ll;
#define pb push_back
#define F first
#define S second
#define ppp pair<ll, pair<ll, ll>>
#define pp pair<ll, ll>
#define all(x) (x).begin(), (x).end()
#define pi 3.14159265358
#define MOD 998244353

int main() {

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

  ios_base::sync_with_stdio(false);
  cin.tie(NULL);

  ll a, b, c;

  cin >> a >> b >> c;
  swap(a, b);
  swap(a, c);

  cout << a << " " << b << " " << c;
}


Error: WA

Fixed submission:


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

typedef long long ll;
#define pb push_back
#define F first
#define S second
#define ppp pair<ll, pair<ll, ll>>
#define pp pair<ll, ll>
#define all(x) (x).begin(), (x).end()
#define pi 3.14159265358
#define MOD 998244353

int main() {

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

  ios_base::sync_with_stdio(false);
  cin.tie(NULL);

  ll a, b, c;

  cin >> a >> b >> c;
  swap(a, b);
  swap(a, c);

  cout << a << " " << b << " " << c;
}
Problem p02717 (C++) — buggy submission, verdict: Runtime Error

#include <bits/stdc++.h>
#define ff first
#define ss second
#define ll long long
#define rep(i, n) for (int i = 0; i < n; i++)
using namespace std;

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

  ll a, b, c;

  cin >> a >> b >> c;

  cout << c << " " << a << " " << b;

  return 0;
}


Error: WA

Fixed submission:

#include <bits/stdc++.h>
#define ff first
#define ss second
#define ll long long
#define rep(i, n) for (int i = 0; i < n; i++)
using namespace std;

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

  ll a, b, c;

  cin >> a >> b >> c;

  cout << c << " " << a << " " << b;

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


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

#define BeatMeScanf                                                            \\
  ios_base::sync_with_stdio(false);                                            \\
  cin.tie(NULL);                                                               \\
  cout.tie(NULL);
#define tc(x)                                                                  \\
  int x;                                                                       \\
  cin >> x;                                                                    \\
  while (x--)
#define ll long long
#define vi vector<int>
#define pii pair<int, int>
#define mii map<int, int>
#define inf 1 << 28
#define mem(x, y) memset(x, y, sizeof(x))
#define ps(x, y) fixed << setprecision(y) << x
#define show(val) cout << #val << " -> " << val << endl
#define Case cout << "Case " << ++cs << ": "
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define mod 1000000007

int main() {
  BeatMeScanf;
  int x, y, z;
  cin >> x >> y >> z;
  cout << z << " " << x << " " << y << '\\n';
  return 0;
}


Error: WA

Fixed submission:


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

#define BeatMeScanf                                                            \\
  ios_base::sync_with_stdio(false);                                            \\
  cin.tie(NULL);                                                               \\
  cout.tie(NULL);
#define tc(x)                                                                  \\
  int x;                                                                       \\
  cin >> x;                                                                    \\
  while (x--)
#define ll long long
#define vi vector<int>
#define pii pair<int, int>
#define mii map<int, int>
#define inf 1 << 28
#define mem(x, y) memset(x, y, sizeof(x))
#define ps(x, y) fixed << setprecision(y) << x
#define show(val) cout << #val << " -> " << val << endl
#define Case cout << "Case " << ++cs << ": "
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define mod 1000000007

int main() {
  BeatMeScanf;
#ifndef ONLINE_JUDGE
  freopen("G:/C++/in.txt", "r", stdin);
  freopen("G:/C++/out.txt", "w", stdout);
#endif
  int x, y, z;
  cin >> x >> y >> z;
  cout << z << " " << x << " " << y << '\\n';
  return 0;
}
Problem p02717 (C++) — buggy submission, verdict: Runtime Error

#include <bits/stdc++.h>
using namespace std;
int main() {
  int a, b, c;
  scanf("%d %d %d", &a, &b, &c);
  printf("%d %d %d", c, a, b);
  return 0;
}

Error: -11

Fixed submission:

#include <bits/stdc++.h>
using namespace std;
void swap(int arr[], int i) {
  int temp = arr[i];
  arr[i] = arr[0];
  arr[0] = temp;
}
int main() {
  int arr[3];
  scanf("%d %d %d", arr[0], arr[1], arr[2]);
  swap(arr, 1);
  swap(arr, 2);
  printf("%d %d %d", arr[0], arr[1], arr[2]);
}
Problem p02717 (C++) — buggy submission, verdict: Runtime Error

#include <bits/stdc++.h>
#include <exception>
#include <unordered_map>
#include <unordered_set>

using namespace std;

typedef long long ll;
typedef long long ull;
typedef pair<int, int> ii;

#define all(v) ((v).begin()), ((v).end())
#define sz(v) ((int)((v).size()))
#define endl "\\n"
#define fx(n) fixed << setprecision(n)
#define mk make_pair

void fast() {
  ios::sync_with_stdio(NULL);
  cout.tie(NULL);
  cin.tie(NULL);
}
const double pi = 2 * acos(0.0);
const ll oo = 0x3f3f3f3f;
const int MOD = 1e9 + 7;
const int nn = 1e5 + 15;
int dx[8] = {1, -1, 0, 0, 1, -1, 1, -1};
int dy[8] = {0, 0, 1, -1, 1, -1, -1, 1};

int main() {
  fast();
  int a, b, c;
  cin >> a >> b >> c;
  swap(a, b);
  swap(a, c);
  cout << a << " " << b << " " << c << endl;
  return 0;
}


Error: WA

Fixed submission:

#include <bits/stdc++.h>
#include <exception>
#include <unordered_map>
#include <unordered_set>

using namespace std;

typedef long long ll;
typedef long long ull;
typedef pair<int, int> ii;

#define all(v) ((v).begin()), ((v).end())
#define sz(v) ((int)((v).size()))
#define endl "\\n"
#define fx(n) fixed << setprecision(n)
#define mk make_pair

void fast() {
  ios::sync_with_stdio(NULL);
  cout.tie(NULL);
  cin.tie(NULL);
#ifndef ONLINE_JUDGE
  freopen("output.txt", "w", stdout);
  freopen("input.txt", "r", stdin);
#endif
#ifdef ONLINE_JUDGE
  /*freopen("output.txt", "w", stdout);
  freopen("pyramid.in", "r", stdin);*/
#endif
}
const double pi = 2 * acos(0.0);
const ll oo = 0x3f3f3f3f;
const int MOD = 1e9 + 7;
const int nn = 1e5 + 15;
int dx[8] = {1, -1, 0, 0, 1, -1, 1, -1};
int dy[8] = {0, 0, 1, -1, 1, -1, -1, 1};

int main() {
  fast();
  int a, b, c;
  cin >> a >> b >> c;
  swap(a, b);
  swap(a, c);
  cout << a << " " << b << " " << c << endl;
  return 0;
}
Problem p02717 (C++) — buggy submission, verdict: Runtime Error

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

int main() {

  ios_base::sync_with_stdio(false);
  cin.tie(NULL);

  int t = 1;
  while (t--) {
    long long int a, b, c;
    cin >> a >> b >> c;
    cout << c << " " << a << " " << b << endl;
  }

  return 0;
}

Error: WA

Fixed submission:

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

int main() {

  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
#ifndef ONLINE_JUDGE
  freopen("input.txt", "r", stdin);
  freopen("output.txt", "w", stdout);
#endif
  int t = 1;
  while (t--) {
    int a, b, c;
    cin >> a >> b >> c;
    cout << c << " " << a << " " << b << endl;
  }

  return 0;
}