Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
import numpy as np
import sys

A, B = list(map(int,input().split()))

L = int(np.ceil(np.log2(B)))
result = 0

for i in range(L+1):
    am = 0
    zen = 2**(i+1)
    han = zen//2

    s = A%zen
    e = B%zen+1

    b = (max(e-han,0) + max(s-han,0) ) %2
    # print(s,e,b)
    result += han*b

print(result)

Fixed submission:
import numpy as np
import sys

A, B = list(map(int,input().split()))

def f(x):
    if x%4 == 0:
        return x
    elif x%4 == 1:
        return x^(x-1)
    elif x%4 == 2:
        return x^1
    else:
        return x^(x-1)^1

print(f(A-1)^f(B))

Buggy python submission (verdict: Runtime Error):
import numpy as np
import sys

A, B = list(map(int,input().split()))

def calcs(val, han):
    if val < han:
        am = han
    else:
        am = zen-(val)
    return am

def calce(val, han):
    if val < han:
        am = han
    else:
        am = zen-(val+1)
    return am


L = int(np.ceil(np.log2(B)))
result = 0
for i in range(L+1):
    am = 0

    zen = 2**(i+1)
    han = zen//2
    # if i==0:
        # b = (B-A)%2
    # else:
    b = (calcs(A%zen, han) + calce(B%zen, han))%2

    # print(i, zen, han , "  |  ", A%zen, calcs(A%zen, han), "  |  ", B%zen, calce(B%zen, han))
    # print(b)

    result += han*b

print(result)

Fixed submission:
import numpy as np
import sys

A, B = list(map(int,input().split()))

def f(x):
    if x%4 == 0:
        return x
    elif x%4 == 1:
        return x^(x-1)
    elif x%4 == 2:
        return x^1
    else:
        return x^(x-1)^1

print(f(A-1)^f(B))
Buggy python submission (verdict: Time Limit Exceeded):
N,P=map(int,input().split())
maxfac = round(P**(1/N))
# print(range(1,maxfac+1))
if N==1:
    print(P)
    exit()
for i in range(1,maxfac+2)[::-1]:
    p = i**N
    # print(P%p)
    if P%p == 0:
        print(i)
        break


Fixed submission:
N,P=map(int,input().split())
maxfac = int(P**(1/N))
# print(range(1,maxfac+1))
if N==1:
    print(P)
    exit()
elif N > 10**6:
    print(1)
    exit()
for i in range(1,maxfac+2)[::-1]:
    p = i**N
    # print(P%p)
    if P%p == 0:
        print(i)
        break

Buggy python submission (verdict: Time Limit Exceeded):
N,P=map(int,input().split())
maxfac = int(P**(1/N))
# print(range(1,maxfac+1))
if N==1:
    print(P)
    exit()
for i in range(1,maxfac+2)[::-1]:
    p = i**N
    # print(P%p)
    if P%p == 0:
        print(i)
        break


Fixed submission:
N,P=map(int,input().split())
maxfac = int(P**(1/N))
# print(range(1,maxfac+1))
if N==1:
    print(P)
    exit()
elif N > 10**6:
    print(1)
    exit()
for i in range(1,maxfac+2)[::-1]:
    p = i**N
    # print(P%p)
    if P%p == 0:
        print(i)
        break
Buggy python submission (verdict: Time Limit Exceeded):
from collections import defaultdict
d = defaultdict(int)

N = int(input())
for _ in range(N):
  d[input()] += 1

for i in sorted([k for k, v in d.items() if v == max(d.values())]):
  print(i)


Fixed submission:
import collections

N = int(input())
S = []
for _ in range(N):
  S += [input()]
d = collections.Counter(S).most_common()

for i in sorted([k for k, v in d if v == d[0][1]]):
  print(i)

Buggy python submission (verdict: Time Limit Exceeded):
from collections import defaultdict
d = defaultdict(int)

N = int(input())
for _ in range(N):
  d[input()] += 1

for i in sorted([k for k, v in d.items() if v == max(d.values())]):
  print(i)


Fixed submission:
import collections

N = int(input())
S = []
for _ in range(N):
  S += [input()]
d = collections.Counter(S).most_common()

for i in sorted([k for k, v in d if v == d[0][1]]):
  print(i)
Buggy python submission (verdict: Time Limit Exceeded):
N, K = map(int, input().split())
p = list(map(int, input().split()))
q = []
for pp in p:
  q += [(pp+1)/2]
ans = 0
for i in range(N-K+1):
  ans = max(ans, sum(q[i:i+K]))
print(ans)

Fixed submission:
N, K = map(int, input().split())
p = list(map(int, input().split()))
q = []
for pp in p:
  q += [(pp+1)/2]
ans = 0
tem = sum(q[:K])
for i in range(K,N+1):
  if i != K: tem += q[i-1] - q[i-K-1]
  ans = max(ans, tem)
print(ans)
Buggy python submission (verdict: Runtime Error):
N, M = map(int, input.split())
print('Yes' if N == M else 'No)

Fixed submission:
N, M = map(int, input().split())
print('Yes' if N == M else 'No')
Buggy python submission (verdict: Runtime Error):
a, b = input().split()
print(min(int(a*int(b)), int(b*int(a))


Fixed submission:
a, b = input().split()
print(max(int(a*int(b)), int(b*int(a))))

Buggy python submission (verdict: Runtime Error):
a, b = input().split()
print(max(int(a*int(b)), int(b*int(a))

Fixed submission:
a, b = input().split()
print(max(int(a*int(b)), int(b*int(a))))
Buggy python submission (verdict: Time Limit Exceeded):
X = int(input())
Y = 0
while Y == 0:
  Y = 1
  for i in range(2,X-1):
    Y = Y * (X % i)
  X += 1
print(X-1)

Fixed submission:
X = int(input())
Y = 0
while Y == 0:
  Y = 1
  for i in range(2,int(X*0.5+1)):
    Y = Y * (X % i)
  X += 1
print(X-1)
Buggy python submission (verdict: Runtime Error):
A1, A2, A3 = map(input().split(), int)

print('win' if A1+A2+A3 <= 21 else 'bust')

Fixed submission:
A1, A2, A3 = map(int, input().split())
 
print('win' if A1+A2+A3 <= 21 else 'bust')
Buggy python submission (verdict: Runtime Error):
M1, D1 = map(int, input())
M2, D2 = map(int, input())
if M1 == M2:
  print(0)
else:
  print(1)
  

Fixed submission:
M1, D1 = map(int, input().split())
M2, D2 = map(int, input().split())
if M1 == M2:
  print(0)
else:
  print(1)
Buggy python submission (verdict: Runtime Error):
import math
A, B, X = map(int, input().split())
L = []
for ln_N in range(17):
    N = math.floor((X - B * ln_N) / A)
    if N <= 0:
        L.append(0)
    else:
        if math.floor(math.log10(N)+1) == ln_N:
            L.append(N)
print(min(1000000000,max(L)))


Fixed submission:
S = input()
L = ['SAT','FRI','THU','WED','TUE','MON','SUN']
for i,l in enumerate(L):
  if S == l:
    print(i+1)
    break

Buggy python submission (verdict: Runtime Error):
L = ['SAT','FRI','THU','WED','TUE','MON','SUN']

for i,l in enumerate(L):
  if S == l:
    print(i+1)
    break

Fixed submission:
S = input()
L = ['SAT','FRI','THU','WED','TUE','MON','SUN']
for i,l in enumerate(L):
  if S == l:
    print(i+1)
    break
Buggy python submission (verdict: Runtime Error):
N = input()
S= input()
hoge=[]
Alphas='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
 
for a in S:
  for i, Alpha in enumerate(Alphas):
    if Alpha == a:
      hoge.append(Alphas[(i+N)%26])
      break
mojiretsu=''
for x in hoge:
    mojiretsu += x
print(mojiretsu)

Fixed submission:
N = int(input())
S = input()
hoge=[]
Alphas='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
 
for a in S:
  for i, Alpha in enumerate(Alphas):
    if Alpha == a:
      hoge.append(Alphas[(i+N)%26])
      break
mojiretsu=''
for x in hoge:
    mojiretsu += x
print(mojiretsu)

Buggy python submission (verdict: Runtime Error):
N=input()
S=input()
hoge=[]
Alphas='ABCDEFGHIJKLMNOPQRSTUVWXYZ'

for a in S:
  for i, Alpha in enumerate(Alphas):
    if Alpha == a:
      hoge.append(Alphas[(i+N)%26])
      break
print(hoge)      

Fixed submission:
N = int(input())
S = input()
hoge=[]
Alphas='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
 
for a in S:
  for i, Alpha in enumerate(Alphas):
    if Alpha == a:
      hoge.append(Alphas[(i+N)%26])
      break
mojiretsu=''
for x in hoge:
    mojiretsu += x
print(mojiretsu)
Buggy python submission (verdict: Runtime Error):
import math
r = int(input())

S = r * r * math.pi
fraction = S / (1 * 1 * math.pi)

print(fractions)

Fixed submission:
r = int(input())
print(r*r)
Buggy python submission (verdict: Runtime Error):
N = int(input())
S = input()
if N%2 == 0:
    print(S[:int(N/2)] == S[int(N/2):])
else:
	print(false)

Fixed submission:
N = int(input())
S = input()
if N%2 == 0:
    if S[:int(N/2)] == S[int(N/2):]:
      print('Yes')
    else:
      print('No')
else:
	print('No')
Buggy python submission (verdict: Runtime Error):
import pandas as pd
import numpy as np
from itertools import combinations

z = []
N = int(input())
for i in range(N):
    temp_x, temp_y = map(int, input().split())
    z = z + [temp_x] + [temp_y]
z = np.array(z).reshape(N,2)
print(z)

d = 0
count = 0
for j, k in combinations(range(N),2):
    temp_d = np.sqrt((z[j,0] - z[k,0])**2 + (z[j,1] - z[k,1])**2)
    d += temp_d
    count += 1
print(d*(N-1)/count)

Fixed submission:
import numpy as np
from itertools import combinations
 
z = []
N = int(input())
for i in range(N):
    temp_x, temp_y = map(int, input().split())
    z = z + [temp_x] + [temp_y]
z = np.array(z).reshape(N,2)
 
d = 0
count = 0
for j, k in combinations(range(N),2):
    temp_d = np.sqrt((z[j,0] - z[k,0])**2 + (z[j,1] - z[k,1])**2)
    d += temp_d
    count += 1
print(d*(N-1)/count)
Buggy python submission (verdict: Runtime Error):
A, B = map(int, input().split())
print(A - 2*B if A - 2*B > 0 else: 0)

Fixed submission:
A, B = map(int, input().split())
print(A - 2*B if A - 2*B > 0 else 0)
Buggy python submission (verdict: Runtime Error):
N = int(input())
if N % 2 == 0:
  print(0.5)
else:
  print((N//2+1)/N

Fixed submission:
N = int(input())
if N % 2 == 0:
  print(0.5)
else:
  print((N//2+1)/N)
Buggy python submission (verdict: Runtime Error):
#142
import pandas as pd
N = int(input())
S = list(map(int,input().split()))
df = pd.DataFrame()
for i, j in enumerate(S,1):
    df_tem = pd.DataFrame([i, j]).T
    df = pd.concat([df, df_tem], axis=0)
df.columns = ['x', 'y']
df = df.sort_values(by='y')

print(' '.join(list(map(str,df['x'].tolist()))))

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

l = []
for i, j in enumerate(S,1):
    l_tem = [i,j]
    l += l_tem
l = np.array(l).reshape(N,2)
l = list(l[np.argsort(l[:,1])][:,0])

print(' '.join(list(map(str,l))))
Buggy python submission (verdict: Time Limit Exceeded):
#141
N, K, Q = map(int, input().split())

A = []
for i in range(Q):
    A += [int(input())]

cnt = 0
for j in range(N):
    for k in range(Q):
        if A[k] == j+1:
            cnt += 1
    print('No' if (Q - cnt) >= K else 'Yes')
    cnt = 0

Fixed submission:
#141
N, K, Q = map(int, input().split())

cnt = 0
P = [K - Q] * N
for i in range(Q):
    idx = int(input()) - 1    
    P[idx] += 1

for j in range(N):
    if P[j] > 0:
        print('Yes')
    else:
        print('No')
Buggy python submission (verdict: Runtime Error):
A, B = map(int, input().split())
plug = 1
cnt = 0
while plug < B:
  plug += A - 1
  cnt += 1
print(cnt)

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

X = 0
j = A[0]
for i in A:
  X += B[i-1]
  if i == j+1:
    X+= C[j-1]
  j = i
print(X)
Buggy python submission (verdict: Runtime Error):
a = int(input())
s = input()
print(s if a >= 3200 else 'red)

Fixed submission:
a = int(input())
s = input()
print(s if a >= 3200 else 'red')
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
s = []
for i in range(N):
  s += [''.join(sorted(input()))]
set_s = set(s)
cnt = 0
for j in set_s:
  cnt += s.count(j)*(s.count(j) - 1) // 2
print(int(cnt+0.5))

Fixed submission:
from collections import Counter

N = int(input())
s = []
for i in range(N):
  s += [''.join(sorted(input()))]
cnt = sum([x*(x - 1) // 2 for x in Counter(s).values()])
print(int(cnt+0.5))

Buggy python submission (verdict: Time Limit Exceeded):
from scipy.misc import comb
N = int(input())
s = []
for i in range(N):
  s += [''.join(sorted(input()))]
set_s = set(s)
cnt = 0
for j in set_s:
  cnt += comb(s.count(j),2)
print(int(cnt+0.5))

Fixed submission:
from collections import Counter

N = int(input())
s = []
for i in range(N):
  s += [''.join(sorted(input()))]
cnt = sum([x*(x - 1) // 2 for x in Counter(s).values()])
print(int(cnt+0.5))
Buggy python submission (verdict: Runtime Error):
A, B = map(int, input())
if (A+B)%2==0:
  print((A+B)/2)
else:
  print('IMPPOSSIBLE') 

Fixed submission:
A, B = map(int, input().split())
if (A+B)%2==0:
  print(int((A+B)/2)) 
else:
  print('IMPOSSIBLE')
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = []
for _ in range(N):
  A += [int(input())]
for i in range(N):
  print(max([A[j] for j in range(N) if j != i])) 

Fixed submission:
N = int(input())
A = []
for _ in range(N):
  A += [int(input())]
Amax = max(A)
Amax2 = sorted(A, reverse=True)[1]
for i in A:
  print(Amax if i != Amax else Amax2)
Buggy python submission (verdict: Runtime Error):
from itertools import combinations
N, D = map(int, input().split())
X = []
cnt = 0
for _ in range(N):
  X += list(map(int, input().split()))
print(combinations(N,2))


Fixed submission:
from itertools import combinations
N, D = map(int, input().split())
X = []
for _ in range(N):
  X += list(map(int, input().split()))
cnt = 0
for i, j in combinations(range(N),2):
  d = 0
  for k in range(D):
    d += (X[i*D + k] - X[j*D + k])**2
  if int(d**0.5)**2 == d: cnt += 1
print(cnt)
Buggy python submission (verdict: Runtime Error):
n = int(input())
p = list(map(int, input().split()))
cnt = 0
for i in range(1,n-1):
  if (p[n] > p[n-1]) and (p[n] < [n+1]): cnt += 1
print(cnt)
    
  

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

cnt = 0
for i in range(1,n-1):
  if (p[i] > p[i-1]) and (p[i] < p[i+1]): cnt += 1
  if (p[i] < p[i-1]) and (p[i] > p[i+1]): cnt += 1
print(cnt)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
d = list(map(int, input().split()))
cnt = 0
maxd = max(d)
mind = min(d)
for K in range(mind, maxd+1):
  if len([i for i in d if i >= K]) == len([i for i in d if i < K]): cnt += 1
print(cnt)
  

Fixed submission:
N = int(input())
d = list(map(int, input().split()))
sor_d = sorted(d)
print(sor_d[int(N*0.5)]-sor_d[int(N*0.5)-1])
Buggy python submission (verdict: Runtime Error):
X, A = map(int, input(),split())
print(0 if X < A else 10)

Fixed submission:
X, A = map(int, input().split())
print(0 if X < A else 10)
Buggy python submission (verdict: Time Limit Exceeded):
N, K = map(int,input().split())
h = list(map(int, input().split()))

dp = [1e+09]*N
dp[0] = 0
for i in range(1,N):
  for j in range(1,K+1):
    if i >= j: dp[i] = min(dp[i],dp[i-j]+abs(h[i] - h[i-j]))
print(int(dp[-1]))

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

dp = [1e+09]*N
dp[0] = 0
for i in range(1,N):
  for j in range(1,K+1):
    if i >= j: dp[i] = min(dp[i],dp[i-j]+abs(h[i] - h[i-j]))
print(int(dp[-1]))

Buggy python submission (verdict: Runtime Error):
import numpy as np
N, K = map(int,input().split())
h = list(map(int, input().split()))

dp = np.full(N, np.inf)
dp[0] = 0
for i in range(1,N):
  for j in range(1,K+1):
    if i >= j: dp[i] = np.min(dp[i],dp[i-j]+np.abs(h[i] - h[i-j]))
print(int(dp[-1]))


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

dp = [1e+09]*N
dp[0] = 0
for i in range(1,N):
  for j in range(1,K+1):
    if i >= j: dp[i] = min(dp[i],dp[i-j]+abs(h[i] - h[i-j]))
print(int(dp[-1]))

Buggy python submission (verdict: Runtime Error):
import numpy as np
N, K = map(int,input().split())
h = list(map(int, input().split()))

dp = np.full(N, np.inf)
dp[0] = 0
for i in range(1,N):
  for j in range(1,K+1):
    if i >= j: dp[i] = np.min(dp[i],dp[i-j]+np.abs(h[i] - h[i-j]))
print(int(dp[-1]))

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

dp = [1e+09]*N
dp[0] = 0
for i in range(1,N):
  for j in range(1,K+1):
    if i >= j: dp[i] = min(dp[i],dp[i-j]+abs(h[i] - h[i-j]))
print(int(dp[-1]))

Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np
N, K = map(int,input().split())
h = list(map(int, input().split()))

dp = np.full(N, np.inf)
dp[0] = 0
for i in range(1,N):
  for j in range(1,K+1):
    if i >= j: dp[i] = min(dp[i],dp[i-j]+np.abs(h[i] - h[i-j]))
print(int(dp[-1]))

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

dp = [1e+09]*N
dp[0] = 0
for i in range(1,N):
  for j in range(1,K+1):
    if i >= j: dp[i] = min(dp[i],dp[i-j]+abs(h[i] - h[i-j]))
print(int(dp[-1]))
Buggy python submission (verdict: Time Limit Exceeded):
N, W = map(int, input().split())
wv = []
for _ in range(N):
  wv += list(map(int, input().split()))
dp = [[0 for i in range(W+1)] for j in range(N+1)]
for i in range(N):
  for w in range(W+1):  
    if w-wv[2*i] >= 0:
      dp[i+1][w] = max(dp[i+1][w], dp[i][w-wv[2*i]]+wv[2*i+1])
    dp[i+1][w] = max(dp[i+1][w], dp[i][w])
print(dp[N][W])

Fixed submission:
N, W = map(int, input().split())
wv = []
for _ in range(N):
  wv += list(map(int, input().split()))
dp = [[0 for i in range(W+1)] for j in range(N+1)]
for i in range(N):
  for w in range(W+1):  
    if w-wv[2*i] >= 0:
      dp[i+1][w] = max(dp[i+1][w], dp[i][w-wv[2*i]]+wv[2*i+1])
    dp[i+1][w] = max(dp[i+1][w], dp[i][w])
print(dp[N][W])

Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np
N, W = map(int, input().split())
wv = []
for _ in range(N):
  wv += list(map(int, input().split()))
wv = np.array(wv).reshape(N,2)
dp = np.zeros((110, 100100))
for i in range(N):
  for w in range(W+1):
    if w - wv[i,0] >= 0:
      dp[i+1,w] = max(dp[i+1,w], dp[i,(w-wv[i,0])]+wv[i,1])
    dp[i+1,w] = max(dp[i+1,w], dp[i, w])
print(int(dp[N,W]))

Fixed submission:
N, W = map(int, input().split())
wv = []
for _ in range(N):
  wv += list(map(int, input().split()))
dp = [[0 for i in range(W+1)] for j in range(N+1)]
for i in range(N):
  for w in range(W+1):  
    if w-wv[2*i] >= 0:
      dp[i+1][w] = max(dp[i+1][w], dp[i][w-wv[2*i]]+wv[2*i+1])
    dp[i+1][w] = max(dp[i+1][w], dp[i][w])
print(dp[N][W])
Buggy python submission (verdict: Time Limit Exceeded):
N, W = map(int, input().split())
wv = []
for _ in range(N):
  wv += list(map(int, input().split()))
dp = [[0 for i in range(W+1)] for j in range(N+1)]
for i in range(N):
  for w in range(W+1):  
    if w-wv[2*i] >= 0:
      dp[i+1][w] = max(dp[i+1][w], dp[i][w-wv[2*i]]+wv[2*i+1])
    dp[i+1][w] = max(dp[i+1][w], dp[i][w])
print(dp[N][W])

Fixed submission:
N, W = map(int, input().split())
wv = []
for _ in range(N):
  wv += list(map(int, input().split()))
MAX_N, MAX_V = 110, 100100
dp = [[10e+09 for i in range(MAX_V)] for j in range(MAX_N)]
dp[0][0] = 0
for i in range(N):
  for v in range(MAX_V):  
    if v-wv[2*i+1] >= 0:
      dp[i+1][v] = min(dp[i+1][v], dp[i][v-wv[2*i+1]]+wv[2*i])
    dp[i+1][v] = min(dp[i+1][v], dp[i][v])
for v in range(MAX_V):
  if dp[N][v] <= W: res = v
print(res)
Buggy python submission (verdict: Runtime Error):
x = input()
if x>= 30:
  print("Yes")
else:
  print("No")

Fixed submission:
x = int(input())
if x>= 30:
  print("Yes")
else:
  print("No")
Buggy python submission (verdict: Runtime Error):
#input one int
#a = int(input())

#input some val
#a, b, c = (int(i) for i in input().split())
#val = [[int(i) for i in input().split()] for i in range(N)]

#input matrix
#a = [input().split() for i in range()]

x, y = (int(i for i in input().split()))
print(x+(y/2))

Fixed submission:
#input one int
#a = int(input())

#input some val
#a, b, c = (int(i) for i in input().split())
#val = [[int(i) for i in input().split()] for i in range(N)]

#input matrix
#a = [input().split() for i in range()]

x, y = (int(i) for i in input().split())
res = x + (y/2)
print(int(res))
Buggy python submission (verdict: Runtime Error):
        h0, w0, k0 = [ int(x) for x in input().split() ]
        buf = {}
        for i in range(h0):
          buf[1 << i] = { 1 << j for j,x in enumerate(input()) if x == '#' }
        found = 0
        for i in range(1, 1 << h0):
          idx = {}
          for k,v in buf.items():
            if k & i == 0: continue
            for v in vs: idx[v] = idx.get(v, 0) + 1
          for j in range(1, 1 << w0):
            n = sum([ v for k,v in idx.items() if k & j ])
            if n == k0: found += 1
        print(found)

Fixed submission:
h0, w0, k0 = [ int(x) for x in input().split() ]
found, buf = 0, {}
for i in range(h0): buf[1 << i] = { 1 << j for j,x in enumerate(input()) if x == '#' }
for i in range(1, 1 << h0):
  idx = {}
  for k,vs in buf.items():
    if k & i == 0: continue
    for v in vs: idx[v] = idx.get(v, 0) + 1
  for j in range(1, 1 << w0):
    n = sum([ v for k,v in idx.items() if k & j ])
    if n == k0: found += 1
print(found)

Buggy python submission (verdict: Runtime Error):
    h0, w0, k0 = [ int(x) for x in input().split() ]
    buf = {}
    for i in range(h0):
      buf[1 << w0] = { 1 << j for j,x in enumerate(input()) if x == '#' }
    found = 0
    for i in range(1, 1 << h0):
      idx = {}
      for k,v in buf.items():
        if k & i == 0: continue
        for v in vs: idx[v] = idx.get(v, 0) + 1
      for j in range(1, 1 << w0):
        n = sum([ v for k,v in idx.items() if k & j ])
        if n == k0: found += 1
    print(found)

Fixed submission:
h0, w0, k0 = [ int(x) for x in input().split() ]
found, buf = 0, {}
for i in range(h0): buf[1 << i] = { 1 << j for j,x in enumerate(input()) if x == '#' }
for i in range(1, 1 << h0):
  idx = {}
  for k,vs in buf.items():
    if k & i == 0: continue
    for v in vs: idx[v] = idx.get(v, 0) + 1
  for j in range(1, 1 << w0):
    n = sum([ v for k,v in idx.items() if k & j ])
    if n == k0: found += 1
print(found)

Buggy python submission (verdict: Runtime Error):
h0, w0, k0 = [ int(x) for x in input().split() ]
buf = 1
for i in range(h0):
  buf[1 << w0] = { 1 << j for j,x in enumerate(input()) if x == '#' }
found = 0
for i in range(1, 1 << h0):
  idx = {}
  for k,v in buf.items():
    if k & i == 0: continue
    for v in vs: idx[v] = idx.get(v, 0) + 1
  for j in range(1, 1 << w0):
    n = sum([ v for k,v in idx.items() if k & j ])
    if n == k0: found += 1
print(found)

Fixed submission:
h0, w0, k0 = [ int(x) for x in input().split() ]
found, buf = 0, {}
for i in range(h0): buf[1 << i] = { 1 << j for j,x in enumerate(input()) if x == '#' }
for i in range(1, 1 << h0):
  idx = {}
  for k,vs in buf.items():
    if k & i == 0: continue
    for v in vs: idx[v] = idx.get(v, 0) + 1
  for j in range(1, 1 << w0):
    n = sum([ v for k,v in idx.items() if k & j ])
    if n == k0: found += 1
print(found)
Buggy python submission (verdict: Runtime Error):
x = input()
s = sum([ int(i) for i in x ])
return 'No' if int(x) % s else 'Yes'

Fixed submission:
x = input()
s = sum([ int(i) for i in x ])
print('No' if int(x) % s else 'Yes')
Buggy python submission (verdict: Runtime Error):
    n, k = [ int(x) for x in input().split(' ') ]
    xs = [  int(x) for x in input().split(' ') ]
    i0 = xs.index(min(xs))
    print(1 + min([ (i + k - 2) // (k - 1) + (n - i - 2) // (k - 1)
      for i in range(max(i0 - k + 1, 0),  min(i0, n - k) + 1)  ]))

Fixed submission:
n, k = [ int(i) for i in input().split(' ') ]
xs = [ int(x) for x in input().split(' ') ]
i0 = xs.index(min(xs))
print(1 + min([ (i + k - 2) // (k - 1) + (n - i - 2) // (k - 1)
  for i in range(max(i0 - k + 1, 0), min(i0, n - k) + 1) ]))
Buggy python submission (verdict: Runtime Error):
X = int(input)

if X >= 30:
  print('yes')
else:
  print('no')
  

Fixed submission:
import sys

X = int(input())

if X >= 30:
  print('Yes')
else:
  print('No')
Buggy python submission (verdict: Runtime Error):
import sys

N, D = (int(x) for x in input().split())

for _ in range(N):
  x, y = (int(x) for x in input().split())
  if x*x + y*y <= D*D:
    result += 1
    
print(result)

Fixed submission:
import sys

N, D = (int(x) for x in input().split())

result = 0
for _ in range(N):
    X, Y = (int(x) for x in input().split())
    if X * X + Y * Y <= D * D:
        result += 1
print(result)

Buggy python submission (verdict: Runtime Error):
import sys

N, D = int(input().split())

result = 0
for i in range(N):
  x, y = int(input().split())
  if x*x + y*y <= D*D:
    result += 1
    
print(result)

Fixed submission:
import sys

N, D = (int(x) for x in input().split())

result = 0
for _ in range(N):
    X, Y = (int(x) for x in input().split())
    if X * X + Y * Y <= D * D:
        result += 1
print(result)
Buggy python submission (verdict: Time Limit Exceeded):
import sys
K = int(input())

t = 7
for i in range(K):
    if t % K == 0:
        print(i + 1)
        break
    t = t*10+7
else:
    print(-1)

Fixed submission:
import sys
K = int(input())

t = 7
for i in range(K):
    if t % K == 0:
        print(i + 1)
        break
    t = (t*10+7) % K
else:
    print(-1)