Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
N, K = map(int, input().split())

ans1 = abs(N - K)
cnt = 0
if N > ans1:
    while True:
        ans2 = abs(ans1 - K)
        if ans1 > ans2:
            ans1 = ans2
            cnt = 1
            cnt += 1
        else:
            ANS = ans1
            break
elif N <= ans1:
    ANS = N

# print(ans1, ans2)
print(ANS)
# print(cnt)

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

t = N % K
ANS = min(t, K-t)
print(ANS)

Buggy python submission (verdict: Runtime Error):
ans1 = abs(N - K)
cnt = 0
if N > ans1:
    while True:
        ans2 = abs(ans1 - K)
        if ans1 > ans2:
            ans1 = ans2
            cnt = 1
            cnt += 1
        else:
            ANS = ans1
            break
elif N <= ans1:
    ANS = N

# print(ans1, ans2)
print(ANS)
# print(cnt)

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

t = N % K
ANS = min(t, K-t)
print(ANS)
Buggy python submission (verdict: Runtime Error):
import math,sys
input = sys.stdin.readline
from collections import defaultdict
n = int(input())
MOD = 1000000007
d = defaultdict(int)
for i in range(n):
  a,b = map(int,input().split())
  g = math.gcd(a,b)
  a,b = a//g,b//g
  if a<0:
    a,b = -a,-b
  d[str(a)+':'+str(b)] += 1
c = 1
for i in d.keys():
  if d[i] != 0:
    cur = pow(2,d[i],MOD)
    if '-' in i:
      ind = i.index(':')
      ci = i[ind+2:] + ':' + i[:ind]
    else:
      ind = i.index(':')
      ci = i[ind+1:] + ':-' + i[:ind]
    if ci in d.keys():
      cur += pow(2,d[ci],MOD)-1
      d[ci] = 0
    c = (c*cur)%MOD
print(c-1)

Fixed submission:
import math,sys
input = sys.stdin.readline
from collections import defaultdict
n = int(input())
MOD = 1000000007
d = defaultdict(int)
l,r = 0,0
count = 0
for i in range(n):
  a,b = map(int,input().split())
  if a == b == 0:
    count += 1
    continue
  elif a == 0 or b == 0:
    if a == 0:
      l += 1
    else:
      r += 1
  else:
    g = math.gcd(a,b)
    a,b = a//g,b//g
    if a<0:
      a,b = -a,-b
    d[str(a)+':'+str(b)] += 1
c = 1
for i in d.keys():
  if d[i] != 0:
    cur = pow(2,d[i],MOD)
    if '-' in i:
      ind = i.index(':')
      ci = i[ind+2:] + ':' + i[:ind]
    else:
      ind = i.index(':')
      ci = i[ind+1:] + ':-' + i[:ind]
    if ci in d.keys():
      cur += pow(2,d[ci],MOD)-1
      d[ci] = 0
    c = (c*cur)%MOD
c = (c*(pow(2,l,MOD)+pow(2,r,MOD)-1)-1+count)%MOD
print(c)
Buggy python submission (verdict: Runtime Error):
print("YNeos"[len(set(map(int,open(0))))!=2::2])

Fixed submission:
print("YNeos"[len(set(map(int,input().split())))!=2::2])
Buggy python submission (verdict: Time Limit Exceeded):
def prime(n):
  prime_table = [2]
  for i in range(3,n+1):
    f = 1
    for j in prime_table[:bisect.bisect_right(prime_table,int(i**0.5))]:
      if i % j == 0:
        f = 0
        break
    if f:
      prime_table.append(i)
  return prime_table

import bisect
n = int(input())
prime_table = prime(10**6)
print(prime_table[bisect.bisect_left(prime_table,n)])

Fixed submission:
def prime(n):
  prime_table = [2]
  for i in range(3,n+1):
    f = 1
    for j in prime_table[:bisect.bisect_right(prime_table,int(i**0.5))]:
      if i % j == 0:
        f = 0
        break
    if f:
      prime_table.append(i)
  return prime_table

import bisect
x = int(input())
pt = prime(5*10**5)
print(pt[bisect.bisect_left(pt,x)])
Buggy python submission (verdict: Runtime Error):
n = int(input())
c = [-1,-1,-1]
a = 1
for i in map(int,input().split()):
  a = a * c.count(i-1) % 1000000007
  c[c.index(i-1)] = i
print(a)

Fixed submission:
n = int(input())
c = [-1,-1,-1]
a = 1
for i in map(int,input().split()):
  co = c.count(i-1)
  if co == 0:
    print(0)
    exit()
  a = a * co % 1000000007
  c[c.index(i-1)] = i
print(a)
Buggy python submission (verdict: Time Limit Exceeded):
x,y = map(int,input().split())
MOD = 10**9+7

def inv_mod(a, p=MOD):
    def inv_mod_sub(a, p):
        if a == 1:
            return 1, 0
        else:
            d, r = p//a, p%a
            x, y = inv_mod_sub(r, a)
            return y-d*x, x
    if p < 0: p = -p
    a %= p
    return inv_mod_sub(a,p)[0] % p

def comb_mod(n, k):
    if k < 0 or k > n:
        return 0
    else:
        return f_mod[n]*f_mod_inverse[k]*f_mod_inverse[n-k] % MOD

if (2*y-x) % 3 != 0 or (2*x-y) % 3 != 0:
  print(0)
else:
  k,l = (2*y-x)//3,(2*x-y)//3
  f_mod=[1]*(10**6)
  f_mod_inverse=[1]*(10**6)
  for i in range(1,10**6):
    f_mod[i]=f_mod[i-1]*i%MOD
    f_mod_inverse[i]=f_mod_inverse[i-1]*inv_mod(i)%MOD
  print(comb_mod(k+l,l))

Fixed submission:
x,y = map(int,input().split())
MOD = 10**9+7

def inv_mod(a, p=MOD):
    def inv_mod_sub(a, p):
        if a == 1:
            return 1, 0
        else:
            d, r = p//a, p%a
            x, y = inv_mod_sub(r, a)
            return y-d*x, x
    if p < 0: p = -p
    a %= p
    return inv_mod_sub(a,p)[0] % p

def comb_mod(n, k):
    if k < 0 or k > n:
        return 0
    else:
        return f_mod[n]*f_mod_inverse[k]*f_mod_inverse[n-k] % MOD

if (2*y-x) % 3 != 0 or (2*x-y) % 3 != 0:
  print(0)
else:
  k,l = (2*y-x)//3,(2*x-y)//3
  f_mod=[1]*(10**6)
  f_mod_inverse=[1]*(10**6)
  for i in range(1,10**6):
    f_mod[i]=f_mod[i-1]*i%MOD
    f_mod_inverse[i]=f_mod_inverse[i-1]*inv_mod(i)%MOD
  print(comb_mod(k+l,l))
Buggy python submission (verdict: Time Limit Exceeded):
from itertools import combinations as comb
n = int(input())
l = list(map(int,input().split()))
l.sort()
tri = set()
for a,b,c in comb(l,3):
  if a<b+c and b<c+a and c<a+b:
    tri.add((a,b,c))
print(len(tri))

Fixed submission:
import bisect
n = int(input())
l = list(map(int,input().split()))
l.sort()
c = 0
for i in range(n-2):
  for j in range(i+1,n-1):
    c += bisect.bisect_right(l,l[j]+l[i]-1) - bisect.bisect_left(l,l[j],j+1)
print(c)
Buggy python submission (verdict: Time Limit Exceeded):
import sys
input=sys.stdin.readline
n,m,l=map(int,input().split())
INF=10**10
graph=[[INF for i in range(n)] for j in range(n)]
fuel=[[INF for i in range(n)] for j in range(n)]
#for i in range(n):
#    graph[i][i]=0
for i in range(m):
    a,b,c=map(int,input().split())
    a-=1;b-=1
    if c>l:continue
    graph[a][b],graph[b][a]=c,c
for i in range(n):
  for j in range(n):
    for k in range(n):
      graph[j][k]=min(graph[j][k],graph[j][i]+graph[i][k])
for i in range(n):
    for j in range(n):
        if graph[i][j]<=l:
            fuel[i][j]=1
for i in range(n):
  for j in range(n):
    for k in range(n):
      fuel[j][k]=min(fuel[j][k],fuel[j][i]+fuel[i][k])
q=int(input())
for i in range(q):
    s,t=map(int,input().split())
    s-=1;t-=1
    if fuel[s][t]==INF:print(-1)
    else:print(fuel[s][t]-1)

Fixed submission:
import sys
input=sys.stdin.readline
n,m,l=map(int,input().split())
INF=10**10
graph=[[INF for i in range(n)] for j in range(n)]
fuel=[[INF for i in range(n)] for j in range(n)]
#for i in range(n):
#    graph[i][i]=0
for i in range(m):
    a,b,c=map(int,input().split())
    a-=1;b-=1
    if c>l:continue
    graph[a][b],graph[b][a]=c,c
for i in range(n):
  for j in range(n):
    for k in range(n):
      graph[j][k]=min(graph[j][k],graph[j][i]+graph[i][k])
for i in range(n):
    for j in range(n):
        if graph[i][j]<=l:
            fuel[i][j]=1
for i in range(n):
  for j in range(n):
    for k in range(n):
      fuel[j][k]=min(fuel[j][k],fuel[j][i]+fuel[i][k])
q=int(input())
for i in range(q):
    s,t=map(int,input().split())
    s-=1;t-=1
    if fuel[s][t]==INF:print(-1)
    else:print(fuel[s][t]-1)
Buggy python submission (verdict: Time Limit Exceeded):
n,k,q = map(int,input().split())
p = [k] * n
for i in range(q):
  a = int(input())-1
  for j in range(n):
    if j != a:
      p[j] -= 1
for i in p:
  if i <= 0:
    print('No')
  else:
    print('Yes')

Fixed submission:
n,k,q = map(int,input().split())
c = [0] * n
for i in range(q):
  c[int(input())-1] += 1
for i in c:
  if k-q+i <= 0:
    print('No')
  else:
    print('Yes')
Buggy python submission (verdict: Time Limit Exceeded):
from collections import defaultdict
n = int(input())
d = [defaultdict(int) for i in range(n)]
for i in range(n):
  for j in input():
    d[i][j] += 1
c = 0
for i in range(n):
  for j in range(i+1,n):
    if all(d[i][key] == d[j][key] for key in d[i]):
      c += 1
print(c)

Fixed submission:
from collections import defaultdict
n = int(input())
s = [''.join(sorted(input())) for i in range(n)]
dd = defaultdict(int)
for i in range(n):
  dd[s[i]] += 1
c = 0
for i in dd.values():
  c += i * (i-1) // 2
print(c)
Buggy python submission (verdict: Runtime Error):
s = input()
l = []
for i in range(len(s)-1):
  if s[i] != s[i+1]:
    l.append(i)
a = [0] * len(s)
a[l[0]] = (l[0]+2)//2 + (l[1]-l[0])//2
a[l[0]+1] = (l[0]+1) // 2 + (l[1]-l[0]+1)//2
i = 2
while True:
  if i == len(l)-1:
    break
  a[l[i]] = (l[i]-l[i-1]+1)//2 + (l[i+1]-l[i])//2
  a[l[i]+1] = (l[i]-l[i-1])//2 + (l[i+1]-l[i]+1)//2
  i += 2
a[l[-1]] = (l[-1]-l[-2]+1)//2 + (len(s)-l[-1]-1)//2
a[l[-1]+1] = (l[-1]-l[-2])//2 + (len(s)-l[-1])//2
print(' '.join(map(str,a)))

Fixed submission:
s = input()
l = []
for i in range(len(s)-1):
  if s[i] != s[i+1]:
    l.append(i)
a = [0] * len(s)
if len(l) == 1:
  a[l[0]] = (l[0]+2)//2 + (len(s)-l[0]-1)//2
  a[l[0]+1] = (l[0]+1)//2 + (len(s)-l[0])//2
  print(' '.join(map(str,a)))
  exit()
a[l[0]] = (l[0]+2)//2 + (l[1]-l[0])//2
a[l[0]+1] = (l[0]+1) // 2 + (l[1]-l[0]+1)//2
i = 2
while True:
  if i == len(l)-1:
    break
  a[l[i]] = (l[i]-l[i-1]+1)//2 + (l[i+1]-l[i])//2
  a[l[i]+1] = (l[i]-l[i-1])//2 + (l[i+1]-l[i]+1)//2
  i += 2
a[l[-1]] = (l[-1]-l[-2]+1)//2 + (len(s)-l[-1]-1)//2
a[l[-1]+1] = (l[-1]-l[-2])//2 + (len(s)-l[-1])//2
print(' '.join(map(str,a)))
Buggy python submission (verdict: Runtime Error):
from collections import defaultdict
d = defaultdict(int)
n, *a = map(int,open(0))
for i in a:
  d[i] += 1
l = list(d.key())
l.sort()
m = l[-1]
if d[m] == 1:
  i = a.index(m)
  [print(m) for j in range(i)]
  print(l[-2])
  [print(m) for j in range(n-i-1)]
else:
  [print(m) for i in range(n)]

Fixed submission:
from collections import defaultdict
d = defaultdict(int)
n, *a = map(int,open(0))
for i in a:
  d[i] += 1
l = list(d.keys())
l.sort()
m = l[-1]
if d[m] == 1:
  i = a.index(m)
  [print(m) for j in range(i)]
  print(l[-2])
  [print(m) for j in range(n-i-1)]
else:
  [print(m) for i in range(n)]
Buggy python submission (verdict: Time Limit Exceeded):
import bisect
n = int(input())
c = [int(input())]
for i in range(n-1):
  a = int(input())
  if c[-1] >= a:
    c.append(a)
  else:
    ind = bisect.bisect_left(c[::-1],a)
    c[len(c)-ind] = a
print(len(c))

Fixed submission:
import bisect
n = int(input())
a = [int(input()) for i in range(n)]
c = [a[-1]]
for i in a[n-2::-1]:
  if c[-1] <= i:
    c.append(i)
  else:
    c[bisect.bisect_left(c,i+1)] = i
  #print(c)
print(len(c))
Buggy python submission (verdict: Runtime Error):
s=input()
s.sort()
print(s)

Fixed submission:
s=list(input())
s.sort()
print("YNeos"[not s[0]==s[1]!=s[2]==s[3]::2])
Buggy python submission (verdict: Time Limit Exceeded):
import sys
input = sys.stdin.readline
h,w = map(int,input().split())
s = [[j for j in input()] for i in range(h)]
d_2y = [[0] * w for i in range(h)]
d_2t = [[0] * w for i in range(h)]
d_2w = [[0] * w for i in range(h)]
for i in range(h):
  c = 0
  for j in range(w):
    if s[i][j] == '#':
      c = 0
    else:
      c += 1
    d_2y[i][j] = c
for i in range(h):
  for j in range(w-2,-1,-1):
    if s[i][j] == '#':
      continue
    else:
      d_2y[i][j] = max(d_2y[i][j+1],d_2y[i][j])
for i in range(w):
  c = 0
  for j in range(h):
    if s[j][i] == '#':
      c = 0
    else:
      c += 1
    d_2t[j][i] = c
for i in range(w):
  for j in range(h-2,-1,-1):
    if s[j][i] == '#':
      d_2t[j][i] = 0
    else:
      d_2t[j][i] = max(d_2t[j][i],d_2t[j+1][i])
m = 0
for i in range(h):
  for j in range(w):
    d_2w[i][j] = d_2y[i][j] + d_2t[i][j]
  m = max(m,max(d_2w[i]))
print(m-1)

Fixed submission:
import sys
input = sys.stdin.readline
h,w = map(int,input().split())
s = [[j for j in input()] for i in range(h)]
d_2y = [[0] * w for i in range(h)]
d_2t = [[0] * w for i in range(h)]
d_2w = [[0] * w for i in range(h)]
for i in range(h):
  c = 0
  for j in range(w):
    if s[i][j] == '#':
      c = 0
    else:
      c += 1
    d_2y[i][j] = c
for i in range(h):
  for j in range(w-2,-1,-1):
    if s[i][j] == '#':
      continue
    else:
      d_2y[i][j] = max(d_2y[i][j+1],d_2y[i][j])
for i in range(w):
  c = 0
  for j in range(h):
    if s[j][i] == '#':
      c = 0
    else:
      c += 1
    d_2t[j][i] = c
for i in range(w):
  for j in range(h-2,-1,-1):
    if s[j][i] == '#':
      d_2t[j][i] = 0
    else:
      d_2t[j][i] = max(d_2t[j][i],d_2t[j+1][i])
m = 0
for i in range(h):
  for j in range(w):
    d_2w[i][j] = d_2y[i][j] + d_2t[i][j]
  m = max(m,max(d_2w[i]))
print(m-1)
Buggy python submission (verdict: Time Limit Exceeded):
R,G,B,n = map(int,input().split())
c = 0
for r in range(n//R+1):
  for g in range(n//G+1):
    for b in range(n//B+1):
      if R*r + G*g + B*b == n:
        c += 1
        break
print(c)

Fixed submission:
R,G,B,N = map(int,input().split())
a = 0
for i in range(N//R+1):
  for j in range((N-R*i)//G+1):
    if (N-R*i-G*j) % B == 0:
      a += 1
print(a)
Buggy python submission (verdict: Runtime Error):
n=int(input())
s=input()
s_list=list(s)
c=0
if s_list[0] == "#" and s_list[1] == ".":
  c += 1
  s_list[0] = "."
for a in range(n-2):
  if s_list[a+1] == "#" and s_list[a+2] ==  ".":
                     c += 1
                     s_list[a+2] = "#"
print(c)

Fixed submission:
n = int(input())
s = input()
k = 0
si = s.count('.')
m = si
for i in s:
  if i == '#':
    k += 1
  else:
    si -= 1
  m = min(m,k+si)
print(m)

Buggy python submission (verdict: Runtime Error):
n=int(input())
s=input()
s_list=list(s)
c=0
for a in range(n-1):
  if s_list[a]s_list[a+1} ==  #.:
                     c += 1
                     s_list[a+1] =#
print(c)

Fixed submission:
n = int(input())
s = input()
k = 0
si = s.count('.')
m = si
for i in s:
  if i == '#':
    k += 1
  else:
    si -= 1
  m = min(m,k+si)
print(m)
Buggy python submission (verdict: Runtime Error):
a,b=map(int,input().split())
print(max(2*a-1,a+b,2*b-1)

Fixed submission:
a,b=map(int,input().split())
print(max(2*a-1,a+b,2*b-1))

Buggy python submission (verdict: Runtime Error):
a,b=map(int,input().split())
print(max(2a-1,a+b,2b-1)

Fixed submission:
a,b=map(int,input().split())
print(max(2*a-1,a+b,2*b-1))
Buggy python submission (verdict: Runtime Error):
a=input()
b=input()
c=input()
d=input()
e=input()
k=input()
f=min(a,b,c,d,e)
g=max(a,b,c,d,e)
h=g-f
if h <= k:
  print('Yay')
else:
  print(':(')

Fixed submission:
a=int(input())
b=int(input())
c=int(input())
d=int(input())
e=int(input())
k=int(input())
f=min(a,b,c,d,e)
g=max(a,b,c,d,e)
h=g-f
if h <= k:
  print('Yay!')
else:
  print(':(')
Buggy python submission (verdict: Runtime Error):
n,q = map(int,input().split())
s = input()
s_c = [0]*(n+1)
c = 0
for k in range(n):
  if s[k] == 'A' and s[k+1] == 'C':
    c += 1
  s_c[k+1] = c
for i in range(q):
  l,r = map(int,input().split())
  print(s_c[r-1]-s_c[l-1])

Fixed submission:
n,q=map(int,input().split())
s=list(input())
a=[0]*n
for i in range(n-1):
  if s[i]=="A" and s[i+1]=="C":
    a[i+1]=a[i]+1
  else:
    a[i+1]=a[i]
for i in range(q):
  l,r=map(int,input().split())
  print(a[r-1]-a[l-1])

Buggy python submission (verdict: Time Limit Exceeded):
n,q = map(int,input().split())
s = input()
for i in range(q):
  c = 0
  l,r = map(int,input().split())
  for k in range(l,r):
    if s[k-1] == 'A' and s[k] == 'C':
      c += 1
  print(c)

Fixed submission:
n,q=map(int,input().split())
s=list(input())
a=[0]*n
for i in range(n-1):
  if s[i]=="A" and s[i+1]=="C":
    a[i+1]=a[i]+1
  else:
    a[i+1]=a[i]
for i in range(q):
  l,r=map(int,input().split())
  print(a[r-1]-a[l-1])
Buggy python submission (verdict: Time Limit Exceeded):
n,m = map(int,input().split())
a=[]
b=[]
sum=0
for i in range(n):
  aa,bb=map(int,input().split())
  a.append(aa)
  b.append(bb)
while True:
  s=min(a)
  t=a.index(s)
  sum += s*b[t]
  m -= b[t]
  if m<=0:
    sum += s*m
    break
  del a[t],b[t]
print(sum)

Fixed submission:
n,m=map(int,input().split())
a=[]
for i in range(n):
  a.append(tuple(map(int,input().split())))
a.sort()
count=0
for i in range(n):
  m-=a[i][1]
  count+=a[i][0]*a[i][1]
  if m<=0:
    count+=a[i][0]*m
    print(count)
    break
Buggy python submission (verdict: Time Limit Exceeded):
import bisect
a,b,q = map(int,input().split())
inf = 10**18
s = [-inf]+[int(input()) for i in range(a)]+[inf]
t = [-inf]+[int(input()) for i in range(b)]+[inf]
for i in range(q):
  x = int(input())
  i = bisect.bisect_right(s,x)
  j = bisect.bisect_right(t,x)
  print(min(max(s[i],t[j])-x,x-min(s[i-1],t[j-1]),min(s[i]-x,x-t[j-1])+s[i]-t[j-1],min(t[j]-x,x-s[i-1])+t[j]-s[i-1]))

Fixed submission:
import bisect,sys
input = sys.stdin.readline
a,b,q = map(int,input().split())
inf = 10**18
s = [-inf]+[int(input()) for i in range(a)]+[inf]
t = [-inf]+[int(input()) for i in range(b)]+[inf]
for i in range(q):
  x = int(input())
  i = bisect.bisect_right(s,x)
  j = bisect.bisect_right(t,x)
  print(min(max(s[i],t[j])-x,x-min(s[i-1],t[j-1]),min(s[i]-x,x-t[j-1])+s[i]-t[j-1],min(t[j]-x,x-s[i-1])+t[j]-s[i-1]))
Buggy python submission (verdict: Runtime Error):
def f(i):
  if i%2==0:
    return i//2
  else:
    return i*3+1

a=int(input())
i=1
while True:
  b=f(a[-1])
  i+=1
  if b in a:
    print(i)
    break
  a.append(b)

Fixed submission:
def f(i):
  if i%2==0:
    return i//2
  else:
    return i*3+1

a=[]
a.append(int(input()))
i=1
while True:
  b=f(a[-1])
  i+=1
  if b in a:
    print(i)
    break
  a.append(b)
Buggy python submission (verdict: Time Limit Exceeded):
from copy import deepcopy
n,W = map(int,input().split())
dp = [10**12] * (10**5+1)
dp[0] = 0
for i in range(n):
  w,v = map(int,input().split())
  pdp = deepcopy(dp)
  for j in range(v,10**5+1):
    dp[j] = min(pdp[j-v]+w,dp[j])
m = 0
for i in range(10**5+1):
  if dp[i] <= W:
    m = i
print(m)

Fixed submission:
n,W = map(int,input().split())
dp = [[10**12] * (10**5+1) for i in range(n+1)]
dp[0][0] = 0
ma = 0
for i in range(1,n+1):
  w,v = map(int,input().split())
  ma += v
  for j in range(v):
    dp[i][j] = dp[i-1][j]
  for j in range(v,ma+1):
    dp[i][j] = min(dp[i-1][j-v]+w,dp[i-1][j])
m = 0
for i in range(ma+1):
  if dp[-1][i] <= W:
    m = i
print(m)
Buggy python submission (verdict: Time Limit Exceeded):
n,k = map(int,input().split())
l = []
a = list(map(int,input().split()))
for i in range(len(a)):
  for j in range(len(a)-i):
    l.append(sum(a[j:j+i+1]))
m = len(bin(sum(a)))-2
x = 0
for i in range(m-1,-1,-1):
  c = 0
  cu = 2**i
  for j in l:
    if x+cu & j == x+cu:
      c += 1
    if c == k:
      x += cu
      break
print(x)

Fixed submission:
n,k = map(int,input().split())
l = []
a = list(map(int,input().split()))
for i in range(len(a)):
  c = 0
  for j in range(len(a)-i):
    c += a[i+j]
    l.append(c)
m = len(bin(sum(a)))-2
x = 0
for i in range(m-1,-1,-1):
  c = 0
  cu = 2**i
  for j in l:
    if x+cu & j == x+cu:
      c += 1
    if c == k:
      x += cu
      break
print(x)
Buggy python submission (verdict: Runtime Error):
n=int(input())
t,a=map(int,input().split())
h=list(map(int,input().split()))
m=a
ans=0
for i in n:
  if abs((t-h[i]*0.006)-a) < m:
    m=abs((t-h[i]*0.006)-a)
    ans=i+1
print(ans)

Fixed submission:
n=int(input())
t,a=map(int,input().split())
h=list(map(int,input().split()))
m=100000
ans=0
for i in range(n):
  if abs((t-h[i]*0.006)-a) < m:
    m=abs((t-h[i]*0.006)-a)
    ans=i+1
print(ans)
Buggy python submission (verdict: Runtime Error):
import sys
input = sys.stdin.readline
n = int(input())
a = [tuple(map(int,input().split())) for _ in range(n)]
for _ in range(n):
  if a[_][2] > 1:
    flag = _
    break
c = 0
for _ in range(101): #x
  for i in range(101): #y
    h = a[flag][2] + abs(a[flag][0]-_) + abs(a[flag][1]-i)
    for j in range(n):
      b = 0
      if a[j][2] != max(h - abs(a[j][0]-_) - abs(a[j][1]-i),0):
        b = 1
        break
      if j == n-1:
        print(_,i,h)
        c = 1
        break
    if c == 1:
      break
  if c == 1:
    break

Fixed submission:
n = int(input())
z = [0] * n
for i in range(n):
  x,y,h = map(int,input().split())
  if h != 0:
    k = [x,y,h]
  z[i] = [x,y,h]
for i in range(101):
  for j in range(101):
    H = k[2] + abs(k[0]-i) + abs(k[1]-j)
    for l in z:
      if l[2] != max(H-abs(l[0]-i)-abs(l[1]-j),0):
        break
      if l == z[-1]:
        print(i,j,H)
        exit()
Buggy python submission (verdict: Runtime Error):
n=list(map(int,input().split()))
for i in range(3):
  if n[i] == 1:
    n[i] = 9
  else:
    n[i] = 1
print("".join(n))

Fixed submission:
n=list(input())
for i in range(3):
  if n[i] == "1":
    n[i] = "9"
  else:
    n[i] = "1"
print("".join(n))
Buggy python submission (verdict: Runtime Error):
n=int(input())
a=[]
for i in range(n):
  aa=input()
  if aa in a or aa[0] != a[-1][0]:
    print("No")
    break
  if i == n-1:
    print("Yes")
  a.append(aa)

Fixed submission:
n=int(input())
a=[input()]
for i in range(n-1):
  aa=input()
  if aa in a or aa[0] != a[-1][-1]:
    print("No")
    break
  if i == n-2:
    print("Yes")
  a.append(aa)
Buggy python submission (verdict: Runtime Error):
h,w=map(int,input().split())
a=[]
for i in range(h):
  aa=list(input())
  if "#" not in aa:
    continue
  else:
    a.append(aa)
for i in range(w):
  c=0
  for j in range(len(a)):
    if a[j][i]=="#":
      c+=1
  if c==0:
    for j in range(len(a)):
      del a[j][i]
for i in range(len(a)):
  print("".join(a[i]))

Fixed submission:
h,w=map(int,input().split())
a=[]
for i in range(h):
  aa=list(input())
  if "#" not in aa:
    continue
  else:
    a.append(aa)
aa=[]
for i in range(w):
  c=0
  for j in range(len(a)):
    if a[j][i]=="#":
      c+=1
  if c==0:
    aa.append(i)
aa.reverse()
for i in aa:
  for j in range(len(a)):
    del a[j][i]
for i in range(len(a)):
  print("".join(a[i]))
Buggy python submission (verdict: Runtime Error):
n=int(input())
c=0
for i in range(1,n+1,2):
  count=0
  for j in range(1,i**0.5):
    if i%j==0:
      count+=1
  if count==8:
    c+=1
print(c)

Fixed submission:
n=int(input())
c=0
for i in range(1,n+1,2):
  count=0
  for j in range(1,i+1):
    if i%j==0:
      count+=1
  if count==8:
    c+=1
print(c)
Buggy python submission (verdict: Runtime Error):
s = input()
t = input()
c = 1
for i in range(len(s)):
  s = s[-1] + s[:-1]
  if s = t:
    c = 0
print('YNeos'[c::2])

Fixed submission:
s = input()
t = input()
c = 1
for i in range(len(s)):
  s = s[-1] + s[:-1]
  if s == t:
    c = 0
print('YNeos'[c::2])
Buggy python submission (verdict: Runtime Error):
n = int(input())
a = list(map(int,input().split()))
al = [0] * n
for i in range(n):
  al[i] = abs(a[i+1] - a[i])
s = sum(al)
for i in range(n):
  print(s-al[i-1]-al[i]+abs(a[i+1]-a[i-1]))

Fixed submission:
n = int(input())
ai = list(map(int,input().split()))
a = [0]
for i in ai:
  a.append(i)
al = [0] * (n+1)
for i in range(n+1):
  al[i] = abs(a[(i+1)%(n+1)] - a[i])
s = sum(al)
for i in range(1,n+1):
  print(s-al[i-1]-al[i]+abs(a[(i+1)%(n+1)]-a[i-1]))
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int,input().split()))
c = 0
while True:
  for i in range(n):
    if a[i] / 2 == a[i] // 2:
      a[i] = a[i] // 2
    else:
      print(c)
      break
  c += 1

Fixed submission:
n = int(input())
a = list(map(int,input().split()))
c = 0
while True:
  for i in range(n):
    if a[i] / 2 == a[i] // 2:
      a[i] = a[i] // 2
    else:
      print(c)
      exit()
  c += 1

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int,input().split()))
c = 0
while True:
  for i in range(n):
    if a[i] / 2 == a[i] // 2:
      a[i] = a[i] // 2
    else:
      print(c)
      break
  c += 1

Fixed submission:
n = int(input())
a = list(map(int,input().split()))
c = 0
while True:
  for i in range(n):
    if a[i] / 2 == a[i] // 2:
      a[i] = a[i] // 2
    else:
      print(c)
      exit()
  c += 1
Buggy python submission (verdict: Runtime Error):
x,y=map(int,input().split())
if x>y:
  print(">")
elif x<y:
  print("<")
else:
  print("=")

Fixed submission:
x,y=input().split()
if x>y:
  print(">")
elif x<y:
  print("<")
else:
  print("=")