Harryxun/stf_run huggingface dataset:
n , m ,l = [int(i) for i in input().split()]

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

for ni in range(n):
    A.append([int(i) for mi 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(l):
    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]]))
import sys
import numpy as np

sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))

H, W = lr()
A = np.array([lr() for _ in range(H)])
B = np.array([lr() for _ in range(H)])
diff = np.abs(A - B).tolist()
dp = np.array([[np.zeros((H+W)*80+1) for _ in range(W)] for _ in range(H)], np.bool)
base = ((H+W)*80+1)//2
begin = diff[0][0]
dp[0][0][base+begin] = 1
dp[0][0][base-begin] = 1
for i in range(H):
    for j in range(W):
        d = diff[i][j]
        if i > 0:
            dp[i][j][d:] |= dp[i-1][j][:-d]
            dp[i][j][:-d] |= dp[i-1][j][d:]
        if j > 0:
            dp[i][j][d:] |= dp[i][j-1][:-d]
            dp[i][j][:-d] |= dp[i][j-1][d:]

result = dp[H-1][W-1][base:]
answer = np.nonzero(result)[0].min()
print(answer)


### FIXED CODE ###

import sys
import numpy as np

sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))

H, W = lr()
A = [lr() for _ in range(H)]
B = [lr() for _ in range(H)]
diff = [[0] * W for _ in range(H)]
for i in range(H):
    for j in range(W):
        diff[i][j] = abs(A[i][j] - B[i][j])

X = (H+W) * 80
L = X + X + 1 #真ん中を0とする、最後に-X
dp = [[None] * W for _ in range(H)]
dp[0][0] = np.zeros(L, np.bool)
dp[0][0][X+diff[0][0]] = 1; dp[0][0][X-diff[0][0]] = 1 #非負整数のみでも良い
for h in range(H):
    for w, di in enumerate(diff[h]):
        if h == 0 and w == 0:
            continue
        x = np.zeros(L, np.bool)
        if h > 0:
            x[di:] |= dp[h-1][w][:L-di]
            x[:L-di] |= dp[h-1][w][di:]
        if w > 0:
            x[di:] |= dp[h][w-1][:L-di]
            x[:L-di] |= dp[h][w-1][di:]
        dp[h][w] = x

dp = dp[-1][-1]
possible = np.where(dp)[0] - X
answer = np.abs(possible).min()
print(answer)
# 07
https://atcoder.jp/contests/abc150/submitinput()
s = input()
ans = 0
while 1:
    pos = s.find('ABC')
    if pos == -1:
        break
    ans += 1
    s = s[pos + 3:]
print(ans)

### FIXED CODE ###

input()
s = input()
ans = 0
while 1:
    pos = s.find('ABC')
    if pos == -1:
        break
    ans += 1
    s = s[pos + 3:]
print(ans)
n,m = map(int, input().split())
x = [int(i) for i in input().split()]
x.sort()
x2 = []
for i in range(len(x)-1):
  x2.append(x[i+1] - x[i])
x2.sort()
if n < m:
  print(sum(x2[:len(x2) - n + 1]))
else:
  print('0')

### FIXED CODE ###

t,x = map(int ,input().split())
print(t/x)
def main():
    N = int(input())
    visited = [False] * N
    d = [[] for _ in range(N)]
    for i in range(N-1):
        a, b = map(int, input().split())
        a -= 1
        b -= 1
        d[a].append((b,i))
        d[b].append((a,i))

    ans = [0] * (N - 1) 

    def dfs(v, c, p):
        k = 1
        for i in range(len(d[v])):
            u = d[v][i][0]
            ei = d[v][i][1]
            if u == p:
                continue
            if k == c:
                k += 1
            ans[ei] = k
            k += 1
            dfs(u,ans[ei],v)
    
    dfs(0,-1,-1)
    print(max(ans))
    for a in ans:
        print(a)

        

if __name__ == "__main__":
    main()

### FIXED CODE ###

import sys
input = sys.stdin.readline
sys.setrecursionlimit(4100000)

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

    ans = [0] * (N - 1) 

    def dfs(v, c, p):
        k = 1
        for i in range(len(d[v])):
            u = d[v][i][0]
            ei = d[v][i][1]
            if u == p:
                continue
            if k == c:
                k += 1
            ans[ei] = k
            k += 1
            dfs(u,ans[ei],v)
    
    dfs(0,-1,-1)
    print(max(ans))
    for a in ans:
        print(a)

        

if __name__ == "__main__":
    main()
# import sys
# input = sys.stdin.readline

n, m, l = map(int, input().split())
abc = [list(map(int, input().split())) for _ in range(m)]
q = int(input())

st = [list(map(int, input().split())) for _ in range(q)]

graph = [[float('inf') for _ in range(n)] for _ in range(n)]


for a, b, c in abc:
    graph[a-1][b-1] = c 
    graph[b-1][a-1] = c
for i in range(n):
    graph[i][i] = 0

# print(graph)

def warshall_floyd(graph):
    d = graph.copy()
    for i in range(n):
        for j in range(n):
            for k in range(n):
                d[i][j] = min(d[i][j], d[i][k] + d[k][j])
    return d

graph = warshall_floyd(graph)

for i in range(n):
    for j in range(n):
        if i!=j and graph[i][j] <= l:
            graph[i][j] = 1
        if graph[i][j] > l:
            graph[i][j] = float('inf')

graph = warshall_floyd(graph)

for s, t in st:
    print(graph[s-1][t-1]-1 if graph[s-1][t-1] != float('inf') else -1)


### FIXED CODE ###

import sys
input = sys.stdin.readline
 
n, m, l = map(int, input().split())
abc = [list(map(int, input().split())) for _ in range(m)]
q = int(input())
 
st = [list(map(int, input().split())) for _ in range(q)]
 
graph = [[float('inf') for _ in range(n)] for _ in range(n)]
 
 
for a, b, c in abc:
    graph[a-1][b-1] = c 
    graph[b-1][a-1] = c
for i in range(n):
    graph[i][i] = 0
 
# print(graph)
 
def warshall_floyd(d):
    for k in range(n):
        for i in range(n):
            for j in range(n):
                d[i][j] = min(d[i][j], d[i][k] + d[k][j])
    return d
 
graph = warshall_floyd(graph)
 
for i in range(n):
    for j in range(n):
        if 0 < graph[i][j] <= l:
            graph[i][j] = 1
        if graph[i][j] > l:
            graph[i][j] = float('inf')
 
graph = warshall_floyd(graph)
 
for s, t in st:
    print(graph[s-1][t-1]-1 if graph[s-1][t-1] != float('inf') else -1)
H, W = map(int, input().split())
S = [input() for _ in range(H)]
seen = [[0]*W for _ in range(H)]


def rec(h,w,seen):
	if S[h][w] == '.':
		res = [1, 0]
	else:
		res = [0, 1]
	dh = [-1, 1, 0, 0]
	dw = [0, 0, -1, 1] 
	seen[h][w] = 1
	for i in range(4):
		nh = h+dh[i]
		nw = w+dw[i]
		if 0 <= nh <= H-1 and 0 <= nw <= W-1:
			if seen[nh][nw] == 0 and S[nh][nw] != S[h][w]:
				r0, r1 = rec(nh, nw, seen)
				res[0] += r0
				res[1] += r1
					
	return res

ans = 0
for h in range(H):
	for w in range(W):
		if seen[h][w] != 1:
			t0, t1 = rec(h, w, seen)
			ans += t0 * t1
print(ans)

### FIXED CODE ###

import sys
sys.setrecursionlimit(10000000)
H, W = map(int, input().split())
S = [input() for _ in range(H)]
seen = [[0]*W for _ in range(H)]


def rec(h,w,seen):
	if S[h][w] == '.':
		res = [1, 0]
	else:
		res = [0, 1]
	dh = [-1, 1, 0, 0]
	dw = [0, 0, -1, 1] 
	seen[h][w] = 1
	for i in range(4):
		nh = h+dh[i]
		nw = w+dw[i]
		if 0 <= nh <= H-1 and 0 <= nw <= W-1:
			if seen[nh][nw] == 0 and S[nh][nw] != S[h][w]:
				r0, r1 = rec(nh, nw, seen)
				res[0] += r0
				res[1] += r1
					
	return res

ans = 0
for h in range(H):
	for w in range(W):
		if seen[h][w] != 1:
			t0, t1 = rec(h, w, seen)
			ans += t0 * t1
print(ans)
a=[int(input()) for _ in range(5)]
ar=[[i,a[i]%10] for i in range(5)]
ar.sort(key=lambda x:x[1])
i=0
while ar[i][1]==0:
    i+=1
k=ar[i][0]
time=0
for i in range(5):
    if i!=k:
        if a[i]%10==0:
            time+=a[i]
        else:
            time+=a[i]+10-a[i]%10
time+=a[k]
print(time)


### FIXED CODE ###

a=[int(input()) for _ in range(5)]
ar=[[i,a[i]%10] for i in range(5)]
ar.sort(key=lambda x:x[1])
i=0
while ar[i][1]==0:
    i+=1
    if i==4:
        break
k=ar[i][0]
time=0
for i in range(5):
    if i!=k:
        time+=a[i]
        if a[i]%10!=0:
            time+=10-a[i]%10
time+=a[k]
print(time)
import numpy as np
N,M = map(int,input().split())
a = 0
w = 0
lis = np.zeros(N + 1)
for i in range(M):
  p,s = map(str,input().split())
  p = int(p)
  if lis[p + 1] == 0 and s == "AC":
    a += 1
    lis[p] = 1
  elif lis[p + 1] > 0 and s == "AC":
    continue
  elif lis[p + 1] == 0 and s == "WA":
    w += 1
  elif lis[p + 1] > 0 and s == "WA":
    continue
    
print(a,w)



### FIXED CODE ###

N,M = map(int,input().split())
a = 0
w = 0
lis = [[] for _ in range(N)]
for i in range(M):
  p,s = map(str,input().split())
  p = int(p)
  lis[p - 1].append(s)
for j in range(N):
  if lis[j].count("AC") > 0:
    a += 1
    w += lis[j].index("AC")

    
print(a,w)
s,t = map(str, input(),split())
print(t + s)

### FIXED CODE ###

s,t = map(str, input().split())
print(t+s)
#!/usr/bin/env python

def main():
    A, B = map(float, input().split())
    print(int((A * B) / /1))

if __name__ == '__main__':
    main()

### FIXED CODE ###

from decimal import *
A, B = map(Decimal, input().split())
print(int(A * B // 1))
n = int(input())
ans = "No"
for i in range(2,10):
    if n % i = 0 and n // i < 10 :
        ans = "Yes"
        break()
print(ans)

### FIXED CODE ###

n = int(input())
ans = "No"
for i in range(1,10):
    if n % i == 0 and n // i < 10 :
        ans = "Yes"
        break
print(ans)
S=str(input())
if S[3]　== S[2]:
  if S[4]==S[6]:
    return str(Yes)
  

### FIXED CODE ###


S = str(input())
a= 'Yes'
b='No'
if S[3] is S[2] and S[4] is S[5]:
    print(a)
else:
    print(b)
a=input()
c=False
f=False
for i in range(len(a))
  if c==True:
    if a[i]=='F'
    f=True
  else:
    if a[i]=='C'
    c=True
if c==True and f==True:
  print("Yes")
else:
  print("No")

### FIXED CODE ###

a=input()
c=False
f=False
for i in range(len(a)):
    if c==True:
        if a[i]=='F':
            f=True
    else:
        if a[i]=='C':
            c=True
if c==True and f==True:
    print("Yes")
else:
    print("No")
from namba import jit
import numpy as np
@jit
def main():
  R,C,K=map(int,input().split())
  scores=np.zeros((R,C),np.int64)
  for _ in range(K): #各マスにアイテム配置
    r,c,v=map(int,input().split())
    scores[r-1][c-1]=v
  dp=np.zeros((R+1,C+1,4),np.int64) #後のために余分に作っておく、scoresの配列は別なのでindexに注意
  for i in range(1,R+1):
    for j in range(1,C+1):
      for k in range(4):
        dp[i][j][k]=max(dp[i][j-1][k],dp[i-1][j][3]) #同じ行ですでに3つ拾ってから次の行にくるのかただ隣のマスに進むか
      for k in range(3,0,-1):
        dp[i][j][k]=max(dp[i][j][k],dp[i][j][k-1]+scores[i-1][j-1]) #そのマスでアイテムを拾うかどうか
  return dp[R][C][3]
print(main())

### FIXED CODE ###

from numba import jit
import numpy as np
@jit
def main():
  R,C,K=map(int,input().split())
  scores=np.zeros((R,C),np.int64)
  for _ in range(K): #各マスにアイテム配置
    r,c,v=map(int,input().split())
    scores[r-1][c-1]=v
  dp=np.zeros((R+1,C+1,4),np.int64) #後のために余分に作っておく、scoresの配列は別なのでindexに注意
  for i in range(1,R+1):
    for j in range(1,C+1):
      for k in range(4):
        dp[i][j][k]=max(dp[i][j-1][k],dp[i-1][j][3]) #同じ行ですでに3つ拾ってから次の行にくるのかただ隣のマスに進むか
      for k in range(3,0,-1):
        dp[i][j][k]=max(dp[i][j][k],dp[i][j][k-1]+scores[i-1][j-1]) #そのマスでアイテムを拾うかどうか
  return dp[R][C][3]
print(main())
N = int(input())
S_list = []
for i in range(N):
  S_list.append(input())
 
sorted(S_list)
name_list = []
vote_list = []
i, j = 0, 0
while i < len(S_list):
  name = S_list[i]
  while j < len(S_list) and S_list[j] == name:
    j += 1
  name_list.append(name)
  vote_list.append(j - i)
  i = j
max_vote = max(vote_list)
for k in range(name_list):
  if vote_list[k] == max_vote:
    print (name_list[k])

### FIXED CODE ###

N = int(input())
S = {}
name_list = []
for i in range(N):
  name = input()
  if name not in S:
    S[name] = 1
    name_list.append(name)
  else:
    S[name] += 1
name_list = sorted(name_list)
max_vote_name = []
max_vote = -float('inf')
for name in name_list:
  if S[name] > max_vote:
    max_vote = S[name]
    max_vote_list = [name]
  elif S[name] == max_vote:
    max_vote_list.append(name)
for name in max_vote_list:
  print (name)
from collections import defaultdict
MOD = 10**9+7
N = int(input())
bul = defaultdict(int)
bul2 = defaultdict(int)
for _ in range(N):
    a,b = map(int,input().split())
    bul[a/b] += 1
    bul2[-(b/a)] += 1

ALL = pow(2,N,MOD)-1

for k in bul.keys():
    if k <= 0:
        ALL -= bul2[k] * bul[k] * (N-1)
        ALL %= MOD

print(ALL)




### FIXED CODE ###

from collections import defaultdict
import math

def main():
    MOD = 10**9+7
    N = int(input())
    zero_cnt = 0
    L = defaultdict(int)
    L2 = defaultdict(int)
    for _ in range(N):
        x,y = map(int,input().split())
        if x == 0 and y == 0:
            zero_cnt += 1
            continue
        d = math.gcd(x,y)
        x //= d
        y //= d
        if x == 0 and y == 0:
            zero_cnt += 1
        if y < 0:
            x *= -1
            y *= -1
        elif ｙ == 0 and ｘ < 0:
            x *= -1
            y *= -1
        rot90 = (x <= 0)
        if rot90:
            tmp = x
            x = y
            y = -tmp
        if rot90:
            L[(x,y)] += 1
        else:
            L2[(x,y)] += 1

    ans = 1
    keys = set(list(L.keys()) + list(L2.keys()))
    for k in keys:
        now = 1
        s = L[k]
        t = L2[k]
        now += pow(2,s,MOD) - 1
        now += pow(2,t,MOD) -1
        ans *= now
        ans %= MOD
    ans -= 1
    ans += zero_cnt
    print(ans%MOD)

main()
n=int(input())
a=list(map(int,input().split()))
g=[[0] for i in range(n)]*60
mod=10**9+7
for i in range(n):
    for j in range(60):
        if (a[i]>>j)&1:
            g[j][i]=1

cnt=0
for i in range(60):
    now=g[i].count(1)
    cnt+=now*(n-now)*(2**i)
    cnt%=mod

print(cnt)

### FIXED CODE ###

n=int(input())
a=list(map(int,input().split()))
g=[0]*60
mod=10**9+7
for i in range(n):
    for j in range(60):
        if (a[i]>>j)&1==1:
            g[j]+=1

cnt=0
for i in range(60):
    now=g[i]
    cnt+=now*(n-now)*(2**i)
    cnt%=mod

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

sum=sum(A)

if N>=sum:
  print('N-sum')
else('-1')


### FIXED CODE ###

n,m=map(int,input().split())
a=list(map(int,input().split()))
x=sum(a)
if n<x:
  print('-1')
else:
  print(n-x)
N = int(input())
A = list(int, input().split())
B = list(int, input().split())
C = list(int, input().split())
happiness = 0
memory = 100
for i in range(N):
  happiness += B[A[i]]
  if memory + 1 == A[i]:
    happiness += C[A[i]]
  memory = A[i]
print(happiness)

### FIXED CODE ###

N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))
happiness = 0
memory = 100
for i in range(N):
  happiness += B[A[i]-1]
  if memory + 1 == A[i]:
    happiness += C[A[i]-2]
  memory = A[i]
print(happiness)
a,b=map(int,input().split());pirnt(a*b-a-b+1)

### FIXED CODE ###

a,b=map(int,input().split());print(a*b-a-b+1)
N = int(input())
# サイズが下の方が大きくないとダメtop<mid<bottom
tops = sorted(list(map(int, input().split(" "))))
mids = sorted(list(map(int, input().split(" "))))
bottoms = sorted(list(map(int, input().split(" "))))


def binary_search(check_list, num, left, right):
    if left > right:
        return left
    mid = (left + right) // 2
    if check_list[mid] > num:
        return binary_search(check_list, num, left, mid - 1)
    elif check_list[mid] == num:
        return mid
    else:
        return binary_search(check_list, num, mid + 1, right)


total_count = 0
for bottom in bottoms:
    mid_insert_index = binary_search(mids, bottom, 0, N - 1)

    for mid in mids[0:mid_insert_index]:
        top_insert_index = binary_search(tops, mid, 0, N - 1)
        total_count += top_insert_index])
print(total_count)


### FIXED CODE ###

import bisect
N = int(input())
# サイズが下の方が大きくないとダメtop<mid<bottom
tops = sorted(list(map(int, input().split(" "))))
mids = list(map(int, input().split(" ")))
bottoms = sorted(list(map(int, input().split(" "))))
# print(tops)
# print(mids)
# print(bottoms)


# def left_binary_search(check_list, num, left, right):
#     if left > right:
#         return left
#     mid = (left + right) // 2
#     if check_list[mid] >= num:
#         return left_binary_search(check_list, num, left, mid - 1)
#     else:
#         return left_binary_search(check_list, num, mid + 1, right)


# def right_binary_search(check_list, num, left, right):
#     if left > right:
#         return left
#     mid = (left + right) // 2
#     if check_list[mid] > num:
#         return right_binary_search(check_list, num, left, mid - 1)
#     else:
#         return right_binary_search(check_list, num, mid + 1, right)


total_count = 0
for mid in mids:
    # bottom_start_index = right_binary_search(bottoms, mid, 0, N - 1)
    bottom_start_index = bisect.bisect_right(bottoms, mid)
    # top_end_index = left_binary_search(tops, mid, 0, N - 1)
    top_end_index = bisect.bisect_left(tops, mid)
    total_count += ((N - bottom_start_index) * top_end_index)
print(total_count)
S,T = map(input().split())
A,B = map(int,input().split())
U = input()

if U==S:
  print (A-1,B);
else:
  print (A,B-1);
  

### FIXED CODE ###

S,T = input().split()
A,B = map(int,input().split())
U = input()
 
if U==S:
  print (A-1,B);
else:
  print (A,B-1);
n = input()
  maxv = -1*10**9
  minv = 10**9

  for j in range(0, n-1):
    num = input()
    if maxv < num - minv:
      maxv = num -minv
    if minv > num:
      minv = num

  print maxv

### FIXED CODE ###

n = int(raw_input())
minv = int(raw_input())
maxv = -1*10**9
  
for j in range(n-1):
  nums = int(raw_input())  
  diff = nums - minv
  if maxv < diff:
    maxv = diff
  if nums < minv:
    minv = nums
  
print maxv
a,b = map(int, input().split())
if b==0 or (a<=0 and b>=0):
    print(0)
elif (a<0 and (0-a)%2==1) or (a<0 and b<0 and (b-a)%2==0):
    print('Negative')
else:
    print('Positive')

### FIXED CODE ###

n = int(input())
p = list(map(int, input().split()))
ans = 0
m = 200001
for i in p:
    if i<m:
        ans+=1
        m=i
print(ans)
import math
x = int(input())
if x==1:
  print(1)
  exit()

used = dictionary()
for b in range(2,int(math.sqrt(x))+1):
  p=2
  while(b**p<=x):
    used[b**p]=True
    p+=1

ans=0
for key,itm in used:
  ans = max(ans,key)

print(ans)
  


### FIXED CODE ###

import math
x = int(input())
if x==1:
  print(1)
  exit()

used = {}
for b in range(2,int(math.sqrt(x))+1):
  p=2
  while(b**p<=x):
    used[b**p]=True
    p+=1

ans=0
for key in used.keys():
  ans = max(ans,key)

print(ans)
N, M = map(int, input().split())
if N <= 2 and M != 0:
    print(N-1)
elif N <= 2:
    print(N)
    
else:
    dp = [0]*N
    dp[0] = 1
    dp[1] = 2
    for i in range(N-2):
        dp[i+2] = dp[i]+dp[i+1]
        
    if M == 0:
        print(dp[N-1])
        
    else:
        a = [int(input()) for _ in range(M)]
    
        for i in range(M-1):
            if a[i+1] == a[i] + 1:
                ans = 0
                break
        else:
            if a[0] == 1:
                ans == 1
            else:
                ans = dp[a[0]-2]
                
        for i in range(M-1):
            if a[i+1]-a[i] >= 3:
                ans *= dp[a[i+1]-a[i]-3]
        if N-a[M-1]-2 >= 0:
            ans *= dp[N-a[M-1]-2] 
        print(ans%1000000007)

### FIXED CODE ###

N, M = map(int, input().split())
a = [int(input()) for _ in range(M)]
dp = [0]*(N+1)
for i in a:
    dp[i] = -1

for i in range(N+1):
    if dp[i] == -1:
        dp[i] = 0
    elif i > 1:
        dp[i] = dp[i-1] + dp[i-2]
    else:
        dp[i] = 1
        
print(dp[N]%1000000007)
N, Q = map(int, input().split())

ARR = []

for i in range(N-1):
    ARR.append(list(map(int, input().split())))

BRR = []

for i in range(Q):
    BRR.append(list(map(int, input().split())))


def prepare(n, q, arr, brr):
    nodePoints = [0 for i in range(n)]
    for i in range(q):
        nodeIndex = brr[i][0] - 1
        nodePoints[nodeIndex] += brr[i][1]

    nodes = [[] for i in range(n)]

    for i in range(n - 1):
        startNode = arr[i][0] - 1
        endNode = arr[i][1] - 1

        nodes[startNode].append(endNode)
        nodes[endNode].append(startNode)

    return nodes, nodePoints


nodes, nodePoints = prepare(N, Q, ARR, BRR)


def dfs(currentNode, nodes, parentNode=-1, parentPoint=0):
    nodePoints[currentNode] = nodePoints[currentNode] + parentPoint
    childNodes = nodes[currentNode]
    for childNode in childNodes:
        if childNode == parentNode:
            continue
        dfs(childNode, nodes, currentNode, nodePoints[currentNode])


dfs(0, nodes)

print(" ".join([str(nodePoints[i]) for i in range(N)]))


### FIXED CODE ###

from sys import setrecursionlimit
setrecursionlimit(100000)
from collections import deque

S = input().split(" ")
N = int(S[0])
Q = int(S[1])

arr = []
prr = []
for i in range(N-1):
    S = input().split(" ")
    ar = [int(S[0]),int(S[1])]
    arr.append(ar)

for i in range(Q):
    S = input().split(" ")
    pr = [int(S[0]), int(S[1])]
    prr.append(pr)



def prepare(n, q, arr, prr):
    links = [[] for _ in range(n)]
    values = [0 for _ in range(n)]
    finalValues = [0 for _ in range(n)]
    for ar in arr:
        start = ar[0] - 1
        end = ar[1] - 1
        links[start].append(end)
        links[end].append(start)

    for pr in prr:
        i = pr[0] - 1
        x = pr[1]
        values[i] += x

    return links, values, finalValues


links, values, finalValues = prepare(N, Q, arr, prr)


def bfs():
    q = deque()

    q.append((0,-1,0))

    while len(q) > 0:
        currentNode,parentNode,parentAccumulate = q.popleft()
        parentAccumulate += values[currentNode]
        finalValues[currentNode] += parentAccumulate
        childNodes = links[currentNode]
        for ch in childNodes:
            if ch == parentNode:
                continue
            q.append((ch,currentNode,finalValues[currentNode]))

bfs()
print(*finalValues)
N,M=map(int,input().split())
  if N==M:
    print("Yes")
  else:
    print("No")


### FIXED CODE ###

N,M=map(int,input().split())
if N==M:
  print("Yes")
else:
  print("No")
n = int(input())
a = list(map(int, input().split()))
a_cur = a[0]

m = 1000
s = 0

for i in range(1, n):
  a_next = a[i]
  if a_cur < a_next:
    # buy current and sell next
    s = m // a_cur
    m += s * (a_next - a_cur)
    a_cur = a_next
if s > 0:
  m += s * a[-1]
print(m)

### FIXED CODE ###

x = int(input())
print(10 - x // 200)
ten = a//10 + b//10 + c//10 + d//10 + e//10

aa = [a%10,b%10,c%10,d%10,e%10]
zero = aa.count(0)

if zero == 5:
	print(ten)
else:
	for i in range(1,10):
		if  i in aa:
			one = i
			break
	print(ten*10 + (4-zero)*10 +one)

### FIXED CODE ###


a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())


ten = a//10 + b//10 + c//10 + d//10 + e//10

aa = [a%10,b%10,c%10,d%10,e%10]
zero = aa.count(0)

if zero == 5:
	print(ten*10)
else:
	for i in range(1,10):
		if  i in aa:
			one = i
			break
	print(ten*10 + (4-zero)*10 +one)
import sys
N=int(input())
a=[int(i) for i in input().split()]
t=0
while True:
  for i in range(N):
    if a[i]%2==0:
      a[i]//=2
      t+=1
    else:
      print(t)
      sys.exit()
      


### FIXED CODE ###

a=input()
print(a.count('1'))
max = 0
i = 0
j = 0
k = 0
n_max = 0

n_max = int(raw_input())
price = [1,2,3,4,5]

for i in range(5)
    if max <= price[5] - price[i]:
        print max

### FIXED CODE ###

import sys

n = int(raw_input())

min_R = int(raw_input())
nums = map(int, sys.stdin.readlines())

ans = -10**9

for num in nums:
    if num - min_R > ans:
        ans = num - min_R
    if num < min_R:
        min_R = num
        
print ans