Harryxun/stf_run huggingface dataset:
x,y = map(int, input().split())

from operator import mul
from functools import reduce

def combinations_count(n, r):
    r = min(r, n - r)
    numer = reduce(mul, range(n, n - r, -1), 1)
    denom = reduce(mul, range(1, r + 1), 1)
    return numer // denom

def cmb(n, r, mod):
    if ( r<0 or r>n ):
        return 0
    r = min(r, n-r)
    return g1[n] * g2[r] * g2[n-r] % mod

mod = 10**9+7 #出力の制限
N = 10**4
g1 = [1, 1] # 元テーブル
g2 = [1, 1] #逆元テーブル
inverse = [0, 1] #逆元テーブル計算用テーブル

for i in range( 2, N + 1 ):
    g1.append( ( g1[-1] * i ) % mod )
    inverse.append( ( -inverse[mod % i] * (mod//i) ) % mod )
    g2.append( (g2[-1] * inverse[-1]) % mod )



move = (x+y) / 3
if int(move) != move or x < move or y < move:
    print(0)
else:
    move = int(move)
    diff = max(x,y) - min(x,y)
    res = cmb(move, move//2 - diff//2, mod)
    print(res)

### FIXED CODE ###


x,y = map(int, input().split())

from operator import mul
from functools import reduce

def combinations_count(n, r):
    r = min(r, n - r)
    numer = reduce(mul, range(n, n - r, -1), 1)
    denom = reduce(mul, range(1, r + 1), 1)
    return numer // denom

def cmb(n, r, mod):
    if ( r<0 or r>n ):
        return 0
    r = min(r, n-r)
    return g1[n] * g2[r] * g2[n-r] % mod

mod = 10**9+7 #出力の制限
N = 10**6
g1 = [1, 1] # 元テーブル
g2 = [1, 1] #逆元テーブル
inverse = [0, 1] #逆元テーブル計算用テーブル

for i in range( 2, N + 1 ):
    g1.append( ( g1[-1] * i ) % mod )
    inverse.append( ( -inverse[mod % i] * (mod//i) ) % mod )
    g2.append( (g2[-1] * inverse[-1]) % mod )



move = (x+y) / 3
if int(move) != move or x < move or y < move:
    print(0)
else:
    move = int(move)
    diff = max(x,y) - min(x,y)
    res = cmb(move, move//2 - diff//2, mod)
    print(res)
n=0
m=input()
c=[0 for i in xrange(m)]
t=[0 for i in xrange(m)]


def d(u):
    global n
    if ts[u]:return
    n = n + 1
    ts[u]=[u+1,n]
    for i in c[u]:d(i-1)
    n = n + 1
    ts[u][2:]=[n]

def dfs():
    for i in range(m):
     l=map(int,raw_input().split())
     c[l[0]-1]=l[2:]
    for i in range(m):
     d(i)
     print " ".join(map(str,ts[i]))

dfs()

### FIXED CODE ###

n=0
m=input()
c=[0 for i in xrange(m)]
ts=[0 for i in xrange(m)]


def dfs_visit(u):
    global n
    if ts[u]:return
    n = n + 1
    ts[u]=[u+1,n]
    for i in c[u]:dfs_visit(i-1)
    n = n + 1
    ts[u][2:]=[n]

def dfs():
    for i in range(m):
     l=map(int,raw_input().split())
     c[l[0]-1]=l[2:]
    for i in range(m):
     dfs_visit(i)
     print " ".join(map(str,ts[i]))

dfs()
import sys
    sys.setrecursionlimit(10**6)
     
    n, q = map(int, input().split())
    g = [[] for _ in range(n)]
    for i in range(n-1):
      a, b = map(int, input().split())
      a, b = a-1, b-1
      g[a].append(b)
      #g[b].append(a)
     
    ans = [0]*n  
    for j in range(q):
      p, x = map(int, input().split())
      ans[p-1] += x
      
    from collections import deque
    s = deque()
    s.append(0)
     
    while s:
      v = s.pop()
      for v_ in g[v]:
        ans[v_] += ans[v]
        s.append(v_)
     
    print(' '.join(map(str, ans)))

### FIXED CODE ###

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

l = [[] for i in range(n+1)]
for a, b in ab:
    l[a].append(b)
    l[b].append(a)

value = [0 for i in range(n+1)]
for p, x in px:
    value[p] += x

s = [1]
flag = [False]*(n+1)
while s:
    v = s.pop()
    flag[v] = True
    for e in l[v]:
        if flag[e]:
            continue
        value[e] += value[v]
        s.append(e)

print(*value[1:])
import numpy as np

N = int(input())
S = np.array([int(x) for x in input().split()],dtype=np.int64)

# 右移動着地点：等差数列、ゴール含む
# 左移動着地点：等差数列、スタート含む

answer = 0
for d in range(1,N):
    # d = A-B
    cum_left = np.cumsum(S[::d])
    cum_right = np.cumsum(S[::-1][::d])
    score = cum_left + cum_right # 等差数列の長さ-1 -> 得点
    # あとは、その経路がルール内で実現できるかどうか
    for L,s in enumerate(score):
        if answer >= s:
            continue
        # 右左に進んでいることの確認
        A = N-1-L*d
        B = A-d
        if A<=B:
            continue
		if B<=0:
          	continue
        # 同じ場所を取っていないかの確認
        # kd = N-1-ldとなるとまずい
        # 約数のとき、Ld >= N-Ldだとまずい
        if (N-1)%d == 0 and 2*L*d >= N-1:
            continue
        answer = s


print(answer)


### FIXED CODE ###

import numpy as np

N = int(input())
S = np.array([int(x) for x in input().split()],dtype=np.int64)

# 右移動着地点：等差数列、ゴール含む
# 左移動着地点：等差数列、スタート含む

answer = 0
for d in range(1,N):
  # d = A-B
  cum_left = np.cumsum(S[::d])
  cum_right = np.cumsum(S[::-1][::d])
  score = cum_left + cum_right # 等差数列の長さ-1 -> 得点
  # あとは、その経路がルール内で実現できるかどうか
  for L,s in enumerate(score):
    if answer >= s:
      continue
    # 右左に進んでいることの確認
    A = N-1-L*d
    B = A-d
    if A <= 0:
      continue
    if A<=B:
      continue
    if B<=0:
      continue
    # 同じ場所を取っていないかの確認
    # kd = N-1-ldとなるとまずい
    # 約数のとき、Ld >= N-Ldだとまずい
    if (N-1)%d == 0 and 2*L*d >= N-1:
      continue
    answer = s

print(answer)
s=input()[::-1]
ans=0
u=0
d=1
l=[0]*2019
l[0]=1
for i in map(int,s):
  u=(u+i*d%2019)
  l[u]+=1
  d=d*10%2019
for i in l:
  ans+=i*(i-1)//2
print(ans)


### FIXED CODE ###

s=input()[::-1]
ans=0
u=0
d=1
l=[0]*2019
l[0]=1
for i in map(int,s):
  u=(u+i*d)%2019
  l[u]+=1
  d=d*10%2019
for i in l:
  ans+=i*(i-1)//2
print(ans)
import math
from functools import reduce

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

def lcm(*numbers):
    return reduce(lcm_base, numbers, 1)

def lcm_list(numbers):
    return reduce(lcm_base, numbers, 1)

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

lcm = lcm_list(list)

ans = 0

for i in range(N):
  ans += lcm // list[i]

print(ans % (10**9 + 7))


### FIXED CODE ###

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

def gcd(a, b):
  while b:
    a, b = b, a % b
  return a

def lcm(a, b):
  return a * b // gcd (a, b)

alllcm = 1

for i in range(N):
  alllcm = lcm(alllcm, list[i])

ans = 0

for i in range(N):
  ans += alllcm // list[i]

print(ans % (10**9 + 7))
# -*- coding: utf-8 -*-
import heapq

N, M = map(int, input().split())
Wlist = []
for i in range(N):
    A, B = map(int, input().split())
    Wlist.append([A,B])
Wlist.sort(key=lambda x:x[0])

h = []
Ans = 0
Index = 0
for day in range(1,M+1):
    while Index < N:
        if Wlist[Index][0] <= day:
            heapq.heappush(h, -Wlist[Index][1])
            Index += 1
        else:
            break
    Ans += -heapq.heappop(h)

print(Ans)


### FIXED CODE ###

# -*- coding: utf-8 -*-
import heapq

N, M = map(int, input().split())
Wlist = []
for i in range(N):
    A, B = map(int, input().split())
    Wlist.append([A,B])
Wlist.sort(key=lambda x:x[0])

h = []
Ans = 0
Index = 0
for day in range(1,M+1):
    while Index < N:
        if Wlist[Index][0] <= day:
            heapq.heappush(h, -Wlist[Index][1])
            Index += 1
        else:
            break
    if len(h):
        Ans += -heapq.heappop(h)

print(Ans)
n,x,y=map(int,input().split())

cnt={}
for i in range(1,n+1):
  for j in range(i+1,n+1):
    if i <= x and y <= j:
      cnt[(j-y)-(x-i)+1] += 1
    else:
      cnt[j-i] += 1
      
for i in range(1,n):
  print(cnt[i])

### FIXED CODE ###

n,x,y=map(int,input().split())

cnt=[0 for i in range(n)]

for i in range(1,n+1):
  for j in range(i+1,n+1):
    a=min(abs(x-i),abs(y-i))
    b=min(abs(x-j),abs(y-j))
    l=min(j-i,a+b+1)
    cnt[l] += 1
      
for i in range(1,n):
  print(cnt[i])
a=input()
if len(a)%2==0:
    for i in range(len(a)-3):
        b=sorted([a[i],a[i+1],a[i+2],a[i+3]])
        c="".join(b)
        d=list(set(a[i:i+4]))
        if (len(d)==2)&(c!="{}".format(d[0]+d[0]+d[1]+d[1]))&(c!="{}".format(d[1]+d[1]+d[0]+d[0])):
            print("{}".format(i+1)+" "+"{}".format(i+4))
            break
    else:
        print("-1 -1")
else:
    for j in range(len(a)-2):
        e=list(set(a[i:i+3]))
        if len(e)==2 or len(e)==1:
            print("{}".format(i+1)+" "+"{}".format(i+3))
            break
    else:
        print("-1 -1")

### FIXED CODE ###

a=input()
if len(a)==1:
    print("-1 -1")
elif (len(a)==2)&(len(list(set(a)))==1):
    print("1 2")
else:
    for i in range(len(a)-2):
        e=list(set(a[i:i+3]))
        if (len(e)==2) or (len(e)==1):
            print("{}".format(i+1)+" "+"{}".format(i+3))
            break
    else:
        print("-1 -1")
n, m = map(int, input().split())
A, B = [0]*n, [0]*n
ans = 'IMPOSSIBLE'
for i in range(m):
    a, b = map(int, input().split())
    if a == 1:
        A[b-1] += 1
    if b == n:
        B[a-1] += 1

for i in range(m):
    if A[i] == 1 and B[i] == 1:
        ans = 'POSSIBLE'
        break
print(ans)

### FIXED CODE ###

n, m = map(int, input().split())
A, B = [0]*n, [0]*n
ans = 'IMPOSSIBLE'
for i in range(m):
    a, b = map(int, input().split())
    if a == 1:
        A[b-1] += 1
    if b == n:
        B[a-1] += 1
if sum(B) == 0:
    print(ans)
    exit()
else:
    for i in range(n):
        if A[i] == 1 and B[i] == 1:
            ans = 'POSSIBLE'
            break
    print(ans)
import math
def main():
    N, M = map(int, input().split())
    S = input()
    T = input()
    result = N * M / math.gcd(N, M)
    cand = (result / N) * (result / M) / math.gcd(int((result / N)), int((result / M)))
    for i in range(0, int(result / cand)):
        if S[int((i * cand) / (result / N))] != T[int((i * cand) / (result / M))]:
            return -1
    return int(result)
print(main())

### FIXED CODE ###

def gcd(a, b):
    if a < b:
        a, b = b, a
    if b == 0:
        return a
    c = a % b
    return gcd(b, c)

def main():
    N, M = map(int, input().split())
    S = input()
    T = input()
    result = N * M / gcd(N, M)
    cand = (result / N) * (result / M) / gcd(int((result / N)), int((result / M)))
    for i in range(0, int(result / cand)):
        if S[int((i * cand) / (result / N))] != T[int((i * cand) / (result / M))]:
            return '-1'
    return int(result)
print(main())
N = int(input())
K = int(input())
 
ans = int(N-K+1)
 
print ans

### FIXED CODE ###

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

ans = int(N-K+1)

print(ans)
n = input()
d = set()
for i in range(n):
    s = raw_input()
    if s in d:
        print "No"
        exit()
    if pre = "" or pre[-1] == s[0]:
        continue
    else:
        print "No"
        exit()
print "Yes"

### FIXED CODE ###

n = input()
d = set()
pre = ""
for i in range(n):
    s = raw_input()
    if s in d:
        print "No"
        exit()
    if pre == "" or pre[-1] == s[0]:
        d.add(s)
        pre = s
    else:
        print "No"
        exit()
print "Yes"
import sys
sys.setrecursionlimit("10**7")

N, A, B, C = map(int, input().split())
l = [int(input()) for i in range(N)]
INF = 10 ** 9
def dfs(cur, a, b, c):
  if cur == N:
  return abs(a - A) + abs(b - B) + abs(c - C) - 30 if min(a, b, c) > 0 else INF
  ret0 = dfs(cur + 1, a, b, c)
  ret1 = dfs(cur + 1, a + l[cur], b, c) + 10
  ret2 = dfs(cur + 1, a, b + l[cur], c) + 10
  ret3 = dfs(cur + 1, a, b, c + l[cur]) + 10
  return min(ret0, ret1, ret2, ret3)
print(dfs(0, 0, 0, 0))


### FIXED CODE ###

import sys
sys.setrecursionlimit(10**7)

N, A, B, C = map(int, input().split())
l = [int(input()) for i in range(N)]
INF = 10 ** 9
def dfs(cur, a, b, c):
  if cur == N:
    return abs(a - A) + abs(b - B) + abs(c - C) - 30 if min(a, b, c) > 0 else INF
  ret0 = dfs(cur + 1, a, b, c)
  ret1 = dfs(cur + 1, a + l[cur], b, c) + 10
  ret2 = dfs(cur + 1, a, b + l[cur], c) + 10
  ret3 = dfs(cur + 1, a, b, c + l[cur]) + 10
  return min(ret0, ret1, ret2, ret3)
print(dfs(0, 0, 0, 0))
N = int(input())
print((N//2)+1/2N if N%2 != 0 else "0.5" )


### FIXED CODE ###

N = int(input())
print(((N//2)+1)/N if N%2 != 0 else "0.5" )
A = int(input())
B = int(input())
C = int(input())
D = int(input())
E = int(input())

l = [A,B,C,D,E]
sub = 10 - min([i%10 for i in l if i%10!==0])
M = []
for i in l:
  if i%10 == 0:
    M.append(i)
  else:
    M.append(((i//10)+1)*10)
print(sum(M)-sub)

### FIXED CODE ###

A = int(input())
B = int(input())
C = int(input())
D = int(input())
E = int(input())

l = [A,B,C,D,E]
m = [i%10 for i in l if i%10!=0 ]
if len(m) == 0:
  sub = 0
else:
  sub = 10 - min(m)
M = []
for i in l:
  if i%10 == 0:
    M.append(i)
  else:
    M.append(((i//10)+1)*10)
print(sum(M)-sub)
n = input()
  maxv = -1*10**9
  minv = input()

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

  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
N,K = map(int,input().split())
ls = []
len = 0
for i in range(N):
    a,b = map(int,input().split())
    ls.append(str(a)*b)
    len += b
    if len >= K:
        break
ls = "".join(ls)
print(ls[K-1])

### FIXED CODE ###

from operator import itemgetter
N,K = map(int,input().split())
ls = [list(map(int,input().split())) for _ in range(N)]
ls = sorted(ls,key=itemgetter(0))
len = 0
ans = 0
i = 0
while True:
    if len >= K:
        break
    ans = ls[i][0]
    len += ls[i][1]
    i += 1
print(ans)
n = map(int, input().split())
a = map(int, input().split())
if n % 500 <= a:
    print('Yes')
else:
    print('No')

### FIXED CODE ###

n = int(input())
a = int(input())
if n % 500 <= a:
    print('Yes')
else:
    print('No')
s = input()
if input() == 'ABC':
  print('ARC')
else:
  print('ABC')

### FIXED CODE ###

S = input()
if S == 'ABC':
  print('ARC')
else:
  print('ABC')
n = input()
sn = sum([int(i) for i in list(n)])
if n % sn == 0 :
    print("Yes")
else :
    print("No")

### FIXED CODE ###

n = input()
sn = sum([int(i) for i in list(n)])
if int(n) % sn == 0 :
    print("Yes")
else :
    print("No")
a, b, k = map(int, input().split())
ab = list(range(a, b+1))
for i in ab:
    if i <= k or i >= b - k:
        print(i)

### FIXED CODE ###

a, b, k = map(int, input().split())
if b-a+1 < k*2:
    for i in range(a, b+1):
        print(i)
else:
    for j in range(a, a+k):
        print(j)
    for k in range(b-k+1 , b+1):
        print(k)
N,M = map(int,input().split())

G = [[] for i in range(N)]
for i in range(M):
  x,y = map(int,input().split())
  G[x - 1].append(y - 1)

dp = [-1] * N # dp[i] = 頂点iから進むことが出来る深さ
def search(v):
  if dp[v] != -1:
    return dp[v]
  max_depth = 0
  for child in G[v]:
    max_depth = max(max_depth, search(child) + 1)
    
  dp[v] = max(dp[v], max_depth)
  return dp[v]

for i in range(N):
  search(i)

print(max(dp))


### FIXED CODE ###

import sys
sys.setrecursionlimit(10 ** 5 + 1)
N,M = map(int,input().split())

G = [[] for i in range(N)]
for i in range(M):
  x,y = map(int,input().split())
  G[x - 1].append(y - 1)

dp = [-1] * N # dp[i] = 頂点iから進むことが出来る深さ
def search(v):
  if dp[v] != -1:
    return dp[v]
  max_depth = 0
  for child in G[v]:
    max_depth = max(max_depth, search(child) + 1)
    
  dp[v] = max(dp[v], max_depth)
  return dp[v]

for i in range(N):
  search(i)

print(max(dp))
a, v = map(int, input().split())
b, w = map(int, input().split())
t = int(input())

if v > w:
    # 1秒あたり距離はv-wだけ縮まる
    # t秒の時の距離は(v-w)*t
    # それが|a-b| の距離に間に合うor追い越せるかどうか
    if abs(a - b) <= (v - w) * t
    # if t <= abs(a - b):
        print("YES")
    else:
        print("NO")
else:
    print("NO")

### FIXED CODE ###

a, v = map(int, input().split())
b, w = map(int, input().split())
t = int(input())

if v > w:
    # 1秒あたり距離はv-wだけ縮まる
    # t秒の時の距離は(v-w)*t
    # それが|a-b| の距離に間に合うor追い越せるかどうか
    if abs(a - b) <= (v - w) * t:
    # if t <= abs(a - b):
        print("YES")
    else:
        print("NO")
else:
    print("NO")
D=input()
c=list(map(int, list(input())))
for i in range(365):
    s=list(map(int, list(input())))
    print(s.index(max(s)) + 1)

### FIXED CODE ###

D=int(input())
c=list(map(int, (input().split(' '))))
s=[]
for i in range(D):
    s.append(list(map(int, (input().split(' ')))))
for i in range(D):
    print(s[i].index(max(s[i])) + 1)
w,h,x,y = map(int,input.split())
s = float((w*h) / 2)
if x==y:
  print(s+"1")
else:
  print(s + "0")

### FIXED CODE ###

w,h,x,y = map(int, input().split())
print('{:.6f} {}'.format(w*h/2, 1 if x+x==w and y+y==h else 0))
a,b,c=map(int,input().split())
if a=b=c or (a!=b and a!=c and b!=c):
  print('No')
else:
  print('Yes')

### FIXED CODE ###

a,b,c=map(int,input().split())
if a==b==c or (a!=b and a!=c and b!=c):
  print('No')
else:
  print('Yes')
N, K = map(int, input().split())
A_i = list(map(int, input().split()))

place = 1
road = []
cycle = 0

while K != 0:
    road.append(place)
    place = A_i[place - 1]
    K -= 1

    if place in road:
        loop_place = place
        break

while 1:
    loop_place = A_i[loop_place - 1]
    cycle += 1

    if place == loop_place:
        break

K = K % cycle

while K != 0:
    place = A_i[place - 1]
    K -= 1

print(place)


### FIXED CODE ###

N, K = map(int, input().split())
A_i = list(map(int, input().split()))

place = 1
road = [0 for i in range(N)]
cycle = 0

road[0] = 1

while K != 0:
    place = A_i[place - 1]
    K -= 1
    if road[place - 1] == 1:
        loop_place = place
        break
    road[place - 1] = 1

while K != 0:
    loop_place = A_i[loop_place - 1]
    cycle += 1

    if place == loop_place:
        break

if cycle != 0:
    K = K % cycle

while K != 0:
    place = A_i[place - 1]
    K -= 1

print(place)
import sys
n=10000000
sys.setrecursionlimit(n)
def s(l):
    if l<2:
        return 1
    else:
        return s(l-2)
ab=int(input())
ll=s(ab)
a=0
b=1
while(b):
    if(ll%10!=0):
        b=0
    else:
        a=a+1
print(a)

### FIXED CODE ###

def fun(n):
    if n%2!=0:
        return 0
    else:
        ans=0
        n//=2
        while(n):
            ans=ans+n//5
            n=n//5
    return ans


n = int(input())
if n>=2:
    print(fun(n))
else:
    print(0)
n, m = map(int,input().strip().split())
lst = list(map(int, input().split()))
summ = 0
for i in lst:
    summ += i
# print(summ)
sol = 1/(m * 4)
# print(sol)
res = sol*summ
# print(res)
if lst[m] > res:
    print("YES")
else:
    print("NO")

### FIXED CODE ###

n,m = map(int,input().split())
s = list(map(int,input().split()))
s.sort(reverse = True)
s1 = s[:m]
if(s1[-1]<sum(s)/(4*m)):
    print("No")
else:
    print("Yes")
i1 = int(input())
i2 = input().split(' ')
i3 = input().split(' ')

w = -1
s = 0

for i in range(i1):
  ii2 = int(i2[i])
  ii3 = int(i3[i])
#  print(ii2)
#  print(ii3)

  if ii2 > ii3:
    #引ききれた場合
    s += ii3
  else:
    s += ii2
    w = ii3 - ii2

    iii2 = int(i2[i+1])

    if iii2 > w:
      s += w
      w = iii2 - w
    else:
      s += iii2
      w = 0

print(s)

### FIXED CODE ###

i1 = input().split(' ')
a=int(i1[0])
b=int(i1[1])

aa = abs(a)+abs(b)
if aa%2 == 0:
  print(int(aa/2))
  exit()

print("IMPOSSIBLE")
a, b = map(int, input().split())

if a >= 2 and b >=2 :
    ans = (a * (a + 1)//2 - a) + (b * (b +1)//2 - b)
    print(ans)

if a < 2 and b < 2:
    print(0)

if a < 2 and b >= 2:
    print(b * (b + 1)//2 -b)

if a >= 2 and b < 2:
    print(a * (a + 1)//2 -a)

### FIXED CODE ###

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

if a >= 2 and b >=2 :
    ans = ((a * (a + 1))//2 - a) + ((b * (b +1))//2 - b)
    print(ans)

if a < 2 and b < 2:
    print(0)

if a < 2 and b >= 2:
    print((b * (b + 1))//2 -b)

if a >= 2 and b < 2:
    print((a * (a + 1))//2 -a)
i=int (input())
a=list(input().split(" "))
n=len(a[0])
for i in range(0,n):
    print(a[0][i]+a[1][i],end="")

### FIXED CODE ###

a=int(input())
b=int(input())
if (a==1 and b==2) or (a==2 and b==1):
    print('3')
if (a==1 and b==3) or (a==3 and b==1):
    print('2')
if (a==2 and b==3) or (a==3 and b==2):
    print('1')
from bisect import bisect_left
from operator import itemgetter

input = sys.stdin.readline

N, Q = map(int, input().split(" "))
check_points = [tuple(map(int, input().split(" "))) for _ in range(N)]
querys = [int(input()) for _ in range(Q)]
time = [-1] * Q
jump = [-1] * Q
check_points = sorted(check_points, key=itemgetter(2))
b_left = bisect_left

for line in check_points:
    s, f, x = line
    start = s-x
    end = f-x
    left = b_left(querys, start)
    right = b_left(querys, end)
    while left < right:
        if time[left] == -1:
            time[left] = x
            jump[left] = right
            left += 1
        else:
            left = jump[left]

for t in time:
    print(t)


### FIXED CODE ###

from bisect import bisect_left
from operator import itemgetter

N, Q = map(int, input().split(" "))
check_points = [tuple(map(int, input().split(" "))) for _ in range(N)]
querys = [int(input()) for _ in range(Q)]
time = [-1 for _ in range(Q)]
jump = [-1 for _ in range(Q)]
check_points = sorted(check_points, key=itemgetter(2))
b_left = bisect_left

for line in check_points:
    s, f, x = line
    start = s-x
    end = f-x
    left = b_left(querys, start)
    right = b_left(querys, end)
    while left < right:
        if time[left] == -1:
            time[left] = x
            jump[left] = right
            left += 1
        else:
            left = jump[left]

for t in time:
    print(t)
S=input()
L=len(S)
for i in range(L):
  S[i]="x"
print(S)

### FIXED CODE ###

S=input()
L=len(S)
ans=""
for i in range(L):
  ans+="x"
print(ans)
x,k,d = map(int, input().split())
x= abs(x)
m= min(k,x//d)
x -= m*d
k -= m
if k%2:
  x = abs(x-d)
print(x)

### FIXED CODE ###

s = input()
for i in ['RRR','RR','R']:
    if i in s:
        print(len(i));break
else:
    print(0)
# -*- coding: utf-8 -*-

def main():
	line = input().strip()
	while line!='':
		seq = list(map(int,line.split(' ')))
		print(0)
		line = input().strip()

if __name__=='__main__':
	main()

"""

/*

0 1 2 3 4 5 6 7
1 0 2 3 4 5 6 7
7 6 5 4 3 2 1 0


0
1
28
*/

"""

### FIXED CODE ###

from __future__ import division
import sys
if sys.version_info[0]>=3: raw_input=input

X=4
Y=2
i=0
m={}
prev={}
v=[]
for i in range(X*Y): v.append(str(i))
m[''.join(v)]=[0,0]
prev[''.join(v)]=[''.join(v),None]
q=[v]
while len(q)>0:
	v=q.pop(0)
	coor=m[''.join(v)][0]
	x=coor%X
	y=coor//X
	depth=m[''.join(v)][1]
	nextstr=''.join(v)
	if 0<x:
		v[coor],v[coor-1]=v[coor-1],v[coor]
		if ''.join(v) not in m:
			m[''.join(v)]=[coor-1,depth+1]
			q.append(v[:])
			prev[''.join(v)]=[nextstr,'R']
		v[coor],v[coor-1]=v[coor-1],v[coor]
	if x<X-1:
		v[coor],v[coor+1]=v[coor+1],v[coor]
		if ''.join(v) not in m:
			m[''.join(v)]=[coor+1,depth+1]
			q.append(v[:])
			prev[''.join(v)]=[nextstr,'L']
		v[coor],v[coor+1]=v[coor+1],v[coor]
	if 0<y:
		v[coor],v[coor-X]=v[coor-X],v[coor]
		if ''.join(v) not in m:
			m[''.join(v)]=[coor-X,depth+1]
			q.append(v[:])
			prev[''.join(v)]=[nextstr,'D']
		v[coor],v[coor-X]=v[coor-X],v[coor]
	if y<Y-1:
		v[coor],v[coor+X]=v[coor+X],v[coor]
		if ''.join(v) not in m:
			m[''.join(v)]=[coor+X,depth+1]
			q.append(v[:])
			prev[''.join(v)]=[nextstr,'U']
		v[coor],v[coor+X]=v[coor+X],v[coor]

try:
	while True:
		v=raw_input().split()
		print(m[''.join(v)][1])
except EOFError:
	pass
n=int(input())
l=list(map(int,input().split()))
max_value=-999
cnt=0
for i in range(n):
  if max_value<=l[i]:
    max_value=max(max_balue,l[i])
    cnt+=1
print(cnt)

### FIXED CODE ###

n=int(input())
l=list(map(int,input().split()))
cnt=1
max_h=-1
for i in range(n-1):
  max_h=max(l[i],max_h)
  if l[i+1]>=max_h:
    cnt+=1
print(cnt)