Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np
 
n = int(input())
arr = np.array([int(i) for i in input().split()])
mod = 10 ** 9 + 7
s = 0

for i in range(60):
    assert np.count_nonzero(arr & 1) == sum(arr & 1)
    c1 = np.count_nonzero(arr & 1)
    s += 2 ** i * c1 * (n - c1)
    arr >>= 1
print(s % mod)

Fixed submission:
import sys
import numpy as np
 
n = int(input())
lst = [int(i) for i in sys.stdin.readline().split()]
arr = np.array(lst, np.int64)

mod = 10 ** 9 + 7
x_sum = 0

for i in range(60):
    c1 = np.count_nonzero(arr & 1)
    x_sum += (c1 * (n - c1) * 2 ** i)
    x_sum %= mod
    arr >>= 1
print(x_sum)

Buggy python submission (verdict: Runtime Error):
import sys
import numpy as np
 
n = int(input())
lst = [int(i) for i in sys.stdin.readline().split()]
arr = np.array(lst, np.int64)

mod = 10 ** 9 + 7
x_sum = 0

for i in range(60):
    c1 = sum(lst & 1)
    x_sum += (c1 * (n - c1) * 2 ** i)
    x_sum %= mod
    lst >>= 1
print(x_sum)

Fixed submission:
import sys
import numpy as np
 
n = int(input())
lst = [int(i) for i in sys.stdin.readline().split()]
arr = np.array(lst, np.int64)

mod = 10 ** 9 + 7
x_sum = 0

for i in range(60):
    c1 = np.count_nonzero(arr & 1)
    x_sum += (c1 * (n - c1) * 2 ** i)
    x_sum %= mod
    arr >>= 1
print(x_sum)

Buggy python submission (verdict: Runtime Error):
import sys
import numpy as np
 
n = int(input())
lst = [int(i) for i in sys.stdin.readline().split()]
mod = 10 ** 9 + 7
c = []

for i in range(60):
    c1 = sum(lst & 1)
    c.append(c1 * (n - c1))
    lst >>= 1
print(sum([v * 2 ** i for i, v in enumerate(c)]) % mod)

Fixed submission:
import sys
import numpy as np
 
n = int(input())
lst = [int(i) for i in sys.stdin.readline().split()]
arr = np.array(lst, np.int64)

mod = 10 ** 9 + 7
x_sum = 0

for i in range(60):
    c1 = np.count_nonzero(arr & 1)
    x_sum += (c1 * (n - c1) * 2 ** i)
    x_sum %= mod
    arr >>= 1
print(x_sum)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
lst = [int(i) for i in input().split()]
s = 0
x = 0
for i in range(n - 1):
    for j in range(i + 1, n):
        s += lst[i]^lst[j]
mod = 10 ** 9 + 7
print(s % mod)


Fixed submission:
import sys
import numpy as np
 
n = int(input())
lst = [int(i) for i in sys.stdin.readline().split()]
arr = np.array(lst, np.int64)

mod = 10 ** 9 + 7
x_sum = 0

for i in range(60):
    c1 = np.count_nonzero(arr & 1)
    x_sum += (c1 * (n - c1) * 2 ** i)
    x_sum %= mod
    arr >>= 1
print(x_sum)
Buggy python submission (verdict: Runtime Error):
if X > 10100:
    print(1)
    quit()
lst = []
for i in range(20):
    lst.append([i*105+1, i*100+99])
for item in lst:
    if X >= item[0] and X<=item[1]:
        print(0)
        quit()
print(1)

Fixed submission:
X =int(input())
if X > 10100:
    print(1)
    quit()
lst = []
for i in range(20):
    lst.append([i*105+1, i*100+99])
for item in lst:
    if X >= item[0] and X<=item[1]:
        print(0)
        quit()
print(1)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
S = input()
lst = []
for i in range(N-2):
    for j in range(i+1,N-1):
        for k in range(j+1,N):
            if S[i]+S[j]+S[k] in lst:
                continue
            else:
                lst.append(S[i]+S[j]+S[k])
            if len(lst) == 999:
                print(len(lst))
                quit()
print(len(lst))

Fixed submission:
N = int(input())
S = input()
lst = []
count = 0
for i in range(1000):
    num = str(i).zfill(3)
    if num[0] in S:
        a1 = S.index(num[0])
        if num[1] in S[a1+1:]:
            a2 = S[a1+1:].index(num[1]) + a1+1
            if num[2] in S[a2+1:]:
                count += 1
print(count)

Buggy python submission (verdict: Runtime Error):
N = int(input())
S = input()
lst = []
for i in range(N-2):
    for j in range(i+1,N-1):
        for k in range(j+1,N):
            if S[i]+S[j]+S[k] in lst:
                continue
            else:
                lst.append(S[i]+S[j]+S[k])
            if len(lst) = 999:
                print(len(lst))
                quit()
print(len(lst))

Fixed submission:
N = int(input())
S = input()
lst = []
count = 0
for i in range(1000):
    num = str(i).zfill(3)
    if num[0] in S:
        a1 = S.index(num[0])
        if num[1] in S[a1+1:]:
            a2 = S[a1+1:].index(num[1]) + a1+1
            if num[2] in S[a2+1:]:
                count += 1
print(count)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
S = input()
lst = []
for i in range(N-2):
    for j in range(i+1,N-1):
        for k in range(j+1,N):
            if S[i]+S[j]+S[k] in lst:
                continue
            else:
                lst.append(S[i]+S[j]+S[k])
print(len(lst))

Fixed submission:
N = int(input())
S = input()
lst = []
count = 0
for i in range(1000):
    num = str(i).zfill(3)
    if num[0] in S:
        a1 = S.index(num[0])
        if num[1] in S[a1+1:]:
            a2 = S[a1+1:].index(num[1]) + a1+1
            if num[2] in S[a2+1:]:
                count += 1
print(count)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
S = input()
lst = []
for i in range(N-2):
    for j in range(i+1,N-1):
        for k in range(j+1,N):
            lst.append(S[i]+S[j]+S[k])
print(len(set(lst)))

Fixed submission:
N = int(input())
S = input()
lst = []
count = 0
for i in range(1000):
    num = str(i).zfill(3)
    if num[0] in S:
        a1 = S.index(num[0])
        if num[1] in S[a1+1:]:
            a2 = S[a1+1:].index(num[1]) + a1+1
            if num[2] in S[a2+1:]:
                count += 1
print(count)
Buggy python submission (verdict: Runtime Error):
N = int(input())
lst = [int(i) for i in input().split()]
mod = 1000000007
count = [0] * N
count[0] = 3

ret = 1
for i in lst:
    count[i + 1] += 1
    ret = (ret * count[i]) % mod
    count[i] -= 1

print(ret)

Fixed submission:
N = int(input())
lst = [int(i) for i in input().split()]
mod = 1000000007
count = [0] * (N + 1)
count[0] = 3

ret = 1
for i in lst:
    count[i + 1] += 1
    ret = (ret * count[i]) % mod
    count[i] -= 1

print(ret)
Buggy python submission (verdict: Runtime Error):
N, M = [int(item) for item in input().split()]
S = input()
a=[]
s = S
n = N
while n > 0:
    for i in range(M, 0, -1):
        can = False
        if n>=i and s[n-i] == '0':
            a.append(i)
            s = s[:n-i+1]
            print(s)
            n -= -i
            can = True
            break
    if not can and len(s)>1:
        print(-1)
        a=[]
        break
a=a[-1::-1]
if len(a):
    print(*a)

Fixed submission:
N, M = [int(item) for item in input().split()]
S = input()
a=[]
s = S
n = N
while n > 0:
    for i in range(M, 0, -1):
        can = False
        if n>=i and s[n-i] == '0':
            a.append(i)
            s = s[:n-i+1]
            n -= i
            can = True
            break
    if (not can) and len(s)>1:
        print(-1)
        a=[]
        break
a=a[-1::-1]
if len(a):
    print(*a)
Buggy python submission (verdict: Time Limit Exceeded):
import sys
from collections import Counter
n, *lst = sys.stdin.read().split()
n = int(n)
c = []
for i in lst:
  tmpc = Counter(i)
  tmpc = ''.join(str(tmpc[chr(key)]) if chr(key) in tmpc else str(0) for key in range(97, 124))
  c.append(tmpc)

c = Counter(c)
res = 0
for key in c:
  res += c[key] * (c[key] - 1) // 2
print(res)

Fixed submission:
import sys
from collections import defaultdict

n, *lst = sys.stdin.read().split()
n = int(n)
c = defaultdict(int)
for i in lst:
  tmpi = ''.join(sorted(i))
  c[tmpi] += 1
res = 0
for key in c:
  res += c[key] * (c[key] - 1) // 2
print(res)
Buggy python submission (verdict: Time Limit Exceeded):
def main():
  N,M,*alst=map(int, open(0).read().split())
  mod=10**9+7
  dp = [0] * (N+1)
  dp[:2] = [1, 1 if 1 not in alst else 0]
  for i in range(2, N+1):
    if i not in alst:
      dp[i] = (dp[i-2] + dp[i-1])%mod
  print(dp[N])

main()

Fixed submission:
def main():
  N,M,*alst=map(int, open(0).read().split())
  alst=set(alst)
  mod=10**9+7
  dp = [0] * (N+1)
  dp[:2] = [1, 1 if 1 not in alst else 0]
  for i in range(2, N+1):
    if i not in alst:
      dp[i] = (dp[i-2] + dp[i-1])%mod
  print(dp[N])
main()

Buggy python submission (verdict: Time Limit Exceeded):
import sys
from functools import lru_cache
sys.setrecursionlimit(1000000)
read=sys.stdin.read
N,M,*alst=map(int,read().split())
mod=10**9+7
dp = [1, 1 if 1 not in alst else 0]


@lru_cache(maxsize=None)
def a(n):
  if n==0:
    return dp[0]
  elif n==1:
    return dp[1]
  else:
    if n not in alst:
      return (a(n-2)+a(n-1))%mod
    else:
      return 0


print(a(N))


Fixed submission:
def main():
  N,M,*alst=map(int, open(0).read().split())
  alst=set(alst)
  mod=10**9+7
  dp = [0] * (N+1)
  dp[:2] = [1, 1 if 1 not in alst else 0]
  for i in range(2, N+1):
    if i not in alst:
      dp[i] = (dp[i-2] + dp[i-1])%mod
  print(dp[N])
main()

Buggy python submission (verdict: Time Limit Exceeded):
import sys
from functools import lru_cache
sys.setrecursionlimit(1000000)
read=sys.stdin.read
N,M,*alst=map(int,read().split())
mod=10**9+7
dp = [1, 1 if 1 not in alst else 0]
@lru_cache(maxsize=None)
def a(n):
  if n==0:
    return dp[0]
  elif n==1:
    return dp[1]
  else:
    if n not in alst:
      return (a(n-2)+a(n-1))%mod
    else:
      return 0
print(a(N))


Fixed submission:
def main():
  N,M,*alst=map(int, open(0).read().split())
  alst=set(alst)
  mod=10**9+7
  dp = [0] * (N+1)
  dp[:2] = [1, 1 if 1 not in alst else 0]
  for i in range(2, N+1):
    if i not in alst:
      dp[i] = (dp[i-2] + dp[i-1])%mod
  print(dp[N])
main()
Buggy python submission (verdict: Runtime Error):
n, m, *lst = map(int, input().split())
l = max(lst[::2])
r = min(lst[1::2])
if l > r:
  print(0)
else:
  print(r - l + 1)


Fixed submission:
n, m = map(int, input().split())
left, right = 1, n
for _ in range(m):
  l, r = map(int, input().split())
  if l > left:
    left = l
  if r < right:
    right = r
  if left > right:
    print(0)
    quit()
print(right - left + 1)

Buggy python submission (verdict: Runtime Error):
n, m = map(int, input().split())
left, right = 1, n
for _ in range(m):
  l, r = map(int, input().split())
  if l > left:
    left = l
  if r < right:
    right = r
  if l > r:
    print(0)
    quit()
if right > n:
  
print(right - left + 1)

Fixed submission:
n, m = map(int, input().split())
left, right = 1, n
for _ in range(m):
  l, r = map(int, input().split())
  if l > left:
    left = l
  if r < right:
    right = r
  if left > right:
    print(0)
    quit()
print(right - left + 1)
Buggy python submission (verdict: Time Limit Exceeded):
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

n,q=map(int,readline().split())
s=readline().decode('utf-8')
lst=map(int,read().split())
lr=list(zip(lst,lst))
for l,r in lr:
  print((r-l+1-len(s[l-1:r].replace('AC','')))//2)

Fixed submission:
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

n,q=map(int,readline().split())
s=readline().decode('utf-8')
dic={}
c=0
for idx, i in enumerate(s, 1):
  if i=='C' and s[idx-2]=='A':
    c+=1
  dic[idx]=c
lst=map(int,read().split())
lr=list(zip(lst,lst))

for l,r in lr:
  print(dic[r]-dic[l])
Buggy python submission (verdict: Runtime Error):
from functools import reduce
from math import log
n, m = map(int, input().split())
f1 = lambda x, y: 1 << x | 1 << y
f2 = lambda x, y: x & y
lst = []
for i in range(n):
  tmplst = [int(i) for i in input().split()]
  tmp = reduce(f1, tmplst[1:])
  lst.append(tmp)
ret = reduce(f2, lst)
if ret:
  print(int(log(ret, 2)))
else:
  print(0)
  

Fixed submission:
n, m = map(int, input().split())
lst = []
for i in range(n):
  tmplst = [int(i) for i in input().split()]
  tmp = 0
  for item in tmplst[1:]:
    tmp |= 1 << item
  lst.append(tmp)
ret = lst[0]
for item in lst[1:]:
  ret &= item
if ret:
  s = sum(map(int, bin(ret)[2:]))
  print(s)
else:
  print(0)
Buggy python submission (verdict: Runtime Error):
n = int(input())
c, *lst = [int(i) for i in input().split()]
for i in range(1, n):
  if lst[i] > lst[i - 1]:
      c += lst[i] - lst[i - 1]
print(c)

Fixed submission:
n = int(input())
lst = [int(i) for i in input().split()]
c = lst[0]
for i in range(1, n):
  if lst[i] > lst[i - 1]:
      c += lst[i] - lst[i - 1]
print(c)
Buggy python submission (verdict: Runtime Error):
n,k = map(int, input().split())
lst = [int(input()) for _ in range(n)]
lst.sort()
print(min(h[i + k - 1] - h[i] for i in range(n - k + 1)))


Fixed submission:
n,k = map(int, input().split())
lst = [int(input()) for _ in range(n)]
lst.sort()
print(min(lst[i + k - 1] - lst[i] for i in range(n - k + 1)))
Buggy python submission (verdict: Runtime Error):
N = int(input())

def dfs(s): # 文字列 s で始まる七五三数の個数
  if int(s) > N:
  	return 0
  ret = 1 if all(s.count(c) > 0 for c in '753') else 0 # s 自体が七五三数なら +1
  for c in '753':
  	ret += dfs(s + c)
	return ret

print(dfs('0')) # 本当は dfs('') と書きたいが 4 行目でのエラーを防ぐため仕方なく


Fixed submission:
N = int(input())

def dfs(s): # 文字列 s で始まる七五三数の個数
  if int(s) > N:
  	return 0
  ret = 1 if all(s.count(c) > 0 for c in '753') else 0 # s 自体が七五三数なら +1
  for c in '753':
  	ret += dfs(s + c)
  return ret

print(dfs('0')) # 本当は dfs('') と書きたいが 4 行目でのエラーを防ぐため仕方なく
Buggy python submission (verdict: Runtime Error):
n = int(input())
lst = []
for _ in range(n):
  x, y, h = map(int, input().split())
  if h:
  lst.append(x, y, h)
if len(lst) == 1:
  print(*lst)
  quit()
for cx in range(101):
  for cy in range(101):
    a = True
    preh = abs(lst[0][0] - cx) + abs(lst[0][1] - cy) +lst[0][2]
    for x, y, h in lst[1:]:
      H = abs(x - cx) + abs(y - cy) + h
      if H != preh:
        a = False
        break
    if a:
      print(cx, cy, H)
      quit()
    

Fixed submission:
n = int(input())
lst = []
for _ in range(n):
  x, y, h = map(int, input().split())
  if h != 0:
    lst.append([x, y, h])
if len(lst) == 1:
  print(*lst[0])
  quit()
for cx in range(101):
  for cy in range(101):
    a = True
    preh = abs(lst[0][0] - cx) + abs(lst[0][1] - cy) +lst[0][2]
    for x, y, h in lst[1:]:
      H = abs(x - cx) + abs(y - cy) + h
      if H != preh:
        a = False
        break
    if a:
      print(cx, cy, H)
      quit()
Buggy python submission (verdict: Runtime Error):
print((int(input() - 1) // 111 + 1) * 111)

Fixed submission:
print(((int(input()) - 1) // 111 + 1) * 111)
Buggy python submission (verdict: Runtime Error):
import bisect

def main():
  n, k, *lst = map(int, open(0).read().split())
  z = bisect.bisect_left(lst, 0)
  idx = max(z - k + 1, 0)
  print(min(min(abs(i), j) + j - i for i, j in zip(lst[idx:], lst[idx + k - 1:])))

if __name__ == '__main__':
  main()

Fixed submission:
import bisect

n, k, *lst = map(int, open(0).read().split())
z = bisect.bisect_left(lst, 0)
if not z:
  print(lst[k - 1])
  quit()
if z >= n - 1:
  print(-lst[-k])
  quit()
res = float('inf')
for i in range(max(z - k + 1, 0), min(z, n - k) + 1):
  tmp = lst[i + k - 1] - lst[i] + min(abs(lst[i]), lst[i + k - 1])
  if tmp < res:
    res = tmp
print(res)

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

n, k, *lst = map(int, open(0).read().split())
z = bisect.bisect_left(lst, 0)
if not z:
  print(lst[z + k - 1])
  quit()
assert lst[z] > 0
res = float('inf')
for i in range(max(z - k + 1, 0), min(z, n - k) + 1):
  tmp = lst[i + k - 1] - lst[i] + min(abs(lst[i]), lst[i + k - 1])
  if tmp < res:
    res = tmp
print(res)


Fixed submission:
import bisect

n, k, *lst = map(int, open(0).read().split())
z = bisect.bisect_left(lst, 0)
if not z:
  print(lst[k - 1])
  quit()
if z >= n - 1:
  print(-lst[-k])
  quit()
res = float('inf')
for i in range(max(z - k + 1, 0), min(z, n - k) + 1):
  tmp = lst[i + k - 1] - lst[i] + min(abs(lst[i]), lst[i + k - 1])
  if tmp < res:
    res = tmp
print(res)
Buggy python submission (verdict: Runtime Error):
n = int(input())
s = '1' if n % 2 == 1 else 0
n = - n // - 2
while n:
  mod = abs(n % 2)
  s = str(mod) + s
  n = n // - 2
print(s)

Fixed submission:
n = int(input())
s = "1" if n % 2 == 1 else "0"
n = - n // - 2
while n:
  mod = (n % 2) ** 2
  s = "{}".format(mod) + s
  n = n // - 2
print(s)
Buggy python submission (verdict: Runtime Error):
import sys
readline = sys.stdin.readline
n = int(readline())
print(sum([int(i) for i in readline().split()] - n)

Fixed submission:
import sys
readline = sys.stdin.readline
n = int(readline())
print(sum([int(i) for i in readline().split()]) - n)
Buggy python submission (verdict: Runtime Error):
_ = input()
lst = map(int, input().split())

print(max(lst) - min(lst))

Fixed submission:
_ = input()
lst = [int(i) for i in input().split()]

print(max(lst) - min(lst))
Buggy python submission (verdict: Runtime Error):
n = int(input())

h = sum(list(str(n)))

print('Yes' if n % h == 0 else 'No')

Fixed submission:
n = int(input())
h = sum(map(int, list(str(n))))

print('Yes' if n % h == 0 else 'No')
Buggy python submission (verdict: Runtime Error):
s = input()
if len(s) < 26:
  for i in range(97, 124):
    if chr(i) not in s:
      break
  print(s + chr(i))
else:
  prep = [s[-1]]
  for i in s[-2::-1]:
    if i > prep[-1]:
      prep.append(i)
    else:
      break
  if len(prep) == 26:
    print(-1)
  else:
    print(s[:-len(prep)-1] + min(i for i in prep if i > s[-len(prep)-2]))

  

Fixed submission:
s = input()
if len(s) < 26:
  for i in range(97, 124):
    if chr(i) not in s:
      break
  print(s + chr(i))
else:
  prep = [s[-1]]
  for i in s[-2::-1]:
    if i > prep[-1]:
      prep.append(i)
    else:
      break
  if len(prep) == 26:
    print(-1)
  else:
    print(s[:-len(prep)-1] + min(i for i in prep if i > s[-len(prep)-1]))
Buggy python submission (verdict: Time Limit Exceeded):
def a(n):
    if n == 0:
        return 2
    elif n == 1:
        return 1
    else:
        return a(n - 1) + a(n - 2)
print(a(int(input())))

Fixed submission:
n = int(input())
la = 1
lla = 2
for i in range(2, n + 1):
    lla, la = la, lla + la
print(la)
Buggy python submission (verdict: Runtime Error):
ss, t = input(), input()
lt = len(t)
lss = len(ss)

for i in range(0, lss - lt + 1):
  tss = ss[i : i + lt]
  tb = True
  for a, b in zip(tss, t):
    if a == '?':
      continue
    elif a != b:
      tb = False
      break
  if tb:
    ss = ss[: i] + t + ss[i + lt:]
    break
if tb:
  print(ss.replace('?', 'a'))
else:
  print('UNRESTORABLE')

Fixed submission:
ss, t = input(), input()
lt = len(t)
lss = len(ss)
lst = []
for i in range(lss - 1, lt - 2, -1):
    tss = ss[i - lt + 1:i + 1]
    tb = True
    for a, b in zip(tss, t):
        if a == '?':
            continue
        elif a != b:
            tb = False
            break
    if tb:
        lst.append(ss[:i - lt + 1] + t + ss[i + 1:])
if len(lst):
    lst.sort()
    print(lst[0].replace('?', 'a'))
else:
    print('UNRESTORABLE')
Buggy python submission (verdict: Runtime Error):
lst = [[int(i) for i in input().split()] for _ in range(n)]
p = 0
for i in lst:
  p += i[1] - i[0] + 1
print(p)

Fixed submission:
n = int(input())
lst = [[int(i) for i in input().split()] for _ in range(n)]
p = 0
for i in lst:
  p += i[1] - i[0] + 1
print(p)

Buggy python submission (verdict: Runtime Error):
import sys
lst = [[int(j) for j in i] for i in sys.stdin.readlines()]n = int(input())
lst = [[int(i) for i in input().split()] for _ in range(n)]
p = 0
for i in lst:
  p += i[1] - i[0] + 1
print(p)

Fixed submission:
n = int(input())
lst = [[int(i) for i in input().split()] for _ in range(n)]
p = 0
for i in lst:
  p += i[1] - i[0] + 1
print(p)
Buggy python submission (verdict: Runtime Error):
n = int(input())
dic = {}
for _ in range(n):
  tmp = int(input())
  if tmp in dic and dic[tmp] == 1:
    dic[tmp] == 0
  else:
    dic[tmp] = 1
print(sum([*dic.values()]))

Fixed submission:
n = int(input())
dic = {}
for _ in range(n):
  tmp = int(input())
  if tmp in dic and dic[tmp] == 1:
    dic[tmp] = 0
  else:
    dic[tmp] = 1
print(sum(dic.values()))

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
s = 0
lst = []
for _ in range(n):
  tmp = int(input())
  if tmp in lst:
    s -= 1
    lst.remove(tmp)
  else:
    s += 1
    lst.append(tmp)
print(s)

Fixed submission:
n = int(input())
dic = {}
for _ in range(n):
  tmp = int(input())
  if tmp in dic and dic[tmp] == 1:
    dic[tmp] = 0
  else:
    dic[tmp] = 1
print(sum(dic.values()))

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
s = 0
for _ in range(n):
  s ^= 1 << int(input())
c = 0
while s:
  flag = s - 1
  s &= flag
  c += 1
print(c)

Fixed submission:
n = int(input())
dic = {}
for _ in range(n):
  tmp = int(input())
  if tmp in dic and dic[tmp] == 1:
    dic[tmp] = 0
  else:
    dic[tmp] = 1
print(sum(dic.values()))
Buggy python submission (verdict: Runtime Error):
n = int(input())
#n, k = map(int,input().split())
#plst = [int(i) for i in input().split()]

lst = [int(input()) for _ in range(n)]

def a(p, q):
    if p % q == 0:
        return q
    else:
        return a(q, p % q)

f = lst[0] * (lst[1] // a(lst[0], lst[1]))
for i in range(2, n):
    f = f * (lst[i] // a(f, lst[i]))
print(f)

Fixed submission:
n = int(input())
#n, k = map(int,input().split())
#plst = [int(i) for i in input().split()]
if n == 1:
    print(int(input()))
else:
    lst = [int(input()) for _ in range(n)]

    def a(p, q):
        if p % q == 0:
            return q
        else:
            return a(q, p % q)

    f = lst[0] * (lst[1] // a(lst[0], lst[1]))
    for i in range(2, n):
        f = f * (lst[i] // a(f, lst[i]))
    print(f)

Buggy python submission (verdict: Runtime Error):
n = int(input())
#n, k = map(int,input().split())
#plst = [int(i) for i in input().split()]

lst = [int(input()) for _ in range(n)]

def a(p, q):
    if p % q == 0:
        return q
    else:
        return a(q, p % q)


f = (lst[0] * lst[1]) // a(lst[0], lst[1])
for i in range(2, n):
    f = (f * lst[i]) // a(f, lst[i])
print(f)

Fixed submission:
n = int(input())
#n, k = map(int,input().split())
#plst = [int(i) for i in input().split()]
if n == 1:
    print(int(input()))
else:
    lst = [int(input()) for _ in range(n)]

    def a(p, q):
        if p % q == 0:
            return q
        else:
            return a(q, p % q)

    f = lst[0] * (lst[1] // a(lst[0], lst[1]))
    for i in range(2, n):
        f = f * (lst[i] // a(f, lst[i]))
    print(f)
Buggy python submission (verdict: Runtime Error):
s = input()
print(s[0] + str(len(s) - 2) + s[-1])s

Fixed submission:
s = input()
print(s[0] + str(len(s) - 2) + s[- 1])

Buggy python submission (verdict: Runtime Error):
s = input()
print(s[0] + str(len(s) - 2) + s[-1])s = input()
print(s[0] + str(len(s) - 2) + s[-1])

Fixed submission:
s = input()
print(s[0] + str(len(s) - 2) + s[- 1])
Buggy python submission (verdict: Runtime Error):
import sys
n, *alst = map(int, sys.stdin.read().split())
lst1 = alst[::2]
lst2 = alst[1::2]
if n % 2:
  lst1.reverse()
  print(''.join(lst1 + lst2))
else:
  lst2.reverse()
  print(''.join(lst2 + lst1))

Fixed submission:
n = int(input())
alst = input().split()
lst1 = alst[::2]
lst2 = alst[1::2]
if n % 2:
  lst1.reverse()
  print(' '.join(lst1 + lst2))
else:
  lst2.reverse()
  print(' '.join(lst2 + lst1))
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
lst = [int(input()) for _ in range(n)]
blst = []
i = 1
n = 0
while i not in blst:
    blst.append(i)
    i = lst[i - 1]
    n += 1
    if i == 2:
        print(n)
        quit()
print(-1)

Fixed submission:
n = int(input())
lst = [int(input()) for _ in range(n)]
i = 1
c = 0
for _ in range(n):
    i = lst[i - 1]
    c += 1
    if i == 2:
        print(c)
        quit()
print(-1)
Buggy python submission (verdict: Runtime Error):
import sys
n, *lst = map(int, sys.stdin.read().split())
res = sum(lst)
if not res % 10:
  tmp = [i if not i % 10 for i in lst]
  if tmp:
    res -= min(tmp)
  else:
    res = 0
print(res)
  

Fixed submission:
import sys
n, *lst = map(int, sys.stdin.read().split())
res = sum(lst)
if not res % 10:
  tmp = [i for i in lst if i % 10]
  if tmp:
    res -= min(tmp)
  else:
    res = 0
print(res)