peterverebics/CodeNet_Python_428 huggingface dataset:
# Judge status: Accepted
import math

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

ans = A_list[0]
for i in range(N-1):
    ans = math.gcd(A_list[i+1], ans)

print(ans)
# Judge status: Accepted
A, B, T = map(int,input().split())

t = A - T
if t >= 0:
    print(t, B)
elif B+t >= 0:
    print(0, B+t)
else:
    print(0, 0)
# Judge status: Accepted
h,a = map(int,input().split())
print(-(-h // a))
# Judge status: Accepted
from math import sqrt, pow

def get_distance(xi, yi, xj, yj):
  return sqrt(pow(xi - xj, 2) + pow(yi - yj, 2))

def solve():
  n = int(input())
  locations = [list(map(int, input().split())) for _ in range(n)]
  
  distance = 0
  
  for xi, yi in locations:
    for xj, yj in locations:
      distance += get_distance(xi, yi, xj, yj)
  
  return distance / n

print(solve())
# Judge status: Accepted
def main():
    input()
    t = list(map(int, input().split()))
    # if len(t) == 2:
    #     print(abs(t[0] - t[1]))
    #     exit()
    all = sum(t)
    left = t[0]
    right = all - t[0]
    ans = abs(left-right)
    for i in range(1, len(t)-1):
        left += t[i]
        if ans > abs(left-(all-left)):
            ans = abs(left-(all-left))
    print(ans)


if __name__ == '__main__':
    main()
# Judge status: Accepted
n,m = map(int,input().split())
h = list(map(int,input().split()))
ans = [1]*n
for i in range(m):
    a,b = map(int,input().split())
    if h[a-1] > h[b-1]:
        ans[b-1] = 0
    elif h[a-1] == h[b-1]:
        ans[a-1] = ans[b-1] = 0
    else:
        ans[a-1] = 0
print(ans.count(1))
# Judge status: Accepted
def listint():
    a = input().split()
    for i in range(len(a)):
        a[i] = int(a[i])
    return a
def main(n,k):
    z = n % k
    if z > k-z:
        return k-z
    else:
        return z
n,k = listint()
print(main(n,k))
# Judge status: Wrong Answer
N = [int(i) for i in list(input())]

# コーナーケース
if len(N) == 1:
    print(N[0])
    exit()
elif set(N) == set([9]):
    print(len(N) * 9)
    exit()

ans = 0
s = 0
for i in range(len(N)):
    if N[i] == 0:
        continue
    ans = max(ans, s + (N[i] - 1) + 9 * (len(N) - 1 - i))
    s += N[i]

print(ans)
# Judge status: Wrong Answer
x,y,z = map(int,input().split())
width = y + z
print((x-x) // width)
# Judge status: Accepted
a,b = map(int,input().split())

if a <= 0 and b >= 0:
    print('Zero')
    exit()

if a > 0 and b > 0:
    print('Positive')
    exit()

d = b - a
if d % 2 == 0:
    print('Negative')
else:
    print('Positive')
# Judge status: Accepted
n, m, k = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))

a_, b_ = [0], [0]

for i in range(n):
    a_.append(a_[i] + a[i])
for i in range(m):
    b_.append(b_[i] + b[i])

ans, j = 0, m

for i in range(n + 1):
    if a_[i] > k:
        break
    while b_[j] > k - a_[i]:
        j -= 1
    ans = max(ans, i + j)
print(ans)
# Judge status: Wrong Answer
N, T = map(int, input().split())
ct = []
for i in range(N):
    ct.append(list(map(int, input().split())))

ct = sorted(ct, key=lambda h: (h[1], h[0]))

if ct[0][1]<=T:
    print(ct[0][0])
else:
    print('TLE')
# Judge status: Accepted
from collections import Counter

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

c = Counter(a)
s = [(k, v) for k, v in c.items() if v >= 2]

s1 = s2 = 0  # s1 >= s2
for k, v in s:
    if k > s1:
        if v >= 4:
            s1 = s2 = k
        else:
            s1, s2 = k, s1
    elif k > s2:
        s2 = k

print(s1 * s2)
# Judge status: Wrong Answer
N = int(input())

def divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            tmp = []
            tmp.append(i)
            if i != n // i:
                tmp.append(n//i)
            if len(tmp)>1:
                divisors.append(tmp)
    return divisors

L = divisors(N)
ans = float('inf')
for l in L:
    tmp = sum(l) - 2
    ans = min(ans,tmp)
print(ans)
# Judge status: Accepted
n = int(input())
a = [int(i) for i in input().split()]

arr = list(zip(range(1,n+1), a))
arr.sort(key=lambda x: x[1])
print(' '.join([str(i[0]) for i in arr]))
# Judge status: Accepted
n ,k,q = map(int,input().split())
a = [int(input()) for i in range(q)]
point = [k-q]*n
for i in range(q):
    point[a[i]-1] += 1
for j in range(n):
    if point[j] > 0:
        print('Yes')
    else:
        print('No')
# Judge status: Wrong Answer
N,K = list(map(int,input().split()))
A = list(map(int,input().split()))

route = [1]
next = A[0]

while(True):
    if next not in route:
        route.append(next)
        next = A[next-1]
    elif A[0] == next:
        break
    else:
        route = route[route.index(next):]
        break

print( A[K % len(route)])
# Judge status: Accepted
N = int(input())
S = input()

tmp1 = S[:int(N / 2)]
tmp2 = S[int(N / 2):]

if tmp1 == tmp2:
    print("Yes")
else:
    print("No")
# Judge status: Accepted

import collections
n,ais = int(raw_input()), map(int, raw_input().split())
cc = collections.Counter()
for ai in ais:
	if ai % 4 == 0: cc[0] += 1
	elif ai % 2 == 0: cc[1] += 1
	else: cc[2] += 1

q,h = collections.deque([0]), [[2,1,0],[1],[0]] 
while(n):
	b = False
	for u in h[q[-1]] + [-1]:
		if u == -1: b = True
		if cc[u] > 0:
			q.append(u)
			q.popleft()
			cc[u] -=1
			n -=1
			break
	if b: break

print 'Yes' if n == 0 else 'No'
# Judge status: Accepted
import sys
from collections import deque, Counter, defaultdict
from fractions import gcd
input = sys.stdin.readline

def eprint(s):
    sys.stderr.write('DEBUG: {}\n'.format(s))
    return

def main():
    x, y = map(int, input().split())
    cnt = 1
    
    a = x
    while True:
        eprint(a)
        if a*2 > y:
            print(cnt)
            return
        else:
            a *= 2
            cnt += 1

    return

if __name__ == '__main__':
    main()
# Judge status: Accepted
H,N = map(int, input().split())
A = list(map(int, input().split()))

print('No' if sum(A) < H else 'Yes')
# Judge status: Accepted
d=int(input())
c=list(map(int,input().split()))
s=[]
for i in range(d):
    t=list(map(int,input().split()))
    s.append(t)

import random

for i in range(d):
    print(random.randrange(1,27))
# Judge status: Accepted
from sys import stdin

N = int(stdin.readline())

print(((10**N)-2*(9**N)+(8**N))%(10**9 + 7))
# Judge status: Accepted
n, m = map(int, input().split())
mod = 1000000007
fact = [1]
for i in range(max(n, m)):
  fact.append(fact[-1] * (i + 1) % mod)
if n == m:
  print(2 * fact[n] * fact[m] % mod)
elif abs(n - m) == 1:
  print(fact[n] * fact[m] % mod)
else:
  print(0)
# Judge status: Accepted
A, B = map(int, input().split())

ans = abs(A+B)
if ans % 2 == 0:
    print(ans // 2)
else:
    print('IMPOSSIBLE')
# Judge status: Wrong Answer
t=list(input())
if t[-1]=='?':
    t[-1]='D'
for i in range(len(t)-1,0,-1):
    if t[i]=='?':
        if t[i-1]=='D':
            t[i]='P'
        else:
            t[i]='D'
print(''.join(t))
# Judge status: Accepted
a, b = input().split()

a_b = a * int(b)
b_a = b * int(a)

print(b_a) if (a_b > b_a) else print(a_b)
# Judge status: Wrong Answer
import sys
import itertools
sys.setrecursionlimit(1000000000)
from heapq import heapify,heappop,heappush,heappushpop
import math
import collections
MOD = 10**9 + 7
x = int(input())
cnt = 0
if x<=6:
    print(1)
elif x<=11:
    print(2)
else:
    if x%11 == 0:
        print((x//11)*2)
    elif x%11 > 6:
        print(((x+1)//11)*2)
    else:
        print((x//11)*2 + 1)
# Judge status: Wrong Answer
from collections import Counter

N=int(input())
A=[input() for _ in range(N)]

M=int(input())
B=[input() for _ in range(M)]

a=Counter(A)
b=Counter(B)

ans=0
for p in A:
    print(p)
    ans=max(ans,a[p]-b[p])
    
print(ans)
# Judge status: Accepted
H = int(input())
cnt = 0
ans = 0

while(H > 0):
  H = int(H / 2)
  cnt += 1

for i in range(cnt):
  ans += 2 ** i

print(ans)
# Judge status: Wrong Answer
#k = int(input())
#s = input()
#a, b = map(int, input().split())
#l = list(map(int, input().split()))

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

if (n >= 10):
    print(k)
else:
    print(k-100*(10-n))
# Judge status: Accepted
a = [list(map(int, input().split())) for _ in range(3)]

if a[0][1] - a[0][0] == a[1][1] - a[1][0] == a[2][1] - a[2][0] and a[0][2] - a[0][0] == a[1][2] - a[1][0] == a[2][2] - a[2][0]:
    print('Yes')
else:
    print('No')
# Judge status: Accepted

a = int(input())
b = int(input())
c = int(input())
x = int(input())

ans = 0
for i in range(a + 1):
    for j in range(b + 1):
        for k in range(c + 1):
            if i * 500 + j * 100 + k * 50 == x:
                ans += 1

print(ans)
# Judge status: Accepted
a, b, c, d = map(int, input().split())

ta = c//b if c % b == 0 else c//b + 1
aa = a//d if a % d == 0 else a//d + 1

print('No' if ta > aa else 'Yes')
# Judge status: Wrong Answer
n,k=map(int,input().split())

al=[0]*(n+1)
bl=[0]*(n+1)
bl[0]=n
for i in range(1,n+1):
    al[i]=i+al[i-1]
    bl[i]=(n+1-i-1)+bl[i-1]
    
ans=0
for i in range(k,n+2):
    ans+=bl[i-1]-al[i-1]+1
print(ans%(1e9+7))
# Judge status: Accepted
import re

t = input()

pattern = r'[a-z]'

repattern = re.compile(pattern)

result = repattern.match(t)

if result:
    print('a')
else:
    print('A')
# Judge status: Wrong Answer
a,b,c=map(int,input().split())
print("Yes" if a>=c<=b else "No")
# Judge status: Accepted
A,B,C=map(int,input().split())
D=max(A,B,C)
print(A+B+C+9*D)
# Judge status: Accepted
n=int(input())
a=list(map(int,input().split()))
if n==0:
    print(1 if a[0]==1 else -1)
    exit()
e=[1-a[0]]
for i in range(n):
    e.append(max(e[i]-a[i],0)*2)
#print(e)
p=[i for i in a]
for i in range(n-1,-1,-1):
    if -p[i+1]//2*-1+p[i]>e[i]:
        print(-1)
        exit()
    if p[i+1]+p[i]>e[i]:
        p[i]=e[i]
    else:
        p[i]+=p[i+1]
print(sum(p))
#print(p)
# Judge status: Wrong Answer
N = int(input()) 
M_List = list(map(int,input().split()))
M_List = sorted(M_List)
a,b = M_List[0],M_List[1]
while a*b > 0:
    if a > b:
        a -= b
    else:
        b -= a
if a > 0:
    print(a)
else:
    print(b)
# Judge status: Accepted
A, B = map(int, input().split())

if A == B:
  ans = 2 * A
else:
  ans = max(A, B) * 2 - 1
print(ans)
# Judge status: Wrong Answer
i = input().split()
if i.count("7") == 1 and i.count("5") == 2:
    print("YES")
else:
    print("NO")
# Judge status: Accepted
import collections

N, X, Y = list(map(int, input().split()))
dists = [
        min(abs(j-i), abs(X-1-i)+1+abs(Y-1-j), abs(Y-1-i)+1+abs(X-1-j))
        for i in range(N-1) for j in range(i+1, N)
    ]
c = collections.Counter(dists)
ans = [c[K] for K in range(1,N)]
print(*ans, sep='\n')
# Judge status: Accepted
a = list(map(int,input().split()))
from operator import mul
from functools import reduce

def combinations_count(n, r):
    r = min(r, n - r)
    numer = reduce(mul, range(n, n - r, -1), 1)
    denom = reduce(mul, range(1, r + 1), 1)
    return numer // denom
x = a[0]
y = a[1]
if(x != 1) and (x != 0):
    c = (combinations_count(x, 2))
else:
    c = 0
if(y != 1) and (y != 0):
    d = (combinations_count(y, 2))
else:
    d = 0
print(c + d)
# Judge status: Accepted
a, b, c, x, y = map(int, input().split())

if 2 * c == min(2 * c, a, b):
    print(c * 2 * max(x, y))
elif 2 * c <= max(a, b) and a == max(a, b):
    print(c * 2 * x + b * max(y - x, 0))
elif 2 * c <= max(a, b) and b == max(a, b):
    print(c * 2 * y + a * max(x - y, 0))
elif 2 * c <= a + b and x <= y:
    print(c * 2 * x + b * (y - x))
elif 2 * c <= a + b and x > y:
    print(c * 2 * y + a * (x - y))
else:
    print(a * x + b * y)
# Judge status: Accepted
N, K = map(int, input().split())

p_list = sorted(list(map(int, input().split())))

print(sum(p_list[:K]))
# Judge status: Wrong Answer
S, T = map(str,input().split())
A, B = map(int, input().split())
U = str(input())

if S == T:
    A -= 1
else:
    B -= 1

print(A, B)
# Judge status: Accepted
N,K=map(int,input().split())
A=list(map(int,input().split()))
b=min(A)
p=0
for i in range(N):
  if A[i]!=b:
    p+=1
if p%(K-1)==0:
  print(p//(K-1))
else:
  print(p//(K-1)+1)
# Judge status: Accepted
S = input()
print("AC" if(S[0] == "A" and 'C' in S[2:-1]
              and S[1:].replace("C", '', 1).islower()) else "WA")
# Judge status: Accepted
a, b , c = -1,-1,-1
n, y = map(int,input().split())
for i in range(n+1):
    for j in range(n+1):
        if i+ j > n:
            break
        elif ((y - (i*10000 + j*5000))%1000 == 0) and ((i+j+(y - (i*10000 + j*5000))/1000) == n):
            if (y - (i*10000 + j*5000))/1000 >= 0:
                a,b,c = i, j, int((y - i*10000 - j*5000)/1000)
                break
print(a, b, c)
# Judge status: Accepted
S = int(input())
A = [0] * (2001)
A[3] = 1
mod = 10**9+7
for i in range(4, S+1):
    A[i] = A[i-1] + A[i-3]
    A[i] %= mod
print(A[S])
# Judge status: Accepted
N,K = list(map(int,input().split()))
lst = [0]*N
for i in range(K):
    d = int(input())
    for Ai in list(map(int,input().split())):
        lst[Ai-1] += 1

ans = 0
for num in lst:
    if num == 0:
        ans += 1
print(ans)
# Judge status: Wrong Answer
import sys

stdin = sys.stdin
def ns(): return stdin.readline().rstrip()
def ni(): return int(stdin.readline().rstrip())
def nm(): return map(int, stdin.readline().split())
def nl(): return list(map(int, stdin.readline().split()))


def main():
    n = ni()
    A = nl()
    mod = 10 ** 9 + 7
    s = sum(A) % mod
    q = sum([a ** 2 % mod for a in A]) % mod
    ans = (((s * s) % mod - q) % mod) / 2
    print(int(ans % mod))


if __name__ == '__main__':
    main()
# Judge status: Wrong Answer
# A - ><
S = input()
N = len(S)+1
INF = 1000000
ans = [0]*N
tmp = -INF
for i in range(N-1):
    if S[i]=='<':
        tmp += 1
    else:
        tmp = 0
    ans[i+1] = tmp
tmp = -INF
for i in range(N-2,-1,-1):
    if S[i]=='>':
        tmp += 1
    else:
        tmp = 0
    ans[i] = max(ans[i],tmp)
print(sum(ans))
# Judge status: Wrong Answer
from collections import defaultdict

n = int(input())
d = list(map(int, input().split()))
d.sort()

mod = 998244353
 
cnt = defaultdict(int)
for i in range(n):
    cnt[d[i]] += 1

ans = 1
max_value = max(d)
for i in range(1, max_value+1):
    ans = ans * pow(cnt[i-1], cnt[i], mod) % mod

print(ans)
# Judge status: Accepted
N=int(input())
 
a=1
 
for i in range(N):
  a*=(i+1)
  a%=1000000007
 
print(a)
# Judge status: Wrong Answer
import itertools

N,K=map(int, input().split())
x=list(map(int, input().split()))

temp=0
ans=(abs(min(x))+abs(max(x)))*N

xc=list(itertools.combinations(x,K))

for l in xc:
	if min(l)<=0 and max(l)>=0:
		ans=min(min(2*max(l)+abs(min(l)),max(l)+2*abs(min(l))),ans)
	elif min(l)<0 and max(l)<0:
		ans=min(ans,min(l))
	elif min(l)>0 and max(l)>0:
		ans=min(ans,max(l))

print(ans)
# Judge status: Accepted
m,d =map(int,input().split())
print(m if m<=d else m-1)
# Judge status: Wrong Answer
s = map(int, input().split())
if(max(s) == sum(s)//2):
  print("Yes")
else:
  print("No")
# Judge status: Accepted
import numpy as np
n, m = map(int,input().split())
questions = [0 for i in range(n)]
clear = [0 for i in range(n)]
for i in range(m):
    p,s = input().split()
    p = int(p)
    if s == 'WA':
        if clear[p-1] == 0:
            questions[p-1] += 1
    else:
        clear[p-1] = 1
questions = np.array(questions)
print(sum(clear), questions[np.where(np.array(clear) == 1)[0]].sum())
# Judge status: Accepted
import fractions

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

U = B - A + 1

x = B // C - (A-1) // C
y = B // D - (A-1) // D

lcm = C*D // fractions.gcd(C,D)
z = B // lcm - (A-1) // lcm

print(U - (x + y - z))
# Judge status: Accepted
from itertools import accumulate
from bisect import bisect

n, m, k = map(int, input().split())
a = accumulate(map(int, input().split()), initial=0)
b = [*accumulate(map(int, input().split()))]
print(max(i + bisect(b, k - x) for i, x in enumerate(a) if x <= k))
# Judge status: Accepted
n, m = map(int, input().split())
a = list(map(int, input().split()))
a.sort(reverse=True)
sum_ = 0
for i in a:
    sum_ +=i
if(a[m-1]>=sum_/(4*m)):
    print('Yes')
else: print('No')
# Judge status: Accepted
# 2020/04/29
# AtCoder Beginner Contest 044 - B

# Input
w = input()

# Init
d = dict()

# Calc
for i in range(len(w)):
    if d.get(w[i]) == None:
        d[w[i]] = 1
    else:
        d[w[i]] = d[w[i]] + 1

ans = 'Yes'
for key in d:
    if d[key] % 2 == 1:
        ans = 'No'
        break

# Output
print(ans)
# Judge status: Accepted
s = input()
t = input()

s_l = len(s)
t_l = len(t)

max_count = 0
for i in range(0, s_l - t_l + 1):
  count = 0
  for j in range(0, t_l):
    if s[i+j] == t[j]:
      count += 1
  if count > max_count:
    max_count = count

diff = t_l - max_count
print(diff)
# Judge status: Wrong Answer
N = int(input())

A = []
for i in range(N):
    A.append(list(map(int, input().split())))

dp = [[0]*3 for _ in range(N)]
for i in range(3):
    dp[0][i] = A[0][i]


for i in range(1, N):
    for j in range(3):
        for k in range(3):
            if i != k: 
                dp[i][k] = max(dp[i-1][j] + A[i][k], dp[i][k])

print(max(dp[-1][0], dp[-1][1], dp[-1][2]))
# Judge status: Accepted
def inp():
    return input()
def iinp():
    return int(input())
def inps():
    return input().split()
def miinps():
    return map(int,input().split())
def linps():
    return list(input().split())
def lmiinps():
    return list(map(int,input().split()))
def lmiinpsf(n):
    return [list(map(int,input().split()))for _ in range(n)]

n = iinp()
a = lmiinps()

ans = 0

for i in range(n-1):
    if a[i+1] < a[i]:
        ans += (a[i] - a[i+1])
        a[i+1] = a[i]

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

if 9>=a>=1 and 9>=b>=1 :
    print(a*b)
else :
    print(-1)
# Judge status: Accepted
nl = list(input())
n = len(nl)

ans = 0
dp = [[0, 0] for i in range(n+1)]
for idx, i in enumerate(nl[::-1]):
    i = int(i)
    if idx == 0:
        dp[1][0] = dp[idx][0] + i
        dp[1][1] = dp[idx][0] + 10 - i
    else:
        dp[idx+1][0] = min(dp[idx][0] + i, dp[idx][1] + i + 1)
        dp[idx+1][1] = min(dp[idx][0] + 10 - i, dp[idx][1] + 10 - i - 1)
print(min(dp[-1][0], dp[-1][1]+1))
# Judge status: Wrong Answer
a,b,c,x,y = map(int,input().split())

a_b = (a+b) // 2
ans = 0
if a_b > c:
    ans += min(x,y)*c*2
    if x > y:
        if a > c*2:
            ans += (x - y)*c*2
        else:
            ans += (x - y)*a
    else:
        if b > c*2:
            ans += (y - x)*c*2
        else:
            ans += (y - x)*b
else:
    ans += x*a+y*b

print(ans)
# Judge status: Wrong Answer
N = int(input())
div = N//2 + 1
ans = (2**div-1)
print(ans)
# Judge status: Accepted
N = input()

if N[0] == '7' or N[1] == '7' or N[2] == '7':
  print('Yes')
else:
  print('No')
# Judge status: Accepted
print(0 if int(input())==1 else 1)
# Judge status: Accepted
x, y = map(int, input().split())

for i in range(100):
	if x * (2 ** i) > y:
		print(i)
		break
# Judge status: Accepted
N = int(input())
if N == 1:
    print(0)
else:
    print(N*(N-1)//2)
# Judge status: Wrong Answer
n=int(input())
k=int(input())
x=int(input())
y=int(input())
f=0
if(n<=k):
  f=n*x
else:
   f=n*x+(n-k)*y
print(f)
# Judge status: Wrong Answer

D,T,S= map(int,input().split())

if (S*T) <= D:
    print("Yes")
else:
    print("No")
# Judge status: Accepted
a, b, c = map(int,input().split())

print(max(0,c-(a-b)))
# Judge status: Accepted
ABC = sorted(list(map(int,input().split())))

ans = ABC[2]-ABC[1]

if (ABC[2]-(ABC[0]+ans))%2 == 0:
    ans += (ABC[2]-(ABC[0]+ans))//2
else:
    ans += (ABC[2]-(ABC[0]+ans))//2+2
print(ans)
# Judge status: Accepted
n=int(input())
A = list(map(int,input().split()))

max_value = max(A)
max_index = A.index(max_value)

c=0

for i in range(max_index,n):
    c+=(max_value-A[i])

for i in range(1,max_index):
    if A[i-1]>A[i]:
        c+=(A[i-1]-A[i])
        A[i]=A[i-1]

print(c)
# Judge status: Accepted
x = map(int, input().split())
for i, j in enumerate(x):
    if j == 0:
        print(i+1)
# Judge status: Accepted
n=int(input())
score=[]
point=0
for i in range(n):
  d=input().split()
  if d[0]==d[1]:
    point+=1
    score.append(point)
  else:
    point=0
    score.append(point)

if max(score)>=3:
  print("Yes")
else:
  print("No")
# Judge status: Wrong Answer
a,b=[int(i) for i in input().split()]
if a%3==0 and b%3==0 and (a+b)%3==0:
  print('Impossible')
else:
  print('Possible')
# Judge status: Accepted
x,y=map(int,input().split())
ans=abs(abs(x)-abs(y))

if (x<0 and y<0) or (x>0 and y>0):
    if x>y :ans+=2
elif x!=0 and y!=0:
    ans+=1
else:
    if y<=0 and x>y:
        ans+=1

print(ans)
# Judge status: Wrong Answer
N = int(input())
A = list(map(int,input().split()))
count = 0
for i in range(N):
  for j in range(N):
    if A[i] == A[j]:
      count += 1
    else:
      count += 0
  print(count-i-1)
# Judge status: Wrong Answer
import sys
read = sys.stdin.read
def main():
    n = int(input())
    if n == 1:
        print(1)
        sys.exit()
    # nd:num of div
    r = 0
    for i1 in range(1, n):
        y = n // i1
        r += y * (y + 1) * i1 / 2
    print(int(r))

if __name__ == '__main__':
    main()
# Judge status: Accepted
import sys


def solve():
    input = sys.stdin.readline
    mod = 10 ** 9 + 7
    s, t = list(map(str, str(input().rstrip('\n')).split()))
    print(t + s)


if __name__ == '__main__':
    solve()
# Judge status: Accepted
n = int(input())
a = [int(x) for x in input().split()]

even = []
odd = []

for i in range(n):
    if i % 2 == 0:
        odd.append(a[i])
    else:
        even.append(a[i])

if n % 2 == 0:
    even.reverse()
    ans = even + odd
    print(*ans)
else:
    odd.reverse()
    ans = odd + even
    print(*ans)
# Judge status: Accepted
n, m = map(int, input().split())
ans = min(n, m//2)
m -= ans*2
ans += m//4
print(ans)
# Judge status: Wrong Answer
n = int(input())
#n, m = list(map(int, input().split()))
a = list(map(int, input().split()))
#abc = [int(input()) for i in range(5)]
a.sort()
for i in range(1, n):
    a[i] %= a[0]
a.sort(reverse=True)
ans = a[-1]
if ans == 0:
    for i in range(n-1, -1, -1):
        if a[i] != 0:
            print(a[i])
            exit()
print(ans)
# Judge status: Wrong Answer
S=input()
T=input()

ans = "No"
for i in range(len(S)):
	if S[:i] + S[0:1] == T:
		ans = "Yes"

print(ans)
# Judge status: Accepted
import sys
import math
import itertools
import collections
import heapq
import re
import numpy as np

rr = lambda: sys.stdin.readline().rstrip()
rs = lambda: map(str, sys.stdin.buffer.readline().split())
ri = lambda: int(sys.stdin.buffer.readline())
rm = lambda: map(int, sys.stdin.buffer.readline().split())
rl = lambda: list(map(int, sys.stdin.buffer.readline().split()))

n = ri()
h = rl()
temp = 0
for i in h:
    if temp == i:
        continue
    elif temp < i:
        temp = i-1
        continue
    else:
        print('No')
        exit()
else:
    print('Yes')
# Judge status: Accepted
N, x = map(int, input().split(" "))
a = list(map(int, input().split(" ")))
children = [0] * N
a.sort()
kashi = 0
n = N
if a[0] > x:
    print(0)
elif sum(a) == x:
    print(N)
else:
    for i in range(0,n):
        if kashi > x:
            break        
        kashi += a[i]
        children[i] += 1
#     print(kashi)
    if kashi == x :
        print(N - children.count(0))
    else:
        print(N - children.count(0) - 1)
# Judge status: Accepted
n = int(input())
y = 0
if(n==0):
  print(y)
elif(n%500==0):
  y = int(n/500)*1000
  print(y)
else:
  j = n%500
  y = int(n//500)*1000 + int(j//5)*5
  print(y)
# Judge status: Accepted
N, M, X, Y = map(int,input().split())
x = [int(x) for x in input().split()]
y = [int(y) for y in input().split()]
x.append(X)
y.append(Y)
x_max = max(x)
y_min = min(y)
if x_max < y_min:
    print('No War')
else:
    print('War')
# Judge status: Wrong Answer
def main():
    N = input()
    L = map(int, input().split())
    a = max(L)
    b = sum(L) - a
    if a > b:
        print("Yes")
    else:
        print("No")


if __name__ == '__main__':
    main()
# Judge status: Accepted
n = int(input())
lis = list(map(int, input().split()))
res = 0
cnt = 0
flg = False
for i in lis:
    if i == 1:
        flg = True
        res = max(res, cnt)
        cnt = 1
    elif i == cnt + 1:
        cnt += 1

if not flg:
    print(-1)
else:
    print(n - max(res, cnt))
# Judge status: Accepted
n = int(input())
a = list(map(int, input().split()))

num = 1
b_num = 0
for i in range(n):
    if num != a[i]:
        b_num += 1
    else:
        num += 1

if b_num == n:
    b_num = -1

print(b_num)