Harryxun/stf_run huggingface dataset:
n = int(input())
a = str(input()).split()
b = str(input()).split()
c = [a,b]
d = [a,b]
def max(x,y):
    if x > y:
        return x
    else:
        return y 
for j in range(0,2):
    for k in range(0,n):
        if j == 0 and k == 0:
            d[j][k] = int(c[j][k])
        elif j  == 0:
            d[j][k] = d[j][k-1] + int(c[j][k])
        elif k == 0:
            d[j][k] = d[j-1][k] + int(c[j][k])
        else:
            d[j][k] = max(d[j][k-1],d[j-1][k]) + int(c[j][k])
print(d[1][n-1])
 
   
n = int(input())
a = str(input()).split()
b = str(input()).split()
c = [a,b]
d = [a,b]
def max(x,y):
    if x > y:
    return x
    else:
    return y 
for j in range(0,2):
    for k in range(0,n):
        if j == 0 and k == 0:
            d[j][k] = int(c[j][k])
        elif j  == 0:
            d[j][k] = d[j][k-1] + int(c[j][k])
        elif k == 0:
            d[j][k] = d[j-1][k] + int(c[j][k])
        else:
            d[j][k] = max(d[j][k-1],d[j-1][k]) + int(c[j][k])
print(d[1][n-1])

   


### FIXED CODE ###

n = int(input())
a = str(input()).split()
b = str(input()).split()
c = [a,b]
d = [a,b]
def max(x,y):
    if x > y:
        return x
    else:
        return y 
for j in range(0,2):
    for k in range(0,n):
        if j == 0 and k == 0:
            d[j][k] = int(c[j][k])
        elif j  == 0:
            d[j][k] = d[j][k-1] + int(c[j][k])
        elif k == 0:
            d[j][k] = d[j-1][k] + int(c[j][k])
        else:
            d[j][k] = max(d[j][k-1],d[j-1][k]) + int(c[j][k])
print(d[1][n-1])
AB = int(input().split())
A,B=AB[0], AB[1]
if max(A,B)-min(A,B) >= 1:
  print(2*max(A,B)-1)
else:
  print(A+B)

### FIXED CODE ###

AB = input().split()
A,B=int(AB[0]), int(AB[1])
if max(A,B)-min(A,B) >= 1:
  print(2*max(A,B)-1)
else:
  print(A+B)
S=input()
K=int(input())
notonehead=min([S.find(str(i)) for i in range(2,10) if S.find(str(i))!=-1])
notone=S[notonehead]
print(1) if K-1<notonehead else print(str(notone))


### FIXED CODE ###

S=input()
K=int(input())
notoneposition=[S.find(str(i)) for i in range(2,10) if S.find(str(i))!=-1]
if notoneposition==[]:
	print(1)
else:
	notonehead=min(notoneposition)
	notone=S[notonehead]
	print(1) if K-1<notonehead else print(str(notone))
#!/usr/bin/env python3
from collections import defaultdict
from collections import deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
import itertools
sys.setrecursionlimit(10**5)
stdin = sys.stdin
bisect_left = bisect.bisect_left
bisect_right = bisect.bisect_right
def LI(): return list(map(int, stdin.readline().split()))
def LF(): return list(map(float, stdin.readline().split()))
def LI_(): return list(map(lambda x: int(x)-1, stdin.readline().split()))
def II(): return int(stdin.readline())
def IF(): return float(stdin.readline())
def LS(): return list(map(list, stdin.readline().split()))
def S(): return list(stdin.readline().rstrip())
def IR(n): return [II() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def FR(n): return [IF() for _ in range(n)]
def LFR(n): return [LI() for _ in range(n)]
def LIR_(n): return [LI_() for _ in range(n)]
def SR(n): return [S() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
mod = 1000000007
inf = float('INF')

#A
def A():
    a, b, c, d = LI()
    print(max(a * b, c * d))
    return

#B
def B():
    _ = II()
    s = S()
    d["I"] = 1
    d["D"] = -1
    ans = 0
    now = 0
    for i in s:
        now += d[i]
        ans = max(ans, now)
    print(ans)
    return

#C
def C():
    return

#D
def D():
    return

#E
def E():
    return

#F
def F():
    return

#G
def G():
    return

#H
def H():
    return

#Solve
if __name__ == '__main__':
    A()


### FIXED CODE ###

#!/usr/bin/env python3
from collections import defaultdict
from collections import deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
import itertools
sys.setrecursionlimit(10**5)
stdin = sys.stdin
bisect_left = bisect.bisect_left
bisect_right = bisect.bisect_right
def LI(): return list(map(int, stdin.readline().split()))
def LF(): return list(map(float, stdin.readline().split()))
def LI_(): return list(map(lambda x: int(x)-1, stdin.readline().split()))
def II(): return int(stdin.readline())
def IF(): return float(stdin.readline())
def LS(): return list(map(list, stdin.readline().split()))
def S(): return list(stdin.readline().rstrip())
def IR(n): return [II() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def FR(n): return [IF() for _ in range(n)]
def LFR(n): return [LI() for _ in range(n)]
def LIR_(n): return [LI_() for _ in range(n)]
def SR(n): return [S() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
mod = 1000000007
inf = float('INF')

#A
def A():
    a, b, c, d = LI()
    print(max(a * b, c * d))
    return

#B
def B():
    _ = II()
    s = S()
    d = {}
    d["I"] = 1
    d["D"] = -1
    ans = 0
    now = 0
    for i in s:
        now += d[i]
        ans = max(ans, now)
    print(ans)
    return

#C
def C():
    return

#D
def D():
    return

#Solve
if __name__ == '__main__':
    B()
s = input()
k = input()

if s[0] == '1':
    print(s[1])
else:
    print(s[0])

### FIXED CODE ###

s = input()
k = int(input())

for i in range(min(len(s), k)):
    if int(s[i]) > 1:
        print(s[i])
        exit(0)

print(1)
import heapq
import sys
input=sys.stdin.readline

lines = open("killer_01.txt", "r")
lines = lines.readlines()

print(lines[0])
print(len(lines))
N,Q = (map (int,lines[0].split(" ")))
querys = []
START = 1
GOAL = 0
GO = 2

for i in range(1,N + 1):
    s,t,x = (map(int,lines[i].split(" ")))
    s -=(x + 0.5)
    t -= (x + 0.5)
    querys.append( (START,s,x) )
    querys.append( (GOAL,t,x) )

for i in range(N + 1,Q + 1):
    querys.append( (GO,lines[i],-1)  )
koji_place = []
koji_um = set([])
heapq.heapify(koji_place)
querys = sorted(querys,key = lambda x:(x[1],x[2]) )
for query in querys:
    qtype,time,place = query
    if qtype == START:
        heapq.heappush(koji_place,place)
        koji_um.add(place)
    elif qtype == GOAL:
        koji_um.remove(place)
    elif qtype == GO:
        while koji_place and koji_place[0] not in koji_um: #更新と最近の場所のチェックを同時に行う
            heapq.heappop(koji_place) #koji place のpopは最大で place分，つまり合計で10 ** 5回行われるため ここのwhile
            # はOに影響を与えない
        if not koji_place:
            print(-1)
        else:
            print(koji_place[0])





### FIXED CODE ###

import bisect
import heapq
import sys
N,Q = [int(x) for x in sys.stdin.readline().split()]

hitos = []
ans = [-1] * Q
queries =[]
jump = [-1] * Q



queries = [[int(x) for x in sys.stdin.readline().split()] for i in range(N)]
hitos = [int(sys.stdin.readline()) for i in range(Q)]


# for i in range(N):
    # S,T,X =list(map(int,input().split(" ")))
    # lt = S -X -0.5
    # rt = T -X -0.5
    # queries.append([lt,rt,X]) #-1 → 挿入クエリ lが時間、-1がクエリの種類、Xが場所


queries.sort(key=lambda x:x[2])





for l,r,x in queries:
     lind  = bisect.bisect_left(hitos,l-x - 0.5)
     rind  = bisect.bisect_left(hitos,r -x - 0.5)
     while lind < rind:
         if ans[lind] == -1:
            ans[lind] = x
            jump[lind] = rind
            lind += 1
         else:
             temp = jump[lind]
             jump[lind] = rind
             lind = temp

for i  in ans:
    print(i)
import sys
import socket

if socket.gethostname() == 'N551J':
    sys.stdin = open('a1.in')


def read_int_list():
    return list(map(int, input().split()))


def read_int():
    return int(input())


def read_str_list():
    return input().split()


def read_str():
    return input()


def solve():
    a, b, c, d, e, f = read_int_list()
    best_sugar = 0
    best_total = a
    for i in range(31):
        for j in range(31):
                for k in range(3001):
                    water = i * 100 * a + j * 100 * b
                    if water + k * c <= f and k * c * 100 <= water * e:
                        l1 = int((f - water - k * c) / d)
                        l2 = int((water * e // 100 - k * c) / d)
                        l = min(l1, l2)
                        if (i, j, k, l) != (0, 0):
                            sugar = k * c + l * d
                            total = water + sugar
                            density = sugar / total
                            best_density = best_sugar / best_total
                            if density > best_density:
                                best_sugar = sugar
                                best_total = total
    return best_total, best_sugar


def main():
    res = solve()
    print(*res)


if __name__ == '__main__':
    main()


### FIXED CODE ###

import sys
import socket

if socket.gethostname() == 'N551J':
    sys.stdin = open('a1.in')


def read_int_list():
    return list(map(int, input().split()))


def read_int():
    return int(input())


def read_str_list():
    return input().split()


def read_str():
    return input()


def solve():
    a, b, c, d, e, f = read_int_list()
    best_sugar = 0
    best_total = 100 * a
    for i in range(31):
        for j in range(31):
            water = i * 100 * a + j * 100 * b
            for k in range(3001):
                if water + k * c <= f and k * c * 100 <= water * e:
                    l1 = int((f - water - k * c) / d)
                    l2 = int((water * e // 100 - k * c) / d)
                    l = min(l1, l2)
                    if (i, j, k, l) != (0, 0, 0, 0):
                        sugar = k * c + l * d
                        total = water + sugar
                        density = sugar / total
                        best_density = best_sugar / best_total
                        if density > best_density:
                            best_sugar = sugar
                            best_total = total
    return best_total, best_sugar


def main():
    res = solve()
    print(*res)


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

s = 'b'*a+'r'*b
x = n//(a+b) 
y = n%(a+b) 

print(x*a+s[y-1].count('b'))

### FIXED CODE ###

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

ans = n//(a+b)*a 
x = n%(a+b) 

if x<=a:
  ans += x
else:
  ans += a

print(ans)
#f

n = int(input())
E = [[] for _ in range(n)]
mod = 10**9 + 7

for i in range(n-1):
    a,b = [int(x) for x in input().split()]
    E[a-1].append((b-1, i)) 
    E[b-1].append((a-1, i)) 
    
X = [0] * n
    
def dfs(u,e):
    num = 1
    for v,c in E[u]:
        if c != e:
            num += dfs(v,c)
    X[e] = num 
    return num

dfs(0, -1)

I = [1]
for i in range(n):
    I.append(I[-1] * pow(2, mod-2, mod) % mod)

ans = 0
for i in range(n):
    x = X[i]
    ans += (1-I[x])*(1-I[n-x]) % mod
    
ans -= n * I[1]
ans += 1 - I[n]
ans %= mod
print(ans)



### FIXED CODE ###

#f
import sys
sys.setrecursionlimit(2 * 10 ** 5 + 10)
 

n = int(input())
E = [[] for _ in range(n)]
mod = 10**9 + 7

for i in range(n-1):
    a,b = [int(x) for x in input().split()]
    E[a-1].append((b-1, i)) 
    E[b-1].append((a-1, i)) 
    
X = [0] * n
    
def dfs(u,e):
    num = 1
    for v,c in E[u]:
        if c != e:
            num += dfs(v,c)
    X[e] = num 
    return num

dfs(0, -1)

I = [1]
inv = pow(2, mod-2, mod)
for i in range(n):
    I.append(I[-1] * inv % mod)

ans = 0
for i in range(n):
    x = X[i]
    ans += (1-I[x])*(1-I[n-x]) % mod
    
ans -= n * I[1]
ans += 1 - I[n]
ans %= mod
print(ans)
# coding: utf-8
# ?????????????????¨????????????
class Dice(object):
	def __init__(self):
		# ???????????????????????°
		# ????????¶???
		self.x = [2, 5]
		self.y = [3, 4]
		self.z = [1, 6]
		SN = {'S': 0, 'N': 1}
		WE = {'W': 0, 'E': 1}
		pass

	def rotate(self, _dir):
		def rot(_k, _r):
			return list(reversed(_r)), _k

		if _dir=='N':
			self.x, self.z = rot(self.x, self.z)
		elif _dir=='S':
			self.z, self.x = rot(self.z, self.x)
		elif _dir=='E':
			self.z, self.y = rot(self.z, self.y)
		elif _dir=='W':
			self.y, self.z = rot(self.y, self.z)
		else:
			pass

	def top(self):
		return self.z[0]

	def view(self):
		print("x, y, z =", self.x, self.y, self.z)

if __name__=="__main__":
	val = list(map(int, input().split()))
	dice = Dice()
	dr = input()
	for d in dr:
		dice.rotate(d)
	print(val(dice.top()))

### FIXED CODE ###

# coding: utf-8
# ?????????????????¨????????????
class Dice(object):
	def __init__(self):
		# ???????????????????????°
		# ????????¶???
		self.x = [2, 5]
		self.y = [3, 4]
		self.z = [1, 6]
		SN = {'S': 0, 'N': 1}
		WE = {'W': 0, 'E': 1}
		pass

	def rotate(self, _dir):
		def rot(_k, _r):
			return list(reversed(_r)), _k

		if _dir=='N':
			self.x, self.z = rot(self.x, self.z)
		elif _dir=='S':
			self.z, self.x = rot(self.z, self.x)
		elif _dir=='E':
			self.z, self.y = rot(self.z, self.y)
		elif _dir=='W':
			self.y, self.z = rot(self.y, self.z)
		else:
			pass

	def top(self):
		return self.z[0]


if __name__=="__main__":
	dice = Dice()
	val = list(map(int, input().split()))
	dr = input()
	for d in dr:
		dice.rotate(d)
	print(val[dice.top()-1])
n = int(input())
s = list(input())
black1 = s.count('#')
white1 = s.count('.')
if black1 > 0:
    for i in reversed(s):
        if i == '#':
            n -= 1
        else:
            break
    l1 = s[:n]
    black2 = l1.count('#')
    b = l1.index('#')
    l2 = l1[b:]
    white2 = l2.count('.')
    l3 = s[b:]
    black3=l3.count('#')
    print(min(black1,white1,black2,white2,black3))
else:
    print('0')

### FIXED CODE ###

n = int(input())
s = list(input())
ans = white = s.count('.')
black = 0
for i in s:
    if i == '.':
        white -= 1
    else:
        black += 1
    ans = min(ans,white+black)
print(ans)
n,k=input().split()
if n%k==0:
  print(0)
else:
  print(1)

### FIXED CODE ###

n,k=input().split()
if int(n)%int(k)==0:
  print(0)
else:
  print(1)
s,t=input().split
a,b=map(int,input().split())
u=input()
if s==u:
  print(b)
else:
  print(a)

### FIXED CODE ###

s, t = input().split()
a, b = map(int, input().split())
u = input()
if s == u:
  print(a-1, b)
else:
  print(a, b-1)
'''A - Train
https://atcoder.jp/contests/abc107/tasks/abc107_a

>>> main(4, 2)
3
>>> main(1, 1)
1
>>> main(15, 11)
5'''


def main(n, i):
    print(n - i + 1)


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


### FIXED CODE ###

'''A - Train
https://atcoder.jp/contests/abc107/tasks/abc107_a

>>> main(4, 2)
3
>>> main(1, 1)
1
>>> main(15, 11)
5'''


def main(n, i):
    print(n - i + 1)


if __name__ == '__main__':
    n, i = map(int, input().split(' '))
    main(n, i)
# coding:utf-8

if __name__=="__main__":
  N = int(input())
  s = []
  a,b,ba=0,0,0
  count = 0
  for i in range(N):
      s.append(input())
      count += s.count('AB')
      if s[i][0]!='B' and s[i][-1]=='A': a+=1
      if s[i][0]=='B' and s[i][-1]!='A': b+=1
      if s[i][0]=='B' and s[i][-1]=='A': ba+=1
  if ba == 0:
      print(count+min(a,b))
  elif min(a,b)==0:
      print(count+ba-1)
  else:
      print(count+ba+min(a,b))

### FIXED CODE ###

# coding:utf-8

if __name__=="__main__":
  N, K = map(int, input().split())
  print(N-K+1)
# - coding : utf-8 -*-
 
n, m = input().split()
xs_str = input().split()
xs = list(map(int, xs_str))
xs.sort()
 
ys = []
for x1, x2 in zip(xs[0:-1], xs[1:]):
    ys.append(abs(x2 - x1))
ys.sort()
 
if len(ys) >= n:
    out = sum(ys[0:-(n-1)])
else:
    out = 0
print(out)


### FIXED CODE ###

# - coding : utf-8 -*-
 
n, m = list(map(int, input().split()))
xs_str = input().split()
xs = list(map(int, xs_str))
xs.sort()
 
ys = []
for x1, x2 in zip(xs[0:-1], xs[1:]):
    ys.append(abs(x2 - x1))
ys.sort()

for i in range(n - 1):
    if ys == []:
        break
    else:
        ys.pop()
print(sum(ys))
import sys
import collections
from functools import lru_cache

xy = []
d = collections.defaultdict(list)
@lru_cache(maxsize=None)
def alg_memoization_recursion(f):
    mt = 0
    for v in d[f]:
        mt = max(mt, alg_memoization_recursion(v) + 1)
    return mt


def solve():
    readline = sys.stdin.buffer.readline
    mod = 10 ** 9 + 7
    sys.setrecursionlimit(10 ** 5 + 1)
    n, m = list(map(int, readline().split()))
    for i in range(m):
        x, y = list(map(int, readline().split()))
        d[x-1] += [y-1]
    mt = 0
    for i in range(n):
        mt = max(mt, alg_memoization_recursion(i))
    print(mt)


if __name__ == '__main__':
    solve()


### FIXED CODE ###

import sys
import collections
from functools import lru_cache

xy = []
d = collections.defaultdict(list)
@lru_cache(maxsize=None)
def alg_memoization_recursion(f):
    mt = 0
    for v in d[f]:
        mt = max(mt, alg_memoization_recursion(v) + 1)
    return mt


def solve():
    readline = sys.stdin.buffer.readline
    mod = 10 ** 9 + 7
    sys.setrecursionlimit(10 ** 5 + 1)
    n, m = list(map(int, readline().split()))
    for i in range(m):
        x, y = list(map(int, readline().split()))
        d[x-1] += [y-1]
    mt = 0
    for i in range(n):
        mt = max(mt, alg_memoization_recursion(i))
    print(mt)


if __name__ == '__main__':
    solve()
A, B, C = int(input().split)

if C >= A and C <= B:
  print('Yes')
else:
  print('No')

### FIXED CODE ###

x = input().split()
A, B, C = int(x[0]), int(x[1]), int(x[2])
if (C >= A) and (C <= B):
  print('Yes')
else:
  print('No')
a = set("a", "e", "i", "o", "u")
if input() in a:
    print("vowel")
else:
    print("consonant")    


### FIXED CODE ###

a = ('a', 'e', 'i', 'o', 'u')
if input() in a:
    print("vowel")
else:
    print("consonant")
import sys
sys.setrecursionlimit(100000)


def process():
    data = []
    for line in get_data():
        line = line.split()
        if len(line) == 2:
            if line[0] == line[1] == '0':
                data = []
                continue
            H = int(line[0])
            W = int(line[1])
        elif len(line) == 0:
            pass
        else:
            data.append(line[0])
            if len(data) == H:
                field = create_field(H, W)
                print search(H, W, data, field)


def search(H, W, data, field):
    count = 0
    for i in xrange(H):
        for j in xrange(W):
            if field[i][j] == 0:
                continue
            _search(i, j, H, W, data[i][j], data, field)
            count += 1
    return count


def _search(i, j, H, W, cell, data, field):
    field[i][j] = 0
    for a in xrange(i-1, i+2):
        if -1 < a < H:
            pass
        else:
            continue
        for b in xrange(j-1, j+2):
            if -1 < b < W:
                pass
            else:
                continue

            if a != i and b != j:
                continue

            if field[a][b] == 0:
                continue
            if cell == data[a][b]:
                _search(a, b, H, W, cell, data, field)
    return


def create_field(H, W):
    field = []
    for i in xrange(H):
        raw = []
        for j in xrange(W):
            raw.append(1)
        field.append(raw)
    return field


def get_data():
    return [line.strip() for line in raw_input()]


process()

### FIXED CODE ###

import sys
sys.setrecursionlimit(100000000)


def main():
    solve()


def solve():
    for data in get_dataset():
        print search(data)


def search(data):
    count = 0
    H = len(data)
    W = len(data[0])
    for i in xrange(H):
        for j in xrange(W):
            if data[i][j] == '.':
                continue
            _search(i, j, H, W, data[i][j], data)
            count += 1
    return count


def _search(i, j, H, W, cell, data):
    data[i][j] = '.'
    for a in xrange(i-1, i+2):
        if not -1 < a < H:
            continue
        for b in xrange(j-1, j+2):
            if not -1 < b < W:
                continue

            if a != i and b != j:
                continue

            if data[a][b] == '.':
                continue

            if cell == data[a][b]:
                _search(a, b, H, W, cell, data)
    return


def get_dataset():
    dataset = []
    while True:
        line = raw_input().rstrip().split()
        H = int(line[0])
        if H == 0:
            break

        data = []
        for i in xrange(H):
            data.append(list(raw_input().rstrip()))
        dataset.append(data)
    return dataset


if __name__ == '__main__':
    main()
x = input()

print("Yes" if x[0]=x[1]=x[2] or x[1]=x[2]=x[3] else "No")

### FIXED CODE ###

x = input()
 
print("Yes" if x[0]==x[1]==x[2] or x[1]==x[2]==x[3] else "No")
n = int(input())
s, t = map(str,input())

ans = ''
for i in range(n):
    ans += s[i]
    ans += t[i]

print(ans)

### FIXED CODE ###

n = int(input())
s, t = map(str,input().split())

ans = ''
for i in range(n):
    ans += s[i]
    ans += t[i]

print(ans)
def eratosthenes2(n):
    lim=int(n**0.5)
    d=[i+1 for i in range(2,n,2)]
    D=[2]*(n+1)
    D[0]=0
    D[1]=1
    while True:
        p=d[0]
        if lim<p:
            for x in d:
                D[x]=x
            break
        D[p]=p
        d2=[]
        for x in d:
            if x%p!=0:
                d2.append(x)
            else:
                D[x]=p
        d=d2
    return D
    
N=int(input())
A=list(map(int,input().split()))
maxA=max(A)
D=eratosthenes2(maxA)
count=[0]*(maxA+1)
for x in A:
    pre=x+1
    while x>1:
        if pre!=D[x]:
            count[D[x]]+=1
            pre=D[x]
        x=int(x/D[x])
maxc=max(count)
if maxc==N:
    print('not coprime')
elif maxc==1:
    print('pairwise coprime')
else:
    print('setwise coprime')

### FIXED CODE ###

N=int(input())
A=list(map(int,input().split()))
maxA=max(A)
count=[0]*(maxA+1)
for x in A:
    count[x]+=1
maxc=0
for i in range(2,maxA+1):
    maxc = max(maxc,sum(count[i::i]))

if maxc==N:
    print('not coprime')
elif maxc<=1:
    print('pairwise coprime')
else:
    print('setwise coprime')
N=int(input())
A=list(map(int,input().split()))
Q=int(input())
L=len(A)
S=sum(A)

for i in range(Q):
    ans=0
    B,C=map(int,input().split())
    for j in range(L):
        if A[j]==B:
            A[j]=C
            S+=(C-B)
    ans=S
    print(ans)


### FIXED CODE ###

N=int(input())
A=list(map(int,input().split()))
x=0
for a in A:
    x^=a
ans=''
for a in A:
    ans+=str(x^a)+' '
print(ans)
from operator import mul
from functools import reduce

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())
print(cmb(n , 2) + cmb(m , 2))

### FIXED CODE ###

n , m = map(int , input().split())
print(int(n*(n-1)/2 + m*(m-1)/2))
import sys
??
n = int(input())
dic = {}
input_ = sys.stdin.readlines()
??
for i in input_:
????????c, s = i.split()
????????if c == 'insert':
????????????????dic[s] = 0
????????else:
????????????????if s in dic:
????????????????????????print('yes')
????????????????else:
????????????????????????print('no')

### FIXED CODE ###

n = int(input())
dic = set()

for i in range(n):
    o = input().split()
    if o[0] == 'insert':
        dic.add(o[1])
    elif o[1] in dic:
        print('yes')
    else:
        print('no')
s = input()
if s[3] == s[4] and s[5] == s[6]:
    print("Yes")
else:
    print("No")

### FIXED CODE ###

s = input()
if s[2] == s[3] and s[4] == s[5]:
    print("Yes")
else:
    print("No")
# D
N, W = map(int, input().split())
 
import numpy as np

dp = np.zeros((N+1, W+1))

for i in range(1, N+1):
    w, v = map(int, input().split())
    dp[w:W+1] = np.maximum(dp[0:W-w+1]+v, dp[w:W+1])

print(dp[-1])


### FIXED CODE ###

# D
N, W = map(int, input().split())

import numpy as np
dp = np.zeros(W+1, dtype="int64")

for i in range(1, N+1):
    w, v = map(int, input().split())
    dp[w:] = np.maximum(dp[w:], dp[0:W-w+1] + v)

print(dp[-1])