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

Fixed submission:
# メイン関数
def main():
    # 入力データ
    s = input()
    t = input()

    # dpテーブルの作成
    dp = [[0] * (len(t)+1) for i in range(len(s)+1)]
    for i in range(len(s)):
        for j in range(len(t)):
            if s[i] == t[j]:
                dp[i+1][j+1] = dp[i][j] + 1
            else:
                dp[i+1][j+1] = max(dp[i][j+1], dp[i+1][j])

    # 部分列の復元
    ans = ''
    i = len(s)
    j = len(t)
    while i != 0 and j != 0:
        if dp[i][j] == dp[i-1][j]:
            i -= 1
        elif dp[i][j] == dp[i][j-1]:
            j -= 1
        else:
            i -= 1
            j -= 1
            ans = s[i] + ans

    # 解答の出力
    print(ans)
    return


# 実行
if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
# ライブラリのインポート
import numpy as np


# メイン関数
def main():
    # 入力データ
    s = input()
    t = input()

    # dpテーブルの作成
    dp = np.zeros((len(s) + 1, len(t) + 1), dtype='int')
    for i in range(len(s)):
        for j in range(len(t)):
            if s[i] == t[j]:
                dp[i+1][j+1] = dp[i][j] + 1
            else:
                dp[i+1][j+1] = max(dp[i][j+1], dp[i+1][j])

    # 部分列の復元
    ans = ''
    i = len(s)
    j = len(t)
    while i != 0 and j != 0:
        if dp[i][j] == dp[i-1][j]:
            i -= 1
        elif dp[i][j] == dp[i][j-1]:
            j -= 1
        else:
            i -= 1
            j -= 1
            ans = s[i] + ans

    # 解答の出力
    print(ans)
    return


# 実行
if __name__ == '__main__':
    main()
Problem p02910 (python)

Fixed submission:
S = input()
odd = set(["R","U","D"])
even = set(["L","U","D"])
ok = True
for s in S[::2]:
    if s not in odd:
        ok = False
if len(S) > 1:
    for s in S[1::2]:
        if s not in even:
            ok = False
print("Yes" if ok else "No")

Buggy submission (verdict: Runtime Error):
RDULULDURURLRDULRLR

Buggy submission (verdict: Runtime Error):
RDULULDURURLRDULRLR
Problem p02936 (python)

Fixed submission:
import sys
def input():
    return sys.stdin.readline()[:-1]
sys.setrecursionlimit(10**6)
N, Q = map(int, input().split())
tree = [[] for _ in range(N)]
ans = [0] * N

def dfs(v, p):
    for u in tree[v]:
        if u == p:
            continue
        ans[u] += ans[v]
        dfs(u, v)

def main():

    for _ in range(N-1):
        a, b = map(int,input().split())
        a -= 1
        b -= 1
        tree[a].append(b)
        tree[b].append(a)

    for _ in range(Q):
        p,x = map(int, input().split())
        ans[p-1] += x
    # print(ans)

    dfs(0, -1)
    print(*ans)

if __name__ == "__main__":
    main()

Buggy submission (verdict: Runtime Error):
from collections import deque
import sys
def input():
    return sys.stdin.readline()[:-1]

N, Q = map(int, input().split())
tree = [[] for _ in range(N+1)]
ans = [0 for _ in range(N+1)]

def dfs(v, p = -1):
    for u in tree[v]:
        if u == p:
            continue
        ans[u] += ans[v]
        dfs(u, v)

def main():

    AB = [list(map(int,input().split())) for _ in range(N-1)]
    AB.sort()

    for a,b in AB:
        tree[a].append(b)
        tree[b].append(a)

    for _ in range(Q):
        p,x = map(int, input().split())
        ans[p] += x

    dfs(1)
    print(*ans[1:])

if __name__ == "__main__":
    main()

Buggy submission (verdict: Runtime Error):
def main():
    N, Q = map(int, input().split())
    # AB = [list(map(int,input().split())) for _ in range(N-1)]
    roots = {}
    for _ in range(N-1):
        root,leaf = map(int,input().split())
        roots[leaf-1] = root-1

    ans = [0 for _ in range(N)]
    for _ in range(Q):
        p,x = map(int, input().split())
        ans[p-1] += x
    # print(ans)
    for i in range(1,N):
        ans[i] += ans[roots[i]]
    print(*ans)

if __name__ == "__main__":
    main()

Buggy submission (verdict: Runtime Error):
def main():
    N, Q = map(int, input().split())
    AB = [list(map(int,input().split())) for _ in range(N-1)]
    roots = {}
    for root,leaf in AB:
        roots[leaf] = root

    ans = [0 for _ in range(N+1)]
    for _ in range(Q):
        p,x = map(int, input().split())
        ans[p] += x
    # print(ans)
    for i in range(2,N+1):
        ans[i] += ans[roots[i]]
    print(*ans[1:])

if __name__ == "__main__":
    main()

Buggy submission (verdict: Runtime Error):
def main():
    N, Q = map(int, input().split())
    AB = [list(map(int,input().split())) for _ in range(N-1)]
    roots = {}
    for root,leaf in AB:
        roots[leaf] = root

    ans = [0 for _ in range(N)]
    for _ in range(Q):
        p,x = map(int, input().split())
        ans[int(p)-1] += int(x)
    # print(ans)
    for i in range(1,N):
        ans[i] += ans[roots[i+1]-1]
    print(*ans)

if __name__ == "__main__":
    main()

Buggy submission (verdict: Runtime Error):
def main():
    roots = {}
    for root,leaf in AB:
        roots[leaf] = root

    ans = [0 for _ in range(N)]
    for _ in range(Q):
        ans[int(p)-1] += int(x)
    # print(ans)
    for i in range(1,N):
        ans[i] += ans[roots[i+1]-1]
    print(*ans)

if __name__ == "__main__":
    main()
Problem p02971 (python)

Fixed submission:
n = int(input())
A = [int(input()) for _ in range(n)]

m2, m1  = sorted(A)[-2:]
for i in range(n):
    if A[i]==m1:
        print(m2)
    else:
        print(m1)

Buggy submission (verdict: Runtime Error):
import heapq
n = int(input())
A = [int(input()) for _ in range(n)]

lerge1, lerge2  = sorted(A)[-2:]
for i in range(n):
    if a[i]==m1:
        pritn(m2)
    else:
        print(m1)
Problem p03363 (python)

Fixed submission:
from collections import Counter
import numpy as np

N = int(input())
A = [0]+list(map(int, input().split()))

cumulative_sum = np.cumsum(A)
counts = Counter(cumulative_sum)
ans = 0
for v in counts.values():
    ans += v * (v-1) // 2
    
print(ans)

Buggy submission (verdict: Runtime Error):
from collections import Counter
from scipy.misc import comb

N = int(input())
A = list(map(int, input().split()))
ans = 0
cumulative_sum = [0] + [sum(A[:i+1]) for i in range(N)]
counts = Counter(cumulative_sum)
ans = 0
for v in counts.values():
    ans += v * (v-1) // 2
    
print(ans)
Problem p02618 (python)

Fixed submission:
for i in range(365):
  print(5)

Buggy submission (verdict: Runtime Error):
import random
for i in range(365):
    print(randint(1,26))
Problem p02789 (python)

Fixed submission:
n,m = map(int,input().split())
if n == m:
  print('Yes')
else:
  print('No')

Buggy submission (verdict: Runtime Error):
n,m = map(int,input().split())
if n == m:
  print(Yes)
else:
  print(No)

Buggy submission (verdict: Runtime Error):
n,m = map(int,input().split())
if n == m:
  print(AC)
else:
  print(WA)
Problem p02801 (python)

Fixed submission:
print(chr(ord(input())+1))

Buggy submission (verdict: Runtime Error):
N,M = list(map(int,input().split()))
moto = list()
for i in range (M):
  moto.append(input())
 
monme = list()
seigo = list()
i = 0
while i < M:
  a = list(moto[i].split())
  monme.append(int(a[0]))
  seigo.append(a[1])
  i += 1
  
monme2 = list()
seigo2 = list()
j = 1
 
while j <= N:
  k = 0
  while k < M:
    if monme[k] == j:
      monme2.append(monme[k])
      seigo2.append(seigo[k])
    k += 1
  j += 1
 
seitou = 0
pena = 0
c = 1
while c <= N:
  d = 0
  karinopena = 0
  while d < M:
    if monme2[d] == c:
      if seigo2[d] == 'WA':
        karinopena += 1
      else:
        seitou += 1
        pena += karinopena
        d = M
    d += 1
  c += 1
print(seitou,pena)
Problem p02848 (python)

Fixed submission:
n = int(input())
s = list(input())
alpha = list("ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ")
i = 0
while i < len(s):
  j = 0
  while j < 26:
    if s[i] == alpha[j]:
      s[i] = alpha[j+n]
      break
    else:j += 1
  i += 1

k = 0
while k < len(s) :
  print(s[k],end ="")
  k += 1

Buggy submission (verdict: Runtime Error):
n = int(input())
s = list(input())
alpha = list("ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ")
i = 0
while i < len(s):
  j = 0
  while j < 26:
    if s[i] == alpha[j]:
      s[i] = alpha[i+n]
      break
    else:j += 1
  i += 1

k = 0
while k < len(s) :
  print(s[k],end ="")
  k += 1
Problem p02957 (python)

Fixed submission:
A,B = input().split()
a = int(A)
b = int(B)
K = (a+b)/2
if K == int(K):
  print(int(K))
else:
  print('IMPOSSIBLE')

Buggy submission (verdict: Runtime Error):
inputA,B = input().split()
a = int(A)
b = int(B)
K = (a+b)/2
if K == int(K):
  print(int(K))
else:
  print('IMPOSSIBLE')
Problem p03477 (python)

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

print(ans)

Buggy submission (verdict: Runtime Error):
a,b,c,d = int(input())
if a+b > c+d:
  ans = "Left"
elif a+b < c+d:
  ans = "Right"
else:
  ans = "Balanced"

print(ans)
Problem p02576 (python)

Fixed submission:
import math
n,x,t=map(int,input().split())
m=math.ceil(n/x)*t
print(m)

Buggy submission (verdict: Runtime Error):
n,x,t=map(int,input().split())
m=math.ceil(n/x)*t
Problem p02630 (python)

Fixed submission:
import numpy as np
n=int(input())
a=np.array(list(map(int,input().split())))
a0,a1= np.unique(a,return_counts=True)
suma=np.sum(a)
a2=np.array([0]*100001)
for j in range(a0.size):
  a2[a0[j]]=a1[j]
#print(suma)
#print(a0)
#print(a1)
q=int(input())
for i in range(q):
  b,c=map(int,input().split())
  sumb=a2[b]
  a2[b]=0
  a2[c]+=sumb
  sumc=sumb*(c-b)
  suma+=sumc
  print(suma)

Buggy submission (verdict: Runtime Error):
import numpy as np
n=int(input())
a=np.array(list(map(int,input().split())))
a0,a1= np.unique(a,return_counts=True)
suma=np.sum(a)
a2=np.array([0]*100000)
for j in range(a0.size):
  a2[a0[j]]=a1[j]
#print(suma)
#print(a0)
#print(a1)
q=int(input())
for i in range(q):
  b,c=map(int,input().split())
  sumb=a2[b]
  a2[b]=0
  a2[c]+=sumb
  sumc=sumb*(c-b)
  suma+=sumc
  print(suma)
Problem p02642 (python)

Fixed submission:
def main():
  n=int(input())
  a=sorted(map(int,input().split()))
  maxa=a[-1]+1
  tf=[False]*maxa
  r=0
  n-=1
  for i in range(n):
    a_i=a[i]
    if tf[a_i] ==False:
      for j in range(a_i,maxa,a_i):
        tf[j]=True
      if a_i < a[i+1]:
        #print(a_i)
        r+=1
  if tf[-1] ==False:
    r+=1
  print(r)
main()

Buggy submission (verdict: Runtime Error):
def main():
  n=int(input())
  a=sorted(map(int,input().split()))
  maxa=a[-1]+1
  tf=[False]*maxa
  r=0
  n-=1
  for i in range(n):
    a_i=a[i]
    if tf[a_i] ==False:
      for j in range(a_i,maxa,a_i):
        tf[j]=True
      if a_i < a[i+1]:
        r+=1
  if tf[n] ==False:
    r+=1
  print(r)
main()

Buggy submission (verdict: Runtime Error):
def main():
  n=int(input())
  a=sorted(map(int,input().split()))
  tf=[1]*n
  n=n-1
#r=[]
#print(n)
#print(a)
  #notdiv=True
  #firstyn=0
  for i in range(n,-1,-1):
  #print(i)
  #notdiv=True
    if tf[i] ==0:
      continue
    for j in range(i):
    #print(a[j])
      if a[i]%a[j] == 0:
        tf[i]=0
        if a[i]==a[j]:
          for k in range(j,i):
            a[k]=0
        break
  print(sum(tf))
main()

Buggy submission (verdict: Runtime Error):
def main():
  n=int(input())
  a=sorted(map(int,input().split()))
  tf=[1]*n
  n=n-1
#r=[]
#print(n)
#print(a)
  #notdiv=True
  #firstyn=0
  for i in range(n,-1,-1):
  #print(i)
  #notdiv=True
    if tf[i] ==0:
      continue
    for j in range(i):
    #print(a[j])
      if a[i]%a[j] == 0:
        tf[i]=0
        if a[i]==a[j]:
          for k in range(j,i):
            a[k]=0
        break
  print(sum(tf))
main()

Buggy submission (verdict: Runtime Error):
def main():
  n=int(input())
  a=sorted(map(int,input().split()))
  tf=[1]*n
  n=n-1
#r=[]
#print(n)
#print(a)
  #notdiv=True
  firstyn=0
  for i in range(n,-1,-1):
  #print(i)
  #notdiv=True
    if tf[i] ==0:
      continue
    for j in range(i):
    #print(a[j])
      if a[i]%a[j] == 0:
        tf[i]=0
      break
  if a[0] % a[1]==0:
    print(sum(tf)-1)
  else:
    print(sum(tf))
main()
Problem p02658 (python)

Fixed submission:
n=int(input())
a=list(map(int,input().split()))
t=1
if 0 in a:
  print(0)
  exit()

for i in range(n):
  t*=a[i]
  if t> 10**18:
    print(-1)
    exit()
print(t)

Buggy submission (verdict: Runtime Error):
n=input()
a=input().replace(" ","*")
t=eval(a)
if t> 10**18:
  print(-1)
else:
  print(t)
Problem p02665 (python)

Fixed submission:
n=int(input())
a=list(map(int,input().split()))
if n==1:
  if a==[0,1]:
    print(2)
  elif a==[0,2]:
    print(3)
  else:
    print(-1)
  exit()
if n==0:
  if a==[1]:
    print(1)
  else:
    print(-1)
  exit()



subt=[0]*(n)
if a[0] == 0:
  subt[0]=2
elif a[0]== 1:
  subt[0]=1
else:
  print(-1)
  exit()

for i in range(n-1):
  #subt[i+1]=subt[i]-subt[i]*2
  #print(subt[i])
  if a[i+1] > subt[i]-1:
    if i<n-1:
      print(-1)
      #print(n)
      #print(subt[i])
      exit()
      #pass
    elif a[i+1] > subt[i]:
      print(-1)
      exit()
      #pass
  else:  
    subt[i+1]=(subt[i]-a[i+1])*2
if a[n]> subt[-1]:
  print(-1)
  exit()
if a[n] > subt[-2]:
  subt[-1]=a[n]
else:
  subt[-1]=a[n]
  for j in range(2,n):
    if (subt[-j]-a[-j])*2 < subt[1-j]:
      print(-1)
      exit()
    if (subt[-j]-a[-j]) <= subt[1-j]:
      pass
    else:
      subt[-j]=subt[1-j]+a[-j]
  
    #pass
  
print(sum(subt)+1)
    
#print(subt)

Buggy submission (verdict: Runtime Error):
n=int(input())
a=list(map(int,input().split()))
if n==1:
  if a==[0,1]:
    print(2)
  elif a==[0,2]:
    print(3)
  else:
    print(-1)
  exit()
subt=[0]*(n)
if a[0] == 0:
  subt[0]=2
elif a[0]== 1:
  subt[0]=1
else:
  print(-1)
  exit()

for i in range(n-1):
  if a[i+1] > subt[i]-1:
    if i<n-1:
      print(-1)
      exit()
    elif a[i+1] > subt[i]:
      print(-1)
      exit()
  else:  
    subt[i+1]=(subt[i]-a[i+1])*2
if a[n]> subt[-1]:
  print(-1)
  exit()
if a[n] > subt[-2]:
  subt[-1]=a[n]
else:
  subt[-1]=a[n]
  for j in range(2,n):
    if (subt[-j]-a[-j])*2 < subt[1-j]:
      print(-1)
      exit()
    if (subt[-j]-a[-j]) <= subt[1-j]:
      pass
    else:
      subt[-j]=subt[1-j]+a[-j]
print(sum(subt)+1)
Problem p02687 (python)

Fixed submission:
o={"ABC":"ARC","ARC":"ABC"}
s = input()
print(o[s])

Buggy submission (verdict: Runtime Error):
def factorization(num):
  if num == 1:
    return [1]
  factor = []
  while num > 1:
    for i in range(num - 1):
      k = i + 2
      if num % k == 0:
        factor.append(k)
        num = int(num / k)
        break
  return factor
  
x=int(input())
a=0
b=0
a_b=0
y=factorization(x)
len_y=len(y)
z=set(y)


z=list(z)
#print(z)
for j in range(len(z)):
  a_b=z[j]
  for k in range(a_b):
    a=a_b+k
    b=k
    if a**5-b**5== x:
      print("%d %d" % (a,b))
      exit()
    a=a_b-k
    b=0-k
    if a**5-b**5== x:
      print("%d %d" % (a,b))
      exit()
      
if len_y > 2:
  z=set([])
  for l in range(0,len_y-1):
    for m in range(l,len_y):
      z=z|set([y[l]*y[m]])
  z=list(z)
  for j in range(len(z)):
    a_b=z[j]
    for k in range(a_b):
      a=a_b+k
      b=k
      if a**5-b**5== x:
        print("%d %d" % (a,b))
        exit()
      a=a_b-k
      b=0-k
      if a**5-b**5== x:
        print("%d %d" % (a,b))
        exit()
    
if len_y > 3:
  z=set([])
  for l in range(0,len_y-2):
    for m in range(l,len_y-1):
      for n in range(m,len_y):
        z=z|set([y[l]*y[m]*y[n]])
  z=list(z)
  for j in range(len(z)):
    a_b=z[j]
    for k in range(a_b):
      a=a_b+k
      b=k
      if a**5-b**5== x:
        print("%d %d" % (a,b))
        exit()
      a=a_b-k
      b=0-k
      if a**5-b**5== x:
        print("%d %d" % (a,b))
        exit()

if len_y > 4:
  z=set([])
  for l in range(0,len_y-3):
    for m in range(l,len_y-2):
      for n in range(m,len_y-1):
        for p in range(n,len_y):
          z=z|set([y[l]*y[m]*y[p]])
  z=list(z)
  for j in range(len(z)):
    a_b=z[j]
    for k in range(a_b):
      a=a_b+k
      b=k
      if a**5-b**5== x:
        print("%d %d" % (a,b))
        exit()
      a=a_b-k
      b=0-k
      if a**5-b**5== x:
        print("%d %d" % (a,b))
        exit()

if len_y > 5:
  z=set([])
  for l in range(0,len_y-4):
    for m in range(l,len_y-3):
      for n in range(m,len_y-2):
        for p in range(n,len_y-1):
          for q in range(p,len_y):
            z=z|set([y[l]*y[m]*y[p]*y[q]])
  z=list(z)
  for j in range(len(z)):
    a_b=z[j]
    for k in range(a_b):
      a=a_b+k
      b=k
      if a**5-b**5== x:
        print("%d %d" % (a,b))
        exit()
      a=a_b-k
      b=0-k
      if a**5-b**5== x:
        print("%d %d" % (a,b))
        exit()
Problem p03457 (python)

Fixed submission:
import sys
# -*- coding: utf-8 -*-
# 	入力
n=int(input())
t=0
x=0
y=0
s="Yes"
for i in range(n):
  t1,x1,y1=map(int,sys.stdin.readline().split())
  if abs(x1-x)+abs(y1-y) > (t1-t):
    s="No"
    break
  if ((x1 + y1) % 2) == (t1 % 2):
    x=x1
    y=y1
    t=t1
  else:
    s="No"
    break
# 出力
print(s)

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
# 	入力
n=int(input())
t=0
x=0
y=0
s="Yes"
for i in range(n):
  t1,x1,y1=map(int,sys.stdin.readline().split())
  if abs(x1-x)+abs(y1-y) > (t1-t):
    s="No"
    break
  if ((x1 + y1) % 2) == (t1 % 2):
    x=x1
    y=y1
    t=t1
  else:
    s="No"
    break
# 出力
print(s)
Problem p02765 (python)

Fixed submission:
time_line = input().rstrip().split(" ")
time_a = int(time_line[0])
time_b = int(time_line[1])

if time_a<10:
    hosei=(10-time_a)*100
    
else:
    hosei=0

kekka=time_b+hosei
print(kekka)

Buggy submission (verdict: Runtime Error):

num_line=input().rstrip().split(" ")
num=int(num_line[0])
a=int(num_line[1])
b=int(num_line[2])

allcase=pow(2,num,1000000007)-1
#print(allcase)

abunshi=1
for i in range(num-a+1,num+1):
    abunshi*=i
#print(abunshi)

abumbo=1
for i in range(1,a+1):
    abumbo*=i
#print(abumbo)

abumbo=pow(abumbo,1000000005,1000000007)
#print(abumbo)

aminus=abunshi*abumbo%1000000007
#print(aminus)

bbunshi=1
for i in range(num-b+1,num+1):
    bbunshi*=i
#print(bbunshi)

bbumbo=1
for i in range(1,b+1):
    bbumbo*=i
#print(bbumbo)

bbumbo=pow(bbumbo,1000000005,1000000007)
#print(bbumbo)

bminus=bbunshi*bbumbo%1000000007
#print(bminus)

print(allcase-aminus-bminus)
Problem p02600 (python)

Fixed submission:
X = int(input())

if 400 <= X <=599:
    print(8)
elif 600 <= X <= 799:
    print(7)
elif 800 <= X <= 999:
    print(6)
elif 1000 <= X <= 1199:
    print(5)
elif 1200 <= X <= 1399:
    print(4)
elif 1400 <= X <= 1599:
    print(3)
elif 1600 <= X <= 1799:
    print(2)
elif 1800 <= X <= 1999:
    print(1)

Buggy submission (verdict: Runtime Error):
N, K = map(int, input().split())
A_list = list(map(int, input().split()))
tmp = [1] * (N+1)

for i in range(K, N+1):
    tmp[i] = sum(A_list[i-K:i])

for i in range(K+1, K+1+N-K):
    if tmp[i] > tmp[i-1]:
        print('Yes')
    else:
        print('No')
Problem p02608 (python)

Fixed submission:
N = int(input())

ans = [0 for _ in range(10**4+50)]

for x in range(1, 105):
    for y in range(1, 105):
        for z in range(1, 105):
            tmp = x**2 + y**2 + z**2 + x*y + y*z + z*x
            if tmp < 10**4+50:
                ans[tmp] += 1

for i in range(1, N+1):
    print(ans[i])

Buggy submission (verdict: Runtime Error):
import math
N = int(input())
for i in range(1, N+1):
    ans = 0
    for x in range(1, math.sqrt(i)):
        for y in range(1, math.sqrt(i)):
            for z in range(1, math.sqrt(i)):
                tmp = x**2 + y**2 + z**2 + x*y + y*z + z*x
                if tmp == i:
                    ans += 1
    print(ans)
Problem p03280 (python)

Fixed submission:
A, B = map(int, input().split())
ans = (A * B) - (A + B - 1)

print(ans)

Buggy submission (verdict: Runtime Error):
ans = (A * B) - (A + B - 1)

print(ans)
Problem p03288 (python)

Fixed submission:
R = int(input())

if R < 1200:
    print('ABC')
elif R < 2800:
    print('ARC')
else:
    print('AGC')

Buggy submission (verdict: Runtime Error):
if R < 1200:
    print('ABC')
elif R < 2800:
    print('ARC')
else:
    print('AGC')
Problem p03377 (python)

Fixed submission:
A, B, X = map(int, input().split())

if 0 <= X - A <= B:
    print('YES')
else:
    print('NO')

Buggy submission (verdict: Runtime Error):
if 0 <= X - A <= B:
    print('YES')
else:
    print('NO')
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):
A, B, C = map(int, input())

if A + B >= C:
    print('Yes')
else:
    print('No')
Problem p03962 (python)

Fixed submission:
print(len(set(map(int, input().split()))))

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*- #

n, k = map(int, input().split())
ans = 0

ans = k * pow(k-1, n-1)

print(ans)
Problem p02687 (python)

Fixed submission:
from sys import stdin

S = stdin.readline().rstrip()

if S=="ABC":
    print("ARC")
else:
    print("ABC")

Buggy submission (verdict: Runtime Error):
from sys import stdin

S = int(stdin.readline().rstrip())

if S=="ABC":
    print("ARC")
else:
    print("ABC")
Problem p02709 (python)

Fixed submission:
from sys import stdin
from sys import setrecursionlimit
setrecursionlimit(2000)


N = int(stdin.readline().rstrip())
As = [int(x) for x in stdin.readline().rstrip().split()]

A_mat = []
for i,A in enumerate(As):
    A_mat.append([A,i])

A_mat.sort(reverse=True)

map1 = []

for i in range(N+1):
    temp = [-1]*(N+1)
    map1.append(temp)



def DP(x, y): #Asのなかからx+y個の数列をすでに端に移動していて、x個左端に, y個右端に移動している状態から始めたときに追加で得られるスコア
    if map1[x][y]>=0:
        return map1[x][y]
    
    if x+y == N:
        return 0

    a_val = A_mat[x+y][0]
    a_pos = A_mat[x+y][1]

    left_case = abs(a_pos-x)
    right_case = abs((N-y-1)-a_pos)

    map1[x][y] = max(DP(x+1,y)+left_case*a_val, DP(x,y+1)+right_case*a_val)

    return map1[x][y]

print(DP(0,0))

Buggy submission (verdict: Runtime Error):
from sys import stdin

N = int(stdin.readline().rstrip())
As = [int(x) for x in stdin.readline().rstrip().split()]

A_mat = []
for i,A in enumerate(As):
    A_mat.append([A,i])

A_mat.sort(reverse=True)

map1 = []

for i in range(N+1):
    temp = [-1]*(N+1)
    map1.append(temp)



def DP(x, y): #Asのなかからx+y個の数列をすでに端に移動していて、x個左端に, y個右端に移動している状態から始めたときに追加で得られるスコア
    if map1[x][y]>=0:
        return map1[x][y]
    
    if x+y == N:
        return 0

    a_val = A_mat[x+y][0]
    a_pos = A_mat[x+y][1]

    left_case = abs(a_pos-x)
    right_case = abs((N-y-1)-a_pos)

    map1[x][y] = max(DP(x+1,y)+left_case*a_val, DP(x,y+1)+right_case*a_val)

    return map1[x][y]

print(DP(0,0))