Harryxun/stf_run huggingface dataset:
import functools
import fractions

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

max_under_lcm = functools.reduce(lambda x, y: int((x * y) / fractions.gcd(x,y)), numbers) - 1
answer = sum([max_under_lcm % n for n in numbers])

print(answer)

### FIXED CODE ###

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

tasks = list(map(int, input().split()))
answer = max(tasks) - min(tasks)
print(answer)
n = list(input())
counter = 1
directions = []
list = []
def add_up(x):
    added = (1/2) * x * (x + 1)
    return added

for i in range(len(n)-1):
    if n[i] == n[i+1]:
        counter += 1
    else:
        directions.append(counter)
        counter = 1
if n[-1] == n[-2]:
    directions[-1] += 1
else:
    directions.append(1)
if n[0] == "<":
    for i in range(0,len(directions)-1,2):
        if directions[i] > directions[i+1]:
            directions[i+1] -= 1
        elif directions[i] < directions[i+1]:
            directions[i] -= 1
else:
    for i in range(1,len(directions)-1,2):
        if directions[i] > directions[i+1]:
            directions[i+1] -= 1
        elif directions[i] < directions[i+1]:
            directions[i] -= 1
for direction in directions:
    list.append(add_up(direction))
print(round(sum(list)))


### FIXED CODE ###

n = list(input())
counter = 1
directions = []
list = []
def add_up(x):
    added = (1/2) * x * (x + 1)
    return added
for i in range(len(n)-1):
    if n[i] == n[i+1]:
        counter += 1
    else:
        directions.append(counter)
        counter = 1
directions.append(counter)
if n[0] == "<":
    for i in range(0,len(directions)-1,2):
        if directions[i] >= directions[i+1]:
            directions[i+1] -= 1
        else:
            directions[i] -= 1
else:
    for i in range(1,len(directions)-1,2):
        if directions[i] >= directions[i+1]:
            directions[i+1] -= 1
        elif directions[i] < directions[i+1]:
            directions[i] -= 1
for direction in directions:
    list.append(add_up(direction))
print(round(sum(list)))
import copy 

n = int(input())
s = list(input())
k = int(input())

ans = s
for i in range(n):
    if ans[i] != s[k]:
        ans[i] = '*'
print(''.join(ans))



### FIXED CODE ###

import copy 

n = int(input())
s = list(input())
k = int(input())

ans = s
for i in range(n):
    if ans[i] != s[k - 1]:
        ans[i] = '*'
print(''.join(ans))
x, y, z = map(int, input().split())

a = z

z = y
y = x
x = a

print(x y z)


### FIXED CODE ###

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

a = z
b = x
c = y

print(a, b, c)
s = input()
k = int(input())
n = len(s)

a = 1
data = []
for i in range(n-1):
    if s[i] == s[i+1]:
        a += 1
    else:
        data.append(a)
        a = 1
data.append(a)

ans = 0

if s[0] != s[-1]:
    for d in data:
        ans += d//2
    ans *= k
elif len(data) == 1:
    ans = n*k//2
else:
    for i in range(1,n-1):
        ans += data[i]//2
    ans *= k
    ans += data[0]//2 + data[-1]//2 + (data[0] + data[-1])//2 * (k-1)

print(ans)

### FIXED CODE ###

s = input()
k = int(input())
n = len(s)

a = 1
data = []
for i in range(n-1):
    if s[i] == s[i+1]:
        a += 1
    else:
        data.append(a)
        a = 1
data.append(a)

ans = 0

if s[0] != s[-1]:
    for d in data:
        ans += d//2
    ans *= k
elif len(data) == 1:
    ans = n*k//2
else:
    for i in range(1,len(data)-1):
        ans += data[i]//2
    ans *= k
    ans += data[0]//2 + data[-1]//2 + (data[0] + data[-1])//2 * (k-1)

print(ans)
S = input()
S = sorted(set(S))
A = "abcdefghijklmnopqrstuvwxyz"
for i in range(len(A)):
  if len(A) == len(S):
    print("None")
    break
  if A[i] != S[i]:
    print(A[i])
    break

### FIXED CODE ###

S = input()
S = sorted(set(S))
A = "abcdefghijklmnopqrstuvwxyz"
for i in range(len(A)):
  if len(A) == len(S):
    print("None")
    break
  if A[i] != S[i]:
    print(A[i])
    break
  if i == len(S) - 1:
    print(A[i + 1])
    break
a = int(input())
b = int(input())
c = int(input())

print((a + b)*h//2)

### FIXED CODE ###

a = int(input())
b = int(input())
h = int(input())

print((a + b)*h//2)
N,K,M = input().split()
N = int(N)
K = int(K)
M = int(M)
print(N)
A = input().split()
print(A)
A = [int(s) for s in A]
print(A)
AN = M * N - sum(A)
print (AN)
if (AN <= K) and (AN >= 0):
	print (AN)
elif AN < 0:
	print (0)
else:
	print (-1)

### FIXED CODE ###

a = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z']
C = input()
if (C != 'z') and (C in a):
	i = a.index(C)
	print (a[i+1])
def run_count(counter, edges, p, x):
    counter[p] += x
    p_list = edges[p]
    if p_list is None:
        return counter

    for _p in p_list:
        counter = run_count(counter, edges, _p, x)

    return counter


N, Q = [int(i) for i in input().rstrip().split()]

a = [0] * (N - 1)
b = [0] * (N - 1)
for i in range(N - 1):
    a[i], b[i] = [int(j) for j in input().rstrip().split()]

p = [0] * Q
x = [0] * Q
for i in range(Q):
    p[i], x[i] = [int(j) for j in input().rstrip().split()]

edges = {}
for i in range(N):
    edges[i + 1] = []

for i in range(N - 1):
    edges[a[i]].append(b[i])

counter = {}
for i in range(N):
    counter[i + 1] = 0

for i in range(Q):
    counter = run_count(counter, edges, p[i], x[i])

res = ""
for i in range(N):
    res += str(counter[i + 1])
    res += " "
res.rstrip(" ")

print(res)


### FIXED CODE ###

import sys

input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)


def dfs(G, v, p, point):
    """G: graph, v: vertex, p: parent"""
    # Loop for each child
    for c in G[v]:
        if c == p:
            continue
        point[c] += point[v]
        dfs(G, c, v, point)


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

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

    dfs(G, 0, -1, point)
    print(" ".join(map(str, point)))


if __name__ == "__main__":
    main()
n,c=map(int,input().split())
x=[0]
v=[]
for i in range(n):
    a,b=map(int,input().split())
    x.append(a)
    v.append(b)
x1=[x[i+1]-x[i] for i in range(len(x)-1)]
x2=[c-x[-1]]+x1[:0:-1]
#print(x1,x2)
h=[0]
t=[0]
for i,j in zip(x2,reversed(v)):
    h.append(h[-1]+j+-i)
hm=[max(h[:-i]) for i in range(1,len(h))]+[0]
#print(h,hm)
m=0
for k,(i,j) in enumerate(zip(x1,v)):
    t.append(t[-1]+j-i)
    #print(m,t[-1],i)
    m=max(m,t[-1]+hm[k])
print(m)

### FIXED CODE ###

a,b,c,x,y=map(int, input().split())

if x>=y :l=min(x,y)*2*c+(x-y)*a
else: l=l=min(x,y)*2*c+(y-x)*b

print(min(a*x+b*y, l, max(x,y)*2*c))
import numpy as np

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

ans = np.prod(A)

if ans > 10**18:
  print(-1)
else:
  print(int(ans))

### FIXED CODE ###

import sys

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

ans = 1

if 0 in A:
  print(0)
  sys.exit()

for i in range(N):
  ans *= A[i]
  if ans > 1e18:
    print(-1)
    sys.exit()
print(ans)
import sys
sys.setrecursionlimit(100001)

def gcd(b, s):
    return s if b % s == 0 else gcd(s, b % s)

# 一人消してgcd
n = int(input())
nl = sorted(list(map(int, input().split(' '))))
rl = nl[::-1]
sumnl = [nl[0]]
sumrl = [rl[0]]
for i in range(1, len(nl)):
    sumnl.append(gcd(sumnl[-1], nl[i]))
    sumrl.append(gcd(sumrl[-1], rl[i]))
sumrl = sumrl[::-1]
if len(sumnl) == 1:
    print(sumnl[0])
else:
    print(max([gcd(sumnl[i],sumrl[i+2]) for i in range(len(sumrl) - 2)]))

### FIXED CODE ###

import sys
sys.setrecursionlimit(100001)

def gcd(b, s):
    return s if b % s == 0 else gcd(s, b % s)

# 一人消してgcd
n = int(input())
nl = sorted(list(map(int, input().split(' '))))
rl = nl[::-1]
sumnl = [nl[0]]
sumrl = [rl[0]]
for i in range(1, len(nl)):
    sumnl.append(gcd(sumnl[-1], nl[i]))
    sumrl.append(gcd(sumrl[-1], rl[i]))
sumrl = sumrl[::-1]
if len(sumnl) == 1:
    print(sumnl[0])
else:
    print(max([sumnl[-2]] + [gcd(sumnl[i],sumrl[i+2]) for i in range(len(sumrl) - 2)] + [sumrl[1]]))
s, w = map(int, input().split())

if s < w
  print("unsafe")
else:
  print("safe")

### FIXED CODE ###

s, w = map(int, input().split())

if s <= w:
  print("unsafe")
else:
  print("safe")
# -*- coding: utf-8 -*-
n = int(input())
l = [int(i) for i in input().split()]
if n > 1:
  for j in range(n):
    if max(l[:j]) - min(l[j:]) >= 2:
      print('No')
      exit()
print('Yes')

### FIXED CODE ###

# -*- coding: utf-8 -*-
n = int(input())
li = [int(a) for a in input().split()]
ans = 'Yes'

if n > 1:
  for i in range(n-1):
    if li[-(i+2)] <= li[-(i+1)]:
      pass
    elif li[-(i+2)] - 1 <= li[-(i+1)]:
      li[-(i+2)] = li[-(i+2)] - 1
    else:
      ans = 'No'
      break

print(ans)
a,b=map(int,input().split())
q,r=divmod(b-a,a-1)
if r==0:
  print(q+1)
else:
  print((q+2)
  

### FIXED CODE ###

a,b=map(int,input().split())
q,r=divmod(b-a,a-1)
if r==0:
  print(q+1)
else:
  print(q+2)
A, B, C = input().split()  
print(C A B)                   

### FIXED CODE ###

A, B, C = input().split()
print(C, A ,B)
n = input()
#a,b = map(str,raw_input().split())
a = [raw_input() for i in range(n)]
j=0
for i in range(1,53):
  for j in range(n);
    if a[j] == 'S %s' % i:
      continue
    elif j==n-1:
      print 'S %s' % i
or i in range(1,53):
  for j in range(n);
    if a[j] == 'H %s' % i:
      continue
    elif j==n-1:
      print 'H %s' % i
or i in range(1,53):
  for j in range(n);
    if a[j] == 'C %s' % i:
      continue
    elif j==n-1:
      print 'C %s' % i
or i in range(1,53):
  for j in range(n);
    if a[j] == 'D %s' % i:
      continue
    elif j==n-1:
      print 'D %s' % i

### FIXED CODE ###

n = input()
a = [raw_input() for i in range(n)]
j=0
for i in range(1,14):
  for j in range(n):
    if a[j] == 'S %s' % i:
      break
    elif j==n-1:
      print 'S %s' % i
for i in range(1,14):
  for j in range(n):
    if a[j] == 'H %s' % i:
      break
    elif j==n-1:
      print 'H %s' % i
for i in range(1,14):
  for j in range(n):
    if a[j] == 'C %s' % i:
      break
    elif j==n-1:
      print 'C %s' % i
for i in range(1,14):
  for j in range(n):
    if a[j] == 'D %s' % i:
      break
    elif j==n-1:
      print 'D %s' % i
x, y = int(input())
if x % y == 0:
  print(-1)
else:
  print(x)

### FIXED CODE ###

x, y = map(int, input().split())
if x % y == 0:
  print(-1)
else:
  print(x)
a,b,x=map(int,input().split())
n=b-a+1
l=[0]*(n+1)
init=a
for i in range(1,n+1):
    if init%x==0:
        l[i]=l[i-1]+1
    else:
        l[i]=l[i-1]
    init+=1
    
print(l[-1]-l[1])

### FIXED CODE ###

#48-B
a,b,x=map(int,input().split())
b_count=b//x
a_count=(a-1)//x
print(b_count-a_count)
N = int(input())

ans = [0 for _ in range(10050)]
for x in range(1,int(N**0.5)+1):
    for y in range(1,int(N**0.5)+1):
        for z in range(1,int(N**0.5)+1):
            n = x**2 + y**2 + z**2 + x*y + y*z + z*x
            ans[n] += 1

for i in range(N):
    print(ans[i+1])

### FIXED CODE ###

n = int(input())
a = [0]*(n+1)
for i in range(1, 102):
    for j in range(1, 102):
        for k in range(1, 102):
            if (i*i + j*j + k*k + i*j + j*k + i*k) <= n:
                a[i*i + j*j + k*k + i*j + j*k + i*k] +=1
                
for x in a[1:]:
    print(x)
H, W, N = list(map(int, input().split()))
AB = [list(map(int, input().split())) for _ in range(N)]

from itertools import product

S = [set() for _ in range(10)]
# S[i]: set(黒いマスをi個こ含む3*3マスの中心セル)

for a,b in AB:
  for x,y in product([-1,0,1], repeat=2):
    X = a+x-1
    Y = b+y-1
    if X<=0 or H-1<=X or Y<=0 or W-1<=Y:
      continue
    for i in range(10):
      if (X, Y) in S[i]:
        S[i].remove((X, Y))
        S[i+1].add((X, Y))
        N[i] -=1
        N[i+1] +=1
        break
    else:
      S[1].add((X, Y))
      N[1] +=1
      N[0] -=1

L = [len(s) for s in S[1:]]
print((H-2)*(W-2) - sum(L))

for l in L:
  print(l)

### FIXED CODE ###

H, W, N = list(map(int, input().split()))
AB = [list(map(int, input().split())) for _ in range(N)]

from itertools import product

S = [set() for _ in range(10)]
# S[i]: set(黒いマスをi個こ含む3*3マスの中心セル)

for a,b in AB:
  for x,y in product([-1,0,1], repeat=2):
    X = a+x-1
    Y = b+y-1
    if X<=0 or H-1<=X or Y<=0 or W-1<=Y:
      continue
    for i in range(10):
      if (X, Y) in S[i]:
        S[i].remove((X, Y))
        S[i+1].add((X, Y))
        break
    else:
      S[1].add((X, Y))

L = [len(s) for s in S[1:]]
print((H-2)*(W-2) - sum(L))

for l in L:
  print(l)
from scipy.special import perm, comb
n, k = map(int, input().split())
for i in range(1, k+1):
	print( comb(k-1, i-1, exact=True)*comb(n-k+1, n-k-i+1, exact=True)%(10**9+7) )


### FIXED CODE ###

from scipy.misc import comb
n, k = map(int, input().split())
for i in range(1, k+1):
	print( comb(k-1, i-1, exact=True)*comb(n-k+1, n-k-i+1, exact=True)%(10**9+7) )
l=0
for i in range(2):
    l=l+int(input)
print(6-l)

### FIXED CODE ###

a=0
for i in range(2):
  a=a+int(input())
print(int(6-a))
X,Y,A,B,C = map(int,input().split())
P = list(map(int, input().split()))
Q = list(map(int, input().split()))
R = list(map(int, input().split()))

P_up = P[-X:]
Q_up = Q[-Y:]

P_up.append(Q_up)
P_up.extend(R)

P_up.sort()
a=-(X+Y)
print(sum(P_up[a:]))

### FIXED CODE ###

X,Y,A,B,C = map(int,input().split())
P = list(map(int, input().split()))
Q = list(map(int, input().split()))
R = list(map(int, input().split()))

R+=sorted(P)[-X:]
R+=sorted(Q)[-Y:]

a=-(X+Y)
print(sum(sorted(R)[a:]))
import sys
import collections
input = sys.stdin.readline
n = int(input())
xy = []
for i in range(n):
    _a,_b = map(int,input().split())
    xy.append([_a,_b])
sxy = sorted(xy)
sxy2 = []
for i in range(1,n):
    sxy2.append(((sxy[i][0]-sxy[i-1][0])**2)+((sxy[i][1]-sxy[i-1][1])**2))
c = collections.Counter(sxy2)
ans = len(sxy2)+1-max(c.values())
print(ans) if ans != 0 else print(1)


### FIXED CODE ###

import sys
input = sys.stdin.readline
n = int(input())
b = sorted([list(map(int,input().split())) for i in range(n)])
d = {}
for i in range(n):
    for j in range(i+1,n):
        x = (b[j][0]-b[i][0],b[j][1]-b[i][1])
        if x in d:
            d[x]+=1
        else:
            d[x]=1
if n==1:
    print(1)
else:
    print(n-max(d.values()))
def bfs(ind):
    kouho=friends[ind]
    for i in kouho:
        if sans[i]!=-1:
            continue
        sans[i]=sans[ind]
        l[sans[ind]].add(i)
        bfs(i)
n,m,k=list(map(int,input().split()))
f=[list(map(int,input().split())) for _ in range(m)]
friends=[set() for _ in range(n)]
friends_num=list(map(lambda x:len(x),friends))
bl=[list(map(int,input().split())) for _ in range(k)]
l=[{i} for i in range(n)]

for each in f:
    a,b=each
    friends[a-1].add(b-1)
    friends[b-1].add(a-1)

block=[set() for _ in range(n)]
for each in bl:
    a,b=each
    block[a-1].add(b-1)
    block[b-1].add(a-1)

sans=[-1 for _ in range(n)]
sans[0]=0
bfs(0)
for i in range(n):
    if sans[i]!=-1:
        continue
    sans[i]=i
    bfs(i)
ans=[0 for _ in range(n)]
for i in range(n):
    tmp=(l[sans[i]]-block[i])-friends[i]-{i}
    ans[i]=tmp
ans=" ".join(map(lambda x: str(len(x)),ans))
print(ans)

### FIXED CODE ###

import sys
sys.setrecursionlimit(10**5)
total=0
def bfs(ind,num):
    kouho=friends[ind]
    
    for i in kouho:
        if sans[i]!=-1:
            continue
        num+=1
        sans[i]=sans[ind]
        l[sans[ind]].add(i)
        num+=bfs(i,0)
    return num
n,m,k=list(map(int,input().split()))
f=[list(map(int,input().split())) for _ in range(m)]
friends=[set() for _ in range(n)]
friends_num=list(map(lambda x:len(x),friends))
bl=[list(map(int,input().split())) for _ in range(k)]
l=[{i} for i in range(n)]

for each in f:
    a,b=each
    friends[a-1].add(b-1)
    friends[b-1].add(a-1)

block=[set() for _ in range(n)]
for each in bl:
    a,b=each
    block[a-1].add(b-1)
    block[b-1].add(a-1)

sans=[-1 for _ in range(n)]
sans[0]=0
total=bfs(0,total)
for i in range(n):
    if sans[i]!=-1:
        continue
    sans[i]=i
    total=bfs(i,total)
ans=[0 for _ in range(n)]


for i in range(n):
    l[i]=set(l[i])


for i in range(n):
    tmp=l[sans[i]]
    ans[i]+=len(tmp)-len(friends[i])-1
    for j in block[i]:
        if sans[i]==sans[j]:
            ans[j]-=1

ans=" ".join(map(str,ans))
#print("total:",total)
print(ans)
a,b = map(int, input().split())

print(a*b a-b)

### FIXED CODE ###

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

print(a*b-a-b +1)
# -*- coding: utf-8 -*-

"""
参考：https://www.hamayanhamayan.com/entry/2018/01/28/231916
・深さ優先
・幅優先とほとんど一緒だけど練習用にこっちも書いた。
"""

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

l_edges = [[] for i in range(N)]
r_edges = [[] for i in range(N)]
for i in range(M):
    l, r, d = map(int, input().split())
    l_edges[l-1].append((r-1, d))
    r_edges[r-1].append((l-1, d))

# 訪問済メモ
visited = [0] * N

def dfs(cur):
    visited[cur] = 1
    # 左から見た右側を確認
    for r, d in l_edges[cur]:
        # 訪問済なら矛盾がないか検証する
        if visited[r]:
            if pos[r] - pos[cur] != d:
                print('No')
                exit()
        # 未訪問なら今回の情報を記録する
        else:
            visited[r] = 1
            pos[r] = pos[cur] + d
            # 確認した位置を次の現在位置として見に行く
            dfs(r)
    # 右から見た左側を確認
    for l, d in r_edges[cur]:
        if visited[l]:
            if pos[cur] - pos[l] != d:
                print('No')
                exit()
        else:
            visited[l] = 1
            pos[l] = pos[cur] - d
            dfs(l)

for i in range(N):
    # 訪問済(確認済)でなければ走破しに行く
    if not visited[i]:
        # この開始位置を基準とした相対位置を記録する
        pos = {i: 0}
        dfs(i)
        pos = {}
# 最後まで矛盾がなければOK
print('Yes')


### FIXED CODE ###

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

"""
参考：http://hamko.hatenadiary.jp/entry/2018/01/30/210057
　　　http://at274.hatenablog.com/entry/2018/02/03/140504
・重み付きUnion-Find木
"""

class WeightedUnionFind:
    def __init__(self, n):
        self.par = [i for i in range(n+1)]
        self.rank = [0] * (n+1)
        # 根への距離を管理
        self.weight = [0] * (n+1)

    # 検索
    def find(self, x):
        if self.par[x] == x:
            return x
        else:
            y = self.find(self.par[x])
            # 親への重みを追加しながら根まで走査
            self.weight[x] += self.weight[self.par[x]]
            self.par[x] = y
            return y

    # 併合
    def union(self, x, y, w):
        rx = self.find(x)
        ry = self.find(y)
        # xの木の高さ < yの木の高さ
        if self.rank[rx] < self.rank[ry]:
            self.par[rx] = ry
            self.weight[rx] = w - self.weight[x] + self.weight[y]
        # xの木の高さ ≧ yの木の高さ
        else:
            self.par[ry] = rx
            self.weight[ry] = - w - self.weight[y] + self.weight[x]
            # 木の高さが同じだった場合の処理
            if self.rank[rx] == self.rank[ry]:
                self.rank[rx] += 1

    # 同じ集合に属するか
    def same(self, x, y):
        return self.find(x) == self.find(y)

    # xからyへのコスト
    def diff(self, x, y):
        return self.weight[x] - self.weight[y]

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

wuf = WeightedUnionFind(N)
for i in range(M):
    x, y, w = map(int, input().split())
    # 同じ集合に属する場合は
    if wuf.same(x, y):
        # 記録された距離と今回の情報に矛盾がないか確認
        if wuf.diff(x, y) != w:
            print('No')
            exit()
    wuf.union(x, y, w)
# 全部無矛盾で木が構築できればOK
print('Yes')
N, Q=map(int, input().split())
S=input()
count=0
ac=[0]
for i in range(N-1):
  if S[i]=="A" and S[i+1]=="C":
    count+=1
  ac.append(count)
for _ in range(Q):
  l, r=map(int, input().split())
  l-=1, r-=1
  print(ac[r]-ac[l])

### FIXED CODE ###

N, Q=map(int, input().split())
S=input()
count=0
ac=[0]
for i in range(N-1):
  if S[i]=="A" and S[i+1]=="C":
    count+=1
  ac.append(count)
for _ in range(Q):
  l, r=map(int, input().split())
  l-=1
  r-=1
  print(ac[r]-ac[l])
a,b=map(int,input().split())
s=sum(map(int,input().split()))
print("Yes" ifs>=a else "No")

### FIXED CODE ###

a,b=map(int,input().split())
s=sum(map(int,input().split()))
print("Yes" if s>=a else "No")
N = int(input())
h = []
count = 0
for i in range(N):
    h.append(int(input()))
max = 0
for i in range(n):
    if max <= h[i]:
        max = h[i]
        count += 1
print(count)

### FIXED CODE ###

N = int(input())
h = list(map(int, input().split()))
count = 0
max = 0
for i in range(N):
    if max <= h[i]:
        max = h[i]
        count += 1
print(count)
n = int(input())
b = map(int, input().split())
a = [b[0]]
for i in range(1, n - 1):
  a.append(min(b[i - 1], b[i]))
a.append(b[-1])
print(sum(a))

### FIXED CODE ###

n = int(input())
b = list(map(int, input().split()))
a = [b[0]]
for i in range(1, n - 1):
  a.append(min(b[i - 1], b[i]))
a.append(b[-1])
print(sum(a))
S = input().split("/")
S[0] = "2018"

print("/".join(S))


### FIXED CODE ###

S = input().split("/")
S[0] = "2018"

print("/".join(S))
INF = 10**18

def dfs1(cur):
    for to in G1[cur]:
        if done1[to]: continue
        done1[to] = True
        dfs1(to)

def dfs2(cur):
    for to in G2[cur]:
        if done2[to]: continue
        done2[to] = True
        dfs2(to)

N, M, P = map(int, input().split())
G = []
G1 = [[] for i in range(N)]
G2 = [[] for i in range(N)]
for i in range(M):
    a, b, c = map(int, input().split())
    a -= 1
    b -= 1
    G.append((a, b, c-P))
    G1[a].append(b)
    G2[b].append(a)
D = [0]*N
for i in range(N):
    D[i] = -INF
D[0] = 0
for i in range(N):
    for j in range(M):
        fr, to, cost = G[j]
        if D[fr] != -INF and D[fr]+cost > D[to]:
            D[to] = D[fr]+cost
done1 = [False]*N
done1[0] = True
dfs1(0)
done2 = [False]*N
done2[N-1] = True
dfs2(N-1)
for _ in range(N):
    for j in range(M):
        fr, to, cost = G[j]
        if D[fr] != -INF and D[fr]+cost > D[to]:
            D[to] = D[fr]+cost
            if done1[to] and done2[to]:
                print(-1)
                exit()
if D[N-1] < 0:
    print(0)
else:
    print(D[N-1])


### FIXED CODE ###

import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)
INF = 10**18

def dfs1(cur):
    for to in G1[cur]:
        if done1[to]: continue
        done1[to] = True
        dfs1(to)

def dfs2(cur):
    for to in G2[cur]:
        if done2[to]: continue
        done2[to] = True
        dfs2(to)

N, M, P = map(int, input().split())
G = []
G1 = [[] for i in range(N)]
G2 = [[] for i in range(N)]
for i in range(M):
    a, b, c = map(int, input().split())
    a -= 1
    b -= 1
    G.append((a, b, c-P))
    G1[a].append(b)
    G2[b].append(a)
D = [0]*N
for i in range(N):
    D[i] = -INF
D[0] = 0
for i in range(N):
    for j in range(M):
        fr, to, cost = G[j]
        if D[fr] != -INF and D[fr]+cost > D[to]:
            D[to] = D[fr]+cost
done1 = [False]*N
done1[0] = True
dfs1(0)
done2 = [False]*N
done2[N-1] = True
dfs2(N-1)
for _ in range(N):
    for j in range(M):
        fr, to, cost = G[j]
        if D[fr] != -INF and D[fr]+cost > D[to]:
            D[to] = D[fr]+cost
            if done1[to] and done2[to]:
                print(-1)
                exit()
if D[N-1] < 0:
    print(0)
else:
    print(D[N-1])
a, b = input(),split()
if a == b:
    print("H")
else:
    print("D")


### FIXED CODE ###

a, b = input().split()
if a == b:
    print("H")
else:
    print("D")
N=int(input())
S=input
c=0
for i in range(0,N-2):
  if S[i:i+2]="ABC":
    c+=1
return c    

### FIXED CODE ###

N=int(input())
S=input()
c=0
for i in range(N-2):
  if S[i:i+3]=="ABC":
    c+=1
print(c)