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

Fixed submission:
N=input()
a=[]
a=N

b=a[int(len(N))-1]

b=int(b)

if(b in [0,1,6,8]):
    print('pon')

elif(b in [3]):
    print('bon')

else:

    print('hon')

Buggy submission (verdict: Runtime Error):
A,B,H,M=map(int,input().split())
import math
H_k=H*30
M_k=M*6
if(M_k==0):
    M_k=360
if(H_k-M_k<=180 ):
    x=H_k-M_k
else:
    x=M_k-H_k
x=abs(x)

if(x==90):
    print((A**2+B**2)**0.5)
elif(x==180):
    print(A+B)
else:

    z=((A*math.sin(math.radians(x)))**2+(B-A*math.cos(math.radians(x)))**2)**0.5
    print(z)
Problem p02684 (python)

Fixed submission:
N, K = map(int, input().split())
A = [int(a) - 1 for a in input().split()]

if K <= N:
    p = 0
    for i in range(K):
        p = A[p]
    print(p + 1)
    exit()

p = 0
t = [-1] * N
t[0] = 0
for i in range(1, N):
    p = A[p]
    if t[p] != -1:
        break
    t[p] = i

d = i - t[p]
K -= i
K %= d

for i in range(K):
    p = A[p]
print(p + 1)

Buggy submission (verdict: Runtime Error):
N,K=map(int,input().split())
A=[int(i) for i in input().split()]
B=[-1 for i in range(N+1)]
C=[0 for i in range(N)]

B[1]=1
i=0

C[0]=1
for i in range(1,N+1):

    if(B[A[C[i-1]-1]]==-1):

        B[A[C[i-1]-1]]=A[C[i-1]-1]
        C[i]=A[C[i-1]-1]




    else:
        bfirst=C.index(A[C[i-1]-1])
        blast=i

        roop=blast-bfirst

        ans=(K-bfirst)%roop

        print(C[bfirst+ans])
        while(1):
            print(f)
        exit()

Buggy submission (verdict: Runtime Error):
N,K=map(int,input().split())
A=[int(i) for i in input().split()]
B=[1]
i=0
for i in range(K):

    B.append(A.index(B[i])+1)

    if(len(set(B))!=i+2):

        blast=B[-1]
        bfirst=B.index(blast)
        roop=len(B)-bfirst
        ans=(K-bfirst)%roop
        print(B[ans])
        exit()
Problem p02700 (python)

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


while(1):

    C=C-B
    if(C<=0):
        print('Yes')
        exit(0)
    A=A-D
    if(A<=0):
        print('No')
        exit(0)

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

if(abs(C/B+1)>abs(A/C+1):
    print('No')

else:
    print('Yes')

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

if(abs(C/B+1)>abs(A/C+1):
    print('No')

else:
    print('Yes')
Problem p02705 (python)

Fixed submission:
import math
a=int(input())
print(2*a*math.pi)

Buggy submission (verdict: Runtime Error):
N,K=map(int,input().split())
wa=0
for i in range(N+1-K):
    n=i+K
    min=(n)*(0+n-1)/2
    max=(n)*(N-n+1+N)/2

    wa=max-min+wa+1


wa=wa+1
wa=wa%(10**9+7)
print(int(wa)
Problem p02708 (python)

Fixed submission:
N,K=map(int,input().split())
wa=0
for i in range(N+1-K):
    n=i+K
    min=(n)*(0+n-1)/2
    max=(n)*(N-n+1+N)/2

    wa=max-min+wa+1


wa=wa+1
wa=wa%(10**9+7)
print(int(wa))

Buggy submission (verdict: Runtime Error):
N,K=map(int,input().split())
wa=0
for i in range(N+1-k+1):
    n=i+K
    min=(n)*(0+n-1)/2
    max=(n)*(N-n+1+N)/2

    wa=max-min+wa
    
print(wa)
Problem p02719 (python)

Fixed submission:
N,K=map(int,input().split())
n_b=N
a=N%K
if(K/2<a):
    print(abs(a-K))
else:
    print(a)

Buggy submission (verdict: Runtime Error):
N,K=map(int,input().split())
n_b=N
a=N%k
if(K/2<a):
    print(a-k)
else:
    print(a)
Problem p02761 (python)

Fixed submission:
N,M=map(int,input().split())
s=[0]*M
c=[0]*M
for i in range(M):
    s[i],c[i]=map(int,input().split())
ans=['#' for i in range(N+1)]

for i in range(M):
    if(ans[s[i]]=='#'):
        ans[s[i]]=str(c[i])
    for j in range(i+1,M):
        if(s[i]==s[j]):
            if(c[i]!=c[j]):
                print('-1')
                exit()

if(2<=N):
    if(ans[1]=='#'):
        ans[1]='1'
    elif(ans[1]=='0'):
        print('-1')
        exit()
else:
    if(ans[1]=='#'):
        ans[1]=0
        pass
    print(ans[1])
    exit()
a=ans[1:]

a=''.join(a).replace('#','0')
print(a)

Buggy submission (verdict: Runtime Error):
N,M=map(int,input().split())
s=[0]*M
c=[0]*M
for i in range(M):
    s[i],c[i]=map(int,input().split())
ans=[0 for i in range(N+1)]
if(N<max(s)):
    print('-1')
    exit()

else:
    for i in range(M-1):
        if(ans[s[i]]==0):
            ans[s[i]]=c[i]
        for j in range(i+1,M):
            if(s[i]==s[j]):
                if(c[i]!=c[j]):
                    print('-1')
                    exit()


an=0
for i in range(1,N+1):
    if(ans[i]==0):
        pass
    else:
        an=ans[i]*10**(N-i)+an
if(ans[1]==0):
    print('-1')
    exit()
if(an<=0):
    print('-1')
    exit()
print(an)

Buggy submission (verdict: Runtime Error):
N,M=map(int,input().split())
s=[0]*M
c=[0]*M
for i in range(M):
    s[i],c[i]=map(int,input().split())
ans=[0 for i in range(N+1)]
if(N<max(s)):
    print('-1')
    exit()

else:
    for i in range(M-1):
        if(ans[s[i]]==0):
            ans[s[i]]=c[i]
        for j in range(i+1,M):
            if(s[i]==s[j]):
                if(c[i]!=c[j]):
                    print('-1')
                    exit()


an=0
for i in range(1,N+1):
    if(ans[i]==0):
        pass
    else:
        an=ans[i]*10**(N-i)+an

if(an<=0):
    print('-1')
    exit()
print(an)
Problem p02616 (python)

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

pos, neg = [], []
zero_count = 0

for x in a:
	if x > 0:
		pos.append(x)
	elif x < 0:
		neg.append(x)
	else:
		zero_count += 1

# max_v = pos[0]
# min_v = neg[0]

# max_p_idx = 1
# max_n_idx = 0
# min_p_idx = 0
# min_n_idx = 1

# for kk in range(1, min(k, len(pos) + len(neg))):
# 	if max_p_idx < len(pos):
# 		max_v 


MOD = 10**9 + 7

neg = list(sorted(neg))
pos = list(reversed(sorted(pos)))

if len(pos) >= k:
	#print('case 1')
	pos_res = pos[:k]
	idx = 0
	while idx + 1 < len(neg) and pos_res[k - idx - 1] * pos_res[k - idx - 2] < neg[idx] * neg[idx + 1]:
		idx += 2

	result = 1
	for i in range(idx):
		result = result * neg[i] % MOD

	for i in range(k - idx):
		result = result * pos[i] % MOD

	print(result)

else:
	#print('case 2')
	left = k - len(pos)	
	if left % 2 == 1:
		if len(pos) > 0:
			left += 1
		else:
			left = 1000000000
	if left > len(neg):
		#print('case 3')
		b = list(sorted(map(abs, a)))
		result = 1
		for i in range(k):
			result = result * b[i] % MOD
		print(-result % MOD)
	else:
		#print("left = ", left)
		idx = left
		pos_shift = 0
		while idx + 1 < len(neg) and pos_shift + 1 < len(pos) and pos[len(pos) - pos_shift - 1] * pos[len(pos) - pos_shift - 2] < neg[idx] * neg[idx + 1]:
			idx += 2
			pos_shift += 2

		result = 1
		for i in range(idx):
			result = result * neg[i] % MOD

		for i in range(k - idx):
			result = result * pos[i] % MOD

		print(result)

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

pos, neg = [], []
zero_count = 0

for x in a:
	if x > 0:
		pos.append(x)
	elif x < 0:
		neg.append(x)
	else:
		zero_count += 1

# max_v = pos[0]
# min_v = neg[0]

# max_p_idx = 1
# max_n_idx = 0
# min_p_idx = 0
# min_n_idx = 1

# for kk in range(1, min(k, len(pos) + len(neg))):
# 	if max_p_idx < len(pos):
# 		max_v 


MOD = 10**9 + 7

if len(pos) >= k:
	pos_res = pos[:k]
	idx = 0
	while idx + 1 < len(neg) and pos_res[k - idx - 1] * pos_res[k - idx - 2] < neg[idx] * neg[idx + 1]:
		idx += 2

	result = 1
	for i in range(idx):
		result = result * neg[i] % MOD

	for i in range(k - idx):
		result = result * pos[i] % MOD

	print(result)

else:
	left = k - len(pos)
	if left > len(neg):
		print(0) 
	else:
		if left % 2 == 0:
			idx = left
			while idx + 1 < len(neg) and pos_res[k - idx - 1] * pos_res[k - idx - 2] < neg[idx] * neg[idx + 1]:
				idx += 2

			result = 1
			for i in range(idx):
				result = result * neg[i] % MOD

			for i in range(k - idx):
				result = result * pos[i] % MOD

			print(result)
		else:
			if zero_count > 0:
				print(0)
			else:
				b = sorted(map(abs, a))
				result = 1
				for i in range(k):
					result = result * b[i] % MOD
				print(result)
Problem p02555 (python)

Fixed submission:
def f(n):
  res = 1
  if n <= 1:
    return 1
  while n>1:
    res *= n
    n-=1
  return res
 
def h(n,m):
  return f(n+m-1)//f(n)//f(m-1)
 
s=int(input())
 
res = 0
 
pair = s//3
 
for i in range(1,pair+1):
  res += h(s-3*i,i)
print(res%(10**9+7))

Buggy submission (verdict: Runtime Error):
def f(n):
  if n <= 1:
    return 1
  return f(n-1)*n
 
def h(n,m):
  return f(n+m-1)//f(n)//f(m-1)
 
s=int(input())
 
res = 0
 
pair = s//3
 
for i in range(1,pair+1):
  res += h(s-3*i,i)
print(res%(10**9+7))

Buggy submission (verdict: Runtime Error):
def f(n):
  if n <= 1:
    return 1
  return f(n-1)*n

def h(n,m):
  return f(n+m-1)/f(n)/f(m-1)

s=int(input())

res = 0

pair = s//3

for i in range(1,pair+1):
  res += h(s-3*i,i)
print(res)
Problem p02556 (python)

Fixed submission:
n = int(input())
xy = []
for _ in range(n):
    xy.append(list(map(int,input().split())))
a,b=xy[0]
m1=a+b
p1=xy[0]
m2=a-b
p2=xy[0]
p3=xy[0]
p4=xy[0]
m3=-a-b
m4=-a+b

for x,y in xy:
    if x+y > m1:
        m1=x+y
        p1 = [x,y]
    if x-y > m2:
        m2=x-y
        p2 = [x,y]
    if -x-y > m3:
        m3 = -x-y
        p3 = [x,y]
    if -x+y > m4:
        m4 = -x+y
        p4 = [x,y]
m = 0
for x0,y0 in [p1,p2,p3,p4]:
    for x1,y1 in [p1,p2,p3,p4]:
        dis=abs(x0-x1) + abs(y0-y1)
        if dis > m:
            m = dis
print(m)

Buggy submission (verdict: Runtime Error):
n = int(input())
xy = [list(map(int,input())) for _ in range(n)]
max = 0
for xy1 in xy:
  for xy2 in xy:
    dis = abs(xy1[0]-xy2[0]) + abs(xy1[1]-xy2[1])
    if dis > max:
      max = dis
print(max)
Problem p03194 (python)

Fixed submission:
import sys

np = input().split()
n = int(np[0])
p = int(np[1])
bound_p = int(p ** (1 / min(n, 4)))


if n == 1:
    print(p)
    sys.exit(0)


ilist = list(range(2, bound_p + 1))
ilist.reverse()


for i in ilist:
    pp = p
    for j in range(n):
        if pp % i != 0:
            break
        pp = pp // i
    else:
        print(i)
        sys.exit(0)


print(1)

Buggy submission (verdict: Runtime Error):
import sys

np = input().split()
n = int(np[0])
p = int(np[1])
bound_p = int(p ** (1 / min(n, 10)))


ilist = list(range(1, bound_p + 1))
ilist.reverse()


for i in ilist:
    pp = p
    for j in range(n):
        if pp % i != 0:
            break
        pp = pp // i
    else:
        print(i)
        sys.exit(0)


print(1)

Buggy submission (verdict: Runtime Error):
import sys

np = input().split()
n = int(np[0])
p = int(np[1])
bound_p = int(p ** (1 / n))


ilist = list(range(1, bound_p + 1))
ilist.reverse()


for i in ilist:
    if p % (i**n) == 0:
        print(i)
        sys.exit(0)

print(1)
Problem p02534 (python)

Fixed submission:
n = int(input())
a = ["ACL"]*n
print(''.join(a))

Buggy submission (verdict: Runtime Error):
n = int(input())
a = ["ACL"]*n
print('',join(a))
Problem p02534 (python)

Fixed submission:
n = int(input())
print('ACL'*n)

Buggy submission (verdict: Runtime Error):
n = int(input())
ptint('ACL'*n)
Problem p02641 (python)

Fixed submission:
x,n = map(int,input().split())
p = list(map(int,input().split()))
p.sort()
li = []
ans = []
Min_sa = 9999999999
for i in range(-200,201):
    if i not in p:
        li.append(i)
for i in li:
     Min_sa = min(Min_sa,abs(x-i))
for i in li:
    if abs(x-i) == Min_sa:
        ans.append(i)
print(min(ans))

Buggy submission (verdict: Runtime Error):
x, n = map(int, input().split())
p = list(map(int, input().split()))
ans = 9999999999
lists = []
if n == 0:
    print(x)
    exit()
for i in range(1, 101):
    if not i in p:
        print(i)
        lists.append(i)
for i in lists:
    if ans > abs(x - i):
        ans = abs(x-i)
        m = i

print(m)

Buggy submission (verdict: Runtime Error):
x, n = map(int, input().split())
p = list(map(int, input().split()))
if n == 0:
    print(x)
    exit()
ans = 9999999999
lists = []
for i in range(1, 101):
    if i not in p:
        lists.append(i)
for i in lists:
    if ans > abs(x - i):
        ans = abs(x-i)
        m = i

print(m)

Buggy submission (verdict: Runtime Error):
x, n = map(int, input().split())
if n == 0:
    print(x)
    exit()
p = list(map(int, input().split()))
ans = 9999999999
lists = []
for i in range(1, 101):
    if i not in p:
        lists.append(i)
for i in lists:
    if ans > abs(x - i):
        ans = abs(x-i)
        m = i

print(m)

Buggy submission (verdict: Runtime Error):
x, n = map(int, input().split())
p = list(map(int, input().split()))
ans = 9999999999
lists = []
for i in range(1, 101):
    if i not in p:
        lists.append(i)
for i in lists:
    if ans > abs(x - i):
        ans = abs(x-i)
        m = i

print(m)

Buggy submission (verdict: Runtime Error):
x, n = map(int, input().split())
p = list(map(int, input().split()))
ans = 9999999999
for i in range(1, 101):
    if i not in p:
        if ans > abs(x - i):
            ans = abs(x-i)
            m = i
print(m)
Problem p02675 (python)

Fixed submission:
N = list(input())
l = len(N)
if N[l-1] == '2' or N[l-1] == '4' or N[l-1] == '5' or N[l-1] == '7' or N[l-1] == '9':
    print('hon')
elif N[l-1] == '0' or N[l-1] == '1' or N[l-1] == '6' or N[l-1] == '8':
    print('pon')
elif N[l-1] == '3':
    print('bon')

Buggy submission (verdict: Runtime Error):
N = input()
if(N[1] == 2, 4, 5, 7, 9):
    print('hon')
elif(N[1] == 0, 1, 6, 8):
    print('pon')
elif(N[1] == 3):
    print('bon')
Problem p02603 (python)

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

kabu = 0
money = 1000
for i in range(N-1):
  if A[i] < A[i+1]:
    mod,money = divmod(money , A[i])
    kabu += mod
  if A[i] > A[i+1]:
    money = money + A[i] * kabu
    kabu = 0

money = money + A[N-1]*kabu
print(money)

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

kabu = 0
money = 1000
for i in range(N-1):
  if A[i] < A[i+1]:
    mod,money = divmod(money , A[i])
    kabu += mod
  if A[i] > A[i+1]
    money = money + A[i+1] * kabu
    kabu = 0

money = money + A[N-1]*kabu
print(money)
Problem p02612 (python)

Fixed submission:
a = int(input())
 
mod = a % 1000

if mod == 0:
  print(0)
else:
  b = mod -1000
  c = int(abs(b))
 
  print(c)

Buggy submission (verdict: Runtime Error):
import sys
 
n, k = map(int, input().split())
a = [int(x) for x in input().split()]
mod = pow(10, 9)+7
zero = 0
plus = []
minus = []
for i in range(n):
  if a[i] == 0:
    zero += 1
  elif a[i] > 0:
    plus.append(a[i])
  else:
    minus.append(a[i])
 
P, M = len(plus), len(minus)
plus.sort(reverse=True)
minus.sort()
ans = 1
if n == k:
  for i in range(n):
    ans *= a[i]
    ans %= mod
elif P+M < k:
  ans = 0
elif P == 0 and k%2 ==1 :
  if zero >= 1:
    ans = 0
  else:
    minus.sort(reverse=True)
    for i in range(k):
      ans *= minus[i]
      ans %= mod
else:
  q = 0
  if k%2 == 1:
    ans *= plus[0]
    ans %= mod
  q = 1
  judge = []
  for i in range((P-q)//2):
    judge.append(plus[2*i+q]*plus[2*i+q+1])
  for i in range(M//2):
    judge.append(minus[2*i]*minus[2*i+1])
  judge.sort(reverse=True)
  for i in range(k//2):
    ans *= (judge[i]%mod)
    ans %= mod
 
print(ans)

Buggy submission (verdict: Runtime Error):
import itertools
import heapq
import sys
import functools
import operator
import numpy as np
input = sys.stdin.readline
#-------------
n,k = map(int,input().split())
a = list(map(int,input().split()))
#-------------
a.sort(reverse = True)
w = 10**9 + 7
ans = 1
if k%2 == 1:
  for i in range(k):
    ans *= a[i]
    print(ans % w)

else:
  if n%2 == 0:
    a_new = [a[2*i]*a[2*i+1] for i in range(n//2)]
    a_new.sort(reverse = True)
    print(a_new)
    for j in range(k//2):
      ans *= a_new[j]
      print(ans % w)
      
  else:
    a_plus = heapq.nlargest(k, a)
    a_minus = heapq.nsmallest(k, a)
    a_plus.sort(reverse = True)
    a_minus.sort()
    a_plus_new = [a_plus[2*i]*a_plus[2*i+1] for i in range(len(a_plus))]
    a_minus_new = [a_minus[2*i]*a_minus[2*i+1] for i in range(len(a_minus))]
    a_new = a_plus_new + a_minus_new
    a_new.sort(revserse = True)
    for j in range(k//2):
      ans *= a_new[j]
      print(ans % w)

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

mod = a % 1000

b = mod - 1000

c = abs(b)

print(c)
Problem p02613 (python)

Fixed submission:
import sys
N = int(input())
s = [input() for i in range(N)]
    
a = s.count("AC")
b = s.count("WA")
c = s.count("TLE")
d = s.count("RE")
 
print("AC"+" x "+str(a))
print("WA"+" x "+str(b))
print("TLE"+" x "+str(c))
print("RE"+" x "+str(d))

Buggy submission (verdict: Runtime Error):
import sys
N = int(input())
s = []
for l in sys.stdin:
    s.append(int(l))
    
a = s.count("AC")
b = s.count("WA")
c = s.count("TLE")
d = s.count("RE")
 
print("AC"+"x"+str(a))
print("WA"+"x"+str(b))
print("TLE"+"x"+str(c))
print("RE"+"x"+str(d))

Buggy submission (verdict: Runtime Error):
import sys
N = int(input())
s = []
for l in sys.stdin:
    s.append(int(l))
    
a = s.count("AC")
b = s.count("WA")
c = s.count("TLE")
d = s.count("RE")

print("AC"+"x"+a)
print("WA"+"x"+b)
print("TLE"+"x"+c)
print("RE"+"x"+d)
Problem p02628 (python)

Fixed submission:
n,k = map(int , input().split( ))
p = list(map(int , input().split( )))
 
p.sort()
 
temp = 0
for i in p[:k] :
  temp += i
print(temp)

Buggy submission (verdict: Runtime Error):
n,k = map(int , input().split( ))
p = list(map(int , input().split( ))
 
p.sort()
 
temp = 0
for i in p[:k] :
  temp += i
print(temp)

Buggy submission (verdict: Runtime Error):
n,k = map(int , input().split( ))
p = list(map(int , input()).split( ))
 
p.sort()
 
temp = 0
for i in p[:k] :
  temp += i
print(temp)

Buggy submission (verdict: Runtime Error):
n,k = map(int , input().split(""))
p = list(map(int , input()).split(""))
 
p.sort()
 
temp = 0
for i in p[:k] :
  temp += i
print(temp)

Buggy submission (verdict: Runtime Error):
n,k = map(int , input().split())
p = list(map(int , input()).split())
 
p.sort()
 
temp = 0
for i in p[:k] :
  temp += i
print(temp)

Buggy submission (verdict: Runtime Error):
n,k = map(int , input().split())
p = list(map(int , input()).split())
 
p1 = sorted(p)
 
temp = 0
for i in p1[:k] :
  temp += i
print(temp)

Buggy submission (verdict: Runtime Error):
n,k = map(int , input().split())
p = list(map(int , input()).split())
 
p1 = sorted(p)
 
temp = 0
for i in p[:k] :
  temp += i
print(temp)

Buggy submission (verdict: Runtime Error):
n,k = map(int , input().split())
p = list(map(int , input()).split())
 
p1 = sorted(p)
 
temp = 0
for i in p[k] :
  temp += i
print(temp)

Buggy submission (verdict: Runtime Error):
n,k = int(input()).split()
p = list(int(input()).split())
 
p1 = sorted(p)
 
temp = 0
for i in p[k] :
  temp += i
print(temp)

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

p1 = sorted(p)

temp = 0
for i in p[k] :
  temp += i
  return temp
print(temp)
Problem p03324 (python)

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

if N == 100:
  N += 1
  
print(N*100**D)

Buggy submission (verdict: Runtime Error):
D , N = map(int, input().split())
C = []
if D == 0 :
  for i in range(1,N**2):
    if i%100 != 0 :
      C.append(i)
  print(C[N-1])

if D == 1:
  print(100*N)
    
if D == 2:
  print(10000*N)

Buggy submission (verdict: Runtime Error):
D , N = map(int, input().split())
C = []
if D == 0 :
  for i in range(N+1):
    if i%100 != 0 :
      C.append(i)

if D == 1:
  for i in range(1,N+1):
    C.append(100 * i)
    
if D == 2:
  for i in range(1,N+1):
    C.append(10000*i)
      
print(C[N-1])
Problem p03331 (python)

Fixed submission:
#-------------
N = int(input())
#-------------

if N%2 == 0:
  k = N//2
else:
  k = (N+1)//2

cmb = []
for i in range(1,k+1):
  cmb.append([i , N-i])
  
def digitSum(n):
    # 数値を文字列に変換
    s = str(n)
    # １文字ずつ数値化し配列にする。
    array = list(map(int, s))
    # 合計値を返す
    return sum(array)

ans = []
for i in range(k-1):
  X = digitSum(cmb[i][0])
  Y = digitSum(cmb[i][1])
  ans.append(X+Y)


if ans == []:
  print("2")
else:
  print(min(ans))

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

if N%2 == 0:
  k = N//2
else:
  k = (N+1)//2

cmb = []
for i in range(1,k):
  cmb.append([i , N-i])

def digitSum(n):
    # 数値を文字列に変換
    s = str(n)
    # １文字ずつ数値化し配列にする。
    array = list(map(int, s))
    # 合計値を返す
    return sum(array)

ans = []
for i in range(k-2):
  X = digitSum(cmb[i][0])
  Y = digitSum(cmb[i][1])
  ans.append(X+Y)

print(min(ans))

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

if N%2 == 0:
  k = N//2
else:
  k = (N+1)//2

cmb = []
for i in range(1,k):
  cmb.append([i , N-i])

def digitSum(n):
    # 数値を文字列に変換
    s = str(n)
    # １文字ずつ数値化し配列にする。
    array = list(map(int, s))
    # 合計値を返す
    return sum(array)

ans = []
for i in range(k-1):
  X = digitSum(cmb[i][0])
  Y = digitSum(cmb[i][1])
  ans.append(X+Y)

print(min(ans))
Problem p03610 (python)

Fixed submission:
#-------------
s = input()
#-------------
if len(s) <= 2:
  print(s[0])

else:
  N = len(s)//2
  q = 0
  if N%2 == 1:
    q=1
  Odd = []
  for i in range(N+q):
    Odd.append(s[2*i])
  Odd = "".join(Odd)
  print(Odd)

Buggy submission (verdict: Runtime Error):
#-------------
s = input()
#-------------
N = len(s)//2
q = 0
if N%2 == 1:
  q=1
Odd = []
for i in range(N+q):
  Odd.append(s[2*i])
Odd = "".join(Odd)
print(Odd)
Problem p02582 (python)

Fixed submission:
num = list(map(str,input()))
if num[0]== 'R' and num[1] =='S':
    print('1')
else:
    print(num.count('R'))

Buggy submission (verdict: Runtime Error):
 a = int(input())
p = list(map(int,input().split()))
 count = 0
  
for i in range(a):
     for s in range(a):
         for t in range(a):
             if p[t]<p[s]<p[i] and p[t]+p[s]>p[i]:
                 count+=1
print(count)
Problem p02583 (python)

Fixed submission:
a = int(input())
p = list(map(int,input().split()))
count = 0

for i in range(a):
     for s in range(a):
         for t in range(a):
             if p[t]<p[s]<p[i] and p[t]+p[s]>p[i]:
                 count+=1
print(count)

Buggy submission (verdict: Runtime Error):
a = int(input())
p = list(map(int,input().split()))
count = 0
 for i in range(a):
     for s in range(a):
         for t in range(a):
             if p[t]<p[s]<p[i] and p[t]+p[s]>p[i]:
                 count+=1
print(count)

Buggy submission (verdict: Runtime Error):
 a = int(input())
 p = list(map(int,input().split()))
 count = 0
 for i in range(a):
     for s in range(a):
         for t in range(a):
             if p[t]<p[s]<p[i] and p[t]+p[s]>p[i]:
                 count+=1
print(count)
Problem p02748 (python)

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

def ri():
    return int(input())

def rl():
    return list(input().split())

def rli():
    return list(map(int, input().split()))

def main():
    a, b, m = rli()
    la = rli()
    lb = rli()
    ans = min(la)+min(lb)
    for i in range(m):
        x, y, c = rli()
        x -= 1
        y -= 1
        ans = min(ans, la[x]+lb[y]-c)
    print(ans)


if __name__ == '__main__':
    main()

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

def ri():
    return int(input())

def rl():
    return list(input().split())

def rli():
    return list(map(int, input().split()))

def main():
    a, b, m = rli()
    la = rli()
    lb = rli()
    ans = min(la)+min(lb)
    for i in range(m):
        x, y, c = rli()
        x -= 1
        y -= 1
        ans = min(ans, la[x]+lb[x]-c)
    print(ans)


if __name__ == '__main__':
    main()