Harryxun/stf_run huggingface dataset:
N = int(input())
A = list(map(int, input().split()))

def is_valid(A):
    counts = {}
    for a in A:
        if a in counts:
            counts[a] += 1
        else:
            counts[a] = 1
    if len(A) % 2 == 1:
        if counts[0] != 1:
            return False
        
        for i in range(1, len(A) // 2 + 1):
            if 2 * i not in counts or counts[2 * i] != 2:
                return False
        return True
    else:
        for i in range(1, len(A) // 2 + 1):
            if 2 * i not in counts or counts[2 * i - 1] != 2:
                return False
        return True
    return True
        
if is_valid(A):
    print(2 ** (N // 2))
else:
    print(0)

### FIXED CODE ###

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

def is_valid(A):
    counts = {}
    for a in A:
        if a in counts:
            counts[a] += 1
        else:
            counts[a] = 1
    if len(A) % 2 == 1:
        if counts[0] != 1:
            return False
        
        for i in range(1, len(A) // 2 + 1):
            if 2 * i not in counts or counts[2 * i] != 2:
                return False
        return True
    else:
        for i in range(1, len(A) // 2 + 1):
            if 2 * i - 1 not in counts or counts[2 * i - 1] != 2:
                return False
        return True
    return True
        
if is_valid(A):
    print(2 ** (N // 2) % 1000000007)
else:
    print(0)
def main():
    suu="abcdefghijklmnopqrstuvwxyz"#26
    n=int(input())
    puts=""
    if n<27:#その数より小さい
        print(suu[n-1])
        return
    while True:
        temp=n%26
        puts=suu[temp-1]+puts
        n/=26
        if temp==0:#補正
            n-=1
        if n<27:
            puts=suu[n-1]+puts
            break
    print(puts)
if __name__ == "__main__":
    main()


### FIXED CODE ###

def main():
    suu="abcdefghijklmnopqrstuvwxyz"#26
    n=int(input())
    puts=""
    if n<27:#その数より小さい
        print(suu[n-1])
        return
    while True:
        temp=n%26
        n//=26
        puts=suu[temp-1]+puts
        if temp==0:#補正
            n-=1
        if n<27:
            puts=suu[n-1]+puts
            break
    print(puts)
if __name__ == "__main__":
    main()
A = list(map(int, input().split()))
M = max(A)
S = sum(A)
M += M % 2 != S % 2
print((3 * M - sum) // 2)

### FIXED CODE ###

A = list(map(int, input().split()))
M = max(A)
S = sum(A)
M += M % 2 != S % 2
print((3 * M - S) // 2)
n, m = list(map(int, input().split()))

    
out = [a]*n
err_flg = False

for i in range(m):
    s = list(map(int, input().split()))

    if s[0]==1 and s[1]==0 and n > 1:
        err_flag = True
    elif s[0]==1 and s[1]==0 and n==1:
        print('0')
    elif m==0 and n==1:
        print('0')

    if out[s[0]-1]==0:
        out[s[0]-1] = s[1]
    elif out[s[0]-1]==s[1]:
        out[s[0]-1] = s[1]
    # elif out[s[0]-1]!=s[1]:
    elif out[s[0]-1]!=s[1]:
        err_flg = True


if out[0]=='a' and n>1:
    out[0]=1
out_s = "".join(map(str,out))

if err_flg:
    print('-1')
# elif m==0 and n==1:
#     print(0)
else:
    print(out_s)

### FIXED CODE ###

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

    
out = ['a']*n
err_flg = False
err_flg2 = False 

for i in range(m):
    s = list(map(int, input().split()))
    # print(s)

    if s[0]==1 and s[1]==0 and n==1:
        err_flg2 = True
    elif m==0 and n==1:
        err_flg2 = True
    elif s[0]==1 and s[1]==0 and n > 1:
        # print('kore')
        err_flg = True

    if out[s[0]-1]=='a':
        out[s[0]-1] = s[1]
    elif out[s[0]-1]==s[1]:
        out[s[0]-1] = s[1]
    # elif out[s[0]-1]!=s[1]:
    elif out[s[0]-1]!=s[1]:
        err_flg = True


if out[0]=='a' and n>1:
    out[0]=1
    

out_s = "".join(map(str,out))

if err_flg2:
    print('0')
    # print('err2')
elif err_flg:
    print('-1')
    # print('err')
else:
    print(out_s.replace('a','0'))
n = input()

INFTY = 10000000

color = [0 for i in xrange(n)]
M = [[0 for i in xrange(n)] for i in xrange(n)]
d = [INFTY for i in xrange(n)]
p = [-1 for i in xrange(n)]

def MST():
  d[0] = 0
  p[0] = -1

  while True:
    cost = INFTY
    for i in xrange(n):
      if color[i] != 1 and d[i] < cost:
        cost = d[i]
        u = i

    if cost == INFTY:
      break
    color[u] = 2

    for v in xrange(n):
      if color[v] != 2 and M[u][v] != INFTY:
      if M[u][v] < d[v]:
        d[v] = M[u][v]
        p[v] = u
        color[v] = 1:

  sum = 0
  for i in xrange(n):
    if p[i] != -1:
      sum += M[i][p[i]] 
  return sum

for i in xrange(n):
  G = map(int, raw_input().split())
  for j in range(n):
   if G[j] == -1:
     M[i][j] = INFTY
   else:
     M[i][j] = G[n]:

print sum

### FIXED CODE ###

n = input()

INFTY = 10000000

color = [0 for i in xrange(n)]
M = [[INFTY for i in xrange(n)] for i in xrange(n)]
d = [INFTY for i in xrange(n)]
p = [-1 for i in xrange(n)]

def MST():
  d[0] = 0

  while True:
    cost = INFTY
    for i in xrange(n):
      if color[i] != 2 and d[i] < cost:
        cost = d[i]
        u = i

    if cost == INFTY:
      break
    
    color[u] = 2

    for v in xrange(n):
      if color[v] != 2 and M[u][v] != INFTY and M[u][v] < d[v]:
        d[v] = M[u][v]
        p[v] = u
        color[v] = 1

  sum = 0
  for i in xrange(n):
    if p[i] != -1:
      sum += M[i][p[i]]
  return sum

for i in xrange(n):
  G = map(int, raw_input().split())
  for j in range(n):
   if G[j] != -1:
     M[i][j] = G[j]

print MST()
from collections import deque
N,R1,R2 = map(int, input().split())
graph = [deque([]) for _ in range(N-1)]
count={}
for i in range(N-1):
    count[i+1] = 0


for i in range(N-1):
    if i != R1-1:
        graph[i].append(i+1)
    else:
        graph[i].append(i+1)
        graph[i].append(R2-1)

def dfs(v, counter):
    global count
    gs=[]
    for g in graph[v]:
        count[counter]+=1
        gs.append(g)
    gsm = max(gs)
    if gsm < N-1:
        dfs(gsm, counter+1)
    else:
        return

for i in range(N-1):
    dfs(i, 1)
    


### FIXED CODE ###

N, R1, R2 = map(int, input().split())
n = R2 - R1 - 1
count={}
for m in range(N-1):
    count[m+1] = 0 
for i in range(N):
    for j in range(i+1, N):
        k = min(j-i, abs((R1-1)-i) + 1 +abs((R2-1)-j))
        count[k]+=1
for k in count.values():
    print(k)
import functools
import math

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

def f(a,ans):
     ans = max(functools.reduce(math.gcd, a),ans)
     return ans
     
for i in range(n):
     ans = f(a[:i]+a[i+1:],ans)
print(ans)

### FIXED CODE ###

def gcd(a, b):
    if b == 0:
        return a
    else:
        return gcd(b, a%b)

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

b = [a[0]]
c = [a[-1]]

for i in range(1,n):
     j = n-1-i
     b.append(gcd(b[-1],a[i]))
     c.append(gcd(c[-1],a[j]))
     
ans = max(b[-2],c[-2])
for i in range(n):
     ans = max(ans,gcd(b[i],c[n-3-i]))
print(ans)
M = map(int, input())
print 48-M

### FIXED CODE ###

print(48-int(input()))
import math

n, m = map(int, input().split())
item_price = list(map(int, input().split()))
# n, m = (4, 4)
# item_price = [1, 9, 3, 5]
item_price.sort(reverse=True)
devided_two_price = [math.ceil(math.log2(i)) for i in item_price]
use_ticket_list = [0] * n
sum = 0

x = 0
for i in range(m):
    if devided_two_price[x] == 2:
        x += 1
        use_ticket_list[x] += 1
        devided_two_price[x] -= 1
    elif devided_two_price[x] >= devided_two_price[x+1]:
        use_ticket_list[x] += 1
        devided_two_price[x] -= 1
    else:
        x += 1
        use_ticket_list[x] += 1
        devided_two_price[x] -= 1

for i in range(n):
    sum += item_price[i] // (2**use_ticket_list[i])

print(sum)

### FIXED CODE ###

from heapq import heappush, heappop, heapify
import math

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

item_price_list = list(map(lambda x: x*(-1), item_price_list))
heapify(item_price_list)
for i in range(m):
    a = heappop(item_price_list)
    heappush(item_price_list, math.ceil(a/2))
    
print((-1)*sum(item_price_list))
S = input()
Q = int(input())

lS = ''
for _ in range(Q):
    query = input().split()
    if query[0] == '1':
        lS, S = S, lS
    else:
        if query[1] == '1':
            lS += query[2]
        else:
            S += query[2]

print(lS[::-1] + S)

### FIXED CODE ###

s = input()

s_count_A = s.count('A')

if s_count_A == 0 or s_count_A == 3:
    ans = 'No'
else:
    ans = 'Yes'

print(ans)
N, M = map(int, input().split())
A = deque(sorted(list(map(int, input().split()))))
for a in A:
  if N / (4 * M) > a:
    A.pop()
  else:
    break
print("Yes" if len(A) >= M else "No")

### FIXED CODE ###

N, M = map(int, input().split())
A = sorted(list(map(int, input().split())))
all = sum(A)
L = len(A)
for a in A:
  if all / (4 * M) > a:
    L -= 1
  else:
    break
print("Yes" if L >= M else "No")
import math
A, B, C, D = map(int, input().split())
E = (C * D) // math.gcd(C, D)
print(B - ((B//C - (A-1)//C) + (B//D - (A-1)//D)-(B//E - (A-1)//E))-A + 1)


### FIXED CODE ###

import fractions
A, B, C, D = map(int, input().split())
E = (C * D) // fractions.gcd(C, D)
print(B - ((B//C - (A-1)//C) + (B//D - (A-1)//D)-(B//E - (A-1)//E))-A + 1)
a = input()
b = input()
print((int(a) * int(b),(int(a) * 2) + (int(b) * 2)))

### FIXED CODE ###

x = input()
print(int(x) ** 3)
import math
from functools import reduce

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

def lcm_base(x, y):
	return (x * y) // math.gcd(x, y)
	
def lcm_list(numbers):
	return reduce(lcm_base, numbers, 1)
	
lcmNum = lcm_list(ANs)
#print(lcmNum)
#print(lcmList)

f = 0
for a in ANs:
	f += (lcmNum-1)%a
print(f)

### FIXED CODE ###

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

m_1 = 0
for a in ANs:
	m_1 += a-1
	
print(m_1)
N=int(input())

H=list(map(int , input().split()))
cnt = 0
for i in range(len(H)):
  if max(H[0:i])==H[i]:
    cnt +=1
    
print(cnt)


### FIXED CODE ###

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

cnt = 0
for i in range(len(H)):
    if (max(H[0:i+1]) == H[i]):
        cnt += 1

print(cnt)
def digit_10(n):
    dten = 0
    while(n>0):
        dten+=int(n%10)
        n/=10
    return dten

n = int(input())
l = []
for a in range(2,n):
    l.append(digit_10(a)+digit_10(n-a))
print(min(l))


### FIXED CODE ###

def digit_10(n):
    dten = 0
    while(n>0):
        dten+=int(n%10)
        n/=10
    return dten

n = int(input())
l = []
for a in range(1,n):
    l.append(digit_10(a)+digit_10(n-a))
print(min(l))
n,m=map(int,input().split())
sc=[list(map(int,input().split())) for _ in range(m)]
if n==1:
    c0=sc[0][0]
    for i in range(m):
        s=sc[i][0]
        c=sc[i][1]
        if c!=c0:
            print(-1)
            exit()
    print(c0)
else:
    ans=10**5
    for i in range(10**(n-1),10**n):
        I=str(i)
        flag=True
        for j in range(m):
            s,c=sc[j][0],sc[j][1]
            if s==1 and c==0:
                print(-1)
                exit()
            if I[s-1]!=str(c):
                flag=False
                continue
        if flag:
            ans=min(ans,i)
    if ans==10**5:
        print(-1)
    else:
        print(ans)

### FIXED CODE ###

n,m=map(int,input().split())
sc=[list(map(int,input().split())) for _ in range(m)]
for i in range(10**n):
    ans=str(i)
    if len(ans)==n and all(ans[s-1]==str(c) for s,c in sc):
        print(ans)
        exit()
print(-1)
import math
import collections

p_max = int(10**(10./3))

marked = [True]*2+[False]*(p_max-2)
ps = []

for n in range(2,p_max):
    if marked[n]:
        continue
    ps.append(n)
    for n2 in range(n, p_max):
        if n2 % n == 0:
            marked[n2] = True

def getexp(n, p):
    ans = 0
    while n > 1 and n % p == 0:
        ans += 1
        n = n // p
    return ans

def getcanon(n):
    canon = []
    for p in ps:
        if n == 1:
            return tuple(canon)
        e = getexp(n, p)
        n = n//(p**e)
        if e % 3 != 0:
            canon.append((p, e % 3))
    sqr = int(math.sqrt(n+0.5))
    if sqr**2 == n:
        canon.append((sqr, 2))
    else:
        canon.append((n,1))
    return tuple(canon)

def getcomp(canon):
    return tuple([(p,3-e) for (p,e) in canon])


N = int(raw_input())
s = [int(raw_input()) for i in range(N)]

ctr = collections.Counter()

for si in s:
    ctr[getcanon(si)] += 1

ans = 0

cans = list(ctr.keys())

for can in cans:
    ct = ctr[can]
    if ct == 0:
        continue
    if can == ():
        ans += 1
        ctr[can] = 0
        continue
    comp = getcomp(can)
    c_ct = ctr[comp]
    if c_ct == 0:
        ans += ct
    else:
        ans += max(ct, c_ct)
        ctr[comp] = 0

print ans

### FIXED CODE ###

import collections
s = input()
C = collections.Counter(list(s))

if ((C['N'] > 0) == (C['S'] > 0)) and ((C['E'] > 0) == (C['W'] > 0)):
    print("Yes")
else:
    print("No")
n = int(input())
x = list(map(int,input().split()))
min_energy = 250000
for i range(0,101):
  energy = 0
  for k range(n):
    energy += (x[k]-1)**2
  if energy < min_energy:
    min_energy = energy
print(min_energy)


### FIXED CODE ###

n = int(input())
x = list(map(int,input().split()))
m_energy = 250000
for i in range(1,101):
  energy = 0
  for k in range(n):
    energy += (x[k]-i)**2
  if energy < m_energy:
    m_energy = energy
print(m_energy)
import math
a,b,h,m = map(int,input().split())
print(a**2+b**2-2*a*b*math.cos(math.radians(h*30 - m*5.5)))**0.5

### FIXED CODE ###

import math
a,b,h,m = map(int,input().split())

print((a**2+b**2-(2*a*b*math.cos(math.radians(h*30 - m*5.5))))**0.5)
N=int(input())
a=[0]*N
b=['z']*N
for i in range(N):
  a[i]=float(input().split())
  b[i]=input().split()
total=0
for j in range(N):
  if b[j]='JPY':
    total = total+ a[j]
  else:
    total = total+380000.0*a[j]
print(total)


### FIXED CODE ###

N=int(input())
a=[]
b=[]
for i in range(N):
  x,y=input().split()
  a.append(float(x))
  b.append(y)
total=0
for j in range(N):
  if b[j]=='JPY':
    total += a[j]
  else:
    total += 380000.0*a[j]
print(total)
import sys
sys.setrecursionlimit(10**6)
n,m=map(int,input().split())
a=[[]for i in range(n+m)]
for i in range(n):
    s=list(map(int,input().split()))
    for j in s[1:]:
        a[i].append(j)
        a[n+j].append(i)
t=[False]*n
def g(x):
    if not t[x]:
        t[x]=False:
            for i in a[x]:
                for j in a[i+n]:
                    g(j)
g(0)
if all(t):
    print("YES")
else:
    print("NO")

### FIXED CODE ###

import sys
sys.setrecursionlimit(10**9)
n,m=map(int,input().split())
a=[[]for i in range(n+m)]
for i in range(n):
    s=list(map(int,input().split()))
    for j in s[1:]:
        a[i].append(j+n-1)
        a[n+j-1].append(i)
t=[False]*(n+m)
def g(x):
    t[x]=True
    for i in a[x]:
            if not t[i]:
                g(i)
g(0)
if all(t[:n]):
    print("YES")
else:
    print("NO")
n = input()
if int(n) % sum(list(map(int, n))) == 0:
	print("Yes")
else:
	print("No")

### FIXED CODE ###

n, a, b = map(int, input().split())
print(min(a * n, b))
a = input()

print(a**2)

### FIXED CODE ###

a = int(input())

print(a**2)
s = input()
K = int(input())

ans = []
flg = False
for i in range(len(s)):
  for j in range(len(s)-i):
    c = s[j:j+i+1]
    if (len(c) > K):
      flg = True
      break
    if (i != 0 and c.count(c[0]) == len(c)):
      c = "".join(set(c))
    ans.append(c)
  if flg:
    break
  
set_ans = list(set(ans))
set_ans.sort()
print(set_ans[K-1])


### FIXED CODE ###

s = input()
K = int(input())
S = set()
ans = []
for i in range(K):
  for j in range(len(s)-i):
    c = s[j:j+i+1]
    S.add(c)
  
set_ans = sorted(list(S))
print(set_ans[K-1])
alpha = [chr(ord('a') + i) for i in range(26)]
s = [str(i) for i in input()]

ss = set(alpha) - set(s)
ans = list(ss)
ans = sorted(ans)
print(ans[0])

### FIXED CODE ###

alpha = [chr(ord('a') + i) for i in range(26)]
s = [str(i) for i in input()]

ss = set(alpha) - set(s)
ans = list(ss)
ans = sorted(ans)
if ans == []:
    print("None")
else:
    print(ans[0])
import sys
input = sys.stdin.readline
from operator import itemgetter
sys.setrecursionlimit(10000000)
from collections import Counter

def main():
    n = int(input().strip())
    p = []
    for i in range(n):
        x, y = map(int, input().strip().split())
        p.append((x, y))
    vtable = [0] * n**2
    for i in range(n):
        for j in range(n):
            vtable[i * n + j] = (p[i][0] - p[j][0], p[i][1] - p[j][1])
    c = sorted(Counter(vtable).values(), reverse=True)
    print(n - c[1])


if __name__ == '__main__':
    main()


### FIXED CODE ###

import sys
input = sys.stdin.readline
from operator import itemgetter
sys.setrecursionlimit(10000000)
from collections import Counter

def main():
    n = int(input().strip())
    p = []
    for i in range(n):
        x, y = map(int, input().strip().split())
        p.append((x, y))
    vtable = [0] * n**2
    for i in range(n):
        for j in range(n):
            vtable[i * n + j] = (p[i][0] - p[j][0], p[i][1] - p[j][1])
    c = sorted(Counter(vtable).values(), reverse=True)
    if len(c) == 1:
        print(1)
    else:
        print(n - c[1])


if __name__ == '__main__':
    main()
n,y = map(int,(input()))
x,y,z = map(int,"-1"*3)
for i in range(n+1):
    for j in range(n+1):
        z=y-i*10000-j*5000
        if z==(n-i-j):
            x=i
            y=j
            z=n-i-j
print(x,y,z)


### FIXED CODE ###

n,Y = map(int,(input().split()))
x = 0
y = 0
z = 0
f = True
for i in range(n+1):
    for j in range(n+1):
        k=Y-i*10000-j*5000
        if k==(n-i-j)*1000 and k>=0:
            x=i
            y=j
            z=int(k/1000)
            f=False
if f :
    x = -1
    y = -1
    z = -1
print(x,y,z)
r = int(input())
print(2*pi*r)

### FIXED CODE ###

import math
r = int(input())
print(math.pi*2*r)
import numpy as np
import math

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

sum_dif =  sum(B) - sum(A)

if sum_dif < 0:
    print("No")
elif sum_dif == 0:
    if A == B:
        print("Yes")
    else:
        print("No")
else:
    difference = list(np.array(A) - np.array(B))
    man_required_A = sum([math.ceil(- a/2) for a in difference if a < 0])
    man_required_B = sum([b for b in difference if b > 0])
    
    admissible_A = sum_dif - man_required_A - man_required_B
    
    if admissible > 0:
        print("Yes")
    else:
        print("No")

### FIXED CODE ###

import math

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

total_manipulation =  sum(B) - sum(A)

manipulation_A = 0
manipulation_B = 0

for i in range(N):
    if A[i] < B[i]:
        manipulation_A += math.ceil((B[i] - A[i]) / 2)
        manipulation_B += (B[i] - A[i]) % 2
    elif A[i] > B[i]:
        manipulation_B += A[i] - B[i]

if total_manipulation - max(manipulation_A, manipulation_B) >= 0:
    print("Yes")
else:
    print("No")
import functools
import math

n, x = map(int, input().split())
l = map(int, input().split())

l2 = map(lambda t: t-x, l)

gcd = functools.reduce(math.gcd, l2)
print(gcd)



### FIXED CODE ###

def gratest_common_factor(x,y):
    while y:
        amari = x % y

        x = y
        y = amari
    return x


n, x = map(int, input().split())
l = map(int, input().split())

l2 = list(map(lambda t: t-x, l))

for i in range(n-1):
    l2[1] = gratest_common_factor(l2[0],l2[1])
    del l2[0]

print(abs(l2[0]))
O = input()
E = input()
N = len(O)
ans = ''
for i in range(N):
    ans += O[i] + E[i]
print(ans)

### FIXED CODE ###

O = input()
E = input()
N = len(E)
ans = ''
for i in range(N):
    ans += O[i] + E[i]
if len(O)-len(E) == 1:
    ans += O[-1]
print(ans)
from math import factorial
#a = factorial(n) / factorial(r) / factorial(n - r)

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

def cf(x1,x2):
    cf=[]
    cf.append(1)
    for i in range(2,min(x1,x2)+1):
        if x1 % i == 0 and x2 % i == 0:
            cf.append(i)
    return cf
  
  
C=cf(A, B)
for i in range(len(C)-1):
  for j in range(i+1, len(C)):
    if len(cf(C[i], C[j]))!=1:
      C.remove(C[j])
n=len(C)
if n==1:
  print(1)
else:
  
  print(int(factorial(n) / factorial(2) / factorial(n - 2)))

### FIXED CODE ###

from fractions import gcd
A, B=map(int, input().split())
def make_divisors(n):
  divisors = []
  for i in range(1, int(n**0.5)+1):
    if n % i == 0:
      divisors.append(i)
      if i != n // i:
        divisors.append(n//i)

  # divisors.sort()
  return divisors

import math

def is_prime(n):
  if n == 1: return False

  for k in range(2, int(math.sqrt(n)) + 1):
    if n % k == 0:
      return False

  return True
ans=0
for x in set(make_divisors(A))&set(make_divisors(B)):
  if is_prime(x):
    ans+=1

#print(set(make_divisors(A))&set(make_divisors(B)))
print(ans+1)
a,op,b = map(str, input().split())
if op == '+':
    result = a + b
else op == '-':
    result = a - b 
    
print("{}".format(result))


### FIXED CODE ###

a,op,b = map(str, input().split())
a = int(a)
b = int(b)
if op == '+':
    result = a + b
elif op == '-':
    result = a - b

print("{}".format(result))
N,M = list(map(int,input().split()))
SC = [0]*(M+1)
for m in range(M):
  sc = list(map(int,input().split()))
  if (sc[0] == 1) and (sc[1] == 0):
    print(-1)
    exit()
  if sc[0] > N:
    print(-1)
    exit()
  if SC[sc[0]] == 0:
    SC[sc[0]] = sc[1]
  else:
    if SC[sc[0]] != sc[1]:
      print(-1)
      exit()


if SC[1]==0:
  SC[1] = 1
ans = 0
for i in range(N):
  ans += 10**(N-i-1)*SC[i+1]

print(ans)


### FIXED CODE ###

N,M = list(map(int,input().split()))
SC = [0]*(N+1)
if M == 0:
  if N==1:
    print(0)
    exit()
  else:
    print(1*10**(N-1))
    exit()

for m in range(M):
  sc = list(map(int,input().split()))
  if (sc[0] == 1) and (sc[1] == 0):
    if N==1:
      continue
    else:
      print(-1)
      exit()
  elif sc[0] > N:
    print(-1)
    exit()
  elif SC[sc[0]] == 0:
    SC[sc[0]] = sc[1]
  else:
    if SC[sc[0]] != sc[1]:
      print(-1)
      exit()

if (SC[1]==0) and (N > 1):
  SC[1] = 1
ans = 0
for i in range(N):
  ans += 10**(N-i-1)*SC[i+1]

print(ans)
import math

N = int(input())
S_lists = [input() for i in range(N)]

S_dict = {}

for S in S_lists:
    S_list = list(S)
    S_list.sort()

    S_str = "".join(S_list)
    if S_str in S_dict.keys():
        S_dict[S_str] = S_dict[S_str] + 1
    else:
        S_dict[S_str] = 1

answer = 0
for v in S_dict.values():
    if v > 1:
        answer += int(math.factorial(v) / 2)

print(answer)


### FIXED CODE ###

N = int(input())
S_lists = [input() for i in range(N)]

S_dict = {}

for S in S_lists:
    S_list = list(S)
    S_list.sort()

    S_str = "".join(S_list)
    if S_str in S_dict.keys():
        S_dict[S_str] = S_dict[S_str] + 1
    else:
        S_dict[S_str] = 1

answer = 0
for v in S_dict.values():
    if v > 1:
        answer += int(v * (v - 1) / 2)

print(answer)
def main():
    n,x = map(int, input().split())
    num_list = list(map(int, input().split()))

    count = 0
    sum = 0

    while(sum <= x):
        sum += num_list[count]
        count += 1

    print(count)

if __name__ == '__main__':
    main()

### FIXED CODE ###

def main():
    n,x = map(int, input().split())
    num_list = list(map(int, input().split()))

    sum = 0
    ans = 1

    for i in num_list:
        sum += i
        if sum <= x:
            ans += 1

    print(ans)

if __name__ == '__main__':
    main()
N=int(input())
T,A=list(map(lambda x:float(A),input().split()))
H_list = list(map(lambda x:float(A),input().split()))
diff = [abs(T-x*0.006-A) for x in H_list]
i=diff.index(min(diff))
print(i+1)

### FIXED CODE ###

N=int(input())
T,A=list(map(lambda x:float(x),input().split()))
H_list = list(map(lambda x:float(x),input().split()))
diff = [abs(T-x*0.006-A) for x in H_list]
i=diff.index(min(diff))
print(i+1)