message
stringlengths
2
433k
message_type
stringclasses
2 values
message_id
int64
0
1
conversation_id
int64
113
108k
cluster
float64
12
12
__index_level_0__
int64
226
217k
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Permutation p is an ordered set of integers p1, p2, ..., pn, consisting of n distinct positive integers, each of them doesn't exceed n. We'll denote the i-th element of permutation p as pi. We'l...
instruction
0
25,917
12
51,834
No
output
1
25,917
12
51,835
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Permutation p is an ordered set of integers p1, p2, ..., pn, consisting of n distinct positive integers, each of them doesn't exceed n. We'll denote the i-th element of permutation p as pi. We'l...
instruction
0
25,918
12
51,836
No
output
1
25,918
12
51,837
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Permutation p is an ordered set of integers p1, p2, ..., pn, consisting of n distinct positive integers, each of them doesn't exceed n. We'll denote the i-th element of permutation p as pi. We'l...
instruction
0
25,919
12
51,838
No
output
1
25,919
12
51,839
Provide tags and a correct Python 3 solution for this coding contest problem. You're given an array a of length n. You can perform the following operations on it: * choose an index i (1 ≤ i ≤ n), an integer x (0 ≤ x ≤ 10^6), and replace a_j with a_j+x for all (1 ≤ j ≤ i), which means add x to all the elements in th...
instruction
0
26,566
12
53,132
Tags: constructive algorithms, greedy, math Correct Solution: ``` n = int(input()) array = list(map(int, input().split())) print(n + 1) add = 0 for i in range(n-1, -1, -1): add = i - array[i] % n if add < 0: add += n print(1, i + 1, add) for j in range(i): array[j] += add add = 0...
output
1
26,566
12
53,133
Provide tags and a correct Python 3 solution for this coding contest problem. You're given an array a of length n. You can perform the following operations on it: * choose an index i (1 ≤ i ≤ n), an integer x (0 ≤ x ≤ 10^6), and replace a_j with a_j+x for all (1 ≤ j ≤ i), which means add x to all the elements in th...
instruction
0
26,567
12
53,134
Tags: constructive algorithms, greedy, math Correct Solution: ``` n = int(input()) l = list(map(int, input().split())) p = 1 t = 400 * 1000 mx = t + len(l) p = 0 #q = [i for i in l] print(n+1) for i in range(n-1, -1, -1): a = mx - ((p + l[i]) % t) #for j in range(i+1): # q[j] += a print(1, i+1,...
output
1
26,567
12
53,135
Provide tags and a correct Python 3 solution for this coding contest problem. You're given an array a of length n. You can perform the following operations on it: * choose an index i (1 ≤ i ≤ n), an integer x (0 ≤ x ≤ 10^6), and replace a_j with a_j+x for all (1 ≤ j ≤ i), which means add x to all the elements in th...
instruction
0
26,568
12
53,136
Tags: constructive algorithms, greedy, math Correct Solution: ``` #!/usr/bin/env python # coding: utf-8 # In[9]: import math # In[10]: n=int(input()) # In[11]: data=list(map(int, input().rstrip().split())) # In[12]: total=0 print(str(n+1)) for i in range(0,n): current=(data[n-i-1]+total) % n add...
output
1
26,568
12
53,137
Provide tags and a correct Python 3 solution for this coding contest problem. You're given an array a of length n. You can perform the following operations on it: * choose an index i (1 ≤ i ≤ n), an integer x (0 ≤ x ≤ 10^6), and replace a_j with a_j+x for all (1 ≤ j ≤ i), which means add x to all the elements in th...
instruction
0
26,569
12
53,138
Tags: constructive algorithms, greedy, math Correct Solution: ``` from sys import stdin,stdout from itertools import combinations from collections import defaultdict,OrderedDict import math import heapq def listIn(): return list((map(int,stdin.readline().strip().split()))) def stringListIn(): return([x for x ...
output
1
26,569
12
53,139
Provide tags and a correct Python 3 solution for this coding contest problem. You're given an array a of length n. You can perform the following operations on it: * choose an index i (1 ≤ i ≤ n), an integer x (0 ≤ x ≤ 10^6), and replace a_j with a_j+x for all (1 ≤ j ≤ i), which means add x to all the elements in th...
instruction
0
26,570
12
53,140
Tags: constructive algorithms, greedy, math Correct Solution: ``` x=int(input()) s=list(map(int,input().split())) print(x+1) print(1,x,500000) for n in range(x):print(2,n+1,s[n]+500000-n ) ```
output
1
26,570
12
53,141
Provide tags and a correct Python 3 solution for this coding contest problem. You're given an array a of length n. You can perform the following operations on it: * choose an index i (1 ≤ i ≤ n), an integer x (0 ≤ x ≤ 10^6), and replace a_j with a_j+x for all (1 ≤ j ≤ i), which means add x to all the elements in th...
instruction
0
26,571
12
53,142
Tags: constructive algorithms, greedy, math Correct Solution: ``` n = int(input()) a = [int(x) for x in input().split()] print(n + 1) print(1, n, 100000) for i in range(n): add = a[i] + 100000 print(2, i + 1, add - i - 1) ```
output
1
26,571
12
53,143
Provide tags and a correct Python 3 solution for this coding contest problem. You're given an array a of length n. You can perform the following operations on it: * choose an index i (1 ≤ i ≤ n), an integer x (0 ≤ x ≤ 10^6), and replace a_j with a_j+x for all (1 ≤ j ≤ i), which means add x to all the elements in th...
instruction
0
26,572
12
53,144
Tags: constructive algorithms, greedy, math Correct Solution: ``` n = int(input()) arr = [int(x) for x in input().split()] print(n+1) sum = 0 for i in reversed(range(n)): arr[i] += sum cur = ((((arr[i] - i) + (n - 1)) // n) * n) + (i-arr[i]) sum += cur print(1, i+1, cur) print(2, n, n) ```
output
1
26,572
12
53,145
Provide tags and a correct Python 3 solution for this coding contest problem. You're given an array a of length n. You can perform the following operations on it: * choose an index i (1 ≤ i ≤ n), an integer x (0 ≤ x ≤ 10^6), and replace a_j with a_j+x for all (1 ≤ j ≤ i), which means add x to all the elements in th...
instruction
0
26,573
12
53,146
Tags: constructive algorithms, greedy, math Correct Solution: ``` n = int(input()) l = list(map(int,input().split())) print(n+1) print(1,n,n*4) for j in range(n): print(2,j+1,l[j]+4*n-j) ```
output
1
26,573
12
53,147
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. You're given an array a of length n. You can perform the following operations on it: * choose an index i (1 ≤ i ≤ n), an integer x (0 ≤ x ≤ 10^6), and replace a_j with a_j+x for all (1 ≤ j ≤ ...
instruction
0
26,574
12
53,148
Yes
output
1
26,574
12
53,149
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. You're given an array a of length n. You can perform the following operations on it: * choose an index i (1 ≤ i ≤ n), an integer x (0 ≤ x ≤ 10^6), and replace a_j with a_j+x for all (1 ≤ j ≤ ...
instruction
0
26,575
12
53,150
Yes
output
1
26,575
12
53,151
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. You're given an array a of length n. You can perform the following operations on it: * choose an index i (1 ≤ i ≤ n), an integer x (0 ≤ x ≤ 10^6), and replace a_j with a_j+x for all (1 ≤ j ≤ ...
instruction
0
26,576
12
53,152
Yes
output
1
26,576
12
53,153
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. You're given an array a of length n. You can perform the following operations on it: * choose an index i (1 ≤ i ≤ n), an integer x (0 ≤ x ≤ 10^6), and replace a_j with a_j+x for all (1 ≤ j ≤ ...
instruction
0
26,577
12
53,154
Yes
output
1
26,577
12
53,155
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. You're given an array a of length n. You can perform the following operations on it: * choose an index i (1 ≤ i ≤ n), an integer x (0 ≤ x ≤ 10^6), and replace a_j with a_j+x for all (1 ≤ j ≤ ...
instruction
0
26,578
12
53,156
No
output
1
26,578
12
53,157
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. You're given an array a of length n. You can perform the following operations on it: * choose an index i (1 ≤ i ≤ n), an integer x (0 ≤ x ≤ 10^6), and replace a_j with a_j+x for all (1 ≤ j ≤ ...
instruction
0
26,579
12
53,158
No
output
1
26,579
12
53,159
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. You're given an array a of length n. You can perform the following operations on it: * choose an index i (1 ≤ i ≤ n), an integer x (0 ≤ x ≤ 10^6), and replace a_j with a_j+x for all (1 ≤ j ≤ ...
instruction
0
26,580
12
53,160
No
output
1
26,580
12
53,161
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. You're given an array a of length n. You can perform the following operations on it: * choose an index i (1 ≤ i ≤ n), an integer x (0 ≤ x ≤ 10^6), and replace a_j with a_j+x for all (1 ≤ j ≤ ...
instruction
0
26,581
12
53,162
No
output
1
26,581
12
53,163
Provide tags and a correct Python 3 solution for this coding contest problem. Nastya came to her informatics lesson, and her teacher who is, by the way, a little bit famous here gave her the following task. Two matrices A and B are given, each of them has size n × m. Nastya can perform the following operation to matr...
instruction
0
26,598
12
53,196
Tags: constructive algorithms, sortings Correct Solution: ``` n, m = map(int, input().split()) a = [list(map(int, input().split())) for i in range(n)] b = [list(map(int, input().split())) for i in range(n)] a1 = [[] for i in range(n + m + 100)] b1 = [[] for i in range(n + m + 100)] for i in range(n): for j in range...
output
1
26,598
12
53,197
Provide tags and a correct Python 3 solution for this coding contest problem. Nastya came to her informatics lesson, and her teacher who is, by the way, a little bit famous here gave her the following task. Two matrices A and B are given, each of them has size n × m. Nastya can perform the following operation to matr...
instruction
0
26,599
12
53,198
Tags: constructive algorithms, sortings Correct Solution: ``` EMPTY = 0 WHITE = 1 BLACK = 8 BOARDWIDTH = 7 BOARDHEIGHT = 6 def isWinner(board, tile): # check / diagonal spaces for x in range(BOARDWIDTH - 3): for y in range(3, BOARDHEIGHT): if board[x][y] == tile and board[x+1][y-1] == til...
output
1
26,599
12
53,199
Provide tags and a correct Python 3 solution for this coding contest problem. Nastya came to her informatics lesson, and her teacher who is, by the way, a little bit famous here gave her the following task. Two matrices A and B are given, each of them has size n × m. Nastya can perform the following operation to matr...
instruction
0
26,600
12
53,200
Tags: constructive algorithms, sortings Correct Solution: ``` n, m = map(int, input().split()) ma = [ [] for i in range(n + m)] mb = [[] for i in range(n + m)] w = [] for i in range(n): w = list(map(int, input().split())) for j in range(m): ma[i + j].append(w[j]) w = [] for i in range(n): w = list(map(int, ...
output
1
26,600
12
53,201
Provide tags and a correct Python 3 solution for this coding contest problem. Nastya came to her informatics lesson, and her teacher who is, by the way, a little bit famous here gave her the following task. Two matrices A and B are given, each of them has size n × m. Nastya can perform the following operation to matr...
instruction
0
26,601
12
53,202
Tags: constructive algorithms, sortings Correct Solution: ``` from sys import stdin,stdout n,m=map(int,stdin.readline().split()) mata=[None]*n matb=[None]*n for i in range(n): mata[i]= list(map(int,stdin.readline().split())) for i in range(n): matb[i] = list(map(int,stdin.readline().split())) la=[None...
output
1
26,601
12
53,203
Provide tags and a correct Python 3 solution for this coding contest problem. Nastya came to her informatics lesson, and her teacher who is, by the way, a little bit famous here gave her the following task. Two matrices A and B are given, each of them has size n × m. Nastya can perform the following operation to matr...
instruction
0
26,602
12
53,204
Tags: constructive algorithms, sortings Correct Solution: ``` n, m = map(int, input().split()) a = [[] for i in range(n + m)] b = [[] for i in range(n + m)] for i in range(n): j = 0 for el in map(int, input().split()): a[i + j].append(el) j += 1 for i in range(n): j = 0 for el in map(int...
output
1
26,602
12
53,205
Provide tags and a correct Python 3 solution for this coding contest problem. Nastya came to her informatics lesson, and her teacher who is, by the way, a little bit famous here gave her the following task. Two matrices A and B are given, each of them has size n × m. Nastya can perform the following operation to matr...
instruction
0
26,603
12
53,206
Tags: constructive algorithms, sortings Correct Solution: ``` def problem_1136c(): gi = lambda: list(map(int, input().strip().split())) n, m = gi() a_list = [gi() for _ in range(n)] b_list = [gi() for _ in range(n)] for k in range(m): a = sorted([a_list[j][k - j] for j in range(min(n, k + 1)...
output
1
26,603
12
53,207
Provide tags and a correct Python 3 solution for this coding contest problem. Nastya came to her informatics lesson, and her teacher who is, by the way, a little bit famous here gave her the following task. Two matrices A and B are given, each of them has size n × m. Nastya can perform the following operation to matr...
instruction
0
26,604
12
53,208
Tags: constructive algorithms, sortings Correct Solution: ``` from collections import defaultdict n, m = list(map(int, input().split(' '))) A = [] B = [] for r in range(n): A.append(list(map(int, input().split(" ")))) for r in range(n): B.append(list(map(int, input().split(" ")))) def compare_maps(map_a, map...
output
1
26,604
12
53,209
Provide tags and a correct Python 3 solution for this coding contest problem. Nastya came to her informatics lesson, and her teacher who is, by the way, a little bit famous here gave her the following task. Two matrices A and B are given, each of them has size n × m. Nastya can perform the following operation to matr...
instruction
0
26,605
12
53,210
Tags: constructive algorithms, sortings Correct Solution: ``` n, m = map(int, input().strip().split()) A = [] B = [] for _ in range(n): a = list(map(int, input().strip().split())) A.append(a) for _ in range(n): b = list(map(int, input().strip().split())) B.append(b) flag = True for i i...
output
1
26,605
12
53,211
Provide tags and a correct Python 3 solution for this coding contest problem. You are given an array a consisting of n integers a_1, a_2, ..., a_n. Your problem is to find such pair of indices i, j (1 ≤ i < j ≤ n) that lcm(a_i, a_j) is minimum possible. lcm(x, y) is the least common multiple of x and y (minimum posi...
instruction
0
26,616
12
53,232
Tags: brute force, greedy, math, number theory Correct Solution: ``` #!/usr/bin/env python # -*- coding: utf-8 -*- """Codeforces Round #552 (Div. 3) Problem G. Minimum Possible LCM :author: Kitchen Tong :mail: kctong529@gmail.com Please feel free to contact me if you have any question regarding the imple...
output
1
26,616
12
53,233
Provide tags and a correct Python 3 solution for this coding contest problem. You are given an array a of length 2^n. You should process q queries on it. Each query has one of the following 4 types: 1. Replace(x, k) — change a_x to k; 2. Reverse(k) — reverse each subarray [(i-1) ⋅ 2^k+1, i ⋅ 2^k] for all i (i ≥...
instruction
0
26,702
12
53,404
Tags: binary search, bitmasks, data structures Correct Solution: ``` class BIT(): def __init__(self,n): self.BIT=[0]*(n+1) self.num=n def query(self,idx): res_sum = 0 while idx > 0: res_sum += self.BIT[idx] idx -= idx&(-idx) return res_sum #A...
output
1
26,702
12
53,405
Provide tags and a correct Python 3 solution for this coding contest problem. You are given an array a of length 2^n. You should process q queries on it. Each query has one of the following 4 types: 1. Replace(x, k) — change a_x to k; 2. Reverse(k) — reverse each subarray [(i-1) ⋅ 2^k+1, i ⋅ 2^k] for all i (i ≥...
instruction
0
26,703
12
53,406
Tags: binary search, bitmasks, data structures Correct Solution: ``` from sys import stdin REPLACE_ID = 1 REVERSE_ID = 2 SWAP_ID = 3 SUM_ID = 4 def main(): n, q = _read_ints() a = tuple(_read_ints()) requests = tuple(_read_ints() for _ in range(q)) for result in compute_requests_results(a, requests)...
output
1
26,703
12
53,407
Provide tags and a correct Python 3 solution for this coding contest problem. You are given an array a of length 2^n. You should process q queries on it. Each query has one of the following 4 types: 1. Replace(x, k) — change a_x to k; 2. Reverse(k) — reverse each subarray [(i-1) ⋅ 2^k+1, i ⋅ 2^k] for all i (i ≥...
instruction
0
26,704
12
53,408
Tags: binary search, bitmasks, data structures Correct Solution: ``` import sys int1 = lambda x: int(x) - 1 p2D = lambda x: print(*x, sep="\n") def II(): return int(sys.stdin.readline()) def MI(): return map(int, sys.stdin.readline().split()) def LI(): return list(map(int, sys.stdin.readline().split())) def LLI(rows_n...
output
1
26,704
12
53,409
Provide tags and a correct Python 3 solution for this coding contest problem. You are given an array a of length 2^n. You should process q queries on it. Each query has one of the following 4 types: 1. Replace(x, k) — change a_x to k; 2. Reverse(k) — reverse each subarray [(i-1) ⋅ 2^k+1, i ⋅ 2^k] for all i (i ≥...
instruction
0
26,705
12
53,410
Tags: binary search, bitmasks, data structures Correct Solution: ``` import os,io input=io.BytesIO(os.read(0,os.fstat(0).st_size)).readline n,q = map(int,input().split()) SegmentTree = [] for i in range(n + 1): SegmentTree.append([0] * (1 << (n - i))) a = list(map(int,input().split())) for i in range(1 << n): ...
output
1
26,705
12
53,411
Provide tags and a correct Python 3 solution for this coding contest problem. You are given an array a of length 2^n. You should process q queries on it. Each query has one of the following 4 types: 1. Replace(x, k) — change a_x to k; 2. Reverse(k) — reverse each subarray [(i-1) ⋅ 2^k+1, i ⋅ 2^k] for all i (i ≥...
instruction
0
26,706
12
53,412
Tags: binary search, bitmasks, data structures Correct Solution: ``` import os,io;input=io.BytesIO(os.read(0,os.fstat(0).st_size)).readline;n,q = map(int,input().split());QueryList = [0] * n;SegmentTree = [];a = list(map(int,input().split())) for i in range(n + 1):SegmentTree.append([0] * (1 << (n - i))) for i in range...
output
1
26,706
12
53,413
Provide tags and a correct Python 3 solution for this coding contest problem. You are given an array a of length 2^n. You should process q queries on it. Each query has one of the following 4 types: 1. Replace(x, k) — change a_x to k; 2. Reverse(k) — reverse each subarray [(i-1) ⋅ 2^k+1, i ⋅ 2^k] for all i (i ≥...
instruction
0
26,707
12
53,414
Tags: binary search, bitmasks, data structures Correct Solution: ``` # Fast IO (be careful about bitstring) import os,io input=io.BytesIO(os.read(0,os.fstat(0).st_size)).readline n,q = map(int,input().split()) SegmentTree = [] for i in range(n + 1): SegmentTree.append([0] * (1 << (n - i))) a = list(map(int,inp...
output
1
26,707
12
53,415
Provide tags and a correct Python 3 solution for this coding contest problem. You are given an array a of length 2^n. You should process q queries on it. Each query has one of the following 4 types: 1. Replace(x, k) — change a_x to k; 2. Reverse(k) — reverse each subarray [(i-1) ⋅ 2^k+1, i ⋅ 2^k] for all i (i ≥...
instruction
0
26,708
12
53,416
Tags: binary search, bitmasks, data structures Correct Solution: ``` from sys import stdin REPLACE_ID = 1 REVERSE_ID = 2 SWAP_ID = 3 SUM_ID = 4 def main(): n, q = _read_ints() a = tuple(_read_ints()) requests = tuple(_read_ints() for _ in range(q)) for result in compute_requests_results(a, requests)...
output
1
26,708
12
53,417
Provide tags and a correct Python 3 solution for this coding contest problem. You are given an array a of length 2^n. You should process q queries on it. Each query has one of the following 4 types: 1. Replace(x, k) — change a_x to k; 2. Reverse(k) — reverse each subarray [(i-1) ⋅ 2^k+1, i ⋅ 2^k] for all i (i ≥...
instruction
0
26,709
12
53,418
Tags: binary search, bitmasks, data structures Correct Solution: ``` import os,io input=io.BytesIO(os.read(0,os.fstat(0).st_size)).readline n,q = map(int,input().split());QueryList = [0] * n;SegmentTree = [];a = list(map(int,input().split())) for i in range(n + 1):SegmentTree.append([0] * (1 << (n - i))) for i in range...
output
1
26,709
12
53,419
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. You are given an array a of length 2^n. You should process q queries on it. Each query has one of the following 4 types: 1. Replace(x, k) — change a_x to k; 2. Reverse(k) — reverse each s...
instruction
0
26,710
12
53,420
Yes
output
1
26,710
12
53,421
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. You are given an array a of length 2^n. You should process q queries on it. Each query has one of the following 4 types: 1. Replace(x, k) — change a_x to k; 2. Reverse(k) — reverse each s...
instruction
0
26,711
12
53,422
Yes
output
1
26,711
12
53,423
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. You are given an array a of length 2^n. You should process q queries on it. Each query has one of the following 4 types: 1. Replace(x, k) — change a_x to k; 2. Reverse(k) — reverse each s...
instruction
0
26,712
12
53,424
No
output
1
26,712
12
53,425
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. You are given an array a of length 2^n. You should process q queries on it. Each query has one of the following 4 types: 1. Replace(x, k) — change a_x to k; 2. Reverse(k) — reverse each s...
instruction
0
26,713
12
53,426
No
output
1
26,713
12
53,427
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. You are given an array a of length 2^n. You should process q queries on it. Each query has one of the following 4 types: 1. Replace(x, k) — change a_x to k; 2. Reverse(k) — reverse each s...
instruction
0
26,714
12
53,428
No
output
1
26,714
12
53,429
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. You are given an array a of length 2^n. You should process q queries on it. Each query has one of the following 4 types: 1. Replace(x, k) — change a_x to k; 2. Reverse(k) — reverse each s...
instruction
0
26,715
12
53,430
No
output
1
26,715
12
53,431
Provide tags and a correct Python 3 solution for this coding contest problem. This is the easy version of the problem. The difference between the versions is in the constraints on the array elements. You can make hacks only if all versions of the problem are solved. You are given an array [a_1, a_2, ..., a_n]. Your...
instruction
0
26,728
12
53,456
Tags: data structures, greedy Correct Solution: ``` ''' Auther: ghoshashis545 Ashis Ghosh College: jalpaiguri Govt Enggineering College ''' from os import path import sys from heapq import heappush,heappop from functools import cmp_to_key as ctk from collections import deque,Counter,defaultdict as dd from bis...
output
1
26,728
12
53,457
Provide tags and a correct Python 3 solution for this coding contest problem. This is the easy version of the problem. The difference between the versions is in the constraints on the array elements. You can make hacks only if all versions of the problem are solved. You are given an array [a_1, a_2, ..., a_n]. Your...
instruction
0
26,729
12
53,458
Tags: data structures, greedy Correct Solution: ``` import sys input = sys.stdin.buffer.readline def prog(): n = int(input()) a = list(map(int,input().split())) freq = [0]*101 for i in range(n): freq[a[i]] += 1 mx = max(freq) amt = freq.count(mx) if amt >= 2: print...
output
1
26,729
12
53,459
Provide tags and a correct Python 3 solution for this coding contest problem. This is the easy version of the problem. The difference between the versions is in the constraints on the array elements. You can make hacks only if all versions of the problem are solved. You are given an array [a_1, a_2, ..., a_n]. Your...
instruction
0
26,730
12
53,460
Tags: data structures, greedy Correct Solution: ``` import sys from sys import stdin n = int(stdin.readline()) a = list(map(int,stdin.readline().split())) lis = [0] * 101 for i in a: lis[i] += 1 f = 0 nmax = 1 for i in range(101): if lis[f] < lis[i]: f = i nmax = 1 elif lis[f] == lis[i]: ...
output
1
26,730
12
53,461
Provide tags and a correct Python 3 solution for this coding contest problem. This is the easy version of the problem. The difference between the versions is in the constraints on the array elements. You can make hacks only if all versions of the problem are solved. You are given an array [a_1, a_2, ..., a_n]. Your...
instruction
0
26,731
12
53,462
Tags: data structures, greedy Correct Solution: ``` from collections import Counter n = int(input()) A = list(map(int, input().split())) cnt = Counter(A) maxv = max(cnt.values()) x = [c for c in cnt if cnt[c] == maxv] if len(x) > 1: print(n) else: x = x[0] ans = 0 for c in cnt: if c == x: contin...
output
1
26,731
12
53,463
Provide tags and a correct Python 3 solution for this coding contest problem. This is the easy version of the problem. The difference between the versions is in the constraints on the array elements. You can make hacks only if all versions of the problem are solved. You are given an array [a_1, a_2, ..., a_n]. Your...
instruction
0
26,732
12
53,464
Tags: data structures, greedy Correct Solution: ``` # Legends Always Come Up with Solution # Author: Manvir Singh import os from io import BytesIO, IOBase import sys from collections import defaultdict, deque, Counter from bisect import * from math import sqrt, pi, ceil, log, inf,gcd from itertools import permutations...
output
1
26,732
12
53,465
Provide tags and a correct Python 3 solution for this coding contest problem. This is the easy version of the problem. The difference between the versions is in the constraints on the array elements. You can make hacks only if all versions of the problem are solved. You are given an array [a_1, a_2, ..., a_n]. Your...
instruction
0
26,733
12
53,466
Tags: data structures, greedy Correct Solution: ``` n=int(input()) arr=list(map(int,input().split())) freq=[0]*(101) for i in arr:freq[i]+=1 maxx=max(freq) amtOFmaxx=freq.count(maxx) if amtOFmaxx>=2:print(n) else: must_apper=freq.index(maxx) ans=0 for j in range(1,101): if j==must_apper: continue fi...
output
1
26,733
12
53,467
Provide tags and a correct Python 3 solution for this coding contest problem. This is the easy version of the problem. The difference between the versions is in the constraints on the array elements. You can make hacks only if all versions of the problem are solved. You are given an array [a_1, a_2, ..., a_n]. Your...
instruction
0
26,734
12
53,468
Tags: data structures, greedy Correct Solution: ``` import sys from collections import defaultdict, Counter import sys import os from io import BytesIO, IOBase #Fast IO Region BUFSIZE = 8192 class FastIO(IOBase): newlines = 0 def __init__(self, file): self._fd = file.fileno() self.buffer = Byte...
output
1
26,734
12
53,469
Provide tags and a correct Python 3 solution for this coding contest problem. This is the easy version of the problem. The difference between the versions is in the constraints on the array elements. You can make hacks only if all versions of the problem are solved. You are given an array [a_1, a_2, ..., a_n]. Your...
instruction
0
26,735
12
53,470
Tags: data structures, greedy Correct Solution: ``` n = int(input()) a = [int(x) for x in input().split()] cnt = [0]*101 for x in a: cnt[x] += 1 maxFreq = max(cnt) v = [] for i in range(101): if cnt[i] == maxFreq: v.append(i) if len(v) > 1: print(n) else: ans = 0 for i in range(101): ...
output
1
26,735
12
53,471