Codeforces Round #169 (Div. 2)

http://www.codeforces.com/contest/276

A, B問題だけ。

A. Lunch Rush

n, k = gets.chomp.split(" ").map{ |e| e.to_i }

ans = -10000000000
n.times do
 f, t = gets.chomp.split(" ").map{ |e| e.to_i }
 tmp = nil
 if t > k
   tmp = f - (t - k)
 else
   tmp = f
 end
 ans = tmp if ans < tmp
end

puts ans

B. Little Girl and Game

chars = gets.chomp.split("")

hash = Hash.new 0
chars.each do |char|
  hash[char] += 1
end

odds = 0
hash.each do |key, value|
  odds += 1 if value % 2 == 1
end

puts (odds == 0 or odds % 2 == 1) ? "First" : "Second"