Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
N, M, X = list(map(int, input().split(" ")))

import numpy as np

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

vals = np.array(vals)

import itertools

prod = []
for i in range(1, N+1):
    v = list(itertools.combinations(range(N), i))
    prod.extend(v)
    
money = 1e8

for p in prod:
    ans = np.zeros(4)
    for p_ in p:
        ans += vals[p_]
    if (ans[1] >= X) and (ans[2] >= X) and (ans[3] >= X):
        if money > ans[0]:
            money = ans[0]
 
if money >= 1e8:
    print(-1)
else:
    print(int(money))

Fixed submission:
N, M, X = list(map(int, input().split(" ")))

import numpy as np

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

vals = np.array(vals)

import itertools

prod = []
for i in range(1, N+1):
    v = list(itertools.combinations(range(N), i))
    prod.extend(v)
    
money = 1e10

for p in prod:
    ans = np.zeros(M+1)
    
    for p_ in p:
        ans += vals[p_]
    
    flag = True
    for j in range(M):
        if ans[1+j] < X:
            flag = False
    if flag:
        if money > ans[0]:
            money = ans[0]
 
if money >= 1e10:
    print(-1)
else:
    print(int(money))
Buggy python submission (verdict: Runtime Error):
N, K = list(map(int, input().split(" ")))
A = list(map(int, input().split(" ")))

import numpy as np



Nstock = np.zeros(N)

cpos = 1
Nstock[cpos - 1] = 1
stock = [cpos]
loop = []

idx = 0
for i in range(K):
    cpos = A[cpos-1]
    if Nstock[cpos - 1]  == 1:
        idx = stock.index(cpos)
        loop = stock[idx:]
        break
    Nstock[cpos - 1] = 1
    stock.append(cpos)
    
v = (K - idx) 
a = v %len(loop)

print(loop[a])


Fixed submission:
N, K = list(map(int, input().split(" ")))
A = list(map(int, input().split(" ")))
 
import numpy as np
 
 
 
Nstock = np.zeros(N)
 
cpos = 1
Nstock[cpos - 1] = 1
stock = [cpos]
loop = []
 
idx = 0
for i in range(K):
    cpos = A[cpos-1]
    if Nstock[cpos - 1]  == 1:
        idx = stock.index(cpos)
        loop = stock[idx:]
        break
    Nstock[cpos - 1] = 1
    stock.append(cpos)
    
if loop != []:
    v = (K - idx) 
    a = v %len(loop)
    print(loop[a])
else:
    print(stock[K])
Buggy python submission (verdict: Runtime Error):
import numpy as np
import itertools


N, M, Q = map(int, input().split(" "))

vals = []
for i in range(Q):
    vals.append([list(map(int, input().split(" ")))])
    
maxv = 0
cand = list(itertools.combinations_with_replacement(range(1, M+1), N))
for c in cand:
    sumv = 0
    for v in vals:
        if (c[v[1]-1] - c[v[0]-1]) == v[2]:
            sumv += v[3]
    if maxv < sumv:
        maxv = sumv
print(maxv)

Fixed submission:
import numpy as np
import itertools


N, M, Q = map(int, input().split(" "))

vals = []
for i in range(Q):
    vals.append(list(map(int, input().split(" "))))
    
maxv = 0
cand = list(itertools.combinations_with_replacement(range(1, M+1), N))
for c in cand:
    sumv = 0
    for v in vals:
        if (c[v[1]-1] - c[v[0]-1]) == v[2]:
            sumv += v[3]
    if maxv < sumv:
        maxv = sumv
print(maxv)

Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np
import itertools


N, M, Q = map(int, input().split(" "))

vals = np.empty((0, 4), int)
for i in range(Q):
    vals = np.append(vals, np.array([list(map(int, input().split(" ")))]), axis=0)
vals = vals[np.argsort(vals[:, 3])[::-1]]
    
maxv = 0
cand = list(itertools.combinations_with_replacement(range(1, M+1), N))
for c in cand:
    sumv = 0
    for i, v in enumerate(vals):
        
        if (maxv - sumv) > sum(vals[i:, 3]):
            break
        
        if (c[v[1]-1] - c[v[0]-1]) == v[2]:
            sumv += v[3]
    if maxv < sumv:
        maxv = sumv
print(maxv)

Fixed submission:
import numpy as np
import itertools


N, M, Q = map(int, input().split(" "))

vals = []
for i in range(Q):
    vals.append(list(map(int, input().split(" "))))
    
maxv = 0
cand = list(itertools.combinations_with_replacement(range(1, M+1), N))
for c in cand:
    sumv = 0
    for v in vals:
        if (c[v[1]-1] - c[v[0]-1]) == v[2]:
            sumv += v[3]
    if maxv < sumv:
        maxv = sumv
print(maxv)

Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np
import itertools


N, M, Q = map(int, input().split(" "))

vals = np.empty((0, 4), int)
for i in range(Q):
    vals = np.append(vals, np.array([list(map(int, input().split(" ")))]), axis=0)
    
maxv = 0
cand = list(itertools.combinations_with_replacement(range(1, M+1), N))
for c in cand:
    sumv = 0
    for v in vals:
        if (c[v[1]-1] - c[v[0]-1]) == v[2]:
            sumv += v[3]
    if maxv < sumv:
        maxv = sumv
print(maxv)

Fixed submission:
import numpy as np
import itertools


N, M, Q = map(int, input().split(" "))

vals = []
for i in range(Q):
    vals.append(list(map(int, input().split(" "))))
    
maxv = 0
cand = list(itertools.combinations_with_replacement(range(1, M+1), N))
for c in cand:
    sumv = 0
    for v in vals:
        if (c[v[1]-1] - c[v[0]-1]) == v[2]:
            sumv += v[3]
    if maxv < sumv:
        maxv = sumv
print(maxv)
Buggy python submission (verdict: Runtime Error):
import numpy as np

a, b, c = map(np.float64, input().split(" "))

if (np.sqrt(a) + np.sqrt(b)) < np.sqrt(c):
    print("Yes")
else:
    print("No")

Fixed submission:
v = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
k = int(input())
print(v[k-1])
Buggy python submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
from itertools import itertools_with_replacement
N,M,Q=map(int,input().split())
abcd=[]
for _ in range(Q):
    abcd.append(tuple(map(int,input().split())))
Abase=[]
for a in range(1,M+1):
    Abase=Abase+[a]
A=set(itertools.combinations_with_replacement(Abase,N))
ans=0
for i in A:
    temp=0
    for j in abcd:
        if i[j[1]-1]-i[j[0]-1]==j[2]:
            temp=temp+j[3]
    if temp>=ans:
        ans=temp
print(ans)

Fixed submission:
# -*- coding: utf-8 -*-
K=int(input())
A,B=map(int,input().split())
i=1
ans=0
while B>=K*i:
    if A<=K*i:
        ans=1
        break
    i=i+1
if ans==1:
    print("OK")
else:
    print("NG")
Buggy python submission (verdict: Runtime Error):
# -*- coding:utf-8 -*-
A=int(input())
B=int(input())
if A+B==3:
    print(3)
elif A+B=4:
    print(2)
else:
    print(1)

Fixed submission:
# -*- coding:utf-8 -*-
A=int(input())
B=int(input())
if A+B==3:
    print(3)
elif A+B==4:
    print(2)
else:
    print(1)
Buggy python submission (verdict: Runtime Error):
# -*- coding:utf-8 -*-
N=int(input())
S,T=map(str,input().split())
for i in range(N):
    ans=ans+S[i]+T[i]
print(ans)

Fixed submission:
# -*- coding:utf-8 -*-
N=int(input())
S,T=map(str,input().split())
ans=""
for i in range(N):
    ans=ans+S[i]+T[i]
print(ans)
Buggy python submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
N=int(input())

def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)
    return divisors

ans=make_divisors(N)

temp=ans[0]+ans[1]-2

for i in range(len(ans)):
    if i%2!=0:
        continue
    if temp>ans[i]+ans[i+1]-2:
        temp=ans[i]+ans[i+1]-2
print(temp)

Fixed submission:
# -*- coding: utf-8 -*-
N=int(input())

def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            divisors.append(n//i)
    return divisors

ans=make_divisors(N)

temp=ans[0]+ans[1]-2

for i in range(len(ans)):
    if i%2!=0:
        continue
    if temp>ans[i]+ans[i+1]-2:
        temp=ans[i]+ans[i+1]-2
print(temp)
Buggy python submission (verdict: Time Limit Exceeded):
# -*- coding: utf-8 -*-
N=int(input())
ans=0
for i in range(N):
    ans=ans+i
print(ans)

Fixed submission:
# -*- coding: utf-8 -*-
N=int(input())
ans=((N-1)**2-(N-1))//2+(N-1)
print(ans)
Buggy python submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
S=input()
if S[0]==S[1] and S[2]==S[3] and S[0]!=S[2] :
  print("Yes")
elif S[0]==S[2] and S[1]==S[4] and S[0]!=S[1] :
  print("Yes")
elif S[0]==S[3] and S[1]==S[2] and S[0]!=S[1] :
  print("Yes")
else:
  print("No")

Fixed submission:
# -*- coding: utf-8 -*-
S=input()
if S[0]==S[1] and S[2]==S[3] and S[0]!=S[2] :
  print("Yes")
elif S[0]==S[2] and S[1]==S[3] and S[0]!=S[1] :
  print("Yes")
elif S[0]==S[3] and S[1]==S[2] and S[0]!=S[1] :
  print("Yes")
else:
  print("No")
Buggy python submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
N,K=map(int,input().split())
import math
for i in range(1,K+1):
    ans1=(math.factorial(K-1)//math.factorial(i-1)//math.factorial(K-i))%1000000007
    ans2=(math.factorial(N-K-i+1+i)//math.factorial(N-K-i+1)//math.factorial(i))%1000000007
    ans=(ans1*ans2)%1000000007
    print(ans)

Fixed submission:
# -*- coding: utf-8 -*-
N,K=map(int,input().split())
import math
for i in range(1,K+1):
    ans1=(math.factorial(K-1)//math.factorial(i-1)//math.factorial(K-i))%1000000007
    if N-K-i+1<0:
        print(0)
        continue
    ans2=(math.factorial(N-K+1)//math.factorial(N-K-i+1)//math.factorial(i))%1000000007
    ans=(ans1*ans2)%1000000007
    print(ans)
Buggy python submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
n,x=map(int,input().split())
L=input().split()
L=[int(i) for i in L]
count=0
l=0
while l<=x:
    l=l+L[count]
    count=count+1
print(count)

Fixed submission:
# -*- coding: utf-8 -*-
n,x=map(int,input().split())
L=input().split()
L=[int(i) for i in L]
count=0
l=0
while l<=x:
    if count>n-1:
        count=count+1
        break
    else:
        l=l+L[count]
        count=count+1
print(count)
Buggy python submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
n=int(input())
x=[]
y=[]
total=[]
count=[]
for _ in range(n):
    x1,y1=map(int,input().split())
    x.append(x1)
    y.append(y1)
for i in range(n):
    for j in range(n):
        if i==j:
            continue
        else:
            temporary=(x[i]-x[j],y[i]-y[j])
            if temporary in total:
                count[total.index(temporary)]=count[total.index(temporary)]+1
            else:
                total.append(temporary)
                count.append(0)
print(n-max(count)-1)

Fixed submission:
# -*- coding: utf-8 -*-
n=int(input())
x=[]
y=[]
total=[]
count=[]
for _ in range(n):
    x1,y1=map(int,input().split())
    x.append(x1)
    y.append(y1)
for i in range(n):
    for j in range(n):
        if i==j:
            continue
        else:
            temporary=(x[i]-x[j],y[i]-y[j])
            if temporary in total:
                count[total.index(temporary)]=count[total.index(temporary)]+1
            else:
                total.append(temporary)
                count.append(0)
if n==1:
    print(1)
else:
    print(n-max(count)-1)

Buggy python submission (verdict: Runtime Error):
# # -*- coding: utf-8 -*-
N=int(input())
X=[]
Y=[]
for _ in range(N):
    x,y=map(int,input().split())
    X.append(x)
    Y.append(y)
Z=[]
for i in range(N):
    for j in range(i+1,N):
        Z=Z+[(abs(X[i]-X[j]),abs(Y[i]-Y[j]))]
import collections
z=collections.Counter(Z)
print(N-z.most_common()[0][1])

Fixed submission:
# -*- coding: utf-8 -*-
n=int(input())
x=[]
y=[]
total=[]
count=[]
for _ in range(n):
    x1,y1=map(int,input().split())
    x.append(x1)
    y.append(y1)
for i in range(n):
    for j in range(n):
        if i==j:
            continue
        else:
            temporary=(x[i]-x[j],y[i]-y[j])
            if temporary in total:
                count[total.index(temporary)]=count[total.index(temporary)]+1
            else:
                total.append(temporary)
                count.append(0)
if n==1:
    print(1)
else:
    print(n-max(count)-1)
Buggy python submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
p,q,r=map(int,input().split())
ptint(min(p+q,q+r,r+p))

Fixed submission:
# -*- coding: utf-8 -*-
p,q,r=map(int,input().split())
print(min(p+q,q+r,r+p))

Buggy python submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
p,q,r=map(int,input().split())
ptint(min(p+q,q+r,r+p)

Fixed submission:
# -*- coding: utf-8 -*-
p,q,r=map(int,input().split())
print(min(p+q,q+r,r+p))
Buggy python submission (verdict: Time Limit Exceeded):
# -*- coding: utf-8 -*-
n,m=map(int,input().split())
a=[]
mod=1000000007
for _ in range(m):
    a.append(int(input()))
ans=[1]+[0]*(n)
for i in range(1,n+1):
    if i in a:
        ans[i]=0
    else:
        ans[i]=(ans[i-1]+ans[i-2])%mod
print(ans[n])

Fixed submission:
# -*- coding: utf-8 -*-
n,m=map(int,input().split())
a=[]
mod=1000000007
for _ in range(m):
    a.append(int(input()))
a=set(a)
ans=[1]+[0]*(n)
for i in range(1,n+1):
    if i in a:
        ans[i]=0
    else:
        ans[i]=(ans[i-1]+ans[i-2])%mod
print(ans[n])

Buggy python submission (verdict: Time Limit Exceeded):
# -*- coding: utf-8 -*-
n,m=map(int,input().split())
a=[]
mod=1000000007
for _ in range(m):
    a.append(int(input()))
if 1 in a:
    ans=[1]+[0]+[0]*(n-1)
else:
    ans=[1]+[1]+[0]*(n-1)
for i in range(2,n+1):
    if i in a:
        ans[i]=0
    else:
        ans[i]=(ans[i-1]+ans[i-2])%mod
print(ans[n])

Fixed submission:
# -*- coding: utf-8 -*-
n,m=map(int,input().split())
a=[]
mod=1000000007
for _ in range(m):
    a.append(int(input()))
a=set(a)
ans=[1]+[0]*(n)
for i in range(1,n+1):
    if i in a:
        ans[i]=0
    else:
        ans[i]=(ans[i-1]+ans[i-2])%mod
print(ans[n])
Buggy python submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
n=int(input())
A=[]
for i in range(n):
    a=(i+1,)+tuple(input().split())
    A.append(a)
A.sort(key=lambda x:(-x[1],x[2]),reverse=True)
for m in range(n):
    print(A[m][0])

Fixed submission:
# -*- coding: utf-8 -*-
N=int(input())
restaurant=[]
for i in range(N):
    s,p=input().split()
    restaurant.append((i+1,s,int(p)))
restaurant.sort(key=lambda x:(x[1],-x[2]))
for j in range(N):
    print(restaurant[j][0])
Buggy python submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
n,k=map(int,input().split(" "))
s=input()
s=s[:k-1]+s[k-1].lower()+s[k]
print(s)

Fixed submission:
# -*- coding: utf-8 -*-
n,k=map(int,input().split(" "))
s=input()
s=s[:k-1]+s[k-1].lower()+s[k:]
print(s)
Buggy python submission (verdict: Time Limit Exceeded):
# -*- coding:utf-8 -*-
r,g,b,n=map(int,input().split(" "))
count=0
r1=n//r
for i in range(0,r1+1):
    g1=(n-i*r)//g+1
    for j in range(0,g1):
        b1=(n-i*r-j*g)//b+1 
        for z in range(0,b1):
            if n-i*r-j*g-z*b==0:
                count=count+1
print(count)

Fixed submission:
# -*- coding:utf-8 -*-
r,g,b,n=map(int,input().split(" "))
count=0
r1=n//r
for i in range(0,r1+1):
    g1=(n-i*r)//g+1
    for j in range(0,g1):
        if (n-i*r-j*g)%b==0:
            count=count+1
print(count)
Buggy python submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
a=[]
ans="Yay!"
for _ in range(6):
  a.append(int(input()))
for i in range(5):
  for j in range(i+1,5):
    if abs(a(i)-a(j))>a(5):
      ans=":("
      break
print(ans)

Fixed submission:
# -*- coding: utf-8 -*-
a=[]
ans="Yay!"
for _ in range(6):
  a.append(int(input()))
for i in range(5):
  for j in range(i+1,5):
    if abs(a[i]-a[j])>a[5]:
      ans=":("
      break
print(ans)

Buggy python submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
a=[]
ans="Yay!"
for _ in range(6):
  a.append(int(input()))
for i in range(5):
  for j in range(i+1,5):
    if abs(a.append(i)-a.append(j))>a.append(5):
      ans=":("
      break
print(ans)

Fixed submission:
# -*- coding: utf-8 -*-
a=[]
ans="Yay!"
for _ in range(6):
  a.append(int(input()))
for i in range(5):
  for j in range(i+1,5):
    if abs(a[i]-a[j])>a[5]:
      ans=":("
      break
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
# -*- coding: utf-8 -*-
K,S=map(int,input().split())
count=0
for i in range(K+1):
  for j in range(K+1):
    for k in range(K+1):
      if i+j+k==S:
        count=count+1
print(count)

Fixed submission:
# -*- coding: utf-8 -*-
K,S=map(int,input().split())
count=0
for i in range(K+1):
  for j in range(K+1):
    k=S-i-j
    if 0<=k<=K:
      count=count+1
print(count)

Buggy python submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
K,S=map(int,input().split())
count=0
for i in range(1,K+1):
  for j in range(1,K+1):
    for k in range(1,K+1):
      if i+j+k=S:
        count=count+1
print(count)

Fixed submission:
# -*- coding: utf-8 -*-
K,S=map(int,input().split())
count=0
for i in range(K+1):
  for j in range(K+1):
    k=S-i-j
    if 0<=k<=K:
      count=count+1
print(count)
Buggy python submission (verdict: Runtime Error):
year = 1
n = 100
while True:
    if n >= X:
        print(year-1)
        exit()
    n = int(n * 1.01)
    year += 1

Fixed submission:
X = int(input())

year = 1
n = 100
while True:
    if n >= X:
        print(year-1)
        exit()
    n = int(n * 1.01)
    year += 1
Buggy python submission (verdict: Runtime Error):
if N[0] == "7":
    print("Yes")
elif N[1] == "7":
    print("Yes")
elif N[2] == "7":
    print("Yes")
else:
    print("No")

Fixed submission:
N = input()
if N[0] == "7":
    print("Yes")
elif N[1] == "7":
    print("Yes")
elif N[2] == "7":
    print("Yes")
else:
    print("No")
Buggy python submission (verdict: Runtime Error):
K = int(input())
list = [1,1,1,2,1,2,1,5,2,2,1,5,1,2,1,14,1,5,1,5,2,2,1,15,2,2,5,4,1,4,1,51]
print(list[K+1])

Fixed submission:
K = int(input())
list = [1,1,1,2,1,2,1,5,2,2,1,5,1,2,1,14,1,5,1,5,2,2,1,15,2,2,5,4,1,4,1,51]
print(list[K-1])

Buggy python submission (verdict: Runtime Error):
K = int(input())
list = [1,1,1,2,1,2,1,5,2,2,1,5,1,2,1,14,1,5,1,5,2,2,1,15,2,2,5,4,1,4,1,51]
print(list[K])

Fixed submission:
K = int(input())
list = [1,1,1,2,1,2,1,5,2,2,1,5,1,2,1,14,1,5,1,5,2,2,1,15,2,2,5,4,1,4,1,51]
print(list[K-1])
Buggy python submission (verdict: Runtime Error):
list_num = input().split(" ") #A,B,M
list_ref = input().split(" ") #冷蔵庫の値段
list_ren = input().split(" ") #レンジの値段
list2 = [] #割引できるやつの組み
for i in range(int(list_num[2])):
    list_c = input().split(" ")
    list2.append(list_c)
A = int(list_num[0])
B = int(list_num[1])
M = int(list_num[2])
 
#割引なしで総当たり
list_price = []
for i in range(A):
    for j in range(B):
        list_price.append(int(list_ref[i]) + int(list_ren[j]))
 
#割引きを総当たり
for k in range(M):
    price = int(list_ref[int(list2[k][0])-1]) + int(list_ren[int(list2[k][1])-1]) - int(int(list2[k][2])-1) - 1
    list_price.append(price)
 
 
print(min(list_price))

Fixed submission:
import math
import sys
#読み込み
s = input()
num = len(s)

#偶数個の文字でなければno
if num % 2 != 0:
    print("No")
    sys.exit()

#偶数番目がhか判定
for i in range(math.floor(num/2)):
    if s[2 * i] != "h":
        print("No")
        sys.exit()

#奇数番目がiか判定
for j in range(math.floor(num/2)):
    if s[2 * j + 1]  != "i":
        print("No")
        sys.exit()
        
print("Yes")
Buggy python submission (verdict: Time Limit Exceeded):
list_num = input().split(" ") #A,B,M
list_ref = input().split(" ") #冷蔵庫の値段
list_ren = input().split(" ") #レンジの値段
list2 = [] #割引できるやつの組み
for i in range(int(list_num[2])):
    list_c = input().split(" ")
    list2.append(list_c)
A = int(list_num[0])
B = int(list_num[1])
M = int(list_num[2])
 
#割引なしで総当たり
list_price = []
for i in range(A):
    for j in range(B):
        list_price.append(int(list_ref[i]) + int(list_ren[j]))
 
#割引きを総当たり
for k in range(M):
    price = int(list_ref[int(list2[k][0])-1]) + int(list_ren[int(list2[k][1])-1]) - int(int(list2[k][2])-1) - 1
    list_price.append(price)
 
 
print(min(list_price))

Fixed submission:
#読み込み
list_num = input().split(" ") #A,B,M
list_ref = input().split(" ") #冷蔵庫の値段
list_ren = input().split(" ") #レンジの値段
list2 = [] #割引できるやつの組み
for i in range(int(list_num[2])):
    list_c = input().split(" ")
    list2.append(list_c)
A = int(list_num[0])
B = int(list_num[1])
M = int(list_num[2])

list_price = []

#一番安いのと一番安いの
list_ref_int = [int(s) for s in list_ref]
list_ren_int = [int(s) for s in list_ren]
cheap = min(list_ref_int) + min(list_ren_int)
list_price.append(cheap)

#割引きを総当たり
for k in range(M):
    price = list_ref_int[int(list2[k][0])-1] + list_ren_int[int(list2[k][1])-1] - int(int(list2[k][2])-1) - 1
    list_price.append(price)

print(min(list_price))

Buggy python submission (verdict: Time Limit Exceeded):
#読み込み
list_num = input().split(" ") #A,B,M
list_ref = input().split(" ") #冷蔵庫の値段
list_ren = input().split(" ") #レンジの値段
list2 = [] #割引できるやつの組み
for i in range(int(list_num[2])):
    list_c = input().split(" ")
    list2.append(list_c)
A = int(list_num[0])
B = int(list_num[1])
M = int(list_num[2])

#割引なしで総当たり
list_price = []
for i in range(A):
    for j in range(B):
        list_price.append(int(list_ref[i]) + int(list_ren[j]))

#割引きを総当たり
for k in range(M):
    price = int(list_ref[int(list2[k][0])-1]) + int(list_ren[int(list2[k][1])-1]) - int(int(list2[k][2])-1) - 1
    list_price.append(price)


print(min(list_price))

Fixed submission:
#読み込み
list_num = input().split(" ") #A,B,M
list_ref = input().split(" ") #冷蔵庫の値段
list_ren = input().split(" ") #レンジの値段
list2 = [] #割引できるやつの組み
for i in range(int(list_num[2])):
    list_c = input().split(" ")
    list2.append(list_c)
A = int(list_num[0])
B = int(list_num[1])
M = int(list_num[2])

list_price = []

#一番安いのと一番安いの
list_ref_int = [int(s) for s in list_ref]
list_ren_int = [int(s) for s in list_ren]
cheap = min(list_ref_int) + min(list_ren_int)
list_price.append(cheap)

#割引きを総当たり
for k in range(M):
    price = list_ref_int[int(list2[k][0])-1] + list_ren_int[int(list2[k][1])-1] - int(int(list2[k][2])-1) - 1
    list_price.append(price)

print(min(list_price))
Buggy python submission (verdict: Runtime Error):
list = input().split(" ")
N = int(list[0])
A = int(list[1])
B = int(list[2])

num1 = N // (A + B)
num2 = N % (A + B)
if num2 <= A:
    print(num1 * A + num2)
else:
    print(num1 * A + A)

Fixed submission:
S = input()
if S == "AAA":
    print("No")
elif S == "BBB":
    print("No")
else:
    print("Yes")
Buggy python submission (verdict: Runtime Error):
list = input().split(" ")
N = int(list[0])
K = int(list[1])
list_hp = input().split(" ")
list_hp = [int(i) for i in list_hp]
list_hp = sorted(list_hp,reverse=True)

if K < N:
    for i in range(K):
        list_hp.pop(0)
    print(sum(list_hp))
    
else:
    print(0)

Fixed submission:
list = input().split(" ")
H = int(list[0])
A = int(list[1])

t = 0
while H > 0:
    H = H - A
    t = t + 1

print(t)
Buggy python submission (verdict: Runtime Error):
list = input().split(" ")
H = int(list[0])
skill = input().split(" ")
skill = [int(i) for i in skill]

a1 = max(skill)
skill.remove(a1)
a2 = max(skill)

if a1 + a2 >= H:
    print("Yes")
else:
    print("No")

Fixed submission:
list = input().split(" ")
H = int(list[0])
skill = input().split(" ")
skill = [int(i) for i in skill]

sum = 0
for i in skill:
    sum = sum + i

if sum >= H:
    print("Yes")
else:
    print("No")

Buggy python submission (verdict: Runtime Error):
list = input().split(" ")
H = int(list[0])
skill = input().split(" ")
skill = [int(i) for i in skill]

a1 = max(skill)
skill.remove(a1)
a2 = max(skill)

if a1 + a2 >= H:
    print("YES")
else:
    print("NO")

Fixed submission:
list = input().split(" ")
H = int(list[0])
skill = input().split(" ")
skill = [int(i) for i in skill]

sum = 0
for i in skill:
    sum = sum + i

if sum >= H:
    print("Yes")
else:
    print("No")

Buggy python submission (verdict: Runtime Error):
list = input().split(" ")
H = int(list[0])
skill = input().split(" ")
skill = [int(i) for i in skill]

a1 = max(skill)
skill.remove(a1)
a2 = max(skill)

if a1 + a2 >= H:
    print("YES")
else:
    print("NO")

Fixed submission:
list = input().split(" ")
H = int(list[0])
skill = input().split(" ")
skill = [int(i) for i in skill]

sum = 0
for i in skill:
    sum = sum + i

if sum >= H:
    print("Yes")
else:
    print("No")