Problem:
 Score : 100 points    Problem Statement  We have N+M balls, each of which has an integer written on it. It is known that:   The numbers written on N of the balls are even.  The numbers written on M of the balls are odd.   Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the numbers written on them is even. It can be shown that this count does not depend on the actual values written on the balls.      Constraints   0 \leq N,M \leq 100  2 \leq N+M  All values in input are integers.         Input  Input is given from Standard Input in the following format:  N  M       Output  Print the answer.        Sample Input 1 2 1      Sample Output 1 1  For example, let us assume that the numbers written on the three balls are 1,2,4 .   If we choose the two balls with 1 and 2 , the sum is odd;  If we choose the two balls with 1 and 4 , the sum is odd;  If we choose the two balls with 2 and 4 , the sum is even.   Thus, the answer is 1 .       Sample Input 2 4 3      Sample Output 2 9       Sample Input 3 1 1      Sample Output 3 0       Sample Input 4 13 3      Sample Output 4 81       Sample Input 5 0 3      Sample Output 5 3

Solution (Python):
a,b=map(int,input().split())
ams=((a*(a-1)/2)+(b*(b-1)/2))
print(int(ams))

Solution (Python):


import math
def nC2(n):
  
  
  if n<2:
    return 0
  return math.factorial(n) // (math.factorial(n - 2) * 2)
n,m = map(int, input().split())



r=nC2(n)+nC2(m)
print(r)

Solution (Python):


def main():

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

    numN = N * (N - 1) / 2
    numM = M * (M - 1) / 2

    ans = 0

    if numN >= 0:
        ans += numN

    if numM >= 0:
        ans += numM

    print(int(ans))


if __name__ == "__main__":
    main()

Solution (Python):
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))

Solution (Python):
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))

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

Solution (Python):
a,b=list(map(int,input().split()))
x=int(a/2*(a-1)+b/2*(b-1))
print(x)

Solution (Python):
n, m = map(int, input().split())
print(n*(n - 1)//2 + m*(m - 1)//2)

Solution (Python):
n, m = map(int, input().split())
print((n*(n - 1) + m*(m - 1)) // 2)

Solution (Python):
tmp = input().split(" ")
N = int(tmp[0])
M = int(tmp[1])
 
ans = N * (N - 1) / 2 + M * (M - 1) / 2

print(int(ans))

Solution (Python):
n, m = list(map(int, input().split()))
nC2 = (n * (n - 1)) // 2
mC2 = (m * (m - 1)) // 2
print(nC2 + mC2)

Solution (Python):
import math
n, m = list(map(int, input().split()))
nC2 = math.factorial(n) // (math.factorial(2) * math.factorial(n - 2)) if n >= 2 else 0
mC2 = math.factorial(m) // (math.factorial(2) * math.factorial(m - 2)) if m >= 2 else 0
print(nC2 + mC2)

Solution (Python):
n, m = map(int, input().split())
count = 0


for i in range(1, n + 1):
    for j in range(i + 1, n + 1):
        count += 1

for i in range(1, m + 1):
    for j in range(i + 1, m + 1):
        count += 1

print(count)

Solution (Python):
n, m = map(int, input().split())
print(m*(m-1)//2+n*(n-1)//2)

Solution (Python):
n,m = map(int, input().split())
ans = n*(n-1)//2 + m*(m-1)//2
print(ans)

Solution (Python):
import math
import itertools

N, M = map(int, input().split())
print(len(list(itertools.combinations(range(N), 2))) + len(list(itertools.combinations(range(M), 2))))

Solution (Python):
n,m = map(int,input().split())
ans = n * (n - 1) / 2 + m * (m - 1) / 2
print(int(ans))

Solution (Python):

from collections import defaultdict, Counter
from itertools import product, groupby, count, permutations, combinations
from math import pi, sqrt
from collections import deque
from bisect import bisect, bisect_left, bisect_right
from string import ascii_lowercase
from functools import lru_cache
import sys
sys.setrecursionlimit(10000)
INF = float("inf")
YES, Yes, yes, NO, No, no = "YES", "Yes", "yes", "NO", "No", "no"
dy4, dx4 = [0, 1, 0, -1], [1, 0, -1, 0]
dy8, dx8 = [0, -1, 0, 1, 1, -1, -1, 1], [1, 0, -1, 0, 1, 1, -1, -1]


def inside(y, x, H, W):
    return 0 <= y < H and 0 <= x < W


def ceil(a, b):
    return (a + b - 1) // b


def sum_of_arithmetic_progression(s, d, n):
    return n * (2 * s + (n - 1) * d) // 2


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


def lcm(a, b):
    g = gcd(a, b)
    return a / g * b


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


def main():
    solve()


if __name__ == '__main__':
    main()

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

Solution (Python):


from typing import *
import collections
import functools
import itertools
import math
import sys

INF = float('inf')


def nPr(n: int, r: int) -> int:
    return math.factorial(n) // math.factorial(n - r)


def nCr(n: int, r: int) -> int:
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))


def solve(N: int, M: int):
    return (nCr(N, 2)if N > 1 else 0) + (nCr(M, 2) if M > 1 else 0)


def main():

    sys.setrecursionlimit(10 ** 6)

    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  
    M = int(next(tokens))  
    print(f'{solve(N, M)}')


if __name__ == '__main__':
    main()

Solution (Python):



































































global FLAG_LOG
FLAG_LOG = False


def log(value):
    
    
    if FLAG_LOG:
        print(str(value))


def calculation(lines):
    
    
    N, M = list(map(int, lines[0].split()))
    
    
    
    
    
    
    
    

    result = 0

    
    if N > 1:
        result += N*(N-1)/2
    
    if M > 1:
        result += M*(M-1)/2
    result = int(result)
    return [result]



def get_input_lines(lines_count):
    lines = list()
    for _ in range(lines_count):
        lines.append(input())
    return lines



def get_testdata(pattern):
    if pattern == 1:
        lines_input = ['2 1']
        lines_export = [1]
    if pattern == 2:
        lines_input = ['4 3']
        lines_export = [9]
    if pattern == 3:
        lines_input = ['1 1']
        lines_export = [0]
    if pattern == 4:
        lines_input = ['13 3']
        lines_export = [81]
    if pattern == 5:
        lines_input = ['0 3']
        lines_export = [3]
    return lines_input, lines_export



def get_mode():
    import sys
    args = sys.argv
    global FLAG_LOG
    if len(args) == 1:
        mode = 0
        FLAG_LOG = False
    else:
        mode = int(args[1])
        FLAG_LOG = True
    return mode



def main():
    import time
    started = time.time()
    mode = get_mode()
    if mode == 0:
        lines_input = get_input_lines(1)
    else:
        lines_input, lines_export = get_testdata(mode)

    lines_result = calculation(lines_input)

    for line_result in lines_result:
        print(line_result)

    
    
    
    
    
    
    
    
    
    
    



if __name__ == '__main__':
    main()

Solution (Python):




import math

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

if (n >= 2):
    a = math.factorial(n)//(2*math.factorial(n-2))
else:
    a = 0

if (m >= 2):
    b = math.factorial(m)//(2*math.factorial(m-2))
else:
    b = 0

print(a+b)

Solution (Python):
N, M = map(int, input().split())

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

print(ans)

Solution (Python):
n, m = map(int, input().split())
x = n * (n - 1) // 2 if n > 1 else 0
y = m * (m - 1) // 2 if m > 1 else 0
print(x + y)

Solution (Python):
n,m= map(int,input().split())
ans = 0
ans += n*(n-1)//2
ans += m*(m-1)//2
print(ans)

Solution (Python):
N, M = map(int, input().split())

import math
if M >= 2:
    m = math.factorial(M) // (math.factorial(M - 2) * math.factorial(2))
else:
    m = 0
if N >= 2:
    n = math.factorial(N) // (math.factorial(N - 2) * math.factorial(2))
else:
    n = 0
print(m + n)

Solution (Python):
m,n =  map(int, input().split())
print(n*(n-1)//2+m*(m-1)//2)

Solution (Python):
N,M=map(int,input().split())
print(N*~-N//2+M*~-M//2)

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

Solution (Python):
N, M = map(int, input().split())

odd = (M * (M - 1)) / 2
even = (N * (N - 1)) / 2

print(int(odd + even))

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

Solution (Python):
n,m=map(int,input().split())
print(int(n*(n-1)/2+m*(m-1)/2))

Solution (Python):


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

Solution (Python):
N , M = map(int,input().split())
ans = 0
ans += N * (N - 1) // 2
ans += M * (M - 1) // 2

print( ans )

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

Solution (Python):
N,M=map(int,input().split())

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

Solution (Python):
import math


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


def main():
    n, m = map(int, input().split())
    if n < 2:
        even = 0
    else:
        even = combinations_count(n, 2)
    if m < 2:
        odd = 0
    else:
        odd = combinations_count(m, 2)
    print(even + odd)


if __name__ == "__main__":
    main()

Solution (Python):

import sys 
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
N, M = map(int, readline().split())
print((N*(N-1)+M*(M-1))//2)

Solution (Python):
import sys
import math
N,M = map(int,input().split())

if not ( 0 <= N <= 100 and 0 <= M <= 100 ): sys.exit()
if not ( 2 <= N+M ): sys.exit()
if not ( isinstance(N,int) and isinstance(M,int) ): sys.exit()

ans = 0
if N >= 2:
    ans += math.factorial(N) // (math.factorial(N - 2) * math.factorial(2))
if M >= 2:
    ans += math.factorial(M) // (math.factorial(M - 2) * math.factorial(2))
print(ans)

Solution (Python):
n,m=map(int,input().split())
print(int(n*(n-1)/2+m*(m-1)/2))

Solution (Python):
from sys  import stdin,stdout

import bisect

import math

def st():
    return list(stdin.readline().strip())

def inp():
    return int(stdin.readline())

def li():
    return list(map(int,stdin.readline().split()))

def mp():
    return map(int,stdin.readline().split())

def pr(n):
    stdout.write(str(n)+"\n")

def soe(limit):
    l=[1]*(limit+1)
    prime=[]
    for i in range(2,limit+1):
        if l[i]:
            for j in range(i*i,limit+1,i):
                l[j]=0

    for i in range(2,limit+1):
        if l[i]:
            prime.append(i)
    return prime

def segsoe(low,high):
    limit=int(high**0.5)+1
    prime=soe(limit)
    n=high-low+1
    l=[0]*(n+1)
    for i in range(len(prime)):
        lowlimit=(low//prime[i])*prime[i]
        if lowlimit<low:
            lowlimit+=prime[i]
        if lowlimit==prime[i]:
            lowlimit+=prime[i]
        for j in range(lowlimit,high+1,prime[i]):
            l[j-low]=1
    for i in range(low,high+1):
        if not l[i-low]:
            if i!=1:
                print(i)

def power(a,n):
    r=1
    while n:
        if n&1:
            r=(r*a)
        a*=a
        n=n>>1
    return r


def solve():
    c=0
    a,b=mp()
    c+=((a-1)*(a))//2
    c+=((b-1)*(b))//2
    print(c)

for _ in range(1):
    solve()

Solution (Python):


from itertools import combinations as com

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

n = [0] * N
m = [0] * M

ans = len(list(com(n, 2))) + len(list(com(m, 2)))

print(ans)

Solution (Python):
n,m=map(int,input().split())
print((n*(n-1)+m*(m-1))//2)

Solution (Python):
n,m=map(int,input().split())
a=(n*(n-1))>>1
a+=(m*(m-1))>>1
print (a)

Solution (Python):

import sys
import os
if sys.platform=="darwin":
	base = os.path.dirname(os.path.abspath(__file__))
	name = os.path.normpath(os.path.join(base, '../atcoder/input.txt'))
	
	sys.stdin = open(name)

from math import factorial

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

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






print(combinations_count(n,2) + combinations_count(m,2))

Solution (Python):
n,m = map(int,input().split())
print(int(n*(n-1)//2 + m*(m-1)//2))

Solution (Python):
N, M = map(int, input().split())

Ev = M * (M - 1) // 2
Od = N * (N - 1) // 2

print(Ev + Od)

Solution (Python):
n,m = map(int, input().split())


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

Solution (Python):
n,m = map(int,input().split())
print(n*(n-1)//2+m*(m-1)//2)

Solution (Python):
n,m = map(int, input().split())
ans=(n+m)*(n+m-1)/2-n*m
print(int(ans))

Solution (Python):
n,m=map(int,input().split())
print((n*(n-1)+m*(m-1))//2)

Solution (Python):
n,m=map(int,input().split());print(n*(n-1)//2+m*(m-1)//2)

Solution (Python):
n, m = map(int, input().split())
ans = 0
for i in range(1, n):
  ans += i
for i in range(1, m):
  ans += i
print(ans)

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

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

Solution (Python):
"""
偶数：偶数＋偶数 or 奇数＋奇数
奇数：偶数＋奇数
"""

def the_number_of_even_pairs():
    
    N, M = map(int, input().split())
    
    list_N = [0] * N
    list_M = [1] * M
    even_pairs_count = 0
    
    
    for _ in range(N):
        even_pairs_count += len(list_N)-1
        list_N.pop(0)
    
    for _ in range(M):
        even_pairs_count += len(list_M)-1
        list_M.pop(0)
    
    return even_pairs_count

result = the_number_of_even_pairs()
print(result)

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

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

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

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

Solution (Python):

import sys
import collections as cl


def II(): return int(sys.stdin.readline())


def MI(): return map(int, sys.stdin.readline().split())


def LI(): return list(map(int, sys.stdin.readline().split()))


def main():
    N, M = MI()
    print(int(N*(N-1)/2 + M*(M-1)/2))


main()

Solution (Python):
n,m = map(int,input().split())

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

Solution (Python):
n,m = list(map(int,input().split()))

print(int(n * (n -1) / 2 +  m * (m -1) / 2))

Solution (Python):
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())

cmb_n = cmb(n,2) if n>=2 else 0
cmb_m = cmb(m,2) if m>=2 else 0

print(cmb_n+cmb_m)

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

Solution (Python):
a, b = map(int, input().split(' '))
print(int(a*(a-1)/2 + b*(b-1)/2))

Solution (Python):
n,m = map(int,input().split())
'''
和が偶数:
奇数＋奇数
偶数＋偶数
'''
ans = n*(n-1)//2 + m*(m-1)//2
print(ans)

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

Solution (Python):
n,m=map(int, input().split())


if n==1:
    even=0
else:
    even=int(n*(n-1)/2)
    

if m==1:
    odd=0
else:
    odd=int(m*(m-1)/2)
    
print(even+odd)

Solution (Python):
N=list(map(int,input().split()))
ans=0
for x in range(2):
  if N[x]==0 or N[x]==1:
    pass
  else:
    ans += N[x]*(N[x]-1)/2
print(int(ans))

Solution (Python):
n,m=map(int,input().split())
print((n+m)*(n+m-1)//2-n*m)

Solution (Python):
a,b=map(int,input().split())
c = a * (a-1)/2
d = b*(b-1)/2
res = int(c+d)
print(res)

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

Solution (Python):
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(ans)

Solution (Python):
m,n=map(int, input().split())
print(int((m*(m-1)+n*(n-1))/2))

Solution (Python):
import itertools
n, m = map(int, input().split())

nn = []
i = 0
for _ in range(n):
    nn.append(i)
    i += 2

mm = []
i = 1
for _ in range(m):
    mm.append(i)
    i += 2

ans = 0
l = nn + mm

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

Solution (Python):
n,m=map(int,input().split())
print( int((n+m)*(n+m-1)/2 - n*m) )

Solution (Python):
n,m=map(int,input().split())
print(n*(n-1)//2+m*(m-1)//2)

Solution (Python):
from scipy.special import comb
N, M = map(int, input().split())
ans = 0
if N >= 2:
    ans += comb(N, 2, exact=True)
if M >= 2:
    ans += comb(M, 2, exact=True)
print(ans)

Solution (Python):
n, m = map(int, input().split())
print((n * (n - 1) + m * (m - 1)) // 2)

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

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

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

Solution (Python):
def main():
 n,m = map(int,input().split())
 print(n * (n - 1) // 2 + m * (m - 1) // 2)
main()

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

Solution (Python):
import sys


def main():
    input = sys.stdin.buffer.readline
    n, m = map(int, input().split())
    print(n * (n - 1) // 2 + m * (m - 1) // 2)


if __name__ == "__main__":
    main()

Solution (Python):
n, m = map(int, input().split())

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

Solution (Python):
n, m = (int(i) for i in input().split())

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

print(tot)

Solution (Python):
N,M=map(int,input().split())

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

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

Solution (Python):
N,M = map(int, input().split())
ans1 = 0
ans2 = 0

ans1 = N*(N-1)/2
ans2 = M*(M-1)/2

print(int(ans1 + ans2))

Solution (Python):
n,m = map(int,input().split())
print(n * (n - 1) // 2 + m * (m - 1) // 2)

Solution (Python):

import math

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

nans = (n * (n - 1)) // 2
mans = (m * (m - 1)) // 2

print(nans + mans)

Solution (Python):
n, m = map(int, input().split())
print(int((n * (n - 1) / 2) + (m * (m - 1) / 2)))

Solution (Python):
n, m = list(map(int, input().split()))

print(sum(range(n)) + sum(range(m)))

Solution (Python):
import sys

read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007


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

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

    print(ans)
    return


if __name__ == '__main__':
    main()

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

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

Solution (Python):
n, m = map(int,input().split())

nx = int(n * ( n - 1) / 2)
mx = int(m * (m -1) / 2)
print(nx + mx)

Solution (Python):
n,m = map(int,input().split())
print(int(((n+m)*(n+m-1)/2)-(n*m)))

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

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

Solution (Python):
n, m = map(int, input().split())
print(n * (n - 1) // 2 + m * (m - 1) // 2)

Solution (Python):
n, m = map(int, input().split())
print((n * (n - 1))//2 + (m*(m - 1)//2))

Solution (Python):
import sys
sys.setrecursionlimit(10**7)
input = sys.stdin.readline

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

sum = n * (n - 1) // 2
if 1 < m:
    sum += m * (m - 1) // 2
print(sum)

Solution (Python):
import math

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




if N >= 2:
  Nf = math.factorial(N)//(math.factorial(N-2)*2)
else:
  Nf = 0

if M >= 2:
  Mf = math.factorial(M)//(math.factorial(M-2)*2)
else:
  Mf = 0
ans = int(Nf + Mf)
print(ans)

Solution (Python):
N,M = map(int,input().split())
 
if N>=2:
  gyu = N*(N-1)//2
else:
  gyu = 0
  
if M>=2:
  ki = M*(M-1)//2
else:
  ki = 0
 
print(gyu+ki)

Solution (Python):
n, m = map(int, input().split())

even = n * (n - 1) // 2
odd = m * (m - 1) // 2

print(even + odd)

Solution (Python):
N, M = (int(x) for x in input().split())
ans=0
if N>=2:
  ans+=N*(N-1)/2
if M>=2:
  ans+=M*(M-1)/2
print(int(ans))

Solution (Python):
n,m = map(int,input().split())
print(n*(n-1)//2 + m*(m-1)//2)

Solution (Python):
N, M = map(int, input().split())

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

Solution (Python):
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)

Solution (Python):
n,m = map(int,input().split())
method = n*(n-1)/2 + m*(m-1)/2
print(int(method))

Solution (Python):
n, m = map(int, input().split())
ans = int(n*(n-1)/2 + m*(m-1)/2)
print(ans)

Solution (Python):
N, M = map(int, input().split())

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

print(ans)

Solution (Python):
n,m = map(int,input().split())
a = n*(n-1)/2 + m*(m-1)/2
print(int(a))

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

Solution (Python):
n,m = map(int, input().split())

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

Solution (Python):
import sys
input = sys.stdin.readline
N,M= list(map(int,input().split()))
print(N*(N-1)//2+M*(M-1)//2)

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

Solution (Python):
from math import factorial
a = 0
b = 0
n, m = map(int,input().split())
if 1 < n:
  a = factorial(n) / factorial(2) / factorial(n - 2)
if 1 < m:
  b = factorial(m) / factorial(2) / factorial(m - 2)
print(int(a+b))

Solution (Python):
n, m = map(int, input().split(' '))

def nCr(n, r):
    if n < r:
        return 0
    ans = 1
    for i in range (r):
        ans *= (n-r+i+1)
        ans = ans // (i+1)

    return ans

print(nCr(n, 2) + nCr(m, 2))

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

Solution (Python):
import itertools 
n,m=map(int,input().split());l1=[];l2=[];ans=0
while len(l1)<n:
  if len(l1)==0:
    l1.append(2)
  else:
    l1.append(l1[-1]+2)
while len(l2)<m:
  if len(l2)==0:
    l2.append(1)
  else:
    l2.append(l2[-1]+2)
for i in list(itertools.combinations(l1+l2, 2)):
  if sum(i)%2==0:
    ans+=1
print(ans)

Solution (Python):
n, m = map(int, input().split())
print(n * (n - 1) // 2 + m * (m - 1) // 2)

Solution (Python):
n,m = map(int,input().split())

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

Solution (Python):
n, m = map(int, input().split())

print(int(n*(n-1)/2+m*(m-1)/2))

Solution (Python):
n, m = list(map(int, input().split()))
print(int((n * (n-1) + m * (m-1)) / 2))

Solution (Python):
N,M = map(int, input().split())

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

Solution (Python):
n,m=map(int,input().split())
print(n*~-n+m*~-m>>1)

Solution (Python):
N,M = map(int,input().split())















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

print(int(ans))

Solution (Python):
N,M = map(int, input().split())
if N==1 and M==1:
  result = 0
if 0<=N and N<=1 and 2<=M:
  result = M*(M-1)//2
if 2<=N and 0<=M and M<=1:
  result = N*(N-1)//2
if 2<=N and 2<=M:
  result = (N*(N-1)+M*(M-1))//2
  
print(result)

Solution (Python):
n,m = [int(i) for i in input().split()]
p = ['P']*n
k = ['I']*m
al = p+k
ans = 0
for i in range(len(al)):
    for j in range(i+1,len(al)):
        if al[i] == 'I' and al[j]=='I':ans+=1
        if al[i] == 'P' and al[j] == 'P': ans+=1
print(ans)

Solution (Python):
import itertools
N, M = map(int, input().split())
print( len([i for i in list(itertools.combinations(([2]*N)+([3]*M), 2)) if sum(i) % 2 == 0]) )

Solution (Python):
N, M = [int(x) for x in input().split()]

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

Solution (Python):
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())

N, M = LI()

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

Solution (Python):
n, m = map(int, input().split())
print(n * (n-1) // 2 + m * (m-1) // 2)

Solution (Python):
import math

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


def choice(n, r):
    if r > n:
        return 0
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))


print(choice(a, 2) + choice(b, 2))

Solution (Python):
import math
N,M=map(int,input().split())

def comb(num,k):
    if num<2:
        return 0
    return math.factorial(num)/(math.factorial(k)*math.factorial(num-k))

ans=int(comb(N,2)+comb(M,2))

print(ans)

Solution (Python):
N, M = map(int, input().split())

import math
print(math.comb(N, 2)+math.comb(M, 2))

Solution (Python):
N,M = map(int, input().split())
S = N+M
ans = S*(S-1) / 2 - N * M
print(int(ans))

Solution (Python):
from math import factorial
n,m=map(int,input().split())
ans=0
if n>1:
    ans+=factorial(n)//2//factorial(n-2)
if m>1:
    ans+=factorial(m)//2//factorial(m-2)
print(ans)

Solution (Python):
from scipy.special import comb
m,n = map(int,input().split())
print(int(comb(m,2)+comb(n,2)))

Solution (Python):
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))

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

Solution (Python):
n,m = map(int,input().split())

print(int((n*(n-1))/2 + (m*(m-1))/2))

Solution (Python):
n , m = map ( int , input (). split ())
ans=(n*(n-1))/2+(m*(m-1))/2
print(int(ans))

Solution (Python):
N, M = map(int, input().split())

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

print(int(X + Y))

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

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

Solution (Python):
a,b=map(int, input().split())
print((a*(a-1)+b*(b-1))//2)

Solution (Python):
N, M = map(int,input().split())
cnt = 0
if N >= 2:
    cnt += N*(N-1)//2
if M >= 2:
    cnt += M*(M-1)//2

print(cnt)

Solution (Python):
N, M = list(map(int, input().split()))
ans = (N * (N-1)) // 2 + (M * (M-1)) // 2
print(ans)

Solution (Python):
n,m = map(int,input().split())
print(int((n*(n-1))/2+(m*(m-1)/2)))

Solution (Python):
n,m = (map(int,input().split()))
print(n*(n-1)//2 + m*(m-1)//2)

Solution (Python):
n,m = (map(int,input().split()))
print(n*(n-1)//2 + m*(m-1)//2)

Solution (Python):
n,m = map(int,input().split())
print(int((n*(n-1)+m*(m-1))/2))

Solution (Python):
import math
def combinations_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))
n, m = map(int, input().split())
ans = 0
if n >= 2:
	ans += combinations_count(n, 2)
if m >= 2:
    ans += combinations_count(m, 2)
print(ans)

Solution (Python):
N, M = map(int, input().split())

from math import factorial

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

print("{}".format(combination(N, 2) + combination(M, 2)))

Solution (Python):
n, m = map(int, input().split())

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

print(ans)

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

Solution (Python):
n, m = map(int, input().split())

def solve(n):
    if n == 0:
        return 1
    return n * solve(n - 1)

if n <= 1:
    n_ans = 0
else:
    n_ans = solve(n) // (solve(n - 2) * 2)
if m <= 1:
    m_ans = 0
else:
    m_ans = solve(m) // (solve(m - 2) * 2)
ans = n_ans + m_ans
print(ans)

Solution (Python):
N,M = map(int,input().split())

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

print(int(ans))

Solution (Python):




import math

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

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

counter = 0

if n >= 2:
    counter = counter + comb(n, 2)

if m >= 2:
    counter = counter + comb(m, 2)

print(counter)

Solution (Python):
n,m=map(int, input().split())
 
a=n*(n-1)/2+m*(m-1)/2
 
print(str(int(a)))

Solution (Python):
import scipy.misc
N, M = map(int, input().split())
ansN = 0
ansM = 0
if N != 1:
    ansN = N*(N-1)/2
if M != 1:
    ansM = M*(M-1)/2
ans = int(ansN+ansM)
print(ans)

Solution (Python):
N, M = map(int, input().split())
cnt = 0
cnt += N * (N - 1) // 2
cnt += M * (M - 1) // 2
print(cnt)

Solution (Python):
n,m = list(map(int,input().split()))

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

print(answer)

Solution (Python):
M, N = map(int, input().split())

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

Solution (Python):


import sys
input=sys.stdin.readline

def main():
    N,M=map(int,input().split())
    if N>=2 and M>=2:
        print((N*(N-1))//2+(M*(M-1)//2))
    elif N>=2:
        print((N*(N-1))//2)
    elif M>=2:
        print((M*(M-1)//2))
    else:
        print(0)
            
    
if __name__=="__main__":
    main()

Solution (Python):
n,m = map(int,input().split())

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

if (n>1)&(m>1):
	print(combinations_count(n, 2)+combinations_count(m, 2))
elif n>1:
    print(combinations_count(n, 2))
elif m>1:
    print(combinations_count(m, 2))
else:
    print(0)

Solution (Python):
n,m=map(int,input().split())

print(int(n*(n-1)/2+m*(m-1)/2))

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

Solution (Python):
N,M = (int(a) for a in input().split())
x = N*(N-1)/2
y = M*(M-1)/2
print(int(x+y))

Solution (Python):
def main():
  m, n = map(int, input().split())
  
  if n <= 1:
    ans1 = 0
  else:
    ans1 = n * (n-1) / 2
    
  if m <= 1:
    ans2 = 0
  else:
    ans2 = m * (m-1) / 2
    
  print(int(ans1 + ans2))
  
main()

Solution (Python):
n,m = map(int,input().split())

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

Solution (Python):
import itertools
import functools
import math
from collections import Counter
from itertools import combinations

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

ans = 0
if N >= 2:
    ans += len(list(itertools.combinations(range(N), 2)))
if M >= 2:
    ans += len(list(itertools.combinations(range(M), 2)))

print(ans)

Solution (Python):
n,m = map(int,input().split())
print((n*(n-1)//2)+(m*(m-1)//2))

Solution (Python):
n,m = map(int, input().split())
ans = n * (n - 1) // 2 + m * (m - 1) // 2
print(ans)

Solution (Python):
N, M = map(int, input().split())
if N < 2:
    A = 0
else:
    A = int(N * (N - 1) / 2)
if M < 2:
    B = 0
else:
    B = int(M * (M - 1) / 2)

print(A + B)

Solution (Python):
n, m = map(int, input().split())

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

Solution (Python):
n, m = map(int, input().split())
nAns= (((n+1)*n)/2)-n
mAns= (((m+1)*m)/2)-m
print(int(nAns+mAns))

Solution (Python):
n,m = map(int,input().split())

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

Solution (Python):
n,m = map(int, input().split())

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

if m == 1 or m == 0:
  b = 0
else:
  b = int(m*(m-1)/2)

print(a+b)

Solution (Python):
n,m=map(int,input().split())
print(n*(n-1)//2+m*(m-1)//2)

Solution (Python):
N, M = map(int, input().split())

if N < 2:
  A = 0
else:
  A = int(N*(N-1)/2)
if M < 2:
  B = 0
else:
  B = int(M*(M-1)/2)

print(A+B)

Solution (Python):
N,M = map(int,input().split())

if N != 0 and M != 0:
    x = N*(N-1)/2+M*(M-1)/2
elif N == 0:
    x = M*(M-1)/2
else:
    x = N*(N-1)/2

print(int(x))

Solution (Python):
n, m = map(int, input().split())

def choose_2(x):
    return x * (x - 1) // 2

print(choose_2(n) + choose_2(m))

Solution (Python):
N, M = map(int, input().split())

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