peterverebics/CodeNet_Python_428 huggingface dataset:
# Judge status: Accepted
c = []
for i in range(3):
    c.append(list(map(int, input().split())))

a = [0]*3
b = []
for i in range(3):
    b.append(c[0][i]-a[0])
for i in range(1, 3):
    a[i] = c[i][0]-b[0]

for i in range(3):
    for j in range(3):
        if a[i]+b[j] != c[i][j]:
            print("No")
            exit()
print("Yes")
# Judge status: Wrong Answer
s = input()
n = int(len(s))
word = "a"
for i in range(n):
	if s[i] == '0':
		word = word + "0"
	if s[i] == '1':
		word = word + "1"
	if s[i] == 'B':
		if int(len(s)) > 1:
			word = word[:-1]
		else:
			word = word
            
w = word[1:]
print(w)
# Judge status: Accepted
from collections import*
(n,m),*c = [[*map(int,i.split())]for i in open(0)]
g = [[]for _ in range(n+1)]

for a,b in c:
    g[a]+=[b]
    g[b]+=[a]

q=deque([1])
r=[0]*(n+1)

while q:
    v=q.popleft()
    for i in g[v]:
        if r[i]==0:
            r[i]=v
            q.append(i)

print("Yes",*r[2:],sep="\n")
# Judge status: Accepted
from bisect import bisect_right
N,H = map(int,input().split())
A = []
B = []
for _ in range(N):
    a,b = map(int,input().split())
    A.append(a)
    B.append(b)
A = sorted(A,reverse=True)
B = sorted(B)
a = A[0]
ind = bisect_right(B,a)
cnt = 0
flag = 0
for i in range(N-1,ind-1,-1):
    H -= B[i]
    cnt += 1
    if H<=0:
        flag = 1
        break
if flag==0:
    k = H//a
    if H%a>0:
        k += 1
    cnt += k
print(cnt)
# Judge status: Wrong Answer
N=int(input())
print(N*(N-1)/2)
# Judge status: Accepted
a, b, k = map(int, input().split())
if a >= k:
    print(a - k, b)
else:
    print(0, max(b - k + a, 0))
# Judge status: Wrong Answer
N = int(input())
B = list(map(int, input().split()))
x = 1
result = 0
count = 1

for a in B[:N-2]:
    if a < B[x]:
        result += a * count
        if x < N - 2:
            x += 1
    else:
        count += 1
        if x < N - 2:
            x += 1
        continue
Z = 0
for i in range(N-2):
    if B[i] < B[i + 1]:
        Z = B[i]
        break

print(result + B[N-2] + Z)
# Judge status: Accepted
# https://atcoder.jp/contests/abc168/tasks/abc168_a

N = int(input())

last_num = int(str(N)[-1])

if last_num in {2, 4, 5, 7, 9}:
    print('hon')

elif last_num in {0, 1, 6, 8}:
    print('pon')

else:
    print('bon')
# Judge status: Accepted
import sys
import math

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

s, c = [0] * M, [0] * M
for i in range(M):
	s[i], c[i] = map(int, input().split())

for i in range(0 if N == 1 else 10 ** (N - 1), 10 ** N):
	x = str(i)
	if M == 0:
		print(i)
		sys.exit(0)
	for j in range(M):
		if x[s[j] - 1] != str(c[j]):
			break
		elif j == M - 1:
			print(i)
			sys.exit(0)

print(-1)
# Judge status: Wrong Answer
import sys

stdin = sys.stdin

ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline().rstrip()  # ignore trailing spaces

n = ni()
h = na()

dp = [0]*n
dp[0] = 0
dp[1] = abs(h[1]-h[0])
count = 1
for i in range(2,n):
  dp[i] = min(abs(h[i-1]-h[i])+dp[i-1], abs(h[i-2]-h[i])+dp[i-2])
print(dp)
# Judge status: Wrong Answer
from sys import stdin as s
n,m=map(int,s.readline().split())
l=[0]*n
wa=[0]*n
pen=0
for i in range(m):
  x,y=s.readline().split()
  x=int(x)-1
  if y=="AC":
    l[x]=1
  elif not l[x] and not wa[x]:
    wa[x]=1
    pen+=1
print(sum(l),pen)
# Judge status: Wrong Answer
n = int(input())
s = input()
cou = 0
for i in range(n-1):
  if "#."==s[i:i+2]:
    cou += 1
print(cou)
# Judge status: Accepted
a,b=map(int,input().split())
count = 0
for i in range(a,b+1):
  if str(i)[0]==str(i)[4] and str(i)[1]==str(i)[3]:
    count+=1
print(count)
# Judge status: Accepted
x,y = map(int,input().split())
ans = 0
cur = x
while cur <= y:
    ans += 1
    cur *= 2
print(ans)
# Judge status: Accepted
a = int(input())

d={}
r=0
for _ in range(a):
    b= input()
    if d.get(b): continue
    else: d[b]= True; r+=1

print(r)
# Judge status: Accepted
x = int(input())
if x==7 or x==5 or x==3:
    print('YES')
else:
    print('NO')
# Judge status: Accepted
n = int(input())
A = list(map(int, input().split()))

ca = [0]
for i in range(n):
    ca.append(A[i]+ca[i])

ans = 2020202020
for i in range(n):
    ans = min(ans, abs(ca[i]-(ca[-1]-ca[i])))

print(ans)
# Judge status: Wrong Answer
n,m=map(int,input().split())
r=m//n
for i in range(n,r):
  if m%i==0:
    print(m//i)
    break
# Judge status: Wrong Answer
N,X = map(int,input().split())
L = [int(i) for i in input().split()]
D = 0
for i in range(N) :
    D = L[i]+D
#    print(i,D)
    if D>X :
        print(i+1)
        exit()

print(N)
# Judge status: Accepted
k, x = map(int, input().split())
ans = list(range(x - k + 1, x + k))
print(*ans, sep=' ')
# Judge status: Accepted
#!/usr/bin/env python3


def main():
    W, H, x, y = map(int, input().split())
    area = W * H / 2
    multi = int((x == W / 2) and (y == H / 2))

    print(area, multi)


if __name__ == '__main__':
    main()
# Judge status: Wrong Answer
n=int(input())
result=0
for i in range(n): 
    if i % 3 == 0 and i % 5 == 0:
        result=result    
    elif i % 3 == 0:
        result=result
    elif i % 5 == 0:
        result=result
    else:
        result=result+i
    
print(result)
# Judge status: Wrong Answer
num = 0
ans = 0
n = int(input())
for i in range(1,n):
	for j in range(1,n):
		for k in range(1,n):
			if(((i * j) + k) == n):
				num += 1
				print(i, j, k)
print(num)
# Judge status: Accepted
a, b, c, d = map(int, input().split())

if a <= c and  d <= b:
    print(d-c)
elif c <= a and b <= d :
    print(b-a)

elif b <= c :
    print(0)
elif a <= c and c <= b :
    print(b-c)
elif a <= d and d <= b :
    print(d-a)
elif d <= a :
    print(0)
# Judge status: Accepted
import sys
input = sys.stdin.readline
#N, K = (int(i) for i in input().split())
#B = [int(x) for x in input().split()]
#A = [[int(i) for i in input().split()] for i in range(N)]
L, R, d = (int(i) for i in input().split())
count = 0
for i in range(L, R+1):
    if i%d == 0:
        count += 1

print(count)
# Judge status: Accepted
s = input()
t = input()
l = len(s)
if t[:l] == s[:l]:
    print('Yes')
else:
    print('No')
# Judge status: Accepted
n = int(input())
H = list(map(int,input().split()))
H[0] -= 1
ans = "Yes"
for i in range(1,n):
    if H[i] < H[i-1]:
        ans = "No"
        break
    if H[i]-1 >= H[i-1]:
        H[i]-=1
print(ans)
# Judge status: Accepted
n,k,q = map(int,input().split())
point = [k-q]*n
for i in range(q):
    a = int(input())
    point[a-1] += 1
for j in point:
    if j>0:
        print('Yes')
    else:
        print('No')
# Judge status: Accepted
N = int(input())
W = list(map(int, input().split()))

ans = float("inf")
for idx in range(N):
    diff = abs(sum(W[:idx]) - sum(W[idx:]))
    if diff <= ans:
        ans = diff

print(ans)
# Judge status: Accepted
a=int(input())
s=input()
print(s if a>=3200 else "red")
# Judge status: Accepted
n, m = map(int, input().split())
s = []
c = []
for i in range(m):
    S, C = map(int, input().split())
    s.append(S-1)
    c.append(str(C))

ans = -1

if n == 3:
    st, ed = 100, 1000
elif n == 2:
    st, ed = 10, 100
else:
    st, ed = 0, 10

for i in range(st, ed):
    t = list(str(i))
    for j in range(m):
        if t[s[j]] != c[j]:
            break
    else:
        ans = i
        break
print(ans)
# Judge status: Accepted
n = int(input())
a = list(map(int,input().split()))

a.sort()

N,K = a[n-1],a[0]

for i in range(1,n):
    if abs((N+1)//2 - K) > abs((N+1)//2 - a[i]):
        K = a[i]

print(N,K)
# Judge status: Wrong Answer
x = input()
s_q = []
t_q = []
for i, v in enumerate(x):
    if v == 'S':
        s_q.append(v)
    else:
        t_q.append(v)
        while len(t_q) > 0 and len(s_q) > 0:
            t_q.pop()
            s_q.pop()
print(len(s_q)+len(t_q))
# Judge status: Accepted
import math
n=int(input())
if n==0:
    print(0)
    exit(0)
l1=[i*i for i in range(int(math.sqrt(n))+1)]
print(l1[-1])
# Judge status: Accepted
s = input()
flg = "Good"
for i in range(4-1):
    if s[i]==s[i+1]:
        flg = "Bad"
print(flg)
# Judge status: Accepted
def f(n):
  return n * (n + 1) // 2

answer = 0
n = int(input())
for i in range(1, n+1):
  answer += i * f(n//i)

print(answer)
# Judge status: Accepted
N,M = map(int, input().split())
a_n = list(map(int, input().split()))
g = a_n.copy()
 
while not any(x%2 for x in g): g = [x//2 for x in g]
if not all(x%2 for x in g): print(0); exit(0)
def gcd(a,b):
  while b: a,b = b,a%b
  return a
lcm = lambda a,b: a*b//gcd(a,b)
tot = 1
for x in a_n: tot = lcm(tot,x//2)
print((M//tot+1)//2)
# Judge status: Accepted
import time

p0 = time.time()
S = input()
n = len(S)
Y = {0:1}
# print(Y)
Y[0] = 1
A = [0]
pk = 0
for i in range(1,n+1):
    # print(S[-i])
    k = (int(S[-i])*pow(10,i-1,2019)+pk)%2019
    A.append(k)
    if k not in Y:
        Y[k] = 1
    else:
        Y[k] += 1
    pk = k

# print(A)
# print(Y)
# print(time.time()-p0)
c = 0
for y in Y:
    d = Y[y]
    c += d*(d-1)//2
print(c)
# Judge status: Wrong Answer
s = int(input())
l = [int(n) for n in input().split()]
l = sorted(l)
flag = 0
print(l)
for i in range(len(l)- 1):
  if l[i] == l[i+1]:
    print("NO")
    flag = 1
    
if flag == 0:
  print("YES")
# Judge status: Accepted
r,g,b=[int(i) for i in input().split()]
num=r*100+g*10+b

if num%4==0:
    print("YES")
else:
    print("NO")
# Judge status: Accepted
c = []
for i in range(3):
  r = list(map(int, input().split()))
  c.append(r)
  
d1 = set([])
d2 = set([])
d3 = set([])
d4 = set([])
for i in range(3):
  d1.add(c[i][1] - c[i][0])
  d2.add(c[i][2] - c[i][1])
  d3.add(c[1][i] - c[0][i])
  d4.add(c[2][i] - c[1][i])
if len(d1) == 1 and len(d2) == 1 and len(d3) == 1 and len(d4) == 1:
  print('Yes')
else:
  print('No')
# Judge status: Wrong Answer
arr = input().split()
K = int(arr[0])
A = int(arr[1])
B = int(arr[2])

n = 1 + K

x = B
K -= A+1

temp = int(K / 2)

x += temp * (B-A)
K -= temp * 2

while K > 0:
	K -= 1
	x += 1

print(max(x, n))
# Judge status: Accepted
n, m, x = map(int, input().split())
a = [list(map(int, input().split())) for _i in range(n)]

result = []
for i in range(2**n):
    num = i
    memo = [0 for _ in range(m)]
    cost = 0
    for j in range(n):
        if num%2==1:
            cost += a[j][0]
            for s in range(m):
                memo[s] += a[j][s+1]
        num >>= 1
    if all(i >= x for i in memo):
        result.append(cost)

if len(result)==0:
    print(-1)
else:
    print(min(result))
# Judge status: Accepted
n = int(input())
s = input()

if n % 2 != 0:
    print('No')
else:
    a = s[:len(s)//2]
    b = s[len(s)//2:]
    print(['No', 'Yes'][a == b])
# Judge status: Accepted
import numpy as np
N,M,*X=map(int,open(0).read().split())
X.sort()
a=np.array(X)
d=np.diff(a)
d.sort()
all=X[-1]-X[0]
left=d[-1:-N:-1].sum()
print(all-left)
# Judge status: Wrong Answer
S = list(input())
for i in range(len(S)-1):
    del S[-1]
    if len(S)%2==0 and S[0:len(S)//2] == S[len(S)//2:]:
        print(len(S))
# Judge status: Accepted
x = int(input())
ok = False

while ok == False:
    ok = True
    for i in range(2, int(x/2)):
        if x%i == 0:
            ok = False
            x += 1
            #print("####")
            break
    if ok == True:
        print(x)
        break
# Judge status: Accepted
import numpy as np
n=int(input())

ans=0

for k in range(n+1):
    if k%2==1:
        count=0
        m=int(np.sqrt(k)+1)
        for i in range(m):
            a=i+1
            if(k%a==0):
                count+=1
        if count==4:
            ans+=1

print(ans)
# Judge status: Wrong Answer
s = input()
t = input()
if sorted(s) < sorted(t):
  print('Yes')
else:
  print('No')
# Judge status: Wrong Answer
import collections

N,K,Q = map(int,input().split())
A = [int(input()) for i in range(Q)]
c = collections.Counter(A)

l = []
for i,v in dict(c).items():
    if v > (Q-K):
        l.append(i-1)
for j in range(N):
    if j in l:
        print('Yes')
    else:
        print('No')
# Judge status: Accepted
s1 = [i for i in input()]
s2 = [i for i in input()]
if s1[0] == s2[2] and s1[1] == s2[1] and s1[2] == s2[0]:
    print("YES")
else:
    print("NO")
# Judge status: Accepted
d = int(input())

if d == 7 or d == 5 or d == 3:
  print('YES')
else:
  print('NO')
# Judge status: Accepted
n = int(input())
k = int(input())
x = int(input())
y = int(input())
total = 0
for i in range(1,n+1):
    if i <= k:
        total += x
    else:
        total += y
print (total)
# Judge status: Wrong Answer
from collections import Counter
 
def factorize(n):
    a = 2
    fct = []
    while a <= n:
        print('-------')
        while n % a == 0:
            n = n // a
            fct.append(a)
        a += 1
    if n > 1:
        fct.append(n)
    return fct
 
 
n = int(input())
c = Counter(factorize(n))
# print(factorize(n))
# print(c.values())


ans = 0
for v in c.values():
    t = 1
    while v >= t:
        v -= t
        t += 1
        ans += 1
print(ans)
# Judge status: Accepted
n, k = map(int,input().split())
# print(min(abs(n - k * int(n/k)), abs(n - k * (int(n/k) + 1))))

# もっと簡単に書けばこうか でもなぜ上は通らない？
print(min(n%k, k-(n%k)))
# Judge status: Wrong Answer
def main():
  a,b= list(map(int,input().split()))
  ans=a
  num=1
  while ans<b:
    num+=1
    ans+=a-1
  print(num)

main()
# Judge status: Wrong Answer
import math

h, n = map(int, input().split())
a = [int(i) for i in input().split()]

if sum(a) >= h:
  print('yes')
else:
  print('no')
# Judge status: Accepted
n = int(input())
cha = "abcdefghijklmnopqrstuvwxyz"
ans = []
while n >= 1:
    mod = (n - 1) % 26
    ans.append(mod)
    n = (n - 1) // 26
    
ans_s = ''
for tmp in reversed(ans):
    ans_s += cha[tmp]
print(ans_s)
# Judge status: Accepted
a = list(map(int, input().split()))
a.sort()
if a[0] + a[1] == a[2]:
    print('Yes')
else: print('No')
# Judge status: Accepted
N = int(input())
W = list(map(int,input().split()))
m = sum(W)
for i in range(1,N):
  S1 = sum(W[:i])
  S2 = sum(W[i:])
  if m > abs(S1-S2):
    m = abs(S1-S2)
print(m)
# Judge status: Wrong Answer
sum_input = list(map(int, input().split(" ")))
print("Even" if (sum(sum_input) % 2) == 0 else "Odd")
# Judge status: Accepted
S=input()
S=S.replace("?","D")
print(S)
# Judge status: Accepted
import bisect
n, m, k = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))

sa = [0 for i in range(n+1)]
sb = [0 for i in range(m+1)]

c = 0

for i in range(n):
  c += a[i]
  sa[i+1] = c
c = 0
for i in range(m):
  c += b[i]
  sb[i+1] = c
ans = 0
# if k >= sum(a)+sum(b):
#   print (n+m)
#   exit()
for i in range(n+1):
  x = k - sa[i]
  if x < 0:
    continue
  y = bisect.bisect_right(sb,x)
  y += i
  ans = max(ans, y-1)
print (ans)
# Judge status: Wrong Answer
N_nin, K_ko = map(int, input().split())

sunuke = []

for i in range(K_ko):
    d = int(input())
    
    if (d != 1):
        sunuke.append(map(int, input().split()))
    else:
        sunuke.append(int(input()))

ans = N_nin - len(set(sunuke))

print(ans)
# Judge status: Wrong Answer
k,n = map(int, input().split())
l = list(map(int, input().split()))
d = []
for i in range(n):
  if i + 1 < n:
    d.append(l[i+1]-l[i])
  else:
    d.append(k - l[i])
sum = sum(d)
a = []
for i in range(n):
  a.append(sum - d[i])
print(min(a))
# Judge status: Accepted
import math
def myAnswer(K:int,A:int,B:int) -> int:
   if(K <= A-1): return K+1
   tmp =(K - (A-1))
   # print(tmp)
   ans = (B - A) * math.floor(tmp//2) + tmp % 2 + A
   # print(ans)
   return max(ans,K+1)



def modelAnswer():
   return
def main():
   K,A,B = map(int,input().split())
   print(myAnswer(K,A,B))
if __name__ == '__main__':
   main()
# Judge status: Accepted
import sys
import math
ha=input().rstrip().split(" ")
h=int(ha[0])
a=int(ha[1])
i=0
hp=h
while hp>0:
    hp=hp-a
    i=i+1
print(i)
# Judge status: Wrong Answer
import math

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

m = 0
M = max(A)

while(M-m>0.5):
    mm = 0

    mid = (M+m)/2
    for i in range(N):
        mm += math.ceil(A[i]/mid)-1

    if mm>K:
        m = mid
    else:
        M = mid

print(math.ceil(mid))
# Judge status: Accepted
k,n = map(int,input().split())
a =list(map(int,input().split()))
kyori = [0]*n
# print(a)
for i in range(1,n):
    # print(i)
    kyori[i]=a[i]-a[i-1]
kyori[0]=a[0]+(k-a[n-1])
print(k-max(kyori))
# Judge status: Wrong Answer
S=int(input())

if S<3:
    ans=0

else:
    ans=0
    a=1
    b=int((S-S%3)/3)
    for x in range(1,b+1):
        for i in range(1,S-2*x-2):
            a*=i
        ans+=a
        a=1
print(ans)
# Judge status: Wrong Answer
from collections import deque

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

graph = [[] for _ in range(n+1)]
for i in range(m):
    a,b = map(int, input().split())
    graph[a].append(b)
    graph[b].append(a)

dist = [-1] * (n + 1)
dist[0] = 0
dist[1] = 0

d=deque()
d.append(1)

while d:
    v = d.popleft()
    
    for i in graph[v]:
        if dist[i] != -1:
            continue
        dist[i] = dist[v] + 1
        d.append(i)

ans = dist[2:]
print('Yes')
print(*ans,sep='\n')
# Judge status: Accepted
sa=list(input())
sb=list(input())
sc=list(input())
flg="a"

while True:
  if flg=="a":
    if len(sa)==0:
      break
    else:
      flg=sa[0]
      sa.pop(0)
  elif flg=="b":
    if len(sb)==0:
      break
    flg=sb[0]
    sb.pop(0)
  elif flg=="c":
    if len(sc)==0:
      break
    else:
      flg=sc[0]
      sc.pop(0)
print("A" if flg=="a" else "B" if flg=="b" else "C")
# Judge status: Accepted
S = input().strip()
N = len(S)
a = S[:(N-1)//2]
if S==S[::-1] and a==a[::-1]:
    print("Yes")
else:
    print("No")
# Judge status: Wrong Answer
A, B, C, D = map(int, input().split())
if B >= C:
  ans = B - C
else:
  ans = 0
print(ans)
# Judge status: Accepted
n = int(input())
while True:
    if len(set(str(n))) == 1:
        break
    else:
        n += 1
print(n)
# Judge status: Accepted
def cumsum(a):
    s = [0]
    for i in range(len(a)):
        s.append(s[i]+a[i][0])
    return s

n = int(input())
a_b = [list(map(int,input().split())) for _ in range(n)]
a_b = sorted(a_b,key=lambda x: x[1])
#print(a_b)
all = cumsum(a_b)
#print(all)
flag = 1
for i in range(n):
    if all[i+1] > a_b[i][1]:
        flag = 0
        break
if flag:
    print('Yes')
else:
    print('No')
# Judge status: Accepted
def main():
    lst = list(map(int, input().split()))
    lst.sort()

    for l in lst:
        if l % 2 == 0:
            print(0)
            exit()
    print(lst[0] * lst[1])


if __name__ == "__main__":
    main()
# Judge status: Wrong Answer
s = str(input())
S = [s[i] for i in range(len(s))]
S.sort()
S = set(S)
count = [chr(i) for i in range(97, 97+26)]
for i in count:
    if i in S:
        pass
    else:
        print(i)
        break
# Judge status: Accepted
from collections import defaultdict
s=input()
n=len(s)
N=defaultdict(int)
x=0
for i in reversed(range(n)):
    x+=int(s[i])*pow(10,(n-i-1),2019)
    x%=2019
    N[x]+=1
ans=N[0]
for j in N.values():
    ans+=j*(j-1)//2
print(ans)
# Judge status: Accepted
x, y = map(int, input().split())
print(x + (y//2))
# Judge status: Wrong Answer
import numpy as np
import sys

n, k = map(int, input().split())
dp = np.full(n, 10005, dtype=int)
h = np.array([int(x) for x in input().split()])
if n - 1 <= k:
	print(abs(h[n - 1] - h[0]))
	sys.exit()
if k == 1:
	s = 0
	for i in range(n - 1):
		s += abs(h[i + 1] - h[i])
	print(s)
	sys.exit()	 
dp[0] = 0
dp[1] = abs(h[1] - h[0])
for i in range(2, n):
	for j in range(1, min(i + 1, k + 1)):
		dp[i] = min(dp[i], dp[i - j] + abs(h[i] - h[i - j]))
print(dp[n - 1])
# Judge status: Wrong Answer
t,a,k = map(int,input().split())

t = t-k
if t<0:
  a -= t
  t = 0
if a<0:
  a = 0
print(t,a)
# Judge status: Wrong Answer
s1,s2,s3,s4 = list(input())
p=0
if s1==s2:
    if s3!=s4:
        p=1
elif s1==s3:
    if s2!=s4:
        p=1
elif s1==s4:
    if s3!=s2:
        p=1
elif s1==s2 and s1== s3 and s1==s4:
    p=1
else:
    p=1
if p==0:
    print("Yes")
elif p==1:
    print("No")
# Judge status: Wrong Answer
s = input()
if s[0] == 9 or s[1] == 9:
  print('No')
else:
  print('Yes')
# Judge status: Accepted
a,b,c,d,e=map(int,input().split())

f=c*60+d-a*60-b


if f-e>=0:
  print(f-e)
else:
  print(0)
# Judge status: Accepted
n = int(input())
s = [" ".join(sorted(input())) for _ in range(n)]

count = 0
dic = {}

for a in s:
    if a in dic.keys():
        count += dic[a]
        dic[a] += 1
    else:
        dic[a] = 1

print(count)
# Judge status: Wrong Answer
from operator import itemgetter

n = int(input())
sp = [input().split() for i in range(n)]

for i in range(n):
  sp[i].append(i+1)

sp = sorted(sp, key=itemgetter(1), reverse=True)
sp = sorted(sp, key=itemgetter(0))

for i in range(n):
  print(sp[i][2])
# Judge status: Accepted
l = list(map(int,input().split()))
go = 0
shichi = 0
for i in range(3):
  if l[i] == 5:
    go += 1
for i in range(3):
  if l[i] == 7:
    shichi += 1
if go == 2 and shichi ==1:
  print('YES')
else:
  print('NO')
# Judge status: Accepted
X = int(input())
ans = 1

for x in range(1, X):
    for y in range(2, X):
        if x ** y <= X:
            ans = max(ans, x ** y)
        else:
            break

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

b=[1]
Flag=True
now=1
arrived=set(b)
memo=1
while Flag:
    b.append(a[now-1])
    if a[now-1] in arrived:
        Flag=False
        memo=a[now-1]
    arrived.add(a[now-1])
    now=a[now-1]

loop=len(b)-b.index(memo)-1

first=b.index(memo)


if k>first:
    p,q=divmod(k-first,loop)
    print(b[first+q])
else:
    print(b[k])
# Judge status: Accepted
from math import log2,ceil
n,k=[int(s) for s in input().split()]

sum=0
for t in range(1,n+1):
    if t>=k:
        sum+=1
    else:
        sum+=1/(2**ceil(log2(k/t)))
print(sum/n)
# Judge status: Wrong Answer
A,B,C,X,Y=map(int,input().split(' '))

price=0
if X>Y:    
  N_same=Y
  flag='A'
else:
  N_same=X
  flag='B'
  
if A+B >2*C:
  price+=2*C*N_same
else:
  price+=(A+B)*N_same

if flag=='A':
  if A*(X-Y)>2*C*(X-Y):
    price+=2*C*(X-Y)
  else:
    price+=A*(X-Y)
else:
  if B*(X-Y)>2*C*(X-Y):
    price+=2*C*(X-Y)
  else:
    price+=B*(X-Y)

print(price)
# Judge status: Accepted

def main():
  a, v = map(int, input().split())
  b, w = map(int, input().split())
  t = int(input())

  if a == b:
    print("YES")
    return

  dis = abs(a - b)
  s = v - w
  dis -= s * t

  if dis <= 0:
    print("YES")
  else:
    print("NO")


main()
# Judge status: Wrong Answer
a,b,c = map(int,input().split())

if a < c < b:
    print('Yes')
else:
    print('No')
# Judge status: Accepted
import sys
input = sys.stdin.readline
N, a, b = map(int, input().split())
mod = 10 ** 9 + 7
res = pow(2, N, mod) - 1
ta = 1 
for i in range(a):
  ta *= N - i
  ta %= mod
for i in range(a):
  ta *= pow(i + 1, mod - 2, mod)
  ta %= mod
tb = 1
for i in range(b):
  tb *= N - i
  tb %= mod
for i in range(b):
  tb *= pow(i + 1, mod - 2, mod)
  tb %= mod
print((res - ta - tb) % mod)
# Judge status: Accepted
#!/usr/bin/env python3

N = int(input())
S = sorted([int(input()) for i in range(N)])
ans = sum(S)

if ans % 10 == 0:
    for i in S:
        if (ans - i) % 10 != 0:
            ans -= i
            break

if ans % 10 == 0:
    ans = 0

print(ans)
# Judge status: Wrong Answer
if __name__ == '__main__':

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

#	ans = 100000001
	ans = float("inf")

	for i in range(k):
		if i+k > n:
			break

		left = A[i]
		right = A[i+k-1]
		
		tmp = abs(left) + abs(right)
		tmp2 = 0
		if tmp >= 0:
			#1 abs(left) < abs(right) の場合
			tmp2 = abs(left) + abs(right - left)
		else:
			#2 abs(right) > abs(left)の場合
			tmp2 = abs(right) + abs(left - right)

		ans = min(ans,tmp2)
	print(ans)
# Judge status: Accepted
def solve():
  x = int(input())
  print(x^1)
  
solve()
# Judge status: Accepted
days = ["SUN",
        "MON",
        "TUE",
        "WED",
        "THU",
        "FRI",
        "SAT"]

S = input()

print(7-days.index(S))
# Judge status: Wrong Answer
MOD = 10**9 + 7
N, M = map(int, input().split())
stairs = [0]*(N+1)
for _ in range(M):
    stairs[int(input())] = 1
if N == 1:
    if M == 1:
        print(0)
        exit()
    else:
        print(1)
        exit()
ans = [0]*(N+1)
ans[1] = 1 if stairs[1] == 0 else 0
ans[2] = 1 + ans[1] if stairs[2] == 0 else ans[1]
for i in range(3,N+1):
    if stairs[i] == 1:
        ans[i] = 0
        continue
    ans[i] = (ans[i-1] + ans[i-2]) % MOD
print(ans[N])