class Yukicoder def initialize n, k = gets.chomp.split.map(&:to_i) max_val = 0 1.upto(n/2) do |num| max_val = [max_val, (n-num).gcd(num)].max end puts max_val end end Yukicoder.new