Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
k=int(input())
import fractions
import itertools
sum_g=0
l=list(itertools.product([i for i in range(1,k+1)], repeat=3))
for p,q,r in l:
    ans=p
    ans = fractions.gcd(ans, q)
    ans = fractions.gcd(ans, r)
    sum_g+=ans
    ans=0
print(sum_g)


Fixed submission:
import math

K=int(input())
sum=0


for i in range(1,K+1):
    for j in range(1,K+1):
        a=math.gcd(i,j)
        for k in range(1,K+1):
            b=math.gcd(a, k)
            sum = sum + b

print(sum)

Buggy python submission (verdict: Time Limit Exceeded):
k=int(input())
import fractions
sum_g=0
for p in range(1,k+1):
    for q in range(1,k+1):
        for r in range(1,k+1):
            ans=p
            ans = fractions.gcd(ans, q)
            ans = fractions.gcd(ans, r)
            sum_g+=ans
            ans=0
print(sum_g)

Fixed submission:
import math

K=int(input())
sum=0


for i in range(1,K+1):
    for j in range(1,K+1):
        a=math.gcd(i,j)
        for k in range(1,K+1):
            b=math.gcd(a, k)
            sum = sum + b

print(sum)

Buggy python submission (verdict: Time Limit Exceeded):
k=int(input())
import fractions
sum_g=0
for p in range(1,k+1):
    for q in range(1,k+1):
        for r in range(1,k+1):
            ans=p
            ans = fractions.gcd(ans, q)
            ans = fractions.gcd(ans, r)
            sum_g+=ans
            ans=0
print(sum_g)

Fixed submission:
import math

K=int(input())
sum=0


for i in range(1,K+1):
    for j in range(1,K+1):
        a=math.gcd(i,j)
        for k in range(1,K+1):
            b=math.gcd(a, k)
            sum = sum + b

print(sum)

Buggy python submission (verdict: Runtime Error):
k=int(input())
import fractions

for p in range(1,k+1):
    for q in range(1,k+1):
        for r in range(1,k+1):
            ans=p
            ans = fractions.gcd(ans, q)
            ans = fractions.gcd(ans, r)
            sum_g+=ans
            ans=0
print(sum_g)


Fixed submission:
import math

K=int(input())
sum=0


for i in range(1,K+1):
    for j in range(1,K+1):
        a=math.gcd(i,j)
        for k in range(1,K+1):
            b=math.gcd(a, k)
            sum = sum + b

print(sum)

Buggy python submission (verdict: Runtime Error):
k=int(input())
import math

for p in range(1,k+1):
    for q in range(1,k+1):
        for r in range(1,k+1):
            ans=p
            ans = math.gcd(ans, q)
            ans = math.gcd(ans, r)
            sum_g+=ans
            ans=0
print(sum_g)


Fixed submission:
import math

K=int(input())
sum=0


for i in range(1,K+1):
    for j in range(1,K+1):
        a=math.gcd(i,j)
        for k in range(1,K+1):
            b=math.gcd(a, k)
            sum = sum + b

print(sum)
Buggy python submission (verdict: Time Limit Exceeded):
n,k=map(int,input().split())

while n>0:
    n=n-k
    
n1=abs(n)
n2=n+k
print(min(n1,n2))

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


    
n1=n-(n//k)*k
n2=abs(n1-k)
print(min(n1,n2))

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

while n>0:
    n=n-k
    
n1=abs(n)
n2=n+k
print(min(n1,n2))

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


    
n1=n-(n//k)*k
n2=abs(n1-k)
print(min(n1,n2))
Buggy python submission (verdict: Runtime Error):
N=int(input())
A=list(map(int,input().split()))
def cmb(n, r):
    if n - r < r: r = n - r
    if r == 0: return 1
    if r == 1: return n

    numerator = [n - r + k + 1 for k in range(r)]
    denominator = [k + 1 for k in range(r)]

    for p in range(2,r+1):
        pivot = denominator[p - 1]
        if pivot > 1:
            offset = (n - r) % p
            for k in range(p-1,r,p):
                numerator[k - offset] /= pivot
                denominator[k] /= pivot

    result = 1
    for k in range(r):
        if numerator[k] > 1:
            result *= int(numerator[k])

    return result



for k in range(N):
    cnt=0
    L=A
    L.pop(k)
    aK=L
    lK=list(set(aK))
    for i in lK:
        if aK.count(i)>=2:
            cnt+=cmb(N-1,aK.count(i))
    print(cnt)
            
            
    

Fixed submission:
import collections
n = int(input())
a = list(map(int,input().split()))
c = collections.Counter(a)
ans = sum(i*(i-1)//2 for i in c.values())
[print(ans-c[i]+1) for i in a]
Buggy python submission (verdict: Runtime Error):
a1=input().split()
a2=input().split()
a3=input().split()
A=[a1,a2,a3]
b=int(input()) for i in range(int(input()))
if a1[0] and a1[1] and a1[2] in b:
    print("Yes")
elif a2[0] and a2[1] and a2[2] in b:
    print("Yes")
elif a3[0] and a3[1] and a3[2] in b:
    print("Yes")
elif a1[0] and a2[0] and a3[0] in b:
    print("Yes")
elif a1[1] and a2[1] and a3[1] in b:
    print("Yes")
elif a1[2] and a2[2] and a3[2] in b:
    print("Yes")
elif a1[0] and a2[1] and a3[2] in b:
    print("Yes")
elif a1[2] and a2[1] and a3[0] in b:
    print("Yes")
else:
    print("No")

Fixed submission:
def main():
    a = [input().split() for _ in range(3)]
    ans = [[0] * 3 for _ in range(3)]
    n = int(input())
    b = [input() for _ in range(n)]

    for bi in b:
        for y in range(3):
            for x in range(3):
                if bi == a[y][x]:
                    ans[y][x] = 1

    if ans[0][0] == ans[0][1] == ans[0][2] == 1:
        print('Yes')
    elif ans[1][0] == ans[1][1] == ans[1][2] == 1:
        print('Yes')
    elif ans[2][0] == ans[2][1] == ans[2][2] == 1:
        print('Yes')
    elif ans[0][0] == ans[1][0] == ans[2][0] == 1:
        print('Yes')
    elif ans[0][1] == ans[1][1] == ans[2][1] == 1:
        print('Yes')
    elif ans[0][2] == ans[1][2] == ans[2][2] == 1:
        print('Yes')
    elif ans[0][0] == ans[1][1] == ans[2][2] == 1:
        print('Yes')
    elif ans[0][2] == ans[1][1] == ans[2][0] == 1:
        print('Yes')
    else:
        print('No')


if __name__ == '__main__':
    main()
Buggy python submission (verdict: Runtime Error):
n=int(input())
A=list(map(int,input().split()))
ans="APPROVED"
for i in A:
    if i%2==0:
        if i%3!=0 and i%5!=0:
            ans="DENIED"
            break
print(ans)
            


Fixed submission:
l=set(map(int,input().split()))
if len(l)==2:
    print("Yes")
else:
    print("No")

Buggy python submission (verdict: Runtime Error):
n=int(input())
A=list(map(int,input().split()))
ans="APPROVED"
for i in A:
    if i%2==0:
        if i%3!=0 and i%5!=0:
            ans="DENIED"
           
            break
print(ans)
            


Fixed submission:
l=set(map(int,input().split()))
if len(l)==2:
    print("Yes")
else:
    print("No")
Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
S=[input() for i in range(n) ]
L=sorted(set(S))
cnt=[]
for l in L:
    cnt.append(S.count(l))
op=[L[i] for i, x in enumerate(cnt) if x == max(cnt)]
print("\n".join(op))


Fixed submission:
N = int(input())
dic = {}

for i in range(N):
  S = input()
  if S in dic:
    dic[S] += 1
  else:
    dic[S] = 1
    
max_N = max(list(dic.values()))
keys = sorted([k for k, v in dic.items() if v == max_N])

print("\n".join(keys))

Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
S=[input() for i in range(n) ]
L=sorted(set(S))
cnt=[]
for l in L:
    cnt.append(S.count(l))
op=[L[i] for i, x in enumerate(cnt) if x == max(cnt)]
print("\n".join(op))


Fixed submission:
N = int(input())
dic = {}

for i in range(N):
  S = input()
  if S in dic:
    dic[S] += 1
  else:
    dic[S] = 1
    
max_N = max(list(dic.values()))
keys = sorted([k for k, v in dic.items() if v == max_N])

print("\n".join(keys))
Buggy python submission (verdict: Time Limit Exceeded):
h,n=map(int,input().split())
a,b=[],[]
for i in range(n):
    a_sub,b_sub=map(int,input().split())
    a.append(a_sub)
    b.append(b_sub)
inf=10000000000000
ma=max(a)
dp=[inf]*(h+1+ma)
dp[0]=0
for i in range(n):
    x=[a[i],b[i]]
    for j in range(h+1+ma):
        if dp[j]!=inf:
            if j+x[0]<=h+ma:
                dp[j+x[0]]=min(dp[j+x[0]],dp[j]+x[1])
            else:
                break
print(min(dp[h:]))

Fixed submission:
h,n=map(int,input().split())
a,b=[],[]
for i in range(n):
    a_sub,b_sub=map(int,input().split())
    a.append(a_sub)
    b.append(b_sub)
inf=10000000000000
ma=max(a)
dp=[inf]*(h+1+ma)
dp[0]=0
for i in range(n):
    x=[a[i],b[i]]
    for j in range(h+1+ma):
        if dp[j]!=inf:
            if j+x[0]<=h+ma:
                dp[j+x[0]]=min(dp[j+x[0]],dp[j]+x[1])
            else:
                break
print(min(dp[h:]))
Buggy python submission (verdict: Runtime Error):
k,x =map(int,input())
if x<=500*k:
  print("Yes")
else:
  print("No")


Fixed submission:
k,x=map(int,input().split())
if 500*k>=x:
    print("Yes")
else:
    print("No")

Buggy python submission (verdict: Runtime Error):
k,x =map(int,input())
if x<=500*k:
  print("Yes")
else:
  print("No")

Fixed submission:
k,x=map(int,input().split())
if 500*k>=x:
    print("Yes")
else:
    print("No")
Buggy python submission (verdict: Time Limit Exceeded):
a,b,k=map(int,input().split())
for i in range(k):
    if a>=1:
        a-=1
    elif a==0 and b==0:
        pass
    else:
        if b>=1:
            b-=1
print(a,b)


Fixed submission:
a,b,k=map(int,input().split())
if k<=a:
    print(a-k,b)
elif a<k<=a+b:
    print(0,b-k+a)
elif a+b<k:
    print(0,0)

Buggy python submission (verdict: Time Limit Exceeded):
a,b,k=map(int,input().split())
for i in range(k):
    if a>=1:
        a-=1
    elif a==0 and b==0:
        pass
    else:
        if b>=1:
            b-=1
print(a,b)


Fixed submission:
a,b,k=map(int,input().split())
if k<=a:
    print(a-k,b)
elif a<k<=a+b:
    print(0,b-k+a)
elif a+b<k:
    print(0,0)
Buggy python submission (verdict: Runtime Error):
x=int(input())
import math
def usinig_sqrt(limit):
    for k in range(x,limit+1):
        
        factor = 0
        if k%2==0 and l != 2:
            continue
        for divisor in range(2,math.floor(math.sqrt(k))+1):
            if k%divisor == 0:
                factor += 1
        if factor == 0:
            print(k)
            exit()
         
print(usinig_sqrt(100000))


Fixed submission:
x=int(input())
import math
def is_prime(n):
    if n==1:
        return False
    for divisor in range(2,int(math.sqrt(n))+1):
        if n%divisor == 0:
            return False
    return True

k=0
while True:
    if is_prime(x+k):
        print(x+k)
        break
    else:
        k += 1
Buggy python submission (verdict: Runtime Error):
a,b = map(int,input())
print(6-a-b)

Fixed submission:
a = int(input())
b= int(input())
print(6-a-b)
Buggy python submission (verdict: Runtime Error):
n=int(input())
A=list(map(int,input.split())
h=[0]*n
for i in range(1,n+1):
       h[i-1]=A.index(i)+1
print(*h)



Fixed submission:
N = int(input())
A = list(map(int,input().split()))
ans = [0] * N
for i, a in enumerate(A):
  ans[a-1] = i+1
print(*ans)

Buggy python submission (verdict: Runtime Error):
n=int(input())
A=list(map(int,input.split())
h=[]
for i in range(1,n+1)
       h.append(A.index(i)+1)
print(*h)



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



Fixed submission:
n=int(input())
B=list(map(int,input().split()))  
C=[0]*n
C[0]=B[0]
C[1]=B[0]
for i in range(1,n-1):
    if C[i]>B[i]:
        C[i+1]=B[i]
        C[i]=B[i]
    else:
        C[i+1]=B[i]
print(sum(C))
Buggy python submission (verdict: Runtime Error):
a=int(input())
s-input()
if a>=3200:
    print(s)
else:
    print("red")


Fixed submission:
a=int(input())
s=input()
if a>=3200:
    print(s)
elif a<3200:
    print("red")
Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
S=["".join(sorted(input())) for i in range(n)]
Sn=set(S)
cnt=0
for s in Sn:
    if S.count(s)>=2:
        cnt+=S.count(s)*(S.count(s)-1)//2
print(cnt)
        
    


Fixed submission:
n = int(input())
s = [input() for _ in range(n)]
for i in range(n):
  s[i] = ''.join(sorted(s[i]))
t = {}
for i in range(n):
  if s[i] in t:
    t[s[i]] += 1
  else:
    t[s[i]] = 1
print(sum(t[k] * (t[k] -1) // 2 for k in t))
Buggy python submission (verdict: Runtime Error):
import copy
n=int(input())
A=[int(input()) for i in range(n)]
B=copy.copy(A)
for i in range(n):
    A.pop(i)
    print(max(A))
    A = B
    

Fixed submission:
n=int(input())
A=[int(input()) for i in range(n)]
B=sorted(A)
for a in A:
    if a == B[-1]:
      print(B[-2])
    else:
        print(B[-1])
Buggy python submission (verdict: Time Limit Exceeded):
l,r=map(int,input().split())
k=[]
for i in range(l,r):
    for j in range(i+1,r+1):
        k.append((i*j)%2019)
print(min(k))
        

Fixed submission:
L, R = map(int, input().split())
ans = float('inf')
for i in range(L, min(L+2019, R)):
    for j in range(i+1, min(L+2019, R) + 1):
        ans = min(ans, (i*j) % 2019)
print(ans)
Buggy python submission (verdict: Runtime Error):
from gcd import fractions
a,b,c,d = map(int,input().split())
def l(x,y):
    return x*y//gcd(x,y)
U = b-a+1
s1 = b//c - (a-1)//c
s2 = b//d - (a-1)//d
s3 = b//l(a,b) - (a-1)//l(a,b)
print(U-(s1+s2-s3))



Fixed submission:
from fractions import gcd
a,b,c,d = map(int,input().split())
def l(x,y):
    return (x*y)//gcd(x,y)
U = b-a+1
s1 = b//c - (a-1)//c
s2 = b//d - (a-1)//d
s3 = b//l(c,d) - (a-1)//l(c,d)
print(U-(s1+s2-s3))
Buggy python submission (verdict: Runtime Error):
, M = [int(x) for x in input().split()]
K = [[0]*N]*M
for i in range(M):
  K[i] = [int(x) for x in input().split()]
P = [int(x) for x in input().split()]
total = 0
for i in range(2 ** N):
    lamp = [0] * N
    for j in range(N):
        if ((i >> j) & 1):
            lamp[j] = 1
    flag = True
    for x in range(M):
      result = 0
      for y in K[x][1:]:
        if lamp[y-1] == 1:
          result += 1
      result %= 2
      if result != P[x]:
        flag = False
    if flag:
      total += 1
print(total)


Fixed submission:
N, M = [int(x) for x in input().split()]
K = [[0]*N]*M
for i in range(M):
  K[i] = [int(x) for x in input().split()]
P = [int(x) for x in input().split()]
total = 0
for i in range(2 ** N):
    lamp = [0] * N
    for j in range(N):
        if ((i >> j) & 1):
            lamp[j] = 1
    flag = True
    for x in range(M):
      result = 0
      for y in K[x][1:]:
        if lamp[y-1] == 1:
          result += 1
      result %= 2
      if result != P[x]:
        flag = False
    if flag:
      total += 1
print(total)
Buggy python submission (verdict: Runtime Error):
s=input()
print(2*(min(s.count("0"),s.count("1")))


Fixed submission:
s=input()
print(2*(min(s.count("0"),s.count("1"))))
Buggy python submission (verdict: Runtime Error):
t,x = map(float,input().split())
print(t/x)


Fixed submission:
t,x=map(int,input().split())
print(t/x)
Buggy python submission (verdict: Runtime Error):
a,b,c = map(int,input().split())
print(a*b//2)

Fixed submission:
a,b,c= map(int,input().split())
print(a*b//2)

Buggy python submission (verdict: Runtime Error):
a,b,c = map(int,input().split())

print(a*b//2)

Fixed submission:
a,b,c= map(int,input().split())
print(a*b//2)
Buggy python submission (verdict: Runtime Error):
N = int(input())
a, b, c = [0] * N, [0] * N, [0] * N
for i in range(N):
	a[i], b[i], c[i] = map(int, input().split())
dp=[[0]*3 for _  in range(N)]
dp[0]=[a[0],b[0],c[0]]
for i in range(N-1):
    for j in range(2):
        for k in range(2):
            if j!=k:
                dp[i+1][j]=max(dp[i+1][j],dp[i][k] + a[i+1][j])
            else:
                pass

print(max(dp[N-1]))


    

Fixed submission:
N = int(input())
a, b, c = [0] * N, [0] * N, [0] * N
for i in range(N):
	a[i], b[i], c[i] = map(int, input().split())
dp = [[0] * 3 for _ in range(N)]

dp[0] = [a[0], b[0], c[0]]
for i in range(N - 1):
	dp[i + 1][0] = max(dp[i + 1][0], dp[i][1] + a[i + 1], dp[i][2] + a[i + 1])
	dp[i + 1][1] = max(dp[i + 1][1], dp[i][0] + b[i + 1], dp[i][2] + b[i + 1])
	dp[i + 1][2] = max(dp[i + 1][2], dp[i][0] + c[i + 1], dp[i][1] + c[i + 1])
print(max(dp[N - 1]))

Buggy python submission (verdict: Runtime Error):
N = int(input())
a, b, c = [0] * N, [0] * N, [0] * N
for i in range(N):
	a[i], b[i], c[i] = map(int, input().split())
dp=[[0]*3 for _  in range(n)]
dp[0]=[a[0],b[0],c[0]]
for i in range(N-1):
    for j in range(2):
        for k in range(2):
            if j!=k:
                dp[i+1][j]=max(dp[i+1][j],dp[i][k] + a[i+1][j])
            else:
                pass

print(max(dp[N-1]))


    

Fixed submission:
N = int(input())
a, b, c = [0] * N, [0] * N, [0] * N
for i in range(N):
	a[i], b[i], c[i] = map(int, input().split())
dp = [[0] * 3 for _ in range(N)]

dp[0] = [a[0], b[0], c[0]]
for i in range(N - 1):
	dp[i + 1][0] = max(dp[i + 1][0], dp[i][1] + a[i + 1], dp[i][2] + a[i + 1])
	dp[i + 1][1] = max(dp[i + 1][1], dp[i][0] + b[i + 1], dp[i][2] + b[i + 1])
	dp[i + 1][2] = max(dp[i + 1][2], dp[i][0] + c[i + 1], dp[i][1] + c[i + 1])
print(max(dp[N - 1]))
Buggy python submission (verdict: Runtime Error):
l=[int(input()) for range(int(input())]
print(sum(l)-int(max(l)/2))                         

Fixed submission:
n=int(input())
P=[int(input()) for i in range(n)]
print(sum(P)-max(P)+max(P)//2)
Buggy python submission (verdict: Runtime Error):
n,k=map(int,input().split())
H=sorted([int(input()) for i in range(n)])
print(min([h[i+k-1]-h[i] for i in range(n-k+1)]))


Fixed submission:
n,k=map(int,input().split())
h=sorted([int(input()) for i in range(n)])
print(min([h[i+k-1]-h[i] for i in range(n-k+1)]))

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


Fixed submission:
n,k=map(int,input().split())
h=sorted([int(input()) for i in range(n)])
print(min([h[i+k-1]-h[i] for i in range(n-k+1)]))

Buggy python submission (verdict: Time Limit Exceeded):
import itertools 
n,k=map(int,input().split())
H=[int(input()) for i in range(n)]
Hn=list(itertools.combinations(H,k))
print(min([max(list(i))-min(list(i)) for i in Hn]))


Fixed submission:
n,k=map(int,input().split())
h=sorted([int(input()) for i in range(n)])
print(min([h[i+k-1]-h[i] for i in range(n-k+1)]))

Buggy python submission (verdict: Time Limit Exceeded):
import itertools 
n,k=map(int,input().split())
H=[int(input()) for i in range(n)]
Hn=list(itertools.combinations(H,k))
print(min([max(list(i))-min(list(i)) for i in Hn]))


Fixed submission:
n,k=map(int,input().split())
h=sorted([int(input()) for i in range(n)])
print(min([h[i+k-1]-h[i] for i in range(n-k+1)]))
Buggy python submission (verdict: Runtime Error):
 n=int(input())
def des(s):
    if int(s) > n:
        return 0
    ret = 1 if all(s.count(c)>0 for c in "753") else 0
    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
    for c in "753":
        ret += dfs(s+c)
    return ret
print(dfs("0"))
Buggy python submission (verdict: Time Limit Exceeded):
s = input()
k = int(input())
l = []
for i in s:
    l.append(str(int(i)**(5*10**15)))
print("".join(l)[k-1])



Fixed submission:
s = input()
k = int(input())
cnt = 0
x = 0
for i in s:
    if i == "1":
        cnt += 1
    else:
        x = int(i)
        break
if k<=cnt:
    print(1)
else:
    print(x)
Buggy python submission (verdict: Runtime Error):
n = int(input())
print(n if n%2==0 else n*2)

Fixed submission:
n,k = map(int,input().split())
print(0 if n%k==0 else 1)
Buggy python submission (verdict: Runtime Error):
import math
n = int(input())
print(n*2//math.gcd(n,2))


Fixed submission:
n = int(input())
print(n if n%2==0 else n*2)

Buggy python submission (verdict: Runtime Error):
import math
n = int(input())
print(n*2//math.gcd(n,2))


Fixed submission:
n = int(input())
print(n if n%2==0 else n*2)
Buggy python submission (verdict: Runtime Error):
n=int(input())
A=list(map(int,input().split()))
cnt=0
if any(A%2==0):
    cnt+=1
print(cnt)





Fixed submission:
n=int(input())
A=list(map(int,input().split()))
cnt=0
for a in A:
    while a%2 == 0:
        cnt += 1
        a = a//2
print(cnt)

Buggy python submission (verdict: Runtime Error):
n=int(input())
A=list(map(int,input().split()))
cnt=0
if any(A%2==0):
    cnt+=1
print(cnt)





Fixed submission:
n=int(input())
A=list(map(int,input().split()))
cnt=0
for a in A:
    while a%2 == 0:
        cnt += 1
        a = a//2
print(cnt)
Buggy python submission (verdict: Runtime Error):
a,b,x=map(int,input().split())
print("YES"  a<=x and x<=a+b else "NO" )



Fixed submission:
a,b,x=map(int,input().split())
print("YES" if a<=x and x<=a+b else "NO" )
Buggy python submission (verdict: Runtime Error):
x,a,b = [int(input()) for i in range(3)]
print((x-a)%b)

Fixed submission:
n = int(input())
a=int(input())
print("Yes" if n%500<=a else "No")
Buggy python submission (verdict: Runtime Error):
n = [int(x) for ix in input()]
l=len(n)-1
for i in range(2**l):
    op=["-"]*l
    for j in range(l):
        if ((i>>j)&1):
            op[l-1-j]="+"
    formula=""
    for p,q in zip(n,op + [""]):
        formula+=(p+q)
    if eval(formula)==7:
        print(formula + "=7" )
        break

Fixed submission:
n = [x for x in input()]
l=len(n)-1
for i in range(2**l):
    op=["-"]*l
    for j in range(l):
        if ((i>>j)&1):
            op[l-1-j]="+"
    formula=""
    for p,q in zip(n,op + [""]):
        formula+=(p+q)
    if eval(formula)==7:
        print(formula + "=7" )
        break
Buggy python submission (verdict: Runtime Error):
h,w=map(int,input().split())
s=[input for i in range(h)]
for i in range(h):
    l=""
    for j in range(w):
        if s[i][j]=="#":
            l+="#"
        else:
            l+=str(sum([t[max(0,j-1):min(w,j+2)].count("#") for t in s[max(0,i-1):min(h,i+2)]]))
    print(l)    
            


Fixed submission:
def minesweeper(grid, x, y):
    if grid[x][y] == '.':
        cnt = 0
        for i in range(x-1, x+2): 
            if i < 0 or H-1 < i:
                pass
            else :
                for j in range(y-1, y+2):
                    if j < 0 or W - 1 < j:
                        pass
                    else :
                        if grid[i][j] == '#':
                            cnt += 1
        grid[x][y] = str(cnt)
    return grid


H, W = [int(i) for i in input().split()]

grid = []
for h in range(H):
    grid.append([l for l in input()])
    
for x in range(H):
    for y in range(W):
        grid = minesweeper(grid, x, y)
        
for row in grid:
    print(''.join(row))
Buggy python submission (verdict: Runtime Error):
s1 s2 s3=input().split()
print(s1[0].upper()+s2[0].upper()+s3[0].upper())



Fixed submission:
s1,s2, s3=input().split()
print(s1[0].upper()+s2[0].upper()+s3[0].upper())
Buggy python submission (verdict: Time Limit Exceeded):
k,s=map(int,input().split())
ans=0
for x in range(k+1):
    for y in range(k+1):
        for z in range(k+1):
            if x+y+z==s:
                ans+=1
print(ans)



Fixed submission:
k,s=map(int,input().split())
ans=0
for x in range(k+1):
    for y in range(k+1):
        if 0<=s-x-y<=k:
            ans+=1
print(ans)

Buggy python submission (verdict: Runtime Error):
k,s=map(int,input().split())
ans=0
for x in range(k+1):
    for y in range(k+1):
        for z in range(k+1):
            if x+y+z==s:
                ans+=1
print(ans)



Fixed submission:
k,s=map(int,input().split())
ans=0
for x in range(k+1):
    for y in range(k+1):
        if 0<=s-x-y<=k:
            ans+=1
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
k,s=map(int,input().split())
ans=0
for x in range(k+1):
    for y in range(k+1):
        for z in range(k+1):
            if x+y+z==s:
                ans+=1
print(ans)



Fixed submission:
k,s=map(int,input().split())
ans=0
for x in range(k+1):
    for y in range(k+1):
        if 0<=s-x-y<=k:
            ans+=1
print(ans)