message stringlengths 2 43.5k | message_type stringclasses 2
values | message_id int64 0 1 | conversation_id int64 853 107k | cluster float64 24 24 | __index_level_0__ int64 1.71k 214k |
|---|---|---|---|---|---|
Provide tags and a correct Python 3 solution for this coding contest problem.
Polycarpus has got n candies and m friends (n β₯ m). He wants to make a New Year present with candies to each friend. Polycarpus is planning to present all candies and he wants to do this in the fairest (that is, most equal) manner. He wants ... | instruction | 0 | 42,403 | 24 | 84,806 |
Tags: implementation
Correct Solution:
```
n,m=map(int,input().split())
if(n%m)==0:
for i in range(m):
print(n//m,end=" ")
print()
else:
x=n%m
y=n//m
for i in range(x):
print(y+1,end=" ")
for i in range(m-x):
print(y,end=" ")
print()
``` | output | 1 | 42,403 | 24 | 84,807 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Polycarpus has got n candies and m friends (n β₯ m). He wants to make a New Year present with candies to each friend. Polycarpus is planning to present all candies and he wants to do this in the fairest (that is, most equal) manner. He wants ... | instruction | 0 | 42,404 | 24 | 84,808 |
Tags: implementation
Correct Solution:
```
import time
import collections
class Time_test:
def __enter__(self):
self.enter_time = time.time()
def __exit__(self, exc_type, exc_val, exc_tb):
print("Command was executed in", time.time()-self.enter_time)
n, m = [int(x) for x in input().split()]
pr... | output | 1 | 42,404 | 24 | 84,809 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Polycarpus has got n candies and m friends (n β₯ m). He wants to make a New Year present with candies to each friend. Polycarpus is planning to present all candies and he wants to do this in the fairest (that is, most equal) manner. He wants ... | instruction | 0 | 42,405 | 24 | 84,810 |
Tags: implementation
Correct Solution:
```
n, m = map(int, input().split())
res = []
while m:
res.append(n // m)
n -= (n // m)
m -= 1
print(*res)
``` | output | 1 | 42,405 | 24 | 84,811 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Polycarpus has got n candies and m friends (n β₯ m). He wants to make a New Year present with candies to each friend. Polycarpus is planning to present all candies and he wants to do this in the fairest (that is, most equal) manner. He wants ... | instruction | 0 | 42,406 | 24 | 84,812 |
Tags: implementation
Correct Solution:
```
n, m = map(int, input().split())
if(n%m == 0):
arr = [n//m]*m
else:
arr= [n//m + 1]*(n%m)
sm = sum(arr)
diff = n - sm
last = m - len(arr)
arr = arr + [diff//last]*last
for i in sorted(arr):
print(i,end=" ")
``` | output | 1 | 42,406 | 24 | 84,813 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Polycarpus has got n candies and m friends (n β₯ m). He wants to make a New Year present with candies to each friend. Polycarpus is planning to present all candies and he wants to do this in the fairest (that is, most equal) manner. He wants ... | instruction | 0 | 42,407 | 24 | 84,814 |
Tags: implementation
Correct Solution:
```
def main():
n, m = map(int, input().split())
a = [(n//m)]*m
if sum(a) < n:
for i in range(n-sum(a)):
a[i]+= 1
print(*a)
main()
``` | output | 1 | 42,407 | 24 | 84,815 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Polycarpus has got n candies and m friends (n β₯ m). He wants to make a New Year present with candies to each friend. Polycarpus is planning to present all candies and he wants to do this in the ... | instruction | 0 | 42,408 | 24 | 84,816 |
Yes | output | 1 | 42,408 | 24 | 84,817 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Polycarpus has got n candies and m friends (n β₯ m). He wants to make a New Year present with candies to each friend. Polycarpus is planning to present all candies and he wants to do this in the ... | instruction | 0 | 42,409 | 24 | 84,818 |
Yes | output | 1 | 42,409 | 24 | 84,819 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Polycarpus has got n candies and m friends (n β₯ m). He wants to make a New Year present with candies to each friend. Polycarpus is planning to present all candies and he wants to do this in the ... | instruction | 0 | 42,410 | 24 | 84,820 |
Yes | output | 1 | 42,410 | 24 | 84,821 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Polycarpus has got n candies and m friends (n β₯ m). He wants to make a New Year present with candies to each friend. Polycarpus is planning to present all candies and he wants to do this in the ... | instruction | 0 | 42,411 | 24 | 84,822 |
Yes | output | 1 | 42,411 | 24 | 84,823 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Polycarpus has got n candies and m friends (n β₯ m). He wants to make a New Year present with candies to each friend. Polycarpus is planning to present all candies and he wants to do this in the ... | instruction | 0 | 42,412 | 24 | 84,824 |
No | output | 1 | 42,412 | 24 | 84,825 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Polycarpus has got n candies and m friends (n β₯ m). He wants to make a New Year present with candies to each friend. Polycarpus is planning to present all candies and he wants to do this in the ... | instruction | 0 | 42,413 | 24 | 84,826 |
No | output | 1 | 42,413 | 24 | 84,827 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Polycarpus has got n candies and m friends (n β₯ m). He wants to make a New Year present with candies to each friend. Polycarpus is planning to present all candies and he wants to do this in the ... | instruction | 0 | 42,414 | 24 | 84,828 |
No | output | 1 | 42,414 | 24 | 84,829 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Polycarpus has got n candies and m friends (n β₯ m). He wants to make a New Year present with candies to each friend. Polycarpus is planning to present all candies and he wants to do this in the ... | instruction | 0 | 42,415 | 24 | 84,830 |
No | output | 1 | 42,415 | 24 | 84,831 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Polycarp loves not only to take pictures, but also to show his photos to friends. On his personal website he has recently installed a widget that can display n photos with the scroll option. At ... | instruction | 0 | 42,572 | 24 | 85,144 |
No | output | 1 | 42,572 | 24 | 85,145 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Polycarp loves not only to take pictures, but also to show his photos to friends. On his personal website he has recently installed a widget that can display n photos with the scroll option. At ... | instruction | 0 | 42,573 | 24 | 85,146 |
No | output | 1 | 42,573 | 24 | 85,147 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Polycarp has to solve exactly n problems to improve his programming skill before an important programming competition. But this competition will be held very soon, most precisely, it will start in k days. It means that Polycarp has exactly k... | instruction | 0 | 42,977 | 24 | 85,954 |
Tags: constructive algorithms, greedy, math
Correct Solution:
```
rint = lambda: int(input())
rmint = lambda: map(int, input().split())
rlist = lambda: list(rmint())
n, k = rmint()
t = k
a = [0] * k
def no(): print("NO"); exit(0)
d = [-1] * (k+1); d[0] = 1
mx = 10 ** 9
for i in range(1, k+1):
if d[i-1] * 2 > mx: b... | output | 1 | 42,977 | 24 | 85,955 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Polycarp has to solve exactly n problems to improve his programming skill before an important programming competition. But this competition will be held very soon, most precisely, it will start in k days. It means that Polycarp has exactly k... | instruction | 0 | 42,978 | 24 | 85,956 |
Tags: constructive algorithms, greedy, math
Correct Solution:
```
import sys
n,k=map(int,input().split())
a=[0]*(k+2)
if k*(k+1)>n*2:
print("NO")
sys.exit()
for i in range(1,k+1):
a[i]=i
n-=k*(k+1)//2
rest=n//k
n-=rest*k
a[1]+=rest
for i in range(2,k+1):
a[i]=a[i-1]+1
rest=n//(k-i+1)
tmp=min(re... | output | 1 | 42,978 | 24 | 85,957 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Polycarp has to solve exactly n problems to improve his programming skill before an important programming competition. But this competition will be held very soon, most precisely, it will start in k days. It means that Polycarp has exactly k... | instruction | 0 | 42,979 | 24 | 85,958 |
Tags: constructive algorithms, greedy, math
Correct Solution:
```
from math import *
def f(n,k,a):
if k == 0:
return 0
L = max(ceil(n/(2**k - 1)), a+1)
R = floor(n/k - (k-1)/2)
if not (a == 0):
R = min(R,2*a)
if ( R >= L ):
return L
else:
return 0
n... | output | 1 | 42,979 | 24 | 85,959 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Polycarp has to solve exactly n problems to improve his programming skill before an important programming competition. But this competition will be held very soon, most precisely, it will start in k days. It means that Polycarp has exactly k... | instruction | 0 | 42,980 | 24 | 85,960 |
Tags: constructive algorithms, greedy, math
Correct Solution:
```
def solve():
N, K = map(int, input().split())
result = list(range(1, K+1))
Sum = (K*(K+1))//2
if N < Sum:
print ("NO")
return
add = (N - Sum)//K
for i in range(K):
result[i] += add
... | output | 1 | 42,980 | 24 | 85,961 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Polycarp has to solve exactly n problems to improve his programming skill before an important programming competition. But this competition will be held very soon, most precisely, it will start in k days. It means that Polycarp has exactly k... | instruction | 0 | 42,981 | 24 | 85,962 |
Tags: constructive algorithms, greedy, math
Correct Solution:
```
#!/usr/bin/evn python
# -*- coding: utf-8 -*-
import math
"""
26 6
2 5
"""
def solution():
n, k = map(int, input().strip().split())
# n, k = 200, 30
a = []
for i in range(k):
mi = math.floor((2 * n / (k - i) + i + 1 - k) / 2... | output | 1 | 42,981 | 24 | 85,963 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Polycarp has to solve exactly n problems to improve his programming skill before an important programming competition. But this competition will be held very soon, most precisely, it will start in k days. It means that Polycarp has exactly k... | instruction | 0 | 42,982 | 24 | 85,964 |
Tags: constructive algorithms, greedy, math
Correct Solution:
```
def mp():
return map(int, input().split())
n, k = mp()
a = [i for i in range(1, k + 1)]
s = (1 + k) * k // 2
p = [0] * k
pp = 0
i = 0
while i < k and s < n:
#print((n - s), (k - i), (n - s) // (k - i))
q = (n - s) // (k - i)
if i == 0 ... | output | 1 | 42,982 | 24 | 85,965 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Polycarp has to solve exactly n problems to improve his programming skill before an important programming competition. But this competition will be held very soon, most precisely, it will start in k days. It means that Polycarp has exactly k... | instruction | 0 | 42,983 | 24 | 85,966 |
Tags: constructive algorithms, greedy, math
Correct Solution:
```
def main():
n, k = map(int, input().split())
if n < k*(k+1)//2:
print('NO')
else:
add = (n-k*(k+1)//2) // k
res = [x+add for x in range(1, k+1)]
left = n-sum(res)
added = True
while left > 0 and... | output | 1 | 42,983 | 24 | 85,967 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Polycarp has to solve exactly n problems to improve his programming skill before an important programming competition. But this competition will be held very soon, most precisely, it will start in k days. It means that Polycarp has exactly k... | instruction | 0 | 42,984 | 24 | 85,968 |
Tags: constructive algorithms, greedy, math
Correct Solution:
```
def check(n, k, fl, fr):
if n < k * (2 * fl + k - 1) // 2:
return 1
if k <= 32 and n > fr * (2**k - 1):
return -1
return 0
def main():
n, k = map(int, input().split(' '))
l, r = 1, n
ans = []
while k > 0... | output | 1 | 42,984 | 24 | 85,969 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Polycarp has to solve exactly n problems to improve his programming skill before an important programming competition. But this competition will be held very soon, most precisely, it will start ... | instruction | 0 | 42,985 | 24 | 85,970 |
Yes | output | 1 | 42,985 | 24 | 85,971 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Polycarp has to solve exactly n problems to improve his programming skill before an important programming competition. But this competition will be held very soon, most precisely, it will start ... | instruction | 0 | 42,986 | 24 | 85,972 |
Yes | output | 1 | 42,986 | 24 | 85,973 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Polycarp has to solve exactly n problems to improve his programming skill before an important programming competition. But this competition will be held very soon, most precisely, it will start ... | instruction | 0 | 42,987 | 24 | 85,974 |
Yes | output | 1 | 42,987 | 24 | 85,975 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Polycarp has to solve exactly n problems to improve his programming skill before an important programming competition. But this competition will be held very soon, most precisely, it will start ... | instruction | 0 | 42,988 | 24 | 85,976 |
Yes | output | 1 | 42,988 | 24 | 85,977 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Polycarp has to solve exactly n problems to improve his programming skill before an important programming competition. But this competition will be held very soon, most precisely, it will start ... | instruction | 0 | 42,989 | 24 | 85,978 |
No | output | 1 | 42,989 | 24 | 85,979 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Polycarp has to solve exactly n problems to improve his programming skill before an important programming competition. But this competition will be held very soon, most precisely, it will start ... | instruction | 0 | 42,990 | 24 | 85,980 |
No | output | 1 | 42,990 | 24 | 85,981 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Polycarp has to solve exactly n problems to improve his programming skill before an important programming competition. But this competition will be held very soon, most precisely, it will start ... | instruction | 0 | 42,991 | 24 | 85,982 |
No | output | 1 | 42,991 | 24 | 85,983 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Polycarp has to solve exactly n problems to improve his programming skill before an important programming competition. But this competition will be held very soon, most precisely, it will start ... | instruction | 0 | 42,992 | 24 | 85,984 |
No | output | 1 | 42,992 | 24 | 85,985 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Polycarpus just has been out of luck lately! As soon as he found a job in the "Binary Cat" cafe, the club got burgled. All ice-cream was stolen.
On the burglary night Polycarpus kept a careful record of all club visitors. Each time a visito... | instruction | 0 | 43,268 | 24 | 86,536 |
Tags: greedy, implementation
Correct Solution:
```
s=input()
ans=a1=a2=0
for i in s:
if i=='+':
ans+=1
else:
ans-=1
a1=max(a1,ans)
a2=min(a2,ans)
print(a1+abs(a2))
``` | output | 1 | 43,268 | 24 | 86,537 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Polycarpus just has been out of luck lately! As soon as he found a job in the "Binary Cat" cafe, the club got burgled. All ice-cream was stolen.
On the burglary night Polycarpus kept a careful record of all club visitors. Each time a visito... | instruction | 0 | 43,269 | 24 | 86,538 |
Tags: greedy, implementation
Correct Solution:
```
a = [1 if x == '+' else -1 for x in input()]
b = list(map(lambda i : sum(a[0:i]), range(len(a) + 1)))
print(max(b) - min(b))
``` | output | 1 | 43,269 | 24 | 86,539 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Polycarpus just has been out of luck lately! As soon as he found a job in the "Binary Cat" cafe, the club got burgled. All ice-cream was stolen.
On the burglary night Polycarpus kept a careful record of all club visitors. Each time a visito... | instruction | 0 | 43,270 | 24 | 86,540 |
Tags: greedy, implementation
Correct Solution:
```
s=input()
s=list(s)
s1=[0]*len(s)
for i in range(len(s)):
if s[i]=='-':
s[i]=1
s1[i]=-1
else:
s[i]=-1
s1[i]=1
def kadane(s):
maxi=-1
curr=0
for i in s:
curr=max(curr+i,i)
maxi=max(maxi,curr)
r... | output | 1 | 43,270 | 24 | 86,541 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Polycarpus just has been out of luck lately! As soon as he found a job in the "Binary Cat" cafe, the club got burgled. All ice-cream was stolen.
On the burglary night Polycarpus kept a careful record of all club visitors. Each time a visito... | instruction | 0 | 43,271 | 24 | 86,542 |
Tags: greedy, implementation
Correct Solution:
```
s = input()
low = 0
high = 0
sum = 0
for i in s:
if i == '+':
sum += 1
else:
sum -= 1
if sum < low:
low = sum
if sum > high:
high = sum
print(high - low)
``` | output | 1 | 43,271 | 24 | 86,543 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Polycarpus just has been out of luck lately! As soon as he found a job in the "Binary Cat" cafe, the club got burgled. All ice-cream was stolen.
On the burglary night Polycarpus kept a careful record of all club visitors. Each time a visito... | instruction | 0 | 43,272 | 24 | 86,544 |
Tags: greedy, implementation
Correct Solution:
```
c, v1, v2 = 0, 0, 0
for ch in input():
c += 1 if ch == '+' else -1
v1, v2 = min(v1, c), max(v2, c)
print(v2 - v1)
``` | output | 1 | 43,272 | 24 | 86,545 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Polycarpus just has been out of luck lately! As soon as he found a job in the "Binary Cat" cafe, the club got burgled. All ice-cream was stolen.
On the burglary night Polycarpus kept a careful record of all club visitors. Each time a visito... | instruction | 0 | 43,273 | 24 | 86,546 |
Tags: greedy, implementation
Correct Solution:
```
# collaborated with no one
suspects = input()
minSus = 0
maxSus = 0
counter = 0
for x in suspects:
if x == '+':
counter += 1
minSus = min(minSus, counter)
maxSus = max(maxSus, counter)
else:
counter -= 1
minSus = min... | output | 1 | 43,273 | 24 | 86,547 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Polycarpus just has been out of luck lately! As soon as he found a job in the "Binary Cat" cafe, the club got burgled. All ice-cream was stolen.
On the burglary night Polycarpus kept a careful record of all club visitors. Each time a visito... | instruction | 0 | 43,274 | 24 | 86,548 |
Tags: greedy, implementation
Correct Solution:
```
#COLLABORATED WITH PRASOON SHAKYA
input_var=input()
counter1=0
counter2=0
for temp in input_var:
if temp=="+":
counter1+=1
if counter2>0:
counter2-=1
else:
counter2+=1
if counter1>0:
counter1-=1
print(coun... | output | 1 | 43,274 | 24 | 86,549 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Polycarpus just has been out of luck lately! As soon as he found a job in the "Binary Cat" cafe, the club got burgled. All ice-cream was stolen.
On the burglary night Polycarpus kept a careful record of all club visitors. Each time a visito... | instruction | 0 | 43,275 | 24 | 86,550 |
Tags: greedy, implementation
Correct Solution:
```
#Created By Minsol Jeong
def N5():
seq = input()
inside = outside = 0
for i in seq:
if (i == '+'):
inside +=1
if (outside):
outside -=1
else:
outside +=1
if (inside):
... | output | 1 | 43,275 | 24 | 86,551 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Polycarpus just has been out of luck lately! As soon as he found a job in the "Binary Cat" cafe, the club got burgled. All ice-cream was stolen.
On the burglary night Polycarpus kept a careful ... | instruction | 0 | 43,276 | 24 | 86,552 |
Yes | output | 1 | 43,276 | 24 | 86,553 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Polycarpus just has been out of luck lately! As soon as he found a job in the "Binary Cat" cafe, the club got burgled. All ice-cream was stolen.
On the burglary night Polycarpus kept a careful ... | instruction | 0 | 43,277 | 24 | 86,554 |
Yes | output | 1 | 43,277 | 24 | 86,555 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Polycarpus just has been out of luck lately! As soon as he found a job in the "Binary Cat" cafe, the club got burgled. All ice-cream was stolen.
On the burglary night Polycarpus kept a careful ... | instruction | 0 | 43,278 | 24 | 86,556 |
Yes | output | 1 | 43,278 | 24 | 86,557 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Polycarpus just has been out of luck lately! As soon as he found a job in the "Binary Cat" cafe, the club got burgled. All ice-cream was stolen.
On the burglary night Polycarpus kept a careful ... | instruction | 0 | 43,279 | 24 | 86,558 |
Yes | output | 1 | 43,279 | 24 | 86,559 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Polycarpus just has been out of luck lately! As soon as he found a job in the "Binary Cat" cafe, the club got burgled. All ice-cream was stolen.
On the burglary night Polycarpus kept a careful ... | instruction | 0 | 43,280 | 24 | 86,560 |
No | output | 1 | 43,280 | 24 | 86,561 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Polycarpus just has been out of luck lately! As soon as he found a job in the "Binary Cat" cafe, the club got burgled. All ice-cream was stolen.
On the burglary night Polycarpus kept a careful ... | instruction | 0 | 43,281 | 24 | 86,562 |
No | output | 1 | 43,281 | 24 | 86,563 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Polycarpus just has been out of luck lately! As soon as he found a job in the "Binary Cat" cafe, the club got burgled. All ice-cream was stolen.
On the burglary night Polycarpus kept a careful ... | instruction | 0 | 43,282 | 24 | 86,564 |
No | output | 1 | 43,282 | 24 | 86,565 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Polycarpus just has been out of luck lately! As soon as he found a job in the "Binary Cat" cafe, the club got burgled. All ice-cream was stolen.
On the burglary night Polycarpus kept a careful ... | instruction | 0 | 43,283 | 24 | 86,566 |
No | output | 1 | 43,283 | 24 | 86,567 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Polycarp took n videos, the duration of the i-th video is a_i seconds. The videos are listed in the chronological order, i.e. the 1-st video is the earliest, the 2-nd video is the next, ..., the n-th video is the last.
Now Polycarp wants to... | instruction | 0 | 43,829 | 24 | 87,658 |
Tags: implementation
Correct Solution:
```
def run():
n, k = map(int, input().split())
a = list(map(int, input().split()))
s = 0
for x in a: s += x
if s%k:
print("No")
return
dur = s//k
cs = 0
ans = []
for i in range(n):
cs += a[i]
if cs == dur:
... | output | 1 | 43,829 | 24 | 87,659 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Polycarp took n videos, the duration of the i-th video is a_i seconds. The videos are listed in the chronological order, i.e. the 1-st video is the earliest, the 2-nd video is the next, ..., the n-th video is the last.
Now Polycarp wants to... | instruction | 0 | 43,830 | 24 | 87,660 |
Tags: implementation
Correct Solution:
```
n,k=[int(x) for x in input().split()]
arr=[int(x) for x in input().split()]
s=sum(arr)
if s%k!=0:
print('No')
else:
d=s//k
ans=[]
curr=0
t=0
flag=True
for i in arr:
curr+=i
t+=1
if curr==d:
ans.append(t)
... | output | 1 | 43,830 | 24 | 87,661 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Polycarp took n videos, the duration of the i-th video is a_i seconds. The videos are listed in the chronological order, i.e. the 1-st video is the earliest, the 2-nd video is the next, ..., the n-th video is the last.
Now Polycarp wants to... | instruction | 0 | 43,831 | 24 | 87,662 |
Tags: implementation
Correct Solution:
```
n, k = map(int, input().split())
vids = [int(bruh) for bruh in input().split()]
len = 0
cnt = 0
res = []
summy = sum(vids)/k
for x in range(n):
len += vids[x]
cnt += 1
if len == summy:
res.append(cnt)
cnt = 0
len = 0
elif len > summy:
... | output | 1 | 43,831 | 24 | 87,663 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.