day 10
This commit is contained in:
parent
dfdf652c0c
commit
17d32009b8
|
@ -0,0 +1,98 @@
|
|||
{{[<[{({<[{(<[<>{}]({}[])>)({<()<>>(<>[])}[[()<>]{<>[]}])}[{{({}<>)[(){}]}{{<>[]}(<><>)}}<{[<>{}]{[]<>}}>]]>[
|
||||
{{<((<<<[{(([[<>[]]]<(()<>){[]{}}>])}]([{[<<[]()>[()[]]>{(()[]){<><>}}][{(<>())([]{})}{{<>{}}[{}[
|
||||
{{[<{{<[[<[<<([]())>>[<<(){}>{<><>}><{<><>}<[]<>>>]]]{<([<<>[]>[[]<>]]{{()[]}})<{{[][]}(()<>)}((
|
||||
{((<<[{{{{<{[(<>)]<[<>{}](<>{})>}>{(<[[]<>]([][])>[<<>()>([]<>)])<<[{}<>](<>[])><<[]<>>{{}<>}>>}}{(
|
||||
{{{[{([[<<{{(<[]<>><[]>){[<>()][[]{}]}}{({[][]}(<>[]))}}{(((()())(<>{}))({<>()}(<><>)))([{()[]}[()[]]][{
|
||||
{[<[{((((<([<<<>[]>>(<[]{}>]]([(<>())<()<>>]))>((<{<<><>><{}<>>}[{{}{}}{{}[]}]>(<{[]()}>[{<>()}(<
|
||||
[(({({{<{[[([[()()]]{{()<>}[{}{}]}><(([]{}){[]{}}){(()<>)[()[]]}>]<<({[]()}{()()})({[]()}{<><
|
||||
{<<<<({{([[{[[()<>]{[]()}]([(){}]({}()))}{{<{}<>>}{[{}()]<(){})}}]{[{[()()]<[][]>}]}]([({<{}>(<>())})
|
||||
({(((([{{[[[{(<><>)({}<>)}]{{{[][]}{{}()}}{{<><>}(()<>)}}]][{[{{[]<>}([]()))]}[<({[]<>}<(){}>){<<><>>({}{}
|
||||
<[[{[<{<{[{[({{}()}[{}<>])[([]())[<><>]]]<{{{}<>}[[]{}]}>}[{[{<>{}}([]{})]}])}>[{<[(({<>{}}([]()))(<{}<>><{}(
|
||||
({[({{([(<[{(([]()))<{<>()}[()<>]>}](({{()()}[<>()]}<<<>[]>[<><>]>))>{(({<[][]>}<{[][]}[()[]]>)<[<
|
||||
{{<(<[<{{<[{[(()[])([]())}<[<>()]<<>>>}{[[()[]]{()[]}][{{}}{{}()}]}]{<<({}<>)[{}{}]>(<{}[]>{()[]})>{(
|
||||
<{<<<({[({[{{<<>()>{[]{}}}}{<<()<>>[[][]]>[<{}<>>[{}{}]]}}}{({{{()[]}[{}]}<((){}){()<>}>}<<[()<>]>[{[][]
|
||||
<<[[<{<{(<[[(({}[])[()[]]){<[]()>}]<(<<>[]>(<>[]))[[[]()]<[]()>]}]{[[{<>[]}[{}]][<[]{}>({}<>
|
||||
((({[{{{<[([({<>[]}[()()]}[[{}[]]([]<>)]]<(((){})(<><>))([()[]](<>()))>)]<(<([[]()]({}<>))[({}[])]>)<[<<()[
|
||||
<<[{({[[([{{<<<>{}><[]()>><([][])[()[]]>}<([()[]]([]{})){(()){[][]}}}}]<{<<[<><>]<(){}>>(([]<>)<{}{}>)><
|
||||
(<[([<<((<<[({[]{}}([]{}))({[]()}<()>)]{{<()<>><(){}>}{([]{})}}>[(((()()){()}){({}<>)[()()]}){{(())<<>[]>}}
|
||||
[<{{[(<[(<[[({<>{}}<<>[]>){[<><>]{<><>}}]<<[<><>]({}())>[{{}[]}[[]{}]]>]{{{{<>()}}{<{}[]){[]{}}}}<
|
||||
(<(<(({(<<(<[{{}{}}[[]<>]]>{[<()[]>(()<>)]({[]<>}}})>>)})[[<[[{[[<[][]>{()[]}]]}[[{<{}>{[][]}}]<{
|
||||
(<{{{<[<<{{[[[{}<>]<[]>]](<[[]{}]((){})>((()[])))}<([{()<>}{<>{}})[[[]{}]{<>()}])>}>{<<[({{}{}}([]()))<([]
|
||||
(<(({[{<{<<<(([][])(()()))(<{}()>)><({[]<>}[()[]])<<(){}>[{}{}]>>>[<[[[]<>]<<>()>][[(){}](<><>)]
|
||||
[[[[[<{{{<<<{{<>()}(()[])}<{<>{}}<<>[]>>>([[{}<>][[]()]]({()()}(<>[])))>>}}[(([[((()()))[([]())[{}{}]]]{(<{
|
||||
{{({([<([{[<{[<>[]]<<><>>}[(<><>)([][])]>({[()<>]<[]()>}{<{}()>})]<([<{}{}>([]())))>}{[<(([]<>)(
|
||||
<<{<((<(<{{[([<>[]][{}<>]){({}())[()()]}]([({}())<()[]>]({{}}>)}[<<(<>{})>(<()[]>([][]))>(([<>[]]<()<>>)<[{
|
||||
{[<[<<(<{{((<{{}()}<[][]>>[[(){}]{()()}])<{[<>[]][{}{}]}{[[]{}]}>){<<{()()}{<>()}>>({[<>[]]<(){}
|
||||
{<[((<{<(<([(<()<>><[]{}>){{<>}[{}[]]}]{(<()()>((){}))({{}<>}[()[]])})[{({<>[]})<{<>{}}<[][]>
|
||||
<(<{{<(([<<{<([]{})[<><>]>{<<><>><(){}>}}<<<[]{}>>{[<><>](<>{})}>>({<{()[]}({}())><[{}[]]<(){}>>})>[{<[{{
|
||||
<<(([<[<({{{([[]<>]<{}{}>)}[{(<>[])<[][]>}{{{}{}}(<>())}]}})<({[[<<><>><<>()>][{<>[]}({}())]]<<[{}()
|
||||
<<<{{[<({<<{{{[]{}}{{}[]}}{{()[]}<{}{}>}}>{({{()<>}[<>[]]}({[]<>}(()()))){<<[]<>>{[][]}><<
|
||||
[([[{[(<[{<<[((){})<()>]><{(()())([]())}{<()<>]<[][]>}>>[{{((){}){<>[]}}<[()()](<><>)>}[[([
|
||||
(<{(<{<<{{<<[<[]<>><[][]>]{{{}{}}}>([[()[]]{[]<>}]<[()[]]<<><>>>)>[({[[]{}]({}[])}{{(){}}{<><
|
||||
[{<<<<({{[({({[]{}}[<>{}])[<<>{}>({}<>)]}{{({})}({[]{}}({}{}))}){<<{{}[]}<{}<>>>[{<>[]}<[][]>]
|
||||
{{<<({<{<[[([[()<>][[]{}>]((()[])))]([{((){}){()[]}}<<<>{}>{{}<>}>])]>}>}){([[[[(<([<>()])<<()()><[]()>>>
|
||||
[<<[(<<<<<{([{<>}]<({}{})<[]<>>>)<[[(){}]<<><>>]{{{}[]}{{}[]}}>}<{<{[]<>}([][])><[{}()]{{}[]}>}(<{<><>}{<>()
|
||||
(([(([<{(<{{<[()[]][{}[]]><<()>([]())>}[(<()<>>({}()))<{[]()}{[]()}>]}[({{[]{}}}<{<><>}(()[])>)<[{<>[]}{<>[]
|
||||
([<{<{<[{({<{[[]()](<><>)}(<<>{}>{{}{}})><<<[]<>>{{}()}>{<(){}>[[]()]}>}[{[{{}}([]{})]]])(({{{
|
||||
[<{[{[{<[{{[(([]<>)<()<>>)(<()()><()()>)][<([]<>)<<>{}>>[(<>{}){(){}}]]}{(<{()<>}{[]{}}>(((){
|
||||
<(<{[[{<{<{(<(<>[])[{}<>]>(<{}<>>[{}[]]))[{{<>[]}([]{})}[(<>()){<>()}]]}<[((<>){()[]})[({}<>)(()[]
|
||||
{{(<[{<{<(<[<(<>[])([][])>[([][])]][<({}<>)<<><>>><[()<>]{<>{}}>]>)[(([[[]]]<<()[]>>)<[<()[]>[()[]]]([()()]
|
||||
{<({{<[([([{[[<><>]{{}{}}]}<{[{}<>]({}{})}<<()>[<>[]]>>])<(<{([]{}){[]()}}[<{}()>{{}}]>(<(<
|
||||
{<[{{{{{<[{(<({}{})[()]>[([]{}){<>()}])[{[<>[]](<>{})}<<<>[]>[()<>]>]}]>([({(<()[]>[{}[]]){{[][
|
||||
{<{{<{[[{[<<{(<>()){(){}}}>{({[][]}[[]()])([{}{}](()))}><{{<<>[]>{{}{}>}<([]<>)<<>()>>}({[[]{}][[]<>]}
|
||||
<(<[(((([{<<{{()[]}[()[]]}({[]<>}<(){}>)>({{[]{}}<<>>}{[<>[]]<()<>>})><<[<[]<>>{<><>}]({[]{}
|
||||
<([[[[<(((({[({}()){<>{}}][{<>}<()[]>]}(([()[]]<{}<>>)[<<>()>(<>[])]))<[<[[]()]{[]<>}>([<>{}]<[]{}>)](<(()[
|
||||
([<{[{([[{[{(<(){}>(<>())){([]())[()()]}}([(<>{})<[]<>>]{<{}()>[[]()]})]<(([<>{}](<>[]))[<{}
|
||||
[[<<{[{[<[{(<{{}<>}<()<>>>([[]{}]{<><>}))<<[{}()]{<>[]}>[{{}[]}{{}<>}]>}]>[{{{<<()<>>{{}[]}
|
||||
((<[{<({([{{(([]{})(<>()))}[[<[]<>>][[[]<>][()()]]]}[{[({})({}[])]<[[]()][[]()}>}[{[()[]]<<>
|
||||
{[(<((<{(<[[{([]()){{}()}}][{<[][]>[<>()]}{[[]][[]{}]}]][{{<()()>{<><>}}<{{}[]}{<>()}>}]>(
|
||||
{{[<(({<[{{[{(<>{})([]<>)}{{()<>}[[][]]}](((<>{})[{}[]])([{}<>]{{}[]}))}[<<[()()][<><>]><[
|
||||
{(({[[([[({{[({}{})[{}{}]][<()()>({}{})]}{(<<>{}>{()[]}){[()]({}[])}>}){((<<{}{}>{{}{}}>[<()<
|
||||
[<{(<[([(((<{<<>[]>[<>()]}({[]()}({}()))>(({<>{}}{[]})<{()<>}(<><>)>)))([<<<{}()>{<>{}}>[<[
|
||||
[{{[(<{[<([[<{<>{}}<(){}>>]{{(())}((<>[]))}]({({{}<>}[(){}])>))({<{(<><>)[<>{}]}<<[][]><<>{}>>>}((
|
||||
([[(({({(<([({{}}[<>()])<({}{})>]((([]()>[[][]])))>)})(<<<[<{[<>](()())}[(()[])(()())]>]{([[[][]]{[]{}}
|
||||
{([({{<([[<<[[{}<>]<()()>]><{{[]}(<><>)}>><<{<{}()>[<><>]}>[[{()}{{}{}}]]>]])[({([<<()<>>([]<
|
||||
<{{{(({{[(((<([][])[{}[]]>((<>())[{}{}]))[<[[]()](<>{})>[(()()){{}[]}]]))][<[[[<<>[])(<>[])][
|
||||
<<<[[[<[[[<[[({}[])<[]<>>]([{}<>][{}[]])]><(({{}()}))({[()]<[]<>>}<[<>{}]({}{})>)]]<[[<{[]
|
||||
({{[<[(<{<{{([<>[]])(([][]){<><>})}}{(({[]{}})<{{}}[<>{}]>){[<[]<>>{()<>}]}}>}{<(<<[<>[]](<><>)>[<()>{()
|
||||
<<[(<[{[[(({{(<>{})<{}{}>}}))<<(((()[]){(){}})([[]<>]<<>{}>})<[<{}{}>]([()]<<>[]>)>>>]]<{(((
|
||||
({({(<<{<(<([{<>[]}<<><>>])>[(<[<>()](<>())>[<[]{}><()()>]){([[]{}])[[{}{}]{[]}]}])<[((<(){}>){([]
|
||||
{{[<<[{[<[(((({}<>){{}{}})<<<>[]>[{}[]]>)[{<{}[]>{<>()}}[<{}[]>[<>[]]]])<(<[[]()>><(<>{})<()<
|
||||
<(<(<<[<({[[(({}{})[[][]])<[{}{}][<>[]]>]]{<[{<>[]}<[]<>>]{{<>{}}{[]{}}}>{<[<><>](<>())>[[<>
|
||||
{(((({{<<<[[{[[][]>{<>{}}}{[{}{}]{()<>}}]{{[[]]}[[[][]][()()]]}]({{[[]<>][[]<>]}<{{}{}}({}
|
||||
({([{<{(<{({[([]())[()[]]]{([]<>){<>[])}}[([[]{}](()<>))<<()<>><{}[]>>])<((<()[]>{<>[]}){{{}()
|
||||
[{<{[{[<[{(<<({}{})<()[])>(<()<>>(()))>{((<>())[{}()])<{<><>}<[]<>>>}){{(<{}{}>{<>[]})[{{}}[[]{}]]}<[
|
||||
{[{<[[[[[(<{{[()[]]{{}<>}}{([][])[(){}]}}>{{<{<>()>([]<>)>[({}{})]}{{<[]>}[[[]<>]([]<>)]}})<
|
||||
{[<{{({((<<(<({}<>)<<>[]>>({{}}[()()]))[[{<><>}[[]{}]]]>>){{<{{([]{})[<><>]}}>(([<{}{}><(){}>]{({}<>)
|
||||
{{{<[((({(<{{({}<>)[<>[]]}[([]<>){()[]}]}{(<[]<>>[[]{}])}>){<<{{[]()}[<>[]]}>[<<[]{}>[(){}]>]>
|
||||
[{{[<{[{({{<<(())<()<>}>(<{}{}><<>[]>)>[[<{}>([]{})]<<<>[]><{}[]>>]}((<{{}<>}{()()}>([()()]{{}<>})))
|
||||
({<[<[<[<<{<[<{}[]>]>{<{{}<>}{()<>}>([()<>][<><>])}}{{[<<>()>]{{[][]}{<>()}}}{<(<>[])<<><>>><(<>{})<<><
|
||||
{{{([[<[[(((<(<>[])<<>[]>>{<{}<>>{()}}><[{(){}}({}<>)][[<>[]][{}{}]]>)([({[][]}[[]<>]){<(){}>}]
|
||||
{(<{{{<[<[[[(<<>[]>([][]))]]]>]>}}([((<<[{(<{}>(<>{})){[()()]{[][]}}}{{([]<>><{}<>>}<{{}()}(
|
||||
([(<[[((([[((((){})({}()))({[]()}{<>()}))[([<><>])[[<>[]]<{}[]>]]]]<<({<(){}>{{}<>}}({(){}}[{}<>]))([(
|
||||
{[[[[{{[[{{<(([][]))(([]<>){[]{}})><{<{}{}>{[]<>}}<{{}<>}(()())>>}([{<[][]>{[][]}}<[<>]{<>[]}>]<{<()()>[()
|
||||
<({{[((<<<([<({}())[()<>]>(<()<>>[<><>])][{(<><>)[<>{}]}([<>{}](<>()))])(<[{(){}}[[]{}]>>)
|
||||
<((({([{<<<[((()[])[<>[]]){[<>{}](()<>)}]{[<{}[]>]<([]<>){<>{}}>}>[<<[{}[]]<(){}>>>]>{<(((<>[]){<>()}){{<
|
||||
[<(<<({<<[<{{<[]()>{{}()}}[{{}{}}{[][]}]}>[{(({}[])({}{}))<((){}){{}[]}>}{(([]{})([]{}))}]][({<<()>(<>())>{{<
|
||||
({<({(([<{[(({(){}}{<><>}){({}[])<()()>})]<<{[[]()]<[][]>}>[{<<>[]>[[]{}]}[([]<>]]]>}[<{({{}()})((()<>)({}())
|
||||
{({[[{({{<<(<[[]{}]{<>[]}>([[]<>]))((<{}()>{()()})<<{}()><(){}>>}>{{[{[]{}}<[]()>](({}[])[<>{}])}<{[<>[]]
|
||||
[([<({{<<([<[[{}{}]((){})]<(<>[])>>][{[[<>[]]{<>()}]{<<>{}>({}())}}({[<>()]{<>[])}{<<>()>({}())})]
|
||||
[[([[(<<({([{<[]()>({})}[<()()>{()[]}]][<[{}<>>{[]{}}>])<[(<[]()>)({<>[]}<[]{}>)]>})>{[<<{{{{}[]}[{}<
|
||||
[<[{<([(<[([[([]<>){()()}][[[]<>]{{}<>}]]{[[<><>]][<<>{}><{}{}>]}){{(([])[()<>])(<<>{}><{}[]>)}}]({<((<>
|
||||
{(<(<{<<({{[[<()()><{}[]>]{<()<>>[{}{}]}][(<()()>({}{}))({<><>}<{}[]>)]}{<<([]{}){[]()}>[((){})[()
|
||||
{({[[<[<<{[(<([][])><[<><>][{}<>]>)<<{<>()}(<>[])>{({}{})[()]}>]{[{<()[]>[(){}]}[<[]()>[(){}]]]{<
|
||||
{(<[[[<(<{{{[{()()}[<>]](({}[])[[][]])}({([][])[(){}]}{{[]{}}{()<>}}}}}<{[(({}<>)<()()>){<(){}>[{}<>]}](<<<
|
||||
{{{{{[[[<[(<<([][])<<>()>>[{{}{}}{[]<>}]><{<{}{}>({}())}>)(({{<>{}}}))][({<<[]{}>>{<()()>}
|
||||
(([[({{[<<[{{({}<>)(<><>)>}([<[]<>>{{}()}]({[]()}[(){}]))]><[(((()<>)<<>[]>))[(<()[]>[()<>]){[()()][{}()]}]
|
||||
[({[[<{<{((<<([][])<()()>>{([]{})([]{})}>(<[[]<>](())><{{}[]>({}[])>))({<[{}]<()[]>><({}<>)([]<>)>}<[<()()>
|
||||
{([<<({<{[{[{([]<>){()()}}][[(<>[])<()()>]({(){}})]}[{[{[][]}<{}[]>]{<()()>>}{<{[]()}<<>()>>[({}<>)[(
|
||||
[[((<{(([<((<(<>)[()]>(<{}{}>)){<{<><>}<()[]>>([<>()]({}[]))})<{<(()()){()[]}>}[({{}{}}([]()))<{
|
||||
<{[(<{({<(<[{[{}[]]}(({}()){{}<>})]{((()[])[[]<>])<[()<>]>}>((<{<><>}([]<>)>))){[[({(){}}<<><>>)<{{
|
||||
({([{[<{(<({<[()<>]<{}()>>[[{}{}][()()]]}[(<[]<>><{}{}>)<{{}<>}[<>()]>])>{([{<[]{}><{}<>>}<({}{}){
|
||||
<([[<<[<{({<([()<>](()<>))[{<>())<{}{}>]><[{[]<>}](([]<>)([]<>))>})[<[{((){})[()<>]}{[{}<>]<<><>>}]>]}><
|
||||
<{<[((<{[{([{(()<>)([][])}][(({}[])(()[])){{()[]}<<><>>}])<{[{[]()}<[]{}>]}<{({}{})<<><>>}<{()()}(<>{})>>>}
|
||||
{{<[<({(<[[<{(())}([<><>]([]<>))>(({<>()}<()()>){{<>()}{[]{}}})]<{([[]<>]{[]()})<<[]()>{()<>)>}<{{[
|
||||
[<([{{[[<(({{(<>())<<>()>}<[[]<>][[]{}]>}<(<{}()>(<>[]))[{[]()}[{}<>]}>)[[{[[]<>](<>{})}[[[]{}][[]{}]
|
||||
{[{([<({<{[{<(<><>)([][])>([[]<>](()()))}<{<[]<>>}[[{}()]{<>[]}]>](<<[<>()]<<>()>>([[]<>])>{{[{}{}][<>[]]}{
|
||||
{{<<<<((({(([{{}()}(<>{})]{{<>()}[()]})<[(()()){<>[]}]{<<>{}>}>)([({[]{}}<{}<>>)]<[([][]){(){})]([[]
|
||||
({[(((<[([[[(({}<>)<()<>>)<{<>()}>]]{{(<{}[]>[<>[]])<({}<>)>}[{<<>>}{[[]{}][{}()]}]}])<<(<{{<>{}}[{}[]
|
|
@ -0,0 +1,42 @@
|
|||
#!/usr/bin/env python3
|
||||
from useful import *
|
||||
|
||||
def parseline(s):
|
||||
return s
|
||||
return [int(c) for c in s]
|
||||
return [int(x) for x in s.strip().split(',')]
|
||||
|
||||
with open(0) as f:
|
||||
|
||||
L = [parseline(l) for l in lines(f)]
|
||||
total = 0
|
||||
d = {
|
||||
')': 3,
|
||||
']': 57,
|
||||
'}': 1197,
|
||||
'>': 25137,
|
||||
}
|
||||
inc = {
|
||||
'(': 1,
|
||||
'[': 2,
|
||||
'{': 3,
|
||||
'<': 4,
|
||||
}
|
||||
fixscores = []
|
||||
for l in L:
|
||||
fixtotal = 0
|
||||
for i in range(len(l)):
|
||||
for p in '{} <> [] ()'.split():
|
||||
l = l.replace(p, '')
|
||||
|
||||
lincomplete = l # save this
|
||||
for p in '{ < [ ('.split():
|
||||
l = l.replace(p, '')
|
||||
if not l: # possibly incomplete
|
||||
fixscores.append(reduce(lambda acc, c: acc * 5 + inc[c], lincomplete[::-1], 0))
|
||||
continue
|
||||
total += d[l[0]]
|
||||
|
||||
print( total)
|
||||
print(sorted(fixscores)[len(fixscores)//2])
|
||||
|
Loading…
Reference in New Issue