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. There are n kangaroos with pockets. Each kangaroo has a size (integer number). A kangaroo can go into another kangaroo's pocket if and only if the size of kangaroo who hold the kangaroo is at least twice as large as the size of kangaroo who ...
instruction
0
58,348
14
116,696
Tags: binary search, greedy, sortings, two pointers Correct Solution: ``` n=int(input()) ls= sorted([int(input()) for _ in range(n)]) cnt=0 mid=n//2-1 right=n-1 # mated=0 # for _ in range(n//2): # if ls[right]>=2*ls[mid] and mid>=0: # cnt+=1 # mid-=1 # right-=1 # mated+=2 # else:...
output
1
58,348
14
116,697
Provide tags and a correct Python 3 solution for this coding contest problem. There are n kangaroos with pockets. Each kangaroo has a size (integer number). A kangaroo can go into another kangaroo's pocket if and only if the size of kangaroo who hold the kangaroo is at least twice as large as the size of kangaroo who ...
instruction
0
58,349
14
116,698
Tags: binary search, greedy, sortings, two pointers Correct Solution: ``` import sys, os, io def rs(): return sys.stdin.readline().rstrip() def ri(): return int(sys.stdin.readline()) def ria(): return list(map(int, sys.stdin.readline().split())) def ws(s): sys.stdout.write(s + '\n') def wi(n): sys.stdout.write(str(n) +...
output
1
58,349
14
116,699
Provide tags and a correct Python 3 solution for this coding contest problem. There are n kangaroos with pockets. Each kangaroo has a size (integer number). A kangaroo can go into another kangaroo's pocket if and only if the size of kangaroo who hold the kangaroo is at least twice as large as the size of kangaroo who ...
instruction
0
58,350
14
116,700
Tags: binary search, greedy, sortings, two pointers Correct Solution: ``` import sys n = int(input()) a = list(sorted([int(next(sys.stdin)) for _ in range(n)])) i, j = 0, n // 2 cnt = 0 while j < n: if a[i] == -1: i += 1 if i == j: j += 1 elif a[i] * 2 <= a[j]: cnt += 1 ...
output
1
58,350
14
116,701
Provide tags and a correct Python 3 solution for this coding contest problem. There are n kangaroos with pockets. Each kangaroo has a size (integer number). A kangaroo can go into another kangaroo's pocket if and only if the size of kangaroo who hold the kangaroo is at least twice as large as the size of kangaroo who ...
instruction
0
58,351
14
116,702
Tags: binary search, greedy, sortings, two pointers 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 = "x" in file...
output
1
58,351
14
116,703
Provide tags and a correct Python 3 solution for this coding contest problem. There are n kangaroos with pockets. Each kangaroo has a size (integer number). A kangaroo can go into another kangaroo's pocket if and only if the size of kangaroo who hold the kangaroo is at least twice as large as the size of kangaroo who ...
instruction
0
58,352
14
116,704
Tags: binary search, greedy, sortings, two pointers Correct Solution: ``` from sys import stdin import collections import os import sys from io import IOBase, BytesIO from sys import stdin, stdout from math import sqrt py2 = round(0.5) if py2: from future_builtins import ascii, filter, hex, map, oct, zip range ...
output
1
58,352
14
116,705
Provide tags and a correct Python 3 solution for this coding contest problem. There are n kangaroos with pockets. Each kangaroo has a size (integer number). A kangaroo can go into another kangaroo's pocket if and only if the size of kangaroo who hold the kangaroo is at least twice as large as the size of kangaroo who ...
instruction
0
58,353
14
116,706
Tags: binary search, greedy, sortings, two pointers Correct Solution: ``` import os import sys from io import BytesIO, IOBase def main(): pass # region fastio BUFSIZE = 8192 class FastIO(IOBase): newlines = 0 def __init__(self, file): self._fd = file.fileno() self.buffer = BytesIO() ...
output
1
58,353
14
116,707
Provide tags and a correct Python 3 solution for this coding contest problem. There are n kangaroos with pockets. Each kangaroo has a size (integer number). A kangaroo can go into another kangaroo's pocket if and only if the size of kangaroo who hold the kangaroo is at least twice as large as the size of kangaroo who ...
instruction
0
58,354
14
116,708
Tags: binary search, greedy, sortings, two pointers Correct Solution: ``` import os import sys from io import BytesIO, IOBase import math from decimal import * getcontext().prec = 25 MOD = pow(10, 9) + 7 BUFSIZE = 8192 class FastIO(IOBase): newlines = 0 def __init__(self, file): self._fd = file.fil...
output
1
58,354
14
116,709
Provide tags and a correct Python 3 solution for this coding contest problem. There are n kangaroos with pockets. Each kangaroo has a size (integer number). A kangaroo can go into another kangaroo's pocket if and only if the size of kangaroo who hold the kangaroo is at least twice as large as the size of kangaroo who ...
instruction
0
58,355
14
116,710
Tags: binary search, greedy, sortings, two pointers 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 = "x" in file.mode...
output
1
58,355
14
116,711
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. There are n kangaroos with pockets. Each kangaroo has a size (integer number). A kangaroo can go into another kangaroo's pocket if and only if the size of kangaroo who hold the kangaroo is at le...
instruction
0
58,359
14
116,718
Yes
output
1
58,359
14
116,719
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. There are n kangaroos with pockets. Each kangaroo has a size (integer number). A kangaroo can go into another kangaroo's pocket if and only if the size of kangaroo who hold the kangaroo is at le...
instruction
0
58,362
14
116,724
No
output
1
58,362
14
116,725
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. There are n kangaroos with pockets. Each kangaroo has a size (integer number). A kangaroo can go into another kangaroo's pocket if and only if the size of kangaroo who hold the kangaroo is at le...
instruction
0
58,363
14
116,726
No
output
1
58,363
14
116,727
Provide tags and a correct Python 3 solution for this coding contest problem. The Berland State University is hosting a ballroom dance in celebration of its 100500-th anniversary! n boys and m girls are already busy rehearsing waltz, minuet, polonaise and quadrille moves. We know that several boy&girl pairs are going...
instruction
0
58,402
14
116,804
Tags: dfs and similar, dp, graph matchings, greedy, sortings, two pointers Correct Solution: ``` # cook your dish here n=int(input()) l1=[int(s) for s in input().split()] m=int(input()) l2=[int(s) for s in input().split()] l1.sort() l2.sort() i=j=c=0 while(i<n and j<m): if(abs(l1[i]-l2[j])<=1): c+=1 ...
output
1
58,402
14
116,805
Provide tags and a correct Python 3 solution for this coding contest problem. The Berland State University is hosting a ballroom dance in celebration of its 100500-th anniversary! n boys and m girls are already busy rehearsing waltz, minuet, polonaise and quadrille moves. We know that several boy&girl pairs are going...
instruction
0
58,403
14
116,806
Tags: dfs and similar, dp, graph matchings, greedy, sortings, two pointers Correct Solution: ``` from collections import deque from math import ceil def ii():return int(input()) def si():return input() def mi():return map(int,input().split()) def li():return list(mi()) abc="abcdefghijklmnopqrstuvwxyz" n=ii() a=li() m=i...
output
1
58,403
14
116,807
Provide tags and a correct Python 3 solution for this coding contest problem. The Berland State University is hosting a ballroom dance in celebration of its 100500-th anniversary! n boys and m girls are already busy rehearsing waltz, minuet, polonaise and quadrille moves. We know that several boy&girl pairs are going...
instruction
0
58,404
14
116,808
Tags: dfs and similar, dp, graph matchings, greedy, sortings, two pointers Correct Solution: ``` import math input() lista_hombres = list(input().split()) for i in range(len(lista_hombres)): lista_hombres[i] = int(lista_hombres[i]) input() lista_mujeres = list(input().split()) for i in range(len(lista_mujeres)): ...
output
1
58,404
14
116,809
Provide tags and a correct Python 3 solution for this coding contest problem. The Berland State University is hosting a ballroom dance in celebration of its 100500-th anniversary! n boys and m girls are already busy rehearsing waltz, minuet, polonaise and quadrille moves. We know that several boy&girl pairs are going...
instruction
0
58,405
14
116,810
Tags: dfs and similar, dp, graph matchings, greedy, sortings, two pointers Correct Solution: ``` def main(): from sys import stdin from itertools import islice tokens = map(int, stdin.read().split()) N = next(tokens) boys = sorted(islice(tokens, N)) M = next(tokens) girls = sorted(islice(tok...
output
1
58,405
14
116,811
Provide tags and a correct Python 3 solution for this coding contest problem. The Berland State University is hosting a ballroom dance in celebration of its 100500-th anniversary! n boys and m girls are already busy rehearsing waltz, minuet, polonaise and quadrille moves. We know that several boy&girl pairs are going...
instruction
0
58,406
14
116,812
Tags: dfs and similar, dp, graph matchings, greedy, sortings, two pointers Correct Solution: ``` def foo(n,m): c=0 n.sort() m.sort() for i in range(len(n)): for j in range(len(m)): if(abs(n[i]-m[j])<=1): c+=1 m[j]=10000 break return...
output
1
58,406
14
116,813
Provide tags and a correct Python 3 solution for this coding contest problem. The Berland State University is hosting a ballroom dance in celebration of its 100500-th anniversary! n boys and m girls are already busy rehearsing waltz, minuet, polonaise and quadrille moves. We know that several boy&girl pairs are going...
instruction
0
58,407
14
116,814
Tags: dfs and similar, dp, graph matchings, greedy, sortings, two pointers Correct Solution: ``` n=int(input()) a=sorted(list(map(int,input().split()))) m=int(input()) b=sorted(list(map(int,input().split()))) i,j,cnt=0,0,0 while i<n and j<m: if abs(a[i]-b[j])<=1: cnt+=1 i+=1 j+=1 elif ...
output
1
58,407
14
116,815
Provide tags and a correct Python 3 solution for this coding contest problem. The Berland State University is hosting a ballroom dance in celebration of its 100500-th anniversary! n boys and m girls are already busy rehearsing waltz, minuet, polonaise and quadrille moves. We know that several boy&girl pairs are going...
instruction
0
58,408
14
116,816
Tags: dfs and similar, dp, graph matchings, greedy, sortings, two pointers Correct Solution: ``` def crear_lista(string): lista = [] cambio = False num = "" for letra in string+" ": if letra == " ": cambio = True lista.append(int(num)) num = "" if not ...
output
1
58,408
14
116,817
Provide tags and a correct Python 3 solution for this coding contest problem. The Berland State University is hosting a ballroom dance in celebration of its 100500-th anniversary! n boys and m girls are already busy rehearsing waltz, minuet, polonaise and quadrille moves. We know that several boy&girl pairs are going...
instruction
0
58,409
14
116,818
Tags: dfs and similar, dp, graph matchings, greedy, sortings, two pointers Correct Solution: ``` # Velichko β™₯ n = int(input()) b = list (map(int,input().split())) m = int(input()) g = list (map(int,input().split())) i=int(0) j=int(0) ans=int(0) g.sort() b.sort() while i<n and j<m: if b[i]-1>g[j]: j+=1 ...
output
1
58,409
14
116,819
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. The Berland State University is hosting a ballroom dance in celebration of its 100500-th anniversary! n boys and m girls are already busy rehearsing waltz, minuet, polonaise and quadrille moves....
instruction
0
58,410
14
116,820
Yes
output
1
58,410
14
116,821
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. The Berland State University is hosting a ballroom dance in celebration of its 100500-th anniversary! n boys and m girls are already busy rehearsing waltz, minuet, polonaise and quadrille moves....
instruction
0
58,411
14
116,822
Yes
output
1
58,411
14
116,823
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. The Berland State University is hosting a ballroom dance in celebration of its 100500-th anniversary! n boys and m girls are already busy rehearsing waltz, minuet, polonaise and quadrille moves....
instruction
0
58,412
14
116,824
Yes
output
1
58,412
14
116,825
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. The Berland State University is hosting a ballroom dance in celebration of its 100500-th anniversary! n boys and m girls are already busy rehearsing waltz, minuet, polonaise and quadrille moves....
instruction
0
58,414
14
116,828
No
output
1
58,414
14
116,829
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. The Berland State University is hosting a ballroom dance in celebration of its 100500-th anniversary! n boys and m girls are already busy rehearsing waltz, minuet, polonaise and quadrille moves....
instruction
0
58,415
14
116,830
No
output
1
58,415
14
116,831
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. The Berland State University is hosting a ballroom dance in celebration of its 100500-th anniversary! n boys and m girls are already busy rehearsing waltz, minuet, polonaise and quadrille moves....
instruction
0
58,416
14
116,832
No
output
1
58,416
14
116,833
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. The Berland State University is hosting a ballroom dance in celebration of its 100500-th anniversary! n boys and m girls are already busy rehearsing waltz, minuet, polonaise and quadrille moves....
instruction
0
58,417
14
116,834
No
output
1
58,417
14
116,835
Provide tags and a correct Python 3 solution for this coding contest problem. Limak is a little polar bear. He loves connecting with other bears via social networks. He has n friends and his relation with the i-th of them is described by a unique integer ti. The bigger this value is, the better the friendship is. No t...
instruction
0
58,469
14
116,938
Tags: implementation Correct Solution: ``` n,k,q=input().split() rank=input().split() for i in range(len(rank)): rank[i]=int(rank[i]) li=[] names=[] for i in range(int(q)): query=input().split() if(query[0]=='1'): if(len(li)<int(k)): names.append(query[1]) li.append(rank[int(...
output
1
58,469
14
116,939
Provide tags and a correct Python 3 solution for this coding contest problem. Limak is a little polar bear. He loves connecting with other bears via social networks. He has n friends and his relation with the i-th of them is described by a unique integer ti. The bigger this value is, the better the friendship is. No t...
instruction
0
58,470
14
116,940
Tags: implementation Correct Solution: ``` def Core(size, rate, data): online_rate = [] count = 0 for item in data: if item[0] == 1: if size > count: count += 1 online_rate.append(rate[item[1]]) online_rate.sort(key=lambda x: -x) elif online_rate[-1] < rate[item[1]]: online_rate[-1] = rate[it...
output
1
58,470
14
116,941
Provide tags and a correct Python 3 solution for this coding contest problem. Limak is a little polar bear. He loves connecting with other bears via social networks. He has n friends and his relation with the i-th of them is described by a unique integer ti. The bigger this value is, the better the friendship is. No t...
instruction
0
58,471
14
116,942
Tags: implementation Correct Solution: ``` import os import sys import math import heapq from decimal import * from io import BytesIO, IOBase from collections import defaultdict, deque def main(): n,k,q = rm() a = rl() b = [] for i in range(q): c,d=rm() if c==1: d-=1 ...
output
1
58,471
14
116,943
Provide tags and a correct Python 3 solution for this coding contest problem. Limak is a little polar bear. He loves connecting with other bears via social networks. He has n friends and his relation with the i-th of them is described by a unique integer ti. The bigger this value is, the better the friendship is. No t...
instruction
0
58,472
14
116,944
Tags: implementation Correct Solution: ``` n=input() b=[] b=n.split() n=int(b[0]) k=int(b[1]) q=int(b[2]) c=input() level=c.split() online=[] for i in range(q): c=input() z=c.split() if z[0]=='1': if len(online)<k: online.append(int(z[1])) else: min=int(level[int(z[1]...
output
1
58,472
14
116,945
Provide tags and a correct Python 3 solution for this coding contest problem. Limak is a little polar bear. He loves connecting with other bears via social networks. He has n friends and his relation with the i-th of them is described by a unique integer ti. The bigger this value is, the better the friendship is. No t...
instruction
0
58,473
14
116,946
Tags: implementation Correct Solution: ``` from heapq import * n, f, q = [int(s) for s in input().split()] loves = [int(s) for s in input().split()] k = [] onlines = set() for i in range(q): ind, num = [int(s) for s in input().split()] if ind == 1: onlines.add(num - 1) if len(k)<f: ...
output
1
58,473
14
116,947
Provide tags and a correct Python 3 solution for this coding contest problem. Limak is a little polar bear. He loves connecting with other bears via social networks. He has n friends and his relation with the i-th of them is described by a unique integer ti. The bigger this value is, the better the friendship is. No t...
instruction
0
58,474
14
116,948
Tags: implementation Correct Solution: ``` n, k, q = [int(i) for i in input().split()] t = input().split() ID = {} online = [] for i in range(len(t)): ID[i+1] = t[i] for i in range(q): a = list(map(int,input().split())) if a[0] == 1: online.append([a[1],int(ID[a[1]])]) if len(online) > k: ...
output
1
58,474
14
116,949
Provide tags and a correct Python 3 solution for this coding contest problem. Limak is a little polar bear. He loves connecting with other bears via social networks. He has n friends and his relation with the i-th of them is described by a unique integer ti. The bigger this value is, the better the friendship is. No t...
instruction
0
58,475
14
116,950
Tags: implementation Correct Solution: ``` def type1(idi): global mnoj, n, k, q, t if len(mnoj) < k: mnoj.add(t[idi]) else: mn = min(mnoj) if t[idi] > mn: mnoj.remove(mn) mnoj.add(t[idi]) def main(): global mnoj, n, k, q, t n, k, q = map(int, input()....
output
1
58,475
14
116,951
Provide tags and a correct Python 3 solution for this coding contest problem. Limak is a little polar bear. He loves connecting with other bears via social networks. He has n friends and his relation with the i-th of them is described by a unique integer ti. The bigger this value is, the better the friendship is. No t...
instruction
0
58,476
14
116,952
Tags: implementation Correct Solution: ``` n, size, tasks = map(int, input().split()) friends = list(map(int, input().split())) online = list() for i in range(tasks): type, id = map(int, input().split()) id -= 1 if type == 1: adds = friends[id] online = sorted(online + [adds], reverse=True) ...
output
1
58,476
14
116,953
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Limak is a little polar bear. He loves connecting with other bears via social networks. He has n friends and his relation with the i-th of them is described by a unique integer ti. The bigger th...
instruction
0
58,477
14
116,954
Yes
output
1
58,477
14
116,955
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Limak is a little polar bear. He loves connecting with other bears via social networks. He has n friends and his relation with the i-th of them is described by a unique integer ti. The bigger th...
instruction
0
58,478
14
116,956
Yes
output
1
58,478
14
116,957
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Limak is a little polar bear. He loves connecting with other bears via social networks. He has n friends and his relation with the i-th of them is described by a unique integer ti. The bigger th...
instruction
0
58,479
14
116,958
Yes
output
1
58,479
14
116,959
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Limak is a little polar bear. He loves connecting with other bears via social networks. He has n friends and his relation with the i-th of them is described by a unique integer ti. The bigger th...
instruction
0
58,480
14
116,960
Yes
output
1
58,480
14
116,961
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Limak is a little polar bear. He loves connecting with other bears via social networks. He has n friends and his relation with the i-th of them is described by a unique integer ti. The bigger th...
instruction
0
58,481
14
116,962
No
output
1
58,481
14
116,963
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Limak is a little polar bear. He loves connecting with other bears via social networks. He has n friends and his relation with the i-th of them is described by a unique integer ti. The bigger th...
instruction
0
58,482
14
116,964
No
output
1
58,482
14
116,965
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Limak is a little polar bear. He loves connecting with other bears via social networks. He has n friends and his relation with the i-th of them is described by a unique integer ti. The bigger th...
instruction
0
58,483
14
116,966
No
output
1
58,483
14
116,967
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Limak is a little polar bear. He loves connecting with other bears via social networks. He has n friends and his relation with the i-th of them is described by a unique integer ti. The bigger th...
instruction
0
58,484
14
116,968
No
output
1
58,484
14
116,969
Provide tags and a correct Python 3 solution for this coding contest problem. There are n servers in a laboratory, each of them can perform tasks. Each server has a unique id β€” integer from 1 to n. It is known that during the day q tasks will come, the i-th of them is characterized with three integers: ti β€” the momen...
instruction
0
58,533
14
117,066
Tags: implementation Correct Solution: ``` import sys try: sys.stdin = open('input.txt', 'r') sys.stdout = open('output.txt', 'w') except: pass input = sys.stdin.readline n, q = map(int, input().split()) server = [-1]*n for _ in range(q): t, k, d = map(int, input().split()) cnt = 0 for i in range(n): if t >=...
output
1
58,533
14
117,067
Provide tags and a correct Python 3 solution for this coding contest problem. There are n servers in a laboratory, each of them can perform tasks. Each server has a unique id β€” integer from 1 to n. It is known that during the day q tasks will come, the i-th of them is characterized with three integers: ti β€” the momen...
instruction
0
58,534
14
117,068
Tags: implementation Correct Solution: ``` import heapq as pq from sys import stdin, stdout #Heap method written by Engineermind.cho #Testing if heap + fast IO can make python pass this question n, q = map(int, stdin.readline().split()) server = [i for i in range(1, n+1)] running = [] is_chg = False for x in stdin.re...
output
1
58,534
14
117,069
Provide tags and a correct Python 3 solution for this coding contest problem. There are n servers in a laboratory, each of them can perform tasks. Each server has a unique id β€” integer from 1 to n. It is known that during the day q tasks will come, the i-th of them is characterized with three integers: ti β€” the momen...
instruction
0
58,535
14
117,070
Tags: implementation Correct Solution: ``` ''' 8 6 1 3 20 4 2 1 6 5 5 10 1 1 15 3 6 21 8 8 ''' p=input().rstrip().split(' ') n=int(p[0]) q=int(p[1]) L=[0]*n; Q=[] W=[] S=[] D=[] for i in range(0,q): o=input().rstrip().split(' ') t=int(o[0]) k=int(o[1]) d=int(o[2]) j=0; while(len(S)>0 and j<...
output
1
58,535
14
117,071
Provide tags and a correct Python 3 solution for this coding contest problem. There are n servers in a laboratory, each of them can perform tasks. Each server has a unique id β€” integer from 1 to n. It is known that during the day q tasks will come, the i-th of them is characterized with three integers: ti β€” the momen...
instruction
0
58,536
14
117,072
Tags: implementation Correct Solution: ``` n , q = map(int,input().split()) tasks=[] servers = [0]*n for _ in range(q): tasks.append(tuple(map(int,input().split()))) for t,k,d in tasks: a = [] for i in range(n): if t>=servers[i]: a.append(i) if len(a)>=k: total = 0 ...
output
1
58,536
14
117,073
Provide tags and a correct Python 3 solution for this coding contest problem. There are n servers in a laboratory, each of them can perform tasks. Each server has a unique id β€” integer from 1 to n. It is known that during the day q tasks will come, the i-th of them is characterized with three integers: ti β€” the momen...
instruction
0
58,537
14
117,074
Tags: implementation Correct Solution: ``` import sys input = sys.stdin.readline # server, task = map(int, input().split()) serverstatus = [0]*server for i in range(task): moment, serven, time = map(int, input().split()) ava = 0 total = 0 d = serverstatus[:] for i in range(server): if ava < serven...
output
1
58,537
14
117,075
Provide tags and a correct Python 3 solution for this coding contest problem. There are n servers in a laboratory, each of them can perform tasks. Each server has a unique id β€” integer from 1 to n. It is known that during the day q tasks will come, the i-th of them is characterized with three integers: ti β€” the momen...
instruction
0
58,538
14
117,076
Tags: implementation Correct Solution: ``` import heapq as pq from sys import stdin, stdout #Heap method written by Engineermind.cho #Testing if heap + fast IO can make python pass this question n, q = map(int, stdin.readline().split()) server = [i for i in range(1, n+1)] running = [] is_chg = False for x i...
output
1
58,538
14
117,077
Provide tags and a correct Python 3 solution for this coding contest problem. There are n servers in a laboratory, each of them can perform tasks. Each server has a unique id β€” integer from 1 to n. It is known that during the day q tasks will come, the i-th of them is characterized with three integers: ti β€” the momen...
instruction
0
58,539
14
117,078
Tags: implementation Correct Solution: ``` num = [int(n) for n in input().split()] server = [0 for n in range(0,num[0])] result = list() num_task = num[1] temp_ti = 0 for i in range(0,num_task): temp_task = [int(n) for n in input().split()] time_passed = temp_task[0]-temp_ti temp_ti = temp_task[0] ###le...
output
1
58,539
14
117,079
Provide tags and a correct Python 3 solution for this coding contest problem. There are n servers in a laboratory, each of them can perform tasks. Each server has a unique id β€” integer from 1 to n. It is known that during the day q tasks will come, the i-th of them is characterized with three integers: ti β€” the momen...
instruction
0
58,540
14
117,080
Tags: implementation Correct Solution: ``` n,q=map(int,input().split()) s=[0]*(n+1) ans = [] for i in range(q): t,k,d=map(int,input().split()) sm=[] for j in range(1, n+1): if s[j] < t: sm.append(j) if len(sm)==k:break if len(sm)!=k:ans.append('-1') else: ans....
output
1
58,540
14
117,081