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):
def comb(a,b):
    import math
    return math.factorial(a)/(math.factorial(a-b)*math.factorial(b))
N,M = map(int,input().split())
ans = 0
if N > 1:
    ans += comb(N,2)
if M > 1:
    ans += comb(M,2)

print(ans)


def comb(a,b):
    import math
    return math.factorial(a)//(math.factorial(a-b)*math.factorial(b))
N,M = map(int,input().split())
ans = 0
if N > 1:
    ans += comb(N,2)
if M > 1:
    ans += comb(M,2)

print(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):
num_list = [int(i) for i in input().split()]
sum = 0
for i in num_list:
  if i != 1:
    sum += i*(i-1)/2

print(sum)

num_list = [int(i) for i in input().split()]
sum = 0
for i in num_list:
  if i > 1:
    sum += i*(i-1)/2

print(int(sum))

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

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


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

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

Verdicts: Wrong Answer

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

n=int(input())
m=int(input())
rate=2*n*m/((n+m)*(n+m-1))
print(int((n+m)*rate))

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

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

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

import math


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


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

N, M = 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,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):
from math import factorial
n,m = map(int,input().split())

N = factorial(n)/factorial(2)/factorial(n-2)
M = factorial(m)/factorial(2)/factorial(m-2)

print(N+M)


from scipy.special import comb

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

ans = comb(n,2,exact=True) + comb(m,2,exact=True)


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

N = factorial(n)/factorial(2)/factorial(n-2)
M = factorial(M)/factorial(2)/factorial(m-2)

print(N+M)


from scipy.special import import comb

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

ans = comb(n,2,exact=True) + comb(m,2,exact=True)


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

if n == 0:
   N = 0
elif n == 1:
    N = 0
else:
    N = factorial(n)/factorial(2)/factorial(n-2)
if m == 0:
   M = 0
elif m == 1:
    M = 0
else:
    M = factorial(m)/factorial(2)/factorial(m-2)

print(int(N+M))


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

x= a[0] * (a[0]-1) * (1/2)

x+= a[1] * (a[1]-1) * (1/2)

print(x)

a = [int(i) for i in input().split()]

x= a[0] * (a[0]-1) * (1/2)

x+= a[1] * (a[1]-1) * (1/2)

print(int(x))


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())
     
summa=0
if N>1:
   summa+=math.factorial(N)/(math.factorial(2)*math.factorial(N-2))
if M>1:
   summa+=math.factorial(M)/(math.factorial(2)*math.factorial(M-2))
      
print(summa)

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

summa=0
if N>1:
  summa+=math.factorial(N)/(math.factorial(2)*math.factorial(N-2))
if M>1:
  summa+=math.factorial(M)/(math.factorial(2)*math.factorial(M-2))
  
print(summa)

import math

N, M = map(int, input().split())
     
summa=0
if N>1:
   summa+=math.factorial(N)/(math.factorial(2)*math.factorial(N-2))
if M>1:
   summa+=math.factorial(M)/(math.factorial(2)*math.factorial(M-2))
      
print(int(summa))

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 * (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(int(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):
S = input()
N = len(S)
flag = True

if S!=S[::-1]:
    flag=False
if S[:int((N-1)/2)]!=S[:int((N-1)/2)][::-1]:
    flag=False
print("Yes" if flag else "No")

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):
L = int(input())
ans = L**3
ans = ans / 27
print(ans)

N,M = map(int,input().split())
ans = (N*(N-1))//2 + (M*(M-1))//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())
import math
def c(n,k):
    return math.factorial(n)//math.factorial(k)//math.factorial(n-k)

print(c(n,2) + c(m,2))


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

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):
import numpy
import copy
N = int(input())
E= list(map(int,input().split()))
ans = [0 for _ in range(N)]
unique = numpy.unique(E)
#for s in range(len(unique)):

uniqueNum = [0 for _ in range(len(unique))]

uniqueAns = [0 for _ in range(len(unique))]

y =0
for t in range(len(unique)):
    uniqueNum[t] = E.count(unique[t])
for g in range(len(unique)):
    uni = copy.copy(uniqueNum)
    uni[g] = uni[g] -1
    for h in range(len(unique)):
        y = y + uni[h] * (uni[h]-1)/2
    uniqueAns[g] =  y
for k in range(N):
    for w in range(len(uni)):
        if unique[w] == E[k]:
            ans[k] = uniqueAns[w]
            break
for i in range(N):
    print(int(ans[i]))

S = input().split()
N = int(S[0])
M = int(S[1])

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

S = input().split()
N = int(S[0])
M = int(S[1])

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

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

nout =n* (n-1)/2
mout =m* (m-1)/2

print(nout+mout)

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

nout =n* (n-1)//2
mout =m* (m-1)//2

print(nout+mout)


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())
oo = n * (n-1) / 2
ee = m * (m-1) / 2

print(oo + ee)


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

print(int(oo + ee))


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):
print((int(input())/3)**3)

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

import math

def comb(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))
  
if n <= 1 and m <= 1:
    print(0)
elif n == 1 and m <= 1:
    print(comb(m,2))
elif n <= 1 and m == 1:
    print(comb(n,2))
else:
    print(comb(n,2) + comb(m,2))

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

import math

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

if n == 0:
    base1 = 0
elif n == 1:
    base1 = 0
else:
    base1 = comb(n,2)

if m == 0:
    base2 = 0
elif m == 1:
    base2 = 0
else:
    base2 = comb(m,2)

print(base1 + 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):
a=list(map(int,input().split()))
print((a[0]*(a[0]-1))+(a[1]*(a[1]-1)))

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


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

#A
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(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):
S = list(map(str,input().split()))
N = int(len(S))
S_a = S[:(N-1)//2]
S_b = S[(N+1)//2:]

if S == S[::-1] and S_a == S_a[::-1] and S_b == S_b[::-1]:
    print("Yes")
else:
    print("No")

S = input()
N = int(len(S))
S_a = S[:(N-1)//2]
S_b = S[(N+1)//2:]
#print(S)
if S == S[::-1] and S_a == S_a[::-1] and S_b == S_b[::-1]:
    print("Yes")
else:
    print("No")

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

Verdicts: Wrong Answer

Wrong Answer

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):
a, b = map(int, input().split())

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


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

ans = round((a * (a - 1) / 2) + (b * (b - 1) / 2))
print(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):
M, N = map(int, input().split())
result = 0

def fact(num):
    result = 1
    while num > 1:
        result *= num
        num -= 1
    return result

result += fact(M) / (fact(2) * fact(M-2))
result += fact(N) / (fact(2) * fact(N-2))

print(round(result))

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

def fact(num):
    result = 1
    while num > 1:
        result *= num
        num -= 1
    return result

if M!=0 or M!=1:
    result += fact(M) // (fact(2) * fact(M-2))

if N!=0 or N!=1:
    result += fact(N) // (fact(2) * fact(N-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):
from itertools import combinations

def resolve():
    N, M = map(int, input().split())
    n = len(list(combinations(range(N), 2)))
    if M >= 2:
        m = len(list(combinations(range(M), 2)))
    else:
        m = 0
    return print(n+m)

from itertools import combinations

def resolve():
    N, M = map(int, input().split())
    balls = [2]*N + [1]*M
    ans = 0
    for x, y in combinations(balls, 2):
        if (x+y)%2 == 0:
            ans += 1
    return print(ans)

if __name__ == "__main__":
    resolve()

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

if n >= 2:
    a = n * (n - 1) / 2
else:
    a = 0

if m >= 2:
    b = m * (m - 1) / 2
else:
    b = 0
    
print(a + b)

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

if n >= 2:
    a = n * (n - 1) / 2
else:
    a = 0

if m >= 2:
    b = m * (m - 1) / 2
else:
    b = 0
    
print(int(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 = input()
N = int(len(S))
a = 0

left = []
for i in range(0,int((N-1)/2)):
  left += S[i]
for i in range(0,int((N-1)/4)):
    if left[i] == left[-i-1]:
        a += 1

right = []
for i in range(0,int((N-1)/2)):
  right += S[-i-1]
for i in range(0,int((N-1)/4)):
    if right[i] == right[-i-1]:
        a += 1

if a == int((N-1)/2) + int((N-1)//4 * 2) -1:
	print('Yes')
else :
    print('No')

S = input()
N = int(len(S))
a = 0
for i in range(0,int((N-1)/2)): 
    if S[i] == S[-i-1]:
        a += 1

left = []
for i in range(0,int((N-1)/2)):
  left += S[i]
if left == left.reverse():
        a += 1

right = []
for i in range(0,int((N-1)/2)):
  right += S[-i-1]
if right == right.reverse():
        a += 1

if a == 3:
	print('Yes')
else :
    print('No')

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


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

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
M,N = list(map(int,input().split()))
def comb(n,r):
    return math.factorial(n)//(math.factorial(n-r)*math.factorial(r))
   
 
A = comb(M,2)
B = comb(N,2)
print(A+B)

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

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())
print(pow(n / 3, 3))

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

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

Verdicts: 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*M + M(M-1)//2
print(ans)

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

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


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

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


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

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



Verdicts: Runtime Error

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 sys
from io import StringIO
import unittest

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

class TestClass(unittest.TestCase):
    def assertIO(self, input, output):
        stdout, stdin = sys.stdout, sys.stdin
        sys.stdout, sys.stdin = StringIO(), StringIO(input)
        resolve()
        sys.stdout.seek(0)
        out = sys.stdout.read()[:-1]
        sys.stdout, sys.stdin = stdout, stdin
        self.assertEqual(out, output)

    def test_入力例_1(self):
        input = """2 1"""
        output = """1"""
        self.assertIO(input, output)

    def test_入力例_2(self):
        input = """4 3"""
        output = """9"""
        self.assertIO(input, output)

    def test_入力例_3(self):
        input = """1 1"""
        output = """0"""
        self.assertIO(input, output)

    def test_入力例_4(self):
        input = """13 3"""
        output = """81"""
        self.assertIO(input, output)

    def test_入力例_5(self):
        input = """0 3"""
        output = """3"""
        self.assertIO(input, output)


if __name__ == "__main__":
    unittest.main()


import sys
from io import StringIO
import unittest

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

class TestClass(unittest.TestCase):
    def assertIO(self, input, output):
        stdout, stdin = sys.stdout, sys.stdin
        sys.stdout, sys.stdin = StringIO(), StringIO(input)
        resolve()
        sys.stdout.seek(0)
        out = sys.stdout.read()[:-1]
        sys.stdout, sys.stdin = stdout, stdin
        self.assertEqual(out, output)

    def test_入力例_1(self):
        input = """2 1"""
        output = """1"""
        self.assertIO(input, output)

    def test_入力例_2(self):
        input = """4 3"""
        output = """9"""
        self.assertIO(input, output)

    def test_入力例_3(self):
        input = """1 1"""
        output = """0"""
        self.assertIO(input, output)

    def test_入力例_4(self):
        input = """13 3"""
        output = """81"""
        self.assertIO(input, output)

    def test_入力例_5(self):
        input = """0 3"""
        output = """3"""
        self.assertIO(input, output)


if __name__ == "__main__":
    # unittest.main()
    resolve()


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):
inp = input().split(' ')

n = int(inp[0])
m = int(inp[1])

ncount = 0 if n < 2 else n*(n-1)/2
mcount = 0 if m < 2 else m*(m-1)/2

print(str(ncount + mcount))

n,m = input().split(' ')

ncount = 0 if n < 2 else n*(n-1)/2
mcount = 0 if m < 2 else m*(m-1)/2

print(str(ncount + mcount))

inp = input().split(' ')

n = int(inp[0])
m = int(inp[1])

ncount = 0 if n < 2 else n*(n-1)//2
mcount = 0 if m < 2 else m*(m-1)//2

print(str(ncount + mcount))

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


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

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

ans = float((L/3)**3)

print(ans)

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

ans = n * (n - 1) // 2 + m * (m - 1) // 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):
def kaibun(s):
  if s == s[::-1]:
    flg = True
  else:
    flg = False
  return flg

S = input()
N = len(S)
ans = 'Yes'
if kaibun(S):
  pass
else:
  ans = ('No')
if kaibun(S[:(N-1)//2]):
  pass
else:
  ans = ('No')
if kaibun(S[:(-(N-1)//2)-1:-1]):
  pass
else:
  ans = ('No')
print(ans)

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

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


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):
A,B=input()
A=int(A)
B=int(B)

num=0
num+=A*(A-1)//2
num+=B*(B-1)//2
print(num)

A,B=input().split(' ')
A=int(A)
B=int(B)

num=0
num+=A*(A-1)//2
num+=B*(B-1)//2
print(num)


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

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


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())
a = N(N-1)/2
b = M(M-1)/2
c = N(N-1) + M(M-1)
print(a + b + c)

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

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

Verdicts: 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())
n=N*(N-1)
m=M*(M-1)
print((n+m)/2)

N,M= map(int,input().split())
n=N*(N-1)
m=M*(M-1)
print((n+m)//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(int(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(' '))
if n >= 2:
    ret_n = n * (n - 1) / 2
else:
    ret_n = 0

if m >= 2:
    ret_m = m * (m - 1) / 2
else:
    ret_m = 0

print(ret_n + ret_m)


import math

n, m = map(int, input().split(' '))
if n >= 2:
    ret_n = n * (n - 1) / 2
else:
    ret_n = 0

if m >= 2:
    ret_m = m * (m - 1) / 2
else:
    ret_m = 0

print(int(ret_n + ret_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):
from collections import defaultdict
from itertools import product
 
H,W,K = map(int,input().split())
S = [input() for i in range(H)]
 
C = [[int(S[i][k]) for i in range(H)] for k in range(W)]
answer = H*W 
for X in product([False,True],repeat = H-1):
  M = [[0]]
  ans = sum(X)
  if ans > answer:
    continue
  for i,x in enumerate(X):
    if x:
      M.append([])
    M[-1].append(i+1)
  D = [0]*len(M)
  for c in C:
    for k,m in enumerate(M):
      D[k] += sum(c[i] for i in m)
      
    if any(d>K for d in D):
      ans += 1
      if ans >answer:
        break
      D = [sum(c[i] for i in m) for m in M]
      if any(d>K for d in D):
        ans = answer + 1
        
        break
  answer = min(answer,ans)
print(answer)

from collections import defaultdict
from itertools import product
 
H, W, K = map(int, input().split())
S = [input() for _ in range(H)]
 
i = 0
while i < len(S):
  if '1' in S[i]:
    i += 1
  else:
    del S[i]
H = len(S)
 
C = [[int(s[i]) for s in S] for i in range(W)]
 
total = sum(sum(c) for c in C)
 
if total <= K:
  answer = 0
else:
  answer = H * W
  for X in product([False, True], repeat=H-1):
    
    ans = sum(X)
    if ans > answer:
      continue
    M = [[0]]
    for i, x in enumerate(X):
      if x:
        M.append([])
      M[-1].append(i+1)
    print('M{}'.format(M))
    D = [0] * len(M)
    for c in C:
      print('c{}'.format(c))
      for k, m in enumerate(M):
        print('m{}'.format(m))
        D[k] += sum(c[i] for i in m)
        
      print('D1{}'.format(D))
      if any(d > K for d in D):
        ans += 1
        if ans > answer:
          break
        D = [sum(c[i] for i in m) for m in M]
        print('D2{}'.format(D))
        if any(d > K for d in D):
          ans = answer + 1
          break
    answer = min(answer, ans)

print(answer)

import numpy as np
a = [int(i) for i in list(input().split())]
b = int((a[0]*(a[0]-1) +a[1]*(a[1]-1))/2)

print(b)

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==0 :
    print(M*(M-1)/2)
elif M==0 :
    print(N*(N-1)/2)
else :
    print(N*(N-1)/2+M*(M-1)/2)

N,M=map(int, input().split())
 
if N==0 :
    print(M*(M-1)//2)
elif M==0 :
    print(N*(N-1)//2)
else :
    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())
num = 2/n*(n-1) + 2/m*(m-1)
print(num)

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

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(int(sum([N*(N-1)/2 if N >= 2 else N, M*(M-1)/2 if M >= 2 else M])))

N, M = map(int, input().split(' '))
print(int(sum([N*(N-1)/2 if N >= 2 else 0, M*(M-1)/2 if M >= 2 else 0])))

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

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

print(ans)

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

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

print(ans)

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

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

print(ans)


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())
Q = N*(N-1)*0.5
P = M*(M-1)*0.5
print(P+Q)


N,M = map(int,input().split())
Q = N*(N-1)*0.5
P = M*(M-1)*0.5
print(int(P+Q))

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

nc=0
mc=0
if n >=2:
    nc=math.factorial(n) // (math.factorial(n - 2) * math.factorial(2))
if m>=2:
    mc=math.factorial(m) // (math.factorial(m - 2) * math.factorial(2))

print(nc+mc)


import math

def resolve():

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

    nc=0
    mc=0
    if n >=2:
        nc=math.factorial(n) // (math.factorial(n - 2) * math.factorial(2))
    if m>=2:
        mc=math.factorial(m) // (math.factorial(m - 2) * math.factorial(2))

    print(nc+mc)

resolve()

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())
print(a*(a-1)/2 + b*(b-1)/2)

a,b =map(int,input().split())
print((a*(a-1))//2 + (b*(b-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 = np.zeros((N+1,S+1,3),dtype=np.int16)


import numpy as np
N,S = map(int,input().split())
list = list(map(int,input().split()))
A = np.zeros((N+1,S+1,3),dtype=np.int16)
A[0][0][0] = 1


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

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

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

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

N, M = map(int, (input().split()))
ans = int(N * (N - 1) / 2 + M * (M - 1) / 2)
print(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):
import sys
sys.setrecursionlimit(2147483647)

n,m = map(int,input().split())
a = n - 1
b = m - 1
ans = 0

if m <= 1:
    ans = n*a/2
else:
    ans = n*a/2 + m*b/2

print(str(int(ans))

import sys
sys.setrecursionlimit(2147483647)

n,m = map(int,input().split())
a = n - 1
b = m - 1
ans = 0

if m <= 1:
    ans = n*a/2
else:
    ans = n*a/2 + m*b/2

print(str(int(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):
#!/usr/bin/env python3

import sys

sys.setrecursionlimit(10 ** 6)


def main():
	pass

main()

#!/usr/bin/env python3

import sys
import math
sys.setrecursionlimit(10 ** 6)


def main():
	n, m = map(int, sys.stdin.readline().split())
	score = 0
	if n >= 2:
		score += math.factorial(n) // math.factorial(n-2) // math.factorial(2)
	if m >= 2:
		score += math.factorial(m) // math.factorial(m-2) // math.factorial(2)
	print(score)

main()

Verdicts: Wrong Answer

Accepted