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. You have array of n numbers a_{1}, a_{2}, …, a_{n}. Rearrange these numbers to satisfy |a_{1} - a_{2}| ≤ |a_{2} - a_{3}| ≤ … ≤ |a_{n-1} - a_{n}|, where |x| denotes absolute value of x. It's al...
instruction
0
13,452
12
26,904
No
output
1
13,452
12
26,905
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. You have array of n numbers a_{1}, a_{2}, …, a_{n}. Rearrange these numbers to satisfy |a_{1} - a_{2}| ≤ |a_{2} - a_{3}| ≤ … ≤ |a_{n-1} - a_{n}|, where |x| denotes absolute value of x. It's al...
instruction
0
13,453
12
26,906
No
output
1
13,453
12
26,907
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Nick has some permutation consisting of p integers from 1 to n. A segment [l, r] (l ≤ r) is a set of elements pi satisfying l ≤ i ≤ r. Nick calls a pair of segments [a0, a1] and [b0, b1] (1 ≤ a...
instruction
0
13,564
12
27,128
No
output
1
13,564
12
27,129
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Nick has some permutation consisting of p integers from 1 to n. A segment [l, r] (l ≤ r) is a set of elements pi satisfying l ≤ i ≤ r. Nick calls a pair of segments [a0, a1] and [b0, b1] (1 ≤ a...
instruction
0
13,565
12
27,130
No
output
1
13,565
12
27,131
Provide tags and a correct Python 3 solution for this coding contest problem. Sereja has got an array, consisting of n integers, a1, a2, ..., an. Sereja is an active boy, so he is now going to complete m operations. Each operation will have one of the three forms: 1. Make vi-th array element equal to xi. In other w...
instruction
0
13,599
12
27,198
Tags: implementation Correct Solution: ``` n,q=map(int,input().split()) a=list(map(int, input().split())) b=0 s='' for i in range(q): l=list(map(int, input().split())) if l[0]==3: s+=str(a[l[1]-1]+b)+'\n' elif l[0]==2: b+=l[1] elif l[0]==1: a[l[1]-1]= l[2]-b print(s) ```
output
1
13,599
12
27,199
Provide tags and a correct Python 3 solution for this coding contest problem. Sereja has got an array, consisting of n integers, a1, a2, ..., an. Sereja is an active boy, so he is now going to complete m operations. Each operation will have one of the three forms: 1. Make vi-th array element equal to xi. In other w...
instruction
0
13,600
12
27,200
Tags: implementation Correct Solution: ``` n,m=input().split() a=input().split() soma=0 dic ={} total=0 for x in range(int(m)): b=input().split() v=int(b[1]) if(b[0]=="1"): b[2]=int(b[2]) a[v-1]=b[2] dic[v] = soma elif(b[0]=="2"): soma=soma+v elif(b[0]=="3"): ...
output
1
13,600
12
27,201
Provide tags and a correct Python 3 solution for this coding contest problem. Sereja has got an array, consisting of n integers, a1, a2, ..., an. Sereja is an active boy, so he is now going to complete m operations. Each operation will have one of the three forms: 1. Make vi-th array element equal to xi. In other w...
instruction
0
13,601
12
27,202
Tags: implementation Correct Solution: ``` import sys import itertools import collections def rs(x=''): return sys.stdin.readline().strip() if len(x) == 0 else input(x).strip() def ri(x=''): return int(rs(x)) def rm(x=''): return map(str, rs(x).split()) def rl(x=''): return rs(x).split() def rmi(x=''): return map(int...
output
1
13,601
12
27,203
Provide tags and a correct Python 3 solution for this coding contest problem. Sereja has got an array, consisting of n integers, a1, a2, ..., an. Sereja is an active boy, so he is now going to complete m operations. Each operation will have one of the three forms: 1. Make vi-th array element equal to xi. In other w...
instruction
0
13,602
12
27,204
Tags: implementation Correct Solution: ``` n,m=map(int,input().split()) l=[int(x) for x in input().split()] curr=0 for _ in range(m): temp=input().split() if temp[0]=="1": x=int(temp[1]) y=int(temp[2]) l[x-1]=y l[x-1]=l[x-1]-curr elif temp[0]=="2": curr+=int(temp[1]) ...
output
1
13,602
12
27,205
Provide tags and a correct Python 3 solution for this coding contest problem. Sereja has got an array, consisting of n integers, a1, a2, ..., an. Sereja is an active boy, so he is now going to complete m operations. Each operation will have one of the three forms: 1. Make vi-th array element equal to xi. In other w...
instruction
0
13,603
12
27,206
Tags: implementation Correct Solution: ``` n, m = map(int, input().split()) arr = [int(i) for i in input().split()] res, s = 0, "" for i in range(m): b = [int(x) for x in input().split()] if b[0] == 1: arr[b[1] - 1] = b[2] - res elif b[0] == 2: res += b[1] else: s += str(arr[b[1]...
output
1
13,603
12
27,207
Provide tags and a correct Python 3 solution for this coding contest problem. Sereja has got an array, consisting of n integers, a1, a2, ..., an. Sereja is an active boy, so he is now going to complete m operations. Each operation will have one of the three forms: 1. Make vi-th array element equal to xi. In other w...
instruction
0
13,604
12
27,208
Tags: implementation Correct Solution: ``` #!/usr/bin/env python import os import sys from io import BytesIO, IOBase #from bisect import bisect_left as bl #c++ lowerbound bl(array,element) #from bisect import bisect_right as br #c++ upperbound br(array,element) def main(): n,m=map(i...
output
1
13,604
12
27,209
Provide tags and a correct Python 3 solution for this coding contest problem. Sereja has got an array, consisting of n integers, a1, a2, ..., an. Sereja is an active boy, so he is now going to complete m operations. Each operation will have one of the three forms: 1. Make vi-th array element equal to xi. In other w...
instruction
0
13,605
12
27,210
Tags: implementation Correct Solution: ``` """ n=int(z()) for _ in range(int(z())): x=int(z()) l=list(map(int,z().split())) n=int(z()) l=sorted(list(map(int,z().split())))[::-1] a,b=map(int,z().split()) l=set(map(int,z().split())) led=(6,2,5,5,4,5,6,3,7,6) vowel={'a':0,'e':0,'i':0,'o':0,'u':0} col...
output
1
13,605
12
27,211
Provide tags and a correct Python 3 solution for this coding contest problem. Sereja has got an array, consisting of n integers, a1, a2, ..., an. Sereja is an active boy, so he is now going to complete m operations. Each operation will have one of the three forms: 1. Make vi-th array element equal to xi. In other w...
instruction
0
13,606
12
27,212
Tags: implementation Correct Solution: ``` from sys import stdin, stdout m=int(input().split()[1]) a=[int(x) for x in stdin.readline().split()] s,o=0,'' for i in range(m): x=[int(x) for x in stdin.readline().split()] if x[0]==1: a[x[1]-1]=x[2]-s elif x[0]==2: s+=x[1] else: o+=str...
output
1
13,606
12
27,213
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Sereja has got an array, consisting of n integers, a1, a2, ..., an. Sereja is an active boy, so he is now going to complete m operations. Each operation will have one of the three forms: 1. M...
instruction
0
13,607
12
27,214
Yes
output
1
13,607
12
27,215
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Sereja has got an array, consisting of n integers, a1, a2, ..., an. Sereja is an active boy, so he is now going to complete m operations. Each operation will have one of the three forms: 1. M...
instruction
0
13,609
12
27,218
Yes
output
1
13,609
12
27,219
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Sereja has got an array, consisting of n integers, a1, a2, ..., an. Sereja is an active boy, so he is now going to complete m operations. Each operation will have one of the three forms: 1. M...
instruction
0
13,610
12
27,220
Yes
output
1
13,610
12
27,221
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Sereja has got an array, consisting of n integers, a1, a2, ..., an. Sereja is an active boy, so he is now going to complete m operations. Each operation will have one of the three forms: 1. M...
instruction
0
13,612
12
27,224
No
output
1
13,612
12
27,225
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Sereja has got an array, consisting of n integers, a1, a2, ..., an. Sereja is an active boy, so he is now going to complete m operations. Each operation will have one of the three forms: 1. M...
instruction
0
13,613
12
27,226
No
output
1
13,613
12
27,227
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Sereja has got an array, consisting of n integers, a1, a2, ..., an. Sereja is an active boy, so he is now going to complete m operations. Each operation will have one of the three forms: 1. M...
instruction
0
13,614
12
27,228
No
output
1
13,614
12
27,229
Provide tags and a correct Python 3 solution for this coding contest problem. Levko loves array a1, a2, ... , an, consisting of integers, very much. That is why Levko is playing with array a, performing all sorts of operations with it. Each operation Levko performs is of one of two types: 1. Increase all elements f...
instruction
0
13,617
12
27,234
Tags: greedy, implementation Correct Solution: ``` n, m = map(int, input().split()) a = [int(1e9)] * n extra = [0] * n query = list() for _ in range(m): t, l, r, x = map(int, input().split()) l -= 1 r -= 1 query.append((t, l, r, x)) if t == 1: for j in range(l, r+1): extra[j] += ...
output
1
13,617
12
27,235
Provide tags and a correct Python 3 solution for this coding contest problem. Levko loves array a1, a2, ... , an, consisting of integers, very much. That is why Levko is playing with array a, performing all sorts of operations with it. Each operation Levko performs is of one of two types: 1. Increase all elements f...
instruction
0
13,618
12
27,236
Tags: greedy, implementation 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 or "r" not in file.mode ...
output
1
13,618
12
27,237
Provide tags and a correct Python 3 solution for this coding contest problem. Levko loves array a1, a2, ... , an, consisting of integers, very much. That is why Levko is playing with array a, performing all sorts of operations with it. Each operation Levko performs is of one of two types: 1. Increase all elements f...
instruction
0
13,619
12
27,238
Tags: greedy, implementation Correct Solution: ``` n, m = map(int, input().split()) a = [10**9 for _ in range(n)] extra = [0 for _ in range(n)] query = list() for _ in range(m): t, l, r, x = map(int, input().split()) l -= 1 r -= 1 query.append((t, l, r, x)) if t == 1: for j in range(l...
output
1
13,619
12
27,239
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Levko loves array a1, a2, ... , an, consisting of integers, very much. That is why Levko is playing with array a, performing all sorts of operations with it. Each operation Levko performs is of ...
instruction
0
13,620
12
27,240
No
output
1
13,620
12
27,241
Provide tags and a correct Python 3 solution for this coding contest problem. Little Artem has invented a time machine! He could go anywhere in time, but all his thoughts of course are with computer science. He wants to apply this time machine to a well-known data structure: multiset. Artem wants to create a basic mu...
instruction
0
13,754
12
27,508
Tags: data structures Correct Solution: ``` from bisect import * d = [{}, {}] i = [0, 0] for q in range(int(input())): a, t, x = map(int, input().split()) for k in [0, 1]: d[k][x] = d[k].get(x, []) i[k] = bisect(d[k][x], t) if a < 3: d[-a][x].insert(i[-a], t) else: print(i[1] - i[0]) ```
output
1
13,754
12
27,509
Provide tags and a correct Python 3 solution for this coding contest problem. Little Artem has invented a time machine! He could go anywhere in time, but all his thoughts of course are with computer science. He wants to apply this time machine to a well-known data structure: multiset. Artem wants to create a basic mu...
instruction
0
13,755
12
27,510
Tags: data structures Correct Solution: ``` # by the authority of GOD author: manhar singh sachdev # import os,sys from io import BytesIO, IOBase new = lambda xx: (xx|xx-1)+1 def buildBIT(bit,n): for i in range(1,n+1): x = new(i) if x <= n: bit[x] += bit[i] def pointUpdate(bit,poi...
output
1
13,755
12
27,511
Provide tags and a correct Python 3 solution for this coding contest problem. Little Artem has invented a time machine! He could go anywhere in time, but all his thoughts of course are with computer science. He wants to apply this time machine to a well-known data structure: multiset. Artem wants to create a basic mu...
instruction
0
13,756
12
27,512
Tags: data structures Correct Solution: ``` from bisect import * u, v = {}, {} for q in range(int(input())): a, t, x = map(int, input().split()) if x not in u: u[x], v[x] = [], [] if a < 3: insort([v, u][-a][x], t) else: print(bisect(u[x], t) - bisect(v[x], t)) ```
output
1
13,756
12
27,513
Provide tags and a correct Python 3 solution for this coding contest problem. Little Artem has invented a time machine! He could go anywhere in time, but all his thoughts of course are with computer science. He wants to apply this time machine to a well-known data structure: multiset. Artem wants to create a basic mu...
instruction
0
13,757
12
27,514
Tags: data structures Correct Solution: ``` # ---------------------------iye ha aam zindegi--------------------------------------------- import math import random import heapq, bisect import sys from collections import deque, defaultdict from fractions import Fraction import sys import threading from collections import...
output
1
13,757
12
27,515
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Little Artem has invented a time machine! He could go anywhere in time, but all his thoughts of course are with computer science. He wants to apply this time machine to a well-known data structu...
instruction
0
13,758
12
27,516
No
output
1
13,758
12
27,517
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Little Artem has invented a time machine! He could go anywhere in time, but all his thoughts of course are with computer science. He wants to apply this time machine to a well-known data structu...
instruction
0
13,759
12
27,518
No
output
1
13,759
12
27,519
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Little Artem has invented a time machine! He could go anywhere in time, but all his thoughts of course are with computer science. He wants to apply this time machine to a well-known data structu...
instruction
0
13,760
12
27,520
No
output
1
13,760
12
27,521
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Little Artem has invented a time machine! He could go anywhere in time, but all his thoughts of course are with computer science. He wants to apply this time machine to a well-known data structu...
instruction
0
13,761
12
27,522
No
output
1
13,761
12
27,523
Provide tags and a correct Python 3 solution for this coding contest problem. Ahmed and Mostafa used to compete together in many programming contests for several years. Their coach Fegla asked them to solve one challenging problem, of course Ahmed was able to solve it but Mostafa couldn't. This problem is similar to ...
instruction
0
13,788
12
27,576
Tags: data structures, dp, greedy, implementation, math, trees Correct Solution: ``` import sys from array import array # noqa: F401 def input(): return sys.stdin.buffer.readline().decode('utf-8') def prepare(n, *a): acc = 0 sub_max = -10**9 left_min = 0 left_max = 0 lmin2, lmax2 = 0, -10**...
output
1
13,788
12
27,577
Provide tags and a correct Python 3 solution for this coding contest problem. Ahmed and Mostafa used to compete together in many programming contests for several years. Their coach Fegla asked them to solve one challenging problem, of course Ahmed was able to solve it but Mostafa couldn't. This problem is similar to ...
instruction
0
13,789
12
27,578
Tags: data structures, dp, greedy, implementation, math, trees Correct Solution: ``` if __name__ == "__main__": i = input().split() N = int(i[0]) M = int(i[1]) arrList = [] leftMax = [] rightMax = [] listTotal = [] rightSum = [] for i in range(N): inputList = [int(x) for x i...
output
1
13,789
12
27,579
Provide tags and a correct Python 3 solution for this coding contest problem. Ahmed and Mostafa used to compete together in many programming contests for several years. Their coach Fegla asked them to solve one challenging problem, of course Ahmed was able to solve it but Mostafa couldn't. This problem is similar to ...
instruction
0
13,790
12
27,580
Tags: data structures, dp, greedy, implementation, math, trees Correct Solution: ``` # Legends Always Come Up with Solution # Author: Manvir Singh import os from io import BytesIO, IOBase import sys def main(): n,m=map(int,input().split()) a=[] for i in range(n): b=list(map(int,input().split())) ...
output
1
13,790
12
27,581
Provide tags and a correct Python 3 solution for this coding contest problem. Ahmed and Mostafa used to compete together in many programming contests for several years. Their coach Fegla asked them to solve one challenging problem, of course Ahmed was able to solve it but Mostafa couldn't. This problem is similar to ...
instruction
0
13,791
12
27,582
Tags: data structures, dp, greedy, implementation, math, trees Correct Solution: ``` # Legends Always Come Up with Solution # Author: Manvir Singh import os from io import BytesIO, IOBase import sys def main(): n,m=map(int,input().split()) a,ans=[],[-1001,-1001,-1001,0] for i in range(n): b=list(m...
output
1
13,791
12
27,583
Provide tags and a correct Python 3 solution for this coding contest problem. Ahmed and Mostafa used to compete together in many programming contests for several years. Their coach Fegla asked them to solve one challenging problem, of course Ahmed was able to solve it but Mostafa couldn't. This problem is similar to ...
instruction
0
13,792
12
27,584
Tags: data structures, dp, greedy, implementation, math, trees Correct Solution: ``` n,m=map(int,input().split()) l=[] d={} e={} for i in range(n): l = list(map(int,input().split())) a=l[1] b=sum(l)-l[0] c=l[-1] x = l[1] for j in range(2,len(l)): x+=l[j] a=max(a,x) x = l[-1] ...
output
1
13,792
12
27,585
Provide tags and a correct Python 3 solution for this coding contest problem. Ahmed and Mostafa used to compete together in many programming contests for several years. Their coach Fegla asked them to solve one challenging problem, of course Ahmed was able to solve it but Mostafa couldn't. This problem is similar to ...
instruction
0
13,793
12
27,586
Tags: data structures, dp, greedy, implementation, math, trees Correct Solution: ``` import sys zz=1 sys.setrecursionlimit(10**5) if zz: input=sys.stdin.readline else: sys.stdin=open('input.txt', 'r') sys.stdout=open('all.txt','w') di=[[-1,0],[1,0],[0,1],[0,-1]] def fori(n): return [fi() for i in range(n)] de...
output
1
13,793
12
27,587
Provide tags and a correct Python 3 solution for this coding contest problem. Ahmed and Mostafa used to compete together in many programming contests for several years. Their coach Fegla asked them to solve one challenging problem, of course Ahmed was able to solve it but Mostafa couldn't. This problem is similar to ...
instruction
0
13,794
12
27,588
Tags: data structures, dp, greedy, implementation, math, trees Correct Solution: ``` def get_best(arr): ans, now = -(1 << 64), 0 for i in arr: now += i ans = max(ans, now) if (now < 0): now = 0 return ans def compute(arr): ans, now = -(1 << 64), 0 for i in arr: now ...
output
1
13,794
12
27,589
Provide tags and a correct Python 3 solution for this coding contest problem. Ahmed and Mostafa used to compete together in many programming contests for several years. Their coach Fegla asked them to solve one challenging problem, of course Ahmed was able to solve it but Mostafa couldn't. This problem is similar to ...
instruction
0
13,795
12
27,590
Tags: data structures, dp, greedy, implementation, math, trees Correct Solution: ``` # Legends Always Come Up with Solution # Author: Manvir Singh import os from io import BytesIO, IOBase import sys def main(): n,m=map(int,input().split()) a,ans=[],[-1001,-1001,-1001,0] for i in range(n): b=list(m...
output
1
13,795
12
27,591
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Ahmed and Mostafa used to compete together in many programming contests for several years. Their coach Fegla asked them to solve one challenging problem, of course Ahmed was able to solve it but...
instruction
0
13,796
12
27,592
No
output
1
13,796
12
27,593
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Ahmed and Mostafa used to compete together in many programming contests for several years. Their coach Fegla asked them to solve one challenging problem, of course Ahmed was able to solve it but...
instruction
0
13,797
12
27,594
No
output
1
13,797
12
27,595
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Ahmed and Mostafa used to compete together in many programming contests for several years. Their coach Fegla asked them to solve one challenging problem, of course Ahmed was able to solve it but...
instruction
0
13,798
12
27,596
No
output
1
13,798
12
27,597
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Ahmed and Mostafa used to compete together in many programming contests for several years. Their coach Fegla asked them to solve one challenging problem, of course Ahmed was able to solve it but...
instruction
0
13,799
12
27,598
No
output
1
13,799
12
27,599
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 consisting of positive integers and q queries to this array. There are two types of queries: * 1 l r x — for each index i such that l ≤ i ≤ r set ai = x. * 2 l r ...
instruction
0
13,816
12
27,632
No
output
1
13,816
12
27,633
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 consisting of positive integers and q queries to this array. There are two types of queries: * 1 l r x — for each index i such that l ≤ i ≤ r set ai = x. * 2 l r ...
instruction
0
13,817
12
27,634
No
output
1
13,817
12
27,635
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 consisting of positive integers and q queries to this array. There are two types of queries: * 1 l r x — for each index i such that l ≤ i ≤ r set ai = x. * 2 l r ...
instruction
0
13,818
12
27,636
No
output
1
13,818
12
27,637
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 consisting of positive integers and q queries to this array. There are two types of queries: * 1 l r x — for each index i such that l ≤ i ≤ r set ai = x. * 2 l r ...
instruction
0
13,819
12
27,638
No
output
1
13,819
12
27,639
Provide tags and a correct Python 3 solution for this coding contest problem. You are given a binary matrix a of size n × m. A binary matrix is a matrix where each element is either 0 or 1. You may perform some (possibly zero) operations with this matrix. During each operation you can inverse the row of this matrix o...
instruction
0
14,214
12
28,428
Tags: brute force, constructive algorithms Correct Solution: ``` def check(a): n = len(a) m = len(a[0]) if a[0][-1] == 1: flag = True else: flag = False ones = [1] * m zeros = [0] * m r = [0] * n c = [0] * m for i in range(1, n): if flag: if a[i] =...
output
1
14,214
12
28,429
Provide tags and a correct Python 3 solution for this coding contest problem. You are given a binary matrix a of size n × m. A binary matrix is a matrix where each element is either 0 or 1. You may perform some (possibly zero) operations with this matrix. During each operation you can inverse the row of this matrix o...
instruction
0
14,215
12
28,430
Tags: brute force, constructive algorithms Correct Solution: ``` def inverse_row(row): inv_row[row]= not inv_row[row] for i in range(m): a[row][i]=not a[row][i] def inverse_col(col): inv_col[col]= not inv_col[col] for i in range(n): a[i][col]=not a[i][col] def check_row(row): ...
output
1
14,215
12
28,431
Provide tags and a correct Python 3 solution for this coding contest problem. You are given a binary matrix a of size n × m. A binary matrix is a matrix where each element is either 0 or 1. You may perform some (possibly zero) operations with this matrix. During each operation you can inverse the row of this matrix o...
instruction
0
14,216
12
28,432
Tags: brute force, constructive algorithms Correct Solution: ``` import sys input = sys.stdin.readline n,m=map(int,input().split()) A=[list(map(int,input().split())) for i in range(n)] for i in range(m): #一行目をi-1まで0にする ANSR=[0]*n ANSC=[0]*m for j in range(i): if A[0][j]==1: ANSC[...
output
1
14,216
12
28,433
Provide tags and a correct Python 3 solution for this coding contest problem. You are given a binary matrix a of size n × m. A binary matrix is a matrix where each element is either 0 or 1. You may perform some (possibly zero) operations with this matrix. During each operation you can inverse the row of this matrix o...
instruction
0
14,217
12
28,434
Tags: brute force, constructive algorithms Correct Solution: ``` import io import os from collections import defaultdict from sys import stdin, stdout #input = stdin.readline def main(): n, m = map(int, input().split()) g = [[] for _ in range(n)] for r in range(n): g[r] = list(map(int, input().spl...
output
1
14,217
12
28,435