Harryxun/stf_run huggingface dataset:
import sys
sys.setrecursionlimit(1000000000000000000)

N = int(input())
A = {}
B = {}
ABsa = {}
BAsa = {}
noneqqs = []
cnt = 0
aeqq_cnt = 0
beqq_cnt = 0

for i in range(N):
	a,b = map(int,input().split())
	A[i] = a
	B[i] = b
	ABsa[i] = a-b
	BAsa[i] = b-a
	if(a==b):
		cnt += 1
	elif(a!=b):
		noneqqs.append(i)
	if(A[0]==a):
		aeqq_cnt += 1
	if(B[0]==b):
		beqq_cnt += 1

takahashi = 0
aoki = 0
if(cnt == N):
	for j in range(N):
		if(j%2 == 0):
			maxkey = max(A,key=A.get)
			takahashi += int(A[maxkey])
			del A[maxkey]
			del B[maxkey]

		elif(j%2 == 1):
			maxkey2 = max(B,key=B.get)
			aoki += int(B[maxkey2])
			del B[maxkey2]
			del A[maxkey2]
	print(takahashi-aoki)

elif(aeqq_cnt == N):
	for j in range(N):
		if(j%2 == 0):
			maxkey = max(B,key=B.get)
			takahashi += int(A[maxkey])
			del A[maxkey]
			del B[maxkey]
		elif(j%2 == 1):
			maxkey2 = max(B, key=B.get)
			aoki += int(B[maxkey2])
			del B[maxkey2]
			del A[maxkey2]
	print(takahashi-aoki)

elif(beqq_cnt == N):
	for j in range(N):
		if(j%2 == 0):
			maxkey = max(A,key=A.get)
			takahashi += int(A[maxkey])
			del A[maxkey]
			del B[maxkey]
		elif(j%2 == 1):
			maxkey2 = max(A, key=A.get)
			aoki += int(B[maxkey2])
			del B[maxkey2]
			del A[maxkey2]
	print(takahashi-aoki)

else:
	for j in range(N):
		if(j%2 == 0):
			maxkey = max(BAsa,key=BAsa.get)
			takahashi += int(A[maxkey])
			del A[maxkey]
			del B[maxkey]
		elif(j%2 == 1):
			maxkey2 = max(ABsa, key=ABsa.get)
			aoki += int(B[maxkey2])
			del B[maxkey2]
			del A[maxkey2]
	print(takahashi-aoki)


### FIXED CODE ###

import sys
sys.setrecursionlimit(10000000)

N = int(input())
A = {}
B = {}
AplusB =[]

for i in range(N):
	a,b = map(int,input().split())
	A[i] = a
	B[i] = b
	AplusB.append((a+b,i))

AplusB.sort()
AplusB.reverse()


takahashi = 0
aoki = 0

for j in range(N):
	if(j%2 == 0):
		takahashi += A[AplusB[j][1]]
	else:
		aoki += B[AplusB[j][1]]

print(takahashi-aoki)
#!/usr/bin/python
# -*- coding: utf-8 -*-
import sys
import math
import collections


def fib(n):
    return int((1 / math.sqrt(5)) * (math.pow((1 + math.sqrt(5)) / 2, n) - math.pow((1 - math.sqrt(5)) / 2, n)))


# for i in range(10):
#     print(fib(i))

N, M = map(int, sys.stdin.readline().rstrip().split(" "))
As = []
for i in range(M):
    a, = map(int, sys.stdin.readline().rstrip().split(" "))
    As.append(a)
As.append(N+1)
result = 1
current = 0
for a in As:
    diff = a - current - 1
    if diff == -1:
        print(0)
        exit(0)
    # 1: 1
    # 2: 2
    # 3: 3C0 + 2C1 = 3
    # 4: (1,1,1,1) (1,1,2) (1, 2, 1) (2, 1, 1), (2, 2): 4C4 + 3C1 + 2C2 = 1+ 3 + 1 = 5
    # 5: 5C0 + 4C1 + 3C2 = 1 + 4 + 3 = 8
    # 6: 6C0 + 5C1 + 4C2 + 3C3 = 1+5+6+1 = 13
    # 7: 7C0 + 6C1 + 5C2 + 4C3 = 1+6+10+4 = 21
    # print(current, a, fib(diff+1))
    result *= fib(diff+1)
    result %= 1000000007
    # print("res", result)
    current = a + 1
print(result)
exit(0)


### FIXED CODE ###

#!/usr/bin/python
# -*- coding: utf-8 -*-
import sys
import math
import collections


fib_list=[1, 1]
for i in range(10**5):
    fib_list.append(fib_list[-1] + fib_list[-2])

# def fib(n):
#     return int((1 / math.sqrt(5)) * (math.pow((1 + math.sqrt(5)) / 2, n) - math.pow((1 - math.sqrt(5)) / 2, n)))

def fib(n):
    return fib_list[n-1]


# for i in range(-10, 10):
#     print(fib(i))

N, M = map(int, sys.stdin.readline().rstrip().split(" "))
As = []
for i in range(M):
    a, = map(int, sys.stdin.readline().rstrip().split(" "))
    As.append(a)
As.append(N+1)
result = 1
current = 0
for a in As:
    diff = a - current - 1
    if diff < 0:
        print(0)
        exit(0)
    # 1: 1
    # 2: 2
    # 3: 3C0 + 2C1 = 3
    # 4: (1,1,1,1) (1,1,2) (1, 2, 1) (2, 1, 1), (2, 2): 4C4 + 3C1 + 2C2 = 1+ 3 + 1 = 5
    # 5: 5C0 + 4C1 + 3C2 = 1 + 4 + 3 = 8
    # 6: 6C0 + 5C1 + 4C2 + 3C3 = 1+5+6+1 = 13
    # 7: 7C0 + 6C1 + 5C2 + 4C3 = 1+6+10+4 = 21
    # print(current, a, fib(diff+1))
    result *= fib(diff+1)
    result %= 1000000007
    # print("res", result)
    current = a + 1
print(result)
exit(0)
waters = set([a+b for b in range(0, F+1, B) for a in range(0, F+1, A) if a+b <= F])

res_water = 0
res_sugar = 0
max_ratio = 0

for w in sorted(waters):
    sugars = [c+d for c in range(0, int(w/100)*E+1, C)
                         for d in range(0, int(w/100)*E+1, D) 
                             if (c+d+w <= F) and (c+d <=int(w/100)*E)]
    sugar = max(sugars)
    #print(sugars)
    if w+sugar==0:
        continue
    if 100*sugar / (w+sugar) > max_ratio:
        max_ratio = 100*sugar / (w+sugar)
        res_water = w
        res_sugar = sugar
print("{} {}".format(res_water+res_sugar, res_sugar))

### FIXED CODE ###

# -*- coding: utf-8 -*-
A, B, C, D, E, F = tuple(map(int, input().split()))
A, B = 100*A, 100*B
waters = set([a+b for b in range(0, F+1, B) for a in range(0, F+1, A) if a+b <= F])

res_water = min(A, B)
res_sugar = 0
max_ratio = 0

for w in sorted(waters):
    sugars = [c+d for c in range(0, int(w//100)*E+1, C)
                         for d in range(0, int(w//100)*E+1, D) 
                             if (c+d+w <= F) and (c+d <= int(w/100)*E)]
    sugar = max(sugars)
    #print(sugars)
    if w+sugar==0:
        continue
    if 100*sugar / (w+sugar) > max_ratio:
        max_ratio = 100*sugar / (w+sugar)
        res_water = w
        res_sugar = sugar
print("{} {}".format(res_water+res_sugar, res_sugar))
x,y = map(str,input().split())
z = x+y
Z=int(z)
for i in range(100):
  if i**2 = Z:
    print("Yes")
    exit()
print("No")

### FIXED CODE ###

a,b=map(int,input().split())
c=int(str(a)+str(b))
for i in range(int(c**(1/2))+1) :
  if i**2==c :
    print("Yes")
    exit()
print("No")
N, K = map(int, input().split())
umai = {}
mazui = []
for _ in range(N):
    t, d = map(int, input().split())
    if t not in umai:
        umai[t] = d
    else:
        tmp = umai[t]
        if tmp < d:
            umai[t] = d
            mazui.append((t, tmp))
        else:
            mazui.append((t, d))

umai = sorted(umai.items(), key=lambda x: -x[1])
mazui = sorted(mazui, key=lambda x: -x[1])


umai_len = len(umai)
mazui_len = len(mazui)

acc_umai = [0 for _ in range(umai_len)]
acc_umai[0] = umai[0][1]
for i in range(umai_len - 1):
    acc_umai[i + 1] = acc_umai[i] + umai[i + 1][1]

acc_mazui = [0 for _ in range(mazui_len)]
acc_mazui[0] = mazui[0][1]
for i in range(mazui_len - 1):
    acc_mazui[i + 1] = acc_mazui[i] + mazui[i + 1][1]
acc_mazui.insert(0, 0)

ans = []
for i in range(1, K + 1):
    if umai_len < i or mazui_len < K - i:
        continue
    ans.append(acc_umai[i - 1] + acc_mazui[K - i] + i ** 2)
print(max(ans))


### FIXED CODE ###

N, K = map(int, input().split())
umai = {}
mazui = []
for _ in range(N):
    t, d = map(int, input().split())
    if t not in umai:
        umai[t] = d
    else:
        tmp = umai[t]
        if tmp < d:
            umai[t] = d
            mazui.append((t, tmp))
        else:
            mazui.append((t, d))

umai = sorted(umai.items(), key=lambda x: -x[1])
mazui = sorted(mazui, key=lambda x: -x[1])


umai_len = len(umai)
mazui_len = len(mazui)

acc_umai = [0 for _ in range(umai_len)]
acc_umai[0] = umai[0][1]
for i in range(umai_len - 1):
    acc_umai[i + 1] = acc_umai[i] + umai[i + 1][1]

acc_mazui = [0 for _ in range(mazui_len)]
if mazui_len > 0:

    acc_mazui[0] = mazui[0][1]
    for i in range(mazui_len - 1):
        acc_mazui[i + 1] = acc_mazui[i] + mazui[i + 1][1]
acc_mazui.insert(0, 0)

ans = []
for i in range(1, K + 1):
    if umai_len < i or mazui_len < K - i:
        continue
    ans.append(acc_umai[i - 1] + acc_mazui[K - i] + i ** 2)
print(max(ans))
import sys
N,M = map(int,input().split())
ls_1 = []
ls_2 = []
ls_3 = []
for i in range(M):
    s,c = map(int,input().split())
    if s == 1:
        ls_1.append(c)
    elif s == 2:
        ls_2.append(c)
    else:
        ls_3.append(c)
if len(set(ls_1)) > 1 or len(set(ls_2)) > 1 or len(set(ls_3)) > 1 or ls_1[0] == 0:
    print(-1)
    sys.exit()
if len(ls_1) == 0:
    ls_1.append(1)
if len(ls_2) == 0:
    ls_2.append(0)
if len(ls_3) == 0:
    ls_3.append(0)
    
ans = (10 **(N-1)) * ls_1[0] + (10**((N-2)*(N-1)// 2)) * ls_2[0] + ((N-2)*(N-1) // 2) * ls_3[0]
print(ans)

### FIXED CODE ###

N,M = map(int,input().split())
ls_1 = []
ls_2 = []
ls_3 = []
for i in range(M):
    s,c = map(int,input().split())
    if s == 1:
        ls_1.append(c)
    elif s == 2:
        ls_2.append(c)
    else:
        ls_3.append(c)
if len(set(ls_1)) > 1 or len(set(ls_2)) > 1 or len(set(ls_3)) > 1 or (N > 1 and len(ls_1) > 0 and sum(ls_1)==0):
    print(-1)
else:
    if len(ls_1) == 0:
        if N > 1:
            ls_1.append(1)
        else:
            ls_1.append(0)
    if len(ls_2) == 0:
        ls_2.append(0)
    if len(ls_3) == 0:
        ls_3.append(0)
    
    ans = (10 **(N-1)) * ls_1[0] + (10**((N-2)*(N-1)// 2)) * ls_2[0] + ((N-2)*(N-1) // 2) * ls_3[0]
    print(ans)
import math

r = input()

s = pi*r*r
l = 2.0*pi*r

print(s,l)

### FIXED CODE ###

import math

r = float(input())

s = math.pi * r**2
l = 2.0*math.pi*r

print(s, l)
def f(s,K):
 res=0
 str=""
 for i in range(len(s)):
  if s[i]=="a":
   str+="a"
   res+=1
   continue
  if K>=123-ord(s[i]):
   str+="a"
   res+=1
   K-=123-ord(s[i])
  else:
   break
 if res==0:
  skip=0
  for skip in range(len(s)):
   if K>=123-ord(s[skip]):
    break
  return s[:skip],s[skip:],K
 return str,s[res:],K

ss=input()
KK=int(input())
sol=""
while len(ss)>1:
 x,ss,KK=f(ss,KK)
 sol+=x
KK%=26
if ord(ss[0])+KK<123:
 sol+=chr(ord(ss[0])+KK)
else:
 sol+=chr(ord(ss[0])+KK-26)
print(sol)

### FIXED CODE ###

def f(s,K):
 if K==0:
  return s,"",0
 res=0
 str=""
 for i in range(len(s)-1):
  if s[i]=="a":
   str+="a"
   res+=1
   continue
  if K>=123-ord(s[i]):
   str+="a"
   res+=1
   K-=123-ord(s[i])
  else:
   break
 if res==0:
  skip=0
  for skip in range(len(s)):
   if K>=123-ord(s[skip]):
    break
  return s[:skip],s[skip:],K
 return str,s[res:],K

ss=input()
KK=int(input())
sol=""
while len(ss)>1:
 x,ss,KK=f(ss,KK)
 sol+=x
if len(ss)==1:
 KK%=26
 if ord(ss[0])+KK<123:
  sol+=chr(ord(ss[0])+KK)
 else:
  sol+=chr(ord(ss[0])+KK-26)
print(sol)
def main():
    N,M,K = map(int, input().split())
    MOD = 998244353

    dp = [[0] * N for _ in range(K+1)]
    dp[0][0] = M

    for i in range(1,N):
        dp[0][i] = (dp[0][i-1] * (M-1)) % MOD

        for k in range(1, K+1):
            dp[k][i] = (dp[k][i-1] * (M-1) + dp[k-1][i-1]) % MOD
        
    res = 0
    for k in range(K+1):
        res += dp[k][-1]
    print(res)


if __name__ == "__main__":
    main()

### FIXED CODE ###


N,M,K = map(int, input().split())
MOD = 998244353

fact = [0] * (N+1)
inv = [0] * (N+1)

fact[0] = fact[1]  = 1
inv[1] = 1

for i in range(2, N+1):
    fact[i] = fact[i-1] * i % MOD
    inv[i] = MOD - inv[MOD%i] * (MOD//i) % MOD # //で良いのかな?

def main():
    if N == 1:
        print(M)
        return 
    num = M
    nums = [M]
    for i in reversed(range(1,N)):
        num *= i*(M-1)
        num *= inv[N-i]
        num %= MOD
        nums.append(num)
    nums.reverse()
    print(sum(nums[:K+1])%MOD)

    
if __name__ == "__main__":
    main()
N = int(open(0).read())
m = N % 1000
if m == 0:
    print(0)
else:
    print(1000 - m)
|                        

### FIXED CODE ###

N = int(open(0).read())
m = N % 1000
if m == 0:
    print(0)
else:
    print(1000 - m)
import math
n=int(input())
a=list(map(int,input().split()))
soin = [0]*(10**5+1)
if sum(a)==n:
    print("pairwise coprime")
    exit()

def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n ** 0.5 // 1)) + 1):
        if temp % i == 0:
            while temp % i == 0:
                temp //= i
            arr.append(i)

    if temp != 1:
        arr.append(temp)

    if arr == []:
        arr.append(n)

    return arr


if len(a)>78498:
    ans=a[0]
    for i in a:
        ans=math.gcd(ans,i)
    if ans==1:
        print("setwise coprime")
    else:
        print("not coprime")
else:
    for i in a:
        for num in factorization(i):
            soin[num]+=1
    if max(soin)==1:
        print("pairwise coprime")
    elif max(soin)==n:
        print("not coprime")
    else:print("setwise coprime")


### FIXED CODE ###

import math
n=int(input())
a=list(map(int,input().split()))
soin = [0]*(10**6+1)
if a.count(1)==n:
    print("pairwise coprime")
    exit()

def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n ** 0.5 // 1)) + 1):
        if temp % i == 0:
            while temp % i == 0:
                temp //= i
            arr.append(i)

    if temp != 1:
        arr.append(temp)

    if arr == []:
        arr.append(n)

    return arr


if len(a)>80000:
    ans=a[0]
    for i in a:
        ans=math.gcd(ans,i)
    if ans==1:
        print("setwise coprime")
    else:
        print("not coprime")
else:
    for i in a:
        if i ==1:continue
        for num in factorization(i):
            soin[num]+=1
    if max(soin)==1:
        print("pairwise coprime")
    elif max(soin)==n and 1 not in a:
        print("not coprime")
    else:print("setwise coprime")
n,m = map(int,input().split())
C = [[i,*map(int,input().split())] for i in range(m)]
C.sort(key=lambda c:c[1:])
prev = 0
count = 0
for c in C:
    if prev==c[1]: count+=1
    else: count=1
    c.append(format(c[1],'0>6')+format(count,'0>6'))
    prev=c[1]

for c in sorted(C, key=lambda c:c[0]):
    print(c[3])

### FIXED CODE ###

n,m = map(int,input().split())
C = [[i]+list(map(int,input().split())) for i in range(m)]
C.sort(key=lambda c:c[1:])
prev = 0
count = 0
for c in C:
    if prev==c[1]: count+=1
    else: count=1
    c.append(format(c[1],'0>6')+format(count,'0>6'))
    prev=c[1]

for c in sorted(C, key=lambda c:c[0]):
    print(c[3])
import itertools
import heapq
n,k = map(int,input().split())
a = list(map(int,input().split()))
if n>=2*k:
  a_plus = heapq.nlargest(k, a)
  a_minus = heapq.nsmallest(k, a)
  a_new = a_plus+a_minus
  comb = itertools.combinations(a_new,k)
else:
  comb = itertools.combinations(a,k)

l = [list(_) for _ in comb]  
A = (functools.reduce(operator.mul,l[_]) for _ in range(len(l)))

l_max = max(A)
waru = 10**9 + 7
 
mod = l_max % waru
print(mod)

### FIXED CODE ###

import sys
 
n, k = map(int, input().split())
a = [int(x) for x in input().split()]
mod = pow(10, 9)+7
zero = 0
plus = []
minus = []
for i in range(n):
  if a[i] == 0:
    zero += 1
  elif a[i] > 0:
    plus.append(a[i])
  else:
    minus.append(a[i])
 
P, M = len(plus), len(minus)
plus.sort(reverse=True)
minus.sort()
ans = 1
if n == k:
  for i in range(n):
    ans *= a[i]
    ans %= mod
elif P+M < k:
  ans = 0
elif P == 0:
  if zero and k%2:
    ans = 0
  else:
    if k%2:
      minus.reverse()
    for i in range(k):
      ans *= minus[i]
      ans %= mod
else:
  q = 0
  if k%2:
    ans *= plus[0]
    ans %= mod
    q = 1
  judge = []
  for i in range((len(plus)-q)//2):
    judge.append(plus[2*i+q]*plus[2*i+q+1])
  for i in range(len(minus)//2):
    judge.append(minus[2*i]*minus[2*i+1])
  judge.sort(reverse=True)
  for i in range(k//2):
    ans *= (judge[i]%mod)
    ans %= mod
 
print(ans)
n=input()
a=list(map(int,input().split()))
print("YES" if len(set(a))==len(a) else "NO"

### FIXED CODE ###

n=input()
a=list(map(int,input().split()))
print("YES" if len(set(a))==len(a) else "NO")
t = int(input())
if t > == 30:
  print('Yes')
else:
  print('No')

### FIXED CODE ###

t = int(input())
if t >= 30:
  print('Yes')
else:
  print('No')
s = input()
alp = [chr(i) for i in range(ord('a'),ord('z')+1)]
ans = []
for i in alp:
    if i not in s:
        ans.append(i)
ans.sort()
print(ans[0])

### FIXED CODE ###

s = input()
alp = [chr(i) for i in range(ord('a'),ord('z')+1)]
ans = []
for i in alp:
    if i not in s:
        ans.append(i)
ans.sort()
if ans:
    print(ans[0])
else:
    print('None')
import math
H,W = map(int,input().split())

if H==1 orW==1:
  print(1)
  exit()
  
x = H*W
if x % 2==0:
  print(x/2)
elif x% 2 ==1:
  print(int(math.ceil(x/2)+1))




### FIXED CODE ###

import math
h,w = map(int,input().split())

x = h*w

if h==1 or w==1:
  print(1)
  exit()

if x%2==0:
  print(int(x/2))
else:
  print(int(math.ceil(x/2)))
l,r = map(int,input().split())
a = []
if r-l>=2019:
  print(0)
else:
  for i in range(l,r+1):
    a.append(i%2019)
a.sort()
print((a[0]*a[1])%2019)

### FIXED CODE ###

l,r = map(int,input().split())
m = 2018
if r-l>=2019:
  print(0)
else:
  for i in range(l,r+1):
    for j in range(i+1,r+1):
      a = (i*j)%2019
      m = min(a,m)
  print(m)
N=int(input())
price=[]
for i in range(N):
    price.append(int(input()))
price.sort(Reverse=True)
price[0]=price[0]//2
sum(price)
           
           

### FIXED CODE ###

N=int(input())
price=[int(input()) for i in range(N)]
price.sort(reverse=True)
price[0]=price[0]//2
a=sum(price)
print(a)
H, W = map(int, input().split())
a = []
for i in range(H):
    a.append(input())


for index, i in enumerate(a):
    if i == '.'*W:
        a.remove('.'*W)


aa = list(map(list, zip(*a)))


for index, i in enumerate(aa):
    if i == ['.']*len(aa[0]):
        aa.remove(tamesi)

aaa = list(map(list, zip(*aa)))

for i in aaa:
    print(''.join(i))

### FIXED CODE ###

H, W = map(int, input().split())
a = []
ans = []
for i in range(H):
    a.append(input())
    
    if len(set(a[-1])) == 1 and a[-1][0] == '.':
        del a[-1]

if len(a) == 1:
    kotae = a[0]
    kotae = kotae.replace('.', '')
    print(kotae)
else:
    for x in range(W):
        check = []
        for y in range(len(a)):

            if a[y][x] != '.':
                break
            else:
                check.append(a[y][x])
                
        if len(check) == len(a):
            ans.append(x)
            
    
    if len(ans) >= 1:
        re_ans = []
        for i in a:
            kari = list(i)
            for j in ans:
                kari[j] = '0'
           # print(kari)
            re_ans.append(kari)
        
        for i in re_ans:
            moji = ''.join(i)
            mojji = moji.replace('0', '')
            print(mojji)
    else:
        for i in a:
            print(i)
def gcd(a,b):
    if b==0:
        return a
    return gcd(b,a%b)

def lcm(a,b):
    return int((a*b)/gcd(a,b))

n=int(input())
a=[int(i) for i in input().split()]
l=1
for i in range(n):
    l=lcm(l,a[i])
s=0
l-=1
for i in range(n):
    s+=(l%a[i])
print(int(s))

### FIXED CODE ###

def lcm(a,b):
    return a*b//(gcd(a,b))
def gcd(a,b):
    if b==0:
        return a
    else:
        return gcd(b,a%b)

n=int(input())
a=[int(i) for i in input().split()]
l=1
for i in range(n):
    l=lcm(a[i],l)
s=0
l-=1
for i in range(n):
    s+=l%a[i]
print(s)
Sp = [1,2,3,4,5,6,7,8,9,10,11,12,13]
Hu = [1,2,3,4,5,6,7,8,9,10,11,12,13]
Cr = [1,2,3,4,5,6,7,8,9,10,11,12,13]
Dy = [1,2,3,4,5,6,7,8,9,10,11,12,13]

num = int(input())
i = 0
while i < num:
     suit, n = raw_input().split
     n = int(n)
     if suit == "S":
        Sp[n-1] = 0
     elif suit == "H":
        Hu[n-1] = 0
     elif suit == "C":
        Cr[n-1] = 0
     else:
        Dy[n-1] = 0
     i += 1

for i in Sp:
    if i != 0:
        print "S", i

for i in Hu:
    if i != 0:
        print "H", i

for i in Cr:
    if i != 0:
        print "C", i

for i in Dy:
    if i != 0:
        print "D", i

### FIXED CODE ###

Sp = [1,2,3,4,5,6,7,8,9,10,11,12,13]
Hu = [1,2,3,4,5,6,7,8,9,10,11,12,13]
Cr = [1,2,3,4,5,6,7,8,9,10,11,12,13]
Dy = [1,2,3,4,5,6,7,8,9,10,11,12,13]

num = int(input())
i = 0

while i < num:
     suit, n = raw_input().split()
     n = int(n)
     if suit == "S":
        Sp[n-1] = 0
     elif suit == "H":
        Hu[n-1] = 0
     elif suit == "C":
        Cr[n-1] = 0
     else:
        Dy[n-1] = 0
     i += 1

for i in Sp:
    if i != 0:
        print "S", i

for i in Hu:
    if i != 0:
        print "H", i

for i in Cr:
    if i != 0:
        print "C", i

for i in Dy:
    if i != 0:
        print "D", i
for a in range(x + 1):
    b = x - a
    if (2 * a + 4 * b) == y:
        print('Yes')
        exit()
print('No')

### FIXED CODE ###

x, y = map(int, input().split())

for a in range(x + 1):
    b = x - a
    if (2 * a + 4 * b) == y:
        print('Yes')
        exit()
print('No')
n,m = map(int,input().split())


def kaijo(i):
    ans = 1
    for i in range(1,i+1):
        ans *= i
    return ans

if abs(m-n) == 1:
    ans = kaijo(n) * kaijo(m)
elif n == m:
    ans = 2*kaijo(n) * kaijo(m)

mod = 10**9+7
print(ans%mod)

### FIXED CODE ###

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

if abs(m-n) == 1:
    ans = math.factorial(n) * math.factorial(m)
elif n == m:
    ans = 2*math.factorial(n) * math.factorial(m)
else:
    ans = 0

mod = 10**9+7
print(ans%mod)
import math
t = int(input())
abcd_list = [[int(i) for i in input().split()] for _ in range(t)]

for i in range(len(abcd_list)):
    a, b, c, d = abcd_list[i]
    _a = a
    is_ok = True
    for j in range(10000):
        if b > a:
            is_ok = False
            break
        if b > d:
            is_ok = False
            break
        if c > b:
            is_ok = True
            break
        g = math.gcd(b, d)
        max_mod_b = b - g + a % g
        if max_mod_b > c:
            print('No')
        else:
            print('Yes')


### FIXED CODE ###

def gcd(a, b):
	while b:
		a, b = b, a % b
	return a
t = int(input())
abcd_list = [[int(i) for i in input().split()] for _ in range(t)]

for i in range(len(abcd_list)):
    a, b, c, d = abcd_list[i]
    if b > a:
        print("No")
        continue
    if b > d:
        print("No")
        continue
    if c > b:
        print('Yes')
        continue
    g = gcd(b, d)
    max_mod_b = b - g + a % g
    if max_mod_b > c:
        print('No')
    else:
        print("Yes")
n, m = list(map(int, input().rstrip().split()))
total = sum([int(i) for i in input().rstrip().split()])
result = -1 if n < total else n - total
print(result)

### FIXED CODE ###

import math

r = int(input().rstrip())
print(r * 2 * math.pi)
LI = lambda: list(map(int, input().split()))

N, X, D = LI()


def sumeq(n):
    return n * (n + 1) // 2


def main():
    d = {}
    for i in range(N + 1):
        a = i * X + sumeq(i - 1) * D
        b = sumeq(N - 1) - sumeq(N - i - 1) - sumeq(i - 1)
        v = (a - a % D) // D
        if a % D in d:
            d[a % D].append((v, b))
        else:
            d[a % D] = [(v, b)]
    
    ans = 0
    for w in d.values():
        w.sort()
        ans += w[0][1] + 1
        x = w[0][0] + w[0][1]
        n = len(w)
        for i in range(1, n):
            r = w[i][0] + w[i][1]
            if x < w[i][0]:
                ans += w[i][1] + 1
            elif x < r:
                ans += r - x
            x = max(x, r)
    print(ans)


if __name__ == "__main__":
    main()


### FIXED CODE ###

LI = lambda: list(map(int, input().split()))

N, X, D = LI()


def sumeq(n):
    return n * (n + 1) // 2


def main():
    if D == 0:
        if X == 0:
            ans = 1
        else:
            ans = N + 1
        print(ans)
        return
    
    d = {}
    for i in range(N + 1):
        a = i * X + sumeq(i - 1) * D
        b = sumeq(N - 1) - sumeq(N - i - 1) - sumeq(i - 1)
        v = (a - a % D) // D
        if a % D in d:
            d[a % D].append((v, b))
        else:
            d[a % D] = [(v, b)]
    
    ans = 0
    for w in d.values():
        w.sort()
        ans += w[0][1] + 1
        x = w[0][0] + w[0][1]
        n = len(w)
        for i in range(1, n):
            r = w[i][0] + w[i][1]
            if x < w[i][0]:
                ans += w[i][1] + 1
            elif x < r:
                ans += r - x
            x = max(x, r)
    print(ans)


if __name__ == "__main__":
    main()
a=input()
b=input()
if a=1 and b=2:
  print "3"
elif a=2 and b=3:
  print "1"
elif a=3 and b=1:
  print "2" 
elif a=3 and b=2:
  print "1"
elif a=2 and b=1:
  print "3"
else:
  print "2" 
  

### FIXED CODE ###

a=input()
b=input()
if a==1 and b==2:
  print "3"
elif a==2 and b==3:
  print "1"
elif a==3 and b==1:
  print "2" 
elif a==3 and b==2:
  print "1"
elif a==2 and b==1:
  print "3"
else:
  print "2"
print'A%sC'%input()[8]

### FIXED CODE ###

print'A%sC'%raw_input()[8]