14 lines
272 B
Python

def solution(x, y):
return str(((x + y - 1) * (x + y) / 2) - (y - 1))
tests = [
([1, 1], "1"),
([3, 2], "9"),
([5, 10], "96"),
([2, 3], "8")
]
for i, o in tests:
result = solution(*i)
print (i, result == o, result, o)