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

Fixed submission:
import sys
import numpy as np

n=int(sys.stdin.readline())
h=np.array(sys.stdin.readline().split(),dtype='int64')
h=h[::-1]
miss=0
for i in range(n):
    if i==0:
        pre=h[i]
    elif pre+1==h[i]:
        pass
    elif pre==h[i]:
        pass
    elif pre+1<h[i]:
        miss=1
        break
    else:
        pre=h[i]

if miss==1:
    print('No')
else:
    print('Yes')

Buggy submission (verdict: Runtime Error):
import sys
import numpy as np

n=int(sys.stdin.readline())
h=np.array(sys.stdin.readline().split(),dtype='int64')
h=np.flip(h)
miss=0
for i in range(n):
    if i==0:
        pre=h[i]
    elif pre+1==h[i]:
        pass
    elif pre==h[i]:
        pass
    elif pre+1<h[i]:
        miss=1
        break
    else:
        pre=h[i]

if miss==1:
    print('No')
else:
    print('Yes')

Buggy submission (verdict: Runtime Error):
import sys
import numpy as np

n=int(sys.stdin.readline())
h=np.array(sys.stdin.readline().split(),dtype='int64')
h=np.flip(h)
miss=0
for i in range(n):
    if i==0:
        pre=h[i]
    elif pre+1==h[i]:
        pass
    elif pre==h[i]:
        pass
    elif pre+1<h[i]:
        miss=1
        break
    else:
        pre=h[i]

if miss==1:
    print('No')
else:
    print('Yes')
Problem p03161 (python)

Fixed submission:
I = list(map(int, input().split()))
N = I[0]
K = I[1]
H = list(map(int, input().split()))

dp = [float('inf') for _ in range(N+1)]

dp[N] = 0
for i in range(N-1,N-K-1,-1):
	if i>0:
		dp[i] = abs(H[i-1]-H[N-1])

for i in range(N-K-1,0,-1):
	for k in range(1,K+1):
		if i+k<=N:
			dp[i] = min(abs(H[i+k-1]-H[i-1])+dp[i+k], dp[i])

print(dp[1])

Buggy submission (verdict: Runtime Error):
I = list(map(int, input().split()))
N = I[0]
K = I[1]
H = list(map(int, input().split()))

dp = [float('inf') for _ in range(N+1)]

dp[N] = 0
for i in range(N-1,N-K-1,-1):
	if i>0:
		dp[i] = abs(H[i]-H[N])

for i in range(N-K-1,0,-1):
	for k in range(1,K+1):
		if i+k<=N:
			dp[i] = min(abs(H[i+k-1]-H[i-1])+dp[i+k], dp[i])

print(dp[1])
Problem p03162 (python)

Fixed submission:
N = int(input())
arr = []*N
for _ in range(N):
	arr.append(list(map(int,input().split())))

dp = [0,0,0]
for a in arr:
	dp = [a[0]+max(dp[1],dp[2]),a[1]+max(dp[0],dp[2]),a[2]+max(dp[0],dp[1])]

print(max(dp))

Buggy submission (verdict: Runtime Error):
N = int(input())
arr = []*N
for _ in range(N):
	arr.append(list(map(int,input().split())))

dp = [0,0,0]
for a in arr:
	dp = [a[0]+max(dp[1],dp[2]),a[1]+max(dp[0],dp[2]),a[2]+max(dp[0],dp[1])]
return max(dp)

Buggy submission (verdict: Runtime Error):
N = int(input())
a = []*N
for _ in range(N):
	a.append(list(map(int,input().split())))

dp = [[0,0]]*(N+1)
m = max(a[0])
j = a[0].index(m)
dp[0][0] = m
dp[0][1] = j
for i in range(N):
	prev = dp[i-1][1]
	m = 0
	for j in range(3):
		if j!=prev:
			m = max(a[i],m)
	j = a[i].index(m)
	dp[i][0] = dp[i-1][0] + m
	dp[i][1] = j
print(dp[N-1][0])

Buggy submission (verdict: Runtime Error):
N = int(input())
a = []*N
for _ in range(N):
	a.append(list(map(int,input().split())))
def prob(N,a):
	if N==1:
		ans = max(a[0][0],a[0][1],a[0][2])
		if ans==a[0][0]:
			click = 0
		elif ans==a[0][1]:
			click = 1
		elif ans==a[0][2]:
			click = 2
		return [ans, click]

	rec = prob(N-1, a)
	if rec[1] == 0:
		ans = rec[0] + max(a[N-1][1],a[N-1][2])
		if a[N-1][1]>a[N-1][2]:
			click = 1
		else:
			click = 2
		return [ans,click]

	if rec[1] == 1:
		ans = rec[0] + max(a[N-1][0],a[N-1][2])
		if a[N-1][0]>a[N-1][2]:
			click = 0
		else:
			click = 2
		return [ans,click]

	if rec[1] == 2:
		ans = rec[0] + max(a[N-1][0],a[N-1][1])
		if a[N-1][0]>a[N-1][1]:
			click = 0
		else:
			click = 1
		return [ans,click]

l = prob(N,a)
print(l[0])
Problem p03166 (python)

Fixed submission:
import sys
sys.setrecursionlimit(10**9)

N,M = map(int,input().split())
G = {}
for node in range(1,N+1):
	G[node] = set()
for _ in range(M):
	x,y = map(int,input().split())
	G[x].add(y)

maxpath = [-1 for _ in range(N+1)]

def maxpa(G,source,maxpath):
	if maxpath[source] != -1:
		return maxpath[source]
	else:	
		if len(G[source]) == 0:
			maxpath[source] = 0
			return maxpath[source]
		else:	
			for ngbr in G[source]:
				maxpath[source] = max(maxpath[source],1+maxpa(G,ngbr,maxpath))
			return maxpath[source]

for i in range(1,N+1):
	if maxpath[i]==-1:
		maxpa(G,i,maxpath)

print(max(maxpath))

Buggy submission (verdict: Runtime Error):
N,M = map(int,input().split())
G = {}
for node in range(1,N+1):
	G[node] = set()
for _ in range(M):
	x,y = map(int,input().split())
	G[x].add(y)

maxpath = [-1 for _ in range(N+1)]

def maxpa(G,source,maxpath):
	#print(source)
	if maxpath[source] != -1:
		return maxpath[source]
	else:	
		if len(G[source]) == 0:
			maxpath[source] = 0
			return maxpath[source]
		else:	
			for ngbr in G[source]:
				maxpath[source] = max(maxpath[source],1+maxpa(G,ngbr,maxpath))
			return maxpath[source]

for i in range(1,N+1):
	if maxpath[i]==-1:
		maxpa(G,i,maxpath)

print(max(maxpath))

Buggy submission (verdict: Runtime Error):
N,M = map(int,input().split())
G = {}
for node in range(1,N+1):
	G[node] = set()
for _ in range(M):
	x,y = map(int,input().split())
	G[x].add(y)

maxpath = [-1 for _ in range(N+1)]

def maxpa(G,source,maxpath):
	print(source)
	if maxpath[source] != -1:
		return maxpath[source]
	else:	
		if len(G[source]) == 0:
			maxpath[source] = 0
			return maxpath[source]
		else:	
			for ngbr in G[source]:
				maxpath[source] = max(maxpath[source],1+maxpa(G,ngbr,maxpath))
			return maxpath[source]

for i in range(1,N+1):
	if maxpath[i]==-1:
		maxpa(G,i,maxpath)

print(max(maxpath))
Problem p02687 (python)

Fixed submission:
args = input()
if args == "ABC":
 print("ARC")
elif(args=="ARC"):
 print("ABC")

Buggy submission (verdict: Runtime Error):
args = input()
 
if(args == "ABC"){
print("ARC")
}elif(args=="ARC"){
print("ABC")
}

Buggy submission (verdict: Runtime Error):
args = raw_input()
 
if(args == "ABC"){
print("ARC")
}elif(args=="ARC"){
print("ABC")
}

Buggy submission (verdict: Runtime Error):

 
if(S == "ABC"){
print("ARC")
}elif(S=="ARC"){
print("ABC")
}

Buggy submission (verdict: Runtime Error):
import sys
args = sys.argv

if(args == "ABC"){
print("ARC")
}elif(args=="ARC"){
print("ABC")
}
Problem p02706 (python)

Fixed submission:
N, M = input().split()

N = int(N)
M = int(M)

a = list(map(int, input().split()))


if sum(a) < N:
    print(N-sum(a))

if sum(a) == N:
    print(0)

if sum(a) > N:
    print(-1)

Buggy submission (verdict: Runtime Error):
N, M = input().split()

N = int(N)
M = int(M)

a = input().split()

a = int(a)


if sam(a) < N:
    print(N - sam(a))

if sam(a) > N:
    print(-1)
Problem p02983 (python)

Fixed submission:
l,r = map(int,raw_input().split())

now = [0]*2020

a = l
while a < r+1:
  now[a % 2019] = 1
  a += 1
  if now[0] == 1 or (now[3]==1 and now[673]==1):
    print 0
    exit(0)

ans = 2019*2019
for x in range(2019):
  if now[x] == 1:
    for y in range(2019):
      if now[y] == 1 and x != y:
        buf = (x*y)%2019
        if ans > buf:
          ans = buf
print ans

Buggy submission (verdict: Runtime Error):
l,r = map(int,raw_input().split())

now = [0]*2020

for a in range(l,r+1):
  now[a % 2019] = 1
  if now[0] == 1 or (now[3]==1 and now[673]==1):
    print 0
    exit(0)

ans = 2019*2019
for x in range(2019):
  if now[x] == 1:
    for y in range(2019):
      if now[y] == 1 and x != y:
        buf = (x*y)%2019
        if ans > buf:
          ans = buf
print ans
Problem p03095 (python)

Fixed submission:
mod = 10**9 + 7

n = int(raw_input())
s = raw_input()

q = []

for a in "abcdefghijklmnopqrstuvwxyz":
  q.append( s.count(a) )

ans = 1

for a in q:
  ans *= (a+1)
  ans %= mod

print ans-1

Buggy submission (verdict: Runtime Error):
import math

mod = 10**9 + 7

n = int(raw_input())
s = raw_input()

def comb(r,n):
  if r == 0: return 1
  return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

ans = 0

q = []

for a in "abcdefghijklmnopqrstuvwxyz":
  q.append( s.count(a) )

#print q

for a in range(1,min(26+1,n+1)):
  ans += comb(a,n)

  for b in range(len(q)):
    if q[b] > 1 and a > 1:
      #print a,q[b]
      #print comb(2,q[b]) * comb(a-2,n-q[b])
      ans -= comb(2,q[b]) * comb(a-2,n-q[b])
      for c in range(b+1,len(q)):
        if q[c] > 1 and a > 3:
          ans += comb(2,q[b]) * comb(2,q[c]) * comb(a-2-2,n-q[b]-q[c])

print ans % mod
Problem p03388 (python)

Fixed submission:
import math

n = int(raw_input())

for a in range(n):
  x = map(int,raw_input().split())
  x.sort()

  if x[0] == x[1]:
    print 2*x[0] - 2
    continue

  if x[0]+1 == x[1]:
    print 2*x[0] - 2
    continue

  q = x[0]*x[1]
  q = int(math.sqrt(q))

  if q*q == x[0]*x[1]:
    q -= 1

  if q*(q+1) >= x[0]*x[1]:
    print 2*q - 2
    continue

  print 2*q - 1

Buggy submission (verdict: Runtime Error):

  q = x[0]*x[1]
  buf = math.sqrt(q)
  buf = int(buf)
  if buf*buf == x[0]*x[1]:
    buf -= 1

  ans = buf * 2 - 2
  if buf*(buf+1) < x[0]*x[1]:
    ans += 1

  print ans
Problem p03416 (python)

Fixed submission:
a,b = map(int,raw_input().split(" "))
ans = 0
for x in range(a,b+1):
  q = str(x)
  if q[0:2] == q[3:5][::-1]:
    ans += 1
print ans

Buggy submission (verdict: Runtime Error):
a = int(raw_input())
b = int(raw_input())
ans = 0
for x in range(a,b+1):
  q = str(x)
  if q[0:2] == q[3:5]:
    ans += 1
print ans
Problem p03452 (python)

Fixed submission:
n,m = map(int,raw_input().split(" "))

pos = []
for a in range(100001):
  pos.append([a,0])

def check(i):
  k,x = pos[i]
  if k != i:
    k2,x2 = check(k)
    pos[i] = [k2,x+x2]
  return pos[i]

for a in range(m):
  l,r,d = map(int,raw_input().split(" "))

  lk,lx = check(l)
  rk,rx = check(r)

  if lk != rk:
    t = d+lx-rx
    if t >= 0:
      pos[rk] = (lk,t)
    else:
      pos[lk] = (rk,-t)
  else:
    if rx - lx != d:
      print "No"
      exit(0)
print "Yes"

Buggy submission (verdict: Runtime Error):
n,m = map(int,raw_input().split(" "))

pos = []
for a in range(100001):
  pos.append([a,0])

def check(i):
  k,x = pos[i]
  if k != i:
    k2,x2 = check(k)
    pos[i] = [k2,x+x2]
  return pos[i]

for a in range(m):
  l,r,d = map(int,raw_input().split(" "))

  lk,lx = check(l)
  rk,rx = check(r)

  if lk != rk:
    t = d+lx-rx
    if t >= 0:
      pos[rk] = (lk,t)
    else:
      pos[lk] = (rk,-t)
  else:
    if rx - lx != d:
      print "No"
      exit(0)
print "Yes"



  if l > r:
    data.append([r,l,-d])
  else:
    data.append([l,r,d])
data.sort()
Problem p03577 (python)

Fixed submission:
print raw_input()[:-8]

Buggy submission (verdict: Runtime Error):
YAKINIKUFESTIVAL
Problem p03943 (python)

Fixed submission:
dat = raw_input()
(A,B,C) = dat.split(" ")
A = int(A)
B = int(B)
C = int(C)

if A == (B+C) or (A+B) == C or (A+C) == B:
  print "Yes"
else:
  print "No"

Buggy submission (verdict: Runtime Error):
dat = raw_input()
(N,T) = dat.split(" ")

N = int(N)
T = int(T)

dat = raw_input()
A = map(int,dat.split(" "))

diffno = 0

mind = A[0]
maxd = 0

for x in range(1,len(A)):
  if maxd < (A[x] - mind):
    maxd = A[x] - mind
    diffno = 1
  elif maxd == (A[x] - mind):
    diffno += 1

  if mind > A[x]:
    mind = A[x]

print diffno
Problem p02687 (python)

Fixed submission:
s = input()
if s == "ABC":
    print("ARC")
else:
    print("ABC")

Buggy submission (verdict: Runtime Error):
s = input()
if s = "ABC":
    print("ARC")
else:
    print("ABC")
Problem p02994 (python)

Fixed submission:
n,l = list(map(int,input().split()))
apple = []
for i in range(n):        apple.append(l+i)
if 0 in apple:
        print(sum(apple))
elif apple[n-1] < 0:
        print(sum(apple)-apple[len(apple)-1])
else:
        print(sum(apple[1:len(apple)+1]))

Buggy submission (verdict: Runtime Error):
n,l = list(map(int,input().split()))
apple = []
for i in range(n):        apple.append(l+i)
if 0 in apple:
        print(sum(apple))
elif apple[n] < 0:
        print(sum(apple)-apple[len(apple)-1])
else:
        print(sum(apple[1:len(apple)+1]))
Problem p03068 (python)

Fixed submission:
N = int(input())
S = list(input())
K = int(input())
key = S[K-1]
for i in range(N):
    if S[i] != key:
        S[i] = "*"
print("".join(S))

Buggy submission (verdict: Runtime Error):
N = int(input())
S = list(input())
K = int(input())
print(key)
for i in range(N):
    if S[i] != key:
        S[i] = "*"
print("".join(S))
Problem p03147 (python)

Fixed submission:
n = int(input())
h = list(map(int,input().split()))
 
mizuyari = 0
for i in range(sorted(h)[n-1]):
    maenohana = False
    for j in range(n):
        if not maenohana and i+1<=h[j]:
            mizuyari += 1
        maenohana = i+1<=h[j]
print(mizuyari)

Buggy submission (verdict: Runtime Error):
n = int(input())
h = input().split()

mizuyari = 0
for i in range(int(sorted(h)[n-1])):
    maenohana = False
    mizuyari += thismizuyari
    thismizuyari = 0
    for j in range(n):
        if not maenohana and i+1<=int(h[j]):
            thismizuyari += 1
        maenohana = i+1<=int(h[j])
print(mizuyari)
Problem p03293 (python)

Fixed submission:
S = input().lower()
T = input().lower()
for i in range(len(S)):
  S = S[len(S)-1:len(S)] + S[0:len(S)-1]
  if S == T:
    break
if S == T:
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
S = input().lower
T = input().lower

for i in range(len(S)):
  S = S[len(S)-1:len(S)] + S[0:len(S)-1]
  if S == T:
    break
if S == T:
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
S = input().lower
T = input().lower
for i in range(len(S)):
  S = S[len(S)-1:len(S)] + S[0:len(S)-1]
  if S == T:
    break
if S == T:
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
from sys import stdin
S, T = stdin.readline().rstrip().split()
S = S[::-1]
if S == T:
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
S, T = stdin.readline().rstrip().split()
S = S[::-1]
if S == T:
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
S,T = str(stdin.readline().rstrip()).lower()
S = S[::-1]
if S == T:
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
S,T = str(stdin.readline().rstrip()).lower()
S = S[::-1]
if S == T:
  print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
S,T = str(stdin.readline().rstrip()).lower()
S = S[::-1]
if S = T:
  print("Yes")
else:
    print("No")
Problem p03316 (python)

Fixed submission:
from sys import stdin
N = int(stdin.readline().rstrip())
i = 0
wa = 0
while i < len(str(N)):
    wa = wa + int(str(N)[i:i+1])
    i += 1
if N % wa == 0:
    print("Yes")
elif N % wa != 0:
    print("No")

Buggy submission (verdict: Runtime Error):
i = 0
wa = 0
while i < len(str(N)):
    wa = wa + int(str(N)[i:i+1])
    i += 1
if N % wa == 0:
    print("Yes")
elif N % wa != 0:
    print("No")

Buggy submission (verdict: Runtime Error):
i = 0
wa = 0
while i len(str(N)):
  wa = wa + int(str(N)[i:i+1])
  i += 1
if N % wa == 0:
  print("Yes")
elif N % wa != 0:
  print("No")
Problem p03624 (python)

Fixed submission:
import string
alphabet = [chr(i) for i in range(97, 97+26)]
s = set(input())
result = set(alphabet) - s
result = sorted(list(result))
if len(result) == 0:
  print("None")
else:
  print(result[0])

Buggy submission (verdict: Runtime Error):
import string
alphabet = [chr(i) for i in range(97, 97+26)]
s = set(input())
result = set(alphabet) - s
result = sorted(list(result))
print(result[0])
Problem p03331 (python)

Fixed submission:
N = int(input())

def wa(x):
    s = 0
    while x > 0:
        s += x % 10
        x = int(x / 10)
    return s
L = []
for i in range(1,N):
    A = i
    B = N - i
    x = wa(A) + wa(B)
    L.append(x)
    
L = sorted(L)
    
print(L[0])

Buggy submission (verdict: Runtime Error):
N = int(input())

def wa(x):
    s = 0
    while x > 0:
        s += x % 10
        x = int(x / 10)
    return s
L = []
for i in range(2,N):
    A = i
    B = N - i
    x = wa(A) + wa(B)
    L.append(x)
    
L = sorted(L)
    
print(L[0])
Problem p03860 (python)

Fixed submission:
print("A" + input()[8] + "C")

Buggy submission (verdict: Runtime Error):
s = input()
print(A + "input[8]" + C)
Problem p04044 (python)

Fixed submission:
N,L = map(int,input().split())
M = []
for i in range(N):
    M.append(input())

M = sorted(M)

print(''.join(M))

Buggy submission (verdict: Runtime Error):
N,L = map(int,input().split())
M = []
for i in range(N):
    M.append(input())
    
M = sorted(input().split())

print(''.join(L))
Problem p03478 (python)

Fixed submission:
N, A, B = map(int, input().split())
print(sum(i for i in range(N + 1) 
         if A <= sum(map(int, str(i)))
         <= B))

Buggy submission (verdict: Runtime Error):
N, A, B = map(int, input().split())
print(sum(i for in range(N + 1)
          if A <= sum(map(int, str(i))) <= B))
Problem p04044 (python)

Fixed submission:
n, l = map(int, input().split())
s = sorted([input() for i in range(n)])
print(*s, sep = "")

Buggy submission (verdict: Runtime Error):
n, l = map(int, input().split())
s = soated([input() for i in range(n)])
print(*s, sep = "")
Problem p02687 (python)

Fixed submission:
s = input()


if s=='ABC':
  print('ARC')  
elif s=='ARC':
    print('ABC')

Buggy submission (verdict: Runtime Error):
s = input()


if s='ABC'
  print('ARC')  
else if s='ARC' 
    print('ABC')
Problem p02765 (python)

Fixed submission:
input= list( map(int,input().split()) )
n = input[0]
r=  input[1]

if n<10:
    print(r + (100 * (10-n)) )
else:
    print(r)

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

#print(max(x),min(x))

min_hp = 1000000000000000
for p in range(min(x),max(x)+1):
    hp = 0
    for i in x:
        hp +=(i-p)**2
        # print(p,i,hp)
    if min_hp > hp:
        min_hp = hp

print(min_hp)

Buggy submission (verdict: Runtime Error):
n= int(input())
r= int(input())

if n<10:
    print(r - 100 * (10-n) )
else:
    print(r)
Problem p02886 (python)

Fixed submission:
n=input()
d=[int(i) for i in input().split()]
sum=0
while True:
  a=d[0]
  del d[0]
  if d == []:
    break
  for i in d:
    sum += a*i
print(sum)

Buggy submission (verdict: Runtime Error):
n=input()
d=[int(i) for i in input().split()]
while True:
  a=d[0]
  del d[0]
  if d == []:
    break
  for i in d:
    sum += a*i
print(sum)

Buggy submission (verdict: Runtime Error):
input()
d=[int(i) for i in input().split()]
i=0
while True:
  a=d[0]
  del d[0]
  if d == []:
    break
  for i in d:
    sum += a*i
print(sum)

Buggy submission (verdict: Runtime Error):
input()
d=[int(i) for i in input().split()]
i=0
while True:
  a=d[0]
  del d[0]
  for i in d:
    sum += a*i
print(sum)
Problem p02909 (python)

Fixed submission:
s=input()
if s == 'Sunny':
 print('Cloudy')
elif s == 'Cloudy':
 print('Rainy')
else:
 print('Sunny')

Buggy submission (verdict: Runtime Error):
s=input()
w=['Sunny','Cloudy','Rainy']
print(w[w.index(s)+1])
Problem p03000 (python)

Fixed submission:
n,x=map(int, input().split())
llist=list(map(int, input().split()))
point=0
cnt=1
for i in range(n):
  point+=llist[i]
  if(point<=x):
    cnt+=1
print(cnt)

Buggy submission (verdict: Runtime Error):
n,x=map(int, input().split())
llist=list(map(int, input().split()))
point=0
cnt=0
while point<=x:
  point+=llist[cnt]
  cnt+=1
  if cnt>n:
    break
print(cnt)

Buggy submission (verdict: Runtime Error):
n,x=map(int, input().split())
llist=list(map(int, input().split()))
point=0
cnt=0
while point<=x:
  cnt+=1
  point+=llist[cnt]
  if cnt>n:
    break
print(cnt)

Buggy submission (verdict: Runtime Error):
n,x=map(int, input().split())
llist=list(map(int, input().split()))
point=0
cnt=0
while point<=x and cnt<=n:
  point+=llist[cnt]
  cnt+=1
print(cnt)

Buggy submission (verdict: Runtime Error):
n,x=map(int, input().split())
llist=list(map(int, input().split()))
point=0
cnt=0
while point+llist[cnt]<=x and cnt<n:
  point+=llist[cnt]
  cnt+=1
print(cnt+1)

Buggy submission (verdict: Runtime Error):
n,x=map(int, input().split())
llist=list(map(int, input().split()))
sum=0
cnt=0
while sum+llist[cnt]<x and cnt<n:
  sum+=llist[cnt]
  cnt+=1
print(cnt+1)
Problem p02687 (python)

Fixed submission:
if __name__=='__main__':
    s = input()
    t = 'ABC' if s == 'ARC' else 'ARC'
    print(t)

Buggy submission (verdict: Runtime Error):
    s = input()
    t = 'ABC' if s == 'ARC' else 'ARC'
    print(t)
Problem p03035 (python)

Fixed submission:
# coding:utf-8

if __name__ == '__main__':
  A,B = map(int,input().split())
  if A >= 13:
    print(B)
  elif A>=6:
    print(int(B/2))
  else:
    print(0)

Buggy submission (verdict: Runtime Error):
# coding:utf-8
if __name__=='__main__':
  r,D,x = map(int, input().split())
  for i in range(10):
    x = r*x-D
    print(x)
Problem p03047 (python)

Fixed submission:
# coding:utf-8

if __name__=="__main__":
  N, K = map(int, input().split())
  print(N-K+1)

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

if __name__=="__main__":
  N = int(input())
  s = []
  a,b,ba=0,0,0
  count = 0
  for i in range(N):
      s.append(input())
      count += s.count('AB')
      if s[i][0]!='B' and s[i][-1]=='A': a+=1
      if s[i][0]=='B' and s[i][-1]!='A': b+=1
      if s[i][0]=='B' and s[i][-1]=='A': ba+=1
  if ba == 0:
      print(count+min(a,b))
  elif min(a,b)==0:
      print(count+ba-1)
  else:
      print(count+ba+min(a,b))

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

if __name__=="__main__":
  R,G,B,N = map(int, input().split())
  count = 0
  for r in range(int(N/R)+1):
    n1 = N - r*R
    for g in range(int(n1/G)+1):
      n2 = n1 - g*G
      if n2%B==0: count+= 1
  print(count)
Problem p02687 (python)

Fixed submission:
comp = input()
try :
  if comp[1] == 'R' :
    print("ABC")
  else : print("ARC")
except: 
  pass

Buggy submission (verdict: Runtime Error):
comp = input()
if cpm[1] == 'R' :
  print("ABC")
else :
  print("ARC")
Problem p02687 (python)

Fixed submission:
S = input() 
if S == "ABC":
	print("ARC")
else:
	print("ABC")

Buggy submission (verdict: Runtime Error):
if S == "ABC":
	print("ARC")
else:
	print("ABC")

Buggy submission (verdict: Runtime Error):
If S = "ABC":
	return "ARC"
else:
	return "ABC"
Problem p02705 (python)

Fixed submission:
import math

r = float(input())

ans = 2*r*math.pi

print(ans)

Buggy submission (verdict: Runtime Error):
import math
R = float(imput())

ans = 2 * R * PI

print(ans)
Problem p02720 (python)

Fixed submission:

from sys import stdin
import sys
sys.setrecursionlimit(10**8)

def nextLine(): return next(stdin)
def nextStrList(): return nextLine().split()
def nextIntList(): return [int(_) for _ in nextStrList()]


def main():
	k=nextIntList()[0]
	if k<=9:
		print(k)
		sys.exit(0)
	num=[0,1]
	for i in range(10, k):
# 		print(num)
		if all([n==9 for n in num]):
			num=[0 for d in range(len(num))]
			num.append(1)
			continue
		
		for di in range(len(num)):
			if di==0:
				if num[di]<=num[di+1] and num[di]<9:
					num[di]+=1
					break
			elif di<len(num)-1:
				if num[di]<=num[di+1] and num[di]<9 and num[di]<=num[di-1]:
					num[di]+=1
					break
			else: #di==len(num)-1
				num[di]+=1
	
		for dii in range(di-1, -1,-1):
			if num[dii+1]==0:
				num[dii]=0
			else:
				num[dii]=num[dii+1]-1 
	
	print("".join(str(n) for n in reversed(num)))

if __name__=="__main__":
	main()

Buggy submission (verdict: Runtime Error):

from sys import stdin
import sys
sys.setrecursionlimit(10**8)

def nextLine(): return next(stdin)
def nextStrList(): return nextLine().split()
def nextIntList(): return [int(_) for _ in nextStrList()]


def main():
	k=nextIntList()[0]
	if k<=9:
		print(k)
		sys.exit(0)
	num=[0,1]
	for i in range(10, k):
# 		print(num)
		if all([n==9 for n in num]):
			num=[*[0 for d in range(len(num))], 1]
			continue
		
		for di in range(len(num)):
			if di==0:
				if num[di]<=num[di+1] and num[di]<9:
					num[di]+=1
					break
			elif di<len(num)-1:
				if num[di]<=num[di+1] and num[di]<9 and num[di]<=num[di-1]:
					num[di]+=1
					break
			else: #di==len(num)-1
				num[di]+=1
	
		for dii in range(di-1, -1,-1):
			if num[dii+1]==0:
				num[dii]=0
			else:
				num[dii]=num[dii+1]-1 
	
	print("".join(str(n) for n in reversed(num)))

if __name__=="__main__":
	main()