You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

2 lines
514 B

with open("input2_pre.txt") as f:
print(sum([(({(1, 1): 3,(1, 2): 1,(1, 3): 2,(2, 1): 1,(2, 2): 2,(2, 3): 3,(3, 1): 2,(3, 2): 3,(3, 3): 1,}[([int(a) for a in line.strip().split()][0], [int(a) for a in line.strip().split()][1])]) + ((3, 0, 6)[((([int(a) for a in line.strip().split()][0]) - ({(1, 1): 3,(1, 2): 1,(1, 3): 2,(2, 1): 1,(2, 2): 2,(2, 3): 3,(3, 1): 2,(3, 2): 3,(3, 3): 1,}[([int(a) for a in line.strip().split()][0], [int(a) for a in line.strip().split()][1])])) % 3)])) for line in f.readlines()]))