Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
n = int(input())
hs = map(int, input().strip().split())

# print(hs)
max = 0
ans = 0
for i in range(n):
    if hs[i] >= max:
        ans +=1
        max = hs[i]

print(ans)

Fixed submission:
n = int(input())
hs = [int(h) for h in input().strip().split()]

# print(hs)
max = 0
ans = 0
for i in range(n):
    if hs[i] >= max:
        ans +=1
        max = hs[i]

print(ans)

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

print(hs)
max = 0
ans = 0
for i in range(n):
    if hs[i] >= max:
        ans +=1
        max = hs[i]

print(ans)

Fixed submission:
n = int(input())
hs = [int(h) for h in input().strip().split()]

# print(hs)
max = 0
ans = 0
for i in range(n):
    if hs[i] >= max:
        ans +=1
        max = hs[i]

print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
# _*_ coding: utf-8 _*_

n = int(input())
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())

t = 0
bounds = [a, b, c, d, e]
nums = [n, 0, 0, 0, 0, 0]

while(nums[5] < n): # not all people have arrived at the destination
    for i in range(6):
        come = min(nums[i-1], bounds[i-1]) if i != 0 else 0
        go = min(nums[i], bounds[i]) if i != 5 else 0
        nums[i] = max(nums[i] + come - go, 0)

    t += 1

print(t)

Fixed submission:
# _*_ coding: utf-8 _*_

n = int(input())

data = []
for i in range(5):
    data.append(int(input()))
flow = min(data)

if n % flow == 0:
    ans = n // flow + 4
else:
    ans = n // flow + 5

print(ans)
Buggy python submission (verdict: Runtime Error):
s = input().strip()

flag = 0
ok_list = ['A', 'T', 'C', 'G']

max_len = 0
start, end, i = 0, 0, 0

while i < len(s):
    if s[i] in ok_list:
        l = 0
        while s[i] in ok_list:
            i += 1
            l += 1

        if l > max_len:
            max_len = l

    else:
         i += 1

print(max_len)

Fixed submission:
s = input().strip()

ok_list = ['A', 'T', 'C', 'G']

max_len, i = 0, 0

while i < len(s):
    if s[i] in ok_list:
        l = 0
        while i < len(s) and s[i] in ok_list:
            i += 1
            l += 1

        if l > max_len:
            max_len = l

    else:
         i += 1

print(max_len)

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

flag = 0
ok_list = ['A', 'T', 'C', 'G']

max_len = 0
start, end, i = 0, 0, 0

while i < len(s):
    while s[i] not in ok_list:
        i += 1
    start = i

    while s[i] in ok_list:
        i += 1
    end = i

    tmp = s[start:end]
    if len(tmp) > max_len:
        max_len = len(tmp)


print(max_len)

Fixed submission:
s = input().strip()

ok_list = ['A', 'T', 'C', 'G']

max_len, i = 0, 0

while i < len(s):
    if s[i] in ok_list:
        l = 0
        while i < len(s) and s[i] in ok_list:
            i += 1
            l += 1

        if l > max_len:
            max_len = l

    else:
         i += 1

print(max_len)
Buggy python submission (verdict: Runtime Error):
from fractions import *
n = int(input())
a = [0]+list(map(int, input().split()))+[0]
b = [0]*(n+2)
c = [0]*(n+2)
for i in range(1, n+1):
	b[i] = gcd(b[i-1], a[i])
for i in range(n, 0, -1):
	c[i] = gcd(c[i+1], a[i])
print(max(gcd(b[i-1], c[i+1]) for i in range(1, n+1)))
#sample answer.

Fixed submission:
a,b,t=map(int,input().split())
print(t//a*b)
Buggy python submission (verdict: Runtime Error):
n=int(input())
v=list(map(int,input().split()))
c=list(map(int,input().split()))
cnt=0
for _ in range(n):
  if v[i]-c[i]>0:
    cnt+=v[i]-c[i]
print(cnt)

Fixed submission:
n=int(input())
v=list(map(int,input().split()))
c=list(map(int,input().split()))
cnt=0
for i in range(n):
  if v[i]-c[i]>0:
    cnt+=v[i]-c[i]
print(cnt)
Buggy python submission (verdict: Runtime Error):
import math
n=int(input())
a=[0]+list(map(int,input().split()))+[0]
b=a[::-1]
l=[0]*n
r=[0]*n
ans=[]
for i in range(1,n):
  l[i]=math.gcd(l[i-1],a[i-1])
for j in range(1,n):
  r[i]=math.gcd(r[i-1],b[i-1])
c=b[::-1]
for k in range(n):
  ans.append(math.gcd(l[k],r[k]))
print(max(ans))

Fixed submission:
from fractions import *
n = int(input())
a = [0]+list(map(int, input().split()))+[0]
b = [0]*(n+2)
c = [0]*(n+2)
for i in range(1, n+1):
	b[i] = gcd(b[i-1], a[i])
for i in range(n, 0, -1):
	c[i] = gcd(c[i+1], a[i])
print(max(gcd(b[i-1], c[i+1]) for i in range(1, n+1)))
#sample answer.
Buggy python submission (verdict: Runtime Error):
n=int(input())
h=list(map(int,input().split()))
i=0
cnt=0
for j in h:
  if i<=j:
    cnt+=1
    i=j
print(cnt)

Fixed submission:
a,b=map(int,input().split())
if a==b:
  print(a+b)
elif a<b:
  print(b+b-1)
else:
  print(a+a-1)
Buggy python submission (verdict: Runtime Error):
n=int(input())
i=0
cnt=0
for _ in range(n):
  j=int(input())
  if i<j:
    cnt+=1
    i=j
print(cnt)

Fixed submission:
n=int(input())
h=list(map(int,input().split()))
i=0
cnt=0
for j in h:
  if i<=j:
    cnt+=1
    i=j
print(cnt)
Buggy python submission (verdict: Runtime Error):
a=int(input())
b=int(input())
c=int(input())
d=int(input())
e=int(input())
k=int(input())
if e-a>=k
  print('Yay!')
else:
  print(':(')


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

Buggy python submission (verdict: Runtime Error):
a=int(input())
b=int(input())
c=int(input())
d=int(input())
e=int(input())
k=int(Input())
if e-a>=k
  print('Yay!')
else:
  print(':(')

Fixed submission:
a=int(input())
b=int(input())
c=int(input())
d=int(input())
e=int(input())
k=int(input())
if e-a<=k:
  print('Yay!')
else:
  print(':(')
Buggy python submission (verdict: Runtime Error):
x,y,z,k=map(int,input().split())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
c=list(map(int,input().split()))
a.sort(reverse=True)
b.sort(reverse=True)
c.sort(reverse=True)
tem=[]
ans=[]

for i in a:
  for j in b:
    tem.append(i+j)
    
tem=tem[:min(3001,x*y*z+1)]

for k in c:
  for l in tem:
    ans.append(k+l)
    
ans.sort()

for m in range(k):
  print(ans[m])

Fixed submission:
x,y,z,k = map(int,input().split())
lisa = list(map(int,input().split()))
lisb = list(map(int,input().split()))
lisc = list(map(int,input().split()))
lisa.sort(reverse=True)
lisb.sort(reverse=True)
lisc.sort(reverse=True)
an = []
ans = []
for num in lisb:
    for nu in lisa:
        an.append(num+nu)
an.sort(reverse=True)
an = an[:min(3001,x*y*z+1)]
for num in lisc:
    for nu in an:
        ans.append(num+nu)
ans.sort(reverse=True)
for i in range(k):
    print(ans[i])
#sample code.
Buggy python submission (verdict: Runtime Error):
n=int(input())
s=list(input())
for i in s:
  if 'R'==i:
    cnt+=1
if cnt<n-cnt:
  print('B')
else:
  print('R')

Fixed submission:
n=int(input())
s=list(input())
cnt=0
for i in s:
  if 'R'==i:
    cnt+=1
if cnt>n-cnt:
  print('Yes')
else:
  print('No')
Buggy python submission (verdict: Runtime Error):
N,M,C=map(int,input().split())
B=list(map(int,input().split()))
A=[list(map(int,input().split())) for _ in range(N)]
cnt=0
for a in A:
  ans=C
  for i in range(M):
    ans+=a[i]*B[i]
  if ans>0:
    cnt+=1
print(cnt)

Fixed submission:
H,W=map(int,input().split())
h,w=map(int,input().split())
print((H-h)*(W-w))
Buggy python submission (verdict: Runtime Error):
s=input()
zero=0
one=0
for i in s:
  if i="0":
    zero+=1
  elif i="1":
    one+=1
print(min(zero,one)*2)

Fixed submission:
s=input()
zero=0
one=0
for i in s:
  if i=="0":
    zero+=1
  elif i=="1":
    one+=1
print(min(zero,one)*2)
Buggy python submission (verdict: Runtime Error):
y,m,d=map(int,input().solit("/"))
if m<5:
  print("Heisei")
else:
  print("TBD")

Fixed submission:
y,m,d=map(int,input().split("/"))
if m<5:
  print("Heisei")
else:
  print("TBD")
Buggy python submission (verdict: Runtime Error):
n=int(input())
sub=dict()
for _ in range(n):
  x,u=input().split()
  if u in sub:
    sub[u]+=x
  else:
    sub[u]=x
print(float(sub["JPY"])+float(sub["BTC"])*380000.0)

Fixed submission:
N = int(input())
XU = [[_ for _ in input().split()] for _ in range(N)]
ans = 0
for x, u in XU:
    if u == 'BTC':
        ans += float(x) * 380000
    else:
        ans += int(x)
print(ans)
#copy code.

Buggy python submission (verdict: Runtime Error):
n=int(input())
sub=dict()
for _ in range(n):
  x,u=input().split()
  if u in sub:
    sub[u]+=x
  else:
    sub[u]=x
print(int(sub["JPY"])+int(sub["TBD"])*380000.0)

Fixed submission:
N = int(input())
XU = [[_ for _ in input().split()] for _ in range(N)]
ans = 0
for x, u in XU:
    if u == 'BTC':
        ans += float(x) * 380000
    else:
        ans += int(x)
print(ans)
#copy code.
Buggy python submission (verdict: Runtime Error):
N, A, B, C = map(int, input().split())
l = [int(input()) for i in range(N)]
INF=10**9

def dfs(cur, a, b, c):
if cur == N:
return abs(a - A) + abs(b - B) + abs(c - C) - 30 if min(a, b, c) > 0 else INF
ret0 = dfs(cur + 1, a, b, c)
ret1 = dfs(cur + 1, a + l[cur], b, c) + 10
ret2 = dfs(cur + 1, a, b + l[cur], c) + 10
ret3 = dfs(cur + 1, a, b, c + l[cur]) + 10
return min(ret0, ret1, ret2, ret3)

print(dfs(0, 0, 0, 0))
#example answer

Fixed submission:
N, A, B, C = map(int, input().split())
l = [int(input()) for i in range(N)]
INF=10**9

def dfs(cur, a, b, c):
  if cur == N:
    return abs(a - A) + abs(b - B) + abs(c - C) - 30 if min(a, b, c) > 0 else INF
  ret0 = dfs(cur + 1, a, b, c)
  ret1 = dfs(cur + 1, a + l[cur], b, c) + 10
  ret2 = dfs(cur + 1, a, b + l[cur], c) + 10
  ret3 = dfs(cur + 1, a, b, c + l[cur]) + 10
  return min(ret0, ret1, ret2, ret3)

print(dfs(0, 0, 0, 0))
#example answer
Buggy python submission (verdict: Runtime Error):
n=int(input())
l=list(map(int,input().split()))
ans="Yes"
for i in l:
  if i>=sum(L)-i:
    ans="No"
print(ans)

Fixed submission:
n=int(input())
l=list(map(int,input().split()))
ans="Yes"
for i in l:
  if i>=sum(l)-i:
    ans="No"
print(ans)
Buggy python submission (verdict: Runtime Error):
n,m=map(int,input().split())
x=list(map(int,input().split()))
n=[]
ans=0
if n>=m:
  print(0)
else:
  x.sort()
  for i in range(n-1):
    n.append(x[i+1]-x[i])
  n.sort(reverse=True)
  for j in range(n-1):
    ans+=n[i]
print(ans)

Fixed submission:
n,m=map(int,input().split())
x=list(map(int,input().split()))
l=[]
ans=0
if n<m:
  x.sort()
  for i in range(m-1):
    l.append(x[i+1]-x[i])
  l.sort()
  for j in range(m-n):
    ans+=l[j]
print(ans)

Buggy python submission (verdict: Runtime Error):
n,m=map(int,input().split())
x=list(map(int,input().split()))
l=[]
x.sort()
for i in range(1,len(x)):
  l.append(abs(x[i]-x[i-1]))
l.sort()
print(sum(l)-l[-1]-l[-2])

Fixed submission:
n,m=map(int,input().split())
x=list(map(int,input().split()))
l=[]
ans=0
if n<m:
  x.sort()
  for i in range(m-1):
    l.append(x[i+1]-x[i])
  l.sort()
  for j in range(m-n):
    ans+=l[j]
print(ans)

Buggy python submission (verdict: Runtime Error):
n,m=map(int,input().split())
x=list(map(int,input().split()))
x.sort()
l=[]
if n>m:
  print(0)
  exit()
for i in range(1,len(x)):  
  for j in range(i,len(x)):
    l.append(abs(x[0]-x[i-1])+abs(x[i]-x[j-1])+abs(x[j]-x[-1]))
print(min(n))


Fixed submission:
n,m=map(int,input().split())
x=list(map(int,input().split()))
l=[]
ans=0
if n<m:
  x.sort()
  for i in range(m-1):
    l.append(x[i+1]-x[i])
  l.sort()
  for j in range(m-n):
    ans+=l[j]
print(ans)

Buggy python submission (verdict: Runtime Error):
n,m=map(int,input().split())
x=list(map(int,input().split()))
x.sort()
n=[]
if n>m:
  print(0)
  exit()
for i in range(1,len(x)):  
  for j in range(i,len(x)):
    n.append(abs(x[0]-x[i-1])+abs(x[i]-x[j-1])+abs(x[j]-x[-1]))
print(min(n))


Fixed submission:
n,m=map(int,input().split())
x=list(map(int,input().split()))
l=[]
ans=0
if n<m:
  x.sort()
  for i in range(m-1):
    l.append(x[i+1]-x[i])
  l.sort()
  for j in range(m-n):
    ans+=l[j]
print(ans)

Buggy python submission (verdict: Runtime Error):
n,m=map(int,input().split())
x=list(map(int,input().split()))
x.sort()
n=[]
if n>,:
  print(0)
  exit()
for i in range(1,len(x)):  
  for j in range(i,len(x)):
    n.append(abs(x[0]-x[i-1])+abs(x[i]-x[j-1])+abs(x[j]-x[-1]))
print(min(n))


Fixed submission:
n,m=map(int,input().split())
x=list(map(int,input().split()))
l=[]
ans=0
if n<m:
  x.sort()
  for i in range(m-1):
    l.append(x[i+1]-x[i])
  l.sort()
  for j in range(m-n):
    ans+=l[j]
print(ans)

Buggy python submission (verdict: Runtime Error):
n,m=map(int,input().split())
x=list(map(int,input().split()))
x.sort()
n=[]
for i in range(1,len(x)):  
  for j in range(i,len(x)):
    n.append(abs(x[0]-x[i-1])+abs(x[i]-x[j-1])+abs(x[j]-x[-1]))
print(min(n))

Fixed submission:
n,m=map(int,input().split())
x=list(map(int,input().split()))
l=[]
ans=0
if n<m:
  x.sort()
  for i in range(m-1):
    l.append(x[i+1]-x[i])
  l.sort()
  for j in range(m-n):
    ans+=l[j]
print(ans)
Buggy python submission (verdict: Runtime Error):
n=int(input())
s=[list(input()) for _ in range(3)]
cnt=0
for i in range(len(s)):
  cnt+=len(set([s[0][i],s[1][i],s[2][i]]))-1
print(cnt)

Fixed submission:
n=int(input())
s=[list(input()) for _ in range(3)]
cnt=0
for i in range(n):
  cnt+=len(set([s[0][i],s[1][i],s[2][i]]))-1
print(cnt)

Buggy python submission (verdict: Runtime Error):
n=int(input())
s=[i for i in range(3)]
cnt=0
for j in range(n):
  cnt+=len(set(s[0][j],s[1][j],s[2][j])-1
print(cnt)

Fixed submission:
n=int(input())
s=[list(input()) for _ in range(3)]
cnt=0
for i in range(n):
  cnt+=len(set([s[0][i],s[1][i],s[2][i]]))-1
print(cnt)
Buggy python submission (verdict: Runtime Error):
s=int(input())
a=[s]
i=1
while len(a)==len(set(a)):
  if a[i-1]%2=0:
    a.append(a[i-1]//2)
  else:
    a.append(a[i-1]*3+1)
  i+=1
print(i)

Fixed submission:
s=int(input())
a=[s]
i=1
while len(a)==len(set(a)):
  if a[i-1]%2==0:
    a.append(a[i-1]//2)
  else:
    a.append(a[i-1]*3+1)
  i+=1
print(i)
Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
h=list(map(int,input().split()))
cnt=0
l=[]
while set(h)!={0}:
  if h.count(0)==0:
    cnt+=min(h)
    for i in range(len(h)):
      h[i]=h[i]-min(h)
  else:
    for i in range(len(h)):      
      if h[i]==0:
        l.append(h[i])
      else:
        l.append(h[i])
        continue
      cnt+=min(l)
      l=[]
print(cnt)

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

ans = 0
pre = 0
for i in h:
    if pre < i:
        ans += i-pre

    pre = i

print(ans)
#copy code

Buggy python submission (verdict: Runtime Error):
n=int(input())
h=list(map(int,input().split()))
cnt=0
while set(h)=={0}
  if h not in 0:
    for i in range(len(h)):
      h[i]=h[i]-min(h)
      cnt+=min(h)
  else:
    for i in range(len(h)):
      l=[]
      if h[i]==0:
      else:
        l.append(h[i])
        continue
      cnt+=min(l)
print(cnt)

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

ans = 0
pre = 0
for i in h:
    if pre < i:
        ans += i-pre

    pre = i

print(ans)
#copy code
Buggy python submission (verdict: Runtime Error):
s=list(input())
n=["k","e","y","e","n","c","e"]
ans=0
for i in n:
  for j in s:
    s.remove(j)
    if i==J:
      ans+=1
      break
  if ans==7:
    break
if ans=7:
  print("YES")
else:
  print("NO")

Fixed submission:
s = input()
for i in range(0, 8):
    if s[:i] + s[-(7-i):] == "keyence":
        print("YES")
        exit()
print("NO")
#copy code
Buggy python submission (verdict: Runtime Error):
n,k = map(int,input().split())
h = (list(map(int,input().split())))
ans =[0]*n
for i in range(1, n):
    s = max(i-k, 0)
    ans[i] = min(ans[s:i]+abs(h[s:i]-h[i]))
print(ans[-1])
#copy code

Fixed submission:
import numpy as np
n,k = map(int,input().split())
h = np.array(list(map(int,input().split())))
ans = np.zeros(n, dtype=int)
for i in range(1, n):
    s = max(i-k, 0)
    ans[i] = np.min(ans[s:i]+np.abs(h[s:i]-h[i]))
print(ans[-1])
#copy code
Buggy python submission (verdict: Runtime Error):
import numpy as np

n,l=map(int,inut().split())
w_all=np.zeros(l+1,dtype=int)

for _ in range(n):
  w,v=map(int,input().split())
  w_all=np.maximum(w_all[w:],w_all[:-w]+v)
  
print(w_all[w])

Fixed submission:
import numpy as np 

N, W = map(int, input().split())
w_all = np.zeros(W + 1, dtype=int)

for i in range(N):
  w, v = map(int, input().split())
  w_all[w:] = np.maximum(w_all[w:], w_all[:-w] + v)

print(w_all[W])
Buggy python submission (verdict: Runtime Error):
a,b,c=map(int,input().split())
if a+b+1<c:
    print(b+a+b+1)
elif a+b+1==c:
    print(b+c)
else a+b>c:
    if b+1>=c:
        print(c+1+c)
    elif b+1<c:
        print(b+c+1)

Fixed submission:
a,b,c=map(int,input().split())
if a+b+1<c:
    print(b+a+b+1)
elif a+b+1==c:
    print(b+c)
elif a+b+1>c:
    if b+1>=c:
        print(b+c)
    elif b+1<c:
        print(b+c)
Buggy python submission (verdict: Runtime Error):
l,n=map(int,input().split())
x=[int(input()) for i in range(n)]
y=x[::-1]
a=[]
b=[]
for j in x:
    a=abs(0-x[i])
    b=abs(l-y[i])
s=max(a[0],b[0])
for k in range(1,n):
    e+=max(a[k]+b[x])
print(e) 

Fixed submission:
L,N = list(map(int,input().split()))
X=[]
Y=[]
SX=[0]
SY=[0]
sx=0
sy=0
for i in range(N):
   x=int(input())
   X.append(x)
   sx+=x
   SX.append(sx)
   Y.append(L-x)
   sy+=L-x
   SY.append(sy)   

max_score=0   
for i in range(N):
    if i>N-i-1:
        max_score=max(2*(SX[i]-SX[2*i-N])+2*(SY[N]-SY[i+1])+Y[i],max_score)
    elif i<N-i-1:
        max_score=max(2*(SX[i]-SX[0])+2*(SY[2*i+2]-SY[i+1])+X[i],max_score)

        
    ind = min(i,N-i-1)
    max_score=max(2*(SX[i]-SX[i-ind])+2*(SY[i+ind+1]-SY[i+1])+X[i],max_score)
    max_score=max(2*(SX[i]-SX[i-ind])+2*(SY[i+ind+1]-SY[i+1])+Y[i],max_score)


print(max_score)
#copy code.
Buggy python submission (verdict: Runtime Error):
n,k=map(int,input().split())
h=[int(input()) for _ in range(n)]
h.sort()
ans=0

for i in range(n-k+1):
  if ans>h[i+k-1]-h[i]:
    ans=h[i+k-1]-h[i]
    
print(ans)


Fixed submission:
d=int(input())
print("Christmas"+" Eve"*(25-d))
Buggy python submission (verdict: Runtime Error):
n,k=map(int,input().split())
h=[i for i in range(n)]
h.sort()
l=[]
for i in range(k-2):
  l.append(abs(h[i]-h[i+k-1]))
print(min(l))

Fixed submission:
n,k=map(int,input().split())
h=[int(input()) for _ in range(n)]
h.sort()
l=[]
for i in range(len(h)-k+1):
  l.append(abs(h[i]-h[i+k-1]))
print(min(l))

Buggy python submission (verdict: Runtime Error):
n,k=map(int,input().split())
h=[i for i in range(n)]
h.sort()
l=[]
for i in range(k-2):
  l.appwnd(abs(h[i]-h[i+k-1]))
print(min(l))

Fixed submission:
n,k=map(int,input().split())
h=[int(input()) for _ in range(n)]
h.sort()
l=[]
for i in range(len(h)-k+1):
  l.append(abs(h[i]-h[i+k-1]))
print(min(l))
Buggy python submission (verdict: Runtime Error):
s=input()
l=[]
for i in range(len(s)-2):
  l.append(abs(753-int(s[i:i+3])))
print(min(l))

Fixed submission:
X=int(input())
if X==7 or X==5 or X==3:
    print("YES")
else:
    print("NO")

Buggy python submission (verdict: Runtime Error):
n=int(input())
print(["NO","YES"][if n in [7,5,3]])

Fixed submission:
X=int(input())
if X==7 or X==5 or X==3:
    print("YES")
else:
    print("NO")
Buggy python submission (verdict: Runtime Error):
n=int(input())

def dfs(s):
  if int(s)>n:
    return 0
  cnt=1 if all(s.count(i)>0 for i in '753') else 0
  for j in '753':
    cnt+=dfs(s+j)
  retunr cnt
  
print(dfs('0')

Fixed submission:
n=int(input())

def dfs(s):
  if int(s)>n:
    return 0
  cnt=1 if all(s.count(i)>0 for i in '753') else 0
  for j in '753':
    cnt+=dfs(s+j)
  return cnt
  
print(dfs('0'))
Buggy python submission (verdict: Runtime Error):
n,m=map(int,input().split())
a=[[] for _ in range(n)]
ans=[None]*n

for i in range(m):
  p,y=map(int,input().split())
  a.append((y,i))
  
for i,b in enumerate(a):
  b.sort()
  for j,(y,k) in b:
    ans[k]='%06d%06d' % (i+1,j+1)
    
print(*ans,sep='\n')

Fixed submission:
n,m=map(int,input().split())
a=[[] for _ in range(n)]
ans=[None]*m

for i in range(m):
  p,y=map(int,input().split())
  a[p-1].append((y,i))
  
for i,b in enumerate(a):
  b.sort()
  for j,(y,k) in enumerate(b):
    ans[k]='%06d%06d' % (i+1,j+1)
    
print(*ans,sep='\n')
Buggy python submission (verdict: Runtime Error):
n,t=map(int,input().split())
ct=[list(map(int,input().split())) for i in range(n)]
a=[]
for j in ct:
  if j[1]<t:
    a.append(j[0])
print(min(a))

Fixed submission:
n,t=map(int,input().split())
ct=[list(map(int,input().split())) for i in range(n)]
a=[]
for j in ct:
  if j[1]<=t:
    a.append(j[0])
if len(a)==0:
  print("TLE")
else:
  print(min(a))
Buggy python submission (verdict: Runtime Error):
a,b,c=map(int,input().split())
a=10-a
b=10-b
c=10-c
s=[a,b,c]
print("".join(s))

Fixed submission:
print(1110-int(input()))
Buggy python submission (verdict: Runtime Error):
n=int(input())
w=[input() for i in range(w)]
ans="Yes"
for j in range(1,len(w)):
  if w[j-1][len(w[j-1])-1]!=w[j][0]:
    ans="No"
print(ans)

Fixed submission:
n=int(input())
w=[input() for i in range(n)]
ans="Yes"
if len(set(w))!=n:
  ans="No"
for j in range(1,len(w)):
  if w[j-1][-1]!=w[j][0]:
    ans="No"
print(ans)
Buggy python submission (verdict: Runtime Error):
h,w=map(int,input().split())
a=[input() for i in range(h)]

for j in a:
  if '#' not in a:
    a.pop(j)
    h-=1
    
b=[]
c=''

for k in range(w):
  for l in range(h):
    c+=a[l][k]
  b.append(c)

for m in range(w):
  if '#' not in b:
    b.pop(m)
    w-=1
    
d=''

for o in range(h):
  for p in range(w):
    d+=b[p][o]
    print(d)
   

Fixed submission:
H, W = map(int, input().split())
a = []
for _ in range(H):
    i = list(input())
    if '#' in i:
        a.append(i)
ans = zip(*[i for i in zip(*a) if '#' in i])
for s in ans:
    print(*s, sep='')
#copy code
Buggy python submission (verdict: Runtime Error):
n=int(input())
total=0
for i in range(1,n+1,2):
  ans=0
  for j in range(1,i+1):
    if i%j==0:
      ans+=1
  if ans==8:
    total+=1
print(total)


Fixed submission:
a,b=map(int,input().split())
print((a-1)*(b-1))
Buggy python submission (verdict: Runtime Error):
n=int(input())
ans=0
total=0
for i in range(n+1):
  for j in range(201):
    if i%j==0:
      ans+=1
  if ans==8:
    total+=1
print(total)

Fixed submission:
n=int(input())
total=0
for i in range(1,n+1,2):
  ans=0
  for j in range(1,i+1):
    if i%j==0:
      ans+=1
  if ans==8:
    total+=1
print(total)
Buggy python submission (verdict: Runtime Error):
s=input()
ans='WA'
if s[0]=='A':
  if S[2:-1].count('C')==1:
    c=s.index('C')
    if s[1:c].islower() and s[c:].islower:
      ans='AC'
print(ans)

Fixed submission:
s=input()
ans='WA'
if s[0]=='A':
  if s[2:-1].count('C')==1:
    c=s.index('C')
    if s[1:c].islower() and s[c+1:].islower():
      ans='AC'
print(ans)
Buggy python submission (verdict: Runtime Error):
s=list(map(int,input().split())
s.sort()
print(s[2]-s[0])


Fixed submission:
s=list(map(int,input().split()))
s.sort()
print(s[2]-s[0])

Buggy python submission (verdict: Runtime Error):
s=list(map(int,input())
s.sort()
print(s[2]-s[0])


Fixed submission:
s=list(map(int,input().split()))
s.sort()
print(s[2]-s[0])

Buggy python submission (verdict: Runtime Error):
s=list(map(int,input())
s=s.sort()
print(s[1]-s[0])


Fixed submission:
s=list(map(int,input().split()))
s.sort()
print(s[2]-s[0])

Buggy python submission (verdict: Runtime Error):
s=list(int(input()))
s=s.sorted()
print(s[1]-s[0])

Fixed submission:
s=list(map(int,input().split()))
s.sort()
print(s[2]-s[0])
Buggy python submission (verdict: Runtime Error):
s=str(input())
t=str(input())
ans='No'
if s==t:
  ans='Yes'
for i in range(len(s)):
  s.append(s[0])
  if s==t:
    ans='Yes'
print(ans)


Fixed submission:
print("Yes" if input() in input()*2 else "No")
#copy code
Buggy python submission (verdict: Runtime Error):
n=int(input())
a=list(map(int,input().split()))
cnt=0
for i in range(n-1):
  if a[i]==a[i+1]:
    a[i+1]=a[i]+a[i+2]
    cnt+=1
print(cnt)

Fixed submission:
n=int(input())
a=list(map(int,input().split()))
l=[ int(i) for i in range(10000)]
b=set(a)
for j in b:
  l.remove(j)
cnt=0
for i in range(1,n):
  if a[i-1]==a[i]:
    a[i]=l.pop()
    cnt+=1
print(cnt)

Buggy python submission (verdict: Runtime Error):
n=int(input())
a=list(map(int,input().split()))
cnt=0
for i in range(1,len(a)):
  if a[i-1]=a[i]:
    cnt+=1
print(cnt)

Fixed submission:
n=int(input())
a=list(map(int,input().split()))
l=[ int(i) for i in range(10000)]
b=set(a)
for j in b:
  l.remove(j)
cnt=0
for i in range(1,n):
  if a[i-1]==a[i]:
    a[i]=l.pop()
    cnt+=1
print(cnt)