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. Mikhail walks on a Cartesian plane. He starts at the point (0, 0), and in one move he can go to any of eight adjacent points. For example, if Mikhail is currently at the point (0, 0), he can go ...
instruction
0
27,409
15
54,818
No
output
1
27,409
15
54,819
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Mikhail walks on a Cartesian plane. He starts at the point (0, 0), and in one move he can go to any of eight adjacent points. For example, if Mikhail is currently at the point (0, 0), he can go ...
instruction
0
27,410
15
54,820
No
output
1
27,410
15
54,821
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Mikhail walks on a Cartesian plane. He starts at the point (0, 0), and in one move he can go to any of eight adjacent points. For example, if Mikhail is currently at the point (0, 0), he can go ...
instruction
0
27,411
15
54,822
No
output
1
27,411
15
54,823
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Mikhail walks on a Cartesian plane. He starts at the point (0, 0), and in one move he can go to any of eight adjacent points. For example, if Mikhail is currently at the point (0, 0), he can go ...
instruction
0
27,412
15
54,824
No
output
1
27,412
15
54,825
Provide tags and a correct Python 3 solution for this coding contest problem. You are given a board of size n Γ— n, where n is odd (not divisible by 2). Initially, each cell of the board contains one figure. In one move, you can select exactly one figure presented in some cell and move it to one of the cells sharing a...
instruction
0
27,568
15
55,136
Tags: math Correct Solution: ``` for _ in range(int(input())): n=int(input()) print( (n**2-1)*n//3) ```
output
1
27,568
15
55,137
Provide tags and a correct Python 3 solution for this coding contest problem. You are given a board of size n Γ— n, where n is odd (not divisible by 2). Initially, each cell of the board contains one figure. In one move, you can select exactly one figure presented in some cell and move it to one of the cells sharing a...
instruction
0
27,569
15
55,138
Tags: math Correct Solution: ``` N = 5*(10**5)+1 dp = [0 for i in range(N)] dp[1] = 0 for i in range(3,N,2): dp[i] = dp[i-2]+8*(i//2)*(i//2) t = int(input()) for y in range(t): n = int(input()) print(dp[n]) ```
output
1
27,569
15
55,139
Provide tags and a correct Python 3 solution for this coding contest problem. You are given a board of size n Γ— n, where n is odd (not divisible by 2). Initially, each cell of the board contains one figure. In one move, you can select exactly one figure presented in some cell and move it to one of the cells sharing a...
instruction
0
27,570
15
55,140
Tags: math Correct Solution: ``` t = int(input()) for z in range(t): n = int(input()) a = 3 b = 1 s = 0 for i in range(1,n//2+1): s += i*(a+b) a = a+2 b = b+2 print(2*s) ```
output
1
27,570
15
55,141
Provide tags and a correct Python 3 solution for this coding contest problem. You are given a board of size n Γ— n, where n is odd (not divisible by 2). Initially, each cell of the board contains one figure. In one move, you can select exactly one figure presented in some cell and move it to one of the cells sharing a...
instruction
0
27,571
15
55,142
Tags: math Correct Solution: ``` t=int(input()); while t>0: n=int(input()); sum=0; for i in range(0,int(n/2)): sum += 8*(i+1)*(i+1); print(sum); t=t-1; ```
output
1
27,571
15
55,143
Provide tags and a correct Python 3 solution for this coding contest problem. You are given a board of size n Γ— n, where n is odd (not divisible by 2). Initially, each cell of the board contains one figure. In one move, you can select exactly one figure presented in some cell and move it to one of the cells sharing a...
instruction
0
27,572
15
55,144
Tags: math Correct Solution: ``` import sys input = sys.stdin.readline t = int(input()) for _ in range(t): n = int(input()) ans = 0 for i in range(n//2+1): ans+=i*4*2*i print(ans) ```
output
1
27,572
15
55,145
Provide tags and a correct Python 3 solution for this coding contest problem. You are given a board of size n Γ— n, where n is odd (not divisible by 2). Initially, each cell of the board contains one figure. In one move, you can select exactly one figure presented in some cell and move it to one of the cells sharing a...
instruction
0
27,573
15
55,146
Tags: math Correct Solution: ``` t = int(input()) while(t): n=int(input()) ans = 0 ck= n//2+1 for i in range(1,ck+1): num = 4*(n-2*(i-1))-4 num*=(abs(i-n//2-1))*1 ans+=num print(ans) t-=1 ```
output
1
27,573
15
55,147
Provide tags and a correct Python 3 solution for this coding contest problem. You are given a board of size n Γ— n, where n is odd (not divisible by 2). Initially, each cell of the board contains one figure. In one move, you can select exactly one figure presented in some cell and move it to one of the cells sharing a...
instruction
0
27,574
15
55,148
Tags: math Correct Solution: ``` t=int(input()) while(t): i=1 n=int(input()) sum=0 while(i<n): sum = sum + ((i + 2) * (i + 2) - (i * i)) * ((i + 1) / 2) i=i+2 t-=1 print('%d' % sum) ```
output
1
27,574
15
55,149
Provide tags and a correct Python 3 solution for this coding contest problem. You are given a board of size n Γ— n, where n is odd (not divisible by 2). Initially, each cell of the board contains one figure. In one move, you can select exactly one figure presented in some cell and move it to one of the cells sharing a...
instruction
0
27,575
15
55,150
Tags: math Correct Solution: ``` t = int(input()) for _ in range(t): n = int(input()) dp = [0, 0] for i in range(2, n+1): if i%2 == 0: dp.append(0) else: dp.append((4*i-4)*(i//2)+dp[-2]) print(dp[-1]) ```
output
1
27,575
15
55,151
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. You are given a board of size n Γ— n, where n is odd (not divisible by 2). Initially, each cell of the board contains one figure. In one move, you can select exactly one figure presented in some...
instruction
0
27,576
15
55,152
Yes
output
1
27,576
15
55,153
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. You are given a board of size n Γ— n, where n is odd (not divisible by 2). Initially, each cell of the board contains one figure. In one move, you can select exactly one figure presented in some...
instruction
0
27,577
15
55,154
Yes
output
1
27,577
15
55,155
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. You are given a board of size n Γ— n, where n is odd (not divisible by 2). Initially, each cell of the board contains one figure. In one move, you can select exactly one figure presented in some...
instruction
0
27,578
15
55,156
Yes
output
1
27,578
15
55,157
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. You are given a board of size n Γ— n, where n is odd (not divisible by 2). Initially, each cell of the board contains one figure. In one move, you can select exactly one figure presented in some...
instruction
0
27,579
15
55,158
Yes
output
1
27,579
15
55,159
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. You are given a board of size n Γ— n, where n is odd (not divisible by 2). Initially, each cell of the board contains one figure. In one move, you can select exactly one figure presented in some...
instruction
0
27,580
15
55,160
No
output
1
27,580
15
55,161
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. You are given a board of size n Γ— n, where n is odd (not divisible by 2). Initially, each cell of the board contains one figure. In one move, you can select exactly one figure presented in some...
instruction
0
27,581
15
55,162
No
output
1
27,581
15
55,163
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. You are given a board of size n Γ— n, where n is odd (not divisible by 2). Initially, each cell of the board contains one figure. In one move, you can select exactly one figure presented in some...
instruction
0
27,582
15
55,164
No
output
1
27,582
15
55,165
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. You are given a board of size n Γ— n, where n is odd (not divisible by 2). Initially, each cell of the board contains one figure. In one move, you can select exactly one figure presented in some...
instruction
0
27,583
15
55,166
No
output
1
27,583
15
55,167
Provide tags and a correct Python 3 solution for this coding contest problem. Artem is building a new robot. He has a matrix a consisting of n rows and m columns. The cell located on the i-th row from the top and the j-th column from the left has a value a_{i,j} written in it. If two adjacent cells contain the same ...
instruction
0
27,633
15
55,266
Tags: 2-sat, chinese remainder theorem, constructive algorithms, fft, flows Correct Solution: ``` for _ in range(int(input())): n, m = map(int, input().split()) mat = [] for i in range(n): row = list(map(int, input().split())) mat.append(row) for i in range(n): for j in range(m):...
output
1
27,633
15
55,267
Provide tags and a correct Python 3 solution for this coding contest problem. Artem is building a new robot. He has a matrix a consisting of n rows and m columns. The cell located on the i-th row from the top and the j-th column from the left has a value a_{i,j} written in it. If two adjacent cells contain the same ...
instruction
0
27,634
15
55,268
Tags: 2-sat, chinese remainder theorem, constructive algorithms, fft, flows Correct Solution: ``` import time,math as mt,bisect as bs,sys from sys import stdin,stdout from collections import deque from collections import defaultdict from fractions import Fraction from collections import Counter from collections import ...
output
1
27,634
15
55,269
Provide tags and a correct Python 3 solution for this coding contest problem. Artem is building a new robot. He has a matrix a consisting of n rows and m columns. The cell located on the i-th row from the top and the j-th column from the left has a value a_{i,j} written in it. If two adjacent cells contain the same ...
instruction
0
27,635
15
55,270
Tags: 2-sat, chinese remainder theorem, constructive algorithms, fft, flows Correct Solution: ``` import sys def input(): return sys.stdin.readline() dif = [(-1, 0), (1, 0), (0, 1), (0, -1)] def solve(): m, n = map(int, input().split()) matrix = [list(map(int, input().split())) for i in range(m)] ...
output
1
27,635
15
55,271
Provide tags and a correct Python 3 solution for this coding contest problem. Artem is building a new robot. He has a matrix a consisting of n rows and m columns. The cell located on the i-th row from the top and the j-th column from the left has a value a_{i,j} written in it. If two adjacent cells contain the same ...
instruction
0
27,636
15
55,272
Tags: 2-sat, chinese remainder theorem, constructive algorithms, fft, flows Correct Solution: ``` from __future__ import division, print_function import os,sys from io import BytesIO, IOBase if sys.version_info[0] < 3: from __builtin__ import xrange as range from future_builtins import ascii, filter, hex, map...
output
1
27,636
15
55,273
Provide tags and a correct Python 3 solution for this coding contest problem. Artem is building a new robot. He has a matrix a consisting of n rows and m columns. The cell located on the i-th row from the top and the j-th column from the left has a value a_{i,j} written in it. If two adjacent cells contain the same ...
instruction
0
27,637
15
55,274
Tags: 2-sat, chinese remainder theorem, constructive algorithms, fft, flows Correct Solution: ``` t=int(input()) ad=[(1,0),(0,1),(-1,0),(0,-1)] def aze(x,y): if x<n and x>-1 and y<m and y>-1: return(True) return(False) print() def dfs(k): q=[k] while q: x=q.pop() i,j=x//m,x%m for w in ad: ip,jp=i+w[0],j...
output
1
27,637
15
55,275
Provide tags and a correct Python 3 solution for this coding contest problem. Artem is building a new robot. He has a matrix a consisting of n rows and m columns. The cell located on the i-th row from the top and the j-th column from the left has a value a_{i,j} written in it. If two adjacent cells contain the same ...
instruction
0
27,638
15
55,276
Tags: 2-sat, chinese remainder theorem, constructive algorithms, fft, flows Correct Solution: ``` from math import * from sys import * t=int(stdin.readline()) for _ in range(t): n, k = map(int, stdin.readline().split()) a=[] for i in range(n): m = list(map(int, stdin.readline().split())) a.a...
output
1
27,638
15
55,277
Provide tags and a correct Python 3 solution for this coding contest problem. Artem is building a new robot. He has a matrix a consisting of n rows and m columns. The cell located on the i-th row from the top and the j-th column from the left has a value a_{i,j} written in it. If two adjacent cells contain the same ...
instruction
0
27,639
15
55,278
Tags: 2-sat, chinese remainder theorem, constructive algorithms, fft, flows Correct Solution: ``` from sys import stdin, stdout t=int(stdin.readline()) for _ in range(t): n,m=map(int,stdin.readline().split()) arr=[] for _ in range(n): arr.append(list(map(int,stdin.readline().split()))) for i in range(n): for j ...
output
1
27,639
15
55,279
Provide tags and a correct Python 3 solution for this coding contest problem. Artem is building a new robot. He has a matrix a consisting of n rows and m columns. The cell located on the i-th row from the top and the j-th column from the left has a value a_{i,j} written in it. If two adjacent cells contain the same ...
instruction
0
27,640
15
55,280
Tags: 2-sat, chinese remainder theorem, constructive algorithms, fft, flows Correct Solution: ``` for _ in range(int(input())): n, m = list(map(int, input().split())) a = [] for i in range(n): a.append(list(map(int, input().split()))) for i in range(n): for r in range(m): if ...
output
1
27,640
15
55,281
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Artem is building a new robot. He has a matrix a consisting of n rows and m columns. The cell located on the i-th row from the top and the j-th column from the left has a value a_{i,j} written i...
instruction
0
27,641
15
55,282
Yes
output
1
27,641
15
55,283
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Artem is building a new robot. He has a matrix a consisting of n rows and m columns. The cell located on the i-th row from the top and the j-th column from the left has a value a_{i,j} written i...
instruction
0
27,642
15
55,284
Yes
output
1
27,642
15
55,285
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Artem is building a new robot. He has a matrix a consisting of n rows and m columns. The cell located on the i-th row from the top and the j-th column from the left has a value a_{i,j} written i...
instruction
0
27,643
15
55,286
Yes
output
1
27,643
15
55,287
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Artem is building a new robot. He has a matrix a consisting of n rows and m columns. The cell located on the i-th row from the top and the j-th column from the left has a value a_{i,j} written i...
instruction
0
27,644
15
55,288
Yes
output
1
27,644
15
55,289
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Artem is building a new robot. He has a matrix a consisting of n rows and m columns. The cell located on the i-th row from the top and the j-th column from the left has a value a_{i,j} written i...
instruction
0
27,645
15
55,290
No
output
1
27,645
15
55,291
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Artem is building a new robot. He has a matrix a consisting of n rows and m columns. The cell located on the i-th row from the top and the j-th column from the left has a value a_{i,j} written i...
instruction
0
27,646
15
55,292
No
output
1
27,646
15
55,293
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Artem is building a new robot. He has a matrix a consisting of n rows and m columns. The cell located on the i-th row from the top and the j-th column from the left has a value a_{i,j} written i...
instruction
0
27,647
15
55,294
No
output
1
27,647
15
55,295
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Artem is building a new robot. He has a matrix a consisting of n rows and m columns. The cell located on the i-th row from the top and the j-th column from the left has a value a_{i,j} written i...
instruction
0
27,648
15
55,296
No
output
1
27,648
15
55,297
Provide tags and a correct Python 3 solution for this coding contest problem. Little Elephant loves magic squares very much. A magic square is a 3 Γ— 3 table, each cell contains some positive integer. At that the sums of integers in all rows, columns and diagonals of the table are equal. The figure below shows the mag...
instruction
0
27,732
15
55,464
Tags: brute force, implementation Correct Solution: ``` def main(): def is_valid(grid): if sum(grid[0]) != sum(grid[1]) or sum(grid[1]) != sum(grid[2]): return False if grid[0][0] + grid[1][1] + grid[2][2] != grid[0][2] + grid[1][1] + grid[2][0]: return False return T...
output
1
27,732
15
55,465
Provide tags and a correct Python 3 solution for this coding contest problem. Pavel loves grid mazes. A grid maze is an n Γ— m rectangle maze where each cell is either empty, or is a wall. You can go from one cell to another only if both cells are empty and have a common side. Pavel drew a grid maze with all empty cel...
instruction
0
27,784
15
55,568
Tags: dfs and similar Correct Solution: ``` from collections import deque,namedtuple dx = [0,0,1,-1] dy = [1,-1,0,0] def main(): n,m,limit = map(int,input().split()) a,sx,sy,tot = [],0,0,0 for i in range(n): s,t = input(),[] for j,c in enumerate(s): if c == '.': ...
output
1
27,784
15
55,569
Provide tags and a correct Python 3 solution for this coding contest problem. Pavel loves grid mazes. A grid maze is an n Γ— m rectangle maze where each cell is either empty, or is a wall. You can go from one cell to another only if both cells are empty and have a common side. Pavel drew a grid maze with all empty cel...
instruction
0
27,785
15
55,570
Tags: dfs and similar Correct Solution: ``` class Queue: def __init__(self): self.list = [] def push(self, value): self.list.append(value) def pop(self): return self.list.pop(0) def top(self): return self.list[0] def empty(self): return len(self.list) == 0 class Cell: def __init__(self, row, column...
output
1
27,785
15
55,571
Provide tags and a correct Python 3 solution for this coding contest problem. Pavel loves grid mazes. A grid maze is an n Γ— m rectangle maze where each cell is either empty, or is a wall. You can go from one cell to another only if both cells are empty and have a common side. Pavel drew a grid maze with all empty cel...
instruction
0
27,786
15
55,572
Tags: dfs and similar Correct Solution: ``` #: Author - Soumya Saurav import sys,io,os,time from collections import defaultdict from collections import Counter from collections import deque from itertools import combinations from itertools import permutations import bisect,math,heapq alphabet = "abcdefghijklmnopqrstuvw...
output
1
27,786
15
55,573
Provide tags and a correct Python 3 solution for this coding contest problem. Pavel loves grid mazes. A grid maze is an n Γ— m rectangle maze where each cell is either empty, or is a wall. You can go from one cell to another only if both cells are empty and have a common side. Pavel drew a grid maze with all empty cel...
instruction
0
27,787
15
55,574
Tags: dfs and similar Correct Solution: ``` import sys import threading n,m,k = map(int,input().split()) matrix = [] for i in range(n): row = input() r=[] for j in range(len(row)): r.append(row[j]) matrix.append(r) number_of_empty_cell = 0 global count count = 0 for i in range(n): for j i...
output
1
27,787
15
55,575
Provide tags and a correct Python 3 solution for this coding contest problem. Pavel loves grid mazes. A grid maze is an n Γ— m rectangle maze where each cell is either empty, or is a wall. You can go from one cell to another only if both cells are empty and have a common side. Pavel drew a grid maze with all empty cel...
instruction
0
27,788
15
55,576
Tags: dfs and similar Correct Solution: ``` from collections import deque,namedtuple dx = [0,0,1,-1] dy = [1,-1,0,0] def main(): n,m,limit = map(int,input().split()) a,sx,sy,tot = [],0,0,0 for i in range(n): s,t = input(),[] for j,c in enumerate(s): if c == '.': ...
output
1
27,788
15
55,577
Provide tags and a correct Python 3 solution for this coding contest problem. Pavel loves grid mazes. A grid maze is an n Γ— m rectangle maze where each cell is either empty, or is a wall. You can go from one cell to another only if both cells are empty and have a common side. Pavel drew a grid maze with all empty cel...
instruction
0
27,789
15
55,578
Tags: dfs and similar Correct Solution: ``` import sys reader = (line.rstrip() for line in sys.stdin) input = reader.__next__ def getInts(): return [int(s) for s in input().split()] def getInt(): return int(input()) def getStrs(): return [s for s in input().split()] def getStr(): return input() ...
output
1
27,789
15
55,579
Provide tags and a correct Python 3 solution for this coding contest problem. Pavel loves grid mazes. A grid maze is an n Γ— m rectangle maze where each cell is either empty, or is a wall. You can go from one cell to another only if both cells are empty and have a common side. Pavel drew a grid maze with all empty cel...
instruction
0
27,790
15
55,580
Tags: dfs and similar Correct Solution: ``` from sys import stdin from collections import * def arr_inp(n): if n == 1: return [int(x) for x in stdin.readline().split()] elif n == 2: return [float(x) for x in stdin.readline().split()] else: return list(stdin.readline()[:-1]) def v...
output
1
27,790
15
55,581
Provide tags and a correct Python 3 solution for this coding contest problem. Pavel loves grid mazes. A grid maze is an n Γ— m rectangle maze where each cell is either empty, or is a wall. You can go from one cell to another only if both cells are empty and have a common side. Pavel drew a grid maze with all empty cel...
instruction
0
27,791
15
55,582
Tags: dfs and similar Correct Solution: ``` def solve(): n,m,k=map(int,input().split()) Maze=[list(input())for row in range(n)] bfs(Maze,n,m,k) print("\n".join("".join(row) for row in Maze)) def bfs(M,n,m,k): r,c=findEmptyCell(M) visited=[[False for col in range(m)]for row in range(n)] visit...
output
1
27,791
15
55,583
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Pavel loves grid mazes. A grid maze is an n Γ— m rectangle maze where each cell is either empty, or is a wall. You can go from one cell to another only if both cells are empty and have a common s...
instruction
0
27,792
15
55,584
Yes
output
1
27,792
15
55,585
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Pavel loves grid mazes. A grid maze is an n Γ— m rectangle maze where each cell is either empty, or is a wall. You can go from one cell to another only if both cells are empty and have a common s...
instruction
0
27,793
15
55,586
Yes
output
1
27,793
15
55,587
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Pavel loves grid mazes. A grid maze is an n Γ— m rectangle maze where each cell is either empty, or is a wall. You can go from one cell to another only if both cells are empty and have a common s...
instruction
0
27,794
15
55,588
Yes
output
1
27,794
15
55,589
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Pavel loves grid mazes. A grid maze is an n Γ— m rectangle maze where each cell is either empty, or is a wall. You can go from one cell to another only if both cells are empty and have a common s...
instruction
0
27,795
15
55,590
Yes
output
1
27,795
15
55,591
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Pavel loves grid mazes. A grid maze is an n Γ— m rectangle maze where each cell is either empty, or is a wall. You can go from one cell to another only if both cells are empty and have a common s...
instruction
0
27,796
15
55,592
No
output
1
27,796
15
55,593