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(x): if x % 8 == 0: print("YES") print(x) exit(0) s = input() for i in range(len(s)): curi = int(s[i]) check(curi) for j in range(len(s)): if j <= i: continue curj = curi * 10 + int(s[j]) check(curj) for k in range(len(s)): ...
FUNC_DEF IF BIN_OP VAR NUMBER NUMBER EXPR FUNC_CALL VAR STRING EXPR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR NUMBER ASSIGN VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR VAR EXPR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR IF VAR VAR ASSIGN VAR BIN_OP BIN_OP 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-...
dp = dict() st = input() def solve(index, qty, valor): t = index, qty, valor if t in dp: return dp[t] if index >= len(st) or qty >= 3: if valor % 8 == 0 and qty >= 1: dp[t] = valor else: dp[t] = -1 return dp[t] L = solve(index + 1, qty + 1, 10 * ...
ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_DEF ASSIGN VAR VAR VAR VAR IF VAR VAR RETURN VAR VAR IF VAR FUNC_CALL VAR VAR VAR NUMBER IF BIN_OP VAR NUMBER NUMBER VAR NUMBER ASSIGN VAR VAR VAR ASSIGN VAR VAR NUMBER RETURN VAR VAR ASSIGN VAR FUNC_CALL VAR BIN_OP VAR NUMBER BIN_OP VAR NUMBER 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-...
nstr = input() def solve(nstr): for n8 in range(0, 1000, 8): if has_subseq(nstr, str(n8)): print("YES") print(n8) return print("NO") def has_subseq(nstr, n8str): pos = 0 limit = len(nstr) for n in n8str: while pos < limit and nstr[pos] != n: ...
ASSIGN VAR FUNC_CALL VAR FUNC_DEF FOR VAR FUNC_CALL VAR NUMBER NUMBER NUMBER IF FUNC_CALL VAR VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR STRING EXPR FUNC_CALL VAR VAR RETURN EXPR FUNC_CALL VAR STRING FUNC_DEF ASSIGN VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR FOR VAR VAR WHILE VAR VAR VAR VAR VAR VAR NUMBER IF VAR VAR RETURN...
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()) if n % 8 == 0: print("YES") print(n) else: results = "NO" n = str(n) a = len(n) for x in range(a): b = int(n[x]) if b % 8 == 0: results = "YES" break for y in range(x + 1, a): b = int(n[x] + n[y]) if b % 8 =...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR IF BIN_OP VAR NUMBER NUMBER EXPR FUNC_CALL VAR STRING EXPR FUNC_CALL VAR VAR ASSIGN VAR STRING ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR VAR IF BIN_OP VAR NUMBER NUMBER ASSIGN VAR STRING FOR VAR FUNC_CALL VAR B...
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() x = len(n) flag = 0 for _ in range(0, 100001, 8): s = str(_) a = "" __ = 0 S = len(s) for ___ in range(x): if __ < S: if s[__] == n[___]: a += s[__] __ += 1 if a == s: print("YES") print(a) flag = 1 b...
ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER NUMBER NUMBER ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR STRING ASSIGN VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR VAR IF VAR VAR IF VAR VAR VAR VAR VAR VAR VAR VAR NUMBER IF VAR VAR EXPR FUNC_CALL VAR 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-...
from itertools import combinations from sys import stdin string = list(stdin.readline().strip()) if len(string) >= 3: for i in range(len(string) - 2): for j in range(i + 1, len(string) - 1): for k in range(j + 1, len(string)): num = int(string[i] + string[j] + string[k]) ...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL FUNC_CALL VAR IF FUNC_CALL VAR VAR NUMBER 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 ...
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 k = input() k = "00" + k n = len(k) flag = True for i in range(n - 2): for j in range(i + 1, n - 1): for t in range(j + 1, n): f = int(k[i] + k[j] + k[t]) if f % 8 == 0 and flag: print("YES") print(f) flag = False if flag: ...
IMPORT ASSIGN VAR FUNC_CALL VAR ASSIGN VAR BIN_OP STRING VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER 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 ASSIGN VAR FUNC_CALL VAR BIN_OP BIN_OP VAR VAR VAR VAR VAR VAR IF BIN_...
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() length = len(n) found = False n = n[::-1] if "8" in n: val = 8 found = True elif "0" in n: val = 0 found = True else: for i in range(1, length): if not found: for j in range(i): if not found: val = int(n[i] + n[j]) ...
ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER ASSIGN VAR VAR NUMBER IF STRING VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER IF STRING VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER VAR IF VAR FOR VAR FUNC_CALL VAR VAR IF VAR ASSIGN VAR FUNC_CALL VAR BIN_OP VAR VAR VAR VAR IF 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-...
a = input() z = len(a) for i in range(0, 993, 8): s = str(i) s1 = len(s) o = 0 for k in a: if k == s[o]: o += 1 if o == s1: print("YES") print(i) exit() print("NO")
ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR NUMBER NUMBER NUMBER ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER FOR VAR VAR IF VAR VAR VAR VAR NUMBER IF 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-...
n = input() f = 0 for i in range(len(n)): if int(n[i]) % 8 == 0: print("YES") print(n[i]) f = 1 break if f == 0: for i in range(len(n)): if f == 1: break for j in range(i + 1, len(n)): if int(n[i] + n[j]) % 8 == 0: print("YE...
ASSIGN VAR FUNC_CALL VAR ASSIGN VAR NUMBER 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 ASSIGN VAR NUMBER IF VAR NUMBER FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR IF VAR NUMBER FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER 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-...
s = str(input()) flag = 0 ans = 0 for i in range(len(s)): v1 = int(s[i]) if v1 % 8 == 0: flag = 1 ans = v1 break for j in range(i + 1, len(s)): if i != j: s1 = s[i] + s[j] v2 = int(s1) if v2 % 8 == 0: flag = 1 ...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR VAR IF BIN_OP VAR NUMBER NUMBER ASSIGN VAR NUMBER ASSIGN VAR VAR FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER FUNC_CALL VAR VAR IF VAR VAR ASSIGN VAR BIN_OP VAR VAR VAR VAR ASSIGN 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 = int(input()) if N % 8 == 0: print("YES") print(N) else: ok = 0 N = str(N) for i in range(len(str(N))): for j in range(i + 1, len(str(N))): for k in range(j + 1, len(str(N))): if (100 * int(N[i]) + 10 * int(N[j]) + int(N[k])) % 8 == 0 and ok == 0: ...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR IF BIN_OP VAR NUMBER NUMBER EXPR FUNC_CALL VAR STRING EXPR FUNC_CALL VAR VAR ASSIGN VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER FUNC_CALL VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR 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-...
from itertools import combinations def prog(): s = "00" + input().strip() worked = False for combo in combinations(s, 3): combo = int("".join(combo)) if combo % 8 == 0: print("YES") print(combo) worked = True break if not worked: ...
FUNC_DEF ASSIGN VAR BIN_OP STRING FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_CALL STRING VAR IF BIN_OP VAR NUMBER NUMBER EXPR FUNC_CALL VAR STRING EXPR FUNC_CALL VAR VAR ASSIGN VAR NUMBER IF VAR EXPR FUNC_CALL VAR STRING EXPR 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-...
n = [int(x) for x in input()][::-1] def f(x): if x % 8 == 0: print("YES") print(x) exit() for i, x in enumerate(n): f(x) for j, y in enumerate(n[i + 1 :], i + 1): f(x + 10 * y) for z in n[j + 1 :]: f(x + 10 * y + 100 * z) print("NO")
ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL VAR NUMBER FUNC_DEF IF BIN_OP VAR NUMBER NUMBER EXPR FUNC_CALL VAR STRING EXPR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR FOR VAR VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR VAR FOR VAR VAR FUNC_CALL VAR VAR BIN_OP VAR NUMBER BIN_OP VAR NUMBER EXPR FUNC_CALL VAR BIN_OP VAR BIN_OP 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-...
numero = input() NiUnoNiOtro = False for cifra in range(0, 1000, 8): x = -1 encontrado = False for digito in str(cifra): x = numero.find(digito, x + 1) if x < 0: encontrado = True break if not encontrado: print("YES") print(cifra) NiUnoNiOt...
ASSIGN VAR FUNC_CALL VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER NUMBER NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR BIN_OP VAR NUMBER IF VAR NUMBER ASSIGN VAR NUMBER IF VAR EXPR FUNC_CALL VAR STRING EXPR FUNC_CALL VAR VAR ASSIGN VAR NUMBER IF VAR EXPR 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-...
n = input().strip() till_1000 = [str(8 * num) for num in range(0, 125)] def is_subseq(sub): it = iter(n) return all(c in it for c in sub) for x in till_1000: if is_subseq(x): print("YES\n", x, sep="") break else: print("NO\n")
ASSIGN VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR BIN_OP NUMBER VAR VAR FUNC_CALL VAR NUMBER NUMBER FUNC_DEF ASSIGN VAR FUNC_CALL VAR VAR RETURN FUNC_CALL VAR VAR VAR VAR VAR FOR VAR VAR IF FUNC_CALL VAR VAR EXPR FUNC_CALL VAR STRING VAR STRING 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-...
n = input() if "0" in n: print("YES") print("0") exit(0) if "8" in n: print("YES") print("8") exit(0) num = int(n) x = int(num / 8) def SinN(s, n): i = 0 for c in s: i = n.find(c, i) + 1 if i == 0: return False return True while x > 0: for i in ran...
ASSIGN VAR FUNC_CALL VAR IF STRING VAR EXPR FUNC_CALL VAR STRING EXPR FUNC_CALL VAR STRING EXPR FUNC_CALL VAR NUMBER IF STRING VAR EXPR FUNC_CALL VAR STRING EXPR FUNC_CALL VAR STRING EXPR FUNC_CALL VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR BIN_OP VAR NUMBER FUNC_DEF ASSIGN VAR NUMBER FOR VAR 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-...
mas = (str(x) for x in range(0, 1000, 8)) s = input() q = False for x in mas: cnt = 0 if q: break for ch in s: if ch == x[cnt]: cnt += 1 if cnt == len(x): print("YES\n" + x) q = True break if not q: print("NO")
ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL VAR NUMBER NUMBER NUMBER ASSIGN VAR FUNC_CALL VAR ASSIGN VAR NUMBER FOR VAR VAR ASSIGN VAR NUMBER IF VAR FOR VAR VAR IF VAR VAR VAR VAR NUMBER IF VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR BIN_OP STRING VAR ASSIGN VAR NUMBER IF 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 check(S, x): if str(x) in S: return x K = list(str(x)) for i in S: if not K: return x if i == K[0]: K.pop(0) if not K: return x else: return -1 A = [] a = 0 while a < 1000: A.append(a) a += 8 S = input() for i in A: an...
FUNC_DEF IF FUNC_CALL VAR VAR VAR RETURN VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FOR VAR VAR IF VAR RETURN VAR IF VAR VAR NUMBER EXPR FUNC_CALL VAR NUMBER IF VAR RETURN VAR RETURN NUMBER ASSIGN VAR LIST ASSIGN VAR NUMBER WHILE VAR NUMBER EXPR FUNC_CALL VAR VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR FOR VAR VAR 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-...
def solve(): n = input() for i in range(0, 1000, 8): s = str(i) k = 0 for j in n: if s[k] == j: k += 1 if k == len(s): print("YES") print(s) return print("NO") for i in range(1): solve()
FUNC_DEF ASSIGN VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR NUMBER NUMBER NUMBER ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER FOR VAR VAR IF VAR VAR VAR VAR NUMBER IF VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR STRING EXPR FUNC_CALL VAR VAR RETURN EXPR FUNC_CALL VAR STRING FOR VAR FUNC_CALL VAR NUMBER EXPR 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-...
l = input() a = 0 m = [int(l[x]) for x in range(len(l))] for x in range(len(m)): if m[x] in [0, 8]: a = 1 b = m[x] break else: pass if a != 1: for x in range(len(m)): for y in range(x + 1, len(m)): if (10 * m[x] + m[y]) % 8 == 0: a = 1 ...
ASSIGN VAR FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR VAR VAR FUNC_CALL VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR IF VAR VAR LIST NUMBER NUMBER ASSIGN VAR NUMBER ASSIGN VAR VAR VAR IF VAR NUMBER FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR BIN_OP 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-...
n = list(map(int, list(input()))) found = False sol = 0 L = len(n) for i in range(L): if n[i] % 8 == 0: sol = n[i] found = True if not found: for i in range(L): for j in range(i + 1, L): if (10 * n[i] + n[j]) % 8 == 0: sol = 10 * n[i] + n[j] fo...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR VAR IF BIN_OP VAR VAR NUMBER NUMBER ASSIGN VAR VAR VAR ASSIGN VAR NUMBER IF VAR FOR VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER VAR IF BIN_OP 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() def f(n): for i in reversed(range(len(n))): ni = int(n[i]) if ni % 8 == 0: return True, "%d" % ni if ni % 2 == 0: for j in reversed(range(i)): nj = int(n[j]) if (10 * nj + ni) % 8 == 0: return True, "%d...
ASSIGN VAR FUNC_CALL VAR FUNC_DEF FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR VAR IF BIN_OP VAR NUMBER NUMBER RETURN NUMBER BIN_OP STRING VAR IF BIN_OP VAR NUMBER NUMBER FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR VAR IF BIN_OP BIN_OP BIN_OP NUMBER VAR 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(x): for i, t in enumerate(x, 1): if t in "13579": return g(t, x[i:]) def g(t, x): for u, v in ["12", "36", "44", "52", "76", "92"]: i = x.find(u) if i != -1: j = x.find(v, i + 1) if j != -1: return t + u + v def h(x): for ...
FUNC_DEF FOR VAR VAR FUNC_CALL VAR VAR NUMBER IF VAR STRING RETURN FUNC_CALL VAR VAR VAR VAR FUNC_DEF FOR VAR VAR LIST STRING STRING STRING STRING STRING STRING ASSIGN VAR FUNC_CALL VAR VAR IF VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR BIN_OP VAR NUMBER IF VAR NUMBER RETURN BIN_OP BIN_OP VAR VAR VAR FUNC_DEF FOR VAR VAR L...
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 = 0 for i in n: if int(i) % 8 == 0: print("YES") print(i) flag = 1 break if flag == 0: for i in range(l): for j in range(i + 1, l): if int(n[i] + n[j]) % 8 == 0: flag = 1 print("YES") ...
ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER FOR VAR VAR IF BIN_OP FUNC_CALL VAR VAR NUMBER NUMBER EXPR FUNC_CALL VAR STRING EXPR FUNC_CALL VAR VAR ASSIGN VAR NUMBER IF VAR NUMBER FOR VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER VAR IF BIN_OP FUNC_CALL VAR BIN_OP VAR VAR 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-...
n = input() if int(n) % 8 == 0: print("YES") print(n) elif "0" in n: print("YES") print(0) elif "8" in n: print("YES") print(8) else: flag = 0 k = 0 while not flag and k < 100: d = "0" * (2 - len(str(k))) + str(k) k += 8 t = n p1 = t.find(d[0]) ...
ASSIGN VAR FUNC_CALL VAR IF BIN_OP FUNC_CALL VAR VAR NUMBER NUMBER EXPR FUNC_CALL VAR STRING EXPR FUNC_CALL VAR VAR IF STRING VAR EXPR FUNC_CALL VAR STRING EXPR FUNC_CALL VAR NUMBER IF STRING VAR EXPR FUNC_CALL VAR STRING EXPR FUNC_CALL VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER WHILE VAR VAR NUMBER ASSIGN VAR BIN_...
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 = int(s) s = list(s) n = len(s) for i in range(n): s[i] = int(s[i]) if x % 8 == 0: print("YES") print(x) elif s.count(8) != 0: print("YES") print(8) elif s.count(0) != 0: print("YES") print(0) else: sol = -1 flag = 0 for i in range(n): for j in range(i + 1...
ASSIGN VAR FUNC_CALL VAR STRING ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR FUNC_CALL VAR VAR VAR IF BIN_OP VAR NUMBER NUMBER EXPR FUNC_CALL VAR STRING EXPR FUNC_CALL VAR VAR IF FUNC_CALL 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 diveight(n): for i in range(len(n) - 1, -1, -1): x1 = int(n[i]) if x1 % 8 == 0: return x1 for j in range(i - 1, -1, -1): x2 = x1 + int(n[j]) * 10 if x2 % 8 == 0: return x2 for k in range(j - 1, -1, -1): x3 = ...
FUNC_DEF FOR VAR FUNC_CALL VAR BIN_OP FUNC_CALL VAR VAR NUMBER NUMBER NUMBER ASSIGN VAR FUNC_CALL VAR VAR VAR IF BIN_OP VAR NUMBER NUMBER RETURN VAR FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER NUMBER NUMBER ASSIGN VAR BIN_OP VAR BIN_OP FUNC_CALL VAR VAR VAR NUMBER IF BIN_OP VAR NUMBER NUMBER RETURN VAR FOR VAR 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 = list(input()) a = list(map(int, a)) b = [] for i in range(len(a)): b.append(a[i] % 8) for i in range(len(a)): if b[i] in (0, 8): print("YES") print(a[i]) quit() for i in range(len(a)): for j in range(i, len(a)): if i != j: if (10 * b[i] + b[j]) % 8 == 0: ...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR VAR ASSIGN VAR LIST FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR BIN_OP VAR VAR NUMBER FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR IF VAR VAR NUMBER NUMBER EXPR FUNC_CALL VAR STRING EXPR FUNC_CALL VAR VAR VAR EXPR 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() for i in range(0, 1000, 8): x = 0 for j in str(i): x = s.find(j, x) if x == -1: break x += 1 if x != -1: print("YES") print(str(i)) exit() print("NO")
ASSIGN VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR NUMBER NUMBER NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR VAR IF VAR NUMBER VAR NUMBER IF VAR NUMBER EXPR FUNC_CALL VAR STRING EXPR FUNC_CALL VAR 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-...
s = input() flag = 0 ans = 0 if "8" in s: flag = 1 ans = 8 if "0" in s: flag = 1 ans = 0 for i in range(len(s)): for j in range(i + 1, len(s)): if int(s[i] + s[j]) % 8 == 0: flag = 1 ans = int(s[i] + s[j]) for i in range(len(s)): for j in range(i + 1, len(s)): ...
ASSIGN VAR FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER IF STRING VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER IF STRING VAR ASSIGN VAR NUMBER 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 IF BIN_OP FUNC_CALL VAR BIN_OP VAR VAR 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-...
n = input() have = False ans = 0 for i in range(len(n)): if int(n[i]) % 8 == 0: have = True ans = int(n[i]) for i in range(len(n)): for j in range(i + 1, len(n)): if (int(n[i]) * 10 + int(n[j])) % 8 == 0: have = True ans = int(n[i]) * 10 + int(n[j]) for i in range...
ASSIGN VAR FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR IF BIN_OP FUNC_CALL VAR VAR VAR NUMBER NUMBER ASSIGN VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR VAR FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER FUNC_CALL VAR VAR IF BIN_OP BIN_OP 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-...
ans = -1 n = input() def dfs(start, end, count, temp): global ans if count <= 3 and temp & 7 == 0: ans = temp return if count > 3: return for i in range(end + 1, len(n)): dfs(start, i, count + 1, temp * 10 + int(n[i])) for i in range(len(n)): count = 1 dfs(i, ...
ASSIGN VAR NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_DEF IF VAR NUMBER BIN_OP VAR NUMBER NUMBER ASSIGN VAR VAR RETURN IF VAR NUMBER RETURN FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER FUNC_CALL VAR VAR EXPR FUNC_CALL VAR VAR VAR BIN_OP VAR NUMBER BIN_OP BIN_OP VAR NUMBER FUNC_CALL VAR VAR VAR FOR VAR FUNC_CALL 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 solve(): n = int(input()) if n < 100: if n % 8 == 0: print("YES") print(n) elif n % 10 == 0: print("YES") print(0) else: print("NO") else: s = str(n) if "0" in s: print("YES") prin...
FUNC_DEF ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR IF VAR NUMBER IF BIN_OP VAR NUMBER NUMBER EXPR FUNC_CALL VAR STRING EXPR FUNC_CALL VAR VAR IF BIN_OP VAR NUMBER NUMBER EXPR FUNC_CALL VAR STRING EXPR FUNC_CALL VAR NUMBER EXPR FUNC_CALL VAR STRING ASSIGN VAR FUNC_CALL VAR VAR IF STRING VAR EXPR FUNC_CALL VAR STRING 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-...
num = input() length = len(num) done = False result = 0 for i in range(0, length): result = int(num[i]) if result % 8 == 0: print("YES") print(result) done = True break if not done: result = 0 for i in range(0, length - 1): if done: break resul...
ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER VAR ASSIGN VAR FUNC_CALL VAR VAR VAR IF BIN_OP VAR NUMBER NUMBER EXPR FUNC_CALL VAR STRING EXPR FUNC_CALL VAR VAR ASSIGN VAR NUMBER IF VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER BIN_OP 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-...
def sub(a, b): d = {} for l in range(len(b)): d[l] = b[l] for x in range(len(b)): if a and d[x] == a[0]: a = a[1:] if a == "": return True return False n = input() if "8" in n: print("YES", 8, sep="\n") else: e = [str(8 * x) for x in range(126) if "8" no...
FUNC_DEF ASSIGN VAR DICT FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR ASSIGN VAR VAR VAR VAR FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR IF VAR VAR VAR VAR NUMBER ASSIGN VAR VAR NUMBER IF VAR STRING RETURN NUMBER RETURN NUMBER ASSIGN VAR FUNC_CALL VAR IF STRING VAR EXPR FUNC_CALL VAR STRING NUMBER STRING ASSIGN VAR 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-...
num_str = input() permutations = [""] i = 0 while i < len(num_str): new = [] for p in [x for x in permutations if len(x) < 3]: new.append(p + num_str[i]) permutations += new i += 1 found = None for x in set(permutations[1:]): if int(x) % 8 == 0: found = x break if found: ...
ASSIGN VAR FUNC_CALL VAR ASSIGN VAR LIST STRING ASSIGN VAR NUMBER WHILE VAR FUNC_CALL VAR VAR ASSIGN VAR LIST FOR VAR VAR VAR VAR FUNC_CALL VAR VAR NUMBER EXPR FUNC_CALL VAR BIN_OP VAR VAR VAR VAR VAR VAR NUMBER ASSIGN VAR NONE FOR VAR FUNC_CALL VAR VAR NUMBER IF BIN_OP FUNC_CALL VAR VAR NUMBER NUMBER ASSIGN VAR VAR IF...
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 = str(input()) n = [i for i in n] flag = False for i in range(len(n)): if int(n[i]) % 8 == 0: flag = True ans = n[i] break for j in range(i + 1, len(n)): if int(n[i] + n[j]) % 8 == 0: flag = True ans = n[i] + n[j] break for k in range...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR VAR VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR IF BIN_OP FUNC_CALL VAR VAR VAR NUMBER NUMBER ASSIGN VAR NUMBER ASSIGN VAR VAR VAR FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER FUNC_CALL VAR VAR IF BIN_OP FUNC_CALL VAR BIN_OP VAR VAR VAR VAR NUMBER 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-...
a = input() if "0" in a: print("YES") print(0) else: x = 0 l = len(a) sol = False while x < l: if sol: break if int(a[x]) == 8: sol = True toprint = a[x] break for y in range(x, l): if int(a[x] + a[y]) % 8 == 0: ...
ASSIGN VAR FUNC_CALL VAR IF STRING VAR EXPR FUNC_CALL VAR STRING EXPR FUNC_CALL VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER WHILE VAR VAR IF VAR IF FUNC_CALL VAR VAR VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR VAR VAR FOR VAR FUNC_CALL VAR VAR VAR IF BIN_OP FUNC_CALL VAR BIN_OP 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-...
from itertools import combinations n = input() l = len(n) if n == "8" or n == "0": print("YES") print(n) elif n in ["1", "2", "3", "4", "5", "6", "7", "9"]: print("NO") elif l == 2 or l == 3: word = list(map(str, n)) for i in range(1, l + 1): x = list(combinations(word, i)) for j in...
ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR IF VAR STRING VAR STRING EXPR FUNC_CALL VAR STRING EXPR FUNC_CALL VAR VAR IF VAR LIST STRING STRING STRING STRING STRING STRING STRING STRING EXPR FUNC_CALL VAR STRING IF VAR NUMBER VAR NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR VAR FOR VAR 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-...
def is_possible(n, pat): i = 0 for c in n: if c == pat[i]: i += 1 if i == len(pat): return True return False def func(): n = input() if n.find("0") != -1: return print("YES\n0") if n.find("8") != -1: return print("YES\n8") pat...
FUNC_DEF ASSIGN VAR NUMBER FOR VAR VAR IF VAR VAR VAR VAR NUMBER IF VAR FUNC_CALL VAR VAR RETURN NUMBER RETURN NUMBER FUNC_DEF ASSIGN VAR FUNC_CALL VAR IF FUNC_CALL VAR STRING NUMBER RETURN FUNC_CALL VAR STRING IF FUNC_CALL VAR STRING NUMBER RETURN FUNC_CALL VAR STRING ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL VAR NUM...
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 def main(): n = input() if "0" in n: print("YES\n0") else: for i in range(1, min(3, len(n)) + 1): for r in combinations(n, i): m = int("".join(r)) if m % 8 == 0: print(f"YES\n{m}") ...
FUNC_DEF ASSIGN VAR FUNC_CALL VAR IF STRING VAR EXPR FUNC_CALL VAR STRING FOR VAR FUNC_CALL VAR NUMBER BIN_OP FUNC_CALL VAR NUMBER FUNC_CALL VAR VAR NUMBER FOR VAR FUNC_CALL VAR VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL STRING VAR IF BIN_OP VAR NUMBER NUMBER EXPR FUNC_CALL VAR STRING VAR EXPR FUNC_CALL VAR EXPR 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-...
s = input() i = 0 while i < 1000: t = str(i) j = 0 for k in s: if k == t[j]: j += 1 if j == len(t): break if j == len(t): print("YES") print(t) exit() i += 8 print("NO")
ASSIGN VAR FUNC_CALL VAR ASSIGN VAR NUMBER WHILE VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER FOR VAR VAR IF VAR VAR VAR VAR NUMBER IF VAR FUNC_CALL VAR VAR IF VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR STRING EXPR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR VAR NUMBER 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 CanDo(num): num = num[::-1] for i in range(0, len(num)): if int(num[i]) % 2 != 0: continue a = int(num[i]) if a % 8 == 0: return a for j in range(i + 1, len(num)): b = int(num[j]) * 10 + a if b % 8 == 0: return b...
FUNC_DEF ASSIGN VAR VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER FUNC_CALL VAR VAR IF BIN_OP FUNC_CALL VAR VAR VAR NUMBER NUMBER ASSIGN VAR FUNC_CALL VAR VAR VAR IF BIN_OP VAR NUMBER NUMBER RETURN VAR 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 VAR IF BIN_O...
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()) x = n _len = 0 if n == 0: _len = 1 while x != 0: _len += 1 x = x // 10 flag = 0 ans = -1 l = list(map(int, list(str(n)))) for i in range(_len): if l[i] % 8 == 0: flag = 1 ans = l[i] if flag == 0: for j in range(i + 1, _len): if (l[i] * 10 + l[j]) ...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR ASSIGN VAR NUMBER IF VAR NUMBER ASSIGN VAR NUMBER WHILE VAR NUMBER VAR NUMBER ASSIGN VAR BIN_OP VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR VAR IF BIN_OP VAR 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-...
lectura = input() conclusion = "NO" for multiplos8 in [str(i) for i in range(1000) if i % 8 == 0]: marcador = -1 for intento2 in multiplos8: marcador = lectura.find(intento2, marcador + 1) if marcador == -1: break if marcador != -1: conclusion = "YES" + "\n" + str(multipl...
ASSIGN VAR FUNC_CALL VAR ASSIGN VAR STRING FOR VAR FUNC_CALL VAR VAR VAR FUNC_CALL VAR NUMBER BIN_OP VAR NUMBER NUMBER ASSIGN VAR NUMBER FOR VAR VAR ASSIGN VAR FUNC_CALL VAR VAR BIN_OP VAR NUMBER IF VAR NUMBER IF VAR NUMBER ASSIGN VAR BIN_OP BIN_OP STRING STRING FUNC_CALL VAR VAR EXPR FUNC_CALL VAR 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-...
n = input() l = list(n) n = len(l) for i in range(len(l)): l[i] = int(l[i]) ans = 0 if 8 in l: print("YES") print(8) elif 0 in l: print("YES") print(0) elif n < 3: if n == 2: if (l[0] * 10 + l[1]) % 8 == 0: print("YES") print(l[0] * 10 + l[1]) elif l[1] ==...
ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN 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 IF NUMBER VAR EXPR FUNC_CALL VAR STRING EXPR FUNC_CALL VAR NUMBER IF NUMBER VAR EXPR FUNC_CALL VAR STRING EXPR FUNC_CALL VAR NUMBER IF VAR NUM...
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-...
__author__ = "victormion" def function(): for word in array: last = -1 flag = True for i in range(0, len(word)): last = n.find(word[i], last + 1) if last == -1: flag = False if flag: return word return -1 n = input() temp = ...
ASSIGN VAR STRING FUNC_DEF FOR VAR VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR VAR BIN_OP VAR NUMBER IF VAR NUMBER ASSIGN VAR NUMBER IF VAR RETURN VAR RETURN NUMBER ASSIGN VAR FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR LIST EXPR 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-...
n = input().strip() ll = [] for i in range(16, 1001, 8): ll.append(str(i)) if "0" in n: print("YES\n0") elif "8" in n: print("YES\n8") else: f = False p = n for i in ll: n = p q = "" for j in range(len(i)): l = n.find(i[j]) if l != -1: ...
ASSIGN VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST FOR VAR FUNC_CALL VAR NUMBER NUMBER NUMBER EXPR FUNC_CALL VAR FUNC_CALL VAR VAR IF STRING VAR EXPR FUNC_CALL VAR STRING IF STRING VAR EXPR FUNC_CALL VAR STRING ASSIGN VAR NUMBER ASSIGN VAR VAR FOR VAR VAR ASSIGN VAR VAR ASSIGN VAR STRING 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-...
def uni_c(): for c in n: v = int(c) if v % 8 == 0: return v return -1 def two_c(): for i in range(len(n)): for j in range(i + 1, len(n)): num = int(n[i]) * 10 + int(n[j]) if num % 8 == 0: return num return -1 def three_c(): ...
FUNC_DEF FOR VAR VAR ASSIGN VAR FUNC_CALL VAR VAR IF BIN_OP VAR NUMBER NUMBER RETURN VAR RETURN NUMBER FUNC_DEF FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR 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_CALL VAR VAR VAR IF BIN_OP VAR NUMBER NUMBER RETURN...
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 divisibili(a): m = len(a) k = 0 for i in range(m - 1, -1, -1): if int(a[i]) % 8 == 0: print("YES") print(a[i]) k = 1 return for j in range(i - 1, -1, -1): if (int(a[j]) * 2 + int(a[i])) % 8 == 0: print("YES") ...
FUNC_DEF ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER NUMBER NUMBER IF BIN_OP FUNC_CALL VAR VAR VAR NUMBER NUMBER EXPR FUNC_CALL VAR STRING EXPR FUNC_CALL VAR VAR VAR ASSIGN VAR NUMBER RETURN FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER NUMBER NUMBER IF BIN_OP BIN_OP BIN_OP FUNC_CAL...
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-...
lis = list(input()) n = len(lis) ans = 0 aa = [2, 4, 8] c = 0 for i in range(n - 1, -1, -1): tmp = ans + int(lis[i]) * 10**c if tmp % aa[c] == 0: ans = tmp c += 1 if c == 3: break if c == 0 or ans % 8 != 0: print("NO") else: print("YES") print(ans)
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER ASSIGN VAR LIST NUMBER NUMBER NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER NUMBER NUMBER ASSIGN VAR BIN_OP VAR BIN_OP FUNC_CALL VAR VAR VAR BIN_OP NUMBER VAR IF BIN_OP VAR VAR VAR NUMBER ASSIGN VAR VAR VAR NUMBER I...
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-...
i = input() def sub_is_8_divisible(number): possible = set() i = 1 while i <= len(number): possible.add(int(number[-i])) i += 1 i = 1 while i <= len(number): e = i + 1 while e <= len(number): possible.add(int(number[-e] + number[-i])) e += 1 ...
ASSIGN VAR FUNC_CALL VAR FUNC_DEF ASSIGN VAR FUNC_CALL VAR ASSIGN VAR NUMBER WHILE VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR FUNC_CALL VAR VAR VAR VAR NUMBER ASSIGN VAR NUMBER WHILE VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP VAR NUMBER WHILE VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR FUNC_CALL VAR BIN_OP VAR VAR VAR VAR 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-...
from sys import stdin, stdout for _ in range(1): s = input() n = len(s) ans = -1 if "8" in s: print("YES") print("8") continue if "0" in s: print("YES") print("0") continue for i in range(n): for j in range(i + 1, n): for k in ...
FOR VAR FUNC_CALL VAR NUMBER ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER IF STRING VAR EXPR FUNC_CALL VAR STRING EXPR FUNC_CALL VAR STRING IF STRING VAR EXPR FUNC_CALL VAR STRING EXPR FUNC_CALL VAR STRING FOR VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER VAR FOR 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-...
def possible(A): rems = [False] * 8 prev = {} digitFor = {} for x in A: digit = int(x) nxtRems = [False] * 8 if digit % 8 not in digitFor: digitFor[digit % 8] = str(digit) nxtRems[digit % 8] = True for rem in range(len(rems)): nxtRems[rem] ...
FUNC_DEF ASSIGN VAR BIN_OP LIST NUMBER NUMBER ASSIGN VAR DICT ASSIGN VAR DICT FOR VAR VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP LIST NUMBER NUMBER IF BIN_OP VAR NUMBER VAR ASSIGN VAR BIN_OP VAR NUMBER FUNC_CALL VAR VAR ASSIGN VAR BIN_OP VAR NUMBER NUMBER FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR VAR VAR VAR 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-...
from itertools import * from sys import * s = input() com, com2 = list(combinations(s, 3)), list(combinations(s, 2)) l, eight, zero = len(s), s.find("8"), s.find("0") if l == 1: if int(s) % 8: exit(print("NO")) else: exit(print("YES", s, sep="\n")) if eight != -1: exit(print("YES", "8", sep...
ASSIGN VAR FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR FUNC_CALL VAR VAR NUMBER FUNC_CALL VAR FUNC_CALL VAR VAR NUMBER ASSIGN VAR VAR VAR FUNC_CALL VAR VAR FUNC_CALL VAR STRING FUNC_CALL VAR STRING IF VAR NUMBER IF BIN_OP FUNC_CALL VAR VAR NUMBER EXPR FUNC_CALL VAR FUNC_CALL VAR STRING EXPR FUNC_CALL VAR FUNC_CALL VAR S...
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_2(num_list, n): for i in range(n): for j in range(i + 1, n): sub_num = num_list[i] * 10 + num_list[j] if sub_num % 8 == 0: print("YES") return sub_num return -1 def sub_3(num_list, n): for i in range(n): for j in range(i + 1, ...
FUNC_DEF FOR VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER VAR ASSIGN VAR BIN_OP BIN_OP VAR VAR NUMBER VAR VAR IF BIN_OP VAR NUMBER NUMBER EXPR FUNC_CALL VAR STRING RETURN VAR RETURN NUMBER FUNC_DEF FOR VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER VAR FOR VAR FUNC_CALL VAR BIN_OP 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 = str(input()) k = 0 l = int(n) + 1 for i in range(len(n)): m = n[i] if int(m) % 8 == 0: k = k + 1 l = m break for i in range(len(n) - 1): for j in range(i + 1, len(n)): m = n[i] + n[j] if int(m) % 8 == 0: k = k + 1 l = m break fo...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR BIN_OP FUNC_CALL VAR VAR NUMBER FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR ASSIGN VAR VAR VAR IF BIN_OP FUNC_CALL VAR VAR NUMBER NUMBER ASSIGN VAR BIN_OP VAR NUMBER ASSIGN VAR VAR FOR VAR FUNC_CALL VAR BIN_OP FUNC_CALL VAR VAR NUMBER 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-...
a = list(map(int, list(input()))) n = len(a) dp = [(0) for i in range(n)] flag = 0 ans = 0 for i in range(n): if a[i] == 0 or a[i] == 8: flag = 1 ans = a[i] break if flag == 0: for i in range(1, n): for j in range(i): if (a[j] * 10 + a[i]) % 8 == 0: an...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR IF VAR VAR NUMBER VAR VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR VAR VAR IF VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER VAR 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-...
a = input() n = len(a) was = False for i4 in range(n - 1, -1, -1): if was: break p = int(a[i4]) if p % 8 == 0: print("YES") print(p) was = True if p % 2 != 0: continue for i3 in range(i4 - 1, -1, -1): if was: break p += int(a[i3]) *...
ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER NUMBER NUMBER IF VAR ASSIGN VAR FUNC_CALL VAR VAR VAR IF BIN_OP VAR NUMBER NUMBER EXPR FUNC_CALL VAR STRING EXPR FUNC_CALL VAR VAR ASSIGN VAR NUMBER IF BIN_OP VAR NUMBER NUMBER FOR VAR FUNC_CALL VAR 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-...
A = input() list(A) A = [int(i) for i in A] if A[0] == 0: print("YES") print(0) else: result = "NO" for i in range(0, len(A)): for j in range(i + 1, len(A)): for k in range(j + 1, len(A)): if (100 * A[i] + 10 * A[j] + A[k]) % 8 == 0: result = 100 *...
ASSIGN VAR FUNC_CALL VAR EXPR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR VAR VAR IF VAR NUMBER NUMBER EXPR FUNC_CALL VAR STRING EXPR FUNC_CALL VAR NUMBER ASSIGN VAR STRING FOR VAR FUNC_CALL VAR NUMBER 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...
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 C = list(map(int, input().strip())) if 8 in C: print("YES") print(8) elif 0 in C: print("YES") print(0) else: combi = [] for i in range(1, 4): tmp = [list(x) for x in itertools.combinations(C, i)] combi.extend(tmp) flag = True for tmp in combi: n...
IMPORT ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR IF NUMBER VAR EXPR FUNC_CALL VAR STRING EXPR FUNC_CALL VAR NUMBER IF NUMBER VAR EXPR FUNC_CALL VAR STRING EXPR FUNC_CALL VAR NUMBER ASSIGN VAR LIST FOR VAR FUNC_CALL VAR NUMBER NUMBER ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL VAR VAR VAR 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-...
ASCII_0 = ord("0") def can_remove_digits(number_string): i = len(number_string) - 1 while i >= 0: third_digit = ord(number_string[i]) - ASCII_0 if third_digit % 8 == 0: return third_digit j = i - 1 while j >= 0: second_digit = ord(number_string[j]) - ASC...
ASSIGN VAR FUNC_CALL VAR STRING FUNC_DEF ASSIGN VAR BIN_OP FUNC_CALL VAR VAR NUMBER WHILE VAR NUMBER ASSIGN VAR BIN_OP FUNC_CALL VAR VAR VAR VAR IF BIN_OP VAR NUMBER NUMBER RETURN VAR ASSIGN VAR BIN_OP VAR NUMBER WHILE VAR NUMBER ASSIGN VAR BIN_OP FUNC_CALL VAR VAR VAR VAR ASSIGN VAR BIN_OP BIN_OP VAR NUMBER VAR IF BIN...
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-...
m = [] flag = False for i in range(100, 999): if i % 8 == 0: m.append(str(i)) s = input() for i in m: posa = 1000 posb = 1000 posc = 1000 a = i[0] b = i[1] c = i[2] for j in range(len(s)): if s[j] == a: posa = j break for j in range(posa + 1, l...
ASSIGN VAR LIST ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER NUMBER IF BIN_OP VAR NUMBER NUMBER EXPR FUNC_CALL VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FOR VAR VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR VAR NUMBER ASSIGN VAR VAR NUMBER ASSIGN VAR VAR NUMBER FOR VAR FUNC_CALL 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-...
a = input() def ans(i, a): b = str(i) j = 0 for i in a: if i == b[j]: j += 1 if j == len(b): return 1 return 0 q = 0 for i in range(0, 1000, 8): if ans(i, a): q = 1 break if q: print("YES") print(i) else: print("NO")
ASSIGN VAR FUNC_CALL VAR FUNC_DEF ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER FOR VAR VAR IF VAR VAR VAR VAR NUMBER IF VAR FUNC_CALL VAR VAR RETURN NUMBER RETURN NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER NUMBER NUMBER IF FUNC_CALL VAR VAR VAR ASSIGN VAR NUMBER IF VAR EXPR FUNC_CALL VAR STRING EXPR 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-...
arr = list(map(int, list(input()))) found = False i = len(arr) - 1 while i >= 0 and not found: if arr[i] == 0 or arr[i] == 8: print("YES") print(0 if arr[i] == 0 else 8) found = True i -= 1 i = len(arr) - 1 while not found and i >= 0: if arr[i] % 2 == 0: for j in range(i): ...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR BIN_OP FUNC_CALL VAR VAR NUMBER WHILE VAR NUMBER VAR IF VAR VAR NUMBER VAR VAR NUMBER EXPR FUNC_CALL VAR STRING EXPR FUNC_CALL VAR VAR VAR NUMBER NUMBER NUMBER ASSIGN VAR NUMBER VAR NUMBER ASSIGN VAR BIN_OP 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 verify(x): return x != -1 d = dict() def solve(index, cur): if index == len(n): if cur % 8 == 0 and cur: return cur return -1 if (index, cur) in d: return d[index, cur] x = solve(index + 1, cur) y = solve(index + 1, (cur * 10 + int(n[index])) % 1000) i...
FUNC_DEF RETURN VAR NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_DEF IF VAR FUNC_CALL VAR VAR IF BIN_OP VAR NUMBER NUMBER VAR RETURN VAR RETURN NUMBER IF VAR VAR VAR RETURN VAR VAR VAR ASSIGN VAR FUNC_CALL VAR BIN_OP VAR NUMBER VAR ASSIGN VAR FUNC_CALL VAR BIN_OP VAR NUMBER BIN_OP BIN_OP BIN_OP VAR NUMBER FUNC_CALL VAR VAR 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-...
n = input() a = [] for i in n: a.append(i) if "0" in a: print("YES") print(0) elif "8" in a: print("YES") print(8) elif len(a) == 1: print("NO") elif len(a) == 2: if int(n) % 8 == 0: print("YES") print(n) else: print("NO") elif len(a) >= 3: for j in range(len(...
ASSIGN VAR FUNC_CALL VAR ASSIGN VAR LIST FOR VAR VAR EXPR FUNC_CALL VAR VAR IF STRING VAR EXPR FUNC_CALL VAR STRING EXPR FUNC_CALL VAR NUMBER IF STRING VAR EXPR FUNC_CALL VAR STRING EXPR FUNC_CALL VAR NUMBER IF FUNC_CALL VAR VAR NUMBER EXPR FUNC_CALL VAR STRING IF FUNC_CALL VAR VAR NUMBER IF BIN_OP FUNC_CALL 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-...
import sys input = [] input_index = 0 def next(type, number=None): def next(): global input, input_index while input_index == len(input): if sys.stdin: input = sys.stdin.readline().split() input_index = 0 else: raise Excepti...
IMPORT ASSIGN VAR LIST ASSIGN VAR NUMBER FUNC_DEF NONE FUNC_DEF WHILE VAR FUNC_CALL VAR VAR IF VAR ASSIGN VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER FUNC_CALL VAR VAR NUMBER RETURN VAR BIN_OP VAR NUMBER IF VAR NONE ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL VAR VAR RE...
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-...
ans = -1 num = input() temp = 0 for x in range(0, 1000, 8): for sym in str(x): if sym in num[temp:]: temp = num[temp:].index(sym) + 1 + temp else: temp = 0 break else: ans = x break if ans == -1: print("NO") else: print("YES", ans, sep=...
ASSIGN VAR NUMBER ASSIGN VAR FUNC_CALL VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER NUMBER NUMBER FOR VAR FUNC_CALL VAR VAR IF VAR VAR VAR ASSIGN VAR BIN_OP BIN_OP FUNC_CALL VAR VAR VAR NUMBER VAR ASSIGN VAR NUMBER ASSIGN VAR VAR IF VAR NUMBER EXPR FUNC_CALL VAR STRING EXPR FUNC_CALL VAR STRING 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 solve(s): for i in range(0, len(s)): if int(s[i]) % 8 == 0: print("YES") print(s[i]) return for i in range(0, len(s) - 1): for j in range(i + 1, len(s)): if int(s[i] + s[j]) % 8 == 0: print("YES") print(s[i] + s[...
FUNC_DEF FOR VAR FUNC_CALL VAR NUMBER 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 FOR VAR FUNC_CALL VAR NUMBER BIN_OP FUNC_CALL VAR VAR NUMBER FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER FUNC_CALL VAR VAR IF BIN_OP FUNC_CALL VAR BIN_OP VAR 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-...
digits = input()[::-1] val = None for i in range(0, 1000, 8): first = 0 for j in reversed(str(i)): c = digits.find(j, first) if c == -1: break else: first = c + 1 else: val = i break print("YES" + "\n" + str(val) if val != None else "NO")
ASSIGN VAR FUNC_CALL VAR NUMBER ASSIGN VAR NONE FOR VAR FUNC_CALL VAR NUMBER NUMBER NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR VAR IF VAR NUMBER ASSIGN VAR BIN_OP VAR NUMBER ASSIGN VAR VAR EXPR FUNC_CALL VAR VAR NONE BIN_OP BIN_OP STRING STRING FUNC_CALL VAR 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() a = [int(x) for x in s] n = len(s) for i in range(n): if a[i] % 8 == 0: print("YES") print(a[i]) exit() ans = [] for i in range(n): for j in range(i + 1, n): if (a[i] * 10 + a[j]) % 8 == 0: print("YES") print(a[i] * 10 + a[j]) exit(...
ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR VAR ASSIGN VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR VAR IF BIN_OP VAR VAR NUMBER NUMBER EXPR FUNC_CALL VAR STRING EXPR FUNC_CALL VAR VAR VAR EXPR FUNC_CALL VAR ASSIGN VAR LIST FOR VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER VAR IF BIN_OP BIN...
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 as it n = list(input()) flag = 0 for i in range(1, 4): temp = it.combinations(n, i) for j in temp: temp1 = int("".join(j)) if temp1 % 8 == 0: print("YES") print(temp1) flag = 1 break else: continue if flag ...
IMPORT ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER NUMBER ASSIGN VAR FUNC_CALL VAR VAR VAR FOR VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL STRING VAR IF BIN_OP VAR NUMBER NUMBER EXPR FUNC_CALL VAR STRING EXPR FUNC_CALL VAR VAR ASSIGN VAR NUMBER IF VAR NUMBER IF VAR 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-...
eg = list(str(input())) for i in range(len(eg)): eg[i] = int(eg[i]) for i in range(0, len(eg) - 2): for j in range(i + 1, len(eg) - 1): for m in range(j + 1, len(eg)): if (eg[i] * 100 + eg[j] * 10 + eg[m]) % 8 == 0: print("YES") print(eg[i] * 100 + eg[j] * 10 ...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR ASSIGN VAR VAR FUNC_CALL VAR VAR VAR FOR VAR FUNC_CALL VAR NUMBER 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...
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-...
ch = str(input()) T = "NO" if len(ch) >= 3: T = "NO" res = 0 BIG = list() for i in range(100, 1000): if i % 8 == 0: BIG.append(i) for n in BIG: a = str(n)[0] b = str(n)[1] c = str(n)[2] m = len(ch) n = len(ch) p = len(ch) fo...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR STRING IF FUNC_CALL VAR VAR NUMBER ASSIGN VAR STRING ASSIGN VAR NUMBER ASSIGN VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR NUMBER NUMBER IF BIN_OP VAR NUMBER NUMBER EXPR FUNC_CALL VAR VAR FOR VAR VAR ASSIGN VAR FUNC_CALL VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR NUMBER 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-...
def readint(): return int(input()) def readfloat(): return float(input()) def readarray(n, f=input): return [f() for i in range(n)] def readlinearray(f=int): return list(map(f, input().split())) def euclide(a, b): if a < 0: g, x, y = euclide(-a, b) return g, -x, y if b < ...
FUNC_DEF RETURN FUNC_CALL VAR FUNC_CALL VAR FUNC_DEF RETURN FUNC_CALL VAR FUNC_CALL VAR FUNC_DEF VAR RETURN FUNC_CALL VAR VAR FUNC_CALL VAR VAR FUNC_DEF VAR RETURN FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR FUNC_DEF IF VAR NUMBER ASSIGN VAR VAR VAR FUNC_CALL VAR VAR VAR RETURN VAR VAR VAR IF VAR NUMBER 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-...
def solve(): n = int(input()) arr = [int(i) for i in str(n)] unique = [i for i in arr if i % 2 == 0] if 0 in arr: print("YES") print(0) return elif n % 8 == 0: print("YES") print(n) return elif len(unique) == 0: print("NO") return ...
FUNC_DEF ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR VAR VAR BIN_OP VAR NUMBER NUMBER IF NUMBER VAR EXPR FUNC_CALL VAR STRING EXPR FUNC_CALL VAR NUMBER RETURN IF BIN_OP VAR NUMBER NUMBER EXPR FUNC_CALL VAR STRING EXPR FUNC_CALL VAR VAR RETURN IF 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-...
v = [] for i in input(): v.append(int(i)) n = len(v) succ = False for i in range(0, n): for j in range(i, n): for k in range(j, n): if succ: continue s = set() s.add(i) s.add(j) s.add(k) r = 0 z = [] ...
ASSIGN VAR LIST FOR VAR FUNC_CALL VAR EXPR FUNC_CALL VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER VAR FOR VAR FUNC_CALL VAR VAR VAR FOR VAR FUNC_CALL VAR VAR VAR IF VAR ASSIGN VAR FUNC_CALL VAR EXPR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR VAR 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-...
n = "00" + input() while len(n) >= 3 and int(n[-1]) % 2 == 1: n = n[:-1] while len(n) >= 3 and int(n[-2] + n[-1]) % 4 != 0: n = n[:-2] + n[-1] while len(n) >= 3 and int(n[-3] + n[-2] + n[-1]) % 8 != 0: n = n[:-3] + n[-2] + n[-1] n = n[2:] if n: print("YES") print(n) else: print("NO")
ASSIGN VAR BIN_OP STRING FUNC_CALL VAR WHILE FUNC_CALL VAR VAR NUMBER BIN_OP FUNC_CALL VAR VAR NUMBER NUMBER NUMBER ASSIGN VAR VAR NUMBER WHILE FUNC_CALL VAR VAR NUMBER BIN_OP FUNC_CALL VAR BIN_OP VAR NUMBER VAR NUMBER NUMBER NUMBER ASSIGN VAR BIN_OP VAR NUMBER VAR NUMBER WHILE FUNC_CALL VAR VAR NUMBER BIN_OP 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-...
def preveritabelo(list): preverjenec = list[0] if preverjenec % 8 != 0: resitu = True for element in range(len(list)): if list[element] == preverjenec: continue else: resitu = False break return resitu else: ...
FUNC_DEF ASSIGN VAR VAR NUMBER IF BIN_OP VAR NUMBER NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR IF VAR VAR VAR ASSIGN VAR NUMBER RETURN VAR RETURN VAR FUNC_DEF ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR LIST FOR VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR FUNC_CALL VAR VAR IF FUNC_CALL VAR 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() N = len(S) flag = 0 if S.count("0") > 0: print("YES") print(0) exit() if S.count("8") > 0: print("YES") print(8) exit() if N < 3: if int(S) % 8 == 0: print("YES") print(S) elif S.count("0") > 0: print("YES") print(0) elif S.count("8") > 0: ...
ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER IF FUNC_CALL VAR STRING NUMBER EXPR FUNC_CALL VAR STRING EXPR FUNC_CALL VAR NUMBER EXPR FUNC_CALL VAR IF FUNC_CALL VAR STRING NUMBER EXPR FUNC_CALL VAR STRING EXPR FUNC_CALL VAR NUMBER EXPR FUNC_CALL VAR IF VAR NUMBER IF BIN_OP FUNC_CALL 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-...
s = input() n = len(s) g = 0 for i in range(n): if s[i] == "0" or s[i] == "8": print("YES") print(s[i]) g = 1 break for j in range(i + 1, n): if int(s[i] + s[j]) % 8 == 0: print("YES") print(s[i] + s[j]) g = 1 break ...
ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR IF VAR VAR STRING VAR VAR STRING EXPR FUNC_CALL VAR STRING EXPR FUNC_CALL VAR VAR VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER VAR IF BIN_OP FUNC_CALL VAR BIN_OP VAR VAR VAR VAR NUMBER NUMBER EXPR FUNC_CAL...
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 = int(s) if a % 8 == 0: print("YES") print(a) else: n = len(s) if n == 1: if a % 8 == 0: print("YES") print(a) else: print("NO") elif n == 2: if "0" in s: print("YES") print(0) elif "8" in s: ...
ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR IF BIN_OP VAR NUMBER NUMBER EXPR FUNC_CALL VAR STRING EXPR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR IF VAR NUMBER IF BIN_OP VAR NUMBER NUMBER EXPR FUNC_CALL VAR STRING EXPR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR STRING IF VAR NUMBER IF STRING VAR 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-...
d = input() n = len(d) if d.find("8") != -1: print("YES") print("8") elif d.find("0") != -1: print("YES") print("0") else: for i in range(n - 1): if d[i] != "0": for j in range(i + 1, n): t = d[i] + d[j] if int(t) % 8 == 0: prin...
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 STRING IF FUNC_CALL VAR STRING NUMBER EXPR FUNC_CALL VAR STRING EXPR FUNC_CALL VAR STRING FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER IF VAR VAR STRING FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER 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 solve(n): for q in (8 * i for i in range(125)): nums = list(str(q)) for c in reversed(n): if c == nums[-1]: nums.pop() if not nums: return q def main(): n = input() ans = solve(n) ans = "YES\n{}".format(ans) if ans is not None...
FUNC_DEF FOR VAR BIN_OP NUMBER VAR VAR FUNC_CALL VAR NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR VAR IF VAR VAR NUMBER EXPR FUNC_CALL VAR IF VAR RETURN VAR FUNC_DEF ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR VAR NONE FUNC_CALL STRING VAR STRING EXPR FUNC_CALL VAR VAR 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-...
def solve(nstr): if "8" in nstr: print("YES") print("8") return elif "0" in nstr: print("YES") print("0") return ind2 = nstr.rfind("2") ind4 = nstr.rfind("4") ind6 = nstr.rfind("6") if ind2 > 0: for ch in ["1", "5", "9"]: if ch ...
FUNC_DEF IF STRING VAR EXPR FUNC_CALL VAR STRING EXPR FUNC_CALL VAR STRING RETURN IF STRING VAR EXPR FUNC_CALL VAR STRING EXPR FUNC_CALL VAR STRING RETURN ASSIGN VAR FUNC_CALL VAR STRING ASSIGN VAR FUNC_CALL VAR STRING ASSIGN VAR FUNC_CALL VAR STRING IF VAR NUMBER FOR VAR LIST STRING STRING STRING IF VAR VAR NUMBER 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-...
num = list(input()) if "8" in num: print("YES") print(8) elif "0" in num: print("YES") print(0) else: for a in range(len(num)): for b in range(a + 1, len(num)): if int(num[a] + num[b]) % 8 == 0: print("YES") print(num[a] + num[b]) e...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR IF STRING VAR EXPR FUNC_CALL VAR STRING EXPR FUNC_CALL VAR NUMBER IF STRING VAR EXPR FUNC_CALL VAR STRING EXPR FUNC_CALL VAR NUMBER FOR VAR FUNC_CALL VAR 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 VAR VAR VAR 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-...
n = input() lgn = len(n) eights = [str(8 * x) for x in range(125)] def match(eight): j = 0 lge = len(eight) ok = 0 for i in range(lgn): if j < lge and eight[j] == n[i]: ok += 1 j += 1 if ok == lge: return 1 else: return 0 ok = 0 for i in range(...
ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR BIN_OP NUMBER VAR VAR FUNC_CALL VAR NUMBER FUNC_DEF ASSIGN VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR IF VAR VAR VAR VAR VAR VAR VAR NUMBER VAR NUMBER IF VAR VAR RETURN NUMBER RETURN NUMBER 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-...
s = input() s = s[::-1] l = len(s) y = 0 for x in range(l): if s[x] == "0" or s[x] == "8": y = 1 print("YES") print(s[x]) elif x != l - 1: for i in range(x + 1, l): if int(s[i] + s[x]) % 8 == 0: print("YES") print(s[i] + s[x]) ...
ASSIGN VAR FUNC_CALL VAR ASSIGN VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR IF VAR VAR STRING VAR VAR STRING ASSIGN VAR NUMBER EXPR FUNC_CALL VAR STRING EXPR FUNC_CALL VAR VAR VAR IF VAR BIN_OP VAR NUMBER FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER VAR IF BIN_OP FUNC_CALL VAR BIN...
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 success(n): print("YES") print(n) exit(0) def check_div(a, b, c): if a == 8 or b == 8 or c == 8: success(8) if (10 * a + b) % 8 == 0: success(10 * a + b) if (10 * a + c) % 8 == 0: success(10 * a + c) if (10 * b + c) % 8 == 0: success(10 * b + c) if (...
FUNC_DEF EXPR FUNC_CALL VAR STRING EXPR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR NUMBER FUNC_DEF IF VAR NUMBER VAR NUMBER VAR NUMBER EXPR FUNC_CALL VAR NUMBER IF BIN_OP BIN_OP BIN_OP NUMBER VAR VAR NUMBER NUMBER EXPR FUNC_CALL VAR BIN_OP BIN_OP NUMBER VAR VAR IF BIN_OP BIN_OP BIN_OP NUMBER VAR VAR NUMBER NUMBER EXPR 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-...
import itertools n = str(input()) length = len(n) divis = False for i in itertools.combinations(n, 1): if int("".join(i)) % 8 == 0: print("YES") print("".join(i)) divis = True break if divis == False and length >= 2: for i in itertools.combinations(n, 2): if int("".join(...
IMPORT ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR NUMBER IF BIN_OP FUNC_CALL VAR FUNC_CALL STRING VAR NUMBER NUMBER EXPR FUNC_CALL VAR STRING EXPR FUNC_CALL VAR FUNC_CALL STRING VAR ASSIGN VAR NUMBER IF VAR NUMBER VAR NUMBER FOR VAR FUNC_CALL VAR 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 = list(input()) length = len(s) if s.count("0") > 0: print("YES", 0, sep="\n") elif s.count("8") > 0: print("YES", 8, sep="\n") elif length < 3: s = "".join(s) if int(s) % 8 == 0: print("YES", s, sep="\n") else: print("NO") else: for i in range(length - 2): for j in ran...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR IF FUNC_CALL VAR STRING NUMBER EXPR FUNC_CALL VAR STRING NUMBER STRING IF FUNC_CALL VAR STRING NUMBER EXPR FUNC_CALL VAR STRING NUMBER STRING IF VAR NUMBER ASSIGN VAR FUNC_CALL STRING VAR IF BIN_OP FUNC_CALL VAR VAR NUMBER NUMBER EXPR FUNC_CALL 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-...
n = input() ans = 0 YES = "YES" NO = "NO" for i in range(0, len(n)): x = int(n[i]) if x % 8 == 0: ans = 1 print(YES) print(x) break if ans != 1: for i in range(len(n) - 1, -1, -1): if ans == 1: break if int(n[i]) % 2 == 0: for j in rang...
ASSIGN VAR FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR STRING ASSIGN VAR STRING FOR VAR FUNC_CALL VAR NUMBER FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR VAR IF BIN_OP VAR NUMBER NUMBER ASSIGN VAR NUMBER EXPR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR VAR IF VAR NUMBER FOR VAR FUNC_CALL VAR BIN_OP FUNC_CALL VAR VAR NUMBER N...
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() if "0" in t: print("YES") print(0) elif len(t) == 1: if t == "8": print("YES") print(8) else: print("NO") elif len(t) == 2: if "8" in t: print("YES") print(8) elif int(t) % 8 == 0: print("YES") print(t) else: print("...
ASSIGN VAR FUNC_CALL VAR IF STRING VAR EXPR FUNC_CALL VAR STRING EXPR FUNC_CALL VAR NUMBER IF FUNC_CALL VAR VAR NUMBER IF VAR STRING EXPR FUNC_CALL VAR STRING EXPR FUNC_CALL VAR NUMBER EXPR FUNC_CALL VAR STRING IF FUNC_CALL VAR VAR NUMBER IF STRING VAR EXPR FUNC_CALL VAR STRING EXPR FUNC_CALL VAR NUMBER IF BIN_OP 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-...
def check(n): return n % 8 == 0 s = input() if "8" in s: print("YES") print("8") exit() if "0" in s: print("YES") print("0") exit() s = "00" + s for i in range(len(s) - 2): for j in range(i + 1, len(s) - 1): for k in range(j + 1, len(s)): if check(int("{}{}{}".forma...
FUNC_DEF RETURN BIN_OP VAR NUMBER NUMBER ASSIGN VAR FUNC_CALL VAR IF STRING VAR EXPR FUNC_CALL VAR STRING EXPR FUNC_CALL VAR STRING EXPR FUNC_CALL VAR IF STRING VAR EXPR FUNC_CALL VAR STRING EXPR FUNC_CALL VAR STRING EXPR FUNC_CALL VAR ASSIGN VAR BIN_OP STRING VAR FOR VAR FUNC_CALL VAR BIN_OP FUNC_CALL VAR VAR NUMBER 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-...
n = list(input()) l = len(n) for i in range(l): n[i] = int(n[i]) flag = 0 for i in range(l): if n[i] == 8 or n[i] == 0: print("YES") print(n[i]) flag = 1 break if flag == 0: for i in range(l - 1): for j in range(i + 1, l): k = int(str(n[i]) + str(n[j])) ...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR FUNC_CALL VAR VAR VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR IF VAR VAR NUMBER VAR VAR NUMBER EXPR FUNC_CALL VAR STRING EXPR FUNC_CALL VAR VAR VAR ASSIGN VAR NUMBER IF VAR NUMBER FOR VAR FUNC_CALL VAR BIN_O...
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(a): if len(a) < 3: return int(a) % 8 == 0 code = lambda x: ord(x) - ord("0") val = 4 * code(a[-3]) + 2 * code(a[-2]) + code(a[-1]) return val % 8 == 0 def main(): s = input() m = len(s) r = "" if s.find("8") >= 0: print("YES\n8") return 0 if s.find...
FUNC_DEF IF FUNC_CALL VAR VAR NUMBER RETURN BIN_OP FUNC_CALL VAR VAR NUMBER NUMBER ASSIGN VAR BIN_OP FUNC_CALL VAR VAR FUNC_CALL VAR STRING ASSIGN VAR BIN_OP BIN_OP BIN_OP NUMBER FUNC_CALL VAR VAR NUMBER BIN_OP NUMBER FUNC_CALL VAR VAR NUMBER FUNC_CALL VAR VAR NUMBER RETURN BIN_OP VAR NUMBER NUMBER FUNC_DEF 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-...
s = input() if "8" in s: print("YES") print(8) elif "0" in s: print("YES") print(0) else: l = len(s) f = False for i in range(l - 1): if f: break for j in range(i + 1, l): if int(s[i] + s[j]) % 8 == 0: f = int(s[i] + s[j]) i...
ASSIGN VAR FUNC_CALL VAR IF STRING VAR EXPR FUNC_CALL VAR STRING EXPR FUNC_CALL VAR NUMBER IF STRING VAR EXPR FUNC_CALL VAR STRING EXPR FUNC_CALL VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER IF VAR FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER VAR IF BIN_OP FUNC_CALL VAR B...
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 = "00" + input() ans = False num = 0 for k in range(len(s) - 2): for i in range(k + 1, len(s) - 1): for j in range(i + 1, len(s)): if int(s[k] + s[i] + s[j]) % 8 == 0: ans = True num = int(s[k] + s[i] + s[j]) if ans: print("YES") print(num) else: pri...
ASSIGN VAR BIN_OP STRING FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER 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 IF BIN_OP FUNC_CALL VAR BIN_OP BIN_OP VAR VAR VAR VAR VAR VAR...