Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
a  = input()
x = int(a[0])
y = int(a[1])
z = int(a[2])
w = int(a[3])
o = ["+","-"]
for i in range(2):
    for j in range(2):
        for k in range(2):
            if i == 0 and j == 0 and k == 0:
                if x + y + z + w == 7: p = [i,j,k]
            elif i == 0 and j == 0 and k == 1:
                if x + y + z - w == 7: p = [i,j,k]
            elif i == 0 and j == 1 and k == 0:
                if x + y - z - w == 7: p = [i,j,k]
            elif i == 1 and j == 0 and k == 0:
                if x - y + z - w == 7: p = [i,j,k]
            elif i == 1 and j == 1 and k == 0:
                if x - y - z + w == 7: p = [i,j,k]
            elif i == 0 and j == 1 and k == 1:
                if x + y - z - w == 7: p = [i,j,k]
            elif i == 1 and j == 0 and k == 1:
                if x - y + z - w == 7: p = [i,j,k]
            elif i == 1 and j == 1 and k == 1:
                if x - y - z - w == 7: p = [i,j,k]
print(str(x)+o[p[0]]+str(y)+o[p[1]]+str(z)+str(o[p[2]])+str(w)+"=7")

Fixed submission:
a  = input()
x = int(a[0])
y = int(a[1])
z = int(a[2])
w = int(a[3])
o = ["+","-"]
for i in range(2):
    for j in range(2):
        for k in range(2):
            if i == 0 and j == 0 and k == 0:
                if x + y + z + w == 7: p = [i,j,k]
            elif i == 0 and j == 0 and k == 1:
                if x + y + z - w == 7: p = [i,j,k]
            elif i == 0 and j == 1 and k == 0:
                if x + y - z + w == 7: p = [i,j,k]
            elif i == 1 and j == 0 and k == 0:
                if x - y + z + w == 7: p = [i,j,k]
            elif i == 1 and j == 1 and k == 0:
                if x - y - z + w == 7: p = [i,j,k]
            elif i == 0 and j == 1 and k == 1:
                if x + y - z - w == 7: p = [i,j,k]
            elif i == 1 and j == 0 and k == 1:
                if x - y + z - w == 7: p = [i,j,k]
            elif i == 1 and j == 1 and k == 1:
                if x - y - z - w == 7: p = [i,j,k]
print(str(x)+o[p[0]]+str(y)+o[p[1]]+str(z)+str(o[p[2]])+str(w)+"=7")
Buggy python submission (verdict: Runtime Error):
def ms():return map(str, input().split())#,a,b,c,d
a ,b =ms()
if a < b:
  pritn("<")
elif a>b:
  print(">")
else:print("=")

Fixed submission:
def ms():return map(str, input().split())#,a,b,c,d
a ,b =ms()
if a < b:
  print("<")
elif a > b:
  print(">")
else:print("=")
Buggy python submission (verdict: Runtime Error):

a,b,c=map(int,input().split())
x = list(map(int,input().split()))
print(max(abs(b-x[-1]),abs(x[-1]-x[-2])))



Fixed submission:

a,b,c=map(int,input().split())
x = list(map(int,input().split()))
if a == 1:
    print(abs(c-x[-1]))
else:
    print(max(abs(c-x[-1]),abs(x[-1]-x[-2])))
Buggy python submission (verdict: Time Limit Exceeded):
def lma():return list(map(int, input().split()))#x or y

a = int(input())
k=[]
s=[]
co=[0]*a*3
c=0
s= [lma()]
x2= lma()
x3 = lma()
s.append(x2)
s.append(x3)
res =0
for j in range(3):
    for i in range(a):
        k.append([j,s[j][i]])
k.sort(key=lambda x: x[1], reverse=True)
for i in range(a*3):
    if k[i][0] == 2:
       c+=1
    elif k[i][0] == 1:
       co[i] = c
    else:
       res+=sum(co[:i])
print(res)
       

Fixed submission:
def lma():return list(map(int, input().split()))#x or y
a = int(input())
k=[]
s=[]
c=0
s= [lma()]
x2= lma()
x3 = lma()
s.append(x2)
s.append(x3)
res =0
r =0
for j in range(3):
    for i in range(a):
        k.append([j,s[j][i]])
k.sort(key=lambda x: x[1], reverse=True)
for i in range(a*3):
    if k[i][0] == 2:
       c+=1
    elif k[i][0] == 1:
       r+=c 
    else:
       #res+=sum(co[:i])
        res+=r
print(res)
Buggy python submission (verdict: Runtime Error):
a=input()
if “AC” in a:
  print(“Yes”)
else:print(“No”)

Fixed submission:
a=input()
if "AC" in a:
  print("Yes")
else:print("No")
Buggy python submission (verdict: Time Limit Exceeded):
def cal(a,b):
    if 4*a*b-A*(a+b)>0:
        return (A*a*b)/(4*a*b-A*(a+b))
    else:
        return -1
A = int(input())
for i in range(1,3501):
    for j in range(1,3501):
        t = cal(i,j)
        if t == -1:
            continue
        if t == int(t):
            print(i,j,int(t))
            exit()

Fixed submission:
def cal(a,b):
    if 4*a*b-A*(a+b)>0:
        return (A*a*b)/(4*a*b-A*(a+b))
    else:
        return -1
A = int(input())
for i in range(1,3501):
    for j in range(i,3501):
        t = cal(i,j)
        if t == -1:
            continue
        if t == int(t):
            print(i,j,int(t))
            exit()
Buggy python submission (verdict: Runtime Error):
from collections import Counter 

a,b = map(int,input().split())
l = ''
for i in range(a):
    t = input()
    l+=t

c = Counter(list(l))
# print(c)
dp = [0,0,0]
for i in c:
    if c[i]%2 ==1:
        dp[0] +=1
    elif c[i]%4 == 0:
        dp[2] += 1
    elif c[i]%2 == 0:
        dp[1] += 1
# print(dp)
ans = 'No'
if a%2 ==1 and b%2 ==1:
    A = 1
    B = (a+b-2)//2
A = 0
elif  a%2 ==0 and b%2 ==0:
    B= 0
elif a%2 ==0 and b%2 ==1:
    B = a//2
else:
    B= b//2
if A >= dp[0] and B >= dp[1]:
    ans = 'Yes'
print(ans)


Fixed submission:
from collections import Counter 

a,b = map(int,input().split())
l = ''
for i in range(a):
    t = input()
    l+=t

c = Counter(list(l))
# print(c)
dp = [0,0,0]
for i in c:
    if c[i]%2 ==1:
        dp[0] +=1
    elif c[i]%4 == 0:
        dp[2] += 1
    elif c[i]%2 == 0:
        dp[1] += 1
# print(dp)
ans = 'No'
if a%2 ==1 and b%2 ==1:
    A = 1
    B = (a+b-2)//2
    if A >= dp[0] and B >= dp[1]:
        ans = 'Yes'
elif  a%2 ==0 and b%2 ==0:
    A = 0
    B= 0
    if A >= dp[0] and B >= dp[1]:
        ans = 'Yes'
elif a%2 ==0 and b%2 ==1:
    A = 0
    B = a//2
    if A >= dp[0] and B >= dp[1]:
        ans = 'Yes'
else:
    A=0
    B= b//2
    if A >= dp[0] and B >= dp[1]:
        ans = 'Yes'
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
a,b,c,d,e,f = map(int,input().split())
A =a* 100
B =b* 100
l = []
for i in range(f//A+1):
    for j in range(f//B+1):
        if i*A+j*B <=f:
            W = i*A+j*B
            s = (W//100)*e
            # print(s)
            r = f - W
            for I in range(s//c+1):
                for J in range(s//d+1):
                    if I*c + J*d<=s and I*c + J*d+W <= f and W>0:
                        S =I*c + J*d
                        l.append([100*S/(W+S),W+S,S])
l.sort()

l = l[::-1]
# print(l[:10])
print(l[0][1],l[0][2])

Fixed submission:
a,b,c,d,e,f = map(int,input().split())
A =a* 100
B =b* 100
l = []
for i in range(f//A+1):
    for j in range(f//B+1):
        if i*A+j*B <=f:
            W = i*A+j*B
            s = (W//100)*e
            # print(s)
            r = f - W
            for I in range(s//c+1):
                for J in range(s//d+1):
                    if I*c + J*d<=s and I*c + J*d+W <= f and W>0:
                        S =I*c + J*d
                        l.append([100*S/(W+S),W+S,S])
l.sort()

l = l[::-1]
# print(l[:10])
print(l[0][1],l[0][2])
Buggy python submission (verdict: Time Limit Exceeded):
def ai():return input()#s
def a():return int(input())#a,n or k
def ma():return map(int, input().split())#a,b,c,d or n,k
def ms():return map(str, input().split())#,a,b,c,d
def lma():return list(map(int, input().split()))#x or y
def lms():return list(map(str, input().split()))#x or y
k= []
l = []
f = 0
def say(i):return print("Yes" if i == 0 else "No")
def Say(i):return print("YES" if i == 0 else "NO")

a = int(input())
c =[0]*a
for i in range(a):
    t = int(input())
    k.append(t)
p = set(k)
for i in p:
    f+=k.count(i)%2
print(f)

Fixed submission:
def ai():return input()#s
def a():return int(input())#a,n or k
def ma():return map(int, input().split())#a,b,c,d or n,k
def ms():return map(str, input().split())#,a,b,c,d
def lma():return list(map(int, input().split()))#x or y
def lms():return list(map(str, input().split()))#x or y
k= []
l = []
f = 0
def say(i):return print("Yes" if i == 0 else "No")
def Say(i):return print("YES" if i == 0 else "NO")

a = int(input())
c=set()
for i in range(a):
    t = int(input())
    if t in c:
        c.remove(t)
    else:
        c.add(t)
print(len(c))
Buggy python submission (verdict: Time Limit Exceeded):
import itertools
N, M, R = map(int, input().split())
r = tuple(map(lambda n: int(n)-1, input().split()))
inf = float("inf")
vertices = [[inf]*N for _ in [0]*N]
for _ in [0]*M:
    a, b, c = map(int, input().split())
    vertices[a-1][b-1] = c
    vertices[b-1][a-1] = c

for k in range(N):
    for i in range(N):
        c2 = vertices[i][k]
        for j, (c1, c3) in enumerate(zip(vertices[i], vertices[k])):
            vertices[i][j] = c1 if c1 < c2+c3 else c2+c3

ans = inf

for p in itertools.permutations(r):
    subt = 0
    for i in range(R-1):
        subt += vertices[p[i]][p[i+1]]
    if subt < ans:
        ans = subt

print(ans)


Fixed submission:
import itertools
N, M, R = map(int, input().split())
r = tuple(map(lambda n: int(n)-1, input().split()))
inf = float("inf")
vertices = [[inf]*N for _ in [0]*N]
for _ in [0]*M:
    a, b, c = map(int, input().split())
    vertices[a-1][b-1] = c
    vertices[b-1][a-1] = c

for k in range(N):
    for i in range(N):
        c2 = vertices[i][k]
        for j, (c1, c3) in enumerate(zip(vertices[i], vertices[k])):
            vertices[i][j] = c1 if c1 < c2+c3 else c2+c3

ans = inf

for p in itertools.permutations(r):
    subt = 0
    for i in range(R-1):
        subt += vertices[p[i]][p[i+1]]
    if subt < ans:
        ans = subt

print(ans)
Buggy python submission (verdict: Runtime Error):
a,b,c,d = map(int, input().split())
if a > c:
    a,b,c,d = c,d,a,b
if b < c:print(0)
elif b >= c and b < d:print(b-c)
else : print(d-c)

Fixed submission:
a = input()
b =a[::-1]
if a!=b:print("No")
else:print("Yes")
Buggy python submission (verdict: Runtime Error):
a,b,c,d = map(int, input().split())
if a > c:
    a,b,c,d = c,d,a,b
if b < c:print(0)
elif b => c and b < d:print(b-c)
else : print(d-c)

Fixed submission:
a,b,c,d = map(int, input().split())
if a > c:
    a,b,c,d=c,d,a,b
if b < c:print(0)
elif b >= c and b < d:print(b-c)
else : print(d-c)

Buggy python submission (verdict: Runtime Error):
a,b,c,d = map(int, input().split())
if a > c:
    a,b,c,d = c,d,a,b
if b < c:print(0)
elif b => c and b < d:print(b-c)
else : print(d-c)

Fixed submission:
a,b,c,d = map(int, input().split())
if a > c:
    a,b,c,d=c,d,a,b
if b < c:print(0)
elif b >= c and b < d:print(b-c)
else : print(d-c)
Buggy python submission (verdict: Runtime Error):
import math
a = int(input())
s = 1
for i in range(a):
    t= int(input())
    s = (t*s)//math.gcd(t,s)
print(s)
    


Fixed submission:

def gcd(x,y):
    if x==0:return y
    else:return gcd(y%x,x)
a = int(input())
s = 1
for i in range(a):
    t= int(input())
    s = (t*s)//gcd(t,s)
print(s)

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

Fixed submission:

def gcd(x,y):
    if x==0:return y
    else:return gcd(y%x,x)
a = int(input())
s = 1
for i in range(a):
    t= int(input())
    s = (t*s)//gcd(t,s)
print(s)

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

Fixed submission:

def gcd(x,y):
    if x==0:return y
    else:return gcd(y%x,x)
a = int(input())
s = 1
for i in range(a):
    t= int(input())
    s = (t*s)//gcd(t,s)
print(s)
Buggy python submission (verdict: Runtime Error):
a = int(input())
c = list(map(int,input().split()))
c1=c2=c4=0
for i in c:
    if c%2==1:
        c1+=1
    elif c%4==0:
        c4+=1
    else:c2+=1
if c1+1>c4:print("No")
elif c1+c2-c4==1:print("Yes")
elif c1<=c4:print("Yes")

Fixed submission:
a = int(input())
c = list(map(int,input().split()))
c1=c2=c4=0
for i in c:
    if i%2==1:
        c1+=1
    elif i%4==0:
        c4+=1
    else:c2+=1
if c1+c2-c4==1:print("Yes")
elif c1<=c4:print("Yes")
else:print("No")

Buggy python submission (verdict: Runtime Error):
a = int(input())
c = list(map(int,input().split()))
c1=c2=c34=0
for i in c:
    if c%2==1:
        c1+=1
    elif c%4==0:
        c4+=1
    else:c2+=1
if c1+1>c4:print("No")
elif c1+c2-c4==1:print("Yes")
elif c1<=c4:print("Yes")
        
        
    

Fixed submission:
a = int(input())
c = list(map(int,input().split()))
c1=c2=c4=0
for i in c:
    if i%2==1:
        c1+=1
    elif i%4==0:
        c4+=1
    else:c2+=1
if c1+c2-c4==1:print("Yes")
elif c1<=c4:print("Yes")
else:print("No")

Buggy python submission (verdict: Runtime Error):
a = int(input())
c = list(map(int,input().split()))
for i in c:
    if c%2==1:
        c1+=1
    elif c%4==0:
        c4+=1
    else:c2+=1
if c1+1>c4:print("No")
elif c1+c2-c4==1:print("Yes")
elif c1<=c4:print("Yes")
        
        
        
        
    

Fixed submission:
a = int(input())
c = list(map(int,input().split()))
c1=c2=c4=0
for i in c:
    if i%2==1:
        c1+=1
    elif i%4==0:
        c4+=1
    else:c2+=1
if c1+c2-c4==1:print("Yes")
elif c1<=c4:print("Yes")
else:print("No")
Buggy python submission (verdict: Runtime Error):
a =input()
b =ABC+a
print(b)

Fixed submission:
a =input()
b ="ABC"+a
print(b)
Buggy python submission (verdict: Runtime Error):
a = int(input())
s = 1
while n>0:
    if 2**n <a:
        s = 2**n
        break
    n-=1
print(s)

Fixed submission:
a = int(input())
s = 1
n = 8
while n>0:
    if 2**n <=a:
        s = 2**n
        break
    n-=1
print(s)

Buggy python submission (verdict: Runtime Error):
a = int(input())
s = 1
while n>0:
    if 2**n <a:
        s = 2**n
        break
    n-=1
print(s)

Fixed submission:
a = int(input())
s = 1
n = 8
while n>0:
    if 2**n <=a:
        s = 2**n
        break
    n-=1
print(s)
Buggy python submission (verdict: Time Limit Exceeded):
from collections import deque
H, W = map(int, input().split())
k=[]
l=[]
for i in range(W):
    ta,tb = map(int, input().split())
    if ta == 1:
        k.append(tb)
    if tb == H:
        l.append(ta)
s = 0
for i in range(len(k)):
    for j in range(len(l)):
        if k[i] == l[j]:
            s = 1
if s ==1:
    print("POSSIBLE")
else:
    print("IMPOSSIBLE")


Fixed submission:
from collections import deque
H, W = map(int, input().split())
k=[0]*200000
for i in range(W):
    ta,tb = map(int, input().split())
    if ta == 1:
        k[tb-1]+=1
    if tb == H:
        k[ta-1]+=1
s = 0
for i in range(len(k)):
    if k[i]>=2:s=1
if s ==1:
    print("POSSIBLE")
else:
    print("IMPOSSIBLE")

Buggy python submission (verdict: Time Limit Exceeded):
from collections import deque
H, W = map(int, input().split())
k=[]
l=[]
def intersection(lst1, lst2): 
    lst3 = [value for value in lst1 if value in lst2] 
    return lst3 
for i in range(W):
    ta,tb = map(int, input().split())
    if ta == 1:
        k.append(tb)
    if tb == H:
        l.append(ta)
s = 0
p = intersection(l,k)
if len(p)>=1:
    print("POSSIBLE")
else:
    print("IMPOSSIBLE")

Fixed submission:
from collections import deque
H, W = map(int, input().split())
k=[0]*200000
for i in range(W):
    ta,tb = map(int, input().split())
    if ta == 1:
        k[tb-1]+=1
    if tb == H:
        k[ta-1]+=1
s = 0
for i in range(len(k)):
    if k[i]>=2:s=1
if s ==1:
    print("POSSIBLE")
else:
    print("IMPOSSIBLE")

Buggy python submission (verdict: Time Limit Exceeded):
from collections import deque
H, W = map(int, input().split())
k=[]
l=[]
def intersection(lst1, lst2): 
    lst3 = [value for value in lst1 if value in lst2] 
    return lst3 
for i in range(W):
    ta,tb = map(int, input().split())
    if ta == 1:
        k.append(tb)
    if tb == H:
        l.append(ta)
s = 0
p = intersection(l,k)
if len(p)>=1:
    print("POSSIBLE")
else:
    print("IMPOSSIBLE")

Fixed submission:
from collections import deque
H, W = map(int, input().split())
k=[0]*200000
for i in range(W):
    ta,tb = map(int, input().split())
    if ta == 1:
        k[tb-1]+=1
    if tb == H:
        k[ta-1]+=1
s = 0
for i in range(len(k)):
    if k[i]>=2:s=1
if s ==1:
    print("POSSIBLE")
else:
    print("IMPOSSIBLE")

Buggy python submission (verdict: Time Limit Exceeded):

from collections import deque
H, W = map(int, input().split())
k=[]
l=[]
for i in range(W):
    ta,tb = map(int, input().split())
    if ta == 1:
        k.append(tb)
    if tb == H:
        l.append(ta)
s = 0
for i in range(len(k)):
    for j in range(len(l)):
        if k[i] == l[j]:
            s = 1
if s ==1:
    print("POSSIBLE")
else:
    print("IMPOSSIBLE")

Fixed submission:
from collections import deque
H, W = map(int, input().split())
k=[0]*200000
for i in range(W):
    ta,tb = map(int, input().split())
    if ta == 1:
        k[tb-1]+=1
    if tb == H:
        k[ta-1]+=1
s = 0
for i in range(len(k)):
    if k[i]>=2:s=1
if s ==1:
    print("POSSIBLE")
else:
    print("IMPOSSIBLE")
Buggy python submission (verdict: Runtime Error):
N,K= map(int, input().split())
x = list(map(int, input().split()))
x.sort()
t = max(x)
y = x[0]
s = [1000000000000]
o=0
if x[0] == K:o=1
for i in range(1,len(x)):
    s.append(x[i]-x[i-1])
    if x[i] == K:o = 1
s.sort()
m = min(y,s[0])
if (t>= K and K%m==0) or o==1:
    print("POSSIBLE")
else:
    print("IMPOSSIBLE")


Fixed submission:
N,K= map(int, input().split())
x = list(map(int, input().split()))
x = list(set(x))
x.sort()
t = max(x)
y = x[0]
s = [1000000000000]
o=0
if x[0] == K:o=1
for i in range(1,len(x)):
    s.append(x[i]-x[i-1])
    if x[i] == K:o = 1
s.sort()
m = min(y,s[0])
if (t>= K and K%m==0) or o==1:
    print("POSSIBLE")
else:
    print("IMPOSSIBLE")

Buggy python submission (verdict: Runtime Error):
N,K= map(int, input().split())
x = list(map(int, input().split()))
x.sort()
t = max(x)
y = x[0]
s = []
for i in range(1,len(x)):
    s.append(x[i]-x[i-1])
s.sort()
m = min(y,s[0])
if t>= K and K%m==0:
    print("POSSIBLE")
else:
    print("IMPOSSIBLE")



Fixed submission:
N,K= map(int, input().split())
x = list(map(int, input().split()))
x = list(set(x))
x.sort()
t = max(x)
y = x[0]
s = [1000000000000]
o=0
if x[0] == K:o=1
for i in range(1,len(x)):
    s.append(x[i]-x[i-1])
    if x[i] == K:o = 1
s.sort()
m = min(y,s[0])
if (t>= K and K%m==0) or o==1:
    print("POSSIBLE")
else:
    print("IMPOSSIBLE")

Buggy python submission (verdict: Runtime Error):
a,b=map(int, input().split())
x = list(map(int, input().split()))
x.sort()
p=0
q=0
y=0
for i in x:
    if p == 1 and q == 1:break
    if i == b:
        y=1
    if i%2==0:
        p=1
    else:
        q=1
if b<=x[-1] or y==1:
    if (b%2==0 and(p*q ==0)):
        m="POSSIBLE"
    elif p==1 and q==1:m="POSSIBLE"
    elif y==1:m="POSSIBLE"
else:m="IMPOSSIBLE" 
print(m)

Fixed submission:
N,K= map(int, input().split())
x = list(map(int, input().split()))
x = list(set(x))
x.sort()
t = max(x)
y = x[0]
s = [1000000000000]
o=0
if x[0] == K:o=1
for i in range(1,len(x)):
    s.append(x[i]-x[i-1])
    if x[i] == K:o = 1
s.sort()
m = min(y,s[0])
if (t>= K and K%m==0) or o==1:
    print("POSSIBLE")
else:
    print("IMPOSSIBLE")
Buggy python submission (verdict: Runtime Error):
a = ai()
x = lma()
k = [0]*a
s = 0
t = 0
for i in range(a):
    if i%2==0:
        k[s] = x[-1-i]
        s+=1
    else:
        k[-t-1] = x[-1-i]
        t+=1
print(k)

Fixed submission:
import collections
def a():return input()#s
def ai():return int(input())#a,n or k
def ma():return map(int, input().split())#a,b,c,d or n,k
def ms():return map(str, input().split())#,a,b,c,d
def lma():return list(map(int, input().split()))#x or y
def lms():return list(map(str, input().split()))#x or y
k= []
l = []
f = 0
def say(i):return print("Yes" if i == 0 else "No")
def Say(i):return print("YES" if i == 0 else "NO")
a = ai()
x = lma()
k = [0]*a
s = 0
t = 0
for i in range(a):
    if i%2==0:
        k[s] = x[-1-i]
        s+=1
    else:
        k[-t-1] = x[-1-i]
        t+=1
s = str(k[0])
for i in range(1,a):
    s+=" "+str(k[i])
print(s)
Buggy python submission (verdict: Time Limit Exceeded):
a = int(input())
l = []
for i in range(a):
    t = int(input())
    l.append((i,t-1))
dic=[0]
k=l[0][1]
ans=1
for i in range(a):
    if k == 1:
        print(ans)
        break
    elif k not in dic:
        dic.append(k)
        k=l[k][1]
        ans+=1
    else:
        print(-1)
        break

Fixed submission:
a = int(input())
l = []
for i in range(a):
    t = int(input())
    l.append((i,t-1))
dic={0}
k=l[0][1]
ans=1
for i in range(a):
    if k == 1:
        print(ans)
        break
    elif k not in dic:
        dic.add(k)
        k=l[k][1]
        ans+=1
    else:
        print(-1)
        break
Buggy python submission (verdict: Runtime Error):
import math
a,b = ma()
mod = 10**9 + 7
m = max(a,b)
n = min(a,b)
k=math.factorial(m)
if m!=n:
    print(((k**2)*m)%mod)
else:
    print(((k**2)*2)%mod)

Fixed submission:
import math
def a():return input()#s
def ai():return int(input())#a,n or k
def ma():return map(int, input().split())#a,b,c,d or n,k
def ms():return map(str, input().split())#,a,b,c,d
def lma():return list(map(int, input().split()))#x or y
def lms():return list(map(str, input().split()))#x or y
k= []
a,b = ma()
mod = 10**9 + 7
m = max(a,b)
n = min(a,b)
k=math.factorial(n)
if abs(a-b)>1:print(0)
elif m!=n:
    print(((k**2)*m)%mod)
else:
    print(((k**2)*2)%mod)
Buggy python submission (verdict: Runtime Error):
#C Colorful
import numpy as np
a = int(input())
x = list(map(int,input().split()))
x.sort()
x = x[::-1]
n =0
k = [0,0,0,0,0,0,0]
for i in x:
    if i > 3199:
        n +=1
    elif i < 400:
        k[0] = 1
    elif i < 800:
        k[1] = 1
    elif i < 1200:
        k[2] = 1
    elif i < 1600:
        k[3] = 1
    elif i < 2000:
        k[4] = 1
    elif i < 2400:
        k[5] = 1
    elif i < 2800:
        k[6] = 1
    elif i < 3200:
        k[7] = 1

c = np.array(k)
s = ss= c.sum()

if s < 8:
    ss += n
    if ss > 8:
        ss = 8
print (s)
print (ss)

Fixed submission:
n=input()
l=list(map(int,input().split()))
c=[0]*8
ma=0
for i in l:
    if i<3200:c[i//400]=1
    else:ma+=1
mi=sum(c)
print(max(mi,1),mi+ma)
Buggy python submission (verdict: Runtime Error):
#C Bugged
import numpy as np
a = int(input())
k   = []
k10 = []
s = 0

for j in range(a):
    i = int(input())
    if i % 10 == 0:
        k10.append(i)
        s += i
    else:
        k.append(i)
k.sort()
c = np.array(k)
l = c.sum()
if l%10==0 and len(k) !=0:
    l = l - c[0]
    s = s + l
elif:len(k) == 0
    s = 0
else:
    s = s + l
print(s)

Fixed submission:
#C Bugged
import numpy as np
a = int(input())
k   = []
k10 = []
s = 0

for j in range(a):
    i = int(input())
    if i % 10 == 0:
        k10.append(i)
        s += i
    else:
        k.append(i)
k.sort()
c = np.array(k)
l = c.sum()
if l%10==0 and len(k) !=0:
    l = l - c[0]
    s = s + l
elif len(k) == 0:
    s = 0
else:
    s = s + l
print(s)

Buggy python submission (verdict: Runtime Error):
#C Bugged
import numpy as np
a = int(input())
k   = []
k10 = []
s = 0

for j in range(a):
    i = int(input())
    if i % 10 == 0:
        k10.append(i)
        s += i
    else:
        k.append(i)
k.sort()
c = np.array(k)
l = c.sum()
if l%10==0 and len(k) !=0:
    l = l - c[0]
    s = s + l
elif:l == 0
    s = 0
else:
    s = s + l
print(s)

Fixed submission:
#C Bugged
import numpy as np
a = int(input())
k   = []
k10 = []
s = 0

for j in range(a):
    i = int(input())
    if i % 10 == 0:
        k10.append(i)
        s += i
    else:
        k.append(i)
k.sort()
c = np.array(k)
l = c.sum()
if l%10==0 and len(k) !=0:
    l = l - c[0]
    s = s + l
elif len(k) == 0:
    s = 0
else:
    s = s + l
print(s)

Buggy python submission (verdict: Runtime Error):
#C Bugged
import numpy as np
a = int(input())
k   = []
k10 = []
s = 0

for j in range(a):
    i = int(input())
    if i % 10 == 0:
        k10.append(i)
        ll = ll + i
    else:
        k.append(i)
c = np.array(k)
s += c.sum()
if s%10==0 and len(k) !=0:
    s = s - k[0]
    s = s + ll
elif s%10 ==0:
    s = 0
    s = s + ll
print(s)

Fixed submission:
#C Bugged
import numpy as np
a = int(input())
k   = []
k10 = []
s = 0

for j in range(a):
    i = int(input())
    if i % 10 == 0:
        k10.append(i)
        s += i
    else:
        k.append(i)
k.sort()
c = np.array(k)
l = c.sum()
if l%10==0 and len(k) !=0:
    l = l - c[0]
    s = s + l
elif len(k) == 0:
    s = 0
else:
    s = s + l
print(s)