peterverebics/CodeNet_Python_428 huggingface dataset:
# Judge status: Wrong Answer
MOD = 10**9 + 7
max = 10**5 + 1
facts = [1 for i in range(max)]
invs = [1 for i in range(max)]

def inv(x):
    return pow(x,MOD-2,MOD)

for i in range(1,max):
    facts[i] = facts[i-1]*i%MOD
    invs[i] = inv(facts[i])

def comb(n,r):
    return facts[n]*invs[r] * invs[n-r] % MOD

n,m = map(int,input().split())
if m > n:
    n,m = m,n
if n-m >= 2:
    print(0)
elif n-m == 1:
    print(facts[m]*facts[n])
else:
    print(facts[m]*facts[n]*2 % MOD)
# Judge status: Accepted
from collections import Counter

N = int(input())
Sss = [''.join(sorted(input().rstrip())) for _ in range(N)]

cnt = Counter(Sss)
#print('cnt:', cnt)

ans = 0
for num in cnt.values():
    ans += num*(num-1)//2
print(ans)
# Judge status: Wrong Answer
s = list(input())

g = []

g.append(0)
g.append(1)
if s[1] == s[2]:
    g.append(1)
else:
    g.append(2)

for i in range(3,len(s)+1):
    if s[i-1] != s[i-2]:
        g.append(g[i-1]+1)
    else:
        g.append(g[i-3]+2)

print(g[-1])
# Judge status: Accepted
hoge=input()
for i in range(len(hoge)):
  print("x",end="")
# Judge status: Accepted
n = input()
dp = [0, 10000]
for d in reversed('0' + n):
    newdp = []
    newdp.append(min(int(d) + dp[0], int(d) + 1 + dp[1]))
    newdp.append(min(10 - int(d) + dp[0], 10 - int(d) - 1 + dp[1]))
    dp = newdp
print(dp[0])
# Judge status: Accepted
N = int(input())
T,A = map(int,input().split())
H = [int(i) for i in input().split()]
 
res = - 1
res_val = 100000
for i in range(N):
    av_temp = T - H[i] * 0.006
    if res_val > abs(av_temp - A):
        res = i
        res_val = abs(av_temp - A)
 
print(res+1)
# Judge status: Accepted
n, m = map(int,input().split())

ai = [int(i) for i in input().split()]

if n - sum(ai) >= 0 :
    print(n - sum(ai))
else :
    print(-1)
# Judge status: Wrong Answer
n = int(input())
s = input()
ans ="Yes"
if n==1:ans="No"
else:
	for i in range(n//2):
		if s[i]!=s[n//2+i]:ans="No"
print(ans)
# Judge status: Wrong Answer
n,m=map(int,input().split())
def int_2(n):
    return int(n)//2
a=list(map(int_2,input().split()))
def gcm(a,b):
    if a==0:
        return b
    elif b==0:
        return a
    else:
        return gcm(a%b,b) if a>=b else gcm(b%a,a)

def lcm(a,b):
    return a*b//gcm(a,b)

lis=[a[0]]*n
for i in range(n-1):
    lis[i+1]=lcm(lis[i],a[i+1])

ma=m//lis[n-1] 
print((ma+1)//2)
# Judge status: Accepted
n,a,b = map(int, input().split())

#距離
d = b-a
c = 0
if d % 2 == 0:
    c = d // 2
else:
    # 端っこに近い方に行く
    c = min(n-b, a-1)
    # 一試合距離を縮める
    c += 1
    d -= 1
    # お互い近づく
    c += (d // 2)

print(c)
# Judge status: Accepted
s = input()
dic = {'SUN': 7,
'MON':6,
'TUE':5,
'WED':4,
'THU':3,
'FRI':2,
'SAT':1}
print(dic[s])
# Judge status: Accepted
N = int(input())
V = [int(x) for x in input().split()]

for v in range(N-1):
    V.sort()
    min1 = V.pop(0)
    min2 = V.pop(0)
    new = (min1 + min2) / 2
    V.append(new)

print(V[0])
# Judge status: Accepted
N, T = map(int, input().split())
c = [0]*N
t = [0]*N
for i in range(N):
    c[i], t[i] = map(int, input().split())
cc = []
for i in range(N):
    if t[i]<=T:
        cc.append(c[i])

if cc == []:
    print('TLE')
    exit()

print(min(cc))
# Judge status: Accepted
Y,M,D=map(int,input().split('/'))

if Y < 2019:
    print('Heisei')
elif Y == 2019 and M <= 4:
    print('Heisei')
else:
    print('TBD')
# Judge status: Accepted
import sys

def main(lines):
  N = int(lines[0])
  print(N // 2*(N - N // 2))

if __name__ == '__main__':
    lines = []
    for l in sys.stdin:
        lines.append(l.rstrip('\r\n'))
    main(lines)
# Judge status: Wrong Answer
x,y=map(int,input().split())
print(x%y)
# Judge status: Wrong Answer
N=int(input())
cnt=1
R=[[0]*2 for _ in range(N)]
for i in range(N):
  x,l=map(int,input().split())
  R[i][0]=(x-l+1)
  R[i][1]=(x+l-1)
  
#print(R)
R.sort(key=lambda x: x[1])
#print(R)
for i in range(1,N):
  if R[i][0]>R[i-1][1]:
    cnt+=1
print(cnt)
# Judge status: Wrong Answer
A, V = map(int, input().split())
B, W = map(int, input().split())
T = int(input())

if A+T*V < B+T*W:
    print('NO')
else:
    print('YES')
# Judge status: Wrong Answer
N = int(input())
A = sorted(list(map(int, input().split())))
print(sum(A[N:N*2]))
# Judge status: Accepted
N,A,B = map(int,input().split())
if A > B:
    print(0)
    exit()
if N == 1:
    if A == B:
        print(1)
    else:
        print(0)
    exit()
print((B-A)*(N-2)+1)
# Judge status: Wrong Answer
import sys
input=sys.stdin.buffer.readline
a,b,c,k=map(int,input().split())
print(-a+b if k != 0 else "-1")
# Judge status: Accepted
A,B = map(int,input().split())

import math
ans = math.ceil((A+B)/2)
print(ans)
# Judge status: Accepted
import itertools

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

comb = list(itertools.combinations_with_replacement(range(1, M + 1), N))

saidai = 0
for c in comb:
    score = 0
    for a in A:
        if (c[a[1] - 1] - c[a[0] - 1] == a[2]):
            score += a[3]
    saidai = max(saidai, score)

print(saidai)
# Judge status: Wrong Answer
def findTrailingZeros(n): 
      
    # If n is odd 
    if (n & 1): 
        return 0
  
    # If n is even 
    else: 
        ans = 0
  
        # Find the trailing zeros 
        # in n/2 factorial 
        n //= 2
        while (n): 
            ans += n // 5
            n //= 5
  
        # Return the required answer 
        return ans 
   
  
n = 12
  
print(findTrailingZeros(n))
# Judge status: Accepted
try:
    N, M = map(int, input().split())
    dp = [[0 for i in range(N)] for j in range(N)]

    for i in range(M):
        a, b = map(int, input().split())
        dp[a-1][b-1] += 1
        dp[b-1][a-1] += 1
    for k in range(len(dp)):
        print(sum(dp[k]))
except EOFError:
    pass
# Judge status: Accepted
import sys
n, m, x, y = map(int, input().split())
x1 = max(list(map(int, input().split())))
y1 = min(list(map(int, input().split())))


for i in range(x+1, y+1):
    if x1 < i <= y1:
        print('No War')
        sys.exit()
print('War')
# Judge status: Accepted
A,B = map(int,input().split())
flag = 0
for i in range(10000):
    a = int(i*0.08)
    b = int(i*0.1)
    if A==a and B==b:
        flag = 1
        ans = i
        break
        
if flag == 1:
    print(ans)
else:
    print(-1)
# Judge status: Accepted
from decimal import *
a, b, c = [Decimal(i).sqrt() for i in input().strip().split(" ")]

if a + b - c < 0:
    print("Yes")
else:
    print("No")
# Judge status: Accepted
W, a, b = map(int, input().split())
if abs(a-b) < W:
    ans = 0
else:
    ans = abs(a-b) - W
print(ans)
# Judge status: Accepted
import math

a = [int(input()) for i in range(5)]
sub = 0
cnt = 0

for i in a:
    if i%10!=0 and sub<(10-i%10):
        sub = 10-i%10
    cnt += math.ceil(i/10)*10
print(cnt-sub)
# Judge status: Wrong Answer
input()
s =input()
a = []
n = 0
for i in s :
  if i == 'I':
    n +=1
  else :
    n-=1
  a.append(n)
print(max(a))
# Judge status: Wrong Answer
N = int(input())
A = list(map(int,input().split()))
ans = 1
i = 2
while (i < N):
    if ((A[i-2] <= A[i-1] <= A[i]) or (A[i-2] >= A[i-1] >= A[i])):
        i += 1
    else:
        ans +=1
        i += 2

print(ans)
# Judge status: Accepted
N, M = map(int, input().split())
hlist = list(map(int, input().split()))
rlist=[]
i=0
while(i<M):
  a = input().split()
  rlist.append(a)
  i+=1
anslist=[0]*N
j=0
while(j<M):
  alist=rlist[j]
  a=int(alist[0])
  b=int(alist[1])
  if(hlist[a-1]<hlist[b-1]):
    anslist[a-1]=1
  elif(hlist[b-1]<hlist[a-1]):
    anslist[b-1]=1
  elif(hlist[a-1]==hlist[b-1]):
    anslist[a-1]=1
    anslist[b-1]=1
  j+=1
print(anslist.count(0))
# Judge status: Accepted
import itertools
n=int(input())
p=tuple(map(int,input().split()))
q=tuple(map(int,input().split()))
count=0
a=0
b=0

for i in itertools.permutations(range(1,n+1)):
  count+=1
  if i == p:
    a=count
  if i==q:
    b=count
print(abs((count-a)-(count-b)))
# Judge status: Accepted
from functools import reduce
def resolver(N, A):
    X = reduce(int.__xor__, A)
    ans = [str(X^a) for a in A]
    
    return ans

def test():
    pass

def main():

    #test()

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

    print(" ".join(ans))
    



if __name__ == '__main__':
    main()
# Judge status: Accepted
# -*- coding: utf-8 -*-

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

A = sorted(A)[::-1]

ans = 0
for i, a in enumerate(A):
    if i==0:
        ans += a
        itr = 2
        if itr >= N:
            break
    else:
        ans += a
        itr += 1
        if itr >= N:
            break
        ans += a
        itr += 1
        if itr >= N:
            break

print(ans)
# Judge status: Accepted
A1, A2, A3 = map(int, input().split())
if A1 + A2 + A3 <= 21:
  print("win")
else:
  print("bust")
# Judge status: Accepted
print("YES" if input() == input()[::-1] else "NO")
# Judge status: Wrong Answer
input_line = input()
Line = input_line.split()

if 500*Line[0] > Line[1]:
  print('yes')
else:
  print('no')
# Judge status: Accepted
N = int(input())
W = list(map(int, input().split()))
d = sum(W) / 2
count = 0
for i in range(N):
  count += W[i]
  if count >= d:
    if i == 0:
      print(W[0] - sum(W[1:]))
      break
    else:
      print(min(sum(W[i:]) - sum(W[:i]), sum(W[:i + 1]) - sum(W[i+1:])))
      break
# Judge status: Wrong Answer
def iroha():
    a, b, c = [int(input()) for i in range(3)]
    result = (a+b)*2 / 2
    print(result)


if __name__ == "__main__":
    iroha()
# Judge status: Accepted
from itertools import accumulate
n = int(input())
As = list(map(int, input().split()))

if n == 0:
    if As[0] == 1:print(1)
    else:print(-1)
    exit()


if As[0] != 0:
    print(-1)
    exit()

b = 1
ans = 1
acc = list(accumulate(As))
s = acc[-1]
for ac,a in zip(acc[1:], As[1:]):
    # print(s-ac,2*b-a)
    b = min(2*b-a, s-ac)
    if b < 0:
        print(-1)
        exit()
    ans += b+a
print(ans)
# Judge status: Wrong Answer
import itertools

N = int(input())

l = [i for i in range(1, N+1)]

p = list(itertools.permutations(l, N))

print(p)

P = tuple(map(int, input().split()))
Q = tuple(map(int, input().split()))

a = p.index(P)
b = p.index(Q)

print(abs(b-a))
# Judge status: Accepted
N=int(input())
rest=[list(map(int,input().split())) for _ in range(N)]
#print(rest)
push=0
a=0
b=0
for i in range(N-1,-1,-1):
    #print(i)
    a = rest[i][0] + push
    push=push+((rest[i][1]-a%rest[i][1])%rest[i][1])
    #print(push)
print(push)
# Judge status: Accepted
N,K = [int(i) for i in input().split()]
h = [int(i) for i in input().split()]
dp = [0]*(N)
dp[1] = abs(h[0] - h[1])
for i in range(0,N-2):
    dp[i+2] = min([dp[i+2-j]+abs(h[i+2-j]-h[i+2]) for j in range(1,min(K+1, i+3))])
print(dp[-1])
# Judge status: Accepted
n = int(input())
a = list(map(int, input().split()))
mod = 10 ** 9 + 7

# 解説AC
ans, num = 0,1
for i in range(60):
    cnt = sum((ai & num) >> i for ai in a)
    ans += (cnt * (n - cnt) * num) % mod
    num <<= 1
print(ans % mod)
# Judge status: Accepted
import numpy as np

n = int(input())
a = list(map(int, input().split()))
a.sort(reverse=True)
a = np.array(a)

alice = a[0::2].sum()
bob = a[1::2].sum()

print(alice-bob)
# Judge status: Accepted
M, N = map(int ,input().split())
x = [int(x) for x in input().split()]
if (sum(x)) > M:
    print(-1)
elif(sum(x) == M):
    print(0)
elif(sum(x)<M):
    print(M-sum(x))
# Judge status: Accepted
from itertools import combinations

N, D = map(int, input().split())
X = [list(map(int, input().split())) for _ in range(N)]

combi = list(combinations(range(N), 2))

ans = 0
for Y, Z in combi:
    dist = 0
    for i in range(D):
        dist += (X[Y][i] - X[Z][i])**2
    if dist**0.5 <= int(dist**0.5):
        ans += 1

print(ans)
# Judge status: Accepted
N = int(input())
data = []
ans = []
for i in range(1, N+1):
  city, score = input().split()
  score = int(score)
  data.append([city, score, i])
city_list = [x[0] for x in data]
score_list = [x[1] for x in data]
num_list = [x[2] for x in data]
city_unique = sorted(set(city_list))

for city_u in city_unique:
  city_index = [i for i, x in enumerate(city_list) if x == city_u]
  for score in sorted([score_list[x] for x in city_index], reverse=True):
    print(num_list[score_list.index(score)])
# Judge status: Accepted
a,b=list(map(int,input().split()))

if a >= 13:
  print(b)
elif 6 <= a <= 12:
  print(b//2)
else:
  print(0)
# Judge status: Wrong Answer
N = int(input())
A = list(map(int, input().split()))
cnt = [0] * (N+1)
ans = 0
for i in range(N):
  cnt[A[i]] += 1
for i in range(N):
  ans += cnt[i] * (cnt[i] - 1) // 2
for i in range(N):
  print(ans - cnt[A[i]] + 1)
# Judge status: Wrong Answer
mod = 10**9 + 7
n, a, b = 1000, 23, 30
res = pow(2, n, mod)-1

c1 = 1
for i in range(n-a+1, n+1):
    c1 *= i
    c1 %= mod

for i in range(1, a+1):
    c1 *= pow(i, mod-2, mod)
    c1 %= mod
    
c2 = 1
for i in range(n-a+1, n+1):
    c2 *= i
    c2 %= mod

for i in range(1, a+1):
    c2 *= pow(i, mod-2, mod)
    c2 %= mod
    
res -= (c1+c2)
res %= mod
print(res)
# Judge status: Accepted
N, M, K = map(int, input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))

C = A[::-1] + B

right = 0
size = 0
ans = 0
for left in range(N+M):
    while right < (N+M) and size+C[right] <= K:
        size += C[right]
        right += 1
    if left <= N and N <= right:
        ans = max(ans, (right-left))
    if left == right:
        right += 1
    else:
        size -= C[left]

print(ans)
# Judge status: Accepted
shurui, kosuu = [int(idx) for idx in input().split()]
price = [int(idx) for idx in input().split()]

price.sort()
result = 0
for idx in range(kosuu):
  result += min(price)
  price.remove(min(price))
  
print(result)
# Judge status: Accepted
sx, sy, tx, ty = map(int, input().split())

ans = (abs(tx - sx)  * 'R') + (abs(ty - sy) * 'U')
ans += ((abs(tx - sx) * 'L') + (abs(ty - sy) * 'D'))
ans += 'L' + ((abs(ty - sy) + 1) * 'U') + ((abs(tx - sx) + 1) * 'R') + 'D'
ans += 'R' + ((abs(ty - sy) + 1) * 'D') + ((abs(tx - sx) + 1) * 'L') + 'U'
print(ans)
# Judge status: Accepted
N,M,X=map(int,input().split())
A=[list(map(int,input().split())) for i in range(N)]

C=10**7
for i in range(2**N):
  P,T=[0]*M,0
  for j in range(N):
    if i&2**j:
      T+=A[j][0]
      for k in range(M):
        P[k]+=A[j][k+1]
  for j in range(M):
    if P[j]<X:
      break
  else:
    C=min(C,T)

print(-1 if C==10**7 else C)
# Judge status: Wrong Answer
sa = str(input())
sb = str(input())
sc = str(input())
d = {'a': [sa, len(sa), 0], 'b': [sb, len(sb), 0], 'c': [sc,len(sc), 0]}
x = 'a'
while True:
    d[x][2] += 1
    if d[x][1] == d[x][2]:
        break
    x = d[x][0][d[x][2]]
print(x.upper())
# Judge status: Accepted
S = input()
T = input()

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

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

    print((b - a) * (b - a + 1) // 2 - b)


if __name__ == "__main__":
    main()
# Judge status: Accepted
from collections import Counter, deque
# from copy import copy, deepcopy
# from fractions import gcd
# from functools import reduce
# from itertools import accumulate, permutations, combinations, combinations_with_replacement, groupby, product
# import math
# import numpy as np
# from operator import xor
import sys
sys.setrecursionlimit(10 ** 5 + 10)
# input = sys.stdin.readline

def resolve():
    N=int(input())
    A=[int(input()) for i in range(N)]

    AA=Counter(A)
    cnt=0
    for i in AA.values():
        if i%2==1:
            cnt+=1

    print(cnt)

resolve()
# Judge status: Accepted
import math

N = int(input())

K = math.ceil((-1 + math.sqrt(1 + 8 * N))/2)

L = int((1 + K) * K //2 - N)

while K:
  if K != L:
    print(K)
  K -= 1
# Judge status: Wrong Answer
A = sorted(list(map(int, input().split())))
ans = 0
for a in A:
    if a%2!=0: ans = A[0]*A[1]
print(ans)
# Judge status: Accepted
S, T = (x for x in input().split())
moji = T+S
print(moji)
# Judge status: Accepted
W,a,b = [int(i) for i in input().split()]
if a <= b and b <= a + W:
  print(0)
else:
  print(abs(a-b)-W)
# Judge status: Accepted
a,b,n = map(int,input().split())

k = max(0,(n - b + 1) // b)
k = min(n,k * b + b - 1)

print((a * k) // b - a * (k // b))
# Judge status: Accepted
A,B,C=map(int,input().split())
ans = 1
if (A%2 != B%2) and (A%2 == C%2):
  A += 1
  C += 1
elif (A%2 == B%2) and (A%2 != C%2):
  A += 1
  B += 1
elif (A%2 != B%2) and (B%2 == C%2):
  C += 1
  B += 1
else:
  ans = 0
L = [A,B,C]
L.sort()
ans += (L[2]-L[1])//2 + (L[2]-L[0])//2
print( ans )
# Judge status: Accepted
n,m =map(int,input().split())
d = [list(map(int,input().split())) for i in range(n)]
d.sort()
i = 0
cnt = 0
while m>0:
  if m-d[i][1] >= 0:
    cnt += d[i][0]*d[i][1]
    m -= d[i][1]
    i += 1
  else:
    cnt += d[i][0]*m
    m = 0
    i += 1
    
print(cnt)
# Judge status: Accepted
import sys
read = sys.stdin.buffer.read

from fractions import gcd

N,*A = map(int,read().split())

lcm = 1
answer = 0
for x in A:
  n = x//gcd(lcm,x)
  lcm *= n
  answer *= n
  answer += lcm//x
  
answer %= (10**9 + 7)
print(answer)
# Judge status: Accepted
a = [str(input()) for i in range(2)]
ans=0
for i in range(len(a[0])):
  if not a[0][i] == a[1][i]:
    ans +=1
    
print(ans)
# Judge status: Accepted
S = input()
S_reverse = S[::-1]

dp = [0] * 2019
now_mod = 0
digit = 1

for i_s in S_reverse:
    now_mod = (now_mod + int(i_s)*digit) % 2019
    digit = (digit*10) % 2019
    dp[now_mod] += 1

ans = sum(x*(x-1)//2 for x in dp)
ans += dp[0]

print(ans)
# Judge status: Accepted
N = int(input())
for i in range(N,1000):
    x = str(i)
    if x[0]==x[1]==x[2]:
        break
print(x)
# Judge status: Accepted
import collections
N = int(input())
  
# 素因数分解
def prime_decomposition(n):
  i = 2
  table = []
  while i * i <= n:
    while n % i == 0:
      n /= i
      table.append(i)
    i += 1
  if n > 1:
    table.append(n)
  return table

num1 = prime_decomposition(N)
num2 = collections.Counter(num1)

ans = 0

for j in set(num1):
  number = 0
  for k in range(50):
    number += k
    if number > num2[j]:
      ans += (k-1)
      break
        
print(ans)
# Judge status: Wrong Answer
s = input('')
max_s = 20000
rec = 0
for m in (range(max_s+1)):
    ms=str(2019*m)
    if not '0' in ms:
        idx=0
        idx=s.find(ms)
        while idx >= 0:
            rec+=1
            idx=s.find(ms,idx+1)
            print("{} {}".format(ms,idx))
print(rec)
# Judge status: Accepted
N=int(input())
count=0
if N//100000==1:
    count=90909
elif N//10000>0:
    count=N%10000+910+((N//10000)-1)*10000
elif N//1000>0:
    count=909
elif N//100>0:
    count=N%100+10+((N//100)-1)*100
elif N//10>0:
    count=9
else:
    count=N//1
print(count)
# Judge status: Accepted
# coding=utf-8
import math

if __name__ == '__main__':
    A, B, C = map(int, input().split())

    MV = max(A, B, C) * 3
    SumABC = A + B + C

    if MV % 2 == 0 and SumABC % 2 == 0:
        ans = (MV - SumABC) / 2

    elif MV % 2 == 1 and SumABC % 2 == 1:
        ans = math.ceil(MV - SumABC) / 2

    else:
        ans = math.ceil((MV - SumABC) / 2) + 1

    print(int(ans))
# Judge status: Accepted
a,b,c = map(int, input().split())
if a+b >= c:
    print('Yes')
else:
    print('No')
# Judge status: Accepted
A,B,C = map(int,input().split())
if A%2==0 or B%2==0 or C%2==0:
  print(0)
else:
  print(A*B*C//max({A,B,C}))
# Judge status: Accepted
s = input()

ans = []

for i in s:
    if i == '1' or i == '0':
        ans.append(i)
    else:
        if ans == []:
            continue
        else:
            ans.pop()

print(''.join(ans))
# Judge status: Accepted
n,m=map(int,input().split())
if n>0 and m>0:print((n*(n-1))//2+(m*(m-1))//2)
else:
    k=max(n,m)
    print((k*(k-1))//2)
# Judge status: Accepted
s = input()

ans = ''

for i in s:
    ans = ans[:-1] if i == 'B' else ans + i    

print(ans)
# Judge status: Accepted
s = input()
if s[-1] == 's':
	print(s + 'es')
else:
	print(s + 's')
# Judge status: Accepted
a = int(input())
color = str(input())
if a >= 3200:
    print(color)
else:
    print('red')
# Judge status: Accepted
n, y = map(int, input().split())
for i in range(n + 1):
    for j in range(n - i + 1):
        if i * 10000 + j * 5000 + (n - i - j) * 1000 == y:
            print(i, j, n - i - j)
            exit()
print("-1 -1 -1")
# Judge status: Accepted
N = int(input())
import collections
A = list(map(int,input().split()))
C = collections.Counter(A)
use = [0,0]
for i,val in C.items():
  if val >= 4:
    use.append(i)
  if val >= 2:
    use.append(i)

use.sort(reverse=True)
 
print(use[0] * use[1])
# Judge status: Accepted
s = str(input())
t = str(input())
n = len(s)
x = s
ans = 'No'
for _ in range(n):
    if x == t:
        ans = 'Yes'
        break
    nx = x[-1] + x[:n-1]
    x = nx
print(ans)
# Judge status: Wrong Answer
n = int(input())
a = list(input().split())
if len(set(a)) == len(a):
    print('Yes')
else:
    print('No')
# Judge status: Wrong Answer
S = input()
print('x'* len(S))
# Judge status: Accepted
s = input()
maxCount = 0
count = 0

for i in s:
  if(i == 'R'):
    count += 1
  else:
    maxCount = max(count, maxCount)
    count = 0
    
print(max(count, maxCount))
# Judge status: Accepted
n =int(input())

for i in range(100//4+1):
    for j in range(100//7+1):
        if n == i*4+j*7:
            print("Yes")
            exit()

print("No")
# Judge status: Wrong Answer
#template
def inputlist(): return [int(j) for j in input().split()]
from collections import Counter
#template
#issueから始める
N,T = inputlist()
ans = 10**9
for i in range(N):
    c,t = inputlist()
    if t <= T:
        ans = min(ans,c)
if ans == 10**9+7:
    ans = 'TLE'
print(ans)
# Judge status: Accepted
n = list(str(input()))

def no():
    print('No')
    exit(0)

if n[1] != n[2]:
    no()
if n[0] != n[1] and n[2] != n[3]:
    no()
print('Yes')
# Judge status: Accepted
S, T = map(str, input().split())

ans = T + S

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

a_sum = sum(a)
ans = n-a_sum

if n >= m and ans >= 0:
    print(ans)
else:
    print(-1)
# Judge status: Accepted
X = input()
s, t = 0, 0
for i in X:
    if i=='S':
        s += 1
    else:
        if s==0:
            t += 1
        else:
            s-= 1
print(s+t)
# Judge status: Accepted
S = input()
k = int(input())
for i, s in enumerate(S, start=1):
    if s != "1":
        print(s)
        break
    if i == k:
        print(1)
        break
# Judge status: Wrong Answer
n = int(input())-1
count=0
er=0
j = 0
for i in range(1, n):
  j=i
  if i*j>n:
    break
  count+=1
  j+=1

print(count)
# Judge status: Wrong Answer
N = int(input())
A = [int(input()) for _ in range(N)]
MAX = 0
SECOND = 0
MAX_COUNT = 0
for a in A:
    if a > MAX:
        MAX = a
        MAX_COUNT = 1
    elif a == MAX:
        MAX_COUNT += 1
    if a > SECOND and a != MAX:
        SECOND = a
for a in A:
    if a == MAX and MAX_COUNT == 1:
        print(SECOND)
    elif a == MAX and MAX_COUNT > 1:
        print(MAX)
    else:
        print(MAX)
# Judge status: Accepted
n = input()
if n[0]==n[1]==n[2] or n[1]==n[2]==n[3]:
  print('Yes')
else:
  print('No')
# Judge status: Accepted
n,k = map(int,input().split())
if n % k == 0: print(0)
else: print(1)
# Judge status: Accepted
P, Q, R = map(int, input().split())
print(P+Q+R-(max(P, Q, R)))
# Judge status: Wrong Answer
S, T = [input() for i in range(2)]
ans = 0

for i in range(len(S)-len(T)):
    diff = 0

    for j in range(len(T)):
        if T[j] == S[i+j]:
            diff +=1
    ans = max(ans, diff)

print(len(T)-ans)
# Judge status: Wrong Answer
import math

X= int(input())

print(math.floor(360/X))
# Judge status: Accepted
X=int(input())
while True:
    for x in range(2,X):
        if X%x==0:
            break
    else:
        print(X)
        break
    X+=1
# Judge status: Wrong Answer
alpha_small_ = [chr(i) for i in range(97, 97+26)] #アルファベッドの小文字

n = int(input())
ans = []
def solve(now,i):
    if len(now) == n:
        ans.append(now)
        return
    for j in range(i+1):
        solve(now+alpha_small_[j],j+1)

solve("a",1)


for x in sorted(ans):
    print(x)
# Judge status: Accepted
S = str(input())
lst = ["SAT","FRI","THU","WED","TUE","MON","SUN"]
for i in range(7):
    if S == lst[i]:
        print(i+1)
        break