description
stringlengths
171
4k
code
stringlengths
94
3.98k
normalized_code
stringlengths
57
4.99k
Holidays are coming up really soon. Rick realized that it's time to think about buying a traditional spruce tree. But Rick doesn't want real trees to get hurt so he decided to find some in an $n \times m$ matrix consisting of "*" and ".". To find every spruce first let's define what a spruce in the matrix is. A set of...
ll = lambda: map(int, input().split()) t = lambda: int(input()) ss = lambda: input() for _ in range(t()): n, m = ll() a = [] ans = [0] d = [] for i in range(n): s = ss() a.append(s) d.append([0] * m) for i in range(n - 1, -1, -1): for j in range(m): if...
ASSIGN VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR ASSIGN VAR LIST ASSIGN VAR LIST NUMBER ASSIGN VAR LIST FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR EXPR FUNC_CALL VAR VAR EXPR FUNC...
Holidays are coming up really soon. Rick realized that it's time to think about buying a traditional spruce tree. But Rick doesn't want real trees to get hurt so he decided to find some in an $n \times m$ matrix consisting of "*" and ".". To find every spruce first let's define what a spruce in the matrix is. A set of...
t = int(input()) g = [] for x in range(t): n, m = input().split() l = [] for y in range(int(n)): l.append(input()) p = [([0] * (int(m) + 2)) for i in range(int(n) + 1)] for i in range(int(n) - 1, -1, -1): for j in range(1, int(m) + 1): if l[i][j - 1] == "*": ...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR LIST FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR BIN_OP LIST NUMBER BIN_OP FUNC_CALL VAR VAR NUMBER VAR FUNC_CALL VAR BIN_OP FUNC_CALL VAR VAR NUMBER...
Holidays are coming up really soon. Rick realized that it's time to think about buying a traditional spruce tree. But Rick doesn't want real trees to get hurt so he decided to find some in an $n \times m$ matrix consisting of "*" and ".". To find every spruce first let's define what a spruce in the matrix is. A set of...
def count_spruce(mat): ans = 0 dp = {} for i in range(len(mat)): for j in range(len(mat[i])): size = spruceSize(mat, i, j, dp) ans += dp[i, j] return ans def spruceSize(mat, i, j, dp): key = i, j if key in dp: return dp[key] if i >= len(mat) or j < 0...
FUNC_DEF ASSIGN VAR NUMBER ASSIGN VAR DICT FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR VAR ASSIGN VAR FUNC_CALL VAR VAR VAR VAR VAR VAR VAR VAR VAR RETURN VAR FUNC_DEF ASSIGN VAR VAR VAR IF VAR VAR RETURN VAR VAR IF VAR FUNC_CALL VAR VAR VAR NUMBER VAR FUNC_CALL VAR VAR VAR ASSIGN VA...
Holidays are coming up really soon. Rick realized that it's time to think about buying a traditional spruce tree. But Rick doesn't want real trees to get hurt so he decided to find some in an $n \times m$ matrix consisting of "*" and ".". To find every spruce first let's define what a spruce in the matrix is. A set of...
t = int(input()) for _ in range(t): n, m = map(int, input().split()) l = [] for i in range(n): l.append(input()) dp = [[(0) for i in range(m + 1)] for i in range(n)] for i in range(n): for j in range(m): if l[i][j] == "*": dp[i][j + 1] = 1 + dp[i][j] ...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST FOR VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR NUMBER VAR FUNC_CALL VAR BIN_OP VAR NUMBER VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR...
Holidays are coming up really soon. Rick realized that it's time to think about buying a traditional spruce tree. But Rick doesn't want real trees to get hurt so he decided to find some in an $n \times m$ matrix consisting of "*" and ".". To find every spruce first let's define what a spruce in the matrix is. A set of...
a = int(input()) for o in range(a): n, m = map(int, input().split()) pic = [0] * n for i in range(n): pic[i] = [0] * m for i in range(n): c = str(input()) for j in range(m): pic[i][j] = c[j] new = [([0] * (m + 2)) for i in range(n + 1)] for i in range(n - 1, -...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR BIN_OP LIST NUMBER VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR BIN_OP LIST NUMBER VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VA...
Holidays are coming up really soon. Rick realized that it's time to think about buying a traditional spruce tree. But Rick doesn't want real trees to get hurt so he decided to find some in an $n \times m$ matrix consisting of "*" and ".". To find every spruce first let's define what a spruce in the matrix is. A set of...
def dfs(x, y): if sublist[x][y] > 0: return sublist[x][y] flag = 0 if x + 1 < n and y - 1 > -1 and y + 1 < m: if matrix[x + 1][y - 1 : y + 2] == "***": flag = 1 if flag: sublist[x][y] = 1 + min(dfs(x + 1, y), dfs(x + 1, y - 1), dfs(x + 1, y + 1)) return sublis...
FUNC_DEF IF VAR VAR VAR NUMBER RETURN VAR VAR VAR ASSIGN VAR NUMBER IF BIN_OP VAR NUMBER VAR BIN_OP VAR NUMBER NUMBER BIN_OP VAR NUMBER VAR IF VAR BIN_OP VAR NUMBER BIN_OP VAR NUMBER BIN_OP VAR NUMBER STRING ASSIGN VAR NUMBER IF VAR ASSIGN VAR VAR VAR BIN_OP NUMBER FUNC_CALL VAR FUNC_CALL VAR BIN_OP VAR NUMBER VAR FUNC...
Holidays are coming up really soon. Rick realized that it's time to think about buying a traditional spruce tree. But Rick doesn't want real trees to get hurt so he decided to find some in an $n \times m$ matrix consisting of "*" and ".". To find every spruce first let's define what a spruce in the matrix is. A set of...
def solve(mat, n, m): res = 0 dp = [[(1) for _ in range(m)] for _ in range(n)] for i in range(n): for j in range(m): if mat[i][j] == ".": dp[i][j] = 0 for i in range(n - 2, -1, -1): for j in range(1, m - 1): if dp[i][j] == 0: contin...
FUNC_DEF ASSIGN VAR NUMBER ASSIGN VAR NUMBER VAR FUNC_CALL VAR VAR VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR VAR IF VAR VAR VAR STRING ASSIGN VAR VAR VAR NUMBER FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER NUMBER NUMBER FOR VAR FUNC_CALL VAR NUMBER BIN_OP VAR NUMBER IF VAR VAR VAR NUMBER ASSIGN V...
Holidays are coming up really soon. Rick realized that it's time to think about buying a traditional spruce tree. But Rick doesn't want real trees to get hurt so he decided to find some in an $n \times m$ matrix consisting of "*" and ".". To find every spruce first let's define what a spruce in the matrix is. A set of...
from sys import stdin, stdout for i in range(int(stdin.readline())): n, m = [int(x) for x in stdin.readline().split()] l = [([0] * m) for j in range(0, n)] arr = [([0] * m) for j in range(0, n)] for rows in range(0, n): l[rows] = list(stdin.readline()) count = 0 j = 1 for r in range...
FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR BIN_OP LIST NUMBER VAR VAR FUNC_CALL VAR NUMBER VAR ASSIGN VAR BIN_OP LIST NUMBER VAR VAR FUNC_CALL VAR NUMBER VAR FOR VAR FUNC_CALL VAR NUMBER VAR ASSIGN VAR VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN ...
Holidays are coming up really soon. Rick realized that it's time to think about buying a traditional spruce tree. But Rick doesn't want real trees to get hurt so he decided to find some in an $n \times m$ matrix consisting of "*" and ".". To find every spruce first let's define what a spruce in the matrix is. A set of...
def readGenerator(): while True: tokens = input().split(" ") for t in tokens: yield t reader = readGenerator() def readWord(): return next(reader) def readInt(): return int(next(reader)) def readFloat(): return float(next(reader)) def readLine(): return input() ...
FUNC_DEF WHILE NUMBER ASSIGN VAR FUNC_CALL FUNC_CALL VAR STRING FOR VAR VAR EXPR VAR ASSIGN VAR FUNC_CALL VAR FUNC_DEF RETURN FUNC_CALL VAR VAR FUNC_DEF RETURN FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_DEF RETURN FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_DEF RETURN FUNC_CALL VAR FUNC_DEF ASSIGN VAR NUMBER ASSIGN VAR LIST ASSIGN ...
Holidays are coming up really soon. Rick realized that it's time to think about buying a traditional spruce tree. But Rick doesn't want real trees to get hurt so he decided to find some in an $n \times m$ matrix consisting of "*" and ".". To find every spruce first let's define what a spruce in the matrix is. A set of...
from sys import stdin input = stdin.readline def find(i, j): mi = 1000000.0 for h in range(2): if j - h < 0 or j + h >= m: mi = 0 break mi = min(mi, processed[i + 1][j - h], processed[i + 1][j + h]) processed[i][j] = mi + 1 def func(): ans = 0 for i in ra...
ASSIGN VAR VAR FUNC_DEF ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER IF BIN_OP VAR VAR NUMBER BIN_OP VAR VAR VAR ASSIGN VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR VAR BIN_OP VAR NUMBER BIN_OP VAR VAR VAR BIN_OP VAR NUMBER BIN_OP VAR VAR ASSIGN VAR VAR VAR BIN_OP VAR NUMBER FUNC_DEF ASSIGN VAR NUMBER FOR VAR FUNC_CALL VA...
Holidays are coming up really soon. Rick realized that it's time to think about buying a traditional spruce tree. But Rick doesn't want real trees to get hurt so he decided to find some in an $n \times m$ matrix consisting of "*" and ".". To find every spruce first let's define what a spruce in the matrix is. A set of...
import sys def main(): import sys input = sys.stdin.readline t = int(input()) for _ in range(t): n, m = map(int, input().split()) c = [input() for i in range(n)] C = [([0] * (m + 1)) for i in range(n)] ans = 0 for i in range(n): for j in range(m): ...
IMPORT FUNC_DEF IMPORT ASSIGN VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP LIST NUMBER BIN_OP VAR NUMBER VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR...
Holidays are coming up really soon. Rick realized that it's time to think about buying a traditional spruce tree. But Rick doesn't want real trees to get hurt so he decided to find some in an $n \times m$ matrix consisting of "*" and ".". To find every spruce first let's define what a spruce in the matrix is. A set of...
class Vertex: def __init__(self, ch, q=0): self.ch = ch self.h = q def set(self, q): self.h = q for t in range(int(input())): n, m = map(int, input().split()) arr = [[Vertex(ch) for ch in input()] for _ in range(n)] count = 0 for y in range(n - 1, -1, -1): for...
CLASS_DEF FUNC_DEF NUMBER ASSIGN VAR VAR ASSIGN VAR VAR FUNC_DEF ASSIGN VAR VAR FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL VAR VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER NUMBER...
Holidays are coming up really soon. Rick realized that it's time to think about buying a traditional spruce tree. But Rick doesn't want real trees to get hurt so he decided to find some in an $n \times m$ matrix consisting of "*" and ".". To find every spruce first let's define what a spruce in the matrix is. A set of...
for _ in range(int(input())): n, m = map(int, input().split()) lst, cnt, dp = ( [input() for i in range(n)], 0, [[(0) for i in range(m)] for j in range(n)], ) for i in range(n - 1, -1, -1): for j in range(m): if lst[i][j] == "*": dp[i][j] = 1 +...
FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR VAR FUNC_CALL VAR VAR FUNC_CALL VAR VAR NUMBER NUMBER VAR FUNC_CALL VAR VAR VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER NUMBER NUMBER FOR VAR FUNC_CALL VAR VAR IF VAR VAR VAR STRIN...
Holidays are coming up really soon. Rick realized that it's time to think about buying a traditional spruce tree. But Rick doesn't want real trees to get hurt so he decided to find some in an $n \times m$ matrix consisting of "*" and ".". To find every spruce first let's define what a spruce in the matrix is. A set of...
import sys input = lambda: sys.stdin.readline().rstrip() def solve(n, m): L0 = [] L1 = [] num = [(0) for i in range(m * n)] for i in range(n): grid = input() for j in range(m): if grid[j] == "*": c = i * m + j num[c] = 1 if i...
IMPORT ASSIGN VAR FUNC_CALL FUNC_CALL VAR FUNC_DEF ASSIGN VAR LIST ASSIGN VAR LIST ASSIGN VAR NUMBER VAR FUNC_CALL VAR BIN_OP VAR VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR IF VAR VAR STRING ASSIGN VAR BIN_OP BIN_OP VAR VAR VAR ASSIGN VAR VAR NUMBER IF VAR NUMBER NUMBER VAR BIN_OP ...
Holidays are coming up really soon. Rick realized that it's time to think about buying a traditional spruce tree. But Rick doesn't want real trees to get hurt so he decided to find some in an $n \times m$ matrix consisting of "*" and ".". To find every spruce first let's define what a spruce in the matrix is. A set of...
for _ in range(int(input())): r, c = map(int, input().split()) res = 0 m = [[(0) for i in range(c + 2)] for j in range(r + 1)] data = [(0) for i in range(r)] for row in range(r): data[row] = input() for i in range(row, -1, -1): for j in range(c): if data[i][j] == "*":...
FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER VAR FUNC_CALL VAR BIN_OP VAR NUMBER VAR FUNC_CALL VAR BIN_OP VAR NUMBER ASSIGN VAR NUMBER VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR FUNC_CALL VAR FOR VAR FU...
Holidays are coming up really soon. Rick realized that it's time to think about buying a traditional spruce tree. But Rick doesn't want real trees to get hurt so he decided to find some in an $n \times m$ matrix consisting of "*" and ".". To find every spruce first let's define what a spruce in the matrix is. A set of...
def solve(): n, m = map(int, input().split()) a = [] for i in range(n): a.append(input()) dp = [] for i in range(n): dp.append([]) for j in range(m): dp[i].append( (1 if a[i][j] == "*" else 0) if j == 0 else dp[i][j ...
FUNC_DEF ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST FOR VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR LIST FOR VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR LIST FOR VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR VAR VAR NUMBER VAR VAR VAR STRING NUMBER NUMBER BIN_OP VAR VAR BIN_O...
Holidays are coming up really soon. Rick realized that it's time to think about buying a traditional spruce tree. But Rick doesn't want real trees to get hurt so he decided to find some in an $n \times m$ matrix consisting of "*" and ".". To find every spruce first let's define what a spruce in the matrix is. A set of...
from itertools import accumulate def main(): t = int(input()) for _ in range(t): a, b = map(int, input().split()) t = [] for i in range(a): l = input() t.append(l) dp = [([0] * (b + 2)) for i in range(a + 1)] ans = 0 for i in range(a - 1,...
FUNC_DEF ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR EXPR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP LIST NUMBER BIN_OP VAR NUMBER VAR FUNC_CALL VAR BIN_OP VAR NUMBER ASSIGN VAR NUMB...
Holidays are coming up really soon. Rick realized that it's time to think about buying a traditional spruce tree. But Rick doesn't want real trees to get hurt so he decided to find some in an $n \times m$ matrix consisting of "*" and ".". To find every spruce first let's define what a spruce in the matrix is. A set of...
def spruce(arr, n, m): cnt = 0 dp = [[(0) for i in range(m)] for i in range(n)] for i in range(n - 1, -1, -1): for j in range(m): if arr[i][j] == "*": if j != 0 and j != m - 1 and i != n - 1: dp[i][j] = 1 + min(dp[i + 1][j], dp[i + 1][j - 1], dp[i + 1]...
FUNC_DEF ASSIGN VAR NUMBER ASSIGN VAR NUMBER VAR FUNC_CALL VAR VAR VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER NUMBER NUMBER FOR VAR FUNC_CALL VAR VAR IF VAR VAR VAR STRING IF VAR NUMBER VAR BIN_OP VAR NUMBER VAR BIN_OP VAR NUMBER ASSIGN VAR VAR VAR BIN_OP NUMBER FUNC_CALL VAR VAR BIN_OP VAR NUMBER VA...
Holidays are coming up really soon. Rick realized that it's time to think about buying a traditional spruce tree. But Rick doesn't want real trees to get hurt so he decided to find some in an $n \times m$ matrix consisting of "*" and ".". To find every spruce first let's define what a spruce in the matrix is. A set of...
for _ in range(int(input())): n, m = map(int, input().split()) dict = [] k = 0 for i in range(n): dict.append(i) dict[i] = [] a = list(input()) for j in range(m): if a[j] == "*": k = k + 1 dict[i].append(k) else: ...
FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR VAR ASSIGN VAR VAR LIST ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR IF VAR VAR STRING ASSIGN VAR BIN_OP VAR NUMBE...
Holidays are coming up really soon. Rick realized that it's time to think about buying a traditional spruce tree. But Rick doesn't want real trees to get hurt so he decided to find some in an $n \times m$ matrix consisting of "*" and ".". To find every spruce first let's define what a spruce in the matrix is. A set of...
def solve_2(grid): n = len(grid) m = len(grid[0]) count = 0 dp = [[(0) for x in range(m)] for y in range(n)] for i in range(m): if grid[n - 1][i] == "*": dp[n - 1][i] = 1 for j in range(n): if grid[j][m - 1] == "*": dp[j][m - 1] = 1 for i in range(n - ...
FUNC_DEF ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER VAR FUNC_CALL VAR VAR VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR VAR IF VAR BIN_OP VAR NUMBER VAR STRING ASSIGN VAR BIN_OP VAR NUMBER VAR NUMBER FOR VAR FUNC_CALL VAR VAR IF VAR VAR BIN_OP VAR NUMBER STRING AS...
Holidays are coming up really soon. Rick realized that it's time to think about buying a traditional spruce tree. But Rick doesn't want real trees to get hurt so he decided to find some in an $n \times m$ matrix consisting of "*" and ".". To find every spruce first let's define what a spruce in the matrix is. A set of...
def findTheSpruce(matrix): total = 0 dp = [([0] * len(matrix[0])) for _ in range(len(matrix))] for col in range(len(matrix[0])): dp[-1][col] = 1 if matrix[-1][col] == "*" else 0 total += dp[-1][col] for row in range(len(matrix) - 2, -1, -1): for col in range(len(matrix[0])): ...
FUNC_DEF ASSIGN VAR NUMBER ASSIGN VAR BIN_OP LIST NUMBER FUNC_CALL VAR VAR NUMBER VAR FUNC_CALL VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR NUMBER ASSIGN VAR NUMBER VAR VAR NUMBER VAR STRING NUMBER NUMBER VAR VAR NUMBER VAR FOR VAR FUNC_CALL VAR BIN_OP FUNC_CALL VAR VAR NUMBER NUMBER NUMBER FOR VAR FU...
Holidays are coming up really soon. Rick realized that it's time to think about buying a traditional spruce tree. But Rick doesn't want real trees to get hurt so he decided to find some in an $n \times m$ matrix consisting of "*" and ".". To find every spruce first let's define what a spruce in the matrix is. A set of...
def solve(): n, m = map(int, input().split()) matrix = [] value = [[(0) for x in range(m)] for y in range(n)] for q in range(n): matrix.append(list(input())) answer = 0 for i in range(n - 1, -1, -1): for j in range(m): if matrix[i][j] != "*": continue ...
FUNC_DEF ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST ASSIGN VAR NUMBER VAR FUNC_CALL VAR VAR VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER NUMBER NUMBER FOR VAR FUNC_CALL VAR VAR IF VA...
Holidays are coming up really soon. Rick realized that it's time to think about buying a traditional spruce tree. But Rick doesn't want real trees to get hurt so he decided to find some in an $n \times m$ matrix consisting of "*" and ".". To find every spruce first let's define what a spruce in the matrix is. A set of...
T = int(input()) for t in range(T): n, m = list(map(int, input().split())) matrix = [] ans = [] for i in range(n): matrix.append(list(input())) ans.append([0] * m) for i in range(n): for j in range(m): if matrix[i][j] == "*": ans[i][j] = 1 for ...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST ASSIGN VAR LIST FOR VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR EXPR FUNC_CALL VAR BIN_OP LIST NUMBER VAR FOR VAR FUNC_CALL VAR VAR FOR VAR FUN...
Holidays are coming up really soon. Rick realized that it's time to think about buying a traditional spruce tree. But Rick doesn't want real trees to get hurt so he decided to find some in an $n \times m$ matrix consisting of "*" and ".". To find every spruce first let's define what a spruce in the matrix is. A set of...
for _ in range(int(input())): n, m = map(int, input().split()) s = [] kiri = [[(0) for i in range(m)] for j in range(n)] kanan = [[(0) for i in range(m)] for j in range(n)] for i in range(n): s.append(list(map(lambda x: x == "*", input()))) for i in range(n): for j in range(m): ...
FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST ASSIGN VAR NUMBER VAR FUNC_CALL VAR VAR VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER VAR FUNC_CALL VAR VAR VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ...
Holidays are coming up really soon. Rick realized that it's time to think about buying a traditional spruce tree. But Rick doesn't want real trees to get hurt so he decided to find some in an $n \times m$ matrix consisting of "*" and ".". To find every spruce first let's define what a spruce in the matrix is. A set of...
t = int(input()) for _ in range(t): n, m = [int(i) for i in input().split()] cnt = 0 a = [] dp = [] for i in range(n): dpp = [] x = input() a.append(x) for j in range(m): if a[i][j] == "*": dpp.append([1, 1]) else: ...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR LIST ASSIGN VAR LIST FOR VAR FUNC_CALL VAR VAR ASSIGN VAR LIST ASSIGN VAR FUNC_CALL VAR EXPR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR VAR IF VAR VAR VAR STRING EXPR F...
Holidays are coming up really soon. Rick realized that it's time to think about buying a traditional spruce tree. But Rick doesn't want real trees to get hurt so he decided to find some in an $n \times m$ matrix consisting of "*" and ".". To find every spruce first let's define what a spruce in the matrix is. A set of...
def result(arr, n, board_number, m): sum = 0 for j in range(m): if arr[n - 1][j] == "*": board_number[n - 1][j] = 1 else: board_number[n - 1][j] = 0 sum += board_number[n - 1][j] for i in range(n - 2, -1, -1): for j in range(m): if arr[i][j...
FUNC_DEF ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR IF VAR BIN_OP VAR NUMBER VAR STRING ASSIGN VAR BIN_OP VAR NUMBER VAR NUMBER ASSIGN VAR BIN_OP VAR NUMBER VAR NUMBER VAR VAR BIN_OP VAR NUMBER VAR FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER NUMBER NUMBER FOR VAR FUNC_CALL VAR VAR IF VAR VAR VAR STRING ASSIGN VAR VAR VAR ...
Holidays are coming up really soon. Rick realized that it's time to think about buying a traditional spruce tree. But Rick doesn't want real trees to get hurt so he decided to find some in an $n \times m$ matrix consisting of "*" and ".". To find every spruce first let's define what a spruce in the matrix is. A set of...
t = int(input()) while t > 0: n, m = map(int, input().split()) dp = [([0] * m) for i in range(n)] matric = [input() for i in range(n)] ans = 0 for i in range(n - 1, -1, -1): for j in range(m): if matric[i][j] == "*": if not (i == n - 1 or j == 0 or j == m - 1): ...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR WHILE VAR NUMBER ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR BIN_OP LIST NUMBER VAR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER NUMBER NUMBER FOR VAR FUNC_CALL VAR VAR IF VAR...
Holidays are coming up really soon. Rick realized that it's time to think about buying a traditional spruce tree. But Rick doesn't want real trees to get hurt so he decided to find some in an $n \times m$ matrix consisting of "*" and ".". To find every spruce first let's define what a spruce in the matrix is. A set of...
def checkStar(char): if char == ".": return 0 else: return 1 matrix = list() for t in [0] * int(input()): n, m = map(int, input().split()) matrix = [input() for _ in [0] * n] for i in range(n): matrix[i] = list(map(checkStar, matrix[i])) for i in range(n - 1, 0, -1): ...
FUNC_DEF IF VAR STRING RETURN NUMBER RETURN NUMBER ASSIGN VAR FUNC_CALL VAR FOR VAR BIN_OP LIST NUMBER FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR BIN_OP LIST NUMBER VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR FUNC_CALL VAR FUNC_CALL VAR VAR VAR VAR...
Holidays are coming up really soon. Rick realized that it's time to think about buying a traditional spruce tree. But Rick doesn't want real trees to get hurt so he decided to find some in an $n \times m$ matrix consisting of "*" and ".". To find every spruce first let's define what a spruce in the matrix is. A set of...
for _ in range(int(input())): n, m = map(int, input().split()) s = [input() for i in range(n)] a = [([0] * m) for i in range(n)] ans = 0 for i in range(n - 1, -1, -1): for j in range(m): if s[i][j] == "*": a[i][j] = 1 if i < n - 1 and j < m - 1 and...
FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP LIST NUMBER VAR VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER NUMBER NUMBER FOR VAR FUNC_CALL VAR VAR IF VAR VAR V...
Holidays are coming up really soon. Rick realized that it's time to think about buying a traditional spruce tree. But Rick doesn't want real trees to get hurt so he decided to find some in an $n \times m$ matrix consisting of "*" and ".". To find every spruce first let's define what a spruce in the matrix is. A set of...
for _ in range(int(input())): n, m = map(int, input().split()) a = [] dp = [([0] * m) for i in range(n)] ans = 0 left = [([0] * m) for i in range(n)] right = [([0] * m) for i in range(n)] for i in range(n): l = list(input()) a.append(l) for j in range(m): ...
FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST ASSIGN VAR BIN_OP LIST NUMBER VAR VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER ASSIGN VAR BIN_OP LIST NUMBER VAR VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP LIST NUMBER VAR VAR FUNC_CALL VAR VAR FOR VAR FUN...
Holidays are coming up really soon. Rick realized that it's time to think about buying a traditional spruce tree. But Rick doesn't want real trees to get hurt so he decided to find some in an $n \times m$ matrix consisting of "*" and ".". To find every spruce first let's define what a spruce in the matrix is. A set of...
for _ in range(int(input())): n, m = map(int, input().split()) num = [[] for _ in range(n)] tab = [[(0) for _ in range(m)] for _ in range(n)] for i in range(n): s = input() for j in s: num[i].append(j) co = 0 for i in range(n - 1, -1, -1): for j in range(m - 1...
FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER VAR FUNC_CALL VAR VAR VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FOR VAR VAR EXPR FUNC_CALL VAR VAR VAR ASSIGN VAR NUMBER FOR V...
Holidays are coming up really soon. Rick realized that it's time to think about buying a traditional spruce tree. But Rick doesn't want real trees to get hurt so he decided to find some in an $n \times m$ matrix consisting of "*" and ".". To find every spruce first let's define what a spruce in the matrix is. A set of...
for _ in range(int(input())): n, m = list(map(int, input().split())) arr = [] c = 0 for i in range(n): z = list(input()) c += z.count("*") arr.append(z) ans = [] for i in range(n): ans.append([0] * m) for i in range(m): for g in range(n): i...
FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL VAR STRING EXPR FUNC_CALL VAR VAR ASSIGN VAR LIST FOR VAR FUNC_CALL VAR VAR EXPR FUNC_...
Holidays are coming up really soon. Rick realized that it's time to think about buying a traditional spruce tree. But Rick doesn't want real trees to get hurt so he decided to find some in an $n \times m$ matrix consisting of "*" and ".". To find every spruce first let's define what a spruce in the matrix is. A set of...
def findSpruces(matrix, n, m): counts = [([0] * (m + 2)) for _ in range(n + 1)] for x in range(1, n + 1): for y in range(1, m + 1): if matrix[n - x][y - 1] != "*": continue a = counts[x - 1][y - 1] b = counts[x - 1][y] c = counts[x - 1][y +...
FUNC_DEF ASSIGN VAR BIN_OP LIST NUMBER BIN_OP VAR NUMBER VAR FUNC_CALL VAR BIN_OP VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER BIN_OP VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER BIN_OP VAR NUMBER IF VAR BIN_OP VAR VAR BIN_OP VAR NUMBER STRING ASSIGN VAR VAR BIN_OP VAR NUMBER BIN_OP VAR NUMBER ASSIGN VAR VAR BIN_OP VAR NUMBER VA...
Holidays are coming up really soon. Rick realized that it's time to think about buying a traditional spruce tree. But Rick doesn't want real trees to get hurt so he decided to find some in an $n \times m$ matrix consisting of "*" and ".". To find every spruce first let's define what a spruce in the matrix is. A set of...
for _ in range(int(input())): n, m = map(int, input().split()) a = [] b = [] for i in range(n): a.append(input()) b.append([0] * m) s = 0 for i in range(n - 1, -1, -1): for j in range(m): if a[i][j] == "*": if i == n - 1: b[...
FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST ASSIGN VAR LIST FOR VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR FUNC_CALL VAR EXPR FUNC_CALL VAR BIN_OP LIST NUMBER VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER NUMBER NUMBER FOR VAR ...
Holidays are coming up really soon. Rick realized that it's time to think about buying a traditional spruce tree. But Rick doesn't want real trees to get hurt so he decided to find some in an $n \times m$ matrix consisting of "*" and ".". To find every spruce first let's define what a spruce in the matrix is. A set of...
for _ in range(int(input())): n, m = map(int, input().split()) a = [] for i in range(n): a.append(input()) count = 0 dp = [] for i in range(n): dp.append([]) for j in range(m): dp[i].append( (0 if a[i][j] == "." else 1) if j == ...
FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST FOR VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR LIST FOR VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR LIST FOR VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR VAR VAR N...
Holidays are coming up really soon. Rick realized that it's time to think about buying a traditional spruce tree. But Rick doesn't want real trees to get hurt so he decided to find some in an $n \times m$ matrix consisting of "*" and ".". To find every spruce first let's define what a spruce in the matrix is. A set of...
t = int(input()) while t > 0: t -= 1 n, m = input().split() n, m = int(n), int(m) mt = [] for i in range(n): mt.append(input()) vst = [] for i in range(n): vst.append([(0) for j in range(m)]) def fun(x, y): if mt[x][y] == ".": return 0 elif no...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR WHILE VAR NUMBER VAR NUMBER ASSIGN VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL VAR VAR ASSIGN VAR LIST FOR VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR LIST FOR VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR NUMBER VAR FUNC_CALL VAR VA...
Holidays are coming up really soon. Rick realized that it's time to think about buying a traditional spruce tree. But Rick doesn't want real trees to get hurt so he decided to find some in an $n \times m$ matrix consisting of "*" and ".". To find every spruce first let's define what a spruce in the matrix is. A set of...
import sys input = sys.stdin.readline t = int(input()) for _ in range(t): n, m = map(int, input().split()) c = [input()[:-1] for i in range(n)] c = [[(1 if j == "*" else 0) for j in ci] for ci in c] ru = [([0] * (m + 1)) for i in range(n)] for i in range(n): for j in range(m): r...
IMPORT ASSIGN VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR NUMBER VAR FUNC_CALL VAR VAR ASSIGN VAR VAR STRING NUMBER NUMBER VAR VAR VAR VAR ASSIGN VAR BIN_OP LIST NUMBER BIN_OP VAR NUMBER VAR FUNC_CALL VAR VAR ...
Holidays are coming up really soon. Rick realized that it's time to think about buying a traditional spruce tree. But Rick doesn't want real trees to get hurt so he decided to find some in an $n \times m$ matrix consisting of "*" and ".". To find every spruce first let's define what a spruce in the matrix is. A set of...
for _ in range(int(input())): n, m = map(int, input().split()) a = [] for __ in range(n): a.append(input()) dp = [[(1 if c == "*" else 0) for c in r] for r in a] for i in range(n - 1, -1, -1): for j in range(m - 1, -1, -1): if dp[i][j] == 1 and i < n - 1 and 0 < j < m - 1...
FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST FOR VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR STRING NUMBER NUMBER VAR VAR VAR VAR FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER NUMBER NUMBER FOR VAR FUNC_CALL VAR BIN_OP VAR...
Holidays are coming up really soon. Rick realized that it's time to think about buying a traditional spruce tree. But Rick doesn't want real trees to get hurt so he decided to find some in an $n \times m$ matrix consisting of "*" and ".". To find every spruce first let's define what a spruce in the matrix is. A set of...
def solve(): n, m = map(int, input().split()) s = [str(input()) for i in range(n)] dp = [[(0) for j in range(m)] for i in range(n)] for i in range(n - 1, -1, -1): for j in range(0, m): if s[i][j] == "*": if j == 0 or j == m - 1 or i == n - 1: dp[i]...
FUNC_DEF ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER VAR FUNC_CALL VAR VAR VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER NUMBER NUMBER FOR VAR FUNC_CALL VAR NUMBER VAR IF VAR VAR VAR STRING IF VAR NUMBER VAR BIN_...
Holidays are coming up really soon. Rick realized that it's time to think about buying a traditional spruce tree. But Rick doesn't want real trees to get hurt so he decided to find some in an $n \times m$ matrix consisting of "*" and ".". To find every spruce first let's define what a spruce in the matrix is. A set of...
t = int(input()) while t: n, m = map(int, input().split()) li = [] for i in range(n): li.append(list(input())) dp = [[(0) for i in range(m)] for j in range(n)] for i in reversed(range(n)): for j in reversed(range(m)): if li[i][j] == "*": if i + 1 < n and j...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR WHILE VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST FOR VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR NUMBER VAR FUNC_CALL VAR VAR VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR F...
Holidays are coming up really soon. Rick realized that it's time to think about buying a traditional spruce tree. But Rick doesn't want real trees to get hurt so he decided to find some in an $n \times m$ matrix consisting of "*" and ".". To find every spruce first let's define what a spruce in the matrix is. A set of...
def find_the_spruce(): for _ in range(int(input())): n, m = list(map(int, input().split())) arr = [[x for x in input()] for _ in range(n)] ans = [[(0) for _ in range(m)] for _ in range(n)] for i in range(m): ans[n - 1][i] = 1 if arr[n - 1][i] == "*" else 0 for i i...
FUNC_DEF FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR VAR FUNC_CALL VAR VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER VAR FUNC_CALL VAR VAR VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP VAR NUMBER VAR VAR BIN_OP VAR...
Holidays are coming up really soon. Rick realized that it's time to think about buying a traditional spruce tree. But Rick doesn't want real trees to get hurt so he decided to find some in an $n \times m$ matrix consisting of "*" and ".". To find every spruce first let's define what a spruce in the matrix is. A set of...
def solve(): n, m = map(int, input().split()) a = [] dp = [] for i in range(n): a.append([""] * m) dp.append([0] * m) for i in range(n): s = input() for j in range(m): a[n - i - 1][j] = s[j] for i in range(m): if a[0][i] == "*": dp[...
FUNC_DEF ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST ASSIGN VAR LIST FOR VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR BIN_OP LIST STRING VAR EXPR FUNC_CALL VAR BIN_OP LIST NUMBER VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP BIN_OP VAR VAR NU...
Holidays are coming up really soon. Rick realized that it's time to think about buying a traditional spruce tree. But Rick doesn't want real trees to get hurt so he decided to find some in an $n \times m$ matrix consisting of "*" and ".". To find every spruce first let's define what a spruce in the matrix is. A set of...
t = int(input()) i = 1 while i <= t: [n, m] = list(map(int, input().split())) arr = [] ans = [] total = 0 for j in range(n): arr.append(input()) ans.append([(0) for k in range(m)]) for j in range(n - 1, -1, -1): for k in range(m - 1, -1, -1): if arr[j][k] == "...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR NUMBER WHILE VAR VAR ASSIGN LIST VAR VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST ASSIGN VAR LIST ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR FUNC_CALL VAR EXPR FUNC_CALL VAR NUMBER VAR FUNC_CALL VAR VAR FOR VAR FUNC_CAL...
Holidays are coming up really soon. Rick realized that it's time to think about buying a traditional spruce tree. But Rick doesn't want real trees to get hurt so he decided to find some in an $n \times m$ matrix consisting of "*" and ".". To find every spruce first let's define what a spruce in the matrix is. A set of...
import sys input = sys.stdin.readline def check(i, j, ls): global n, m, dp ans = 0 for c in range(min(j + 1, n - i, m - j)): if ( dp[i + c][j + c] - dp[i + c][j - c] + (1 if ls[i + c][j - c] == "*" else 0) == 2 * (c + 1) - 1 ): ans += 1 else: ...
IMPORT ASSIGN VAR VAR FUNC_DEF ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR FUNC_CALL VAR BIN_OP VAR NUMBER BIN_OP VAR VAR BIN_OP VAR VAR IF BIN_OP BIN_OP VAR BIN_OP VAR VAR BIN_OP VAR VAR VAR BIN_OP VAR VAR BIN_OP VAR VAR VAR BIN_OP VAR VAR BIN_OP VAR VAR STRING NUMBER NUMBER BIN_OP BIN_OP NUMBER BIN_OP VAR NUMBER NUMBER V...
Holidays are coming up really soon. Rick realized that it's time to think about buying a traditional spruce tree. But Rick doesn't want real trees to get hurt so he decided to find some in an $n \times m$ matrix consisting of "*" and ".". To find every spruce first let's define what a spruce in the matrix is. A set of...
t = int(input()) for q in range(t): n, m = map(int, input().split()) a = n * [0] for w in range(n): a[w] = input() dp = [[(0) for i in range(m)] for j in range(n)] for i in list(reversed(range(n))): for j in range(m): if a[i][j] == ".": dp[i][j] = 0 ...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR BIN_OP VAR LIST NUMBER FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR FUNC_CALL VAR ASSIGN VAR NUMBER VAR FUNC_CALL VAR VAR VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL V...
Holidays are coming up really soon. Rick realized that it's time to think about buying a traditional spruce tree. But Rick doesn't want real trees to get hurt so he decided to find some in an $n \times m$ matrix consisting of "*" and ".". To find every spruce first let's define what a spruce in the matrix is. A set of...
for _ in range(int(input())): n, m = map(int, input().split()) l = [] fa = [] for i in range(n): s = input() l.append(s) k = [] for i in range(m): k.append(0) fa.append(k) ans = 0 for i in range(n): for j in range(m): if l[i...
FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST ASSIGN VAR LIST FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR EXPR FUNC_CALL VAR VAR ASSIGN VAR LIST FOR VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR NUMBER EXPR FUNC_CALL VAR VAR ASSIGN VAR NUMBE...
Holidays are coming up really soon. Rick realized that it's time to think about buying a traditional spruce tree. But Rick doesn't want real trees to get hurt so he decided to find some in an $n \times m$ matrix consisting of "*" and ".". To find every spruce first let's define what a spruce in the matrix is. A set of...
import sys input = sys.stdin.readline I = lambda: list(map(int, input().split())) (t,) = I() for _ in range(t): n, m = I() ar = [list(input().strip()) for i in range(n)] ans = 0 arr = [([0] * (m + 1)) for i in range(n)] for i in range(n): arr[i][0] = int(ar[i][0] == "*") for j in ra...
IMPORT ASSIGN VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL FUNC_CALL VAR VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER ASSIGN VAR BIN_OP LIST NUMBER BIN_OP VAR NUMBER VAR FUNC_CALL ...
Holidays are coming up really soon. Rick realized that it's time to think about buying a traditional spruce tree. But Rick doesn't want real trees to get hurt so he decided to find some in an $n \times m$ matrix consisting of "*" and ".". To find every spruce first let's define what a spruce in the matrix is. A set of...
for _ in range(int(input())): n, m = list(map(int, input().split())) a = [] for i in range(n): a.append(input()) ans = [[(0) for i in range(m)] for j in range(n)] for i in range(n - 1, -1, -1): for j in range(m): if a[i][j] == "*": if j < m - 2 and i > 0: ...
FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST FOR VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR NUMBER VAR FUNC_CALL VAR VAR VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER NUMBER NUMBER FOR VAR ...
Holidays are coming up really soon. Rick realized that it's time to think about buying a traditional spruce tree. But Rick doesn't want real trees to get hurt so he decided to find some in an $n \times m$ matrix consisting of "*" and ".". To find every spruce first let's define what a spruce in the matrix is. A set of...
n = int(input()) for i in range(n): p, q = [int(x) for x in input().split()] tree = [] for j in range(p): tree.append([(1 if x == "*" else 0) for x in list(input())]) for x in range(p - 2, -1, -1): for y in range(q): if ( x + 1 < p and y - 1 < ...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST FOR VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR VAR STRING NUMBER NUMBER VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER NUMBER NUMBER FOR VAR FUNC_CALL VAR ...
Holidays are coming up really soon. Rick realized that it's time to think about buying a traditional spruce tree. But Rick doesn't want real trees to get hurt so he decided to find some in an $n \times m$ matrix consisting of "*" and ".". To find every spruce first let's define what a spruce in the matrix is. A set of...
t = int(input()) for _ in range(t): n, m = map(int, input().split()) l = [] for i in range(n): l.append(input()) count = 0 trees = dict() for i in range(n - 1, -1, -1): for j in range(0, m): if l[i][j] == "*": x = 0 if i != n - 1 and j ...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST FOR VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER NUMBER NUMBER FOR VAR FUNC_CALL VAR NUMB...
Holidays are coming up really soon. Rick realized that it's time to think about buying a traditional spruce tree. But Rick doesn't want real trees to get hurt so he decided to find some in an $n \times m$ matrix consisting of "*" and ".". To find every spruce first let's define what a spruce in the matrix is. A set of...
T = int(input()) for t in range(T): N, M = list(map(int, input().split())) a = [list(input()) for n in range(N)] ans = 0 for i in range(N): for j in range(M): if a[i][j] == "*": a[i][j] = 1 elif a[i][j] == ".": a[i][j] = 0 for i in rang...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR VAR IF VAR VAR VAR STRING ASSIGN VAR VAR VAR NUMBER IF VA...
Holidays are coming up really soon. Rick realized that it's time to think about buying a traditional spruce tree. But Rick doesn't want real trees to get hurt so he decided to find some in an $n \times m$ matrix consisting of "*" and ".". To find every spruce first let's define what a spruce in the matrix is. A set of...
def find(mat): count = 0 for i in range(n - 1, -1, -1): for j in range(m - 1, -1, -1): if mat[i][j] == ".": mat[i][j] = 0 elif j == 0 or j == m - 1 or i == n - 1: mat[i][j] = 1 else: min_val = min(mat[i + 1][j - 1], mat[...
FUNC_DEF ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER NUMBER NUMBER FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER NUMBER NUMBER IF VAR VAR VAR STRING ASSIGN VAR VAR VAR NUMBER IF VAR NUMBER VAR BIN_OP VAR NUMBER VAR BIN_OP VAR NUMBER ASSIGN VAR VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR BIN_OP VAR NUMBER BIN_OP...
Holidays are coming up really soon. Rick realized that it's time to think about buying a traditional spruce tree. But Rick doesn't want real trees to get hurt so he decided to find some in an $n \times m$ matrix consisting of "*" and ".". To find every spruce first let's define what a spruce in the matrix is. A set of...
t = int(input()) for _ in range(t): m, n = [int(i) for i in input().split()] matrix = [] for _ in range(m): matrix.append(input()) count = [[(0) for _ in range(n)] for _ in range(m)] res = 0 for i in range(m): start = 0 for j in range(n): if matrix[i][j] == "*...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST FOR VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR NUMBER VAR FUNC_CALL VAR VAR VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR ASSIGN VAR NU...
Holidays are coming up really soon. Rick realized that it's time to think about buying a traditional spruce tree. But Rick doesn't want real trees to get hurt so he decided to find some in an $n \times m$ matrix consisting of "*" and ".". To find every spruce first let's define what a spruce in the matrix is. A set of...
import sys input = sys.stdin.readline t = int(input()) for tests in range(t): n, m = map(int, input().split()) TREE = [input().strip() for i in range(n)] DP = [([0] * (m + 2)) for i in range(n + 2)] for i in range(n): for j in range(m): if TREE[i][j] == "*": DP[i][j]...
IMPORT ASSIGN VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL FUNC_CALL VAR VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP LIST NUMBER BIN_OP VAR NUMBER VAR FUNC_CALL VAR BIN_OP VAR NUMBER FOR VAR FUNC_CALL VAR VAR FOR VAR F...
Holidays are coming up really soon. Rick realized that it's time to think about buying a traditional spruce tree. But Rick doesn't want real trees to get hurt so he decided to find some in an $n \times m$ matrix consisting of "*" and ".". To find every spruce first let's define what a spruce in the matrix is. A set of...
t = int(input()) for _ in range(0, t): dp = {} a, b = map(int, input().split(" ")) board = [] for _ in range(a): board.append(list(input())) answer = 0 def heightSpruce(y, x): if board[y][x] == ".": return 0 if y == a - 1: return 1 if (y, ...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR NUMBER VAR ASSIGN VAR DICT ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR STRING ASSIGN VAR LIST FOR VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR NUMBER FUNC_DEF IF VAR VAR VAR STRING RETURN NUMBER IF VAR BIN_OP VA...
Holidays are coming up really soon. Rick realized that it's time to think about buying a traditional spruce tree. But Rick doesn't want real trees to get hurt so he decided to find some in an $n \times m$ matrix consisting of "*" and ".". To find every spruce first let's define what a spruce in the matrix is. A set of...
from sys import stdin, stdout def II(): return int(stdin.readline()) def SI(): return stdin.readline()[:-1] def MI(): return map(int, stdin.readline().split()) def solve(): n, m = MI() c = [] l = [[(0) for i in range(m)] for j in range(n)] r = [[(0) for i in range(m)] for j in range(...
FUNC_DEF RETURN FUNC_CALL VAR FUNC_CALL VAR FUNC_DEF RETURN FUNC_CALL VAR NUMBER FUNC_DEF RETURN FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR FUNC_DEF ASSIGN VAR VAR FUNC_CALL VAR ASSIGN VAR LIST ASSIGN VAR NUMBER VAR FUNC_CALL VAR VAR VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER VAR FUNC_CALL VAR VAR VAR FUNC_CALL VAR VAR FOR...
Holidays are coming up really soon. Rick realized that it's time to think about buying a traditional spruce tree. But Rick doesn't want real trees to get hurt so he decided to find some in an $n \times m$ matrix consisting of "*" and ".". To find every spruce first let's define what a spruce in the matrix is. A set of...
n, m = 0, 0 matrix = list() for t in range(int(input())): n, m = [int(num) for num in input().split()] matrix = list() for i in range(n): matrix.append([(0 if char == "." else 1) for char in input()]) for i in range(n - 1, 0, -1): for j in range(1, m - 1): if ( ...
ASSIGN VAR VAR NUMBER NUMBER ASSIGN VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR VAR STRING NUMBER NUMBER VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER NU...
Holidays are coming up really soon. Rick realized that it's time to think about buying a traditional spruce tree. But Rick doesn't want real trees to get hurt so he decided to find some in an $n \times m$ matrix consisting of "*" and ".". To find every spruce first let's define what a spruce in the matrix is. A set of...
for _ in range(int(input())): k = [int(x) for x in input().split()] a = [] for i in range(k[0]): a.append(input()) dp = [] for i in range(k[0]): t = [] for j in range(k[1]): t.append(0) dp.append(t) s = 0 for i in range(k[1]): if a[-1][i] =...
FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST FOR VAR FUNC_CALL VAR VAR NUMBER EXPR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR LIST FOR VAR FUNC_CALL VAR VAR NUMBER ASSIGN VAR LIST FOR VAR FUNC_CALL VAR VAR NUMBER EXPR FUNC_CALL VAR NUMBER EXPR FU...
Holidays are coming up really soon. Rick realized that it's time to think about buying a traditional spruce tree. But Rick doesn't want real trees to get hurt so he decided to find some in an $n \times m$ matrix consisting of "*" and ".". To find every spruce first let's define what a spruce in the matrix is. A set of...
t = int(input()) for z in range(t): n, m = map(int, input().split()) a = [] for i in range(n): tmp = input() a.append(tmp) sum = [] kq = [] ans = int(0) for i in range(n): tmp = [] tmp1 = [] for j in range(m): tmp.append(int(0)) ...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR EXPR FUNC_CALL VAR VAR ASSIGN VAR LIST ASSIGN VAR LIST ASSIGN VAR FUNC_CALL VAR NUMBER FOR VAR FUNC_CALL VAR VAR ASSIGN VAR LIST AS...
Holidays are coming up really soon. Rick realized that it's time to think about buying a traditional spruce tree. But Rick doesn't want real trees to get hurt so he decided to find some in an $n \times m$ matrix consisting of "*" and ".". To find every spruce first let's define what a spruce in the matrix is. A set of...
t = int(input()) for i in range(t): n, m = map(int, input().split()) w = [] for j in range(n): l = input() l = list(l) w.append(l) dp = [] for j in range(n): dp.append([0]) for k in range(m): if w[j][k] == "*": dp[-1].append(1 + dp[...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR VAR ASSIGN VAR LIST FOR VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR LIST NUMBER FOR VA...
Holidays are coming up really soon. Rick realized that it's time to think about buying a traditional spruce tree. But Rick doesn't want real trees to get hurt so he decided to find some in an $n \times m$ matrix consisting of "*" and ".". To find every spruce first let's define what a spruce in the matrix is. A set of...
for i in range(int(input())): n, m = map(int, input().split()) l = [] for i in range(n): a = input() s = [0] * m for i in range(len(a)): if a[i] == "*": s[i] = 1 l.append(s) for i in range(n): l[i].insert(0, 0) for i in range(n): ...
FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR BIN_OP LIST NUMBER VAR FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR IF VAR VAR STRING ASSIGN VAR VAR NUMBER EXPR FUNC_CALL VAR VAR FOR VAR F...
Holidays are coming up really soon. Rick realized that it's time to think about buying a traditional spruce tree. But Rick doesn't want real trees to get hurt so he decided to find some in an $n \times m$ matrix consisting of "*" and ".". To find every spruce first let's define what a spruce in the matrix is. A set of...
def f(x: int): return x % 2 + x // 2 def find_spruce(n: int, m: int, field: list): res = 0 temp_field = [[(0) for j in range(m)] for i in range(n)] for j in range(m): if field[0][j] == "*": temp_field[0][j] = 1 res += temp_field[0][j] for i in range(1, n): s...
FUNC_DEF VAR RETURN BIN_OP BIN_OP VAR NUMBER BIN_OP VAR NUMBER FUNC_DEF VAR VAR VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER VAR FUNC_CALL VAR VAR VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR VAR IF VAR NUMBER VAR STRING ASSIGN VAR NUMBER VAR NUMBER VAR VAR NUMBER VAR FOR VAR FUNC_CALL VAR NUMBER VAR ASSIGN VAR NUMBER FOR VA...
Holidays are coming up really soon. Rick realized that it's time to think about buying a traditional spruce tree. But Rick doesn't want real trees to get hurt so he decided to find some in an $n \times m$ matrix consisting of "*" and ".". To find every spruce first let's define what a spruce in the matrix is. A set of...
for t in range(int(input())): r, c = map(int, input().split()) a = [] for i in range(r): str = input() a.append(str) front = [[(0) for i in range(c)] for j in range(r)] back = [[(0) for i in range(c)] for j in range(r)] count = 0 for i in range(r): count = 0 f...
FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR EXPR FUNC_CALL VAR VAR ASSIGN VAR NUMBER VAR FUNC_CALL VAR VAR VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER VAR FUNC_CALL VAR VAR VAR FUNC_CALL VAR VAR...
Holidays are coming up really soon. Rick realized that it's time to think about buying a traditional spruce tree. But Rick doesn't want real trees to get hurt so he decided to find some in an $n \times m$ matrix consisting of "*" and ".". To find every spruce first let's define what a spruce in the matrix is. A set of...
def main(): def conv(ind): if ind == ".": return 0 else: return 1 def check(x, y): tx = x ty = y height = 0 count = 0 broke = False while broke == False: if ty - height >= 0 and ty + height <= m - 1 and tx + he...
FUNC_DEF FUNC_DEF IF VAR STRING RETURN NUMBER RETURN NUMBER FUNC_DEF ASSIGN VAR VAR ASSIGN VAR VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER WHILE VAR NUMBER IF BIN_OP VAR VAR NUMBER BIN_OP VAR VAR BIN_OP VAR NUMBER BIN_OP VAR VAR BIN_OP VAR NUMBER IF BIN_OP VAR VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR VAR B...
Holidays are coming up really soon. Rick realized that it's time to think about buying a traditional spruce tree. But Rick doesn't want real trees to get hurt so he decided to find some in an $n \times m$ matrix consisting of "*" and ".". To find every spruce first let's define what a spruce in the matrix is. A set of...
for _ in range(int(input())): n, m = map(int, input().split()) inp = [] out = 0 for i in range(n): inp.append(list(input())) mat = [[] for i in range(n)] for i in range(n): for j in range(m): k = 0 while j - k >= 0 and j + k < m: if inp[i][...
FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR LIST VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBE...
Holidays are coming up really soon. Rick realized that it's time to think about buying a traditional spruce tree. But Rick doesn't want real trees to get hurt so he decided to find some in an $n \times m$ matrix consisting of "*" and ".". To find every spruce first let's define what a spruce in the matrix is. A set of...
tcs = int(input()) for tc in range(tcs): m, n = list(map(int, input().split())) mn = list() li = list() ans = 0 for i in range(m): inp = input() mn.append("." + inp + ".") mn.append("." + "." * n + ".") li = [[(1 if i == "*" else 0) for i in mn[j]] for j in range(m + 1)] ...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR EXPR FUNC_CALL VAR BIN_OP BIN_OP STRING VAR STRING EXPR FUNC_CALL...
Holidays are coming up really soon. Rick realized that it's time to think about buying a traditional spruce tree. But Rick doesn't want real trees to get hurt so he decided to find some in an $n \times m$ matrix consisting of "*" and ".". To find every spruce first let's define what a spruce in the matrix is. A set of...
for y in range(int(input())): n, m = map(int, input().split()) dp = [] lst = [] for i in range(n): dp.append([0] * m) lst.append(list(input())) cnt = 0 for i in range(n - 1, -1, -1): for j in range(m): if lst[i][j] == "*": if i == n - 1 or j ==...
FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST ASSIGN VAR LIST FOR VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR BIN_OP LIST NUMBER VAR EXPR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER NUMBER N...
Holidays are coming up really soon. Rick realized that it's time to think about buying a traditional spruce tree. But Rick doesn't want real trees to get hurt so he decided to find some in an $n \times m$ matrix consisting of "*" and ".". To find every spruce first let's define what a spruce in the matrix is. A set of...
t = int(input()) for _ in range(0, t): n, m = map(int, input().split()) a = [] for _ in range(0, n): a.append(input()) ml = [[(0) for _ in range(m + 1)] for _ in range(n)] for i in range(0, n): for j in range(0, m): if a[i][j] == "*": ml[i][j + 1] = ml[i][...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR NUMBER VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST FOR VAR FUNC_CALL VAR NUMBER VAR EXPR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR NUMBER VAR FUNC_CALL VAR BIN_OP VAR NUMBER VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR NUMBER VAR ...
Holidays are coming up really soon. Rick realized that it's time to think about buying a traditional spruce tree. But Rick doesn't want real trees to get hurt so he decided to find some in an $n \times m$ matrix consisting of "*" and ".". To find every spruce first let's define what a spruce in the matrix is. A set of...
for _ in range(int(input())): n, m = map(int, input().split()) a = [] t = [] for i in range(n): a.append(input()) x = [] s = 0 for j in a[i]: if j == "*": s += 1 x.append(s) t.append(x) ans = 0 for i in range(n): ...
FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST ASSIGN VAR LIST FOR VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR LIST ASSIGN VAR NUMBER FOR VAR VAR VAR IF VAR STRING VAR NUMBER EXPR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR VAR A...
Holidays are coming up really soon. Rick realized that it's time to think about buying a traditional spruce tree. But Rick doesn't want real trees to get hurt so he decided to find some in an $n \times m$ matrix consisting of "*" and ".". To find every spruce first let's define what a spruce in the matrix is. A set of...
for _ in range(int(input())): n, m = list(map(int, input().split())) c = [] for _ in range(n): c.append(input()) pt = [0] * m ans = 0 for i in range(n): ct = [0] * m j = 0 while j < m: if c[i][j] == "*": start = j while ...
FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST FOR VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR BIN_OP LIST NUMBER VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP LIST NUMBER VAR ASSIGN VAR N...
Holidays are coming up really soon. Rick realized that it's time to think about buying a traditional spruce tree. But Rick doesn't want real trees to get hurt so he decided to find some in an $n \times m$ matrix consisting of "*" and ".". To find every spruce first let's define what a spruce in the matrix is. A set of...
import sys t = int(input()) for test in range(t): [n, m] = list(map(int, input().split(" "))) a = [] for i in range(n): a.append(input()) res = 0 b = [] for i in range(n): k = 0 bi = [] for j in range(m): if a[i][j] == "*": bi.append(1...
IMPORT ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN LIST VAR VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR STRING ASSIGN VAR LIST FOR VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR LIST FOR VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER ASSIGN VAR L...
Holidays are coming up really soon. Rick realized that it's time to think about buying a traditional spruce tree. But Rick doesn't want real trees to get hurt so he decided to find some in an $n \times m$ matrix consisting of "*" and ".". To find every spruce first let's define what a spruce in the matrix is. A set of...
for _ in range(int(input())): n, m = map(int, input().split()) matrix = [list(input()) for _ in range(n)] dp = [([0] * m) for _ in range(n)] ans = 0 s = 0 for i in range(n - 1, -1, -1): for j in range(m): if matrix[i][j] == "*": dp[i][j] = 1 if...
FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP LIST NUMBER VAR VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER NUMBER NUMBER FOR VA...
You're creating a game level for some mobile game. The level should contain some number of cells aligned in a row from left to right and numbered with consecutive integers starting from $1$, and in each cell you can either put a platform or leave it empty. In order to pass a level, a player must throw a ball from the ...
def fill(A, k, dp, x): for i in range(1, k + 1): j = len(A) - i addcost = 0 while j >= 0: addcost += (A[j] == "0") * x dp[j] = addcost j = j - k def fun(A, x, y, k, p, dp): rcost = 0 s = 0 mini = dp[p - 1] i = p - 1 + s while rcost < ...
FUNC_DEF FOR VAR FUNC_CALL VAR NUMBER BIN_OP VAR NUMBER ASSIGN VAR BIN_OP FUNC_CALL VAR VAR VAR ASSIGN VAR NUMBER WHILE VAR NUMBER VAR BIN_OP VAR VAR STRING VAR ASSIGN VAR VAR VAR ASSIGN VAR BIN_OP VAR VAR FUNC_DEF ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR VAR BIN_OP VAR NUMBER ASSIGN VAR BIN_OP BIN_OP VAR NUMBER ...
You're creating a game level for some mobile game. The level should contain some number of cells aligned in a row from left to right and numbered with consecutive integers starting from $1$, and in each cell you can either put a platform or leave it empty. In order to pass a level, a player must throw a ball from the ...
for _ in range(int(input())): n, p, k = map(int, input().split()) s = input() x, y = map(int, input().split()) mem = [0] * (n + 1) for i in range(n - 1, p - 2, -1): if s[i] == "0": if i + k < n: mem[i] = mem[i + k] mem[i] += 1 elif i + k < n: ...
FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR BIN_OP LIST NUMBER BIN_OP VAR NUMBER FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER BIN_OP VAR NUMBER NUMBER IF VAR VAR STR...
You're creating a game level for some mobile game. The level should contain some number of cells aligned in a row from left to right and numbered with consecutive integers starting from $1$, and in each cell you can either put a platform or leave it empty. In order to pass a level, a player must throw a ball from the ...
for _ in range(int(input())): n, p, k = map(int, input().split()) a = list(input()) x, y = map(int, input().split()) minn = float("inf") l = 1 for i in range(p - 1, p + k - 1): cnt = 0 for j in range(n - l, p - 2, k * -1): if a[j] == "0": cnt += 1 ...
FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR STRING ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER BIN_OP BIN_OP VAR VAR N...
You're creating a game level for some mobile game. The level should contain some number of cells aligned in a row from left to right and numbered with consecutive integers starting from $1$, and in each cell you can either put a platform or leave it empty. In order to pass a level, a player must throw a ball from the ...
import sys input = sys.stdin.readline for _ in range(int(input())): n, p, k = [*map(int, input().split())] l = [(1 - int(i)) for i in input().strip()] x, y = [*map(int, input().split())] dp = [float("inf") for i in range(n)] for i in range(n): if i < p - 1: continue dp[i...
IMPORT ASSIGN VAR VAR FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR VAR LIST FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR BIN_OP NUMBER FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR LIST FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR STRING VAR FUNC_CALL VAR...
You're creating a game level for some mobile game. The level should contain some number of cells aligned in a row from left to right and numbered with consecutive integers starting from $1$, and in each cell you can either put a platform or leave it empty. In order to pass a level, a player must throw a ball from the ...
for _ in range(int(input())): n, p, k = map(int, input().split()) s = input() x, y = map(int, input().split()) dp = [0] * n for i in range(n - 1, -1, -1): if i + k < n: dp[i] += dp[i + k] + (s[i] == "0") else: dp[i] += s[i] == "0" ans = 2e18 for i in r...
FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR BIN_OP LIST NUMBER VAR FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER NUMBER NUMBER IF BIN_OP VAR VAR VAR VAR VAR BIN_OP VA...
You're creating a game level for some mobile game. The level should contain some number of cells aligned in a row from left to right and numbered with consecutive integers starting from $1$, and in each cell you can either put a platform or leave it empty. In order to pass a level, a player must throw a ball from the ...
t = int(input()) for _ in range(t): n, p, k = map(int, input().split()) a = list(str(input())) x, y = map(int, input().split()) cost = [(0) for i in range(k)] for i in range(p - 1, n): a[i] = int(a[i]) if a[i] == 0: cost[i % k] += x a[i] = 2 mn = 10**12 ...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER VAR ...
You're creating a game level for some mobile game. The level should contain some number of cells aligned in a row from left to right and numbered with consecutive integers starting from $1$, and in each cell you can either put a platform or leave it empty. In order to pass a level, a player must throw a ball from the ...
for y in range(int(input())): a, b, c = map(int, input().split()) s = input() x, y = map(int, input().split()) ans = [0] * c t = 0 for i in range(b - 1, a): if t >= c: t = 0 if s[i] == "0": ans[t] += 1 t += 1 t = 0 by = 0 minn = 1000000...
FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR BIN_OP LIST NUMBER VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER VAR IF VAR VAR ASSIGN VAR NUMBER IF...
You're creating a game level for some mobile game. The level should contain some number of cells aligned in a row from left to right and numbered with consecutive integers starting from $1$, and in each cell you can either put a platform or leave it empty. In order to pass a level, a player must throw a ball from the ...
t = int(input()) for _ in range(t): n, p, k = map(int, input().split()) plat = "0" + input() x, y = map(int, input().split()) cost = [0] * (n + 1) for i in range(n, p - 1, -1): if i + k <= n: cost[i] = cost[i + k] if plat[i] == "0": cost[i] += x for i in r...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR BIN_OP STRING FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR BIN_OP LIST NUMBER BIN_OP VAR NUMBER FOR VAR FUNC_CALL VAR VAR BIN_OP VAR NUMBER NUMBER...
You're creating a game level for some mobile game. The level should contain some number of cells aligned in a row from left to right and numbered with consecutive integers starting from $1$, and in each cell you can either put a platform or leave it empty. In order to pass a level, a player must throw a ball from the ...
import sys def minp(): return sys.stdin.readline().strip() def mint(): return int(minp()) def mints(): return map(int, minp().split()) def solve(): n, p, k = mints() a = list(map(int, minp())) x, y = mints() dp = [0] * n for i in range(n - 1, max(n - k - 1, -1), -1): dp[i...
IMPORT FUNC_DEF RETURN FUNC_CALL FUNC_CALL VAR FUNC_DEF RETURN FUNC_CALL VAR FUNC_CALL VAR FUNC_DEF RETURN FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR FUNC_DEF ASSIGN VAR VAR VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR ASSIGN VAR BIN_OP LIST NUMBER VAR FOR VAR F...
You're creating a game level for some mobile game. The level should contain some number of cells aligned in a row from left to right and numbered with consecutive integers starting from $1$, and in each cell you can either put a platform or leave it empty. In order to pass a level, a player must throw a ball from the ...
for i in range(int(input())): n, p, k = map(int, input().split()) l = [*input()] x, y = map(int, input().split()) q = [(0) for i in range(n)] r = [] for i in range(n - 1, n - k - 1, -1): w = 0 for j in range(i, -1, -k): if l[j] == "0": w += x ...
FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER VAR FUNC_CALL VAR VAR ASSIGN VAR LIST FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER BIN_OP BIN_OP VAR VAR NUMB...
You're creating a game level for some mobile game. The level should contain some number of cells aligned in a row from left to right and numbered with consecutive integers starting from $1$, and in each cell you can either put a platform or leave it empty. In order to pass a level, a player must throw a ball from the ...
def solve(): cells, first_cell, period = map(int, input().split()) first_cell -= 1 pattern = list(map(int, input())) add_platform, reduce_cell = map(int, input().split()) dp = [0] * cells for i in range(cells - 1, -1, -1): dp[i] = 1 - pattern[i] if i + period < cells: ...
FUNC_DEF ASSIGN VAR VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR BIN_OP LIST NUMBER VAR FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER NUMBER NUMBER ASSIGN VAR VAR BIN_OP NUMBER VAR VAR ...
You're creating a game level for some mobile game. The level should contain some number of cells aligned in a row from left to right and numbered with consecutive integers starting from $1$, and in each cell you can either put a platform or leave it empty. In order to pass a level, a player must throw a ball from the ...
t = int(input()) for i in range(t): n, p, k = map(int, input().split()) s = input() x, y = map(int, input().split()) summ = 0 arr = [0] * n for j in range(k): arr[n - j - 1] = 1 - int(s[n - j - 1]) for j in range(n - k - 1, p - 2, -1): arr[j] = arr[j + k] + 1 - int(s[j]) ...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR BIN_OP LIST NUMBER VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP BIN_OP VAR VAR N...
You're creating a game level for some mobile game. The level should contain some number of cells aligned in a row from left to right and numbered with consecutive integers starting from $1$, and in each cell you can either put a platform or leave it empty. In order to pass a level, a player must throw a ball from the ...
for _ in range(int(input())): n, p, k = map(int, input().strip().split()) s = input() x, y = map(int, input().strip().split()) l = [0] * n for i in range(n - 1, -1, -1): if s[i] == "0": l[i] += x if i < n - k: l[i] += l[i + k] for i in range(0, n - p + 1):...
FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL FUNC_CALL VAR ASSIGN VAR BIN_OP LIST NUMBER VAR FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER NUMBER NUMBER IF VAR VAR STRING V...
You're creating a game level for some mobile game. The level should contain some number of cells aligned in a row from left to right and numbered with consecutive integers starting from $1$, and in each cell you can either put a platform or leave it empty. In order to pass a level, a player must throw a ball from the ...
for _ in range(int(input())): n, p, k = map(int, input().split()) s = " " + input() x, y = map(int, input().split()) f = [0] * (n + 3) kq = 10**12 for i in range(1, n + 1): if i < p: f[i] = 10**12 continue f[i] = y * (i - p) if i - k > 0: ...
FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR BIN_OP STRING FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR BIN_OP LIST NUMBER BIN_OP VAR NUMBER ASSIGN VAR BIN_OP NUMBER NUMBER FOR VAR FUNC_CALL VAR NUMBER BIN_...
You're creating a game level for some mobile game. The level should contain some number of cells aligned in a row from left to right and numbered with consecutive integers starting from $1$, and in each cell you can either put a platform or leave it empty. In order to pass a level, a player must throw a ball from the ...
t = int(input()) for z in range(t): n, p, k = map(int, input().split()) a = input() x, y = map(int, input().split()) result = 10**18 dp = [10**18] * n for i in range(n): if i + 1 < p: continue if i + 1 < k: if a[i] == "0": dp[i] = y * (i - ...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR BIN_OP NUMBER NUMBER ASSIGN VAR BIN_OP LIST BIN_OP NUMBER NUMBER VAR FOR VAR FUNC_CALL VAR VAR IF BIN...
You're creating a game level for some mobile game. The level should contain some number of cells aligned in a row from left to right and numbered with consecutive integers starting from $1$, and in each cell you can either put a platform or leave it empty. In order to pass a level, a player must throw a ball from the ...
for z in range(int(input())): n, p, k = map(int, input().split()) p -= 1 a = input() b = [0] * n x, y = map(int, input().split()) ss = n - p for i in range(p, n): b[i] = (i - p) * y + (x if a[i] == "0" else 0) for i in range(p + k, n): if a[i] == "0": b[i] = m...
FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR ASSIGN VAR BIN_OP LIST NUMBER VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR BIN_OP VAR VAR FOR VAR FUNC_CALL VAR VAR VAR ASSIGN VAR VAR BIN_OP BIN_...
You're creating a game level for some mobile game. The level should contain some number of cells aligned in a row from left to right and numbered with consecutive integers starting from $1$, and in each cell you can either put a platform or leave it empty. In order to pass a level, a player must throw a ball from the ...
for _ in range(int(input())): n, p, k = map(int, input().split()) a = input() x, y = map(int, input().split()) r = 999999999 s = [0] * k for q in range(k): count = 0 for i in range(q, n, k): if i >= p - 1 and a[i] == "0": count += 1 s[q] = coun...
FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR BIN_OP LIST NUMBER VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR VAR V...
You're creating a game level for some mobile game. The level should contain some number of cells aligned in a row from left to right and numbered with consecutive integers starting from $1$, and in each cell you can either put a platform or leave it empty. In order to pass a level, a player must throw a ball from the ...
tc = int(input()) while tc: n, p, k = map(int, input().split()) st = "#" + input() x, y = map(int, input().split()) ans = -1 dp = [0] * (n + 1) for i in reversed(range(1, n + 1)): if i + k > n: if st[i] == "0": dp[i] = 1 else: if st[i] == "...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR WHILE VAR ASSIGN VAR VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR BIN_OP STRING FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR BIN_OP LIST NUMBER BIN_OP VAR NUMBER FOR VAR FUNC_CALL VAR FUNC_CALL VAR NUMBER BIN_O...
You're creating a game level for some mobile game. The level should contain some number of cells aligned in a row from left to right and numbered with consecutive integers starting from $1$, and in each cell you can either put a platform or leave it empty. In order to pass a level, a player must throw a ball from the ...
t = int(input()) for i in range(t): n, p, k = [int(i) for i in input().split()] a = str(input()) x, y = [int(i) for i in input().split()] c = [0] * n res = 1000000000000 for j in range(n - 1, -1, -1): if n - j - 1 < k: c[j] = 1 - int(a[j]) else: c[j] = c[j...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR BIN_OP LIST NUMBER VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBE...
You're creating a game level for some mobile game. The level should contain some number of cells aligned in a row from left to right and numbered with consecutive integers starting from $1$, and in each cell you can either put a platform or leave it empty. In order to pass a level, a player must throw a ball from the ...
t = int(input()) for _ in range(t): n, p, k = [int(i) for i in input().split()] a = [int(i) for i in input()] x, y = [int(i) for i in input().split()] b = [(0) for i in range(n)] for i in range(n - k, n): b[i] = 1 - a[i] for i in range(n - k - 1, -1, -1): b[i] = b[i + k] + 1 - a[...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR BIN_OP VAR VAR VAR A...
You're creating a game level for some mobile game. The level should contain some number of cells aligned in a row from left to right and numbered with consecutive integers starting from $1$, and in each cell you can either put a platform or leave it empty. In order to pass a level, a player must throw a ball from the ...
for tt in range(int(input())): n, p, k = map(int, input().split()) s = "x" + input() x, y = map(int, input().split()) ma = 10**9 dp = [ma for i in range(n + 1)] cnt = 0 for i in range(p, p + k): if i > n: break dp[i] = cnt * y if s[i] == "0": d...
FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR BIN_OP STRING FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR BIN_OP NUMBER NUMBER ASSIGN VAR VAR VAR FUNC_CALL VAR BIN_OP VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC...
You're creating a game level for some mobile game. The level should contain some number of cells aligned in a row from left to right and numbered with consecutive integers starting from $1$, and in each cell you can either put a platform or leave it empty. In order to pass a level, a player must throw a ball from the ...
t = int(input()) for t in range(0, t): q = list(map(int, input().rstrip().split())) n = q[0] p = q[1] k = q[2] st = input() r = list(map(int, input().rstrip().split())) x = r[0] y = r[1] count = [] j = p while j <= n and j < p + k: co = 0 for d in range(j, n +...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR NUMBER VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR NUMBER ASSIGN VAR VAR NUMBER ASSIGN VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL FUNC_CALL VAR ASS...
You're creating a game level for some mobile game. The level should contain some number of cells aligned in a row from left to right and numbered with consecutive integers starting from $1$, and in each cell you can either put a platform or leave it empty. In order to pass a level, a player must throw a ball from the ...
t = int(input()) for i in range(t): n, p, k = map(int, input().split()) l = list(input()) x, y = map(int, input().split()) val = [0] * n ans = x * n + y * n for j in range(n - 1, -1, -1): if l[j] == "0": val[j] = x + val[j + k] if j + k < n else x else: va...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR BIN_OP LIST NUMBER VAR ASSIGN VAR BIN_OP BIN_OP VAR VAR BIN_OP VAR VAR FOR VAR FUNC_CAL...
You're creating a game level for some mobile game. The level should contain some number of cells aligned in a row from left to right and numbered with consecutive integers starting from $1$, and in each cell you can either put a platform or leave it empty. In order to pass a level, a player must throw a ball from the ...
for _ in range(int(input())): n, p, k = map(int, input().split()) a = input() x, y = map(int, input().split()) p -= 1 n -= p a = a[p:] ans = [0] * n for i in range(n - 1, -1, -1): ans[i] = ans[i + k] - y * k if i + k < n else i * y if a[i] == "0": ans[i] += x ...
FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR VAR NUMBER VAR VAR ASSIGN VAR VAR VAR ASSIGN VAR BIN_OP LIST NUMBER VAR FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER NUMBER NUMBER A...
You're creating a game level for some mobile game. The level should contain some number of cells aligned in a row from left to right and numbered with consecutive integers starting from $1$, and in each cell you can either put a platform or leave it empty. In order to pass a level, a player must throw a ball from the ...
import sys sys.setrecursionlimit(10**7) input = sys.stdin.readline f_inf = float("inf") mod = 10**9 + 7 def resolve(): t = int(input()) for _ in range(t): n, p, k = map(int, input().split()) p -= 1 A = input().rstrip() x, y = map(int, input().split()) dp = [f_inf] * n ...
IMPORT EXPR FUNC_CALL VAR BIN_OP NUMBER NUMBER ASSIGN VAR VAR ASSIGN VAR FUNC_CALL VAR STRING ASSIGN VAR BIN_OP BIN_OP NUMBER NUMBER NUMBER FUNC_DEF ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR VAR NUMBER ASSIGN VAR FUNC_CALL FUNC_CALL VAR...
You're creating a game level for some mobile game. The level should contain some number of cells aligned in a row from left to right and numbered with consecutive integers starting from $1$, and in each cell you can either put a platform or leave it empty. In order to pass a level, a player must throw a ball from the ...
t = int(input()) for q in range(t): n, p, k = map(int, input().split()) a = list(map(int, input())) x, y = map(int, input().split()) dp = [-1] * (n + 1) for i in range(p, n + 1): dp[i] = y * (i - p) + (a[i - 1] + 1) % 2 * x for i in range(p + k, n + 1): dp[i] = min(dp[i], dp[i - ...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR BIN_OP LIST NUMBER BIN_OP VAR NUMBER FOR VAR FUNC_CALL VAR VAR BIN_OP...
You're creating a game level for some mobile game. The level should contain some number of cells aligned in a row from left to right and numbered with consecutive integers starting from $1$, and in each cell you can either put a platform or leave it empty. In order to pass a level, a player must throw a ball from the ...
a = int(input()) for i in range(0, a): n, p, k = map(int, input().split()) p = p - 1 s = input() x, y = map(int, input().split()) arr = [int(i) for i in s] d = dict() for i in range(p, len(arr)): if (i - p) % k in d: d[(i - p) % k].append(arr[i]) else: ...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR NUMBER VAR ASSIGN VAR VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR BIN_OP VAR NUMBER ASSIGN VAR FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR VAR ASSIGN VAR FUNC_CALL VAR FOR VAR FUNC_C...
You're creating a game level for some mobile game. The level should contain some number of cells aligned in a row from left to right and numbered with consecutive integers starting from $1$, and in each cell you can either put a platform or leave it empty. In order to pass a level, a player must throw a ball from the ...
t = int(input()) for _ in range(t): n, p, k = map(int, input().split()) s = input() x, y = map(int, input().split()) dp = [0] * n for i in range(k): if s[n - i - 1] == "1": dp[i] = 0 else: dp[i] = x for i in range(k, n - p + 1): if s[n - i - 1] == ...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR BIN_OP LIST NUMBER VAR FOR VAR FUNC_CALL VAR VAR IF VAR BIN_OP BIN_OP VAR VAR NUMBER STRING ASSIGN VA...