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):

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):

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

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

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):
A, B = map(int, input().split())
print((A*(A-1))//2+(B*(B-1))//2)

Solution (Python):

import os
import sys
from io import BytesIO, IOBase

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







BUFSIZE = 8192


class FastIO(IOBase):
    newlines = 0

    def __init__(self, file):
        self._fd = file.fileno()
        self.buffer = BytesIO()
        self.writable = "x" in file.mode or "r" not in file.mode
        self.write = self.buffer.write if self.writable else None

    def read(self):
        while True:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            if not b:
                break
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines = 0
        return self.buffer.read()

    def readline(self):
        while self.newlines == 0:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            self.newlines = b.count(b"\n") + (not b)
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines -= 1
        return self.buffer.readline()

    def flush(self):
        if self.writable:
            os.write(self._fd, self.buffer.getvalue())
            self.buffer.truncate(0), self.buffer.seek(0)


class IOWrapper(IOBase):
    def __init__(self, file):
        self.buffer = FastIO(file)
        self.flush = self.buffer.flush
        self.writable = self.buffer.writable
        self.write = lambda s: self.buffer.write(s.encode("ascii"))
        self.read = lambda: self.buffer.read().decode("ascii")
        self.readline = lambda: self.buffer.readline().decode("ascii")


sys.stdin, sys.stdout = IOWrapper(sys.stdin), IOWrapper(sys.stdout)
input = lambda: sys.stdin.readline().rstrip("\r\n")



if __name__ == "__main__":
    main()

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 = list(map(int,input().split(" ")))
ans = N * (N - 1) //2 +M * (M - 1) //2
print(ans)

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

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

print(out)

Solution (Python):
A,B=map(int,input().split())
print(A*(A-1)//2+B*(B-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(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):

import sys


def solve(N: int, M: int):
    print(int(N * (N - 1) / 2 + M * (M - 1) / 2))



def main():
    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))  
    solve(N, M)

if __name__ == '__main__':
    main()

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

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

print(n)

Solution (Python):
from functools import reduce

def binom(n, r):
    if n < r or n < 0 or r < 0: return 0
    
    if n - r < r: r = n - r
    if r == 0: return 1
    elif r == 1: return n

    numerator = [n - r + 1 + k for k in range(r)]  
    denominator = [1 + k for k in range(r)]         

    
    for p in range(2, r+1):
        pivot = denominator[p - 1]
        if pivot > 1:
            offset = (n - r) % p
            for k in range(p-1, r, p):
                numerator[k - offset] //= pivot
                denominator[k] //= pivot
    
    
    return reduce(lambda x, y: x*y, numerator)

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

Solution (Python):
input = raw_input

a, b = map(int, input().split(" "))
out1 = a * (a-1) // 2
out2 = b * (b-1) // 2
out = out1 + out2
print(out)

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

Solution (Python):
N, M = [int(x) for x in input().split()]
ans = (N * (N - 1) + 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 * (n - 1) / 2 + m * (m - 1) / 2

print(round(ans))

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

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

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 = int(n*(n-1)/2) + int(m*(m-1)/2)
print(ans)

Solution (Python):

import copy
import random
import bisect 
import fractions 
import math
import sys
import collections

mod = 10**9+7
sys.setrecursionlimit(mod) 

d = collections.deque()
def LI(): return list(map(int, sys.stdin.readline().split()))

N, M = LI()

ans = 0
if N >= 2:
    ans += N * (N - 1) // 2

if M >= 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())
ans = N * (N-1) // 2 + M * (M-1) // 2
print(ans)

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

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

    print(ans)
    

main()

Solution (Python):

import sys
input = sys.stdin.readline

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())
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())

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 ** 6)
input = sys.stdin.readline
N, M = [int(x) for x in input().strip().split()]

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

Solution (Python):
import sys
input = sys.stdin.readline

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

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

Solution (Python):
def xgcd(a, b):
  x0, y0, x1, y1 = 1, 0, 0, 1
  while b != 0:
    q, a, b = a // b, b, a % b
    x0, x1 = x1, x0 - q * x1
    y0, y1 = y1, y0 - q * y1
  return a, x0, y0
def modinv(a, m):
  g, x, y = xgcd(a, m)
  if g != 1:
    raise Exception('modular inverse does not exist')
  else:
    return x % m
def combination(n, k, mod=1e9+7) -> int:
  ret = 1
  for i in range(1, k+1):
    ret = (ret * (n-k+i) * modinv(i, mod))%mod
  return int(ret)

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

Na = combination(N,2) if N >=2 else 0
Ma = combination(M,2) if M >=2 else 0

print(Na+Ma)

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 = [int(i) for i in input().strip().split(" ")]

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

Solution (Python):
printn = lambda x: print(x,end='')
inn = lambda : int(input())
inl   = lambda: list(map(int, input().split()))
inm   = lambda:      map(int, input().split())
ins = lambda : input().strip()
DBG = True 
BIG = 10**18
R = 10**9 + 7

def ddprint(x):
  if DBG:
    print(x)

n,m = inm()
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):
m, n = map(int, input().split())


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

Solution (Python):


import itertools
from math import factorial
import sys
import heapq
from collections import Counter
from collections import deque
from fractions import gcd
from functools import reduce

sys.setrecursionlimit(4100000)
INF = 1 << 60
MOD = 10 ** 9 + 7


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

Solution (Python):



def ri():
    return int(input())

def rl():
    return list(input().split())

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

def main():
    n, m = rli()
    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) + 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, math, itertools, collections, bisect
input = lambda: sys.stdin.buffer.readline().rstrip().decode('utf-8')
inf = float('inf') ;mod = 10**9+7
mans = inf ;ans = 0 ;count = 0 ;pro = 1
from operator import mul
from functools import reduce

def cmb(n, r):
  if not n >= r:return 0
  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))

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

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

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

print(main())

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 = list(map(int, input().split(' ')))

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

Solution (Python):
def main():
    n,m = tuple([int(t)for t in input().split()])

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

if __name__ == "__main__":
    main()

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

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

Solution (Python):
from sys import stdin
from sys import setrecursionlimit
setrecursionlimit(1000000)


INF = int(1e10)

def input():
    return stdin.readline()[:-1]

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

if __name__ == '__main__':
    main()

Solution (Python):


n, m = map(int, input().split())
print((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):
n,m=map(int,input().split())
print(n*(n-1)//2+m*(m-1)//2)

Solution (Python):
import sys
input = sys.stdin.readline
INF = 10**10
MOD = 10**9 + 7
sys.setrecursionlimit(100000000)
from functools import lru_cache
from itertools import permutations
from math import factorial


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


if __name__=='__main__':
    main()

Solution (Python):
N, M = [int(i) for i in input().split()]
print(int((N*(N-1)/2)+(M*(M-1)/2)))

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

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):
import itertools
from collections import deque,defaultdict,Counter
from itertools import accumulate
import bisect
from heapq import heappop,heappush,heapify
from fractions import gcd
from copy import deepcopy
import math
import queue
import numpy as np

Mod = 1000000007
import sys
sys.setrecursionlimit(100000) 
  
def sieve_of_eratosthenes(n):
    if not isinstance(n,int):
        raise TypeError("n is not int")
    if n<2:
        raise ValueError("n is not effective")
    prime = [1]*(n+1)
    for i in range(2,int(math.sqrt(n))+1):
        if prime[i] == 1:
            for j in range(2*i,n+1):
                if j%i == 0:
                    prime[j] = 0
    res = []
    for i in range(2,n+1):
        if prime[i] == 1:
            res.append(i)
    return res

 
class UnionFind:
    def __init__(self,n):
        self.parent = [i for i in range(n+1)]
        self.rank = [0 for i in range(n+1)]
    
    def findroot(self,x):
        if x == self.parent[x]:
            return x
        else:
            y = self.parent[x]
            y = self.findroot(self.parent[x])
            return y
    
    def union(self,x,y):
        px = self.findroot(x)
        py = self.findroot(y)
        if px < py:
            self.parent[py] = px
        else:
            self.parent[px] = py
 
    def same_group_or_no(self,x,y):
        return self.findroot(x) == self.findroot(y)

def main(): 
    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 = list(map(int,input().split()))
print(int(N*(N-1)/2 + M*(M-1)/2))

Solution (Python):
ii = lambda : int(input())
mi = lambda : map(int,input().split())
li = lambda : list(map(int,input().split()))

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

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

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):


import sys
stdin = sys.stdin

def ns(): return stdin.readline().rstrip()
def ni(): return int(ns())
def na(): return list(map(int, stdin.readline().split()))

def main():
    n, m = na()
    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):

import bisect
import heapq
import math
import random
import sys
from collections import Counter, defaultdict, deque
from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal
from functools import lru_cache, reduce
from itertools import combinations, combinations_with_replacement, product, permutations
from operator import add, mul, sub

sys.setrecursionlimit(100000)
input = sys.stdin.readline
INF = 2**62-1

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


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


def read_float():
    return float(input())


def read_float_n():
    return list(map(float, input().split()))


def read_str():
    return input().strip()


def read_str_n():
    return list(map(str, input().split()))


def error_print(*args):
    print(*args, file=sys.stderr)


def mt(f):
    import time

    def wrap(*args, **kwargs):
        s = time.time()
        ret = f(*args, **kwargs)
        e = time.time()

        error_print(e - s, 'sec')
        return ret

    return wrap


@mt
def slv(N, M):
    return ((N) * (N-1) + (M) * (M-1)) // 2


def main():
    N, M = read_int_n()
    print(slv(N, M))


if __name__ == '__main__':
    main()

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

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

Solution (Python):
import sys
rl = sys.stdin.readline


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


if __name__ == '__main__':
    solve()

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

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

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

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


if __name__ == '__main__':
    resolve()

Solution (Python):
n,m = (int(x) for x in 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(ans)

Solution (Python):
import sys
sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))
def resolve():
    N, M = lr()
    print(N*(N-1)//2+M*(M-1)//2)
resolve()

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

Solution (Python):
import sys
input = sys.stdin.readline

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

Solution (Python):
a, b = map(int, input().split())

print(a * (a - 1) // 2 + b * (b - 1) // 2)

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

Solution (Python):
def get_ints():
    return map(int, input().split())

n, m = get_ints()
pats = 0
if n >= 2:
    pats += n * (n - 1) // 2
if m >= 2:
    pats += m * (m - 1) // 2

print(pats)

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

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

Solution (Python):
import sys
from collections import *
import heapq
import math
import bisect
from itertools import permutations,accumulate,combinations,product
from fractions import gcd
def input():
    return sys.stdin.readline()[:-1]
def ruiseki(lst):
    return [0]+list(accumulate(lst))
mod=pow(10,9)+7
al=[chr(ord('a') + i) for i in range(26)]

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

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

Solution (Python):
n, m = map(int, input().split())
print((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):
if __name__ == '__main__':
    from sys import stdin
    input = stdin.readline

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

Solution (Python):

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



if __name__ == "__main__":
    resolve()

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())
ans = n*(n-1)//2
ans += m*(m-1)//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())
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):
from collections import Counter, defaultdict, deque

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

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

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

print(main())

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

Solution (Python):
import sys

sys.setrecursionlimit(10 ** 8)

input = sys.stdin.readline


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

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


if __name__ == '__main__':
    main()

Solution (Python):
import math
from functools import reduce
from collections import deque
import sys
sys.setrecursionlimit(10**7)


def get_nums_l():
    return [ int(s) for s in input().split(" ")]


def get_nums_n(n):
    return [ int(input()) for _ in range(n)]


def get_all_int():
    return map(int, open(0).read().split())

def log(*args):
    print("DEBUG:", *args, file=sys.stderr)

n,m = get_nums_l()

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

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

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

print (ans)

Solution (Python):











import sys
sys.setrecursionlimit(10**6)
input=sys.stdin.readline
from math import floor,sqrt,factorial,hypot,log 
from heapq import heappop, heappush, heappushpop
from collections import Counter,defaultdict,deque
from itertools import accumulate,permutations,combinations,product,combinations_with_replacement
from bisect import bisect_left,bisect_right
from copy import deepcopy
from fractions import gcd
from random import randint
def ceil(a,b): return (a+b-1)//b
inf=float('inf')
mod = 10**9+7
def pprint(*A): 
    for a in A:     print(*a,sep='\n')
def INT_(n): return int(n)-1
def MI(): return map(int,input().split())
def MF(): return map(float, input().split())
def MI_(): return map(INT_,input().split())
def LI(): return list(MI())
def LI_(): return [int(x) - 1 for x in input().split()]
def LF(): return list(MF())
def LIN(n:int): return [I() for _ in range(n)]
def LLIN(n: int): return [LI() for _ in range(n)]
def LLIN_(n: int): return [LI_() for _ in range(n)]
def LLI(): return [list(map(int, l.split() )) for l in input()]
def I(): return int(input())
def F(): return float(input())
def ST(): return input().replace('\n', '')
def main():
    N,M=MI()
    ans = N*(N-1)//2 + M*(M-1)//2
    print(ans)
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()]
print(N * (N - 1) // 2 + M * (M - 1) // 2)

Solution (Python):

import sys


def solve(N: int, M: int):
    n = N*(N-1)//2 if N >=2 else 0
    m = M*(M-1)//2 if M >=2 else 0
    print(n+m)
    return



def main():
    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))  
    solve(N, M)

if __name__ == '__main__':
    main()

Solution (Python):
NM = list(map(int, input().split()))
N = NM[0]
M = NM[1]
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)
if __name__ == '__main__':
    main()

Solution (Python):
import sys

sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))

N, M = lr()
answer = N * (N-1) // 2 + M * (M-1) // 2
print(answer)

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

Solution (Python):












mod = int(1e9+7)
INF = 1<<29
lINF = 1<<35

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

if __name__=='__main__':
    main()

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

Solution (Python):
n,m = [int(x) for x in input().split()]
ans = n * (n-1) / 2
ans += m * (m-1) /2
print(int(ans))

Solution (Python):
import sys
sys.setrecursionlimit(10 ** 7)

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

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

if N < 2 and M < 2:
    print(0)
    exit()

ans = 0

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

Solution (Python):



import array
from bisect import *
from collections import *
import fractions
import heapq
from itertools import *
import math
import random
import re
import string
import sys

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):
import sys


def input():
    return sys.stdin.readline().strip()


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

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

Solution (Python):
import math,itertools,fractions,heapq,collections,bisect,sys,queue,copy

sys.setrecursionlimit(10**7)
inf=10**20
mod=10**9+7
dd=[(-1,0),(0,1),(1,0),(0,-1)]
ddn=[(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())
def LS(): return sys.stdin.readline().split()
def S(): return input()


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


def main():
  n,m=LI()
  ans=0

  ans+=nCr(n,2)
  ans+=nCr(m,2)

  return ans


print(main())

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


def comb(n: int, k: int) -> int:
    if n < k or n < 0 or k < 0:
        return 0
    k = min(k, n - k)
    ans = 1
    for i in range(1, k + 1):
        ans *= n - i + 1
        ans //= i
    return ans


ans = comb(n, 2) + comb(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())
res=0
if N>0:
    res+=N*(N-1)//2
if M>0:
    res+=M*(M-1)//2
print(res)

Solution (Python):






import sys
input = sys.stdin.readline

import math
from collections import deque
from fractions import gcd
from functools import lru_cache






MOD = 10**9 +7
INF = float('inf')






def inputI(): return int(input().strip())
def inputS(): return input().strip()
def inputIL(): return list(map(int,input().split()))
def inputSL(): return list(map(str,input().split()))
def inputILs(n): return list(int(input()) for _ in range(n))
def inputSLs(n): return list(input().strip() for _ in range(n))
def inputILL(n): return [list(map(int, input().split())) for _ in range(n)]
def inputSLL(n): return [list(map(str, input().split())) for _ in range(n)]


def inv(n): return pow(n, MOD-2, MOD)


kaijo_memo = []
def kaijo(n):
  if(len(kaijo_memo) > n):
    return kaijo_memo[n]
  if(len(kaijo_memo) == 0):
    kaijo_memo.append(1)
  while(len(kaijo_memo) <= n):
    kaijo_memo.append(kaijo_memo[-1] * len(kaijo_memo) % MOD)
  return kaijo_memo[n]

gyaku_kaijo_memo = []
def gyaku_kaijo(n):
  if(len(gyaku_kaijo_memo) > n):
    return gyaku_kaijo_memo[n]
  if(len(gyaku_kaijo_memo) == 0):
    gyaku_kaijo_memo.append(1)
  while(len(gyaku_kaijo_memo) <= n):
    gyaku_kaijo_memo.append(gyaku_kaijo_memo[-1] * pow(len(gyaku_kaijo_memo),MOD-2,MOD) % MOD)
  return gyaku_kaijo_memo[n]

def nCr(n,r):
  if(n == r):
    return 1
  if(n < r or r < 0):
    return 0
  ret = 1
  ret = ret * kaijo(n) % MOD
  ret = ret * gyaku_kaijo(r) % MOD
  ret = ret * gyaku_kaijo(n-r) % MOD
  return ret


def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])
    if temp!=1:
        arr.append([temp, 1])

    if arr==[]:
        arr.append([n, 1])
    return arr


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





N,M = inputIL()

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

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

print(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())
print((m*(m-1))//2 + (n*(n-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):
import sys
input = sys.stdin.readline

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

ans = 0

if n >= 2:
    ans += (1 / 2) * n * (n - 1)

if m>= 2:
    ans += (1 / 2) * m * (m - 1)

print(int(ans))

Solution (Python):

import sys,os
from collections import defaultdict, deque
from fractions import gcd
from math import ceil, floor
sys.setrecursionlimit(10**6)
write = sys.stdout.write
dbg = (lambda *something: print(*something)) if 'TERM_PROGRAM' in os.environ else lambda *x: 0
def main(given=sys.stdin.readline):
    input = lambda: given().rstrip()
    LMIIS = lambda: list(map(int,input().split()))
    II = lambda: int(input())
    XLMIIS = lambda x: [LMIIS() for _ in range(x)]
    YN = lambda c : print('Yes') if c else print('No')
    MOD = 10**9+7

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

if __name__ == '__main__':
    main()

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())

tmp1 = (n * (n-1)) // 2
tmp2 = (m * (m-1)) // 2

print(tmp1 + tmp2)

Solution (Python):
def main():
    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 = 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 (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):
a,b=map(int,input().split())
print(a*(a-1)//2 + b*(b-1)//2)

Solution (Python):
N,M = list(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
import heapq, math
from itertools import zip_longest, permutations, combinations, combinations_with_replacement
from itertools import accumulate, dropwhile, takewhile, groupby
from functools import lru_cache
from copy import deepcopy





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((N-1)*N//2+(M-1)*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())

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

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

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

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