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

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

l = [int(i) for i in input().split()]

d = 0

cnt = 1

for i in range(n):
	d += l[i]
	if d > x:
		break
	else:
		cnt += 1

print(cnt)

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

l = [int(i) for i in input().split()]

d = 0

cnt = 0

for i in range(n+1):
	if d > x:
		break
	else:
		d += l[i]
		cnt += 1

print(cnt)
Problem p03001 (python)

Fixed submission:
w,h,x,y=map(int,input().split())

if x*2==w and y*2==h:
    print(w*h/2, 1)
else:
    print(w*h/2, 0)

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

flag = '0'
size = 0

if (w==x and h==y) or (x==0 and y==0):
	size = x*y
	flag = '1'
elif w == x and h != y:
	size = min(x*y, x*(h-y))
elif h == y and w != x:
	size = min(x*y, (w-x)*y)
else:
	size1 = x * h
	size2 = (w - x) * h
	size3 = w * x
	size4 = w * (h - y)

	min_size1 = min(size1, size2)
	min_size2 = min(size3, size4)

	if min_size1 == min_size2:
		flag = '1'

	if min_size1 < min_size2:
		size = min_size2
	else:
		size = min_size1


print(min_size1)
print(min_size2)
print(size, flag)
Problem p03029 (python)

Fixed submission:
a,p=map(int,input().split())
tmp = 3*a+p
print(tmp//2)

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

a = []

for i in range(n):
  	# input as str
	s, p = input().split()
    # p -> integer
	p = int(score)
    # create list
	a.append((s, p, i+1))

# sort
a.sort(key=lambda x:x[1], reverse=True)

# sort
a.sort(key=lambda x:x[0])

# output
for i in range(n):
	print(a[i][2])
Problem p03030 (python)

Fixed submission:
n = int(input())

a = []

for i in range(n):
  	# input as str
	s, p = input().split()
    # p -> integer
	p = int(p)
    # create list
	a.append((s, p, i+1))

# sort
a.sort(key=lambda x:x[1], reverse=True)

# sort
a.sort(key=lambda x:x[0])

# output
for i in range(n):
	print(a[i][2])

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

a = []

for i in range(n):
  	# input as str
	s, p = input().split()
    # p -> integer
	p = int(score)
    # create list
	a.append((s, p, i+1))

# sort
a.sort(key=lambda x:x[1], reverse=True)

# sort
a.sort(key=lambda x:x[0])

# output
for i in range(n):
	print(a[i][2])
Problem p03031 (python)

Fixed submission:
import itertools

n, m = map(int,input().split())

sw = [[] for _ in range(m)]
for i in range(m):
    sw[i] = list(map(int,input().split()[1:])) #k不要
     
p = list(map(int,input().split()))

res = 0
for tpl in itertools.product([0,1],repeat=n):
    bl = True
    for i in range(m):
        s = sum([tpl[s-1] for s in sw[i]]) # 電球iを計算
        if (s-p[i])%2 != 0:
            bl = False
            break
    if bl:
        res += 1
print(res)

Buggy submission (verdict: Runtime Error):
import itertools

n, m = map(int,input().split())

sw = [[] for _ in range(M)]
for i in range(m):
    sw[i] = list(map(int,input().split()[1:])) #k不要
     
p = list(map(int,input().split()))

res = 0
for tpl in itertools.product([0,1],repeat=n):
    bl = True
    for i in range(m):
        s = sum([tpl[s-1] for s in sw[i]]) # 電球iを計算
        if (s-p[i])%2 != 0:
            bl = False
            break
    if bl:
        res += 1
print(res)
Problem p03037 (python)

Fixed submission:
#不十分だった
n, m = map(int, input().split())
l_max, r_min = 0, 10**5 + 1
for i in range(m):
    l, r = map(int, input().split())
    l_max = max(l_max, l)
    r_min = min(r_min, r)

print(max(r_min - l_max + 1, 0))

Buggy submission (verdict: Runtime Error):
#TLEする
#こんなことしなくても最小と最大を更新していけばおｋ
#m-1にしてた
n,m=map(int,input().split())
l,r=map(int,input().split())
l_max,r_min=l,r
for i in range(m):
    l,r=map(int,input().split())
    if l_max<l: l_max=l
    if r_min>r: r_min=r
print(r_min-l_max+1)
Problem p03062 (python)

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

cnt_minus = len([a[i] for i in range(n) if a[i] < 0])

if cnt_minus % 2 == 0:
    print(sum([abs(a[i]) for i in range(n)]))
else:
    mi = min([abs(a[i]) for i in range(n)])
    print(sum([abs(a[i]) for i in range(n)]) - 2 * mi)

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

if cnt_minus % 2 == 0:
    print(sum([abs(a[i]) for i in range(n)]))
else:
    mi = min([abs(a[i]) for i in range(n)])
    print(sum([abs(a[i]) for i in range(n)]) - 2 * mi)
Problem p03071 (python)

Fixed submission:
A,B = map(int, input().split())

if A==B:
  print(A+B)
else:
  print(max(A,B)*2-1)

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

H = list(map(int, input().split()))

num_ryokan = 0
max_height = 0

for i in range(N):
  if max_height <= H[i]:#見えるとき
    num_ryokan +=1
    max_height = H[i]

print(num_ryokan)
Problem p03076 (python)

Fixed submission:
#cited by maspy
A = [int(input()) for _ in range(5)]
 
ceiled = [(x+9)//10*10 for x in A]
can_save = [y - x for x,y in zip(A,ceiled)]

answer = sum(ceiled) - max(can_save)
print(answer)

Buggy submission (verdict: Runtime Error):
a = []
for i in range(5):
    a.append(int(input()))

b = []
for i in range(5):
    b.append(a[i]%10)
  
def kiriage(n):
    if n%10==0:
        return n
    else:
        amari = n%10
        n = n - amari
        return n+10

#non-zero かつ minimum
mini_amari = 9
idx = 9
for i in range(len(b)):
    if b[i]<mini_amari and b[i]!=0:
        mini_amari = b[i]
        idx = i

res = 0
for i in range(len(a)):
    if i != idx:
        res += kiriage(a[i])
res += a[idx]
print(res)
Problem p03102 (python)

Fixed submission:
n,m,c = map(int,input().split())
b = list(map(int,input().split()))
cnt = 0
for i in range(n):
    res=0
    a = list(map(int,input().split()))
    for j in range(m):
        res += a[j]*b[j]
    if res+c>0: cnt+=1
print(cnt)

Buggy submission (verdict: Runtime Error):
n,m,c = map(int,input().split())
b = list(map(int,input().split()))
cnt = 0
for i in range(n):
  a = list(map(int,input().split()))
  res=0
  for j in range(m):
    res += a[i]*b[i]
  if res+c>0: cnt+=1
print(cnt)

Buggy submission (verdict: Runtime Error):
n,m,c = map(int,input())
b = list(map(int,input()))
cnt = 0
for i in range(n):
  a = list(map(int,input()))
  res=0
  for j in range(m):
    res += a[i]*b[i]+c
  if res>0: cnt+=1
print(cnt)
Problem p03160 (python)

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

INF = 1 << 40
dp = [INF] * n
dp[0] = 0
dp[1] = abs(h[1] - h[0])
for i in range(1, n - 1):
	dp[i + 1] = min(dp[i-1] + abs(h[i+1] - h[i-1]), dp[i] + abs(h[i+1] - h[i]))

print(dp[-1])

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

def chmin(a, b):
    if a > b: return b
    else: return a

def rec(i):
    if dp[i] < float('inf'): return dp[i]
    
    if i == 0: return 0

    res = float('inf')
    res = chmin(res, rec(i - 1) + abs(h[i] - h[i - 1]))
    if i > 1:
        res = chmin(res, rec(i - 2) + abs(h[i] - h[i - 2]))
    dp[i] = res
    return dp[i]

dp = [float('inf')] * n
print(rec(n - 1))

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

def chmin(a, b):
    if a > b: return b
    else: return a

def rec(i):
    if dp[i] < INF:
        return dp[i]
    
    if i == 0:
        return 0

    res = INF
    res = chmin(res, rec(i - 1) + abs(h[i] - h[i - 1]))
    if i > 1:
        res = chmin(res, rec(i - 2) + abs(h[2] - h[i - 2]))
    dp[i] = res
    return dp[i]

INF = float('inf')
dp = [INF] * n
print(rec(n - 1))
Problem p03193 (python)

Fixed submission:
n, h, w = map(int, input().split())
ans = 0
for i in range(n):
    a, b = map(int, input().split())
    if a >= h and b >= w:
        ans += 1
print(ans)

Buggy submission (verdict: Runtime Error):
n, h, w = map(int, input().split())
ans = 0
for i in range(n):
    a, b = map(int, input().split())
    if a >= h and b >= w:
        ans += 1
print(ans
Problem p03196 (python)

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

def prime_factor(n):
	d = {}
	for i in range(2, int(n ** 0.5) + 1):
		while (n % i == 0):
			d[i] = d.get(i, 0) + 1
			n //= i
	if n != 1:
		d[n] = d.get(n, 0) + 1
	return d

if n == 1:
	print(p)
	exit()

res = 1
fac = prime_factor(p)
for p, c in fac.items():
	res *= p ** (c // n)
print(res)

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

g = 1
res = 1
while g ** n <= p:
	if p % (g ** n) == 0:
		res = g
	g += 1

print(res)
Problem p03211 (python)

Fixed submission:
S = input()
ans = 99999
for i in range(len(S)-2):
    ans = min(ans, abs(int(S[i:i+3])-753))
print(ans)

Buggy submission (verdict: Runtime Error):
S = input()
ans = 99999
for i in range(len(S)-2):
    ans = min(ans, abs(int(S[i:i+3])-753))
print ans

Buggy submission (verdict: Runtime Error):
S = input()
ans = 99999
for i in range(len(S)-2):
    ans = min(ans, abs(int(S[i:i+3]), 753))
print ans

Buggy submission (verdict: Runtime Error):
S = input()
ans = 99999
for i in range(len(S)-2):
    ans = min(ans, abs(S[i:i+3], 753))
print ans

Buggy submission (verdict: Runtime Error):
S = input()
ans = 99999
for i in range(len(S)-2):
  ans = min(ans, abs(S[i:i+3], 753)
            
print ans
Problem p03231 (python)

Fixed submission:
n, m = map(int, input().split())
s = input()
t = input()

def gcd(x, y):
    while y:
        x, y = y, x % y
    return x

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

g = gcd(n, m)
bl = True
for k in range(g):
    i, j = k * n // g, k * m // g
    if s[i] != t[j]: # s[i] != s[j] にしてた...
        bl = False

print(lcm(n, m)) if bl else print('-1')

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

def gcd(x, y):
    while y:
        x, y = y, x % y
    return x

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

g = gcd(n, m)
bl = True
for k in range(g):
    i, j = k * n // g, k * m // g
    if s[i] != s[j]:
        bl = False

print(lcm(n, m)) if bl else print('-1')

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

def gcd(x, y):
    while y:
        x, y = y, x % y
    return x

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

L = lcm(n, m)
target = [0] * L
for i in range(n):
    target[i * L // n] = s[i]
for i in range(m):
    if target[i * L // m] == 0 or target[i * L // m] == t[i]:
        target[i * L // m] = t[i]
    else:
        print('-1')
        exit()

print(L)
Problem p03238 (python)

Fixed submission:
N = input()
if N == "1":
    print("Hello World")
elif N == "2":
    a,b = [int(input()) for i in range(2)]
    print(a+b)

Buggy submission (verdict: Runtime Error):
N = input()
if N == "1":
    print("Hello World")
elif N == "2":
    a,b = map(int, input().split())
    print(a+b)

Buggy submission (verdict: Runtime Error):
N = int(input())
if N == 1:
    print("Hello World")
elif N == 2:
    a,b = map(int, input().split())
    print(a+b)
Problem p03282 (python)

Fixed submission:
s=input()
k=int(input())

cnt=0 #1の個数
i=0
while True:
    if s[i]!='1': break
    else:
        cnt+=1
        i+=1
        if i>len(s)-1: break
        
print(1 if k<=cnt else s[cnt])

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

cnt=0 #1の個数
i=0
while True:
    if s[i]!='1': break
    else:
        cnt+=1
        i+=1
        
print(1 if k<=cnt else s[cnt])

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

ans: int = 1
for i in range(min(K, len(S))):
    if(S[i] != "1"):
        ans = S[i]
        break
print(ans)

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

ans: int = 1
for i in range(min(K, len(S))):
    if(S[i] != "1"):
        ans = S[i]
        break
print(ans)
Problem p03316 (python)

Fixed submission:
def digitsum(n):
    ans = 0
    while n > 0:
        ans += n % 10
        n = n // 10
    return ans

N = int(input())
SumN = digitsum(N)
if N % SumN == 0:
    print("Yes")
else:
    print("No")

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

while n > 0:
    sum += sum % 10
    n //= 10

if tmp % sum == 0:
    print("Yes")
else:
    print("No")

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

while tmp > 0:
    sum += sum % 10
    tmp //= 10

if n % sum == 0:
    print("Yes")
else:
    print("No")

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

sum = 0
tmp = n

while tmp > 0:
    sum += sum % 10
    tmp //= 10

if n % sum == 0:
    print("Yes")
else:
    print("No")

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

sum = 0
tmp = n

while tmp > 0:
    sum += sum % 10
    tmp /= 10

if n % sum == 0:
    print("Yes")
else:
    print("No")
Problem p03325 (python)

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

def cnt_div2(n):
    cnt=0
    while n%2==0:
        n//=2
        cnt+=1
    return cnt

#各要素に対して，2で割ることのできる回数をカウント
lis = [cnt_div2(i) for i in a]
print(sum(lis))

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

cnt=0
for i in range(n):
    if all([i%2!=0 for i in a])==True: #すべての要素が奇数ならbreak
        break
    elif a[i]%2!=0: #奇数なら3倍
        a[i]*=3
    elif a[i]%4==2: #4の剰余が2（e.g.,2,6,10,...）なら3倍
        a[i]*=3
    elif a[i]%4==0: #4の剰余が0なら1/2倍
        a[i]//=2
    cnt+=1
print(cnt)
Problem p03360 (python)

Fixed submission:
a,b,c = map(int, input().split())
k = int(input())
 
lis = [a,b,c]
lis.sort()
maxi = lis[-1]
for i in range(k):
    maxi *= 2
print(lis[0]+lis[1]+maxi)

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

lis = list(a,b,c)
lis.sort()
maxi = lis[-1]
print(lis[0]+lis[1]+k*maxi)
Problem p03361 (python)

Fixed submission:
h,w=map(int,input().split())
s=[list(map(str,list(input()))) for i in range(h)] 

for i in range(1,h-1):
    for j in range(1,w-1):
        if s[i][j]=='#':
            if s[i-1][j]=='.' and s[i][j-1]=='.' and s[i][j+1]=='.' and s[i+1][j]=='.':
                print('No')
                exit()
print('Yes')

Buggy submission (verdict: Runtime Error):
h,w=map(int,input().split())
s=[list(map(int,list(input()))) for i in range(h)] 

for i in range(1,h-1):
    for j in range(1,w-1):
        if s[i][j]=='#':
            if s[i-1][j]=='.' and s[i][j-1]=='.' and s[i][j+1]=='.' and s[i+1][j]=='.':
                print('No')
                exit()
print('Yes')
Problem p03370 (python)

Fixed submission:
n,x = map(int, input().split())
m=[]
for i in range(n): m.append(int(input()))
m.sort()
nokori = x - sum(m)
kosuu  = nokori // m[0]
print(len(m) + kosuu)

Buggy submission (verdict: Runtime Error):
n,x = map(int, input().split())
m=[]
for i in range(n): m.append(int(input()))
m.sort()
nokori = x - sum(m)
kosuu  = nokoro // m[0]
print(len(m) + kosuu)
Problem p03386 (python)

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

lis=[]
for i in range(a, min(a+k,b+1)):
    lis.append(i)
for i in range(max(a,b-k+1), b+1):
    lis.append(i)


lis=list(set(lis)) #重複除去
lis.sort()
for i in lis:
    print(i)

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

lis=[]
for i in range(a, min(a+k,b+1)):
    lis.append(i)
for i in range(max(a,b-k+1), b+1):
    lis.append(i)


lis=list(set(l)) #重複除去
lis.sort()
for i in lis:
    print(i)
Problem p03457 (python)

Fixed submission:
n=int(input())
t=[0]*(n+1)
x=[0]*(n+1)
y=[0]*(n+1)

for i in range(n):
    t[i+1],x[i+1],y[i+1] = map(int,input().split())

    
for i in range(n):
    dist = abs(x[i+1]-x[i]) + abs(y[i+1]-y[i])
    diff = t[i+1]-t[i]
    if dist>diff or dist%2!=diff%2:
        print('No')
        exit()
print('Yes')

Buggy submission (verdict: Runtime Error):
n=int(input())
t=[0]*n
x=[0]*n
y=[0]*n
for i in range(n):
    t[i],x[i],y[i] = map(int,input().split())

if len(t)>1:
    for i in range(n-1):
        dist = abs(x[i+1]-x[i]) + abs(y[i+1]-y[i])
        diff = t[i+1]-t[i]
        if dist>diff or dist%2!=diff%2:
            print('No')
            exit()
    print('Yes')
else:
    dist = abs(x[0]-0) + abs(y[0]-0)
    if t[0] < dist or t[0]%2!=diff%2:
        print('No')
    else:
        print('Yes')
Problem p03494 (python)

Fixed submission:
N = input()
A = list(map(int, input().split()))
count = 0
while all(a%2==0 for a in A):
    A = [a/2 for a in A]
    count += 1
print(count)

Buggy submission (verdict: Runtime Error):
N = input()
A = list(map(int, input().split()))
count = 0
while all(a%2==0 for a in A):
    A = [a/2 for a in A]
    count += 1
print(cnt)
Problem p03495 (python)

Fixed submission:
import collections
n,k=map(int,input().split())
a=list(map(int,input().split()))

c=collections.Counter(a)
num_kind=len(set(a)) #種類の数
diff = num_kind-k #変更すべき数
values, counts = zip(*c.most_common()[::-1]) #少ない順
print(sum(counts[:diff]))

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

c=collections.Counter(a)
num_kind=len(set(a)) #種類の数
diff = num_kind-k #変更すべき数
values, counts = zip(*c.most_common()[::-1]) #少ない順
print(sum(counts[:diff]))
Problem p03546 (python)

Fixed submission:
H, W = map(int, input().split())
c = [list(map(int, input().split())) for _ in range(10)]
A = [list(map(int, input().split())) for _ in range(H)] 

INF = 10 ** 6
for k in range(10):
    for i in range(10):
        for j in range(10):
            c[i][j] = min(c[i][j], c[i][k] + c[k][j])

res = 0
for arr in A:
    for a in arr:
        if a == -1:
            continue
        else:
            res += c[a][1]

print(res)

Buggy submission (verdict: Runtime Error):
H, W = map(int, input().split())
c = [list(map(int, input().split())) for _ in range(10)]
A = [list(map(int, input().split())) for _ in range(H)] 

# 0,(1),2,3,...,9に対して1にするための最小コストを求める
INF = 10 ** 4
d = c.copy()
for k in range(10):
    for i in range(10):
        for j in range(10):
            d[i][j] = min(d[i][j], d[i][k] + d[k][j])


res = 0
for arr in A:
    for a in arr:
        if a == 1 or a == -1:
            continue
        else:
            res += d[a][1]

print(res)
Problem p03547 (python)

Fixed submission:
x, y = map(str, input().split())
x = int(x, 16)
y = int(y, 16)
if x==y: print('=')
elif x>y: print('>')
else: print('<')

Buggy submission (verdict: Runtime Error):
x, y = map(str, input())
x = int(x, 16)
y = int(y, 16)
if x==y: print('=')
elif x>y: print('>')
else: print('<')
Problem p03563 (python)

Fixed submission:
r=int(input())
g=int(input())
print(2*g-r)

Buggy submission (verdict: Runtime Error):
r, g = map(int, input().split())
print(2*g-r)

Buggy submission (verdict: Runtime Error):
r, g = map(int, input().split())
print(2*g-r)
Problem p03625 (python)

Fixed submission:
n=int(input())
a=list(map(int,input().split()))
a.sort(reverse=True)

tmp1=a[0]
for i in range(n-1):
    l,s= 0,0
    if tmp1 == a[i+1]:
        idx = i+1
        l = tmp1 #lを確定させる
        #break
        tmp2=a[idx+1]
        for j in range(idx+1,n-1):
            if tmp2==a[j+1]:
                s = tmp2
                print(l*s)
                exit()
            else:
                tmp2 = a[j+1]
    else:
        idx=i
        tmp1=a[i+1]
        
print(0)

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

tmp=a[0]
for i in range(n-1):
    l= 0
    if tmp == a[i+1]:
        idx = i+1
        l = tmp #lを確定させる
        break
    else:
        idx=i
        tmp=a[i+1]
        

tmp2=a[idx+1]
for j in range(idx+1,n-1):
    s=0
    if tmp2==a[j+1]:
        s = tmp2
        break
    else:
        tmp2=a[j+1]
        
print(l*s)

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

b = list(set(a))
b.sort(reverse=True)

for i in range(len(b)):
    if a.count(b[i])==4:
        print(b[i]**2)
        exit()
    elif a.count(b[i])==3 or a.count(b[i])==2:
        while True:
            j=i+1
            if j<n and a.count(b[j])>=2:
                print(b[i]*b[j])
                break
                exit()
            else:
                j+=1
print(0)

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

b = list(set(a))
b.sort(reverse=True)

for i in range(len(b)):
    if a.count(b[i])==4:
        print(b[i]**2)
    elif a.count(b[i])==3 or a.count(b[i])==2:
        while True:
            j=i+1
            if j<n and a.count(b[j])>=2:
                print(b[i]*b[j])
                break
                exit()
            else:
                j+=1
print(0)
Problem p03633 (python)

Fixed submission:
n=int(input())
t=[int(input()) for _ in range(n)]

import fractions
if n==1: print(t[0])
else:
    a,b=t[0],t[1]
    res=a*b//fractions.gcd(a,b)
    for i in range(2,n):
        tmp=t[i]
        res = res*tmp//fractions.gcd(res,tmp)
    print(res)

Buggy submission (verdict: Runtime Error):
n=int(input())
t=[int(input()) for _ in range(n)]

import fractions
a,b=t[0],t[1]
res=a*b//fractions.gcd(a,b)
for i in range(2,n):
    tmp=t[i]
    res = res*tmp//fractions.gcd(res,tmp)
print(res)

Buggy submission (verdict: Runtime Error):
n=int(input())
t=[int(input()) for _ in range(n)]

import fractions
a,b=t[0],t[1]
res=a*b//fractions.gcd(a,b)
for i in range(2,n-1):
    a,b=t[i],t[i+1]
    res = a*b//fractions.gcd(a,b)
print(res)
Problem p03651 (python)

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

# 最大公約数
def gcd(a, b):
	while b:
		a, b = b, a % b
	return a

MAX = max(A)
GCD = 0
for i in range(n):
	GCD = gcd(GCD, A[i])

if k % GCD == 0 and k <= MAX:
	print('POSSIBLE')
else:
	print('IMPOSSIBLE')

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

# 最大公約数
def gcd(a, b):
	while b:
		a, b = b, a % b
	return a

MAX = max(A)
GCD = gcd(A[0], A[1])
for i in range(2, n):
	GCD = gcd(GCD, A[i])

if k % GCD == 0 and k <= MAX:
	print('POSSIBLE')
else:
	print('IMPOSSIBLE')
Problem p03760 (python)

Fixed submission:
o = input()
e = input()
lis = []
for i in range(min(len(o),len(e))):
    lis.append(o[i])
    lis.append(e[i])
if len(o)>len(e):
    lis.append(o[-1])

print(''.join(lis))

Buggy submission (verdict: Runtime Error):
o = input()
e = input()
lis = []
for i in range(min(len(o),len(e)):
    lis.append(o[i])
    lis.append(e[i])
if len(o)>len(e):
    lis.append(o[-1])
elif len(o)==len(e):
    lis.append(o[-1])
    lis.append(e[-1])

print(''.join(lis))

Buggy submission (verdict: Runtime Error):
o = input()
e = input()
lis = []
for i in range(len(o)):
  lis.append(o[i])
  lis.append(e[i])
print(''.join(lis))
Problem p03761 (python)

Fixed submission:
from collections import Counter
n=int(input())
s=Counter(input())
for i in range(n-1):
    s&=Counter(input())
print(''.join(sorted(s.elements())))

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

n=int(input())
s=[Counter(input()) for _ in range(n)]

c = counter[0]
#各アルファベット(a,b,c,...,z)に対して，使用回数の最小値を求める
c = s[0]
for i in range(1,n):
    for k,v in c.items():
        c[k] = min(s[i][k], c[k])
        
c = sorted(c.items())
ans = ''
for k,v in c:
    ans += k*v
print(ans)

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

def intersect_list(lst1, lst2):
    arr = []
    lst = lst1.copy()
    for element in lst2:
        try:
            lst.remove(element)
        except ValueError:
            pass
        else:
            arr.append(element)
    return arr
  
res = list(input()) 
for _ in range(n-1):
    s = list(input())
    res = intersect_list(res,s)
res.sort()
ans = ''.join(res)
print(ans)

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

def intersect_list(lst1, lst2):
    arr = []
    lst = lst1.copy()
    for element in lst2:
        try:
            lst.remove(element)
        except ValueError:
            pass
        else:
            arr.append(element)
    return arr


res = list(input())
for _ in range(n-1):
    s = list(input())
    res = intersect_list(res,s)
res.sort()
ans = ''.join(res)
print(*ans, sep='')