Harryxun/stf_run huggingface dataset:
import numpy as np
from numpy.fft import rfft, irfft
from bisect import bisect_left
import sys
Max = 10**6
N, M = map(int, input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = np.zeros(Max+1)
D = np.zeros(Max+1)
for a in A:
    C[a] +=1
for b in B:
    D[b]+=1
L = 2**8
res = irfft(rfft(C, L)*rfft(D, L))
res = np.where(res>1.4)
if res[0].size == 0:
    print(ahfkgashg)
    sys.exit()
res = res[0][-1]
B.sort()
ans  = []
for i, a in enumerate(A):
    j = bisect_left(B, res-a)
    b = B[j]
    if b == res-a:
        ans.append(i)
        ans.append(j)
    if len(ans) == 4:
        break
if len(ans) < 4:
    print(liahbcon)
print(*ans)    
    


### FIXED CODE ###

import numpy as np
N = int(input())
A = np.array(list(map(int, input().split())), dtype = np.int64)
a = np.bitwise_xor.reduce(A)
for i in range(60):
    bit = 1<<i
    if bit & a:
        A^=(A&bit)
for k in range(60, -1, -1):
    bit = 1<<k
    one = (A&bit != 0)
    i = np.where(one & (A < (1<<(k+1))))[0]
    if len(i) == 0:
        continue
    i = i[0]
    x = A[i]
    A[one]^=x
    A[i] = x
b = np.bitwise_xor.reduce(A)
a^=b
print(a+b)
N = input()

while len(N) > 1:
    M = sum(int(N[i]) for i in range(len(N)))
    N = str(M)

if M == 9 or M == 0:
    print('Yes')
else:
    print('No')


### FIXED CODE ###

import math
N, X, T = map(int, input().split())

print(T * math.ceil(N / X))
x = int(input())

while True:
    c = 0
    for i in range(2, x+1):
        if x % i == 0:
            c += 1
    if cnt == 1:
        print(x)
        exit()
    else:
        x += 1


### FIXED CODE ###

x = int(input())

while True:
    c = 0
    for i in range(2, x+1):
        if x % i == 0:
            c += 1
    if c == 1:
        print(x)
        exit()
    else:
        x += 1
while 1:
    a, b = map(int, raw_input().split())
    if not a and not b:
        break
    if a < b:
        print "%d %d" % (a, b)
    else:
        print "%d &d" % (b, a)

### FIXED CODE ###

while True:
	a,b = map(int,raw_input().split())
	if a == b == 0:
		break
	if a < b:
		print '%d %d' % (a,b)
	else:
		print '%d %d' % (b,a)
n = int(input())
s = input()            # テキストをリストに変換
pattern = list('ABC')          # パターンをリストに変換
cnt = 0

for i in range(n):
    match = True                # 一致しているものとして探索開始
    for j in range(len(pattern)):
        if s[i + j] != pattern[j]:
            match = False       # 一致しなかった
    if match:                   # すべての文字が一致していればカウント
        cnt += 1

print(cnt)

### FIXED CODE ###

n = int(input())
s = input()      
pattern = list('ABC')          
cnt = 0

for i in range(n-len(pattern)+1):
    if s[i] == pattern[0]:
        if s[i+1] == pattern[1]:
            if s[i+2] == pattern[2]:
                cnt += 1

print(cnt)
N, M = map(int,input().split())
2 A = list(map(int,input().split()))
3 S = sum(A)
4 cnt = 0
5 for a in A:
6 if a >= S / (4*M):
7 cnt += 1
8 if cnt >= M:
9 print("Yes")
10 else:
11 print("No")

### FIXED CODE ###

N, M = map(int,input().split())
A = list(map(int,input().split()))
S = sum(A)
cnt = 0
for a in A:
  if a >= S / (4*M):
    cnt += 1
if cnt >= M:
  print("Yes")
else:
	print("No")
H = int(input())

cnt = H
B = [H]
for i in range(1000):
    cnt = cnt//2
    B.append(cnt)
    if cnt == 1:
        break

C =[1]
for i in range(1,100):
    C.append(C[i-1]*2)

ans= 0
for i in range(len(B)):
    ans +=C[i]
print(ans)

### FIXED CODE ###

H = int(input())
cnt = H
ans = 0
B = [H]

if H == 1:
    ans == 'NA'
else:
    for i in range(100000000000):
        cnt = cnt//2
        B.append(cnt)
        if cnt == 1:
            break

C =[1]
for i in range(1,1001):
    C.append(C[i-1]*2)

if ans == 'NA':
    print('0')
else:
    for i in range(len(B)):
        ans +=C[i]
print(ans)
a, b = input().split()
return a == b

### FIXED CODE ###

a, b = input().split()
print(['Yes', 'No'][a!=b])
n,r = map(int,input().split())
if n >= 10:
  print(r)
else:
  ans = r+ (100*(10-k))
  print(ans)

### FIXED CODE ###

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

if n >= 10:
    print(r)
else:
    print(r + ((10 - n) * 100))
n = int(input())

print("Yes" if n[0] == 9 or n[1] == 9 else "No")

### FIXED CODE ###

n = input()

print("Yes" if n[0] == "9" or n[1] == "9" else "No")
import math


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

if 2*x<a*a*b:
    sit=math.acos(2*x/(a*b*b))
    print(math.degrees(sit))
elif 2*x>a*a*b:
    p1=2*(a*a*b-x)
    p2=a*a*a
    sit=math.atan(p1/p2)
    print(math.degrees(sit))
else:
    print(45.00000)


### FIXED CODE ###

import math


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

if 2*x<a*a*b:
    sit=math.atan((a*b*b)/(2*x))
    print(math.degrees(sit))
elif 2*x>a*a*b:
    p1=2*(a*a*b-x)
    p2=a*a*a
    sit=math.atan(p1/p2)
    print(math.degrees(sit))
else:
    print(45.00000)
while True:
    data = int(input())
    if data == 0:
        break

    sum == 0
    while 

### FIXED CODE ###

while True:
    data = input()
    if data == '0':
        break
 
    print(sum([int(i) for i in data]))
n=input()
int(n)
all=0
a=[]
a=input().split()
mx=0
for i in range(0,n):
	x=int(a[i])
	if x>mx: mx=x
	all=all+x
if all>2*mx : print("Yes")
else : print("No")

### FIXED CODE ###

n = raw_input()
L = map(int, raw_input().strip().split())
s = sum(L)
mx = max(L)
if mx < s - mx:
  print "Yes"
else:
  print "No"
a,b=int(input())
if b%a == 0:
  print(a+b)
else:
  print(b-a)

### FIXED CODE ###

a,b=map(int,input().split())
if b%a == 0:
  print(a+b)
else:
  print(b-a)
s = input().split()
if(s = 'ABC'):
  print("ARC")
else:
  print("ABC")

### FIXED CODE ###

s= input()
if(s == "ABC"):
  print("ARC")
else:
  print("ABC")
a = sorted(input())
b = reversed(input())
c = ''.join(a) 
d = ''.join(b)
if c < d:
	print("Yes")
elif c >= d:
	print("No")

### FIXED CODE ###

a,b=map(int,input().split())
print(int((a+b+1)/2))
import sys
sys.setrecursionlimit(10**9)
input=sys.stdin.readline

def dfs(u,par):
  ans_list[u]+=ans_list[par]  
  for v in tree_list[u]:
    if v!=par:
      dfs(v,u)      
  return

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

tree_list=[[] for _ in range(N+1)]
for i in range(N-1):
  a,b=map(int,input().split())
  tree_list[a].append(b)
  tree_list[b].append(a)
#print(tree_list)

ans_list=[0]*(N+1)
for i in range(Q):
  p,x=map(int,input().split())
  ans_list[p]+=x

dfs(1,0,0)

print(*ans_list[1:])

### FIXED CODE ###

import sys
sys.setrecursionlimit(10**9)
input=sys.stdin.readline

def dfs(u,par):
  ans_list[u]+=ans_list[par]  
  for v in tree_list[u]:
    if v!=par:
      dfs(v,u)      
  return

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

tree_list=[[] for _ in range(N+1)]
for i in range(N-1):
  a,b=map(int,input().split())
  tree_list[a].append(b)
  tree_list[b].append(a)
#print(tree_list)

ans_list=[0]*(N+1)
for i in range(Q):
  p,x=map(int,input().split())
  ans_list[p]+=x

dfs(1,0)

print(*ans_list[1:])
X = int(input())
a = [i for i in range(1, 10**5)]

from collections import deque
s = deque([])
s.append(0)
i = 0
while s[i] < 10 ** 9:
    s.append(s[i] + a[i])
    i += 1

print(bisect.bisect_left(s, X))

### FIXED CODE ###

X = int(input())
a = [i for i in range(1, 10**5)]
import bisect
from collections import deque
s = deque([])
s.append(0)
i = 0
while s[i] < 10 ** 9:
    s.append(s[i] + a[i])
    i += 1

print(bisect.bisect_left(s, X))
N = (int(input()))

print(int((1 / 2) * N * (N - 1)))

### FIXED CODE ###

S = input()
T = input()

count = 0

for i in range(3):
    if S[i] == T[i]:
        count += 1

print(count)
N = int(input())
K = int(input())
result = 0
for i in range(1,N+1):
    prob = 1
    count = i 
    while count < K:
        prob *= 0.5
        count *= 2
    result += prob /N
print(result)

### FIXED CODE ###

N,K = map(int,input().split())
result = 0
for i in range(1,N+1):
    prob = 1
    count = i 
    while count < K:
        prob *= 0.5
        count *= 2
    result += prob /N
print(result)
import sys

read = sys.stdin.read
readline = sys.stdin.buffer.readline
sys.setrecursionlimit(10 ** 8)
INF = float('inf')
MOD = 10 ** 9 + 7


def main():
    A, B, C == map(int, readline().split())
    if A == B:
        print(C)
    elif B == C:
        print(A)
    else:
        print(bin())


if __name__ == '__main__':
    main()


### FIXED CODE ###

import sys

read = sys.stdin.read
readline = sys.stdin.buffer.readline
sys.setrecursionlimit(10 ** 8)
INF = float('inf')
MOD = 10 ** 9 + 7


def main():
    A, B, C = map(int, input().split())
    if A == B:
        print(C)
    elif B == C:
        print(A)
    else:
        print(B)


if __name__ == '__main__':
    main()
def small(a, b):
    if a > b:
        return b
    else:
        return a


def main():
    n, k = map(int, input().split())
    h = tuple(map(int, input().split()))
    INF = 10 ** 9
    dp = [INF] * n
    dp[0] = 0
    for i in range(n):
        for j in range(1, k + 1):
            i_j = i + j
            if si_j < n:
                dp[i_j] = small(dp[i_j], dp[i] + abs(h[i] - h[i_j]))
    print(dp[-1])


if __name__ == "__main__":
    main()

### FIXED CODE ###

def main():
    n, k = map(int, input().split())
    h = tuple(map(int, input().split()))
    INF = 10 ** 9
    dp = [INF] * n
    dp[0] = 0
    for i in range(n):
        for j in range(1, k + 1):
            i_j = i + j
            if i_j < n:
                x = dp[i] + abs(h[i] - h[i_j])
                if dp[i_j] > x:
                    dp[i_j] = x
    print(dp[-1])


if __name__ == "__main__":
    main()
s=input()
if s ==　"Sunny":
    print("Cloudy")
if s ==　"Cloudy":
    print("Rainy")
else:
    print("Sunny")

### FIXED CODE ###

s=input()
if s=="Sunny":
  print("Cloudy")
if s=="Cloudy":
  print("Rainy")
if s=="Rainy":
  print("Sunny")
X,Y=map(int,input().split())
mod=10**9+7
if (X+Y)%3!=0:
  print(0)
else:
  N=int((2*Y-X)/3)
  M=int((2*X-Y)/3)
  List=[0 for i in range(N+M)]
  List[0]=1
  for i in range(N+M-1):
    List[i+1]=List[i]*(i+2)%mod
  print(List[N+M-1]*pow(List[N-1],mod-2,mod)*pow(List[M-1],mod-2,mod)%mod)

### FIXED CODE ###

X,Y=map(int,input().split())
mod=10**9+7
if (X+Y)%3!=0:
  print(0)
else:
  N=int((2*Y-X)/3)
  M=int((2*X-Y)/3)
  if N<0 or M<0:
    print(0)
  if N==0 or M==0:
    print(1)
  if N>0 and M>0:
    List=[0 for i in range(N+M)]
    List[0]=1
    for i in range(N+M-1):
      List[i+1]=List[i]*(i+2)%mod
    print(List[N+M-1]*pow(List[N-1],mod-2,mod)*pow(List[M-1],mod-2,mod)%mod)
n, m = map(int, input().split())
edge = [tuple(map(int, input().split())) for _ in range(m)]

inf = 10 ** 18
dis = [inf] * n
dis[0] = 0

for z in range(n+1):
    update = False
    for a, b, c in edge:
        a -= 1
        a -= 1
        if dis[a] != inf and dis[b] > dis[a] - c:
            dis[b] = dis[a] - c
            update = True
    if not update:
        break

if z == n:
    print('inf')
else:
    print(-dis[n-1])

### FIXED CODE ###

n, m = map(int, input().split())
edge = [tuple(map(int, input().split())) for _ in range(m)]

inf = 10 ** 18
dis = [inf] * n
dis[0] = 0

for z in range(2*n+1):
    update = False
    for a, b, c in edge:
        a -= 1
        b -= 1
        if dis[a] != inf and dis[b] > dis[a] - c:
            dis[b] = dis[a] - c
            update = True
            if b == n - 1 and z >= n - 1:
                print('inf')
                exit()
print(-dis[n-1])
import math
 
# D - Maximum Average Sets
# 問題URL:http://abc057.contest.atcoder.jp/tasks/abc057_d
 
# N:商品の数　A個以上B個以下の範囲で選ぶ
N, A, B = map(int, input().split())
# C：最大価値組み合わせ総数
C = 0
 
# 商品価値をリストに入れる
V = [int(value) for value in input().split()]
# 商品価値が高い順に並び替え
V.sort(reverse=True)
 
# 商品価値が高いものから出来るだけ少なく（＝A個）選ぶのが最も平均価値が高くなる
S = V[0:A]
ave = sum(S) / A
print(ave)
 
Vs = V.count(min(S))
Ss = S.count(min(S))
if min(S) != max(S):
    C = math.factorial(Vs) // (math.factorial(Vs -Ss) * math.factorial(Ss))
    print(C)
else:
    i = A
    C = 0
    while i <= B and V[-i] == min(S):
        c = math.factorial(Vs) // (math.factorial(Vs -i) * math.factorial(i))
        C = C + c
        i = i + 1
    print(C)

### FIXED CODE ###

# 元ソースコード：http://abc057.contest.atcoder.jp/submissions/1183710
# 初心者の実験用です

import math
N,A,B = map(int,input().split())
V = list(map(int,input().split()))
V.sort()
S = V[-A:]
avgmax = sum(S) / A
print(avgmax)
 
Vs = V.count(min(S))
Ss = S.count(min(S))
if min(S) != max(S):
	C = math.factorial(Vs) // (math.factorial(Vs -Ss) * math.factorial(Ss))
	print(C)
else:
	i = A
	C = 0
	while i <= B and V[-i] == min(S):
		c = math.factorial(Vs) // (math.factorial(Vs -i) * math.factorial(i))
		C = C + c
		i = i + 1
	print(C)
num=1
while True;
    x= int(input())
    if x==0; break
    print ("Case{0}:{1}". fromat(num,x))
    
    num +=1


### FIXED CODE ###

num = 1
while True:
    x = int(input())
    if x == 0: break
    print ("Case {0}: {1}".format(num,x))
    num += 1
# encoding: utf-8
import math
N, M = map(int, input().split())

def distribute(pos, full, tmp):
    return memo[tmp][pos]

# define search range
p_max = int(M / 2) # M is prime if M has a factor p (> p_max)
ip_up = int(math.log2(p_max))

#### O(MlogM) below (if M has a very large prime factor)
M_tmp = M
ips = []
for p in range(2, p_max + 1):
    if M_tmp % p > 0: continue
    # how many times M_tmp can be divided
    p_tmp = p
    for i_p in range(ip_up + 1):
        if M_tmp % p_tmp > 0: break
        p_tmp = p_tmp * p
    # calculate later
    ips.append(i_p)
    # next
    M_tmp = M_tmp // (p_tmp // p)
    if M_tmp == 1: break
#### O(Mlog M) above

#### O(N) below
# create memo
## init
if len(ips) > 0: ip_max = max(ips)
else: ip_max = 0
memo = [[None] * N for i in range(ip_max + 1)] # max ip
for j in range(N): memo[0][j] = 1
for i in range(1, ip_max + 1): memo[i][N - 1] = 1
## fill
for i in range(1, ip_max + 1):
    sum_tmp = 0
    vals = list(memo[i - 1])[::-1]
    p_memo = memo[i]
    for j, val in enumerate(vals):
        sum_tmp += val
        p_memo[N - 1 - j] = sum_tmp
#### O(N) above
        
# calculate ans
ans = 1
for i_p in ips: ans = (ans * distribute(0, i_p, i_p)) % (10 ** 9 + 7)

if ip_max == 0: print(N)
else: print(ans)

### FIXED CODE ###

# encoding: utf-8
import math
N, M = map(int, input().split())

ips = []
M_tmp = M
for p in range(2, int(math.sqrt(M)) + 1):
    if M_tmp % p > 0: continue
    for i_p in range(1, 33):
        if M_tmp % (p ** (i_p + 1)) > 0: break
    ips.append(i_p)
    M_tmp = M_tmp // (p ** i_p)
    if M_tmp == 1: break
else:
    ips.append(1)

#### O(NlogM) below ?
# create memo
## init
if len(ips) > 0: ip_max = max(ips)
else: ip_max = 0
memo = [[None] * N for i in range(ip_max + 1)] # max ip
for j in range(N): memo[0][j] = 1
for i in range(1, ip_max + 1): memo[i][N - 1] = 1
## fill
for i in range(1, ip_max + 1):
    sum_tmp = 0
    vals = list(memo[i - 1])[::-1]
    ptr_memo = memo[i]
    for j, val in enumerate(vals):
        sum_tmp += val
        ptr_memo[N - 1 - j] = sum_tmp
#### O(NlogM) above ?
        
# calculate ans
ans = 1
for i_p in ips:
    ans = (ans * memo[i_p][0]) % (10 ** 9 + 7)

if M == 1: print(1)
elif ip_max < 1: print(N)
else: print(ans)
,w=input().split()
a=[list(input()) for i in range(int(h))]

l1=[i for i in a if '#' in i]
l2=[i for i in zip(*l1) if '#' in i]
for i in zip(*l2):
    print(''.join(i))

### FIXED CODE ###

h,w=map(int,input().split())
a=[list(input()) for i in range(h)]
for i in range(h):
    if '#' not in a[i]:
        a[i]=['n']*w
for i in range(w):
    l=[a[j][i] for j in range(len(a))]
    if '#' not in l:
        for k in range(len(a)):
           a[k][i]='n'
for i in a:
    l=[x for x in i if x!='n']
    if l:
        print(''.join(l))
A1 = int(input())

A2 = int(input())

A3 = int(input())


s = A1 + A2 + A3

if s >= 22:

    print('bust')

else:

    print('win')


### FIXED CODE ###

a1, a2, a3 = [int(x) for x in input().split()]

s = a1 + a2 + a3

if s >= 22:

    print('bust')

else:

    print('win')
S = input().split("/")
N = S[0] + S[1] + S[2]
if int(N) <= 20190430: print("Heisei")
else: print("TBD")

### FIXED CODE ###

T, X = map(int, input().split())
print(T / X)
Ot = 0
N = int(input())
for i in range (N):
    X = input().split()
    x = int(X[0])
    if X[1] == "BTC":
        Ot += x * 380000
    else:
        Ot += x
print(Ot)

### FIXED CODE ###

Ot = 0
N = int(input())
for i in range (N):
    X = input().split()
    x = float(X[0])
    if X[1] == "BTC":
        Ot += x * 380000
    else:
        Ot += x
print(Ot)
list = []
	print(T,S)
	setup.strip','

list

### FIXED CODE ###

A, B = input().split()
C = B + A
print(C)
N,K = map(int, input().split())
T = list(map(int, input().split()))
T.sort()
if K>=N:
    print(0)
else:
    for i in range(K):
        T.pop()
    
    print(sum(T)) 

### FIXED CODE ###

def c(i):
    return i

H,A = map(int, input().split())
a,b = map(c,divmod(H,A))
if b==0:
    print(a)
else:
    print(a+1)
def how_many_times_divisible(n):
	ans = 0
	while n % 2 == 0:
		n /= 2
		ans += 1
	return ans

n = int(raw_input())
a = map(int, raw_input().split())
ans = min(map(how_many_times_divisible, a))

print ans


### FIXED CODE ###

def how_many_times_divisible(n):
	ans = 0
	while n % 2 == 0:
		n /= 2
		ans += 1
	return ans

n = int(input())
a = map(int, input().split())
ans = min(map(how_many_times_divisible, a))

print(ans)
n, k = map(int, input().split())
a = list(map(int, input().split()))
mod = 10**9 + 7
ans = 1

if k == n:
    for i in range(n):
        ans *= a[i]
        ans %= mod
    print(ans)
    exit()
if max(a) < 0 and k%2 == 1:
    a.sort(reverse=True)
    for i in range(k):
        ans *= a[i]
        ans %= mod
    print(ans)
    exit()

plus, minus = [], []
for i in range(n):
    if a[i] >= 0: plus.append(a[i])
    else: minus.append(a[i])

plus.sort()
minus.sort(reverse=True)
while k > 0:
    if len(plus) >= 2: nump = plus[-1] * plus[-2]
    elif len(plus) == 1: nump = plus[-1]
    else: nump = -10**10
    if len(minus) >= 2: numm = minus[-1] * minus[-2]
    elif len(minus) == 1: numm = minus[-1]
    else: numm == -10**10
    if nump > numm or k == 1:
        ans *= plus.pop()
        ans %= mod
        k -= 1
    else:
        ans *= minus.pop()
        ans *= minus.pop()
        ans %= mod
        k -= 2
print(ans)

### FIXED CODE ###

n, k = map(int, input().split())
a = list(map(int, input().split()))
mod = 10**9 + 7
ans = 1

if k == n:
    for i in range(n):
        ans *= a[i]
        ans %= mod
    print(ans)
    exit()
if max(a) < 0 and k%2 == 1:
    a.sort(reverse=True)
    for i in range(k):
        ans *= a[i]
        ans %= mod
    print(ans)
    exit()

a.sort(key=lambda x: abs(x))
cnt = 0
for i in range(1, k+1):
    ans *= a[-i]
    ans %= mod
    if a[-i] < 0:
        cnt += 1

if cnt%2 == 0:
    print(ans)
else:
    a_plus = None
    a_minus = None
    b_plus = None
    b_minus = None
    for i in range(k, 0, -1):
        if a[-i] >= 0 and a_plus == None:
            a_plus = a[-i]
        if a[-i] < 0 and a_minus == None:
            a_minus = a[-i]
    for i in range(k+1, n+1):
        if a[-i] >= 0 and b_plus == None:
            b_plus = a[-i]
        if a[-i] < 0 and b_minus == None:
            b_minus = a[-i]
    if a_plus == None or b_minus == None:
        ans *= pow(a_minus, mod-2, mod)
        ans %= mod
        ans *= b_plus
        ans %= mod
    elif a_minus == None or b_plus == None:
        ans *= pow(a_plus, mod-2, mod)
        ans %= mod
        ans *= b_minus
        ans %= mod
    else:
        if abs(a_plus*b_plus) > abs(a_minus*b_minus):
            ans *= pow(a_minus, mod-2, mod)
            ans %= mod
            ans *= b_plus
            ans %= mod
        else:
            ans *= pow(a_plus, mod-2, mod)
            ans %= mod
            ans *= b_minus
            ans %= mod
    print(ans)
N, Q = map(int, input().split())
ab = [list(map(int, input().split())) for i in range(N - 1)]
px = [list(map(int, input().split())) for i in range(Q)]

ab.sort()

p = [[] for i in range(N + 1)]
result = [0 for i in range(N + 1)]

for i in range(N - 1):
    a = ab[i][0]
    b = ab[i][1]
    p[a].append(b)


def dfs(point, score, result):
    result[point] = result[point] + score
    for i in range(len(p[point])):
        next = p[point][i]
        dfs(next, score, result)
    return result


for i in range(Q):
    result = dfs(px[i][0], px[i][1], result)

print(*result[1:])

### FIXED CODE ###

N, Q = map(int,input().split()) # 複数の数字を変数に格納
List_ab = [list(map(int,input().split())) for i in range(N-1)] # [[1,2],[3,4],[5,6]]
List_px = [list(map(int,input().split())) for i in range(Q)] # [[1,2],[3,4],[5,6]]

count_list = [0]*N

List_ab.sort()

for i in range(Q):
    count_list[List_px[i][0]-1] += List_px[i][1]
        
for i in range(N-1):
    count_list[List_ab[i][1]-1] += count_list[List_ab[i][0]-1]
    
print(*count_list)
s, w = map(int, input().split())

if s < w
    print('unsafe')
else:
    print('safe')

### FIXED CODE ###

s, w = map(int, input().split())

if s <= w:
  print("unsafe")
else:
  print("safe")
print('Christmas' + *' Eve'(25-int(input())))

### FIXED CODE ###

print('Christmas' + ' Eve' * (25 - int(input())))
if __name__ == '__main__':
    n = int(input())
    s1 = [int(i) for i in input().split()]
    s2 = [int(i) for i in input().split()]
    l = []
    for i in range(n):
        l.append(i+1)
    g = []

    for v in itertools.permutations(l, n):
        h = ""
        for i in v:
            h=h+str(i)
        g.append(h)
    g.sort()

    index1 = ""
    index2 = ""
    for i in s1:
        index1 = index1 +str(i)
    for i in s2:
        index2 = index2 +str(i)

    print(abs(g.index(index1) - g.index(index2)))



### FIXED CODE ###

import itertools

if __name__ == '__main__':
    n = int(input())
    s1 = [int(i) for i in input().split()]
    s2 = [int(i) for i in input().split()]
    l = []
    for i in range(n):
        l.append(i+1)
    g = []

    for v in itertools.permutations(l, n):
        h = ""
        for i in v:
            h=h+str(i)
        g.append(h)
    g.sort()

    index1 = ""
    index2 = ""
    for i in s1:
        index1 = index1 +str(i)
    for i in s2:
        index2 = index2 +str(i)

    print(abs(g.index(index1) - g.index(index2)))
N, K = list(map(int, input().split()))

Alist = [int(i) for i in input().split(' ')]
import math

#print(Alist)
my_list = [9,8,7,4,7,1,3]

Alist=sorted(Alist, reverse=True)
#print(sorted(Alist, reverse=True))


for i in range(K):
   Alist[0]=Alist[0]/2
   if N>1: 
      if Alist[0]<Alist[1]:
         temp=Alist[0]
         Alist[0]=Alist[1]
         Alist[1]=temp
         continue          
      if Alist[0]<Alist[i]:
         temp=Alist[0]
         Alist[0]=Alist[i]
         Alist[i]=temp
         continue
      if i>2:
         if Alist[0]<Alist[i-1]:
            temp=Alist[0]
            Alist[0]=Alist[i-1]
            Alist[i-1]=temp
            continue
   Alist=sorted(Alist, reverse=True)
sum=0
#print(Alist)
for i in Alist:
   sum+=math.floor(i) 
print(int(sum))

### FIXED CODE ###

from heapq import heappush, heappop
import math
 
N,M = [int(i) for i in input().split(' ')]
inputList = [int(i) for i in input().split(' ')]
list = []
 
for i in inputList:
    heappush(list, -i)
 
for _ in range(M):
    heappush(list, math.ceil(heappop(list)/2))
    
print(-sum(list))
N = int(input())
xy = [map(int, input().split()) for _ in range(5)]
x, y = [list(i) for i in zip(*xy)]
flag = 0

for i in range(N-3):
  if x[i] == y[i]:
    if x[i+1] == y[i+1]:
      if x[i+2] == y[i+2]:
        flag = 1

if flag == 1:
  print('Yes')
else:
  print('No')

### FIXED CODE ###

N = int(input())
xy = [map(int, input().split()) for _ in range(N)]
x, y = [list(i) for i in zip(*xy)]
flag = 0
count = 0

for i in range(N):
  if x[i] == y[i]:
    count += 1
    if count >= 3:
      flag = 1
  else:
    count = 0

if flag == 1:
  print('Yes')
else:
  print('No')
N = int(input())
A = [int(a) for a in input().split()]
cnt = 0
for i in range(N):
  for j in range(i+1, N):
    d = A[i] + A[j] - (j-i)
    if d == 0:
      cnt += 1
print(cnt)

### FIXED CODE ###

s = input()
if s == "ABC":
  print("ARC")
else:
  print("ABC")