message
stringlengths
2
43.5k
message_type
stringclasses
2 values
message_id
int64
0
1
conversation_id
int64
853
107k
cluster
float64
24
24
__index_level_0__
int64
1.71k
214k
Provide tags and a correct Python 3 solution for this coding contest problem. Monocarp and Bicarp live in Berland, where every bus ticket consists of n digits (n is an even number). During the evening walk Monocarp and Bicarp found a ticket where some of the digits have been erased. The number of digits that have been...
instruction
0
14,231
24
28,462
Tags: games, greedy, math Correct Solution: ``` n = int(input()) a = input() sum1 = 0 for i in range(n//2): if(a[i] == '?'): sum1 += 4.5 else: sum1 += int(a[i]) for i in range(n//2, n): if(a[i] == '?'): sum1 -= 4.5 else: sum1 -= int(a[i]) if(sum1 == 0): print('Bicarp'...
output
1
14,231
24
28,463
Provide tags and a correct Python 3 solution for this coding contest problem. Monocarp and Bicarp live in Berland, where every bus ticket consists of n digits (n is an even number). During the evening walk Monocarp and Bicarp found a ticket where some of the digits have been erased. The number of digits that have been...
instruction
0
14,232
24
28,464
Tags: games, greedy, math Correct Solution: ``` ''' Auther: ghoshashis545 Ashis Ghosh College: jalpaiguri Govt Enggineering College Date:09/06/2020 ''' from os import path import sys from functools import cmp_to_key as ctk from collections import deque,defaultdict as dd from bisect import bisect,bisect_le...
output
1
14,232
24
28,465
Provide tags and a correct Python 3 solution for this coding contest problem. Monocarp and Bicarp live in Berland, where every bus ticket consists of n digits (n is an even number). During the evening walk Monocarp and Bicarp found a ticket where some of the digits have been erased. The number of digits that have been...
instruction
0
14,233
24
28,466
Tags: games, greedy, math Correct Solution: ``` n = int(input()) s = input() lsum = lcount = rsum = rcount = 0 for ch in s[:n//2]: if ch == '?': lcount += 1 else: lsum += int(ch) for ch in s[n//2:]: if ch == '?': rcount += 1 else: rsum += int(ch) if lcount > rcount: ...
output
1
14,233
24
28,467
Provide tags and a correct Python 3 solution for this coding contest problem. Monocarp and Bicarp live in Berland, where every bus ticket consists of n digits (n is an even number). During the evening walk Monocarp and Bicarp found a ticket where some of the digits have been erased. The number of digits that have been...
instruction
0
14,234
24
28,468
Tags: games, greedy, math Correct Solution: ``` #585_D n = int(input()) ln = list(input()) sm1 = 0 sm2 = 0 qs1 = 0 qs2 = 0 for i in range(0, n // 2): if ln[i] != "?": qs1 += 1 sm1 += int(ln[i]) if ln[n // 2 + i] != "?": qs2 += 1 sm2 += int(ln[n // 2 + i]) qs1 = n // 2 - qs1 ...
output
1
14,234
24
28,469
Provide tags and a correct Python 3 solution for this coding contest problem. Monocarp and Bicarp live in Berland, where every bus ticket consists of n digits (n is an even number). During the evening walk Monocarp and Bicarp found a ticket where some of the digits have been erased. The number of digits that have been...
instruction
0
14,235
24
28,470
Tags: games, greedy, math Correct Solution: ``` import sys # sys.setrecursionlimit(10**6) from sys import stdin, stdout import bisect #c++ upperbound import math import heapq def modinv(n,p): return pow(n,p-2,p) def cin(): return map(int,sin().split()) def ain(): #takes ar...
output
1
14,235
24
28,471
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Monocarp and Bicarp live in Berland, where every bus ticket consists of n digits (n is an even number). During the evening walk Monocarp and Bicarp found a ticket where some of the digits have b...
instruction
0
14,237
24
28,474
Yes
output
1
14,237
24
28,475
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Monocarp and Bicarp live in Berland, where every bus ticket consists of n digits (n is an even number). During the evening walk Monocarp and Bicarp found a ticket where some of the digits have b...
instruction
0
14,240
24
28,480
No
output
1
14,240
24
28,481
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Monocarp and Bicarp live in Berland, where every bus ticket consists of n digits (n is an even number). During the evening walk Monocarp and Bicarp found a ticket where some of the digits have b...
instruction
0
14,242
24
28,484
No
output
1
14,242
24
28,485
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Monocarp and Bicarp live in Berland, where every bus ticket consists of n digits (n is an even number). During the evening walk Monocarp and Bicarp found a ticket where some of the digits have b...
instruction
0
14,243
24
28,486
No
output
1
14,243
24
28,487
Provide tags and a correct Python 3 solution for this coding contest problem. Polycarp is practicing his problem solving skill. He has a list of n problems with difficulties a_1, a_2, ..., a_n, respectively. His plan is to practice for exactly k days. Each day he has to solve at least one problem from his list. Polyca...
instruction
0
15,058
24
30,116
Tags: greedy, implementation, sortings Correct Solution: ``` n,d = map(int,input().split()) ai = list(map(int,input().split())) arr = sorted(ai,reverse=True)[:d] s = sum(arr) lst = [] last = -1 i = 0 while len(arr) > 0: if ai[i] in arr: lst.append(i-last) last = i arr.remove(ai[i]) i +=...
output
1
15,058
24
30,117
Provide tags and a correct Python 3 solution for this coding contest problem. Polycarp is practicing his problem solving skill. He has a list of n problems with difficulties a_1, a_2, ..., a_n, respectively. His plan is to practice for exactly k days. Each day he has to solve at least one problem from his list. Polyca...
instruction
0
15,059
24
30,118
Tags: greedy, implementation, sortings Correct Solution: ``` n,k=input().split() n=int(n) k=int(k) list1=[int(x) for x in input().split()] index=[] maxis=[] for i in range(k): temp=max(list1) maxis.append(temp) temp2=list1.index(temp) index.append(temp2) list1[temp2]=-1 print(sum(maxis)) index.sort(...
output
1
15,059
24
30,119
Provide tags and a correct Python 3 solution for this coding contest problem. Polycarp is practicing his problem solving skill. He has a list of n problems with difficulties a_1, a_2, ..., a_n, respectively. His plan is to practice for exactly k days. Each day he has to solve at least one problem from his list. Polyca...
instruction
0
15,060
24
30,120
Tags: greedy, implementation, sortings Correct Solution: ``` n, days = list(map(int,input().split())) diff = list(map(int,input().split())) index = [] for i in range(n): index.append([diff[i], i]) index.sort(reverse = True) temp = [] sum = 0 for i in range(days): sum += index[i][0] temp.append(index[i][1]...
output
1
15,060
24
30,121
Provide tags and a correct Python 3 solution for this coding contest problem. Polycarp is practicing his problem solving skill. He has a list of n problems with difficulties a_1, a_2, ..., a_n, respectively. His plan is to practice for exactly k days. Each day he has to solve at least one problem from his list. Polyca...
instruction
0
15,061
24
30,122
Tags: greedy, implementation, sortings Correct Solution: ``` n, k = map(int, input().split()) nth_p = list(map(int, input().split())) sor = sorted(nth_p) ods = [] count = od_max = tp_co = 0 for i in range(n-1, n-k-1, -1): count += sor[i] i_n = nth_p.index(sor[i]) ods.append(i_n) nth_p[i_n] = -1 print(...
output
1
15,061
24
30,123
Provide tags and a correct Python 3 solution for this coding contest problem. Polycarp is practicing his problem solving skill. He has a list of n problems with difficulties a_1, a_2, ..., a_n, respectively. His plan is to practice for exactly k days. Each day he has to solve at least one problem from his list. Polyca...
instruction
0
15,062
24
30,124
Tags: greedy, implementation, sortings Correct Solution: ``` def main(): n, m = map(int, input().split()) l = list(map(int, input().split())) f = l.__getitem__ idx = sorted(sorted(range(n), key=f)[-m:]) print(sum(map(f, idx))) idx[0] = 0 print(*[b - a for a, b in zip(idx, idx[1:] + [n])]) ...
output
1
15,062
24
30,125
Provide tags and a correct Python 3 solution for this coding contest problem. Polycarp is practicing his problem solving skill. He has a list of n problems with difficulties a_1, a_2, ..., a_n, respectively. His plan is to practice for exactly k days. Each day he has to solve at least one problem from his list. Polyca...
instruction
0
15,063
24
30,126
Tags: greedy, implementation, sortings Correct Solution: ``` n, k = map(int, input().split()) a = list(map(int, input().split())) if k >= 2: cell_max = [] cell_index = [-1] for i in range(k): max1 = 0 index_max1 = 0 for j in range(n): if a[j] > max1: m...
output
1
15,063
24
30,127
Provide tags and a correct Python 3 solution for this coding contest problem. Polycarp is practicing his problem solving skill. He has a list of n problems with difficulties a_1, a_2, ..., a_n, respectively. His plan is to practice for exactly k days. Each day he has to solve at least one problem from his list. Polyca...
instruction
0
15,064
24
30,128
Tags: greedy, implementation, sortings Correct Solution: ``` import sys sys.setrecursionlimit(10000000) mod = 10 ** 9 + 7 digl=['0','1','2','3','4','5','6','7','8','9'] ii = lambda : int(input()) si = lambda : input() dgl = lambda : list(map(int, input())) f = lambda : map(int, input().split()) il = lambda : list(map(i...
output
1
15,064
24
30,129
Provide tags and a correct Python 3 solution for this coding contest problem. Polycarp is practicing his problem solving skill. He has a list of n problems with difficulties a_1, a_2, ..., a_n, respectively. His plan is to practice for exactly k days. Each day he has to solve at least one problem from his list. Polyca...
instruction
0
15,065
24
30,130
Tags: greedy, implementation, sortings Correct Solution: ``` n,m=map(int,input().split()) s=list(map(int,input().split())) s1=[] s1=[] for i in range(n): s1.append([s[i],i]) s1.sort() s1=s1[::-1] s2=[-1] p=0 for i in range(m): p+=s1[i][0] s2.append(s1[i][1]) print(p) s2.sort() s2[-1]=(n-1) for i in range(...
output
1
15,065
24
30,131
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Polycarp is practicing his problem solving skill. He has a list of n problems with difficulties a_1, a_2, ..., a_n, respectively. His plan is to practice for exactly k days. Each day he has to s...
instruction
0
15,066
24
30,132
Yes
output
1
15,066
24
30,133
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Polycarp is practicing his problem solving skill. He has a list of n problems with difficulties a_1, a_2, ..., a_n, respectively. His plan is to practice for exactly k days. Each day he has to s...
instruction
0
15,067
24
30,134
Yes
output
1
15,067
24
30,135
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Polycarp is practicing his problem solving skill. He has a list of n problems with difficulties a_1, a_2, ..., a_n, respectively. His plan is to practice for exactly k days. Each day he has to s...
instruction
0
15,068
24
30,136
Yes
output
1
15,068
24
30,137
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Polycarp is practicing his problem solving skill. He has a list of n problems with difficulties a_1, a_2, ..., a_n, respectively. His plan is to practice for exactly k days. Each day he has to s...
instruction
0
15,069
24
30,138
Yes
output
1
15,069
24
30,139
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Polycarp is practicing his problem solving skill. He has a list of n problems with difficulties a_1, a_2, ..., a_n, respectively. His plan is to practice for exactly k days. Each day he has to s...
instruction
0
15,070
24
30,140
No
output
1
15,070
24
30,141
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Polycarp is practicing his problem solving skill. He has a list of n problems with difficulties a_1, a_2, ..., a_n, respectively. His plan is to practice for exactly k days. Each day he has to s...
instruction
0
15,071
24
30,142
No
output
1
15,071
24
30,143
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Polycarp is practicing his problem solving skill. He has a list of n problems with difficulties a_1, a_2, ..., a_n, respectively. His plan is to practice for exactly k days. Each day he has to s...
instruction
0
15,072
24
30,144
No
output
1
15,072
24
30,145
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Polycarp is practicing his problem solving skill. He has a list of n problems with difficulties a_1, a_2, ..., a_n, respectively. His plan is to practice for exactly k days. Each day he has to s...
instruction
0
15,073
24
30,146
No
output
1
15,073
24
30,147
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Polycarp wants to assemble his own keyboard. Layouts with multiple rows are too complicated for him β€” his keyboard will consist of only one row, where all 26 lowercase Latin letters will be arra...
instruction
0
15,206
24
30,412
Yes
output
1
15,206
24
30,413
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Polycarp wants to assemble his own keyboard. Layouts with multiple rows are too complicated for him β€” his keyboard will consist of only one row, where all 26 lowercase Latin letters will be arra...
instruction
0
15,207
24
30,414
Yes
output
1
15,207
24
30,415
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Polycarp wants to assemble his own keyboard. Layouts with multiple rows are too complicated for him β€” his keyboard will consist of only one row, where all 26 lowercase Latin letters will be arra...
instruction
0
15,208
24
30,416
Yes
output
1
15,208
24
30,417
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Polycarp wants to assemble his own keyboard. Layouts with multiple rows are too complicated for him β€” his keyboard will consist of only one row, where all 26 lowercase Latin letters will be arra...
instruction
0
15,209
24
30,418
Yes
output
1
15,209
24
30,419
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Polycarp wants to assemble his own keyboard. Layouts with multiple rows are too complicated for him β€” his keyboard will consist of only one row, where all 26 lowercase Latin letters will be arra...
instruction
0
15,210
24
30,420
No
output
1
15,210
24
30,421
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Polycarp wants to assemble his own keyboard. Layouts with multiple rows are too complicated for him β€” his keyboard will consist of only one row, where all 26 lowercase Latin letters will be arra...
instruction
0
15,211
24
30,422
No
output
1
15,211
24
30,423
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Polycarp wants to assemble his own keyboard. Layouts with multiple rows are too complicated for him β€” his keyboard will consist of only one row, where all 26 lowercase Latin letters will be arra...
instruction
0
15,212
24
30,424
No
output
1
15,212
24
30,425
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Polycarp wants to assemble his own keyboard. Layouts with multiple rows are too complicated for him β€” his keyboard will consist of only one row, where all 26 lowercase Latin letters will be arra...
instruction
0
15,213
24
30,426
No
output
1
15,213
24
30,427
Provide tags and a correct Python 3 solution for this coding contest problem. Polycarp is a music editor at the radio station. He received a playlist for tomorrow, that can be represented as a sequence a1, a2, ..., an, where ai is a band, which performs the i-th song. Polycarp likes bands with the numbers from 1 to m,...
instruction
0
15,557
24
31,114
Tags: greedy Correct Solution: ``` from collections import defaultdict N, M = map(int, input().split()) ori = list(map(int, input().split())) best = N // M c = defaultdict(int) for o in ori: if 1 <= o <= M: c[o] += 1 counter = {} more = set() less = set() for i in range(1, M+1): counter[i] = c[i] - best...
output
1
15,557
24
31,115
Provide tags and a correct Python 3 solution for this coding contest problem. Polycarp is a music editor at the radio station. He received a playlist for tomorrow, that can be represented as a sequence a1, a2, ..., an, where ai is a band, which performs the i-th song. Polycarp likes bands with the numbers from 1 to m,...
instruction
0
15,558
24
31,116
Tags: greedy Correct Solution: ``` import copy n, m = map(int, input().split()) a = list(map(int, input().split())) d = copy.copy(a) a.sort() s = n // m b = [0] * m cnt = 0 q = 0 for el in a: if el <= m and b[el - 1] < s: b[el - 1] += 1 q += 1 ans = (n - q - n % m) print(s, ans) a = d q = copy.copy(...
output
1
15,558
24
31,117
Provide tags and a correct Python 3 solution for this coding contest problem. Polycarp is a music editor at the radio station. He received a playlist for tomorrow, that can be represented as a sequence a1, a2, ..., an, where ai is a band, which performs the i-th song. Polycarp likes bands with the numbers from 1 to m,...
instruction
0
15,559
24
31,118
Tags: greedy Correct Solution: ``` n,m = (int(x) for x in input().split()) l = [ int(x) for x in input().split() ] count = [0]*(m+1) overcount = 0 dielist = [] changelist = [] maxmin = int(n/m) for ind,i in enumerate(l): if i <= m: count[i] += 1 if count[i] > maxmin: dielist.append(ind) ...
output
1
15,559
24
31,119
Provide tags and a correct Python 3 solution for this coding contest problem. Polycarp is a music editor at the radio station. He received a playlist for tomorrow, that can be represented as a sequence a1, a2, ..., an, where ai is a band, which performs the i-th song. Polycarp likes bands with the numbers from 1 to m,...
instruction
0
15,560
24
31,120
Tags: greedy Correct Solution: ``` n,m=[int(item) for item in input().split()] a=[int(item) for item in input().split()] mx=n//m r=n%m c=0 counts=[a.count(i) for i in range(1,m+1)] queue=[] for i in range(1,m+1): queue=[i]*(mx-counts[i-1])+queue for i in range(n): if a[i]>m: if queue: curr=q...
output
1
15,560
24
31,121
Provide tags and a correct Python 3 solution for this coding contest problem. Polycarp is a music editor at the radio station. He received a playlist for tomorrow, that can be represented as a sequence a1, a2, ..., an, where ai is a band, which performs the i-th song. Polycarp likes bands with the numbers from 1 to m,...
instruction
0
15,561
24
31,122
Tags: greedy Correct Solution: ``` from collections import Counter n, m = map(int, input().split()) nums = list(map(int, input().split())) cnts = dict(Counter(nums)) for i in range(1, m+1): if i not in cnts: cnts[i] = 0 def minner(): return min(cnts.items(), key=lambda x: x[1]) n //= m res = 0 for...
output
1
15,561
24
31,123
Provide tags and a correct Python 3 solution for this coding contest problem. Polycarp is a music editor at the radio station. He received a playlist for tomorrow, that can be represented as a sequence a1, a2, ..., an, where ai is a band, which performs the i-th song. Polycarp likes bands with the numbers from 1 to m,...
instruction
0
15,562
24
31,124
Tags: greedy Correct Solution: ``` n, m = [int(i) for i in input().split()] a = [int(i) for i in input().split()] b = [0] * (m + 1) low = int(n / m) changes = 0 for i in a: if i <= m: b[i] += 1 bi = 1 for i in range(n): done = False while b[bi] >= low: bi += 1 if bi > m: ...
output
1
15,562
24
31,125
Provide tags and a correct Python 3 solution for this coding contest problem. Polycarp is a music editor at the radio station. He received a playlist for tomorrow, that can be represented as a sequence a1, a2, ..., an, where ai is a band, which performs the i-th song. Polycarp likes bands with the numbers from 1 to m,...
instruction
0
15,563
24
31,126
Tags: greedy Correct Solution: ``` n, m = map(int, input().split()) a = list(map(int, input().split())) good = n // m ans = 0 cnt = [0] * m ch = [0] * n for i in range(n): if 1 <= a[i] <= m: cnt[a[i] - 1] += 1 if cnt[a[i] - 1] <= good: ch[i] = 1 for i in range(m): ans += max(0, good ...
output
1
15,563
24
31,127
Provide tags and a correct Python 3 solution for this coding contest problem. Polycarp is a music editor at the radio station. He received a playlist for tomorrow, that can be represented as a sequence a1, a2, ..., an, where ai is a band, which performs the i-th song. Polycarp likes bands with the numbers from 1 to m,...
instruction
0
15,564
24
31,128
Tags: greedy Correct Solution: ``` import collections n,m = [int(s) for s in input().split()] a = [int(s) for s in input().split()] ctr = collections.Counter(a) nummin = n//m inses = [] for b in range(1,m+1): if ctr[b] < nummin: inses.extend([b]*(nummin - ctr[b])) num_ins = 0 for i in range(n): b = ...
output
1
15,564
24
31,129
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Polycarp is a music editor at the radio station. He received a playlist for tomorrow, that can be represented as a sequence a1, a2, ..., an, where ai is a band, which performs the i-th song. Pol...
instruction
0
15,565
24
31,130
Yes
output
1
15,565
24
31,131
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Polycarp is a music editor at the radio station. He received a playlist for tomorrow, that can be represented as a sequence a1, a2, ..., an, where ai is a band, which performs the i-th song. Pol...
instruction
0
15,566
24
31,132
Yes
output
1
15,566
24
31,133
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Polycarp is a music editor at the radio station. He received a playlist for tomorrow, that can be represented as a sequence a1, a2, ..., an, where ai is a band, which performs the i-th song. Pol...
instruction
0
15,567
24
31,134
Yes
output
1
15,567
24
31,135
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Polycarp is a music editor at the radio station. He received a playlist for tomorrow, that can be represented as a sequence a1, a2, ..., an, where ai is a band, which performs the i-th song. Pol...
instruction
0
15,568
24
31,136
Yes
output
1
15,568
24
31,137
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Polycarp is a music editor at the radio station. He received a playlist for tomorrow, that can be represented as a sequence a1, a2, ..., an, where ai is a band, which performs the i-th song. Pol...
instruction
0
15,569
24
31,138
No
output
1
15,569
24
31,139
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Polycarp is a music editor at the radio station. He received a playlist for tomorrow, that can be represented as a sequence a1, a2, ..., an, where ai is a band, which performs the i-th song. Pol...
instruction
0
15,570
24
31,140
No
output
1
15,570
24
31,141
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Polycarp is a music editor at the radio station. He received a playlist for tomorrow, that can be represented as a sequence a1, a2, ..., an, where ai is a band, which performs the i-th song. Pol...
instruction
0
15,571
24
31,142
No
output
1
15,571
24
31,143
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Polycarp is a music editor at the radio station. He received a playlist for tomorrow, that can be represented as a sequence a1, a2, ..., an, where ai is a band, which performs the i-th song. Pol...
instruction
0
15,572
24
31,144
No
output
1
15,572
24
31,145
Provide tags and a correct Python 3 solution for this coding contest problem. Polycarp is an introvert person. In fact he is so much of an introvert that he plays "Monsters and Potions" board game alone. The board of the game is a row of n cells. The cells are numbered from 1 to n from left to right. There are three t...
instruction
0
16,860
24
33,720
Tags: brute force, dp, greedy, implementation Correct Solution: ``` import sys n, m = tuple(int(x) for x in sys.stdin.readline().split()) heroes = [] for i in range(m): s, h = tuple(int(x) for x in sys.stdin.readline().split()) heroes.append((s - 1, h, i)) heroes = tuple(sorted(heroes)) a = tuple(int(x) for ...
output
1
16,860
24
33,721