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.
Bob got a job as a system administrator in X corporation. His first task was to connect n servers with the help of m two-way direct connection so that it becomes possible to transmit data from one server to any other server via these connect... | instruction | 0 | 11,919 | 14 | 23,838 |
Tags: graphs
Correct Solution:
```
servers, conn, failturePoint = map(int, input().split(' '))
def main():
global conn
if conn > (servers - 1) * (servers - 2) / 2 + 1 or conn < servers - 1:
return -1
for i in range(1, servers+1):
if i != failturePoint:
print(str(i) + ' ' + str(failturePoint))
conn -= serve... | output | 1 | 11,919 | 14 | 23,839 |
Provide tags and a correct Python 3 solution for this coding contest problem.
When Valera has got some free time, he goes to the library to read some books. Today he's got t free minutes to read. That's why Valera took n books in the library and for each book he estimated the time he is going to need to read it. Let's... | instruction | 0 | 11,944 | 14 | 23,888 |
Tags: binary search, brute force, implementation, two pointers
Correct Solution:
```
n, t = map(int, input().split())
a = [int(a) for a in input().split()]
j = -1
ans = 0
s = 0
for i in range(n):
s += a[i]
while s > t:
j += 1
s -= a[j]
ans = max(i-j, ans)
print(ans)
``` | output | 1 | 11,944 | 14 | 23,889 |
Provide tags and a correct Python 3 solution for this coding contest problem.
When Valera has got some free time, he goes to the library to read some books. Today he's got t free minutes to read. That's why Valera took n books in the library and for each book he estimated the time he is going to need to read it. Let's... | instruction | 0 | 11,945 | 14 | 23,890 |
Tags: binary search, brute force, implementation, two pointers
Correct Solution:
```
n, t = map(int, input().split())
a = list(map(int, input().split()))
summ = 0
j = 0
ans = 0
for i in range(n):
summ += a[i]
while (summ > t):
summ -= a[j]
j += 1
ans = max(ans, i - j + 1)
print(ans)
``` | output | 1 | 11,945 | 14 | 23,891 |
Provide tags and a correct Python 3 solution for this coding contest problem.
When Valera has got some free time, he goes to the library to read some books. Today he's got t free minutes to read. That's why Valera took n books in the library and for each book he estimated the time he is going to need to read it. Let's... | instruction | 0 | 11,946 | 14 | 23,892 |
Tags: binary search, brute force, implementation, two pointers
Correct Solution:
```
# http://codeforces.com/problemset/problem/279/B
n,t = map(int, input().split())
a = list(map(int, input().split()))
i = j = s = 0
for j in range(len(a)):
s+=a[j]
if s > t:
s -= a[i]
i+=1
print(j-i+1)
``` | output | 1 | 11,946 | 14 | 23,893 |
Provide tags and a correct Python 3 solution for this coding contest problem.
When Valera has got some free time, he goes to the library to read some books. Today he's got t free minutes to read. That's why Valera took n books in the library and for each book he estimated the time he is going to need to read it. Let's... | instruction | 0 | 11,947 | 14 | 23,894 |
Tags: binary search, brute force, implementation, two pointers
Correct Solution:
```
if __name__ == '__main__':
n, t = map(int, input().split())
all_a = list(map(int, input().split()))
sums = []
s, start = t, 0
for stop, element in enumerate(all_a):
s -= element
while s < 0:
... | output | 1 | 11,947 | 14 | 23,895 |
Provide tags and a correct Python 3 solution for this coding contest problem.
When Valera has got some free time, he goes to the library to read some books. Today he's got t free minutes to read. That's why Valera took n books in the library and for each book he estimated the time he is going to need to read it. Let's... | instruction | 0 | 11,949 | 14 | 23,898 |
Tags: binary search, brute force, implementation, two pointers
Correct Solution:
```
n,m=map(int,input().split())
a=list(map(int,input().split()))
s=pointer=ans=0
for i in range(n):
s+=a[i]
while s>m:
s-=a[pointer]
pointer+=1
ans=max(ans,i-pointer+1)
print(ans)
``` | output | 1 | 11,949 | 14 | 23,899 |
Provide tags and a correct Python 3 solution for this coding contest problem.
When Valera has got some free time, he goes to the library to read some books. Today he's got t free minutes to read. That's why Valera took n books in the library and for each book he estimated the time he is going to need to read it. Let's... | instruction | 0 | 11,950 | 14 | 23,900 |
Tags: binary search, brute force, implementation, two pointers
Correct Solution:
```
n,t = map(int, input().split())
L = list(map(int, input().split()))
i,j,s = 0,0,0
for i in range(n):
s = s + L[i]
if s > t:
s = s - L[j]
j += 1
print(n-j)
``` | output | 1 | 11,950 | 14 | 23,901 |
Provide tags and a correct Python 3 solution for this coding contest problem.
When Valera has got some free time, he goes to the library to read some books. Today he's got t free minutes to read. That's why Valera took n books in the library and for each book he estimated the time he is going to need to read it. Let's... | instruction | 0 | 11,951 | 14 | 23,902 |
Tags: binary search, brute force, implementation, two pointers
Correct Solution:
```
n, t = map(int,input().split())
a = list(map(int,input().split()))
time = 0
count = 0
x = 0
for i in range(len(a)):
time += a[i]
count += 1
if time > t:
time -= a[x]
x += 1
count -= 1
print(count)
`... | output | 1 | 11,951 | 14 | 23,903 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Once upon a time in the thicket of the mushroom forest lived mushroom gnomes. They were famous among their neighbors for their magic mushrooms. Their magic nature made it possible that between every two neighboring mushrooms every minute gre... | instruction | 0 | 12,072 | 14 | 24,144 |
Tags: math, matrices
Correct Solution:
```
#!/usr/bin/pypy3
from sys import stdin, stdout
input, print = stdin.readline, stdout.write
p = 0
def readints():
return list(map(int, input().split()))
def writeln(x):
print(str(x) + '\n')
def mod(x):
return (x % p + p) % p
def matmul(a, b):
n = len(a)
... | output | 1 | 12,072 | 14 | 24,145 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Once upon a time in the thicket of the mushroom forest lived mushroom gnomes. They were famous among their neighbors for their magic mushrooms. Their magic nature made it possible that between every two neighboring mushrooms every minute gre... | instruction | 0 | 12,073 | 14 | 24,146 |
Tags: math, matrices
Correct Solution:
```
#!/usr/bin/pypy3
from sys import stdin, stdout
input, print = stdin.readline, stdout.write
p = 0
def readints():
return list(map(int, input().split()))
def writeln(x):
print(str(x) + '\n')
def mod(x):
return (x % p + p) % p
def matmul(a, b):
n = len(a)
... | output | 1 | 12,073 | 14 | 24,147 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Sasha lives in a big happy family. At the Man's Day all the men of the family gather to celebrate it following their own traditions. There are n men in Sasha's family, so let's number them with integers from 1 to n.
Each man has at most one... | instruction | 0 | 12,108 | 14 | 24,216 |
Tags: constructive algorithms, dfs and similar, graphs, trees
Correct Solution:
```
# by the authority of GOD author: manhar singh sachdev #
import os,sys
from io import BytesIO, IOBase
def main():
n,m = map(int,input().split())
path = [[] for _ in range(n)]
indeg = [0]*n
for _ in range(m):
... | output | 1 | 12,108 | 14 | 24,217 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Sasha lives in a big happy family. At the Man's Day all the men of the family gather to celebrate it following their own traditions. There are n men in Sasha's family, so let's number them with integers from 1 to n.
Each man has at most one... | instruction | 0 | 12,109 | 14 | 24,218 |
Tags: constructive algorithms, dfs and similar, graphs, trees
Correct Solution:
```
# [https://codeforces.com/contest/681/submission/37694242 <- https://codeforces.com/contest/681/status/D <- https://codeforces.com/contest/681 <- https://codeforces.com/blog/entry/45425 <- https://codeforces.com/problemset/problem/681/D... | output | 1 | 12,109 | 14 | 24,219 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Sasha lives in a big happy family. At the Man's Day all the men of the family gather to celebrate it following their own traditions. There are n men in Sasha's family, so let's number them with integers from 1 to n.
Each man has at most one... | instruction | 0 | 12,110 | 14 | 24,220 |
Tags: constructive algorithms, dfs and similar, graphs, trees
Correct Solution:
```
n, m = map(int, input().split())
adj = [[] for _ in range(n)]
cp = [-1] * n
for i in range(m):
p, c = map(int, input().split())
adj[p - 1].append(c - 1)
cp[c - 1] = p - 1
pres = [i - 1 for i in map(int, input().split())]
... | output | 1 | 12,110 | 14 | 24,221 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Sasha lives in a big happy family. At the Man's Day all the men of the family gather to celebrate it following their own traditions. There are n men in Sasha's family, so let's number them with ... | instruction | 0 | 12,111 | 14 | 24,222 |
No | output | 1 | 12,111 | 14 | 24,223 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Sasha lives in a big happy family. At the Man's Day all the men of the family gather to celebrate it following their own traditions. There are n men in Sasha's family, so let's number them with ... | instruction | 0 | 12,112 | 14 | 24,224 |
No | output | 1 | 12,112 | 14 | 24,225 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Sasha lives in a big happy family. At the Man's Day all the men of the family gather to celebrate it following their own traditions. There are n men in Sasha's family, so let's number them with ... | instruction | 0 | 12,113 | 14 | 24,226 |
No | output | 1 | 12,113 | 14 | 24,227 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Bear Limak examines a social network. Its main functionality is that two members can become friends (then they can talk with each other and share funny pictures).
There are n members, numbered 1 through n. m pairs of members are friends. Of... | instruction | 0 | 12,146 | 14 | 24,292 |
Tags: dfs and similar, dsu, graphs
Correct Solution:
```
n, m = [int(x) for x in input().split()]
l = []
for i in range(m):
x, y = [int(x) for x in input().split()]
if x>y: x,y = y,x
l.append((x, y))
l.sort(key=lambda x: x[0])
labels = {}
rels_count = {}
class_count = {}
for x, y in l:
if x not in la... | output | 1 | 12,146 | 14 | 24,293 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Bear Limak examines a social network. Its main functionality is that two members can become friends (then they can talk with each other and share funny pictures).
There are n members, numbered 1 through n. m pairs of members are friends. Of... | instruction | 0 | 12,147 | 14 | 24,294 |
Tags: dfs and similar, dsu, graphs
Correct Solution:
```
from collections import defaultdict,deque
from sys import *
def bfs(graph,vis,node):
q=deque()
q.append(node)
vis[node]=0
cnt=1
while q:
s=q.popleft()
for i in graph[s]:
if vis[i]==1:
vis[i]=0
... | output | 1 | 12,147 | 14 | 24,295 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Bear Limak examines a social network. Its main functionality is that two members can become friends (then they can talk with each other and share funny pictures).
There are n members, numbered 1 through n. m pairs of members are friends. Of... | instruction | 0 | 12,148 | 14 | 24,296 |
Tags: dfs and similar, dsu, graphs
Correct Solution:
```
import os
import sys
from io import BytesIO, IOBase
import math
from decimal import Decimal
from decimal import *
from collections import defaultdict, deque
import heapq
getcontext().prec = 25
abcd='abcdefghijklmnopqrstuvwxyz'
MOD = pow(10, 9) + 7
BUFSIZE = 8192
... | output | 1 | 12,148 | 14 | 24,297 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Bear Limak examines a social network. Its main functionality is that two members can become friends (then they can talk with each other and share funny pictures).
There are n members, numbered 1 through n. m pairs of members are friends. Of... | instruction | 0 | 12,149 | 14 | 24,298 |
Tags: dfs and similar, dsu, graphs
Correct Solution:
```
import sys
n,m=map(int,input().split())
q={i:set([i]) for i in range(1,n+1)}
v=set()
for i in range(m):
a,b=map(int,input().split())
q[a].add(b)
q[b].add(a)
for k,w in q.items():
if k not in v:
z=[q[i]==w for i in w]
if 0 not in z:... | output | 1 | 12,149 | 14 | 24,299 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Bear Limak examines a social network. Its main functionality is that two members can become friends (then they can talk with each other and share funny pictures).
There are n members, numbered 1 through n. m pairs of members are friends. Of... | instruction | 0 | 12,150 | 14 | 24,300 |
Tags: dfs and similar, dsu, graphs
Correct Solution:
```
import sys
def main():
n,m = map(int,sys.stdin.readline().split())
l = [[] for i in range(n+1)]
u = [False]*(n+1)
for i in range(m):
a, b = map(int,sys.stdin.readline().split())
l[a].append(b)
l[b].append(a)
... | output | 1 | 12,150 | 14 | 24,301 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Bear Limak examines a social network. Its main functionality is that two members can become friends (then they can talk with each other and share funny pictures).
There are n members, numbered 1 through n. m pairs of members are friends. Of... | instruction | 0 | 12,151 | 14 | 24,302 |
Tags: dfs and similar, dsu, graphs
Correct Solution:
```
from collections import defaultdict
import sys
input=__import__('sys').stdin.readline
n,m=map(int,input().split())
adj=defaultdict(set)
vis=[False]*(n+1)
for i in range(m):
u,v=map(int,input().split())
adj[u].add(v)
adj[v].add(u)
for x in adj:
a... | output | 1 | 12,151 | 14 | 24,303 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Bear Limak examines a social network. Its main functionality is that two members can become friends (then they can talk with each other and share funny pictures).
There are n members, numbered 1 through n. m pairs of members are friends. Of... | instruction | 0 | 12,152 | 14 | 24,304 |
Tags: dfs and similar, dsu, graphs
Correct Solution:
```
from sys import stdin
from collections import deque
#from math import sqrt, floor, ceil, log, log2, log10, pi, gcd, sin, cos, asin
def ii(): return int(stdin.readline())
def fi(): return float(stdin.readline())
def mi(): return map(int, stdin.readline().split())
... | output | 1 | 12,152 | 14 | 24,305 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Bear Limak examines a social network. Its main functionality is that two members can become friends (then they can talk with each other and share funny pictures).
There are n members, numbered 1 through n. m pairs of members are friends. Of... | instruction | 0 | 12,153 | 14 | 24,306 |
Tags: dfs and similar, dsu, graphs
Correct Solution:
```
from collections import Counter,defaultdict,deque
#alph = 'abcdefghijklmnopqrstuvwxyz'
#from math import factorial as fact
#nl = '\n'
#import sys
#input=sys.stdin.readline
#print=sys.stdout.write
#tt = int(input())
#total=0
#n = int(input())
#n,m,k = [int(x) for... | output | 1 | 12,153 | 14 | 24,307 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Bear Limak examines a social network. Its main functionality is that two members can become friends (then they can talk with each other and share funny pictures).
There are n members, numbered ... | instruction | 0 | 12,154 | 14 | 24,308 |
Yes | output | 1 | 12,154 | 14 | 24,309 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Bear Limak examines a social network. Its main functionality is that two members can become friends (then they can talk with each other and share funny pictures).
There are n members, numbered ... | instruction | 0 | 12,155 | 14 | 24,310 |
Yes | output | 1 | 12,155 | 14 | 24,311 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Bear Limak examines a social network. Its main functionality is that two members can become friends (then they can talk with each other and share funny pictures).
There are n members, numbered ... | instruction | 0 | 12,156 | 14 | 24,312 |
Yes | output | 1 | 12,156 | 14 | 24,313 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Bear Limak examines a social network. Its main functionality is that two members can become friends (then they can talk with each other and share funny pictures).
There are n members, numbered ... | instruction | 0 | 12,157 | 14 | 24,314 |
Yes | output | 1 | 12,157 | 14 | 24,315 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Bear Limak examines a social network. Its main functionality is that two members can become friends (then they can talk with each other and share funny pictures).
There are n members, numbered ... | instruction | 0 | 12,158 | 14 | 24,316 |
No | output | 1 | 12,158 | 14 | 24,317 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Bear Limak examines a social network. Its main functionality is that two members can become friends (then they can talk with each other and share funny pictures).
There are n members, numbered ... | instruction | 0 | 12,159 | 14 | 24,318 |
No | output | 1 | 12,159 | 14 | 24,319 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Bear Limak examines a social network. Its main functionality is that two members can become friends (then they can talk with each other and share funny pictures).
There are n members, numbered ... | instruction | 0 | 12,160 | 14 | 24,320 |
No | output | 1 | 12,160 | 14 | 24,321 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Bear Limak examines a social network. Its main functionality is that two members can become friends (then they can talk with each other and share funny pictures).
There are n members, numbered ... | instruction | 0 | 12,161 | 14 | 24,322 |
No | output | 1 | 12,161 | 14 | 24,323 |
Provide a correct Python 3 solution for this coding contest problem.
D: Indecision-Indecision-
problem
Ebi-chan has been addicted to gal games lately, and her goal now is to capture two heroines at the same time.
Ebi-chan can use several events to increase her liking from the heroine, but only one heroine can be se... | instruction | 0 | 12,445 | 14 | 24,890 |
"Correct Solution:
```
N, C = map(int, input().split())
events = []
for i in range(N):
events.append(list(map(int, input().split())))
def solve():
L = 250
dp = [[-10**18]*(L+1) for i in range(C+1)]
for j in range(C+1):
dp[j][0] = 0
for a, b, c in events:
for j in range(C-c, -1, -1):... | output | 1 | 12,445 | 14 | 24,891 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
D: Indecision-Indecision-
problem
Ebi-chan has been addicted to gal games lately, and her goal now is to capture two heroines at the same time.
Ebi-chan can use several events to increase her... | instruction | 0 | 12,446 | 14 | 24,892 |
No | output | 1 | 12,446 | 14 | 24,893 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
D: Indecision-Indecision-
problem
Ebi-chan has been addicted to gal games lately, and her goal now is to capture two heroines at the same time.
Ebi-chan can use several events to increase her... | instruction | 0 | 12,447 | 14 | 24,894 |
No | output | 1 | 12,447 | 14 | 24,895 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
D: Indecision-Indecision-
problem
Ebi-chan has been addicted to gal games lately, and her goal now is to capture two heroines at the same time.
Ebi-chan can use several events to increase her... | instruction | 0 | 12,448 | 14 | 24,896 |
No | output | 1 | 12,448 | 14 | 24,897 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
D: Indecision-Indecision-
problem
Ebi-chan has been addicted to gal games lately, and her goal now is to capture two heroines at the same time.
Ebi-chan can use several events to increase her... | instruction | 0 | 12,449 | 14 | 24,898 |
No | output | 1 | 12,449 | 14 | 24,899 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Everyone loves a freebie. Especially students.
It is well-known that if in the night before exam a student opens window, opens the student's record-book and shouts loudly three times "Fly, freebie, fly!" β then flown freebie helps him to pa... | instruction | 0 | 12,793 | 14 | 25,586 |
Tags: binary search, brute force, implementation
Correct Solution:
```
read = lambda: map(int, input().split())
n = int(input())
a = sorted(read())
T = int(input())
ans = 0
j = 0
for i in range(n):
while j < n and a[j] - a[i] <= T:
j += 1
ans = max(ans, j - i)
print(ans)
``` | output | 1 | 12,793 | 14 | 25,587 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Everyone loves a freebie. Especially students.
It is well-known that if in the night before exam a student opens window, opens the student's record-book and shouts loudly three times "Fly, freebie, fly!" β then flown freebie helps him to pa... | instruction | 0 | 12,794 | 14 | 25,588 |
Tags: binary search, brute force, implementation
Correct Solution:
```
n=int(input())
l=list(map(int,input().split()))
t=int(input())
l.sort()
mx=1
i=0
j=0
count=1
while j<n-1:
count=1
i=j+1
while i<n:
if l[i]-l[j]<=t:
count+=1
i+=1
else:
bre... | output | 1 | 12,794 | 14 | 25,589 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Everyone loves a freebie. Especially students.
It is well-known that if in the night before exam a student opens window, opens the student's record-book and shouts loudly three times "Fly, freebie, fly!" β then flown freebie helps him to pa... | instruction | 0 | 12,795 | 14 | 25,590 |
Tags: binary search, brute force, implementation
Correct Solution:
```
n = int(input())
lst = list(map(int,input().split()))
t = int(input())
lst.sort()
res=0
from bisect import bisect
for i,x in enumerate(lst):
j=bisect(lst,x+t)
res=max(res,j-i)
print(res)
``` | output | 1 | 12,795 | 14 | 25,591 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Everyone loves a freebie. Especially students.
It is well-known that if in the night before exam a student opens window, opens the student's record-book and shouts loudly three times "Fly, freebie, fly!" β then flown freebie helps him to pa... | instruction | 0 | 12,796 | 14 | 25,592 |
Tags: binary search, brute force, implementation
Correct Solution:
```
def halyava(lst, t):
count = 1
for i in range(len(lst)):
for j in range(i + 1, len(lst)):
if sorted(lst)[j] - sorted(lst)[i] <= t:
count = max(j - i + 1, count)
return count
n = int(input())
b = [int... | output | 1 | 12,796 | 14 | 25,593 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Everyone loves a freebie. Especially students.
It is well-known that if in the night before exam a student opens window, opens the student's record-book and shouts loudly three times "Fly, freebie, fly!" β then flown freebie helps him to pa... | instruction | 0 | 12,797 | 14 | 25,594 |
Tags: binary search, brute force, implementation
Correct Solution:
```
n=int(input())
l=list(map(int,input().split()))
t=int(input())
l.sort()
a=[]
i=0
j=0
while i<n:
while j<n and l[j]-l[i]<=t:
j+=1
a.append(j-i)
i+=1
print(max(a))
``` | output | 1 | 12,797 | 14 | 25,595 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Everyone loves a freebie. Especially students.
It is well-known that if in the night before exam a student opens window, opens the student's record-book and shouts loudly three times "Fly, freebie, fly!" β then flown freebie helps him to pa... | instruction | 0 | 12,798 | 14 | 25,596 |
Tags: binary search, brute force, implementation
Correct Solution:
```
n = int(input())
v = list(map(int, input().split()))
t = int(input())
v.sort()
ret = 1
lef = 0
rit = 1
while rit < n:
while rit < n and v[rit] - v[lef] <= t:
rit = rit + 1
ret = max(ret, rit - lef)
lef = lef + 1
print(ret)
``... | output | 1 | 12,798 | 14 | 25,597 |
Provide tags and a correct Python 3 solution for this coding contest problem.
There are n parliamentarians in Berland. They are numbered with integers from 1 to n. It happened that all parliamentarians with odd indices are Democrats and all parliamentarians with even indices are Republicans.
New parliament assembly h... | instruction | 0 | 12,931 | 14 | 25,862 |
Tags: *special, constructive algorithms
Correct Solution:
```
n,a,b=(int(z) for z in input().split())
if a*b<n:
print(-1)
else:
i=1
s=''
if b%2==1:
while i<=n:
if i%b!=0:
s+=str(i)+' '
else:
print(s+str(i))
s=''
... | output | 1 | 12,931 | 14 | 25,863 |
Provide tags and a correct Python 3 solution for this coding contest problem.
There are n parliamentarians in Berland. They are numbered with integers from 1 to n. It happened that all parliamentarians with odd indices are Democrats and all parliamentarians with even indices are Republicans.
New parliament assembly h... | instruction | 0 | 12,932 | 14 | 25,864 |
Tags: *special, constructive algorithms
Correct Solution:
```
n, a, b = map(int, input().split())
t = 1
if a*b < n:
print(-1)
else:
if b%2:
for i in range(a):
ar = [x+i*b for x in range(1, b+1)]
for j in range(b):
if ar[j] <= n:
print(ar[j], en... | output | 1 | 12,932 | 14 | 25,865 |
Provide tags and a correct Python 3 solution for this coding contest problem.
There are n parliamentarians in Berland. They are numbered with integers from 1 to n. It happened that all parliamentarians with odd indices are Democrats and all parliamentarians with even indices are Republicans.
New parliament assembly h... | instruction | 0 | 12,933 | 14 | 25,866 |
Tags: *special, constructive algorithms
Correct Solution:
```
from itertools import combinations, accumulate, groupby, count
from sys import stdout, stdin, setrecursionlimit
from io import BytesIO, IOBase
from collections import *
from random import *
from bisect import *
from string import *
from queue import *
from h... | output | 1 | 12,933 | 14 | 25,867 |
Provide tags and a correct Python 3 solution for this coding contest problem.
There are n parliamentarians in Berland. They are numbered with integers from 1 to n. It happened that all parliamentarians with odd indices are Democrats and all parliamentarians with even indices are Republicans.
New parliament assembly h... | instruction | 0 | 12,934 | 14 | 25,868 |
Tags: *special, constructive algorithms
Correct Solution:
```
import itertools
def grouper(n, iterable):
it = iter(iterable)
while True:
chunk = tuple(itertools.islice(it, n))
if not chunk:
return
yield chunk
(n,a,b)= [int(x) for x in input().split()]
possible = True
t = []
if... | output | 1 | 12,934 | 14 | 25,869 |
Provide tags and a correct Python 3 solution for this coding contest problem.
There are n parliamentarians in Berland. They are numbered with integers from 1 to n. It happened that all parliamentarians with odd indices are Democrats and all parliamentarians with even indices are Republicans.
New parliament assembly h... | instruction | 0 | 12,935 | 14 | 25,870 |
Tags: *special, constructive algorithms
Correct Solution:
```
A = input().split()
a = [[0] * int(A[2]) for i in range(int(A[1]))]
count = 1
if int(A[1]) * int(A[2]) < int(A[0]):
print(-1)
else:
for i in range(int(A[1])):
if i % 2 == 0:
for j in range(int(A[2])-1, -1, -1):
a[i... | output | 1 | 12,935 | 14 | 25,871 |
Provide tags and a correct Python 3 solution for this coding contest problem.
There are n parliamentarians in Berland. They are numbered with integers from 1 to n. It happened that all parliamentarians with odd indices are Democrats and all parliamentarians with even indices are Republicans.
New parliament assembly h... | instruction | 0 | 12,936 | 14 | 25,872 |
Tags: *special, constructive algorithms
Correct Solution:
```
n, a, b = map(int, input().split())
if n > a * b:
print(-1)
else:
c = [[0 for j in range(b)] for i in range(a)]
p = 1
i = 0
j = 0
while p <= n:
if i % 2 == 0:
for j in range(b):
if p > n:
... | output | 1 | 12,936 | 14 | 25,873 |
Provide tags and a correct Python 3 solution for this coding contest problem.
There are n parliamentarians in Berland. They are numbered with integers from 1 to n. It happened that all parliamentarians with odd indices are Democrats and all parliamentarians with even indices are Republicans.
New parliament assembly h... | instruction | 0 | 12,937 | 14 | 25,874 |
Tags: *special, constructive algorithms
Correct Solution:
```
n, a, b = map(int, input().split())
if (a * b < n):
print(-1)
exit(0)
q = [[0] * 102 for i in range(102)]
i = 0
j = 0
k = n - 1
while (n > 0):
q[i][j] = n
n -= 1
if (j == b - 1 and i % 2 == 0):
i += 1
else:
if (j == 0 ... | output | 1 | 12,937 | 14 | 25,875 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.