Harryxun/stf_run huggingface dataset:
import math
def comb(n,r):
  return int(math.factorial(n)/(math.factorial(r)*math.factorial(n-r)))

N,P=map(int,input().split())
A=list(map(int,input().split()))
odd=0
even=0
total=0
for i in range(N):
  total+=A[i]
  if A[i]%2==0:
    even+=1
  else: 
    odd+=1
total=total%2
evens=2**even

ans=0
if total==even%2:
  for i in range(int(odd/2)+1): 
    ans+=comb(odd,2*i)
else:
  for i in range(int((odd-1)/2)+1):
    ans+=comb(odd,2*i+1)
print(ans*evens)

### FIXED CODE ###

N,P=map(int,input().split())
A=list(map(int,input().split()))
odd=0
for i in range(N):
  if A[i]%2==1: odd+=1
if odd==0:
  if P==1: print(0)
  else: print(2**N)
else:
  print(2**(N-1))
n,a,b = map(int, input().split())

shou = n // (a+b)
amari = n % (a+b)

print(shou * a + a) if amari >= a　else print(shou*a+amari)

### FIXED CODE ###

n,a,b = map(int, input().split())

shou = n // (a+b)
amari = n % (a+b)

if amari >= a:
    print(shou * a + a)

else: print(shou * a + amari)
N=int(input())
L=list(map(int,input().split()))
L.sort()
L.reverse()
count=0
a=len(L)
#print(L)
for i in range(a-2):
  count1=0
  for j in range(i+1,a-1):
    for k in range(j+1,a):
      if L[i]<L[j]+L[k]:
        count+=1
        #print(L[i],L[j],L[k])
      else:
        count1+=1
        break
    if count1==1:
         break
print(count)



### FIXED CODE ###

a,b=map(int,input().split())
if a>=2*b:
  print(a-2*b)
else:
  print(0)
import sys
from math import cos, radians, pi, sqrt
import numpy as np

head = input().split()

N = int(head[0])
M = int(head[1])
inputs = [input() for i in range(M)]

vector = np.zeros((N, N))
for i in range(0, M):
	param = inputs[i].split()
	A = int(param[0])
	B = int(param[1])
	vector[A-1:A,B-1:B] = 1
	vector[B-1:B,A-1:A] = 1

depth = np.zeros((1, N))
que = [0]

while not que == []:
	room = que[0]
	que.pop(0)
	search = np.where(vector[room:room+1]==1)[1]
	for next_room in search:
		if not depth[:,next_room:next_room+1] == 0 or next_room == 0:
			continue
		depth[:,next_room:next_room+1] = depth[:,room:room+1]+1
		que.append(next_room)

print("Yes")
for dep in depth[:,1:][0]:
	print(np.where(depth==dep-1)[1][0]+1)

### FIXED CODE ###

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

will.append(1)

while will:
    visit = will.pop(0)
    for i in root[visit]:
        if visited[i] != -1:
            continue
        will.append(i)
        visited[i] = visit

if visited[1:] == -1:
    print('No')
else:
    print('Yes')
    for i in range(2,len(visited)):
        print(visited[i])
K = int(input())
S = input()
M = K + len(S)
alpha = "abcdefghijklmnopqrstuvwxyz"
mod = int(1e9) + 7 # <-- input modulo
maxf = 200000           # <-- input factional limitation

def doubling(n, m, modulo=mod):
    y = 1
    base = n
    tmp = m
    while tmp != 0:
        if tmp % 2 == 1:
            y *= base
            if modulo > 0:
                y %= modulo
        base *= base
        if modulo > 0:
            base %= modulo
        tmp //= 2
    return y

def inved(a, modulo=mod):
    x, y, u, v, k, l = 1, 0, 0, 1, a, modulo
    while l != 0:
        x, y, u, v = u, v, x - u * (k // l), y - v * (k // l)
        k, l = l, k % l
    return x % modulo

fact = [1 for _ in range(maxf+1)]
invf = [1 for _ in range(maxf+1)]

for i in range(maxf):
    fact[i+1] = (fact[i] * (i+1)) % mod
invf[-1] = inved(fact[-1])
for i in range(maxf, 0, -1):
    invf[i-1] = (invf[i] * i) % mod
  
SS = 0
bas = 1
for i in range(M, len(S)-1, -1):
  SS += (bas * invf[i] * invf[M-i]) % mod
  bas *= 25
  bas %= mod
  SS %= mod
print(SS*fact[M]%mod)

### FIXED CODE ###

K = int(input())
S = input()
M = K + len(S)
alpha = "abcdefghijklmnopqrstuvwxyz"
mod = int(1e9) + 7 # <-- input modulo
maxf = 2000010           # <-- input factional limitation

def doubling(n, m, modulo=mod):
    y = 1
    base = n
    tmp = m
    while tmp != 0:
        if tmp % 2 == 1:
            y *= base
            if modulo > 0:
                y %= modulo
        base *= base
        if modulo > 0:
            base %= modulo
        tmp //= 2
    return y

def inved(a, modulo=mod):
    x, y, u, v, k, l = 1, 0, 0, 1, a, modulo
    while l != 0:
        x, y, u, v = u, v, x - u * (k // l), y - v * (k // l)
        k, l = l, k % l
    return x % modulo

fact = [1 for _ in range(maxf+1)]
invf = [1 for _ in range(maxf+1)]

for i in range(maxf):
    fact[i+1] = (fact[i] * (i+1)) % mod
invf[-1] = inved(fact[-1])
for i in range(maxf, 0, -1):
    invf[i-1] = (invf[i] * i) % mod
  
SS = 0
bas = 1
for i in range(M, len(S)-1, -1):
  SS += (bas * invf[i] * invf[M-i]) % mod
  bas *= 25
  bas %= mod
  SS %= mod
print(SS*fact[M]%mod)
import numpy as np
import itertools
 
H, W, K = list(map(int, input().split())) 
c = [input().split() for i in range(H)]
 
c.replace("." , "0")
c.replace("#" , "1")
 
C_arr = np.array(c)
 
In = np.array(list(itertools.product([0,1] , repeat=H)))
Out = np.array(list(itertolls.product([0,1] , repeat=W)))
 
ans = 0
for i in range(2**H):
  for j in range(2**W):
    In_matrix = np.diag(In[i])
    Out_matrix = np.diag(Out[j])
    
    In_C = np.dot(In_matrix , C_arr)
    In_C_Out = np.dot(In_C , Out_matrix)
    
    ICO = In_C_Out.flatten()
    ICO = ICO.tolist()
    
    if ICO.count(1) == k:
      ans += 1
      
print(ans)

### FIXED CODE ###

H, W, K = list(map(int, input().split()))
 
c = [list(input()) for i in range(H)]
 
cnt = 0
for i in range(2**H):
    for j in range(2**W):
        cnt_black = 0
        for k in range(H):
            if (i >> k) & 1:
                continue
            for l in range(W):
                if (j >> l) & 1:
                    continue
                if c[k][l] == '#':
                    cnt_black += 1
        if cnt_black == K:
            cnt += 1
 
print(cnt)
a,b,c = map(int, raw_input().split())

print(max([a, b, c])*10+sum([a,b,c])-max([a,b,c]))

### FIXED CODE ###

a,b,c = map(int, input().split())

print(max([a, b, c])*10+sum([a,b,c])-max([a,b,c]))
S=input()
for i in range(len(S)):
  if S[i]=="1":
    S[i]="9"
  else:
    S[i]="1"
print(S)

### FIXED CODE ###

S=input()
A=""
for i in range(len(S)):
  if S[i]=="1":
    A+="9"
  else:
    A+="1"
print(int(A))
S = input()
s_list=[]
string= ""
AGCT = ["A", "G", "C", "T"]
for s in S:
    if s in AGCT:
        #string = string + s
        string += s
    else:
        s_list.append(string)
        string=""
print(max(map(len, s_list)))

### FIXED CODE ###

S = input()
s_list=[]
string= ""
AGCT = ["A", "G", "C", "T"]
for s in S:
    if s in AGCT:
        #string = string + s
        string += s
    else:
        s_list.append(string)
        string=""
s_list.append(string)
print(max(map(len, s_list)))
import math

A,B,C,D = map(int,input().split(" "))
min_C = int(B/C)-int((A-1)/C)
min_D = int(B/D)-int((A-1)/D)
lcm = int(C*D/math.gcd(C,D))
min_lcm = int(B/lcm)-int((A-1)/lcm)
print(B-A-min_C-min_D+min_lcm+1)



### FIXED CODE ###

def gcd(a,b):
    while b!=0:
        a,b=b,a%b
    return a

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

A,B,C,D = map(int,input().split(" "))
min_C = B//C-(A-1)//C
min_D = B//D-(A-1)//D
lcm = lcm(C,D)
min_lcm = B//lcm-(A-1)//lcm
print(B-A-min_C-min_D+min_lcm+1)
n, k = map(int, input().split())
r, s, p = map(int, input().split())
t = str(input())
syo = n//k 
total = 0
for i in range(k):
  for j in range(i, n, k):
    if j == i or score == 0 or t[j] ?= te:
      if t[j] = 'r'
      	score = p
      	total += p
        te = 'p'
      elif t[j] = 's'
      	score = r
      	total += r
        te = 'r'
      else:
        score = s
        total += s
        te = 's'
    else:
      score = 0
      
  
print(total)

### FIXED CODE ###

n, k = map(int, input().split())
r, s, p = map(int, input().split())
t = str(input())
syo = n//k 
total = 0
for i in range(k):
  te = ''
  score = 0
  for j in range(i, n, k):
    if score == 0 or t[j] != te:
      if t[j] == 'r':
        score = p
        total += p
        te = 'r'
      elif t[j] == 's':
        score = r
        total += r
        te = 's'
      else:
        score = s
        total += s
        te = 'p'
    else:
      score = 0
      
  
print(total)
import bisect
import sys
input = sys.stdin.readline
def main():
    n, m = map(int, input().split())
    a = list(map(int, input().split()))
    b = []
    min_num = min(a)
    process = []
    p_append = process.append

    for i in range(m):
        array = list(map(int, input().split()))
        p_append(array)

    a.sort()
    process = sorted(process, key=lambda x: -x[1])

    for i in range(len(process)):
        index = bisect.bisect_left(a, process[i][1])
        ooo = min(index, process[i][0])
        if ooo == 0:
            continue
        else:
            a = a[ooo:]
            b.append(process[i][1] * ooo)
        if a[0] > process[i][1]:
            break

    print(sum(a)+sum(b))

if __name__ == '__main__':
    main()

### FIXED CODE ###

from operator import itemgetter

def main():
    n, m = map(int, input().split())
    a = list(map(int, input().split()))
    change = []
    process = []
    p_append = process.append

    for i in range(m):
        array = list(map(int, input().split()))
        p_append(array)

    process.sort(key = itemgetter(1),reverse=True)

    for i in range(len(process)):
        change += [process[i][1]] * process[i][0]
        if len(change) >= n:
            break

    a = a + change
    a.sort(reverse=True)
    a = a[:n]
    print(sum(a))

if __name__ == '__main__':
    main()
n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
c = list(map(int, input().split()))

ans = sum(b)
for i in range(len(a)-1):
  if(a[i+1] == a[i] + 1):
    ans += c[a[i]]
print(ans)

### FIXED CODE ###

n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
c = list(map(int, input().split()))

ans = sum(b)
for i in range(len(a)-1):
  if(a[i+1] == a[i] + 1):
    ans += c[a[i]-1]
print(ans)
import bisect
import copy
import time

start = time.time()

D = int(input())
c = [0] + list(map(int, input().split()))
s = [0] + [[0] + list(map(int, input().split())) for _ in range(D)]
sch, held = [0], [[0] for _ in range(27)]

for d in range(1, D+1):
    SLvar = [s[d][i] + c[i] * (d - held[i][-1]) for i in range(1, 27)]
    t = SLvar.index(max(SLvar)) + 1
    sch.append(t)
    held[t].append(d)

for i in range(1, 27):
    held[i].append(D+1)

s_sort = [0] + [[0] + sorted([[s[d][i], i] for i in range(1, 27)], key=lambda x: x[0], reverse=True) for d in range(1, D+1)]

sch_can = [[copy.copy(sch), copy.copy(held)]] + [0]*9
SL, N = [0]*10, 1

i, j, NN = 1, 1, 0
while time.time() - start < 1.8 and i <= D and j < 27:
    d, q = i, s_sort[i][j][1]

    for n in range(N):
        sch, held = sch_can[n][0], sch_can[n][1]
        print(len(sch), len(held))
        if sch_can[n][0][d] != q:
            SLvar = s[d][q] - s[d][sch_can[n][0][d]]

            ind_p = bisect.bisect_left(sch_can[n][1][sch_can[n][0][d]], d)
            k = d - sch_can[n][1][sch_can[n][0][d]][ind_p-1]
            l = sch_can[n][1][sch_can[n][0][d]][ind_p+1] - d
            SLvar -= c[sch_can[n][0][d]] * k * l

            ind_n = bisect.bisect_left(sch_can[n][1][q], d)
            k = d - sch_can[n][1][q][ind_n-1]
            l = sch_can[n][1][q][ind_n] - d
            SLvar += c[q] * k * l

            if N + NN < 10:
                sch_can[N + NN] = [copy.copy(sch_can[n][0]), copy.copy(sch_can[n][1])]
                del sch_can[n][1][sch_can[N + NN][0][d]][ind_p]
                sch_can[N + NN][1][q].insert(ind_n, d)
                sch_can[N + NN][0][d] = q
                SL[N + NN] = SL[n] + SLvar
                NN += 1
            else:
                if SL[n] + SLvar > min(SL):
                    ind = SL.index(min(SL))
                    sch_can[ind] = [copy.copy(sch_can[n][0]), copy.copy(sch_can[n][1])]
                    del sch_can[n][1][sch_can[ind][0][d]][ind_p]
                    sch_can[ind][1][q].insert(ind_n, d)
                    sch_can[ind][0][d] = q
                    SL[ind] = SL[n] + SLvar
    N += NN
    NN = 0
    i += 1
    if i > D:
        i = 1
        j += 1

for i in range(1, D+1):
    print(sch[i])

### FIXED CODE ###

D = int(input())
c = [0] + list(map(int, input().split()))
s = [0] + [[0] + list(map(int, input().split())) for _ in range(D)]
last = [0]*27

for d in range(1, D+1):
    SLvar = [s[d][i] + c[i] * (d - last[i]) for i in range(1, 27)]

    t = SLvar.index(max(SLvar)) + 1
    print(t)
    last[t] = d
n = int(input())
from collections import Counter
a = list(map(int,input().split()))
b = []
for i in range(n):
  b.append(a[i]-i-1)
b = Counter(b)
k = -a[0]-1
a.append(10**10)
ans = 0
for i in range(n):
  ans += b[k]
  k -= 1
  k += a[i]-a[i+1]
print(ans)

### FIXED CODE ###

s = input()
if s == "ABC":
  print("ARC")
else:
  print("ABC")
N, K = map(int, input().split())

for i in range(N):
    if 2**i > N:
        a = i-1
        b = N - 2**a
        break
for j in range(K):
    if 2**j > K:
        c = j-1
        d = K - 2**c
        break

if N <= K:
    print((2**(2*a-c+1)+2**(-c)+3*2**(a-c+1)*b)/3N)
else:
    print((2**(c+1)+2**(-c)+3*2*b)/3N + (N-K+1)/N)

### FIXED CODE ###

from math import ceil, log2
N, K = map(int, input().split())

M = min(N, K)
p = max((N-K)/N, 0)
for n in range(1, M+1):
    p += 2**(-ceil(log2(K/n))) / N
print(p)
import fractions
def lcm(a,b):
  return (a*b)//fractions.gcd(a,b)
n=int(input())
x=lcm(int(input()),int(input()))
for i in range(n-2):
  x=lcm(x,int(input()))
print(x)

### FIXED CODE ###

import fractions
def lcm(a,b):
  return (a*b)//fractions.gcd(a,b)
n=int(input())
if n>1:
  x=lcm(int(input()),int(input()))
  for i in range(n-2):
    x=lcm(x,int(input()))
  print(x)
else:print(int(input()))
H,W=map(int,input().split())
S=[list(input()) for i in range(H)]
for i in range(H):
    for j in range(W):
        if s[i][j]=='#':
            continue
            #もし見ている文字が#だったら通過
        cnt=0
        for k in [-1,0,1]:
            if i+k<0 or H<=i+k:
                continue
                #iが端の時通過
            for l in [-1,0,1]:
                if j+l<0 or j+l>=w:
                    continue
                    #jが端の時通過
                cnt+=1*(S[i+k][j+l]=='#')
                #一個前一個上~一個下一個右までの#の数を足す
        S[i][j]=str(cnt)
        #見ていた数を足した数字に変更
for i in range(H):
    print("".join(S[i]))


### FIXED CODE ###

H,W=map(int,input().split())
S=[list(input()) for i in range(H)]
for i in range(H):
    for j in range(W):
        if S[i][j]=='#':
            continue
            #もし見ている文字が#だったら通過
        cnt=0
        for k in [-1,0,1]:
            if i+k<0 or H<=i+k:
                continue
                #iが端の時通過
            for l in [-1,0,1]:
                if j+l<0 or j+l>=W:
                    continue
                    #jが端の時通過
                cnt+=1*(S[i+k][j+l]=='#')
                #一個前一個上~一個下一個右までの#の数を足す
        S[i][j]=str(cnt)
        #見ていた数を足した数字に変更
for i in range(H):
    print("".join(S[i]))
K = int(sys.stdin.readline())
A, B = map(int, input().split())
for i in range(A,B+1):
    if i%K==0:
        return "OK"
    return "NG"

### FIXED CODE ###

K=int(input())
A,B = map(int, input().split())
count=0
for i in range(A,B+1):
    if i%K==0:
        print("OK")
        count+=1
        break
if count==0:
    print("NG")
import fractions
A,B = map(int,input().split())
x = fractions.gcd(A,B)
pf = {}
for i in range(2,int(x**0.5)+2):
  while x%i == 0:
    pf[i] = pf.get(i,0) +1
    x //= i
if x > 1:
  pf[m] = 1
print(len(pf)+1)

### FIXED CODE ###

import fractions
A,B = map(int,input().split())
x = fractions.gcd(A,B)
pf = {}
for i in range(2,int(x**0.5)+2):
  while x%i == 0:
    pf[i] = pf.get(i,0) +1
    x //= i
if x > 1:
  pf[x] = 1
print(len(pf)+1)
input_line = input()
n = int(input_line / 111)
print(n*111)

### FIXED CODE ###

input_line = input()
n = int(int(input_line) / 111)
if int(input_line) % 111 == 0:
  print(n *111)
else:
  print(111 + n *111)
import fractions

A, B, C, D = map(int, input().split())

s = B - A + 1

if A % C == 0 or A % D == 0:
    A -= 1

def lcm(x, y):
    return (x * y) // fractions.gcd(x, y)

E = lcm(C, D)

val1 = A // C
val2 = B // C
val3 = A // D
val4 = B // D
val5 = A // E
val6 = B // E

print(s - (val2 - val1 + val4 - val3 - (val6 - val5)))


### FIXED CODE ###

result = "Good"
s = list(input())
if s[0] == s[1] or s[1] == s[2] or s[2] == s[3]:
    result = "Bad"
print(result)
def cul(lst, m):
    r = 0
    for i in lst:
        r  += i if i < m else m
    return r

n, k = map(int,input().split())
s = input()
val = []

if len(s) == 1:
    print(1)

a = 1
for i in range(1, len(s)):
    if s[i-1] == s[i]:
        a += 1
    else:
        val.append(a)
        a = 1
val.append(a)
ans = []
now = int(s[0])
for i in range(len(s)-k):
    lst = val[i:i+k*2+1]
    if now == 1:
        ans.append(cul(lst, n))
    now = 1 if now == 0 else 0
print(max(ans))

### FIXED CODE ###

n, k = map(int,input().split())
s = input()
nums = []

now = 1
cnt = 0
for i in range(len(s)):
    if s[i] == str(now): cnt += 1
    else:
        nums.append(cnt)
        now = 1 - now
        cnt = 1
if not cnt == 0: nums.append(cnt)
if len(nums) % 2 == 0: nums.append(0)

summ = [0]
for i in range(len(nums)):
    summ.append(summ[i]+nums[i])

ans = 0
for i in range(len(nums))[::2]:
    left = i
    right = min(i+k*2+1, len(nums))
    tmp = summ[right] - summ[left]

    ans = max(tmp, ans)


print(ans)
n = int(input())
l = list(int,input().split())

l_max = max(l)
if sum(l) - l_max > l_max:
    print("Yes")
else:
    print("No")

### FIXED CODE ###

N =int(input())
L =[int(j) for j in input().split()]
if max(L) < sum(L)-max(L):
    print('Yes')
else:
    print('No')
aord = ord("a")
s = list(raw_input())
k = int(input())
i = 0

while k > 0 and i < len(s):
	if k >= ord('z') - ord(s[i]) + 1:
		if s[i] == "a": continue
		k -= ord('z') - ord(s[i]) + 1
		s[i] = "a"

	i += 1

s[len(s)-1] = chr(ord(s[len(s)-1]) + k)
print ''.join(s)

### FIXED CODE ###


aord = ord("a")
s = list(raw_input())
k = int(input())
i = 0

while k > 0 and i < len(s):
	if k >= ord('z') - ord(s[i]) + 1:
		if s[i] != "a":
			k -= ord('z') - ord(s[i]) + 1
			s[i] = "a"

	i += 1
k = k%26
s[len(s)-1] = chr(ord(s[len(s)-1]) + k)
print ''.join(s)
n,m=map(int,input().split())
MOD = 10**9+7
ans=1
def inv_mod(a, p=MOD):
    def inv_mod_sub(a, p):
        if a == 1:
            return 1, 0
        else:
            d, r = p//a, p%a
            x, y = inv_mod_sub(r, a)
            return y-d*x, x
    if p < 0: p = -p
    a %= p
    return inv_mod_sub(a,p)[0] % p

def comb_mod(n, k):
    if k < 0 or k > n:
        return 0
    else:
        return f_mod[n]*f_mod_inverse[k]*f_mod_inverse[n-k] % MOD
f_mod=[1]*(m+1)
f_mod_inverse=[1]*(m+1)
for i in range(1,m+1):
  f_mod[i]=f_mod[i-1]*i%MOD
  f_mod_inverse[i]=f_mod_inverse[i-1]*inv_mod(i) % MOD  
pf={}
for i in range(2,int(m**0.5)+1):
    while m%i==0:
        pf[i]=pf.get(i,0)+1
        m//=i
if m>1:pf[m]=1
for i in pf.values():
  ans*=comb_mod(i+n-1,n-1)
print(ans%MOD)


### FIXED CODE ###

import sys
n,m=map(int,input().split())
MOD = 10**9+7
ans=1
if m==1:
  print(1)
  sys.exit()
def inv_mod(a, p=MOD):
    def inv_mod_sub(a, p):
        if a == 1:
            return 1, 0
        else:
            d, r = p//a, p%a
            x, y = inv_mod_sub(r, a)
            return y-d*x, x
    if p < 0: p = -p
    a %= p
    return inv_mod_sub(a,p)[0] % p

def comb_mod(n, k):
    if k < 0 or k > n:
        return 0
    else:
        return f_mod[n]*f_mod_inverse[k]*f_mod_inverse[n-k] % MOD
pf={}
for i in range(2,int(m**0.5)+1):
    while m%i==0:
        pf[i]=pf.get(i,0)+1
        m//=i
if m>1:pf[m]=1
Max=max(list(pf.values()))
f_mod=[1]*(Max+n+1)
f_mod_inverse=[1]*(Max+n+1)
for i in range(1,Max+n+1):
  f_mod[i]=(f_mod[i-1]*i)%MOD
  f_mod_inverse[i]=(f_mod_inverse[i-1]*inv_mod(i)) % MOD  
for i in pf.values():
  ans*=comb_mod(i+n-1,n-1)
print(ans%MOD)
n,m=map(int,input().split())
if n<10 && m<10 :
  print(n*m)
else :
  print(-1)


### FIXED CODE ###

n,m=map(int,input().split())
if n<10 and m<10 :
  print(n*m)
else :
  print(-1)
from math import gcd
A,B,K=map(int,input().split())
C=gcd(A,B)
count=0
for x in range(C,-1,-1):
    if C%x==0:
        count+=1
        if count==K:
            ans=x
            break
print(ans)

### FIXED CODE ###

import fractions
A,B,K=map(int,input().split())
C=fractions.gcd(A,B)
cnt=0
for x in range(C,0,-1):
    if C%x==0:
        cnt+=1
        if cnt==K:
            print(x)
            break
N = int(input())
L = [0] * N
for x in range(1,101):
  for y in range(1,101):
    for z in range(1,101):
      n = ((x + y) ** 2 + (y + z) ** 2 + (z + x) ** 2)/ 2 
      if n <= N:
        L[n - 1] += 1
print(*L, sep='\n')

### FIXED CODE ###

N = int(input())
L = [0] * N
for x in range(1,101):
  for y in range(1,101):
    for z in range(1,101):
      n = int(((x + y) ** 2 + (y + z) ** 2 + (z + x) ** 2)/ 2 )
      if n <= N:
        L[n - 1] += 1
print(*L, sep='\n')
xxx

### FIXED CODE ###

s = input()
print(700 + s.count("o")*100)
from collections import heapq

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

max_score = float('-inf')
for i in range(N, 2 * N + 1):
    rm_count_1 = i - N
    rm_count_2 = N - rm_count_1
    a_list_1 = []
    a_list_2 = []
    for k in a[0:i]:
        if len(a_list_1) >= N:
            heappushpop(a_list_1, k)
        else:
            heappush(a_list_1, k)
    for k in a[i:3*N]:
        if len(a_list_2) >= N:
            heappushpop(a_list_2, -k)
        else:
            heappush(a_list_2, -k)
    sum_1 = sum(a_list_1)
    sum_2 = sum(a_list_2)
    score = sum_1 + sum_2
    if score > max_score:
        max_score = score

print(max_score)

### FIXED CODE ###

from heapq import heappush, heappushpop

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

a_list_1 = []
a_list_2 = []
for i in a[0:N]:
    heappush(a_list_1, i)
for i in list(reversed(a))[0:N]:
    heappush(a_list_2, -i)

sum_1 = sum(a_list_1)
sum_2 = sum(a_list_2)
sum_arr_1 = [0] * (N + 1)
sum_arr_1[0] = sum_1
sum_arr_2 = [0] * (N + 1)
sum_arr_2[-1] = sum_2
for k in range(N, 2 * N):
    l = heappushpop(a_list_1, a[k])
    sum_1 += a[k] - l
    sum_arr_1[k - N + 1] = sum_1

for k in reversed(range(N, 2 * N)):
    l = heappushpop(a_list_2, -a[k])
    sum_2 += -a[k] - l
    sum_arr_2[k - N] = sum_2

max_score = float('-inf')
for s1, s2 in zip(sum_arr_1, sum_arr_2):
    score = s1 + s2
    if score > max_score:
        max_score = score

print(max_score)
N = int(input())
S = list(map(int,input().split())) 
result_list = [] 
for i in range(N): 
    X = S[:i] 
    Y = S[i:] 
    counter = 0 
    old_list = [] 
    for j in X: 
        if j in Y and not(j in old_list): 
            counter += 1 old_list.append(j) 
            result_list.append(counter) 
print(max(result_list))

### FIXED CODE ###

N = int(input())
S = list(input()) 
result_list = [] 
for i in range(N): 
    X = S[:i] 
    Y = S[i:] 
    counter = 0 
    old_list = [] 
    for j in X: 
        if j in Y and not(j in old_list): 
            counter += 1 
            old_list.append(j) 
            result_list.append(counter) 
if result_list == []:
    print(0)
else:
    print (max(result_list))
n = int(input())
S = ['S']
H = ['H']
C = ['C']
D = ['D']
for i in range(0, n):
 x = list(input().split())
 if x[0] == 'S':
  S.append(int(x[1]))
 elif x[0] == 'H':
  H.append(int(x[1]))
 elif x[0] == 'C':
  C.append(int(x[1]))
 else:
  D.append(int(x[1]))
def print(list):
 list.sort()
 for i in range(1, 14):
  if i not in list:
   print("{0} {1}".format(list[0], i, end = "\n")
print(S)
print(H)
print(C)
print(D)
 

### FIXED CODE ###

n = int(input())
S = []
H = []
C = []
D = []
for i in range(0, n):
 x = list(input().split())
 if x[0] == 'S':
  S.append(int(x[1]))
 elif x[0] == 'H':
  H.append(int(x[1]))
 elif x[0] == 'C':
  C.append(int(x[1]))
 else:
  D.append(int(x[1]))
def pr(list, type):
 list.sort()
 for i in range(1, 14):
  if i not in list:
   print("{0} {1}".format(type, i))
pr(S, 'S')
pr(H, 'H')
pr(C, 'C')
pr(D, 'D')