akhauriyash/Code-Regression huggingface dataset:
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!{
        h: u64,
        n: u64,
        a: [u64;n]
    }
    println!("{}", if h > a.iter().sum() {"No".to_string()} else {"Yes".to_string()})
}


Measured memory_bytes: 6396
<?php
$n = intval(fgets(STDIN));
$minRet = ask(0);
$maxRet = ask($n-1);

$min = 0;
$max = $n-1;
while($min!=$max){
    $mid = intdiv($max+$min, 2);
    $midRet = ask($mid);
    if(($midRet != $minRet) != ($mid - $min) % 2){
        $max = $mid;
        $maxRet = $midRet;
    }else{
        $min = $mid;
        $minRet = $midRet;
    }
}

function ask($a){
    //return dummyResponder($a);
    echo $a,"\n";
    flush();
    $in = trim(fgets(STDIN));
    if($in == "Vacant"){
        exit;
    }elseif($in == "Male"){
        return 1;
    }else{
        return -1;
    }
}
function dummyResponder($a){
    echo $a,"\n";
    return [1,-1,1,-1,1,-1,0,1,-1,1,-1][$a];
}



Measured memory_bytes: 5200
#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef vector<double> vd;
typedef vector<string> vs;
typedef pair<int, int> P;

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()

void YN(bool flg){if(flg) cout << "YES" << endl; else cout << "NO" << endl;}
void Yn(bool flg){if(flg) cout << "Yes" << endl; else cout << "No" << endl;}
void yn(bool flg){if(flg) cout << "yes" << endl; else cout << "no" << endl;}

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

int main()
{   
    int n, x, y;
    cin >> n >> x >> y;
    --x, --y;
    vvi g(n);
    g[x].push_back(y); g[y].push_back(x);
    rep(i, n-1) {
        g[i].push_back(i+1), g[i+1].push_back(i);
    }

    vvi d(n, vi(n, -1));
    queue<P> q;
    rep(i, n) {
        q.push({i, 0});
        while(!q.empty()) {
            auto x = q.front(); q.pop();
            int p = x.first, s = x.second;
            for(int u : g[p]) {
                if(d[i][u] != -1) continue;
                d[i][u] = s+1;
                q.push({u, s+1});
            }
        }
    }

    vi ans(n);
    rep(i, n) for(int j=i+1; j < n; j++) {
        ans[d[i][j]-1]++;
    }

    rep(i, n-1) cout << ans[i] << endl;

    return 0;
}


Measured memory_bytes: 19004
#line 1 "/mnt/c/Users/leafc/dev/compro/lib/template.hpp"


#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n; i++)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define ALL(v) (v).begin(), (v).end()
#define coutd(n) cout << fixed << setprecision(n)
#define ll long long int
#define vl vector<ll>
#define vi vector<int>
#define MM << " " <<

using namespace std;

template <class T> void say(bool val, T yes = "Yes", T no = "No") { cout << (val ? yes : no) << endl; }

template <class T> void chmin(T &a, T b) {
  if (a > b)
    a = b;
}

template <class T> void chmax(T &a, T b) {
  if (a < b)
    a = b;
}


#line 2 "abc164_b.cpp"

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);

  int a, b, c, d;
  cin >> a >> b >> c >> d;
  while (true) {
    c -= b;
    if (c <= 0) {
      cout << "Yes" << endl;
      return 0;
    }
    a -= d;
    if (a <= 0) {
      cout << "No" << endl;
      return 0;
    }
  }
}


Measured memory_bytes: 3648
#include <stdio.h>

int main(int argc, char** argv) {
	int i = 0;
	int ans = 1;
	int d, n;
	scanf("%d %d", &d, &n);

	if (d == 0) {
		if (n == 100) {
			ans = 101;
		} else  {
			ans = n * 1;
		}

		printf("%d\n", ans);
		return 0;
	} else if (d == 1) {
		if (n == 100) {
			ans = 10100;
		} else {
			ans = n * 100;
		}
		printf("%d\n", ans);
		return 0;
	} else {
		if (n == 100) {
			ans = 1010000;
		} else {
			ans = n * 10000;
		}
		printf("%d\n", ans);
		return 0;
	}
	
	return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;

int main() {
  int N;
  cin >> N;
  vector<int> a(3*N), b(3*N);
  for(int i=0; i<3*N; i++) {
    cin >> a.at(i);
    //b.at(i)=a.at(i);
  }
  sort(a.begin(), a.end(), greater<int>());
  //reverse(a, a+N);
  long long ans=0;
  for(int i=1; i<2*N+1; i+=2) {
    ans+=a.at(i);
    //cout << a.at(i) << endl;
  }
  cout << ans << endl;
}

Measured memory_bytes: 2560
#include "iostream"
#include "climits"
#include "list"
#include "queue"
#include "stack"
#include "set"
#include "functional"
#include "algorithm"
#include "string"
#include "map"
#include "iomanip"
#include "cmath"

using namespace std;

const long long int MOD = 1000000007;

long long int N, M, K, H, W, L, R;


int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);

	cin >> H >> W;
	vector<vector<int>>edge(10, vector<int>(10, 100000));
	for (int i = 0; i < 10; i++) {
		for (int j = 0; j < 10; j++) {
			cin >> edge[i][j];
		}
	}
	for (int k = 0; k < 10; k++) {
		for (int i = 0; i < 10; i++) {
			for (int j = 0; j < 10; j++) {
				edge[i][j] = min(edge[i][j], edge[i][k] + edge[k][j]);
			}
		}
	}
	vector<int>num(10);
	for (int i = 0; i < H; i++) {
		for (int j = 0; j < W; j++) {
			cin >> K;
			if (K != -1) {
				num[K]++;
			}
		}
	}
	for (int i = 0; i < 10; i++) {
		M += edge[i][1] * num[i];
	}
	cout << M << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
#define PI 3.1415926535897932384626433
#define mod 1000000007

int gcd(int a, int b) { return b ? gcd(b, a%b) : a; }

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

int main(){
    ll a, b;
    cin >> a >> b;
    if(a > 0 && b > 0){
        cout << "Positive" << endl;
    }else if(a < 0 && b < 0){
        if((abs(b - a )+ 1 )% 2 == 0){
            cout << "Positive" << endl;
        }else{
            cout << "Negative" << endl;
        }
    }else if(a <= 0 && b >= 0){
        cout << "Zero" << endl;
    }
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;

#define sync ios::sync_with_stdio(0), cin.tie(0), cout.tie(0)
#define endl "\n"
#define ends ' '
#define die(x) return cout << x << endl, 0
#define all(v) v.begin(), v.end()
#define sz(x) (int)(x.size())
#define debug(x) cerr << #x << ": " << x << endl
#define debugP(p) cerr << #p << ": {" << p.first << ", " << p.second << '}' << endl
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
const ll INF = 1e9, MOD = INF + 7;

/////////////////////////////////////////////////////////////////////

const int N = 1e2 + 10;

int main() {

   	sync;

	int n; cin >> n;
	cout << n * n * n << endl;

	return 0;
}


Measured memory_bytes: 256
N = int(input())
W = [input() for _ in range(N)]

b = W[0][-1]
for i in range(1, N):
    if b == W[i][0]:
        b = W[i][-1]
    else:
        print("No")
        exit()

if len(W) == len(set(W)):
    print("Yes")
else:
    print("No")


Measured memory_bytes: 3060
#include<stdio.h>
int main()
{
int A,B,C;
int K;
scanf("%d %d %d",&A,&B,&C);
scanf("%d",&K);

int sum=A+B+C;
int large;
if(A>=B&&A>=C)
large=A;
else if(B>=A&&B>=C)
large=B;
else
large=C;
for(int i=0;i<K;i++)
{
sum+=large;
large*=2;
}
printf("%d",sum);
return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <vector>
#include <algorithm>
#include <queue>
#include <map>
#include <set>
#include <math.h>
#include <string>
#include <iomanip>

using namespace std;

typedef long long ll;
typedef pair<ll, ll> P;
typedef pair<ll, P> Q;

const ll mod = 1000000007;
const ll INF = 1000000000000;

ll n, a[2010], k, dp[2010], ans;

ll poww(ll x, ll y)
{
	if (y == 0) return 1;
	if (y % 2 == 0)
	{
		ll ttt = poww(x, y / 2);
		return ttt * ttt % mod;
	}
	else
	{
		return poww(x, y - 1) * x % mod;
	}
}

int main()
{
	cin >> n >> k;

	for (int i = 0; i < n; i++)
	{
		cin >> a[i];
		dp[a[i]]++;
	}

	for (int i = 0; i <= 2005; i++)
	{
		dp[i + 1] += dp[i];
	}

	for (int i = 0; i < n; i++)
	{
		(ans += dp[a[i] - 1] * k % mod * (k - 1) % mod * poww(2, mod - 2) % mod) %= mod;
	}

	for (int i = 0; i < n; i++)
	{
		for (int j = i + 1; j < n; j++)
		{
			if (a[i] > a[j])
			{
				(ans += k) %= mod;
			}
		}
	}

	cout << ans << endl;

	int www;
	cin >> www;
}


Measured memory_bytes: 256
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        String[] sList = new String[n];
        for (int i = 0; i < n; i++) {
            sList[i] = scanner.next();
        }
        int m = scanner.nextInt();
        String[] mList = new String[m];
        for (int i = 0; i < m; i++) {
            mList[i] = scanner.next();
        }

        Map<String, Integer> resultMap = new HashMap<>();
        for (int i = 0; i < n; i++) {
            if(resultMap.containsKey(sList[i])){
                int tempNum = resultMap.get(sList[i]);
                resultMap.put(sList[i], ++tempNum);
            } else {
                resultMap.put(sList[i], 1);
            }
        }
        for (int i = 0; i < m; i++) {
            if(resultMap.containsKey(mList[i])){
                int tempNum = resultMap.get(mList[i]);
                resultMap.put(mList[i], --tempNum);
            } else {
                continue;
            }
        }
        int result = 0;
        for (Map.Entry<String, Integer> entry : resultMap.entrySet() ) {
           if(result < entry.getValue()){
               result = entry.getValue();
           } else {
               continue;
           }
        }
        System.out.println(result);
    }
}


Measured memory_bytes: 21844
use std::io::*;
use std::str::*;
use std::collections::*;

pub fn read_from<T: FromStr, R: Read>(s: &mut R) -> T {
    let s = s.bytes().map(|c| c.unwrap() as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect::<String>();
    if !s.is_empty() {
        if let Ok(s) = s.parse::<T>() {
            s
        } else {
            panic!("faild to parse {}", s);
        }
    } else {
        if cfg!(local) {
            // eprintln!("reached to EOF");
        }
        std::process::exit(0)
    }
}

pub fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let mut stdin = stdin.lock();
    read_from(&mut stdin)
}

fn main() {
    loop {
        let n = read();
        let m = read();
        let x: i32 = read();
        let y: i32 = read();
        let xs: Vec<i32> = (0..n).map(|_| read()).collect();
        let ys: Vec<i32> = (0..m).map(|_| read()).collect();

        let safe = (-110..110).any(|z| {
            x < z && z <= y && xs.iter().all(|&x| x < z) && ys.iter().all(|&y| y >= z)
        });
        println!("{}", if safe { "No War" } else { "War" });
    }
}


Measured memory_bytes: 4352
#include <algorithm>
#include <chrono>
#include <cstring>
#include <iomanip>
#include <istream>
#include <map>
#include <numeric>
#include <ostream>
#include <random>
#include <set>
#include <sstream>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>


using namespace std;


class Solution {
 public:
  void solve(std::istream& in, std::ostream& out) {
    string s;
    in >> s;
    int rez = 753;
    for (int ctr1 = 0; ctr1 + 2 < s.length(); ++ctr1)
      rez = min(rez, abs(753 - (s[ctr1] - '0') * 100 - (s[ctr1 + 1] - '0') * 10
                                                     - s[ctr1 + 2] + '0'));
    out << rez << "\n";
  }
};

void solve(std::istream& in, std::ostream& out)
{
  out << std::setprecision(12);
  Solution solution;
  solution.solve(in, out);
}
// Powered by caide (code generator, tester, and library code inliner)


#include <fstream>
#include <iostream>


int main() {
  
  ios_base::sync_with_stdio(false);
  cin.tie(0);


  istream& in = cin;


  ostream& out = cout;

  solve(in, out);
  return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i = 0; i < (n); ++i)
using ll = long long;
using P = pair<int, int>;

string s;
ll k;
ll num, len;


int main() {
  cin >> s >> k;
  len = 1000000000000000001;
  rep (i, s.size()) {
    if (s[i] != '1') {
      num = s[i] - '0';
      len = i + 1;
      break;
    }
  }
  if (k < len) {
    cout << 1 << endl;
  } else {
    cout << num << endl;
  }
  return 0;
}


Measured memory_bytes: 3600
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

public class AtCoderA
{
    static void Main()
    {
        var sc = new Scanner();

        long n = sc.NextLong();
        long[] a = sc.LongArray();

        long total = 1;
        long odd = 1;
        for (int i = 0; i < n; i++)
        {
            total *= 3;
            if (a[i] % 2 == 0)
            {
                odd *= 2;
            }
        }

        long answer = total - odd;

        Console.WriteLine(answer);
    }

    class Scanner
    {
        private string[] _line;
        private int _index;
        private const char Separator = ' ';

        public Scanner()
        {
            _line = new string[0];
            _index = 0;
        }

        public string Next()
        {
            while (_index >= _line.Length)
            {
                _line = Console.ReadLine().Split(Separator);
                _index = 0;
            }

            return _line[_index++];
        }

        public int NextInt() => int.Parse(Next());
        public long NextLong() => long.Parse(Next());
        public double NextDouble() => double.Parse(Next());
        public decimal NextDecimal() => decimal.Parse(Next());
        public char NextChar() => Next()[0];
        public char[] NextCharArray() => Next().ToCharArray();

        public string[] Array()
        {
            _line = Console.ReadLine().Split(Separator);
            _index = _line.Length;
            return _line;
        }

        public int[] IntArray() => Array().Select(int.Parse).ToArray();
        public long[] LongArray() => Array().Select(long.Parse).ToArray();
        public double[] DoubleArray() => Array().Select(double.Parse).ToArray();
        public decimal[] DecimalArray() => Array().Select(decimal.Parse).ToArray();
    }
}


Measured memory_bytes: 28136
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
using namespace std;
int main() {
	string S, T; 
	cin >> S >> T;
	bool ans = false;

	for (int i = 0; i < S.size(); ++i) {
		if (S == T) 
		{
			ans = true;
			break;
		}
		S = S.back() + S.substr(0, S.size() - 1);
	}

	if (ans) {
		cout << " Yes " << endl;
	}

	else {
		cout << "No" << endl;
	}
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
#define ll long long int
#define rep(i,n) for( int i = 0; i < n; i++ )
#define rrep(i,n) for( int i = n; i >= 0; i-- )
#define REP(i,s,t) for( int i = s; i <= t; i++ )
#define RREP(i,s,t) for( int i = s; i >= t; i-- )
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define INF 2000000000
#define mod 1000000007
#define INF2 1000000000000000000

bool exist[300];
string K = "NEWS";
int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    string S; cin >> S;
    rep(i, S.length()) {
        exist[S[i]] = true;
    }
    if (exist['E'] ^ exist['W']) {
        cout << "No" << endl;
    } else if (exist['N'] ^ exist['S']) {
        cout << "No" << endl;
    } else {
        cout << "Yes" << endl;
    }

    return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <ctime>
#include <iostream>
#include <sstream>
#include <functional>
#include <map>
#include <string>
#include <cstring>
#include <vector>
#include <queue>
#include <stack>
#include <deque>
#include <set>
#include <list>
#include <numeric>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll,ll> P;
const double PI = 3.14159265358979323846;
const double EPS = 1e-12;
const ll INF = 1LL<<29;
const ll mod = 1e9+7;
#define rep(i,n) for(int (i)=0;(i)<(ll)(n);++(i))
#define repd(i,n,d) for(ll (i)=0;(i)<(ll)(n);(i)+=(d))
#define all(v) (v).begin(), (v).end()
#define pb(x) push_back(x)
#define mp(x,y) make_pair((x),(y))
#define mset(m,v) memset((m),(v),sizeof(m))
#define chmin(X,Y) ((X)>(Y)?X=(Y),true:false)
#define chmax(X,Y) ((X)<(Y)?X=(Y),true:false)
#define fst first
#define snd second
#define UNIQUE(x) (x).erase(unique(all(x)),(x).end())
template<class T> ostream &operator<<(ostream &os, const vector<T> &v){int n=v.size();rep(i,n)os<<v[i]<<(i==n-1?"":" ");return os;}

int main(){
	ll x, a, b;
	cin>>x>>a>>b;
	if(a>=x){
		cout<<1<<endl;
	} else if(b>=a){
		cout<<-1<<endl;
	} else {
		ll r = 1, d = a-b;
		r += (x-a+d-1)/d*2;
		cout<<r<<endl;
	}
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define MAXB 64
using namespace std;
typedef long long LL;

int main(){
	LL n;
	cin >> n;
	LL x[n];
	for(int i = 0; i < n; i++) cin >> x[i];
	vector<int> diff;
	for(int i = 0; i < n-1; i++){
		diff.push_back(x[i+1]-x[i]);
	}
	LL m, k;
	cin >> m >> k;
	LL perm[n-1];
	for(int i = 0; i < n-1; i++) perm[i] = i;
	for(int i = 0; i < m; i++){
		int a;
		cin >> a;
		a -= 2;
		swap(perm[a], perm[a+1]);
	}
	int jump[MAXB][n-1];
	for(int j = 0; j < MAXB; j++){
		for(int i = 0; i < n-1; i++){
			if(j == 0){
				jump[j][i] = perm[i];
				continue;
			}
			jump[j][i] = jump[j-1][jump[j-1][i]];
		}
	}
	for(int i = 0; i < n-1; i++){
		LL f = k;
		perm[i] = i;
		for(int j = MAXB - 1; j >= 0; j--){
			if(f & (1LL << j)){
				f ^= (1LL << j);
				perm[i] = jump[j][perm[i]];
			}
		}
	}
	cout << x[0] << endl;
	for(int i = 0; i < n-1; i++){
		x[0] += diff[perm[i]];
		cout << x[0] << endl;
	}
}


Measured memory_bytes: 28280
#include <iostream>
#include <string>
#include <algorithm>
using namespace std;
int main(int argc, char const *argv[]) {
  string s,t;
  cin>>s>>t;
  bool flag=0;
  sort(s.begin(),s.end());
  sort(t.begin(),t.end(),greater<char>());
  int l=min(s.size(),t.size());
  for(int i=0;i<l;i++){
    if(s[i]<t[i]){
      flag=1;
      break;
    }
    if(s[i]==t[i]&&i==l-1){
      if(s.size()<t.size()) flag=1;
    }
  }
  if(flag==1){
    cout<<"Yes"<<endl;
  }else{
    cout<<"No"<<endl;
  }
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n)for(int i=0;i<(n);i++)
using namespace std;
typedef long long ll;
typedef pair<int,int>P;

const int INF=0x3f3f3f3f;
const ll INFL=0x3f3f3f3f3f3f3f3f;
const int MOD=1000000007;

int main(){
	int x;cin>>x;x-=400;
	cout<<8-x/200<<endl;
}

Measured memory_bytes: 3644
#########行列読み込み ##############################################
"""
from sys import stdin
n = int(stdin.readline().rstrip())
data = [stdin.readline().rstrip().split() for _ in range(n)]
print(data)
print(*data, sep='\n')
"""
##################################################################
#########入力系####################################################
"""
s =input()
s=list(input())
a=int(input())
x,y = map(int,input().split())	
li = input().split()	
li = list(map(int,input().split()))	
li = input().split('T')	
"""
##################################################################

#########行列読み込み ##############################################
"""
from sys import stdin
n = int(stdin.readline().rstrip())
data = [stdin.readline().rstrip().split() for _ in range(n)]
print(data)
print(*data, sep='\n')
"""
##################################################################
#########入力系####################################################
"""
s =input()
s=list(input())
a=int(input())
x,y = map(int,input().split())	
li = input().split()	
li = list(map(int,input().split()))	
li = input().split('T')	
"""
##################################################################
L = int(input())
leng = L/3
ans = pow(leng,3)
print(ans)














Measured memory_bytes: 3188
A = int(input())
B = int(input())
C = int(input())
X = int(input())
cnt = 0
for i in range(A+1):
  for j in range(B+1):
    for k in range(C+1):
      if(500*i + 100*j + 50*k == X):
        cnt += 1
print(cnt)

Measured memory_bytes: 3060
// ITP1_7_B How many ways?
import java.io.*;

public class Main {

   public static void main(String[] args) {
      try {
         BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
         
         while (true) {
            String strAry[] = br.readLine().split(" ");
            int n = Integer.parseInt(strAry[0]);
            int x = Integer.parseInt(strAry[1]);

            if ((n == 0 && x == 0) || (n < 3 || n > 100))
               break;

            System.out.println(combination(n, x));
         }
      }

      catch (Exception e) {
         System.err.println(e);
      }
   }

   private static int combination(int n, int x) {
      int count = 0;
      int a, b, c;
      for (int i = 1; i <= n; i++) {
         for (int j = 1; j <= n; j++) {
            if (i == j)
               break;
            for (int k = 1; k <= n; k++) {
               if (i == k || j == k)
                  break;
               if (i + j + k == x)
                  count++;
            }
         }
      }

      return count;
   }
}

Measured memory_bytes: 18924
#include <iostream>
#include <cstdio>
#include <cstring>
#include <vector>
#include <set>
#include <unordered_set>
#include <cmath>
#include <algorithm>
#include <numeric>
#include <cassert>
#include <utility>

using namespace std;
using lli = long long int;
// #define DEBUG
#ifdef DEBUG
#define debug(var) cout << (#var) << ": " << (var) << endl;
template<class T> void dump_array_impl(const T& a) {
  bool first = true;
  for (auto&& x : a) {
    if (!first) cout << ", "; else first = false;
    cout << x;
  }
}
#define debug_array(a) cout<<(#a)<<": ";dump_array_impl(a);cout<<endl
#else
#define debug(var) {}
#define debug_array(a) {}
#endif
template<class T> void read_n(vector<T>& v, size_t n) {
  v = vector<T>(n); for (lli i=0; i<n; ++i) cin >> v[i];
}
template<class T> T gabs(const T& x) { return max(x, -x); }
#define abs gabs

int n, m, q;
int mat[501][501];
int main() {
  memset(mat, 0, sizeof(decltype(mat[0][0]))*501*501);
  cin >> n >> m >> q;
  for (int i=0; i<m; ++i) {
    int a, b; cin >> a >> b;
    mat[b][a]++;
  }
  for (int y=2; y<=n; ++y) {
    for (int i=1, j=y; j<=n; ++i, ++j) {
      mat[j][i] += mat[j-1][i] + mat[j][i+1] - mat[j-1][i+1];
    }
  }
  for (int i=0; i<q; ++i) {
    int a, b;
    cin >> a >> b;
    cout << mat[b][a] << endl;
  }
  return 0;
}


Measured memory_bytes: 1920
fun main(args: Array<String>) {
    val (N, K) = listOfInt()
    val X = listOfInt()
    var ans = Int.MAX_VALUE
    for (n in 0 until N - K + 1) {
        val d = X[n + K - 1] - X[n]
        val a = d + Math.abs(X[n])
        val b = d + Math.abs(X[n + K - 1])
        ans = Math.min(ans, Math.min(a, b))
    }
    println(ans)
}
fun next() = readLine()!!
fun listOfString() = next().split(" ")
fun listOfInt() = listOfString().map { Integer.parseInt(it) }


Measured memory_bytes: 49888
a,v= list(map(int,input().split()))
b,w= list(map(int,input().split()))
t = int(input())

if a <= b :
    a_x = a+v*t
    b_x = b + w*t

    if a_x >= b_x:
        print("YES")
    else:
        print("NO")
else:
    a_x = a-v*t
    b_x = b - w*t

    if a_x <= b_x:
        print("YES")
    else:
        print("NO")  

Measured memory_bytes: 9200
#include<iostream>
#include<string>
using namespace std;

int main(){
	
	string str;
	int s,n, i,e,w;
	
	while(cin>>str){
		
		e=0;w=0;
		s=0;n=0;
		
		for(i=0;i<str.length();i++){
		
			if(str[i]=='E')
				e=1;
			else if (str[i]=='W')
				w=1;
			else if (str[i]=='N')
				n=1;
			else if (str[i]=='S')
				s=1;
		}
		
		
		if(e==w&&n==s){
			
			cout<<"Yes"<<endl;
		}else{
			cout<<"No"<<endl;
		}
		
	}
	
	
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;

#define loop(i,n) for(int i=1;i<=n;i++)
int s[100002];
int c[100002];

int main(){
  int n,m,a;
  cin>>n>>m;
  loop(i,n-1)cin>>s[i];
  int pos=1;
  loop(i,m){
    cin>>a;
    if(a>0){
      loop(_,a)c[pos++]++;
    }else{
      loop(_,-a)c[--pos]++;
    }
  }
  int tot=0;
  loop(i,n-1){
    tot+=s[i]*c[i];
    tot%=100000;
  }
  cout<<tot<<endl;
  return 0;
}

Measured memory_bytes: 3832
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);

        long X =  scanner.nextLong();
        long deposit = 100;
        int count = 0;

        while(deposit < X) {
            deposit *= 1.01;
            count++;
        }

        System.out.println(count);
    }
}


Measured memory_bytes: 35592
n = int(input())
p = list(map(int, input().split()))

p_s = sorted(p)

b = True
cnt = 0

for p1, p2 in zip(p, p_s):
    if p1 != p2:
        cnt += 1
    
    if cnt >= 3:
        b=False
        break

if b:
    print('YES')
else:
    print('NO')

Measured memory_bytes: 3060
import java.util.Arrays;
import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		Scanner stdIn=new Scanner(System.in);
		int a[]=new int[3];
		int z=0;
		while(z<3){
			a[z]=stdIn.nextInt();
			z++;
		}
		Arrays.sort(a);
		if(a[0]+a[1]==a[2])
			System.out.println("Yes");
		else
			System.out.println("No");
	}
}


Measured memory_bytes: 21844
#include <iostream>
#include <algorithm>
#include <vector>
#include <cmath>

using namespace std;

int main(void){
  int n, m, p;
  string s;
  cin >> n >> m;
  int ac = 0, wa = 0;

  vector<int> ok(n + 1, 0);
  vector<int> waacc(n + 1, 0);

  for (int i = 0; i < m; i++){
    cin >> p >> s;
    if (s == "WA"){
      waacc[p]++;
    }
    if (s == "AC" && ok[p] == 0){
      ok[p]++;
      ac++;
      wa += waacc[p];
    }
  }



  cout << ac << " " << wa << endl;


  return 0;
}


Measured memory_bytes: 1024
n=int(input())
a= list(map(int, input().split()))

# aの各要素とインデックスを紐付け
for i in range(n):
    a[i]=[a[i],i]
a.sort(reverse=True)

# dp[i][l]:大きいものからi個位置決めてそのうち左がl（右がi-l）の時のMAX
dp=[[0]*(n+1) for i in range(n+1)]

for i in range(n):
    for j in range(i+1):
        # i番目を左に置く時、左に一つズレる
        dp[i+1][j+1]=dp[i][j]+abs(a[i][1]-j)*a[i][0]
    for j in range(i+1):
        # i番目を右に置く時
        dp[i+1][j]=max(dp[i+1][j],dp[i][j]+abs(a[i][1]-(n-1-(i-j)))*a[i][0])

print(max(dp[-1]))


Measured memory_bytes: 100608
#include <iostream>
using namespace std;
#define MAXSIZE 100

void dfs(int x, int y, int n, int num_candy, int *max, int a[2][MAXSIZE]){
    num_candy += a[x][y];
    //printf("x = %d, y = %d, num_candy = %d, max = %d\n", x, y, num_candy, *max);

    if(x == 1 && y == n - 1){
        //printf("reached goal\n");
        if(num_candy > *max){
            *max = num_candy;
        }
        return;
    }

    if(y < n - 1){
        dfs(x, y + 1, n, num_candy, max, a);
    }

    if(x < 1){
        dfs(x + 1, y, n, num_candy, max, a);
    }
}

int main(){
    int n, max = 0;
    cin >> n;
    int a[2][MAXSIZE];
    for(int i = 0; i < 2; i++){
        for(int j = 0; j < n; j++){
            cin >> a[i][j];
        }
    }
    dfs(0, 0, n, 0, &max, a);
    cout << max << endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
	long long a,b,c,d;
	long long j;
	scanf("%lld%lld%lld%lld",&a,&b,&c,&d);
printf("%lld",max(a*c,max(b*d,max(a*d,b*c))));
} 

Measured memory_bytes: 3824
N, K = map(int, input().split())

cnt = 0
for j in range(K+1, N+1):
    block = N // j
    R = N % j
    cnt += block * (j-1-K+1)
    if R:
        cnt += max(0, R - max(K,1) +1)
    #print(j, block, block * (j-1-K+1), max(0, R - K +1))
print(cnt)

Measured memory_bytes: 39408
#include <algorithm>
#include <bits/stdc++.h>

#define ll long long
#define pi (acos(-1))
#define rep(i, n) for (unsigned long long i = 0; i < (unsigned long long)(n); ++i)
using namespace std;
std::vector<unsigned ll> genprimevec(const unsigned ll N);
int main()
{
    int n;
    cin >> n;
    vector<int> v(n), vv;
    rep(i, n) { cin >> v[i]; }
    vv = v;
    sort(vv.begin(), vv.end());
    rep(i, n)
    {
        if (v[i] == vv[n - 1]) { cout << vv[n - 2] << endl; }
        else
        {
            cout << vv[n - 1] << endl;
        }

    }
    return 0;
}
    /*author  https://qiita.com/drken/items/0c88a37eec520f82b788*/
    ll extgcd(ll a, ll b, ll & x, ll & y)
    {
        if (b == 0)
        {
            x = 1, y = 0;
            return a;
        }
        ll d = extgcd(b, a % b, y, x);
        y -= a / b * x;
        return d;
    }


    std::vector<unsigned ll> genprimevec(const unsigned ll N)
    {
        std::vector<bool> is_prime(N + 1);
        for (unsigned ll i = 0; i <= N; i++) { is_prime[i] = true; }
        std::vector<unsigned ll> P;
        for (unsigned ll i = 2; i <= N; i++)
        {
            if (is_prime[i])
            {
                for (unsigned ll j = 2 * i; j <= N; j += i) { is_prime[j] = false; }
                P.emplace_back(i);
            }
        }
        return P;
    }


Measured memory_bytes: 4820
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
#define rep( i, n, m ) for(int i = ( n ); i < ( m ); i++)
#define rep_d( i, n, m ) for(int i = ( n ) - 1; i >= ( m ); i--)
const ll INF = 1LL << 60;
const int k_mod = 1e9 + 7;
template <class T> inline bool chmax( T& a, T b ) {
	if (a < b){
		a = b; return true;
	}
	return false;
}
template <class T> inline bool chmin( T& a, T b ) {
	if (a > b){
		a = b; return true;
	}
	return false;
}

int MAX = 1e5 + 1;

int main(){
	int N;
	cin >> N;
	int vec[ MAX ] = {}, fw[ MAX ] = {}, bw[ MAX ] = {};
	rep( i, 1, N + 1 ){
		cin >> vec[ i ];
		fw[ i ] = __gcd( vec[ i ], fw[ i - 1 ] );
	}
	rep_d( i, N + 1, 1 ){
		bw[ i ] = __gcd( vec[ i ], bw[ i + 1 ] );
	}
	int ans = 0;
	rep( i, 1, N + 1 ){
		ans = max( ans, __gcd( fw[ i - 1 ], bw[ i + 1 ] ));
	}
	cout << ans << endl;
}


Measured memory_bytes: 1408
#include <bits/stdc++.h>
using namespace std;
using ll = long long;

int main() {
  int N;
  cin >> N;
  string S;
  cin >> S;
  int res = 1;
  for (int i = 0; i < N-1; i++) {
    if (S[i] != S[i+1]) res++;
  }
  cout << res;
}


Measured memory_bytes: 512
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
const int mod = 1000000007;

int main(){
  string S;
  cin>>S;
  string key={"keyence"};
  vector<int> nn(7,-1);
  int aa=0;
  int bb=0;

  if (S==key){
    cout<<"YES"<<endl;
    return 0;
  }

  if (S[0]!='k' && S[S.length()-1]!='e') {
    cout<<"NO"<<endl;
    return 0;
  }

  if (S.substr(0,7)==key){
    cout<<"YES"<<endl;
    return 0;
  }

  if (S.substr(S.length()-7,7)==key){
    cout<<"YES"<<endl;
    return 0;
  }

  for (int i=0;i<S.length();i++){
    if (S[i]!=key[i]) {
      aa=i;
      break;
    }
  }

  int p=6;
  for (int i=S.length()-1;i>=0;i--,p--,bb++){
    if (S[i]!=key[p]){
      break;
    }
  }


  if (aa+bb>=7){
    cout<<"YES"<<endl;
  }
  else {
    cout<<"NO"<<endl;
  }
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) FOR(i, 0, (n))
#define FOR(i, a, b) for(int i=(a); i<(b); i++)
#define LAR(a, b) ((a)=max((a),(b)))
#define SML(a, b) ((a)=min((a),(b)))
using ll = long long;
using ld = long double;
using vi = vector<int>;
using vl = vector<ll>;
using pii = pair<int, int>;
using vpii = vector<pair<int, int>>;
template<typename T>
using pque = priority_queue<T, vector<T>, greater<T>>;
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define ALL(a) (a).begin(), (a).end()
#ifdef LOCAL_DEBUG
#define DEBUG(...) printf(__VA_ARGS__)
#else
#define DEBUG(...)
#endif

#define N 1123456
char s[N];
int a[N][2];

int main(){
	scanf("%s", s);
	int n = strlen(s);
	REP(i, n) s[i] -= '0';
	a[0][0] = 0, a[0][1] = 1;
	REP(i, n){
		a[i+1][0] = a[i][0] + s[i];
		if(s[i]) SML(a[i+1][0], a[i][1] + (10-s[i]));
		a[i+1][1] = a[i][1] + (9-s[i]);
		if(s[i] < 9) SML(a[i+1][1], a[i][0] + (s[i]+1));
		DEBUG("%d %d\n", a[i+1][0], a[i+1][1]);
	}
	printf("%d\n", a[n][0]);
}


Measured memory_bytes: 9472
n = int(input())
a = list(map(int, input().split()))
l = []
for i in a:
    l.append(i//400)
x = set()
y = 0
for i in l:
    if i<=7:
        x.add(i)
    else:
        y+=1
x = len(x)
if x:
    mi = x
else:
    mi = 1
ma = x+y
print('{} {}'.format(mi, ma))

Measured memory_bytes: 3064
#include<iostream>
#include<algorithm>
#include<cmath>
#include<cstring>
#include<stdio.h>
#include<map>
#include<queue>
#include<vector>
using namespace std;
const int mod=1e9+7;

typedef long long ll;

ll ksm(ll a,ll b){
	ll res=1;
	while(b){
		if(b&1)
			res=res*a%mod;
		a=a*a%mod;
		b>>=1;
	}
	return res;
}

ll n,ans;

int main(){
	cin>>n;
	ans=((ksm(10,n)-2*ksm(9,n)+ksm(8,n))%mod+mod)%mod;
	cout<<ans;
	return 0;
}

Measured memory_bytes: 3624
#include <ext/pb_ds/assoc_container.hpp>
#include <bits/stdc++.h>
using namespace std;
using namespace __gnu_pbds;
template <class c, class cmp = less<c> > using ordered_set = tree<c, null_type, cmp, rb_tree_tag, tree_order_statistics_node_update>;
#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define TRACE
#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
  cerr << name << " : " << arg1 << std::endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
  const char* comma = strchr(names + 1, ',');cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
#else
#define trace(...) 
#endif
template<class T> ostream& operator<<(ostream &os, vector<T> V) {os << "[ "; for(auto v : V) os << v << " "; return os << "]";}
template<class L, class R> ostream& operator<<(ostream &os, pair<L,R> P) {return os << "(" << P.first << "," << P.second << ")";}
template <typename T,typename U>pair<T,U> operator+(const pair<T,U> & l,const std::pair<T,U> & r) { return {l.first+r.first,l.second+r.second};}
typedef long long int ll;
const ll mod =1e9+7;
const int maxn = 100002;
#define endl '\n'
#define int ll
#define ld long double
#define all(x) (x).begin(),(x).end()

int32_t main()
{ 
   IOS
 

  int n;
  cin >> n;
  vector<int> a(n);
  for(int i = 0;i<n;i++) cin >> a[i];
  sort(all(a));
  reverse(all(a));
  int ans = a[0];
  if(n%2 == 0){
    for(int i = 1;i<=(n-2)/2;i++){
      ans += a[i]*2;
    }
  }
  else{
    for(int i = 1;i<=(n-2)/2;i++){
      ans += a[i]*2;
    }
    ans += (a[(n-2)/2 + 1]);
  }
  cout<<ans<<endl;
  
  
  


  
}

Measured memory_bytes: 4780
#include <iostream>
using namespace std;
#define FOR(i,a,b) for(int i=a;i<b;i++)
#define ll long long
int main(){
	ll n,k,ans=1;
	cin >> n >> k;
	FOR(i,0,n) ans *= k-1;
	cout << ans*k/(k-1) << endl;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(void)
{
	int W,H,x,y,r;
	
	scanf("%d %d %d %d %d",&W,&H,&x,&y,&r);
	
	if(x<r||x>W-r||y<r||y>H-r){
		printf("No\n");
	}
	else{
		printf("Yes\n");
	}
	return 0;
}

Measured memory_bytes: 580
#include<iostream>
#include<string>
#include<vector>
#include<utility>
#include<queue>
#include<algorithm>
#include<cmath>
#define INF 2147483647
#define llINF 9223372036854775807
#define pb push_back
#define mp make_pair 
#define F first
#define S second
#define ll long long

using namespace std;
int main(){
  string s,t;
  cin>>s>>t;
  int flag=0;
  for(int i=s.size()-t.size();i>=0;i--){
    for(int j=0;j<t.size();j++){
      if(j==t.size()-1&&(s[i+j]=='?'||s[i+j]==t[j])){
	flag=1;
	//cout<<"!"<<endl;
	for(int k=0;k<t.size();k++)
	  s[i+k]=t[k];
	break;
      }
      if(s[i+j]=='?'){
	//cout<<"!"<<endl;
	continue;
      }
      if(s[i+j]!=t[j]){
	//cout<<s[i+j]<<endl;
	break;
      }
    }
    if(flag)
      break;
  }
  for(int i=0;i<s.size();i++)
    if(s[i]=='?')
      s[i]='a';
  if(flag)
    cout<<s<<endl;
  else
    cout<<"UNRESTORABLE"<<endl;
  return 0;
}


Measured memory_bytes: 256
#include<cstdio>
#include<algorithm>
#include<queue>
#include<math.h>

using namespace std;

typedef long long ll;

ll N, L[100000], R[100000];

ll check(bool ok) {
  priority_queue<ll> left;
  priority_queue<ll, vector<ll>, greater<ll> > right;
  for (ll i = 0; i < N; i++) {
    left.push(L[i]);
    right.push(R[i]);
  }
  ll ans = 0;
  ll now = 0;
  for (ll i = 0; i < N; i++) {
    ll l = left.top() - now;
    ll r = now - right.top();
    if (l <= 0 && r <= 0) break;
    if (i == 0) {
      if (ok) {
        ans += (ll) l;
        now = left.top();
        left.pop();
      } else {
        ans += (ll) r;
        now = right.top();
        right.pop();
      }
    } else if (l > r) {
      ans += (ll) l;
      now = left.top();
      left.pop();
    } else {
      ans += (ll) r;
      now = right.top();
      right.pop();
    }
  }
  ans += (ll) abs(now);
  return ans;
}

int main(){
  scanf("%lld", &N);
  for (ll i = 0; i < N; i++) {
    scanf("%lld%lld", &L[i], &R[i]);
  }
  printf("%lld\n", max(check(true), check(false)));
}

Measured memory_bytes: 4716
#include <bits/stdc++.h>
using namespace std;

int main() {

	int N;
	cin >> N;

	string S;
	cin >> S;


	
	int result = 1;
	for (int i = 0; i < (int)S.size()-1; i++)
	{
		if (S[i] != S[i+1]) {
			result++;
		}
	}
	cout << result << endl;


	return 0;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
typedef long long ll;
#define REP(i, n) for(int i = 0; i < (int)(n); i++)
#define FOR(i, a, b) for(int i = (int)(a); i < (int)(b); i++)
using namespace std;

int main() {
    int N; cin >> N;
    ll a[N]; REP(i, N) cin >> a[i];
    ll dp[N+1][N];
    REP(i, N) dp[1][i] = a[i];
    FOR(l, 2, N+1){
        REP(i, N-l+1){
            dp[l][i] = max(-dp[l-1][i+1] + a[i], -dp[l-1][i] + a[i+l-1]);
        }
    }
    cout << dp[N][0] << endl;
    
}

Measured memory_bytes: 70528
#include <functional>
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <cstring>
#include <string>
#include <vector>
#include <random>
#include <bitset>
#include <queue>
#include <cmath>
#include <stack>
#include <set>
#include <map>
typedef long long ll;
using namespace std;
const ll MOD = 1000000007LL;

int main() {
    cin.sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);

    int n;
    cin >> n;

    int cur = 1;
    for (int i = 0; i < n; i++) {
        int a;
        cin >> a;
        if (a == cur) cur++;
    }

    if (cur == 1) {
        cout << -1 << '\n';
    } else {
        cout << n - cur + 1 << '\n';
    }

    return 0;
}

Measured memory_bytes: 380
#include <bits/stdc++.h>
using namespace std;
typedef long long int LL;
typedef vector<LL> vl;
typedef pair<LL, LL> pl;
typedef vector<pair<LL, LL>> VP;
typedef tuple<LL, LL, LL> tl;
const LL N=pow(10, 9)+7;
#define ull unsigned long long int 
#define endl "\n"
#define REP(i, a, b) for(LL i=a; i<b; i++)
#define RREP(i, a, b) for(LL i=a; i>b; i--)
#define WE(i) while(i--)
#define PB push_back
#define PF pop_front
#define MP make_pair
#define MT make_tuple
#define F first
#define S second

LL sod(LL a)
{
    LL sum=0;
    while(a!=0)
    {
        sum=sum+a%10;
        a=a/10;
    }
    return sum;
}

LL num1(LL a)
{
    LL s=0;
    while(a!=0){
        if(a%2==1){
            s++;
        }
        a=a/2;
    }
    return s;
}

LL bmod(string s, LL a)
{
    LL res=0;
    REP(i, 0, s.length()){
        res=(10*res+(LL)s[i]-'0')%a;
    }
    return res;
}

void pd(LL n) 
{ 
    LL ans=0, x=sqrt(n);
    if(x%1==0){
        REP(i, 1, x+1){
            if(n%i==0){
                ans+=2;
            }
            if(n==i*i){
                ans--;
            }
        }
    }
    else{
        REP(i, 0, x){
            if(n%i==0){
                ans+=2;
            }
        }
    }
    cout << ans << endl;
}

void primeFactors(LL n, vl &v)  
{  
    // Print the number of 2s that divide n  
    while (n % 2 == 0)  
    {  
        v.PB(2); 
        n = n/2;  
    }  
  
    // n must be odd at this point. So we can skip  
    // one element (Note i = i +2)  
    for (int i = 3; i <= sqrt(n); i = i + 2)  
    {  
        // While i divides n, print i and divide n  
        while (n % i == 0)  
        {  
            v.PB(i);
            n = n/i;  
        }  
    }  
  
    // This condition is to handle the case when n  
    // is a prime number greater than 2  
    if (n > 2)  
        v.PB(n);  
}  

LL decToBinary(LL n) 
{
    LL sum=0;
    while (n > 0) { 
        if(n%2==1) sum++; 
        n=n/2; 
    } 
    return sum;
} 

LL factorial(LL n) 
{ 
    if (n == 0) 
    return 1; 
    return n * factorial(n - 1); 
}

double dist(LL x1, LL y1, LL x2, LL y2){
    LL dx=x1-x2, dy=y1-y2;
    return(pow(dx*dx+dy*dy, 0.5));
}

LL solve()
{
    LL n;
    double ans=0.0;
    cin >> n;
    LL x[n], y[n];
    LL xx=factorial(n);
    REP(i, 0, n){
        cin >> x[i] >> y[i];
    }
    REP(i, 0, n){
        REP(j, 0, n){
            ans+=(dist(x[i], y[i], x[j], y[j]))/n;
        }
    }
    cout << fixed << setprecision(10) << ans << endl;
    return 0;
}

int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);

    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);

    LL T=1;
    //cin >> T;
    WE(T){
        solve();
    }
    return 0;
}

Measured memory_bytes: 384
#include <string>
#include <vector>
#include <algorithm>
#include <numeric>
#include <set>
#include <map>
#include <queue>
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cmath>
#include <ctime>
#include <cstring>
#include <cctype>
#include <cassert>
#include <limits>
#include <functional>
#include <complex>
#define rep(i,n) for(int (i)=0;(i)<(int)(n);++(i))
#define rer(i,l,u) for(int (i)=(int)(l);(i)<=(int)(u);++(i))
#define reu(i,l,u) for(int (i)=(int)(l);(i)<(int)(u);++(i))
#if defined(_MSC_VER) || __cplusplus > 199711L
#define aut(r,v) auto r = (v)
#else
#define aut(r,v) __typeof(v) r = (v)
#endif
#define each(it,o) for(aut(it, (o).begin()); it != (o).end(); ++ it)
#define all(o) (o).begin(), (o).end()
#define pb(x) push_back(x)
#define mp(x,y) make_pair((x),(y))
#define mset(m,v) memset(m,v,sizeof(m))
#define INF 0x3f3f3f3f
#define INFL 0x3f3f3f3f3f3f3f3fLL-1
double EPS=1e-9;
using namespace std;
typedef vector<int> vi; typedef pair<int, int> pii; typedef vector<pair<int, int> > vpii; typedef long long ll;
typedef complex<double> P;
template<typename T, typename U> inline void amin(T &x, U y) { if(y < x) x = y; }
template<typename T, typename U> inline void amax(T &x, U y) { if(x < y) x = y; }
long long int MOD = 1000000007;
/*
cin >> n;
vi a(n);
rep(i,n)cin>>a[i];
*/
vi primes;
int num[1005]={0};
int main(){
	int N;
	cin >>N;
	
	for(int i=2;i*i<=1000000;i++){
		bool flag=true;
		for(int j=0;j<primes.size();j++){
			if(i%primes[j]==0)flag=false;
		}
		if(flag)primes.pb(i);
	}
	for(int j=2;j<=N;j++){
		int temp=j;
		for(int k=0;k<primes.size();k++){
			int p=primes[k];
			while(temp%p==0){
				num[p]++;
				temp=temp/p;
				//cout<<p<<" ";
			}
		}
		//cout<<endl;
	}
	ll ans=(ll)1;
	for(int i=1;i<=1000;i++){
		ans =(ans*(ll)(num[i]+1))%MOD;
	}
	cout<<ans<<endl;
}


Measured memory_bytes: 256
#include <stdio.h>

int main(void){
    int H1,H2,M1,M2,K,result;
    scanf ("%d",&H1);
    scanf ("%d",&M1);
    scanf ("%d",&H2);
    scanf ("%d",&M2);
    scanf ("%d",&K);

    H1 = H1 *60;
    H2 = H2 *60;

    H1 = H1 + M1;
    H2 = H2 + M2;

    result = (H2 - H1) -K;

    printf("%d",result);
  
  	return 0;

}

Measured memory_bytes: 1724
#!/usr/bin/env python2
"""
This file is part of https://github.com/cheran-senthil/PyRival
Copyright 2019 Cheran Senthilkumar <hello@cheran.io>

"""
from __future__ import division, print_function

import itertools
import os
import sys
from atexit import register
from io import BytesIO


class dict(dict):
    """dict() -> new empty dictionary"""

    def items(self):
        """D.items() -> a set-like object providing a view on D's items"""
        return dict.iteritems(self)

    def keys(self):
        """D.keys() -> a set-like object providing a view on D's keys"""
        return dict.iterkeys(self)

    def values(self):
        """D.values() -> an object providing a view on D's values"""
        return dict.itervalues(self)


def gcd(x, y):
    """greatest common divisor of x and y"""
    while y:
        x, y = y, x % y
    return x


range = xrange

filter = itertools.ifilter
map = itertools.imap
zip = itertools.izip

sys.stdin = BytesIO(os.read(0, os.fstat(0).st_size))
sys.stdout = BytesIO()
register(lambda: os.write(1, sys.stdout.getvalue()))

input = lambda: sys.stdin.readline().rstrip('\r\n')


def main():
    a, b = map(int, input().split())

    if b % a == 0:
        print(a + b)
    else:
        print(b - a)


if __name__ == '__main__':
    main()


Measured memory_bytes: 28652
class Arrow
  attr_reader :source, :sink, :label

  def initialize(source, sink, label)
    @source = source
    @sink = sink
    @label = label
  end
end

def push(queue, label)
  size = queue.size
  index = queue.index{|entry| entry[0] >= label} || size
  return queue[index][1] if index < size && queue[index][0] == label

  return nil if index > 0 && !label.start_with?(queue[index - 1][0])
  queue.slice!(index..-1) if index < size && !queue[index][0].start_with?(label)

  nodes = {}
  queue.insert(index, [label.dup, nodes])
  nodes
end

def calc(n, arrows, start, goal)
  ins = Array.new(n){[]}
  arrows.each do |arrow|
    ins[arrow.sink] << arrow.source
  end

  reachable_from = {}
  stack = [goal]
  until stack.empty?
    node = stack.pop
    reachable_from[node] = true
    ins[node].each do |source|
      stack << source unless reachable_from[source]
    end
  end

  return nil unless reachable_from[start]
  arrows.select!{|arrow| reachable_from[arrow.sink]}

  outs = Array.new(n){[]}
  arrows.each do |arrow|
    outs[arrow.source] << [arrow.sink, arrow.label]
  end

  limit = n * arrows.map{|arrow| arrow.label.size}.max

  result = ''
  queue = [['', {start => true}]]
  until queue.empty?
    label, nodes = queue.shift
    result << label
    return result if nodes[goal]
    return nil if result.size > limit

    size = label.size
    queue.each do |next_label, _|
      next_label.slice!(0...size)
    end

    nodes.each do |node, _|
      outs[node].each do |sink, label|
        new_nodes = push(queue, label)
        new_nodes[sink] = true if new_nodes
      end
    end
  end
  nil
end

loop do
  n, a, s, g = gets.split.map(&:to_i)
  break if n == 0

  arrows = a.times.map{
    x, y, lab = gets.split
    Arrow.new(x.to_i, y.to_i, lab)
  }

  puts calc(n, arrows, s, g) || 'NO'
end

Measured memory_bytes: 9696
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		while(true) {
			String str = sc.nextLine();
			if(str.equals("END OF INPUT")) break;
			String [] a = str.split(" ");
			for(String ss:a) {
				System.out.print(ss.length());
			}
			System.out.println();
		}
	}
}



Measured memory_bytes: 25860
import java.util.Scanner;

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

		int N = scan.nextInt();

		int count = 0;

		for(int i =1; i < N+1 ; i++) {
			if( String.valueOf(i).length()%2 == 1) {
				count++;
			}
		}
		System.out.println(count);
		scan.close();
	}
}


Measured memory_bytes: 28372