message stringlengths 2 19.9k | message_type stringclasses 2
values | message_id int64 0 1 | conversation_id int64 322 108k | cluster float64 15 15 | __index_level_0__ int64 644 217k |
|---|---|---|---|---|---|
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
This is an interactive problem.
Omkar has just come across a duck! The duck is walking on a grid with n rows and n columns (2 ≤ n ≤ 25) so that the grid contains a total of n^2 cells. Let's den... | instruction | 0 | 103,068 | 15 | 206,136 |
No | output | 1 | 103,068 | 15 | 206,137 |
Provide a correct Python 3 solution for this coding contest problem.
Masa Kita, who entered the University of Tokyo, joined a circle called TSG (University of Tokyo Super Gamers).
This circle exhibits games at the Komaba Festival every year, and Masa Kita decided to create and display the games as well.
The game cre... | instruction | 0 | 103,623 | 15 | 207,246 |
"Correct Solution:
```
def kesu(x, s, c, h):
global n
if (x[0] - 1, x[1]) not in s and a[x[0] - 1][x[1]] == c:
s.add((x[0] - 1, x[1]))
kesu((x[0] - 1, x[1]), s, c, h + 1)
if (x[0] + 1, x[1]) not in s and a[x[0] + 1][x[1]] == c:
s.add((x[0] + 1, x[1]))
kesu((x[0] + 1, x[1]), ... | output | 1 | 103,623 | 15 | 207,247 |
Provide a correct Python 3 solution for this coding contest problem.
Masa Kita, who entered the University of Tokyo, joined a circle called TSG (University of Tokyo Super Gamers).
This circle exhibits games at the Komaba Festival every year, and Masa Kita decided to create and display the games as well.
The game cre... | instruction | 0 | 103,624 | 15 | 207,248 |
"Correct Solution:
```
t = int(input())
vec = ((1, 0), (0, -1), (-1, 0), (0, 1))
for _ in range(t):
def check(x, y, lst, checked):
checked[y][x] = False
color = mp[y][x]
for dx, dy in vec:
nx, ny = x + dx, y + dy
if color == mp[ny][nx] and checked[ny][nx] == None:
lst.append((nx, ny))
... | output | 1 | 103,624 | 15 | 207,249 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Masa Kita, who entered the University of Tokyo, joined a circle called TSG (University of Tokyo Super Gamers).
This circle exhibits games at the Komaba Festival every year, and Masa Kita decide... | instruction | 0 | 103,625 | 15 | 207,250 |
No | output | 1 | 103,625 | 15 | 207,251 |
Provide a correct Python 3 solution for this coding contest problem.
Falling Block Puzzle
Block drop
You are playing a falling block puzzle. As shown in the figure below, the field of this puzzle has a shape in which cubic cells are arranged in 2 squares x 2 squares in each row, and the rows are infinitely arranged ... | instruction | 0 | 103,628 | 15 | 207,256 |
"Correct Solution:
```
#!usr/bin/env python3
from collections import defaultdict
from collections import deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
def LI(): return list(map(int, sys.stdin.readline().split()))
def I(): return int(sys.stdin.readline())
def LS():return li... | output | 1 | 103,628 | 15 | 207,257 |
Provide a correct Python 3 solution for this coding contest problem.
Falling Block Puzzle
Block drop
You are playing a falling block puzzle. As shown in the figure below, the field of this puzzle has a shape in which cubic cells are arranged in 2 squares x 2 squares in each row, and the rows are infinitely arranged ... | instruction | 0 | 103,629 | 15 | 207,258 |
"Correct Solution:
```
import sys
readline = sys.stdin.readline
write = sys.stdout.write
def solve():
H, N = map(int, readline().split())
if H == N == 0:
return False
def get_block():
s = readline().strip()
v = (s[0] == '#') + (s[1] == '#')*2
s = readline().strip()
v ... | output | 1 | 103,629 | 15 | 207,259 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Falling Block Puzzle
Block drop
You are playing a falling block puzzle. As shown in the figure below, the field of this puzzle has a shape in which cubic cells are arranged in 2 squares x 2 sq... | instruction | 0 | 103,630 | 15 | 207,260 |
No | output | 1 | 103,630 | 15 | 207,261 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Falling Block Puzzle
Block drop
You are playing a falling block puzzle. As shown in the figure below, the field of this puzzle has a shape in which cubic cells are arranged in 2 squares x 2 sq... | instruction | 0 | 103,631 | 15 | 207,262 |
No | output | 1 | 103,631 | 15 | 207,263 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Falling Block Puzzle
Block drop
You are playing a falling block puzzle. As shown in the figure below, the field of this puzzle has a shape in which cubic cells are arranged in 2 squares x 2 sq... | instruction | 0 | 103,632 | 15 | 207,264 |
No | output | 1 | 103,632 | 15 | 207,265 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Falling Block Puzzle
Block drop
You are playing a falling block puzzle. As shown in the figure below, the field of this puzzle has a shape in which cubic cells are arranged in 2 squares x 2 sq... | instruction | 0 | 103,633 | 15 | 207,266 |
No | output | 1 | 103,633 | 15 | 207,267 |
Provide tags and a correct Python 3 solution for this coding contest problem.
You are given an infinite checkered field. You should get from a square (x1; y1) to a square (x2; y2). Using the shortest path is not necessary. You can move on the field squares in four directions. That is, when you are positioned in any sq... | instruction | 0 | 103,805 | 15 | 207,610 |
Tags: math
Correct Solution:
```
a,b,x1,y1,x2,y2 = map(int,input().split())
a1 = x1+y1
a2 = x2+y2
b1 = x1-y1
b2 = x2-y2
ad = a2//(2*a) - a1//(2*a)
bd = b2//(2*b) - b1//(2*b)
print(max(abs(ad),abs(bd)))
``` | output | 1 | 103,805 | 15 | 207,611 |
Provide tags and a correct Python 3 solution for this coding contest problem.
You are given an infinite checkered field. You should get from a square (x1; y1) to a square (x2; y2). Using the shortest path is not necessary. You can move on the field squares in four directions. That is, when you are positioned in any sq... | instruction | 0 | 103,806 | 15 | 207,612 |
Tags: math
Correct Solution:
```
a, b, x1, y1, x2, y2 = map(int, input().split())
X1, Y1 = x1 + y1, x1 - y1
X2, Y2 = x2 + y2, x2 - y2
A, B = 2 * a, 2 * b
def solve(x, y, z):
if x >= 0 > y or x < 0 <= y:
x = max(x, -x)
y = max(y, -y)
tmp = x // z - (x % z == 0) + y // z - (y % z == 0) + 1
... | output | 1 | 103,806 | 15 | 207,613 |
Provide tags and a correct Python 3 solution for this coding contest problem.
You are given an infinite checkered field. You should get from a square (x1; y1) to a square (x2; y2). Using the shortest path is not necessary. You can move on the field squares in four directions. That is, when you are positioned in any sq... | instruction | 0 | 103,807 | 15 | 207,614 |
Tags: math
Correct Solution:
```
a,b,x1,y1,x2,y2 = map(int,input().split())
s = abs((x1 + y1) // (2 * a) - (x2 + y2) // (2 * a))
s = max(s,abs((x1 - y1) // (2 * b) - (x2 - y2) // (2 * b)))
print(s)
``` | output | 1 | 103,807 | 15 | 207,615 |
Provide tags and a correct Python 3 solution for this coding contest problem.
You are given an infinite checkered field. You should get from a square (x1; y1) to a square (x2; y2). Using the shortest path is not necessary. You can move on the field squares in four directions. That is, when you are positioned in any sq... | instruction | 0 | 103,808 | 15 | 207,616 |
Tags: math
Correct Solution:
```
a, b, x_1, y_1, x_2, y_2 = map(int, input().split())
a_b, a_e = (x_2 + y_2), (x_1 + y_1)
b_b, b_e = (x_2 - y_2), (x_1 - y_1)
if a_b > a_e:
a_b, a_e = a_e, a_b
if b_b > b_e:
b_b, b_e = b_e, b_b
if a_b % (2 * a) != 0:
a_b = (a_b // (2 * a) + 1) * (2 * a)
a_result, b_res... | output | 1 | 103,808 | 15 | 207,617 |
Provide tags and a correct Python 3 solution for this coding contest problem.
You are given an infinite checkered field. You should get from a square (x1; y1) to a square (x2; y2). Using the shortest path is not necessary. You can move on the field squares in four directions. That is, when you are positioned in any sq... | instruction | 0 | 103,809 | 15 | 207,618 |
Tags: math
Correct Solution:
```
a, b, x1, y1, x2, y2 = map(int, input().split())
X1, Y1 = x1 + y1, x1 - y1
X2, Y2 = x2 + y2, x2 - y2
A, B = 2 * a, 2 * b
def solve(x, y, z):
if x >= 0 > y or x < 0 <= y:
x = max(x, -x)
y = max(y, -y)
tmp = x // z + y // z + 1
return tmp
else:
... | output | 1 | 103,809 | 15 | 207,619 |
Provide tags and a correct Python 3 solution for this coding contest problem.
You are given an infinite checkered field. You should get from a square (x1; y1) to a square (x2; y2). Using the shortest path is not necessary. You can move on the field squares in four directions. That is, when you are positioned in any sq... | instruction | 0 | 103,810 | 15 | 207,620 |
Tags: math
Correct Solution:
```
#!/usr/bin/python3
def cds(a, b, x, y):
return (x + y) // (2 * a), (x - y) // (2 * b)
def norm(x, y):
return max(x, y)
a, b, x1, y1, x2, y2 = map(int, input().split())
xp1, yp1 = cds(a, b, x1, y1)
xp2, yp2 = cds(a, b, x2, y2)
print(norm(abs(xp1 - xp2), abs(yp1 - yp2)))
``` | output | 1 | 103,810 | 15 | 207,621 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You are given an infinite checkered field. You should get from a square (x1; y1) to a square (x2; y2). Using the shortest path is not necessary. You can move on the field squares in four directi... | instruction | 0 | 103,811 | 15 | 207,622 |
No | output | 1 | 103,811 | 15 | 207,623 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You are given an infinite checkered field. You should get from a square (x1; y1) to a square (x2; y2). Using the shortest path is not necessary. You can move on the field squares in four directi... | instruction | 0 | 103,812 | 15 | 207,624 |
No | output | 1 | 103,812 | 15 | 207,625 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You are given an infinite checkered field. You should get from a square (x1; y1) to a square (x2; y2). Using the shortest path is not necessary. You can move on the field squares in four directi... | instruction | 0 | 103,813 | 15 | 207,626 |
No | output | 1 | 103,813 | 15 | 207,627 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You are given an infinite checkered field. You should get from a square (x1; y1) to a square (x2; y2). Using the shortest path is not necessary. You can move on the field squares in four directi... | instruction | 0 | 103,814 | 15 | 207,628 |
No | output | 1 | 103,814 | 15 | 207,629 |
Provide tags and a correct Python 3 solution for this coding contest problem.
There are n robbers at coordinates (a_1, b_1), (a_2, b_2), ..., (a_n, b_n) and m searchlight at coordinates (c_1, d_1), (c_2, d_2), ..., (c_m, d_m).
In one move you can move each robber to the right (increase a_i of each robber by one) or ... | instruction | 0 | 103,867 | 15 | 207,734 |
Tags: binary search, brute force, data structures, dp, implementation, sortings, two pointers
Correct Solution:
```
'''Author- Akshit Monga'''
from sys import stdin,stdout
input=stdin.readline
n,m=map(int,input().split())
a=[]
b=[]
for _ in range(n):
x,y=map(int,input().split())
a.append((x,y))
for _ in range(m... | output | 1 | 103,867 | 15 | 207,735 |
Provide tags and a correct Python 3 solution for this coding contest problem.
There are n robbers at coordinates (a_1, b_1), (a_2, b_2), ..., (a_n, b_n) and m searchlight at coordinates (c_1, d_1), (c_2, d_2), ..., (c_m, d_m).
In one move you can move each robber to the right (increase a_i of each robber by one) or ... | instruction | 0 | 103,868 | 15 | 207,736 |
Tags: binary search, brute force, data structures, dp, implementation, sortings, two pointers
Correct Solution:
```
n, m = map(int, input().split())
robbers = []
lights = []
for i in range(n):
a, b = map(int, input().split())
robbers.append((a, b))
for i in range(m):
c, d = map(int, input().split())
... | output | 1 | 103,868 | 15 | 207,737 |
Provide tags and a correct Python 3 solution for this coding contest problem.
There are n robbers at coordinates (a_1, b_1), (a_2, b_2), ..., (a_n, b_n) and m searchlight at coordinates (c_1, d_1), (c_2, d_2), ..., (c_m, d_m).
In one move you can move each robber to the right (increase a_i of each robber by one) or ... | instruction | 0 | 103,869 | 15 | 207,738 |
Tags: binary search, brute force, data structures, dp, implementation, sortings, two pointers
Correct Solution:
```
n, m = map(int, input().split())
g = []
c = []
for i in range(n):
x, y = map(int, input().split())
g.append((x, y))
for i in range(m):
x, y = map(int, input().split())
c.append((x, y))
g.s... | output | 1 | 103,869 | 15 | 207,739 |
Provide tags and a correct Python 3 solution for this coding contest problem.
There are n robbers at coordinates (a_1, b_1), (a_2, b_2), ..., (a_n, b_n) and m searchlight at coordinates (c_1, d_1), (c_2, d_2), ..., (c_m, d_m).
In one move you can move each robber to the right (increase a_i of each robber by one) or ... | instruction | 0 | 103,870 | 15 | 207,740 |
Tags: binary search, brute force, data structures, dp, implementation, sortings, two pointers
Correct Solution:
```
import sys,math
from collections import Counter,deque,defaultdict
from bisect import bisect_left,bisect_right
mod = 10**9+7
INF = float('inf')
def inp(): return int(sys.stdin.readline())
def inpl(): retu... | output | 1 | 103,870 | 15 | 207,741 |
Provide tags and a correct Python 3 solution for this coding contest problem.
There are n robbers at coordinates (a_1, b_1), (a_2, b_2), ..., (a_n, b_n) and m searchlight at coordinates (c_1, d_1), (c_2, d_2), ..., (c_m, d_m).
In one move you can move each robber to the right (increase a_i of each robber by one) or ... | instruction | 0 | 103,871 | 15 | 207,742 |
Tags: binary search, brute force, data structures, dp, implementation, sortings, two pointers
Correct Solution:
```
'''Author- Akshit Monga'''
from sys import stdin,stdout
input=stdin.readline
n,m=map(int,input().split())
a=[]
b=[]
for _ in range(n):
x,y=map(int,input().split())
a.append((x,y))
for _ in range(m... | output | 1 | 103,871 | 15 | 207,743 |
Provide tags and a correct Python 3 solution for this coding contest problem.
There are n robbers at coordinates (a_1, b_1), (a_2, b_2), ..., (a_n, b_n) and m searchlight at coordinates (c_1, d_1), (c_2, d_2), ..., (c_m, d_m).
In one move you can move each robber to the right (increase a_i of each robber by one) or ... | instruction | 0 | 103,872 | 15 | 207,744 |
Tags: binary search, brute force, data structures, dp, implementation, sortings, two pointers
Correct Solution:
```
#1800 practice
n, m = map(int, input().split())
robs = [tuple(map(int, input().split())) for i in range(n)]
light = [tuple(map(int, input().split())) for i in range(m)]
limitation = [0]*(10**6+10)
for i i... | output | 1 | 103,872 | 15 | 207,745 |
Provide tags and a correct Python 3 solution for this coding contest problem.
There are n robbers at coordinates (a_1, b_1), (a_2, b_2), ..., (a_n, b_n) and m searchlight at coordinates (c_1, d_1), (c_2, d_2), ..., (c_m, d_m).
In one move you can move each robber to the right (increase a_i of each robber by one) or ... | instruction | 0 | 103,873 | 15 | 207,746 |
Tags: binary search, brute force, data structures, dp, implementation, sortings, two pointers
Correct Solution:
```
# region fastio # from https://codeforces.com/contest/1333/submission/75948789
import sys, io, os
BUFSIZE = 8192
class FastIO(io.IOBase):
newlines = 0
def __init__(self, file):
self._... | output | 1 | 103,873 | 15 | 207,747 |
Provide tags and a correct Python 3 solution for this coding contest problem.
There are n robbers at coordinates (a_1, b_1), (a_2, b_2), ..., (a_n, b_n) and m searchlight at coordinates (c_1, d_1), (c_2, d_2), ..., (c_m, d_m).
In one move you can move each robber to the right (increase a_i of each robber by one) or ... | instruction | 0 | 103,874 | 15 | 207,748 |
Tags: binary search, brute force, data structures, dp, implementation, sortings, two pointers
Correct Solution:
```
from sys import stdin, stdout
def search_lights(n, m, ab, cd):
y_a = [0] * (10**6 + 1)
for i in range(n):
for j in range(m):
if ab[i][0] > cd[j][0] or ab[i][1] > cd[j][1]:
... | output | 1 | 103,874 | 15 | 207,749 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
There are n robbers at coordinates (a_1, b_1), (a_2, b_2), ..., (a_n, b_n) and m searchlight at coordinates (c_1, d_1), (c_2, d_2), ..., (c_m, d_m).
In one move you can move each robber to the... | instruction | 0 | 103,875 | 15 | 207,750 |
Yes | output | 1 | 103,875 | 15 | 207,751 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
There are n robbers at coordinates (a_1, b_1), (a_2, b_2), ..., (a_n, b_n) and m searchlight at coordinates (c_1, d_1), (c_2, d_2), ..., (c_m, d_m).
In one move you can move each robber to the... | instruction | 0 | 103,876 | 15 | 207,752 |
Yes | output | 1 | 103,876 | 15 | 207,753 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
There are n robbers at coordinates (a_1, b_1), (a_2, b_2), ..., (a_n, b_n) and m searchlight at coordinates (c_1, d_1), (c_2, d_2), ..., (c_m, d_m).
In one move you can move each robber to the... | instruction | 0 | 103,877 | 15 | 207,754 |
Yes | output | 1 | 103,877 | 15 | 207,755 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
There are n robbers at coordinates (a_1, b_1), (a_2, b_2), ..., (a_n, b_n) and m searchlight at coordinates (c_1, d_1), (c_2, d_2), ..., (c_m, d_m).
In one move you can move each robber to the... | instruction | 0 | 103,878 | 15 | 207,756 |
Yes | output | 1 | 103,878 | 15 | 207,757 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
There are n robbers at coordinates (a_1, b_1), (a_2, b_2), ..., (a_n, b_n) and m searchlight at coordinates (c_1, d_1), (c_2, d_2), ..., (c_m, d_m).
In one move you can move each robber to the... | instruction | 0 | 103,879 | 15 | 207,758 |
No | output | 1 | 103,879 | 15 | 207,759 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
There are n robbers at coordinates (a_1, b_1), (a_2, b_2), ..., (a_n, b_n) and m searchlight at coordinates (c_1, d_1), (c_2, d_2), ..., (c_m, d_m).
In one move you can move each robber to the... | instruction | 0 | 103,880 | 15 | 207,760 |
No | output | 1 | 103,880 | 15 | 207,761 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
There are n robbers at coordinates (a_1, b_1), (a_2, b_2), ..., (a_n, b_n) and m searchlight at coordinates (c_1, d_1), (c_2, d_2), ..., (c_m, d_m).
In one move you can move each robber to the... | instruction | 0 | 103,881 | 15 | 207,762 |
No | output | 1 | 103,881 | 15 | 207,763 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
There are n robbers at coordinates (a_1, b_1), (a_2, b_2), ..., (a_n, b_n) and m searchlight at coordinates (c_1, d_1), (c_2, d_2), ..., (c_m, d_m).
In one move you can move each robber to the... | instruction | 0 | 103,882 | 15 | 207,764 |
No | output | 1 | 103,882 | 15 | 207,765 |
Provide tags and a correct Python 3 solution for this coding contest problem.
In this problem at each moment you have a set of intervals. You can move from interval (a, b) from our set to interval (c, d) from our set if and only if c < a < d or c < b < d. Also there is a path from interval I1 from our set to interval ... | instruction | 0 | 103,982 | 15 | 207,964 |
Tags: data structures
Correct Solution:
```
def dfs(G, start, target, path_exists):
s = [start]
visited = set([])
# if not start in path_exists:
# path_exists[start] = set([])
while(s):
node = s.pop()
if not node in visited:
visited.add(node)
# path_exist... | output | 1 | 103,982 | 15 | 207,965 |
Provide tags and a correct Python 3 solution for this coding contest problem.
In this problem at each moment you have a set of intervals. You can move from interval (a, b) from our set to interval (c, d) from our set if and only if c < a < d or c < b < d. Also there is a path from interval I1 from our set to interval ... | instruction | 0 | 103,984 | 15 | 207,968 |
Tags: data structures
Correct Solution:
```
from sys import stdin,stdout
from collections import defaultdict
nmbr=lambda:int(stdin.readline())
lst = lambda: list(map(int, input().split()))
def dfs(src,des):
global f
vis[src]=1
if src==des:
f=1
return
for neigh in g[src]:
if not v... | output | 1 | 103,984 | 15 | 207,969 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
In this problem at each moment you have a set of intervals. You can move from interval (a, b) from our set to interval (c, d) from our set if and only if c < a < d or c < b < d. Also there is a ... | instruction | 0 | 103,996 | 15 | 207,992 |
No | output | 1 | 103,996 | 15 | 207,993 |
Provide tags and a correct Python 3 solution for this coding contest problem.
A monopole magnet is a magnet that only has one pole, either north or south. They don't actually exist since real magnets have two poles, but this is a programming contest problem, so we don't care.
There is an n× m grid. Initially, you may... | instruction | 0 | 104,587 | 15 | 209,174 |
Tags: constructive algorithms, dfs and similar, dsu, graphs
Correct Solution:
```
import sys
from sys import stdin
from collections import defaultdict
import bisect
import re
def eprint(*args, **kwargs):
print(*args, file=sys.stderr, **kwargs)
def inputs(f=int):
return list(map(f, stdin.readline().strip().s... | output | 1 | 104,587 | 15 | 209,175 |
Provide tags and a correct Python 3 solution for this coding contest problem.
A monopole magnet is a magnet that only has one pole, either north or south. They don't actually exist since real magnets have two poles, but this is a programming contest problem, so we don't care.
There is an n× m grid. Initially, you may... | instruction | 0 | 104,588 | 15 | 209,176 |
Tags: constructive algorithms, dfs and similar, dsu, graphs
Correct Solution:
```
import sys
readline = sys.stdin.readline
H, W = map(int, readline().split())
G = [[1 if s == '#' else 0 for s in readline().strip()] for _ in range(H)]
DIREC = [(0, 1), (1, 0), (-1, 0), (0, -1)]
def calc():
zh = 0
for i in... | output | 1 | 104,588 | 15 | 209,177 |
Provide tags and a correct Python 3 solution for this coding contest problem.
A monopole magnet is a magnet that only has one pole, either north or south. They don't actually exist since real magnets have two poles, but this is a programming contest problem, so we don't care.
There is an n× m grid. Initially, you may... | instruction | 0 | 104,589 | 15 | 209,178 |
Tags: constructive algorithms, dfs and similar, dsu, graphs
Correct Solution:
```
# Author: Uday Gupta
def make_reachable(x, y):
stack = []
stack.append((x, y))
while len(stack):
s = stack[-1]
stack.pop()
i = s[0]
j = s[1]
if reachable_table[i][j] == 0:
... | output | 1 | 104,589 | 15 | 209,179 |
Provide tags and a correct Python 3 solution for this coding contest problem.
A monopole magnet is a magnet that only has one pole, either north or south. They don't actually exist since real magnets have two poles, but this is a programming contest problem, so we don't care.
There is an n× m grid. Initially, you may... | instruction | 0 | 104,590 | 15 | 209,180 |
Tags: constructive algorithms, dfs and similar, dsu, graphs
Correct Solution:
```
h, w = map(int, input().split())
b = [list(input()) for _ in range(h)]
cnt_mx = 0
all_white_row = 0
for hi in range(h):
prev = "."
cnt = 0
for wi in range(w):
if b[hi][wi] != prev:
cnt += 1
prev = ... | output | 1 | 104,590 | 15 | 209,181 |
Provide tags and a correct Python 3 solution for this coding contest problem.
A monopole magnet is a magnet that only has one pole, either north or south. They don't actually exist since real magnets have two poles, but this is a programming contest problem, so we don't care.
There is an n× m grid. Initially, you may... | instruction | 0 | 104,591 | 15 | 209,182 |
Tags: constructive algorithms, dfs and similar, dsu, graphs
Correct Solution:
```
import sys
import math
from collections import deque
input = sys.stdin.buffer.readline
def BFS(x,y):
q = deque()
q.append([x,y])
visited[x][y] = 1
while len(q)>0:
x,y = q.popleft()
if graph[min(x+1,n-1)][y] =='#' and visited[m... | output | 1 | 104,591 | 15 | 209,183 |
Provide tags and a correct Python 3 solution for this coding contest problem.
A monopole magnet is a magnet that only has one pole, either north or south. They don't actually exist since real magnets have two poles, but this is a programming contest problem, so we don't care.
There is an n× m grid. Initially, you may... | instruction | 0 | 104,592 | 15 | 209,184 |
Tags: constructive algorithms, dfs and similar, dsu, graphs
Correct Solution:
```
from collections import deque
def valid() :
#check rows
rows = 0
cols = 0
for r in adj :
white = False
black = False
for col in r :
if(col == '#' and white and black) : return False
... | output | 1 | 104,592 | 15 | 209,185 |
Provide tags and a correct Python 3 solution for this coding contest problem.
A monopole magnet is a magnet that only has one pole, either north or south. They don't actually exist since real magnets have two poles, but this is a programming contest problem, so we don't care.
There is an n× m grid. Initially, you may... | instruction | 0 | 104,593 | 15 | 209,186 |
Tags: constructive algorithms, dfs and similar, dsu, graphs
Correct Solution:
```
from collections import deque
def BFS(graph, i, j, n, m):
Q = deque([])
vis = set()
vis.add((i, j))
Q.append((i, j))
neigh = [(1, 0), (-1, 0), (0, 1), (0, -1)]
while len(Q):
curr = Q.popleft()
i = curr[0]; j = curr[1]
graph[... | output | 1 | 104,593 | 15 | 209,187 |
Provide tags and a correct Python 3 solution for this coding contest problem.
A monopole magnet is a magnet that only has one pole, either north or south. They don't actually exist since real magnets have two poles, but this is a programming contest problem, so we don't care.
There is an n× m grid. Initially, you may... | instruction | 0 | 104,594 | 15 | 209,188 |
Tags: constructive algorithms, dfs and similar, dsu, graphs
Correct Solution:
```
class UnionFind:
def __init__(self, n):
self.parent = list(range(n))
def find(self, a): #return parent of a. a and b are in same set if they have same parent
acopy = a
while a != self.parent[a]:
... | output | 1 | 104,594 | 15 | 209,189 |
Provide tags and a correct Python 2 solution for this coding contest problem.
A monopole magnet is a magnet that only has one pole, either north or south. They don't actually exist since real magnets have two poles, but this is a programming contest problem, so we don't care.
There is an n× m grid. Initially, you may... | instruction | 0 | 104,595 | 15 | 209,190 |
Tags: constructive algorithms, dfs and similar, dsu, graphs
Correct Solution:
```
from sys import stdin, stdout
from collections import Counter, defaultdict
from itertools import permutations, combinations
raw_input = stdin.readline
pr = stdout.write
def fun(x):
return 1*(x=='#')
def in_num():
return int(raw_... | output | 1 | 104,595 | 15 | 209,191 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
A monopole magnet is a magnet that only has one pole, either north or south. They don't actually exist since real magnets have two poles, but this is a programming contest problem, so we don't c... | instruction | 0 | 104,596 | 15 | 209,192 |
Yes | output | 1 | 104,596 | 15 | 209,193 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
A monopole magnet is a magnet that only has one pole, either north or south. They don't actually exist since real magnets have two poles, but this is a programming contest problem, so we don't c... | instruction | 0 | 104,597 | 15 | 209,194 |
Yes | output | 1 | 104,597 | 15 | 209,195 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.