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.
Mad scientist Mike entertains himself by arranging rows of dominoes. He doesn't need dominoes, though: he uses rectangular magnets instead. Each magnet has two poles, positive (a "plus") and negative (a "minus"). If two magnets are put toget... | instruction | 0 | 17,133 | 14 | 34,266 |
Tags: implementation
Correct Solution:
```
c = 1
for i in range(int(input())):
if i == 0 :
a = input()
else:
b = input()
c = c + (1 if a != b else 0)
a = b
print(c)
``` | output | 1 | 17,133 | 14 | 34,267 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Mad scientist Mike entertains himself by arranging rows of dominoes. He doesn't need dominoes, though: he uses rectangular magnets instead. Each magnet has two poles, positive (a "plus") and negative (a "minus"). If two magnets are put toget... | instruction | 0 | 17,134 | 14 | 34,268 |
Tags: implementation
Correct Solution:
```
numberMagnets = int(input())
groups = 1
if numberMagnets == 1:
print(1)
else:
lastMag = str(input())
for _ in range(numberMagnets-1):
currMag = str(input())
if currMag != lastMag:
groups += 1
lastMag = currMag
prin... | output | 1 | 17,134 | 14 | 34,269 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Mad scientist Mike entertains himself by arranging rows of dominoes. He doesn't need dominoes, though: he uses rectangular magnets instead. Each magnet has two poles, positive (a "plus") and neg... | instruction | 0 | 17,137 | 14 | 34,274 |
Yes | output | 1 | 17,137 | 14 | 34,275 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Mad scientist Mike entertains himself by arranging rows of dominoes. He doesn't need dominoes, though: he uses rectangular magnets instead. Each magnet has two poles, positive (a "plus") and neg... | instruction | 0 | 17,138 | 14 | 34,276 |
Yes | output | 1 | 17,138 | 14 | 34,277 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Mad scientist Mike entertains himself by arranging rows of dominoes. He doesn't need dominoes, though: he uses rectangular magnets instead. Each magnet has two poles, positive (a "plus") and neg... | instruction | 0 | 17,139 | 14 | 34,278 |
No | output | 1 | 17,139 | 14 | 34,279 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Mad scientist Mike entertains himself by arranging rows of dominoes. He doesn't need dominoes, though: he uses rectangular magnets instead. Each magnet has two poles, positive (a "plus") and neg... | instruction | 0 | 17,141 | 14 | 34,282 |
No | output | 1 | 17,141 | 14 | 34,283 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Mad scientist Mike entertains himself by arranging rows of dominoes. He doesn't need dominoes, though: he uses rectangular magnets instead. Each magnet has two poles, positive (a "plus") and neg... | instruction | 0 | 17,142 | 14 | 34,284 |
No | output | 1 | 17,142 | 14 | 34,285 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
On a cold winter evening our hero Vasya stood in a railway queue to buy a ticket for Codeforces championship final. As it usually happens, the cashier said he was going to be away for 5 minutes ... | instruction | 0 | 17,153 | 14 | 34,306 |
No | output | 1 | 17,153 | 14 | 34,307 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
On a cold winter evening our hero Vasya stood in a railway queue to buy a ticket for Codeforces championship final. As it usually happens, the cashier said he was going to be away for 5 minutes ... | instruction | 0 | 17,154 | 14 | 34,308 |
No | output | 1 | 17,154 | 14 | 34,309 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
On a cold winter evening our hero Vasya stood in a railway queue to buy a ticket for Codeforces championship final. As it usually happens, the cashier said he was going to be away for 5 minutes ... | instruction | 0 | 17,155 | 14 | 34,310 |
No | output | 1 | 17,155 | 14 | 34,311 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
On a cold winter evening our hero Vasya stood in a railway queue to buy a ticket for Codeforces championship final. As it usually happens, the cashier said he was going to be away for 5 minutes ... | instruction | 0 | 17,156 | 14 | 34,312 |
No | output | 1 | 17,156 | 14 | 34,313 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Pasha decided to invite his friends to a tea party. For that occasion, he has a large teapot with the capacity of w milliliters and 2n tea cups, each cup is for one of Pasha's friends. The i-th cup can hold at most ai milliliters of water.
... | instruction | 0 | 17,221 | 14 | 34,442 |
Tags: constructive algorithms, implementation, math, sortings
Correct Solution:
```
n, w = map(int, input().split())
a = sorted(list(map(int, input().split())))
print(min(min(a[n]/2, a[0])*3*n, w))
``` | output | 1 | 17,221 | 14 | 34,443 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Pasha decided to invite his friends to a tea party. For that occasion, he has a large teapot with the capacity of w milliliters and 2n tea cups, each cup is for one of Pasha's friends. The i-th cup can hold at most ai milliliters of water.
... | instruction | 0 | 17,222 | 14 | 34,444 |
Tags: constructive algorithms, implementation, math, sortings
Correct Solution:
```
friends_and_teapotsize = list(map(int, list(input().split())))
cup_size = list(map(int, list(input().split())))
total_boys = friends_and_teapotsize[0]
total_teapot = friends_and_teapotsize[1]
cup_size.sort(reverse=False)
smallest_girl_... | output | 1 | 17,222 | 14 | 34,445 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Pasha decided to invite his friends to a tea party. For that occasion, he has a large teapot with the capacity of w milliliters and 2n tea cups, each cup is for one of Pasha's friends. The i-th cup can hold at most ai milliliters of water.
... | instruction | 0 | 17,223 | 14 | 34,446 |
Tags: constructive algorithms, implementation, math, sortings
Correct Solution:
```
n, w = map(int, input().split(" "))
l = list(map(int, input().split(" ")))
l = sorted(l)
if l[0]*2 >= l[int(len(l)/2)]:
if l[int(len(l)/2)] >= w/3*2/n:
print(w)
else:
print(l[int(len(l)/2)]/2*n+l[int(len(l)/2)]*... | output | 1 | 17,223 | 14 | 34,447 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Pasha decided to invite his friends to a tea party. For that occasion, he has a large teapot with the capacity of w milliliters and 2n tea cups, each cup is for one of Pasha's friends. The i-th cup can hold at most ai milliliters of water.
... | instruction | 0 | 17,224 | 14 | 34,448 |
Tags: constructive algorithms, implementation, math, sortings
Correct Solution:
```
n, w = map(int ,input().split())
read = list(map(int, input().split()))
read.sort(reverse = True)
c = min(read[-1], read[n - 1]/2)
print(min(w, c * 3 * n))
``` | output | 1 | 17,224 | 14 | 34,449 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Pasha decided to invite his friends to a tea party. For that occasion, he has a large teapot with the capacity of w milliliters and 2n tea cups, each cup is for one of Pasha's friends. The i-th cup can hold at most ai milliliters of water.
... | instruction | 0 | 17,225 | 14 | 34,450 |
Tags: constructive algorithms, implementation, math, sortings
Correct Solution:
```
n, w = map(int, input().split())
t1 = w / (3 * n)
a = list(map(int, input().split()))
a.sort()
a1 = a[n]
a2 = a[0]
if a1 / 2 <= a2:
t = a1 / 2
else:
t = a2
if t < t1:
print(3 * n * t)
else:
print(w)
``` | output | 1 | 17,225 | 14 | 34,451 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Pasha decided to invite his friends to a tea party. For that occasion, he has a large teapot with the capacity of w milliliters and 2n tea cups, each cup is for one of Pasha's friends. The i-th cup can hold at most ai milliliters of water.
... | instruction | 0 | 17,226 | 14 | 34,452 |
Tags: constructive algorithms, implementation, math, sortings
Correct Solution:
```
n, w = [int(i) for i in input().split()]
capacity = [int(i) for i in input().split()]
capacity.sort(reverse=True)
result = min(capacity[(2*n) - 1] * 3 * n, capacity[n-1] * 3 / 2 * n, w)
print(result)
``` | output | 1 | 17,226 | 14 | 34,453 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Pasha decided to invite his friends to a tea party. For that occasion, he has a large teapot with the capacity of w milliliters and 2n tea cups, each cup is for one of Pasha's friends. The i-th cup can hold at most ai milliliters of water.
... | instruction | 0 | 17,227 | 14 | 34,454 |
Tags: constructive algorithms, implementation, math, sortings
Correct Solution:
```
n, w = (int(i) for i in input().split())
tea = sorted(int(i) for i in input().split())
smallest = min(tea[0], tea[n]/2)
print(min(smallest*3*n, w))
``` | output | 1 | 17,227 | 14 | 34,455 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Pasha decided to invite his friends to a tea party. For that occasion, he has a large teapot with the capacity of w milliliters and 2n tea cups, each cup is for one of Pasha's friends. The i-th cup can hold at most ai milliliters of water.
... | instruction | 0 | 17,228 | 14 | 34,456 |
Tags: constructive algorithms, implementation, math, sortings
Correct Solution:
```
n, w = map(int, input().split())
a = sorted(list(map(int, input().split())))
print(min(3 * n * a[0], 1.5 * n * a[n], w))
``` | output | 1 | 17,228 | 14 | 34,457 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Pasha decided to invite his friends to a tea party. For that occasion, he has a large teapot with the capacity of w milliliters and 2n tea cups, each cup is for one of Pasha's friends. The i-th ... | instruction | 0 | 17,231 | 14 | 34,462 |
Yes | output | 1 | 17,231 | 14 | 34,463 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Pasha decided to invite his friends to a tea party. For that occasion, he has a large teapot with the capacity of w milliliters and 2n tea cups, each cup is for one of Pasha's friends. The i-th ... | instruction | 0 | 17,232 | 14 | 34,464 |
Yes | output | 1 | 17,232 | 14 | 34,465 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Pasha decided to invite his friends to a tea party. For that occasion, he has a large teapot with the capacity of w milliliters and 2n tea cups, each cup is for one of Pasha's friends. The i-th ... | instruction | 0 | 17,234 | 14 | 34,468 |
No | output | 1 | 17,234 | 14 | 34,469 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Just to remind, girls in Arpa's land are really nice.
Mehrdad wants to invite some Hoses to the palace for a dancing party. Each Hos has some weight wi and some beauty bi. Also each Hos may have some friends. Hoses are divided in some frien... | instruction | 0 | 17,298 | 14 | 34,596 |
Tags: dfs and similar, dp, dsu
Correct Solution:
```
from collections import defaultdict
class UnionFind():
def __init__(self, n):
self.n = n
self.parents = [-1] * n
def find(self, x):
if self.parents[x] < 0:
return x
else:
self.parents[x] = self.find(se... | output | 1 | 17,298 | 14 | 34,597 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Just to remind, girls in Arpa's land are really nice.
Mehrdad wants to invite some Hoses to the palace for a dancing party. Each Hos has some weight wi and some beauty bi. Also each Hos may have some friends. Hoses are divided in some frien... | instruction | 0 | 17,299 | 14 | 34,598 |
Tags: dfs and similar, dp, dsu
Correct Solution:
```
f = lambda: map(int, input().split())
n, m, w = f()
wb = [(0, 0)] + list(zip(f(), f()))
t = list(range(n + 1))
def g(x):
if x == t[x]: return x
t[x] = g(t[x])
return t[x]
for i in range(m):
x, y = f()
x, y = g(x), g(y)
if x != y: t[y] = x
... | output | 1 | 17,299 | 14 | 34,599 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Just to remind, girls in Arpa's land are really nice.
Mehrdad wants to invite some Hoses to the palace for a dancing party. Each Hos has some weight wi and some beauty bi. Also each Hos may have some friends. Hoses are divided in some frien... | instruction | 0 | 17,300 | 14 | 34,600 |
Tags: dfs and similar, dp, dsu
Correct Solution:
```
R = lambda: map(int, input().split())
n, m, w = R()
ws = list(R())
bs = list(R())
anc = [-1] * n
def get(x):
if anc[x] < 0:
return x
anc[x] = get(anc[x])
return anc[x]
def join(x1, x2):
x1, x2 = get(x1), get(x2)
if x1 != x2:
anc[... | output | 1 | 17,300 | 14 | 34,601 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Just to remind, girls in Arpa's land are really nice.
Mehrdad wants to invite some Hoses to the palace for a dancing party. Each Hos has some weight wi and some beauty bi. Also each Hos may have some friends. Hoses are divided in some frien... | instruction | 0 | 17,301 | 14 | 34,602 |
Tags: dfs and similar, dp, dsu
Correct Solution:
```
def ler():
return [int(x) for x in input().split()]
def dfs(u, adj, visited, s, Pesos, Belezas):
visited[u] = True
total_p = Pesos[u]
total_b = Belezas[u]
s.append(u)
for v in adj[u]:
if not visited[v]:
w, b = dfs(v, adj... | output | 1 | 17,301 | 14 | 34,603 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Just to remind, girls in Arpa's land are really nice.
Mehrdad wants to invite some Hoses to the palace for a dancing party. Each Hos has some weight wi and some beauty bi. Also each Hos may have some friends. Hoses are divided in some frien... | instruction | 0 | 17,302 | 14 | 34,604 |
Tags: dfs and similar, dp, dsu
Correct Solution:
```
f = lambda: map(int, input().split())
n, m, w = f()
wb = [(0, 0)] + list(zip(f(), f()))
t = list(range(n + 1))
def g(x):
if x == t[x]: return x
t[x] = g(t[x])
return t[x]
for i in range(m):
x, y = f()
x, y = g(x), g(y)
if x ... | output | 1 | 17,302 | 14 | 34,605 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Just to remind, girls in Arpa's land are really nice.
Mehrdad wants to invite some Hoses to the palace for a dancing party. Each Hos has some weight wi and some beauty bi. Also each Hos may have some friends. Hoses are divided in some frien... | instruction | 0 | 17,303 | 14 | 34,606 |
Tags: dfs and similar, dp, dsu
Correct Solution:
```
hoses, pairs, total_weight = map(int, input().split())
weight_arr = list(map(int, input().split()))
beauty_arr = list(map(int, input().split()))
arr = [-1] * hoses
def get(hose):
if arr[hose] < 0:
return hose
arr[hose] = get(arr[hose])
return ar... | output | 1 | 17,303 | 14 | 34,607 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Just to remind, girls in Arpa's land are really nice.
Mehrdad wants to invite some Hoses to the palace for a dancing party. Each Hos has some weight wi and some beauty bi. Also each Hos may have some friends. Hoses are divided in some frien... | instruction | 0 | 17,304 | 14 | 34,608 |
Tags: dfs and similar, dp, dsu
Correct Solution:
```
from collections import defaultdict
def read(): return list(map(int, input().split(' ')))
def DSU(count):
vs = list(range(count))
ss = [1] * count
def get(i):
if vs[i] == i:
return i
else:
vs[i] = get(vs[i])
... | output | 1 | 17,304 | 14 | 34,609 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Just to remind, girls in Arpa's land are really nice.
Mehrdad wants to invite some Hoses to the palace for a dancing party. Each Hos has some weight wi and some beauty bi. Also each Hos may have some friends. Hoses are divided in some frien... | instruction | 0 | 17,305 | 14 | 34,610 |
Tags: dfs and similar, dp, dsu
Correct Solution:
```
from sys import stdin, stdout
from collections import defaultdict as dd
read, write = stdin.readline, stdout.write
class DisjointSetUnion:
def __init__(self, n):
self.parent = list(range(n))
self.size = [1] * n
self.num_sets = n
def ... | output | 1 | 17,305 | 14 | 34,611 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Just to remind, girls in Arpa's land are really nice.
Mehrdad wants to invite some Hoses to the palace for a dancing party. Each Hos has some weight wi and some beauty bi. Also each Hos may hav... | instruction | 0 | 17,306 | 14 | 34,612 |
Yes | output | 1 | 17,306 | 14 | 34,613 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Just to remind, girls in Arpa's land are really nice.
Mehrdad wants to invite some Hoses to the palace for a dancing party. Each Hos has some weight wi and some beauty bi. Also each Hos may hav... | instruction | 0 | 17,307 | 14 | 34,614 |
Yes | output | 1 | 17,307 | 14 | 34,615 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Just to remind, girls in Arpa's land are really nice.
Mehrdad wants to invite some Hoses to the palace for a dancing party. Each Hos has some weight wi and some beauty bi. Also each Hos may hav... | instruction | 0 | 17,308 | 14 | 34,616 |
Yes | output | 1 | 17,308 | 14 | 34,617 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Just to remind, girls in Arpa's land are really nice.
Mehrdad wants to invite some Hoses to the palace for a dancing party. Each Hos has some weight wi and some beauty bi. Also each Hos may hav... | instruction | 0 | 17,309 | 14 | 34,618 |
Yes | output | 1 | 17,309 | 14 | 34,619 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Just to remind, girls in Arpa's land are really nice.
Mehrdad wants to invite some Hoses to the palace for a dancing party. Each Hos has some weight wi and some beauty bi. Also each Hos may hav... | instruction | 0 | 17,310 | 14 | 34,620 |
No | output | 1 | 17,310 | 14 | 34,621 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Just to remind, girls in Arpa's land are really nice.
Mehrdad wants to invite some Hoses to the palace for a dancing party. Each Hos has some weight wi and some beauty bi. Also each Hos may hav... | instruction | 0 | 17,311 | 14 | 34,622 |
No | output | 1 | 17,311 | 14 | 34,623 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Just to remind, girls in Arpa's land are really nice.
Mehrdad wants to invite some Hoses to the palace for a dancing party. Each Hos has some weight wi and some beauty bi. Also each Hos may hav... | instruction | 0 | 17,312 | 14 | 34,624 |
No | output | 1 | 17,312 | 14 | 34,625 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Just to remind, girls in Arpa's land are really nice.
Mehrdad wants to invite some Hoses to the palace for a dancing party. Each Hos has some weight wi and some beauty bi. Also each Hos may hav... | instruction | 0 | 17,313 | 14 | 34,626 |
No | output | 1 | 17,313 | 14 | 34,627 |
Provide tags and a correct Python 3 solution for this coding contest problem.
There is an automatic door at the entrance of a factory. The door works in the following way:
* when one or several people come to the door and it is closed, the door immediately opens automatically and all people immediately come inside,... | instruction | 0 | 17,368 | 14 | 34,736 |
Tags: implementation
Correct Solution:
```
BigNum = 10 ** 20
n, m, a, d = map(int, input().split(' '))
ts = [0] + list(map(int, input().split(' '))) + [BigNum]
def empsInRange(l, r):
em1 = l // a + 1
em2 = r // a
return (em1, min(em2, n))
empDoorGroup = d // a + 1
def moveEmps(emps, last):
em1, em2 ... | output | 1 | 17,368 | 14 | 34,737 |
Provide tags and a correct Python 3 solution for this coding contest problem.
There is an automatic door at the entrance of a factory. The door works in the following way:
* when one or several people come to the door and it is closed, the door immediately opens automatically and all people immediately come inside,... | instruction | 0 | 17,369 | 14 | 34,738 |
Tags: implementation
Correct Solution:
```
def solve():
n1, m, a, d = list(map(int, input().split()))
t = list(map(int, input().split()))
from bisect import insort
from math import floor
insort(t, a * n1)
pred = 0
k = 0
kpred = 0
n = 0
step = d // a + 1
sol = 0
fl = 0
... | output | 1 | 17,369 | 14 | 34,739 |
Provide tags and a correct Python 3 solution for this coding contest problem.
There is an automatic door at the entrance of a factory. The door works in the following way:
* when one or several people come to the door and it is closed, the door immediately opens automatically and all people immediately come inside,... | instruction | 0 | 17,370 | 14 | 34,740 |
Tags: implementation
Correct Solution:
```
n1,m,a,d=list(map(int,input().split()))
t=list(map(int,input().split()))
from bisect import *
from math import *
insort(t,a*n1)
pred=0
k=0
kpred=0
n=0
step=d//a+1
sol=0
fl=0
for i in t:
if (i > pred):
if fl == 0:
n=(i-pred+(pred%a))//a
if n!... | output | 1 | 17,370 | 14 | 34,741 |
Provide tags and a correct Python 3 solution for this coding contest problem.
There is an automatic door at the entrance of a factory. The door works in the following way:
* when one or several people come to the door and it is closed, the door immediately opens automatically and all people immediately come inside,... | instruction | 0 | 17,371 | 14 | 34,742 |
Tags: implementation
Correct Solution:
```
def solve():
n1, m, a, d = list(map(int, input().split()))
t = list(map(int, input().split()))
from bisect import insort
from math import floor
insort(t, a * n1)
pred = 0
k = 0
kpred = 0
n = 0
step = d // a + 1
sol = 0
... | output | 1 | 17,371 | 14 | 34,743 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
There is an automatic door at the entrance of a factory. The door works in the following way:
* when one or several people come to the door and it is closed, the door immediately opens automa... | instruction | 0 | 17,373 | 14 | 34,746 |
No | output | 1 | 17,373 | 14 | 34,747 |
Provide tags and a correct Python 3 solution for this coding contest problem.
The Dogeforces company has k employees. Each employee, except for lower-level employees, has at least 2 subordinates. Lower-level employees have no subordinates. Each employee, except for the head of the company, has exactly one direct super... | instruction | 0 | 17,885 | 14 | 35,770 |
Tags: constructive algorithms, data structures, dfs and similar, divide and conquer, dsu, greedy, sortings, trees
Correct Solution:
```
import io
import os
input = io.BytesIO(os.read(0, os.fstat(0).st_size)).readline
class DSU:
def __init__(self, n):
self.parent = list(range(n))
def add(self)... | output | 1 | 17,885 | 14 | 35,771 |
Provide tags and a correct Python 3 solution for this coding contest problem.
The Dogeforces company has k employees. Each employee, except for lower-level employees, has at least 2 subordinates. Lower-level employees have no subordinates. Each employee, except for the head of the company, has exactly one direct super... | instruction | 0 | 17,886 | 14 | 35,772 |
Tags: constructive algorithms, data structures, dfs and similar, divide and conquer, dsu, greedy, sortings, trees
Correct Solution:
```
import io
import os
from collections import Counter, defaultdict, deque
def solve(N, A):
parent = [-1] * N
children = [[]] * N
costs = [A[i][i] for i in range(N)]
l... | output | 1 | 17,886 | 14 | 35,773 |
Provide tags and a correct Python 3 solution for this coding contest problem.
The Dogeforces company has k employees. Each employee, except for lower-level employees, has at least 2 subordinates. Lower-level employees have no subordinates. Each employee, except for the head of the company, has exactly one direct super... | instruction | 0 | 17,887 | 14 | 35,774 |
Tags: constructive algorithms, data structures, dfs and similar, divide and conquer, dsu, greedy, sortings, trees
Correct Solution:
```
class node:
def __init__(self,id_no,val):
self.id_no = id_no
self.val = val
self.child = []
import sys,functools,collections,bisect,math,heapq
input = sys.... | output | 1 | 17,887 | 14 | 35,775 |
Provide tags and a correct Python 3 solution for this coding contest problem.
The Dogeforces company has k employees. Each employee, except for lower-level employees, has at least 2 subordinates. Lower-level employees have no subordinates. Each employee, except for the head of the company, has exactly one direct super... | instruction | 0 | 17,888 | 14 | 35,776 |
Tags: constructive algorithms, data structures, dfs and similar, divide and conquer, dsu, greedy, sortings, trees
Correct Solution:
```
import bisect
nodes = []
class Node:
def __init__(self, idx, salary):
self.idx = idx
self.salary = salary
self.children = []
nodes.append(self)
d... | output | 1 | 17,888 | 14 | 35,777 |
Provide tags and a correct Python 3 solution for this coding contest problem.
The Dogeforces company has k employees. Each employee, except for lower-level employees, has at least 2 subordinates. Lower-level employees have no subordinates. Each employee, except for the head of the company, has exactly one direct super... | instruction | 0 | 17,889 | 14 | 35,778 |
Tags: constructive algorithms, data structures, dfs and similar, divide and conquer, dsu, greedy, sortings, trees
Correct Solution:
```
class UnionFind():
def __init__(self, n):
self.n = n
self.parents = [-1] * n
def find(self, x):
if self.parents[x] < 0:
return x
el... | output | 1 | 17,889 | 14 | 35,779 |
Provide tags and a correct Python 3 solution for this coding contest problem.
The Dogeforces company has k employees. Each employee, except for lower-level employees, has at least 2 subordinates. Lower-level employees have no subordinates. Each employee, except for the head of the company, has exactly one direct super... | instruction | 0 | 17,890 | 14 | 35,780 |
Tags: constructive algorithms, data structures, dfs and similar, divide and conquer, dsu, greedy, sortings, trees
Correct Solution:
```
n = int(input())
a = [list(map(int, input().split())) for i in range(n)]
val = [-1]*(10**6)
par = [-1]*(10**6)
for i in range(n):
val[i] = a[i][i]
edgetank = []
for i in range(n... | output | 1 | 17,890 | 14 | 35,781 |
Provide tags and a correct Python 3 solution for this coding contest problem.
The Dogeforces company has k employees. Each employee, except for lower-level employees, has at least 2 subordinates. Lower-level employees have no subordinates. Each employee, except for the head of the company, has exactly one direct super... | instruction | 0 | 17,891 | 14 | 35,782 |
Tags: constructive algorithms, data structures, dfs and similar, divide and conquer, dsu, greedy, sortings, trees
Correct Solution:
```
import sys,math,itertools
from collections import Counter,deque,defaultdict
from bisect import bisect_left,bisect_right
from heapq import heappop,heappush,heapify, nlargest
from copy ... | output | 1 | 17,891 | 14 | 35,783 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.