Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
def inverse(a):
    return pow(a, mod - 2, mod)

def main():
    n = int(input())
    a = [0] * n
    b = [0] * n
    for i in range(n):
        x, y = tuple(map(int, input().split()))
        a[i] = x
        b[i] = y
    from collections import defaultdict
    d = defaultdict(lambda: 0)
    for i in range(n):
        for j in range(i+1, n):
            t = a[i] - a[j]
            y = b[i] - b[j]
            tmp = 1 if (t > 0 or (t == 0 and y > 0)) else -1
            d[(tmp * t, tmp * y)] += 1

    print(n-max(d.values()))

main()

Fixed submission:
def inverse(a):
    return pow(a, mod - 2, mod)

def main():
    n = int(input())
    a = [0] * n
    b = [0] * n
    for i in range(n):
        x, y = map(int, input().split())
        a[i] = x
        b[i] = y
    from collections import defaultdict
    if n == 1:
        print(1)
        return 
    d = defaultdict(lambda: 0)
    for i in range(n):
        for j in range(i+1, n):
            t = a[i] - a[j]
            y = b[i] - b[j]
            tmp = 1 if (t > 0 or (t == 0 and y > 0)) else -1
            d[(tmp * t, tmp * y)] += 1

    print(n-max(d.values()))

main()

Buggy python submission (verdict: Runtime Error):
def inverse(a):
    return pow(a, mod - 2, mod)

def main():
    n = int(input())
    a = [0] * n
    b = [0] * n
    for i in range(n):
        x, y  =tuple(map(int, input().split()))
        a[i] = x
        b[i] = y
    from collections import defaultdict
    d = defaultdict(lambda : 0)
    for i in range(n):
        for j in range(i+1, n):
            d[(abs(a[i] - a[j]), abs(b[i] - b[j]))] += 1

    print(n-max(d.values()))

main()

Fixed submission:
def inverse(a):
    return pow(a, mod - 2, mod)

def main():
    n = int(input())
    a = [0] * n
    b = [0] * n
    for i in range(n):
        x, y = map(int, input().split())
        a[i] = x
        b[i] = y
    from collections import defaultdict
    if n == 1:
        print(1)
        return 
    d = defaultdict(lambda: 0)
    for i in range(n):
        for j in range(i+1, n):
            t = a[i] - a[j]
            y = b[i] - b[j]
            tmp = 1 if (t > 0 or (t == 0 and y > 0)) else -1
            d[(tmp * t, tmp * y)] += 1

    print(n-max(d.values()))

main()
Buggy python submission (verdict: Runtime Error):
def main():
    n=int(input())
    s=input()
    if '.' not in s or '#' not in s:
        print(0)
        return
    j = s.index('.')
    a = len([i for i in s[j:] if i == '#'])
    j = n - s[:-1].index('.')
    b = len([i for i in s[:j] if i == '#'])
    print(min([a, b]))

main()

Fixed submission:
def main():
    n=int(input())
    s=input()
    # if len(set(s)) == 1:
    #     print(0)
    #     return
    # s = s[s.index('#'):]
    # n = len(s)
    ans = n
    b = [0] * (n+1)
    w = [0] * (n+1)
    for i in range(n):
        b[i+1] = b[i] + (1 if s[i] == '#' else 0)
        w[i+1] = w[i] + (0 if s[i] == '#' else 1)

    for i in range(n+1):
        tmp = b[i] + (w[n] - w[i])
        ans = min([ans, tmp])
    print(ans)
main()
Buggy python submission (verdict: Runtime Error):
a=[int(input()) for i in range(5)]
b=int(input())
if a[-1] - a[0] <= b:
  print("Yay!")
 else:
  print(":(")

Fixed submission:
a=[int(input()) for i in range(5)]
b=int(input())
if a[-1] - a[0] <= b:
    print("Yay!")
else:
    print(":(")

Buggy python submission (verdict: Runtime Error):
a=[int(input) for i in range(5)]
b=int(input())
if a[-1] - a[0] <= b:
  print("Yay!")
 else:
  print(":(")

Fixed submission:
a=[int(input()) for i in range(5)]
b=int(input())
if a[-1] - a[0] <= b:
    print("Yay!")
else:
    print(":(")
Buggy python submission (verdict: Runtime Error):
a=[int(input()) for _ in range(5)]
a.sort()
a=[i*10 + j for i, j in enumurate(a)]
print(max(a))

Fixed submission:
a=[int(input()) for _ in range(5)]
a.sort(key=lambda x:(x-1) % 10)
print(a[0] + sum(i if i % 10 == 0 else (i // 10 +1) * 10 for i in a[1:]))
Buggy python submission (verdict: Runtime Error):
a=''.join([i if i in ['A', 'C', 'G', 'T'] else ' ' for i in input()])
print(max(len, a.split())

Fixed submission:
a=''.join([i if i in ['A', 'C', 'G', 'T'] else ' ' for i in input()])
print(len(max(a.split() + [''], key=len)))
Buggy python submission (verdict: Runtime Error):
n,m=map(int, input().split())
a=list(map(int, input().split()))
a.sort()
b=[a[i+1]-a[i] for i in range(n-1)]
b.sort(reverse=True)
print(sum(b[m-1:]))


Fixed submission:
n,m=map(int, input().split())
a=list(map(int, input().split()))
a.sort()
b=[a[i+1]-a[i] for i in range(m-1)]
b.sort(reverse=True)
print(sum(b[n-1:]))

Buggy python submission (verdict: Runtime Error):
n,m=map(int, input().split())
a=list(map(int, input().split()))
a.sort(reversed=True)
print(sum(a[m-1:]))


Fixed submission:
n,m=map(int, input().split())
a=list(map(int, input().split()))
a.sort()
b=[a[i+1]-a[i] for i in range(m-1)]
b.sort(reverse=True)
print(sum(b[n-1:]))
Buggy python submission (verdict: Time Limit Exceeded):
n, k = map(int, input().split())
h = list(map(int, input().split()))
dp = [5e9] * (n + 2)
dp[0] = 0
for i in range(n):
    for j in range(1, k+1):
        if not i + j < n:
            break
        dp[i + j] = min([dp[i + j], dp[i] + abs(h[i] - h[i + j])])

print(dp[n - 1])


Fixed submission:
n, k = map(int, input().split())
h = list(map(int, input().split()))
dp = [5e9] * (n + 2)
dp[0] = 0
for i in range(n):
    for j in range(1, k+1):
        if not i + j < n:
            break
        dp[i + j] = min([dp[i + j], dp[i] + abs(h[i] - h[i + j])])

print(dp[n - 1])
Buggy python submission (verdict: Runtime Error):
n=int(input())
if [i for i in [int(input()) for _ in range(n)] if i % 2]:
  print('first')
 else:
  print('second')

Fixed submission:
n=int(input())
if [i for i in [int(input()) for _ in range(n)] if i % 2]:
    print('first')
else:
    print('second')

Buggy python submission (verdict: Runtime Error):
n=input()
if [i for i in [int(input()) for _ in range(n)] if i % 2]:
  print('first')
 else:
  print('second')

Fixed submission:
n=int(input())
if [i for i in [int(input()) for _ in range(n)] if i % 2]:
    print('first')
else:
    print('second')

Buggy python submission (verdict: Runtime Error):
input()
if [i for i in map(int, input().split()) if i % 2]:
  print('first')
 else:
  print('second')

Fixed submission:
n=int(input())
if [i for i in [int(input()) for _ in range(n)] if i % 2]:
    print('first')
else:
    print('second')
Buggy python submission (verdict: Runtime Error):
n,x=map(int, input().split())

memo = {0:'p'}
def f(m):
    if m in memo:
        return memo[m]
    tmp =  'b' + f(m-1) + 'p' + f(m-1) + 'b'
    memo[m] = tmp
    return tmp

print(len([i for i in f(n)[:x] if i == 'p']))

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

memol = {0: 1}
memop = {0: 1}


for i in range(1, n+1):
    memol[i] = memol[i-1] * 2 + 3
    memop[i] = memop[i-1] * 2 + 1

ret = 0
ln = 0
for i in range(n, -1, -1):
    if ln >= x:
        break
    ln += 1
    if ln >= x:
        break
    if ln + memol[i-1] > x:
        continue
    ln += memol[i-1]
    ret += memop[i-1]
    if ln == x:
        break
    ln += 1
    ret += 1
    if ln + memol[i-1] > x:
        continue
    ln += memol[i-1]
    ret += memop[i-1]
    if ln == x:
        break
    ln += 1

print(ret)
Buggy python submission (verdict: Runtime Error):
import itertools


def main():
    n = int(input())

    a = []
    for i in range(n):
        a.append(int(input()))
    a.sort()
    if n == 2:
        print(abs(a[0] - a[1]))
        return
    if n == 3:
        tmp1 = abs(a[0] - a[1]) + abs(a[0] - a[2])
        tmp2 = abs(a[0] - a[2]) + abs(a[1] - a[2])
        print(max([tmp1, tmp2]))
        return
    if n < 10:
        ans = 0
        for a in itertools.permutations(a):
            tmp = 0
            for i in range(len(a) - 1):
                tmp += abs(a[i] - a[i + 1])
            ans = max([ans, tmp])
        print(ans)
        return
    ret1 = a[:n // 2 + (1 if n % 2 == 1 else 0)]
    ret2 = a[n // 2 + (1 if n % 2 == 1else 0):]
    ret1 = [ret1[-1]] + ret1[:-2] + [ret1[-2]]
    ret2 = ret2[1:] + [ret2[0]]
    ans = 0

    ans += abs(ret1[-1] - ret2[-1])
    for i in range(len(ret2) - 1):
        ans += abs(ret1[i] - ret2[i])
        ans += abs(ret1[i + 1] - ret2[i])
    if len(ret1) != len(ret2):
        ans += abs(ret1[-2] - ret2[-1])

    # if n % 2 == 0:
    #     print(ans)
    #     return
    ans1 = ans

    ret1 = a[:n // 2 + (0 if n % 2 == 1 else 1)]
    ret2 = a[n // 2 + (0 if n % 2 == 1else 1):]
    # ret1 = ret1[1:] + [ret1[0]]
    ret2 = [ret2[0]] + ret2[2:] + [ret2[1]]
    ans = 0

    ans += abs(ret1[-1] - ret2[-1])
    for i in range(len(ret1) - 1):
        ans += abs(ret2[i] - ret1[i])
        ans += abs(ret2[i + 1] - ret1[i])
    if len(ret1) != len(ret2):
        ans += abs(ret1[-1] - ret2[-2])
    print(max([ans, ans1]))


main()
7541

Fixed submission:
import itertools


def main():
    n = int(input())

    a = []
    for i in range(n):
        a.append(int(input()))
    a.sort()
    if n == 2:
        print(abs(a[0] - a[1]))
        return
    if n == 3:
        tmp1 = abs(a[0] - a[1]) + abs(a[0] - a[2])
        tmp2 = abs(a[0] - a[2]) + abs(a[1] - a[2])
        print(max([tmp1, tmp2]))
        return
    if n < 10:
        ans = 0
        for a in itertools.permutations(a):
            tmp = 0
            for i in range(len(a) - 1):
                tmp += abs(a[i] - a[i + 1])
            ans = max([ans, tmp])
        print(ans)
        return
    ret1 = a[:n // 2 + (1 if n % 2 == 1 else 0)]
    ret2 = a[n // 2 + (1 if n % 2 == 1else 0):]
    ret1 = [ret1[-1]] + ret1[:-2] + [ret1[-2]]
    ret2 = ret2[1:] + [ret2[0]]
    ans = 0

    ans += abs(ret1[-1] - ret2[-1])
    for i in range(len(ret2) - 1):
        ans += abs(ret1[i] - ret2[i])
        ans += abs(ret1[i + 1] - ret2[i])
    if len(ret1) != len(ret2):
        ans += abs(ret1[-2] - ret2[-1])

    if n % 2 == 0:
        print(ans)
        return
    ans1 = ans

    ret1 = a[:n // 2 + (0 if n % 2 == 1 else 1)]
    ret2 = a[n // 2 + (0 if n % 2 == 1else 1):]
    # ret1 = ret1[1:] + [ret1[0]]
    ret2 = [ret2[0]] + ret2[2:] + [ret2[1]]
    ans = 0

    ans += abs(ret1[-1] - ret2[-1])
    for i in range(len(ret1) - 1):
        ans += abs(ret2[i] - ret1[i])
        ans += abs(ret2[i + 1] - ret1[i])
    if len(ret1) != len(ret2):
        ans += abs(ret1[-1] - ret2[-2])
    print(max([ans, ans1]))


main()
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int, input().split()))

ret = 0
mod = int(1e9) + 7

cum = [0] * (n + 1)

for i in range(n):
    cum[i + 1] = cum[i] + a[i]


def inv(x):
    return pow(x, mod - 2, mod)


for i in range(n):
    for j in range(n):
        if i == j:
            continue
        ret += inv(abs(j - i)+1) * (a[j])
        ret %= mod
ret += cum[-1]
ret %= mod
for i in range(2, n + 1):
    ret *= i
    ret %= mod
print(ret)


Fixed submission:
mod = int(1e9 + 7)


def inv(x):
    return pow(x, mod - 2, mod)

n = int(input())
a = list(map(int, input().split()))

memo = [inv(i + 1) for i in range(100000)]
for i in range(1, 100000):
    memo[i] = (memo[i] + memo[i - 1]) % mod

p = 1
for i in range(1, n + 1):
    p = p * i % mod
ret = 0
for i in range(n):
    ret = (ret +a[i] * (memo[i] + memo[n - i- 1] - 1) % mod * p) % mod

print(ret % mod)
Buggy python submission (verdict: Runtime Error):
print("Yes" if list(filter(lambda x:x%2==0,map(int, input().split()))) "No")


Fixed submission:
a,b=map(int, input().split())
print('Yes' if a * b % 2 == 1 else 'No')
Buggy python submission (verdict: Runtime Error):
a, b=map(int, input().split())
try:
	c = a // (b // 2)
	c = c //2 + c% 2
except Exception:
  c = 0
try:
    d = a // b
except Exception:
  d = 0
    print(c**3 + d **3)

Fixed submission:
a, b=map(int, input().split())
try:
    c = a // (b // 2)
    c = c //2 + c%2
except Exception as  e:
    c = 0
if b % 2 == 1:
    c = 0
try:
    d = a // b
except Exception as e:
    d = 0
print(c**3 + d**3)

Buggy python submission (verdict: Runtime Error):
a, b=map(int, input().split())
c = a // (b // 2)
c = c //2 + c% 2
d = a // b
print(c**3 + d **3)

Fixed submission:
a, b=map(int, input().split())
try:
    c = a // (b // 2)
    c = c //2 + c%2
except Exception as  e:
    c = 0
if b % 2 == 1:
    c = 0
try:
    d = a // b
except Exception as e:
    d = 0
print(c**3 + d**3)
Buggy python submission (verdict: Runtime Error):
n = int(input())
a=map(int, input().split())
print(sum(a) - len(a))

Fixed submission:
n = int(input())
a=list(map(int, input().split()))
print(sum(a) - len(a))
Buggy python submission (verdict: Runtime Error):
n = int(input())
a = list(map(int, input().split()))

for i in range(len(a)):
    a[i] -= i + 1

a.sort()
b = [a[0]]
for i in a[1:]:
    b.append(b[-1] + i)
hi = len(a)
lo = 0


def score(index):
    return abs((lft * a[index] - b[index]) - (b[-1] - b[index] - (len(a) - index) * a[index]))


for i in range(10000):
    lft = (hi + 2 * lo) // 3
    rgt = (2 * hi + lo) // 3
    ltmp = score(lft)
    rtmp = score(rgt)
    if ltmp <= rtmp:
        lo = lft
    else:
        hi = rgt

printmin([(score(lo), score(lo + 1)]))


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

for i in range(len(a)):
    a[i] -= i + 1

a.sort()

d1 = a[len(a) // 2]
print(sum([abs(i - d1) for i in a]))

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

a = list(map(int, input().split()))

for i in range(len(a)):
    a[i] -= i + 1

a.sort()

d1, d2 = a[len(a) // 2], a[len(a) // 2 + 1]
print(sum([abs(i - d1) for i in a]))

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

for i in range(len(a)):
    a[i] -= i + 1

a.sort()

d1 = a[len(a) // 2]
print(sum([abs(i - d1) for i in a]))
Buggy python submission (verdict: Runtime Error):
n, k = map(int, input().split())

a = list(map(int, input().split()))

b = min(a)

lft = 0
rgt = 0
for i in range(len(a)):
    if a[i] == b:
        lft = i
        break

ret = 0
i = 0
for i in range(len(a)):
    if a[i] == b:
        continue
    flag = False
    for j in range(k - 1):
        if not i + j < n:
            break
        if a[i+j] == b:
            flag = True
        a[i+j] = b
    if flag:
        a[i+k-1] = b
    ret += 1

print(ret)

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

a = list(map(int, input().split()))

b = min(a)

lft = 0
rgt = 0
for i in range(len(a)):
    if a[i] == b:
        lft = i
        break

ret = 0
i = 0
for i in range(len(a)):
    if a[i] == b:
        continue
    flag = False
    for j in range(k - 1):
        if not i + j < n:
            break
        if a[i+j] == b:
            flag = True
        a[i+j] = b
    if flag and i+k-1 < len(a):
        a[i+k-1] = b
    ret += 1

print(ret)
Buggy python submission (verdict: Runtime Error):
print(sum([min([int(input())for i in[1,2])for j in[1,2]]))

Fixed submission:
print(sum([min([int(input())for i in[1,2]])for j in[1,2]]))

Buggy python submission (verdict: Runtime Error):
print(sum([min([int(input())for i in[1,2]]for j in[1,2]))

Fixed submission:
print(sum([min([int(input())for i in[1,2]])for j in[1,2]]))
Buggy python submission (verdict: Runtime Error):
a,b,c=map(int,input().split())
print('No'ifa+b<c else'Yes')

Fixed submission:
a,b,c=map(int,input().split())
print('No'if a+b<c else'Yes')
Buggy python submission (verdict: Runtime Error):
    n, y = map(int, input().split())
    yen = [1000, 5000, 10000]
     
    def f():
      for i range(n):
        r = yen[2] * i
        if r > y:
          continue
        for j range(n):
          if i + j > n:
            continue
          r += yen[1] * j  + yen[1] * (n - i -j)
          if r == y:
            print('{} {} {}'.format(i, j, n - i - j))
            return
      print('-1 -1 -1')
     
    f()

Fixed submission:
n, y = map(int, input().split())
yen = [1000, 5000, 10000]

def f():
    for i in range(n+1):
        r = yen[2] * i
        if r > y:
            continue
        for j in range(n+1):
            if i + j > n:
                continue
            if r + yen[1] * j + yen[0] * (n - i -j)== y:
                print('{} {} {}'.format(i, j, n - i - j))
                return
    print('-1 -1 -1')

f()

Buggy python submission (verdict: Runtime Error):
n, y = map(int, input().split())
yen = [1000, 5000, 10000]

def f():
  for i range(n):
    r = yen[2] * i
    if r > y:
      continue
    for j range(n):
      if i + j > n:
        continue
      r += yen[1] * j  + yen[1] * (n - i -j)
      if r == y:
        print('{} {} {}".format(i, j, n - i - j))
        return
  print('-1 -1 -1')

f()

Fixed submission:
n, y = map(int, input().split())
yen = [1000, 5000, 10000]

def f():
    for i in range(n+1):
        r = yen[2] * i
        if r > y:
            continue
        for j in range(n+1):
            if i + j > n:
                continue
            if r + yen[1] * j + yen[0] * (n - i -j)== y:
                print('{} {} {}'.format(i, j, n - i - j))
                return
    print('-1 -1 -1')

f()
Buggy python submission (verdict: Runtime Error):
work = [True] * 100001
work[0] = False
work[1] = False
primes = []
for i in range(100001):
    if work[i]:
        primes.append(i)
        for j in range(2, 100001 // i):
            work[j * i] = False

ret = [i for i in primes if (i + 1) // 2 in primes]

csum = [0]
index = 0
for i in range(1, 10001):
    if i < ret[index]:
        csum.append(csum[-1])
    else:
        csum.append(csum[-1] + 1)
        index += 1

q = int(input())
for i in range(q):
    l, r = map(int, input().split())
    low = csum[l-1]
    high = csum[r]
    print(high-low)


Fixed submission:
work = [True] * 100001
work[0] = False
work[1] = False
primes = []
for i in range(100001):
    if work[i]:
        for j in range(2* i, 100001, i):
            work[j] = False


csum = [0] * 100001
index = 0
for i in range(1, 100001):
    if work[i] and work[(i+1)//2]:
        csum[i] = csum[i - 1] + 1
    else:
        csum[i] = csum[i - 1]

q = int(input())
for i in range(q):
    l, r = map(int, input().split())
    low = csum[l-1]
    high = csum[r]
    print(high-low)

Buggy python submission (verdict: Time Limit Exceeded):
primes = {2}
for i in range(1, 50000):
    i = 2 * i + 1
    for j in primes:
        if i % j == 0:
            break
    else:
        primes.add(i)

ret = set()
for i in primes:
    if (i + 1) // 2 in primes:
        ret.add(i)
ret = sorted(ret)


def binary(i):
    low = 0
    high = len(ret) - 1
    mid = 0
    while high - low > 1:
        mid = (high + low) // 2
        if ret[mid] < i:
            low = mid
        else:
            high = mid
    return low if ret[low] < i else -1


q = int(input())
for i in range(q):
    l, r = map(int, input().split())
    low = binary(l)
    high = binary(r)
    high += 1 if ret[high+1] == r else 0
    print(high-low)


Fixed submission:
work = [True] * 100001
work[0] = False
work[1] = False
primes = []
for i in range(100001):
    if work[i]:
        for j in range(2* i, 100001, i):
            work[j] = False


csum = [0] * 100001
index = 0
for i in range(1, 100001):
    if work[i] and work[(i+1)//2]:
        csum[i] = csum[i - 1] + 1
    else:
        csum[i] = csum[i - 1]

q = int(input())
for i in range(q):
    l, r = map(int, input().split())
    low = csum[l-1]
    high = csum[r]
    print(high-low)
Buggy python submission (verdict: Runtime Error):
a=map(input().split(), int)
r = next(a)
r += next(a)
r -= next(a)
r -= next(a)
print('Left' if r > 0 else 'Balanced' if r == 0 else 'Right')

Fixed submission:
a=map(int,input().split())
r = next(a)
r += next(a)
r -= next(a)
r -= next(a)
print('Left' if r > 0 else 'Balanced' if r == 0 else 'Right')
Buggy python submission (verdict: Runtime Error):
a=eval(input().replace(' ', '+');print(a//2+a%2)

Fixed submission:
a=eval(input().replace(' ', '+'));print(a//2+a%2)

Buggy python submission (verdict: Runtime Error):
a,b=map(input().split(),int);print(a/b+a%b)

Fixed submission:
a=eval(input().replace(' ', '+'));print(a//2+a%2)

Buggy python submission (verdict: Runtime Error):
a,b=input().split()
print(a/b+a%b)

Fixed submission:
a=eval(input().replace(' ', '+'));print(a//2+a%2)

Buggy python submission (verdict: Runtime Error):
a,b=input().split();print(a/b+a%b)

Fixed submission:
a=eval(input().replace(' ', '+'));print(a//2+a%2)

Buggy python submission (verdict: Runtime Error):
    a,b=input().split();printa/b+a%b)

Fixed submission:
a=eval(input().replace(' ', '+'));print(a//2+a%2)

Buggy python submission (verdict: Runtime Error):
a,b=input().split();print(eval(a/b+a%b))

Fixed submission:
a=eval(input().replace(' ', '+'));print(a//2+a%2)

Buggy python submission (verdict: Runtime Error):
a,b=input().split();print(eval(a/b+a%b)

Fixed submission:
a=eval(input().replace(' ', '+'));print(a//2+a%2)
Buggy python submission (verdict: Runtime Error):
input();print(max(int(i) for i in input().split() if int(i) in [1 << i for i in range(9)]))


Fixed submission:
input()
n = eval(input().replace(' ', '|'))
for i in range(201):
    if n & 1 << i:
        print(i)
        break

Buggy python submission (verdict: Runtime Error):
n = [1 << i for i range(9)]
print(max(int(i) for i in input().split() if int(i) in n))

Fixed submission:
input()
n = eval(input().replace(' ', '|'))
for i in range(201):
    if n & 1 << i:
        print(i)
        break
Buggy python submission (verdict: Runtime Error):
n, k = input().split()
a = {}
for i in [int(j) for j in input().split()]:
  if i in a:
    a[i] += 1
   else:
    a[i] = 1
if len(a) <= k:
  print(0)
else:
	print(sum(sorted(a.values())[len(a) - k]))

Fixed submission:
n, k = map(int, input().split())
a = {}
for i in [int(j) for j in input().split()]:
    if i in a:
        a[i] += 1
    else:
        a[i] = 1
if len(a) <= k:
    print(0)
else:
    print(sum(sorted(a.values())[:len(a) - k]))
Buggy python submission (verdict: Runtime Error):
def func():
    tvs = []
    for i in range(num):
        tvs.append((-1, -1))
    for i in range(len(bans)):
        now = bans[i][0]
        can = bans[i][1]
        for j, tv in enumerate([tv for tv in tvs if tv[1] == can] + [tv for tv in tvs if tv[1 != can]]):
            if tv[1] == -1 or (tv[1] == can and tv[0] <= now) or tv[0] <= now - 1:
                del tvs[j]
                tvs.append((bans[i][1], can))
                break
        else:
            return False
    return True


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

bans = []
for i in range(n):
    s, t, c = map(int, input().split())
    bans.append((2 * s, 2 * t, c))
bans.sort(key=lambda x: x[0])

for num in range(1, 1024):
    if func():
        print(num)
        break


Fixed submission:
def func():
    tvs = []
    for i in range(num):
        tvs.append((-1, -1))
    for i in range(len(bans)):
        now = bans[i][0]
        can = bans[i][2]
        tvs = [tv for tv in tvs if tv[1] == can] + [tv for tv in tvs if tv[1] != can]
        for j, tv in enumerate(tvs):
            if tv[1] == -1 or (tv[1] == can and tv[0] <= now) or tv[0] <= now - 1:
                del tvs[j]
                tvs.append((bans[i][1], can))
                break
        else:
            return False
    return True


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

bans = []
for i in range(n):
    bans.append(tuple(map(int, input().split())))
bans.sort(key=lambda x: x[0])

for num in range(1, 1024):
    if func():
        print(num)
        break
Buggy python submission (verdict: Runtime Error):
n,z,w=map(int,input().split())
a=list(map(int,input().split()))
a[-1], b = w, a[-1]
print(max((x-b) if x > a else b-x for x in a))


Fixed submission:
n,z,w=map(int,input().split())
a=list(map(int,input().split()))
if n == 1:
    print(abs(a[0]- w))
else:
    print(max([abs(a[-1] - a[-2]), abs(w - a[-1])]))
Buggy python submission (verdict: Runtime Error):
import math
n=int(input())
m=int(input())
s=1
for i in range(n):
  s = math.min(s*2, s+m)
print(s)

Fixed submission:
n=int(input())
m=int(input())
s=1
for i in range(n):
  s = min(s*2, s+m)
print(s)
Buggy python submission (verdict: Runtime Error):
a=input().split()
print(a[0] if a[1] == a[2] else a[1] a[0] == a[2] else a[2])

Fixed submission:
a=input().split()
print(a[0] if a[1] == a[2] else a[1] if a[0] == a[2] else a[2])