Harryxun/stf_run huggingface dataset:
n = int(input())
a = [int(x) for x in input().split()]
num = 0
while True:
    for i in n:
        if a[i] % 2 == 1:
          return ans
        else:
            a[i] = a[i] / 2
        num += 1

### FIXED CODE ###

x = list(input())
print(x.count("1"))
A,B,C,D = map(int,input().split())
for num in range(0,):
    aoki = C - B
    taka = A - D
    if (aoki or taka) <= 0 : break
    else : pass

#print(aoki,taka)
if aoki <= 0 : print("Yes")
elif taka <= 0 : print("No")

### FIXED CODE ###

import math
A,B,C,D = map(int,input().split())
if (math.ceil(A/D)) >= (math.ceil(C/B)) : print("Yes") #小数点切り上げ
else : print("No")
from math import gcd
mod=1000000007

n=int(input())
zeros = 0
vec = {}
for _ in range(n):
  a,b=map(int,input().split())
  if a==0 and b==0:
    zeros+=1
    continue
  elif a==0:
    vec[(0,1)]=vec.get((0,1),0)+1
  elif b==0:
    vec[(1,0)]=vec.get((1,0),0)+1
  else:
    g = gcd(a,b)
    a,b= a//g,b//g
    vec[(a,b)]=vec.get((a,b),0)+1
done = set()
total=1
for (a,b),v in vec.items():
  if (-b,a) in done or (b,-a) in done: continue
  done.add((a,b))
  w=vec[(-b,a)]+vec[(b,-a)]
  total *= (pow(2,v,mod)+pow(2,w,mod)-1)
  total %= mod
print((total+zeros-1+mod)%mod)


### FIXED CODE ###

from math import gcd
mod = 10**9+7
n=int(input())
r = dict()
zeros = 0
for _ in range(n):
  a,b=map(int,input().split())
  if not any((a,b)):
    zeros+=1
    continue
  if all((a,b)):
    g = gcd(a,b)*(a//abs(a))
  elif a:
    g = a
  else:
    g = b
  p = a//g,b//g
  r[p] = r.get(p,0)+1
ans = 1
done = set()
for (a,b), v in r.items():
  if (b,-a) in done or (-b,a) in done:
    continue
  done.add((a,b))
  w = r.get((b,-a),0)+r.get((-b,a),0)
  ans = ans*(pow(2,v,mod)+pow(2,w,mod)-1)%mod
  
print((ans+zeros+mod-1)%mod)
N = int(input())
A = list(map(int, input().split()))
A.sort()
INF = 10**6+1
lis = [1]*INF
exist = [0]*INF
for i in range(N):
    a = A[i]
    exist[a] += 1
    if lis[a]:
        for q in range(2, INF // a + 1):
            lis[a*q] = 0
cnt = 0
for a in A:
    if lis[a] and exist[a] == 1:
        cnt += 1
print(cnt)

### FIXED CODE ###

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

INF = 10**6

A.sort()
check = [False] + [True]*(INF)

setA = list(set(A))
length = len(setA)
for i in range(length):
    x = setA[i]
    for j in range(2, int(INF/x)+1):
        check[x*j] = False

prev = 0
count = 0
flag = False #重複チェック
for i in range(N):
    x = A[i]
    if check[x]:
        if x != prev:
            count += 1
            flag = True
        elif flag:
            count -= 1
            flag = False
        prev = x
print(count)
#include <iostream>
using namespace std;
int main(void){
    int a, b, c;
    cin >> a >> b >> c;
    if(a < b && b < c) {
        cout << "Yes" << endl;
    }
    else {
        cout << "No" << endl;
    }
}



### FIXED CODE ###

a,b,c = map(int, input().split())
if a<b and b<c:
	print("Yes")
else:
	print("No")
n,m = map(int, input().split())
print((n*(n-1)/2+m*(m-1)/2)

### FIXED CODE ###

n,m = map(float, input().split())
print(int((n*(n-1)+m*(m-1))/2))
s = input()
n = len(s)
ret = None
for i in range(n - 1, 0, -1):
    if len(s[:i]) % 2 == 1:
        continue
    # print(s[:i // 2], s[i // 2:i][::-1])
    if s[:i // 2] == s[i // 2:i][::-1]:
        ret = s[:i]
        break
print(len(ret))


### FIXED CODE ###

s = input()
n = len(s)
ret = ''
for i in range(n - 1, 0, -1):
    if len(s[:i]) % 2 == 1:
        continue
    # print(s[:i // 2], s[i // 2:i])
    if s[:i // 2] == s[i // 2:i]:
        ret = s[:i]
        break
print(len(ret))
s=input()
if s=="1":
    print("Hello World");
else:
    a,b=map(int,input().split())
    print(a+b)


### FIXED CODE ###

s=input()
if s=="1":
    print("Hello World")
else:
    a=int(input())
    b=int(input())
    print(a+b)
print(sum(range(1,int(input())+1))

### FIXED CODE ###

print(sum(range(1,int(input())+1)))
N = int(input())

if N <= 9
	print(N)

### FIXED CODE ###

n = int(input())
 
if  n <= 9:
    print(n)
elif 10 <= n <= 99:
    print(9)
elif 100 <= n <= 999:
    print(n-99+9)
elif 1000 <= n <= 9999:
    print(909)
elif 10000 <= n <= 99999:
    print(n-9999+909)
elif n == 100000:
    print(90909)
times=10**100
S=input()
bs=[True if s=="L" else False for s in S]
#print(bs)

start=-1
cycle=-1
list_list=[]

clist=[1]*len(bs)
list_list.append(clist)
dic_list[str(clist)]=0

dic_list={}
for i in range(1,10**100):  
  new_clist=[0]*len(bs)
  for j,b in enumerate(bs):
    if b:
      new_clist[j-1]+=clist[j]
    else:
      new_clist[j+1]+=clist[j]

  clist=new_clist
  list_list.append(clist)
  #print(clist)
  
  if str(clist) in dic_list:
    #print(i,i-dic_list[str(clist)],str(clist))
    start=dic_list[str(clist)]
    cycle=i-dic_list[str(clist)]
    break
  else:
    dic_list[str(clist)]=i
    
#print(start,cycle,list_list[start])
index=((10**100-start)%cycle)+start
ans_list=map(str,list_list[index])
print(" ".join(ans_list))


### FIXED CODE ###

S=input()
ans_list=[0]*len(S)

rmode=True
cnt_R=0
cnt_L=0
border_R=0
border_L=0
for i in range(len(S)):
  if rmode:
    if S[i]=="R":
      cnt_R+=1
    else:
      border_R=i-1
      border_L=i      
      rmode=False
      cnt_L=1
  else:
    if S[i]=="L":
      cnt_L+=1
    else:
      ans_list[border_R]+=(cnt_R+1)//2
      ans_list[border_L]+=cnt_R//2
      ans_list[border_R]+=cnt_L//2
      ans_list[border_L]+=(cnt_L+1)//2
      rmode=True
      cnt_R=1
      cnt_L=0
else:
  ans_list[border_R]+=(cnt_R+1)//2
  ans_list[border_L]+=cnt_R//2
  ans_list[border_R]+=cnt_L//2
  ans_list[border_L]+=(cnt_L+1)//2
  
      
ans_list_str=map(str,ans_list)
print(" ".join(ans_list_str))
n= input()
ans,temp = 0,0
for x in S:
    if x in 'ACGT':
        temp += 1
    else:
        temp = 0
    ans = max(ans,temp)
print(ans)

### FIXED CODE ###

s=input()
ans=0
cnt=0
for i in s:
    if i in ["A","G","C","T"]:
        cnt+=1
        ans=max(ans,cnt)
    else: cnt=0
print(ans)
x = input()
 print(x*x*x)

### FIXED CODE ###

x = input()
ans = x**3
print ans
n=int(input())
q=[input().split() + [i] for i in range(n)]
for i in range(n):
    q[i][1]=int(q[i][1])
list_point = sorted(q, key=lambda x:x[1], reverse=1)
list_city = sorted(list_point, key=lambda x:x[0], reverse=0)
for s,t,r in list_city:
    print(r+1)
    

### FIXED CODE ###

A, P = (int(i) for i in input().split()) 

print((3*A + P)//2)
h, a = map(int, input().split())
arr = list(map(int, input.split()))
for i in arr:
    h-=i
print("Yes" if h<=0 else "No")

### FIXED CODE ###

h, a = map(int, input().split())
arr = list(map(int, input().split()))
for i in arr:
    h-=i
print("Yes" if h<=0 else "No")
def dfs(st, depth=0):
    dist[st] = depth
    for to, c in tree[st]:
        if dist[to]>=0:
            continue
        dfs(to, depth+c)


N = int(input())
tree = [[] for _ in range(N)]
dist = [-1]*N

for _ in range(N-1):
    a,b,c = map(int, input().split())
    tree[a-1].append((b-1, c))
    tree[b-1].append((a-1, c))

Q, K = map(int, input().split())
dfs(K-1, 0)
# print(dist)
# print(tree)
for _ in range(Q):
    x, y = map(int, input().split())
    print(dist[x-1]+dist[y-1])

### FIXED CODE ###

import sys
sys.setrecursionlimit(10**7)

def dfs(st, depth=0):
    dist[st] = depth
    for to, c in tree[st]:
        if dist[to]>=0:
            continue
        dfs(to, depth+c)


N = int(input())
tree = [[] for _ in range(N)]
dist = [-1]*N

for _ in range(N-1):
    a,b,c = map(int, input().split())
    tree[a-1].append((b-1, c))
    tree[b-1].append((a-1, c))

Q, K = map(int, input().split())
dfs(K-1, 0)
# print(dist)
# print(tree)
for _ in range(Q):
    x, y = map(int, input().split())
    print(dist[x-1]+dist[y-1])
A, B = map(int, input().split())
if A < B:
  if A == 1:
    print('Alice')
  else:
    print('Bob')

elif B > A:
  if B == 1:
    print('Bob')
  else:
    print('Alice')
else:
  print('Draw')

### FIXED CODE ###

x = int(input())
if x >= 1200:
  print('ARC')
else:
  print('ABC')
a = int(input())



b= int(input())

if (a*b)%2 == 0:
    print("Even")
else:
    print("Odd")


### FIXED CODE ###

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


if (a*b)%2 == 0:
    print("Even")
else:
    print("Odd")
MOD = 10**9 + 7


def main():
    N = int(input())
    AB = {tuple(sorted(int(i) for i in input().split())) for j in range(N)}
    cnt = 0
    ban = set()
    bannum = 0
    for a, b in AB:
        if (a, b) in ban:
            continue
        ban1 = (-a, b)
        ban2 = (a, -b)
        if ban1 in AB and ban2 in AB:
            ban.add(ban1)
            ban.add(ban2)
            cnt += 1
            bannum += 3*pow(2, N-3, MOD)
            bannum %= MOD
        elif ban1 in AB:
            ban.add(ban1)
            cnt += 1
            bannum += pow(2, N-2, MOD)
            bannum %= MOD
        elif ban2 in AB:
            ban.add(ban2)
            bannum += pow(2, N-2, MOD)
            bannum %= MOD
            cnt += 1
    if (-1, 1) in AB:
        add = 1
        for a, b in AB:
            if a == b:
                bannum += pow(2, N-2, MOD)
                bannum %= MOD
                add += 1
        cnt += add
    # cntは選んではいけないペアの数
    v = cnt
    ans = pow(2, N, MOD) - 1
    ans -= bannum
    ans %= MOD
    print(ans)


if __name__ == '__main__':
    main()


### FIXED CODE ###

MOD = 10**9 + 7
P = 7 ** 21 + 52


def F(a, b):
    return (a * pow(b, P-2, P)) % P


def main():
    from collections import Counter
    import sys
    input = sys.stdin.buffer.readline
    N = int(input())
    T = [[int(i) for i in input().split()] for j in range(N)]
    cnt_zero = [0, 0]  # 片方が0のとき
    p = 0  # 両方0
    cA = Counter()
    B = []
    used = set()
    for a, b in T:
        if a == 0 and b == 0:
            p += 1
        elif a == 0:
            cnt_zero[0] += 1
        elif b == 0:
            cnt_zero[1] += 1
        else:
            x = F(a, b)
            y = -F(b, a) % P
            cA[x] += 1
            if x not in used and y not in used:
                B.append((x, y))
                used.add(x)
                used.add(y)

    ans = 1
    ans *= pow(2, cnt_zero[0], MOD) - 1 + pow(2, cnt_zero[1], MOD) - 1 + 1
    for a, b in B:
        ans *= pow(2, cA[a], MOD) - 1 + pow(2, cA[b], MOD) - 1 + 1
        ans %= MOD
    print((ans + p - 1) % MOD)


if __name__ == '__main__':
    main()
#!/usr/bin/env python3
#dp9 #Sushi

import sys
import bisect
input = sys.stdin.readline
def LI(): return list(map(int,input().split()))
def LIR(n): return [LI() for _ in range(n)]

def J():
    n = int(input())
    a = LI()
    a.sort()
    one = bisect.bisect_right(a,1)
    two = bisect.bisect_right(a,2) - one
    three = n - one - two

    #dp[i][j][k] := 残り1個の皿がi枚、2個の皿がj枚、3個の皿がk枚の状態から
    #               寿司をすべてなくすのに必要な操作回数の期待値
    dp = [[[0.0]*(n+1) for _ in range(n+1)] for _ in range(n+1)]
    for k in range(three+1):
        for j in range(two+three+1 - k):
            for i in range(one+two+three+1-k-j):
                if i == 0 and j == 0 and k == 0:
                    continue
                tmp = n*1.0
                if i > 0:
                    tmp += i*dp[i-1][j][k]
                if j > 0:
                    tmp += j*dp[i+1][j-1][k]
                if k > 0:
                    tmp += k*dp[i][j+1][k-1]
                dp[i][j][k] = tmp/(i+j+k)
    print(dp[one][two][three])
if __name__ == '__main__':
    J()
#!/usr/bin/env python3
#dp9 #Sushi

import sys
import bisect
input = sys.stdin.readline
def LI(): return list(map(int,input().split()))
def LIR(n): return [LI() for _ in range(n)]

def J():
    n = int(input())
    a = LI()
    a.sort()
    one = bisect.bisect_right(a,1)
    two = bisect.bisect_right(a,2) - one
    three = n - one - two

    #dp[i][j][k] := 残り1個の皿がi枚、2個の皿がj枚、3個の皿がk枚の状態から
    #               寿司をすべてなくすのに必要な操作回数の期待値
    dp = [[[0.0]*(n+1) for _ in range(n+1)] for _ in range(n+1)]
    for k in range(three+1):
        for j in range(two+three+1 - k):
            for i in range(one+two+three+1-k-j):
                if i == 0 and j == 0 and k == 0:
                    continue
                tmp = n*1.0
                if i > 0:
                    tmp += i*dp[i-1][j][k]
                if j > 0:
                    tmp += j*dp[i+1][j-1][k]
                if k > 0:
                    tmp += k*dp[i][j+1][k-1]
                dp[i][j][k] = tmp/(i+j+k)
    print(dp[one][two][three])
if __name__ == '__main__':
    J()


### FIXED CODE ###

#!/usr/bin/env python3
#dp9 #Sushi

import sys
import bisect
input = sys.stdin.readline
def LI(): return list(map(int,input().split()))
def LIR(n): return [LI() for _ in range(n)]

def J():
    n = int(input())
    a = LI()
    a.sort()
    one = bisect.bisect_right(a,1)
    two = bisect.bisect_right(a,2) - one
    three = n - one - two

    #dp[i][j][k] := 残り1個の皿がi枚、2個の皿がj枚、3個の皿がk枚の状態から
    #               寿司をすべてなくすのに必要な操作回数の期待値
    dp = [[[0.0]*(n+1) for _ in range(n+1)] for _ in range(n+1)]
    for k in range(three+1):
        for j in range(two+three+1 - k):
            for i in range(one+two+three+1-k-j):
                if i == 0 and j == 0 and k == 0:
                    continue
                tmp = n*1.0
                if i > 0:
                    tmp += i*dp[i-1][j][k]
                if j > 0:
                    tmp += j*dp[i+1][j-1][k]
                if k > 0:
                    tmp += k*dp[i][j+1][k-1]
                dp[i][j][k] = tmp/(i+j+k)
    print(dp[one][two][three])
if __name__ == '__main__':
    J()
N, K = map(int, input().split())
S = input()
if(S[K-1] == 'A'):
  S[K-1] = 'a'
elif(S[K-1] == 'B'):
  S[K-1] = 'b'
else:
  S[K-1] = 'c'
print(S)

### FIXED CODE ###

N, K = map(int, input().split())
S = input()
if(S[K-1] == 'A'):
  S = S[:(K-1)] + 'a' + S[K:]
elif(S[K-1] == 'B'):
  S = S[:(K-1)] + 'b' + S[K:]
else:
  S = S[:(K-1)] + 'c' + S[K:]
print(S)
INF = 10 ** 9
import sys
sys.setrecursionlimit(100000000)
dy = (-1,0,1,0)
dx = (0,1,0,-1)
from  collections import deque

def main():
    s = list(input())
    k = int(input())
    for i in range(len(s)):
        if k >= ord('z') - ord(s[i]) + 1:
            k -= ord('z') - ord(s[i]) + 1
            s[i] = 'a'
        else:
            i += 1
    
    if k > 0:
        s[-1] = chr(ord(s[-1]) + k)
    
    print(''.join(s))
if __name__ == '__main__':
    main()


### FIXED CODE ###

INF = 10 ** 9
import sys
sys.setrecursionlimit(100000000)
dy = (-1,0,1,0)
dx = (0,1,0,-1)
from  collections import deque

def main():
    s = list(input())
    k = int(input())
    for i in range(len(s)):
        if s[i] == 'a':
            continue
        if k >= ord('z') - ord(s[i]) + 1:
            k -= ord('z') - ord(s[i]) + 1
            s[i] = 'a'
            if k == 0:
                break
    
    if k > 0:
        s[-1] = chr((ord(s[-1]) + k - 97)%26 + 97)
    
    print(''.join(s))
if __name__ == '__main__':
    main()
s=int(input())
print("Heisei" if s <= "2019/04/30" else "TBD")

### FIXED CODE ###

s=input()
print("Heisei" if s <= "2019/04/30" else "TBD")
n = int(input())
k = int(input())

if n >= k:
  n %= k
  
print(n)

### FIXED CODE ###

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

if n >= k:
  n %= k
  
print(min(n, -(n-k)))
import itertools as it
def X (n):
    if n%2==0:
        r=n//2
    else:
        r=(n-1)//2
    S=1
    C=1
    for j in range(1,r+1):
        C=len(list(it.combinations(range(n-j),j)))
        S+=C
    return int(S)

N,M=map(int,input().split())
L=[]
a=0
for i in range(M):
    b=int(input())
    L.append(b-a-1)
    a=b
L.append(N-b-1)
A=1
mod=10**9+7
for i in range(len(L)):
    A*=(X(L[i])%mod)
    if L[i]==0 and i>0:
        A=0
        break
print(A%mod)

### FIXED CODE ###

N,M=map(int,input().split())
mod=1000000007
a=[0]*(10**5+1)
dp=[0]*(10**5+1)
for i in range(M):
    b=int(input())
    a[b]=1
dp[0]=1
for i in range(1,N+1):
    if a[i]==1:
        continue
    dp[i]+=dp[i-1]
    if i>1:
        dp[i]+=dp[i-2]
    dp[i]=dp[i]%mod
print(dp[N]%mod)
K = int(input())

Sum = []
for a in range(1, K+1):
    for b in range(1, K + 1):
        for c in range(1, K + 1):
            gcd = gcd_list([a, b, c])
            Sum.append(gcd)

print(sum(Sum))

### FIXED CODE ###

import math

K = int(input())

Sum = []
for a in range(1, K+1):
    for b in range(1, K + 1):
        gcd2 = math.gcd(a, b)
        for c in range(1, K + 1):
            gcd = math.gcd(gcd2, c)
            Sum.append(gcd)

print(sum(Sum))
n,a,b=int(input().split())
print(min(n*a,b))

### FIXED CODE ###

n,a,b=map(int,input().split())
print(min(n*a,b))
count=0
def merge(A, left, mid, right):
    global count
    L=A[left:mid]+[100000000]
    R=A[mid:right]+[10000000]
    i=0
    j=0
    for k in range(left,right):
        if L[i] <= R[j]:
            A[k] = L[i]
            i += 1
        else:
            A[k] = R[j]
            j += 1
        count+=1
def merge_sort(A, left, right):
    if left+1 < right:
        mid=(left+right)//2
        merge_sort(A, left, mid)
        merge_sort(A, mid, right)
        merge(A, left, mid, right) 

if __name__ == "__main__":
    n=int(input())
    A=list(map(int,input().split()))
    merge_sort(A,0,n)
    print(*A)
    print(count)


### FIXED CODE ###

count=0
def merge(A, left, mid, right):
    global count
    L=A[left:mid]+[2**32]
    R=A[mid:right]+[2**32]
    i=0
    j=0
    for k in range(left,right):
        if L[i] <= R[j]:
            A[k] = L[i]
            i += 1
        else:
            A[k] = R[j]
            j += 1
        count+=1
def merge_sort(A, left, right):
    if left+1 < right:
        mid=(left+right)//2
        merge_sort(A, left, mid)
        merge_sort(A, mid, right)
        merge(A, left, mid, right) 

if __name__ == "__main__":
    n=int(input())
    A=list(map(int,input().split()))
    merge_sort(A,0,n)
    print(*A)
    print(count)
import math
import numpy as np
from functools import reduce
n,x=map(int,input().split())
p=list(map(int,input().split()))
p=np.array(p)
p=p-x

def gcd_list(numbers):
    return reduce(math.gcd, numbers)
print(gcd=list(p))

### FIXED CODE ###

import math
import numpy as np
import functools
import fractions
n,x=map(int,input().split())
p=list(map(int,input().split()))
p=np.array(p)
p=abs(p-x)
print(functools.reduce(fractions.gcd, p))
h,w=map(int,input().split())
l=[list(input()) for _ in range(w)]
l=[x for x in l if '#' in x]
l=[x for x in zip(*l) if '#' in x]
for i in zip(*l):
	print(''.join(i))
	

### FIXED CODE ###

h,w=map(int,input().split())
l=[list(input()) for _ in range(h)]
l=[x for x in l if '#' in x]
l=[x for x in zip(*l) if '#' in x]
for i in zip(*l):
	print(''.join(i))
if __name__ == '__main__':
	a, b, c = map(int, input().split(' '))
    if a == b and b == c:
		print('Yes')
	else:
		print('No')

### FIXED CODE ###

if __name__ == '__main__':
	a, b, c = list(map(int, input().split(' ')))
	if a == b and b == c:
		print('Yes')
	else:
		print('No')
# -*- coding: utf-8 -*-
"""
Created on Sun Mar 22 09:27:00 2020

@author: azikausy
"""
from collections import deque

S = list(input())
Q = int(input())
#Query = {}
#TFC = []
perm = 0
d = deque(S)
#l = []
for i in range(0, Q):
    l = input().split()
    if len(l) == 1:
        #Query[i] = [l[0], 0, 0]
        #S.reverse()
        perm += 1
    else:
        #l[2] = l[2] + perm
        #Query[i] = l
        if (int(l[1])+perm) % 2 == 0:
            d.append(l[2])
        else:
            d.insert(0, l[2])

S0 = list(d)
if perm % 2 != 0:
    S0.reverse()
ans = ""
for i in range(0, len(S0)):
    ans = ans + S0[i]
print(ans)

### FIXED CODE ###

from collections import deque
S = list(input())
Q = int(input())
perm = 0
d = deque(S)

for i in range(0, Q):
    l = input().split()
    if len(l) == 1:
        perm += 1
    else:
        if (int(l[1])+perm) % 2 == 0:
            d.append(l[2])
        else:
            d.appendleft(l[2])
 
S0 = list(d)
if perm % 2 != 0:
    S0.reverse()
ans = ""
for i in range(0, len(S0)):
    ans = ans + S0[i]
print(ans)
N, M = map(int,input().split())

connect = [[] for _ in range(N)]
visited = [False for _ in range(N)]
cord = [0 for _ in range(N)]

for _ in range(M):
    l,r,d = map(int,input().split())
    l -= 1
    r -= 1
    connect[l].append((r,-d))
    connect[r].append((l,d))

def dfs(i,depth):
    for x, d in connect[i]:
        if not visited[x]:
            visited[x] = True
            cord[x] = depth + d
            dfs(x, cord[x])
        else:
            if cord[x] != depth + d:
                return False
    return True

for i in range(N):
    if not visited[i]:
        visited[i] = True
        flag = dfs(i, 0)
    if not flag:
        break

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

### FIXED CODE ###

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

connect = [[] for _ in range(N)]
visited = [False for _ in range(N)]
cord = [0 for _ in range(N)]

for _ in range(M):
    l,r,d = map(int,input().split())
    l -= 1
    r -= 1
    connect[l].append((r,d))
    connect[r].append((l,-d))

def dfs(i):
    q = [i]
    
    while q:
        x = q.pop()
        for nx, d in connect[x]:
            if not visited[nx]:
                visited[nx] = True
                cord[nx] = cord[x] + d
                q.append(nx)
            else:
                if cord[nx] != cord[x] + d:
                    return False
            
    return True

for i in range(N):
    if not visited[i]:
        visited[i] = True
        flag = dfs(i)
    if not flag:
        break

if flag:
    print('Yes')
else:
    print('No')
n, m, l = [int(i) for i in input().split()]

A = []
B = []
C = []

for ni in range(n):
    A.append([int(i) for i in input().split()])

for mi in range(m):
    B.append([int(i) for i in input().split()])

for i in range(n):
    C.append([])
    for j in range(l):
        c.append(0)
        for k in range(m):
            C[i][j] += A[i][k] * B[k][j]

for ni in range(n):
    print(" ".join([str(s) for s in C[ni]]))

### FIXED CODE ###


n, m, l = [int(i) for i in input().split()]

A = []
B = []
C = []

for ni in range(n):
    A.append([int(i) for i in input().split()])

for mi in range(m):
    B.append([int(i) for i in input().split()])

for i in range(n):
    C.append([])
    for j in range(l):
        C[i].append(0)
        for k in range(m):
            C[i][j] += A[i][k] * B[k][j]

for ni in range(n):
    print(" ".join([str(s) for s in C[ni]]))
def LI(): return list(map(int,input().split()))
N,D = LI()
X = [LI() for _ in range(N)]
ans = 0
for i in range(N):
    for j in range(i+1,N):
        temp = 0
        for k in range(D):
            temp += (X[j][k]-X[i][k])**2
        if temp **0.5%1==0:
        ans += 1
print(ans)

### FIXED CODE ###

import numpy
N, D = map(int, input().split())
listx = []
count = 0
for i in range(N):
    x = list(map(int, input().split()))
    listx.append(x)

for j in range(0, N):
    for k in range(j+1,N):
        a = numpy.array(listx[j])
        b = numpy.array(listx[k])
        u = b - a
        c = float(numpy.linalg.norm(u))
        if c.is_integer() :
            count += 1
print(count)
def main()
	import sys
	input = sys.stdin.readline
	sys.setrecursionlimit(10 ** 7)
 
 
	N, Q = map(int, input().split())
 
	T = [[]for i in range(N)]
 
	for i in range(N-1):
    	a, b = map(int, input().split())
    	T[a-1].append(b-1)
    	T[b-1].append(a-1)
 
	X = [0 for i in range(N)]
	for i in range(Q):
    	p, x = map(int, input().split())
    	X[p-1] += x
 
	def dfs(x, p):
    	for j in T[x]:
        	if j == p:
            	continue
        	X[j] += X[x]
        	dfs(j, x)
 
	dfs(0, -1)
 
	for i in range(N):
    	print(X[i], end =" ")
main()

### FIXED CODE ###

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

F = [0 for i in range(N)]
T = [[]for i in range(N)]

for i in range(N-1):
    a, b = map(int, input().split())
    T[a-1].append(b-1)

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

ans = [X[i] for i in range(N)]
for i in range(N):
    F[i] = 1
    for j in range(len(T[i])):
        if F[T[i][j]] == 1:
            continue
        ans[T[i][j]] += ans[i]

for i in range(N):
    print(ans[i], end =" ")
A=int(input())
B=[1]*9
for i in range(1:10):
  for j in range(A+1):
    if j**i <= A:
      B[i]= j**i
    else:break
print(B.sort()[-1])
  

### FIXED CODE ###

A=int(input())
B=[1]*8
for i in range(2,10):
  for j in range(A+1):
    if j**i <= A:
      B[i-2]= j**i
    else:break
print(max(B))