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())
 
ln = [2*i for i in range(1, n+1)]
lm = [2*i+1 for i in range(m)]
 
c = 0
for i in ln:
  for j in lm:
    if (i+j)%2==0:
      c+=1
for i in lm:
  for j in lm:
    if (i+j)%2==0:
      c+=1
for i in ln:
  for j in ln:
    if (i+j)%2==0:
      c+=1
print(c)

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

ln = [2*i for i in range(1, n+1)]
lm = [2*i+1 for i in range(m)]

c = 0
for i in ln:
  for j in lm:
    if (i+j)%2==0:
      c+=1
print(c)

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

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

if n!=0:
  c+= n*(n-1)/2
if m!=0:
  c+= m*(m-1)/2
print(c)

n, m = map(int, input().split())
 
ln = [2*i for i in range(1, n+1)]
lm = [2*i+1 for i in range(m)]
 
c = 0
for i in ln:
  for j in lm:
    if (i+j)%2==0:
      c+=1
c+= n*(n-1)/2
c+= m*(m-1)/2
print(c)

n, m = map(int, input().split())
c = 0
if n!=0:
  c+= n*(n-1)/2
print(c)

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

Verdicts: Wrong Answer

Wrong Answer

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())
if (a != 0) and (b != 0):
    print(str(int(a*(a-1)/2 + b*(b-1)/2)))
elif (a == 0) and (b == 0):
    print("0")      
elif (a == 0) and (b != 0):
    print(str(int((b*(b-1)/2)))
else:
    print(str(int((a*(a-1)/2)))

a,b = map(int,input().split())
if (a >= 1) and (b >= 1):
    print(str(a*(a-1)/2 + b*(b-1)/2))
elif (a == 0) and (b == 0):
    print(str("0")
elif (a == 0):
    print(str(b*(b-1)/2))
else:
    print(str(a*(a-1)/2))


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

a,b = map(int,input().split())
if (a != 0) and (b != 0):
    print(str(a*(a-1)/2 + b*(b-1)/2))
elif (a == 0) and (b == 0):
    print("0")      
elif (a == 0) and (b != 0):
    print(str(b*(b-1)/2))
else:
    print(str(a*(a-1)/2))

a,b = map(int,input().split())
if (a != 0) and (b != 0):
    print(str(int(a*(a-1)/2 + b*(b-1)/2)))
elif (a == 0) and (b == 0):
    print("0")      
elif (a == 0) and (b != 0):
    print(str(int(b*(b-1)/2)))
else:
    print(str(int(a*(a-1)/2)))

Verdicts: Runtime Error

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 math import factorial

N, M = (int(s) for s in sys.stdin.split(' '))

total = 0
if N > 1:
  total += factorial(N) / factorial(N - 2) / 2
if M > 1:
  total += factorial(M) / factorial(M - 2) / 2
  
print(total)

import sys
from math import factorial

line = input()
N, M = (int(s) for s in line.split(' '))

total = 0
if N > 1:
  total += factorial(N) / factorial(N - 2) / 2
if M > 1:
  total += factorial(M) / factorial(M - 2) / 2

print(total)

import sys
from math import factorial

line = input()
N, M = (int(s) for s in line.split(' '))

total = 0
if N > 1:
  total += factorial(N) / factorial(N - 2) / 2
if M > 1:
  total += factorial(M) / factorial(M - 2) / 2

print(int(total))

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):
def resolve():
    import itertools
    N,M = map(int,input().split())
    N_list = [int(x) for x in range(N)]
    M_list = [int(y) for y in range(M)]

    n = len(list(itertools.combinations(N_list,2)))
    m = len(list(itertools.combinations(M_list,2)))
    print(n+m)

if __name__ == "__main__":
    main()   

def resolve():
    import itertools
    N,M = map(int,input().split())
    N_list = [int(x) for x in range(N)]
    M_list = [int(y) for y in range(M)]

    n = len(list(itertools.combinations(N_list,2)))
    m = len(list(itertools.combinations(M_list,2)))
    print(n+m)

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

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

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

print(x)

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

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

print(x)


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):
data = input().split(" ")

N = int(data[0])
M = int(data[1])

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

print(ans)


data = input().split(" ")
 
N = int(data[0])
M = int(data[1])
 
ans = N*(N-1)/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):
import math
from scipy.misc import comb

N, M = map(int, input().split())
print(math.ceil(comb(N, 2))+math.ceil(comb(M, 2)))

def comb(a):
    if a < 2:
        return 0
    else:
        return a * (a-1) // 2


N, M = map(int, input().split())
print(comb(N)+comb(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):
N = int(input(""))
M = int(input(""))
ans = 0
if N == 1 :
  if M != 1 :
    ans = M * (M - 1)
else :
  if M == 1 :
    ans = N * (N - 1)
  else :
    ans = M * (M - 1) + N * (N - 1)
print(ans)


n = input("")
m = input("")
N = int(n)
M = int(m)
a = N*(N-1) if N*(N-1) >= 0 else 0
b = M*(M-1) if M*(M-1) >= 0 else 0
print(a + b)

n,m = input("")
N = int(n)
M = int(m)
a = N*(N-1) if N*(N-1) >= 0 else 0
b = M*(M-1) if M*(M-1) >= 0 else 0
print(a + b)

num = input("")
num = num.split(" ")
N = int(num[0])
M = int(num[1])
a = N*(N-1) if N*(N-1) >= 0 else 0
b = M*(M-1) if M*(M-1) >= 0 else 0
print(a + b)

num = input("")
num = num.split(" ")
N = int(num[0])
M = int(num[1])
a = int(N*(N-1)/2) if N*(N-1) >= 0 else 0
b = int(M*(M-1)/2) if M*(M-1) >= 0 else 0
print(a + b)


Verdicts: Runtime Error

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):
import math

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

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

from operator import mul
from functools import reduce

def cmb(n,r):
    r = min(n-r,r)
    if r == 0: return 1
    over = reduce(mul, range(n, n - r, -1))
    under = reduce(mul, range(1,r + 1))
    return over // under

if M == 0:
    print(cmb(N, 2))
elif N == 0:
    print(cmb(M, 2))
elif M <= 1 and N <= 1:
    print(0)
else:
    a = cmb(M, 2)
    b = cmb(N, 2)
    print(a + b)

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

from operator import mul
from functools import reduce

def cmb(n,r):
    r = min(n-r,r)
    if r == 0: return 1
    over = reduce(mul, range(n, n - r, -1))
    under = reduce(mul, range(1,r + 1))
    return over // under

if M <= 1 and N <= 1:
    print(0)
elif M == 0:
    print(cmb(N, 2))
elif N == 0:
    print(cmb(M, 2))
else:
    a = cmb(M, 2)
    b = cmb(N, 2)
    print(a + b)

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

from operator import mul
from functools import reduce

def cmb(n,r):
    r = min(n-r,r)
    if r == 0: return 1
    over = reduce(mul, range(n, n - r, -1))
    under = reduce(mul, range(1,r + 1))
    return over // under

if M == 0 and N == 0:
    print(0)
elif M == 0:
    print(cmb(N, 2))
elif N == 0:
    print(cmb(M, 2))
elif M <= 1 and N <= 1:
    print(0)
else:
    a = cmb(M, 2)
    b = cmb(N, 2)
    print(a + b)

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

from operator import mul
from functools import reduce

def cmb(n,r):
    r = min(n-r,r)
    if r == 0: return 1
    over = reduce(mul, range(n, n - r, -1))
    under = reduce(mul, range(1,r + 1))
    return over // under

if M <= 1 and N <= 1:
    print(0)
elif M == 2 and N == 2:
    print(2)
elif M == 2:
    print(cmb(N, 2)+1)
elif N == 2:
    print(cmb(M, 2)+1)
elif M == 0:
    print(cmb(N, 2))
elif N == 0:
    print(cmb(M, 2))
else:
    a = cmb(M, 2)
    b = cmb(N, 2)
    print(a + b)

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

from operator import mul
from functools import reduce

def cmb(n,r):
    r = min(n-r,r)
    if r == 0: return 1
    over = reduce(mul, range(n, n - r, -1))
    under = reduce(mul, range(1,r + 1))
    return over // under

if M == 0 and N == 0:
    print(0)
elif M == 1 and N == 1:
    print(0)
elif M <= 1:
    print(cmb(N, 2))
elif N <= 1:
    print(cmb(M, 2))
else:
    a = cmb(M, 2)
    b = cmb(N, 2)
    print(a + b)

Verdicts: Runtime Error

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
N=int(sys.stdin.readline())
L=list(map(int,sys.stdin.readline().split()))
count=[0]*N
C=list(set(L))
x=0
d=[0]*len(C)
e=[0]*N
for i in range(len(C)):
  d[i] = int((L.count(C[i]))*(L.count(C[i])-1)/2)
  x += d[i]  
for K in range(N):
  e[K] = L.count(L[K])-1
  print(x-e[K])


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):
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())
if n>=2 and m>=2:print(cmb(n,2)+cmb(m,2))
elif n>=2:print(cmb(m,2))
elif m>=2:print(cmb(n,2))
else:print(0)

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())
if n>=2 and m>=2:print(cmb(n,2)+cmb(m,2))
elif n=>2:print(cmb(m,2))
elif m>=2:print(cmb(n,2))
else:print(0)

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())
if n>=2 and m>=2:print(cmb(n,2)+cmb(m,2))
elif n>=2:print(cmb(n,2))
elif m>=2:print(cmb(m,2))
else:print(0)

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):
ST = input().split()
N = int(ST[0])
M = int(ST[1])
print((N*(N-1)+(M*(M-1)))/2)

ST = input().split()
N = ST[0]
M = ST[1]
print((N*(N-1)+(M*(M-1)))/2)

ST = input().split()
N = int(ST[0])
M = int(ST[1])
print(int((N*(N-1)+(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):
N,M = map(int,input().split())
while N > 0:
  A = N - 1
  A += A
  N -= N
while M > 0:
  B = M - 1
  B += B
  M -= M
else:
  print('A + B')



N,M = map(int,input().split())
while N > 0:
  A = N - 1
  A += A
  N -= N
while M > 0:
  B = M - 1
  B += B
  M -= M
else:
  print(str('A + B'))
 

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

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 math

nums = map(int,input().split())

ans=0
for n in nums:
    ans+=math.factorial(n) // (math.factorial(n - 2) * math.factorial(2))
print(ans)

import math

nums = map(int,input().split())

ans=0
for n in nums:
    if n<2:
    	continue
    ans+=math.factorial(n) // (math.factorial(n - 2) * math.factorial(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 itertools

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

import itertools

n,m = map(int,input().split())
comb = lambda x:x*(x-1)/2 if x >= 1 else 0
print(int(comb(n)+comb(m)))


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):
from math import factorial

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

if N == 0:
    combN = 0
else:
    combN = factorial(N) // (factorial(N - 2) * factorial(2))

if M == 0:
    combM = 0
else:
    combM = factorial(M) // (factorial(M - 2) * factorial(2))

print(combN + combM)


from math import factorial

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

if N <= 1:
    combN = 0
else:
    combN = factorial(N) // (factorial(N - 2) * factorial(2))

if M <= 1:
    combM = 0
else:
    combM = factorial(M) // (factorial(M - 2) * factorial(2))

print(combN + combM)


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(M//2+N)


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

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

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

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

import math

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

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

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

N = int(input())
M = int(input())

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

a = list(map(int, input().split()))
N = a[0]
M = a[1]

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

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

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

import sys
N, M = map(int, sys.stdin.readline().split())

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


Verdicts: Wrong Answer

Wrong Answer

Wrong Answer

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):
n,m = map(int,input().split())
a = [0]*n
b = [1]*m
ans = a+b
count = 0
for i in range(0,n+m):
    for j in range(i+1,n+m):
        if (ans[i]+ans[j])%2==0:
            count += 1
            print(ans[i],ans[j],i,j)
print(count)

n,m = map(int,input().split())
a = [0]*n
b = [1]*m
ans = a+b
count = 0
for i in range(0,n+m):
    for j in range(i+1,n+m):
        if (ans[i]+ans[j])%2==0:
            count += 1
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):
def kai(n):
    a=1
    for i in range(1,n+1):
        a=a*i
    return a

N,M=map(int,input().split())
if N==0 or N==1:
    g=0
else:
    g=kai(N)/(kai(N-2)*2)
if M==0 or M==1:
    k=0
else:
    k=kai(M)/(kai(M-2)*2)
print(g+k)

def kai(n):
    a=1
    for i in range(1,n+1):
        a=a*i
    return a

N,M=map(int,input().split())
if N==0 or N==1:
    g=0
else:
    g=kai(N)/(kai(N-2)*2)
if M==0 or M==1:
    k=0
else:
    k=kai(M)/(kai(M-2)*2)
print(g,k)

def kai(n):
    a=1
    for i in range(1,n+1):
        a=a*i
    return a

N,M=map(int,input().split())
if N==0 or N==1:
    g=0
else:
    g=kai(N)/(kai(N-2)*2)
if M==0 or M==1:
    k=0
else:
    k=kai(M)/(kai(M-2)*2)
print(int(g+k))

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

p = n * (n - 1) / 2 + m * (m - 1) / 2

print(p)

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

if n = 0:
  pn = 0
  
if m = 0:
  pm = 0

else:
  pn = n*(n-1) // 2
  pm = m*(m-1) // 2

p = pn + pm
print(p)

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

pn = n*(n-1) / 2
pm = m*(m-1) / 2

p = pn + pm
print(p)

n, m = map(int, input().split())
import math
pn = math.factorial(n) / (math.factorial(n-2) * math.factorial(2))
pm = math.factorial(m) / (math.factorial(m-2) * math.factorial(2))
print(pn + pm)

n, m = map(int, input().split())
import math
if n <= 1:
  pn = 0
  if m <= 1:
    pm = 0
  else:
    pm = math.factorial(m) // (math.factorial(m-2) * math.factorial(2))
elif m >= 2:
  pn = math.factorial(n) // (math.factorial(n-2) * math.factorial(2))
  pm = math.factorial(m) // (math.factorial(m-2) * math.factorial(2))

p = pn + pm
print(p)

n, m = map(int, input().split())
import math
pn = math.factorial(n) // (math.factorial(n-2) * math.factorial(2))
pm = math.factorial(m) // (math.factorial(m-2) * math.factorial(2))
p = pn + pm
print(p)

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

p = n * (n - 1) // 2 + m * (m - 1) // 2

print(p)

Verdicts: Wrong Answer

Runtime Error

Wrong Answer

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):
def cmb(n,k):
  x,y=n,k
  for i in range(1,k):
    x*=n-i
    y*=k-i
  return x//y

n,m=[int(x) for x in input().split()]
N=cmb(m,2) if n>=2 else 0
M=cmb(n,2) if m>=2 eles 0
print(N+M)

def cmb(n,k):
  x,y=n,k
  for i in range(1,k):
    x*=n-i
    y*=k-i
  return x//y

n,m=[int(x) for x in input().split()]
N=cmb(n,2) if n>=2 else 0
M=cmb(m,2) if m>=2 else 0
print(N+M)


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
input = sys.stdin.readline

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

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

import sys
input = sys.stdin.readline

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

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


N, M = input()
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

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):
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())
if n<2 and m<2:
    print(0)
    quit()
if n==0:
    print(cmb(m,2))
    quit()
elif m==0:
    print(cmb(n,2))
    quit()
print(cmb(n,2)+cmb(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):
A,B=map(int, input().split())
import math
def comb(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))
print(comb(A,2)+comb(B,2))

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


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

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

sum = 0

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

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

print(int(sum))

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 combinations_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

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

if(N == 1 and M == 1):
	ans = 0
elif(N != 0 and M != 0): 
	ans = combinations_count(N, 2)
	ans += combinations_count(M, 2)
elif(N == 1 and M != 1):
  ans = combinations_count(M, 2)
elif(N != 1 and M == 1):
  ans = combinations_count(N, 2)
elif(N == 1 and M ==1 ):
  ans = 0
elif(N == 0 and M != 0):
  ans = combinations_count(M, 2)
elif(N != 0 and M == 0):
  ans = combinations_count(N, 2)
  
print(ans)


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

ansA = 0

if N < 2 and M < 2:
    ansA = 0
if N >=2:
    ansA += ((N * (N-1)) / 2)
if M >= 2:
    ansA += ((M * (M-1)) / 2)

print(int(ansA))

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

N, M = map(int, input().split())
ans = 0
ans += (N * (N - 1)) // 2
ans += (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
import os
if sys.platform=="darwin":
	base = os.path.dirname(os.path.abspath(__file__))
	name = os.path.normpath(os.path.join(base, '../atcoder/input.txt'))
	#print(name)
	sys.stdin = open(name)

from math import factorial

def combinations_count(n,r):
    if n <= r:
        return 0
    else:
        return factorial(n) // ( factorial(n-r) * factorial(r))

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

#print(combinations_count(n,2))
#print(combinations_count(m,2))

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







import sys
import os
if sys.platform=="darwin":
	base = os.path.dirname(os.path.abspath(__file__))
	name = os.path.normpath(os.path.join(base, '../atcoder/input.txt'))
	#print(name)
	sys.stdin = open(name)

from math import factorial

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

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

#print(combinations_count(n,2))
#print(combinations_count(m,2))

#print(factorial(0))

print(combinations_count(n,2) + combinations_count(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):
s=list(input())
#s=['l','e','l','v','l','e','l']
L=int((len(s)-1)/2)
f1=0
for i in range(L):
#    print(s[0+i])
 #   print(s[len(s)-i-1])
    if s[0+i]==s[len(s)-i-1]:
        pass
  #      print('here1')
    else:
        f1+=1
   #     print('here2')
        
LL=L//2
f2=0
if f1==0:
    for j in range(LL):
    #    print(s[0+j])
     
        if s[0+j]==s[L-j-1]:
            pass
      #      print('here3')
        else:
            f2+=1
       #     print('here4')
else:
    f2=1
if f1==0 and f2==0:
    print('Yes')
else:
    print('No')


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

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

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

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())
a=N*(N-1)/2
b=M*(M-1)/2
if N<1.5 and M>1.5:
    print(int(b))
elif M<1.5 and N>1.5:
    print(a)
elif N<1.5 and N<1.5:
    print(int(0))
else:
    print(int(a+b))

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

N, M = map(int, readline().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: 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())

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

print(X)

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

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

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

a = N * (N - 1)/2
b = M * (M - 1)/2

print(a + b)

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

n1 = n*(n-1)/2

m1 = m*(m-1)/2
##print
print(n1 + m1)


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

n1 = n*(n-1)/2

m1 = m*(m-1)/2
##print
ans = int(n1 + m1)
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):
N = int(input())
M = int(input())
a = N*(N-1)//2 + M*(M-1)//2
print(a)

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)+M*(M-1))

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

n, m = map(int, input().split())
print(round((n*(n-1) + 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):
def main():
    import numpy as np
    inf = 100100100
    ans = inf
    H, W, K = map(int, input().split())
    S = []
    for _ in range(H):
        S.append([int(x) for x in input()])
    S = np.array(S)
    for i in range(2**(H-1)):
        group = [0]
        g = 0
        for j in range(H-1):
            if (i >> j) & 1:
                g += 1
            group.append(g)
        group = np.array(group)
        g += 1
        c = np.array([[0]*W]*g)
        for j in range(H):
            for k in range(W):
                c[group[j],k] += S[j,k]
        num = g-1
        now = np.zeros(g)
        def large(now):
            for n in now:
                if n > K:
                    return True
            else:
                return False
        for k in range(W):
            now += c[:,k]
            if large(now):
                now = c[:,k]
                num += 1
                if large(now):
                    num = inf
                    break
        ans = min(ans, num)
    print(ans)
main()


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

a = int(data[0])
b = int(data[1])

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


data = input().split()
 
a = int(data[0])
b = int(data[1])
ans = (a*(a-1)+b*(b-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().strip().split(' ')))
ans = A[0] * (A[0] - 1) + A[1] * (A[1] - 1)
print(ans)

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

A = list(map(int, input().strip().split(' ')))
ans = (A[0] * (A[0] - 1)) // 2 + ((A[1] * (A[1] - 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())

ans = 0
# even + even
if N>0:
	ans += N*(N-1)/2

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

print(ans)



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

ans = 0
# even + even
if N>0:
	ans += N*(N-1)/2

if M>0:
	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):
import math

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

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

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

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

Verdicts: Runtime Error

Accepted