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 |
|---|---|---|---|---|---|
Provide tags and a correct Python 3 solution for this coding contest problem.
Fafa owns a company that works on huge projects. There are n employees in Fafa's company. Whenever the company has a new project to start working on, Fafa has to divide the tasks of this project among all the employees.
Fafa finds doing thi... | instruction | 0 | 82,322 | 14 | 164,644 |
Tags: brute force, implementation
Correct Solution:
```
# cook your dish here
import sys
import bisect
import math
from itertools import permutations
m=1000000007
#a=list(map(int,input().strip().split(' ')))
#n,k,s= map(int, sys.stdin.readline().split(' '))
def find_lt(a, x):
'Find rightmost value less than x'
... | output | 1 | 82,322 | 14 | 164,645 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Fafa owns a company that works on huge projects. There are n employees in Fafa's company. Whenever the company has a new project to start working on, Fafa has to divide the tasks of this project... | instruction | 0 | 82,323 | 14 | 164,646 |
Yes | output | 1 | 82,323 | 14 | 164,647 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Fafa owns a company that works on huge projects. There are n employees in Fafa's company. Whenever the company has a new project to start working on, Fafa has to divide the tasks of this project... | instruction | 0 | 82,324 | 14 | 164,648 |
Yes | output | 1 | 82,324 | 14 | 164,649 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Fafa owns a company that works on huge projects. There are n employees in Fafa's company. Whenever the company has a new project to start working on, Fafa has to divide the tasks of this project... | instruction | 0 | 82,325 | 14 | 164,650 |
Yes | output | 1 | 82,325 | 14 | 164,651 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Fafa owns a company that works on huge projects. There are n employees in Fafa's company. Whenever the company has a new project to start working on, Fafa has to divide the tasks of this project... | instruction | 0 | 82,326 | 14 | 164,652 |
Yes | output | 1 | 82,326 | 14 | 164,653 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Fafa owns a company that works on huge projects. There are n employees in Fafa's company. Whenever the company has a new project to start working on, Fafa has to divide the tasks of this project... | instruction | 0 | 82,327 | 14 | 164,654 |
No | output | 1 | 82,327 | 14 | 164,655 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Fafa owns a company that works on huge projects. There are n employees in Fafa's company. Whenever the company has a new project to start working on, Fafa has to divide the tasks of this project... | instruction | 0 | 82,328 | 14 | 164,656 |
No | output | 1 | 82,328 | 14 | 164,657 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Fafa owns a company that works on huge projects. There are n employees in Fafa's company. Whenever the company has a new project to start working on, Fafa has to divide the tasks of this project... | instruction | 0 | 82,329 | 14 | 164,658 |
No | output | 1 | 82,329 | 14 | 164,659 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Fafa owns a company that works on huge projects. There are n employees in Fafa's company. Whenever the company has a new project to start working on, Fafa has to divide the tasks of this project... | instruction | 0 | 82,330 | 14 | 164,660 |
No | output | 1 | 82,330 | 14 | 164,661 |
Provide a correct Python 3 solution for this coding contest problem.
Problem Statement
The Animal School is a primary school for animal children. You are a fox attending this school.
One day, you are given a problem called "Arithmetical Restorations" from the rabbit teacher, Hanako. Arithmetical Restorations are the... | instruction | 0 | 82,524 | 14 | 165,048 |
"Correct Solution:
```
INF = 10 ** 10
MOD = 10 ** 9 + 7
def solve(A,B,C):
A = A[::-1]
B = B[::-1]
C = C[::-1]
before =[1,0,0]
N = len(A)
for i in range(N):
dp = [0]*3
s = 0
if i == N - 1:
s += 1
for j in range(3):
for a in range(s,10):
... | output | 1 | 82,524 | 14 | 165,049 |
Provide a correct Python 3 solution for this coding contest problem.
Problem Statement
The Animal School is a primary school for animal children. You are a fox attending this school.
One day, you are given a problem called "Arithmetical Restorations" from the rabbit teacher, Hanako. Arithmetical Restorations are the... | instruction | 0 | 82,525 | 14 | 165,050 |
"Correct Solution:
```
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools
sys.setrecursionlimit(10**7)
inf = 10**20
eps = 1.0 / 10**10
mod = 10**9+7
dd = [(-1,0),(0,1),(1,0),(0,-1)]
ddn = [(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]
def LI(): return [int... | output | 1 | 82,525 | 14 | 165,051 |
Provide tags and a correct Python 3 solution for this coding contest problem.
The "BerCorp" company has got n employees. These employees can use m approved official languages for the formal correspondence. The languages are numbered with integers from 1 to m. For each employee we have the list of languages, which he k... | instruction | 0 | 82,858 | 14 | 165,716 |
Tags: dfs and similar, dsu
Correct Solution:
```
n, m = map(int, input().split())
q = [[] for i in range(n + 1)]
r, s = [0] * (m + 1), 0
for i in range(1, n + 1):
t = list(map(int, input().split()))
if t[0]:
t = t[1: ]
d = set([r[j] for j in t])
if 0 in d: d.remove(0)
if len(d):
... | output | 1 | 82,858 | 14 | 165,717 |
Provide tags and a correct Python 3 solution for this coding contest problem.
The "BerCorp" company has got n employees. These employees can use m approved official languages for the formal correspondence. The languages are numbered with integers from 1 to m. For each employee we have the list of languages, which he k... | instruction | 0 | 82,859 | 14 | 165,718 |
Tags: dfs and similar, dsu
Correct Solution:
```
def root(ids, u):
if ids[u] < 0: return u
ids[u] = root(ids, ids[u])
return ids[u]
def union(ids, u, v):
if ids[u] > ids[v]:
u, v = v, u
ids[u] += ids[v]
ids[v] = u
n, m = list(map(int, input().split()))
langs = [[] for _ in range(m)]
h... | output | 1 | 82,859 | 14 | 165,719 |
Provide tags and a correct Python 3 solution for this coding contest problem.
The "BerCorp" company has got n employees. These employees can use m approved official languages for the formal correspondence. The languages are numbered with integers from 1 to m. For each employee we have the list of languages, which he k... | instruction | 0 | 82,860 | 14 | 165,720 |
Tags: dfs and similar, dsu
Correct Solution:
```
def dfs(i,v,vi,lan,emp,bn):
if bn:
vi[i]=1
for j in lan[i]:
if not v[j]: dfs(j,v,vi,lan,emp,(bn+1)%2)
else:
v[i]=1
for j in emp[i]:
if not vi[j]: dfs(j,v,vi,lan,emp,(bn+1)%2)
def main():
emp={}
lan={}
num0=ans=0
n,m=list(map(int,input().split()))
fo... | output | 1 | 82,860 | 14 | 165,721 |
Provide tags and a correct Python 3 solution for this coding contest problem.
The "BerCorp" company has got n employees. These employees can use m approved official languages for the formal correspondence. The languages are numbered with integers from 1 to m. For each employee we have the list of languages, which he k... | instruction | 0 | 82,861 | 14 | 165,722 |
Tags: dfs and similar, dsu
Correct Solution:
```
parent=[i for i in range(200005)]
size=[1 for i in range(200005)]
def find(v):
if v == parent[v]:
return v
parent[v]=find(parent[v])
return parent[v]
def union(a,b):
a=find(a)
b=find(b)
if a is not b:
if size[a] < size[b]:
... | output | 1 | 82,861 | 14 | 165,723 |
Provide tags and a correct Python 3 solution for this coding contest problem.
The "BerCorp" company has got n employees. These employees can use m approved official languages for the formal correspondence. The languages are numbered with integers from 1 to m. For each employee we have the list of languages, which he k... | instruction | 0 | 82,862 | 14 | 165,724 |
Tags: dfs and similar, dsu
Correct Solution:
```
def find(i):
if dsu[i] == i:
return i
dsu[i] = find(dsu[i])
return dsu[i]
if __name__ == '__main__':
dsu = [0]
visited = set()
iss = set()
ans = 0
N, M = map(int, input().split())
for i in range(1, M + 1):
dsu += [0]
... | output | 1 | 82,862 | 14 | 165,725 |
Provide tags and a correct Python 3 solution for this coding contest problem.
The "BerCorp" company has got n employees. These employees can use m approved official languages for the formal correspondence. The languages are numbered with integers from 1 to m. For each employee we have the list of languages, which he k... | instruction | 0 | 82,863 | 14 | 165,726 |
Tags: dfs and similar, dsu
Correct Solution:
```
from collections import defaultdict
def bfs(G, node):
Q = [node]
while Q:
node = Q.pop(0)
U.remove(node)
for neighbor in G[node]:
if neighbor in Q: # already queued up
continue
elif neighbor not in ... | output | 1 | 82,863 | 14 | 165,727 |
Provide tags and a correct Python 3 solution for this coding contest problem.
The "BerCorp" company has got n employees. These employees can use m approved official languages for the formal correspondence. The languages are numbered with integers from 1 to m. For each employee we have the list of languages, which he k... | instruction | 0 | 82,864 | 14 | 165,728 |
Tags: dfs and similar, dsu
Correct Solution:
```
n,m = map(int,input().split())
sets = list(range(n+m+1))
for i in range(n):
l = list(map(int,input().split()))
for j in range(1,len(l)):
sp = sets[i+1]
sl = sets[l[j]+n]
for k in range(len(sets)):
if sets[k]==sp:
sets[k] = sl
if len(l)<2:
sets[i+1] = 0
... | output | 1 | 82,864 | 14 | 165,729 |
Provide tags and a correct Python 3 solution for this coding contest problem.
The "BerCorp" company has got n employees. These employees can use m approved official languages for the formal correspondence. The languages are numbered with integers from 1 to m. For each employee we have the list of languages, which he k... | instruction | 0 | 82,865 | 14 | 165,730 |
Tags: dfs and similar, dsu
Correct Solution:
```
n, m = [int(x) for x in input().split()]
l = [[]] * n
for i in range(n):
l[i] = set(int(x) for x in input().split()[1:])
while True:
for i in range(len(l)):
for j in range(i):
if l[i] & l[j]:
l[j] |= l[i]
l = l[:i] + l[i + 1:]
break
else:
continue... | output | 1 | 82,865 | 14 | 165,731 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Piegirl found the red button. You have one last chance to change the inevitable end.
The circuit under the button consists of n nodes, numbered from 0 to n - 1. In order to deactivate the button, the n nodes must be disarmed in a particular... | instruction | 0 | 82,890 | 14 | 165,780 |
Tags: combinatorics, dfs and similar, dsu, graphs, greedy
Correct Solution:
```
n=int(input())
if n&1:
print(-1)
else:
D,R=[False]*(10**6),[0]*(10**6)
i,j=0,0
while True:
D[j]=True
R[i]=j
i+=1
if not D[(j+n)>>1]:
j=(j+n)>>1
elif not D[j>>1]:
j=j>>1
else:
break
print(" ".join(str(R[i]) for i in... | output | 1 | 82,890 | 14 | 165,781 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Piegirl found the red button. You have one last chance to change the inevitable end.
The circuit under the button consists of n nodes, numbered from 0 to n - 1. In order to deactivate the button, the n nodes must be disarmed in a particular... | instruction | 0 | 82,891 | 14 | 165,782 |
Tags: combinatorics, dfs and similar, dsu, graphs, greedy
Correct Solution:
```
# METO Bot 0.9.9
n=int(input())
if n&1:
print(-1)
else:
D,R=[False]*(10**6),[0]*(10**6)
i,j=0,0
while True:
D[j]=True
R[i]=j
i+=1
if not D[(j+n)>>1]:
j=(j+n)>>1
elif not D[j>>1]:
j=j>>1
else:
break
print(" ".join(s... | output | 1 | 82,891 | 14 | 165,783 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Piegirl found the red button. You have one last chance to change the inevitable end.
The circuit under the button consists of n nodes, numbered from 0 to n - 1. In order to deactivate the button, the n nodes must be disarmed in a particular... | instruction | 0 | 82,892 | 14 | 165,784 |
Tags: combinatorics, dfs and similar, dsu, graphs, greedy
Correct Solution:
```
# METO Bot 0.9.9.1
n=int(input())
if n&1:
print(-1)
else:
D,R=[False]*(10**6),[0]*(10**6)
i,j=0,0
while True:
D[j]=True
R[i]=j
i+=1
if not D[(j+n)>>1]:
j=(j+n)>>1
elif not D[j>>1]:
j=j>>1
else:
break
print(" ".join... | output | 1 | 82,892 | 14 | 165,785 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Even the most successful company can go through a crisis period when you have to make a hard decision β to restructure, discard and merge departments, fire employees and do other unpleasant stuf... | instruction | 0 | 82,974 | 14 | 165,948 |
No | output | 1 | 82,974 | 14 | 165,949 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Even the most successful company can go through a crisis period when you have to make a hard decision β to restructure, discard and merge departments, fire employees and do other unpleasant stuf... | instruction | 0 | 82,975 | 14 | 165,950 |
No | output | 1 | 82,975 | 14 | 165,951 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Even the most successful company can go through a crisis period when you have to make a hard decision β to restructure, discard and merge departments, fire employees and do other unpleasant stuf... | instruction | 0 | 82,976 | 14 | 165,952 |
No | output | 1 | 82,976 | 14 | 165,953 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Even the most successful company can go through a crisis period when you have to make a hard decision β to restructure, discard and merge departments, fire employees and do other unpleasant stuf... | instruction | 0 | 82,977 | 14 | 165,954 |
No | output | 1 | 82,977 | 14 | 165,955 |
Provide tags and a correct Python 3 solution for this coding contest problem.
One company of IT City decided to create a group of innovative developments consisting from 5 to 7 people and hire new employees for it. After placing an advertisment the company received n resumes. Now the HR department has to evaluate each... | instruction | 0 | 82,994 | 14 | 165,988 |
Tags: combinatorics, math
Correct Solution:
```
def fact(a):
ans = 1
for i in range(2, a + 1):
ans *= i
return ans
n = int(input())
ans = 0
for i in range(5, 8):
ans += fact(n) // fact(i) // fact(n - i)
print(ans)
``` | output | 1 | 82,994 | 14 | 165,989 |
Provide tags and a correct Python 3 solution for this coding contest problem.
One company of IT City decided to create a group of innovative developments consisting from 5 to 7 people and hire new employees for it. After placing an advertisment the company received n resumes. Now the HR department has to evaluate each... | instruction | 0 | 82,995 | 14 | 165,990 |
Tags: combinatorics, math
Correct Solution:
```
from math import factorial
n = int(input())
a = n * (n - 1) * (n - 2) * (n - 3) * (n - 4)
ans = a // factorial(5)
a *= (n - 5)
ans += a // factorial(6)
a *= (n - 6)
ans += a // factorial(7)
print(ans)
``` | output | 1 | 82,995 | 14 | 165,991 |
Provide tags and a correct Python 3 solution for this coding contest problem.
One company of IT City decided to create a group of innovative developments consisting from 5 to 7 people and hire new employees for it. After placing an advertisment the company received n resumes. Now the HR department has to evaluate each... | instruction | 0 | 82,996 | 14 | 165,992 |
Tags: combinatorics, math
Correct Solution:
```
n = int(input())
def fact(k):
if k < 2:
return 1
else:
return int(k * fact(k - 1))
def nb(k):
result = int(1)
f = fact(k)
for i in range(k):
result *= int(n - i)
result /= f
return int(result)
result = 0
for i in... | output | 1 | 82,996 | 14 | 165,993 |
Provide tags and a correct Python 3 solution for this coding contest problem.
One company of IT City decided to create a group of innovative developments consisting from 5 to 7 people and hire new employees for it. After placing an advertisment the company received n resumes. Now the HR department has to evaluate each... | instruction | 0 | 82,997 | 14 | 165,994 |
Tags: combinatorics, math
Correct Solution:
```
n = int(input())
dp = [[0 for i in range(n+1)] for i in range(n+1)]
dp[0][0] = 1
dp[1][0] = 1
dp[1][1] = 1
for i in range(1,n+1):
for j in range(0,i+1):
if j == 0:
dp[i][0] = 1
dp[i][j] = dp[i-1][j-1] + dp[i-1][j]
# print(*dp)
# print(dp)
print(dp[n][5]+dp[n][6... | output | 1 | 82,997 | 14 | 165,995 |
Provide tags and a correct Python 3 solution for this coding contest problem.
One company of IT City decided to create a group of innovative developments consisting from 5 to 7 people and hire new employees for it. After placing an advertisment the company received n resumes. Now the HR department has to evaluate each... | instruction | 0 | 82,998 | 14 | 165,996 |
Tags: combinatorics, math
Correct Solution:
```
n = int(input())
c5 = 1;
c6 = 1;
c7 = 1;
for i in range(n - 5 + 1, n + 1):
c5 *= i;
c5 //= (2 * 3 * 4 * 5)
for i in range(n - 6 + 1, n + 1):
c6 *= i;
c6 //= (2 * 3 * 4 * 5 * 6)
for i in range(n - 7 + 1, n + 1):
c7 *= i;
c7 //= (2 * 3 * 4 * 5 * 6 * 7)
print(c5 ... | output | 1 | 82,998 | 14 | 165,997 |
Provide tags and a correct Python 3 solution for this coding contest problem.
One company of IT City decided to create a group of innovative developments consisting from 5 to 7 people and hire new employees for it. After placing an advertisment the company received n resumes. Now the HR department has to evaluate each... | instruction | 0 | 82,999 | 14 | 165,998 |
Tags: combinatorics, math
Correct Solution:
```
while True:
try:
n = int(input())
print(n * (n - 1) * (n - 2) * (n - 3) * (n - 4) // 120
+ n * (n - 1) * (n - 2) * (n - 3) * (n - 4) * (n - 5) // 720
+ n * (n - 1) * (n - 2) * (n - 3) * (n - 4) * (n - 5) * (n - 6) // 5040)
... | output | 1 | 82,999 | 14 | 165,999 |
Provide tags and a correct Python 3 solution for this coding contest problem.
One company of IT City decided to create a group of innovative developments consisting from 5 to 7 people and hire new employees for it. After placing an advertisment the company received n resumes. Now the HR department has to evaluate each... | instruction | 0 | 83,000 | 14 | 166,000 |
Tags: combinatorics, math
Correct Solution:
```
from math import factorial as f
gh=lambda x,y:f(x)//(f(x-y)*f(y))
a=int(input())
print(gh(a,5)+gh(a,6)+gh(a,7))
``` | output | 1 | 83,000 | 14 | 166,001 |
Provide tags and a correct Python 3 solution for this coding contest problem.
One company of IT City decided to create a group of innovative developments consisting from 5 to 7 people and hire new employees for it. After placing an advertisment the company received n resumes. Now the HR department has to evaluate each... | instruction | 0 | 83,001 | 14 | 166,002 |
Tags: combinatorics, math
Correct Solution:
```
p = [1] * 800;
for i in range(1, 800):
p[i] = i * p[i - 1];
n = int(input());
print(p[n] // (p[7] * p[n - 7]) + p[n] // (p[6] * p[n - 6]) + p[n] // (p[5] * p[n - 5]));
``` | output | 1 | 83,001 | 14 | 166,003 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Little Petya likes points a lot. Recently his mom has presented him n points lying on the line OX. Now Petya is wondering in how many ways he can choose three distinct points so that the distance between the two farthest of them doesn't exce... | instruction | 0 | 83,693 | 14 | 167,386 |
Tags: binary search, combinatorics, two pointers
Correct Solution:
```
n,d=map(int,input().split())
arr=list(map(int,input().split()))
#arr.sort()
if n<3:
print(0)
else:
i=0
j=2
count=0
while i<len(arr):
while (j<len(arr) and (arr[j]-arr[i])<=d):
j+=1
count+=((j-i-1)*(... | output | 1 | 83,693 | 14 | 167,387 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Little Petya likes points a lot. Recently his mom has presented him n points lying on the line OX. Now Petya is wondering in how many ways he can choose three distinct points so that the distance between the two farthest of them doesn't exce... | instruction | 0 | 83,694 | 14 | 167,388 |
Tags: binary search, combinatorics, two pointers
Correct Solution:
```
import math
import sys
import collections
import bisect
import string
import time
def get_ints():return map(int, sys.stdin.readline().strip().split())
def get_list():return list(map(int, sys.stdin.readline().strip().split()))
def get_string():return... | output | 1 | 83,694 | 14 | 167,389 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Little Petya likes points a lot. Recently his mom has presented him n points lying on the line OX. Now Petya is wondering in how many ways he can choose three distinct points so that the distance between the two farthest of them doesn't exce... | instruction | 0 | 83,695 | 14 | 167,390 |
Tags: binary search, combinatorics, two pointers
Correct Solution:
```
######### ## ## ## #### ##### ## # ## # ##
# # # # # # # # # # # # # # # # # # #
# # # # ### # # # # # # # # # # # #
# ##### # # # # ### # # # # # # # # ####... | output | 1 | 83,695 | 14 | 167,391 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Little Petya likes points a lot. Recently his mom has presented him n points lying on the line OX. Now Petya is wondering in how many ways he can choose three distinct points so that the distance between the two farthest of them doesn't exce... | instruction | 0 | 83,696 | 14 | 167,392 |
Tags: binary search, combinatorics, two pointers
Correct Solution:
```
# Upsolve from Dukkha
n, d = map(int, input().split())
x = list(map(int, input().split()))
output = 0
j = 0
for i in range(n):
while j < n and x[j] - x[i] <= d:
j += 1
k = j - i - 1
output += (k/2)*(k-1)
print(int(output))
``` | output | 1 | 83,696 | 14 | 167,393 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Little Petya likes points a lot. Recently his mom has presented him n points lying on the line OX. Now Petya is wondering in how many ways he can choose three distinct points so that the distance between the two farthest of them doesn't exce... | instruction | 0 | 83,697 | 14 | 167,394 |
Tags: binary search, combinatorics, two pointers
Correct Solution:
```
import math
import random
from queue import Queue
import time
def main(arr,d):
ans=0
for i in range(len(arr)):
start=i
end=len(arr)-1
mid=(start+end)//2
best_val=mid
while start<=end:
mid=(start+end)//2
... | output | 1 | 83,697 | 14 | 167,395 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Little Petya likes points a lot. Recently his mom has presented him n points lying on the line OX. Now Petya is wondering in how many ways he can choose three distinct points so that the distance between the two farthest of them doesn't exce... | instruction | 0 | 83,698 | 14 | 167,396 |
Tags: binary search, combinatorics, two pointers
Correct Solution:
```
import sys
import string
import math
import heapq
from collections import defaultdict
from collections import deque
from collections import Counter
from functools import lru_cache
from fractions import Fraction
def mi(s):
return map(int, s.stri... | output | 1 | 83,698 | 14 | 167,397 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Little Petya likes points a lot. Recently his mom has presented him n points lying on the line OX. Now Petya is wondering in how many ways he can choose three distinct points so that the distance between the two farthest of them doesn't exce... | instruction | 0 | 83,699 | 14 | 167,398 |
Tags: binary search, combinatorics, two pointers
Correct Solution:
```
# Little Petya likes points a lot. Recently his mom has presented him n points lying on the line OX. Now Petya is wondering in how many ways he can choose three distinct points so that the distance between the two farthest of them doesn't exceed d.
... | output | 1 | 83,699 | 14 | 167,399 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Alexandra has a paper strip with n numbers on it. Let's call them ai from left to right.
Now Alexandra wants to split it into some pieces (possibly 1). For each piece of strip, it must satisfy:
* Each piece should contain at least l numb... | instruction | 0 | 83,780 | 14 | 167,560 |
Tags: binary search, data structures, dp, two pointers
Correct Solution:
```
def split(a,n,s,l):
pieces = []
i = 1
tmpmin = a[0]
tmpmax = a[0]
tmppc = [a[0]]
while i<n:
if abs(a[i]-tmpmin)<=s and abs(a[i]-tmpmax)<=s:
tmppc.append(a[i])
if a[i]<tmpmin: tmpmin=a[i... | output | 1 | 83,780 | 14 | 167,561 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Fox Ciel is participating in a party in Prime Kingdom. There are n foxes there (include Fox Ciel). The i-th fox is ai years old.
They will have dinner around some round tables. You want to distribute foxes such that:
1. Each fox is sitti... | instruction | 0 | 83,784 | 14 | 167,568 |
Tags: flows
Correct Solution:
```
from collections import deque
class Dinic():
def __init__(self, listEdge, s, t):
self.s = s
self.t = t
self.graph = {}
self.maxCap = 1000000
# dict cΓ‘c node lΓ’n cαΊn
# e[0]: from, e[1]: to, e[2]: dung luong
fo... | output | 1 | 83,784 | 14 | 167,569 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Fox Ciel is participating in a party in Prime Kingdom. There are n foxes there (include Fox Ciel). The i-th fox is ai years old.
They will have dinner around some round tables. You want to distribute foxes such that:
1. Each fox is sitti... | instruction | 0 | 83,785 | 14 | 167,570 |
Tags: flows
Correct Solution:
```
N = int(input())
L = list(map(int, input().split(' ')))
def isPrime(x) :
for i in range(2, int(x**0.5)+2) :
if x % i == 0 : return False
return True
odd = []
even = []
for i in range(N) :
if L[i]%2 == 0 :
even.append(i)
else :
odd.append(i)
if... | output | 1 | 83,785 | 14 | 167,571 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Fox Ciel is participating in a party in Prime Kingdom. There are n foxes there (include Fox Ciel). The i-th fox is ai years old.
They will have dinner around some round tables. You want to distribute foxes such that:
1. Each fox is sitti... | instruction | 0 | 83,786 | 14 | 167,572 |
Tags: flows
Correct Solution:
```
#E
def main():
sieve = [False, True] * 10001
for i in range(3, 140, 2):
if sieve[i]:
j, k = i * 2, i * i
le = (20001 - k) // j + 1
sieve[k::j] = [False] * le
n = int(input())
aa = list(map(int, input().split()))
pp = [-1] ... | output | 1 | 83,786 | 14 | 167,573 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Fox Ciel is participating in a party in Prime Kingdom. There are n foxes there (include Fox Ciel). The i-th fox is ai years old.
They will have dinner around some round tables. You want to distribute foxes such that:
1. Each fox is sitti... | instruction | 0 | 83,787 | 14 | 167,574 |
Tags: flows
Correct Solution:
```
import math
def ip(x):
for i in range(2,1 + int(math.sqrt(x))):
if not x % i:
return False
return True
def add(x, y, z):
cap[x][y] = z
def send(x, flow):
if x == n + 1:
return flow
if vis[x]:
return 0
vis[x] = 1
ret = 0
... | output | 1 | 83,787 | 14 | 167,575 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Fox Ciel is participating in a party in Prime Kingdom. There are n foxes there (include Fox Ciel). The i-th fox is ai years old.
They will have dinner around some round tables. You want to distribute foxes such that:
1. Each fox is sitti... | instruction | 0 | 83,788 | 14 | 167,576 |
Tags: flows
Correct Solution:
```
def main():
sieve = [False, True] * 10001
for i in range(3, 140, 2):
if sieve[i]:
j, k = i * 2, i * i
le = (20001 - k) // j + 1
sieve[k::j] = [False] * le
n = int(input())
aa = list(map(int, input().split()))
pp = [-1] * ... | output | 1 | 83,788 | 14 | 167,577 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Fox Ciel is participating in a party in Prime Kingdom. There are n foxes there (include Fox Ciel). The i-th fox is ai years old.
They will have dinner around some round tables. You want to distribute foxes such that:
1. Each fox is sitti... | instruction | 0 | 83,789 | 14 | 167,578 |
Tags: flows
Correct Solution:
```
def main():
sieve = [False, True] * 10001
for i in range(3, 140, 2):
if sieve[i]:
j, k = i * 2, i * i
le = (20001 - k) // j + 1
sieve[k::j] = [False] * le
n = int(input())
aa = list(map(int, input().split()))
pp = [-1] * ... | output | 1 | 83,789 | 14 | 167,579 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Fox Ciel is participating in a party in Prime Kingdom. There are n foxes there (include Fox Ciel). The i-th fox is ai years old.
They will have dinner around some round tables. You want to dist... | instruction | 0 | 83,790 | 14 | 167,580 |
No | output | 1 | 83,790 | 14 | 167,581 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Fox Ciel is participating in a party in Prime Kingdom. There are n foxes there (include Fox Ciel). The i-th fox is ai years old.
They will have dinner around some round tables. You want to dist... | instruction | 0 | 83,791 | 14 | 167,582 |
No | output | 1 | 83,791 | 14 | 167,583 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.