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.
The Hedgehog likes to give presents to his friend, but no less he likes to receive them.
Having received another present today, the Hedgehog suddenly understood that he has no place to put it as there was no room left on the special shelf i... | instruction | 0 | 107,379 | 14 | 214,758 |
Tags: implementation
Correct Solution:
```
a,b=map(int,input().split())
z=list(map(int,input().split()[1:]))
ans,t=0,1
for i in range(1,a+1):
if i in z:ans+=1;t=1
elif t==b:ans+=1;t=1
else:t+=1
print(ans)
``` | output | 1 | 107,379 | 14 | 214,759 |
Provide tags and a correct Python 3 solution for this coding contest problem.
The Hedgehog likes to give presents to his friend, but no less he likes to receive them.
Having received another present today, the Hedgehog suddenly understood that he has no place to put it as there was no room left on the special shelf i... | instruction | 0 | 107,380 | 14 | 214,760 |
Tags: implementation
Correct Solution:
```
class CodeforcesTask54ASolution:
def __init__(self):
self.result = ''
self.n_k = []
self.holidays = []
def read_input(self):
self.n_k = [int(x) for x in input().split(" ")]
self.holidays = [int(x) for x in input().split(" ")]
... | output | 1 | 107,380 | 14 | 214,761 |
Provide tags and a correct Python 3 solution for this coding contest problem.
The Hedgehog likes to give presents to his friend, but no less he likes to receive them.
Having received another present today, the Hedgehog suddenly understood that he has no place to put it as there was no room left on the special shelf i... | instruction | 0 | 107,381 | 14 | 214,762 |
Tags: implementation
Correct Solution:
```
n, k = map(int, input().split())
h, d, hi, v = list(map(int, input().split())) + [n + 1], 0, 1, -1
while d <= n:
v += 1
if h[hi] <= d + k:
d = h[hi]
hi += 1
else:
d += k
print(v)
``` | output | 1 | 107,381 | 14 | 214,763 |
Provide tags and a correct Python 3 solution for this coding contest problem.
The Hedgehog likes to give presents to his friend, but no less he likes to receive them.
Having received another present today, the Hedgehog suddenly understood that he has no place to put it as there was no room left on the special shelf i... | instruction | 0 | 107,382 | 14 | 214,764 |
Tags: implementation
Correct Solution:
```
entrada1 = input().split()
n, k = int(entrada1[0]), int(entrada1[1])
entrada2 = input().split()
c = int(entrada2[0])
festivos = []
for i in range(c):
festivos.append(int(entrada2[i+1]))
regalos = 0
k_esimo = 0
f = 0
i = 1
while i<=n:
if f<c and i == festivos[f]:
... | output | 1 | 107,382 | 14 | 214,765 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
The Hedgehog likes to give presents to his friend, but no less he likes to receive them.
Having received another present today, the Hedgehog suddenly understood that he has no place to put it a... | instruction | 0 | 107,383 | 14 | 214,766 |
Yes | output | 1 | 107,383 | 14 | 214,767 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
The Hedgehog likes to give presents to his friend, but no less he likes to receive them.
Having received another present today, the Hedgehog suddenly understood that he has no place to put it a... | instruction | 0 | 107,384 | 14 | 214,768 |
Yes | output | 1 | 107,384 | 14 | 214,769 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
The Hedgehog likes to give presents to his friend, but no less he likes to receive them.
Having received another present today, the Hedgehog suddenly understood that he has no place to put it a... | instruction | 0 | 107,385 | 14 | 214,770 |
Yes | output | 1 | 107,385 | 14 | 214,771 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
The Hedgehog likes to give presents to his friend, but no less he likes to receive them.
Having received another present today, the Hedgehog suddenly understood that he has no place to put it a... | instruction | 0 | 107,386 | 14 | 214,772 |
Yes | output | 1 | 107,386 | 14 | 214,773 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
The Hedgehog likes to give presents to his friend, but no less he likes to receive them.
Having received another present today, the Hedgehog suddenly understood that he has no place to put it a... | instruction | 0 | 107,387 | 14 | 214,774 |
No | output | 1 | 107,387 | 14 | 214,775 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
The Hedgehog likes to give presents to his friend, but no less he likes to receive them.
Having received another present today, the Hedgehog suddenly understood that he has no place to put it a... | instruction | 0 | 107,388 | 14 | 214,776 |
No | output | 1 | 107,388 | 14 | 214,777 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
The Hedgehog likes to give presents to his friend, but no less he likes to receive them.
Having received another present today, the Hedgehog suddenly understood that he has no place to put it a... | instruction | 0 | 107,389 | 14 | 214,778 |
No | output | 1 | 107,389 | 14 | 214,779 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
The Hedgehog likes to give presents to his friend, but no less he likes to receive them.
Having received another present today, the Hedgehog suddenly understood that he has no place to put it a... | instruction | 0 | 107,390 | 14 | 214,780 |
No | output | 1 | 107,390 | 14 | 214,781 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Little Artem got n stones on his birthday and now wants to give some of them to Masha. He knows that Masha cares more about the fact of receiving the present, rather than the value of that present, so he wants to give her stones as many time... | instruction | 0 | 107,439 | 14 | 214,878 |
Tags: math
Correct Solution:
```
n=int(input())
m=n%3
z=n//3
if m==0:
print(z*2)
else:
print(z*2+1)
``` | output | 1 | 107,439 | 14 | 214,879 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Little Artem got n stones on his birthday and now wants to give some of them to Masha. He knows that Masha cares more about the fact of receiving the present, rather than the value of that present, so he wants to give her stones as many time... | instruction | 0 | 107,440 | 14 | 214,880 |
Tags: math
Correct Solution:
```
n=int(input())
c=n//3
c*=2
if n%3!=0:
c+=1
print(c)
``` | output | 1 | 107,440 | 14 | 214,881 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Little Artem got n stones on his birthday and now wants to give some of them to Masha. He knows that Masha cares more about the fact of receiving the present, rather than the value of that present, so he wants to give her stones as many time... | instruction | 0 | 107,441 | 14 | 214,882 |
Tags: math
Correct Solution:
```
n=int(input())
if n%3==0:
print(2*n//3)
else:
print(2*(n//3+1)-1)
``` | output | 1 | 107,441 | 14 | 214,883 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Little Artem got n stones on his birthday and now wants to give some of them to Masha. He knows that Masha cares more about the fact of receiving the present, rather than the value of that present, so he wants to give her stones as many time... | instruction | 0 | 107,442 | 14 | 214,884 |
Tags: math
Correct Solution:
```
n = int(input())
result = 2 * (n // 3)
if n % 3 != 0:
result += 1
print(result)
``` | output | 1 | 107,442 | 14 | 214,885 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Little Artem got n stones on his birthday and now wants to give some of them to Masha. He knows that Masha cares more about the fact of receiving the present, rather than the value of that present, so he wants to give her stones as many time... | instruction | 0 | 107,443 | 14 | 214,886 |
Tags: math
Correct Solution:
```
n=int(input())
print(n//3*2+(n%3>0))
``` | output | 1 | 107,443 | 14 | 214,887 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Little Artem got n stones on his birthday and now wants to give some of them to Masha. He knows that Masha cares more about the fact of receiving the present, rather than the value of that present, so he wants to give her stones as many time... | instruction | 0 | 107,444 | 14 | 214,888 |
Tags: math
Correct Solution:
```
n = int(input())
print(2 * (n // 3) + int(n % 3 != 0))
``` | output | 1 | 107,444 | 14 | 214,889 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Little Artem got n stones on his birthday and now wants to give some of them to Masha. He knows that Masha cares more about the fact of receiving the present, rather than the value of that present, so he wants to give her stones as many time... | instruction | 0 | 107,445 | 14 | 214,890 |
Tags: math
Correct Solution:
```
#rOkY
#FuCk
################################## kOpAl #####################################
t=int(input())
g=0
g=t//3
g=g*2
if(t%3>0):
g+=1
print(g)
``` | output | 1 | 107,445 | 14 | 214,891 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Little Artem got n stones on his birthday and now wants to give some of them to Masha. He knows that Masha cares more about the fact of receiving the present, rather than the value of that present, so he wants to give her stones as many time... | instruction | 0 | 107,446 | 14 | 214,892 |
Tags: math
Correct Solution:
```
n=int(input())
ans=(n//3)*2
if n%3 !=0:
ans += 1
print(ans)
``` | output | 1 | 107,446 | 14 | 214,893 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Little Artem got n stones on his birthday and now wants to give some of them to Masha. He knows that Masha cares more about the fact of receiving the present, rather than the value of that prese... | instruction | 0 | 107,447 | 14 | 214,894 |
Yes | output | 1 | 107,447 | 14 | 214,895 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Little Artem got n stones on his birthday and now wants to give some of them to Masha. He knows that Masha cares more about the fact of receiving the present, rather than the value of that prese... | instruction | 0 | 107,448 | 14 | 214,896 |
Yes | output | 1 | 107,448 | 14 | 214,897 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Little Artem got n stones on his birthday and now wants to give some of them to Masha. He knows that Masha cares more about the fact of receiving the present, rather than the value of that prese... | instruction | 0 | 107,449 | 14 | 214,898 |
Yes | output | 1 | 107,449 | 14 | 214,899 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Little Artem got n stones on his birthday and now wants to give some of them to Masha. He knows that Masha cares more about the fact of receiving the present, rather than the value of that prese... | instruction | 0 | 107,450 | 14 | 214,900 |
Yes | output | 1 | 107,450 | 14 | 214,901 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Little Artem got n stones on his birthday and now wants to give some of them to Masha. He knows that Masha cares more about the fact of receiving the present, rather than the value of that prese... | instruction | 0 | 107,451 | 14 | 214,902 |
No | output | 1 | 107,451 | 14 | 214,903 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Little Artem got n stones on his birthday and now wants to give some of them to Masha. He knows that Masha cares more about the fact of receiving the present, rather than the value of that prese... | instruction | 0 | 107,452 | 14 | 214,904 |
No | output | 1 | 107,452 | 14 | 214,905 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Little Artem got n stones on his birthday and now wants to give some of them to Masha. He knows that Masha cares more about the fact of receiving the present, rather than the value of that prese... | instruction | 0 | 107,453 | 14 | 214,906 |
No | output | 1 | 107,453 | 14 | 214,907 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Little Artem got n stones on his birthday and now wants to give some of them to Masha. He knows that Masha cares more about the fact of receiving the present, rather than the value of that prese... | instruction | 0 | 107,454 | 14 | 214,908 |
No | output | 1 | 107,454 | 14 | 214,909 |
Provide tags and a correct Python 3 solution for this coding contest problem.
In a small restaurant there are a tables for one person and b tables for two persons.
It it known that n groups of people come today, each consisting of one or two people.
If a group consist of one person, it is seated at a vacant one-se... | instruction | 0 | 107,515 | 14 | 215,030 |
Tags: implementation
Correct Solution:
```
if __name__ == "__main__":
n, c1, c2 = list(map(int, input().split()))
g = list(map(int, input().split()))
count = 0
deny = 0
for i in range(n):
if g[i] == 1:
if c1 > 0:
c1 -= 1
elif c1 <= 0 and c2 > 0:
... | output | 1 | 107,515 | 14 | 215,031 |
Provide tags and a correct Python 3 solution for this coding contest problem.
In a small restaurant there are a tables for one person and b tables for two persons.
It it known that n groups of people come today, each consisting of one or two people.
If a group consist of one person, it is seated at a vacant one-se... | instruction | 0 | 107,516 | 14 | 215,032 |
Tags: implementation
Correct Solution:
```
n,a,b=map(int,input().split())
l=list(map(int,input().split()))
ans=0
c=0
for i in range(n):
if l[i]==2:
if b==0:
ans+=2
else:
b-=1
else:
if a!=0:
a-=1
elif b!=0:
b-=1
c+=1
... | output | 1 | 107,516 | 14 | 215,033 |
Provide tags and a correct Python 3 solution for this coding contest problem.
In a small restaurant there are a tables for one person and b tables for two persons.
It it known that n groups of people come today, each consisting of one or two people.
If a group consist of one person, it is seated at a vacant one-se... | instruction | 0 | 107,517 | 14 | 215,034 |
Tags: implementation
Correct Solution:
```
n = input().split()
a = int(n[1])
b = int(n[2])
n = int(n[0])
t = [int(i) for i in input().split()]
lost = 0
bm = 2 * b
b2 = b
b1 = 0
for i in t:
if i == 1:
if a > 0:
a -= 1
else:
if bm > 0:
if b2 > 0:
... | output | 1 | 107,517 | 14 | 215,035 |
Provide tags and a correct Python 3 solution for this coding contest problem.
In a small restaurant there are a tables for one person and b tables for two persons.
It it known that n groups of people come today, each consisting of one or two people.
If a group consist of one person, it is seated at a vacant one-se... | instruction | 0 | 107,518 | 14 | 215,036 |
Tags: implementation
Correct Solution:
```
n, a, b = map(int, input().split())
t = list(map(int, input().split()))
ans = 0
cnta = 0
cntb1 = 0
cntb2 = 0
for ti in t:
if ti == 1:
if cnta < a:
cnta += 1
elif cntb1 + cntb2 < b:
cntb1 += 1
elif 0 < cntb1:
cntb... | output | 1 | 107,518 | 14 | 215,037 |
Provide tags and a correct Python 3 solution for this coding contest problem.
In a small restaurant there are a tables for one person and b tables for two persons.
It it known that n groups of people come today, each consisting of one or two people.
If a group consist of one person, it is seated at a vacant one-se... | instruction | 0 | 107,519 | 14 | 215,038 |
Tags: implementation
Correct Solution:
```
from sys import stdin, stdout
n, a, b = map(int, stdin.readline().split())
values = list(map(int, stdin.readline().split()))
cnt = 0
c = 0
for i in range(n):
if values[i] == 2:
if b:
b -= 1
else:
cnt += 2
else:
if a:
... | output | 1 | 107,519 | 14 | 215,039 |
Provide tags and a correct Python 3 solution for this coding contest problem.
In a small restaurant there are a tables for one person and b tables for two persons.
It it known that n groups of people come today, each consisting of one or two people.
If a group consist of one person, it is seated at a vacant one-se... | instruction | 0 | 107,520 | 14 | 215,040 |
Tags: implementation
Correct Solution:
```
primLinea=input().split()
iteraciones=int(primLinea[0])
indiv=int(primLinea[1])
par=int(primLinea[2])
parParaIndiv=0
personas=input().split()
negados=0
for i in range(0,iteraciones):
costumer=int(personas[i])
if costumer==1:
if indiv>0:
indiv-=1
... | output | 1 | 107,520 | 14 | 215,041 |
Provide tags and a correct Python 3 solution for this coding contest problem.
In a small restaurant there are a tables for one person and b tables for two persons.
It it known that n groups of people come today, each consisting of one or two people.
If a group consist of one person, it is seated at a vacant one-se... | instruction | 0 | 107,521 | 14 | 215,042 |
Tags: implementation
Correct Solution:
```
n, a, b = [int(nab) for nab in str(input()).split(' ')]
t = [int(ti) for ti in str(input()).split(' ')]
tables = {1: {0: a, 1: 0}, 2: {0: b, 1: 0, 2: 0}}
noservice = 0
for ti in t:
if (ti == 1):
if (tables[1][0] > 0):
tables[1][0] -= 1
tab... | output | 1 | 107,521 | 14 | 215,043 |
Provide tags and a correct Python 3 solution for this coding contest problem.
In a small restaurant there are a tables for one person and b tables for two persons.
It it known that n groups of people come today, each consisting of one or two people.
If a group consist of one person, it is seated at a vacant one-se... | instruction | 0 | 107,522 | 14 | 215,044 |
Tags: implementation
Correct Solution:
```
n, a, b = map(int, input().split())
str = input()
ls = [int(u) for u in str.split()]
#print(ls)
t=0
count=0
sum = 0
for u in ls:
sum += u
if u==1 and a>0:
a -=1
count += 1
elif u==1 and a==0 and t>0 and b==0:
t-=1
count += 1
elif... | output | 1 | 107,522 | 14 | 215,045 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
In a small restaurant there are a tables for one person and b tables for two persons.
It it known that n groups of people come today, each consisting of one or two people.
If a group consist... | instruction | 0 | 107,523 | 14 | 215,046 |
Yes | output | 1 | 107,523 | 14 | 215,047 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
In a small restaurant there are a tables for one person and b tables for two persons.
It it known that n groups of people come today, each consisting of one or two people.
If a group consist... | instruction | 0 | 107,524 | 14 | 215,048 |
Yes | output | 1 | 107,524 | 14 | 215,049 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
In a small restaurant there are a tables for one person and b tables for two persons.
It it known that n groups of people come today, each consisting of one or two people.
If a group consist... | instruction | 0 | 107,525 | 14 | 215,050 |
Yes | output | 1 | 107,525 | 14 | 215,051 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
In a small restaurant there are a tables for one person and b tables for two persons.
It it known that n groups of people come today, each consisting of one or two people.
If a group consist... | instruction | 0 | 107,526 | 14 | 215,052 |
Yes | output | 1 | 107,526 | 14 | 215,053 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
In a small restaurant there are a tables for one person and b tables for two persons.
It it known that n groups of people come today, each consisting of one or two people.
If a group consist... | instruction | 0 | 107,527 | 14 | 215,054 |
No | output | 1 | 107,527 | 14 | 215,055 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
In a small restaurant there are a tables for one person and b tables for two persons.
It it known that n groups of people come today, each consisting of one or two people.
If a group consist... | instruction | 0 | 107,528 | 14 | 215,056 |
No | output | 1 | 107,528 | 14 | 215,057 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
In a small restaurant there are a tables for one person and b tables for two persons.
It it known that n groups of people come today, each consisting of one or two people.
If a group consist... | instruction | 0 | 107,529 | 14 | 215,058 |
No | output | 1 | 107,529 | 14 | 215,059 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
In a small restaurant there are a tables for one person and b tables for two persons.
It it known that n groups of people come today, each consisting of one or two people.
If a group consist... | instruction | 0 | 107,530 | 14 | 215,060 |
No | output | 1 | 107,530 | 14 | 215,061 |
Provide tags and a correct Python 3 solution for this coding contest problem.
While Farmer John rebuilds his farm in an unfamiliar portion of Bovinia, Bessie is out trying some alternative jobs. In her new gig as a reporter, Bessie needs to know about programming competition results as quickly as possible. When she co... | instruction | 0 | 108,260 | 14 | 216,520 |
Tags: binary search, dp, graphs
Correct Solution:
```
# by the authority of GOD author: manhar singh sachdev #
import os,sys
from io import BytesIO,IOBase
def topsort(n,path,indeg):
ans = []
for i in range(n):
if not indeg[i]:
ans.append(i)
i = 0
if len(ans) > 1:
return 0... | output | 1 | 108,260 | 14 | 216,521 |
Provide tags and a correct Python 3 solution for this coding contest problem.
While Farmer John rebuilds his farm in an unfamiliar portion of Bovinia, Bessie is out trying some alternative jobs. In her new gig as a reporter, Bessie needs to know about programming competition results as quickly as possible. When she co... | instruction | 0 | 108,261 | 14 | 216,522 |
Tags: binary search, dp, graphs
Correct Solution:
```
from collections import defaultdict,deque
def bfs(q,n,mid):
g=defaultdict(list)
vis=[0]*(n)
for i in range(mid):
x,y=q[i]
g[x].append(y)
vis[y]+=1
q=deque()
for i in range(n):
if vis[i]==0:
q.append(i)
flag=True
cnt=0
while q and flag:
# print(... | output | 1 | 108,261 | 14 | 216,523 |
Provide tags and a correct Python 3 solution for this coding contest problem.
While Farmer John rebuilds his farm in an unfamiliar portion of Bovinia, Bessie is out trying some alternative jobs. In her new gig as a reporter, Bessie needs to know about programming competition results as quickly as possible. When she co... | instruction | 0 | 108,262 | 14 | 216,524 |
Tags: binary search, dp, graphs
Correct Solution:
```
from heapq import heappop,heappush
n,m = map(int,input().split())
C = [[] for _ in range(n)]
indeg = [0]*n
def toposort():
S = [i for i in range(n) if indeg[i] == 0]
nparent = indeg[:]
topo = []
while S:
cur = S.pop()
topo.append(c... | output | 1 | 108,262 | 14 | 216,525 |
Provide tags and a correct Python 3 solution for this coding contest problem.
While Farmer John rebuilds his farm in an unfamiliar portion of Bovinia, Bessie is out trying some alternative jobs. In her new gig as a reporter, Bessie needs to know about programming competition results as quickly as possible. When she co... | instruction | 0 | 108,263 | 14 | 216,526 |
Tags: binary search, dp, graphs
Correct Solution:
```
from collections import defaultdict
class RobotRapping():
def __init__(self, n, m, battles):
self.n, self.m = n, m
self.battles = battles
def generate_graph(self, k):
edge_map = defaultdict(list)
rev_map = defaultdict(list)... | output | 1 | 108,263 | 14 | 216,527 |
Provide tags and a correct Python 3 solution for this coding contest problem.
While Farmer John rebuilds his farm in an unfamiliar portion of Bovinia, Bessie is out trying some alternative jobs. In her new gig as a reporter, Bessie needs to know about programming competition results as quickly as possible. When she co... | instruction | 0 | 108,264 | 14 | 216,528 |
Tags: binary search, dp, graphs
Correct Solution:
```
from sys import stdin, stdout
import sys
import bisect
import heapq
input = sys.stdin.readline
def solve(n, m, edges):
lo = 0
hi = m
curr_k = -1
while lo <= hi:
mid = lo + (hi - lo) // 2
can_do = True
# condition
... | output | 1 | 108,264 | 14 | 216,529 |
Provide tags and a correct Python 3 solution for this coding contest problem.
While Farmer John rebuilds his farm in an unfamiliar portion of Bovinia, Bessie is out trying some alternative jobs. In her new gig as a reporter, Bessie needs to know about programming competition results as quickly as possible. When she co... | instruction | 0 | 108,265 | 14 | 216,530 |
Tags: binary search, dp, graphs
Correct Solution:
```
from sys import stdin
def main():
def f(k):
g, cnt = [[] for _ in range(n)], [0] * n
for u, v in data[:k]:
g[u].append(v)
cnt[v] += 1
if cnt.count(0) > 1:
return False
w, u = cnt.index(0), -1
... | output | 1 | 108,265 | 14 | 216,531 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.