bored, doing past years
This commit is contained in:
parent
9ba38eac9e
commit
a000932c92
4 changed files with 1302 additions and 0 deletions
20
2018/01/01.exs
Normal file
20
2018/01/01.exs
Normal file
|
@ -0,0 +1,20 @@
|
|||
list = File.read!("input.txt")
|
||||
|> String.split("\n")
|
||||
|> Enum.map(&String.to_integer/1)
|
||||
|
||||
ans1 = list
|
||||
|> Enum.sum()
|
||||
IO.puts(ans1)
|
||||
|
||||
reducer = fn i, {current, seen} -> frequency = current + i
|
||||
if MapSet.member?(seen, frequency) do
|
||||
{:halt, frequency}
|
||||
else
|
||||
{:cont, {frequency, MapSet.put(seen, frequency)}}
|
||||
end
|
||||
end
|
||||
|
||||
ans2 = list
|
||||
|> Stream.cycle()
|
||||
|> Enum.reduce_while({0, MapSet.new([0])}, reducer)
|
||||
IO.puts(ans2)
|
1014
2018/01/input.txt
Normal file
1014
2018/01/input.txt
Normal file
File diff suppressed because it is too large
Load diff
18
2018/02/02.py
Normal file
18
2018/02/02.py
Normal file
|
@ -0,0 +1,18 @@
|
|||
def read_file():
|
||||
with open("input.txt","r") as f:
|
||||
return f.read().split('\n')
|
||||
|
||||
def part1(boxes):
|
||||
from collections import Counter as C
|
||||
counts = [C(box) for box in boxes]
|
||||
hasTwo = len([1 for count in counts if 2 in count.values()])
|
||||
hasThree = len([1 for count in counts if 3 in count.values()])
|
||||
return hasTwo * hasThree
|
||||
|
||||
def main():
|
||||
boxes = read_file()
|
||||
print(f'Part 1: {part1(boxes)}')
|
||||
# print(f'Part 2: {part2(boxes)}')
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
250
2018/02/input.txt
Normal file
250
2018/02/input.txt
Normal file
|
@ -0,0 +1,250 @@
|
|||
uqyoeiznvmzrstpkgnsacjxwld
|
||||
uqloeizfvmbrstpkgndacjxwyd
|
||||
dqgoeizfbmbrstpkgnhacjxwld
|
||||
uqyjeizfvmbrstpygntacjxwld
|
||||
uqyoeizfhmbrstppbnhacjxwld
|
||||
uqyoeizfvmbrstpkschanjxwld
|
||||
uqyoeizfvtbrstpkgnmazjxwld
|
||||
uqyoeizfvmyrstpzgnhacjxsld
|
||||
udtoeizfvmbrttpkgnhacjxwld
|
||||
uqyneizfvmbratpognhacjxwld
|
||||
uqyoeizfvmbrstpkunhaajxnld
|
||||
uqyteizfvmbrstpkgnhzcnxwld
|
||||
hqyteuzfvmbrstpkgnhacjxwld
|
||||
uqyoeizyvmbrsdpkgnhacdxwld
|
||||
uqyoeizfibbrsepkgnhacjxwld
|
||||
uqxoeizfvmbrstpkgnhaxjjwld
|
||||
iqaoeizfvmbrstpkrnhacjxwld
|
||||
uqyoeizpvvbrstpkghhacjxwld
|
||||
aqyoeizfvmbrstpbgnhfcjxwld
|
||||
uqyonfzfvmbrstpkgnhacjgwld
|
||||
uqyoeizovmhrstpkgnhacjxwvd
|
||||
uqyoegzfvmbrstpkgnfacjxrld
|
||||
uqyoeizfvmbrstpjgnwacjxwdd
|
||||
uqyogiifumbrstpkgnhacjxwld
|
||||
uqyorizfvmbrstpkgnhaezxwld
|
||||
uqyoexdfvmbretpkgnhacjxwld
|
||||
uqyoeizfvmbrstpkgwhlcjxzld
|
||||
uqyoeibfvmbrstpggnhzcjxwld
|
||||
udyoeizfvmbrstppwnhacjxwld
|
||||
ufyoeizfvmhrstpkgnfacjxwld
|
||||
aqyoeftfvmbrstpkgnhacjxwld
|
||||
uhyoeivfvmbrstpkgnhadjxwld
|
||||
uqyoeizfvmbrstpkgmhacjxhud
|
||||
uqyfeizfvmbrstpkgnhkljxwld
|
||||
uqyoeibfvmbrstpkgbhazjxwld
|
||||
uqyceizfvnbrslpkgnhacjxwld
|
||||
uqyoeizfvmirstpkonhacaxwld
|
||||
fqyooizfvmbrstpkgnhacjxwlq
|
||||
uqydeizfvmbgstpugnhacjxwld
|
||||
uqyoiizfvmbrstpkgnhacjalld
|
||||
uqyivizfvmbrstpkgnhocjxwld
|
||||
uqyoeizfvmbrstpngnhjcjxwtd
|
||||
uqyoeizfvmbrstpkynhrcexwld
|
||||
ugmfeizfvmbrstpkgnhacjxwld
|
||||
uqyoeizrvmbrstpkwnhycjxwld
|
||||
uqyoeiyfvmbrstpkgnlacjxwwd
|
||||
unyoeizfvmbrstrkgnhadjxwld
|
||||
uqyoeizhvmbrstpkgnhacjawlz
|
||||
uqyoeazfvmbrstpwgnhacjxwlp
|
||||
uqyoeiznvmbastpkgnhaccxwld
|
||||
kqyoeisfvmbrstikgnhacjxwld
|
||||
uqyoeizfvlxrstpmgnhacjxwld
|
||||
uqyoeiofvmbrstpkgniacjxwll
|
||||
uqyoeizfvmbrswpegnhacixwld
|
||||
uqyoeizfvmarstlkgnhanjxwld
|
||||
uuyoeizfvmbrstykgnhacjxwbd
|
||||
uqyoeizfvmbpstxkgnhacjxwlu
|
||||
uqyoqizfvmbrsspkgnhacjpwld
|
||||
uqyoeizfvmzrstnkgnhacjgwld
|
||||
uqyoeizfvmbrstrcgnhacjxwud
|
||||
uqyoeizfvmbrstpkgnuacxxwsd
|
||||
cqyoeizfvmbrscpkgnhacjxwpd
|
||||
sqyoeizfaobrstpkgnhacjxwld
|
||||
uqyoeizfvmbrgtpkgnhacjxbwd
|
||||
uqyoeibhvmbrstpkgnhagjxwld
|
||||
uqyoeizfvcbrstpkgzhactxwld
|
||||
uqkoeizfvmbrstijgnhacjxwld
|
||||
uqroelzfvmbrstpkgmhacjxwld
|
||||
uqyoeizfvmbrsfpcgnhkcjxwld
|
||||
uqyoeizfumgrstpygnhacjxwld
|
||||
uqyozibfvmbrstpkgnhacjwwld
|
||||
uqyoeigfvmbrstpkgjharjxwld
|
||||
uqpoeizfvmbrstpkgnhacjxrcd
|
||||
uqyoeizfvmbrskokgnhqcjxwld
|
||||
uqyoeikfvmbrstpkgehacjxwle
|
||||
uqygeizfvhbrstpkgnqacjxwld
|
||||
lqyoeizfvmbrsvpkgnhacjuwld
|
||||
uqyjeizfvmbectpkgnhacjxwld
|
||||
unyoeizfvmbrstpkgnhzckxwld
|
||||
uqyoeizfvmbrstpkgmoacjxwlm
|
||||
uqfoeizfvmbrutpkgnhacjrwld
|
||||
uqyohizflnbrstpkgnhacjxwld
|
||||
uquoeizfembrstpkgniacjxwld
|
||||
uqyoeizfvmbrytpkgnhbcjkwld
|
||||
pqyoeizfvsbwstpkgnhacjxwld
|
||||
uqyoerzfvmbrstpkxntacjxwld
|
||||
uqyoeizfvmbritpkgnhacjqhld
|
||||
uqyoeisfvmbrstpkglhscjxwld
|
||||
hqyoeizfvmwrstpwgnhacjxwld
|
||||
uqyoeyzrvmbrstpkgnhacjxdld
|
||||
pqyoeozfombrstpkgnhacjxwld
|
||||
uwyosizfvmbrstpkgnhacjrwld
|
||||
uqyoegzfvmbrstekbnhacjxwld
|
||||
uqyoeinfvmirstpkgdhacjxwld
|
||||
uqyoeizfvmbistpkgnobcjtwld
|
||||
uqyoeikfvmbrsepkgnhycjxwld
|
||||
qqyoeiafvmbrstpkgnhacjxold
|
||||
uqbooizfvmbrstpkgnhacjxwdd
|
||||
uquoeizfvmbrswpkgnhatjxwld
|
||||
tqyoejzfvmbrstpkgnhacjxwlv
|
||||
yqyoeizfvmbrsttkgnhakjxwld
|
||||
usyoeizfvmbfstpkgnhkcjxwld
|
||||
gqyocizfvmbrstpkgnhacjbwld
|
||||
mqyoeizfvmbrstpkgnhacjzzld
|
||||
uqyoeczfvmbrotpkgnhacjxwsd
|
||||
jqyoeizfvmkrstpkgnhacaxwld
|
||||
uqyoeirfvmblstpkgnhaijxwld
|
||||
uqpoeirfvmbrstpkgbhacjxwld
|
||||
uqyoiizcvmbrsipkgnhacjxwld
|
||||
uqyoeizfvmbrstekgnhayjywld
|
||||
uqyoeizpvmnrstpkgnhacjxwcd
|
||||
eqyoaizfvmbrstpkgnhacjzwld
|
||||
uqyubizfvmbrltpkgnhacjxwld
|
||||
kqmoeizfvmbrstbkgnhacjxwld
|
||||
uqyoeizfvmkrstpvgnhahjxwld
|
||||
uqyoeizfrmbrsjpkgchacjxwld
|
||||
uqyoeizfvmbrstfkgnhacbxwlx
|
||||
uqyoeizfvmbrstpkbngayjxwld
|
||||
uqyorizfvmbrstpkgghacjxwle
|
||||
oqyoeizfvpkrstpkgnhacjxwld
|
||||
uqyoexzfvmbrscpkgnhacjxwlq
|
||||
uqkoyilfvmbrstpkgnhacjxwld
|
||||
uqyotizfamnrstpkgnhacjxwld
|
||||
uqnoeizfvmbrstpkgnhacdfwld
|
||||
uqyoeizffmbrstqkgnhacuxwld
|
||||
uqyoeizfvmbrzhpkgnhqcjxwld
|
||||
uqyzeizfvmbrsnpkgnracjxwld
|
||||
jhyoeizfvhbrstpkgnhacjxwld
|
||||
uqyohizfvmbrstpkgnqhcjxwld
|
||||
uqyleizfgmbrstlkgnhacjxwld
|
||||
ucyoeizzvmbrstgkgnhacjxwld
|
||||
uqyoeizqvmbrstbkgahacjxwld
|
||||
uqyseizpvkbrstpkgnhacjxwld
|
||||
uqyobizfvmirstpkgnhachxwld
|
||||
uqyoiizfvmbrstpkgnhacwxzld
|
||||
uqyoeizfvmbrstpkgnhafoxsld
|
||||
pqyoeizfvmbrstpkgnhaijxwle
|
||||
uqyoeizfvubrstpkgneacjxcld
|
||||
uqyoeigfumbrstpknnhacjxwld
|
||||
uqyoeiffvmbrstwkgnhacjxxld
|
||||
uqooeizfvmbrstpkgnhacjxilv
|
||||
uqyoeizfvmbrstpkgnhaljirld
|
||||
uqyoeizfvmbistpkgnoacjtwld
|
||||
uqyogizfvmlustpkgnhacjxwld
|
||||
uqyoeizfvmufjtpkgnhacjxwld
|
||||
uqyoeixfvmbrstpugwhacjxwld
|
||||
uqyoeizfrzbrsjpkgnhacjxwld
|
||||
uqyoeizfvmbbsqpkgzhacjxwld
|
||||
uqyoeizovqfrstpkgnhacjxwld
|
||||
uqyieizfvmbrsjpkgnhacjxwzd
|
||||
uqdoeizfvmbrstnkgnqacjxwld
|
||||
usyoohzfvmbrstpkgnhacjxwld
|
||||
uqyoeicfvmbrstpkgnhacgxwtd
|
||||
uqyoeizfvmbrstpkgkhbcjxold
|
||||
fwyoeizfvmbrstpkgnhkcjxwld
|
||||
oqyoeizfvmbrstpkenhacjjwld
|
||||
uqyoeizfvmbrttpkgjhacjhwld
|
||||
uqyoeituvmbrstpkgohacjxwld
|
||||
uqyoeizfvekrslpkgnhacjxwld
|
||||
upyoeizfvmbrstpkgnhjcjxwlb
|
||||
uqyoeiwfvmbrstpkgshacjmwld
|
||||
uqyceizfvmbrstpkgnpazjxwld
|
||||
aqyoeizfvmbrstpkgntacjxwed
|
||||
uqyosizfvmbrsapkgphacjxwld
|
||||
uqyoeizfvmbysipkgnhacjxwls
|
||||
uqyoeicfvmbgstpkgnhacjxwjd
|
||||
uqyoxizfvmbrsggkgnhacjxwld
|
||||
uqyoeizfvbbrhtplgnhacjxwld
|
||||
usyoeizfvmbrstvkgnhacjxwlo
|
||||
uqyleizfvmbrstpkgnhacjxwac
|
||||
uqyoeisfvmbrstpfgnhacjxwdd
|
||||
uqyoeizwvmbvstpkgnhacjxhld
|
||||
uqyoeczfvmbrstpkgnhecjxwlv
|
||||
uqyoeizfvmbrstpkgnhacjueid
|
||||
uqyoeisfvmbrstpkgnhaxjxwzd
|
||||
uqyoeizfvmbrstpkgnhicjmyld
|
||||
ugygeizfvmbrmtpkgnhacjxwld
|
||||
uoyoeiftvmbrstpkgnhacjxwld
|
||||
uqyoeinfvmbrstpkenhacjxwbd
|
||||
xqyoeiofvmbrstpkgnhacjxwlt
|
||||
uqyoeizfvnbrsipkgnhfcjxwld
|
||||
uqyteizfvmbrstpngmhacjxwld
|
||||
uqyoeijfvmbrstpdgnhacjcwld
|
||||
uqyoeizfjmbrstpkgntaclxwld
|
||||
uqyaeizfvmbrstpkgnhajjxwkd
|
||||
uqyoeizfvmbraqpkgnhacjxwlv
|
||||
uqyocizfvmbrstpkqnhrcjxwld
|
||||
uqyoqizfvmbrdtpkenhacjxwld
|
||||
uqyoeicfvwbrstpkknhacjxwld
|
||||
uqyoeizfvmbrstpktnhacjxxlz
|
||||
uqyoeizfvmbhstpkgnhacjmwgd
|
||||
uqyoeizfvmorskpkgnhncjxwld
|
||||
nqyxeezfvmbrstpkgnhacjxwld
|
||||
uqyoeitfvmbrstpksnhicjxwld
|
||||
uqyoeizfmmwrstpkgnhacjxwud
|
||||
uqyoeizfvmmrstpkgnhvcjxwlk
|
||||
uqyoeizfvmbrstpkgihacjxblz
|
||||
uqnoeizfvmwrstpkgnhaujxwld
|
||||
uqyoeizfvlbrsrpkgnhacjxwpd
|
||||
uqyoeizfvmbwstpkgnhvcjxwdd
|
||||
uqyoeixfvlbrstpkgxhacjxwld
|
||||
uqyoeizfvmbjstpmgnhacjxmld
|
||||
uqyoeizyvhbrstpkgnhacjxwzd
|
||||
uqyhepzfvmbrstpkghhacjxwld
|
||||
uqyoetzfvmbrstpkghsacjxwld
|
||||
uqyoeizfvmbrbnpkgnuacjxwld
|
||||
uqyokizfvmbrstpkgnhacqiwld
|
||||
uqyoeizfvmbrstpkgqhacagwld
|
||||
uqyoeizfvnbvstckgnhacjxwld
|
||||
uqyoeizfbmbhstpkjnhacjxwld
|
||||
uqyoeixfvmbrstpkgnegcjxwld
|
||||
uqyoeizfvmbrstpkshlacjxwld
|
||||
uqyoeisfhmbrsnpkgnhacjxwld
|
||||
uqyoekzfvmbrstpkgnhadjxsld
|
||||
uqyoeizfzmyrstckgnhacjxwld
|
||||
uqyoeizpvmbrztpkenhacjxwld
|
||||
uqyopizffmbrstpkgnhacjxuld
|
||||
uqyoeizfvzhrstpkgnhscjxwld
|
||||
uqyoeizfvlbrstskvnhacjxwld
|
||||
uqyohizfvmbrstekgnhacaxwld
|
||||
uqlodizfvmbastpkgnhacjxwld
|
||||
uqyoeizfvubrstpbgnhacjvwld
|
||||
uqnoupzfvmbrstpkgnhacjxwld
|
||||
tqzoeizfvmbrsdpkgnhacjxwld
|
||||
pqyobizfvmbrstphgnhacjxwld
|
||||
uqyweizfvkbrstpkguhacjxwld
|
||||
uqyoexzfvmbrstzktnhacjxwld
|
||||
cqyoeizfvmbrstpkgnhacvxfld
|
||||
uqyoeiefvmbrytpmgnhacjxwld
|
||||
uqyoeizfvmbhstpkgnhmcjpwld
|
||||
uqyoeizfvnbrstpkgnhaczrwld
|
||||
uqyoeibfvnbrstpkgnhacjxvld
|
||||
uqyoeizfvebrsypygnhacjxwld
|
||||
uqyoeikfnmbrstukgnhacjxwld
|
||||
uqyoeizfvmbrsfpkgnhfcdxwld
|
||||
uqyoeizfvmmrstpnbnhacjxwld
|
||||
uqyoeizfvmbrztpegnhacjxwrd
|
||||
pqyoeizfvmbrqtukgnhacjxwld
|
||||
uqyoeizfvmbbstpkgahacjxpld
|
||||
uqsoeizfvmbpstpkgnhatjxwld
|
||||
uqyodizfvmbrsfpkgnhgcjxwld
|
||||
uuyoeizfvmbnstpkgnhacjxbld
|
||||
gqyoeizfvmbrstpkgnhacjqwcd
|
||||
uqyoeizfvmyrotkkgnhacjxwld
|
||||
uqyoeizfvmabstpkgnhacjawld
|
||||
uqyoeizfvmbrstpkglhaszxwld
|
||||
ukyoeizfvmbrstpkgnhacjxtfd
|
||||
uqeoeizfvmbrstpkgnhtnjxwld
|
||||
uqyouizfvmnrstpkgxhacjxwld
|
||||
ugyoeizfvmbrsupygnhacjxwld
|
Loading…
Reference in a new issue