Harryxun/GPT-100-sft-dataset huggingface dataset:
Problem p02609 (python)

Fixed submission:
ma = lambda :map(int,input().split())
ni = lambda:int(input())
import collections
import math
import itertools
gcd = math.gcd
n = ni()
x = input()
xr = x[::-1]
px = x.count("1")
def solve(t):
    ret = 1 #最初の一回
    while t>0:
        p = bin(t).count("1")
        t %=p
        ret +=1
    return ret
x_tp = 0
x_tm = 0

for i in range(n):
    x_tp = (x_tp + int(xr[i])*pow(2,i,px+1) ) %(px+1) ## 0->1
if px>1:
    for i in range(n):
        x_tm = (x_tm + int(xr[i])*pow(2,i,px-1) ) %(px-1) # 1->0
ans = []

for i in range(n):
    if xr[i] =="0":
        x_tmp = (x_tp + pow(2,i,px+1) ) %(px+1)
    else:#1->0
        if px==1:
            ans.append(0)
            continue
        x_tmp = (x_tm - pow(2,i,px-1)) %(px-1)
    t = solve(x_tmp)
    ans.append(t)
for i in range(n-1,-1,-1):
    print(ans[i])

Buggy submission (verdict: Runtime Error):
ma = lambda :map(int,input().split())
ni = lambda:int(input())
import collections
import math
import itertools
gcd = math.gcd
n = ni()
x = input()
xr = x[::-1]
px = x.count("1")
def solve(t):
    ret = 1 #最初の一回
    while t>0:
        p = bin(t).count("1")
        t %=p
        ret +=1
    return ret
x_tp = 0
x_tm = 0

for i in range(n):
    x_tp = (x_tp + int(xr[i])*pow(2,i,px+1) ) %(px+1) ## 0->1
if px>1:
    for i in range(n):
        x_tm = (x_tm + int(xr[i])*pow(2,i,px-1) ) %(px-1) # 1->0
ans = []

for i in range(n):
    if xr[i] =="0":
        x_tmp = (x_tp + pow(2,i,px+1) ) %(px+1)
    else:#1->0
        x_tmp = (x_tm - pow(2,i,px-1)) %(px-1)
    t = solve(x_tmp)
    ans.append(t)
for i in range(n-1,-1,-1):
    print(ans[i])

Buggy submission (verdict: Runtime Error):
ma = lambda :map(int,input().split())
ni = lambda:int(input())
import collections
import math
import itertools
gcd = math.gcd
n = ni()
x = input()
xr = x[::-1]
px = x.count("1")
def solve(t):
    ret = 1
    while t>0:
        p = bin(t).count("1")
        t %=p
        ret +=1
    return ret
x_tp = 0
x_tm = 0

for i in range(n):
    x_tp = (x_tp + int(xr[i])*pow(2,i,px+1) ) %(px+1) ## 0->1
if px>0:
    for i in range(n):
        x_tm = (x_tm + int(xr[i])*pow(2,i,px-1) ) %(px-1) # 1->0
ans = []
for i in range(n):
    if xr[i] =="0":
        x_tmp = (x_tp + pow(2,i,px+1) ) %(px+1)
    else:#1->0
        x_tmp = (x_tm - pow(2,i,px-1)) %(px-1)
    t = solve(x_tmp)
    ans.append(t)
for i in range(n-1,-1,-1):
    print(ans[i])
Problem p02613 (python)

Fixed submission:
n = int(input())
import collections
co = collections.Counter()
for i in range(n):
    s = input()
    co[s] +=1
print(f"AC x {co['AC']}")
print(f"WA x {co['WA']}")
print(f"TLE x {co['TLE']}")
print(f"RE x {co['RE']}")

Buggy submission (verdict: Runtime Error):
n = int(input())
import collections
co = collections.Counter()
for i in range(n):
    co[input()] +=1
print(f"AC x {co["AC"]}")
print(f"WA x {co["WA"]}")
print(f"TLE x {co["TLE"]}")
print(f"RE x {co["RE"]}")
Problem p02632 (python)

Fixed submission:
ma = lambda :map(int,input().split())
lma = lambda :list(map(int,input().split()))
tma = lambda :tuple(map(int,input().split()))
ni = lambda:int(input())
yn = lambda fl:print("Yes") if fl else print("No")
import collections
import math
import itertools
import heapq as hq
nmax = 2*10**6+2
mod = 10**9+7
fac = [1]*nmax
finv = [1]*nmax
inv = [1]*nmax
def ncr_pre():
    for i in range(2,nmax):
        fac[i] = fac[i-1]*i % mod
        inv[i] = mod - inv[mod%i] * (mod//i) %mod
        finv[i] = finv[i-1] * inv[i] %mod

def ncr(n,r):
    if n<r:
        return 0
    if n<0 or r<0:
        return 0
    return fac[n]* (finv[r] * finv[n-r] %mod) %mod

ncr_pre()
k = ni()
s = input()
n = len(s)
ans= 0
for i in range(k+1):
    ans=(ans+ ncr(n+k-i-1,n-1)*pow(25,k-i,mod)*pow(26,i,mod) )%mod
print(ans)

Buggy submission (verdict: Runtime Error):
ma = lambda :map(int,input().split())
lma = lambda :list(map(int,input().split()))
tma = lambda :tuple(map(int,input().split()))
ni = lambda:int(input())
yn = lambda fl:print("Yes") if fl else print("No")
import collections
import math
import itertools
import heapq as hq
nmax = 10**6
mod = 10**9+7
fac = [1]*nmax
finv = [1]*nmax
inv = [1]*nmax
def ncr_pre():
    for i in range(2,nmax):
        fac[i] = fac[i-1]*i % mod
        inv[i] = mod - inv[mod%i] * (mod//i) %mod
        finv[i] = finv[i-1] * inv[i] %mod

def ncr(n,r):
    if n<r:
        return 0
    if n<0 or r<0:
        return 0
    return fac[n]* (finv[r] * finv[n-r] %mod) %mod

ncr_pre()
k = ni()
s = input()
n = len(s)
ans= 0
for i in range(k+1):
    ans=(ans+ ncr(n+k-i-1,n-1)*pow(25,k-i,mod)*pow(26,i,mod) )%mod
print(ans)
Problem p02696 (python)

Fixed submission:
import collections
import math
import itertools
import sys
sys.setrecursionlimit(10**6)
def f(x):
  return (a*x)//b - a*(x//b)
ma = lambda :map(int,input().split())
ni = lambda:int(input())
a,b,n = ma()
if n>=b-1:
    print(f(b-1))
else:
    print(f(n))

Buggy submission (verdict: Runtime Error):
comb = []
def f(n,cnt,ls):
    if cnt == n:
        comb.append(ls)
        return
    for i in range(ls[cnt-1],m+1):
        tmp = ls.copy()
        tmp[cnt] = i
        f(n,cnt+1,tmp)
    return
ma = lambda :map(int,input().split())
ni = lambda:int(input())

n,m,q = ma()
abcd = []
for i in range(q):
    abcd.append(list(ma()))
ls = [1]*(n+1)
f(n,0,ls)
ans = 0
for A in  comb:
    tmp = 0
    for a,b,c,d in abcd:
        if A[b-1] - A[a-1] ==c:
            tmp +=d
    ans = max(ans,tmp)
print(ans)
Problem p02698 (python)

Fixed submission:
## まきもどし？
ma = lambda :map(int,input().split())
lma = lambda :list(map(int,input().split()))
tma = lambda :tuple(map(int,input().split()))
ni = lambda:int(input())
yn = lambda fl:print("Yes") if fl else print("No")
import collections
import math
import itertools
import heapq as hq
ceil = math.ceil
import sys
sys.setrecursionlimit(10**6)
n = ni()
A = lma()
tree = [[] for i in range(n)]
INF = 10**10
for i in range(n-1):
    u,v = ma();u-=1;v-=1
    tree[u].append(v)
    tree[v].append(u)
#print(tree)
def isok(num,val):##適宜変更
    return num<val
def bisect(ls,val): ##valの関数isok(x,val)がTrueとなる一番右のindex を返す 全部Falseなら-1,Trueならlen(ls)-1
    ok = -1
    ng = len(ls)
    x = (ok+ng)//2
    while ng-ok>1:
        num = ls[x]
        if isok(num,val):
            ok = x
        else:
            ng = x
        x = (ok+ng)//2
    return ok ##一番右のTrueのindex  Trueの個数はok+1こ
def LIS_1(x,ls,right):##right ::これまでわかっている右端
    idx = bisect(ls,x)+1
    if idx+1>right:
        ret= idx+1
    else:
        ret=right
    rewind_idxval.append((idx,ls[idx]))
    ls[idx]=x
    #print(x,ls)
    return ret
def DFS_LIS(prev,ls,right):
    ans[prev]= LIS_1(A[prev],ls,right)
    for node in tree[prev]:
        if not visited[node]:
            visited[node]=True
            DFS_LIS(node,ls,ans[prev])
    #rewind
    idx,pval = rewind_idxval.pop()
    ls[idx] = pval

ans = [0]*n
s = 0
right=0
rewind_idxval=collections.deque()
visited=[False]*n
visited[s]=True
ls=[INF]*n
DFS_LIS(s,ls,right)
#print(ls)
for a in ans :
    print(a)

Buggy submission (verdict: Runtime Error):
## まきもどし？
ma = lambda :map(int,input().split())
lma = lambda :list(map(int,input().split()))
tma = lambda :tuple(map(int,input().split()))
ni = lambda:int(input())
yn = lambda fl:print("Yes") if fl else print("No")
import collections
import math
import itertools
import heapq as hq
ceil = math.ceil
n = ni()
A = lma()
tree = [[] for i in range(n)]
INF = 10**10
for i in range(n-1):
    u,v = ma();u-=1;v-=1
    tree[u].append(v)
    tree[v].append(u)
#print(tree)
def isok(num,val):##適宜変更
    return num<val
def bisect(ls,val): ##valの関数isok(x,val)がTrueとなる一番右のindex を返す 全部Falseなら-1,Trueならlen(ls)-1
    ok = -1
    ng = len(ls)
    x = (ok+ng)//2
    while ng-ok>1:
        num = ls[x]
        if isok(num,val):
            ok = x
        else:
            ng = x
        x = (ok+ng)//2
    return ok ##一番右のTrueのindex  Trueの個数はok+1こ
def LIS_1(x,ls,right):##right ::これまでわかっている右端
    idx = bisect(ls,x)+1
    if idx+1>right:
        ret= idx+1
    else:
        ret=right
    rewind_idxval.append((idx,ls[idx]))
    ls[idx]=x
    #print(x,ls)
    return ret
def DFS_LIS(prev,ls,right):
    ans[prev]= LIS_1(A[prev],ls,right)
    for node in tree[prev]:
        if not visited[node]:
            visited[node]=True
            DFS_LIS(node,ls,ans[prev])
    #rewind
    idx,pval = rewind_idxval.pop()
    ls[idx] = pval

ans = [0]*n
s = 0
right=0
rewind_idxval=collections.deque()
visited=[False]*n
visited[s]=True
ls=[INF]*n
DFS_LIS(s,ls,right)
#print(ls)
for a in ans :
    print(a)
Problem p02705 (python)

Fixed submission:
n = int(input())
import math
print(2*math.pi*n)

Buggy submission (verdict: Runtime Error):
n = int(input())
import math
print(2*math.pi()*n)

Buggy submission (verdict: Runtime Error):
n = int(input())
import math
print(2*math.pi()*n)
Problem p02713 (python)

Fixed submission:
import math
gcd = math.gcd
ans = 0
k = int(input())
for i in range(1,k+1):
    for j in range(1,k+1):
        for l in range(1,k+1):
            ans += gcd(i,gcd(j,l))
print(ans)

Buggy submission (verdict: Runtime Error):
import math
gcd = math.gcd()
ans = 0
k = int(input())
for i in range(1,k+1):
    for j in range(1,k+1):
        for l in range(1,k+1):
            ans += gcd(i,gcd(j,l))
print(ans)
Problem p02782 (python)

Fixed submission:
nmax = (10**6+1)*2
mod = 10**9+7

fac = [1]*nmax
finv = [1]*nmax
inv = [1]*nmax
def ncr_pre():
    for i in range(2,nmax):
        fac[i] = fac[i-1]*i % mod
        inv[i] = mod - inv[mod%i] * (mod//i) %mod
        finv[i] = finv[i-1] * inv[i] %mod

def ncr(n,r):
    if n<r:
        return 0
    if n<0 or r<0:
        return 0
    return fac[n]* (finv[r] * finv[n-r] %mod) %mod

def g(r,c):## r以下かつc以下の経路f(i,j)の総和
    ans = 0
    for i in range(1,r+2):
        ## f(i+1,c) =  f(i,0) + f(i,1) + ...f(i,c)
        ans += ncr(i+c,c)
        ans %=mod
    return ans

ncr_pre()
r1,c1,r2,c2 = map(int,input().split())
ans = g(r2,c2) - g(r1-1,c2) - g(r2,c1-1) + g(r1-1,c1-1)
print(ans % mod)

Buggy submission (verdict: Runtime Error):
nmax = 10**6+1
mod = 10**9+7

fac = [1]*nmax
finv = [1]*nmax
inv = [1]*nmax
def ncr_pre():
    for i in range(2,nmax):
        fac[i] = fac[i-1]*i % mod
        inv[i] = mod - inv[mod%i] * (mod//i) %mod
        finv[i] = finv[i-1] * inv[i] %mod

def ncr(n,r):
    if n<r:
        return 0
    if n<0 or r<0:
        return 0
    return fac[n]* (finv[r] * finv[n-r] %mod) %mod

ncr_pre()
r1,c1,r2,c2 = map(int,input().split())

ans = 0
for c in range(c1,c2+1):
    for r in range(r1,r2+1):
        ans+=ncr(r+c,c)
        ans %=mod
print(ans)
Problem p02823 (python)

Fixed submission:
ma = lambda :map(int,input().split())

n,a,b = ma()
if (b-a)%2 ==0:
    print((b-a)//2)
else:
    print(min(a+ (b-a-1)//2, (n-b+1)+(b-a-1)//2))

Buggy submission (verdict: Runtime Error):
ma = lambda :map(int,input().split())

n,a,b = ma()
if (b-a)%2 ==0:
    print((b-a)//2)
else:
    print(min(a+ (b-a-1)//2, (n-b+1)+(b-a-1)//2)
Problem p02898 (python)

Fixed submission:
n,k = map(int,input().split())
H = list(map(int,input().split()))
cnt = 0
H.sort(reverse=True)
for h in H :
    if h >=k:
        cnt+=1
print(cnt)

Buggy submission (verdict: Runtime Error):
n,k = map(int,input().split())
H = list(map(int,input().split()))
cnt = 0
H.sort(reverse=True))
for h in H :
    if h >=k:
        cnt+=1
print(cnt)
Problem p02947 (python)

Fixed submission:
n = int(input())
di = {}
for i in range(n):
    sl = "".join(sorted(list(input())))
    if sl in di:
      di[sl] += 1
    else:
      di[sl] = 1
def nc2(n):
    a = n * (n-1) /2
    return int(a) #1c2 =0
ls = di.items()
cnt = 0
for i in ls:
    cnt += nc2(i[1])
print(cnt)

Buggy submission (verdict: Runtime Error):
n = int(input())
di = {}
for i in range(n):
    sl = "".join(sorted(list(input())))
    if sl in di:
      di[sl] += 1
    else:
      di[sl] = 1
def nc2(n):
    a = 1
    for i in range(1,n+1):
        a *= i
    return int(a / 2) #1c2 =0
ls = di.items()
cnt = 0
for i in ls:
    cnt += nc2(i[1])
print(cnt)

Buggy submission (verdict: Runtime Error):
di ={}
n = int(input())
di = {}
for i in range(n):
    sl = tuple(sorted(list(input())))
    if sl in di:
      di[sl] += 1
    else:
      di[sl] = 1
def nc2(n):
    a = 1
    for i in range(1,n+1):
        a *= i
    return int(a / 2) #1c2 =0
ls = di.items()
cnt = 0
for i in ls:
    cnt += nc2(i[1])
print(cnt)

Buggy submission (verdict: Runtime Error):
di ={}
n = int(input())
di = {}
for i in range(n):
    sl = tuple(sorted(list(input()))
    if sl in di:
      di[sl] += 1
    else:
      di[sl] = 1
def nc2(n):
    a = 1
    for i in range(1,n):
        a *= i
    return int(a / 2)
ls = di.items()
cnt = 0
for i in ls:
    cnt += nc2(i[1])
print(cnt)
Problem p02957 (python)

Fixed submission:
ma = lambda :map(int,input().split())
lma = lambda :list(map(int,input().split()))
tma = lambda :tuple(map(int,input().split()))
ni = lambda:int(input())
yn = lambda fl:print("Yes") if fl else print("No")
import collections
import math
import itertools
import heapq as hq
a,b = ma()
k2 = abs(b-a)
if k2%2==0:
    print(k2//2+min(b,a))
else:
    print("IMPOSSIBLE")

Buggy submission (verdict: Runtime Error):
ma = lambda :map(int,input().split())
lma = lambda :list(map(int,input().split()))
tma = lambda :tuple(map(int,input().split()))
ni = lambda:int(input())
yn = lambda fl:print("Yes") if fl else print("No")
import collections
import math
import itertools
import heapq as hq
a,b = ma()
k2 = abs(b-a)
if k%2==1:
    print(k2//2+min(b,a))
else:
    print("IMPOSSIBLE")
Problem p03059 (python)

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

Buggy submission (verdict: Runtime Error):
n = int(input())
a = list(map(int,input().split()))
pal =1
minabs = 10**9
for i in range(n):
    if a[i] <0:
        pal *=-1
        a[i] = -1*a[i]
    minabs = min(minabs,a[i])
if pal ==1:
    print(sum(a))
else:
    print(sum(a)-2*minabs)
Problem p03086 (python)

Fixed submission:
s = list(input())
lis = ["A","T","G","C"]
ans = []
for i in range(len(s)):
    cnt = 0
    for j in range(len(s)-i):
        if s[i+j] in lis:
            cnt +=1
        else:
            ans.append(cnt)
            break
    else:ans.append(cnt)
print(max(ans))

Buggy submission (verdict: Runtime Error):
s = list(input())
lis = ["A","T","G","C"]
ans = []
for i in range(len(s)):
    cnt = 0
    for j in range(len(s)-i):
        if s[i+j] in lis:
            cnt +=1
        else:
            ans.append(cnt)
            break
print(max(ans))
Problem p03215 (python)

Fixed submission:
ma = lambda :map(int,input().split())
lma = lambda :list(map(int,input().split()))
tma = lambda :tuple(map(int,input().split()))
ni = lambda:int(input())
yn = lambda fl:print("Yes") if fl else print("No")
import collections
import math
import itertools
import heapq as hq

n,k = ma()
A = lma()
bu = []
for i in range(n):
    tmp=0
    for j in range(i,n):
        tmp+=A[j]
        bu.append(tmp)
mb = bin(max(bu))
ls = [0]*(len(mb)-2)
for b in bu:
    for i in range(len(bin(b))-2):
        if (b>>i &1):
            ls[i]+=1
ans = 0
tmp=bu
for i in range(len(mb)-3,-1,-1):
    if ls[i]<k:
        continue
    tmp2=[]
    for b in tmp:
        if (b>>i &1):
            tmp2.append(b)
    if len(tmp2)>=k:
        ans+=2**i
        tmp=tmp2
    else:
        pass
print(ans)

Buggy submission (verdict: Runtime Error):
ma = lambda :map(int,input().split())
lma = lambda :list(map(int,input().split()))
tma = lambda :tuple(map(int,input().split()))
ni = lambda:int(input())
yn = lambda fl:print("Yes") if fl else print("No")
import collections
import math
import itertools
import heapq as hq

n,k = ma()
A = lma()
bu = []
for i in range(n):
    tmp=0
    for j in range(i,n):
        tmp+=A[j]
        bu.append(tmp)
mb = bin(max(bu))
ans = 0
for i in range(len(mb)-3,-1,-1):
    tmp=[]
    for b in bu:
        if (b>>i &1):
            tmp.append(b)
    if len(tmp2)>=k:
        ans+=2**i
        bu=tmp
    else:
        pass
print(ans)
Problem p03220 (python)

Fixed submission:
def tempDif(h,T,A):
  temp = T - 0.006*h
  dif = A -temp
  if dif < 0:
    dif = -dif
  return dif
 
N = int(input())
T,A = map(int,input().split())
lis = [int(n) for n in input().split()]
 
lisnew = [tempDif(H,T,A) for H in lis]
print(lisnew.index(min(lisnew))+1)

Buggy submission (verdict: Runtime Error):
def tempDif(h,T,A):
  temp = T - 0.006*h
  dif = A -temp
  if dif < 0:
    dif = -dif
  return dif
 
N = int(input())
T,A = map(int,input().split())
lis = [int(n) for n in input().split()]
 
lisnew = [tempDif(H,T,A) for H in lis]
print(listnew.index(max(listnew)))
Problem p03241 (python)

Fixed submission:
import sys
import collections
from math import ceil
ma = lambda : map(int,input().split())
ni = lambda : int(input())
def divisor(n):
    d = []
    for i in range(1,int(n**0.5)+1):
        if n%i == 0:
            d.append(i)
            if i != n//i:
                d.append(n//i)
    #d.sort()
    return d
n,m = ma()
gcd = 1
D = divisor(m)
for d in D:
    q,r = divmod(m,d)
    if q>=n and r==0:gcd = max(gcd,d)
print(gcd)

Buggy submission (verdict: Runtime Error):
import sys
import collections
from math import ceil
ma = lambda : map(int,input().split())
ni = lambda : int(input())

n,m = ma()
gcd = 1
for d in range(m//n-2*n,m//n+1):
    q,r = divmod(m,d)
    if r == 0 and q>=n:gcd = d
print(gcd)
Problem p03325 (python)

Fixed submission:
input()
print(sum(map(lambda a:len(bin(int(a)&-int(a)))-3,input().split())))

Buggy submission (verdict: Runtime Error):
i=input;i()
i(sum([len(bin(a&-a))-3 for a in map(int,i().split())]))
Problem p03339 (python)

Fixed submission:
n = int(input())
pp = list(input())
cnt = 0
lis = [0]*n
w = [0]*n
e = [0]*n
if pp[0] =="W":
    w[0] =1
else:
    e[0] =1
for i in range(1,n):
    if pp[i] == "W":
        w[i] = w[i-1]+1
        e[i] = e[i-1]

    else:
        e[i] = e[i-1]+1
        w[i] = w[i-1]
for i in range(1,n):
    lis[i] = w[i-1]+e[n-1]-e[i]
lis[0] = e[n-1]-e[0]

print(min(lis))

Buggy submission (verdict: Runtime Error):
n = int(input())
pp = list(input())
cnt = 0
lis = []
for i in range(n):
    for j in range(i):
        if pp[j] == "E":
            cnt += 1
    for k in range(i+1,n):
        if pp[k] =="W":
            cnt += 1
    lis.apped(cnt) 
    cnt = 0
print(min(lis))
Problem p03361 (python)

Fixed submission:
h,w = map(int,input().split())
s = [list(input()) for i in range(h)]
edge = [(0,1),(0,-1),(1,0),(-1,0)]
for i in range(h):
    for j in range(w):
        if s[i][j] =="#":
            for x,y in edge:
                if 0<= i+y <h and 0<= j+x < w and s[i+y][j+x] =="#":break #三番目のforから抜け出す
            else:
                print("No")
                break #二番目
    else:continue
    break
else:print("Yes")

Buggy submission (verdict: Runtime Error):
h,w = map(int,input().split())
s = [list(input()) for i in range(h)]
edge = [(0,1),(0,-1),(1,0),(-1,0)]
ans = []
for i in range(h):
    for j in range(w):
        if s[i][j] =="#":
            for x,y in edge:
                if 0<= i+x <w and 0<= j+y < h and s[i+x][j+y] =="#":break #三番目のforから抜け出す
            else:
                print("No")
                break #二番目
    else:continue
    break
else:print("Yes")
Problem p03370 (python)

Fixed submission:
n,x = map(int,input().split())
m = [int(input()) for i in range(n)]
print(n + (x-sum(m))//min(m))

Buggy submission (verdict: Runtime Error):
n,x = map(int,input().split())
m = []
for i in range(n):
  m = m.append(int(input())) 
  
print(n + x//min(m))

Buggy submission (verdict: Runtime Error):
n,x = int(input())
m = []
for i in range(n):
  m = m.append(int(input())) 
print(n + x//min(m))

Buggy submission (verdict: Runtime Error):
n,x = int(input())
gr = [0 for i in range(1,n)]
for i in range(1,n):
  gr[i] = int(input())
print(n-1 + x//min(gr))
Problem p03377 (python)

Fixed submission:
import sys
input = sys.stdin.readline
ma = lambda : map(int,input().split())
ni = lambda : int(input())
a,b,x = ma()

if a<=x and a+b>=x:print("YES")
else:print("NO")

Buggy submission (verdict: Runtime Error):
import sys
input = sys.stdin.readline
ma = lambda : map(int,input().split())
ni = lambda : int(input())
a,b,x = ma

if a<=x and a+b>=x:print("Yes")
else:print("No")
Problem p03433 (python)

Fixed submission:
N = int(input())
A = int(input())
if N % 500 <= A:
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
N,A = map(int,input().split())
if N % 500 <= A:
  print("Yes")
else:
  print("No")
Problem p03434 (python)

Fixed submission:
n = int(input())
ls = list(map(int,input().split()))
A = []
B = []
lsn = sorted(ls,reverse = True)

A = lsn[0::2]
B = lsn[1::2]
print(sum(A)-sum(B))

Buggy submission (verdict: Runtime Error):
n = int(input())
ls = list(map(int,input().split()))
A = 0
B = 0
lsn = sorted(ls,reverse = True)
if n%2 == 1:
  lsn = lsn.append(0)
for i in range(0,len(lsn),2):
  A += lsn[i]
  B += lsn[i+1]
print(A-B)
Problem p03448 (python)

Fixed submission:
nums = [input() for i in range(3)]
A,B,C = map(int,nums)
x = int(input())
count = 0
for i in range(A+1):
  for j in range(B+1):
    for k in range(C+1):
      if 500*i+100*j+50*k == x:
        count +=1
print(count)

Buggy submission (verdict: Runtime Error):
nums = [input() for i in range(2)]
A,B,C = map(int,nums)
x = int(input())
  
count = 0
for i in range(A):
  if i*500 == x:
    count += 1
    break
  else:
    x -= i*500
    for j in range(B):
      if j*100 == x:
        count += 1
        break
      else:
        x -= j*100
        for k in range(C):
          if k*50 == x:
            count += 1
            break
print(count)

Buggy submission (verdict: Runtime Error):
nums = [input() for i in range(2)]
A,B,C = map(int,nums)
x = int(input())
  
count = 0
for i in range(A):
  if i*500 == x:
  	count += 1
  	break
  else:
    x -= i*500
    for j in range(B):
		if j*100 == x:
		  count += 1    		
		  break
        else:
          x -= j*100
          for k in range(C):
            if k*50 == x:
    		  count += 1
      		  break
print(count)

Buggy submission (verdict: Runtime Error):
nums = [input() for i in range(2)]
A,B,C = map(int,nums)
x = int(input())
  
count = 0
for i in range(A):
  if i*500 == x:
    count += 1
    break
  else:
    x -= i*500
    for j in range(B):
  		if j*100 == x:
    	  count += 1    		
  		  break
        else:
          x -= j*100
          for k in range(C):
            if k*50 == x:
    		  count += 1
      		  break
print(count)
Problem p03455 (python)

Fixed submission:
a,b = map(int,input().split())
if a*b % 2 == 0:
  print("Even")
else:
  print("Odd")

Buggy submission (verdict: Runtime Error):
a,b = map(int,input().split())
if a*b % 2 == 0:
  print("Even")
 else:
  print("Odd")
Problem p03470 (python)

Fixed submission:
n = int(input())
m = [int(input()) for i in range(n)]
mso = sorted(m)
count = 0
for s in range(1,n):
  if mso[s] == mso[s-1]:
    count += 1
print(n-count)

Buggy submission (verdict: Runtime Error):
n = int(input())
m = [int(input()) for i in range(n)]
mso = sorted(m)
count = 0
for s in range(1,n):
  if mso[s] == mso[s-1]
    count += 1
print(n-count)
Problem p03478 (python)

Fixed submission:
def sumC(x):
  s = x%10
  s1 = (x-s)/10 %10
  s2 = (x-s-s1*10)/100 %10
  s3 = (x-s-s1*10-s2*100)/1000 %10
  s4 = (x-s-s1*10-s2*100-s3*1000)/10000 %10
  return(int(s+s1+s2+s3+s4))
  
n,a,b = map(int,input().split())
ans = 0
for i in range(1,n+1):
  if a<= sumC(i) <= b:
    ans += i
print(ans)

Buggy submission (verdict: Runtime Error):
def sumC(x):
  s = x//10
  s1 = (x-s)//100
  s2 = (x-s-s1*10)//1000
  s3 = (x-s-s1*10-s2*100)//10000
  s4 = (x-s-s1*10-s2*100-s3*1000)//100000
  return(s+s1+s2+s+3+s4)
  
n,a,b = map(int,input().split)
ans = 0
for i in range(1,n+1):
  if a<= sumC(i) <= b:
    ans += i
print(ans)
Problem p03494 (python)

Fixed submission:
def counter(a):
  count = 0 
  while a%2 ==0:
    a /= 2
    count += 1
  return count
N = int(input())
s = [int(n) for n in input().split()]
print(min([counter(a) for a in s]))

Buggy submission (verdict: Runtime Error):
def counter(a):
  count = 0 
  while a%2 ==0:
    a /= 2
    count += 1
  return count
s = list(map(int,input().split()))
print(min(list(map(counter,s)))

Buggy submission (verdict: Runtime Error):
lis = map(int,input().split())
 
def counter(x):
  count = 0 
  while x%2 ==0:
    x = x/2
    count += 1
  return count
 
min(counter,lis)