message stringlengths 2 28.7k | message_type stringclasses 2
values | message_id int64 0 1 | conversation_id int64 21 109k | cluster float64 7 7 | __index_level_0__ int64 42 217k |
|---|---|---|---|---|---|
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
It's Petya's birthday party and his friends have presented him a brand new "Electrician-n" construction set, which they are sure he will enjoy as he always does with weird puzzles they give him.... | instruction | 0 | 95,381 | 7 | 190,762 |
No | output | 1 | 95,381 | 7 | 190,763 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
It's Petya's birthday party and his friends have presented him a brand new "Electrician-n" construction set, which they are sure he will enjoy as he always does with weird puzzles they give him.... | instruction | 0 | 95,382 | 7 | 190,764 |
No | output | 1 | 95,382 | 7 | 190,765 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Rick and Morty want to find MR. PBH and they can't do it alone. So they need of Mr. Meeseeks. They Have generated n Mr. Meeseeks, standing in a line numbered from 1 to n. Each of them has his ow... | instruction | 0 | 95,763 | 7 | 191,526 |
No | output | 1 | 95,763 | 7 | 191,527 |
Provide tags and a correct Python 3 solution for this coding contest problem.
In the game of Mastermind, there are two players — Alice and Bob. Alice has a secret code, which Bob tries to guess. Here, a code is defined as a sequence of n colors. There are exactly n+1 colors in the entire universe, numbered from 1 to n... | instruction | 0 | 96,292 | 7 | 192,584 |
Tags: constructive algorithms, graph matchings, greedy, implementation, sortings, two pointers
Correct Solution:
```
from sys import stdin, stdout
from collections import defaultdict
from heapq import heapify, heappop, heappush
def solve():
n, s, y = map(int, stdin.readline().split())
a = stdin.readline().split... | output | 1 | 96,292 | 7 | 192,585 |
Provide tags and a correct Python 3 solution for this coding contest problem.
In the game of Mastermind, there are two players — Alice and Bob. Alice has a secret code, which Bob tries to guess. Here, a code is defined as a sequence of n colors. There are exactly n+1 colors in the entire universe, numbered from 1 to n... | instruction | 0 | 96,293 | 7 | 192,586 |
Tags: constructive algorithms, graph matchings, greedy, implementation, sortings, two pointers
Correct Solution:
```
import sys, math
import io, os
#data = io.BytesIO(os.read(0,os.fstat(0).st_size)).readline
from bisect import bisect_left as bl, bisect_right as br, insort
from heapq import heapify, heappush, heappop
fr... | output | 1 | 96,293 | 7 | 192,587 |
Provide tags and a correct Python 3 solution for this coding contest problem.
In the game of Mastermind, there are two players — Alice and Bob. Alice has a secret code, which Bob tries to guess. Here, a code is defined as a sequence of n colors. There are exactly n+1 colors in the entire universe, numbered from 1 to n... | instruction | 0 | 96,294 | 7 | 192,588 |
Tags: constructive algorithms, graph matchings, greedy, implementation, sortings, two pointers
Correct Solution:
```
from sys import stdin, stdout
from collections import Counter, defaultdict
import heapq
t = int(stdin.readline())
for _ in range(t):
n, x, y = map(int, stdin.readline().split())
a = list(map(int... | output | 1 | 96,294 | 7 | 192,589 |
Provide tags and a correct Python 3 solution for this coding contest problem.
In the game of Mastermind, there are two players — Alice and Bob. Alice has a secret code, which Bob tries to guess. Here, a code is defined as a sequence of n colors. There are exactly n+1 colors in the entire universe, numbered from 1 to n... | instruction | 0 | 96,295 | 7 | 192,590 |
Tags: constructive algorithms, graph matchings, greedy, implementation, sortings, two pointers
Correct Solution:
```
from sys import stdin
from collections import deque
from itertools import chain
input = stdin.readline
def getint(): return int(input())
def getints(): return list(map(int, input().split()))
def getint1(... | output | 1 | 96,295 | 7 | 192,591 |
Provide tags and a correct Python 3 solution for this coding contest problem.
In the game of Mastermind, there are two players — Alice and Bob. Alice has a secret code, which Bob tries to guess. Here, a code is defined as a sequence of n colors. There are exactly n+1 colors in the entire universe, numbered from 1 to n... | instruction | 0 | 96,296 | 7 | 192,592 |
Tags: constructive algorithms, graph matchings, greedy, implementation, sortings, two pointers
Correct Solution:
```
import collections
t = int(input())
for _ in range(t):
# print('time', _)
n, x, y = map(int, input().split())
b = [int(i) for i in input().split()]
if x == n:
print("YES")
... | output | 1 | 96,296 | 7 | 192,593 |
Provide tags and a correct Python 3 solution for this coding contest problem.
In the game of Mastermind, there are two players — Alice and Bob. Alice has a secret code, which Bob tries to guess. Here, a code is defined as a sequence of n colors. There are exactly n+1 colors in the entire universe, numbered from 1 to n... | instruction | 0 | 96,297 | 7 | 192,594 |
Tags: constructive algorithms, graph matchings, greedy, implementation, sortings, two pointers
Correct Solution:
```
from sys import stdin, stdout
import heapq
# 5 3 4
# 1 1 2 1 2
# 3 1 1 1 2
# 1 1 2 1 2
# 4 1 4
# 2 3 2 3
# 2 2 3 3
# 1 2 1 2
# 0 2 1 3
# 1 3 0 2
def Mastermind(n, x, y, b_a):
ans = [-1] * n
#... | output | 1 | 96,297 | 7 | 192,595 |
Provide tags and a correct Python 3 solution for this coding contest problem.
In the game of Mastermind, there are two players — Alice and Bob. Alice has a secret code, which Bob tries to guess. Here, a code is defined as a sequence of n colors. There are exactly n+1 colors in the entire universe, numbered from 1 to n... | instruction | 0 | 96,298 | 7 | 192,596 |
Tags: constructive algorithms, graph matchings, greedy, implementation, sortings, two pointers
Correct Solution:
```
from heapq import *
from collections import Counter
import sys
sys.setrecursionlimit(10 ** 5)
int1 = lambda x: int(x) - 1
p2D = lambda x: print(*x, sep="\n")
def II(): return int(sys.stdin.readline())
d... | output | 1 | 96,298 | 7 | 192,597 |
Provide tags and a correct Python 3 solution for this coding contest problem.
In the game of Mastermind, there are two players — Alice and Bob. Alice has a secret code, which Bob tries to guess. Here, a code is defined as a sequence of n colors. There are exactly n+1 colors in the entire universe, numbered from 1 to n... | instruction | 0 | 96,299 | 7 | 192,598 |
Tags: constructive algorithms, graph matchings, greedy, implementation, sortings, two pointers
Correct Solution:
```
from collections import defaultdict
from heapq import heapify, heappop, heappush
def solve():
n, s, y = map(int, input().split())
a = input().split()
d = defaultdict(list)
for i, x in enu... | output | 1 | 96,299 | 7 | 192,599 |
Provide tags and a correct Python 3 solution for this coding contest problem.
You've gotten an n × m sheet of squared paper. Some of its squares are painted. Let's mark the set of all painted squares as A. Set A is connected. Your task is to find the minimum number of squares that we can delete from set A to make it n... | instruction | 0 | 96,388 | 7 | 192,776 |
Tags: constructive algorithms, graphs, trees
Correct Solution:
```
n, m = map(int, input().split())
a = [list(input()) for i in range(n)]
dirs = [(0, 1), (1, 0), (0, -1), (-1, 0)]
def valid(x, y):
return 0 <= x < n and 0 <= y < m
def d():
cnt, p = 0, -1
for i in range(n):
for j in range(m... | output | 1 | 96,388 | 7 | 192,777 |
Provide tags and a correct Python 3 solution for this coding contest problem.
You've gotten an n × m sheet of squared paper. Some of its squares are painted. Let's mark the set of all painted squares as A. Set A is connected. Your task is to find the minimum number of squares that we can delete from set A to make it n... | instruction | 0 | 96,389 | 7 | 192,778 |
Tags: constructive algorithms, graphs, trees
Correct Solution:
```
def add(vertex,neighbour):
if vertex in graph:
graph[vertex].append(neighbour)
else:
graph[vertex]=[neighbour]
if neighbour in graph: #####for undirected part remove to get directed
graph[neighbour].append(vertex)... | output | 1 | 96,389 | 7 | 192,779 |
Provide tags and a correct Python 3 solution for this coding contest problem.
You've gotten an n × m sheet of squared paper. Some of its squares are painted. Let's mark the set of all painted squares as A. Set A is connected. Your task is to find the minimum number of squares that we can delete from set A to make it n... | instruction | 0 | 96,390 | 7 | 192,780 |
Tags: constructive algorithms, graphs, trees
Correct Solution:
```
n, m = map(int, input().split())
p, s = [], {}
for i in range(n):
t = [j for j, q in enumerate(input()) if q == '#']
for j in t:
s[(i, j)] = x = len(s)
p += [[]]
for q in [(i, j - 1), (i - 1, j)]:
if q in s:
... | output | 1 | 96,390 | 7 | 192,781 |
Provide tags and a correct Python 3 solution for this coding contest problem.
You've gotten an n × m sheet of squared paper. Some of its squares are painted. Let's mark the set of all painted squares as A. Set A is connected. Your task is to find the minimum number of squares that we can delete from set A to make it n... | instruction | 0 | 96,391 | 7 | 192,782 |
Tags: constructive algorithms, graphs, trees
Correct Solution:
```
from sys import stdin, stdout
n, m = map(int, stdin.readline().split())
step = [(-1, 0), (1, 0), (0, -1), (0, 1)]
ans = float('inf')
challengers = []
counting = 0
maps = []
def check(s, c):
return n > s >= 0 and m > c >= 0 and maps[s][c] == '#'
... | output | 1 | 96,391 | 7 | 192,783 |
Provide tags and a correct Python 3 solution for this coding contest problem.
You've gotten an n × m sheet of squared paper. Some of its squares are painted. Let's mark the set of all painted squares as A. Set A is connected. Your task is to find the minimum number of squares that we can delete from set A to make it n... | instruction | 0 | 96,392 | 7 | 192,784 |
Tags: constructive algorithms, graphs, trees
Correct Solution:
```
n, m = map(int, input().split())
p, s = [], {}
x = 0
for i in range(n):
for j, q in enumerate(input()):
if q != '#': continue
s[(i, j)] = x
p.append([])
if (i, j - 1) in s:
p[x] += [x - 1]
p[x ... | output | 1 | 96,392 | 7 | 192,785 |
Provide tags and a correct Python 3 solution for this coding contest problem.
You've gotten an n × m sheet of squared paper. Some of its squares are painted. Let's mark the set of all painted squares as A. Set A is connected. Your task is to find the minimum number of squares that we can delete from set A to make it n... | instruction | 0 | 96,393 | 7 | 192,786 |
Tags: constructive algorithms, graphs, trees
Correct Solution:
```
n, m = map(int, input().split())
a = [list(input()) for i in range(n)]
dirs = [(0, 1), (1, 0), (0, -1), (-1, 0)]
def valid(x, y):
return 0 <= x < n and 0 <= y < m
def dfs():
cnt, p = 0, -1
for i in range(n):
for j in range(m):
... | output | 1 | 96,393 | 7 | 192,787 |
Provide tags and a correct Python 3 solution for this coding contest problem.
You've gotten an n × m sheet of squared paper. Some of its squares are painted. Let's mark the set of all painted squares as A. Set A is connected. Your task is to find the minimum number of squares that we can delete from set A to make it n... | instruction | 0 | 96,394 | 7 | 192,788 |
Tags: constructive algorithms, graphs, trees
Correct Solution:
```
import os,io
from sys import stdout
import collections
import random
input = io.BytesIO(os.read(0,os.fstat(0).st_size)).readline
import sys
sys.setrecursionlimit(10000)
def binomial_coefficient(n, k):
if 0 <= k <= n:
ntok = 1
ktok ... | output | 1 | 96,394 | 7 | 192,789 |
Provide tags and a correct Python 3 solution for this coding contest problem.
You've gotten an n × m sheet of squared paper. Some of its squares are painted. Let's mark the set of all painted squares as A. Set A is connected. Your task is to find the minimum number of squares that we can delete from set A to make it n... | instruction | 0 | 96,395 | 7 | 192,790 |
Tags: constructive algorithms, graphs, trees
Correct Solution:
```
# by the authority of GOD author: manhar singh sachdev #
import os,sys
from io import BytesIO, IOBase
from collections import deque
def func(lst,st,po,n,m):
dirs = [(0,1),(0,-1),(1,0),(-1,0)]
x = (st[0] if st[0]!=po else st[1])
curr,se... | output | 1 | 96,395 | 7 | 192,791 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You've gotten an n × m sheet of squared paper. Some of its squares are painted. Let's mark the set of all painted squares as A. Set A is connected. Your task is to find the minimum number of squ... | instruction | 0 | 96,396 | 7 | 192,792 |
No | output | 1 | 96,396 | 7 | 192,793 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You've gotten an n × m sheet of squared paper. Some of its squares are painted. Let's mark the set of all painted squares as A. Set A is connected. Your task is to find the minimum number of squ... | instruction | 0 | 96,397 | 7 | 192,794 |
No | output | 1 | 96,397 | 7 | 192,795 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You've gotten an n × m sheet of squared paper. Some of its squares are painted. Let's mark the set of all painted squares as A. Set A is connected. Your task is to find the minimum number of squ... | instruction | 0 | 96,398 | 7 | 192,796 |
No | output | 1 | 96,398 | 7 | 192,797 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You've gotten an n × m sheet of squared paper. Some of its squares are painted. Let's mark the set of all painted squares as A. Set A is connected. Your task is to find the minimum number of squ... | instruction | 0 | 96,399 | 7 | 192,798 |
No | output | 1 | 96,399 | 7 | 192,799 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Gildong has bought a famous painting software cfpaint. The working screen of cfpaint is square-shaped consisting of n rows and n columns of square cells. The rows are numbered from 1 to n, from top to bottom, and the columns are numbered fro... | instruction | 0 | 97,036 | 7 | 194,072 |
Tags: brute force, data structures, dp, implementation, two pointers
Correct Solution:
```
from sys import stdin
from sys import setrecursionlimit as SRL; SRL(10**7)
rd = stdin.readline
rrd = lambda: map(int, rd().strip().split())
n,k = rrd()
s = []
cal = [[0]*(n+10) for _i in range(n+10)]
for i in range(n):
s.... | output | 1 | 97,036 | 7 | 194,073 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Gildong has bought a famous painting software cfpaint. The working screen of cfpaint is square-shaped consisting of n rows and n columns of square cells. The rows are numbered from 1 to n, from top to bottom, and the columns are numbered fro... | instruction | 0 | 97,037 | 7 | 194,074 |
Tags: brute force, data structures, dp, implementation, two pointers
Correct Solution:
```
from sys import stdin, stdout
from collections import *
from array import *
def iarr(delim = " "): return map(int, input().split(delim))
def mat(n, m, v = None): return [[v]*m for _ in range(n)]
n, k, *_ = iarr()
lc = [-1]*n
rc ... | output | 1 | 97,037 | 7 | 194,075 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Gildong has bought a famous painting software cfpaint. The working screen of cfpaint is square-shaped consisting of n rows and n columns of square cells. The rows are numbered from 1 to n, from top to bottom, and the columns are numbered fro... | instruction | 0 | 97,038 | 7 | 194,076 |
Tags: brute force, data structures, dp, implementation, two pointers
Correct Solution:
```
import sys
def count(n, k, field):
blank = 0
cnt = [[0] * (n - k + 1) for _ in range(n)]
for i, row in enumerate(field):
l = row.find('B')
r = row.rfind('B')
if l == r == -1:
blan... | output | 1 | 97,038 | 7 | 194,077 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Gildong has bought a famous painting software cfpaint. The working screen of cfpaint is square-shaped consisting of n rows and n columns of square cells. The rows are numbered from 1 to n, from top to bottom, and the columns are numbered fro... | instruction | 0 | 97,039 | 7 | 194,078 |
Tags: brute force, data structures, dp, implementation, two pointers
Correct Solution:
```
n, k = map(int ,input().split())
c_p1 = [[-1] * 2001 for x in range(2001)]
c_p2 = [[-1] * 2001 for x in range(2001)]
r_p1 = [[-1] * 2001 for x in range(2001)]
r_p2 = [[-1] * 2001 for x in range(2001)]
cells = []
for i in ran... | output | 1 | 97,039 | 7 | 194,079 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Gildong has bought a famous painting software cfpaint. The working screen of cfpaint is square-shaped consisting of n rows and n columns of square cells. The rows are numbered from 1 to n, from top to bottom, and the columns are numbered fro... | instruction | 0 | 97,040 | 7 | 194,080 |
Tags: brute force, data structures, dp, implementation, two pointers
Correct Solution:
```
import sys
input = lambda: sys.stdin.readline().strip()
n, k = map(int, input().split())
arr = []
for i in range(n):
arr.append(list(input()))
extra = 0
res = []
for i in range(n-k+1):
res.append([])
for j in range(n... | output | 1 | 97,040 | 7 | 194,081 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Gildong has bought a famous painting software cfpaint. The working screen of cfpaint is square-shaped consisting of n rows and n columns of square cells. The rows are numbered from 1 to n, from top to bottom, and the columns are numbered fro... | instruction | 0 | 97,041 | 7 | 194,082 |
Tags: brute force, data structures, dp, implementation, two pointers
Correct Solution:
```
# ---------------------------iye ha aam zindegi---------------------------------------------
import math
import heapq, bisect
import sys
from collections import deque, defaultdict
from fractions import Fraction
import sys
mod = 1... | output | 1 | 97,041 | 7 | 194,083 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Gildong has bought a famous painting software cfpaint. The working screen of cfpaint is square-shaped consisting of n rows and n columns of square cells. The rows are numbered from 1 to n, from top to bottom, and the columns are numbered fro... | instruction | 0 | 97,042 | 7 | 194,084 |
Tags: brute force, data structures, dp, implementation, two pointers
Correct Solution:
```
# pypy 3.6
import re
from collections import deque
from functools import reduce
from fractions import gcd # ~py3.4
from heapq import *
from itertools import permutations
from math import pi
from operator import itemgetter
from ... | output | 1 | 97,042 | 7 | 194,085 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Gildong has bought a famous painting software cfpaint. The working screen of cfpaint is square-shaped consisting of n rows and n columns of square cells. The rows are numbered from 1 to n, from top to bottom, and the columns are numbered fro... | instruction | 0 | 97,043 | 7 | 194,086 |
Tags: brute force, data structures, dp, implementation, two pointers
Correct Solution:
```
n,k=map(int,input().split())
it=[[0]*n for i in range(n)]
t=[[-1,-1] for i in range(n)]
tt=[[-1,-1] for i in range(n)]
for i in range(n):
s=input()
c=-1
cc=-1
for j,ii in enumerate(s):
if ii=="B":
... | output | 1 | 97,043 | 7 | 194,087 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Gildong has bought a famous painting software cfpaint. The working screen of cfpaint is square-shaped consisting of n rows and n columns of square cells. The rows are numbered from 1 to n, from ... | instruction | 0 | 97,044 | 7 | 194,088 |
Yes | output | 1 | 97,044 | 7 | 194,089 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Gildong has bought a famous painting software cfpaint. The working screen of cfpaint is square-shaped consisting of n rows and n columns of square cells. The rows are numbered from 1 to n, from ... | instruction | 0 | 97,045 | 7 | 194,090 |
Yes | output | 1 | 97,045 | 7 | 194,091 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Gildong has bought a famous painting software cfpaint. The working screen of cfpaint is square-shaped consisting of n rows and n columns of square cells. The rows are numbered from 1 to n, from ... | instruction | 0 | 97,046 | 7 | 194,092 |
Yes | output | 1 | 97,046 | 7 | 194,093 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Gildong has bought a famous painting software cfpaint. The working screen of cfpaint is square-shaped consisting of n rows and n columns of square cells. The rows are numbered from 1 to n, from ... | instruction | 0 | 97,047 | 7 | 194,094 |
Yes | output | 1 | 97,047 | 7 | 194,095 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Gildong has bought a famous painting software cfpaint. The working screen of cfpaint is square-shaped consisting of n rows and n columns of square cells. The rows are numbered from 1 to n, from ... | instruction | 0 | 97,048 | 7 | 194,096 |
No | output | 1 | 97,048 | 7 | 194,097 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Gildong has bought a famous painting software cfpaint. The working screen of cfpaint is square-shaped consisting of n rows and n columns of square cells. The rows are numbered from 1 to n, from ... | instruction | 0 | 97,049 | 7 | 194,098 |
No | output | 1 | 97,049 | 7 | 194,099 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Gildong has bought a famous painting software cfpaint. The working screen of cfpaint is square-shaped consisting of n rows and n columns of square cells. The rows are numbered from 1 to n, from ... | instruction | 0 | 97,050 | 7 | 194,100 |
No | output | 1 | 97,050 | 7 | 194,101 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Gildong has bought a famous painting software cfpaint. The working screen of cfpaint is square-shaped consisting of n rows and n columns of square cells. The rows are numbered from 1 to n, from ... | instruction | 0 | 97,051 | 7 | 194,102 |
No | output | 1 | 97,051 | 7 | 194,103 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Consider an n × m grid. Initially all the cells of the grid are colored white. Lenny has painted some of the cells (at least one) black. We call a painted grid convex if one can walk from any black cell to any another black cell using a path... | instruction | 0 | 97,283 | 7 | 194,566 |
Tags: constructive algorithms, implementation
Correct Solution:
```
#author: riyan
def solve(n, m):
grid = []
for i in range(n):
grid.append(input().strip())
cnt = 0
for j in range(1, m):
if grid[i][j] != grid[i][j - 1]:
cnt += 1
if (cnt > 2) or (cnt ... | output | 1 | 97,283 | 7 | 194,567 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Consider an n × m grid. Initially all the cells of the grid are colored white. Lenny has painted some of the cells (at least one) black. We call a painted grid convex if one can walk from any black cell to any another black cell using a path... | instruction | 0 | 97,284 | 7 | 194,568 |
Tags: constructive algorithms, implementation
Correct Solution:
```
import sys
def exi():
print("NO")
sys.exit()
I=lambda:list(map(int,input().split()))
g=[]
n,m=I()
for i in range(n):
g.append(list(input()))
for i in range(n):
temp=0
for j in range(1,m):
if g[i][j-1]!=g[i][j]:
t... | output | 1 | 97,284 | 7 | 194,569 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Consider an n × m grid. Initially all the cells of the grid are colored white. Lenny has painted some of the cells (at least one) black. We call a painted grid convex if one can walk from any black cell to any another black cell using a path... | instruction | 0 | 97,285 | 7 | 194,570 |
Tags: constructive algorithms, implementation
Correct Solution:
```
import os
import sys
from io import BytesIO, IOBase
from collections import Counter
BUFSIZE = 8192
class FastIO(IOBase):
newlines = 0
def __init__(self, file):
self._fd = file.fileno()
self.buffer = BytesIO()
self.wr... | output | 1 | 97,285 | 7 | 194,571 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Consider an n × m grid. Initially all the cells of the grid are colored white. Lenny has painted some of the cells (at least one) black. We call a painted grid convex if one can walk from any black cell to any another black cell using a path... | instruction | 0 | 97,286 | 7 | 194,572 |
Tags: constructive algorithms, implementation
Correct Solution:
```
def f():
n, m = map(int, input().split())
t = [input() for j in range(n)]
p = [''.join(i) for i in zip(*t)]
if h(p): return 1
i = 0
while i < n and not 'B' in t[i]: i += 1
while i < n:
a = t[i].find('B')
i... | output | 1 | 97,286 | 7 | 194,573 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Consider an n × m grid. Initially all the cells of the grid are colored white. Lenny has painted some of the cells (at least one) black. We call a painted grid convex if one can walk from any black cell to any another black cell using a path... | instruction | 0 | 97,287 | 7 | 194,574 |
Tags: constructive algorithms, implementation
Correct Solution:
```
def f():
n, m = map(int, input().split())
t = [input() for j in range(n)]
p = [''.join(i) for i in zip(*t)]
if h(p): return 1
i = 0
while i < n and not 'B' in t[i]: i += 1
while i < n:
a = t[i].find('B'... | output | 1 | 97,287 | 7 | 194,575 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Consider an n × m grid. Initially all the cells of the grid are colored white. Lenny has painted some of the cells (at least one) black. We call a painted grid convex if one can walk from any black cell to any another black cell using a path... | instruction | 0 | 97,288 | 7 | 194,576 |
Tags: constructive algorithms, implementation
Correct Solution:
```
n, m = map(int, input().split())
z = [[] for i in range(n+1)]
for i in range(n):
a = input()
for j in a:
z[i].append(j)
def solve(n, m):
for i in range(n):
cnt = 0
for j in range(1, m):
if z[i][j] != z[... | output | 1 | 97,288 | 7 | 194,577 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Consider an n × m grid. Initially all the cells of the grid are colored white. Lenny has painted some of the cells (at least one) black. We call a painted grid convex if one can walk from any black cell to any another black cell using a path... | instruction | 0 | 97,289 | 7 | 194,578 |
Tags: constructive algorithms, implementation
Correct Solution:
```
n,m = map(int, input().split())
row, col_sum, row_sum, black = [], [], [], []
for i in range(n):
row.append(input())
t = [0]
for j in range(m):
t += [t[j] + (row[i][j] == 'B')]
row_sum += [t]
d = [[0,1], [1,0], [-1,0], [0,-1]]... | output | 1 | 97,289 | 7 | 194,579 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Consider an n × m grid. Initially all the cells of the grid are colored white. Lenny has painted some of the cells (at least one) black. We call a painted grid convex if one can walk from any black cell to any another black cell using a path... | instruction | 0 | 97,290 | 7 | 194,580 |
Tags: constructive algorithms, implementation
Correct Solution:
```
n, m = map(int, input().split())
grid = []
ans = True
for i in range(n):
grid.append(input())
black = False
change = False
for j in range(m):
if grid[i][j] == "W" and black:
change = True
elif grid[i][j]... | output | 1 | 97,290 | 7 | 194,581 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Consider an n × m grid. Initially all the cells of the grid are colored white. Lenny has painted some of the cells (at least one) black. We call a painted grid convex if one can walk from any bl... | instruction | 0 | 97,291 | 7 | 194,582 |
Yes | output | 1 | 97,291 | 7 | 194,583 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Consider an n × m grid. Initially all the cells of the grid are colored white. Lenny has painted some of the cells (at least one) black. We call a painted grid convex if one can walk from any bl... | instruction | 0 | 97,292 | 7 | 194,584 |
Yes | output | 1 | 97,292 | 7 | 194,585 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Consider an n × m grid. Initially all the cells of the grid are colored white. Lenny has painted some of the cells (at least one) black. We call a painted grid convex if one can walk from any bl... | instruction | 0 | 97,293 | 7 | 194,586 |
Yes | output | 1 | 97,293 | 7 | 194,587 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.