message stringlengths 2 65.1k | message_type stringclasses 2
values | message_id int64 0 1 | conversation_id int64 0 108k | cluster float64 14 14 | __index_level_0__ int64 0 217k |
|---|---|---|---|---|---|
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Emily's birthday is next week and Jack has decided to buy a present for her. He knows she loves books so he goes to the local bookshop, where there are n books on sale from one of m genres.
In ... | instruction | 0 | 77,881 | 14 | 155,762 |
Yes | output | 1 | 77,881 | 14 | 155,763 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Emily's birthday is next week and Jack has decided to buy a present for her. He knows she loves books so he goes to the local bookshop, where there are n books on sale from one of m genres.
In ... | instruction | 0 | 77,882 | 14 | 155,764 |
Yes | output | 1 | 77,882 | 14 | 155,765 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Emily's birthday is next week and Jack has decided to buy a present for her. He knows she loves books so he goes to the local bookshop, where there are n books on sale from one of m genres.
In ... | instruction | 0 | 77,883 | 14 | 155,766 |
Yes | output | 1 | 77,883 | 14 | 155,767 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Emily's birthday is next week and Jack has decided to buy a present for her. He knows she loves books so he goes to the local bookshop, where there are n books on sale from one of m genres.
In ... | instruction | 0 | 77,884 | 14 | 155,768 |
Yes | output | 1 | 77,884 | 14 | 155,769 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Emily's birthday is next week and Jack has decided to buy a present for her. He knows she loves books so he goes to the local bookshop, where there are n books on sale from one of m genres.
In ... | instruction | 0 | 77,885 | 14 | 155,770 |
No | output | 1 | 77,885 | 14 | 155,771 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Emily's birthday is next week and Jack has decided to buy a present for her. He knows she loves books so he goes to the local bookshop, where there are n books on sale from one of m genres.
In ... | instruction | 0 | 77,886 | 14 | 155,772 |
No | output | 1 | 77,886 | 14 | 155,773 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Emily's birthday is next week and Jack has decided to buy a present for her. He knows she loves books so he goes to the local bookshop, where there are n books on sale from one of m genres.
In ... | instruction | 0 | 77,887 | 14 | 155,774 |
No | output | 1 | 77,887 | 14 | 155,775 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Emily's birthday is next week and Jack has decided to buy a present for her. He knows she loves books so he goes to the local bookshop, where there are n books on sale from one of m genres.
In ... | instruction | 0 | 77,888 | 14 | 155,776 |
No | output | 1 | 77,888 | 14 | 155,777 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Two friends are on the coordinate axis Ox in points with integer coordinates. One of them is in the point x1 = a, another one is in the point x2 = b.
Each of the friends can move by one along the line in any direction unlimited number of t... | instruction | 0 | 77,967 | 14 | 155,934 |
Tags: brute force, greedy, implementation, math
Correct Solution:
```
x=int(input())
y=int(input())
dis=abs(x-y)
a=dis//2
b=dis-a
print(a*(a+1)//2+b*(b+1)//2) if dis>1 else print(1)
``` | output | 1 | 77,967 | 14 | 155,935 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Two friends are on the coordinate axis Ox in points with integer coordinates. One of them is in the point x1 = a, another one is in the point x2 = b.
Each of the friends can move by one along the line in any direction unlimited number of t... | instruction | 0 | 77,968 | 14 | 155,936 |
Tags: brute force, greedy, implementation, math
Correct Solution:
```
import math
def f(n):
return sum(list(range(n+1)))
a = int(input())
b = int(input())
middle = (a+b)//2
dist1 = int(math.fabs(a-middle))
dist2 = int(math.fabs(b-middle))
print(f(dist1) + f(dist2))
``` | output | 1 | 77,968 | 14 | 155,937 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Two friends are on the coordinate axis Ox in points with integer coordinates. One of them is in the point x1 = a, another one is in the point x2 = b.
Each of the friends can move by one along the line in any direction unlimited number of t... | instruction | 0 | 77,969 | 14 | 155,938 |
Tags: brute force, greedy, implementation, math
Correct Solution:
```
from math import ceil
def solve(a, b):
x = ceil(abs(a - b)/2)
y = abs(a - b)//2
if x != y:
return ((1+y)*y)//2 + ((x+1)*x)//2
else:
return ((1+y)*y)
def main():
a = int(input())
b = int(input())
print(so... | output | 1 | 77,969 | 14 | 155,939 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Two friends are on the coordinate axis Ox in points with integer coordinates. One of them is in the point x1 = a, another one is in the point x2 = b.
Each of the friends can move by one along the line in any direction unlimited number of t... | instruction | 0 | 77,970 | 14 | 155,940 |
Tags: brute force, greedy, implementation, math
Correct Solution:
```
import math;a=int(input());b=int(input());print((math.ceil(abs(a-b)/2))*((math.ceil(abs(a-b)/2)) + 1)//1 - (((a-b)%2))*(math.ceil(abs(a-b)/2)) )
``` | output | 1 | 77,970 | 14 | 155,941 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Two friends are on the coordinate axis Ox in points with integer coordinates. One of them is in the point x1 = a, another one is in the point x2 = b.
Each of the friends can move by one along the line in any direction unlimited number of t... | instruction | 0 | 77,971 | 14 | 155,942 |
Tags: brute force, greedy, implementation, math
Correct Solution:
```
a = int(input())
b = int(input())
result = 0
contA = 0
contB = 0
while(a != b):
if(contA > contB):
if(b > a):
b -= 1
else:
b += 1
contB += 1
result += contB
else:
if(a < b):
... | output | 1 | 77,971 | 14 | 155,943 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Two friends are on the coordinate axis Ox in points with integer coordinates. One of them is in the point x1 = a, another one is in the point x2 = b.
Each of the friends can move by one along the line in any direction unlimited number of t... | instruction | 0 | 77,972 | 14 | 155,944 |
Tags: brute force, greedy, implementation, math
Correct Solution:
```
a=int(input())
b=int(input())
c=(a+b)//2
d=0
e=1
if(a<c):
for i in range(a,c):
d=d+e
e=e+1
else:
for i in range(c,a):
d=d+e
e=e+1
e=1
if(b<c):
for i in range(b,c):
d=d+e
e=e+1
else:
for ... | output | 1 | 77,972 | 14 | 155,945 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Two friends are on the coordinate axis Ox in points with integer coordinates. One of them is in the point x1 = a, another one is in the point x2 = b.
Each of the friends can move by one along the line in any direction unlimited number of t... | instruction | 0 | 77,973 | 14 | 155,946 |
Tags: brute force, greedy, implementation, math
Correct Solution:
```
a = int(input())
b = int(input())
x = abs(a - b) // 2
s = (x * (1 + x)) // 2
s *= 2
if (abs(a - b) % 2 == 1):
s += x + 1
print(s)
``` | output | 1 | 77,973 | 14 | 155,947 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Two friends are on the coordinate axis Ox in points with integer coordinates. One of them is in the point x1 = a, another one is in the point x2 = b.
Each of the friends can move by one along the line in any direction unlimited number of t... | instruction | 0 | 77,974 | 14 | 155,948 |
Tags: brute force, greedy, implementation, math
Correct Solution:
```
a=int(input())
b=int(input())
c=abs(a-b)
d=(c//2)*((c//2)+1)+(c%2)*((c//2)+1)
print(d)
``` | output | 1 | 77,974 | 14 | 155,949 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Polycarp and his friends want to visit a new restaurant. The restaurant has n tables arranged along a straight line. People are already sitting at some tables. The tables are numbered from 1 to n in the order from left to right. The state of... | instruction | 0 | 78,431 | 14 | 156,862 |
Tags: constructive algorithms, greedy, math
Correct Solution:
```
import sys
INF = 10**20
MOD = 10**9 + 7
I = lambda:list(map(int,input().split()))
from math import gcd
from math import ceil
from collections import defaultdict as dd, Counter
from bisect import bisect_left as bl, bisect_right as br
def solve():
n, k ... | output | 1 | 78,431 | 14 | 156,863 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Polycarp and his friends want to visit a new restaurant. The restaurant has n tables arranged along a straight line. People are already sitting at some tables. The tables are numbered from 1 to n in the order from left to right. The state of... | instruction | 0 | 78,432 | 14 | 156,864 |
Tags: constructive algorithms, greedy, math
Correct Solution:
```
for i in range(int(input())):
n, k = [int(x) for x in input().split()]
n += 2*k + 2
s = '1' + '0'*k + input() + '0'*k + '1'
one = [0]
for j in range(k+1, n - (k+1)):
if s[j] == '1':
one.append(j)
one.append(n-1)
ans = 0
for j in... | output | 1 | 78,432 | 14 | 156,865 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Polycarp and his friends want to visit a new restaurant. The restaurant has n tables arranged along a straight line. People are already sitting at some tables. The tables are numbered from 1 to n in the order from left to right. The state of... | instruction | 0 | 78,433 | 14 | 156,866 |
Tags: constructive algorithms, greedy, math
Correct Solution:
```
import math
t=int(input())
for i in range(t):
n,k = map(int,input().split())
s=input()
z=0
noz=0
if not('1' in s):
print(math.ceil(n/(k+1)))
else:
while z<len(s):
if s[z]=='1':
z+=k+1
... | output | 1 | 78,433 | 14 | 156,867 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Polycarp and his friends want to visit a new restaurant. The restaurant has n tables arranged along a straight line. People are already sitting at some tables. The tables are numbered from 1 to n in the order from left to right. The state of... | instruction | 0 | 78,434 | 14 | 156,868 |
Tags: constructive algorithms, greedy, math
Correct Solution:
```
from sys import stdin as lector
input = lector.readlines()
n = lambda l,k: int((l-k)/(1+k))
for i in range(1,2*int(input[0])+1,2):
L,k = list(map(int,input[i].split(' ')))
x = input[i+1][0:-1]
linea = list(map(int,list(x)))
suma = sum(linea)
if L < ... | output | 1 | 78,434 | 14 | 156,869 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Polycarp and his friends want to visit a new restaurant. The restaurant has n tables arranged along a straight line. People are already sitting at some tables. The tables are numbered from 1 to n in the order from left to right. The state of... | instruction | 0 | 78,435 | 14 | 156,870 |
Tags: constructive algorithms, greedy, math
Correct Solution:
```
a = int(input())
for _ in range(a):
n, k = map(int,input().split())
s = input()
a = 0
z = -100000000
lis = [int(i) for i in s]
for i in range(len(lis)):
if lis[i] == 1:
if i <= k + z:
a -= 1
... | output | 1 | 78,435 | 14 | 156,871 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Polycarp and his friends want to visit a new restaurant. The restaurant has n tables arranged along a straight line. People are already sitting at some tables. The tables are numbered from 1 to n in the order from left to right. The state of... | instruction | 0 | 78,436 | 14 | 156,872 |
Tags: constructive algorithms, greedy, math
Correct Solution:
```
from collections import *
from bisect import *
from math import *
mod = 10 ** 9 + 7
for _ in range(int(input())):
n,k = map(int,input().split())
l = list(input())
ans = 0
val = k
for i in range(n):
if(l[i] == '1'):
... | output | 1 | 78,436 | 14 | 156,873 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Polycarp and his friends want to visit a new restaurant. The restaurant has n tables arranged along a straight line. People are already sitting at some tables. The tables are numbered from 1 to n in the order from left to right. The state of... | instruction | 0 | 78,437 | 14 | 156,874 |
Tags: constructive algorithms, greedy, math
Correct Solution:
```
ncases = int(input())
a = []
for i in range(ncases):
take = input().split(" ")
n = int(take[0])
k = int(take[1])
state = list(input())
if ('1' not in state):
for j in range(0,len(state),k+1):
state[j] = '1'
... | output | 1 | 78,437 | 14 | 156,875 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Polycarp and his friends want to visit a new restaurant. The restaurant has n tables arranged along a straight line. People are already sitting at some tables. The tables are numbered from 1 to n in the order from left to right. The state of... | instruction | 0 | 78,438 | 14 | 156,876 |
Tags: constructive algorithms, greedy, math
Correct Solution:
```
for _ in range(int(input())):
n,k=map(int,input().split())
s=input()
ar=[]
for i in range(n):
if s[i]=='1':
ar.append(i)
al=len(ar)
ans=0
if al==0:
ans=1+(n-1)//(k+1)
else:
ans=ar[0]//(k... | output | 1 | 78,438 | 14 | 156,877 |
Provide tags and a correct Python 3 solution for this coding contest problem.
One industrial factory is reforming working plan. The director suggested to set a mythical detail production norm. If at the beginning of the day there were x details in the factory storage, then by the end of the day the factory has to prod... | instruction | 0 | 78,653 | 14 | 157,306 |
Tags: implementation, math, matrices
Correct Solution:
```
# mukulchandel
a,m=map(int,input().split())
for i in range(20):
if (a*(2**i))%m==0:
print("Yes")
quit()
print("No")
``` | output | 1 | 78,653 | 14 | 157,307 |
Provide tags and a correct Python 3 solution for this coding contest problem.
One industrial factory is reforming working plan. The director suggested to set a mythical detail production norm. If at the beginning of the day there were x details in the factory storage, then by the end of the day the factory has to prod... | instruction | 0 | 78,654 | 14 | 157,308 |
Tags: implementation, math, matrices
Correct Solution:
```
import sys
input = sys.stdin.readline
############ ---- Input Functions ---- ############
def inp():
return(int(input()))
def inlt():
return(list(map(int,input().split())))
def insr():
s = input()
return(list(s[:len(s) - 1]))
def invr():
re... | output | 1 | 78,654 | 14 | 157,309 |
Provide tags and a correct Python 3 solution for this coding contest problem.
One industrial factory is reforming working plan. The director suggested to set a mythical detail production norm. If at the beginning of the day there were x details in the factory storage, then by the end of the day the factory has to prod... | instruction | 0 | 78,655 | 14 | 157,310 |
Tags: implementation, math, matrices
Correct Solution:
```
a, m = map(int, input().split())
print('No' if (a << 17) % m else 'Yes')
``` | output | 1 | 78,655 | 14 | 157,311 |
Provide tags and a correct Python 3 solution for this coding contest problem.
One industrial factory is reforming working plan. The director suggested to set a mythical detail production norm. If at the beginning of the day there were x details in the factory storage, then by the end of the day the factory has to prod... | instruction | 0 | 78,656 | 14 | 157,312 |
Tags: implementation, math, matrices
Correct Solution:
```
a, m = map(int, input().split())
r = a
ans = 0
for i in range(10**6):
r += r % m
if r % m == 0:
ans = 1
if ans:
print("Yes")
else:
print("No")
``` | output | 1 | 78,656 | 14 | 157,313 |
Provide tags and a correct Python 3 solution for this coding contest problem.
One industrial factory is reforming working plan. The director suggested to set a mythical detail production norm. If at the beginning of the day there were x details in the factory storage, then by the end of the day the factory has to prod... | instruction | 0 | 78,657 | 14 | 157,314 |
Tags: implementation, math, matrices
Correct Solution:
```
import sys
input = lambda:sys.stdin.readline()
MOD = 1000000007
ii = lambda: int(input())
si = lambda: input()
dgl = lambda: list(map(int, input()))
f = lambda: list(map(int, input().split()))
il = lambda: list(map(int, input().split()))
ls = lambda: list(input... | output | 1 | 78,657 | 14 | 157,315 |
Provide tags and a correct Python 3 solution for this coding contest problem.
One industrial factory is reforming working plan. The director suggested to set a mythical detail production norm. If at the beginning of the day there were x details in the factory storage, then by the end of the day the factory has to prod... | instruction | 0 | 78,658 | 14 | 157,316 |
Tags: implementation, math, matrices
Correct Solution:
```
a,m = map(int,input().split())
for i in range(17):
if a%m==0:
print("Yes")
quit()
else:
a+=a%m
print("No")
``` | output | 1 | 78,658 | 14 | 157,317 |
Provide tags and a correct Python 3 solution for this coding contest problem.
One industrial factory is reforming working plan. The director suggested to set a mythical detail production norm. If at the beginning of the day there were x details in the factory storage, then by the end of the day the factory has to prod... | instruction | 0 | 78,659 | 14 | 157,318 |
Tags: implementation, math, matrices
Correct Solution:
```
a, m = map(int, input().split())
was = [False for i in range(m)]
was[a % m] = True
a += a % m
while a % m != 0 and not was[a % m]:
was[a % m] = True
a += a % m
print('Yes' if was[0] or a % m == 0 else 'No')
``` | output | 1 | 78,659 | 14 | 157,319 |
Provide tags and a correct Python 3 solution for this coding contest problem.
One industrial factory is reforming working plan. The director suggested to set a mythical detail production norm. If at the beginning of the day there were x details in the factory storage, then by the end of the day the factory has to prod... | instruction | 0 | 78,660 | 14 | 157,320 |
Tags: implementation, math, matrices
Correct Solution:
```
import math
def res():
n,m=map(int,input().split())
k=math.floor(math.log(m,2))+2
i=1
t=n
f=1
while i<=k:
if t%m==0:
f=0
break
t=t*2
i=i+1
if f==0:
print("Yes")
else:
... | output | 1 | 78,660 | 14 | 157,321 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Generous sponsors of the olympiad in which Chloe and Vladik took part allowed all the participants to choose a prize for them on their own. Christmas is coming, so sponsors decided to decorate the Christmas tree with their prizes.
They too... | instruction | 0 | 78,765 | 14 | 157,530 |
Tags: dfs and similar, dp, graphs, trees
Correct Solution:
```
#!/usr/bin/env python3
import sys
import threading
from math import *
def ri():
return map(int, sys.stdin.readline().split())
def dfsv(u):
global ans
h1 = -inf
h2 = -inf
for i in adj[u]:
if v[i] == 0:
v[i] = 1
... | output | 1 | 78,765 | 14 | 157,531 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Generous sponsors of the olympiad in which Chloe and Vladik took part allowed all the participants to choose a prize for them on their own. Christmas is coming, so sponsors decided to decorate the Christmas tree with their prizes.
They too... | instruction | 0 | 78,766 | 14 | 157,532 |
Tags: dfs and similar, dp, graphs, trees
Correct Solution:
```
import sys
from math import inf
import threading
def dfs(g, i, v, n, p):
global exist, ans
summ = v[i-1]
first = -inf
second = -inf
maxm = -inf
for j in g[i]:
if(j==p):
continue
sum_child, max_child... | output | 1 | 78,766 | 14 | 157,533 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Generous sponsors of the olympiad in which Chloe and Vladik took part allowed all the participants to choose a prize for them on their own. Christmas is coming, so sponsors decided to decorate the Christmas tree with their prizes.
They too... | instruction | 0 | 78,767 | 14 | 157,534 |
Tags: dfs and similar, dp, graphs, trees
Correct Solution:
```
import sys
input = sys.stdin.readline
oo = 10**20
n = int(input())
a = list(map(int, input().split()))
adj = [[] for _ in range(n)]
for _ in range(n-1):
u, v = [int(i) - 1 for i in input().split()]
adj[u].append(v)
adj[v].append(u)
sm = [0] * n... | output | 1 | 78,767 | 14 | 157,535 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Generous sponsors of the olympiad in which Chloe and Vladik took part allowed all the participants to choose a prize for them on their own. Christmas is coming, so sponsors decided to decorate the Christmas tree with their prizes.
They too... | instruction | 0 | 78,768 | 14 | 157,536 |
Tags: dfs and similar, dp, graphs, trees
Correct Solution:
```
import os
import sys
from io import BytesIO, IOBase
from types import GeneratorType
from collections import defaultdict
BUFSIZE = 8192
class FastIO(IOBase):
newlines = 0
def __init__(self, file):
self._fd = file.fileno()
self.buff... | output | 1 | 78,768 | 14 | 157,537 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Generous sponsors of the olympiad in which Chloe and Vladik took part allowed all the participants to choose a prize for them on their own. Christmas is coming, so sponsors decided to decorate the Christmas tree with their prizes.
They too... | instruction | 0 | 78,769 | 14 | 157,538 |
Tags: dfs and similar, dp, graphs, trees
Correct Solution:
```
import sys
input = sys.stdin.readline
oo = 10**20
n = int(input())
a = list(map(int, input().split()))
adj = [[] for _ in range(n)]
for _ in range(n-1):
u, v = [int(i) - 1 for i in input().split()]
adj[u].append(v)
adj[v].append(u)
sm = [0] * ... | output | 1 | 78,769 | 14 | 157,539 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Generous sponsors of the olympiad in which Chloe and Vladik took part allowed all the participants to choose a prize for them on their own. Christmas is coming, so sponsors decided to decorate t... | instruction | 0 | 78,770 | 14 | 157,540 |
No | output | 1 | 78,770 | 14 | 157,541 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Generous sponsors of the olympiad in which Chloe and Vladik took part allowed all the participants to choose a prize for them on their own. Christmas is coming, so sponsors decided to decorate t... | instruction | 0 | 78,771 | 14 | 157,542 |
No | output | 1 | 78,771 | 14 | 157,543 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Generous sponsors of the olympiad in which Chloe and Vladik took part allowed all the participants to choose a prize for them on their own. Christmas is coming, so sponsors decided to decorate t... | instruction | 0 | 78,772 | 14 | 157,544 |
No | output | 1 | 78,772 | 14 | 157,545 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Generous sponsors of the olympiad in which Chloe and Vladik took part allowed all the participants to choose a prize for them on their own. Christmas is coming, so sponsors decided to decorate t... | instruction | 0 | 78,773 | 14 | 157,546 |
No | output | 1 | 78,773 | 14 | 157,547 |
Provide tags and a correct Python 3 solution for this coding contest problem.
One day, n people (n is an even number) met on a plaza and made two round dances, each round dance consists of exactly n/2 people. Your task is to find the number of ways n people can make two round dances if each round dance consists of exa... | instruction | 0 | 79,334 | 14 | 158,668 |
Tags: combinatorics, math
Correct Solution:
```
import math
n = int(input())
ans = int(((2*math.factorial(n))/pow(n,2)))
print(ans)
``` | output | 1 | 79,334 | 14 | 158,669 |
Provide tags and a correct Python 3 solution for this coding contest problem.
One day, n people (n is an even number) met on a plaza and made two round dances, each round dance consists of exactly n/2 people. Your task is to find the number of ways n people can make two round dances if each round dance consists of exa... | instruction | 0 | 79,335 | 14 | 158,670 |
Tags: combinatorics, math
Correct Solution:
```
n = int(input())
k = n//2
num = 1
for i in range(n,k,-1):
num = num*i
den = 1
for i in range(k,0,-1):
den = den*i
ans = num//den
for i in range(k-1,1,-1):
ans = ans * i*i
print (ans//2)
``` | output | 1 | 79,335 | 14 | 158,671 |
Provide tags and a correct Python 3 solution for this coding contest problem.
One day, n people (n is an even number) met on a plaza and made two round dances, each round dance consists of exactly n/2 people. Your task is to find the number of ways n people can make two round dances if each round dance consists of exa... | instruction | 0 | 79,336 | 14 | 158,672 |
Tags: combinatorics, math
Correct Solution:
```
def factorial(m, n):
if m == 0:
return 1
if m == 1:
return n
return factorial(m - 1, n * m)
n = int(input())
if n > 2:
half = n // 2
res = factorial(n, 1) // factorial(half, 1)
res = res // factorial(half, 1)
res = res // 2
... | output | 1 | 79,336 | 14 | 158,673 |
Provide tags and a correct Python 3 solution for this coding contest problem.
One day, n people (n is an even number) met on a plaza and made two round dances, each round dance consists of exactly n/2 people. Your task is to find the number of ways n people can make two round dances if each round dance consists of exa... | instruction | 0 | 79,337 | 14 | 158,674 |
Tags: combinatorics, math
Correct Solution:
```
n = int(input())
if n == 2:
print(1)
else:
if n==4:
print(3)
else:
rs = 1
for i in range(3,n//2):
rs*=i*i
rs*=2
for i in range(n//2+1,n+1):
rs*=i
for i in range(1,n//2+1):
rs//=i
print(rs)
``` | output | 1 | 79,337 | 14 | 158,675 |
Provide tags and a correct Python 3 solution for this coding contest problem.
One day, n people (n is an even number) met on a plaza and made two round dances, each round dance consists of exactly n/2 people. Your task is to find the number of ways n people can make two round dances if each round dance consists of exa... | instruction | 0 | 79,338 | 14 | 158,676 |
Tags: combinatorics, math
Correct Solution:
```
import math
n = int(input())
print(math.factorial(n) // (2 * math.factorial(n // 2) ** 2) * (math.factorial(n // 2) // (n // 2)) ** 2)
``` | output | 1 | 79,338 | 14 | 158,677 |
Provide tags and a correct Python 3 solution for this coding contest problem.
One day, n people (n is an even number) met on a plaza and made two round dances, each round dance consists of exactly n/2 people. Your task is to find the number of ways n people can make two round dances if each round dance consists of exa... | instruction | 0 | 79,339 | 14 | 158,678 |
Tags: combinatorics, math
Correct Solution:
```
def fact(n):
res = 1
for i in range(2, n+1):
res = res * i
return res
def nCr(n, r):
return (fact(n) / (fact(r) * fact(n - r)))
n = int(input())
if(n == 2):
print(1)
else:
x = fact((n//2)-1)
ans = int(nC... | output | 1 | 79,339 | 14 | 158,679 |
Provide tags and a correct Python 3 solution for this coding contest problem.
One day, n people (n is an even number) met on a plaza and made two round dances, each round dance consists of exactly n/2 people. Your task is to find the number of ways n people can make two round dances if each round dance consists of exa... | instruction | 0 | 79,340 | 14 | 158,680 |
Tags: combinatorics, math
Correct Solution:
```
n = input()
res = {'2' : 1, '4' : 3, '6' : 40, '8' : 1260, '10' : 72576, '12' : 6652800, '14' : 889574400, '16' : 163459296000, '18' : 39520825344000, '20' : 12164510040883200 }
print(res[n])
``` | output | 1 | 79,340 | 14 | 158,681 |
Provide tags and a correct Python 3 solution for this coding contest problem.
One day, n people (n is an even number) met on a plaza and made two round dances, each round dance consists of exactly n/2 people. Your task is to find the number of ways n people can make two round dances if each round dance consists of exa... | instruction | 0 | 79,341 | 14 | 158,682 |
Tags: combinatorics, math
Correct Solution:
```
def nCr(n, r):
num = fact(n)
denom=fact(r)*fact(n-r)
return num/denom
def fact(n):
res = 1
for i in range(1,n+1):
res = res * i
return int(res)
t=1
while t>0:
n=int(input())
x=int(n/2)
ans=int(nCr(n,x))
ans/=2
y=... | output | 1 | 79,341 | 14 | 158,683 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
One day, n people (n is an even number) met on a plaza and made two round dances, each round dance consists of exactly n/2 people. Your task is to find the number of ways n people can make two r... | instruction | 0 | 79,342 | 14 | 158,684 |
Yes | output | 1 | 79,342 | 14 | 158,685 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.