Harryxun/stf_run huggingface dataset:
n=int(input())
H=list(map(int,input()))
ans=0
m=-1000
for i in range(n):
  if m<=H[i]:
    m=H[i]
    ans+=1
print(ans)


### FIXED CODE ###

n=int(input())
H=list(map(int,input().split()))
ans=0
m=-1000
for i in range(n):
  if m<=H[i]:
    m=H[i]
    ans+=1
print(ans)
a, b = input().split()

if a == 'H'
  if b == 'H':
  	print('H')
  else:
    print('D')

else:
  if b == 'H':
    print('D')
  else:
    print('H')
 

### FIXED CODE ###

a, b = input().split()
if a == 'H':
  print(b)
else:
  if b == 'H':
    print('D')
  else:
    print('H')
n, k = map(int, input().split())
cnt=0
for a in range(1,n+1):
    for b in range(k,n+1):
        if a%b>=k:
            cnt+=1
print(cnt)


### FIXED CODE ###

n, k = map(int, input().split())
cnt=0
if k==0:
    print(n*n)
else:
    for b in range(k+1,n+1):
        a_=int(n/b)
        cnt+=(b-k)*(a_)
        cnt+=max(n%b-k+1, 0)
    print(cnt)
n = str(input())
a =int(n[0:-3])
tens = int(n[-2])
need = tens*2
ones = int(n[-1])
if ones < 5:
    need += 1
else:
    need +=2

if need <= int(a):
    print(1)
else:
    print(0)


### FIXED CODE ###

n = str(input())
if len(n) <= 2:
    print(0)
else:
    a = n[0:-2]
    tens = int(n[-2])
    need = tens*2
    ones = int(n[-1])
    if ones == 0:
        need +=0
    elif ones <= 5:
        need += 1
    else:
        need +=2
    if need <= int(a):
        print(1)
    else:
        print(0)
from scipy.special import comb
import math
N=int(import())

if N==1 or N==2:
  ans=0
else N%2==0:
  ans=N/2-1
else:
  ans=N/2
  ans = math.floor(ans)
print(ans)

### FIXED CODE ###

N=int(input())
if N==1 or N==2:
  ans=0
elif N%2==0:
  ans=(N/2)-1
else:
  ans=N//2  
print(int(ans))
s = list(map(int, input()))
k = int(input())

ans = 1

for i in range(len(k)):
	if s[i] != 1:
		ans = s[i]
		break

print(ans)
		
	

### FIXED CODE ###

s = list(map(int, input()))
k = int(input())

i=0

while i <= k-1:
	if s[i] == 1:
		ans = 1
		i += 1
	else:
		ans = s[i]
		break

print(ans)
from math import *
n = int(input())
ps = set(range(2, 55556))
for i in range(2, frool(sqrt(55555))):
    if i in ps:
        k = 2
        while(i*k <= 55555):
            ps.remove(i*k)
            k += 1
ans = []
i = 2
while len(ans) < n and i <= 55555:
    if i in ps:
        ans.append(i)
    i += 5
print(*ans)

### FIXED CODE ###

from math import *
n = int(input())
ps = set(range(2, 55556))
for i in range(2, floor(sqrt(55555) + 1)):
    if i in ps:
        k = 2
        while(i*k <= 55555):
            if i*k in ps:
                ps.remove(i*k)
            k += 1
ans = []
i = 2
while len(ans) < n and i <= 55555:
    if i in ps:
        ans.append(i)
    i += 5
print(*ans)
a=int(input())
b=float(input())
b=b*100
p=int((a*b)/100)
print(p)



### FIXED CODE ###

from decimal import*
a,b=input().split()
da=Decimal(a)
db=Decimal(b)
print(da*db//1)
temp1 = input()
r1 = temp1.split()
for j in range(len(r1)):
    r1[j] = int(r1[j])
temp2 = input()
r2 = temp2.split()
for j in range(len(r2)):
    r2[j] = int(r2[j])
temp3 = input()
r3 = temp3.split()
for j in range(len(r3)):
    r3[j] = int(r3[j])

r_d1 = [i for i in range(3)]
r_d2 = [i for i in range(3)]
for i in range(3):
    r_d1[i] = r2[i]-r1[i]
    r_d2[i] = r3[i]-r1[i]
if r_d1.count(r_d1[0]) == 3:
    flag = 1
else:flag = 0

if r_d2.count(r_d2[0]) == 3:
    flag = flag*1
else:flag = flag*0

if flag == 1:
    print("Yes")
else:print("No")

### FIXED CODE ###


N = input()
A = input()

N = int(N)
A = int(A)

rest = N % 500

if rest<=A:
    print("Yes")

else:
    print("No")
N = int(input())
points = list(map(int, input().split(" ")))

powers = []
for i in range(min(points), max(points)):
    power = 0
    for point in points:
        power += ((i - point) ** 2)
    powers.append(power)

print(min(powers))


### FIXED CODE ###

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

powers = []
for i in range(min(points), max(points) + 1):
    power = 0
    for point in points:
        power += ((i - point) ** 2)
    powers.append(power)

print(min(powers))
def main():
    import copy
    H,W,K=map(int,input().split())
    S=[]
    for _ in range(H):
        S.append([int(x) for x in list(input())])

    ans=(H-1)+(W-1)

    for i in range(2**(H-1)):
        check=[0]*H
        for j in range(H-1):
            if ((i>>j)&1):
                check[j+1]=check[j]+1
            else:
                check[j+1]=check[j]

        g=check[H-1]+1
        A=[0]*g
        c=0
        f=0
        for j in range(W):
            B=[0]*g
            for k in range(H):
                if S[k][j]==1:
                    B[check[k]]+=1
                if B[check[k]]>K:
                    c=10**4
                    f=1
                    break
            if f:
                break
            #print("AB",A,B)
            for l in range(g):
                if B[l]==0:
                    continue
                elif A[l]+B[l]>K:
                    c+=1
                    A=copy.copy(B)
                    break
                else:
                    A[l]+=B[l]
        ans=min(ans,c+g-1)

print(ans)




if __name__ == '__main__':
    main()

### FIXED CODE ###

import copy
H,W,K=map(int,input().split())
S=[]
for _ in range(H):
    S.append([int(x) for x in list(input())])

ans=(H-1)+(W-1)

for i in range(2**(H-1)):
    check=[0]*H
    for j in range(H-1):
        if ((i>>j)&1):
            check[j+1]=check[j]+1
        else:
            check[j+1]=check[j]
    
    g=check[H-1]+1
    A=[0]*g
    c=0
    f=0
    for j in range(W):
        B=[0]*g
        for k in range(H):
            if S[k][j]==1:
                B[check[k]]+=1
            if B[check[k]]>K:
                c=10**4
                f=1
                break
        if f:
            break
        #print("AB",A,B)
        for l in range(g):
            if A[l]+B[l]>K:
                c+=1
                A=copy.copy(B)
                break
            else:
                A[l]+=B[l]
    ans=min(ans,c+g-1)

print(ans)
class Node:
    def __init__(self, idx):
        self.idx = idx
        self.v = 0
        self.parent = None
        self.children = []
        self.connections = []
        self.level = -1

    def set_children(self):
        self.children = self.connections
        for node in self.connections:
            if self in node.connections:
                node.connections.remove(self)
            node.set_children()

    def add(self, x):
        self.v += x
        for c in self.children:
            c.add(x)

    def __str__(self):
        return str(self.v)


N, Q = [int(_) for _ in input().split()]
nodes = [Node(i) for i in range(1, N + 1)]

for i in range(N - 1):
    a, b = [int(_) - 1 for _ in input().split()]
    nodes[a].connections.append(nodes[b])
    nodes[b].connections.append(nodes[a])

nodes[0].set_children()

# for n in nodes:
#     print(n.v, [str(c) for c in n.children])
for i in range(Q):
    p, x = [int(_) for _ in input().split()]
    nodes[p - 1].add(x)

print(*[n.v for n in nodes])

### FIXED CODE ###

import sys
from collections import deque

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

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

edges = [[] for _ in range(N + 1)]
for i in range(N - 1):
    a, b = [int(_) for _ in input().split()]
    edges[a].append(b)
    edges[b].append(a)

P = [0] * (N + 1)

for q in range(Q):
    p, x = [int(_) for _ in input().split()]
    P[p] += x

que = deque()
que.append((1, 0))

while que:
    v, parent = que.popleft()
    P[v] += P[parent]
    for next_v in edges[v]:
        if next_v == parent: continue
        que.append((next_v, v))

# def f(v, parent=0):
#     P[v] += P[parent]
#
#     for next_v in edges[v]:
#         if next_v == parent: continue
#         f(next_v, v)
#
#
# f(1)
print(*[P[i] for i in range(1, N + 1)])
W=np.zeros(w)
for i in range(m):
    hi,wi=hw[i]
    H[hi-1]+=1
    W[wi-1]+=1
hmax=[i for i, x in enumerate(H) if x == max(H)]
wmax=[i for i, x in enumerate(W) if x == max(W)]
ans=0
mh=max(H)
mw=max(W)
for hi in hmax:
    for wi in wmax:
        if not ([hi+1,wi+1] in hw):
            ans=mh+mw
            print(int(ans))
            exit()
ans=mh+mw-1
print(int(ans))

### FIXED CODE ###

import numpy as np
h,w,m=map(int, input().split())
hw=[tuple(map(int,input().split())) for i in range(m)]
H=np.zeros(h)
W=np.zeros(w)
for i in range(m):
    hi,wi=hw[i]
    H[hi-1]+=1
    W[wi-1]+=1
mh=max(H)
mw=max(W)
hmax=[i for i, x in enumerate(H) if x == mh]
wmax=[i for i, x in enumerate(W) if x == mw]
f=0
for i in range(m):
    hi,wi=hw[i]
    if H[hi-1]==mh and W[wi-1]==mw:
        f+=1
if len(hmax)*len(wmax)-f<1:
    print(int(mh+mw-1))
else:
    print(int(mh+mw))
n = int(input())
a = list(map(int, input().split()))
ans = [0] * n
for i in range(n):
    ans[a[i]-1]=i+1
print(*ans)

### FIXED CODE ###

n = int(input())
if n % 2 == 0: print(1 / 2)
else: print((n+1)/2/n)
import math


def main():
  
	n = int(input())
    a = list(map(int, input().split()))
    print(solution(n, a))  
    gcd_left = [0]
    gcd_right = [0]
    for i in range(n):
        gcd_left.append(math.gcd(gcd_left[i], a[i]))
        # 順に(0とa[-1]), (a[-1]とa[-2]),...の比較
        # 要は右端から順にgcdを求めている
        gcd_right.append(math.gcd(gcd_right[i], a[-(i + 1)]))

    gcd_right = gcd_right[::-1]  # gcd_right[i]がi番目以降のgcdとなるように反転

    ans = []
    for i in range(n):
        ans.append(math.gcd(gcd_left[i], gcd_right[i + 1]))


    return max(ans)

if __name__ == '__main__':
  
    main()

### FIXED CODE ###

import unittest
import fractions


def solution(n, a):
    gcd_left = [0]
    gcd_right = [0]
    for i in range(n):
        gcd_left.append(fractions.gcd(gcd_left[i], a[i]))
        # 順に(0とa[-1]), (a[-1]とa[-2]),...の比較
        # 要は右端から順にgcdを求めている
        gcd_right.append(fractions.gcd(gcd_right[i], a[-(i + 1)]))

    gcd_right = gcd_right[::-1]  # gcd_right[i]がi番目以降のgcdとなるように反転

    ans = []
    for i in range(n):
        ans.append(fractions.gcd(gcd_left[i], gcd_right[i + 1]))


    return max(ans)


class MyTestCase(unittest.TestCase):
    def test1(self):
        self.assertEqual(solution(3, [7, 6, 8]), 2)

    def test2(self):
        self.assertEqual(solution(3, [12, 15, 18]), 6)

    def test3(self):
        self.assertEqual(solution(2, [1000000000, 1000000000]), 1000000000)




if __name__ == '__main__':

    n = int(input())
    a = list(map(int, input().split()))
    print(solution(n, a))

    unittest.main()
import sys
 
args = sys.argv
 
length = args[1]
focus = args[2]
abcs = args[3]
 
 
def change_upper_to_lower(str, num):
  
  before = str[:int(num) - 1]
  print(before)
  after = str[int(num):]
  print(after)

  if(str[int(num) - 1] == "A"):
    newstr = before + "a" + after
  elif(str[int(num) - 1] == "B"):
    newstr = before + "b" + after
  else:
    newstr = before + "c" + after
    
  return newstr
 
 
changed_abcs = change_upper_to_lower(abcs, focus)
 
print(changed_abcs)

### FIXED CODE ###

import sys

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

abcs = input()
 
def change_upper_to_lower(str, num):
  
  before = str[:int(num) - 1]
  after = str[int(num):]

  if(str[int(num) - 1] == "A"):
    newstr = before + "a" + after
  elif(str[int(num) - 1] == "B"):
    newstr = before + "b" + after
  else:
    newstr = before + "c" + after
    
  return newstr
 
 
changed_abcs = change_upper_to_lower(abcs, b)
 
print(changed_abcs)
a, b, k = map(int, input().split())
divs = []

for i in range(1, min(a, b)):
    if a % i == 0:
        if b % i == 0:
            divs.append(i)
print(divs[-k])

### FIXED CODE ###

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

for i in range(min(a, b), 0, -1):
    if a % i == 0 and b % i == 0:
        k -= 1
        if k == 0:
            print(i)
from cmath import pi, exp

def convolve(a, b):
    """配列a, bの畳み込みをFFT(fast Fourier transform)によって計算する
    res[k] = sum{i=0...n}a[i]*b[k-i]
    """
    def fft(a, inverse=False):
        # バタフライ演算用の配置入れ替え
        for i in range(n):
            j = 0
            for k in range(h):
                j |= (i >> k & 1) << (h - 1 - k)
            if i < j:
                a[i], a[j] = a[j], a[i]
 
        # バタフライ演算
        sign = 1.0 if inverse else -1.0
        b = 1
        while b < n:
            for j in range(b):
                w = exp(sign * 2.0j * pi / (2.0 * b) * j)
                for k in range(0, n, b*2):
                    s = a[j + k]
                    t = a[j + k + b] * w
                    a[j + k] = s + t
                    a[j + k + b] = s - t
            b *= 2
 
        # 逆変換時には配列のサイズで割る
        if inverse:
            for i in range(n):
                a[i] /= n
        return a
 
    def ifft(a):
        return fft(a, inverse=True)
 
    n = 1 << (len(a) + len(b) - 1).bit_length()
    h = n.bit_length() - 1
    a += [0] * (n - len(a))
    b += [0] * (n - len(b))
    
    # in-placeで計算を進めることに注意
    fft(a), fft(b)
    for i in range(n):
        a[i] *= b[i]
    ifft(a)
 
    res = [int(abs(v) + 0.5) for i, v in enumerate(a)]
    return res[1:]

import sys
input = sys.stdin.readline
n,m = map(int, input().split())
a = list(map(int, input().split()))
 
cnt = [0] * (10010)
for i in a:
    cnt[i] += 1 

c = convolve(cnt[0:], cnt[0:])
ans = 0
for i in range(len(c))[::-1]:
    if c[i] > 0:
      p = min(m,c[i])
      m -= p
      ans += i*p+p
      if m == 0:
        break
print(ans)

### FIXED CODE ###

import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
from bisect import bisect_left

n,m = map(int,readline().split())
a = list(map(int,readline().split()))

b = [0]*(n+1)
a.sort()
for i in range(n):
  b[i+1] = b[i]+a[i]

def is_ok(arg):
    c = 0
    f = False
    for i in a:
      if c >= m:
        break
      c += (n-bisect_left(a,arg-i))
    if c >= m:
      f = True
    return f

def bisect_ok(ng, ok):
    while (abs(ok - ng) > 1):
        mid = (ok + ng) // 2
        if is_ok(mid):
            ok = mid
        else:
            ng = mid
    return ok

x = bisect_ok(2*a[-1]+1,1)
ans = 0
cnt = 0
for i in a:
  ind = n-bisect_left(a,x-i)
  cnt += ind
  ans += i*ind+(b[-1]-b[n-ind])
if cnt > m:
  ans -= x*(cnt-m)
print(ans)
n,k = map(int,input().split())
a = list(map(int,input().split()))

b = []
for i in range(n):
    r = 0
    for j in range(i,n):
        r += a[j]
        b.append(r)


n2 = n*(n+1)//2

res = 0
for i in range(31):
    p = res + 2**(30-i)
    
    c = 0
    for j in range(n2):
        if p == p&b[j]:
            c+=1
    
    if c >= k:
        res = p

print(res)

### FIXED CODE ###

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

b = sum(a)/n
for i in range(n):
    a[i] = abs(a[i]-b)

k = a.index(min(a))
print(k)
import sys
input = sys.stdin.readline
import numpy as np
sys.setrecursionlimit(10**6)

N = int(input())
graph = [[] for _ in range(N+1)] # parent to child
for i,p in enumerate(input().split(),2):
    graph[int(p)].append(i)
X = [None] + [int(x) for x in input().split()]

def dfs(v):
    # None または 白、黒の2つ組を返す
    child = []
    for w in graph[v]:
        c = dfs(w)
        if c is None:
            return None
        child.append(c)
    S = sum(a+b for a,b in child)
    x = X[v]
    dp = np.zeros(x+1, dtype=np.bool) # 2択の繰り返しで作れる和
    dp[0] = 1
    for a,b in child:
        prev = dp
        dp = np.zeros_like(prev)
        dp[a:] = prev[:x+1-a]
        dp[b:] |= prev[:x+1-b]
    nz = np.nonzero(dp)[0]
    if len(nz) == 0:
        return None
    return x, S - nz[-1]

answer = 'POSSIBLE' if dfs(1) is not None else 'IMPOSSIBLE'
print(answer)



### FIXED CODE ###

import sys
input = sys.stdin.readline
import numpy as np
sys.setrecursionlimit(10**6)

N = int(input())
graph = [[] for _ in range(N+1)] # parent to child
for i,p in enumerate(input().split(),2):
    graph[int(p)].append(i)
X = [None] + [int(x) for x in input().split()]

def dfs(v):
    # None または 白、黒の2つ組を返す
    child = []
    for w in graph[v]:
        c = dfs(w)
        if c is None:
            return None
        child.append(c)
    S = sum(a+b for a,b in child)
    x = X[v]
    dp = np.zeros(x+1, dtype=np.bool) # 2択の繰り返しで作れる和
    dp[0] = 1
    for a,b in child:
        prev = dp
        dp = np.zeros_like(prev)
        if a <= x:
            dp[a:] = prev[:x+1-a]
        if b <= x:
            dp[b:] |= prev[:x+1-b]
    nz = np.nonzero(dp)[0]
    if len(nz) == 0:
        return None
    return x, S - nz[-1]

answer = 'POSSIBLE' if dfs(1) is not None else 'IMPOSSIBLE'
print(answer)
def gcd(a,b):
    if a < b:
        a, b = b, a
    while a % b != 0:
        a, b = b, a % b
    return b

def main():
    A,B,C,D=map(input().split())
    if A%C!=0:
        C_min=A-A%C+C
    else:
        C_min=A
    C_max=B-B%C
    if A%D!=0:
        D_min=A-A%D+D
    else:
        D_min=A
    D_max=B-B%D
    if A%(C*D/gcd(C,D))!=0:
        CD_min=A-A%(C*D/gcd(C,D))+(C*D/gcd(C,D))
    else:
        CD_min=A
    CD_max=B-B%(C*D/gcd(C,D))
    C_sum=(C_max-C_min)/C+1
    D_sum=(D_max-D_min)/D+1
    CD_sum=(CD_max-CD_min)/(C*D/gcd(C,D))+1
    sum= B-A+1-int(C_sum+D_sum-CD_sum)
    return sum
 
print(main())

### FIXED CODE ###

def gcd(a,b):
    if a < b:
        a, b = b, a
    while a % b != 0:
        a, b = b, a % b
    return b
def main():
    A,B,C,D=map(int,input().split())
    if A%C!=0:
        C_min=A-A%C+C
    else:
        C_min=A
    C_max=B-B%C
    if A%D!=0:
        D_min=A-A%D+D
    else:
        D_min=A
    D_max=B-B%D
    mod=C*D//gcd(C,D)
    if A%mod!=0:
        CD_min=A-A%mod+mod
    else:
        CD_min=A
    CD_max=B-B%mod
    C_sum=(C_max-C_min)//C
    D_sum=(D_max-D_min)//D
    CD_sum=(CD_max-CD_min)//mod
    sum= B-A+1-int(C_sum+D_sum-CD_sum+1)
    return sum
print(int(main()))
# from fractions import gcd
from math import gcd
from functools import reduce
N, M = map(int, input().split())
nums = set([num // 2 for num in list(map(int, input().split()))])
# 1<=X<=Mの範囲で、半公倍数の数を求める。
# 但し、Xは、num*(p+0.5)でなければならない
# Mが10**9なので、全部やるのは無理。
# n.5倍なので、numsのあたいは全て偶数になっている。

# nums一つ一つ、答えになりうるXの配列を作って、重複したものを残せばそれが答えになる。
# Nが10**5なので、どうだろう


def half_multiple(x, y):
    return (x * y) // gcd(x, y)


def run():
    half_multiple_num = reduce(half_multiple, nums, 1)

    # print(half_multiple_num)
    for num in nums:
        if (half_multiple_num // num) % 2 == 0:
            print(0)
            return

    pmax = M // half_multiple_num
    pmax = pmax - 1 if pmax % 2 == 0 else pmax

    print((pmax + 1) // 2)


run()


### FIXED CODE ###

from fractions import gcd
# from math import gcd
from functools import reduce
N, M = map(int, input().split())
nums = set([num // 2 for num in list(map(int, input().split()))])
# 1<=X<=Mの範囲で、半公倍数の数を求める。
# 但し、Xは、num*(p+0.5)でなければならない
# Mが10**9なので、全部やるのは無理。
# n.5倍なので、numsのあたいは全て偶数になっている。

# nums一つ一つ、答えになりうるXの配列を作って、重複したものを残せばそれが答えになる。
# Nが10**5なので、どうだろう


def half_multiple(x, y):
    return (x * y) // gcd(x, y)


def run():
    half_multiple_num = reduce(half_multiple, nums, 1)

    # print(half_multiple_num)
    for num in nums:
        if (half_multiple_num // num) % 2 == 0:
            print(0)
            return

    pmax = M // half_multiple_num
    pmax = pmax - 1 if pmax % 2 == 0 else pmax

    print((pmax + 1) // 2)


run()
import numpy as np
 
n=int(input())
w=list(map(int, input().split()))
s=[0]*n
 
for i in range(n):
  a = np.sum(w[:i])
  b = np.sum(w)
  c = b - a
  s[i] = abs(a-c)
  
print(int(np.min(s)))

### FIXED CODE ###

import numpy as np
 
n=int(input())
w=list(map(int, input().split()))
s=[0]*n
 
for i in range(n):
  a = np.sum(w[:i])
  b = np.sum(w)
  c = b - a
  s[i] = abs(a-c)
  
print(int(np.min(s)))
n = int(input())
num = 10**9 + 7
print(factorial(n) % numß)

def factorial(n):
    if n == 1:
        return n
    return n * factorial(n-1)

### FIXED CODE ###

import math

n = int(input())
num = 10**9 + 7
print(math.factorial(n) % num)
print(max(int(input())-int(input()), 0))

### FIXED CODE ###

x, t = [int(i) for i in input().split()]
ans = max(x-t, 0)
print(ans)
print(r*r*3)


### FIXED CODE ###

r=int(input())
ans=r*r*3
print(ans)
[a,b,t] = (input().split(" "))
print((t//a)*b)

### FIXED CODE ###

[a,b,t] = map(int,input().split(" "))
print((t//a)*b)
n = input()
b = ['{0:b}'.format(int(x)) for x in input().split()]
a = 0
for c in b:
    m = re.match(r'.*(10*)$',c)
    print(m[1])   
    if m is None:
      continue
    a = max(a,len(m[1])-1)
print(a)

### FIXED CODE ###

n = input()
b = [int(x) for x in input().split()]
c = 0
flg = True
while flg:
    for i,x in enumerate(b):
        if x!=0 and x%2 != 0:
            flg=False
            break
        b[i] = int(x/2)
    c += 1
print(c-1)
W = input()

while True:
    line = input()
    if line == 'END_OF_TEXT':
        break

    for s in line.split():
        if s == W:
            count += 1

print(count)

### FIXED CODE ###

W = input()

count = 0
while True:
    line = input()
    if line == 'END_OF_TEXT':
        break

    for s in line.lower().split():
        if s == W:
            count += 1

print(count)
x,a,b=map(int,input().split())
print("delicious")if a>b print("safe")elif x+a>b else print("dangerous")

### FIXED CODE ###

x,a,b=map(int,input().split())
if a>=b:
  print("delicious")
elif x+a>=b:
  print("safe")
else:
  print("dangerous")
import numpy
N=int(input())
A=input().split()
for i in range(N):
    A[i]=2*int(A[i])
x=[None]*N
for i in range(N-1):
    x[i]=[0]*N
    x[i][i],x[i][i+1]=1,1
x[N-1]=[0]*N
x[N-1][0],x[N-1][N-1]=1,1
y=numpy.linalg.solve(x,A)
for i in range(N):
    print(int(y[i]),end=' ')


### FIXED CODE ###

import sys
def input():
    return sys.stdin.readline()[:-1]
N=int(input())
A=list(map(int,input().split()))
y=0
for i in range(N-1):
    y=2*(A[i]-y//2)
l=[None]*N
l[0]=(2*A[-1]-y)//2
for i in range(1,N):
    l[i]=2*(A[i-1]-l[i-1]//2)
print(*l)
N = int(input())
A = list(map(int,input().split()))

if 0 in A:
    print(0)
else:
    x = 1
    for i in range(N):
        x = x * A[i]
        if x>10**18:
            x = -1
    print(x)

### FIXED CODE ###

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

print(a*b)
n, k = map(int, input().split())
r, s, p = map(int, input().split())
t = list(map(str, input().rstrip()))

cir = defaultdict(list)
for i in range(k):
    cir[i] = t[i::k]


def solve(sq):
    # 初手
    x = sq[0]
    if x == "r":
        before, score = "r", p
    elif x == "s":
        before, score = "s", r
    else:
        before, score = "p", s
    cnt = 1

    # 前回と違う手なら問答無用で勝てる、前回と同じ手なら奇数回目に勝てる
    for x in sq[1:]:
        if before != x:
            if x == "r":
                score += p
            elif x == "s":
                score += r
            else:
                score += s
            before = x
            cnt = 1
        elif cnt % 2 == 1:
            cnt += 1
        else:
            if x == "r":
                score += p
            elif x == "s":
                score += r
            else:
                score += s
            cnt += 1
    return score


ans = []
for i in range(k):
    ans.append(solve(cir[i]))

print(sum(ans))

### FIXED CODE ###

from collections import defaultdict

n, k = map(int, input().split())
r, s, p = map(int, input().split())
t = list(map(str, input().rstrip()))

cir = defaultdict(list)
for i in range(k):
    cir[i] = t[i::k]


def solve(sq):
    # 初手
    x = sq[0]
    if x == "r":
        before, score = "r", p
    elif x == "s":
        before, score = "s", r
    else:
        before, score = "p", s
    cnt = 1

    # 前回と違う手なら問答無用で勝てる、前回と同じ手なら奇数回目に勝てる
    for x in sq[1:]:
        if before != x:
            if x == "r":
                score += p
            elif x == "s":
                score += r
            else:
                score += s
            before = x
            cnt = 1
        elif cnt % 2 == 1:
            cnt += 1
        else:
            if x == "r":
                score += p
            elif x == "s":
                score += r
            else:
                score += s
            cnt += 1
    return score


ans = []
for i in range(k):
    ans.append(solve(cir[i]))

print(sum(ans))