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):
#200322D
N = int(input())
A = list(map(int,input().split()))
count = 0
for i in range(N):
    for j in range(N):
        if A[i] == A[j]:
            count += 1
All = (count - N) / 2
#print(int(All))

for i in range(N):
    count = 0
    for j in range(N):
        if A[i] == A[j]:
            count += 1
    print(int(All - count + 1))

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

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

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

S=input()
N=len(S)
S1=S[:int((N+1)/2)]
S2=S[int((N+3)/2):]
if S == S[::-1] and S1 == S1[::-1] and S2 == S2[::-1]:
  print("Yes")
else:
  print("No")

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=int(input())
M=int(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: Wrong Answer

Wrong Answer

Wrong Answer

Wrong Answer

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

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

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

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

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


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

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


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

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

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

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

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

def comb(n):
    if n == 1:
        return 0
    else:
        return int(n*(n-1)/2)

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

origin = list(set(AS))
num = []
for i in origin:
    num.append(AS.count(i))
comb_list = [-1]*(max(num)+1)
all_num = 0
for i in num:
    if comb_list[i] == -1:
        all_num += comb(i)
        comb_list[i] = comb(i)
    else:
        all_num += comb_list[i]
    
for i in range(n):
    j = num[origin.index(AS[i])]
    ans = all_num - (j-1)
    print(ans)

from math import factorial

n, m = map(int, input().split())
if n > 1 and m > 1:
    print(int(factorial(n)/factorial(2)/factorial(n-2) + factorial(m)/factorial(2)/factorial(m-2)))
elif n > 1:
    print(int(factorial(n)/factorial(2)/factorial(n-2)))
elif m > 1:
    print(int(factorial(m)/factorial(2)/factorial(m-2)))
else:
    print(0)

Verdicts: Runtime Error

Accepted
Problem: We have N+M balls, each of which has an integer written on it.   It is known that:    * The numbers written on N of the balls are even.   * The numbers written on M of the balls are odd.  Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the numbers written on them is even.   It can be shown that this count does not depend on the actual values written on the balls.

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

n, m = [int(i) for i in input().split(" ")]

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

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

n, m = [int(i) for i in input().split(" ")]
r = 0
if n > 1:
  r += comb(n, 2)
if m > 1:
  r += comb(m, 2)
print(r)

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

n = int(sys.stdin.readline())
 
li = list(map(int, sys.stdin.readline().split()))
 
ans = [0]*n
for i in range(n):
    li2 = li.copy()
    del li2[i]
    for j in range(n-1):
        for k in range(j+1, n-1):
            if li2[j] == li2[k]:
                ans[i] += 1
for l in range(len(ans)):
    print(ans[l])

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

ans = 0

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

print(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):
ls = list(input())
n = len(ls)
rvls = ls[::-1]

fh = int((n-1) /2)
fhls = ls[:fh]
rvfhls = fhls[::-1]

sh = int((n+3)/2-1)
shls = ls[sh:]
rvshls = shls[::-1]

if ls == rvls and fhls==rvfhls and shls == rvshls:
    print('Yes')
else:
    print('No')

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

if a >= 2 and b >=2 :
    ans = (a * (a + 1)//2 - a) + (b * (b +1)//2 - b)
    print(ans)

if a < 2 and b < 2:
    print(0)

if a < 2 and b >= 2:
    print(b * (b + 1)//2 -b)

if a >= 2 and b < 2:
    print(a * (a + 1)//2 -a)

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

if a >= 2 and b >=2 :
    ans = ((a * (a + 1))//2 - a) + ((b * (b +1))//2 - b)
    print(ans)

if a < 2 and b < 2:
    print(0)

if a < 2 and b >= 2:
    print((b * (b + 1))//2 -b)

if a >= 2 and b < 2:
    print((a * (a + 1))//2 -a)

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

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

Verdicts: Runtime Error

Accepted
Problem: We have N+M balls, each of which has an integer written on it.   It is known that:    * The numbers written on N of the balls are even.   * The numbers written on M of the balls are odd.  Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the numbers written on them is even.   It can be shown that this count does not depend on the actual values written on the balls.

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

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

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

if n < 1:
  print(comb(m, 2))
elif m < 1:
  print(comb(n, 2))
else:
  print(comb(n, 2) + comb(m, 2))


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

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

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

import math
import sys

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

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

if n <= 1
  print(comb(m, 2))
  sys.exit()
  
if m <=1
  print(comb(n, 2))
  sys.exit()

if n == 1 and m == 1:
  print('0')
  sys.exit()

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


import math
import sys

def comb(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:
  print('0')
  sys.exit()
  
if n <= 1:
  print(comb(m, 2))
  sys.exit()
  
if m <=1:
  print(comb(n, 2))
  sys.exit()

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

Verdicts: Runtime Error

Runtime Error

Runtime Error

Accepted
Problem: We have N+M balls, each of which has an integer written on it.   It is known that:    * The numbers written on N of the balls are even.   * The numbers written on M of the balls are odd.  Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the numbers written on them is even.   It can be shown that this count does not depend on the actual values written on the balls.

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


n, m = [int(x) for x in 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())

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

print(ans)

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

if n == 0:
    n = 1

if m == 0:
    m = 1

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

print(int(ans))

Verdicts: Wrong Answer

Accepted
Problem: We have N+M balls, each of which has an integer written on it.   It is known that:    * The numbers written on N of the balls are even.   * The numbers written on M of the balls are odd.  Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the numbers written on them is even.   It can be shown that this count does not depend on the actual values written on the balls.

Submission attempts (in order):
# -*- coding: utf-8 -*-

N, M= map(int, input().split())
import math
def combinations_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))
if N != 0:
  N_sum = combinations_count(N, 2)
else:
  N_sum = 0
if M != 0:
  M_sum = combinations_count(M, 2)
else:
  M_sum = 0
print(N_sum + M_sum)

l=int(input())
print((l/3)**3)

# -*- coding: utf-8 -*-
N, M = map(int, input().split())
import math
def combinations_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))
if N != 0:
  if N != 1:
    N_sum = combinations_count(N, 2)
  else:
    N_sum = 0
else:
  N_sum = 0
if M != 0:
  if M != 1:
    M_sum = combinations_count(M, 2)
  else:
    M_sum = 0
else:
  M_sum = 0
print(N_sum + M_sum)

Verdicts: Runtime Error

Runtime Error

Accepted
Problem: We have N+M balls, each of which has an integer written on it.   It is known that:    * The numbers written on N of the balls are even.   * The numbers written on M of the balls are odd.  Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the numbers written on them is even.   It can be shown that this count does not depend on the actual values written on the balls.

Submission attempts (in order):
import sys

s = input()

def is_kaibun(aaa):
    str_len = len(aaa)
    half_str_len = str_len // 2

    str_mae = aaa[:half_str_len]
    str_ato = aaa[half_str_len+1:]

    if str_mae == str_ato:
        return(True)
    else:
        return(False)
    

if is_kaibun(s):
    s_len = len(s)
    half_s_len = s_len // 2
    mae = s[:half_s_len]
    ato = s[half_s_len+1:] 
    if is_kaibun(mae) and is_kaibun(ato):
        print('Yes')
    else:
        print('No')
else:
    print('No')




import itertools

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

even = [i for i in range(2, 333, 2)]

odd = [i for i in range(1, 333, 2)]


seq = []


for i in range(n):
    seq.append(even[i])

for i in range(m):
    seq.append(odd[i])



cnt = 0

for v1, v2 in itertools.combinations(seq,2):
    tmp = int(v1) + int(v2)
    if tmp % 2 == 0:
        cnt += 1

print(cnt)


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):
H, W, K = map(int, input().split())
S = list(input() for i in range(H))

sum = [[0] * (W+1) for i in range((H+1))]
for i in range(H):
    for j in range(W):
        sum[i+1][j+1] = sum[i][j+1] + sum[i+1][j] - sum[i][j] + (1 if S[i][j] == '1' else 0)

ans = H + W - 2

for ptn in range(1<<H-1): 
    cand = 0

    sep = [0] 
    for i in range(H-1):
        if((ptn >> i) & 1): 
            sep.append(i+1)
            cand += 1
    sep.append(H)

    left = 0 
    for pos in range(W):
    	cur = [] 

    	
    	for i in range(len(sep) - 1):
    		cur.append(sum[sep[i+1]][pos+1] - sum[sep[i+1]][left] - sum[sep[i]][pos+1] + sum[sep[i]][left])

    	if max(cur) > K:
    		if left == pos: 
    			cand = H * W
    			break
    		else:
    			cand += 1
    			left = pos

    ans = min(ans, cand)

print(ans)


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

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

print(a+b)

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

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

print(int(a+b))

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

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

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

Verdicts: Wrong Answer

Wrong Answer

Accepted
Problem: We have N+M balls, each of which has an integer written on it.   It is known that:    * The numbers written on N of the balls are even.   * The numbers written on M of the balls are odd.  Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the numbers written on them is even.   It can be shown that this count does not depend on the actual values written on the balls.

Submission attempts (in order):
from scipy.misc import comb

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

print(int(comb(N, 2) + comb(M, 2)))



from scipy.misc import comb

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

print(int(comb(N, 2)) + int(comb(M, 2)))


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


def comb(x):
    if x == 0:
        return 0
    if x == 1:
        return 0
    return x * (x - 1) // 2


print(comb(N) + comb(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):
s = list(input())

f1 = s == list(reversed(s))
f2 = s[:(len(s)-1)//2] == list(reversed(s[:(len(s)-1)//2]))
f3 = s[(len(s)+2)//2:] == list(reversed(s[(len(s)+2)//2:]))
print("Yes" if all([f1, f2, f3]) else "No")

s = list(input())

f1 = s == list(reversed(s))
f2 = s[:(len(s)-1)//2] == list(reversed(s[:(len(s)-1)//2]))
f3 = s[(len(s)+2)//2:] == list(reversed(s[(len(s)+2)//2:]))

print("Yes" if all([f1, f2, f3]) else "No")

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

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

Verdicts: Wrong Answer

Wrong Answer

Accepted
Problem: We have N+M balls, each of which has an integer written on it.   It is known that:    * The numbers written on N of the balls are even.   * The numbers written on M of the balls are odd.  Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the numbers written on them is even.   It can be shown that this count does not depend on the actual values written on the balls.

Submission attempts (in order):
import sys


import math

n,m = map(int, input().split())
def c(n):
    return int(math.factorial(n) / math.factorial(n-2) / math.factorial(2))

if n == 1 and m == 1:
    print(0)
else:
    print(c(n)+c(m))

import sys


import math

n,m = map(int, input().split())
def c(n):
    return int(math.factorial(n) / math.factorial(n-2) / math.factorial(2))

if n == 1 and m == 1:
    print(0)
elif n <= 1:
    print(c(m))
elif m <= 1:
    print(c(n))
else:
    print(c(n)+c(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):
n = int(input())
m = int(input())
ans = n*(n-1)//2+m*(m-1)//2

print(ans)


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

print(int(ans))

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

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

print(ans)

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

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 scipy.misc import comb

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

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

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


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


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

Verdicts: Wrong Answer

Accepted
Problem: We have N+M balls, each of which has an integer written on it.   It is known that:    * The numbers written on N of the balls are even.   * The numbers written on M of the balls are odd.  Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the numbers written on them is even.   It can be shown that this count does not depend on the actual values written on the balls.

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


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

Verdicts: Runtime Error

Accepted
Problem: We have N+M balls, each of which has an integer written on it.   It is known that:    * The numbers written on N of the balls are even.   * The numbers written on M of the balls are odd.  Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the numbers written on them is even.   It can be shown that this count does not depend on the actual values written on the balls.

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

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

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

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

n,m=map(int,input().split())
if(n+m>=2 and n>=0 and n<=100 and m<=100 and m>=0):
    ans=int(round(n*(n-1)/2)+(m*(m-1)/2))
    print(ans)

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):
def comb(val):
    if(val > 0):
        return int(val*(val-1) / 2)
    else:
        return 0
    
def make_map(balls):
    balls_map = {}
    for ball in balls:
        if(ball in balls_map):
            balls_map[ball] += 1
        else:
            balls_map[ball] = 1
    return balls_map

def main():
    args = input().rstrip().split(' ')
    N = int(args[0])
    balls = [val for val in input().rstrip().split(' ')]
    balls_map = make_map(balls)
    
    sum_ = 0
    for ball in balls:
        balls_map[ball] -= 1
        sum_ = 0
        for val in balls_map.values():
            sum_ += comb(val)
        print(sum_)
        balls_map[ball] += 1
    
if __name__ == "__main__":
    main()

def comb(val):
    if(val > 0):
        return int(val*(val-1) / 2)
    else:
        return 0

def main():
    args = input().rstrip().split(' ')
    N, M = int(args[0]), int(args[1])
    print(comb(N) + comb(M))
    
if __name__ == "__main__":
    main()

Verdicts: Runtime Error

Accepted
Problem: We have N+M balls, each of which has an integer written on it.   It is known that:    * The numbers written on N of the balls are even.   * The numbers written on M of the balls are odd.  Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the numbers written on them is even.   It can be shown that this count does not depend on the actual values written on the balls.

Submission attempts (in order):
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: 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 combination(M,N):
    return M*(M-1)/2+N*(N-1)/2
M,N=map (int,input().split())
x=combination(M,N)
print(x)


def combination(M,N):
    return M*(M-1)/2+N*(N-1)/2
M,N=map (int,input().split())
x=combination(M,N)
x=int(x)
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())
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):
m,n=(int(x) for x in input().split());
even = m*(m-1)/2;
odd = n*(n-2)/2;

result = even + odd;
print(result);

n,m=(int(x) for x in input().split());
print(n);
print(m);

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


m,n=(int(x) for x in input().split());
even = m*(m-1)/2;
odd = n*(n-1)/2;

result = even + odd;
print(result);

m,n=(int(x) for x in input().split());
even = m*(m-1)/2;
odd = n*(n-1)/2;

result = int(even + odd);
print(result);

Verdicts: 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):
from math import factorial as f
x,y=map(int,input().split())
a=f(x)//(f(x-2)*2)
b=f(y)//(f(y-2)*2)
print(a+b)

from math import factorial as f
x,y=map(int,input().split())
if(x<2):
    a=0
else:
    a=f(x)//(f(x-2)*2)
if(y<2):
    b=0
else:    
    b=f(y)//(f(y-2)*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):
def main():
  
  strInput = input()
  
  if len(strInput) < 3 or len(strInput) > 99 \
  	or strInput.isupper() or (strInput.isalpha() == False):
    return print('No\n')
  
  if len(strInput) % 2 != 0:
    return print('No\n')
  
  strInputReverse = ''.join(list(reversed(strInput)))
  
  if strInput == strInputReverse:
    return print('Yes\n')
  else:
    return print('No\n')

if __name__ == '__main__':
  main()

def main():
  inputNumEven, inputNumOdd = map(int, input().split())
  
  
  if inputNumEven < 0:
    inputNumEven = 0
  if inputNumOdd > 100:
    inputNumOdd = 100
    
  result = inputNumEven*(inputNumEven-1)/2 + inputNumOdd*(inputNumOdd-1)/2
    
  
  return print(int(result))

if __name__ == '__main__':
  main()


Verdicts: Wrong Answer

Accepted
Problem: We have N+M balls, each of which has an integer written on it.   It is known that:    * The numbers written on N of the balls are even.   * The numbers written on M of the balls are odd.  Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the numbers written on them is even.   It can be shown that this count does not depend on the actual values written on the balls.

Submission attempts (in order):
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):
a,b=int(input().split())
print((a*(a-1))//2+(b*(b-1))//2)

a,b=list(map(int, input().split()))
print((a*(a-1))//2+(b*(b-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):
#include<bits/stdc++.h> 
using namespace std;
 
int main() {
	int n, m;
	cin >> n >> m;
	cout << (n*(n-1) / 2) + (m * (m-1) / 2) << "\n";
	return 0;
}


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

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


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

print(comb(n,2)+comb(m,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 sys import stdin
n = int(stdin.readline().rstrip())
data = [stdin.readline().rstrip().split() for _ in range(n)]
print(data)
print(*data, sep='\n')
"""
##################################################################

"""
s =input()
s=list(input())
a=int(input())
x,y = map(int,input().split())	
li = input().split()	
li = list(map(int,input().split()))	
li = input().split('T')	
"""
##################################################################


"""
from sys import stdin
n = int(stdin.readline().rstrip())
data = [stdin.readline().rstrip().split() for _ in range(n)]
print(data)
print(*data, sep='\n')
"""
##################################################################

"""
s =input()
s=list(input())
a=int(input())
x,y = map(int,input().split())	
li = input().split()	
li = list(map(int,input().split()))	
li = input().split('T')	
"""
##################################################################
N,M = map(int,input().split())

if N==1 and M==1:
    print("0")
else:
    N = N*(N-1)
    M = M*(M-1)
    ans = (M+N)/2
    print(ans)















"""
from sys import stdin
n = int(stdin.readline().rstrip())
data = [stdin.readline().rstrip().split() for _ in range(n)]
print(data)
print(*data, sep='\n')
"""
##################################################################

"""
s =input()
s=list(input())
a=int(input())
x,y = map(int,input().split())	
li = input().split()	
li = list(map(int,input().split()))	
li = input().split('T')	
"""
##################################################################


"""
from sys import stdin
n = int(stdin.readline().rstrip())
data = [stdin.readline().rstrip().split() for _ in range(n)]
print(data)
print(*data, sep='\n')
"""
##################################################################

"""
s =input()
s=list(input())
a=int(input())
x,y = map(int,input().split())	
li = input().split()	
li = list(map(int,input().split()))	
li = input().split('T')	
"""
##################################################################
N,M = map(int,input().split())

if N==1 and M==1:
    print("0")
else:
    N = N*(N-1)
    M = M*(M-1)
    ans = (M+N)//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
X,Y = map(int,input().split())
if(X == 1 or Y == 1):
    print(0)
    sys.exit()
print(int((X * (X-1))/2 + Y))


import sys
X,Y = map(int,input().spliut())
if(X == 1 or Y == 1):
    print(0)
    sys.exit()
print(int((X * (X-1))/2 + Y))


import sys
X,Y = map(int,input().split())
if(X == 1 and Y == 1):
    print(0)
    sys.exit()
elif(Y == 1):
    print(int(X/2))
    sys.exit()
elif(X == 0 and Y ==2):
    print(1)
    sys.exit()
print(int((X * (X-1))/2 + int((Y * (Y-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())
print(n/(2n-4)+m/(2m-4))

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

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

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()
L=len(S)
ans=0
if S[:int((L-1)/2)]==S[int((L-1)/2-1)::-1] and S[int((L+3)/2-1):]==S[:int((L+3)/2-2):-1]:
    ans='Yes'
else:
    ans='No'
print(ans)

S = input()
L=len(S)
ans='No'
    if S[:(L-1)/2+1]==S[(L-1)/2+1::-1] and S[L+3/2:]==S[:(L+3/2)-1:-1]:
    ans='Yes'
print(ans)

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

Verdicts: Wrong Answer

Runtime Error

Accepted
Problem: We have N+M balls, each of which has an integer written on it.   It is known that:    * The numbers written on N of the balls are even.   * The numbers written on M of the balls are odd.  Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the numbers written on them is even.   It can be shown that this count does not depend on the actual values written on the balls.

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

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


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

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

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


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

while n > 0:
    a = a + n
    n = n - 1

while m > 0:
    a = a + m
    m = m - 1

print(a)

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

while n > 0:
    a = a + n

while m > 0:
    a = a + m

print(a)

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

while n > 0:
    a = a + n
    n = n - 1

while m > 0:
    a = a + m
    m = m - 1

print(a)


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

while n > 0:
    a = a + n
    n = n - 1

while m > 0:
    a = a + m
    m = m - 1

print(a)


Verdicts: Runtime Error

Runtime Error

Wrong Answer

Accepted
Problem: We have N+M balls, each of which has an integer written on it.   It is known that:    * The numbers written on N of the balls are even.   * The numbers written on M of the balls are odd.  Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the numbers written on them is even.   It can be shown that this count does not depend on the actual values written on the balls.

Submission attempts (in order):
n,m=map(int,input().split())
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())

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

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

if N==0 or N ==1:
  if M ==0 or M == 1:
    print(0)
  else:
    print(M*(M-1)/2)
else:
  if M ==0 or M == 1:
    print(N*(N-1)/2)
  else:
    print(N*(N-1)/2+M*(M-1)/2)


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

if M<2:
  M=1

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

if N==0 or N ==1:
  if M ==0 or M == 1:
    print(0)
  else:
    print(M*(M-1)/2)
else:
  if M ==0 or M == 1:
    print(N*(N-1)/2)
  else:
    print(0)

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

if N==0 or N ==1:
  if M ==0 or M == 1:
    print(0)
  else:
    print(M*(M-1)/2)
else:
  if M ==0 or M == 1:
    print(N*(N-1))
  else:
    print(0)
  

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

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