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.
Roy and Biv have a set of n points on the infinite number line.
Each point has one of 3 colors: red, green, or blue.
Roy and Biv would like to connect all the points with some edges. Edges can... | instruction | 0 | 517 | 7 | 1,034 |
Yes | output | 1 | 517 | 7 | 1,035 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Roy and Biv have a set of n points on the infinite number line.
Each point has one of 3 colors: red, green, or blue.
Roy and Biv would like to connect all the points with some edges. Edges can... | instruction | 0 | 518 | 7 | 1,036 |
Yes | output | 1 | 518 | 7 | 1,037 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Roy and Biv have a set of n points on the infinite number line.
Each point has one of 3 colors: red, green, or blue.
Roy and Biv would like to connect all the points with some edges. Edges can... | instruction | 0 | 519 | 7 | 1,038 |
Yes | output | 1 | 519 | 7 | 1,039 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Roy and Biv have a set of n points on the infinite number line.
Each point has one of 3 colors: red, green, or blue.
Roy and Biv would like to connect all the points with some edges. Edges can... | instruction | 0 | 520 | 7 | 1,040 |
No | output | 1 | 520 | 7 | 1,041 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Roy and Biv have a set of n points on the infinite number line.
Each point has one of 3 colors: red, green, or blue.
Roy and Biv would like to connect all the points with some edges. Edges can... | instruction | 0 | 521 | 7 | 1,042 |
No | output | 1 | 521 | 7 | 1,043 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Roy and Biv have a set of n points on the infinite number line.
Each point has one of 3 colors: red, green, or blue.
Roy and Biv would like to connect all the points with some edges. Edges can... | instruction | 0 | 522 | 7 | 1,044 |
No | output | 1 | 522 | 7 | 1,045 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Roy and Biv have a set of n points on the infinite number line.
Each point has one of 3 colors: red, green, or blue.
Roy and Biv would like to connect all the points with some edges. Edges can... | instruction | 0 | 523 | 7 | 1,046 |
No | output | 1 | 523 | 7 | 1,047 |
Provide tags and a correct Python 3 solution for this coding contest problem.
President of Berland has a very vast office-room, where, apart from him, work his subordinates. Each subordinate, as well as President himself, has his own desk of a unique colour. Each desk is rectangular, and its sides are parallel to the ... | instruction | 0 | 1,317 | 7 | 2,634 |
Tags: implementation
Correct Solution:
```
n , m , p = input().strip().split(' ')
n , m = int(n), int(m)
M = [[None for _ in range(m)] for _ in range(n)]
for i in range(n):
s = input().strip()
for j in range(m):
M[i][j] = s[j]
T = [[False for _ in range(m)] for _ in range(n)]
for i in range(n):
fo... | output | 1 | 1,317 | 7 | 2,635 |
Provide tags and a correct Python 3 solution for this coding contest problem.
President of Berland has a very vast office-room, where, apart from him, work his subordinates. Each subordinate, as well as President himself, has his own desk of a unique colour. Each desk is rectangular, and its sides are parallel to the ... | instruction | 0 | 1,318 | 7 | 2,636 |
Tags: implementation
Correct Solution:
```
t=list(map(str,input().split()))
a=[]
for _ in range(int(t[0])):
a.append(input())
r=[]
#print(a)
n=int(t[0])
m=int(t[1])
for i in range(n-1):
for j in range(m-1):
if a[i][j]!='.' and a[i][j+1]==t[2] and a[i][j]!=t[2]:
r.append(a[i][j])
if ... | output | 1 | 1,318 | 7 | 2,637 |
Provide tags and a correct Python 3 solution for this coding contest problem.
President of Berland has a very vast office-room, where, apart from him, work his subordinates. Each subordinate, as well as President himself, has his own desk of a unique colour. Each desk is rectangular, and its sides are parallel to the ... | instruction | 0 | 1,319 | 7 | 2,638 |
Tags: implementation
Correct Solution:
```
a = input().split()
n = int(a[0])
m = int(a[1])
c = a[2]
k = []
d = []
b = []
for i in range(n):
st = input()
k.append(st)
for i in range(n):
for j in range(m):
if k[i][j] == c:
d.append([i, j])
b.append(c)
for i in range(len(d)):
if d[i][0]... | output | 1 | 1,319 | 7 | 2,639 |
Provide tags and a correct Python 3 solution for this coding contest problem.
President of Berland has a very vast office-room, where, apart from him, work his subordinates. Each subordinate, as well as President himself, has his own desk of a unique colour. Each desk is rectangular, and its sides are parallel to the ... | instruction | 0 | 1,320 | 7 | 2,640 |
Tags: implementation
Correct Solution:
```
n, m, c = input().split()
n, m = map(int, (n, m))
a = [input() for i in range(n)]
s = set()
d = (0, 1), (1, 0), (0, -1), (-1, 0)
cor = lambda x, y: 0 <= x < n and 0 <= y < m
for i in range(n):
for j in range(m):
if a[i][j] == c:
for dx, dy in d:
... | output | 1 | 1,320 | 7 | 2,641 |
Provide tags and a correct Python 3 solution for this coding contest problem.
President of Berland has a very vast office-room, where, apart from him, work his subordinates. Each subordinate, as well as President himself, has his own desk of a unique colour. Each desk is rectangular, and its sides are parallel to the ... | instruction | 0 | 1,321 | 7 | 2,642 |
Tags: implementation
Correct Solution:
```
# Fast IO
import sys
input = sys.stdin.readline
def print(x, end='\n'):
sys.stdout.write(str(x) + end)
# IO helpers
def get_int():
return int(input())
def get_list_ints():
return list(map(int, input().split()))
def get_char_list():
s = input()
return lis... | output | 1 | 1,321 | 7 | 2,643 |
Provide tags and a correct Python 3 solution for this coding contest problem.
President of Berland has a very vast office-room, where, apart from him, work his subordinates. Each subordinate, as well as President himself, has his own desk of a unique colour. Each desk is rectangular, and its sides are parallel to the ... | instruction | 0 | 1,322 | 7 | 2,644 |
Tags: implementation
Correct Solution:
```
m, n, c = input().split()
m = int(m)
n = int(n)
a = [[j for j in input()]for i in range(m)]
inxs = list()
con = list()
fin = list()
for i in range(m):
for j in range(n):
if a[i][j] == c:
inxs.append(i)
inxs.append(j)
# if i == 0:... | output | 1 | 1,322 | 7 | 2,645 |
Provide tags and a correct Python 3 solution for this coding contest problem.
President of Berland has a very vast office-room, where, apart from him, work his subordinates. Each subordinate, as well as President himself, has his own desk of a unique colour. Each desk is rectangular, and its sides are parallel to the ... | instruction | 0 | 1,323 | 7 | 2,646 |
Tags: implementation
Correct Solution:
```
n,m,c = input().split(" ")
n = int(n)
m = int(m)
M = []
temp = []
for i in range(m+2):
temp.append('.')
M.append(temp)
for i in range(0,n):
k = list(input())
k.insert(0,'.')
k.insert(len(k),'.')
M.append(k)
M.append(temp)
#print(M)
d={}
for i in range(1,n+... | output | 1 | 1,323 | 7 | 2,647 |
Provide tags and a correct Python 3 solution for this coding contest problem.
President of Berland has a very vast office-room, where, apart from him, work his subordinates. Each subordinate, as well as President himself, has his own desk of a unique colour. Each desk is rectangular, and its sides are parallel to the ... | instruction | 0 | 1,324 | 7 | 2,648 |
Tags: implementation
Correct Solution:
```
rows, columns, color = input().split()
rows = int(rows)
columns = int(columns)
mat = []
desk = {color}
for i in range(rows):
mat.append(list(input()))
for i in range(len(mat)):
for j in range(columns):
if mat[i][j] != '.':
if j+1 < columns:
... | output | 1 | 1,324 | 7 | 2,649 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
President of Berland has a very vast office-room, where, apart from him, work his subordinates. Each subordinate, as well as President himself, has his own desk of a unique colour. Each desk is ... | instruction | 0 | 1,325 | 7 | 2,650 |
Yes | output | 1 | 1,325 | 7 | 2,651 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
President of Berland has a very vast office-room, where, apart from him, work his subordinates. Each subordinate, as well as President himself, has his own desk of a unique colour. Each desk is ... | instruction | 0 | 1,326 | 7 | 2,652 |
Yes | output | 1 | 1,326 | 7 | 2,653 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
President of Berland has a very vast office-room, where, apart from him, work his subordinates. Each subordinate, as well as President himself, has his own desk of a unique colour. Each desk is ... | instruction | 0 | 1,327 | 7 | 2,654 |
Yes | output | 1 | 1,327 | 7 | 2,655 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
President of Berland has a very vast office-room, where, apart from him, work his subordinates. Each subordinate, as well as President himself, has his own desk of a unique colour. Each desk is ... | instruction | 0 | 1,328 | 7 | 2,656 |
Yes | output | 1 | 1,328 | 7 | 2,657 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
President of Berland has a very vast office-room, where, apart from him, work his subordinates. Each subordinate, as well as President himself, has his own desk of a unique colour. Each desk is ... | instruction | 0 | 1,329 | 7 | 2,658 |
No | output | 1 | 1,329 | 7 | 2,659 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
President of Berland has a very vast office-room, where, apart from him, work his subordinates. Each subordinate, as well as President himself, has his own desk of a unique colour. Each desk is ... | instruction | 0 | 1,330 | 7 | 2,660 |
No | output | 1 | 1,330 | 7 | 2,661 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
President of Berland has a very vast office-room, where, apart from him, work his subordinates. Each subordinate, as well as President himself, has his own desk of a unique colour. Each desk is ... | instruction | 0 | 1,331 | 7 | 2,662 |
No | output | 1 | 1,331 | 7 | 2,663 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
President of Berland has a very vast office-room, where, apart from him, work his subordinates. Each subordinate, as well as President himself, has his own desk of a unique colour. Each desk is ... | instruction | 0 | 1,332 | 7 | 2,664 |
No | output | 1 | 1,332 | 7 | 2,665 |
Provide tags and a correct Python 3 solution for this coding contest problem.
The flag of Berland is such rectangular field n × m that satisfies following conditions:
* Flag consists of three colors which correspond to letters 'R', 'G' and 'B'.
* Flag consists of three equal in width and height stripes, parralel... | instruction | 0 | 1,389 | 7 | 2,778 |
Tags: brute force, implementation
Correct Solution:
```
N, M = map(int, input().split())
flag = [input() for n in range(N)]
def get_rect_of_color(color):
rect_points = []
for i, row in enumerate(flag):
first = True
seq_is_broken = False
tmp = [None] * 4
for j, char in enumerate... | output | 1 | 1,389 | 7 | 2,779 |
Provide tags and a correct Python 3 solution for this coding contest problem.
The flag of Berland is such rectangular field n × m that satisfies following conditions:
* Flag consists of three colors which correspond to letters 'R', 'G' and 'B'.
* Flag consists of three equal in width and height stripes, parralel... | instruction | 0 | 1,390 | 7 | 2,780 |
Tags: brute force, implementation
Correct Solution:
```
n, m = list(map(int, input().split()))
res = max(n, m) >= 3
is_horo = True
is_vert = True
if res:
flag = []
for i in range(n):
r = input()
if len(r) != m:
res = False
break
flag.append(list(r))
px = f... | output | 1 | 1,390 | 7 | 2,781 |
Provide tags and a correct Python 3 solution for this coding contest problem.
The flag of Berland is such rectangular field n × m that satisfies following conditions:
* Flag consists of three colors which correspond to letters 'R', 'G' and 'B'.
* Flag consists of three equal in width and height stripes, parralel... | instruction | 0 | 1,391 | 7 | 2,782 |
Tags: brute force, implementation
Correct Solution:
```
#python 3.5.2
b, k = map(int, input().split())
arr = []
for i in range(b):
s = input()
arr.append(s)
x = arr[0][0]
nb = 1
nk = 1
pola = str(x)
while (nk < k and arr[0][nk] == x):
nk += 1
pola += x
if (nk == k or nk == k/3):
if (nk =... | output | 1 | 1,391 | 7 | 2,783 |
Provide tags and a correct Python 3 solution for this coding contest problem.
The flag of Berland is such rectangular field n × m that satisfies following conditions:
* Flag consists of three colors which correspond to letters 'R', 'G' and 'B'.
* Flag consists of three equal in width and height stripes, parralel... | instruction | 0 | 1,392 | 7 | 2,784 |
Tags: brute force, implementation
Correct Solution:
```
n, m = map(int, input().split())
s = [input() for _ in range(n)]
if n % 3 != 0 and m % 3 != 0:
print('NO')
exit()
flag = 0
if n % 3 == 0:
if not(s[0][0]!=s[n//3][0] and s[2*n//3][0]!=s[n//3][0] and s[2*n//3][0]!=s[0][0]):
flag=1
r, g, b ... | output | 1 | 1,392 | 7 | 2,785 |
Provide tags and a correct Python 3 solution for this coding contest problem.
The flag of Berland is such rectangular field n × m that satisfies following conditions:
* Flag consists of three colors which correspond to letters 'R', 'G' and 'B'.
* Flag consists of three equal in width and height stripes, parralel... | instruction | 0 | 1,393 | 7 | 2,786 |
Tags: brute force, implementation
Correct Solution:
```
import sys
#import random
from bisect import bisect_left as lb
from collections import deque
#sys.setrecursionlimit(10**8)
from queue import PriorityQueue as pq
from math import *
input_ = lambda: sys.stdin.readline().strip("\r\n")
ii = lambda : int(input_())
il =... | output | 1 | 1,393 | 7 | 2,787 |
Provide tags and a correct Python 3 solution for this coding contest problem.
The flag of Berland is such rectangular field n × m that satisfies following conditions:
* Flag consists of three colors which correspond to letters 'R', 'G' and 'B'.
* Flag consists of three equal in width and height stripes, parralel... | instruction | 0 | 1,394 | 7 | 2,788 |
Tags: brute force, implementation
Correct Solution:
```
def c(f, n, m):
if n % 3 != 0:return 0
s=n//3;s=f[0],f[s],f[2*s]
if set(s)!=set(map(lambda x:x*m,'RGB')):return 0
for i in range(n):
if f[i] != s[i*3 // n]:return 0
return 1
n,m=map(int, input().split())
f=[input() for _ in range(n)]
pr... | output | 1 | 1,394 | 7 | 2,789 |
Provide tags and a correct Python 3 solution for this coding contest problem.
The flag of Berland is such rectangular field n × m that satisfies following conditions:
* Flag consists of three colors which correspond to letters 'R', 'G' and 'B'.
* Flag consists of three equal in width and height stripes, parralel... | instruction | 0 | 1,395 | 7 | 2,790 |
Tags: brute force, implementation
Correct Solution:
```
import sys
#sys.stdin = open("input2","r")
n,m = map(int,input().split())
s = []
for i in range(n):
string = input()
s.append(string)
no = 0
# row mix check
r_mix = 0
for i in range(n):
cnt_r = s[i].count('R')
cnt_b = s[i].count('B')
cnt_g = s... | output | 1 | 1,395 | 7 | 2,791 |
Provide tags and a correct Python 3 solution for this coding contest problem.
The flag of Berland is such rectangular field n × m that satisfies following conditions:
* Flag consists of three colors which correspond to letters 'R', 'G' and 'B'.
* Flag consists of three equal in width and height stripes, parralel... | instruction | 0 | 1,396 | 7 | 2,792 |
Tags: brute force, implementation
Correct Solution:
```
[n,m] = [int(i) for i in input().split()]
flag = []
flip_flag = []
for i in range(m):
flip_flag.append([])
tmp = n
while tmp:
tmp -= 1
flag.append(list(input()))
for i in range(m):
flip_flag[i].append(flag[-1][i])
if len(set(flag[0])) != 1:
flag = f... | output | 1 | 1,396 | 7 | 2,793 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
The flag of Berland is such rectangular field n × m that satisfies following conditions:
* Flag consists of three colors which correspond to letters 'R', 'G' and 'B'.
* Flag consists of th... | instruction | 0 | 1,397 | 7 | 2,794 |
Yes | output | 1 | 1,397 | 7 | 2,795 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
The flag of Berland is such rectangular field n × m that satisfies following conditions:
* Flag consists of three colors which correspond to letters 'R', 'G' and 'B'.
* Flag consists of th... | instruction | 0 | 1,398 | 7 | 2,796 |
Yes | output | 1 | 1,398 | 7 | 2,797 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
The flag of Berland is such rectangular field n × m that satisfies following conditions:
* Flag consists of three colors which correspond to letters 'R', 'G' and 'B'.
* Flag consists of th... | instruction | 0 | 1,399 | 7 | 2,798 |
Yes | output | 1 | 1,399 | 7 | 2,799 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
The flag of Berland is such rectangular field n × m that satisfies following conditions:
* Flag consists of three colors which correspond to letters 'R', 'G' and 'B'.
* Flag consists of th... | instruction | 0 | 1,400 | 7 | 2,800 |
Yes | output | 1 | 1,400 | 7 | 2,801 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
The flag of Berland is such rectangular field n × m that satisfies following conditions:
* Flag consists of three colors which correspond to letters 'R', 'G' and 'B'.
* Flag consists of th... | instruction | 0 | 1,401 | 7 | 2,802 |
No | output | 1 | 1,401 | 7 | 2,803 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
The flag of Berland is such rectangular field n × m that satisfies following conditions:
* Flag consists of three colors which correspond to letters 'R', 'G' and 'B'.
* Flag consists of th... | instruction | 0 | 1,402 | 7 | 2,804 |
No | output | 1 | 1,402 | 7 | 2,805 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
The flag of Berland is such rectangular field n × m that satisfies following conditions:
* Flag consists of three colors which correspond to letters 'R', 'G' and 'B'.
* Flag consists of th... | instruction | 0 | 1,403 | 7 | 2,806 |
No | output | 1 | 1,403 | 7 | 2,807 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
The flag of Berland is such rectangular field n × m that satisfies following conditions:
* Flag consists of three colors which correspond to letters 'R', 'G' and 'B'.
* Flag consists of th... | instruction | 0 | 1,404 | 7 | 2,808 |
No | output | 1 | 1,404 | 7 | 2,809 |
Provide tags and a correct Python 3 solution for this coding contest problem.
You are given n integers. You need to choose a subset and put the chosen numbers in a beautiful rectangle (rectangular matrix). Each chosen number should occupy one of its rectangle cells, each cell must be filled with exactly one chosen num... | instruction | 0 | 2,595 | 7 | 5,190 |
Tags: brute force, combinatorics, constructive algorithms, data structures, greedy, math
Correct Solution:
```
def play(arr):
n = len(arr)
number2Count = {}
for p in arr:
number2Count[p] = number2Count.get(p, 0) + 1
count2Numbers = {}
maxCnt = 0
for num in number2Count:
cnt ... | output | 1 | 2,595 | 7 | 5,191 |
Provide a correct Python 3 solution for this coding contest problem.
You are given a grid of squares with H horizontal rows and W vertical columns, where each square is painted white or black. HW characters from A_{11} to A_{HW} represent the colors of the squares. A_{ij} is `#` if the square at the i-th row from the ... | instruction | 0 | 3,134 | 7 | 6,268 |
"Correct Solution:
```
INF=float("inf")
def main():
H,W=map(int, input().split())
A=[input()for _ in range(H)]
D=[[0 if A[h][w]=="#" else INF for w in range(W)] for h in range(H)]
for h in range(H):
for w in range(1,W):
D[h][w]=min(D[h][w],D[h][w-1]+1)
for w in range(W-2, -1,... | output | 1 | 3,134 | 7 | 6,269 |
Provide a correct Python 3 solution for this coding contest problem.
You are given a grid of squares with H horizontal rows and W vertical columns, where each square is painted white or black. HW characters from A_{11} to A_{HW} represent the colors of the squares. A_{ij} is `#` if the square at the i-th row from the ... | instruction | 0 | 3,135 | 7 | 6,270 |
"Correct Solution:
```
from collections import deque
h,w = map(int,input().split())
l = [list(input()) for i in range(h)]
dis = [[10000]*w for i in range(h)]
q = deque([])
for i in range(h):
for j in range(w):
if l[i][j] == "#":
q.append([i,j,0])
dis[i][j] = 0
dx = [0,0,1,-1]
dy =... | output | 1 | 3,135 | 7 | 6,271 |
Provide a correct Python 3 solution for this coding contest problem.
You are given a grid of squares with H horizontal rows and W vertical columns, where each square is painted white or black. HW characters from A_{11} to A_{HW} represent the colors of the squares. A_{ij} is `#` if the square at the i-th row from the ... | instruction | 0 | 3,136 | 7 | 6,272 |
"Correct Solution:
```
h,w = map(int,input().split())
a = list(list(input())for i in range(h))
stack = []
for i in range(h):
for j in range(w):
if a[i][j] == "#":
stack.append((i,j))
vec = ((1,0),(0,1),(-1,0),(0,-1))
move = 0
while stack:
next = []
move +=1
for y,x in stack:... | output | 1 | 3,136 | 7 | 6,273 |
Provide a correct Python 3 solution for this coding contest problem.
You are given a grid of squares with H horizontal rows and W vertical columns, where each square is painted white or black. HW characters from A_{11} to A_{HW} represent the colors of the squares. A_{ij} is `#` if the square at the i-th row from the ... | instruction | 0 | 3,137 | 7 | 6,274 |
"Correct Solution:
```
from collections import deque
h, w = map(int, input().split())
d = deque()
op = [[-1] * w for i in range(h)]
for i in range(h):
s = input().rstrip()
for j in range(len(s)):
if s[j] == '#':
d.append((i, j, 0))
op[i][j] = 0
while d:
i, j, step = d.pop... | output | 1 | 3,137 | 7 | 6,275 |
Provide a correct Python 3 solution for this coding contest problem.
You are given a grid of squares with H horizontal rows and W vertical columns, where each square is painted white or black. HW characters from A_{11} to A_{HW} represent the colors of the squares. A_{ij} is `#` if the square at the i-th row from the ... | instruction | 0 | 3,138 | 7 | 6,276 |
"Correct Solution:
```
from collections import deque
h, w = map(int, input().split())
a = [list(input()) for _ in range(h)]
q = deque([])
for i in range(h):
for j in range(w):
if a[i][j] == '#':
q.append([i, j])
q.append(0)
while q:
y, x = q.popleft()
ans = q.popleft() + 1... | output | 1 | 3,138 | 7 | 6,277 |
Provide a correct Python 3 solution for this coding contest problem.
You are given a grid of squares with H horizontal rows and W vertical columns, where each square is painted white or black. HW characters from A_{11} to A_{HW} represent the colors of the squares. A_{ij} is `#` if the square at the i-th row from the ... | instruction | 0 | 3,139 | 7 | 6,278 |
"Correct Solution:
```
from collections import deque
h, w = map(int, input().split())
A = [input() for _ in range(h)]
dist = [[-1]*w for _ in range(h)]
di = [1, 0, -1, 0]
dj = [0, 1, 0, -1]
que = deque()
for i in range(h):
for j in range(w):
if A[i][j] == "#":
que.append((i, j))
dist[i][j] = 0
while q... | output | 1 | 3,139 | 7 | 6,279 |
Provide a correct Python 3 solution for this coding contest problem.
You are given a grid of squares with H horizontal rows and W vertical columns, where each square is painted white or black. HW characters from A_{11} to A_{HW} represent the colors of the squares. A_{ij} is `#` if the square at the i-th row from the ... | instruction | 0 | 3,140 | 7 | 6,280 |
"Correct Solution:
```
h,w=map(int,input().split())
G=[input() for _ in range(h)]
from collections import deque
move=[(0,1),(0,-1),(1,0),(-1,0)]
que=deque([])
for i in range(h):
for j in range(w):
if G[i][j]=='#':
que.append((i,j,0))
c=0
visit=[[0]*w for _ in range(h)]
while len(que)>0:
... | output | 1 | 3,140 | 7 | 6,281 |
Provide a correct Python 3 solution for this coding contest problem.
You are given a grid of squares with H horizontal rows and W vertical columns, where each square is painted white or black. HW characters from A_{11} to A_{HW} represent the colors of the squares. A_{ij} is `#` if the square at the i-th row from the ... | instruction | 0 | 3,141 | 7 | 6,282 |
"Correct Solution:
```
from collections import deque
H,W = map(int, input().split())
A = 0
dp = [None] * H
mat = deque()
for h in range(H):
s = list(input())
for w, x in zip(range(W), s):
if x == "#":
mat.append((h, w, 0))
dp[h] = s
while len(mat):
h, w, cnt = mat.popleft()
for... | output | 1 | 3,141 | 7 | 6,283 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You are given a grid of squares with H horizontal rows and W vertical columns, where each square is painted white or black. HW characters from A_{11} to A_{HW} represent the colors of the square... | instruction | 0 | 3,142 | 7 | 6,284 |
Yes | output | 1 | 3,142 | 7 | 6,285 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You are given a grid of squares with H horizontal rows and W vertical columns, where each square is painted white or black. HW characters from A_{11} to A_{HW} represent the colors of the square... | instruction | 0 | 3,143 | 7 | 6,286 |
Yes | output | 1 | 3,143 | 7 | 6,287 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.