peterverebics/CodeNet_Python_428 huggingface dataset:
# Judge status: Accepted
a,b = map(int,input().split())
if a in range(10) and b in range(10):
     print(a*b)
else:
     print(-1)
# Judge status: Wrong Answer
import collections
n, p = list(map(int, input().split()))
a = list(map(int, input().split()))
a2 = [ai%2 for ai in a]
a2 = collections.Counter(a2)

if p == 0:
  if a2[1] == 0:
    print(2 ** n)
  else:
    print(2 ** (n - 1))
    
else:
  print(2 ** (n-1))
# Judge status: Accepted
A,B=map(int,input().split())
count=0
for C in range(A,B+1):
    s=str(C)
    res=True
    for i in range(len(s)//2):
        if s[i]!=s[-1-i]:
            res=False
            break

    if res:
        count+=1

print(count)
# Judge status: Accepted
a,b=map(int,input().split())
ans=0
c=1
while(c<b):
    c+=a-1
    ans+=1
print(ans)
# Judge status: Accepted
n,m = map(int,input().split())
if 2*n >= m:
    print(m//2)
else:
    pair = 0
    m -= 2*n
    pair += n
    pair += (m//4)
    print(pair)
# Judge status: Wrong Answer
x = int(input())

print(1 if x % 100 <= x / 100 * 5 else 0)
# Judge status: Wrong Answer
r, g, b = map(int, input().split())

K = int(input())

while K > 0:
  if g < r:
    g *= 2
    K -= 1
  elif b < g:
    b *= 2
    K -= 1
  else:
    break
    




if g > r and b > g:
  print("Yes")
else:
  print("No")
# Judge status: Accepted
n, m = map(int, input().split())
if abs(n-m) > 1:
    print(0)
    exit()

mod = 10**9 + 7
ans = 1
for i in range(1, n+1):
    ans *= i
    ans %= mod

for j in range(1, m+1):
    ans *= j
    ans %= mod

if n == m:
    ans *= 2
    ans %= mod

print(ans)
# Judge status: Accepted
n = int(input())
A = sorted(map(int, input().split()), reverse=True)
ans = 0
mod = 10 ** 9 + 7
m=A[0]
for i in range(61):
    cnt0 = cnt1 = 0
    if m < 2 ** i:
        break
    for j, a in enumerate(A):
        if a < 2 ** i:
            cnt0 += n - j
            break
        if (a >> i) & 1:
            cnt1 += 1
        else:
            cnt0 += 1
    ans += (((2 ** i) % mod) * ((cnt1 * cnt0) % mod)) % mod
    ans %= mod

print(ans)
# Judge status: Accepted
n, m = map(int, input().split())

road = []
for i in range(m):
   tmp = [int(x) for x in input().split()]
   road.extend(tmp)

for i in range(1, n+1):
   print(road.count(i))
# Judge status: Wrong Answer
N,M,X,Y = map(int,input().split())
x = list(map(int,input().split()))
y = list(map(int,input().split()))
if max(x) < min(y) and min(y) >= M and min(y) > N:
	print("No War")
else:
	print("War")
# Judge status: Accepted
from __future__ import print_function
import sys


if sys.subversion[0] == "PyPy":
    import io, atexit

    sys.stdout = io.BytesIO()
    atexit.register(lambda: sys.__stdout__.write(sys.stdout.getvalue()))

    sys.stdin = io.BytesIO(sys.stdin.read())
    input = lambda: sys.stdin.readline().rstrip()
RS = raw_input
RA = lambda x=int: map(x, RS().split())
RN = lambda x=int: x(RS())


def solve():
    ans = 0
    for i in range(l, r+1):
        if i % d == 0:
            ans += 1
    print(ans)
    return





l, r, d = RA()
solve()
# Judge status: Accepted
N = int(input())
ans = 0
for i in range(1, N + 1):
    b = N // i
    ans += i * b * (b + 1) // 2
print(ans)
# Judge status: Wrong Answer
a, b = map(int, input().split())
print(a + b /2)
# Judge status: Wrong Answer
N=int(input())
d=[input().split() for i in range(N)]
name=[]
for i in range(N):
    d[i].append(i+1)
    name.append(d[i][0])
Name=list(set(name))
Name.sort()
d.sort()
for i in range(len(Name)):
    li=[]
    for j in range(N):
        if Name[i]==d[j][0]:
            li.append([d[j][1],d[j][2]])
    li.sort()
    Li=li[::-1]
    for j in range(len(li)):
        print(Li[j][1])
# Judge status: Wrong Answer
a,b,c = input().split()
print(c,b,a)
# Judge status: Accepted
S = input()

answer = 'Good'
for i in range(len(S)-1):
  if S[i] == S[i+1]:
    answer = 'Bad'

print(answer)
# Judge status: Accepted
import math
def ModFact(N,Mod):
    Num = 1
    for T in range(2,N+1):
        Num = (Num*T)%Mod
    return Num
  
N,M = (int(T) for T in input().split())
Mod = 10**9+7
if N==M:
    print((2*ModFact(N,Mod)*ModFact(M,Mod))%Mod)
elif N==M+1 or M==N+1:
    print((ModFact(N,Mod)*ModFact(M,Mod))%Mod)
else:
    print(0)
# Judge status: Accepted
N,M=map(int, input().split())
A=[input() for i in range(N)]
B=[input() for i in range(M)]
a=0
for i in range(N-M+1):
    for j in range(N-M+1):
        for k in range(M):
            if A[j+k][i:i+M]!=B[k]:
                break
        else:
            a=1
print("Yes" if a else "No")
# Judge status: Wrong Answer
from fractions import *
n,*a=map(int,open(0).read().split())
l=[0]+[a[0]]*(n-1)
r=[a[-1]]*(n-1)+[0]
ans=0
for i in range(2,n):
  l[i]=gcd(l[i-1],a[i])
for i in range(n-3,-1,-1):
  print(r[i+1],a[i+1])
  r[i]=gcd(r[i+1],a[i+1])
for i in range(n):
  ans=max([0,l[i],r[i],gcd(l[i],r[i])][(l[i]>0)+2*(r[i]>0)],ans)
print(ans)
# Judge status: Accepted
N,M = map(int,input().split())
a = list()
b = list()
for i in range(M):
  tmp_a,tmp_b =  map(int, input().split())
  a.append(tmp_a)
  b.append(tmp_b)
print(min(b)-max(a)+1 if min(b)-max(a) >= 0 else 0)
# Judge status: Accepted
x,y,z = map(int, input().split())

print(z,x,y)
# Judge status: Accepted
N, M = map(int,input().split())
ans = min(N,M//2)
N -= ans
M -= ans*2
if M >= 2:
    ans += M//4
print(ans)
# Judge status: Accepted
num = list(map(int,input().split()))
a=0
b=0
for i in range(3):
	if num[i]==5:
		a+=1
	if num[i]==7:
		b+=1
if a==2 and b==1:
	print("YES")
else:
	print("NO")
# Judge status: Wrong Answer
n = int(input())
p = list(map(int, input().split()))
cnt = 0
for i in range(n):
  if i==0:
    cnt+=1
  else:
    if p[i]<=p[i-1]:
      cnt+=1
print(cnt)
# Judge status: Accepted
from bisect import bisect, bisect_left


def bin_search(n):

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

    a.sort()
    c.sort()

    ans = 0

    for i in range(n):
        upper_b = bisect_left(a, b[i])
        under_b = n - bisect(c, b[i])
        ans += upper_b * under_b
    return ans


if __name__ == '__main__':
    n = int(input())
    print(bin_search(n))
# Judge status: Wrong Answer
x = int(input())
if x >= 30:
    print('YES')
else:
    print('NO')
# Judge status: Accepted
#B - Judge Status Summary
N = int(input())
s =list(input() for i in range(N))
DP = [0]*4
for j in range(N):
    if s[j] == "AC":
        DP[0] += 1
    elif s[j] == "WA":
        DP[1] += 1
    elif s[j] == "TLE":
        DP[2] += 1
    else:
        DP[3] += 1

print("AC x",DP[0])
print("WA x",DP[1])
print("TLE x",DP[2])
print("RE x",DP[3])
# Judge status: Wrong Answer
a, b = map(int, input().split())
print(0 if a <= 0 <= b else "Negative" if a != b and b < 0 and (-1) ** ((b - a + 1) % 2) < 0 else "Positive")
# Judge status: Wrong Answer
N = int(input())
sp_list = list(map(int, input().split()))
stock = 0
money = 1000
for i in range(N-1):
    p_today = sp_list[i]
    p_tomorrow = sp_list[i+1]
    if p_tomorrow > p_today:
        stock = money // p_today
        money = money % p_today
    if p_tomorrow < p_today:
        money += p_today * stock
        stock = 0

money += sp_list[N-1] * stock

print(money)
# Judge status: Accepted
s=input()
a=s.count('a')
b=s.count('b')
c=s.count('c')
print("YES" if max(a,b,c)-min(a,b,c)<= 1 else "NO")
# Judge status: Wrong Answer
N = int(input())
ans = 1
cnt = 0
an = 0
for i in range(N+1 // 2):
    if N >= 2:
        ans *= N
        N -= 2
    else:
        break

ans = str(ans)
for i in range(len(ans)):
    if ans[i] == "0":
        cnt += 1
    else:
        if an < cnt:
            an = cnt
        cnt = 0
print (an)
# Judge status: Wrong Answer
N=int(input())
D=list(map(int,input().split()))
cnt=0
for i in range(1,N+1):
    c=[]
    for d in D:
        if d>=i:
            c.append(d)
    if len(c)==N//2:
        cnt+=1
print(cnt)
# Judge status: Accepted
S=input()
c0=0
c1=0
for i in range(len(S)):
  if i%2==0:
    if S[i]=='0':
      c0+=1
  else:
    if S[i]=='1':
      c0+=1
for i in range(len(S)):
  if i%2==0:
    if S[i]=='1':
      c1+=1
  else:
    if S[i]=='0':
      c1+=1
print(min(c0,c1))
# Judge status: Accepted
import math
 
S = []
L = []
for i in range(5):
    D = int(input())
    T = math.ceil(D/10)
    S.append(T)
    L.append(T-D/10)
    
print(int((sum(S) - max(L))*10))
# Judge status: Wrong Answer
import math
MOD = 10**9+7
n, m = map(int, input().split())

if n == m:
    print( (2 * (math.factorial(n)%MOD)**2) % MOD)
if abs(n-m) == 1:
    print((max(n, m)*(math.factorial(min(n, m))%MOD)**2) % MOD)
else:
    print(0)
# Judge status: Wrong Answer
n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
c = list(map(int, input().split()))
ans = 0
tem = n

for i in a:
    i-=1
    ans += b[i]
    if i == tem + 1:
        ans += c[tem]
        tem = i
print(ans)
# Judge status: Wrong Answer
N,A,B=map(int,input().split())
if A>B:
  print(0)
if N==1 and A!=B:
  print(0)
else:
  print((N-2)*(B-A)+1)
# Judge status: Accepted
S = input()

cnt = 0
i = 1

while i < len(S):
  if S[i] == S[i-1]:
    cnt += 1
    i += 2
  i += 1

print(len(S)-cnt)
# Judge status: Wrong Answer
# -*- coding: utf-8 -*-


def main():
    n, m = map(int, input().split())
    inf = float('inf')
    number = [inf] * n

    for i in range(m):
        si, ci = map(int, input().split())
        si -= 1

        number[si] = min(number[si], ci)

    for index, num in enumerate(number):
        if num == inf:
            number[index] = 0

    candidate = ''.join(map(str, number))

    if len(str(int(candidate))) == len(candidate):
        print(candidate)
    else:
        print(-1)


if __name__ == '__main__':
    main()
# Judge status: Accepted
N = int(input())
A = list(map(int, input().split()))
print(len([a for a in A[::2] if a%2==1]))
# Judge status: Wrong Answer
N, A, B = map(int, input().split())
S = input()
 
ok_count = 0
ok_fcount = 0
for i in range(N):
  if S[i] == 'a':
    if ok_count < A+B-1:
      print('Yes')
      ok_count +=1
      
    else:
      print('No')
      
  elif S[i] == 'b':
    if ok_count < A+B-1 and ok_fcount <= B-1:
      print('Yes')
      ok_count+=1
      ok_fcount+=1
      
    else:
      print('No')
      
  else:
    print('No')
# Judge status: Wrong Answer
n = int(input())

A = [0]*n
ans = 0
for i in range(n):
    a = int(input())
    ans += a//2
    A[i] = a%2

#print(A)

for i in range(n-1):
    if A[i] == 1 and A[i+1] == 1:
        ans += 1
        A[i] = 0
        A[i+1] = 0
        
print(ans)
# Judge status: Accepted
from collections import Counter
S = input()[::-1]
cur = 0
mods = Counter()
mods[0] += 1
MOD = 2019
for i,d in enumerate(S):
  cur += int(d) * pow(10, i, MOD)
  mods[cur%MOD] += 1

res = 0
for k,v in mods.items():
  res += (v * (v-1) // 2)

print(res)
# Judge status: Accepted
import sys
sys.setrecursionlimit(10 ** 5 + 10)
def input(): return sys.stdin.readline().strip()

def resolve():

    N=int(input())
    i=1
    while i<=N:
        i*=2
    print(i//2)

resolve()
# Judge status: Wrong Answer
from math import factorial
n,m=map(int,input().split())
if abs(n-m)>2:
  print(0)
elif n==m:
  print(2*factorial(n)*factorial(m))
elif abs(n-m)==1:
  print(factorial(n)*factorial(m))
# Judge status: Accepted
N = int(input())

List=list(map(int,input().split()))
cnt = 0
for i in range(len(List)):
  if List[i] < 0:
    List[i] = int(-List[i])
    cnt +=1
    
if cnt % 2 == 0:
  print(int(sum(List)))
else:
  a = int(min(List))
  b = int(sum(List))
  print(int(b-a*2))
# Judge status: Wrong Answer
n,m=map(int,input().split())
a=[list(map(int,input().split())) for a in range(n)]
c=[list(map(int,input().split())) for b in range(m)]
dist=0
min=10*12
minnum=-1
for indi,i in enumerate(a):
    dist=0
    min=10*12
    for indj,j in enumerate(c):
        dist+=abs(i[0]-j[0])
        dist+=abs(i[1]-j[1])
        if min>dist:
            min=dist
            minnum=indj
        dist=0
    
    print(minnum+1)
# Judge status: Wrong Answer
N = int(input())
a = list(map(int,input().split()))

a.sort()

ans = 10**9+1
for i in range(1,N):
    min_a = abs(sum(a[:i]) - sum(a[i:]))
    if ans > min_a:
        ans = min_a

print(ans)
# Judge status: Accepted
n, k = map(int, input().split())
p = list(map(int, input().split()))

cnt = 0
for i in range(n):
    if i <= k - 1:
        cnt += p[i]
        tmp = cnt
        end = i + 1
    else:
        cnt = cnt - p[i - k] + p[i]
        if cnt >= tmp:
            tmp = cnt
            end = i + 1

ans = 0
L = p[end - k: end]
for i in L:
    ans += sum(range(1, i + 1)) / i

print(ans)
# Judge status: Accepted
import sys
input = sys.stdin.readline

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

    come = [None] * N

    for i, x in enumerate(A):
        come[x - 1] = (i + 1)

    print(*come)


if __name__ == "__main__":
    main()
# Judge status: Wrong Answer
n = int(input())
a = []
for _ in range(2):
    a.append(list(map(int, input().split(" "))))

res = 0
for i in range(n):
    res += a[0][i]

    if i + 1 == n:
        res += a[1][i]
        break

    sum_row_1 = sum(a[0][i + 1:n])
    sum_row_2 = sum(a[1][i + 1:n])
    if sum_row_1 <= sum_row_2 and max(a[1][i:n]) == a[1][i]:
        res += sum(a[1][i:n])
        break

print(res)
# Judge status: Accepted
from itertools import accumulate


def GCD(x, y):
    if y == 0:
        return x
    return GCD(y, x % y)


N, X = map(int, input().split())
A = [abs(X - a) for a in map(int, input().split())]
ans = list(accumulate(A, func=GCD))[-1]
print(ans)
# Judge status: Accepted
n = int(input())
a = list(map(int, input().split()))
import collections
a = collections.Counter(a)
ans = 0
for i,j in a.items():
    if i>j:
        ans += j
    else:
        ans += abs(i-j)
print(ans)
# Judge status: Accepted
N = int(input())
dp = [[0 for i in range(3)]for j in range(N+1)]
a = []
for i in range(N):
    a.append(list(map(int,input().split())))
for i in range(N):
    for j in range (3):
        for k in range(3):
            if j !=k:
                dp[i+1][k] = max(dp[i+1][k],(dp[i][j]+a[i][k]))
print(max(dp[-1][0],dp[-1][1],dp[-1][2]))
# Judge status: Accepted
X, Y = map(int, input().split())

mod = 10 ** 9 + 7


def choose(n, r):
    x = 1
    y = 1
    for i in range(min(r, n - r)):
        x = x * (n - i) % mod
        y = y * (i + 1) % mod
    y = pow(y, mod - 2, mod)
    return (x * y) % mod


ans = 0

if (X + Y) % 3 == 0:
    n = (2 * Y - X) // 3
    m = (2 * X - Y) // 3
    if min(n, m) >= 0:
        ans = choose(n + m, n)


print(ans)
# Judge status: Accepted
import math


N, *ABCDE = map(int, open(0).read().split())
bottle_neck = min(ABCDE)
print(math.ceil(N/bottle_neck) + 4)
# Judge status: Accepted
# Problem B - Exactly N points(Code Festival)

# input
N = int(input())

# initialization
ans_list = []
check_sum = 0

# count
for i in range(1, N+1):
    check_sum += i
    ans_list.append(i)
    if check_sum>=N:
        tmp_sum = sum(ans_list)
        remove_num = check_sum - N
        if remove_num in ans_list:
            ans_list.remove(remove_num)
        break

# output
for a in ans_list:
    print(a)
# Judge status: Accepted
# -*- coding: utf-8 -*-
n, k = map(int, input().split())
a = list(map(lambda x: int(x) - 1, input().split()))

passed = [-1 for _ in range(n)]

cnt = 0
now = 0
_next = a[now]
remain = 0
for i in range(k):
    _next = a[now]
    if passed[_next] != -1:
        pre = passed[_next]
        remain = (k-pre) % (cnt + 1 - pre)
        now = _next
        break
    passed[now] = cnt
    now = _next
    cnt += 1

for _ in range(remain):
    now = a[now]

print(now + 1)
# Judge status: Accepted
import math
n = int(input())
res = 0
for i in range(1,n+1):
    keta = int(math.log10(i))+1
    if(keta % 2 == 1):
        res += 1
print(res)
# Judge status: Accepted
N=int(input())
p=list(map(int,input().split()))

count=0
flag=0
for i in range(N):
  if flag:
    flag=0
    continue
  if p[i]==i+1:
    count += 1
    if i < N-1 and p[i+1]==i+2:flag=1
      
print(count)
# Judge status: Accepted
N = int(input())
A = list(map(int, input().split()))

m_ = min(A)

flag = True

#m_ = m
while True:
    m = m_
    flag = True
    for a in A:
        n = a % m
        if n > 0:
            flag = False
            m_ = min(m_, n)
    if m_ == m:
        break
    if flag:
        break

print(m_)
# Judge status: Accepted
N, = map(int, input().split())
tt, aa, bb = 0, 0, 0
for i in range(N):
    t, a, b = map(int, input().split())
    if abs(a-aa) + abs(b-bb) > t - tt or (abs(a-aa) + abs(b-bb) + t - tt) % 2 != 0:
        print("No")
        break
    tt, aa, bb = t, a, b
else:
    print("Yes")
# Judge status: Wrong Answer
import sys

S = input()
T = input()

for i in range(len(S)):
  s = S[i:] + S[:i]
  if S == T:
    print('Yes')
    sys.exit()
    
print('No')
# Judge status: Accepted
S = input()
K = int(input())


char_sum = 0

for letter in S:
    n = int(letter)
    let_power = 1 if (n == 1) else float('inf')
    if (char_sum + let_power) >= K:
        print(letter)
        break
    else:
        char_sum += let_power
# Judge status: Wrong Answer
n = int(input())
list_n_ans = []
ans = []

if n % 2 == 0:
    x = n / 2
    while x > 4:
        ans.append(int(x/5))
        x = int(x/5)

print(sum(ans))
# Judge status: Accepted
X = input()

S_cnt = 0
T_cnt = 0
for i in range(len(X)):
    if X[i] == 'S':
        S_cnt += 1
    else:
        if S_cnt > 0:
            S_cnt -= 1
        else:
            T_cnt += 1

print(S_cnt+T_cnt)
# Judge status: Wrong Answer
x1, x2, x3, x4, x5 = map(int, input().split())

l = [x1, x2, x3, x4, x5]
ls = [str(n) for n in l]
s = ''.join(ls).find('0')
print(s)
# Judge status: Wrong Answer
b = input()
if b == 'A':
    print('T')
elif b == 'C':
    print('G')
elif b == 'G':
    print('C')
else:
    print('A')
# Judge status: Accepted
x = int(input())

a = x-x//100*100
print(1) if a//5 + (a%5!=0) <= x//100 else print(0)
# Judge status: Wrong Answer
import numpy as np
def main():
    N,W=map(int,input().split())
    dp=np.zeros((N+1,W+1),dtype=int)
    for i in range(1,N+1):
        w,v=map(int,input().split())
        dp[i][w:]=np.maximum(dp[i-1][w:],dp[i-1][:-w]+v)
        dp[i][:w]=dp[i-1][:w]
    print(dp)
main()
# Judge status: Accepted
a, b, c = map(int, raw_input().split())
k = input()

print a + b + c - max(a,b,c) + max(a,b,c) * 2 ** k
# Judge status: Accepted
N = int(input())
B = tuple(map(int, input().split()))
assert len(B) == N - 1

count = B[0] + B[-1]
for b1,b2 in zip(B, B[1:]):
  count += min(b1, b2)
print(count)
# Judge status: Accepted
import sys
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines

def main():
    N = int(readline())
    X = [int(i) for i in readline().split()]

    m = sum(X) / N
    m = round(m)

    ans = 0
    for i in X:
        ans += (i - m)**2
    
    print(ans)


if __name__ == "__main__":
    main()
# Judge status: Accepted
def resolve():
    N = int(input())
    s = [input() for _ in range(N)]
    ans = 0
    chk = {}
    for tmp in s:
        d1 = "".join(sorted(list(tmp)))
        if d1 in chk.keys():
            ans += chk[d1]
            chk[d1] += 1
        else:
            chk[d1] = 1
    print(ans)


resolve()
# Judge status: Accepted
import math
n, d = map(int, input().split())
xy = [map(int, input().split()) for _ in range(n)]
x, y = [list(i) for i in zip(*xy)]

count = 0

for i in range(n):
    if math.sqrt((x[i] * x[i] + y[i] * y[i])) <= d:
        count += 1

print(count)
# Judge status: Wrong Answer
H, A = map(int, input().split())

if H % A == 0:
  print(H / A)
  
elif H % A != 0:
  print(H / A +1)
# Judge status: Accepted
x, y, z = map(int, input().split())
cnt = 0
while x >= 0:
    x -= z
    if x >= y+z:
        x -= y
        cnt += 1

print(cnt)
# Judge status: Wrong Answer
import sys

W, H, x, y = map(int, input().split())

HW = H * W
S1 = min(x * H, HW - x * H)
S2 = min(W * y, HW - W * y)
S = max(S1, S2)

ans2 = S1 == S2

if (x, y) in [(0, 0), (W, 0), (0, H), (W, H)]:
    print(H * W / 2, 0)
    sys.exit()

print(S, int(ans2))
# Judge status: Accepted
ans = []
flag = True
for i in range(3):
    ans.append(list(map(int,input().split())))
for i in range(2):
    diff1 = ans[i][0]-ans[i+1][0]
    diff2 = ans[i][1]-ans[i+1][1]
    diff3 = ans[i][2]-ans[i+1][2]
    if diff1!=diff2 or diff2!=diff2 or diff3!=diff1:
        flag = False
        break
if flag:
    print('Yes')
else:
    print('No')
# Judge status: Wrong Answer
x = int(input())

print(360 // x)
# Judge status: Wrong Answer
X = int(input())

flag = False
for i in range(1,20,1):
  if not (X in range(100*i,105*i +1)) == False:
    print("1")
    
    flag = True
    break

if flag ==False:
  print("0")
# Judge status: Accepted
n,x=map(int,input().split())
a=list(map(int,input().split()))
a.sort()
num=0
for i in range(n):
  num+=a[i]
  if num>x:
    print(i)
    exit()
if num==x:
  print(n)
else:
  print(n-1)
# Judge status: Accepted
l = list(map(int, input().split()))
C = l[2]
l.sort()

if l[1] == C:
    print('Yes')
else:
    print('No')
# Judge status: Wrong Answer
s = input()
def is_kaibun(kaibun):
    for i in range(len(kaibun)//2):
        if kaibun[i] != kaibun[-i-1]:
            return False
    return True
for i in range(len(s)):
    if is_kaibun(s):
        print(i)
# Judge status: Accepted
N = int(input())
P = list(map(int,input().split()))

P_sorted = sorted(P)
ans = 0
for i in range(N):
  if P[i] != P_sorted[i]:
    ans += 1

if ans <= 2:
  print("YES")
else:
  print("NO")
# Judge status: Accepted
h, n = map(int, input().split())
magics = [list(map(int, input().split())) for _ in range(n)]
max_a = max(a for a, b in magics)
dp = [0] * (h + max_a)
for i in range(1, h + max_a):
    dp[i] = min(dp[i - a] + b for a, b in magics)
print(dp[h])
# Judge status: Accepted
N = int(input())
s = 2
while s * (s - 1) / 2 < N:
  s += 1
for i in range(s -1 ):
  if N >= (s - i -1):
    print(s - i-1)
    N -= s - i -1
# Judge status: Accepted
a, b, k = map(int, input().split())
ans = []
for i in range(a, min(a+k, b+1)):
    ans.append(i)
for i in range(b, max(b-k, a-1), -1):
    ans.append(i)
ans = list(set(ans))
ans.sort()
for i in ans:
    print(i)
# Judge status: Wrong Answer
S = int(input())

ans, MOD, N = 0, 1000000007, S // 3

if N == 0:
  print(0)
  exit()

for i in range(1, N+1):
  S -= 3
  ans += i ** S

print(ans % MOD)
# Judge status: Accepted
O = list(input())
E = list(input())
S = []
N1 = len(E)
N2 = len(O)
for i in range(N1):
    S.append(O[i])
    S.append(E[i])
if N1 < N2:
    S.append(O[-1])
print(''.join(S))
# Judge status: Wrong Answer
a = int(input())
if a >= 1000:
  print(a-999)
else:
  print(a)
# Judge status: Accepted
#!/usr/bin/env python3
import collections
import itertools as it
import math
#import numpy as np
 
#  = int(input())
n, a, b, c, d  = map(int, input().split())
a -= 1
b -= 1
c -= 1
d -= 1
s  = input()
#  = list(map(int, input().split()))
#  = [int(input()) for i in range(N)]
#
# c = collections.Counter()

is_rock2 = '##' in s[a:d+1]
is_empty3 = '...' in s[b-1:d+2]

joken = (not is_rock2) and (is_empty3 if c > d else 1)
print('Yes' if joken else 'No')
# Judge status: Accepted
# -*- coding: utf-8 -*-

def main():
    # 入力
    N = int(input())
    nums = list(map(int, input().split()))

    cnt = 0
    while len([x for x in nums if x % 2 == 1]) == 0:
        cnt += 1
        nums = [x/2 for x in nums]

    print(cnt)


main()
# Judge status: Accepted
x, y = map(int, input().split())
print(x + int(y / 2))
# Judge status: Wrong Answer
import math
n=int(input())
l=[int(input()) for i in range(5)]
sum=0
w=n
for i in range(4):
  c=math.ceil((w/l[i]))
  sum+=c
  w=w-w%l[i]-(c-1)*l[i+1]+w%l[i]
  if w==0:
    w=l[i]
print(sum+math.ceil(w/l[4]))
# Judge status: Accepted
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10**8)
INF = float('inf')
MOD = 10**9+7


def main():
  N = int(input())
  S = input()
  ans = 'Yes'
  if N%2==1:
    ans = 'No'
  else:
    L = len(S)//2
    for i in range(L):
      if S[i] != S[L+i]:
        ans = 'No'
        break
  print(ans)
  
  
if __name__ == '__main__':
  main()