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

Fixed submission:
n = int(input())
a = list(map(int, input().split()))

b = []
if n % 2 == 0:
    for i in reversed(range(1, n, 2)):
        b.append(str(a[i]))
    for i in range(0, n, 2):
        b.append(str(a[i]))
else:
    for i in reversed(range(0, n + 1, 2)):
        b.append(str(a[i]))
    for i in range(1, n, 2):
        b.append(str(a[i]))

ans = ' '.join(b)
print(ans)

Buggy submission (verdict: Runtime Error):
from operator import mul
from functools import reduce

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

def com(n, k):
    if n == 0 or k == 0:
        return 1
    return int(reduce(mul, range(n + 1 - k, n + 1)) / reduce(mul, range(1, k + 1)))

idx_list = [-1] * (n + 2)
l = 0
r = 0
for i, a_i in enumerate(a):
    if idx_list[a_i] < 0:
        idx_list[a_i] = i
    else:
        l = idx_list[a_i]
        r = n - i
        break

for k in range(1, n + 2):
    m = k - 1
    dup = 0
    for l_n in range(0, m + 1):
        r_n = m - l_n
        if l_n > l or r_n > r:
            continue
        l_c = com(l, l_n)
        r_c = com(r, r_n)
        dup += l_c * r_c
    ans = (com(n + 1, k) - dup) % (10 ** 9 + 7)
    print(ans)
Problem p03714 (python)

Fixed submission:
from heapq import heappush, heappushpop

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

a_list_1 = []
a_list_2 = []
for i in a[0:N]:
    heappush(a_list_1, i)
for i in list(reversed(a))[0:N]:
    heappush(a_list_2, -i)

sum_1 = sum(a_list_1)
sum_2 = sum(a_list_2)
sum_arr_1 = [0] * (N + 1)
sum_arr_1[0] = sum_1
sum_arr_2 = [0] * (N + 1)
sum_arr_2[-1] = sum_2
for k in range(N, 2 * N):
    l = heappushpop(a_list_1, a[k])
    sum_1 += a[k] - l
    sum_arr_1[k - N + 1] = sum_1

for k in reversed(range(N, 2 * N)):
    l = heappushpop(a_list_2, -a[k])
    sum_2 += -a[k] - l
    sum_arr_2[k - N] = sum_2

max_score = float('-inf')
for s1, s2 in zip(sum_arr_1, sum_arr_2):
    score = s1 + s2
    if score > max_score:
        max_score = score

print(max_score)

Buggy submission (verdict: Runtime Error):
import heapq

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

max_score = float('-inf')
for i in range(N, 2 * N + 1):
    rm_count_1 = i - N
    rm_count_2 = N - rm_count_1
    a_list_1 = []
    a_list_2 = []
    for k in a[0:i]:
        if len(a_list_1) >= N:
            heappushpop(a_list_1, k)
        else:
            heappush(a_list_1, k)
    for k in a[i:3*N]:
        if len(a_list_2) >= N:
            heappushpop(a_list_2, -k)
        else:
            heappush(a_list_2, -k)
    sum_1 = sum(a_list_1)
    sum_2 = sum(a_list_2)
    score = sum_1 + sum_2
    if score > max_score:
        max_score = score

print(max_score)

Buggy submission (verdict: Runtime Error):
from collections import heapq

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

max_score = float('-inf')
for i in range(N, 2 * N + 1):
    rm_count_1 = i - N
    rm_count_2 = N - rm_count_1
    a_list_1 = []
    a_list_2 = []
    for k in a[0:i]:
        if len(a_list_1) >= N:
            heappushpop(a_list_1, k)
        else:
            heappush(a_list_1, k)
    for k in a[i:3*N]:
        if len(a_list_2) >= N:
            heappushpop(a_list_2, -k)
        else:
            heappush(a_list_2, -k)
    sum_1 = sum(a_list_1)
    sum_2 = sum(a_list_2)
    score = sum_1 + sum_2
    if score > max_score:
        max_score = score

print(max_score)
Problem p03719 (python)

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

if C >= A and C <= B:
    print('Yes')
else:
    print('No')

Buggy submission (verdict: Runtime Error):
import sys
sys.setrecursionlimit(100000)

def set_enable_goal(cur_node, back_paths, enable_goal):
    if cur_node in back_paths:
        for next_node in back_paths[cur_node]:
            if enable_goal[next_node - 1] == 0:
                enable_goal[next_node - 1] = 1
                set_enable_goal(next_node, back_paths, enable_goal)


N, M = map(int, input().split())
MIN = float('-inf')
INF_LIMIT = -MIN

back_paths = {}
all_paths = {}
for i in range(M):
    a, b, c = map(int, input().split())
    if a in all_paths:
        all_paths[a].append((b, c))
    else:
        all_paths[a] = [(b, c)]

    if b in back_paths:
        back_paths[b].append(a)
    else:
        back_paths[b] = [a]


# path cut
enable_goal= [0 for i in range(N)]
enable_goal[N - 1] = 1
set_enable_goal(N, back_paths, enable_goal)

for a, paths in all_paths.items():
    if not enable_goal[a - 1]:
        all_paths[a] = []
    else:
        valid_paths = []
        for b, c in paths:
            if enable_goal[b - 1]:
                valid_paths.append((b, c))
        all_paths[a] = valid_paths


scores = [MIN for i in range(N)]
scores[0] = 0

is_inf = False
for n in range(N):
    for a in range(1, M + 1):
        if a in all_paths:
            for b, c in all_paths[a]:
                scores[b - 1] = max(scores[b - 1], scores[a - 1] + c)

# loop check
if not is_inf:
    prev_score = scores[N - 1]
    for a in range(1, M + 1):
        if a in all_paths:
            for b, c in all_paths[a]:
                scores[b - 1] = max(scores[b - 1], scores[a - 1] + c)
    if prev_score != scores[N - 1]:
        is_inf = True


if is_inf:
    print('inf')
else:
    print(scores[N - 1])
Problem p02969 (python)

Fixed submission:
r = int(input())

print(3*r**2)

Buggy submission (verdict: Runtime Error):
r = input()
print(3*r**2)
Problem p02971 (python)

Fixed submission:
n = int(input())
a = [int(input()) for i in range(n)]

a_max = max(a)
idx = [i for i, x in enumerate(a) if x==a_max]

if len(idx) > 1:
    for i in range(n):
        print(a_max)
else:
    for i in range(n):
        if a[i] == a_max:
            print(max(a[0:i]+a[i+1:]))
        else:
            print(a_max)

Buggy submission (verdict: Runtime Error):
n = int(input())
a = [int(input()) for i in range(n)]

r = [max([*a[0:i],*a[i+1:]]) for i in range(n)]

for answer in r:
     print(answer)

Buggy submission (verdict: Runtime Error):
n = int(input())
a = [int(input()) for i in range(n)]

r = [max([*a[0:i],*a[i+1:]]) for i in range(n)]

for answer in r:
     print(answer)
Problem p02996 (python)

Fixed submission:
from operator import itemgetter

n = int(input())
jobs = [list(map(int, input().split())) for i in range(n)]

jobs.sort(key=itemgetter(1))

flg = True
sum = 0
for a, b in jobs:
    sum += a
    if sum > b:
        flg = False
        break

if flg:
    print('Yes')
else:
    print('No')

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

n = int(input())
jobs = [list(map(int, input().split())) for i in range(n)]

jobs.sort(key=lambda x:x[1])

flg = True

a = np.array(jobs)[:,0]
b = np.array(jobs)[:,1]

sum = np.add.accumulate(a)
if sum(sum > b):
    print('No')
else:
    print('Yes')
Problem p02971 (python)

Fixed submission:
n = input()
n = int(n)

li = [int(input()) for i in range(n)]
m = max(li)
m2 = sorted(li)[-2]

for j in range(n):
  if m == li[j]:
    print(m2)
  else:
    print(m)

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

li = [int(input()) for i in range(n)]
m = max(li)
for j in range(n):
  if m < li[j]:
    print(m)
  else:
    buf=li.pop(j)
    print(max(li))

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

    li = [int(input()) for i in range(n)]
    m = max(li)
    for j in range(n):
      if m < li[j]:
        print(m)
      else:
        print(max(li))
Problem p03061 (python)

Fixed submission:
def gcd(x, y):
    if x >= y:
        while y != 0:
            x, y = y, x % y
        return x
    else:
        while x != 0:
            y, x = x, y % x
        return y

N = int(input())
A = list(map(int, input().split()))
L = [0, 0]
for ai in A:
    L.append(gcd(L[-1], ai))
 
R = [0, 0]
for ai in A[::-1]:
    R.append(gcd(R[-1], ai))
 
print(max(gcd(l, r) for l, r in zip(L, reversed(R))))

Buggy submission (verdict: Runtime Error):
from functools import reduce

def gcd_base(x, y):
    if x >= y:
        while y != 0:
            x, y = y, x % y
        return x
    else:
        while x != 0:
            y, x = x, y % x
        return y

def gcd(numbers):
    return reduce(gcd_base, numbers)

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

for i in range(N):
    GCD.append(gcd(A[:i]))
    A.append(a)

print(max(GCD))
Problem p02995 (python)

Fixed submission:
import math
from fractions import gcd

def count(n, A, B):
    n_upper = B // n
    n_lower = (A-1) // n
    n_count = n_upper - n_lower
    return n_count

def main():
    A, B, C ,D  = list(map(int, input().split(" ")))
    C_count = count(C, A, B)
    D_count = count(D, A, B)
    s = (C * D) // gcd(C, D)
    CD_count = count(s, A ,B)
    fcount = (B - A + 1) - (C_count + D_count - CD_count)
    print(fcount)

if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
import math

def count(n, A, B):
    n_upper = int(B/n)
    n_lower = int(A/n + 1)
    n_count = n_upper - n_lower + 1
    return n_count

def main():
    A, B, C ,D  = list(map(int, input().split(" ")))
    C_count = count(C, A, B)
    D_count = count(D, A, B)
    s = int((C / math.gcd(C, D)) * D)
    CD_count = count(s, A ,B)
    fcount = (B - A + 1) - (C_count + D_count - CD_count)
    print(fcount)

if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
import math

def count(n, A, B):
    n_upper = int(B/n)
    n_lower = int(A/n + 1)
    n_count = n_upper - n_lower + 1
    return n_count

def main():
    A, B, C ,D  = list(map(int, input().split(" ")))
    C_count = count(C, A, B)
    D_count = count(D, A, B)
    s = (C / math.gcd(C, D)) * D
    CD_count = count(s, A ,B)
    fcount = (B - A + 1) - (C_count + D_count - CD_count)
    print(fcount)

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

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

train = n*a
taxi = b
print(min(train,taxi))

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

vlist = []
mini = 2019
xlist = []

for x in range(gap+1):
    v = (l+x) % 2019
    vlist.append(v)

mini = min(vlist)
for x in vlist:
    if v <= mini+1:
        xlist.append(x)
        

xlist.sort()
#print(vlist)

#res = i*j % 2019
print((vlist[0]*vlist[1])%2019)
Problem p02983 (python)

Fixed submission:
l,r = map(int, input().split())
gap = r-l
 
vlist = []
mini = 2019
 
for x in range(gap+1):
    v = (l+x) % 2019
    vlist.append(v)
    if v == 0:
        print(0)
        exit()
 
vlist.sort()

mini = 2019

for i in vlist:
    for j in vlist:
        if i==j:
            pass
        else:
            temp = (i*j) %2019
            mini = min(temp, mini)
            if mini == 0:
                print(0)
                exit()

print(mini)
    
#print((vlist[0]*vlist[1])%2019)
#print((vlist[0]*vlist[1])%2019)

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

vlist = []
mini = 2019
xlist = []

for x in range(gap+1):
    v = (l+x) % 2019
    vlist.append(v)

mini = min(vlist)
for x in vlist:
    if v <= mini+1:
        xlist.append(x)
        

xlist.sort()
#print(vlist)

#res = i*j % 2019
print((xlist[0]*xlist[1])%2019)

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

vlist = []

    v = (l+x) % 2019
    vlist.append(v)

vlist.sort()
#print(vlist)

#res = i*j % 2019
print(vlist[0]*vlist[1])

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

vlist = []

    v = (l+x) % 2019
    vlist.append(v)

vlist.sort()
print(vlist)

#res = i*j % 2019
print(vlist[0]*vlist[1])
Problem p03035 (python)

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

if A >= 13:
    print(B)
elif 13 > A >= 6:
    print(int(B/2))
else:
    print(0)

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

A, B = map(int, input().split())

for i in range(M-1):
    A2, B2 = map(int, input().split())

    if (A < A2 and B2 < A) or (B < A2 and B< B2):
        A = 0
        B = 0
    if (A2 <= A and B <= B2):
        pass
    elif (A2 <= A and A <= B):
        B = B2

    elif (A2 <= B and B <= B2):
        A = A2
    else:
        A = A2
        B = B2


if (B-A) <= 0:
  print(0)
else:
  print(B-A+1)
Problem p03059 (python)

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

print((t//a)*b)

Buggy submission (verdict: Runtime Error):
import fractions
from functools import reduce
import copy

def gcd(*numbers):
    return reduce(fractions.gcd, numbers)

def gcd_list(numbers):
    return reduce(fractions.gcd, numbers)

#in
n=int(input())
v=list(map(int, input().split()))

maxi = 0

# おなじか？
if len(list(set(v))) == 1:
    maxi = (v[0])
elif len(v) == 2:
    maxi = (max(v))
# 書き換え 1
else:
    for i in range(n):
        listv = []
        listv = copy.copy(v)
        listv[i] = min(v) 
        listv[i] = max(listv)
        if gcd_list(listv)> maxi:
            maxi = gcd_list(listv)
#最大公約数


print(maxi)

# 書き換え 2

Buggy submission (verdict: Runtime Error):
import fractions
from functools import reduce

def gcd(*numbers):
    return reduce(fractions.gcd, numbers)

def gcd_list(numbers):
    return reduce(fractions.gcd, numbers)

#in
n=int(input())
v=list(map(int, input().split()))

maxi = 0

# おなじか？
if len(list(set(v))) == 1:
    maxi = (v[0])
elif len(v) == 2:
    maxi = (max(v))
# 書き換え 1
else:
    for i in range(n):
        listv = v
        listv[i] = min(v) 
        listv[i] = max(listv)
        print(listv)
        print(v)
        listval = listv
        temp = gcd_list(listval)
        if temp> maxi:
            if temp != max(listv)
                maxi = temp
#最大公約数


print(maxi)

# 書き換え 2
Problem p03206 (python)

Fixed submission:
D = int(input())
if D ==22:
  print("Christmas Eve Eve Eve")
elif D == 23:
  print("Christmas Eve Eve")
elif D == 24:
  print("Christmas Eve")
else:
  print("Christmas")

Buggy submission (verdict: Runtime Error):
D = int().input()
if D==22:
  print("Christmas Eve Eve Eve")
else if D == 23:
  print("Christmas Eve Eve")
else if D == 24:
  print("Christmas Eve")
else:
  print("Cristmas")
Problem p03238 (python)

Fixed submission:
n = int(input())
 
if n == 1:
  print("Hello World")
else:
  a = int(input())
  b = int(input())
  print(a+b)

Buggy submission (verdict: Runtime Error):
n = int(input())
 
if n == 1:
  print("Hello World")
else:
  a,b = map(int, input().split())
  print(a+b)

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

if n == 1:
  print("Hello World")
  
else:
  a,b = map(int, input().split())
  print(a+b)
Problem p03260 (python)

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

for i in range(1,3):
    if ((a*b*i)%2) == 1:
        c = 1

if c == 1:
    print("Yes")
else:
    print("No")

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

used = [empty]
ans = "Yes"

for i in range(n):
    if i == 0:
        t = str(input())
        
        past = t
    else:
        t = str(input())
        for j in used:
            if j == t:
                ans = "No"
    
    if past[-1] != t[1]:
        ans = "No"
    used.append(t)
    past = t

print(ans)
Problem p03261 (python)

Fixed submission:

s = int(input())
last = str(input())
wordlist = [last]
ans = "Yes"

for i in range(s-1):
    word = str(input())

    if last[-1] != word[0]:
        ans = "No"
        break
    
    elif word in wordlist:
        ans = "No"
        break

    last = word
    wordlist.append(word)

print(ans)

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

used = []
ans = "Yes"

for i in range(n):
    if i == 0:
        t = str(input())
    else:
        t = str(input())
        print(t + "!")
        for j in used:
            if t == j:
                ans = "No"

        if len(t) == 1:
            if past[]
            
        else:
            if past[-1] != t[0]:
               ans == "No"
    used.append(t)
    past = t

print(ans)

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

used = []
ans = "Yes"

for i in range(n):
    if i == 0:
        t = str(input())
    else:
        t = str(input())
        for j in used:
            if t == j:
                ans = "No"
        if past[-1] != t[1]:
            ans == "No"
    used.append(t)
    past = t

print(ans)

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

used = ["empty"]
ans = "Yes"

for i in range(n):
    if i == 0:
        t = str(input())
        
        past = t
    else:
        t = str(input())
        for j in used:
            if j == t:
                ans = "No"
    
    if past[-1] != t[1]:
        ans = "No"
    used.append(t)
    past = t

print(ans)

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

used = []
ans = "Yes"

for i in range(n):
    if i == 0:
        t = str(input())
        
        past = t
    else:
        t = str(input())
        for j in used:
            if j == t:
                ans = "No"
    
    if past[-1] != t[1]:
        ans = "No"
    used.append(t)
    past = t

print(ans)
Problem p03264 (python)

Fixed submission:
a = int(input())

oddl = []
evenl = []

for i in range(a):
    if i%2 == 1:
        oddl.append(i)
    else:
        evenl.append(i)

odd = len(oddl)
even = len(evenl)

print(odd*even)

Buggy submission (verdict: Runtime Error):
x1, y1, x2, y2 = map(int, input().split())
 
x3 = x2 + (y1 - y2)
y3 = y2 - (x1 - x2)
x4 = x3 + (x1 - x2)
y4 = y3 + (y1 - y2)
 
print(x3, y3, x4, y4)
Problem p03281 (python)

Fixed submission:
a = int(input())

if a == 105:
    cnt = 1
elif a <= 104:
    cnt = 0
else:
    cnt = 0
    divs = 0
    for i in range(1,a+1, 2):
        divs = 0
        for j in range(1,i+1):
            if i%j == 0:
                divs += 1
        if divs == 8:
            cnt += 1

print(cnt)

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

if a == 105:
    print(1)
elif a <= 104:
    print(0)
else:
    cnt = 0
    divs = 0
    for i in range(1,a+1, 2):
        divs = 0
        for j in range(1,i+1):
            if i%j == 0:
                divs += 1
        if divs == 8:
            cnt += 1

print(cnt)
Problem p02994 (python)

Fixed submission:
import numpy as np
N,L = map(int,input().split())
s = []
for i in range(N):
    s.append(L+i)
ans_pre = abs(np.array([s]))
if L + N <= 0:
    print(-1*(sum(ans_pre[0])-min(ans_pre[0])))
else:
    print(sum(s)-min(ans_pre[0]))

Buggy submission (verdict: Runtime Error):
N,L = map(int,input().split())
s = []
for i in range(N):
    s.append(L+i)
ans_pre = abs(np.array([s]))
if L + N < 0:
    print(-1*(sum(ans_pre[0])-min(ans_pre[0])))
else:
    print(sum(s)-min(ans_pre[0]))
Problem p03155 (python)

Fixed submission:
N = int(input())
H = int(input())
W = int(input())
x = (N - H + 1) * (N - W + 1)
print(x)

Buggy submission (verdict: Runtime Error):
import numpy as np
H, W = map(int,input().split())
S_pre = []
for i in range(H):
    S_i = list(input().split())
    S_pre.append(S_i)
    black = [j for j,x in enumerate(S_i) if x == '#']
       
S = np.array(S_pre)
Problem p03145 (python)

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

if a>b and a>c:
  print(int((1/2 * b * c)))
  
if b>a and b>c:
  print(int((1/2 * a * c)))
  
else:
  print(int((1/2 * a *b)))

Buggy submission (verdict: Runtime Error):
a, b, c= input().split()
a, b, c = int(a), int(b), int(c)

if a>b and a>c:
  print(int((1/2 * b * c)))
  
if b>a and b>c:
  print(int((1/2 * a * c)))
  
else:
  print(int((1/2 * a *b))
Problem p03846 (python)

Fixed submission:
N = int(input())
A = list(map(lambda x:int(x), input().split()))

fail=False
count_list = [0]*(int((N-1)/2)+1)
for i in range(N):
	if A[i]%2==N%2:
		print(0)
		fail=True
		break
	count_list[int(A[i]/2)] = count_list[int(A[i]/2)]+1
if not fail:
	if N%2==0:
		for c in count_list:
			if c!=2:
				print(0)
				break
		else:
			result = 2
			for i in range(int(N/2)-1):
				result = result*2%(10**9+7)
			print(result)
	if N%2==1:
		if count_list[0]!=1:
			print(0)
		else:
			count_list.pop(0)
			for c in count_list:
				if c!=2:
					print(0)
					break
			else:
				if N==1:
					print(1)
				else:
					result = 2
					for i in range(int((N-1)/2)-1):
						result = result*2%(10**9+7)
					print(result)

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

fail=False
count_list = [0]*(int((N-1)/2)+1)
for i in range(N):
	if A[i]%2==N%2:
		print(0)
		fail=True
		break
	count_list[int(A[i]/2)] = count_list[int(A[i]/2)]+1
if not fail:
	if N%2==0:
		for c in count_list:
			if c!=2:
				print(0)
				break
		else:
			print(int(2**(N/2)%(10**9+7)))
	if N%2==1:
		if count_list[0]!=1:
			print(0)
		else:
			count_list.pop(0)
			for c in count_list:
				if c!=2:
					print(0)
					break
			else:
				print(int(2**((N-1)/2)%(10**9+7)))
Problem p03035 (python)

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

if A >= 13:
    print(B)
elif A >= 6 and A <= 12:
    print("{:.0f}".format(B/2))
elif A <= 5:
    print(0)

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

li.sort()
tmp = 0

for i in range(M):
    B, C = map(int, input().split())
    for j in range(B):
        if li[j] < C:
            li[j] = C
        else:
            break
    li.sort()

print(sum(li))
Problem p03000 (python)

Fixed submission:
n,x = map(int,input().split())
if n != 1:
  l = list(map(int,input().split()))
  i = 0
  cnt = 0
  ans = 0
  while cnt <= x :
    if i == n:
      print(n+1)
      exit()
    ans += 1
    cnt += l[i]
    i += 1
  print(ans)
else:
  l = int(input())
  if l <= x:
    print(2)
  else:
    print(1)

Buggy submission (verdict: Runtime Error):
n,x = map(int,input().split())
if n != 1:
  l = list(map(int,input().split()))
  i = 0
  cnt = 0
  ans = 0
  while cnt <= x:
    ans += 1
    cnt += l[i]
    i += 1
  print(ans)
else:
  l = int(input())
  if l <= x:
    print(2)
  else:
    print(1)

Buggy submission (verdict: Runtime Error):
n,x = map(int,input().split())
if n > 2:
  l = list(map(int,input().split()))
  i = 0
  cnt = 0
  ans = 0
  while cnt <= x:
    ans += 1
    cnt += l[i]
    i += 1
  print(ans)
else:
  l = int(input())
  if l <= x:
    print(2)
  else:
    print(1)

Buggy submission (verdict: Runtime Error):
n,x = map(int,input().split())
if n != 1:
  l = list(map(int,input().split()))
  i = 0
  cnt = 0
  ans = 0
  while cnt <= x:
    ans += 1
    cnt += l[i]
    i += 1
  print(ans)
else:
  l = int(input())
  if l <= x:
    print(2)
  else:
    print(1)

Buggy submission (verdict: Runtime Error):
n,x = map(int,input().split())
l = list(map(int,input().split()))
i = 0
cnt = 0
ans = 0
while cnt <= x:
  ans += 1
  cnt += l[i]
  i += 1
print(ans)
Problem p02971 (python)

Fixed submission:
n = int(input())
a = [int(input()) for _ in range(n)]
b = sorted(a)
for x in a:
    print(b[(x < b[-1]) - 2])

Buggy submission (verdict: Runtime Error):
n = int(input())
a = [int(input()) for _ in range(n)]
m1, m2 = sorted(set(a))[n - 2:]
if a.count(m1) > 1:
    for _ in range(n):
        print(m1)
else:
    for x in a:
        print(m1) if x == m2 else print(m2)
Problem p02975 (python)

Fixed submission:
n=int(input())
a=[int(x) for x in input().split()]
b=0
for i in a:
  b=b^i
if b==0:
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
n=int(input())
a=[int(x) for x in input().split()]
b=0
for i in a:
  b=b^a
if b==0:
  print("Yes")
else:
  print("No")
Problem p02995 (python)

Fixed submission:
def gcd(x, y): 
  
   while(y): 
       x, y = y, x % y 
  
   return x 
[a,b,c,d]=[int(x) for x in input().split()]
k=(c*d)//gcd(c,d)
count=(b-a+1)-((b//c-(a-1)//c)+(b//d-(a-1)//d)-(b//k-(a-1)//k))
print(count)

Buggy submission (verdict: Runtime Error):
from math import gcd
[a,b,c,d]=[int(x) for x in input().split()]
k=(c*d)//gcd(c,d)
count=(b-a+1)-((b//c-(a-1)//c)+(b//d-(a-1)//d)-(b//k-(a-1)//k))
print(count)
Problem p02999 (python)

Fixed submission:
[x,a]=[int(x) for x in input().split()]
if x<a:
  print('0')
else:
  print('10')

Buggy submission (verdict: Runtime Error):
[n,x]=[int(x) for x in input().split()]
l=[int(x) for x in input().split()]
k=0
count=0
for i in range(n):
  if k<=x:
    count+=1
  k+=l[i]
print(count)