Harryxun/stf_run huggingface dataset:
import sys
sys.setrecursionlimit(10**7)

road_par = []
road_rank = []
rail_par = []
rail_rank = []
c1 = []
c2 = []

def init(par, rank, c, n):
    for i in range(n):
        par.append(i)
        rank.append(0)
        c.append(0)


def find(par,x):
    if par[x] == x:
        return x
    par[x] = find(par, par[x])
    return par[x]


def unite(par, rank, x, y):
    x = par[x]; y = par[y]
    if x == y:
        return
    if rank[x] < rank[y]:
        par[x] = y
    elif rank[y] < rank[x]:
        par[y] = x
    else:
        par[y] = x
        rank[x] += 1


def same(par, x, y):
    if find(par, x) == find(par, y):
        return True
    else:
        return False


N, K, L = map(int, input().split())
init(road_par, road_rank, c1, N)
init(rail_par, rail_rank, c2, N)

for i in range(K):
    f, t = map(int, input().split())
    unite(road_par, road_rank, f-1, t-1)

for i in range(L):
    f,t = map(int, input().split())
    unite(rail_par, rail_rank, f-1, t-1)

for i in range(N):
    c1[find(road_par, i)] += 1
    c2[find(rail_par, i)] += 1

for i in range(N):
    if c1[i] == 1:
        road_par[i] = -1
    if c2[i] == 1:
        rail_par[i] = -1

ans = [0 for i in range(N)]
for i in range(N):
    if road_par[i] != -1:
        ans[i] +=1
    if rail_par[i] != -1:
        ans[i] += 1

for i in range(N):
    print(ans[i])

### FIXED CODE ###

import sys
sys.setrecursionlimit(10**7)

road_par = []
road_rank = []
rail_par = []
rail_rank = []
c1 = []
c2 = []

def init(par, rank, c, n):
    for i in range(n):
        par.append(i)
        rank.append(0)
        c.append(0)


def find(par,x):
    if par[x] == x:
        return x
    par[x] = find(par, par[x])
    return par[x]


def unite(par, rank, x, y):
    x = find(par, x); y = find(par, y)
    if x == y:
        return
    if rank[x] < rank[y]:
        par[x] = y
    elif rank[y] < rank[x]:
        par[y] = x
    else:
        par[y] = x
        rank[x] += 1


N, K, L = map(int, input().split())
init(road_par, road_rank, c1, N)
init(rail_par, rail_rank, c2, N)


for i in range(K):
    f, t = map(int, input().split())
    unite(road_par, road_rank, f-1, t-1)

for i in range(L):
    f,t = map(int, input().split())
    unite(rail_par, rail_rank, f-1, t-1)

for i in range(N):
    c1[find(road_par, i)] += 1
    c2[find(rail_par, i)] += 1

ans = [0 for i in range(N)]

"""
for i in range(N):
    for j in range(N):
        if find(road_par, i) == find(road_par, j) and find(rail_par, i) == find(rail_par, j):
            ans[i] += 1
"""
from collections import defaultdict
ans = defaultdict(int)
for i in range(N):
    ans[(find(road_par, i), find(rail_par, i))] += 1

for i in range(N):
    print(ans[(find(road_par, i), find(rail_par, i))], end=' ')
print('')
def cross(x, y):
    return (x.conjugate() * y).imag

def area_polygon(points):
    area = 0
    n = len(points)
    for i in range(n + 1):
        area += cross(points[i], points[(i+1)%n])
    return area / 2
    
    
import sys

p = []
for line in sys.stdin:
    p.append(list(map(float, line.split(','))))

print(area_polygon(p))

### FIXED CODE ###

def cross(x, y):
    return (x.conjugate() * y).imag

def area_polygon(points):
    area = 0
    n = len(points)
    for i in range(n):
        area += cross(points[i], points[(i+1)%n])
    return area / 2
    
    
import sys

p = []
for line in sys.stdin:
    x, y = map(float, line.split(','))
    p.append(complex(x, y))

print(area_polygon(p))
n,m=map(int,input().split())
a=[]
for i in range(n):
  a.append(input())
b=[]
for i in range(m):
  b.append(input())

res=0
for i in range(0,n-m+1):
  keep=0
  for j in range(i,i+m):
    if b[j-i] in a[j]:
      keep+=1
  if keep==m:
    print("Yes")
    res=1
    break
if res=0:
  print("No")


### FIXED CODE ###

n,m=map(int,input().split())
a=[]
for i in range(n):
  a.append(input())
b=[]
for i in range(m):
  b.append(input())

res=0
for i in range(0,n-m+1):
  for k in range(0,n-m+1):
    keep=0
    for j in range(i,i+m):    
      if b[j-i] in a[j][k:k+m]:
        keep+=1
      if keep==m:
        print("Yes")
        res=1
        break
  if res==1:
    break
if res==0:
  print("No")
import numpy as np
N = int(input())
x = np.zeros(N)
y = np.zeros(N)

for i in range(N):
    x[i], y[i] = map(int, input().split())
for j in range(N):
    for k in range(N-1):
        if x[k] > x[k + 1]:
            x[k], y[k] = x[k + 1], y[k + 1]
        elif x[k] == x[k + 1] and y[k] > y[k + 1]:
            x[k], y[k] = x[k + 1], y[k + 1]

ans = []
for p in range(N-1):
    for m in range(p+1, N):
        diff_x = x[m] - x[p]
        diff_y = y[m] - y[p]
        ans_kari = 0
        for r in range(N-1):
            for q in range(r+1, N):
                if x[q] - x[r] == diff_x and y[q] - y[r] == diff_y:
                    ans_kari += 1
        ans.append(ans_kari)

print("{}".format(N-max(ans)))


### FIXED CODE ###

# 未完成

import sys
N = int(input())
x = [0]*N
y = [0]*N
kouholist = []
ans = N
if N == 1:
    print(1)
    sys.exit()

for i in range(N):
    x[i], y[i] = map(int, input().split())
for m in range(N):
    for p in range(N):
        if m == p:
            continue
        diff_x = x[m] - x[p]
        diff_y = y[m] - y[p]
        ans_kari = N
        for r in range(N):
            for q in range(N):
                if x[q] - x[r] == diff_x and y[q] - y[r] == diff_y:
                    ans_kari -= 1
        if ans_kari < ans:
            ans = ans_kari

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

sys.setrecursionlimit(200000)


def close(v, i):
    j = int(s[v] == 'B')
    for u in links[v][i].copy():
        links[u][j].remove(v)
        if not links[u][j]:
            able[u] = False
            close(u, j ^ 1)


n, m = map(int, input().split())
s = input()
links = [[set(), set()] for _ in range(n)]
able = [False] * n
for _ in range(m):
    a, b = map(int, input().split())
    a -= 1
    b -= 1
    la, lb = links[a], links[b]
    i, j = [(0, 1), (1, 0)][s[b] == 'B']
    if not la[i] and la[j]:
        able[a] = True
    la[i].add(b)
    i, j = [(0, 1), (1, 0)][s[a] == 'B']
    if not lb[i] and lb[j]:
        able[b] = True
    lb[i].add(a)

for v in range(n):
    if able[v]:
        continue
    close(v, bool(links[v][1]))

print('Yes' if any(able) else 'No')


### FIXED CODE ###

import sys

sys.setrecursionlimit(200000)


def add_link(a, b):
    la = links[a]
    i, j = [(0, 1), (1, 0)][s[b] == 'B']
    if not la[i] and la[j]:
        able[a] = True
    la[i].add(b)


def close(v, i):
    j = int(s[v] == 'B')
    for u in links[v][i].copy():
        if not able[u]:
            continue
        links[u][j].discard(v)
        if not links[u][j]:
            able[u] = False
            close(u, j ^ 1)


n, m = map(int, input().split())
s = input()
links = [[set(), set()] for _ in range(n)]
able = [False] * n
for line in sys.stdin.readlines():
    a, b = map(int, line.split())
    a -= 1
    b -= 1
    add_link(a, b)
    add_link(b, a)

for v in range(n):
    if able[v]:
        continue
    close(v, bool(links[v][1]))

print('Yes' if any(able) else 'No')
A,B,C=map(int, input().slpit())
 
if A==B:
  print(C)
elif B==C:
  print(A)
else:
  print(B)

### FIXED CODE ###

A, B, C = map(int, input().split())
 
if A==B:
  print(C)
elif B==C:
  print(A)
else:
  print(B)
%
n = int(input())

def func(n, i):
    ans = 0
    while  n > 0:
        ans += n % i
        n // = i
    return ans

b = n
for i in range(n+1):
    tmp = func(i, 6) + func(n-1, 9)
    b = min(tmp, b)

print(b)

### FIXED CODE ###

n = int(input())
def func(n, i):
    ans = 0
    while n>0:
        ans += n%i
        n //= i
    return ans
b=n
for i in range(n+1):
    tmp = func(i, 6) + func(n-i, 9)
    b = min(tmp, b)
print(b)
def solve(n, m, ABC):
    g = [[] for _ in range(n)]
    for a, b, c in ABC:
        g[a - 1].append((b - 1, c))

    distance = [-10 ** 10] * n
    distance[0] = 0
    parents = [-1] * n
    ng = [False]

    def search(node):
        if ng[0]:
            return
        for to, d in g[node]:
            if node == parents[to] and distance[to] < distance[node] + d:
                ng[0] = True
                return
            if distance[to] < distance[node] + d:
                distance[to] = distance[node] + d
                parents[to] = node
            search(to)

    search(0)
    return 'inf' if ng[0] else distance[n - 1]

_n, _m = map(int, input().split())
_ABC = [list(map(int, input().split())) for _ in range(_m)]
print(solve(_n, _m, _ABC))


### FIXED CODE ###

def solve(n, m, ABC):
    distance = [None] * n
    distance[0] = 0

    for _ in range(n - 1):
        for a, b, c in ABC:
            if distance[a - 1] is None:
                continue
            if distance[b - 1] is None or distance[b - 1] < distance[a - 1] + c:
                distance[b - 1] = distance[a - 1] + c

    for _ in range(n - 1):
        for a, b, c in ABC:
            if distance[a - 1] is None or distance[b - 1] is None:
                continue
            if distance[b - 1] < distance[a - 1] + c:
                distance[b - 1] = distance[a - 1] + c
                if b == n:
                    return 'inf'

    return distance[n - 1]

_n, _m = map(int, input().split())
_ABC = [list(map(int, input().split())) for _ in range(_m)]
print(solve(_n, _m, _ABC))
N,Q = map(int,input().split())
def dfs(x, score):
    for y in Tree[x]:
        if Parent[x] != y:
            Parent[y] = x
            score[y] += score[x]
            dfs(y, score)
Tree = [[] for i in range(N+1)]
Parent = [0]*(N+1)
for i in range(N-1):
    a,b = map(int,input().split())
    Tree[a].append(b)
    Tree[b].append(a)
score = [0]*(N+1)
for j in range(Q):
    p,x = map(int,input().split())
    score[p] += x
dfs(1,score)
print(*score[1:],end="\t")

### FIXED CODE ###

import sys
sys.setrecursionlimit(1<<30)
N,Q = map(int,input().split())
def dfs(x, score):
    for y in Tree[x]:
        if Parent[x] != y:
            Parent[y] = x
            score[y] += score[x]
            dfs(y, score)
Tree = [[] for i in range(N+1)]
Parent = [0]*(N+1)
for i in range(N-1):
    a,b = map(int,input().split())
    Tree[a].append(b)
    Tree[b].append(a)
score = [0]*(N+1)
for j in range(Q):
    p,x = map(int,input().split())
    score[p] += x
dfs(1,score)
print(*score[1:],end="\t")
f,*l=map(len,input().split("T"))
x,y=map(int,input().split())
z=8000;bx=1<<f+z;by=1<<z
for dy,dx in zip(*[iter(l)]*2):bx=bx<<dx|bx>>dx;by=by<<dy|by>>dy
print("Yes"*(bx&(1<<x+z) and by&(1<<y+z))or"No")

### FIXED CODE ###

l = [len(c) for c in input().split("T")]
x, y = map(int, input().split())
bx = 1 << l.pop(0) + 8000
by = 1 << 8000
for i, d in enumerate(l):
	if i % 2:
		bx = (bx << d) | (bx >> d)
	else:
		by = (by << d) | (by >> d)
print("Yes" if bx & (1 << x + 8000) and by & (1 << y + 8000) else "No")
n, m, l = (int(i) for i in input().split())
A = []
B = []
C = [[0 for i in range(n)] for j in range(l)]
#??\?????????????????????????´?
for i in range(n):
    swap_list = input().split()
    A.append(swap_list)
for i in range(m):
    swap_list = input().split()
    B.append(swap_list)
#?????????????????????
for i in range(n):
    for j in range(l):
        for k in range(m):
            C[i][j] += int(A[i][k]) * int(B[k][j])
#?????????????????????
for i in range(n):
    print(" ".join(map(str,C[i][:])))

### FIXED CODE ###

n, m, l = (int(i) for i in input().split())
A = []
B = []
C = [[0 for i in range(l)] for j in range(n)]
#??\?????????????????????????´?
for i in range(n):
    swap_list = input().split()
    A.append(swap_list)
    #A.append([int(i) for i in input().split()])
for i in range(m):
    swap_list = input().split()
    B.append(swap_list)
    #B.append([int(i) for i in input().split()])
#????????????????¨????
for i in range(n):
    for j in range(l):
        for k in range(m):
            C[i][j] += int(A[i][k]) * int(B[k][j])
#?????????????????????
#for i in range(n):
#    for j in range(l):
#        print("{0}".format(C[i][j]), end="\b")
#    print("")
for i in range(n):
    print(" ".join(map(str, C[i][:])))
#for r in C:
#    print(" ".join([str(d) for d in r]))
import sys
def input(itr=iter(sys.stdin.readlines())):  # pylint: disable= redefined-builtin
    return next(itr).rstrip('\n\r')
###############################################################################

from networkx.utils.union_find import UnionFind

N, Q = map(int, input().split())

uf = UnionFind()
responses = []
for _ in range(Q):
    uq, u, v = map(int, input().split())
    if uq == 0:
        uf.union(u, v)
    else:
        responses.append(1 if uf[u] == uf[v] else 0)

print(*responses, sep='\n')


### FIXED CODE ###

import sys
def input(itr=iter(sys.stdin.readlines())):  # pylint: disable= redefined-builtin
    return next(itr).rstrip('\n\r')
###############################################################################

from networkx.utils.union_find import UnionFind

N, Q = map(int, input().split())

uf = UnionFind()
responses = []
for _ in range(Q):
    uq, u, v = map(int, input().split())
    if uq == 0:
        uf.union(u, v)
    else:
        responses.append(1 if uf[u] == uf[v] else 0)

print(*responses, sep='\n')
a=int(input())
b=int(input())
c=int(input())
d=int(input())
e=int(input())
f=int(input())
k=int(input())

if b-a>k or c-b>k or d-c>k or e-d>k or f-e>k:
    print(':(')
else:
    print('Yay!')
    



### FIXED CODE ###

a=int(input())
b=int(input())
c=int(input())
d=int(input())
e=int(input())
k=int(input())

x=max(a,b,c,d,e)
y=min(a,b,c,d,e)


if x-y>k:
    print(':(')
else:
    print('Yay!')
N = int(input())
A = list(map(int, input().split()))

b = [0] * (N + 1)
half = int(N / 2)
b[half:] = A[half - 1:]
for i in range(N, 0, -1):
    s = sum([b[j] for j in range(i * 2, N + 1, i)]) % 2
    if s != A[i - 1]:
        b[i] = 1
s = sum(b)
if s % 2 != A[0]:
    b[1] = 1
    s += 1
print(s)
for i, b_ in enumerate(b):
    if b_ == 1:
        print(i, end=" ")

### FIXED CODE ###

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

b = [0] * (N + 1)
half = N // 2
b[half + 1:] = A[half:]
for i in range(half, 1, -1):
    s = sum([b[j] for j in range(i * 2, N + 1, i)]) % 2
    if s != A[i - 1]:
        b[i] = 1
s = sum(b)
if s % 2 != A[0]:
    b[1] = 1
    s += 1
print(s)
for i, b_ in enumerate(b[:]):
    if b_ == 1:
        print(i, end=" ")
import collections

N, M = map(int,input().split())

A = list(map(int,input().split()))
A.sort()
op = [0]*M

for i in range(M):
    b,c = map(int,input().split())
    op[i] = (c, b)

op.sort(reverse=True)

now = 0
flag = False
for i in range(M):
    if flag:
        break
    val, maisu = op[i]
    if A[now] < val:
        for j in range(maisu):
            if A[now+j] < val:
                A[now+j] = val
            else:
                flag = True
                break
        now += maisu 
    else:
        break
    
print(sum(A))

### FIXED CODE ###

import collections

N, M = map(int,input().split())

A = list(map(int,input().split()))
A.sort()
op = [0]*M

for i in range(M):
    b,c = map(int,input().split())
    op[i] = (c, b)

op.sort(reverse=True)

now = 0
flag = False
for i in range(M):
    if flag:
        break
    val, maisu = op[i]
    if now >= N:
        break
    if A[now] < val:
        for j in range(maisu):
            if now+j < N:
                if A[now+j] < val:
                    A[now+j] = val
                else:
                    flag = True
                    break
        now += maisu 
    else:
        break
    
print(sum(A))
k,s=map(int,input(),split())
#k=2
#s=2
result=0
for x in range(k+1):
    for y in range(k+1):
        z=s-x-y
        if 0<=z and z<=k:
            result+=1
            
print(result)
            

### FIXED CODE ###

k,s=map(int,input().split())
#k=2
#s=2
result=0
for x in range(k+1):
    for y in range(k+1):
        z=s-x-y
        if 0<=z and z<=k:
            result+=1
            
print(result)
n=int(input())
l=list(map(int,input().split()))
from collections import defaultdict
d=defaultdict(int)
l1=set(l)
l2=[]
for i in l:
  d[i]+=1
if len(d)==1:
  print("No")
elif len(d)==2:
  for i in l1:
    l2.append(i)
  bool1=True
  if d[l2[0]]==d[l2[1]]*2:
    a=l2[0]
    b=l2[0]
    c=l2[1]
  elif d[l2[0]]*2==d[l2[1]]:
    a=l2[0]
    b=l2[1]
    c=l2[1]
  else:
    boo11=False
  if bool1:
    la=[]
    lb=[]
    lc=[]
    while a!=0:
      la.append(a%2)
      a=a//2
    while b!=0:
      lb.append(b%2)
      b=b//2
    while c!=0:
      lc.append(c%2)
      c=c//2
    while len(lb)<len(la):
      lb.append(0)
    while len(lc)<len(la):
      lc.append(0)
    bool1=True
    for i in range(len(la)):
      if la[i]+lb[i]+lc[i]==1 or la[i]+lb[i]+lc[i]==3:
        bool1=False
    if bool1:
      print("Yes")
    else:
      print("No")
  else:
    print("No")  
elif len(d)==3:
  for i in l1:
    l2.append(i)
  l2=sorted(l2)
  if d[l2[0]]==d[l2[1]] and d[l2[1]]==d[l2[2]]:
    a=l2[2]
    b=l2[1]
    c=l2[0]
    la=[]
    lb=[]
    lc=[]
    while a!=0:
      la.append(a%2)
      a=a//2
    while b!=0:
      lb.append(b%2)
      b=b//2
    while c!=0:
      lc.append(c%2)
      c=c//2
    while len(lb)<len(la):
      lb.append(0)
    while len(lc)<len(la):
      lc.append(0)
    bool1=True
    for i in range(len(la)):
      if la[i]+lb[i]+lc[i]==1 or la[i]+lb[i]+lc[i]==3:
        bool1=False
    if bool1:
      print("Yes")
    else:
      print("No")           
  else:
    print("No")
else:
  print("No")

### FIXED CODE ###

n=int(input())
def xor(x,y):
  bitx=[]
  bity=[]
  num1,num2=x,y
  while num1!=0:
    bitx.append(num1%2)
    num1//=2
  while num2!=0:
    bity.append(num2%2)
    num2//=2
  m=max(len(bitx),len(bity))
  while len(bitx)<m+1:
    bitx.append(0)
  while len(bity)<m+1:
    bity.append(0)
  ans=0
  for i in range(m):
    if bitx[i]!=bity[i]:
      ans+=2**i
  return ans
from collections import defaultdict
import sys
d=defaultdict(int)
l=list(map(int,input().split()))
if n%3!=0:
  for i in range(n):
    if l[i]!=0:
      print("No")
      sys.exit()
  print("Yes")
  sys.exit()
for i in l:
  d[i]+=1
if len(d)>3:
  print("No")
elif len(d)==3:
  b=True
  l1=[]
  for i in d:
    l1.append(i)
    if d[i]!=n/3:
      b=False
  if l1[0]!=xor(l1[1],l1[2]) or l1[1]!=xor(l1[0],l1[2]) or l1[2]!=xor(l1[0],l1[1]):
    b=False
  if b:
    print("Yes")
  else:
    print("No")
elif len(d)==2:
  if d[0]!=n/3:
    print("No")
  else:
    print("Yes")
else:
  if d[0]==n:
    print("Yes")
  else:
    print("No")
print(int(input)**3)

### FIXED CODE ###

a=int(input())
print(a*a*a)
n = int(input())
l = []
for i in  range():
    s, p = input().split()
    l.append([s, int(p), i])
l_sorted = sorted(l, key = lambda x: (x[0], -x[1]))
for out in l_sorted:
    print(out[2]+1)

### FIXED CODE ###

n = int(input())
l = []
for i in range(n):
    s, p = input().split()
    l.append([s, int(p), i+1])
l_sorted = sorted(l, key = lambda x: (x[0], -x[1]))
for j in range(n):
    print(l_sorted[j][2])
[n, m] = [int(i) for i in input().split()]
h = [int(i) for i in input().split()]
st = [{} for _ in range(n)]
for i in range(m):
    [a, b] = [int(i) for i in input().split()]
    st[a-1].add(b-1)
    st[b-1].add(a-1)
cnt = 0
for i, height in enumerate(h):
    line = []
    for huga in st[i]:
        line.append(h[huga])
    if height > max(line):
        cnt += 1
print(cnt)

### FIXED CODE ###

[n, m] = [int(i) for i in input().split()]
h = [int(i) for i in input().split()]
st = [set([]) for _ in range(n)]
for i in range(m):
    [a, b] = [int(i) for i in input().split()]
    st[a-1].add(b-1)
    st[b-1].add(a-1)
cnt = 0
for i, height in enumerate(h):
    line = []
    for huga in st[i]:
        line.append(h[huga])
    if len(line) == 0 or height > max(line):
        cnt += 1
print(cnt)
S = input()
T = input()
l = len(T)
ans = l
print(ans)
for i in range(l):
  for j in range(l):
    if (i<=j):
      if T[i:j+1] in S:
        if f >= i and f + (l-j) <= len(S):
          ans = min(ans, l - (j+1-i))
print(ans)
        

### FIXED CODE ###

S = input()
T = input()
ls = len(S)
lt = len(T)
ans = lt
for i in range(0,ls-lt+1):
  m = 0
  for j in range(lt):
    if S[i:i+lt][j]!=T[j]:
      m += 1
  ans = min(ans,m)
print(ans)
def dfs(d, v, p):
    if (d & 1):
        C[v] = 1
    for w, u in E[v]:
        if u == p:
            continue
        dfs(d ^ w, u, v)

N = int(input())
C = [0] * N
E = [[] for _ in range(N)]
for i in range(N-1):
    u, v, w = map(int, input().split())
    u -= 1
    v -= 1
    E[u].append((w % 2, v))
    E[v].append((w % 2, u))
dfs(0, 0, -1)
print(*C, sep='\n')

### FIXED CODE ###

import sys
sys.setrecursionlimit(10 ** 6)

def dfs(v):
    check[v] = True
    for u, w in T[v]:
        if check[u]:
            continue
        dist[u] = dist[v] + w
        dfs(u)

N = int(input())
T = [[] for _ in range(N+1)]
for _ in range(N-1):
    u, v, w = map(int, input().split())
    T[u].append((v, w))
    T[v].append((u, w))

dist = [0] * (N + 1)
check = [False] * (N + 1)
dfs(1)

print(*[d % 2 for d in dist[1:]], sep="\n")
a = input()
s = int(input())
print(s if a >= 3200 else 'red')

### FIXED CODE ###

a = int(input())
s = input()
print(s if a >= 3200 else 'red')
package main 

import "fmt"

func main() {
	var x [5]int

	for i := 0; i < 5; i++ {
		fmt.Scan(&x[i])
	}

	for i := 0; i < 5; i++ {
		if x[i] == 0 {
			fmt.Println(i + 1)
		}
	}
}

### FIXED CODE ###

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

for i in range(5):
    if X[i] == 0:
        ans = i + 1

print(ans)
import bisect as b
import math

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

for _ in range(m):
    half = a.pop(-1) / 2
    a.insert(b.bisect_left(a, half), half)

print(sum(list(map(lambda x: math.floor(x), a))))


### FIXED CODE ###

s = input().strip()

if (s == 'Sunny'):
    print('Cloudy')
elif (s == 'Cloudy'):
    print('Rainy')
else:
    print('Sunny')
print(('pphbhhphph'[int(input())])+'on')

### FIXED CODE ###

print(('pphbhhphph'[int(input()[-1])])+'on')
n=int(input())
a=[int(x) for x in input().split()]
a.sort()
even=[]
odd=[]
for i in range(0,n // 2):
    even.append(2*i+1)
even=even+even
even.sort()
for j in range(1,(n-1 // 2)+1):
    odd.append(2*j)
odd =odd + odd
odd.append(0)
odd.sort()
if n % 2 == 1:
    if a == odd:
        print(pow(2,n-1 // 2,10**9+7)
    else:
        print(0)
else:
    if a == even:
        print(2,n // 2,10**9+7)
    else:
        print(0)


### FIXED CODE ###

import numpy as np
MOD = 10**9 + 7
N = int(input())
A = np.array([int(x) for x in input().split()])

left = np.arange(N)
right = N-1-left
cnt_1 = np.bincount(np.abs(left-right))
cnt_2 = np.bincount(A)

if cnt_1.shape != cnt_2.shape or (cnt_1 != cnt_2).any():
  answer = 0
else:
  answer = pow(2, N//2, MOD)
  
print(answer)