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

Fixed submission:
a, b = map(int, input().split())
if 0 < a <= b:
    print("Positive")

elif a <= b < 0:
    if (b - a + 1) % 2 == 0:
        print("Positive")

    else:
        print("Negative")
elif a <= 0 <= b:
    print("Zero")

Buggy submission (verdict: Runtime Error):
a, b = map(int, input().split())
numbers = list(range(a, b + 1))
if a <= 0:
    if 0 <= b or a == 0 or b == 0:
        print("Zero")
        exit()
    if len(numbers) % 2 != 0:
        print("Negative")
    else:
        print("Positive")
else:
    print("Positive")

Buggy submission (verdict: Runtime Error):
a, b = map(int, input().split())
numbers = list(range(a, b + 1))
if a < 0:
    if 0 < b:
        print("Zero")
        exit()
    if len(numbers) % 2 != 0:
        print("Negative")
    else:
        print("Positive")
else:
    print("Positive")

Buggy submission (verdict: Runtime Error):
a, b = map(int, input().split())
numbers = list(range(a, b + 1))
if a < 0:
    if 0 < b:
        print("Zero")
        exit()
    if numbers.index(-1) % 2 != 0:
        print("Positive")
    else:
        print("Negative")
else:
    print("Positive")

Buggy submission (verdict: Runtime Error):
a, b = map(int, input().split())
numbers = list(range(a, b + 1))
if a < 0:
    if 0 < b:
        print("Zero")
        exit()
    elif numbers.index(-1) % 2 != 0:
        print("Positive")
    else:
        print("Negative")
else:
    print("Positive")

Buggy submission (verdict: Runtime Error):
a, b = map(int, input().split())
numbers = list(range(a, b + 1))
if a < 0:
    if 0 < b:
        print("Zero")
    elif numbers.index(-1) % 2 != 0:
        print("Positive")
    else:
        print("Negative")
else:
    print("Positive")
Problem p03160 (python)

Fixed submission:
N=int(input())
h=list(map(int,input().split()))
# N = 4
# h = [10, 30, 40, 20]
dp = [1000000]*N
#d[i]はカエルが足場iへと移動するのに必要な最小コスト
dp[0]=0
for i in range(1,N):
    if i == 1:
        dp[i] = dp[i-1]+abs(h[i]-h[i-1])
    else:
        dp[i] = min(dp[i-1]+abs(h[i]-h[i-1]), dp[i-2]+abs(h[i]-h[i-2]))
# print(dp)
# print("min cost=",dp[-1])
print(dp[-1])

Buggy submission (verdict: Runtime Error):
N, K = map(int, input().split())
h = list(map(int, input().split()))
dp = [10**9]*N
dp[0] = 0
for i in range(1,N):
    for k in range(1,min(K+1,N-i)):
        dp[i+k]=min(dp[i+k],dp[i]+abs(h[i]-h[i+k]))
print(dp[-1])
Problem p02576 (python)

Fixed submission:
def probA():
    N, X, T = map(int, input().split())

    t = 0
    while N > 0:
        N -= X
        t += T
    print(t)


def main():
    probA()


if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
probA():
    N, X, T = map(int, input().split())

    t = 0
    while N > 0:
        N //= X
        t += T
    print(t)


def main():
    probA()


if __name__ == '__main__':
    main()
Problem p02600 (python)

Fixed submission:
def Kyu_in_atcoder():
    score = int(input())
    if score >= 1800:
        print(1)
    elif score >= 1600:
        print(2)
    elif score >= 1400:
        print(3)
    elif score >= 1200:
        print(4)
    elif score >= 1000:
        print(5)
    elif score >= 800:
        print(6)
    elif score >= 600:
        print(7)
    elif score >= 400:
        print(8)


def main():
	Kyu_in_atcoder()


if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
def laod_to_mill():
    days = int(input())
    prices = tuple(map(int, input().split()))

    if max(prices) == prices[0]:
        print(1000)
        return

    total = 1000
    ks = 0

    for d in range(days):
        if d == days - 1:
            total += ks * prices[d]
            break

        if prices[d] < prices[d + 1]:
            buy = total // prices[d]
            total -= buy * prices[d]
            ks += buy

        elif prices[d] > prices[d + 1]:
            total += ks * prices[d]
            ks = 0

    print(total)


def main():
    laod_to_mill()


if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
def marks_C():
    N, K = map(int, input().split())
    scores = tuple(map(int, input().split()))

    for i, k in enumerate(range(K, N)):
     
        if calc_score(scores[i + 1:k + 1]) > calc_score(scores[i:k]):
            print('Yes')
        else:
            print('No')
     
     
def calc_score(score: tuple):
    total = 1
    for i in score:
        total *= i
     return total
     
     
if __name__ == '__main__':
    marks_C()
Problem p02554 (python)

Fixed submission:
N = int(input())
MOD = 1000000000 + 7
def power_func(a, n, p):
    bi = str(format(n,"b"))#2進表現に
    res = 1
    for i in range(len(bi)):
        res = (res*res) % p
        if bi[i] == "1":
            res = (res*a) % p
    return res
print(str((power_func(10, N, MOD) - 2 * power_func(9, N, MOD) + power_func(8, N, MOD)) % MOD))

Buggy submission (verdict: Runtime Error):
N = int(input())
MOD = 1000000000 + 7
def power_func(a,n,p):
    bi = str(format(n,"b"))#2進表現に
    res = 1
    for i in range(len(bi)):
        res = (res*res) %p
        if bi[i] == "1":
            res = (res*a) %p
    return res
print(str((power_func(10, N, MOD) - 2 * power_func(9, N, MOD) + power_func(8, N, MOD) % MOD))
Problem p03304 (python)

Fixed submission:
(n, m, d) = map(int, input().split())
if d == 0:
    print((m-1) / float(n))
else:
    print(2 * (m-1) * (n-d) / float(n * n))

Buggy submission (verdict: Runtime Error):
n, m, d = map(int, input().split())
if d == 0:
    print((m-1) / double(n) )
else:
    print(2 * (m-1) * (n-d) / double(n * n))
Problem p02957 (python)

Fixed submission:
A,B = [int(char) for char in input().split(' ')]

if (A+B)%2 != 0:
  print('IMPOSSIBLE')
else:
  print(int((A+B)/2))

Buggy submission (verdict: Runtime Error):
N = int(input())
p_list = list(int(pi) for pi in input().split(' '))

num_opposite = 0
indices = []

for i in range(N-1):
  p_1st = p_list[i]
  p_2nd = p_list[i+1]
  
  if p_1st<=p_2nd:
    pass
  else:
    num_opposite+=1
    if num_opposite==1:
      indices.append(i)
    else:
      indices.append(i+1)
      
  
  if num_opposite >=3:
    break 

if num_opposite == 0:
  print('YES')
elif num_opposite == 1:
  print('YES')
elif num_opposite == 2:
  small_idx = indices[0]
  large_idx = indices[1]
  
  p_small = p_list[small_idx]
  p_large = p_list[large_idx]
  
  if (p_small==p_list[large_idx-1]+1) and (p_large==p_list[small_idx+1]-1):
    print('YES')
  else:
    print('NO')
else:
  print('NO')
Problem p02971 (python)

Fixed submission:
N = int(input())

idx_1st=1
val_1st=1
idx_2nd=0
val_2nd=0

for i in range(N):
  Ai = int(input())
  if Ai>=val_1st:
    idx_2nd=idx_1st
    val_2nd=val_1st
    
    idx_1st=i
    val_1st=Ai
    
  elif Ai<val_1st:
    if Ai>val_2nd:
      idx_2nd=i
      val_2nd=Ai
  else:
    raise ValueError

for i in range(N):
  if i!=idx_1st:
    print(val_1st)
  elif i==idx_1st:
    print(val_2nd)
  else:
    raise ValueError

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

idx_1st=1
val_1st=1
idx_2nd=0
val_2nd=0

for i in range(N):
  Ai = int(input())
  if Ai>=val_1st:
    idx_2nd=idx_1st
    val_2nd=val_1st
    
    idx_1st=i
    val_1st=Ai
    
  elif Ai<val_1st:
    if Ai>val_2nd:
      idx_2nd=i
      val_2nd=Ai
    else:
      raise ValueError
  else:
    raise ValueError

for i in range(N):
  if i!=idx_1st:
    print(val_1st)
  elif i==idx_1st:
    print(val_2nd)
  else:
    raise ValueError
Problem p02642 (python)

Fixed submission:
n = int(input())
nums = list(map(int,input().split()))
nums.sort()
ans = 0
cnt = {}
flag = [0]*1000005
for i in nums:
  cnt[i] = cnt.get(i,0) + 1

for i in nums:
  if flag[i] == 0 and cnt[i] == 1:
    ans += 1
  if flag[i] == 1:
    continue
  for j in range(i,1000001,i):
    flag[j] = 1

print(ans)

Buggy submission (verdict: Runtime Error):
n = int(input())
nums = list(map(int,input().split()))
nums.sort()
ans = 0
cnt = {}
flag = [0]*1000005
for i in range(1,len(nums)):
  cnt[i] = cnt.get(i,0) + 1

    
for i in nums:
  if flag[i] == 0 and cnt[i] == 1:
    ans += 1
  for j in range(i*2,1000000,i):
    flag[j] = 1

print(ans)

Buggy submission (verdict: Runtime Error):
n = int(input())
nums = list(map(int,input().split()))
nums.sort()
ans = 0
cnt = {}
flag = [0]*1000000
for i in range(1,len(nums)):
  if nums[i] == nums[i-1]:
    flag[nums[i]] = 1

    
for i in range(len(nums)):
  if flag[nums[i]] == 0:
    ans += 1
  if flag[nums[i]*2] == 0:
    for j in range(nums[i]*2,1000000,nums[i]):
      flag[j] = 1

print(ans)

Buggy submission (verdict: Runtime Error):
n = int(input())
nums = list(map(int,input().split()))
nums.sort()
ans = 0
cnt = {}
flag = [0]*1000000
for i in range(1,len(nums)):
  if nums[i] == nums[i-1]:
    flag[nums[i]] = 1

    
for i in range(len(nums)-1):
  if flag[nums[i]] == 0:
    ans += 1
  if nums[i] != nums[i+1]:
    n = nums[i]
    while n <1000000:
      flag[n] = 1
      n = n+ nums[i]

if flag[nums[-1]] == 0:
  ans +=1

print(ans)

Buggy submission (verdict: Runtime Error):
n = int(input())
nums = list(map(int,input().split()))
nums.sort()
ans = 0
cnt = {}
flag = [0]*1000000
for i in range(1,len(nums)):
  if nums[i] == nums[i-1]:
    flag[nums[i]] = 1
    
if flag[nums[0]] == 0:
  ans +=1
    
for i in range(1,len(nums)):
  if flag[nums[i]] == 0:
    ans += 1
  if nums[i] != nums[i-1]:
    n = nums[i]
    while n <1000000:
      flag[n] = 1
      n = n+ nums[i]

print(ans)
Problem p02812 (python)

Fixed submission:
N=int(input())
S=str(input())
list_S=list(S)
ans=0

for i in range(N-2):
    if list_S[i]=='A':
        if list_S[i+1]=='B':
            if list_S[i+2]=='C':
                ans += 1
    

print(ans)

Buggy submission (verdict: Runtime Error):
N=int(input())
S=str(input())
list_S=list(S)
ans=0

for i in range(N):
    if list_S[i]=='A':
        if list_S[i+1]=='B':
            if list_S[i+2]=='C':
                ans += 1

print(ans)
Problem p03086 (python)

Fixed submission:
S=str(input())
lst=['A','C','G','T']
ans=0

for i in range(len(S)):
    cnt=0
    if S[i] in lst:
        cnt+=1
        if i==len(S)-1:
            ans = max(ans,cnt)
            break
        while S[i+1] in lst:
            cnt+=1
            i+=1
            if i+1==len(S):
                break
    ans=max(ans,cnt)

print(ans)

Buggy submission (verdict: Runtime Error):
S=str(input())
lst=['A','C','G','T']
ans=0

for i in range(len(S)):
    cnt=0
    if S[i] in lst:
        cnt+=1
        if i==len(S)-1:
            ans = max(ans,cnt)
            break
        while S[i+1] in lst:
            cnt+=1
            i+=1
            if i+1==len(S)-1:
                break
    ans=max(ans,cnt)

print(ans)
Problem p02584 (python)

Fixed submission:
import numpy as np

inpt = input()
inpt_list = inpt.split(" ")
X, K, D = [int(x) for x in inpt_list]

X_abs = np.abs(X)
num = X_abs // D
rem = K - num
if rem < 0:
    out = X_abs - D*K
else:
    if rem%2==0:
        out = X_abs - num*D
    else:
        out = np.abs(X_abs - num*D - D)
print(out)

Buggy submission (verdict: Runtime Error):
import numpy as np
import matplotlib.pyplot as plt

inpt = input()
inpt_list = inpt.split(" ")
X, K, D = [int(x) for x in inpt_list]

X_abs = np.abs(X)
num = X_abs // D
rem = K - num
if rem < 0:
    out = X_abs - D*K
else:
    if rem%2==0:
        out = X_abs - num*D
    else:
        out = np.abs(X_abs - num*D - D)
print(out)
Problem p02584 (python)

Fixed submission:
X, K, D = map(int,input().split())
res = 0
X = abs(X)
if X >= K * D:
    res = X - K * D
else:
    i = X // D
    j = K - i
    if j % 2 == 0:
        res = X - D * i
    else:
        res = X - D * (i + 1)
print(abs(res))

Buggy submission (verdict: Runtime Error):
N, K = map(int, input().split())
P = list(map(int, input().split()))
C = list(map(int, input().split()))

ans = -float('inf')
for s in range(N):
    ### Step1
    S = []  # 累積和S. ただし, 初項は0ではなく1回目の移動後の得点とする.
    # 1回目の移動
    i = P[s] - 1
    S.append(C[i])
    # 2回目以降の移動. スタート地点に戻ってくるまで繰り返し.
    while i != s:
        i = P[i] - 1
        S.append(S[-1] + C[i])

    ### Step2: KとSの長に応じて場合分けして, 得点の最大値を求める.
    # 1周未満しか移動できない場合:
    if K <= len(S):
        score = max(S[:K])
    # 1周以上回ることができるが, ループを1周したときに得点が減る場合:
    elif S[-1] <= 0:
        score = max(S)
    # 1週以上回ることができ, かつループを1週するごとに得点が増える場合:
    else:
        # ループを (K // len(S) - 1)回 廻る場合:
        score1 = S[-1] * (K // len(S) - 1)
        score1 += max(S)
        # ループを (K // len(S))回 廻る場合:
        score2 = S[-1] * (K // len(S))
        r = K % len(S)
        if r != 0:
            score2 += max(0, max(S[:r]))
        # score1 と score2 の大きい方がこの場合の得点の最大値
        score = max(score1, score2)

    ans = max(ans, score)

print(ans)
Problem p02642 (python)

Fixed submission:
from collections import Counter
N = int(input())
A = list(map(int, input().split()))
C = Counter(A)

A = set(A)
MAX_A = 10 ** 6
X = [0] * (MAX_A + 1)
for a in A:
    for i in range(a, MAX_A + 1, a):
        X[i] += 1

ans = len([a for a in A if (X[a] == 1) and (C[a] == 1)])
print(ans)

Buggy submission (verdict: Runtime Error):
N = int(input())
A = list(map(int,input().split()))
A.sort()
res = 0
Ab = [True] * N
cnt = 0
for i in range(N):
    if not Ab[i]:
        continue
    for j in range(i+1,N):
        if Ab[j] :
            if A[j] % A[i] == 0:
                 Ab[j] = False
                if A[i] == A[j]:
                    Ab[i] = False
print(Ab.count(True))
Problem p02658 (python)

Fixed submission:
n = int(input())
a = []
a = map(int,input().split())
a = sorted(a)
ans = 1
for val in a:
    ans *= val
    if ans > 10**18:
        print(-1)
        break
else:
    print(ans)

Buggy submission (verdict: Runtime Error):
n = int(input())
a = []
a = map(int,input().split())
ans = 1
for val in a:
    ans *= val
if ans > 10**18:
    print("-1")
    break
else:
    print(ans)
Problem p02684 (python)

Fixed submission:
N, K = map(int,input().split())
A = list(map(int,input().split()))
A.insert(0,0)
list = []
replist = []
judge = [True] * (2 * 10 ** 5 + 1)
pos = 1
owari = True
while owari:
    judge[pos] = False
    list.append(pos)
    pos = A[pos]
    if not judge[pos]:
        while True:
            replist.append(pos)
            judge[pos] = True
            pos = A[pos]
            if judge[pos]:
                owari = False
                break
if K <= len(list)-1:
    print(list[K])
else:
    K = K - len(list) + 1
    print(replist[( K % len(replist) ) -1])

Buggy submission (verdict: Runtime Error):
N, K = map(int,input().split())
A = list(map(int,input().split()))
A.insert(0,0)
list = []
replist = []
judge = [True] * (2 * 10 ** 5)
cnt = 1
pos = 1
owari = True
while cnt < 2 * 10 ** 5 and owari:
    judge[pos] = False
    list.append(pos)
    pos = A[pos]
    if not judge[pos]:
        while True:
            replist.append(pos)
            judge[pos] = True
            pos = A[pos]
            if judge[pos]:
                owari = False
                break
if K <= len(list)-1:
    print(list[K])
else:
    K = K - len(list) + 1
    print(replist[( K % len(replist) ) -1])
Problem p02761 (python)

Fixed submission:
N, M = map(int, input().split())
st = 1 * 10 ** (N-1)
en = st * 10
SC = []
for i in range(M):
    sc = list(map(int,input().split()))
    SC.append(sc)
if N == 1:
    for i in range(0, 10):
        t = str(i)
        judge = True
        for j in range(M):
            if t[SC[j][0] - 1] != str(SC[j][1]):
                judge = False
        if judge:
            print(i)
            exit()
    print("-1")
    exit()
    
for i in range(st,en):
    t = str(i)
    judge = True
    for j in range(M):
        if t[SC[j][0]-1] != str(SC[j][1]):
            judge = False
    if judge:
        print(i)
        exit()
print("-1")

Buggy submission (verdict: Runtime Error):
N, M = map(int, input().split())
Digit = [0] * N
Count = 0
for i in range(M):
    s, c = map(int, input().split())
    if Digit[s - 1] == c or Digit[s - 1] == 0:
        Digit[s - 1] = c
        Count += 1
    else:
        print("-1")
        exit()
if Digit[0] == 0 and M >= 1:
    if Digit[1] == 0 and M >=2:
        if Digit[2] == 0 and Count == 0:
            print("".join(map(str,Digit)))
            exit()
        else:
            print("-1")
            exit()
    else:
        print("-1")
        exit()
print("".join(map(str,Digit)))

Buggy submission (verdict: Runtime Error):
N, M = map(int, input().split())
Digit = [0] * N
Count = 0
for i in range(M):
    s, c = map(int, input().split())
    if Digit[s - 1] == c or Digit[s - 1] == 0:
        Digit[s - 1] = c
        Count += 1
    else:
        print("-1")
        exit()
if Digit[0] == 0:
    if Digit[1] == 0:
        if Digit[2] == 0 and Count == 0:
            print("".join(map(str,Digit)))
            exit()
        else:
            print("-1")
            exit()
    else:
        print("-1")
        exit()
print("".join(map(str,Digit)))
Problem p02848 (python)

Fixed submission:
n = int(input())
s = str(input())
alphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
rot = []
for i in s:
  pos = alphabet.find(i)
  pos = int(pos) + n
  if pos >= 26:
    pos = int(pos) - 26
  rot.append(alphabet[pos])
strout = "".join(rot)
print(strout)

Buggy submission (verdict: Runtime Error):
n = int(input())
s = str(input())
alphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
rot = []
for i in s:
  pos = alphabet.find(i)
  pos = int(pos) + n
  if pos > 26:
    pos = int(pos) - 26
  rot.append(alphabet[pos])
strout = "".join(rot)
print(strout)
Problem p02887 (python)

Fixed submission:
n = int(input())
s = str(input())
slist = []
for i in range(n):
  slist.append(s[i])
slime = slist[0]
fslist = []
fslist.append(slime)
for i in range(1, n):
  if slime != slist[i]:
    fslist.append(slist[i])
    slime = slist[i]
print(len(fslist))

Buggy submission (verdict: Runtime Error):
n = int(input())
s = str(input())
slist = []
for i in range(n):
  slist.append(s[i])
slime = slist[0]
fslist = [slime]
for i in range(1, n):
  if slime != slist[i]:
    fslist.append(slist[i])
    slime = slist[i]
print(len(fslist)
Problem p02924 (python)

Fixed submission:
n = int(input())
print(n * (n - 1) // 2)

Buggy submission (verdict: Runtime Error):
n = int(input())
r = [0] * (n - 1)
for i in range(n - 1):
  r[i] = i
print(sum(r) + (n - 1))

Buggy submission (verdict: Runtime Error):
n = int(input())
r = [0] * (n - 1)
for i in range(n - 1):
  r[i] = i + 1
print(sum(r))

Buggy submission (verdict: Runtime Error):
n = int(input())
r = [0] * (n - 1)
for i in range(n - 1):
  r[i] = (i + 1) % (i + 2)
print(sum(r))

Buggy submission (verdict: Runtime Error):
n = int(input())
p = [1] * n
q = [1] * n
r = [0] * n
for i in range(n):
  p[i] = i + 1
  q[i] = p[i] + 1
  r[i] = p[i] % q[i]
r[-1] = 0
print(sum(r))
Problem p03282 (python)

Fixed submission:
s = str(input())
k = int(input())
i, count = 0, 0
while (i < len(s)):
  if int(s[i]) == 1:
    if (count >= k - 1):
      print('1')
      break
    count += 1
  else:
    print(s[i])
    break
  i += 1

Buggy submission (verdict: Runtime Error):
s = str(input())
k = int(input())
if int(s[0]) == 1:
  print(s[1])
else:
  print(s[0])
Problem p03479 (python)

Fixed submission:
x, y = map(int, input().split())
a = x
i = 1
while (a <= y):
  a *= 2
  if a > y:
    break
  i += 1
print(i)

Buggy submission (verdict: Runtime Error):
x, y = map(int, input().split())
a = x
i = 0
al.append(a)
while (a < y):
  a *= 2
  i += 1
  if a >= y:
    break
print(i)
Problem p03160 (python)

Fixed submission:
N = int(input())
hList = list(map(int, input().split()))

dp = [0] * N
dp[1] = abs(hList[1] - hList[0])
for index in range(2, N):
    dp[index] = min(dp[index-1] + abs(hList[index] - hList[index-1]),
                    dp[index-2] + abs(hList[index] - hList[index-2]))
print(dp[-1])

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

if len(hList) == 1:
    print(hList[0])
    return

minimum = abs(hList[0] - hList[1])
for index in range(2, len(hList)):
    minimum = min(abs(hList[index] - hList[index-1]), abs(hList[index] - hList[index-2]))
print(minimum)
Problem p03162 (python)

Fixed submission:
N = int(input())
abcList = [list(map(int, input().split())) for i in range(N)]
dp = [abcList[0]]

if len(abcList) == 1:
    print(max(abcList[0][0], abcList[0][1], abcList[0][2]))
else:
    for i in range(1, N):
        dp.append([abcList[i][0] + max(dp[i - 1][1], dp[i - 1][2]),
                   abcList[i][1] + max(dp[i - 1][0], dp[i - 1][2]),
                   abcList[i][2] + max(dp[i - 1][0], dp[i - 1][1])])
    print(max(dp[-1]))

Buggy submission (verdict: Runtime Error):
def abcCalc(abc, dp):
    return [abc[0] + max(dp[1], dp[2]), abc[1] + max(dp[0], dp[2]), abc[2] + max(dp[0], dp[1])]

N = int(input())
abcList = [list(map(int, input().split())) for i in range(N)]
dp = [abcList[0]]

if len(abcList) == 1:
    print(max(abcList[0][0], abcList[0][1], abcList[0][2]))
    return

dp.append(abcCalc(abcList[1], dp[0]))

for i in range(2, N):
    dp.append(abcCalc(abcList[i], dp[i-1]))
print(max(dp[-1]))

Buggy submission (verdict: Runtime Error):
def abc(abc, dp):
    return [abc[0] + max(dp[1], dp[2]),
            abc[1] + max(dp[0], dp[2]),
            abc[2] + max(dp[0], dp[1])]

N = int(input())
abcList = [list(map(int, input().split())) for i in range(N)]
dp = [abcList[0]]

if len(abcList) == 1:
    print(max(abcList[0][0], abcList[0][1], abcList[0][2]))
    return

dp.append(abc(abcList[1], dp[0]))

for i in range(2, N):
    dp.append(abc(abcList[i], dp[i-1]))
print(max(dp[-1]))

Buggy submission (verdict: Runtime Error):
N = int(input())
abcList = [list(map(int, input().split())) for i in range(N)]
dp = [abcList[0]]

if len(abcList) == 1:
    print(max(abcList[0][0], abcList[0][1], abcList[0][2]))
    return

dp.append(abc(abcList[1], dp[0]))

for i in range(2, N):
    dp.append(abc(abcList[i], dp[i-1]))
print(max(dp[-1]))

Buggy submission (verdict: Runtime Error):
N = int(input())
abcList = [list(map(int, input().split())) for i in range(N)]
dp = [abcList[0]]

if len(abcList) == 1:
    print(max(abcList[0][0], abcList[0][1], abcList[0][2]))
    return

# dp=1
dp.append(abc(abcList[1], dp[0]))

for i in range(2, N):
    dp.append(abc(abcList[i], dp[i-1]))
print(max(dp[-1]))
Problem p03448 (python)

Fixed submission:
A = int(input())
B = int(input())
C = int(input())
X = int(input())

value = 0
for a in range(0, A+1):
    for b in range(0, B+1):
        for c in range(0, C+1):
            if 500*a + 100*b + 50*c == X:
                value += 1
print(value)

Buggy submission (verdict: Runtime Error):
A = int(input())
B = int(input())
C = int(input())
X = int(input())

value = 0
for a in range(0, A+1):
	for b in range(0, B+1):
        for c in range(0, C+1):
            if 500*a + 100*b + 50*c == X:
                value += 1
print(value)

Buggy submission (verdict: Runtime Error):
    A = int(input())
    B = int(input())
    C = int(input())
    X = int(input())

    value = 0
    for a in range(0, A+1):
        for b in range(0, B+1):
            for c in range(0, C+1):
                if 500*a + 100*b + 50*c == X:
                    value += 1
    print(value)
Problem p02628 (python)

Fixed submission:
I=lambda:list(map(int,input().split()))
n,k=I()
l=sorted(I())
print(sum(l[:k]))

Buggy submission (verdict: Runtime Error):
Iimport math as mt
import sys
I=lambda:list(map(int,input().split()))
n,k=I()
l=sorted(I())
print(sum(l[:k]))
Problem p02690 (python)

Fixed submission:
import bisect as bi
import collections as cc
I=lambda:list(map(int,input().split()))
x,=I()
ar=[]
i=1
fl=1

t=bi.bisect_left(ar,x)
for i in range(-1000,1000):
    for j in range(-1000,1000):
        if pow(i,5)-pow(j,5)==x:
            print(i,j)
            fl=0
            break
    if not fl:
        break

Buggy submission (verdict: Runtime Error):
import bisect as bi
import collections as cc
I=lambda:list(map(int,input().split()))
x,=I()
ar=[]
i=1

t=bi.bisect_left(ar,x)
for i in range(-100,100):
    for j in range(-100,100):
        if (i**5)-(j**5)==x:
            print(i,j)
            fl=0
            break
    if not fl:
        break