peterverebics/CodeNet_Python_428 huggingface dataset:
# Judge status: Accepted
n = int(input())
a = list(map(int, input().split()))
a.sort()

import bisect
import numpy as np
amax = a[-1]
cent = amax // 2

idx = bisect.bisect_left(a, cent)
if idx == len(a)-1:
    print(amax, a[-2])
else:
    max_idx = np.argmin([abs(a[idx]-cent), abs(a[idx-1]-cent)])
    if max_idx:
        print(amax, a[idx-1])
    else:
        print(amax, a[idx])
# Judge status: Accepted
f_1 = {1,3,5,7,8,10,12}
f_2 = {4,6,9,11}
 
x, y = map(int, input().split())
if (x in f_1) and (y in f_1):
  print("Yes")
elif (x in f_2) and (y in f_2):
  print("Yes")
else:
  print("No")
# Judge status: Accepted
# A - Simple Calculator
x,y = map(int,input().split())

# 初めと終わりに B を押すとき
ans1 = -y - (-x) + 2
# 初めだけ B を押すとき
ans2 = y - (-x) + 1
# 終わりだけ B を押すとき
ans3 = -y - x + 1
# B を押さないとき
ans4 = y - x

ans = [ans1,ans2,ans3,ans4]
ans = [a for a in ans if a > 0]
ans = min(ans)
print(ans)
# Judge status: Accepted
S = input()
if '7' in S:
    print('Yes')
else:
    print('No')
# Judge status: Wrong Answer
n,l=map(int, input().split())
t=0
for i in range(n):
  if i==0:
    t=abs(l+(i+1)-1)
  else:
    t=min(t, abs(l+(i+1)-1))
print(t)
# Judge status: Wrong Answer
N=int(input())
S=list(str(input()))
wesr=S[1:].count('W')
east=S[1:].count('E')
ans_min = east
ans = east
for i in range(N-1):
  if S[i]=='W':
    ans+=1
  else:
    ans-=1
  if ans < ans_min:
    ans_min = ans
print(ans_min)
# Judge status: Accepted
n, m = map(int, input().split())
a = sum(list(map(int, input().split())))
if n >= a:
    print(n-a)
else:
    print(-1)
# Judge status: Wrong Answer
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())

ans = a//10*10 + b//10*10 + c//10*10 + d//10*10 + e//10*10 + 50

for i in range(1, 10):
    for j in [a, b, c, d, e]:
        if str(j)[-1] == str(i):
            ans += i - 10
            print(ans)
            exit()
print(ans)
# Judge status: Accepted
import numpy as np
def solve(s):
    h = int(np.sqrt(s))
    if h**2 < s:
        h += 1
    d = h**2 - s
    if d == 0:
        x, y = 0, 0
    else:
        x, y = 1, d
    return " ".join(map(str, [0,0,x,h,h,y]))

s = int(input())
print(solve(s))
# Judge status: Accepted
import math
import collections
import bisect
from collections import deque
from copy import copy, deepcopy


def main():
    N = int(input())
    A = list(map(int, input().split()))
    ans = 1000
    for i in range(N - 1):
        if A[i] < A[i + 1]:
            ans += (A[i + 1] - A[i]) * (ans // A[i])

    print(ans)


if __name__ == '__main__':
    main()
# Judge status: Wrong Answer
a,b=map(int,input().split())
if a%2==b%2:
    print((a+b)/2)
else:
    print("IMPOSSIBLE")
# Judge status: Accepted
n = input()
while True:
  if len(set(list(n))) == 1:
    print(n)
    break
  n = str(int(n)+1)
# Judge status: Accepted
def main():
    import sys
    input = sys.stdin.buffer.readline
    N, K = (int(i)-1 for i in input().split())
    _ = [int(i) for i in input().split()]
    print((N + K - 1)//K)


if __name__ == '__main__':
    main()
# Judge status: Wrong Answer
# coding: utf-8
N = int(input())
A = list(map(int, input().split()))
A.reverse()
B = [0 for i in range(N)]
for i in range(N):
    tmp = 0
    for j in range(0, i+1, i+1):
        tmp += B[j]
    if A[i] % 2 != tmp % 2:
        B[i] = 1
B.reverse()
ans = []
M = sum(B)
for i in range(N):
    if B[i] == 1:
        ans.append(i+1)
print(M)
print(*ans)
# Judge status: Accepted
n = int(input())
w = [input() for i in range(n)]
lists = []
tmp = ''

for i in range(n):
    if i != 0:
        if tmp != w[i][0]:
            print('No')
            exit()
    if w[i] in lists:
        print('No')
        exit()
    lists.append(w[i])
    tmp = w[i][-1]            

print('Yes')
# Judge status: Wrong Answer
import sys
input = sys.stdin.readline


N = int(input())
start = []
end = []
itv = []
for i in range(N):
    X, L = (int(i) for i in input().split())
    itv.append([X+L-1, X-L+1])
    #start.append(X-L)
    #end.append(X+L)

#XL = [[int(i) for i in input().split()] for i in range(N)] 

#line = [0] * (2*(10**9) +1)

itv.sort()

#print(itv)

ass = 0
tt = 0-10**9
for i in range(N):
    if tt < itv[i][1]:
        ass += 1
        tt = itv[i][0]
print(ass)
# Judge status: Wrong Answer
x,y,a,b,c=map(int,input().split())
p=list(map(int,input().split()))
q=list(map(int,input().split()))
r=list(map(int,input().split()))

p.sort(reverse=True)
q.sort(reverse=True)
r.sort(reverse=True)
tmp=[]
for i in range(a):
    tmp.append(p[i])

for j in range(b):
    tmp.append(q[j])

for k in range(len(r)):
    tmp.append(r[k])

tmp.sort(reverse=True)
ans=0
for i in range(x+y):
    ans+=tmp[i]

print(ans)
# Judge status: Accepted
import sys
from math import sqrt, gcd, ceil, log, floor
from bisect import bisect, bisect_left
from collections import defaultdict, Counter, deque
from heapq import heapify, heappush, heappop
input = sys.stdin.readline
read = lambda: list(map(int, input().strip().split()))

MOD = 10**9 + 7


def main():
	# ans_ = []
	# ans_.append(ans)
	# print(("\n").join(map(str, ans_)))
	n, x, t = read()
	print(ceil(n/x)*t)






if __name__ == "__main__":
	main()
# Judge status: Wrong Answer
from collections import defaultdict
n, m = map(int, input().split())
order = []
dd = defaultdict(int)

for i in range(m):
    p, y = map(int, input().split())
    order.append([i, p, y])

# 全体を年代順にソート
order.sort(key=lambda x: (x[2]))
ans = []
for ii, pp, yy in order:
    dd[pp] += 1
    ans.append('{:0>6}{:0>6}'.format(pp, dd[pp]))

print('\n'.join(ans))
# Judge status: Accepted
s = input()
if s[0]==s[1] or s[1]==s[2] or s[2] == s[3]:
    print('Bad')
else:
    print('Good')
# Judge status: Wrong Answer
a = int(input())
print(int(a+a^2+a^3))
# Judge status: Wrong Answer
n,k = map(int,input().split())
d = dict()
for _ in range(n):
  a,b = input().split()
  b = int(b)
  if a in d.keys():
    d[a] += b
  else:
    d[a] = b
d_sorted = dict(sorted(d.items(),key=lambda x:x[0]))
now = 0
for num,cnt in d_sorted.items():
  now += cnt
  if now >= k:
    print(num)
    exit()
# Judge status: Accepted
n = int(input())
l = list(map(int, input().split()))

ans = 0
l = sorted(l)
for i in range(n):
  for j in range(i+1,n):
    for k in range(j+1,n):
      if l[i]!=l[j] and l[j]!=l[k] and l[k] != l[i]:
         if l[i]+l[j]>l[k] and l[j]+l[k]>l[i] and l[k]+l[i]>l[j]:
            ans += 1
          
print(ans)
# Judge status: Accepted
A,B,C = map(int, input().split())

list_iroha = [A,B,C]

#print(list_iroha)
if [5,7,5] == list_iroha or [7,5,5] == list_iroha or [5,5,7] == list_iroha:
  print("YES")
else:
  print("NO")
# Judge status: Wrong Answer
if int(input()) == 3 or 5 or 7:
  print('YES')
else:
  print('NO')
# Judge status: Accepted
import bisect

N = int(input())
L = list(map(int, input().split()))
L.sort()
count = 0
for a in range(N):
    for b in range(a + 1, N):
        c = bisect.bisect_left(L, L[a] + L[b])
        if c > b:
            count += c - b - 1
        else:
            break
print(count)
# Judge status: Accepted
from itertools import groupby
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

from itertools import groupby
ans = 0
p = prime_decomposition(n)
for k,g in groupby(p):
  gn = len(list(g))
  for i in range(1,1000000):
    gn -= i
    if gn >= 0:
      ans += 1
    else:
      break
print(ans)
# Judge status: Accepted
a=int(input())
l=list(map(int,input().split()))
List=[0]*(a+1)
for i in l:
  List[i]+=1
s=0
for i in List:
  s+=int(i*(i-1)/2)
for i in l:
  print(s-List[i]+1)
# Judge status: Accepted
a = list(map(int, input().split()))
k = int(input())
a.sort(reverse=True)
a[0] *= 2**k
print(sum(a))
# Judge status: Accepted
N,M,X,Y = map(int,input().split())
x = [int(i) for i in input().split()]
x.append(X)
y = [int(i) for i in input().split()]
y.append(Y)
mx_x = max(x)
mn_y = min(y)

if mx_x < mn_y:
    print('No War')
    
else:
    print('War')
# Judge status: Accepted
s,c=map(int,input().split())
if s > c//2:
   print(c//2)
   exit()
else:
   c-=s*2
s+=c//4
print(s)
# Judge status: Wrong Answer
######## Biscuits   ###########3
N = int(input())
a = [list(map(int, input().split())) for i in range(N)]
dp = [[0 for i in range(3)] for j in range(N + 1)]

for i in range(N):
    for j in range(3):
        for k in range(3):
            if j == k:
                continue
            dp[i + 1][k] = max(dp[i + 1][k], dp[i][j] + a[i][k])
            print(dp)

print(max(dp[N]))
# Judge status: Accepted
n = int(input())
s = input()
dic = {}
for i in range(n):
  if s[i] in dic:
    dic[s[i]] += 1
  else:
    dic[s[i]] = 1
ans = 1
for v in dic.values():
  ans *= (1 + v)
  ans %= 10**9 + 7
ans -= 1
print(ans)
# Judge status: Accepted
import sys
import os


def main():
    if os.getenv("LOCAL"):
        sys.stdin = open("input.txt", "r")

    a = int(sys.stdin.readline().strip())
    s = sys.stdin.readline().strip()
    
    if a >= 3200:
        print(s)
    else:
        print("red")


if __name__ == '__main__':
    main()
# Judge status: Accepted
n = int(input())
w = [input() for i in range(n)]
v = []
for i in range(n - 1):
    if w[i] not in v and w[i + 1] not in v and w[i][- 1] == w[i + 1][0]:
        v.append(w[i])
    else:
        print("No")
        break
else:
    print("Yes")
# Judge status: Accepted
from itertools import permutations as pu
n = int(input())
p = tuple([int(_) for _ in input().split()])
q = tuple([int(_) for _ in input().split()])
ls = list(pu(range(1, n + 1)))
print(abs(ls.index(p) - ls.index(q)))
# Judge status: Accepted
D=int(input())
print("Christmas"+" Eve"*(25-D))
# Judge status: Accepted

import math

n = int(input())
count = 0

for i in range(1,n+1):
    for j in range(1,n+1):
        t = math.gcd(i,j)
        for k in range(1,n+1):
            m = math.gcd(t,k)
            count += m
print(count)
# Judge status: Accepted
n,m = map(int,input().split())
a = [[0,0] for _ in range(n)]
pn = 0
ac = 0
for i in range(m):
    p, s = input().split()
    if s == "AC":
        if a[int(p)-1][1] == 0:
            a[int(p)-1][1] = 1
            pn += a[int(p)-1][0]
            ac += 1
    else:
        a[int(p)-1][0] += 1
print(ac, pn)
# Judge status: Accepted
import math

a, b = map(int, input().split())
ans = math.ceil((a + b) / 2)
print(ans)
# Judge status: Accepted
s = input()

s = list(s)
sowth = s.count('S') if 'S' in s else 0
east  = s.count('E') if 'E' in s else 0
north = s.count('N') if 'N' in s else 0
west  = s.count('W') if 'W' in s else 0

if (sowth + north != 0 and sowth * north == 0) or\
    (west + east != 0 and west * east == 0):
    print('No')
else:
    print('Yes')
# Judge status: Accepted
H, N = map(int, input().split())
A = list(map(int, input().split()))

S = sum(A)
if S >= H:
    print('Yes')
else:
    print('No')
# Judge status: Accepted
A, B, T = list(map(int, input().split()))
print(T//A*B)
# Judge status: Wrong Answer
a=int(input())
b=[]
for i in range(a):
    b.append(int(input()))
c=max(b)
if b.count(c)>1:
    for i in range(a):
        print(c)
elif b.count(c)==1:
    d=sorted(b)
    d=d[1]
    e=b.index(c)
    for i in range(a):
        if i==e:
            print(d)
        else:
            print(c)
# Judge status: Accepted
K = int(input())
S = input()

if len(S) > K:
  print(S[:K] + '...')
else:
  print(S)
# Judge status: Accepted
A,B,C=map(int,input().split())
x=A%B
y=max(A,B)
for i in range(y+1):
	if (x*i)%B==C:
		print("YES")
		exit()
print("NO")
# Judge status: Accepted
N = int(input())

# N : odd -> N**2 - 1 // 4
# N : even -> N**2 // 4
print( N ** 2 // 4)
# Judge status: Accepted
import sys
import itertools

a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
lst = [a, b, c, d, e]
ans = 1 <<10
for i in itertools.permutations(lst, 5):
    cnt = 0
    for num, j in enumerate(i):
        if num == 4:
            cnt += j
            break
        if j%10 != 0:
            cnt += 10 * (j//10) + 10
        else: cnt += j
    ans = min(ans, cnt)

print(ans)
# 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
cnt = 0
for i in range(n):
    ans += b[i]
    if i >= 1:
        if a[i] == a[i-1]+1:
            ans += c[cnt]
            cnt+=1

print(ans)
# Judge status: Accepted
import numpy as np
import sys

input = sys.stdin.readline

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

res = [0]*N
for _ in range(M):
    a,b = map(int,input().split())
    res[a-1]+=1
    res[b-1]+=1


for a in res:
    print(a)
# Judge status: Accepted
W,H,x,y = map(int, input().split())

# quad = [[0,0],[W,0],[W,H],[0,H]] 
# S = (quad[1][0]-quad[0][1]) * (quad[2][1]-quad[0][1])
S = W*H
ans = 0

if W/2 == x and H/2 == y:
    ans = 1

print(S/2 , ans)
# Judge status: Wrong Answer
N = int(input())
r = [list(map(int, input().split())) for _ in range(N)]
a = []
for i in r:
    a.append((i[0]-i[1],i[0]+i[1]))
a.sort(key=lambda x:x[1])
ans = 0
cur = -float('inf')
for i in a:
    if i[0] < cur:
        continue
    ans += 1
    cur = i[1]
print(a)
print(ans)
# Judge status: Wrong Answer
n,k,*p=map(int,open(0).read().split())
s=m=sum(p[:k])
for i in range(k,n):s+=p[i]-p[i-k];m=max(m,s)  
print((s+k)/2)
# Judge status: Wrong Answer
# coding:utf-8
n = int(input())
count = 0
ans = 0

for i in range(n):
    d1, d2 = map(int, input().split())

    if d1 == d2:
        count += 1
    else:
        ans = count
        count = 0

ans = max(ans, count)

if ans >= 3:
    print('Yes')
else:
    print('No')
# Judge status: Wrong Answer
n,m = map(int, input().split())
if n == 1 or m == 1: print(max(n,m)-2 if max(n,m)>2 else 0)
elif n==m==1: print(1)
else: print((n-2) * (m-2))
# Judge status: Accepted
X=int(input())
i=1
while i*X % 360 != 0:
	i+=1
print(i)
# Judge status: Accepted
A, B = list(map(int, input().split()))

large = A if A > B else B
small = A if A < B else B

def gcd(large, small):
    r = large % small
    while r != 0:
        large = small
        small = r
        r = large % small
    return small

print(large*small//gcd(large, small))
# Judge status: Accepted
list = list(map(int,input().split()))
i=0
while i<5:
  
  if list[i] == 0:
    print(i+1)
  i += 1
# Judge status: Accepted
n,a,b = map(int,input().split())
if a == 0:
    print(0)
else:
    print((n // min(n,a+b) * min(n,a)) + min(a,(n % min(n,(a+b)))))
# Judge status: Accepted
S = input()
print("Yes" if S[::2].count("L") + S[1::2].count("R") == 0 else "No")
# Judge status: Accepted

def myAnswer(S:list)->str:
   if(S.pop(0) !="A"): return "WA"
   flag = False
   for n,s in enumerate(S):
      if(n>=1 and n <= len(S)-2 and flag==False and s=="C"):
         flag = True
      else:
         if(s.isupper()):
            return "WA"
   return "WA" if(flag==False) else "AC"


def modelAnswer():
   tmp=1
def main():
   S = list(input())
   print(myAnswer(S))
if __name__ == '__main__':
   main()
# Judge status: Accepted
n,k=map(int, input().split())
if n%k==0:
  print("0")
else:
  print("1")
# Judge status: Accepted
s = input()
for i in range(3):
  if s[i] == s[i + 1]:
    print("Bad")
    break
else:
  print("Good")
# Judge status: Wrong Answer
N = int(input())

if N % 4 == 0 or N % 7 == 0:
    print("Yes")
    
else:
    print("No")
# Judge status: Accepted
a, b, x = list(map(int, input().split()))

print(b // x - (a - 1) // x)
# Judge status: Wrong Answer
n = int(input())
f = [0] * (n + 1)
t = int(n ** .5) + 3
for i in range(1, t):
    for j in range(1, t):
        for k in range(1, t):
            res = i ** 2 + j ** 2 + k ** 2 + i * j + j * k + k * i
            if res <= n:
                f[res] += 1
print('\n'.join(map(str, f)))
# Judge status: Accepted
n = int(input())
list_a = []
list_b = []
su = 0
for i in range(n):
  a,b = map(int,input().split())
  list_a.append(a)
  list_b.append(b)
list_a = list_a[::-1]
list_b = list_b[::-1]
for i in range(n):
  list_a[i] += su
  if list_a[i]%list_b[i]==0:
    continue
  else:
    x = list_b[i]-(list_a[i]%list_b[i])
    su += x
#  print(list_a)
print(su)
# Judge status: Accepted
N,M = map(int,input().split())
# 偶数 = 偶数＋偶数 or 奇数＋奇数
print(N*(N-1)//2 + M*(M-1)//2)
# Judge status: Accepted
import collections
_ = input()
A = collections.Counter(int(T) for T in input().split()).most_common()
Num4 = sum(A[T][1] for T in range(0,len(A)) if A[T][0]%4==0)
Num2 = sum(A[T][1] for T in range(0,len(A)) if A[T][0]%4!=0 and A[T][0]%2==0)
Odd  = sum(A[T][1] for T in range(0,len(A)) if A[T][0]%2!=0)
if Num2>0: Capacity = Num4
else: Capacity = Num4+1
if Capacity>=Odd: print('Yes')
else: print('No')
# Judge status: Accepted
n,a,b=map(int,input().split())
s=list(input())
nover=0
tot=0
for i in range(n):
    if tot<a+b:
        if s[i]=='a':
            print('Yes')
            tot+=1
        elif s[i]=='b' and nover<b:
            print('Yes')
            nover+=1
            tot+=1
        else:
            print('No')
    else:
        print('No')
# Judge status: Accepted
from heapq import*
(N,M),*t=[map(int,s.split())for s in open(0)]
z,*q=[0]*50*M
v=[[]for _ in q]
for a,b in t:v[a-1]+=b,
for i in v[:M]:[heappush(q,-j)for j in i];z-=heappop(q)
print(z)
# Judge status: Accepted
# 頭から順にaに変えていく

import sys
readline = sys.stdin.readline

S = list(readline().rstrip())
K = int(readline())

z = ord("z")
for i in range(len(S) - 1):
  # aにするためのコストを求める
  if S[i] == "a":
    continue
  cost = z + 1 - ord(S[i])
  if cost <= K:
    S[i] = "a"
    K -= cost

K %= 26
nex = ord(S[-1]) + K
if nex > ord("z"):
  nex -= 26
S[-1] = chr(nex)

print("".join(S))
# Judge status: Wrong Answer
n,k = map(int,input().split())
if n%k == 0:
  print(0)
else:
  if n>= k:
    print(n%k)
  else:
    print(1)
# Judge status: Accepted
n=int(input())
print(n*800-(n//15)*200)
# Judge status: Accepted
N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
total = 0
for i in range(N):
    total += min(A[i], B[i])
    B[i] -= min(A[i], B[i])
    A[i] -= min(A[i], B[i])
    total += min(A[i+1], B[i])
    A[i+1] -= min(A[i+1], B[i])

print(total)
# Judge status: Accepted
n,t=map(int,input().split())
ct=[list(map(int,input().split())) for i in range(n)]
c=10000000000000000
for i in range(n):
    if ct[i][1]<=t:
        c=min(c,ct[i][0])
print(c if c!=10000000000000000 else "TLE")
# Judge status: Accepted
s=input()
if s[2]==s[3] and s[4]==s[5]:
  print("Yes")
else:
  print("No")
# Judge status: Wrong Answer
a,b,k=map(int,input().split())
ans=[]
for i in range(a,min(a+k,b+1),1):
    ans.append(i)
for i in range(b,max(a,b-k+1),-1):
    ans.append(i)
ans=list(set(ans)) #重複を削除
ans.sort() #ソート
for i in ans:
    print(i)
# Judge status: Wrong Answer
K = int(input())
count = 0
for sev in range(10**3):
  sev = sev *10 + 7
  count += 1
  if K % sev == 0:
    pass
  elif sev >10**6:
    count = -1
    pass
print(count)
# Judge status: Wrong Answer
import sys
from functools import lru_cache

@lru_cache(maxsize=None)
def gcd(a, b):
    if a % b == 0:
        return b
    else:
        return gcd(b, a % b)


N, *A = map(int, sys.stdin.read().split())
L, R = [0] * (N + 1), [0] * (N + 1)
for i in range(N):
    L[i + 1] = gcd(L[i], A[i])
    R[-i - 2] = gcd(R[-i - 1], A[-i - 1])


res = 1
for i in range(N - 1):
    tmp = gcd(L[i], R[i + 1])
    if res < tmp:
        res = tmp
print(res)
# Judge status: Wrong Answer
N = int(input())
P = list(map(int, input().split()))
index = []

for i, p in enumerate(P):
    index.append(p-(i+1))
    
ans = 0
seq = 0
for i in index:
    if i == 0:
        ans += 1
        seq += 1
    else:
        if seq > 1:
            ans -= (seq-1)
        seq = 0

if seq > 1:
    ans -= (seq-1)
print(ans)
# Judge status: Wrong Answer
k, m =map(int, input().split())
n = int(k / 2)
answer = [m]
for i in range(1, n + 2):
    answer.append(m - i)
    answer.append(m + i)
answer.sort()
if k == 1:
    answer = [m]
print(*answer)
# Judge status: Accepted
import bisect,collections,copy,heapq,itertools,math,string
import sys
def S(): return sys.stdin.readline().rstrip()
def M(): return map(int,sys.stdin.readline().rstrip().split())
def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
def LS(): return list(sys.stdin.readline().rstrip().split())
a, b, t = M()
print((t//a)*b)
# Judge status: Accepted
import sys


def input(): return sys.stdin.readline().strip()
def I(): return int(input())
def LI(): return list(map(int, input().split()))
def IR(n): return [I() for i in range(n)]
def LIR(n): return [LI() for i in range(n)]
def SR(n): return [S() for i in range(n)]
def S(): return input()
def LS(): return input().split()


INF = float('inf')


n = I()
w = LI()
t = float('inf')
s_1 = 0
s_2 = sum(w)
for i in range(n):
    s_1 += w[i]
    s_2 -= w[i]
    t = min(t, abs(s_1 - s_2))
print(t)
# Judge status: Wrong Answer
k=int(input())
l=k//2
if k%2==0:print((k/2)**2)
else:print((l+1)*l)
# Judge status: Accepted
n = int(input())
s = input()
counter_l = 0
pairs = 0
double_check = set()

for i in range(n):
    if s[i] == "(":
        counter_l += 1
        for j in range(i + 1, n):
            if s[j] == ")" and j not in double_check:
                pairs += 1
                double_check.add(j)
                break
counter_r = n - counter_l
s = s + ")" * (counter_l - pairs)
s = "(" * (counter_r - pairs) + s

print(s)
# Judge status: Accepted
import sys
import math

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

count = min(M//2, N)
M -= count*2
print(count + M//4)
# Judge status: Accepted
a = input()

result =0

if a[0]=="1":
	result +=1
if a[1]=="1":
	result +=1
if a[2]=="1":
	result +=1
    
print(result)
# Judge status: Wrong Answer
N = int(input())
L = list(map(int, input().split()))
a = 0
if N > 2:
    for i in range(N):
        for j in range(i+1, N):
            for k in range(j+1, N):
                if L[i] == L[j] or L[i] == L[k] or L[j] == L[k]:
                    continue
                if L[i] + L[j] > L[k] and L[i] + L[k] > L[j] and L[j] + L[k] >= L[i]:
                    a = a + 1
print(a)
# Judge status: Wrong Answer
n = int(input())
arr = [int(s) for s in input().split(" ")]


def calculate(n,arr):

    for ar in arr:
        if ar % 2 == 0:
            s1 = ar % 3
            s2 = ar % 5
            if (s1 == 0) or (s2 == 0):
                print("APPROVED")
                return
            else:
                print("DENIED")
                return

    print("DENIED")

calculate(n,arr)
# Judge status: Wrong Answer
n=int(input())
a=list(map(int,input().split()))
x={}
edge=[0]*2
for i in a:
  if i in x:
    if x[i]==1:
      edge.append(i)
      x[i]=0
  else:
    x[i]=1
edge.sort(reverse=True)
print(edge[0]*edge[1])
# Judge status: Wrong Answer
n, m = map(int, input().split())
a = list(map(int, input().split()))
if (n+m) % m == 0:
    print("Yes")
else:
    print("No")
# 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
sx,sy,tx,ty = map(int,input().split())
dx = tx-sx
dy = ty-sy
a = ['U','R','D','L']
print(
    a[0]*dy+
    a[1]*dx+
    a[2]*dy+
    a[3]*(dx+1)+
    a[0]*(dy+1)+
    a[1]*(dx+1)+
    a[2]+a[1]+
    a[2]*(dy+1)+
    a[3]*(dx+1)+
    a[0]
)
# Judge status: Accepted
from math import ceil, log2
n, k = map(int, input().split())
X = (ceil(log2(k / (i+1))) if ceil(log2(k / (i+1))) > 0 else 0 for i in range(n))
print(sum(0.5 ** x / n for x in X))
# Judge status: Accepted
n ,l = map(int, input().split())
apple = []
for i in range(n):
    apple.append(l + i)

min_num = 10 ** 5
sum_num = sum(apple)
ans = 0
for i in range(n):
    tmp = abs(sum_num - (sum_num - apple[i]))
    if tmp < min_num:
        min_num = min(tmp, min_num)
        flag = apple[i]
        ans = sum_num - apple[i]

print(ans)
# Judge status: Wrong Answer
n, r = map(int, input().split())

if n < 10:
	print(r)
else:
  print(r + 800)
# Judge status: Accepted
def main():
    K = int(input())
    oddnum = K//2
    evennum = K//2 + K%2
    ans = oddnum*evennum
    return ans
print(main())
# Judge status: Wrong Answer
S = list(input())
T = list(input())

if sorted(S) == sorted(T):
    print('Yes')
else:
    print('No')
# Judge status: Accepted
n=int(input())
a=[]
b=[]
for i in range(n):
    x,y=map(int,input().split())
    a.append(x+y)
    b.append(x-y)
a=sorted(a)
b=sorted(b)
ans=max(a[-1]-a[0],b[-1]-b[0])
print(ans)