Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
from collections import Counter
N=int(input())
A=list(map(int,input().split()))
ans=0
if N%2!=0:
    c=list(Counter(A).items())
    c.sort(reverse=True)
    for a,b in c:
        if a!=0 and b==2:
            ans+=1
        elif a==0 and b==1:
            print(2**ans/(10**9+7))
        else:
            print(0)
            break
else:
    if A.count(0)>0:
        print(0)
    else:
        c=list(Counter(A).items())
        c.sort(reverse=True)
        for a,b in c:
            if a!=1 and b==2:
                ans+=1
            elif a==1 and b==2:
                ans+=1
                print(2**ans/(10**9+7))
            else:
                print(0)
                break


Fixed submission:
from collections import Counter
N=int(input())
A=list(map(int,input().split()))
ans=0
if N%2!=0:
    c=list(Counter(A).items())
    c.sort(reverse=True)
    for a,b in c:
        if a!=0 and b==2:
            ans+=1
        elif a==0 and b==1:
            print(2**ans%(10**9+7))
        else:
            print(0)
            break
else:
    if A.count(0)>0:
        print(0)
    else:
        c=list(Counter(A).items())
        c.sort(reverse=True)
        for a,b in c:
            if a!=1 and b==2:
                ans+=1
            elif a==1 and b==2:
                ans+=1
                print(2**ans%(10**9+7))
            else:
                print(0)
                break
Buggy python submission (verdict: Runtime Error):
ss = input().split()
N = int(ss[0])
K = int(ss[1])
Q = int(ss[2])
As = []

SCORE = [0] * N

for i in range(Q):
  SCORE[int(input())-1] += 1
for i in range(N):
  if(SCORE[i]<= Q-K):
    print("No")
  else:
    print("Yes")

Fixed submission:
s = input()

if s == "Sunny":
  print("Cloudy")
if s == "Cloudy":
  print("Rainy")
if s == "Rainy":
  print("Sunny")
Buggy python submission (verdict: Time Limit Exceeded):
ss = input().split()
N = int(ss[0])
K = int(ss[1])
Q = int(ss[2])
As = []

SCORE = [K] * N

for i in range(Q):
  XX = map(lambda x: x - 1, SCORE)
  SCORE = list(XX)
  SCORE[int(input())-1] += 1
for i in range(N):
  if(SCORE[i]<1):
    print("No")
  else:
    print("Yes")

Fixed submission:
ss = input().split()
N = int(ss[0])
K = int(ss[1])
Q = int(ss[2])
As = []

SCORE = [0] * N

for i in range(Q):
  SCORE[int(input())-1] += 1
for i in range(N):
  if(SCORE[i]<= Q-K):
    print("No")
  else:
    print("Yes")

Buggy python submission (verdict: Time Limit Exceeded):
ss = input().split()
N = int(ss[0])
K = int(ss[1])
Q = int(ss[2])
As = []
for i in range(Q):
  As.append(int(input()))
SCORE = [K] * N
for i in range(Q):
  XX = map(lambda x: x - 1, SCORE)
  SCORE = list(XX)
  SCORE[As[i]-1] += 1
for i in range(N):
  if(SCORE[i]<1):
    print("No")
  else:
    print("Yes")

Fixed submission:
ss = input().split()
N = int(ss[0])
K = int(ss[1])
Q = int(ss[2])
As = []

SCORE = [0] * N

for i in range(Q):
  SCORE[int(input())-1] += 1
for i in range(N):
  if(SCORE[i]<= Q-K):
    print("No")
  else:
    print("Yes")
Buggy python submission (verdict: Runtime Error):
A = input()
P = input()
ans = int((int(A) * 3  + int(P))/2)


print(ans) 

Fixed submission:
A, P = input().strip().split()

ans = int((int(A) * 3  + int(P))/2)


print(ans)

Buggy python submission (verdict: Runtime Error):
apple = input()
kakera = input()
ans = int((int(apple) * 3  + int(kakera))/2)


print(ans) 

Fixed submission:
A, P = input().strip().split()

ans = int((int(A) * 3  + int(P))/2)


print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
import sys
N, K = list(map(int,input().split()))
h = list(map(int, input().split()))

score = [sys.maxsize for i in range(N)]

score[0] = 0
score[1] = score[0] + abs(h[1]-h[0])
for i in range(2, N):
    for j in range(max(i-K, 0), i):
        score[i] = min(score[i], score[j] + abs(h[i]-h[j]))

print(score[-1])


Fixed submission:
import sys
N, K = list(map(int,input().split()))
h = list(map(int, input().split()))

score = [sys.maxsize for i in range(N)]

score[0] = 0
score[1] = score[0] + abs(h[1]-h[0])
for i in range(2, N):
    for j in range(max(i-K, 0), i):
        score[i] = min(score[i], score[j] + abs(h[i]-h[j]))

print(score[-1])
Buggy python submission (verdict: Time Limit Exceeded):
import copy

N, W = list(map(int, input().split()))
w = [0 for i in range(N)]
v = [0 for i in range(N)]
for i in range(N):
    w[i], v[i] = list(map(int, input().split()))


# N, W = [3, 8]
# w = [0 for i in range(N)]
# v = [0 for i in range(N)]


# w[0], v[0] = [3, 30]
# w[1], v[1] = [4, 50]
# w[2], v[2] = [5, 60]

s = [0 for i in range(W+1)]


for i in range(N):
    #print(s)
    ns = copy.copy(s)
    for j in range(W+1):
        for k in range(j + w[i], W+1):
            ns[k] = max(s[k], s[j] + v[i])
    s = ns

print(max(s))





Fixed submission:
import copy

N, W = list(map(int, input().split()))
w = [0 for i in range(N)]
v = [0 for i in range(N)]
for i in range(N):
    w[i], v[i] = list(map(int, input().split()))




s = [[0 for i in range(W+1)] for i in range(N)]


for i in range(W+1):
    if i < w[0]:
        s[0][i] = 0
    else :
        s[0][i] = v[0]

for i in range(1,N):
    for j in range(w[i]):
        s[i][j] = s[i-1][j]
    for j in range(w[i], W+1):
        s[i][j] = max(s[i-1][j], s[i-1][j-w[i]] + v[i])
#print(s)
print(s[-1][-1])
Buggy python submission (verdict: Runtime Error):
N = input()
N = int(N)

a_sub = input().split(" ")
a = [int(n0) for n0 in a_sub]
# print(a)

b_sub = input().split(" ")
b = [int(n0) for n0 in b_sub]
# print(b)

c_sub = input().split(" ")
c = [int(n0) for n0 in c_sub]
# print(c)

score = 0
for xi in range(N-1):
    score = score + b[xi]
    if a[xi+1]==a[xi]+1:
        score = score + c[a[xi]-1]
        # print(xi, c[xi])
score = score + b[N-1]
print(score)


Fixed submission:
N = input()
N = int(N)
print(N**3)

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

a_sub = input().split(" ")
a = [int(n0) for n0 in a_sub]
# print(a)

b_sub = input().split(" ")
b = [int(n0) for n0 in b_sub]
# print(b)

c_sub = input().split(" ")
c = [int(n0) for n0 in c_sub]
# print(c)

score = 0
for xi in range(N):
    score = score + b[xi]
    if a[xi+1]==a[xi]+1 and xi<N-1:
        score = score + c[a[xi]-1]
        # print(xi, c[xi])

print(score)


Fixed submission:
N = input()
N = int(N)
print(N**3)

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

a_sub = input().split(" ")
a = [int(n0) for n0 in a_sub]
# print(a)

b_sub = input().split(" ")
b = [int(n0) for n0 in b_sub]
# print(b)

c_sub = input().split(" ")
c = [int(n0) for n0 in c_sub]
# print(c)

score = 0
for xi in range(N):
    score = score + b[xi]
    if a[xi+1]==a[xi]+1 and xi<N:
        score = score + c[a[xi]-1]
        # print(xi, c[xi])

print(score)


Fixed submission:
N = input()
N = int(N)
print(N**3)

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

a_sub = input().split(" ")
a = [int(n0) for n0 in a_sub]
# print(a)

b_sub = input().split(" ")
b = [int(n0) for n0 in b_sub]
# print(b)

c_sub = input().split(" ")
c = [int(n0) for n0 in c_sub]
# print(c)

score = 0
for xi in range(N):
    score = score + b[xi]
    if a[xi+1]==a[xi]+1 and xi<N:
        score = score + c[a[xi]-1]
        print(xi, c[xi])

print(score)


Fixed submission:
N = input()
N = int(N)
print(N**3)

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

a_sub = input().split(" ")
a = [int(n0) for n0 in a_sub]
# print(a)

b_sub = input().split(" ")
b = [int(n0) for n0 in b_sub]
# print(b)

c_sub = input().split(" ")
c = [int(n0) for n0 in c_sub]
# print(c)

score = 0
for xi in range(N):
    score = score + b[xi]
    if a[xi+1]==a[xi]+1 and xi<N:
        score = score + c[a[xi]-1]
        print(xi, c[xi])

# print(score)

for xi in range(N-1):
    if a[xi+1]==a[xi]+1:
        score = score + c[a[xi]-1]
        print(xi, c[xi])
print(score)


Fixed submission:
N = input()
N = int(N)
print(N**3)

Buggy python submission (verdict: Runtime Error):
N = input()
print(N**3)

Fixed submission:
N = input()
N = int(N)
print(N**3)
Buggy python submission (verdict: Time Limit Exceeded):
N = input()
N = int(N)

l = input().split(" ")
l = [int(n0) for n0 in l]

# print(l)

l.append(10**10)

ans = 0

for xi in range(N-1):
    step = l[xi]
    count = 0
    while l[xi+count] >= l[xi+count+1] :
        # step = l[xi+count+1]
        count = count +1
    if ans < count:
        ans = count

print(ans)


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

step = 0
mstep = 0
for xi in range(n-1):
    if h[xi] >= h[xi+1]:
        step += 1
    else:
        if mstep<step:
            mstep = step
        step = 0

if mstep<step:
    mstep = step

print(mstep)

Buggy python submission (verdict: Time Limit Exceeded):
N = input()
N = int(N)

l = input().split(" ")
l = [int(n0) for n0 in l]

# print(l)

l.append(10**10)

ans = 0

for xi in range(N-1):
    step = l[xi]
    count = 0
    while step >= l[xi+count+1] :
        step = l[xi+count+1]
        count = count +1
    if ans < count:
        ans = count

print(ans)


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

step = 0
mstep = 0
for xi in range(n-1):
    if h[xi] >= h[xi+1]:
        step += 1
    else:
        if mstep<step:
            mstep = step
        step = 0

if mstep<step:
    mstep = step

print(mstep)
Buggy python submission (verdict: Runtime Error):
n = int(input())
list = []
for xi in range(n):
    add1, add2 = input().split()
    add = [add2, add1, xi+1]
    list.append(add)
list.sort(key=lambda list2: list2[1])


name = list[0][1]
list2 = [list[0]]
count = 1
for xi in range(1,n):
    if name == list[xi][1]:
        list2.append(list[xi])
        count += 1
    else:
        list2.sort(key=int, reverse=True)
        for yi in range(count-1,-1,-1):
            print(list2[yi][2])
        name = list[xi][1]
        list2 = [list[xi]]
        count = 1

if len(list2)<n:
    list2.sort(key=int, reverse=True)
for yi in range(count-1,-1,-1):
    print(list2[yi][2])
name = list[xi][1]
list2 = [list[xi]]
count = 1


Fixed submission:
n = int(input())
list = []
for xi in range(n):
    add1, add2 = input().split()
    add = [int(add2), add1, xi+1]
    list.append(add)
list.sort(key=lambda list2: list2[1])


name = list[0][1]
list2 = [list[0]]
count = 1
for xi in range(1,n):
    if name == list[xi][1]:
        list2.append(list[xi])
        count += 1
    else:
        list2.sort()
        for yi in range(count-1,-1,-1):
            print(list2[yi][2])
        name = list[xi][1]
        list2 = [list[xi]]
        count = 1

if len(list2)<n:
    list2.sort()
for yi in range(count-1,-1,-1):
    print(list2[yi][2])
name = list[xi][1]
list2 = [list[xi]]
count = 1

Buggy python submission (verdict: Runtime Error):
n = int(input())
list = []
for xi in range(n):
    add1, add2 = input().split()
    add = [add2, add1, xi+1]
    list.append(add)
list.sort(key=lambda list2: list2[1])

print(list)

name = list[0][1]
list2 = [list[0]]
count = 1
for xi in range(1,n):
    if name == list[xi][1]:
        list2.append(list[xi])
        count += 1
    else:
        list2.sort(key=int, reverse=True)
        for yi in range(count-1,-1,-1):
            print(list2[yi][2])
        name = list[xi][1]
        list2 = [list[xi]]
        count = 1

if len(list2)<n:
    list2.sort(key=int, reverse=True)
for yi in range(count-1,-1,-1):
    print(list2[yi][2])
name = list[xi][1]
list2 = [list[xi]]
count = 1


Fixed submission:
n = int(input())
list = []
for xi in range(n):
    add1, add2 = input().split()
    add = [int(add2), add1, xi+1]
    list.append(add)
list.sort(key=lambda list2: list2[1])


name = list[0][1]
list2 = [list[0]]
count = 1
for xi in range(1,n):
    if name == list[xi][1]:
        list2.append(list[xi])
        count += 1
    else:
        list2.sort()
        for yi in range(count-1,-1,-1):
            print(list2[yi][2])
        name = list[xi][1]
        list2 = [list[xi]]
        count = 1

if len(list2)<n:
    list2.sort()
for yi in range(count-1,-1,-1):
    print(list2[yi][2])
name = list[xi][1]
list2 = [list[xi]]
count = 1
Buggy python submission (verdict: Runtime Error):
s = raw_input()

a = int(s[:2])
b = int(s[2:])

if 0<a<13:
    if 0<b<13:
        print("AMBIGUOUS")
    else:
        print("MMYY")
else:
    if -1<b<13:
        print("YYMM")
    else:
        print("NA")


Fixed submission:
s = input()
a = int(s[:2])
b = int(s[2:])

if 0<a<13:
    if 0<b<13:
        print("AMBIGUOUS")
    else:
        print("MMYY")
else:
    if 0<b<13:
        print("YYMM")
    else:
        print("NA")
Buggy python submission (verdict: Runtime Error):
for i in range(n):
    x,y=map(int,input().split())
    l.append([x,y])

l=sorted(l,key=lambda x:x[1])
t=0
ans='Yes'
for i in range(n):
    if t+l[i][0]<=l[i][1]:
        t+=l[i][0]
    else:
        ans='No'
print(ans)

Fixed submission:
n=int(input())
l=[]
for i in range(n):
    x,y=map(int,input().split())
    l.append([x,y])

l=sorted(l,key=lambda x:x[1])
t=0
ans='Yes'
for i in range(n):
    if t+l[i][0]<=l[i][1]:
        t+=l[i][0]
    else:
        ans='No'
print(ans)
Buggy python submission (verdict: Runtime Error):
from itertools import combinations as c
from collections import Counter

n=int(input())
l=[]
for i in range(n):
    x,y=map(int,input().split())
    l.append([x,y])

l.sort()
m=c(l,2)
ans=[]
for v in m:
    ans.append(str([v[1][0]-v[0][0],v[1][1]-v[0][1]]))
a=Counter(ans).most_common()[0][1]
print(n-a)

Fixed submission:
from itertools import combinations as c
from collections import Counter

n=int(input())
l=[]
for i in range(n):
    x,y=map(int,input().split())
    l.append([x,y])

if n==1:
    print(1)
else:
    l.sort()
    m=c(l,2)
    ans=[]
    for v in m:
        ans.append(str([v[1][0]-v[0][0],v[1][1]-v[0][1]]))
    a=Counter(ans).most_common()[0][1]
    print(n-a)
Buggy python submission (verdict: Time Limit Exceeded):
r,g,b,n=map(int,input().split())

sum=0
for x in range(0,1+(3000//r)):
    for y in range(0,1+(3000-x*r)//g):
        if r*x+g*y<=n and (n-r*x-g*y)%b==0:
            sum+=1
print(sum)

Fixed submission:
r,g,b,n=map(int,input().split())

sum=0
for x in range(0,1+(n//r)):
    for y in range(0,1+(n-x*r)//g):
        if (n-r*x-g*y)%b==0:
            sum+=1
print(sum)

Buggy python submission (verdict: Time Limit Exceeded):
r,g,b,n=map(int,input().split())

sum=0
for x in range(0,3001):
    for y in range(0,1+(3000-x*r)//g):
        if r*x+g*y<=n and (n-r*x-g*y)%b==0:
            sum+=1
print(sum)

Fixed submission:
r,g,b,n=map(int,input().split())

sum=0
for x in range(0,1+(n//r)):
    for y in range(0,1+(n-x*r)//g):
        if (n-r*x-g*y)%b==0:
            sum+=1
print(sum)

Buggy python submission (verdict: Time Limit Exceeded):
r,g,b,n=map(int,input().split())

sum=0
for x in range(0,3001):
    for y in range(0,3001):
        if r*x+g*y<=n and (n-r*x-g*y)%b==0:
            sum+=1
print(sum)

Fixed submission:
r,g,b,n=map(int,input().split())

sum=0
for x in range(0,1+(n//r)):
    for y in range(0,1+(n-x*r)//g):
        if (n-r*x-g*y)%b==0:
            sum+=1
print(sum)
Buggy python submission (verdict: Time Limit Exceeded):
a,b=map(int,input().split())
if a==b:
    print(a)
else:
    s=0
    t=0
    for i in range(41):
        if 2**i>a:
            s=i
            break
    for i in range(41):
        if 2**i>b:
            t=i-1
            break
    ans=0
    for j in range(a,2**s):
        ans=ans^j
    for j in range(2**t,b+1):
        ans=ans^j
    print(ans)


Fixed submission:
a,b=map(int,input().split())
if a==b:
    print(a)
else:
    s=4-a%4
    t=(1+b%4)
    ans=0
    for j in range(a,a+s):
        ans=ans^j
    for j in range(b+1-t,b+1):
        ans=ans^j
    print(ans)

Buggy python submission (verdict: Runtime Error):
a,b=map(int,input().split())
if a==b:
    print(a)
else:
    s=0
    t=0
    for i in range(41):
        if 2**i>a:
            s=i
            break
    for i in range(41):
        if 2**i>b:
            t=i-1
            break
    ans=0
    for j in range(a,2**s):
        ans=ans^j
    for j in range(2**t,b+1):
        ans=ans^j
	print(ans)


Fixed submission:
a,b=map(int,input().split())
if a==b:
    print(a)
else:
    s=4-a%4
    t=(1+b%4)
    ans=0
    for j in range(a,a+s):
        ans=ans^j
    for j in range(b+1-t,b+1):
        ans=ans^j
    print(ans)

Buggy python submission (verdict: Runtime Error):
a,b=map(int,input().split())
if a==b:
    print(a)
else:
    s=0
    t=0
    for i in range(41):
        if 2**i>a:
            s=i
            break
    for i in range(41):
        if 2**i>b:
            t=i-1
            break
    ans=0
    for j in range(a,2**s):
        ans=ans^j
    for j in range(2**t,b+1):
        ans=ans^j
print(ans)

Fixed submission:
a,b=map(int,input().split())
if a==b:
    print(a)
else:
    s=4-a%4
    t=(1+b%4)
    ans=0
    for j in range(a,a+s):
        ans=ans^j
    for j in range(b+1-t,b+1):
        ans=ans^j
    print(ans)

Buggy python submission (verdict: Runtime Error):
a,b=map(int,input().split())
if a==b:
    print(a)
else:
    s=0
    t=0
    for i in range(41):
        if 2**i>a:
            s=i
            break
    for i in range(41):
        if 2**i>b:
            t=i-1
            break
    print(s,t)
    x=int('0'*t)
    ans=x
    for j in range(a,2**s):
        ans=ans^j
    for j in range(2**t,b+1):
        ans=ans^j
print(ans)

Fixed submission:
a,b=map(int,input().split())
if a==b:
    print(a)
else:
    s=4-a%4
    t=(1+b%4)
    ans=0
    for j in range(a,a+s):
        ans=ans^j
    for j in range(b+1-t,b+1):
        ans=ans^j
    print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n,m=map(int,input().split())
l=list(map(int,input().split()))
if n>=m:
  print(0)
else:
  l.sort()
  k=[]
  for i in range(m-1):
    x=l[i+1]-l[i]
    k.append(x)
    k.sort()
  sum=0
  for i in range(m-n):
    sum+=k[i]
  print(sum)

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

Buggy python submission (verdict: Time Limit Exceeded):
n,m=map(int,input().split())
l=list(map(int,input().split()))
if n>=m:
  print(0)
else:
  l.sort()
  k=[]
  for i in range(m-1):
    x=l[i+1]-l[i]
    k.append(x)
    k.sort()
  sum=0
  for i in range(m-n):
    sum+=k[i]
  print(sum)

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

Buggy python submission (verdict: Time Limit Exceeded):
n,m=map(int,input().split())
l=list(map(int,input().split()))
l.sort()
k=[]
for i in range(m-1):
  x=l[i+1]-l[i]
  k.append(x)
  k.sort()
sum=0
for i in range(m-n):
  sum+=k[i]
print(sum)

Fixed submission:
n,m=map(int,input().split())
l=list(map(int,input().split()))
if n>=m:
  print(0)
else:
  l.sort()
  k=[]
  for i in range(m-1):
    x=l[i+1]-l[i]
    k.append(x)
  k.sort()
  sum=0
  for i in range(m-n):
    sum+=k[i]
  print(sum)
Buggy python submission (verdict: Time Limit Exceeded):
n,p=map(int,input().split())
l=[]
x=int(p**(1/n))
for i in range(x+1,0,-1):
  if p%(i**n)==0:
    print(i)
    break

Fixed submission:
n,p=map(int,input().split())
l=[]
if n>41:
  print(1)
else:
  x=int(p**(1/n))
  for i in range(x+1,0,-1):
    if p%(i**n)==0:
      print(i)
      break
Buggy python submission (verdict: Runtime Error):
n=int(input())
def dfs(s):
  if int(s) > N:
    return 0
  if all(s.count(c) > 0 for c in '753'):
    ret=1
  else:
    ret=0 # s 自体が七五三数なら +1 
  for c in '753':
    ret += dfs(s + c)
  return ret
print(dfs('0'))

Fixed submission:
n=int(input())
def dfs(s):
  if int(s) > n:
    return 0
  if all(s.count(c) > 0 for c in '753'):
    ret=1
  else:
    ret=0 # s 自体が七五三数なら +1 
  for c in '753':
    ret += dfs(s + c)
  return ret
print(dfs('0'))

Buggy python submission (verdict: Runtime Error):
n=int(input())
ans=0
if n<10**8:
  if n%2==0:
    for i in range(1,n-1,2):
      sum3=0
      sum5=0
      sum7=0
      x=str(i)
      l=len(x)
      for j in range(l):
        if x[j]=='3':
          sum3 += 1
        elif x[j]=='5':
          sum5 += 1
        elif x[j]=='7':
          sum7 += 1
        if (sum3 + sum5 + sum7 == l) and (sum3>0) and(sum5>0) and (sum7>0):
          ans+=1
  else:
    for i in range(1,n,2):
      sum3=0
      sum5=0
      sum7=0
      x=str(i)
      l=len(x)
      for j in range(l):
        if x[j]=='3':
          sum3 += 1
        elif x[j]=='5':
          sum5 += 1
        elif x[j]=='7':
          sum7 += 1
        if (sum3+sum5+sum7==l) and (sum3>0) and(sum5>0) and (sum7>0):
          ans+=1
print(ans)
else:
print(0)


Fixed submission:
n=int(input())
def dfs(s):
  if int(s) > n:
    return 0
  if all(s.count(c) > 0 for c in '753'):
    ret=1
  else:
    ret=0 # s 自体が七五三数なら +1 
  for c in '753':
    ret += dfs(s + c)
  return ret
print(dfs('0'))
Buggy python submission (verdict: Runtime Error):
from fractions import gcd

n,m=map(int,input().split())
s=input()
t=input()
l=n*m//gcd(n,m)
x=['']*l
ans=l
for i in range(n):
    x[i*(l//n)]=s[i]
for j in range(m):
    if x[j*(l//m)]!='':
        if x[j*(l//m)]!=t[j]:
            ans=-1
            break
print(ans)

Fixed submission:
from fractions import gcd

n,m=map(int,input().split())
s=input()
t=input()
x=gcd(n,m)
l=n*m//gcd(n,m)
for i in range(x):
    if s[i*(n//x)]!=t[i*(m//x)]:
        print(-1)
        exit()
print(l)

Buggy python submission (verdict: Runtime Error):
from fractions import gcd

n,m=map(int,input().split())
s=input()
t=input()
l=n*m//gcd(n,m)
x=[0]*l
ans=l
for i in range(n):
    x[i*(l//n)]=s[i]
for j in range(m):
    if x[j*(l//m)]!=0:
        if x[j*(l//m)]!=t[j]:
            ans=-1
            break
    else:
        pass
print(ans)

Fixed submission:
from fractions import gcd

n,m=map(int,input().split())
s=input()
t=input()
x=gcd(n,m)
l=n*m//gcd(n,m)
for i in range(x):
    if s[i*(n//x)]!=t[i*(m//x)]:
        print(-1)
        exit()
print(l)

Buggy python submission (verdict: Runtime Error):
from fractions import gcd

n,m=map(int,input().split())
s=input()
t=input()
l=n*m//gcd(n,m)
x=[0]*l
ans=l
for i in range(n):
    x[i*(l//n)]=s[i]
for j in range(m):
    if x[j*(l//m)]!=0:
        if x[j*(l//m)]!=t[j]:
            ans=-1
            break
print(ans)

Fixed submission:
from fractions import gcd

n,m=map(int,input().split())
s=input()
t=input()
x=gcd(n,m)
l=n*m//gcd(n,m)
for i in range(x):
    if s[i*(n//x)]!=t[i*(m//x)]:
        print(-1)
        exit()
print(l)

Buggy python submission (verdict: Runtime Error):
from fractions import gcd

n,m=map(int,input().split())
s=input()
t=input()
l=n*m//gcd(n,m)
x=[0]*(l)
for i in range(n):
    x[i*(l//n)]=s[i]
for j in range(m):
    if x[j*(l//m)]!=0:
        if x[j*(l//m)]!=t[j]:
            print(-1)
            exit()
print(l)

Fixed submission:
from fractions import gcd

n,m=map(int,input().split())
s=input()
t=input()
x=gcd(n,m)
l=n*m//gcd(n,m)
for i in range(x):
    if s[i*(n//x)]!=t[i*(m//x)]:
        print(-1)
        exit()
print(l)
Buggy python submission (verdict: Runtime Error):
n,t=map(int, input().split())
l=[input().split() for i in range(n)]

k=[]

for x in range(n):
  if (int(l[x][1])<=t):
    k.append(l[x][0])
  
if (k==[]):
  print('TLE')
else:  
  print(min(k))


Fixed submission:
n=int(input())
if (n==1):
  print('Hello World')
else:
  a=int(input())
  b=int(input())
  print(a+b)
Buggy python submission (verdict: Runtime Error):
n,t=map(int, input().split())
l=[input().split() for i in range(n)]

k=[]

for x in range(n):
  if (int(l[x][1])<t):
    k.append(l[x][0])
    
print(min(k))

Fixed submission:
n,t=map(int, input().split())
l=[input().split() for i in range(n)]

k=[]

for x in range(n):
  if (int(l[x][1]) <= t):
    k.append(int(l[x][0]))
  
if (k==[]):
  print('TLE')
else:  
  print(min(k))