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

Fixed submission:
S = input()
if S[0]==S[1] or S[1]==S[2] or S[2]==S[3]:
    print('Bad')
else:
    print('Good')

Buggy submission (verdict: Runtime Error):
S = input()
if S[0]==S[1] or S[1]==S[2] or S[2]==S[3] or S[3]==S[4]:
    print('Bad')
else:
    print('Good')
Problem p03068 (python)

Fixed submission:
n = int(input())
s = str(input())
k = int(input())

s =list(s)

for i in range(n):
    if s[i] != s[k-1]:
        s[i] = '*'

print(''.join(s))

Buggy submission (verdict: Runtime Error):
n = int(input())
s = str(input())
k = int(input())

s =list(s)

for i in range(n):
    if s[i] != s[k]:
        s[i] = '*'

print(''.join(s))
Problem p03086 (python)

Fixed submission:
S = input()
listS = list(S)
N = []
dic = ['A', 'T', 'G', 'C']
count = 0
for i in range(len(listS)):
    if listS[i] in dic:
        count += 1
        N.append(count)
    else:
        count = 0
        N.append(count)
print(max(N))

Buggy submission (verdict: Runtime Error):
S = input()
listS = list(S)
N = []
dic = ['A', 'T', 'G', 'C']
count = 0
for i in range(len(listS)):
    if listS[i] in dic:
        count += 1
        N.append(count)
    else:
        count = 0

print(max(N))
Problem p03145 (python)

Fixed submission:
a,b,c = map(int,input().split())

print(int(a*b/2))

Buggy submission (verdict: Runtime Error):
ab,bc,ca = map(str,input().split())

print(ab*bc/2)
Problem p03264 (python)

Fixed submission:
k = int(input())

if k % 2 == 0:
    print(int((k/2)**2))
else:
    print(int((k-1)/2 * (k+1)/2))

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

print(int(k-1)/2**2))
Problem p03477 (python)

Fixed submission:
A, B, C, D = map(int, input().split())
if A+B < C+D :
    print('Right')
elif A+B == C+D:
    print('Balanced')
else:
    print('Left')

Buggy submission (verdict: Runtime Error):
L, R = map(int, input().split())
if L < R:
    print('Right')
elif L == R:
    print('Balanced')
else:
    print('Left')
Problem p03671 (python)

Fixed submission:
a, b, c = map(int, input().split())
print( a+b+c - max(a,b,c) )

Buggy submission (verdict: Runtime Error):
a, b, c = map(int, input().split())
print( sum(a,b,c) - max(a,b,c) )
Problem p03844 (python)

Fixed submission:
# ABC50_A

a, op, b = map(str,input().split())
if op == '+':
    print(int(a)+int(b))
else:
    print(int(a)-int(b))

Buggy submission (verdict: Runtime Error):
A, op, B = map(int, input().split())
if op == '+':
    print(A+B)
else:
    print(A-B)

Buggy submission (verdict: Runtime Error):
A, op, B = map(int, input().split())
if op == '+':
    print(A+B)
elif op == '-':
    print(A-B)
Problem p02830 (python)

Fixed submission:
n = input()
str = input()
sl = list(str.split(" ")[0])
tl = list(str.split(" ")[1])

for i in range(0,int(n)):
    print(sl[i],end="")
    print(tl[i],end="")

Buggy submission (verdict: Runtime Error):
n = input()
str = input()
sl = list(str.split(" ")[0])
tl = list(str.split(" ")[1])

for i in range(0,n-1):
    print(sl[i],end="")
    print(tl[i],end="")
Problem p02681 (python)

Fixed submission:
a = input()
b = input()

for i in range(len(a)):
  if a[i] != b[i]:
    print("No")
    break
  if i == len(a) - 1:
    print("Yes")

Buggy submission (verdict: Runtime Error):
a = input()
b = input()

for i in range(len(b)):
  if a[i] != b[i]:
    print("No")
    break
  if i == len(b) - 1:
    print("Yes")
Problem p02898 (python)

Fixed submission:
N,K = [int(i) for i in input().split()]
h = [int(i) for i in input().split()]
 
count = 0
for i in range(N):
  if h[i] >= K:
    count += 1
 
print(count)

Buggy submission (verdict: Runtime Error):
N,K = [int(i) for i input().split()]
h = [int(i) for i input().split()]

count = 0
for i in range(N):
  if h[i] >= K:
    count += 1

print(count)
Problem p03160 (python)

Fixed submission:
N = int(input())
h = [int(i) for i in input().split()]
DP = [0]
DP.append(abs(h[0] - h[1]))

for i in range(2,len(h)):
    if DP[i-1] + abs(h[i-1] - h[i]) > DP[i-2] + abs(h[i-2] - h[i]):
        DP.append(DP[i-2] + abs(h[i-2] - h[i]))
    else:
        DP.append(DP[i-1] + abs(h[i-1] - h[i]))

print(DP[N-1])

Buggy submission (verdict: Runtime Error):
N = int(input())
h = [int(i) for i in input().split()]
DP = [0]
DP.append(abs(h[0] - h[1]))

for i in range(2,len(h)):
    if DP[i-1] + abs(h[i-1] - h[i]) > DP[i-2] + abs(h[i-2] - h[i]):
        DP.append(DP[i-2] + abs(h[i-2] - h[i]))
    else:
        DP.append(DP[i-1] + abs(h[i-1] - h[i]))

print(DP[len(N)-1])
Problem p03695 (python)

Fixed submission:
N = int(input())
a = [int(i) for i in input().split()]
list = {}
list[8] = 0

for i in a:
    if 1 <= i <= 399:
        list[0] = 1
    elif 400 <= i <= 799:
        list[1] = 1
    elif 800 <= i <= 1199:
        list[2] = 1
    elif 1200 <= i <= 1599:
        list[3] = 1
    elif 1600 <= i <= 1999:
        list[4] = 1
    elif 2000 <= i <= 2399:
        list[5] = 1
    elif 2400 <= i <= 2799:
        list[6] = 1
    elif 2800 <= i <= 3199:
        list[7] = 1
    else:
        list[8] += 1

if len(list) == 1:
    min = 1
else:
    min = len(list) - 1

if list[8] > 0:
    max = len(list) + list[8] - 1
else:
    max = len(list) - 1

print(min,max)

Buggy submission (verdict: Runtime Error):
N = int(input())
a = [int(i) for i in input().split()]
list = {}


for i in a:
    if 1 <= i <= 399:
        list[0] = 1
    elif 400 <= i <= 799:
        list[1] = 1
    elif 800 <= i <= 1199:
        list[2] = 1
    elif 1200 <= i <= 1599:
        list[3] = 1
    elif 1600 <= i <= 1999:
        list[4] = 1
    elif 2000 <= i <= 2399:
        list[5] = 1
    elif 2400 <= i <= 2799:
        list[6] = 1
    elif 2800 <= i <= 3199:
        list[7] = 1
    else:
        list[8] += 1

min = len(list)


if list[8] > 0:
    max = len(list) + chin
else:
    max = len(list)

print(min,max)
Problem p03699 (python)

Fixed submission:
N = int(input())
chin = []
sum = 0

for i in range(N):

    x = int(input())
    sum += x

    if x % 10 != 0:
        chin.append(x)

chin.sort()
i = 0

while chin != [] and i < len(chin) and sum % 10 == 0:
    sum -= chin[i]
    i += 1

if sum % 10 == 0:
    print(0)
else:
    print(sum)

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


for i in range(N):
    x = int(input())
    score.append(x)

pai = sum(score)
score.sort()

i = 0

while pai % 10 == 0:
    pai -= score[i]
    i += 1

print(pai)
Problem p03713 (python)

Fixed submission:
H,W = [int(i) for i in input().split()]
ans = H * W

for x in range(1,W):
    y1 = H // 2
    Sa1 = H * x
    Sb1 = (W - x) * y1
    Sc1 = (W - x) * (H - y1)
    M = max(Sa1,Sb1,Sc1)
    m = min(Sa1,Sb1,Sc1)

    y2 = (W - x) // 2
    Sa2 = H * x
    Sb2 = H * y2
    Sc2 = H * (W - x - y2)
    M2 = max(Sa2,Sb2,Sc2)
    m2 = min(Sa2,Sb2,Sc2)

    if ans > min(M-m,M2-m2):
        ans = min(M-m,M2-m2)

H,W = W,H
for x in range(1,W):
    y = H // 2
    Sa1 = H * x
    Sb1 = (W - x) * y
    Sc1 = (W - x) * (H - y)
    M = max(Sa1,Sb1,Sc1)
    m = min(Sa1,Sb1,Sc1)

    y2 = (W - x) // 2
    Sa2 = H * x
    Sb2 = H * y2
    Sc2 = H * (W - x - y2)
    M2 = max(Sa2,Sb2,Sc2)
    m2 = min(Sa2,Sb2,Sc2)

    if ans > min(M-m,M2-m2):
        ans = min(M-m,M2-m2)

print(ans)

Buggy submission (verdict: Runtime Error):
def answer(H,W,ans):
    for x in range(1,W):
        y1 = H // 2
        Sa1 = H * x
        Sb1 = (W - x) * y1
        Sc1 = (W - x) * (H - y1)
        M = max(Sa1,Sb1,Sc1)
        m = min(Sa1,Sb1,Sc1)

        y2 = (W - x) // 2
        Sa2 = H * x
        Sb2 = H * y2
        Sc2 = H * (W - x - y2)
        M2 = max(Sa2,Sb2,Sc2)
        m2 = min(Sa2,Sb2,Sc2)

        if ans > min(M-m,M2-m2):
            ans = min(M-m,M2-m2)

        return ans

if __name__ == '__main__':
    H,W = [int(i) for i in input().split()]
    ans = H * W
    ans = answer(H,W)
    
    H,W = W,H

    if answer(H,W) < ans:
        ans = answer(H,W)

    print(ans)

Buggy submission (verdict: Runtime Error):
H,W = [int(i) for i in input().split()]
ans = 0

for x in range(1,W):
    y = H // 2
    Sa1 = H * x
    Sb1 = (W - x) * y
    Sc1 = (W - x) * (H - y)
    M = max(Sa1,Sb1,Sc1)
    m = min(Sa1,Sb1,Sc1)

    Sa2 = H * x
    Sb2 = H * y
    Sb2 = H * (W - x - y)
    M2 = max(Sa2,Sb2,Sc2)
    m2 = min(Sa2,Sb2,Sc2)

    if ans > min(M-m,M2-m2):
        ans = min(M-m,M2-m2)

print(ans)
Problem p03773 (python)

Fixed submission:
A,B = [int(i) for i in input().split()]
if A + B >= 24:
  print(A + B -24)
else:
  print(A+B)

Buggy submission (verdict: Runtime Error):
A,B = [for(i) for i in input().split()]
if A + B > 24:
  print(A + B -24)
else:
  print(A+B)
Problem p03778 (python)

Fixed submission:
W,a,b = [int(i) for i in input().split()]
if a <= b and b <= a + W:
  print(0)
else:
  print(abs(a-b)-W)

Buggy submission (verdict: Runtime Error):
W,a,b = [int(i) for i input().split()]
if a <= b and b <= a + W:
  print(0)
else:
  print(min(b+W-a,b-a-W))
Problem p03796 (python)

Fixed submission:
N = int(input())
ans = 1
for i in range(2,N+1):
  ans = ans * i % (10 ** 9 + 7)

print(ans)

Buggy submission (verdict: Runtime Error):
N = int(input())
ans = 1
for i in range(2,i+1):
  ans = ans * i % (10 ** 9 + 7)

print(ans)

Buggy submission (verdict: Runtime Error):
N = int(input())
def per(N):
    if N == 0 or N == 1:
        return 1
    else:
        return N * per(N-1)

print(per(N) % (10 ** 9 + 7))

Buggy submission (verdict: Runtime Error):
N = int(input())
def per(N):
  return N * per(N-1)

print(per(N) / (10 ** 9 + 7))
Problem p03797 (python)

Fixed submission:
N,M = [int(i) for i in input().split()]
count = 0
if 2 * N <= M:
    count = N + (M - 2 * N) // 4
else:
    count = M // 2

print(count)

Buggy submission (verdict: Runtime Error):
N,M = [int(i) for i in input().split()]
count = 0
if 2 * N <= M:
    count = N
    M -= 2 * N
    if M >= 4:
        count += M // 4
        print(count)
    else:
        print(count)
else:
    if N != 0:
        while N == 0 or M <= 1:
            count += 1
            N -= 1
            M - = 2
        print(count)
    else:
        print(count)

Buggy submission (verdict: Runtime Error):
N,M = [int(i) for i in input().split()]
count = 0
if 2 * N <= M:
    count = N
    M -= 2 * N
    if M >= 4:
        count += M // 4
        print(count)
    else:
        print(count)
else:
    if N != 0:
        while N == 0 or M <= 1:
            count += 1
            N -= 1
            M - = 2
        print(count)
    else:
        print(count)
Problem p03944 (python)

Fixed submission:
W,H,N = [int(i) for i in input().split()]
A = [list(map(int, input().split())) for i in range(N)]

x1,y1 = 0,0
x2 = W
y2 = H

for i in range(N):
    if A[i][2] == 1:
        if x1 < A[i][0]:
            x1 = A[i][0]
    elif A[i][2] == 2:
        if x2 > A[i][0]:
            x2 = A[i][0]
    elif A[i][2] == 3:
        if y1 < A[i][1]:
            y1 = A[i][1]
    elif A[i][2] == 4:
        if y2 > A[i][1]:
            y2 = A[i][1]

if (x2-x1) > 0 and (y2-y1) > 0:
    print((x2-x1)*(y2-y1))
else:
    print(0)

Buggy submission (verdict: Runtime Error):
xmax,ymax,N = [int(i) for i in input().split()]
x,y,a = list(map(int,input().split()))
xmin = 0
ymin = 0

for i in range(N):
    if a[i] == 1:
        if xmin < x[i]:
            xmin = x[i]
    elif a[i] == 2:
        if xmax > x[i]:
            xmax = x[i]
    elif a[i] == 3:
        if ymin < y[i]:
            ymin = y[i]
    elif a[i] == 4:
        if ymax > y[i]:
            ymax = y[i]

if ymax > ymin and xmax > xmin:
    print((ymax - ymin)*(xmax - xmin))
else:
    print(0)
Problem p03962 (python)

Fixed submission:
a = [int(i) for i in input().split()]
print(len(set(a)))

Buggy submission (verdict: Runtime Error):
a = [int(i) for i in input().split()]
print(len(set(a))
Problem p03998 (python)

Fixed submission:
from collections import deque
A = deque(list(input()+'A'))
B = deque(list(input()+'B'))
C = deque(list(input()+'C'))

x = A.popleft()
while(True):
    if x == 'a':
        x = A.popleft()
    elif x == 'b':
        x = B.popleft()
    elif x == 'c':
        x = C.popleft()
    else:
        break

print(x)

Buggy submission (verdict: Runtime Error):
A = str(input())
B = str(input())
C = str(input())
na = int()
nb = int()
nc = int()
n = 'a'

while na < len(A)+1 and nb < len(B)+1 and nc < len(C)+1:
    if n == 'a':
        if A[na] == 'a':
            na += 1
            n = 'a'
        elif A[na] == 'b':
            na += 1
            n = 'b'
        elif A[na] == 'c':
            na += 1
            n = 'c'
    if n == 'b':
        if B[nb] == 'a':
            nb += 1
            n = 'a'
        elif B[nb] == 'b':
            nb += 1
            n = 'b'
        elif B[nb] == 'c':
            nb += 1
            n = 'c'
    if n == 'c':
        if C[nc] == 'a':
            nc += 1
            n = 'a'
        elif C[nc] == 'b':
            nc += 1
            n = 'b'
        elif C[nc] == 'c':
            nc += 1
            n = 'c'

print(n)

Buggy submission (verdict: Runtime Error):
A = str(input())
B = str(input())
C = str(input())
na = int()
nb = int()
nc = int()
n = 'a'

while na < len(A)+1 and nb < len(B)+1 and nc < len(C)+1:
    if n == 'a':
        if A[na] == 'a':
            na += 1
            n = 'a'
        elif A[na] == 'b':
            nb += 1
            n = 'b'
        elif A[na] == 'c':
            nc += 1
            n = 'c'
    if n == 'b':
        if A[nb] == 'a':
            na += 1
            n = 'a'
        elif A[nb] == 'b':
            nb += 1
            n = 'b'
        elif A[nb] == 'c':
            nc += 1
            n = 'c'
    if n == 'c':
        if A[nc] == 'a':
            na += 1
            n = 'a'
        elif A[nc] == 'b':
            nb += 1
            n = 'b'
        elif A[nc] == 'c':
            nc += 1
            n = 'c'

print(n)
Problem p04043 (python)

Fixed submission:
A,B,C = [int(i) for i in input().split()]
list = [A,B,C]
go = 0
nana = 0
for i in list:
  if i == 5:
    go += 1
  if i == 7:
    nana += 1

if go == 2 and nana == 1:
  print("YES")
else:
  print("NO")

Buggy submission (verdict: Runtime Error):
N,K = [int(i) for i in input().split()]
#D = [int(i) for i in input().split()]は数値代入
#文字列を複数代入
D = input().split()
#集合に置き換える(型はset)
D = set(D)
use = set(['0','1','2','3','4','5','6','7','8','9'])
use -= D

for i in range(N,10001):
    if use >= set(str(i)):
        print(i)
        break

Buggy submission (verdict: Runtime Error):
A,B,C = [int(i) for i in input().split()]
list = [A,B,C]

for i in list:
  if i == 5:
    go += 1
  if i == 7:
    nana += 1

if go == 2 and nana == 1:
  print("YES")
else:
  print("NO")
Problem p02761 (python)

Fixed submission:
N, M = map(int, input().split())
num_list = [0]*N

flag=True

for _ in range(M):
  s, c = map(int, input().split())

  if (s == 1 and c == 0 and N != 1):
    print(-1)
    flag=False
    break

  if (num_list[s-1] == 0):
    num_list[s-1] = c
  else:
    if num_list[s-1] != c:
      print(-1)
      flag=False
      break

if flag:
  if num_list[0] == 0 and N != 1:
    num_list[0] = 1

  ans = ""
  for i in num_list:
    ans += str(i)

  print(ans)

Buggy submission (verdict: Runtime Error):
A_list = []

def my_index(l, x, default=False):
    if x in l:
        return l.index(x)
    else:
        return default

for i in range(3):
  a, b, c = map(int, input().split())
  A_list.append(a)
  A_list.append(b)
  A_list.append(c)

N = int(input())
flag=True

for i in range(N):
  num = int(input())

  tmp = my_index(A_list, num)
  if tmp != False or tmp == 0:
    A_list[tmp] = -1
  
  if ((A_list[0] == A_list[3]) and (A_list[0] == A_list[6]) and (A_list[3] == A_list[6])) or ((A_list[1] == A_list[4]) and (A_list[1] == A_list[7]) and (A_list[4] == A_list[7])) or ((A_list[2] == A_list[5]) and (A_list[2] == A_list[8]) and (A_list[5] == A_list[8])) or ((A_list[0] == A_list[4]) and (A_list[0] == A_list[8]) and (A_list[4] == A_list[8])) or ((A_list[2] == A_list[4]) and (A_list[2] == A_list[6]) and (A_list[4] == A_list[6])) or ((A_list[0] == A_list[1]) and (A_list[0] == A_list[2]) and (A_list[1] == A_list[2])) or ((A_list[3] == A_list[4]) and (A_list[3] == A_list[5]) and (A_list[4] == A_list[5])) or ((A_list[6] == A_list[7]) and (A_list[6] == A_list[8]) and (A_list[7] == A_list[8])):
    print("Yes")
    flag=False
    break

if flag:
  print("No")
Problem p02780 (python)

Fixed submission:
N, K = input().split(" ")
N, K = int(N), int(K)
p_list = [int(i) for i in input().split(" ")]

for i in range(0, N):
  if i+K > N:
    break

  if i == 0:
    max_sum = sum(p_list[0:K])
    now_sum = max_sum
  else:
    now_sum += (p_list[i-1+K] - p_list[i-1])
    if max_sum < now_sum:
      max_sum = now_sum

print((max_sum + K)/2)

Buggy submission (verdict: Runtime Error):
N, K = input().split(" ")
N, K = int(N), int(K)
p_list = [int(i) for i in input().split(" ")]

for i in range(0, N):
  if (i+K > N) or (p_list[i-1] >= p_list[i-1+K]):
    break

  if i == 0:
    max_sum = sum(p_list[0:K])+K
  else:
    tmp = sum(p_list[i:i+K])+K
    if max_sum < tmp:
      max_sum = tmp

print(max_sum/2)
Problem p02983 (python)

Fixed submission:
L, R = [int(i) for i in input().split(" ")]

flag=True
if (R - L) >= 2019:
  flag=False
  print(0)
else:
  min_mod = 2019
  for i in range(L, R):
    for j in range(i+1, R+1):
      tmp = (i*j) % 2019
      if tmp == 0:
        print(0)
        flag=False
        break
      elif tmp < min_mod:
        min_mod = tmp
    if flag==False:
      break

if flag==True:
  print(min_mod)

Buggy submission (verdict: Runtime Error):
L, R = [int(i) for i in input().split(" ")]

flag=True
if (R - L) >= 2019:
  print(0)
else:
  min_mod = 2019
  for i in range(L, R):
    for j in range(i+1, R+1):
      tmp = (i*j) % 2019
      if tmp == 0:
        print(0)
        flag=False
        break
      elif tmp < min_mod:
        min_mod = tmp
    if flag==False:
      break

if flag==True:
  print(min_mod)

Buggy submission (verdict: Runtime Error):
L, R = [int(i) for i in input().split(" ")]

flag=True
if (R - L) >= 2019:
  print(0)
else:
  min_mod = 2019
  for i in range(L, R):
    for j in range(i+1, R+1):
      tmp = (i*j) % 2019
      if tmp == 0:
        print(0)
        flag=False
        break
      elif tmp < min_mod:
        min_mod = tmp
    if flag==False:
      break

if (flag):
  print(min_mod)

Buggy submission (verdict: Runtime Error):
L, R = [int(i) for i in input().split(" ")]

flag=True
if (R - L) >= 2019:
  print(0)
else:
  min_mod = 2020
  for i in range(L, R):
    for j in range(i+1, R+1):
      tmp = (i*j) % 2019
      if tmp == 0:
        print(0)
        flag=False
        break
      elif tmp < min_mod:
        min_mod = tmp

if (flag):
  print(min_mod)
Problem p02716 (python)

Fixed submission:
from math import gcd

############ ---- USER DEFINED INPUT FUNCTIONS ---- ############
def inp():
    return(int(input().rstrip()))
def inlt():
    return(list(map(int,input().rstrip().split())))
def insr():
    s = input().rstrip()
    return(s[:len(s) - 1])
def invr():
    return(map(int,input().rstrip().split()))
################################################################
n = inp()
nums = [0] + inlt()
dp = [0 for i in range(n + 1)]
s = [0 for i in range(n + 1)]
s[1] = nums[1]
for i in range(3,n,2):
    s[i] = s[i - 2] + nums[i]
if n == 1:
    print(nums[0])
elif n == 2:
    print(max(nums[1],nums[2]))
elif n == 3:
    print(max(nums[3],nums[1],nums[2]))
elif n == 4:
    print(max(nums[1] + nums[3],nums[1] + nums[4],nums[2] + nums[4]))
else:
    dp[1] = nums[1]
    dp[2] = max(nums[1],nums[2])
    dp[3] = max(nums[3],nums[1],nums[2])
    dp[4] = max(nums[1] + nums[3],nums[1] + nums[4],nums[2] + nums[4])
    for i in range(5,n + 1):
        if i % 2 == 0:
            dp[i] = max(dp[i - 2] + nums[i], s[i - 1]) #if n % 2 == 0 take sum else dp[i - 1]
        else:
            dp[i] = max(dp[i - 2] + nums[i], dp[i - 1])
    print(dp[n])
#print('No')
#print()

Buggy submission (verdict: Runtime Error):
from math import gcd

############ ---- USER DEFINED INPUT FUNCTIONS ---- ############
def inp():
    return(int(input().rstrip()))
def inlt():
    return(list(map(int,input().rstrip().split())))
def insr():
    s = input().rstrip()
    return(s[:len(s) - 1])
def invr():
    return(map(int,input().rstrip().split()))
################################################################
n = inp()
nums = [0] + inlt()
dp = [0 for i in range(n + 1)]
s = [0 for i in range(n + 1)]
s[1] = nums[1]
for i in range(3,n,2):
    s[i] = s[i - 2] + nums[i]
if n == 1:
    print(nums[0])
elif n == 2:
    print(max(nums[1],nums[2]))
elif n == 3:
    print(max(nums[3],nums[1],nums[2]))
elif n == 4:
    print(max(nums[1] + nums[3],nums[1] + nums[4],nums[2] + nums[4]))
else:
    dp[1] = nums[1]
    dp[2] = max(nums[1],nums[2])
    dp[3] = max(nums[3],nums[1],nums[2])
    dp[4] = max(nums[1] + nums[3],nums[1] + nums[4],nums[2] + nums[4])
    for i in range(5,n + 1):
        if i % 2 == 0:
            dp[i] = max(dp[i - 2] + nums[i], s[i - 1]) #if n % 2 == 0 take sum else dp[i - 1]
        else:
            dp[i] = max(dp[i - 2] + nums[i], dp[i - 1])
    print(dp[n])
#print('No')
#print()
Problem p02724 (python)

Fixed submission:


############ ---- USER DEFINED INPUT FUNCTIONS ---- ############
def inp():
    return(int(input().rstrip()))
def inlt():
    return(list(map(int,input().rstrip().split())))
def insr():
    s = input().rstrip()
    return(s[:len(s) - 1])
def invr():
    return(map(int,input().rstrip().split()))
################################################################
n = inp()
remain = n - (n//500)*500

print((n//500)*1000 + 5*(remain//5))
#print()

Buggy submission (verdict: Runtime Error):
import sys,bisect
from math import gcd
input = sys.stdin.readline

############ ---- USER DEFINED INPUT FUNCTIONS ---- ############
def inp():
    return(int(input().rstrip()))
def inlt():
    return(list(map(int,input().rstrip().split())))
def insr():
    s = input().rstrip()
    return(s[:len(s) - 1])
def invr():
    return(map(int,input().rstrip().split()))
################################################################
n = inp()
remain = n - (n//500)*500

print((n//500)*1000 + 5*(remain//5))
#print()
Problem p02983 (python)

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

if r - l >= 2018:
    print(0)

else:
    array = range(l, r + 1, 1)
    kouho = 2018
    for i in array:
        for j in array:
            if i != j:
                mod = (i * j) % 2019
                if kouho > mod:
                    kouho = mod

    print(kouho)

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

if r - l >= 2018:
    print(0)

else:
    array = range(l, r + 1, 1)
    kouho = 2018
    for i in array:
        for j in array:
            if i != j:
                mod = (i * j) % 2019
                if kouho > mod:
                    kouho = mod

print(kouho)
Problem p02995 (python)

Fixed submission:
import fractions

abcd = list(map(int, input().split()))
a = abcd[0]
b = abcd[1]
c = abcd[2]
d = abcd[3]

aa = a - 1
lcm = (c * d) // fractions.gcd(c, d)

a_count = aa - (aa // c) - (aa // d) + (aa // lcm)
b_count = b - (b // c) - (b // d) + (b // lcm)

print(b_count - a_count)

Buggy submission (verdict: Runtime Error):
import fractions

abcd = list(map(int, input().split()))
a = abcd[0]
b = abcd[1]
c = abcd[2]
d = abcd[3]

aa = a - 1
lcm = (c * d) // fractinos.gcd(c, d)

a_count = aa - (aa // c) - (aa // d) + (aa // lcm)
b_count = b - (b // c) - (b // d) + (b // lcm)

print(b_count - a_count)
Problem p03000 (python)

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

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

goukei = 0
for i in range(n + 1):
    if goukei > x:
        print(i)
        break
    if i == n:
        print(n + 1)
        break
    goukei = goukei + l[i]

Buggy submission (verdict: Runtime Error):
nx = list(map(int, list(input().split())))
n = nx[0]
x = nx[1]

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

goukei = 0
for i in range(n + 1):
    if goukei > x:
        break
    goukei = goukei + l[i]

print(i)