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. You are standing on the OX-axis at point 0 and you want to move to an integer point x > 0. You can make several jumps. Suppose you're currently at point y (y may be negative) and jump for the k-th time. You can: * either jump to the poi...
instruction
0
71,858
15
143,716
Tags: constructive algorithms, math Correct Solution: ``` # Competitive Programming Template --> Ankit Josh import os from math import factorial import sys from io import BytesIO, IOBase def inp(): return sys.stdin.readline().strip() def IIX(): return (int(x) for x in sys.stdin.readline().split()) def II(): return (i...
output
1
71,858
15
143,717
Provide tags and a correct Python 3 solution for this coding contest problem. You are standing on the OX-axis at point 0 and you want to move to an integer point x > 0. You can make several jumps. Suppose you're currently at point y (y may be negative) and jump for the k-th time. You can: * either jump to the poi...
instruction
0
71,859
15
143,718
Tags: constructive algorithms, math Correct Solution: ``` for _ in range(int(input()) if True else 1): n=(int)(input()) c=0 for i in range(1,n+1): if (i*(i+1))//2>=n: c=i v=(i*(i+1))//2 break if (v-n==1): print(c+1) else: print(c) ```
output
1
71,859
15
143,719
Provide tags and a correct Python 3 solution for this coding contest problem. You are standing on the OX-axis at point 0 and you want to move to an integer point x > 0. You can make several jumps. Suppose you're currently at point y (y may be negative) and jump for the k-th time. You can: * either jump to the poi...
instruction
0
71,860
15
143,720
Tags: constructive algorithms, math Correct Solution: ``` from math import ceil t=int(input()) for _ in range(t): n=int(input()) count=0 now=0 if(n==2): print(3) continue for i in range(1,n+1): count+=1 now+=i if(now>=n): break if(now!=n ...
output
1
71,860
15
143,721
Provide tags and a correct Python 3 solution for this coding contest problem. You are standing on the OX-axis at point 0 and you want to move to an integer point x > 0. You can make several jumps. Suppose you're currently at point y (y may be negative) and jump for the k-th time. You can: * either jump to the poi...
instruction
0
71,861
15
143,722
Tags: constructive algorithms, math Correct Solution: ``` t = int(input()) for _ in range(t): x = int(input()) for i in range(1, x + 1): if i * (i + 1) >= 2 * x: break k = (i * (i + 1)) // 2 print(i + 1 if k == x + 1 else i) ```
output
1
71,861
15
143,723
Provide tags and a correct Python 3 solution for this coding contest problem. One day Alex decided to remember childhood when computers were not too powerful and lots of people played only default games. Alex enjoyed playing Minesweeper that time. He imagined that he saved world from bombs planted by terrorists, but h...
instruction
0
72,252
15
144,504
Tags: implementation Correct Solution: ``` r, c = map(int, input().split()) b = [list(input()) for i in range(r)] for y in range(r): for x in range(c): if b[y][x] == '.': b[y][x] = '0' ok = True for Y in range(r): for X in range(c): if not b[Y][X].isdigit(): continue ...
output
1
72,252
15
144,505
Provide tags and a correct Python 3 solution for this coding contest problem. One day Alex decided to remember childhood when computers were not too powerful and lots of people played only default games. Alex enjoyed playing Minesweeper that time. He imagined that he saved world from bombs planted by terrorists, but h...
instruction
0
72,253
15
144,506
Tags: implementation Correct Solution: ``` def cntBomb(i,j): global n,m,x cnt=0 if x[i-1][j]=='*': cnt+=1 if x[i+1][j]=='*': cnt+=1 if x[i][j-1]=='*': cnt+=1 if x[i][j+1]=='*': cnt+=1 if x[i-1][j-1]=='*': cnt+=1 if x[i-1][j+1]=='*': cnt+=1 if x[i+1][j-1]=='*': cnt+=1 if x[i+1][j+1]=='*': cnt+=1 re...
output
1
72,253
15
144,507
Provide tags and a correct Python 3 solution for this coding contest problem. One day Alex decided to remember childhood when computers were not too powerful and lots of people played only default games. Alex enjoyed playing Minesweeper that time. He imagined that he saved world from bombs planted by terrorists, but h...
instruction
0
72,254
15
144,508
Tags: implementation Correct Solution: ``` n,m=map(int,input().split()) dx=[0,0,-1,1,-1,-1,1,1] dy=[-1,1,0,0,-1,1,-1,1] g=[] for _ in range(n): g.append(input()) for i in range(n): for j in range(m): c=g[i][j] if c=='*': continue d=0 if c>='1' and c<='9': ...
output
1
72,254
15
144,509
Provide tags and a correct Python 3 solution for this coding contest problem. One day Alex decided to remember childhood when computers were not too powerful and lots of people played only default games. Alex enjoyed playing Minesweeper that time. He imagined that he saved world from bombs planted by terrorists, but h...
instruction
0
72,255
15
144,510
Tags: implementation Correct Solution: ``` from sys import stdin n, m = map(int, stdin.readline().strip().split()) field = [] for i in range(n): field.append(stdin.readline().strip()) def neighboring_bombs(field, n, m, i, j): count = 0 for ii in range(max(i - 1, 0), min(i + 2, n)): for jj in range...
output
1
72,255
15
144,511
Provide tags and a correct Python 3 solution for this coding contest problem. One day Alex decided to remember childhood when computers were not too powerful and lots of people played only default games. Alex enjoyed playing Minesweeper that time. He imagined that he saved world from bombs planted by terrorists, but h...
instruction
0
72,256
15
144,512
Tags: implementation Correct Solution: ``` n, m = map(int, input().split()) a = [input() for _ in range(n)] ans = 'YES' for i in range(n): for j in range(m): if a[i][j] != '*': s = sum(0<=k<n and 0<=l<m and a[k][l] == '*' for k in range(i-1, i+2) for l in range(j-1, j+2)) ...
output
1
72,256
15
144,513
Provide tags and a correct Python 3 solution for this coding contest problem. One day Alex decided to remember childhood when computers were not too powerful and lots of people played only default games. Alex enjoyed playing Minesweeper that time. He imagined that he saved world from bombs planted by terrorists, but h...
instruction
0
72,257
15
144,514
Tags: implementation Correct Solution: ``` #!/usr/bin/env python3 from sys import stdin, stdout def rint(): return map(int, stdin.readline().split()) #lines = stdin.readlines() r, c = rint() def check (i, j): cur_val = m[i][j] if cur_val == -1: return True cnt = 0 p = [[-1, -1, -1] for _ ...
output
1
72,257
15
144,515
Provide tags and a correct Python 3 solution for this coding contest problem. One day Alex decided to remember childhood when computers were not too powerful and lots of people played only default games. Alex enjoyed playing Minesweeper that time. He imagined that he saved world from bombs planted by terrorists, but h...
instruction
0
72,258
15
144,516
Tags: implementation Correct Solution: ``` def bad_num(k): tb = 0 for x in [-1, 0, 1]: for y in [-1, 0, 1]: if pole[i+x][j+y] == '*': tb +=1 return tb == k n, m = list(map(int, input().split())) pole = [] for i in range(n): arr = list(input().strip()) arr.append(...
output
1
72,258
15
144,517
Provide tags and a correct Python 3 solution for this coding contest problem. One day Alex decided to remember childhood when computers were not too powerful and lots of people played only default games. Alex enjoyed playing Minesweeper that time. He imagined that he saved world from bombs planted by terrorists, but h...
instruction
0
72,259
15
144,518
Tags: implementation Correct Solution: ``` n,m = map(int,input().split()) a =[] for i in range(n): a.append(input()) f = 1 for i in range(n): for j in range(m): c = 0 if a[i][j] == '.':t=0 elif a[i][j] == '*':t=-1 else:t=int(a[i][j]) if t!= -1: for k1 in range...
output
1
72,259
15
144,519
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. One day Alex decided to remember childhood when computers were not too powerful and lots of people played only default games. Alex enjoyed playing Minesweeper that time. He imagined that he save...
instruction
0
72,260
15
144,520
Yes
output
1
72,260
15
144,521
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. One day Alex decided to remember childhood when computers were not too powerful and lots of people played only default games. Alex enjoyed playing Minesweeper that time. He imagined that he save...
instruction
0
72,261
15
144,522
Yes
output
1
72,261
15
144,523
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. One day Alex decided to remember childhood when computers were not too powerful and lots of people played only default games. Alex enjoyed playing Minesweeper that time. He imagined that he save...
instruction
0
72,262
15
144,524
Yes
output
1
72,262
15
144,525
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. One day Alex decided to remember childhood when computers were not too powerful and lots of people played only default games. Alex enjoyed playing Minesweeper that time. He imagined that he save...
instruction
0
72,263
15
144,526
Yes
output
1
72,263
15
144,527
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. One day Alex decided to remember childhood when computers were not too powerful and lots of people played only default games. Alex enjoyed playing Minesweeper that time. He imagined that he save...
instruction
0
72,264
15
144,528
No
output
1
72,264
15
144,529
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. One day Alex decided to remember childhood when computers were not too powerful and lots of people played only default games. Alex enjoyed playing Minesweeper that time. He imagined that he save...
instruction
0
72,265
15
144,530
No
output
1
72,265
15
144,531
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. One day Alex decided to remember childhood when computers were not too powerful and lots of people played only default games. Alex enjoyed playing Minesweeper that time. He imagined that he save...
instruction
0
72,266
15
144,532
No
output
1
72,266
15
144,533
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. One day Alex decided to remember childhood when computers were not too powerful and lots of people played only default games. Alex enjoyed playing Minesweeper that time. He imagined that he save...
instruction
0
72,267
15
144,534
No
output
1
72,267
15
144,535
Provide a correct Python 3 solution for this coding contest problem. In sliding block puzzles, we repeatedly slide pieces (blocks) to open spaces within a frame to establish a goal placement of pieces. A puzzle creator has designed a new puzzle by combining the ideas of sliding block puzzles and mazes. The puzzle is ...
instruction
0
72,456
15
144,912
"Correct Solution: ``` from collections import deque from heapq import heappush, heappop, heapify import sys readline = sys.stdin.readline write = sys.stdout.write dd = ((-1, 0), (0, -1), (1, 0), (0, 1)) Z = [-1]*(50*50) def calc(H, W, G, x0, y0, bx, by, S): S[:] = Z[:H*W] k = y0*W + x0 que = deque([k]) ...
output
1
72,456
15
144,913
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. This is an interactive task. Dasha and NN like playing chess. While playing a match they decided that normal chess isn't interesting enough for them, so they invented a game described below. T...
instruction
0
72,531
15
145,062
No
output
1
72,531
15
145,063
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. This is an interactive task. Dasha and NN like playing chess. While playing a match they decided that normal chess isn't interesting enough for them, so they invented a game described below. T...
instruction
0
72,532
15
145,064
No
output
1
72,532
15
145,065
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. This is an interactive task. Dasha and NN like playing chess. While playing a match they decided that normal chess isn't interesting enough for them, so they invented a game described below. T...
instruction
0
72,533
15
145,066
No
output
1
72,533
15
145,067
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. This is an interactive task. Dasha and NN like playing chess. While playing a match they decided that normal chess isn't interesting enough for them, so they invented a game described below. T...
instruction
0
72,534
15
145,068
No
output
1
72,534
15
145,069
Provide tags and a correct Python 3 solution for this coding contest problem. You are given an infinite checkered field. You should get from a square (x1; y1) to a square (x2; y2). Using the shortest path is not necessary. You can move on the field squares in four directions. That is, when you are positioned in any sq...
instruction
0
72,603
15
145,206
Tags: math Correct Solution: ``` def f(a,b,x,y,z,w): c=(x+y) // (2*a) d=(z+w) // (2*a) e=(x-y) // (2*b) f=(z-w) // (2*b) return max(abs(c-d),abs(e-f)) a,b,x,y,z,w=map(int,input().split()) print(f(a,b,x,y,z,w)) ```
output
1
72,603
15
145,207
Provide tags and a correct Python 3 solution for this coding contest problem. You are given an infinite checkered field. You should get from a square (x1; y1) to a square (x2; y2). Using the shortest path is not necessary. You can move on the field squares in four directions. That is, when you are positioned in any sq...
instruction
0
72,604
15
145,208
Tags: math Correct Solution: ``` #!/usr/bin/python3 def cds(a, b, x, y): return (x + y) // (2 * a), (x - y) // (2 * b) def norm(x, y): return max(x, y) a, b, x1, y1, x2, y2 = map(int, input().split()) xp1, yp1 = cds(a, b, x1, y1) xp2, yp2 = cds(a, b, x2, y2) print(norm(abs(xp1 - xp2), abs(yp1 - yp2))) ```
output
1
72,604
15
145,209
Provide tags and a correct Python 3 solution for this coding contest problem. You are given an infinite checkered field. You should get from a square (x1; y1) to a square (x2; y2). Using the shortest path is not necessary. You can move on the field squares in four directions. That is, when you are positioned in any sq...
instruction
0
72,605
15
145,210
Tags: math Correct Solution: ``` a, b, x_1, y_1, x_2, y_2 = map(int, input().split()) a_b, a_e = (x_2 + y_2), (x_1 + y_1) b_b, b_e = (x_2 - y_2), (x_1 - y_1) if a_b > a_e: a_b, a_e = a_e, a_b if b_b > b_e: b_b, b_e = b_e, b_b if a_b % (2 * a) != 0: a_b = (a_b // (2 * a) + 1) * (2 * a) a_result, b_res...
output
1
72,605
15
145,211
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. You are given an infinite checkered field. You should get from a square (x1; y1) to a square (x2; y2). Using the shortest path is not necessary. You can move on the field squares in four directi...
instruction
0
72,606
15
145,212
No
output
1
72,606
15
145,213
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. You are given an infinite checkered field. You should get from a square (x1; y1) to a square (x2; y2). Using the shortest path is not necessary. You can move on the field squares in four directi...
instruction
0
72,607
15
145,214
No
output
1
72,607
15
145,215
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
72,831
15
145,662
Tags: dfs and similar Correct Solution: ``` import sys import math sys.setrecursionlimit(300000) MAXNUM = math.inf MINNUM = -1 * math.inf def getInt(): return int(sys.stdin.readline().rstrip()) def getInts(): return map(int, sys.stdin.readline().rstrip().split(" ")) def getString(): return sys.stdin....
output
1
72,831
15
145,663
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
72,832
15
145,664
Tags: dfs and similar Correct Solution: ``` n, m, k = map(int, input().split()) maze = [["#"]*(m+2)]+[list("#"+input()+"#") for i in range(n)]+[["#"]*(m+2)] steps = [[0,1],[0,-1],[1,0],[-1,0]] empty = -k x, y = None, None for i in range(n+2): empty += maze[i].count(".") for j in range(m+2): if...
output
1
72,832
15
145,665
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
72,833
15
145,666
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
72,833
15
145,667
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
72,834
15
145,668
Tags: dfs and similar Correct Solution: ``` from collections import deque def neighbours(v): out = set() x, y = v if 0 <= x + 1 < m and 0 <= y < n: out.add((x + 1, y)) if 0 <= x - 1 < m and 0 <= y < n: out.add((x - 1, y)) if 0 <= x < m and 0 <= y + 1 < n: out.add((x, y + 1)...
output
1
72,834
15
145,669
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
72,835
15
145,670
Tags: dfs and similar Correct Solution: ``` ## necessary imports import sys input = sys.stdin.readline from math import log2, log, ceil # swap_array function def swaparr(arr, a,b): temp = arr[a]; arr[a] = arr[b]; arr[b] = temp ## gcd function def gcd(a,b): if a == 0: return b return gcd(b%...
output
1
72,835
15
145,671
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
72,836
15
145,672
Tags: dfs and similar Correct Solution: ``` from collections import* n, m, k = map(int, input(). split()) b = [input() for _ in range(n)] c = [[[] for z in range(m)] for _ in range(n)] ans = 0 r = [[0] * m for i in range(n)] s = 0 q, w = -1, -1 def f(i, y): an = [] if i > 0: an.append([i - 1, y]) ...
output
1
72,836
15
145,673
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
72,837
15
145,674
Tags: dfs and similar Correct Solution: ``` import sys import math import collections import heapq import decimal n,m,k=(int(i) for i in input().split()) l=[] for i in range(n): l.append(list(input())) def neighbours(x,y): global n global m global l l1=[] if(x-1>=0 and l[x-1][y]=='.'): l...
output
1
72,837
15
145,675
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
72,838
15
145,676
Tags: dfs and similar Correct Solution: ``` def dfs(mat, r, c, visited, limit): dfsStack = [(r,c)] while dfsStack and limit > 0: i, j = dfsStack.pop() if 0 <= i < len(mat) and 0 <= j < len(mat[i]) and mat[i][j] == "." and not visited[i][j]: mat[i][j] = "C" visited[i][j] =...
output
1
72,838
15
145,677
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
72,839
15
145,678
Yes
output
1
72,839
15
145,679
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
72,840
15
145,680
Yes
output
1
72,840
15
145,681
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
72,841
15
145,682
Yes
output
1
72,841
15
145,683
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
72,842
15
145,684
Yes
output
1
72,842
15
145,685
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
72,843
15
145,686
No
output
1
72,843
15
145,687
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
72,844
15
145,688
No
output
1
72,844
15
145,689
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
72,845
15
145,690
No
output
1
72,845
15
145,691
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
72,846
15
145,692
No
output
1
72,846
15
145,693
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Finally Fox Ciel arrived in front of her castle! She have to type a password to enter her castle. An input device attached to her castle is a bit unusual. The input device is a 1 Γ— n rectangle...
instruction
0
72,998
15
145,996
No
output
1
72,998
15
145,997
Provide tags and a correct Python 3 solution for this coding contest problem. You are playing some computer game. One of its levels puts you in a maze consisting of n lines, each of which contains m cells. Each cell either is free or is occupied by an obstacle. The starting cell is in the row r and column c. In one st...
instruction
0
73,319
15
146,638
Tags: graphs, shortest paths Correct Solution: ``` '''input 4 5 3 2 1 2 ..... .***. ...** *.... 3 5 3 2 1 2 ..... .***. ...** 4 4 2 2 0 1 .... ..*. .... .... ''' from collections import deque n, m = map(int, input().split()) sx, sy = map(int, input().split()) tl, tr = map(int, input().split()) g = [input() for i in r...
output
1
73,319
15
146,639
Provide tags and a correct Python 3 solution for this coding contest problem. You are playing some computer game. One of its levels puts you in a maze consisting of n lines, each of which contains m cells. Each cell either is free or is occupied by an obstacle. The starting cell is in the row r and column c. In one st...
instruction
0
73,320
15
146,640
Tags: graphs, shortest paths Correct Solution: ``` input = __import__('sys').stdin.readline print = __import__('sys').stdout.write from collections import deque n, m = map(int, input().split()) sx, sy = map(int, input().split()) l, r = map(int, input().split()) sx-=1 sy-=1 lab = [input() for _ in range(n)] visited = [[...
output
1
73,320
15
146,641
Provide tags and a correct Python 3 solution for this coding contest problem. You are playing some computer game. One of its levels puts you in a maze consisting of n lines, each of which contains m cells. Each cell either is free or is occupied by an obstacle. The starting cell is in the row r and column c. In one st...
instruction
0
73,321
15
146,642
Tags: graphs, shortest paths Correct Solution: ``` import collections n,m = map(int,input().split()) r,c = map(int,input().split()) x,y = map(int,input().split()) arr = [] for i in range(n): arr.append(input()) que = collections.deque([(r-1,c-1)]) dist = [[float("inf")]*m for i in range(n)] dist[r-1][c-1] = 0 while ...
output
1
73,321
15
146,643