Buggy python submission (verdict: Runtime Error):
N, M = map(int, input().split())

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 M == 0 and N == 0:
    print(0)
elif M == 0:
    print(cmb(N, 2))
elif N == 0:
    print(cmb(M, 2))
elif M <= 1 and N <= 1:
    print(0)
else:
    a = cmb(M, 2)
    b = cmb(N, 2)
    print(a + b)

Fixed submission:
N, M = map(int, input().split())

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 M == 0 and N == 0:
    print(0)
elif M == 1 and N == 1:
    print(0)
elif M <= 1:
    print(cmb(N, 2))
elif N <= 1:
    print(cmb(M, 2))
else:
    a = cmb(M, 2)
    b = cmb(N, 2)
    print(a + b)

Buggy python submission (verdict: Runtime Error):
N, M = map(int, input().split())

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 M == 0:
    print(cmb(N, 2))
elif N == 0:
    print(cmb(M, 2))
elif M <= 1 and N <= 1:
    print(0)
else:
    a = cmb(M, 2)
    b = cmb(N, 2)
    print(a + b)

Fixed submission:
N, M = map(int, input().split())

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 M == 0 and N == 0:
    print(0)
elif M == 1 and N == 1:
    print(0)
elif M <= 1:
    print(cmb(N, 2))
elif N <= 1:
    print(cmb(M, 2))
else:
    a = cmb(M, 2)
    b = cmb(N, 2)
    print(a + b)

Buggy python submission (verdict: Runtime Error):
N, M = map(int, input().split())

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 M <= 1 and N <= 1:
    print(0)
elif M == 2 and N == 2:
    print(2)
elif M == 2:
    print(cmb(N, 2)+1)
elif N == 2:
    print(cmb(M, 2)+1)
elif M == 0:
    print(cmb(N, 2))
elif N == 0:
    print(cmb(M, 2))
else:
    a = cmb(M, 2)
    b = cmb(N, 2)
    print(a + b)

Fixed submission:
N, M = map(int, input().split())

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 M == 0 and N == 0:
    print(0)
elif M == 1 and N == 1:
    print(0)
elif M <= 1:
    print(cmb(N, 2))
elif N <= 1:
    print(cmb(M, 2))
else:
    a = cmb(M, 2)
    b = cmb(N, 2)
    print(a + b)

Buggy python submission (verdict: Runtime Error):
N, M = map(int, input().split())

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 M <= 1 and N <= 1:
    print(0)
elif M == 0:
    print(cmb(N, 2))
elif N == 0:
    print(cmb(M, 2))
else:
    a = cmb(M, 2)
    b = cmb(N, 2)
    print(a + b)

Fixed submission:
N, M = map(int, input().split())

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 M == 0 and N == 0:
    print(0)
elif M == 1 and N == 1:
    print(0)
elif M <= 1:
    print(cmb(N, 2))
elif N <= 1:
    print(cmb(M, 2))
else:
    a = cmb(M, 2)
    b = cmb(N, 2)
    print(a + b)

Buggy python submission (verdict: Runtime Error):
import math

N, M = map(int, input().split())
if M <= 1 and N <= 1:
    print(0)
elif N == 0:
    print(int((math.factorial(M)/(2*math.factorial(M-2)))))
elif M == 0:
    print(int((math.factorial(N)/(2*math.factorial(N-2)))))
else:
    print(int((math.factorial(N)/(2*math.factorial(N-2))) + (math.factorial(M)/(2*math.factorial(M-2)))))

Fixed submission:
N, M = map(int, input().split())

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 M == 0 and N == 0:
    print(0)
elif M == 1 and N == 1:
    print(0)
elif M <= 1:
    print(cmb(N, 2))
elif N <= 1:
    print(cmb(M, 2))
else:
    a = cmb(M, 2)
    b = cmb(N, 2)
    print(a + b)