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. Little Artem found a grasshopper. He brought it to his house and constructed a jumping area for him. The area looks like a strip of cells 1 × n. Each cell contains the direction for the next ju...
instruction
0
81,285
15
162,570
Yes
output
1
81,285
15
162,571
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Little Artem found a grasshopper. He brought it to his house and constructed a jumping area for him. The area looks like a strip of cells 1 × n. Each cell contains the direction for the next ju...
instruction
0
81,286
15
162,572
Yes
output
1
81,286
15
162,573
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Little Artem found a grasshopper. He brought it to his house and constructed a jumping area for him. The area looks like a strip of cells 1 × n. Each cell contains the direction for the next ju...
instruction
0
81,287
15
162,574
Yes
output
1
81,287
15
162,575
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Little Artem found a grasshopper. He brought it to his house and constructed a jumping area for him. The area looks like a strip of cells 1 × n. Each cell contains the direction for the next ju...
instruction
0
81,288
15
162,576
No
output
1
81,288
15
162,577
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Little Artem found a grasshopper. He brought it to his house and constructed a jumping area for him. The area looks like a strip of cells 1 × n. Each cell contains the direction for the next ju...
instruction
0
81,289
15
162,578
No
output
1
81,289
15
162,579
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Little Artem found a grasshopper. He brought it to his house and constructed a jumping area for him. The area looks like a strip of cells 1 × n. Each cell contains the direction for the next ju...
instruction
0
81,290
15
162,580
No
output
1
81,290
15
162,581
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Little Artem found a grasshopper. He brought it to his house and constructed a jumping area for him. The area looks like a strip of cells 1 × n. Each cell contains the direction for the next ju...
instruction
0
81,291
15
162,582
No
output
1
81,291
15
162,583
Provide tags and a correct Python 3 solution for this coding contest problem. On the way to Rio de Janeiro Ostap kills time playing with a grasshopper he took with him in a special box. Ostap builds a line of length n such that some cells of this line are empty and some contain obstacles. Then, he places his grasshopp...
instruction
0
81,311
15
162,622
Tags: implementation, strings Correct Solution: ``` n, k = map(int, input().split()) s = input() # code G = s.index('G') T = s.index('T') def check(u): if s[u] == 'T': exit(print("YES")) elif s[u] == '#': exit(print("NO")) if G > T: u = G while u >= 0: check(u) u -= k ...
output
1
81,311
15
162,623
Provide tags and a correct Python 3 solution for this coding contest problem. On the way to Rio de Janeiro Ostap kills time playing with a grasshopper he took with him in a special box. Ostap builds a line of length n such that some cells of this line are empty and some contain obstacles. Then, he places his grasshopp...
instruction
0
81,312
15
162,624
Tags: implementation, strings Correct Solution: ``` def solution(): number = input() seq = input() n = int(number.split()[0]) k = int(number.split()[1]) i = seq.find('T') j = seq.find('G') i, j = min(i, j), max(i, j) while i + k <= j: i += k if seq[i] == '#': ...
output
1
81,312
15
162,625
Provide tags and a correct Python 3 solution for this coding contest problem. On the way to Rio de Janeiro Ostap kills time playing with a grasshopper he took with him in a special box. Ostap builds a line of length n such that some cells of this line are empty and some contain obstacles. Then, he places his grasshopp...
instruction
0
81,313
15
162,626
Tags: implementation, strings Correct Solution: ``` n,k = map(int,input().split()) s = input() T = -1 G = -1 for i in range(len(s)): if(s[i]=='T'): T=i elif(s[i]=='G'): G=i if T<G: while(G>=0): G-=k if(G<0): G+=k print('NO') exit(0) if(s[G]=='#'): print('NO') exit(0) elif(T==G): print('...
output
1
81,313
15
162,627
Provide tags and a correct Python 3 solution for this coding contest problem. On the way to Rio de Janeiro Ostap kills time playing with a grasshopper he took with him in a special box. Ostap builds a line of length n such that some cells of this line are empty and some contain obstacles. Then, he places his grasshopp...
instruction
0
81,314
15
162,628
Tags: implementation, strings Correct Solution: ``` import math from fractions import Fraction as frac MOD = 1e9 + 7 def gcd(a, b): if b == 0: return a return gcd(b, a % b) def lcm(a, b): return a * b // gcd(a, b) def solve(case_no): n, k = map(int, input().split()) s = str(input()) ...
output
1
81,314
15
162,629
Provide tags and a correct Python 3 solution for this coding contest problem. On the way to Rio de Janeiro Ostap kills time playing with a grasshopper he took with him in a special box. Ostap builds a line of length n such that some cells of this line are empty and some contain obstacles. Then, he places his grasshopp...
instruction
0
81,315
15
162,630
Tags: implementation, strings Correct Solution: ``` n,k=map(int,input().split()) arr=list(input()) starting=arr.index("G") end=arr.index("T") if end<starting: starting,end=end,starting i=starting broken=0 while i<=end: if arr[i]=="#": broken+=1 break i+=k if abs(starting-end)%k==0 and broken...
output
1
81,315
15
162,631
Provide tags and a correct Python 3 solution for this coding contest problem. On the way to Rio de Janeiro Ostap kills time playing with a grasshopper he took with him in a special box. Ostap builds a line of length n such that some cells of this line are empty and some contain obstacles. Then, he places his grasshopp...
instruction
0
81,316
15
162,632
Tags: implementation, strings Correct Solution: ``` import sys n, k = map(int, sys.stdin.readline().split()) line = sys.stdin.readline() idx_g = line.index('G') idx_t = line.index('T') idx_max = max(idx_g, idx_t) idx_min = min(idx_g, idx_t) if (idx_max - idx_min) % k != 0: print("NO") sys.exit() for idx in...
output
1
81,316
15
162,633
Provide tags and a correct Python 3 solution for this coding contest problem. On the way to Rio de Janeiro Ostap kills time playing with a grasshopper he took with him in a special box. Ostap builds a line of length n such that some cells of this line are empty and some contain obstacles. Then, he places his grasshopp...
instruction
0
81,317
15
162,634
Tags: implementation, strings Correct Solution: ``` n, k=map(int,input().split()) s=input().strip() m=min(s.index('G'),s.index('T')) flag=0 for i in range(m+k,n,k): if s[i]=='#': flag=1 print("NO") break if s[i]=='G' or s[i]=='T': flag=1 print("YES") break if fla...
output
1
81,317
15
162,635
Provide tags and a correct Python 3 solution for this coding contest problem. On the way to Rio de Janeiro Ostap kills time playing with a grasshopper he took with him in a special box. Ostap builds a line of length n such that some cells of this line are empty and some contain obstacles. Then, he places his grasshopp...
instruction
0
81,318
15
162,636
Tags: implementation, strings Correct Solution: ``` n,m=map(int,input().split()) a=list(input()) if abs(a.index('G')-a.index('T'))%m!=0: print("No") else: i=a.index('G') j=a.index('T') if i>j: flag=0 while i>=j: if a[i]=='#': print("No") flag=1...
output
1
81,318
15
162,637
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. On the way to Rio de Janeiro Ostap kills time playing with a grasshopper he took with him in a special box. Ostap builds a line of length n such that some cells of this line are empty and some c...
instruction
0
81,319
15
162,638
Yes
output
1
81,319
15
162,639
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. On the way to Rio de Janeiro Ostap kills time playing with a grasshopper he took with him in a special box. Ostap builds a line of length n such that some cells of this line are empty and some c...
instruction
0
81,320
15
162,640
Yes
output
1
81,320
15
162,641
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. On the way to Rio de Janeiro Ostap kills time playing with a grasshopper he took with him in a special box. Ostap builds a line of length n such that some cells of this line are empty and some c...
instruction
0
81,321
15
162,642
Yes
output
1
81,321
15
162,643
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. On the way to Rio de Janeiro Ostap kills time playing with a grasshopper he took with him in a special box. Ostap builds a line of length n such that some cells of this line are empty and some c...
instruction
0
81,322
15
162,644
Yes
output
1
81,322
15
162,645
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. On the way to Rio de Janeiro Ostap kills time playing with a grasshopper he took with him in a special box. Ostap builds a line of length n such that some cells of this line are empty and some c...
instruction
0
81,323
15
162,646
No
output
1
81,323
15
162,647
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. On the way to Rio de Janeiro Ostap kills time playing with a grasshopper he took with him in a special box. Ostap builds a line of length n such that some cells of this line are empty and some c...
instruction
0
81,324
15
162,648
No
output
1
81,324
15
162,649
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. On the way to Rio de Janeiro Ostap kills time playing with a grasshopper he took with him in a special box. Ostap builds a line of length n such that some cells of this line are empty and some c...
instruction
0
81,325
15
162,650
No
output
1
81,325
15
162,651
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. On the way to Rio de Janeiro Ostap kills time playing with a grasshopper he took with him in a special box. Ostap builds a line of length n such that some cells of this line are empty and some c...
instruction
0
81,326
15
162,652
No
output
1
81,326
15
162,653
Provide tags and a correct Python 3 solution for this coding contest problem. Alice has a cute cat. To keep her cat fit, Alice wants to design an exercising walk for her cat! Initially, Alice's cat is located in a cell (x,y) of an infinite grid. According to Alice's theory, cat needs to move: * exactly a steps l...
instruction
0
81,838
15
163,676
Tags: greedy, implementation, math Correct Solution: ``` t=int(input()) for i in range(t): a,b,c,d=map(int,input().split()) x,y,x1,y1,x2,y2=map(int,input().split()) x+=b-a y+=d-c if x1<=x and x2>=x and y1<=y and y2>=y and (x1<x2 or a+b==0) and (y1<y2 or c+d==0): print("YES") else: print("NO") ```
output
1
81,838
15
163,677
Provide tags and a correct Python 3 solution for this coding contest problem. Alice has a cute cat. To keep her cat fit, Alice wants to design an exercising walk for her cat! Initially, Alice's cat is located in a cell (x,y) of an infinite grid. According to Alice's theory, cat needs to move: * exactly a steps l...
instruction
0
81,839
15
163,678
Tags: greedy, implementation, math Correct Solution: ``` #!/usr/bin/python3 t = int(input()) for i in range(1, t + 1): a, b, c, d = map(int, input().split()) x, y, x1, y1, x2, y2 = map(int, input().split()) if (x1 == x2 and (a != 0 or b != 0)) or (y1 == y2 and (c != 0 or d != 0)): print("NO") e...
output
1
81,839
15
163,679
Provide tags and a correct Python 3 solution for this coding contest problem. Alice has a cute cat. To keep her cat fit, Alice wants to design an exercising walk for her cat! Initially, Alice's cat is located in a cell (x,y) of an infinite grid. According to Alice's theory, cat needs to move: * exactly a steps l...
instruction
0
81,840
15
163,680
Tags: greedy, implementation, math Correct Solution: ``` import sys def input(): return sys.stdin.readline().strip() def iinput(): return int(input()) def rinput(): return map(int, input().split()) def rlinput(): return list(map(int, input().split())) def main(): def pro(a,b,x,x1,x2): ...
output
1
81,840
15
163,681
Provide tags and a correct Python 3 solution for this coding contest problem. Alice has a cute cat. To keep her cat fit, Alice wants to design an exercising walk for her cat! Initially, Alice's cat is located in a cell (x,y) of an infinite grid. According to Alice's theory, cat needs to move: * exactly a steps l...
instruction
0
81,841
15
163,682
Tags: greedy, implementation, math Correct Solution: ``` import sys input = sys.stdin.readline for _ in range(int(input())): a, b, c, d = map(int, input().split()) sx, sy, ax, ay, bx, by = map(int, input().split()) if (ax == bx and a+b != 0) or (ay == by and c+d != 0): print('no') elif ax <= sx...
output
1
81,841
15
163,683
Provide tags and a correct Python 3 solution for this coding contest problem. Alice has a cute cat. To keep her cat fit, Alice wants to design an exercising walk for her cat! Initially, Alice's cat is located in a cell (x,y) of an infinite grid. According to Alice's theory, cat needs to move: * exactly a steps l...
instruction
0
81,842
15
163,684
Tags: greedy, implementation, math Correct Solution: ``` from sys import stdin import math inp = lambda: stdin.readline().strip() t = int(inp()) for i in range(t): l, r, d, u = [int(x) for x in input().split()] x, y, x1, y1, x2, y2 = [int(x) for x in input().split()] if (r > 0 or l > 0) and x1 - x2 == 0: ...
output
1
81,842
15
163,685
Provide tags and a correct Python 3 solution for this coding contest problem. Alice has a cute cat. To keep her cat fit, Alice wants to design an exercising walk for her cat! Initially, Alice's cat is located in a cell (x,y) of an infinite grid. According to Alice's theory, cat needs to move: * exactly a steps l...
instruction
0
81,843
15
163,686
Tags: greedy, implementation, math Correct Solution: ``` task_number = int(input()) for _ in range(task_number): left, right, down, up = map(int, input().split()) x, y, x1, y1, x2, y2 = map(int, input().split()) left_gap, right_gap, down_gap, up_gap = x-x1, x2-x, y-y1, y2-y if left + right > 0 and left_...
output
1
81,843
15
163,687
Provide tags and a correct Python 3 solution for this coding contest problem. Alice has a cute cat. To keep her cat fit, Alice wants to design an exercising walk for her cat! Initially, Alice's cat is located in a cell (x,y) of an infinite grid. According to Alice's theory, cat needs to move: * exactly a steps l...
instruction
0
81,844
15
163,688
Tags: greedy, implementation, math Correct Solution: ``` for _ in range(int(input())): l,r,d,u = map(int,input().split()) x1,y1,x2,y2,x3,y3 = map(int,input().split()) f=0 if(x1-(l-r)<x2): f=1; if(x1+r-l>x3): f=1; if(y1+u-d<y2): f=1; if(y1+u-d>y3): f=1; if(...
output
1
81,844
15
163,689
Provide tags and a correct Python 3 solution for this coding contest problem. Alice has a cute cat. To keep her cat fit, Alice wants to design an exercising walk for her cat! Initially, Alice's cat is located in a cell (x,y) of an infinite grid. According to Alice's theory, cat needs to move: * exactly a steps l...
instruction
0
81,845
15
163,690
Tags: greedy, implementation, math Correct Solution: ``` import sys input=sys.stdin.readline from math import * mod=10**9+7 def bo(i): return ord(i)-ord('a') t=int(input()) while t>0: t-=1 a,b,c,d=map(int,input().split()) x,y,x1,y1,x2,y2=map(int,input().split()) if x1<=-a+b+x<=x2 and y1<=-c+d+y<=y2 ...
output
1
81,845
15
163,691
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Alice has a cute cat. To keep her cat fit, Alice wants to design an exercising walk for her cat! Initially, Alice's cat is located in a cell (x,y) of an infinite grid. According to Alice's the...
instruction
0
81,846
15
163,692
Yes
output
1
81,846
15
163,693
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Alice has a cute cat. To keep her cat fit, Alice wants to design an exercising walk for her cat! Initially, Alice's cat is located in a cell (x,y) of an infinite grid. According to Alice's the...
instruction
0
81,847
15
163,694
Yes
output
1
81,847
15
163,695
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Alice has a cute cat. To keep her cat fit, Alice wants to design an exercising walk for her cat! Initially, Alice's cat is located in a cell (x,y) of an infinite grid. According to Alice's the...
instruction
0
81,848
15
163,696
Yes
output
1
81,848
15
163,697
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Alice has a cute cat. To keep her cat fit, Alice wants to design an exercising walk for her cat! Initially, Alice's cat is located in a cell (x,y) of an infinite grid. According to Alice's the...
instruction
0
81,849
15
163,698
Yes
output
1
81,849
15
163,699
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Alice has a cute cat. To keep her cat fit, Alice wants to design an exercising walk for her cat! Initially, Alice's cat is located in a cell (x,y) of an infinite grid. According to Alice's the...
instruction
0
81,850
15
163,700
No
output
1
81,850
15
163,701
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Alice has a cute cat. To keep her cat fit, Alice wants to design an exercising walk for her cat! Initially, Alice's cat is located in a cell (x,y) of an infinite grid. According to Alice's the...
instruction
0
81,851
15
163,702
No
output
1
81,851
15
163,703
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Alice has a cute cat. To keep her cat fit, Alice wants to design an exercising walk for her cat! Initially, Alice's cat is located in a cell (x,y) of an infinite grid. According to Alice's the...
instruction
0
81,852
15
163,704
No
output
1
81,852
15
163,705
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Alice has a cute cat. To keep her cat fit, Alice wants to design an exercising walk for her cat! Initially, Alice's cat is located in a cell (x,y) of an infinite grid. According to Alice's the...
instruction
0
81,853
15
163,706
No
output
1
81,853
15
163,707
Provide tags and a correct Python 3 solution for this coding contest problem. There is a square box 6 × 6 in size. It contains 36 chips 1 × 1 in size. Those chips contain 36 different characters — "0"-"9" and "A"-"Z". There is exactly one chip with each character. You are allowed to make the following operations: you...
instruction
0
82,226
15
164,452
Tags: constructive algorithms Correct Solution: ``` ls="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ" s,cnt,a1,a2=[],0,[],[] for i in range(6): s.append(list(input())) def add(c,i): global cnt cnt+=1 a1.append(c) a2.append(i) def right(i): add('R',i+1) tmp=s[i][5] for j in range(5,0,-1): s[i][j]=s[i][j-1] s[i][0]=...
output
1
82,226
15
164,453
Provide a correct Python 3 solution for this coding contest problem. There is a frog living in a big pond. He loves jumping between lotus leaves floating on the pond. Interestingly, these leaves have strange habits. First, a leaf will sink into the water after the frog jumps from it. Second, they are aligned regularly...
instruction
0
82,523
15
165,046
"Correct Solution: ``` import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools sys.setrecursionlimit(10**7) inf = 10**20 eps = 1.0 / 10**13 mod = 10**9+7 dd = [(-1,0),(0,1),(1,0),(0,-1)] ddn = [(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)] def LI(): return [int...
output
1
82,523
15
165,047
Provide a correct Python 3 solution for this coding contest problem. The goal of 8 Queens Problem is to put eight queens on a chess-board such that none of them threatens any of others. A queen threatens the squares in the same row, in the same column, or on the same diagonals as shown in the following figure. <image...
instruction
0
82,528
15
165,056
"Correct Solution: ``` N = 8 flag_row = [False]*N flag_col = [False]*N flag_diag_right = [False]*(2*N-1) flag_diag_left = [False]*(2*N-1) B = [ [False for n in range(N)] for n in range(N)] def ShowBoard(): for i in range(N): for j in range(N): if B[i][j] : if flag_row[i] != j: ...
output
1
82,528
15
165,057
Provide a correct Python 3 solution for this coding contest problem. The goal of 8 Queens Problem is to put eight queens on a chess-board such that none of them threatens any of others. A queen threatens the squares in the same row, in the same column, or on the same diagonals as shown in the following figure. <image...
instruction
0
82,529
15
165,058
"Correct Solution: ``` import itertools k = int(input()) X = sorted([list(map(int, input().split())) for _ in range(k)]) for l in list(itertools.permutations(range(8))): flag = True for x in X: if l[x[0]] != x[1]: flag = False if flag: flag2= True check = [] for i in range(8): for j i...
output
1
82,529
15
165,059
Provide a correct Python 3 solution for this coding contest problem. The goal of 8 Queens Problem is to put eight queens on a chess-board such that none of them threatens any of others. A queen threatens the squares in the same row, in the same column, or on the same diagonals as shown in the following figure. <image...
instruction
0
82,530
15
165,060
"Correct Solution: ``` N = 8 FREE = -1 NOT_FREE = 1 def printBoard(): for i in range(N): for j in range(N): if X[i][j]: if not Y[i][j]: return for i in range(N): for j in range(N): if Y[i][j]: print("Q", end = "") ...
output
1
82,530
15
165,061
Provide a correct Python 3 solution for this coding contest problem. The goal of 8 Queens Problem is to put eight queens on a chess-board such that none of them threatens any of others. A queen threatens the squares in the same row, in the same column, or on the same diagonals as shown in the following figure. <image...
instruction
0
82,531
15
165,062
"Correct Solution: ``` from itertools import permutations import sys read = sys.stdin.read readline = sys.stdin.readline readlines = sys.stdin.readlines def main(): k,*rc = map(int, read().split()) tmp = [] ng_list_add = [] ng_list_sub = [] for pattern in permutations(range(8)): flag = Tru...
output
1
82,531
15
165,063
Provide a correct Python 3 solution for this coding contest problem. The goal of 8 Queens Problem is to put eight queens on a chess-board such that none of them threatens any of others. A queen threatens the squares in the same row, in the same column, or on the same diagonals as shown in the following figure. <image...
instruction
0
82,532
15
165,064
"Correct Solution: ``` import itertools K=int(input()) R=[] C=[] RCd={} rflag=[ 0 for _ in range(8) ] for i in range(K): r,c=map(int,input().split()) R.append(r) C.append(c) RCd[r]=c rflag[r]=1 l=[ i for i in range(8) ] P=itertools.permutations(l,8) for p in P: p=list(p) flag=0 for i in range(8): i...
output
1
82,532
15
165,065
Provide a correct Python 3 solution for this coding contest problem. The goal of 8 Queens Problem is to put eight queens on a chess-board such that none of them threatens any of others. A queen threatens the squares in the same row, in the same column, or on the same diagonals as shown in the following figure. <image...
instruction
0
82,533
15
165,066
"Correct Solution: ``` import copy as cp N = 8 ans = [] def out(M): for i in range(N): for j in range(N): print(M[i][j], end="") print("") def DFS(r,c,dp,dn,qn): global ans if qn == N: for h in range(N): for w in range(N): if r[h] & c[w] ...
output
1
82,533
15
165,067
Provide a correct Python 3 solution for this coding contest problem. The goal of 8 Queens Problem is to put eight queens on a chess-board such that none of them threatens any of others. A queen threatens the squares in the same row, in the same column, or on the same diagonals as shown in the following figure. <image...
instruction
0
82,534
15
165,068
"Correct Solution: ``` # -*- coding: utf-8 -*- if __name__ == '__main__': N = 8 FREE = -1 NOT_FREE = 1 row = [FREE] * N col = [FREE] * N dpos = [FREE] * (2 * N - 1) dneg = [FREE] * (2 * N - 1) X = [["." for _ in range(N)] for _ in range(N)] k = int(input()) for _ in range(k):...
output
1
82,534
15
165,069
Provide a correct Python 3 solution for this coding contest problem. The goal of 8 Queens Problem is to put eight queens on a chess-board such that none of them threatens any of others. A queen threatens the squares in the same row, in the same column, or on the same diagonals as shown in the following figure. <image...
instruction
0
82,535
15
165,070
"Correct Solution: ``` from itertools import permutations BLANK = 0 Q = 1 WALL = 2 def to_board_pos(x, y): return x * 10 + y def place_queen(pos, board): assert board[pos] != WALL if board[pos] == Q: return False, None board[pos] = Q directions = [-10, -9, 1, 11, 10, 9, -1, -11] for ...
output
1
82,535
15
165,071
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. The goal of 8 Queens Problem is to put eight queens on a chess-board such that none of them threatens any of others. A queen threatens the squares in the same row, in the same column, or on the ...
instruction
0
82,536
15
165,072
Yes
output
1
82,536
15
165,073