mirror of
https://github.com/Dummi26/mers.git
synced 2025-03-10 22:37:46 +01:00
22 lines
629 B
Plaintext
22 lines
629 B
Plaintext
![]() |
input := fs_read("/tmp/pin.txt").assume_no_enum().bytes_to_string().assume_no_enum()
|
||
|
|
||
|
fn get_pair(s string) {
|
||
|
list := s.regex("[^-]+").assume_no_enum()
|
||
|
[
|
||
|
list.get(0).assume1("A").parse_int().assume1("a")
|
||
|
list.get(1).assume1("B").parse_int().assume1("b")
|
||
|
]
|
||
|
}
|
||
|
|
||
|
count := 0
|
||
|
for pair input.regex(".+").assume_no_enum() {
|
||
|
s := pair.regex("[^,]*").assume_no_enum()
|
||
|
s1 := get_pair(s.get(0).assume1("bb"))
|
||
|
s2 := get_pair(s.get(1).assume1("aa"))
|
||
|
if { s1.0 <= s2.0 && s1.1 >= s2.1 } || { s1.0 >= s2.0 && s1.1 <= s2.1 } {
|
||
|
&count = count + 1
|
||
|
}
|
||
|
}
|
||
|
|
||
|
println("count: " + count.to_string())
|