Compare commits

...
2 Commits
Author SHA1 Message Date
daniel 3df3a70754 day 10 2021-12-10 11:37:15 +01:00
daniel 211dbae5a4 fixed colors/comments of PGM 2021-12-09 13:01:48 +01:00
4 changed files with 207 additions and 8 deletions

No files matched your search

+5 -7
View File
@@ -105,7 +105,7 @@
low-points))
; write a PGM file for given heightmap and low points
; max altitude (9) is white
; basin limits are grey
; basins are red-ish (brighter the higher the point)
; low points are bright green
;
@@ -148,20 +148,18 @@
(when (< y (- height 1))
(y-loop (+ y 1))))
; show basins as redish areas
; show low points as full green pixels
(for-each
(lambda (lp)
; red channel to max on pixels of basins
; show basins as redish areas
(visit-basin heightmap lp
(lambda (x y)
(let [(ofs (offset x y))]
(vector-set! data ofs 255))))
; green channel to max on pixels of low point
; show low points as bright green
(let [(ofs (offset (low-point-x lp) (low-point-y lp)))]
(vector-set! data ofs 255)
(vector-set! data ofs 0)
(vector-set! data (+ 1 ofs) 255)
(vector-set! data (+ 2 ofs) 255)))
(vector-set! data (+ 2 ofs) 0)))
low-points)
; write pixels to file
+1 -1
View File
@@ -1,4 +1,4 @@
P3
100 100
255
255 255 255 255 20 20 180 180 180 255 160 160 255 140 140 255 120 120 255 100 100 255 80 80 255 100 100 255 120 120 255 140 140 180 180 180 255 255 255 255 80 80 180 180 180 255 160 160 255 140 140 255 120 120 255 100 100 255 120 120 255 120 120 255 140 140 255 160 160 180 180 180 180 180 180 255 160 160 180 180 180 255 100 100 255 80 80 255 60 60 255 40 40 255 60 60 255 40 40 255 60 60 255 80 80 255 100 100 180 180 180 255 160 160 180 180 180 255 100 100 255 80 80 255 100 100 255 140 140 255 160 160 180 180 180 180 180 180 255 160 160 255 160 160 255 120 120 255 140 140 255 160 160 180 180 180 255 160 160 255 140 140 255 120 120 255 140 140 180 180 180 255 160 160 255 120 120 255 100 100 255 120 120 255 140 140 255 120 120 255 140 140 255 160 160 180 180 180 255 255 255 255 20 20 180 180 180 255 160 160 180 180 180 255 160 160 180 180 180 255 60 60 255 40 40 255 60 60 180 180 180 180 180 180 255 140 140 255 120 120 255 100 100 255 80 80 255 60 60 255 40 40 255 20 20 255 40 40 180 180 180 255 120 120 255 100 100 255 80 80 255 60 60 255 40 40 255 255 255 180 180 180 255 160 160 255 140 140 255 120 120 255 100 100 255 80 80 255 100 100 180 180 180 180 180 180 180 180 180 255 140 140 255 120 120 255 100 100 255 80 80 255 60 60 255 80 80 255 100 100 255 120 120 255 160 160 180 180 180 180 180 180 255 160 160 255 140 140 255 120 120 255 100 100 255 80 80 255 255 255 255 80 80 255 100 100 180 180 180 180 180 180 255 160 160 255 140 140 255 160 160 180 180 180 255 100 100 180 180 180 255 20 20 255 255 255 255 20 20 255 80 80 255 100 100 180 180 180 255 160 160 255 140 140 255 160 160 255 80 80 255 60 60 255 80 80 255 100 100 255 140 140 180 180 180 255 160 160 255 140 140 255 120 120 255 100 100 255 120 120 255 140 140 255 160 160 180 180 180 255 120 120 255 100 100 180 180 180 255 160 160 255 140 140 255 100 100 255 80 80 255 255 255 255 80 80 255 100 100 180 180 180 180 180 180 255 40 40 255 20 20 180 180 180 255 160 160 255 140 140 180 180 180 255 140 140 255 160 160 180 180 180 255 255 255 180 180 180 255 160 160 255 140 140 255 120 120 255 100 100 255 80 80 255 60 60 255 40 40 255 20 20 255 255 255 180 180 180 255 160 160 180 180 180 255 120 120 180 180 180 255 80 80 180 180 180 180 180 180 255 160 160 255 140 140 255 120 120 255 100 100 255 80 80 255 60 60 255 40 40 255 140 140 255 160 160 180 180 180 255 160 160 255 100 100 255 80 80 255 60 60 255 40 40 255 100 100 255 80 80 255 100 100 255 120 120 255 160 160 180 180 180 180 180 180 255 160 160 255 160 160 255 140 140 255 100 100 255 120 120 255 100 100 255 140 140 255 160 160 180 180 180 255 100 100 255 120 120 255 140 140 180 180 180 180 180 180 255 160 160 180 180 180 255 20 20 255 40 40 255 100 100 180 180 180 255 160 160 255 140 140 255 120 120 255 100 100 255 60 60 255 40 40 255 60 60 255 120 120 180 180 180 255 160 160 180 180 180 255 120 120 255 100 100 255 80 80 255 100 100 255 120 120 255 140 140 180 180 180 255 255 255 255 80 80 255 100 100 180 180 180 255 140 140 255 120 120 255 100 100 255 80 80 255 100 100 255 120 120 255 140 140 255 160 160 180 180 180 180 180 180 255 160 160 255 140 140 255 120 120 255 160 160 255 120 120 180 180 180 255 160 160 180 180 180 180 180 180 180 180 180 255 160 160 180 180 180 255 160 160 255 140 140 255 80 80 255 60 60 255 80 80 180 180 180 180 180 180 255 140 140 255 160 160 180 180 180 255 160 160 180 180 180 255 160 160 180 180 180 180 180 180 255 120 120 255 100 100 255 80 80 255 60 60 255 40 40 255 255 255 255 120 120 180 180 180 255 160 160 255 140 140 255 120 120 255 100 100 255 80 80 255 20 20 255 40 40 255 60 60 255 80 80 255 100 100 255 140 140 255 160 160 180 180 180 180 180 180 180 180 180 255 160 160 255 120 120 255 140 140 255 120 120 255 140 140 255 160 160 180 180 180 255 80 80 255 100 100 255 140 140 255 160 160 180 180 180 255 140 140 255 160 160 180 180 180 255 60 60 180 180 180 255 160 160 255 140 140 255 120 120 255 100 100 255 80 80 255 60 60 255 20 20 255 40 40 255 100 100 255 160 160 255 140 140 255 160 160 180 180 180 255 80 80 255 255 255 255 80 80 255 140 140 255 160 160 180 180 180 255 80 80 255 100 100 255 120 120 180 180 180 255 160 160 255 160 160 255 140 140 255 100 100 180 180 180 180 180 180 255 160 160 180 180 180 255 100 100 255 80 80 180 180 180 255 80 80 255 100 100 255 140 140 255 100 100 255 120 120 255 140 140 255 160 160 180 180 180 180 180 180 180 180 180 180 180 180 180 180 180 255 120 120 255 100 100 255 80 80 180 180 180 255 160 160 255 140 140 255 120 120 180 180 180 255 160 160 255 140 140 255 120 120 255 140 140 255 160 160 180 180 180 180 180 180 255 120 120 255 100 100 255 80 80 255 60 60 255 40 40 255 100 100 255 120 120 180 180 180 255 160 160 255 140 140 255 80 80 255 60 60 255 255 255 255 20 20 255 120 120 255 100 100 255 120 120 255 160 160 180 180 180 180 180 180 255 120 120 255 140 140 180 180 180 180 180 180 255 160 160 255 140 140 255 160 160 180 180 180 255 255 255 255 60 60 255 80 80 255 160 160 180 180 180 255 80 80 255 120 120 255 140 140 255 160 1Line truncated
0 255 0 255 20 20 180 180 180 255 160 160 255 140 140 255 120 120 255 100 100 255 80 80 255 100 100 255 120 120 255 140 140 180 180 180 0 255 0 255 80 80 180 180 180 255 160 160 255 140 140 255 120 120 255 100 100 255 120 120 255 120 120 255 140 140 255 160 160 180 180 180 180 180 180 255 160 160 180 180 180 255 100 100 255 80 80 255 60 60 255 40 40 255 60 60 255 40 40 255 60 60 255 80 80 255 100 100 180 180 180 255 160 160 180 180 180 255 100 100 255 80 80 255 100 100 255 140 140 255 160 160 180 180 180 180 180 180 255 160 160 255 160 160 255 120 120 255 140 140 255 160 160 180 180 180 255 160 160 255 140 140 255 120 120 255 140 140 180 180 180 255 160 160 255 120 120 255 100 100 255 120 120 255 140 140 255 120 120 255 140 140 255 160 160 180 180 180 0 255 0 255 20 20 180 180 180 255 160 160 180 180 180 255 160 160 180 180 180 255 60 60 255 40 40 255 60 60 180 180 180 180 180 180 255 140 140 255 120 120 255 100 100 255 80 80 255 60 60 255 40 40 255 20 20 255 40 40 180 180 180 255 120 120 255 100 100 255 80 80 255 60 60 255 40 40 0 255 0 180 180 180 255 160 160 255 140 140 255 120 120 255 100 100 255 80 80 255 100 100 180 180 180 180 180 180 180 180 180 255 140 140 255 120 120 255 100 100 255 80 80 255 60 60 255 80 80 255 100 100 255 120 120 255 160 160 180 180 180 180 180 180 255 160 160 255 140 140 255 120 120 255 100 100 255 80 80 0 255 0 255 80 80 255 100 100 180 180 180 180 180 180 255 160 160 255 140 140 255 160 160 180 180 180 255 100 100 180 180 180 255 20 20 0 255 0 255 20 20 255 80 80 255 100 100 180 180 180 255 160 160 255 140 140 255 160 160 255 80 80 255 60 60 255 80 80 255 100 100 255 140 140 180 180 180 255 160 160 255 140 140 255 120 120 255 100 100 255 120 120 255 140 140 255 160 160 180 180 180 255 120 120 255 100 100 180 180 180 255 160 160 255 140 140 255 100 100 255 80 80 0 255 0 255 80 80 255 100 100 180 180 180 180 180 180 255 40 40 255 20 20 180 180 180 255 160 160 255 140 140 180 180 180 255 140 140 255 160 160 180 180 180 0 255 0 180 180 180 255 160 160 255 140 140 255 120 120 255 100 100 255 80 80 255 60 60 255 40 40 255 20 20 0 255 0 180 180 180 255 160 160 180 180 180 255 120 120 180 180 180 255 80 80 180 180 180 180 180 180 255 160 160 255 140 140 255 120 120 255 100 100 255 80 80 255 60 60 255 40 40 255 140 140 255 160 160 180 180 180 255 160 160 255 100 100 255 80 80 255 60 60 255 40 40 255 100 100 255 80 80 255 100 100 255 120 120 255 160 160 180 180 180 180 180 180 255 160 160 255 160 160 255 140 140 255 100 100 255 120 120 255 100 100 255 140 140 255 160 160 180 180 180 255 100 100 255 120 120 255 140 140 180 180 180 180 180 180 255 160 160 180 180 180 255 20 20 255 40 40 255 100 100 180 180 180 255 160 160 255 140 140 255 120 120 255 100 100 255 60 60 255 40 40 255 60 60 255 120 120 180 180 180 255 160 160 180 180 180 255 120 120 255 100 100 255 80 80 255 100 100 255 120 120 255 140 140 180 180 180 0 255 0 255 80 80 255 100 100 180 180 180 255 140 140 255 120 120 255 100 100 255 80 80 255 100 100 255 120 120 255 140 140 255 160 160 180 180 180 180 180 180 255 160 160 255 140 140 255 120 120 255 160 160 255 120 120 180 180 180 255 160 160 180 180 180 180 180 180 180 180 180 255 160 160 180 180 180 255 160 160 255 140 140 255 80 80 255 60 60 255 80 80 180 180 180 180 180 180 255 140 140 255 160 160 180 180 180 255 160 160 180 180 180 255 160 160 180 180 180 180 180 180 255 120 120 255 100 100 255 80 80 255 60 60 255 40 40 0 255 0 255 120 120 180 180 180 255 160 160 255 140 140 255 120 120 255 100 100 255 80 80 255 20 20 255 40 40 255 60 60 255 80 80 255 100 100 255 140 140 255 160 160 180 180 180 180 180 180 180 180 180 255 160 160 255 120 120 255 140 140 255 120 120 255 140 140 255 160 160 180 180 180 255 80 80 255 100 100 255 140 140 255 160 160 180 180 180 255 140 140 255 160 160 180 180 180 255 60 60 180 180 180 255 160 160 255 140 140 255 120 120 255 100 100 255 80 80 255 60 60 255 20 20 255 40 40 255 100 100 255 160 160 255 140 140 255 160 160 180 180 180 255 80 80 0 255 0 255 80 80 255 140 140 255 160 160 180 180 180 255 80 80 255 100 100 255 120 120 180 180 180 255 160 160 255 160 160 255 140 140 255 100 100 180 180 180 180 180 180 255 160 160 180 180 180 255 100 100 255 80 80 180 180 180 255 80 80 255 100 100 255 140 140 255 100 100 255 120 120 255 140 140 255 160 160 180 180 180 180 180 180 180 180 180 180 180 180 180 180 180 255 120 120 255 100 100 255 80 80 180 180 180 255 160 160 255 140 140 255 120 120 180 180 180 255 160 160 255 140 140 255 120 120 255 140 140 255 160 160 180 180 180 180 180 180 255 120 120 255 100 100 255 80 80 255 60 60 255 40 40 255 100 100 255 120 120 180 180 180 255 160 160 255 140 140 255 80 80 255 60 60 0 255 0 255 20 20 255 120 120 255 100 100 255 120 120 255 160 160 180 180 180 180 180 180 255 120 120 255 140 140 180 180 180 180 180 180 255 160 160 255 140 140 255 160 160 180 180 180 0 255 0 255 60 60 255 80 80 255 160 160 180 180 180 255 80 80 255 120 120 255 140 140 255 160 160 180 180 180 255 80 80 180 180 180 255 160 160 255 100Line truncated
+107
View File
@@ -0,0 +1,107 @@
; get list of lines from a file
(define (get-lines file)
(let loop [(lines '())]
(if (eof-object? (peek-char file))
lines
(loop (cons (get-line file) lines)))))
; check if character can close chunk
(define (closing? c)
(case c
(#\) #t)
(#\} #t)
(#\] #t)
(#\> #t)
(else #f)))
; check if character can close chunk starting by o
(define (is-closed-by? o c)
(or (and (char=? o #\<) (char=? c #\>))
(and (char=? o #\{) (char=? c #\}))
(and (char=? o #\() (char=? c #\)))
(and (char=? o #\[) (char=? c #\]))))
; return character needed to close chunk started by o
(define (close o)
(case o
(#\( #\))
(#\{ #\})
(#\[ #\])
(#\< #\>)
(else #f)))
; if given line is corrupt, returns expected character
(define (corrupt-char? line)
(let loop [(i 0)]
(if (< i (string-length line))
(let [(c (string-ref line i))]
(if (closing? c)
i
(let [(close-index (loop (+ i 1)))]
(if (number? close-index)
(let [(d (string-ref line close-index))]
(if (is-closed-by? c d)
(loop (+ close-index 1))
d))
close-index))))
#t)))
; compute score after syntax checking all given lines
(define (score-illegal-lines lines)
(fold-left
(lambda (score line)
(+ score
(case (corrupt-char? line)
(#\) 3)
(#\] 57)
(#\} 1197)
(#\> 25137)
(else 0))))
0 lines))
; returns #t if line is corrupt
(define (corrupt? line)
(char? (corrupt-char? line)))
(define (not-corrupt? line)
(not (corrupt? line)))
; returns list of characters needed to autocomplete the given line
(define (complete incomplete-line)
(let [(stack '())]
(string-for-each
(lambda (c)
(if (closing? c)
(set! stack (cdr stack))
(set! stack (cons c stack))))
incomplete-line)
(map close stack)))
; returns auto complete score applied to incomplete lines of input
(define (score-autocomplete lines)
(define (score completion)
(fold-left
(lambda (s c)
(+ (* s 5)
(case c
(#\) 1)
(#\] 2)
(#\} 3)
(#\> 4))))
0 completion))
(let [(scores (sort <
(map score
(map complete
(filter not-corrupt? lines)))))]
(list-ref scores (div (length scores) 2))))
(call-with-input-file
"input"
(lambda (file)
(let [(lines (get-lines file))]
(printf "part 1:~% Illegal lines score = ~a~%"
(score-illegal-lines lines))
(printf "part 2:~% Completed lines score = ~a~%"
(score-autocomplete lines)))))
+94
View File
@@ -0,0 +1,94 @@
<({<[(({(((({(<><>)[[][]]}<<()>{{}}>)(<{(){}}((){})>))<[((<><>){()()})[(<>{}){[]{}}]]>){{(({[]()}<[][]>
{<({[[<<{(<{(<{}()>([][])){<<>}[<>()]}}[<(<>()){()()}>[[(){}]({}())]]>{({{<>{}}[<><>]}<{()<>}{{}()
{{<<<[<({[{{<({}())(<>{})>(<()<>><()[]>)}<([<>{}](<>[]))<{{}<>]>>}<[[<<><>><[]()>][[[]{}]{{}}]][{(<>(
[[<<<[([[([<(({}[]){{}[]})><{([]<>)[(){}]}[{()[]}([]{})]>][({({}[])<[]{}>}{[{}()](<>())}){(([]{}){[][]})[
{((({{<[(((<(<()><()()>)>[{<[]()>{<>{}}}{([][])<[]()>}]){(({[][]}{()})(({}<>)[<>{}]))({{()<
[[[(({[<<[([[[[]<>]{[]()}]([{}()]{{}{}}]][{[()()]{(){}}}(([]())<{}>)])][{[(([][]){[]{}})]<{(()<
{<[{[({<{[{[<[()<>]>({[]<>}{[]()})]}{[([<>{}]({}{})){([]{})}]{{<{}{}>}{<()<>>(<>{})}}}](([{{(){}}<{}{}>
<{({{[(({({<[[[][]]]{[<>()][{}()]}>((<{}<>>))})(<(<[{}[]]({}<>)><({}<>)>)[[{()<>}{<>{}}}[{[]<>
[<[[[{<[([<(<<<>{}><(){}>>(<[]()>)){<<{}<>>[()]>[<[]<>>([][])]}><<{[{}()][{}[]]}<({}{})>>({{{}{}}}
{[[{<(<[{[<(<<{}{}>{[]()}>){{(()<>)[[]<>]}}>[[[[<><>]<[]{}>]]]]}({{{{([]<>)[[]{}]}}{{(()[])[[]{}]}}}}((<(<<
<[([({<({(<{[[[][]][<>()]][<{}[]>]}[{(()())<{}{}>}<({}())(<>{})>]>{(<<[]{}>>{{{}<>}[[]<>]}){{([]
{<<[<(<{[[<[{[()[]](<><>)}{<[]{}>(()[])}]<{{[]{}}<{}<>>}([[]()]([])))>(([[<><>]]))]<[<{{[][
(((<<([[([<<[(()[]]<()<>>]<(()[]){{}[]}>><<[{}{}](()())>{<()()>[{}()]}>>])(([[({(){}}<<><>>)[{{}[]}[{
[<{([[<(<<[[([<>[]][<>()])(((){})([]()))](<{[]<>}({}())>[<<>[]>(()[])])]{[((<>())[{}()])(([])((){})
(({<{<([[[(<(<[]()>{<><>}){[[]()]{{}<>}}>)]<([<{()[]}<<><>>>{{<>()}{[][]}}][<{[]<>}<{}()>>])[<{
<<<<[([({{(<[<<>{})]<[[][]][{}{}]>>[<{{}()}[[]<>]><[[]<>]{[]()}>])}}<(<([(()())({}())]({<>
{<[{{(<((<{<[<()()>[{}<>]][([]())[{}{}]]><{[[]{}]{()()}}{([]<>)<()<>>}>}><{(<<<>{}>[[]]><({}[])({}()]>)}<{[
(<{{<(([[({<(<{}><<>{}>)><{[(){}]}<{<>()}[[]<>]>>}{({<(){}}({}{})})})<<[[<(){}>{[]()}]<[{}{}]>]
<{((<{[{<{[((((){})(<>{}))[<{}[]>[()]])(<[()()]{()<>}>)]{{({()}<{}[]))}[<(()[])><[()[]]({}<>)>
(<(<({[{<{{{<[{}][[]<>]><{<><>}(<>[])>}}}>}<{<[({<[]{}>[{}()]}([()[]]{[]<>}))[[({}[])]{({}{})[{}[]]}]][<{{<>(
[({<<[{{{<(<<<{}{}>{[]}>({()[]}({}()))>{<[{}()][{}{}]>[[<>{}](<><>)]})>(<<[<{}<>>]{<[]{}>([
<(({{[(({(<{{([]<>)[{}<>]}}{<<[][]>{<>{}}>({<>()}{<>()})}>{[[[[]<>]](<<>{}><()<>>)]})({<([<
<<[(<<([([({<[{}[]]<{}()>]{<[][]>[[][]]}}({<()()>{()[]}}({<>()}((){})))){{(<()[]>[[]])(<<>{}>)}{<{{}[
{{(<<{([{[{(([{}{}]((){})))}{<[(()())({}())][{()<>}]>}][{<{({}())<[]()>}[[<><>]{<>()}]>}]}[((<
<[[{(([<<<{<([[][]][()[]}){{[]<>}(()[])}>([(<>[]){{}[]}]{({})<<>{}>})}[[<{<>[]}<[]()>>][{{()[]}}[{{}()
{{([{<((<{<[<<()[]>(<>())>{[<>()][[]<>]}]([({}[]][<>()]][(<>())<()<>>])>({<[[]<>]>[[()()][[][]]]}<[<[]()
[<<({<{[[({[<((){})[{}]><<[][]>{()[]}>][<({}{})>[[{}()]{{}<>}]]}{{<<[]()>([]())>{{<>()}{<>[]}}
[({[({{(<(<{<<<>[]><<>()>>({()[]}{()[]})]>){(([[()()](<>{})]{([][])<()()>})(({()[]}<{}()>)[
{<(<{<{(({{[(<<>()>{<>[]})(({}())[[]()])]([({}())(<>{}}])}{{<{{}()}[[][]]>{{[]{}}<<>[]>}}}}{<[{<
[((<{{{([<<<[({}[])[()<>]]<{<><>}<<>[]>>>>>[(<{[{}]<[]()>}{[<>]<[][]>}>{{(()[])}(([][]){<>[]}
{<((<{(({{{<([[][]]{{}{}}){{[]{}}{[]<>}}>[{<{}()>([]<>)}(<[][]>{<>[]})]}<([[()[]]]{{()()}([][])})([{[][]}<{}
[{([(([<{([(<{[]{}}[()[]]>(([])[<><>]))])[[{(({}())<[]<>>)<({}())[()[]]]}([<()()>[<><>]](<[]<>><<>()>))](
{{[[[(((([[{[([]())[()>]}(<<()<>>({}<>)>[{<>[]}[()<>]])]<<[{[]()}{[]{}}]>({[{}{}]([]{})}[{(){}}{{}[]}])>]
[({[<(<[{[{({<<>{}>{{}{}]}[(<>())[<>{}]])(((<>[])<{}[]>)[<()()>[{}{}]])}[[<<{}<>>{{}[]}>[(<><
[{<((([{{{(<{[{}<>][[]<>]}]){[({{}<>})<<{}()>{{}{}}>]{<([]<>)<[]{}>>[<(){}>(<>[])]}}}(([{[<>]<[]()>}([<>{}][
{(([<{[[<({[<<<>{})([]<>)>[{[]()}(<><>)]][<(()[])>{(<>{}){[][]}}]}<{[([]())<[]{}>]<{[]()}(()
<{[{[<<{[(([{(<>{})<[][]>}<([]<>)(<><>)>](<[<>[]][[]<>]>[[[][]]({}[])])))]{[[{({<>}[()<>])[<[]<>>{[]()}]}(
{(<(({{(<{<[<<<>{}>[<>[]]>([[]][[][]))]([(<>{})({})])><[[{{}[]}({}[])][{<><>}<{}>]](<([][]){[]}><{[][]
{[[(({{({<(<(({}<>){{}}){([])({}{})}>)>}<<[([{<>[]}[[]<>]])<({[]()}[{}<>])<[{}{}][[][]]>>][{<
({[{[{[<([{{[[()()](<>{})]((<>{})(()<>))}[({[]()}({}{}))[<<><>>{(){}}]]}<((([]){()<>}))>])><<<
[{<({([<(([{[{[]<>}][(()<>)<<>[]>]}]<(<({}{})(()())>[([][])[(){}]]){<<()[]>>}>))<[{<[[[]{}]([]())][{{}{}}
{[(((<<{[[(([<[]()>(<><>)])(<<<>{}>[<>{}]>{<<>><[]<>>}))[{(<<>()>[[]<>])(([]<>){<><>})}[((<>)[[][]])(([]{})[[
{([<<{((({[[[(<>{})[()()]]]]<[([{}{}]<[]<>>){<<>[]><()[]>}]>}{<<{<()()>}>{{([]<>)[[]<>]}{<()[]>[[
<<[(<(<[({<{<([]())(<>[])>[{{}<>}((){})]}>{({(<>())({}<>)})}}{<{<(<>[])><{[]{}}<{}()>>}[{(())(()[])}[({}())<[
{{([{{<{{<[(<[[][]]{{}()}>)[<{[][]}<{}[]>}({{}()}{()()})]][{[[[]()]{()[]}]<{{}}([]())>}{(<
[<<{{<<<[[[({[{}()]}{<{}[]>(()())}){({[]<>}([]{}))<({}{})(<>())>}]{({<[]<>>([]<>}}{{[][]}[[
(({[[[{<(<{[[([][]){<>[]}]([[]<>])]<{[{}()]<{}[]>}[({}<>)<{}()>]>}[[(<<>[]>[<>()]){<()<>>{{}{}}
{<{([[<<(<<{<[()<>][()()]>[[()[]]({})]}>>)>>]])<{({<<[[<([(){}]<[]()>)<<[][]>[<><>]>]]]>[({[{<()<>><
{({([(([({{((<()()>([][])))}{{{<<>>}[[()<>](()())]}<{<<><>><{}[]>}>}})({<[{<{}{}>[<>()]}[{{}<>}[{}{}]]]({(
{{(<{<[[(<(<[(<><>){[]()}]>)(([<{}{}>[[]<>]][<<><>>(<>{})])<<[[][]]><<[]()>{<>}>>)><<{<({}{})[<><>]>}<
{[[[[{{(<<{<{{[]{}}<{}[]>}[<()[]>[<>[]]]>{([{}()])(<{}{}>{<>{}}]}}[<<{<>{}}<()()>>{[<>]}>{[(<>{})<()<>>]
((<[{<[({<({[(()())(<>[])]<[<><>]{[][]}>}([([])[{}()]]<{<>()}{{}<>}>))><([<([]{}){[]}>[{[]}[[][]]]
[<[<({[{{({<[(<><>)<[][]>](<<>{}>(<>()))>}(<<<{}{}>[{}<>]><<[]{}>[<><>]>>(((<>())<()>))))}}[{[(<[{()[]
[{<[<(<<{[<([<{}[]><<>()>][[[]()]<()[]>])>[(<[(){}][{}{}]>{[<>{}]<{}()]})]]({[(<<>>)<[{}<>]<[]{}>>]<<<(){}><
[<{<{<<<(((([<()>{<><>}][(()())[{}()]])[[{{}()}<()()>][{()}]])<(<<[][]>><<{}()>[{}[]]>)[([[][]][<>[]]
({{<[{[{(<<[((<>[])<[]()>)[[{}{}]({}{})]]>([[(()<>)<<>{}>]{(()<>)[{}()]}]{(([]())([]()))[[[]<>][<>{}]]})>
({<<[<{{[[([{<()<>>}])[<{<()[]>}[{(){}]<{}[]>]>[[[[][]]](<[]<>>{<><>})]]]<[{[([]{})<()()>]}(<({}<>){<
<([<<{(<({{{<({})(<><>)>{{<>[]}<[][]>}}<([()[]]({}{}))>}})>{{({[[{{}<>}]{[(){}][(){}]}]([{{}{}}({}{})][[
{[({<[<[([[<<({}{}){()[]}>{([]<>)}>{(({}<>)<[][]>)[{{}<>}(<>{})]}]])[({[(([]<>){<><>})(([]<>)<[
<[[[{<<({<{([<()[]><[]()>])<[{{}()}<()[]>](([]<>){[]()})>}>{[[(<{}()){<>{}})[<[]()><()<>>]]{[{[][]
{[(<{<{{{[(((({}[]){(){}})(<(){}>{{}<>})){([[]<>]{[]<>})[[<>{}]{<>()}]}){(([<><>][{}[]])([<>]
[<({[[[[{<<{[{[]()}<[][]>](<{}<>>[{}{}])}{({{}()}((){}))([()<>]<<>()>)}>>[<([{()()}{[]()}]{[<
{<{{([{<([<[{<(){}>(()[])}<<(){}>{{}{}}>][{[(){}](<>())}[{<><>}<[]{})]]>({({[]()}[[][]])<{<>()}<[]()
[{{<[{<((([{{<[]{}>[[]{}]}{<<><>>[<>[]]}}](({<<>{}><[]>}<(<>)>)[((<>{}){<>[]})[{{}<>}<[]()>]]
([<<{([<[<<([([]{})[{}()]]<(<><>)<()<>>>)><([{{}<>}[(){}]]([{}<>](<>{}))){<<[]<>>{()<>}>[<()<>>(<>)
{{({({(<{({<{[()()]{[]{}}}[<{}[]>]>{[{<>[]}{{}()}](<<>{}>[{}<>])}}[{<[{}{}]<<>[])>([{}[]]{{}[]})
<{((<([<[{([([<>{}]([]<>))]{{<{}[]>[[][]]}})([(<{}{}>{()<>})[[[]()][{}{}]]}[{{{}()}<<>()>}
[{<[<<({({<[{<<>[]><<>{}>}<{<><>}<{}()>>][([[]()]{<>{}})]>{(<[{}[]]([]<>)>}<<[{}[]][{}<>]>{{{}()}{<>[]
[{<<([([[{<((({}<>)[{}()])[{[]()}(<><>)])<[<()<>)(<>())]>>([((<>()))[[{}]([][])]]<([<>()]<()()>)>)}(([<{
(<(([{<{(<([[[<>[]]{[][]}][((){})]])([((()())({}{}))(<<><>>)]<([[]<>]((){}>)({[]{}}{<>()})>)>)({{{{[
{<<{{(<{[<{{<({}[])<{}[]>><([]())<{}<>>>}<([[]{}]<()<>>)>}>{<(([<>[]]([]()))<{{}{}}(<>[])>){[([]()
{{(({<{[{[[[([{}<>](()))]{{{{}{}}{<>{}}}[[{}{}]([]<>)]}][([(<><>)[[][]]])<<(()())(()<>)>[([]()){()
(<[{<<[<<[(<{{<>{}}{[]<>}}[{[][]}[()[]]]>[<(<>())((){})>{({}{}){[]<>}}])]]>((([(<[<>{}]{{}<>}>{(
(<<{{<[{[(<<<[{}{}]([][])>[{()<>}[{}]]>{({()[]})(<()<>>(()))}>)}}][[<([({<{}>[<>[]]}){({()[]}(()[])){
<(<([<<({[{(((<>[])<<><>>){{<>{}>}){{[()[]]<{}{}>}{({}{}){<>()}}}}[(<<<>{}>[{}{}]>(<()[]>[<><>])
[{[<<{[<(([[({<>{}}(<>))<<()()>[<>{}]>][{{[]{}}}<<<>()>({})>]]><{([(<><>)]<<(){}>{{}{}}>){{{{}[]}<<><>>}[[()
[[[[<{(({{(<<<{}><[]{}>>((()[])[{}()])><<{[]<>}{<>[]}>[(<>()){{}<>}]>)(({(<>())({}[])}){[<(){}><[]{}>][[
<{[[<{<[<<[{([()()]{()()})[{[]()){{}{}}]}][{({<>{}})<[()()]{[]()}>}<[[(){}][{}[]]]{{<>[]}}>]><(([(()())
{<<(<(([<<{[{<[][]>}{([]())[()<>]}]{[[<>]<[][]>](([]{})(()[]))})[<<[{}<>]{<>{}}>[([]<>)[{}[]]]><(
[([({([([{<({<<>{}>[{}]})<[({}{})({}{})][{{}()}(<>{})]>><{{([]{})([][])}[[{}[]]<<><>>]}<((<><>)[()
([[[[{{{{{{{<<(){}>{<><>}}{[{}[]]({}[])}}<({{}[]}[<>]){<<>{}>{()[]}}>}{{{(()[])}{{{}}}}{[([]())
(<{(({<<<{(<[<[][]>]<<{}<>>{{}{}}>><[{[]<>][<>[]]][[<><>]<[]()>]>)[(<([]{}){[]{}}>({{}{}})
<((({[(<<{({(([][])){[[]<>]}}<(({}{})({}{}))(<[]()>[()()])>)}>({(<[([]())[[]<>>]([[]{}]<[]<>>)><{{()[]}
<{(<<({[(({{({<>[]}(<>{}))<<()[]>{<><>}>}<<<()[]>[(){}]>>})<{({(<>[]){<>[]}}[[<><>]])<[(())(<>[])
[([<[{[[{({{({[]<>}{[]()})([{}{}](()<>))}{(<[]<>><<>[]>)}})}<<([<[<>()]<[][]>>([[][]]{[]{}})](<<()
<<<(<({[{[{{(<{}>[{}{}])(([][])[(){}])}{([{}<>](<>))}}]}[<<{<((){}){[]{}}>({{}<>}{[][]})}<{{()()}<<><>>}>>{((
<<<{{{((<[<<{<[]{}>}><[({}{})[[]<>]]>>[<([<>()](()))<(<><>)(()())>>[{<()<>>{()()}}]]]({(({[]{}}({}[])))<({{
[<{[{[[{{{[{({<>[]}<[][]>)[{(){}}{{}()}]}<[[()()][{}()]](({}<>)[()()])>]<({<{}<>>({})}([()<>])){[{()<
<{{{{([(([{{{<{}[]>(()[])}{({}[])({}[])}}}])<{({<({}<>]<<>{}>>[<()<>>({}())]}[<<[]()>[<>()]>(<()<>>{<>[]})])
((([({[<[[([([<>[]]<[]<>>)(<()<>>)]{[{<>)[()()]][([]()){[]<>}]})]][{((<[<>[]]{<>()}>[<()<>>[{
<[<{[[<[<<{{(<[]{}>){[()]({}{})}}(<[()[]]{[]()}>[<()[]>])}{{({[]<>>([]{})){{()<>}{<>[]}}}(<(<
<[<<<[{<[<[[{(()<>)[()<>]}]({{()<>}({}())}[[{}()]])][{([<>{}]){({}[])([]{})}}]>[[[<(<>{})<(){}>>]}]]
<<[[[{[<[(<<<{<><>}(()[])>{{()()}[()[]]}>>)[<{[<[]()>({}{})]{{{}[]}[[]]}}{{{[]<>}{()()}}}>[[[[(){}]({}<>)]{
<[<((<<<{<[({[[][]]<{}{}>})({{<>{}}[()<>]}(({}{})[[]()]))]({{(<><>)<<>()>}{[[]{}]}}({(()())[{}()