Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
def gcd2(a, b):
    if b == 0:
        return a
    
    return gcd2(b, a % b)

def gcd3(a, b, c):
    return gcd2(gcd2(a, b), c)

if __name__ == "__main__":
    k = int(input())
    
    ans = 0

    for a in range(1, k + 1):
        for b in range(1, k + 1):
            for c in range(1, k + 1):
                ans += gcd3(a, b, c)
    
    print(ans)

Fixed submission:
def gcd2(a, b):
    if b == 0:
        return a
    
    return gcd2(b, a % b)

def gcd3(a, b, c):
    return gcd2(gcd2(a, b), c)

if __name__ == "__main__":
    k = int(input())
    
    ans = 0

    for a in range(1, k + 1):
        for b in range(1, a + 1):
            for c in range(1, b + 1):
                if a == b and b == c and c == a:
                    ans += gcd3(a, b, c)
                elif a == b or b == c or c == a:
                    ans += gcd3(a, b, c) * 3
                else:
                    ans += gcd3(a, b, c) * 6
    
    print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
if __name__ == "__main__":
    N = int(input())
    A = []
    for i in range(N):
        Ai = int(input())
        if Ai in A:
            A.remove(Ai)
        else:
            A.append(Ai)
    print(len(A))

Fixed submission:
if __name__ == "__main__":
    N = int(input())
    #A = []
    d = {}
    for i in range(N):
        Ai = int(input())
        if Ai in d.keys():
            d[Ai] = not d[Ai]
        else:
            d[Ai] = True
    
    ans = 0
    for item in d.items():
        if item[1]:
            ans += 1
    
    print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int,input().split()))
sum = 1
for i in a:
  if i == 0:
    sum = 0
    break
  sum *= i
  if sum > 1000000000000000000:
    sum = -1
print(sum)

Fixed submission:
n = int(input())
a = list(map(int,input().split()))
if sorted(a)[0] == 0:
  sum = 0
else:
  sum = 1
if sum == 1:
  for i in a:
    sum *= i
    if sum > 1000000000000000000:
      sum = -1
      break
print(sum)
Buggy python submission (verdict: Runtime Error):
n = int(input())
for i in range(3):
  if n%10 == 7:
    print('Yes')
    break
  elif n/10 < 1:
    print('No')
  else:
    n = math.floor(n/10)

Fixed submission:
import math
n = int(input())
for i in range(3):
  if n%10 == 7:
    print('Yes')
    break
  elif n/10 < 1:
    print('No')
  else:
    n = math.floor(n/10)

Buggy python submission (verdict: Time Limit Exceeded):
n = (int(input()))
while n > 0:
  if n%10==7:
    print('Yes')
    break
  elif n < 10:
    print('No')
  else:
    n /= 10

Fixed submission:
import math
n = int(input())
for i in range(3):
  if n%10 == 7:
    print('Yes')
    break
  elif n/10 < 1:
    print('No')
  else:
    n = math.floor(n/10)
Buggy python submission (verdict: Runtime Error):
m,n = (int(x) for x in input().split())
list = (input().split())
for i in range(len(list)):
  list[i] = int(list[i])
  
la = sorted(list, reverse=True)

sum = 0
for i in range(len(list)):
  sum += int(list[i])
if int(la[n-1])<sum/(4*m):
  print('No')
else:
  print('Yes')

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

a,b = b,a
a,c = c,a

print(a, b, c)

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

a,b = b,a
a,c = c,a

print(a, b, c)

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

a,b = b,a
a,c = c,a

print(a, b, c)

Buggy python submission (verdict: Runtime Error):
n = [0]*3
for i in range(len(n)):
  while n[i]<1 or 100<n[i]:
    n[i] = int(input())

n[0], n[1] = n[1], n[0]
n[0], n[2] = n[2], n[0]

print(n[0], n[1], n[2])

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

a,b = b,a
a,c = c,a

print(a, b, c)

Buggy python submission (verdict: Runtime Error):
n = [0]*3
for i in range(len(n)):
  while n[i]<1 or 100<n[i]:
    n[i] = int(input())

n[0], n[1] = n[1], n[0]
n[0], n[2] = n[2], n[0]

print(n[0], n[1], n[2])

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

a,b = b,a
a,c = c,a

print(a, b, c)

Buggy python submission (verdict: Runtime Error):
n = [0]*3
for i in range(len(n)):
  n[i] = input()

n[0], n[1] = n[1], n[0]
n[0], n[2] = n[2], n[0]

print(n[0], n[1], n[2])

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

a,b = b,a
a,c = c,a

print(a, b, c)

Buggy python submission (verdict: Runtime Error):
a = input()
b = input()
c = input()

a, b = b, a
a, c = c, a

print(a, b, c)


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

a,b = b,a
a,c = c,a

print(a, b, c)

Buggy python submission (verdict: Runtime Error):
a = input()
b = input()
c = input()

tmp = a
a = b
b = tmp

tmp = a
a = c
c = tmp

print(a, b, c)


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

a,b = b,a
a,c = c,a

print(a, b, c)

Buggy python submission (verdict: Runtime Error):
n = [0]*3
for i in range(len(n)):
  n[i] = input()

tmp = n[0]
n[0] = n[1]
n[1] = tmp

tmp = n[0]
n[0] = n[2]
n[2] = tmp

for i in range(len(n)):
  print(n[i])


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

a,b = b,a
a,c = c,a

print(a, b, c)

Buggy python submission (verdict: Runtime Error):
n = [0,0,0]
for i in range(len(n)):
  n[i] = input()
  
tmp = n[0]
n[0] = n[1]
n[1] = tmp

tmp = n[0]
n[0] = n[2]
n[2] = tmp

for i in range(len(n)):
  print(n[i])

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

a,b = b,a
a,c = c,a

print(a, b, c)

Buggy python submission (verdict: Runtime Error):
n = [0,0,0]
for i in range(len(n)):
  n[i] = input()
  
tmp = n[0]
n[0] = n[1]
n[1] = tmp

tmp = n[0]
n[0] = n[2]
n[2] = tmp

for i in range(len(n)):
  print(n[i])

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

a,b = b,a
a,c = c,a

print(a, b, c)
Buggy python submission (verdict: Time Limit Exceeded):
n,k = (int(x) for x in input().split())
if k == 1:
  print(0)
elif k == 2:
  if n%2==0:
    print(0)
  else:
    print(1)
elif k == 3:
  if n%3==0:
    print(0)
  else:
    print(1)
else:
  while abs(n-k) < n:
    n = abs(n-k)
  print(n)

Fixed submission:
n,k = (int(x) for x in input().split())
if n%k < k-(n%k):
  print(n%k)
else:
  print(k-(n%k))

Buggy python submission (verdict: Time Limit Exceeded):
n,k = (int(x) for x in input().split())
if k == 1:
  print(0)
elif k == 2:
  if n%2==0:
    print(0)
  else:
    print(1)
else:
  while abs(n-k) < n:
    n = abs(n-k)
  print(n)

Fixed submission:
n,k = (int(x) for x in input().split())
if n%k < k-(n%k):
  print(n%k)
else:
  print(k-(n%k))

Buggy python submission (verdict: Time Limit Exceeded):
n,k = (int(x) for x in input().split())
while abs(n-k) < n:
  n = abs(n-k)
print(n)

Fixed submission:
n,k = (int(x) for x in input().split())
if n%k < k-(n%k):
  print(n%k)
else:
  print(k-(n%k))
Buggy python submission (verdict: Time Limit Exceeded):
n, q = (int(x) for x in input().split())
string = list(input())
l = [0]*q
r = [0]*q
for i in range(q):
    l[i], r[i] = (int(x) for x in input().split())

for i in range(q):
    count = 0
    for j in range(r[i]-l[i]):
        if string[l[i]+j-1] == 'A' and string[l[i]+j] == 'C':
            count += 1
    print(count)

Fixed submission:
n, q = (int(x) for x in input().split())
s = input()
t = [0]*(n+1)
for i in range(n):
  t[i+1] = t[i] + (1 if s[i : i + 2] == 'AC' else 0)
for i in range(q):
  l,r = (int(x) for x in input().split())
  print(t[r-1]-t[l-1])
Buggy python submission (verdict: Time Limit Exceeded):
import sys
input = sys.stdin.readline
input()
A = input().split()
ans = 1
for a in A:
    ans*=int(a)
    if ans==0:
        print(0)
        quit()
print(-1 if ans>10**18 else ans)

Fixed submission:
input()
A = list(map(int,input().split()))
if 0 in A:
    print(0)
    quit()
else:
    prod = 1
    for a in A:
        prod*=a
        if prod > 10**18:
            print(-1)
            quit()
    print(prod)

Buggy python submission (verdict: Time Limit Exceeded):
import sys
input = sys.stdin.readline
input()
A = input().split()
if "0" in A:
    print(0)
    quit()
ans = 1
for a in A:
    ans*=int(a)
print(-1 if ans>10**18 else ans)

Fixed submission:
input()
A = list(map(int,input().split()))
if 0 in A:
    print(0)
    quit()
else:
    prod = 1
    for a in A:
        prod*=a
        if prod > 10**18:
            print(-1)
            quit()
    print(prod)

Buggy python submission (verdict: Time Limit Exceeded):
import sys
input = sys.stdin.readline
input()
A = list(map(int,input().split()))
if 0 in A:
    print(0)
    quit()
ans = 1
for a in A:
    ans*=a
print(-1 if ans>10**18 else ans)

Fixed submission:
input()
A = list(map(int,input().split()))
if 0 in A:
    print(0)
    quit()
else:
    prod = 1
    for a in A:
        prod*=a
        if prod > 10**18:
            print(-1)
            quit()
    print(prod)

Buggy python submission (verdict: Time Limit Exceeded):
input()
A = list(map(int,input().split()))
if 0 in A:
    print(0)
    quit()
ans = 1
for a in A:
    ans*=a
print(-1 if ans>10**18 else ans)


Fixed submission:
input()
A = list(map(int,input().split()))
if 0 in A:
    print(0)
    quit()
else:
    prod = 1
    for a in A:
        prod*=a
        if prod > 10**18:
            print(-1)
            quit()
    print(prod)

Buggy python submission (verdict: Time Limit Exceeded):
input()
A = list(map(int,input().split()))
if 0 in A:
    print(0)
    quit()
ans = 1
for a in A:
    ans*=a
print(-1 if ans>10**18 else ans)

Fixed submission:
input()
A = list(map(int,input().split()))
if 0 in A:
    print(0)
    quit()
else:
    prod = 1
    for a in A:
        prod*=a
        if prod > 10**18:
            print(-1)
            quit()
    print(prod)

Buggy python submission (verdict: Time Limit Exceeded):
input()
A = map(int,input().split())
ans = 1
for a in A:
    if a==0:
        ans = 0
        break
    ans*=a
print(-1 if ans>10**18 else ans)

Fixed submission:
input()
A = list(map(int,input().split()))
if 0 in A:
    print(0)
    quit()
else:
    prod = 1
    for a in A:
        prod*=a
        if prod > 10**18:
            print(-1)
            quit()
    print(prod)
Buggy python submission (verdict: Time Limit Exceeded):
N,M=map(int,input().split())
H=list(map(int,input().split()))
o=[i for i in range(1,N+1)]
def removeObs(x):
    if x in o:
        o.remove(x)
for i in range(M):
    A,B=map(int,input().split())
    if H[A-1]==H[B-1]:
        removeObs(A)
        removeObs(B)
    elif H[A-1]>H[B-1]:
        removeObs(B)
    else:
        removeObs(A)
print(len(o))

Fixed submission:
N,M=map(int,input().split())
H=list(map(int,input().split()))
ab=[0]*N
for i in range(M):
    a,b=map(int,input().split())
    ab[a-1]=max(ab[a-1],H[b-1])
    ab[b-1]=max(ab[b-1],H[a-1])
ans=0
for i in range(N):
    if ab[i]<H[i]:
        ans+=1
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
import math, itertools
from functools import reduce
def gcd_list(numbers):
    return(reduce(math.gcd,numbers))
k=int(input())
ans=0
for numbers in itertools.product(range(1,k+1),repeat=3):
    ans+=gcd_list(numbers)
print(ans)

Fixed submission:
import math, itertools
from functools import reduce
def gcd_list(numbers):
    return(reduce(math.gcd,numbers))
k=int(input())
ans=0
for numbers in itertools.combinations_with_replacement(range(1,k+1),3):
    a,b,c=numbers
    if a==b==c:
        ans+=gcd_list(numbers)
    elif a!=b and a!=c and b!=c:
        ans+=6*gcd_list(numbers)
    else:
        ans+=3*gcd_list(numbers)
print(ans)
Buggy python submission (verdict: Runtime Error):
input()
T,A = map(int,input().split())
a = list(map(int,input().split()))
min_val = T-A
for i in range(len(a)):
    if abs(T-0.006*a[i]-A) <= min_val:
        min_val = abs(T-0.006*a[i]-A)
        min_num = i
print(min_num+1)

Fixed submission:
N = int(input())
T,A = map(int,input().split())
H = list(map(int,input().split()))
 
x = 100000
ans = 0
 
for i in range(N):
    temp = abs(A -(T - H[i]*0.006))
    if abs(A -(T - H[i]*0.006)) < x:
        x = abs(A -(T - H[i]*0.006))
        ans = i
 
print(ans+1)

Buggy python submission (verdict: Runtime Error):
input()
T,A = map(int,input().split())
a = list(map(int,input().split()))
min_val = T-A
for i in range(len(a)):
    print("min_val={}".format(min_val))
    if abs(T-0.006*a[i]-A) <= min_val:
        min_val = abs(T-0.006*a[i]-A)
        min_num = i
print(min_num+1)

Fixed submission:
N = int(input())
T,A = map(int,input().split())
H = list(map(int,input().split()))
 
x = 100000
ans = 0
 
for i in range(N):
    temp = abs(A -(T - H[i]*0.006))
    if abs(A -(T - H[i]*0.006)) < x:
        x = abs(A -(T - H[i]*0.006))
        ans = i
 
print(ans+1)

Buggy python submission (verdict: Runtime Error):
input()
T,A = map(int,input().split())
a = list(map(int,input().split()))
min_val = T-A
for i in range(len(a)):
    print("min_val={}".format(min_val))
    if abs(T-0.006*a[i]-A) <= min_val:
        min_val = abs(T-0.006*a[i]-A)
        min_num = i
print(min_num+1)

Fixed submission:
N = int(input())
T,A = map(int,input().split())
H = list(map(int,input().split()))
 
x = 100000
ans = 0
 
for i in range(N):
    temp = abs(A -(T - H[i]*0.006))
    if abs(A -(T - H[i]*0.006)) < x:
        x = abs(A -(T - H[i]*0.006))
        ans = i
 
print(ans+1)
Buggy python submission (verdict: Runtime Error):
print(700 + input().count('o')　*　100)

Fixed submission:
s = input()
counter = 0
if s[0] == 'o':
  counter += 1
if s[1] == 'o':
  counter += 1
if s[2] == 'o':
  counter += 1
print(int(700+counter*100))
Buggy python submission (verdict: Runtime Error):
N = int(input())
A = int(input())
if A => N%500:
  print("Yes")
else:
  print("No")

Fixed submission:
N = int(input())
A = int(input())
if A >= N%500:
  print("Yes")
else:
  print("No")
Buggy python submission (verdict: Runtime Error):
n,y=map(int,input().split())

for i in range(n+1):
     for j in range(n+1-i):
        z_m=y-(10000*i+5000*j)
        z_n=n-(i+j)
          if z_m>=0 and z_m//1000==z_n:
            print(i,j,z_n)
               exit()
print(-1,-1,-1)

Fixed submission:
n,y=map(int,input().split())
for i in range(n+1):
     for j in range(n+1-i):
        z_m=y-(10000*i+5000*j)
        z_n=n-(i+j)
        if z_m>=0 and z_m//1000==z_n:
          print(i,j,z_n)
          exit()
print(-1,-1,-1)
Buggy python submission (verdict: Time Limit Exceeded):
import collections
N,K = map(int,input().split())
a = list(map(int,input().split()))
c = collections.Counter(a)
if len(c) <= K:
    print(0)
else:
    print(sum([c.most_common()[-i][1] for i in range(1,len(c)-K+1)]))

Fixed submission:
import collections
N,K = map(int,input().split())
a = list(map(int,input().split()))
c = collections.Counter(a)
c_most = c.most_common()
if len(c) <= K:
    print(0)
else:
    print(sum([c_most[-i][1] for i in range(1,len(c)-K+1)]))
Buggy python submission (verdict: Time Limit Exceeded):
N=input()
A=list(map(int,input().split()))
ans = []
for i in range(min(A),max(A)+1):
    ans.append(A.count(i-1)+A.count(i)+A.count(i+1))
print(max(ans))

Fixed submission:
input()
A=list(map(int,input().split()))
c=[0 for _ in range(10**5+3)]
for a in A:
    c[a]+=1
    c[a-1]+=1
    c[a+1]+=1
print(max(c))
Buggy python submission (verdict: Runtime Error):
N = int(input())
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)
divisors_sorted = sorted(divisors)
print(len(str(divisors_sorted[int((len(divisors_sorted)+1)/2)])))

Fixed submission:
N = int(input())
ans=[]
for i in range(1,int(N**0.5)+1):
    if N%i==0:
        ans.append(max(len(str(i)),len(str(N//i))))
print(min(ans))

Buggy python submission (verdict: Runtime Error):
N = int(input())
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)
divisors.sort()
print(len(str(divisors[int((len(divisors)+1)/2)])))

Fixed submission:
N = int(input())
ans=[]
for i in range(1,int(N**0.5)+1):
    if N%i==0:
        ans.append(max(len(str(i)),len(str(N//i))))
print(min(ans))

Buggy python submission (verdict: Runtime Error):
N = int(input())
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)
divisors.sort()
print(len(str(divisors[int((len(divisors)+1)/2)])))

Fixed submission:
N = int(input())
ans=[]
for i in range(1,int(N**0.5)+1):
    if N%i==0:
        ans.append(max(len(str(i)),len(str(N//i))))
print(min(ans))
Buggy python submission (verdict: Runtime Error):
N,A,B = map(int,input().split())
ans = 0
for i in range(1,N+1):
    if A<=(i//10)+(i%10) and (i//10)+(i%10)<=B:
        ans+=i
print(ans)

Fixed submission:
import itertools
K,S = map(int,input().split())
ans = 0
for i,j in itertools.product(range(K+1),range(K+1)):
    if 0<=S-i-j and S-i-j<=K:
        ans+=1
print(ans)
Buggy python submission (verdict: Runtime Error):
# import re
s = input()
# m = re.fullmatch(hi{1,10},s):
# if m = "None":
#     print("No")
# else:
#     print("Yes")

if s == "hi" or s =="hihi"or s == "hihihi"  or s=="hihihihi" or s== "hihihihihi:
    print("Yes")
else:
    print("No")

Fixed submission:
# import re
s = input()
# m = re.fullmatch(hi{1,10},s):
# if m = "None":
#     print("No")
# else:
#     print("Yes")

if s == "hi" or s =="hihi"or s == "hihihi"  or s=="hihihihi" or s== "hihihihihi":
    print("Yes")
else:
    print("No")
Buggy python submission (verdict: Runtime Error):
A,B,M = map(int,input().split())
a = list(map(int,input().split()))
b = list(map(int,input().split()))
x = [0] * M
y = [0] * M
c = [0] * M
for i in range(M):
    x[i], y[i], c[i] = map(int, input().split())


ans= 0
tmp =0
#割引券を使わない場合
ans = min(a) + min(b)

#割引券を使う場合
for i in range(M):
    if a[x[i]-1] + b[y[i]-1] - c[i] < ans:
        ans = a[x[i]] + b[y[i]] - c[i]

print(ans)


Fixed submission:
A,B,M = map(int,input().split())
a = list(map(int,input().split()))
b = list(map(int,input().split()))
x = [0] * M
y = [0] * M
c = [0] * M
for i in range(M):
    x[i], y[i], c[i] = map(int, input().split())


ans= 0
tmp =0
#割引券を使わない場合
ans = min(a) + min(b)

#割引券を使う場合
for i in range(M):
    if a[x[i]-1] + b[y[i]-1] - c[i] < ans:
        ans = a[x[i]-1] + b[y[i]-1] - c[i]

print(ans)
Buggy python submission (verdict: Runtime Error):
n,k = map(int,input().split())
h = list(map(int,input().split()))

h.sort(reverse = True)

if k <= len(h):
    for i in range(k):
        h.pop(0)

    print(sum(h))

else:
    print("0")

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

if h%a ==0:
    print(h//a)
else:
    print(h//a +1)
Buggy python submission (verdict: Time Limit Exceeded):
n,k = map(int,input().split())
h = list(map(int,input().split()))

h.sort(reverse = True)

if k <= len(h):
    for i in range(k):
        h.pop(0)

    print(sum(h))

else:
    print("0")

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

h.sort(reverse = True)

if k <= len(h):
    h[0:k] = []
    print(sum(h))
else:
    print("0")
Buggy python submission (verdict: Runtime Error):
A, B = map(int, input().split)
ans = A * B
print(ans)

Fixed submission:
A, B = map(int, input().split())
ans = A * B
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
num_list = list(map(int, input().split()))
ans = num_list[0]
for i in range(1, N):
    ans *= num_list[i]

if ans > 10**18:
    print(-1)
else:
    print(ans)

Fixed submission:
import numpy as np
N = int(input())
num_list = list(map(int, input().split()))

# ans = np.prod(num_list)
ans = num_list[0]
for i in range(1, N):
    if ans > 10**18:
        break
    ans *= num_list[i]


if 0  in num_list:
    print(0)
elif ans > 10**18:
    print("-1")
else:
    print(ans)
Buggy python submission (verdict: Runtime Error):
import math

a, b = map(float, input().split())
ans = math.floor(int(a)*b)
print(ans)

Fixed submission:
a, b = map(float, input().split())
A = int(a)
B = int(b*1000)

ans = A * B
print(ans//1000)
Buggy python submission (verdict: Runtime Error):
a = [input() for i in range(3)]
# print(a)
# print(T[:-1])

# s_len = len(a[0])
# a[0] = a[0].rstrip('\n')


if a[0] == a[1][:-1]:
    print("Yes")
else:
    print("No")

Fixed submission:
a = [input() for i in range(2)]
# print(a)
# print(T[:-1])

# s_len = len(a[0])
# a[0] = a[0].rstrip('\n')


if a[0] == a[1][:-1]:
    print("Yes")
else:
    print("No")
Buggy python submission (verdict: Runtime Error):
import sys
input = sys.stdin.readline
import itertools

N, M, X = map(int, input().split())
values_list = []
for i in range(N):
    values = list(map(int, input().split()))
    values_list.append(values)


for i in range(1, N+1):
    for pair in itertools.combinations(values_list, i):
        this_m_dict = {}
        this_cost = 0
        for item in pair:
            for j in range(1, M+1):
                this_m_dict[j] = this_m_dict.get(j, 0) + item[j]
            this_cost += item[0]
        for myvalue in this_m_dict.values():
            if myvalue < X:
                break
        ans = min(this_cost, ans)

print(ans)

Fixed submission:
import sys
input = sys.stdin.readline
import itertools

# 解けなかった
# N, M, X = map(int, input().split())
# values_list = []
# for i in range(N):
#     values = list(map(int, input().split()))
#     values_list.append(values)

# ans = 0
# for i in range(1, N+1):
#     for pair in itertools.combinations(values_list, i):
#         this_m_dict = {}
#         this_cost = 0
#         for item in pair:
#             for j in range(1, M+1):
#                 this_m_dict[j] = this_m_dict.get(j, 0) + item[j]
#             this_cost += item[0]
#         for myvalue in this_m_dict.values():
#             if myvalue < X:
#                 break
#         ans = min(this_cost, ans)

N, M, X = map(int, input().split())
A = []
C = []

for i in range(N):
    values = list(map(int, input().split()))
    C.append(values[0])
    A.append(values[1:])

INF = float('INF')
min_cost = INF

def dfs(i, cost, learn):
    if i == N:
        if min(learn) >= X: 
            return cost
        else:
            return INF

    else:
        new_learn = [(x+y) for (x, y) in zip(A[i], learn)]
        cost = min(dfs(i+1, cost, learn), dfs(i+1, cost + C[i], new_learn))
        return cost

min_cost = dfs(0, 0, [0] * M)

if min_cost == INF:
    print(-1)
else:
    print(min_cost)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
p_num = list(map(int, input().split()))

for i in range(1, N+1):
    min_p_index = p_num.index(i)+1
    print(min_p_index)

Fixed submission:
N = int(input())
p_num = list(map(int, input().split()))
ans_list = [0] * N

for i in range(N):
    ans_list[p_num[i] - 1] = i+1

for i in range(N):
    print(ans_list[i])
Buggy python submission (verdict: Time Limit Exceeded):
import itertools
import numpy as np

N = int(input())
points = np.array(list(map(int, input().split())))
ans = 0
s_points = sorted(points)

for k in range(max(points)+1):
    arc_list = points[points >= k]
    abc_list = points[points < k]
    if len(arc_list) == len(abc_list):
        ans += 1

print(ans)

Fixed submission:
import itertools
import numpy as np

N = int(input())
points = np.array(list(map(int, input().split())))
ans = 0
s_points = sorted(points)

ans = s_points[int(N/2)] - s_points[int(N/2)-1]

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
import itertools
N = int(input())
points = list(map(int, input().split()))
ans = 0

for k in range(max(points)+1):
    arc_list = []
    abc_list = []
    for point in points:
        if point >= k:
            arc_list.append(point)
        else:
            abc_list.append(point)
    if len(arc_list) == len(abc_list):
        ans += 1

print(ans)

Fixed submission:
import itertools
import numpy as np

N = int(input())
points = np.array(list(map(int, input().split())))
ans = 0
s_points = sorted(points)

ans = s_points[int(N/2)] - s_points[int(N/2)-1]

print(ans)
Buggy python submission (verdict: Runtime Error):
S = input()

al_list = [chr(i) for i in range(97, 97+26)]
s_list = []
Flag = True

for al in S:
    s_list.append(al)

if s_list == al_list:
    print('None')
else:
    print(min(list(set(al_list) - set(s_list))))

Fixed submission:
S = input()

al_list = [chr(i) for i in range(97, 97+26)]
s_list = []
Flag = True

for al in S:
    s_list.append(al)

if set(s_list) == set(al_list):
    print('None')
else:
    print(min(list(set(al_list) - set(s_list))))