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

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

int main() {
  cin.tie(0)->sync_with_stdio(0);
  int n;
  cin >> n;
  long long x, y, rest = 0;
  cin >> x >> y;
  for (auto i = 0; i < n - 2; ++i) {
    long long x;
    cin >> x;
    rest ^= x;
  }
  if ((x ^ y ^ rest) & 1 || x + y < rest) {
    cout << "-1\\n";
    return 0;
  }
  long long a = x + y - rest >> 1;
  if (a > x) {
    cout << "-1\\n";
    return 0;
  }
  long long init_x = x;
  int limit = 10000;
  while (x && x & y ^ a && limit--) {
    for (auto bit = 40; bit >= 0; --bit) {
      if (x & y & 1LL << bit ^ a & 1LL << bit) {
        long long d =
            min(x - (x >> bit << bit) + 1, ((y >> bit) + 1 << bit) - y);
        x -= d, y += d;
        break;
      }
    }
  }
  x &&limit >= 0 ? cout << init_x - x << "\\n" : cout << "-1\\n";
  return 0;
}

/*

*/

////////////////////////////////////////////////////////////////////////////////////////
//                                                                                    //
//                                   Coded by Aeren //
//                                                                                    //
////////////////////////////////////////////////////////////////////////////////////////

Error: TLE

Fixed submission:

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

int main() {
  cin.tie(0)->sync_with_stdio(0);
  int n;
  cin >> n;
  long long x, y, rest = 0;
  cin >> x >> y;
  for (auto i = 0; i < n - 2; ++i) {
    long long x;
    cin >> x;
    rest ^= x;
  }
  if ((x ^ y ^ rest) & 1 || x + y < rest) {
    cout << "-1\\n";
    return 0;
  }
  long long a = x + y - rest >> 1;
  if (a > x) {
    cout << "-1\\n";
    return 0;
  }
  long long init_x = x;
  while (x && x & y ^ a) {
    for (auto bit = 40; bit >= 0; --bit) {
      if (x & y & 1LL << bit ^ a & 1LL << bit) {
        long long d =
            min(x - (x >> bit << bit) + 1, ((y >> bit) + 1 << bit) - y);
        x -= d, y += d;
        break;
      }
    }
  }
  x ? cout << init_x - x << "\\n" : cout << "-1\\n";
  return 0;
}

/*

*/

////////////////////////////////////////////////////////////////////////////////////////
//                                                                                    //
//                                   Coded by Aeren //
//                                                                                    //
////////////////////////////////////////////////////////////////////////////////////////
Problem p02626 (C++) — buggy submission, verdict: Runtime Error

#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define REP(i, m, n) for (int i = (int)(m); i < (int)(n); i++)
#define rep(i, n) REP(i, 0, n)
#define RREP(i, m, n) for (int i = (int)(m); i >= (int)(n); i--)
#define rrep(i, n) RREP(i, n - 1, 0)
#define all(v) v.begin(), v.end()
const int inf = 1e9 + 7;
const ll longinf = 1LL << 60;
const ll mod = 1e9 + 7;

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int N;
  cin >> N;
  vector<ll> A(N);
  rep(i, N) cin >> A[i];
  ll S = 0, X = 0;
  S = A[0] + A[1];
  REP(i, 2, N) X ^= A[i];
  if ((S - X) & 1) {
    cout << -1 << "\\n";
    return 0;
  }
  ll D = (S - X) >> 1;
  if (D > A[0]) {
    cout << -1 << "\\n";
    return 0;
  }
  vector<ll> d(45);
  {
    int i = 0;
    while (X > 0) {
      d[i] = X & 1;
      if (d[i] && (D >> i) & 1) {
        cout << -1 << "\\n";
        return 0;
      }
      X >>= 1;
      i++;
    }
  }
  rrep(i, 45) {
    if ((D ^ (d[i] << i)) > A[0])
      continue;
    D ^= (d[i] << i);
  }
  cout << (D == 0 ? -1 : A[0] - D) << "\\n";
  return 0;
}


Error: 0

Fixed submission:

#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define REP(i, m, n) for (int i = (int)(m); i < (int)(n); i++)
#define rep(i, n) REP(i, 0, n)
#define RREP(i, m, n) for (int i = (int)(m); i >= (int)(n); i--)
#define rrep(i, n) RREP(i, n - 1, 0)
#define all(v) v.begin(), v.end()
const int inf = 1e9 + 7;
const ll longinf = 1LL << 60;
const ll mod = 1e9 + 7;

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int N;
  cin >> N;
  vector<ll> A(N);
  rep(i, N) cin >> A[i];
  ll S = 0, X = 0;
  S = A[0] + A[1];
  REP(i, 2, N) X ^= A[i];
  if ((S - X) % 2 == 1) {
    cout << -1 << "\\n";
    return 0;
  }
  ll D = (S - X) >> 1;
  if (D > A[0]) {
    cout << -1 << "\\n";
    return 0;
  }
  vector<ll> d(35);
  {
    int i = 0;
    while (X > 0) {
      d[i] = X & 1;
      X >>= 1;
      i++;
    }
  }
  rrep(i, 35) {
    if ((D ^ (d[i] << i)) > A[0])
      continue;
    D ^= (d[i] << i);
  }
  cout << (D == 0 ? -1 : A[0] - D) << "\\n";
  return 0;
}
Problem p02626 (C++) — buggy submission, verdict: Time Limit Exceeded

// https://atcoder.jp/contests/abc172/tasks/abc172_f

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

#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define FOR(i, b, e) for (int i = (b); i <= (int)(e); i++)
#define DEBUG 1
#if DEBUG
#define _GLIBCXX_DEBUG
#define DUMP(a)                                                                \\
  REP(_i, a.size()) cout << a[_i] << (_i + 1 == a.size() ? "\\n" : " ")
#define DUMP2D(b)                                                              \\
  REP(_j, b.size()) DUMP(b[_j]);                                               \\
  cout << endl
#else
#define DUMP(a)
#define DUMP2D(b)
#endif

const int N_MAX = 300;
const ull A_I_MAX = 1e12;

int N;
vector<ull> A;

vector<vector<ull>> v;

int main() {
  cin >> N;
  A = vector<ull>(N);
  REP(i, N) cin >> A[i];

  ull X = 0;
  FOR(i, 2, N - 1) X ^= A[i];
  // cout << "X:" << X << endl;

  v = vector<vector<ull>>(41);

  ull Y = A[0] ^ A[1] ^ X;
  // cout << "d:" << 0 << " Y:" << Y << endl;
  if (Y == 0) {
    cout << 0 << endl;
    return 0;
  }
  v[0].push_back(0);
  FOR(j, 0, 39) {
    if (Y >> j & 1)
      break;
    v[j + 1].push_back(0);
  }

  FOR(i, 0, 39) {
    // cout << "v[" << i << "]: ";
    // DUMP(v[i]);
    ull q = 1ULL << i;
    for (ull r : v[i]) {
      ull d = q + r;
      if (d >= A[0]) {
        cout << -1 << endl;
        return 0;
      }
      ull Y = (A[0] - d) ^ (A[1] + d) ^ X;
      // cout << "d:" << d << " Y:" << Y << endl;
      if (Y == 0) {
        cout << d << endl;
        return 0;
      }
      FOR(j, i, 39) {
        if (Y >> j & 1)
          break;
        v[j + 1].push_back(d);
      }
    }
  }

  cout << -1 << endl;
}


Error: TLE

Fixed submission:

// https://atcoder.jp/contests/abc172/tasks/abc172_f

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

#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define FOR(i, b, e) for (int i = (b); i <= (int)(e); i++)
#define DEBUG 1
#if DEBUG
#define _GLIBCXX_DEBUG
#define DUMP(a)                                                                \\
  REP(_i, a.size()) cout << a[_i] << (_i + 1 == a.size() ? "\\n" : " ")
#define DUMP2D(b)                                                              \\
  REP(_j, b.size()) DUMP(b[_j]);                                               \\
  cout << endl
#else
#define DUMP(a)
#define DUMP2D(b)
#endif

const int N_MAX = 300;
const ull A_I_MAX = 1e12;

int N;
vector<ull> A;

int main() {
  cin >> N;
  A = vector<ull>(N);
  REP(i, N) cin >> A[i];

  ull X = 0;
  FOR(i, 2, N - 1) X ^= A[i];

  ull a0 = A[0];
  ull a1 = A[1];
  for (ull i = 0ULL; i < a0; i++) {
    if ((a0 ^ a1) == X) {
      cout << i << endl;
      return 0;
    }
    a0--;
    a1++;
  }

  cout << -1 << endl;
}
Problem p02626 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <bits/stdc++.h>

#define int long long
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); ++i)
typedef pair<int, int> pii;
const int INF = 1l << 60;

signed main() {
  int N;
  cin >> N;
  int A1max, a2, S, X = 0;
  cin >> A1max >> a2;
  S = A1max + a2;
  rep(i, N - 2) {
    int a;
    cin >> a;
    X ^= a;
  }
  int D = (S - X) / 2;
  if (D < 0 || D & X || D > A1max || (S - X) & 1) {
    cout << -1 << endl;
    return 0;
  }
  int A1 = D;
  for (int i = 44; i >= 0; --i) {
    if ((X >> i) & 1) {
      A1 += (1ll << i);
      if (A1 > A1max)
        A1 -= (1ll << i);
    }
  }
  if (A1 == 0) {
    cout << -1 << endl;
  } else {
    cout << A1max - A1 << endl;
  }
  return 0;
}


Error: TLE

Fixed submission:

#include <bits/stdc++.h>

#define int long long
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); ++i)
typedef pair<int, int> pii;
const int INF = 1l << 60;

signed main() {
  int N;
  cin >> N;
  int A1, A2;
  cin >> A1 >> A2;
  int Axor = 0;
  rep(i, N - 2) {
    int a;
    cin >> a;
    Axor ^= a;
  }
  for (int a = A1; a > 0; --a) {
    if (a + (a ^ Axor) == A1 + A2) {
      cout << A1 - a << endl;
      return 0;
    }
  }
  cout << -1 << endl;
  return 0;
}
Problem p02626 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <bits/stdc++.h>
typedef long long LL;
typedef double dl;
#define opt operator
#define pb push_back
const LL maxn = 1e6 + 9, mod = 998244353, up = 5e6;
LL Read() {
  LL x(0), f(1);
  char c = getchar();
  while (c < '0' || c > '9') {
    if (c == '-')
      f = -1;
    c = getchar();
  }
  while (c >= '0' && c <= '9') {
    x = (x << 3ll) + (x << 1ll) + c - '0';
    c = getchar();
  }
  return x * f;
}
LL n;
LL a[maxn];
int main() {
  n = Read();
  for (LL i = 1; i <= n; ++i)
    a[i] = Read();
  LL ret(0);
  for (LL i = 3; i <= n; ++i)
    ret ^= a[i];

  LL x(a[1]), y(a[2]), tmp(0);
  for (LL i = 0; i < x; i += up) {
    LL l(i), r(i + up - 1);
    r = std::min(r, x - 1);
    LL L((x - l) ^ (y + l)), R((x - r) ^ (y + r));
    if (L > R)
      std::swap(L, R);
    if ((L <= ret && ret <= R) ||
        (std::abs(L - ret) <= up || std::abs(R - ret) <= up)) {
      for (LL j = l; j <= r; ++j) {
        if (((x - j) ^ (y + j)) == ret) {
          printf("%lld\\n", j);
          return 0;
        }
        ++tmp;
        if (tmp >= 6e7) {
          puts("-1");
          return 0;
        }
      }
    }
  }
  puts("-1");
  return 0;
}


Error: TLE

Fixed submission:

#include <bits/stdc++.h>
typedef long long LL;
typedef double dl;
#define opt operator
#define pb push_back
const LL maxn = 1e6 + 9, mod = 998244353, up = 1e5;
LL Read() {
  LL x(0), f(1);
  char c = getchar();
  while (c < '0' || c > '9') {
    if (c == '-')
      f = -1;
    c = getchar();
  }
  while (c >= '0' && c <= '9') {
    x = (x << 3ll) + (x << 1ll) + c - '0';
    c = getchar();
  }
  return x * f;
}
LL n;
LL a[maxn];
int main() {
  n = Read();
  for (LL i = 1; i <= n; ++i)
    a[i] = Read();
  LL ret(0);
  for (LL i = 3; i <= n; ++i)
    ret ^= a[i];

  LL x(a[1]), y(a[2]);
  for (LL i = 0; i < x; i += up) {
    LL l(i), r(i + up - 1);
    r = std::min(r, x - 1);
    LL L((x - l) ^ (y + l)), R((x - r) ^ (y + r));
    if (L > R)
      std::swap(L, R);
    if ((L <= ret && ret <= R) ||
        (std::abs(L - ret) <= up || std::abs(R - ret) <= up)) {
      for (LL j = l; j <= r; ++j) {
        if (((x - j) ^ (y + j)) == ret) {
          printf("%lld\\n", j);
          return 0;
        }
      }
    }
  }
  puts("-1");
  return 0;
}
Problem p02626 (C++) — buggy submission, verdict: Runtime Error

#include <bits/stdc++.h>
#define pb emplace_back
using namespace std;
using ll = long long;
const int maxk = 21;
const ll inf = 1e15;
#define FI() (puts("-1"), exit(0))
ll a, b, c, n;
#define int ll
void ob(ll v) {
  for (int i = 40; i >= 0; --i)
    cerr << (!!(v & (1ll << i)));
  cerr << '\\n';
}
vector<ll> getok() {
  static ll an = (1ll << maxk) - 1;
  vector<ll> res;
  // set<ll> did;
  for (int i = 0; i < 1 << maxk && i < a; ++i) {
    ll na = a - i, nb = b + i, tar = c;
    na &= an, nb &= an, tar &= an;
    if ((na ^ nb) == tar) // && !did.count(((a-i) ^ (b+i))>>maxk))
      res.pb(i);          //, did.insert(((a-i) ^ (b+i)) >> maxk);
  }
  return res;
}
ll cost(ll a, ll b, ll c) {
  assert(a >= 0 && b >= 0 && c >= 0);
  for (ll i = 0; i < 1 << maxk; ++i) {
    // if (a < i) break;
    if (((a - i) ^ (b + i)) == c)
      return i << maxk;
  }
  return inf;
}
signed main() {
  ios_base::sync_with_stdio(0), cin.tie(0);
  cin >> n >> a >> b;
  for (int i = 2; i < n; ++i) {
    ll t;
    cin >> t;
    c ^= t;
  }
  auto R = getok();
  ll res = a + 1;

  for (auto i : R)
    res = min(res, i + cost((a - i) >> maxk, (b + i) >> maxk, c >> maxk));

  if (res >= a)
    res = -1;
  cout << (long long)res << '\\n';
}


Error: 0

Fixed submission:

#include <bits/stdc++.h>
#define pb emplace_back
using namespace std;
using ll = long long;
const int maxk = 21;
const ll inf = 1e15;
#define FI() (puts("-1"), exit(0))
ll a, b, c, n;
#define int ll
void ob(ll v) {
  for (int i = 40; i >= 0; --i)
    cerr << (!!(v & (1ll << i)));
  cerr << '\\n';
}
vector<ll> getok() {
  static ll an = (1ll << maxk) - 1;
  vector<ll> res;
  set<ll> did;
  for (int i = 0; i < 1 << maxk && i < a; ++i) {
    ll na = a - i, nb = b + i, tar = c;
    na &= an, nb &= an, tar &= an;
    if ((na ^ nb) == tar && !did.count(((a - i) ^ (b + i)) >> maxk))
      res.pb(i), did.insert(((a - i) ^ (b + i)) >> maxk);
  }
  return res;
}
ll cost(ll a, ll b, ll c) {
  assert(a >= 0 && b >= 0 && c >= 0);
  for (ll i = 0; i < 1 << maxk; ++i) {
    // if (a < i) break;
    if (((a - i) ^ (b + i)) == c)
      return i << maxk;
  }
  return inf;
}
signed main() {
  ios_base::sync_with_stdio(0), cin.tie(0);
  cin >> n >> a >> b;
  for (int i = 2; i < n; ++i) {
    ll t;
    cin >> t;
    c ^= t;
  }
  auto R = getok();
  ll res = a + 1;

  for (auto i : R)
    res = min(res, i + cost((a - i) >> maxk, (b + i) >> maxk, c >> maxk));

  if (res >= a)
    return -1;
  cout << (long long)res << '\\n';
}
Problem p02626 (C++) — buggy submission, verdict: Time Limit Exceeded

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

int main() {
  int N;
  cin >> N;
  vector<long long> A(N);
  long long X = 0;
  for (int i = 0; i < N; i++) {
    cin >> A[i];
    X ^= A[i];
  }
  X ^= (A[0] ^ A[1]);
  long long S = A[0] + A[1];
  long long D = (S - X) / 2;
  if (D < 0 || (D & X) != 0 || (D ^ 0) > A[0] || ((S + X) & 1) != 0)
    cout << -1 << endl;
  else {
    long long ans = D;
    for (long long i = 60; 0 <= i; i--) {
      if ((X >> i) & 1) {
        if ((ans | (1LL << i)) <= A[0])
          ans |= (1LL << i);
      }
    }
    if (A[0] - ans >= 0 && ans > 0)
      cout << A[0] - ans << endl;
    else
      cout << -1 << endl;
  }
}

Error: TLE

Fixed submission:

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

int main() {
  int N;
  cin >> N;
  vector<long long> A(N);
  for (int i = 0; i < N; i++) {
    cin >> A[i];
  }
  // 3~N個目までの排他的論理和
  long long X = 0;
  for (int i = 2; i < N; i++) {
    X ^= A[i];
  }
  long long a = A[0];
  long long S = A[0] + A[1];
  for (; 0 < a; a--) {
    if ((a ^ (S - a)) == X) {
      cout << A[0] - a << endl;
      return 0;
    }
  }
  cout << -1 << endl;
}
Problem p02626 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vll>;
using vc = vector<char>;
using vvc = vector<vc>;
using pll = pair<ll, ll>;
using vpll = vector<pll>;
const ll INF = 1LL << 60;
const ll MOD = 1e9 + 7;
#define rep(i, n) for (ll i = 0; i < (n); i++)
template <typename T1, typename T2> inline void chmin(T1 &a, T2 b) {
  if (a > b)
    a = b;
}
template <typename T1, typename T2> inline void chmax(T1 &a, T2 b) {
  if (a < b)
    a = b;
}
#ifndef ONLINE_JUDGE
#define debug(x) cerr << #x << ": " << x << endl;
#else
#define debug(x)
#endif

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(20);

  ll N;
  cin >> N;
  vll A(N);
  rep(i, N) cin >> A[i];

  ll Xor = 0;
  for (ll i = 2; i < N; i++)
    Xor ^= A[i];
  ll x = A[0], y = A[1];

  // x^y = x + y + 2*(x&y)
  ll And = x + y - Xor;
  // パリティ的に無理
  if (And % 2 || And < 0) {
    cout << -1 << endl;
    return 0;
  }
  And /= 2;

  // XorとAnd両方にビット立たせるx,yは存在しない
  if (Xor & And) {
    cout << -1 << endl;
    return 0;
  }

  ll ans = And;
  for (ll b = 1ll << 40; b >= 1; b /= 2) {
    if (Xor & b && ans + b <= x)
      ans += b;
  }

  if (ans == 0 || x < ans) {
    cout << -1 << endl;
    return 0;
  }

  cout << x - ans << endl;
}


Error: TLE

Fixed submission:

#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vll>;
using vc = vector<char>;
using vvc = vector<vc>;
using pll = pair<ll, ll>;
using vpll = vector<pll>;
const ll INF = 1LL << 60;
const ll MOD = 1e9 + 7;
#define rep(i, n) for (ll i = 0; i < (n); i++)
template <typename T1, typename T2> inline void chmin(T1 &a, T2 b) {
  if (a > b)
    a = b;
}
template <typename T1, typename T2> inline void chmax(T1 &a, T2 b) {
  if (a < b)
    a = b;
}
#ifndef ONLINE_JUDGE
#define debug(x) cerr << #x << ": " << x << endl;
#else
#define debug(x)
#endif

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(20);

  ll N;
  cin >> N;
  vll A(N);
  rep(i, N) cin >> A[i];

  ll s = 0;
  for (ll i = 2; i < N; i++)
    s ^= A[i];

  ll ans = -1;
  for (ll x = 0; x < A[0]; x++) {
    if (2 * ((A[0] - x) & (A[1] + x)) == (A[0] + A[1] - s)) {
      ans = x;
      cout << x << endl;
      return 0;
    }
  }
  cout << ans << endl;
}
Problem p02626 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;

int main() {
  int N;
  cin >> N;
  ull x, A1, A2;
  cin >> A1;
  cin >> A2;
  x = 0;
  for (int i = 3; i <= N; i++) {
    ull a;
    cin >> a;
    x ^= a;
  }
  set<pair<ull, ull>> S; // (z+b,b)
  S.insert(pair<ull, ull>(1, 1));
  while (S.size() > 0) {
    pair<ull, ull> p = *S.begin();
    S.erase(S.begin());
    ull z = p.first - p.second;
    ull b = p.second;
    //		cout << "check (" << z << "," << b << ")" << endl;
    if (((A1 - z) ^ (A2 + z)) == x) {
      cout << z << endl;
      return (0);
    }
    if ((((A1 - z) & (b * 2 - 1)) ^ ((A2 + z) & (b * 2 - 1))) ==
        (x & (b * 2 - 1))) {
      if (p.first + p.second < A1) {
        S.insert(pair<ull, ull>(z + b * 2, b * 2));
        //				cout << "insert (" << z + b * 2 << "," << b *
        //2 << ")" << endl;
        if (((A1 - z) & b) == 0 || ((A2 + z) & b) == b) {
          S.insert(pair<ull, ull>(z + b + b * 2, b * 2));
          //				cout << "insert (" << z + b + b * 2 << "," << b * 2
          //<< ")" << endl;
        }
      }
    }
  }
  cout << -1 << endl;
  return (0);
}


Error: TLE

Fixed submission:

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;

int main() {
  int N;
  cin >> N;
  ull x, A1, A2;
  cin >> A1;
  cin >> A2;
  x = 0;
  for (int i = 3; i <= N; i++) {
    ull a;
    cin >> a;
    x ^= a;
  }
  set<pair<ull, ull>> S; // (z+b,b)
  S.insert(pair<ull, ull>(1, 1));
  while (S.size() > 0) {
    pair<ull, ull> p = *S.begin();
    S.erase(S.begin());
    ull z = p.first - p.second;
    ull b = p.second;
    //		cout << "check (" << z << "," << b << ")" << endl;
    if (((A1 - z) ^ (A2 + z)) == x) {
      cout << z << endl;
      return (0);
    }
    if ((((A1 - z) & (b * 2 - 1)) ^ ((A2 + z) & (b * 2 - 1))) ==
        (x & (b * 2 - 1))) {
      if (p.first + p.second < A1) {
        S.insert(pair<ull, ull>(z + b * 2, b * 2));
        //				cout << "insert (" << z + b * 2 << "," << b *
        //2 << ")" << endl;
        S.insert(pair<ull, ull>(z + b + b, b));
        //				cout << "insert (" << z + b + b * 2 << "," <<
        //b * 2 << ")" << endl;
      }
    }
  }
  cout << -1 << endl;
  return (0);
}
Problem p02627 (C++) — buggy submission, verdict: Runtime Error

#include <iostream>
using namespace std;
int main() {
  char i;
  cin >> i;
  if (i >= 65 && i <= 90)
    cout << "A";
  else
    cout << "a";
}

Error: WA

Fixed submission:

#include <bits/stdc++.h>
#include <cmath>
#include <iostream>
using namespace std;
int main() {
  int n, k;
  cin >> n >> k;
  int array[n];
  for (int x = 0; x < n; x++)
    cin >> array[x];
  sort(array, array + n);
  int sum = 0;
  for (int y = 0; y < k; y++)
    sum += array[y];
  cout << sum;
}
Problem p02627 (C++) — buggy submission, verdict: Runtime Error

#include <iostream>
using namespace std;

int main() {
  char alpha;
  cin >> alpha;
  cout << ((alpha > 90) ? 'a' : 'A');
  return 0;
}

Error: -11

Fixed submission:

#include <algorithm>
#include <iostream>
#include <vector>
using namespace std;

int main() {
  int N, K, input;
  cin >> N >> K;
  vector<int> prices;
  for (int i = 0; i < N; ++i) {
    cin >> input;
    prices.push_back(input);
  }
  sort(prices.begin(), prices.end());
  int cost = 0;
  for (int i = 0; i < K; ++i)
    cost += prices[i];
  cout << cost;
  return 0;
}
Problem p02627 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <bits/stdc++.h>
using namespace std;
#define ALL(A) A.begin(), A.end()
#define MEM(a, b) memset(a, b, sizeof(a))
#define FOR(n) for (int i = 0; i < n; ++i)
#define FOR_(n) for (int i = 1; i <= n; ++i)
#define FOR_J(n) for (int j = 0; j < n; ++j)
#define FOR_J_(n) for (int j = 1; j <= n; ++j)
#define IT_FOR(A) for (auto i = A.begin(); i != A.end(); ++i)
#define INF 0x3f3f3f3f
#define N ((int)1e6)
// #define max(_a,_b) (((_a) > (_b)) ? (_a) : (_b))
// #define min(_a,_b) (((_a) < (_b)) ? (_a) : (_b))
const int mod = 1000000007;
typedef long long ll;

inline int read() {
  int x = 0, w = 1;
  char ch = 0;
  while (ch < '0' || ch > '9') {
    if (ch == '-')
      w = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') {
    x = x * 10 + (ch - '0');
    ch = getchar();
  }
  return x * w;
}

int main() {
  // freopen("in.txt", "r", stdin);
  // freopen("wa4.txt","w",stdout);
  int _ = 1;
  //_ = read();
  while (_--) {
    char c;
    cin >> c;
    char t = tolower(c);
    if (c == t)
      cout << "a\\n";
    else
      cout << "A\\n";
  }
  return 0;
}

Error: TLE

Fixed submission:

#include <bits/stdc++.h>
using namespace std;
#define ALL(A) A.begin(), A.end()
#define MEM(a, b) memset(a, b, sizeof(a))
#define FOR(n) for (int i = 0; i < n; ++i)
#define FOR_(n) for (int i = 1; i <= n; ++i)
#define FOR_J(n) for (int j = 0; j < n; ++j)
#define FOR_J_(n) for (int j = 1; j <= n; ++j)
#define IT_FOR(A) for (auto i = A.begin(); i != A.end(); ++i)
#define INF 0x3f3f3f3f
#define N ((int)1e6)
// #define max(_a,_b) (((_a) > (_b)) ? (_a) : (_b))
// #define min(_a,_b) (((_a) < (_b)) ? (_a) : (_b))
const int mod = 1000000007;
typedef long long ll;

inline int read() {
  int x = 0, w = 1;
  char ch = 0;
  while (ch < '0' || ch > '9') {
    if (ch == '-')
      w = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') {
    x = x * 10 + (ch - '0');
    ch = getchar();
  }
  return x * w;
}

int main() {
  // freopen("in.txt", "r", stdin);
  // freopen("wa4.txt","w",stdout);
  int _ = 1;
  _ = read();
  while (_--) {
    char c;
    cin >> c;
    char t = tolower(c);
    if (c == t)
      cout << "a\\n";
    else
      cout << "A\\n";
  }
  return 0;
}