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

Fixed submission:
l = list(map(int,input().split()))
ans = list(dict.fromkeys(l))
print(len(ans))

Buggy submission (verdict: Runtime Error):
l = list(map(int,input()split()))
ans = list(dict.fromkeys(l))
print(len(ans)+1)
Problem p03997 (python)

Fixed submission:
a = int(input())
b = int(input())
h = int(input())
ans = (a+b)*h/2
print(int(ans))

Buggy submission (verdict: Runtime Error):
a = int(input())
b = int(input())
h = int(input())
ans = (a+b)*h/2
print()ans
Problem p04029 (python)

Fixed submission:
n = int(input())
count = 0
for i in range(n):
    count += i+1
print(count)

Buggy submission (verdict: Runtime Error):
n = int(input())
for i in range(n):
    count += i
print(count)
Problem p03813 (python)

Fixed submission:
x = int(input())
if x < 1200:
    print('ABC')
else:
    print('ARC')

Buggy submission (verdict: Runtime Error):
x = input()
if x < 1200:
    print('ABC')
else:
    print('ARC')
Problem p03962 (python)

Fixed submission:
n = list(int(x) for x in input().split(' '))

ans = set(n)
print(len(ans))

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

ans = set(n)
print(ans.count)
Problem p03963 (python)

Fixed submission:
n, k = (int(x) for x in input().split(' '))
print(k*(k-1)**(n-1))

Buggy submission (verdict: Runtime Error):
n, k = (int(x) for x in input().split())
count = 0
s = [[0 for i in range(n)] for j in range(k)]

for i in range(n):
    for j in range(k):
        if i == 0 or s[i][j] != s[i - 1][j]:
            count += 1

print(count)
Problem p04029 (python)

Fixed submission:
n = int(input())
ans = 0

for i in range(n + 1):
    ans += i

print(ans)

Buggy submission (verdict: Runtime Error):
n = int(input())
print(n*(n + 1) // 2
Problem p04030 (python)

Fixed submission:
s = input()

ans = ''
for i in s:
    if i != 'B':
        ans += i
    else:
        ans = ans[:-1]
print(ans)

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

ans = ''
for x in s:
    if x == '1' or x == '0':
        ans += x
    elif ans:
        ans[-1].remove
print(ans)
Problem p04044 (python)

Fixed submission:
n, l = (int(x) for x in input().split())
s = [input() for a in range(n)]
print("".join(sorted(s)))

Buggy submission (verdict: Runtime Error):
n, l = (int(x) for x in input().split())
s = list(str(x) for x in input().split())

s.sort()
ans = 0
while range(n + 1):
    ans += s[n]

Buggy submission (verdict: Runtime Error):
n, l = (int(x) for x in input().split())
while range(n + 1):
    s = list(x for x in input.split())

s.sort()
ans = 0
while range(n + 1):
    ans += s[n]

Buggy submission (verdict: Runtime Error):
n, l= (int(x) for x in input().split())
s = list(x for x in input.split())

s.sort()
ans = 0
while range(n + 1):
    ans += s[n]
Problem p02866 (python)

Fixed submission:
n = int(input())
d = list(map(int, input().split()))
b = 1
ans = 1
dd=[0]*10**5
for i in d:
    dd[i]+=1
max = max(d)
if d[0] == 0 and d.count(0) == 1:
    for i in range(1, max+1):
        if dd[i] == 0:
            print(0)
            exit()
        if dd[i] == 1:
            ans *= b
        else:
            if b != 1:
                ans *= pow(b, dd[i], 998244353)
        b = dd[i]
    print(ans % 998244353)
else:
    print(0)

Buggy submission (verdict: Runtime Error):
n = int(input())
d = list(map(int, input().split()))
b = 1
ans = 1
max = 0
dd=[0]*10**5
for i in d:
    dd[i]+=1
max = max(d)
if d[0] == 0 and d.count(0) == 1:
    for i in range(1, max+1):
        if dd[i] == 0:
            print(0)
            exit()
        if dd[i] == 1:
            ans *= b
        else:
            if b != 1:
                ans *= pow(b, dd[i], 998244353)
        b = dd[i]
    print(ans % 998244353)
else:
    print(0)
Problem p02934 (python)

Fixed submission:
N = int(input())
A = map(float,input().split())
sum = 0

for i in A:
  a = 1/i
  
  sum += a

print(1/sum)

Buggy submission (verdict: Runtime Error):
N = int(input())
A = map(int,input().split())
sum = 0
a = []
for i in range(N):
  a.append(1/A[i])
  sum += a[i]

print(1/sum)
Problem p02937 (python)

Fixed submission:
import bisect

s=input()
t=input()

#index=list()
#for a in range(len(t)):
# index.append([i for i, x in enumerate(s) if x == t[a]])

char_appear = {ch: [] for ch in 'abcdefghijklmnopqrstuvwxyz'}
for i, ch in enumerate(s):
    char_appear[ch].append(i)
#print(char_appear['a'])
      
b=0
loop=0
condition=0

for j in range(len(t)):
  if len(char_appear[t[j]])<1:
    print(-1)
    condition=1
    break
  c=bisect.bisect(char_appear[t[j]],b)
 # print(j,char_appear[t[j]],b,c,loop)
  if j<1:
    b=char_appear[t[0]][0]    
  elif c == len(char_appear[t[j]]): #or c==char_appear[t[j]][len(char_appear[t[j]])-1]: 
     loop +=1
     b=char_appear[t[j]][0]
     if loop==10**100:
        print(-1)
        condition=1
        break
  else:
     b=char_appear[t[j]][c]
     #print(j,b,loop)


if condition==0:
 print(b+loop*len(s)+1)

Buggy submission (verdict: Runtime Error):
import bisect

s=input()
t=input()

condition=0

index=list()
for a in range(len(t)):
 index.append([i for i, x in enumerate(s) if x == t[a]])

for i in range(len(t)):
 if index[i]==[]:
   condition=1
   break

if condition==1:
  print(-1)
else:
  #print(index)
  b=index[0][0]
  j=1
  loop=0
  if len(t)==1:
    print(b+1)
  else:
   while j <= len(t)-1:
     c=bisect.bisect_left(index[j],b)
     #print(j,index[j],b,c,loop)
     if  c < index[j][len(index[j])-1]:
        b=index[j][c]
        #print(j,b,loop)
        j=j+1
        if j==len(t):
          print(b+loop+1)
          break
     else:
        loop=loop+len(s)
        b=index[j][0]
        j=j+1
        if j==len(t):
          print(b+loop+1)
          break
        if loop == len(s)*(10**100):
           print(-1)
           break
Problem p02939 (python)

Fixed submission:
S = input()
count = 1
strings = []
strings.append(S[0])
stack = ''
for s in S[1:]:
    stack += s
    if strings[-1] == stack:
        continue
    else:
        strings.append(stack)
        stack = ''
        count+=1    

print(count)

Buggy submission (verdict: Runtime Error):
N = int(input())
A = [int(i) for i in input().split()]
B = [int(i) for i in input().split()]
count =0
while B != A: 
    if max(B) < max(A):
        count =-1
        break
    i = B.index(max(B))
    if i+1 >= N:
        B[i] = B[i] - B[0] - B[i-1]
    else:
        B[i] = B[i] - B[i+1] - B[i-1]
    count += 1
    
print(count)

Buggy submission (verdict: Runtime Error):
S = input()
count = 0
i = 0
while i < len(S)-2:
    if S[i] == S[i+1]:
        i +=3
        count += 2  
    else:
        i +=1
        count += 1
if S[i] == S[i+1]:
    count += 1
else:
    count += 2
print(count)

Buggy submission (verdict: Runtime Error):
S = input()
count = 0
i = 0
while i < len(S)-2:
    if S[i] == S[i+1]:
        i +=3
        count += 2  
    else:
        i +=1
        count += 1
if S[i] == S[i+1]:
    count += 1
else:
    count += 2
print(count)

Buggy submission (verdict: Runtime Error):
S = input()
count = 0
i = 0
while i < len(S)-2:
    if S[i] == S[i+1]:
        print(S[i])
        print(S[i+1]+S[i+2])
        i +=3
        count += 2  
    else:
        print(S[i])
        i +=1
        count += 1
if S[i] == S[i+1]:
    count += 1
else:
    count += 2
print(count)
Problem p02957 (python)

Fixed submission:
A, B = map(int,input().split())
K = (A+B) 
if K % 2 == 0:
    print(K//2)
else:
    print('IMPOSSIBLE')

Buggy submission (verdict: Runtime Error):
N = int(input())
p = list(map(int,input().split()))
count = 0
for i in range(1,N+1):
    if p[i-1] != i:
        count += 1
    if count >2:
        print('NO')
        exit(0)
print('YES')
Problem p02981 (python)

Fixed submission:
N,A,B=map((int),input().split())
if N*A>B:
    print(B)
else:
    print(N*A)

Buggy submission (verdict: Runtime Error):
N,A,B=map((int),input(),split())
if N*A>B:
    print(B)
else:
    print(N*A)
Problem p02983 (python)

Fixed submission:
L, R = map(int, input().split())
l_mod = L % 2019
r_mod = R % 2019
if R >2019+L:
    print(0)
else:
    mod = (l_mod*(l_mod+1)) % 2019
    for i in range(l_mod,r_mod):
        for j in range(i+1,r_mod+1):
            if mod>(i*j)%2019:
                mod=(i*j)%2019
    print(mod)

Buggy submission (verdict: Runtime Error):
L, R = map(int, input().split())
l_mod = L % 2019
r_mod = R % 2019
result = 2019
if l_mod > r_mod:
    print(0)
else:
    print((L_mod*(L_mod+1))%2019)

Buggy submission (verdict: Runtime Error):
L, R = map(int, input().split())
l_mod = L % 2019
r_mod = R % 2019
result = 2019
if l_mod > r_mod:
    print(0)
else:
    print(L_mod*(L_mod+1)%2019)
Problem p03471 (python)

Fixed submission:
N,Y = map(int,input().split())
x = y = z = 0
for i in range(N,-1,-1):
    if i*10000 <= Y:
        charge = Y - i*10000
        rest = N - i
        for j in range(rest,-1,-1):
            if j*5000 <= charge:
                if charge - j*5000 - (rest-j)*1000 == 0:
                    print('{0} {1} {2}'.format(i, j ,rest-j))
                    exit(0)
print('-1 -1 -1')

Buggy submission (verdict: Runtime Error):
N,Y = map(int,input().split())
x = y = z = 0
for i in range(N,-1,-1):
    if i*10000 <= Y:
        charge = Y - i*10000
        rest = N - i
        for j in range(rest,-1,-1):
            if j*5000 <= charge:
                if charge - j*5000 - (rest-j)*1000 == 0:
                    print('{1} {2} {3}'.format(i, j ,rest-j))
                    exit(0)
print('-1 -1 -1')

Buggy submission (verdict: Runtime Error):
N,Y = map(int,input().split())
x = y = z = 0
for i in range(N,-1,-1):
    if i*10000 <= Y:
        charge = Y - i*10000
        rest = N - i
        for j in range(rest,-1,-1):
            if j*5000 <= charge:
                if charge - j*5000 - (rest-j)*1000 == 0:
                    print(f'{i} {j} {rest-j}')
                    exit(1)
print('-1 -1 -1')

Buggy submission (verdict: Runtime Error):
N,Y = map(int,input().split())
x = y = z = 0
for i in range(N,-1,-1):
    if i*10000 <= Y:
        charge = Y - i*10000
        rest = N - i
        for j in range(rest,-1,-1):
            if j*5000 <= charge:
                if charge - j*5000 - (rest-j)*1000 == 0:
                    print(f'{i} {j} {rest-j}')
                    exit(0)
print('-1 -1 -1')

Buggy submission (verdict: Runtime Error):
N,Y = map(int,input().split())
x = y = z = 0
for i in range(N,-1,-1):
    if i*10000 <= Y:
        charge = Y - i*10000
        rest = N - i
        for j in range(rest,-1,-1):
            if j*5000 <= charge:
                if charge - j*50000 - (rest-j)*1000 == 0:
                    print(f'{i} {j} {rest-j}')
                    exit(0)
print('-1 -1 -1 ')

Buggy submission (verdict: Runtime Error):
N,Y = map(int,input().split())
x = y = z = 0
for i in range(N,-1,-1):
    if i*10000 <= Y:
        charge = Y - i*10000
        rest = N - i
        for j in range(rest,-1,-1):
            if j*5000 <= charge:
                if charge - j*50000 - (rest-j)*1000 == 0:
                    print(f'{i} {j} {rest-j}')
                    exit(0)
print('-1 -1 -1 ')

Buggy submission (verdict: Runtime Error):
N,Y = map(int,input().split())
x = y = z = 0
for i in range(N,-1,-1):
    if i*10000 <= Y:
        charge = Y - i*10000
        rest = N - i
        for j in range(rest,-1,-1):
            if j*5000 <= charge:
                if charge - j*50000 - (rest-j)*1000 == 0:
                    print(f'{i} {j} {rest-j}')
                    exit(0)
Problem p04001 (python)

Fixed submission:
S = input()
n = len(S)-1
total_num = 0
if n == 0:
    total_num = S[0]
else:
    for i in range(2**n):
        num = '' 
        for j in range(n):
            if i & 2**j:
                num += S[j]
                total_num += int(num)
                num = ''
            else:
                num += S[j]
        num += S[-1]
        total_num += int(num)
print(total_num)

Buggy submission (verdict: Runtime Error):
S = input()
n = len(S)-1
total_num = 0
for i in range(2**n):
    num = '' 
    for j in range(n):
        if i & 2**j:
            num += S[j]
            total_num += int(num)
            num = ''
        else:
            num += S[j]
    num += S[j+1]
    total_num += int(num)
print(total_num)
Problem p02838 (python)

Fixed submission:
import numpy as np

n=int(input())



a= list(map(int,input().split()))
a=np.array(a,np.int64)


max=60
mod=10**9+7
ans=0
cnt1=0
cnt0=0


for i in range(max):
    new_a=(a>>i & 1)

    cnt1=np.count_nonzero(new_a)
    cnt0=n-cnt1
    ans=(ans+cnt1*cnt0*(2**i))%mod
    cnt1=0
    cnt0=0
print(ans)

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

n=int(input())

a=[]

for i in range(n):
    k=int(input())
    a.append(k)

ans=0
for i in range(n-1):
    for k in range(i,n):
        tmp=a[i]^a[k]
        #print(tmp)
        ans=(ans+tmp)%1000000007

print(ans)
Problem p02848 (python)

Fixed submission:
# 整数の入力
a = int(input())

# 文字列の入力
S = str(input())

chr = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
SS = []

for k in range(len(S)):
    for j in range(len(chr)):
        if S[k] == chr[j]:
            if (j+a) >= 25:
                SS += chr[j+a-26]
            else:
                SS += chr[j+a]

SS = ''.join(SS)

print(SS)

Buggy submission (verdict: Runtime Error):

# 整数の入力
a = int(input())

# 文字列の入力
S = str(input())

chr = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
SS = []

for k in range(len(S)):
    for j in range(len(chr)):
        if S[k] == chr[j]:
            if (j+a) >= 25:
                SS += chr[j+a-25]
            else:
                SS += chr[j+a]

SS = ''.join(SS)

print(SS)
Problem p02936 (python)

Fixed submission:
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 6)

n, q = map(int, input().split())
vals = [0] * n
node_idxes = [[] for _ in range(n)]

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

for i in range(q):
	p, x = map(int, input().split())
	vals[p - 1] += x

def dfs(chi_idx, parent):
	for child in node_idxes[chi_idx]:
		if child == parent:
			continue
		vals[child] += vals[chi_idx]
		dfs(child, chi_idx)

dfs(0, -1)
print(*vals)

Buggy submission (verdict: Runtime Error):
n, q = map(int, input().split())
vals = [0] * n
node_idxes = [[] for _ in range(n)]

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

for i in range(q):
	p, x = map(int, input().split())
	vals[p - 1] += x

def dfs(chi_idx, parent):
	for child in node_idxes[chi_idx]:
		if child == parent:
			continue
		vals[child] += vals[chi_idx]
		dfs(child, chi_idx)

dfs(0, -1)
print(*vals)

Buggy submission (verdict: Runtime Error):
class Node(object):
	def __init__(self):
		self.val = 0
		self.children = []
	
	def add_child(self, child):
		self.children.append(child)

	def add_counter(self, val):
		self.val += val
		for child in self.children:
			child.add_counter(val)

n, q = map(int, input().split())
nodes = [Node() for i in range(n)]

for i in range(n - 1):
	a, b = map(int, input().split())
	nodes[a - 1].add_child(nodes[b - 1])

for i in range(q):
	p, x = map(int, input().split())
	nodes[p - 1].add_counter(x)

for node in nodes:
	print(node.val, end=" ")
Problem p03697 (python)

Fixed submission:
res = sum(map(int, input().split()))
if res >= 10:
	print("error")
else:
	print(res)

Buggy submission (verdict: Runtime Error):
from math import ceil
from bisect import bisect

n, a, b = map(int, input().split())
raw_hs = [int(input()) for _ in range(n)]
hs = sorted(raw_hs, reverse=True)
diff = a - b

c_min = 0
c_max = int(10e9)

while c_max - c_min > 1:
	c = (c_min + c_max) // 2
	tmp_hs = [h - c * b for h in hs]
	rem = sum([ceil(h / diff) for h in tmp_hs if h > 0])
	if rem > c:
		c_min = c
	else:
		c_max = c

print(c_max)
Problem p03813 (python)

Fixed submission:
x = int(input())

print("ABC" if x < 1200 else "ARC")

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

s = set(a)
l = len(s)
l2 = 0 if len([a.count(x) for x in s]) % 2 else 1
print(l - l2)
Problem p03837 (python)

Fixed submission:
import copy
from itertools import product as prod

n, m = [int(x) for x in input().split()]

wait = [[float("inf") for _ in range(n)] for _ in range(n)]
for i in range(n):
    wait[i][i] = 0
for _ in range(m):
    a, b, c = map(int, input().split())
    wait[a-1][b-1] = c
    wait[b-1][a-1] = c

dist = copy.deepcopy(wait)
for k, i, j in prod(range(n), range(n), range(n)):
    dist[i][j] = min(dist[i][j], dist[i][k] + dist[k][j])
    dist[j][i] = min(dist[j][i], dist[j][k] + dist[k][i])

ans = 0
for i, j in prod(range(n), range(n)):
    if not wait[i][j] == float("inf") and dist[i][j] < wait[i][j]:
        ans += 1

print(ans // 2)

Buggy submission (verdict: Runtime Error):
from itertools import product as prod

n, m = [int(x) for x in input().split()]

gr = [[] for _ in range(n)]
for _ in range(m):
    a, b, c = [int(x) for x in input().split()]
    a -= 1
    b -= 1
    gr[a].append((b, c))
    gr[b].append((a, c))

numset = set(range(n))
def dist(i, j, gr=gr):
    tmp_d = float("inf")
    if i == j:
        return 0
    for (node, d) in gr[i]:
        if node == j:
            tmp_d = d
    # gr_cp = [[(n, d) for (n, d) in g if n != i] for g in gr]
    numset.remove(i)
    routes = [d + dist(n, j, gr=gr) for (n, d) in gr[i] if n in numset]

    return min(routes + [tmp_d])

ans = 0
for i in range(n):
    for (j, d) in gr[i]:
        if dist(i, j) < d:
            ans += 1

print(ans // 2)
Problem p03844 (python)

Fixed submission:
a, op, b = input().split()
a = int(a)
b = int(b)
if op == "+":
    print(a + b)
elif op == "-":
    print(a - b)

Buggy submission (verdict: Runtime Error):
n = int(input())
a = [int(x) for x in input().split()]

def is_satisfied(s):
    ln = len(s)
    check = [s.count(i) == 2 for i in range(ln - 1, 1, -2)]
    if ln % 2 == 0:
        check.append(s.count(1) == 2)
    else:
        check.append(s.count(0) == 1)

    return all(check)


ans = 2 ** (n // 2) if is_satisfied(a) else 0
print(ans)
Problem p02841 (python)

Fixed submission:
a,b=map(int,input().split())
c,d=map(int,input().split())
if a+1==c:
  print(1)
else:
  print(0)

Buggy submission (verdict: Runtime Error):
a=int(input())
b=input()
count=0
for i in range(1000):
  flag=False
  for j in range(a):
    if b[j]=='{0:03d}'.format(str(i))[0]:
      x=j
      flag=True
      break
  if flag:
    flag=False
  else:
    continue
  for k in range(x+1,a):
    if b[k]=='{0:03d}'.format(str(i))[1]:
      y=k
      flag=True
      break
  if flag:
    flag=False
  else:
    continue
  for l in range(y+1,a):
    if b[l]=='{0:03d}'.format(str(i))[1]:
      count+=1
      break
print(count)
Problem p02911 (python)

Fixed submission:
a,b,c=map(int,input().split())
d=[]
e=[]
for i in range(c):
  d.append(int(input()))
for i in range(a):
  e.append(b-c)
for i in d:
  e[i-1]+=1
for i in e:
  if i<=0:
    print('No')
  else:
    print('Yes')

Buggy submission (verdict: Runtime Error):
a,b,c=map(int,input().split())
d=[]
e=[]
for i in range(c):
  d.append(int(input()))
for i in range(a):
  e.append(b-c)
for i in d:
  e[i+1]+-1
for i in e:
  if e<=0:
    print('No')
  else:
    print('Yes')
Problem p02971 (python)

Fixed submission:
while True:
    n=int(input())
    if(2<=n<=200000):
        break
a=[]
for i in range(n):
        a.append(int(input()))
ma=a[0]
b=0
for j in range(1,n):
    if(ma==a[j]):
        b=a[j]
    if(ma<a[j]):
        ma=a[j]
        continue
    if(b<a[j]):
        b=a[j]
for l in range(n):
    if(a[l]!=ma):
        print(str(ma))
    else:
        print(str(b))

Buggy submission (verdict: Runtime Error):
n=int(input())
a=[]
ma=0
for i in range(n):
    a.append(int(input()))
for j in range(n):
    if(ma=a[j]):
        for h in range(n):
            if(h!=j):
                if(ma<a[h]):
                    ma=a[h]
        print(str(ma))
Problem p02993 (python)

Fixed submission:
a=input()
flag=False
for i in range(len(a)-1):
  if a[i]==a[i+1]:
    flag=True
    break
if flag:
  print('Bad')
else:
  print('Good')

Buggy submission (verdict: Runtime Error):
a=input()
for i in range(len(a)-1):
  if a[i]==a[i+1]:
    flag=True
    break
if flag:
  print('Bad')
else:
  print('Good')

Buggy submission (verdict: Runtime Error):
a=input()
for i in range(len(a)-1):
  if a[i]==a[i+1]:
    flag=True
    break
if flag:
  print('Bad')
else:
  print('Good')
Problem p03633 (python)

Fixed submission:
def gmax(a,b):
  if a<b:
  	a,b=b,a
  while a%b!=0:
    tmp=a
    a=b
    b=tmp%b
  return b
 
n=int(input())
x=[]
for i in range(n):
  x.append(int(input()))

if len(x)!=1:
  g=gmax(x[0],x[1])
  l=x[0]*x[1]//g

  for i in range(2,len(x)):
    g=gmax(x[i],l)
    l=(x[i]*l)//g
else:
  l=x[0]
print(l)

Buggy submission (verdict: Runtime Error):
def gmax(a,b):
  if a<b:
  	a,b=b,a
  while a%b!=0:
    tmp=a
    a=b
    b=tmp%b
  return b
 
n=int(input())
x=[]
for i in range(n):
  x.append(int(input()))
    
g=gmax(x[0],x[1])
l=x[0]*x[1]//g
 
for j in range(2,len(x)):
  g=gmax(x[j],l)
  l=x[j]*l//g
  
print(l)

Buggy submission (verdict: Runtime Error):
def gmax(a,b):
  if a<b:
  	a,b=b,a
  while a%b!=0:
    tmp=a
    a=b
    b=tmp%b
  return b

n=int(input())
x=[]
for i in range(n):
  x.append(int(input()))
    
g=gmax(x[0],x[1])
l=x[0]*x[1]//g

for i in range(2,len(x)):
  g=gmax(x[i],l)
  l=x[i]*l//g

ans=l
print(ans)

Buggy submission (verdict: Runtime Error):
def gmax(a,b):
  if a<b:
    a,b=b,a
  while a%b!=0:
    tmp=a
    a=b
    b=tmp%b
  return b

n=int(input())
x=[]
for i in range(n):
  x.append(int(input()))
    
g=gmax(x[0],x[1])
l=x[0]*x[1]//g

for i in range(2,len(x)):
  g=gmax(x[i],g)
  l=x[i]*l//g

ans=l
print(ans)
Problem p02853 (python)

Fixed submission:
def main():
    x, y = map(int, input().split())
    def get_prize(a):
        if a==1:
            return 300000
        elif a==2:
            return 200000
        elif a==3:
            return 100000
        else:
            return 0
    a = 0
    a += get_prize(x)
    a += get_prize(y)
    a = a + 400000 if a==600000 else a
    print(a)

if __name__ == "__main__":
    main()

Buggy submission (verdict: Runtime Error):
def main():
    x, y = map(int, input().split())
    def get_prize(a):
        if a==1:
            return 300_000
        elif a==2:
            return 200_000
        elif a==3:
            return 100_000
        else:
            return 0
    a = 0
    a += get_prize(x)
    a += get_prize(y)
    a = a + 400_000 if a==600_000 else a
    print(a)

if __name__ == "__main__":
    main()

Buggy submission (verdict: Runtime Error):
def main():
    x, y = map(int, input().split())
    d = {1: 30_000, 2: 20_000, 3: 10_000}
    a = 0
    a += d.get(x, 0)
    a += d.get(y, 0)
    a = a + 40_000 if a==60_000 else a
    print(a)

if __name__ == "__main__":
    main()
Problem p02855 (python)

Fixed submission:
def main():
    h, w, k = map(int, input().split())
    o = [[0]*w for _ in range(h)]
    s = [list(input()) for i in range(h)]
    n, mn = 0, 0
    for i in range(h):
        for j in range(w):
            if s[i][j]=="#":
                mn += 1
                n = mn
                o[i][j] = n
            else:
                o[i][j] = n
        n = 0
    for i in range(h):
        for j in range(w-2, -1, -1):
            if o[i][j]==0:
                o[i][j] = o[i][j+1]
    for j in range(w):
        for i in range(1, h):
            if o[i][j]==0:
                o[i][j] = o[i-1][j]
    for j in range(w):
        for i in range(h-2, -1, -1):
            if o[i][j]==0:
                o[i][j] = o[i+1][j]
    for i in range(h):
        print(*o[i])

if __name__ == "__main__":
    main()

Buggy submission (verdict: Runtime Error):
def main():
    h, w, k = map(int, input().split())
    o = [[0]*w for _ in range(h)]
    s = [list(input()) for i in range(h)]
    n, mn = 0, 0
    for i in range(h):
        for j in range(w):
            if s[i][j]=="#":
                mn += 1
                n = mn
                o[i][j] = n
            else:
                o[i][j] = n
        n = 0
    for i in range(h):
        for j in range(w-1, -1, -1):
            if o[i][j]==0:
                o[i][j] = o[i][j+1]

    for i in range(h):
        print(*o[i])

if __name__ == "__main__":
    main()