TnT/Multi_CodeNet4Repair huggingface dataset:
Problem: 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.

Submission attempts (in order):
N, M = map(int,input().split())

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

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

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

Verdicts: Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
import math
n,m = map(int,input().split())
n2 = n*(n-1)/2
m2 = m*(m-1)/2

print((n2+m2)//1)

n,m = import math
n,m = map(int,input().split())
print(math.factorial(n)+math.factorial(m))

import math
n,m = map(int,input().split())
n2 = n*(n-1)/2
m2 = m*(m-1)/2

print(round(n2+m2))

Verdicts: Wrong Answer

Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):
n, m = map(int,input().split())
if (n < 2):
  a = 0
else:
  a = n*(n - 1)/2
if (m < 2):
  b = 0
else:
  b = m*(m - 1)/2
print(a + b)

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)


Verdicts: Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
n,m=map(int,input())
print(int((n*(n-1)/2 + m*(m-1)*2)))

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

Verdicts: Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):
n,m = map(int,input().split())
print(n*(n-1)/2 + m*(m-1)/2)

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

Verdicts: Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
n,m=map(int,input().split())
print(n*(n+1)//2+m*(m+1)//2)

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

Verdicts: Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
n, m = map(int, input().split()))

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

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

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

Verdicts: Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):
N=int(input())
M=int(input())

for inN in N:
	inN=N*2
    
    for inM in M:
      inM=M*2-1
      sum=inN+inM
      
      if sum%2==0:
        count.append(sum)
      
      else:
        break
        
 print(len(count))

def Even(x):
  return  2 * x

def Odd(x):
  return 2 * x - 1

N, M = map(int, input().split())
G = list(map(Even, range(1, N+1)))
K = list(map(Odd, range(1, M+1)))

even=list()

for n in range(0, N):
  for nm in range(n+1, N):
    even.append(G[n]+G[nm])
  
for m in range(0, M):
  for mm in range(m+1, M):
    even.append(K[m]+K[mm])

print(len(even))

Verdicts: Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):
a,b = map(int, input().split(" "))
n = a + b
print(n*(n-1)//2 - b * (b-1)//2)

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


Verdicts: Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
a,b=map(int,input().split())
c=0
while a>1 or b>1:
  if (a-2)>1 or (b-2)>1:
    a=a-2
    b=b-2
    c=c+1
print(c)  


a,b=map(int,input().split())
c=0
while a>0 or b>0:
  if (a-2)>0 or (b-2)>0:
    a=a-2
    b=b-2
    c=c+1
print(c)  


a,b=map(int,input().split()):
c=0
d=d*(d-1)//2
e=e*(e-1)//2
while d>0:
  d=d-1
  c=c+1
while e>0:
  e=e-1
  c=c+1
print(c)  
  
 

a,b=map(int,input().split())
c=0
for i in range(a+b)
  if (a-2)>0 or (b-2)>0:
    a=a-2
    b=b-2
    c=c+1
print(c)  

a,b=map(int,input().split())
c=0
d=a*(a-1)//2
e=b*(b-1)//2
while d>0:
  d=d-1
  c=c+1
while e>0:
  e=e-1
  c=c+1
print(c)  
  
 


Verdicts: Time Limit Exceeded

Time Limit Exceeded

Runtime Error

Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):
M,N=map(int,input().split())
def fact(n):
	s=1
	for i in range(2,n):
		s=s*i
	return s

def conb(n,r):
	return fact(n)//(fact(r)*fact(n-r))

print(conb(M,2)+conb(N,2))

M,N=map(int,input().split())
def fact(n):
	s=1
	for i in range(2,n+1):
		s=s*i
	return s

def conb(n,r):
	return fact(n)//(fact(r)*fact(n-r))

if (N==1 or N==0) and (M==1 or M==0):
	print(0)
elif N==1 or N==0:
	print(conb(M,2))
elif M==1 or M==0:
	print(conb(N,2))
else:
	print(conb(M,2)+conb(N,2))


Verdicts: Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
N = int(input())
A = list(map(int,input().split()))
count = [0] * N
for i in range(N):
  count[A[i] - 1]  += 1
  
nanimo = 0 
for i in range(N):
  nanimo += count[i] * (count[i] - 1) // 2
for i in range(N):
  tekito = count[A[i] - 1]
  if tekito == 1:
    s = nanimo
  else:
    s = nanimo -  ((tekito * (tekito - 1) //2) - ((tekito - 1) * (tekito - 2) //2))
  print(s)


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

Verdicts: Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):
import sys
import os


def main():
    if os.getenv("LOCAL"):
        sys.stdin = open("input.txt", "r")

    L = int(sys.stdin.buffer.readline().rstrip())
    print(L ** 3 / 27)


if __name__ == '__main__':
    main()


import sys
import os
import collections

def main():
    if os.getenv("LOCAL"):
        sys.stdin = open("input.txt", "r")

    N, M = list(map(int, sys.stdin.buffer.readline().split()))
    e = N * (N-1) // 2
    o = 0 if M <= 1 else M * (M-1) // 2
    print(e+o)


if __name__ == '__main__':
    main()


Verdicts: Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):
import math
n,m=map(int,input().split())
if n-2>0:
    a=math.factorial(n)//(math.factorial(2)*math.factorial(n-2))
else:
    a=0
if m-2>0:
    b=math.factorial(m)//(math.factorial(2)*math.factorial(m-2))
else:
    b=0
print(a+b)

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

Verdicts: Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
import math

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


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


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

print(ans)


import math

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


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


if n >= 2 and m >= 2:
    ans = combinations_count(m, 2) + combinations_count(n, 2)
elif n < 2 and m < 2:
    ans = 0
elif n < 2:
    ans = combinations_count(m, 2)
elif m < 2:
    ans = combinations_count(n, 2)


print(ans)


Verdicts: Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):
import math
def comb(n, r):
    if(n>=r):
        return math.factorial(n)//(math.factorial(n-r)*math.factorial(r))
    else:
        return 0

f = open("input.txt", "r")
sys.stdin = f

m,n = map(int, input().split())
ans = comb(m, 2) + comb(n, 2)
print(ans)

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

Verdicts: Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):
N,M=map(int,input().split())
if N > 1:
  n = 0
else:
  n = N*(N-1) / 2
if M > 1:
  m = 0
else:
  m = M*(M-1) / 2
print(n+m)

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


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

Verdicts: Wrong Answer

Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
N,M=map(int,input().split())
ans=(N*N-1)/2+(M*M-1)/2
print(ans)

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

Verdicts: Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
a = list(map(int,input().split()))
print(a)

count = 0
for i in range(a[0]):
  count += i
 
for i in range(a[1]):
  count += i
  
print(count)

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

count = 0
for i in range(a[0]):
  count += i
 
for i in range(a[1]):
  count += i
  
print(count)

Verdicts: Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
N,M=map(int,input().split())
even=(N*(N-1))/2
odd=(M*(M-1))/2
print(even+odd)


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


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


Verdicts: Wrong Answer

Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
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())
print(cmb(n , 2) + cmb(m , 2))

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

Verdicts: Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):
#!/usr/bin/env python3
# -*- coding: utf-8 -*-

from EmurateInput import input
import functools

@functools.lru_cache(maxsize=None)
def factorial(N):
    if N == 0:
        return 1
    if N == 1:
        return 1
    else:
        return N * factorial(N - 1)


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


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

print(
    c(N, 2) + c(M, 2)
)


import functools

@functools.lru_cache(maxsize=None)
def factorial(N):
    if N == 0:
        return 1
    if N == 1:
        return 1
    else:
        return N * factorial(N - 1)


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


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

print(
    c(N, 2) + c(M, 2)
)


Verdicts: Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):
s = input()
ans = True
def isPalindrome(string):
    return s == s[::-1]
if not isPalindrome(s):
    ans = Flase
if not isPalindrome(s[:len(s)//2]):
    ans = False
if not isPalindrome(s[len(s)//2+1:]):
    ans = False
if ans:
    print('Yes')
else:
    print('No')


n = int(input())
a = list(map(int, input().split()))
cnt = [0]*n
for i in a:
    cnt[i] += 1
total = 0
for i in cnt:
    total += i * (i-1) // 2
for i in a:
    print(total - (cnt[i] - 1)

          

n = int(input())
a = list(map(int, input().split()))
ans = [0]*n
def choose2(n):
    return n * (n - 1) // 2
total = 0
for i in range(1,n+1):
    total += choose2(a.count(i))
for i in range(n):
    ans[i] = total
    ans[i] -= a.count(a[i]) - 1
print(*ans[:], sep='\n')


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)


Verdicts: Runtime Error

Runtime Error

Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):
N, M = map(int,input().split())
import math
def comb(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))
base = comb(N,2)
base2 = comb(M,2)
print(base+base2)

N, M = map(int,input().split())
import math
def comb(n, r):
    if (n-r) >= 0:
        return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))
    else:
        return 0
base = comb(N,2)
base2 = comb(M,2)
print(base+base2)

Verdicts: Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):
N,M = map(int,input().split())
if N <= 1:
  N = 2
if M <= 1:
  M = 2
print(int(N*(N-1)/2+M*(M-1)/2))


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

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


Verdicts: Wrong Answer

Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):
# number of balls
N = input()
# ball values
K = list(map(int, input().split()))

# get ball counts
ball_counts = {}
for i in range(len(K)):
    ball_value = K[i]
    if ball_value in ball_counts:
        ball_counts[ball_value] += 1
    else:
        ball_counts[ball_value] = 1


total_sum = 0
for value, count in ball_counts.items():
    total_sum += (count * (count - 1)) / 2


for i in range(len(K)):
    ball_value = K[i]
    print(int(total_sum - (ball_counts[ball_value] - 1)))

# number of even balls, number of odd balls
N, M = list(map(int, input().split()))

total_choice = 0

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

if M > 1:
    total_choice += M*(M-1)/2

print(int(total_choice))

Verdicts: Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):
n, m = map(int, input().split())
print(n*(n-1)/2 +m*(m-1)/2 )

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


Verdicts: Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
n,m = map(int,input().split())
print(n*(n-1) / 2 + m*(m-1) / 2)






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


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


Verdicts: Wrong Answer

Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
import math
N,M =map(int,input().split())

N1=(math.factorial(N))//(math.factorial(N-2)*2)
M1=(math.factorial(M))//(math.factorial(M-2)*2)

print(str(N1+M1))

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

N1=math.factorial(N)//(math.factorial(N-2)*2)
M1=math.factorial(M)//(math.factorial(M-2)*2)

print(N1+M1)

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


Verdicts: Runtime Error

Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):
n,m=map(int,input().split())

if n==1 and m==1:
  print("0")
if n==1 and not m==1:
  print(m*(m-1)/2)
if m==1 and not n==1:
  print(n*(n-1)/2)
if not m==1 and not n==1:
    print(n*(n-1)/2+m*(m-1)/2)

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

if n==1 and m==1:
  print("0")
if n==1:
  print(m/2)
if m==1:
  print(n/2)
else:
    print(n*(n-1)/2+m*(m-1)/2)

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

if n==1 and m==1:
  print("0")
if n==1 and not m==1:
  print(m*(m-1)//2)
if m==1 and not n==1:
  print(n*(n-1)//2)
if not m==1 and not n==1:
    print(n*(n-1)//2+m*(m-1)//2)

Verdicts: Wrong Answer

Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
import math
n, m = input().split()
m = int(m)
n = int(n)
mNum = math.factorial(n) / (math.factorial(n-2) * math.factorial(2))
nNum = math.factorial(m) / (math.factorial(m-2) * math.factorial(2))
print(int(mNum + nNum))

import math
n, m = input().split()
m = int(m)
n = int(n)
if n == 1 or n == 0:
	nNum = 0
else:
	nNum = math.factorial(n) / (math.factorial(n-2) * math.factorial(2))
if m == 1 or m == 0:
	mNum = 0
else:
	mNum = math.factorial(m) / (math.factorial(m-2) * math.factorial(2))
print(int(mNum + nNum))

Verdicts: Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):
N,M=map(int, input().split())
print(N*(N-1)+M*(M-1))

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


S=input()
s=int(len(S))
p=1
for i in range(int((((s-1)/2)+1)/2)):
    if S[i]==S[int((s-1)/2-(i+1))]==S[s-i-1]==S[int((s-1)/2+(i+1))]:
        p=p*1
    else:
        p=p*0
if int(p)==1:
    print('Yes')
else:
    print('No')

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

Verdicts: Wrong Answer

Runtime Error

Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
N, M = map(int, input().split())

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

print(int(ans))

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

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

print(int(ans))

Verdicts: Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
n,m = (int(x) for x in input().split())
N = n*(n-1)/2
M = m*(m-1)/2
print(N+M)

n,m = (int(x) for x in inpit().split())
N = n *(n -1) /2
M = m *(m-1) / 2
print(N+M)

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

Verdicts: Wrong Answer

Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):
S = input()
N = len(str(S))
temp = S[0:(N-1)/2]
temp2 = S[(N+2)/2:N]
print("Yes") if temp == temp[::-1] and temp2 == temp2[::-1] else "No"

from functools import reduce
def permu(n,r):
    return reduce(lambda a,b: a*b, range(n-r+1,n+1))
N,M = map(int, input().split())
print(int((permu(N,2)+permu(M,2))/2))

Verdicts: Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):
N,M=map(int,inputt().split())
print(N*(N-1)/2+M*(M-1)/2)

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

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

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

N,M=map(int,inputt().split())
print(N*(N-1)+N*M)

N,M=map(int,inputt().split())
print(N*(N-1)+M*(M-1))

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

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

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

Verdicts: Runtime Error

Wrong Answer

Runtime Error

Runtime Error

Runtime Error

Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):
import sys; sys.setrecursionlimit(2147483647); input = sys.stdin.readline
from math import floor, ceil, sqrt, factorial, log
from collections import Counter, defaultdict, deque
from operator import itemgetter
INF = float('inf'); MOD = 10**9+7
def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(MI())
def LIR(n): return [LI() for i in range(n)]
def IS(): return input().rstrip()
from operator import mul
from functools import reduce

def combinations_count(n, r):
    r = min(r, n - r)
    numer = reduce(mul, range(n, n - r, -1), 1)
    denom = reduce(mul, range(1, r + 1), 1)
    return numer // denom


def main():
    N, M = MI()
    print(combinations_count(N, 2)+combinations_count(M, 2))
    

if __name__ == '__main__':
    main()

import sys; sys.setrecursionlimit(2147483647); input = sys.stdin.readline
from math import floor, ceil, sqrt, factorial, log
from collections import Counter, defaultdict, deque
from operator import itemgetter
INF = float('inf'); MOD = 10**9+7
def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(MI())
def LIR(n): return [LI() for i in range(n)]
def IS(): return input().rstrip()
from operator import mul
from functools import reduce

def combinations_count(n, r):
    r = min(r, n - r)
    numer = reduce(mul, range(n, n - r, -1), 1)
    denom = reduce(mul, range(1, r + 1), 1)
    return numer // denom


def main():
    N, M = MI()
    if N > 1:
        n = combinations_count(N, 2)
    else:
        n = 0
    if M > 1:
        m = combinations_count(M, 2)
    else:
        m = 0
    print(n+m)

if __name__ == '__main__':
    main()

Verdicts: Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
def main():
	n, s, *a = map(int, open(0).read().split())
	ans = 0
	mod = 998244353
	dp = [0] * (s + 1)
	for i, x in enumerate(a):
		dp[0] += 1
		if x > s:continue
		ans += dp[s - x] * (n - i)
		ans %= mod
		dp = dp[:x] + [(dp[j] + dp[j - x]) % mod for j in range(x, s + 1)]
	print(ans)
	
if __name__=="__main__":
	main()



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

Verdicts: Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
#!/usr/bin/env python3
import collections
import itertools as it
import math
#import numpy as np
 
#  = input()
#  = int(input())
#  = map(int, input().split())
#  = list(map(int, input().split()))

#
# c = collections.Counter()


#!/usr/bin/env python3
import collections
import itertools as it
import math
import numpy as np

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

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

#
# c = collections.Counter()

cN = 0
cM = 0
if N == 0:
    cN = 0
elif N == 1:
    cN == 1
else:
    cN = permutations_count(N, 2)

if M == 0:
    cM = 0
elif M == 1:
    cM == 1
else:
    cM = permutations_count(M, 2)

print(cN + cM)

Verdicts: Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
s = input()
t = s[::-1]
n = len(s)

if n == 1 or n == 5:
    print('No')
    exit()
    
elif s != t:
    print('No')
    exit()

else:
    for i in range(0, (n - 1)//2, 2):
        if s[i] != t[i]:
            print('No')
            exit()
print('Yes')

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

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

print(even + odd)
    

Verdicts: Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
k = list(map(int, input().split()))

l = k[0] * (k[0] -1) / 2
m = k[1] * (k[1] -1) / 2

print(l + m)

k = list(map(int, input().split()))
l = k[0] * (k[0] -1) / 2
m = k[1] * (k[1] -1) / 2
print(int(l + m))

Verdicts: Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
# -*- coding: utf-8 -*-
"""
Created on Sat Apr  4 19:20:51 2020

@author: Kanaru Sato
"""

n,m = list(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
    
ans = ans1+ans2
print(ans)

# -*- coding: utf-8 -*-
"""
Created on Sat Apr  4 19:20:51 2020

@author: Kanaru Sato
"""

n,m = list(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
    
ans = ans1+ans2
print(int(ans))

Verdicts: Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
arr = list(map(int,input().rstrip().split()))
cou = 0
cou_n = 0
cou_m = 0
i =1
j =1
N = arr[0]
M = arr[1]
n =[]
m = []
while cou_n  != N:
    if i % 2 == 0:
        n.append(i)
        cou_n += 1
    i += 1

while cou_m != M:
    if j % 2 != 0 :
        m.append(j)
        cou_m +=1
    j += 1
f = n + m
# print(n)
# print(m)
f.sort()
print(f)

for i in range(len(f)):
    for j in range(i+1,len(f)):
        if ((f[i] + f [j]) % 2) == 0:
            cou +=1
print(cou)

if __name__ == '__main__':
    arr = list(map(int,input().rstrip().split()))
    cou = 0
    cou_n = 0
    cou_m = 0
    i =1
    j    =1
    N = arr[0]
    M = arr[1]
    n =[]
    m = []
    while cou_n  != N:
        if i % 2 == 0:
            n.append(i)
            cou_n += 1
        i += 1

    while cou_m != M:
        if j % 2 != 0 :
            m.append(j)
            cou_m +=1
        j += 1
    f = n + m
# print(n)
# print(m)
    f.sort()


    for i in range(len(f)):
        for j in range(i+1,len(f)):
            if ((f[i] + f [j]) % 2) == 0:
                cou +=1
    print(cou)

Verdicts: Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
def factorial(n):
    if n > 1:
        return n * factorial(n - 1)
    else:
        return 1
        
m,n=map(int,input().split())
# n = 100
# m = 100
n_result = factorial(n)/(factorial(2) * factorial(n - 2))
m_result = factorial(m)/(factorial(2) * factorial(m - 2))

print(n_result + m_result)

def factorial(n):
    if n > 1:
        return n * factorial(n - 1)
    else:
        return 1
        
m,n=map(int,input().split())
#n = 100
#m = 100

result = (int)(factorial(n)/(factorial(2) * factorial(n - 2)))
result += (int)(factorial(m)/(factorial(2) * factorial(m - 2)))

print(result)

Verdicts: Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
L = int(input())
x = float(L/3)
print(x**3)

N,M = map(int,input().split())
 
def cmb(n,r):
    if r > n:
        return 0
    if r == 0 or r == n:
        return 1
    if r == 1:
        return n
    return cmb(n-1,r) + cmb(n-1,r-1)
 
ret = cmb(N,2) + cmb(M,2)
print(ret)

Verdicts: Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):
N,M=int(input())
n=N*(N-1)/2
m=M*(M-1)/2
print(n+m)

N,M=int(input())
n=N*(N-1)/2
m=M*(M-1)/2
print(n+m)

N,M=int(input())
n=n*(n-1)/2
m=m*(m-1)/2
print(n+m)

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

Verdicts: Runtime Error

Runtime Error

Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):
n,m = map(int, input().split())
print(n*(n-1)/2+m*(m-1)/2)

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

Verdicts: Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
N, M = map(int, input().split())
a = N*(N-1)/2
b = M*(M-1)/2
print(a+b)

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


Verdicts: Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
S=str(input())
import sys
t=0
lista=[]
for i in range(99):
  try:
    lista.append(S[i])
    t=t+1
  except IndexError:
    break
u=t//2
v=u//2+1
p=1
for i in range(v):
  if S[i]==S[u-i-1] and S[u-i+1]==S[u+i+1] and S[u+i+1]==S[t-1-i]:
    p=p*1
  else:
    print ('No')
    sys.exit()
print ('Yes')

L=int(input())
print (L**3/27)

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

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

Verdicts: Wrong Answer

Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):
n, m = map(int, input().split())
print((n + 1) * (m // 2 + 1))

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

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

Verdicts: Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
a = list(map(int, input().split()))
if a[0] == 1 or a[0] == 0:
  a[0] = 1
  return a[0]
else: 
  return a[0]*(a[0] - 1)/2
if a[1] == 1 or a[1] == 0:
  a[1] = 1
  return a[1] 
else: 
  return a[1]*(a[1] - 1)/2
print(a[0]*a[1])


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


def a1():
    if a[0] == 1 or a[0] == 0:
        a[0] = 1
        return a[0]
    else:
        return a[0] * (a[0] - 1) / 2


def b1():
    if a[1] == 1 or a[1] == 0:
        a[1] = 1
        return a[1]
    else:
        return a[1] * (a[1] - 1) / 2


print(a1() * b1())


a = list(input().split())
a1 = "".join(a)
c = reversed(a)
c1 = "".join(c)


def b():
    if len(a1) <= 5:
        return 0
    if a1 == c1:
        return 1
    else:
        return 0


if b() == 0:
    print("No")
else:
    print("Yes")


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


def a1():
    if a[0] == 1 or a[0] == 0:
        a[0] = 1
        return a[0]
    else:
        return a[0] * (a[0] - 1) / 2


def b1():
    if a[1] == 1 or a[1] == 0:
        a[1] = 1
        return a[1]
    else:
        return a[1] * (a[1] - 1) / 2


print(a1() + b1())


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


def a1():
    if a[0] == 1 or a[0] == 0:
        a[0] = 1
        return a[0]
    else:
        return a[0] * (a[0] - 1) / 2


def b1():
    if a[1] == 1 or a[1] == 0:
        a[1] = 1
        return a[1]
    else:
        return a[1] * (a[1] - 1) / 2


print(a() * b())


a = list(map(int, input().split()))
if a[0] == 1:
  a[0] = 1
  return a[1]
else: 
  return a[0]*(a[0] - 1)
if a[1] == 1:
  a[1] = 1
  return a[1] 
else: 
  return a[1]*(a[1] - 1)
print(a[0]*a[1])

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


def a1():
    if a[0] == 1 or a[0] == 0:
        a[0] = 1
        return a[0]
    else:
        return a[0] * (a[0] - 1) / 2


def b1():
    if a[1] == 1 or a[1] == 0:
        a[1] = 1
        return a[1]
    else:
        return a[1] * (a[1] - 1) / 2


print(int(a1() + b1()))


a = list(map(int, input().split()))
print(a[0] * (a[0] - 1) // 2 + a[1] * (a[1] - 1) // 2)


Verdicts: Runtime Error

Wrong Answer

Wrong Answer

Wrong Answer

Runtime Error

Runtime Error

Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
N, M = map(int, input().split())
a, b = (N//2)+1, (M//2)+1
print(a*b+(N-a)*(M-b))


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

Verdicts: Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
import math

N, M = map(int, imput().split())
count = 0

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

print(nCr(N)+nCr(M))

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

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

Verdicts: Runtime Error

Accepted