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
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Heidi's friend Jenny is asking Heidi to deliver an important letter to one of their common friends. Since Jenny is Irish, Heidi thinks that this might be a prank. More precisely, she suspects th...
instruction
0
100,842
14
201,684
Yes
output
1
100,842
14
201,685
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Heidi's friend Jenny is asking Heidi to deliver an important letter to one of their common friends. Since Jenny is Irish, Heidi thinks that this might be a prank. More precisely, she suspects th...
instruction
0
100,843
14
201,686
Yes
output
1
100,843
14
201,687
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Heidi's friend Jenny is asking Heidi to deliver an important letter to one of their common friends. Since Jenny is Irish, Heidi thinks that this might be a prank. More precisely, she suspects th...
instruction
0
100,844
14
201,688
No
output
1
100,844
14
201,689
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Heidi's friend Jenny is asking Heidi to deliver an important letter to one of their common friends. Since Jenny is Irish, Heidi thinks that this might be a prank. More precisely, she suspects th...
instruction
0
100,845
14
201,690
No
output
1
100,845
14
201,691
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Heidi's friend Jenny is asking Heidi to deliver an important letter to one of their common friends. Since Jenny is Irish, Heidi thinks that this might be a prank. More precisely, she suspects th...
instruction
0
100,846
14
201,692
No
output
1
100,846
14
201,693
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Heidi's friend Jenny is asking Heidi to deliver an important letter to one of their common friends. Since Jenny is Irish, Heidi thinks that this might be a prank. More precisely, she suspects th...
instruction
0
100,847
14
201,694
No
output
1
100,847
14
201,695
Provide tags and a correct Python 3 solution for this coding contest problem. As the guys fried the radio station facilities, the school principal gave them tasks as a punishment. Dustin's task was to add comments to nginx configuration for school's website. The school has n servers. Each server has a name and an ip (...
instruction
0
100,886
14
201,772
Tags: implementation, strings Correct Solution: ``` m, n = map(int, input().split()) s1 = dict(reversed(input().split()) for _ in range(m)) for _ in range(n): l = input() #c, d = map(str, input().split()) c, d = l.split() print(l + ' #' + s1[d[:-1]]) # for x in s1: # if d[:-1] == s1[x]: # print(l +" #" + ...
output
1
100,886
14
201,773
Provide tags and a correct Python 3 solution for this coding contest problem. As the guys fried the radio station facilities, the school principal gave them tasks as a punishment. Dustin's task was to add comments to nginx configuration for school's website. The school has n servers. Each server has a name and an ip (...
instruction
0
100,887
14
201,774
Tags: implementation, strings Correct Solution: ``` n,m=map(int,input().split()) d=dict([input().split()[::-1] for i in range(n)]) l=[input().split() for i in range(m)] for i in l: print(i[0],i[1],'#'+d[i[1][:-1]],sep=' ') ```
output
1
100,887
14
201,775
Provide tags and a correct Python 3 solution for this coding contest problem. As the guys fried the radio station facilities, the school principal gave them tasks as a punishment. Dustin's task was to add comments to nginx configuration for school's website. The school has n servers. Each server has a name and an ip (...
instruction
0
100,888
14
201,776
Tags: implementation, strings Correct Solution: ``` x,y=map(int,input().split()) n=list() t=list() for i in range(x): n.append(input().split()) for i in range(y): t.append(input().split()) for i in range(y): for j in range(x): l=t[i][1][0:len(t[i][1])-1] if l == ...
output
1
100,888
14
201,777
Provide tags and a correct Python 3 solution for this coding contest problem. As the guys fried the radio station facilities, the school principal gave them tasks as a punishment. Dustin's task was to add comments to nginx configuration for school's website. The school has n servers. Each server has a name and an ip (...
instruction
0
100,889
14
201,778
Tags: implementation, strings Correct Solution: ``` import sys import math import bisect from sys import stdin, stdout from math import gcd, floor, sqrt, log from collections import defaultdict as dd from bisect import bisect_left as bl, bisect_right as br from collections import Counter #sys.setrecursionlimit(1000000...
output
1
100,889
14
201,779
Provide tags and a correct Python 3 solution for this coding contest problem. As the guys fried the radio station facilities, the school principal gave them tasks as a punishment. Dustin's task was to add comments to nginx configuration for school's website. The school has n servers. Each server has a name and an ip (...
instruction
0
100,890
14
201,780
Tags: implementation, strings Correct Solution: ``` n,m=map(int,input().split()) server=[] cont=[] for i in range(n): s=input() server.append(s.split()) for j in range(m): s=input() cont.append(s.split()) for i in range(m): st=cont[i][1] st=st[:len(st)-1] for j in range(n): if(server[j][1]==st): ...
output
1
100,890
14
201,781
Provide tags and a correct Python 3 solution for this coding contest problem. As the guys fried the radio station facilities, the school principal gave them tasks as a punishment. Dustin's task was to add comments to nginx configuration for school's website. The school has n servers. Each server has a name and an ip (...
instruction
0
100,891
14
201,782
Tags: implementation, strings Correct Solution: ``` lst=list(map(int, input().split())) m=lst[0] n=lst[1] table=list() for i in range(0,m): lst=list(map(str,input().split())) table.append(lst) for i in range(0,n): lstt=list(map(str,input().split())) for j in range(0,m): if lstt[1]==table[j][1]+'...
output
1
100,891
14
201,783
Provide tags and a correct Python 3 solution for this coding contest problem. As the guys fried the radio station facilities, the school principal gave them tasks as a punishment. Dustin's task was to add comments to nginx configuration for school's website. The school has n servers. Each server has a name and an ip (...
instruction
0
100,892
14
201,784
Tags: implementation, strings Correct Solution: ``` #!/usr/bin/python3 import sys inf = [int(x) for x in sys.stdin.readline().split(" ")] ser = {} for i in range(inf[0]): new = sys.stdin.readline().split(" ") ser[new[1].strip()+";"] = new[0].strip() for i in range(inf[1]): new = sys.stdin.readline() ...
output
1
100,892
14
201,785
Provide tags and a correct Python 3 solution for this coding contest problem. As the guys fried the radio station facilities, the school principal gave them tasks as a punishment. Dustin's task was to add comments to nginx configuration for school's website. The school has n servers. Each server has a name and an ip (...
instruction
0
100,893
14
201,786
Tags: implementation, strings Correct Solution: ``` from collections import defaultdict final = defaultdict(list) n, m = map(int, input().split()) d, name, ip = [], [], [] # d = dict(input().split() for _ in range(n)) for _ in range(n): name = [] i = input().split() name.append(i[1]) name.append(i[0]...
output
1
100,893
14
201,787
Provide a correct Python 3 solution for this coding contest problem. An SNS has N users - User 1, User 2, \cdots, User N. Between these N users, there are some relationships - M friendships and K blockships. For each i = 1, 2, \cdots, M, there is a bidirectional friendship between User A_i and User B_i. For each i ...
instruction
0
100,936
14
201,872
"Correct Solution: ``` from collections import deque n,m,k= map(int, input().split()) fri = [[] for _ in range(n+1)] blo = [[] for _ in range(n+1)] for i in range(m): a, b = map(int, input().split()) fri[a].append(b) fri[b].append(a) for i in range(k): a, b = map(int, input().split()) blo[a].app...
output
1
100,936
14
201,873
Provide a correct Python 3 solution for this coding contest problem. An SNS has N users - User 1, User 2, \cdots, User N. Between these N users, there are some relationships - M friendships and K blockships. For each i = 1, 2, \cdots, M, there is a bidirectional friendship between User A_i and User B_i. For each i ...
instruction
0
100,937
14
201,874
"Correct Solution: ``` n,m,k = map(int, input().split()) g = [[] for i in range(n+1)] f = [0]*(n+1) b = [] for i in range(m): u, v = map(int, input().split()) g[u].append(v) g[v].append(u) f[u] += 1 f[v] += 1 for i in range(k): b.append(map(int, input().split())) count = 0 renketu_list = [-1]*(n+1) renketu...
output
1
100,937
14
201,875
Provide a correct Python 3 solution for this coding contest problem. An SNS has N users - User 1, User 2, \cdots, User N. Between these N users, there are some relationships - M friendships and K blockships. For each i = 1, 2, \cdots, M, there is a bidirectional friendship between User A_i and User B_i. For each i ...
instruction
0
100,938
14
201,876
"Correct Solution: ``` from collections import defaultdict from collections import Counter N,M,K = map(int,input().split()) fn = defaultdict(lambda: 1) CD = [0]*K par = list(range(N)) def root(x): S = set() S.add(x) y = x while True: if par[y] == y: for s in S: pa...
output
1
100,938
14
201,877
Provide a correct Python 3 solution for this coding contest problem. An SNS has N users - User 1, User 2, \cdots, User N. Between these N users, there are some relationships - M friendships and K blockships. For each i = 1, 2, \cdots, M, there is a bidirectional friendship between User A_i and User B_i. For each i ...
instruction
0
100,939
14
201,878
"Correct Solution: ``` from collections import defaultdict, deque, Counter N,M,K= map(int,input().split()) friend = defaultdict(list) #block = defaultdict(list) for i in range(M): a,b= list(map(int,input().split())) friend[a].append(b) friend[b].append(a) ''' for i in range(K): c,d= list(map(int,input...
output
1
100,939
14
201,879
Provide a correct Python 3 solution for this coding contest problem. An SNS has N users - User 1, User 2, \cdots, User N. Between these N users, there are some relationships - M friendships and K blockships. For each i = 1, 2, \cdots, M, there is a bidirectional friendship between User A_i and User B_i. For each i ...
instruction
0
100,940
14
201,880
"Correct Solution: ``` N,M,K=map(int,input().split()) par=[i for i in range(N)] siz=[1 for _ in range(N)] rank=[0 for _ in range(N)] def find(x): if(par[x]==x): return x else: par[x]=find(par[x]) return par[x] def union(a,b): a=find(a) b=find(b) if(a==b): return 0 ...
output
1
100,940
14
201,881
Provide a correct Python 3 solution for this coding contest problem. An SNS has N users - User 1, User 2, \cdots, User N. Between these N users, there are some relationships - M friendships and K blockships. For each i = 1, 2, \cdots, M, there is a bidirectional friendship between User A_i and User B_i. For each i ...
instruction
0
100,941
14
201,882
"Correct Solution: ``` r=lambda x:p[x]>0and r(p[x])or x (n,m,k),*t=[map(int,t.split())for t in open(0)] p=[-1]*-~n s=[-1]*-~n for a,b in t: x,y=sorted((r(a),r(b))) if(x!=y)*m>0:p[x]+=p[y];p[y]=x if(x==y)+(m>0):s[a]-=1;s[b]-=1 m-=1 print(*[s[i+1]-p[r(i+1)]for i in range(n)]) ```
output
1
100,941
14
201,883
Provide a correct Python 3 solution for this coding contest problem. An SNS has N users - User 1, User 2, \cdots, User N. Between these N users, there are some relationships - M friendships and K blockships. For each i = 1, 2, \cdots, M, there is a bidirectional friendship between User A_i and User B_i. For each i ...
instruction
0
100,942
14
201,884
"Correct Solution: ``` from collections import deque #空のリスト 作った後は普通にappend使えばOK n,m,k=map(int,input().split()) tomodati=[[] for i in range(n+1)] group=[0]*(n+1) group_cnt=[0]*(n+1) block=[0]*(n+1) tansaku=deque() for i in range(m): a,b=map(int,input().split()) tomodati[a].append(b) tomodati[b].ap...
output
1
100,942
14
201,885
Provide a correct Python 3 solution for this coding contest problem. An SNS has N users - User 1, User 2, \cdots, User N. Between these N users, there are some relationships - M friendships and K blockships. For each i = 1, 2, \cdots, M, there is a bidirectional friendship between User A_i and User B_i. For each i ...
instruction
0
100,943
14
201,886
"Correct Solution: ``` r=lambda x:p[x]>0and r(p[x])or x (n,m,k),*t=[map(int,t.split())for t in open(0)] p=[-1]*-~n s=p[:] for a,b in t: x,y=sorted((r(a),r(b))) if(x!=y)*m>0:p[x]+=p[y];p[y]=y=x if x==y:s[a]-=1;s[b]-=1 m-=1 print(*[s[i+1]-p[r(i+1)]for i in range(n)]) ```
output
1
100,943
14
201,887
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. An SNS has N users - User 1, User 2, \cdots, User N. Between these N users, there are some relationships - M friendships and K blockships. For each i = 1, 2, \cdots, M, there is a bidirectiona...
instruction
0
100,944
14
201,888
Yes
output
1
100,944
14
201,889
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. An SNS has N users - User 1, User 2, \cdots, User N. Between these N users, there are some relationships - M friendships and K blockships. For each i = 1, 2, \cdots, M, there is a bidirectiona...
instruction
0
100,945
14
201,890
Yes
output
1
100,945
14
201,891
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. An SNS has N users - User 1, User 2, \cdots, User N. Between these N users, there are some relationships - M friendships and K blockships. For each i = 1, 2, \cdots, M, there is a bidirectiona...
instruction
0
100,946
14
201,892
Yes
output
1
100,946
14
201,893
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. An SNS has N users - User 1, User 2, \cdots, User N. Between these N users, there are some relationships - M friendships and K blockships. For each i = 1, 2, \cdots, M, there is a bidirectiona...
instruction
0
100,947
14
201,894
Yes
output
1
100,947
14
201,895
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. An SNS has N users - User 1, User 2, \cdots, User N. Between these N users, there are some relationships - M friendships and K blockships. For each i = 1, 2, \cdots, M, there is a bidirectiona...
instruction
0
100,948
14
201,896
No
output
1
100,948
14
201,897
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. An SNS has N users - User 1, User 2, \cdots, User N. Between these N users, there are some relationships - M friendships and K blockships. For each i = 1, 2, \cdots, M, there is a bidirectiona...
instruction
0
100,949
14
201,898
No
output
1
100,949
14
201,899
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. An SNS has N users - User 1, User 2, \cdots, User N. Between these N users, there are some relationships - M friendships and K blockships. For each i = 1, 2, \cdots, M, there is a bidirectiona...
instruction
0
100,950
14
201,900
No
output
1
100,950
14
201,901
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. An SNS has N users - User 1, User 2, \cdots, User N. Between these N users, there are some relationships - M friendships and K blockships. For each i = 1, 2, \cdots, M, there is a bidirectiona...
instruction
0
100,951
14
201,902
No
output
1
100,951
14
201,903
Provide tags and a correct Python 3 solution for this coding contest problem. Petya is having a party soon, and he has decided to invite his n friends. He wants to make invitations in the form of origami. For each invitation, he needs two red sheets, five green sheets, and eight blue sheets. The store sells an infini...
instruction
0
101,213
14
202,426
Tags: math Correct Solution: ``` # cook your dish here n,k=map(int,input().split()) print((2*n)//k+(5*n)//k+(8*n)//k+(int((2*n)%k!=0)+int((5*n)%k!=0)+int((8*n)%k!=0))) ```
output
1
101,213
14
202,427
Provide tags and a correct Python 3 solution for this coding contest problem. Petya is having a party soon, and he has decided to invite his n friends. He wants to make invitations in the form of origami. For each invitation, he needs two red sheets, five green sheets, and eight blue sheets. The store sells an infini...
instruction
0
101,214
14
202,428
Tags: math Correct Solution: ``` import math n_str, k_str = input().split(" ") n = int(n_str) k = int(k_str) num_of_red_sheets = 2*n num_of_green_sheets = 5*n num_of_blue_sheets = 8*n num_of_red_notebooks = math.ceil(num_of_red_sheets / k) num_of_green_notebooks = math.ceil(num_of_green_sheets / k) num_of_blue_noteboo...
output
1
101,214
14
202,429
Provide tags and a correct Python 3 solution for this coding contest problem. Petya is having a party soon, and he has decided to invite his n friends. He wants to make invitations in the form of origami. For each invitation, he needs two red sheets, five green sheets, and eight blue sheets. The store sells an infini...
instruction
0
101,215
14
202,430
Tags: math Correct Solution: ``` s=input() s=s.split() for j in range(len(s)): s[j]=int(s[j]) n=s[0] k=s[1] red=2*n green=5*n blue=8*n res=0 if red%k==0: res=res+red//k else: res=res+red//k+1 if green%k==0: res=res+green//k else: res=res+green//k+1 if blue%k==0: res=res+blue//k else: res=res...
output
1
101,215
14
202,431
Provide tags and a correct Python 3 solution for this coding contest problem. Petya is having a party soon, and he has decided to invite his n friends. He wants to make invitations in the form of origami. For each invitation, he needs two red sheets, five green sheets, and eight blue sheets. The store sells an infini...
instruction
0
101,216
14
202,432
Tags: math Correct Solution: ``` n,k = map(int, input().split()) k1 = k-1 print((8*n+k1)//k + (5*n+k1)//k + (2*n+k1)//k) ```
output
1
101,216
14
202,433
Provide tags and a correct Python 3 solution for this coding contest problem. Petya is having a party soon, and he has decided to invite his n friends. He wants to make invitations in the form of origami. For each invitation, he needs two red sheets, five green sheets, and eight blue sheets. The store sells an infini...
instruction
0
101,217
14
202,434
Tags: math Correct Solution: ``` n, k = map(int, input().split()) m = (2 * n + k - 1) // k + (5 * n + k - 1) // k + (8 * n + k - 1) // k print(m) ```
output
1
101,217
14
202,435
Provide tags and a correct Python 3 solution for this coding contest problem. Petya is having a party soon, and he has decided to invite his n friends. He wants to make invitations in the form of origami. For each invitation, he needs two red sheets, five green sheets, and eight blue sheets. The store sells an infini...
instruction
0
101,218
14
202,436
Tags: math Correct Solution: ``` # -*- coding: utf-8 -*- import math import collections import bisect import heapq import time import itertools import sys """ created by shhuan at 2018/11/24 15:28 """ N, K = map(int, input().split()) r = 2 * N // K g = 5 * N // K b = 8 * N // K if r * K < 2*N: r += 1 if g * ...
output
1
101,218
14
202,437
Provide tags and a correct Python 3 solution for this coding contest problem. Petya is having a party soon, and he has decided to invite his n friends. He wants to make invitations in the form of origami. For each invitation, he needs two red sheets, five green sheets, and eight blue sheets. The store sells an infini...
instruction
0
101,219
14
202,438
Tags: math Correct Solution: ``` def one(t,n,k): if t*n/k>t*n//k: l=t*n//k+1 else: l=t*n//k return l s=input().split() n=int(s[0])#���-�� ������ k=int(s[1])#���-�� ������ � ����� �������� print(int(one(2,n,k)+one(5,n,k)+one(8,n,k))) ```
output
1
101,219
14
202,439
Provide tags and a correct Python 3 solution for this coding contest problem. Petya is having a party soon, and he has decided to invite his n friends. He wants to make invitations in the form of origami. For each invitation, he needs two red sheets, five green sheets, and eight blue sheets. The store sells an infini...
instruction
0
101,220
14
202,440
Tags: math Correct Solution: ``` import math n,k=list(map(int,input().split())) print(math.ceil((n*2)/k) + math.ceil((n*5)/k) + math.ceil((n*8)/k)) ```
output
1
101,220
14
202,441
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Petya is having a party soon, and he has decided to invite his n friends. He wants to make invitations in the form of origami. For each invitation, he needs two red sheets, five green sheets, a...
instruction
0
101,221
14
202,442
Yes
output
1
101,221
14
202,443
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Petya is having a party soon, and he has decided to invite his n friends. He wants to make invitations in the form of origami. For each invitation, he needs two red sheets, five green sheets, a...
instruction
0
101,222
14
202,444
Yes
output
1
101,222
14
202,445
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Petya is having a party soon, and he has decided to invite his n friends. He wants to make invitations in the form of origami. For each invitation, he needs two red sheets, five green sheets, a...
instruction
0
101,223
14
202,446
Yes
output
1
101,223
14
202,447
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Petya is having a party soon, and he has decided to invite his n friends. He wants to make invitations in the form of origami. For each invitation, he needs two red sheets, five green sheets, a...
instruction
0
101,224
14
202,448
Yes
output
1
101,224
14
202,449
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Petya is having a party soon, and he has decided to invite his n friends. He wants to make invitations in the form of origami. For each invitation, he needs two red sheets, five green sheets, a...
instruction
0
101,225
14
202,450
No
output
1
101,225
14
202,451
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Petya is having a party soon, and he has decided to invite his n friends. He wants to make invitations in the form of origami. For each invitation, he needs two red sheets, five green sheets, a...
instruction
0
101,226
14
202,452
No
output
1
101,226
14
202,453
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Petya is having a party soon, and he has decided to invite his n friends. He wants to make invitations in the form of origami. For each invitation, he needs two red sheets, five green sheets, a...
instruction
0
101,227
14
202,454
No
output
1
101,227
14
202,455
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Petya is having a party soon, and he has decided to invite his n friends. He wants to make invitations in the form of origami. For each invitation, he needs two red sheets, five green sheets, a...
instruction
0
101,228
14
202,456
No
output
1
101,228
14
202,457
Provide tags and a correct Python 3 solution for this coding contest problem. BerPhone X is almost ready for release with n applications being preinstalled on the phone. A category of an application characterizes a genre or a theme of this application (like "game", "business", or "education"). The categories are given...
instruction
0
101,318
14
202,636
Tags: greedy, implementation, math Correct Solution: ``` # Legends Always Come Up with Solution # Author: Manvir Singh import os from io import BytesIO, IOBase import sys from collections import Counter def main(): for _ in range(int(input())): n=int(input()) a,mi=[0]*(n+1),n for i in input...
output
1
101,318
14
202,637
Provide tags and a correct Python 3 solution for this coding contest problem. BerPhone X is almost ready for release with n applications being preinstalled on the phone. A category of an application characterizes a genre or a theme of this application (like "game", "business", or "education"). The categories are given...
instruction
0
101,319
14
202,638
Tags: greedy, implementation, math Correct Solution: ``` import sys import io, os import math gcd=math.gcd ceil=math.ceil input = io.BytesIO(os.read(0,os.fstat(0).st_size)).readline #arr=list(map(int, input().split())) def main(): t=int(input()) for _ in range(t): n=int(input()) arr=list(map(int...
output
1
101,319
14
202,639
Provide tags and a correct Python 3 solution for this coding contest problem. BerPhone X is almost ready for release with n applications being preinstalled on the phone. A category of an application characterizes a genre or a theme of this application (like "game", "business", or "education"). The categories are given...
instruction
0
101,320
14
202,640
Tags: greedy, implementation, math Correct Solution: ``` #m*(s-1)<=nItems<=m*s def checkSPossible(s,nItems): m=(nItems+s-1)//s # print('m:{}'.format(m)) return m*(s-1)<=nItems<=m*s def checkAllPossible(s,allCnts): for cnt in allCnts: if not checkSPossible(s,cnt): return False ...
output
1
101,320
14
202,641
Provide tags and a correct Python 3 solution for this coding contest problem. BerPhone X is almost ready for release with n applications being preinstalled on the phone. A category of an application characterizes a genre or a theme of this application (like "game", "business", or "education"). The categories are given...
instruction
0
101,321
14
202,642
Tags: greedy, implementation, math Correct Solution: ``` import sys from collections import Counter input = sys.stdin.readline for nt in range(int(input())): n = int(input()) a = list(map(int,input().split())) c = Counter(a) minn = n for i in c: minn = min(c[i],minn) ans = n for i in range(1,minn+2): flag = ...
output
1
101,321
14
202,643