description stringlengths 171 4k | code stringlengths 94 3.98k | normalized_code stringlengths 57 4.99k |
|---|---|---|
You are given string s. Your task is to determine if the given string s contains two non-overlapping substrings "AB" and "BA" (the substrings can go in any order).
-----Input-----
The only line of input contains a string s of length between 1 and 10^5 consisting of uppercase Latin letters.
-----Output-----
Print ... | s = input()
ab = []
ba = []
for i in range(len(s) - 1):
if s[i : i + 2] == "AB":
ab.append(i)
elif s[i : i + 2] == "BA":
ba.append(i)
if len(ab) == 0 or len(ba) == 0:
print("NO")
else:
works = False
for i in ab:
if works:
break
for j in ba:
if ... | ASSIGN VAR FUNC_CALL VAR ASSIGN VAR LIST ASSIGN VAR LIST FOR VAR FUNC_CALL VAR BIN_OP FUNC_CALL VAR VAR NUMBER IF VAR VAR BIN_OP VAR NUMBER STRING EXPR FUNC_CALL VAR VAR IF VAR VAR BIN_OP VAR NUMBER STRING EXPR FUNC_CALL VAR VAR IF FUNC_CALL VAR VAR NUMBER FUNC_CALL VAR VAR NUMBER EXPR FUNC_CALL VAR STRING ASSIGN VAR N... |
You are given string s. Your task is to determine if the given string s contains two non-overlapping substrings "AB" and "BA" (the substrings can go in any order).
-----Input-----
The only line of input contains a string s of length between 1 and 10^5 consisting of uppercase Latin letters.
-----Output-----
Print ... | s = input()
s1 = s
if "BA" in s:
s = s.replace("BA", "//", 1)
else:
s = s.replace("AB", "//")
if "AB" in s:
t = True
else:
t = False
s = s1
if "AB" in s:
s = s.replace("AB", "//", 1)
else:
s = s.replace("BA", "//")
if "BA" in s:
t1 = True
else:
t1 = False
if t or t1:
print("YES")
els... | ASSIGN VAR FUNC_CALL VAR ASSIGN VAR VAR IF STRING VAR ASSIGN VAR FUNC_CALL VAR STRING STRING NUMBER ASSIGN VAR FUNC_CALL VAR STRING STRING IF STRING VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR VAR IF STRING VAR ASSIGN VAR FUNC_CALL VAR STRING STRING NUMBER ASSIGN VAR FUNC_CALL VAR STRING STRING IF STRING VAR ASS... |
You are given string s. Your task is to determine if the given string s contains two non-overlapping substrings "AB" and "BA" (the substrings can go in any order).
-----Input-----
The only line of input contains a string s of length between 1 and 10^5 consisting of uppercase Latin letters.
-----Output-----
Print ... | s = input()
AB = [x for x in range(len(s) - 1) if s[x] + s[x + 1] == "AB"]
BA = [x for x in range(len(s) - 1) if s[x] + s[x + 1] == "BA"]
try:
print("YES" if AB[0] + 1 < BA[-1] or BA[0] + 1 < AB[-1] else "NO")
except IndexError:
print("NO") | ASSIGN VAR FUNC_CALL VAR ASSIGN VAR VAR VAR FUNC_CALL VAR BIN_OP FUNC_CALL VAR VAR NUMBER BIN_OP VAR VAR VAR BIN_OP VAR NUMBER STRING ASSIGN VAR VAR VAR FUNC_CALL VAR BIN_OP FUNC_CALL VAR VAR NUMBER BIN_OP VAR VAR VAR BIN_OP VAR NUMBER STRING EXPR FUNC_CALL VAR BIN_OP VAR NUMBER NUMBER VAR NUMBER BIN_OP VAR NUMBER NUMB... |
You are given string s. Your task is to determine if the given string s contains two non-overlapping substrings "AB" and "BA" (the substrings can go in any order).
-----Input-----
The only line of input contains a string s of length between 1 and 10^5 consisting of uppercase Latin letters.
-----Output-----
Print ... | inputsa = input().lower()
inputs = inputsa
ab_ex = False
ba_ex = False
it = True
var1 = "ab"
var2 = "ba"
while 1:
if inputs.find(var1) > -1:
temp = inputs.find(var1)
inputs = inputs[:temp] + "0" + inputs[temp + 2 :]
ab_ex = True
if inputs.find(var2) > -1:
temp = inputs.find(var2)... | ASSIGN VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR STRING ASSIGN VAR STRING WHILE NUMBER IF FUNC_CALL VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP BIN_OP VAR VAR STRING VAR BIN_OP VAR NUMBER ASSIGN VAR NUMBER IF FUNC_CALL VAR VAR NUMBER AS... |
You are given string s. Your task is to determine if the given string s contains two non-overlapping substrings "AB" and "BA" (the substrings can go in any order).
-----Input-----
The only line of input contains a string s of length between 1 and 10^5 consisting of uppercase Latin letters.
-----Output-----
Print ... | def take_AB(_list: [[str]]) -> bool:
AB = False
for i in range(len(_list) - 1):
if not AB and _list[i][0] == "A" and _list[i + 1][0] == "B":
_list[i][0] = "X"
_list[i + 1][0] = "X"
AB = True
if AB:
return True
else:
return False
def take_BA(_... | FUNC_DEF LIST LIST VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR BIN_OP FUNC_CALL VAR VAR NUMBER IF VAR VAR VAR NUMBER STRING VAR BIN_OP VAR NUMBER NUMBER STRING ASSIGN VAR VAR NUMBER STRING ASSIGN VAR BIN_OP VAR NUMBER NUMBER STRING ASSIGN VAR NUMBER IF VAR RETURN NUMBER RETURN NUMBER VAR FUNC_DEF LIST LIST VAR ASSIGN V... |
You are given string s. Your task is to determine if the given string s contains two non-overlapping substrings "AB" and "BA" (the substrings can go in any order).
-----Input-----
The only line of input contains a string s of length between 1 and 10^5 consisting of uppercase Latin letters.
-----Output-----
Print ... | s = input()
n = len(s)
l = []
k = []
for i in range(n - 1):
if s[i] == "A" and s[i + 1] == "B":
l.append([i + 1, i])
if s[i] == "B" and s[i + 1] == "A":
k.append([i, i + 1])
if len(l) == 0 or len(k) == 0:
print("NO")
else:
if abs(len(l) - len(k)) > 0 and (len(l) > 2 or len(k) > 2):
... | ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR LIST ASSIGN VAR LIST FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER IF VAR VAR STRING VAR BIN_OP VAR NUMBER STRING EXPR FUNC_CALL VAR LIST BIN_OP VAR NUMBER VAR IF VAR VAR STRING VAR BIN_OP VAR NUMBER STRING EXPR FUNC_CALL VAR LIST VAR BIN_OP VAR NUMBER IF FUNC_... |
You are given string s. Your task is to determine if the given string s contains two non-overlapping substrings "AB" and "BA" (the substrings can go in any order).
-----Input-----
The only line of input contains a string s of length between 1 and 10^5 consisting of uppercase Latin letters.
-----Output-----
Print ... | s = input().strip()
n = len(s)
T = False
if s[:2] == "AB" or s[:2] == "BA":
h = 1
k = []
h = []
for i in range(n - 1):
if s[i : i + 2] == "AB":
k.append(i)
if s[i : i + 2] == "BA":
h.append(i)
if len(k) > 1 and len(h) > 1:
print("YES")
elif len(h) == 0 or len(k) == 0:
print("NO")
eli... | ASSIGN VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER IF VAR NUMBER STRING VAR NUMBER STRING ASSIGN VAR NUMBER ASSIGN VAR LIST ASSIGN VAR LIST FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER IF VAR VAR BIN_OP VAR NUMBER STRING EXPR FUNC_CALL VAR VAR IF VAR VAR BIN_OP VAR NUMBER STRING EXPR FUNC_CALL... |
You are given string s. Your task is to determine if the given string s contains two non-overlapping substrings "AB" and "BA" (the substrings can go in any order).
-----Input-----
The only line of input contains a string s of length between 1 and 10^5 consisting of uppercase Latin letters.
-----Output-----
Print ... | def next(arr, target):
start = 0
end = len(arr) - 1
ans = -1
while start <= end:
mid = (start + end) // 2
if arr[mid] <= target:
start = mid + 1
else:
ans = mid
end = mid - 1
return ans
def isFound(s):
abIndexes = []
baIndexes = [... | FUNC_DEF ASSIGN VAR NUMBER ASSIGN VAR BIN_OP FUNC_CALL VAR VAR NUMBER ASSIGN VAR NUMBER WHILE VAR VAR ASSIGN VAR BIN_OP BIN_OP VAR VAR NUMBER IF VAR VAR VAR ASSIGN VAR BIN_OP VAR NUMBER ASSIGN VAR VAR ASSIGN VAR BIN_OP VAR NUMBER RETURN VAR FUNC_DEF ASSIGN VAR LIST ASSIGN VAR LIST FOR VAR FUNC_CALL VAR BIN_OP FUNC_CALL... |
You are given string s. Your task is to determine if the given string s contains two non-overlapping substrings "AB" and "BA" (the substrings can go in any order).
-----Input-----
The only line of input contains a string s of length between 1 and 10^5 consisting of uppercase Latin letters.
-----Output-----
Print ... | s = input()
def findPattern():
ans = ""
ba_pos = s.find("BA")
ab_pos = s.find("AB")
if ab_pos != -1:
s_new = s[ab_pos + 2 :]
if s_new.find("BA") != -1:
ans = "YES"
else:
ans = "NO"
else:
ans = "NO"
if ba_pos != -1 and ans == "NO":
... | ASSIGN VAR FUNC_CALL VAR FUNC_DEF ASSIGN VAR STRING ASSIGN VAR FUNC_CALL VAR STRING ASSIGN VAR FUNC_CALL VAR STRING IF VAR NUMBER ASSIGN VAR VAR BIN_OP VAR NUMBER IF FUNC_CALL VAR STRING NUMBER ASSIGN VAR STRING ASSIGN VAR STRING ASSIGN VAR STRING IF VAR NUMBER VAR STRING ASSIGN VAR VAR BIN_OP VAR NUMBER IF FUNC_CALL V... |
You are given string s. Your task is to determine if the given string s contains two non-overlapping substrings "AB" and "BA" (the substrings can go in any order).
-----Input-----
The only line of input contains a string s of length between 1 and 10^5 consisting of uppercase Latin letters.
-----Output-----
Print ... | s = input()
AB_left = min([(i if s[i : i + 2] == "AB" else 100000000) for i in range(len(s))])
AB_right = max([(i if s[i : i + 2] == "AB" else -100000000) for i in range(len(s))])
BA_left = min([(i if s[i : i + 2] == "BA" else 100000000) for i in range(len(s))])
BA_right = max([(i if s[i : i + 2] == "BA" else -10000000... | ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR BIN_OP VAR NUMBER STRING VAR NUMBER VAR FUNC_CALL VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR VAR BIN_OP VAR NUMBER STRING VAR NUMBER VAR FUNC_CALL VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR VAR BIN_OP VAR NUMBER STRING VAR NUMBER VAR FUNC_CALL VA... |
You are given string s. Your task is to determine if the given string s contains two non-overlapping substrings "AB" and "BA" (the substrings can go in any order).
-----Input-----
The only line of input contains a string s of length between 1 and 10^5 consisting of uppercase Latin letters.
-----Output-----
Print ... | import sys
r = input()
s = r[:]
f = 0
a = "AB"
b = "BA"
if s.find(a) != -1:
j = s.find(a)
t = s[j + 2 :]
if t.find(b) != -1:
print("YES")
sys.exit()
if s.find(b) != -1:
j = s.find(b)
t = s[j + 2 :]
if t.find(a) != -1:
print("YES")
sys.exit()
print("NO") | IMPORT ASSIGN VAR FUNC_CALL VAR ASSIGN VAR VAR ASSIGN VAR NUMBER ASSIGN VAR STRING ASSIGN VAR STRING IF FUNC_CALL VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR VAR BIN_OP VAR NUMBER IF FUNC_CALL VAR VAR NUMBER EXPR FUNC_CALL VAR STRING EXPR FUNC_CALL VAR IF FUNC_CALL VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR... |
You are given string s. Your task is to determine if the given string s contains two non-overlapping substrings "AB" and "BA" (the substrings can go in any order).
-----Input-----
The only line of input contains a string s of length between 1 and 10^5 consisting of uppercase Latin letters.
-----Output-----
Print ... | s = input()
X = []
a = 0
l = len(s)
while 1:
p = s[a:l].find("AB")
if p == -1:
break
X.append(p + a)
a = a + p + 2
Y = []
a = 0
l = len(s)
while 1:
p = s[a:l].find("BA")
if p == -1:
break
Y.append(p + a)
a = a + p + 2
f = 0
for i in X:
if f == 1:
break
for... | ASSIGN VAR FUNC_CALL VAR ASSIGN VAR LIST ASSIGN VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR WHILE NUMBER ASSIGN VAR FUNC_CALL VAR VAR VAR STRING IF VAR NUMBER EXPR FUNC_CALL VAR BIN_OP VAR VAR ASSIGN VAR BIN_OP BIN_OP VAR VAR NUMBER ASSIGN VAR LIST ASSIGN VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR WHILE NUMBER ASSIGN VAR FUNC... |
You are given string s. Your task is to determine if the given string s contains two non-overlapping substrings "AB" and "BA" (the substrings can go in any order).
-----Input-----
The only line of input contains a string s of length between 1 and 10^5 consisting of uppercase Latin letters.
-----Output-----
Print ... | s = input()
a = []
for i in range(len(s) - 1):
if s[i] == "A" and s[i + 1] == "B":
a.append((i, i + 1))
ans = False
for i in range(len(s) - 1):
if s[i] == "B" and s[i + 1] == "A":
for x, y in a:
if x not in [i, i + 1] and y not in [i, i + 1]:
ans = True
... | ASSIGN VAR FUNC_CALL VAR ASSIGN VAR LIST FOR VAR FUNC_CALL VAR BIN_OP FUNC_CALL VAR VAR NUMBER IF VAR VAR STRING VAR BIN_OP VAR NUMBER STRING EXPR FUNC_CALL VAR VAR BIN_OP VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR BIN_OP FUNC_CALL VAR VAR NUMBER IF VAR VAR STRING VAR BIN_OP VAR NUMBER STRING FOR VAR VAR VAR IF... |
You are given string s. Your task is to determine if the given string s contains two non-overlapping substrings "AB" and "BA" (the substrings can go in any order).
-----Input-----
The only line of input contains a string s of length between 1 and 10^5 consisting of uppercase Latin letters.
-----Output-----
Print ... | data = input()
def run():
for index in range(len(data) - 1):
if data[index : index + 2] == "AB":
if data[index + 2 :].count("BA") > 0:
return "YES"
if data[index : index + 2] == "BA":
if data[index + 2 :].count("AB") > 0:
return "YES"
ret... | ASSIGN VAR FUNC_CALL VAR FUNC_DEF FOR VAR FUNC_CALL VAR BIN_OP FUNC_CALL VAR VAR NUMBER IF VAR VAR BIN_OP VAR NUMBER STRING IF FUNC_CALL VAR BIN_OP VAR NUMBER STRING NUMBER RETURN STRING IF VAR VAR BIN_OP VAR NUMBER STRING IF FUNC_CALL VAR BIN_OP VAR NUMBER STRING NUMBER RETURN STRING RETURN STRING EXPR FUNC_CALL VAR F... |
You are given string s. Your task is to determine if the given string s contains two non-overlapping substrings "AB" and "BA" (the substrings can go in any order).
-----Input-----
The only line of input contains a string s of length between 1 and 10^5 consisting of uppercase Latin letters.
-----Output-----
Print ... | s = input()
w = ""
if "AB" in s:
w = s.replace("AB", ".", 1)
else:
print("NO")
exit()
if "BA" in w:
print("YES")
else:
if "BA" in s:
s = s.replace("BA", ".", 1)
else:
print("NO")
exit()
if "AB" in s:
print("YES")
else:
print("NO") | ASSIGN VAR FUNC_CALL VAR ASSIGN VAR STRING IF STRING VAR ASSIGN VAR FUNC_CALL VAR STRING STRING NUMBER EXPR FUNC_CALL VAR STRING EXPR FUNC_CALL VAR IF STRING VAR EXPR FUNC_CALL VAR STRING IF STRING VAR ASSIGN VAR FUNC_CALL VAR STRING STRING NUMBER EXPR FUNC_CALL VAR STRING EXPR FUNC_CALL VAR IF STRING VAR EXPR FUNC_CAL... |
You are given string s. Your task is to determine if the given string s contains two non-overlapping substrings "AB" and "BA" (the substrings can go in any order).
-----Input-----
The only line of input contains a string s of length between 1 and 10^5 consisting of uppercase Latin letters.
-----Output-----
Print ... | s = input()
n = len(s)
b, b1 = [], []
for i in range(n - 1):
if s[i] == "B" and s[i + 1] == "A":
b1.append(i)
if s[i] == "A" and s[i + 1] == "B":
b.append(i)
for i in range(len(b)):
c = 0
if b[i] - 1 in b1:
c += 1
if b[i] + 1 in b1:
c += 1
if len(b1) > c:
... | ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR VAR LIST LIST FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER IF VAR VAR STRING VAR BIN_OP VAR NUMBER STRING EXPR FUNC_CALL VAR VAR IF VAR VAR STRING VAR BIN_OP VAR NUMBER STRING EXPR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER IF ... |
You are given string s. Your task is to determine if the given string s contains two non-overlapping substrings "AB" and "BA" (the substrings can go in any order).
-----Input-----
The only line of input contains a string s of length between 1 and 10^5 consisting of uppercase Latin letters.
-----Output-----
Print ... | a = input()
t = "AB"
r = "BA"
if t in a and r in a:
w = str(a)
w = w.replace(r, " ", 1)
a = a.replace(t, " ", 1)
if t in w:
print("YES")
elif r in a:
print("YES")
else:
print("NO")
else:
print("NO") | ASSIGN VAR FUNC_CALL VAR ASSIGN VAR STRING ASSIGN VAR STRING IF VAR VAR VAR VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR STRING NUMBER ASSIGN VAR FUNC_CALL VAR VAR STRING NUMBER IF VAR VAR EXPR FUNC_CALL VAR STRING IF VAR VAR EXPR FUNC_CALL VAR STRING EXPR FUNC_CALL VAR STRING EXPR FUNC_CALL VAR STRING |
You are given string s. Your task is to determine if the given string s contains two non-overlapping substrings "AB" and "BA" (the substrings can go in any order).
-----Input-----
The only line of input contains a string s of length between 1 and 10^5 consisting of uppercase Latin letters.
-----Output-----
Print ... | l = input()
i = 0
f1 = False
f2 = False
f3 = False
f4 = False
while i < len(l) - 1:
if (l[i] == "A" and l[i + 1] == "B") and not f1:
f1 = True
i += 2
elif (l[i] == "B" and l[i + 1] == "A") and not f2:
f2 = True
i += 2
else:
i += 1
i = len(l) - 1
if not (f1 and f2):
... | ASSIGN VAR FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER WHILE VAR BIN_OP FUNC_CALL VAR VAR NUMBER IF VAR VAR STRING VAR BIN_OP VAR NUMBER STRING VAR ASSIGN VAR NUMBER VAR NUMBER IF VAR VAR STRING VAR BIN_OP VAR NUMBER STRING VAR ASSIGN VAR NUMBER VAR NUMBER VAR... |
You are given string s. Your task is to determine if the given string s contains two non-overlapping substrings "AB" and "BA" (the substrings can go in any order).
-----Input-----
The only line of input contains a string s of length between 1 and 10^5 consisting of uppercase Latin letters.
-----Output-----
Print ... | def main():
a, ab, ba = "*", [], []
for i, b in enumerate(input()):
if a == "A" and b == "B":
ab.append(i)
elif a == "B" and b == "A":
ba.append(i)
a = b
print(("NO", "YES")[bool(ab and ba) and (ba[-1] - ab[0] > 1 or ab[-1] - ba[0] > 1)])
main() | FUNC_DEF ASSIGN VAR VAR VAR STRING LIST LIST FOR VAR VAR FUNC_CALL VAR FUNC_CALL VAR IF VAR STRING VAR STRING EXPR FUNC_CALL VAR VAR IF VAR STRING VAR STRING EXPR FUNC_CALL VAR VAR ASSIGN VAR VAR EXPR FUNC_CALL VAR STRING STRING FUNC_CALL VAR VAR VAR BIN_OP VAR NUMBER VAR NUMBER NUMBER BIN_OP VAR NUMBER VAR NUMBER NUMB... |
You are given string s. Your task is to determine if the given string s contains two non-overlapping substrings "AB" and "BA" (the substrings can go in any order).
-----Input-----
The only line of input contains a string s of length between 1 and 10^5 consisting of uppercase Latin letters.
-----Output-----
Print ... | a = input()
p = a.count("AB")
b = a.replace("AB", ".", 1)
q = b.count("BA")
if p > 0 and q > 0:
y = 1
else:
y = 0
r = a.count("BA")
c = a.replace("BA", ".", 1)
s = c.count("AB")
if r > 0 and s > 0:
x = 1
else:
x = 0
if x == 1 or y == 1:
print("YES")
else:
print("NO") | ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR STRING ASSIGN VAR FUNC_CALL VAR STRING STRING NUMBER ASSIGN VAR FUNC_CALL VAR STRING IF VAR NUMBER VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR FUNC_CALL VAR STRING ASSIGN VAR FUNC_CALL VAR STRING STRING NUMBER ASSIGN VAR FUNC_CALL VAR STRING IF VAR NUMBER ... |
You are given string s. Your task is to determine if the given string s contains two non-overlapping substrings "AB" and "BA" (the substrings can go in any order).
-----Input-----
The only line of input contains a string s of length between 1 and 10^5 consisting of uppercase Latin letters.
-----Output-----
Print ... | def findAB(s):
ab = s.find("AB")
ba = s.rfind("BA")
if ab == -1 or ba == -1:
return False
if ab + 1 < ba:
return True
ba = s.find("BA")
ab = s.rfind("AB")
if ba + 1 < ab:
return True
return False
if findAB(input()):
print("YES")
else:
print("NO") | FUNC_DEF ASSIGN VAR FUNC_CALL VAR STRING ASSIGN VAR FUNC_CALL VAR STRING IF VAR NUMBER VAR NUMBER RETURN NUMBER IF BIN_OP VAR NUMBER VAR RETURN NUMBER ASSIGN VAR FUNC_CALL VAR STRING ASSIGN VAR FUNC_CALL VAR STRING IF BIN_OP VAR NUMBER VAR RETURN NUMBER RETURN NUMBER IF FUNC_CALL VAR FUNC_CALL VAR EXPR FUNC_CALL VAR ST... |
You are given string s. Your task is to determine if the given string s contains two non-overlapping substrings "AB" and "BA" (the substrings can go in any order).
-----Input-----
The only line of input contains a string s of length between 1 and 10^5 consisting of uppercase Latin letters.
-----Output-----
Print ... | s = input()
p = list(s)
flag = False
for i in range(len(s) - 3):
if s[i] == "A" and s[i + 1] == "B":
if "BA" in s[i + 2 :]:
print("YES")
flag = True
if flag == True:
break
if s[i] == "B" and s[i + 1] == "A":
if "AB" in s[i + 2 :]:
print("YES")
... | ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR BIN_OP FUNC_CALL VAR VAR NUMBER IF VAR VAR STRING VAR BIN_OP VAR NUMBER STRING IF STRING VAR BIN_OP VAR NUMBER EXPR FUNC_CALL VAR STRING ASSIGN VAR NUMBER IF VAR NUMBER IF VAR VAR STRING VAR BIN_OP VAR NUMBER STRING IF STRING ... |
You are given string s. Your task is to determine if the given string s contains two non-overlapping substrings "AB" and "BA" (the substrings can go in any order).
-----Input-----
The only line of input contains a string s of length between 1 and 10^5 consisting of uppercase Latin letters.
-----Output-----
Print ... | s = input()
ans = False
ans_2 = False
i = 0
l = len(s)
while i < l:
if not ans and s[i] == "A" and i + 1 < l and s[i + 1] == "B":
ans = True
i += 2
elif ans and s[i] == "B" and i + 1 < l and s[i + 1] == "A":
ans_2 = True
break
else:
i += 1
if ans * ans_2:
print("Y... | ASSIGN VAR FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR WHILE VAR VAR IF VAR VAR VAR STRING BIN_OP VAR NUMBER VAR VAR BIN_OP VAR NUMBER STRING ASSIGN VAR NUMBER VAR NUMBER IF VAR VAR VAR STRING BIN_OP VAR NUMBER VAR VAR BIN_OP VAR NUMBER STRING ASSIGN VAR NUMBER VAR N... |
You are given string s. Your task is to determine if the given string s contains two non-overlapping substrings "AB" and "BA" (the substrings can go in any order).
-----Input-----
The only line of input contains a string s of length between 1 and 10^5 consisting of uppercase Latin letters.
-----Output-----
Print ... | def are_substring(s):
i = 0
ab = False
ba = False
while i < len(s) and s[i : i + 2] != "BA":
i += 1
if i < len(s) and "AB" in s[i + 2 :]:
ab = True
j = 0
while j < len(s) and s[j : j + 2] != "AB":
j += 1
if j < len(s) and "BA" in s[j + 2 :]:
ba = True
... | FUNC_DEF ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER WHILE VAR FUNC_CALL VAR VAR VAR VAR BIN_OP VAR NUMBER STRING VAR NUMBER IF VAR FUNC_CALL VAR VAR STRING VAR BIN_OP VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER WHILE VAR FUNC_CALL VAR VAR VAR VAR BIN_OP VAR NUMBER STRING VAR NUMBER IF VAR FUNC_CALL VAR VA... |
A star is a figure of the following type: an asterisk character '*' in the center of the figure and four rays (to the left, right, top, bottom) of the same positive length. The size of a star is the length of its rays. The size of a star must be a positive number (i.e. rays of length $0$ are not allowed).
Let's consid... | n, m = input().split()
n = int(n)
m = int(m)
mat = []
count = 0
for i in range(n):
temp = input()
mat.append(temp)
for j in temp:
if j == "*":
count += 1
Map = {}
ans = {}
for i in range(n):
for j in range(m):
if mat[i][j] == "*":
u = [i - 1, j]
d = [i... | ASSIGN VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR LIST ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR EXPR FUNC_CALL VAR VAR FOR VAR VAR IF VAR STRING VAR NUMBER ASSIGN VAR DICT ASSIGN VAR DICT FOR VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VA... |
A star is a figure of the following type: an asterisk character '*' in the center of the figure and four rays (to the left, right, top, bottom) of the same positive length. The size of a star is the length of its rays. The size of a star must be a positive number (i.e. rays of length $0$ are not allowed).
Let's consid... | n, m = map(int, input().split())
maps = [list(input()) for i in range(n)]
vis = [["." for j in range(m)] for i in range(n)]
ans = []
for i in range(0, n):
for j in range(0, m):
if maps[i][j] == "*":
length = 1
while (
i - length >= 0
and i + length < n... | 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 STRING VAR FUNC_CALL VAR VAR VAR FUNC_CALL VAR VAR ASSIGN VAR LIST FOR VAR FUNC_CALL VAR NUMBER VAR FOR VAR FUNC_CALL VAR NUMBER VAR IF VAR VAR VAR STRING ASSIGN VAR NUMBER WHILE BIN_OP VAR V... |
A star is a figure of the following type: an asterisk character '*' in the center of the figure and four rays (to the left, right, top, bottom) of the same positive length. The size of a star is the length of its rays. The size of a star must be a positive number (i.e. rays of length $0$ are not allowed).
Let's consid... | from sys import exit, stdin
def listInput():
return list(map(int, stdin.readline().rstrip().split()))
n, m = listInput()
mapp = [input().rstrip() for _ in range(n)]
ans = [[[] for j in range(m)] for i in range(n)]
for i in range(n):
for j in range(m):
if mapp[i][j] == ".":
continue
... | FUNC_DEF RETURN FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL FUNC_CALL VAR VAR FUNC_CALL VAR VAR ASSIGN VAR LIST 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 NUMBER ... |
A star is a figure of the following type: an asterisk character '*' in the center of the figure and four rays (to the left, right, top, bottom) of the same positive length. The size of a star is the length of its rays. The size of a star must be a positive number (i.e. rays of length $0$ are not allowed).
Let's consid... | import sys
input = sys.stdin.readline
n, m = map(int, input().split())
MAP = [list(input().strip()) for i in range(n)]
T0 = [([0] * (m + 1)) for i in range(n + 1)]
T1 = [([0] * (m + 1)) for i in range(n + 1)]
Y0 = [([0] * (m + 1)) for i in range(n + 1)]
Y1 = [([0] * (m + 1)) for i in range(n + 1)]
for i in range(n):
... | IMPORT ASSIGN VAR VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL 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 ASSIGN VAR BIN_OP LIST NUMBER BIN_OP VAR NUMBER VAR FUNC_CALL VAR BIN_OP VAR NUMBER AS... |
A star is a figure of the following type: an asterisk character '*' in the center of the figure and four rays (to the left, right, top, bottom) of the same positive length. The size of a star is the length of its rays. The size of a star must be a positive number (i.e. rays of length $0$ are not allowed).
Let's consid... | n, m = [int(x) for x in input().split()]
a = []
for _ in range(n):
a.append(list(str(input())))
visited = [[(0) for i in range(m)] for j in range(n)]
ans = []
for i in range(n):
for j in range(m):
if a[i][j] == "*":
x = 1
while 1:
if i + x < n and j + x < m and i ... | 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 FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR NUMBER VAR FUNC_CALL VAR VAR VAR FUNC_CALL VAR VAR ASSIGN VAR LIST FOR VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR VAR IF VAR VAR VAR STRING ASSI... |
A star is a figure of the following type: an asterisk character '*' in the center of the figure and four rays (to the left, right, top, bottom) of the same positive length. The size of a star is the length of its rays. The size of a star must be a positive number (i.e. rays of length $0$ are not allowed).
Let's consid... | n, m = map(int, input().split())
s = [list(input()) for i in range(n)]
dp = [["." for i in range(m)] for j in range(n)]
ans = []
for i in range(1, n - 1):
for j in range(1, m - 1):
if (
s[i][j] == "*"
and s[i + 1][j] == "*"
and s[i - 1][j] == "*"
and s[i][j - ... | 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 STRING VAR FUNC_CALL VAR VAR VAR FUNC_CALL VAR VAR ASSIGN VAR LIST FOR VAR FUNC_CALL VAR NUMBER BIN_OP VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER BIN_OP VAR NUMBER IF VAR VAR VAR STRING VAR BIN_... |
A star is a figure of the following type: an asterisk character '*' in the center of the figure and four rays (to the left, right, top, bottom) of the same positive length. The size of a star is the length of its rays. The size of a star must be a positive number (i.e. rays of length $0$ are not allowed).
Let's consid... | io = input().split()
n = int(io[0])
m = int(io[1])
arr = []
stars = []
res = []
def analitic(y, x):
global n, m, arr
maxValue = min(y, m - x - 1, n - y - 1, x)
tMax = 0
for i in range(maxValue):
if arr[y - i - 1][x] == ".":
tMax = i
break
else:
tMax ... | ASSIGN VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR NUMBER ASSIGN VAR LIST ASSIGN VAR LIST ASSIGN VAR LIST FUNC_DEF ASSIGN VAR FUNC_CALL VAR VAR BIN_OP BIN_OP VAR VAR NUMBER BIN_OP BIN_OP VAR VAR NUMBER VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR IF VAR BIN_OP BIN_OP ... |
A star is a figure of the following type: an asterisk character '*' in the center of the figure and four rays (to the left, right, top, bottom) of the same positive length. The size of a star is the length of its rays. The size of a star must be a positive number (i.e. rays of length $0$ are not allowed).
Let's consid... | n, m = map(int, input().split())
maze = []
for _ in range(n):
maze.append(list(str(input())))
noa = 0
for i in range(n):
for j in range(m):
if maze[i][j] == "*":
noa += 1
dp = [[(0) for j in range(m)] for i in range(n)]
output = []
for i in range(1, n):
for j in range(1, m - 1):
... | 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 FUNC_CALL VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR VAR IF VAR VAR VAR STRING VAR NUMBER ASSIGN VAR NUMBER VAR FUNC_CALL VAR VAR VAR FUNC_CALL VAR... |
A star is a figure of the following type: an asterisk character '*' in the center of the figure and four rays (to the left, right, top, bottom) of the same positive length. The size of a star is the length of its rays. The size of a star must be a positive number (i.e. rays of length $0$ are not allowed).
Let's consid... | def all_true(stars, n, m):
for i in range(n):
for j in range(m):
if not stars[i][j]:
return False
return True
def get_biggest_star(ar, i, j):
ans = 0
cur = i - 1
while cur >= 0 and ar[cur][j] == "*":
ans += 1
cur -= 1
length = 0
cur = i +... | FUNC_DEF FOR VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR VAR IF VAR VAR VAR RETURN NUMBER RETURN NUMBER FUNC_DEF ASSIGN VAR NUMBER ASSIGN VAR BIN_OP VAR NUMBER WHILE VAR NUMBER VAR VAR VAR STRING VAR NUMBER VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR BIN_OP VAR NUMBER WHILE VAR VAR VAR VAR VAR STRING VAR NUMBER VAR NUMBER ... |
A star is a figure of the following type: an asterisk character '*' in the center of the figure and four rays (to the left, right, top, bottom) of the same positive length. The size of a star is the length of its rays. The size of a star must be a positive number (i.e. rays of length $0$ are not allowed).
Let's consid... | n, m = map(int, input().split())
qw = 0
grid = [None] * n
for i in range(n):
grid[i] = list(input())
ANS = []
def star(x, y, i):
if x < i or x >= n - i or y < i or y >= m - i:
return 0
if grid[x][y] == ".":
return 0
for j in range(1, i + 1):
if (
grid[x + i][y] == "... | ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR BIN_OP LIST NONE VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR LIST FUNC_DEF IF VAR VAR VAR BIN_OP VAR VAR VAR VAR VAR BIN_OP VAR VAR RETURN NUMBER IF VAR VAR VAR STRING RETURN NUMBER FOR VAR FUNC... |
A star is a figure of the following type: an asterisk character '*' in the center of the figure and four rays (to the left, right, top, bottom) of the same positive length. The size of a star is the length of its rays. The size of a star must be a positive number (i.e. rays of length $0$ are not allowed).
Let's consid... | n, m = map(int, input().split())
S = [list(str(input())) for _ in range(n)]
L = [([0] * m) for _ in range(n)]
R = [([0] * m) for _ in range(n)]
U = [([0] * m) for _ in range(n)]
D = [([0] * m) for _ in range(n)]
for i in range(n):
cnt = 0
for j in range(m):
if S[i][j] == ".":
cnt = 0
... | ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL 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 BIN_OP LIST NUMBER VAR VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP LIST NUMBER VAR VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP LI... |
A star is a figure of the following type: an asterisk character '*' in the center of the figure and four rays (to the left, right, top, bottom) of the same positive length. The size of a star is the length of its rays. The size of a star must be a positive number (i.e. rays of length $0$ are not allowed).
Let's consid... | n, m = map(int, input().split())
s = [input() for row in range(n)]
f = [[((column == "*") & 1) for column in row] for row in s]
vis = [[(0) for i in range(0, m)] for j in range(0, n)]
result = []
def allvis(vis, f, n, m):
sum1 = 0
sum2 = 0
for i in range(0, n):
for j in range(0, m):
su... | 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 VAR STRING NUMBER VAR VAR VAR VAR ASSIGN VAR NUMBER VAR FUNC_CALL VAR NUMBER VAR VAR FUNC_CALL VAR NUMBER VAR ASSIGN VAR LIST FUNC_DEF ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR NUMBE... |
A star is a figure of the following type: an asterisk character '*' in the center of the figure and four rays (to the left, right, top, bottom) of the same positive length. The size of a star is the length of its rays. The size of a star must be a positive number (i.e. rays of length $0$ are not allowed).
Let's consid... | n, m = map(int, input().split())
center = {}
t = []
for i in range(n):
t.append([])
s = input()
for j in s:
t[-1].append(j)
if t[0][0] == "*" or t[n - 1][m - 1] == "*" or t[0][m - 1] == "*" or t[n - 1][0] == "*":
print(-1)
else:
for s in range(min(n, m) // 2 + 1, 0, -1):
for i in ran... | ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR DICT ASSIGN VAR LIST FOR VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR LIST ASSIGN VAR FUNC_CALL VAR FOR VAR VAR EXPR FUNC_CALL VAR NUMBER VAR IF VAR NUMBER NUMBER STRING VAR BIN_OP VAR NUMBER BIN_OP VAR NUMBER STRING VAR NUMBER BIN_OP VAR NUMBER STRING VAR... |
A star is a figure of the following type: an asterisk character '*' in the center of the figure and four rays (to the left, right, top, bottom) of the same positive length. The size of a star is the length of its rays. The size of a star must be a positive number (i.e. rays of length $0$ are not allowed).
Let's consid... | n, m = map(int, input().split())
a = [[" " for i in range(m)] for j in range(n)]
for i in range(n):
a[i] = list(input())
check = [["." for i in range(m)] for j in range(n)]
MAX_STAR_SIZE = min(n, m) // 2
ans = []
def valid_star(i, j, s):
if s <= 0:
return False
if i - s < 0 or i + s >= n or j - s ... | ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR STRING VAR FUNC_CALL VAR VAR VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR STRING VAR FUNC_CALL VAR VAR VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP FUNC_CALL VAR VAR VAR NUMBER ASSIGN VAR LIST FUNC_DE... |
A star is a figure of the following type: an asterisk character '*' in the center of the figure and four rays (to the left, right, top, bottom) of the same positive length. The size of a star is the length of its rays. The size of a star must be a positive number (i.e. rays of length $0$ are not allowed).
Let's consid... | def CheckStar(n, m, i, j, a):
s = 1
while i - s >= 0 and i + s < n and j - s >= 0 and j + s < m:
if (
a[i - s][j] >= 1
and a[i + s][j] >= 1
and a[i][j - s] >= 1
and a[i][j + s] >= 1
):
a[i][j] += 1
a[i - s][j] += 1
... | FUNC_DEF ASSIGN VAR NUMBER WHILE BIN_OP VAR VAR NUMBER BIN_OP VAR VAR VAR BIN_OP VAR VAR NUMBER BIN_OP VAR VAR VAR IF VAR BIN_OP VAR VAR VAR NUMBER VAR BIN_OP VAR VAR VAR NUMBER VAR VAR BIN_OP VAR VAR NUMBER VAR VAR BIN_OP VAR VAR NUMBER VAR VAR VAR NUMBER VAR BIN_OP VAR VAR VAR NUMBER VAR BIN_OP VAR VAR VAR NUMBER VAR... |
A star is a figure of the following type: an asterisk character '*' in the center of the figure and four rays (to the left, right, top, bottom) of the same positive length. The size of a star is the length of its rays. The size of a star must be a positive number (i.e. rays of length $0$ are not allowed).
Let's consid... | n, m = map(int, input().split())
s = [input() for row in range(n)]
f = [[((column == "*") & 1) for column in row] for row in s]
result = []
seq_row = [[] for row in range(0, n)]
seq_column = [[] for column in range(0, m)]
dp = [[[(0) for _ in range(0, m)] for __ in range(0, n)] for ___ in range(0, 2)]
def all_vis():
... | 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 VAR STRING NUMBER VAR VAR VAR VAR ASSIGN VAR LIST ASSIGN VAR LIST VAR FUNC_CALL VAR NUMBER VAR ASSIGN VAR LIST VAR FUNC_CALL VAR NUMBER VAR ASSIGN VAR NUMBER VAR FUNC_CALL VAR NUMBER VAR VAR FUNC_CA... |
A star is a figure of the following type: an asterisk character '*' in the center of the figure and four rays (to the left, right, top, bottom) of the same positive length. The size of a star is the length of its rays. The size of a star must be a positive number (i.e. rays of length $0$ are not allowed).
Let's consid... | n, m = map(int, input().split())
arr = [input() for i in range(n)]
s1 = set()
s2 = set()
res = list()
for i in range(n):
for j in range(m):
if arr[i][j] == "*":
s1.add((i, j))
l = 1
while True:
if i - l >= 0 and i + l < n and j - l >= 0 and j + l < m:
... | ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR VAR IF VAR VAR VAR STRING EXPR FUNC_CALL VAR VAR VAR ASSIGN VAR NUMBER WHILE NUMBER IF BIN_OP... |
A star is a figure of the following type: an asterisk character '*' in the center of the figure and four rays (to the left, right, top, bottom) of the same positive length. The size of a star is the length of its rays. The size of a star must be a positive number (i.e. rays of length $0$ are not allowed).
Let's consid... | import sys
from itertools import accumulate
def input():
return sys.stdin.readline().strip()
def list2d(a, b, c):
return [([c] * b) for i in range(a)]
def list3d(a, b, c, d):
return [[([d] * c) for j in range(b)] for i in range(a)]
def list4d(a, b, c, d, e):
return [[[([e] * d) for j in range(c)... | IMPORT FUNC_DEF RETURN FUNC_CALL FUNC_CALL VAR FUNC_DEF RETURN BIN_OP LIST VAR VAR VAR FUNC_CALL VAR VAR FUNC_DEF RETURN BIN_OP LIST VAR VAR VAR FUNC_CALL VAR VAR VAR FUNC_CALL VAR VAR FUNC_DEF RETURN BIN_OP LIST VAR VAR VAR FUNC_CALL VAR VAR VAR FUNC_CALL VAR VAR VAR FUNC_CALL VAR VAR FUNC_DEF NUMBER RETURN FUNC_CALL ... |
A star is a figure of the following type: an asterisk character '*' in the center of the figure and four rays (to the left, right, top, bottom) of the same positive length. The size of a star is the length of its rays. The size of a star must be a positive number (i.e. rays of length $0$ are not allowed).
Let's consid... | n, m = map(int, input().split())
c = []
for j in range(n):
d = []
s = input()
for i in s:
d.append(i)
c.append(d)
a = []
b = []
e = []
g = []
for j in range(n):
k = [0] * m
e.append(k)
for j in range(n):
k = [0] * m
g.append(k)
dpu = []
for j in range(n):
k = [0] * m
dpu.... | ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST FOR VAR FUNC_CALL VAR VAR ASSIGN VAR LIST ASSIGN VAR FUNC_CALL VAR FOR VAR VAR EXPR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR VAR ASSIGN VAR LIST ASSIGN VAR LIST ASSIGN VAR LIST ASSIGN VAR LIST FOR VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP LIST NUMBER VA... |
A star is a figure of the following type: an asterisk character '*' in the center of the figure and four rays (to the left, right, top, bottom) of the same positive length. The size of a star is the length of its rays. The size of a star must be a positive number (i.e. rays of length $0$ are not allowed).
Let's consid... | class StarCell:
def __init__(self, row, col, top=None, bot=None, left=None, right=None):
self.row = row
self.col = col
self.covered = False
self.top = top
self.bot = bot
self.left = left
self.right = right
self._size = None
self._size_top = No... | CLASS_DEF FUNC_DEF NONE NONE NONE NONE ASSIGN VAR VAR ASSIGN VAR VAR ASSIGN VAR NUMBER ASSIGN VAR VAR ASSIGN VAR VAR ASSIGN VAR VAR ASSIGN VAR VAR ASSIGN VAR NONE ASSIGN VAR NONE ASSIGN VAR NONE ASSIGN VAR NONE ASSIGN VAR NONE FUNC_DEF ASSIGN VAR VAR VAR VAR ASSIGN VAR FUNC_CALL VAR BIN_OP VAR NUMBER VAR NONE ASSIGN VA... |
A star is a figure of the following type: an asterisk character '*' in the center of the figure and four rays (to the left, right, top, bottom) of the same positive length. The size of a star is the length of its rays. The size of a star must be a positive number (i.e. rays of length $0$ are not allowed).
Let's consid... | def main():
n, m = map(int, input().split())
grid = []
for i in range(n):
grid.append(input())
visited = set()
ans = {}
for l in range(1, min(n, m)):
for row in range(l, n - l):
for col in range(l, m - l):
new = set()
found = True
... | 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 FUNC_CALL VAR ASSIGN VAR DICT FOR VAR FUNC_CALL VAR NUMBER FUNC_CALL VAR VAR VAR FOR VAR FUNC_CALL VAR VAR BIN_OP VAR VAR FOR VAR FUNC_CALL VAR VAR BIN_OP VAR VAR ASSIG... |
A star is a figure of the following type: an asterisk character '*' in the center of the figure and four rays (to the left, right, top, bottom) of the same positive length. The size of a star is the length of its rays. The size of a star must be a positive number (i.e. rays of length $0$ are not allowed).
Let's consid... | import sys
input = sys.stdin.readline
def p(board):
for row in board:
print(*row)
n, m = map(int, input().split())
grid = [list(input().strip("\n")) for i in range(n)]
up = [[(0) for i in range(m)] for j in range(n)]
down = [[(0) for i in range(m)] for j in range(n)]
left = [[(0) for i in range(m)] for... | IMPORT ASSIGN VAR VAR FUNC_DEF FOR VAR VAR EXPR FUNC_CALL VAR VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL FUNC_CALL VAR STRING VAR 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... |
A star is a figure of the following type: an asterisk character '*' in the center of the figure and four rays (to the left, right, top, bottom) of the same positive length. The size of a star is the length of its rays. The size of a star must be a positive number (i.e. rays of length $0$ are not allowed).
Let's consid... | n, m = map(int, input().split())
table = [[0] * (m + 2)]
for i in range(n):
table.append([0])
s = input()
for j in range(m):
table[i + 1].append(2 if s[j] == "*" else 0)
table[i + 1].append(0)
table.append([0] * (m + 2))
dx = [-1, 0, 1, 0]
dy = [0, 1, 0, -1]
answer = []
for i in range(1, n + 1):... | ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST BIN_OP LIST NUMBER BIN_OP VAR NUMBER FOR VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR LIST NUMBER ASSIGN VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR BIN_OP VAR NUMBER VAR VAR STRING NUMBER NUMBER EXPR FUNC_CALL VAR BIN_OP VAR NUMBER... |
A star is a figure of the following type: an asterisk character '*' in the center of the figure and four rays (to the left, right, top, bottom) of the same positive length. The size of a star is the length of its rays. The size of a star must be a positive number (i.e. rays of length $0$ are not allowed).
Let's consid... | n, m = map(int, input().split())
G = []
L = [[(0) for x in range(m + 2)] for x in range(n + 2)]
R = [[(0) for x in range(m + 2)] for x in range(n + 2)]
U = [[(0) for x in range(m + 2)] for x in range(n + 2)]
D = [[(0) for x in range(m + 2)] for x in range(n + 2)]
for i in range(n):
s = input()
G.append(s)
for i... | ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST 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 BIN_OP VAR NUMBER VAR FUNC_CALL VAR BIN_OP VAR NUMBER ASSIGN VAR NUMBER VAR FUNC_CALL VAR BIN_OP VAR NUMBER VAR FUNC_CALL... |
A star is a figure of the following type: an asterisk character '*' in the center of the figure and four rays (to the left, right, top, bottom) of the same positive length. The size of a star is the length of its rays. The size of a star must be a positive number (i.e. rays of length $0$ are not allowed).
Let's consid... | n, m = [int(t) for t in input().split()]
field = [list(input()) for _ in range(n)]
done = [list(map(lambda t: t != "*", line)) for line in field]
muls = sum(t.count("*") for t in field)
def fit_hor(x):
return 0 <= x < m
def fit_ver(y):
return 0 <= y < n
def mark(x, y):
global muls
global done
... | ASSIGN VAR VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR STRING VAR VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR STRING VAR VAR FUNC_DEF RETURN NUMBER VAR VAR FUNC_DEF RETURN NUMBER VAR VAR FUNC_DEF IF VAR VAR ... |
A star is a figure of the following type: an asterisk character '*' in the center of the figure and four rays (to the left, right, top, bottom) of the same positive length. The size of a star is the length of its rays. The size of a star must be a positive number (i.e. rays of length $0$ are not allowed).
Let's consid... | def check_size(x_c, y_c):
global n, m
max_size = min(x_c, m - x_c - 1, y_c, n - y_c - 1)
size = 1
while (
size <= max_size
and data[y_c][x_c + size]
and data[y_c - size][x_c]
and data[y_c][x_c - size]
and data[y_c + size][x_c]
):
size += 1
size -= ... | FUNC_DEF ASSIGN VAR FUNC_CALL VAR VAR BIN_OP BIN_OP VAR VAR NUMBER VAR BIN_OP BIN_OP VAR VAR NUMBER ASSIGN VAR NUMBER WHILE VAR VAR VAR VAR BIN_OP VAR VAR VAR BIN_OP VAR VAR VAR VAR VAR BIN_OP VAR VAR VAR BIN_OP VAR VAR VAR VAR NUMBER VAR NUMBER RETURN VAR FUNC_DEF FOR VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR VAR IF... |
A star is a figure of the following type: an asterisk character '*' in the center of the figure and four rays (to the left, right, top, bottom) of the same positive length. The size of a star is the length of its rays. The size of a star must be a positive number (i.e. rays of length $0$ are not allowed).
Let's consid... | def main():
inp = []
n, m = list(map(int, input().split()))
remaining = 0
for _ in range(n):
cur_inp = input()
inp.append(cur_inp)
remaining += cur_inp.count("*")
remaining2 = [([True] * m) for _ in range(n)]
res = []
for x in range(1, n - 1):
for y in range(1... | FUNC_DEF ASSIGN VAR LIST ASSIGN VAR VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR EXPR FUNC_CALL VAR VAR VAR FUNC_CALL VAR STRING ASSIGN VAR BIN_OP LIST NUMBER VAR VAR FUNC_CALL VAR VAR ASSIGN VAR LIST FOR VAR FUNC_CALL VAR NUMBER BIN_OP... |
A star is a figure of the following type: an asterisk character '*' in the center of the figure and four rays (to the left, right, top, bottom) of the same positive length. The size of a star is the length of its rays. The size of a star must be a positive number (i.e. rays of length $0$ are not allowed).
Let's consid... | n, m = input().split(" ")[:2]
n = int(n)
m = int(m)
orig = []
for _ in range(n):
row = input()
orig.append(row)
copy = [(["."] * m) for _ in range(n)]
stars = []
for i in range(n):
for j in range(m):
curSymbol = orig[i][j]
if curSymbol == "*":
if (
i > 0
... | ASSIGN VAR VAR FUNC_CALL FUNC_CALL VAR STRING NUMBER ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR 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 STRING VAR VAR FUNC_CALL VAR VAR ASSIGN VAR LIST FOR VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR... |
A star is a figure of the following type: an asterisk character '*' in the center of the figure and four rays (to the left, right, top, bottom) of the same positive length. The size of a star is the length of its rays. The size of a star must be a positive number (i.e. rays of length $0$ are not allowed).
Let's consid... | import sys
n, m = map(int, input().split())
a = []
k = 0
ans = []
for line in sys.stdin:
a.append(list(line))
a[-1].pop()
for i in range(n):
for j in range(m):
if a[i][j] == "*":
ni = i
nj = j
p = 0
l = 0
v = 0
vn = 0
... | IMPORT ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST ASSIGN VAR NUMBER ASSIGN VAR LIST FOR VAR VAR EXPR FUNC_CALL VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR NUMBER FOR VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR VAR IF VAR VAR VAR STRING ASSIGN VAR VAR ASSIGN VAR VAR ASSIGN VAR NUMBER ASSIGN VA... |
A star is a figure of the following type: an asterisk character '*' in the center of the figure and four rays (to the left, right, top, bottom) of the same positive length. The size of a star is the length of its rays. The size of a star must be a positive number (i.e. rays of length $0$ are not allowed).
Let's consid... | import sys
mod = 10**9 + 7
INF = float("inf")
def inp():
return int(sys.stdin.readline())
def inpl():
return list(map(int, sys.stdin.readline().split()))
n, m = inpl()
s = [input() for _ in range(n)]
chk = [([False] * m) for _ in range(n)]
res = []
se = set()
for size in range(1, 50)[::-1]:
if size *... | IMPORT ASSIGN VAR BIN_OP BIN_OP NUMBER NUMBER NUMBER ASSIGN VAR FUNC_CALL VAR STRING FUNC_DEF RETURN FUNC_CALL VAR FUNC_CALL VAR FUNC_DEF RETURN FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP LIST NUMBER VAR VAR FUNC_... |
A star is a figure of the following type: an asterisk character '*' in the center of the figure and four rays (to the left, right, top, bottom) of the same positive length. The size of a star is the length of its rays. The size of a star must be a positive number (i.e. rays of length $0$ are not allowed).
Let's consid... | n, m = map(int, input().split())
s = list()
for i in range(n):
s.append(list(map(lambda x: 0 if x == "." else 1, *input().split())))
re = list()
check_re = [([0] * m) for _ in range(n)]
def check(x, y, length):
if x + length >= n or y + length >= m or x - length < 0 or y - length < 0:
if length > 1:
... | ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR VAR STRING NUMBER NUMBER FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR BIN_OP LIST NUMBER VAR VAR FUNC_CALL VAR VAR FUNC_DEF IF BIN_OP VAR VAR VAR BIN_... |
A star is a figure of the following type: an asterisk character '*' in the center of the figure and four rays (to the left, right, top, bottom) of the same positive length. The size of a star is the length of its rays. The size of a star must be a positive number (i.e. rays of length $0$ are not allowed).
Let's consid... | n, m = map(int, input().split())
pole = []
metka = []
for i in range(n):
pole.append([])
metka.append([])
s = input()
for j in range(m):
pole[i].append(s[j])
if s[j] == ".":
metka[i].append(0)
else:
metka[i].append(1)
k = 0
ans = []
for i in range(n):
... | 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 LIST EXPR FUNC_CALL VAR LIST ASSIGN VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR VAR VAR VAR IF VAR VAR STRING EXPR FUNC_CALL VAR VAR NUMBER EXPR FUNC_CALL VAR VAR NUMB... |
A star is a figure of the following type: an asterisk character '*' in the center of the figure and four rays (to the left, right, top, bottom) of the same positive length. The size of a star is the length of its rays. The size of a star must be a positive number (i.e. rays of length $0$ are not allowed).
Let's consid... | n, m = [int(i) for i in input().split()]
stars = []
directionx = [0, -1, 0, 1]
directiony = [1, 0, -1, 0]
for i in range(n):
stars.append(list(input()))
s = 0
f = [([False] * m) for i in range(n)]
for i in range(n):
for j in range(m):
if stars[i][j] == "*":
s += 1
anslist = []
ans = 0
for i ... | ASSIGN VAR VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST ASSIGN VAR LIST NUMBER NUMBER NUMBER NUMBER ASSIGN VAR LIST NUMBER NUMBER NUMBER NUMBER FOR VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR BIN_OP LIST NUMBER VAR VAR FUNC_CALL VAR VAR FOR VAR ... |
A star is a figure of the following type: an asterisk character '*' in the center of the figure and four rays (to the left, right, top, bottom) of the same positive length. The size of a star is the length of its rays. The size of a star must be a positive number (i.e. rays of length $0$ are not allowed).
Let's consid... | import sys
input = sys.stdin.readline
def read():
return list(map(int, input().split()))
n, m = read()
g = [input() for i in range(n)]
mrk = [[(0) for j in range(m)] for i in range(n)]
ans = []
for i in range(n):
for j in range(m):
if g[i][j] == "*":
cnt = [0, 0, 0, 0]
k = i... | IMPORT ASSIGN VAR VAR FUNC_DEF RETURN FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER VAR FUNC_CALL VAR VAR VAR FUNC_CALL VAR VAR ASSIGN VAR LIST FOR VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR VAR IF VAR VAR VAR STRIN... |
A star is a figure of the following type: an asterisk character '*' in the center of the figure and four rays (to the left, right, top, bottom) of the same positive length. The size of a star is the length of its rays. The size of a star must be a positive number (i.e. rays of length $0$ are not allowed).
Let's consid... | n, m = map(int, input().split())
num = []
used = []
for i in range(n):
num.append(input())
used.append([False] * m)
ans = []
for i in range(1, n - 1):
for j in range(1, m - 1):
if num[i][j] == "*":
d1 = 0
d2 = 0
d3 = 0
d4 = 0
for x in range... | 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 LIST FOR VAR FUNC_CALL VAR NUMBER BIN_OP VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER BIN_OP VAR NUMBER IF VAR VAR VAR STRIN... |
A star is a figure of the following type: an asterisk character '*' in the center of the figure and four rays (to the left, right, top, bottom) of the same positive length. The size of a star is the length of its rays. The size of a star must be a positive number (i.e. rays of length $0$ are not allowed).
Let's consid... | n, m = map(int, input().split())
sky = [0] * (n + 1)
for i in range(n):
sky[i] = list(input()) + ["."]
sky[n] = ["."] * m
used = [([False] * m) for i in range(n)]
ans = []
for i in range(n):
for j in range(m):
if sky[i][j] == ".":
continue
ln = 1
while (
sky[i - l... | 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 ASSIGN VAR VAR BIN_OP FUNC_CALL VAR FUNC_CALL VAR LIST STRING ASSIGN VAR VAR BIN_OP LIST STRING VAR ASSIGN VAR BIN_OP LIST NUMBER VAR VAR FUNC_CALL VAR VAR ASSIGN VAR LIST FOR VAR FUNC_CALL... |
A star is a figure of the following type: an asterisk character '*' in the center of the figure and four rays (to the left, right, top, bottom) of the same positive length. The size of a star is the length of its rays. The size of a star must be a positive number (i.e. rays of length $0$ are not allowed).
Let's consid... | def findStar(ar, i, j, n, m):
size = 1
newStars = 0
while True:
if (
j - size > -1
and j + size < m
and i - size > -1
and i + size < n
and ar[i][j - size] > 0
and ar[i][j + size] > 0
and ar[i - size][j] > 0
... | FUNC_DEF ASSIGN VAR NUMBER ASSIGN VAR NUMBER WHILE NUMBER IF BIN_OP VAR VAR NUMBER BIN_OP VAR VAR VAR BIN_OP VAR VAR NUMBER BIN_OP VAR VAR VAR VAR VAR BIN_OP VAR VAR NUMBER VAR VAR BIN_OP VAR VAR NUMBER VAR BIN_OP VAR VAR VAR NUMBER VAR BIN_OP VAR VAR VAR NUMBER IF VAR VAR BIN_OP VAR VAR NUMBER VAR NUMBER VAR VAR BIN_O... |
A star is a figure of the following type: an asterisk character '*' in the center of the figure and four rays (to the left, right, top, bottom) of the same positive length. The size of a star is the length of its rays. The size of a star must be a positive number (i.e. rays of length $0$ are not allowed).
Let's consid... | def main():
n, m = map(int, input().split())
ll = [(c == "*") for _ in range(n) for c in input()]
nm = n * m
RLUD = [
*[range(i, i + m) for i in range(0, nm, m)],
*[range(i, nm, m) for i in range(m)],
]
cc = [1000] * nm
for f in (True, False):
for r in RLUD:
... | FUNC_DEF ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR STRING VAR FUNC_CALL VAR VAR VAR FUNC_CALL VAR ASSIGN VAR BIN_OP VAR VAR ASSIGN VAR LIST FUNC_CALL VAR VAR BIN_OP VAR VAR VAR FUNC_CALL VAR NUMBER VAR VAR FUNC_CALL VAR VAR VAR VAR VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP LIST NUMBER VAR FO... |
A star is a figure of the following type: an asterisk character '*' in the center of the figure and four rays (to the left, right, top, bottom) of the same positive length. The size of a star is the length of its rays. The size of a star must be a positive number (i.e. rays of length $0$ are not allowed).
Let's consid... | def go():
n, m = [int(i) for i in input().split(" ")]
grid = []
count = 0
for _ in range(n):
l = [i for i in input()]
count += l.count("*")
grid.append(l)
visited = set()
stars = set()
def x(i, j):
low = i - 1
high = i + 1
while -1 < low < n a... | FUNC_DEF ASSIGN VAR VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR STRING ASSIGN VAR LIST ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR VAR FUNC_CALL VAR VAR FUNC_CALL VAR STRING EXPR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_DEF ASSIGN VAR BIN_OP VAR NUMBER ASSIGN VAR BIN... |
A star is a figure of the following type: an asterisk character '*' in the center of the figure and four rays (to the left, right, top, bottom) of the same positive length. The size of a star is the length of its rays. The size of a star must be a positive number (i.e. rays of length $0$ are not allowed).
Let's consid... | R = lambda: map(int, input().split())
n, m = R()
g = [input() for _ in range(n)]
f = [([0] * m) for i in range(n)]
res = []
for i in range(n):
for j in range(m):
if g[i][j] == "*":
d = 1
while (
i >= d
and i + d < n
and j >= d
... | ASSIGN VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR 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 LIST FOR VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR VAR IF VAR VAR VAR STRING ASSIGN VAR NUMBER WHILE VAR VAR BIN_OP VAR VA... |
A star is a figure of the following type: an asterisk character '*' in the center of the figure and four rays (to the left, right, top, bottom) of the same positive length. The size of a star is the length of its rays. The size of a star must be a positive number (i.e. rays of length $0$ are not allowed).
Let's consid... | import sys
n, m = map(int, input().split())
a = [[c for c in l.strip()] for l in sys.stdin]
ans = []
for i in range(n):
for j in range(m):
b = a[i][j]
for k in range(1, 101):
if i > k - 1 and i < n - k and j > k - 1 and j < m - k and b == "*":
if (
a[... | IMPORT ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR VAR FUNC_CALL VAR VAR VAR ASSIGN VAR LIST FOR VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR VAR VAR FOR VAR FUNC_CALL VAR NUMBER NUMBER IF VAR BIN_OP VAR NUMBER VAR BIN_OP VAR VAR VAR BIN_OP VAR NUMBER VAR BIN_OP VAR VAR VAR... |
A star is a figure of the following type: an asterisk character '*' in the center of the figure and four rays (to the left, right, top, bottom) of the same positive length. The size of a star is the length of its rays. The size of a star must be a positive number (i.e. rays of length $0$ are not allowed).
Let's consid... | w = [int(x) for x in input().split()]
n = w[0]
m = w[1]
a = [["." for i in range(m)] for j in range(n)]
s = [list(input()) for i in range(n)]
res = []
for i in range(1, n - 1):
for j in range(1, m - 1):
if (
s[i][j] == "*"
and s[i - 1][j] == "*"
and s[i + 1][j] == "*"
... | ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR NUMBER ASSIGN VAR VAR NUMBER ASSIGN VAR STRING VAR FUNC_CALL VAR VAR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL VAR VAR ASSIGN VAR LIST FOR VAR FUNC_CALL VAR NUMBER BIN_OP VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER BIN_... |
A star is a figure of the following type: an asterisk character '*' in the center of the figure and four rays (to the left, right, top, bottom) of the same positive length. The size of a star is the length of its rays. The size of a star must be a positive number (i.e. rays of length $0$ are not allowed).
Let's consid... | io = input().split()
n = int(io[0])
m = int(io[1])
arr = []
def analitic(y, x):
global n, m, arr
maxValue = min(y, m - x - 1, n - y - 1, x)
tMax = rMax = bMax = lMax = 0
for i in range(maxValue):
if arr[y - i - 1][x] == ".":
tMax = i
break
else:
tMax... | ASSIGN VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR NUMBER ASSIGN VAR LIST FUNC_DEF ASSIGN VAR FUNC_CALL VAR VAR BIN_OP BIN_OP VAR VAR NUMBER BIN_OP BIN_OP VAR VAR NUMBER VAR ASSIGN VAR VAR VAR VAR NUMBER FOR VAR FUNC_CALL VAR VAR IF VAR BIN_OP BIN_OP VAR VAR NUMBER VAR S... |
A star is a figure of the following type: an asterisk character '*' in the center of the figure and four rays (to the left, right, top, bottom) of the same positive length. The size of a star is the length of its rays. The size of a star must be a positive number (i.e. rays of length $0$ are not allowed).
Let's consid... | def i_ints():
return map(int, input().split())
def stars_to_the_left(s):
res = []
n = len(s)
l = 0
while l < n:
r = s.find("*", l)
if r == -1:
r = n
res.extend([0] * (r - l))
l = s.find(".", r)
if l == -1:
l = n
res.extend(ran... | FUNC_DEF RETURN FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR FUNC_DEF ASSIGN VAR LIST ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER WHILE VAR VAR ASSIGN VAR FUNC_CALL VAR STRING VAR IF VAR NUMBER ASSIGN VAR VAR EXPR FUNC_CALL VAR BIN_OP LIST NUMBER BIN_OP VAR VAR ASSIGN VAR FUNC_CALL VAR STRING VAR IF VAR NUMBER ASSIGN V... |
A star is a figure of the following type: an asterisk character '*' in the center of the figure and four rays (to the left, right, top, bottom) of the same positive length. The size of a star is the length of its rays. The size of a star must be a positive number (i.e. rays of length $0$ are not allowed).
Let's consid... | n, m = [int(x) for x in input().split()]
L = []
for _ in range(n):
L.extend([i for i in input()])
for i in range(n * m):
if L[i] == ".":
L[i] = 0
else:
L[i] = 1
stars = []
for i in range(n * m):
l = 0
y = i // m
x = i % m
if L[i] == 1:
while True:
if y + l... | 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 VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR BIN_OP VAR VAR IF VAR VAR STRING ASSIGN VAR VAR NUMBER ASSIGN VAR VAR NUMBER ASSIGN VAR LIST FOR VAR FUNC_CALL VAR BIN_OP VAR VAR ASSIGN VAR NUMBER ASSIGN... |
A star is a figure of the following type: an asterisk character '*' in the center of the figure and four rays (to the left, right, top, bottom) of the same positive length. The size of a star is the length of its rays. The size of a star must be a positive number (i.e. rays of length $0$ are not allowed).
Let's consid... | n, m = map(int, input().split())
T = [[] for i in range(n)]
for i in range(n):
a = list(input())
T[i] = a
S = [([0] * m) for i in range(n)]
for i in range(n):
for j in range(m):
if T[i][j] == "*":
S[i][j] = 1
rec = []
for i in range(n):
for j in range(m):
if (
1 <... | ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR VAR ASSIGN VAR BIN_OP LIST NUMBER 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 ... |
A star is a figure of the following type: an asterisk character '*' in the center of the figure and four rays (to the left, right, top, bottom) of the same positive length. The size of a star is the length of its rays. The size of a star must be a positive number (i.e. rays of length $0$ are not allowed).
Let's consid... | n, m = list(map(int, input().split()))
pole = []
unfitted = []
def star_fits(x, y, r):
if x - r >= 0 and x + r < m and y - r >= 0 and y + r < n:
res = True
for k in range(x - r, x + r + 1):
if pole[y][k] != "*":
res = False
for k in range(y - r, y + r + 1):
... | ASSIGN VAR VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST ASSIGN VAR LIST FUNC_DEF IF BIN_OP VAR VAR NUMBER BIN_OP VAR VAR VAR BIN_OP VAR VAR NUMBER BIN_OP VAR VAR VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR BIN_OP VAR VAR BIN_OP BIN_OP VAR VAR NUMBER IF VAR VAR VAR STRING ASSIGN VAR NUMBER... |
A star is a figure of the following type: an asterisk character '*' in the center of the figure and four rays (to the left, right, top, bottom) of the same positive length. The size of a star is the length of its rays. The size of a star must be a positive number (i.e. rays of length $0$ are not allowed).
Let's consid... | from sys import stdin, stdout
def main():
n, m = map(int, stdin.readline().split())
A = [list(stdin.readline()[:-1]) for _ in range(n)]
B = [[(False) for _ in range(m)] for __ in range(n)]
def star(i, j, x):
if (
i - x >= 0
and i + x < n
and j - x >= 0
... | FUNC_DEF ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR NUMBER VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER VAR FUNC_CALL VAR VAR VAR FUNC_CALL VAR VAR FUNC_DEF IF BIN_OP VAR VAR NUMBER BIN_OP VAR VAR VAR BIN_OP VAR VAR NUMBER BIN_OP VAR VAR VAR VAR BIN_OP VAR VAR VAR STRING ... |
A star is a figure of the following type: an asterisk character '*' in the center of the figure and four rays (to the left, right, top, bottom) of the same positive length. The size of a star is the length of its rays. The size of a star must be a positive number (i.e. rays of length $0$ are not allowed).
Let's consid... | n, m = list(map(int, input().split()))
used = [([True] * m) for i in range(n)]
Pole = [0] * n
M = []
for i in range(n):
Pole[i] = list(input())
for i in range(n):
for g in range(m):
if Pole[i][g] == "*":
k = 0
while i - k - 1 >= 0 and i + k + 1 < n and g - k - 1 >= 0 and g + k + ... | ASSIGN VAR VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR BIN_OP LIST NUMBER VAR VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP LIST NUMBER VAR ASSIGN VAR LIST FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR VAR IF VAR VAR VAR STRING ... |
A star is a figure of the following type: an asterisk character '*' in the center of the figure and four rays (to the left, right, top, bottom) of the same positive length. The size of a star is the length of its rays. The size of a star must be a positive number (i.e. rays of length $0$ are not allowed).
Let's consid... | import sys
n, m = map(int, input().split())
s = [list(input()) for i in range(n)]
u = [[(-1) for i in range(m)] for j in range(n)]
d = [[(-1) for i in range(m)] for j in range(n)]
l = [[(-1) for i in range(m)] for j in range(n)]
r = [[(-1) for i in range(m)] for j in range(n)]
for i in range(m):
acum = 0
for j... | IMPORT 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 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 ASSIGN VA... |
A star is a figure of the following type: an asterisk character '*' in the center of the figure and four rays (to the left, right, top, bottom) of the same positive length. The size of a star is the length of its rays. The size of a star must be a positive number (i.e. rays of length $0$ are not allowed).
Let's consid... | n, m = [int(x) for x in input().split()]
grid = [[x for x in input()] for _ in range(n)]
star_mem = {}
astr_num = set()
def l_0(x):
return x < 1
def astr_size(x, y, size):
for i in range(y, y + size + 1, 1):
astr_num.add((x, i))
for i in range(y, y - size - 1, -1):
astr_num.add((x, i))
... | ASSIGN VAR VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR VAR FUNC_CALL VAR VAR FUNC_CALL VAR VAR ASSIGN VAR DICT ASSIGN VAR FUNC_CALL VAR FUNC_DEF RETURN VAR NUMBER FUNC_DEF FOR VAR FUNC_CALL VAR VAR BIN_OP BIN_OP VAR VAR NUMBER NUMBER EXPR FUNC_CALL VAR VAR VAR FOR VAR FUNC_CALL VAR VAR BIN_OP BIN_O... |
A star is a figure of the following type: an asterisk character '*' in the center of the figure and four rays (to the left, right, top, bottom) of the same positive length. The size of a star is the length of its rays. The size of a star must be a positive number (i.e. rays of length $0$ are not allowed).
Let's consid... | def possible(i, j):
count = 0
x = 10**18
for k in range(j + 1, m):
if grid[i][k] == "*":
count += 1
else:
break
x = min(x, count)
count = 0
for k in range(j - 1, -1, -1):
if grid[i][k] == "*":
count += 1
else:
break
... | FUNC_DEF ASSIGN VAR NUMBER ASSIGN VAR BIN_OP NUMBER NUMBER FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER VAR IF VAR VAR VAR STRING VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER NUMBER NUMBER IF VAR VAR VAR STRING VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR VAR ASSIGN VAR NU... |
A star is a figure of the following type: an asterisk character '*' in the center of the figure and four rays (to the left, right, top, bottom) of the same positive length. The size of a star is the length of its rays. The size of a star must be a positive number (i.e. rays of length $0$ are not allowed).
Let's consid... | def check(x, y, fd, stars, n, m):
ln = 1
while y - ln > -1 and x - ln > -1 and y + ln < m and x + ln < n:
flag = True
if fd[x - ln][y] == ".":
flag = False
if fd[x + ln][y] == ".":
flag = False
if fd[x][y - ln] == ".":
flag = False
if f... | FUNC_DEF ASSIGN VAR NUMBER WHILE BIN_OP VAR VAR NUMBER BIN_OP VAR VAR NUMBER BIN_OP VAR VAR VAR BIN_OP VAR VAR VAR ASSIGN VAR NUMBER IF VAR BIN_OP VAR VAR VAR STRING ASSIGN VAR NUMBER IF VAR BIN_OP VAR VAR VAR STRING ASSIGN VAR NUMBER IF VAR VAR BIN_OP VAR VAR STRING ASSIGN VAR NUMBER IF VAR VAR BIN_OP VAR VAR STRING A... |
A star is a figure of the following type: an asterisk character '*' in the center of the figure and four rays (to the left, right, top, bottom) of the same positive length. The size of a star is the length of its rays. The size of a star must be a positive number (i.e. rays of length $0$ are not allowed).
Let's consid... | def zvezda(r, c, dlina):
global s, resA, d
for i in range(r - dlina, r + dlina + 1):
if s[i][c] == ".":
return False
for i in range(c - dlina, c + dlina + 1):
if s[r][i] == ".":
return False
for i in range(r - dlina, r + dlina + 1):
s[i] = s[i][:c] + "1" +... | FUNC_DEF FOR VAR FUNC_CALL VAR BIN_OP VAR VAR BIN_OP BIN_OP VAR VAR NUMBER IF VAR VAR VAR STRING RETURN NUMBER FOR VAR FUNC_CALL VAR BIN_OP VAR VAR BIN_OP BIN_OP VAR VAR NUMBER IF VAR VAR VAR STRING RETURN NUMBER FOR VAR FUNC_CALL VAR BIN_OP VAR VAR BIN_OP BIN_OP VAR VAR NUMBER ASSIGN VAR VAR BIN_OP BIN_OP VAR VAR VAR ... |
A star is a figure of the following type: an asterisk character '*' in the center of the figure and four rays (to the left, right, top, bottom) of the same positive length. The size of a star is the length of its rays. The size of a star must be a positive number (i.e. rays of length $0$ are not allowed).
Let's consid... | n, m = input().split()
n = int(n)
m = int(m)
lst = [([0] * m) for i in range(n)]
rec = [([0] * m) for i in range(n)]
fin = [([0] * m) for i in range(n)]
ans = 0
cnt = 0
for i in range(n):
tmp = input()
for j, x in enumerate(tmp):
if x == "*":
lst[i][j] = 1
for i in range(n):
for j in ran... | ASSIGN VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP LIST NUMBER VAR VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP LIST NUMBER 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 V... |
A star is a figure of the following type: an asterisk character '*' in the center of the figure and four rays (to the left, right, top, bottom) of the same positive length. The size of a star is the length of its rays. The size of a star must be a positive number (i.e. rays of length $0$ are not allowed).
Let's consid... | import sys
input = lambda: sys.stdin.readline().rstrip()
h, w = map(int, input().split())
s = (
[list("." * (w + 2))]
+ [list("." + input() + ".") for _ in range(h)]
+ [list("." * (w + 2))]
)
b = [([0] * (w + 2)) for _ in range(h + 2)]
c = [([0] * (w + 2)) for _ in range(h + 2)]
for i in range(1, h + 2):
... | IMPORT ASSIGN VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR BIN_OP BIN_OP LIST FUNC_CALL VAR BIN_OP STRING BIN_OP VAR NUMBER FUNC_CALL VAR BIN_OP BIN_OP STRING FUNC_CALL VAR STRING VAR FUNC_CALL VAR VAR LIST FUNC_CALL VAR BIN_OP STRING BIN_OP VAR NUMBER ASSIGN VAR BIN_O... |
A star is a figure of the following type: an asterisk character '*' in the center of the figure and four rays (to the left, right, top, bottom) of the same positive length. The size of a star is the length of its rays. The size of a star must be a positive number (i.e. rays of length $0$ are not allowed).
Let's consid... | N, M = map(int, input().split())
L = []
for a in range(N):
L.append(list(input()))
ANS = []
for i in range(N):
for j in range(M):
if L[i][j] == "*" or L[i][j] == "-":
k = 1
l = min(i, j, N - 1 - i, M - 1 - j)
while k <= l:
if (
(L[i... | 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 LIST FOR VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR VAR IF VAR VAR VAR STRING VAR VAR VAR STRING ASSIGN VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR VAR BIN_OP BIN_OP ... |
A star is a figure of the following type: an asterisk character '*' in the center of the figure and four rays (to the left, right, top, bottom) of the same positive length. The size of a star is the length of its rays. The size of a star must be a positive number (i.e. rays of length $0$ are not allowed).
Let's consid... | n, m = map(int, input().split())
c = []
for j in range(n):
d = []
s = input()
for i in s:
d.append(i)
c.append(d)
a = []
b = []
for j in range(n):
a.append([0] * m)
for i in range(1, n - 1):
for j in range(1, m - 1):
if c[i][j] == "*":
p = i - 1
x = 0
... | ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST FOR VAR FUNC_CALL VAR VAR ASSIGN VAR LIST ASSIGN VAR FUNC_CALL VAR FOR VAR VAR EXPR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR VAR ASSIGN VAR LIST ASSIGN VAR LIST FOR VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR BIN_OP LIST NUMBER VAR FOR VAR FUNC_CALL VAR ... |
A star is a figure of the following type: an asterisk character '*' in the center of the figure and four rays (to the left, right, top, bottom) of the same positive length. The size of a star is the length of its rays. The size of a star must be a positive number (i.e. rays of length $0$ are not allowed).
Let's consid... | n, m = map(int, input().split())
mat = []
for i in range(n):
mat.append(list(map(int, input().replace("*", "1").replace(".", "0"))))
ver, hor = [[(0) for i in range(m)] for j in range(n)], [
[(0) for i in range(m)] for j in range(n)
]
dp = [[[(0) for i in range(4)] for j in range(m)] for k in range(n)]
for i in... | 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 VAR FUNC_CALL FUNC_CALL FUNC_CALL VAR STRING STRING STRING STRING ASSIGN VAR VAR NUMBER VAR FUNC_CALL VAR VAR VAR FUNC_CALL VAR VAR NUMBER VAR FUNC_CALL VAR VAR VAR FUNC_CALL... |
A star is a figure of the following type: an asterisk character '*' in the center of the figure and four rays (to the left, right, top, bottom) of the same positive length. The size of a star is the length of its rays. The size of a star must be a positive number (i.e. rays of length $0$ are not allowed).
Let's consid... | n, m = map(int, input().split())
arr = []
for i in range(n):
arr.append(list(input()))
vis = {}
ans = []
for i in range(1, n - 1):
for j in range(1, m - 1):
if arr[i][j] == "*":
if (
arr[i + 1][j] == "*"
and arr[i - 1][j] == "*"
and arr[i][j + ... | 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 DICT ASSIGN VAR LIST FOR VAR FUNC_CALL VAR NUMBER BIN_OP VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER BIN_OP VAR NUMBER IF VAR VAR VAR STRING IF VAR BIN_OP VAR NUMBER V... |
A star is a figure of the following type: an asterisk character '*' in the center of the figure and four rays (to the left, right, top, bottom) of the same positive length. The size of a star is the length of its rays. The size of a star must be a positive number (i.e. rays of length $0$ are not allowed).
Let's consid... | n, m = map(int, input().split())
g = [[*input()] for _ in range(n)]
c = [[(0) for _ in range(m)] for _ in range(n)]
for i in range(n):
v = 0
for j in range(m):
v = (v + 1) * (g[i][j] == "*")
c[i][j] = v
v = 0
for j in range(m - 1, -1, -1):
v = (v + 1) * (g[i][j] == "*")
c... | ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST 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 NUMBER FOR VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP BIN_OP VAR NUMBER VAR VAR VAR STRING ASSIGN VAR VAR VAR VAR A... |
A star is a figure of the following type: an asterisk character '*' in the center of the figure and four rays (to the left, right, top, bottom) of the same positive length. The size of a star is the length of its rays. The size of a star must be a positive number (i.e. rays of length $0$ are not allowed).
Let's consid... | def find_stars(h, w, matrix):
max_size = 0
if matrix[h][w] == ".":
return max_size
size = 1
while True:
for next_h in range(h, h + size + 1):
if next_h >= height or matrix[next_h][w] != "*":
return max_size
for next_h in range(h, h - size - 1, -1):
... | FUNC_DEF ASSIGN VAR NUMBER IF VAR VAR VAR STRING RETURN VAR ASSIGN VAR NUMBER WHILE NUMBER FOR VAR FUNC_CALL VAR VAR BIN_OP BIN_OP VAR VAR NUMBER IF VAR VAR VAR VAR VAR STRING RETURN VAR FOR VAR FUNC_CALL VAR VAR BIN_OP BIN_OP VAR VAR NUMBER NUMBER IF VAR NUMBER VAR VAR VAR STRING RETURN VAR FOR VAR FUNC_CALL VAR VAR B... |
A star is a figure of the following type: an asterisk character '*' in the center of the figure and four rays (to the left, right, top, bottom) of the same positive length. The size of a star is the length of its rays. The size of a star must be a positive number (i.e. rays of length $0$ are not allowed).
Let's consid... | def valid(i, j):
if (i >= 0 and i < n) and (j >= 0 and j < m):
return True
return False
x = [int(x) for x in input().split()]
n = x[0]
m = x[1]
a = [[(-1) for i in range(m)] for j in range(n)]
k = []
s = []
for i in range(n):
t = [x for x in input()]
k.append(t)
for l in range(n):
for o in... | FUNC_DEF IF VAR NUMBER VAR VAR VAR NUMBER VAR VAR RETURN NUMBER RETURN NUMBER ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR NUMBER ASSIGN VAR VAR NUMBER ASSIGN VAR NUMBER VAR FUNC_CALL VAR VAR VAR FUNC_CALL VAR VAR ASSIGN VAR LIST ASSIGN VAR LIST FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR VAR FU... |
A star is a figure of the following type: an asterisk character '*' in the center of the figure and four rays (to the left, right, top, bottom) of the same positive length. The size of a star is the length of its rays. The size of a star must be a positive number (i.e. rays of length $0$ are not allowed).
Let's consid... | n, m = input().strip().split(" ")
n = int(n)
m = int(m)
grid = []
for i in range(n):
grid.append(input())
mask = [([0] * m) for _ in range(n)]
stars = dict()
for i in range(n):
for j in range(m):
if grid[i][j] == ".":
mask[i][j] = 1
else:
stars[i, j] = 1
def get_largest... | ASSIGN VAR VAR FUNC_CALL FUNC_CALL FUNC_CALL VAR STRING ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR LIST FOR VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR BIN_OP LIST NUMBER VAR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR VA... |
A star is a figure of the following type: an asterisk character '*' in the center of the figure and four rays (to the left, right, top, bottom) of the same positive length. The size of a star is the length of its rays. The size of a star must be a positive number (i.e. rays of length $0$ are not allowed).
Let's consid... | import sys
n, m = map(int, input().split())
s = [[*input()] for i in range(n)]
f = [[(0) for i in range(m)] for i in range(n)]
ans = []
for i in range(n):
for j in range(m):
if s[i][j] == ".":
f[i][j] = 1
continue
for k in range(1, min(n, m) + 1):
if (
... | IMPORT ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST FUNC_CALL VAR VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER VAR FUNC_CALL VAR VAR VAR FUNC_CALL VAR VAR ASSIGN VAR LIST 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 NUMB... |
Vanya is doing his maths homework. He has an expression of form $x_{1} \diamond x_{2} \diamond x_{3} \diamond \ldots \diamond x_{n}$, where x_1, x_2, ..., x_{n} are digits from 1 to 9, and sign [Image] represents either a plus '+' or the multiplication sign '*'. Vanya needs to add one pair of brackets in this expressio... | str = input()
n, result = len(str), eval(str)
for i in range(-1, n):
if i == -1 or str[i] == "*":
for j in range(i + 1, n + 1):
if j == n or str[j] == "*":
result = max(
result, eval(str[: i + 1] + "(" + str[i + 1 : j] + ")" + str[j:])
)
print(... | ASSIGN VAR FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR NUMBER VAR IF VAR NUMBER VAR VAR STRING FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER BIN_OP VAR NUMBER IF VAR VAR VAR VAR STRING ASSIGN VAR FUNC_CALL VAR VAR FUNC_CALL VAR BIN_OP BIN_OP BIN_OP BIN_OP VAR BIN_OP VAR NUMBER STRIN... |
Vanya is doing his maths homework. He has an expression of form $x_{1} \diamond x_{2} \diamond x_{3} \diamond \ldots \diamond x_{n}$, where x_1, x_2, ..., x_{n} are digits from 1 to 9, and sign [Image] represents either a plus '+' or the multiplication sign '*'. Vanya needs to add one pair of brackets in this expressio... | expr = input()
muls = []
expr = "1*" + expr + "*1"
for i in range(len(expr)):
if expr[i] == "*":
muls.append(i)
ans = eval(expr)
mc = len(muls)
for i in range(mc - 1):
for j in range(i + 1, mc):
t = eval(
expr[: muls[i] + 1]
+ "("
+ expr[muls[i] + 1 : muls[j]]... | ASSIGN VAR FUNC_CALL VAR ASSIGN VAR LIST ASSIGN VAR BIN_OP BIN_OP STRING VAR STRING FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR IF VAR VAR STRING EXPR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER VAR ASSIGN VAR FU... |
Vanya is doing his maths homework. He has an expression of form $x_{1} \diamond x_{2} \diamond x_{3} \diamond \ldots \diamond x_{n}$, where x_1, x_2, ..., x_{n} are digits from 1 to 9, and sign [Image] represents either a plus '+' or the multiplication sign '*'. Vanya needs to add one pair of brackets in this expressio... | s = input()
a = [0]
for i in range(len(s)):
if s[i] == "*":
a.append(i + 1)
a.append(len(s) + 1)
maxRes = eval(s)
for i in a:
for j in a:
if j > i:
maxRes = max(maxRes, eval(s[:i] + "(" + s[i : j - 1] + ")" + s[j - 1 :]))
print(maxRes) | ASSIGN VAR FUNC_CALL VAR ASSIGN VAR LIST NUMBER FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR IF VAR VAR STRING EXPR FUNC_CALL VAR BIN_OP VAR NUMBER EXPR FUNC_CALL VAR BIN_OP FUNC_CALL VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR FOR VAR VAR FOR VAR VAR IF VAR VAR ASSIGN VAR FUNC_CALL VAR VAR FUNC_CALL VAR BIN_OP BIN_OP BIN_O... |
Vanya is doing his maths homework. He has an expression of form $x_{1} \diamond x_{2} \diamond x_{3} \diamond \ldots \diamond x_{n}$, where x_1, x_2, ..., x_{n} are digits from 1 to 9, and sign [Image] represents either a plus '+' or the multiplication sign '*'. Vanya needs to add one pair of brackets in this expressio... | s = input()
ma = eval(s)
for i in range(len(s)):
if s[i] == "*":
s1 = s[:i]
s2 = s[i - len(s) + 1 :]
s3 = "(" + s1 + ")*" + s2
ma = max(ma, eval(s3))
s3 = s1 + "*(" + s2 + ")"
ma = max(ma, eval(s3))
for j in range(i):
if s[j] == "*":
... | ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR IF VAR VAR STRING ASSIGN VAR VAR VAR ASSIGN VAR VAR BIN_OP BIN_OP VAR FUNC_CALL VAR VAR NUMBER ASSIGN VAR BIN_OP BIN_OP BIN_OP STRING VAR STRING VAR ASSIGN VAR FUNC_CALL VAR VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP BIN_OP BIN_O... |
Vanya is doing his maths homework. He has an expression of form $x_{1} \diamond x_{2} \diamond x_{3} \diamond \ldots \diamond x_{n}$, where x_1, x_2, ..., x_{n} are digits from 1 to 9, and sign [Image] represents either a plus '+' or the multiplication sign '*'. Vanya needs to add one pair of brackets in this expressio... | s = input()
w = "1*" + s + "*1"
n = len(w)
res = eval(w)
for i in range(n):
if w[i] == "*":
for j in range(i + 1, n):
if w[j] == "*":
temp = eval(w[: i + 1] + "(" + w[i + 1 : j] + ")" + w[j:])
res = max(res, temp)
print(res) | ASSIGN VAR FUNC_CALL VAR ASSIGN VAR BIN_OP BIN_OP STRING VAR STRING ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR VAR IF VAR VAR STRING FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER VAR IF VAR VAR STRING ASSIGN VAR FUNC_CALL VAR BIN_OP BIN_OP BIN_OP BIN_OP VAR BIN_OP VAR NUMBER STRING VAR BI... |
Vanya is doing his maths homework. He has an expression of form $x_{1} \diamond x_{2} \diamond x_{3} \diamond \ldots \diamond x_{n}$, where x_1, x_2, ..., x_{n} are digits from 1 to 9, and sign [Image] represents either a plus '+' or the multiplication sign '*'. Vanya needs to add one pair of brackets in this expressio... | s = "1*" + input() + "*1"
poses = []
for i in range(len(s)):
if s[i] == "*":
poses.append(i)
ans = 0
for i in poses:
for j in poses:
if i < j:
t = s[: i + 1] + "(" + s[i + 1 : j] + ")" + s[j:]
ans = max(ans, eval(t))
print(ans) | ASSIGN VAR BIN_OP BIN_OP STRING FUNC_CALL VAR STRING ASSIGN VAR LIST FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR IF VAR VAR STRING EXPR FUNC_CALL VAR VAR ASSIGN VAR NUMBER FOR VAR VAR FOR VAR VAR IF VAR VAR ASSIGN VAR BIN_OP BIN_OP BIN_OP BIN_OP VAR BIN_OP VAR NUMBER STRING VAR BIN_OP VAR NUMBER VAR STRING VAR VAR ASSIGN V... |
Vanya is doing his maths homework. He has an expression of form $x_{1} \diamond x_{2} \diamond x_{3} \diamond \ldots \diamond x_{n}$, where x_1, x_2, ..., x_{n} are digits from 1 to 9, and sign [Image] represents either a plus '+' or the multiplication sign '*'. Vanya needs to add one pair of brackets in this expressio... | s = input()
s = "1*" + s + "*1"
lx = len(s)
rep = eval(s)
pos = []
for i in range(lx):
if s[i] == "*":
pos.append(i)
sz = len(pos)
for aa1 in range(sz):
for aa2 in range(aa1 + 1, sz):
a1 = pos[aa1]
a2 = pos[aa2]
ns = ""
for i in range(lx):
if i == a2:
... | ASSIGN VAR FUNC_CALL VAR ASSIGN VAR BIN_OP BIN_OP STRING VAR STRING ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR LIST FOR VAR FUNC_CALL VAR VAR IF VAR VAR STRING EXPR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER VAR ASSIGN VAR V... |
Vanya is doing his maths homework. He has an expression of form $x_{1} \diamond x_{2} \diamond x_{3} \diamond \ldots \diamond x_{n}$, where x_1, x_2, ..., x_{n} are digits from 1 to 9, and sign [Image] represents either a plus '+' or the multiplication sign '*'. Vanya needs to add one pair of brackets in this expressio... | s = "1*" + input() + "*1"
L = len(s)
ans = eval(s)
for i in range(L):
if s[i] == "*":
for j in range(i + 1, L):
if s[j] == "*":
ans = max(ans, eval(s[: i + 1] + "(" + s[i + 1 : j] + ")" + s[j:]))
print(ans) | ASSIGN VAR BIN_OP BIN_OP STRING FUNC_CALL VAR STRING ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR VAR IF VAR VAR STRING FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER VAR IF VAR VAR STRING ASSIGN VAR FUNC_CALL VAR VAR FUNC_CALL VAR BIN_OP BIN_OP BIN_OP BIN_OP VAR BIN_OP VAR NUMBER STRING VAR... |
Vanya is doing his maths homework. He has an expression of form $x_{1} \diamond x_{2} \diamond x_{3} \diamond \ldots \diamond x_{n}$, where x_1, x_2, ..., x_{n} are digits from 1 to 9, and sign [Image] represents either a plus '+' or the multiplication sign '*'. Vanya needs to add one pair of brackets in this expressio... | s = input()
r = [0]
t = s.find("*")
while -1 != t:
r += [t]
t = s.find("*", t + 1)
r += [len(s)]
R = 0
for i in range(len(r)):
for j in range(i + 1, len(r)):
a = r[i]
b = r[j]
t = s[:a]
if t:
t += "*"
a += 1
t += "(" + s[a:b] + ")" + s[b:]
... | ASSIGN VAR FUNC_CALL VAR ASSIGN VAR LIST NUMBER ASSIGN VAR FUNC_CALL VAR STRING WHILE NUMBER VAR VAR LIST VAR ASSIGN VAR FUNC_CALL VAR STRING BIN_OP VAR NUMBER VAR LIST FUNC_CALL VAR VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER FUNC_CALL VAR VAR ASSIGN VAR VAR VA... |
Vanya is doing his maths homework. He has an expression of form $x_{1} \diamond x_{2} \diamond x_{3} \diamond \ldots \diamond x_{n}$, where x_1, x_2, ..., x_{n} are digits from 1 to 9, and sign [Image] represents either a plus '+' or the multiplication sign '*'. Vanya needs to add one pair of brackets in this expressio... | s = "1*" + input() + "*1"
muls = [1]
for i in range(3, len(s) - 2, 2):
if s[i] == "*" and (s[i - 2] == "+" or s[i + 2] == "+"):
muls.append(i)
muls.append(len(s) - 2)
m = eval(s)
for i in range(len(muls)):
for j in range(i + 1, len(muls)):
a, b = muls[i], muls[j]
new_s = s[: a + 1] + "("... | ASSIGN VAR BIN_OP BIN_OP STRING FUNC_CALL VAR STRING ASSIGN VAR LIST NUMBER FOR VAR FUNC_CALL VAR NUMBER BIN_OP FUNC_CALL VAR VAR NUMBER NUMBER IF VAR VAR STRING VAR BIN_OP VAR NUMBER STRING VAR BIN_OP VAR NUMBER STRING EXPR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR BIN_OP FUNC_CALL VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR V... |
Vanya is doing his maths homework. He has an expression of form $x_{1} \diamond x_{2} \diamond x_{3} \diamond \ldots \diamond x_{n}$, where x_1, x_2, ..., x_{n} are digits from 1 to 9, and sign [Image] represents either a plus '+' or the multiplication sign '*'. Vanya needs to add one pair of brackets in this expressio... | s = input()
n = len(s)
p = [-1] + [i for i in range(n) if s[i] == "*"] + [n]
m = len(p)
ans = eval(s)
for i in range(m):
for j in range(i + 1, m):
a, b = p[i] + 1, p[j]
t = s[:a] + "(" + s[a:b] + ")" + s[b:]
ans = max(ans, eval(t))
print(ans) | ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP BIN_OP LIST NUMBER VAR VAR FUNC_CALL VAR VAR VAR VAR STRING LIST VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER VAR ASSIGN VAR VAR BIN_OP VAR VAR NUMBER VAR VAR ASSIGN... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.