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

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

int main() {
  int a;
  string s, t;
  cin >> a;
  cin >> s >> t;
  string ans = s + t;
  for (int i = 0; i < 2 * a; i++) {
    if (i % 2 == 0) {
      ans.at(i) = s.at(i / 2);
    } else {
      ans.at(i) = s.at((i + 1) / 2);
    }
  }
  cout << ans << endl;
}


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

int main() {
  int a;
  string s, t;
  cin >> a;
  cin >> s >> t;
  string ans = s + t;
  for (int i = 0; i < 2 * a; i++) {
    if (i % 2 == 0) {
      ans.at(i) = s.at(i / 2);
    } else {
      ans.at(i) = t.at((i - 1) / 2);
    }
  }
  cout << ans << endl;
}
Problem p02830 (C++)

Buggy submission (status: Runtime Error):
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define rep2(i, x, n) for (int i = x; i < (n); i++)
#define all(n) begin(n), end(n)
struct cww {
  cww() {
    ios::sync_with_stdio(false);
    cin.tie(0);
  }
} star;
const long long INF = numeric_limits<long long>::max();
typedef long long ll;
typedef vector<int> vint;
typedef vector<char> vchar;
typedef vector<vector<int>> vvint;
typedef vector<ll> vll;
typedef vector<vector<ll>> vvll;
typedef unsigned long long ull;

int main() {
  int N;
  cin >> N;
  vchar S(N), T(N);
  rep(i, N) { cin >> S[i]; }
  rep(i, N) { cin >> T[i]; }
  vchar ans(2 * N);
  int j = 0, k = 0;
  rep(i, 2 * N + 1) {
    if (i % 2 == 0)
      ans[i] = S[j++];
    else
      ans[i] = T[k++];
  }
  rep(i, 2 * N) { cout << ans[i]; }
}

Fixed submission:
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define rep2(i, x, n) for (int i = x; i < (n); i++)
#define all(n) begin(n), end(n)
struct cww {
  cww() {
    ios::sync_with_stdio(false);
    cin.tie(0);
  }
} star;
const long long INF = numeric_limits<long long>::max();
typedef long long ll;
typedef vector<int> vint;
typedef vector<char> vchar;
typedef vector<vector<int>> vvint;
typedef vector<ll> vll;
typedef vector<vector<ll>> vvll;
typedef unsigned long long ull;

int main() {
  int N;
  cin >> N;
  vchar S(N), T(N);
  rep(i, N) { cin >> S[i]; }
  rep(i, N) { cin >> T[i]; }
  vchar ans(2 * N);
  int j = 0, k = 0;
  rep(i, 2 * N) {
    if (i % 2 == 0)
      ans[i] = S[j++];
    else
      ans[i] = T[k++];
  }
  rep(i, 2 * N) { cout << ans[i]; }
}
Problem p02830 (C++)

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

int main() {

  int n;
  cin >> n;

  string s, t;
  cin >> s >> t;

  for (int i = 0; i < n * 2; i++) {
    cout << s.at(i) << t.at(i);
  }

  cout << endl;
}

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

int main() {

  int n;
  cin >> n;

  string s, t;
  cin >> s >> t;

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

  cout << endl;
}
Problem p02830 (C++)

Buggy submission (status: Runtime Error):
#include <iostream>
using namespace std;
int main() {
  int a;
  unsigned char *s = new unsigned char[101];
  unsigned char *t = new unsigned char[101];
  unsigned char *r = new unsigned char[101];
  cin >> a >> s >> t;
  for (int i = 0; i < a; i++) {
    r[2 * i] = s[i];
    r[2 * i + 1] = t[i];
  }
  cout << r;
  delete[] s;
  delete[] t;
  delete[] r;
  return 0;
}

Fixed submission:
#include <iostream>
using namespace std;
int main() {
  int a;
  unsigned char *s = new unsigned char[101];
  unsigned char *t = new unsigned char[101];
  unsigned char *r = new unsigned char[201];
  cin >> a >> s >> t;
  for (int i = 0; i < a; i++) {
    r[2 * i] = s[i];
    r[2 * i + 1] = t[i];
  }
  cout << r;
  delete[] s;
  delete[] t;
  delete[] r;
  return 0;
}
Problem p02830 (C++)

Buggy submission (status: Runtime Error):

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

int main() {
  int i, j, k, n, l, m;
  string str1, str2;
  string str3;
  cin >> n;
  cin >> str1 >> str2;
  for (i = 0, j = 0; i < n; i++) {
    str3[j++] = str1[i];
    str3[j++] = str2[i];
  }
  for (i = 0; i < n * n; i++) {
    cout << str3[i];
  }
  return 0;
}

Fixed submission:

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

int main() {
  int i, j, k, n, l, m;
  string str1, str2;
  string str3;
  cin >> n;
  cin >> str1 >> str2;
  for (i = 0, j = 0; i < n; i++) {
    str3[j++] = str1[i];
    str3[j++] = str2[i];
  }
  for (i = 0; i < n + n; i++) {
    cout << str3[i];
  }
  return 0;
}
Problem p02830 (C++)

Buggy submission (status: Runtime Error):
#include <bits/stdc++.h>
typedef long long int ll;
using namespace std;
const ll N = 1e6 + 9;
const ll p = 31;
const ll m = 1e9 + 7;
const ll inf = 1e14;
ll mod = 1e9 + 7;
ll powm(ll a, ll b) {
  ll res = 1;
  while (b) {
    if (b & 1)
      res = (res * a) % mod;
    a = (a * a) % mod;
    b >>= 1;
  }
  return res;
}

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

#ifndef ONLINE_JUDGE
  freopen("input.txt", "r", stdin);
  freopen("output.txt", "w", stdout);
#endif
  ll t = 1;
  // cin>>t;

  while (t--) {
    ll n;
    cin >> n;
    string s, t;
    cin >> s >> t;
    for (int i = 0; i < n; i++) {
      cout << s[i] << t[i];
    }
  }
}

Fixed submission:
#include <bits/stdc++.h>
typedef long long int ll;
using namespace std;
const ll N = 1e6 + 9;
const ll p = 31;
const ll m = 1e9 + 7;
const ll inf = 1e14;
ll mod = 1e9 + 7;
ll powm(ll a, ll b) {
  ll res = 1;
  while (b) {
    if (b & 1)
      res = (res * a) % mod;
    a = (a * a) % mod;
    b >>= 1;
  }
  return res;
}

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

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

  while (t--) {
    ll n;
    cin >> n;
    string s, t;
    cin >> s >> t;
    for (int i = 0; i < n; i++) {
      cout << s[i] << t[i];
    }
  }
}
Problem p02830 (C++)

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

int main() {
  int n;
  cin >> n;
  vector<char> a, b(n);
  rep(i, n) cin >> a[i];
  rep(i, n) cin >> b[i];
  rep(i, n) cout << a[i] << b[i];
  cout << endl;
}

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

int main() {
  int n;
  cin >> n;
  vector<char> a(n);
  vector<char> b(n);
  rep(i, n) cin >> a[i];
  rep(i, n) cin >> b[i];
  rep(i, n) cout << a[i] << b[i];
  cout << endl;
}
Problem p02830 (C++)

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

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

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

int main() {
  int N;
  string S, T;
  cin >> N >> S >> T;

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

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

int main() {
  int N;
  string S, T;
  cin >> N >> S >> T;

  for (int i = 0; i < N; i++) {
    cout << S.at(i) << T.at(i);
  }
}
Problem p02830 (C++)

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

int main() {
  string S, T;
  char ans[200] = {};
  int N, i, count = 0;

  cin >> N;
  cin >> S >> T;

  for (i = 0; i <= N * 2; i += 2) {
    ans[i] = S[count];
    ans[i + 1] = T[count];
    count++;
  }
  cout << ans << endl;
  return 0;
}


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

int main() {
  string S, T;
  char ans[200] = {};
  int N, i, count = 0;

  cin >> N;
  cin >> S >> T;

  for (i = 0; i < N * 2; i += 2) {
    ans[i] = S[count];
    ans[i + 1] = T[count];
    count++;
  }
  cout << ans << endl;
  return 0;
}
Problem p02830 (Python)

Buggy submission (status: Runtime Error):
n = int(input())
s, t = [int(input()) for i in range(2)]
out = ""
for i in range(n):
    out += s[i] + t[i]
print(out)


Fixed submission:
n = int(input())
s, t = input().split()
out = ""
for i in range(n):
    out += s[i] + t[i]
print(out)
Problem p02830 (C++)

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

int main() {

  int N;

  cin >> N;

  string S, T;

  cin >> S, T;

  for (int i = 0; i < N; i++) {

    cout << S.at(i) << T.at(i);
  }

  cout << endl;
}


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

int main() {

  int N;

  cin >> N;

  string S, T;

  cin >> S >> T;

  for (int i = 0; i < N; i++) {

    cout << S.at(i) << T.at(i);
  }

  cout << endl;
}
Problem p02830 (C++)

Buggy submission (status: Runtime Error):
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define ld long double
#define pb emplace_back
#define mp make_pair
#define f(i, a, n) for (int i = a; i < n; i++)
#define F first
#define S second
#define vll vector<ll>
#define fast ios::sync_with_stdio(false), cin.tie(0);
#define COUT cout << fixed << setprecision(12)
#define SET set<ll, greater<ll>> gquiz
#define ITERATOR set<ll, greater<ll>>::iterator itr
#define V vector<ll> vector
#define sz size()
#define A vector<pair<ll, ll>> vect
ll N = 100000, M = 100000;
#define B vect.push_back(make_pair(N, M));
ll MOD = 1000000007;

void solve() {
  ll a, b;
  cin >> a >> b;
  ll c[4] = {0};
  c[a - 1]++;
  c[b - 1]++;
  if (c[0] == 0)
    cout << 1;
  else if (c[1] == 0)
    cout << 2;
  else if (c[2] == 0)
    cout << 3;
}
int main() { solve(); }

Fixed submission:
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define ld long double
#define pb emplace_back
#define mp make_pair
#define f(i, a, n) for (int i = a; i < n; i++)
#define F first
#define S second
#define vll vector<ll>
#define fast ios::sync_with_stdio(false), cin.tie(0);
#define COUT cout << fixed << setprecision(12)
#define SET set<ll, greater<ll>> gquiz
#define ITERATOR set<ll, greater<ll>>::iterator itr
#define V vector<ll> vector
#define sz size()
#define A vector<pair<ll, ll>> vect
ll N = 100000, M = 100000;
#define B vect.push_back(make_pair(N, M));
ll MOD = 1000000007;

void solve() {
  ll n;
  cin >> n;
  string s, t;
  cin >> s;
  cin >> t;
  for (ll i = 0; i < n; i++)
    cout << s[i] << t[i];
}
int main() { solve(); }
Problem p02830 (C++)

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

int main() {
  int n;
  cin >> n;
  string s, t;

  for (int i = 0; i < n; i++) {
    cout << s.at(i);
    cout << t.at(i);
  }
  cout << endl;
}

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

int main() {
  int n;
  cin >> n;
  string s, t;
  cin >> s >> t;

  for (int i = 0; i < n; i++) {
    cout << s.at(i);
    cout << t.at(i);
  }
  cout << endl;
}
Problem p02830 (C++)

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

using namespace std;

int main() {
  int N;
  string raw;
  string s, t;
  cin >> N;
  cin >> raw;

  s = raw.substr(0, N);
  t = raw.substr(N + 1, N);

  for (int i = 0; i < N; i++) {
    cout << s[i] << t[i];
  }
  cout << "\n";
}

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

using namespace std;

int main() {
  int N;
  string raw;
  string s, t;
  getline(cin, raw);
  N = stoi(raw);
  getline(cin, raw);

  s = raw.substr(0, N);
  t = raw.substr(N + 1, N);

  for (int i = 0; i < N; i++) {
    cout << s[i] << t[i];
  }
  cout << "\n";
}
Problem p02830 (C++)

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

#define rep(i, n) for (int i = 0; i < n; i++)
#define REP(i, n) for (int i = 1; i <= n; i++)
#define int long long
#define all(x) (x).begin(), (x).end()

signed main() {
  int N;
  string S, T, U;
  cin >> N >> S >> T;
  rep(i, N) {
    U[2 * i] = S[i];
    U[2 * i + 1] = T[i];
  }
  cout << U;
}

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

#define rep(i, n) for (int i = 0; i < n; i++)
#define REP(i, n) for (int i = 1; i <= n; i++)
#define int long long
#define all(x) (x).begin(), (x).end()

signed main() {
  int N;
  string S, T, U;
  cin >> N >> S >> T;
  rep(i, N) {
    U += S[i];
    U += T[i];
  }
  cout << U;
}
Problem p02830 (C++)

Buggy submission (status: Runtime Error):
#include <iostream>
#include <string>
using namespace std;
int main() {
  int n;
  cin >> n;
  string a, b, c;
  cin >> a >> b;
  c = a.at(0);
  c += b.at(0);
  for (int i = 1; i <= n; i++) {
    c += a.at(i);
    c += b.at(i);
  }
  cout << c << endl;
}

Fixed submission:
#include <iostream>
#include <string>
using namespace std;
int main() {
  int n;
  cin >> n;
  string a, b, c;
  cin >> a >> b;
  c = a.at(0);
  c += b.at(0);
  for (int i = 1; i < n; i++) {
    c += a.at(i);
    c += b.at(i);
  }
  cout << c << endl;
}
Problem p02830 (C++)

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

Fixed submission:
#include <bits/stdc++.h>
using namespace std;
int main() {
  int N;
  string S, T;
  cin >> N >> S >> T;
  for (int i = 0; i < N; i++) {
    cout << S.at(i) << T.at(i);
  }
}
Problem p02831 (Python)

Buggy submission (status: Runtime Error):
import fractions

a, b = map(int, input().split())

print(int(a * b / fractions.gcd(a * b)))


Fixed submission:
import fractions

a, b = map(int, input().split())

print(a * b // fractions.gcd(a, b))
Problem p02831 (C++)

Buggy submission (status: Runtime Error):
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll gcd(ll a, ll b) {
  if (b == 0)
    return a;
  else
    return (b, a % b);
}
int main() {
  ll a, b;
  cin >> a >> b;
  cout << (a * b) / gcd(a, b);
}

Fixed submission:
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll gcd(ll a, ll b) {
  if (b == 0)
    return a;
  return gcd(b, a % b);
}
int main() {
  ll a, b;
  cin >> a >> b;
  cout << (a * b) / gcd(a, b);
}
Problem p02831 (Python)

Buggy submission (status: Runtime Error):
# C - Snack

from math import gcd

A, B = map(int, input().split())
print(A * B // gcd(A, B))


Fixed submission:
# C - Snack

from fractions import gcd

A, B = map(int, input().split())
print(A * B // gcd(A, B))
Problem p02831 (Python)

Buggy submission (status: Runtime Error):
# from fractions import gcd
from math import gcd

a, b = map(int, input().split())
print(a * b // gcd(a, b))
exit(0)


Fixed submission:
from fractions import gcd

# from math import gcd

a, b = map(int, input().split())
print(a * b // gcd(a, b))
exit(0)
Problem p02831 (Python)

Buggy submission (status: Runtime Error):
import math

a, b = map(int, input().split())
print((a * b) // math.gcd(a, b))


Fixed submission:
import math

a, b = map(int, input().split())

i = 1
flag = True
while flag:
    if (a * i) % b == 0:
        flag = False
        ans = a * i
        break
    i += 1

print(ans)
Problem p02831 (Python)

Buggy submission (status: Runtime Error):
from math import gcd

a, b = map(int, input().split())
print(int(a * b / gcd(a, b)))


Fixed submission:
from fractions import gcd

a, b = map(int, input().split())
print(int(a * b / gcd(a, b)))
Problem p02831 (Python)

Buggy submission (status: Runtime Error):
from math import gcd

a, b = tuple(map(int, input().split()))
print(int(a * b / gcd(a, b)))


Fixed submission:
from fractions import gcd

a, b = tuple(map(int, input().split()))
print(int(a * b / gcd(a, b)))
Problem p02831 (Python)

Buggy submission (status: Runtime Error):
# abc148_c.py
import sys
import time
import unittest
from io import StringIO
import math


def resolve():
    A, B = [int(i) for i in input().split()]
    print(int(A * B / math.gcd(A, B)))


class TestClass(unittest.TestCase):
    def assertIO(self, input, output):
        stdout, stdin = sys.stdout, sys.stdin
        sys.stdout, sys.stdin = StringIO(), StringIO(input)
        resolve()
        sys.stdout.seek(0)
        out = sys.stdout.read()[:-1]
        sys.stdout, sys.stdin = stdout, stdin
        self.assertEqual(out, output)

    def setUp(self):
        self.startTime = time.time()

    def tearDown(self):
        t = time.time() - self.startTime
        print("%s: %.3f" % (self.id(), t), flush=True)

    def test_入力例_1(self):
        input = """2 3"""
        output = """6"""
        self.assertIO(input, output)

    def test_入力例_2(self):
        input = """123 456"""
        output = """18696"""
        self.assertIO(input, output)

    def test_入力例_3(self):
        input = """100000 99999"""
        output = """9999900000"""
        self.assertIO(input, output)


if __name__ == "__main__":
    if "IS_LOCAL" in locals():
        suite = unittest.TestLoader().loadTestsFromTestCase(TestClass)
        unittest.TextTestRunner(verbosity=0).run(suite)
    else:
        resolve()


Fixed submission:
# abc148_c.py
import sys
import time
import unittest
from io import StringIO
import fractions as math


def resolve():
    A, B = [int(i) for i in input().split()]
    print(int(A * B / math.gcd(A, B)))


class TestClass(unittest.TestCase):
    def assertIO(self, input, output):
        stdout, stdin = sys.stdout, sys.stdin
        sys.stdout, sys.stdin = StringIO(), StringIO(input)
        resolve()
        sys.stdout.seek(0)
        out = sys.stdout.read()[:-1]
        sys.stdout, sys.stdin = stdout, stdin
        self.assertEqual(out, output)

    def setUp(self):
        self.startTime = time.time()

    def tearDown(self):
        t = time.time() - self.startTime
        print("%s: %.3f" % (self.id(), t), flush=True)

    def test_入力例_1(self):
        input = """2 3"""
        output = """6"""
        self.assertIO(input, output)

    def test_入力例_2(self):
        input = """123 456"""
        output = """18696"""
        self.assertIO(input, output)

    def test_入力例_3(self):
        input = """100000 99999"""
        output = """9999900000"""
        self.assertIO(input, output)


if __name__ == "__main__":
    if "IS_LOCAL" in locals():
        suite = unittest.TestLoader().loadTestsFromTestCase(TestClass)
        unittest.TextTestRunner(verbosity=0).run(suite)
    else:
        resolve()
Problem p02831 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <bits/stdc++.h>
using namespace std;
#define SPEED                                                                  \
  ios::sync_with_stdio(false);                                                 \
  cin.tie(0);                                                                  \
  cout.tie(0)
#define ll long long
#define ld long double
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define all(x) x.begin(), x.end()

int main() {
  SPEED;
  ll l, g;
  cin >> l >> g;
  if (l > g)
    swap(l, g);
  ll i;
  for (i = g;; i++) {
    if (i % l == 0 and i % g == 0) {
      break;
    }
  }
  cout << i << endl;

  return 0;
}

Fixed submission:
#include <bits/stdc++.h>
using namespace std;
#define SPEED                                                                  \
  ios::sync_with_stdio(false);                                                 \
  cin.tie(0);                                                                  \
  cout.tie(0)
#define ll long long
#define ld long double
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define all(x) x.begin(), x.end()

int main() {
  ll a, b;
  cin >> a >> b;
  cout << a * b / (__gcd(a, b)) << endl;

  return 0;
}
Problem p02831 (Python)

Buggy submission (status: Runtime Error):
from math import gcd

a, b = map(int, input().split())
lcm = a * b // gcd(a, b)
print(lcm)


Fixed submission:
from fractions import gcd

a, b = map(int, input().split())
lcm = a * b // gcd(a, b)
print(lcm)
Problem p02831 (C++)

Buggy submission (status: Runtime Error):
#include <iostream>
#include <map>
#include <set>
#include <unordered_map>
#include <vector>

using namespace std;
const int N = 1e5 + 10;
typedef long long ll;
typedef pair<ll, ll> PII;

int n;
string s1, s2, ans;

ll a, b;

ll f(ll a, ll b) { b == 0 ? a : f(b, a % b); }

int main() {

  cin >> a >> b;
  cout << a * b / f(a, b);
}

Fixed submission:
#include <iostream>
#include <map>
#include <set>
#include <unordered_map>
#include <vector>

using namespace std;
const int N = 1e5 + 10;
typedef long long ll;
typedef pair<ll, ll> PII;

int n;
string s1, s2, ans;

ll a, b;

ll f(ll a, ll b) { return b == 0 ? a : f(b, a % b); }

int main() {

  cin >> a >> b;
  cout << a * b / f(a, b);
}
Problem p02831 (C++)

Buggy submission (status: Runtime Error):
#include <algorithm>
#include <bitset>
#include <climits>
#include <cmath>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <vector>

using namespace std;

#define ef emplace_front
#define eb emplace_back
#define mp make_pair
#define MOD 1000000007

typedef long double f80;
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef vector<bool> vb;
typedef vector<char> vc;
typedef vector<string> vs;
typedef pair<int, int> pi;
typedef pair<ll, ll> pll;
typedef vector<pi> vpi;
typedef vector<pll> vpll;
typedef vector<vb> vvb;
typedef vector<vc> vvc;
typedef vector<vs> vvs;
typedef float f32;
typedef double f64;
typedef long double f80;
typedef unordered_set<int> usi;
typedef set<int> si;

ll gcd(ll a, ll b) {
  if (a < b)
    return gcd(b, a);
  if (!a)
    return b;
  return gcd(b, a % b);
}
int main() {
  cin.tie(0);
  ios::sync_with_stdio(0);

  ll a, b;
  cin >> a >> b;
  cout << a / gcd(a, b) * b;
}

Fixed submission:
#include <algorithm>
#include <bitset>
#include <climits>
#include <cmath>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <vector>

using namespace std;

#define ef emplace_front
#define eb emplace_back
#define mp make_pair
#define MOD 1000000007

typedef long double f80;
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef vector<bool> vb;
typedef vector<char> vc;
typedef vector<string> vs;
typedef pair<int, int> pi;
typedef pair<ll, ll> pll;
typedef vector<pi> vpi;
typedef vector<pll> vpll;
typedef vector<vb> vvb;
typedef vector<vc> vvc;
typedef vector<vs> vvs;
typedef float f32;
typedef double f64;
typedef long double f80;
typedef unordered_set<int> usi;
typedef set<int> si;

ll gcd(ll a, ll b) {
  if (a < b)
    return gcd(b, a);
  if (!b)
    return a;
  return gcd(b, a % b);
}
int main() {
  cin.tie(0);
  ios::sync_with_stdio(0);

  ll a, b;
  cin >> a >> b;
  cout << a / gcd(a, b) * b;
}
Problem p02831 (C++)

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

using namespace std;

long gcd(long x, long y) {
  long t;
  if (x < y) {
    long tmp = x;
    x = y;
    y = tmp;
  }
  t = x % y;
  if (t == 0) {
    return y;
  } else {
    gcd(y, t);
  }
}

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

  cout << (a * b) / gcd(a, b) << endl;
  return 0;
}


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

using namespace std;

long gcd(long x, long y) {
  long t;
  if (x < y) {
    long tmp = x;
    x = y;
    y = tmp;
  }
  t = x % y;
  if (t == 0) {
    return y;
  } else {
    return gcd(y, t);
  }
}

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

  cout << (a * b) / gcd(a, b) << endl;
  return 0;
}
Problem p02831 (C++)

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

using namespace std;

long long n, k, mn;

int main() {
  cin >> n >> k;
  if (n < k) {
    mn = n;
  } else {
    mn = k;
  }
  for (int i = mn; i <= n * k; i++) {
    if (i % n == 0 && i % k == 0) {
      cout << i;
      return 0;
    }
  }
  return 0;
}

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

using namespace std;

long long n, k, mn;

int main() {
  cin >> n >> k;
  cout << n * k / __gcd(n, k);
  return 0;
}
Problem p02831 (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 a, b;
  cin >> a >> b;

  int max = 0;
  for (int i = 1; i < min(a, b); i++) {
    if (a % i == 0 && b % i == 0) {
      max = i;
    }
  }

  cout << (int64_t)a * b / max << endl;
}


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

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

  int max = 0;
  for (int i = 1; i <= min(a, b); i++) {
    if (a % i == 0 && b % i == 0) {
      max = i;
    }
  }

  cout << (int64_t)a * b / max << endl;
}
Problem p02831 (Python)

Buggy submission (status: Runtime Error):
from math import gcd

a, b = map(int, input().split())
print(a * b // gcd(a, b))


Fixed submission:
def gcd(a, b):
    if a == 0:
        return b
    return gcd(b % a, a)


a, b = map(int, input().split())
print(a * b // gcd(a, b))
Problem p02831 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <iostream>
using namespace std;

int main() {
  long int a, b;
  cin >> a >> b;
  for (long int i = 0; i < 10000000000; i++) {
    if (i % a == 0 && i % b == 0) {
      cout << i << endl;
    }
  }
}

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

int main() {
  long int a, b;
  cin >> a >> b;
  for (int i = 1; i <= b; i++) {
    if (a * i % b == 0) {
      cout << a * i << endl;
      return 0;
    }
  }
}
Problem p02831 (C++)

Buggy submission (status: Runtime Error):
#include <bits/stdc++.h>
using namespace std;
long long GCD(long long a, long long b) {
  if (b == 1)
    return a;
  return GCD(b, a % b);
}
long long LCM(long long a, long long b) { return a / GCD(a, b) * b; }
int main() {
  long long a, b;
  scanf("%lld %lld", &a, &b);
  printf("%lld", LCM(a, b));
  return 0;
}

Fixed submission:
#include <bits/stdc++.h>
using namespace std;
long long GCD(long long a, long long b) {
  if (b == 0)
    return a;
  return GCD(b, a % b);
}
long long LCM(long long a, long long b) { return a / GCD(a, b) * b; }
int main() {
  long long a, b;
  scanf("%lld %lld", &a, &b);
  printf("%lld", LCM(a, b));
  return 0;
}
Problem p02831 (C++)

Buggy submission (status: Runtime Error):
#include <bits/stdc++.h>
using namespace std;
long long gcd(long long a, long long b) {
  if (b == 0)
    return a;
  gcd(b, a % b);
}
int main() {
  long long a, b;
  cin >> a >> b;
  if (b % a == 0)
    cout << b;
  else
    cout << a / gcd(a, b) * b;
  return 0;
}


Fixed submission:
#include <bits/stdc++.h>
using namespace std;
long long gcd(long long a, long long b) {
  if (b == 0)
    return a;
  gcd(b, a % b);
}
int main() {
  long long a, b;
  cin >> a >> b;
  // cout<<a/gcd(a,b)*b<<endl;
  for (int i = 1; i <= b; i++) {
    if ((a * i) % b == 0) {
      cout << a * i << endl;
      break;
    }
  }
  return 0;
}
Problem p02831 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int a, b;
  cin >> a >> b;
  if (__gcd(a, b) == 1) {
    cout << a * b;
  } else {
    for (long long int i = max(a, b);; i++) {
      if (i % a == 0 && i % b == 0) {
        cout << i;
        break;
      }
    }
  }
}


Fixed submission:
#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int a, b;
  cin >> a >> b;
  cout << (a * b) / __gcd(a, b);
}
Problem p02831 (C++)

Buggy submission (status: Runtime Error):
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < (n); i++)
#define RREP(i, s, n) for (int i = s; i < (n); i++)
#define ALL(a) a.begin(), a.end()
#define RALL(a) a.rbegin(), a.rend()
#define maxs(x, y) x = max(x, y)
#define mins(x, y) x = min(x, y)
using namespace std;
using ll = long long;
typedef pair<int, int> pint;
typedef pair<ll, ll> pll;
const ll MOD = 1000000007;
const ll INF = MOD * MOD;
const int inf = (1 << 29);

ll gcd(ll a, ll b) {
  if (b == 0)
    return a;
  else
    return gcd(b, a % b);
}
ll lcm(ll a, ll b) { return a * b / gcd(a, b); }

int main() {

  ll a, b;
  cout << lcm(a, b) << endl;

  // cout << ans << endl;
  return 0;
}

Fixed submission:
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < (n); i++)
#define RREP(i, s, n) for (int i = s; i < (n); i++)
#define ALL(a) a.begin(), a.end()
#define RALL(a) a.rbegin(), a.rend()
#define maxs(x, y) x = max(x, y)
#define mins(x, y) x = min(x, y)
using namespace std;
using ll = long long;
typedef pair<int, int> pint;
typedef pair<ll, ll> pll;
const ll MOD = 1000000007;
const ll INF = MOD * MOD;
const int inf = (1 << 29);

ll gcd(ll a, ll b) {
  if (b == 0)
    return a;
  else
    return gcd(b, a % b);
}
ll lcm(ll a, ll b) { return a * b / gcd(a, b); }

int main() {

  ll a, b;
  cin >> a >> b;
  cout << lcm(a, b) << endl;

  // cout << ans << endl;
  return 0;
}
Problem p02831 (C++)

Buggy submission (status: Time Limit Exceeded):
/*

*/
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <map>
#include <set>
#include <string>
#include <vector>

#define ll long long
#define cint const int
#define ld long double
#define sz(a) (int)a.size()
#define all(a) a.begin(), a.end()
#define pb push_back
#define ppb pop_back
#define fi first
#define se second

using namespace std;

typedef vector<long long> vll;
typedef vector<string> vs;
typedef vector<char> vc;
typedef set<int> si;
typedef set<string> ss;
typedef pair<int, int> pi;
// typedef pair <long long, long long> pll;
// typedef pair <int, long long> pil;
// typedef pair <int, string> pis;
// typedef pair <int, char> pic;
// typedef pair <long long, int> pli;
// typedef pair <long long, string> pls;
// typedef pair <long long, char> plc;
// typedef pair <string, int> psi;
// typedef pair <string, long long> psl;
// typedef pair <string, char> psc;
// typedef pair <char, int> pci;
// typedef pair <char, long long> pcl;
// typedef pair <char, string> pcs;

ll a, b;

int main() {
  cin >> a >> b;
  for (int i = max(a, b);; ++i) {
    if (i % a == 0 && i % b == 0) {
      cout << i;
      return 0;
    }
  }
  return 0;
}

Fixed submission:
/*

*/
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <map>
#include <set>
#include <string>
#include <vector>

#define ll long long
#define cint const int
#define ld long double
#define sz(a) (int)a.size()
#define all(a) a.begin(), a.end()
#define pb push_back
#define ppb pop_back
#define fi first
#define se second

using namespace std;

typedef vector<long long> vll;
typedef vector<string> vs;
typedef vector<char> vc;
typedef set<int> si;
typedef set<string> ss;
typedef pair<int, int> pi;
// typedef pair <long long, long long> pll;
// typedef pair <int, long long> pil;
// typedef pair <int, string> pis;
// typedef pair <int, char> pic;
// typedef pair <long long, int> pli;
// typedef pair <long long, string> pls;
// typedef pair <long long, char> plc;
// typedef pair <string, int> psi;
// typedef pair <string, long long> psl;
// typedef pair <string, char> psc;
// typedef pair <char, int> pci;
// typedef pair <char, long long> pcl;
// typedef pair <char, string> pcs;

ll a, b;

int main() {
  cin >> a >> b;
  for (ll i = max(a, b);; i += max(a, b)) {
    if (i % a == 0 && i % b == 0) {
      cout << i;
      return 0;
    }
  }
  return 0;
}
Problem p02831 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
int main() {
  LL a, b;
  cin >> a >> b;

  if (a > b) {
    swap(a, b);
  }
  if (b - a == 1) {
    cout << a * b << "\n";
    return 0;
  }
  for (LL i = a;; i++) {
    if (i % a == 0 && i % b == 0) {
      cout << i << "\n";
      return 0;
    }
  }
}


Fixed submission:
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
int main() {
  LL a, b;
  cin >> a >> b;

  if (a > b) {
    swap(a, b);
  }

  for (LL i = b;; i += b) {
    if (i % a == 0) {
      cout << i << "\n";
      return 0;
    }
  }
}
Problem p02831 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <bits/stdc++.h>
using namespace std;
int main() {
  long long a, b;
  cin >> a >> b;
  long long c = a * b;
  long long ans;
  for (long long i = 1; i <= c; ++i) {
    if (i % a == 0 && i % b == 0) {
      ans = i;
      break;
    }
  }
  cout << ans << endl;
}


Fixed submission:
#include <bits/stdc++.h>
using namespace std;
int main() {
  long long a, b;
  cin >> a >> b;
  long long c = a * b;
  long long ans;
  for (long long i = 1; i <= c; ++i) {
    ans = a * i;
    if (ans % a == 0 && ans % b == 0) {
      break;
    }
  }
  cout << ans << endl;
}
Problem p02831 (C++)

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

#define ll long long
#define p_q priority_queue
#define rep(i, n) for (int(i) = 0; (i) < (n); (i)++)

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

  ll min, el;
  if (a > b) {
    min = b;
    el = a;
  } else {
    min = a;
    el = b;
  }

  ll g = 0, gm = 0;
  for (ll i = 1; i < min; i++) {
    if (min % i == 0 && el % i == 0) {
      g = i;
      if (gm < g) {
        gm = g;
      }
    }
  }

  a /= gm;
  b /= gm;

  cout << a * b * gm << endl;
}


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

#define ll long long
#define p_q priority_queue
#define rep(i, n) for (int(i) = 0; (i) < (n); (i)++)

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

  ll min, el;
  if (a > b) {
    min = b;
    el = a;
  } else {
    min = a;
    el = b;
  }

  ll g = 1, gm = 1;
  for (ll i = 1; i <= min; i++) {
    if (min % i == 0 && el % i == 0) {
      g = i;
      if (gm < g) {
        gm = g;
      }
    }
  }

  a /= gm;
  b /= gm;

  cout << a * b * gm << endl;
}
Problem p02831 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <ctype.h>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

int main() {

  long long a, b, n;
  scanf("%d %d", &a, &b);
  for (long long i = a; i > 0; i--) {
    if (a % i == 0 && b % i == 0) {
      n = i;
      break;
    }
  }
  printf("%lld", a * b / n);
  return 0;
}

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

int main() {

  long long a, b, n;
  scanf("%lld %lld", &a, &b);
  for (long long i = a; i > 0; i--) {
    if (a % i == 0 && b % i == 0) {
      n = i;
      break;
    }
  }
  printf("%lld", a * b / n);
  return 0;
}
Problem p02831 (Python)

Buggy submission (status: Runtime Error):
import math

A, B = map(int, input().split())


def lcm(x, y):
    return (x * y) // math.gcd(x, y)


print(lcm(A, B))


Fixed submission:
import math

A, B = map(int, input().split())


def gcd(a, b):
    while b:
        a, b = b, a % b
    return a


# a,bの最小公倍数


def lcm(a, b):
    return a * b // gcd(a, b)


print(lcm(A, B))
Problem p02831 (C++)

Buggy submission (status: Runtime Error):
#include <algorithm>
#include <iostream>
using namespace std;
int main() {
  int a, b;
  int p = a * b;
  int g = __gcd(a, b);
  int l = p / g;
  cout << l;
}

Fixed submission:
#include <algorithm>
#include <iostream>
using namespace std;
int main() {
  long int a, b;
  cin >> a >> b;
  long int p = a * b;
  long int g = __gcd(a, b);
  long int l = p / g;
  cout << l;
}
Problem p02831 (C++)

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

int main() {
  int A, B;
  cin >> A >> B;
  int v = max(A, B);
  int i = 1;
  int ans = v;
  while (!((ans / A > 0 && ans / B > 0) && (ans % A == 0 && ans % B == 0))) {
    i++;
    ans = v * i;
  }
  cout << ans << endl;
}


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

int main() {
  int A, B;
  cin >> A >> B;
  int v = max(A, B);
  int w = min(A, B);
  long int ans = v;
  while ((ans % w != 0) || !(ans / v > 0)) {
    ans += v;
  }
  cout << ans << endl;
}
Problem p02831 (C++)

Buggy submission (status: Runtime Error):
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
ll gcd(ll a, ll b) {
  if (b == 0)
    return a;
  return (gcd(b, a % b));
}
int main() {
  ll a, b;
  ll ans = a * b;
  ll k = gcd(a, b);
  ans /= k;
  cout << ans << "\n";
  return 0;
}

Fixed submission:
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
ll gcd(ll a, ll b) {
  if (b == 0)
    return a;
  return (gcd(b, a % b));
}
int main() {
  ll a, b;
  cin >> a >> b;
  ll ans = a * b;
  ll k = gcd(a, b);
  ans /= k;
  cout << ans << "\n";
  return 0;
}
Problem p02831 (C++)

Buggy submission (status: Runtime Error):
#include <bits/stdc++.h>
#define _overload3(_1, _2, _3, name, ...) name
#define _rep(i, n) repi(i, 0, n)
#define repi(i, a, b) for (ll i = (ll)(a); i < (ll)(b); ++i)
#define rep(...) _overload3(__VA_ARGS__, repi, _rep, )(__VA_ARGS__)
#define ll long long
#define lld long double
#define ALL(x) x.begin(), x.end()
#ifdef DEBUG
#define line() cerr << "[" << __LINE__ << "] ";
#define dump(i) cerr << #i ": " << i << " ";
#define dumpl(i) cerr << #i ": " << i << endl;
#else
#define line(i)
#define dump(i)
#define dumpl(i)
#endif
using namespace std;

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

int main() {
  ll a, b;
  cin >> a >> b;
  cout << (a * b) / gcd(a, b) << endl;
  return 10;
}

Fixed submission:
#include <bits/stdc++.h>
#define _overload3(_1, _2, _3, name, ...) name
#define _rep(i, n) repi(i, 0, n)
#define repi(i, a, b) for (ll i = (ll)(a); i < (ll)(b); ++i)
#define rep(...) _overload3(__VA_ARGS__, repi, _rep, )(__VA_ARGS__)
#define ll long long
#define lld long double
#define ALL(x) x.begin(), x.end()
#ifdef DEBUG
#define line() cerr << "[" << __LINE__ << "] ";
#define dump(i) cerr << #i ": " << i << " ";
#define dumpl(i) cerr << #i ": " << i << endl;
#else
#define line(i)
#define dump(i)
#define dumpl(i)
#endif
using namespace std;

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

int main() {
  ll a, b;
  cin >> a >> b;
  cout << (a * b) / gcd(a, b) << endl;
  return 0;
}
Problem p02831 (C++)

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

Fixed submission:
#include <bits/stdc++.h>
using namespace std;
int main() {
  long long m, n, r, t;
  cin >> m >> n;
  t = m * n;
  do {
    r = m % n;
    m = n;
    n = r;
  } while (r != 0);
  cout << t / m << endl;
  return 0;
}
Problem p02831 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <bits/stdc++.h>
using namespace std;
#define freinput "input.txt", "r", stdin
#define freoutput "output.txt", "w", stdout
#define mp make_pair
#define fi first
#define sc second
#define pb push_back
#define ellapse printf("Time : %0.3lf\n", clock() * 1.0 / CLOCKS_PER_SEC);
typedef long long ll;
typedef unsigned long int uld;
typedef vector<int> vi;
typedef vector<string> vs;
typedef pair<int, int> pii;
struct comp {
  bool operator()(int a, int b) { return a > b; }
};

int main() {
  long a, b;
  cin >> a >> b;
  for (long i = 1; i <= 10000000000; i++) {
    if (i % a == 0 && i % b == 0) {
      cout << i << endl;
      break;
    }
  }
}


Fixed submission:
#include <bits/stdc++.h>
using namespace std;
#define freinput "input.txt", "r", stdin
#define freoutput "output.txt", "w", stdout
#define mp make_pair
#define fi first
#define sc second
#define pb push_back
#define ellapse printf("Time : %0.3lf\n", clock() * 1.0 / CLOCKS_PER_SEC);
typedef long long ll;
typedef unsigned long int uld;
typedef vector<int> vi;
typedef vector<string> vs;
typedef pair<int, int> pii;
struct comp {
  bool operator()(int a, int b) { return a > b; }
};

int main() {
  long a, b;
  cin >> a >> b;
  cout << (a * b) / __gcd(a, b) << endl;
}
Problem p02831 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <iostream>
using namespace std;

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

  int min_ = min(a, b);
  int i = min_;
  while ((i % a != 0) || (i % b != 0)) {
    i += min_;
    // cout << i << endl;
  }
  cout << i << endl;
}

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

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

  long long i = b;
  while (i % a != 0) {
    i += b;
    // cout << i << endl;
  }
  cout << i << endl;
}
Problem p02831 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <algorithm>
#include <iostream>
using namespace std;

int main() {
  long long a, b;
  cin >> a >> b;
  long long ans;
  ans = max(a, b);
  for (long long i = 0; i < 1e9; i++) {
    if (ans % a == 0 && ans % b == 0) {
      cout << ans << endl;
      return 0;
    }
    ans++;
  }
}

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

int main() {
  long long a, b;
  cin >> a >> b;
  long long ans = a * b / __gcd(a, b);
  cout << ans << endl;
  return 0;
}
Problem p02831 (C++)

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

using namespace std;
typedef long long ll;
int main() {
  ll a, b;
  cout << a * b / __gcd(a, b);
  return 0;
}


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

using namespace std;
typedef long long ll;
int main() {
  ll a, b;
  cin >> a >> b;
  cout << a * b / __gcd(a, b);
  return 0;
}
Problem p02831 (C++)

Buggy submission (status: Runtime Error):
#include <algorithm>
#include <cmath>
#include <fstream>
#include <iomanip>
#include <iostream>
#include <queue>
#include <set>
#include <string>
#include <utility>
#include <vector>
#define MOD 998244353
using namespace std;
long long PGCD(long long a, long long b) {
  if (a % b == 0)
    return b;
  return PGCD(b, a % b);
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long a, b;
  if (a < b)
    swap(a, b);
  cout << (a * b) / PGCD(a, b);
}

Fixed submission:
#include <algorithm>
#include <cmath>
#include <fstream>
#include <iomanip>
#include <iostream>
#include <queue>
#include <set>
#include <string>
#include <utility>
#include <vector>
#define MOD 998244353
using namespace std;
long long PGCD(long long a, long long b) {
  if (a % b == 0)
    return b;
  return PGCD(b, a % b);
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long a, b;
  cin >> a >> b;
  if (a < b)
    swap(a, b);
  cout << (a * b) / PGCD(a, b);
}
Problem p02832 (C++)

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

int main() {
  int n;
  cin >> n;
  vector<int> a(n);
  int b = 1;
  for (int i = 0; i < n; i++) {
    cin >> a.at(n);
    if (a.at(i) == b)
      b++;
  }
  if (b == 1)
    cout << -1 << endl;
  else
    cout << n - b + 1 << endl;
}

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

int main() {
  int n;
  cin >> n;
  vector<int> a(n);
  int b = 1;
  for (int i = 0; i < n; i++) {
    cin >> a.at(i);
    if (a.at(i) == b)
      b++;
  }
  if (b == 1)
    cout << -1 << endl;
  else
    cout << n - b + 1 << endl;
}
Problem p02832 (C++)

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

using namespace std;

#define IOS                                                                    \
  ios::sync_with_stdio(0);                                                     \
  cin.tie(0);                                                                  \
  cout.tie(0);
#define mp make_pair
#define endl "\n"
#define pb push_back
#define ll long long

int main() {
#ifndef ONLINE_JUDGE
  // for getting input from input.txt
  freopen("input.txt", "r", stdin);
  // for writing output to output.txt
  freopen("output.txt", "w", stdout);
#endif

  IOS;

  ll i, n;
  cin >> n;

  vector<ll> a(n);

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

  ll cnt = 0;
  ll ans = 0;

  for (i = 0; i < n; i++) {
    if (a[i] == (cnt + 1)) {
      cnt++;
    } else
      ans++;
  }

  if (cnt == 0) {
    cout << "-1" << endl;
  } else
    cout << ans << endl;

  return 0;
}


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

using namespace std;

#define IOS                                                                    \
  ios::sync_with_stdio(0);                                                     \
  cin.tie(0);                                                                  \
  cout.tie(0);
#define mp make_pair
#define endl "\n"
#define pb push_back
#define ll long long

int main() {

  IOS;

  ll i, n;
  cin >> n;

  vector<ll> a(n);

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

  ll cnt = 0;
  ll ans = 0;

  for (i = 0; i < n; i++) {
    if (a[i] == (cnt + 1)) {
      cnt++;
    } else
      ans++;
  }

  if (cnt == 0) {
    cout << "-1" << endl;
  } else
    cout << ans << endl;

  return 0;
}
Problem p02832 (C++)

Buggy submission (status: Runtime Error):
#include <algorithm>
#include <array>
#include <cassert>
#include <cmath>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <string>
#include <utility>
#include <vector>

using namespace std;
using ll = long long;

constexpr ll infl = 1000000000000000007LL;
constexpr int inf = 1000000007;

int main() {
  int n;
  cin >> n;
  vector<vector<int>> indices(n + 1);
  for (int i = 0; i < n; ++i) {
    int a;
    cin >> a;
    indices[a].push_back(i);
  }
  int x = 0;
  int i = 1;
  while (true) {
    auto it = lower_bound(indices[i].begin(), indices[i].end(), x);
    if (it == indices[i].end())
      break;

    x = *it + 1;
    ++i;
  }

  if (i == 1)
    cout << -1 << endl;
  else
    cout << n - i + 1 << endl;
  return 0;
}

Fixed submission:
#include <algorithm>
#include <array>
#include <cassert>
#include <cmath>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <string>
#include <utility>
#include <vector>

using namespace std;
using ll = long long;

constexpr ll infl = 1000000000000000007LL;
constexpr int inf = 1000000007;

int main() {
  int n;
  cin >> n;
  vector<vector<int>> indices(n + 1);
  for (int i = 0; i < n; ++i) {
    int a;
    cin >> a;
    indices[a].push_back(i);
  }
  int x = 0;
  int i = 1;
  while (i <= n) {
    auto it = lower_bound(indices[i].begin(), indices[i].end(), x);
    if (it == indices[i].end())
      break;

    x = *it + 1;
    ++i;
  }

  if (i == 1)
    cout << -1 << endl;
  else
    cout << n - i + 1 << endl;
  return 0;
}