A

# ruby
n, m, p = gets.split(' ').map(&:to_i)
 
a = n / p
if n % p > 0
    a += 1
end
b = m / p
if m % p > 0
    b += 1
end
puts a * b

B

n = gets.to_i
 
RC_PATTERN = /\AR(\d+)C(\d+)/
ABC_PATTERN = /\A([A-Z]+)(\d+)\z/
 
def cv_rc(value)
    v = 0
    for c in value.split('')
        v *= 26
        v += (c.ord - 'A'.ord + 1)
    end
    v
end
 
def cv_a(value)
    ('A'.ord + value - 1).chr
end
 
def cv_ab(value)
    return '' if value == 0
 
    cv_ab((value - 1) / 26) + cv_a((value - 1)% 26 + 1)
end
 
for i in 1..n
    v = gets.chomp 
    if v =~ RC_PATTERN
        m = RC_PATTERN.match(v)
        
        puts cv_ab(m[2].to_i) + m[1]
    else
        m = ABC_PATTERN.match(v)
            
        puts 'R' + m[2] + 'C' +  cv_rc(m[1]).to_s
    end
end

C

In codeforce, calculation error appears.

# Your code here!


class Point
    attr_accessor :x, :y

    def initialize(x, y)
        @x = x
        @y = y
    end
end

class PointGroup
    def initialize()
        @core = []
    end
    
    def push(point)
        @core.push(point)
    end
    
    def area
        @lengths = []
        for i in 1..3
            @lengths.push(Math::sqrt((@core[i % 3].x -  @core[(i + 1) % 3].x) ** 2 + (@core[i % 3].y -  @core[(i + 1) % 3].y) ** 2))
        end
        @lengths.sort!
        
        @radius = radius
        @min_deg = min_deg
        Math::PI * @radius * @radius * Math::sin(@min_deg) / @min_deg;
    end
    
    private
    
    def radius
        p = @lengths.sum() / 2
        s = Math::sqrt(@lengths.map {|l| p - l}.inject(:*) * p )
        @lengths.inject(:*) / 4 / s
    end
    
    def min_deg
        a = 2 * Math::asin(@lengths[0] / 2 / @radius)
        b = 2 * Math::asin(@lengths[1] / 2 / @radius)
        #c = 2 * Math::asin(@lengths[2] / 2 / @radius)
        c = Math::PI - a - b
        
        p = fgcd(c, fgcd(b, a))
        
        c = 2 * Math::asin(@lengths[2] / 2 / @radius)
        
        q = fgcd(c, fgcd(b, a))
        
        a = Math::PI - b - c
        
        r = fgcd(c, fgcd(b, a))
        
        a = 2 * Math::asin(@lengths[0] / 2 / @radius)
        b = Math::PI - a - c
        
        s = fgcd(c, fgcd(b, a))
        
        (p + q + r + s) / 4
    end
    
    def fgcd(a, b)
        a < 0.01 ? b : fgcd(b % a, a)
    end
end

group = PointGroup.new

for i in 1..3
    x, y = gets.split(' ').map(&:to_f)
    group.push(Point.new(x, y))    
end

puts group.area