Harryxun/stf_run huggingface dataset:
import collections
N, K, L = map(int, input().split())
road = [{"Connected":[],"set":0,"seen":False} for _ in range(N)]
rail = [{"Connected":[],"set":0,"seen":False} for _ in range(N)]

def dfs(node, num): #深さ優先探索
    node["seen"] = True
    node["set"] = num
    for next_node in node["Connected"]:
        if next_node["seen"]:
            continue
        dfs(next_node, num)

for X in ((road, K), (rail, L)): #結合を入力
    for i in range(X[1]):
        p, q = map(int, input().split())
        X[0][p-1]["Connected"].append(X[0][q-1])
        X[0][q-1]["Connected"].append(X[0][p-1])

for X in [road, rail]: #探索して連結成分に分解
    set_index = 0
    for x in X:
        if x["seen"]:
            continue
        dfs(x, set_index)
        set_index += 1

List = [(road[i]["set"],rail[i]["set"]) for i in range(N)]
counter = collections.Counter(List)
for A in List:
    print(counter[A],end=" ")
        


### FIXED CODE ###

N, K, L = map(int, input().split())

def fp(x, parentList): #findParent
    if parentList[x] == x:
        return x
    else:
        parentList[x] = fp(parentList[x], parentList)
        return parentList[x]

#各ノードのparentをリストで表現(連結前は自身がparent)
road = [i for i in range(N)]
rail = [i for i in range(N)]

for _ in range(K):
    p, q = map(int, input().split())
    par_p, par_q = fp(p-1, road), fp(q-1, road) #p, qのparent 
    #連結する際、若い番号をparentとする
    if par_p < par_q:
        road[par_q] = par_p
    else:
        road[par_p] = par_q

#railについても同様
for _ in range(L):
    s, t = map(int, input().split())
    par_s, par_t = fp(s-1, rail), fp(t-1, rail)
    if par_s < par_t:
        rail[par_t] = par_s
    else:
        rail[par_s] = par_t

#連結成分の要素をカウント
cnt = {}
for i in range(N):
    key = (fp(i,road),fp(i,rail))
    if key in cnt:
        cnt[key] += 1
    else:
        cnt[key] = 1
#出力
for i in range(N):
    key = (fp(i,road),fp(i,rail))
    ans = cnt[key]
    print(ans, end=" ")
A=int(input())
B=int(input())
if A<=9 and B<=9:
    print(A*B)
else:
    print("-1")

### FIXED CODE ###

A,B=map(int,input() .split())
if A<=9 and B<=9:
    print(A*B)
else:
    print('-1')
import math
N=int(import())
 
if N==1 or N==2:
  ans=0
elif N%2==0:
  ans=N/2-1
else:
  ans=N/2
  ans = math.floor(ans)
print(ans)

### FIXED CODE ###

N=int(input())
if N==1 or N==2:
  ans=0
elif N%2==0:
  ans=(N/2)-1
else:
  ans=N//2  
print(int(ans))
P = int(input())
res= []
for i in range(P):
  a, b = input().split(' ')
  res.append((a,b,i+1))
res2 = sorted(res, key = lambda x:x[1], reverse = True)
res3 = sorted(res2, key = lambda x:x[0])
for j in range(P):
  print(res3[2])

### FIXED CODE ###

P = int(input())
res= []
for i in range(P):
  a, b = input().split()
  res.append((a,int(b)))
res2 = sorted(res, key = lambda x:x[1], reverse = True)
res3 = sorted(res2, key = lambda x:x[0])
for j in range(P):
  print(str(res.index(res3[j])+1))
n,m=map(int,input().split())
a=list(map(int,input().split()))
b=sum(a)
c=sorted(a)
if c[n-m+1] >b//(4*m):
  print("Yes")
else:
  prinnt("No")

### FIXED CODE ###

n,m=map(int,input().split())
a=list(map(int,input().split()))
b=sum(a)
a.sort(reverse=True)
if a[m-1]*4*m >=b:
  print("Yes")
else:
  print("No")
n, d = map(int,input().split())

for i in range(1,n):
    n -= (2*d+1)
    if n<= 0:
        break

print(i)

### FIXED CODE ###

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

d = d*2+1

for i in range(1,n+1):
    n -= d
    if n < 1:
        break

print(i)
import sys
import math
import itertools
import bisect
from copy import copy
from collections import deque,Counter
from decimal import Decimal
def s(): return input()
def i(): return int(input())
def S(): return input().split()
def I(): return map(int,input().split())
def L(): return list(input().split())
def l(): return list(map(int,input().split()))
def lcm(a,b): return a*b//math.gcd(a,b)
fact = math.factorial
sys.setrecursionlimit(10**9)
INF = 10**9
mod = 10**9+7

N = i()
X = s()[::-1]
num1 = 1
num2 = 1
num3 = 0
num4 = 0
cnt = 0
for i in range(N):
    if X[i] == '1':
        cnt += 1
cnt1 = cnt+1#0用
cnt2 = cnt-1#1用
nums = []
ans = []
for i in range(N):
    if X[i] == '0':
        nums.append(num1)
    else:
        num3 += num1
        num4 += num2
        nums.append(num2)
    num1 = (num1*2)%cnt1
    num2 = (num2*2)%cnt2
num3 %= cnt1
num4 %= cnt2
for i in range(N):
    if X[i] == '0':
        ans.append((num3+nums[i])%cnt1)
    else:
        ans.append((num4-nums[i])%cnt2)
ans.reverse()
tans = [1]*N
def f(n):
    if n == 0:
        return
    tans[i] += 1
    c = n%(list(bin(n)[2:]).count('1'))
    f(c)
for i in range(N):
    f(ans[i])
for i in range(N):
    print(tans[i])

### FIXED CODE ###

import sys
import math
import itertools
import bisect
from copy import copy
from collections import deque,Counter
from decimal import Decimal
def s(): return input()
def i(): return int(input())
def S(): return input().split()
def I(): return map(int,input().split())
def L(): return list(input().split())
def l(): return list(map(int,input().split()))
def lcm(a,b): return a*b//math.gcd(a,b)
fact = math.factorial
sys.setrecursionlimit(10**9)
INF = 10**9
mod = 10**9+7

N = i()
X = s()[::-1]
num1 = 1
num2 = 1
num3 = 0
num4 = 0
cnt = 0
for i in range(N):
    if X[i] == '1':
        cnt += 1
cnt1 = cnt+1#0用
cnt2 = cnt-1#1用
nums = []
ans = []
tans = [1]*N
for i in range(N):
    if X[i] == '0':
        nums.append(num1)
    else:
        num3 += num1
        num4 += num2
        nums.append(num2)
    if cnt1 != 0:
        num1 = (num1*2)%cnt1
    if cnt2 != 0:
        num2 = (num2*2)%cnt2
if cnt1 != 0:
    num3 %= cnt1
if cnt2 != 0:
    num4 %= cnt2
for i in range(N):
    if X[i] == '0':
        if cnt1 != 0: 
            ans.append((num3+nums[i])%cnt1)
        else:
            ans.append(0)
            tans[i] = 0
    else:
        if cnt2 != 0:    
            ans.append((num4-nums[i])%cnt2)
        else:
            ans.append(0)
            tans[i] = 0
ans.reverse()
tans.reverse()
def f(n):
    if n == 0:
        return
    tans[i] += 1
    c = n%(list(bin(n)[2:]).count('1'))
    f(c)
for i in range(N):
    f(ans[i])
for i in range(N):
    print(tans[i])
S = int(input())
h = int(S / 3600)
m = int(S /60)
s = h-m
print(h:m:s)

### FIXED CODE ###

S = int(input())
h = int(S // 3600)
m = int((S - h*3600)// 60 )
s = int(S - (h*3600+m*60))

print(h,m,s, sep=':' )
def getN():
    return int(input())
def getNM():
    return map(int, input().split())
def getList():
    return list(map(int, input().split()))
def getArray(intn):
    return [int(input()) for i in range(intn)]
def input():
    return sys.stdin.readline().rstrip()

from collections import defaultdict, deque, Counter
from sys import exit
import heapq
import math
import copy
from operator import mul
from functools import reduce
from bisect import bisect_left, bisect_right

import sys
sys.setrecursionlimit(1000000000)
mod = 10 ** 9 + 7

A, B = getNM()
# bit1桁目のフラグの個数
# 周期は2 ** 1
# 0と1が交互に
# bit2桁目のフラグの個数
# 周期は2 ** 2
flags1 = [0] * 40
flags2 = [0] * 40
# 1 ~ nまでに各桁のフラグが何本立つか計算する関数
def bitflag(n, flaglist):
    if n > 0:
        for i in range(1, 40):
            split = 2 ** i
            flag1 = (n // split) * (split // 2)
            flag2 = max(n % split + 1 - (split // 2), 0)
            flaglist[i] += flag1 + flag2
# 1 ~ A - 1について（Aは範囲に入っているため）
bitflag(A - 1, flags1)
bitflag(B, flags2)

for i in range()
for i in range(40):
    flags2[i] -= flags1[i]
ans = 0
# 奇数ならフラグが立つ
for i in range(40):
    if flags2[i] % 2 != 0:
        ans += 2 ** (i - 1)
print(ans)

### FIXED CODE ###

def getN():
    return int(input())
def getNM():
    return map(int, input().split())
def getList():
    return list(map(int, input().split()))
def getArray(intn):
    return [int(input()) for i in range(intn)]
def input():
    return sys.stdin.readline().rstrip()

from collections import defaultdict, deque, Counter
from sys import exit
import heapq
import math
import copy
from operator import mul
from functools import reduce
from bisect import bisect_left, bisect_right

import sys
sys.setrecursionlimit(1000000000)
mod = 10 ** 9 + 7

A, B = getNM()
# bit1桁目のフラグの個数
# 周期は2 ** 1
# 0と1が交互に
# bit2桁目のフラグの個数
# 周期は2 ** 2
flags1 = [0] * 61
flags2 = [0] * 61
# 1 ~ nまでに各桁のフラグが何本立つか計算する関数
def bitflag(n, flaglist):
    if n > 0:
        for i in range(1, 61):
            split = 2 ** i
            flag1 = (n // split) * (split // 2)
            flag2 = max(n % split + 1 - (split // 2), 0)
            flaglist[i] += flag1 + flag2
# 1 ~ A - 1について（Aは範囲に入っているため）
bitflag(A - 1, flags1)
bitflag(B, flags2)
for i in range(61):
    flags2[i] -= flags1[i]
ans = 0
# 奇数ならフラグが立つ
for i in range(61):
    if flags2[i] % 2 != 0:
        ans += 2 ** (i - 1)
print(ans)
N = int(input())
lis_X = list(map(int, input().split()))

lis_X_sorted = sorted(lis_X)

def calc_dif_sq(a,b):
    return (a-b)**2

if N == 1:
    ans = 0
else :
    res = []
    for p in range(lis_X_sorted[0],lis_X_sorted[-1]):
        tmp = sum(list(map(lambda x:calc_dif_sq(x, p), lis_X_sorted)))
        res.append(tmp)
    ans = min(res)
print(ans)

### FIXED CODE ###

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

lis_X_sorted = sorted(lis_X)

def calc_dif_sq(a,b):
    return (a-b)**2

if N == 1:
    ans = 0
elif min(lis_X_sorted)==max(lis_X_sorted):
    ans = 0
else :
    res = []
    for p in range(lis_X_sorted[0],lis_X_sorted[-1]):
        tmp = sum(list(map(lambda x:calc_dif_sq(x, p), lis_X_sorted)))
        res.append(tmp)
    ans = min(res)
print(ans)
box = [input(),input(),input()]
X,Y,Z = box
print(Y,Z,X)

### FIXED CODE ###

X,Y,Z = list(map(int,input().split()))
print(Z,X,Y)
h=int(input())
n=len(list(bin(h)))-2
print(2**n-1)

### FIXED CODE ###

h,a=map(int,input().split())
if h%a==0:
    print(h//a)
else:
    print((h//a)+1)
l = map(int, input().split())
a = l[0] * l[1]
if a % 2 == 0:
    print("No")
else:
    print("Yes")

### FIXED CODE ###

import sys
l = list(map(int, input().split()))
if (l[0] * l[1]) % 2 == 0:
    print("No")
else:
    print("Yes")
# -*- coding: <encoding name> -*-

x = int(input())
print(1000 * (x // 500) + 5 * (x % 500 // 5)

### FIXED CODE ###

# -*- coding: <encoding name> -*-

x = int(input())
print(1000 * (x // 500) + 5 * (x % 500 // 5))
import fractions
import copy
from functools import reduce
import sys
def gcd_list(numbers):
    return reduce(fractions.gcd,numbers)
  
n = int(sys.stdin.readline())
a = list(map(int,sys.stdin.readline().split()))
a2 = copy.deepcopy(a)
res = []
for i in range(0,n):
    a2.pop(i)
    res.append(gcd_list(a2))
    a2 = copy.deepcopy(a)
print(max(res))

### FIXED CODE ###

a,b,t=map(int,input().split());print(int(t/a)*b)
#min
minsum=0
for i in range(n):
    if n-(i+1)>=k-1:
        minsum+=(a[i] * comb(n-i-1,k-1))%M
        minsum%=M
b=sorted(a,reverse=True)
#max
maxsum=0
for i in range(n):
    if n-(i+1)>=k-1:
        maxsum+=(b[i] * comb(n-i-1,k-1))%M
        maxsum%=M
print((maxsum-minsum)%M)

### FIXED CODE ###

n,k=map(int,input().split())
a=sorted(list(map(int,input().split())))
num=[1]
M=10**9+7
for i in range(n):
    x=(num[i]*(i+1))%M
    num.append(x)
def inverse(number,mod):
    m=mod-2
    mod2=""
    while m!=0:
        if m%2==0:
            mod2="0"+mod2
        else:
            mod2="1"+mod2
        m=m//2
    two=[]
    for i in range(len(mod2)):
        if mod2[len(mod2)-1-i]=="1":
            two.append(i)
    ret=1
    for i in two:
        v=i
        retsub=number
        while v>0:
            retsub=retsub**2
            retsub=retsub%mod
            v-=1
        ret*=retsub
    ret=ret%mod
    return ret
def comb(p,q):
    ret1=num[p]
    ret2=inverse(num[p-q],M)
    ret3=inverse(num[q],M)
    ret=(ret1*ret2*ret3)%M
    return ret
#min
minsum=0
for i in range(n):
    if n-(i+1)>=k-1:
        minsum+=(a[i] * comb(n-i-1,k-1))%M
        minsum%=M
b=sorted(a,reverse=True)
#max
maxsum=0
for i in range(n):
    if n-(i+1)>=k-1:
        maxsum+=(b[i] * comb(n-i-1,k-1))%M
        maxsum%=M
print((maxsum-minsum)%M)
N, M = list(map(int,input().split()))
A = []
B = []
for i in range(M):
    A1,B1=[int(i) for i in input().split()]
    A.append(A1)
    B.append(B1)
A.reverse()
B.reverse()

class UnionFind(object):
    def __init__(self, n=1):
        self.par = [i for i in range(n+1)]
        self.rank = [0 for _ in range(n+1)]
        self.size = [1 for _ in range(n+1)]
    
    def find(self, x):
        """
        x が属するグループを探索
        """
        if self.par[x] == x:
            return x
        else:
            self.par[x] = self.find(self.par[x])
            return self.par[x]

    def union(self, x, y):
        """
        x と y のグループを結合
        """
        x = self.find(x)
        y = self.find(y)
        if x != y:
            x_size = self.size[x]
            y_size = self.size[y]
            sum_size = x_size + y_size
            self.size[x] = sum_size
            self.size[y] = sum_size
            
            if self.rank[x] < self.rank[y]:
                x, y = y, x
            if self.rank[x] == self.rank[y]:
                self.rank[x] += 1
            self.par[y] = x

    def is_same(self, x, y):
        """
        x と y が同じグループか否か
        """
        return self.find(x) == self.find(y)
    
    def get_size(self, a):
        x = self.find(a)
        return self.size[x]
      
uf = UnionFind(N)
anses = []
ans = N * (N-1) // 2
anses.append(ans)

for k in range(len(A)-1):
    if uf.is_same(A[k], B[k]):
        anses.append(anses[k])
        print(anses)
    else:
        N1 = uf.get_size(A[k])
        N2 = uf.get_size(B[k])
        ans = anses[k] - (N1 * N2)
        if ans < 0:
            ans = 0
        uf.union(A[k], B[k])
        anses.append(ans)
        
for ans in reversed(anses):
        print(ans)

### FIXED CODE ###

a, b, c = list(map(int,input().split()))
q = int(b / a)
if q > c:
    print(c)
else:
    print(q)
temp=list(map(int,input().rstrip().split()))
n=temp[0]
S=temp[1]
summ=0
count=0
while summ<S :
    if (S-summ)>=n :
        summ+=n

        count+=1
    else :
        count+=1
        break
print(count)

### FIXED CODE ###

n=int(input())
a=set()
while n!=0 :
    rem=n%10
    a.add(rem)
    n/=10
if 7 in a :
    print("Yes")
    
else :
    print("No")
def resolve():
    import fractions
    n=int(input())
    a=[int(i) for i in input().split()]
    g=1
    dx=fractions.gcd
    for i in a:
        g*=i//dx(g,i)
    suml=0
    mod=10**9+7
    for i in a:
        suml+=g*pow(i,mod-2,mod)
        suml%=mod
    print(suml)
resolve()

### FIXED CODE ###

def resolve():
    N, M = map(int, input().split())
    if N == M:
        print('Yes')
    else:
        print('No')
resolve()
n,m=map(int,input().split())
a = []
b = []
ans = 0
for i in range(n):
    tempa,tempb = map(int,input().split())
    a.append(tempa)
    b.append(tempb)
test = dict(zip(a,b))
test = sorted(test.items())
# print(test)
# test_item = test.values()
# test_key = test.keys()
# print(test_item)
# print(test_key)
i=0
while m>0:
    if m-test[i][1] >=0:
        ans += test[i][0]*test[i][1]
        m -=test[i][1]
        i += 1
    else:
        ans += test[i][0]*m
        m=0
print(ans)



### FIXED CODE ###

n,m=map(int,input().split())
a = []
b = []
ans = 0
for i in range(n):
    tempa,tempb = map(int,input().split())
    a.append(tempa)
    b.append(tempb)
test = list(zip(a,b))
test = sorted(test)
i=0
while m>0:
    if m-test[i][1] >=0:
        ans += test[i][0]*test[i][1]
        m -=test[i][1]
    else:
        ans += test[i][0]*m
        m=0
        print(ans)
        exit()
    i+=1
print(ans)
while(True):
    tmp = list(map(int,input().split()))
    N, M = tmp[0],tmp[1]
    if N == 0:
        quit()
    hs = [0]
    ws = [0]
    hlen = []
    wlen = []
    ans = 0
    for i in range(N):
        hs.append(hs[-1] + int(input()))
    for i in range(M):
        ws.append(ws[-1] + int(input()))
    for i in range(N):
        for j in range(i+1,N+1):
            hlen.append(hs[j]-hs[i])
    for i in range(M):
        for j in range(i+1,M+1):
            wlen.append(ws[j]-ws[i])
    for i in hlen:
        ans += wlen.count(i)
    print(ans)



### FIXED CODE ###

#問題番号：2015 「Square Route」
#教室内の着席位置：中央*奥
#URL：http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=2015
#この問題の制約を見るに、O(N^2)で十分
#しかし、道と道の間の長さがN(N-1)/2あるため、これを求めるだけでO(N^2)
#従って、hとwでの比較はO(N)でしなければならない
while(True):
    tmp = list(map(int,input().split()))
    n,m = tmp[0],tmp[1]
    ans = 0
    #終了するケースを省く
    if n == 0:
        quit()
    hs, ws = [0], [0]
    #hとwについて累積和を取る(これがhsとws)
    for i in range(n):
        hs.append(hs[-1]+int(input()))
    for i in range(m):
        ws.append(ws[-1]+int(input()))
    #hとwについて、道の間の距離を差分として計算してそれぞれ記録(累積和を取っているのでsumを取る必要がなく高速)
    #工夫として、距離を直接記録して行くのではなく、「距離Lになった時にdif[L]をインクリメント」という方針
    #こうすることで最終的な計算をsum(h_dif[L]*w_dif[L])で出せる
    h_dif, w_dif = [0] * (hs[-1]+1), [0] * (ws[-1]+1)
    for i in range(n):
        for j in range(i+1,n+1):
            h_dif[hs[j]-hs[i]] += 1
    for i in range(m):
        for j in range(i+1,m+1):
            w_dif[ws[j]-ws[i]] += 1
    for i in range(1,min(len(h_dif),len(w_dif))):
        ans += h_dif[i] * w_dif[i]
    print(ans)
a = input()
    if a == 111:
      print("3")
    elif a == 101 or a==110 or a== 11:
      print("2")
    elif a = 0:
      print("0")
    else:
      print("1")

### FIXED CODE ###

a = input()
a = int(a)
if a==111:
  print("3")
elif a==101 or a==110 or a==11:
  print("2")
elif a ==0:
  print("0")
else:
  print("1")
input_x = input
print(x ** 3)

### FIXED CODE ###

x = input()
print(x ** 3)
x = input()
print(x**3)

### FIXED CODE ###

x = input()
y = int(x)
print(y**3)
#!/usr/bin/env python
# coding: UTF-8

import math, sys
if sys.version_info[0]<3: input=raw_input

class StandardInput:

    def stdin_string(self):
        self.s=str(input().rstrip())
        return self.s

    def stdin_integer(self):
        self.n=int(input().rstrip())
        return self.n

    def stdin_array(self):
        self.arr=input().rstrip().split()
        return self.arr

    def stdin_integer_array(self):
        self.arr=list(map(int,input().rstrip().split()))
        return self.arr

def test(arr):
    a,b,h,m=arr
    ar=2*math.pi*( h/12 + m/60/12 )
    br=2*math.pi*( m/60 )
    return math.sqrt( ( a*math.cos(ar) - b*math.cos(br) )**2 + ( a*math.sin(ar) - b*math.sin(br) )**2 )

def main():
    obj=StandardInput()
    arr=obj.stdin_integer_array()
    s=obj.stdin_string()
    print(test(arr))
        
if __name__ == '__main__':
    main()

### FIXED CODE ###

#!/usr/bin/env python
# coding: UTF-8

import math, sys
if sys.version_info[0]<3: input=raw_input

class StandardInput:

    def stdin_string(self):
        self.s=str(input().rstrip())
        return self.s

    def stdin_integer(self):
        self.n=int(input().rstrip())
        return self.n

    def stdin_array(self):
        self.arr=input().rstrip().split()
        return self.arr

    def stdin_integer_array(self):
        self.arr=list(map(int,input().rstrip().split()))
        return self.arr

def test(arr):
    a,b,h,m=arr
    ar=2*math.pi*( h/12 + m/60/12 )
    br=2*math.pi*( m/60 )
    return math.sqrt( ( a*math.cos(ar) - b*math.cos(br) )**2 + ( a*math.sin(ar) - b*math.sin(br) )**2 )

def main():
    obj=StandardInput()
    arr=obj.stdin_integer_array()
    print(test(arr))
        
if __name__ == '__main__':
    main()
n = int(input())
arr = []
for i in range(n-1):
    arr.append([int(s) for s in input().split(" ")])

childNodeNums = [0 for i in range(n)]
childNodeStatus = [-1 for i in range(n)]
nodeLines = [[] for i in range(n - 1)]


def prepare(n, arr):
    s = [[] for i in range(n)]
    for ar in arr:
        s[ar[0] - 1].append(ar[1] - 1)
        s[ar[1] - 1].append(ar[0] - 1)
    return s


# x为记录入边的颜色
def dfs(currentNode, arr, x):
    m1 = childNodeNums
    m2 = childNodeStatus
    childNodes = arr[currentNode]
    if len(childNodes) == 0:
        return

    childNodeNums[currentNode] = childNodeNums[currentNode] + len(arr[currentNode])
    childNodeStatus[currentNode] = 1

    kk = 0
    for i, childNodeIndex in enumerate(childNodes):

        if childNodeStatus[childNodeIndex] == -1:
            kk = kk + 1
            if x == kk:
                kk = kk + 1
            nodeLines[currentNode].append(kk)
            dfs(childNodeIndex, arr, kk)




data = prepare(n, arr)
dfs(0, data, -1)

print(max(childNodeNums))

for ar in nodeLines:
    for r in ar:
        print(r)


### FIXED CODE ###

from sys import setrecursionlimit


def genid(a, b):
    if b < a:
        a, b = b, a
    return a * 100000 + b


def paint(currentNode, usedColor, parentNode, edges, colors):
    color = 1
    for childNode in edges[currentNode]:
        if childNode == parentNode:
            continue
        if color == usedColor:
            color += 1
        colors[genid(currentNode, childNode)] = color
        paint(childNode, color, currentNode, edges, colors)
        color += 1


setrecursionlimit(100000)

N = int(input())
ab = [list(map(int, input().split())) for _ in range(N - 1)]

edges = [[] for _ in range(N)]
for a, b in ab:
    edges[a - 1].append(b - 1)
    edges[b - 1].append(a - 1)

colors = {}
paint(0, -1, -1, edges, colors)

print(max(len(e) for e in edges))
for a, b in ab:
    print(colors[genid(a - 1, b - 1)])
Sa = list(input())
Sb = list(input())
Sc = list(input())
d = Sa.pop(0)
for i in range(300):
  if d == "a":
    d = Sa.pop(0)
  elif d == "b":
    d = Sb.pop(0)
  else:
    d = Sc.pop(0)
  if Sa == [] and d == "a":
    print("A")
    break
  elif Sb == [] and d == "b":
    print("B")
    break
  elif Sc == [] and d == "c":
    print("C")
    break

### FIXED CODE ###

Sa = list(input())
Sb = list(input())
Sc = list(input())
d = Sa[0]
for i in range(300):
  if d == "a":
    d = Sa.pop(0)
  elif d == "b":
    d = Sb.pop(0)
  else:
    d = Sc.pop(0)
  if Sa == [] and d == "a":
    print("A")
    break
  elif Sb == [] and d == "b":
    print("B")
    break
  elif Sc == [] and d == "c":
    print("C")
    break
n = int(input())
ans = 0
for i in range(n):
    x, u = input().split()
    x = float(x)
    if u == 'JPY'
        ans += x
    else:
        ans += x * 380000
print(ans)

### FIXED CODE ###

n = int(input())
l = [input().split() for _ in range(n)]
ans = 0
for x, u in l:
    x = float(x)
    if u == 'JPY':
        ans += x
    else:
        ans += x * 380000
print(ans)
N,X=map(int,input().split())
inputcities=list(map(int, input().split()))
cities=set([abs(inputcities[i]-X) for i in range(N)])
N=len(cities)
count=0
flag=0
minimum=min(cities)
for j in range(minimum+1)[::-1]:
  for i in range(N):
    if cities[i]%j==0:
      count+=1
    else:
      count=0
      break
    if count==N:
      print(j)
      flag=1
      break
  if flag==1:
    break

### FIXED CODE ###

def gcd(a,b):
    if a < b:
        a,b = b,a
    if a % b == 0:
        return b
    else:
        return gcd(b,(a % b))
 
N,X=map(int,input().split())
inputcities=list(map(int, input().split()))
cities=[abs(inputcities[i]-X) for i in range(N)]
cities.sort()
D=cities[0]
for i in range(N):
  D=gcd(D,cities[i])
print(D)
N, M = map(int, input().split())
ab = []
for _ in range(M):
  ab.append(map(int, input().split())
           
bs = [0] * N
            

for c in range(N):
  for i in range(M):
    if c+1==ab[i][0] or c+1==ab[i][1]:
      bs[c] += 1
            

for _ in range(N):
  print(bs[_] ) 

### FIXED CODE ###

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


ab = []
for _ in range(M):
  ab.append(list(map(int, input().split())))
  
           
bridges = [0] * N
            
for c in range(N):
  for i in range(M):
    if c+1==ab[i][0] or c+1==ab[i][1]:
      bridges[c] += 1
            
 
for _ in range(N):
  print(bridges[_] )
x=int(input())
i,j=2,1
ans=[]
while True:
    j+=1
    if i**j>x:
        i+=1
        j=2
        if i**j>x:
            break
    ans.append(i**j)
print(max(ans))

### FIXED CODE ###

x=int(input())
i,j=2,1
ans=[]
if x==1:
    print(1)
    quit()
while True:
    j+=1
    if i**j>x:
        i+=1
        j=2
        if i**j>x:
            break
    ans.append(i**j)
print(max(ans))