Harryxun/GPT-100-sft-dataset huggingface dataset:
Problem p02732 (python)

Fixed submission:
import collections
n = int(input())
*a, = map(int, input().split())
counter = collections.Counter(a)
d = {key: (value * (value - 1)) // 2 for key, value in counter.items()}
#print(d)
all_sum = sum(d.values())
#print(all_sum)

sum_d = {}
for k in range(n):
    if a[k] not in sum_d:
        if d[a[k]] > 0:
            tmp = ((counter[a[k]] - 1) * (counter[a[k]] - 2)) // 2
            sum_d[a[k]] = all_sum  - d[a[k]] + tmp
            print(sum_d[a[k]])
        else:
            print(all_sum)
    else:
        print(sum_d[a[k]])

Buggy submission (verdict: Runtime Error):
import collections
n = int(input())
*a, = map(int, input().split())
counter = collections.Counter(a)
d = {key: (value * (value - 1)) // 2 for key, value in counter.items()}
#print(d)
all_sum = sum(d.values())
#print(all_sum)

sum_d = {}
for k in range(n):
    if a[k] not in sum_d:
        if d[a[k]] > 0:
            tmp = ((counter[a[k]] - 1) * (counter[a[k]] - 2)) // 2
        sum_d[a[k]] = all_sum  - d[a[k]] + tmp
        print(sum_d[a[k]])
    else:
        print(sum_d[a[k]])

Buggy submission (verdict: Runtime Error):
import collections
n = int(input())
*a, = map(int, input().split())
counter = collections.Counter(a)
d = {}
for key, value in counter.items():
    d[key] = (value * (value - 1)) // 2

sum_d = {}
for k in range(n):
    if a[k] not in sum_d:
        if d[a[k]] > 0: tmp = ((counter[a[k]] - 1) * (counter[a[k]] - 2)) // 2
        sum_d[a[k]] = sum(d.values())  - d[a[k]] + tmp
        print(sum_d[a[k]])
    else:
        print(sum_d[a[k]])
Problem p02756 (python)

Fixed submission:
from collections import deque
import sys


def input(): return sys.stdin.readline().strip()
def I(): return int(input())
def LI(): return list(map(int, input().split()))
def IR(n): return [I() for i in range(n)]
def LIR(n): return [LI() for i in range(n)]
def SR(n): return [S() for i in range(n)]
def S(): return input()
def LS(): return input().split()


s = S()
q = I()
queries = SR(q)
que = deque(list(s))
top = True  # 先頭の位置 Trueが左（初期位置）
for query in queries:
    if query[0] == '1':
        top = not(top)
    else:
        _, f, c = query.split()
        if f == '1':
            if top:
                que.appendleft(c)
            else:
                que.append(c)
        else:
            if top:
                que.append(c)
            else:
                que.appendleft(c)
if top:
    print(''.join(list(que)))
else:
    print(''.join(list(que))[::-1])

Buggy submission (verdict: Runtime Error):
import sys


def input(): return sys.stdin.readline().strip()
def I(): return int(input())
def LI(): return list(map(int, input().split()))
def IR(n): return [I() for i in range(n)]
def LIR(n): return [LI() for i in range(n)]
def SR(n): return [S() for i in range(n)]
def S(): return input()
def LS(): return input().split()


s = S()
q = I()
queries = SR(q)
for query in queries:
    print(query[0])
    if query[0] == '1':
        if len(s) <= 1:
            continue
        s = s[-1] + s[1:-1] + s[0]
    else:
        _, f, c = query.split()
        if f == '1':
            s = c + s
        else:
            s = s + c
    print(f'{s=}')
print(s)
Problem p02778 (python)

Fixed submission:
s = input()
ans = 'x' * len(s)
print(ans)

Buggy submission (verdict: Runtime Error):
s = input()
ans = 'x' * len(s)
print(len(input()) * 'x')
Problem p02923 (python)

Fixed submission:
n = int(input())
h = list(map(int, input().split()))
l = []
cnt = 0
ans = 0
for i in reversed(range(1, n)):
  if h[i]<=h[i-1]:
    cnt += 1
  else:
    l.append(cnt)
    cnt = 0
  if i==1:
    l.append(cnt)

if len(l)!=0: ans = max(l)
print(ans)

Buggy submission (verdict: Runtime Error):
n = int(input())
h = list(map(int, input().split()))
l = []
cnt = 0
ans = 0
for i in reversed(range(1, n)):
  if h[i]<=h[i-1]:
    cnt += 1
  else:
    l.append(cnt)
    cnt = 0
ans = max(l)
print(ans)

Buggy submission (verdict: Runtime Error):
n = int(input())
h = list(map(int, input().split()))
l = []
cnt = 0
for i in reversed(range(1, n)):
  if h[i]<=h[i-1]:
    cnt += 1
  else:
    l.append(cnt)
    cnt = 0
ans = max(l)
print(ans)
Problem p02971 (python)

Fixed submission:
n = int(input())
a = [int(input()) for _ in range(n)]
sort_a = sorted(a)
max_a = max(a)
max_ind = 0
for i in range(n):
    if a[i] == max_a: max_ind = i
for i in range(n):
    ans = max_a if i != max_ind else sort_a[-2]
    print(ans)

Buggy submission (verdict: Runtime Error):
import numpy as np

n = int(input())
a = [int(input()) for _ in range(n)]
sort_a = list(np.sort(a))
sort_arg = np.argsort(a)
for i in range(n):
    tmp_l = sort_a[:]
    tmp_l.pop(sort_arg[i])
    print(tmp_l.pop(-1))
Problem p02995 (python)

Fixed submission:
import fractions

def main():
    a, b, c, d = map(int, input().split())
    l =  (c * d) // fractions.gcd(c, d)
    cntb = b - (b // c + b // d - b // l)
    cnta = (a-1) - ((a-1) // c + (a-1) // d - (a-1) // l)
    ans = cntb - cnta

    print(ans)

if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
import math
def count(n, m, l):
    c_m = n // m
    c_l = n // l
    c_ml = n // (m * l // math.gcd(m, l))
    return n - (c_m + c_l - c_ml)

a, b, c, d = map(int, input().split())
b_tar = count(b, c, d)
a_tar = count(a, c, d)
is_plus_a = not(bool(a % c == 0 or a % d == 0))
ans = b_tar - a_tar
if is_plus_a: ans += 1
print(ans)

Buggy submission (verdict: Runtime Error):
import math
def count(n, m, l):
    c_m = n // m
    c_l = n // l
    c_ml = n // (m * l // math.gcd(m, l))
     return n - (c_m + c_l - c_ml)

a, b, c, d = map(int, input().split())
b_tar = count(b, c, d)
a_tar = count(a, c, d)
is_plus_a = not(a % c == 0 or a % d == 0)
ans = b_tar - a_tar
if is_plus_a: ans += 1
print(ans)

Buggy submission (verdict: Runtime Error):
import math
def count(n, m, l):
    c_m = n // m
    c_l = n // l
    c_ml = n // (m * l // math.gcd(m, l))
    return n - (c_m + c_l - c_ml)

a, b, c, d = map(int, input().split())
b_tar = count(b, c, d)
a_tar = count(a, c, d)
is_plus_a = not(a % c == 0 or a % d == 0)
ans = b_tar - a_tar
if is_plus_a: ans += 1
print(ans)

Buggy submission (verdict: Runtime Error):
import math


def main():
    a, b, c, d = map(int, input().split())
    l =  (c * d) // math.gcd(c, d)
    cntb = b - (b // c + b // d - b // l)
    cnta = (a-1) - ((a-1) // c + (a-1) // d - (a-1) // l)
    ans = cntb - cnta

    print(ans)

if __name__ == '__main__':
    main()
Problem p03001 (python)

Fixed submission:
def main():
    W, H, x, y = map(int, input().split())
    ans = W * H / 2
    num = 1 if (2*x == W and 2*y == H) else 0
    print(ans, num)
if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
def main():
    W, H, x, y = map(int, f.input().split())
    ans = W * H / 2
    num = 1 if (2*x == W and 2*y == H) else 0
    print(ans, num)

  
if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
def main():
    with open('./input/input.txt') as f:
        W, H, x, y = map(int, f.input().split())
    ans = W * H / 2
    num = 1 if (2*x == W and 2*y == H) else 0
    print(ans, num)

  
if __name__ == '__main__':
    main()
Problem p03085 (python)

Fixed submission:
from collections import defaultdict, deque
import sys

INF = float('inf')
def LI(): return list(map(int, sys.stdin.buffer.readline().split()))
def I(): return int(sys.stdin.buffer.readline())
def LS(): return sys.stdin.buffer.readline().rstrip().decode('utf-8').split()
def S(): return sys.stdin.buffer.readline().rstrip().decode('utf-8')
def IR(n): return [I() for i in range(n)]
def LIR(n): return [LI() for i in range(n)]
def SR(n): return [S() for i in range(n)]
def LSR(n): return [LS() for i in range(n)]
def SRL(n): return [list(S()) for i in range(n)]
def MSRL(n): return [[int(j) for j in list(S())] for i in range(n)]


b = S()
ans = 'T' if b == 'A' else 'A' if b == 'T' else 'C' if b == 'G' else 'G'
print(ans)

Buggy submission (verdict: Runtime Error):
from collections import defaultdict, deque
import sys

INF = float('inf')
def LI(): return list(map(int, sys.stdin.buffer.readline().split()))
def I(): return int(sys.stdin.buffer.readline())
def LS(): return sys.stdin.buffer.readline().rstrip().decode('utf-8').split()
def S(): return sys.stdin.buffer.readline().rstrip().decode('utf-8')
def IR(n): return [I() for i in range(n)]
def LIR(n): return [LI() for i in range(n)]
def SR(n): return [S() for i in range(n)]
def LSR(n): return [LS() for i in range(n)]
def SRL(n): return [list(S()) for i in range(n)]
def MSRL(n): return [[int(j) for j in list(S())] for i in range(n)]


b = S()
ans = 'T' if b == 'A' else 'A' if b == 'T' else 'C' if b == 'G' else 'C' if b == 'G'
print(ans)
Problem p03160 (python)

Fixed submission:
import sys
n = int(sys.stdin.readline().strip('\n'))
h = list(map(int, sys.stdin.readline().strip('\n').split()))
dp = [float('inf') for _ in range(n)]
dp[0] = 0
dp[1] = abs(h[0]-h[1])
for i in range(2, n):
  dp[i] = min(dp[i-1] + abs(h[i-1]-h[i]), 
             dp[i-2] + abs(h[i-2]-h[i]))
print(dp[n-1])

Buggy submission (verdict: Runtime Error):
import sys
n = int(sys.stdin.readline().strip('\n'))
h = list(map(int, sys.stdin.readline().strip('\n').split()))
inf = float('inf')
dp = [inf for _ in range(n)]

# メモ化再帰（一度計算した結果はメモしておく）
def rec(i):
  # 値が既に更新されていたらそのまま返す（計算し直さない）
  if dp[i] != inf:
    return dp[i]
  if i==0:
    return 0
  res = inf
  res = min(res, rec(i-1) + abs(h[i]-h[i-1]))
  if i > 1:
    res = min(res, rec(i-2) + abs(h[i]-h[i-2]))
  #print('dp[{}] = {}'.format(i, res))
  dp[i] = res
  return res

ans = rec(n-1)
print(ans)

Buggy submission (verdict: Runtime Error):
import sys
n = int(sys.stdin.readline().strip('\n'))
h = list(map(int, sys.stdin.readline().strip('\n').split()))
inf = float('inf')
dp = [inf for _ in range(n)]

# メモ化再帰（一度計算した結果はメモしておく）
def rec(i):
  # 値が既に更新されていたらそのまま返す（計算し直さない）
  if dp[i] < inf: return dp[i]
  if i==0: return 0
  res = inf
  res = min(res, rec(i-1) + abs(h[i]-h[i-1]))
  if i > 1: res = min(res, rec(i-2) + abs(h[i]-h[i-2]))
  dp[i] = res
  return res

ans = rec(n-1)
print(ans)

Buggy submission (verdict: Runtime Error):
import sys
n = int(sys.stdin.readline().strip('\n'))
h = list(map(int, sys.stdin.readline().strip('\n').split()))
inf = float('inf')
dp = [inf for _ in range(n)]
# メモ化再帰（一度計算した結果はメモしておく）
def rec(i):
  # 値が既に更新されていたらそのまま返す（計算し直さない）
  if dp[i] < inf: return dp[i]
  if i==0: return 0
  res = inf
  res = min(res, rec(i-1) + abs(h[i]-h[i-1]))
  if i>1: res = min(res, rec(i-2) + abs(h[i]-h[i-2]))
  dp[i] = res
  return res
ans = rec(n-1)
print(ans)

Buggy submission (verdict: Runtime Error):
import sys
n = int(sys.stdin.readline().strip('\n'))
h = list(map(int, sys.stdin.readline().strip('\n').split()))
inf = float('inf')
dp = [inf for _ in range(n)]
# メモ化再帰（一度計算した結果はメモしておく）
def rec(i):
  # 値が既に更新されていたらそのまま返す（計算し直さない）
  if dp[i] < inf: return dp[i]
  if i==0: return 0
  res = inf
  res = min(res, rec(i-1) + abs(h[i]-h[i-1]))
  if i>1: res = min(res, rec(i-2) + abs(h[i]-h[i-2]))
  dp[i] = res
  return res
ans = rec (n-1)
print(ans)
Problem p03164 (python)

Fixed submission:
# atcoderのテスト用
# ./iunput/input.txt に入力を書き込む
n, W = map(int, input().split())
wv = [list(map(int, input().split())) for _ in range(n)]
w = [wv[i][0] for i in range(n)]
v = [wv[i][1] for i in range(n)]
inf = float('inf')
V = max(v)
vmax = 10**5+1
# dp[i][sum_v] 
# := i-1番目までの品物で価値がsum_vを超えないように選んだときの重さの総和の最小値
# 価値の合計はどれくらい大きくなるかわからないので十分に用意しとく
dp = [[inf for _ in range(vmax)] for _ in range(n+1)]
# 初期条件
dp[0][0] = 0
for i in range(n):
    for sum_v in range(vmax):
        # i番目の品物を選べるとき
        if sum_v - v[i] >= 0:
            dp[i+1][sum_v] = min(dp[i+1][sum_v], dp[i][sum_v - v[i]] + w[i])
        # i番目の品物を選ばないとき
        dp[i+1][sum_v] = min(dp[i+1][sum_v], dp[i][sum_v])


# 最適解を探す
ans = 0
for sum_v in range(vmax):
    if dp[n][sum_v] <= W:
        ans = sum_v
print(ans)

Buggy submission (verdict: Runtime Error):
# atcoderのテスト用
# ./iunput/input.txt に入力を書き込む
with open('./input/input.txt') as f:
    n, W = map(int, f.readline().split())
    wv = [list(map(int, f.readline().split())) for _ in range(n)]
w = [wv[i][0] for i in range(n)]
v = [wv[i][1] for i in range(n)]
inf = float('inf')
V = max(v)
vmax = 10**5+1
# dp[i][sum_v] 
# := i-1番目までの品物で価値がsum_vを超えないように選んだときの重さの総和の最小値
# 価値の合計はどれくらい大きくなるかわからないので十分に用意しとく
dp = [[inf for _ in range(vmax)] for _ in range(n+1)]
# 初期条件
dp[0][0] = 0
for i in range(n):
    for sum_v in range(vmax):
        # i番目の品物を選べるとき
        #print(f'before: dp[{i}][{sum_v}] = {dp[i][sum_v]}')
        if sum_v - v[i] >= 0:
            dp[i+1][sum_v] = min(dp[i+1][sum_v], dp[i][sum_v - v[i]] + w[i])
            #print(f'after choosing i: dp[{i}][{sum_v}] = {dp[i][sum_v]}')
        # i番目の品物を選ばないとき
        dp[i+1][sum_v] = min(dp[i+1][sum_v], dp[i][sum_v])
        #print(f'after: dp[{i}][{sum_v}] = {dp[i][sum_v]}')

# 最適解を探す
ans = 0
for sum_v in range(vmax):
    if dp[n][sum_v] <= W:
        #print(f'dp[{n}][{sum_v}] = {dp[n][sum_v]}')
        ans = sum_v
#print(dp[n])
print(ans)
Problem p03231 (python)

Fixed submission:
# 02
import sys
import math


def input(): return sys.stdin.readline().strip()
def I(): return int(input())
def LI(): return list(map(int, input().split()))
def IR(n): return [I() for i in range(n)]
def LIR(n): return [LI() for i in range(n)]
def SR(n): return [S() for i in range(n)]
def S(): return input()
def LS(): return input().split()


INF = float('inf')


n, m = LI()
s = S()
t = S()

gcd = math.gcd(n, m)
lcm = n * m // gcd
i_s = n // gcd
i_t = m // gcd
for i in range(gcd):
    if s[i*i_s] != t[i*i_t]:
        print(-1)
        exit()
print(lcm)

Buggy submission (verdict: Runtime Error):
# 02
import sys
import math


def input(): return sys.stdin.readline().strip()
def I(): return int(input())
def LI(): return list(map(int, input().split()))
def IR(n): return [I() for i in range(n)]
def LIR(n): return [LI() for i in range(n)]
def SR(n): return [S() for i in range(n)]
def S(): return input()
def LS(): return input().split()


INF = float('inf')


n, m = LI()
s = S()
t = S()

gcd = math.gcd(n, m)
l = n * m // gcd
d_s = l // n
d_t = l // m
x = list('*' * l)
is_ok = True

for i in range(n):
    x[d_s * i] = s[i]

for i in range(m):
    if x[d_t * i] != '*':
        if x[d_t * i] != t[i]:
            is_ok = False
            break
    else:
        x[d_t * i] = t[i]

if is_ok:
    ans = len(x)
    print(ans)
else:
    print(-1)

Buggy submission (verdict: Runtime Error):
# 02
import sys
import math


def input(): return sys.stdin.readline().strip()
def I(): return int(input())
def LI(): return list(map(int, input().split()))
def IR(n): return [I() for i in range(n)]
def LIR(n): return [LI() for i in range(n)]
def SR(n): return [S() for i in range(n)]
def S(): return input()
def LS(): return input().split()


INF = float('inf')


n, m = LI()
s = S()
t = S()

gcd = math.gcd(n, m)
l = n * m // gcd
d_s = l // n
d_t = l // m

x = list('*' * l)
is_ok = True
for i in range(n):
    x[d_s * i] = s[i]
for i in range(m):
    if x[d_t * i] != '*' and x[d_t * i] != t[i]:
        is_ok = False
        break
    x[d_t * i] = t[i]
if is_ok:
    ans = len(x)
    print(ans)
else:
    print(-1)
Problem p03244 (python)

Fixed submission:
from collections import Counter
n = int(input())
*v, = map(int, input().split())
v_even, v_odd = v[::2], v[1::2]
even = Counter(v_even).most_common(2)
odd = Counter(v_odd).most_common(2)

ans = 0

if even[0][0] != odd[0][0]:
    ans = n - odd[0][1] - even[0][1]

else:
    if len(even) == 1 and len(odd) == 1:
        ans = n // 2
        
    elif len(even) == 1:
        ans = n - even[0][1] - odd[1][1]
        
    elif len(odd) == 1:
        ans = n - even[1][1] - odd[0][1]
        
    else:
        ans = min(n - even[0][1] - odd[1][1], 
                  n - even[1][1] - odd[0][1])
                  
print(ans)

Buggy submission (verdict: Runtime Error):
import collections
n = int(input())
*v, = map(int, input().split())
v_even, v_odd = [v[i] for i in range(n) if i % 2 == 0], [v[i] for i in range(n) if i % 2 != 0]

counter_even = collections.Counter(v_even)
counter_odd = collections.Counter(v_odd)

count_even = sorted(counter_even.items(), key=lambda x:x[1], reverse=True)
print(count_even)
count_odd = sorted(counter_odd.items(), key=lambda x:x[1], reverse=True)
print(count_odd)

if len(counter_even) == 1 and len(counter_odd) == 1:
    if count_even[0][0] != count_odd[0][0]:
        ans = 0
    else:
        ans1 = 0
        for i in range(n // 2):
            if v_even[i] != count_even[1][0]:
                v_even[i] = count_even[1][0]
                ans1 += 1
            
            if v_odd[i] != count_odd[0][0]:
                v_odd[i] = count_odd[0][0]
                ans1 += 1
    
        ans2 = 0
        for i in range(n // 2):
            if v_even[i] != count_even[0][0]:
                v_even[i] = count_even[0][0]
                ans2 += 1
            
            if v_odd[i] != count_odd[1][0]:
                v_odd[i] = count_odd[1][0]
                ans2 += 1
                
        ans = min(ans1, ans2)

else:
    ans = 0 
    for i in range(n // 2):
        if v_even[i] != count_even[0][0]:
            v_even[i] = count_even[0][0]
            ans += 1
        
        if v_odd[i] != count_odd[0][0]:
            v_odd[i] = count_odd[0][0]
            ans += 1

print(ans)
Problem p03282 (python)

Fixed submission:
s = input()
k = int(input())
lengh = 0
ans = '1'
flag = True
for i in list(s):
    if i != '1':
        ans = i
        break
if k <= len(s):
    for i in list(s)[:k]:
        if i == '1': continue
        flag = False
        break
    if flag: ans = s[k-1]
print(ans)

Buggy submission (verdict: Runtime Error):
s = input()
k = int(input())
lengh = 0
ans = '1'
for i in list(s):
    if i != '1':
        ans = i
        break
if k <= len(s) and s[k-1] == '1': ans = s['k-1']
print(ans)
Problem p03545 (python)

Fixed submission:
def test():
    nums = list(map(int, list(input())))
    end = False
    for i in range(2 ** 3):
        ans = nums[0]
        res = '{}'.format(nums[0])
        for j in range(3):
            if (i >> j) & 1:
                ans += nums[j+1]
                res += '+{}'.format(nums[j+1])
            else:
                ans -= nums[j+1]
                res += '-{}'.format(nums[j+1])
        if ans == 7:
            end = True
            break
    print('{}=7'.format(res))

if __name__ == '__main__':
    test()

Buggy submission (verdict: Runtime Error):
def test():
    nums = list(map(int, list(input())))
    for i in range(2 ** 3):
        ans = nums[0]
        res = '{}'.format(nums[0])
        for j in range(3):
            if (i >> j) & 1:
                ans += nums[j+1]
                res += '+{}'.format(nums[j+1])
            else:
                ans -= nums[j+1]
                res += '-{}'.format(nums[j+1])
        if ans == 7:
            print('{}=7'.format(res))
            exit(1)

if __name__ == '__main__':
    test()

Buggy submission (verdict: Runtime Error):
def test():
    nums = list(map(int, list(input())))
    for i in range(2 ** 3):
        ans = nums[0]
        res = f'{nums[0]}'
        for j in range(3):
            if (i >> j) & 1:
                ans += nums[j+1]
                res += f'+{nums[j+1]}'
            else:
                ans -= nums[j+1]
                res += f'-{nums[j+1]}'
        if ans == 7:
            print(f'{res}=7')
            exit(1)

if __name__ == '__main__':
    test()
Problem p03633 (python)

Fixed submission:
from functools import reduce
import math
import sys


def input(): return sys.stdin.readline().strip()
def I(): return int(input())
def LI(): return list(map(int, input().split()))
def IR(n): return [I() for i in range(n)]
def LIR(n): return [LI() for i in range(n)]
def SR(n): return [S() for i in range(n)]
def S(): return input()
def LS(): return input().split()


n = I()
t = IR(n)


def lcm_base(a, b):
    return (a * b) // math.gcd(a, b)


def lcm_list(l): return reduce(lcm_base, l, 1)


ans = lcm_list(t)
print(ans)

Buggy submission (verdict: Runtime Error):
import decimal
import math
import sys


def input(): return sys.stdin.readline().strip()
def I(): return int(input())
def LI(): return list(map(int, input().split()))
def IR(n): return [I() for i in range(n)]
def LIR(n): return [LI() for i in range(n)]
def SR(n): return [S() for i in range(n)]
def S(): return input()
def LS(): return input().split()


n = I()
t = IR(n)
t.sort()
ans = t[0]


for i in t[1:]:
    gcd = math.gcd(ans, i)
    ans = int((decimal.Decimal(ans) * decimal.Decimal(i)) //
              decimal.Decimal(gcd))
print(ans)

Buggy submission (verdict: Runtime Error):
import decimal
import math
import sys


def input(): return sys.stdin.readline().strip()
def I(): return int(input())
def LI(): return list(map(int, input().split()))
def IR(n): return [I() for i in range(n)]
def LIR(n): return [LI() for i in range(n)]
def SR(n): return [S() for i in range(n)]
def S(): return input()
def LS(): return input().split()


n = I()
t = IR(n)

ans = t[0]

for i in t[1:]:
    gcd = math.gcd(ans, i)
    ans = int(decimal.Decimal((decimal.Decimal(ans) *
                               decimal.Decimal(i))) // decimal.Decimal(gcd))
print(ans)
Problem p03957 (python)

Fixed submission:
import sys


def LI(): return list(map(int, sys.stdin.buffer.readline().split()))
def I(): return int(sys.stdin.buffer.readline())
def LS(): return sys.stdin.buffer.readline().rstrip().decode('utf-8').split()
def S(): return sys.stdin.buffer.readline().rstrip().decode('utf-8')
def IR(n): return [I() for i in range(n)]
def LIR(n): return [LI() for i in range(n)]
def SR(n): return [S() for i in range(n)]
def LSR(n): return [LS() for i in range(n)]
def SRL(n): return [list(S()) for i in range(n)]
def MSRL(n): return [[int(j) for j in list(S())] for i in range(n)]


s = S()
ans = ''
if 'C' in s:
    ans += 'C'
    if 'F' in s[s.index('C'):]:
        ans += 'F'
if ans == 'CF':
    print('Yes')
else:
    print('No')

Buggy submission (verdict: Runtime Error):
import sys


def LI(): return list(map(int, sys.stdin.buffer.readline().split()))
def I(): return int(sys.stdin.buffer.readline())
def LS(): return sys.stdin.buffer.readline().rstrip().decode('utf-8').split()
def S(): return sys.stdin.buffer.readline().rstrip().decode('utf-8')
def IR(n): return [I() for i in range(n)]
def LIR(n): return [LI() for i in range(n)]
def SR(n): return [S() for i in range(n)]
def LSR(n): return [LS() for i in range(n)]
def SRL(n): return [list(S()) for i in range(n)]
def MSRL(n): return [[int(j) for j in list(S())] for i in range(n)]


s = S()
ans = ''
if 'C' in s:
    ans += 'C'
if 'F' in s[s.index('C'):]:
    ans += 'F'
if ans == 'CF':
    print('Yes')
else:
    print('No')
Problem p03280 (python)

Fixed submission:
a,b = map(int,input().split())
print((a-1)*(b-1))

Buggy submission (verdict: Runtime Error):
s = input()
k = int(input())
for c in range(len(s)):
    if s[c] == "1":
        k -= 1
        if k >= 0:
            print(1)
            break
    else:
        print(s[c])
        break
Problem p03282 (python)

Fixed submission:
s = input()
k = int(input())
for c in range(min(len(s),k)):
    if s[c] != "1":
        print(s[c])
        exit()
print(1)

Buggy submission (verdict: Runtime Error):
s = input()
k,a = int(input()),list()
for c in range(len(s)):
    if s[c] == "1":
        k -= 1
        if k < 0:
            print(1)
            break
    else:
        a.append(s[c])
print(a[0])
Problem p03323 (python)

Fixed submission:
a,b = map(int,input().split())

if a<=8 and b<=8 :
    print("Yay!")
else:
    print(":(")

Buggy submission (verdict: Runtime Error):
    a = int(input())
    b = int(input())
     
    if a<=8 and b<=8 :
        print("Yay!")
    else:
        print(":(")

Buggy submission (verdict: Runtime Error):
a = int(input())
b = int(input())

if a<=8 and b<=8 :
    print("Yay!")
else:
    print(":(")
Problem p03760 (python)

Fixed submission:
o = input()
e = input()
counter = 0
ans = ""
while len(o) > counter:
    ans = str(ans) + o[counter]
    if len(o) > len(e):
        if counter == len(o)-1:
            break
    ans = ans + e[counter]
    counter+=1
print(ans)

Buggy submission (verdict: Runtime Error):
o = input()
e = input()
counter = 0
ans = ""
while len(o) > counter:
    ans = str(ans) + o[counter] + e[counter]
    counter+=1
print(ans)