K2YJLCH7FGGD56VAPJGZ5FX3O664ZRK43HAQ2UKHYMRQ4FYYJO3QC
#!/bin/sh python3
import itertools
from typing import List
Input = List[int]
Solution = int
def read_data(filename: str) -> Input:
with open(filename, 'r') as f:
return [int(x) for x in list(f)]
def solve_problem(numbers: Input) -> Solution:
combinations = itertools.combinations(numbers, 2)
right = next(pair for pair in combinations if pair[0] + pair[1] == 2020)
return right[0] * right[1]
def main():
data = read_data("input_1.txt")
print(solve_problem(data))
if __name__ == "__main__":
main()
#!/bin/sh python3
import itertools
from functools import reduce
from typing import List
Input = List[int]
Solution = int
def read_data(filename: str) -> Input:
with open(filename, 'r') as f:
return [int(x) for x in list(f)]
def solve_problem(numbers: Input) -> Solution:
combinations = itertools.combinations(numbers, 3)
right = next(combination for combination in combinations if sum(combination) == 2020)
return reduce(lambda x, y: x*y, right)
def main():
data = read_data("input_1.txt")
print(solve_problem(data))
if __name__ == "__main__":
main()
1975
1600
113
1773
1782
1680
1386
1682
1991
1640
1760
1236
1159
1259
1279
1739
1826
1888
1072
416
1632
1656
1273
1631
1079
1807
1292
1128
1841
1915
1619
1230
1950
1627
1966
774
1425
1983
1616
1633
1559
1925
960
1407
1708
1211
1666
1910
1960
1125
1242
1884
1829
1881
1585
1731
1753
1784
1095
1267
1756
1226
1107
1664
1710
2000
1181
1997
1607
1889
1613
1859
1479
1763
1692
1967
522
1719
1816
1714
1331
1976
1160
1899
1906
1783
1061
2006
1993
1717
2009
1563
1733
1866
1651
1437
1517
1113
1743
1240
1629
1868
1912
1296
1873
1673
1996
1814
1215
1927
1956
1970
1887
1702
1495
1754
1621
1055
1538
1693
1840
1685
1752
1933
1727
1648
1792
1734
1305
1446
1764
1890
1904
1560
1698
1645
1214
1516
1064
1729
1835
1642
1932
1683
962
1081
1943
1502
1622
196
1972
1916
1850
1205
1971
1937
1575
1401
1351
2005
1917
1670
1388
1051
1941
1751
1169
510
217
1948
1120
1635
1636
1511
1691
1589
1410
1902
1572
1871
1423
1114
1806
1282
1193
1974
388
1398
1992
1263
1786
1723
1206
1363
1177
1646
1231
1140
1088
1322
#!/bin/sh python3
import itertools
import re
from typing import List, Dict
Input = Dict
Solution = int
def parse(line:str) -> Input:
parsed = re.match("(?P<min>\d+)-(?P<max>\d+) (?P<char>\w): (?P<password>\w+)", line)
return {
"min": int(parsed.group("min")),
"max": int(parsed.group("max")),
"char": parsed.group("char"),
"password": parsed.group("password")
}
def read_data(filename: str) -> List[Input]:
with open(filename, 'r') as f:
return [parse(x) for x in list(f)]
def check_password(case: Input) -> bool:
number = case['password'].count(case["char"])
return case["min"] <= number <= case["max"]
def solve_problem(numbers: List[Input]) -> Solution:
return sum(1 for case in numbers if check_password(case))
def main():
data = read_data("input_2.txt")
print(solve_problem(data))
if __name__ == "__main__":
main()
#!/bin/sh python3
import itertools
import re
from typing import List, Dict
Input = Dict
Solution = int
def parse(line:str) -> Input:
parsed = re.match("(?P<min>\d+)-(?P<max>\d+) (?P<char>\w): (?P<password>\w+)", line)
return {
"pos1": int(parsed.group("min")),
"pos2": int(parsed.group("max")),
"char": parsed.group("char"),
"password": parsed.group("password")
}
def read_data(filename: str) -> List[Input]:
with open(filename, 'r') as f:
return [parse(x) for x in list(f)]
def check_password(case: Input) -> bool:
char1 = case['password'][case['pos1'] - 1]
char2 = case['password'][case['pos2'] - 1]
target = case['char']
return (char1 == target) != (char2 == target)
def solve_problem(numbers: List[Input]) -> Solution:
return sum(1 for case in numbers if check_password(case))
def main():
data = read_data("input_2.txt")
print(solve_problem(data))
if __name__ == "__main__":
main()
4-5 r: rrrjr
9-10 x: pxcbpxxwkqjttx
8-13 b: rjbbbbvgrbrfjx
3-5 d: dtddsdddddsddddddwd
3-11 q: qbqsqqzqqxkmbqx
3-4 v: vgvhcvxlbfcwg
1-7 t: rtctmtt
8-11 s: ksssswsssstssssss
2-6 v: vxvvvlvv
16-18 c: ptgprcccvqvbfcnckc
18-20 w: wgtnwgnwvzwqhqtwvwrw
14-18 k: kkkkkkxkkkkkknkkkl
3-6 f: pwfgqlbbrfvwf
6-10 h: pqlfbhcnglgvhdgddn
2-13 k: bkfdvztsdkkkwm
8-12 d: dddddddddddd
1-10 v: lvvvvvvvvvvnvvvvvv
2-3 d: dfdz
3-10 w: vwwwwwnwwwwwxww
2-7 c: ccwkpggxd
4-5 g: kgqqg
1-14 q: bcqqqqqqdqqqqbqqcq
1-10 j: jjjjjjjfjjjjhjj
1-4 x: bkjghxrsb
2-15 v: vvvpvvvpvvrvvvvvvv
1-6 q: pqlqqn
2-6 k: skdkqk
14-16 g: sggbggggrgbmgtgg
8-9 f: ffffnkffk
1-2 x: tjxxl
6-8 t: tzdtvttkhctk
1-4 z: zzzkzzzzzxzzz
1-2 h: hthhjhhhqq
2-4 d: ddpkzvxbjnxhw
1-4 k: kkhq
8-9 s: sssssssps
5-11 b: bbbbbbbbbrbbbbbb
2-4 g: crrj
4-5 j: djjjqzmxttjg
1-4 b: bbbbb
3-4 z: zrqx
2-12 l: vvggvdqqcjplqzkczgj
15-16 l: sgclwcllcvltvthl
2-3 c: tbclrfclrhxvtlw
8-11 n: nhnnnwlqnnznnnnnn
7-15 c: jlcxswgncffcpnbdrhlx
6-14 k: kkkkkgkkkkkkkkk
8-11 r: rrrrrrrsrrrkrrr
4-6 m: fmhmtmm
10-12 p: ppcpjppppppg
2-5 m: zbtmmmmlmmmhvblmmnx
4-5 q: hqwhr
2-5 r: rzrrwrr
9-10 k: kkkkkkkkchk
3-5 p: ppptkpn
2-3 f: ffxfzwd
6-14 p: ppppppppppppppppp
1-7 f: hffffffkffff
2-13 h: hhhhhhhhhmmhvhhhjhhh
8-10 z: zzzzkzzbdzz
8-16 w: wwwwwwwwwwwwvwwwwww
3-10 n: qqpnnnlnwznctsbjnn
2-4 m: rmfw
2-5 z: jzfsqt
14-15 n: nnnnfnfndpnnnnn
7-9 d: drvdpddpddd
8-12 j: kjjjjjjqjjjjjj
3-11 h: hxhhhhllhthwhjhxhhhz
3-5 w: ndwww
5-10 r: qrrrrrrrrrrr
9-10 k: kkkdlkkkkwknkg
5-7 t: lstztlh
1-2 j: jljk
5-19 q: zkrqqwthdjgzqzpjwkq
2-3 r: drrrpswzwfmrfcrss
8-12 r: qrrrdrxfzdqb
17-18 x: cxbdcxxxxxxkxxdxxq
12-15 d: dvxdddddndzldlmc
6-14 m: mmmmmsmmmmmmmmm
2-4 s: lssf
1-4 p: tpppp
4-10 w: wwwwwwwwwpwww
3-14 p: fshdffznzrppwpp
1-8 l: hllllmlf
1-18 m: mmmmmmmmmmmmmmmmtmm
5-7 p: pfpqpppp
7-15 q: qzkqvfxqqrvqqqcnxccc
3-4 g: jlgggtk
2-3 f: dfffffffffff
2-3 j: jjjmjs
8-10 t: tthtmxttftftvttntqkh
1-13 x: xxxxxxxsxxxxxx
2-3 d: fjdd
13-17 b: nnxgrpkqgtnhjsnbcqhb
12-18 x: lnqlnzqxxlxclzpwxx
7-10 l: gxxlqllqmllglmls
2-15 j: djfqjtlswxsdrvwcwkl
7-9 n: hdblrjntz
2-4 f: ffzff
2-3 b: bvbb
10-14 n: tglngsjnzlptknxcrbdn
15-16 m: mmmksfmsbzmmjnqmm
3-6 g: kgzmgk
9-17 g: gcgrgxhgggmgrrdqtdg
3-5 h: whcfh
4-5 g: kpdgw
2-10 d: dhdddddddld
9-12 l: stsjflnqblqtl
2-3 t: tttt
18-19 t: tttctttttttttttttqj
5-8 x: xxxdxxxxxmxhpxdpx
5-8 h: hhhphhhkhtthhph
1-7 l: wlllllnl
4-7 x: xxxlxxsx
14-15 r: rrrrdlvrrrrrdjvrrr
11-18 c: hbhtbtczsbcqvrkxwc
14-17 d: ndqzdrcftdkdddddv
2-3 l: llgf
7-8 z: hvqcstzrzz
3-13 g: ggtggggggggggggggg
11-12 r: dgnzdmsrqgrccf
8-9 z: zqzzzzzzbzz
7-9 h: hllhhhwhhzhrc
7-9 g: ghgkgwrvg
5-6 d: ddddknd
4-5 s: qqlss
1-2 q: jcqq
9-10 v: vvvvvvvvxwvvvv
4-9 p: zqjpvpttf
16-20 t: tpttthqttcpttttftttk
8-13 p: pppppppmppppppp
1-5 p: hpppzp
2-4 t: ktttt
2-4 f: jfltfr
2-6 t: gxtmnt
2-8 v: vvjqpvvxvvfvzvv
1-4 l: dqlsll
1-3 b: zhqgqrbk
7-9 n: nncfnnnnwnnn
4-12 w: bqswnwqwlkhwbcc
1-2 b: kbbbb
4-11 x: xjxkxxxnxxxxxxxxxx
2-10 b: bbbwnbknghbbbbbj
9-11 h: hhhmghhshtqh
8-9 t: tdctmtfpt
8-19 b: bbbbbbbsbngbzhbpbbb
11-12 k: dxkkhkknrkrkkkz
8-10 b: fcbwbgbkbb
1-5 h: qfdhn
6-9 w: wwwvkpwwbwwwww
1-10 c: ccccccccccccccccc
13-14 k: kxzkfkkkkkkfvckkk
2-4 p: wrrrpb
7-9 s: spsssssvssssxzsqzssh
4-5 f: fffgf
13-15 n: clhngxdnnsnqlptnz
10-11 f: fffffffffhlff
9-13 k: kkkkkkkktkkkkk
15-16 p: pxppppppgprslpln
4-6 s: mscssms
2-4 b: zbjjjz
13-17 n: cthpnbmzwxbnnxngns
14-18 z: zzzzzzzzzzzzzdzzzvz
16-18 h: hhhhhhhhhhhhhhhvhhh
1-6 s: xssfswlsssscdnshss
7-10 v: cwrzfzvppzgcvkxs
1-2 n: xnjnnrn
8-9 b: rnbbbskbrhbbbfbz
10-20 x: jljkxspllxqhjvknfxqx
6-7 q: qxskpqq
5-8 q: mwhqqqdfq
11-15 l: lplldlllltlljll
3-8 j: grsdjjzj
2-8 p: pppppppjp
3-10 m: xpfmmmvmnmrtjmfbkpb
10-11 k: cfkbkndxkxgk
11-12 k: kkkkkkkkkkkb
10-11 t: ttttttttttnt
10-11 w: wwwwvgswwwwwwwwww
3-4 c: drkc
8-11 f: ffgfdffjffnflnqfsff
5-6 n: nnnnwtq
10-11 s: dsswkmshsbsslwgsvss
8-11 z: zzzzzzzlzzsz
8-15 s: sssssssssnsssssssss
9-18 d: ghzcrfrhflqdsvrphd
11-16 q: fqqqkpfhxqqmgxcj
4-6 b: qcbzcv
2-5 q: qqlpn
9-10 c: ccccbqgxcc
11-14 v: nzvjhxvvnvbvvvvv
1-4 q: xqgq
5-12 t: ftdtmwmqkhthj
5-6 w: bqlwwr
11-12 t: vlfgktvfttrt
4-7 n: nfnvtnjnnbnbnnn
9-15 w: wwwwwwwwwwwwwwjwww
17-18 k: kkkkkpkkkkkkkkkkkckk
2-4 x: nxnx
2-4 s: lbjm
4-6 j: jjjqjzj
3-4 v: lvwv
5-8 x: xhxxxsgxnjfdb
4-6 m: wmmlcx
6-10 t: tttttdttttt
15-18 d: dddddsdddddddddddldd
14-16 r: crwxgrrlrrgsrrqc
4-8 b: bbccgprbbqmvmjcbbfn
8-10 d: dddddddddldd
3-5 k: jkkzk
19-20 q: bnqnchhwjjrnzzqcqqvq
2-3 g: ghfggxgbg
11-16 r: pgqjshvmjrzrrrxsr
4-6 j: qjjjnrjzjjrjj
6-10 n: qrwwvnngtnsgmn
7-8 m: mmmmmmhhmm
5-6 c: clfcnx
1-2 c: zcccc
9-10 q: lpqfbkdqqq
4-9 t: wrjtzlrptlkvsmt
13-15 l: klsgqllzlvlrbkl
4-5 j: jjjljj
6-11 p: ppppppppppbrppppp
11-12 q: cqqqqqqqqqtq
8-9 z: zzzxmzszz
12-18 z: zzzzzzzzwzzzzzzzfzzz
12-13 h: nhhhhshhptzjs
3-5 c: ccmghck
6-9 z: zzjzzjzvzzz
12-15 d: dddddddddddkddddd
7-11 c: qwcccmccccc
10-12 t: ttttdvwrwrwgt
2-3 l: ljbll
8-9 x: xxxxdxxmx
1-4 b: wpdgxfdsngsbbbpl
16-19 f: fzwrdbblftrblfjfplw
6-7 p: ppppppg
5-7 l: mllllglllfllllvlxll
4-6 b: bbnlbbbbbbbbbbbbb
2-4 d: ldlb
7-8 h: khpmrbhh
3-5 l: llllllllllllllllllll
6-8 f: ffqffffx
4-8 n: vxmflsfn
1-6 k: zkktzfzkdkkzkk
9-11 j: jjjjjjjjjjkjjjjjjj
4-7 b: bbkvbbnbbp
1-13 v: fvvtmxvlvvxkvvs
1-4 h: hrhf
1-4 s: ksgs
3-6 z: zzzzzzzzzzz
13-16 j: djjjjjjjjjjjgjjrjj
13-16 j: jjjjjjjjjjjhljjjjj
4-6 k: hkhkkkvktpbkk
2-3 p: pkqp
2-13 j: jjjkjjjjjjjjdfjjj
9-13 z: wwwzpkcczbmzntkjlf
3-7 n: nntnnxgnnnnp
2-3 t: ttpt
1-7 h: qlthhgppdhfxhkhjhhd
10-11 z: zmzzzzzjtxzzzzz
3-6 p: ppppppp
3-7 k: kmzvfhkkhrkk
16-17 k: kpkkjkkklknkkkvkw
2-5 z: zbzdzz
1-9 z: zzzzzzzzzzzzzzzzzzz
7-10 t: ttttttnttrt
13-15 b: bbbbbbbbbbbbbbbb
2-3 h: hcnhlxh
3-5 h: lqdhh
4-5 p: twptp
1-4 x: xjxq
4-6 c: ccmcgpvrfkwxpcjvcq
5-6 h: chhhhcch
6-13 m: fmmgmhmmjmgnbmmf
5-8 j: ljzjljvjbjjjj
7-10 j: jjjjjjjjjfj
1-4 f: tffmkfnfw
7-8 n: fbhgkmnndrbq
1-14 m: mmmmmmmqmxmmmmm
2-3 v: vzvtpmp
5-10 q: qqqqqpqqfj
4-9 q: qqqqqhqqqqqb
8-11 b: bbbbbbbhbbbb
1-3 r: rrsrr
6-8 f: zktkmfnkffdffwfxj
3-9 c: pkckkkxjc
1-7 h: hhhhhhh
1-16 s: kssssssssssssssnss
8-16 j: gxhqtbnjcnrtjcdm
9-13 d: vxdspdnmkfdbwlzd
2-14 f: ffffffffvffffffffff
18-19 x: xxfkppxxlxxxxxxtxqx
5-9 t: txmtptttpqbtnjtts
12-14 r: rrcrrrrrrrrtrxr
9-10 d: ddddbdbddd
1-3 z: mwzrz
5-12 q: qqqqqqqqqqqlqqq
3-15 s: rphsmgngvmqtdhnlk
5-6 n: nnnnmtnt
4-5 z: gzxzc
1-6 r: rrcwrmcrx
4-5 n: dbfnrn
15-16 f: ffffffffgfkfffff
3-9 w: twwxvxspkwtj
17-18 l: lllllllllllllllllgl
1-3 q: mtwqqq
10-11 k: kkkkkkkkkkkkkkk
12-18 f: rfvkgfffkkxfdfhgfvb
4-8 q: cnnvqvvrllwmw
17-18 q: qxqqlqlqtqqqqqqrmq
8-9 s: sjssssszsjsss
4-5 w: cwwxw
5-6 q: qqqqqr
3-4 d: cddrng
6-10 c: bzcgscknzc
16-18 l: ttvsvtfkmbfcglslpljk
3-7 c: xlwtncn
5-14 q: cpkvqljhwqqxjqsngm
7-8 b: bbbgjbbcjbbt
11-14 m: mmmmmmmmmmmmmrm
3-4 v: kjgvv
14-16 w: vpwmfdkfkwlrnldbhmq
2-11 w: gkxjlmgwkpw
16-17 k: kkkxkkkktknkmkzkk
3-7 c: cfcpczsw
16-18 l: cllrclltlllllmlbldlq
7-13 q: brqtqqqbqnqbf
13-14 q: vqtqqqqqqqqqrrq
10-11 x: xxxxdxxxxxwxxqxxxxbx
6-8 p: ppnnpspcpwwdppfzk
5-6 s: sssqsr
2-16 j: jvbhqwqzrrhhxdhjm
2-13 x: prgsbszbcsvvxxs
9-11 h: bhwghbhhhvqql
16-18 q: xjmqwmrlvkpjxdtzbq
9-10 t: wtwtctrtpnf
11-12 j: jjfsjqjrjjjhp
13-14 x: jflkltqvqdzqxxh
3-4 p: xppp
6-8 d: mwpndflpfpk
7-12 h: pqfhhhhhnglgfl
5-6 b: lnrvhbfdbbdncbqrrbj
1-4 m: cdmfmmmmglgmmcmmzmmm
4-6 h: hhhhhj
3-5 s: pssssc
12-16 x: svqltrtdlgxnhcmx
7-11 j: jjjsjjjjjjjjjjjjjj
14-16 w: xwxdgzfwstfjwckw
11-14 b: cbhbgbjbvbbcbc
4-6 l: bpgllnxlj
4-5 x: xxrvx
11-12 d: dmdddcjdddzdk
1-16 l: fllllllllslllllllll
3-9 q: qqqqqqqsqqqqlqfq
14-15 d: hnmwvtprhxpdcgd
5-7 t: zccgcttxttft
3-6 d: ddvdddf
11-12 r: rrgxjjnsfprrgk
8-10 h: hhhhhhjchhfhshd
2-5 b: bbbbvbbb
18-19 m: msxttmbmqmmwdrgmmss
3-6 b: vbhxtw
7-8 r: tjrrmrrn
4-11 g: wgdgwtwllgg
4-5 j: jjjjkj
15-16 r: rrrrrrrrrqrrrrdr
15-16 q: qqqqqqqqqqqqqqqp
2-8 r: kzswfbvcm
4-8 b: bbbnbbbbbb
11-13 m: mmmmmmmmmmmmbmm
3-4 s: wnlss
11-13 q: rlzbslqcqnqchqmv
2-6 x: bxqwxzq
6-7 k: dkjgdjk
6-9 h: hhhqhhgrwp
5-6 n: pnnldn
3-4 z: zzzz
4-5 d: sdnqz
4-8 b: kkccxbfdxbljbn
1-6 v: vbvvvzvvvv
3-5 j: wwmwj
2-13 q: sqtvrbspzkflqj
2-3 z: xzhd
4-7 p: pcpmpwpg
4-6 f: fffgfwf
13-15 k: zkkkkrhmlnlckkcvkk
7-9 q: qqqqqqkqqqlqq
14-16 g: gggggwgsqggggkgzghg
4-10 v: vvvdvvvvvvv
18-19 c: ccbfkgnrcwxccwtlczc
1-8 j: jfjjjjjjqfjjljj
12-14 w: wtwhwxwqwnwmwq
4-5 l: ngwwzwxxrsbxmlnc
3-4 n: nnqn
4-13 d: kddfddddmtddd
4-5 m: mmmpjmmm
15-16 r: rrrrrrrrrrrrrrzrr
17-19 k: krkxkzkkskcmdkckwkkf
3-11 t: xgthvllfhjtb
1-6 p: fppppfpp
10-11 d: djdddlcdwlmd
11-12 h: hhhmhshhhchdhr
12-16 k: nwkvtkskkkwzkcbnkkc
16-19 m: mvmmmmmmmmmmqjmtmml
3-4 v: qvvwvvv
1-4 w: npwp
6-8 f: fffffffqfff
2-3 w: zwmwwwn
1-3 t: ttstr
1-4 d: dddmddd
2-3 m: mkmm
1-7 f: fffqffffffffffff
1-2 c: qcccccptcc
7-8 g: ggghkgggbg
13-15 b: dlbpbxdbrbbbbdcv
3-4 p: pppcpvpq
13-17 q: qqqqqqsqqqqqqqqqzqvq
1-7 q: qqqqqqqq
10-15 l: lmlsfkgpllldnlxgh
4-5 t: cbptdgtq
5-12 x: xxxxcxxxxxxxxxxxxx
10-12 c: ccchcfckcctcccd
4-16 h: cgqhppwhgqbqgthw
18-20 h: cqsdtbjlhzwlrvztnlth
1-10 v: vvvvvvqvzvvlvvvvvv
11-12 l: qzlxrgrpglsldwrx
2-4 t: ttttmt
16-17 z: zzztzzzzzzzlzzzzt
16-19 q: plqzzmhddkrwqtkqxmq
14-18 l: lklllllzdlllpllqlll
8-14 x: gxkcgwxxxxxkcx
3-6 n: nnnnnvn
1-4 p: cppp
2-3 s: xsdvnd
6-11 m: xghqpmmjmsm
1-9 j: jhnjjjtpx
15-17 z: pqrzgxlznjzzzmhcj
1-11 z: zzzzzzzzzztzzz
7-10 k: nkkkkhkkdgkcn
8-14 g: xdxglrzzbdjrmqpdqrzn
11-12 q: whfqqqsqfqqc
5-12 s: rfltwhrsnsksqmbv
8-9 s: sssssssstbssss
2-3 h: hfhhhhh
2-4 g: tjtg
13-15 z: gzzzxzzzzzzzzzlz
4-11 c: ccccbcccxccccccc
13-14 k: krxkkkjkwkkkpk
2-18 c: cccccccccccccccccccc
4-12 r: rrrrrrrrrrrmrr
7-8 s: sstsssfssbssssp
8-11 s: ssssssswssfs
1-4 j: jghnjdsgkwjqmmj
3-6 m: mmvmmm
10-17 f: sfffffjffffgfwpffv
2-4 p: pcvp
18-19 f: wcffffflnfffnffpklf
6-12 x: ctkckxgxghjq
1-8 h: fhhhhhhhhhh
14-17 l: llllllllfllgldllhll
3-4 z: zfmwpt
7-8 h: whhxhhhhhhh
6-11 j: shzqfjgwtwjmgwktjstw
7-10 n: cnngnzddmnpp
2-6 f: tffhffz
1-2 k: lkkzpq
4-11 d: vkfbjgsmdld
1-6 v: xlxvtvwvvvxv
11-14 d: ffddjdffcspxzk
3-13 z: tfqwwhwqjzdlz
13-17 p: hgpjfpqrtvspgfppsh
11-12 l: pbvlvkrlllxxfdll
12-14 f: flffpffffffcfxpfnfff
5-7 p: mvbpppk
10-11 s: sqbsxsrtscsxtssssgs
9-12 q: qqqqqqqqqqqf
6-7 t: mzwjtzt
14-15 v: xlvxsvctjgqwjvgm
5-6 t: tctttt
7-14 g: nfxgkvwzgcthpjvnl
1-4 g: gggg
11-14 t: blftntttcxhttxtwtl
2-7 k: jkklsjw
12-17 t: jmtjdtttttttfhtjnsp
14-18 b: qbtsbbtwplkklbjsfb
12-14 x: xxxxcjxgxxxxdhxxxx
4-5 s: ssssss
4-7 z: zzzzzzzz
8-13 w: swdwhlqwwwpsr
4-6 b: bdtbbd
12-15 h: hhfxkhhhhhhqhhhhhhh
14-15 n: nnnnnnnnnnnnnnjnnnnn
4-5 c: ccccpcccc
13-16 l: llllmljtddqpvwlhl
6-7 p: pppppfp
7-9 g: gwggghvvw
7-8 v: vfzdvvvvvvv
4-5 m: mxcvm
1-5 r: rrsmm
4-6 d: nddvddrkdxdnfld
6-7 q: qqqqqrt
9-15 r: rrrrrrrrrrrrrrrrr
8-9 g: zlgvbgnkg
4-5 c: ctgcc
1-12 s: cmsssssssssl
4-6 x: xxxxxxxx
2-4 t: tthpx
10-13 f: kfggfnfftjwcf
11-12 l: llllllllllrl
4-10 t: ttttttttft
2-3 x: xvnxj
4-17 j: jjjjnjtjjjxljznjjj
6-10 z: zzzzzzzzzlz
5-14 j: vdwjbtntgzcchjhfl
12-15 l: lllllhxlflpplllcl
5-7 s: fqsssmswsgqlsvsssvf
5-8 r: bhrhbqzrfr
2-5 x: lxxxxxbwxdmx
9-10 d: zdxjjdjdhdd
16-18 l: lqllrtllbllvlllblll
5-9 n: nnnnnnnnznnnnnn
4-5 g: ggghzg
6-14 m: ldmpkmtzslmdbljvsxtm
7-8 p: ppppprpmsp
8-13 p: qbkqpkpwmdgppnbp
1-3 r: rrrrrr
6-12 q: dqqqthphqhpqkqqmnmfl
5-8 l: llllzzll
9-10 m: ljmbmmmdjwdgmm
4-5 s: qxsls
17-18 k: nkfwsdvldkktdvsmkk
7-8 l: llllllvlsl
3-5 t: dlpctqfkwtbrvxfdxwr
13-15 r: rrrvrrrrgrrrrrm
4-16 l: llnlllllllllllllblll
7-9 w: kwwwwwgwv
7-8 z: hvzhphwm
2-3 g: qgghtgk
3-7 s: xsfqthm
12-16 b: bbbbbbbbbbbbbbbzbbbb
3-4 s: hbmzwncbvsgk
14-18 s: ssssssssssssssssssss
5-9 d: dtnbnxjlqh
5-8 x: xxxxpxxz
12-19 r: jwrrrrrrrrjrjrzgzrrm
15-16 r: rrrrrrrrrrwrrrplr
6-8 d: jddddlzj
3-15 v: kfvrbtsxlmsqvzgbdk
7-12 n: nfnnnmhnnnncnnnnnrnw
14-17 c: zswgzkxrfvcvtcvjcjmf
11-13 v: vvvvvvvvvvvvsv
9-11 n: tnlnqnnntnn
2-3 x: rxrlrfwm
7-9 c: cccccccctcccccccc
15-16 v: vvzvvwfvvvvvvvvrvvvv
2-4 r: rrrmrr
10-16 d: gldpwpdlxdhbtjhm
5-6 z: zqzzzqzz
3-4 n: nntnq
2-3 z: gzdzbs
6-20 j: gwjhxjjlzqdjmjvjcmjj
5-6 q: qqxqsq
6-7 g: gqgggpbkhjbg
7-8 t: ttttcttj
12-19 v: vvvvvvvvvvvnvvvvvvsv
2-5 k: xkkwf
3-7 g: ghqhtng
3-8 v: vvvvvvvthl
5-7 h: qjhxhrdwjz
7-10 g: kmkxqcgfgmxw
1-8 h: ghfhhhhhqhhhhh
4-11 g: gqggbtgzgqgzgt
6-7 t: tpxxtjt
9-12 q: qqqqqsqqqtqqqnj
3-7 m: znghsmmfczwvd
4-11 t: stgjwttqvtstlsfcsssz
9-10 f: fffffffffffff
14-15 l: mlwlvnlpcxldflt
1-6 g: gjgggwgg
1-3 g: gggg
2-4 s: jszs
3-5 n: nnmnnn
11-12 c: cccccjjcccdq
11-17 h: hhhhhhhhhhshhhhhhh
7-15 h: hpfdvhhhhnkhchb
7-10 g: gggggggggg
4-5 x: xjdxx
5-13 p: hptpppgpmqsxpxnj
3-4 b: bbbb
5-6 s: psssgmqtcxs
2-8 w: rwwtfxsh
4-5 v: wjjvvtbhz
10-12 j: qjjjjjjjjjrjjj
4-6 h: hxhhvgwhrz
9-12 x: xxxxxxjxxxzxxxxx
7-14 w: wpzbwwvrkgdwwwm
15-18 x: pbpnrpjkcmgxqtxxmxxx
15-16 q: pzzgjwwqpgvcwvqj
3-4 d: gdddpd
6-16 b: bjsrnqsjhbzjsbvbpbq
2-4 h: whsqxphkjwfq
18-19 x: xxxxxxxxxxxxxxxxxxx
3-4 n: nnnv
5-7 n: nnnnxnnth
2-7 k: gkkkpfn
13-14 m: pwmmxznzmdsznm
3-4 p: tzpg
6-7 h: hzhhhhchh
2-4 l: lllll
5-8 g: gggggggxgggg
1-4 q: qqqqq
5-9 j: wjqjnjjjjjjjjjjjjjj
5-10 g: gtgggkgggprxkzxgw
1-4 p: rppp
4-5 z: jzzzzzzzzz
4-5 j: pjhjk
3-10 j: ljpxdgdmlq
1-2 z: tzjzz
4-8 k: kkkpkkksk
8-16 h: hhhhhhhhhhhhhhhnh
5-8 n: nnxzhgtnnnvq
9-10 d: hhdlcrwcdlktjxrg
15-16 h: nhhlmfkhlhhhwthlhgqx
3-4 p: pppppp
7-8 h: mfkwxmhh
4-5 l: lllllb
1-4 s: ssls
6-10 c: qtwkdpfwcg
4-5 m: mvcmm
12-13 n: nnnnfnnnnnnnn
8-9 b: bbbbbbbcbpbbbsb
5-6 f: ffffttf
4-11 g: gggggtgggggqgg
4-8 h: bmhhrjnxhkbhdhqjwswh
12-14 x: xxxxxwxmxxxxwbxxxxp
2-7 r: crrrrrrrrrrrpr
7-9 m: zmmpzmmtg
4-13 l: llldlllllllllll
4-5 d: dddsdd
3-4 s: bsnb
3-4 h: chhh
5-10 t: gswkzvktjbbrltsbdlx
4-6 k: kkkrtkqk
2-4 m: cswpvtrzfvf
15-18 r: rrrrrrrrrrrrrrvrrjrr
1-6 l: lllmlt
19-20 w: nwnpwqsrvwwwwcwwldqw
8-10 k: mkkkkkvtkl
16-20 x: dgxxxxxxrxxnxxxhxxxx
1-5 s: ssprbsb
7-9 q: brqbqmqrb
7-12 w: wmqwcwwwjwvwwtm
10-14 n: nnnnnnnnnnnnnxn
4-12 t: tkjdhjnmhqrtdbn
2-7 w: fpllpbplqspwgqbz
1-9 b: btltdnbkbm
3-4 c: cccqcg
11-12 k: xkkkkknlkmtk
4-5 v: fvvhvjlwvwwwq
9-11 p: pppjppprqtp
8-9 b: bbmbhbtbbb
4-5 t: ttttt
12-13 d: ddzdddkkdddplcspl
4-5 r: zlxrpdpfr
6-9 d: vddgddthh
6-7 j: mdqqjjjmmj
4-5 p: ppppxd
10-14 x: xxxxnxxxxxxxlx
3-6 k: kkqkkbkkkkkkkkkkk
2-6 q: tgbqsx
4-7 z: zwnzzzfzfzz
1-7 g: cggggggg
2-3 x: xcxjmqr
3-6 p: pppppm
7-8 h: txhfcrhhwr
7-8 s: ssblssns
9-12 q: qqqbqqqqqqqjcq
16-19 z: zzzzzzzzzzzzzzzzzzzz
6-7 n: nnbgnhn
7-9 t: tthmbtttpw
2-6 z: zzzfzqz
4-8 r: pvplrnqfjbbsfc
1-3 v: wvvvv
3-10 s: btzqhmbbkszgvqsqjzf
9-13 g: xhjpmqkcgbmpgmgz
13-18 c: kwjrlmdvcwjwlsbbbf
9-11 d: ddfdhqddkdmmjx
7-11 l: dlllllblclp
10-11 x: xxwpktxscxxxxqz
1-12 k: kkkkkkkkkkkkkkkkk
4-5 h: hhhfhhhhh
4-10 l: lmlwkllrklll
7-8 d: ddddfdnd
10-19 d: ddpdddwddwvdbddddddl
5-6 g: bgsldggjk
4-5 b: bgbnb
2-5 x: xvxxxbxxtxx
4-6 g: pggkjg
3-8 j: jjkjjjjtjjjjjjjjjjj
5-10 d: jcwvxxdhvk
12-19 w: wwqwwwwbxcwvwwnwgdvw
1-2 v: dtfd
6-12 p: tpnshppqppgp
5-11 w: kjwzpfwhxhtv
7-8 h: mhhjkhhhv
3-4 t: lttqf
5-6 x: wkxxfj
4-7 j: qnjcjjs
6-10 x: kblfnxxzzx
4-5 w: twwwxtwwpw
4-8 p: pflpllppcwcq
1-13 w: wdnbjrhtmxwkb
10-11 x: xxxxxgxxxqcdx
10-17 x: lgxwbzxsxxvxbmvxk
3-4 r: rjkr
8-11 x: xxxxxxxcxxxxx
1-3 l: wlll
3-6 d: sjmwjdtr
6-10 b: bbbbbwbbws
16-19 j: jjjjjjcjljwjjjjnjjjj
4-10 q: qgxsjxzvgqzvqvx
4-15 p: lppjppppppppppppp
11-12 d: ddddddddbdtddd
4-5 h: rpqch
3-4 n: nnds
1-4 h: gjxh
14-20 s: cxscvksfqspjwvsnsnjk
8-13 p: ppfppppdppppxpppppp
3-7 w: wzwwwggwww
3-8 p: xfdzhzpz
5-7 j: jbjtwgjxj
6-10 b: bdpfbfvlbbdbczbfbbzp
1-8 w: jwlzdwnw
15-17 l: llllllllllllllvlkl
13-16 s: sssssssssssssssqss
8-9 m: bqvdbrrfmm
3-9 b: sbfbbjbbn
5-6 z: zzzzzzzz
18-19 d: dddddddddddddddddjd
16-17 n: rnspnwwtnnnnnnnnln
3-4 b: kmbw
10-14 d: ddddddddqdchdfddd
5-8 t: htttdstkm
1-6 g: gggggdg
4-6 h: qnjhhcb
6-7 t: tttttfttt
2-3 v: vpvvrvvv
5-10 d: dddddddddldd
15-17 p: dzpmmlcppwpbzwbxpj
2-3 r: rwlhr
7-8 j: jjjjsjgjjj
4-9 m: mmnlmlmmmv
7-9 r: vrrnrrrrrrrr
6-7 m: mmmmmmqmm
7-8 j: jnjjjszj
11-12 t: tttxttsttttt
7-8 t: dsjjwctn
6-16 z: zzzzzzzzzzzzwzzpzz
11-13 m: mmmmmmmmmmmmmmmmmm
4-7 z: kzpzzzzmwcqmmf
3-8 s: sbgcnjssbv
6-7 k: kkkkkknkk
2-11 w: wwlvtxglnfw
3-5 k: gvmlg
8-9 r: crrrrrrrvgrrfrr
1-4 b: rbfbbbbbbgffmbnb
4-6 t: rmwmjthbtlh
3-10 c: ccmcccxcdc
9-11 d: ldldddnddjd
12-17 s: smsfnssssssdssssms
3-6 m: qxmmmfdj
9-10 v: vvvcvvvtvvzvvvvvv
10-15 v: wdlmskhsvvqddxvgllj
1-9 k: kkkkkkkkkckk
9-14 h: hhxfsdnthnrhhxh
7-10 p: pwcppppljphkppzjp
7-8 n: snqcpwnnnnnplcc
9-11 h: hhgrhsrhhhz
1-4 v: zcvvvvsmzjjz
1-6 x: txxxxqx
4-13 j: jjjbjjjjjjjjpjj
1-5 c: ccwvfccjpckcckbc
2-4 t: btttbp
4-5 d: cwwfd
9-18 p: ppphppphfjspsbgpnp
4-12 r: ksvfpjgmrsvr
2-3 q: lhnq
1-5 c: czcxc
4-6 m: mmzmbzrq
4-7 m: mmmmmmbm
14-17 v: mvhvthfvvvvvvvvvvv
5-12 d: cdwwdnbvhddqhwxbnghz
8-16 z: mjzzzzzczzzzdzpz
5-10 j: jjjjjjjjjnj
15-16 q: qqqqqqqqqqqqqqlq
4-7 g: hglngrgpkzmw
4-17 c: xlscnhcbmccrxhsqc
6-8 l: slqljlglr
12-13 q: qqqqqqqqqqqdq
4-9 q: qrcnpnqmdrq
1-7 l: llllllt
5-6 c: ccccpc
1-2 c: clcc
4-13 g: ggglggggggggwgn
7-11 g: ggggxgbggggg
5-10 b: bbbbbqbbbbbb
9-12 d: ddddhdddddxddd
1-3 d: jchdvcsdfzkt
8-9 w: qqwvwpwwrswq
1-2 p: mrnwxjtndwkzbgc
3-6 h: hhcbhrhh
3-14 m: frmxqtgnxdtphp
3-8 l: llmllllll
6-7 b: bdjgcbb
3-11 x: mslfthzgqcscpctqcxd
2-11 n: ncntpnnlnnnqnnn
15-18 p: pppppppppdppgppppfhp
4-5 z: wrfzzz
6-7 h: tqgnhvhjhddzs
2-4 m: mmvgw
13-14 n: tpvfpwxlnqnbnvzk
13-14 s: stnsssssvsssmscssss
5-8 z: zzhkzdzdzz
4-7 x: bxjxzgxsgmrmlln
1-12 m: mmmmmmmmjbmbzmmbmmmm
7-15 m: mmjmmmgmmmmmmmmmmmmf
10-15 d: llrcldwnckfpwfv
9-12 g: mfggggggvnggg
2-10 p: grbctspghpj
16-18 g: qhhgjwwgwggskcgghntq
6-10 r: lrtdjrxqrrrnxrhc
4-8 f: fffmfffkfff
9-11 j: tbsxfwbwjjc
11-14 s: sssssssssxsspss
4-5 t: jthdjtttt
1-7 j: jkjlhjh
17-19 z: zzzvzzzzzzzzzzzzzzzg
8-18 n: tgglgtfnnthsxpqvfj
2-11 h: qhhlpkmbxqdrhhhkhrm
9-14 m: xvmjjxmwmmmkmq
14-15 c: cccccsccbccffjc
9-10 j: xjzxpxjjfj
8-10 x: pmfxfxxsxxq
7-14 t: ttttttsqttttwttt
4-16 d: dddwddddddddddddd
8-10 f: fkcbqlffgqzvdzfhrn
1-9 h: hhhhhhhhhhh
5-12 v: lvvvvvvvvvvjvvt
5-15 p: gqvpvpbxsgrgpvpjpvl
14-15 d: qbnbtdrwkswfbtbdrx
7-19 f: ffffffffffffffffffff
7-9 r: jjbrrsqcrqmpxr
4-5 h: mpthjh
12-13 v: vvrvvvpvqvvvv
11-17 c: ccccccccccccccccgc
3-4 t: brttb
5-9 r: rrrrxrrrrr
1-4 f: fwfsfft
15-16 z: znfzdqzzzhzwzgsr
2-3 v: vwfvvvvvvvvvvvvvvvvv
3-4 n: nnnzn
2-11 k: hgptsdsqxlmpjqmt
1-15 g: ggggcgggggggggtggggg
14-15 z: xzzqzwzzjwrzkzz
5-9 s: snsgscrssscs
4-5 l: slbtm
1-4 s: jmsjpss
6-9 h: hhzhhhhhhhhhhhh
3-12 b: xgbpbwqhzwzl
10-11 g: gsgjggkgggg
4-8 m: jrmlgmmm
2-4 q: gqqd
1-4 w: zqkwww
6-7 f: bctdsvvs
7-14 w: wwwwwwcwwwgwwk
9-15 w: fjwgwpwwwstnrwgs
4-9 v: qvvklvshvwvvrvvpvc
1-6 w: wwswlw
2-11 w: xmmqwjrvxglxnzmv
13-15 x: hnxnvxxrxzvnrvxmxxx
5-12 f: gfwtfxnmhfmjxlsllpx
5-15 f: gmsrffblxvppctrt
1-5 h: rhbhh
1-2 c: cckccccccc
12-13 c: cntcqmcltrcnc
6-8 f: bbrflcrffqfj
2-3 v: vvvkmzz
1-2 j: jjknrj
3-5 p: sppptqjp
3-4 t: gttt
1-3 h: hhzhjthh
6-7 k: kkldvkg
2-10 s: sssvsssssqswslljs
1-10 w: swwwwwwwwwwwwwww
10-17 j: jhjmbzjjjglbgndzhdm
8-9 l: lllllllgdl
7-10 g: wdsjsglvltf
3-5 g: ggvggg
6-10 j: jjnwrjnkjx
2-14 p: wkdwppdpsnzvppb
5-14 h: shjfjqhrwphgxhjqdm
16-17 t: ttwhttgtttttnjtrqjt
6-7 d: ldcdjdz
13-16 j: wxjtlcpjjhxsfjzjzjj
4-6 s: sqgpsx
3-6 z: ztjtzz
4-10 c: bjgcmlwfxc
1-13 c: hcccccccccccfc
4-7 b: grtbjrxfg
3-4 z: mzxx
9-10 t: tmgdbttltf
4-12 n: qnvmnmnnnnnngnnn
9-10 b: prllqxdsbbcw
3-6 t: ttmtttbt
7-8 c: kccpnccbc
3-8 s: sssssssgss
9-10 z: zzzzzzzzzzzzzzzz
11-14 g: ggggggggggggghg
4-7 m: vgjmmffhspmkn
3-4 n: nnlnn
4-5 t: ttttttt
5-6 h: xrczhbqqhvhgq
8-17 n: vntdgfcqbrnbdwngsnnq
3-4 f: gflfptww
9-16 k: kkfkkkkkckkkkkkkkk
15-17 r: rrrrrrrrrrrrrrwrrr
2-7 n: bnkpljdtdscpsczjlf
9-11 k: vksvzkkkkkszkwb
2-4 x: hxpxxsfr
8-19 c: mlwncdlckrpnnwfjshgf
7-10 j: jjjqjjljjjjj
2-3 n: nlxnnnf
2-4 k: kskkkkkk
5-6 r: dmsrrr
13-14 x: nwcxqzxpxxrxxx
4-6 b: bbbcbbb
3-6 l: wmpzrl
1-7 w: wcdwwwwwkwtw
3-8 w: dhwlrbrwbkzqhxfwpfxs
3-20 n: vnpzwmdbvrhdrlvqhmsn
1-4 z: zzzzjzzz
6-13 s: pfnzxdsssxpps
4-12 q: qhqtrkwmfgvn
4-10 t: mwgrtptprhtbzcfbvcc
12-17 n: nnnnnnknwgnnknfgn
2-3 k: jtnkk
9-10 f: ffffhffffffff
1-7 k: pkkkkkvpkkkkkk
5-7 n: nnnnnnnn
5-9 t: tcdttttttxj
9-10 x: xxxxxxfxwxxxx
12-17 s: pbsxshpbdssshfmxcbs
4-10 n: nfnpnnnnnp
1-7 d: vdddddbd
7-8 r: rrrrrrrq
10-12 v: vhvvvvvvvvzq
6-10 n: xcnnbpnwnx
4-5 f: ffflf
5-9 b: jxpbbcjgrbqfbbmbbbf
10-11 b: wchbzbbbbgbdb
4-7 s: ssrnsssss
5-12 p: vppgpdnkrptfv
8-19 j: jvjjjjjtjjjjjjjjjjjj
10-14 l: llllllllllklll
11-13 h: hqhvhhchbjprhzhl
1-10 h: sjfhhhhhhljrhhhh
8-9 w: wwwwwwwww
9-10 t: tgtttttrtt
5-11 x: lgqsgxxpzprx
3-4 n: qvngbnrvt
2-9 x: drqckjkxkbs
8-14 w: wjbswmpwwwhwwq
3-14 k: tktxjdzrzrdnlk
2-3 l: hmllslzlx
10-11 s: sssssssssmss
3-4 m: mmmnm
4-5 b: jbbbq
4-12 q: hqbwbbtqtqdvjjj
2-10 g: gdcddxlrkgmzw
1-13 z: zsgfzqpbbzjndvz
1-10 b: nbbbbbbbbqbdb
4-7 j: jmrbqsj
9-15 r: prrkbzsgjlrrtlrrsp
8-12 h: hhfhhkhhphfq
4-17 p: hvgrcjhzmsmmpznlphb
14-17 v: lvvvvvvvvvvvvvvvbvvp
9-13 r: bhwrptnrrcpzxtrhvd
5-7 b: trbqnthjrfwdg
12-14 j: jjjjjjjjjjjjbsjj
2-4 s: jswmwvtw
1-7 c: mccctnkcccccccm
7-8 m: zjmmmmgd
4-6 x: xhqxddbfrngbxfzb
6-9 x: xdtqxbdwx
10-14 r: qskrrvvzclrrvztrdkrh
4-13 c: wccwcccbccccrccc
11-14 l: wlqzllcljjtqglbhl
17-19 b: bbbbbbbbbbbbbbbbbbq
3-5 x: xxqxm
#!/bin/sh python3
import itertools
from typing import List
Input = List[str]
Solution = int
def read_data(filename: str) -> Input:
with open(filename, 'r') as f:
return list(f)
def solve_problem(numbers: Input) -> Solution:
trees = 0
x = 0
y = 0
while y < len(numbers):
trees += 1 if numbers[y][x] == "#" else 0
x = (x + 3) % len(numbers[0])
y += 1
return trees
def main():
data = read_data("input_3.txt")
print(solve_problem(data))
if __name__ == "__main__":
main()
.....##.#.....#........#....##.
....#...#...#.#.......#........
.....##.#......#.......#.......
...##.........#...#............
........#...#.......#.........#
..........#......#..#....#....#
..................#..#..#....##
.....##...#..#..#..#..#.##.....
..##.###....#.#.........#......
#.......#......#......#....##..
.....#..#.#.......#......#.....
............#............#.....
...#.#........#........#.#.##.#
.#..#...#.....#....##..........
##..........#...#...#..........
...........#...###...#.......##
.#..#............#........#....
##.#..#.....#.......#.#.#......
.##.....#....#.#.......#.##....
..##...........#.......#..##.#.
##...#.#........#..#...#...#..#
.#..#........#.#.......#..#...#
.##.##.##...#.#............##..
..#.#..###......#..#......#....
.#..#..#.##.#.##.#.#...........
...#....#..#.#.#.........#..#..
......#.#....##.##......#......
#....#.##.##....#..#...........
...#.#.#.#..#.#..#.#..#.##.....
#.....#######.###.##.#.#.#.....
..#.##.....##......#...#.......
..#....#..#...##.#..#..#..#..#.
.............#.##....#.........
.#....#.##.....#...............
.#............#....#...#.##....
.#.....#.##.###.......#..#.....
.#...#.........#.......#..#....
..#.#..#.##.......##...........
.....##..#..#..#..#.##..#.....#
..##............##...#..#......
...#..#....#..##.....##..#.#...
#.....##....#.#.#...#...#..##.#
#.#..#.........#.##.#...#.#.#..
.....#.#....##....#............
#.......#..#.....##..#...#...#.
.....#.#...#...#..#......#.....
..##....#.#.#.#.#..#...........
##..#...#.........#......#...#.
..#...#.#.#.#..#.#.##..##......
#............###.....###.......
..........#...#........###.....
.......##...#...#...#........#.
.#..#.##.#.....................
.#..##........##.##...#.......#
.......##......#.....#......#..
.##.#.....#......#......#......
#...##.#.#...#.#...............
........#..#...#.##.......#....
...................#...#...##..
...#...#.........#.....#..#.#..
.###..#........#..##.##..#.##..
#...#.....#.....#.....#..#..#..
###..#.....#.#.#.#......#....#.
#........#....##.#...##........
.#.#..##........##....##.#.#...
#...#....#.###.#.#.........#...
...#...##..###.......#.........
......#....#..##..#.....#.#....
........#...##...###......##...
..........##.#.......##........
...#....#......#...##.....#....
###.#.....#.#..#..#....#...#..#
.#.....#.#....#...............#
..#....#....####....###....#.#.
....##........#..#.##.#....#...
.......##...#...#..#....####...
#...##.#......##...#..#........
..##..#.##....#.......##.#.#...
..#.#...............#...#.#....
....#.....#.#.....#.##.......#.
...#.#..##.#.#..............##.
..#.....#...#.............#.##.
##..#.#...#........#..#.....##.
...........##...#.#.###...#....
...#.#.#..#..................#.
.#...##.............#...#......
..#..#...#.#.......#...#.....#.
..##.......#.#.................
.##..#........###.....#....#.##
......#..###.......#....##....#
....#.....#.................#..
........#...#...#..............
...#..#.###.......#..#.#.#.##..
..#...#.....#....#.........#...
...#.............#........###..
......#..............#......#..
#..#...........#...#..........#
...##...#.###..#...#.....#.#...
....#..##......#.......##......
....#....##.#...#.#..#....#...#
.#...........#..#....##...#..##
..#.#.................###.#...#
..#.#.#...##...........#.......
..........#..##...#.#..##....##
........#........#.##..#.#...#.
.....#...##.......##......#...#
....#...#..#..#.....#..........
.#..#......#..#..#..###.......#
.##..........#...#...#.#.....##
..#..........#.#.#...###.......
....#................#...##....
.##..#....#..........#.#.#.....
..##...#.#........#.....#.##...
....####.....#..#.........##..#
......#.........#...#..........
....#...................#..##..
.##....#.#.........#....#...#..
....##...##.....#..####........
..##.#....#.#.......##...#.....
#...#.#.#...#..#..##.....#.....
#..................###.....#...
#.#.....#.......#.#...###.#....
.#..#....#............#........
#.#....#..#.#...............#..
..#..#..#.............#......#.
..#.......##...................
.#....#.........#....#.#.#..#..
....#....#..#...............#..
......#..#..##......#.........#
..#.##........##......#..#..#.#
#.....#.#....#.........##...#..
###..............#....###...##.
....#..##......#.......##......
......#...#.##......##....#..#.
..........#....#..##.......#..#
.#..#...##..#...........#..#..#
.....#....#...#..###...###....#
.#####..#...#.#.#..#.#.###...##
..##............##.#...#.##...#
.##..#...#...#....##.#..#..##..
.#....#...#............##..#...
.#.#......#....#....#..##..##..
.........#...#.......#.##..#...
#.........#.....##.....#..#..#.
...##.#...#...#..#..#....##..##
.#............#...#....##......
..#...#.##.........#.#......#.#
....#.##........#.........#..##
#.........#......#.#......#..#.
........#.#.......#.#........#.
..#..........##.#...#..#.#.....
..#...#....#...#...#..#.#..#.#.
.#.........#....#..#####..#....
#.#....#.#.###...#.............
..##...........##......##......
#.....#..#....#...............#
...#.#..#....##......#...##....
...#........#.....#...#..#.....
.#......##.........#......#....
..#..###.##...#.#.....#........
.............#......#..#.......
..#...............#.#...#..#..#
.......#..#...#.#####......#..#
.........#.....#...............
##........#............#.#.....
.#...#.....#..#..#...#....#...#
..#....#....##......##.....#.#.
#...##..##......#...#....#.....
....#.#.#.....###....##.##....#
..........##...##.......#......
..#.......#...##.#....##.##....
....#........................#.
...#...#.#.##...#.....#...#..#.
.#....##..#..#..........##..##.
.#.....#..#...#.##.....#.......
.#.##...#.#..#.....##....#...#.
.##...#........##....#..#......
.....#........#..........#.#..#
....#..##.......#..#.....#.....
...........#...#........#.##..#
.....#..#....#..#.#.....#....##
.....#....#.##.#..##...........
...##.......##.........#.......
...............##..#....#.#....
.......###..#........#..####.##
.......#.##...#.#....#.####....
....#...............#..........
##.#.......#.....#......#...#..
......##.....#....#.....#..#..#
.....#...##.............#......
#.#.##.#.....#..#........#.....
......##....#..#........#......
............#........#..#.#....
##.......#......#...####..#.##.
..##..#...#.............#.##...
.....#..##......#.##......###..
............#........#........#
#.#.#.#...#.#.....#.........#..
.........#...............#.....
.............###.#.......#....#
###.##..#..#..........#....#...
#......#...#..#..#.....#.##....
............#....#....#..#.....
..#.#....#...#......#.#..#..##.
...#........................#..
#.#...#..........#......#.#....
.........#................#...#
##.....#....#........##.......#
#...##........#...#...........#
...#...#..........##.......#.#.
..#.#.#....#......##...........
...#.#...#.##.#..#.#.##........
#....##.....###..#.......#.....
###.....#.#.#...#..#.........##
..#......#..###...#.#.#.....#.#
.#....#.....#............#..##.
....#....##..........#.....##..
#...........#....#...#..#...##.
..#.......#.....#..........#...
.#..#................#......#..
..#......#.#...#..#.#....#....#
...#..#...###..#..##....#.#....
..#..............#.....#.......
...#.#...#.........#.#.........
##......##...........##.#.##..#
..#..##..#....#.#......#.#...##
...#.###....###...#.....#......
#.#................#......#....
..#.....#.....#....##.......#..
.#.#...............##..#.......
...#....#.......#.#.....##..#..
.........#....#.......#.#...##.
#....#......##.#.........##...#
#.............#..##.#.#..##....
...#....#..#...#....#.#.#.#...#
.#....#....#..##.....#.#...###.
##............#.#...##.#..#.#..
##.#....##.....#..#..###....#..
##....#................##......
...##..#...#..###....#.....##..
.#...##......#..#.#.....#...#..
..##......##...#.##.......#....
......#.....#.....##........#.#
##....#...........#............
#.......#....#..#.##..##.#..#..
.#....##.#.....#..#..#.........
.#....#.#.#...#.....##.....#.#.
.......##.#.#........#......##.
##........#.##.......#...#..#..
...###..##....#.#....#.#.......
......#.......#...##.....#...#.
..#......##.#......#.....#.....
.....#.....###...#.............
#...#.#...#...#..#......#......
#.....#.......###.#....###.#...
...#.......#....####....##..#..
#.#.....#....#........#.......#
.........#.......#......#.#...#
..##....#.....##...............
..........#..#.#..#......#.....
..................##...##.#....
........#.......#...#..#.#.#...
.....#.#..##..#..#.#..#.......#
.....#........#..#..#....#....#
##............#..#..#...#....#.
.....#....................##..#
........##.#....###............
##.......#.##................#.
.....###.#..#..#...#....###.##.
.#......#.#....#.....##.#......
...##......##.........#...#....
....####..............#........
#...#.#..##..##.........##.....
......#......#....#..#.........
#.....#.....#.##...............
..#.##..#...##.#.####..#....###
#..#......#....#.##..##...#.#..
#....#.......#.....#.....#.#...
##.......#.....##...#.....#....
...#...##..........#..##..##..#
.###..#..##...#....#...#..#....
......##..###.......###...#....
....#...#.#.......#.##...##..##
#.#......#..##.#.#..#..#..#....
......#........#.......#.......
..........#.#.....##...........
......#..#........#..#.#..###..
##..#.............##..#........
.........#....#.....#.........#
.....#..##...#..#..##.##......#
###..#...........#.......#....#
...............#....#.#........
.##.#...#.#........##....#.....
.##.###...##..###....#...#...#.
.##..#....#.#.#...#.#.#.#...#..
.###.#...#.......#....#..#.....
..#..#.#.#.#........#.....##...
.#.......#.#...#.#...........##
...#.....##....#.....##...#....
................#.....####...#.
.#.#......#.......##...#.##....
.###.........#.#......#..#.#...
#......#...#....#..##.......#..
.##..#....#..#...........#...#.
.#...#.......##........#.##....
..#...........#...##...........
.....##....##......#....#..#...
#......#.#...#.##.#...##....#..
#....................#...##...#
..#............#........#......
.............#.........##.....#
...#...#......##.#...#...#.#...
..#...#.#.................#....
....##...#....#...###.##......#
...#....#...#..#...#....#.....#
...##.#........#..#.........#..
..##.....#..##...#.....##...#..
#.........#.#.#...#......#...#.
#.#...........#...#..#..#..##..
..#..#..##....#..........#.###.
.....#..#....#.#...#...#..#..#.
###.....#..#.................#.
.#..##.##.#......#....##..#....