class Yukicoder def initialize l = gets.to_i limit = Math.sqrt(l) mod = 1000003 answer = 0 1.upto(limit-1) do |n| (n+1).upto(limit) do |m| if m.gcd(n) == 1 && [n,m].any?(&:even?) && (2*m*n + 2*m*m) <= l/4 answer += 1 end end end puts answer % mod end end Yukicoder.new