Harryxun/stf_run huggingface dataset:
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

def main():
    from scipy.special import comb
    NM = list(map(int,readline().split()))
    cnt = 0
    for nm in NM:
        if nm <2:
            continue
        else:
            cnt += comb(nm, 2, exact=True)
    print(cnt)
    return

if __name__ == '__main__':
    main()



### FIXED CODE ###

N, M = map(int, input().split())
nC2 = N * (N - 1) / 2
mC2 = M * (M - 1) / 2
print(int(nC2+mC2))
from collections import defaultdict
def ReadInput():
	return [int(a) for a in input().split(' ')]
(N, M) = ReadInput()
Q = int(input())
Array = ReadInput()
def ifEqual(x):
	temp = None
	for i in x:
		if (temp == None):	
			temp = x[i]
			continue
		elif (x[i] != temp):
			print('ifEqual is 0')
			return 0
	return temp
def check(Array, N, M, *args):
	Count = defaultdict(int)
	Array.reverse()
	if ("reverse") not in args:
		for i in Array:
			if (i == 1 or Count[i] < Count[i-1]):
				Count[i] += 1
			else:	
				return 0
		Count.pop(N)
		if(ifEqual(Count)):
			return 1
		else:
			return 0
	else:
		for i in Array:
			if (i == N or Count[i] < Count[i+1]):
				Count[i] += 1
			else:
				return 0
		Count.pop(1)
		if(ifEqual(Count) >= M):
			return 1
		else
			return 0
if (check(Array, N, M) or check(Array, N, M, "reverse")):
	print("Yes")
else:
	print("No")


### FIXED CODE ###

def reads(offset = 0):
	return [int(i) - offset for i in input().split(' ')]
def Judge(vector):
	length = len(vector)-1
	for i in range(length):
		if(vector[i] > vector[i+1]):		
			return 0
	return 1
(N, M) = reads()
Q = int(input())
A = reads(1)
pos = [-1] * M
pat = []
freq = [0] * (M+1)
freq[0] = N
found = set()
counter = 0
for i in A[::-1]:
	if (i not in found):
		pat.append(i)
		found.add(i)
		pos[i] = counter
		counter += 1
		if(counter == M):
			break
for i in range(M):
	if (pos[i] == -1):
		pat.append(i)	
for i in A[::-1]:
	temp = pos[i]
	if (freq[temp] > 0):
		freq[temp] -= 1
		freq[temp+1] += 1
start = M
for i in range(M):
	if (freq[i] != 0):
		start = i
		break
print("Yes") if Judge(pat[start:]) else print("No")
s = input()
a = [0]*(len(s)-2)
for i in range(len(s)-2):
  a[i]==abs(s[i]*100+s[i+1]*10+s[i+2]-753)
print(min(a))

### FIXED CODE ###

s = input()
a = []
for i in range(len(s)-2):
  a.append(abs(int(s[i])*100+int(s[i+1])*10+int(s[i+2])-753))
print(min(a))
import fractions

mod = 1e9 + 7;

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

l = 1
for i in A:
  l = l * i // fractions.gcd(l, i)

sum = 0
for i in A:
  sum += l // i

print(int(sum % mod))




### FIXED CODE ###

import fractions

mod = 10**9 + 7;

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

l = 1
for i in A:
  l = l * i // fractions.gcd(l, i)

sum = 0
for i in A:
  sum += l // i

print(sum % mod)
h,w,m=list(map(int,input().split()))
b=[]
r=[0]*(10**5+1)
c=[0]*(10**5+1)
for i in range(m):
    h,w=list(map(int,input().split()))
    r[h]=r[h]+1
    c[w]=c[w]+1
    b.append([h,w])
if max(r)>max(c):
    j=r.index(max(r))
    for i in range(len(b)):
        if b[i][0]==j:
            c[b[i][1]]=c[b[i][1]]-1
    i=c.index(max(c))
else:
    i=c.index(max(c))
    for j in range(len(b)):
        if b[j][1]==i:
            r[b[j][0]]=r[b[j][0]]-1
    j=r.index(max(r))
print(r[j]+c[i])

### FIXED CODE ###

h,w,m=list(map(int,input().split()))
b=[]
r=[0]*(3*10**5+2)
c=[0]*(3*10**5+2)
for i in range(m):
    h,w=list(map(int,input().split()))
    r[h]=r[h]+1
    c[w]=c[w]+1
    b.append([h,w])
if max(r)>max(c):
    j=r.index(max(r))
    for i in range(len(b)):
        if b[i][0]==j:
            c[b[i][1]]=c[b[i][1]]-1
else:
    i=c.index(max(c))
    for j in range(len(b)):
        if b[j][1]==i:
            r[b[j][0]]=r[b[j][0]]-1
print(max(r)+max(c))
a,b = int(input().split())

sum = a+b
if(sum>=10):
  print("error")
else:
  print(sum)


### FIXED CODE ###

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

sum = a + b
if sum >= 10:
    print("error")
else:
    print(sum)
s,t=input().split()
a,b=map(int,input()split())
u=input()
if u==s:
    a-=1
elif:b-=1
print(a, b)

### FIXED CODE ###

s, t = input().split()
a, b = map(int, input().split())
u = input()
if u == s:
    a-= 1
else: b -= 1
print(a, b)
import collections
N = int(input())
num = []
for i in range(2,N+1):
    for j in range(2,i+1):
        #print(j)
        while i%j==0:
            i //= j
            num.append(j)
#print(num)
A = collections.Counter(num)
#print(A)
ans = 1
for v in A.values():
    ans *= (v+1)%mod
print(ans%mod)

### FIXED CODE ###

import collections
N = int(input())
num = []
mod = 10**9+7
for i in range(2,N+1):
    for j in range(2,i+1):
        #print(j)
        while i%j==0:
            i //= j
            num.append(j)
#print(num)
A = collections.Counter(num)
#print(A)
ans = 1
for v in A.values():
    ans *= (v+1)%mod
print(ans%mod)
List = list(map(int,input().split()))
price = 700 + List.count('○')
print(price)

### FIXED CODE ###

print((input().count("o"))*100+700)