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

Fixed submission:
import statistics
N = int(input())
A = list(map(int, input().split()))

for i in range(N):
	A[i] = A[i] - (i+1)
A.sort()

if N % 2 == 0:
	med1 = A[N // 2 - 1]
	med2 = A[N //2]
	ans = min(sum([abs(a - med1) for a in A]), sum([abs(a - med2) for a in A]))

else:
	med = A[N // 2]
	ans = sum([abs(a - med) for a in A])
	
print(ans)

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

for i in range(N):
	A[i] = A[i] - (i+1)
A.sort()

b = statistics.median(A)

ans = 0

for i in range(N):
	ans += abs(A[i] - b)
print(ans

Buggy submission (verdict: Runtime Error):
import numpy as np
N = int(input())
A = list(map(int, input().split()))

for i in range(N):
	A[i] = A[i] - (i+1)
A.sort()
ans = 10000000000000000000000000000000

def dis(a):
	return abs(a - b)

r = np.arange(min(A), max(A)+1)
for b in r:
	l = list(map(dis, A))
	ans = min(sum(l), ans) 

print(ans)
Problem p03352 (python)

Fixed submission:
x = int(input())

ans = 1
for b in range(1,32):
	for p in range(2,10):
		l = b**p
		if l <= x and l > ans:
			ans = l
print(ans)

Buggy submission (verdict: Runtime Error):
x = int(input())
for b in range(x):
	for p in range(x):
		if b >0 and p >=2:
			if b**p > x:
				break
			ans = b ** p
print(ans)

Buggy submission (verdict: Runtime Error):
x = int(input())
for b in range(x):
	for p in range(x):
		if b >0 and p >=2:
			if b**p > x:
				break
			ans = b ** p
print(ans
Problem p03359 (python)

Fixed submission:
a,b=map(int,input().split( ))
if a>b:
  print(a-1)
else:
  print(a)

Buggy submission (verdict: Runtime Error):
a,b=map(int,input().split)
if a>b:
  print(a-1)
else:
  print(a)
Problem p03416 (python)

Fixed submission:
a,b=map(str,input().split( ))
a_12 = int(a[0:2])
a_3 = int(a[2])
a_45 = int(a[3:5])
b_12 = int(b[0:2])
b_3 = int(b[2])
b_45 = int(b[3:5])
a_21 = int(a[1]+a[0])
b_21 = int(b[1]+b[0])
ans = (b_12-a_12+1)*10 - a_3 - (10 - b_3 - 1)
if a_21 < a_45:
    ans = ans - 1
if b_21 > b_45:
    ans = ans - 1
print(ans)

Buggy submission (verdict: Runtime Error):
a,b=map(int,input().split( ))
a_12 = int(a[0:2])
a_3 = int(a[2])
a_45 = int(a[3:5])
b_12 = int(b[0:2])
b_3 = int(b[2])
b_45 = int(b[3:5])
a_21 = int(a[1]+a[0])
b_21 = int(b[1]+b[0])
ans = (b_12-a_12+1)*10 - a_3 - (10 - b_3 - 1)
if a_21 < a_45:
    ans = ans - 1
if b_21 > b_45:
    ans = ans - 1
print(ans)

Buggy submission (verdict: Runtime Error):
a = input()
b = input()
a_12 = int(a[0:2])
a_3 = int(a[2])
a_45 = int(a[3:5])
b_12 = int(b[0:2])
b_3 = int(b[2])
b_45 = int(b[3:5])
a_21 = int(a[1]+a[0])
b_21 = int(b[1]+b[0])
ans = (b_12-a_12+1)*10 - a_3 - (10 - b_3 - 1)
if a_21 < a_45:
    ans = ans - 1
if b_21 > b_45:
    ans = ans - 1
print(ans)
Problem p03424 (python)

Fixed submission:
N = int(input())
S_list = list(map(str, input().split( )))
import collections
S_dict = collections.Counter(S_list)
S_val, S_count=zip(*S_dict.most_common())
ans_number = len(S_val)
ans = 'Three'
if ans_number == 4:
  ans = 'Four'
print(ans)

Buggy submission (verdict: Runtime Error):
N = int(input())
S_list = list(map(str, input().split( )))
import collections
S_dict = collections.Counter(S_list)
S_val, S_count=zip(*S_dict.most_common())
ans_number = len(S_val)
ans = 'Three'
if ans_number = 4:
  ans = 'Four'
print(ans)
Problem p03587 (python)

Fixed submission:
s = list(map(int, list(input())))
print(sum(s))

Buggy submission (verdict: Runtime Error):
N = int(input())
ans = 0
while ans == 0: 
	for h in range(3500):
		h = h + 1
		for n in range(3500):
			n = n + 1
			up = 4*h*n - n*N - N*h
			down = N*h*n
			if up  0:
				if down % up == 0:
					w = down // up
					ans = 1
					break
		if ans == 1:
			break
print(h, n , w)
Problem p03693 (python)

Fixed submission:
r, g, b = map(str, input().split( ))
ans = 'NO'

if int(r + g + b) % 4 ==0:
	ans = 'YES'
print(ans)

Buggy submission (verdict: Runtime Error):
import numpy as np
N = int(input())
a = list(map(int, input().split()))

d = np.arange(0, 3600, 400)
c = []

for i in range(N):
	for j in range(len(d)-1):
		if d[j] <= a[i] < d[j + 1]:
			c.append(j)
	if a[i] >= 3200:
		c.append(8)

import collections
c_dict=collections.Counter(c)

s_val, s_count=zip(*c_dict.most_common())
nana_ika = [x for x in s_val if x < 8]

if not 8 in s_val:
	print(len(nana_ika), len(nana_ika))

else:
	if len(nana_ika) == 0:
		print(1, c_dict[8])
	elif 8 - len(nana_ika) > c_dict[8]:
		print(len(nana_ika), len(nana_ika) + c_dict[8])
	elif 8 -len(nana_ika) <= c_dict[8]:
		print(len(nana_ika), 8)
Problem p03721 (python)

Fixed submission:
from collections import defaultdict

N, K = map(int,input().split( ))

a = []
b = []

for i in range(N):
	a_i, b_i = map(int, input().split( ))
	a.append(a_i)
	b.append(b_i)

d = defaultdict(int)

for i in range(N):
    if a[i] in d:
        d[a[i]] += b[i]
    else:
        d[a[i]] = b[i]

d_sorted = sorted(d.items())

l = 0

for i in range(N):
	a_i = d_sorted[i][0]
	b_i = d_sorted[i][1]
	l += b_i
	if l >= K:
		print(a_i)
		break

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

N, K = map(int,input().split( ))

a = []
b = []

for i in range(N):
	a_i, b_i = map(int, input().split( ))
	a.append(a_i)
	b.append(b_i)

d = defaultdict(int)

for i in range(N):
    if a[i] in d:
        d[a[i]] += b[i]
    else:
        d[a[i]] = b[i]

d_sorted = sorted(d.items())

l = 0
for a_i,b_i in d_sorted.items():
	l += b_i
	if l >= K:
		print(a_i)
		break

Buggy submission (verdict: Runtime Error):
N, K = map(int,input().split( ))
l = []
for i in range(N):
	a, b = map(int, input().split( ))
	l.append(b)
	print(l)
	if sum(l) > K-1:
		print(a)
		break
Problem p03761 (python)

Fixed submission:
n = int(input())
S = []
ans = ''
for i in range(n):
	s = list(input())
	S.append(s)


S[0].sort()

for i in range(len(S[0])):
	if n == 1:
		ans = ''.join(S[0])
	a = S[0][i]
	l = 0
	for j in range(n - 1):
		if a in S[j + 1]:
			S[j + 1].remove(a)
			l += 1
		if l == n - 1:
			ans += a


print(ans)

Buggy submission (verdict: Runtime Error):
n = int(input())
S = []
ans = ''
for i in range(n):
	s = list(input())
	S.append(s)


S[0].sort()

for i in range(len(S[0])):
	if n == 1:
		ans = ''.join(S[0])
        break
	a = S[0][i]
	l = 0
	for j in range(n - 1):
		if a in S[j + 1]:
			S[j + 1].remove(a)
			l += 1
		if l == n - 1:
			ans += a


print(ans)
Problem p02780 (python)

Fixed submission:
N,K = map(int,input().split())
P = list(map(int,input().split()))
T = [0]*N

for i in range(N):
    P[i] = (1 + P[i])/2

if N == K:
    print(sum(P))

else:
    for i in range(1,N):
        P[i] += P[i-1]

    for i in range(K,N):
        T[i] = P[i] - P[i-K]

    T = T[K:]

    print(max(T))

Buggy submission (verdict: Runtime Error):
N,K = map(int,input().split())
P = list(map(int,input().split()))
T = [0]*N

for i in range(N):
    P[i] = (1 + P[i])/2

for i in range(1,N):
    P[i] += P[i-1]

for i in range(K,N):
    T[i] = P[i] - P[i-K]

T = T[K:]

if N == 1:
    print(P[i])
else:
    print(max(T))

Buggy submission (verdict: Runtime Error):
N,K = map(int,input().split())
P = list(map(int,input().split()))
T = [0]*N

for i in range(N):
    P[i] = (1 + P[i])/2

for i in range(1,N):
    P[i] += P[i-1]

for i in range(K,N):
    T[i] = P[i] - P[i-K]

T = T[K:]

print(max(T))
Problem p02947 (python)

Fixed submission:
N = int(input())

ans = 0
d = {}

for i in range(N):
    txt = "".join(sorted(input()))
    d.setdefault(txt,0)
    
    ans += d[txt]
    d[txt] += 1
    
print(ans)

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

l = max(X-K+1,-1000000)
r = min(X+K-1,1000000)

ans = []

for i in range(l,r+1):
    ans.append(str(i))

ans = " ".join(ans)

print(ans)

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

l = max(X-K+1,-1000000)
r = min(X+K-1,1000000)

ans = []

for i in range(l,r+1):
    ans.append(str(i))

ans = " ".join(ans)

print(ans)
Problem p02982 (python)

Fixed submission:
#! python3
#  solve_133B.py

import math



N,D = map(int,input().split())
X = []
ans = 0


def dis(Y,Z):
    ans = 0
    for i in range(D):
        ans += (Y[i] - Z[i])**2
    return math.sqrt(ans)

for i in range(N):
    X.append(list(map(int,input().split())))

for i in range(N):
    for j in range(i+1,N):
       if dis(X[i],X[j]) % 1 == 0:
           ans += 1

print(ans)

Buggy submission (verdict: Runtime Error):
#! python3
#  solve_133B.py

import math

def dis(Y,Z):
    ans = 0
    for i in range(len(Y)):
        ans += (Y[i] - Z[i])**2
    return math.sqrt(ans)


N,D = map(int,input(().split()))
X = []
ans = 0

for i in range(N):
    X.append(list(map(int,input().split())))

for i in range(N):
    for j in range(i,N):
       if dis(i,j) % 1 == 0:
           ans += 1

print(ans)
Problem p02983 (python)

Fixed submission:
L,R = map(int,input().split())

ans = 2018

for i in range(L,min(R,L+2100)):
    for j in range(i+1,min(R+1,i+2100)):
        if (i*j) % 2019 <= ans:
            ans = (i*j) % 2019

print(ans)

Buggy submission (verdict: Runtime Error):
A,B,C,D = map(int,input().split())

count = 0

for i in range(A,B+1):
    if not i % C == 0:
        if not i % D ==0:
            count += 1

print(count)
Problem p03030 (python)

Fixed submission:
N = int(input())
l = []
for i in range(N):
    s,p = input().split()
    l.append([s,int(p),i+1])

l = sorted(l,key = lambda x:x[1],reverse=True)
l = sorted(l,key = lambda x:x[0])

for i in range(N):
    print(l[i][2])

Buggy submission (verdict: Runtime Error):
N = int(input())
l = []
for i in range(N):
    s,p = input().split()
    l.append([s,int(p),i+1])

l = sorted(l,key = lambda x:x[1],reverse=True)
l = sorted(l,key = lambda x:x[0])

for i in range(N):
    print(l[2])
Problem p03035 (python)

Fixed submission:
A,B = map(int,input().split())
 
if A >= 13:
  print(B)
elif 6<=A<=12:
  print(B//2)
else:
  print("0")

Buggy submission (verdict: Runtime Error):
A,B = map(int(input()).split())

if A >= 13:
  print(B)
elif 6<=A<=12:
  print(B/2)
else:
  print(0)
Problem p03136 (python)

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

if L[-1] < sum(L[0:N-1]):
    print("Yes")
else:
    print("No")

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

nl = sorted(l)

for i in range(n-1):
	other = 0 + n1[i]

if other < nl[n-1]:
  print("Yes")
else:
  print("No")
Problem p03210 (python)

Fixed submission:
age = int(input())
 
if age == 3 or age == 5 or age == 7:
  print("YES")
else:
  print("NO")

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

if age == 3,5,7:
  print("YES")
else:
  print("NO")
Problem p03238 (python)

Fixed submission:
age = int(input())
 
if age == 1:
  print("Hello World")
  
else:
  A=int(input())
  B =int(input())
  print(A+B)

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

if age == 1:
  print("Hello World")
  
else:
  print(A+B)
Problem p03282 (python)

Fixed submission:
S = input()
K = int(input())
judge = 1

for i in range(K):
    if S[i] != "1":
        print(S[i])
        judge = 0
        break

if judge != 0:
    print("1")

Buggy submission (verdict: Runtime Error):
S = input()
K = int(input())
judge = 1

for i in range(K+1):
    if S[i] != "1":
        print(S[i])
        judge = 0
        break

if judge != 0:
    print("1")
Problem p03292 (python)

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

print(max(list)-min(list))

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

print(n[3]-n[0])
Problem p03293 (python)

Fixed submission:
S = input()
T = input()*2

if S in T:
    print("Yes")
else:
    print("No")

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

print(task_list[2]-task_list[0])
Problem p03455 (python)

Fixed submission:
a, b = map(int, input().split())
print("Even" if a*b % 2 == 0 else "Odd")

Buggy submission (verdict: Runtime Error):
a, b = map(int, input().split())
	if a*b % 2 ==0:
    	print("Even")
    else:
      print("Odd")
Problem p03816 (python)

Fixed submission:
N = int(input())
A = list(map(int, input().split()))
# print(A)

cnt = {}
for a in A:
  if a not in cnt:
    cnt[a] = 1
  else:
  	cnt[a] += 1
  
s, e = 1, 100000
while True:
  while (s not in cnt or cnt[s] <= 1) and s < e:
    s += 1
  while (e not in cnt or cnt[e] <= 1) and s < e:
    e -= 1
  if e < s:
    break
  if s == e:
    if s in cnt:
      if cnt[s] <= 1:
        break
    else:
      break
  if s in cnt:
  	cnt[s] -= 1
  if e in cnt:
    cnt[e] -= 1

ans = 0
for i in range(1, 100001):
  if i in cnt and cnt[i] > 0:
    ans += 1
    
print(ans)

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

cnt = {}
for a in A:
  if a not in cnt:
    cnt[a] = 1
  else:
  	cnt[a] += 1
  
s, e = 1, 100000
while True:
  while (s not in cnt or cnt[s] <= 1) and s < e:
    s += 1
  while (e not in cnt or cnt[e] <= 1) and s < e:
    e -= 1
  if e < s:
    break
  if s == e and cnt[s] <= 1:
    break
  if s in cnt:
  	cnt[s] -= 1
  if e in cnt:
    cnt[e] -= 1

ans = 0
for i in range(1, 100001):
  if i in cnt and cnt[i] > 0:
    ans += 1
    
print(ans)

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

cnt = {}
for a in A:
  if a not in cnt:
    cnt[a] = 1
  else:
  	cnt[a] += 1
  
s, e = 1, 100000
while True:
  while (s not in cnt or cnt[s] <= 1) and s < e:
    s += 1
  while (e not in cnt or cnt[e] <= 1) and s < e:
    e -= 1
  if e < s:
    break
  if s == e and cnt[s] <= 1:
    break
  cnt[s] -= 1
  cnt[e] -= 1

ans = 0
for i in range(1, 100001):
  if i in cnt and cnt[i] > 0:
    ans += 1
    
print(ans)
Problem p02969 (python)

Fixed submission:
r = int(input())
print(3*r*r)

Buggy submission (verdict: Runtime Error):
r = input()
print(3*r*r)

Buggy submission (verdict: Runtime Error):
r = 0

s = 3*r*r
printf(s)
Problem p03543 (python)

Fixed submission:
S=input()
if S[0]==S[1]==S[2] or S[1]==S[2]==S[3]:
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
S=input()
if S[1]==S[2]==S[3] or S[2]==S[3]==S[4]:
  print("Yes")
else:
  print("No")
Problem p02574 (python)

Fixed submission:
def sieve_eratosthenes(n):
    primes = [0, 1] * (n // 2 + 1)
    if n % 2 == 0:
        primes.pop()
    primes[1] = 0
    primes[2] = 1
    for p in range(3, n + 1, 2):
        if primes[p]:
            for q in range(p * p, n + 1, 2 * p):
                primes[q] = 0
    return primes

def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])
    if temp!=1:
        arr.append([temp, 1])
    if arr==[]:
        arr.append([n, 1])
    return arr

ps = set()
for i,m in enumerate(sieve_eratosthenes(1000000)):
    if m == 1:
        ps.add(i)

from collections import defaultdict
import math

n = int(input())
a = list(map(int, input().split()))
a.sort(reverse = True)
one = False
for i in range(n):
    if a[-1] == 1:
        a.pop()
        one = True
        n -= 1
    else:
        break

if n==0 or n==1:
    print("pairwise coprime")
    exit()

a.sort()

g = a[0]
for i in range(1,n):
    g = math.gcd(g, a[i])

if g == 1:
    if n > len(ps):
        print("setwise coprime")
    else:
        d = defaultdict(int)
        for i in range(n):
            f = factorization(a[i])
            for x, y in f:
                d[x] += 1
        for i in d.values():
            if i != 1:
                print("setwise coprime")
                exit()
        print("pairwise coprime")

else:
    if one:
        print("setwise coprime")
    else:
        print("not coprime")

Buggy submission (verdict: Runtime Error):
def sieve_eratosthenes(n):
    primes = [0, 1] * (n // 2 + 1)
    if n % 2 == 0:
        primes.pop()
    primes[1] = 0
    primes[2] = 1
    for p in range(3, n + 1, 2):
        if primes[p]:
            for q in range(p * p, n + 1, 2 * p):
                primes[q] = 0
    return primes

def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])
    if temp!=1:
        arr.append([temp, 1])
    if arr==[]:
        arr.append([n, 1])
    return arr

ps = set()
for i,m in enumerate(sieve_eratosthenes(1000000)):
    if m == 1:
        ps.add(i)

from collections import defaultdict
import math

n = int(input())
a = list(map(int, input().split()))
a.sort(reverse = True)
for i in range(n):
    if a[-1-i] == 1:
        a.pop()
        n -= 1
    else:
        break

a.sort()

g = a[0]
for i in range(1,n):
    g = math.gcd(g, a[i])

if g == 1:
    if n > len(ps):
        print("setwise coprime")
    else:
        d = defaultdict(int)
        for i in range(n):
            f = factorization(a[i])
            for x, y in f:
                d[x] += 1
        for i in d.values():
            if i != 1:
                print("setwise coprime")
                exit()
        print("pairwise coprime")

else:
    print("not coprime")
Problem p02697 (python)

Fixed submission:
n,m=map(int,input().split())
if n%2==1:
    for i in range(m):
        print(i+1, n-i-1)
else:
    used = [False]*n
    next = [i+1 for i in range(m)][::-2]+[i+1 for i in range(m)][-2::-2]
    i=0
    now=0
    count=0
    while True:
        if used[now]==False and used[now+next[i]]==False:
            print(now+1, now+next[i]+1)
            count+=1
            if count==m:
                break
            used[now]=True
            used[now+next[i]]=True
            i+=1
            now+=1
        else:
            now+=1

Buggy submission (verdict: Runtime Error):
n,m=map(int,input().split())
if n%2==1:
    for i in range(m):
        print(i+1, n-i-1)
else:
    if n==4:
        print(2, 3)
        exit()
    for i in range(m-1):
        print(i+1, n-i)
    print(i+3, n-i-1)
Problem p02727 (python)

Fixed submission:
import heapq

x,y,a,b,c=map(int,input().split())
p=list(map(int,input().split()))
q=list(map(int,input().split()))
r=list(map(int,input().split()))
p.sort(reverse=True)
q.sort(reverse=True)
r.sort(reverse=True)
pq=p[:x]+q[:y]
heapq.heapify(pq)

for i in range(c):
    a=heapq.heappop(pq)
    if a<r[i]:
        heapq.heappush(pq,r[i])
    else:
        heapq.heappush(pq,a)
        break

print(sum(pq))

Buggy submission (verdict: Runtime Error):
x,y,a,b,c=map(int,input().split())
p=list(map(int,input().split()))
q=list(map(int,input().split()))
r=list(map(int,input().split()))
p.sort(reverse=True)
q.sort(reverse=True)
r.sort(reverse=True)

red=0
green=0
no=0
ans=0

while True:
    if red>x-1 and green>y-1:
        break
    if no<=c-1:
        if red>x-1:
            if q[green]>=r[no]:
                ans+=q[green]
                green+=1
            else:
                ans+=r[no]
                green+=1
                no+=1
        elif green>y-1:
            if p[green]>=r[no]:
                ans+=p[red]
                red+=1
            else:
                ans+=r[no]
                red+=1
                no+=1
        else:
            if max(p[red],q[green],r[no])==p[red]:
                ans+=p[red]
                red+=1
            elif max(p[red],q[green],r[no])==q[green]:
                ans+=q[green]
                green+=1
            else:
                if p[red]>q[green]:
                    q[green]=r[no]
                else:
                    p[red]=r[no]
                no+=1
    else:
        ans+=sum(p[red:x])
        ans+=sum(q[green:y])
        break
print(ans)
Problem p02786 (python)

Fixed submission:
h=int(input())

ans=0
i=0
while True:
    ans+=(2**i)
    h//=2
    i+=1
    if h==0:
        break
print(ans)

Buggy submission (verdict: Runtime Error):
h,n=map(int,input().split())
ab=[list(map(int,input().split())) for _ in range(n)]
 
dp=[0]*h
for i in range(h):
    _min = 10**10
    for g in range(n):
        if i>=ab[g][0]:
            _min = min(ab[g][1]+dp[i-ab[g][0]], _min)
        else:
            _min = min(ab[g][1], _min)
    dp[i]=_min
print(dp[-1])
Problem p02999 (python)

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

Buggy submission (verdict: Runtime Error):
n, x = (int(i) for i in input().split())  
l = list(int(_) for _ in input().split()) 
distance=0
_count=1
for i in range(0, n+1):
    distance += l[i]
    if distance<=x:
        _count += 1
    else:
        break
print(_count)
Problem p03000 (python)

Fixed submission:
n, x = (int(i) for i in input().split())  
l = list(int(_) for _ in input().split()) 
distance=0
_count=1
for i in range(0, n):
    distance += l[i]
    if distance<=x:
        _count += 1
    else:
        break
print(_count)

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

Buggy submission (verdict: Runtime Error):
n, x = (int(i) for i in input().split())  
l = list(int(_) for _ in input().split()) 
distance=0
_count=1
for i in range(0, n+1):
    distance += l[i]
    if distance<=x:
        _count += 1
    else:
        break
print(_count)

Buggy submission (verdict: Runtime Error):
n, x = (int(i) for i in input().split())  
l = list(int(_) for _ in input().split()) 
distance=0
_count=1
for i in range(0, n+1):
    distance += l[i]
    if distance<=x:
        _count += 1
    else:
        break
print(_count)
Problem p03037 (python)

Fixed submission:
import numpy as np

N, M= (int(i) for i in input().split())  
lr = [[int(i) for i in input().split()] for i in range(M)] 	
lr = np.array(lr)
l = list(lr[:, 0])
r = list(lr[:, 1])
d = min(r)-max(l)+1
if d>0:
	print(d)
else:
	print(0)

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

N, M= (int(i) for i in input().split())  
lr = [[int(i) for i in input().split()] for i in range(M)] 	
a = np.zeros([M,N])
for i in range(M):
	a[i, lr[i][0]-1:lr[i][1]] = 1
b = list(np.all(a == 1, axis=0))
print(b.count(True))

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

N, M= (int(i) for i in input().split())  
lr = [[int(i) for i in input().split()] for i in range(M)] 	
a = np.zeros([M,N])
for i in range(M):
	a[i, lr[i][0]-1:lr[i][1]] = 1
b = list(np.all(a == 1, axis=0))
print(sum(b))
Problem p03071 (python)

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

Buggy submission (verdict: Runtime Error):
S = input()
S = [int(i) for i in list(S)]

a = []
c = []
b = True
for i in range(len(S)):
    if b:
        a.append(1)
        c.append(0)
        b=False
    else:
        a.append(0)
        c.append(1)
        b=True

combined1 = [abs(x-y) for (x, y) in zip(S, a)]
combined2 = [abs(x-y) for (x, y) in zip(S, c)]

if len(S)==1:
    print(0)
else:
    print(min(sum(combined1), sum(combined2)))
Problem p03078 (python)

Fixed submission:
X,Y,Z,K = (int(i) for i in input().split())  
A = [int(i) for i in input().split()] 
B = [int(i) for i in input().split()] 
C = [int(i) for i in input().split()] 

A.sort(reverse=True)
B.sort(reverse=True)
C.sort(reverse=True)

ans = []
b=0
c=0
for a in range(len(A)):
	for b in range(len(B)):
		for c in range(len(C)):
			if (a+1)*(b+1)*(c+1)<=K:
				ans.append(A[a]+B[b]+C[c])
			else:
				break

ans.sort(reverse=True)
for i in range(K):
	print(ans[i])

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

A.sort(reverse=True)
B.sort(reverse=True)
C.sort(reverse=True)

ans = []
b=0
c=0
for a in range(len(A)):
	if (a+1)*(b+1)*(c+1)>K:
		break
	for b in range(len(B)):
		if (a+1)*(b+1)*(c+1)>K:
			break
		for c in range(len(C)):
			if (a+1)*(b+1)*(c+1)<=K:
				ans.append(A[a]+B[b]+C[c])
			else:
				break

ans.sort(reverse=True)
for i in range(K):
	print(ans[i])