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.
Have you ever used the chat application QQ? Well, in a chat group of QQ, administrators can muzzle a user for days.
In Boboniu's chat group, there's a person called Du Yi who likes to make fun of Boboniu every day.
Du will chat in the grou... | instruction | 0 | 106,322 | 14 | 212,644 |
Tags: dp, greedy, sortings, two pointers
Correct Solution:
```
N, D, M = map(int, input().split())
A = sorted(map(int, input().split()), reverse=True)
L = [a for a in A if a>M]
S = [a for a in A if a<=M]
cum_S = [0]
c = 0
for s in S:
c += s
cum_S.append(c)
d = N-1
ans = max(A)
if len(L) == 0:
print(sum(S))
... | output | 1 | 106,322 | 14 | 212,645 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Have you ever used the chat application QQ? Well, in a chat group of QQ, administrators can muzzle a user for days.
In Boboniu's chat group, there's a person called Du Yi who likes to make fun of Boboniu every day.
Du will chat in the grou... | instruction | 0 | 106,323 | 14 | 212,646 |
Tags: dp, greedy, sortings, two pointers
Correct Solution:
```
from sys import stdin
import sys
n,d,m = map(int,stdin.readline().split())
a = list(map(int,stdin.readline().split()))
a.sort()
a.reverse()
over = [0]
below = [0]
nuse = 0
for i in range(n):
if a[i] > m:
over.append(over[-1] + a[i])
... | output | 1 | 106,323 | 14 | 212,647 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Have you ever used the chat application QQ? Well, in a chat group of QQ, administrators can muzzle a user for days.
In Boboniu's chat group, there's a person called Du Yi who likes to make fun of Boboniu every day.
Du will chat in the grou... | instruction | 0 | 106,324 | 14 | 212,648 |
Tags: dp, greedy, sortings, two pointers
Correct Solution:
```
import sys
import math,bisect
from collections import defaultdict
from itertools import groupby,accumulate
from heapq import heapify,heappop,heappush
from collections import deque,Counter,OrderedDict
#input = iter(sys.stdin.buffer.read().decode().splitlines... | output | 1 | 106,324 | 14 | 212,649 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Have you ever used the chat application QQ? Well, in a chat group of QQ, administrators can muzzle a user for days.
In Boboniu's chat group, there's a person called Du Yi who likes to make fun of Boboniu every day.
Du will chat in the grou... | instruction | 0 | 106,325 | 14 | 212,650 |
Tags: dp, greedy, sortings, two pointers
Correct Solution:
```
n,d,m=map(int,input().split())
a=list(map(int,input().split()))
e,f=[i for i in a if i<=m],[i for i in a if i>m]
e.sort(reverse=True)
f.sort(reverse=True)
c=len(e)
if c==n:
print(sum(a))
exit()
l=1
r=min((n-1)//(d+1)+1,len(f))
#k's range
#e,f 's su... | output | 1 | 106,325 | 14 | 212,651 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Have you ever used the chat application QQ? Well, in a chat group of QQ, administrators can muzzle a user for days.
In Boboniu's chat group, there's a person called Du Yi who likes to make fun of Boboniu every day.
Du will chat in the grou... | instruction | 0 | 106,326 | 14 | 212,652 |
Tags: dp, greedy, sortings, two pointers
Correct Solution:
```
n, d, m = map(int, input().split())
a = list(map(int, input().split()))
small, big = [], []
for i in a:
if i > m:
big.append(i)
else:
small.append(i)
small.sort(reverse=True)
big.sort(reverse=True)
res = 0
if len(small) == 0:
cnt... | output | 1 | 106,326 | 14 | 212,653 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Have you ever used the chat application QQ? Well, in a chat group of QQ, administrators can muzzle a user for days.
In Boboniu's chat group, there's a person called Du Yi who likes to make fun of Boboniu every day.
Du will chat in the grou... | instruction | 0 | 106,327 | 14 | 212,654 |
Tags: dp, greedy, sortings, two pointers
Correct Solution:
```
# TestCases
# 5 2 11
# 8 10 15 23 5
# # 48
# 20 2 16
# 20 5 8 2 18 16 2 16 16 1 5 16 2 13 6 16 4 17 21 7
# # 195
from math import ceil
import sys
read = lambda: sys.stdin.readline().rstrip("\r\n")
def maxFun():
n, d, m = map(int, read().split())
... | output | 1 | 106,327 | 14 | 212,655 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Have you ever used the chat application QQ? Well, in a chat group of QQ, administrators can muzzle a user for days.
In Boboniu's chat group, there's a person called Du Yi who likes to make fun of Boboniu every day.
Du will chat in the grou... | instruction | 0 | 106,328 | 14 | 212,656 |
Tags: dp, greedy, sortings, two pointers
Correct Solution:
```
def solve(n, d, m, a):
a.sort()
small = sorted(x for x in a if x <= m)
scs = [0]
for x in small:
scs.append(scs[-1] + x)
sol = scs[-1]
bn = n - len(small)
take, r, sbig, possible = 1, n-1, 0, True
while possible:
... | output | 1 | 106,328 | 14 | 212,657 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Have you ever used the chat application QQ? Well, in a chat group of QQ, administrators can muzzle a user for days.
In Boboniu's chat group, there's a person called Du Yi who likes to make fun ... | instruction | 0 | 106,329 | 14 | 212,658 |
Yes | output | 1 | 106,329 | 14 | 212,659 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Have you ever used the chat application QQ? Well, in a chat group of QQ, administrators can muzzle a user for days.
In Boboniu's chat group, there's a person called Du Yi who likes to make fun ... | instruction | 0 | 106,330 | 14 | 212,660 |
Yes | output | 1 | 106,330 | 14 | 212,661 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Have you ever used the chat application QQ? Well, in a chat group of QQ, administrators can muzzle a user for days.
In Boboniu's chat group, there's a person called Du Yi who likes to make fun ... | instruction | 0 | 106,331 | 14 | 212,662 |
Yes | output | 1 | 106,331 | 14 | 212,663 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Have you ever used the chat application QQ? Well, in a chat group of QQ, administrators can muzzle a user for days.
In Boboniu's chat group, there's a person called Du Yi who likes to make fun ... | instruction | 0 | 106,332 | 14 | 212,664 |
Yes | output | 1 | 106,332 | 14 | 212,665 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Have you ever used the chat application QQ? Well, in a chat group of QQ, administrators can muzzle a user for days.
In Boboniu's chat group, there's a person called Du Yi who likes to make fun ... | instruction | 0 | 106,333 | 14 | 212,666 |
No | output | 1 | 106,333 | 14 | 212,667 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Have you ever used the chat application QQ? Well, in a chat group of QQ, administrators can muzzle a user for days.
In Boboniu's chat group, there's a person called Du Yi who likes to make fun ... | instruction | 0 | 106,334 | 14 | 212,668 |
No | output | 1 | 106,334 | 14 | 212,669 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Have you ever used the chat application QQ? Well, in a chat group of QQ, administrators can muzzle a user for days.
In Boboniu's chat group, there's a person called Du Yi who likes to make fun ... | instruction | 0 | 106,335 | 14 | 212,670 |
No | output | 1 | 106,335 | 14 | 212,671 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Have you ever used the chat application QQ? Well, in a chat group of QQ, administrators can muzzle a user for days.
In Boboniu's chat group, there's a person called Du Yi who likes to make fun ... | instruction | 0 | 106,336 | 14 | 212,672 |
No | output | 1 | 106,336 | 14 | 212,673 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Vasya has got many devices that work on electricity. He's got n supply-line filters to plug the devices, the i-th supply-line filter has ai sockets.
Overall Vasya has got m devices and k electrical sockets in his flat, he can plug the devic... | instruction | 0 | 106,444 | 14 | 212,888 |
Tags: greedy, implementation, sortings
Correct Solution:
```
import sys
import math
n, m, k = [int(x) for x in (sys.stdin.readline()).split()]
an = [int(x) for x in (sys.stdin.readline()).split()]
an.sort(reverse = True)
res = 0
i = 0
while(m > k):
if(i < n):
k -= 1
k += an[i]
i += 1
... | output | 1 | 106,444 | 14 | 212,889 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Vasya has got many devices that work on electricity. He's got n supply-line filters to plug the devices, the i-th supply-line filter has ai sockets.
Overall Vasya has got m devices and k electrical sockets in his flat, he can plug the devic... | instruction | 0 | 106,445 | 14 | 212,890 |
Tags: greedy, implementation, sortings
Correct Solution:
```
#Code by Sounak, IIESTS
#------------------------------warmup----------------------------
import os
import sys
import math
from io import BytesIO, IOBase
from fractions import Fraction
import collections
from itertools import permutations
from collections im... | output | 1 | 106,445 | 14 | 212,891 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Vasya has got many devices that work on electricity. He's got n supply-line filters to plug the devices, the i-th supply-line filter has ai sockets.
Overall Vasya has got m devices and k electrical sockets in his flat, he can plug the devic... | instruction | 0 | 106,446 | 14 | 212,892 |
Tags: greedy, implementation, sortings
Correct Solution:
```
n,m,k=map(int,input().split())
l = list(map(int,input().split()))
l.sort(reverse=True)
# l.reverse()
# print(l)
if m<=k:
print(0)
quit()
for ii,c in enumerate(l):
k+=c-1
# print(k)
if k>=m:
print('{}'.format(ii+1))
quit()
p... | output | 1 | 106,446 | 14 | 212,893 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Vasya has got many devices that work on electricity. He's got n supply-line filters to plug the devices, the i-th supply-line filter has ai sockets.
Overall Vasya has got m devices and k electrical sockets in his flat, he can plug the devic... | instruction | 0 | 106,447 | 14 | 212,894 |
Tags: greedy, implementation, sortings
Correct Solution:
```
def sockets():
n, m, k = map(int, input().split())
a = map(int, input().split())
a = sorted(a, reverse=True)
if m <= k:
print(0)
return
i = 0
for x in a:
k += x - 1
i += 1
if m <= k:
print(i)
... | output | 1 | 106,447 | 14 | 212,895 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Vasya has got many devices that work on electricity. He's got n supply-line filters to plug the devices, the i-th supply-line filter has ai sockets.
Overall Vasya has got m devices and k electrical sockets in his flat, he can plug the devic... | instruction | 0 | 106,448 | 14 | 212,896 |
Tags: greedy, implementation, sortings
Correct Solution:
```
n, m, k = list(map(int, input().rstrip().split()))
a = list(map(int, input().rstrip().split()))
a.sort(reverse=True)
if m <= k:
print(0)
else:
ans = 0
x = m
while (True):
maxm = a.pop(0)
m = m - maxm
k = k - 1
a... | output | 1 | 106,448 | 14 | 212,897 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Vasya has got many devices that work on electricity. He's got n supply-line filters to plug the devices, the i-th supply-line filter has ai sockets.
Overall Vasya has got m devices and k electrical sockets in his flat, he can plug the devic... | instruction | 0 | 106,449 | 14 | 212,898 |
Tags: greedy, implementation, sortings
Correct Solution:
```
n,m,k=map(int,input().split())
l=list(map(int,input().split()))
l.sort(reverse=True)
if(m<k):
print("0")
else:
c=k
i=0
j=0
flag=0
while(c<m):
if(i==n):
flag=1
break
c=c-1
c=c+l[i]
... | output | 1 | 106,449 | 14 | 212,899 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Vasya has got many devices that work on electricity. He's got n supply-line filters to plug the devices, the i-th supply-line filter has ai sockets.
Overall Vasya has got m devices and k electrical sockets in his flat, he can plug the devic... | instruction | 0 | 106,450 | 14 | 212,900 |
Tags: greedy, implementation, sortings
Correct Solution:
```
n,m,k=map(int,input().split())
arr=list(map(int,input().split()))
arr.sort()
arr=arr+[k]
ans=0
s=0
while ans<n+1:
s+=arr[-ans-1]
if s>=m:
break
ans+=1
s-=1
if s>=m:
print(ans)
else:
print("-1")
``` | output | 1 | 106,450 | 14 | 212,901 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Vasya has got many devices that work on electricity. He's got n supply-line filters to plug the devices, the i-th supply-line filter has ai sockets.
Overall Vasya has got m devices and k electrical sockets in his flat, he can plug the devic... | instruction | 0 | 106,451 | 14 | 212,902 |
Tags: greedy, implementation, sortings
Correct Solution:
```
import math
import os
import random
import re
import sys
import functools
from operator import itemgetter, attrgetter
if __name__ == '__main__':
n, m, k = list(map(int, input().strip().split()))
a, b, i = list(map(int, input().strip().split())), 0, 0... | output | 1 | 106,451 | 14 | 212,903 |
Provide tags and a correct Python 3 solution for this coding contest problem.
During the lunch break all n Berland State University students lined up in the food court. However, it turned out that the food court, too, has a lunch break and it temporarily stopped working.
Standing in a queue that isn't being served is... | instruction | 0 | 106,558 | 14 | 213,116 |
Tags: dsu, implementation
Correct Solution:
```
s1,s2,d,v = set(),set(),{},[]
for _ in range(int(input())):
a,b = map(int,input().split())
d[a]=b;s1.add(a);s2.add(b)
v.append(list(s1-s2)[0]);v.append(d[0])
while 1:
try:v.append(d[v[-2]]);v.append(d[v[-2]])
except:v.pop();print(*v);break
``` | output | 1 | 106,558 | 14 | 213,117 |
Provide tags and a correct Python 3 solution for this coding contest problem.
During the lunch break all n Berland State University students lined up in the food court. However, it turned out that the food court, too, has a lunch break and it temporarily stopped working.
Standing in a queue that isn't being served is... | instruction | 0 | 106,559 | 14 | 213,118 |
Tags: dsu, implementation
Correct Solution:
```
n=int(input());
a=[];
ab=1000002*[-1];
b=1000002*[0];
res=[0,0]
for i in range(n):
[aa,bb]=[int(i) for i in input().split()];
a.append(aa);
ab[aa]=bb;
b[bb]=1;
if(aa==0):
res[1]=bb;
for i in a:
if b[i]==0:
res[0]=i;
for i in range(2... | output | 1 | 106,559 | 14 | 213,119 |
Provide tags and a correct Python 3 solution for this coding contest problem.
During the lunch break all n Berland State University students lined up in the food court. However, it turned out that the food court, too, has a lunch break and it temporarily stopped working.
Standing in a queue that isn't being served is... | instruction | 0 | 106,560 | 14 | 213,120 |
Tags: dsu, implementation
Correct Solution:
```
from sys import stdin, stdout
fin = stdin
fout = stdout
n = int(fin.readline().rstrip())
q = []
d = dict()
a = dict()
for i in range(n):
q.append(list(map(int, fin.readline().split())))
a[q[i][0]] = q[i][1]
if q[i][0] not in d:
d[q[i][0]] = 0
d[q[i... | output | 1 | 106,560 | 14 | 213,121 |
Provide tags and a correct Python 3 solution for this coding contest problem.
During the lunch break all n Berland State University students lined up in the food court. However, it turned out that the food court, too, has a lunch break and it temporarily stopped working.
Standing in a queue that isn't being served is... | instruction | 0 | 106,561 | 14 | 213,122 |
Tags: dsu, implementation
Correct Solution:
```
ab = {}
ba = {}
n = int(input())
res = [None]*n
for _ in range(n):
a, b = input().split()
ab[a], ba[b] = b, a
z = "0"
for i in range(1, n, 2):
res[i] = z = ab[z]
if n&1:#=1
n += 1
for x in ba:
if x not in ab:
ba["0"] = x
break
z = "0"
for i in r... | output | 1 | 106,561 | 14 | 213,123 |
Provide tags and a correct Python 3 solution for this coding contest problem.
During the lunch break all n Berland State University students lined up in the food court. However, it turned out that the food court, too, has a lunch break and it temporarily stopped working.
Standing in a queue that isn't being served is... | instruction | 0 | 106,562 | 14 | 213,124 |
Tags: dsu, implementation
Correct Solution:
```
from sys import stdin
n = int(input())
graph = {}
for _ in range(1, n + 1):
ai, bi = input().split()
graph[ai] = bi
ans = [0] * n
ans[0] = (set(graph.keys()) - set(graph.values())).pop()
ans[1] = graph['0']
for i in range(2, n):
ans[i] = graph[ans[i - 2]]
p... | output | 1 | 106,562 | 14 | 213,125 |
Provide tags and a correct Python 3 solution for this coding contest problem.
During the lunch break all n Berland State University students lined up in the food court. However, it turned out that the food court, too, has a lunch break and it temporarily stopped working.
Standing in a queue that isn't being served is... | instruction | 0 | 106,563 | 14 | 213,126 |
Tags: dsu, implementation
Correct Solution:
```
n=int(input())
d={}
t={}
for i in range(n):
Qi,Pi=list(map(int,input().split()))
d[Qi]=Pi
t[Pi]=Qi
ans = [list(filter(lambda x:t.get(x)==None,d.keys()))[0],d.get(0)]
for i in range(2,n):
ans.append(d.get(ans[i-2]))
print(*ans)
``` | output | 1 | 106,563 | 14 | 213,127 |
Provide tags and a correct Python 3 solution for this coding contest problem.
During the lunch break all n Berland State University students lined up in the food court. However, it turned out that the food court, too, has a lunch break and it temporarily stopped working.
Standing in a queue that isn't being served is... | instruction | 0 | 106,564 | 14 | 213,128 |
Tags: dsu, implementation
Correct Solution:
```
from collections import defaultdict, deque, Counter, OrderedDict
from bisect import insort, bisect_right, bisect_left
import threading, sys
def main():
n = int(input())
adj, rdj = {}, {}
ans = [0]*n
for i in range(n):
a, b = map(int, input().split... | output | 1 | 106,564 | 14 | 213,129 |
Provide tags and a correct Python 3 solution for this coding contest problem.
During the lunch break all n Berland State University students lined up in the food court. However, it turned out that the food court, too, has a lunch break and it temporarily stopped working.
Standing in a queue that isn't being served is... | instruction | 0 | 106,565 | 14 | 213,130 |
Tags: dsu, implementation
Correct Solution:
```
n = int(input())
d1 = dict()
d2 = dict()
ar = [0] * (30000000)
for i in range(n):
a, b = map(int, input().split())
ar[a] += 1
ar[b] += 1
d1[a] = b
d2[b] = a
if n % 2 == 0:
x = 0
ar1 = []
ar2 = []
while x in d1:
ar1.append(d1... | output | 1 | 106,565 | 14 | 213,131 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
During the lunch break all n Berland State University students lined up in the food court. However, it turned out that the food court, too, has a lunch break and it temporarily stopped working.
... | instruction | 0 | 106,566 | 14 | 213,132 |
Yes | output | 1 | 106,566 | 14 | 213,133 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
During the lunch break all n Berland State University students lined up in the food court. However, it turned out that the food court, too, has a lunch break and it temporarily stopped working.
... | instruction | 0 | 106,567 | 14 | 213,134 |
Yes | output | 1 | 106,567 | 14 | 213,135 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
During the lunch break all n Berland State University students lined up in the food court. However, it turned out that the food court, too, has a lunch break and it temporarily stopped working.
... | instruction | 0 | 106,568 | 14 | 213,136 |
Yes | output | 1 | 106,568 | 14 | 213,137 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
During the lunch break all n Berland State University students lined up in the food court. However, it turned out that the food court, too, has a lunch break and it temporarily stopped working.
... | instruction | 0 | 106,569 | 14 | 213,138 |
Yes | output | 1 | 106,569 | 14 | 213,139 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
During the lunch break all n Berland State University students lined up in the food court. However, it turned out that the food court, too, has a lunch break and it temporarily stopped working.
... | instruction | 0 | 106,570 | 14 | 213,140 |
No | output | 1 | 106,570 | 14 | 213,141 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
During the lunch break all n Berland State University students lined up in the food court. However, it turned out that the food court, too, has a lunch break and it temporarily stopped working.
... | instruction | 0 | 106,571 | 14 | 213,142 |
No | output | 1 | 106,571 | 14 | 213,143 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
During the lunch break all n Berland State University students lined up in the food court. However, it turned out that the food court, too, has a lunch break and it temporarily stopped working.
... | instruction | 0 | 106,572 | 14 | 213,144 |
No | output | 1 | 106,572 | 14 | 213,145 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
During the lunch break all n Berland State University students lined up in the food court. However, it turned out that the food court, too, has a lunch break and it temporarily stopped working.
... | instruction | 0 | 106,573 | 14 | 213,146 |
No | output | 1 | 106,573 | 14 | 213,147 |
Provide a correct Python 3 solution for this coding contest problem.
Haruna is a high school student. She must remember the seating arrangements in her class because she is a class president. It is too difficult task to remember if there are so many students.
That is the reason why seating rearrangement is depress ta... | instruction | 0 | 106,969 | 14 | 213,938 |
"Correct Solution:
```
while 1:
a,b=map(int,input().split())
if a==b==0: break
if a*b%2: print("no")
else: print("yes")
``` | output | 1 | 106,969 | 14 | 213,939 |
Provide a correct Python 3 solution for this coding contest problem.
Haruna is a high school student. She must remember the seating arrangements in her class because she is a class president. It is too difficult task to remember if there are so many students.
That is the reason why seating rearrangement is depress ta... | instruction | 0 | 106,970 | 14 | 213,940 |
"Correct Solution:
```
while True:
a,b = map(int, input().split())
if a == 0 and b == 0:
break
if a%2 == 0 or b%2 == 0:
print("yes")
else:
print("no")
``` | output | 1 | 106,970 | 14 | 213,941 |
Provide a correct Python 3 solution for this coding contest problem.
Haruna is a high school student. She must remember the seating arrangements in her class because she is a class president. It is too difficult task to remember if there are so many students.
That is the reason why seating rearrangement is depress ta... | instruction | 0 | 106,971 | 14 | 213,942 |
"Correct Solution:
```
while True:
r, c = map(int, input().split())
if r == 0:
break
print(["yes", "no"][c % 2 and r % 2])
``` | output | 1 | 106,971 | 14 | 213,943 |
Provide a correct Python 3 solution for this coding contest problem.
Haruna is a high school student. She must remember the seating arrangements in her class because she is a class president. It is too difficult task to remember if there are so many students.
That is the reason why seating rearrangement is depress ta... | instruction | 0 | 106,972 | 14 | 213,944 |
"Correct Solution:
```
# AOJ 1072: Rearranging Seats
# Python3 2018.7.10 bal4u
while True:
r, c = map(int, input().split())
if r == 0: break
print("no" if r*c & 1 else "yes")
``` | output | 1 | 106,972 | 14 | 213,945 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Iahub and Iahubina went to a picnic in a forest full of trees. Less than 5 minutes passed before Iahub remembered of trees from programming. Moreover, he invented a new problem and Iahubina has to solve it, otherwise Iahub won't give her the... | instruction | 0 | 107,329 | 14 | 214,658 |
Tags: bitmasks, constructive algorithms, dp, greedy, trees
Correct Solution:
```
def DFS(x):
for i in range(x):
if(Seen[i][x]):
continue
if(Rem[i]>=C[x]):
if(Rem[i]==C[x] and len(Children[i])==0):
continue
Rem[i]-=C[x]
Parent[x]=i
... | output | 1 | 107,329 | 14 | 214,659 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Iahub and Iahubina went to a picnic in a forest full of trees. Less than 5 minutes passed before Iahub remembered of trees from programming. Moreover, he invented a new problem and Iahubina has to solve it, otherwise Iahub won't give her the... | instruction | 0 | 107,330 | 14 | 214,660 |
Tags: bitmasks, constructive algorithms, dp, greedy, trees
Correct Solution:
```
def DFS(x):
for i in range(x):
if(Seen[i][x]):
continue
if(Rem[i]>=C[x]):
if(Rem[i]==C[x] and len(Children[i])==0):
continue
Rem[i]-=C[x]
Parent[x]=i
... | output | 1 | 107,330 | 14 | 214,661 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Iahub and Iahubina went to a picnic in a forest full of trees. Less than 5 minutes passed before Iahub remembered of trees from programming. Moreover, he invented a new problem and Iahubina has to solve it, otherwise Iahub won't give her the... | instruction | 0 | 107,331 | 14 | 214,662 |
Tags: bitmasks, constructive algorithms, dp, greedy, trees
Correct Solution:
```
def DFS(x):
for i in range(x):
if(Seen[i][x]):
continue
if(Rem[i]>=C[x]):
if(Rem[i]==C[x] and len(Children[i])==0):
continue
Rem[i]-=C[x]
Parent[x]... | output | 1 | 107,331 | 14 | 214,663 |
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,375 | 14 | 214,750 |
Tags: implementation
Correct Solution:
```
def cpd(fd,sd,k):
d=sd-fd-1
return d//k
n,k=[int(x) for x in input().split(' ')]
vp=[int(x) for x in input().split(' ')]
np=vp[0]
vp[0]=0
vp.append(n+1)
sm=len(vp)-2
for c in range(len(vp)-1):
sm+=cpd(vp[c],vp[c+1],k)
print(sm)
``` | output | 1 | 107,375 | 14 | 214,751 |
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,376 | 14 | 214,752 |
Tags: implementation
Correct Solution:
```
n, k = map(int, input().split())
c = list(map(int, input().split()))[1:]
present = [0] * n
for i in c:
present[i - 1] = 1
prev = -1
d = 0
for i in range(n):
if i - prev == k:
d += 1
prev = i
elif present[i] == 1:
prev = i
d += 1
prin... | output | 1 | 107,376 | 14 | 214,753 |
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,377 | 14 | 214,754 |
Tags: implementation
Correct Solution:
```
import math
# from _54AArray import *
# from colorama import Fore,Back,Style,init
# from pipenv.vendor.yaspin.termcolor import colored
def print_input():
print("n is",n)
print("k is",k)
print("c is",c)
def func_exe(n,k,c):
cn = len(c)
if cn == 0:
... | output | 1 | 107,377 | 14 | 214,755 |
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,378 | 14 | 214,756 |
Tags: implementation
Correct Solution:
```
def find_in_range(arr: list, start: int, end: int) -> int:
for i in range(start, end + 1):
if i in arr:
return i
return -1
n, k = [int(item) for item in input().split(" ")]
holidays = [int(item) for item in input().split(" ")]
# holidays.remove(ho... | output | 1 | 107,378 | 14 | 214,757 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.