description stringlengths 171 4k | code stringlengths 94 3.98k | normalized_code stringlengths 57 4.99k |
|---|---|---|
You are given a non-negative integer n, its decimal representation consists of at most 100 digits and doesn't contain leading zeroes.
Your task is to determine if it is possible in this case to remove some of the digits (possibly not remove any digit at all) so that the result contains at least one digit, forms a non-... | def check_me(inp):
for i in inp:
if int(i) % 8 == 0:
print("YES\n" + i)
return
for i in range(len(inp) - 1, 0, -1):
for j in range(i - 1, -1, -1):
curNumber = int(inp[j] + inp[i])
if curNumber % 8 == 0:
print("YES\n" + str(curNumber... | FUNC_DEF FOR VAR VAR IF BIN_OP FUNC_CALL VAR VAR NUMBER NUMBER EXPR FUNC_CALL VAR BIN_OP STRING VAR RETURN FOR VAR FUNC_CALL VAR BIN_OP FUNC_CALL VAR VAR NUMBER NUMBER NUMBER FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER NUMBER NUMBER ASSIGN VAR FUNC_CALL VAR BIN_OP VAR VAR VAR VAR IF BIN_OP VAR NUMBER NUMBER EXPR FUNC_CALL ... |
You are given a non-negative integer n, its decimal representation consists of at most 100 digits and doesn't contain leading zeroes.
Your task is to determine if it is possible in this case to remove some of the digits (possibly not remove any digit at all) so that the result contains at least one digit, forms a non-... | import itertools
import sys
lst = [int(item) for item in list(input())]
for i in lst:
if i in (0, 8):
print("YES\n{}".format(i))
sys.exit(0)
for i, j in itertools.combinations(list(range(len(lst))), 2):
if (lst[i] * 10 + lst[j]) % 8 == 0:
print("YES\n{}".format(lst[i] * 10 + lst[j]))
... | IMPORT IMPORT ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR VAR IF VAR NUMBER NUMBER EXPR FUNC_CALL VAR FUNC_CALL STRING VAR EXPR FUNC_CALL VAR NUMBER FOR VAR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR VAR NUMBER IF BIN_OP BIN_OP BIN_OP VAR VAR NUMBER VAR VAR NUMBER NUMBER EXPR F... |
You are given a non-negative integer n, its decimal representation consists of at most 100 digits and doesn't contain leading zeroes.
Your task is to determine if it is possible in this case to remove some of the digits (possibly not remove any digit at all) so that the result contains at least one digit, forms a non-... | def getLast(arr):
n = len(arr)
for i in range(n - 1, -1, -1):
t = a.pop(i)
if t % 2 == 0:
return t
return -1
a = list(map(int, input()))
last = getLast(a)
if last == -1:
print("NO")
elif last == 0 or last == 8:
print("YES")
print(last)
else:
for i in a:
... | FUNC_DEF ASSIGN VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER NUMBER NUMBER ASSIGN VAR FUNC_CALL VAR VAR IF BIN_OP VAR NUMBER NUMBER RETURN VAR RETURN NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR IF VAR NUMBER EXPR FUNC_CALL VAR STRING IF VAR NUMBER VAR NU... |
You are given a non-negative integer n, its decimal representation consists of at most 100 digits and doesn't contain leading zeroes.
Your task is to determine if it is possible in this case to remove some of the digits (possibly not remove any digit at all) so that the result contains at least one digit, forms a non-... | import sys
s = input()
k = len(s)
if s.count("0") > 0:
print("YES")
print(0)
elif s.count("8") > 0:
print("YES")
print(8)
elif k == 1:
print("NO")
elif k == 2:
for i in range(1, k):
for j in range(i):
if int(s[j] + s[i]) % 8 == 0:
print("YES")
... | IMPORT ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR IF FUNC_CALL VAR STRING NUMBER EXPR FUNC_CALL VAR STRING EXPR FUNC_CALL VAR NUMBER IF FUNC_CALL VAR STRING NUMBER EXPR FUNC_CALL VAR STRING EXPR FUNC_CALL VAR NUMBER IF VAR NUMBER EXPR FUNC_CALL VAR STRING IF VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER VAR FOR VA... |
You are given a non-negative integer n, its decimal representation consists of at most 100 digits and doesn't contain leading zeroes.
Your task is to determine if it is possible in this case to remove some of the digits (possibly not remove any digit at all) so that the result contains at least one digit, forms a non-... | s = input()
n = len(s)
if "0" in s:
print("YES")
print(0)
exit(0)
for i in range(n):
for j in range(i + 1, n):
for k in range(j + 1, n):
t = int(s[i] + s[j] + s[k])
if t % 8 == 0:
print("YES")
print(t)
exit(0)
t = in... | ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR IF STRING VAR EXPR FUNC_CALL VAR STRING EXPR FUNC_CALL VAR NUMBER EXPR FUNC_CALL VAR NUMBER FOR VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER VAR FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER VAR ASSIGN VAR FUNC_CALL VAR BIN_OP BIN_OP VAR VAR VAR VAR VAR V... |
You are given a non-negative integer n, its decimal representation consists of at most 100 digits and doesn't contain leading zeroes.
Your task is to determine if it is possible in this case to remove some of the digits (possibly not remove any digit at all) so that the result contains at least one digit, forms a non-... | n = input()
if n.count("0"):
print("YES\n0")
exit()
if n.count("8"):
print("YES\n8")
exit()
if len(n) == 2 and int(n) % 8 == 0:
print("Yes")
print(n)
exit()
for i in range(len(n) - 1, -1, -1):
for j in range(i - 1, -1, -1):
if (int(n[j]) * 10 + int(n[i])) % 8 == 0:
pr... | ASSIGN VAR FUNC_CALL VAR IF FUNC_CALL VAR STRING EXPR FUNC_CALL VAR STRING EXPR FUNC_CALL VAR IF FUNC_CALL VAR STRING EXPR FUNC_CALL VAR STRING EXPR FUNC_CALL VAR IF FUNC_CALL VAR VAR NUMBER BIN_OP FUNC_CALL VAR VAR NUMBER NUMBER EXPR FUNC_CALL VAR STRING EXPR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR FOR VAR FUNC_CALL VAR ... |
You are given a non-negative integer n, its decimal representation consists of at most 100 digits and doesn't contain leading zeroes.
Your task is to determine if it is possible in this case to remove some of the digits (possibly not remove any digit at all) so that the result contains at least one digit, forms a non-... | s = input()
y = "YES"
flag = True
if "8" in s:
print(y)
print("8")
flag = False
if flag:
if "0" in s:
print(y)
print("0")
flag = False
if flag:
for i in range(16, 100, 8):
a = str(i)
if s.find(a[0]) + 1 > 0 and s.find(a[1], s.find(a[0]) + 1) >= 0:
... | ASSIGN VAR FUNC_CALL VAR ASSIGN VAR STRING ASSIGN VAR NUMBER IF STRING VAR EXPR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR STRING ASSIGN VAR NUMBER IF VAR IF STRING VAR EXPR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR STRING ASSIGN VAR NUMBER IF VAR FOR VAR FUNC_CALL VAR NUMBER NUMBER NUMBER ASSIGN VAR FUNC_CALL VAR VAR IF BIN_OP F... |
You are given a non-negative integer n, its decimal representation consists of at most 100 digits and doesn't contain leading zeroes.
Your task is to determine if it is possible in this case to remove some of the digits (possibly not remove any digit at all) so that the result contains at least one digit, forms a non-... | def get(a, b, c):
num = int(a) * 100 + int(b) * 10 + int(c)
if num % 8 == 0:
print("YES")
print(num)
return True
return False
def deal(n):
l_raw = len(n)
n = "0000" + n
l = len(n)
diff = l - l_raw - 1
for i in range(l):
for j in range(i + 1, l):
... | FUNC_DEF ASSIGN VAR BIN_OP BIN_OP BIN_OP FUNC_CALL VAR VAR NUMBER BIN_OP FUNC_CALL VAR VAR NUMBER FUNC_CALL VAR VAR IF BIN_OP VAR NUMBER NUMBER EXPR FUNC_CALL VAR STRING EXPR FUNC_CALL VAR VAR RETURN NUMBER RETURN NUMBER FUNC_DEF ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP STRING VAR ASSIGN VAR FUNC_CALL VAR VAR ASS... |
You are given a non-negative integer n, its decimal representation consists of at most 100 digits and doesn't contain leading zeroes.
Your task is to determine if it is possible in this case to remove some of the digits (possibly not remove any digit at all) so that the result contains at least one digit, forms a non-... | s = input()
s = "00" + s
u = 0
for i in range(len(s)):
for j in range(i + 1, len(s)):
for k in range(j + 1, len(s)):
if int(s[i] + s[j] + s[k]) % 8 == 0 and u == 0:
print("YES")
u = 1
ans = s[i] + s[j] + s[k]
if s[i] == "0":
... | ASSIGN VAR FUNC_CALL VAR ASSIGN VAR BIN_OP STRING 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 FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER FUNC_CALL VAR VAR IF BIN_OP FUNC_CALL VAR BIN_OP BIN_OP VAR VAR VAR VAR VAR VAR NUMBER NUMBER VAR NUMBER EXPR ... |
You are given a non-negative integer n, its decimal representation consists of at most 100 digits and doesn't contain leading zeroes.
Your task is to determine if it is possible in this case to remove some of the digits (possibly not remove any digit at all) so that the result contains at least one digit, forms a non-... | number = input()
def sol(number):
n = len(number)
if n >= 3:
number += " "
n = len(number)
for i in range(0, n):
for j in range(i, n):
for h in range(j, n):
if i != j != h:
num = int(number[i] + number[j] + number... | ASSIGN VAR FUNC_CALL VAR FUNC_DEF ASSIGN VAR FUNC_CALL VAR VAR IF VAR NUMBER VAR STRING ASSIGN VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR NUMBER VAR FOR VAR FUNC_CALL VAR VAR VAR FOR VAR FUNC_CALL VAR VAR VAR IF VAR VAR VAR ASSIGN VAR FUNC_CALL VAR BIN_OP BIN_OP VAR VAR VAR VAR VAR VAR IF BIN_OP VAR NUMBER NUMBER EXPR... |
You are given a non-negative integer n, its decimal representation consists of at most 100 digits and doesn't contain leading zeroes.
Your task is to determine if it is possible in this case to remove some of the digits (possibly not remove any digit at all) so that the result contains at least one digit, forms a non-... | def solve():
s = input()
n = len(s)
for i in range(n):
if int(s[i]) % 8 == 0:
print("YES")
print(s[i])
return 0
for j in range(i + 1, n):
if int(s[j]) % 8 == 0:
print("YES")
print(s[j])
return 0
... | FUNC_DEF ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR VAR IF BIN_OP FUNC_CALL VAR VAR VAR NUMBER NUMBER EXPR FUNC_CALL VAR STRING EXPR FUNC_CALL VAR VAR VAR RETURN NUMBER FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER VAR IF BIN_OP FUNC_CALL VAR VAR VAR NUMBER NUMBER EXPR FUNC_CALL VAR STRING EX... |
You are given a non-negative integer n, its decimal representation consists of at most 100 digits and doesn't contain leading zeroes.
Your task is to determine if it is possible in this case to remove some of the digits (possibly not remove any digit at all) so that the result contains at least one digit, forms a non-... | n = input()
if n.find("8") >= 0:
print("YES")
print(8)
elif n.find("0") >= 0:
print("YES")
print(0)
else:
found = False
for i in range(16, 97, 8):
first = str(i % 10)
second = str(i // 10)
fcheck = n.rfind(first)
if fcheck >= 1:
if n.rfind(second, 0, f... | ASSIGN VAR FUNC_CALL VAR IF FUNC_CALL VAR STRING NUMBER EXPR FUNC_CALL VAR STRING EXPR FUNC_CALL VAR NUMBER IF FUNC_CALL VAR STRING NUMBER EXPR FUNC_CALL VAR STRING EXPR FUNC_CALL VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER NUMBER NUMBER ASSIGN VAR FUNC_CALL VAR BIN_OP VAR NUMBER ASSIGN VAR FUNC_CALL VAR ... |
You are given a non-negative integer n, its decimal representation consists of at most 100 digits and doesn't contain leading zeroes.
Your task is to determine if it is possible in this case to remove some of the digits (possibly not remove any digit at all) so that the result contains at least one digit, forms a non-... | def f(s):
before = [None] * 10
digits = [False] * 10
until = [None] * 10
before[0] = [True, False, False, False, False, False, False, False, False, False]
until[0] = True
digits[0] = True
for c in s:
c = ord(c) - ord("0")
for b, bval in enumerate(digits):
if bval ... | FUNC_DEF ASSIGN VAR BIN_OP LIST NONE NUMBER ASSIGN VAR BIN_OP LIST NUMBER NUMBER ASSIGN VAR BIN_OP LIST NONE NUMBER ASSIGN VAR NUMBER LIST NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER ASSIGN VAR NUMBER NUMBER ASSIGN VAR NUMBER NUMBER FOR VAR VAR ASSIGN VAR BIN_OP FUNC_CALL VAR VAR FUNC_CALL VAR... |
You are given a non-negative integer n, its decimal representation consists of at most 100 digits and doesn't contain leading zeroes.
Your task is to determine if it is possible in this case to remove some of the digits (possibly not remove any digit at all) so that the result contains at least one digit, forms a non-... | a = input()
if len(a) <= 3:
t = 0
if len(a) == 3:
k = [a[0], a[1], a[2], a[:2], a[1:], a[0] + a[2], a]
k = list(map(int, k))
for i in k:
if i % 8 == 0:
t = t + 1
print("YES")
print(i)
break
if t == 0:
... | ASSIGN VAR FUNC_CALL VAR IF FUNC_CALL VAR VAR NUMBER ASSIGN VAR NUMBER IF FUNC_CALL VAR VAR NUMBER ASSIGN VAR LIST VAR NUMBER VAR NUMBER VAR NUMBER VAR NUMBER VAR NUMBER BIN_OP VAR NUMBER VAR NUMBER VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR VAR FOR VAR VAR IF BIN_OP VAR NUMBER NUMBER ASSIGN VAR BIN_OP VAR NUMBER E... |
You are given a non-negative integer n, its decimal representation consists of at most 100 digits and doesn't contain leading zeroes.
Your task is to determine if it is possible in this case to remove some of the digits (possibly not remove any digit at all) so that the result contains at least one digit, forms a non-... | def main():
s = input()
if "0" in s or "8" in s:
print("YES")
print("0" if "0" in s else "8")
else:
for i in range(len(s) - 2):
x = (ord(s[i]) - 48) * 100
for j in range(i + 1, len(s) - 1):
y = (ord(s[j]) - 48) * 10
for k in ran... | FUNC_DEF ASSIGN VAR FUNC_CALL VAR IF STRING VAR STRING VAR EXPR FUNC_CALL VAR STRING EXPR FUNC_CALL VAR STRING VAR STRING STRING FOR VAR FUNC_CALL VAR BIN_OP FUNC_CALL VAR VAR NUMBER ASSIGN VAR BIN_OP BIN_OP FUNC_CALL VAR VAR VAR NUMBER NUMBER FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER BIN_OP FUNC_CALL VAR VAR NUMBER ASSI... |
You are given a non-negative integer n, its decimal representation consists of at most 100 digits and doesn't contain leading zeroes.
Your task is to determine if it is possible in this case to remove some of the digits (possibly not remove any digit at all) so that the result contains at least one digit, forms a non-... | from itertools import combinations as cmb
a = input()
b = a
c = 0
N = 0
for p in cmb(a, 1):
s = ""
for o in p:
s += o
if int(s) % 8 == 0:
c += 1
N = s
break
for j in cmb(a, 2):
s = ""
for n in j:
s += n
if int(s) % 8 == 0:
c += 1
N = s
... | ASSIGN VAR FUNC_CALL VAR ASSIGN VAR VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR NUMBER ASSIGN VAR STRING FOR VAR VAR VAR VAR IF BIN_OP FUNC_CALL VAR VAR NUMBER NUMBER VAR NUMBER ASSIGN VAR VAR FOR VAR FUNC_CALL VAR VAR NUMBER ASSIGN VAR STRING FOR VAR VAR VAR VAR IF BIN_OP FUNC_CALL VAR VAR NUMBER... |
You are given a non-negative integer n, its decimal representation consists of at most 100 digits and doesn't contain leading zeroes.
Your task is to determine if it is possible in this case to remove some of the digits (possibly not remove any digit at all) so that the result contains at least one digit, forms a non-... | def main():
n = str(input())
for i in range(len(n)):
curr = n[i]
if int(curr) % 8 == 0:
print("YES")
print(curr)
return
for j in range(i + 1, len(n)):
curr += n[j]
if int(curr) % 8 == 0:
print("YES")
... | FUNC_DEF ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR ASSIGN VAR VAR VAR IF BIN_OP FUNC_CALL VAR VAR NUMBER NUMBER EXPR FUNC_CALL VAR STRING EXPR FUNC_CALL VAR VAR RETURN FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER FUNC_CALL VAR VAR VAR VAR VAR IF BIN_OP FUNC_CALL VAR VAR NUMBER NUMBER EXP... |
You are given a non-negative integer n, its decimal representation consists of at most 100 digits and doesn't contain leading zeroes.
Your task is to determine if it is possible in this case to remove some of the digits (possibly not remove any digit at all) so that the result contains at least one digit, forms a non-... | given = "00" + input()
l = len(given)
ans = "NO"
for i in range(l):
for j in range(i + 1, l):
for k in range(j + 1, l):
curr = given[i] + given[j] + given[k]
curr = int(curr)
if curr % 8 == 0:
ans = "YES"
print(ans)
print(cu... | ASSIGN VAR BIN_OP STRING FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR STRING FOR VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER VAR FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER VAR ASSIGN VAR BIN_OP BIN_OP VAR VAR VAR VAR VAR VAR ASSIGN VAR FUNC_CALL VAR VAR IF BIN_OP VAR NUMBER NUMBER ASSIGN VAR STR... |
You are given a non-negative integer n, its decimal representation consists of at most 100 digits and doesn't contain leading zeroes.
Your task is to determine if it is possible in this case to remove some of the digits (possibly not remove any digit at all) so that the result contains at least one digit, forms a non-... | s = input()
a = 0
if int(s) % 8 == 0:
print("YES")
print(s)
exit()
if "0" in s:
print("YES")
print(0)
exit()
if "8" in s:
print("YES")
print(8)
exit()
for i in range(len(s)):
flag1 = n = 0
for j in range(i + 1, len(s)):
flag2 = 0
for k in range(j + 1, len(s)):... | ASSIGN VAR FUNC_CALL VAR ASSIGN VAR NUMBER IF BIN_OP FUNC_CALL VAR VAR NUMBER NUMBER EXPR FUNC_CALL VAR STRING EXPR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR IF STRING VAR EXPR FUNC_CALL VAR STRING EXPR FUNC_CALL VAR NUMBER EXPR FUNC_CALL VAR IF STRING VAR EXPR FUNC_CALL VAR STRING EXPR FUNC_CALL VAR NUMBER EXPR FUNC_CALL V... |
You are given a non-negative integer n, its decimal representation consists of at most 100 digits and doesn't contain leading zeroes.
Your task is to determine if it is possible in this case to remove some of the digits (possibly not remove any digit at all) so that the result contains at least one digit, forms a non-... | import sys
n = input()
if n.find("0") != -1:
print("YES\n0")
sys.exit()
if n.find("8") != -1:
print("YES\n8")
sys.exit()
if len(n) < 3:
if int(n) % 8 == 0:
print("YES", n, sep="\n")
else:
print("NO")
else:
for i in range(10, 1000):
if i % 8 == 0:
x = str(... | IMPORT ASSIGN VAR FUNC_CALL VAR IF FUNC_CALL VAR STRING NUMBER EXPR FUNC_CALL VAR STRING EXPR FUNC_CALL VAR IF FUNC_CALL VAR STRING NUMBER EXPR FUNC_CALL VAR STRING EXPR FUNC_CALL VAR IF FUNC_CALL VAR VAR NUMBER IF BIN_OP FUNC_CALL VAR VAR NUMBER NUMBER EXPR FUNC_CALL VAR STRING VAR STRING EXPR FUNC_CALL VAR STRING FOR... |
You are given a non-negative integer n, its decimal representation consists of at most 100 digits and doesn't contain leading zeroes.
Your task is to determine if it is possible in this case to remove some of the digits (possibly not remove any digit at all) so that the result contains at least one digit, forms a non-... | num = input()
num = "00" + num
for i in range(len(num) - 2):
for j in range(i + 1, len(num) - 1):
for k in range(j + 1, len(num)):
val = int(num[i] + num[j] + num[k])
if val % 8 == 0:
print("YES")
print(val)
exit()
print("NO") | ASSIGN VAR FUNC_CALL VAR ASSIGN VAR BIN_OP STRING VAR FOR VAR FUNC_CALL VAR BIN_OP FUNC_CALL VAR VAR NUMBER FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER BIN_OP FUNC_CALL VAR VAR NUMBER FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR BIN_OP BIN_OP VAR VAR VAR VAR VAR VAR IF BIN_OP VAR NUMBE... |
You are given a non-negative integer n, its decimal representation consists of at most 100 digits and doesn't contain leading zeroes.
Your task is to determine if it is possible in this case to remove some of the digits (possibly not remove any digit at all) so that the result contains at least one digit, forms a non-... | s = input()
n = len(s)
for i in range(n):
if int(s[i]) % 8 == 0:
print("YES", s[i], sep="\n")
exit(0)
for j in range(i + 1, n):
son = int(s[i] + s[j])
if son % 8 == 0:
print("YES", son, sep="\n")
exit(0)
for k in range(j + 1, n):
hozi =... | ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR VAR IF BIN_OP FUNC_CALL VAR VAR VAR NUMBER NUMBER EXPR FUNC_CALL VAR STRING VAR VAR STRING EXPR FUNC_CALL VAR NUMBER FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER VAR ASSIGN VAR FUNC_CALL VAR BIN_OP VAR VAR VAR VAR IF BIN_OP VAR NUMBER NUMBER EXPR FU... |
You are given a non-negative integer n, its decimal representation consists of at most 100 digits and doesn't contain leading zeroes.
Your task is to determine if it is possible in this case to remove some of the digits (possibly not remove any digit at all) so that the result contains at least one digit, forms a non-... | n = input()
a = [str(i) for i in range(0, 1000, 8)]
for s in a:
i = 0
for c in n:
if i == len(s):
break
if c == s[i]:
i += 1
if i == len(s):
print("YES")
print(s)
exit()
print("NO") | ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL VAR NUMBER NUMBER NUMBER FOR VAR VAR ASSIGN VAR NUMBER FOR VAR VAR IF VAR FUNC_CALL VAR VAR IF VAR VAR VAR VAR NUMBER IF VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR STRING EXPR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR EXPR FUNC_CALL VAR STRING |
You are given a non-negative integer n, its decimal representation consists of at most 100 digits and doesn't contain leading zeroes.
Your task is to determine if it is possible in this case to remove some of the digits (possibly not remove any digit at all) so that the result contains at least one digit, forms a non-... | def good_endings():
return [str(i) for i in range(1000) if i % 8 == 0]
n = input()
for ending in good_endings():
a = n.find(ending[0])
if a == -1:
continue
if len(ending) > 1:
b = n.find(ending[1], a + 1)
if b == -1:
continue
if len(ending) > 2:
c = n.fi... | FUNC_DEF RETURN FUNC_CALL VAR VAR VAR FUNC_CALL VAR NUMBER BIN_OP VAR NUMBER NUMBER ASSIGN VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR NUMBER IF VAR NUMBER IF FUNC_CALL VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR NUMBER BIN_OP VAR NUMBER IF VAR NUMBER IF FUNC_CALL VAR VAR NUMBER ASSIGN VAR FUNC... |
You are given a non-negative integer n, its decimal representation consists of at most 100 digits and doesn't contain leading zeroes.
Your task is to determine if it is possible in this case to remove some of the digits (possibly not remove any digit at all) so that the result contains at least one digit, forms a non-... | s = input()
a = []
d = []
for i in range(2, 13):
a.append(str(8 * i))
for i in range(13, 125):
d.append(str(8 * i))
if "8" in s:
print("YES")
print("8")
exit(0)
if "0" in s:
print("YES")
print(0)
exit(0)
for i in a:
if i[0] in s:
k = s.index(i[0])
if i[1] in s[k + 1 :... | ASSIGN VAR FUNC_CALL VAR ASSIGN VAR LIST ASSIGN VAR LIST FOR VAR FUNC_CALL VAR NUMBER NUMBER EXPR FUNC_CALL VAR FUNC_CALL VAR BIN_OP NUMBER VAR FOR VAR FUNC_CALL VAR NUMBER NUMBER EXPR FUNC_CALL VAR FUNC_CALL VAR BIN_OP NUMBER VAR IF STRING VAR EXPR FUNC_CALL VAR STRING EXPR FUNC_CALL VAR STRING EXPR FUNC_CALL VAR NUMB... |
You are given a non-negative integer n, its decimal representation consists of at most 100 digits and doesn't contain leading zeroes.
Your task is to determine if it is possible in this case to remove some of the digits (possibly not remove any digit at all) so that the result contains at least one digit, forms a non-... | a = input()
f = 0
for i in range(len(a)):
for j in range(i + 1, len(a)):
for k in range(j + 1, len(a)):
if a[i] != "0" and int(a[i] + a[j] + a[k]) % 8 == 0:
print("YES")
print(a[i] + a[j] + a[k])
f = 1
break
if f:
... | ASSIGN VAR FUNC_CALL 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 FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER FUNC_CALL VAR VAR IF VAR VAR STRING BIN_OP FUNC_CALL VAR BIN_OP BIN_OP VAR VAR VAR VAR VAR VAR NUMBER NUMBER EXPR FUNC_CALL VAR STRING EXPR... |
You are given a non-negative integer n, its decimal representation consists of at most 100 digits and doesn't contain leading zeroes.
Your task is to determine if it is possible in this case to remove some of the digits (possibly not remove any digit at all) so that the result contains at least one digit, forms a non-... | def sub_3(num_list, n):
for i in range(n):
sub_num = num_list[i]
if sub_num % 8 == 0:
return sub_num
for j in range(i + 1, n):
sub_num2 = sub_num * 10 + num_list[j]
if sub_num2 % 8 == 0:
return sub_num2
for k in range(j + 1, n):... | FUNC_DEF FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR VAR IF BIN_OP VAR NUMBER NUMBER RETURN VAR FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER VAR ASSIGN VAR BIN_OP BIN_OP VAR NUMBER VAR VAR IF BIN_OP VAR NUMBER NUMBER RETURN VAR FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER VAR ASSIGN VAR BIN_OP BIN_OP VAR NUMBER VAR VAR IF BIN_OP VA... |
You are given a non-negative integer n, its decimal representation consists of at most 100 digits and doesn't contain leading zeroes.
Your task is to determine if it is possible in this case to remove some of the digits (possibly not remove any digit at all) so that the result contains at least one digit, forms a non-... | import itertools
def solve(a):
for i in range(len(a)):
if int(a[i]) % 8 == 0:
print("YES")
print(int(a[i]))
return 0
for j in range(len(a)):
if j == i or j < i:
continue
if int(a[i] + a[j]) % 8 == 0:
print(... | IMPORT FUNC_DEF FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR IF BIN_OP FUNC_CALL VAR VAR VAR NUMBER NUMBER EXPR FUNC_CALL VAR STRING EXPR FUNC_CALL VAR FUNC_CALL VAR VAR VAR RETURN NUMBER FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR IF VAR VAR VAR VAR IF BIN_OP FUNC_CALL VAR BIN_OP VAR VAR VAR VAR NUMBER NUMBER EXPR FUNC_CALL VA... |
You are given a non-negative integer n, its decimal representation consists of at most 100 digits and doesn't contain leading zeroes.
Your task is to determine if it is possible in this case to remove some of the digits (possibly not remove any digit at all) so that the result contains at least one digit, forms a non-... | from itertools import combinations
s = input()
for x in s:
if int(x) % 8 == 0:
exit(print("YES\n" + x))
for i, j in combinations(range(len(s)), 2):
if int(s[i] + s[j]) % 8 == 0:
exit(print("YES\n" + s[i] + s[j]))
for i, j, k in combinations(range(len(s)), 3):
if int(s[i] + s[j] + s[k]) % 8 ... | ASSIGN VAR FUNC_CALL VAR FOR VAR VAR IF BIN_OP FUNC_CALL VAR VAR NUMBER NUMBER EXPR FUNC_CALL VAR FUNC_CALL VAR BIN_OP STRING VAR FOR VAR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR VAR NUMBER IF BIN_OP FUNC_CALL VAR BIN_OP VAR VAR VAR VAR NUMBER NUMBER EXPR FUNC_CALL VAR FUNC_CALL VAR BIN_OP BIN_OP STRING VAR VAR VA... |
You are given a non-negative integer n, its decimal representation consists of at most 100 digits and doesn't contain leading zeroes.
Your task is to determine if it is possible in this case to remove some of the digits (possibly not remove any digit at all) so that the result contains at least one digit, forms a non-... | def ans(s):
if "8" in s:
print("YES")
print("8")
return None
elif "0" in s:
print("YES")
print("0")
return None
else:
for i in range(len(s)):
for j in range(i + 1, len(s)):
num = int(s[i] + s[j])
if num % 8 =... | FUNC_DEF IF STRING VAR EXPR FUNC_CALL VAR STRING EXPR FUNC_CALL VAR STRING RETURN NONE IF STRING VAR EXPR FUNC_CALL VAR STRING EXPR FUNC_CALL VAR STRING RETURN NONE FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR BIN_OP VAR VAR VAR VAR IF BIN_OP... |
You are given a non-negative integer n, its decimal representation consists of at most 100 digits and doesn't contain leading zeroes.
Your task is to determine if it is possible in this case to remove some of the digits (possibly not remove any digit at all) so that the result contains at least one digit, forms a non-... | a = list(map(int, "00" + input()))
n = len(a)
for i in range(n - 1):
for j in range(i + 1, n - 1):
for k in range(j + 1, n):
if (a[i] * 100 + a[j] * 10 + a[k]) % 8 == 0:
print("YES")
print(a[i] * 100 + a[j] * 10 + a[k])
exit()
print("NO") | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR BIN_OP STRING FUNC_CALL 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 BIN_OP VAR NUMBER FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER VAR IF BIN_OP BIN_OP BIN_OP BIN_OP VAR VAR NUMBER BIN_OP VAR VAR NUMBER VAR VAR NU... |
You are given a non-negative integer n, its decimal representation consists of at most 100 digits and doesn't contain leading zeroes.
Your task is to determine if it is possible in this case to remove some of the digits (possibly not remove any digit at all) so that the result contains at least one digit, forms a non-... | n = input()
for x in n:
if int(x) % 8 == 0:
print("YES")
print(x)
exit()
for i in range(len(n) - 1):
for j in range(i + 1, len(n)):
val = int(n[i]) * 10 + int(n[j])
if val % 8 == 0:
print("YES")
print(val)
exit()
for i in range(len(n) -... | ASSIGN VAR FUNC_CALL VAR FOR VAR VAR IF BIN_OP FUNC_CALL VAR VAR NUMBER NUMBER EXPR FUNC_CALL VAR STRING EXPR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR FOR VAR FUNC_CALL VAR BIN_OP FUNC_CALL VAR VAR NUMBER FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER FUNC_CALL VAR VAR ASSIGN VAR BIN_OP BIN_OP FUNC_CALL VAR VAR VAR NUMBER FUNC_CA... |
You are given a non-negative integer n, its decimal representation consists of at most 100 digits and doesn't contain leading zeroes.
Your task is to determine if it is possible in this case to remove some of the digits (possibly not remove any digit at all) so that the result contains at least one digit, forms a non-... | x = input()
if int(x) % 8 == 0:
print("YES")
print(x)
else:
x = x[::-1]
y = len(x)
f = 0
for i in range(y):
w = x[i]
if int(w) % 8 == 0:
f = 1
z = w
break
for j in range(i + 1, y):
w = x[i] + x[j]
w = w[::-1]
... | ASSIGN VAR FUNC_CALL VAR IF BIN_OP FUNC_CALL VAR VAR NUMBER NUMBER EXPR FUNC_CALL VAR STRING EXPR FUNC_CALL VAR VAR ASSIGN VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR VAR IF BIN_OP FUNC_CALL VAR VAR NUMBER NUMBER ASSIGN VAR NUMBER ASSIGN VAR VAR FOR VAR FUNC_CA... |
You are given a non-negative integer n, its decimal representation consists of at most 100 digits and doesn't contain leading zeroes.
Your task is to determine if it is possible in this case to remove some of the digits (possibly not remove any digit at all) so that the result contains at least one digit, forms a non-... | from itertools import combinations
s = input()
l = list(combinations(s, 3)) + list(combinations(s, 2)) + list(combinations(s, 1))
f = True
for i in range(len(l)):
n = int("".join(l[i]))
if n % 8 == 0:
print("YES")
print(n)
f = False
break
if f:
print("NO") | ASSIGN VAR FUNC_CALL VAR ASSIGN VAR BIN_OP BIN_OP FUNC_CALL VAR FUNC_CALL VAR VAR NUMBER FUNC_CALL VAR FUNC_CALL VAR VAR NUMBER FUNC_CALL VAR FUNC_CALL VAR VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL STRING VAR VAR IF BIN_OP VAR NUMBER NUMBER EXPR FUNC_CALL VA... |
You are given a non-negative integer n, its decimal representation consists of at most 100 digits and doesn't contain leading zeroes.
Your task is to determine if it is possible in this case to remove some of the digits (possibly not remove any digit at all) so that the result contains at least one digit, forms a non-... | n = input()
def pan(n):
for i in n:
if i == "0":
print("YES")
print("0")
return
elif i == "8":
print("YES")
print("8")
return
for i in range(len(n) - 1, -1, -1):
if int(n[i]) % 2 == 0:
for j in range(i ... | ASSIGN VAR FUNC_CALL VAR FUNC_DEF FOR VAR VAR IF VAR STRING EXPR FUNC_CALL VAR STRING EXPR FUNC_CALL VAR STRING RETURN IF VAR STRING EXPR FUNC_CALL VAR STRING EXPR FUNC_CALL VAR STRING RETURN FOR VAR FUNC_CALL VAR BIN_OP FUNC_CALL VAR VAR NUMBER NUMBER NUMBER IF BIN_OP FUNC_CALL VAR VAR VAR NUMBER NUMBER FOR VAR FUNC_C... |
You are given a non-negative integer n, its decimal representation consists of at most 100 digits and doesn't contain leading zeroes.
Your task is to determine if it is possible in this case to remove some of the digits (possibly not remove any digit at all) so that the result contains at least one digit, forms a non-... | def lcs(X, Y):
m = len(X)
n = len(Y)
L = [([None] * (n + 1)) for i in range(m + 1)]
for i in range(m + 1):
for j in range(n + 1):
if i == 0 or j == 0:
L[i][j] = 0
elif X[i - 1] == Y[j - 1]:
L[i][j] = L[i - 1][j - 1] + 1
else:
... | FUNC_DEF ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP LIST NONE BIN_OP VAR NUMBER VAR FUNC_CALL VAR BIN_OP VAR NUMBER FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER IF VAR NUMBER VAR NUMBER ASSIGN VAR VAR VAR NUMBER IF VAR BIN_OP VAR NUMBER VAR BIN_OP VAR ... |
You are given a non-negative integer n, its decimal representation consists of at most 100 digits and doesn't contain leading zeroes.
Your task is to determine if it is possible in this case to remove some of the digits (possibly not remove any digit at all) so that the result contains at least one digit, forms a non-... | s = input()
x = list(map(int, [y for y in s]))
n = len(x)
dp = [""] * 8
dp[x[0] % 8] = str(x[0])
for i in range(1, n):
nex = dp[:]
for j in range(8):
if j != 0 and dp[j] == "":
continue
tmp = j * 10 + x[i]
nex[tmp % 8] = dp[j] + str(x[i])
dp = nex
if dp[0] == "":
prin... | ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR VAR VAR VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP LIST STRING NUMBER ASSIGN VAR BIN_OP VAR NUMBER NUMBER FUNC_CALL VAR VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER VAR ASSIGN VAR VAR FOR VAR FUNC_CALL VAR NUMBER IF VAR NUMBER VAR VAR STRING ASSIGN ... |
You are given a non-negative integer n, its decimal representation consists of at most 100 digits and doesn't contain leading zeroes.
Your task is to determine if it is possible in this case to remove some of the digits (possibly not remove any digit at all) so that the result contains at least one digit, forms a non-... | n = input()
l = len(n)
flag = False
if not flag:
if "0" in n:
print("YES")
print("0")
flag = True
if not flag:
if "8" in n:
print("YES")
print("8")
flag = True
if not flag:
for i in range(l - 2):
for j in range(i + 1, l):
for k in range(j +... | ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER IF VAR IF STRING VAR EXPR FUNC_CALL VAR STRING EXPR FUNC_CALL VAR STRING ASSIGN VAR NUMBER IF VAR IF STRING VAR EXPR FUNC_CALL VAR STRING EXPR FUNC_CALL VAR STRING ASSIGN VAR NUMBER IF VAR FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER FOR VAR FUNC_CALL V... |
You are given a non-negative integer n, its decimal representation consists of at most 100 digits and doesn't contain leading zeroes.
Your task is to determine if it is possible in this case to remove some of the digits (possibly not remove any digit at all) so that the result contains at least one digit, forms a non-... | s = list(input())
n = len(s)
flag = False
for i in range(n):
a1 = int(s[i])
if a1 % 8 == 0:
ans = a1
flag = True
break
for j in range(i + 1, n):
a2 = int(s[j])
if a2 % 8 == 0:
ans = a2
flag = True
break
a4 = int(s[i] + s[j])... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR VAR IF BIN_OP VAR NUMBER NUMBER ASSIGN VAR VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER VAR ASSIGN VAR FUNC_CALL VAR VAR VAR IF BIN_OP VAR NUMBER NUMBER ASSIGN VA... |
You are given a non-negative integer n, its decimal representation consists of at most 100 digits and doesn't contain leading zeroes.
Your task is to determine if it is possible in this case to remove some of the digits (possibly not remove any digit at all) so that the result contains at least one digit, forms a non-... | n = input()
if "0" in n:
print("YES")
print(0)
exit()
elif "8" in n:
print("YES")
print(8)
exit()
for i in range(16, 104, 8):
if n.find(str(i)[0]) >= 0 and n[n.find(str(i)[0]) + 1 :].find(str(i)[1]) >= 0:
print("YES")
print(i)
exit()
for i in range(104, 1000, 8):
... | ASSIGN VAR FUNC_CALL VAR IF STRING VAR EXPR FUNC_CALL VAR STRING EXPR FUNC_CALL VAR NUMBER EXPR FUNC_CALL VAR IF STRING VAR EXPR FUNC_CALL VAR STRING EXPR FUNC_CALL VAR NUMBER EXPR FUNC_CALL VAR FOR VAR FUNC_CALL VAR NUMBER NUMBER NUMBER IF FUNC_CALL VAR FUNC_CALL VAR VAR NUMBER NUMBER FUNC_CALL VAR BIN_OP FUNC_CALL VA... |
You are given a non-negative integer n, its decimal representation consists of at most 100 digits and doesn't contain leading zeroes.
Your task is to determine if it is possible in this case to remove some of the digits (possibly not remove any digit at all) so that the result contains at least one digit, forms a non-... | a = input()
if int(a) % 8 == 0:
print("YES")
print(a)
exit()
for i in range(len(a)):
if int(a[i]) % 8 == 0:
print("YES")
print(a[i])
exit()
for i in range(len(a)):
for j in range(i, len(a)):
if int(a[i] + a[j]) % 8 == 0:
print("YES")
print(a[i]... | ASSIGN VAR FUNC_CALL VAR IF BIN_OP FUNC_CALL VAR VAR NUMBER NUMBER EXPR FUNC_CALL VAR STRING EXPR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR IF BIN_OP FUNC_CALL VAR VAR VAR NUMBER NUMBER EXPR FUNC_CALL VAR STRING EXPR FUNC_CALL VAR VAR VAR EXPR FUNC_CALL VAR FOR VAR FUNC_CALL VAR FUNC_... |
You are given a non-negative integer n, its decimal representation consists of at most 100 digits and doesn't contain leading zeroes.
Your task is to determine if it is possible in this case to remove some of the digits (possibly not remove any digit at all) so that the result contains at least one digit, forms a non-... | num = input()
has_anwser = False
anwser_list = [
"0",
"8",
"16",
"24",
"32",
"56",
"64",
"72",
"96",
"112",
"136",
"144",
"152",
"176",
"192",
"312",
"336",
"344",
"352",
"376",
"392",
"512",
"536",
"544",
"552",
"57... | ASSIGN VAR FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR LIST STRING STRING STRING STRING STRING STRING STRING STRING STRING STRING STRING STRING STRING STRING STRING STRING STRING STRING STRING STRING STRING STRING STRING STRING STRING STRING STRING STRING STRING STRING STRING STRING STRING STRING STRING STRING STRING ST... |
You are given a non-negative integer n, its decimal representation consists of at most 100 digits and doesn't contain leading zeroes.
Your task is to determine if it is possible in this case to remove some of the digits (possibly not remove any digit at all) so that the result contains at least one digit, forms a non-... | def f(n, memo, index=0, currnum=0):
key = index, currnum
if key in memo:
return memo[key]
if currnum % 8 == 0 and currnum > 0:
return True, currnum
if currnum > 999 or index >= len(n):
return False, -1
a = f(n, memo, index + 1, currnum * 10 + int(n[index]))
if a[0]:
... | FUNC_DEF NUMBER NUMBER ASSIGN VAR VAR VAR IF VAR VAR RETURN VAR VAR IF BIN_OP VAR NUMBER NUMBER VAR NUMBER RETURN NUMBER VAR IF VAR NUMBER VAR FUNC_CALL VAR VAR RETURN NUMBER NUMBER ASSIGN VAR FUNC_CALL VAR VAR VAR BIN_OP VAR NUMBER BIN_OP BIN_OP VAR NUMBER FUNC_CALL VAR VAR VAR IF VAR NUMBER ASSIGN VAR VAR ASSIGN VAR ... |
You are given a non-negative integer n, its decimal representation consists of at most 100 digits and doesn't contain leading zeroes.
Your task is to determine if it is possible in this case to remove some of the digits (possibly not remove any digit at all) so that the result contains at least one digit, forms a non-... | R = lambda: map(int, input().split())
ds = list(map(int, input()))
for i in range(len(ds)):
if ds[i] % 8 == 0:
print("YES\n" + str(ds[i]))
exit(0)
for j in range(i):
num = 10 * ds[j] + ds[i]
if num % 8 == 0:
print("YES\n" + str(num))
exit(0)
for k ... | ASSIGN VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR IF BIN_OP VAR VAR NUMBER NUMBER EXPR FUNC_CALL VAR BIN_OP STRING FUNC_CALL VAR VAR VAR EXPR FUNC_CALL VAR NUMBER FOR VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP BIN_OP NUMBER... |
You are given a non-negative integer n, its decimal representation consists of at most 100 digits and doesn't contain leading zeroes.
Your task is to determine if it is possible in this case to remove some of the digits (possibly not remove any digit at all) so that the result contains at least one digit, forms a non-... | def getno(n, i, j, k):
if i == j == k:
return int(n[i])
elif i != j and j != k:
return int(n[i] + n[j] + n[k])
return int(n[i] + n[k])
n = input()
l = len(n)
for i in range(l):
check1 = False
for j in range(i, l):
check2 = False
for k in range(j, l):
val... | FUNC_DEF IF VAR VAR VAR RETURN FUNC_CALL VAR VAR VAR IF VAR VAR VAR VAR RETURN FUNC_CALL VAR BIN_OP BIN_OP VAR VAR VAR VAR VAR VAR RETURN FUNC_CALL VAR BIN_OP VAR VAR VAR VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR VAR ASSIGN VAR NUMBER... |
You are given a non-negative integer n, its decimal representation consists of at most 100 digits and doesn't contain leading zeroes.
Your task is to determine if it is possible in this case to remove some of the digits (possibly not remove any digit at all) so that the result contains at least one digit, forms a non-... | n = int(input())
l = list(str(n))
for i in range(len(l)):
l[i] = int(l[i])
cs = 0
ax = 0
for i in range(len(l)):
zs = ""
zs += str(l[i])
if int(zs) % 8 == 0:
cs = 1
ax = int(zs)
break
for j in range(i + 1, len(l)):
bs = ""
bs += str(l[i])
bs += str(l[j... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR ASSIGN VAR VAR FUNC_CALL VAR VAR VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR ASSIGN VAR STRING VAR FUNC_CALL VAR VAR VAR IF BIN_OP FUNC_CALL VAR VAR NUMBER NUMBER... |
You are given a non-negative integer n, its decimal representation consists of at most 100 digits and doesn't contain leading zeroes.
Your task is to determine if it is possible in this case to remove some of the digits (possibly not remove any digit at all) so that the result contains at least one digit, forms a non-... | x = input()
for i in range(125):
g = list(str(8 * i))
for d in x:
if d == g[0]:
del g[0]
if not g:
print("YES")
print(8 * i)
break
else:
continue
break
else:
print("NO") | ASSIGN VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR BIN_OP NUMBER VAR FOR VAR VAR IF VAR VAR NUMBER VAR NUMBER IF VAR EXPR FUNC_CALL VAR STRING EXPR FUNC_CALL VAR BIN_OP NUMBER VAR EXPR FUNC_CALL VAR STRING |
You are given a non-negative integer n, its decimal representation consists of at most 100 digits and doesn't contain leading zeroes.
Your task is to determine if it is possible in this case to remove some of the digits (possibly not remove any digit at all) so that the result contains at least one digit, forms a non-... | s = input()
n = len(s)
ans = -1
if n >= 3:
for i in range(n):
c = int(s[i])
if c % 8 == 0:
ans = c
for j in range(i + 1, n):
c = int(s[i] + s[j])
if c % 8 == 0:
ans = c
for k in range(j + 1, n):
c = int(s[i] + s[... | ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER IF VAR NUMBER FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR VAR IF BIN_OP VAR NUMBER NUMBER ASSIGN VAR VAR FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER VAR ASSIGN VAR FUNC_CALL VAR BIN_OP VAR VAR VAR VAR IF BIN_OP VAR NUMBER NUMBER ASSIGN VAR V... |
You are given a non-negative integer n, its decimal representation consists of at most 100 digits and doesn't contain leading zeroes.
Your task is to determine if it is possible in this case to remove some of the digits (possibly not remove any digit at all) so that the result contains at least one digit, forms a non-... | x = int(input())
s = str(x)
n = len(s)
ans = ""
final = 0
flag = 0
for i in range(n):
ans = ""
ans += s[i]
if int(ans) % 8 == 0:
flag = 1
final = int(ans)
break
for j in range(i + 1, n):
ans = s[i]
if i != j:
temp = ans + s[j]
if int(temp) ... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR STRING ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR ASSIGN VAR STRING VAR VAR VAR IF BIN_OP FUNC_CALL VAR VAR NUMBER NUMBER ASSIGN VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR BI... |
You are given a non-negative integer n, its decimal representation consists of at most 100 digits and doesn't contain leading zeroes.
Your task is to determine if it is possible in this case to remove some of the digits (possibly not remove any digit at all) so that the result contains at least one digit, forms a non-... | n = input()
a = 0
if "8" in n:
print("YES")
print(8)
a = 1
elif "0" in n:
print("YES")
print(0)
a = 1
else:
i = "16"
while int(i) < 1000:
if len(i) == 2:
for j in range(len(n)):
if n[j] == i[0]:
for k in range(j + 1, len(n)):
... | ASSIGN VAR FUNC_CALL VAR ASSIGN VAR NUMBER IF STRING VAR EXPR FUNC_CALL VAR STRING EXPR FUNC_CALL VAR NUMBER ASSIGN VAR NUMBER IF STRING VAR EXPR FUNC_CALL VAR STRING EXPR FUNC_CALL VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR STRING WHILE FUNC_CALL VAR VAR NUMBER IF FUNC_CALL VAR VAR NUMBER FOR VAR FUNC_CALL VAR FUNC_CALL ... |
You are given a non-negative integer n, its decimal representation consists of at most 100 digits and doesn't contain leading zeroes.
Your task is to determine if it is possible in this case to remove some of the digits (possibly not remove any digit at all) so that the result contains at least one digit, forms a non-... | t = input()
n = "00" + t
flag = False
for i in range(len(n)):
for j in range(i + 1, len(n)):
for k in range(j + 1, len(n)):
num = n[i] + n[j] + n[k]
if int(num) % 8 == 0:
print("YES")
print(int(num))
flag = True
if flag == T... | ASSIGN VAR FUNC_CALL VAR ASSIGN VAR BIN_OP STRING 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 FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER FUNC_CALL VAR VAR ASSIGN VAR BIN_OP BIN_OP VAR VAR VAR VAR VAR VAR IF BIN_OP FUNC_CALL VAR VAR NUMBER NUMBER E... |
You are given a non-negative integer n, its decimal representation consists of at most 100 digits and doesn't contain leading zeroes.
Your task is to determine if it is possible in this case to remove some of the digits (possibly not remove any digit at all) so that the result contains at least one digit, forms a non-... | def doit(n):
s = n
for i in range(len(n)):
if int(s[i]) % 8 == 0:
n = s[i]
return n
for j in range(i + 1, len(n)):
if (int(s[i]) * 10 + int(s[j])) % 8 == 0:
n = s[i] + s[j]
return n
for k in range(j + 1, len(n)):
... | FUNC_DEF ASSIGN VAR VAR FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR IF BIN_OP FUNC_CALL VAR VAR VAR NUMBER NUMBER ASSIGN VAR VAR VAR RETURN VAR FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER FUNC_CALL VAR VAR IF BIN_OP BIN_OP BIN_OP FUNC_CALL VAR VAR VAR NUMBER FUNC_CALL VAR VAR VAR NUMBER NUMBER ASSIGN VAR BIN_OP VAR VAR VAR VAR... |
Palindromic characteristics of string s with length |s| is a sequence of |s| integers, where k-th number is the total number of non-empty substrings of s which are k-palindromes.
A string is 1-palindrome if and only if it reads the same backward as forward.
A string is k-palindrome (k > 1) if and only if: Its left ... | P = 311
MOD1 = int(1000000000.0) + 7
MOD2 = int(1000000000.0) + 9
def main():
s = input()
n = len(s)
power_1 = [(0) for i in range(n + 1)]
power_2 = [(0) for i in range(n + 1)]
mod_inv_1 = [(0) for i in range(n + 1)]
mod_inv_2 = [(0) for i in range(n + 1)]
power_1[0] = 1
power_2[0] = 1... | ASSIGN VAR NUMBER ASSIGN VAR BIN_OP FUNC_CALL VAR NUMBER NUMBER ASSIGN VAR BIN_OP FUNC_CALL VAR NUMBER NUMBER FUNC_DEF ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER VAR FUNC_CALL VAR BIN_OP VAR NUMBER ASSIGN VAR NUMBER VAR FUNC_CALL VAR BIN_OP VAR NUMBER ASSIGN VAR NUMBER VAR FUNC_CALL VAR BIN... |
Palindromic characteristics of string s with length |s| is a sequence of |s| integers, where k-th number is the total number of non-empty substrings of s which are k-palindromes.
A string is 1-palindrome if and only if it reads the same backward as forward.
A string is k-palindrome (k > 1) if and only if: Its left ... | s = input()
dp = [([0] * 5005) for _ in range(5005)]
n = len(s)
ans = [(0) for _ in range(5005)]
for length in range(1, n + 1):
for l in range(n - length + 1):
r = l + length
if length == 1:
dp[l][r] = 1
continue
elif length == 2:
dp[l][r] = 2 if s[l] == s... | ASSIGN VAR FUNC_CALL VAR ASSIGN VAR BIN_OP LIST NUMBER NUMBER VAR FUNC_CALL VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER VAR FUNC_CALL VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER BIN_OP VAR NUMBER FOR VAR FUNC_CALL VAR BIN_OP BIN_OP VAR VAR NUMBER ASSIGN VAR BIN_OP VAR VAR IF VAR NUMBER ASSIGN VAR VAR VAR NUMB... |
Palindromic characteristics of string s with length |s| is a sequence of |s| integers, where k-th number is the total number of non-empty substrings of s which are k-palindromes.
A string is 1-palindrome if and only if it reads the same backward as forward.
A string is k-palindrome (k > 1) if and only if: Its left ... | class HString:
def __init__(self, string, base=257, modulo=1000000007):
self.__base, self.__modulo = base, modulo
self.__prefix_hash, self.__base_pow, self.__size = [], [1], 0
self += string
def __add__(self, string):
for ch in string:
self.__base_pow.append(self.__... | CLASS_DEF FUNC_DEF NUMBER NUMBER ASSIGN VAR VAR VAR VAR ASSIGN VAR VAR VAR LIST LIST NUMBER NUMBER VAR VAR FUNC_DEF FOR VAR VAR EXPR FUNC_CALL VAR BIN_OP BIN_OP VAR NUMBER VAR VAR IF VAR NUMBER EXPR FUNC_CALL VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR BIN_OP BIN_OP BIN_OP VAR NUMBER VAR FUNC_CALL VAR VAR VAR VAR NUMBER R... |
Palindromic characteristics of string s with length |s| is a sequence of |s| integers, where k-th number is the total number of non-empty substrings of s which are k-palindromes.
A string is 1-palindrome if and only if it reads the same backward as forward.
A string is k-palindrome (k > 1) if and only if: Its left ... | s = input().strip()
n = len(s)
pl = [0] * (n + 1)
dp = [([0] * n) for i in range(n)]
for i in range(n):
for j in range(n - i):
l = j + i
if i == 0:
dp[j][l] = 1
pl[1] += 1
elif i == 1:
if s[j] == s[l]:
dp[j][l] = 2
pl[2] += ... | ASSIGN VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP LIST NUMBER BIN_OP VAR NUMBER ASSIGN VAR BIN_OP LIST NUMBER VAR VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR BIN_OP VAR VAR ASSIGN VAR BIN_OP VAR VAR IF VAR NUMBER ASSIGN VAR VAR VAR NUMBER VAR NUMBER NUMBER IF VA... |
Palindromic characteristics of string s with length |s| is a sequence of |s| integers, where k-th number is the total number of non-empty substrings of s which are k-palindromes.
A string is 1-palindrome if and only if it reads the same backward as forward.
A string is k-palindrome (k > 1) if and only if: Its left ... | def main():
s = input()
n = len(s)
dp = [[(0) for i in range(n + 1)] for j in range(n + 1)]
count = [(0) for i in range(n + 1)]
for sub_len in range(1, n + 1):
for left in range(0, n - sub_len + 1):
right = left + sub_len - 1
if sub_len == 1:
dp[left][... | FUNC_DEF ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR 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 FOR VAR FUNC_CALL VAR NUMBER BIN_OP VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER BIN_OP BIN_OP VAR VAR NUMBER ASSIGN V... |
Palindromic characteristics of string s with length |s| is a sequence of |s| integers, where k-th number is the total number of non-empty substrings of s which are k-palindromes.
A string is 1-palindrome if and only if it reads the same backward as forward.
A string is k-palindrome (k > 1) if and only if: Its left ... | s = input()
n = len(s)
dp = [[(0) for i in range(n - le + 1)] for le in range(n + 1)]
ans = [(0) for i in range(n + 1)]
for le in range(1, n + 1):
for l in range(0, n - le + 1):
r = l + le
if s[l] != s[r - 1]:
continue
if le == 1:
dp[1][l] = 1
ans[1] += 1
... | ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER VAR FUNC_CALL VAR BIN_OP BIN_OP VAR VAR NUMBER VAR FUNC_CALL VAR BIN_OP VAR NUMBER ASSIGN 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 BIN_OP VAR VAR NUMBER ASSIGN... |
Palindromic characteristics of string s with length |s| is a sequence of |s| integers, where k-th number is the total number of non-empty substrings of s which are k-palindromes.
A string is 1-palindrome if and only if it reads the same backward as forward.
A string is k-palindrome (k > 1) if and only if: Its left ... | s = input()
size = len(s)
dp = [[(0) for l in range(size)] for li in range(size)]
ans = [0] * (size + 1)
for i in range(1, size + 1):
if i == 1:
for j in range(0, size):
dp[j][j] = 1
ans[1] += 1
elif i == 2:
for j in range(0, size - 1):
if s[j + 1] == s[j]:
... | ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER VAR FUNC_CALL VAR VAR VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP LIST NUMBER BIN_OP VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER BIN_OP VAR NUMBER IF VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER VAR ASSIGN VAR VAR VAR NUMBER VAR NUMBER NUMBER IF VAR NUMBER FOR ... |
Palindromic characteristics of string s with length |s| is a sequence of |s| integers, where k-th number is the total number of non-empty substrings of s which are k-palindromes.
A string is 1-palindrome if and only if it reads the same backward as forward.
A string is k-palindrome (k > 1) if and only if: Its left ... | def main():
s = input()
n = len(s)
isPalindrome = [[(False) for i in range(n + 1)] for i in range(n + 1)]
for i in range(n):
isPalindrome[i][i] = True
for i in range(n - 1, -1, -1):
for j in range(i + 1, n):
if s[i] == s[j] and (i + 1 == j or isPalindrome[i + 1][j - 1] ==... | FUNC_DEF ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER VAR FUNC_CALL VAR BIN_OP VAR NUMBER VAR FUNC_CALL VAR BIN_OP VAR NUMBER FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR VAR NUMBER FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER NUMBER NUMBER FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER VAR IF VAR VAR VAR VA... |
Palindromic characteristics of string s with length |s| is a sequence of |s| integers, where k-th number is the total number of non-empty substrings of s which are k-palindromes.
A string is 1-palindrome if and only if it reads the same backward as forward.
A string is k-palindrome (k > 1) if and only if: Its left ... | def palindromic_characteristics(s):
n = len(s)
palindrome_level = [[(0) for _ in range(n)] for _ in range(n)]
palindrome_level_count = [(0) for _ in range(n + 1)]
for i in range(n):
j = i
while i >= 0 and j < n and s[i] == s[j]:
palindrome_level[i][j] = 1
i, j = i... | FUNC_DEF ASSIGN 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 BIN_OP VAR NUMBER FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR WHILE VAR NUMBER VAR VAR VAR VAR VAR VAR ASSIGN VAR VAR VAR NUMBER ASSIGN VAR VAR BIN_OP VAR NUMBER BIN_OP VAR NUMBER FOR VAR... |
Given two numbers n and x, find out the total number of ways n can be expressed as the sum of the Xth power of unique natural numbers. As the total number of ways can be very large, so return the number of ways modulo 10^{9 }+ 7.
Example 1:
Input:
n = 10, x = 2
Output:
1
Explanation:
10 = 1^{2} + 3^{2}, Hence tota... | class Solution:
def numOfWays(self, n, x):
list = []
list.append(1)
for i in range(1, n + 1):
list.append(0)
for i in range(1, n + 1):
for j in range(n, i - 1, -1):
a = i**x
if j >= a:
list[j] = (list[j] + l... | CLASS_DEF FUNC_DEF ASSIGN VAR LIST EXPR FUNC_CALL VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER BIN_OP VAR NUMBER EXPR FUNC_CALL VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER BIN_OP VAR NUMBER FOR VAR FUNC_CALL VAR VAR BIN_OP VAR NUMBER NUMBER ASSIGN VAR BIN_OP VAR VAR IF VAR VAR ASSIGN VAR VAR BIN_OP BIN_OP VAR VAR VAR BIN_OP VAR... |
Given two numbers n and x, find out the total number of ways n can be expressed as the sum of the Xth power of unique natural numbers. As the total number of ways can be very large, so return the number of ways modulo 10^{9 }+ 7.
Example 1:
Input:
n = 10, x = 2
Output:
1
Explanation:
10 = 1^{2} + 3^{2}, Hence tota... | class Solution:
def express(self, x, target, i, dp):
if target == 0:
return 1
if i < 0:
return 0
if dp[target][i] != -1:
return dp[target][i]
pa = pow(i, x)
if pa <= target:
dp[target][i] = self.express(x, target - pa, i - 1, d... | CLASS_DEF FUNC_DEF IF VAR NUMBER RETURN NUMBER IF VAR NUMBER RETURN NUMBER IF VAR VAR VAR NUMBER RETURN VAR VAR VAR ASSIGN VAR FUNC_CALL VAR VAR VAR IF VAR VAR ASSIGN VAR VAR VAR BIN_OP FUNC_CALL VAR VAR BIN_OP VAR VAR BIN_OP VAR NUMBER VAR FUNC_CALL VAR VAR VAR BIN_OP VAR NUMBER VAR RETURN VAR VAR VAR ASSIGN VAR VAR V... |
Given two numbers n and x, find out the total number of ways n can be expressed as the sum of the Xth power of unique natural numbers. As the total number of ways can be very large, so return the number of ways modulo 10^{9 }+ 7.
Example 1:
Input:
n = 10, x = 2
Output:
1
Explanation:
10 = 1^{2} + 3^{2}, Hence tota... | class Solution:
def numOfWays(self, n, x):
def solve(n, x, curr_val, dp):
mod = 1000000007
if n == 0:
return 1
if n < 0 or curr_val <= 0:
return 0
if dp[n][curr_val] != -1:
return dp[n][curr_val]
dp... | CLASS_DEF FUNC_DEF FUNC_DEF ASSIGN VAR NUMBER IF VAR NUMBER RETURN NUMBER IF VAR NUMBER VAR NUMBER RETURN NUMBER IF VAR VAR VAR NUMBER RETURN VAR VAR VAR ASSIGN VAR VAR VAR BIN_OP BIN_OP FUNC_CALL VAR BIN_OP VAR BIN_OP VAR VAR VAR BIN_OP VAR NUMBER VAR FUNC_CALL VAR VAR VAR BIN_OP VAR NUMBER VAR VAR RETURN VAR VAR VAR ... |
Given two numbers n and x, find out the total number of ways n can be expressed as the sum of the Xth power of unique natural numbers. As the total number of ways can be very large, so return the number of ways modulo 10^{9 }+ 7.
Example 1:
Input:
n = 10, x = 2
Output:
1
Explanation:
10 = 1^{2} + 3^{2}, Hence tota... | class Solution:
def numOfWays(self, n, x):
dp = [(0) for _ in range(n + 1)]
dp[0] = 1
M = pow(10, 9) + 7
for i in range(1, n + 1):
for j in range(n, i - 1, -1):
y = pow(i, x)
if j >= y:
dp[j] = (dp[j] + dp[j - y]) % M
... | CLASS_DEF FUNC_DEF ASSIGN VAR NUMBER VAR FUNC_CALL VAR BIN_OP VAR NUMBER ASSIGN VAR NUMBER NUMBER ASSIGN VAR BIN_OP FUNC_CALL VAR NUMBER NUMBER NUMBER FOR VAR FUNC_CALL VAR NUMBER BIN_OP VAR NUMBER FOR VAR FUNC_CALL VAR VAR BIN_OP VAR NUMBER NUMBER ASSIGN VAR FUNC_CALL VAR VAR VAR IF VAR VAR ASSIGN VAR VAR BIN_OP BIN_O... |
Given two numbers n and x, find out the total number of ways n can be expressed as the sum of the Xth power of unique natural numbers. As the total number of ways can be very large, so return the number of ways modulo 10^{9 }+ 7.
Example 1:
Input:
n = 10, x = 2
Output:
1
Explanation:
10 = 1^{2} + 3^{2}, Hence tota... | class Solution:
def numOfWays(self, n, x):
M = int(1000000000.0) + 7
p = []
i = 1
while True:
if pow(i, x) <= n:
p.append(pow(i, x))
i += 1
else:
break
dp = [0] * (n + 1)
dp[0] = 1
for a ... | CLASS_DEF FUNC_DEF ASSIGN VAR BIN_OP FUNC_CALL VAR NUMBER NUMBER ASSIGN VAR LIST ASSIGN VAR NUMBER WHILE NUMBER IF FUNC_CALL VAR VAR VAR VAR EXPR FUNC_CALL VAR FUNC_CALL VAR VAR VAR VAR NUMBER ASSIGN VAR BIN_OP LIST NUMBER BIN_OP VAR NUMBER ASSIGN VAR NUMBER NUMBER FOR VAR VAR FOR VAR FUNC_CALL VAR VAR NUMBER NUMBER IF... |
Given two numbers n and x, find out the total number of ways n can be expressed as the sum of the Xth power of unique natural numbers. As the total number of ways can be very large, so return the number of ways modulo 10^{9 }+ 7.
Example 1:
Input:
n = 10, x = 2
Output:
1
Explanation:
10 = 1^{2} + 3^{2}, Hence tota... | class Solution:
def numOfWays(self, n, x):
d = [i for i in range(1, int(n ** (1 / x)) + 1)]
n1 = len(d)
t = [[(0) for i in range(n + 1)] for j in range(n1 + 1)]
for i in range(n1 + 1):
for j in range(n + 1):
if i == 0 or j == 0:
if i =... | CLASS_DEF FUNC_DEF ASSIGN VAR VAR VAR FUNC_CALL VAR NUMBER BIN_OP FUNC_CALL VAR BIN_OP VAR BIN_OP NUMBER VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER VAR FUNC_CALL VAR BIN_OP VAR NUMBER VAR FUNC_CALL VAR BIN_OP VAR NUMBER FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER IF VA... |
Given two numbers n and x, find out the total number of ways n can be expressed as the sum of the Xth power of unique natural numbers. As the total number of ways can be very large, so return the number of ways modulo 10^{9 }+ 7.
Example 1:
Input:
n = 10, x = 2
Output:
1
Explanation:
10 = 1^{2} + 3^{2}, Hence tota... | def numHelper(i, n, x, dp):
if i**x > n:
return 0
if i**x == n:
return 1
if dp[n - i**x][i + 1] == -1:
tempAns = numHelper(i + 1, n - i**x, x, dp)
dp[n - i**x][i + 1] = tempAns
else:
tempAns = dp[n - i**x][i + 1]
if dp[n][i + 1] == -1:
tempAns2 = numHe... | FUNC_DEF IF BIN_OP VAR VAR VAR RETURN NUMBER IF BIN_OP VAR VAR VAR RETURN NUMBER IF VAR BIN_OP VAR BIN_OP VAR VAR BIN_OP VAR NUMBER NUMBER ASSIGN VAR FUNC_CALL VAR BIN_OP VAR NUMBER BIN_OP VAR BIN_OP VAR VAR VAR VAR ASSIGN VAR BIN_OP VAR BIN_OP VAR VAR BIN_OP VAR NUMBER VAR ASSIGN VAR VAR BIN_OP VAR BIN_OP VAR VAR BIN_... |
Given two numbers n and x, find out the total number of ways n can be expressed as the sum of the Xth power of unique natural numbers. As the total number of ways can be very large, so return the number of ways modulo 10^{9 }+ 7.
Example 1:
Input:
n = 10, x = 2
Output:
1
Explanation:
10 = 1^{2} + 3^{2}, Hence tota... | class Solution:
def numOfWays(self, n, x):
l = []
i = 1
while i**x <= n:
l.append(i)
i += 1
t = n
n = len(l)
dp = [[(0) for _ in range(t + 1)] for _ in range(n + 1)]
for i in range(n + 1):
dp[i][0] = 1
for i in rang... | CLASS_DEF FUNC_DEF ASSIGN VAR LIST ASSIGN VAR NUMBER WHILE BIN_OP VAR VAR VAR EXPR FUNC_CALL VAR VAR VAR NUMBER ASSIGN VAR VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER VAR FUNC_CALL VAR BIN_OP VAR NUMBER VAR FUNC_CALL VAR BIN_OP VAR NUMBER FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER ASSIGN VAR VAR NUMBER NUMBER FOR V... |
Given two numbers n and x, find out the total number of ways n can be expressed as the sum of the Xth power of unique natural numbers. As the total number of ways can be very large, so return the number of ways modulo 10^{9 }+ 7.
Example 1:
Input:
n = 10, x = 2
Output:
1
Explanation:
10 = 1^{2} + 3^{2}, Hence tota... | class Solution:
def numOfWays(self, n, x):
dp = [0] * (n + 1)
dp[0] = 1
dp[1] = 1
maxLimit = int(n ** (1 / x))
for i in range(2, maxLimit + 1):
curr = i**x
for j in range(n, curr - 1, -1):
dp[j] += dp[j - curr]
mm = 1000000007
... | CLASS_DEF FUNC_DEF ASSIGN VAR BIN_OP LIST NUMBER BIN_OP VAR NUMBER ASSIGN VAR NUMBER NUMBER ASSIGN VAR NUMBER NUMBER ASSIGN VAR FUNC_CALL VAR BIN_OP VAR BIN_OP NUMBER VAR FOR VAR FUNC_CALL VAR NUMBER BIN_OP VAR NUMBER ASSIGN VAR BIN_OP VAR VAR FOR VAR FUNC_CALL VAR VAR BIN_OP VAR NUMBER NUMBER VAR VAR VAR BIN_OP VAR VA... |
Given two numbers n and x, find out the total number of ways n can be expressed as the sum of the Xth power of unique natural numbers. As the total number of ways can be very large, so return the number of ways modulo 10^{9 }+ 7.
Example 1:
Input:
n = 10, x = 2
Output:
1
Explanation:
10 = 1^{2} + 3^{2}, Hence tota... | class Solution:
def numOfWays(self, n, x):
def fun(n, x, s, k):
if s == n:
return 1
if s > n or k == 0:
return 0
if dp[s][k] != -1:
return dp[s][k]
ans = (fun(n, x, s, k - 1) + fun(n, x, s + k**x, k - 1)) % 100... | CLASS_DEF FUNC_DEF FUNC_DEF IF VAR VAR RETURN NUMBER IF VAR VAR VAR NUMBER RETURN NUMBER IF VAR VAR VAR NUMBER RETURN VAR VAR VAR ASSIGN VAR BIN_OP BIN_OP FUNC_CALL VAR VAR VAR VAR BIN_OP VAR NUMBER FUNC_CALL VAR VAR VAR BIN_OP VAR BIN_OP VAR VAR BIN_OP VAR NUMBER NUMBER ASSIGN VAR VAR VAR VAR RETURN VAR ASSIGN VAR FUN... |
You are given an array $a$ consisting of $n$ integers.
You can remove at most one element from this array. Thus, the final length of the array is $n-1$ or $n$.
Your task is to calculate the maximum possible length of the strictly increasing contiguous subarray of the remaining array.
Recall that the contiguous subar... | n = int(input())
A = [int(i) for i in input().split()]
if n == 1:
print(1)
elif n == 2:
if A[1] > A[0]:
print(2)
else:
print(1)
else:
left = [1] * n
right = [1] * n
for i in range(1, n):
if A[i] > A[i - 1]:
right[i] = 1 + right[i - 1]
else:
... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR IF VAR NUMBER EXPR FUNC_CALL VAR NUMBER IF VAR NUMBER IF VAR NUMBER VAR NUMBER EXPR FUNC_CALL VAR NUMBER EXPR FUNC_CALL VAR NUMBER ASSIGN VAR BIN_OP LIST NUMBER VAR ASSIGN VAR BIN_OP LIST NUMBER VAR FOR VAR FUNC_CALL VAR NUM... |
You are given an array $a$ consisting of $n$ integers.
You can remove at most one element from this array. Thus, the final length of the array is $n-1$ or $n$.
Your task is to calculate the maximum possible length of the strictly increasing contiguous subarray of the remaining array.
Recall that the contiguous subar... | n = int(input())
x = list(map(int, input().split()))
dp, dp2, num, ans = [0] * 200005, [0] * 200005, 1, 0
for i in range(n):
if i != 0:
if x[i] > x[i - 1]:
num += 1
else:
num = 1
dp[i] = num
num = 1
for i in range(n - 1, -1, -1):
if i != n - 1:
if x[i] < x[i +... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR VAR VAR BIN_OP LIST NUMBER NUMBER BIN_OP LIST NUMBER NUMBER NUMBER NUMBER FOR VAR FUNC_CALL VAR VAR IF VAR NUMBER IF VAR VAR VAR BIN_OP VAR NUMBER VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR VAR VAR ASSI... |
You are given an array $a$ consisting of $n$ integers.
You can remove at most one element from this array. Thus, the final length of the array is $n-1$ or $n$.
Your task is to calculate the maximum possible length of the strictly increasing contiguous subarray of the remaining array.
Recall that the contiguous subar... | n = int(input())
s = list(map(int, input().split()))
L = [1] * n
R = [1] * n
for i in range(n - 1):
if s[i] < s[i + 1]:
L[i + 1] += L[i]
for i in range(n - 1, 0, -1):
if s[i] > s[i - 1]:
R[i - 1] += R[i]
ans = max(L)
for i in range(n - 2):
if s[i] < s[i + 2]:
ans = max(ans, L[i] + R[... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR BIN_OP LIST NUMBER VAR ASSIGN VAR BIN_OP LIST NUMBER VAR FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER IF VAR VAR VAR BIN_OP VAR NUMBER VAR BIN_OP VAR NUMBER VAR VAR FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER NUM... |
You are given an array $a$ consisting of $n$ integers.
You can remove at most one element from this array. Thus, the final length of the array is $n-1$ or $n$.
Your task is to calculate the maximum possible length of the strictly increasing contiguous subarray of the remaining array.
Recall that the contiguous subar... | from sys import stdin, stdout
get_string = lambda: stdin.readline().strip()
get_intmap = lambda: map(int, get_string().split())
def testcase():
n = int(input())
t = tuple(get_intmap())
last_seen_val_left, curr_max_left = 0, 0
dp_left = [0] * n
for ind in range(n):
if last_seen_val_left >=... | ASSIGN VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR FUNC_DEF ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR NUMBER NUMBER ASSIGN VAR BIN_OP LIST NUMBER VAR FOR VAR FUNC_CALL VAR VAR IF VAR VAR VAR ASSIGN VAR NUMBER VAR NUMBER ASSIGN VAR V... |
You are given an array $a$ consisting of $n$ integers.
You can remove at most one element from this array. Thus, the final length of the array is $n-1$ or $n$.
Your task is to calculate the maximum possible length of the strictly increasing contiguous subarray of the remaining array.
Recall that the contiguous subar... | n = int(input())
a = list(map(int, input().split()))
d = [1] * n
d2 = [1] * n
for i in range(1, n):
if a[i] > a[i - 1]:
d[i] = d[i - 1] + 1
d2[i] = d2[i - 1] + 1
if i >= 2 and a[i] > a[i - 2]:
d2[i] = max(d2[i], d[i - 2] + 1)
print(max(d2)) | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR BIN_OP LIST NUMBER VAR ASSIGN VAR BIN_OP LIST NUMBER VAR FOR VAR FUNC_CALL VAR NUMBER VAR IF VAR VAR VAR BIN_OP VAR NUMBER ASSIGN VAR VAR BIN_OP VAR BIN_OP VAR NUMBER NUMBER ASSIGN VAR VAR BIN_OP VAR BIN... |
You are given an array $a$ consisting of $n$ integers.
You can remove at most one element from this array. Thus, the final length of the array is $n-1$ or $n$.
Your task is to calculate the maximum possible length of the strictly increasing contiguous subarray of the remaining array.
Recall that the contiguous subar... | n = int(input())
a = list(map(int, input().split())) + [0]
x, y, r = 1, 1, 1
if a[1] > a[0]:
x, y = x + 1, y + 1
for i in range(2, n):
if a[i] > a[i - 1]:
x, y = x + 1, y + 1
else:
r = max(r, x)
x = y if a[i] > a[i - 2] or a[i + 1] > a[i - 1] else 1
y = 1
print(max(r, x)) | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR BIN_OP FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR LIST NUMBER ASSIGN VAR VAR VAR NUMBER NUMBER NUMBER IF VAR NUMBER VAR NUMBER ASSIGN VAR VAR BIN_OP VAR NUMBER BIN_OP VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER VAR IF VAR VAR VAR BIN_OP VAR NUMBER ASSIGN VAR VA... |
You are given an array $a$ consisting of $n$ integers.
You can remove at most one element from this array. Thus, the final length of the array is $n-1$ or $n$.
Your task is to calculate the maximum possible length of the strictly increasing contiguous subarray of the remaining array.
Recall that the contiguous subar... | input()
n = map(int, input().split())
n = list(n)
f = 1
if n[1] > n[0]:
c = 2
d = 2
MAX = 2
else:
c = 1
d = 1
MAX = 1
for i, x in enumerate(n[2:]):
i += 2
if x > n[i - 1]:
a = c + 1
b = d + 1
if x > n[i - 2]:
b = max(b, 1 + f)
else:
a = 1
... | EXPR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER IF VAR NUMBER VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR VAR FUNC_CALL VAR VAR NUMBER VAR NUMBER IF VAR VAR BIN_OP VA... |
You are given an array $a$ consisting of $n$ integers.
You can remove at most one element from this array. Thus, the final length of the array is $n-1$ or $n$.
Your task is to calculate the maximum possible length of the strictly increasing contiguous subarray of the remaining array.
Recall that the contiguous subar... | drop = input()
elements = input().split(" ")
ri = []
li = []
for i in range(len(elements)):
ri.append(1)
li.append(1)
max1 = 1
for i in range(1, len(elements)):
if int(elements[i]) > int(elements[i - 1]):
li[i] = li[i - 1] + 1
if li[i] > max1:
max1 = li[i]
if int(elements[-i]... | ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL FUNC_CALL VAR STRING ASSIGN VAR LIST ASSIGN VAR LIST FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR NUMBER EXPR FUNC_CALL VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER FUNC_CALL VAR VAR IF FUNC_CALL VAR VAR VAR FUNC_CALL VAR VAR BIN_OP VAR NUMBER ASS... |
You are given an array $a$ consisting of $n$ integers.
You can remove at most one element from this array. Thus, the final length of the array is $n-1$ or $n$.
Your task is to calculate the maximum possible length of the strictly increasing contiguous subarray of the remaining array.
Recall that the contiguous subar... | n = int(input())
arr = list(map(int, input().split()))
l = [1] * len(arr)
r = [1] * len(arr)
length = len(arr)
for i in range(1, length):
if arr[i - 1] < arr[i]:
l[i] = l[i - 1] + 1
if arr[length - i] > arr[length - i - 1]:
r[length - i - 1] = r[length - i] + 1
max1 = max(l)
for i in range(1, le... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR BIN_OP LIST NUMBER FUNC_CALL VAR VAR ASSIGN VAR BIN_OP LIST NUMBER FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR NUMBER VAR IF VAR BIN_OP VAR NUMBER VAR VAR ASSIGN VAR VAR BIN_OP V... |
You are given an array $a$ consisting of $n$ integers.
You can remove at most one element from this array. Thus, the final length of the array is $n-1$ or $n$.
Your task is to calculate the maximum possible length of the strictly increasing contiguous subarray of the remaining array.
Recall that the contiguous subar... | n = int(input())
a = [int(i) for i in input().split()]
b = [1]
l = 1
for i in range(1, n):
if a[i] > a[i - 1]:
l += 1
b.append(l)
else:
l = 1
b.append(l)
l = b[-1]
c = [l]
for i in range(2, n + 1):
if b[n - i] < b[n - i + 1]:
c.append(l)
else:
l = b[n - i]... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER VAR IF VAR VAR VAR BIN_OP VAR NUMBER VAR NUMBER EXPR FUNC_CALL VAR VAR ASSIGN VAR NUMBER EXPR FUNC_CALL VAR VAR ASSIGN VAR VAR NUMBER ASSIGN VAR LIST VAR ... |
You are given an array $a$ consisting of $n$ integers.
You can remove at most one element from this array. Thus, the final length of the array is $n-1$ or $n$.
Your task is to calculate the maximum possible length of the strictly increasing contiguous subarray of the remaining array.
Recall that the contiguous subar... | n = int(input()) + 1
a = [10**18] + list(map(int, input().split())) + [-1, -1]
stack = []
length = 1
for i, x, y in zip(range(2, n + 1), a[1:], a[2:]):
if x >= y:
stack.append((length, i))
length = 1
else:
length += 1
stack.append((0, n))
ans = 0
for (x, i), (y, _) in zip(stack, stack[1:... | ASSIGN VAR BIN_OP FUNC_CALL VAR FUNC_CALL VAR NUMBER ASSIGN VAR BIN_OP BIN_OP LIST BIN_OP NUMBER NUMBER FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR LIST NUMBER NUMBER ASSIGN VAR LIST ASSIGN VAR NUMBER FOR VAR VAR VAR FUNC_CALL VAR FUNC_CALL VAR NUMBER BIN_OP VAR NUMBER VAR NUMBER VAR NUMBER IF VAR VAR EXPR ... |
You are given an array $a$ consisting of $n$ integers.
You can remove at most one element from this array. Thus, the final length of the array is $n-1$ or $n$.
Your task is to calculate the maximum possible length of the strictly increasing contiguous subarray of the remaining array.
Recall that the contiguous subar... | n = int(input())
a = [0] + list(map(int, input().split())) + [10**10]
f = [0] * (n + 2)
t = [0] * (n + 2)
for i in range(1, n + 1):
if a[i] > a[i - 1]:
f[i] = f[i - 1] + 1
else:
f[i] = 1
for i in range(n, 0, -1):
if a[i] < a[i + 1]:
t[i] = t[i + 1] + 1
else:
t[i] = 1
res ... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR BIN_OP BIN_OP LIST NUMBER FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR LIST BIN_OP NUMBER NUMBER ASSIGN VAR BIN_OP LIST NUMBER BIN_OP VAR NUMBER ASSIGN VAR BIN_OP LIST NUMBER BIN_OP VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER BIN_OP VAR NUMBER IF VAR VAR VAR BIN_... |
You are given an array $a$ consisting of $n$ integers.
You can remove at most one element from this array. Thus, the final length of the array is $n-1$ or $n$.
Your task is to calculate the maximum possible length of the strictly increasing contiguous subarray of the remaining array.
Recall that the contiguous subar... | n = int(input())
a = list(map(int, input().split()))
res = []
first = a[0]
temp = 1
for i in range(1, len(a)):
if first < a[i]:
temp += 1
else:
res.append((temp, i - 1))
temp = 1
first = a[i]
if temp >= 1:
res.append((temp, len(a) - 1))
final_ans = []
for i in range(len(res) - 1)... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST ASSIGN VAR VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER FUNC_CALL VAR VAR IF VAR VAR VAR VAR NUMBER EXPR FUNC_CALL VAR VAR BIN_OP VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR VAR VAR IF VAR ... |
You are given an array $a$ consisting of $n$ integers.
You can remove at most one element from this array. Thus, the final length of the array is $n-1$ or $n$.
Your task is to calculate the maximum possible length of the strictly increasing contiguous subarray of the remaining array.
Recall that the contiguous subar... | n = int(input())
maxx = 1
ch = input()
nb = 1
nb2 = 1
L = [int(i) for i in ch.split()]
L2 = []
L3 = []
test = False
for i in range(n - 2):
if L[i] < L[i + 1]:
nb += 1
else:
L2.append(nb)
nb = 1
if L[i - 1] >= L[i + 1] and L[i] >= L[i + 2]:
L3.append(False)
els... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL VAR ASSIGN VAR LIST ASSIGN VAR LIST ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER IF VAR VAR VAR BIN_OP VAR NUMBER VAR NUMBER EXPR FUNC_CALL VAR VA... |
You are given an array $a$ consisting of $n$ integers.
You can remove at most one element from this array. Thus, the final length of the array is $n-1$ or $n$.
Your task is to calculate the maximum possible length of the strictly increasing contiguous subarray of the remaining array.
Recall that the contiguous subar... | n = int(input())
aa = list(map(int, input().split()))
ll, rr = [1] * n, [1] * n
cl, cr = 1, 1
res = 0
for il, ir in [(i, n - 1 - i) for i in range(1, n)]:
cl = cl + 1 if aa[il - 1] < aa[il] else 1
cr = cr + 1 if aa[ir] < aa[ir + 1] else 1
res = max(res, cl)
res = max(res, cr)
ll[il], rr[ir] = cl, cr... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR BIN_OP LIST NUMBER VAR BIN_OP LIST NUMBER VAR ASSIGN VAR VAR NUMBER NUMBER ASSIGN VAR NUMBER FOR VAR VAR VAR BIN_OP BIN_OP VAR NUMBER VAR VAR FUNC_CALL VAR NUMBER VAR ASSIGN VAR VAR BIN_OP VAR NUMBER... |
You are given an array $a$ consisting of $n$ integers.
You can remove at most one element from this array. Thus, the final length of the array is $n-1$ or $n$.
Your task is to calculate the maximum possible length of the strictly increasing contiguous subarray of the remaining array.
Recall that the contiguous subar... | def main():
n = int(input())
arr = list(map(int, input().split()))
dpleft = []
for i in range(n):
if not dpleft:
dpleft.append(1)
elif arr[i] > arr[i - 1]:
dpleft.append(dpleft[-1] + 1)
else:
dpleft.append(1)
dpright = []
for i in range... | FUNC_DEF ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST FOR VAR FUNC_CALL VAR VAR IF VAR EXPR FUNC_CALL VAR NUMBER IF VAR VAR VAR BIN_OP VAR NUMBER EXPR FUNC_CALL VAR BIN_OP VAR NUMBER NUMBER EXPR FUNC_CALL VAR NUMBER ASSIGN VAR LIST FOR VAR FUN... |
You are given an array $a$ consisting of $n$ integers.
You can remove at most one element from this array. Thus, the final length of the array is $n-1$ or $n$.
Your task is to calculate the maximum possible length of the strictly increasing contiguous subarray of the remaining array.
Recall that the contiguous subar... | from sys import stdin
inp = lambda: stdin.readline().strip()
x = int(inp())
a = [int(x) for x in inp().split()]
l = [1] * x
r = [1] * x
ans = 1
for i in range(x - 2, -1, -1):
if a[i] < a[i + 1]:
r[i] = r[i + 1] + 1
ans = max(ans, r[i])
for i in range(1, x):
if a[i] > a[i - 1]:
l[i] = l[... | ASSIGN VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR BIN_OP LIST NUMBER VAR ASSIGN VAR BIN_OP LIST NUMBER VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER NUMBER NUMBER IF VAR VAR VAR BIN_OP VAR NUMBER ASSIGN VAR VAR B... |
You are given an array $a$ consisting of $n$ integers.
You can remove at most one element from this array. Thus, the final length of the array is $n-1$ or $n$.
Your task is to calculate the maximum possible length of the strictly increasing contiguous subarray of the remaining array.
Recall that the contiguous subar... | import sys
from itertools import chain, permutations
def res(x):
result = 1
current = 1
for i in range(1, len(x)):
if x[i] > x[i - 1]:
current = current + 1
result = max(result, current)
else:
result = max(result, current)
current = 1
... | IMPORT FUNC_DEF ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER FUNC_CALL VAR VAR IF VAR VAR VAR BIN_OP VAR NUMBER ASSIGN VAR BIN_OP VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR VAR ASSIGN VAR FUNC_CALL VAR VAR VAR ASSIGN VAR NUMBER IF VAR VAR ASSIGN VAR VAR RETURN VAR FUNC_DEF ASSIGN VAR FUNC_CALL VAR VAR ... |
You are given an array $a$ consisting of $n$ integers.
You can remove at most one element from this array. Thus, the final length of the array is $n-1$ or $n$.
Your task is to calculate the maximum possible length of the strictly increasing contiguous subarray of the remaining array.
Recall that the contiguous subar... | n = int(input())
array = input()
array = [int(x) for x in array.split()]
L = len(array)
if n == 1:
print(1)
exit()
elif n == 0:
print(0)
exit()
A = [[1, -1], [1, -1]]
nj = 1
if array[1] > array[0]:
nj += 1
A[1][0] = nj
ans = nj
for i in range(2, L):
if array[i] > array[i - 1]:
nj += 1
... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR IF VAR NUMBER EXPR FUNC_CALL VAR NUMBER EXPR FUNC_CALL VAR IF VAR NUMBER EXPR FUNC_CALL VAR NUMBER EXPR FUNC_CALL VAR ASSIGN VAR LIST LIST NUMBER NUMBER LIST NUMBER NUMBER ASSIGN V... |
You are given an array $a$ consisting of $n$ integers.
You can remove at most one element from this array. Thus, the final length of the array is $n-1$ or $n$.
Your task is to calculate the maximum possible length of the strictly increasing contiguous subarray of the remaining array.
Recall that the contiguous subar... | n = int(input())
a = list(map(int, input().split()))
dp = [(0) for _ in range(n)]
for i in range(n - 1, -1, -1):
if i == n - 1 or a[i] >= a[i + 1]:
dp[i] = 1
else:
dp[i] = dp[i + 1] + 1
ans = l = 1
i = 0
for j in range(1, n):
if a[j] > a[j - 1]:
l += 1
else:
if j - 2 >= i... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL 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 NUMBER NUMBER IF VAR BIN_OP VAR NUMBER VAR VAR VAR BIN_OP VAR NUMBER ASSIGN VAR VAR NUMBER ASSIGN VAR VAR BIN_OP VAR BIN_OP VAR NUMBER... |
You are given an array $a$ consisting of $n$ integers.
You can remove at most one element from this array. Thus, the final length of the array is $n-1$ or $n$.
Your task is to calculate the maximum possible length of the strictly increasing contiguous subarray of the remaining array.
Recall that the contiguous subar... | n = map(int, input().split())
t = list(map(int, input().split()))
t_l = [1]
t_r = [1]
curr_wyn = 1
for x in range(1, len(t)):
if t[x - 1] < t[x]:
curr_wyn += 1
t_l.append(curr_wyn)
else:
curr_wyn = 1
t_l.append(curr_wyn)
curr_wyn = 1
for x in range(len(t) - 2, -1, -1):
if t[x... | ASSIGN VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST NUMBER ASSIGN VAR LIST NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER FUNC_CALL VAR VAR IF VAR BIN_OP VAR NUMBER VAR VAR VAR NUMBER EXPR FUNC_CALL VAR VAR ASSIGN VAR NUMBER EXPR... |
You are given an array $a$ consisting of $n$ integers.
You can remove at most one element from this array. Thus, the final length of the array is $n-1$ or $n$.
Your task is to calculate the maximum possible length of the strictly increasing contiguous subarray of the remaining array.
Recall that the contiguous subar... | n = int(input())
arr = [int(j) for j in input().split()]
arr += [-(10**18)]
temp = []
count = [arr[0]]
for i in range(1, n + 1):
if arr[i] <= arr[i - 1]:
temp += [count]
count = [arr[i]]
else:
count += [arr[i]]
ma = 0
for x in temp:
if len(x) > ma:
ma = len(x)
ans = []
for i ... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR VAR LIST BIN_OP NUMBER NUMBER ASSIGN VAR LIST ASSIGN VAR LIST VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER BIN_OP VAR NUMBER IF VAR VAR VAR BIN_OP VAR NUMBER VAR LIST VAR ASSIGN VAR LIST VAR VAR VAR LIST VAR VAR ASSIGN VAR NUMBER... |
You are given an array $a$ consisting of $n$ integers.
You can remove at most one element from this array. Thus, the final length of the array is $n-1$ or $n$.
Your task is to calculate the maximum possible length of the strictly increasing contiguous subarray of the remaining array.
Recall that the contiguous subar... | n = int(input())
ns = [int(x) for x in input().split(" ")]
l = [(0) for x in ns]
r = [(0) for x in ns]
l[0] = 1
ans = 0
for i in range(1, n):
if ns[i] > ns[i - 1]:
l[i] = l[i - 1] + 1
ans = max(ans, l[i])
else:
l[i] = 1
r[n - 1] = 1
for i in range(n - 2, -1, -1):
if ns[i] < ns[i + 1]... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR STRING ASSIGN VAR NUMBER VAR VAR ASSIGN VAR NUMBER VAR VAR ASSIGN VAR NUMBER NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER VAR IF VAR VAR VAR BIN_OP VAR NUMBER ASSIGN VAR VAR BIN_OP VAR BIN_OP VAR NUMBER NUMBER ASSIG... |
You are given an array $a$ consisting of $n$ integers.
You can remove at most one element from this array. Thus, the final length of the array is $n-1$ or $n$.
Your task is to calculate the maximum possible length of the strictly increasing contiguous subarray of the remaining array.
Recall that the contiguous subar... | n = int(input())
a = [int(x) for x in input().split()]
ac = [1]
for a1, a2 in zip(a, a[1:]):
if a1 < a2:
ac.append(ac[-1] + 1)
else:
ac.append(1)
ds = [1]
for a1, a2 in zip(a[:-1][::-1], a[1:][::-1]):
if a1 < a2:
ds.append(ds[-1] + 1)
else:
ds.append(1)
ds = ds[::-1]
mx =... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST NUMBER FOR VAR VAR FUNC_CALL VAR VAR VAR NUMBER IF VAR VAR EXPR FUNC_CALL VAR BIN_OP VAR NUMBER NUMBER EXPR FUNC_CALL VAR NUMBER ASSIGN VAR LIST NUMBER FOR VAR VAR FUNC_CALL VAR VAR NUMBER NUMBER VAR NUMBER N... |
You are given an array $a$ consisting of $n$ integers.
You can remove at most one element from this array. Thus, the final length of the array is $n-1$ or $n$.
Your task is to calculate the maximum possible length of the strictly increasing contiguous subarray of the remaining array.
Recall that the contiguous subar... | n = int(input())
a = list(map(int, input().split()))
curr = [a[0]]
all = []
ans = 0
for i in range(1, n):
if a[i - 1] < a[i]:
curr.append(a[i])
else:
all.append(curr)
ans = max(ans, len(curr))
curr = [a[i]]
ans = max(ans, len(curr))
all.append(curr)
for i in range(1, len(all)):
... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST VAR NUMBER ASSIGN VAR LIST ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER VAR IF VAR BIN_OP VAR NUMBER VAR VAR EXPR FUNC_CALL VAR VAR VAR EXPR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR FUNC_CAL... |
You are given an array $a$ consisting of $n$ integers.
You can remove at most one element from this array. Thus, the final length of the array is $n-1$ or $n$.
Your task is to calculate the maximum possible length of the strictly increasing contiguous subarray of the remaining array.
Recall that the contiguous subar... | n = int(input())
ans = 1
x = [(1) for i in range(n)]
y = [(1) for i in range(n)]
s = list(map(int, input().split()))
for i in range(1, len(s)):
if s[i] > s[i - 1]:
x[i] = x[i - 1] + 1
else:
x[i] = 1
ans = max(ans, x[i])
for i in range(len(s) - 2, -1, -1):
if s[i] < s[i + 1]:
y[i]... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR FOR VAR FUNC_CALL VAR NUMBER FUNC_CALL VAR VAR IF VAR VAR VAR BIN_OP VAR NUMBER ASSIGN VAR VAR BIN_OP VAR BIN_OP VAR... |
You are given an array $a$ consisting of $n$ integers.
You can remove at most one element from this array. Thus, the final length of the array is $n-1$ or $n$.
Your task is to calculate the maximum possible length of the strictly increasing contiguous subarray of the remaining array.
Recall that the contiguous subar... | from sys import stdin
n = int(input())
a = [int(x) for x in stdin.readline().split()]
l = [(1) for i in range(n)]
r = [(1) for i in range(n)]
ans = 1
for i in range(1, n):
if a[i - 1] < a[i]:
l[i] += l[i - 1]
ans = max(ans, l[i])
for i in range(n - 2, -1, -1):
if a[i] < a[i + 1]:
r[i] += r[... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER VAR IF VAR BIN_OP VAR NUMBER VAR VAR VAR VAR VAR BIN_OP VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR V... |
You are given an array $a$ consisting of $n$ integers.
You can remove at most one element from this array. Thus, the final length of the array is $n-1$ or $n$.
Your task is to calculate the maximum possible length of the strictly increasing contiguous subarray of the remaining array.
Recall that the contiguous subar... | n = int(input())
a = list(map(int, input().split()))
m = 1
k = 0
e = 0
for i in range(n - 1):
k = e
c = 1
while k < n - 1 and a[k] < a[k + 1]:
c += 1
k += 1
e = k + 1
k += 1
if k < n and k - 2 >= 0 and a[k] <= a[k - 2]:
k += 1
if k < n and k - 2 >= 0 and a[k] > a[k - ... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER ASSIGN VAR VAR ASSIGN VAR NUMBER WHILE VAR BIN_OP VAR NUMBER VAR VAR VAR BIN_OP VAR NUMBER VAR NUMBER VAR NUMBER ASSIGN ... |
You are given an array $a$ consisting of $n$ integers.
You can remove at most one element from this array. Thus, the final length of the array is $n-1$ or $n$.
Your task is to calculate the maximum possible length of the strictly increasing contiguous subarray of the remaining array.
Recall that the contiguous subar... | n = int(input())
li = list(map(int, input().split()))
pre_dp = [1] * n
suff_dp = [1] * n
for i in range(1, n):
if li[i - 1] < li[i]:
pre_dp[i] = pre_dp[i - 1] + 1
for i in range(n - 2, -1, -1):
if li[i] < li[i + 1]:
suff_dp[i] = suff_dp[i + 1] + 1
res = 0
for i in range(n):
res = max(res, ma... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR BIN_OP LIST NUMBER VAR ASSIGN VAR BIN_OP LIST NUMBER VAR FOR VAR FUNC_CALL VAR NUMBER VAR IF VAR BIN_OP VAR NUMBER VAR VAR ASSIGN VAR VAR BIN_OP VAR BIN_OP VAR NUMBER NUMBER FOR VAR FUNC_CALL VAR BIN_OP ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.