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

Buggy submission (status: Runtime Error):
#include <bits/stdc++.h>
#define endl "\n"
#define fastio                                                                 \
  ios_base::sync_with_stdio(false);                                            \
  cin.tie(0);

using namespace std;

typedef long long ll;
typedef vector<ll> vi;
typedef pair<ll, ll> pi;

#define F first
#define S second
#define pb push_back
#define mp make_pair
#define FOR(i, a, b) for (ll i = a; i <= b; i++)

void solve() {
  string s;
  cin >> s;

  if (s[0] == s[1] && s[1] == s[2]) {
    cout << "No" << endl;
  } else {
    cout << "Yes" << endl;
  }

  return;
}

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

      ll t = 1;
  // cin >> t;

  while (t--) {
    solve();
  }

  return 0;
}

Fixed submission:
#include <bits/stdc++.h>
#define endl "\n"
#define fastio                                                                 \
  ios_base::sync_with_stdio(false);                                            \
  cin.tie(0);

using namespace std;

typedef long long ll;
typedef vector<ll> vi;
typedef pair<ll, ll> pi;

#define F first
#define S second
#define pb push_back
#define mp make_pair
#define FOR(i, a, b) for (ll i = a; i <= b; i++)

void solve() {
  string s;
  cin >> s;

  if (s[0] == s[1] && s[1] == s[2]) {
    cout << "No" << endl;
  } else {
    cout << "Yes" << endl;
  }

  return;
}

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

      ll t = 1;
  // cin >> t;

  while (t--) {
    solve();
  }

  return 0;
}
Problem p02753 (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++)
#define ll long long

int main() {
  string s;

  if (s.at(0) == s.at(1) && s.at(1) == s.at(2))
    cout << "No" << endl;
  else
    cout << "Yes" << endl;

  return 0;
}


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

int main() {
  string s;
  cin >> s;

  if (s.at(0) == s.at(1) && s.at(1) == s.at(2))
    cout << "No" << endl;
  else
    cout << "Yes" << endl;

  return 0;
}
Problem p02753 (C++)

Buggy submission (status: Runtime Error):
/*Author : Kartik Bansal
 *Date : 07/09/19
 *Time : 16:14 */
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define tc                                                                     \
  int t;                                                                       \
  cin >> t;                                                                    \
  while (t--)
#define pb push_back
#define mp make_pair
#define FOR(i, n) for (int i = 0; i < n; i++)
#define loop(i, a, b) for (int i = a; i < b; i++)
#define tra(a)                                                                 \
  for (auto it : a)                                                            \
    cout << it << " ";
#define all(v) v.begin(), v.end()
#define vi vector<int>
#define vll vector<long long>
#define vpp vector<pair<int, int>>
#define inf INT_MAX
#define minf INT_MIN
#define ss second
#define ff first
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
#ifndef ONLINE_JUDGE
  freopen("input.txt", "r", stdin);
  freopen("output.txt", "w", stdout);
#endif
  string s;
  cin >> s;
  set<char> ss;
  FOR(i, 3) { ss.insert(s[i]); }
  if (ss.size() >= 2)
    cout << "Yes\n";
  else
    cout << "No\n";

  return 0;
}


Fixed submission:
/*Author : Kartik Bansal
 *Date : 07/09/19
 *Time : 16:14 */
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define tc                                                                     \
  int t;                                                                       \
  cin >> t;                                                                    \
  while (t--)
#define pb push_back
#define mp make_pair
#define FOR(i, n) for (int i = 0; i < n; i++)
#define loop(i, a, b) for (int i = a; i < b; i++)
#define tra(a)                                                                 \
  for (auto it : a)                                                            \
    cout << it << " ";
#define all(v) v.begin(), v.end()
#define vi vector<int>
#define vll vector<long long>
#define vpp vector<pair<int, int>>
#define inf INT_MAX
#define minf INT_MIN
#define ss second
#define ff first
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  // #ifndef ONLINE_JUDGE
  // 		    freopen("input.txt", "r", stdin);
  // 	    freopen("output.txt", "w", stdout);
  //    #endif
  string s;
  cin >> s;
  set<char> ss;
  FOR(i, 3) { ss.insert(s[i]); }
  if (ss.size() >= 2)
    cout << "Yes\n";
  else
    cout << "No\n";

  return 0;
}
Problem p02753 (C++)

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

int main() {
  std::string str;
  std::cin >> str;
  for (int i = 0; i < 3; i++)
    for (int j = j + 1; j < 3; j++)
      if (str[i] != str[j]) {
        std::cout << "Yes" << std::endl;
        return 0;
      }
  std::cout << "No" << std::endl;
}

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

int main() {
  std::string str;
  std::cin >> str;
  int ca = 0;
  int cb = 0;
  for (int i = 0; i < 3; ++i)
    if (str[i] == 'A')
      ca += 1;
    else
      cb += 1;
  if (ca == 3 || cb == 3)
    std::cout << "No" << std::endl;
  else
    std::cout << "Yes" << std::endl;
}
Problem p02753 (C++)

Buggy submission (status: Runtime Error):
// Nguyen Anh Tu
#include <bits/stdc++.h>
#define FOR(x, a, b) for (int x = a; x <= b; x++)
#define FORD(x, a, b) for (int x = a; x >= b; x--)
#define maxn 100005
#define maxc 1000000007
#define MOD 1000000007
#define reset(x, y) memset(x, y, sizeof(x))
#define task ""
#define mp make_pair
#define pb push_back
#define F first
#define S second
#define pii pair<int, int>
#define ll long long
#define bit(p, x) ((x >> p) & 1)
#define remain(a, b) (a + b >= MOD) ? (a + b - MOD) : (a + b)

using namespace std;
string s;
bool ok1, ok2;
int main() {
  ios_base::sync_with_stdio(NULL);
  cin.tie(NULL);
  cout.tie(NULL);
#ifndef ONLINE_JUDGE
  freopen(task ".inp", "r", stdin);
  freopen(task ".out", "w", stdout);
#endif
  cin >> s;
  for (int i = 0; i <= 2; ++i)
    if (s[i] == 'A')
      ok1 = 1;
    else
      ok2 = 1;
  if (ok1 && ok2)
    cout << "Yes";
  else
    cout << "No";
}


Fixed submission:
// Nguyen Anh Tu
#include <bits/stdc++.h>
#define FOR(x, a, b) for (int x = a; x <= b; x++)
#define FORD(x, a, b) for (int x = a; x >= b; x--)
#define maxn 100005
#define maxc 1000000007
#define MOD 1000000007
#define reset(x, y) memset(x, y, sizeof(x))
#define task ""
#define mp make_pair
#define pb push_back
#define F first
#define S second
#define pii pair<int, int>
#define ll long long
#define bit(p, x) ((x >> p) & 1)
#define remain(a, b) (a + b >= MOD) ? (a + b - MOD) : (a + b)

using namespace std;
string s;
bool ok1, ok2;
int main() {
  ios_base::sync_with_stdio(NULL);
  cin.tie(NULL);
  cout.tie(NULL);
  cin >> s;
  for (int i = 0; i <= 2; ++i)
    if (s[i] == 'A')
      ok1 = 1;
    else
      ok2 = 1;
  if (ok1 && ok2)
    cout << "Yes";
  else
    cout << "No";
}
Problem p02753 (C++)

Buggy submission (status: Runtime Error):
#include <bits/stdc++.h>
using namespace std;
#define lli long long int
int main() {
  lli n, i, j, flag = 0;
  cin >> n;
  string s;
  cin >> s;
  for (i = 0; i < s.size() - 1; i++) {
    if (s[i] != s[i + 1]) {
      flag = 1;
      break;
    }
  }
  if (flag == 0)
    cout << "No" << '\n';
  else
    cout << "Yes" << '\n';

  return 0;
}


Fixed submission:
#include <bits/stdc++.h>
using namespace std;
#define lli long long int
int main() {
  lli n, i, j, flag = 0;
  string s;
  cin >> s;
  for (i = 0; i < s.size() - 1; i++) {
    if (s[i] != s[i + 1]) {
      flag = 1;
      break;
    }
  }
  if (flag == 0)
    cout << "No" << '\n';
  else
    cout << "Yes" << '\n';

  return 0;
}
Problem p02753 (C++)

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

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<int, int> ii;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<ii> vii;
typedef vector<vi> vvi;
typedef vector<vll> vvll;
typedef vector<vii> vvii;

#define fastIO ios::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL)
#define forw(i, l, r) for (int i = (l); i < (r); i++)
#define forb(i, r, l) for (int i = (r); i > (l); i--)
#define log2i(x) 32 - __builtin_clz((x)) - 1
#define log2ll(x) 64 - __builtin_clzll((x)) - 1
#define Pi acos(-1.0)
#define sz(x) (int)x.size()
#define pw(x, y) trunc(exp(log((x)) * (y)))
#define mt make_tuple
#define mp make_pair
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()

string st;

int main() {
#ifndef ONLINE_JUDGE
  freopen("test.inp", "r", stdin);
  freopen("test.out", "w", stdout);
#endif
  fastIO;
  cin >> st;
  if (count(all(st), 'A') == 2 || count(all(st), 'B') == 2)
    cout << "Yes";
  else
    cout << "No";
  return 0;
}


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

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<int, int> ii;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<ii> vii;
typedef vector<vi> vvi;
typedef vector<vll> vvll;
typedef vector<vii> vvii;

#define fastIO ios::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL)
#define forw(i, l, r) for (int i = (l); i < (r); i++)
#define forb(i, r, l) for (int i = (r); i > (l); i--)
#define log2i(x) 32 - __builtin_clz((x)) - 1
#define log2ll(x) 64 - __builtin_clzll((x)) - 1
#define Pi acos(-1.0)
#define sz(x) (int)x.size()
#define pw(x, y) trunc(exp(log((x)) * (y)))
#define mt make_tuple
#define mp make_pair
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()

string st;

int main() {
#ifndef ONLINE_JUDGE
  // freopen("test.inp","r",stdin);
  // freopen("test.out","w",stdout);
#endif
  fastIO;
  cin >> st;
  if (count(all(st), 'A') == 2 || count(all(st), 'B') == 2)
    cout << "Yes";
  else
    cout << "No";
  return 0;
}
Problem p02753 (C++)

Buggy submission (status: Runtime Error):
#include <bits/stdc++.h>
#define fup(i, a, b) for (int i = a; i <= b; ++i)
#define fdw(i, a, b) for (int i = a; i >= b; --i)
#define sync                                                                   \
  ios::sync_with_stdio(false);                                                 \
  cin.tie(0)
#define cl(a) memset(a, 0, sizeof(a))
#define gcd __gcd
#define fi first
#define se second
#define pb push_back
#pragma GCC optimize(2)
using namespace std;
typedef long long ll;
// ll lcm(ll a,ll b){return a/gcd(a,b)*b;}
// ll ksm(ll a,ll b,ll mod){ll res=1;a%=mod;for(;b;b>>=1){if(b&1)
// res=res*a%mod;a=a*a%mod;}return res;} ll oula(ll n){ ll res=n;for(ll
// i=2;i*i<=n;i++){if(n%i==0){ res=res-res/i;while(n%i==0) n/=i;}}if(n>1)
// res=res-res/n;return res;} bool MRT(ll x){if(x==2)return true;fup(i,1,50){ll
// now=rand()%(x-2)+2;if(ksm(now,x-1,x)!=1)return false;}return true;} void
// shai(int n)fup(i,2,n){if(isprime[i]){v.push_back(i);for(int
// j=2*i;j<=10000;j+=i)isprime[j]=0;}}//"埃氏筛筛选素数"
const int mod = 1e9 + 7;
const int inf = 0x3f3f3f3f;
const double eps = 1e-7;
const int N = 4e5 + 10;
int main() {
#ifdef ONLINE_JUDGE
#else
  freopen("D:\\untitled3\\in", "r", stdin);
#endif
  sync;
  string s;
  cin >> s;
  int t1 = 0, t2 = 0;
  fup(i, 0, 2) {
    if (s[i] == 'A')
      t1++;
    else
      t2++;
  }
  if (t1 && t2) {
    cout << "Yes" << endl;
  } else
    cout << "No" << endl;
  return 0;
}

Fixed submission:
#include <bits/stdc++.h>
#define fup(i, a, b) for (int i = a; i <= b; ++i)
#define fdw(i, a, b) for (int i = a; i >= b; --i)
#define sync                                                                   \
  ios::sync_with_stdio(false);                                                 \
  cin.tie(0)
#define cl(a) memset(a, 0, sizeof(a))
#define gcd __gcd
#define fi first
#define se second
#define pb push_back
#pragma GCC optimize(2)
using namespace std;
typedef long long ll;
// ll lcm(ll a,ll b){return a/gcd(a,b)*b;}
// ll ksm(ll a,ll b,ll mod){ll res=1;a%=mod;for(;b;b>>=1){if(b&1)
// res=res*a%mod;a=a*a%mod;}return res;} ll oula(ll n){ ll res=n;for(ll
// i=2;i*i<=n;i++){if(n%i==0){ res=res-res/i;while(n%i==0) n/=i;}}if(n>1)
// res=res-res/n;return res;} bool MRT(ll x){if(x==2)return true;fup(i,1,50){ll
// now=rand()%(x-2)+2;if(ksm(now,x-1,x)!=1)return false;}return true;} void
// shai(int n)fup(i,2,n){if(isprime[i]){v.push_back(i);for(int
// j=2*i;j<=10000;j+=i)isprime[j]=0;}}//"埃氏筛筛选素数"
const int mod = 1e9 + 7;
const int inf = 0x3f3f3f3f;
const double eps = 1e-7;
const int N = 4e5 + 10;
int main() {

  sync;
  string s;
  cin >> s;
  int t1 = 0, t2 = 0;
  fup(i, 0, 2) {
    if (s[i] == 'A')
      t1++;
    else
      t2++;
  }
  if (t1 && t2) {
    cout << "Yes" << endl;
  } else
    cout << "No" << endl;
  return 0;
}
Problem p02753 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <bits/stdc++.h>
using namespace std;
#define rep(i, N) for (int i = 0; i < N; i++)
#define all(x) x.begin(), x.end()
#define sort(x) sort(all(x))
#define cou(x) cout << x << endl
using lint = long long;
int main() {
  string N;
  cin >> N;
  cou((N == "AAA" || N == "BBB" ? "No" : "Yes"));
  rep(i, 1000) {
    rep(j, 1000) {
      rep(k, 200) { N = "処理"; }
    }
  }
}

Fixed submission:
#include <bits/stdc++.h>
using namespace std;
#define rep(i, N) for (int i = 0; i < N; i++)
#define all(x) x.begin(), x.end()
#define sort(x) sort(all(x))
#define cou(x) cout << x << endl
using lint = long long;
int main() {
  string N;
  cin >> N;
  cou((N == "AAA" || N == "BBB" ? "No" : "Yes"));
  rep(i, 1000) {
    rep(j, 1000) {
      rep(k, 100) { N = "処理"; }
    }
  }
}
Problem p02753 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <bits/stdc++.h>
using namespace std;
#define rep(i, N) for (int i = 0; i < N; i++)
#define all(x) x.begin(), x.end()
#define sort(x) sort(all(x))
#define cou(x) cout << x << endl
using lint = long long;
int main() {
  string N;
  cin >> N;
  cou((N == "AAA" || N == "BBB" ? "No" : "Yes"));
  rep(i, 1000) {
    rep(j, 1000) {
      rep(k, 140) { N = "処理"; }
    }
  }
}

Fixed submission:
#include <bits/stdc++.h>
using namespace std;
#define rep(i, N) for (int i = 0; i < N; i++)
#define all(x) x.begin(), x.end()
#define sort(x) sort(all(x))
#define cou(x) cout << x << endl
using lint = long long;
int main() {
  string N;
  cin >> N;
  cou((N == "AAA" || N == "BBB" ? "No" : "Yes"));
  rep(i, 1000) {
    rep(j, 1000) {
      rep(k, 135) { N = "処理"; }
    }
  }
}
Problem p02753 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <bits/stdc++.h>
using namespace std;
#define rep(i, N) for (int i = 0; i < N; i++)
#define all(x) x.begin(), x.end()
#define sort(x) sort(all(x))
#define cou(x) cout << x << endl
using lint = long long;
int main() {
  string N;
  cin >> N;
  cou((N == "AAA" || N == "BBB" ? "No" : "Yes"));
  rep(i, 1000) {
    rep(j, 1020) {
      rep(k, 135) { N = "処理"; }
    }
  }
}

Fixed submission:
#include <bits/stdc++.h>
using namespace std;
#define rep(i, N) for (int i = 0; i < N; i++)
#define all(x) x.begin(), x.end()
#define sort(x) sort(all(x))
#define cou(x) cout << x << endl
using lint = long long;
int main() {
  string N;
  cin >> N;
  cou((N == "AAA" || N == "BBB" ? "No" : "Yes"));
  rep(i, 1000) {
    rep(j, 1005) {
      rep(k, 135) { N = "処理"; }
    }
  }
}
Problem p02753 (C++)

Buggy submission (status: Runtime Error):
#include <bits/stdc++.h>
using namespace std;
int main() {
  string s;
  cin >> s;
  if (s.at(1) == s.at(2) && s.at(2) == s.at(3)) {
    cout << "No" << endl;
  } else {
    cout << "Yes" << endl;
  }
}


Fixed submission:
#include <bits/stdc++.h>
using namespace std;
int main() {
  string s;
  cin >> s;
  if (s.at(1) == s.at(2) && s.at(2) == s.at(0)) {
    cout << "No" << endl;
  } else {
    cout << "Yes" << endl;
  }
}
Problem p02753 (C++)

Buggy submission (status: Runtime Error):
#include <bits/stdc++.h>
using namespace std;
#define pi 3.14159265359
#define int long long
#define pii pair<int, int>
const int mod = 1e9 + 7;

int dx[] = {-1, 0, 1, 0};
int dy[] = {0, -1, 0, 1};

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

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

  string s;
  cin >> s;

  if (s[0] == s[1] && s[1] == s[2]) {
    cout << "No\n";
  } else
    cout << "Yes\n";
}


Fixed submission:
#include <bits/stdc++.h>
using namespace std;
#define pi 3.14159265359
#define int long long
#define pii pair<int, int>
const int mod = 1e9 + 7;

int dx[] = {-1, 0, 1, 0};
int dy[] = {0, -1, 0, 1};

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

  string s;
  cin >> s;

  if (s[0] == s[1] && s[1] == s[2]) {
    cout << "No\n";
  } else
    cout << "Yes\n";
}
Problem p02753 (C++)

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

int main() {
#ifndef ONLINE_JUDGE
  freopen("in.in", "r", stdin);
// freopen("out.out", "w", stdout);
#endif // ONLINE_JUDGE
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  string s;
  cin >> s;
  if (s[0] == s[1] && s[1] == s[2])
    cout << "No";
  else
    cout << "Yes";
  return 0;
}

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

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  string s;
  cin >> s;
  if (s[0] == s[1] && s[1] == s[2])
    cout << "No";
  else
    cout << "Yes";
  return 0;
}
Problem p02753 (C++)

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

typedef unsigned long long int ull;
typedef long long int ll;
typedef vector<ll> vi;

#define fast                                                                   \
  ios_base::sync_with_stdio(0);                                                \
  cin.tie(0);                                                                  \
  cout.tie(0);
#define nl cout << '\n'
#define pb push_back
#define all(s) s.begin(), s.end()
#define bs binary_search

#define gcd(a, b) __gcd((a), (b))
#define lcm(a, b) (a) * (b) / (__gcd((a), (b)))

const int Mod = 1e9 + 7;
#define sum(a, b) (((a) % Mod) + ((b) % Mod)) % Mod
#define sub(a, b) (((a) % Mod) - ((b) % Mod)) % Mod
#define mul(a, b) (((a) % Mod) * ((b) % Mod)) % Mod

#define count1(x) __built_popcount(x)

#define loop(i, s, e) for (i = s; i < e; i++)
#define rloop(i, s, e) for (i = e; i >= s; i--)

#define dbg(x) cout << #x << ":" << x << endl;

bool isPowerOfTwo(int x) {
  /* First x in the below expression is for the case when x is 0 */
  return x && (!(x & (x - 1)));
}

ll pow(ll x, ll y, ll mod) {
  int ans = 1;
  while (y) {
    if (y & 1)
      ans = (ans * x) % mod;
    y /= 2;
    x = (x * x) % mod;
  }
  return ans;
}

int main() {
#ifndef ONLINE_JUDGE
  freopen("input.txt", "r", stdin);
  freopen("output.txt", "w", stdout);
  freopen("debug.txt", "w", stderr);
#endif
  fast;
  int i, a = 0, b = 0;
  string s;
  cin >> s;
  for (i = 0; i < 3; i++) {
    if (s[i] == 'A')
      a = 1;
    else
      b = 1;
  }
  if (a & b) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
}

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

typedef unsigned long long int ull;
typedef long long int ll;
typedef vector<ll> vi;

#define fast                                                                   \
  ios_base::sync_with_stdio(0);                                                \
  cin.tie(0);                                                                  \
  cout.tie(0);
#define nl cout << '\n'
#define pb push_back
#define all(s) s.begin(), s.end()
#define bs binary_search

#define gcd(a, b) __gcd((a), (b))
#define lcm(a, b) (a) * (b) / (__gcd((a), (b)))

const int Mod = 1e9 + 7;
#define sum(a, b) (((a) % Mod) + ((b) % Mod)) % Mod
#define sub(a, b) (((a) % Mod) - ((b) % Mod)) % Mod
#define mul(a, b) (((a) % Mod) * ((b) % Mod)) % Mod

#define count1(x) __built_popcount(x)

#define loop(i, s, e) for (i = s; i < e; i++)
#define rloop(i, s, e) for (i = e; i >= s; i--)

#define dbg(x) cout << #x << ":" << x << endl;

bool isPowerOfTwo(int x) {
  /* First x in the below expression is for the case when x is 0 */
  return x && (!(x & (x - 1)));
}

ll pow(ll x, ll y, ll mod) {
  int ans = 1;
  while (y) {
    if (y & 1)
      ans = (ans * x) % mod;
    y /= 2;
    x = (x * x) % mod;
  }
  return ans;
}

int main() {

  fast;
  int i, a = 0, b = 0;
  string s;
  cin >> s;
  for (i = 0; i < 3; i++) {
    if (s[i] == 'A')
      a = 1;
    else
      b = 1;
  }
  if (a & b) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
}
Problem p02753 (Python)

Buggy submission (status: Runtime Error):
s = input()
Q = int(input())
flag = True  # flagがTrueのとき、偶数回数の反転が行われている
cnt = 0
for _ in range(Q):
    query = list(map(str, input().split()))
    # tmp.append(query)
    if len(query) == 1:  # 1のqueryのとき
        cnt += 1
        if flag:
            flag = False
        else:
            flag = True
    else:
        f, c = query[1], query[2]
        if f == "1":  # 先頭に追加するもの
            if flag:
                s = c + s  # 偶数回の反転なら素直に先頭に追加する
            else:
                s += c  # 奇数会の反転なら後ろに追加する
        else:  # 末尾に追加する
            if flag:
                s += c
            else:
                s = c + s

if cnt % 2 == 1 and cnt != 0:
    s = s[::-1]
print(s)


Fixed submission:
S = input()
if "A" in S and "B" in S:
    print("Yes")
else:
    print("No")
Problem p02753 (Python)

Buggy submission (status: Runtime Error):
S = list(input())
Q = int(input())
for i in range(Q):
    query = input().split()
    if int(query[0]) == 1:
        S.reverse()
    else:
        if int(query[1]) == 1:
            S.insert(0, query[2])
        else:
            S.append(query[2])
print("".join(S))


Fixed submission:
S = input()
if len(set(S)) == 2:
    print("Yes")
else:
    print("No")
Problem p02753 (C++)

Buggy submission (status: Runtime Error):
#include <bits/stdc++.h>
using namespace std;
int main() {
  string s[3];
  cin >> s[3];
  if (s[0] == s[1] && s[1] == s[2]) {
    cout << "No";
  } else {
    cout << "Yes";
  }
  return 0;
}

Fixed submission:
#include <bits/stdc++.h>
using namespace std;
int main() {
  string s;
  for (int i = 0; i < 3; i++) {
    cin >> s[i];
  }
  if ((s[0] == s[1]) && (s[1] == s[2])) {
    cout << "No";
  } else {
    cout << "Yes";
  }
  return 0;
}
Problem p02753 (Python)

Buggy submission (status: Runtime Error):
s = int(input())
if s in "AAA-BBB":
    print("No")
else:
    print("Yes")


Fixed submission:
s = input()
if s in "AAA-BBB":
    print("No")
else:
    print("Yes")
Problem p02753 (C++)

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

int main() {
  string S = 0;
  cin >> S;
  if (S[0] == S[1] && S[1] == S[2]) {
    cout << "No" << endl;
  } else {
    cout << "Yes" << endl;
  }
}


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

int main() {
  string S;
  cin >> S;
  if (S[0] == S[1] && S[1] == S[2]) {
    cout << "No" << endl;
  } else {
    cout << "Yes" << endl;
  }
}
Problem p02753 (C++)

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

int main() {
  string s;
  char AB[3] = "AB";

  cin >> s;

  int n_a = 0;
  int n_b = 0;
  for (int i = 0; i < s.size(); i++) {
    if (s[i] == AB[0]) {
      n_a++;
    } else {
      n_b++;
    }
  }

  if (n_a == 0 || n_b == 0) {
    cout << "No" << endl;
  } else {
    cout << "Yes" << endl;
  }

  return 1;
}

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

int main() {
  string s;
  char AB[3] = "AB";

  cin >> s;

  int n_a = 0;
  int n_b = 0;
  for (int i = 0; i < s.size(); i++) {
    if (s[i] == AB[0]) {
      n_a++;
    } else {
      n_b++;
    }
  }

  if (n_a == 0 || n_b == 0) {
    cout << "No" << endl;
  } else {
    cout << "Yes" << endl;
  }

  return 0;
}
Problem p02753 (C++)

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

int main() {
  string S;
  cin >> S;

  if (S.at(1) == S.at(2) && S.at(2) == S.at(3)) {
    cout << "No" << endl;
  }

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


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

int main() {
  string S;
  cin >> S;

  if (S == "AAA") {
    cout << "No" << endl;
  } else if (S == "BBB") {
    cout << "No" << endl;
  }

  else {
    cout << "Yes" << endl;
  }
}
Problem p02753 (Python)

Buggy submission (status: Runtime Error):
s = input()

if s[0] == s[1] and s[2] == s[3] and s[3] == s[1]:
    print("No")
else:
    print("Yes")


Fixed submission:
s = input()

if s[0] == s[1] and s[1] == s[2] and s[2] == s[0]:
    print("No")
else:
    print("Yes")
Problem p02754 (C++)

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

int main() {
  int N, A, B, ans = 0;
  cin >> N >> A >> B;
  ans += A * (N / (A + B));
  ans += min(A, N % (A + B));
  cout << ans << endl;
}

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

int main() {
  int64_t N, A, B, ans = 0;
  cin >> N >> A >> B;
  ans += A * (N / (A + B));
  ans += min(A, N % (A + B));
  cout << ans << endl;
}
Problem p02754 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <bits/stdc++.h>
using namespace std;
typedef long long int lli;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(nullptr);
  cout.tie(nullptr);
  lli i, n, a, b, c = 0;
  cin >> n >> a >> b;
  for (i = 0; n > 0; ++i) {
    if (i % 2 == 0) {
      if (n - a > 0) {
        n -= a;
        c += a;
      } else {
        c += n;
        n = 0;
      }
    } else {
      if (n - b > 0) {
        n -= b;
      } else {
        n = 0;
      }
    }
  }
  cout << c;
  return 0;
}


Fixed submission:
#include <bits/stdc++.h>
using namespace std;
typedef long long int lli;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(nullptr);
  cout.tie(nullptr);
  lli i, n, a, b, c = 0;
  cin >> n >> a >> b;
  c += (n / (a + b)) * a;
  n %= (a + b);
  if (n > a)
    c += a;
  else
    c += n;
  cout << c;
  return 0;
}
Problem p02754 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using V = vector<ll>;
#define _GLIBCXX_DEBUG
#define rep(i, a, b) for (int i = a; i < b; i++)
#define ALL(v) v.begin(), v.end()

int main() {
  ll n, a, b;
  cin >> n >> a >> b;
  string s = {};
  ll ans = 0;
  while (1) {
    rep(i, 0, a) {
      s.push_back('b');
      ans++;
    }
    rep(i, 0, b) s.push_back('r');
    if (s.size() >= n)
      break;
    if (s.size() + b > n) {
      rep(i, 0, n - s.size()) ans++;
      break;
    }
  }
  cout << ans << endl;
}


Fixed submission:
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using V = vector<ll>;
#define _GLIBCXX_DEBUG
#define rep(i, a, b) for (int i = a; i < b; i++)
#define ALL(v) v.begin(), v.end()

int main() {
  ll n, a, b;
  cin >> n >> a >> b;
  ll ans = 0, rem;
  ans += a * (n / (a + b));
  rem = n % (a + b);
  ans += min(rem, a);
  cout << ans << endl;
}
Problem p02754 (C++)

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

int main() {
  int N, blue, red, num, blue_red, nokori;
  cin >> N >> blue >> red;
  blue_red = blue + red;
  nokori = (N % (blue_red));
  num = N / (blue_red)*blue + min(blue, nokori);
  cout << num << endl;
}

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

int main() {
  int64_t N, blue, red, num, blue_red, nokori;
  cin >> N >> blue >> red;
  blue_red = blue + red;
  nokori = (N % (blue_red));
  num = N / (blue_red)*blue + min(blue, nokori);
  cout << num << endl;
}
Problem p02754 (C++)

Buggy submission (status: Runtime Error):
#include <iostream>
using namespace std;
int main() {
  int n, a, b, loop = 0, rem = 0;
  cin >> n >> a >> b;
  loop = n / (a + b);
  rem = n % (a + b);
  if (rem > a)
    rem = a;
  cout << loop * a + rem << endl;
}

Fixed submission:
#include <iostream>
using namespace std;
int main() {
  unsigned long long n, a, b, loop = 0, rem = 0;
  cin >> n >> a >> b;
  loop = n / (a + b);
  rem = n % (a + b);
  if (rem > a)
    rem = a;
  cout << loop * a + rem << endl;
}
Problem p02754 (C++)

Buggy submission (status: Runtime Error):
#include <bits/stdc++.h>
using namespace std;
int main() {
  int N, A, B, loop;
  cin >> N >> A >> B;
  loop = N / (A + B);
  cout << (loop * A + min(N % (A + B), A));
  return 0;
}


Fixed submission:
#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int N, A, B, loop;
  cin >> N >> A >> B;
  loop = N / (A + B);
  cout << (loop * A + min(N % (A + B), A));
  return 0;
}
Problem p02754 (C++)

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

int n, a, b, c, res;

int main() {
  cin >> n >> a >> b;
  res = res + n / (a + b) * a;
  c = n % (a + b);
  if (c > a) {
    cout << res + a << endl;
  } else {
    cout << res + c << endl;
  }
}


Fixed submission:
#include <bits/stdc++.h>
using namespace std;
long long n, a, b, c, res;

int main() {
  cin >> n >> a >> b;
  res = res + n / (a + b) * a;
  c = n % (a + b);
  if (c > a) {
    cout << res + a << endl;
  } else {
    cout << res + c << endl;
  }
}
Problem p02754 (C++)

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

int main() {
  ll n, a, b;
  cin >> n >> a >> b;
  ll ans = 0;
  while (1) {
    if (n >= a) {
      ans += a;
    } else {
      ans += n;
    }

    if (a + b >= n) {
      break;
    }
    n -= a + b;
  }
  cout << ans << endl;
}


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

int main() {
  ll n, a, b;
  cin >> n >> a >> b;
  ll amari = (n % (a + b));
  ll ans = (n / (a + b)) * a;
  if (amari > a) {
    ans += a;
  } else {
    ans += amari;
  }
  cout << ans << endl;
}
Problem p02754 (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++)
using ll = long long;

int main() {
  int n, a, b;
  cin >> n >> a >> b;
  int ans = 0;
  int A = n / (a + b);
  ans += A * a;
  int B = n % (a + b);
  ans += B;
  cout << ans << endl;
}

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

int main() {
  ll N, A, B;
  cin >> N >> A >> B;
  ll ans = 0;
  if (N > A + B) {
    ans += (N / (A + B)) * A;
    if (N % (A + B) <= A)
      ans += N % (A + B);
    else
      ans += A;
  } else {
    ans += A;
  }
  if (N < A)
    ans = N;
  cout << ans << endl;
}
Problem p02754 (C++)

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

int main() {
  int N, A, B;
  cin >> N >> A >> B;
  if (N % (A + B) >= A) {
    cout << (N / (A + B)) * A + A << endl;
  } else {
    cout << (N / (A + B)) * A + N % (A + B) << endl;
  }
  return 0;
}

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

int main() {
  long long N, A, B;
  cin >> N >> A >> B;
  if (N % (A + B) >= A) {
    cout << (N / (A + B)) * A + A << endl;
  } else {
    cout << (N / (A + B)) * A + N % (A + B) << endl;
  }
  return 0;
}
Problem p02754 (C++)

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

#define pr pair<int, int>

using namespace std;

const ll mod = 1000000007;
const ll INF = (ll)1000000007 * 1000000007;

// #define DEBUG

#ifdef DEBUG
#define PRINT(A) std::cout << (#A) << ":" << (A) << std::endl;
#else
#define PRINT(A)
#endif

template <class T> inline bool chmin(T &a, T b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}
template <class T> inline bool chmax(T &a, T b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}

// int a[10010][10010], b[1000];
// int dp[10010][3];

int S[10][1000];

void chAllVal(int before, int after, int h, int w) {
  rep(i, h * w) {
    if (S[i / w][i % w] == before) {
      S[i / w][i % w] = after;
    }
  }
}

int main() {

  int N, A, B;
  cin >> N >> A >> B;
  cout << N / (A + B) * A + min(A, N % (A + B)) << endl;
  return 0;
}


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

#define pr pair<int, int>

using namespace std;

const ll mod = 1000000007;
const ll INF = (ll)1000000007 * 1000000007;

// #define DEBUG

#ifdef DEBUG
#define PRINT(A) std::cout << (#A) << ":" << (A) << std::endl;
#else
#define PRINT(A)
#endif

template <class T> inline bool chmin(T &a, T b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}
template <class T> inline bool chmax(T &a, T b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}

// int a[10010][10010], b[1000];
// int dp[10010][3];

int S[10][1000];

void chAllVal(int before, int after, int h, int w) {
  rep(i, h * w) {
    if (S[i / w][i % w] == before) {
      S[i / w][i % w] = after;
    }
  }
}

int main() {

  ll N, A, B;
  cin >> N >> A >> B;
  cout << N / (A + B) * A + min(A, N % (A + B)) << endl;
  return 0;
}
Problem p02754 (C++)

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

int main() {

  int N, A, B;
  cin >> N >> A >> B;

  cout << N / (A + B) * A + min(N - N / (A + B) * (A + B), A) << endl;
}

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

int main() {

  int64_t N, A, B;
  cin >> N >> A >> B;

  cout << N / (A + B) * A + min(N - N / (A + B) * (A + B), A) << endl;
}
Problem p02754 (C++)

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

int main() {
  ll N, A, B;
  cin >> N >> A >> B;
  ll cnt = 0;
  do {
    if (N < A) {
      cnt += N;
      break;
    } else {
      N -= A;
      cnt += A;
    }
    N -= B;
  } while (N >= 0);
  cout << cnt << endl;
}

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

int main() {
  ll N, A, B;
  cin >> N >> A >> B;
  ll cnt = 0;
  ll cntr = (ll)(N / (A + B));
  ll amari = N - cntr * (A + B);
  if (amari < A) {
    cnt = cntr * A + amari;
  } else {
    cnt = (cntr + 1) * A;
  }
  cout << cnt << endl;
}
Problem p02754 (C++)

Buggy submission (status: Runtime Error):
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <iostream>
using namespace std;
int n, a, b;
int main() {
  cin >> n >> a >> b;
  cout << n / (a + b) * a + min(a, n % (a + b));
  return 0;
}

Fixed submission:
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <iostream>
using namespace std;
long long n, a, b;
int main() {
  cin >> n >> a >> b;
  cout << n / (a + b) * a + min(a, n % (a + b));
  return 0;
}
Problem p02754 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int a, b, c, d, ans, j, p, i;
  cin >> a >> b >> c;
  ans = 0;
  p = 0;
  i = 1;
  while (a != 0) {
    if (i % 2 != 0) {
      if (a > b) {
        ans += b;
        a -= b;
      } else {
        ans += a;
        a -= a;
      }
    } else {
      if (a > c) {
        a -= c;
      } else {
        a -= a;
      }
    }
    i++;
  }
  cout << ans << endl;
}


Fixed submission:
#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int a, b, c, d, ans, j, p, i;
  cin >> a >> b >> c;
  i = a / (b + c);
  j = a % (b + c);
  ans = b * i + min(j, b);
  cout << ans << endl;
}
Problem p02754 (C++)

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

int main() {
  int N, A, B;
  cin >> N >> A >> B;
  if (N % (A + B) > A) {
    cout << (N / (A + B)) * A + A << endl;
  } else if (N % (A + B) <= A) {
    cout << ((N / A + B)) * A + (N % (A + B)) << endl;
  }
}


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

int main() {
  long long n, a, b;
  cin >> n >> a >> b;
  if (n % (a + b) >= a) {
    cout << (n / (a + b)) * a + a << endl;
  } else {
    cout << (n / (a + b)) * a + n % (a + b) << endl;
  }
}
Problem p02754 (C++)

Buggy submission (status: Runtime Error):
// #include<bits/stdc++.h>
#include <algorithm>
#include <assert.h>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <queue>
#include <stack>
#include <vector>
using namespace std;
#define de_x(x) cout << #x << "->debug_val: " << x << endl;
#define de_ve(x)                                                               \
  for (auto it : x)                                                            \
    cout << it << " ";
#define rep(i, a, n) for (int i = a; i < n; i++)
#define _rep(i, a, n) for (int i = a; i <= n; i++)
#define per(i, a, n) for (int i = n - 1; i >= a; i--)
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define SZ(x) ((int)(x).size())
#define all(x) (x).begin(), (x).end()
typedef long long ll;
typedef vector<int> VI;
typedef pair<int, int> PII;
typedef double db;
// std::mt19937 mrand(random_device{}());
// int rnd(int x) { return mrand() % x ; }
const ll mod = 1e7;
ll ksm(ll a, ll b) {
  ll res = 1;
  a %= mod;
  assert(b >= 0);
  for (; b; b >>= 1) {
    if (b & 1)
      res = res * a % mod;
    a = a * a % mod;
  }
  return res;
}
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
int _, n, m;
/***********************/
void run() {}
int main() {
  //    for(scanf("%d",&_);_;_--) run();
  int a, b, ans = 0, res;
  cin >> n >> a >> b;
  ans = n / (a + b) * a;
  res = n % (a + b);
  ans += min(res, a);
  cout << ans << endl;
  return 0;
}

Fixed submission:
// #include<bits/stdc++.h>
#include <algorithm>
#include <assert.h>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <queue>
#include <stack>
#include <vector>
using namespace std;
#define de_x(x) cout << #x << "->debug_val: " << x << endl;
#define de_ve(x)                                                               \
  for (auto it : x)                                                            \
    cout << it << " ";
#define rep(i, a, n) for (int i = a; i < n; i++)
#define _rep(i, a, n) for (int i = a; i <= n; i++)
#define per(i, a, n) for (int i = n - 1; i >= a; i--)
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define SZ(x) ((int)(x).size())
#define all(x) (x).begin(), (x).end()
typedef long long ll;
typedef vector<int> VI;
typedef pair<int, int> PII;
typedef double db;
// std::mt19937 mrand(random_device{}());
// int rnd(int x) { return mrand() % x ; }
const ll mod = 1e7;
ll ksm(ll a, ll b) {
  ll res = 1;
  a %= mod;
  assert(b >= 0);
  for (; b; b >>= 1) {
    if (b & 1)
      res = res * a % mod;
    a = a * a % mod;
  }
  return res;
}
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
int _, n, m;
/***********************/
void run() {}
int main() {
  //    for(scanf("%d",&_);_;_--) run();
  ll x, y, z;
  cin >> x >> y >> z;
  cout << x / (y + z) * y + min(x % (z + y), y) << endl;
  return 0;
}
Problem p02754 (C++)

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

typedef unsigned long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<pii> vii;
typedef vector<pll> vll;

#define mem0(x) memset(x, 0, sizeof(x))
#define asort(x) sort(x.begin(), x.end());
#define dsort(x, t) sort(x.begin(), a.end(), greater<t>());
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end());
#define MINS(m, s) m.insert(mp(s, 1));
#define MFIN(m, s) m.find(s) != m.end()
#define mp make_pair
#define pb push_back
#define INF (1 << 29)
const int mod = 1000000007;

int main() {
  ll N, A, B, ans;
  ans = 0;
  cin >> N >> A >> B;
  while (N > 0) {
    N -= A;
    ans += A;
    if (N <= 0) {
      ans = ans + N;
      break;
    }
    N -= B;
  }
  cout << ans << endl;
  return 0;
}

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

typedef unsigned long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<pii> vii;
typedef vector<pll> vll;

#define mem0(x) memset(x, 0, sizeof(x))
#define asort(x) sort(x.begin(), x.end());
#define dsort(x, t) sort(x.begin(), a.end(), greater<t>());
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end());
#define MINS(m, s) m.insert(mp(s, 1));
#define MFIN(m, s) m.find(s) != m.end()
#define mp make_pair
#define pb push_back
#define INF (1 << 29)
const int mod = 1000000007;

int main() {
  ll N, A, B, ans;
  ans = 0;
  cin >> N >> A >> B;
  ans = N / (A + B) * A + min(N % (A + B), A);
  cout << ans << endl;
  return 0;
}
Problem p02754 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <algorithm>
#include <iostream>
#include <string>
using namespace std;
#define ll long long
int main() {
  ll n, a, b;
  cin >> n >> a >> b;
  ll i = 0, k = 0, ans = 0;
  while (i < n) {
    if ((k % 2) == 0) {
      if (i + a < n) {
        i += a;
        ans += a;
      } else {
        ans += (n - i);
        i = n;
      }

    } else {
      if (i + b < n) {
        i += b;
        // ans+=a;
      } else {
        // ans+=(n-i);
        i = n;
      }
    }
    k++;
  }
  cout << ans;
}

Fixed submission:
#include <algorithm>
#include <iostream>
#include <string>
using namespace std;
#define ll long long
int main() {
  ll n, a, b;
  cin >> n >> a >> b;
  ll i = 0, k = 0, ans = 0;
  ll q = n / (a + b);
  ll r = n % (a + b);
  ans = q * a;
  if (r > a)
    r = a;
  ans += r;
  cout << ans;
}
Problem p02754 (C++)

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

using namespace std;

int main() {
  int N, blue, red, anadir;
  cin >> N >> blue >> red;
  if (N % (blue + red) <= blue)
    anadir = N % (blue + red);
  else
    anadir = blue;
  cout << ((N / (blue + red)) * blue) + anadir;
}

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

using namespace std;

int main() {
  long long N, blue, red, anadir;
  cin >> N >> blue >> red;
  if (N % (blue + red) <= blue)
    anadir = N % (blue + red);
  else
    anadir = blue;
  cout << ((N / (blue + red)) * blue) + anadir;
}
Problem p02754 (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;
  int A, B;
  cin >> N >> A >> B;
  cout << N / (A + B) * A + min(N % (A + B), A) << endl;
}

Fixed submission:
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
int main() {
  int64_t N;
  int64_t A, B;
  cin >> N >> A >> B;
  cout << N / (A + B) * A + min(N % (A + B), A) << endl;
}
Problem p02754 (C++)

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

int main() {
  int n, a, b;
  int ans;
  cin >> n >> a >> b;

  ans = (n / (a + b)) * a + min(a, n % (a + b));
  cout << ans << endl;
}

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

int main() {
  unsigned long long n, a, b;
  unsigned long long ans;
  cin >> n >> a >> b;

  ans = (n / (a + b)) * a + min(a, n % (a + b));
  cout << ans << endl;
}
Problem p02754 (C++)

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

using namespace std;
using namespace std;
#define rep(i, n) for (long long i = 0; i < (long long)(n); i++)
// rep…「0からn-1まで」の繰り返し
#define rep2(i, s, n) for (long long i = s; i <= (long long)(n); i++)
// rep2…「sからnまで」の繰り返し
#define repr(i, s, n) for (long long i = s; i >= (long long)(n); i--)
// repr…「ｓからnまで」の降順の繰り返し

typedef long long ll;

const ll inf = 1e9 + 7;
const ll mod = 1e9 + 7;

int main() {
  int n, a, b;
  cin >> n >> a >> b;

  cout << a * (n / (a + b)) + min(n % (a + b), a) << endl;
}


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

using namespace std;
using namespace std;
#define rep(i, n) for (long long i = 0; i < (long long)(n); i++)
// rep…「0からn-1まで」の繰り返し
#define rep2(i, s, n) for (long long i = s; i <= (long long)(n); i++)
// rep2…「sからnまで」の繰り返し
#define repr(i, s, n) for (long long i = s; i >= (long long)(n); i--)
// repr…「ｓからnまで」の降順の繰り返し

typedef long long ll;

const ll inf = 1e9 + 7;
const ll mod = 1e9 + 7;

int main() {
  ll n, a, b;
  cin >> n >> a >> b;

  cout << a * (n / (a + b)) + min(n % (a + b), a) << endl;
}
Problem p02754 (C++)

Buggy submission (status: Runtime Error):
#include <bits/stdc++.h>
using namespace std;
const int INF = 1001001001;
int main() {
  long long n, a, b;
  cin >> n >> a >> b;
  string ans;
  for (int i = 0; i < n; i++) {
    if (ans.length() <= n) {
      ans += string(a, 'b');
      ans += string(b, 'r');
    }
  }
  long long cnt = 0;
  sort(ans.rbegin(), ans.rend());
  for (int i = 0; i < n; i++) {
    if (ans[i] == 'b')
      cnt++;
    if (ans[i] == 'a')
      break;
  }
  cout << cnt << endl;
}

Fixed submission:
#include <bits/stdc++.h>
using namespace std;
const int INF = 1001001001;
int main() {
  long long n, a, b;
  cin >> n >> a >> b;
  cout << n / (a + b) * a + min(n % (a + b), a) << endl;
}
Problem p02754 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for (int i = 0; i < (int)n; i++)
#define REPR(i, n) for (int i = (int)n - 1; i >= 0; i--)
#define FOR(i, m, n) for (int i = (int)m; i < (int)n; i++)
#define FORR(i, m, n) for (int i = (int)m - 1; i >= (int)n; i--)
#define ASC(v) sort(v.begin(), v.end());
#define DESC(v) sort(v.begin(), v.end(), greater<int>());
#define REVERSE(v) reverse(v.begin(), v.end());
#define DEBUG(x) cout << #x << ": " << x << "\n"
typedef long long ll;
struct nya {
  nya() {
    cin.tie(0);
    ios::sync_with_stdio(false);
  }
} nyan;

int main() {
  ll N, A, B;
  cin >> N >> A >> B;
  string s;

  if (A == 0) {
    cout << 0 << "\n";
    return 0;
  }

  ll res = 0;
  while (N > 0) {
    REP(i, A) {
      res++;
      N--;
      if (N == 0) {
        cout << res << "\n";
        return 0;
      }
    }
    REP(i, B) {
      N--;
      if (N == 0) {
        cout << res << "\n";
        return 0;
      }
    }
  }
}


Fixed submission:
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for (int i = 0; i < (int)n; i++)
#define REPR(i, n) for (int i = (int)n - 1; i >= 0; i--)
#define FOR(i, m, n) for (int i = (int)m; i < (int)n; i++)
#define FORR(i, m, n) for (int i = (int)m - 1; i >= (int)n; i--)
#define ASC(v) sort(v.begin(), v.end());
#define DESC(v) sort(v.begin(), v.end(), greater<int>());
#define REVERSE(v) reverse(v.begin(), v.end());
#define DEBUG(x) cout << #x << ": " << x << "\n"
typedef long long ll;
struct nya {
  nya() {
    cin.tie(0);
    ios::sync_with_stdio(false);
  }
} nyan;

int main() {
  ll N, A, B;
  cin >> N >> A >> B;
  string s;

  if (A == 0) {
    cout << 0 << "\n";
    return 0;
  }

  ll res = N / (A + B) * A;
  ll rem = N % (A + B);
  res += min(rem, A);
  cout << res << "\n";
}
Problem p02754 (C++)

Buggy submission (status: Runtime Error):
#include <bits/stdc++.h>
using namespace std;
int main() {
  int N, A, B;
  cin >> N >> A >> B;

  if (N % (A + B) >= A) {
    cout << (N / (A + B)) * A + A << endl;
  } else {
    cout << (N / (A + B)) * A + (N % (A + B)) << endl;
  }
}

Fixed submission:
#include <bits/stdc++.h>
using namespace std;
int main() {
  long long N, A, B;
  cin >> N >> A >> B;

  if (N % (A + B) >= A) {
    cout << (N / (A + B)) * A + A << endl;
  } else {
    cout << (N / (A + B)) * A + (N % (A + B)) << endl;
  }
}
Problem p02754 (C++)

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

int main() {
  int n, a, b = 0;
  int shou, amari = 0;
  cin >> n >> a >> b;

  shou = n / (a + b);
  amari = n % (a + b);

  if (amari <= a) {
    cout << shou * a + amari;
  } else {
    cout << shou * a + a;
  }
}

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

int main() {
  long n, a, b = 0;
  long shou, amari = 0;
  cin >> n >> a >> b;

  shou = n / (a + b);
  amari = n % (a + b);

  if (amari <= a) {
    cout << shou * a + amari;
  } else {
    cout << shou * a + a;
  }
}