#!/usr/bin/env lua function bSearch(x,t) if #t==0 then return end local mid = math.max(1,math.floor(#t/2)) if x==t[mid] then return x end if x < t[mid] then return bSearch(x,table.pack(table.unpack(t,1,mid-1))) end if x > t[mid] then return bSearch(x,table.pack(table.unpack(t,mid+1))) end end local nrs={} for l in io.lines(arg[2]) do for nr in l:gmatch("-?%d+") do table.insert(nrs,tonumber(nr)) end end print(bSearch(tonumber(arg[1]), nrs) and 1 or 0) --[[ run