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.
Imp likes his plush toy a lot.
<image>
Recently, he found a machine that can clone plush toys. Imp knows that if he applies the machine to an original toy, he additionally gets one more original toy and one copy, and if he applies the mach... | instruction | 0 | 84,752 | 14 | 169,504 |
Tags: implementation
Correct Solution:
```
x,y = map(int,input().split())
if (y==0) or (y==1 and x!=0):
print("No")
else:
if (x-(y-1))%2==0 and x>=(y-1) and y!=0:
print("Yes")
else:
print("No")
``` | output | 1 | 84,752 | 14 | 169,505 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Imp likes his plush toy a lot.
<image>
Recently, he found a machine that can clone plush toys. Imp knows that if he applies the machine to an original toy, he additionally gets one more original toy and one copy, and if he applies the mach... | instruction | 0 | 84,753 | 14 | 169,506 |
Tags: implementation
Correct Solution:
```
[copies, originals] = input().split()
copies = int(copies)
originals = int(originals)
if originals < 1 :
print("No")
elif originals == 1 and copies > 0 :
print("No")
elif originals > copies + 1:
print("No")
elif (copies - originals) % 2 == 0 :
print("No")
else :
pri... | output | 1 | 84,753 | 14 | 169,507 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Imp likes his plush toy a lot.
<image>
Recently, he found a machine that can clone plush toys. Imp knows that if he applies the machine to an original toy, he additionally gets one more original toy and one copy, and if he applies the mach... | instruction | 0 | 84,754 | 14 | 169,508 |
Tags: implementation
Correct Solution:
```
def orig_copies(x, y):
x1, y1 = y, y - 1
if y1 == 0 and x > 0:
return "No"
elif y1 > 0 and (x - y1) % 2 == 1:
return "No"
elif y == 0:
return "No"
elif x - y1 < 0:
return "No"
return "Yes"
X, Y = [int(i) for i in input(... | output | 1 | 84,754 | 14 | 169,509 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Imp likes his plush toy a lot.
<image>
Recently, he found a machine that can clone plush toys. Imp knows that if he applies the machine to an original toy, he additionally gets one more original toy and one copy, and if he applies the mach... | instruction | 0 | 84,755 | 14 | 169,510 |
Tags: implementation
Correct Solution:
```
X,Y= input().split()
X,Y = [int(X),int(Y)]
if X % 2 == 0 and Y % 2 == 0 or X % 2 != 0 and Y % 2 != 0 or X < Y - 1 or Y == 0 or Y == 1 and X != 0:
print("No")
else: print("Yes")
``` | output | 1 | 84,755 | 14 | 169,511 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Imp likes his plush toy a lot.
<image>
Recently, he found a machine that can clone plush toys. Imp knows that if he applies the machine to an original toy, he additionally gets one more original toy and one copy, and if he applies the mach... | instruction | 0 | 84,756 | 14 | 169,512 |
Tags: implementation
Correct Solution:
```
import sys
x, y = map(int, input().split())
print("NO" if (y == 1 and x != 0) or x % 2 == y % 2 or y == 0 or y > x + 1 else "YES")
``` | output | 1 | 84,756 | 14 | 169,513 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Imp likes his plush toy a lot.
<image>
Recently, he found a machine that can clone plush toys. Imp knows that if he applies the machine to an original toy, he additionally gets one more original toy and one copy, and if he applies the mach... | instruction | 0 | 84,757 | 14 | 169,514 |
Tags: implementation
Correct Solution:
```
x,y=map(int,input().split())
if y-1<=0 and x!=0:
print("No")
elif x<y-1:
print("No")
else:
if (x-y+1)%2==0:
print("Yes")
else:
print("No")
``` | output | 1 | 84,757 | 14 | 169,515 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Imp likes his plush toy a lot.
<image>
Recently, he found a machine that can clone plush toys. Imp knows that if he applies the machine to an original toy, he additionally gets one more origin... | instruction | 0 | 84,759 | 14 | 169,518 |
Yes | output | 1 | 84,759 | 14 | 169,519 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Imp likes his plush toy a lot.
<image>
Recently, he found a machine that can clone plush toys. Imp knows that if he applies the machine to an original toy, he additionally gets one more origin... | instruction | 0 | 84,760 | 14 | 169,520 |
Yes | output | 1 | 84,760 | 14 | 169,521 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Imp likes his plush toy a lot.
<image>
Recently, he found a machine that can clone plush toys. Imp knows that if he applies the machine to an original toy, he additionally gets one more origin... | instruction | 0 | 84,765 | 14 | 169,530 |
No | output | 1 | 84,765 | 14 | 169,531 |
Provide tags and a correct Python 3 solution for this coding contest problem.
One day Igor K. stopped programming and took up math. One late autumn evening he was sitting at a table reading a book and thinking about something.
The following statement caught his attention: "Among any six people there are either three... | instruction | 0 | 84,766 | 14 | 169,532 |
Tags: graphs, implementation, math
Correct Solution:
```
from collections import defaultdict
from sys import exit
class Graph:
def __init__(self):
self.adj=defaultdict(list)
def add_edge(self,x,y):
self.adj[x].append(y)
self.adj[y].append(x)
def check(self):
for i in range(1,... | output | 1 | 84,766 | 14 | 169,533 |
Provide tags and a correct Python 3 solution for this coding contest problem.
One day Igor K. stopped programming and took up math. One late autumn evening he was sitting at a table reading a book and thinking about something.
The following statement caught his attention: "Among any six people there are either three... | instruction | 0 | 84,767 | 14 | 169,534 |
Tags: graphs, implementation, math
Correct Solution:
```
n = int(input())
l = [0, 0, 0, 0, 0]
for i in range(n):
a, b = map(int, input().split())
for j in range(6):
if a == j: l[j-1] += 1
if b == j: l[j-1] += 1
if l.count(2) !=5: print("WIN")
else: print("FAIL")
# Made By Mostafa_Kh... | output | 1 | 84,767 | 14 | 169,535 |
Provide tags and a correct Python 3 solution for this coding contest problem.
One day Igor K. stopped programming and took up math. One late autumn evening he was sitting at a table reading a book and thinking about something.
The following statement caught his attention: "Among any six people there are either three... | instruction | 0 | 84,768 | 14 | 169,536 |
Tags: graphs, implementation, math
Correct Solution:
```
import sys
n=int(input())
list1=[[0 for i in range(6)]for i in range(6)]
for i in range(n):
a,b=map(int,input().split())
list1[a][b]=1
list1[b][a]=1
for i in range(1,6):
for j in range(1,6):
for k in range(1,6):
if(i!=j an... | output | 1 | 84,768 | 14 | 169,537 |
Provide tags and a correct Python 3 solution for this coding contest problem.
One day Igor K. stopped programming and took up math. One late autumn evening he was sitting at a table reading a book and thinking about something.
The following statement caught his attention: "Among any six people there are either three... | instruction | 0 | 84,769 | 14 | 169,538 |
Tags: graphs, implementation, math
Correct Solution:
```
from collections import defaultdict
n = int(input())
d = defaultdict(list)
l = []
for i in range(1 , 6):
for j in range(i+1 , 6):
for k in range(j+1 , 6):
l.append([i , j , k])
for i in range(n):
u , v = map(int,input().split())
... | output | 1 | 84,769 | 14 | 169,539 |
Provide tags and a correct Python 3 solution for this coding contest problem.
One day Igor K. stopped programming and took up math. One late autumn evening he was sitting at a table reading a book and thinking about something.
The following statement caught his attention: "Among any six people there are either three... | instruction | 0 | 84,770 | 14 | 169,540 |
Tags: graphs, implementation, math
Correct Solution:
```
import sys
input = sys.stdin.readline
m = int(input())
neigh = {1: [], 2: [], 3: [], 4: [], 5: []}
for i in range(m):
a, b = map(int, input().split())
neigh[a].append(b)
neigh[b].append(a)
for key in neigh:
if len(neigh[key]) != 2:
print... | output | 1 | 84,770 | 14 | 169,541 |
Provide tags and a correct Python 3 solution for this coding contest problem.
One day Igor K. stopped programming and took up math. One late autumn evening he was sitting at a table reading a book and thinking about something.
The following statement caught his attention: "Among any six people there are either three... | instruction | 0 | 84,771 | 14 | 169,542 |
Tags: graphs, implementation, math
Correct Solution:
```
m = int(input())
L = [[False for i in range(5)] for j in range(5)]
for i in range(m):
relation = [int(s) for s in input().split()]
L[relation[0]-1][relation[1]-1] = True
L[relation[1]-1][relation[0]-1] = True
bool = False
for i in range(3):
for j ... | output | 1 | 84,771 | 14 | 169,543 |
Provide tags and a correct Python 3 solution for this coding contest problem.
One day Igor K. stopped programming and took up math. One late autumn evening he was sitting at a table reading a book and thinking about something.
The following statement caught his attention: "Among any six people there are either three... | instruction | 0 | 84,772 | 14 | 169,544 |
Tags: graphs, implementation, math
Correct Solution:
```
m=int(input())
n={}
n[5]=0
n[4]=0
n[3]=0
n[2]=0
n[1]=0
for i in range(m):
g=input().split()
n[int(g[0])]+=1
n[int(g[1])]+=1
if n[1]==n[2]==n[3]==n[4]==n[5]==2:
print('FAIL')
exit()
print('WIN')
``` | output | 1 | 84,772 | 14 | 169,545 |
Provide tags and a correct Python 3 solution for this coding contest problem.
One day Igor K. stopped programming and took up math. One late autumn evening he was sitting at a table reading a book and thinking about something.
The following statement caught his attention: "Among any six people there are either three... | instruction | 0 | 84,773 | 14 | 169,546 |
Tags: graphs, implementation, math
Correct Solution:
```
def s():
m = int(input())
s = set(tuple(sorted(list(map(int,input().split()))))for _ in range(m))
for i in range(1,4):
for j in range(i+1,5):
for k in range(j+1,6):
r = ((i,j)in s) + ((j,k)in s) + ((i,k)in s)
... | output | 1 | 84,773 | 14 | 169,547 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
One day Igor K. stopped programming and took up math. One late autumn evening he was sitting at a table reading a book and thinking about something.
The following statement caught his attentio... | instruction | 0 | 84,774 | 14 | 169,548 |
Yes | output | 1 | 84,774 | 14 | 169,549 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
One day Igor K. stopped programming and took up math. One late autumn evening he was sitting at a table reading a book and thinking about something.
The following statement caught his attentio... | instruction | 0 | 84,775 | 14 | 169,550 |
Yes | output | 1 | 84,775 | 14 | 169,551 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
One day Igor K. stopped programming and took up math. One late autumn evening he was sitting at a table reading a book and thinking about something.
The following statement caught his attentio... | instruction | 0 | 84,776 | 14 | 169,552 |
Yes | output | 1 | 84,776 | 14 | 169,553 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
One day Igor K. stopped programming and took up math. One late autumn evening he was sitting at a table reading a book and thinking about something.
The following statement caught his attentio... | instruction | 0 | 84,777 | 14 | 169,554 |
Yes | output | 1 | 84,777 | 14 | 169,555 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
One day Igor K. stopped programming and took up math. One late autumn evening he was sitting at a table reading a book and thinking about something.
The following statement caught his attentio... | instruction | 0 | 84,778 | 14 | 169,556 |
No | output | 1 | 84,778 | 14 | 169,557 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
One day Igor K. stopped programming and took up math. One late autumn evening he was sitting at a table reading a book and thinking about something.
The following statement caught his attentio... | instruction | 0 | 84,779 | 14 | 169,558 |
No | output | 1 | 84,779 | 14 | 169,559 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
One day Igor K. stopped programming and took up math. One late autumn evening he was sitting at a table reading a book and thinking about something.
The following statement caught his attentio... | instruction | 0 | 84,780 | 14 | 169,560 |
No | output | 1 | 84,780 | 14 | 169,561 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
One day Igor K. stopped programming and took up math. One late autumn evening he was sitting at a table reading a book and thinking about something.
The following statement caught his attentio... | instruction | 0 | 84,781 | 14 | 169,562 |
No | output | 1 | 84,781 | 14 | 169,563 |
Provide tags and a correct Python 3 solution for this coding contest problem.
There are n benches in the Berland Central park. It is known that a_i people are currently sitting on the i-th bench. Another m people are coming to the park and each of them is going to have a seat on some bench out of n available.
Let k b... | instruction | 0 | 85,022 | 14 | 170,044 |
Tags: binary search, implementation
Correct Solution:
```
n = int(input().strip())
m = int(input().strip())
max = 0
total = 0
for i in range(n):
a = int(input().strip())
if (a > max):
max = a
total += a
if (total + m <= n * max):
print(max)
else:
print((total+m-1)//n+1)
print(m + max)
``` | output | 1 | 85,022 | 14 | 170,045 |
Provide tags and a correct Python 3 solution for this coding contest problem.
There are n benches in the Berland Central park. It is known that a_i people are currently sitting on the i-th bench. Another m people are coming to the park and each of them is going to have a seat on some bench out of n available.
Let k b... | instruction | 0 | 85,023 | 14 | 170,046 |
Tags: binary search, implementation
Correct Solution:
```
import math
for i in range(1):
n=int(input())
m=int(input())
l=[]
s=0
for i in range(n):
k=int(input())
s+=k
l.append(k)
print(max((m+s+n-1)//n,max(l)),(max(l)+m))
``` | output | 1 | 85,023 | 14 | 170,047 |
Provide tags and a correct Python 3 solution for this coding contest problem.
There are n benches in the Berland Central park. It is known that a_i people are currently sitting on the i-th bench. Another m people are coming to the park and each of them is going to have a seat on some bench out of n available.
Let k b... | instruction | 0 | 85,024 | 14 | 170,048 |
Tags: binary search, implementation
Correct Solution:
```
from collections import defaultdict, deque, Counter
from sys import stdin, stdout
from heapq import heappush, heappop
import math
import io
import os
import math
import bisect
#?############################################################
def isPrime(x):
... | output | 1 | 85,024 | 14 | 170,049 |
Provide tags and a correct Python 3 solution for this coding contest problem.
There are n benches in the Berland Central park. It is known that a_i people are currently sitting on the i-th bench. Another m people are coming to the park and each of them is going to have a seat on some bench out of n available.
Let k b... | instruction | 0 | 85,025 | 14 | 170,050 |
Tags: binary search, implementation
Correct Solution:
```
def indmin(m):
a=min(m)
for i in range(len(m)):
if m[i] == a:
return i
a=int(input())
b=int(input())
m=[]
ind=0
d=0
for i in range(a):
m.append(int(input()))
c=list(m)
for i in range(b):
c[indmin(c)]+=1
d=max(m) + b
print(max(... | output | 1 | 85,025 | 14 | 170,051 |
Provide tags and a correct Python 3 solution for this coding contest problem.
There are n benches in the Berland Central park. It is known that a_i people are currently sitting on the i-th bench. Another m people are coming to the park and each of them is going to have a seat on some bench out of n available.
Let k b... | instruction | 0 | 85,026 | 14 | 170,052 |
Tags: binary search, implementation
Correct Solution:
```
n = int(input())
m = int(input())
bench = [int(input()) for i in range(n)]
mx = max(bench) + m
for i in range(m):
bench[bench.index(min(bench))] += 1
print(max(bench), mx)
``` | output | 1 | 85,026 | 14 | 170,053 |
Provide tags and a correct Python 3 solution for this coding contest problem.
There are n benches in the Berland Central park. It is known that a_i people are currently sitting on the i-th bench. Another m people are coming to the park and each of them is going to have a seat on some bench out of n available.
Let k b... | instruction | 0 | 85,027 | 14 | 170,054 |
Tags: binary search, implementation
Correct Solution:
```
#510_A
n = int(input())
p = int(input())
ms = []
for i in range(0, n):
m = int(input())
ms.append(m)
mx = max(ms)
m2 = mx + p
diffs = sum([mx - i for i in ms])
if p < diffs:
m1 = mx
else:
m1 = (p - diffs)
if m1 % n != 0:
m1 = m1 /... | output | 1 | 85,027 | 14 | 170,055 |
Provide tags and a correct Python 3 solution for this coding contest problem.
There are n benches in the Berland Central park. It is known that a_i people are currently sitting on the i-th bench. Another m people are coming to the park and each of them is going to have a seat on some bench out of n available.
Let k b... | instruction | 0 | 85,028 | 14 | 170,056 |
Tags: binary search, implementation
Correct Solution:
```
import math
n = int(input())
m = int(input())
abc = m
a = []
ans = 0
for i in range(n):
x = int(input())
a.append(x)
a.sort()
for j in range(len(a)):
ans += a[-1] - a[j]
if j == len(a) - 1:
if ans >= m:
ans = max(a)
el... | output | 1 | 85,028 | 14 | 170,057 |
Provide tags and a correct Python 3 solution for this coding contest problem.
There are n benches in the Berland Central park. It is known that a_i people are currently sitting on the i-th bench. Another m people are coming to the park and each of them is going to have a seat on some bench out of n available.
Let k b... | instruction | 0 | 85,029 | 14 | 170,058 |
Tags: binary search, implementation
Correct Solution:
```
def inp():
return list(map(int,input().split()))
n,=inp()
m,=inp()
a = [int(input()) for i in range(n)]
s=sum(a)
mx=max(a)
mi= max([mx, int((s+m+n-1)/n)])
mx= mx + m
print(mi,mx)
``` | output | 1 | 85,029 | 14 | 170,059 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
There are n benches in the Berland Central park. It is known that a_i people are currently sitting on the i-th bench. Another m people are coming to the park and each of them is going to have a ... | instruction | 0 | 85,030 | 14 | 170,060 |
Yes | output | 1 | 85,030 | 14 | 170,061 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
There are n benches in the Berland Central park. It is known that a_i people are currently sitting on the i-th bench. Another m people are coming to the park and each of them is going to have a ... | instruction | 0 | 85,031 | 14 | 170,062 |
Yes | output | 1 | 85,031 | 14 | 170,063 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
There are n benches in the Berland Central park. It is known that a_i people are currently sitting on the i-th bench. Another m people are coming to the park and each of them is going to have a ... | instruction | 0 | 85,032 | 14 | 170,064 |
Yes | output | 1 | 85,032 | 14 | 170,065 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
There are n benches in the Berland Central park. It is known that a_i people are currently sitting on the i-th bench. Another m people are coming to the park and each of them is going to have a ... | instruction | 0 | 85,033 | 14 | 170,066 |
Yes | output | 1 | 85,033 | 14 | 170,067 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
There are n benches in the Berland Central park. It is known that a_i people are currently sitting on the i-th bench. Another m people are coming to the park and each of them is going to have a ... | instruction | 0 | 85,034 | 14 | 170,068 |
No | output | 1 | 85,034 | 14 | 170,069 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
There are n benches in the Berland Central park. It is known that a_i people are currently sitting on the i-th bench. Another m people are coming to the park and each of them is going to have a ... | instruction | 0 | 85,035 | 14 | 170,070 |
No | output | 1 | 85,035 | 14 | 170,071 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
There are n benches in the Berland Central park. It is known that a_i people are currently sitting on the i-th bench. Another m people are coming to the park and each of them is going to have a ... | instruction | 0 | 85,036 | 14 | 170,072 |
No | output | 1 | 85,036 | 14 | 170,073 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
There are n benches in the Berland Central park. It is known that a_i people are currently sitting on the i-th bench. Another m people are coming to the park and each of them is going to have a ... | instruction | 0 | 85,037 | 14 | 170,074 |
No | output | 1 | 85,037 | 14 | 170,075 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Today Adilbek is taking his probability theory test. Unfortunately, when Adilbek arrived at the university, there had already been a long queue of students wanting to take the same test. Adilbek has estimated that he will be able to start th... | instruction | 0 | 85,090 | 14 | 170,180 |
Tags: combinatorics, dp, number theory, probabilities, two pointers
Correct Solution:
```
mod = 10 ** 9 + 7
MAX = 2 * 10 ** 5+2
r = [1] * MAX
factorial = [1] * MAX
rfactorial = [1] * MAX
rp = [1] * MAX
#Permite precalcular factorial hasta "MAX", para evitar tener que calcularlo varias veces
#dentro de la ejecucio... | output | 1 | 85,090 | 14 | 170,181 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Today Adilbek is taking his probability theory test. Unfortunately, when Adilbek arrived at the university, there had already been a long queue of students wanting to take the same test. Adilbek has estimated that he will be able to start th... | instruction | 0 | 85,091 | 14 | 170,182 |
Tags: combinatorics, dp, number theory, probabilities, two pointers
Correct Solution:
```
MOD = 10 ** 9 + 7
MAX = 5 * 10 ** 5
fac, ifac = [1] * MAX, [1] * MAX
for i in range(2, MAX):
fac[i] = fac[i - 1] * i % MOD
ifac[-1] = pow(fac[-1], MOD - 2, MOD)
for i in range(MAX - 2, 1, -1):
ifac[i] = ifac[i + 1] * (i + ... | output | 1 | 85,091 | 14 | 170,183 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Today Adilbek is taking his probability theory test. Unfortunately, when Adilbek arrived at the university, there had already been a long queue of students wanting to take the same test. Adilbek has estimated that he will be able to start th... | instruction | 0 | 85,092 | 14 | 170,184 |
Tags: combinatorics, dp, number theory, probabilities, two pointers
Correct Solution:
```
from sys import stdin, stdout, exit
mod = 10**9 + 7
def modinv(x):
return pow(x, mod-2, mod)
N = 2*10**5 + 10
facts = [1]*N
for i in range(1,N):
facts[i] = facts[i-1] * i
facts[i] %= mod
def binom(n, k):
ans = ... | output | 1 | 85,092 | 14 | 170,185 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Today Adilbek is taking his probability theory test. Unfortunately, when Adilbek arrived at the university, there had already been a long queue of students wanting to take the same test. Adilbek has estimated that he will be able to start th... | instruction | 0 | 85,093 | 14 | 170,186 |
Tags: combinatorics, dp, number theory, probabilities, two pointers
Correct Solution:
```
mod = 10 ** 9 + 7
MAX = 2 * 10 ** 5+2
r = [1] * MAX
factorial = [1] * MAX
rfactorial = [1] * MAX
rp = [1] * MAX
for i in range(2, MAX):
factorial[i] = i * factorial[i - 1] % mod
r[i] = mod - (mod // i) * r[mod%i] ... | output | 1 | 85,093 | 14 | 170,187 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Today Adilbek is taking his probability theory test. Unfortunately, when Adilbek arrived at the university, there had already been a long queue of students wanting to take the same test. Adilbek has estimated that he will be able to start th... | instruction | 0 | 85,094 | 14 | 170,188 |
Tags: combinatorics, dp, number theory, probabilities, two pointers
Correct Solution:
```
mod = 10 ** 9 + 7
MAX = 2 * 10 ** 5+2
n, T = list(map(int, input().split()))
t = [0]
t += list(map(int, input().split()))
t += [MAX]
r = [1] * MAX
factorial = [1] * MAX
rfactorial = [1] * MAX
rp = [1] * MAX
sim = 0
sim_... | output | 1 | 85,094 | 14 | 170,189 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Today Adilbek is taking his probability theory test. Unfortunately, when Adilbek arrived at the university, there had already been a long queue of students wanting to take the same test. Adilbek has estimated that he will be able to start th... | instruction | 0 | 85,095 | 14 | 170,190 |
Tags: combinatorics, dp, number theory, probabilities, two pointers
Correct Solution:
```
mod = 10 ** 9 + 7
MAX = 2 * 10 ** 5 + 10
r = [1] * MAX
f = [1] * MAX
rf = [1] * MAX
rp2 = [1] * MAX
for i in range(2, MAX):
f[i] = f[i - 1] * i % mod
r[i] = mod - (mod // i) * r[mod%i] % mod
rf[... | output | 1 | 85,095 | 14 | 170,191 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Today Adilbek is taking his probability theory test. Unfortunately, when Adilbek arrived at the university, there had already been a long queue of students wanting to take the same test. Adilbek has estimated that he will be able to start th... | instruction | 0 | 85,096 | 14 | 170,192 |
Tags: combinatorics, dp, number theory, probabilities, two pointers
Correct Solution:
```
mod = 10 ** 9 + 7
MAX = 2 * 10 ** 5+1
r = [1] * MAX
factorial = [1] * MAX
rfactorial = [1] * MAX
rp = [1] * MAX
for i in range(2, MAX):
factorial[i] = i * factorial[i - 1] % mod
r[i] = mod - (mod // i) * r[mod%i] ... | output | 1 | 85,096 | 14 | 170,193 |
Provide tags and a correct Python 3 solution for this coding contest problem.
The only difference between easy and hard versions are constraints on n and k.
You are messaging in one of the popular social networks via your smartphone. Your smartphone can show at most k most recent conversations with your friends. Init... | instruction | 0 | 85,101 | 14 | 170,202 |
Tags: implementation
Correct Solution:
```
n,k=map(int, input().split())
l=list(map(int, input().split()))
y=[]
x=set()
for i in l:
if i not in x:
x.add(i)
y.append(i)
if len(x)>k:
x.remove(y[0])
y.pop(0)
print(len(x))
print(*y[::-1])
``` | output | 1 | 85,101 | 14 | 170,203 |
Provide tags and a correct Python 3 solution for this coding contest problem.
The only difference between easy and hard versions are constraints on n and k.
You are messaging in one of the popular social networks via your smartphone. Your smartphone can show at most k most recent conversations with your friends. Init... | instruction | 0 | 85,102 | 14 | 170,204 |
Tags: implementation
Correct Solution:
```
n, k = map(int, input().split())
d = {}
ls = []
for x in list(map(int, input().split())):
if d.get(x) == None:
d[x] = 0
ls.append(x)
if len(ls) > k:
d[ls[0]] = None
del ls[0]
print(len(ls))
ls.reverse()
print(' '.join(map(str... | output | 1 | 85,102 | 14 | 170,205 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.