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.
A simple recommendation system would recommend a user things liked by a certain number of their friends. In this problem you will implement part of such a system.
You are given user's friends' opinions about a list of items. You are also gi... | instruction | 0 | 92,193 | 14 | 184,386 |
Tags: *special
Correct Solution:
```
f, i, t = [int(x) for x in input().split()]
s = [0] * i
for kitten in range(f):
l = input()
for o in range(i):
if l[o] == 'Y':
s[o]+=1
print(sum([1 for x in s if x >= t]))
``` | output | 1 | 92,193 | 14 | 184,387 |
Provide tags and a correct Python 3 solution for this coding contest problem.
A simple recommendation system would recommend a user things liked by a certain number of their friends. In this problem you will implement part of such a system.
You are given user's friends' opinions about a list of items. You are also gi... | instruction | 0 | 92,194 | 14 | 184,388 |
Tags: *special
Correct Solution:
```
f,i,t = map(int,input().split())
a = [0] * i
for b in range(f):
u = input().strip()
for q in range(i):
if u[q] == 'Y': a[q] += 1
print(len([_ for _ in a if _ >= t]))
# kitten
# meow~~
``` | output | 1 | 92,194 | 14 | 184,389 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
A simple recommendation system would recommend a user things liked by a certain number of their friends. In this problem you will implement part of such a system.
You are given user's friends' ... | instruction | 0 | 92,195 | 14 | 184,390 |
Yes | output | 1 | 92,195 | 14 | 184,391 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
A simple recommendation system would recommend a user things liked by a certain number of their friends. In this problem you will implement part of such a system.
You are given user's friends' ... | instruction | 0 | 92,196 | 14 | 184,392 |
Yes | output | 1 | 92,196 | 14 | 184,393 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
A simple recommendation system would recommend a user things liked by a certain number of their friends. In this problem you will implement part of such a system.
You are given user's friends' ... | instruction | 0 | 92,197 | 14 | 184,394 |
Yes | output | 1 | 92,197 | 14 | 184,395 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
A simple recommendation system would recommend a user things liked by a certain number of their friends. In this problem you will implement part of such a system.
You are given user's friends' ... | instruction | 0 | 92,198 | 14 | 184,396 |
Yes | output | 1 | 92,198 | 14 | 184,397 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
A simple recommendation system would recommend a user things liked by a certain number of their friends. In this problem you will implement part of such a system.
You are given user's friends' ... | instruction | 0 | 92,199 | 14 | 184,398 |
No | output | 1 | 92,199 | 14 | 184,399 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
A simple recommendation system would recommend a user things liked by a certain number of their friends. In this problem you will implement part of such a system.
You are given user's friends' ... | instruction | 0 | 92,200 | 14 | 184,400 |
No | output | 1 | 92,200 | 14 | 184,401 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
A simple recommendation system would recommend a user things liked by a certain number of their friends. In this problem you will implement part of such a system.
You are given user's friends' ... | instruction | 0 | 92,201 | 14 | 184,402 |
No | output | 1 | 92,201 | 14 | 184,403 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
A simple recommendation system would recommend a user things liked by a certain number of their friends. In this problem you will implement part of such a system.
You are given user's friends' ... | instruction | 0 | 92,202 | 14 | 184,404 |
No | output | 1 | 92,202 | 14 | 184,405 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Anya and Kirill are doing a physics laboratory work. In one of the tasks they have to measure some value n times, and then compute the average value to lower the error.
Kirill has already made his measurements, and has got the following int... | instruction | 0 | 92,337 | 14 | 184,674 |
Tags: implementation, math
Correct Solution:
```
from collections import Counter
n = int(input())
a = list(map(int, input().split()))
def get_mm(a):
mmin = 1000000
mmax = -1000000
for el in a:
if el> mmax:
mmax = el
if el< mmin:
mmin = el
if mmax - mmin == ... | output | 1 | 92,337 | 14 | 184,675 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Anya and Kirill are doing a physics laboratory work. In one of the tasks they have to measure some value n times, and then compute the average value to lower the error.
Kirill has already made his measurements, and has got the following int... | instruction | 0 | 92,338 | 14 | 184,676 |
Tags: implementation, math
Correct Solution:
```
n=int(input())
l=list(map(int,input().split()))
d=dict()
l.sort()
d.update({l[0]+1:0})
for i in range(n):
if l[i] not in d:
d.update({l[i]:1})
else:
d[l[i]]+=1
if l[0]+1>=l[-1]:
print(n)
print(*l,sep=" ")
else:
a=d[l[0]]
c=d[l[-1]]... | output | 1 | 92,338 | 14 | 184,677 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Anya and Kirill are doing a physics laboratory work. In one of the tasks they have to measure some value n times, and then compute the average value to lower the error.
Kirill has already made his measurements, and has got the following int... | instruction | 0 | 92,339 | 14 | 184,678 |
Tags: implementation, math
Correct Solution:
```
n = int(input())
a = list(map(int, input().split()))
a.sort()
sr = sum(a) / n
x = []
min1 = min(a)
max1 = max(a)
targ = False
if min1 + 2 != max1:
print(n)
print(*a)
min1 = int(sr) - 1
max1 = int(sr) + 1
else:
sred = (min1 + max1) // 2
i = 0
k... | output | 1 | 92,339 | 14 | 184,679 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Anya and Kirill are doing a physics laboratory work. In one of the tasks they have to measure some value n times, and then compute the average value to lower the error.
Kirill has already made his measurements, and has got the following int... | instruction | 0 | 92,340 | 14 | 184,680 |
Tags: implementation, math
Correct Solution:
```
n=int(input())
x=input().split()
x=[int(k) for k in x]
rem=[]
x.sort()
mn = x[0]
mx = x[-1]
if (mx-mn<=1):
print(len(x))
for k in x:
print(k, end=' ')
print()
else:
avg=mn+1
expsum = avg*len(x)
sm=0
countmn=0
countavg=0
countmx=0
for k in x:
sm+=k
if (s... | output | 1 | 92,340 | 14 | 184,681 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Anya and Kirill are doing a physics laboratory work. In one of the tasks they have to measure some value n times, and then compute the average value to lower the error.
Kirill has already made his measurements, and has got the following int... | instruction | 0 | 92,341 | 14 | 184,682 |
Tags: implementation, math
Correct Solution:
```
def main():
n = int(input())
measures = [int(x) for x in input().split()]
m = min(measures)
count = [measures.count(m + i) for i in range(3)]
if count[2] == 0:
print(n)
print(' '.join([str(x) for x in measures]))
return
pai... | output | 1 | 92,341 | 14 | 184,683 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Anya and Kirill are doing a physics laboratory work. In one of the tasks they have to measure some value n times, and then compute the average value to lower the error.
Kirill has already made his measurements, and has got the following int... | instruction | 0 | 92,342 | 14 | 184,684 |
Tags: implementation, math
Correct Solution:
```
n=int(input())
x=input()
a=list(map(int,x.split()))
if max(a)-min(a)<2:
print(n)
print(x)
exit()
s=set(a)
q=min(a)
s=max(a)
r=q+1
m={}
m[q]=m[s]=m[r]=0
for i in a:m[i]+=1
if n-2*min(m[q],m[s])<n-m[r]//2*2:
print(n-2*min(m[q],m[s]))
e=min(m[q],m[s])
m[r]+=e+e
m[q]-... | output | 1 | 92,342 | 14 | 184,685 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Anya and Kirill are doing a physics laboratory work. In one of the tasks they have to measure some value n times, and then compute the average value to lower the error.
Kirill has already made his measurements, and has got the following int... | instruction | 0 | 92,343 | 14 | 184,686 |
Tags: implementation, math
Correct Solution:
```
n = int(input())
l = list(map(int, input().split(' ')))
s = sum(l) // len(l)
mn, mx = min(l), max(l)
if mx - mn <= 1:
print(n)
for i in l:
print(i, end=' ')
else:
a, b, c = l.count(mn), l.count(mn + 1), l.count(mx)
a1, b1, c1 = a - min(a, c), b + ... | output | 1 | 92,343 | 14 | 184,687 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Anya and Kirill are doing a physics laboratory work. In one of the tasks they have to measure some value n times, and then compute the average value to lower the error.
Kirill has already made his measurements, and has got the following int... | instruction | 0 | 92,344 | 14 | 184,688 |
Tags: implementation, math
Correct Solution:
```
# -*- coding: utf-8 -*-
from collections import defaultdict
def problem():
def count_collisions(lows, mids, his):
return min(xs_low, lows) + min(xs_mid, mids) + min(xs_hi, his)
in1 = int(input())
in2 = input()
# in1 = 2
# in2 = '2 0'... | output | 1 | 92,344 | 14 | 184,689 |
Provide a correct Python 3 solution for this coding contest problem.
A company has N members, who are assigned ID numbers 1, ..., N.
Every member, except the member numbered 1, has exactly one immediate boss with a smaller ID number.
When a person X is the immediate boss of a person Y, the person Y is said to be an ... | instruction | 0 | 92,401 | 14 | 184,802 |
"Correct Solution:
```
a = int(input())
b = list(map(int,input().split()))
c = [0]*a
for i in b:
c[i-1] += 1
for i in c:
print(i)
``` | output | 1 | 92,401 | 14 | 184,803 |
Provide a correct Python 3 solution for this coding contest problem.
A company has N members, who are assigned ID numbers 1, ..., N.
Every member, except the member numbered 1, has exactly one immediate boss with a smaller ID number.
When a person X is the immediate boss of a person Y, the person Y is said to be an ... | instruction | 0 | 92,402 | 14 | 184,804 |
"Correct Solution:
```
n=int(input())
buka = [0]*n
for joushi in input().split():
buka[int(joushi)-1] += 1
print(*buka,sep='\n')
``` | output | 1 | 92,402 | 14 | 184,805 |
Provide a correct Python 3 solution for this coding contest problem.
A company has N members, who are assigned ID numbers 1, ..., N.
Every member, except the member numbered 1, has exactly one immediate boss with a smaller ID number.
When a person X is the immediate boss of a person Y, the person Y is said to be an ... | instruction | 0 | 92,403 | 14 | 184,806 |
"Correct Solution:
```
n=int(input())
a=list(map(int,input().split()))
rank=[0]*n
for i in a:
rank[i-1]+=1
for i in rank:
print(i)
``` | output | 1 | 92,403 | 14 | 184,807 |
Provide a correct Python 3 solution for this coding contest problem.
A company has N members, who are assigned ID numbers 1, ..., N.
Every member, except the member numbered 1, has exactly one immediate boss with a smaller ID number.
When a person X is the immediate boss of a person Y, the person Y is said to be an ... | instruction | 0 | 92,404 | 14 | 184,808 |
"Correct Solution:
```
N = int(input())
B = [0] * N
for a in input().split():
B[int(a)-1] += 1
for b in B:
print(b)
``` | output | 1 | 92,404 | 14 | 184,809 |
Provide a correct Python 3 solution for this coding contest problem.
A company has N members, who are assigned ID numbers 1, ..., N.
Every member, except the member numbered 1, has exactly one immediate boss with a smaller ID number.
When a person X is the immediate boss of a person Y, the person Y is said to be an ... | instruction | 0 | 92,405 | 14 | 184,810 |
"Correct Solution:
```
N=int(input())
A=list(map(int,input().split()))
B=[0]*N
for i in A:
B[i-1]+=1
for i in B:
print(i)
``` | output | 1 | 92,405 | 14 | 184,811 |
Provide a correct Python 3 solution for this coding contest problem.
A company has N members, who are assigned ID numbers 1, ..., N.
Every member, except the member numbered 1, has exactly one immediate boss with a smaller ID number.
When a person X is the immediate boss of a person Y, the person Y is said to be an ... | instruction | 0 | 92,406 | 14 | 184,812 |
"Correct Solution:
```
N=int(input())
A=list(map(int,input().split()))
x=[0]*N
for i in A:
x[i-1]+=1
for j in x:
print(j)
``` | output | 1 | 92,406 | 14 | 184,813 |
Provide a correct Python 3 solution for this coding contest problem.
A company has N members, who are assigned ID numbers 1, ..., N.
Every member, except the member numbered 1, has exactly one immediate boss with a smaller ID number.
When a person X is the immediate boss of a person Y, the person Y is said to be an ... | instruction | 0 | 92,407 | 14 | 184,814 |
"Correct Solution:
```
n=int(input())
r=[0]*n
j=list(map(int, input().split()))
for i in j:
r[i-1]+=1
for i in r:
print(i)
``` | output | 1 | 92,407 | 14 | 184,815 |
Provide a correct Python 3 solution for this coding contest problem.
A company has N members, who are assigned ID numbers 1, ..., N.
Every member, except the member numbered 1, has exactly one immediate boss with a smaller ID number.
When a person X is the immediate boss of a person Y, the person Y is said to be an ... | instruction | 0 | 92,408 | 14 | 184,816 |
"Correct Solution:
```
n=int(input())
j=[0]*n
*a,=map(int,input().split())
for i in a:
j[i-1]+=1
for i in range(n):
print(j[i])
``` | output | 1 | 92,408 | 14 | 184,817 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
A company has N members, who are assigned ID numbers 1, ..., N.
Every member, except the member numbered 1, has exactly one immediate boss with a smaller ID number.
When a person X is the imme... | instruction | 0 | 92,409 | 14 | 184,818 |
Yes | output | 1 | 92,409 | 14 | 184,819 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
A company has N members, who are assigned ID numbers 1, ..., N.
Every member, except the member numbered 1, has exactly one immediate boss with a smaller ID number.
When a person X is the imme... | instruction | 0 | 92,410 | 14 | 184,820 |
Yes | output | 1 | 92,410 | 14 | 184,821 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
A company has N members, who are assigned ID numbers 1, ..., N.
Every member, except the member numbered 1, has exactly one immediate boss with a smaller ID number.
When a person X is the imme... | instruction | 0 | 92,411 | 14 | 184,822 |
Yes | output | 1 | 92,411 | 14 | 184,823 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
A company has N members, who are assigned ID numbers 1, ..., N.
Every member, except the member numbered 1, has exactly one immediate boss with a smaller ID number.
When a person X is the imme... | instruction | 0 | 92,412 | 14 | 184,824 |
Yes | output | 1 | 92,412 | 14 | 184,825 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
A company has N members, who are assigned ID numbers 1, ..., N.
Every member, except the member numbered 1, has exactly one immediate boss with a smaller ID number.
When a person X is the imme... | instruction | 0 | 92,413 | 14 | 184,826 |
No | output | 1 | 92,413 | 14 | 184,827 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
A company has N members, who are assigned ID numbers 1, ..., N.
Every member, except the member numbered 1, has exactly one immediate boss with a smaller ID number.
When a person X is the imme... | instruction | 0 | 92,414 | 14 | 184,828 |
No | output | 1 | 92,414 | 14 | 184,829 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
A company has N members, who are assigned ID numbers 1, ..., N.
Every member, except the member numbered 1, has exactly one immediate boss with a smaller ID number.
When a person X is the imme... | instruction | 0 | 92,415 | 14 | 184,830 |
No | output | 1 | 92,415 | 14 | 184,831 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
A company has N members, who are assigned ID numbers 1, ..., N.
Every member, except the member numbered 1, has exactly one immediate boss with a smaller ID number.
When a person X is the imme... | instruction | 0 | 92,416 | 14 | 184,832 |
No | output | 1 | 92,416 | 14 | 184,833 |
Provide a correct Python 3 solution for this coding contest problem.
Saying that it is not surprising that people want to know about their love, she has checked up his address, name, age, phone number, hometown, medical history, political party and even his sleeping position, every piece of his personal information. T... | instruction | 0 | 92,556 | 14 | 185,112 |
"Correct Solution:
```
# AOJ 1054: Distorted Love
# Python3 2018.7.7 bal4u
while True:
n = int(input())
if n == 0: break
input() # w, h
pag, dic = [], {}
for i in range(n):
nm, k = input().split()
dic[nm] = i
btn = []
for j in range(int(k)):
x1, y1, x2, y2, bnm = input().split()
btn.append((int(x1... | output | 1 | 92,556 | 14 | 185,113 |
Provide a correct Python 3 solution for this coding contest problem.
Saying that it is not surprising that people want to know about their love, she has checked up his address, name, age, phone number, hometown, medical history, political party and even his sleeping position, every piece of his personal information. T... | instruction | 0 | 92,557 | 14 | 185,114 |
"Correct Solution:
```
class Page:
def __init__(self, name, buttons):
self.name = name
self.buttons = buttons
class Button:
def __init__(self, line):
self.x1 = int(line[0])
self.y1 = int(line[1])
self.x2 = int(line[2])
self.y2 = int(line[3])
self.link = ... | output | 1 | 92,557 | 14 | 185,115 |
Provide a correct Python 3 solution for this coding contest problem.
problem
In Ikatta, the SNS used by AOR Ika-chan, posts are called tweets.
And in squid, there is a concern that visibility will deteriorate if there are many replies to tweets, so when a tweet meets any of the following rules, the tweet will be dis... | instruction | 0 | 92,583 | 14 | 185,166 |
"Correct Solution:
```
import sys
readline = sys.stdin.readline
N, K = map(int, readline().split())
a = [int(readline())-1 for _ in [0]*N]
result = a.count(-1)
nodes = set()
node_add = nodes.add
hoge = set()
hoge_add = hoge.add
for i in range(N):
if a[i] in hoge:
node_add(a[i])
hoge_add(a[i])
visited ... | output | 1 | 92,583 | 14 | 185,167 |
Provide a correct Python 3 solution for this coding contest problem.
problem
In Ikatta, the SNS used by AOR Ika-chan, posts are called tweets.
And in squid, there is a concern that visibility will deteriorate if there are many replies to tweets, so when a tweet meets any of the following rules, the tweet will be dis... | instruction | 0 | 92,584 | 14 | 185,168 |
"Correct Solution:
```
# AOJ 2833: Displayed tweets
# Python3 2018.7.12 bal4u
INF = 0x7ffffff
N, K = map(int, input().split())
k, f = [INF]*(N+1), [0]*(N+1)
a = [0]+[int(input()) for i in range(N)]
ans = 0
for i in range(N, 0, -1):
re = a[i]
if re:
if f[i] == 0: v = 0; ans += 1
else:
v = k[i]
if v < K: an... | output | 1 | 92,584 | 14 | 185,169 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
problem
In Ikatta, the SNS used by AOR Ika-chan, posts are called tweets.
And in squid, there is a concern that visibility will deteriorate if there are many replies to tweets, so when a tweet... | instruction | 0 | 92,586 | 14 | 185,172 |
No | output | 1 | 92,586 | 14 | 185,173 |
Provide tags and a correct Python 3 solution for this coding contest problem.
What joy! Petya's parents went on a business trip for the whole year and the playful kid is left all by himself. Petya got absolutely happy. He jumped on the bed and threw pillows all day long, until...
Today Petya opened the cupboard and ... | instruction | 0 | 92,865 | 14 | 185,730 |
Tags: greedy, implementation, sortings
Correct Solution:
```
n=int(input())
l=list(map(int,input().split()))
k=0
s=0
while s<n:
if len(l)==0:
k=-1
break
h=max(l)
s=s+h
l.remove(h)
k=k+1
print(k)
``` | output | 1 | 92,865 | 14 | 185,731 |
Provide tags and a correct Python 3 solution for this coding contest problem.
What joy! Petya's parents went on a business trip for the whole year and the playful kid is left all by himself. Petya got absolutely happy. He jumped on the bed and threw pillows all day long, until...
Today Petya opened the cupboard and ... | instruction | 0 | 92,867 | 14 | 185,734 |
Tags: greedy, implementation, sortings
Correct Solution:
```
n=int(input())
l=list(map(int,input().split()))
l.sort(reverse=True)
s=0
a=0
flag=0
if n > 0:
for i in range(len(l)):
s+=l[i]
a+=1
if n<=s:
flag=1
break
if flag == 1:
print(a)
else:
print(-1)
else:
print(0)
``` | output | 1 | 92,867 | 14 | 185,735 |
Provide tags and a correct Python 3 solution for this coding contest problem.
What joy! Petya's parents went on a business trip for the whole year and the playful kid is left all by himself. Petya got absolutely happy. He jumped on the bed and threw pillows all day long, until...
Today Petya opened the cupboard and ... | instruction | 0 | 92,868 | 14 | 185,736 |
Tags: greedy, implementation, sortings
Correct Solution:
```
n = int(input())
a = map(int, input().split())
if n is 0:
print('0')
exit()
c = 0
for i, v in enumerate(reversed(sorted(a))):
c += v
if c >= n:
print(i + 1)
exit()
print('-1')
``` | output | 1 | 92,868 | 14 | 185,737 |
Provide tags and a correct Python 3 solution for this coding contest problem.
What joy! Petya's parents went on a business trip for the whole year and the playful kid is left all by himself. Petya got absolutely happy. He jumped on the bed and threw pillows all day long, until...
Today Petya opened the cupboard and ... | instruction | 0 | 92,869 | 14 | 185,738 |
Tags: greedy, implementation, sortings
Correct Solution:
```
n=int(input())
l1=list(map(int,input().split()))
l1=sorted(l1,reverse=True)
a=sum(l1)
if a<n:
print("-1")
else:
i=0
b=0
while b<n:
b+=l1[i]
i+=1
print(i)
``` | output | 1 | 92,869 | 14 | 185,739 |
Provide tags and a correct Python 3 solution for this coding contest problem.
What joy! Petya's parents went on a business trip for the whole year and the playful kid is left all by himself. Petya got absolutely happy. He jumped on the bed and threw pillows all day long, until...
Today Petya opened the cupboard and ... | instruction | 0 | 92,870 | 14 | 185,740 |
Tags: greedy, implementation, sortings
Correct Solution:
```
n=int(input())
num=[int(x) for x in input().split()]
list.sort(num,reverse=True)
a=0
b=0
for i in range(len(num)):
a=a+int(num[i])
if a>=n:
b=i+1
break
if n==0:
print(0)
else:
if b==0:
print(-1)
else:
print(... | output | 1 | 92,870 | 14 | 185,741 |
Provide tags and a correct Python 3 solution for this coding contest problem.
What joy! Petya's parents went on a business trip for the whole year and the playful kid is left all by himself. Petya got absolutely happy. He jumped on the bed and threw pillows all day long, until...
Today Petya opened the cupboard and ... | instruction | 0 | 92,871 | 14 | 185,742 |
Tags: greedy, implementation, sortings
Correct Solution:
```
k= int(input())
a = list(map(int, input().split()))
if sum(a)<k:
print(-1)
exit()
if k<=0:
print(0)
exit()
else:
a.sort(reverse = True)
sum = 0
i = 0
while(sum<k):
sum +=a[i]
i+=1
print(i)
``` | output | 1 | 92,871 | 14 | 185,743 |
Provide tags and a correct Python 3 solution for this coding contest problem.
What joy! Petya's parents went on a business trip for the whole year and the playful kid is left all by himself. Petya got absolutely happy. He jumped on the bed and threw pillows all day long, until...
Today Petya opened the cupboard and ... | instruction | 0 | 92,872 | 14 | 185,744 |
Tags: greedy, implementation, sortings
Correct Solution:
```
def business(n, ls):
s = 0
count = 0
if(n == 0):
return 0
s1 = sum(ls)
while(s < n):
m = max(ls)
s = s + m
i = ls.index(max(ls))
ls[i] = 0
count = count + 1
if(s == s1 and s < n):... | output | 1 | 92,872 | 14 | 185,745 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Pashmak decided to give Parmida a pair of flowers from the garden. There are n flowers in the garden and the i-th of them has a beauty number bi. Parmida is a very strange girl so she doesn't want to have the two most beautiful flowers neces... | instruction | 0 | 93,035 | 14 | 186,070 |
Tags: combinatorics, implementation, sortings
Correct Solution:
```
n=int(input())
l=list(map(int, input().split()))
max=max(l)
min=min(l)
m=l.count(max)
if min==max:
print(str(abs(max-min))+" "+str(m*(m-1)//2))
else:
print(str(abs(max-min))+" "+str(m*l.count(min)))
``` | output | 1 | 93,035 | 14 | 186,071 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Pashmak decided to give Parmida a pair of flowers from the garden. There are n flowers in the garden and the i-th of them has a beauty number bi. Parmida is a very strange girl so she doesn't want to have the two most beautiful flowers neces... | instruction | 0 | 93,036 | 14 | 186,072 |
Tags: combinatorics, implementation, sortings
Correct Solution:
```
n=int(input())
a = list(map(int, input().split()))
maximum=max(a)
minimum=min(a)
if minimum==maximum:
print(0,int(n/2*(n-1)))
else:
print(maximum-minimum,a.count(maximum)*a.count(minimum))
``` | output | 1 | 93,036 | 14 | 186,073 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Pashmak decided to give Parmida a pair of flowers from the garden. There are n flowers in the garden and the i-th of them has a beauty number bi. Parmida is a very strange girl so she doesn't want to have the two most beautiful flowers neces... | instruction | 0 | 93,037 | 14 | 186,074 |
Tags: combinatorics, implementation, sortings
Correct Solution:
```
n=int(input())
l=list(map(int,input().split()))
id1=0
id2=0
mi=l[0]
ma=l[0]
for i in l:
if(i>ma):
ma=i
if(i<mi):
mi=i
for i in l:
if(i==mi):
id1+=1
if(i==ma):
id2+=1
if(mi!=ma):
print("{0} {1}".format(ma-mi,id1*id2))
else:
print("{0} {1}"... | output | 1 | 93,037 | 14 | 186,075 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Pashmak decided to give Parmida a pair of flowers from the garden. There are n flowers in the garden and the i-th of them has a beauty number bi. Parmida is a very strange girl so she doesn't want to have the two most beautiful flowers neces... | instruction | 0 | 93,038 | 14 | 186,076 |
Tags: combinatorics, implementation, sortings
Correct Solution:
```
#!/usr/bin/env python3
import math
if __name__ == "__main__":
n = int(input())
bis = list(map(int, input().split()))
i, j= max(bis), min(bis)
print(i-j, n*(n-1)//2 if i == j else bis.count(i)*bis.count(j))
``` | output | 1 | 93,038 | 14 | 186,077 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.