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 a correct Python 3 solution for this coding contest problem.
Takahashi has come to a party as a special guest. There are N ordinary guests at the party. The i-th ordinary guest has a power of A_i.
Takahashi has decided to perform M handshakes to increase the happiness of the party (let the current happiness b... | instruction | 0 | 40,210 | 14 | 80,420 |
"Correct Solution:
```
import bisect
n, m = map(int, input().split())
a = list(map(int, input().split()))
a.sort()
a_cum = [0 for _ in range(n+1)]
for i in range(n):
a_cum[i+1] = a_cum[i] + a[i]
l, r = 0, 10 ** 6
while r - l > 1:
x = (l + r) // 2
cnt = 0
for i in range(n):
idx = bisect.bisect... | output | 1 | 40,210 | 14 | 80,421 |
Provide a correct Python 3 solution for this coding contest problem.
Takahashi has come to a party as a special guest. There are N ordinary guests at the party. The i-th ordinary guest has a power of A_i.
Takahashi has decided to perform M handshakes to increase the happiness of the party (let the current happiness b... | instruction | 0 | 40,211 | 14 | 80,422 |
"Correct Solution:
```
def count(pre, a, x):
cnt = 0
val = 0
for i in reversed(range(n)):
if 2*a[i] < x:
break
lo, hi = 0, n-1
while lo < hi:
mid = (lo + hi)//2
if a[mid] + a[i] < x:
lo = mid + 1
else:
hi = mid
cnt += 1 + 2*(i - lo)
val += 2*(i-lo+1)*a[i... | output | 1 | 40,211 | 14 | 80,423 |
Provide a correct Python 3 solution for this coding contest problem.
Takahashi has come to a party as a special guest. There are N ordinary guests at the party. The i-th ordinary guest has a power of A_i.
Takahashi has decided to perform M handshakes to increase the happiness of the party (let the current happiness b... | instruction | 0 | 40,212 | 14 | 80,424 |
"Correct Solution:
```
from bisect import bisect_left
N,M=map(int,input().split())
A=list(map(int,input().split()))
A.sort()
l=1
r=200000+1
def chk(x):
c=0
for la in A:
y=bisect_left(A,x-la)
c+=N-y
if c>=M:
return True
else:
return False
while l+1<r:
mid=(l+r)/... | output | 1 | 40,212 | 14 | 80,425 |
Provide a correct Python 3 solution for this coding contest problem.
Takahashi has come to a party as a special guest. There are N ordinary guests at the party. The i-th ordinary guest has a power of A_i.
Takahashi has decided to perform M handshakes to increase the happiness of the party (let the current happiness b... | instruction | 0 | 40,213 | 14 | 80,426 |
"Correct Solution:
```
n, m = map(int, input().split())
A = list(map(int, input().split()))
A.sort(reverse=True)
cumsumA = []
total = 0
for a in A:
total += a
cumsumA.append(total)
cumsumA.append(0)
l = 0
r = 10 ** 6
while l + 1 < r:
num = (l+r)//2
pair_idx = n-1
count = 0
for a in A:
... | output | 1 | 40,213 | 14 | 80,427 |
Provide a correct Python 3 solution for this coding contest problem.
Takahashi has come to a party as a special guest. There are N ordinary guests at the party. The i-th ordinary guest has a power of A_i.
Takahashi has decided to perform M handshakes to increase the happiness of the party (let the current happiness b... | instruction | 0 | 40,214 | 14 | 80,428 |
"Correct Solution:
```
import sys
input = sys.stdin.readline
# 昇順ソートされた配列の挿入位置indexを返す O(logN)
from bisect import bisect_left
def isOver(a,n,x):
cnt = 0
for i in range(n):
cnt += n-bisect_left(a,x-a[i])
return cnt
def calX(a,n,m,l,r):
while r-l>1:
# x: 握手で得たい最低パワー値
x = (l+r)//2
if isOver(a,n,x) >= m:
l... | output | 1 | 40,214 | 14 | 80,429 |
Provide a correct Python 3 solution for this coding contest problem.
Takahashi has come to a party as a special guest. There are N ordinary guests at the party. The i-th ordinary guest has a power of A_i.
Takahashi has decided to perform M handshakes to increase the happiness of the party (let the current happiness b... | instruction | 0 | 40,215 | 14 | 80,430 |
"Correct Solution:
```
from itertools import accumulate
MAX = 2 * 10 ** 5 + 5
N, M, *A = map(int, open(0).read().split())
B = [0] * MAX
for a in A:
B[a] += 1
C = list(accumulate(reversed(B)))[::-1]
ng, ok = 1, MAX
while abs(ok - ng) > 1:
m = (ok + ng) // 2
if sum(C[max(0, m - a)] for a in A) >= M:
... | output | 1 | 40,215 | 14 | 80,431 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Takahashi has come to a party as a special guest. There are N ordinary guests at the party. The i-th ordinary guest has a power of A_i.
Takahashi has decided to perform M handshakes to increase... | instruction | 0 | 40,216 | 14 | 80,432 |
Yes | output | 1 | 40,216 | 14 | 80,433 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Takahashi has come to a party as a special guest. There are N ordinary guests at the party. The i-th ordinary guest has a power of A_i.
Takahashi has decided to perform M handshakes to increase... | instruction | 0 | 40,217 | 14 | 80,434 |
Yes | output | 1 | 40,217 | 14 | 80,435 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Takahashi has come to a party as a special guest. There are N ordinary guests at the party. The i-th ordinary guest has a power of A_i.
Takahashi has decided to perform M handshakes to increase... | instruction | 0 | 40,218 | 14 | 80,436 |
Yes | output | 1 | 40,218 | 14 | 80,437 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Takahashi has come to a party as a special guest. There are N ordinary guests at the party. The i-th ordinary guest has a power of A_i.
Takahashi has decided to perform M handshakes to increase... | instruction | 0 | 40,219 | 14 | 80,438 |
Yes | output | 1 | 40,219 | 14 | 80,439 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Takahashi has come to a party as a special guest. There are N ordinary guests at the party. The i-th ordinary guest has a power of A_i.
Takahashi has decided to perform M handshakes to increase... | instruction | 0 | 40,220 | 14 | 80,440 |
No | output | 1 | 40,220 | 14 | 80,441 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Takahashi has come to a party as a special guest. There are N ordinary guests at the party. The i-th ordinary guest has a power of A_i.
Takahashi has decided to perform M handshakes to increase... | instruction | 0 | 40,221 | 14 | 80,442 |
No | output | 1 | 40,221 | 14 | 80,443 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Takahashi has come to a party as a special guest. There are N ordinary guests at the party. The i-th ordinary guest has a power of A_i.
Takahashi has decided to perform M handshakes to increase... | instruction | 0 | 40,222 | 14 | 80,444 |
No | output | 1 | 40,222 | 14 | 80,445 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Takahashi has come to a party as a special guest. There are N ordinary guests at the party. The i-th ordinary guest has a power of A_i.
Takahashi has decided to perform M handshakes to increase... | instruction | 0 | 40,223 | 14 | 80,446 |
No | output | 1 | 40,223 | 14 | 80,447 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Indian summer is such a beautiful time of the year! A girl named Alyona is walking in the forest and picking a bouquet from fallen leaves. Alyona is very choosy — she doesn't take a leaf if it matches the color and the species of the tree of... | instruction | 0 | 40,746 | 14 | 81,492 |
Tags: implementation
Correct Solution:
```
n = int(input())
bunch = []
for i in range(n):
leaf = input()
if (leaf not in bunch):
bunch.append(leaf)
print(len(bunch))
``` | output | 1 | 40,746 | 14 | 81,493 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Indian summer is such a beautiful time of the year! A girl named Alyona is walking in the forest and picking a bouquet from fallen leaves. Alyona is very choosy — she doesn't take a leaf if it matches the color and the species of the tree of... | instruction | 0 | 40,747 | 14 | 81,494 |
Tags: implementation
Correct Solution:
```
tot = set()
for _ in range(int(input())):
tot.add(tuple(input().split()))
print(len(tot))
``` | output | 1 | 40,747 | 14 | 81,495 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Indian summer is such a beautiful time of the year! A girl named Alyona is walking in the forest and picking a bouquet from fallen leaves. Alyona is very choosy — she doesn't take a leaf if it matches the color and the species of the tree of... | instruction | 0 | 40,748 | 14 | 81,496 |
Tags: implementation
Correct Solution:
```
n = int(input())
g = set()
for i in range(n):
b = input()
g.add(b)
print(len(g))
``` | output | 1 | 40,748 | 14 | 81,497 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Indian summer is such a beautiful time of the year! A girl named Alyona is walking in the forest and picking a bouquet from fallen leaves. Alyona is very choosy — she doesn't take a leaf if it matches the color and the species of the tree of... | instruction | 0 | 40,749 | 14 | 81,498 |
Tags: implementation
Correct Solution:
```
int1=int(input())
d=[]
for i in range(int1):
d.append(input().strip())
#print(d)
print(len(set(d)))
``` | output | 1 | 40,749 | 14 | 81,499 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Indian summer is such a beautiful time of the year! A girl named Alyona is walking in the forest and picking a bouquet from fallen leaves. Alyona is very choosy — she doesn't take a leaf if it matches the color and the species of the tree of... | instruction | 0 | 40,750 | 14 | 81,500 |
Tags: implementation
Correct Solution:
```
n = int(input())
s = []
for i in range(n):
m = input()
if s.count(m) == 0:
s.append(m)
print(len(s))
``` | output | 1 | 40,750 | 14 | 81,501 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Indian summer is such a beautiful time of the year! A girl named Alyona is walking in the forest and picking a bouquet from fallen leaves. Alyona is very choosy — she doesn't take a leaf if it matches the color and the species of the tree of... | instruction | 0 | 40,752 | 14 | 81,504 |
Tags: implementation
Correct Solution:
```
# cook your dish here
d={}
c=0
n=int(input())
for _ in range(n):
a,b=input().split()
if(a in d and b not in d[a]):
d[a].append(b)
c+=1
elif(a not in d):
d[a]=[b]
c+=1
#(d)
print(c)
``` | output | 1 | 40,752 | 14 | 81,505 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Indian summer is such a beautiful time of the year! A girl named Alyona is walking in the forest and picking a bouquet from fallen leaves. Alyona is very choosy — she doesn't take a leaf if it matches the color and the species of the tree of... | instruction | 0 | 40,753 | 14 | 81,506 |
Tags: implementation
Correct Solution:
```
x = []
for _ in range(int(input())):
x.append(input())
print(len(set(x)))
``` | output | 1 | 40,753 | 14 | 81,507 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Indian summer is such a beautiful time of the year! A girl named Alyona is walking in the forest and picking a bouquet from fallen leaves. Alyona is very choosy — she doesn't take a leaf if it m... | instruction | 0 | 40,754 | 14 | 81,508 |
Yes | output | 1 | 40,754 | 14 | 81,509 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Indian summer is such a beautiful time of the year! A girl named Alyona is walking in the forest and picking a bouquet from fallen leaves. Alyona is very choosy — she doesn't take a leaf if it m... | instruction | 0 | 40,755 | 14 | 81,510 |
Yes | output | 1 | 40,755 | 14 | 81,511 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Indian summer is such a beautiful time of the year! A girl named Alyona is walking in the forest and picking a bouquet from fallen leaves. Alyona is very choosy — she doesn't take a leaf if it m... | instruction | 0 | 40,756 | 14 | 81,512 |
Yes | output | 1 | 40,756 | 14 | 81,513 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Indian summer is such a beautiful time of the year! A girl named Alyona is walking in the forest and picking a bouquet from fallen leaves. Alyona is very choosy — she doesn't take a leaf if it m... | instruction | 0 | 40,757 | 14 | 81,514 |
Yes | output | 1 | 40,757 | 14 | 81,515 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Indian summer is such a beautiful time of the year! A girl named Alyona is walking in the forest and picking a bouquet from fallen leaves. Alyona is very choosy — she doesn't take a leaf if it m... | instruction | 0 | 40,758 | 14 | 81,516 |
No | output | 1 | 40,758 | 14 | 81,517 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Indian summer is such a beautiful time of the year! A girl named Alyona is walking in the forest and picking a bouquet from fallen leaves. Alyona is very choosy — she doesn't take a leaf if it m... | instruction | 0 | 40,759 | 14 | 81,518 |
No | output | 1 | 40,759 | 14 | 81,519 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Indian summer is such a beautiful time of the year! A girl named Alyona is walking in the forest and picking a bouquet from fallen leaves. Alyona is very choosy — she doesn't take a leaf if it m... | instruction | 0 | 40,760 | 14 | 81,520 |
No | output | 1 | 40,760 | 14 | 81,521 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Indian summer is such a beautiful time of the year! A girl named Alyona is walking in the forest and picking a bouquet from fallen leaves. Alyona is very choosy — she doesn't take a leaf if it m... | instruction | 0 | 40,761 | 14 | 81,522 |
No | output | 1 | 40,761 | 14 | 81,523 |
Provide tags and a correct Python 3 solution for this coding contest problem.
The only difference between easy and hard versions is constraints.
Nauuo is a girl who loves random picture websites.
One day she made a random picture website by herself which includes n pictures.
When Nauuo visits the website, she sees ... | instruction | 0 | 41,300 | 14 | 82,600 |
Tags: dp, probabilities
Correct Solution:
```
P = 998244353
N, M = map(int, input().split())
A = [int(a) for a in input().split()]
B = [int(a) for a in input().split()]
li = sum([A[i]*B[i] for i in range(N)])
di = sum([(A[i]^1)*B[i] for i in range(N)])
X = [1]
SU = li+di
PO = [0] * (5*M+10)
for i in range(-M-5, 2*M+5):... | output | 1 | 41,300 | 14 | 82,601 |
Provide tags and a correct Python 3 solution for this coding contest problem.
A team of students from the city S is sent to the All-Berland Olympiad in Informatics. Traditionally, they go on the train. All students have bought tickets in one carriage, consisting of n compartments (each compartment has exactly four peo... | instruction | 0 | 41,542 | 14 | 83,084 |
Tags: combinatorics, constructive algorithms, greedy, implementation
Correct Solution:
```
n = int(input())
A = [0, 0, 0, 0, 0]
B = map(int, input().split(' '))
for i in B:
A[i] += 1
res = min(A[1], A[2])
A[1] -= res
A[2] -= res
A[3] += res
res += 2 * (A[1] // 3)
A[3] += A[1] // 3
A[1] %= 3
res += 2 * (A[2] // 3)
... | output | 1 | 41,542 | 14 | 83,085 |
Provide tags and a correct Python 3 solution for this coding contest problem.
A team of students from the city S is sent to the All-Berland Olympiad in Informatics. Traditionally, they go on the train. All students have bought tickets in one carriage, consisting of n compartments (each compartment has exactly four peo... | instruction | 0 | 41,543 | 14 | 83,086 |
Tags: combinatorics, constructive algorithms, greedy, implementation
Correct Solution:
```
#! /usr/bin/env python
n = int(input())
counts = [0] * 5
nums = [int(x) for x in input().split()]
for x in nums:
counts[x] += 1
s = sum(nums)
if s > 2 and s != 5:
ans = 0
if counts[1] >= counts[2]:
ans += co... | output | 1 | 41,543 | 14 | 83,087 |
Provide tags and a correct Python 3 solution for this coding contest problem.
A team of students from the city S is sent to the All-Berland Olympiad in Informatics. Traditionally, they go on the train. All students have bought tickets in one carriage, consisting of n compartments (each compartment has exactly four peo... | instruction | 0 | 41,544 | 14 | 83,088 |
Tags: combinatorics, constructive algorithms, greedy, implementation
Correct Solution:
```
import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192
class FastIO(IOBase):
newlines = 0
def __init__(self, file):
self._fd = file.fileno()
self.buffer = BytesIO()
self.writable = ... | output | 1 | 41,544 | 14 | 83,089 |
Provide tags and a correct Python 3 solution for this coding contest problem.
A team of students from the city S is sent to the All-Berland Olympiad in Informatics. Traditionally, they go on the train. All students have bought tickets in one carriage, consisting of n compartments (each compartment has exactly four peo... | instruction | 0 | 41,545 | 14 | 83,090 |
Tags: combinatorics, constructive algorithms, greedy, implementation
Correct Solution:
```
a = [0] * 5
tot, ans = 0, 0
input()
for x in list(map(int, input().split())):
a[x] += 1
tot += x
if tot < 3 or tot == 5:
exit(print(-1))
mn = min(a[1], a[2])
a[1] -= mn
a[2] -= mn
a[3] += mn
ans += mn
if a[1]:
add = a... | output | 1 | 41,545 | 14 | 83,091 |
Provide tags and a correct Python 3 solution for this coding contest problem.
A team of students from the city S is sent to the All-Berland Olympiad in Informatics. Traditionally, they go on the train. All students have bought tickets in one carriage, consisting of n compartments (each compartment has exactly four peo... | instruction | 0 | 41,546 | 14 | 83,092 |
Tags: combinatorics, constructive algorithms, greedy, implementation
Correct Solution:
```
n = int(input())
seq = list(map(int, input().split(" ")))
if sum(seq) < 3 or sum(seq) == 5:
print(-1)
else:
arr = [0,0,0,0,0]
for s in seq:
arr[s] += 1
#print(arr)
ans = 0
if arr[2] >= arr[1]:
ans += arr[1]
arr[2]... | output | 1 | 41,546 | 14 | 83,093 |
Provide tags and a correct Python 3 solution for this coding contest problem.
A team of students from the city S is sent to the All-Berland Olympiad in Informatics. Traditionally, they go on the train. All students have bought tickets in one carriage, consisting of n compartments (each compartment has exactly four peo... | instruction | 0 | 41,547 | 14 | 83,094 |
Tags: combinatorics, constructive algorithms, greedy, implementation
Correct Solution:
```
#! /usr/bin/env python
n = int(input())
counts = [0] * 5
s = 0
for x in [int(x) for x in input().split()]:
counts[x] += 1
s += x
if s > 2 and s != 5:
ans = 0
if counts[1] >= counts[2]:
ans += counts[2]
... | output | 1 | 41,547 | 14 | 83,095 |
Provide tags and a correct Python 3 solution for this coding contest problem.
A team of students from the city S is sent to the All-Berland Olympiad in Informatics. Traditionally, they go on the train. All students have bought tickets in one carriage, consisting of n compartments (each compartment has exactly four peo... | instruction | 0 | 41,548 | 14 | 83,096 |
Tags: combinatorics, constructive algorithms, greedy, implementation
Correct Solution:
```
#! /usr/bin/env python
n = int(input())
counts = [0] * 5
nums = [int(x) for x in input().split()]
for x in nums:
counts[x] += 1
s = sum(nums)
if s > 2 and s != 5:
ans = 0
if counts[1] >= counts[2]:
ans += co... | output | 1 | 41,548 | 14 | 83,097 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
A team of students from the city S is sent to the All-Berland Olympiad in Informatics. Traditionally, they go on the train. All students have bought tickets in one carriage, consisting of n comp... | instruction | 0 | 41,549 | 14 | 83,098 |
No | output | 1 | 41,549 | 14 | 83,099 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
A team of students from the city S is sent to the All-Berland Olympiad in Informatics. Traditionally, they go on the train. All students have bought tickets in one carriage, consisting of n comp... | instruction | 0 | 41,551 | 14 | 83,102 |
No | output | 1 | 41,551 | 14 | 83,103 |
Provide tags and a correct Python 3 solution for this coding contest problem.
The prison of your city has n prisoners. As the prison can't accommodate all of them, the city mayor has decided to transfer c of the prisoners to a prison located in another city.
For this reason, he made the n prisoners to stand in a line... | instruction | 0 | 41,578 | 14 | 83,156 |
Tags: data structures, implementation
Correct Solution:
```
n, t, c = map(int, input().split())
arr = list(map(int, input().split()))
i, j, res = 0, 0, 0
while i < n:
while i < n and arr[i] <= t:
i += 1
r = i - j
if r >= c:
res += (r - c + 1)
i += 1
j = i
print(res)
``` | output | 1 | 41,578 | 14 | 83,157 |
Provide tags and a correct Python 3 solution for this coding contest problem.
The prison of your city has n prisoners. As the prison can't accommodate all of them, the city mayor has decided to transfer c of the prisoners to a prison located in another city.
For this reason, he made the n prisoners to stand in a line... | instruction | 0 | 41,579 | 14 | 83,158 |
Tags: data structures, implementation
Correct Solution:
```
n, t, c = map(int, input().split())
ps = list(map(int, input().split()))
s = [0] + [i + 1 for i in range(n) if ps[i] > t] + [n + 1]
print(sum(s[i] - s[i-1] - c for i in range(1, len(s)) if s[i] - s[i-1] > c))
``` | output | 1 | 41,579 | 14 | 83,159 |
Provide tags and a correct Python 3 solution for this coding contest problem.
The prison of your city has n prisoners. As the prison can't accommodate all of them, the city mayor has decided to transfer c of the prisoners to a prison located in another city.
For this reason, he made the n prisoners to stand in a line... | instruction | 0 | 41,580 | 14 | 83,160 |
Tags: data structures, implementation
Correct Solution:
```
n, t, c = map(int, input().split())
a = list(map(int, input().split()))
b = [-1]
res = 0
tmp = 0
for i in range(n):
if a[i] > t:
b.append(i)
b.append(n)
for i in range(1, len(b)):
tmp = b[i] - b[i - 1] - 1
res += max(tmp - c + 1, 0)
print(r... | output | 1 | 41,580 | 14 | 83,161 |
Provide tags and a correct Python 3 solution for this coding contest problem.
The prison of your city has n prisoners. As the prison can't accommodate all of them, the city mayor has decided to transfer c of the prisoners to a prison located in another city.
For this reason, he made the n prisoners to stand in a line... | instruction | 0 | 41,581 | 14 | 83,162 |
Tags: data structures, implementation
Correct Solution:
```
# prison transfer
def main():
n, t, c = [int(c) for c in input().split()]
s = ''.join([str(int(int(c) <= t)) for c in input().split()])
s = s.split('0')
res = 0
for e in s:
if len(e) >= c:
res += len(e) - c + 1
prin... | output | 1 | 41,581 | 14 | 83,163 |
Provide tags and a correct Python 3 solution for this coding contest problem.
The prison of your city has n prisoners. As the prison can't accommodate all of them, the city mayor has decided to transfer c of the prisoners to a prison located in another city.
For this reason, he made the n prisoners to stand in a line... | instruction | 0 | 41,582 | 14 | 83,164 |
Tags: data structures, implementation
Correct Solution:
```
n, t, c = map(int, input().split())
lis = [int(x) for x in input().split()]
ans = 0
cnt = 0
for i in lis:
if(i <= t):
cnt += 1
else:
cnt = 0
if(cnt >= c):
ans += 1
print(ans)
``` | output | 1 | 41,582 | 14 | 83,165 |
Provide tags and a correct Python 3 solution for this coding contest problem.
The prison of your city has n prisoners. As the prison can't accommodate all of them, the city mayor has decided to transfer c of the prisoners to a prison located in another city.
For this reason, he made the n prisoners to stand in a line... | instruction | 0 | 41,583 | 14 | 83,166 |
Tags: data structures, implementation
Correct Solution:
```
n,t,c = map(int,input().split())
s = [int(i) for i in input().split()]
cnt = 0
d = [-1]
for i in range(n):
if s[i]>t:
d.append(i)
d.append(n)
for i in range(len(d)-1):
a = d[i+1]-d[i]-1
if a>=c:
cnt+=a-c+1
print(cnt)
``` | output | 1 | 41,583 | 14 | 83,167 |
Provide tags and a correct Python 3 solution for this coding contest problem.
The prison of your city has n prisoners. As the prison can't accommodate all of them, the city mayor has decided to transfer c of the prisoners to a prison located in another city.
For this reason, he made the n prisoners to stand in a line... | instruction | 0 | 41,584 | 14 | 83,168 |
Tags: data structures, implementation
Correct Solution:
```
n, t, c = [int(x) for x in input().split()]
ex_id = [-1] + [i for i, v in enumerate(input().split()) if int(v) > t] + [n]
ans = 0
for i in range(1, len(ex_id)):
diff = ex_id[i] - ex_id[i-1] - 1
ans += max(diff- c + 1, 0)
print(ans)
``` | output | 1 | 41,584 | 14 | 83,169 |
Provide tags and a correct Python 3 solution for this coding contest problem.
The prison of your city has n prisoners. As the prison can't accommodate all of them, the city mayor has decided to transfer c of the prisoners to a prison located in another city.
For this reason, he made the n prisoners to stand in a line... | instruction | 0 | 41,585 | 14 | 83,170 |
Tags: data structures, implementation
Correct Solution:
```
n, t, c = map(int, input().split())
v = list(map(int, input().split()))
f = []
cont1 = 0
conTot = 0
for i in range(n):
if(v[i] <= t):
cont1 += 1
else:
cont1 = 0
if(cont1 >= c):
conTot += 1
print(conTot)
``` | output | 1 | 41,585 | 14 | 83,171 |
Provide tags and a correct Python 3 solution for this coding contest problem.
There are n student groups at the university. During the study day, each group can take no more than 7 classes. Seven time slots numbered from 1 to 7 are allocated for the classes.
The schedule on Monday is known for each group, i. e. time ... | instruction | 0 | 41,752 | 14 | 83,504 |
Tags: implementation
Correct Solution:
```
n = int(input())
dictt ={}
arr=[]
for i in range(n):
a = input()
arr.append(a)
for i in range(0,n):
for j in range(0,7):
if (arr[i][j]=='1'):
try:dictt[j]+=1
except:dictt[j]=1
try:print(max(dictt.values()))
except:print(0)
``` | output | 1 | 41,752 | 14 | 83,505 |
Provide tags and a correct Python 3 solution for this coding contest problem.
There are n student groups at the university. During the study day, each group can take no more than 7 classes. Seven time slots numbered from 1 to 7 are allocated for the classes.
The schedule on Monday is known for each group, i. e. time ... | instruction | 0 | 41,753 | 14 | 83,506 |
Tags: implementation
Correct Solution:
```
t = int(input())
classes = []
answer = 0
for i in range(t):
s = input()
classes.insert(i, s)
for i in range(7):
room = 0
for j in range(len(classes)):
if int(classes[j][i]) == 1:
room += 1
if room > answer:
answer = room
print(an... | output | 1 | 41,753 | 14 | 83,507 |
Provide tags and a correct Python 3 solution for this coding contest problem.
There are n student groups at the university. During the study day, each group can take no more than 7 classes. Seven time slots numbered from 1 to 7 are allocated for the classes.
The schedule on Monday is known for each group, i. e. time ... | instruction | 0 | 41,754 | 14 | 83,508 |
Tags: implementation
Correct Solution:
```
n = int(input())
arr = [0 for i in range(7)]
for i in range(n):
s = input()
for j in range(7):
if s[j] == '1':
arr[j] += 1
print(max(arr))
``` | output | 1 | 41,754 | 14 | 83,509 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.