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

Fixed submission:
from math import factorial
N = factorial(int(input()))
mod = 10**9 + 7
ans = 1
i = 2

while i*i <= N:
    cnt = 1
    while N%i == 0:
        cnt += 1
        N //= i
    ans *= cnt
    i += 1

if N != 1:
    ans *= 2
print(int(ans%mod))

Buggy submission (verdict: Runtime Error):
from math import factorial
from sympy import divisors

N = factorial(int(input()))

def make_divisors(n):
    lower_divisors , upper_divisors = [], []
    i = 1
    while i*i <= n:
        if n % i == 0:
            lower_divisors.append(i)
            if i != n // i:
                upper_divisors.append(n//i)
        i += 1
    return lower_divisors + upper_divisors[::-1]

print(len(make_divisors(N)))
Problem p02684 (python)

Fixed submission:
n, k = map(int, input().split())
a = list(map(int, input().split()))
s = []
x = [0] * n
x.append(0)
v = 1
c = 1
l = 0
while x[v] == 0:
    x[v] = len(s)
    s.append(v)
    v = a[v-1]
c = len(s) - x[v]
l = x[v]


if k < l:
    print(s[k])
else:
    k -= l
    k = k % c
    print(s[l+k])

Buggy submission (verdict: Runtime Error):
n, k = map(int, input().split())
a = list(map(int, input().split()))
tmp = a[0]
tmp0 = tmp
x = 0

for i in range(k-1):
    tmp = a[tmp-1]
    if tmp == tmp0:
        x = i
        break

ans = a[0]
for i in range(k % x):
    ans = a[ans-1]
print(ans)
Problem p02952 (python)

Fixed submission:
n = int(input())
ans = 0
for i in range(1, n + 1):
    if len(str(i)) % 2 == 1:
        ans += 1
print(ans)

Buggy submission (verdict: Runtime Error):
a, b, c = map(int, input().split())
if c - (a - b) <= 0:
    print(0)
else:
    print(c - (a-b))
Problem p03262 (python)

Fixed submission:
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import sys

input = sys.stdin.readline
n, x = map(int, input().split())
a = input().split()
b = list(map(int, a))
b.append(x)
b.sort()
if len(b) == 2:
    print(b[1] - b[0])
    exit(0)
c = [abs(a - x) for a in b]


def gcd(a, b):
    while b > 0:
        a, b = b, a % b
    return a


ans = c[0]
for i in range(len(c)):
    ans = gcd(c[i], ans)
print(ans)

Buggy submission (verdict: Runtime Error):
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import sys
import functools

input = sys.stdin.readline
n, x = map(int, input().split())
a = input().split()
b = list(map(int, a))
b.append(x)
b.sort()
c = []
if len(b) == 2:
    print(b[1] - b[0])
    exit(0)
for i in range(1, n - 1):
    c.append(b[i] - b[i - 1])


def gcd(a, b):
    while b > 0:
        a, b = b, a % b
    return a

ans = c[0]
for i in range(len(c)):
    ans = gcd(c[i], ans)
print(ans)

Buggy submission (verdict: Runtime Error):
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import sys
import functools

input = sys.stdin.readline
n, x = map(int, input().split())
a = input().split()
b = list(map(int, a))
b.append(x)
b.sort()
c = []
if len(b) == 2:
    print(b[1] - b[0])
    exit(0)
for i in range(1, n - 1):
    c.append(b[i] - b[i - 1])


def gcd(a, b):
    while b > 0:
        a, b = b, a % b
    return a

ans = functools.reduce(gcd, c)
print(ans)

Buggy submission (verdict: Runtime Error):
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import sys
import functools
import math

input = sys.stdin.readline
n, x = map(int, input().split())
a = input().split()
b = list(map(int, a))
b.append(x)
b.sort()
c = []
if len(b) == 2:
    print(b[1] - b[0])
    exit(0)
for i in range(1, n - 1):
    c.append(b[i] - b[i - 1])

gcd = functools.reduce(math.gcd, c)
print(gcd)

Buggy submission (verdict: Runtime Error):
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import sys
import functools
import math

input = sys.stdin.readline
n, x = map(int, input().split())
a = input().split()
b = list(map(int, a))
b.append(x)
b.sort()
c = []
for i in range(n):
    if i <= n - 1:
        c.append(b[i + 1] - b[i])
gcd = functools.reduce(math.gcd, c)

print(gcd)

Buggy submission (verdict: Runtime Error):
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import sys
import functools
import math

input = sys.stdin.readline
n, x = map(int, input().split())
a = input().split()
b = list(map(int, a))
b.append(x)
b.sort()
c = []
for i in range(1, n):
    c.append(b[i] - b[i - 1])
gcd = functools.reduce(math.gcd, c)
print(gcd)

Buggy submission (verdict: Runtime Error):
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import sys
import functools
import math

input = sys.stdin.readline
n, x = map(int, input().split())
a = input().split()
b = list(map(int, a))
b.append(x)
b.sort()
c = []
for i in range(n):
    if i <= n - 1:
        c.append(b[i + 1] - b[i])
gcd = functools.reduce(math.gcd, c)
print(gcd)
Problem p02628 (python)

Fixed submission:
N, K = map(int, input().split())
P = list(map(int, input().split()))
P.sort()
ans = 0
for p in P[:K]:
    ans += p
print(ans)

Buggy submission (verdict: Runtime Error):
N, K = map(int, input().split())
P = list(map(int, input().split())).sort()
print(sum(P[:K]))
Problem p02639 (python)

Fixed submission:
x_list = list(map(int, input().split()))
for i, num in enumerate(x_list):
    if num == 0:
        print(i+1)
        break

Buggy submission (verdict: Runtime Error):
X, Y = map(int, input().split())
print("Yes" if 2*Y <= X <= 4*Y and Y%2 == 0 else "No")
Problem p02642 (python)

Fixed submission:
N = int(input())
A_list = list(map(int, input().split()))
M = 10**6+1
cnt = [0 for _ in range(M)]

for i in A_list:
    if cnt[i] != 0:
        cnt[i] = 2
        continue
    for j in range(i, M, i): cnt[j] += 1

ans = 0
for k in A_list:
    if cnt[k] == 1: ans += 1
print(ans)

Buggy submission (verdict: Runtime Error):
N = int(input())
A_list = list(map(int, input().split()))
M = 2*10**5+1
cnt = [0 for _ in range(M)]

for i in A_list:
    if cnt[i] != 0:
        cnt[i] = 2
        continue
    for j in range(i, M, i): cnt[j] += 1

ans = 0
for k in A_list:
    if cnt[k] == 1: ans += 1
print(ans)
Problem p02657 (python)

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

Buggy submission (verdict: Runtime Error):
def factorization(n):
    arr = []
    for i in range(2, int(-(-n**0.5//1))+1):
        if n%i==0:
            cnt=0
            while n%i==0:
                cnt+=1
                n //= i
            arr.append([i, cnt])

    if n != 1:
        arr.append([n, 1])

    return arr
N = int(input())
ans = 0
if N != 1:
    fact_list = factorization(N)
    for _, i in fact_list:
        j = 1
        while i >= j:
            ans += 1
            i = i - j
            j += 1
            
print(ans)

Buggy submission (verdict: Runtime Error):
input()
int_list = list(map(int, input().split()))
max_num = 10**18
ans = 1

if 0 in int_list:
  print(0)
  exit()
  
for i in int_list:
    ans *= i
    if ans > max_num:
            print(-1)
        break
else:
    print(ans)
Problem p02660 (python)

Fixed submission:
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
N = int(input())
ans = 0
if N != 1:
    fact_list = factorization(N)
    for _, i in fact_list:
        j = 1
        while i >= j:
            ans += 1
            i = i - j
            j += 1
            
print(ans)

Buggy submission (verdict: Runtime Error):
def factorization(n):
    arr = []
    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])

    return arr
N = int(input())
ans = 0
if N != 1:
    fact_list = factorization(N)
    for _, i in fact_list:
        j = 1
        while i >= j:
            ans += 1
            i = i - j
            j += 1
            
print(ans)
Problem p02687 (python)

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

Buggy submission (verdict: Runtime Error):
n = int(input())
 
a = [i**5 for i in range(120)]
for i in range(119):
    for j in range(i+1,119):
        if a[j]-a[i] == n:
            print(j,i)
            break
        if a[j]+a[i] == n:
            print(j,-i)
            break
    else: continue
    break
Problem p02621 (python)

Fixed submission:
a = int(input())
print(a + (a * a) + (a * a * a))

Buggy submission (verdict: Runtime Error):
print(a + (a*a) + (a*a*a))
Problem p02639 (python)

Fixed submission:
a,b,c,d,e=map(int,input().split())
if a==0:
  print(1)
elif b==0:
  print(2)
elif c==0:
  print(3)
elif d==0:
  print(4)
else:
  print(5)

Buggy submission (verdict: Runtime Error):
a,b,c,d,e=map(int,input().split())
if a = 0:
  print(1)
elif b = 0:
  print(2)
elif c = 0:
  print(3)
elif d = 0:
  print(4)
else:
  print(5)
Problem p02641 (python)

Fixed submission:
x,n = map(int, input().split())
a = list(map(int,input().split()))
c = -1
b = 0
d = 101
e = 0
for w in range(103):
  if c not in a:
    b = abs(x - c)
    if b < d:
      d = b
      e = c
      c += 1
    else:
      c += 1
  else:
    c += 1
print(e)

Buggy submission (verdict: Runtime Error):
x,n = map(int, input().split())
a = []
for i in range(n):
    a.append(input())
c = -1
b = 0
d = 101
e = 0
for w in range(103):
  if c not in a:
    b = abs(x - c)
    if b < d:
      d = b
      e = c
      c += 1
    else:
      c += 1
  else:
    c += 1
print(e)

Buggy submission (verdict: Runtime Error):
x,n = map(int, input().split())
a = []
for i in range(n):
    a.append(input())
c = -1
b = 0
d = 101
e = 0
for w in range(103):
  if c not in a:
	b = abs(x - c)
    if b < d:
      d = b
      e = c
      c += 1
    else:
      c += 1
  else:
    c += 1
print(e)
Problem p03740 (python)

Fixed submission:
#!/usr/bin/env python
# -*- coding: utf-8 -*-

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

if abs(A - B) < 2:
	print("Brown")
else:
	print("Alice")

Buggy submission (verdict: Runtime Error):
#!/usr/bin/env python
# -*- coding: utf-8 -*-

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

if abs(A - B) < 2
	print("Brown")
else:
	print("Alice")
Problem p02861 (python)

Fixed submission:
import math

N = int(input())
list_1 = []
for i in range(N):
    list_1.append(list(map(int, input().split())))

m = 0
for list_i in list_1:
    for list_j in list_1:
        if list_i != list_j:
            d = math.sqrt((list_j[0]-list_i[0])**2 + (list_j[1]-list_i[1])**2)
            m += d

average = m / N
print(average)

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

m = 0
for list_i in list_1:
    for list_j in list_1:
        if list_i != list_j:
            d = math.sqrt((list_j[0]-list_i[0])**2 + (list_j[1]-list_i[1])**2)
            m += d

average = m / N
print(average)
Problem p02882 (python)

Fixed submission:
from math import atan, degrees

a,b,x = map(float, input().split())

D = a**2 * b / 2
S = x/a

if x == a ** 2 * b:
  deg = 90
  
elif x < D:
  Z = a - 2*S/b
  rad = atan((a-Z) / b)
  deg = degrees(rad)
  
elif x > D:
  Y = 2*S/a - b
  rad = atan(a / (b-Y))
  deg = degrees(rad)
  
else:
  rad = atan(a / b)
  deg = degrees(rad)

print(90-deg)

Buggy submission (verdict: Runtime Error):
from math import atan, degrees

a,b,x = map(float, input().split())

D = a**2 * b / 2
S = x/a

if x < D:
  Z = a - 2*S/b
  rad = atan((a-Z) / b)
  deg = degrees(rad)
  
elif x > D:
  Y = 2*S/a - b
  rad = atan(a / (b-Y))
  deg = degrees(rad)
  
else:
  rad = atan(a / b)
  deg = degrees(rad)

print(90-deg)

Buggy submission (verdict: Runtime Error):
from math import atan, degrees

a,b,x = map(int, input().split())

D = 1/2 * a**2 * b
S = x/a

if x < D:
  Z = a - 2*S/b
  rad = atan((a-Z) / b)
  deg = degrees(rad)
  
elif x > D:
  Y = 2*S/a - b
  rad = atan(a / (b-Y))
  deg = degrees(rad)
  
elif x == D:
  rad = atan(a / b)
  deg = degrees(rad)

print(90-deg)

Buggy submission (verdict: Runtime Error):
from math import atan, degrees

a,b,x = map(int, input().split())

D = 1/2 * a**2 * b
S = x/a

if x < D:
  Z = a - 2*S/b
  rad = atan((a-Z) / b)
  deg = degrees(rad)
  
elif x > D:
  Y = 2*S/a - b
  rad = atan(a / (b-Y))
  deg = degrees(rad)
  
elif x == D:
  rad = atan(a / b)
  deg = degrees(rad)

print(90-deg)

Buggy submission (verdict: Runtime Error):
from math import atan, degrees

a,b,x = map(int, input().split())

D = 1/2 * a**2 * b
S = x/a

if x < D:
  Z = a - 2*S/b
  rad = atan((a-Z) / b)
  deg = degrees(rad)
  
elif x > D:
  Y = 2*S/a - b
  rad = atan(a / (b-Y))
  deg = degrees(rad)
  
elif x == D:
  rad = atan(a / b)
  deg = degrees(rad)

print(90-deg)
Problem p02612 (python)

Fixed submission:
n = input()
n_l = int(n[-3:])
if n_l==0:
    print(0)
else:
    print(1000-n_l)

Buggy submission (verdict: Runtime Error):
n = input()
n_l = int(n[1:])
if n_l==0:
    print(0)
else:
    print(1000-n_l)
Problem p02639 (python)

Fixed submission:
n=list(map(int,input().split()))
print(n.index(0)+1)

Buggy submission (verdict: Runtime Error):
n=list(map(int,input().split()))
print(n.index(0)+1)
Problem p02886 (python)

Fixed submission:
import itertools
n=int(input())
l=list(map(int,input().split()))
c=itertools.combinations(l,2)
ans=sum(x*y for x,y in c)
print(ans)

Buggy submission (verdict: Runtime Error):
n=int(input())
l=list(map(int,input().split()))
c=itertools.combinations(l,2)
ans=sum(x*y for x,y in c)
print(ans)
Problem p02994 (python)

Fixed submission:
n,l=map(int,input().split())
l1=list(int(l)+i-1 for i in range(1,n+1))
n1=sum(l1)
ans=min(l1,key=abs)

print(n1-(ans))

Buggy submission (verdict: Runtime Error):
n,l=map(int,input().split())
l1=list(int(l)+i-1 for i in range(1,n+1))
l2=100
n1=sum(l1)

for i in range(1,n+1):
    if l2>abs(int(l)+i-1):
        l2=abs(int(l)+i-1)
        x=i

print(n1-l1[x-1])
Problem p03030 (python)

Fixed submission:
n=int(input())
l=[input().split() for i in range(n)]
l2=[x for x in range(n)]
base=list(zip(l2,l))
ans=sorted(base, key=lambda x: int(x[1][1]),reverse=True)
ans=sorted(ans,key=lambda x: x[1][0])

for i in range(n):
    print(1+ans[i][0])

Buggy submission (verdict: Runtime Error):
n=int(input())
l=[input().split() for i in range(n)]
l2=[x for x in range(10)]
base=list(zip(l2,l))
ans=sorted(base, key=lambda x: x[1][1],reverse=True)
ans=sorted(ans,key=lambda x: x[1][0])

for i in range(n):
    print(1+ans[i][0])

Buggy submission (verdict: Runtime Error):
n=int(input())
l=[input().split() for i in range(n)]
tmp=sorted(l, key=lambda x: x[1],reverse=True)
tmp=sorted(tmp,key=lambda x: x[0])
l2=[x for x in range(10)]
ans=list(zip(l2,tmp))

for i in range(n):
    print(1+ans[i][0])
Problem p02639 (python)

Fixed submission:
try:
  a=list(map(int,input().split()))
  for i in range(len(a)):
    if a[i]==0:
      print(i+1)
      break
except:
  pass

Buggy submission (verdict: Runtime Error):
a,l=map(int,input().split())
s=0
if l/a==2 or l/a==4:
	print("YES")
else:
	f=a*4
	if f>l:
		while f>l:
			f=f-2
		if f==l:
			print("YES")			
		else:
			print("NO")
	else:
		print("NO")
Problem p02640 (python)

Fixed submission:
a,l=map(int,input().split())
s=0
if l<a or a==0:
	print("No")
elif l/a==2 or l/a==4:
	print("Yes")

else:
	f=a*4
	if f>l:
		for i in range(a):
			f=f-2
			if f==l:
				print("Yes")
				break			
		else:
			print("No")
	else:
		print("No")

Buggy submission (verdict: Runtime Error):
a,l=map(int,input().split())
s=0
if l/a==2 or l/a==4:
	print("YES")
else:
	t,f=0,0
	for i in range(1,a+1):
		t+=i*2
		f+=i*4
if f>l:
	while f!=l:
		f=f-2
	if f==l:
		print("YES")
	else:
		print("NO")
else:
	print("NO")
Problem p02765 (python)

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

if N >= 10:
    print(R)
else:
    print(R+100*(10-N))

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

if N >= 10:
  print(R)
else:
  print(R+100*(10-N))
Problem p02845 (python)

Fixed submission:
N = int(input())
A = map(int, input().split())
MOD = 1000000007
ans = 1
cnt = [3 if i == 0 else 0 for i in range(N + 1)]
 
for a in A:
    ans = ans * cnt[a] % MOD
    if ans == 0:
        break
    cnt[a] -= 1
    cnt[a+1] += 1
 
print(ans)

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

c = [-1, -1 ,-1]

sum = 1
tmp = 0
for a in A:
    sum = sum * c.count(A-1) % 1000000007
    if A-1 == c[0]:
        c[0] += 1
        tmp = c.count(c[0] - 1) + 1
    elif A-1 == c[1]:
        c[1] += 1
        tmp = c.count(c[1]-1) + 1
    elif A-1 == c[2]:
        c[2] += 1
        tmp = c.count(c[2] - 1) + 1
print(sum)

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

c = [0, 0, 0]

sum = 1
# print(c)
for a in A:
    # print(a)
    if a == c[0]:
        c[0] += 1
        tmp = c.count(c[0] - 1) + 1
    elif a == c[1]:
        c[1] += 1
        tmp = c.count(c[1]-1) + 1
    elif a == c[2]:
        c[2] += 1
        tmp = c.count(c[2] - 1) + 1
    # print(tmp)
    sum = sum * tmp % 1000000007
    # print(c)
print(sum)

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

# print(A)
c = [0, 0, 0]
# r = 0
# b = 0
# g = 0
sum = 1
# print(c)
for a in A:
    a = int(a)
    # print(a)
    if a == c[0]:
        c[0] += 1
        tmp = c.count(c[0] - 1) + 1
    elif a == c[1]:
        c[1] += 1
        tmp = c.count(c[1]-1) + 1
    elif a == c[2]:
        c[2] += 1
        tmp = c.count(c[2] - 1) + 1
    # print(tmp)
    sum *= tmp
    # print(c)
print(sum % 1000000007)

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

# print(A)
c = [0, 0, 0]
# r = 0
# b = 0
# g = 0
sum = 1
# print(c)
for a in A:
    a = int(a)
    # print(a)
    if a == c[0]:
        c[0] += 1
        tmp = c.count(c[0] - 1) + 1
    elif a == c[1]:
        c[1] += 1
        tmp = c.count(c[1]-1) + 1
    elif a == c[2]:
        c[2] += 1
        tmp = c.count(c[2] - 1) + 1
    # print(tmp)
    sum *= tmp
    # print(c)
print(sum % 1000000007)

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

# print(A)
c = [0, 0, 0]
# r = 0
# b = 0
# g = 0
sum = 1
# print(c)
for a in A:
    # print(a)
    if a == c[0]:
        c[0] += 1
        tmp = c.count(c[0] - 1) + 1
    elif a == c[1]:
        c[1] += 1
        tmp = c.count(c[1]-1) + 1
    elif a == c[2]:
        c[2] += 1
        tmp = c.count(c[2] - 1) + 1
    # print(tmp)
    sum *= tmp
    # print(c)
print(sum % 1000000007)

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

# print(A)
c = [0, 0, 0]
# r = 0
# b = 0
# g = 0
sum = 1
# print(c)
for a in A:
    # print(a)
    if a == c[0]:
        c[0] += 1
        tmp = c.count(c[0] - 1) + 1
    elif a == c[1]:
        c[1] += 1
        tmp = c.count(c[1]-1) + 1
    elif a == c[2]:
        c[2] += 1
        tmp = c.count(c[2] - 1) + 1
    # print(tmp)
    sum *= tmp
    # print(c)
print(sum)
Problem p02854 (python)

Fixed submission:
N = int(input())
# A = input().split()
A = list(map(int, input().split()))
# f = open("tmp.text")
# A = list(map(int, f.read().split()))



# left = 0
# right = N - 1
# tmp = 10**9
# while True:
#     # print(left)
#     # print(right)
#     mid = (left + right) // 2
#     # print("mid: " + str(mid))
#     lnum = A[:mid+1]
#     rnum = A[mid+1:]
#     # print(lnum)
#     # print(rnum)
#     new = abs(sum(lnum) - sum(rnum))
#     if tmp == new:
#         break
#     if tmp > new:
#         tmp = new
#     if lnum > rnum:
#         right = mid

#     # print("tmp: "+str(tmp))
#     # input()
#     if left == right:
#         break

# print(tmp)



left = A[0]
right = A[-1]

front = 1
back = 1
for _ in range(N-2):
    if left > right:
        right += A[-1 - back]
        back += 1
    else:
        left += A[front]
        front += 1

print(abs(left-right))

Buggy submission (verdict: Runtime Error):
N = int(input())
# A = input().split()
# A = list(map(int, input().split()))
f = open("tmp.text")
A = list(map(int, f.read().split()))



# left = 0
# right = N - 1
# tmp = 10**9
# while True:
#     # print(left)
#     # print(right)
#     mid = (left + right) // 2
#     # print("mid: " + str(mid))
#     lnum = A[:mid+1]
#     rnum = A[mid+1:]
#     # print(lnum)
#     # print(rnum)
#     new = abs(sum(lnum) - sum(rnum))
#     if tmp == new:
#         break
#     if tmp > new:
#         tmp = new
#     if lnum > rnum:
#         right = mid

#     # print("tmp: "+str(tmp))
#     # input()
#     if left == right:
#         break

# print(tmp)



left = A[0]
right = A[-1]

front = 1
back = 1
for _ in range(N-2):
    if left > right:
        right += A[-1 - back]
        back += 1
    else:
        left += A[front]
        front += 1

print(abs(left-right))
Problem p02899 (python)

Fixed submission:
N = input()
N = int(N)
ans = [0]*N
A = input().split()

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

for i in ans:
    print(i, end=" ")

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

A = input().split()
for i in range(len(A)):
    ans.append(0)

for i in range(len(A)):
    print(A.index(str(i+1))+1, end=" ")
Problem p02684 (python)

Fixed submission:
n,k = map(int,input().split())
a = [int(i)-1 for i in input().split()]
loc = 0
lst = [False]*n
lst[0] = True
while True:
    if lst[a[loc]]:
        x = a[loc]
        break
    loc = a[loc]
    lst[loc] = True
cnt = 0
loc = 0
if x != 0:
    while True:
        loc = a[loc]
        cnt += 1
        if loc == x: break
cnt2 = 0
while True:
    loc = a[loc]
    cnt2 += 1
    if loc == x: break
if k >= cnt:
    k -= cnt
    k %= cnt2
    loc = x
    while k > 0:
        loc = a[loc]
        k -= 1
else:
    loc = 0
    while k > 0:
        loc = a[loc]
        k -= 1
print(loc+1)

Buggy submission (verdict: Runtime Error):
n,k = map(int,input().split())
a = [int(i)-1 for i in input().split()]
loc = 0
cnt1 = 0
seen = [False]*n
seen[0] = True
while not seen[loc]:
    loc = a[loc]
    cnt1 += 1
    if cnt1 == k:
        print(loc+1)
        exit()
cnt2 = 0
x = loc
while loc != x:
    loc = a[loc]
    cnt2 += 1
cnt1 -= cnt2
k = (k-cnt1)%cnt2
loc = 0
while k > 0:
    loc = a[loc]
    k -= 1
print(loc+1)
Problem p02727 (python)

Fixed submission:
x,y,a,b,c = map(int,input().split())
p = [int(i) for i in input().split()]
q = [int(i) for i in input().split()]
r = [int(i) for i in input().split()]
p.sort(reverse=True)
q.sort(reverse=True)
for i in range(x): r.append(p[i])
for i in range(y): r.append(q[i])
r.sort(reverse=True)
print(sum(r[:x+y]))

Buggy submission (verdict: Runtime Error):
x,y,a,b,c = map(int,input().split())
p = [int(i) for i in input().split()]
q = [int(i) for i in input().split()]
r = [int(i) for i in input().split()]
p.sort(reverse=True)
q.sort(reverse=True)
for i in range(x): r.append(p[i])
for i in range(y): r.append(q[i])
r.sort(reverse=True)
print(sum(r[:x+y])
Problem p02789 (python)

Fixed submission:
n,m = map(int,input().split())
ans = "Yes" if n == m else "No"
print(ans)

Buggy submission (verdict: Runtime Error):
n = int(input())
p = [int(i) for i in input().split()]

t = p[0]
ans = 0
for i in range(n):
    if t >= p[i]:
        ans += 1
        t = p[i]

print(ans)
Problem p02797 (python)

Fixed submission:
n,k,s = map(int,input().split())
x = [0]*n
for i in range(n):
    if i < k:
        x[i] = s
    else:
        if s != 10**9:
            x[i] = s+1
        else:
            x[i] = 1

for i in range(n-1):
    print(x[i],end=" ")
else:
    print(x[n-1])

Buggy submission (verdict: Runtime Error):
n,k,s = map(int,input().split())
x = [0]*n
for i in range(k):
    x[i] = s
if k != n:
    x[i+1] = 1 if s != 1 else 2

for i in range(n-1):
    print(x[i],end=" ")
else:
    print(x[i+1])

Buggy submission (verdict: Runtime Error):
n,k,s = map(int,input().split())
x = [0]*n
for i in range(k):
    x[i] = s
else:
    x[i+1] = 1 if s != 1 else 2

for i in range(n-1):
    print(x[i],end=" ")
else:
    print(x[i+1])