Harryxun/stf_run huggingface dataset:
N,M = map(int,input().split())
S = input()
N0 = 2**(N+1).bit_length()
INF = 2**31-1

# k番目の要素をxに更新
def update(k, x, data):
    k += N0-1
    data[k] = x
    while k >= 0:
        k = (k - 1) // 2
        data[k] = min(data[2*k+1], data[2*k+2])

# [l,r)の最小値
def query(l, r, data):
    L = l + N0; R = r + N0
    s = INF
    while L < R:
        if R & 1:
            R -= 1
            s = min(s, data[R-1])

        if L & 1:
            s = min(s, data[L-1])
            L += 1
        L >>= 1; R >>= 1
    return s



data1 = [INF]*(2*N0)
update(0,0,data1)
for n in range(N):
    if S[n+1]=='0':
        update(n+1,query(n-M+1,n+1,data1)+1,data1)

S = S[::-1]
data2 = [INF]*(2*N0)
update(0,0,data2)
for n in range(N):
    if S[n+1]=='0':
        update(n+1,query(n-M+1,n+1,data2)+1,data2)

cost1 = [INF]*(N+1)
cost2 = [INF]*(N+1)
for n in range(N+1):
    cost1[n] = query(n,n+1,data1)
    cost2[n] = query(N-n,N-n+1,data2)

ans = []
cost = 0
for n in range(N+1):
    if cost != cost1[n] and cost1[n]+cost2[n]==cost1[N]:
        ans.append(n)
        cost = cost1[n]
ans = [0]+ans
for i in range(len(ans)-2,-1,-1):
    ans[i+1] = ans[i+1]-ans[i]

ans = ' '.join([str(c) for c in ans[1:]])
if cost2[0]==INF:
    ans = '-1'
print(ans)


### FIXED CODE ###

N,M = map(int,input().split())
S = input()
N0 = 2**(N-1).bit_length()
INF = 2**31-1

# k番目の要素をxに更新
def update(k, x, data):
    k += N0-1
    data[k] = x
    while k >= 0:
        k = (k - 1) // 2
        data[k] = min(data[2*k+1], data[2*k+2])

# [l,r)の最小値
def query(l, r, data):
    L = l + N0; R = r + N0
    s = INF
    while L < R:
        if R & 1:
            R -= 1
            s = min(s, data[R-1])

        if L & 1:
            s = min(s, data[L-1])
            L += 1
        L >>= 1; R >>= 1
    return s



data1 = [INF]*(3*N0)
update(0,0,data1)
for n in range(N):
    if S[n+1]=='0':
        update(n+1,query(max(0,n-M+1),n+1,data1)+1,data1)

S = S[::-1]
data2 = [INF]*(3*N0)
update(0,0,data2)
for n in range(N):
    if S[n+1]=='0':
        update(n+1,query(max(0,n-M+1),n+1,data2)+1,data2)

cost1 = [INF]*(N+1)
cost2 = [INF]*(N+1)
for n in range(N+1):
    cost1[n] = query(n,n+1,data1)
    cost2[n] = query(N-n,N-n+1,data2)

ans = []
cost = 0
for n in range(N+1):
    if cost != cost1[n] and cost1[n]+cost2[n]==cost1[N]:
        ans.append(n)
        cost = cost1[n]
ans = [0]+ans
for i in range(len(ans)-2,-1,-1):
    ans[i+1] = ans[i+1]-ans[i]

ans = ' '.join([str(c) for c in ans[1:]])
if cost2[0]==INF:
    ans = '-1'
print(ans)
from collections import Counter, defaultdict
from math import sqrt

MOD = 10**9+7
p_list = defaultdict(int)

def prime_decomposition(n):
    i = 2
    table = []
    while i * i <= n:
        while n % i == 0:
            n /= i
            table.append(i)
        i += 1
    if n > 1:
        table.append(n)
    return table


def main():
    N = int(input())
    a = [int(i) for i in input().split()]

    for i in a:
        l = Counter(prime_decomposition(i))
        for k, v in l.items():
            p_list[k] = max(p_list[k], v)
    
    lcm = 1
    for k, v in p_list.items():
        lcm *= k**v

    ans = 0
    for i in a:
        ans += lcm // i

    print(int(ans) % MOD)


if __name__ == "__main__":
    main()


### FIXED CODE ###

from functools import reduce
from fractions import gcd

MOD = 10**9+7

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

def main():
    N = int(input())
    a = [int(i) for i in input().split()]

    lcm = reduce(lcm_base, a, 1)
    
    ans = 0
    for i in a:
        ans += lcm // i

    print(ans % MOD)


if __name__ == "__main__":
    main()
n = str(input())
if n[0] == "1":
    tmpint = eval("9"*(len(n)-1))
    #print("tmpint",tmpint)
else:
    tmpint = eval(str(eval(n[0])-1) + "9"*(len(n)-1))
    #print("tmpint",tmpint)
tmpsum = sum([
        eval(str(tmpint)[i]) for i in range(len(str(tmpint)))
    ])
ssum = sum([
        eval(n[i]) for i in range(len(str(n)))
    ])
print(max(tmpsum,ssum))
#print(tmpsum,ssum)

### FIXED CODE ###

n = str(input())
if n == "1":
    print(1)
    exit()
if n[0] == "1":
    tmpint = eval("9"*(len(n)-1))
    #print("tmpint",tmpint)
else:
    tmpint = eval(str(eval(n[0])-1) + "9"*(len(n)-1))
    #print("tmpint",tmpint)
tmpsum = sum([
        eval(str(tmpint)[i]) for i in range(len(str(tmpint)))
    ])
ssum = sum([
        eval(n[i]) for i in range(len(str(n)))
    ])
print(max(tmpsum,ssum))
#print(tmpsum,ssum)
import numpy as np

n, m = map(int, input().split())
lists = list(map(int, input().split()))

arr = np.array(lists)
days = arr.sum()

if days >= 0:
  print(int(n - days))
else:
  print('-1')

### FIXED CODE ###

import numpy as np

n, m = map(int, input().split())
lists = list(map(int, input().split()))

arr = np.array(lists)
days = arr.sum()

if n - days >= 0:
    print(int(n - days))
else:
    print('-1')
maximum = 0
for u in range(K):
    for i in u:
        frontSum = 0
        frontList = []
        backSum = 0
        backList = []
        for o in range(i):
            frontSum += V[o]
            frontList.append(V[o])
        for o in range(len(V)-(K-i), len(V)):
            backSum += V[o]
            backList.append(V[o])
        total = frontSum + backSum
        if total > maximum:
            maximum = total
        frontList.sort()
        backList.sort()
        for p in range(K-u):
            frontList = frontLIst[p:]
            newFrontSum = 0
            for k in frontList:
                newFrontSum += k
            if newFrontSum > frontSum:
                frontSum = newFrontSum
            for j in range(K-u-p):
                backList = backList[p:]
                newBackSum = 0
                for k in backList:
                    nweBackSum += k
                if newBackSum > backSum:
                    backSum = newBackSum
        newTotal = backSum + frontSum
        if newTotal > maximum:
            maximum = newTotal
print(maximum)


### FIXED CODE ###

N, K = map(int, input().strip().split())
V = list(map(int, input().strip().split()))
H = []
maxi = 0
for i in range(min(N, K)):
    for o in range(i+2):  # error1
        ts = 0
        hand = []
        for p in range(o):
            hand.append(V[p])
        for p in range(N-(i-o)-1, N):  # error2
            hand.append(V[p])
        for values in hand:
            ts += values
        if ts > maxi:
            maxi = ts
        if len(hand) > 0:
            hand.sort()
            for j in range(K-i-1):  # error3
                if len(hand) > 0:
                    if hand[0] < 0:
                        del hand[0]
                    else:
                        break
        ts = 0
        for k in hand:
            ts += k
        if ts > maxi:
            maxi = ts
print(maxi)
x,y = map(int,input().split())
min1 = 2019
n = y-x
i=0
while(i<n):
  s = (x + i) % 2019
  i = i +1
  if s == 0:
    print(s)
    break
  elif min1 > s:
    min1 = s:
minmin = 2019
j=0
while(j<n):
  g = (x + j) % 2019
  j=j+1
  if g == 0:
    break
  elif minmin > g and g == s:
    minmin =g

if s != 0:
  z = (min1*minmin)%2019
  print(z)


### FIXED CODE ###

l, r = map(int, input().split())

min = 2019

for i in range(l, r+1):
    for j in range(i+1, r+1):
        p = (i % 2019)*(j % 2019) % 2019
        if p < min:
            min = p

        if min == 0:
            print("0")
            exit()

print(min)
from math import factorial as fact
import sys
input = sys.stdin.readline

N, M = map(int, input().split())
num = []
p_flag = [True]*(int(M**0.5)+1)

for i in range(2, int(M**0.5)+2):
    if p_flag:
        for j in range(2*i, int(M**0.5)+2, i):
            p_flag[j] = False

        cnt = 0
        while M % i == 0:
            cnt += 1
            M //= i
        if cnt > 0:
            num.append(cnt)
        if M == 1:
            break
else:
    num.append(1)

ans = 1
for i in num:
    ans = (ans * fact(N-1+i)//(fact(i)*fact(N-1))) % (10**9+7)
print(ans)

### FIXED CODE ###

from math import factorial as fact
from operator import mul
from functools import reduce
import sys
input = sys.stdin.readline


def cmb(n,r):
    r = min(n-r,r)
    if r == 0: return 1
    over = reduce(mul, range(n, n - r, -1))
    under = reduce(mul, range(1,r + 1))
    return over // under


N, M = map(int, input().split())
num = []
p_flag = [True]*(int(M**0.5)+2)

for i in range(2, int(M**0.5)+2):
    if p_flag:
        for j in range(2*i, int(M**0.5)+2, i):
            p_flag[j] = False

        cnt = 0
        while M % i == 0:
            cnt += 1
            M //= i
        if cnt > 0:
            num.append(cnt)
        if M == 1:
            break
else:
    num.append(1)

ans = 1
for i in num:
    ans = (ans * cmb(N-1+i, i)) % (10**9+7)
print(ans)
import sys
sys.setrecursionlimit(10**5)

n, m = [int(i) for i in input().split(" ")]

par = [i for i in range(0, n + 1)]
d2p = [0 for i in range(0, n + 1)]

def root(x):
    global par
    global d2p
    if par[x] == x:
        return (x, 0)
    else:
        r = root(par[x])
        par[x] = r[0]
        d2p[x] += r[1]
        #print(par, d2p)
        return (r[0], d2p[x])


def unite(x, y, d):
    global par
    global d2p
    #print(x, y, d)
    rx, dx = root(x)
    ry, dy = root(y)
    if rx != ry:
        par[x] = y
        d2p[x] = d
        #print(par, d2p,"noz")
        return True
    else:
        if dy - dx != d:
            #print(rx, ry, dx, dy)
            return False
        else:
            return True

l = [0] * n
r = [0] * n
d = [0] * n

for i in range(0, m):
    l[i], r[i], d[i] = [int(i) for i in input().split(" ")]

f = True
for i in range(0, m):
    if not unite(l[i], r[i], d[i]):
        f = False
        break

if f and max(d2p) <= 10**9:
    print("Yes")
else:
    print("No")

### FIXED CODE ###

import queue

n, m = [int(i) for i in input().split(" ")]

g = [[] for i in range(0, n + 1)]
v = [0] * (n + 1)
v_asn = [False] * (n + 1)
f = True

for i in range(0, m):
    l, r, d = [int(i) for i in input().split(" ")]
    g[l].append([r, d])
    g[r].append([l, -d])

for i in range(1, n + 1):
    if not v_asn[i]:
        q = queue.Queue()
        v_asn[i] = True
        q.put(i)
        while not q.empty():
            qi = q.get()
            for a in g[qi]:
                if not v_asn[a[0]]:
                    v_asn[a[0]] = True
                    v[a[0]] = v[qi] + a[1]
                    q.put(a[0])
                else:
                    if v[a[0]] != v[qi] + a[1]:
                        f = False
                        break
        if not f:
            break

if f:
    print("Yes")
else:
    print("No")
def main():
    h, n = map(int, input().split())
    ab = [list(map(int, input().split())) for _ in range(n)]

    dp = [0] + [0] * h
    for i in range(1, h + 1):
        dp[i] = min(dp[i - a] + b for a, b in ab)


if __name__ == '__main__':
    main()


### FIXED CODE ###

def main():
    h, n = map(int, input().split())
    ab = [list(map(int, input().split())) for _ in range(n)]

    amax = max(a for a, b in ab)
    dp = [0] + [0] * (h + amax)
    for i in range(1, h + 1):
        dp[i] = min(dp[i - a] + b for a, b in ab)
    print(dp[h])


if __name__ == '__main__':
    main()
n, x = map(int, input().split())


def pi(n):
    return 2**(n+1)-1


def ai(n):
    return 2**(n+2) - 3


def f(n, x):
    if N == 0:
        return 0 if X <= 0 else 1
    elif (1 < x) and (x <= 1 + ai(n-1)):
        return f(n - 1, x - 1)
    elif x == 2 + ai(n - 1):
        return pi(n - 1) + 1
    elif (2 + ai(n - 1) < x) and (x <= 2 + 2 * ai(n - 1)):
        return pi(n-1) + 1 + f(n-1, x-2-ai(n-1))
    elif x >= ai(n):
        return pi(n)


print(f(n, x))


### FIXED CODE ###

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


def pi(n):
    return 2**(n+1)-1


def ai(n):
    return 2**(n+2) - 3


def f(n, x):
    if n == 0:
        return 1
    else:
        if x == 1:
            return 0
        elif (1 < x) and (x <= 1 + ai(n-1)):
            return f(n - 1, x - 1)
        elif x == 2 + ai(n - 1):
            return pi(n - 1) + 1
        elif (2 + ai(n - 1) < x) and (x <= 2 + 2 * ai(n - 1)):
            return pi(n-1) + 1 + f(n-1, x-2-ai(n-1))
        elif x >= ai(n):
            return pi(n)


print(f(n, x))
n,b,r = map(int,input().split())

s_b = ['b']*b
s_r = ['r']*r
l = []
for i in range(1000):
  l+=(s_b + s_r)

print(l[0:n].count('b'))

### FIXED CODE ###

n,b,r = map(int,input().split())

x = n//(b+r)
x1 = n%(b+r)

if b >= x1:
  b_count = x1
else:
  b_count = b

print(x*b + b_count)
from copy import copy
n = int(input())
a = list(map(int, input().split()))

ok, ng = n, 0
while ok-ng > 1:
	x = (ok+ng)//2
	#d = defaultdict(int)
	d = dict()
	dels = []
	last = 0
	valid = True
	if x == 1:
		for i in range(n-1):
			if a[i] >= a[i+1]:
				valid = False
				break
		if valid:
			ok = x
		else:
			ng = x
		continue

	for i in range(n-1):
		if a[i] < a[i+1]:
			last = a[i+1]
		elif a[i] > a[i+1]:
			#dels = []
			for k in d.keys():
				if k > last:
					dels.append(k)
			if a[i+1] > last:
				d[a[i+1]] = 1
			else:
				j = a[i+1]
				while j in d:
					if d[j] != x-1 or j <= 0:
						break
					else:
						dels,append(j)
						j -= 1
				if j in d:
					d[j] += 1
				else:
					d[j] = 1
			last = a[i+1]
		elif a[i] == a[i+1]:
			#dels = []
			for k in d.keys():
				if k > last:
					dels.append(k)
			j = a[i+1]
			while j in d:
				if d[j] != x-1 or j <= 0:
					break
				else:
					dels.append(j)
					j -= 1
			if j in d:
				d[j] += 1
			else:
				d[j] = 1
			last = a[i+1]

		for k in dels:
			del d[k]

		if 0 in d:
			valid = False
			break

	if valid:
		ok = x
	else:
		ng = x
print(ok)

### FIXED CODE ###

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

ok, ng = n, 0
while ok-ng > 1:
	x = (ok+ng)//2
	#d = defaultdict(int)
	d = dict()
	last = 0
	valid = True
	if x == 1:
		for i in range(n-1):
			if a[i] >= a[i+1]:
				valid = False
				break
		if valid:
			ok = x
		else:
			ng = x
		continue

	for i in range(n-1):
		dels = []
		if a[i] < a[i+1]:
			last = a[i+1]
			continue

		j = a[i+1]
		for k in d.keys():
			if j < k:
				dels.append(k)

		while j > 0:
			if j in d and d[j] == x-1:
				#d[j] = 0
				dels.append(j)
				j -= 1
			else:
				break

		if j in d:
			d[j] += 1
		else:
			d[j] = 1

		for k in dels:
			del d[k]

		if 0 in d:
			valid = False
			break
		last = j

	if valid:
		ok = x
	else:
		ng = x
print(ok)
N, M = map(int, input().split())
A = list(map(int, input().split()))
for _ in range(M):
    b, c = map(int, input().split())
    A += [c] * b

A.sort()
print(sum(A[-N]))

### FIXED CODE ###

from operator import itemgetter

N, M = map(int, input().split())
A = list(map(int, input().split()))
BC = []
for _ in range(M):
    BC.append(tuple(map(int, input().split())))

A.sort(reverse=True)
BC.sort(key=itemgetter(1), reverse=True)

n = 0
ans = 0
while True:
    if not BC:
        ans += sum(A[: N - n])
        break
    tgt = BC[0][1]
    a = A[0]
    if a >= tgt:
        ans += A.pop(0)
        n += 1
        if n == N:
            break
    else:
        tgt_n = BC[0][0]
        if n + tgt_n < N:
            ans += tgt * tgt_n
            n += tgt_n
            _ = BC.pop(0)
        else:
            ans += tgt * (N - n)
            break

print(ans)
s = input()
head = s.fine("A")
tail = s.rfind("Z")
print(tail - head +1)

### FIXED CODE ###

s = input()
head = s.find("A")
tail = s.rfind("Z")
print(tail - head +1)
# coding: utf-8
# Your code here!
import fractions
N=int(input())
A=list(map(int,input().split()))
def lcm(x,y):
    l=x*y/fractions.gcd(x,y)
    return l
l=A[0]
for i in range(N-1):
    l=int(A[i+1]*l/fractions.gcd(A[i+1],l))
ans=0
for i in range(N):
    ans+=l//A[i]
print(ans%(10**9+7))

### FIXED CODE ###

# coding: utf-8
# Your code here!
import fractions
from functools import reduce
N=int(input())
A=list(map(int,input().split()))

def lcm_base(x, y):
    return (x * y) // fractions.gcd(x, y)
def lcm_list(numbers):
    return reduce(lcm_base, numbers, 1)
l=lcm_list(A)
ans=0

for i in range(N):
    ans+=(l//A[i])
print(ans%(10**9+7))
str = input()
cntl = []
cnt = 1
for i in range(len(str)-1):
    if str[i] == str[i+1]:
        cnt += 1
    else:
        cntl.append(cnt)
        cnt = 1
else:
    cntl.append(cnt)
s = 0
for i in range(len(cntl)):
    s += cntl[i]*(cntl[i]+1)//2
r = 0
if str[0] == "<":
    for i in range(len(cntl)//2):
        r += min(cntl[2*i],cntl[2*i+1])
if str[0] == ">":
    for i in range(1,len(cntl)//2+1):
        r += min(cntl[2*i-1],cntl[2*i])
print(s-r)


### FIXED CODE ###

str = input()
cntl = []
cnt = 1
for i in range(len(str)-1):
    if str[i] == str[i+1]:
        cnt += 1
    else:
        cntl.append(cnt)
        cnt = 1
else:
    cntl.append(cnt)
s = 0
for i in range(len(cntl)):
    s += cntl[i]*(cntl[i]+1)//2
r = 0
if str[0] == "<":
    for i in range(len(cntl)//2):
        r += min(cntl[2*i],cntl[2*i+1])
if str[0] == ">":
    for i in range(1,(len(cntl)+1)//2):
        r += min(cntl[2*i-1],cntl[2*i])
print(s-r)
n = input()
count=0
for i in range(len(n)-1):
    if n[i] = n[i+1]:
        count +1

if count >=3:
    print("Yes")
else:
    print("No")

### FIXED CODE ###

n = input()
if (n[0]==n[1] and n[1]==n[2]) or (n[1]==n[2] and n[2]==n[3]):
    print("Yes")
else:
    print("No")
hoge = [0 for i in range(2)]

for i in range(2):
  hoge[i] = input()
  
N = int(hoge[0])
S = hoge[1]

print(S.count('ABC'))

### FIXED CODE ###

K, X = map(int,input().split())
if (500*K) >= X:
  print('Yes')
else:
  print('No')
from collections import Counter

n=int(input())
s=list(map(int,input().split()))
e=Counter(s[0::2])
o=Counter(s[1::2])
e[0]=0
o[0]=0
e1,e2=e.most_common(2)
o1,o2=o.most_common(2)
if e1[0]!=o1[0]:
    print(n-(e1[1]+o1[1]))
else:
    print(n-max(e1[1]+o2[1],e2[1]+o1[1]))z

### FIXED CODE ###

from collections import Counter

n=int(input())
s=list(map(int,input().split()))
e=Counter(s[0::2])
o=Counter(s[1::2])
e[0]=0
o[0]=0
e1,e2=e.most_common(2)
o1,o2=o.most_common(2)
if e1[0]!=o1[0]:
    print(n-(e1[1]+o1[1]))
else:
    print(n-max(e1[1]+o2[1],e2[1]+o1[1]))
n = int(input())
res = n-1 if n%(n-1) == int(n/(n-1)) else 0
i = 2
while i*i <= n:
  if n%i == 0:
    if n%(i-1) == int(n/(i-1)):
      res += i-1
    if i*i != n:
      if n%(int(n/i)-1) == int(n/(int(n/i)-1)):
        res += int(n/i) - 1
  else:
    pass
  i += 1
print(res)

### FIXED CODE ###

n = int(input())
if n == 1:
  print(0)
  quit()
else:
  res = n-1 if n%(n-1) == int(n/(n-1)) else 0
i = 2
while i*i <= n:
  if n%i == 0:
    if n%(i-1) == int(n/(i-1)):
      res += i-1
    if i*i != n:
      if n%(int(n/i)-1) == int(n/(int(n/i)-1)):
        res += int(n/i) - 1
  else:
    pass
  i += 1
print(res)
has_seven = False
N = str(raw_input())
for i in range(len(N)):
  	if N[i] == '7':
    	has_seven = True
    	break

if has_seven:
	print("Yes")
else:
	print("No")




### FIXED CODE ###


has_seven = False
N = str(input())
for i in range(len(N)):
  if N[i] == '7':
      has_seven = True
      break

if has_seven:
  print("Yes")
else:
  print("No")
A = [0, 0, 0, 0, 0]
A[0] = int(input())
A[1] = int(input())
A[2] = int(input())
A[3] = int(input())
A[4] = int(input())
k = int(input())

flg = 0

for i in range(4):
    for j in range(i+1, 5, 1)
        if k < (A[j] - A[i]):
            flg = 1
            print(":(")
            break

if flg == 0:
    print("Yay!")


### FIXED CODE ###


A = [0, 0, 0, 0, 0]
A[0] = int(input())
A[1] = int(input())
A[2] = int(input())
A[3] = int(input())
A[4] = int(input())
k = int(input())

flg = 0

for i in range(0, 4, 1):
    if flg == 1:
        break

    for j in range(i+1, 5, 1):
        if k < (A[j] - A[i]):
            flg = 1
            print(":(")
            break

if flg == 0:
    print("Yay!")
import math    
A, B = map(int, input().split())
#最小公倍数least common multiple (lcm)を定義する
def lcm(A,B):
    return (A*B)// math.gcd(A, B)

print(lcm(A,B))
    


### FIXED CODE ###

a, b = map(int, input().split())
#greatest commmon divisor(gdc)を定義する
def gcd(a, b):
    if a < b:
        a, b = b, a
    while a % b != 0:
        a, b = b, a % b
    return b
#least common multiple (lcm)を定義する
def lcm(a,b):
    return (a*b)// gcd(a, b)

print(lcm(a,b))
import sys
n = int(input())

an =[]

for i in range(11):
    if 26**(10-i)<=n and i<=10:
        wk = n//26**(10-i)
        n=n%26**(10-i)
        an.append(chr(wk%26+96))
    else:
        an.append(chr(n+96))
print(''.join(an))

### FIXED CODE ###

n = int(input())

nn=n
i=1
while nn > 26**i:
    nn-=26**i
    i+=1

an=['a']*i
j=0
while n:
    n-=1
    wk=n%26
    an[j]=(chr(ord('a')+wk))
    n = n//26
    j+=1
    
an.reverse()
print(''.join(an))
l=[]
x=0
l.append(x)
n=int(input())
s=input()
for i in s:
  if(i=='I'):
    x++
    l.append(x)
  if(i=='D'):
    x--
    l.append(x)
print(max(l))

### FIXED CODE ###

l=[]
x=0
l.append(x)
n=int(input())
s=input()
for i in s:
  if(i=='I'):
      x=x+1
      l.append(x)
  if(i=='D'):
      x=x-1
      l.append(x)
print(max(l))
K, S = map(int, input().split())

ans = 0
for i in range(K+1):
    for j in range(K+1):
        for l in range(K+1):
            if i + j + l == S:
                ans += 1


print(ans)

### FIXED CODE ###

s = input()

print(s.replace(",", " "))
a,b,k = map(int,input().split())
l = []
for i in range(a,b+1):
    l.append(i)
for j in range(0,len(l)):
    if b <= k:
        print(l[j])
    elif l[j] <= l[k-1] :
        print(l[j])
    elif l[j] >=l[len(l)-k]:
        print(l[j])

### FIXED CODE ###

a,b,k = map(int,input().split())
l = []
if b-a >= k:
    for i in range(k):
        l.append(a+i)
    for i in range(k):
        l.append(b-i)
    l = sorted(set(l))
    for i in range(len(l)):
        print(l[i])
else:
    for i in range(b-a+1):
        print(a+i)
a = input()
al = 'abcdefghijklmnopqrstuvwxyz'
for a in range(26):
  if a.count(al[i]) % 2 != 0:
    print('No')
    exit()
print('Yes')

### FIXED CODE ###

a = str(input())
al = 'abcdefghijklmnopqrstuvwxyz'
for i in range(26):
  if a.count(al[i]) % 2 != 0:
    print('No')
    exit()
print('Yes')
#nの約数を列挙する関数
def n_div(n):
    div_list = []
    import math
    for i in range(1, math.ceil(math.sqrt(n))+1):
        if n % i ==0:
            div_list.append(i)
            if i*i ==n:
                continue
            div_list.append(n//i)
    div_list.sort()
    return div_list

n = int(input())
lr = n_div(n)
#print(lr)
if len(lr) % 2==0:
    a = len(lr)/2
    a = int(a)
    ans = lr[a]+lr[a-1]-2
else:
    a = math.floor(len(lr))
    ans = lr[a]**2
    
print(ans)

### FIXED CODE ###

#nの約数を列挙する関数
import math
def n_div(n):
    div_list = []
    import math
    for i in range(1, math.ceil(math.sqrt(n))+1):
        if n % i ==0:
            div_list.append(i)
            if i*i ==n:
                continue
            div_list.append(n//i)
    div_list.sort()
    return div_list

n = int(input())
lr = n_div(n)
#print(lr)
if len(lr) % 2==0:
    a = len(lr)/2
    a = int(a)
    ans = lr[a]+lr[a-1]-2
else:
    a = math.floor(len(lr)/2)
    #print(a)
    ans = lr[a]*2  -2
    
print(ans)
x, y = map(int, input().split())
if abs(x-y)<=1:
    print("Brown")
else:
    print("Alice")



### FIXED CODE ###

a, b, c = input().split()
d = ""
d += a.upper()[0]
d += b.upper()[0] 
d += c.upper()[0]
print(d)
A = int(input())
B = int(input())
C = int(input())
D = int(input())
E = 0

if A > B and C > D:
	E += B + D
print(E)
elif A > B and C < D:
	E += B + C
print(E)
elif A < B and C > D:
	E += A + D
print(E)
elif A < B and C < D:
	E += A + C
print(E)


### FIXED CODE ###

A = int(input())
B = int(input())
C = int(input())
D = int(input())
sum = 0

if A > B:
	sum += B
else:
	sum += A
if C > D:
	sum += D
else :
	sum += C
	
print(sum)
def ctonum(c):
	alp="qwertyuiopasdfghjklzxcvbnm"
	for i in len(alp):
		if yay == alp[i]:
			return i

countS=[0 for i in range(100)]
countT=countS

S,T=input(),input()

for i in range(len(S)):
	countS[ctonum[S[i]]]+=1
	countT[ctonum[T[i]]]+=1
	
countS.sort()
countT.sort()

if countS==countT:
	print("Yes")
else:
	print("No")

### FIXED CODE ###

str1= list(raw_input())
str2 = list(raw_input())
from collections import Counter
# import operator
resstr2 = Counter(str2)
resstr1 = Counter(str1)

# a = sorted(res.values())
res1 = Counter(resstr1.values())
res2 =  Counter(resstr2.values())
result = "Yes"
for k , i in res1.iteritems():
    if res2[k] != i:
        result = "No"
        break
print result