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

Fixed submission:
N = int(input())
S = input()
K = int(input())

s = S[K-1]

answer = ''
for i in range(N):
    if S[i] != s:
        answer += '*'
    else:
        answer += s
print(answer)

Buggy submission (verdict: Runtime Error):
N = int(input())
S = input()
K = int(input())

s = S[K]

answer = ''
for i in range(N):
    if S[i] != s:
        answer += '*'
    else:
        answer += s
print(answer)
Problem p03074 (python)

Fixed submission:
N,K = map(int,input().split())
S = input()

if S[N-1] == '1':
    S += '0'
else:
    S += '1'

memo = [1]
now = S[0]
cnt = 1
for i in range(N):
    if S[i+1] == now:
        cnt += 1
    else:
        cnt += 1
        memo.append(cnt)
        now = S[i+1]

n = len(memo)
for i in range(2*K+1):
    memo.append(N+1)

m = 0
l = []
if S[0] == '1':
    for i in range(n):
        if i%2 == 0:
            l.append(memo[i+2*K+1]-memo[i])
        else:
            l.append(memo[i+2*K]-memo[i])



        # if s > m:
        #     m = s
else:
    for i in range(n):
        if i%2 == 1:
            l.append(memo[i+2*K+1]-memo[i])
        else:
            l.append(memo[i+2*K]-memo[i])


        # if s > m:
        #     m = s

print(max(l))

Buggy submission (verdict: Runtime Error):
N,K = map(int,input().split())
S = input()

if S[N-1] == '1':
    S += '0'
else:
    S += '1'

memo = []
now = S[0]
cnt = 1
for i in range(N):
    if S[i+1] == now:
        cnt += 1
    else:
        memo.append(cnt)
        cnt += 1
        now = S[i+1]

m = 0
l = []
if S[0] == '1':
    for i in range(len(memo)):
        if i%2 == 0:
            l.append(memo[i+2*K+1]-memo[i])
        else:
            l.append(memo[i+2*K]-memo[i])



        # if s > m:
        #     m = s
else:
    for i in range(len(memo)):
        if i%2 == 1:
            l.append(memo[i+2*K+1]-memo[i])
        else:
            l.append(memo[i+2*K]-memo[i])


        # if s > m:
        #     m = s

print(max(l))
Problem p03086 (python)

Fixed submission:
s = input()

max_score = 0
score = 0
for i in range(len(s)):
  if s[i] == 'A' or s[i] == 'T' or s[i] == 'G' or s[i] == 'C':
    score += 1
    if max_score <= score:
      max_score = score
  else:
    if max_score <= score:
      max_score = score
    score = 0
  
 
      
print(max_score)

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

max_score = 0
for i in range(len(s)):
  if s[i] == 'A' or s[i] == 'T' or s[i] == 'G' or s[i] == 'C':
    score += 1
  else:
    if max_score < score:
      max_score = score
    score = 0

      
print(max_score)
Problem p03126 (python)

Fixed submission:
N,M = map(int,input().split())
cnt = [0 for i in range(M)]
for i in range(N):
    A = list(map(int,input().split()))
    A = A[1:]
    for j in range(len(A)):
        cnt[A[j]-1] += 1

print(cnt.count(N))

Buggy submission (verdict: Runtime Error):
N,M = map(int,input().split())
cnt = [0 for i in range(M)]
for i in range(N):
    A = list(map(int,input().split()))
    A = A[1:]
    for j in range(len(A)):
        cnt[A[j]] += 1

print(cnt.count(N))
Problem p03024 (python)

Fixed submission:
S = input()
k = len(S)
l = 15 - k
m =S.count("o")
if m + l>= 8:
    print("YES")
else:
    print("NO")

Buggy submission (verdict: Runtime Error):
S = input()
k = S.size()
l = 15 - k
m =S.count("○")
if m + l>= 8:
    print("YES")
else:
    print("NO")
Problem p03068 (python)

Fixed submission:
N = int(input())
S = input()
K = int(input())
list = []
Sk = S[K-1]
for i in range(0,N):
  s = S[i]
  s_ans = Sk if s == Sk else "*"
  list.append(s_ans)
ans = "".join(list)
print(ans)

Buggy submission (verdict: Runtime Error):
N = int(input())
S = input()
K = int(input())
list = []
Sk = S[K-1]
for i range(0,N):
  s = S[i]
  s_ans = Sk if s == Sk else "*"
  list.append(s_ans)
ans = join(list)
print(ans)
Problem p02983 (python)

Fixed submission:
def main():
  l, r = map(int, input().split(' '))
  if r - l >= 2019:
    print(0)
  else:
    ans = l * r
    i = l
    while i < r:
      j = i + 1
      while j <= r:
        ij = i * j
        if mod(ij) < ans:
          ans = mod(ij)
        j += 1
      i += 1
    print(ans)


def mod(n):
  if n < 2019:
    return n
  else:
    return(n % 2019)


if __name__ == '__main__':
  main()

Buggy submission (verdict: Runtime Error):
def main():
    l, r = map(int, input().split(' '))
    if (r - l) >= 2019:
        ans = 0
    else:
        while l > 2019:
            l %= 2019
        while r > 2019:
            r %= 2019
            ans = 0 if l >= r else l * (l + 1)
    print(ans)


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

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

Buggy submission (verdict: Runtime Error):
ans = int(input())
ans *= int(input())
print(ans)
Problem p02677 (python)

Fixed submission:
import math

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

def clock_to_minutes(h, m):
  minutes = m
  minutes += h*60
  return minutes

angular_speed_A = 360/12/60
angular_speed_B = 6

angle = abs((angular_speed_A - angular_speed_B)*clock_to_minutes(h,m)%360)

ans = math.sqrt(a**2 + b**2 - 2*a*b*math.cos(math.radians(angle)))

print(ans)

Buggy submission (verdict: Runtime Error):
import math

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

def clock_to_minutes(h, m):
  minutes = m
  minutes += h*60
  return minutes

angular_speed_A = 360/12/60
angular_speed_B = 6

angle = abs((angular_speed_A - angular_speed_B)*clock_to_minutes(h,m)%360)

ans = sqrt(a**2 + b**2 - 2*a*b*math.cos(math.radians(angle)))

print(ans)
Problem p02684 (python)

Fixed submission:
n, k = map(int,input().split())
town = list(map(int,input().split()))
cnt = 1
step = 1
now = town[0]
via = [1]
s = {1}
while True:
  now = town[via[-1]-1]
  if not now in s:
    via.append(now)
    s.add(now)
  else:
    start = via.index(now)
    roop = len(via) - start
    break
 
 
if len(via) == 1:
    print(1)
    exit()
 
elif len(via) > k:
    print(via[k])
    exit()
 
else:
    roop_remainder = (k + 1 - start) % roop
    if roop_remainder == 0:
        print(via[-1])
    else:
        print(via[start + roop_remainder -1])

Buggy submission (verdict: Runtime Error):
n, k = map(int,input().split())
town = list(map(int,input().split()))
cnt = 1
step = 1
now = town[0]
via = [1]
s = {1}
while True:
  now = town[via[-1]-1-
  if not now in s:
    via.append(now)
    s.add(now)
  else:
    start = via.index(now)
    roop = len(via) - start
    break


if len(via) == 1:
    print(1)
    exit()
 
elif len(via) > k:
    print(via[k])
    exit()
 
else:
    roop_remainder = (k + 1 - start) % roop
    if roop_remainder == 0:
        print(via[-1])
    else:
        print(via[start + roop_remainder -1])
Problem p02700 (python)

Fixed submission:
a,b,c,d = map(int,input().split())
turn =1
while((a>0) and (c>0)):
  if(turn == 1):
    c -= b
    turn = 0
  else:
    a -= d
    turn = 1
if(a<=0):
  print("No")
else:
  print("Yes")

Buggy submission (verdict: Runtime Error):
a,b,c,d = map(int,input().split())
turn =1
while((a<=0) or (c<=0)):
  if(turn = 1):
    c -= b
    turn = 0
  else:
    a -= d
    turn = 1
if(a<=0):
  print("No")
else:
  print("Yes")
Problem p02756 (python)

Fixed submission:
from collections import deque

s = deque(list(input()))

q = int(input())

reverse = 0

for i in range(q):
  query = list(input().split())
  if query[0] == '1':
    reverse ^= 1
    continue
  else:
    if query[1] == '1':
      if reverse:
        s.append(query[2])
      else:
        s.appendleft(query[2])
    else:
      if reverse:
        s.appendleft(query[2])
      else:
        s.append(query[2])
if reverse:
  print(''.join(s)[::-1])
else:
  print(''.join(s))

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

s = deque(list(input()))

q = int(input())

reverse = 0

for i in range(q):
  query = list(input().split())
  if query[0] == '1':
    reverse ^= 1
    continue
  else:
    if query[1] == '1':
      if reverse:
        s.append(query[2])
      else:
        s.appendleft(query[2])
    else:
      if reverse:
        s.appendleft(query[2])
      else:
        s.append(query[2])
if reverse:
  s = s[::-1]
print(''.join(s))

Buggy submission (verdict: Runtime Error):
s = list(input())

q = int(input())

reverse = 0

for i in range(q):
  query = list(input().split())
  if query[0] == '1':
    reverse ^= 1
    continue
  else:
    if query[1] == '1':
      if reverse:
        s.append(query[2])
      else:
        s.appendleft(query[2])
    else:
      if reverse:
        s.appendleft(query[2])
      else:
        s.append(query[2])
if reverse:
  s = s[::-1]
print(''.join(s))
Problem p03030 (python)

Fixed submission:
n = int(input())

res = []
for i in range(n):
  city, value = input().split()
  value = int(value)
  res.append([city, value, i+1])
res_s = sorted(res, key = lambda x: (x[0], -x[1]))
for i in range(n):
  print(res_s[i][2])

Buggy submission (verdict: Runtime Error):
n = int(input())

res = []
for i in range(n):
  city, value = input().split()
  value = int(value)
  res.append([city, value, i])
res_s = sorted(res, key = lambda x: (x[0], -x[1]))
for i in range(n):
  print(ans[i][2])
Problem p03043 (python)

Fixed submission:
import math
n, k = map(int, input().split())
ans = 0.0
if n >= k:
  ans += (n-k+1)/n
  
for i in range(1, min(n+1, k)):
  now = i
  p = 1/n
  while(now <k):
    now *= 2
    p /= 2
  ans += p
  
print(ans)

Buggy submission (verdict: Runtime Error):
import math
n, k = map(int, input().split())
ans = 0.0
if n >= k:
  ans += (n-k+1)/n
  
for i in range(1, min(n+1, k)):
  ans+= (1/2)**(floor(math.log2(k/i))+1)
print(ans)
Problem p02997 (python)

Fixed submission:
n, k = map(int, input().split())

if k > (n-1)*(n-2)//2:
  print(-1)
else:
  ans = []
  for i in range(n-1):
    ans.append("{} {}".format(1, i+2))
  u = 2
  v = 3
  for _ in range((n-1)*(n-2)//2 - k):
    ans.append("{} {}".format(u, v))
    v += 1
    if (v > n):
      u += 1
      v = u + 1

  print(len(ans))
  for s in ans:
    print(s)

Buggy submission (verdict: Runtime Error):
n, k = map(int, input().split())

if k > (n-1)*(n-2)//2:
  print(-1)
else:
  ans = []
  for i in range(n-1):
    ans.append("{} {}".format(0, i+1))
  u = 1
  v = 2
  for i in range((n-1)*(n-2)//2 - k):
    ans.append("{} {}".format(u, v))
    v += 1
    if (v > n):
      u += 1
      v = u + 1

print(len(ans))
for s in ans:
  print(s)

Buggy submission (verdict: Runtime Error):
n, k = map(int, input().split())

if k > (n-1)(n-2)//2:
  print(-1)
else:
  ans = []
  for i in range(n-1):
    ans.push_back("{} {}".format(0, i+1))
  u = 1
  v = 2
  for i in range((n-1)(n-2)//2 - k):
    ans.push_back("{} {}".format(u, v))
    v += 1
    if (v > n):
      u += 1
      v = u + 1

print(len(ans))
for s in ans:
  print(s)
Problem p03239 (python)

Fixed submission:
n, t = map(int, input().split())
ret = 1001
for i in range(n):
  a, b = map(int, input().split())
  if b <= t:
    ret = min(a, ret)
    
if ret == 1001:
  print('TLE')
else:
  print(ret)

Buggy submission (verdict: Runtime Error):
n, t = input().split()
ret = 1001
for i in range(n):
  a, b = map(int, input().split())
  if b <= t:
    ret = min(a, ret)
    
if ret == 1001:
  print('TLE')
else:
  print(ret)

Buggy submission (verdict: Runtime Error):
n, t = input().split()
ret = 1001
for i in range(n):
  a, b = input().split()
  if b <= t:
    ret = min(a, ret)
    
if ret == 1001:
  print('TLE')
else:
  print(ret)

Buggy submission (verdict: Runtime Error):
n, t = split(input())
ret = 1001
for i in range(n):
  a, b = split(input())
  if b <= t:
    ret = min(a, ret)
    
if ret == 1001:
  print('TLE')
else:
  print(ret)
Problem p03283 (python)

Fixed submission:
import numpy as np

n,m,q=map(int, input().split())  
a=[list(map(int, input().split())) for i in range(m)]
b=[list(map(int, input().split())) for i in range(q)]

x=np.zeros((501, 501), dtype=np.int)

for i in range(m):
    x[a[i][0], a[i][1]]+=1

x = np.cumsum(x, axis=0)
x = np.cumsum(x, axis=1)

for i in range(q):
    v1=b[i][0]
    v2=b[i][1]
    
    a1=x[v2, v2]
    a2=x[v2, v1-1]
    a3=x[v1-1, v2]
    a4=x[v1-1, v1-1]
    print(a1-a2-a3+a4)

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

n,m,q=map(int, input().split())  
a=[list(map(int, input().split())) for i in range(m)]
b=[list(map(int, input().split())) for i in range(q)]

x=np.zeros(501, 501)

for i in range(m):
    x[a[i][0]][a[i][1]]+=1

x= np.cumsum(x, axis=0)
x= np.cumsum(x, axis=1)

for i in range(q):
    v1=b[i][0]
    v2=b[i][1]
    
    a1=x[v2,v2]
    a2=x[v2,v1-1]
    a3=x[v1-1,v2]
    a4=x[v1-1,v1-1]
    print(a1-a2-a3+a4)
Problem p03292 (python)

Fixed submission:
x = list(map(int, input().split()))
print(max(x) - min(x))

Buggy submission (verdict: Runtime Error):
x = list(map(input().split(), int))

print(x.max() - x.min())
Problem p02678 (python)

Fixed submission:
from collections import deque
N, M = map(int, input().split())
root = [set() for i in range(N + 1)]
ans = [0 for i in range(N + 1)]
for i in range(M):
    a, b = map(int, input().split())
    root[a].add(b)
    root[b].add(a)
task = deque([1])
itta = {1}
while len(task) > 0:
    now = task.popleft()
    additional = root[now] - itta
    for i in additional:
        ans[i] = now
        itta.add(i)
    task.extend(list(additional))
print("Yes")
for i in range(2, N + 1):
    print(ans[i])

Buggy submission (verdict: Runtime Error):
from collections import deque
N, M = map(int, input().split())
root = [set() for i in range(N + 1)]
ans = [0 for i in range(N + 1)]
for i in range(M):
    a, b = map(int, input().split())
    root[a].add(b)
    root[b].add(a)
task = deque([1])
itta = {1}
while len(task) > 0:
    now = task.pop()
    additional = root[now] - itta
    for i in additional:
        ans[i] = now
        itta.add(i)
    task.append(list(additional))
print("Yes")
for i in range(2, N + 1):
    print(ans[i])

Buggy submission (verdict: Runtime Error):
def cape(iri):
    ima = set()
    for i in iri:
        for j in root[i]:
            if ans[j] == 0:
                ans[j] = i
                root[j] -= iri #ここが重そう
                ima.add(j) #ここも重そう
    if len(ima) > 0:
        cape(ima)

N, M = map(int, input().split())
root = [set() for i in range(N + 1)]
ans = [0 for i in range(N + 1)]
for i in range(M):
    a, b = map(int, input().split())
    root[a].add(b)
    root[b].add(a)
cape({1})
print("Yes")
for i in range(2, N + 1):
    print(ans[i])

Buggy submission (verdict: Runtime Error):
def cape(iri):
    ima = set()
    for i in iri:
        for j in root[i]:
            if ans[j] == 0:
 #               print("now", i, j, ima)
                ans[j] = i
 #               print(root[j])
                root[j] -= iri #ここが重そう
 #               print(root[j])
                ima.add(j) #ここも重そう
#                print(ima)
#    print(ima)
    if ima != set():
        cape(ima)

N, M = map(int, input().split())
root = [set() for i in range(N + 1)]
ans = [0 for i in range(N + 1)]
for i in range(M):
    a, b = map(int, input().split())
    root[a].add(b)
    root[b].add(a)
#print(root)
cape({1})
print("Yes")
for i in range(2, N + 1):
    print(ans[i])

Buggy submission (verdict: Runtime Error):
import copy

def cape(iri):
    ima = set()
    for i in iri:
        for j in root[i]:
#            print(i, j)
            if ans[j] == 0:
                ans[j] = i
                root[j] -= {i}
                ima = ima | {j}
    if ima != set():
        cape(ima)

N, M = map(int, input().split())
root = [set() for i in range(N + 1)]
ans = [0 for i in range(N + 1)]
for i in range(M):
    a, b = map(int, input().split())
    root[a].add(b)
    root[b].add(a)
#print(root)
cape({1})
#print(ans)
print("Yes")
for i in range(2, N + 1):
    print(ans[i])
Problem p02702 (python)

Fixed submission:
S = input()[::-1]
N = len(S)
amari = [0 for i in range(2019)]
before = int(S[0])
amari[before] += 1
S = S[1::]
keta = 1
for i in S:
    i = int(i)
    keta = (keta * 10) % 2019
    x = (keta * i + before) % 2019
    amari[x] += 1
    before = x
ans = amari[0]
for i in amari:
    ans += i * (i - 1) // 2
print(ans)

Buggy submission (verdict: Runtime Error):
S = input()
N = len(S)
amari = [0 fot i in range(2019)]
for i in range(N):
    amari[int(S[i : N]) % 2019] += 1
ans = amari[0]
for i in amari:
    if i > 1:
       ans += i * (i - 1) // 2
print(ans)

Buggy submission (verdict: Runtime Error):
S = input()
N = len(S)
amari = [0 fot i in range(2019)]
for i in range(N):
	amari[int(S[i : N]) % 2019] += 1
ans = amari[0]
for i in amari:
    if i > 1:
	       ans += i * (i - 1) // 2
print(ans)
Problem p03000 (python)

Fixed submission:
import sys
N, X = map(int,input().split())
x = 0
L = list(map(int,input().split()))
count = 1
for i in range(N):
    if x + L[i] <= X:
        count = count + 1
        x = x + L[i]
    else:
        print(count)
        sys.exit()
print(count)

Buggy submission (verdict: Runtime Error):
import sys
N, X = map(int,input().split())
x = 0
L.append(list(map(int,input().split())))
count = 1
for i in range(N):
    if x + L[i] <= X:
        count = count + 1
        x = x + L[i]
    else:
        print(count)
        sys.exit()
print(count)
Problem p02936 (python)

Fixed submission:
from heapq import heappush,heappop

def resolve():
    n, q = map(int, input().split())

    hen = []
    for _ in range(n-1):
        a,b = map(int, input().split())
        heappush(hen,(a,b))

    ns = [0 for _ in range(n+1)]
    for _ in range(q):
        p, x = map(int, input().split())
        ns[p] += x

    # 操作はまとめられる。頂点nに対してpの和
    # 親から累積させながら末端へ下ろしていく

    while len(hen) > 0:
        a, b = heappop(hen)
        ns[b] += ns[a]

    print(*ns[1:n+1])
resolve()

Buggy submission (verdict: Runtime Error):
def resolve():
    def dfs(num, p=-1):
        for i in to[num]:
            if p == i:
                continue
            ns[i] += ns[num]
            dfs(i, num)
            
    n, q = map(int, input().split())

    to = [[] for _ in range(n)]

    for _ in range(n-1):
        a,b = map(int, input().split())
        a -= 1
        b -= 1
        to[a].append(b)
        to[b].append(a)

    ns = [0 for _ in range(n)]
    for _ in range(q):
        p, x = map(int, input().split())
        p -= 1
        ns[p] += x

    dfs(0)
    print(*ns)
resolve()
Problem p02995 (python)

Fixed submission:
import fractions

def resolve():
    a,b,c,d = map(int,input().split())
 
    dividable_by_c = b // c - (a-1) // c
    dividable_by_d = b // d - (a-1) // d
    lcm = c * d // fractions.gcd(c,d)
    dividable_by_c_and_d = b // lcm - (a-1) // lcm
 
    result = (b - a + 1) - dividable_by_c - dividable_by_d + dividable_by_c_and_d
    print(result)
resolve()

Buggy submission (verdict: Runtime Error):
def resolve():
    a,b,c,d = map(int,input().split())

    dividable_by_c = b // c - (a-1) // c
    dividable_by_d = b // d - (a-1) // d
    lcm = c * d // fractions.gcd(c,d)
    dividable_by_c_and_d = b // lcm - (a-1) // lcm

    result = (b - a + 1) - dividable_by_c - dividable_by_d + dividable_by_c_and_d
    print(result)
resolve()
Problem p02899 (python)

Fixed submission:
n = int(input())
a = list(map(int, input().split()))
l = [0]*(n)
for i in range(n):
    l[a[i]-1] = i + 1
print(" ".join(map(str, l)))

Buggy submission (verdict: Runtime Error):
n = int(input())
a = list(map(int, input().split()))
l = [0]*(n)
l[1] = 1
for i in range(n):
    l[a[i]-1] = i + 1
print(" ".join(map(str, l)))
Problem p03109 (python)

Fixed submission:
s = int(input().replace('/',''))
if s > 20190430:
    print("TBD")
else:
    print("Heisei")

Buggy submission (verdict: Runtime Error):
s = int(input().replace('/',''))
if s > 20190420:
    print("TBD")
else]
    print("Heisei")
Problem p03110 (python)

Fixed submission:
n = int(input())
ans = 0
for i in range(n):
    x, u = input().split()
    s = float(x)
    if u == "JPY":
        ans += s
    else:
        ans += (s * 380000.0)
print(ans)

Buggy submission (verdict: Runtime Error):
n = int(input())
ans = 0
for i in range(n):
    x, u = input().split()
    s = float(x)
    if u = "JPY":
        ans += s
    else:
        ans += (s * 380000.0)
print(s)
Problem p03262 (python)

Fixed submission:
import functools
def gcd( a, b ):
    while b != 0:
        a, b = b,a%b
    return a
n,x=map(int,input().split())
l = [abs(int(i) - x) for i in input().split()]
print(functools.reduce(gcd,l))

Buggy submission (verdict: Runtime Error):
import math
n,x=map(int,input().split())
l = [abs(int(i) - x) for i in input().split()]
ans = l[0]
for i in l:
    y = math.gcd(ans,i)
    ans = y
print(ans)

Buggy submission (verdict: Runtime Error):
import math
n,x=map(int,input().split())
l = [abs(int(i) - x) for i in input().split()]
ans = l[0]
for i in l:
    ans = math.gcd(ans,i)
print(ans)

Buggy submission (verdict: Runtime Error):
from math import gcd
n,x=map(int,input().split())
l = [abs(int(i) - x) for i in input().split()]
ans = l[0]
for i in l:
    ans = gcd(ans,i)
print(ans)
Problem p03399 (python)

Fixed submission:
a=[int(input()) for i in range(2)];b=[int(input()) for i in range(2)]
print(min(a)+min(b))

Buggy submission (verdict: Runtime Error):
a,b,c,d=map(int,input().split());print(min(a,b)+min(c,d))
Problem p03609 (python)

Fixed submission:
a,b = map(int,input().split());print(max(a-b,0))

Buggy submission (verdict: Runtime Error):
a,b = map(int,input().split();print(max(a-b,0))
Problem p03633 (python)

Fixed submission:
def gcd(a, b):
    while b:
        a, b = b, a % b
    return a
n = int(input())
lc = 1
for i in range(n):
    t = int(input())
    lc = lc * t // gcd(lc,t)
print(lc)

Buggy submission (verdict: Runtime Error):
import math
n = int(input())
lc = 1
for i in range(n):
    t = int(input())
    lc = lc * t // math.gcd(lc,t)
print(lc)

Buggy submission (verdict: Runtime Error):
import math
input()
lc = 1
for i in range(n):
    t = int(input())
    lc = lc * t // math.gcd(lc,t)
print(lc)

Buggy submission (verdict: Runtime Error):
import math
input()
t = list(map(int,input().split()))
lc = 1
for i in t:
    lc = lc * t // math.gcd(lc,t)
print(lc)
Problem p03659 (python)

Fixed submission:
n = int(input())
a = list(map(int,input().split()))
ans = -1
sum_ = sum(a)
sunuke = 0
for i in range(n-1):
    sum_ -= a[i]
    sunuke += a[i]
    tmp = abs(sum_ - sunuke)
    if ans == -1:
        ans = tmp
    if ans > tmp:
        ans = tmp
print(ans)

Buggy submission (verdict: Runtime Error):
from _overlapped import NULL
n = int(input())
a = list(map(int,input().split()))
ans = NULL
for i in range(n):
    tmp = abs(sum(a[:i])-sum(a[i:]))
    if ans == NULL:
        ans = tmp
    if tmp < ans:
        ans = tmp
print(ans)
Problem p03671 (python)

Fixed submission:
a = list(map(int,input().split()))
a.sort()
print(sum(a[0:2]))

Buggy submission (verdict: Runtime Error):
a = list(map(int,input(),split()))
a.sort(reverse = True)
print(sum(a[0:2]))
Problem p03694 (python)

Fixed submission:
n = int(input())
a = list(map(int,input().split()))
print(max(a)-min(a))

Buggy submission (verdict: Runtime Error):
n = int(input())
a = list(map(int,input().split()))
print(max(a)-min(a)
Problem p03760 (python)

Fixed submission:
o = input()
e = input()
pw = ""
for i in range(len(e)):
    pw+= o[i] + e[i]
if len(o) != len(e):
    pw += o[-1]
print(pw)

Buggy submission (verdict: Runtime Error):
o = input()
e = input()
pw = ""
for i in range(e):
    pw+= o[i] + e[i]
if len(o) != len(e):
    pw += o[-1]
print(pw)
Problem p03813 (python)

Fixed submission:
print(['ARC','ABC'][int(input())<1200])

Buggy submission (verdict: Runtime Error):
print("ABC" if int(input() < 1200 else "ARC")
Problem p03845 (python)

Fixed submission:
from copy import deepcopy
n = int(input())
t = list(map(int,input().split()))
m = int(input())
p = []
x = []
for i in range(m):
    tmpp,tmpx = map(int,input().split())
    p.append(tmpp)
    x.append(tmpx)
for j in range(len(p)):
    tmplist = deepcopy(t)
    tmplist[p[j]-1] = x[j]
    print(sum(tmplist))

Buggy submission (verdict: Runtime Error):
from copy import deepcopy
n = int(input())
t = list(map(int,input().split()))
m = int(input())
p = []
x = []
for i in range(m):
    tmpp,tmpx = map(int,input().split())
    p.append(tmpp)
    x.append(tmpx)
for j in p:
    tmplist = deepcopy(t)
    tmplist[j-1] = x[j-1]
    print(sum(tmplist))