Harryxun/stf_run huggingface dataset:
n, m = map(int, input().split())
p = []
s = []
pen= [0] * (n+1)
result=[False] * (n+1)
cnt = 0
for i in range(m):
    p1, s1 = input().split()
    p1 = int(p1)
    p.append(p1)
    s.append(s1)

    if s1 == "AC" and not result[p1]:
        result[p1] = True
        cnt += 1
    if s1 == "WA" and not result[p1]:
        pen[p1] += 1
print(f"{cnt} {sum(pen)}")


### FIXED CODE ###

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

pen= [0] * (n+1)
result=[False] * (n+1)
cnt = 0
pen_sum = 0
for i in range(m):
    p1, s1 = input().split()
    p1 = int(p1)
    if s1 == "AC" and not result[p1]:
        result[p1] = True
        cnt += 1
        pen_sum += pen[p1]
    if s1 == "WA" and not result[p1]:
        pen[p1] += 1

print("{} {}".format(cnt, pen_sum))
import math
import copy
import sys
import fractions
import numpy as np
from functools import reduce


# ===FUNCTION===

def getInputInt():
    inputNum = int(input())
    return inputNum


def getInputListInt():
    outputoData = []
    inputData = input().split()
    outputData = [int(n) for n in inputData]

    return outputData


def getSomeInputInt(n):
    outputDataList = []
    for i in range(n):
        inputData = int(input())
        outputDataList.append(inputData)

    return outputDataList


def getSomeInputListInt(n):
    inputDataList = []
    outputDataList = []
    for i in range(n):
        inputData = input().split()
        inputDataList = [int(n) for n in inputData]
        outputDataList.append(inputDataList)

    return outputDataList


# ===CODE===

n = getInputInt()
data = getInputListInt()

ans = 0

#最小公倍数
def lcm_base(x, y):
    return (x * y) // math.gcd(x, y)

def lcm(*numbers):
    return reduce(lcm_base, numbers, 1)

def lcm_list(numbers):
    return reduce(lcm_base, numbers, 1)

lcm_num = lcm_list(data)

for i in range(n):
    ans += lcm_num % data[i]

print(ans)

### FIXED CODE ###

import math
import copy
import sys
import fractions
import numpy as np
from functools import reduce


# ===FUNCTION===

def getInputInt():
    inputNum = int(input())
    return inputNum


def getInputListInt():
    outputoData = []
    inputData = input().split()
    outputData = [int(n) for n in inputData]

    return outputData


def getSomeInputInt(n):
    outputDataList = []
    for i in range(n):
        inputData = int(input())
        outputDataList.append(inputData)

    return outputDataList


def getSomeInputListInt(n):
    inputDataList = []
    outputDataList = []
    for i in range(n):
        inputData = input().split()
        inputDataList = [int(n) for n in inputData]
        outputDataList.append(inputDataList)

    return outputDataList


# ===CODE===

n = getInputInt()
data = getInputListInt()

ans = data[0]


for i in range(1, n):
    ans = ans * data[i] // fractions.gcd(ans, data[i])

prians=0
for i in range(n):
    prians += (ans-1) % data[i]
print(prians)
N, K = map(int, input().split())
S = input()

S[K] = S[K].lower()

print(S)

### FIXED CODE ###

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

S[K - 1] = S[K - 1].lower()

print(''.join(S))
from collections import deque

n = int(input())
a = [list(map(lambda x:int(x)-1,input().split())) for _ in range(n)]

l,day = [0]*n,[0]*n

que = deque([i for i in range(n)])

while que:
    u = que.popleft()
    v = a[u][l[u]]
    if a[v][l[v]] == u:
        day[u] = max(day[u],day[v]) + 1
        l[u] += 1
        l[v] += 1
        que.append(u)
        que.append(v)

if any(x != n-1 for x in l):
    print(-1)
    exit()

print(max(day))

### FIXED CODE ###

import time
start = time.time()
n = int(input())
a = [list(map(int,input().split())) for _ in range(n)]
s = [0 for i in range(n)] #それぞれ何試合目か
ans = 0
need = n*(n-1)//2
while need:
    c = [0 for i in range(n)] #今日試合をするかどうか
    ans += 1
    for first in range(n):
        if c[first] == 0 and s[first] < n-1:
            second = a[first][s[first]]-1 # firstが対戦したい相手
            second_num = s[second] # #secondの対戦番号
            if c[second] == 0 and a[second][second_num]-1 == first:
                c[first] = 1
                c[second] = 1
                s[first] += 1
                s[second] += 1
                need -= 1
    if sum(c) == 0:
        print(-1)
        exit()
    now = time.time()-start
    if now > 1.8:
        print(n*(n-1)//2)
        exit()
print(ans)
from functools import lru_cache

N = int(input())
X = input()
x = int(X, 2)
y = X.count('1')
if y == 0:
    x2 = 0
else:
    x2 = x % (y-1)
x1 = x % (y+1)

def f(n):
    if n == 0:
        return 0
    return 1 + f(n % bin(n).count('1'))

d = [0] * (2*10**5+5)
for i in range(2*10**5+5):
    d[i] = f(i)

for i in range(N):
    if x >>(N - i - 1) & 1:
        # print(f(x-pow(2, N-i-1)))
        print(d[(x2 - pow(2, N - i - 1, y-1)) % (y-1)] + 1)
    else:
        # print(f(x+pow(2, N-i-1)))
        print(d[(x1 + pow(2, N - i - 1, y+1)) % (y+1)] + 1)

### FIXED CODE ###

from functools import lru_cache

N = int(input())
X = input()
x = int(X, 2)
y = X.count('1')
if y == 1:
    x2 = 0
else:
    x2 = x % (y-1)
x1 = x % (y+1)

def f(n):
    if n == 0:
        return 0
    return 1 + f(n % bin(n).count('1'))

d = [0] * (2*10**5+5)
for i in range(2*10**5+5):
    d[i] = f(i)

for i in range(N):
    if x >>(N - i - 1) & 1:
        # print(f(x-pow(2, N-i-1)))
        if y - 1 == 0:
            print(0)
        else:
            print(d[(x2 - pow(2, N - i - 1, y-1)) % (y-1)] + 1)
    else:
        # print(f(x+pow(2, N-i-1)))
        print(d[(x1 + pow(2, N - i - 1, y+1)) % (y+1)] + 1)
S = input()

if S.count(A) >= 1 and S.count(B) >= 1 :
    print("Yes")
else :
    print("No")

### FIXED CODE ###

S = input()

if S.count("A") >= 1 and S.count("B") >= 1 :
    print("Yes")
else :
    print("No")
x, y = map(int, input().split())
for y in range(x):
  C = 1*Y
  if C >= 10^18:
    print(-1)
  else:
    print(C)

### FIXED CODE ###

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

a = 1
if 0 in list:
    print(0)
    exit()
else:
    for i in list:
        a *= i
        if a > 10**18:
            print(-1)
            exit()
print(a)
from _typeshed import ReadableBuffer
import sys
def LI(): return list(map(int, sys.stdin.buffer.readline().split()))
def I(): return int(sys.stdin.buffer.readline())
def LS(): return sys.stdin.buffer.readline().rstrip().decode('utf-8').split()
def S(): return sys.stdin.buffer.readline().rstrip().decode('utf-8')
def IR(n): return [I() for i in range(n)]
def LIR(n): return [LI() for i in range(n)]
def SR(n): return [S() for i in range(n)]
def LSR(n): return [LS() for i in range(n)]
def SRL(n): return [list(S()) for i in range(n)]
def MSRL(n): return [[int(j) for j in list(S())] for i in range(n)]
mod = 10 ** 9 + 7

X, N = LI()
P = LI().sort()

# Pに含まれない整数（負も含まれる）で最もXに近くて最小の値を探す

if N == 0:
    print(X)
    sys.exit()

elif (X not in P) and (N != 0):
    print(X)
    sys.exit()

else:
    while X in P:
        X = X - 1
    print(X)
    sys.exit()

### FIXED CODE ###

import sys
def LI(): return list(map(int, sys.stdin.buffer.readline().split()))
def I(): return int(sys.stdin.buffer.readline())
def LS(): return sys.stdin.buffer.readline().rstrip().decode('utf-8').split()
def S(): return sys.stdin.buffer.readline().rstrip().decode('utf-8')
def IR(n): return [I() for i in range(n)]
def LIR(n): return [LI() for i in range(n)]
def SR(n): return [S() for i in range(n)]
def LSR(n): return [LS() for i in range(n)]
def SRL(n): return [list(S()) for i in range(n)]
def MSRL(n): return [[int(j) for j in list(S())] for i in range(n)]
mod = 10 ** 9 + 7

X, N = LI()
P = LI()
# u = X
# d = X
# Pに含まれない整数（負も含まれる）で最もXに近くて最小の値を探す

if N == 0:
    print(X)
    sys.exit()

elif (N != 0) and (X not in P):
    print(X)
    sys.exit()

Q = [q for q in range(-1, 102) if q not in P]  # -1以上101以下整数のうちPに存在しないもの
ans = min(Q, key=lambda x: (abs(x - X), x))  # maspyさん解法
# python の min() は、順序比較のためのキーを指定できて、abs(x-X) が最小のもののうち x が最小のものをとるとかはこんな感じで書いたりできます。
print(ans)
n, m = map(int, input().split())
num = ["A"] * n
for i in range(m):
    s, c = map(int, input().split())
    if n == 1 and s == 1 and c == 0:
        print(0)
        exit()
    elif s == 1 and c == 0:
        print(-1)
        exit()
    elif num[s-1] == "A":
        num[s-1] = c
    elif num[s-1] != "A" and num[s-1] != c:
        print(-1)
        exit()
for j in range(3):
    if num[j] == "A":
        num[j] = 0
    if num[0] == 0:
        num[0] = 1
print(int("".join(map(str, num))))


### FIXED CODE ###

n, m = map(int, input().split())
num = ["A"] * n
for i in range(m):
    s, c = map(int, input().split())
    if n>1 and s == 1 and c == 0:
        print(-1)
        exit()
    elif num[s - 1] != "A" and num[s - 1] != c:
        print(-1)
        exit()
    num[s - 1] = c

for j in range(n):
    if num[j] == "A":
        num[j] = 0
    if n>1 and num[0] == 0:
        num[0] = 1
print(int("".join(map(str, num))))
import math
abc = input()
abc = abc.split(' ')
a = int(abc[0])
b = int(abc[1])
c = int(abc[2])

if 4*a*b<(c-a-b)*(c-a-b):
    print('Yes')
else:
    print('No')




### FIXED CODE ###

array = [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]

inp = input()

inp = int(inp)

print('{}'.format(array[inp-1]))
# python template for atcoder1
import sys
sys.setrecursionlimit(10**9)

s = input()

K = []
for k in range(1, len(s)):
    if s[k] != s[k-1]:
        K.append(max(len(s)-k, k))
    else:
        continue

ans = 0
if min(K) == 0:
    if all(v == "1" for v in s):
        ans = len(K)
else:
    ans = min(K)
print(ans)


### FIXED CODE ###

import sys
sys.setrecursionlimit(10**9)

s = input()

K = float('inf')
if all(c == '0' for c in s):
    K = len(s)
elif all(c == '1' for c in s):
    K = len(s)
else:
    for k in range(1, len(s)):
        if s[k] != s[k-1]:
            K = min(K, max(k, len(s)-k))
        else:
            continue

print(K)
contest_1 == "ABC"
contest_2 == "ARC"

S = input()

if S == contest_1:
    print(contest_2)
else:
    print(contest_1)

### FIXED CODE ###

contest_1 = "ABC"
contest_2 = "ARC"

S = input()

if S == contest_1:
    print(contest_2)
else:
    print(contest_1)
a,b=map(int,input().split())
i=1
while a+(i-1)*(a-1)<b:
    i+=1
print(i)

### FIXED CODE ###

s=input()
t=input()
a=0
for i in range(3):
  if s[i]==t[i]:
    a+=1
print(a)
n, m = map(int,input().split())
a = [-1]
for i in range(m):
    ai = int(input())
    a.append(ai)
a.append(n+1)]

def factorial(x):
  if x == 0:
    return 1
  else:
    return x * factorial(x-1)

def C(x,y):
    return factorial(x)//(factorial(x-y)*factorial(y))

def f(x):
    if x == 0:
        return 1
    else:
        ret = 0
        for i in range(x//2+1):
            ret += C(x-i,i)
        return ret

b = []
for i in range(m+1):
    b.append(a[i+1]-a[i]-2)

ans = 1
if -1 in b:
    print(0)
else:
    for j in b:
        ans *= (f(j)%1000000007)
    print(ans%1000000007)

### FIXED CODE ###

n, m = map(int,input().split())
dp = [1]*(n+1)
a = []
for i in range(m):
    ai = int(input())
    a.append(ai)

for i in a:
    dp[i] = 0

for i in range(2,n+1):
    if dp[i] != 0:
        dp[i] = (dp[i-1] + dp[i-2]) % (10**9+7)

print(dp[n])
n = int(input())
A = list(map(int, input().split()))
k = [0]*n
mk = [0]*8
for i in range(n):
    k[i] = A[i]//400
    mk[k[i]-1] += 1
if mk[-1]:
    print(len(set(k))-1, min(len(set(k))-1+mk[-1], 8))
else:
    print(len(set(k)), len(set(k)))

### FIXED CODE ###

#cant fix re, just copy and paste.
n = int(input())
a = list(map(int, input().split()))
a.sort()
free=0
cset=set()
for rate in a:
    color = int(rate / 400)
    if color >=8:
        free+=1
    else:
        cset.add(color)

colormin=len(cset)
colormax=colormin+free
 
print(str(max(1,colormin)), colormax)
cnt = 0
n = int(input())
for i in range(1, n + 1):
  p = int(input())
  if int(i) != p :
    cnt += 1
    if cnt >= 2:
      break
if cnt <= 1 :
  print("YES")
else :
   print("NO")


### FIXED CODE ###

cnt = 0
n = int(input())
p = list(map(int, input().split()))
for i in range(1, n + 1):
  if int(i) != p[i - 1] :
    cnt += 1
    if cnt >= 3:
      break
if cnt <= 2 :
  print("YES")
else :
   print("NO")
n = int(input())
A = list(map(int, input().split(' ')))
q = int(input())
M = list(map(int, input().split(' ')))

def rec(i, sum, m):
    if sum == m:
        return True
    elif sum > m:
        return False

    if i >= n:
        return False

    rst = rec(i+1, sum, m) or rec(i+1, sum + A[i], m)
    return rst

for m in M:
    if rec(0, 0, m):
        print('yes')
    else:
        print('no')


### FIXED CODE ###

n = int(input())
A = list(map(int, input().split(' ')))
q = int(input())
M = list(map(int, input().split(' ')))

# 上限と下限でフィルター
max_A = 0
min_A = float('inf')
for num in A:
    max_A += num
    if num < min_A:
        min_A = num

def rec(i, m):
    if m < 0:
        return False
    elif m == 0:
        return True
    if i >= n:
        return False

    rst = rec(i+1, m - A[i]) or rec(i+1, m)
    return rst

for m in M:
    if m < min_A or max_A < m:
        print('no')
    elif rec(0, m):
        print('yes')
    else:
        print('no')
n, k = tuple(map(int, input.split()))
l = list[map(int, input.split())]
s = sum(l.sort().[:k])
print(s)

### FIXED CODE ###

n, k = tuple(map(int, input().split()))
l = list(map(int, input().split()))
s = sum(sorted(l)[:k])
print(s)
n,a,b,c = int(input().spilt())

ko = [int(input()) for i in range(n)]
INF = 10**9

 def dfs(q,w,e,r):
 	if q == n:
 		 return abs(a-w) + abs(b-e) + abs(c-r) - 30 if min(a,b,c) > 0 else INF
 	re0 = dfs(q+1,w,e,r)
 	re1 = dfs(q+1,w+ko[q],e,r) + 10
 	re2 = dfs(q+1,w,e+ko[ko],r) + 10
 	re3 = dfs(q+1,w,e,r+ko[q]) + 10
 	return min(re0,re1,re2,re3)

print(dfs(0,0,0,0))

### FIXED CODE ###

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

ko = [int(input()) for i in range(n)]
INF = 10**9

def dfs(q,w,e,r):
 	if q == n:
 		 return abs(a-w) + abs(b-e) + abs(c-r) - 30 if min(w,e,r) > 0 else INF
 	re0 = dfs(q+1,w,e,r)
 	re1 = dfs(q+1,w+ko[q],e,r) + 10
 	re2 = dfs(q+1,w,e+ko[q],r) + 10
 	re3 = dfs(q+1,w,e,r+ko[q]) + 10
 	return min(re0,re1,re2,re3)

print(dfs(0,0,0,0))
a=int(input())
ans=0
for i in range(1,n+1):
  num=n//i
  ans+=(((num+1)*num)//2)*i
print(ans)

### FIXED CODE ###

a=int(input())
ans=0
for i in range(1,a+1):
  num=a//i
  ans+=(((num+1)*num)//2)*i
print(ans)
from collections import*
n,*A=map(int,open(0).read().split());C=Counter(A).items();f=1;l=len(C)
if l==3:f=(len(set(c[1]for c in C))>1)+n%3>0
elif l==2:f=(abs(C[1][1]-C[0][1])!=n//3)+n%3>0
else:f=(l!=1)+A[0]>0
print('YNeos'[f::2])

### FIXED CODE ###

from collections import*
n,*A=map(int,open(0).read().split());C=Counter(A).items();f=1;l=len(C)
if l==3:
  x=0
  for c in C:x^=c[0]
  f=(len(set(c[1]for c in C))>1)+n%3+x>0
elif l==2:f=(abs(sum(c[1]*(-1)**i for i,c in enumerate(C)))!=n//3)+n%3>0
else:f=(l!=1)+A[0]>0
print('YNeos'[f::2])
n,t=map(int,input().split())
T=list(map(int,input().split()))
count=0
if t>T[1]:
    count+=t-T[1]
pre=T[1]
for i in range(2,n):
    sa=T[i]-pre
    if t>sa:
        count+=t-sa
    pre=T[i]
print(n*t-count)

### FIXED CODE ###

n,t=map(int,input().split())
T=list(map(int,input().split()))
if n==1:
	print(t)
	exit()
count=0
if t>T[1]:
    count+=t-T[1]
pre=T[1]
for i in range(2,n):
    sa=T[i]-pre
    if t>sa:
        count+=t-sa
    pre=T[i]
print(n*t-count)
N, Q = map(int, input().split())
edges = [list(map(int, input().split())) for _ in range(N-1)]
operations = [list(map(int, input().split())) for _ in range(Q)]

edge_map = {}
for i in range(N):
    edge_map[i+1] = []

for edge in edges:
    a = edge[0]
    b = edge[1]
    edge_map[a].append(b)
    edge_map[b].append(a)

counters_map = [None for i in range(N)]

def dfs(idx, parent):
    global counters_map
    if counters_map[idx - 1]:
        return counters_map[idx - 1]
    counter = [idx]
    for child in edge_map[idx]:
        if parent and child == parent:
            continue
        counter.extend(dfs(child, idx))
    counters_map[idx-1] = counter
    return counter

dfs(1, None)

counters = [0 for i in range(N)]

for operation in operations:
    p = operation[0]
    x = operation[1]
    for idx in counters_map[p-1]:
        counters[idx-1] += x

print(counters)

### FIXED CODE ###

from collections import deque
N, Q = map(int, input().split())
edges = [list(map(int, input().split())) for _ in range(N-1)]
operations = [list(map(int, input().split())) for _ in range(Q)]

edge_map = [[] for i in range(N)]

for edge in edges:
    a = edge[0]
    b = edge[1]
    edge_map[a-1].append(b-1)
    edge_map[b-1].append(a-1)


counters = [0]*N

for operation in operations:
    p = operation[0]
    x = operation[1]
    counters[p-1] += x


res_list = [counters[i] for i in range(N)]
calculated = [False for i in range(N)]

target = [0]
while len(target) > 0:
    t = target.pop()
    calculated[t] = True
    for child in edge_map[t]:
        if calculated[child]:
            continue
        target.append(child)
        res_list[child] += res_list[t]

print(*res_list)
import math
import itertools

def combinations_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

def main():
    N,K = map(int,input().split(" "))
    for i in range(1,K+1):
        print(combinations_count(K-1,i-1)*combinations_count(N-K+1,i)%(10**9+7))

if __name__=='__main__':
    main()


### FIXED CODE ###

import math
import itertools

def combinations_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

def main():
    N,K = map(int,input().split(" "))
    for i in range(1,K+1):
        if(i<=N-K+1):
            print(combinations_count(K-1,i-1)*combinations_count(N-K+1,i)%(10**9+7))
        else:
            print(0)

if __name__=='__main__':
    main()
n=int(input())
m = int(sqrt(m))
for i in reversed(range(1, m)):
  if N%i==0:
    j = N//i
    print(i+j-2)

### FIXED CODE ###

import math
n = int(input())
m = int(math.sqrt(n))
for i in reversed(range(1, m+1)):
  if n % i == 0:
    j =  n // i
    print(i+j-2)
    break
import numpy as np
import math

def contrary_bit(bit):
    if (bit == 1):
        return 0
    elif (bit == 0):
        return 1
    else:
        print("error")

def dfs(adj_lists, nodes, node):
    # nodeから出発して，深さ優先探索
    neighbors = adj_lists[node]
    for neighbor in neighbors:
        if (nodes[neighbor[0]] != -1):
            #訪問済み
            continue
        else:
            if neighbor[1] %2 == 0:
                # 同じbit  
                nodes[neighbor[0]]= nodes[node]
                nodes = dfs(adj_lists, nodes, neighbor[0])
            else:
                nodes[neighbor[0]] = contrary_bit(nodes[node])
                nodes = dfs(adj_lists, nodes, neighbor[0])
    return nodes

def main():
    N = int(input())
    adj_lists = {}
    for i in range(1, N + 1):
        adj_lists[i] = []
    # adj_lists = {i: []} # u: [(v, w), []]
    nodes = [-1] * (N + 1)
    for _ in range(N - 1):
        u, v, w = map(int, input().split())
        adj_lists[u].append((v, w))
        adj_lists[v].append((u, w))
    nodes[1] = 1
    nodes = dfs(adj_lists, nodes, 1)
    ans = nodes[1:]
    for color in ans:
        print(color)

if __name__ == '__main__':
    main()

### FIXED CODE ###

import numpy as np
import math
import sys

sys.setrecursionlimit(1000000)

def contrary_bit(bit):
    if (bit == 1):
        return 0
    elif (bit == 0):
        return 1
    else:
        print("error")

def dfs(adj_lists, nodes, node):
    # nodeから出発して，深さ優先探索
    neighbors = adj_lists[node]
    for neighbor in neighbors:
        if (nodes[neighbor[0]] != -1):
            #訪問済み
            continue
        else:
            if neighbor[1] % 2 == 0:
                # 同じbit  
                nodes[neighbor[0]] = nodes[node]
                nodes = dfs(adj_lists, nodes, neighbor[0])
            else:
                nodes[neighbor[0]] = contrary_bit(nodes[node])
                nodes = dfs(adj_lists, nodes, neighbor[0])
    return nodes

def main():
    N = int(input())
    adj_lists = {}
    for i in range(1, N + 1):
        adj_lists[i] = []
    nodes = [-1] * (N + 1)
    for _ in range(N - 1):
        u, v, w = map(int, input().split())
        adj_lists[u].append((v, w))
        adj_lists[v].append((u, w))
    nodes[1] = 1
    nodes = dfs(adj_lists, nodes, 1)
    ans = nodes[1:]
    for color in ans:
        print(color)

if __name__ == '__main__':
    main()
n, m, k = list(map(int, input().split()))

c = m * ((m-1) ** (n-1))

s = c


for i in range(1, k+1):
    c = c * (n-i) // (i * (m-1))
    s += c

print(s % 998244353)


### FIXED CODE ###

import math

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

MOD=998244353

fact = [0] * (n+1)
inv = [0] * (n+1)
factinv = [0] * (n+1)

fact[0]=fact[1]=1
inv[1]=1
factinv[0]=factinv[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 )
    factinv[i] = factinv[i-1] * inv[i] % MOD

def cbn(n, k, fact, factinv, MOD):
    return fact[n] * factinv[n-k] * factinv[k] % MOD

def power(x, n, MOD):
    if n == 0:
        return 1
    elif n % 2 == 0:
        return power(x*x % MOD , n // 2, MOD) % MOD
    else:
        return x * power(x * x % MOD, n // 2, MOD) % MOD

s = 0
for i in range(k+1):
    s += cbn(n-1, i, fact, factinv, MOD) * m * power(m-1, n-1-i, MOD)

print(s % MOD)
return x**3

### FIXED CODE ###

x = raw_input()
x = int(x)
print x*x*x
import math

def Repsept():
    
    num = int(input())

    seven_yes = num % 7
    eleven_yes = num % 11
    mod_value = 1

    count = 1
    
    if num % 2 != 0:
    
        if seven_yes == 0 or eleven_yes == 0 or num < 10000:
        
            while mod_value != 0:
                value = 7*(pow(10, count)-1)/9
                
                mod_value = value % num
    
                if mod_value != 0:
                    count = count + 1
    
            print(count)
                
        else:
            
            print(num-1)

    else:
    
        print(-1)


def is_prime(n):
    if n == 1: 
        return False

    for k in range(2, int(math.sqrt(n)) + 1):
        if n % k == 0:
            return False

    return True


if __name__ == '__main__':
    Repsept()



### FIXED CODE ###

def Repsept():
    
    num = int(input())

    f=0
    n=num
    
    for i in range(10**6+1):
      if n==0:
        f=1
        print(i)
        break
      n=((n*10)+7)%num
    if f==0:
      print(-1)


if __name__ == '__main__':
    Repsept()
X=int(input("X="))
if 30<=X<=40:
    print("Yes")
elif:-40<=X<30
    print("No")


### FIXED CODE ###

X=int(input(""))
if 30<=X:
   print("Yes")
else:
   print("No")
S = input()

results = []

cnt = 0
results = []

for i in range(len(S)):
    if S[i] in ['A', 'C', 'G', 'T']:
        cnt += 1
    else :
        results.append(cnt)
        cnt = 0
        
print(max(results))

### FIXED CODE ###

S = input()

cnt = 0
results = []

for i in range(len(S)):
    if S[i] in ['A', 'C', 'G', 'T']:
        cnt += 1
    else :
        results.append(cnt)
        cnt = 0
    results.append(cnt)
    
print(max(results))
import sys

array = []

for line in sys.stdin:
    try:
        array = [int(x) for x in line.split()]
        array.sort()
        if array[2]**2 == (array[0]**2+array[1]**2):
            print('YES')
        else:
            print('NO')
    except(ValueError):
        continue

### FIXED CODE ###

import sys

for line in sys.stdin:
    try:
        a,b,c = [int(x) for x in line.split()]
        if (a**2+b**2) == c**2:
            print('YES')
        elif (a**2+c**2) == b**2:
            print('YES')
        elif (b**2+c**2) == a**2:
            print('YES')
        else:
            print('NO')
    except(ValueError):
        continue
num_input = int(input())
input_arr = [int(x) for x in input().split()]

max_input = max(input_arr)
count = 0
second_arr =[]
first_arr = []
sorted_arr = sorted(input_arr)
ans = sorted_arr[int(num_input/2)] - sorted_arr[int(num_input/2)-1]
print(ans)

### FIXED CODE ###

def consunt():
    if input_.count(input_str_arr[0]) and input_.count(input_str_arr[1]):
      print("Yes")
    else:
      print("No")

input_ = input()

input_str = set(input_)

input_str_arr = [s for s in input_str]

if len(set(input_str_arr))==2:
    consunt()
else:
    print("No")