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

Fixed submission:
k=int(input())
a=0
b=1
for i in range(k):
  a+=b
  print(a)
  if b<(a+b)/sum(map(int,str(a+b))):
    b*=10

Buggy submission (verdict: Runtime Error):
k=input()
a=0
b=1
for i in range(k):
  a+=b
  print(a)
  if b<(a+b)/sum(map(int,str(a+b))):
    b*=10
Problem p03342 (python)

Fixed submission:
n=int(input())
a=list(map(int,input().split()))
ans=0
s=0
r=0
for l in range(n):
  while r<n and s^a[r]==s+a[r]:
    s+=a[r]
    r+=1
  ans+=r-l
  s-=a[l]
print(ans)

Buggy submission (verdict: Runtime Error):
n=int(input())
a=list(map(int,input().split()))
ans=0
s=0
r=0
for l in range(n):
  while r<n and s^a[r]==s+a[r]:
    sum+=a[r]
    r+=1
  ans+=r-l
  s-=a[l]
print(ans)
Problem p03394 (python)

Fixed submission:
n=int(input())
if n==3:
  print(2,5,63)
elif n==4:
  print(2,5,20,63)
elif n==5:
  print(2,5,20,30,63)
else:
  l=set()
  cnt=0
  e=0
  for i in range(2,30001):
    if i%2==0 or i%3==0:
      l.add(i)
      cnt+=1
      if cnt==n:
        m=sum(l)
        if m%6==2:
          l.discard(8)
          l.add((i//6+1)*6)
        elif m%6==3:
          l.discard(9)
          l.add((i//6+1)*6)
        elif m%6==5:
          l.discard(8)
          l.add((i+3)//6*6+3)
        break
  print(' '.join(map(str,l)))

Buggy submission (verdict: Runtime Error):
n=int(input())
if n==3:
  print(2,5,63)
elif n==4:
  print(2,5,20,63)
elif n==5:
  print(2,5,20,30,63)
else:
  l=[2,3]
  cnt=2
  last=0
  for i in range(4,30001):
    if i%6 in [0,2,3,4]:
      l.append(i)
      cnt+=1
      if cnt==n:
        last=i
        break
  m=sum(l)
  if m%6==1:
    l.remove(9)
    for i in range(6):
      if (last+i)%6==2:
        l.append(last+i)
        break
  elif m%6==2:
    l.remove(8)
    for i in range(6):
      if (last+i)%6==0:
        l.append(last+i)
        break
  elif m%6==3:
    l.remove(9)
    for i in range(6):
      if (last+i)%6==0:
        l.append(last+i)
        break
  elif m%6==4:
    l.remove(8)
    for i in range(6):
      if (last+i)%6==4:
        l.append(last+i)
        break
  elif m%6==5:
    l.remove(9)
    for i in range(6):
      if (last+i)%6==4:
        l.append(last+i)
        break
  print(*l)
  if len(s)!=n:
    while True:
      z=0

Buggy submission (verdict: Runtime Error):
n=int(input())
if n==3:
  print(2,5,63)
elif n==4:
  print(2,5,20,63)
elif n==5:
  print(2,5,20,30,63)
else:
  l=[2,3]
  cnt=2
  last=0
  for i in range(6,30001):
    if i%6 in [0,2,3,4]:
      l.append(i)
      cnt+=1
      if cnt==n:
        last=i
        break
  m=sum(l)
  if m%6==2:
    l.remove(8)
    for i in range(6):
      if (last+i)%6==0:
        l.append(last+i)
        break
  elif m%6==3:
    l.remove(9)
    for i in range(6):
      if (last+i)%6==0:
        l.append(last+i)
        break
  elif m%6==5:
    l.remove(9)
    for i in range(6):
      if (last+i)%6==4:
        l.append(last+i)
        break
print(*l)
Problem p03404 (python)

Fixed submission:
a,b=map(int,input().split())
cntA,cntB=0,0
print(100,100)
flag=False
if a>=b:
  arr=[['#']*100 for i in range(100)]
  l=[]
  cntB=1
  for i in range(2,99,4):
    if flag:break
    for j in range(2,99,4):
      l.append((i,j))
      for y in range(i-1,i+2):
        for x in range(j-1,j+2):
          arr[y][x]='.'
      cntA+=1
      if cntA==a:
        flag=True
        break
  while cntB<b:
    cntB+=1
    s,t=l.pop()
    arr[s][t]='#'
  for i in range(100):
    print(''.join(arr[i]))
else:
  arr=[['.']*100 for i in range(100)]
  l=[]
  cntA=1
  for i in range(2,99,4):
    if flag:break
    for j in range(2,99,4):
      l.append((i,j))
      for y in range(i-1,i+2):
        for x in range(j-1,j+2):
          arr[y][x]='#'
      cntB+=1
      if cntB==b:
        flag=True
        break
  while cntA<a:
    cntA+=1
    s,t=l.pop()
    arr[s][t]='.'
  for i in range(100):
    print(''.join(arr[i]))

Buggy submission (verdict: Runtime Error):

a,b=map(int,input().split())
cntA,cntB=0,0
print(100,100)
flag=False
arr=[['#']*100 for i in range(100)]
l=[]
cntB=1
for i in range(2,99,4):
  if flag:break
  for j in range(2,99,4):
    l.append((i,j))
    for y in range(i-1,i+2):
      for x in range(j-1,j+2):
        arr[y][x]='.'
    cntA+=1
    if cntA==a:
      flag=True
      break
while cntB<b:
  cntB+=1
  s,t=l.pop()
  arr[s][t]='#'
for i in range(100):
  print(''.join(arr[i]))

Buggy submission (verdict: Runtime Error):
a,b=map(int,input().split())
cntA,cntB=0,0
print(100,100)
flag=False
arr=[['#']*100 for i in range(100)]
l=[]
cntB=1
for i in range(2,100,4):
  if flag:break
  for j in range(2,100,4):
    l.append((i,j))
    for y in range(i-1,i+2):
      for x in range(j-1,j+2):
        arr[y][x]='.'
    cntA+=1
    if cntA==a:
      flag=True
      break
while cntB<b:
  cntB+=1
  s,t=l.pop()
  arr[s][t]='#'
for i in range(100):
  print(''.join(arr[i]))
Problem p03425 (python)

Fixed submission:
import itertools
n=int(input())
s=[input() for i in range(n)]
cnt=[0]*5
for t in s:
  if t[0]=='M':
    cnt[0]+=1
  elif t[0]=='A':
    cnt[1]+=1
  elif t[0]=='R':
    cnt[2]+=1
  elif t[0]=='C':
    cnt[3]+=1
  elif t[0]=='H':
    cnt[4]+=1
ans=0
for v in itertools.combinations([0,1,2,3,4],3):
  ans+=cnt[v[0]]*cnt[v[1]]*cnt[v[2]]
print(ans)

Buggy submission (verdict: Runtime Error):
n=int(input())
s=[input() for i in range(n)]
cnt=[0]*5
for t in s:
  if t[0]=='M':
    cnt[0]+=1
  elif t[0]=='A':
    cnt[1]+=1
  elif t[0]=='R':
    cnt[2]+=1
  elif t[0]=='C':
    cnt[3]+=1
  elif t[0]=='H':
    cnt[4]+=1
ans=0
for v in itertools.combinations([0,1,2,3,4],3):
  ans+=cnt[v[0]]*cnt[v[1]]*cnt[v[2]]
print(ans)
Problem p03449 (python)

Fixed submission:
n=int(input())
a=[list(map(int,input().split())) for i in range(2)]
ans=0
for i in range(n):
  cnt=0
  for j in range(i+1):
    cnt+=a[0][j]
  for j in range(i,n):
    cnt+=a[1][j]
  ans=max(ans,cnt)
print(ans)

Buggy submission (verdict: Runtime Error):
n=int(input())
a=[list(map(int,input().split())) for i in range(2)]
ans=0
for i in range(n):
  cnt=0
  for j in range(i+1):
    cnt+=a[j][0]
  for j in range(i,n):
    cnt+=a[j][1]
  ans=max(ans,cnt)
print(ans)
Problem p03479 (python)

Fixed submission:
x,y=map(int,input().split())
print(len(bin(y//x))-2)

Buggy submission (verdict: Runtime Error):
import math
x,y=map(int,input().split())
print(math.ceil(math.log2((y-x)/x))+1)
Problem p03487 (python)

Fixed submission:
from collections import Counter
n=int(input())
a=list(map(int,input().split()))
cnt=0
c=Counter(a)
for u in c.keys():
  if int(u)>c[u]:
    cnt+=c[u]
  else:
    cnt+=c[u]-int(u)
print(cnt)

Buggy submission (verdict: Runtime Error):
from collections import Counter
n=int(input())
a=list(map(int,input().split()))
cnt=0
c=Counter(a)
for u in c.keys():
  if int(u)>c[u]:
    cnt+=v
  else:
    cnt+=c[u]-int(u)
print(cnt)

Buggy submission (verdict: Runtime Error):
import Counter
n=int(input())
a=list(map(int,input().split()))
cnt=0
c=Counter(a)
for u,v in c:
  if int(u)>v:
    cnt+=v
  else:
    cnt+=v-int(u)
print(cnt)
Problem p03504 (python)

Fixed submission:
N,C=map(int,input().split())
ch=[[] for i in range(31)]
for i in range(N):
  s,t,c=map(int,input().split())
  ch[c].append([s,t])
arr=[[] for i in range(31)]
start=[]
end=[]
for i in range(31):
  score=[0]*(10**5+1)
  for j in range(len(ch[i])):
    score[ch[i][j][0]]+=1
    score[ch[i][j][1]]-=1
  for j in range(10**5+1):
    if score[j]==1:
      start.append(j)
    if score[j]==-1:
      end.append(j)
ans=[0]*(10**5+3)
for i in start:
  ans[i]+=1
for j in end:
  ans[j+1]-=1
for i in range(10**5):
  ans[i+1]+=ans[i]
print(max(ans))

Buggy submission (verdict: Runtime Error):
N,C=map(int,input().split())
ch=[[] for i in range(31)]
for i in range(N):
  s,t,c=map(int,input().split())
  ch[c].append([s,t])
arr=[[] for i in range(31)]
start=[]
end=[]
for i in range(31):
  score=[0]*(10**5+1)
  for j in range(len(ch[i])):
    score[ch[i][j][0]]+=1
    score[ch[i][j][1]]-=1
  for j in range(10**5+1):
    if score[j]==1:
      start.append(j)
    if score[j]==-1:
      end.append(j)
ans=[0]*(10**5+1)
for i in start:
  ans[i]+=1
for j in end:
  ans[j+1]-=1
for i in range(10**5):
  ans[i+1]+=ans[i]
print(max(ans))
Problem p03557 (python)

Fixed submission:
import bisect
n=int(input())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
c=list(map(int,input().split()))
a.sort()
b.sort()
c.sort()
ans=0
for i in range(n):
  j=bisect.bisect_left(a,b[i])
  k=n-bisect.bisect_right(c,b[i])
  ans+=j*k
print(ans)

Buggy submission (verdict: Runtime Error):
n=int(input())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
c=list(map(int,input().split()))
a.sort()
b.sort()
c.sort()
i,j,k=0
ans=0
while i<n and j<n and k<n:
  while j<n and a[i]>=b[j]:
    j+=1
  if j==n:
    break
  while k<n and b[j]>=c[k]:
    k+=1
  if k==n:
    break
  ans+=1
  i+=1
  j+=1
  k+=1
print(ans)

Buggy submission (verdict: Runtime Error):
n=int(input())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
c=list(map(int,input().split()))
a.sort()
b.sort()
c.sort()
i,j,k=0
ans+=1
while i<n and j<n and k<n:
  while j<n and a[i]>=b[j]:
    j+=1
  if j==n:
    break
  while k<n and b[j]>=c[k]:
    k+=1
  if k==n:
    break
  ans+=1
  i+=1
  j+=1
  k+=1
print(ans)

Buggy submission (verdict: Runtime Error):
n=int(input())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
c=list(map(int,input().split()))
a.sort()
b.sort()
c.sort()
i,j,k=0
ans+=1
while i<n and j<n and k<n:
  while j<n and a[i]>=b[j]:
    j+=1
  while k<n and b[j]>=c[k]:
    k+=1
  ans+=1
  i+=1
  j+=1
  k+=1
print(ans)
Problem p03607 (python)

Fixed submission:
from collections import Counter
n=int(input())
a=[int(input()) for i in range(n)]
c=Counter(a).most_common()
ans=0
for v in c:
  if v[1]%2==1:
    ans+=1
print(ans)

Buggy submission (verdict: Runtime Error):
import Counter
n=int(input())
a=[int(input()) for i in range(n)]
c=Counter(a).most_common()
ans=0
for v in c:
  if v[1]%2==1:
    ans+=1
print(ans)
Problem p03625 (python)

Fixed submission:
from collections import Counter
n=int(input())
a=list(map(int,input().split()))
c=Counter(a).most_common()
s=[0,0]
for v in c:
  if v[1]>=2:
    for _ in range(v[1]//2):
      s.append(int(v[0]))
s.sort()
print(s[-1]*s[-2])

Buggy submission (verdict: Runtime Error):
from collections import Counter
n=int(input())
a=list(map(int,input().split()))
c=Counter(c).most_common()
s=[0,0]
for v in c:
  if v[1]>=2:
    s.append(int(v[0]))
s.sort()
print(s[-1]*s[-2])
Problem p03637 (python)

Fixed submission:
n=int(input())
a=list(map(int,input().split()))
cnt1=0
cnt2=0
cnt4=0
for i in a:
  if i%2==1:
    cnt1+=1
  elif i%4!=0:
    cnt2+=1
  elif i%4==0:
    cnt4+=1
if cnt2==0:
  if cnt1<=cnt4+1:
    print('Yes')
  else:
    print('No')
else:
  if cnt1<=cnt4:
    print('Yes')
  else:
    print('No')

Buggy submission (verdict: Runtime Error):
n=int(input())
a=list(map(int,input().split()))
cnt1=0
cnt4=0
for i in a:
  if i%2==1:
    cnt1+=1
  elif cnt%4==0:
    cnt4+=1
if cnt4>=cnt1+1:
  print('Yes')
else:
  print('No')
Problem p03681 (python)

Fixed submission:
from math import factorial
n,m=map(int,input().split())
mod=10**9+7
if abs(n-m)>=2:
  print(0)
elif abs(n-m)==1:
  print((factorial(n)%mod*factorial(m)%mod)%mod)
else:
  print((2*factorial(n)%mod*factorial(m)%mod)%mod)

Buggy submission (verdict: Runtime Error):
from math import factorial
n,m=map(int,input().split())
mod=10**9+7
if abs(n-m)>=2:
  print(0)
elif abs(n-m)==1:
  print((factorial(n,mod)*factorial(m,mod))%mod)
else:
  print((2*factortial(n,mod)*factorial(m,mod))%mod)
Problem p03682 (python)

Fixed submission:
from heapq import *
class UnionFind():
  def __init__(self,n):
    self.n=n
    self.parents=[-1]*n
  def find(self,x):
    if self.parents[x]<0:
      return x
    else:
      self.parents[x]=self.find(self.parents[x])
      return self.parents[x]
  def unite(self,x,y):
    x=self.find(x)
    y=self.find(y)
    if x==y:
      return
    if self.parents[x]>self.parents[y]:
      x,y=y,x
    self.parents[x]+=self.parents[y]
    self.parents[y]=x
  def size(self,x):
    return -size.parents[self.find(x)]
  def same(self,x,y):
    return self.find(x)==self.find(y)
  def members(self,x):
    root=self.find(x)
    return [i for i in range(self.n) if self.find(i)==root]
  def roots(self):
    return [i for i,x in enumerate(self.parents) if x<0]
  def group_count(self):
    return len(self.roots())
n=int(input())
X=[]
Y=[]
edge=[] 
for i in range(n):
  x,y=map(int,input().split())
  X.append((x,i))
  Y.append((y,i))
  edge.append((x,y))
X.sort()
Y.sort()
hq=[]
heapify(hq)
for i in range(n-1):
  x1,j1=X[i]
  x2,j2=X[i+1]
  y1,k1=Y[i]
  y2,k2=Y[i+1]
  heappush(hq,(x2-x1,j1,j2))
  heappush(hq,(y2-y1,k1,k2))
uf=UnionFind(n)
ans=0
while hq:
  w,s,t=heappop(hq)
  if uf.find(s)!=uf.find(t):
    uf.unite(s,t)
    ans+=w
print(ans)

Buggy submission (verdict: Runtime Error):
from heapq import *
class UnionFind():
  def __init__(self,n):
    self.n=n
    self.parents=[-1]*n
  def find(self,x):
    if self.parents[x]<0:
      return x
    else:
      self.parents[x]=self.find(self.parents[x])
      return self.parents[x]
  def unite(self,x,y):
    x=self.find(x)
    y=self.find(y)
    if x==y:
      return
    if self.parents[x]>self.parents[y]:
      x,y=y,x
    self.parents[x]+=self.parents[y]
    self.parents[y]=x
  def size(self,x):
    return -size.parents[self.find(x)]
  def same(self,x,y):
    return self.find(x)==self.find(y)
  def members(self,x):
    root=self.find(x)
    return [i for i in range(self.n) if self.find(i)==root]
  def roots(self):
    return [i for i,x in enumerate(self.parents) if x<0]
  def group_count(self):
    return len(self.roots())
n=int(input())
X=[[] for i in range(n)]
Y=[[] for i in range(n)]
edge=[[] for i in range(n)] 
for i in range(n):
  x,y=map(int,input().split())
  X.append((x,i))
  Y.append((y,i))
  edge.append((x,y))
X.sort()
Y.sort()
hq=[]
heapify(hq)
for i in range(n-1):
  x1,j1=X[i]
  x2,j2=X[i+1]
  y1,k1=Y[i]
  y2,k2=Y[i+1]
  heappush(hq,(x2-x1,j1,j2))
  heappush(hq,(y2-y1,k1,k2))
uf=UnionFind(n)
ans=0
while hq:
  w,s,t=heappop(hq)
  if uf.find(s)!=uf.find(t):
    uf.unite(s,t)
    ans+=w
print(ans)
Problem p03700 (python)

Fixed submission:
from math import ceil
n,a,b=map(int,input().split())
h=[int(input()) for i in range(n)]
def enough(x):
  cnt=0
  for i in range(n):
    if h[i]-x*b<=0:
      continue
    cnt+=ceil((h[i]-x*b)/(a-b))
  if cnt<=x:
    return True
  else:
    return False
l=0
r=10**9
while r-l>0:
  mid=(r+l)//2
  if enough(mid):
    r=mid
  else:
    l=mid+1
print(r)

Buggy submission (verdict: Runtime Error):
from math import ceil
n,a,b=map(int,input().split())
h=[int(input()) for i in range(n)]
def enough(x):
  cnt=0
  for i in range(n):
    if h[i]-x*b<=0:
      continue:
    cnt+=ceil((h[i]-x*b)/(a-b))
  if cnt<=x:
    return True
  else:
    return False
l=0
r=10**9
while r-l>0:
  mid=(r+l)//2
  if enough(mid):
    r=mid
  else:
    l=mid+1
print(r)
Problem p03731 (python)

Fixed submission:
N,T=map(int,input().split())
t=list(map(int,input().split()))+[10**18]
x=0
for i in range(N):
  x+=min(t[i+1]-t[i],T)
print(x)

Buggy submission (verdict: Runtime Error):
N,T=map(int,input().split())
t=list(map(int,input().split()))+[10**18]
x=0
for i in range(n):
  x+=min(t[i+1]-t[i],T)
print(x)
Problem p04014 (python)

Fixed submission:
n=int(input())
s=int(input())
if s==n:
  print(n+1)
  exit()
def f(x):
  m=n
  t=0
  while m:
    t+=m%x
    m//=x
  return t
for b in range(2,int(n**0.5)+2):
  if f(b)==s:
    print(b)
    exit()
for p in range(1,int(n**0.5))[::-1]:
  q=s-p
  b=(n-s)//p+1
  if 1<=p<b and 0<=q<b and (n-s)%p==0:
    b=(n-s)//p+1
    if f(b)==s:
      print(b)
      exit()
print(-1)

Buggy submission (verdict: Runtime Error):
n=int(input())
s=int(input())
if s==n:
  print(n+1)
  exit()
def f(x):
  m=n
  t=[]
  while m>0:
    y=m%x
    t.append(y)
    m-=m%x
    m//=x
  return sum(t)
for b in range(2,int(n**0.5)+1):
  if f(b)==s:
    print(b)
    exit()
for p in range(1,int(n**0.5)+1):
  if (n-s)%p==0:
    b=(n-s)//p+1
    if f(b)==s:
      print(b)
      exit()
print(-1)
Problem p04045 (python)

Fixed submission:
n,k=map(int,input().split())
d=list(map(int,input().split()))
for i in range(n,n*10+1):
  N=list(str(i))
  for j in range(len(N)):
    N[j]=int(N[j])
  N=set(N)
  d=set(d)
  if N.isdisjoint(d):
    print(i)
    exit()

Buggy submission (verdict: Runtime Error):
n,k=map(int,input().split())
d=list(map(int,input().split()))
N=list(str(n))
for i in range(len(N)):
  N[i]=int(N[i])
for i in range(n,n*10+1):
  if not N.isdisjoint(d):
    print(i)
    exit()
Problem p02731 (python)

Fixed submission:
L = int(input())
v = (L / 3) ** 3
print(v)

Buggy submission (verdict: Runtime Error):
L = int(input())
v = (L / 3) ^ 3
print(v)

Buggy submission (verdict: Runtime Error):
L = int(input())
l = [L / 3 for _ in range(L)]

for i in range(L % 3):
    l[i] += 1

v = l[0] * l[1] * l[2]
print(v)
Problem p02718 (python)

Fixed submission:
x = input().split()
y = input().split()



a = [int(i) for i in x]
b = [int(i) for i in y]

M = a[1]
s = sum(b)
c = 0
f = False

for i in b:
    if i >= ((1/(4*M)*s)):
        c += 1
    if c == M:
        print("Yes")
        f = True
        break

if not f:
    print("No")

Buggy submission (verdict: Runtime Error):
x = input().split()
y = input().split()


a = [int(i) for i in x]
b = [int(i) for i in y]

M = a[1]
s = sum(b)
c = 0

for i in b:
    if i >= int((1/(4*M)*S):
        c += 1
    if c > 1:
        print("Yes")

print("No")
Problem p03693 (python)

Fixed submission:
r,g,b = input().split(" ")

if (int(r)*100+int(g)*10+int(b))%4==0 :
    print("YES")
else :
    print("NO")

Buggy submission (verdict: Runtime Error):
N=int(input())
a_n=[]
a2_n=[]
a_n = input().split(" ")
count = 0

for i in range(N):
    if int(a_n[i])%400 < 8:
         a2_n.append(int(a_n[i])%400)
    else:
        count += 1

n_min = len(set(a2_n))
if n_min+count >= 8:
    n_max=8
else:
    n_max = n_min+count

print(str(n_min)+" "+str(n_max))

Buggy submission (verdict: Runtime Error):
 r,g,b = input().split(" ")

if (int(r)*100+int(g)*10+int(b))%4==0 :
    print("YES")
else :
    print("NO")
Problem p03695 (python)

Fixed submission:
N=int(input())
a_n=[]
a2_n=[]
a_n = input().split(" ")
count = 0

for i in range(N):
    if int(a_n[i])/400 < 8:
         a2_n.append(int(a_n[i])//400)
    else:
        count += 1

n_min = len(set(a2_n))
n_max = n_min+count

print(max(1, n_min),n_max)

Buggy submission (verdict: Runtime Error):
N=int(input())
a_n=[]
a2_n=[]
a_n = input().split(" ")
count = 0

for i in range(N):
    if int(a_n[i])/400 < 8:
         a2_n.append(int(a_n[i])/400)
    else:
        count += 1
if len(a2_n) == 0:
    num = 0
    n_min = 1
else:
    n_min = len(set(a2_n))
n_max = num+count

print(str(n_min)+" "+str(n_max))

Buggy submission (verdict: Runtime Error):
N=int(input())
a_n=[]
a_n = input().split(" ")
a_n = x.split(" ")
count = 0

a_n.sort()
for i in range(N):
    if int(a_n[i])/400 < 8:
         a_n[i] = int(a_n[i])/400
    else:
        count += 1

num = len(set(a_n))

print(str(num)+" "+str(num+count))
Problem p03598 (python)

Fixed submission:
n = int(input())
k = int(input())
summ = 0
x = list(map(int, input().split()))
for i in x:
	summ += min(2*i, 2*(k-i))
print(summ)

Buggy submission (verdict: Runtime Error):
n = int(input())
k = int(input())
summ = 0
for _ in range(n):
  x = int(input())
  summ += min(2*x, 2*(k-x))
 print(summ)
Problem p03698 (python)

Fixed submission:
def varied(s):
	for i in range(1, len(s)):
		if s[i-1] in s[i:]:
			return "no"
	return "yes"

s = input()
print(varied(s))

Buggy submission (verdict: Runtime Error):
def check(s):
  for i in range(1, len(s)):
    if i - 1 in s[i:]:
      return "no"
  return "yes"

s = input()
print(check(s))
Problem p03731 (python)

Fixed submission:
n, t = map(int, input().split())
arr = list(map(int, input().split()))
summ = t
for i in range(n-1):
  summ += min(t, arr[i+1] - arr[i])
print(summ)

Buggy submission (verdict: Runtime Error):
n, t = map(int, input().split())
arr = list(map(int, input().split()))
summ = t
for i in range(n-1):
  summ += min(t, arr[i+1] - arr[i])
return summ
Problem p02818 (python)

Fixed submission:
import sys

lines = sys.stdin.readlines()

a, b, k = map(int, lines[0].split())

if a <= k:
    k = k - a
    a = 0
    if b <= k:
        k = k - b
        b = 0
    else:
        b = b - k
else:
    a = a - k

print(a, b)

Buggy submission (verdict: Runtime Error):
import sys

lines = sys.stdin.readlines()

a, b, k = map(int, lines[0].split())

if a => k:
    a = 0
    k = k - a
    if b => k:
        b = 0
        k = k - b
else:
    a = a - k

print(a, b)

Buggy submission (verdict: Runtime Error):
import sys

lines = sys.stdin.readlines()

a, b, k = map(int, lines[0].split())

if a => k:
  a = 0
  k = k - a
  if b => k:
    b = 0
    k = k - b
else:
  a = a - k
  
print(a, b)
Problem p03076 (python)

Fixed submission:
dishes = [int(input()) for i in range(5)] 

d = [abs(d % 10 -10) for d in dishes if d % 10 != 0] # select nums which can be divided by 10
if d: d.remove(max(d)) 
print(sum(dishes) + sum(d))

Buggy submission (verdict: Runtime Error):
dishes = [int(input()) for i in range(5)] 

d = [abs(d % 10 -10) for d in dishes if d % 10 != 0] # select nums which can be divided by 10
d.remove(max(d)) 
print(sum(dishes) + sum(d))
Problem p03386 (python)

Fixed submission:
A, B, K = map(int, input().split())
res = (set([i for i in range(A, A+K) if A<=i<=B]) |\
       set([i for i in range(B-K+1, B+1) if A<=i<=B]))
print(*sorted(res), sep="\n")

Buggy submission (verdict: Runtime Error):
A, B, K = map(int, input().split())
res = set(list(range(A,B+1))) &\
     (set([i for i in range(A, A+K)]) | set([i for i in range(B-K+1, B+1)]))
print(*sorted(res), sep="\n")
Problem p02922 (python)

Fixed submission:
# -*- coding: utf-8 -*-
# スペース区切りの整数の入力
a, b = map(int, input().split())
x = ((1-b)//(a-1))
# 出力
print("{}".format(-x))

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
# スペース区切りの整数の入力
a, b = map(int, input().split())
x = ((1-b)//(a-1))
# 出力
print("{}".format(-x)

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
# スペース区切りの整数の入力
a, b = map(int, input().split())
# 出力
print("{}".format( -( (1-b)//(a-1) ) )
Problem p03282 (python)

Fixed submission:
import re

S = input()
K = int(input())

m = re.match(r'\A(1+)([1-9]*)\Z', S)
if m:
    print('1' if len(m.group(1)) >= K else m.group(2)[0])
else:
    print(S[0])

Buggy submission (verdict: Runtime Error):
// #define _GLIBCXX_DEBUG
#include <bits/stdc++.h>

#define FOR(i, a, b) for (int i = (a); i < int(b); ++i)
#define RFOR(i, a, b) for (int i = (b)-1; i >= int(a); --i)
#define REP(i, n) FOR(i, 0, n)
#define REP1(i, n) FOR(i, 1, int(n) + 1)
#define RREP(i, n) RFOR(i, 0, n)
#define RREP1(i, n) RFOR(i, 1, int(n) + 1)
#define ALL(c) begin(c), end(c)

int _ = (
#ifndef LOCAL
    std::cin.tie(nullptr), std::ios::sync_with_stdio(false),
#endif
    std::cout.precision(10), std::cout.setf(std::ios::fixed));

using ll = long long;
using ull = unsigned long long;
using ld = long double;
template <typename T> using vec = std::vector<T>;
using namespace std;

int main() {
  string S;
  ll K;
  cin >> S >> K;
  smatch m;
  regex_match(S, m, regex("^(1*)([1-9]*)$"));
  cout << ((m.length(1) >= K) ? '1' : m.str(2).front()) << endl;
  return 0;
}
Problem p03470 (python)

Fixed submission:
N = int(input())

s = set()
for i in range(N):
    d = int(input())
    s.add(d)
print(len(s))

Buggy submission (verdict: Runtime Error):
def solve(N, Y):
    for x in range(N + 1):
        for y in range(0, N - x + 1):
            z = N - x - y
            elif 10000 * x + 5000 * y + 1000 * z == Y:
                return x, y, z
    return -1, -1, -1


N, Y = list(map(int, input().split()))
x, y, z = solve(N, Y)
print('{} {} {}'.format(x, y, z))