Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
weathers = [
   'Sunny',
   'Cloudy',
   'Rainy'
]

  s = str(input())

  index = 0
  next_index = 0

  for w in weathers:
    if w == s:
      next_index = (index + 1) % 3
      break
      else:
        index += 1

  print(weathers[next_index])

Fixed submission:
if __name__ == '__main__':
    weathers = [
        'Sunny',
        'Cloudy',
        'Rainy'
    ]

    s = str(input())

    index = 0
    next_index = 0

    for w in weathers:
        if w == s:
            next_index = (index + 1) % 3
            break
        else:
            index += 1

    print(weathers[next_index])

Buggy python submission (verdict: Runtime Error):
weathers = [
        'Sunny',
        'Cloudy',
        'Rainy'
    ]

    s = str(input())

    index = 0
    next_index = 0

    for w in weathers:
        if w == s:
            next_index = (index + 1) % 3
            break
        else:
            index += 1

    print(weathers[next_index])

Fixed submission:
if __name__ == '__main__':
    weathers = [
        'Sunny',
        'Cloudy',
        'Rainy'
    ]

    s = str(input())

    index = 0
    next_index = 0

    for w in weathers:
        if w == s:
            next_index = (index + 1) % 3
            break
        else:
            index += 1

    print(weathers[next_index])
Buggy python submission (verdict: Runtime Error):
n = int(input())
print(10**n-9**n-8**n-9**n)

Fixed submission:
a,b,c,d = map(int,input().split())
ac = a*c
ad = a*d
bc = b*c
bd = b*d

if ac>ad and ac>bc and ac>bd:
  print(ac)
elif ad >bc and ad>bd and ad>ac:
  print(ad)
elif bc>ac and bc>ad and bc>bd:
  print(bc)
else:
  print(bd)
Buggy python submission (verdict: Runtime Error):
n = int(input())
print(10**n=9**n-8**n-9**n)

Fixed submission:
n = int(input())
if n == 1:
  print(0)
  exit()

print((10**n-9**n+8**n-9**n)%(10**9+7))
Buggy python submission (verdict: Runtime Error):
m = 10**9 + 7
n = input()
a = list(map(int,input().split()))
ans = 0

for i in range (len(a)):
  for j in range (i+1,len(a)):
    ans += a[i]*a[j]

ans = ans%m

print(ans)

Fixed submission:
d, t, s = map(int, input().split())

if s*t<d:
  print('No')
else:
  print('Yes')

Buggy python submission (verdict: Runtime Error):
d = int(input())
t = int(input())
s = int(input())

if s*t<d:
  print('No')
else:
  print('Yes')

Fixed submission:
d, t, s = map(int, input().split())

if s*t<d:
  print('No')
else:
  print('Yes')

Buggy python submission (verdict: Runtime Error):
d = int(input())
t = int(input())
s = int(input())

if s*t<d:
  print('No')
else:
  print('Yes')

Fixed submission:
d, t, s = map(int, input().split())

if s*t<d:
  print('No')
else:
  print('Yes')
Buggy python submission (verdict: Runtime Error):
m = 10**9 + 7
n = input()
a = list(map(int,input().split()))
ans = 0
s = sum(a)

for i in a:
s -=i
ans += s*i
s+=i

ans = ans%m

print(ans)

Fixed submission:
m = 10**9 + 7
n = input()
a = list(map(int,input().split()))
ans = 0
s = sum(a)

for i in a:
  s -= i
  ans += s*i

ans = ans%m

print(ans)

Buggy python submission (verdict: Runtime Error):
m = 10**9 + 7
n = input()
a = list(map(int,input().split()))
ans = 0
s = sum(a)

for i in range a:
s -=i
ans += s*i
s+=i

ans = ans%m

print(ans)

Fixed submission:
m = 10**9 + 7
n = input()
a = list(map(int,input().split()))
ans = 0
s = sum(a)

for i in a:
  s -= i
  ans += s*i

ans = ans%m

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
m = 10**9 + 7
n = input()
a = list(map(int,input().split()))
ans = 0

for i in range (len(a)):
  for j in range (i+1,len(a)):
    ans += a[i]*a[j]

ans = ans%m

print(ans)

Fixed submission:
m = 10**9 + 7
n = input()
a = list(map(int,input().split()))
ans = 0
s = sum(a)

for i in a:
  s -= i
  ans += s*i

ans = ans%m

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
m = 10**9 + 7
n = input()
a = list(map(int,input().split()))
ans = 0

for i in range (len(a)):
  for j in range (i+1,len(a)):
    ans += a[i]*a[j]

ans = ans%m

print(ans)

Fixed submission:
m = 10**9 + 7
n = input()
a = list(map(int,input().split()))
ans = 0
s = sum(a)

for i in a:
  s -= i
  ans += s*i

ans = ans%m

print(ans)
Buggy python submission (verdict: Runtime Error):
n = int(input())
if n%9 == 0:
  print('Yes')
else:
  print('No')

Fixed submission:
import math
z,x,t=map(int, input().split())

ans =math.ceil(z/x)*t
print(ans)

Buggy python submission (verdict: Runtime Error):
z, x, t = map(int, input().split())

ans = math.ceil(z/x)*t


Fixed submission:
import math
z,x,t=map(int, input().split())

ans =math.ceil(z/x)*t
print(ans)
Buggy python submission (verdict: Runtime Error):
n = input()
if n%9 == 0:
  print('Yes')
else:
  print('No')

Fixed submission:
n = int(input())
if n%9 == 0:
  print('Yes')
else:
  print('No')

Buggy python submission (verdict: Runtime Error):
n = input()
ifn%9 == 0:
  print('Yes')
else:
  print('No')

Fixed submission:
n = int(input())
if n%9 == 0:
  print('Yes')
else:
  print('No')
Buggy python submission (verdict: Runtime Error):
s = input()

if 'RRR' in s:
  ans == 3
elif 'RR' in s:
  ans = 2
elif 'R' in s:
  ans = 1
else:
  ans = 0

print(str(ans))

Fixed submission:
s = input()

if 'RRR' in s:
  print(3)
elif 'RR' in s:
  print(2)
elif 'R' in s:
  print(1)
else:
  print(0)

Buggy python submission (verdict: Runtime Error):
s = input()
ans = 0
if s == 'RSR':
  ans == 1
else:
  for i in s:
  if i == 'R':
    ans +=1

print(ans)

Fixed submission:
s = input()

if 'RRR' in s:
  print(3)
elif 'RR' in s:
  print(2)
elif 'R' in s:
  print(1)
else:
  print(0)
Buggy python submission (verdict: Time Limit Exceeded):
x,k,d = map(int,input().split())
for i in range(k):
  if abs(x-d)<=abs(x):
    x -=d
  else:
    x+=d

print(abs(x))


Fixed submission:
import math
x,k,d = map(int,input().split())
d = abs(d)
x = abs(x)

if k*d<=x:
  print(x-k*d)
else:
  e = math.floor(x/d)
  k -= e
  x = x-e*d
  if k%2 == 0:
    print(x)
  else:
    print(abs(x-d))
Buggy python submission (verdict: Time Limit Exceeded):
k = int(input())
x = 7
ans = 1
if k%2 == 0 or k%5 ==0:
  ans = -1
elif 7%k == 0:
  ans = 1
else:
  for i in range (1,k):
    x = x*10+7
    if x%k == 0:
      ans = i+1
      break

print(ans)



Fixed submission:
k = int(input())
x = 7
ans = 1
if k%2 == 0 or k%5 ==0:
  print(-1)
  exit()
elif 7%k == 0:
  ans = 1

else:
  for i in range (1,k):
    x = (x*10+7)%k

    if x%k == 0:
      ans = i+1
      break

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
k = int(input())
x = 7
ans = 1
if k%2 == 0 or k%5 ==0:
  ans = -1
elif 7%k == 0:
  ans = 1
else:
  for i in range (k):
    ans +=1
    x = x*10+7
    if x%k == 0:
      break


print(ans)



Fixed submission:
k = int(input())
x = 7
ans = 1
if k%2 == 0 or k%5 ==0:
  print(-1)
  exit()
elif 7%k == 0:
  ans = 1

else:
  for i in range (1,k):
    x = (x*10+7)%k

    if x%k == 0:
      ans = i+1
      break

print(ans)

Buggy python submission (verdict: Runtime Error):
k = int(input())
x = 7
ans = 1
if k%2 == 0 or k%5 ==0:
  ans = -1
elif 7%k == 0:
  ans = 1
else:
  for i in range(k)
    ans +=1
    x = x*10+7
    if x%k == 0:
      break


print(ans)



Fixed submission:
k = int(input())
x = 7
ans = 1
if k%2 == 0 or k%5 ==0:
  print(-1)
  exit()
elif 7%k == 0:
  ans = 1

else:
  for i in range (1,k):
    x = (x*10+7)%k

    if x%k == 0:
      ans = i+1
      break

print(ans)

Buggy python submission (verdict: Runtime Error):
k = int(input())
x = 7
ans = 1
if k%2 == 0 or k%5 ==0:
  ans = -1
elif 7%k == 0:
  ans = 1
else:
  for i in range(k)
    ans +=1
    x = x*10+7
    if x%k == 0:
      break


print(ans)



Fixed submission:
k = int(input())
x = 7
ans = 1
if k%2 == 0 or k%5 ==0:
  print(-1)
  exit()
elif 7%k == 0:
  ans = 1

else:
  for i in range (1,k):
    x = (x*10+7)%k

    if x%k == 0:
      ans = i+1
      break

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
k = int(input())
x = 7
ans = 1
if k%2 == 0 or k%5 ==0:
  ans = -1
else:
  while x%k != 0:
    ans +=1
    x = x*10+7

print(ans)



Fixed submission:
k = int(input())
x = 7
ans = 1
if k%2 == 0 or k%5 ==0:
  print(-1)
  exit()
elif 7%k == 0:
  ans = 1

else:
  for i in range (1,k):
    x = (x*10+7)%k

    if x%k == 0:
      ans = i+1
      break

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
k = int(input())
x = 7
ans = 1
if k%2 == 0 or k%5 ==0:
  ans = -1
else:
  while x%k != 0:
    ans +=1
    x *= 10
    x+=7

print(ans)



Fixed submission:
k = int(input())
x = 7
ans = 1
if k%2 == 0 or k%5 ==0:
  print(-1)
  exit()
elif 7%k == 0:
  ans = 1

else:
  for i in range (1,k):
    x = (x*10+7)%k

    if x%k == 0:
      ans = i+1
      break

print(ans)
Buggy python submission (verdict: Runtime Error):
n,m,k = map(int,input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
c=[]
ac = 0
bc = 0
ans = 0
t = 0
while t<k:
  if bc<=m-1 and ac <=n-1:
    if a[ac] > b[bc]:
      t += b[bc]
      bc +=1
      c.
    else:
      t+= a[ac]
      ac+=1
  elif ac >= n and bc<=m-1:
    t += b[bc]
    bc +=1
    print(t)
  elif bc == m and ac<=n-1:
    t+= a[ac]
    ac+=1
  ans+=1

if t>k:
  ans -=1
  
print(ans)

Fixed submission:
N, M, K = map(int, input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))

a, b = [0], [0]
for i in range(N):
  a.append(a[i] + A[i])
for i in range(M):
  b.append(b[i] + B[i])
ans, j = 0, M
for i in range(N + 1):
  if a[i] > K:
    break
  while b[j] > K - a[i]:
    j -= 1
  ans = max(ans, i + j)
print(ans)
Buggy python submission (verdict: Runtime Error):
n,k = map(int,input().split())
p = list[]
ans = 0

for i in range (n):
  p[i] = int(input())

p.sort()

for i in range(k):
  ans += p[i]

print(ans)

Fixed submission:
n,k = map(int,input().split())
p = list(map(int,input().split()))
ans = 0


p.sort()

for i in range(k):
  ans += p[i]

print(ans)
Buggy python submission (verdict: Runtime Error):
x,y = map(int,input().split())

if y%2 == 0 and x*2<=y<=x*4:
  print('Yes')
else:
  print('No')

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

for i in range(5):
  if x[i] == 0:
    print(i+1)

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

for i in range(%):
  if x[i] == 0:
    print(i+1)

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

for i in range(5):
  if x[i] == 0:
    print(i+1)

Buggy python submission (verdict: Runtime Error):
x= list(map(int,input().split()))
for i in x:
  if x[i] == 0:
    print(i+1)
    

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

for i in range(5):
  if x[i] == 0:
    print(i+1)
Buggy python submission (verdict: Runtime Error):
x,y = map(int,input().split())

if y%2 == 0 and x*2=<y<=x*4:
  print('Yes')
else:
  print('No')

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

if y%2 == 0 and x*2 <=y <=x*4:
  print('Yes')
else:
  print('No')
Buggy python submission (verdict: Runtime Error):
N = map(int, input().split())
p = list(map(int, input().split()))
for d in range(X + 1):
  for s in [-1, +1]:
    a = X + s * d
    if p.count(a) == 0:
      print(a)
      exit(0)


Fixed submission:
X,N = map(int, input().split())
p = list(map(int, input().split()))
for d in range(X + 1):
  for s in [-1, +1]:
    a = X + s * d
    if p.count(a) == 0:
      print(a)
      exit(0)
Buggy python submission (verdict: Runtime Error):
n = input()
a = list(map(int,input().split()))
ans = 1
for i in a:
  ans *=i
  if ans>10**18:
  ans = -1
  break

print(ans)

Fixed submission:
n = input()
a = list(map(int,input().split()))
ans = 1
t = False

for i in a:
  if i == 0:
    ans = 0
    t = True

if t != True:
  for i in a:
    ans *=i
    if ans>10**18:
      ans = -1
      break
    
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
n = input()
a = list(map(int,input().split()))
ans = 1
for i in a:
  ans *=i

if ans>10**18:
  ans = -1

print(ans)

Fixed submission:
n = input()
a = list(map(int,input().split()))
ans = 1
t = False

for i in a:
  if i == 0:
    ans = 0
    t = True

if t != True:
  for i in a:
    ans *=i
    if ans>10**18:
      ans = -1
      break
    
print(ans)
Buggy python submission (verdict: Runtime Error):
a,b = map(float,input().split())
b = int(b.replace(".",""))
print(int(a*b//100))

Fixed submission:
a,b = input().split()
a = int(a)
b = int(b.replace(".",""))
print(int(a*b//100))

Buggy python submission (verdict: Runtime Error):
a,b = map(float,input().split())
b *=100
print(int(a*b//100))a

Fixed submission:
a,b = input().split()
a = int(a)
b = int(b.replace(".",""))
print(int(a*b//100))

Buggy python submission (verdict: Runtime Error):
import math
a,b = map(int,input().split())

print(math.floor(a*b))

Fixed submission:
a,b = input().split()
a = int(a)
b = int(b.replace(".",""))
print(int(a*b//100))

Buggy python submission (verdict: Runtime Error):
import math
a,b = map(int,input(),split())

print(math.floor(a*b))

Fixed submission:
a,b = input().split()
a = int(a)
b = int(b.replace(".",""))
print(int(a*b//100))
Buggy python submission (verdict: Runtime Error):
import math
a,b,h,m = map(int,input().split())
t = h*60+m
mt = 720
rh = math.radians(t/60/720)
rm = math.radians()
r= rh-rm
print(rh)

Fixed submission:
import math
a,b,h,m= map(int, input().split())

hr = 30*h+0.5*m
mr = 6*m
ans = a**2+b**2-2*a*b*math.cos(math.radians(hr-mr))
print(math.sqrt(ans))
Buggy python submission (verdict: Time Limit Exceeded):
x  = int(input())
t = 100
ans = 0
while t<x:
  t = t//100
  ans +=1

print(ans)

Fixed submission:
x  = int(input())
t = 100
ans = 0
while t<x:
  t += t//100
  ans +=1

print(ans)
Buggy python submission (verdict: Runtime Error):
a,b,cd = map(int,input().split())
while a>=0 and b>=0:
  b-=c
  d-=a
if d == 0 and b==0:
  print('Yes')
elif b == 0:
  print('Yes')
else:
  print('No')

Fixed submission:
a,b,c,d = map(int,input().split())
while a>0 and b>0:
  a-=d
  c-=b

if a <= 0 and c<=0:
  print('Yes')
elif c <= 0:
  print('Yes')
else:
  print('No')

Buggy python submission (verdict: Runtime Error):
a,b,c.d = map(int,input().split())
while a>=0 and b>=0:
  b-=c
  d-=a
if a == 0 and b==0:
  print('Yes')
elif b == 0:
  print('Yes')
else:
  print('No')

Fixed submission:
a,b,c,d = map(int,input().split())
while a>0 and b>0:
  a-=d
  c-=b

if a <= 0 and c<=0:
  print('Yes')
elif c <= 0:
  print('Yes')
else:
  print('No')

Buggy python submission (verdict: Runtime Error):
a,b,c.d = map(int,input().split())
while a>=0 ans b>=0:
  b-=c
  d-=a
if a == 0 and b==0:
  print('Yes')
elif b == 0:
  print('Yes')
else:
  print('No')

Fixed submission:
a,b,c,d = map(int,input().split())
while a>0 and b>0:
  a-=d
  c-=b

if a <= 0 and c<=0:
  print('Yes')
elif c <= 0:
  print('Yes')
else:
  print('No')
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
sl = []
ans = 0
for i in  range (n):
  s = input()
  if s not in sl:
    sl.append(s)
    ans +=1
print(ans)

Fixed submission:
n = int(input())
sl = set()
for i in  range (n):
  s = input()
  sl.add(s)
print(len(sl))
Buggy python submission (verdict: Runtime Error):
s =input()
if s=='AAA' or s=='BBB:
  print('No')
else:
  print('Yes')

Fixed submission:
s =input()
if s=='AAA' or s=='BBB':
  print('No')
else:
  print('Yes')
Buggy python submission (verdict: Runtime Error):
import math
n=int(input())
print(math.ceil(n/2))

Fixed submission:
n,r=map(int,input().split())
ans = r
if n<10:
  ans = r+100*(10-n)
print(ans)
Buggy python submission (verdict: Runtime Error):
n,k=map(int,input().split())
if n<k:
  print(1)
  exit()
for i in range (100):
  if k**i==n:
    print(i)
  else:
     k**i < n <k**(i+1)
    print(i+1)

Fixed submission:
n,k=map(int,input().split())
ans=0
while n>0:
  n = n//k
  ans +=1
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
n,k=map(int,input().split())
if n<k:
  print(1)
  exit()
for i in range (n):
  if k**i < n <k**(i+1):
    print(i+1)

Fixed submission:
n,k=map(int,input().split())
ans=0
while n>0:
  n = n//k
  ans +=1
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
a = list(map(int,input().split()))
for i in range (n):
  for j in range(n):
    if i != j:
      if a[i] == a[j]:
        print('NO')
        exit()
print('YES')

Fixed submission:
n=int(input())
a = list(map(int,input().split()))
a.sort()
for i in range (n-1):
  if a[i] == a[i+1]:
    print('NO')
    exit()
print('YES')
Buggy python submission (verdict: Time Limit Exceeded):
import itertools
N = int(input())

cnt = 0
L = list(range(1, N))
for i in itertools.product(L, repeat=3):
    if (i[0]*i[1])+i[2] == N:
        cnt += 1

print(cnt)

Fixed submission:
N = int(input())
ans = 0
for i in range(N-1):
    ans += (N-1)//(i+1)
    
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(map(int, input().split()))
s = sum(A)
ans = 0
for i in range(N):
    s = sum(A[i:N])
    s -= A[i]
    ans += A[i]*s
    
print(ans%((10**9)+7))

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

ans = 0
s = sum(A)
for i in range(N-1):
    s -= A[i]
    ans += A[i]*s
    
print(ans%((10**9)+7))

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(map(int, input().split()))

ans = 0
for i in range(N-1):
    for j in range(i+1, N):
        ans += A[i]*A[j]
    
print(ans%((10**9)+7))

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

ans = 0
s = sum(A)
for i in range(N-1):
    s -= A[i]
    ans += A[i]*s
    
print(ans%((10**9)+7))

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

S = list(itertools.combinations(A,2))
ans = 0
for s in S:
    ans += s[0]*s[1]
    
print(ans%((10**9)+7))

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

ans = 0
s = sum(A)
for i in range(N-1):
    s -= A[i]
    ans += A[i]*s
    
print(ans%((10**9)+7))
Buggy python submission (verdict: Time Limit Exceeded):
import sys
X, K, D = map(int, input().split())
if X == D and K%2 == 0:
    print(abs(X))
    sys.exit(0)
for _ in range(K):
    if abs(X+D) > abs(X-D):
        X -= D
    else:
        X += D
print(abs(X))

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

X = abs(X)

if K <= int(X/D):
    X -= D*K
    print(abs(X))
else:
    K -= int(X/D)
    X -= D*int(X/D)
    if K % 2 == 0:
        print(abs(X))
    else:
        print(abs(X-D))
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
C = list(input())

C_l = []
ans = []
for _ in range(N):
    w = C_l.count("W")
    r = C.count("R")
    ans.append(max(w, r))
    C_l.append(C.pop(0))
w = C_l.count("W")
r = C.count("R")
ans.append(max(w, r))
print(min(ans))

Fixed submission:
N = int(input())
C = list(input())

r = C.count("R")

cnt = 0
for i in range(r):
    if C[i] == "W":
        cnt += 1
        
print(cnt)
Buggy python submission (verdict: Time Limit Exceeded):
from functools import reduce
N, K = map(int, input().split())
A = list(map(int, input().split()))

for k in range(N-K):
    score1 = reduce(lambda x,y: x*y, A[k:K+k])
    score2 = reduce(lambda x, y: x*y, A[k+1:K+k+1])
    if score1 < score2:
        print("Yes")
    else:
        print("No")

Fixed submission:
from functools import reduce
N, K = map(int, input().split())
A = list(map(int, input().split()))

for k in range(N-K):
    score1 = A[k]
    score2 = A[K+k]
    if score1 < score2:
        print("Yes")
    else:
        print("No")
Buggy python submission (verdict: Runtime Error):
A, V = map(int, input().split())
B, W = map(int, input().split())
T = int(input())

a = V*T+A
b = W*T+B

if V >= W:
    if abs(A-B)/(V-W) <= T:
        print("YES")
    else:
        print("NO")
else:
    print("NO")

Fixed submission:
A, V = map(int, input().split())
B, W = map(int, input().split())
T = int(input())

a = V*T+A
b = W*T+B

if V > W:
    if abs(A-B)/(V-W) <= T:
        print("YES")
    else:
        print("NO")
else:
    print("NO")
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(map(int, input().split()))

ans = 1
for a in A:
    ans *= a

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

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

A = sorted(A)
ans = 1
for a in A:
    ans *= a
    if a == 0:
        ans = 0
        break
    if ans > 10**18:
        ans = -1
        break

print(ans)
Buggy python submission (verdict: Runtime Error):
from operator import sub, add
import sys
N, M, X = map(int, input().split())
AC = []
for _ in range(N):
    AC.append(list(map(int, input().split())))

S = [sum(x) for x in zip(*AC)]
s = [sum(x) for x in zip(*AC)]
for m in range(1, M+1):
    if s[m] < X:
        print(-1)
        sys.exit(0)
        
AC.sort(reverse=True)        
for n in range(N):
    ac = AC[n]
    s = list(map(sub, s, ac))
    for m in range(1, M+1):
        if s[m] < X:
            s = list(map(add, s, ac))
            break
            
print(min(S, s[0]))

Fixed submission:
import itertools as it

N,M,X=map(int,input().split())
book = [[int(_) for _ in input().split()] for i in range(N)]

combs = it.product([0, 1], repeat=N)
prices = []
for comb in combs:
	bag = [0] * (M+1)
	for i in range(N):
		if comb[i] == 0:
			continue
		else:
			for j in range(M+1):
				bag[j]+=book[i][j]
	if min(bag[1:]) < X:
		continue
	else:
		prices.append(bag[0])

if len(prices) == 0:
	print(-1)
else:
	print(min(prices))
Buggy python submission (verdict: Runtime Error):
N, M = map(int, input().split())
H = list(map(int, input().split()))
AB = [list(map(int, input().split())) for m in range(M)]
AB = list(map(list, set(map(tuple, AB))))

i = []
for m in range(len(AB)):
    a = AB[m][0]
    b = AB[m][1]
    if H[a-1] >= H[b-1]:
        i.append(b-1)
    elif H[a-1] <= H[b-1]:
        i.append(a-1)

i = list(set(i))
for x in i:
    H[i] = 0

cnt = H.count(0)
print(len(H)-cnt)

Fixed submission:
N, M = map(int, input().split())
H = list(map(int, input().split()))
AB = [list(map(int, input().split())) for m in range(M)]
AB = list(map(list, set(map(tuple, AB))))

i = []
for m in range(len(AB)):
    a = AB[m][0]
    b = AB[m][1]
    if H[a-1] > H[b-1]:
        i.append(b-1)
    elif H[a-1] < H[b-1]:
        i.append(a-1)
    else:
        i.append(a-1)
        i.append(b-1)

i = list(set(i))
print(len(H)-len(i))
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(map(int, input().split()))

for i in range(1, N+1):
    print(A.count(i))

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

c = collections.Counter(A)
for i in range(1, N+1):
    print(c[i])

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(map(int, input().split()))

for i in range(1, N+1):
    count = 0
    for a in A:
        if i == a:
            count += 1
    print(count)

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

c = collections.Counter(A)
for i in range(1, N+1):
    print(c[i])
Buggy python submission (verdict: Runtime Error):
N, K = map(int, input().split())

if abs(N-K) < N:
    if N >= K:
        if K/(N%K) >= 1:
            print(K%(N%K))
        else:
            print(N % K)
    else:
        if N/(K%N) >= 1:
            print(N%(K%N))
        else:
            print(K % N)
else:
    print(N)

Fixed submission:
#coding:utf-8

n,k = map(int,input().split())

r1 = n % k
r2 = abs(k - r1)

ans = min(r1,r2)

print("{}".format(ans))

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

if N >= K:
    print(N % K)
else:
    print(K % N)

Fixed submission:
#coding:utf-8

n,k = map(int,input().split())

r1 = n % k
r2 = abs(k - r1)

ans = min(r1,r2)

print("{}".format(ans))

Buggy python submission (verdict: Time Limit Exceeded):
N, K = map(int, input().split())

x = [N]
i = 0
while True:
    N = abs(N-K)
    x.append(N)
    i += 1
    if x[i-1] <= x[i]:
        break
print(min(x))

Fixed submission:
#coding:utf-8

n,k = map(int,input().split())

r1 = n % k
r2 = abs(k - r1)

ans = min(r1,r2)

print("{}".format(ans))