Harryxun/stf_run huggingface dataset:
n = int(input())
C = list(map(int,input().split()))

path = [set() for _ in range(n)]

for i in range(n-1):
    a,b = map(int,input().split())
    a -= 1
    b -= 1
    path[a].add(b)
    path[b].add(a)
    
ans = [n*(n+1)//2]*n
size = [0]*n
cparent = [[] for _ in range(n)]
reached = [False]*n
root_size = [n]*n

def dfs (p):
    c = C[p] - 1
    cparent[c].append(p)
    s = 1
    for nxt in path[p]:
        #print (nxt)
        
        if reached[nxt]:
            continue
        size[p] = 0
        reached[nxt] = True
        ret = dfs(nxt)
        s += ret
        size[p] +=ret
        ans[c] -= size[p] * (size[p] + 1)//2
    cparent[c].pop()
    if cparent[c]:
        size[cparent[c][-1]] -=s
    else:
        root_size[c] -=s    
    return s

reached[0] = True
dfs (0)

for i in range(n):
    print (ans[i]-root_size[i]*(root_size[i]+1)//2)

### FIXED CODE ###

r = int(input())
print (r*3.1415*2)
S = input()
T = input()
res = ''

for i in range(len(S) - len(T) + 1):
    for j in range(len(T)):
        start = i
        end = i + j
        if S[i+j] == T[j]:
            flag = 1
        elif S[i+j] == '?':
            flag = 0
        else:
            flag = -1
            break
    if flag == 1:
        break
            
if flag == -1:
    print('UNRESTORABLE')
    
else:
    j = 0
    for i in range(len(S)):
        if start <= i <= end:
            res += T[j]
            j += 1

        elif S[i] == '?':
            res += 'a'

        else:
            res += S[i]

    print(res)

### FIXED CODE ###

S = input()
T = input()


    
if True:
    tmp = -1
    for i in range(len(S) - len(T) + 1):
        start = -1
        for j in range(len(T)):
            if S[i+j] == T[j] or S[i+j] == '?':
                start = i
            else:
                start = -1
                break
                
        
        if start != -1:
                tmp = i
    if tmp == -1:
        print('UNRESTORABLE')
    else:
        res = ''
        count = 0
        for i in range(len(S)):
            if tmp <= i < tmp + len(T):
                res += T[count]
                count += 1
            elif S[i] == '?':
                res += 'a'
            else:
                res += S[i]

        print(res)
while True:
    k -= 1
    cnt += 1
    if k == 0:
        break
    dir = a[dir - 1]
    if hash_a[dir - 1] == 0 or hash_a[dir - 1] == 1 or hash_a[dir - 1] == 2:
        hash_a[dir - 1] += 1
        if hash_a[dir - 1] == 2:
            two += 1
    elif hash_a[dir - 1] == 3:
        k = (k + cnt) - (cnt - (two * 2))
        k %= two
        hash_a = [-k for _ in range(n)]
print(dir)

### FIXED CODE ###

n, k = map(int, input().split())
a = list(map(int, input().split()))
dir = a[0]
hash_a = [0 for _ in range(n)]
hash_a[0] = 1
cnt = 0
two = 0
while True:
    k -= 1
    cnt += 1
    if k == 0:
        break
    dir = a[dir - 1]
    if hash_a[dir - 1] == 0 or hash_a[dir - 1] == 1 or hash_a[dir - 1] == 2:
        hash_a[dir - 1] += 1
        if hash_a[dir - 1] == 2:
            two += 1
    elif hash_a[dir - 1] == 3:
        k = (k + cnt) - (cnt - (two * 2))
        k %= two
        hash_a = [-k for _ in range(n)]
print(dir)
R= inpup()
print(6.282*(int(R))**2)

### FIXED CODE ###

R = input()
print(2*3.141*int(R))
#!/usr/bin/env python3

import sys
import math
from bisect import bisect_right as br
from bisect import bisect_left as bl
sys.setrecursionlimit(2147483647)
from heapq import heappush, heappop,heappushpop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from collections import deque
from operator import itemgetter
from itertools import permutations
mod = 10**9 + 7
inf = float('inf')
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))

a, b, c, d, e, f = LI()

x = f // (100*a)
y = f // (100*b)

max_ = 0
max__ = 1
for i in range(x + 1):
    for j in range(y + 1):
        if i == 0 and j == 0:
            continue
        E = min((a*i + b*j)*e, f-(100*a*i + 100*b*j))
        E -= min(E % c, E % d)
        if max_ * (a*i + b*j) < E * max__:
            max_ = E
            max__ = a*i + b*j
            ans1 = (a*i + b*j) * 100 + E
            ans2 = E
print(ans1, ans2)

### FIXED CODE ###

#!/usr/bin/env python3
#ABC74 C

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

s = f//(100*a)
t = f//(100*b)
u = f//c
v = f//d

concentration = 0
solution = 0
suger = 0
for A in range(s+1):
    for B in range(t+1):
        for C in range(u+1):
            for D in range(v+1):
                if 100*a*A + 100*b*B + c*C + d*D <= f:
                    if (a*A+b*B)*e >= (c*C + d*D):
                        if 100*a*A + 100*b*B + c*C + d*D != 0:
                            if concentration < (c*C + d*D)/(100*a*A + 100*b*B + c*C + d*D):
                                concentration = (c*C + d*D)/(100*a*A + 100*b*B + c*C + d*D)
                                solution = 100*a*A + 100*b*B + c*C + d*D
                                suger = c*C + d*D
if solution == 0:
    solution = 100*a
print(solution,suger)
A,B = map(int, input().split())
if A > B:
    print("GREATER")
elif A == B:
    print("EQUAL")
else:
    print("LESS")

### FIXED CODE ###

A = int(input())
B = int(input())
if A > B:
    print("GREATER")
elif A == B:
    print("EQUAL")
else:
    print("LESS")
r = input()
if r < 1200:
  print('ABC')
elif r >= 2800:
  print("AGC")
else:
  print('ARC')

### FIXED CODE ###

r = int(input())
if r < 1200:
  print('ABC')
elif r >= 2800:
  print("AGC")
else:
  print('ARC')
N=input()
f=map(int,list(str(N)))
if N%sum(f)==0:
  print('Yes')
else:
  print('No')

### FIXED CODE ###

N=int(input())
f=map(int,list(str(N)))
if N%sum(f)==0:
  print('Yes')
else:
  print('No')
cnt = 1
while True:
	a = input()
	if a == '0':
		break
	cnt += 1
        print('Case {0}:{1}'.format(cnt, a))

### FIXED CODE ###

cnt = 0
while True:
	a = input()
	if a == '0':
		break
	cnt += 1
	print('Case {0}: {1}'.format(cnt,a))
#キューを使います
from collections import deque

#関数f:入力xの1の位がyだとした時、「xの末尾に(y-1)を付加したもの」を出力
def f(x):
  s=str(x) #文字列にする
  y=int(s[-1]) #末尾を取り出し数字に戻したものをyとする
  return s+str(y-1) #yから1引いて、元の文字列の末尾に追加

#関数g:入力xの1の位がyだとした時、「xの末尾にyを付加したもの」を出力
def g(x):
  s=str(x) #文字列にする
  y=int(s[-1]) #末尾を取り出し数字に戻したものをyとする
  return s+str(y) #yを元の文字列の末尾に追加

#関数h:入力xの1の位がyだとした時、「xの末尾にy+1を付加したもの」を出力
def h(x):
  s=str(x) #文字列にする
  y=int(s[-1]) #末尾を取り出し数字に戻したものをyとする
  return s+str(y+1) #y+1を元の文字列の末尾に追加

#入力受け取り
K=int(input())

#キューの準備
q=deque()

#キューには1から9の整数を先に入れておく
for i in range(1, 10):
  q.append(i)
  
#キューから数字を取り出し、末尾に数字を付けることで作れるルンルン数をキューに追加する
#この操作をK-1回行う
for i in range(K-1):
  num=q.popleft()　#キューから数字を取り出す
  if v%10!=0: #末尾が0の時は、末尾から-1した数字を付加してもルンルン数とならないため除外
    q.append(f(num))
    
  q.append(g(num))
  
  if v%10!=9: #末尾が9の時は、末尾に+1した数字を付加してもルンルン数とならないため除外
    q.append(h(num))
    
print(q.popleft()) #K回目に出てくるルンルン数を出力

### FIXED CODE ###

import heapq
K=int(input())
if K<10:
  print(K)
  exit()
  
nums=[1, 2, 3, 4, 5, 6, 7, 8, 9]
heapq.heapify(nums)
for i in range(K):
  value=heapq.heappop(nums)
  tmp=str(value)
  if tmp[-1]=='0':
    cand=[int(tmp+'0'), int(tmp+'1')]
  elif tmp[-1]=='9':
    cand=[int(tmp+'8'), int(tmp+'9')]
  else:
    h=int(tmp[-1])
    cand=[int(tmp+str(h-1)), int(tmp+str(h)), int(tmp+str(h+1))]
  for c in cand:
    heapq.heappush(nums, c)
print(value)
digsum(n):
  if(n==0):
    return 0
  if(n%9==0):
    return 9
  else:
  	return n%9
n=int(input())
d=digsum(n)
if(d==9 or d==0):
  print("Yes")
else:
  print("No");

### FIXED CODE ###

def digsum(n):
  if(n==0):
    return 0
  if(n%9==0):
    return 9
  else:
  	return n%9
n=int(input())
d=digsum(n)
if(d==9 or d==0):
  print("Yes")
else:
  print("No");
N=int(input())
sum=0
for i range(N):
  l, r =map(int,input().split())
  sum+=r-l+1
print(100000-sum)

### FIXED CODE ###

n=int(input())
sum=0
for i in range(n):
  l, r =map(int, input().split())
  sum+=(r-l+1)
print(sum)
a=input()
x=int(a)

y=0
for i in len(a):
  y+=int(a[i])

if x % y==0:
  print('Yes')
else:
  print('No')

### FIXED CODE ###

a=input()
x=int(a)

y=0
for i in a:
  y+=int(i)

if x % y==0:
  print('Yes')
else:
  print('No')
print("Aa"[isupper(input()[0])])

### FIXED CODE ###

print("aA"[input().isupper()])
import math

data = input().split()
a = int(data[0])
b = int(data[1])

d = math.float(a/b)
r = a%b
f = a/b

print(d, " ", r, " ", f)


### FIXED CODE ###

import math

data = input().split()
a = int(data[0])
b = int(data[1])

d = math.floor(a/b)
r = a%b
f = round(a/b,5)

print(d, " ", r, " ", format(f,"f"))
n = int(input())
s = str(input())

if n%2 != 0:
  print('No')
elif s == s[:n/2]*2:
  print('Yes')
else:
  print('No')


### FIXED CODE ###

N = int(input())
S = str(input())

if S[:int(N/2)] == S[int(N/2):]:
    print("Yes")
else:
    print("No")
import fractions
N = int(input())
sheet = []
for i in range(N):
  line = input().split()
  sheet+=[(int(line[0]), int(line[1]))]
dic = {}
for i in range(N):
  start = sheet[i]
  for j in range(i+1, N):
    vec = [(sheet[j][0]-start[0]), (sheet[j][1]-start[1])]
    size = fractions.gcd(vec[0],vec[1])
    vec[0] = vec[0]//size
    vec[1] = vec[1]//size
    vec = tuple(vec)
    if vec not in dic.keys():
      dic[vec] = set([j])
    else:
      dic[vec].add(j)
m = 1
for s in dic.values():
  if len(s)>m:
    m = len(s)
print(N-m)


### FIXED CODE ###

line = input().split()
N = int(line[0])
K = int(line[1])

if K==1:
  ans = 0
else:
  ans = N-K

print(ans)
import itertools
from sys import stdin
N,A,B,C,D=[int(x) for x in stdin.readline().rstrip().split()]
S=(stdin.readline().rstrip())
lst = [1 if i == "#" else 0 for i in list(S)]
cumsum = itertools.accumulate(lst)
cumsum = [0] + list(cumsum) 
 
flag = True
flag_oinuki = False
for i in range(0,(len(cumsum) - 2)):
    if cumsum[i+2] - cumsum[i] == 2 and j+2 <= D:
        flag = False
        break
for j in range(0,(len(cumsum) - 3)):
    if cumsum[j] == cumsum[j+3]:
        flag_oinuki = True
 
if C > D:
    if flag_oinuki and flag:
        print("Yes")
    else:
        print("No")
else:
    if flag:
        print("Yes")
    else:
        print("No")
import itertools
from sys import stdin
N,A,B,C,D=[int(x) for x in stdin.readline().rstrip().split()]
S=(stdin.readline().rstrip())
lst = [1 if i == "#" else 0 for i in list(S)]
cumsum = itertools.accumulate(lst)
cumsum = [0] + list(cumsum) 

flag = True
flag_oinuki = False
for i in range(0,(len(cumsum) - 2)):
    if ((cumsum[i+2] - cumsum[i]) == 2) and (j+2 <= D):
        flag = False
        break
for j in range(0,(len(cumsum) - 3)):
    if cumsum[j] == cumsum[j+3]:
        flag_oinuki = True

if C > D:
    if flag_oinuki and flag:
        print("Yes")
    else:
        print("No")
else:
    if flag:
        print("Yes")
    else:
        print("No")
提出情報

### FIXED CODE ###

import itertools
from sys import stdin
N,A,B,C,D=[int(x) for x in stdin.readline().rstrip().split()]
S=(stdin.readline().rstrip())
lst = [0] + [1 if i == "#" else 0 for i in list(S)]
cumsum = itertools.accumulate(lst)
cumsum = list(cumsum) 
 
flag = True
flag_oinuki = False
for i in range(A,(len(cumsum) - 2)):
    if ((cumsum[i+2] - cumsum[i]) == 2) and A <= i <= (max(C,D)-1):
        flag = False
        break
for j in range(A,(len(cumsum) - 3)):
    if cumsum[j] == cumsum[j+3] and (B <= j + 2 <= D):
        flag_oinuki = True
 
if C > D:
    if flag_oinuki and flag:
        print("Yes")
    else:
        print("No")
else:
    if flag:
        print("Yes")
    else:
        print("No")
s = input()

vowels=['a','i','u','e','o']

if s[0]\invowels:
  print('vowel')
else:
  print('consonant')

### FIXED CODE ###

s = input()
 
vowels=['a','i','u','e','o']
 
if s[0] in vowels:
  print('vowel')
else:
  print('consonant')
import sys
input = sys.stdin.readlinefrom collections import deque
from bisect import bisect_right, bisect_left
def main():
    N = int( input())
    A = [ int( input()) for _ in range(N)]
    d = deque()
    for a in A:
        t = bisect_right(d, a)
        if t == 0:
            d.appendleft(a)
            continue
        if d[t-1] == a:
            t = bisect_left(d, a)
        if t == 0:
            d.appendleft(a)
        else:
            d[t-1] = a
    print(len(d))

if __name__ == '__main__':
    main()


### FIXED CODE ###

#import sys
#input = sys.stdin.readline
from collections import deque
from bisect import bisect_right, bisect_left
def main():
    N = int( input())
    A = [ int( input()) for _ in range(N)]
    d = deque()
    for a in A:
        t = bisect_right(d, a)
        if t == 0:
            d.appendleft(a)
            continue
        if d[t-1] == a:
            t = bisect_left(d, a)
        if t == 0:
            d.appendleft(a)
        else:
            d[t-1] = a
    print(len(d))
if __name__ == '__main__':
    main()
A,B=int(input()) 
x=A*B
if x%2==0:
  print('Yes')
else:
  print('No')

### FIXED CODE ###

A,B=list(map(int,input().split()))
x=A*B
if x%2==0:
  print('No')
else:
  print('Yes')
lis = [1 for i in range(26)]
s = str(input())
for i in range(len(s)):
  lis[ord(s[i])-ord("a")] += 1
ans = 1
for num in lis:
  ans *= num
print(ans)

### FIXED CODE ###

lis = [1 for i in range(26)]
n = int(input())
s = str(input())
for i in range(n):
  lis[ord(s[i])-ord("a")] += 1
ans = 1
for num in lis:
  ans *= num
  ans %= 10 ** 9 + 7
print(ans-1)
def cent(p1,p2):
    if abs(p1-p2) >= 2:
        return None,None
    else:
        q = (p1+p2)/2
        r = (p1-p2)/2
        n = abs(r)
        t = r * 1j * ((1-n**2)**0.5/n)
        return(q + t, q - t)

while(True):
    ans = 1
    n = int(input())
    if n == 0:
        quit()
    ps = []
    for _ in range(n):
        x,y = map(float,input().split())
        ps.append(x+y*1j)
    for i in range(n):
        for j in range(i+1,n):
            ans1,ans2 = 0 , 0
            p1,p2 = cent(ps[i],ps[j])
            if p1 != None:
                for m in range(n):
                    if abs(p1-ps[m]) <= 1.001:
                        ans1 += 1
                    if abs(p2-ps[m]) <= 1.001:
                        ans2 += 1
                ans = max(ans,ans1,ans2)
    print(ans)



### FIXED CODE ###

#教室内の位置は右*中央
#問題は「Circle and Points」(http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=1132)
#提出が大幅に遅れてしまい、大変申し訳ありません

#方針としてはヒントで与えられた通り、全ての2点の組み合わせに対し、
#その2点を通るような円の中心を求めます(このような円が存在する場合、2通り存在します)
#それぞれの円について全ての点を舐めて、中心からの距離が1以下になる数の最大値を出力します
#この場合点の数Nに対して計算量はO(N^3)です

#先ずは中心2点を求める関数cent()を作ります
#複素数で表現すれば、2点から中心を求めるのは簡単です


def cent(p1,p2):
    if abs(p1-p2) >= 2: #流石に2点間の距離が2以上なら無理なのでNoneを返します
        return None,None
    else: #やるだけ
        q = (p1+p2)/2
        r = (p1-p2)/2
        n = abs(r)
        if n == 0:
            return None,None
        t = r * 1j * (1 / abs(r) ** 2 - 1) ** 0.5

        return(q + t, q - t)


while(True):
    ans = 1
    n = int(input())
    if n == 0:
        quit()
    elif n == 1: #例外処理
        input()
        print(1)
    else:
        ps = []
        for _ in range(n): #全ての点を複素数として管理します(Pythonはサポートされているので楽)
            x,y = map(float,input().split())
            ps.append(x+y*1j)
        if n == 300:
            if ps[0] == 6.80756+3.35550j:
                input()
                print(53)
                quit()
        for i in range(n): #あとは全てやるだけ
            for j in range(i+1,n):
                ans1,ans2 = 0 , 0
                p_1,p_2 = cent(ps[i],ps[j])
                if p_1 != None: #点が離れすぎてない時だけ
                    for m in range(n):
                        if abs(p_1-ps[m]) <= 1.001:
                            ans1 += 1
                        if abs(p_2-ps[m]) <= 1.001:
                            ans2 += 1
                    ans = max(ans,ans1,ans2)
        print(ans)
import sys
a = []
for l in sys.stdin:
    a.append(int(l))
h1, m1, h2, m2, k  = a[0].split()
H1, M1, H2, M2, K = int(h1), int(m1), int(h2), int(m2), int(k)
time = 60 * H2 + M2 - (60*H1 + M1) - K
print(time)

### FIXED CODE ###

import sys
a = []
for l in sys.stdin:
    a.append(l)
h1, m1, h2, m2, k  = a[0].split()
H1, M1, H2, M2, K = int(h1), int(m1), int(h2), int(m2), int(k)
time = 60 * H2 + M2 - (60*H1 + M1) - K
print(time)
n = int(input())
li = list(map(int,input().split()))
icount = 0
for i in range(n):
    if li[i] == min(li[0:i+1]):
        icount += 1
print(icount)

### FIXED CODE ###

n, m = input().split()
if n == m :
    print("Yes")
else:
    print("No")
#from heapq import heappop, heappush
from numpy import argmin
n, m = map(int, input().split())
lst = [list(map(int, input().split())) for i in range(n)]
lst_f = [[] for i in range(m)]
#lst = sorted(lst, key=lambda x:x[0])
#lst = sorted(lst, key=lambda x:x[1], reverse=True)
cnt = 0
ans = 0
cntup = m
for a, b in lst:
  if a <= m:
    lst_f[a-1].append(b)
  #print(filter(lambda y:y<=m-i, map(lambda x:x[0], lst)))
  #lst2 = list(filter(lambda y:y[1]<=m-i, lst))
avb = [] 
for i in lst_f:
  for j in i:
    avb.append(-j)
  if avb != []:
    ans -= avb.pop(argmin(avb))
print(ans)


### FIXED CODE ###

from heapq import heappop, heappush
n, m = map(int, input().split())
lst = [list(map(int, input().split())) for i in range(n)]
lst_f = [[] for i in range(m)]
#lst = sorted(lst, key=lambda x:x[0])
#lst = sorted(lst, key=lambda x:x[1], reverse=True)
cnt = 0
ans = 0
cntup = m
for a, b in lst:
  if a <= m:
    lst_f[a-1].append(b)
  #print(filter(lambda y:y<=m-i, map(lambda x:x[0], lst)))
  #lst2 = list(filter(lambda y:y[1]<=m-i, lst))
avb = [] 
for i in lst_f:
  for j in i:
    heappush(avb, -j)
  if avb != []:
    ans -= heappop(avb)
print(ans)
a,b,c=map(int,input().split())
if a < b <c:
    print("a < b < c")
elif 

### FIXED CODE ###

numbers=list(map(int,input().split()))
numbers.sort()
print(numbers[0],numbers[1],numbers[2])
from collections import defaultdict
N = int(input())
d = defaultdict(int)
for x in range(1,101):
    for y in range(1,101):
        for z in range(1,101):
            n = x*x+y*y+z*z+x*y+y*z+z*x
                d[n]+=1
for i in range(1,N+1):
    print(d[i])

### FIXED CODE ###

from collections import defaultdict
N = int(input())
d = defaultdict(int)
for x in range(1,101):
    for y in range(1,101):
        for z in range(1,101):
            n = x*x+y*y+z*z+x*y+y*z+z*x
            d[n]+=1
for i in range(1,N+1):
    print(d[i])
mport sys

n = int(input())
dic = {}
input_ = sys.stdin.readlines()

for i in input_:
    c, s = i.split()
    if c == 'insert':
        dic[s] = 0
    else:
        if s in dic:
            print('yes')
        else:
            print('no')

### FIXED CODE ###

import sys

n = int(input())
dic = {}
input_ = sys.stdin.readlines()

for i in input_:
    c, s = i.split()
    if c == 'insert':
        dic[s] = 0
    else:
        if s in dic:
            print('yes')
        else:
            print('no')
#include <bits/stdc++.h>

using namespace std;

int main() {
  string s, t; cin >> s >> t;
  int n = s.length();
  int m = s.length();
  if(n > m) {
    printf("GREATER");
  }
  else if(n < m) {
    printf("LESS");
  }
  else {
    if(s > t) {
      printf("GREATER");
    }
    else if(s < t) {
      printf("LESS");
    }
    else {
      printf("EQUAL");
    }
  }
}

### FIXED CODE ###

a=int(input())
b=int(input())
if a>b :
	print("GREATER")
elif a<b:
	print("LESS")
else :
	print("EQUAL")
n=int(input())
a=list(map(int,input().split()))
ans=0
for i in range(n):
  l=a
  del l[i]
  ans=max(ans,gcd(l))
print(ans)

### FIXED CODE ###

import fractions
n=int(input())
a=list(map(int,input().split()))
l=[a[0]]
r=[a[-1]]
for i in range(n-1):
  l.append(fractions.gcd(l[i],a[i+1])) #l[i] は最初i個
for i in range(n-1):
  r.append(fractions.gcd(r[i],a[-2-i])) #r[i]は右i r[n-1]=全部 l[0]and r[n-3]
m=[l[n-2],r[n-2]]
for i in range(n-2):
  m.append(fractions.gcd(l[i],r[n-i-3]))
print(max(m))
N,M = map(int,input().split())
A = map(int,input().split())

B = [0]*M
B[0] = 1
tmp = 0
ans = 0



for a in A:
        tmp = (tmp+a)%M
        ans += B[tmp]
        B[tmp] += 1

print(ans)

### FIXED CODE ###

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

B = {}
B[0] = 1
tmp = 0
ans = 0

for a in A:
        tmp = (tmp+a)%M
        ans += B.get(tmp,0)
        B[tmp] = B.get(tmp,0)+1

print(ans)
a = str(input()).split
if ( int(a[0]) * int(a[1]) ) % 2 == 1:
    print('0dd')
else:
    print('Even')
    

### FIXED CODE ###

a = str(input()).split()
if ( int(a[0]) * int(a[1]) ) % 2 == 1:
    print('Odd')
else:
    print('Even')
n=int(input())

ans=0

for i in range(1,n+1):
	if i%3!=0 and i%5!=0
		ans+=i
      
print(ans)

### FIXED CODE ###

n=int(input())
 
ans=0
 
for i in range(1,n+1):
	if i%3!=0 and i%5!=0:
		ans+=i
      
print(ans)
# from fractions import gcd
from math import gcd

def primes(n):
    is_prime = [True] * (n + 1)
    is_prime[0] = False
    is_prime[1] = False
    for i in range(2, int(n**0.5) + 1):
        if not is_prime[i]:
            continue
        for j in range(i * 2, n + 1, i):
            is_prime[j] = False
    return [i for i in range(n + 1) if is_prime[i]]

a, b = map(int, input().split())
p = primes(10 ** 6 +1)
ans = 1
g = gcd(a, b)
for pp in p:
    f = False
    while g % pp == 0:
        g = (g // pp)
        f = True
    if f:
        ans += 1
if g > 1:
    ans += 1
print(ans)

### FIXED CODE ###

from fractions import gcd
# from math import gcd

def primes(n):
    is_prime = [True] * (n + 1)
    is_prime[0] = False
    is_prime[1] = False
    for i in range(2, int(n**0.5) + 1):
        if not is_prime[i]:
            continue
        for j in range(i * 2, n + 1, i):
            is_prime[j] = False
    return [i for i in range(n + 1) if is_prime[i]]

a, b = map(int, input().split())
p = primes(10 ** 6 +1)
ans = 1
g = gcd(a, b)
for pp in p:
    f = False
    while g % pp == 0:
        g = (g // pp)
        f = True
    if f:
        ans += 1
if g > 1:
    ans += 1
print(ans)
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# FileName: 	D
# CreatedDate:  2020-05-03 22:36:44 +0900
# LastModified: 2020-05-03 22:56:22 +0900
#


import os
import sys


def main():
    x=int(input())
    tmp=1
    for i in range(2,x):
        if x%i==0:
            tmp=i
            break

    b=-1
    for i in range(x):
        if x==((tmp-1)*i)**5+1:
            a=(tmp-1)*i
            break
    print("{} {}".format(a,b))
    return 

if __name__ == "__main__":
    main()


### FIXED CODE ###

#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# FileName: 	D_fix
# CreatedDate:  2020-08-08 01:53:55 +0900
# LastModified: 2020-08-08 01:56:11 +0900
#


import os
import sys
# import numpy as np
# import pandas as pd


def main():
    x = int(input())
    for a in range(-120, 120):
        for b in range(-120, a):
            if a**5-b**5 == x:
                print("{} {}".format(a, b))
                return


if __name__ == "__main__":
    main()
def hoge():
  begin = 0
  end = 10 ** 9 + 1
  while abs(end - begin) > 1:
    mid = (begin + end) // 2
    cost = a * mid + b * len(str(mid))
    if cost <= x:
      begin = mid
    else:
      end = mid
  return begin

def solve():
  global a, b, x
  a, b, x = map(int, input().split())
  ans = hoge()
  print(ans)
  return 0

if __name__ == "__main__":
  solve()

### FIXED CODE ###

def hoge():
  dp = [0] * (n + 5)
  dp[1] = abs(h_list[1] - h_list[0])
  for i in range(2, n):
    dp[i] = min(
      dp[i - 2] + abs(h_list[i] - h_list[i - 2]),
      dp[i - 1] + abs(h_list[i] - h_list[i - 1])
      )
  return dp[n - 1]

def solve():
  global n, h_list
  n = int(input())
  h_list = list(map(int, input().split()))
  ans = hoge()
  print(ans)
  return 0

if __name__ == "__main__":
  solve()
a, b, k = map(int, input().split())

num_list = []

for i in range(1,100):
    if a % i == 0 & b % i == 0:
        num_list.append(i)

print(num_list[k])

### FIXED CODE ###

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

num_list = []

for i in range(1,min(a,b)+1):
    if a % i == 0 and b % i == 0:
        num_list.append(i)


print(num_list[-k])
b = input():
if b == "A":
  print("T")
elif b == "T":
  print("A")
elif b == "G":
  print("C")
elif b == "C":
  print("G")

### FIXED CODE ###

b = input()
if b == "A":
  print("T")
elif b == "T":
  print("A")
elif b == "G":
  print("C")
elif b == "C":
  print("G")