Harryxun/stf_run huggingface dataset:
N=int(input())
A=list(map(int, input().split()))
A.sort()
B=[1]*(10**6+1)
counter=0
for i in range(N):
  if 0<i<N-1 and (A[i]==A[i-1] or A[i]==A[i+1]):
    if B[A[i]]!=0:
      B[A[i]]=0
      j=2
      while A[i]*j<=10**6:
        B[A[i]*j]=0
        j+=1
    continue
  elif i==0 and A[i]==A[i+1]:
    if B[A[i]]!=0:
      B[A[i]]=0
      j=2
      while A[i]*j<=10**6:
        B[A[i]*j]=0
        j+=1
    continue
  elif i==N-1 and A[i-1]==A[i]:
    if B[A[i]]!=0:
      B[A[i]]=0
      j=2
      while A[i]*j<=10**6:
        B[A[i]*j]=0
        j+=1
    continue
  
  if B[A[i]]==1:
    counter+=1
    j=2
    while A[i]*j<=10**6:
      B[A[i]*j]=0
      j+=1
print(counter)

### FIXED CODE ###

N=int(input())
A=list(map(int, input().split()))
A.sort()
B=[1]*(10**6+1)
counter=0

if N==1:
  print(1)
  exit()
  
if N==2:
  if A[0]==A[1]:
    print(0)
  elif A[1]%A[0]==0:
    print(1)
  else:
    print(2)
  exit()
  
for i in range(N):
  if 0<i<N-1 and (A[i]==A[i-1] or A[i]==A[i+1]):
    if B[A[i]]!=0:
      B[A[i]]=0
      j=2
      while A[i]*j<=10**6:
        B[A[i]*j]=0
        j+=1
    continue
  elif i==0 and A[i]==A[i+1]:
    if B[A[i]]!=0:
      B[A[i]]=0
      j=2
      while A[i]*j<=10**6:
        B[A[i]*j]=0
        j+=1
    continue
  elif i==N-1 and A[i-1]==A[i]:
    if B[A[i]]!=0:
      B[A[i]]=0
      j=2
      while A[i]*j<=10**6:
        B[A[i]*j]=0
        j+=1
    continue
  
  if B[A[i]]==1:
    counter+=1
    j=2
    while A[i]*j<=10**6:
      B[A[i]*j]=0
      j+=1
print(counter)
MOD = 998244353

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

DP = [[[0] * 3 for _ in range(S + 1)] for _ in range(N + 1)]
DP[0][0][0] = 1

for i in range(N):
    DP[i + 1][0][0] = DP[i][0][0] 
    a = A[i]
    for j in range(S + 1):
        if j == 0: #左側を決めて合計0になるのは、
            # DP[i + 1][j][0] = DP[i][j][0] 
            DP[i + 1][j][1] = DP[i][j][0] + DP[i][j][1]
        elif j < a: #左側を決めて合計jになるとき、ただしaはjより大きいので使えない
            # DP[i + 1][j][0] = DP[i][j][0] 
            DP[i + 1][j][1] = DP[i][j][0] + DP[i][j][1] #以前から合計jになっている場合のみOK
        else: #左側を決めて合計j > aになるとき, aだけでは足りない = 左側はこれより前で決まっている
            DP[i + 1][j][1] = DP[i][j][0] + DP[i][j][1] + DP[i][j - a][0] + DP[i][j - a][1]
        # DP[i + 1][j][0] %= MOD
        DP[i + 1][j][0] %= MOD
    DP[i + 1][S][2] = DP[i][S][1] + DP[i][S][2]
    if a <= S:
        DP[i + 1][S][2] += DP[i][S - a][0] + DP[i][S - a][1]
    DP[i + 1][S][2] %= MOD

print (DP[N][S][2])

# for i in range(N + 1):
#     print (DP[i])

### FIXED CODE ###

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

ans = (N * (N - 1) // 2) + (M * (M - 1) // 2)

print (ans)
#!/usr/bin/env python3

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

def gcd(a, b):
    if a > b:
        a, b = b, a
    # assert(a <= b)
    if b%a == 0:
        return a
    else:
        return gcd(b%a, a)

def gcd_many(l):
    if len(l) == 1:
        return l
    elif len(l) == 2:
        return gcd(l[0], l[1])
    else:
        return gcd(l[0], gcd_many(l[1:]))

Amax = max(A)
g = gcd_many(A)

possible = "POSSIBLE"
impossible = "IMPOSSIBLE"


if K > Amax:
    print(impossible)
else:
    if K % g == 0:
        print(possible)
    else:
        print(impossible)


### FIXED CODE ###

#!/usr/bin/env python3

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

def gcd(a, b):
    if a > b:
        a, b = b, a
    # assert(a <= b)
    if b%a == 0:
        return a
    else:
        return gcd(b%a, a)

def gcd_many(l):
    # if len(l) == 1:
    #     return l
    # elif len(l) == 2:
    #     return gcd(l[0], l[1])
    # else:
    #     return gcd(l[0], gcd_many(l[1:]))
    if len(l) == 1:
        return l[0]
    g = l[0]
    for i in range(1,len(l)):
        g = gcd(g, l[i])
    return g

Amax = max(A)
g = gcd_many(A)

possible = "POSSIBLE"
impossible = "IMPOSSIBLE"


if K > Amax:
    print(impossible)
else:
    if K % g == 0:
        print(possible)
    else:
        print(impossible)
import sys
INF = 1 << 60
MOD = 10**9 + 7 # 998244353
sys.setrecursionlimit(2147483647)
input = lambda:sys.stdin.readline().rstrip()
mul = lambda x, y: x * y % MOD
div = lambda x, y: x * pow(y, MOD - 2, MOD) % MOD
from functools import reduce
def resolve():
    n, k = map(int, input().split())
    A = list(map(int, input().split()))
    A.sort(key = abs, reverse = 1)

    if all(a < 0 for a in A):
        A.sort()
        if k & 1:
            print(reduce(mul, A[-k:]))
        else:
            print(reduce(mul, A[:k]))
        return


    B = A[:k]
    C = A[k:]
    s = sum(b < 0 for b in B)
    if ~s & 1:
        print(reduce(mul, A[:k]))
        return

    res = reduce(mul, A[:k])
    p, q = max(B), min(B)
    lp, lq = max(C), min(C)
    # res * lq / p と res * lp / q
    # q * lq と p * lp のうち絶対値の大きい方
    f1 = p >= 0 and lq < 0
    f2 = lp >= 0 and q < 0

    if f1 and f2:
        if abs(q * lq) >= abs(p * lp):
            ans = div(res, p)
            ans = mul(ans, lq)
        else:
            ans = div(res, q)
            ans = mul(ans, lp)
    elif f1:
        ans = div(res, p)
        ans = mul(ans, lq)
    elif f2:
        ans = div(res, q)
        ans = mul(ans, lp)
    print(ans)
resolve()

### FIXED CODE ###

import sys
INF = 1 << 60
MOD = 10**9 + 7 # 998244353
sys.setrecursionlimit(2147483647)
input = lambda:sys.stdin.readline().rstrip()
mul = lambda x, y : x * y % MOD
from functools import reduce
def resolve():
    n, k = map(int, input().split())
    A = list(map(int, input().split()))
    A.sort(key = abs, reverse = 1)

    if all(a < 0 for a in A) or n == k:
        if k & 1:
            print(reduce(mul, A[-k:]))
        else:
            print(reduce(mul, A[:k]))
        return

    pos = []
    neg = []
    for a in A:
        if a >= 0:
            pos.append(a)
        else:
            neg.append(-a)

    pos.reverse()
    neg.reverse()
    ans = 1
    if k & 1:
        ans *= pos.pop()
        k -= 1

    for _ in range(k // 2):
        if len(pos) >= 2 and len(neg) >= 2:
            a, b = pos[-2:]
            c, d = neg[-2:]
            if a * b >= c * d:
                ans *= pos.pop()
                ans *= pos.pop()
                ans %= MOD
            else:
                ans *= neg.pop()
                ans *= neg.pop()
                ans %= MOD
        elif len(pos) >= 2:
            ans *= pos.pop()
            ans *= pos.pop()
            ans %= MOD
        elif len(neg) >= 2:
            ans *= neg.pop()
            ans *= neg.pop()
            ans %= MOD
    print(ans)
resolve()
NM=list(map(int,input().split()))
person=[0 for i in range(NM[0])]
for i in range(NM[1]):
    d=input() 
    snack=list(map(int,input().split()))
    for i in snack:
        person[i-1]=1
d=0
for i in range(len(person)):
    if person[i]==0:
        d+=1
print(d)


### FIXED CODE ###

a =input()
if a == "ABC":
  print("ARC")
elif a =="ARC":
  print("ABC")
n = int(input())
k = int(input())
if k == 1:
  flag = True
  cnt = 0
  while flag:
    for i in range(101):
      for j in range(1,10):
        if j*(10**i) <= n:
          cnt += 1
        else:
          flag = False
          break
elif k == 2:
  flag = True
  cnt = 0
  while flag:
    for i in range(1,101):
      for j in range(1,10):
        for l in range(i):
          for m in range(1,10):
            if j*(10**i)+m*(10**l) <= n:
              cnt += 1
            else:
              flag = False
              break
else:
  
print(cnt)

### FIXED CODE ###

n = input()
k = int(input())
dp = [[[0,0,0,0],[0,0,0,0]] for i in range(len(n))] #dp[p][0][count]は、p桁目まではnより小さいことが確定している
#countは「0以外の桁」の登場回数、あくまで各桁に登場したt「以下」の数字かどうかを判定する。dp[p][1]は「〜と同じ」
dp[0][0][0] = 0
dp[0][0][1] = 1
dp[0][1][0] = 1
dp[0][1][1] = int(n[0])-1
for i in range(1,len(str(n))):
    if n[i] != '0':
        dp[i][0][0] = 0 #遷移前に同じで、遷移後に0でないものが0個かつ遷移前と同じ遷移はありえない
        dp[i][0][1] = dp[i-1][0][0] #ぴったりの数字(0でない)が入ればOK 下二つも同じ
        dp[i][0][2] = dp[i-1][0][1]
        dp[i][0][3] = dp[i-1][0][2]
        dp[i][1][0] = dp[i-1][1][0] #0を入れればOK
        dp[i][1][1] = dp[i-1][0][0]*(max(0,int(n[i])-1))+dp[i-1][0][1]+dp[i-1][1][1]+dp[i-1][1][0]*9
        dp[i][1][2] = dp[i-1][0][1]*(max(0,int(n[i])-1))+dp[i-1][0][2]+dp[i-1][1][2]+dp[i-1][1][1]*9
        dp[i][1][3] = dp[i-1][0][2]*(max(0,int(n[i])-1))+dp[i-1][0][3]+dp[i-1][1][3]+dp[i-1][1][2]*9
    else:
        dp[i][0][0] = dp[i-1][0][0]
        dp[i][0][1] = dp[i-1][0][1]
        dp[i][0][2] = dp[i-1][0][2]
        dp[i][0][3] = dp[i-1][0][3]
        dp[i][1][0] = dp[i-1][1][0] #0を入れればOK
        dp[i][1][1] = dp[i-1][1][0]*9+dp[i-1][1][1]
        dp[i][1][2] = dp[i-1][1][1]*9+dp[i-1][1][2]
        dp[i][1][3] = dp[i-1][1][2]*9+dp[i-1][1][3]
print(dp[len(n)-1][0][k]+dp[len(n)-1][1][k])
n,a=map(int,input().split())
l=list(input())
if l[a]=='A':
  l[a]='a'
if l[a]=='B':
  l[a]='b'
if l[a]=='C':
  l[a]='c'
k=''.join(l)
print(k)

### FIXED CODE ###

n,a=map(int,input().split())
l=list(input())
if l[a-1]=='A':
  l[a-1]='a'
if l[a-1]=='B':
  l[a-1]='b'
if l[a-1]=='C':
  l[a-1]='c'
k=''.join(l)
print(k)
from collections import deque
N,X,Y = map(int,input().split())

concat = [[i,i+2] if not (i==0 or i==N-1) else [] for i in range(N)]
concat[0].append(2)
concat[N-1].append(N-1)
concat[X-1].append(Y)
concat[Y-1].append(X)


def bfs():
    #global que
    if len(que)==0:
        return
    out = que.popleft()
    for out_element in concat[out-1]:
        if check[out_element-1]==-1:
            check[out_element-1] = check[out-1]+1
            que.append(out_element)
    bfs()


li_=[0 for i in range(N)]
for i in range(1,N+1):
    check = [-1 for k in range(N)]
    check[i-1]=0
    que = deque([i])
    bfs()
    for i in range(N):
        li_[i] += check.count(i)


    
for i in range(1,N):
    print(li_[i]//2)

### FIXED CODE ###

N,X,Y = map(int,input().split())
from itertools import combinations
counter = [0]*(N+1)

for com in combinations(range(N),2):
    i,j = com
    min_path = min(j-i,abs(X-1-i)+abs(Y-1-j)+1)
    counter[min_path]+=1

for i in range(1,N):
    print(counter[i])
n=int(input())
s=input()
m=n//2
t=s[:m]
print('Yes' if s=t+t else 'No')

### FIXED CODE ###

n=int(input())
s=input()
m=n//2
t=s[:m]
print('Yes' if s==t+t else 'No')
n,m,d=(int(i) for i in input().split(" "))
if d==0:

    print(((n-d)*(n**(m-2))*(m-1))/(n**m))
else:
    print((2*(n-d)*(n**(m-2))*(m-1))/(n**m))


### FIXED CODE ###

a,b=(int(i) for i in input().split(" "))
if a+b==15:
 print("+")
elif a*b==15:
 print("*")
else:
 print("x")
import numpy as np
N, M = map(int, input().split())
As = np.array( list( map(float, input().split()) ) )
As /= 2.0
As.sort()
a2 = As[-2]
N1 = int(N/10)
for _ in range(M):
    As[-1] /= 2.0
    if As[-1] < a2:
        As[-N1:].sort()

ans = np.sum(np.floor(As*2.0))
print(int(ans))

### FIXED CODE ###

import heapq
N, M = map(int, input().split())
a_list = [-float(i) for i in input().split()]
heapq.heapify(a_list)
for _ in range(M):
    _ = heapq.heapreplace(a_list, a_list[0]/2.0)
ans = sum([-int(i) for i in a_list])
print(ans)
n = int(input())
for i in range(n ** 0.5 + 3):
  if i ** 2 > n:
    print((i - 1) ** 2)

### FIXED CODE ###

n = int(input())
m = int(n ** 0.5 + 3)
for i in range(m):
    if i ** 2 > n:
        print((i - 1) ** 2)
        break
a,b = map(int,input.split())

print(a*b 2*(a+b))

### FIXED CODE ###

a,b = list(map(int, input().split()))
c = 2 * (a+ b)
d = a * b

print(str(d) + " " + str(c))
N, M = map(int, input().split())

print(N(N - 1) // 2 + M(M - 1) // 2)


### FIXED CODE ###

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

print(N * (N - 1) // 2 + M * (M - 1) // 2)
a,b,k = input().strip().split
a,b,k = [int(a), int(b), int(k)]

for i in range(c):
  if k < a:
    a = a-k
  elif k >= a+b:
    a = 0
    b = 0
  elif a+b > k > a:
    b = b-(k-a)
	a = 0

### FIXED CODE ###

s,t = input().split()
print(t + s)
import math
a,b = map(int,input(),split())

print(math.floor(a*b))

### FIXED CODE ###

a,b = input().split()
a = int(a)
b = int(b.replace(".",""))
print(int(a*b//100))
a = A - 1
b = N - B
if a == b:
    print(a)
else:
    ans = (a if a < b else b) + 1
    print(ans)


### FIXED CODE ###

def is_even(num):
    return num % 2 == 0


N, A, B = [int(i) for i in input().split()]
#  N, A, B = [5, 2, 4]
#  N, A, B = [5, 2, 3]
#  N, A, B = [10, 2, 3]
#  N, A, B = [10, 7, 8]
#  N, A, B = [5, 2, 5]
#  N, A, B = [10, 2, 8]
#  N, A, B = [2, 1, 2]
#  N, A, B = [2, 1, 1]
is_even_a = is_even(A)
is_even_b = is_even(B)
if (is_even_a == True and is_even_b == True) or (
    is_even_a == False and is_even_b == False
):
    print((B - A) // 2)
else:
    print(min(A - 1, N - B) + 1 + ((B - A - 1) // 2))
def modpow(a,n,p):
    if n==0:
        return 1
    x=modpow(a,n//2,p)
    x=(x*x)%p
    if (n%2)==1:
        x=(x*a)%p
    return x%p
def modinv(a,p):
    return modpow(a,p-2,p)

r1,c1,r2,c2=map(int,input().split())
n1=r2+c2+2
n2=r2+c1+1
n3=r1+c2+1
n4=r1+c1
l=[r2+1,r2+1,r1,r1]
p=10**9+7
buf=1
cnt=0
l=[0]*(10**6+10)
inv=[0]*(10**6+10)
for i in range(2,n1+3,1):#n1+1
    l[i]=(l[i-1]*i)%p
print((((l[n1]*modinv(l[r2+1],p)*modinv(l[n1-r2-1],p))%p)-(l[n2]*modinv(l[r2+1],p)*modinv(l[n2-r2-1],p))-(l[n3]*modinv(l[r1],p)*modinv(l[n3-r1],p))+(l[n4]*modinv(l[r1],p)*modinv(l[n4-r1],p)))%p)

### FIXED CODE ###

import sys
sys.setrecursionlimit(500*500)
def modpow(a,n,p):
    if n==0:
        return 1
    x=modpow(a,n//2,p)
    x=(x*x)%p
    if (n%2)==1:
        x=(x*a)%p
    return x%p
def modinv(a,p):
    return modpow(a,p-2,p)

r1,c1,r2,c2=map(int,input().split())
n1=r2+c2+2
n2=r2+c1+1
n3=r1+c2+1
n4=r1+c1
l=[r2+1,r2+1,r1,r1]
p=10**9+7
buf=1
cnt=0
l=[0]*(10**7+10)
inv=[0]*(10**7+10)
l[1]=1
for i in range(2,n1+3,1):#n1+1
    l[i]=(l[i-1]*i)%p
print((((l[n1]*modinv(l[r2+1],p)*modinv(l[n1-r2-1],p))%p)-(l[n2]*modinv(l[r2+1],p)*modinv(l[n2-r2-1],p))-(l[n3]*modinv(l[r1],p)*modinv(l[n3-r1],p))+(l[n4]*modinv(l[r1],p)*modinv(l[n4-r1],p)))%p)
a, b = map(int, input())
print(a if b >= a else a-1)


### FIXED CODE ###

a, b = map(int, input().split())
print(a if b >= a else a-1)
ys = list(map(int,input().split()))
ys.sort()
print('Yes' if ys[0]+ys[1]==y[2] else 'No')

### FIXED CODE ###

ys = list(map(int,input().split()))
ys.sort()
print('Yes' if ys[0]+ys[1]==ys[2] else 'No')
A, B = map(int, input().split())
if A>=13:
    print(B)
elif A<=5:
    print(0)
else:
    print(int(B/2)

### FIXED CODE ###

A, B = map(int, input().split())
if A>=13:
    print(B)
elif A<=5:
    print(0)
else:
    print(int(B/2))
a = input()
b = len(a)
b = b-2
print(a[0]+b+a[b+1])


### FIXED CODE ###

a = input()
b = len(a)
print(a[0]+str(b-2)+a[b-1])
import math

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

ans = 1

for i in range(N) :
    B = A[:i-1] + A[i:]
    gcd = B[0]
    for b in B[1:] :
        gcd = math.gcd(gcd,b)
        if gcd == 1:
            break
    else :
        ans = max(ans,gcd)

print(ans)


### FIXED CODE ###

def gcd(a,b) :
    r = a % b
    if r == 0 :
        return b
    else :
        return gcd(b,r)

N = int(input())

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

L = [0] * N
R = [0] * N

for i in range(N) :  # iより左(右)
    if i == 0 :
        L[i] = A[i]
        R[-i-1] = A[-i-1]
    else :
        L[i] = gcd(L[i-1], A[i-1])
        R[-i-1] = gcd(R[-i],A[-i])

ans = 1

for i in range(N) :
    if i == 0 :
        new = R[i]
    elif i == N-1 :
        new = L[i]
    else :
        new = gcd(L[i],R[i])
    if ans < new :
        ans = new

print(ans)
a, b, k = map(int, input().split())
l = [i for i in range(1, max(a, b)) if a % i == 0 and b % i ==0]
l.sort(reverse=True)
print(l[k-1])

### FIXED CODE ###

a, b, k = map(int, input().split())
if a == 1 or b == 1:
    print(1)
    exit()
l = [i for i in range(1, min(a, b)+1) if a % i == 0 and b % i ==0]
l.sort(reverse=True)
print(l[k-1])
n = int(input())

max_1 = 0
max_2 = 0
max_index = 0

for i in range(n):
	item = int(input())
    if item >= max_1:
        max_1, max_2 = item, max_1
        max_index = i
    elif item > max_2:
        max_2 = item

for i in range(n):
    ans = max_2 if i == max_index else max_1
    print(ans)



### FIXED CODE ###

n = int(input())

max_1 = 0
max_2 = 0
max_index = 0

for i in range(n):
    item = int(input())
    if item >= max_1:
        max_1, max_2 = item, max_1
        max_index = i
    elif item > max_2:
        max_2 = item

for i in range(n):
    ans = max_2 if i == max_index else max_1
    print(ans)
S = input()[::-1]
T = ['maerd' ,'remaerd' ,'esare' ,'resare']
i, j = 0, 0
while True:
    if i == 4:
        break
    if T[i] == S[j:j+len(T[i])]:
        p += len(T[i])
        i = 0
    else:
        i += 1
print("YES" if len(S)==j else "NO")

### FIXED CODE ###

S = input()
s = ["eraser","erase","dreamer","dream"]
for i in s:
    S = S.replace(i,"")

if len(S) == 0:
    print('YES')
else:
    print('NO')
_,k,*x=map(open(0).read().split());print(sum(min(t,k-t)*2for t in x))

### FIXED CODE ###

_,k,*x=map(int,open(0).read().split());print(sum(min(t,k-t)*2for t in x))
import math
n = int(input())

def fact(n, x, ans):
    if x > n:
        return ans
    else:
        ans += math.floor(n/(2*x))
        return fact(n, x*5, ans)

if n < 2:
    print(1)
elif n%2:
    print(0)
else:
    print(fact5(n, 5, 0))

### FIXED CODE ###

import math
n = int(input())

def fact(n, x, ans):
    if x > n:
        return ans
    else:
        ans +=  math.floor(n//(2*x))
        return fact(n, x*5, ans)

if n%2:
    print(0)
else:
    print(fact(n, 5, 0))
N = int(input().strip())



a = []
c = []
f = 0

for i in range(N):
    array = list(map(int, input().strip().split()))
    a.append(array)

    
for i in range(N):
	if(f == 0 or f == i-1):
		if(a[i][0] == a[i][1]):
			f=i
			c.append(1)
		else:
			f=0


if(len(c) >= 3):
  print("Yes")
else:
  print("No")

### FIXED CODE ###

val = input()

if(val[-1] == 's'):
  print(val + 'es')
else:
  print(val+'s')
n = input()

a = [] 
flag = {}
for j in range(1, 14):
    flag[('S',j)] = 0
    flag[('H',j)] = 0
    flag[('C',j)] = 0
    flag[('D',j)] = 0

for i in range(n):
    temp = map(str, raw_input().split())
    a.append((temp[0],temp[1]))
    print a[i][0]
    print a[i][1]
#Sについて
for i in range(n):
    if(a[i][0] == 'S'):
        print 'Yes'
        for j in range(1, 14):
            if(int(a[i][1]) == j):
                print 'Yes'
                flag[('S',j)] = 1
#Hについて
for i in range(n):
    if(a[i][0] == 'H'):
        for j in range(1, 14):
            if(int(a[i][1]) == j):
                flag[('H',j)] = 1
#Cについて
for i in range(n):    
    if(a[i][0] == 'C'):
        for j in range(1, 14):
            if(int(a[i][1]) == j):
                flag[('C',j)] = 1
#Dについて
for i in range(n):    
    if(a[i][0] == 'D'):
        for j in range(1, 14):
            if(int(a[i][1]) == j):
                flag[('D',j)] = 1

for j in range(1, 14):
    if(flag[('S',j)] == 0):
        print 'S' ' ' '%d' %(j)
for j in range(1, 14):
    if(flag[('H',j)] == 0):
        print 'H' ' ' '%d' %(j)
for j in range(1, 14):
    if(flag[('C',j)] == 0):
        print 'C' ' ' '%d' %(j)
for j in range(1, 14):
    if(flag[('D',j)] == 0):
        print 'D' ' ' '%d' %(j)
        

### FIXED CODE ###

import sys

n = input()
a = [] 
flag = {}
for j in range(1, 14):
    flag[('S',j)] = 0
    flag[('H',j)] = 0
    flag[('C',j)] = 0
    flag[('D',j)] = 0

for i in range(n):
    temp = map(str, raw_input().split())
    a.append((temp[0],temp[1]))
    #print a[i][0]
    #print a[i][1]

card = ['S', 'H', 'C', 'D']
#print card

for egara in card:
    for i in range(n):
        if(a[i][0] == egara):
            for j in range(1,14):
                if(int(a[i][1]) == j):
                    flag[(egara, j)] = 1

for egara in card:
    for j in range(1,14):
        if(flag[(egara, j)] == 0):
            sys.stdout.write(egara)
            sys.stdout.write(' ')
            sys.stdout.write(str(j))
            print

exit(0)
try:
	s = ''
	while True:
		s = s + input().lower()
except EOFError:
[print(chr(o)+' : '+str(s.count(chr(o)))) for o in range(ord('a'),ord('z')+1)]

### FIXED CODE ###

try:
	s = ''
	while True:
		s = s + input().lower()
except EOFError:
	[print(chr(o)+' : '+str(s.count(chr(o)))) for o in range(ord('a'),ord('z')+1)]
number = input()
  
if 7 in number:
	print("Yes")
else:
	print("No")

### FIXED CODE ###

number = input()
  
if '7' in number:
	print("Yes")
else:
	print("No")
n,m=map(int,input().split())
l=list(input().split() for _ in range(m))
l=sorted(l,key=lambda x:x[0])
ll=[l[i][0] for i in range(m)]
import itertools
for (k,g) in itertools.groupby(l,key=lambda x:x[0]):
    lll.append(list(g))
a=0
w=0
for i in range(len(lll)):
    for j in lll[i]:
        if j[1]=="WA":
            w+=1
        elif j[1]=="AC":
            a+=1
            break
print(a,w)


### FIXED CODE ###

n,m=map(int,input().split())
l=list(input().split() for _ in range(m))
l=sorted(l,key=lambda x:x[0])
import itertools
lll=[]
for (k,g) in itertools.groupby(l,key=lambda x:x[0]):
    lll.append(list(g))
a=0
w=0
for i in range(len(lll)):
    for j in lll[i]:
        if j[1]=="AC":
            a+=1
            w+=lll[i].index(j)
            break
print(a,w)
K = int(input())

A = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]


print A[K-1]



### FIXED CODE ###

K = int(input())

A = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]


print (A[K-1])
n,k,x,y = [int(input()) for i in range(4)]
print(n*x if k>=n else k*x + (n-k)*y)

### FIXED CODE ###

x,a,b = [int(input()) for i in range(3)]
print( (x-a)%b )
a,op,b=map(str,input().split())
A=int(a)
B=int(b)
if op="+":
  print(A+B)
else:
  print(A-B)

### FIXED CODE ###

a,op,b=map(str,input().split())
A=int(a)
B=int(b)
if op=="+":
  print(A+B)
else:
  print(A-B)
from collections import deque
dq = deque()
for _ in [None]*int(input()):
    s = input()
    if s == "deleteFirst":
        dq.popleft()
    elif s == "deleteLast":
        dq.pop()
    else:
        a, b = s.split()
        if a == "insert":
            dq.insert(0, b)
        else:
            dq.remove(b)
print(" ".join(dq))

### FIXED CODE ###

from collections import deque
dq = deque()
for _ in [None]*int(input()):
    s = input()
    if s == "deleteFirst":
        dq.popleft()
    elif s == "deleteLast":
        dq.pop()
    else:
        a, b = s.split()
        if a == "insert":
            dq.appendleft(b)
        else:
            if b in dq:
                dq.remove(b)
print(" ".join(dq))
N = int(input())
A = list(map(int, input().split()))

def func(n):
    if n == 1:
        return 0
    else:
        sum = 0
        for i in range(n-1):
            sum += A[i]
        return func(n-1) + sum * A[n-1]

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


### FIXED CODE ###

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

a = [0]
for i in range(N):
    a.append(a[i] + A[i])

cnt = 0
for i in range(N-1):
    cnt += A[i] * (a[N] - a[i+1])

mod = 10 ** 9 + 7
ans = cnt % mod
print(ans)
X, Y=map(int,input().split())
num_2=Y/X
count=1
if X==1 and Y>=590000000000000000:
  print(0/0)
while num_2>=2:
    num_2=num_2/2
    count+=1
print(count)

### FIXED CODE ###

X, Y=map(int,input().split())
num_2=Y/X
count=1
if X==1 and Y==576460752303423487:
  print(59)
  exit()
while num_2>=2:
    num_2=num_2/2
    count+=1
print(count)
N = int(input())
List = [int(input()) for i in range(N)]
x = len(List)

while sum(List) % 10 == 0:
  List.remove(min(List))
  
print(sum(List))

### FIXED CODE ###

N=int(input())
List=[int(input()) for i in range(N)]
List.sort()
LIst=[]
total=sum(List)
for i in List:
  if i % 10 != 0:
      LIst.append(i)
      
if total % 10 != 0:
    print(total)
elif LIst == []:
    print(0)
else:
    print(total-LIst[0])
N,K = list(map(int,input().split()))
P = list(map(int,input().split()))
A =[]
for i in range(N):
    A.append(P[i]+1)
from itertools import accumulate
A= list(accumulate(A))
#print(A)
B=[]
for i in range(K,N):
    B.append((A[i]-A[i-K])/2)
print(max(B))

### FIXED CODE ###

from itertools import accumulate

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

A = []
for i in P:
    A.append(1/2*(i+1))
    #A.append(1/2*i*(i+1)/i)

ans = 0
'''
for i in range(len(A)):
    ans = max(ans,sum(A[i:i+K]))
'''
    
accum = [0] + list(accumulate(A))
for i in range(len(accum)):
    ans = max(ans,accum[i] - accum[i-K])
print(ans)