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. All of us love treasures, right? That's why young Vasya is heading for a Treasure Island. Treasure Island may be represented as a rectangular table n Γ— m which is surrounded by the ocean. Let us number rows of the field with consecutive int...
instruction
0
107,937
15
215,874
Tags: dfs and similar, dp, flows, hashing Correct Solution: ``` import sys input = sys.stdin.readline n,m=map(int,input().split()) MAP=[list(input().strip()) for i in range(n)] from collections import deque Q=deque() Q.append([0,0]) while Q: x,y=Q.pop() if x+1<n and MAP[x+1][y]==".": MAP[x+1][y]=1 ...
output
1
107,937
15
215,875
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. All of us love treasures, right? That's why young Vasya is heading for a Treasure Island. Treasure Island may be represented as a rectangular table n Γ— m which is surrounded by the ocean. Let u...
instruction
0
107,938
15
215,876
Yes
output
1
107,938
15
215,877
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. All of us love treasures, right? That's why young Vasya is heading for a Treasure Island. Treasure Island may be represented as a rectangular table n Γ— m which is surrounded by the ocean. Let u...
instruction
0
107,939
15
215,878
Yes
output
1
107,939
15
215,879
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. All of us love treasures, right? That's why young Vasya is heading for a Treasure Island. Treasure Island may be represented as a rectangular table n Γ— m which is surrounded by the ocean. Let u...
instruction
0
107,940
15
215,880
Yes
output
1
107,940
15
215,881
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. All of us love treasures, right? That's why young Vasya is heading for a Treasure Island. Treasure Island may be represented as a rectangular table n Γ— m which is surrounded by the ocean. Let u...
instruction
0
107,941
15
215,882
Yes
output
1
107,941
15
215,883
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. All of us love treasures, right? That's why young Vasya is heading for a Treasure Island. Treasure Island may be represented as a rectangular table n Γ— m which is surrounded by the ocean. Let u...
instruction
0
107,942
15
215,884
No
output
1
107,942
15
215,885
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. All of us love treasures, right? That's why young Vasya is heading for a Treasure Island. Treasure Island may be represented as a rectangular table n Γ— m which is surrounded by the ocean. Let u...
instruction
0
107,943
15
215,886
No
output
1
107,943
15
215,887
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. All of us love treasures, right? That's why young Vasya is heading for a Treasure Island. Treasure Island may be represented as a rectangular table n Γ— m which is surrounded by the ocean. Let u...
instruction
0
107,944
15
215,888
No
output
1
107,944
15
215,889
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. All of us love treasures, right? That's why young Vasya is heading for a Treasure Island. Treasure Island may be represented as a rectangular table n Γ— m which is surrounded by the ocean. Let u...
instruction
0
107,945
15
215,890
No
output
1
107,945
15
215,891
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Consider a square grid with h rows and w columns with some dominoes on it. Each domino covers exactly two cells of the grid that share a common side. Every cell is covered by at most one domino....
instruction
0
107,946
15
215,892
No
output
1
107,946
15
215,893
Provide tags and a correct Python 3 solution for this coding contest problem. In this task Anna and Maria play a game with a very unpleasant rival. Anna and Maria are in the opposite squares of a chessboard (8 Γ— 8): Anna is in the upper right corner, and Maria is in the lower left one. Apart from them, the board has s...
instruction
0
107,968
15
215,936
Tags: dfs and similar Correct Solution: ``` from itertools import product from queue import Queue BOARD_SIZE = 10 OCC, EMPTY = 1, 0 VISITED = 2 board = [input() for _ in range(8)] graph = [] for _ in range(BOARD_SIZE): graph += [[[EMPTY for _ in range(BOARD_SIZE)] for _ in range(BOARD_SIZE)]] for i, j in product(r...
output
1
107,968
15
215,937
Provide tags and a correct Python 3 solution for this coding contest problem. In this task Anna and Maria play a game with a very unpleasant rival. Anna and Maria are in the opposite squares of a chessboard (8 Γ— 8): Anna is in the upper right corner, and Maria is in the lower left one. Apart from them, the board has s...
instruction
0
107,969
15
215,938
Tags: dfs and similar Correct Solution: ``` start=[] for i in range(8): start.append(input()) a=[start] #start=[".......A","........","........","........","........",".SSSSSSS","S.......","M......."] #a=[start] for i in range(10): tmp=a[-1] tmp=[".......A"]+tmp tmp[1]=tmp[1][:-1]+"." a.append(tmp[:-1...
output
1
107,969
15
215,939
Provide tags and a correct Python 3 solution for this coding contest problem. In this task Anna and Maria play a game with a very unpleasant rival. Anna and Maria are in the opposite squares of a chessboard (8 Γ— 8): Anna is in the upper right corner, and Maria is in the lower left one. Apart from them, the board has s...
instruction
0
107,970
15
215,940
Tags: dfs and similar Correct Solution: ``` from sys import stdin from collections import * from copy import deepcopy def valid(i, j): n, m = [8] * 2 return i > -1 and i < n and j > -1 and j < m def str_inp(n): return list(reversed(list((list(stdin.readline()[:-1]) for x in range(n))))) def check(x, y...
output
1
107,970
15
215,941
Provide tags and a correct Python 3 solution for this coding contest problem. In this task Anna and Maria play a game with a very unpleasant rival. Anna and Maria are in the opposite squares of a chessboard (8 Γ— 8): Anna is in the upper right corner, and Maria is in the lower left one. Apart from them, the board has s...
instruction
0
107,971
15
215,942
Tags: dfs and similar Correct Solution: ``` f = [] for i in range(8): f.append(input()) d = [[[0 for i in range(8)] for j in range(8)] for k in range(100)] d[0][7][0] = 1 dx = [1, 1, 1, 0, 0, -1, -1, -1, 0] dy = [1, 0, -1, 1, -1, 1, 0, -1, 0] ans = 'LOSE' for i in range(99): for x in range(8): for y ...
output
1
107,971
15
215,943
Provide tags and a correct Python 3 solution for this coding contest problem. In this task Anna and Maria play a game with a very unpleasant rival. Anna and Maria are in the opposite squares of a chessboard (8 Γ— 8): Anna is in the upper right corner, and Maria is in the lower left one. Apart from them, the board has s...
instruction
0
107,972
15
215,944
Tags: dfs and similar Correct Solution: ``` grid = [ list(input().strip()) for r in range(8) ] grid[0][7] = '.' grid[7][0] = '.' mark = [ [ False for c in range(8) ] for r in range(8) ] mark[7][0] = True def display_grid(): print('\n'.join(map(lambda row: ''.join(row), grid))) print() def display_mark(): ...
output
1
107,972
15
215,945
Provide tags and a correct Python 3 solution for this coding contest problem. In this task Anna and Maria play a game with a very unpleasant rival. Anna and Maria are in the opposite squares of a chessboard (8 Γ— 8): Anna is in the upper right corner, and Maria is in the lower left one. Apart from them, the board has s...
instruction
0
107,973
15
215,946
Tags: dfs and similar Correct Solution: ``` r, s = [63], ''.join(input() + 'T' for i in range(8)) + 'T' * 9 for i in range(0, 72, 9): t = set() for x in r: for y in (x, x - 1, x + 1, x - 9, x + 9, x - 10, x - 8, x + 10, x + 8): if s[y] == 'T': continue if (y < i or s[y - i] != 'S...
output
1
107,973
15
215,947
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. In this task Anna and Maria play a game with a very unpleasant rival. Anna and Maria are in the opposite squares of a chessboard (8 Γ— 8): Anna is in the upper right corner, and Maria is in the l...
instruction
0
107,974
15
215,948
No
output
1
107,974
15
215,949
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. In this task Anna and Maria play a game with a very unpleasant rival. Anna and Maria are in the opposite squares of a chessboard (8 Γ— 8): Anna is in the upper right corner, and Maria is in the l...
instruction
0
107,975
15
215,950
No
output
1
107,975
15
215,951
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. In this task Anna and Maria play a game with a very unpleasant rival. Anna and Maria are in the opposite squares of a chessboard (8 Γ— 8): Anna is in the upper right corner, and Maria is in the l...
instruction
0
107,976
15
215,952
No
output
1
107,976
15
215,953
Provide tags and a correct Python 3 solution for this coding contest problem. The Smart Beaver from ABBYY got hooked on square matrices. Now he is busy studying an n Γ— n size matrix, where n is odd. The Smart Beaver considers the following matrix elements good: * Elements of the main diagonal. * Elements of the...
instruction
0
108,114
15
216,228
Tags: implementation Correct Solution: ``` n = int(input()) matrix = [[0] * n] * n for i in range(n): a = list(map(int, input().split(' '))) matrix[i] = a ans = 0 for i in range(n): for j in range(n): if i == n // 2 or j == n // 2 or i == j or i + j == n - 1: ans += matrix[i][j] print(a...
output
1
108,114
15
216,229
Provide tags and a correct Python 3 solution for this coding contest problem. The Smart Beaver from ABBYY got hooked on square matrices. Now he is busy studying an n Γ— n size matrix, where n is odd. The Smart Beaver considers the following matrix elements good: * Elements of the main diagonal. * Elements of the...
instruction
0
108,115
15
216,230
Tags: implementation Correct Solution: ``` n=int(input()) if n==1: print(int(input())) else: g=[] for i in range(n): g.append(list(map(int,input().split()))) x=n//2 count=sum(g[x]) for i in range(n): count+=g[i][x] count+=g[i][i]+g[i][n-1-i] count-=g[x][x]*3 print...
output
1
108,115
15
216,231
Provide tags and a correct Python 3 solution for this coding contest problem. The Smart Beaver from ABBYY got hooked on square matrices. Now he is busy studying an n Γ— n size matrix, where n is odd. The Smart Beaver considers the following matrix elements good: * Elements of the main diagonal. * Elements of the...
instruction
0
108,116
15
216,232
Tags: implementation Correct Solution: ``` n = int(input()) a = [list(map(int, input().split())) for _ in range(n)] s1 = sum(a[i][i] for i in range(n)) s2 = sum(a[i][n - 1 - i] for i in range(n)) s3 = sum(a[i][n // 2] for i in range(n)) s4 = sum(a[n // 2][i] for i in range(n)) print(s1 + s2 + s3 + s4 - 3 * a[n //...
output
1
108,116
15
216,233
Provide tags and a correct Python 3 solution for this coding contest problem. The Smart Beaver from ABBYY got hooked on square matrices. Now he is busy studying an n Γ— n size matrix, where n is odd. The Smart Beaver considers the following matrix elements good: * Elements of the main diagonal. * Elements of the...
instruction
0
108,117
15
216,234
Tags: implementation Correct Solution: ``` n = int(input()) lst = [] for i in range(n): a = list(map(int, input().split())) lst.append(a) middle = n // 2 first = 0 second = 0 for i in range(0, n): for j in range(0, n): if (i == j): first += lst[i][j] if (i == ...
output
1
108,117
15
216,235
Provide tags and a correct Python 3 solution for this coding contest problem. The Smart Beaver from ABBYY got hooked on square matrices. Now he is busy studying an n Γ— n size matrix, where n is odd. The Smart Beaver considers the following matrix elements good: * Elements of the main diagonal. * Elements of the...
instruction
0
108,118
15
216,236
Tags: implementation Correct Solution: ``` n = int(input()) a = [list(map(int, input().split())) for i in range(n)] print(sum(a[i][i] + a[i][n - i - 1] + a[n // 2][i] + a[i][n // 2] for i in range(n)) - 3 * a[n // 2][n // 2]) ```
output
1
108,118
15
216,237
Provide tags and a correct Python 3 solution for this coding contest problem. The Smart Beaver from ABBYY got hooked on square matrices. Now he is busy studying an n Γ— n size matrix, where n is odd. The Smart Beaver considers the following matrix elements good: * Elements of the main diagonal. * Elements of the...
instruction
0
108,119
15
216,238
Tags: implementation Correct Solution: ``` n=int(input()) are=[] suma=0 for k in range (n): a=input() a=a.split() are.append(a) espaciovacio=n-3 for k in range ( n): for r in range (n): if k==((n)//2): suma=suma+int(are[k][r]) ...
output
1
108,119
15
216,239
Provide tags and a correct Python 3 solution for this coding contest problem. The Smart Beaver from ABBYY got hooked on square matrices. Now he is busy studying an n Γ— n size matrix, where n is odd. The Smart Beaver considers the following matrix elements good: * Elements of the main diagonal. * Elements of the...
instruction
0
108,120
15
216,240
Tags: implementation Correct Solution: ``` """ instagram : essipoortahmasb2018 telegram channel : essi_python """ Sum = 0 i = input n = int(i()) l = [] for i in range(n): l.append([*map(int,input().split())]) for i in range(n): Sum+= l[i][i] l[i][i] = 0 Sum+=l[i][n//2] l[i][n//2] = 0 a = 0 b ...
output
1
108,120
15
216,241
Provide tags and a correct Python 3 solution for this coding contest problem. The Smart Beaver from ABBYY got hooked on square matrices. Now he is busy studying an n Γ— n size matrix, where n is odd. The Smart Beaver considers the following matrix elements good: * Elements of the main diagonal. * Elements of the...
instruction
0
108,121
15
216,242
Tags: implementation Correct Solution: ``` n = int(input()) ans = 0 for i in range(n): a = [int(i) for i in input().split()] if i != n // 2: ans += a[i] + a[n//2] +a[n-1-i] else: for j in range(n): ans += a[j] print(ans) ```
output
1
108,121
15
216,243
Provide tags and a correct Python 3 solution for this coding contest problem. Olya loves energy drinks. She loves them so much that her room is full of empty cans from energy drinks. Formally, her room can be represented as a field of n Γ— m cells, each cell of which is empty or littered with cans. Olya drank a lot o...
instruction
0
108,347
15
216,694
Tags: data structures, dfs and similar, graphs, shortest paths Correct Solution: ``` from sys import * f = lambda: map(int, input().split()) n, m, k = f() t = [[1e9 * (q == '.') for q in stdin.readline()] for i in range(n)] t.append([0] * m) a, b, c, d = [q - 1 for q in f()] u = [(a, b)] t[a][b] = l = 0 def g(...
output
1
108,347
15
216,695
Provide tags and a correct Python 3 solution for this coding contest problem. Olya loves energy drinks. She loves them so much that her room is full of empty cans from energy drinks. Formally, her room can be represented as a field of n Γ— m cells, each cell of which is empty or littered with cans. Olya drank a lot o...
instruction
0
108,348
15
216,696
Tags: data structures, dfs and similar, graphs, shortest paths Correct Solution: ``` # aadiupadhyay import os.path from math import gcd, floor, ceil from collections import * import sys mod = 1000000007 INF = float('inf') def st(): return list(sys.stdin.readline().strip()) def li(): return list(map(int, sys.stdin.readl...
output
1
108,348
15
216,697
Provide tags and a correct Python 3 solution for this coding contest problem. Olya loves energy drinks. She loves them so much that her room is full of empty cans from energy drinks. Formally, her room can be represented as a field of n Γ— m cells, each cell of which is empty or littered with cans. Olya drank a lot o...
instruction
0
108,349
15
216,698
Tags: data structures, dfs and similar, graphs, shortest paths Correct Solution: ``` import sys import io, os input = sys.stdin.readline INF = 10**18 def main(): h, w, k = map(int, input().split()) C = [input().rstrip() for i in range(h)] x1, y1, x2, y2 = map(int, input().split()) x1, y1, x2, y2 = x1-...
output
1
108,349
15
216,699
Provide tags and a correct Python 3 solution for this coding contest problem. Olya loves energy drinks. She loves them so much that her room is full of empty cans from energy drinks. Formally, her room can be represented as a field of n Γ— m cells, each cell of which is empty or littered with cans. Olya drank a lot o...
instruction
0
108,350
15
216,700
Tags: data structures, dfs and similar, graphs, shortest paths Correct Solution: ``` from sys import * f = lambda: map(int, input().split()) n, m, k = f() t = [[1e9 * (q == '.') for q in stdin.readline()] for i in range(n)] t.append([0] * m) a, b, c, d = [q - 1 for q in f()] u = [(a, b)] t[a][b] = l = 0 def g(x, y): ...
output
1
108,350
15
216,701
Provide tags and a correct Python 3 solution for this coding contest problem. Olya loves energy drinks. She loves them so much that her room is full of empty cans from energy drinks. Formally, her room can be represented as a field of n Γ— m cells, each cell of which is empty or littered with cans. Olya drank a lot o...
instruction
0
108,351
15
216,702
Tags: data structures, dfs and similar, graphs, shortest paths 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() ...
output
1
108,351
15
216,703
Provide tags and a correct Python 3 solution for this coding contest problem. Olya loves energy drinks. She loves them so much that her room is full of empty cans from energy drinks. Formally, her room can be represented as a field of n Γ— m cells, each cell of which is empty or littered with cans. Olya drank a lot o...
instruction
0
108,352
15
216,704
Tags: data structures, dfs and similar, graphs, shortest paths Correct Solution: ``` import sys from collections import deque input=sys.stdin.readline n,m,k=map(int,input().split()) grid=[] grid1=[] grid2=[] leftyes=[] rightyes=[] upyes=[] downyes=[] for i in range(n): grid.append(input()) grid1.append([-1]*m) gr...
output
1
108,352
15
216,705
Provide tags and a correct Python 3 solution for this coding contest problem. Olya loves energy drinks. She loves them so much that her room is full of empty cans from energy drinks. Formally, her room can be represented as a field of n Γ— m cells, each cell of which is empty or littered with cans. Olya drank a lot o...
instruction
0
108,353
15
216,706
Tags: data structures, dfs and similar, graphs, shortest paths Correct Solution: ``` from collections import deque n, m, k = map(int, input().split()) INF = float("inf") d = [[INF] * m for _ in range(n)] t = [[] for i in range(n)] for i in range(n): a = list(input()) t[i] = a sx, sy, gx, gy = map(int, input()....
output
1
108,353
15
216,707
Provide tags and a correct Python 3 solution for this coding contest problem. Olya loves energy drinks. She loves them so much that her room is full of empty cans from energy drinks. Formally, her room can be represented as a field of n Γ— m cells, each cell of which is empty or littered with cans. Olya drank a lot o...
instruction
0
108,354
15
216,708
Tags: data structures, dfs and similar, graphs, shortest paths 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**15 mod = 10**9+7 def LI(): return [int(x) for x in sys.stdin.readline()...
output
1
108,354
15
216,709
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Olya loves energy drinks. She loves them so much that her room is full of empty cans from energy drinks. Formally, her room can be represented as a field of n Γ— m cells, each cell of which is e...
instruction
0
108,355
15
216,710
Yes
output
1
108,355
15
216,711
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Olya loves energy drinks. She loves them so much that her room is full of empty cans from energy drinks. Formally, her room can be represented as a field of n Γ— m cells, each cell of which is e...
instruction
0
108,356
15
216,712
Yes
output
1
108,356
15
216,713
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Olya loves energy drinks. She loves them so much that her room is full of empty cans from energy drinks. Formally, her room can be represented as a field of n Γ— m cells, each cell of which is e...
instruction
0
108,357
15
216,714
No
output
1
108,357
15
216,715
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Olya loves energy drinks. She loves them so much that her room is full of empty cans from energy drinks. Formally, her room can be represented as a field of n Γ— m cells, each cell of which is e...
instruction
0
108,358
15
216,716
No
output
1
108,358
15
216,717
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Olya loves energy drinks. She loves them so much that her room is full of empty cans from energy drinks. Formally, her room can be represented as a field of n Γ— m cells, each cell of which is e...
instruction
0
108,359
15
216,718
No
output
1
108,359
15
216,719
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Olya loves energy drinks. She loves them so much that her room is full of empty cans from energy drinks. Formally, her room can be represented as a field of n Γ— m cells, each cell of which is e...
instruction
0
108,360
15
216,720
No
output
1
108,360
15
216,721