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.
A progress bar is an element of graphical interface that displays the progress of a process for this very moment before it is completed. Let's take a look at the following form of such a bar.
A... | instruction | 0 | 14,666 | 7 | 29,332 |
Yes | output | 1 | 14,666 | 7 | 29,333 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
A progress bar is an element of graphical interface that displays the progress of a process for this very moment before it is completed. Let's take a look at the following form of such a bar.
A... | instruction | 0 | 14,667 | 7 | 29,334 |
Yes | output | 1 | 14,667 | 7 | 29,335 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
A progress bar is an element of graphical interface that displays the progress of a process for this very moment before it is completed. Let's take a look at the following form of such a bar.
A... | instruction | 0 | 14,668 | 7 | 29,336 |
Yes | output | 1 | 14,668 | 7 | 29,337 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
A progress bar is an element of graphical interface that displays the progress of a process for this very moment before it is completed. Let's take a look at the following form of such a bar.
A... | instruction | 0 | 14,669 | 7 | 29,338 |
No | output | 1 | 14,669 | 7 | 29,339 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
A progress bar is an element of graphical interface that displays the progress of a process for this very moment before it is completed. Let's take a look at the following form of such a bar.
A... | instruction | 0 | 14,670 | 7 | 29,340 |
No | output | 1 | 14,670 | 7 | 29,341 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
A progress bar is an element of graphical interface that displays the progress of a process for this very moment before it is completed. Let's take a look at the following form of such a bar.
A... | instruction | 0 | 14,671 | 7 | 29,342 |
No | output | 1 | 14,671 | 7 | 29,343 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
A progress bar is an element of graphical interface that displays the progress of a process for this very moment before it is completed. Let's take a look at the following form of such a bar.
A... | instruction | 0 | 14,672 | 7 | 29,344 |
No | output | 1 | 14,672 | 7 | 29,345 |
Provide a correct Python 3 solution for this coding contest problem.
There are N squares lining up in a row, numbered 1 through N from left to right. Initially, all squares are white. We also have N-1 painting machines, numbered 1 through N-1. When operated, Machine i paints Square i and i+1 black.
Snuke will operate... | instruction | 0 | 14,847 | 7 | 29,694 |
"Correct Solution:
```
n = int(input())
p = 10**9 + 7
def fact(n):
n_ = 1
yield n_
for i in range(1, n+1):
n_ = (n_*i) % p
yield n_
def invfact(n, f, p):
m = pow(f[n], p-2, p)
yield m
for i in range(n, 0, -1):
m = m * i % p
yield m
ans = 0
m = n - 1
f = list(... | output | 1 | 14,847 | 7 | 29,695 |
Provide a correct Python 3 solution for this coding contest problem.
There are N squares lining up in a row, numbered 1 through N from left to right. Initially, all squares are white. We also have N-1 painting machines, numbered 1 through N-1. When operated, Machine i paints Square i and i+1 black.
Snuke will operate... | instruction | 0 | 14,851 | 7 | 29,702 |
"Correct Solution:
```
n = int(input())
p = 10**9 + 7
def fact(n):
n_ = 1
yield n_
for i in range(1, n+1):
n_ = (n_*i) % p
yield n_
def invfact(n, f, p):
m = pow(f[n], p-2, p)
yield m
for i in range(n, 0, -1):
m = m * i % p
yield m
ans = 0
m = n - 1
f = list(... | output | 1 | 14,851 | 7 | 29,703 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
There are N squares lining up in a row, numbered 1 through N from left to right. Initially, all squares are white. We also have N-1 painting machines, numbered 1 through N-1. When operated, Mach... | instruction | 0 | 14,858 | 7 | 29,716 |
No | output | 1 | 14,858 | 7 | 29,717 |
Provide a correct Python 3 solution for this coding contest problem.
There are N cats. We number them from 1 through N.
Each of the cats wears a hat. Cat i says: "there are exactly a_i different colors among the N - 1 hats worn by the cats except me."
Determine whether there exists a sequence of colors of the hats t... | instruction | 0 | 14,876 | 7 | 29,752 |
"Correct Solution:
```
N = int(input())
a = list(map(int, input().split()))
seta = set(a)
if len(seta) == 1:
if a[0] in (0, N-1) or a[0] <= N // 2:
print("Yes")
else:
print("No")
elif len(seta) == 2:
a1 = min(seta)
a2 = max(seta)
counta1 = a.count(a1)
if a2 != a1 + 1:
pr... | output | 1 | 14,876 | 7 | 29,753 |
Provide a correct Python 3 solution for this coding contest problem.
There are N cats. We number them from 1 through N.
Each of the cats wears a hat. Cat i says: "there are exactly a_i different colors among the N - 1 hats worn by the cats except me."
Determine whether there exists a sequence of colors of the hats t... | instruction | 0 | 14,877 | 7 | 29,754 |
"Correct Solution:
```
n = int(input())
a = list(map(int, input().split()))
Min = min(a)
Max = max(a)
if Max - Min > 1:
print("No")
elif Max == Min:
if a[0] == n - 1 or a[0] <= n // 2:
print("Yes")
else:
print("No")
else:
c_M = a.count(Max)
c_m = n - c_M
if c_m < Max <= c_m + c_M // 2:
print("Yes")
else:
... | output | 1 | 14,877 | 7 | 29,755 |
Provide a correct Python 3 solution for this coding contest problem.
There are N cats. We number them from 1 through N.
Each of the cats wears a hat. Cat i says: "there are exactly a_i different colors among the N - 1 hats worn by the cats except me."
Determine whether there exists a sequence of colors of the hats t... | instruction | 0 | 14,878 | 7 | 29,756 |
"Correct Solution:
```
N = int(input())
A = sorted(list(map(int,input().split())),reverse=True)
if A[0]==A[-1] and (A[0]==1 or A[0]==N-1):
print("Yes")
else:
k = A[0]
cnt = A.count(k-1)
n = N-cnt
k -= cnt
if k<=0:
print("No")
else:
n -= 2*k
if n>=0:
print(... | output | 1 | 14,878 | 7 | 29,757 |
Provide a correct Python 3 solution for this coding contest problem.
There are N cats. We number them from 1 through N.
Each of the cats wears a hat. Cat i says: "there are exactly a_i different colors among the N - 1 hats worn by the cats except me."
Determine whether there exists a sequence of colors of the hats t... | instruction | 0 | 14,879 | 7 | 29,758 |
"Correct Solution:
```
n = int(input())
a = list(map(int,input().split()))
L = len(set(a))
if L ==1:
if a[0] < n//2+1 or a[0]==n-1:
print('Yes')
else:
print('No')
elif L == 2:
M,m =max(a),min(a)
m_c =a.count(m)
if M == m+1 and m_c <= m and n-m_c >= 2*(M-m_c):
print('Yes')
else:
print('No')
e... | output | 1 | 14,879 | 7 | 29,759 |
Provide a correct Python 3 solution for this coding contest problem.
There are N cats. We number them from 1 through N.
Each of the cats wears a hat. Cat i says: "there are exactly a_i different colors among the N - 1 hats worn by the cats except me."
Determine whether there exists a sequence of colors of the hats t... | instruction | 0 | 14,880 | 7 | 29,760 |
"Correct Solution:
```
n = int(input())
a = list(map(int, input().split()))
a.sort()
cnt = 0
for i in range(n):
if a[i] == a[0]:
cnt = i+1
else:
break
if a[-1] - a[0] > 1:
print('No')
exit()
elif a[-1] - a[0] == 1:
actual = a[-1]
if actual >= n:
print('No')
elif cnt... | output | 1 | 14,880 | 7 | 29,761 |
Provide a correct Python 3 solution for this coding contest problem.
There are N cats. We number them from 1 through N.
Each of the cats wears a hat. Cat i says: "there are exactly a_i different colors among the N - 1 hats worn by the cats except me."
Determine whether there exists a sequence of colors of the hats t... | instruction | 0 | 14,881 | 7 | 29,762 |
"Correct Solution:
```
N = int(input())
a = list(map(int, input().split()))
M = max(a)
m = min(a)
if M > m + 1:
print("No")
else:
if M == m:
if M == N-1:
print("Yes")
elif M*2 <= N:
print("Yes")
else:
print("No")
else:
# ai == m ならば、ai以外にそ... | output | 1 | 14,881 | 7 | 29,763 |
Provide a correct Python 3 solution for this coding contest problem.
There are N cats. We number them from 1 through N.
Each of the cats wears a hat. Cat i says: "there are exactly a_i different colors among the N - 1 hats worn by the cats except me."
Determine whether there exists a sequence of colors of the hats t... | instruction | 0 | 14,882 | 7 | 29,764 |
"Correct Solution:
```
N = int(input())
a = list(map(int, input().split()))
ma = max(a)
mi = min(a)
if ma - mi >= 2:
print('No')
elif ma == mi:
if a[0] == N - 1:
print('Yes')
elif 2 * a[0] <= N:
print('Yes')
else:
print('No')
else:
al = 0
na = 0
for i in range(N):
... | output | 1 | 14,882 | 7 | 29,765 |
Provide a correct Python 3 solution for this coding contest problem.
There are N cats. We number them from 1 through N.
Each of the cats wears a hat. Cat i says: "there are exactly a_i different colors among the N - 1 hats worn by the cats except me."
Determine whether there exists a sequence of colors of the hats t... | instruction | 0 | 14,883 | 7 | 29,766 |
"Correct Solution:
```
n = int(input())
a = sorted(list(map(int, input().split())))
data = [[-1, 0]]
for x in a:
if data[-1][0] == x:
data[-1][1] += 1
else:
data.append([x, 1])
data = data[1:]
if len(data) == 1:
print("Yes" if data[0][0] * 2 <= n or data[0][0] + 1 == n else "No")
elif len(d... | output | 1 | 14,883 | 7 | 29,767 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
There are N cats. We number them from 1 through N.
Each of the cats wears a hat. Cat i says: "there are exactly a_i different colors among the N - 1 hats worn by the cats except me."
Determine... | instruction | 0 | 14,886 | 7 | 29,772 |
Yes | output | 1 | 14,886 | 7 | 29,773 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
There are N cats. We number them from 1 through N.
Each of the cats wears a hat. Cat i says: "there are exactly a_i different colors among the N - 1 hats worn by the cats except me."
Determine... | instruction | 0 | 14,887 | 7 | 29,774 |
Yes | output | 1 | 14,887 | 7 | 29,775 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
There are N cats. We number them from 1 through N.
Each of the cats wears a hat. Cat i says: "there are exactly a_i different colors among the N - 1 hats worn by the cats except me."
Determine... | instruction | 0 | 14,888 | 7 | 29,776 |
No | output | 1 | 14,888 | 7 | 29,777 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
There are N cats. We number them from 1 through N.
Each of the cats wears a hat. Cat i says: "there are exactly a_i different colors among the N - 1 hats worn by the cats except me."
Determine... | instruction | 0 | 14,889 | 7 | 29,778 |
No | output | 1 | 14,889 | 7 | 29,779 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
There are N cats. We number them from 1 through N.
Each of the cats wears a hat. Cat i says: "there are exactly a_i different colors among the N - 1 hats worn by the cats except me."
Determine... | instruction | 0 | 14,891 | 7 | 29,782 |
No | output | 1 | 14,891 | 7 | 29,783 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Nezzar has n balls, numbered with integers 1, 2, …, n. Numbers a_1, a_2, …, a_n are written on them, respectively. Numbers on those balls form a non-decreasing sequence, which means that a_i ≤ a_{i+1} for all 1 ≤ i < n.
Nezzar wants to colo... | instruction | 0 | 15,289 | 7 | 30,578 |
Tags: brute force, greedy
Correct Solution:
```
from collections import Counter
# region fastio
import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192
class FastIO(IOBase):
newlines = 0
def __init__(self, file):
self._fd = file.fileno()
self.buffer = BytesIO()
self.writab... | output | 1 | 15,289 | 7 | 30,579 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Nezzar has n balls, numbered with integers 1, 2, …, n. Numbers a_1, a_2, …, a_n are written on them, respectively. Numbers on those balls form a non-decreasing sequence, which means that a_i ≤ a_{i+1} for all 1 ≤ i < n.
Nezzar wants to colo... | instruction | 0 | 15,290 | 7 | 30,580 |
Tags: brute force, greedy
Correct Solution:
```
t = int(input())
while t>0 :
n = int(input())
a = list(map(int,input().strip().split()))[:n]
ans=1
x = 1
for i in range(1,n,1):
if a[i]==a[i-1]:
x+=1
ans = max(x,ans)
else:
x=1
print(ans)
t= ... | output | 1 | 15,290 | 7 | 30,581 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Nezzar has n balls, numbered with integers 1, 2, …, n. Numbers a_1, a_2, …, a_n are written on them, respectively. Numbers on those balls form a non-decreasing sequence, which means that a_i ≤ a_{i+1} for all 1 ≤ i < n.
Nezzar wants to colo... | instruction | 0 | 15,291 | 7 | 30,582 |
Tags: brute force, greedy
Correct Solution:
```
t=int(input())
for j in range(0,t):
n=int(input())
s=list(map(int,input().split()))
p={}
for i in range(0,n):
if(p.get(s[i],-1)==-1): p[s[i]]=1
else: p[s[i]]+=1
zd=0
for i in p:
zd=max(zd,p[i])
print(zd)
... | output | 1 | 15,291 | 7 | 30,583 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Nezzar has n balls, numbered with integers 1, 2, …, n. Numbers a_1, a_2, …, a_n are written on them, respectively. Numbers on those balls form a non-decreasing sequence, which means that a_i ≤ a_{i+1} for all 1 ≤ i < n.
Nezzar wants to colo... | instruction | 0 | 15,292 | 7 | 30,584 |
Tags: brute force, greedy
Correct Solution:
```
ans = []
for _ in range(int(input())):
n = int(input())
u = list(map(int, input().split()))
mx = 1
k = 1
for i in range(1, n):
if u[i] == u[i - 1]:
k += 1
else:
mx = max(mx, k)
k = 1
mx = max(mx, ... | output | 1 | 15,292 | 7 | 30,585 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Nezzar has n balls, numbered with integers 1, 2, …, n. Numbers a_1, a_2, …, a_n are written on them, respectively. Numbers on those balls form a non-decreasing sequence, which means that a_i ≤ a_{i+1} for all 1 ≤ i < n.
Nezzar wants to colo... | instruction | 0 | 15,293 | 7 | 30,586 |
Tags: brute force, greedy
Correct Solution:
```
import sys
input = sys.stdin.readline
def println(val):
sys.stdout.write(str(val) + '\n')
ans = []
def solve():
global ans
n = int(input())
a = list(map(int, input().split()))
import collections
cnt = collections.Counter(a)
res = 0
for key in cnt:
if cnt[key] ... | output | 1 | 15,293 | 7 | 30,587 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Nezzar has n balls, numbered with integers 1, 2, …, n. Numbers a_1, a_2, …, a_n are written on them, respectively. Numbers on those balls form a non-decreasing sequence, which means that a_i ≤ a_{i+1} for all 1 ≤ i < n.
Nezzar wants to colo... | instruction | 0 | 15,294 | 7 | 30,588 |
Tags: brute force, greedy
Correct Solution:
```
for tt in range(int(input())):
n = int(input())
a = list(map(int,input().split()))
used = [set() for i in range(150)]
ans = 0
for x in a:
for i in range(150):
if x not in used[i]:
ans = max(ans,i+1)
u... | output | 1 | 15,294 | 7 | 30,589 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Nezzar has n balls, numbered with integers 1, 2, …, n. Numbers a_1, a_2, …, a_n are written on them, respectively. Numbers on those balls form a non-decreasing sequence, which means that a_i ≤ a_{i+1} for all 1 ≤ i < n.
Nezzar wants to colo... | instruction | 0 | 15,295 | 7 | 30,590 |
Tags: brute force, greedy
Correct Solution:
```
from collections import deque, Counter,defaultdict as dft
from heapq import heappop ,heappush
from math import log,sqrt,factorial,cos,tan,sin,radians,log2,ceil,floor
from bisect import bisect,bisect_left,bisect_right
from decimal import *
import sys,threading
from itertoo... | output | 1 | 15,295 | 7 | 30,591 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Nezzar has n balls, numbered with integers 1, 2, …, n. Numbers a_1, a_2, …, a_n are written on them, respectively. Numbers on those balls form a non-decreasing sequence, which means that a_i ≤ a_{i+1} for all 1 ≤ i < n.
Nezzar wants to colo... | instruction | 0 | 15,296 | 7 | 30,592 |
Tags: brute force, greedy
Correct Solution:
```
# ------------------- fast io --------------------
import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192
class FastIO(IOBase):
newlines = 0
def __init__(self, file):
self._fd = file.fileno()
self.buffer = BytesIO()
self.wri... | output | 1 | 15,296 | 7 | 30,593 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Nezzar has n balls, numbered with integers 1, 2, …, n. Numbers a_1, a_2, …, a_n are written on them, respectively. Numbers on those balls form a non-decreasing sequence, which means that a_i ≤ a... | instruction | 0 | 15,297 | 7 | 30,594 |
Yes | output | 1 | 15,297 | 7 | 30,595 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Nezzar has n balls, numbered with integers 1, 2, …, n. Numbers a_1, a_2, …, a_n are written on them, respectively. Numbers on those balls form a non-decreasing sequence, which means that a_i ≤ a... | instruction | 0 | 15,298 | 7 | 30,596 |
Yes | output | 1 | 15,298 | 7 | 30,597 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Nezzar has n balls, numbered with integers 1, 2, …, n. Numbers a_1, a_2, …, a_n are written on them, respectively. Numbers on those balls form a non-decreasing sequence, which means that a_i ≤ a... | instruction | 0 | 15,299 | 7 | 30,598 |
Yes | output | 1 | 15,299 | 7 | 30,599 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Nezzar has n balls, numbered with integers 1, 2, …, n. Numbers a_1, a_2, …, a_n are written on them, respectively. Numbers on those balls form a non-decreasing sequence, which means that a_i ≤ a... | instruction | 0 | 15,300 | 7 | 30,600 |
Yes | output | 1 | 15,300 | 7 | 30,601 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Nezzar has n balls, numbered with integers 1, 2, …, n. Numbers a_1, a_2, …, a_n are written on them, respectively. Numbers on those balls form a non-decreasing sequence, which means that a_i ≤ a... | instruction | 0 | 15,301 | 7 | 30,602 |
No | output | 1 | 15,301 | 7 | 30,603 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Nezzar has n balls, numbered with integers 1, 2, …, n. Numbers a_1, a_2, …, a_n are written on them, respectively. Numbers on those balls form a non-decreasing sequence, which means that a_i ≤ a... | instruction | 0 | 15,302 | 7 | 30,604 |
No | output | 1 | 15,302 | 7 | 30,605 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Nezzar has n balls, numbered with integers 1, 2, …, n. Numbers a_1, a_2, …, a_n are written on them, respectively. Numbers on those balls form a non-decreasing sequence, which means that a_i ≤ a... | instruction | 0 | 15,303 | 7 | 30,606 |
No | output | 1 | 15,303 | 7 | 30,607 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Nezzar has n balls, numbered with integers 1, 2, …, n. Numbers a_1, a_2, …, a_n are written on them, respectively. Numbers on those balls form a non-decreasing sequence, which means that a_i ≤ a... | instruction | 0 | 15,304 | 7 | 30,608 |
No | output | 1 | 15,304 | 7 | 30,609 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Fox Ciel has a board with n rows and n columns, there is one integer in each cell.
It's known that n is an odd number, so let's introduce <image>. Fox Ciel can do the following operation many t... | instruction | 0 | 15,390 | 7 | 30,780 |
No | output | 1 | 15,390 | 7 | 30,781 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Pasha loves his phone and also putting his hair up... But the hair is now irrelevant.
Pasha has installed a new game to his phone. The goal of the game is following. There is a rectangular field consisting of n row with m pixels in each row... | instruction | 0 | 17,205 | 7 | 34,410 |
Tags: brute force
Correct Solution:
```
#In the name of Allah
from sys import stdin, stdout
input = stdin.readline
n, m, k = map(int, input().split())
mat = [[False] * (m + 2) for _ in range(n + 2)]
for ans in range(1, k + 1):
i, j = map(int, input().split())
if mat[i - 1][j] and mat[i][j - 1]:
... | output | 1 | 17,205 | 7 | 34,411 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Pasha loves his phone and also putting his hair up... But the hair is now irrelevant.
Pasha has installed a new game to his phone. The goal of the game is following. There is a rectangular field consisting of n row with m pixels in each row... | instruction | 0 | 17,206 | 7 | 34,412 |
Tags: brute force
Correct Solution:
```
n,m,k = [int(x) for x in input().split()]
l = [[int(x) for x in input().split()] for i in range(k)]
if n<2 or m<2:
print(0)
else:
a = [[0 for i in range(m+2)] for j in range(n+2)]
f = 1
for i in range(k):
a[l[i][0]][l[i][1]] = 1
b = a[l[i][0]][l[i]... | output | 1 | 17,206 | 7 | 34,413 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Pasha loves his phone and also putting his hair up... But the hair is now irrelevant.
Pasha has installed a new game to his phone. The goal of the game is following. There is a rectangular field consisting of n row with m pixels in each row... | instruction | 0 | 17,207 | 7 | 34,414 |
Tags: brute force
Correct Solution:
```
n, m, k = map(int, input().split())
mx = [(m+2)*[0] for i in range(n+2)]
# if square 2*2 formed from black cells appears, and cell (i, j) will upper-left, upper right, bottom-left or bottom-right of this square.
def square_check(i, j):
if mx[i][j+1] and mx[i+1][j] and mx[i+1]... | output | 1 | 17,207 | 7 | 34,415 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Pasha loves his phone and also putting his hair up... But the hair is now irrelevant.
Pasha has installed a new game to his phone. The goal of the game is following. There is a rectangular field consisting of n row with m pixels in each row... | instruction | 0 | 17,208 | 7 | 34,416 |
Tags: brute force
Correct Solution:
```
(n,m,k)=[int(x) for x in input().split()]
l=[[0 for x in range(m+2)] for x in range(n+2)]
h=0
for i in range(k):
(a,b)=[int(x) for x in input().split()]
l[a][b]=1
if l[a-1][b-1]+l[a-1][b]+l[a][b-1]+l[a][b]==4 or l[a+1][b+1]+l[a+1][b]+l[a][b+1]+l[a][b]==4 or l[a-1][b+1]+l[a-... | output | 1 | 17,208 | 7 | 34,417 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Pasha loves his phone and also putting his hair up... But the hair is now irrelevant.
Pasha has installed a new game to his phone. The goal of the game is following. There is a rectangular field consisting of n row with m pixels in each row... | instruction | 0 | 17,209 | 7 | 34,418 |
Tags: brute force
Correct Solution:
```
n,m,k=input().split(" ")
n=int(n)
m=int(m)
k=int(k)
l=[[0 for x in range(m+2)] for x in range(n+2)]
flag=0
for i in range(k):
a,b=input().split(" ")
a=int(a)
b=int(b)
l[a][b]=1;
if l[a][b+1]==1 and l[a-1][b]==1 and l[a-1][b+1]==1: #up right
if flag==0:
flag=i+1
elif l... | output | 1 | 17,209 | 7 | 34,419 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Pasha loves his phone and also putting his hair up... But the hair is now irrelevant.
Pasha has installed a new game to his phone. The goal of the game is following. There is a rectangular field consisting of n row with m pixels in each row... | instruction | 0 | 17,210 | 7 | 34,420 |
Tags: brute force
Correct Solution:
```
def formed(w,e):
if w+1 < n and mat[w+1][e] == 'B':
if e+1 < m and mat[w+1][e+1] == 'B' and mat[w][e+1] == 'B' or e-1 >= 0 and mat[w+1][e-1] == 'B' and mat[w][e-1] == 'B':
return True
elif w-1 >= 0 and mat[w-1][e] == 'B':
if e+1 < m and mat[w-1... | output | 1 | 17,210 | 7 | 34,421 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Pasha loves his phone and also putting his hair up... But the hair is now irrelevant.
Pasha has installed a new game to his phone. The goal of the game is following. There is a rectangular field consisting of n row with m pixels in each row... | instruction | 0 | 17,211 | 7 | 34,422 |
Tags: brute force
Correct Solution:
```
n, m, k = map(int, input().split())
field = [[0] * 1024 for _ in range(1024)]
for i in range(1, k + 1):
r, c = map(int, input().split())
field[r][c] = 1
for y, x in ((r - 1, c - 1), (r - 1, c), (r, c - 1), (r, c)):
if all(field[y + dy][x + dx] for dy in (0, 1)... | output | 1 | 17,211 | 7 | 34,423 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Pasha loves his phone and also putting his hair up... But the hair is now irrelevant.
Pasha has installed a new game to his phone. The goal of the game is following. There is a rectangular field consisting of n row with m pixels in each row... | instruction | 0 | 17,212 | 7 | 34,424 |
Tags: brute force
Correct Solution:
```
n, m, k = map(int, input().split())
arr = [[0 for _ in range(m)] for _ in range(n)]
for i in range(1,k+1):
a, b = map(int, input().split())
a = a - 1
b = b - 1
if arr[a][b] == 0:
arr[a][b] = i
ans = 100000000000
for i in range(n-1):
for j in range(m-1):
if arr[i][j] >... | output | 1 | 17,212 | 7 | 34,425 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Pasha loves his phone and also putting his hair up... But the hair is now irrelevant.
Pasha has installed a new game to his phone. The goal of the game is following. There is a rectangular fiel... | instruction | 0 | 17,213 | 7 | 34,426 |
Yes | output | 1 | 17,213 | 7 | 34,427 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Pasha loves his phone and also putting his hair up... But the hair is now irrelevant.
Pasha has installed a new game to his phone. The goal of the game is following. There is a rectangular fiel... | instruction | 0 | 17,214 | 7 | 34,428 |
Yes | output | 1 | 17,214 | 7 | 34,429 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.