def mystery(x):
if not isinstance(x, str): return False
if len(x) != 15: return False
grid = [
[1, 2, 3],
[4, 5, 6],
[7, 8, 9]
]
r, c = 1, 1
seq = [grid[r][c]]
for move in x:
if move == 'U': r -= 1
elif move == 'D': r += 1
elif move == 'L': c -= 1
elif move == 'R': c += 1
else: return False
if r < 0 or r > 2 or c < 0 or c > 2:
return False
seq.append(grid[r][c])
return sum(seq[i] * (10 ** i) for i in range(len(seq))) == 6589632145874125
def mystery(x):
if not isinstance(x, str):
return False
try:
n = int(x)
except ValueError:
return False
if n < 0:
return False
from math import factorial
digits = [int(d) for d in str(n)]
digit_factorial_sum = sum(factorial(d) for d in digits)
return digit_factorial_sum == n
def mystery(x):
if not isinstance(x, str) or len(x) != 21:
return False
allowed = set("0123456789+* ")
for c in x:
if c not in allowed:
return False
try:
val1 = eval(x)
val2 = eval(x[::-1])
except Exception:
return False
return val1 == 12345 and val2 == 99999
def mystery(x):
if not isinstance(x, str):
return False
if not x.isdigit():
return False
if len(x) % 2 != 0:
return False
mid = len(x) // 2
left = x[:mid]
right = x[mid:]
left_num = int(left)
right_num = int(right[::-1])
return left_num * right_num == 1024
def mystery(x):
if not isinstance(x, str) or len(x) > 130:
return False
try:
import hashlib
env = {"__builtins__": {}, "md5": hashlib.md5}
f = eval(x, env)
return f() == hashlib.md5(x.encode()).hexdigest()
except Exception:
return False
def mystery(x):
if not isinstance(x, str) or len(x) != 6:
return False
if not x.isdigit() or x[0] == '0':
return False
digits = [int(d) for d in x]
# Each digit (from the 3rd) is the last digit of the sum of the previous two
if not all(digits[i] == (digits[i-1] + digits[i-2]) % 10 for i in range(2, 6)):
return False
# The sum of all digits equals 20
return sum(digits) == 20
def mystery(x):
if not isinstance(x, str) or len(x) > 90:
return False
if "_" in x:
return False
try:
res = eval(x, {"__builtins__": {}})
return isinstance(res, str) and res == x.swapcase()
except Exception:
return False
def mystery(x):
if not isinstance(x, str) or not x.isdigit() or len(x) < 4 or x[0] == '0':
return False
def is_prime(n):
if n < 2:
return False
for i in range(2, int(n**0.5) + 1):
if n % i == 0:
return False
return True
# Each consecutive 3-digit substring must be prime
for i in range(len(x) - 2):
if not is_prime(int(x[i:i+3])):
return False
# The number itself must be prime
return is_prime(int(x))
def mystery(x):
if not isinstance(x, str) or len(x) > 115:
return False
# Completely empty sandbox blocks all built-ins (like len, eval, str, vars)
# Banning "_" mathematically eliminates all dunder-based sandbox escapes
# Banning "len" outright forces an alternate mathematical length calculation
if "_" in x or "len" in x:
return False
try:
res = eval(x, {"__builtins__": {}})
return isinstance(res, tuple) and len(res) == 2 and res[0] == x and res[1] == len(x)
except Exception:
return False
def mystery(x):
if not isinstance(x, str) or not x.isdigit() or len(x) != 10 or x[0] == '0':
return False
# Sum of all digits must be 40
if sum(int(d) for d in x) != 40:
return False
# Last digit must be 0
if x[-1] != '0':
return False
# Digits 1-9 must all be in range [3, 7]
for d in x[:-1]:
if int(d) < 3 or int(d) > 7:
return False
# Last 3 digits must form a number divisible by 8
if int(x[-3:]) % 8 != 0:
return False
return True