Harryxun/stf_run huggingface dataset:
#!/usr/bin/env python3
from collections import defaultdict,deque
from heapq import heappush, heappop
from bisect import bisect_left, bisect_right
import sys, random, itertools, math
sys.setrecursionlimit(10**5)
input = sys.stdin.readline
sqrt = math.sqrt
def LI(): return list(map(int, input().split()))
def LF(): return list(map(float, input().split()))
def LI_(): return list(map(lambda x: int(x)-1, input().split()))
def II(): return int(input())
def IF(): return float(input())
def LS(): return list(map(list, input().split()))
def S(): return list(input().rstrip())
def IR(n): return [II() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def FR(n): return [IF() for _ in range(n)]
def LFR(n): return [LI() for _ in range(n)]
def LIR_(n): return [LI_() for _ in range(n)]
def SR(n): return [S() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
mod = 1000000007
inf = float('INF')

#solve
def solve():
    n = II()
    p = LI()
    a = itertools.accumulate(p, min)
    a = [inf] + list(a)
    ans = 0
    for i in range(n):
        ans += a[i] >= p[i]
    print(ans)
    return


#main
if __name__ == '__main__':
    solve()


### FIXED CODE ###

#!/usr/bin/env python3
from collections import defaultdict,deque
from heapq import heappush, heappop
from bisect import bisect_left, bisect_right
import sys, random, itertools, math
sys.setrecursionlimit(10**5)
input = sys.stdin.readline
sqrt = math.sqrt
def LI(): return list(map(int, input().split()))
def LF(): return list(map(float, input().split()))
def LI_(): return list(map(lambda x: int(x)-1, input().split()))
def II(): return int(input())
def IF(): return float(input())
def LS(): return list(map(list, input().split()))
def S(): return list(input().rstrip())
def IR(n): return [II() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def FR(n): return [IF() for _ in range(n)]
def LFR(n): return [LI() for _ in range(n)]
def LIR_(n): return [LI_() for _ in range(n)]
def SR(n): return [S() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
mod = 1000000007
inf = float('INF')

#solve
def solve():
    n = II()
    p = LI()
    a = inf
    ans = 0
    for i in range(n):
        ans += a >= p[i]
        a= min(a, p[i])
    print(ans)
    return


#main
if __name__ == '__main__':
    solve()
import numpy as np
N,K=map(int, input().split())
A =list(map(int,input().split()))
MOD = 10 ** 9 + 7

if N==K:
  ans0 = 1
  for a in A[0:N]:
    ans0 *= a
    ans0 %= MOD
  print(ans0)
  exit()
A=sorted(A)  
if (K%2==1 and A[-1]<0):
  ans1 = 1
  for a in A[N-K:N]:
    ans1 *= a
    ans1 %= MOD
  print(ans1)
  exit()

A=sorted(A, key=lambda x:abs(x), reverse=True)
AA=[np.sign(i) for i in A]

ansA = 1
for a in A[0:K]:
  ansA *= a
  ansA %= MOD
ansAA = AA[0:K].count(-1)%2
if ansA==0 or ansAA==0:
  print(ansA)
  exit()

while ansA>0:
  ansA-=MOD
Bp=[i for i in A[0:K] if i>0]
Bm=[i for i in A[0:K] if i<0]

B=sorted(A[K:N])
if not Bm:ansB1=ansA//Bp[-1]*B[-1]
else:ansB1=ansA//Bp[-1]*B[-1]
if not Bp:ansB2=ansA//Bm[-1]*B[-1]
else:ansB2=ansA//Bm[-1]*B[-1]          
#print(ansA,B,Bp,Bm)

#print(ansB1,ansB2)%MOD
print(max(ansB1,ansB2)%MOD)

### FIXED CODE ###

import numpy as np
N,K=map(int, input().split())
A =list(map(int,input().split()))
MOD = 10 ** 9 + 7
if N==K:
  ans0 = 1
  for a in A[0:N]:
    ans0 *= a
    ans0 %= MOD
  print(ans0)
  exit()
A=sorted(A)  
if (K%2==1 and A[-1]<0):
  ans1 = 1
  for a in A[N-K:N]:
    ans1 *= a
    ans1 %= MOD
  print(ans1)
  exit()
 
A=sorted(A, key=lambda x:abs(x), reverse=True)
AA=[np.sign(i) for i in A]
 
ansA = 1
for a in A[0:K]:
  ansA *= a
  ansA %= MOD
ansAA = AA[0:K].count(-1)%2
if ansA==0 or ansAA==0:
  print(ansA)
  exit()

while ansA>0:
  ansA-=MOD

B1=A[0:K]
C1=A[0:K]
B2=sorted(A[K:N])
Bp=[i for i in A[0:K] if i>0]
Bm=[i for i in A[0:K] if i<0]
 
if B2[0]>0:B2.insert(0,0)
if B2[-1]<0:B2.insert(-1,0)
if not Bp:Bp.insert(0,B1[-1])
if not Bm:Bm.insert(0,B1[0])
  
#print(Bp,Bm,B2)
#print(Bp[-1],B2[0])
B1.remove(Bp[-1])
B1.append(min(B2[0],0))
#print(B1)
ansB = 1
for a in B1[0:K]:
  ansB *= a
  ansB %= MOD
#print(Bm[-1],B2[-1])
C1.remove(Bm[-1])
C1.append(max(B2[-1],0))
 
ansC = 1
for a in C1[0:K]:
  ansC *= a
  ansC %= MOD
#print(B1,C1)
#print(ansB,ansC)
BB1=[np.sign(i) for i in B1]
ansBB1 = BB1[0:K].count(-1)%2
BB2=[np.sign(i) for i in C1]
ansBB2 = BB2[0:K].count(-1)%2
#print(ansBB1,ansBB2)
if ansBB1==1:
  print(ansC)
  exit()
if ansBB2==1:
  print(ansB)
  exit()
#print(B2[0]/Bp[-1],B2[-1]/Bm[-1])
#print(Bp[-1]*B2[-1],Bm[0]*B2[0])

#print(abs(Bp[-1]*B2[-1])-abs(Bm[-1]*B2[0]))
#print(ansB,ansC)
if abs(Bp[-1]*B2[-1])-abs(Bm[-1]*B2[0])>=0:
  print(ansC)
else: print(ansB)
n, k = map(int, input().split())
l = sorted(list(map(int, input().split())))
l = list(reversed(l))

print(sum(:l[k-1]))

### FIXED CODE ###

n, k = map(int, input().split())
l = sorted(list(map(int, input().split())))

print(sum(l[n-k:]))
n, m = map(int, input().split())
sc = [list(map(int, input().split())) for i in range(m)]
sc = list(map(list, set(map(tuple, sc))))

l = list()
for i in range(1000):
    i = str(i).zfill(3)
    flg = True
    for j in sc:
        if int(i[j[0]-1]) != j[1]:
            flg = False
    if flg:
        l.append(int(i))

print(min(l))

### FIXED CODE ###

n, m = map(int, input().split())
sc = [list(map(int, input().split())) for i in range(m)]
sc = list(map(list, set(map(tuple, sc))))

ans = [-1] * n
for i in sc:
    if i[0] == 1 and i[1] == 0 and n == 1:
        print(0)
        exit()
    if i[0] == 1 and i[1] == 0:
        print(-1)
        exit()
    if i[0] > n or ans[i[0]-1] != -1:
        print(-1)
        exit()
    ans[i[0]-1] = i[1]

for i, val in enumerate(ans):
    if val == -1:
        ans[i] = 0

if (m == 0 and n != 1) or (ans[0] == 0 and n != 1):
    ans[0] = 1

flg = False
for i in ans:
    if i != 0:
        flg = True
if not flg:
    print(0)
    exit()

ans = map(lambda x: str(x), ans)
print("".join(ans))
# -*- coding: utf-8 -*-

def dfs(graph, color, visit, idx):
    visit[idx] = True
    for i, w in graph[idx]:
        if visit[i] is True:
            continue
        if w%2 == 0:    # 同色で塗る
            color[i] = color[idx]
            dfs(graph, color, visit, i)
        else:   # 異色で塗る
            color[i] = 1 - color[idx]   # 1-cで異色になる
            dfs(graph, color, visit, i)


N = int(input())
L = N-1
graph = [[] for _ in range(N)]
color = [-1 for _ in range(N)]
visit = [False for _ in range(N)]

for i in range(L):
    u,v,w = map(int, input().split())
    u-=1
    v-=1
    graph[u].append((v,w))
    graph[v].append((u,w))

color[0] = 0    # 添え字0をcolor0と置く
dfs(graph, color, visit, 0)

for c in color:
    print(c)


### FIXED CODE ###

# -*- coding: utf-8 -*-

from collections import deque

N = int(input())
L = N-1
graph = [[] for _ in range(N)]
color = [-1 for _ in range(N)]
visit = [False for _ in range(N)]

for i in range(L):
    u,v,w = map(int, input().split())
    u-=1
    v-=1
    graph[u].append((v,w))
    graph[v].append((u,w))

que = deque([0])    # 添え字0からアクセス開始
color[0] = 0    # 添え字0をcolor0と置く
while len(que) > 0:
    idx = que.popleft()
    visit[idx] = True
    for i, w in graph[idx]:
        if visit[i] is True:
            continue
        if w%2 == 0:    # 同色で塗る
            color[i] = color[idx]
            que.append(i)
        else:   # 異色で塗る
            color[i] = 1 - color[idx]   # 1-cで異色になる
            que.append(i)

for c in color:
    print(c)
N = int(input())
A = list(map(str, input().split()))

for i in range(1,1+N):
    print(A.count(str(i)))

### FIXED CODE ###

N = int(input())
A = list(map(int, input().split()))
D = [0 for i in range(N)]

for i in A:
    D[i-1] += 1

for i in range(len(D)):
    print(D[i])
S = list(map(int,input().split()))
N = S[0]
K = S[1]
X = list(map(int,input().split()))

Xnegative = [abs(x) for x in X if x < 0]
Xpositive = [x for x in X if x >= 0]
Xnegative = sorted(Xnegative)

i = 0

if len(Xpositive) >= K:
    sub = Xpositive[K-1]
    while i < len(Xnegative) and K-i-2 >= 0:
        distance = min(Xnegative[i],Xpositive[K-2-i]) + Xnegative[i] + Xpositive[K-2-i]
        if sub > distance:
            sub = distance
        i = i + 1
elif len(Xpositive) == 0:
    sub = Xnegative[K-1]
else:
    l = K-len(Xpositive)
    sub = min(Xnegative[l-1],Xpositive[-1]) + Xnegative[l-1] + Xpositive[-1]
    while i + l < len(Xnegative) and i < len(Xpositive):
        distance = max(Xnegative[i+l],Xpositive[-i-2]) + Xnegative[i+l] + Xpositive[-i-2]
        if sub > distance:
            sub = distance
        i = i + 1

print(sub)

### FIXED CODE ###

S = list(map(int,input().split()))
N = S[0]
K = S[1]
X = list(map(int,input().split()))

Xnegative = [abs(x) for x in X if x < 0]
Xpositive = [x for x in X if x >= 0]
Xnegative = sorted(Xnegative)

i = 0

if len(Xpositive) >= K:
    sub = Xpositive[K-1]
    while i < len(Xnegative) and K-i-2 >= 0:
        distance = min(Xnegative[i],Xpositive[K-2-i]) + Xnegative[i] + Xpositive[K-2-i]
        if sub > distance:
            sub = distance
        i = i + 1
elif len(Xpositive) == 0:
    sub = Xnegative[K-1]
else:
    l = K-len(Xpositive)
    sub = min(Xnegative[l-1],Xpositive[-1]) + Xnegative[l-1] + Xpositive[-1]
    while i + l < len(Xnegative) and -i-2 >= -len(Xpositive):
        distance = min(Xnegative[i+l],Xpositive[-i-2]) + Xnegative[i+l] + Xpositive[-i-2]
        if sub > distance:
            sub = distance
        i = i + 1

print(sub)
def c(ints):
    
    for i in range(len(ints)):
        if ints[i] != 0:
            sig = 1 if ints[i] > 0 else -1
            total = ints[i]
            mov = i + 1
            j = i
            break
        if i == len(ints) - 1:
            return i + 1
    
    for i_ in ints[j+1:]:
        tmp = total + i_
        if tmp == 0:
            mov +=1
            tmp = -sig
            
        elif sig * tmp > 0:
            mov += abs(tmp) + 1
            tmp = -sig
            
        sig *= -1
        total = tmp
        
    return mov

_ = input()
inp = input()
inp = inp.split(' ')
inp = [int(i_) for i_ in inp]
print(c(inp))

### FIXED CODE ###

def a(inp):
    sts = inp.split(' ')
    ans = [s[0].upper() for s in sts]
    print(''.join(ans))

a(input())
s = input()
if s = 'ABC':
	print('ARC)
else:
	print('ARC')

### FIXED CODE ###

s = input()
if s == 'ABC':
	print('ARC')
else:
	print('ABC')
import numpy as np
N,M,C = map(int,input().split())
B = [int,input().split()]
for i in range(1,N)
    Ai = [int(j) for j in input().split()]
    ai = np.array(Ai)   
b = np.array(B)
bt = b.reshape([N,1])
cnt = 0
for i in range(1,N)
    if (np.dot(ai,bt) + C >0)
         cnt += 1
print(cnt)




### FIXED CODE ###

import numpy as np
N,M,C = map(int,input().split())
B = [int(k) for k in input().split()]
A = [[int(j) for j in input().split()] for i in range(N)] 
b = np.array(B)
cnt = 0
for i in range(N):
    if (np.dot(np.array(A[i]),b) + C >0):
        cnt += 1
    else:
        cnt = cnt
        
print(cnt)
[N, A, B]= list(map(int, input().split()))

ans = 0
ball = []

for i in range(N // (A + B)) :
    ball += list('b' * A + 'r' * B)

mod = N % (A + B)
if mod <= A :
    ball += list('b' * mod)
elif A < mod:
    ball += list('b' * A + 'r' * (mod - A))

#print(ball)
ans = ball.count('b')
print(ans)

### FIXED CODE ###

N, A, B= map(int, input().split())
ans = 0

div = N//(A+B) * A
mod = N % (A+B)
ans = div + min(mod, A)

print(ans)
N,M = map(int, input().split())
L = []
 
for i in range(1,(M**0.5)+1):
    if M % i == 0:
        L.append(i)
        L.append(int(M / i))
L1 = [i for i in L if M / i >= N]
print(max(L1))

### FIXED CODE ###

N,M = map(int, input().split())
L = []
 
for i in range(1,int(M**0.5)+1):
    if M % i == 0:
        L.append(i)
        L.append(int(M / i))
L1 = [i for i in L if M / i >= N]
print(max(L1))
import math

def lcm(x, y):
    return (x * y) // math.gcd(x, y)

A, B, C, D = map(int, input().split())

lcm_CD = lcm(C, D)
count = (B // C - (A-1) // C) + (B // D - (A-1) // D) - (B // lcm_CD - (A-1) // lcm_CD)
    
print((B - A + 1) - count)

### FIXED CODE ###

import fractions

def lcm(x, y):
    return (x * y) // fractions.gcd(x, y)

A, B, C, D = map(int, input().split())

lcm_CD = lcm(C, D)
count = (B // C - (A-1) // C) + (B // D - (A-1) // D) - (B // lcm_CD - (A-1) // lcm_CD)
    
print((B - A + 1) - count)
x, n = map(int,input().split())
p = [int(s) for s in input().split()]
k= 100

for r in range (1,101):
    if (r not in p):
        if (abs(x - int(r)) < k):
            A = int(r)
            k = abs(x - int(r))
if (A > x):
    if (2*x-A not in p):
        A = 2*x-A

print (A)





### FIXED CODE ###

x, n = map(int,input().split())
p = [int(s) for s in input().split()]
k= 100

for r in range (0,102):
    if (r not in p):
        if (abs(x - int(r)) < k):
            A = int(r)
            k = abs(x - int(r))
if (A > x):
    if (2*x-A not in p):
        A = 2*x-A

print (A)
def mod3(n):
    b= n
    sho = []
    while b >= 1:
        a = int(b % 3)
        b = int((b - a)/3)
        sho.append(a)
    return sho

def cal_dis(ss,tt):
    s,t = mod3(ss),mod3(tt)
    c = 0
    if len(s) == len(t):
        n = len(s)
        k = 0
        b = 0
        flg =0
        for i in range(n):
            if s[i] == 1 and t[i] == 1:
                k = i+1
                b =2
                flg =1
                if i > 0:
                    c = int(3**(k-1)/2) +1
                    amari = ss % (3^k-1)
                    amari2 = tt%(3^k-1)
                    if amari > (3^k-1)/2:
                        amari = (3^k-1) -amari
                    if amari2 > (3^k-1)/2:
                        amari2 = (3^k-1) -amari2
                    b = amari+2 +amari2 
        if flg == 0:
            a = ss - tt if ss > tt else tt-ss
            return a
        else:
            return b

    else:
        return ss - tt if ss > tt else tt-ss

N = int(input())
dic ={}
for i in range(N):
    dic[i] = [int(a) for a in input().split(' ')]

for i in range(N):
    s = [dic[i][0]-1,dic[i][1]-1]
    t = [dic[i][2]-1,dic[i][3]-1]

    print(cal_dis(s[0],t[0]) + cal_dis(s[1], t[1]))

### FIXED CODE ###

def solve(A,B,C,D, level):
    E = 3**level
    if level == -1:
        return int(abs(A-C) + abs(B-D))
    a,b,c,d = A//E, B//E, C//E, D//E
    if a != c and b != d:
        return int(abs(A-C) + abs(B-D))

    if a == c and b==d:
        return solve(A,B,C,D,level-1)

    if a != c and b==d:
        A,B,C,D = B,A,D,C
        a,b,c,d = b,a,d,c

    if b != d and a == c:
        if a%3 != 1:
            return solve(A,B,C,D,level-1)
        if abs(b-d) == 1:
            return solve(A,B,C,D,level-1)

        if B > D:
            A, B, C, D = C, D, A, B
            a, b, c, d = c, d, a, b

        x = E * a -1
        y1 = E * (b+1) -1
        y2 = E * d
        d = abs(x-A) + abs(y1-B) + abs(y1-y2) + abs(x-C) + abs(y2-D)
        x = E *(a+1)
        d2 = abs(x-A) + abs(y1-B) + abs(y1-y2) + abs(x-C) + abs(y2-D)
        return min(d,d2)

N = int(input())

for i in range(N):
    sg = [int(j.strip())  for j in input().split(' ')]
    s,g = [sg[0]-1,sg[1]-1],[sg[2]-1,sg[3]-1]
    A,B,C,D = s[0],s[1],g[0],g[1]
    print(solve(A,B,C,D,30))
N=int(input())
A=list(map(int,input().split()))
B=[0]*N
B[0]=3

c=1
for a in A:
    c*=B[a]
    c%=1000000007
    B[a]-=1
    B[a+1]+=1

print(c)





### FIXED CODE ###

N=int(input())
A=list(map(int,input().split()))
B=[0]*(N+1)
B[0]=3

c=1
for a in A:
    c*=B[a]
    c%=1000000007
    B[a]-=1
    B[a+1]+=1

print(c)
N=int(input())
a = list(map(int, input().split()))
dic={}
mul = [3,2,1]
res = 1
for i in range(len(a)):
    if a[i] in dic:
        dic[a[i]] += 1
    else:
        dic[a[i]] = 0
    if a[i] == 0:
        res *= mul[dic[0]]
    else:
        if a[i]-1 not in dic:
            print(0)
            exit()
        res *= dic[a[i]-1] - dic[a[i]] + 1
    res = res%(10**9+7)
print(res)


### FIXED CODE ###

N=int(input())
a = list(map(int, input().split()))
dic={}
mul = [3,2,1]
res = 1
for i in range(len(a)):
    if a[i] in dic:
        if dic[a[i]] == 2:
            print(0)
            exit()
        dic[a[i]] += 1
    else:
        dic[a[i]] = 0
    if a[i] == 0:
        if dic[0] >= 3:
            print(0)
            exit()
        res *= mul[dic[0]]
    else:
        if a[i]-1 not in dic:
            print(0)
            exit()
        res *= dic[a[i]-1] - dic[a[i]] + 1
    res = res%(10**9+7)
print(res)
# -*- coding:utf-8 -*-
#Write a program which computes the digit number of sum of two integers a and b.
import sys
import math

array =[]
for line in sys.stdin:
    try:
        array.append(line)
    except EOFError:
        break
    
for i in range(array):
    num = array[i].sprit(' ')
    a = num[0]
    b = num[1]
    n = a + b
    print(int(math.log10(x) + 1))

### FIXED CODE ###

# -*- coding:utf-8 -*-
import sys
import math

array =[]
for line in sys.stdin:
    array.append(line)
    
for i in range(len(array)):
    num = array[i].split(' ')
    a = int(num[0])
    b = int(num[1])
    n = a + b
    print(int(math.log10(n) + 1))
N = int(input())
K = int(input())

count = 0
i = 1
while i <= N:
  s = str(i)
  if K == len(s) - s.count("0"):
    count = count + 1
  i = i + 1

print(count)

### FIXED CODE ###

tmp = input().split()
S = tmp[0]
T = tmp[1]
i = list(map(int, input().split()))
A = i[0]
B = i[1]
U = input()

if S == U:
  print(str(A-1) + " " + str(B))
else:
  print(str(A) + " " + str(B-1))
import sys
from decimal import Decimal
input = sys.stdin.readline


def divide(n):
    c1, c2 = 0, 0
    while (n%2 == 0):
        c1 += 1
        n //= 2
    while (n%5 == 0):
        c2 += 1
        n //= 5
    c1, c2 = min(18, c1), min(18, c2)
    return (c1, c2)
    

def main():
    n = int(input())
    a = [divide(int(Decimal(float(input()))*1e9)) for _ in range(n)]

    dp = [[0]*20 for _ in range(20)]
    for i in range(n):
        c1, c2 = a[i]
        dp[c1][c2] += 1
    
    for i in range(18, -1, -1):
        for j in range(18, -1, -1):
            dp[i][j] += dp[i+1][j]+dp[i][j+1]-dp[i+1][j+1]

    ans = 0
    for i in range(n):
        c1, c2 = a[i]
        if (c1 >= 9 and c2 >= 9):
            ans -= 1
        ans += dp[18-c1][18-c2]
        
    print(ans//2)
    

if __name__ == "__main__":
    main()


### FIXED CODE ###

def divide(n, p):
    c = 0
    while n%p == 0 and c < 18:
        c += 1
        n //= p
    return c

n = int(input())
table = [[0]*19 for _ in range(19)]
for i in range(n):
    sub = input()
    key = float(sub)
    if "." in sub:
        a, b = map(str, sub.split("."))
        s = int(a)*1000000000+10**(9-len(b))*int(b)
    else:
        s = int(sub)
        s *= 1000000000
    if key != s/1000000000:
        while True:
            pass
    c2, c5 = divide(s, 2), divide(s, 5)
    table[c2][c5] += 1

ans = 0
for i in range(19):
    for j in range(19):
        for k in range(19):
            for l in range(19):
                if i+k < 18 or j+l < 18:
                    continue;
                if i == k and j == l:
                    ans += table[i][j]*(table[k][l]-1)
                else:
                    ans += table[i][j]*table[k][l]

ans //= 2
print(ans)
N,M=map(int,input().split())
Xs=input().split()

Xs=[int(Xs[i]) for i in range(M)]

Xs.sort()
costs=[]

for i in range(M-1):
    costs.append(abs(Xs[i]-Xs[i+1]))





for i in range(N-1):
    costs.remove(max(costs))

if not costs:
    print(0)
    exit(0)

print(sum(costs))

### FIXED CODE ###

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


Xs.sort()
costs=[abs(Xs[i]-Xs[i+1]) for i in range(M-1)]
costs.sort(reverse=True)

for i in range(N-1):
    if not costs:
        print(0)
        exit(0)
    costs.pop(0)




print(sum(costs))
import sys
sys.setrecursionlimit(400000)
N, Q = map(int, input().split())
paths = [list() for _ in range(N+1)] # paths[i] : 頂点iと繋がってる点を全て表す
for _ in range(N-1):
    a, b = map(int, input().split())
    paths[a].append(b)
    paths[b].append(a)
# ab = [list(map(int, input().split())) for _ in range(N-1)]
px = [list(map(int, input().split())) for _ in range(Q)]

ans = [0]*(N+1) # ans[i] : 頂点iについて答える値を格納

counters = [0]*(N+1) # そのノードの部分木に与える点数の総和を格納
for x in px:
    counters[x[0]] += x[1]

# visit = [0]*(N+1) #dfsをする時に一度訪れた点に再訪しないための確認
def dfs(node, score, ans):
    # visit[node] = 1 # 訪問したことを記録
    score += counters[node] # 自分の部分木に加点する分を加えて後世に残す
    ans[node] = score # 点数の記録
    for loof in paths[node]: # 自分と繋がってる各ノードについて
        # if visit[loof] == 0: # まだ探索していなければ
            dfs(loof, score, ans) # 探索

dfs(1, 0, ans)
    

# for i in range(1, N+1):
#     print(ans[i])
# print('\n'.join(map(str, ans[1:])))

# for i in range(1, N+1):
#     print(ans[i], end = " ")
# print()
print(" ".join(map(str, ans[1:])))

### FIXED CODE ###

import sys
sys.setrecursionlimit(400000)
N, Q = map(int, input().split())
paths = [list() for _ in range(N+1)] # paths[i] : 頂点iと繋がってる点を全て表す
for _ in range(N-1):
    a, b = map(int, input().split())
    paths[a].append(b)
    paths[b].append(a)
# ab = [list(map(int, input().split())) for _ in range(N-1)]
px = [list(map(int, input().split())) for _ in range(Q)]

ans = [0]*(N+1) # ans[i] : 頂点iについて答える値を格納

counters = [0]*(N+1) # そのノードの部分木に与える点数の総和を格納
for x in px:
    counters[x[0]] += x[1]

visit = [0]*(N+1) #dfsをする時に一度訪れた点に再訪しないための確認
def dfs(node, score, ans):
    visit[node] = 1 # 訪問したことを記録
    score += counters[node] # 自分の部分木に加点する分を加えて後世に残す
    ans[node] = score # 点数の記録
    for loof in paths[node]: # 自分と繋がってる各ノードについて
        if visit[loof] == 0: # まだ探索していなければ
            dfs(loof, score, ans) # 探索

dfs(1, 0, ans)
    

for i in range(1, N+1):
    print(ans[i])
a = int(input())

print(input() if a => 3200, else 'red')

### FIXED CODE ###

a = int(input())
s = input()

print(s if a >= 3200 else 'red')
l=list(input().split())
A=int(l[0])
B=int(l[1])
c=0
for i in range(1,100001):
	if int(i*0.08)==A and int(i**0.1)==B:
  		print(i)
        c=1
        break
if c==1:
	print(-1)



### FIXED CODE ###

l=list(input().split())
A=int(l[0])
B=int(l[1])
c=0
for i in range(1,100001):
  if int(i*0.08)==A and int(i*0.1)==B:
    print(i)
    c=1
    break
if c==0:
	print(-1)
r = int(input())
pi = 3.14159265
print("{:.6f} {:.6f}".format(pi * r * r, 2 * pi * r))

### FIXED CODE ###

import math
r = float(input())
print("{:.6f} {:.6f}".format(math.pi * r *r, 2 * math.pi * r))