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 |
|---|---|---|---|---|---|
Provide tags and a correct Python 3 solution for this coding contest problem.
Om Nom really likes candies and doesn't like spiders as they frequently steal candies. One day Om Nom fancied a walk in a park. Unfortunately, the park has some spiders and Om Nom doesn't want to see them at all.
<image>
The park can be re... | instruction | 0 | 7,010 | 15 | 14,020 |
Tags: implementation, math
Correct Solution:
```
class CodeforcesTask436BSolution:
def __init__(self):
self.result = ''
self.n_m_k = []
self.field = []
def read_input(self):
self.n_m_k = [int(x) for x in input().split(" ")]
for x in range(self.n_m_k[0]):
self... | output | 1 | 7,010 | 15 | 14,021 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Om Nom really likes candies and doesn't like spiders as they frequently steal candies. One day Om Nom fancied a walk in a park. Unfortunately, the park has some spiders and Om Nom doesn't want to see them at all.
<image>
The park can be re... | instruction | 0 | 7,011 | 15 | 14,022 |
Tags: implementation, math
Correct Solution:
```
# -*- coding: utf-8 -*-
import sys
f = sys.stdin
n, m, k = map(int, f.readline().strip().split())
s = f.readline().strip()
sp = [0]*m
for i in range(1, n):
s = f.readline().strip()
for l in range(m):
if s[l]=='U':
if i % 2 == 0:
... | output | 1 | 7,011 | 15 | 14,023 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Om Nom really likes candies and doesn't like spiders as they frequently steal candies. One day Om Nom fancied a walk in a park. Unfortunately, the park has some spiders and Om Nom doesn't want to see them at all.
<image>
The park can be re... | instruction | 0 | 7,012 | 15 | 14,024 |
Tags: implementation, math
Correct Solution:
```
def f():
n, m, k = map(int, input().split())
s = []
a = []
for i in range(n):
s.append(input())
for j in range(m):
ans = 0
for i in range(n):
if i + i < n and s[i + i][j] == 'U':
ans += 1
... | output | 1 | 7,012 | 15 | 14,025 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Om Nom really likes candies and doesn't like spiders as they frequently steal candies. One day Om Nom fancied a walk in a park. Unfortunately, the park has some spiders and Om Nom doesn't want to see them at all.
<image>
The park can be re... | instruction | 0 | 7,013 | 15 | 14,026 |
Tags: implementation, math
Correct Solution:
```
n, m, k = map(int, input().split())
field = []
counts = []
for j in range(m):
counts.append(0)
for i in range(n):
row = list(input())
field.append(row)
for i in range(n):
for j in range(m):
if field[i][j] == "L":
jth = j - i
if jth >= 0:
... | output | 1 | 7,013 | 15 | 14,027 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Om Nom really likes candies and doesn't like spiders as they frequently steal candies. One day Om Nom fancied a walk in a park. Unfortunately, the park has some spiders and Om Nom doesn't want to see them at all.
<image>
The park can be re... | instruction | 0 | 7,014 | 15 | 14,028 |
Tags: implementation, math
Correct Solution:
```
#!/usr/bin/python
import re
import inspect
from sys import argv, exit
def rstr():
return input()
def rint():
return int(input())
def rints(splitchar=' '):
return [int(i) for i in input().split(splitchar)]
def varnames(obj, namespace=globals()):
return... | output | 1 | 7,014 | 15 | 14,029 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Om Nom really likes candies and doesn't like spiders as they frequently steal candies. One day Om Nom fancied a walk in a park. Unfortunately, the park has some spiders and Om Nom doesn't want to see them at all.
<image>
The park can be re... | instruction | 0 | 7,015 | 15 | 14,030 |
Tags: implementation, math
Correct Solution:
```
def solve():
answer = [0] * m
for i in range(1, n):
for j in range(m):
if j - i >= 0:
if park[i][j - i] == 'R':
answer[j] += 1
if j + i < m:
if park[i][j + i] == 'L':
... | output | 1 | 7,015 | 15 | 14,031 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Om Nom really likes candies and doesn't like spiders as they frequently steal candies. One day Om Nom fancied a walk in a park. Unfortunately, the park has some spiders and Om Nom doesn't want to see them at all.
<image>
The park can be re... | instruction | 0 | 7,016 | 15 | 14,032 |
Tags: implementation, math
Correct Solution:
```
n, m, k = map(int, str.split(input()))
f = tuple(map(lambda _: str.strip(input()), range(n)))
r = []
for x in range(m):
cr = sum(map(lambda y: f[y][x] == "U", range(0, n, 2)))
for cx in range(max(0, x + 1 - n), x):
cr += f[x - cx][cx] == "R"
for c... | output | 1 | 7,016 | 15 | 14,033 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Om Nom really likes candies and doesn't like spiders as they frequently steal candies. One day Om Nom fancied a walk in a park. Unfortunately, the park has some spiders and Om Nom doesn't want t... | instruction | 0 | 7,017 | 15 | 14,034 |
Yes | output | 1 | 7,017 | 15 | 14,035 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Om Nom really likes candies and doesn't like spiders as they frequently steal candies. One day Om Nom fancied a walk in a park. Unfortunately, the park has some spiders and Om Nom doesn't want t... | instruction | 0 | 7,018 | 15 | 14,036 |
Yes | output | 1 | 7,018 | 15 | 14,037 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Om Nom really likes candies and doesn't like spiders as they frequently steal candies. One day Om Nom fancied a walk in a park. Unfortunately, the park has some spiders and Om Nom doesn't want t... | instruction | 0 | 7,019 | 15 | 14,038 |
Yes | output | 1 | 7,019 | 15 | 14,039 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Om Nom really likes candies and doesn't like spiders as they frequently steal candies. One day Om Nom fancied a walk in a park. Unfortunately, the park has some spiders and Om Nom doesn't want t... | instruction | 0 | 7,020 | 15 | 14,040 |
Yes | output | 1 | 7,020 | 15 | 14,041 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Om Nom really likes candies and doesn't like spiders as they frequently steal candies. One day Om Nom fancied a walk in a park. Unfortunately, the park has some spiders and Om Nom doesn't want t... | instruction | 0 | 7,021 | 15 | 14,042 |
No | output | 1 | 7,021 | 15 | 14,043 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Om Nom really likes candies and doesn't like spiders as they frequently steal candies. One day Om Nom fancied a walk in a park. Unfortunately, the park has some spiders and Om Nom doesn't want t... | instruction | 0 | 7,022 | 15 | 14,044 |
No | output | 1 | 7,022 | 15 | 14,045 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Om Nom really likes candies and doesn't like spiders as they frequently steal candies. One day Om Nom fancied a walk in a park. Unfortunately, the park has some spiders and Om Nom doesn't want t... | instruction | 0 | 7,023 | 15 | 14,046 |
No | output | 1 | 7,023 | 15 | 14,047 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Om Nom really likes candies and doesn't like spiders as they frequently steal candies. One day Om Nom fancied a walk in a park. Unfortunately, the park has some spiders and Om Nom doesn't want t... | instruction | 0 | 7,024 | 15 | 14,048 |
No | output | 1 | 7,024 | 15 | 14,049 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Alice and Bob are playing a game on a line with n cells. There are n cells labeled from 1 through n. For each i from 1 to n-1, cells i and i+1 are adjacent.
Alice initially has a token on some cell on the line, and Bob tries to guess where ... | instruction | 0 | 8,403 | 15 | 16,806 |
Tags: graphs
Correct Solution:
```
n,k=map(int,input().split())
arr=list(map(int,input().split()))
dict1={}
for i in range(1,n+1):
dict1[i]=[]
for i in range(k):
dict1[arr[i]].append(i)
ans=0
for i in range(1,n+1):
if(i==1):
if(n==1):
break
if(len(dict1[1])==0):
ans+=2
else:
if(len(dict1[2])==0):
... | output | 1 | 8,403 | 15 | 16,807 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Alice and Bob are playing a game on a line with n cells. There are n cells labeled from 1 through n. For each i from 1 to n-1, cells i and i+1 are adjacent.
Alice initially has a token on some cell on the line, and Bob tries to guess where ... | instruction | 0 | 8,404 | 15 | 16,808 |
Tags: graphs
Correct Solution:
```
import sys
input = lambda: sys.stdin.readline().strip("\r\n")
n, k = map(int, input().split())
x = list(map(int, input().split()))
first = [k] * (n+1)
last = [-1] * (n+1)
for i in range(1, k+1):
last[x[i-1]] = i
for i in range(k, 0, -1):
first[x[i-1]] = i
ans = 0
# print(f... | output | 1 | 8,404 | 15 | 16,809 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Alice and Bob are playing a game on a line with n cells. There are n cells labeled from 1 through n. For each i from 1 to n-1, cells i and i+1 are adjacent.
Alice initially has a token on some cell on the line, and Bob tries to guess where ... | instruction | 0 | 8,405 | 15 | 16,810 |
Tags: graphs
Correct Solution:
```
import sys
n, k = map(int, input().split())
q = list(map(int, input().split()))
if n == 1:
print(0)
sys.exit()
res = max(n - 2, 0) * 3 + 4
#
# st = set(q)
# res -= len(st)
#
# arr = [2] + [3] * max(n - 2, 0) + [2]
arr = [0] * n
l_flags = [False] * n
r_flags = [False] * n
... | output | 1 | 8,405 | 15 | 16,811 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Alice and Bob are playing a game on a line with n cells. There are n cells labeled from 1 through n. For each i from 1 to n-1, cells i and i+1 are adjacent.
Alice initially has a token on some cell on the line, and Bob tries to guess where ... | instruction | 0 | 8,406 | 15 | 16,812 |
Tags: graphs
Correct Solution:
```
from math import *
from collections import *
from bisect import *
import sys
input=sys.stdin.readline
t=1
while(t):
t-=1
n,k=map(int,input().split())
a=list(map(int,input().split()))
vis=set()
for i in a:
vis.add((i,i))
if((i-1,i-1) in vis):
... | output | 1 | 8,406 | 15 | 16,813 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Alice and Bob are playing a game on a line with n cells. There are n cells labeled from 1 through n. For each i from 1 to n-1, cells i and i+1 are adjacent.
Alice initially has a token on some cell on the line, and Bob tries to guess where ... | instruction | 0 | 8,407 | 15 | 16,814 |
Tags: graphs
Correct Solution:
```
def getn():
return int(input())
def getns():
return [int(x)for x in input().split()]
# n=getn()
# ns=getns()
n,k=getns()
ks=getns()
f=[None]*(n+1)
l=[None]*(n+1)
ans=3*n-2
for i in range(k):
c=ks[i]
if f[c]==None:
f[c]=i
ans-=1
l[c]=i
for i in ran... | output | 1 | 8,407 | 15 | 16,815 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Alice and Bob are playing a game on a line with n cells. There are n cells labeled from 1 through n. For each i from 1 to n-1, cells i and i+1 are adjacent.
Alice initially has a token on some cell on the line, and Bob tries to guess where ... | instruction | 0 | 8,408 | 15 | 16,816 |
Tags: graphs
Correct Solution:
```
def solve():
n,k = map(int,input().split())
x = list(map(int,input().split()))
fpos = [k for i in range(n+1)]
lpos = [-1 for i in range(n+1)]
for i in range(1,k+1):
lpos[x[i-1]] = i
for i in range(k,0,-1):
fpos[x[i-1]] = i
ans = 0
for i in range(1,n+1):
if lpos[i] == -1:... | output | 1 | 8,408 | 15 | 16,817 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Alice and Bob are playing a game on a line with n cells. There are n cells labeled from 1 through n. For each i from 1 to n-1, cells i and i+1 are adjacent.
Alice initially has a token on some cell on the line, and Bob tries to guess where ... | instruction | 0 | 8,409 | 15 | 16,818 |
Tags: graphs
Correct Solution:
```
(n,k)=[int(x) for x in input().split()]
q =[int(x) for x in input().split()]
f = 0
incl = set()
counted={}
for i in range(k-1,-1,-1):
if q[i]+1 in incl and str(q[i])+"+1" not in counted:
f+=1
counted[str(q[i])+"+1"]=True
if q[i]-1 in incl and str(q[i])+"-1" not... | output | 1 | 8,409 | 15 | 16,819 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Alice and Bob are playing a game on a line with n cells. There are n cells labeled from 1 through n. For each i from 1 to n-1, cells i and i+1 are adjacent.
Alice initially has a token on some cell on the line, and Bob tries to guess where ... | instruction | 0 | 8,410 | 15 | 16,820 |
Tags: graphs
Correct Solution:
```
n, k = map(int, input().split())
a = list(map(int, input().split()))
first_appear = {}
last_appear = {}
for i in range(k):
last_appear[a[i]] = i
for i in range(k)[::-1]:
first_appear[a[i]] = i
count = 0
for i in range(1,n+1):
for j in range(i-1,i+2):
if 1 <= j <... | output | 1 | 8,410 | 15 | 16,821 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Alice and Bob are playing a game on a line with n cells. There are n cells labeled from 1 through n. For each i from 1 to n-1, cells i and i+1 are adjacent.
Alice initially has a token on some ... | instruction | 0 | 8,411 | 15 | 16,822 |
Yes | output | 1 | 8,411 | 15 | 16,823 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Alice and Bob are playing a game on a line with n cells. There are n cells labeled from 1 through n. For each i from 1 to n-1, cells i and i+1 are adjacent.
Alice initially has a token on some ... | instruction | 0 | 8,412 | 15 | 16,824 |
Yes | output | 1 | 8,412 | 15 | 16,825 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Alice and Bob are playing a game on a line with n cells. There are n cells labeled from 1 through n. For each i from 1 to n-1, cells i and i+1 are adjacent.
Alice initially has a token on some ... | instruction | 0 | 8,413 | 15 | 16,826 |
Yes | output | 1 | 8,413 | 15 | 16,827 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Alice and Bob are playing a game on a line with n cells. There are n cells labeled from 1 through n. For each i from 1 to n-1, cells i and i+1 are adjacent.
Alice initially has a token on some ... | instruction | 0 | 8,414 | 15 | 16,828 |
Yes | output | 1 | 8,414 | 15 | 16,829 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Alice and Bob are playing a game on a line with n cells. There are n cells labeled from 1 through n. For each i from 1 to n-1, cells i and i+1 are adjacent.
Alice initially has a token on some ... | instruction | 0 | 8,415 | 15 | 16,830 |
No | output | 1 | 8,415 | 15 | 16,831 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Alice and Bob are playing a game on a line with n cells. There are n cells labeled from 1 through n. For each i from 1 to n-1, cells i and i+1 are adjacent.
Alice initially has a token on some ... | instruction | 0 | 8,416 | 15 | 16,832 |
No | output | 1 | 8,416 | 15 | 16,833 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Alice and Bob are playing a game on a line with n cells. There are n cells labeled from 1 through n. For each i from 1 to n-1, cells i and i+1 are adjacent.
Alice initially has a token on some ... | instruction | 0 | 8,417 | 15 | 16,834 |
No | output | 1 | 8,417 | 15 | 16,835 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Alice and Bob are playing a game on a line with n cells. There are n cells labeled from 1 through n. For each i from 1 to n-1, cells i and i+1 are adjacent.
Alice initially has a token on some ... | instruction | 0 | 8,418 | 15 | 16,836 |
No | output | 1 | 8,418 | 15 | 16,837 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Let's imagine: there is a chess piece billiard ball. Its movements resemble the ones of a bishop chess piece. The only difference is that when a billiard ball hits the board's border, it can reflect from it and continue moving.
More formall... | instruction | 0 | 8,717 | 15 | 17,434 |
Tags: dfs and similar, dsu, graphs, number theory
Correct Solution:
```
import math
x, y = map(int, input().split())
x -= 1; y -= 1
print(math.gcd(x, y)+1)
``` | output | 1 | 8,717 | 15 | 17,435 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Let's imagine: there is a chess piece billiard ball. Its movements resemble the ones of a bishop chess piece. The only difference is that when a billiard ball hits the board's border, it can reflect from it and continue moving.
More formall... | instruction | 0 | 8,718 | 15 | 17,436 |
Tags: dfs and similar, dsu, graphs, number theory
Correct Solution:
```
n, m = map(int, input().split())
while 1 == 1:
if n == m:
print(n)
break
if n > m:
n, m = m, n
m -= (n - 1)
``` | output | 1 | 8,718 | 15 | 17,437 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Let's imagine: there is a chess piece billiard ball. Its movements resemble the ones of a bishop chess piece. The only difference is that when a billiard ball hits the board's border, it can reflect from it and continue moving.
More formall... | instruction | 0 | 8,719 | 15 | 17,438 |
Tags: dfs and similar, dsu, graphs, number theory
Correct Solution:
```
import math
n,m=map(int,input().split())
print(math.gcd(n-1,m-1)+1)
``` | output | 1 | 8,719 | 15 | 17,439 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Let's imagine: there is a chess piece billiard ball. Its movements resemble the ones of a bishop chess piece. The only difference is that when a billiard ball hits the board's border, it can reflect from it and continue moving.
More formall... | instruction | 0 | 8,720 | 15 | 17,440 |
Tags: dfs and similar, dsu, graphs, number theory
Correct Solution:
```
n, m = map(int, input().split())
while True:
if n == m:
print(n)
break
if n > m:
n, m = m, n
m -= (n - 1)
``` | output | 1 | 8,720 | 15 | 17,441 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Let's imagine: there is a chess piece billiard ball. Its movements resemble the ones of a bishop chess piece. The only difference is that when a billiard ball hits the board's border, it can reflect from it and continue moving.
More formall... | instruction | 0 | 8,721 | 15 | 17,442 |
Tags: dfs and similar, dsu, graphs, number theory
Correct Solution:
```
from math import *
n,m=sorted(list(map(int,input().split())))
print(1+gcd(n-1,m-n))
``` | output | 1 | 8,721 | 15 | 17,443 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Let's imagine: there is a chess piece billiard ball. Its movements resemble the ones of a bishop chess piece. The only difference is that when a billiard ball hits the board's border, it can ref... | instruction | 0 | 8,722 | 15 | 17,444 |
No | output | 1 | 8,722 | 15 | 17,445 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Let's imagine: there is a chess piece billiard ball. Its movements resemble the ones of a bishop chess piece. The only difference is that when a billiard ball hits the board's border, it can ref... | instruction | 0 | 8,723 | 15 | 17,446 |
No | output | 1 | 8,723 | 15 | 17,447 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Let's imagine: there is a chess piece billiard ball. Its movements resemble the ones of a bishop chess piece. The only difference is that when a billiard ball hits the board's border, it can ref... | instruction | 0 | 8,724 | 15 | 17,448 |
No | output | 1 | 8,724 | 15 | 17,449 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Let's imagine: there is a chess piece billiard ball. Its movements resemble the ones of a bishop chess piece. The only difference is that when a billiard ball hits the board's border, it can ref... | instruction | 0 | 8,725 | 15 | 17,450 |
No | output | 1 | 8,725 | 15 | 17,451 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Joe has been hurt on the Internet. Now he is storming around the house, destroying everything in his path.
Joe's house has n floors, each floor is a segment of m cells. Each cell either contains nothing (it is an empty cell), or has a brick... | instruction | 0 | 9,380 | 15 | 18,760 |
Tags: brute force
Correct Solution:
```
import sys
from math import *
def minp():
return sys.stdin.readline().strip()
def mint():
return int(minp())
def mints():
return map(int, minp().split())
n, m = mints()
a = list(minp())
x = 0
t = 0
d = 1
for i in range(n-1):
b = list(minp())
l = x
r = x
wall = 0
while... | output | 1 | 9,380 | 15 | 18,761 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Joe has been hurt on the Internet. Now he is storming around the house, destroying everything in his path.
Joe's house has n floors, each floor is a segment of m cells. Each cell either contains nothing (it is an empty cell), or has a brick... | instruction | 0 | 9,381 | 15 | 18,762 |
Tags: brute force
Correct Solution:
```
n, m = [int(i) for i in input().split()]
current_floor = list(input())
x, t, direction = 0, 0, 1
for i in range(n-1):
floor = list(input())
l, r = x, x
wall = 0
while True:
t += 1
if floor[x] == '.':
break
if (x + direction ==... | output | 1 | 9,381 | 15 | 18,763 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You have a grid with n rows and n columns. Each cell is either empty (denoted by '.') or blocked (denoted by 'X').
Two empty cells are directly connected if they share a side. Two cells (r1, c1... | instruction | 0 | 9,523 | 15 | 19,046 |
No | output | 1 | 9,523 | 15 | 19,047 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You have a grid with n rows and n columns. Each cell is either empty (denoted by '.') or blocked (denoted by 'X').
Two empty cells are directly connected if they share a side. Two cells (r1, c1... | instruction | 0 | 9,524 | 15 | 19,048 |
No | output | 1 | 9,524 | 15 | 19,049 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You have a grid with n rows and n columns. Each cell is either empty (denoted by '.') or blocked (denoted by 'X').
Two empty cells are directly connected if they share a side. Two cells (r1, c1... | instruction | 0 | 9,525 | 15 | 19,050 |
No | output | 1 | 9,525 | 15 | 19,051 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You have a grid with n rows and n columns. Each cell is either empty (denoted by '.') or blocked (denoted by 'X').
Two empty cells are directly connected if they share a side. Two cells (r1, c1... | instruction | 0 | 9,526 | 15 | 19,052 |
No | output | 1 | 9,526 | 15 | 19,053 |
Provide a correct Python 3 solution for this coding contest problem.
There is a pond with a rectangular shape. The pond is divided into a grid with H rows and W columns of squares. We will denote the square at the i-th row from the top and j-th column from the left by (i,\ j).
Some of the squares in the pond contains... | instruction | 0 | 9,737 | 15 | 19,474 |
"Correct Solution:
```
from collections import deque
INF = float("inf")
TO = 0; CAP = 1; REV = 2
class Dinic:
def __init__(self, N):
self.N = N
self.V = [[] for _ in range(N)] # to, cap, rev
# 辺 e = V[n][m] の逆辺は V[e[TO]][e[REV]]
self.level = [0] * N
def add_edge(self, u, v, c... | output | 1 | 9,737 | 15 | 19,475 |
Provide a correct Python 3 solution for this coding contest problem.
There is a pond with a rectangular shape. The pond is divided into a grid with H rows and W columns of squares. We will denote the square at the i-th row from the top and j-th column from the left by (i,\ j).
Some of the squares in the pond contains... | instruction | 0 | 9,738 | 15 | 19,476 |
"Correct Solution:
```
import sys
sys.setrecursionlimit(1000000)
def FF(E, s, t):
NN = H+W+2
G = [[] for _ in range(NN)]
for a, b, f in E:
G[a].append([b, f, len(G[b])])
G[b].append([a, 0, len(G[a])-1])
def dfs(s, t, f):
if s == t:
return f
used[s] = 1
... | output | 1 | 9,738 | 15 | 19,477 |
Provide a correct Python 3 solution for this coding contest problem.
There is a pond with a rectangular shape. The pond is divided into a grid with H rows and W columns of squares. We will denote the square at the i-th row from the top and j-th column from the left by (i,\ j).
Some of the squares in the pond contains... | instruction | 0 | 9,739 | 15 | 19,478 |
"Correct Solution:
```
# https://tjkendev.github.io/procon-library/python/max_flow/dinic.html
# Dinic's algorithm
from collections import deque
class Dinic:
def __init__(self, N):
self.N = N
self.G = [[] for i in range(N)]
def add_edge(self, fr, to, cap):
forward = [to, cap, None]
... | output | 1 | 9,739 | 15 | 19,479 |
Provide a correct Python 3 solution for this coding contest problem.
There is a pond with a rectangular shape. The pond is divided into a grid with H rows and W columns of squares. We will denote the square at the i-th row from the top and j-th column from the left by (i,\ j).
Some of the squares in the pond contains... | instruction | 0 | 9,740 | 15 | 19,480 |
"Correct Solution:
```
from collections import deque
class mf_graph:
n=1
g=[[] for i in range(1)]
pos=[]
def __init__(self,N):
self.n=N
self.g=[[] for i in range(N)]
def add_edge(self,From,To,cap):
assert 0<=From and From<self.n
assert 0<=To and To<self.n
asse... | output | 1 | 9,740 | 15 | 19,481 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.