Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
n,q = list(map(int, input().split()))
queue = []
for i in range(n):
    pair = input().split()
    queue.append( (pair[0], int(pair[1])))

time = 0
while queue != []:
    p,t = queue[0]
    queue = queue[1:]
    if t<=q:
        time += t
        print(p,time)
    else:
        time += q
        queue.append((p,t-q))

Fixed submission:
import collections
n,q = map(int, input().split())
queue = collections.deque(maxlen=100000)

for i in range(n):
    p,t = input().split()
    queue.append([p, int(t)])

time = 0
while queue:
    p,t = queue.popleft()
    if t<=q:
        time += t
        print(p,time)
    else:
        time += q
        queue.append([p,t-q])

Buggy python submission (verdict: Time Limit Exceeded):
n,q = list(map(int, input().split()))
queue = []
for i in range(n):
    pair = input().split()
    queue.append( (pair[0], int(pair[1])))

time = 0
while queue != []:
    p,t = queue[0]
    queue = queue[1:]
    if t<=q:
        time += t
        print(p,time)
    else:
        time += q
        queue.append((p,t-q))

Fixed submission:
import collections
n,q = map(int, input().split())
queue = collections.deque(maxlen=100000)

for i in range(n):
    p,t = input().split()
    queue.append([p, int(t)])

time = 0
while queue:
    p,t = queue.popleft()
    if t<=q:
        time += t
        print(p,time)
    else:
        time += q
        queue.append([p,t-q])

Buggy python submission (verdict: Runtime Error):
import collections
q = collections.deque(maxlen=100000)

n = int(input())
for i in range(n):
    com = input().split()
    if com[0]=='insert':
        q.appendleft(int(com[1]))
    elif com[0]=='delete':
        try:
            q.remove(int(com[0]))
        except ValueError:
            pass
    elif com[0]=='deleteFirst':
        q.popleft()
    elif com[0]=='deleteLast':
        q.pop()
print(' '.join(q))

Fixed submission:
import collections
n,q = map(int, input().split())
queue = collections.deque(maxlen=100000)

for i in range(n):
    p,t = input().split()
    queue.append([p, int(t)])

time = 0
while queue:
    p,t = queue.popleft()
    if t<=q:
        time += t
        print(p,time)
    else:
        time += q
        queue.append([p,t-q])
Buggy python submission (verdict: Time Limit Exceeded):
a,b,c=map(int,input().split(" "))
count=0
while(1):
    if c%a==0:
        count+=1
    a+=1
    
    if a==b:
        break
    
print(count)




Fixed submission:
a,b,c=map(int,input().split(" "))
count=0
while(a<=b):
    if c%a==0:
        count+=1
    a+=1

print(count)
Buggy python submission (verdict: Runtime Error):
# coding: utf-8
# Your code here!
n=int(input())
sum=0
min=1000001
max=-1000001
for i in range(n)
    num=int(input())
    sum+=i
    if max<i:
        max=i
    if min>i:
        min=i

print(str(min)+" "+str(max)+" "+str(sum))


Fixed submission:
# coding: utf-8
# Your code here!
n=int(input())
sum=0
min=1000001
max=-1000001
table=list(map(int,input().split(" ")))
for i in table:
    sum+=i
    if max<i:
        max=i
    if min>i:
        min=i

print(str(min)+" "+str(max)+" "+str(sum))

Buggy python submission (verdict: Runtime Error):
# coding: utf-8
# Your code here!
n=int(input())
sum=0
min=1000001
max=-1000001
for i in range(n):
    num=int(input())
    sum+=i
    if max<i:
        max=i
    if min>i:
        min=i

print(str(min)+" "+str(max)+" "+str(sum))


Fixed submission:
# coding: utf-8
# Your code here!
n=int(input())
sum=0
min=1000001
max=-1000001
table=list(map(int,input().split(" ")))
for i in table:
    sum+=i
    if max<i:
        max=i
    if min>i:
        min=i

print(str(min)+" "+str(max)+" "+str(sum))
Buggy python submission (verdict: Runtime Error):
while(1):
    m,f,r=map(int,input().split())
    if m==-1 and f==-1 and r==-1:
        break
    elif m==-1 or f==-1:
        print("F")
    elif m+f>=80:
        print("A")
    elif m+f>=65 and m+f<80:
        print("B")
    elif m+f>=50 and m+f<65:
        print("C")
    elif m+f>=30 and m+f<50:
        print("D")
    elif r>=50:
        print("D")
    elif:
        print("F")






Fixed submission:
while(1):
    m,f,r=map(int,input().split())
    if m==-1 and f==-1 and r==-1:
        break
    
    elif m==-1 or f==-1:
        print("F")
    elif m+f>=80:
        print("A")
    elif m+f>=65 and m+f<80:
        print("B")
    elif m+f>=50 and m+f<65:
        print("C")
    elif m+f>=30 and m+f<50 and r>=50:
        print("C")
    elif m+f>=30 and m+f<50:
        print("D")
    elif m+f<30:
        print("F")
Buggy python submission (verdict: Time Limit Exceeded):
def solve(prev, r, dic):
    d = 0
    t = r
    stack = []
    stack += [[prev, r, d]]
    while stack:
        prev, r, d1 = stack.pop(-1)
        if r in dic:
            for vtx, cost in dic[r]:
                if vtx == prev:
                    continue
                stack += [[r, vtx, d1 + cost]]
                if d < d1 + cost:
                    d = d1 + cost
                    t = vtx
    return d, t

dic = {}
line = input()
n = int(line)
for _ in range(1, n):
    line = input()
    s, t, w = list(map(int, line.split()))
    if s not in dic:
        dic[s] = [[t, w]]
    else:
        dic[s] += [[t, w]]
    if t not in dic:
        dic[t] = [[s, w]]
    else:
        dic[t] += [[s, w]]
for t in range(0, n):
    r1, t1 = solve(-1, t, dic)
    print(r1)


Fixed submission:
def solve(prev, r, n, dic):
    d = [0] * n
    md = 0
    t = r
    stack = []
    stack += [[prev, r, 0]]
    while stack:
        prev, r, d1 = stack.pop(-1)
        if r in dic:
            for vtx, cost in dic[r]:
                if vtx == prev:
                    continue
                stack += [[r, vtx, d1 + cost]]
                if d[vtx] < d1 + cost:
                    d[vtx] = d1 + cost
                    if md < d[vtx]:
                        md = d[vtx]
                        t = vtx
    return d, t

dic = {}
line = input()
n = int(line)
for _ in range(1, n):
    line = input()
    s, t, w = list(map(int, line.split()))
    if s not in dic:
        dic[s] = [[t, w]]
    else:
        dic[s] += [[t, w]]
    if t not in dic:
        dic[t] = [[s, w]]
    else:
        dic[t] += [[s, w]]
d1, t1 = solve(-1, 0, n, dic)
d2, t2 = solve(-1, t1, n, dic)
d3, t3 = solve(-1, t2, n, dic)
print("\n".join(map(str, [max(a, b) for a, b in zip(d2, d3)] )))
Buggy python submission (verdict: Runtime Error):
while True:
    try:
        a,b,c,d,e,f = (map(int,input().split()))

        n = d/a
        a = n*a
        b = n*b
        c = n*c

        y = (c-f)/(b-e)
        x = (c-(b*y))/a

        print("{0:.3f} {1:.3f}".format(x, y))
    except EOFError:
        break


Fixed submission:
EPS = 0.0001
while True:
    try:
        a = list(map(float, input().split()))
        dd = a[0]*a[4]-a[3]*a[1]
        d1 = a[2]*a[4]-a[5]*a[1]
        d2 = a[0]*a[5]-a[3]*a[2]
        print("{0:.3f} {1:.3f}".format(d1/dd+EPS, d2/dd+EPS))
    except EOFError:
        break
Buggy python submission (verdict: Runtime Error):
import math
x1,y1,x2,y2 = map(int,input().split())
print(math.sqrt(math.pow((x2-x1),2)+math.pow((y2-y1),2)))

Fixed submission:
import math
x1,y1,x2,y2=map(float,input().split())
xx = (x2-x1)**2
yy = (y2-y1)**2
print(math.sqrt(xx + yy))
Buggy python submission (verdict: Runtime Error):
import math
n=int(input())
xli=list(map(int,input().split())
yli=list(map(int,input().split())
a=0
b=0
c=0
d=0

for x,y in zip(xli,yli):
    base = math.fabs(x,y)
    a += base
    b += base**2
    c += base**3
    if d < base : d = base

print(a)
print(b**(1/2))
print(c**(1/3))
print(d)

Fixed submission:
import math
n=int(input())
xli=list(map(float,input().split()))
yli=list(map(float,input().split()))
a=0
b=0
c=0
d=0
 
for x,y in zip(xli,yli):
    base = math.fabs(x-y)
    a += base
    b += base**2
    c += base**3
    if d < base : d = base
 
print(a)
print(b**(1/2))
print(c**(1/3))
print(d)

Buggy python submission (verdict: Runtime Error):
import math
n=int(input())
xli=list(map(int,input().split()))
yli=list(map(int,input().split()))
a=0
b=0
c=0
d=0

for x,y in zip(xli,yli):
    base = math.fabs(x,y)
    a += base
    b += base**2
    c += base**3
    if d < base : d = base

print(a)
print(b**(1/2))
print(c**(1/3))
print(d)

Fixed submission:
import math
n=int(input())
xli=list(map(float,input().split()))
yli=list(map(float,input().split()))
a=0
b=0
c=0
d=0
 
for x,y in zip(xli,yli):
    base = math.fabs(x-y)
    a += base
    b += base**2
    c += base**3
    if d < base : d = base
 
print(a)
print(b**(1/2))
print(c**(1/3))
print(d)

Buggy python submission (verdict: Runtime Error):
import math
n=int(input())
xli=list(map(float,input().split())
yli=list(map(float,input().split())
a=0
b=0
c=0
d=0
 
for x,y in zip(xli,yli):
    base = math.fabs(x-y)
    a += base
    b += base**2
    c += base**3
    if d < base : d = base
 
print(a)
print(b**(1/2))
print(c**(1/3))
print(d)

Fixed submission:
import math
n=int(input())
xli=list(map(float,input().split()))
yli=list(map(float,input().split()))
a=0
b=0
c=0
d=0
 
for x,y in zip(xli,yli):
    base = math.fabs(x-y)
    a += base
    b += base**2
    c += base**3
    if d < base : d = base
 
print(a)
print(b**(1/2))
print(c**(1/3))
print(d)
Buggy python submission (verdict: Runtime Error):
import numpy as np
A = np.array(input())
for i, val in numpy.ndenumerate(A):
    print('Case '+repr(i[0])+': '+repr(val))

Fixed submission:
import sys
cnt = 1
for x in sys.stdin:
    i= int(x)
    if i == 0: break
    print('Case '+repr(cnt)+': '+repr(i))
    cnt+=1

Buggy python submission (verdict: Runtime Error):
import numpy as np
A = np.array(input())
for i, val in numpy.ndenumerate(A):
    if val==0:
        break
    else:
        print('Case '+repr(i[0])+': '+repr(val))

Fixed submission:
import sys
cnt = 1
for x in sys.stdin:
    i= int(x)
    if i == 0: break
    print('Case '+repr(cnt)+': '+repr(i))
    cnt+=1

Buggy python submission (verdict: Runtime Error):
import numpy as np
A = np.array(input())
for i, val in numpy.ndenumerate(A):
    if val==0:
        break
    else:
        print('Case '+repr(i[0]+1)+': '+repr(val))

Fixed submission:
import sys
cnt = 1
for x in sys.stdin:
    i= int(x)
    if i == 0: break
    print('Case '+repr(cnt)+': '+repr(i))
    cnt+=1

Buggy python submission (verdict: Runtime Error):
import sys
[x.strip() for x in sys.stdin.readlines()]
cnt=1
for i in x:
	if i==0:
        break
    else:
        print('Case '+repr(cnt)+': '+repr(i))
        cnt+=1

Fixed submission:
import sys
cnt = 1
for x in sys.stdin:
    i= int(x)
    if i == 0: break
    print('Case '+repr(cnt)+': '+repr(i))
    cnt+=1

Buggy python submission (verdict: Runtime Error):
import sys
[x.strip() for x in sys.stdin.readlines()]
cnt=1
for i in x:
    if i==0:
        break
    else:
        print('Case '+repr(cnt)+': '+repr(int(i)))
        cnt+=1

Fixed submission:
import sys
cnt = 1
for x in sys.stdin:
    i= int(x)
    if i == 0: break
    print('Case '+repr(cnt)+': '+repr(i))
    cnt+=1
Buggy python submission (verdict: Runtime Error):
(a, b) = [int(i) for i in input().split(' ')]  
print( repr(a // b) +" "+ repr(a % b) +" "+ ('%0.5f' % (a / b))

Fixed submission:
(a, b) = [int(i) for i in input().split(' ')]  
print( repr(a // b) +" "+ repr(a % b) +" "+ ('%0.5f' % (a / b)))
Buggy python submission (verdict: Runtime Error):
import math
a=int(input())
print(('%0.5f' % (math.pi*r**2)) + " " + ('%0.5f' % (2*math.pi*r)))

Fixed submission:
import math
r = float(input())
print(('%0.5f' % (math.pi*r**2)) + " " + ('%0.5f' % (2*math.pi*r)))

Buggy python submission (verdict: Runtime Error):
import math
r=int(input())
print(('%0.5f' % (math.pi*r**2)) + " " + ('%0.5f' % (2*math.pi*r)))

Fixed submission:
import math
r = float(input())
print(('%0.5f' % (math.pi*r**2)) + " " + ('%0.5f' % (2*math.pi*r)))
Buggy python submission (verdict: Runtime Error):
import sys
a,op,c=sys.stdin.readline().split()
def ope(a,op,b):
    if op == '+': ret = a + b
    if op == "-": ret = a - b
    if op == "*": ret = a * b
    if op == "/": ret = a / b
    return ret
print(ope(a,op,b))

Fixed submission:
import sys
def ope(a,op,b):
	if op == '+': ret = a + b
	if op == '-': ret = a - b
	if op == '/': ret = int(a / b)
	if op == '*': ret = a * b
	if op == r'?': ret = 'end'
	return ret

while True:
	a,op,b = sys.stdin.readline().split()
	ret = ope(int(a) , op , int(b))
	if ret == 'end': break
	else: print(ret)
Buggy python submission (verdict: Runtime Error):
s= [i+1 for i in range(13)]
h= [i+1 for i in range(13)]
c= [i+1 for i in range(13)]
d= [i+1 for i in range(13)]

n=input()
while True:
    i=input()
    if i == -1: break
    e,n =i.split()
    if e == 'S':s[int(n)-1]=0
    elif e == 'H':h[int(n)-1]=0
    elif e == 'C':c[int(n)-1]=0
    elif e == 'D':d[int(n)-1]=0

for i in s:
    if i != 0: print('S '+repr(i))
for i in h:
    if i != 0: print('H '+repr(i))
for i in c:
    if i != 0: print('C '+repr(i))
for i in d:
    if i != 0: print('D '+repr(i))

Fixed submission:
s= [i+1 for i in range(13)]
h= [i+1 for i in range(13)]
c= [i+1 for i in range(13)]
d= [i+1 for i in range(13)]
 
n=int(input())
for cnt in range(n):
    e,n =input().split()
    if e == 'S':s[int(n)-1]=0
    elif e == 'H':h[int(n)-1]=0
    elif e == 'C':c[int(n)-1]=0
    elif e == 'D':d[int(n)-1]=0
 
for i in s:
    if i != 0: print('S '+repr(i))
for i in h:
    if i != 0: print('H '+repr(i))
for i in c:
    if i != 0: print('C '+repr(i))
for i in d:
    if i != 0: print('D '+repr(i))

Buggy python submission (verdict: Runtime Error):
s= [i+1 for i in range(13)]
h= [i+1 for i in range(13)]
c= [i+1 for i in range(13)]
d= [i+1 for i in range(13)]

n=int(input())
for cnt in range(n)
    e,n =input().split()
    if e == 'S':s[int(n)-1]=0
    elif e == 'H':h[int(n)-1]=0
    elif e == 'C':c[int(n)-1]=0
    elif e == 'D':d[int(n)-1]=0

for i in s:
    if i != 0: print('S '+repr(i))
for i in h:
    if i != 0: print('H '+repr(i))
for i in c:
    if i != 0: print('C '+repr(i))
for i in d:
    if i != 0: print('D '+repr(i))

Fixed submission:
s= [i+1 for i in range(13)]
h= [i+1 for i in range(13)]
c= [i+1 for i in range(13)]
d= [i+1 for i in range(13)]
 
n=int(input())
for cnt in range(n):
    e,n =input().split()
    if e == 'S':s[int(n)-1]=0
    elif e == 'H':h[int(n)-1]=0
    elif e == 'C':c[int(n)-1]=0
    elif e == 'D':d[int(n)-1]=0
 
for i in s:
    if i != 0: print('S '+repr(i))
for i in h:
    if i != 0: print('H '+repr(i))
for i in c:
    if i != 0: print('C '+repr(i))
for i in d:
    if i != 0: print('D '+repr(i))
Buggy python submission (verdict: Runtime Error):
n= int(input())
for i in range(n):
    b, f, r, v = input().split()
    fstr= 'f' + f
    rint= int(r) - 1
    vint= int(v)
    if b == '1':
        b1[fstr][rint]+=vint
    elif b == '2':
        b2[fstr][rint]+=vint
    elif b == '3':
        b3[fstr][rint]+=vint
    elif b == '4':
        b4[fstr][rint]+=vint

print(str(b1['f1']).replace(',','')[1:9*2])
print(str(b1['f2']).replace(',','')[1:9*2])
print(str(b1['f3']).replace(',','')[1:9*2])
print('#'*20)

print(str(b2['f1']).replace(',','')[1:9*2])
print(str(b2['f2']).replace(',','')[1:9*2])
print(str(b2['f3']).replace(',','')[1:9*2])
print('#'*20)

print(str(b3['f1']).replace(',','')[1:9*2])
print(str(b3['f2']).replace(',','')[1:9*2])
print(str(b3['f3']).replace(',','')[1:9*2])
print('#'*20)


print(str(b4['f1']).replace(',','')[1:9*2])
print(str(b4['f2']).replace(',','')[1:9*2])
print(str(b4['f3']).replace(',','')[1:9*2])

Fixed submission:
class myResi():
    def __init__(self):
        self.val=[[0]*10 for _ in range(3)]
    def __str__(self):
        ret = ''
        for i in range(3):
            ret += ' '+(str(self.val[i]).replace(',','')[1:10*2])+'\n'
        return ret.rstrip("\n")
    def setVal(self,f,r,v):
        self.val[f-1][r-1] += v
        
def fill(allb,b,f,r,v):
    bname=allb[b-1]
    bname.setVal(f,r,v)
    
b1=myResi()
b2=myResi()
b3=myResi()
b4=myResi()
allb=[b1,b2,b3,b4]
n=int(input())
for _ in range(n):
    b,f,r,v = map(int,input().split())
    fill(allb,b,f,r,v)
    
print(b1)
print('#'*20)
print(b2)
print('#'*20)
print(b3)
print('#'*20)
print(b4)

Buggy python submission (verdict: Runtime Error):
def out(bnum):
    print(' '+str(bnum['1f']).replace(',','')[1:10*2])
    print(' '+str(bnum['2f']).replace(',','')[1:10*2])
    print(' '+str(bnum['3f']).replace(',','')[1:10*2])

def init(bnum):
    bnum = {'1f': [0]*10, '2f': [0]*10, '3f': [0]*10}
    return bnum
    
n = int(input())
b1 = init(b1)
b2 = init(b2)
b3 = init(b3)
b4 = init(b4)
for i in range(n):
    b, f, r, v = input().split()
    f += 'f'
    rint = int(r) - 1
    vint = int(v)
    if b == '1':
        b1[f][rint]+=vint
    elif b == '2':
        b2[f][rint]+=vint
    elif b == '3':
        b3[f][rint]+=vint
    elif b == '4':
        b4[f][rint]+=vint

out(b1)
print('#'*20)
out(b2)
print('#'*20)
out(b3)
print('#'*20)
out(b4)

Fixed submission:
class myResi():
    def __init__(self):
        self.val=[[0]*10 for _ in range(3)]
    def __str__(self):
        ret = ''
        for i in range(3):
            ret += ' '+(str(self.val[i]).replace(',','')[1:10*2])+'\n'
        return ret.rstrip("\n")
    def setVal(self,f,r,v):
        self.val[f-1][r-1] += v
        
def fill(allb,b,f,r,v):
    bname=allb[b-1]
    bname.setVal(f,r,v)
    
b1=myResi()
b2=myResi()
b3=myResi()
b4=myResi()
allb=[b1,b2,b3,b4]
n=int(input())
for _ in range(n):
    b,f,r,v = map(int,input().split())
    fill(allb,b,f,r,v)
    
print(b1)
print('#'*20)
print(b2)
print('#'*20)
print(b3)
print('#'*20)
print(b4)
Buggy python submission (verdict: Runtime Error):
i,j=map(int,input().split())
mn=[]
n=[]
for _ in range(i):
    mn.append(list(map(int,input().split())))
for _ in range(j):
    n.append(list(map(int,input().split())))

import numpy as np
x=np.array(mn)
y=np.array(n)
ret=x*y
for num in range(i):
    print(sum(ret[num]))

Fixed submission:
i,j=map(int,input().split())
matrix=[list(map(int,input().split())) for _ in range(i)]
vector=[int(input()) for _ in range(j)]
for x in range(i):
    print(sum([v * m for v,m in zip(vector,matrix[x])]))

Buggy python submission (verdict: Runtime Error):
import numpy as np
i,j=map(int,input().split())
mn=[]
n=[]
for _ in range(i):
    mn.append(list(map(int,input().split())))
for _ in range(j):
    n.append(int(input()))

x=np.array(mn)
y=np.array(n)
ret=x*y

for num in range(i):
    print(sum(ret[num]))

Fixed submission:
i,j=map(int,input().split())
matrix=[list(map(int,input().split())) for _ in range(i)]
vector=[int(input()) for _ in range(j)]
for x in range(i):
    print(sum([v * m for v,m in zip(vector,matrix[x])]))
Buggy python submission (verdict: Runtime Error):
s = input()
p = input()
ret = 'No'
tts = s + s[:len(p)]
if p in tts: ret = 'Yes'
print(ret)


Fixed submission:
import string
x = ''
allcase = string.ascii_lowercase
while True:
    try: x+=input().lower()
    except:break
for letter in allcase:
    print(letter + " : " + repr(x.count(letter)))

Buggy python submission (verdict: Runtime Error):
n = input().lower()
li=[chr(i) for i in range(97,97+26)]
for a in li:


Fixed submission:
import string
x = ''
allcase = string.ascii_lowercase
while True:
    try: x+=input().lower()
    except:break
for letter in allcase:
    print(letter + " : " + repr(x.count(letter)))
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(map(int, input().split()))

if N == 1:
    print(A[0])
else:

    for i in range(N):
        j = i

        while j > 0 and A[j] < A[j-1]:
            if A[j] > A[j-1]:

                break
                k = A[j]
                l = A[j-1]
                A[j-1] = k
                A[j] = l
                j -= 1

            S = str(A[0])
            for k in range(1,N-1):
                S += " " + str(A[k])

            S = S + " "+str(A[N-1])
            print(S)



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


for i in range(N):
    if N == 1:
        print(A[0])
        break
    j = i

    while j > 0 and A[j] < A[j-1]:
        if A[j] > A[j-1]:

            break
        k = A[j]
        l = A[j-1]
        A[j-1] = k
        A[j] = l
        j -= 1

    S = str(A[0])
    for k in range(1,N-1):
        S += " " + str(A[k])

    S = S + " "+str(A[N-1])
    print(S)
Buggy python submission (verdict: Time Limit Exceeded):
def make_divisor_list(num):
    if num < 1:
        return []
    elif num == 1:
        return [1]
    else:
        divisor_list = []
        divisor_list.append(1)
        for i in range(2, num // 2 + 1):
            if num % i == 0:
                divisor_list.append(i)
        divisor_list.append(num)

        return divisor_list
a,b = map(int,input().split())
a_set = set(make_divisor_list(a))
b_set = set(make_divisor_list(b))
matched_list = list(a_set & b_set)
print(max(matched_list))



Fixed submission:
a,b = map(int,input().split())
def gcd(x,y):
    q = max(x,y)  %  min(x,y)
    if q == 0 :
        return [min(x,y),0]
    return gcd(min(x,y),q)

print(max(gcd(a,b)))

Buggy python submission (verdict: Time Limit Exceeded):
a,b = map(int,input().split())
def gcd(x,y):
    z = max(x,y)  %  min(x,y)
    if z == 0 :
        return [min(x,y),0]
    return gcd(max(x,y),z)

L = gcd(a,b)
K = []
for i in reversed( (range(1,L[0]+1 )) ) :
    if a % i == 0 and b % i == 0:
        K.append(i)

print(max(K))



Fixed submission:
a,b = map(int,input().split())
def gcd(x,y):
    q = max(x,y)  %  min(x,y)
    if q == 0 :
        return [min(x,y),0]
    return gcd(min(x,y),q)

print(max(gcd(a,b)))

Buggy python submission (verdict: Time Limit Exceeded):
a,b = map(int,input().split())
def gcd(x,y):
    z = max(x,y)  %  min(x,y)
    if z == 0 :
        return [min(x,y),0]
    return gcd(max(x,y),z)

L = gcd(a,b)
K = []
for i in reversed( (range(1,L[0]+1 )) ) :
    if a % i == 0 and b % i == 0:
        K.append(i)

print(max(K))



Fixed submission:
a,b = map(int,input().split())
def gcd(x,y):
    q = max(x,y)  %  min(x,y)
    if q == 0 :
        return [min(x,y),0]
    return gcd(min(x,y),q)

print(max(gcd(a,b)))

Buggy python submission (verdict: Time Limit Exceeded):
a,b = map(int,input().split())
def gcd(x,y):
    q = max(x,y)  %  min(x,y)
    if q == 0 :
        return [min(x,y),0]
    return gcd(min(x,y),q)

L = gcd(a,b)
K = [ i for i in reversed(range(1, L[0] +1 )) if a % i == 0 ]

print(max(K))



Fixed submission:
a,b = map(int,input().split())
def gcd(x,y):
    q = max(x,y)  %  min(x,y)
    if q == 0 :
        return [min(x,y),0]
    return gcd(min(x,y),q)

print(max(gcd(a,b)))
Buggy python submission (verdict: Runtime Error):
def prime(x):
    if  x == 2:
        return True
    elif x < 2 or  x %2 == 0:
        return False
    i = 3
    while i <= x**(1/2):
        if x % i == 0:
            return false
        i = i + 2

    return true

L = []
while True:
    try:
        i = int(input())
        L.append(i)
    except EOFError:
        break
K = 0
for i in range(len(L)):
    if prime(L[i]):
        K += 1

print(K)


Fixed submission:
def prime(x):
    if  x == 2:
        return True
    elif x < 2 or  x %2 == 0:
        return False
    i = 3
    while i <= x**(1/2):
        if x % i == 0:
            return False
        i = i + 2

    return True

L = []
while True:
    try:
        i = int(input())
        L.append(i)
    except EOFError:
        break
K = 0
for i in range(len(L)):
    if prime(L[i]):
        K += 1

print(K)
Buggy python submission (verdict: Runtime Error):
import math
x_1,y_1,x_2,y_2 = int(input().split(" "))

print(math.sqrt((x_1-x_2)**2+(y_1-y_2)**2))



Fixed submission:
import math
x_1,y_1,x_2,y_2 = map(float,input().split())
print(math.sqrt((x_1-x_2)**2+(y_1-y_2)**2))

Buggy python submission (verdict: Runtime Error):
import math
x_1,y_1,x_2,y_2 = map(int,input().split())
print(math.sqrt((x_1-x_2)**2+(y_1-y_2)**2))


Fixed submission:
import math
x_1,y_1,x_2,y_2 = map(float,input().split())
print(math.sqrt((x_1-x_2)**2+(y_1-y_2)**2))