Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
S=list(input())
count=0

if  s='o':
  count+=1

print(count*100+700)

Fixed submission:
S=list(input())
count=0

if S[0]=='o':
  count+=1
if S[1]=='o':
  count+=1
if S[2]=='o':
  count+=1
  
print(count*100+700)

Buggy python submission (verdict: Runtime Error):
s=str(input())
price=700
count=0

if s[0]=='o':
  count+=1
else:
  continue
if s[1]=='o':
  count+=1
else:
  continue
if s[2]=='o':
  count+=1
else:
  continue
print(price+count*100)

Fixed submission:
S=list(input())
count=0

if S[0]=='o':
  count+=1
if S[1]=='o':
  count+=1
if S[2]=='o':
  count+=1
  
print(count*100+700)

Buggy python submission (verdict: Runtime Error):
s=list(map(str,input().split()))
price=700

for i in s:
  if s[i]=="o":
    price+=100
  else:
    price=price

print(price)

Fixed submission:
S=list(input())
count=0

if S[0]=='o':
  count+=1
if S[1]=='o':
  count+=1
if S[2]=='o':
  count+=1
  
print(count*100+700)

Buggy python submission (verdict: Runtime Error):
s=list(map(str,input().split()))
price=700

for i in range(s):
  if s[i]=="o":
    price+=100
  else:
    price=price

print(price)

Fixed submission:
S=list(input())
count=0

if S[0]=='o':
  count+=1
if S[1]=='o':
  count+=1
if S[2]=='o':
  count+=1
  
print(count*100+700)

Buggy python submission (verdict: Runtime Error):
s=list(map(str,input()))
price=700

for i in range(s):
  if s[i]=="o":
    price+=100
  else:
    price=price

print(price)

Fixed submission:
S=list(input())
count=0

if S[0]=='o':
  count+=1
if S[1]=='o':
  count+=1
if S[2]=='o':
  count+=1
  
print(count*100+700)

Buggy python submission (verdict: Runtime Error):
s=str(input())
price=700

for i in range(s.size):
  if s[i]=="o":
    price+=100

print(price)

Fixed submission:
S=list(input())
count=0

if S[0]=='o':
  count+=1
if S[1]=='o':
  count+=1
if S[2]=='o':
  count+=1
  
print(count*100+700)

Buggy python submission (verdict: Runtime Error):
s=str(input())
price=700

for i in range(s):
  if s[i]=="o":
    price+=100

print(price)

Fixed submission:
S=list(input())
count=0

if S[0]=='o':
  count+=1
if S[1]=='o':
  count+=1
if S[2]=='o':
  count+=1
  
print(count*100+700)

Buggy python submission (verdict: Runtime Error):
s=str(input())
price=700

if s[0]=o:
  price+=100
if s[1]=o:
  price+=100
if s[2]=o:
  price+=100
else:
  price=price

print(price)

Fixed submission:
S=list(input())
count=0

if S[0]=='o':
  count+=1
if S[1]=='o':
  count+=1
if S[2]=='o':
  count+=1
  
print(count*100+700)

Buggy python submission (verdict: Runtime Error):
s=str(input())
price=700

if s[0]=o:
  price+=100
if s[1]=o:
  price+=100
if s[2]=o:
  price+=100

print(price)

Fixed submission:
S=list(input())
count=0

if S[0]=='o':
  count+=1
if S[1]=='o':
  count+=1
if S[2]=='o':
  count+=1
  
print(count*100+700)
Buggy python submission (verdict: Runtime Error):
n,x=map(int,input().split())
m=[int(input()) for i in range(n)]
cnt=0
mass=0
cnt+=n

for i in range(n):
  mass+=int(m[i])
  
if (x-mass)>=min(m):
  for j in range(1,n):
    ans=(x-mass)-min(int(m))
    cnt+=1
    if ans<0:
      break
  print(cnt-1)

else:
  print(cnt)

Fixed submission:
n,x=map(int,input().split())
m=[int(input()) for i in range(n)]
cnt=0
mass=0
cnt+=n

for i in range(n):
  mass+=int(m[i])
ans=(x-mass)//min(m)
print(ans+cnt)
Buggy python submission (verdict: Runtime Error):
n=int,input()
a=int,input()

if n%500==0:
    print('Yes')
elif n%500<=a:
    print('Yes')
else:
    print('No')

Fixed submission:
n=int(input())
a=int(input())

if n%500==0:
    print('Yes')
elif n%500<=a:
    print('Yes')
else:
    print('No')

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

if n%500==0:
    print('Yes')
elif n%500<=a:
    print('Yes')
else: n%500>a:
    print('No')

Fixed submission:
n=int(input())
a=int(input())

if n%500==0:
    print('Yes')
elif n%500<=a:
    print('Yes')
else:
    print('No')

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

if n%500==0:
    print('Yes')
elif n%500<=a:
    print('Yes')
elif n%500>a:
    print('No')

Fixed submission:
n=int(input())
a=int(input())

if n%500==0:
    print('Yes')
elif n%500<=a:
    print('Yes')
else:
    print('No')
Buggy python submission (verdict: Runtime Error):
a,b=int(input())

x=(a+b)//2

print(x)

Fixed submission:
import math

a,b=map(int,input().split())
x=(a+b)/2

print(math.ceil(x))
Buggy python submission (verdict: Runtime Error):
s=str(input())

for i in range(len(s)):
  if s.index(s[i]) % 2 == 0:
    del s[i]
  else:
    continue
print(s)

Fixed submission:
s=str(input())
ans=str('')
for i in range(0,len(s),2):
  ans+=s[i]
print(ans)

Buggy python submission (verdict: Runtime Error):
s=str(input())

for i in range(len(s)):
  if s.index(s[i]) % 2 == 0:
    del s[i]
print(s)

Fixed submission:
s=str(input())
ans=str('')
for i in range(0,len(s),2):
  ans+=s[i]
print(ans)
Buggy python submission (verdict: Runtime Error):
S=str(input())
size=len(S)

print(S[0]+int(int(size)-2)+S[-1])

Fixed submission:
S=str(input())
size=len(S)

print(S[0]+str(int(size)-2)+S[-1])

Buggy python submission (verdict: Runtime Error):
S=str(input())
size=len(S)

print(S[0]+(int(size)-2)+S[-1])

Fixed submission:
S=str(input())
size=len(S)

print(S[0]+str(int(size)-2)+S[-1])

Buggy python submission (verdict: Runtime Error):
S=str(input())

print(S[0:]+(S.count(S)-2)+S[-1:])

Fixed submission:
S=str(input())
size=len(S)

print(S[0]+str(int(size)-2)+S[-1])

Buggy python submission (verdict: Runtime Error):
S=str(input())

print(S[0]+(S.count(S)-2)+S[-1])

Fixed submission:
S=str(input())
size=len(S)

print(S[0]+str(int(size)-2)+S[-1])

Buggy python submission (verdict: Runtime Error):
S=str(input())

print(S[0]+(S.count(S)-2)+S[-0])

Fixed submission:
S=str(input())
size=len(S)

print(S[0]+str(int(size)-2)+S[-1])
Buggy python submission (verdict: Runtime Error):
n=int(input())

for i in (1,n):
  if 2**i>n
    print(2**(i-1))

Fixed submission:
n=int(input())

for i in range(1,8):
  if 2**i>n:
    n=2**(i-1)
    break
  if 1==n:
    break
  if 2**i==n:
    break
    
print(n)
Buggy python submission (verdict: Runtime Error):
s=str(input())
S=int()
G=int()

#Sに最初のAのインデックスを取得
for i in range(len(s)):
  if s[i]=='A':
    S=s.index(s[i])
    break
    
ss=s[::-1]

#Gに最後のZのインデックスを取得
for j in range(len(ss)):
  if ss[j]=='Z':
    G=len(ss)-j-1
    break
print(G-S+1

Fixed submission:
s=str(input())
S=int()
G=int()

#Sに最初のAのインデックスを取得
for i in range(len(s)):
  if s[i]=='A':
    S=s.index(s[i])
    break
    
ss=s[::-1]

#Gに最後のZのインデックスを取得
for j in range(len(ss)):
  if ss[j]=='Z':
    G=len(ss)-j-1
    break
print(G-S+1)

Buggy python submission (verdict: Runtime Error):
s=str(input())
S=int()
G=int()

for i in range(len(s)):
  if s[i]=='a':
    S=s.index(s[i])
    break
for i in reversed(range(len(s))):
  if s[i]=='z':
    G=s.index(s[i])
    break
print(G-S+1

Fixed submission:
s=str(input())
S=int()
G=int()

#Sに最初のAのインデックスを取得
for i in range(len(s)):
  if s[i]=='A':
    S=s.index(s[i])
    break
    
ss=s[::-1]

#Gに最後のZのインデックスを取得
for j in range(len(ss)):
  if ss[j]=='Z':
    G=len(ss)-j-1
    break
print(G-S+1)

Buggy python submission (verdict: Runtime Error):
s=str(input())

for i in range(len(s)):
  if s[i]=='a':
    S=s.index(s[i])
    break
for j in reversed(range(len(s)):
  if s[j]=='z':
    G=s.index(s[j])
    break
print(G-S+1)

Fixed submission:
s=str(input())
S=int()
G=int()

#Sに最初のAのインデックスを取得
for i in range(len(s)):
  if s[i]=='A':
    S=s.index(s[i])
    break
    
ss=s[::-1]

#Gに最後のZのインデックスを取得
for j in range(len(ss)):
  if ss[j]=='Z':
    G=len(ss)-j-1
    break
print(G-S+1)
Buggy python submission (verdict: Time Limit Exceeded):
k,s=map(int,input().split())
cnt=0

for x in range(k+1):
  for y in range(k+1):
    for z in range(k+1):
      if x+y+z==s:
        cnt+=1
print(cnt)


Fixed submission:
k,s=map(int,input().split())
cnt=0

for x in range(k+1):
  for y in range(k+1):
    z=s-x-y
    if x+y<=s and z<=k:
      cnt+=1
print(cnt)

Buggy python submission (verdict: Time Limit Exceeded):
k,s=map(int,input().split())
cnt=0

for x in range(k+1):
  for y in range(k+1):
    for z in range(k+1):
      if x+y+z==s:
        cnt+=1
      else:
        continue
print(cnt)

Fixed submission:
k,s=map(int,input().split())
cnt=0

for x in range(k+1):
  for y in range(k+1):
    z=s-x-y
    if x+y<=s and z<=k:
      cnt+=1
print(cnt)
Buggy python submission (verdict: Runtime Error):
A=input()
B=input()
ans_list=[1,2,3]
for ans in ans_list:
  if ans!=A and ans!=B:
    return ans
  

Fixed submission:
A=input()
B=input()
ans_list=[1,2,3]
for ans in ans_list:
    if ans!=int(A) and ans !=int(B):
        print(ans)
Buggy python submission (verdict: Runtime Error):
A,B = input().split()
A=int(A)
B =int(B)
for i in range(1,B+1):
  if A*i%B ==0:
    print(A*i)

Fixed submission:
N=input()
S,T=input().split()
strings=[]
for i in range(int(N)):
    strings.append(S[i]+T[i])
print(''.join(strings))

Buggy python submission (verdict: Runtime Error):

N=input()
S=input()
T=input()

strings=[]
for i in range(int(N)):
    strings.append(S[i]+T[i])
    
print(''.join(strings))

Fixed submission:
N=input()
S,T=input().split()
strings=[]
for i in range(int(N)):
    strings.append(S[i]+T[i])
print(''.join(strings))

Buggy python submission (verdict: Runtime Error):
N=input()
S=input()
T=input()

strings=[]
for s,t in zip(S,T):
    strings.append(s+t)
print(''.join( strings))

Fixed submission:
N=input()
S,T=input().split()
strings=[]
for i in range(int(N)):
    strings.append(S[i]+T[i])
print(''.join(strings))
Buggy python submission (verdict: Runtime Error):
A,B = input().split()

for i in range(1,B+1):
  if A*i%B==0:
    print(A*i)
   

Fixed submission:
A,B = input().split()
A=int(A)
B =int(B)
if A<B:
  for i in range(1,B+1):
    if A*i%B ==0:
      print(A*i)
      break
else:
  for i in range(1,A+1):
    if B*i%A ==0:
      print(B*i)
      break
Buggy python submission (verdict: Runtime Error):
a1=input()
a2=input()
print(6-a1-a2)

Fixed submission:
a1=int(input())
a2=int(input())
print(6-a1-a2)

Buggy python submission (verdict: Runtime Error):
a1 = input()
a2 = input()

x = [1, 2, 3]

x = x.remove(a1)
x = x.remove(a2)

print(x)

Fixed submission:
a1=int(input())
a2=int(input())
print(6-a1-a2)
Buggy python submission (verdict: Runtime Error):
n = input()
A, B = input().split()
c = ""

for i in range(n):
  c = c+A[i]
  c = c+B[i]

print(c)

Fixed submission:
n = int(input())
A, B = input().split()
c = ""

for i in range(n):
  c = c+A[i]
  c = c+B[i]

print(c)

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

for i in range (n):
  a.append(s[n])
  a.append(t[n])
  
print(n)

Fixed submission:
n = int(input())
A, B = input().split()
c = ""

for i in range(n):
  c = c+A[i]
  c = c+B[i]

print(c)
Buggy python submission (verdict: Runtime Error):
#入力
day = input()


if day == "MON":
  answer = 6
  
if day == "TUE":
  answer = 5
if day == "WEN":
  answer = 4
if day == "TUR":
  answer = 3
if day == "FRY":
  answer = 2
if day == "SAT":
  answer = 1
if day == "SUN":
  answer = 7

print(answer)


Fixed submission:
#入力
day = input()


if day == "MON":
  answer = 6
  
if day == "TUE":
  answer = 5
if day == "WED":
  answer = 4
if day == "THU":
  answer = 3
if day == "FRI":
  answer = 2
if day == "SAT":
  answer = 1
if day == "SUN":
  answer = 7

print(answer)
Buggy python submission (verdict: Runtime Error):
a = input()
b=3*a*a
print (b)


Fixed submission:
a = int(input())
b=3*a*a
print (b)
Buggy python submission (verdict: Runtime Error):
n=int(input())
for _ in range(n):
     s,t=input().split()
     c=''
     i=0
     j=0
     f=0
     for _ in range(len(s)+len(t)):
         if f==0:
             c+=s[i]
             i+=1
             f=1
         else:
             c+=t[j]
             j+=1
             f=0
     print(c)

Fixed submission:
n=int(input())

s,t=input().split()
c=''
i=0
j=0
f=0
for _ in range(len(s)+len(t)):
          if f==0:
             c+=s[i]
             i+=1
             f=1
          else:
              c+=t[j]
              j+=1
              f=0
print(c)
Buggy python submission (verdict: Runtime Error):
n=int(input())

if n%2==1:
    print(0)
    exit(0)
def findTrailingZeros(n):
    # Initialize result
    count = 0

    i = 10

    while (i<=n):
        count+=floor(n/i)
        i *= 5

    return count
get5s=findTrailingZeros(n)
print(get5s)



Fixed submission:
n=int(input())


def findTrailingZeros(n):
    # Initialize result
    count = 0

    i = 10

    while (i<=n):
        count+=n//i
        i *= 5

    return count


if n % 2 == 1:
    print(0)
else:
 get5s=findTrailingZeros(n)
 print(get5s)
Buggy python submission (verdict: Runtime Error):
x,y=map(int,input().split())
m={1:300000,2:200000,3:100000}
ans=m[x]+m[y]
if x==y:
    ans+=400000
print(ans)

Fixed submission:
x,y=map(int,input().split())
m={1:300000,2:200000,3:100000}
ans=0
if x<=3:
   ans=m[x]
if y<=3:
    ans+=m[y]
if x==y and y==1:
    ans+=400000
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
a=list(map(int,input().split()))
ans=float('inf')
for i in range(1,n):
    s1=sum(a[0:i])
    s2=sum(a[i:])
    ans=min(ans,abs(s1-s2))
print(ans)

Fixed submission:
n=int(input())
a=list(map(int,input().split()))
ans=float('inf')
s=sum(a)
s1 = a[0]
s2 = s-s1
ans = min(ans, abs(s1 - s2))
for i in range(1,n):
    s1+=a[i]
    s2-=a[i]
    ans = min(ans, abs(s1 - s2))

print(ans)
Buggy python submission (verdict: Runtime Error):
import sys
sys.setrecursionlimit(20000)
def getMax(d,n,c):
    global bs
    if len(d[n])==0:
        bs=max(bs,c)

    for k in d[n]:
        getMax(d,k,c+1)

n,m=map(int,input().split())
d={}
for j in range(1,n+1):
    d[j]=[]
for i in range(m):
    a,b=map(int,input().split())
    d[a].append(b)
bs=-1
for i in range(1,n+1):
    c=0
    getMax(d,i,c)
print(bs)


Fixed submission:
n=int(input())
h=list(map(int,input().split()))
dp=[0 for _ in range(n)]
dp[0]=0
dp[1]=abs(h[0]-h[1])
for i in range(2,n):
    x=dp[i-1]+abs(h[i-1]-h[i])
    x1 = dp[i - 2] + abs(h[i - 2] - h[i])
    dp[i]=min(x,x1)
print(dp[-1])

Buggy python submission (verdict: Runtime Error):
def recur(n,h,s,j):
    #print(s,j)
    if s==n:
        return abs(h[n-1]-h[n-2])
    if s==n-1:
     #   print("ret")
        return abs(h[n-1]-h[s-j])
    else:
         
          return abs(h[s]-h[s-j])+min(recur(n,h,s+1,1),recur(n,h,s+2,2))
        
    
n=int(input())
h=list(map(int,input().split()))
print(min(recur(n,h,1,1),recur(n,h,2,2)))

Fixed submission:
n=int(input())
h=list(map(int,input().split()))
dp=[0 for _ in range(n)]
dp[0]=0
dp[1]=abs(h[0]-h[1])
for i in range(2,n):
    x=dp[i-1]+abs(h[i-1]-h[i])
    x1 = dp[i - 2] + abs(h[i - 2] - h[i])
    dp[i]=min(x,x1)
print(dp[-1])
Buggy python submission (verdict: Runtime Error):
n=int(input())
def recuur(g,x,y,z):
     global n

     if z==n-1:
        return y
     if x==1:
         return y+max(recuur(g,2,g[z+1][2],z+1),recuur(g,0,g[z+1][0],z+1))
     if x==2:
         return y+max(recuur(g,1,g[z+1][1],z+1),recuur(g,0,g[z+1][0],z+1))
     if x==0:
         return y+max(recuur(g,2,g[z+1][2],z+1),recuur(g,1,g[z+1][1],z+1))

g=[[0,0,0] for _ in range(n)]
for u in range(n):
    a,b,c=map(int,input().split())
    g[u][1],g[u][2],g[u][0]=b,c,a
dp=[ [0,0] for _ in range(n)]
dp[0]=[max(g[0]),g[0].index(max(g[0]))]
print(recuur(g,dp[0][1],dp[0][0],0))

Fixed submission:
n=int(input())
a=[[0,0,0] for _ in range(n)]
for j in range(n):
  a[j][0],a[j][1],a[j][2]=map(int,input().split())
dp=[[0,0,0] for _ in range(n)]
dp[0][0]=a[0][0]
dp[0][1]=a[0][1]
dp[0][2]=a[0][2]
for i in range(1,n):
    dp[i][0]=a[i][0]+max(dp[i-1][1],dp[i-1][2])
    dp[i][1] = a[i][1] + max(dp[i - 1][0], dp[i - 1][2])
    dp[i][2] = a[i][2] + max(dp[i - 1][1], dp[i - 1][0])
print(max(dp[n-1][0],max(dp[n-1][1],dp[n-1][2])))
Buggy python submission (verdict: Time Limit Exceeded):
n,w=map(int,input().split())
val=[]
we=[]
for i in range(n):
  a,b=map(int,input().split())
  we.append(a)
  val.append(b)
dp=[[0 for _ in range(w+1)]for _ in range(n+1)]
for i in range(n+1):
  for j in range(w+1):
    if i==0 or j==0:
      continue
    if we[i-1]>j:
      dp[i][j]=dp[i-1][j]
    else:
      dp[i][j]=max(dp[i-1][j],val[i-1]+dp[i-1][j-we[i-1]])
print(dp[n][w])

Fixed submission:
n,w=map(int,input().split())
val=[]
we=[]
for i in range(n):
  a,b=map(int,input().split())
  we.append(a)
  val.append(b)
dp=[[0 for _ in range(w+1)]for _ in range(n+1)]
for i in range(n+1):
  for j in range(w+1):
    if i==0 or j==0:
      continue
    if we[i-1]>j:
      dp[i][j]=dp[i-1][j]
    else:
      dp[i][j]=max(dp[i-1][j],val[i-1]+dp[i-1][j-we[i-1]])
print(dp[n][w])

Buggy python submission (verdict: Time Limit Exceeded):
n,w=map(int,input().split())
we=[]
va=[]
for j in range(n):
    w1,v=map(int,input().split())
    we.append(w1)
    va.append(v)
dp=[[ 0 for _ in range(w+1)]for _ in range(n+1)]
for i in range(n+1):
    for j in range(w+1):
        if i==0 or j==0:
            dp[i][j]=0
        else:
            if j>=we[i-1]:
                dp[i][j]=max(va[i-1]+dp[i-1][j-we[i-1]],dp[i-1][j])
            else:
                dp[i][j]=dp[i-1][j]
print(dp[n][w])

Fixed submission:
n,w=map(int,input().split())
val=[]
we=[]
for i in range(n):
  a,b=map(int,input().split())
  we.append(a)
  val.append(b)
dp=[[0 for _ in range(w+1)]for _ in range(n+1)]
for i in range(n+1):
  for j in range(w+1):
    if i==0 or j==0:
      continue
    if we[i-1]>j:
      dp[i][j]=dp[i-1][j]
    else:
      dp[i][j]=max(dp[i-1][j],val[i-1]+dp[i-1][j-we[i-1]])
print(dp[n][w])

Buggy python submission (verdict: Runtime Error):
n,w=map(int,input().split())
a=[[0,0] for _ in range(n)]
vw=[[0,0] for _ in range(n)]
for j in range(n):
    a[j][0],a[j][1]=map(int,input().split())
    vw[j][0],vw[j][1]=a[j][1]/a[j][0],j
vw.sort(reverse=True)
print(vw,a)
j=0
v=0
while(w>0):
    print(w,a[vw[j][1]][0],a)
    d=min(w,a[vw[j][1]][0])
    print(d)
    v=v+d*vw[j][0]
    w=w-d
    a[j][1]-=d
    print(v, w, a[j][1],vw[j][0]*d)
    j+=1
  #  print(v,w,a[j][1])
print(int(v))

Fixed submission:
n,w=map(int,input().split())
val=[]
we=[]
for i in range(n):
  a,b=map(int,input().split())
  we.append(a)
  val.append(b)
dp=[[0 for _ in range(w+1)]for _ in range(n+1)]
for i in range(n+1):
  for j in range(w+1):
    if i==0 or j==0:
      continue
    if we[i-1]>j:
      dp[i][j]=dp[i-1][j]
    else:
      dp[i][j]=max(dp[i-1][j],val[i-1]+dp[i-1][j-we[i-1]])
print(dp[n][w])
Buggy python submission (verdict: Time Limit Exceeded):
import sys
sys.setrecursionlimit(20000)
def getMax(d,n,c):
    global bs
    if len(d[n])==0:
        bs=max(bs,c)

    for k in d[n]:
        getMax(d,k,c+1)

n,m=map(int,input().split())
d={}
for j in range(1,n+1):
    d[j]=[]
for i in range(m):
    a,b=map(int,input().split())
    d[a].append(b)
bs=-1
for i in range(1,n+1):
    c=0
    getMax(d,i,c)
print(bs)


Fixed submission:
import sys

sys.setrecursionlimit(20000)


def getMax(d, n):
    if len(d[n]) == 0:
        return 0
    if not dp[n] == -1:
      
        return dp[n]
    for k in d[n]:
        dp[n] = max(dp[n], 1 + getMax(d, k))
    return dp[n]


n, m = map(int, input().split())
d = {}
dp = [-1 for _ in range(n + 1)]
for j in range(1, n + 1):
    d[j] = []
for i in range(m):
    a, b = map(int, input().split())
    d[a].append(b)
bs = -1
for i in range(1, n + 1):
    bs = max(bs, getMax(d,i))
print(bs)

Buggy python submission (verdict: Runtime Error):
def getMax(d,n,c):
    global bs
    if len(d[n])==0:
        bs=max(bs,c)

    for k in d[n]:
        getMax(d,k,c+1)

n,m=map(int,input().split())
d={}
for j in range(1,n+1):
    d[j]=[]
for i in range(m):
    a,b=map(int,input().split())
    d[a].append(b)
bs=-1
for i in range(1,n+1):
    c=0
    getMax(d,i,c)
print(bs)

Fixed submission:
import sys

sys.setrecursionlimit(20000)


def getMax(d, n):
    if len(d[n]) == 0:
        return 0
    if not dp[n] == -1:
      
        return dp[n]
    for k in d[n]:
        dp[n] = max(dp[n], 1 + getMax(d, k))
    return dp[n]


n, m = map(int, input().split())
d = {}
dp = [-1 for _ in range(n + 1)]
for j in range(1, n + 1):
    d[j] = []
for i in range(m):
    a, b = map(int, input().split())
    d[a].append(b)
bs = -1
for i in range(1, n + 1):
    bs = max(bs, getMax(d,i))
print(bs)
Buggy python submission (verdict: Time Limit Exceeded):
x = int(input())
l = int(x/105)
u = int(x/100)+1
flag = False
for n in range(l, u):
    for a in range(0, u):
        for b in range(0, u):
            for c in range(0, u):
                for d in range(0, u):
                    for e in range(0, u):
                        for f in range(0, u):
                            if 100*a + 101*b + 102*c + 103*d + 104*e + 105*f == x:
                                #print(a,b,c,d,e,f)
                                flag = True
                                break
                            if flag == True: break
                        if flag == True: break
                    if flag == True: break
                if flag == True: break
            if flag == True: break
        if flag == True: break
    if flag == True: break

if flag:
    print('1')
else:
    print('0')

Fixed submission:
x = int(input())
l = int(x/105)
u = int(x/100)+1
flag = False
for n in range(l, u):
    for a in range(0, u):
        for b in range(0, u-a):
            for c in range(0, u-a-b):
                for d in range(0, u-a-b-c):
                    for e in range(0, u-a-b-c-d):
                        for f in range(0, u-a-b-c-d-e):
                            if 100*a + 101*b + 102*c + 103*d + 104*e + 105*f == x:
                                #print(a,b,c,d,e,f)
                                flag = True
                                break
                            if flag == True: break
                        if flag == True: break
                    if flag == True: break
                if flag == True: break
            if flag == True: break
        if flag == True: break
    if flag == True: break

if flag:
    print('1')
else:
    print('0')
Buggy python submission (verdict: Runtime Error):
i = input()
if i[0] == i[1] == i[2]:
    print('Yes')
elif i[1] == i[2] == i[e]:
    print('Yes')
else:
    print('No')

Fixed submission:
i = input()
if i[0] == i[1] == i[2]:
    print('Yes')
elif i[1] == i[2] == i[3]:
    print('Yes')
else:
    print('No')
Buggy python submission (verdict: Runtime Error):
import math
S=input()
S_list=[*S]
sumup=0
print(len(S_list))
if len(S_list)%2==0:
  for i in range(math.floor(len(S_list)/2)):
    if S_list[i]!=S_list[len(S_list)-i-1]:
      sumup+=1
  print(sumup)
else:
  for i in range(math.floor((len(S_list)-1)/2)):
    if S_list[i]!=S_list[len(S_list)-i-1]:
      sumup+=1
  print(sumup)

Fixed submission:
import math
s=input()
S_list = [s[i: i+1] for i in range(0, len(s))]
sumup=0
if len(S_list)%2==0:
  for i in range(math.floor(len(S_list)/2)):
    if S_list[i]!=S_list[len(S_list)-i-1]:
      sumup+=1
  print(sumup)
else:
  for i in range(math.floor((len(S_list)-1)/2)):
    if S_list[i]!=S_list[len(S_list)-i-1]:
      sumup+=1
  print(sumup)
Buggy python submission (verdict: Runtime Error):
import math
N=int(input())
if isinstance(i(N+1)/1.08, int):
  X=math.floor((N+1)/1.08))-1
else:
  X=math.floor((N+1)/1.08))
if X < N/1.08:
  print(":(")
else:
  print(X)

Fixed submission:
import math
N=int(input())
if ((N+1)/1.08).is_integer():
  X=math.floor((N+1)/1.08)-1
else:
  X=math.floor((N+1)/1.08)
if X < N/1.08:
  print(":(")
else:
  print(X)
Buggy python submission (verdict: Runtime Error):
S=input()
S_dic={"sun":7,"MON":1,"TUE":2,"WED":3,"THU":4,"FRI":5,"SAT":6}
print(7-S_dic[S])

Fixed submission:
S=input()
S_dic={"SUN":0,"MON":1,"TUE":2,"WED":3,"THU":4,"FRI":5,"SAT":6}
print(7-S_dic[S])
Buggy python submission (verdict: Runtime Error):
import math

a,b = map(int,input().split())

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

print(lcm(a, b))

Fixed submission:
import fractions

a,b = map(int,input().split())

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

print(lcm(a, b))