Harryxun/testdata huggingface dataset:
Buggy python 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)


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 python 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)


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 python submission (verdict: Time Limit Exceeded):
n=int(input())
l=[int(input()) for _ in range(n)]
a=0
for i in set(l):
  if l.count(i)%2:a+=1
print(a)

Fixed submission:
from collections import Counter as co
n=int(input())
l=[int(input()) for _ in range(n)]
print(len([1 for (a,d) in co(l).items() if d%2]))
Buggy python submission (verdict: Time Limit Exceeded):
t,r,g=map(int,input().split())
d=[[float("INF")]*t for i in range(t)]
for i in range(t):
    d[i][i]=0
gl=list(map(int,input().split()))
for j in range(r):
    x,y,c=map(int,input().split())
    d[x-1][y-1]=c
    d[y-1][x-1]=c
for i in range(t):
    for j in range(t):
        for k in range(t):
            d[i][j]=min(d[i][j],d[i][k]+d[k][j])
from itertools import permutations as pe
ans=float("INF")
for i in pe(gl,r=None):
    #rは長さ、Noneでiteraterの長さ
    p=0
    for k,j in zip(i,i[1:]):
        p+=d[k-1][j-1]
    ans=min(ans,p)
print(ans)

Fixed submission:
t,r,g=map(int,input().split())
d=[[float("INF") for ccc in range(t)] for i in range(t)]
for i in range(t):
    d[i][i]=0
gl=list(map(int,input().split()))
for j in range(r):
    x,y,c=map(int,input().split())
    d[x-1][y-1]=c
    d[y-1][x-1]=c
for i in range(t):
    for j in range(t):
        for k in range(t):
            d[k][j]=min(d[k][j],d[k][i]+d[i][j])
from itertools import permutations as pe
ans=float("INF")
for G in pe(gl):
    p=0
    for qw in range(g-1):
        p+=d[G[qw]-1][G[qw+1]-1]
    ans=min(ans,p)
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
g=list(map(int,input().split()))
l=[0]*(max(g)+2)
for i in g:
  for j in range(max(0,i-1),min(i+2,max(g)+1)):
    l[j]+=1
print(max(l))

Fixed submission:
n=int(input())
g=list(map(int,input().split()))
f=max(g)
l=[0]*(f+2)
for i in g:
  for j in range(max(0,i-1),min(i+2,f+1)):
    l[j]+=1
print(max(l))
Buggy python submission (verdict: Time Limit Exceeded):
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)

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 python 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)

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 python submission (verdict: Time Limit Exceeded):
n=int(input())
l=list(set([int(input()) for d in range(n)]))
def gcd(a,s):
  for i in range(min(a,s)+1)[:0:-1]:
    if (a%i,s%i)==(0,0):
      return i

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

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 python submission (verdict: Runtime Error):
a,s=int(input().split())
print((s-1)*(a-1))

Fixed submission:
a,s=map(int,input().split())
print((s-1)*(a-1))
Buggy python submission (verdict: Runtime Error):
n=int(input())
for i in range(7):
  print(i) if 2**i <= n < 2**(i+1)

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

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

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

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

Fixed submission:
n=int(input())
for i in range(7):
  if 2**i<=n<2**(i+1):
    print(2**i)
Buggy python submission (verdict: Time Limit Exceeded):
n,m=map(int,input().split())
edges=[set() for i in range(n+1)]
for i in range(m):
	a,s=map(int,input().split())
	edges[a].add(s)
	edges[s].add(a)
for i in range(2,n):
	if i in edges[1]&edges[n]:
		print("POSSIBLE");exit()
print("IMPOSSIBLE")

Fixed submission:
n,m=map(int,input().split())
edges=[set() for i in range(n+1)]
for i in range(m):
	a,s=map(int,input().split())
	edges[a].add(s)
	edges[s].add(a)
for i in range(2,n):
	if i in edges[1] and i in edges[n]:
		print("POSSIBLE");exit()
print("IMPOSSIBLE")
Buggy python 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")


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 python 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")

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 python 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")

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 python 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)

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 python submission (verdict: Runtime Error):
a,b,c=map(int,input().split())
print("YNeos"[!(a<=c<=b)::2])

Fixed submission:
a,b,c=map(int,input().split())
print("YNeos"[not (a<=c<=b)::2])
Buggy python 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))

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 python 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))

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 python 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

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 python 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

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 python submission (verdict: Time Limit Exceeded):
n,m=map(int,input().split())
c=sum([list(map(int,input().split())) for i in range(m)],[])
from collections import Counter as co
for i in co(c).values():
    if i%2:print("NO");exit()
print("YES")

Fixed submission:
n,m=map(int,input().split())
l=[0]*(n+1)
for i in range(m):
    a,s=map(int,input().split())
    l[a]+=1
    l[s]+=1
for i in l:
    if i%2:print("NO");exit()
print("YES")

Buggy python submission (verdict: Runtime Error):
n,m=map(int,input().split())
c=sum([list(map(int,input().split())) for i in range(m)],[])
from collections import Counter as co
for i in co(c).values():
    if i%2:print("NO");exit()
  print("YES")

Fixed submission:
n,m=map(int,input().split())
l=[0]*(n+1)
for i in range(m):
    a,s=map(int,input().split())
    l[a]+=1
    l[s]+=1
for i in l:
    if i%2:print("NO");exit()
print("YES")
Buggy python 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")

Fixed submission:
a,b,c=map(int,input().split())
from fractions import gcd
print("NO")if c%gcd(a,b) else print("YES")
Buggy python 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)]

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 python submission (verdict: Runtime Error):
from math imoprt sqrt
n=int(input())
for i in range(int(sqrt(n)),0,-1):
  if n%i==0:
    print(max(len(str(i)),len(str(n//i))))
    exit()

Fixed submission:
n=int(input())
m=int((n**(1/2))//1+1)
l=[]
for i in list(range(m+1))[:0:-1]:
  if n%i==0:
    l.append(max(len(str(i)),len(str(n//i))))
  if len(l)==3:
    break
print(min(l))

Buggy python submission (verdict: Runtime Error):
n=int(input())
m=n**(1/2)//1+1
l=[]
for i in range(m+1)[:0:-1]:
  if n%i==0:
    l.append(max(len(str(i)),len(str(n//i))))
  if len(l)==3:
    break
print(min(l))

Fixed submission:
n=int(input())
m=int((n**(1/2))//1+1)
l=[]
for i in list(range(m+1))[:0:-1]:
  if n%i==0:
    l.append(max(len(str(i)),len(str(n//i))))
  if len(l)==3:
    break
print(min(l))
Buggy python submission (verdict: Runtime Error):
from collections import Counter as co
hit,te,ji=map(int,input().split())
l=list(co(sorted([int(input()) for u in range(hit)])).items())
inc=0
ans=0
ef=len(l)
for ix in range(hit):
  k,v=l[inc]
  ans-=(-v//te)
  nokori=te-v%te if v%te else 0
  inc+=1
  if inc==ef:break
  while nokori:
    if l[inc][0]>k+ji:
      break
    if l[inc][1]<=nokori:
      nokori-=l[inc][1]
      inc+=1
      if inc==ef:break
    else:l[inc][1]-=nokori;break
print(ans+1 if nokori else ans)

Fixed submission:
n,c,k=map(int,input().split())
ans=0
cnt=1
t=sorted([int(input())for s in range(n)])
while t:
    now=t.pop()
    ans+=1
    while t and cnt<c and t[-1]+k>=now:
        cnt+=1
        t.pop()
    cnt=1

print(ans)

Buggy python submission (verdict: Runtime Error):
from collections import Counter as co
hit,te,ji=map(int,input().split())
l=list(co(sorted([int(input()) for u in range(hit)])).items())
inc=0
ans=0
ef=len(l)
for ix in range(hit):
  k,v=l[inc]
  ans-=(-v//te)
  nokori=te-v%te if v%te else 0
  inc+=1
  while nokori:
    if l[inc][0]>k+ji:break
    if l[inc][1]<=nokori:
      nokori-=l[inc][1]
      inc+=1
      if inc==ef:break
    else:l[inc][1]-=nokori;break
  if inc==ef:break
print(ans+1 if nokori else ans)

Fixed submission:
n,c,k=map(int,input().split())
ans=0
cnt=1
t=sorted([int(input())for s in range(n)])
while t:
    now=t.pop()
    ans+=1
    while t and cnt<c and t[-1]+k>=now:
        cnt+=1
        t.pop()
    cnt=1

print(ans)

Buggy python submission (verdict: Runtime Error):
from collections import Counter as co
hit,te,ji=map(int,input().split())
l=list(co(sorted([int(input()) for u in range(hit)])).items())
inc=0
ans=0
ef=len(l)
if ef==1:print(-(-l[0][1]//te));break
for ix in range(hit):
  k,v=l[0]
  ans-=(-v//te)
  nokori=te-v%te if v%te else 0
  inc+=1
  while nokori:
    if l[inc][0]>k+ji:break
    if l[inc][1]<=nokori:
      nokori-=l[inc][1]
      inc+=1
      if inc==ef:
        break
    else:
      l[inc][1]-=nokori
      break
  if inc==ef:
    break
print(ans+1 if nokori else ans)

Fixed submission:
n,c,k=map(int,input().split())
ans=0
cnt=1
t=sorted([int(input())for s in range(n)])
while t:
    now=t.pop()
    ans+=1
    while t and cnt<c and t[-1]+k>=now:
        cnt+=1
        t.pop()
    cnt=1

print(ans)

Buggy python submission (verdict: Runtime Error):
from collections import Counter as co
hit,te,ji=map(int,input().split())
l=list(co(sorted([int(input()) for u in range(hit)])).items())
inc=0
ans=0
ef=len(l)
for ix in range(hit):
  k,v=l[0]
  ans-=(-v//te)
  nokori=te-v%te if v%te else 0
  inc+=1
  while nokori:
    if l[inc][0]>k+ji:break
    if l[inc][1]<=nokori:
      nokori-=l[inc][1]
      inc+=1
      if inc==ef:break
    else:l[inc][1]-=nokori;break
  if inc==ef:break
print(ans+1 if nokori else ans)

Fixed submission:
n,c,k=map(int,input().split())
ans=0
cnt=1
t=sorted([int(input())for s in range(n)])
while t:
    now=t.pop()
    ans+=1
    while t and cnt<c and t[-1]+k>=now:
        cnt+=1
        t.pop()
    cnt=1

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

Fixed submission:
import math
a=int(input())
print(math.factorial(a)%(10**9+7))
Buggy python submission (verdict: Runtime Error):
print("A{}C".format("B" if int(input()<1200 else "R"))

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

Fixed submission:
a,s,d,f=map(int,input().split());print(max(a*s,d*f))
Buggy python 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)


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 python 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)

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 python submission (verdict: Runtime Error):
a,s,d=input(),split(',')
print(a,s,d)

Fixed submission:
a,s,d=input().split(',')
print(a,s,d)
Buggy python submission (verdict: Runtime Error):
k,s=map(int,input(),split())
ans=0
for a in range(k+1):
  for b in range(k+1):
    if 0<=(s-a-b)<=k:
      ans+=1
print(ans)k,s=map(int,input().split())
ans=0
for a in range(k+1):
  for b in range(k+1):
    if 0<=(s-a-b)<=k:
      ans+=1
print(ans)

Fixed submission:
k,s=map(int,input().split())
ans=0
for a in range(k+1):
  for b in range(k+1):
    if 0<=(s-a-b)<=k:
      ans+=1
print(ans)
Buggy python 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)

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 python 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]))

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 python submission (verdict: Runtime Error):
s=input()
from itertools import groupby as gb
print(len(gb(s)))

Fixed submission:
s=input()
ans=0
for x,y in zip(s,s[1:]):
  if x!=y:ans+=1
print(ans)
Buggy python 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))

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 python submission (verdict: Runtime Error):
print(eval('(i*i)*i//2'.replace('i','int(input()')))

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

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

Fixed submission:
a,b,c,d=eval('['+'int(input()),'*3+'0]');print((a+b)*c//2)
Buggy python 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)

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 python submission (verdict: Runtime Error):
n,m=map(int,input().split())
a=[1]*n
ans=set([1])
for i in range(m):
  x,y=map(int,input().split())
  if a[x-1]==0:continue
  else:
    a[x-1]-=1
    a[y-1]+=1
    if x in ans:
      ans.add(y)
      if a[x-1]==0:ans.rempve(x)
print(len(ans))

Fixed submission:
n,m=map(int,input().split())
a=[1]*n
ans=set([1])
for i in range(m):
  x,y=map(int,input().split())
  if a[x-1]==0:continue
  else:
    a[x-1]-=1
    a[y-1]+=1
    if x in ans:
      ans.add(y)
      if a[x-1]==0:ans.remove(x)
print(len(ans))

Buggy python submission (verdict: Runtime Error):
n,m=map(int,input().split())
aru=1
a=[1]*n
ans=set([1])
for i in range(m):
  x,y=map(int,input().split())
  if a[x-1]==0:continue
  else:
    a[x-1]-=1
    a[y-1]+=1
    if aru==x:
      aru=y
      if a[x-1]!=0:
        ans.add(x)
      else:ans.remove(x)
print(len(ans))

Fixed submission:
n,m=map(int,input().split())
a=[1]*n
ans=set([1])
for i in range(m):
  x,y=map(int,input().split())
  if a[x-1]==0:continue
  else:
    a[x-1]-=1
    a[y-1]+=1
    if x in ans:
      ans.add(y)
      if a[x-1]==0:ans.remove(x)
print(len(ans))

Buggy python submission (verdict: Runtime Error):
n,m=map(int,input().split())
aru=1
a=[1]*n
ans=set()
for i in range(m):
  x,y=map(int,input().split())
  if a[x-1]==0:continue
  else:
    a[x-1]-=1
    a[y-1]+=1
    if aru==x:
      aru=y
      if a[x-1]!=0:
        ans.add(x)
      else:ans.remove(x)
print(len(ans))

Fixed submission:
n,m=map(int,input().split())
a=[1]*n
ans=set([1])
for i in range(m):
  x,y=map(int,input().split())
  if a[x-1]==0:continue
  else:
    a[x-1]-=1
    a[y-1]+=1
    if x in ans:
      ans.add(y)
      if a[x-1]==0:ans.remove(x)
print(len(ans))
Buggy python submission (verdict: Runtime Error):
s,t=open(0)
print(min(sum(a!=b for a,b in zip(s[i:],t[:-1]))for i in range(len(s)-len(t))))

Fixed submission:
s = input()
t = input()
ans = len(t)
for i in range(len(s) - len(t) + 1):
    ans = min(ans, sum(si != ti for si, ti in zip(s[i:], t)))
print(ans)