@@ -0,0 +1,11 @@ | |||
import sys | |||
ans1 = 0 | |||
ans2 = 0 | |||
for line in sys.stdin.readlines(): | |||
a, b, c = sorted(map(int, line.split('x'))) | |||
ans1 += 2 * (a * b + b * c + a * c) + a * b | |||
ans2 += a * b * c + 2 * (a + b) | |||
print(ans1) | |||
print(ans2) |
@@ -0,0 +1,12 @@ | |||
import sys | |||
from itertools import accumulate as acc | |||
text = sys.stdin.read() | |||
dirs = dict(zip('<>^v', [-1, 1, -1j, 1j])) | |||
ans1 = len({*acc(map(dirs.get, text))}) | |||
print(ans1) | |||
ans2 = len({*acc(map(dirs.get, text[::2])), *acc(map(dirs.get, text[1::2]))}) | |||
print(ans2) |
@@ -0,0 +1,23 @@ | |||
import sys | |||
from hashlib import md5 | |||
from multiprocessing import Pool | |||
def mine(code, i): | |||
hasher = md5() | |||
hasher.update(f'{code}{i}'.encode()) | |||
return i, hasher.hexdigest() | |||
if __name__ == '__main__': | |||
code = sys.stdin.read().strip() | |||
ans1 = None | |||
ans2 = None | |||
with Pool() as pool: | |||
for i, coin in pool.starmap(mine, [(code, i) for i in range(10**7)]): | |||
if ans1 is None and coin.startswith('00000'): | |||
ans1 = i | |||
if ans2 is None and coin.startswith('000000'): | |||
ans2 = i | |||
print(ans1) | |||
print(ans2) |
@@ -0,0 +1,22 @@ | |||
import re | |||
import sys | |||
def checks1(string): | |||
yield len(re.findall(r'([aeiou])', string)) >= 3 | |||
yield len(re.findall(r'(.)\1', string)) | |||
yield len(re.findall(r'(ab|cd|pq|xy)', string)) == 0 | |||
def checks2(string): | |||
yield len(re.findall(r'(.)(.).*\1\2', string)) >= 1 | |||
yield len(re.findall(r'(.).\1', string)) >= 1 | |||
ans1 = 0 | |||
ans2 = 0 | |||
for line in sys.stdin.read().splitlines(): | |||
ans1 += all(checks1(line)) | |||
ans2 += all(checks2(line)) | |||
print(ans1) | |||
print(ans2) |