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

Fixed submission:
from itertools import accumulate
n,c = map(int,input().split())
wv = [[0,0]]+[list(map(int,input().split())) for i in range(n)]+[[c,0]]
n += 2
ansls = []
ls1 = [0]*n
ls2 = [0]*n
ls3 = [0]*n
ls4 = [0]*n
for i in range(1,n):
  w,v = wv[i]
  w -= wv[i-1][0]
  ls1[i] = v-w*2
  ls2[i] = v-w
for i in range(n-2,-1,-1):
  w,v = wv[i]
  w -= wv[i+1][0]
  ls3[n-i-1] = v+w*2
  ls4[n-i-1] = v+w
als1 = list(accumulate(ls1))
als2 = list(accumulate(ls2))
als3 = list(accumulate(ls3))
als4 = list(accumulate(ls4))
als1 = list(accumulate(als1,max))
als2 = list(accumulate(als2,max))
als3 = list(accumulate(als3,max))
als4 = list(accumulate(als4,max))
for i in range(n-1):
  ansls.append(als1[i]+als4[n-2-i])
  ansls.append(als2[i]+als3[n-2-i])
print(max(ansls))

Buggy submission (verdict: Runtime Error):
from itertools import accumulate
n,c = map(int,input().split())
wv = [[0,0]]+[list(map(int,input().split())) for i in range(n)]+[[c,0]]
n += 2
ansls = []
ls1 = [0]*n
ls2 = [0]*n
ls3 = [0]*n
ls4 = [0]*n
for i in range(1,n):
  w,v = wv[i]
  w -= wv[i-1][0]
  ls1[i] = v-w*2
  ls2[i] = v-w
for i in range(n-2,-1,-1):
  w,v = wv[i]
  w -= wv[i+1][0]
  ls3[n-i-1] = v+w*2
  ls4[n-i-1] = v+w
als1 = list(accumulate(ls1))
als2 = list(accumulate(ls2))
als3 = list(accumulate(ls3))
als4 = list(accumulate(ls4))
als1 = list(accumulate(als1,max))
als2 = list(accumulate(als2,max))
als3 = list(accumulate(als3,max))
als4 = list(accumulate(als4,max))
for i in range(n-1):
  ansls.append(als1[i]+als4[n-2-i])
  ansls.append(als2[i]+als3[n-2-i])
print(max(ansls))

Buggy submission (verdict: Runtime Error):
from itertools import accumulate
n,c = map(int,input().split())
wv = [[0,0]]+[list(map(int,input().split())) for i in range(n)]+[[c,0]]
n += 2
ansls = []
for i in range(n):
  if wv[i][0] > c//2:
    spr = i
    break
for sp in spr-1,spr:
  ls = [0]*n
  lsx = [0]*n
  for i in range(1,sp):
    w,v = wv[i]
    w -= wv[i-1][0]
    ls[i] = v-w*2
    lsx[i] = v-w
  for i in range(n-2,sp-1,-1):
    w,v = wv[i]
    w -= wv[i+1][0]
    ls[i] = v+w*2
    lsx[i] = v+w
  alsf = list(accumulate(ls[:sp]))
  alsl = list(accumulate(ls[sp:][::-1]))
  alsxf = list(accumulate(lsx[:sp]))
  alsxl = list(accumulate(lsx[sp:][::-1]))
  ansls.append(max(alsf)+max(alsxl))
  ansls.append(max(alsl)+max(alsxf))
print(max(ansls))
Problem p03386 (python)

Fixed submission:
a,b,c=map(int,input().split())
if c>(b-a)//2:
  for i in range(a,b+1):
    print(i)
else:
  for i in range(a,a+c):
    print(i)
  for i in range(b-c+1,b+1):
    print(i)

Buggy submission (verdict: Runtime Error):
a,b,c=map(int,input().split())
for i in range(a,b+1):
  if i<a+n or i>b-n:
    print(i)
Problem p03394 (python)

Fixed submission:
n=int(input())
if n==3:
  print(22,3,5)
  exit()
if n==4:
  print(2,3,4,9)
  exit()
if n==5:
  print(2,3,4,6,9)
  exit()
a=n//4
b=n%4
ans=[]
for i in range(a):
  ans.extend((6*i+2,6*i+3,6*i+4,6*i+6))
if a%2==0:
  if b==1:
    ans.append(6*a+6)
  if b==2:
    ans.extend((6*a+2,6*a+4))
  if b==3:
    ans.extend((6*a+2,6*a+4,6*a+6))
else:
  if b==0:
    del ans[-1]
    ans.append(6*a+3)
  if b==1:
    ans.append(6*a+3)
  if b==2:
    ans.extend((6*a+3,6*a+6))
  if b==3:
    ans.extend((6*a+2,6*a+3,6*a+4))
print(*ans)

Buggy submission (verdict: Runtime Error):
n=int(input())
if n==3:
  print(22,3,5)
  exit()
if n==4:
  print(2,3,4,9)
  exit()
if n==5:
  print(2,3,4,6,9)
  exit()
a=n//4
b=n%4
ans=[]
for i in range(a):
  ans.extend(6*i+2,6*i+3,6*i+4,6*i+6)
if b==1:
  ans.append(6*a+6)
if b==2:
  ans.extend(6*a+2,6*a+4)
if b==3:
  ans.extend(6*a+2,6*a+3,6*a+4)
print(*ans)
Problem p03407 (python)

Fixed submission:
a,b,c=map(int,input().split())
if a+b>=c:
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
def main():
  import sys
  input = sys.stdin.readline
  import bisect
  import numpy as np
  n = int(input())
  a = list(map(int,input().split()))
  b = list(map(int,input().split()))
  x = max(max(a),max(b)).bit_length()+1
  b = np.array(b,dtype=np.int32)
  ans = 0
  for i in range(1,x+1):
    d = sorted(b&(1<<i)-1)
    t = 1<<(i-1)
    anstmp = 0
    for j in range(n):
      y = a[j]&(1<<i)-1
      t1 = np.searchsorted(d,t-y)
      t2 = np.searchsorted(d,2*t-y)
      t3 = np.searchsorted(d,3*t-y)
      anstmp += (t2-t1)+(n-t3)
    if anstmp%2:
      ans += t
  print(ans)
main()

Buggy submission (verdict: Runtime Error):
import sys
input = sys.stdin.readline
import bisect
import numpy as np
n = int(input())
a = list(map(int,input().split()))
b = list(map(int,input().split()))
x = max(max(a),max(b)).bit_length()+1
b = np.array(b)
ans = 0
for i in range(1,x+1):
  d = np.sort(np.bitwise_and(b,(1<<i)-1))
  t = 1<<(i-1)
  anstmp = 0
  for j in range(n):
    y = a[j]&(1<<i)-1
    t1 = np.searchsorted(d,t-y)
    t2 = np.searchsorted(d,2*t-y)
    t3 = np.searchsorted(d,3*t-y)
    t4 = np.searchsorted(d,4*t-y)
    anstmp += (t2-t1)+(t4-t3)
  if anstmp%2:
    ans += t
print(ans)

Buggy submission (verdict: Runtime Error):
import sys
input = sys.stdin.readline
import bisect
import numpy as np
n = int(input())
a = list(map(int,input().split()))
b = list(map(int,input().split()))
a = np.array(a)
b = np.array(b)
x = max(max(a),max(b)).bit_length()+1
ans = 0
for i in range(1,x+1):
  c = sorted(np.bitwise_and(a,(1<<i)-1))
  d = sorted(np.bitwise_and(b,(1<<i)-1))
  t = 1<<(i-1)
  anstmp = 0
  for j in range(n):
    t1 = np.searchsorted(d,t-c[j])
    t2 = np.searchsorted(d,2*t-c[j])
    t3 = np.searchsorted(d,3*t-c[j])
    t4 = np.searchsorted(d,4*t-c[j])
    anstmp += (t2-t1)+(t4-t3)
  if anstmp%2:
    ans += t
print(ans)
Problem p03408 (python)

Fixed submission:
from collections import Counter
n=int(input())
a=[input() for i in range(n)]
m=int(input())
b=[input() for i in range(m)]
ca = Counter(a)
cb = Counter(b)
ans = [0]
for s,n in ca.items():
  ans.append(n-cb[s])
print(max(ans))

Buggy submission (verdict: Runtime Error):
from collections import Counter
n=int(input())
a=[input() for i in range(n)]
m=int(input())
b=[input() for i in range(m)]
ca = Counter(a)
cb = Counter(b)
ans = 0
for s,n in ca.items():
  ans.append(n-cb[s])
print(max(ans))
Problem p03410 (python)

Fixed submission:
import sys
input = sys.stdin.readline
import numpy as np
n = int(input())
a = list(map(int,input().split()))
b = list(map(int,input().split()))
x = max(max(a),max(b)).bit_length()+1
a = np.array(a,dtype=np.int32)
b = np.array(b,dtype=np.int32)
ans = 0
for i in range(1,x+1):
  c = a&(1<<i)-1
  d = b&(1<<i)-1
  d.sort()
  t = 1<<(i-1)
  anstmp = 0
  t1 = np.searchsorted(d,t-c).sum()
  t2 = np.searchsorted(d,2*t-c).sum()
  t3 = np.searchsorted(d,3*t-c).sum()
  anstmp += (t2-t1)+(n-t3)
  if anstmp%2:
    ans += t
print(ans)

Buggy submission (verdict: Runtime Error):
import sys
input = sys.stdin.readline
import numpy as np
n = int(input())
a = list(map(int,input().split()))
b = list(map(int,input().split()))
x = max(max(a),max(b)).bit_length()+1
a = np.array(a,dtype=np.int32)
b = np.array(b,dtype=np.int32)
ans = 0
for i in range(1,x+1):
  c = a&(1<<i)-1
  d = b&(1<<i)-1
  d.sort()
  t = 1<<(i-1)
  anstmp = 0
  t1 = np.searchsorted(d,t-c).sum()
  t2 = np.searchsorted(d,2*t-c).sum()
  t3 = np.searchsorted(d,3*t-c).sum()
    anstmp += (t2-t1)+(n-t3)
  if anstmp%2:
    ans += t
print(ans)

Buggy submission (verdict: Runtime Error):
import sys
input = sys.stdin.readline
import numpy as np
n = int(input())
a = list(map(int,input().split()))
b = list(map(int,input().split()))
x = max(max(a),max(b)).bit_length()+1
b = np.array(a,dtype=np.int32)
b = np.array(b,dtype=np.int32)
ans = 0
for i in range(1,x+1):
  c = a&(1<<i)-1
  d = b&(1<<i)-1
  d.sort()
  t = 1<<(i-1)
  anstmp = 0
  for j in range(n):
    y = c[j]
    t1 = np.searchsorted(d,t-y)
    t2 = np.searchsorted(d,2*t-y)
    t3 = np.searchsorted(d,3*t-y)
    anstmp += (t2-t1)+(n-t3)
  if anstmp%2:
    ans += t
print(ans)

Buggy submission (verdict: Runtime Error):
import sys
input = sys.stdin.readline
import bisect
import numpy as np
n = int(input())
a = list(map(int,input().split()))
b = list(map(int,input().split()))
a = np.array(a)
b = np.array(b)
x = max(max(a),max(b)).bit_length()+1
ans = 0
for i in range(1,x+1):
  c = sorted(np.bitwise_and(a,(1<<i)-1))
  d = sorted(np.bitwise_and(b,(1<<i)-1))
  t = 1<<(i-1)
  anstmp = 0
  for j in range(n):
    t1 = np.searchsorted(d,t-c[j])
    t2 = np.searchsorted(d,2*t-c[j])
    t3 = np.searchsorted(d,3*t-c[j])
    t4 = np.searchsorted(d,4*t-c[j])
    anstmp += (t2-t1)+(t4-t3)
  if anstmp%2:
    ans += t
print(ans)

Buggy submission (verdict: Runtime Error):
import sys
input = sys.stdin.readline
import bisect
import numpy as np
n = int(input())
a = list(map(int,input().split()))
b = list(map(int,input().split()))
a = np.array(a)
b = np.array(b)
x = max(max(a),max(b)).bit_length()+1
ans = 0
for i in range(1,x+1):
  c = sorted(np.bitwise_and(a,(1<<i)-1))
  d = sorted(np.bitwise_and(b,(1<<i)-1))
  t = 1<<(i-1)
  anstmp = 0
  for j in range(n):
    t1 = np.searchsorted(d,t-c[j])
    t2 = np.searchsorted(d,2*t-c[j])
    t3 = np.searchsorted(d,3*t-c[j])
    t4 = np.searchsorted(d,4*t-c[j])
    anstmp += (t2-t1)+(t4-t3)
  if anstmp%2:
    ans += t
print(ans)
Problem p03415 (python)

Fixed submission:
print(input()[0]+input()[1]+input()[2])

Buggy submission (verdict: Runtime Error):
n,k=map(int,input().split())
ans=0
for b in range(k+1,n+1):
  q=n//b
  s=n%b
  ans+=q*(b-k)
  if s>=k:
    ans+=s-k+1
if k==0:
  ans-=n
print(ans)
Problem p03421 (python)

Fixed submission:
n,a,b = map(int,input().split())
if a+b>n+1 or a*b<n:
  print(-1)
  exit()
ans = []
for i in range(1,a+1):
  ans.append(i*b)
if b == 1:
  x = list(range(1,n+1))
  print(*x)
  exit()
x = (n-a)//(b-1)
y = (n-a)%(b-1)
for i in range(1,b):
  for j in range(1,x+1):
    ans.append(j*b-i)
  if i <= y:
    ans.append((x+1)*b-i)
ans_true = []
for i,x in enumerate(ans):
  ans_true.append((i+1,x))
ans_true.sort(key=lambda x:x[1])
x = list(zip(*ans_true))[0]
print(*x)

Buggy submission (verdict: Runtime Error):
n,a,b = map(int,input().split())
if a+b>n+1 or a*b<n:
  print(-1)
  exit()
ans = []
for i in range(1,a+1):
  ans.append(i*b)
x = (n-a)//(b-1)
y = (n-a)%(b-1)
for i in range(1,b):
  for j in range(1,x+1):
    ans.append(j*b-i)
  if i <= y:
    ans.append((x+1)*b-i)
ans_true = []
for i,x in enumerate(ans):
  ans_true.append((i+1,x))
ans_true.sort(key=lambda x:x[1])
print(*list(zip(*ans_true))[0])
Problem p03424 (python)

Fixed submission:
n=int(input())
h=list(input().split())
if len(list(set(h)))==3:
  print("Three")
else:
  print("Four")

Buggy submission (verdict: Runtime Error):
n=int(input())
h=list(map(input().split()))
if len(list(set(h)))==3:
  print("Three")
else:
  print("Four")

Buggy submission (verdict: Runtime Error):
n=int(input())
h=list(map(int,input().split()))
if len(list(set(h)))==3:
  print("Three")
else:
  print("Four")
Problem p03447 (python)

Fixed submission:
print((int(input())-int(input()))%int(input()))

Buggy submission (verdict: Runtime Error):
print((int(input()-int(input()))%int(input()))
Problem p03448 (python)

Fixed submission:
a = [int(input()) for i in range(4)]
ans = 0
for i in range(a[0]+1):
  for j in range(a[1]+1):
    for k in range(a[2]+1):
      if 500*i+100*j+50*k==a[3]:
        ans+=1
print(ans)

Buggy submission (verdict: Runtime Error):
ans = 0
flg = 0
for i in range(int(input())):
  for j in range(int(input())):
    for k in range(int(input())):
      if flg == 0:
        x = int(input())
      flg+=1
      if 500*i+100*j+50*k==x:
        ans+=1
print(ans)
Problem p03449 (python)

Fixed submission:
n=int(input())
a=[list(map(int,input().split())) for i in range(2)]
sm = [sum(a[0])+a[1][n-1]]
for i in range(n-1):
  sm.append(sm[-1]-a[0][-i-1]+a[1][-i-2])
print(max(sm))

Buggy submission (verdict: Runtime Error):
n=int(input())
a=[list(map(int,input().split())) for i in range(2)]
sm = [sum(a[0])+a[1][n-1]]
for i in range(n-1):
  sm.append(sm[-1]-a[-i-1][0]+a[-i-2][1])
print(max(sm))
Problem p03458 (python)

Fixed submission:
n,k = map(int,input().split())
xyc = [list(input().split()) for i in range(n)]
for i in range(n):
  x,y,c = xyc[i]
  x = int(x)
  y = int(y)
  xq = x//k
  yq = y//k
  if (xq+yq)%2:
    if c == "B":
      c = "W"
    else:
      c = "B"
  x %= k
  y %= k
  xyc[i] = x,y,c
gridw = [[0 for i in range(k+1)] for j in range(k+1)]
gridb = [[0 for i in range(k+1)] for j in range(k+1)]
for x,y,c in xyc:
  x += 1
  y += 1
  if c == "B":
    gridb[x][y] += 1
  else:
    gridw[x][y] += 1
for grid in gridb,gridw:
  for i in range(1,k+1):
    for j in range(k+1):
      grid[i][j] += grid[i-1][j]
for grid in gridb,gridw:
  for i in range(k+1):
    for j in range(1,k+1):
      grid[i][j] += grid[i][j-1]
nw = gridw[-1][-1]
nb = gridb[-1][-1]
ans = 0
def sm(grid,i,j):
  return grid[i][j]+grid[-1][-1]-grid[-1][j]-grid[i][-1]+grid[i][j]
for i in range(k+1):
  for j in range(k+1):
    x = sm(gridb,i,j)+nw-sm(gridw,i,j)
    ans = max(ans,x,n-x)
print(ans)

Buggy submission (verdict: Runtime Error):
import sys
input=sys.stdin.readline
n,k=map(int,input().split())
lsw=[0]*(k*2)
for i in range(n):
  a,b,c=input().split()
  a=int(a)%(k*2)
  b=int(b)%(k*2)
  if c=="B":
    b=(b+k)%(k*2)
  if a>=k:
    b=(b+k)%(k*2)
  lsw[b]+=1
ans=[sum(lsw[:k])]
for i in range(1,k+1):
  ans.append(ans[-1]+lsw[k+i]-lsw[i])
print(max(ans))

Buggy submission (verdict: Runtime Error):
import sys
input=sys.stdin.readline
n,k=map(int,input().split())
lsw=[0]*(k*2)
for i in range(n):
  a,b,c=input().split()
  a,b=int(a)%(k*2),int(b)%(k*2)
  if c=="B":
    b=(b+k)%(k*2)
  if a>=k:
    b=(b+k)%(k*2)
  lsw[b]+=1
ans=[sum(lsw[:k])]
for i in range(1,k+1):
  ans.append(ans[-1]+lsw[k+i]-lsw[i])
print(max(ans))
Problem p03469 (python)

Fixed submission:
print(input().replace("2017","2018"))

Buggy submission (verdict: Runtime Error):
print(input().replace("2017","2018))
Problem p03472 (python)

Fixed submission:
import sys
from operator import itemgetter
input=sys.stdin.readline
n,x=map(int,input().split())
a=[list(map(int,input().split())) for i in range(n)]
b=list(zip(*a))
t=max(b[0])
a.sort(key=itemgetter(1),reverse=True)
ans=0
for i in range(n):
  if a[i][1]>=t:
    x-=a[i][1]
    ans+=1
  if x<=0:
    print(ans)
    break
else:
  ans+=(x+t-1)//t
  x=0
  print(ans)

Buggy submission (verdict: Runtime Error):
import sys
from operator import itemgetter
input=sys.stdin.readline
n,x=map(int,input().split())
a=[list(map(int,input().split())) for i in range(n)]
b=list(zip(*a))
t=max(b[0])
a.sort(key=itemgetter(1),reverse=True)
ans=0
for i in range(n):
  if x<=0:
    print(ans)
    break
  if a[1][i]>=t:
    x-=a[1][i]
    ans+=1
  else:
    ans+=(x+t-1)//t
    x=0

Buggy submission (verdict: Runtime Error):
import sys
from operator import itemgetter
input=sys.stdin.readline
n,x=map(int,input().split())
a=[list(map(int,input().split())) for i in range(n)]
a=list(zip(*a))
t=max(a[0])
a.sort(key=itemgetter(1),reverse=True)
ans=0
for i in range(n):
  if x<=0:
    print(ans)
    break
  if a[1][i]>=t:
    x-=a[1][i]
    ans+=1
  else:
    ans+=(x+t-1)//t
    x=0
Problem p03477 (python)

Fixed submission:
a,b,c,d=map(int,input().split())
if a+b>c+d:
  print("Left")
elif a+b==c+d:
  print("Balanced")
else:
  print("Right")

Buggy submission (verdict: Runtime Error):
x,y=map(int,input().split())
for i in range(1,1000):
  x*=2
  if x>y:
    print(i)
    break

Buggy submission (verdict: Runtime Error):
a,b,c,d=map(int,input().split())
if a+b>c+d:
  print("Left")
elif a+b=c+d:
  print("Balanced")
else:
  print("Right")
Problem p03479 (python)

Fixed submission:
x,y=map(int,input().split())
for i in range(1,1000):
  x*=2
  if x>y:
    print(i)
    break

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

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

Buggy submission (verdict: Runtime Error):
import sys
s = input()
gx,gy = map(int, input().split(' '))
x_d = [0]
y_d = []
cnt = 0
for i in range(len(s)):
    if s[i] == "T":
        cnt += 1
        if cnt % 2 == 0:
            x_d.append(0)
        elif cnt % 2 == 1:
            y_d.append(0)
    if s[i] == "F":
        if cnt % 2 == 0:
            x_d[-1] += 1
        elif cnt % 2 == 1:
            y_d[-1] += 1
x_d.append(0)
y_d.append(0)
if (sum(x_d)-gx) % 2 or (sum(y_d)-gy) % 2:
    print("No")
    sys.exit()
x_n = (sum(x_d)-gx)//2
y_n = (sum(y_d)-gy)//2
DPx = [[False for i in range(x_n+2)] for j in range(len(x_d))]
DPy = [[False for i in range(y_n+2)] for j in range(len(y_d))]
for x in DPx:
    x[0] = True
for y in DPy:
    y[0] = True
for i in range(len(x_d)-1):
    for j in range(x_n+1):
        if DPx[i][j]:
            DPx[i+1][j] = True
            if j+x_d[i] <= x_n:
                DPx[i+1][j+x_d[i]] = True
for i in range(len(y_d)-1):
    for j in range(y_n+1):
        if DPy[i][j]:
            DPy[i+1][j] = True
            if j+y_d[i] <= y_n:
                DPy[i+1][j+y_d[i]] = True

if DPx[len(x_d)-1][x_n] and DPy[len(y_d)-1][y_n]:
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
import sys
s = input()
gx,gy = map(int, input().split(' '))
x_d = [0]
y_d = []
cnt = 0
for i in range(len(s)):
    if s[i] == "T":
        cnt += 1
        if cnt % 2 == 0:
            x_d.append(0)
        elif cnt % 2 == 1:
            y_d.append(0)
    if s[i] == "F":
        if cnt % 2 == 0:
            x_d[-1] += 1
        elif cnt % 2 == 1:
            y_d[-1] += 1
x_d.append(0)
y_d.append(0)
if (sum(x_d)-gx) % 2 or (sum(y_d)-gy) % 2:
    print("No")
    sys.exit()
x_n = (sum(x_d)-gx)//2
y_n = (sum(y_d)-gy)//2
DPx = [[False for i in range(x_n+1)] for j in range(len(x_d))]
DPy = [[False for i in range(y_n+1)] for j in range(len(y_d))]
for x in DPx:
    x[0] = True
for y in DPy:
    y[0] = True
for i in range(len(x_d)-1):
    for j in range(x_n+1):
        if DPx[i][j]:
            DPx[i+1][j] = True
            if j+x_d[i] <= x_n:
                DPx[i+1][j+x_d[i]] = True
for i in range(len(y_d)-1):
    for j in range(y_n+1):
        if DPy[i][j]:
            DPy[i+1][j] = True
            if j+y_d[i] <= y_n:
                DPy[i+1][j+y_d[i]] = True

if DPx[-2][x_n] and DPy[-2][y_n]:
    print("Yes")
else:
    print("No")
Problem p03486 (python)

Fixed submission:
s=list(input())
t=list(input())
s.sort()
t.sort(reverse=True)
if s>=t:
  print("No")
else:
  print("Yes")

Buggy submission (verdict: Runtime Error):
s=input()
t=input()
s.sort()
t.sort(reverse=True)
if s>t:
  print("No")
else:
  print("Yes")
Problem p03487 (python)

Fixed submission:
from collections import Counter
n=int(input())
a=list(map(int,input().split()))
c=Counter(a)
c=list(c.items())
ans=0
for k in range(len(c)):
  i=c[k][0]
  x=c[k][1]
  if i>x:
    ans+=x
  elif i<x:
    ans+=x-i
print(ans)

Buggy submission (verdict: Runtime Error):
from collections import Counter
n=int(input())
a=list(map(int,input().split()))
c=Counter(a)
c=list(c)
ans=0
for k in range(len(c)):
  i=c[k][0]
  x=c[k][1]
  if i>x:
    ans+=x
  elif i<x:
    ans+=x-i
print(ans)

Buggy submission (verdict: Runtime Error):
from collections import Counter
n=int(input())
a=list(map(int,input().split()))
c=list(Counter(a))
ans=0
for k in range(len(c)):
  i=c[k][0]
  x=c[k][1]
  if i>x:
    ans+=x
  elif i<x:
    ans+=x-i
print(ans)

Buggy submission (verdict: Runtime Error):
from collections import Counter
n=int(input())
a=list(map(int,input().split()))
c=list(Counter(a))
ans=0
for (i,x) in c:
  if i>x:
    ans+=x
  elif i<x:
    ans+=x-i
print(ans)
Problem p03504 (python)

Fixed submission:
from itertools import accumulate
import sys
input = sys.stdin.readline
N,C = map(int,input().split())
p = [list(map(int,input().split())) for i in range(N)]
p.sort()
ch = [[0,0] for i in range(C+1)]
p_true = []
for i in range(N):
  [s,t,c] = p[i]
  if ch[c][1] == s:
    ch[c][1] = t
  elif ch[c] == [0,0]:
    ch[c] = [s,t]
  else:
    p_true.append([ch[c][0],ch[c][1],c])
    ch[c] = [s,t]
for i in range(1,C+1):
  if ch[i] != [0,0]:
    p_true.append([ch[i][0],ch[i][1],i])
p_true.sort()
time = [0 for i in range(100002)]
for i in range(len(p_true)):
  [s,t,c] = p_true[i]
  time[s] += 1
  time[t+1] -= 1
print(max(accumulate(time)))

Buggy submission (verdict: Runtime Error):
N,C = map(int,input().split())
p = [list(map(int,input().split())) for i in range(N)]
p.sort()
ch = [[0,0] for i in range(C+1)]
p_true = []
for i in range(N):
  [s,t,c] = p[i]
  if ch[c][1] == s:
    ch[c][1] = t
  elif ch[c] == [0,0]:
    ch[c] = [s,t]
  else:
    p_true.append([*ch[c],c])
    ch[c] = [s,t]
for i in range(1,C+1):
  if ch[i] != [0,0]:
    p_true.append([*ch[i],i])
p_true.sort()
Problem p03525 (python)

Fixed submission:
n=int(input())
d=list(map(int,input().split()))
d.sort()
time=[0]*24
time[0]=1
for i in range(n):
  if i%2:
    time[d[i]]+=1
  else:
    time[-d[i]]+=1
if max(time)>1:
  print(0)
  exit()
ans=[]
cnt=1
for i in range(1,25):
  i=i%24
  if time[i]==0:
    cnt+=1
  else:
    ans.append(cnt)
    cnt=1
print(min(ans))

Buggy submission (verdict: Runtime Error):
n=int(input())
d=list(map(int,input().split()))
d.sort()
time=[0]*24
time[0]=1
if n==0:
  print(0)
  exit()
for i in range(n):
  if i%2:
    time[d[i]]+=1
  else:
    time[24-d[i]]+=1
if max(time)>1:
  print(0)
  exit()
flg=0
ans=0
cnt=0
for i in range(25):
  i=i%24
  if time[i]==0 and not flg:
    flg=1
    cnt=1
  elif time[i]==0:
    cnt+=1
  else:
    ans=max(ans,cnt)
    cnt=0
    flg=0
print(ans)
Problem p03543 (python)

Fixed submission:
n=input()
if int(n[:3])%111==0 or int(n[1:])%111==0:
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
a=int(input())
print("YNeos"[(a//10)%11*(a%1000)%11>0::2]

Buggy submission (verdict: Runtime Error):
h,w = map(int, input().split(' '))
tbl = [list(map(int, input().split(' '))) for i in range(10)]
wf = [[10**18 for i in range(10)] for j in range(10)]
for k in range(10):
    for i in range(10):
        for j in range(10):
            wf[i][j] = min(tbl[i][j], tbl[i][k]+tbl[k][j])
wall = [list(map(int, input().split(' '))) for i in range(h)]
ans = 0
for i in range(h):
    for j in range(w):
        num = wall[i][j]
        if num == -1:
            continue
        else:
            ans += wf[num][1]
print(ans)

Buggy submission (verdict: Runtime Error):
h,w=map(int, input().split(' '))
tbl = [list(map(int, input().split(' '))) for i in range(10)]
tbli = list(zip(*tbl))
cost = [10**18]*10
cost[1]=0
sorttool = [0,1,2,3,4,5,6,7,8,9]
order = list(zip(tbli[1],sorttool))
order.sort()
del order[0]
for i,(c,x) in enumerate(order):
    cost[x] = min(cost[x],tbli[1][x])
    if i == 0:
        continue
    for j in range(i):
        cost[x]=min(cost[x],cost[order[j][1]]+tbli[order[j][1]][x])
cost.append(0)
wall = [list(map(int, input().split(' '))) for i in range(h)]
ans =0
for i in range(h):
    for j in range(w):
        ans += cost[wall[i][j]]
print(ans)
Problem p03547 (python)

Fixed submission:
x, y = input().split(' ')
if x>y:
  print(">")
elif x<y:
  print("<")
else:
  print("=")

Buggy submission (verdict: Runtime Error):
x, y = map(input().split(' '))
if x>y:
  print(">")
elif x<y:
  print("<")
else:
  print("=")
Problem p03555 (python)

Fixed submission:
a=input()
b=input()
if a == b[::-1]:
  print("YES")
else:
  print("NO")

Buggy submission (verdict: Runtime Error):
from collections import deque
n = int(input())
mins = [1000 for i in range(n+1)]
used = [0 for i in range(n+1)]
deq = deque()
deq.append((1,1))
while deq:
  x,cnt = deq.popleft()
  mins[x] = min(mins[x],cnt)
  used[x] = 1
  if used[10*x%n] == 0:
    deq.appendleft((10*x%n,cnt))
  if used[(x+1)%n] == 0:
    deq.append(((x+1)%n,cnt+1))
print(mins[0])