jiahuimbzuai/CoQuIR huggingface dataset:
//  [rust]
use std::io::{stdout, Write, BufWriter};

macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let mut s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};

    ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {
        let mut $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    };
}

macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };

    ($iter:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
    };

    ($iter:expr, chars) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };

    ($iter:expr, usize1) => {
        read_value!($iter, usize) - 1
    };

    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}

fn main() {
    input!{ n: i32 }
    let a = ((n as f64) / 1.08).ceil() as i32;
    let b = (((n + 1) as f64) / 1.08).ceil() as i32;
    for i in a..b {
        if ((i as f64) * 1.08).floor() as i32 == n {
            println!("{:?}", i);
            return;
        }
    }
    println!(":(");
}
//  [rust]
use proconio::input;

fn main() {
    input! {
        n: i32,
    }

    let mut ans = None;
    for i in 1..=n {
        if 108 * i / 100 == n {
            ans = Some(i);
            break;
        }
    }

    if let Some(x) = ans {
        println!("{}", x);
    } else {
        println!(":(");
    }
}
//  [rust]
macro_rules! input {(source = $s:expr, $($r:tt)*) => {let mut iter = $s.split_whitespace();input_inner!{iter, $($r)*}};($($r:tt)*) => {let mut s = {use std::io::Read;let mut s = String::new();std::io::stdin().read_to_string(&mut s).unwrap();s};let mut iter = s.split_whitespace();input_inner!{iter, $($r)*}};
}

macro_rules! input_inner {($iter:expr) => {};($iter:expr, ) => {};($iter:expr, $var:ident : $t:tt $($r:tt)*) => {let $var = read_value!($iter, $t);input_inner!{$iter $($r)*}};
}

macro_rules! read_value {($iter:expr, ( $($t:tt),* )) => {( $(read_value!($iter, $t)),* )};($iter:expr, [ $t:tt ; $len:expr ]) => {(0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()};($iter:expr, chars) => {read_value!($iter, String).chars().collect::<Vec<char>>()};($iter:expr, usize1) => {read_value!($iter, usize) - 1};($iter:expr, $t:ty) => {$iter.next().unwrap().parse::<$t>().expect("Parse error")};
}

const TAX: f64 = 1.08;
const TAX_INV: f64 = 1.0/1.08;

fn main() {
    input!{
        n: usize,
    }
    let notax = (n as f64) * TAX_INV;
    let notax_ceil = notax.ceil();
    let notax_floor = notax.floor();
    if n == (notax_ceil*TAX) as usize {
        println!("{}", notax_ceil as usize);
    } else if n == (notax_floor*TAX) as usize {
        println!("{}", notax_floor as usize);
    } else {
        println!(":(");
    }
}
//  [swift]
import Foundation

let N = Int(readLine()!)!

func ans(N: Int) -> String {
    for i in 0..<50001 {
        if Int((Double(i)*1.08).rounded(.down)) == N {
            return String(i)
        }
    }
    return ":("
}

print(ans(N: N))
//  [swift]

let n=Int(readLine()!)!
var i = 0
for i in 1...50000 {
  if Int(Double(i) * 1.08) == n {
    print(i)
    break
  } else if Int(Double(i) * 1.08) >= n {
    print( ":(" )
    break
  }
}
//  [typescript]
function main(input: string) {
  const N = parseInt(input);
  const genka = Math.floor(N / 1.08);
  const genka2 = genka + 1;
  console.log(Math.floor(genka * 1.08) === N ? genka : Math.floor((genka2) * 1.08) === N ? genka2 : ":(");
}

main(
  require("fs")
    .readFileSync("/dev/stdin", "utf8")
    .trim()
);
//  [typescript]
{
  const main = (input: string) => {
    const r = reader(input)
    const n = r.n()

    const base = Math.floor(n / 1.08)
    const checks = [-2, -1, 0, 1, 2]
    const res = checks
      .map(v => v + base)
      .some(v => {
        if (Math.floor(v * 1.08) === n) {
          console.log(v)
          return true
        }
        return false
      })
    if (!res) {
      console.log(':(')
    }
  }

  // const values = obj => Object.keys(obj).map(e => obj[e]);

  const reader = (str: string) => {
    const lines = str.trim().split('\n')
    const s = () => lines.shift() || ''
    const n = () => Number(s())

    const ss = () => s().split(' ')
    const ns = () => ss().map(Number)
    return { lines, s, n, ss, ns }
  }

  const getInput = () => require('fs').readFileSync('/dev/stdin', 'utf8')
  main(getInput())
}
//  [typescript]
const input=require('fs').readFileSync('/dev/stdin','utf8').split(/[\s]/);let input_i=-1;const tn=():number=>{input_i++;return Number(input[input_i])};const tnn=(n:number):number[]=>{const a=[];for(let i=0;i<n;i++){a.push(tn())}return a};const ts=():string=>{input_i++;return String(input[input_i])};const tss=(n:number):string[]=>{const a=[];for(let i=0;i<n;i++){a.push(ts())}return a};const to=(...arg)=>{console.log(...arg)};const abs=(a)=>{return Math.abs(a)};const min=(...a)=>{return Math.min(...a)};const max=(...a)=>{return Math.max(...a)};const floor=(a)=>{return Math.floor(a)};const asc=(ar:number[])=>{const t=[...ar];return ar.sort((a,b)=>{return a-b})};const desc=(ar:number[])=>{const t=[...ar];return t.sort((a,b)=>{return b-a})};const sw=(a,arr:any[],op:'=='|'>='|'>'|'<='|'<'='==')=>{for(let i=0;i<arr.length-1;i+=2){if(eval(a+op+arr[i])){return arr[i+1]}}return arr[arr.length-1]};const near=(n:number,arr:number[]):number=>{let ne=arr[0],ni=0;for(let i=1;i<arr.length;i++){if(Math.abs(n-ne)>Math.abs(n-arr[i])){ne=arr[i];ni=i}}return ni};const deduplicate=(a:any[]):any[]=>{return Array.from(new Set(a))}
const main=()=>{
  let n=tn()
  let a=floor(n*0.92)
  for(let i=a;floor(i*1.08)<=n;i++){
    if(floor(i*1.08)==n){
      to(floor(i))
      return
    }
  }
  to(':(')
}
main()
//  [typescript]
import * as fs from 'fs'

const reader = (data: string) =>
  data
    .split('\n')
    .join(' ')
    .split(' ')
    .map(t => parseInt(t, 10))

function Main(input) {
  const [N] = reader(input)
  const genka = Math.floor((N + 0.999) / 1.08)
  if (N === Math.floor(genka * 1.08)) {
    console.log(genka)
  } else {
    console.log(':(')
  }
}

Main(fs.readFileSync('/dev/stdin', 'utf8'))
//  [typescript]
"use strict";
const Main = (input) =>{
   let xs = input.trim().split(' ').map(v=>parseInt(v,10));
   let N = xs[0];
   let tax = 1.08;
   let ans1 = [];
   let ans2 = 0;
  
   for(let i=0; i<=N; i++){
      ans1.push(Math.floor(i*tax));
      if(ans1[i]==N){
        ans2 = Math.ceil(N/tax);
        break;
      }else{
        ans2 = -1;
      }
   }
   if(ans2==-1){
     console.log(":(")
   }else{
     console.log(ans2);
   }
}
Main(require('fs').readFileSync('/dev/stdin','utf8'));
//  [typescript]
import * as fs from "fs";

let N = Number.parseInt(fs.readFileSync("/dev/stdin", "utf8"));


function solve() {
	for(let x=1; x<50001; x++) {
		if (Math.floor(1.08*x) == N) {
			return x;
		}
	}
	return ':(';
}

console.log(solve())
//  [python]
N = int(input())
A = list(map(int, input().split(" ")))
# 割り切れる
if sum(A)%len(A) == 0:
  avrA = sum(A)/len(A)
# 割り切れない
else:
  if (sum(A) / len(A)) < (sum(A) // len(A) + 0.5):
    avrA = sum(A) // len(A)
  else:
    avrA = sum(A) // len(A) +1

dst = 0
for i in A:
  dst += (i-avrA)**2
print(int(dst)) 

#print(int(avrA))
//  [python]
n=int(input())
a=list(map(int,input().split()))
y=round(sum(a)/n)
ans=n*y*y-2*y*sum(a)
for x in a:
  ans+=x*x
print(ans)
//  [python]
n = int(input())
s = list(map(int, input().split()))
total = sum(s)
lower_mean = total // n
upper_mean = total // n + 1
r1 = sum([(x-lower_mean) ** 2 for x in s])
r2 = sum([(x-upper_mean) ** 2 for x in s])
r = min(r1, r2)
print(r)
//  [python]
import numpy as np
import math
N = int(input())

a = np.array(list(map(int, input().split())))

c = round(a.mean())

res = int(0)

for i in a:
    res += (c - i) ** 2

print(int(res))
//  [python]
import re
import doctest
import functools

class IO_for_Contest(object):
    @staticmethod
    def my_input():
        #return raw_input()
        return input()

    @staticmethod
    def read_from_input():
        n = IO_for_Contest.read_int()
        return IO_for_Contest.read_n_int(n)

    @staticmethod
    def read_line():
        return IO_for_Contest.my_input().strip()

    @staticmethod
    def read_int():
        return int(IO_for_Contest.my_input().strip())

    @staticmethod
    def read_n_int(n):
        return list(map( \
                int, \
                re.split('\s+', IO_for_Contest.my_input().strip())))[ : n]
def solve():
    a = IO_for_Contest.read_from_input()
    print(think_min_cost_for(a))

def think_min_cost_for(arr):
    """
    >>> think_min_cost_for([4, 8])
    8
    """
    ceil = 100
    floor = -100
    cost = []
    for to in range(floor, ceil + 1):
        cost.append(think_min_cost_about(arr, to))
    return min(cost)

def think_min_cost_about(arr, to):
    diff = list(map(lambda x: x - to, arr))
    diff_2 = list(map(lambda x: x ** 2, diff))
    return sum(diff_2)

if __name__ == '__main__':
    #doctest.testmod()
    solve()
//  [python]
import numpy as np
n = int(input())
arr = np.array(list(map(int,input().split())))
rmean = round(sum(arr)/len(arr))
cost = sum((arr-rmean)**2)
print(int(cost))
//  [java]
import java.util.*;
import java.io.*;

public class Main {
    static BufferedReader br = new BufferedReader(new InputStreamReader(System.in), 32768);
    static PrintWriter out = new PrintWriter(System.out);
    static StringTokenizer t;

    static String sn() {
        while (t == null || !t.hasMoreTokens()) {
            try {
                t = new StringTokenizer(br.readLine());
            } catch (IOException e) {
                throw new RuntimeException();
            }
        }
        return t.nextToken();
    }

    static int ni() {
        return Integer.parseInt(sn());
    }

    static long nlo() {
        return Long.parseLong(sn());
    }

    public static void main(String args[]) {
        int t = 1;//ni();
        while (t-- > 0) {
            solve();
        }
        out.close();
    }

    static long mod = (long) 1e9 + 7;

    static long pro(long a, long b) {
        return (a % mod * b % mod) % mod;
    }

    static int maxn = 200005;

    static void solve() {
        int n = ni();
        int a[] = new int[n];
        HashSet<Integer> set = new HashSet<>();
        for (int i = 0; i < n; i++) {
            a[i] = ni();
            set.add(a[i]);
        }
        if (set.size() == 1) {
            out.println(0);
            return;
        }
        int ans = Integer.MAX_VALUE;
        for (int i = -100; i <= 100; i++) {
            int sum = 0;
            for (int j = 0; j < n; j++) {
                sum += (a[j] - i) * (a[j] - i);
            }
            if (sum < ans)
                ans = sum;

        }
        out.println(ans);
    }
}
//  [java]
import java.util.*;
import java.io.*;

public class Main {
    
	public static void main(String[] args) {
		InputReader in = new InputReader(System.in);
	    int n = in.readInt(); 
	    int arr[] = new int[n];
	    for(int i = 0; i<n; i++) arr[i] = in.readInt();
	    long ans = Long.MAX_VALUE;  
	    for(int t = -100; t<=100; t++) {
	    	long cost = 0; 
	    	for(int i = 0; i<n; i++) {
	    		cost += (int)Math.pow(arr[i] - t, 2);
	    	}
	    	ans = Math.min(ans, cost); 
	    }
	    System.out.println(ans); 
	}
}

class InputReader {

	private InputStream stream;
	private byte[] buf = new byte[1024];
	private int curChar;
	private int numChars;
	private SpaceCharFilter filter;

	public InputReader(InputStream stream) {
		this.stream = stream;
	}

	public int read() {
		if (numChars == -1)
			throw new InputMismatchException();
		if (curChar >= numChars) {
			curChar = 0;
			try {
				numChars = stream.read(buf);
			} catch (IOException e) {
				throw new InputMismatchException();
			}
			if (numChars <= 0)
				return -1;
		}
		return buf[curChar++];
	}

	public int readInt() {
		int c = read();
		while (isSpaceChar(c))
			c = read();
		int sgn = 1;
		if (c == '-') {
			sgn = -1;
			c = read();
		}
		int res = 0;
		do {
			if (c < '0' || c > '9')
				throw new InputMismatchException();
			res *= 10;
			res += c - '0';
			c = read();
		} while (!isSpaceChar(c));
		return res * sgn;
	}

	public String readString() {
		int c = read();
		while (isSpaceChar(c))
			c = read();
		StringBuilder res = new StringBuilder();
		do {
			res.appendCodePoint(c);
			c = read();
		} while (!isSpaceChar(c));
		return res.toString();
	}

	public long readLong() {
		int c = read();
		while (isSpaceChar(c)) {
			c = read();
		}
		int sgn = 1;
		if (c == '-') {
			sgn = -1;
			c = read();
		}
		long res = 0;
		do {
			if (c < '0' || c > '9') {
				throw new InputMismatchException();
			}
			res *= 10;
			res += c - '0';
			c = read();
		} while (!isSpaceChar(c));
		return res * sgn;
	}
	
	public boolean isSpaceChar(int c) {
		if (filter != null)
			return filter.isSpaceChar(c);
		return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
	}

	public String next() {
		return readString();
	}

	public interface SpaceCharFilter {
		public boolean isSpaceChar(int ch);
	}
}
//  [java]
import java.util.*;
import java.io.*;
class Main {
    public static void main(String[] args) {
        FastScanner sc = new FastScanner();
        int N = sc.nextInt();
        int[] a = new int[N];
        long sum = 0;
        for(int i = 0; i< N; i++) {
            a[i] = sc.nextInt();
            sum += a[i];
        }
        double x = (double)sum/(double)N;
        if(x>=0) x += 0.5;
        else x -= 0.5;
        long y = (long)x;
        System.err.println(y);
        long cost = 0;
        for(int i = 0; i<N; i++) {
            cost += Math.pow(y-a[i],2);
        }
        System.out.println(cost);
    }
}
class FastScanner {
    private final InputStream in = System.in;
    private final byte[] buffer = new byte[1024];
    private int ptr = 0;
    private int buflen = 0;
    private boolean hasNextByte() {
        if (ptr < buflen) {
            return true;
        } else {
            ptr = 0;
            try {
                buflen = in.read(buffer);
            } catch (IOException e) {
                e.printStackTrace();
            }
            if (buflen <= 0) {
                return false;
            }
        }
        return true;
    }
 
    private int readByte() {
        if (hasNextByte())
            return buffer[ptr++];
        else
            return -1;
    }
 
    private boolean isPrintableChar(int c) {
        return 33 <= c && c <= 126;
    }
 
    public boolean hasNext() {
        while (hasNextByte() && !isPrintableChar(buffer[ptr]))
            ptr++;
        return hasNextByte();
    }
 
    public String next() {
        if (!hasNext())
            throw new NoSuchElementException();
        StringBuilder sb = new StringBuilder();
        int b = readByte();
        while (isPrintableChar(b)) {
            sb.appendCodePoint(b);
            b = readByte();
        }
        return sb.toString();
    }
 
    public long nextLong() {
        if (!hasNext())
            throw new NoSuchElementException();
        long n = 0;
        boolean minus = false;
        int b = readByte();
        if (b == '-') {
            minus = true;
            b = readByte();
        }
        if (b < '0' || '9' < b) {
            throw new NumberFormatException();
        }
        while (true) {
            if ('0' <= b && b <= '9') {
                n *= 10;
                n += b - '0';
            } else if (b == -1 || !isPrintableChar(b)) {
                return minus ? -n : n;
            } else {
                throw new NumberFormatException();
            }
            b = readByte();
        }
    }
 
    public int nextInt() {
        long nl = nextLong();
        if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE)
            throw new NumberFormatException();
        return (int) nl;
    }
 
    public double nextDouble() {
        return Double.parseDouble(next());
    }
}
//  [java]
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.Scanner;
import java.util.stream.IntStream;

public class Main {
	static PrintWriter out = new PrintWriter(System.out);
	public static void main(String[] args) {
		// 入力
		final int n;	// 1≦N≦100
		final int[] a;	// −100≦ai≦100
		try(Scanner scan = new Scanner(System.in)) {
			n = scan.nextInt();
			a = new int[n];
			for (int i = 0; i < n; i++) {
				a[i] = scan.nextInt();
			}
		}
		
		// 数値が小さいのでそのまま全列挙計算したほうが速い。
		
		int result = IntStream.rangeClosed(-100, 100)
				.map(y -> Arrays.stream(a).map(e -> (e-y)*(e-y)).sum())
				.min().getAsInt();
		
		// 出力
		out.println(result);
		out.close();
	}

}
//  [java]
import java.util.Arrays;
import java.util.HashSet;
import java.util.LinkedList;
import java.util.Scanner;
import java.util.Set;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		final int N = sc.nextInt();
		long[] arr = new long[N];
		for(int i = 0; i < N; i++){
			arr[i] = sc.nextLong();
		}
		
		final long sum = Arrays.stream(arr).sum();
		final long lo_avg = sum / N;
		final long hi_avg = (sum + N - 1) / N;
		
		long lo_answer = 0, hi_answer = 0;
		for(int i = 0; i < N; i++){
			lo_answer += (arr[i] - lo_avg) * (arr[i] - lo_avg);
			hi_answer += (arr[i] - hi_avg) * (arr[i] - hi_avg);
		}
		
		System.out.println(Math.min(lo_answer, hi_answer));
		
		
	}

}
//  [cpp]
#include <iostream>
#include <vector>
#include <cmath>

double grad(std::vector<int>, double);

int main(void)
{
  int N;
  std::cin >> N;
  int temp;
  std::vector<int> a;
  double ave=0;
  for(int ii=0;ii<N;ii++){
    std::cin >> temp;
    a.push_back(temp);
    ave += temp;
  }
  ave /= N;
  
  while(fabs(grad(a, ave))>0.001){
    ave = ave-0.1*grad(a, ave);
  }
  
  if(ave-(int)ave<0.5){
    ave=(int)ave;
  }else{
    ave=(int)ave+1;
  }
  
  int cost=0;
  for(int ii=0;ii<N;ii++){
    cost += pow(a[ii]-ave, 2);
  }
  
  std::cout << cost << std::endl;
  
  return 0;
}

double grad(std::vector<int> a, double ave)
{
  double sum=0;
  for(int ii=0;ii<a.size();ii++){
    sum += ave-a[ii];
  }
  return sum;
}
//  [cpp]
#include <bits/stdc++.h>
using namespace std;

int main(){
  int N; cin >> N;
  vector<int> a(N);
  int sum = 0;
  
  for(int i = 0; i < N; i++){
    cin >> a.at(i);
    sum += a.at(i);
  }
  
  int mean = sum / N;
  int cost1 = 0, cost2 = 0;
  
  for(int i = 0; i < N; i++){
    cost1 += (a.at(i) - mean) * (a.at(i) - mean);
    cost2 += (a.at(i) - (mean + 1)) * (a.at(i) - (mean + 1));
  }
  
  
  cout << min(cost1, cost2) << endl;
}
//  [cpp]
#include <algorithm>
#include <climits>
#include <cmath>
#include <cstdio>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
#define REP(var, a, b) for (int var = (a); var < (b); var++)
#define rep(var, n) for (int var = 0; var < (n); ++var)
#define ALL(c) (c).begin(), (c).end()
#define rALL(c) (c).rbegin(), (c).rend()

ll MOD = 1000000007;
ll lcm(ll a, ll b) { return (a / __gcd(a, b) * b); }

int main() {
  //
  int n;
  cin >> n;
  ll ans = INT_MAX;
  vi a(n);
  rep(i, n) cin >> a[i];
  REP(x, -100, 101) {
    ll total = 0;
    rep(i, n) { total += (x - a[i]) * (x - a[i]); }
    ans = min(total, ans);
  }
  cout << ans << endl;
  return 0;
}
//  [cpp]
# include <bits/stdc++.h>

using namespace std;

#define pii pair<int, int>
#define pll pair<ll, ll>

#define pb push_back
#define eb emplace_back
#define mp make_pair

#define fi first
#define se second

typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;

const int inf = (int)1e9 + 7;
const int maxn = (int)6e5 + 7;
const int lmaxn = (int)6e6 + 7;
const ll linf = (ll)1e16 + 7;

const ld eps = ld(1e-11);

const ll dx[] = {-1, 0, 0, 1};
const ll dy[] = {0, -1, 1, 0};

ll gcd(ll a, ll b){
    while(b) a %= b, swap(a, b);
    return a | b;
}

ll lcm(ll a, ll b){
    return a * b / gcd(a, b);
}

ll n, mn = linf;
ll a[maxn];

int main(){
    scanf("%lld", &n);
    for(ll i = 1; i <= n; ++i){
        scanf("%lld", &a[i]);
    }
    for(ll i = -200; i <= 200; ++i){
        ll ans = 0;
        for(ll j = 1; j <= n; ++j)
            ans += (a[j] - i) * (a[j] - i);
        mn = min(mn, ans);
    }
    printf("%lld", mn);
    return 0;
}
//  [cpp]
#include <iostream>
using namespace std;

const int N = 100;

int main(){
	int a[N], n, cost = 1e9 + 7;
	cin >> n;
	for(int i = 0;i < n;++i){
		cin >> a[i];
	}
	for(int i = -N;i <= N;++i){
		int c = 0;
		for(int j = 0;j < n;++j){
			c += (i - a[j]) * (i - a[j]);
		}
		if(c < cost){
			cost = c;
		}
	}
	cout << cost << endl;
}
//  [cpp]
#include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define all(v) v.begin(), v.end()
#define mem(arr) memset(arr, 0, sizeof(arr))
#define ff first
#define ss second
#define int long long int
const int MOD = 1e9 + 7;
const int INF = 1e18;
const int N = 1e6 + 1;
vector<int> g[N];
vector<int> vis(N);
int32_t main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    int tc = 1;
    while(tc--){
        int n;
        cin >> n;
        int a[n];
        for(int &it : a){
            cin >> it;
        }
        int ans = INF;
        for(int i = -100; i <= 100; i++){
            int curr = 0;
            for(int &j : a){
                curr += (i - j) * (i - j);
            }
            ans = min(ans, curr);
        }
        cout << ans << '\n';
    }
}
//  [c]
# include"stdio.h"
# include"math.h"
int main(){
    int n;
    scanf("%d",&n);
    double sum=0;
    int a[n];
    for(int i=0;i<n;i++){
        scanf("%d",&a[i]);
        sum += a[i];
    }
    int med = (int)round(sum/n);
    int sc=0;
    for(int i=0;i<n;i++){
        sc += (med-a[i])*(med-a[i]);
    }
    printf("%d\n",sc );

}
//  [c]
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <stdint.h> // int64_t

#define max(a,b) ((a) > (b) ? (a) : (b))
#define min(a,b) ((a) > (b) ? (b) : (a))

int get_int(void) {
  int num;
  scanf("%d", &num);
  return num;
}

// <arr[0]> <arr[1]> .. <arr[size-1]>
int fget_array(int *arr, int size) {
    int i;
    for(i = 0; i < size; i++) {
        scanf("%d", &arr[i]);
    }
    return 0;
}

#define NUM_MAX 100
#define INF (1e+9)

int main(void) {
    int num = get_int();
    static int arr[NUM_MAX];
    fget_array(arr, num);

    int i;
    int sum = 0;
    for(i = 0; i < num; i++) {
        sum += arr[i];
    }
    int ave = sum / num;
    int n;
    int mmin = INF;
    for(n = ave-1; n <= ave+1; n++) {
        int res = 0;
        for(i = 0; i < num; i++) {
            res += (arr[i] - n) * (arr[i] - n);
        }
        mmin = min(res, mmin);
    }
    printf("%d\n", mmin);
    return 0;
}
//  [c]
#include <stdio.h>

int main(){
  int n,i,average=0,result_f=0,result_c=0;
  int a[100];
  
  scanf("%d",&n);
  for(i=0;i<n;i++){
    scanf("%d",&a[i]);
    average+=a[i];
  }
  
  average=average/n;
  
  //average by floor
  for(i=0;i<n;i++){
    result_f+=(average-a[i])*(average-a[i]);
  }
  
  //average by ceil
  for(i=0;i<n;i++){
    result_c+=(average+1-a[i])*(average+1-a[i]);
  }
  
  if(result_f<=result_c){
    printf("%d",result_f);
  } else {
    printf("%d",result_c);
  }
}
//  [c]
#include<stdio.h>
int main(){
    int n;
    scanf("%d",&n);
    int a[n],i;
    int av=0,cost1=0,cost2=0;
    for(i=0;i<n;i++){
        scanf("%d",&a[i]);
        av += a[i];
    }
    av /= n;
    int av2= av+1; 
    for(i=0;i<n;i++){
       cost1 += (a[i]-av)*(a[i]-av);
       cost2 += (a[i]-av2)*(a[i]-av2);
        
    }
    printf("%d",(cost1<cost2?cost1:cost2));
    return 0;
}
//  [c]
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <stdbool.h>
#include <math.h>

int main(void){

    int N;

    scanf("%d", &N);

    int a[N];

    for(int i = 0; i < N; i++){
        scanf("%d", &a[i]);
    }

    int c, min = 1000000000;

    for(int i = -100; i <= 100; i++){
        c = 0;
        for(int j = 0; j < N; j++){
            c += (a[j] - i) * (a[j] - i);
        }
        if(c < min){
            min = c;
        }
    }

    printf("%d\n", min);

    return 0;
}
//  [c]
int main(){
    int N;
    scanf("%d",&N);
 
    int a[N];
    for(int i=0;i<N;i++){
        scanf("%d",&a[i]);
    }
 
    int temp,min;
    for(int i=-100;i<=100;i++){
      int sum=0;
      for(int j=0;j<N;j++){
        sum+=(a[j]-i)*(a[j]-i);
      }
      if(i==-100){
        min=sum;
        temp=sum;
      }else{
        temp=sum;
      }
      if(temp<min){
        min=temp;
      }
    }
    printf("%d\n",min);
    return 0;
}
//  [javascript]
function Main(input) {
  input = input.split("\n");
  var n = parseInt(input[0].split(" ")[0]);
  temp = input[1].split(" ");
  a = new Array(n).fill(0);
  for(i=0;i<n;i++){
    a[i]=parseInt(temp[i]);
  }
  var ans =0;
  var m=0;
  for(i=0;i<n;i++){
    m+=a[i];
  }
  var l = Math.round(m/n);
  for(i=0;i<n;i++){
    ans+=Math.pow(a[i]-l,2);
  }

  console.log('%s', ans);
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));
//  [javascript]
'use strict';
function Main(input) {

  const n = Number(input[0]);
  const ary = (input[1].split(" ")).map(str => Number(str));
  const sum = ary.reduce((a,b) => a+b);
  const average = Math.round(sum/n);

  let result = 0;
  for (let i=0; i<n; i++) {
    result += (ary[i]-average)*(ary[i]-average);
  }

  console.log(result);

}
Main(require("fs").readFileSync("/dev/stdin", "utf8").split("\n"));
//  [javascript]
function main(input) {
    const numbers = input.split("\n")[0];
    const list = input.split("\n")[1].split(" ").map(v => Number(v));

    const maxList = Math.max(...list);
    const minList = Math.min(...list);
    const calcCost = (org, mod) => (org - mod) ** 2;

    const costs = [];
    for (let testNumber = minList; testNumber <= maxList; testNumber++) {
        let cost = 0;
        for (let i = 0; i < list.length; i++) {
            cost += calcCost(list[i], testNumber);
        }
        costs.push({ testNumber, cost });
    }
    let costsSort = costs.sort((a, b) => a.cost - b.cost)
    // console.log('costsSort', costsSort);
    console.log(costsSort[0].cost);

}

// let input = "2"+ '\n' + "4 8"; //8
// let input = "3" + '\n' + "1 1 3"; //3
// let input = "3" + '\n' + "4 2 5"; //5
// let input = "4" + '\n' + "-100 -100 -100 -100"; //0

// main(input);
main(require("fs").readFileSync("/dev/stdin","utf8"));
//  [javascript]
process.stdin.resume();
process.stdin.setEncoding('ascii');

var input_stdin = "";
var input_stdin_array = "";
var input_currentline = 0;

process.stdin.on('data', function (data) {
    input_stdin += data;
});
/*
process.on('SIGINT', function(){
    input_stdin_array = input_stdin.split("\n");
    main();
    process.exit();
});
*/
process.stdin.on('end', function () {
    input_stdin_array = input_stdin.split("\n");
    main();    
});

function readLine() {
    return input_stdin_array[input_currentline++];
}

/////////////// ignore above this line ////////////////////


function main() {
	var s = readLine();	
	var N = parseInt(s);
    s = readLine().split(" ");
	for (var i=0; i < N; i++){
		s[i]=parseInt(s[i]);
	}
	
	var ans = 200*200*200+1;
	
	for (var goal = -100; goal <= 100; goal++){
		var cost=0;
		for (var i=0; i < N; i++){
			cost += (s[i]-goal)*(s[i]-goal);
		}
		if (ans > cost){
			ans = cost;
		}
	}
	
	console.log(ans.toString());
}
//  [javascript]
function Main(input) {
  input=input.split("\n");
　const N=input[0]-0;
  var sum=0;
  var nums=input[1].split(" ");
  for(var i=0;i<nums.length;i++){
    sum+=(nums[i]-0);
  }
  var x=Math.round(sum/N);
  sum=0;
  for(var i=0;i<nums.length;i++){
    sum+=(nums[i]-x)**2;
  }
  console.log(sum);
}

//*この行以降は編集しないでください（標準入出力から一度に読み込み、Mainを呼び出します）
Main(require("fs").readFileSync("/dev/stdin", "utf8"));
//  [go]
package main

import "fmt"
import "math"

func main() {
	var n int
	fmt.Scan(&n)

	inputs := make([]int, n, n)
	for i := 0; i < n; i++ {
		fmt.Scan(&inputs[i])
	}

	min := math.MaxInt32
	for i := -100; i <= 100; i++ {
		sum := 0

		for _, a := range inputs {
			sum += (a - i) * (a - i)
		}

		if sum < min {
			min = sum
		}
	}

	fmt.Println(min)
}
//  [go]
package main

import (
	"bufio"
	"fmt"
	"math"
	"os"
	"strconv"
)

var sc = bufio.NewScanner(os.Stdin)

func scanInt() int {
	sc.Scan()
	iv, _ := strconv.Atoi(sc.Text())
	return iv
}

func init() {
	sc.Split(bufio.ScanWords)
}

func min(x, y int) int {
	if x < y {
		return x
	}
	return y
}

func main() {
	n := scanInt()
	a := make([]int, n)
	for i := range a {
		a[i] = scanInt()
	}

	ans := math.MaxInt64
	for i := -100; i <= 100; i++ {
		sum := 0
		for _, v := range a {
			sum += (v - i) * (v - i)
		}
		ans = min(ans, sum)
	}
	fmt.Println(ans)
}
//  [go]
package main

import (
	"bufio"
	"fmt"
	"math"
	"os"
	"strconv"
)

const (
	initialBufSize = 1e4
	maxBufSize     = 1e8 + 7
)

var buf []byte = make([]byte, maxBufSize)
var sc = bufio.NewScanner(os.Stdin)

func init() {
	sc.Split(bufio.ScanWords)
	sc.Buffer(buf, maxBufSize)
}

func main() {
	N := nextInt()
	An := make([]int, N)
	var sum, cost1, cost2, ans int
	var ave float64
	for i := range An {
		An[i] = nextInt()
		sum += An[i]
	}
	ave = float64(sum) / float64(N)
	for _, Ai := range An {
		ave1 := int(math.Ceil(ave))
		ave2 := int(math.Floor(ave))
		cost1 += cost(Ai, ave1)
		cost2 += cost(Ai, ave2)
	}
	if cost1 < cost2 {
		ans = cost1
	} else {
		ans = cost2
	}
	fmt.Println(ans)
}

func nextInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

func cost(Ai int, ave int) int {
	if Ai > ave {
		return (Ai - ave) * (Ai - ave)
	} else {
		return (ave - Ai) * (ave - Ai)
	}
}
//  [go]
package main

import (
	"bufio"
	"fmt"
	"math"
	"os"
	"strconv"
	"strings"
)

var num int

func main() {
	fmt.Scan(&num)
	ele := numScan(num)
	ans := calc(ele)

	fmt.Printf("%d", int(ans))
}

func numScan(num int) []float64 {
	sc := bufio.NewScanner(os.Stdin)
	sc.Scan()
	ss := strings.Split(sc.Text(), " ")

	element := []float64{}
	for _, i := range ss {
		m, _ := strconv.ParseFloat(i, 64)
		element = append(element, m)
		//fmt.Printf("%f", element)
	}
	return element
}

func calc(element []float64) float64 {
	ans := math.MaxFloat64
	for i := -100; i <= 100; i++ {
		r := 0.0
		for _, x := range element {
			r += math.Pow(x-float64(i), 2)
		}
		if ans > r {
			ans = r
		}
	}
	return ans
}
//  [go]
package main

import "fmt"

func main() {
	// Code for C - Be Together
	var N int
	fmt.Scanf("%d", &N)

	a := make([]int, N)
	for i := 0; i < N; i++ {
		fmt.Scanf("%d", &a[i])
	}

	var sum int
	var min int = 100000000
	for i := -100; i <= 100; i++ {
		sum = 0
		for j := 0; j < N; j++ {
			sum += (i - a[j]) * (i - a[j])
		}

		if sum < min {
			min = sum
		}
	}

	fmt.Println(min)
}
//  [ruby]
n = gets.to_i
a = gets.chomp.split.map(&:to_i)
ava = a.inject(:+) / n
puts [ava, ava + 1].map {|x| a.map {|y| (x - y) ** 2 }.inject(:+) }.min
//  [ruby]
n = gets.to_i
a = gets.split(' ').map(&:to_i)

avg = (a.inject(:+) / n.to_f).round
cost = 0

a.each do |x|
  cost += (x - avg)**2
end

puts cost
//  [ruby]
n=gets.to_i
as=gets.split.map(&:to_i)
ave=(as.inject(:+)/n.to_f).round
puts as.inject(0){|sum,an| sum+(an-ave)**2}
//  [ruby]
N = gets.to_i
a = gets.strip.split.map(&:to_i)
b = Array.new(a.max-a.min+1,0)
for i in a.min..a.max 
    
    for j in 0..N-1

        b[i-a.min] += (a[j] - i ) ** 2

    end

end

puts b.min
//  [ruby]
n = gets.chomp.to_i

arr = gets.chomp.split(' ').map(&:to_i)

# 平均を出して、入力のうち最小値から最大値までの整数のうち、一番距離の短い整数にする
# -> 四捨五入した数

avg = arr.inject(&:+)/n.to_f

target = 0

# 0.5の場合 → arrの中にあるものを優先
if avg - avg.to_i == 0.5
  if arr.include? avg.to_i
    target = avg.to_i
  else
    target = avg.to_i - 1
  end
else
  target = avg.round
end

cost = 0

arr.each do |item|
  cost += (item - target) ** 2
end

puts cost
//  [ruby]
n = gets.chomp
arr = gets.split.map(&:to_i)

avg = (1.0 * arr.sum / arr.size).round

puts arr.map {|n| (avg - n) ** 2 }.sum
//  [rust]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let mut s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};

    ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    };
}

macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };

    ($iter:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
    };

    ($iter:expr, chars) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };

    ($iter:expr, usize1) => {
        read_value!($iter, usize) - 1
    };

    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}
fn main() {
    input!(n:usize, nums:[i32;n]);
    let mean: i32 = (nums.iter().sum::<i32>() as f64/ nums.len() as f64).round() as i32;
    println!("{}", nums.iter().fold(0, |acc,x| acc + (x-mean).pow(2)));
}
//  [rust]
fn read1<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}

fn readn<T: std::str::FromStr>(delimiter: &str) -> Vec<T> {
    let s = read1::<String>();
    s.split(delimiter).map(|e| e.parse().ok().unwrap()).collect::<Vec<T>>()
}

fn main() {
    let n = read1::<isize>();
    let a = readn::<isize>(" ");

    let s2 = a.iter().map(|x| x*x).sum::<isize>();
    let s1 = a.iter().sum::<isize>();
    let m1 = s1 / n;
    let m2 = (s1 + n - 1) / n;

    let ans = std::cmp::min(n * m1 * m1 + s2 - 2 * s1 * m1, n * m2 * m2 + s2 - 2 * s1 * m2);
    println!("{}", ans);
}
//  [rust]
use std::io::stdin;

fn main() {
    let mut s = String::new();
    stdin().read_line(&mut s).ok();
    let n: usize = s.trim().parse().unwrap();
    let mut s = String::new();
    stdin().read_line(&mut s).ok();
    let a: Vec<i64> = s.split_whitespace().map(|e| e.parse().unwrap()).collect();
    let ave = (a.iter().sum::<i64>() as f64 / a.len() as f64 + 0.5).floor() as i64;

    let mut ans = 0;

    for &e in &a {
        ans += (ave - e).pow(2);
    }

    println!("{}", ans);
}
//  [rust]
use proconio::{input, fastout};
use proconio::marker::{Chars};
use proconio::marker::Usize1;
use std::cmp::*;

macro_rules! debug {
      ($($a:expr),*) => {
          eprintln!(concat!($(stringify!($a), " = {:?}, "),*), $($a),*);
    }
}

#[fastout]
fn main() {
    input!{
        n: usize,
        mut a: [i64;n],
    }

    a.sort();
    let mut ans: Vec<i64> = Vec::new();
    for mid in a[0]..a[n-1]+1 {
        let mut tmp = 0;
        for i in 0..n {
            tmp += (a[i]-mid).pow(2);
        }
        ans.push(tmp);
    }

    ans.sort();
    println!("{}", ans[0]);

}
//  [rust]
use proconio::input;

fn main() {
    input! {
        n: usize,
        a: [isize; n],
    }

    let mut min = std::isize::MAX;
    for i in -100..101 {
        let mut sum = 0;
        for na in &a {
            sum += (na - i) * (na - i);
        }
        if sum < min {
            min = sum;
        }
    }

    println!("{}", min);
}
//  [rust]
#[allow(unused_imports)]
use std::cmp::*;
#[allow(unused_imports)]
use std::collections::*;
use std::io::{BufWriter, Write};
// https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8
macro_rules! input {
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};
    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

macro_rules! read_value {
    ($next:expr, [graph1; $len:expr]) => {{
        let mut g = vec![vec![]; $len];
        let ab = read_value!($next, [(usize1, usize1)]);
        for (a, b) in ab {
            g[a].push(b);
            g[b].push(a);
        }
        g
    }};
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };
    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };
    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };
    ($next:expr, usize1) => (read_value!($next, usize) - 1);
    ($next:expr, [ $t:tt ]) => {{
        let len = read_value!($next, usize);
        read_value!($next, [$t; len])
    }};
    ($next:expr, $t:ty) => ($next().parse::<$t>().expect("Parse error"));
}

#[allow(unused)]
macro_rules! debug {
    ($($format:tt)*) => (write!(std::io::stderr(), $($format)*).unwrap());
}
#[allow(unused)]
macro_rules! debugln {
    ($($format:tt)*) => (writeln!(std::io::stderr(), $($format)*).unwrap());
}

fn solve() {
    let out = std::io::stdout();
    let mut out = BufWriter::new(out.lock());
    macro_rules! puts {
        ($($format:tt)*) => (let _ = write!(out,$($format)*););
    }
    input! {
        n: usize,
        a: [i32; n]
    }
    let mut ans = 10000000;
    for i in -100..101 {
        let mut cost = 0;
        for j in &a {
            cost += (j - i)*(j - i);
        }
        ans = min(ans,cost);
    }
    puts!("{}\n",ans);
}

fn main() {
    // In order to avoid potential stack overflow, spawn a new thread.
    let stack_size = 104_857_600; // 100 MB
    let thd = std::thread::Builder::new().stack_size(stack_size);
    thd.spawn(|| solve()).unwrap().join().unwrap();
}
//  [swift]
let N = Int(readLine()!)!
let a = readLine()!.characters.split(" ").map{Int(String($0))!}
var ans = 4000000
for i in -100...100 {
  ans = min(a.reduce(0){$0+($1-i)*($1-i)}, ans)
}
print(ans)
//  [typescript]
import * as fs from 'fs';
const input = fs.readFileSync("/dev/stdin", "utf8").split(/\n/);

// C - いっしょ

const N = +input[0];
const nums = input[1].split(' ').map(Number);
const goal = Math.round(nums.reduce((acc, cur) => {return acc + cur}) / nums.length);
let cost = 0;

if (!checkNums(nums, goal)) {
    nums.forEach(num => {
        cost += (num - goal) * (num - goal);
    });
}

console.log(cost);

function checkNums(nums: Array<number>, goal: number): boolean {
    let res = true;
    nums.forEach(num => {
        if (num !== goal) res = false;
    });
    return res;
}
//  [typescript]
function main(input: string) {
  const arrInput: number[] = input
    .split("\n")[1]
    .split(" ")
    .map((elm: string) => Number(elm));
  const ave: number = Math.floor(
    arrInput.reduce((sum: number, num: number) => sum + num) / arrInput.length
  );
  console.log(calcMinEnergy(ave, arrInput));
}

const calcMinEnergy = (base: number, arrInput: number[]) => {
  const baseEnergy: number = energy(base, arrInput);
  if (baseEnergy > energy(base - 1, arrInput)) {
    return calcMinEnergy(base - 1, arrInput);
  } else if (baseEnergy > energy(base + 1, arrInput)) {
    return calcMinEnergy(base + 1, arrInput);
  }
  return baseEnergy;
};

const energy = (base: number, arrInput: number[]) =>
  arrInput.reduce(
    (sum: number, num: number) => (sum += Math.pow(num - base, 2)),
    0
  );

main(require("fs").readFileSync("/dev/stdin", "utf8"));
//  [typescript]
const fs = require('fs')
const reader = (s: string) => (s.split("\n"))[1].split(" ")
 
function Main(input: string) {
  let min = 100
  let max = -100
  let minCost = Number.MAX_VALUE

  const nums = reader(input).map(i => parseInt(i));

  nums.forEach(num =>{
    min = min > num ? num : min;
    max = max < num ? num : max;
  })

  for( let i= min ;i <= max ; i++)
  {
    let cost = 0
    nums.forEach(num =>{
      cost += Math.pow((i - num),2)
    })
    minCost = minCost > cost ? cost : minCost;
  }
  console.log(minCost);

}
 
Main(fs.readFileSync('/dev/stdin', 'utf8'))
//  [python]
r = int(input())
import numpy as np
print(r * np.pi * 2)
//  [python]
n = int(input())
import numpy as np
x = np.pi
print(x*2*n)
//  [java]
import java.util.*;
class Main{
  public static void main(String args[]){
    Scanner sc = new Scanner(System.in);
    int a = sc.nextInt();
    pl(2*Math.PI*a+"");
  }

  public static void pr(String str){
    System.out.print(str);
  }
  public static void pl(String str){
    System.out.println(str);
  }
}
//  [java]
import java.util.Scanner;
import java.lang.Math;

public class Main {
  public static void main(String[] args) {
    Scanner scan = new Scanner(System.in);
    int R = scan.nextInt();
    scan.close();

    System.out.println(2*Math.PI*R);
  }
}
//  [java]
import java.util.Scanner;

	public class Main {

		public static void main(String[] args) {

			Scanner sc = new Scanner(System.in);
			
			double r = sc.nextDouble();
			double ret = 0.00;
			
			ret = 2*3.141592*r;
			
			System.out.println(ret);
			
		}
	}
//  [cpp]
#include<iostream>
#include<algorithm>
#include<math.h>
#include<string>
#include<tuple>
#include<vector>
#include<cstdlib>
#include<cstdint>
#include<stdio.h>
#include<cmath>
#include<limits>
#include<iomanip> 
#include<ctime>
#include<climits>
#include<random>
#include<queue>

using namespace std;
void Solve();

signed main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout<<setprecision(20)<<fixed;
  Solve();
}


/****************************************\
| Thank you for viewing my code:)        |
| Written by RedSpica a.k.a. RanseMirage |
| Twitter:@asakaakasaka                  | 
\****************************************/

void Solve(){
  std::random_device rnd;
  std::mt19937 mt(rnd());
  std::uniform_int_distribution<> rand100(0,10000);
  double n;
    cin>>n;
  double ans=0.0;
  double m=30000000;
  for(int i=0;i<m;i++){
    int x=rand100(mt);
    int y=rand100(mt);

    double d1=sqrt(x*x+y*y);
    
    if(d1<=10000){
      ans+=1.0;
    }
  }
  cout<<ans/m*8*n<<"\n";
}
//  [cpp]
#include<iostream>
#include<algorithm>
#include<math.h>
#include<string>
#include<tuple>
#include<vector>
#include<cstdlib>
#include<cstdint>
#include<stdio.h>
#include<cmath>
#include<limits>
#include<iomanip> 
#include<ctime>
#include<climits>
#include<random>
#include<queue>

using namespace std;
void Solve();

signed main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout<<setprecision(20)<<fixed;
  Solve();
}


/****************************************\
| Thank you for viewing my code:)        |
| Written by RedSpica a.k.a. RanseMirage |
| Twitter:@asakaakasaka                  | 
\****************************************/

void Solve(){
  std::random_device rnd;
  std::mt19937 mt(rnd());
  std::uniform_int_distribution<> rand100(0,10000);
  double n;
    cin>>n;
  double ans=0.0;
  for(int i=0;i<5000000;i++){
    int x=rand100(mt);
    int y=rand100(mt);

    double d1=sqrt(x*x+y*y);
    
    if(d1<=10000){
      ans+=1.0;
    }
  }
  cout<<ans/5000000*8*n<<"\n";
}
//  [cpp]

#include<bits/stdc++.h>
using namespace std;

#define fastio 			ios::sync_with_stdio(0);	cin.tie(0); cout.tie(0);  cout<<fixed;  cout<<setprecision(12);	
#define randomINT 		mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());
#define	newl 			cout<<"\n"
#define DISP(as)		for(auto it : as) cout<<it<<" ";newl;
#define all(x)         	(x).begin(),(x).end()
#define mset(x,val)    	memset(x,val,sizeof(x))
#define newl           	cout<<"\n"
#define pb             	push_back
#define mp             	make_pair
#define f 				first
#define s 				second
#define dline          cerr<<"///REACHED///\n";
#define deb1(x)        cerr<<#x<<" = "<<x<<'\n';
#define deb2(x,y)      cerr<<'['<<#x<<','<<#y<<"] = "<<'['<<x<<','<<y<<']'<<'\n';
#define deb3(x,y,z)    cerr<<'['<<#x<<','<<#y<<','<<#z<<"] = "<<'['<<x<<','<<y<<','<<z<<']'<<'\n';

typedef long long 				ll;
typedef long double 			ld;
typedef vector<ll> 				vll;
typedef pair<ll ,ll> 			pll;
typedef pair<ld,ld> 			pld;
typedef unordered_map<ll,ll> 	um;
typedef vector<pll> 			vpll;

const ll 	MAX5 	= 	1e+5+7;
const ll 	MAX7 	= 	1e+7+7;
const ll 	MAXN 	= 	MAX7;
const ll   	INF   	=  	0x7f7f7f7f7f7f7f7f;
const int  	INFi 	=  	0x7f7f7f7f;
const ll 	MOD		=  	1e+9+7;

vll adj[MAXN];ll visit[MAXN]={};
int dx8[]={0,1,1,1,0,-1,-1,-1}, dy8[]={1,1,0,-1,-1,-1,0,1};
int dx4[]={0,1,0,-1}, dy4[]={1,0,-1,0};

// <------------- Declare Variables Here ------------> //

ll t=1;
ll n,x;
string s;

// <------------- Implement Functions Here ----------> //



// <------------- Start of main() -------------------> //

void MAIN() {
	cin>>n;
	cout<<3.1415*2*n;newl;
}

int main() {
	fastio;randomINT;
	//cin>>t;
	while(t--) {
		MAIN();
	}
	return 0;
}
//  [c]
#include <stdio.h>
 
int main() {
	int R;
	scanf("%d", &R);
	printf("%f",((double)R)*2.0*3.14);
	return 0;
}
//  [c]
#include <stdio.h>

int main()
{
  
    int r;
    float c,pi=3.14159;
    scanf("%d",&r);
    c=2*pi*r;
    printf("%f\n",c);
    return 0;
}
//  [c]
#include<stdio.h>

int main(){
    float pi=3.1416;
    int r;
    scanf("%d",&r);
    if(r>=1 && r<=100){
        printf("%.2f",(2*pi*r));

    }

 return 0;
}
//  [javascript]
const Main = input => {
  const R = Number(input);
  const result = Math.PI * 2 * R;
  console.log(result);
};

Main(require('fs').readFileSync('/dev/stdin', 'utf8'));
//  [javascript]
function Main (N) {
  console.log((2*parseInt(N.split("\n")[0], 10))*Math.PI);
}

Main(require("fs").readFileSync("/dev/stdin", "utf8"));
//  [javascript]
function Main(input) {
  const r = input * 2 * Math.PI;
  console.log(r);
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));
//  [go]
package main
 
import (
  "fmt"
  "math"
)
 
func main() {
  var r float64
  fmt.Scanf("%f", &r)

  ans := 2 * r * math.Pi
  fmt.Printf("%f\n", ans)
}
//  [go]
package main

import (
	"fmt"
)

func main() {
	var r float64
	fmt.Scan(&r)

	var ans float64

	ans = 2 * r * 3.141592
	fmt.Println(ans)
}
//  [go]
package main

import (
        "fmt"
        "math"
)

func solution(x int) float64 {
        return 2 * math.Pi * float64(x)
}

func main() {
        var x int
        fmt.Scan(&x)
        fmt.Println(solution(x))
}
//  [ruby]
require 'pp'

# 入力値を数値で返却する
def gets_i()
  gets.chomp.to_i
end

R = gets_i

puts R * 2 * Math::PI
//  [ruby]
require 'set'; require 'prime'; require 'pp'
INF=Float::INFINITY; MOD=10**9+7
r = gets.chomp.to_i

puts 2.0 * r * 3.1415926
//  [swift]
import Foundation


let input = readLine()!
let a = Double(input)!
let length = a * 2 * Double.pi

print(length)
//  [swift]
import Foundation

let  radius = Int(readLine()!) ?? 0 
let circumference = Double(2*radius)*Double.pi
print(circumference)
//  [swift]
import Foundation

private func readInt() -> [Int]{
    return readLine()!.split(separator: " ").map{Int($0)!}
}

func mainA() {
    let R = Double(readLine()!)!
    
    print(2.0 * R * 3.14159)
}

mainA()
//  [typescript]
import { readFileSync } from "fs";

const read = () =>
  readFileSync(0, "utf8")
    .split("\n")
    .map((line) => line.split(" "));

const main = (input: string[][]) => {
  const R = Number(input[0][0]);

  return 2 * Math.PI * R;
};

console.log(main(read()));
//  [typescript]
process.stdin.resume();
process.stdin.setEncoding('utf8');

// 標準入力取込
let gInput = '';
process.stdin.on('data', (chunk) => (gInput += chunk));
process.stdin.on('end', () => main(gInput.split(/\r?\n/)));

// 解答
function main(inputs: string[]): void {
  const r = Number(inputs[0].split(' ')[0]);

  console.log(r * 2 * Math.PI);
}
//  [python]
a=list(map(str,input().split()))
if a.count('5')==2 and a.count('7')==1:
    print('YES')
else:
    print('NO')