Harryxun/stf_run huggingface dataset:
import copy
import heapq
H, W = map(int, input().split())
S = []
cnt_list = []
min_cnt = 10**100
for _ in range(H):
    S.append(list(input()))

def move(i,j,cnt,frag):
    global min_cnt
    if cnt > min_cnt:
        return
    c_cnt = copy.deepcopy(cnt)
    c_frag = copy.deepcopy(frag)
    if frag != S[i][j]:
        c_cnt = cnt + 1
    c_frag = S[i][j]
    if i != H-1:
        move(i+1,j,c_cnt,c_frag)
    if j != W-1:
        move(i,j+1,c_cnt,c_frag)
    if i == H-1 and j == W-1:
        if c_cnt < min_cnt:
            min_cnt = c_cnt


if S[0][0] == '#' and S[H][W] == '#':
    a = 1
else :
    a = 0

move(0,0,0,S[0][0])

print(min_cnt//2 + a)

### FIXED CODE ###

import copy
import heapq
H, W = map(int, input().split())
S = [['.'] * (W+1)]
for _ in range(H):
    s = list(input())
    s.insert(0,'.')
    S.append(s)

inf = float('inf')

dp = []
for _ in range(H+1):
    dp.append([inf] * (W+1))

if S[1][1] == '.':
    dp[1][1] = 0
else:
    dp[1][1] = 1

for i in range(1,H+1):
    for j in range(1,W+1):
        right = dp[i][j-1]
        down = dp[i-1][j]
        if S[i][j] == '#':
            if S[i-1][j] == '.':
                down += 1
            if S[i][j-1] == '.':
                right += 1

        dp[i][j] = min(dp[i][j],right,down)

print(dp[H][W])
def main():
    import sys
    input = sys.stdin.readline
    n,m = map(int,input().split())
    a=[]
    for i in range(m):
        a.append(int(input()) )
    mod=10**9 + 7
    

    def cmb(n, r):
        if n - r < r: r = n - r
        if r == 0: return 1
        if r == 1: return n
        numerator = [n - r + k + 1 for k in range(r)]
        denominator = [k + 1 for k in range(r)]
        for p in range(2,r+1):
            pivot = denominator[p - 1]
            if pivot > 1:
                offset = (n - r) % p
                for k in range(p-1,r,p):
                    numerator[k - offset] /= pivot
                    denominator[k] /= pivot
        result = 1
        for k in range(r):
            if numerator[k] > 1:
                result *= int(numerator[k])
        return result

    
    c=0
    for i in range(m-1):
        if a[i]==a[i+1]-1: c+=1
    if c!=0:
        print(0)
    elif m==0:
         print( sum( cmb(n-i,i)%mod for i in range(n//2+1) )%mod )
        
        
    else:
        b=[a[0]-1] + [a[j+1]-a[j]-2 for j in range(m-1)] + [n-a[-1]-1]
        cc=[ sum( nCrMOD(bb-i,i,mod) for i in range(bb//2+1) )%mod for bb in b ]
    
        ans=1
        for ccc in cc:
            ans = ans*ccc%mod
        print(ans)
if __name__ == '__main__':
    main()

### FIXED CODE ###

#c dp version
n,m = map(int,input().split())
a=[]
for i in range(m):
    a.append(int(input()) )
from collections import deque
a=deque(a)
mod=10**9 + 7

dp=[0]*(n+2)
dp[0]=0
dp[1]=1
aa=0
if len(a)>0:
    aa=a.popleft()
for i in range(2,n+2):
    if i-1 == aa:
        dp[i]=0
        if len(a)>0:
            aa=a.popleft()
    else:
        dp[i]=( dp[i-1]+dp[i-2] )%mod
print(dp[-1])
import math
from decimal import *

a,b,c=map(Decimal,input().split())

A=math.sqrt(a)
B=math.sqrt(b)
C=math.sqrt(c)


if   A+B<C:
    print("Yes")
else :
    print("No")



### FIXED CODE ###

N=int(input())

list = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]

print(list[N-1])
N=int(input())
v=sorted(map(int,input().split()))
value=v[0]
for i in range(len(N)):
    value=(value+v[i])/2
print(value)

### FIXED CODE ###

N=int(input())
v=sorted(map(int,input().split()))
value=v[0]
for i in range(N):
    value=(value+v[i])/2
print(value)
n,*p,=map(int,open(0).read().split())
p=sorted(p)
print(p(max)//2)


### FIXED CODE ###

n=int(input())
p=sorted([int(input()) for i in range(n)])
print(int(max(p)//2+sum(p[:-1])))
a, b, c = input().split()
count = 0
if a == '1':
  count = count + 1
if b == '1':
  count = count + 1
if c == '1':
  count = count + 1
print(count)

### FIXED CODE ###

str_list = input()
count = 0
if str_list[0] == '1':
  count = count + 1
if str_list[1] == '1':
  count = count + 1
if str_list[2] == '1':
  count = count + 1
print(count)
ri = lambda S: [int(v) for v in S.split()]
def rii(): return ri(input())

H, A = rii()

print((H // A)

### FIXED CODE ###

ri = lambda S: [int(v) for v in S.split()]
def rii(): return ri(input())

H, A = rii()

print((H + A - 1) // A)
n = int(input())
a = list(map(int , input().split()))
count = 0 if 1 in a else -1
i = 1
ind = 0
while i in a:
  ind = a[ind + 1:].index(i)
  count += ind
  i += 1
print(count)

### FIXED CODE ###

n = int(input())
a = list(map(int , input().split()))
# count = 0 if 1 in a else -1
# i = 1
# while i in a:
#   ind = a.index(i)
#   count += ind
#   a = a[ind + 1:]
#   i += 1
# print(count)

ans = []
i = 1
for j in range(n):
  if i == a[j]:
    i += 1
    ans.append(i)

print(n - len(ans) if 1 in a else -1)
n=int(input())
h=list(map(int,input().split()))

d=[0]*(n-1)
k=0
for i in range(n-1):
  if h[i]-h[i+1]>=0:
    d[k]+=1
  else:
    k+=1
print(max(d))

### FIXED CODE ###

n=int(input())
h=list(map(int,input().split()))

d=[0]*(n-1)
k=0
if n==1:
  print(0)
  exit()
for i in range(n-1):
  if h[i]-h[i+1]>=0:
    d[k]+=1
  else:
    k+=1
print(max(d))
n,t=map(int, input().split())
x=[]
y=[]
m=[]
for i in range(n):
    a,b=map(int, input().split())
    x.append(a)
    y.append(b)
    m.append([a,b])
x.sort()
y.sort()
for i in range(n-1):
    for j in range(i,n):
        if i>=j:continue
        for k in range(n-1):
            for l in range(k,n):
                if k>=l:continue
                count=0
                for a,b in m:
                    if x[i]<=a<=x[j] and y[k]<=b<=y[l]:
                        count+=1
                if count>=t:
                    ans=min(ans,(x[j]-x[i])*(y[l]-y[k]))
print(ans)

### FIXED CODE ###

n,t=map(int, input().split())
x=[]
y=[]
m=[]
for i in range(n):
    a,b=map(int, input().split())
    x.append(a)
    y.append(b)
    m.append([a,b])
x.sort()
y.sort()
ans=float('inf')
for i in range(n-1):
    for j in range(i,n):
        if i>=j:continue
        for k in range(n-1):
            for l in range(k,n):
                if k>=l:continue
                count=0
                for a,b in m:
                    if x[i]<=a<=x[j] and y[k]<=b<=y[l]:
                        count+=1
                if count>=t:
                    ans=min(ans,(x[j]-x[i])*(y[l]-y[k]))
print(ans)
for i in range(1,100):
    a=int(raw_input("Enter the height a in meters="))
    b=int(raw_input("Enter the height b in meters="))
    c=int(raw_input("Enter the height c in meters="))
    if b-a==c-b:
        print 'Yes'
        print'Since'+str(b)+ '-' +str(a)+ '=' +str(c)+ '-' +str(b)+ ',this arrangement of poles is beautiful.'
    elif c-b==b-a:
        print 'Yes'
        print'Since'+str(c)+ '-' +str(b)+ '=' +str(b)+ '-' +str(a)+ ',this arrangement of poles is beautiful.'
    else:
        print 'NO'
        print'Since'+str(b)+ '-' +str(a)+ '≠' +str(c)+ '-' +str(b)+ ',this arrangement of poles is not beautiful.'

### FIXED CODE ###

a,b,c=map(int,input().split())
if b-a == c-b:
    print("YES")
else:
    print("NO")
a, b = map(int, input().split())
c, d = map(int, input().split())
[print("0") if (a*b)=(c*d) else print(c*d)]

### FIXED CODE ###

a, b = map(int, input().split())
c, d = map(int, input().split())
print((a-c)*(b-d))
array1 = [int(input()) for i in range(5)]
array2 = [i for i in array1 if i % 10 == 0]
array3 = [i for i in array1 if i % 10 =! 0]
array4 = [i % 10 for i in array3]
idx = array4.index(min(array4))
sum1 = 0
sum2 = sum(array2)
for k, i in enumerate(array3):
  if (k == idx):
    sum1 += i
  else:
    sum1 += i + (10 - i % 10)
print(sum1 + sum2)

### FIXED CODE ###

array1 = [int(input()) for i in range(5)]
array2 = [i for i in array1 if i % 10 == 0]
array3 = [i for i in array1 if i % 10 != 0]
array4 = [i % 10 for i in array3]
sum1 = 0
sum2 = sum(array2)
if (len(array3) != 0):
  idx = array4.index(min(array4))
  for k, i in enumerate(array3):
    if (k == idx):
      sum1 += i
    else:
      sum1 += i + (10 - i % 10)
print(sum1 + sum2)
x,y,r = map(int,input().split())

AREA = x*y

AREA2 =(AREA/2) 


print(AREA2)


### FIXED CODE ###

T, X = map(int, input().split())
print(T / X)
import bisect
N,M = map(int,input().split())
A = sorted(list(map(int,input().split())))
BC = [list(map(int,input().split())) for _ in range(M)]
BC = sorted(BC, key=lambda x:x[1], reverse=True)
D = []
for b,c in BC:
    D += [c]*b
# print(D)

for i in range(N):
    if A[i] < D[i]:
        A[i] = D[i]
    else:
        break
# print(sorted(A))
print(sum(A))

### FIXED CODE ###

N,M = map(int,input().split())
A = sorted(list(map(int,input().split())))
BC = [list(map(int,input().split())) for _ in range(M)]
BC = sorted(BC, key=lambda x:x[1], reverse=True)
D = [0] * N
idx = 0
for b,c in BC:
    for i in range(b):
        D[idx] = c
        idx += 1
        if idx >= N:
            break
    if idx >= N:
        break
# print(D)


# print(D)
# print(sorted(A))
# print(len(D), len(A))
for i in range(N):
    if A[i] < D[i]:
        A[i] = D[i]
    else:
        break
print(sum(A))
from collections import defaultdict

N = int(input())
d = defaultdict(int)

for n in range(N):
    n = str(n)

    a = n[0]
    b = n[-1]

    d[(a, b)] += 1


s = 0
for i in range(1, 10):
    for j in range(10):

        s += d[(str(j), str(i))] * d[(str(i), str(j))]

print(s)



### FIXED CODE ###

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

if N == M:
    print('Yes')
else:
    print('No')
import sympy
N = int(input())
div_arr = sympy.divisors(N)

if len(div_arr) == 1:
    print(1)
if len(div_arr) == 2:
    ans_num = max(div_arr)
    print(len(str(ans_num)))
else:
    memo = []
    if len(div_arr) % 2 == 0:
        last_idx = -1
        count = 0
        for i in range(len(div_arr)):
            print(div_arr)
            print(div_arr[i] * div_arr[last_idx])
            count += 1
            if N == div_arr[i] * div_arr[last_idx] and count != len(div_arr) // 2:
                last_idx -= 1
                memo.append(len(str(div_arr[last_idx])))
            else:
                break
    else:
        print(div_arr)
        target_index = len(div_arr) // 2
        memo.append(len(str(div_arr[target_index])))
    print(min(memo))

### FIXED CODE ###

N = int(input())
def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    divisors.sort()
    return divisors
div_arr = make_divisors(N)

if len(div_arr) == 1:
    print(1)
elif len(div_arr) == 2:
    ans_num = max(div_arr)
    print(len(str(ans_num)))
else:
    memo = []
    if len(div_arr) % 2 == 0:
        last_idx = -1
        count = 0
        for i in range(len(div_arr)):
            count += 1
            if N == div_arr[i] * div_arr[last_idx] and count != len(div_arr) // 2:
                last_idx -= 1
                memo.append(len(str(div_arr[last_idx])))
            else:
                break
    else:
        target_index = len(div_arr) // 2
        memo.append(len(str(div_arr[target_index])))
    print(min(memo))
import numpy as np
n, W = map(int, input().split())
dp = np.zeros((n,W+1), dtype='int64')

for i in range(n):
    w, v = map(int , input().split())

    # print("left", dp[i, :w])
    # print("right", dp[i-1, :w])
    dp[i, :w] = dp[i-1, :w]
    dp[i, w:] = np.fmax(dp[i-1, w:], dp[i-1,:W-w+1]+v)

    print(dp[i])
# print(dp[n-1][W])


### FIXED CODE ###

N, W = map(int, input().split())
dp = [-1]*(W+1)
dp[0] = 0
for _ in range(N):
    w, v = map(int, input().split())
    for i in range(W-w, -1, -1):
        if dp[i] == -1:
            continue
        if dp[i+w] < dp[i] + v:
            dp[i+w] = dp[i] + v
print(max(dp))
from collections import Counter
n = int(input())
s = list(input())
ans1 = dict(Counter(s))
for i in range(n-1):
    ans = {}
    s = list(input())
    ans2 = dict(Counter(s))
    for j in ans2:
        if j in ans1:
            ans[j] = min(ans1[j],ans2[j])
st = []
sorted(ans)
for i,j in zip(ans,ans.values()):
    st.append(i*j)
print(''.join(st))

### FIXED CODE ###

from collections import Counter
n = int(input())
s = [dict(Counter(list(input()))) for _ in range(n)]
st = []
kouho = s[0]
moji = sorted(kouho)
for i in moji: #１つめの辞書から１つ１つ取り出す
    mn = kouho[i]
    for j in s: #すべての辞書において確認
        if i in j: #もし辞書に入っているのであれば取る値の小さいほうをmnに格納
            mn = min(mn,j[i])
        else:
            mn = 0
    st.append(i*mn)

print(''.join(st))
memo = {}

def fib_memo(n):
  if n <= 1:
    return 1
  if n in memo: # 動的計画法とも
    return memo[n]
  memo[n] = fib_memo(n - 1) + fib_memo(n - 2)
  return memo[n]

x = int(raw_input())

print fib_memo(x)

### FIXED CODE ###

memo = {}

def fib_memo(n):
  if n <= 1:
    return 1
  if n in memo:
    return memo[n]
  memo[n] = fib_memo(n - 1) + fib_memo(n - 2)
  return memo[n]

x = int(raw_input())

print fib_memo(x)
import numpy as np
import sys
import math

N , M = map(int,input().split())
miti = [ [] for _ in range(M)]  
for m in range(M):
    a , b = map(int , input().split())
    if b-1 != 0:
        miti[a-1].append(b-1)
    if a-1 != 0:
        miti[b-1].append(a-1)
visit = [0] * N
point = [ -1 for _ in range(N)]

def bfs():
    nextV = [0]
    visit[0] = 1
    total = 1
    while True:
        G = nextV
        # 次のloop用
        nextV = []
        for m in G:
            # m : 現在地
            # n : 目的地

            # mから到達可能な点nを調べる
            for n in miti[m]:
                if visit[n] == 0 :
                    # first visit
                    visit[n] = 1
                    point[n] = m
                    # 次の探索範囲を追加
                    nextV.append(n)
                    total += 1
                else:
                    continue
        if total == N :
            break

def solve():
    bfs()
    print("Yes")
    for a in point[1::]:
        print(a+1)

if __name__ == "__main__":
    solve()



### FIXED CODE ###

import numpy as np
import sys
import math

N , M = map(int,input().split())
miti = [ [] for _ in range(N)]
for m in range(M):
    a , b = map(int , input().split())
    if b-1 != 0:
        miti[a-1].append(b-1)
    if a-1 != 0:
        miti[b-1].append(a-1)
visit = [0] * N
point = [ -1 for _ in range(N)]

def bfs():
    nextV = [0]
    visit[0] = 1
    total = 1
    while True:
        G = nextV
        # 次のloop用
        nextV = []
        for m in G:
            # m : 現在地
            # n : 目的地

            # mから到達可能な点nを調べる
            for n in miti[m]:
                if visit[n] == 0 :
                    # first visit
                    visit[n] = 1
                    point[n] = m
                    # 次の探索範囲を追加
                    nextV.append(n)
                    total += 1
                else:
                    continue
        if total == N :
            break

def solve():
    bfs()
    print("Yes")
    for a in point[1::]:
        print(a+1)

if __name__ == "__main__":
    solve()
A = input()
n = len(a)
i = 1
ans = ''

def check(i, a, ans):
    if i == n:
#         print(i, 'bottom', a)
        if eval(a) == 7:
            ans = a
        return ans
    
    else:
        a = a[:2*i-2] + A[i-1:]
#         print(i, 'left', a)
        p = i + a.count('+') + a.count('-')
        a = a[:p] + '+' + a[p:]
        ans = check(i+1, a, ans)
        
        a = a[:2*i-2] + A[i-1:]
#         print(i, 'right', a)
        p = i + a.count('+') + a.count('-')
        a = a[:p] + '-' + a[p:]
        ans = check(i+1, a, ans)
    return ans

ans = check(i, A, ans) 
print(ans+'=7')

### FIXED CODE ###

A = input()
n = len(A)
i = 1
ans = ''

def check(i, a, ans):
    if i == n:
        if eval(a) == 7:
            ans = a
        return ans
    
    else:
        a = a[:2*i-2] + A[i-1:]
        p = i + a.count('+') + a.count('-')
        a = a[:p] + '+' + a[p:]
        ans = check(i+1, a, ans)
        
        a = a[:2*i-2] + A[i-1:]
        p = i + a.count('+') + a.count('-')
        a = a[:p] + '-' + a[p:]
        ans = check(i+1, a, ans)
    return ans

ans = check(i, A, ans) 
print(ans+'=7')
n = int(raw_input())
A = map(int, raw_input().split())
q = int(raw_input())
M = map(int, raw_input().split())
  
def solve(i,m):
  if m == 0:
    return True
  if i >= n or m - sum(A) > 0:
    return False
  res = solve(i+1,m) or solve(i+1, m-A[i]
  return res

for j in range(q):
   if solve(0,M[j]):
      print "yes"
   else:
      print "no"
 

### FIXED CODE ###

n = int(raw_input())
A = map(int, raw_input().split())
q = int(raw_input())
M = map(int, raw_input().split())
  
def solve(i,m):
  if m == 0:
    return True
  if i >= n or m - sum(A) > 0:
    return False
  res = solve(i+1,m) or solve(i+1, m-A[i])
  return res

for j in range(q):
   if solve(0,M[j]):
      print "yes"
   else:
      print "no"
S=list(input())
a=0
for i in range(1,len(S),2):
    if S[i]=="L" or S[i]=="U" or S[i]=="D":
        a+=1
for j in range(0,len(S),2):
    if S[i]=="R" or S[i]=="U" or S[i]=="D":
        a+=1
if a==len(S):
    print("Yes")
else:
    print("No")

### FIXED CODE ###

S=list(input())
a=0
for j in range(0,len(S),2):
    if S[j]=="R" or S[j]=="U" or S[j]=="D":
        a+=1
for i in range(1,len(S),2):
    if S[i]=="L" or S[i]=="U" or S[i]=="D":
        a+=1
if a==len(S):
    print("Yes")
else:
    print("No")
s = sorted(input())
print("Yes" if s[0]==s[1] and S[1]!=S[2] and s[2]==s[3] else "No")

### FIXED CODE ###

from collections import Counter
s = Counter(input()).values()
print("Yes" if min(s)==max(s) and len(s)==2 else "No")
S = list(input())
L = len(S)

def f(i, result):
  if S[i] == S[i-1]:
    if i == 1:
      print(result)
      exit()
    else:
      f(i-1, result)
  else:
    if i == 1:
      result += 1
      print(result)
      exit()
    else:
      result += 1
      f(i-1, result)
      
if L == 1:
  result = 0
  print(result)
  exit()
else:
  f(L-1, 0)

### FIXED CODE ###

import sys
sys.setrecursionlimit(1000000)

S = list(input())
L = len(S)
b = S.count("B")
w = S.count("W")

def f(i, result):
  if S[i] == S[i-1]:
    if i == 1:
      print(result)
      exit()
    else:
      f(i-1, result)
  else:
    if i == 1:
      result += 1
      print(result)
      exit()
    else:
      result += 1
      f(i-1, result)
      
if L == 1:
  result = 0
  print(result)
  exit()
elif b == L or w == L:
  result = 0
  print(result)
  exit()
else:
  f(L-1, 0)
N, K = map(int, input().split())
l = [map(int, input().split())]
ans = 0
while max(l)<K:
  if max(l) >= K:
    l.remove(max(l))
    ans += 1
    
print(ans)
    


### FIXED CODE ###

N, K = map(int, input().split())
li = list(map(int, input().split()))
ans = 0
for i in range(N):
  if li[i] >= K:
    ans += 1
print(ans)
H,W,h,w=map(int,input().split())
p=(10**9-1)//(h*w-1)
m=p*(h*w-1)+1
vec=[[p for i in range(W+1)] for j in range(H+1)]
sm=0
for i in range(1,H+1):
  for j in range(1,W+1):
    if i%h==0 and j%w==0:
      vec[i][j]=-m
    sm+=vec[i][j]
if sm<=0:
  print("No")
else:
  print("Yes")
  for i in range(1,H+1):
    for j in range(1,W+1):
      print(vec[i][j],end=" \n"[j==W])

### FIXED CODE ###

H,W,h,w=map(int,input().split())
p=(10**9-1)//(max(h*w-1,1))
m=p*(h*w-1)+1
vec=[[p for i in range(W+1)] for j in range(H+1)]
sm=0
for i in range(1,H+1):
  for j in range(1,W+1):
    if i%h==0 and j%w==0:
      vec[i][j]=-m
    sm+=vec[i][j]
if sm<=0:
  print("No")
else:
  print("Yes")
  for i in range(1,H+1):
    for j in range(1,W+1):
      print(vec[i][j],end=" \n"[j==W])
import sys
inputs = sys.stdin.readlines()

from collections import deque, defaultdict

def dfs_generator(nodes, start):
    nexts = deque([start])
    while nexts:
        node = nexts.popleft()
        nexts.extend(nodes[node]['childs'])
        yield node

nodes = dict({1: dict({'val': 0, 'childs': []})})
for x in inputs[1:n]:
    from_, to_ = map(int, x.split())
    nodes[from_]['childs'].append(to_)
    nodes[to_] = dict({'val': 0, 'childs': []})
'''
subtree_roots = defaultdict(int)
for x in inputs[n:]:
    n, v = map(int, x.split())
    subtree_roots[n] += v

subtrees = defaultdict(list)
for r, v in subtree_roots.items():
    gen = dfs_generator(nodes, r)
    try:
        while True:
            node = next(gen)
            subtrees[r].append(node) 
    except StopIteration:
        pass
    for n in subtrees[r]:
        nodes[n]['val'] += v

for i in range(1, n):
    print(str(nodes[i]['val']), end=' ')
print(str(nodes[i+1]['val']))
'''

### FIXED CODE ###

import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

N,Q = map(int,readline().split())
ABPX = list(map(int,read().split()))
AB = iter(ABPX[:N+N-2])
PX = iter(ABPX[N+N-2:])

graph = [[] for _ in range(N+1)]
for a,b in zip(AB,AB):
    graph[a].append(b)
    graph[b].append(a)

val = [0] * (N+1)
for p,x in zip(PX,PX):
    val[p] += x

stack = [1]

parent = [0] * (N+1)
while stack:
    x = stack.pop()
    for y in graph[x]:
        if y == parent[x]:
            continue
        parent[y] = x
        stack.append(y)
        val[y] += val[x]

print(' '.join(map(str,val[1:])))
import sys



if __name__ == "__main__":
    a, b = list(map(int, intput().split()))
    for i in range(1, 3):
        if a * b * i % 2 == 1:
            print('True')

    print('No')


### FIXED CODE ###

import sys


def main():
    a, b = list(map(int, input().split()))
    for i in range(1, 4):
        if a * b * i % 2 == 1:
            print('Yes')
            return

    print('No')


if __name__ == "__main__":
    main()
N,X = list(map(int, input().split()))
L = list(map(int, input().split()))
D = [0]*(N+2)
for i in range(N):
    D[i+1] = D[i] + L[i]
#print (D)
count = 0
for i in range(len(D)):
    if D[i] <= X:
        count += 1
print count

### FIXED CODE ###

N,X = list(map(int, input().split()))
L = list(map(int, input().split()))
D = [0]*(N+2)
for i in range(N):
    D[i+1] = D[i] + L[i]
#print (D)
count = 0
for i in range(len(D)):
    if D[i] <= X:
        count += 1
print (count-1)