peterverebics/CodeNet_Python_428 huggingface dataset:
# Judge status: Accepted
n = int(input())
x = n % 1000
if x == 0:
    print(0)
else:
    print(1000-x)
# Judge status: Accepted
n, k = map(int, input().split())
rest = n % k
print(min(rest, k - rest))
# Judge status: Accepted
n=int(input())
a=list(map(int,input().split()))

color=[]
free=0
Sans,Mans=0,0
for i in a:
    if i//400<8 and i//400 not in color:
        color.append(i//400)
        Sans+=1
    elif i>=3200:
        free+=1
        
#Mans=Sans
#if free+Sans>=8:
 #   Mans=8
#else:
 #   Mans=Sans+free

Mans=Sans+free
if Sans==0:
    Sans=1
print(Sans,Mans)
# Judge status: Accepted
import sys
input = sys.stdin.readline
def calc(A, B, C, K):
    sum = 0
    if K>A:
        sum += A
        K = K-A
    else:
        sum = K
        return sum
    if K>B:
        K = K - B
    else:
        return sum
    sum = sum - K
    return sum


def main():
    A, B, C, K = map(int, input().split())
    sum = calc(A,B,C,K)
    print(sum)

    

if __name__ == '__main__':
    main()
# Judge status: Wrong Answer
n=int(input())
ans=0
a=[]
for i in range(n):
  a.append(list(map(int,input().split())))
for i in reversed(range(n)):
  if a[i][1] != 1 and a[i][0] != 0:
    a[i][0] += ans
    ans += a[i][1] - a[i][0] % a[i][1]
print(ans)
# Judge status: Wrong Answer
def main():
    import numpy as np
    import sys
    input = sys.stdin.readline

    n,w = map(int,input().split())
    l = [list(map(int,input().split())) for i in range(n)]

    dp = np.zeros((n+1,w+1),dtype="int64")
    for i in range(n):
        dp[i+1,l[i][0]:] = np.maximum(dp[i,l[i][0]:],dp[i,-l[i][0]]+l[i][1])
    print(dp[n][w])

if __name__ == "__main__":
    main()
# Judge status: Accepted
from collections import deque

K = int(input())
queue = deque(range(1, 10))

for i in range(K):
    x = queue.popleft()
    shimo1keta = x % 10
    if shimo1keta != 0:
        queue.append(x * 10 + shimo1keta - 1)
    queue.append(x * 10 + shimo1keta)
    if shimo1keta != 9:
        queue.append(x * 10 + shimo1keta + 1)

print(x)
# Judge status: Accepted
l1 = []
for _ in range(6):
  l1.append(int(input()))
 
if (l1[4] - l1[0]) > l1[5]:
  r = ':('
else:
  r = 'Yay!'
  
  
print(r)
# Judge status: Accepted
from collections import deque
n,m = map(int,input().split())
g = [[] for _ in range(n)]
for i in range(m):
    a,b = map(int,input().split())
    g[a-1].append(b-1)
    g[b-1].append(a-1)
q = deque([0])
d = [-1]*n
d[0] = 0
while q:
    v = q.popleft()
    for i in g[v]:
        if d[i] != -1:
            continue
        d[i] = v
        q.append(i)
if -1 in d:
    print("No")
else:
    print("Yes")
    for i in d[1:]:
        print(i+1)
# Judge status: Accepted
# -*- coding: utf-8 -*-
x = int(input())
print(0 if x == 1 else 1)
# Judge status: Wrong Answer
N = int(input())

L = map(int, input().split())
L = list(set(L))
L.sort()
ret = 0
N_ = len(L)
if N_ >= 3:
  for i in range(N_ - 2):
    for j in range(i + 1, N_ - 1):
      for k in range(j + 1, N_):
        if L[i] + L[j] < L[k]:
          ret += 1
print(ret)
# Judge status: Accepted
N, M, K = map(int, input().split())
if K % N == 0 or K % M == 0:
    print('Yes')
    exit()
candidates = set()
for i in range(1, N):
    curr = i * M
    for j in range(1, M):
        curr += N - 2 * i
        candidates.add(curr)
print('Yes') if K in candidates else print('No')
# Judge status: Accepted
c = input()
print("vowel" if c in ["a", "e", "i", "o", "u"] else "consonant")
# Judge status: Accepted
a,b=list(map(int,input().split()))
if a<=b:
  print(a)
else:
  print(a-1)
# Judge status: Accepted
import math
s = list(map(int, input().split()))
n=s[0]
k=s[1]-1
s = list(map(int, input().split()))
ind=s.index(1)
# print(ind,n-ind-1,math.ceil(ind/k),math.ceil((n-ind-1)/k))
print(math.ceil((n-1)/(k)))
# Judge status: Accepted
a,b,c = map(int,input().split())
if b-c>=0:
    print("delicious")
elif a+b-c>=0:
    print("safe")
else:
    print("dangerous")
# Judge status: Accepted
import heapq

N,M = (int(x) for x in input().split())
AB = []
sum = 0

for i in range(N):
    a,b = (int(x) for x in input().split())
    AB.append([a,b])

AB = sorted(AB , key = lambda x : x[0])
heap = []
heapq.heapify(heap)
j = 0

for i in range(M+1):
    while j<N and AB[j][0] < i+1:
        heapq.heappush(heap,-AB[j][1])
        j += 1

    if len(heap):
        sum += -heapq.heappop(heap)
                           
print(sum)
# Judge status: Wrong Answer
A,B,C = map(int,input().split())
if A%2==0 or B%2==0 or C==0:
  print(0)
else:
  print(A*B*C//max({A,B,C}))
# Judge status: Accepted
import math
n = int(input())
d = math.floor(math.log(1+(26-1)*n, 26))
position = int(n - (26**d - 1) / (26  - 1))
txt = list('a' * d)
for i in range(d):
    txt[d - i - 1] = chr(ord(txt[d - i - 1])+(position % 26))
    position = position // 26
print(''.join(txt))
# Judge status: Accepted
x,y=map(int,input().split())
mod=pow(10,9)+7
x_=(2*x-y)
y_=(2*y-x)
if x_<0 or y_<0 or x_%3!=0 or y_%3!=0:
  print(0)
  exit()
x_//=3
y_//=3
n=x_+y_
r=min(x_,y_)

a,b=1,1
for i in range(r):
  a*=n-i
  a%=mod
  b*=i+1
  b%=mod
c=(a*pow(b,mod-2,mod))%mod
print(c)
# Judge status: Accepted
from bisect import bisect_right
 
n=int(input())
lst=[1]
lst2=[1]
for i in range(1,41):
  lst.append(2**i)
  lst2.append(lst2[i-1]+lst[i])
  
ind=bisect_right(lst,n)
print(lst2[ind-1])
# Judge status: Wrong Answer
S=input()
l="keyence"
i=0
for j in S:
  if j==l[i]:
    if i==6:
      print("YES")
      break
    else:
      i+=1
else:
  print("NO")
# Judge status: Accepted
s = input()
n = len(s)

def f(s):
    return s == s[::-1]

if f(s) and f(s[:(n-1)//2]) and f(s[(n+3)//2-1:]):
    print("Yes")
else:
    print("No")
# Judge status: Wrong Answer
import itertools

n = int(input())
a = [int(i) for i in input().split()]
l = list(itertools.permutations(a, 2))
ans = 0
for i in range(len(l)):
  for j in range(i+1, n):
    if j-i == l[i][1]+l[i][0]:
      ans += 1
  
print(ans)
# Judge status: Wrong Answer
h, w = map(int,input().split())
if h == 1 or w == 1:
    print(1)
if h%2 == 1 and w%2 == 1:
    print((h*w+1)//2)
else:
    print(h*w//2)
# Judge status: Wrong Answer
import sys
readline = sys.stdin.readline
sys.setrecursionlimit(10**8)
mod = 10**9+7
#mod = 998244353
INF = 10**18
eps = 10**-7

a,b,x=map(int,input().split())
v=a*a*b-x
maxh=v/(a*a)*2
import math
print(math.degrees(math.atan(maxh/a)))
# Judge status: Accepted
N=int(input())
S=input()
x=0
X=[0]
for i in S:
    if i=="I":
        x+=1
        X.append(x)
    else:
        x-=1
        X.append(x)
print(max(X))
# Judge status: Accepted
N = int(input())
counter = [51]*26
for i in range(N):
    s = input()
    for j in range(97,123):
        counter[j-97] = min(counter[j-97],s.count(chr(j)))
ps = ''
for i in range(26):
    ps += chr(i+97)*counter[i]
print(ps)
# Judge status: Accepted
#54
a,b=map(int,input().split())
if ((a==1 and b!=1) or (a>b and b!=1)):
    print('Alice')
elif ((b==1 and a!=1) or (b>a and a!=1)):
    print('Bob')
else:
    print('Draw')
# Judge status: Accepted
def resolve():
    N = int(input())
    T, A = [int(i) for i in input().split()]
    H = [int(i) for i in input().split()]
    absList = []
    for i in range(N):
        absList.append((abs(A - (T - (H[i] * 0.006))), i))
    print(min(absList)[1] + 1)


resolve()
# Judge status: Wrong Answer
import math
N = int(input())
S = N / 1.08
if math.ceil(S) * 1.08 != N:
  print(":(")
else:
  print(math.ceil(S))
# Judge status: Wrong Answer
a,b = map(int,input().split())
c = a*b % 2
if c == 0:
    print("even")
else:
    print("odd")
# Judge status: Accepted
n, a, b = map(int, input().split())

if a + 2 < b:
    if n < a:
        print(n + 1)
    else:
        n -= a - 1
        if n % 2 == 0:
            print(n//2 * (b - a) + a)
        else:
            print(n//2 * (b - a) + 1 + a)
else:
    print(n + 1)
# Judge status: Wrong Answer
h,a=map(int,input().split())
count=0
while h>=0:
  h-=a
  count+=1
print(count)
# Judge status: Wrong Answer
n, k = map(int, input().split())
a = list(map(int, input().split()))

sum_tmp = sum(a[:k])
sum_max = sum_tmp
for i in range(3,len(a)):
    sum_tmp += a[i] - a[i-k]
    if sum_tmp > sum_max:
        sum_max = sum_tmp
print((sum_max + k)/2)
# Judge status: Accepted
x=int(input())
s=0
while x>=500:
    x-=500
    s+=1000
while x>=5:
    x-=5
    s+=5
print(s)
# Judge status: Accepted
n = int(input())
A = [int(input()) for _ in range(n)]
# print(A)
mf = max(A)
cnt_mf = A.count(mf)

if cnt_mf > 1:
    for _ in range(n):
        print(mf)
    exit()

Aset = set(A)
# print(Aset - {mf})
ms = max((Aset - {mf}))
# print(ms)

for e in A:
    if e != mf:
        print(mf)
    else:
        print(ms)
# Judge status: Accepted
n = int(input())
a = [int(x) for x in input().split()]

ans = 1
up = None

for i in range(n-1):
    if up == None:
        if a[i] == a[i+1]:
            continue
        elif a[i] < a[i+1]:
            up = True
        else:
            up = False
    elif up and a[i] > a[i+1]:
        up = None
        ans += 1
    elif not up and a[i] < a[i+1]:
        up = None
        ans += 1
print(ans)
# Judge status: Accepted
import fractions
N = int(input())
T = []
for i in range(N):
    T.append(int(input()))
X = T[0]
for i in range(1, N):
    X = X*T[i] // fractions.gcd(X, T[i])
print(X)
# Judge status: Wrong Answer
W, H, N = [int(i) for i in input().split()]

xya = []

for _ in range(N):
    xya.append([int(i) for i in input().split()])

xmin = 1
ymin = 1
xmax = W
ymax = H

for i in xya:
    if i[2] == 1:
        xmin = max(xmin, i[0])
    elif i[2] == 2:
        xmax = min(xmax, i[0])
    elif i[2] == 3:
        ymin = max(ymin, i[1])
    else:
        ymax = min(ymax, i[1])

s = (xmax - xmin) * (ymax - ymin)

if s > 0:
    print(s)
else:
    print(0)
# Judge status: Accepted
n,k=map(int,input().split())
h=[int(input()) for _ in range(n)]
h.sort()
ans=max(h)
for i in range(n-k+1):
    tmp=h[i+k-1]-h[i]
    ans=min(ans,tmp)
print(ans)
# Judge status: Accepted
l = list(map(int, input().split()))
l.sort()

max_v = l[2]
mid_v = l[1]
min_v = l[0]

count = max_v - mid_v
mid_v = max_v
min_v = min_v + count
diff = max_v - min_v

if diff == 0:
    count = count
elif diff == 1:
    count += 2  # ope2 and ope1
elif diff > 1 and diff % 2 == 0:
    count += diff / 2
elif diff > 1 and diff % 2 == 1:
    count += int(diff / 2)
    count += 2
else:
    print("Error")
print(int(count))
# Judge status: Wrong Answer
N=int(input())
s=str(input())
t=str(input())
cnt=0

for i in range(min(len(s),len(t))):
    if s[-1-i]==t[i]:
        cnt+=1
    else:
        break
st=s[:len(s)-cnt+1]+t[cnt:]
if s==t:
    st=s
print(len(st))
# Judge status: Accepted
n,a,b = map(int,input().split())
c = 0
for i in range(1,n+1):
    s = 0
    d = i
    while d!=0:
        s+= d%10
        d//=10
    if a<=s<=b:
        c+=i
print(c)
# Judge status: Accepted
import math
p=int(input())
ll=["a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"]
a=0
n=0
prevn=0

while n<1000000000000001:
  a+=1
  prevn=n
  n+=26**a
  if n>=p:
    break
    
p2=p-prevn-1

al=""
for i in range(a):
  s1=math.floor(p2/(26**(a-i-1)))
  al=al+ll[s1]
  p2=p2%26**(a-i-1)

print(al)
# Judge status: Accepted
n = int(input())
flag = 0
max_ = 0
for i in range(n):
    d = list(map(int, input().split()))
    if d[0] == d[1]:
        flag += 1
    else:
        flag = 0

    if max_ < flag:
        max_ = flag

if max_ >= 3:
    print("Yes")
else:
    print("No")
# Judge status: Accepted
import random
D = int(input())
C = list(map(int, input().split()))
S = [list(map(int, input().split())) for _ in range(D)]

score = 0
last_day = [-1] * 26
for d in range(D):
    print(d % 26 + 1)
# Judge status: Accepted
s=input()

s=list(s)
    
alf = [chr(ord('a') + i) for i in range(26)]

for i in alf:
    if i not in s:
        print(i)
        exit()
print('None')
# Judge status: Wrong Answer
n=int(input())
gou=0
goub=0
ke = n
for i in range(n):
  b=n-i
  while i:
    gou += i%10
    i= i//10
  while b:
    goub += b%10
    b= b//10
  kei=gou+goub
  if ke > kei:
    ke=kei
print(ke)
# Judge status: Wrong Answer
a,b = map(float, input().split())
b100 = int(b*100)
ab = int(a*b100)
print(str(ab)[:-2])
# Judge status: Accepted
n,k = map(int,input().split())
a = [int(i) for i in input().split()]

b = a.index(1) 
ans = 0
b -= (k-1)
if b < 0:
    b = a.index(1) + abs(b)
if b > n-1 -(k-1):
    b -= b- (k-1)
c,d = divmod(b,k-1)
ans += c
if d != 0:
    ans +=1
e,f = divmod(n-1 - b,k-1)
ans += e
if f != 0:
    ans +=1
if d != 0 and f != 0 and d + f <= k-1:
    ans -=1
print(ans)
# Judge status: Wrong Answer
a,b=map(int, input().split())
print(int(a*b/2) if a*b/2%2==0 else "IMPOSSIBLE")
# Judge status: Wrong Answer
n,m=map(int,input().split())

cnt=0

m=m-2*n
cnt+=n

num=m//4
cnt+=num
  
print(cnt)
# Judge status: Wrong Answer
n = int(input())
aL = sorted(list(map(int, input().split(" "))))

s = set()

oddOnly = True
gOnly = True
for a in aL:
    if a % 2 == 1:
        gOnly = False
    if a % aL[0] != 0:
        oddOnly = False
    s.add(a)

if oddOnly:
    print(min(aL))
elif gOnly:
    print(2)
else:
    print(1)
# Judge status: Accepted
import sys
import decimal

a,b = input().split()
Da = decimal.Decimal(a)
Db = decimal.Decimal(b)
res = Da*Db

print(int(res))
# Judge status: Wrong Answer
n=int(input())
inf=float("inf")
DP=[inf]*(n+1)
DP[0]=0

for i in range(1,n+1):
    for P in (6,9):
        cnt=1
        while P**cnt<=i:
            DP[i]=min(DP[i-1]+1,DP[i-P**cnt]+1,DP[i])
            cnt +=1

print(DP[n])
# Judge status: Accepted
N = int(input())
S = input()

w = S.count('.')
b = N - w
ans = min(w, b)
l, r = 0, w

for si in S:
    if si == '#':
        l += 1  # 現時点iも含め左側に存在する黒の数
    else:
        r -= 1  # 現時点iも含め右側に存在する白の数
    ans = min(ans, l+r)

print(ans)
# Judge status: Accepted
import sys

sys.setrecursionlimit(10 ** 7)
input = sys.stdin.readline
f_inf = float('inf')
mod = 10 ** 9 + 7


def resolve():
    n = int(input())
    A = list(map(int, input().split()))

    Color = [0] * 9
    for a in A:
        if a >= 3200:
            Color[-1] += 1
        else:
            Color[a // 400] = 1

    mi = sum(Color[:8]) + (1 if sum(Color[:8]) == 0 and Color[8] > 0 else 0)
    ma = sum(Color[:8]) + Color[8]

    print(mi, ma)


if __name__ == '__main__':
    resolve()
# Judge status: Accepted
k, x = map(int, input().split())

if k*500 >= x:
    print('Yes')
else:
    print('No')
# Judge status: Accepted
x=int(input())
print(str(int(x/500)*1000+int((x%500)/5)*5))
# Judge status: Accepted
a,b,c = map(int,input().split())
if(c-b>a): 
  print("dangerous")
elif(c-b<=0): 
  print("delicious")
else:
  print("safe")
# Judge status: Accepted
import re
A, B = map(int, input().split())
S = input()
n_pattern = "[0-9]"
res  = "Yes"
for i in range(A+B+1):
  if i < A:
    if re.match(n_pattern, S[i]) is None:
      res = "No"
      break
  elif i == A:
    if S[i] != "-":
      res = "No"
      break
  else:
    if re.match(n_pattern, S[i]) is None:
      res = "No"
      break
  
print(res)
# Judge status: Accepted
N = int(input())
A = list(map(int, input().split()))

p = int(1e9 + 7)

result = 0
total = 0
for i in range(N - 1, 0, -1):
    total = (total + A[i]) % p
    result = (result + A[i-1] * total) % p
print(result)
# Judge status: Wrong Answer
n = int(input())
s = input()
ans = ""
l=r=0
for i in range(n):
    if s[i]=="(": l+= 1
    else: r += 1
    if i+1 < n and s[i]+s[i+1]== ")(":
        ans += "("*max(l,r) + ")"*max(l,r)
        l=r=0
if max(l,r) != 0:ans += "("*max(l,r) + ")"*max(l,r)
print(ans)
# Judge status: Accepted
N, M, X, Y = map(int, input().split())
x = [int(_) for _ in input().split()]
y = [int(_) for _ in input().split()]

x_max = max(x)
y_min = min(y)

if (y_min-x_max > 0) and (Y-X > 0) and (X<y_min) and (x_max<Y):
    print("No War")
else:
    print("War")
# Judge status: Wrong Answer
a,b = map(int,input().split())
s = input()
if s[a:a+1] == '-' and s[0:a].isdecimal() and s[a+1:b+1].isdecimal():
  print('Yes')
else:
  print('No')
# Judge status: Wrong Answer
#!/usr/bin/env python3
n,x = map(int,input().split())	
a = list(map(int,input().split()))
ans = 0
for i in range(n-1):
    ans += max(0,a[i]+a[i+1]-x)
    a[i+1] -= max(0,a[i]+a[i+1]-x)
print(ans)
# Judge status: Accepted
a=int(input())
if a%2!=0:
  print((a//2+1)*(a//2))
else:
  print((a//2)*(a//2))
# Judge status: Wrong Answer
N = int(input())

A = [0] * N
B = [0] * N

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

A.sort()
B.sort()

print(A, B)
if N % 2 == 0:
    n1 = N // 2 - 1
    n2 = N // 2
    ans = B[n1] - A[n1] + B[n2] - A[n2] + 1
    print(ans)

else:
    n = N // 2
    ans = B[n] - A[n] + 1
    print(ans)
# Judge status: Accepted
n=int(input())
p=list(map(int,input().split()))
ans=0
for i in range(1,n-1):
  pref = sorted(p[i-1:i+2])
  if pref[1] == p[i]:
    ans+=1
print(ans)
# Judge status: Accepted
x,y=map(int,input().split());print((x+1)*(x%y>0)-1)
# Judge status: Accepted
import sys
input = sys.stdin.readline

n = int(input())

max1 = 0
max2 = 0
maxindex = -1

for i in range(n):
    a = int(input())
    if a >= max1:
        max2 = max1
        max1 = a
        maxindex = i
    elif a >= max2:
        max2 = a

out = [max1] * n
out[maxindex] = max2

for m in out:
    print(m)
# Judge status: Accepted
N = int(input())
a = [int(input())-1 for _ in range(N)]

ans,i = 0,0
check = [0]*N

while i != 1:
  check[i] += 1
  if check[i] > 1:
    ans = -1
    break
  ans += 1
  i = a[i]

print(ans)
# Judge status: Accepted
s = int(input())
A = [s]
ans = 1
while True:
    A.append(A[-1]//2 if A[-1]%2 == 0 else A[-1]*3+1)
    ans += 1
    if A.count(A[-1]) > 1:
        break
print(ans)
# Judge status: Accepted
n = int(input())
s = input()
ans = ''

for i in range(len(s)):
    next = ord(s[i]) + n
    if next > ord('Z'):
        next -= 26
    ans += (chr(next))

print(ans)
# Judge status: Accepted
n, m, x, y = map(int, input().split())
xs = list(map(int, input().split()))
ys = list(map(int, input().split()))

xx = max(xs)
yy = min(ys)

for i in range(x+1,y+1):
  if xx < i <= yy:
    print('No War')
    break
else:
  print('War')
# Judge status: Accepted
A,B,K = map(int, input().split())

l = []

for i in range (1, min(A,B)+1):
    if A % i== 0 and B % i == 0:
        l.append(i)
print(l[-K])
# Judge status: Wrong Answer
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.readline())
rm = lambda: map(int, sys.stdin.buffer.readline().split())
rl = lambda: list(map(int, sys.stdin.readline().split()))
inf = float('inf')
mod = 10**9 + 7

n, m = rm()
l = 0
r = inf
for _ in range(m):
  a, b = rm()
  l = max(a, l)
  r = min(b, r)
print(r-l+1)
# Judge status: Accepted
import math
import itertools
import numpy as np

def div(n):
    c = 0
    for i in range(1,n+1):
        if n % i == 0:
            c += 1
    return c

def solve():
    n = int(input())
    ans = 0
    for i in range(1,n+1):
        if div(i) == 8 and i % 2 == 1:
            ans += 1
    print(ans)
    return 0

if __name__ == "__main__":
    solve()
# Judge status: Wrong Answer
n =int(input())
print(n*800+200*(n+14)//15)
# Judge status: Wrong Answer
r = input()

pi = 3.1415926535

R = int(r) * pi

print(R)
# Judge status: Accepted
N,M = map(int,input().split())
x = set()
y = set()

for m in range(M):
    a,b = map(int,input().split())
    if a==1:
      x.add(b)
    if b==N:
      y.add(a)

if x&y:
  print("POSSIBLE")
else:
  print("IMPOSSIBLE")
# Judge status: Accepted
import math
N=int(input())
d=[]
l=[]
for i in range(N):
  x,y=map(int,input().split())
  l.append([x,y])
for i in range(N-1):
  for j in range(i+1,N):
    x1,y1=l[i][0],l[i][1]
    x2,y2=l[j][0],l[j][1]
    d.append(math.sqrt((x1-x2)**2+(y1-y2)**2))
print(2*sum(d)/N)
# Judge status: Accepted
def main():
    N = int(input())
    A = list(map(int, input().split()))
    temp = A[0]
    su = 0
    for i in range(1, N):
        if A[i - 1] > A[i]:
            su += A[i - 1] - A[i]
            A[i] = A[i - 1]
    print(su)


if __name__ == '__main__':
    main()
# Judge status: Wrong Answer
n = int(input())
x = 0

for i in range(n):
    a, b = map(int, input().split())
    if a == b:
        x += 1
        
if x >= 3:
    print('Yes')
else:
    print('No')
# Judge status: Accepted
n, m = map(int, input().split())

l = [0] * n
for i in range(m):
    a, b = map(int, input().split())
    l[a-1] += 1
    l[b-1] += 1

for i in range(n):
    print(l[i])
# Judge status: Accepted
d,n=map(int,input().split())
x=n*(100**d)
print(x if n%100!=0 else x+(100**d))
# 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()

xy = p[:x] + q[:y]
xy.sort()
j=0
for i in range(x+y):
    if j==c: break
    if xy[i]<r[j]:
        xy[i]=r[j]
        j+=1
    else:
        break
print(sum(xy))
# Judge status: Wrong Answer
N, K = map(int, input().split())

max = N // K
min = N % K

if min == 0:
    print(0)
else:
    print(max-min)
# Judge status: Accepted
import itertools
A,B,C = list(map(int, input().split()))
K = int(input())
ans = False
for p in itertools.product(['a','b','c'], repeat=K):
    A0,B0,C0 = A,B,C
    for e in p:
        if e == 'a':
            A0 = 2*A0
        elif e == 'b':
            B0 = 2*B0
        else:
            C0 = 2*C0
    if A0 < B0 < C0 :
        ans = True
        break
print('Yes' if ans else 'No')
# Judge status: Accepted
s=[input()]
q=int(input())
turn=True
l=""
for i in range(q):
    qq=input().split()
    if qq[0]=='1':
        turn=not turn
    else:
        if turn==bool(int(qq[1])-2):
            l+=qq[2]
        else:
            s.append(qq[2])

text=l[::-1]+"".join(s)
print(text if turn else text[::-1])
# Judge status: Wrong Answer
def make_divisors(n):
    lower_divisors , upper_divisors = [], []
    i = 1
    while i*i <= n:
        if n % i == 0:
            lower_divisors.append(i)
            if i != n // i:
                upper_divisors.append(n//i)
        i += 1
    return lower_divisors + upper_divisors[::-1]



if __name__ == "__main__":
    N = int(input())
    total = 0
    for i in range(1,N+1):
        Y = int(N/i)
        total += Y*(Y+1)*i/2
    print(total)
# Judge status: Accepted
s = "abcdefghijklmnopqrstuvwxyz"
C = str(input())
print(s[s.find(C)+1])
# Judge status: Accepted
a_life, a_attk, b_life, b_attk = [int(i) for i in input().split()]

i = 0
while(True):
  if i % 2 == 0:
    b_life -= a_attk
  else:
    a_life -= b_attk
  i += 1
  if b_life <= 0:
    print("Yes")
    break
  elif a_life <= 0:
    print("No")
    break
# Judge status: Accepted
N = int(input())

if N > 9:
    if (N%(int("1" + (len(str(N)) - 1)*"0"))) == int((len(str(N)) - 1) * "9"):
        tmp = list(str(N))
        tmp = [int(item) for item in tmp]
        print(sum(tmp))
    else:
        tmp = list(str(N - (N%(int("1" + (len(str(N)) - 1)*"0"))) - 1))
        tmp = [int(item) for item in tmp]
        print(sum(tmp))
else:
    print(N)
# Judge status: Accepted
s = input()
end_z = s.rfind('Z')
begin_a = s.find('A')
print(end_z - begin_a + 1)
# Judge status: Wrong Answer
N, K, S = map(int, input().split())

ans = []
if S == 10**9:
  for i in range(K):
    ans.append(S)
  for i in range(N-K):
    ans.append(S+1)
else:
  for i in range(K):
    ans.append(S)
  for i in range(N-K):
    ans.append(S+1)
print(*ans)
# Judge status: Accepted
import sys

def solve():
    input = sys.stdin.readline
    A, V = map(int, input().split())
    B, W = map(int, input().split())
    T = int(input())
    if V <= W: print("NO")
    else:
        diff = abs(A - B)
        if (V - W) * T >= diff: print("YES")
        else: print("NO")

    return 0

if __name__ == "__main__":
    solve()
# Judge status: Accepted
s=input()
if s=='Rainy':
  print('Sunny')
elif s=='Sunny':
  print('Cloudy')
else:
  print('Rainy')
# Judge status: Accepted
n=int(input())
a=list(map(int,input().split()))
l=[0 for i in range(n+1)]

for i in a:
  l[i]+=1
cmb1=[0 for i in range(n+1)]
cmb2=[0 for i in range(n+1)]

for i in range(1,n+1):
  cmb1[i]=(l[i]*(l[i]-1))//2
  cmb2[i]=((l[i]-1)*(l[i]-2))//2

kei1=0
for i in range(1,n+1):
  kei1+=cmb1[i]

for i in range(1,n+1):
  print(kei1-cmb1[a[i-1]]+cmb2[a[i-1]])