peterverebics/CodeNet_Python_118 huggingface dataset:
def main():
    N, M = map(int, input().split())
    
    ans = 0
    if N >= 2:
        ans += N*(N-1)/2
    
    if M >= 2:
        ans += M*(M-1)/2

    print(int(ans))

if __name__ == '__main__':
    main()
import math

def comb(n, r):
    return math.factorial(n) // (math.factorial(r) * (math.factorial(n - r)))

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

ans = 0
if N >= 2:
    ans += comb(N, 2)
if M >= 2:
    ans += comb(M, 2)

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

answer = (n*(n-1)) // 2 + (m*(m-1)) // 2

print(answer)
#--------------------------------------------
#ライブラリ等
import sys
import math
from math import sqrt
input = sys.stdin.readline
#---------------------------------------------
X, Y = map(int, input().split())
M = (X*(X-1))
N = (Y*(Y-1))
L =(M+N)/2
print(int(L))
a,b=list(map(int, input().split()))
ct=(a*(a-1))//2
ct+=(b*(b-1))//2
print(ct)
N, M = map(int, input().split())
# kCa = k(k-1)/a もっとデカくなるとk(k-1)(k-2)(k-3)/a/(a-1)(a-2)
print(N * (N - 1) // 2 + M * (M - 1) // 2)
n,m = map(int,input().split())
print(int(n*(n-1)//2 + m*(m-1)//2))
N,M = map(int, input().split())
print(int(N*(N-1)/2)+int(M*(M-1)/2))
N, M = map(int, input().split())

X = N * (N - 1) * (1/2)
Y = M * (M - 1) * (1/2)

print(int(X + Y))
I = input().split()

N = int(I[0])
M = int(I[1])

print( int(N*(N-1)/2) + int(M*(M-1)/2) )
import math
n,m=map(int,input().split())
def comb(k, r):
  if k<2:
    return 0
  else:
    return math.factorial(k) // (math.factorial(k - r) * math.factorial(r))

print(comb(n,2)+comb(m,2))
n, m = map(int, input().split())

ans = int(n*(n-1)/2 + m*(m-1)/2)
print(ans)
N,M = map(int,input().split())

ans = N*(N-1)/2 + M*(M-1)/2

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

binomials = [0, 0, 1]
for i in range(3, 101):
    binomials.append(binomials[-1] * i // (i - 2))

ans = binomials[N] + binomials[M]

print(ans)
# N : even
# M : odd
N, M = map(int, input().split())

print(N*(N-1)//2 + M*(M-1)//2)
import math
N, M = list(map(int, input().split()))
ans = 0
if N > 1:
  ans += math.factorial(N) // (math.factorial(N-2) * math.factorial(2))
if M > 1:
  ans += math.factorial(M) // (math.factorial(M - 2) * math.factorial(2))
print(ans)
n, m = list(map(int, input().split()))
print(int(n*(n-1)/2 + m*(m-1)/2))
#!/usr/bin/python3
# -*- coding: utf-8 -*-
n, m = map(int, input().split())
ans = n * (n - 1) // 2 + m * (m - 1) // 2
print(ans)
n, m = map(int, input().split())
a = n * (n - 1) // 2
b = m * (m - 1) // 2
print(a + b)
N, M = map(int, input().split())
print(N*(N-1)//2+ M * (M-1)//2)
n,m = [int(i) for i in input().split()]
if n <= 1:
  a = 0
else:
  a = n*(n-1)/2
if m <= 1:
  b = 0
else:
  b = m*(m-1)/2
print(int(a+b))
[N,M] = [int(s) for s in input().rstrip().split(' ')]
def f(a:int):
  if a < 2:
    return 0
  else:
    return a*(a-1)//2
print(f(N) + f(M))
a,b = map(int,input().split())
sums = a * (a - 1) // 2 + b * (b - 1) // 2
print(sums)
[n,m] = [int(i) for i in input().split()]
print(n * (n-1)//2 + m * (m-1)//2)
N,M=map(int,input().split())
print(int((N*(N-1)/2)+M*(M-1)/2))
import math
n,m=map(int,input().split())
def com(n, r):
    if n<r:
        return 0
    else:
        return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))
print(com(n,2)+com(m,2))
N, M = map(int,input().split())
print((N*(N-1)+M*(M-1))//2)
N,M = map(int,input().split())
print(int(N*(N -1)/2 + M*(M - 1)/2))
import sys
N, M = map(int, sys.stdin.readline().split())

print(N*(N-1)//2 + M*(M-1)//2)
e,o=map(int,input().split())
ean=0
oan=0

if e>1:
    ean+=e*(e-1)//2
if o>1:
    oan+=o*(o-1)//2
    
print(ean+oan)
n,m = map(int,input().split())
evensum = int(n*(n-1)/2 + m*(m-1)/2)
print(evensum)
n, m = map(int, input().split())
ans = 0
if n > 1:
  ans += n*(n-1)//2
if m > 1:
  ans += m*(m-1)//2
print(ans)
import sys
input = sys.stdin.readline

def main():
    N, M = map(int, input().split())
    print((N * (N-1))//2 + (M * (M-1))//2)



if __name__ == "__main__":
    main()
N, M = map(int, input().split())
print(N * (N - 1) //2 + M * (M - 1) // 2)
import sys
input = sys.stdin.readline

n, m = map(int, input().split())
ans = 0
for i in range(n):
    ans += i
for j in range(m):
    ans += j
print(ans)
from operator import mul
from functools import reduce
N, M=map(int, input().split())


def combinations_count(n, r):
    r = min(r, n - r)
    numer = reduce(mul, range(n, n - r, -1), 1)
    denom = reduce(mul, range(1, r + 1), 1)
    return numer // denom

if N>=2 and M>=2:
    print(combinations_count(N, 2)+combinations_count(M, 2))
elif N>=2 or M>=2:
    print(combinations_count(N, 2)+combinations_count(M, 2)-1)
else:
    print(0)
import math

N,M=(int(x) for x in input().split())

def combinations_count(n, r):
    if n < 2:
        return 0
    else: 
        return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))


print(combinations_count(N, 2)+ combinations_count(M, 2))
N,M = map(int,input().split())

def cmb(n,r):
    if r > n:
        return 0
    if r == 0 or r == n:
        return 1
    if r == 1:
        return n
    return cmb(n-1,r) + cmb(n-1,r-1)

ret = cmb(N,2) + cmb(M,2)
print(ret)
n, m = map(int, input().split())
print(n*(n - 1)//2 + m*(m - 1)//2)
N, M = map(int, input().split())

ans = (N * (N - 1) // 2) + (M * (M - 1) // 2)

print (ans)
import itertools
import sys
import math
import numpy as np
from collections import deque
from itertools import combinations
from functools import reduce
from functools import lru_cache
sys.setrecursionlimit(10**9)

def main():
    N,M = map(int,input().split())
    print((N*(N-1)+M*(M-1))//2)

if __name__ == "__main__":
  main()
import bisect,collections,copy,itertools,math,string
import sys
def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
def S(): return sys.stdin.readline().rstrip()
def LS(): return list(sys.stdin.readline().rstrip().split())
def main():
    def select(n,k):
        return math.factorial(n)//(math.factorial(k)*math.factorial(n-k))
    n,m = LI()
    ans = 0
    if n>=2:
        ans += n*(n-1)//2
    if m>=2:
        ans += m*(m-1)//2

    print(ans)
main()
n,m=map(int,input().split())
x=n*(n-1)/2+m*(m-1)/2
print(int(x))
from  itertools import combinations
N, M = map(int, input().split())
N = range(N)
M = range(M)
count_n = len(list(combinations(N,2))) if len(N) >=2 else 0
count_m = len(list(combinations(M,2))) if len(M) >=2 else 0

print(count_n+count_m)
N,M=map(int,input().split())
from operator import mul
from functools import reduce

def combinations_count(n, r):
    r = min(r, n - r)
    numer = reduce(mul, range(n, n - r, -1), 1)
    denom = reduce(mul, range(1, r + 1), 1)
    return numer // denom

if N>=2:
    a=combinations_count(N,2)
else:
    a=0
if M>=2:
    b=combinations_count(M,2)
else:
    b=0
print(a+b)
from scipy.special import comb
N,M = input().split()
N = int(N)
M = int(M)

A = 0
B = 0
if N >= 2 :
  A = comb(N, 2, exact=True)

if M >= 2 :
  B = comb(M, 2, exact=True)
 
print(A + B)
n, m = map(int, input().split())
print(int(n * (n - 1) / 2 + m * (m - 1) / 2))
N, M = map(int, input().split())

c_o = int((N * (N-1)) / 2)
c_e = int((M * (M-1)) / 2)

print(c_o + c_e)
n,m = map(int, input().split())

ans = n*(n-1)//2 + m*(m-1)//2

print(ans)
n,m = map(int, input().split())
print(int((n*(n-1)/2 ) + (m*(m-1))/2))
N, M = map(int, input().split())

ans = ((N * (N - 1)) + M * (M - 1))//2

print(ans)
M,N=map(int,input().split())
print(M*(M-1)//2+N*(N-1)//2)
import math
def combi(n,r):
  ans = math.factorial(n) // (math.factorial(n-r) * math.factorial(r))
  return ans

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

ans = 0
if N > 1:
  ans += combi(N,2)
if M > 1:
  ans += combi(M,2)
print(ans)
nm = [int(i) for i in input().split()]

result = (nm[0] * (nm[0] - 1)) // 2
result += (nm[1] * (nm[1] - 1)) // 2

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

if(N>1):
    A=(N*(N-1)//2)
else:
    A=0

if(M>1):
    B=(M*(M-1)//2)
else:
    B=0

print(A+B)
n, m = list(map(int, input().split()))

ans = n*(n-1)/2+m*(m-1)/2

print(int(ans))
import math
import sys

def comb(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

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

if n == 1 and m == 1:
  print('0')
  sys.exit()
  
if n <= 1:
  print(comb(m, 2))
  sys.exit()
  
if m <=1:
  print(comb(n, 2))
  sys.exit()

print(comb(n, 2) + comb(m, 2))
''' بِسْمِ اللَّهِ الرَّحْمَٰنِ الرَّحِيمِ '''
#codeforces
gi = lambda : list(map(int,input().split()))
n, m = gi()
print((n * (n - 1)) // 2 + (m * (m - 1)) // 2)
#スペース区切りの整数入力
N, M  = map(int, input().split())


if N >= 2:
    N_even = N*(N - 1)/2
else:
    N_even = 0

if M >= 2:
    M_even = M*(M-1)/2
else:
    M_even = 0

print(int(N_even + M_even))
N, M = map(int, input().split())

print(int(N*(N-1)/2 + M*(M-1)/2))
N, M = map(int, input().split())

print((N * (N - 1) + M * (M - 1)) // 2)
import math
n, m = raw_input().split()
n = int(n)
m = int(m)
if n < 2 and m < 2:
  print(0)
elif n < 2:
  print(math.factorial(m)//(math.factorial(m-2) * 2))
elif m < 2:
  print(math.factorial(n)//(math.factorial(n-2) * 2))
else:
  print(math.factorial(n)//(math.factorial(n-2)*2) + math.factorial(m)//(math.factorial(m-2)*2))
N, M = [int(i) for i in input().split()]

n_comb = (N * (N -1)) / 2
m_comb = (M * (M -1)) / 2

output = int(n_comb) + int(m_comb)

print(output)
from math import factorial

inputted = list(map(int, input().split()))
N = inputted[0]
M = inputted[1]

nPk = lambda n, k: 0 if n - k < 0 else factorial(n) / (factorial(k) * factorial(n - k))

answer = nPk(N, 2) +  nPk(M, 2)
answer = int(answer)

print(answer)
N,M = map(int, input().split())
print(int((N*(N-1)+M*(M-1))/2))
n,m = map(int,input().split())

if n == 1 and m ==1:
    print(0)
    exit()

ans = 0
ans += n*(n-1)/2
ans += m*(m-1)/2
print(int(ans))
a,b=input().split()
a=int(a)
b=int(b)
print(int(a*(a-1)/2+(b*(b-1)/2)))
N, M = map(int, input().split())
print(int((N * (N - 1) + M * (M - 1)) * 0.5))
N, M = [int(_) for _ in input().split()]
print(N*(N-1)//2 + M*(M-1)//2)
N,M = map(int,input().split())
if N ==1 and M ==1:
    print(0)
elif N ==1 and M != 1:
    print(int(M*(M-1)/2))
elif N != 1 and M ==1:
    print(int(N*(N-1)/2))
else:    
    a = N*(N-1)
    b = M*(M-1)
    print(int((a+b)/2))
import math
n, m = map(int,input().split())
def a(n, l):
    return math.factorial(n) // ((math.factorial(n - l) * math.factorial(l)))
if n and m >1:
    print(a(n, 2)+a(m, 2))
elif n > 1:
    print(a(n, 2))
elif m > 1:
    print(a(m, 2))
else:
    print(0)
n,m=map(int,input().split())
a=n*(n-1)/2+m*(m-1)/2
a=int(a)
print(str(a))
NM = input().split(" ")
N = int(NM[0])
M = int(NM[1])

#print(N,M)
comb_N=0
comb_M=0
if N>=2:
  comb_N = (N*(N-1))/2
if M>=2:
  comb_M = (M*(M-1))/2

print(int(comb_N+comb_M))
N, M = map(int, input().split())
ans = (N+M)*(N+M-1)//2 - N*M
print(ans)
N, M = map(int, input().split())
ans = (N*(N-1) + M*(M-1))/2
print(int(ans))
import math
def comb(n, r):
    if n < r:
        return 0
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

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

print(comb(n, 2) + comb(m, 2))
from math import factorial

def choose(n, k):
    if n < k:
        return 0
    else:
        return factorial(n) // factorial(k) // factorial(n - k)

n, m = map(int, input().split())
print(choose(n, 2) + choose(m, 2))
even,odd =map(int,input().split())

tot = even+odd
num = int(tot*(tot-1)/2 - even*odd)
print(num)
n, m = map(int, input().split())
print((n * (n - 1) + m * (m - 1)) // 2)
import math


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


def combinations_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))


ans = 0
if n > 1:
    ans += combinations_count(n, 2)
if m > 1:
    ans += combinations_count(m, 2)

print(ans)
NM = input("").split()
N = int(NM[0])
M = int(NM[1])


K = N*(N-1)/2 + M*(M-1)/2
K = int(K)
print(K)
N , M = map(int,input().split())
ans = 0
ans += N * (N - 1) // 2
ans += M * (M - 1) // 2

print( ans )
n, m = map(int, input().split())

count = 0
if n > 1:
  count += n * (n - 1) // 2
if m > 1:
  count += m * (m - 1) // 2
print(count)
N,M = map(int,input().split())

a = int(N*(N-1)/2 + M*(M-1)/2)

print(a)
import itertools

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

ans = N*(N-1)//2 + M*(M-1)//2
print(ans)
even, odd = list(map(int, input().split()))
print((even*(even-1)//2) + (odd*(odd-1)//2))
import itertools
n,m  = map(int, input().split())
l = list()
ans = 0

for i in range(n):
  l.append(2)
for i in range(m):
  l.append(1)

for v in itertools.combinations(l, 2):
  if sum(v)%2 == 0:
    ans += 1

print(ans)
from math import factorial

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

def comb(n, r):
    if n - r < 0:
        return 0
    else:
        return factorial(n) // (factorial(n - r) * factorial(r))

print(comb(N, 2) + comb(M, 2))
n, m = map(int,input().split())

print(n*(n-1)//2 +m*(m-1)//2)
import math
n, m = map(int, input().split())
ans = n * (n - 1) / 2 + m * (m - 1) / 2
print(int(ans))
N, M = map(int, input().split())

print((N * (N - 1) // 2) + (M * (M - 1) // 2))
N, M = map(int, input().split())
print((N*(N-1))//2 + (M*(M-1))//2)
def inp():
    return input()
def iinp():
    return int(input())
def inps():
    return input().split()
def miinps():
    return map(int,input().split())
def linps():
    return list(input().split())
def lmiinps():
    return list(map(int,input().split()))
def lmiinpsf(n):
    return [list(map(int,input().split()))for _ in range(n)]

def re(n):
  if n < 2:
    return 1
  return n*re(n-1)

def c(n,r):
  return re(n)//re(n-r)//2

a,b = miinps()

ans = 0

ans += c(a,2)
ans += c(b,2)

print(ans)
num = [int(n) for n in input().split()]

def comb(x):
    if x >= 2:
        return (x * (x-1)) / 2
    else:
        return 0

r = 0

for i in num:
    r += comb(i)

print(int(r))
if __name__ == "__main__":
    n, m = map(int, input().split())
    ans = m * (m - 1) / 2 + n * (n - 1) / 2
    print(int(ans))
def s0():return input()
def s1():return input().split()
def s2(n):return [input() for x in range(n)]
def n0():return int(input())
def n1():return [int(x) for x in input().split()]
def n2(n):return [int(input()) for _ in range(n)]
def n3(n):return [[int(x) for x in input().split()] for _ in range(n)]

n,m=n1()

import math
print(n*(n-1)//2+m*(m-1)//2)
import math

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

def com(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

if(N==0 and M==0):
  print("0")
elif(N==0 and M==1):
  print("0")
elif(N==1 and M==1):
  print("0")
elif(M==0 or M==1):
  print(com(N, 2))
elif(N==0):
  print(com(M, 2))
else:
  print(com(N, 2) + com(M, 2))
n, m = map(int,input().split())

print(int((n*(n-1))/2 + ((m*(m-1))/2)))
i = input().split(" ")
n = int(i[0])
m = int(i[1])

r = n * (n-1) / 2 + m * (m-1) / 2

print(int(r))
n, m = map(int, input().split())
print(int((n * (n - 1) / 2) + (m * (m - 1) / 2)))
n,m=map(int,input().split())
ans=n*(n-1)//2+m*(m-1)//2
print(ans)
n, m = map(int, input().split())
print((n * (n - 1) // 2) + (m * (m - 1) // 2))
import math

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


def combinations_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))


if m >= 2:
    odd = combinations_count(m, 2)
elif m == 0 or m == 1:
    odd = 0

if n >= 2:
    even = combinations_count(n, 2)
elif n == 1:
    even = 1
elif n == 0:
    even = 0

answer = odd + even
if m == 1 and n == 1:
    answer = 0

print(answer)
N,M=map(int,input().split())
print((N*(N-1)+M*(M-1))//2)
n,m=map(int, input().split())
from scipy.misc import comb
print(comb(n,2,exact=True)+comb(m,2,exact=True))
n, m = map(int, input().split())
print((n*(n-1))//2+(m*(m-1))//2)
import math
n, m = map(int, input().split())

def comb(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))
ll = 0
if n > 1:
  ll = comb(n, 2)
rr = 0
if m > 1:
  rr = comb(m, 2)
print(ll + rr)
print(sum([i*(i-1)//2 for i in list(map(int, input().split()))]))
N,M = map(int,input().split())
ans = N*(N-1)//2 + M*(M-1)//2
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


if __name__ == '__main__':
    a,b = map(int, input().split())
    c = 0
    d = 0
    if a > 1:
        c = cmb(a,2)
    if b > 1:
        d = cmb(b,2)
    print(c+d)
n,m = map(int, input().split())
print(int(n*(n-1)/2+m*(m-1)/2))
# -*- coding: utf-8 -*-
"""
Created on Thu Mar 19 11:55:12 2020

@author: 17664
"""
even, odd = map(int, input().split())

print(int((even*(even-1)/2 + odd*(odd-1)/2)))
n,m=map(int,input().split())
if(n+m>=2 and n>=0 and n<=100 and m<=100 and m>=0):
    ans=int(round(n*(n-1)/2)+(m*(m-1)/2))
    print(ans)
N, M = map(int, input().split())
print(round((N * (N-1) + M * (M-1)) / 2))
N, M = map(int, input().split())
if (N>=2)&(M>=2):
    ans = N*(N-1)/2 + M*(M-1)/2
elif (N<2)&(M<2):
    ans = 0
elif N<2:
    ans = M*(M-1)/2
elif M<2:
    ans = N*(N-1)/2

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

ki = n[0]*(n[0]-1) / 2
gu = n[1]*(n[1]-1) / 2

print(int(ki + gu))
def main():
    a, b = map(int, input().split())
    print(int((a*(a-1)/2) + (b*(b-1)/2)))
main()
a,b=map(int,input().split())
print(int(a*(a-1)/2+b*(b-1)//2))
n, m = map(int, input().split())

print(n * (n - 1) // 2 + m * (m - 1) // 2)
N, M = map(int, input().split())

mysum = 0

if N >= 2:
    mysum += (N*(N-1))//2
if M >=2 :
    mysum += (M*(M-1))//2

print(mysum)
#!/usr/bin/env python3
n,m = map(int,input().split())
print((n*(n-1)//2) + (m*(m-1)//2))
n,m=map(int,input().split())
ans=0
if n>1:
  ans+=n*(n-1)//2
if m>1:
  ans+=m*(m-1)//2
print(ans)
import sys

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

#偶数+偶数
result = n * (n - 1) // 2
#奇数+奇数
result += m * (m - 1) // 2
print(result)
import math

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

def c(a, b):
    if a >= 2:
        return math.factorial(a) // (math.factorial(b) * math.factorial(a - b))
    else:
        return 0
        

print(c(n, 2) + c(m, 2))
n,m = map(int,input().split())
print(n*(n-1)//2+m*(m-1)//2)
n, m = list(map(int, input().split()))
nC2 = (n * (n - 1)) // 2
mC2 = (m * (m - 1)) // 2
print(nC2 + mC2)
li = input().split()
li[0] = int(li[0])  
li[1] = int(li[1])  
  
print( int(li[0]*(li[0]-1)/2 + li[1]*(li[1]-1)/2 ))
import math
def comb(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

n,m = (int(x) for x in input().split())

if n<=1:
  if m<=1:
    print(0)
  else:
    print(comb(m, 2))
elif m<=1:
  print(comb(n, 2))
else:
  print(comb(n, 2)+comb(m, 2))
n,m=map(int,input().split())
ans = n*(n-1)//2
ans += m*(m-1)//2
print(ans)
N, M = map(int,input().split())

print(N*(N-1)//2+M*(M-1)//2)
n, m = map(int, input().split())

if n >= 2:
    a = n * (n - 1) / 2
else:
    a = 0

if m >= 2:
    b = m * (m - 1) / 2
else:
    b = 0
    
print(int(a + b))
#!/usr/bin/ python3.8
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

N, M = map(int, readline().split())
x = M * (M - 1) // 2
x += N * (N - 1) // 2
print(x)
n,m=map(int,input().split())
x=(n*(n-1))//2
y=(m*(m-1))//2
print(x+y)
N, M = list(map(int, input().split()))

ans=0

for i in range(1, N):
    ans += i

for ii in range(1, M):
    ans += ii


print(ans)
n,m = map(int, input().split())
ans = n*(n-1)//2 + m*(m-1)//2
print(ans)
n, m = map(int, input().split())
oo = n * (n-1) / 2
ee = m * (m-1) / 2

print(int(oo + ee))
n,m=map(int,input().split());print(n*~-n+m*~-m>>1)
n, m = map(int, input().split())
print(n * (n-1) // 2 + m * (m-1) // 2)
n,m = map(int, input().split())

ans = n * (n-1) // 2 + m * (m-1) // 2
print(ans)
n, m = map(int, input().split())
print((m*(m-1))//2+(n*(n-1))//2)
#%%
import sys
def input():
    return sys.stdin.readline().rstrip()

def main():
    N, M = map(int, input().split())

    print(N*(N-1)//2+M*(M-1)//2)

# %%
if __name__ == '__main__':
    main()

# %%
# from atcoder_test import doTest
# doTest("abc159","a",main)
N, M = (int(x) for x in input().split())
print(int(N*(N-1)/2 + M*(M-1)/2))
n,m = map(int,input().split())

ans = n*(n-1)//2 + m*(m-1)//2

print(ans)
N, M = list(map(int, input().split()))

ans = 0
ans += N * (N-1) // 2 if N!=1 else 0
ans += M * (M-1) // 2 if M!=1 else 0

print(ans)
import math
def P(n, r):
    return math.factorial(n)//math.factorial(n-r)
def C(n, r):
    return P(n, r)//math.factorial(r)
N, M = map(int, input().split())
if N > 1:
    ans1 = C(N,2)
else:
    ans1 = 0
if M > 1:
    ans2 = C(M,2)
else:
    ans2 = 0
print(ans1+ans2)
N, M = map(int, input().split())
print(int((N*(N-1)/2) + (M*(M-1)/2)))
e,o = map(int,input().split())
cte = (e*(e-1))//2
cto = (o*(o-1))//2
print(cte+cto)
#A - The Number of Even Pairs
N,M= map(int, input().split())

ans = (N*(N-1))//2 +(M*(M-1))//2

print(ans)
n,m = map(int,input().split())
print(((n-1)*n + (m-1)*m)//2)
import math
def combinations_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))
N,M = map(int,input().split(" "))
if N>1:
    n = combinations_count(N, 2)
else:
    n=0
if M>1:
    m = combinations_count(M, 2)
else:
    m=0
print(n+m)
#!/usr/bin/env python3
import math

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

# 偶数だけ
# 奇数だけ


def C(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))


t = 0
if N >= 2:
    t += C(N, 2)
if M >= 2:
    t += C(M, 2)
ans = t
print(ans)
import math
N, M = map(int, input().split())
S =( N * (N-1) + M * (M-1))//2
print(S)
n,m = map(int,input().split())
print((n*(n-1)//2)+m*(m-1)//2)
N,M=map(int,input().split())
count = 0
count += M*(M-1)/2
count += N*(N-1)/2
print(int(count))
guusuu, kisuu = map(int, input().split())
guusuuhairetu = [i for i in range(2, guusuu * 2 + 1, 2)]
kisuuhairetu = [i for i in range(1, kisuu * 2, 2)]
count = 0
haiiretu = guusuuhairetu + kisuuhairetu
hairetu2 = guusuuhairetu + kisuuhairetu
for i in hairetu2:
    haiiretu.remove(i)
    for u in haiiretu:
        if (i + u) % 2 == 0:
            count += 1
print(count)
def main():
    N, M = (int(i) for i in input().split())
    ans = 0
    if N >= 2:
        ans += N*(N-1)//2
    if M >= 2:
        ans += M*(M-1)//2
    print(ans)


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

ans = n * (n - 1) // 2 + m * (m - 1) // 2

if ans < 0:
    print(ans)
else:
    print(ans)
N,M = map(int,input().split())
print(int((N * (N-1))/2 + (M * (M-1))/2))
# -*- coding: utf-8 -*-
N, M = map(int, input().split())

print((N * (N - 1) + M * (M - 1)) // 2)
a,b=map(int, input().split())
print((a*(a-1)+b*(b-1))//2)
n,m = map(int,input().split())
res = 0
if(n>=2):
	res += n * (n-1) // 2
if(m>=2):
	res += m * (m-1) // 2
print(res)
N,M=map(int,input().split())
Ans = (N**2-N)/2 + (M**2-M)/2
print(int(Ans))
from itertools import permutations, combinations,combinations_with_replacement,product

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

s = [1 for _ in range(n)]
t = [1 for _ in range(m)]

a = list(combinations(s, 2))
b = list(combinations(t, 2))

print(int(len(a)) + int(len(b)))
n,m = map(int,input().split())
a=n+m
print(int(a*((a-1)/2)-n*m))
N, M = map(int,input().split())
print(N*(N-1)//2+M*(M-1)//2)
import numpy as np
a = [int(i) for i in list(input().split())]
b = int((a[0]*(a[0]-1) +a[1]*(a[1]-1))/2)

print(b)
#input
N, M = map(int, input().split())

#output
if N == 0:
    print(M*(M-1)//2)
elif M == 0:
    print(N*(N-1)//2)
else:
    print(N*(N-1)//2 + M*(M-1)//2)
M,N=map(int,input().split())
def fact(n):
	s=1
	for i in range(2,n+1):
		s=s*i
	return s

def conb(n,r):
	return fact(n)//(fact(r)*fact(n-r))

if (N==1 or N==0) and (M==1 or M==0):
	print(0)
elif N==1 or N==0:
	print(conb(M,2))
elif M==1 or M==0:
	print(conb(N,2))
else:
	print(conb(M,2)+conb(N,2))
a = list(map(int,input().split()))
n = a[0]
m = a[1]

if n ==1:
    if m ==1:
        print(0)
    else:
        print(int(m*(m-1)/2))
else:
    if m == 1:
        print(int(n*(n-1)/2))
    else:
        print(int(m*(m-1)/2 + n*(n-1)/2))
N, M = [int(x) for x in input().split()]
ans = (N * (N - 1) + M * (M - 1)) // 2
print(ans)
N,M = map(int,input().split())

print(int((N*(N-1))/2+(M*(M-1))/2))
st = input().split()

n = int(st[0])
m = int(st[1])
print(int(n * (n - 1) / 2 + m * (m - 1) / 2))
a,b=map(int,input().split())
print(int(a*(a-1)/2+b*(b-1)/2))
[n, m] = input().split()
m = int(m)
n = int(n)

sum = 0
sum2 = 0
for i in range(m):
    sum += i

for i in range(n):
    sum2 += i

print(sum + sum2)