main = do
let ls = [262734068,-1284266430,850241238,1854436759,925227574,1072391605,
1593098480,753973039,-1320460728,1653753372,1036510631,1372732547,
searchX :: Int32 -> Int32
searchX x
where
f :: Int32 -> Int32 -> Int32
f l r =
case p m of
0 -> m
1 -> f l m
-1 -> f (m + 1) r
_ -> 0
where
m = mid l r
p = aboutX x
aboutX :: Int32 -> Int32 -> Int32
aboutX x a =
EQ -> 0
GT -> 1
LT -> -1
mid x y
aW1wb3J0IERhdGEuSW50CgptYWluIDo6IElPICgpCm1haW4gPSBkbwogIGxldCBscyA9IFsyNjI3MzQwNjgsLTEyODQyNjY0MzAsODUwMjQxMjM4LDE4NTQ0MzY3NTksOTI1MjI3NTc0LDEwNzIzOTE2MDUsCiAgICAgICAgICAgIDE1OTMwOTg0ODAsNzUzOTczMDM5LC0xMzIwNDYwNzI4LDE2NTM3NTMzNzIsMTAzNjUxMDYzMSwxMzcyNzMyNTQ3LAogICAgICAgICAgICAyMDI3MjA5ODIyLDE1NzM2NjQ4NjgsIG1pbkJvdW5kLCBtYXhCb3VuZF0KICBwcmludCAkICg9PSBscykgJCBtYXAgc2VhcmNoWCBscwoKc2VhcmNoWCA6OiBJbnQzMiAtPiBJbnQzMgpzZWFyY2hYIHgKICB8IHAgMCA+IDAgICA9IGYgbWluQm91bmQgMAogIHwgb3RoZXJ3aXNlID0gZiAwIG1heEJvdW5kCiAgd2hlcmUKICAgIGYgOjogSW50MzIgLT4gSW50MzIgLT4gSW50MzIKICAgIGYgbCByID0KICAgICAgY2FzZSBwIG0gb2YKICAgICAgICAwICAtPiBtCiAgICAgICAgMSAgLT4gZiBsIG0KICAgICAgICAtMSAtPiBmIChtICsgMSkgcgogICAgICAgIF8gIC0+IDAKICAgICAgd2hlcmUKICAgICAgICBtID0gbWlkIGwgcgogICAgcCA9IGFib3V0WCB4CgphYm91dFggOjogSW50MzIgLT4gSW50MzIgLT4gSW50MzIKYWJvdXRYIHggYSA9CiAgY2FzZSBjb21wYXJlIGEgeCBvZgogICA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