Harryxun/stf_run huggingface dataset:
import numpy as np

N, S = map(int, input().split())
x = [int(x) for x in input().split()]
 
# 状態リストを作成
m = np.zeros((S+1,3))
p = np.zeros((S+1,3))
p[0,0] = 1

# 前状態から次状態の場合数を計算
for i in range(1,N+1):
    
    # x[i] を加えない場合
    m[:,0] = p[:,0]
    m[:,1] = p[:,0] + p[:,1]  # 今回から開始して加えない、もしくは既に開始しているが、加えない
    m[:,2] = p[:,0] + p[:,1] + p[:,2]  # 今回、開始・終了して加えない、今回開始して加えず終了。

    # x[i] を加える場合
    m[x[i]:,1] += p[:-x[i-1],0] + p[:-x[i-1],1]
    m[x[i]:,2] += p[:-x[i-1],0] + p[:-x[i-1],1]

    p[:,0] = m[:,0] % 998244353
    p[:,1] = m[:,1] % 998244353
    p[:,2] = m[:,2] % 998244353
            
print(int(p[S,2]))

### FIXED CODE ###

import numpy as np

N, S = map(int, input().split())
x = [int(x) for x in input().split()]
 
# 状態リストを作成
m = np.zeros((S+1,3))
p = np.zeros((S+1,3))
p[0,0] = 1

# 前状態から次状態の場合数を計算
for i in range(1,N+1):
    
    # x[i] を加えない場合
    m[:,0] = p[:,0]
    m[:,1] = p[:,0] + p[:,1]  # 今回から開始して加えない、もしくは既に開始しているが、加えない
    m[:,2] = p[:,0] + p[:,1] + p[:,2]  # 今回、開始・終了して加えない、今回開始して加えず終了。

    # x[i] を加える場合
    m[x[i-1]:,1] += p[:-x[i-1],0] + p[:-x[i-1],1]
    m[x[i-1]:,2] += p[:-x[i-1],0] + p[:-x[i-1],1]

    p[:,0] = m[:,0] % 998244353
    p[:,1] = m[:,1] % 998244353
    p[:,2] = m[:,2] % 998244353
            
print(int(p[S,2]))
import sys
print(len(str(sum(map(int,s.split()))))) for s in sys.stdin:

### FIXED CODE ###

import sys
for s in sys.stdin:print len(str(sum(map(int,s.split()))))
n, k, q = map(int, input().split())
a = [int(x) for x in input().split()]
m = None
for x in a:
    b = []
    c = []
    for y in a:
        if y < x:
            if len(c) >= k:
                c.sort()
                b.extend(c[:len(c) - k + 1])
            c = []
        else:
            c.append(y)
    if len(c) >= k:
        c.sort()
        b.extend(c[:len(c) - k + 1])
    if len(b) >= q:
        b.sort()
        if m is None or m > b[q - 1] - x: m = b[q - 1] - x
print(m)


### FIXED CODE ###

n = int(input())
s = input()
a = [0] * n
if s[0] == 'W': a[0] = 1
for i in range(1, n):
    c = s[i]
    if c == 'E':
        a[i] = a[i - 1]
    else:
        a[i] = a[i - 1] + 1
b = [0] * n
if s[n - 1] == 'E': b[n - 1] = 1
for i in range(n - 2, -1, -1):
    c = s[i]
    if c == 'W':
        b[i] = b[i + 1]
    else:
        b[i] = b[i + 1] + 1
m = n
for i in range(n):
    m = min(m, a[i] + b[i])
print(m - 1)
s=input()
k=input()
a=int(s[0])

for num in range(0,max(len(s),k)):
    if int(s[num])==1:
        print(1)
    else:
        print(s[num])

### FIXED CODE ###

s = input()
t =int(input())
for i in range(t):
  if s[i]!='1':
    print(s[i])
    exit()
print('1')
n = int(input())
l = sorted(list(map(int, input().split())))

ans = 0
for i in range(len(l)):
    for j in range(len(l))[i + 1:]:
        k = bisect(l[j+1:], l[i] + l[j]) + j+1
        ans += len(l[j+1:k])
print(ans)

### FIXED CODE ###

from bisect import bisect_left
 
n = int(input())
l = sorted(list(map(int,input().split())))

ans = 0
for i in range(n-2):
    for j in range(i+1,n-1):
        k = bisect_left(l,l[i]+l[j])
        ans += k - j - 1

print(ans)
import math

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

if n == 2:
    print(max(nums))
else:
    l_gcds = [nums[0]]
    r_gcds = [nums[-1]]
    for i in range(1, n - 1):
        l = math.gcd(l_gcds[-1], nums[i])
        r = math.gcd(r_gcds[-1], nums[n - i - 1])
        l_gcds.append(l)
        r_gcds.append(r)

### FIXED CODE ###

def gcd(a, b):
    while True:
        a, b = b, a % b
        if b == 0:
            break
    return a


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

if n == 2:
    print(max(nums))
else:
    l_gcds = [nums[0]]
    r_gcds = [nums[-1]]
    for i in range(1, n - 1):
        l = gcd(l_gcds[-1], nums[i])
        r = gcd(r_gcds[-1], nums[n - i - 1])
        l_gcds.append(l)
        r_gcds.append(r)
    r_gcds = r_gcds[::-1]
    gcds = [l_gcds[-1], r_gcds[0]]
    for i in range(1, n - 1):
        gcds.append(gcd(l_gcds[i - 1], r_gcds[i]))
    print(max(gcds))
#include <bits/stdc++.h>
using namespace std;

long long N, ans, M, cnt[26];
char S;

int main() {
  M = 1e9 + 7;
  cin >> N;

  for (int i = 0; i < N; i++) {
    cin >> S;
    cnt[S - 'a']++;
  }

  ans = 1;
  for (int i = 0; i < 26; i++) {
    ans *= (cnt[i] + 1);
    ans %= M;
  }

  cout << ans - 1 << '\n';

  return 0;
}


### FIXED CODE ###

N = int(input())
S = input()

M = 10**9 + 7
cnt = [0] * 26

for i in range(N):
    cnt[ord(S[i]) - ord('a')] += 1

ans = 1
for i in range(26):
    ans *= (cnt[i] + 1)
    ans %= M

print(ans - 1)
import string
s=input()
t=input()
a=string.ascii_lowercase
cnt1=0
for i in range(len(s)):
  n = a.find(s[i])
  if cnt1 < n:
    cnt1 = n

cnt2=0
for i in range(len(t)):
  n = a.find(s[i])
  if cnt2 < n:
    cnt2 = n
if cnt1 < cnt2:
  print("Yes")
else:
  print("No")

### FIXED CODE ###

s=sorted(input())
t=sorted(input(),reverse=True)
print("Yes" if s<t else "No")
ui = input()

A, B = int(ui.split()[0]), int(ui.split()[1])

def return_ans(A, B):
    if A > 8 or B > 8:
        return ':('
    else:
        return 'Yay!'

a = return_and(A,B)


### FIXED CODE ###

ui = input()
D, N = int(ui.split()[0]), int(ui.split()[1])
if D <= 8 and N <= 8:
    print('Yay!')
else:
    print(':(')
X,Y,A,B,C=map(int,input().split())
p=sorted(map(int,input().split()))
q=sorted(map(int,input().split()))
r=sorted(map(int,input().split()))
ans=[]
ans+=p[A-X:]
ans+=q[B-Y:]
ans.sort()
j=0
for i in ans:
	if i<r[-1]:
		ans[j]=r.pop()
		j+=1
	else:
		break
print(sum(ans))



### FIXED CODE ###

X,Y,A,B,C=map(int,input().split())
p=sorted(map(int,input().split()))
q=sorted(map(int,input().split()))
r=sorted(map(int,input().split()))
ans=[]
ans+=p[A-X:]
ans+=q[B-Y:]
ans.sort()
j=0
k=0
for i in ans:
	if len(r)>1:
		k=r[-1]
	elif len(r)==1:
		k=r[0]
	else:
		break
	if i<k:
		ans[j]=r.pop()
		j+=1
	else:
		break
print(sum(ans))
a=input()
b=int(input())
c=1
if a[0]!="1":
  print(a[0])
if a[0]=="1":
  for i in range(len(a)-1):
    if a[i]=="1" and a[i+1]=="1":
      c=c+1
    else:
      break
if c>b:
  print(1)
else:
  print(a[c])


### FIXED CODE ###

a=input()
b=int(input())
c=1
if a[0]!="1":
  print(a[0])
if a[0]=="1":
  for i in range(len(a)-1):
    if a[i]=="1" and a[i+1]=="1":
      c=c+1
    else:
      break
  if c>=b:
    print(1)
  else:
    print(a[c])
import sys

def solve():
    N = int(input())
    A = [int(a) for a in input().split()]
    lengthD = dict()
    for a in A:
        if a in lengthD: lengthD[a] += 1
        else: lengthD[a] = 1
    moreThanTwo = []
    count = 0
    for key in lengthD:
        if lengthD[key] > 1: 
            moreThanTwo.append(key)
            count += 1
    ans = 0
    moreThanTwo.sort()
    if lengthD[moreThanTwo[-1]] > 3: ans = moreThanTwo[-1] ** 2
    if count < 2: print(ans)
    else:
        ans = max(ans, moreThanTwo[-1] * moreThanTwo[-2])
        print(ans)

    return 0

if __name__ == "__main__":
    solve()

### FIXED CODE ###

import sys

def solve():
    N = int(input())
    A = [int(a) for a in input().split()]
    lengthD = dict()
    for a in A:
        if a in lengthD: lengthD[a] += 1
        else: lengthD[a] = 1
    moreThanTwo = []
    count = 0
    for key in lengthD:
        if lengthD[key] > 1: 
            moreThanTwo.append(key)
            count += 1
    
    if count == 0: print(0)
    else:
        ans = 0
        moreThanTwo.sort()
        if lengthD[moreThanTwo[-1]] > 3: ans = moreThanTwo[-1] ** 2
        if count < 2: print(ans)
        else:
            ans = max(ans, moreThanTwo[-1] * moreThanTwo[-2])
            print(ans)

    return 0

if __name__ == "__main__":
    solve()
N = int(input())
 
if N%2 == 0:
  print(N/2)
else:
  print([N+1] / 2)

### FIXED CODE ###

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

a.sort(reverse=True)
print(sum(a[0::2]) - sum(a[1::2]))
-*- coding:utf-8 -*-

a,b,c = int(x) for x in input()
list = [a, b, c]
count = 0
for i in list:
	if i == 1:
		count += 1
print(count)

### FIXED CODE ###

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

a,b,c = (int(x) for x in input())
list = [a, b, c]
count = 0
for i in list:
	if i == 1:
		count += 1
print(count)
n = int(input())
A = list(map(int,input().split()))

def flip_signs(a,b):
    if A[a] + A[b] < 0:
        A[a] *= (-1)
        A[b] *= (-1)
    elif A[a] + A[b]  == 0:
        if n//2 < a:
            A[b] = abs(A[b])
            A[a] *= A[b]//abs(A[b])
        elif b < n//2:
            A[a] = abs(A[a])
            A[b] *= A[a]//abs(A[a])

if n%2 == 1:
    for i in range(n//2-1):
        flip_signs(i,i+1)
        flip_signs(n-1-i,n-2-i)
    ans = sum(A[:(n//2-1)]+A[(n//2+2):])
    x = A[n//2-1]
    y = A[n//2]
    z = A[n//2+1]
    ans += max([-x-y+z,x-y-z,x+y+z,-x+y-z])

else:
    for i in range(n//2-1):
        flip_signs(i,i+1)
        flip_signs(n-1-i,n-2-i)
    ans = sum(A[:(n//2-1)]+A[(n//2+2):])
    x = A[n//2-1]
    y = A[n//2]
    ans += max(-x-y,x+y)
print(ans)

### FIXED CODE ###

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

minus = 0
zero = 0

for i in range(n):
    if A[i] < 0:
        minus += 1
    elif A[i] == 0:
        zero += 1

A2 = [abs(i) for i in A]
if minus %2 == 0 or zero >= 1:
    print(sum(A2))
else:
    print(sum(A2)-2*min(A2))
p,q,r = map(int,input().split())


mintime = p + q
if(mintime > q + r):
    mintime = q + r
elif(mintime > p + r):
    mintime = P + r
print(mintime)

### FIXED CODE ###

p,q,r = map(int,input().split())

mintime = p + q + r - max(p,q,r)

print(mintime)
print(max((int(input())-int(input())),0))

### FIXED CODE ###

x,t=map(int,input().split())
print(max(x-t,0))
N,H = map(int,input().split())
Ma = 1
B = []
for i in range(N):
    a,b = map(int,input().split())
    B.append(b)
    if a > Ma:
        Ma = a
B.sort()
B.reverse()
i = 0
Mb = B[0]
while Mb > Ma:
  i += 1
  if i == N:
    Mb = 0
    B = B[:i]
  else:
    Mb = B[i]
H -= sum(B)
print(i+int(-(-H//Ma)))

### FIXED CODE ###

N = int(input())
a = [int(n) for n in input().split()]
print(sum(a)-N)
N=int(input())
A=list(map(int, input().split()))
ans=[0]*N
for a in A:
  ans[a-1]+=1
for n in ans:
print(n)

### FIXED CODE ###

N=int(input())
A=list(map(int, input().split()))
ans=[0]*N
for a in A:
  ans[a-1]+=1
for n in ans:
  print(n)
import heapq

mod = 998244353

def dfs(v: int) -> int:
  res = 1
  for u in child[v]:
    res = res * dfs(u) % mod
  return res + 1

n = int(input())
robot = [tuple(map(int, input().split())) for _ in range(n)]
robot.sort()
child = [[] for _ in range(n)]

root = []
for i in range(n-1, -1, -1):
  x, d = robot[i]
  while root:
    r = heapq.heappop(root)
    if r[0] < x + d:
      child[i].append(r[1])
    else:
      heapq.heappush(root, r)
      break
  heapq.heappush(root, (x, i))
  
count = 1
for r in root:
  count = count * dfs(r[1]) % mod
print(count)

### FIXED CODE ###

import heapq

mod = 998244353

n = int(input())
robot = [tuple(map(int, input().split())) for _ in range(n)]
robot.sort(reverse=True)
parent = list(range(n))

root = []
for i in range(n):
  x, d = robot[i]
  while root:
    r = heapq.heappop(root)
    if r[0] < x + d:
      parent[r[1]] = i
    else:
      heapq.heappush(root, r)
      break
  heapq.heappush(root, (x, i))
  
count = 1
dp = [1] * n
for i in range(n):
  p = parent[i]
  if p == i:
    count = count * (dp[i] + 1) % mod
  else:
    dp[p] = dp[p] * (dp[i] + 1) % mod
print(count)
# -*- coding: utf-8 -*-
import numpy as np

def solve():
    N, K = map(int, input().split())
    C = np.array(list(map(int,input().split())))
    D = list()
    for i in range(N-K+1):
      c = C[i:i+K]
      l, r = max(c), min(c)
      d = -2*r + l if l > r else  -r + 2*l
      D.append(d)
    return str(min(D)

if __name__ == '__main__':
    print(solve())

### FIXED CODE ###

# -*- coding: utf-8 -*-
import numpy as np

def solve():
    N, K = map(int, input().split())
    C = np.array(list(map(int,input().split())))
    z = (C<0).sum()
    D = set()
    for i in range(N-K+1):
        l = -min(C[i],0)
        r = max(C[i+K-1],0)
        d = 2*l+r if l < r else 2*r+l
        D.add(d)
    return str(min(D))

if __name__ == '__main__':
    print(solve())
def main():
    n=int(input())
    ga,sa,ba=map(int,input().split())
    gb,sb,bb=map(int,input().split())
    
    def calc_1(dg,a0,a1):
        return (dg//a0)*a1+dg%a0

    def calc_2(dg,a0,a1,b0,b1):
        x=dg//a0
        visit=set()
        temp=0
        for i in range(x,-1,-1):
            amari=(dg-x*a0)%b0
            if amari in visit:
                break
            temp=max(x*a1+((dg-x*a0)//b0)*b1+amari,temp)
            visit.add(amari)
        return temp

    #def calc_3(dg,a0,a1,b0,b1,c0,c1):
    #    return max([a1*i+calc_2(dg-a0*i,b0,b1,c0,c1) for i in range(dg//a0,-1,-1)])

    gsb=[[ga,gb],[sa,sb],[ba,bb]]
    gsb.sort(key=lambda x:x[1]/x[0],reverse=True)
    temp=[[i,j] for i,j in gsb if i<j]
    if len(temp)==1:
        n=calc_1(n,temp[0][0],temp[0][1])
    elif len(temp)==2:
        n=calc_2(n,temp[0][0],temp[0][1],temp[1][0],temp[1][1])
    elif len(temp)==3:
        n=calc_3(n,temp[0][0],temp[0][1],temp[1][0],temp[1][1],temp[2][0],temp[2][1])

    gsb=reversed(gsb)
    temp=[[j,i] for i,j in gsb if i>j]
    if len(temp)==1:
        n=calc_1(n,temp[0][0],temp[0][1])
    elif len(temp)==2:
        n=calc_2(n,temp[0][0],temp[0][1],temp[1][0],temp[1][1])
    elif len(temp)==3:
        n=calc_3(n,temp[0][0],temp[0][1],temp[1][0],temp[1][1],temp[2][0],temp[2][1])
    print(n)
main()

### FIXED CODE ###

def main():
    n=int(input())
    ga,sa,ba=map(int,input().split())
    gb,sb,bb=map(int,input().split())
    
    def calc_1(dg,a0,a1):
        return (dg//a0)*a1+dg%a0

    def calc_2(dg,a0,a1,b0,b1):
        x=dg//a0
        visit=set()
        temp=0
        for i in range(x,-1,-1):
            amari=(dg-i*a0)%b0
            if amari in visit:
                break
            temp=max(i*a1+((dg-i*a0)//b0)*b1+amari,temp)
            visit.add(amari)
        return temp

    def calc_3(dg,a0,a1,b0,b1,c0,c1):
        return max([a1*i+calc_2(dg-a0*i,b0,b1,c0,c1) for i in range(dg//a0,-1,-1)])

    gsb=[[ga,gb],[sa,sb],[ba,bb]]
    gsb.sort(key=lambda x:x[1]/x[0],reverse=True)
    temp=[[i,j] for i,j in gsb if i<j]
    if len(temp)==1:
        n=calc_1(n,temp[0][0],temp[0][1])
    elif len(temp)==2:
        n=calc_2(n,temp[0][0],temp[0][1],temp[1][0],temp[1][1])
    elif len(temp)==3:
        n=calc_3(n,temp[0][0],temp[0][1],temp[1][0],temp[1][1],temp[2][0],temp[2][1])

    gsb=reversed(gsb)
    temp=[[j,i] for i,j in gsb if i>j]
    if len(temp)==1:
        n=calc_1(n,temp[0][0],temp[0][1])
    elif len(temp)==2:
        n=calc_2(n,temp[0][0],temp[0][1],temp[1][0],temp[1][1])
    elif len(temp)==3:
        n=calc_3(n,temp[0][0],temp[0][1],temp[1][0],temp[1][1],temp[2][0],temp[2][1])
    print(n)
main()
#https://atcoder.jp/contests/dp/tasks/dp_d
#2019-01-13
N, W = map(int, input().split())
w, v = [], []
for i in range(N):
    a, b = map(int, input().split())
    w += [a]
    v += [b]

DP = [0] * (W+1)
# i 円以下で買える商品の最大価値
for i in range(N):
    for weight in range(W,-1,-1):
        if weight - w[i] < 0 :continue
        DP[weight] = max(DP[weight], DP[weight - w[i]] +v[i])
print(DP[-1])

### FIXED CODE ###

#https://atcoder.jp/contests/dp/tasks/dp_e
#2019-01-13
N, W = map(int, input().split())
w, v = [], []
for i in range(N):
    a, b = map(int, input().split())
    w += [a]
    v += [b]

DP = [float("inf")] * (N*1000+1)
DP[0] = 0
#総価値 i 円を得るために最低限必要な重量
for i in range(N):
    for j in range(N*1000,-1,-1):
        DP[j] = min(DP[j- v[i]] + w[i], DP[j])
ans = 0
for k in range(N*1000+1):
    if DP[k] <= W:
        
        ans = k
print(ans)
count=0
def merge(A, left, mid, right):
    global count
    n1=mid - left
    n2=right - mid
    L=[i for i in range(n1+1)]
    R=[i for i in range(n2+1)]
    for i in range(n1):
        L[i] = A[left+i]
    for i in range(n2):
        R[i] = A[mid+i]
    L[n1] = 100000
    R[n2] = 100000
    i=0
    j=0
    for k in range(left,right):
        if L[i] <= R[j]:
            A[k] = L[i]
            i = i + 1
            count+=1
        else:
            A[k] = R[j]
            j = j + 1
            count+=1
def merge_sort(A, left, right):
    if left+1 < right:
        mid=(left+right)//2
        merge_sort(A, left, mid)
        merge_sort(A, mid, right)
        merge(A, left, mid, right) 

if __name__ == "__main__":
    n=int(input())
    A=list(map(int,input().split()))
    merge_sort(A,0,n)
    for i,j in enumerate(A):
        if i == n-1:
            print(j)
        else:
            print(j,end=" ")
    print(count)


### FIXED CODE ###

count=0
def merge(A, left, mid, right):
    global count
    L=A[left:mid]+[2**32]
    R=A[mid:right]+[2**32]
    i=0
    j=0
    for k in range(left,right):
        if L[i] <= R[j]:
            A[k] = L[i]
            i += 1
        else:
            A[k] = R[j]
            j += 1
        count+=1
def merge_sort(A, left, right):
    if left+1 < right:
        mid=(left+right)//2
        merge_sort(A, left, mid)
        merge_sort(A, mid, right)
        merge(A, left, mid, right) 

if __name__ == "__main__":
    n=int(input())
    A=list(map(int,input().split()))
    merge_sort(A,0,n)
    print(*A)
    print(count)
N, K = map(int,input().split())
LIst_1 = sorted(list(map(int, input().split())), reverse=True)
K = K+1
ans = sum(List_1[:K])

### FIXED CODE ###

N, K = map(int,input().split())
List_1 = sorted(list(map(int, input().split())))
ans = sum(List_1[:K])
print(ans)
# dict形式で既出分をもたせる
N, Q = map(int, raw_input().split())
string = raw_input()
a = []
for i in range(Q):
    a.append(map(int, raw_input().split()))
test_dict = {}
result = ''
for temp in a:
    if test_dict.get(string[temp[0]-1:temp[1]]):
        result += '\n' + str(test_dict.get(string[temp[0]-1:temp[1]]))
        continue
    test_dict[string[temp[0]-1:temp[1]]] = string[temp[0]-1:temp[1]].count('AC')
    result += '\n' + str(test_dict[string[temp[0]-1:temp[1]]])
print(result.lstrip)

### FIXED CODE ###

N, Q = map(int, raw_input().split())
string = raw_input()
cnt = [0]
for i in range(N):
#    print(i)
#    print(string[i-2:i])
#    if i == 0:
#        cnt.append(0)
#        continue
    if string[i-1:i+1] == 'AC':
        cnt.append(cnt[i]+1)
        continue
    cnt.append(cnt[i])

for j in range(Q):
    #print(j)
    pare = map(int, raw_input().split())
    print(cnt[pare[1]] - cnt[pare[0]])
N=int(input())
XY =  [list(map(int, input().split())) for _ in range(N)]
vecs = [  (x[0]-y[0], x[1]-y[1]) for y in XY   for x in XY]
pattern = list(set(vecs))
pattern.remove((0,0))
pattern2 = tuple(pattern)
qty = map(lambda x: vecs.count(x), pattern2)
data = zip(qty, pattern)
data2 = list(data)
data2.sort()
d = int(data2[-1][0])
print(N-d)

### FIXED CODE ###

N=int(input())
XY =  [list(map(int, input().split())) for _ in range(N)]
if N==1:
    print(1)
    exit()
vecs = [  (x[0]-y[0], x[1]-y[1]) for y in XY   for x in XY]
pattern = list(set(vecs))
pattern.remove((0,0))
pattern2 = tuple(pattern)
qty = map(lambda x: vecs.count(x), pattern2)
data = zip(qty, pattern)
data2 = list(data)
data2.sort()
d = int(data2[-1][0])
print(N-d)
n = int(input())
height = list(map(int,input().split()))

no_ocean = 0

for i in range(1,n):
  for k in range(i):
    if height[k] > height[i]:
      	no_ocean += 1
      	break
    else:
        continue
        
print(n - no_ocean)
    

### FIXED CODE ###

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

for i in range(2):
  if a > b:
    coins += a
    a-=1
  else:
    coins += b
    b-=1
  
print(coins)
import sys
input=sys.stdin.buffer.readline
#segtree
#https://juppy.hatenablog.com/entry/2019/05/02/%E8%9F%BB%E6%9C%AC_python_%E3%82%BB%E3%82%B0%E3%83%A1%E3%83%B3%E3%83%88%E6%9C%A8_%E7%AB%B6%E6%8A%80%E3%83%97%E3%83%AD%E3%82%B0%E3%83%A9%E3%83%9F%E3%83%B3%E3%82%B0_Atcoder
#####segfunc######
def segfunc(x,y):
    return x|y
def init(init_val):
    #set_val
    for i in range(n):
        seg[i+num-1]=init_val[i]    
    #built
    for i in range(num-2,-1,-1) :
        seg[i]=segfunc(seg[2*i+1],seg[2*i+2]) 
def update(k,x):
    k += num-1
    seg[k] = x
    while k:
        k = (k-1)//2
        seg[k] = segfunc(seg[k*2+1],seg[k*2+2])
def query(p,q):
    if q<=p:
        return ide_ele
    p += num-1
    q += num-2
    res=ide_ele
    while q-p>1:
        if p&1 == 0:
            res = segfunc(res,seg[p])
        if q&1 == 1:
            res = segfunc(res,seg[q])
            q -= 1
        p = p//2
        q = (q-1)//2
    if p == q:
        res = segfunc(res,seg[p])
    else:
        res = segfunc(segfunc(res,seg[p]),seg[q])
    return res
#####単位元######
ide_ele = set()
#num:n以上の最小の2のべき乗
n=int(input())
num =2**(n-1).bit_length()
seg=[ide_ele]*2*num
s=str(input())[2:n+2]
init([{ord(s[i])-97}for i in range(n)])
q=int(input())
for _ in range(q):
  quer=str(input())
  x,a,b=quer[2:7:2]
  if x=="1":
    i,c=a,b
    update(int(i)-1,{ord(c)-97})
  else:
    l,r=a,b
    print(len(query(int(l)-1,int(r))))

### FIXED CODE ###

import sys;input=sys.stdin.readline
n=int(input())
s=input()
num=2**(n-1).bit_length()
def segfunc(x,y):return x|y
seg=[0]*(2*num-1)
for i in range(n):seg[i+num-1]=2**(ord(s[i])-97)
for i in range(num-2,-1,-1):seg[i]=segfunc(seg[2*i+1],seg[2*i+2])
def update(i,x):
  i+=num-1;seg[i]=x
  while i:i=(i-1)//2;seg[i]=segfunc(seg[i*2+1],seg[i*2+2])
def query(l,r):
  l+=num-1;r+=num-1
  if l==r:return seg[l]
  s=seg[l];l+=1
  while r-l>1:
    if ~l%2:s=segfunc(seg[l],s)
    if r%2:s=segfunc(seg[r],s);r-=1
    l//=2;r=(r-1)//2
  if l==r:return segfunc(s,seg[l])
  return segfunc(s,segfunc(seg[l],seg[r]))
for _ in range(int(input())):
  quer=input().split()
  if quer[0]=="1":
    _,i,c=quer
    update(int(i)-1,2**(ord(c)-97))
  else:
    _,l,r=quer
    print(sum(map(int,bin(query(int(l)-1,int(r)-1))[2:])))
N = int(input())
L = [input()]

for _ in range(N-1):
    a = input()
    imin = 0
    imax = len(L)-1
    l = 0

    while (imin<imax):
        l = (imin+imax)//2
        if (a==L[l]):
            break
        elif (a>L[l]):
            imin = min(l+1,len(L)-1)
        else:
            imax = max(l-1,0)
    
    if(imax==imin)       
    	if (a>L[imin]):
        	L.insert(imin+1,a)
    	elif (a<L[imin]):
        	L.insert(imin,a)
            
print(len(L))

### FIXED CODE ###

N = int(input())
L = set([input() for _ in range(N)])
print(len(L))
m1=int(input())
d1=int(intput())
m2=int(input())
d2=int(intput())
if m1+1==m2:
  print(1)
else:
  print(0)
  

### FIXED CODE ###

m1,d1=map(int,input().split())
m2,d2=map(int,input().split())

if m1+1==m2:
  print(1)
else:
  print(0)