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

Fixed submission:
#D in [S_i-X_i,T_i-X_i) → Xiで止まる
import sys
input = sys.stdin.readline
from heapq import heappop,heappush
from collections import defaultdict

N,Q = map(int,input().split())
task = []

STX = [[int(x) for x in input().split()] for _ in range(N)]
for s,t,x in STX:
  task.append((t-x,0,x)) # xで止まらなくなる
  task.append((s-x,1,x)) # xで止まる

for i in range(Q):
  d = int(input())
  task.append((d,2,i)) # 止まる位置を答える
answer = [-1]*Q

task.sort()

# 引っかかってる場所の管理
se = set()
se_hp = [] # heapで最小値を先頭に保つ

# 小さい時刻から順に見ていく
for a,b,c in task:
  if not b: # b == 0
    se.remove(c)
  elif b&1: # b == 1
    se.add(c)
    heappush(se_hp,c)
  else: # b == 2
    while se_hp and se_hp[0] not in se:
      heappop(se_hp)
    answer[c] = se_hp[0] if se_hp else -1

print('\n'.join(map(str,answer)))

Buggy submission (verdict: Runtime Error):
import sys
#import numpy as np
import bisect
sys.setrecursionlimit(10 ** 7)

# TLE
# PyPy3 (2.4.0) 2112 ms

N, Q = map(int, input().split())
STX = []
for _ in range(N):
    s, t, x = map(int, input().split())
    STX.append((s, t, x))

PEOPLE = []
for _ in range(Q):
    d = int(input())
    PEOPLE.append(d)

ans = [-1] * Q

STX.sort(key=lambda x: x[2])

for s, t, x in STX:
    if len(PEOPLE) == 0:
        break

    i = bisect.bisect_left(PEOPLE, s - x)
    j = bisect.bisect_left(PEOPLE, t - x)

    if i == j:
        continue

    use = [PEOPLE[x] for x in range(i, j)]

    for k in use:
        if ans[k] == -1:
            ans[k] = x

    del PEOPLE[i:j]


print("\n".join(map(str, ans)))
Problem p03127 (python)

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

A.sort()
stack = A[1:]
m = A[0]

while stack:
  stack = list(stack)
  l = []
  for x in stack:
    if x % m == 0:
      continue
    l.append(x % m)
  
  if not l:
    break
  l.append(m)
  m = min(l)
  stack = set(l)

print(m)

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

A.sort()
stack = A[1:]
m = A[0]

while stack:
  stack = list(stack)
  l = []
  for x in stack:
    if x % m == 0:
      continue
    l.append(x % m)
  
  m = min(l)
  stack = set(l)

print(m)
Problem p03137 (python)

Fixed submission:
N,M = map(int,input().split())
X = list(map(int,input().split()))
X.sort()

D = [abs(X[i] - X[i+1]) for i in range(M-1)]
D.sort(reverse=True)

print(sum(D[N-1:]))

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

D = [abs(X[i] - X[i+1]) for i in range(N-1)]
D.sort(reverse=True)

print(sum(D[M+1:]))
Problem p03723 (python)

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

if not (A % 2 == 0 and B % 2 == 0 and C % 2 == 0):
  print(0)
  exit()

if A == B and B == C:
  print(-1)
  exit()
  
while A % 2 == 0 and B % 2 == 0 and C % 2 == 0:
  A,B,C = (B+C)//2,(C+A)//2,(A+B)//2
  ans += 1
  
  if A == B and B == C:
    print(-1)
    exit()
    
print(ans)

Buggy submission (verdict: Runtime Error):
A,B,C = map(int,input().split())
ans = None

if A == B and B == C:
  print(-1)
  exit()
  
while A % 2 == 0 and B % 2 == 0 and C % 2 == 0:
  A,B,C = (B+C)//2,(C+A)//2,(A+B)//2
  ans += 1
  
  if A == B and B == C:
    print(-1)
    exit()
    
print(ans)

Buggy submission (verdict: Runtime Error):
A,B,C = int(input())
ans = None

if A == B and B == C:
  print(-1)
  exit()
  
while A % 2 == 0 and B % 2 == 0 and C % 2 == 0:
  A,B,C = (B+C)//2,(C+A)//2,(A+B)//2
  ans += 1
  
  if A == B and B == C:
    print(-1)
    exit()
    
print(ans)
Problem p02777 (python)

Fixed submission:
s, t = input().split(' ')
a, b = map(int, input().split(' '))
u = input()

d = {}
d[s] = a
d[t] = b
d[u] -= 1

print(d[s], d[t])

Buggy submission (verdict: Runtime Error):
s, t = input().split(' ')
a, b = map(int, input().split(' '))
u = input()

d = {
    'red': a,
    'blue': b
}

d[u] -= 1

print(d['red'], d['blue'])
Problem p03075 (python)

Fixed submission:
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
k = int(input())
 
if (max(a,b,c,d,e) - min(a,b,c,d,e) <= k):
	print('Yay!')
else:
	print(':(')

Buggy submission (verdict: Runtime Error):
a = input()
b = input()
c = input()
d = input()
e = input()
k = input()

if (max(a,b,c,d,e) - min(a,b,c,d,e,f) <= 15):
	print('Yay!')
else:
	print(':(')
Problem p02987 (python)

Fixed submission:
#coding:utf-8

S = list(input())

S.sort()

if S[0] == S[1] and S[2] == S[3]:
    if S[0] == S[1] == S[2] == S[3]:
        print('No')
    else:
        print('Yes')
else:
    print('No')

Buggy submission (verdict: Runtime Error):
#coding:utf-8
from math import factorial

N, K = map(int, input().split())
# subli = []


def P(n,r):
    return factorial(n) // factorial(n-r)

def C(n,r):
    return P(n,r) // factorial(r)


for i in range(1, K+1):
    '''
    n = N - K + i
    ans = math.factorial(n) // (math.factorial(N-K) * math.factorial(i))
    '''
    ans = C(N-K+1, i) * C(K-1, i-1)
    print(ans % (10**9 + 7))
Problem p02912 (python)

Fixed submission:
import math
import copy
from queue import Queue
import heapq

#n = int(input())
n, m = [int(i) for i in input().split()]
#table = [[int(i) for i in input().split()] for j in range(n)]
#table = [list(input()) for n in range(h)]
s = [int(i) for i in input().split()]
#s = [int(i) for i in range(n)]
#s = [int(input()) for i in range(n)]
#s = input()
#list = list(s)
# dp = [[0 for _ in range(2)] for _ in range(13)]

#a = [[0 for _ in range(n+1)] for _ in range(n+1)]
#b = [[0 for _ in range(n+1)] for _ in range(n+1)]

s = list(map(lambda x: x*(-1), s))
heapq.heapify(s)

for i in range(m) :
    heapq.heappush(s, math.ceil(heapq.heappop(s)/2))

print(sum(s)*(-1))

Buggy submission (verdict: Runtime Error):
import math
import copy
from queue import Queue

#n = int(input())
n, m = [int(i) for i in input().split()]
#table = [[int(i) for i in input().split()] for j in range(n)]
#table = [list(input()) for n in range(h)]
s = [int(i) for i in input().split()]
#s = [int(i) for i in range(n)]
#s = [int(input()) for i in range(n)]
#s = input()
#list = list(s)
# dp = [[0 for _ in range(2)] for _ in range(13)]

#a = [[0 for _ in range(n+1)] for _ in range(n+1)]
#b = [[0 for _ in range(n+1)] for _ in range(n+1)]

for i in range(m) :
    s[s.index(max(s))] = math.floor(max(s)/2)

print(sum(s))
Problem p03011 (python)

Fixed submission:
import math

a, b, c= [int(i) for i in input().split()]
#table = [[int(i) for i in input().split()] for n in range(n)]
#light = [int(i) for i in input().split()]
#s = input()
#list = list(s)

#print(n, m)
#print(table)
#print(light)

kotae = 0

kotae = a + b + c - max(a, b, c)

print(kotae)

Buggy submission (verdict: Runtime Error):
import math
 
#n = int(input())
n, m = [int(i) for i in input().split()]
#table = [[int(i) for i in input().split()] for n in range(n)]
#list = [int(i) for i in input().split()]
#s = input()
#list = list(s)
 
s = [int(input()) for i in range(m)] #m行1列入力
 
MOD = 1000000007
 
 
def fib(n):
    a = 0
    b = 1
    temp = 0
    if (n == 0) :
        return 0
    elif (n == 1) :
        return 1
    else:
        for i in range(n-1) :
            temp = b
            b = (a + b) % MOD
            a = temp
        return b
 
kotae = 1
 
if (m == 0) :
    kotae = (kotae * fib(n)) % MOD
else :
    for i in range(m + 1) :
        if (i == 0) :
            kotae = (kotae * fib(s[i])) % MOD
        elif (i == m) :
            kotae = (kotae * fib(n - s[i-1])) % MOD
        else :
            kotae = (kotae * fib(s[i] - s[i-1] - 1)) % MOD
 
 
print(kotae)
Problem p03017 (python)

Fixed submission:
import math

n, a, b, c, d = [int(i) for i in input().split()]
#table = [[int(i) for i in input().split()] for m in range(m)]
#light = [int(i) for i in input().split()]
s = input()
list = list(s)

#print(n, m)
#print(table)
#print(light)

flag = 1



#A-C B-Dまでの間に岩が2個並んでいたらアウト

for i in range(a-1, c-1) :
    if ( list[i] == '#') :
        if ( list[i+1] == "#") :
            flag = 0

for i in range(b-1, d-1) :
    if ( list[i] == "#") :
        if ( list[i+1] == "#") :
            flag = 0

# D < C　のとき、B-Dまでの間に、3個以上空白がなければアウト

if (d < c) :
    flag = 0
    for i in range(b-2, d-1) :
        if (list[i] == '.' and list[i+1] == '.' and list[i+2] == '.') :
            flag = 1

if (flag == 1) :
    print("Yes")
else :
    print("No")

Buggy submission (verdict: Runtime Error):
import math

n, a, b, c, d = [int(i) for i in input().split()]
#table = [[int(i) for i in input().split()] for m in range(m)]
#light = [int(i) for i in input().split()]
s = input()
list = list(s)

#print(n, m)
#print(table)
#print(light)

flag = 1



#A-C B-Dまでの間に岩が2個並んでいたらアウト

for i in range(a-1, c-1) :
    if ( list[i] == '#') :
        if ( list[i+1] == "#") :
            flag = 0

for i in range(b-1, d-1) :
    if ( list[i] == "#") :
        if ( list[i+1] == "#") :
            flag = 0

# D < C　のとき、A-Cまでの間に、3個以上空白がなければアウト

if (d < c) :
    flag = 0
    for i in range(a-1, d) :
        if (list[i] == '.' and list[i+1] == '.' and list[i+2] == '.') :
            flag = 1

if (flag == 1) :
    print("Yes")
else :
    print("No")
Problem p02831 (python)

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

Buggy submission (verdict: Runtime Error):
import math
a,b=map(int,input().split())
print(int(a*b/math.gcd(a,b)))
Problem p03042 (python)

Fixed submission:
sstr=list(input())
# s=[int(n) for n in sstr]
# print(sstr)
sf=[sstr[0],sstr[1]]
sb=[sstr[2],sstr[3]]
if sf[0]=="0":
  sf.pop(0)
if sb[0]=="0":
  sb.pop(0)
fws="".join(sf)
bks="".join(sb)
fwb=[int(n) for n in fws]
bkb=[int(n) for n in bks]
# print(fwb)
# print(bkb)
if len(fwb)==2:
    fw=(fwb[0]*10)+(fwb[1])
else:
    fw=fwb[0]
if len(bkb)==2:
    bk=(bkb[0]*10)+(bkb[1])
else:
    bk=bkb[0]
# print(fw)
# print(bk)
if 1<=fw<=12:
  if 1<=bk<=12:
    print("AMBIGUOUS")
  else:
    print("MMYY")
else:
  if 1<=bk<=12:
    print("YYMM")
  else:
    print("NA")
"""
sstr=list(input())
s=[int(n) for n in sstr]
if s[0]>=2: #前2桁の十の位が2より大きければ前は年
    if s[2]>=2: #後2桁の十の位が2以上ならば該当なし
        print("NA")
    elif s[2]==1: #後2桁の十の位が1なら一の位は0-2
        if s[3]>=3: #後2桁の一の位が3以上ならNA
            print("NA")
        else: #後2桁の一の位が0-2ならYYMM
            print("YYMM")
    else: #後2桁の十の位が0ならYYMMかNA
        if s[3]==0: #後2桁の一の位が0ならNA
            print("NA")
        else: #後2桁の一の位が0でなければYYMM
            print("YYMM")

elif s[0]==1: #前2桁の十の位が1なら場合分け
    if s[1]>=3: #前2桁の一の位が3以上ならYYMMかNA
        if s[2]>=2: #後2桁の十の位が2以上ならNA
            print("NA")
        elif s[2]==1: #後2桁の十の位が1なら一の位は0-2
            if s[3]>=3: #後2桁の一の位が3以上ならNA
                print("NA")
            else: #後2桁の一の位が2以下ならYYMM
                print("YYMM")
        else: #後2桁の十の位が0ならYYMMかNA
            if s[3]==0:
                print("NA")
            else:
                print("YYMM")
    else: #前2桁の一の位が0-2ならMMYYかAMBIGUOUS
        if s[2]>=2: #後2桁の十の位が2以上ならMMYY
            print("MMYY")
        elif s[2]==1: #後2桁の十の位が1なら場合分け
            if s[3]>=3: #後2桁の一の位が3以上ならMMYY
                print("MMYY")
            else: #後2桁の一の位が2以下ならAMBIGUOUS
                print("AMBIGUOUS")
        else: #後2桁の十の位が0ならAMBIGUOUS
            print("AMBIGUOUS")

else: #前2桁の十の位が0ならMMYYかAMBIGIOUS
    if s[2]>=2: #後2桁の十の位が2以上ならMMYY
        if s[1]==0:
            print("NA")
        else:
            print("MMYY")
    elif s[2]==1: #後2桁の十の位が1なら場合分け
        if s[3]<=2: #後2桁の一の位が0-2ならAMBIGUOUS
            print("AMBIGUOUS")
        else: #後2桁の一の位が3以上ならMMYY
            print("MMYY")
    else: #後2桁の十の位が0ならAMBIGUOUSかNA
        if s[3]==0: #後2桁の一の位が0なら0x00のxを調査
            if s[1]==0:
                print("NA")
            else:
                print("MMYY")
        else:
            print("AMBIGUOUS")
            """

Buggy submission (verdict: Runtime Error):
sstr=list(input())
s=[int(n) for n in sstr]
sf=[s[0],s[1]]
sb=[s[2],s[3]]
if sf[0]==0:
  sf.pop(0)
if sb[0]==0:
  sb.pop(0)
fw="".join(sf)
bk="".join(sb)
if 1<=fw<=12:
  if 1<=bk<=12:
    print("AMBIGUOUS")
  else:
    print("MMYY")
else:
  if 1<=bk<=12:
    print("YYMM")
  else:
    print("NA")

Buggy submission (verdict: Runtime Error):
sstr=list(input())
s=[int(n) for n in sstr]
sf=[s[0],s[1]]
sb=[s[2],s[3]]
fw="".join(sf)
bk="".join(sb)
if fw[0]==0:
  fw.pop(0)
if bk[0]==0:
  bk.pop(0)
if 1<=fw<=12:
  if 1<=bk<=12:
    print("AMBIGUOUS")
  else:
    print("MMYY")
else:
  if 1<=bk<=12:
    print("YYMM")
  else:
    print("NA")
Problem p03075 (python)

Fixed submission:
a=int(input())
b=int(input())
c=int(input())
d=int(input())
e=int(input())
k=int(input())
if (b-a)<=k and (c-a)<=k and (d-a)<=k and (e-a)<=k and (c-b)<=k and (d-b)<=k and (e-b)<=k and (d-c)<=k and (e-c)<=k and (e-d)<=k:
    print("Yay!")
else:
    print(":(")

Buggy submission (verdict: Runtime Error):
a=int(input())
b=int(input())
c=int(input())
d=int(input())
e=int(input())
k=int(input())
if abs(a-b)<k and abs(a-c)<k and abs(a-d)<k and abs(a-e)<k and abs(b-c)<k and abs(b-d)<k and abs(b-e)<k and abs(c-d)<k and abs(c-e)<k and abs(d-e)<k:
  print("Yay!")
else
  print(":(")
Problem p03135 (python)

Fixed submission:
t,x=map(int,input().split())
print(str(t/x))

Buggy submission (verdict: Runtime Error):
t, x = map(int,input(),split())
print(t/x)
Problem p03242 (python)

Fixed submission:
n=input()
d={"9":"1","1":"9"}
print("".join(d[x] for x in n))

Buggy submission (verdict: Runtime Error):
n=input()
d=["9":"1","1":"9"]
"".join(d[x] for x in n)

Buggy submission (verdict: Runtime Error):
n=input()
d={"9":"1","1":"9"}
"".join(d[x] for in n)
Problem p02597 (python)

Fixed submission:
n = int(input())
s = input()
number_of_W_in_prefix = [0]
number_of_R_in_suffix = [0]
for i in range(n):
    number_of_W_in_prefix.append(number_of_W_in_prefix[i] + (s[i] == 'W'))
    number_of_R_in_suffix.append(number_of_R_in_suffix[i] + (s[n - i - 1] == 'R'))
result = n
for k in range(n + 1):
    result = min(result, max(number_of_W_in_prefix[k], number_of_R_in_suffix[n - k]))
print(result)

Buggy submission (verdict: Runtime Error):
n, k = map(int, input().split())
a = list(map(int, input().split()))
result = max(a)
left = 1
right = result
med = left + (right - left) // 2
while left <= right:
    counter = sum([(x - 1) // med for x in a])
    if counter <= k:
        result = med
        right = med - 1
    else:
        left = med + 1
    med = left + (right - left) // 2
print(result)
Problem p02623 (python)

Fixed submission:
n,m,k=map(int,input().split())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
#print(a)
asum=[0]
bsum=[0]
cnt=0
for i in range(n):
    cnt+=a[i]
    asum.append(cnt)
#    if cnt>k:
#        amx=i
#        break
#    amx=i
#print("amx=",amx)

cnt=0
for i in range(m):
    cnt+=b[i]
    bsum.append(cnt)
#    if cnt>k:
#        bmx=i
#        break
#    bmx=i
#print("bmx=",bmx)

ans=0
j=m
for i in range(n+1):
    c=k-asum[i]
#    print("i=",i)
#    print("c=",c)
    if c<0:
        continue
    while c<bsum[j] and j>0:
        j-=1
    ans=max(ans,i+j)
#    print("ans=",ans)
print(ans)

Buggy submission (verdict: Runtime Error):
n,m,k=map(int,input().split())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
#print(a)
asum=[]
bsum=[]
cnt=0
for i in range(n):
    cnt+=a[i]
    asum.append(cnt)
    if cnt>k:
        amx=i
        break
    amx=i
#print("amx=",amx)

cnt=0
for i in range(m):
    cnt+=b[i]
    bsum.append(cnt)
    if cnt>k:
        bmx=i
        break
    bmx=i
#print("bmx=",bmx)

ans=0
for i in range(amx+1):
    c=k-asum[i]
#    print("i=",i)
#    print("c=",c)
    if c<0:
        continue
    elif i==0:
#        for j in range(bmx,0,-1):
        for j in reversed(range(0,bmx+1)):
#            print(j)
#            print(bsum[j])
            if c>=bsum[j]:
                tmp=i+j+2
                l=j
#                print("l=",l)
                break
    else:
        while(c<bsum[l]):
            l-=1
        tmp=i+l+2
    ans=max(ans,tmp)
#    print("ans=",ans)
print(ans)
Problem p02659 (python)

Fixed submission:
from decimal import *
import sys
sys.setrecursionlimit(10**6)

a,b=input().split()

ans=int(Decimal(a)*Decimal(b))

print(ans)

Buggy submission (verdict: Runtime Error):
import sys
sys.setrecursionlimit(10**6)

a,b=input().split()

#print(a)
#print(b)
ans=int(a)*int(b*100)
ans=ans//100

print(ans)
Problem p02829 (python)

Fixed submission:
list=["1","2","3"]

A=input()
B=input()

list.remove(A)
list.remove(B)

print(list[0])

Buggy submission (verdict: Runtime Error):
list=[1,2,3]

A=input()
B=input()

C=list.remove(A).remove(B)

print(C[0])
Problem p02693 (python)

Fixed submission:
k = int(input())
[a,b] = [int(i) for i in input().split()]
f = 0
for i in range(a,b+1):
  if i % k == 0:
    f = 1
if f:
  print("OK")
else:
  print("NG")

Buggy submission (verdict: Runtime Error):
k = int(input())
[a,b] = [int(i) for i in input().split()]
f = 0
for i in range(a,b+1):
	if i % k == 0:
    	f = 1
if f:
	print("OK")
else:
	print("NG")
Problem p02779 (python)

Fixed submission:
n = int(input())
a = [int(i) for i in input().split()]
dic = {}
for i in range(n):
	try:
		dic[a[i]] += 1
	except:
		dic[a[i]] = 1
if max(dic.values()) > 1:
	print("NO")
else:
  	print("YES")

Buggy submission (verdict: Runtime Error):
n = int(input())
a = [int(i) for i in input().split()]
dic = {}
for i in range(n):
	try:
		dic[a[i]] += 1
	except:
		dic[a[i]] = 1
if max(dic.values) > 1:
	print("Yes")
else:
  	print("No")

Buggy submission (verdict: Runtime Error):
[n,k] = [int(i) for i in input().split()]
p = [(int(i)+1)/2 for i in input().split()]

a = []
#print(a)
ans = -1
ruiseki = []
for i in range(n-k+1):
    ruiseki.append(sum(p[i:i+k]))
print(max(ruiseki))

Buggy submission (verdict: Runtime Error):
n = int(input())
a = [int(i) for i in input().split()]
flag = 1
ls = [0] * (max(a)+1)
#print(ls)
for i in range(n):
    if ls[a[i]] == 1:
        flag = 0
        print("NO")
        break
    else:
        ls[a[i]] = 1
if flag:
    print("YES")
#print(ls)

Buggy submission (verdict: Runtime Error):
n = int(input())
a = [int(i) for i in input().split()]
dic = {}
flag = 1
ls = [0] * (max(a)+1)
for i in range(n):
    if ls[a[i]] == 1:
        flag = 0
        print("NO")
        break
    else:
        ls[a[i]] = 1

if flag:
    print("YES")
Problem p03013 (python)

Fixed submission:
[n,m] = [int(i) for i in input().split()]
a = []
for i in range(m):
    a.append(int(input()))
ok = [0] * (n+1)
for i in range(m):
    ok[a[i]] = 1
dp = [0] * (n+1)
dp[0] = 1
if n > 1:
    for i in range(1,n+1):
        if ok[i] != 1:
            if i == 1:
                dp[i] = 1
            else:
                dp[i] = (dp[i-2]+dp[i-1])%(10**9+7)
        else:
            dp[i] = 0
    print((dp[n])%(10 ** 9 + 7))
else:
    if 1 in a:
        print(0)
    else:
        print(1)

Buggy submission (verdict: Runtime Error):
[n,m] = [int(i) for i in input().split()]
ls = []
tmp1 = -1
tmp2 = 0
checker = 0
ans = []
for i in range(m):
    tmp2 = int(input())
    ls.append(tmp2)
    if tmp2 - tmp1 == 1:
        checker = 1
        print(0)
        break
    tmp1 = tmp2
#i番目までの道の数
if n == 1:
    if 1 in ls:
        print(0)
    else:
        print(1)
else:
    for i in range(1,n+1):
        if i == 1:
            #1段目が使える時
            if 1 not in ls:
                ans.append(1)
            else:
                ans.append(0)
        elif i == 2:
            #2段目が使える時
            if 1 not in ls and 2 not in ls:
                ans.append(2)
            else:
                ans.append(1)
        else:
            if i in ls:
                ans.append(0)
            else:
                ans.append((ans[i-3]+ans[i-2])%(10**9+7))
if checker == 0:
    print(ans[n-1])
Problem p03127 (python)

Fixed submission:
import fractions
 
def gcd_1(a):
    p = fractions.gcd(a[0],a[1])
    if len(a) > 2:
        for i in range(2,len(a)):
            p = gcd_1([p,a[i]])
    else:
        p = fractions.gcd(a[0],a[1])
 
    return p
 
n = int(input())
a = [int(i) for i in input().split()]
 
print(gcd_1(a))

Buggy submission (verdict: Runtime Error):
import fraction

def gcd_1(a):
    p = fraction.gcd(a[0],a[1])
    if len(a) > 2:
        for i in range(2,len(a)):
            p = gcd_1([p,a[i]])
    else:
        p = fraction.gcd(a[0],a[1])

    return p

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

print(gcd_1(a))

Buggy submission (verdict: Runtime Error):
import fraction
from functools import reduce

def gcd(*numbers):
    return reduce(math.gcd, numbers)

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

print(gcd(*a))
Problem p03804 (python)

Fixed submission:
[n,m] = [int(i) for i in input().split()]
a = []
b = []
for i in range(n):
    a.append(input())
for i in range(m):
    b.append(input())
cnt = 0
flag = "No"
for i in range(n - m + 1):
    for j in range(n - m + 1):
        for k in range(m):
            for l in range(m):
                if a[i+k][j+l] == b[k][l]:
                    cnt += 1

        if cnt == m ** 2:
            flag = "Yes"
        else:
            cnt = 0
print(flag)

Buggy submission (verdict: Runtime Error):
[n,m] = [int(i) for i in input().split()]
a = []
b = []
for i in range(n):
  a.append(input())
for i in range(m):
  b.append(input())
cnt = 0
flag = "No"
for i in range(n - m + 1):
  for j in range(n - m + 1):
    for k in range(m):
      for l in range(m):
	    if a[i+k][j+l] == b[k][l]:
          cnt += 1
    if cnt == m ** 2:
      flag = "Yes"
    else:
      cnt = 0
print(flag)

Buggy submission (verdict: Runtime Error):
[n,m] = [int(i) for i in input().split()]
a = []
b = []
for i in range(n):
  a.append(input())
for i in range(m):
  b.append(input())
cnt = 0
flag = "No"
for i in range(n - m + 1):
  for j in range(n - m + 1):
    for k in range(m):
      for l in range(m):
	    if a[i+k][j+l] == b[k][l]:
          cnt += 1
    if cnt == m ** 2:
      flag = "Yes"
    else:
      cnt = 0
print(flag)

Buggy submission (verdict: Runtime Error):
[n,m] = [int(i) for i in input().split()]
a = []
n = []
for i in range(n):
  a.append(input())
for i in range(m):
  b.append(input())

#0,0からm,mまでの全てについて、合致するかどうかを全てのパターンでみる
#2*2だとして、3*3なら4個、4*4なら9個
#→差+1個あると考えて良さそう
ok = 1
for i in range(m):
  for j in range(m):
    for k in range(n - m):
      for l in range(n - m):
        if a[i+k][j+l] != b[i][j]:
          ok = 0

if ok == 0:
  print("No")
else:
  print("Yes")

Buggy submission (verdict: Runtime Error):
[n,m]=[int(i) for i in input().split()]
a=[]
b=""
c=[]
d=""
e=1
#a箱,c箱にそれぞれの画像を用意
for i in range(n):
    b=b+str(input().split())
a.append(b)
for i in range(m):
    d=d+str(input().split())
c.append(d)
print(c)
print(d)
#照合
for i in range(n):
    for j in range(m):
        f=c[j].find(a[i])
        if f!=-1:
            for k in range(m):
                e=e*(a[f:f+m]!=c[f:f+m])
if e==0:
    print("Yes")
else:
    print("No")
Problem p04005 (python)

Fixed submission:
[a,b,c] = [int(i) for i in input().split()]

if (a * b * c) % 2 == 0:
    print(0)
else:
    print(min(a * b,b * c,c * a))

Buggy submission (verdict: Runtime Error):
[a,b,c] == [int(i) for i in input().split()]

if (a * b * c) % 2 == 0:
    print(0)
else:
    print(min(a * b,b * c,c * a))
Problem p02785 (python)

Fixed submission:
a, b = map(int, input().split())
l = [int(x) for x in input().split()]

l.sort()
i = a - 1

for x in range(b):
    l[i] = 0
    i -= 1

    if i < 0:
        break

print(sum(l))

Buggy submission (verdict: Runtime Error):
a, b = map(int, input().split())
l = [int(x) for x in input().split()]

l.sort()
i = a - 1

for x in range(b):
    l[i] = 0
    i -= 1

print(sum(l))