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

Fixed submission:
n,x=map(int,input().split())
l=sorted(list(map(int,input().split())))
if sum(l)<=x:print(n-int(sum(l)!=x));exit()
if l[0]>x:print(0);exit()
d=[]
now=0
for i in l:
    now+=i;d.append(now)
from bisect import bisect_left as bl,bisect_right as br

print(br(d,x))

Buggy submission (verdict: Runtime Error):
n,x=map(int,input().split())
l=sorted(list(map(int,input().split())))

now=0
for i in l:
    now+=i;d.append(now)
from bisect import bisect_left as bl,bisect_right as br

print(max(0,br(d,x)-1+(sum(l)==x)))
Problem p03281 (python)

Fixed submission:
s=[]
for i in range(201)[105::2]:
  d=1;k=i
  for h in range(2,i+1):
    if i%h==0:
      cnt=0
      while i%h==0:
        cnt+=1
        i//=h
      d*=(cnt+1)
  if d==8:
    s.append(k)
ans=0;n=int(input())
for f in s:
  if n>=f:ans+=1
print(ans)

Buggy submission (verdict: Runtime Error):
print(len([1 for i in [104,134,164,188,194] if i<int(input())]))
Problem p03292 (python)

Fixed submission:
*a,=map(int,input().split())
print(max(a)-min(a))

Buggy submission (verdict: Runtime Error):
a=[int(input().split())]
print(max(a)-min(a))

Buggy submission (verdict: Runtime Error):
a=list(int(input().split()))
print(max(a)-min(a))

Buggy submission (verdict: Runtime Error):
a=list(int(input().split()) for i in range(3))
print(max(a)-min(a))

Buggy submission (verdict: Runtime Error):
a=[int(input().split()) for i in range(3)]
print(max(a)-min(a))

Buggy submission (verdict: Runtime Error):
*a=map(int,input().split())
print(max(a)-min(a))
Problem p03296 (python)

Fixed submission:
n=int(input())
from itertools import groupby as gb
ans=0
for a,b in gb(list(map(int,input().split()))):
    ans+=len(list(b)) //2
print(ans)

Buggy submission (verdict: Runtime Error):
n=int(input())
from itertools import groupby as gb
ans=0
for a,b in gb(list(map(int,input().split()))):
    ans+=b//2
print(ans)
Problem p03362 (python)

Fixed submission:
print(*[11,31,41,61,71,101,131,151,181,191,211,241,251,271,281,311,331,401,421,431,461,491,521,541,571,601,631,641,661,691,701,751,761,811,821,881,911,941,971,991,1021,1031,1051,1061,1091,1151,1171,1181,1201,1231,1291,1301,1321,1361,1381,1451,1471,1481,1511,1531][:int(input())],sep=" ")

Buggy submission (verdict: Runtime Error):
p={2,3};n,c=5,0
while c<int(input()):
  for j in p:
    if n%j==0:break
  else:p.add(n);if n%5==1:print(n,end=" ");cnt+=1
print()
Problem p03380 (python)

Fixed submission:
from bisect import bisect_left as bl,bisect_right as br
n=int(input())
l=list(map(int,input().split()))
l.sort()
pre=10**9
mm=l[-1];p=0
for i in range(max(0,bl(l,l[-1]//2)-2),min(n,l[-1]//2+3)):
    if abs(mm/2-l[i])<pre:pre=abs(mm/2-l[i]);p=i
print(mm,l[p])

Buggy submission (verdict: Runtime Error):
from scipy import special
from bisect import bisect_left as bl,bisect_right as br
n=int(input())
l=list(map(int,input().split()))
l.sort()
mm=l[-1];ans=0;p=0
for i in range(max(0,bl(l,l[-1]//2)-2),min(n,l[-1]//2+3)):
    g=scipy.special.comb(mm, l[i], exact = False)
    if ans<g:
        ans=g
        p=i
print(mm,l[p])
Problem p03386 (python)

Fixed submission:
a,s,k=map(int,input().split())
if s-a<=2*k-1:print(*list(range(a,s+1)),sep="\n")
else:print(*list(range(a,a+k))+list(range(s+1-k,s+1)),sep="\n")

Buggy submission (verdict: Runtime Error):
a,s,k=map(int,input().split())
if s-a<=2*k-1:print(*list(range(a,s+1)),sep="\n")
else:print(*list(range(a,a+k)),*list(range(s+1-k,s+1)),sep="\n")
Problem p03393 (python)

Fixed submission:
d="zyxwvutsrqponmlkjihgfedcba"
s=input()
if s=="zyxwvutsrqponmlkjihgfedcba":print(-1)
else:
    if len(s)!=26:
        for i in range(1,1+26):
            if d[-i] not in s:print(s+d[-i]);exit()
    else:
        from bisect import bisect_left as bl,bisect_right as br
        de=[s[-1]]
        for i in range(2,27):

            if de[-1]<s[-i]:de.append(s[-i])
            else:print(s[:-i]+de[bl(de,s[-i])]);exit()

Buggy submission (verdict: Runtime Error):
s=input()
if s=="zyxwvutsrqponmlkjihgfedcba":print(-1);exit()
if len(s)!=26:
    print(s+sorted(list(set(list("zyxwvutsrqponmlkjihgfedcba"))-set(list(s))))[0])
else:
    des=set()
    l=list(s)
    while chr(ord(s[-1])+1) not in des:
        des.add(l.pop())
    print("".join(l[:-1])+sorted(list(des))[0])
Problem p03403 (python)

Fixed submission:
n=int(input())
l=[0]+list(map(int,input().split()))+[0]
ans=0
for a,s in zip(l,l[1:]):
    ans+=abs(a-s)
for i in range(n):
    a,s=sorted([l[i],l[i+2]])
    if a<=l[i+1]<=s:print(ans)
    else:
        print(ans-abs(a-l[i+1])-abs(l[i+1]-s)+s-a)

Buggy submission (verdict: Runtime Error):
n=input()
l=[0]+list(map(int,input().split()))+[0]
ans=0
pre=0
for i in l:ans+=abs(pre-i);pre=i
for i in range(1,int(n)+1):
  dif=-abs(l[i]-l[i-1])-abs(l[i]-l[i+1])+abs(l[i-1]-l[i+1])
  if l[i]in(l[i-1],l[i+1]):print(ans)
  elif l[i]<l[i-1]:
    print(ans if l[i+1]<l[i] else ans+dif)
  else:print(ansans if l[i+1]>l[i] else ans+dif)
Problem p03416 (python)

Fixed submission:
a,b=map(int,input().split())
ans=0
for i in range(b+1)[a:]:
  if len(str(i))%2==0:
    p=list(str(i))[:len(str(i))//2]
    q=list(reversed(list(str(i))[len(str(i))//2:]))
    if p==q:
      ans+=1
  else:
    s=list(str(i))[:len(str(i))//2+1]
    d=list(reversed(list(str(i))[len(str(i))//2:]))
    if s==d:
      ans += 1
print(ans)

Buggy submission (verdict: Runtime Error):
a,s=map(int,input().split())
ad=0
for i in range(a,b+1):
  s=str(i)
  if s==s[::-1]:ad+=1
print(ad)

Buggy submission (verdict: Runtime Error):
a,s=map(int,input().split())
A=0
for i in range(a,b+1):
  if str(i)==str(i)[::-1]:A+=1
print(A)

Buggy submission (verdict: Runtime Error):
a,s=map(int,input().split())
A=0
for i in range(a,b+1):
  if str(i)==str(i)[::-1]:A+=1
print(A)
Problem p03433 (python)

Fixed submission:
n=int(input())
a=int(input())
print("No") if (n%500) > a else print("Yes")

Buggy submission (verdict: Runtime Error):
n=int(input())
a=int(input())
print("No") if (n%500) >= a else ptrint("Yes")

Buggy submission (verdict: Runtime Error):
n=int(input())
a=int(input())
print("No") if n%500 >= a else ptrint("Yes")

Buggy submission (verdict: Runtime Error):
n=int(input())
a=int(input())
print("No") if (n%500)>=a else ptrint("Yes")
Problem p03447 (python)

Fixed submission:
x,y,z=[int(input()) for i in range(3)]
x-=y
x-=(x//z)*z
print(x)

Buggy submission (verdict: Runtime Error):
x,y,z=*[int(input()) for i in range(3)]
x-=(x//y)*y
x-=(x//z)*z
print(x)
Problem p03471 (python)

Fixed submission:
mai,yen=map(int,input().split())
for i in range(mai+1):
  for j in range(mai+1-i):
    if 10000*i+5000*j+1000*(mai-i-j)==yen:print(i,j,mai-i-j);exit()
else:print(-1,-1,-1)

Buggy submission (verdict: Runtime Error):
mai,yen=map(int,input().split())
for i in range(mai+1):
  for j in range(mai+1-j):
    if 10000*i+5000*j+1000*(mai-i-j)==yen:print(i,j,mai-i-j);exit()
else:print(-1,-1,-1)

Buggy submission (verdict: Runtime Error):
mai,yen=map(int,input().split())
for i in range(mai+1):
  for j in range(mai+1-j):
    if 10000*i+5000*j+1000*(mai-i-j)==yen:print(i,j,mai-i-j);exit()
else:pint(-1,-1,-1)
Problem p03475 (python)

Fixed submission:
n=int(input())
l=[list(map(int,input().split())) for i in range(n-1)]+[[0,0,1]]
al=[]
mati=0
for i in range(n):
  now=l[i][1]+l[i][0]
  for j in range(i+1,n):
    now=l[j][0]+l[j][1]-(-max(0,now-l[j][1])//l[j][2])*l[j][2]
  al.append(now)
print(*al,sep="\n")

Buggy submission (verdict: Runtime Error):
def f():
  n=int(input())
  l=(tuple(map(int,input().split())) for i in range(n-1))
  for i in range(n):
    now=0
    for a,s,d in l[i:]:
      now=a+s-(-max(0,now-s)//d)*d
    print(now)
if __name__=="__main__":
  f()
Problem p03501 (python)

Fixed submission:
a,s,d=map(int,input().split());print(min(a*s,d))

Buggy submission (verdict: Runtime Error):
n,c=map(int,input().split())
table=[0]*220000
for i in range(n):
    a,s,c=map(int,input().split())
    table[2*a-1]+=1
    table[s*2]-=1
from itertools import accumulate
print(max(list(accumulate(table))))
Problem p03523 (python)

Fixed submission:
s=input()
l=list("AKIHABARA".split("A"))[1:-1]

for ii in range(2**4):
  p="A" if ii%2 else ""
  i=ii
  for j in range(3):
    p+=l[j]
    i//=2
    p+="A" if i%2 else ""
  if s==p:print("YES");exit()
print("NO")

Buggy submission (verdict: Runtime Error):
s=input()
l=list("AKIHABARA".split("A"))[1:-1]

for ii in range(2**4):
  p="A" if ii%2 else ""
  i=ii
   for j in range(3):
    p+=l[j]
    i//=2
    p+="A" if i%2 else ""
  if s==p:print("YES");exit()
print("NO")
Problem p03524 (python)

Fixed submission:
from collections import Counter as co
s=input()
n=len(s)
l=sorted(co(list(s)).values())
if len(l)<=2:
    print("YES") if n==len(l) else print("NO")

else:
    m=l[0]
    for v in l:
        if v-m<=1:continue
        print("NO");exit()

    print("YES")

Buggy submission (verdict: Runtime Error):
from collections import Counter as co
s=input()
n=len(s)
l=sorted(co(list(s)).values())
if len(l)<=2:
    print("YES") if n==len(l) else print("NO")

else:
    m=l[0]
    for i,v in l:
        if v-m<=1:continue
        print("NO");exit()

    print("YES")
Problem p03546 (python)

Fixed submission:
h,w=map(int,input().split())
tra=[list(map(int,input().split())) for i in range(10)]
ll=[[tra[i][j] for j in range(10)] for i in range(10)]
for i in range(10**3-1):
    for i in range(10):
        for j in range(10):
            if i!=j:
                ll[i][j]=min(ll[i][j],min(ll[i][o]+tra[o][j] for o in range(10) if o!=i and o!=j))
ans=0
for i in range(h):
    for j in map(int,input().split()):
        if j==-1 or j==1:continue
        ans+=ll[j][1]
print(ans)

Buggy submission (verdict: Runtime Error):
h,w=map(int,input().split())
ll=[list(map(int,input().split())) for i in range(10)]

for i in range(10**3-1):
    for i in range(10):
        for j in range(10):
            if i!=j:
                ll[i][j]=min(ll[i][j],min(ll[i][o]+tra[o][j] for o in range(10) if o!=i and o!=j))
ans=0
for i in range(h):
    for j in map(int,input().split()):
        if j==-1 or j==1:continue
        ans+=ll[j][1]
print(ans)
Problem p03549 (python)

Fixed submission:
n,m=map(int,input().split())
print((2**m)*(100*n+1800*m))

Buggy submission (verdict: Runtime Error):
n,m=map(int,input().split())
print(2**m*(100n+1800m))
Problem p03569 (python)

Fixed submission:
s=input()
d=s.replace("x","")
rd=d[::-1]
if d!=rd:print(-1)
else:
    ans=0
    x,y=0,len(s)-1
    while y-x>0:
        if s[x]==s[y]:
            x+=1;y-=1
        elif s[x]=="x":
            ans+=1;x+=1
        else:
            ans+=1;y-=1
    print(ans)

Buggy submission (verdict: Runtime Error):
s=input()
d=s.replace("x","")
rd=d[::-1]
if d!=rd:print(-1)
else:
    ans=0
    x,y=0,len(s)-1
    while abs(x-y)>0:
        if s[x]==s[y]:x+=1;y-=1
        elif s[x]=="x":ans+=1;x+=1
        else:ans+=1;y-=1
    print(ans)
Problem p03574 (python)

Fixed submission:
gyou,retu=map(int,input().split())
l=[input() for _ in range(gyou)]
d=[(-1,-1),(-1,0),(-1,1),(0,-1),(0,1),(1,-1),(1,0),(1,1)]
for g in range(gyou):
  preans=str()
  for r in range(retu):
    s=0
    if l[g][r]=="#":
      preans += "#"
    else:
      for x in range(8):
        a,b=d[x]
        try:
          if l[g+a][r+b]=="#" and g+a>=0 and r+b>=0:
            s+=1
        except IndexError:
          s+=0
      preans += str(s)
  print(preans)

Buggy submission (verdict: Runtime Error):
n,m=map(int,input().split())
l=["!"*(m+2)]+["!"+input()+"!" for i in range(n)]+["!"*(m+2)]
ans=["0"*m for c in range(n)] 
for i in range(n):
  for d in range(m):
    if l[i+1][d+1]==".":
      ret=0
      for a,b in[[1,1],[1,0],[0,1],[-1,-1],[-1,0],[0,-1],[1,-1],[-1,1]] :
        if l[i+1+a][d+1+b]=="#":
          ret+=1
        ans[i][d]=str(ret)
    else:ans[i][d]="#"
for i in range(n):
  print(ans[i])

Buggy submission (verdict: Runtime Error):
gyou,retu=map(int,input().split())
l=[input() for _ in range(gyou)]
d=[(-1,-1),(-1,0),(-1,1),(0,-1),(0,1),(1,-1),(1,0),(1,1)]
for g in range(gyou):
  preans=str()
  for r in range(retu):
    s=0
    if l[g][r]=="#":
      preans += "#"
    else:
      for x in range(8):
        a,b=*d[x]
        try:
          if l[g+a][r+b]=="#" and g+a>=0 and r+b>=0:
            s+=1
        except IndexError:
          s+=0
      preans += str(s)
  print(preans)
Problem p03592 (python)

Fixed submission:
n,m,k=map(int,input().split())
n,m=min(n,m),max(n,m)
for i in range(n//2+n%2):
  num,dem=k-i*m,n-2*i
  if num%dem or not(0<=num//dem<=m):continue
  print("Yes");exit()
print("No")

Buggy submission (verdict: Runtime Error):
n,m,k=map(int,input().split())
n,m=min(n,m),max(n,m)
for i in range(n//2+n%2):
  num,dem=k-i*m,n-2*i
  if num%dem or not(0<=num///dem<=m):continue
  print("Yes");exit()
print("No")
Problem p03599 (python)

Fixed submission:
from decimal import Decimal as D
mi1,mi2,sa1,sa2,houwa,lim=map(int,input().split())
slim=houwa*lim//(100+houwa)
ws=set(mi1*i+mi2*j for i in range(lim//(100*mi1)+2) for j in range(lim//(100*mi2)+2) if 100*(mi1*i+mi2*j)<=lim)
ss=set(sa1*i+sa2*j for i in range(slim//sa1+2) for j in range(slim//sa2+2) if (sa1*i+sa2*j)<=slim)
ans=D("0")
iw,isa=mi1,0
for s in ss:
  for w in ws:
    if s>houwa*w or w==0:continue
    if ans<D(str(10000*s))/D(str(s+100*w)) and s+100*w<=lim:
      ans=D(str(10000*s))/D(str(s+100*w))
      isa,iw=s,w
print(100*iw+isa,isa)

Buggy submission (verdict: Runtime Error):
from decimal import Decimal as D
mi1,mi2,sa1,sa2,houwa,lim=map(int,input().split())
slim=houwa*lim/(100+houwa)
ws=set(mi1*i+mi2*j for i in range(lim//(100*mi1)+1) for j in range(lim//(100*mi2)+2) if 100*(mi1*i+mi2*j)<=lim)
ss=set(sa1*i+sa2*j for i in range(slim//sa1+1) for j in range(slim//sa2+2) if (sa1*i+sa2*j)<=slim)
ans=D("0")
iw,isa=mi1*100,0
for s in ss:
  for w in ws:
    if s>houwa*w or w==0:continue
    if ans<D(str(10000*s))/D(str(s+100*w)) and s+100*w<=lim:
      ans=D(str(10000*s))/D(str(s+100*w))
      isa,iw=s,w
print(100*iw+isa,isa)

Buggy submission (verdict: Runtime Error):
from decilmal import Decimal as D
mi1,mi2,sa1,sa2,houwa,lim=map(int,input().split())
slim=lim*houwa//100
ws=set(mi1*i+mi2*j for i in range(lim//(100*mi1)+2) for j in range(lim//(100*mi2)+2) if 100*(mi1*i+mi2*j)<=lim)
ss=set(sa1*i+sa2*j for i in range(slim//sa1+2) for j in range(slim//sa2+2) if (sa1*i+sa2*j)<=slim)
ans=D("0")
iw,isa=mi1*100,0
for s in ss:
  for w in ws:
    if s>houwa*w or s==w==0:continue
    if ans<D(str(10000*s))/D(str(s+100*w)) and s+100*w<=lim:
      ans=D(str(10000*s))/D(str(s+100*w))
      isa,iw=s,w
print(100*iw+isa,isa)
Problem p03633 (python)

Fixed submission:
n=int(input())
l=list(set([int(input()) for d in range(n)]))  
a=l[0]
def gcd(a,s):
  a,s=min(a,s),max(a,s)
  if a==0:return s
  else:return gcd(s%a,a)

for i in l[1:]:
  a=a*i//gcd(a,i)
print(a)

Buggy submission (verdict: Runtime Error):
n=int(input())
l=list(set([int(input()) for d in range(n)]))  
a=l[0]
sd=0
for i in l[1:]:
  for h in range(min(i,a)+1)[:0:-1]:
    if (a%h,i%h)==(0,0):sd=h,break
  a=a*i//sd
print(a)
Problem p03635 (python)

Fixed submission:
a,s=map(int,input().split())
print((s-1)*(a-1))

Buggy submission (verdict: Runtime Error):
a,s=int(input().split())
print((s-1)*(a-1))
Problem p03644 (python)

Fixed submission:
n=int(input())
for i in range(7):
  if 2**i<=n<2**(i+1):
    print(2**i)

Buggy submission (verdict: Runtime Error):
n=int(input())
for i in range(7):
  print(i) if 2**i <= n < 2**(i+1)

Buggy submission (verdict: Runtime Error):
n=int(input())
for i in range(7):
  print(i) if 2**i <= n < 2++(i+1)

Buggy submission (verdict: Runtime Error):
n=input()
for i in range(7):
  print(i) if 2**i <= n < 2++(i+1)
Problem p03651 (python)

Fixed submission:
n,k=map(int,input().split())
l=sorted(map(int,input().split()))
def gcd(x,y):
  if y==0:return x
  return gcd(y,x%y)
ans=""
s=0
for i in l:
  s=gcd(i,s)
  if s==1:break
else:
  if k%s!=l[-1]%s:
    ans="IM"
if l[-1]<k:ans="IM"
print(ans+"POSSIBLE")

Buggy submission (verdict: Runtime Error):
n,k=map(int,input().split())
l=soted(list(map(int,input().split())))
def gcd(x,y):
  if y==0:return x
  return gcd(y,x%y)
ans=""
s=0
for i in l:
  s=gcd(i,s)
  if s==1:break
else:
  if k%s!=l[-1]%s:
    ans="IM"
print(ans+"POSSIBLE")

Buggy submission (verdict: Runtime Error):
n,k=map(int,input().split())
l=soted(map(int,input().split()))
def gcd(x,y):
  if y==0:return x
  return gcd(y,x%y)
ans=""
s=0
for i in l:
  s=gcd(i,s)
  if s==1:break
else:
  if k%s!=l[-1]%s:
    ans="IM"
print(ans+"POSSIBLE")
Problem p03688 (python)

Fixed submission:
n=int(input())

a=list(map(int,input().split()))
if len(set(a))==1:
    if n>=2*a[0] or n-1==a[0]:print("Yes")
    else:print("No")
elif len(set(a))>=3:print("No")
else:
    s,S=sorted(list(set(a)))
    k=a.count(s)
    if S==s+1 and 2*S-n<=k and S>k:print("Yes")
    else:print("No")

Buggy submission (verdict: Runtime Error):
n=int(input())
a=list(map(int,input().split()))
if len(set(a))==1:
    if n>=2*a[0] or n-1==a[0]:print("Yes")
    else:print("No")
elif len(set(a))==3:print("No")
else:
    s,S=sorted(list(set(a)))
    if n+a.count(s)>=2*S:print("Yes")
    else:print("No")
Problem p03695 (python)

Fixed submission:
n=int(input())
def f(x):
  return x//400 if x<3200 else 8
l=list(map(f,list(map(int,input().split()))))
ds=l.count(8)
sl=set(l)
if ds==0:
  print(len(sl),len(sl))
elif len(sl)==1:print(1,ds)
else:
  print(len(sl)-1,len(sl)+ds-1)

Buggy submission (verdict: Runtime Error):
n=int(input())
def f(x):
  return x//400 if x<3200 else return 8
l=set(map(lambda x:x//400 if x < 3200 else 8 ,list(map(int,input().split()))))
print(l)
Problem p03719 (python)

Fixed submission:
a,b,c=map(int,input().split())
print("YNeos"[not (a<=c<=b)::2])

Buggy submission (verdict: Runtime Error):
a,b,c=map(int,input().split())
print("YNeos"[!(a<=c<=b)::2])
Problem p03720 (python)

Fixed submission:
t,l=map(int,input().split())
li=[0 for i in range(t)]
for i in range(l):
  a,b= map(int,input().split())
  li[a-1]+=1
  li[b-1]+=1
print(*li,sep="\n")

Buggy submission (verdict: Runtime Error):
t,l=map(int,input().split())
li=[set() for i in range(t)]
for i in range(l):
  a,b= map(int,input().split())
  l[a-1].add(b)
  l[b-1].add(a)
for i in li:
  print(len(i))

Buggy submission (verdict: Runtime Error):
t,l=map(int,input().split())
l=[set() for i in range(t)]
for i in range(l):
  a,b= map(int,input().split())
  l[a-1].add(b)
  l[b-1].add(a)
for i in l:
  print(len(i))
Problem p03721 (python)

Fixed submission:
n,k=map(int,input().split())
l=sorted([list(map(int,input().split())) for _ in range(n)])
cou=0
for r in l:
  a,b=r[0],r[1]
  cou+=b
  if cou>=k:
    print(a)
    break

Buggy submission (verdict: Runtime Error):
n,k=map(int,input().split())
l=[list(map(int,input().split())) for _ in range(n)].sort()
cou=0
for r in l:
  a,b=r[0],r[1]
  cou+=b
  if cou>=k:
    print(a)
    break

Buggy submission (verdict: Runtime Error):
n,k=map(int,input().split())
l=[list(map(int,input().split())) for _ in range(n)].sort()
cou=0
for [a,b] in l:
  cou+=b
  if cou>=k:
    print(a)
    break
Problem p03730 (python)

Fixed submission:
a,b,c=map(int,input().split())
from fractions import gcd
print("NO")if c%gcd(a,b) else print("YES")

Buggy submission (verdict: Runtime Error):
a,b,c=map(int,input().split())
from math import gcd
print("NO")if c%gcd(a,b) else print("YES")
Problem p03761 (python)

Fixed submission:
from itertools import groupby as gb
n=int(input())
s=set(list("qazwsxedcrfvtgbyhnujmiklop"))
l=[500 for i in range(26)]
for i in  range(n):
  strd=sorted(input())
  vs=set(strd)
  sstr=sorted(list(vs))
  gr=[(a,len(list(b))) for a,b in gb(strd)]
  for t in s-vs:
    l[ord(t)-97]=0
  if sum(l)==0:print();exit()
  for v in vs:
    fg=ord(v)-97
    l[fg]=min(l[fg],gr[sstr.index(v)][1])
  s&=vs
ans=""
for i,c in enumerate(l):
  if c:
    f=chr(i+97)
    ans+=f*c
print(ans)

Buggy submission (verdict: Runtime Error):
from collections import Counter as c
n=int(input())
l=[[s,cou for s,cou in c(input()).items()]for i in range(n)]
Problem p03796 (python)

Fixed submission:
import math
a=int(input())
print(math.factorial(a)%(10**9+7))

Buggy submission (verdict: Runtime Error):
import math
a=int(input())
print(math.factrial(a)%(10*9+7))
Problem p03813 (python)

Fixed submission:
print("A{}C".format("B"if int(input())<1200else"R"))

Buggy submission (verdict: Runtime Error):
print("A{}C".format("B" if int(input()<1200 else "R"))
Problem p03826 (python)

Fixed submission:
a,s,d,f=map(int,input().split());print(max(a*s,d*f))

Buggy submission (verdict: Runtime Error):
print("A{}C".format("B"if int(input())<1200else"R"))
Problem p03828 (python)

Fixed submission:
mod=10**9+7
import math
n=int(input())
ans=1
l=[0]*n
for ii in range(2,n+1):
  i=ii
  for j in range(2,int(math.sqrt(i))+1):
    if i%j==0:
      cnt=0
      while  i%j==0:
        cnt+=1;i//=j
      l[j-1]+=cnt
  if i!=1:
    l[i-1]+=1
for i in l:
  ans*=(i+1)
  ans%=mod
print(ans)

Buggy submission (verdict: Runtime Error):
mod=10**9+7
import math
n=int(input())
ans=1
l=[0]*n
for ii in range(n,2,-1):
  i=ii
  for j in range(2,int(math.sqrt(i))+1):
    if i%j==0:
      cnt=0
      while  i%j==0:
        snt+=1;i//=j
      l[i-1]+=cnt
  if i!=1:
    l[i-1]+=1
for i in l:
  ans+=(i+1)
  ans%=mod
print(ans)

Buggy submission (verdict: Runtime Error):
mod=10***9+7
import math
n=int(input())
ans=1
l=[0]*n
for ii in range(n,2,-1):
  i=ii
  for j in range(2,int(math.sqrt(i))+1):
    if i%j==0:
      cnt=0
      while  i%j==0:
        snt+=1;i//=j
      l[i-1]+=cnt
  if i!=1:
    l[i-1]+=1
for i in l:
  ans+=(i+1)
  ans%=mod
print(ans)
Problem p03845 (python)

Fixed submission:
n=int(input())
t=[0]+list(map(int,input().split()))
ans=sum(t)
o=ans
for i in range(int(input())):
    p,x=map(int,input().split())
    print(ans-t[p]+x)

Buggy submission (verdict: Runtime Error):
n=int(input())
l=[0]+list(map(int,input().split()))\
ans=sum(l)
for i in range(int(input())):
  a,s=map(int,input().split())
  print(ans-l[a]+s)
Problem p03910 (python)

Fixed submission:
from math import sqrt
n=int(input())
d=min(-(-int(sqrt(8*n+1))//2),n)
l=list(range(1,d+1))
remain=(d*(d+1))//2-n

while remain>=l[-1]:
    remain-=l[-1]
    l.pop()
print(*list(set(l)-set([remain])),sep="\n")

Buggy submission (verdict: Runtime Error):
from math import sqrt
n=int(input())
d=min(-(-int(sqrt(8*n+1))//2),n)
l=list(range(1,d+1))
remain=(d*(d+1))//2-n
while remain<=l[-1]:
    remain-=l[-1]
    l.pop()
print(set(l)-set([remain]))
Problem p03945 (python)

Fixed submission:
s=input()
ans=0
for x,y in zip(s,s[1:]):
  if x!=y:ans+=1
print(ans)

Buggy submission (verdict: Runtime Error):
s=input()
from itertools import groupby as gb
print(len(gb(s)))
Problem p03994 (python)

Fixed submission:
s=input()
n=int(input())
l=""
for i in range(len(s)):
    f=(26+ord("a")-ord(s[i]))%26
    if n>=f:n-=f;l+="a"
    else:l+=s[i]
    if n==0:print(l+s[i+1:]);exit()
print(l[:-1]+chr(ord(l[-1])+n%26))

Buggy submission (verdict: Runtime Error):
s=input()
n=int(input())
l=""
for i in range(len(s)):
    f=(26+ord("a")-ord(s[i]))%26
    if n>=f:n-=f;l+="a"
    else:l+=s[i]
    if n==0:print(l+s[i+1:]);exit()
print(l[:-1]+chr(ord(l[-1])+n))
Problem p03997 (python)

Fixed submission:
a,b,c,d=eval('['+'int(input()),'*3+'0]');print((a+b)*c//2)

Buggy submission (verdict: Runtime Error):
print(eval('(i*i)*i//2'.replace('i','int(input()')))

Buggy submission (verdict: Runtime Error):
a,b,c=eval('int(input())'*3)
print((a+b)*h//2)
Problem p04030 (python)

Fixed submission:
from itertools import groupby as gb
s=""
for i,b in gb(input()):
  if i=="B":
    s=s[:-len(list(b))]
  else:s+=i*len(list(b))
print(s)

Buggy submission (verdict: Runtime Error):
from itertools import groupby as gb
ans=""
for i,b in gb(input()):
  if i=="B":
    s=s[:-len(list(b))]
  else:s+=i*len(list(b))
print(ans)