Problem:
Score : 100 points

Problem Statement

Three poles stand evenly spaced along a line. Their heights are a, b and c meters, from left to right.
We will call the arrangement of the poles beautiful if the tops of the poles lie on the same line, that is, b-a = c-b.

Determine whether the arrangement of the poles is beautiful.

Constraints

1 \leq a,b,c \leq 100

a, b and c are integers.

Input

Input is given from Standard Input in the following format:

a b c

Output

Print YES if the arrangement of the poles is beautiful; print NO otherwise.

Sample Input 1

2 4 6

Sample Output 1

YES

Since 4-2 = 6-4, this arrangement of poles is beautiful.

Sample Input 2

2 5 6

Sample Output 2

NO

Since 5-2 \neq 6-5, this arrangement of poles is not beautiful.

Sample Input 3

3 2 1

Sample Output 3

YES

Since 1-2 = 2-3, this arrangement of poles is beautiful.

Solution in JavaScript (node.js v5.12) (judge verdict: Runtime Error)

function Main( input ){

    input = input.split( '\n' )

    var mn = input[0].split( ' ' )
    
    var n = mn[0],
        m = mn[1]
    
    var area = []
    
    var x = input[1].split( ' ' )
    var y = input[2].split( ' ' )
    
    var result = []

    
    var _x, _y
    var x1, x2, y1, y2
    
    _x = x.concat()
    for( ;_x.length!==1; ){
        x1 = _x.shift()
        x2 = _x[0]
        
        _y = y.concat()
        for( ;_y.length!==1; ){
            y1 = _y.shift()
            
            for( var i=0; i<_y.length; i++ ){
                y2 = _y[i]
                result.push( ( y2-y1 ) * (x2-x1) )
            }
        }
    }
    
    
    
    
    _x = x.concat()
    for( ;_x.length!==1; ){
        x1 = _x.pop()
        x2 = _x[_x.length-1]

        _y = y.concat()
        for( ;_y.length!==1; ){
            y1 = _y.pop()

            for( var i=_y.length-2; i>0; i-- ){
                y2 = _y[i]
                result.push( ( y2-y1 ) * (x2-x1) )
            }
        }
    }
    
    
    
    
    
    
    _y = y.concat()
    for( ;_y.length!==1; ){
        y1 = _y.shift()
        y2 = _y[0]

        _x = x.concat()
        for( ;_x.length!==1; ){
            x1 = _x.shift()
            
            for( var i=0; i<_x.length; i++ ){
                x2 = _x[i]
                result.push( ( y2-y1 ) * (x2-x1) )
            }
        }
    }
    
    _y = y.concat()
    for( ;_y.length!==1; ){
        y1 = _y.pop()
        y2 = _y[_y.length-1]

        _x = x.concat()
        for( ;_x.length!==1; ){
            x1 = _x.pop()

            for( var i=_x.length-2; i>0; i-- ){
                x2 = _x[i]
                result.push( ( y2-y1 ) * (x2-x1) )
            }
        }
    }
    
    
    

    var sum = 0
    for( var i=0; i<result.length; i++ ){
        sum += result[i]
    }
    
    console.log( sum % 1000000007 )
    
}

Main( require( 'fs' ).readFileSync( '/dev/stdin', 'utf8' ) )