message stringlengths 2 67k | message_type stringclasses 2
values | message_id int64 0 1 | conversation_id int64 463 109k | cluster float64 19 19 | __index_level_0__ int64 926 217k |
|---|---|---|---|---|---|
Provide tags and a correct Python 3 solution for this coding contest problem.
Nauuo is a girl who loves playing cards.
One day she was playing cards but found that the cards were mixed with some empty ones.
There are n cards numbered from 1 to n, and they were mixed with another n empty cards. She piled up the 2n ca... | instruction | 0 | 64,053 | 19 | 128,106 |
Tags: greedy, implementation
Correct Solution:
```
import sys
input = sys.stdin.readline
N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
tmp = B[-1]
ok = True
if tmp != 0:
for i in reversed(range(N)):
b = B[i]
if tmp-(N-1-i) > 0:
if b != tmp-(N-... | output | 1 | 64,053 | 19 | 128,107 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Nauuo is a girl who loves playing cards.
One day she was playing cards but found that the cards were mixed with some empty ones.
There are n cards numbered from 1 to n, and they were mixed with another n empty cards. She piled up the 2n ca... | instruction | 0 | 64,054 | 19 | 128,108 |
Tags: greedy, implementation
Correct Solution:
```
from collections import defaultdict as dd
import math
import sys
input=sys.stdin.readline
def nn():
return int(input())
def li():
return list(input())
def mi():
return map(int, input().split())
def lm():
return list(map(int, input().split()))
n=nn()
hand=lm()... | output | 1 | 64,054 | 19 | 128,109 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Nauuo is a girl who loves playing cards.
One day she was playing cards but found that the cards were mixed with some empty ones.
There are n cards numbered from 1 to n, and they were mixed with another n empty cards. She piled up the 2n ca... | instruction | 0 | 64,055 | 19 | 128,110 |
Tags: greedy, implementation
Correct Solution:
```
n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
avail = [0 for i in range(n+1)]
cont = False
for i in range(n):
avail[b[i]] = i + 1
if cont and b[i-1] != b[i] - 1:
cont = False
if b[i] == 1:
cont = T... | output | 1 | 64,055 | 19 | 128,111 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Nauuo is a girl who loves playing cards.
One day she was playing cards but found that the cards were mixed with some empty ones.
There are n cards numbered from 1 to n, and they were mixed wit... | instruction | 0 | 64,056 | 19 | 128,112 |
Yes | output | 1 | 64,056 | 19 | 128,113 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Nauuo is a girl who loves playing cards.
One day she was playing cards but found that the cards were mixed with some empty ones.
There are n cards numbered from 1 to n, and they were mixed wit... | instruction | 0 | 64,057 | 19 | 128,114 |
Yes | output | 1 | 64,057 | 19 | 128,115 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Nauuo is a girl who loves playing cards.
One day she was playing cards but found that the cards were mixed with some empty ones.
There are n cards numbered from 1 to n, and they were mixed wit... | instruction | 0 | 64,058 | 19 | 128,116 |
Yes | output | 1 | 64,058 | 19 | 128,117 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Nauuo is a girl who loves playing cards.
One day she was playing cards but found that the cards were mixed with some empty ones.
There are n cards numbered from 1 to n, and they were mixed wit... | instruction | 0 | 64,059 | 19 | 128,118 |
Yes | output | 1 | 64,059 | 19 | 128,119 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Nauuo is a girl who loves playing cards.
One day she was playing cards but found that the cards were mixed with some empty ones.
There are n cards numbered from 1 to n, and they were mixed wit... | instruction | 0 | 64,060 | 19 | 128,120 |
No | output | 1 | 64,060 | 19 | 128,121 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Nauuo is a girl who loves playing cards.
One day she was playing cards but found that the cards were mixed with some empty ones.
There are n cards numbered from 1 to n, and they were mixed wit... | instruction | 0 | 64,061 | 19 | 128,122 |
No | output | 1 | 64,061 | 19 | 128,123 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Nauuo is a girl who loves playing cards.
One day she was playing cards but found that the cards were mixed with some empty ones.
There are n cards numbered from 1 to n, and they were mixed wit... | instruction | 0 | 64,062 | 19 | 128,124 |
No | output | 1 | 64,062 | 19 | 128,125 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Nauuo is a girl who loves playing cards.
One day she was playing cards but found that the cards were mixed with some empty ones.
There are n cards numbered from 1 to n, and they were mixed wit... | instruction | 0 | 64,063 | 19 | 128,126 |
No | output | 1 | 64,063 | 19 | 128,127 |
Provide tags and a correct Python 3 solution for this coding contest problem.
The game of Berland poker is played with a deck of n cards, m of which are jokers. k players play this game (n is divisible by k).
At the beginning of the game, each player takes n/k cards from the deck (so each card is taken by exactly one... | instruction | 0 | 64,132 | 19 | 128,264 |
Tags: brute force, greedy, math
Correct Solution:
```
t=int(input())
for _ in range(t):
n,m,k=input().split()
n=int(n)
m=int(m)
k=int(k)
p=n//k
if(m-p <0):
print(m)
else:
left=m-p
x=left/(k-1)
if(int(x)==x):
print(int(p-x))
else:
... | output | 1 | 64,132 | 19 | 128,265 |
Provide tags and a correct Python 3 solution for this coding contest problem.
The game of Berland poker is played with a deck of n cards, m of which are jokers. k players play this game (n is divisible by k).
At the beginning of the game, each player takes n/k cards from the deck (so each card is taken by exactly one... | instruction | 0 | 64,133 | 19 | 128,266 |
Tags: brute force, greedy, math
Correct Solution:
```
t = int(input())
while t > 0:
[n, m, k] = [int(x) for x in input().split()]
if m <= n//k:
print(m)
else:
arr = []
max1 = n//k
remaining_cards = m - max1
equal = remaining_cards//(k-1)
# print... | output | 1 | 64,133 | 19 | 128,267 |
Provide tags and a correct Python 3 solution for this coding contest problem.
The game of Berland poker is played with a deck of n cards, m of which are jokers. k players play this game (n is divisible by k).
At the beginning of the game, each player takes n/k cards from the deck (so each card is taken by exactly one... | instruction | 0 | 64,134 | 19 | 128,268 |
Tags: brute force, greedy, math
Correct Solution:
```
tests=int(input())
for _ in range(tests):
n,m,k=map(int,input().split())
if m<=n//k:
print(m)
continue
else:
x=n//k
rem=m-x
y=rem//(k-1)
if rem%(k-1) !=0:
y+=1
print(x-y)
... | output | 1 | 64,134 | 19 | 128,269 |
Provide tags and a correct Python 3 solution for this coding contest problem.
The game of Berland poker is played with a deck of n cards, m of which are jokers. k players play this game (n is divisible by k).
At the beginning of the game, each player takes n/k cards from the deck (so each card is taken by exactly one... | instruction | 0 | 64,135 | 19 | 128,270 |
Tags: brute force, greedy, math
Correct Solution:
```
for _ in range(int(input())):
n,m,k=map(int,input().split())
y=n/k
if y>=m:
print(m)
else:
if (m-y)%(k-1) != 0:
print(int(y-1-(m-y)//(k-1)))
else:
print(int(y-((m-y)/(k-1))))
``` | output | 1 | 64,135 | 19 | 128,271 |
Provide tags and a correct Python 3 solution for this coding contest problem.
The game of Berland poker is played with a deck of n cards, m of which are jokers. k players play this game (n is divisible by k).
At the beginning of the game, each player takes n/k cards from the deck (so each card is taken by exactly one... | instruction | 0 | 64,136 | 19 | 128,272 |
Tags: brute force, greedy, math
Correct Solution:
```
n = int(input())
for i in range(n):
n,m,k = map(int,input().split(" "))
a = n//k
if m >a:
c = m-a
e = c//(k-1)
if c%(k-1) !=0:
b = a - (e+1)
else:
b= a-e
else:
b = m
print(b)
``` | output | 1 | 64,136 | 19 | 128,273 |
Provide tags and a correct Python 3 solution for this coding contest problem.
The game of Berland poker is played with a deck of n cards, m of which are jokers. k players play this game (n is divisible by k).
At the beginning of the game, each player takes n/k cards from the deck (so each card is taken by exactly one... | instruction | 0 | 64,137 | 19 | 128,274 |
Tags: brute force, greedy, math
Correct Solution:
```
def cap(n, m, k):
t = n // k
if m > t:
# print(m, t)
rem = m - t
pl = k - 1
if rem <= pl:
print(t-1)
else:
if rem%pl==0:
print(t-rem//pl)
else:
print... | output | 1 | 64,137 | 19 | 128,275 |
Provide tags and a correct Python 3 solution for this coding contest problem.
The game of Berland poker is played with a deck of n cards, m of which are jokers. k players play this game (n is divisible by k).
At the beginning of the game, each player takes n/k cards from the deck (so each card is taken by exactly one... | instruction | 0 | 64,138 | 19 | 128,276 |
Tags: brute force, greedy, math
Correct Solution:
```
### A. Berland Poker
for _ in range(int(input())):
card,joker,player = map(int, input().split())
get = card//player
if joker <= get:
print(joker)
else:
left = joker - get
num, div = left, (player-1)
ans= [nu... | output | 1 | 64,138 | 19 | 128,277 |
Provide tags and a correct Python 3 solution for this coding contest problem.
The game of Berland poker is played with a deck of n cards, m of which are jokers. k players play this game (n is divisible by k).
At the beginning of the game, each player takes n/k cards from the deck (so each card is taken by exactly one... | instruction | 0 | 64,139 | 19 | 128,278 |
Tags: brute force, greedy, math
Correct Solution:
```
import sys
def input(): return sys.stdin.readline().strip()
def list2d(a, b, c): return [[c] * b for i in range(a)]
def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]
def list4d(a, b, c, d, e): return [[[[e] * d for j in range(c)] for j ... | output | 1 | 64,139 | 19 | 128,279 |
Provide tags and a correct Python 2 solution for this coding contest problem.
The game of Berland poker is played with a deck of n cards, m of which are jokers. k players play this game (n is divisible by k).
At the beginning of the game, each player takes n/k cards from the deck (so each card is taken by exactly one... | instruction | 0 | 64,140 | 19 | 128,280 |
Tags: brute force, greedy, math
Correct Solution:
```
from sys import stdin, stdout
from collections import Counter, defaultdict
from itertools import permutations, combinations
raw_input = stdin.readline
pr = stdout.write
mod=10**9+7
def ni():
return int(raw_input())
def li():
return map(int,raw_input().spl... | output | 1 | 64,140 | 19 | 128,281 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
The game of Berland poker is played with a deck of n cards, m of which are jokers. k players play this game (n is divisible by k).
At the beginning of the game, each player takes n/k cards from... | instruction | 0 | 64,141 | 19 | 128,282 |
Yes | output | 1 | 64,141 | 19 | 128,283 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
The game of Berland poker is played with a deck of n cards, m of which are jokers. k players play this game (n is divisible by k).
At the beginning of the game, each player takes n/k cards from... | instruction | 0 | 64,142 | 19 | 128,284 |
Yes | output | 1 | 64,142 | 19 | 128,285 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
The game of Berland poker is played with a deck of n cards, m of which are jokers. k players play this game (n is divisible by k).
At the beginning of the game, each player takes n/k cards from... | instruction | 0 | 64,143 | 19 | 128,286 |
Yes | output | 1 | 64,143 | 19 | 128,287 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
The game of Berland poker is played with a deck of n cards, m of which are jokers. k players play this game (n is divisible by k).
At the beginning of the game, each player takes n/k cards from... | instruction | 0 | 64,144 | 19 | 128,288 |
Yes | output | 1 | 64,144 | 19 | 128,289 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
The game of Berland poker is played with a deck of n cards, m of which are jokers. k players play this game (n is divisible by k).
At the beginning of the game, each player takes n/k cards from... | instruction | 0 | 64,145 | 19 | 128,290 |
No | output | 1 | 64,145 | 19 | 128,291 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
The game of Berland poker is played with a deck of n cards, m of which are jokers. k players play this game (n is divisible by k).
At the beginning of the game, each player takes n/k cards from... | instruction | 0 | 64,146 | 19 | 128,292 |
No | output | 1 | 64,146 | 19 | 128,293 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
The game of Berland poker is played with a deck of n cards, m of which are jokers. k players play this game (n is divisible by k).
At the beginning of the game, each player takes n/k cards from... | instruction | 0 | 64,147 | 19 | 128,294 |
No | output | 1 | 64,147 | 19 | 128,295 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
The game of Berland poker is played with a deck of n cards, m of which are jokers. k players play this game (n is divisible by k).
At the beginning of the game, each player takes n/k cards from... | instruction | 0 | 64,148 | 19 | 128,296 |
No | output | 1 | 64,148 | 19 | 128,297 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Mike and some bears are playing a game just for fun. Mike is the judge. All bears except Mike are standing in an n × m grid, there's exactly one bear in each cell. We denote the bear standing in column number j of row number i by (i, j). Mik... | instruction | 0 | 64,387 | 19 | 128,774 |
Tags: brute force, dp, greedy, implementation
Correct Solution:
```
def fff(i):
global a
global m
t=0
max=0
for j in range(m+1):
if a[i][j]==0:
if t>max:
max=t
t=0
else:
t=t+1
return max
n,m,q=map(int,input().split())
a=[]
s=[]... | output | 1 | 64,387 | 19 | 128,775 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Mike and some bears are playing a game just for fun. Mike is the judge. All bears except Mike are standing in an n × m grid, there's exactly one bear in each cell. We denote the bear standing in column number j of row number i by (i, j). Mik... | instruction | 0 | 64,388 | 19 | 128,776 |
Tags: brute force, dp, greedy, implementation
Correct Solution:
```
def line_score(row):
m = 0
c = 0
for elem in row:
if elem == 1:
c += 1
else:
c = 0
m = max(c, m)
return m
n, m, q = [int(x) for x in input().split(' ')]
grid = [[int(x) for x in input().s... | output | 1 | 64,388 | 19 | 128,777 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Mike and some bears are playing a game just for fun. Mike is the judge. All bears except Mike are standing in an n × m grid, there's exactly one bear in each cell. We denote the bear standing in column number j of row number i by (i, j). Mik... | instruction | 0 | 64,389 | 19 | 128,778 |
Tags: brute force, dp, greedy, implementation
Correct Solution:
```
import sys
input = sys.stdin.readline
def multi_input():
return map(int, input().split())
def array_print(arr):
print(' '.join(map(str, arr)))
def findsum(arr):
ans = 0
max1 = 0
for i in arr:
if i==1:
ans+=1
... | output | 1 | 64,389 | 19 | 128,779 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Mike and some bears are playing a game just for fun. Mike is the judge. All bears except Mike are standing in an n × m grid, there's exactly one bear in each cell. We denote the bear standing in column number j of row number i by (i, j). Mik... | instruction | 0 | 64,390 | 19 | 128,780 |
Tags: brute force, dp, greedy, implementation
Correct Solution:
```
f = lambda s: max(map(len, ''.join(s).split('0')))
n, m, q = map(int, input().split())
a = [input().split() for i in range(n)]
b = list(map(f, a))
c = [list(map(int, input().split())) for i in range(q)]
for x, y in c:
a[x - 1][y - 1] = str(1 - int(... | output | 1 | 64,390 | 19 | 128,781 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Mike and some bears are playing a game just for fun. Mike is the judge. All bears except Mike are standing in an n × m grid, there's exactly one bear in each cell. We denote the bear standing in column number j of row number i by (i, j). Mik... | instruction | 0 | 64,391 | 19 | 128,782 |
Tags: brute force, dp, greedy, implementation
Correct Solution:
```
def kadane(lst):
ans = s = 0
for n in lst:
if n == 0:
ans = max(ans, s)
s = 0
else:
s += 1
return max(ans, s)
if __name__ == '__main__':
n,m,q = map(int, input().split())
f = []
... | output | 1 | 64,391 | 19 | 128,783 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Mike and some bears are playing a game just for fun. Mike is the judge. All bears except Mike are standing in an n × m grid, there's exactly one bear in each cell. We denote the bear standing in column number j of row number i by (i, j). Mik... | instruction | 0 | 64,392 | 19 | 128,784 |
Tags: brute force, dp, greedy, implementation
Correct Solution:
```
n, m, q = map(int, input().split())
xs = [list(map(int, input().split())) for i in range(n)]
def go(xs):
answer, total = 0, 0
for x in xs:
total = total + 1 if x else 0
answer = total if total > answer else answer
return... | output | 1 | 64,392 | 19 | 128,785 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Mike and some bears are playing a game just for fun. Mike is the judge. All bears except Mike are standing in an n × m grid, there's exactly one bear in each cell. We denote the bear standing in column number j of row number i by (i, j). Mik... | instruction | 0 | 64,393 | 19 | 128,786 |
Tags: brute force, dp, greedy, implementation
Correct Solution:
```
def conta(mat):
combo = 0
maior = 0
for l in range(len(mat)):
if mat[l]==1:
combo+=1
elif combo>0:
if combo>maior:
maior = combo
combo =0
if combo>maior:
maior = combo
return maior
i,j,t = [int(z) for z in input().split(" ")]... | output | 1 | 64,393 | 19 | 128,787 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Mike and some bears are playing a game just for fun. Mike is the judge. All bears except Mike are standing in an n × m grid, there's exactly one bear in each cell. We denote the bear standing in column number j of row number i by (i, j). Mik... | instruction | 0 | 64,394 | 19 | 128,788 |
Tags: brute force, dp, greedy, implementation
Correct Solution:
```
def calc(li,m):
ans=0
count=0
for i in range(m):
if li[i]==1:
count+=1
else:
count=0
ans=max(ans,count)
return ans
n,m,q=map(int,input().split())
adj=[]
for i in range(n):
li=list(map(int,input().split()))
adj.appen... | output | 1 | 64,394 | 19 | 128,789 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Mike and some bears are playing a game just for fun. Mike is the judge. All bears except Mike are standing in an n × m grid, there's exactly one bear in each cell. We denote the bear standing in... | instruction | 0 | 64,395 | 19 | 128,790 |
Yes | output | 1 | 64,395 | 19 | 128,791 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Mike and some bears are playing a game just for fun. Mike is the judge. All bears except Mike are standing in an n × m grid, there's exactly one bear in each cell. We denote the bear standing in... | instruction | 0 | 64,396 | 19 | 128,792 |
Yes | output | 1 | 64,396 | 19 | 128,793 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Mike and some bears are playing a game just for fun. Mike is the judge. All bears except Mike are standing in an n × m grid, there's exactly one bear in each cell. We denote the bear standing in... | instruction | 0 | 64,397 | 19 | 128,794 |
Yes | output | 1 | 64,397 | 19 | 128,795 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Mike and some bears are playing a game just for fun. Mike is the judge. All bears except Mike are standing in an n × m grid, there's exactly one bear in each cell. We denote the bear standing in... | instruction | 0 | 64,398 | 19 | 128,796 |
Yes | output | 1 | 64,398 | 19 | 128,797 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Mike and some bears are playing a game just for fun. Mike is the judge. All bears except Mike are standing in an n × m grid, there's exactly one bear in each cell. We denote the bear standing in... | instruction | 0 | 64,399 | 19 | 128,798 |
No | output | 1 | 64,399 | 19 | 128,799 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Mike and some bears are playing a game just for fun. Mike is the judge. All bears except Mike are standing in an n × m grid, there's exactly one bear in each cell. We denote the bear standing in... | instruction | 0 | 64,400 | 19 | 128,800 |
No | output | 1 | 64,400 | 19 | 128,801 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Mike and some bears are playing a game just for fun. Mike is the judge. All bears except Mike are standing in an n × m grid, there's exactly one bear in each cell. We denote the bear standing in... | instruction | 0 | 64,401 | 19 | 128,802 |
No | output | 1 | 64,401 | 19 | 128,803 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Mike and some bears are playing a game just for fun. Mike is the judge. All bears except Mike are standing in an n × m grid, there's exactly one bear in each cell. We denote the bear standing in... | instruction | 0 | 64,402 | 19 | 128,804 |
No | output | 1 | 64,402 | 19 | 128,805 |
Provide tags and a correct Python 3 solution for this coding contest problem.
This is an interactive problem. Refer to the Interaction section below for better understanding.
Ithea and Chtholly want to play a game in order to determine who can use the kitchen tonight.
<image>
Initially, Ithea puts n clear sheets of... | instruction | 0 | 64,537 | 19 | 129,074 |
Tags: binary search, constructive algorithms, games, greedy, interactive
Correct Solution:
```
import sys
n, m, c = map(int, input().split())
free = n
nums = [0] * n
for i in range(m):
pi = int(input())
if(pi > c//2):
current = n - 1
while(nums[current] > 0 and nums[current] >= pi and current ... | output | 1 | 64,537 | 19 | 129,075 |
Provide tags and a correct Python 3 solution for this coding contest problem.
This is an interactive problem. Refer to the Interaction section below for better understanding.
Ithea and Chtholly want to play a game in order to determine who can use the kitchen tonight.
<image>
Initially, Ithea puts n clear sheets of... | instruction | 0 | 64,538 | 19 | 129,076 |
Tags: binary search, constructive algorithms, games, greedy, interactive
Correct Solution:
```
import sys
n, m, c=map(int, input().split())
a=[]
for i in range(n+1):
a.append(0)
cnt=0
while cnt<n:
i=0
x=int(input())
if x*2<=c:
i=1
while a[i] and a[i]<=x:
i+=1
else:
... | output | 1 | 64,538 | 19 | 129,077 |
Provide tags and a correct Python 3 solution for this coding contest problem.
This is an interactive problem. Refer to the Interaction section below for better understanding.
Ithea and Chtholly want to play a game in order to determine who can use the kitchen tonight.
<image>
Initially, Ithea puts n clear sheets of... | instruction | 0 | 64,539 | 19 | 129,078 |
Tags: binary search, constructive algorithms, games, greedy, interactive
Correct Solution:
```
import sys
n, m, c = map(int, input().split())
free = n
nums = [0] * n
for i in range(m):
pi = int(input())
if(pi > c//2):
current = n - 1
while(nums[current] > 0 and nums[current] >= pi an... | output | 1 | 64,539 | 19 | 129,079 |
Provide tags and a correct Python 3 solution for this coding contest problem.
This is an interactive problem. Refer to the Interaction section below for better understanding.
Ithea and Chtholly want to play a game in order to determine who can use the kitchen tonight.
<image>
Initially, Ithea puts n clear sheets of... | instruction | 0 | 64,540 | 19 | 129,080 |
Tags: binary search, constructive algorithms, games, greedy, interactive
Correct Solution:
```
def get_int(string, n):
i = j = k = 0
for s in string:
k += 1
for s in string:
if i == n - 1:
break
if s == ' ':
i += 1
j += 1
i = 0
while j < k:
if string[j] == ' ':
break
i = 10 * i + int(string[j]... | output | 1 | 64,540 | 19 | 129,081 |
Provide tags and a correct Python 3 solution for this coding contest problem.
This is an interactive problem. Refer to the Interaction section below for better understanding.
Ithea and Chtholly want to play a game in order to determine who can use the kitchen tonight.
<image>
Initially, Ithea puts n clear sheets of... | instruction | 0 | 64,541 | 19 | 129,082 |
Tags: binary search, constructive algorithms, games, greedy, interactive
Correct Solution:
```
import sys
import math
N, M, C = map(int, input().split())
mid = C // 2
res = []
for i in range(0, N):
res.append(0)
l, r = 0, N - 1
for i in range(0, M):
val = int(input())
pos = 0
if (val <= mid):
for ... | output | 1 | 64,541 | 19 | 129,083 |
Provide a correct Python 3 solution for this coding contest problem.
We will host a rock-paper-scissors tournament with N people. The participants are called Person 1, Person 2, \ldots, Person N. For any two participants, the result of the match between them is determined in advance. This information is represented by... | instruction | 0 | 64,632 | 19 | 129,264 |
"Correct Solution:
```
import sys
p2D = lambda x: print(*x, sep="\n")
def II(): return int(sys.stdin.readline())
def SI(): return sys.stdin.readline()[:-1]
def pbit(aa,L):
for a in aa:print(format(a,"b").zfill(L))
print()
def main():
n=II()
aa=[[int(c) for c in SI()] for _ in range(n-1)]
#p2D(aa)
... | output | 1 | 64,632 | 19 | 129,265 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.