def main(): parens = InputReader.fetch_input() floor = 0 for index, paren in enumerate(parens): floor += 1 if paren == "(" else -1 if floor == -1: print(index + 1) break
def main(): secret_key = InputReader.fetch_input() done = False num = 0 while not done: value_to_hash = secret_key + str(num) hex_value = md5(value_to_hash.encode()).hexdigest() first_5 = str(hex_value)[0:6] if first_5 == "00000": done = True else: num += 1 print(num)
def main(): santa_x = 0 santa_y = 0 robo_x = 0 robo_y = 0 visited = {coord_to_key(0, 0)} directions = InputReader.fetch_input() for index, direction in enumerate(directions): if index % 2 == 0: santa_x, santa_y = update_coord(santa_x, santa_y, direction, visited) else: robo_x, robo_y = update_coord(robo_x, robo_y, direction, visited) print(len(visited))
def main(): x = 0 y = 0 presents = 1 visited = {coord_to_key(0, 0)} directions = InputReader.fetch_input() for direction in directions: if direction == "^": y += 1 elif direction == "v": y -= 1 elif direction == ">": x += 1 else: x -= 1 if not coord_to_key(x, y) in visited: presents += 1 visited.add(coord_to_key(x, y)) print(presents)
def main(): parens = InputReader.fetch_input() floor = sum([1 if paren == "(" else -1 for paren in parens]) print(floor)