@"imports"@
$stdout.sync = true
@"declarations"@
@"global"@
while line = $stdin.gets(chomp: true) do
n = Integer(line)
if n == 0 then
puts "0 nsec"
exit
end
@"sample"@
start_nsec = Process.clock_gettime(Process::CLOCK_MONOTONIC, :nanosecond)
1.upto n do
@"timed"@
end
end_nsec = Process.clock_gettime(Process::CLOCK_MONOTONIC, :nanosecond)
elapsed_nsec = end_nsec - start_nsec
puts "#{elapsed_nsec} nsec"
end