akhauriyash/Code-Regression huggingface dataset:
#include<stdio.h>

int main(void){
    long long int x;
    long long int ureshisa500, ureshisa5;
    scanf("%lld",&x);
    ureshisa500 = (x / 500) * 1000;
    x = x % 500;
    ureshisa5 = (x / 5) * 5;
    printf("%lld\n", ureshisa500 + ureshisa5);
    return 0;
}

Measured memory_bytes: 128
n = int(input())
ls = list(map(int, input().split()))

ans = [0] * 9

for i in range(n):
	if 1 <= ls[i] <= 399:
		ans[0] += 1
	elif 400 <= ls[i] <= 799:
		ans[1] += 1
	elif 800 <= ls[i] <= 1199:
		ans[2] += 1
	elif 1200 <= ls[i] <= 1599:
		ans[3] += 1
	elif 1600 <= ls[i] <= 1999:
		ans[4] += 1
	elif 2000 <= ls[i] <= 2399:
		ans[5] += 1
	elif 2400 <= ls[i] <= 2799:
		ans[6] += 1
	elif 2800 <= ls[i] <= 3199:
		ans[7] += 1
	elif ls[i] >= 3200:
		ans[8] += 1

cnt = 0

for j in range(8):
	if ans[j] != 0:
		cnt += 1
		
print(max(cnt, 1), cnt + ans[8])

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

using namespace std;

int Solve(const int m, int n) {
    constexpr int MAX_Y = 7368792;
    vector<bool> year(MAX_Y, false);

    int idx = m;
    while (n--) {
        while (year[idx]) ++idx;
        for (int i = 1; i * idx < MAX_Y; ++i)
            year[i * idx] = true;
    }

    while (year[idx]) ++idx;

    return idx;
}

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

    int m, n;

    while (cin >> m >> n, m)
        cout << Solve(m, n) << '\n';

    return 0;
}



Measured memory_bytes: 4004
def check753(s):
    global n
    if int(s) > n:
        return 0
    else:
        cnt = 1 if all(s.count(c) > 0 for c in '753') else 0
        for c in '753':
            cnt += check753(s+c)
        return cnt

if __name__ == "__main__":
    n = int(input())
    print(check753('0'))


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

int main() {
  int n, m;
  cin >> n >> m;

  int A[n][m];
  for (int i = 0; i < n; i++)
    for (int j = 0; j < m; j++)
      cin >> A[i][j];

  int b[m];
  for (int i = 0; i < m; i++)
    cin >> b[i];

  int c[n] = {};
  for (int i = 0; i < n; i++)
    for (int j = 0; j < m; j++)
      c[i] += A[i][j] * b[j];

  for (int i = 0; i < n; i++)
    cout << c[i] << endl;
    
  return 0;
}


Measured memory_bytes: 3116
#include <iostream>
#include <vector>
#include <array>
#include <deque>
#include <queue>
#include <list>
#include <map>
#include <set>
#include <algorithm>
#include <numeric>
#include <utility>
#include <cmath>

using namespace std;
using i64=long long int;

int main() {
    int N;
    cin >> N;
    vector<int> cost(N+1, 1000000);

    cost[0] = 0;
    for (int i = 0; i < N; ++i) {
        cost[i+1] = min(cost[i+1], cost[i]+1);
        int j = 6;
        while (i+j <= N) {
            cost[i+j] = min(cost[i+j], cost[i]+1);
            j *= 6;
        }
        j = 9;
        while (i+j <= N) {
            cost[i+j] = min(cost[i+j], cost[i]+1);
            j *= 9;
        }
    }

    cout << cost[N] << endl;

    return 0;
}


Measured memory_bytes: 640
#include<bits/stdc++.h>
#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define REPS(i,n) for(int i=1, i##_len=(n); i<i##_len; ++i)
#define all(x) (x).begin(),(x).end()
using ll = long long;
using namespace std;
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; }
#define INF 1e9
#define PI (acos(-1))
int main() {
    int n,f=0;
    cin>>n;
    REP(i,9){
        if(n%(i+1)==0){
            if(n/(i+1)<10){
                f=1;
            }
        }
    }
    if(f)cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main()
{
	int A, B, C, i, stand;
	cin >> A >> B >> C;
	if (A != B && A != C) {
		cout << A << endl;
	}
	else if (B != A && B != C) {
		cout << B << endl;
	}
	else {
		cout << C << endl;
	}
	return 0;
}

Measured memory_bytes: 256
# -*- coding: utf-8 -*-
"""
http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ITP1_3_B&lang=jp

"""
import sys
from sys import stdin
input = stdin.readline


def main(args):
    count = 1
    while True:
        x = int(input())
        if x == 0:
            break
        print('Case {}: {}'.format(count, x))
        count += 1


if __name__ == '__main__':
    main(sys.argv[1:])
    

Measured memory_bytes: 7760
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define repr(i,n) for(int i = (int)(n); i >= 0; i--)
#define all(v) v.begin(),v.end()
typedef long long ll;

int main(){
    int N,X,Y;
    cin >> N >> X >> Y;
    vector<vector<int> > vec(N + 1,vector<int>(N + 1));
    for (int i = 1; i <= N - 1; i++){
        for (int j = i + 1; j <= N; j++){
            vec[i][j] = min(j - i, min(max(X - i, i - X) + 1 + max(Y - j, j - Y), max(Y - i, i - Y) + 1 + max(X - j, j - X)));
        }
    }
    vector<int> answer_vec(N,0);
    for (int i = 1; i <= N - 1; i++){
        for (int j = i + 1; j <= N; j++){
            answer_vec[vec[i][j]]++;
        }
    }
    for (int i = 1; i <= N - 1; i++){
        cout << answer_vec[i] << endl;
    }
}



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

using namespace std ;

#define sz(v) (int)v.size()
#define ll long long
#define all(v)  v.begin() , v.end()
#define rall(v)  v.rbegin() , v.rend()
#define pf push_front
#define pb push_back
#define fast FastInputOutput() ;
#define Clear( container , value ) memset( container , value , sizeof container )
#define PI acos( -1.0 )
#define forn( t , v , be , n ) for( t v = be ; v < n ; v++ )
#define fore( x , j ) for( auto x : j )
#define se second
#define fr first
//#define c_b fflush(stdin);

const ll Long_max = numeric_limits < ll > :: max() ;
const int Int_max = numeric_limits < int > :: max() ;

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

void File_input( string pathIn ) {
    freopen( pathIn.c_str(), "r", stdin ) ;
}

void File_output( string pathOut ) {
    freopen( pathOut.c_str(), "w", stdout ) ;
}

int msg() {
    srand( time( 0 ) ) ;
    vector < string > st = {
        "Wish everyone high ratings!",
        "Good luck!",
        "Have fun!",
        "Please, read all the problems!",
        "Go Go fight!"
    } ;
    cerr << st[ rand() % sz( st ) ] ;
    return 0 ;
}

void FastInputOutput() {
    ios_base :: sync_with_stdio( 0 ) ;
    cin.tie( 0 ) ;
    cout.tie( 0 ) ;
}

int w , h ;
double x , y ;

int main() {

   cin >> w >> h >> x >> y ;
   vector < pair < int , int > > vec ;
   vec.pb( { 0 , 0 } ) ;
   vec.pb( { 0 , h } ) ;
   vec.pb( { w , 0 } ) ;
   vec.pb( { w , h } ) ;

   forn( int , i , 0 , 4 ){
      if( vec[ i ].first == x && vec[ i ].second == y ){
         double area = (double)w * h / 2 ;
         cout << fixed << setprecision( 9 ) << area << " " << 0 << "\n" ;
         return 0 ;
      }
   }

   if( abs( ( (double)w / 2 ) - (double)x ) < 1e-9 && abs( ( (double)h / 2 ) - (double)y ) < 1e-9 ){
         double area = (double)w * h / 2 ;
         cout << fixed << setprecision( 9 ) << area << " " << 1 << "\n" ;
         return 0 ;
   }


   double area = (double)w * h / 2 ;
   cout << fixed << setprecision( 9 ) << area << " " << 0 << "\n" ;





   return 0 ;
}



Measured memory_bytes: 256
#pragma gcc optimize("Ofast")
#include<bits/stdc++.h>
using namespace std;
#define FOR(i,r,n) for(ll i=(ll)(r);i<(ll)(n);++i)
#define RFOR(i,r,n) for(ll i=(ll)(n-1);i>=r;--i)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define ALL(x) x.begin(),x.end()
#define RALL(x) x.rbegin(),x.rend()
#define SORT(c) sort(ALL((c)))
#define RSORT(c) sort(RALL((c)))
#define pb(n) push_back(n)
#define endl '\n'
#define debug(x) cout << #x << " = " << (x) << endl
#define IN(n) cin >> n
#define IN2(a,b) cin >> a >> b
#define IN3(a,b,c) cin >> a >> b >> c
#define VIN(V) for(int ii = 0; ii < (V).size(); ii++) {cin >> (V).at(ii);}
#define OUT(n) cout << n << endl
#define OUT2(n1,n2) cout << n1 << " " << n2 << endl
#define OUT3(n1,n2,n3) cout << n1 << " " << n2 << " " << n3 << endl
#define VOUT(V) REP(ii,(V).size()){cout << (V)[ii] << " ";} cout<<endl;
#define VOUT2(V) REP(jj,(V).size()){VOUT(V[jj])}
typedef long long int ll;
typedef vector<ll> vi;
typedef vector<vi > vvi;
typedef vector<pair<ll, ll> > vp;
typedef vector<string> vs;
typedef vector<char> vc;
typedef list<ll> lst;
typedef pair<ll, ll> P;
const long long INF = numeric_limits<ll>::max();
const long long MOD = 1000000007;
const long double PI = 3.1415926;
template <class T> T &chmin(T &a, const T &b) { return a = min(a, b); }
template <class T> T &chmax(T &a, const T &b) { return a = max(a, b); }
ll n, m, k, ans, sum, cnt = 0; string s; char c; bool flg;

int main(){
  cin.tie(0);ios::sync_with_stdio(false);
  ll l;
  IN2(n,l);

  ll min = 10000;
  ll min2 = 10000;
  FOR(i,l,l+n) {
    ans += i;
    if (min > abs(i)){
      min = abs(i);
      min2 = i;
    }
  }

  OUT(ans-min2);
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<long long> vll;
typedef vector<pair<int,int>> vp;
typedef pair<int,int> pii;
#define INF (int)(1e9)
#define MAXX 1.1529215e+18
#define inf 999999
#define EPS (1e-7)
#define rep(i,n) for(int i=0; i<(int)(n);i++)
#define REP(i,n) for(int i=1;i<=(int)(n);i++)
#define FOR(i,k,n) for(int i=(k);i<(int)(n);i++)
#define ALL(a)  a.begin(),a.end()
#define RALL(a) a.begin(),a.end(),greater<int>()
#define ROT(a) a.begin(),a.begin()+1,a.end()
#define RROT(a) a.begin(),a.end()-1,a.end()
#define PB push_back
#define MP make_pair
#define PI acos(-1.0)
#define sz(a) a.size()
const ll MOD = 1e9+7;
const int MAX = 10000000;
template<typename T1, typename T2> inline bool chmin(T1 &a, T2 b) { if (a > b) { a = b; return 1; } return 0; }
template<typename T1, typename T2> inline bool chmax(T1 &a, T2 b) { if (a < b) { a = b; return 1; } return 0; }
template<typename T> T gcd(T a, T b) { if (b == 0) return a; return gcd(b, a % b); }
//cout << 'H' << endl;
//next_permutation(ALL(p));
//typedef priority_queue<int> pque;//これは大きい順
//typedef priority_queue<int, vector<int>, greater<int>> pque;//これは小さい順
//factorizeは、素因数分解用の関数

int main(){
	int n;
	cin >> n;
	cout << n*n*n <<  endl;

  return 0;
}


Measured memory_bytes: 256
import java.io.InputStream;
import java.io.PrintStream;
import java.util.Arrays;
import java.util.Scanner;

public class Main {
	InputStream in = System.in;
	PrintStream out = System.out;

	public void _main(String[] args) {
		Scanner sc = new Scanner(in);

		int N = sc.nextInt();
		int M = sc.nextInt();
		
		int[] A = nextIntArray(sc, M);

		int sum = 0;
		for(int a : A) {
			sum += a;
		}
		
		if(sum > N) {
			out.println(-1);
		}else {
			out.println(N-sum);
		}
		
		
		sc.close();

	}

	public static void main(String[] args) {
		new Main()._main(args);
	}

	@SuppressWarnings("unused")
	private String join(String delimiter, int[] a) {
		StringBuilder sb = new StringBuilder();

		for (int i = 0; i < a.length; i++) {
			sb.append(a[i]);
			sb.append(delimiter);
		}
		return sb.substring(0, Math.max(sb.length() - delimiter.length(), 0));
	}

	@SuppressWarnings("unused")
	private String join(String delimiter, long[] a) {
		StringBuilder sb = new StringBuilder();

		for (int i = 0; i < a.length; i++) {
			sb.append(a[i]);
			sb.append(delimiter);
		}
		return sb.substring(0, Math.max(sb.length() - delimiter.length(), 0));
	}

	@SuppressWarnings("unused")
	private int max(int[] arr) {
		if(arr == null || arr.length == 0) {
			throw new IllegalArgumentException(Arrays.toString(arr));
		}

		int candidate = arr[0];
		for(int i=1;i<arr.length;i++) {
			candidate = candidate > arr[i] ? candidate : arr[i];
		}
		return candidate;
	}

	@SuppressWarnings("unused")
	private long max(long[] arr) {
		if(arr == null || arr.length == 0) {
			throw new IllegalArgumentException(Arrays.toString(arr));
		}

		long candidate = arr[0];
		for(int i=1;i<arr.length;i++) {
			candidate = candidate > arr[i] ? candidate : arr[i];
		}
		return candidate;
	}

	@SuppressWarnings("unused")
	private int min(int[] arr) {
		if(arr == null || arr.length == 0) {
			throw new IllegalArgumentException(Arrays.toString(arr));
		}

		int candidate = arr[0];
		for(int i=1;i<arr.length;i++) {
			candidate = candidate < arr[i] ? candidate : arr[i];
		}
		return candidate;
	}

	@SuppressWarnings("unused")
	private long min(long[] arr) {
		if(arr == null || arr.length == 0) {
			throw new IllegalArgumentException(Arrays.toString(arr));
		}

		long candidate = arr[0];
		for(int i=1;i<arr.length;i++) {
			candidate = candidate < arr[i] ? candidate : arr[i];
		}
		return candidate;
	}

	@SuppressWarnings("unused")
	private int[] nextIntArray(Scanner sc, int n) {
		int[] result = new int[n];
		for (int i = 0; i < n; i++) {
			result[i] = sc.nextInt();
		}
		return result;
	}

	@SuppressWarnings("unused")
	private long[] nextLongArray(Scanner sc, int n) {
		long[] result = new long[n];
		for (int i = 0; i < n; i++) {
			result[i] = sc.nextLong();
		}
		return result;
	}

	@SuppressWarnings("unused")
	private int[] nextIntArray1origin(Scanner sc, int n) {
		int[] result = new int[n + 1];
		for (int i = 1; i <= n; i++) {
			result[i] = sc.nextInt();
		}
		return result;
	}
}


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

int main()
{
ll n ;
cin >> n ;
rep(i,n){
  if(i+1<10)ans++;
  if(100<=i+1&&i+1<1000)ans++;
  if(10000<=i+1&&i+1<100000)ans++;
}

cout << ans << endl;
return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<string>
#include<cstdlib>
#include<map>
#include<iomanip>
#include<sstream>
#include<vector>
#include<stack>
#include<math.h>
#include<queue>
#include<complex>
using namespace std;
const long long int INF = 99999999999999999;
struct ab {
	long long int a, b;
};

bool cmp(ab x,ab y){
	return x.b < y.b;
}
int main() {
	complex<long double>cmpmp;
	const long long int mod = 1000000007;
	map<long long int, long long int>mp;
	//cout << fixed << setprecision(10);
	string str;
	long long int a,b,c,d,n,time=0;
	ab task[200005];
	cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> task[i].a >> task[i].b;
	}
	sort(task, task + n, cmp);
	for (int i = 0; i < n; i++) {
		time += task[i].a;
		if (time > task[i].b) {
			cout << "No";
			return 0;
		}
	}
	cout << "Yes";
}

Measured memory_bytes: 3328
#include"bits/stdc++.h"
using namespace std;
using ll = int64_t;

int main() {
    ll n, m, d;
    cin >> n >> m >> d;

    //printf("%.10f\n", 2 * (n - d) * (m - 1) * pow(n, m - 2) / pow(n, m));
    if (d == 0) {
        printf("%.10f\n", 1.0 * (n - d) * (m - 1) / pow(n, 2));
    } else {
        printf("%.10f\n", 2.0 * (n - d) * (m - 1) / pow(n, 2));
    }
}

Measured memory_bytes: 256
using System;

public class MainCls
{
	public static void Main(string[] args)
	{
		string m = Console.ReadLine();
		string[] input = m.Split(' ');
		int ab = int.Parse(input[0]);
		int bc = int.Parse(input[1]);
		int ca = int.Parse(input[2]);
		

		Console.WriteLine(ab * bc / 2);
	}
}

Measured memory_bytes: 11092
#include <bits/stdc++.h>
#include <boost/multiprecision/cpp_int.hpp>
using namespace std;

//#define int long long
//using ll = boost::multiprecision::cpp_int;
using ll = long long;
//constexpr int INF = 1e9;//INT_MAX=(1<<31)-1=2147483647
constexpr ll INF = (ll)1e18;//(1LL<<63)-1=9223372036854775807
constexpr ll MOD = (ll)1e9 + 7;
constexpr double EPS = 1e-9;
constexpr int dx[4]={1,0,-1,0};
constexpr int dy[4]={0,1,0,-1};
#ifdef LOCAL_ENV
	#define debug(var) std::cout<<#var" = "<<var<<std::endl
#else
	#define debug(var)
#endif
#define p(var) std::cout<<var<<std::endl
#define rep(i, n)   for(ll i=0, i##_length=(n); i< i##_length; ++i)
#define repeq(i, n) for(ll i=1, i##_length=(n); i<=i##_length; ++i)
#define all(a) (a).begin(), (a).end()
#define PI (acos(-1))
template<typename T> inline T power(T x, T n){ return n ? power(x*x%MOD,n/2)*(n%2?x:1)%MOD : 1; }
template<typename T> inline T gcd(T a, T b) { return b ? gcd(b,a%b) : a; }
template<typename T> inline T lcm(T a, T b) { return a / gcd(a,  b) * b; }
template<typename T1, typename T2>inline bool chmax(T1 &a, T2 b) { return a < b && (a = b, true); }
template<typename T1, typename T2>inline bool chmin(T1 &a, T2 b) { return a > b && (a = b, true); }
template<typename T1, typename T2> ostream& operator<<(ostream& s, const pair<T1, T2>& p) {return s << "(" << p.first << ", " << p.second << ")";}
template<typename T> ostream& operator<<(ostream& s, const vector<T>& v) {
	for (int i = 0, len = v.size(); i < len; ++i){
		s << v[i]; if (i < len - 1) s << "\t";
	}
	return s;
}
template<typename T> ostream& operator<<(ostream& s, const vector< vector<T> >& vv) {
	for (int i = 0, len = vv.size(); i < len; ++i){
		s << vv[i] << endl;
	}
	return s;
}
template<typename T1, typename T2> ostream& operator<<(ostream& s, const map<T1, T2>& m) {
	s << "{" << endl;
	for (typeof(m.begin()) itr = m.begin(); itr != m.end(); ++itr){
		s << "\t" << (*itr).first << " : " << (*itr).second << endl;
	}
	s << "}" << endl;
	return s;
}

/*-----8<-----8<-----*/



constexpr ll N_MAX = 100000;
constexpr ll M_MAX = 100000;
constexpr ll A_I_MAX = 100000;
constexpr ll B_I_MAX = 10000;

ll N, M;
vector<pair<ll,ll>> a;
void input() {
	cin>>N>>M;
	a.assign(N,pair<ll,ll>());

	rep(i, N) cin>>a[i].first>>a[i].second;


}

void solve() {
	ll ans = 0;

	sort(a.begin(), a.end(), [](const pair<ll,ll> &x, const pair<ll,ll> &y) {
		return x.first < y.first;
	});
	debug(a);

	priority_queue<ll, vector<ll>, function<bool(ll,ll)>>que(
		[](const ll &x, const ll &y){
			return x < y;
		}//xの優先度が低いときに対してtrueを返すこと この場合皇潤優先
	);

	ll day=1;
	ll aindex=-1;
	repeq(day,M){
		//que追加
		while((aindex+1)<N){
			aindex++;
			if(a[aindex].first<=day){
				que.push(a[aindex].second);
			}else{
				aindex--;
				break;
			}
		}
		
		if(!que.empty()){
			ll t=que.top();
			que.pop();
			ans+=t;
			debug(t);
		}

	}


	cout<<ans<<endl;
}

signed main() {
	input();
	solve();
	return 0;
}


Measured memory_bytes: 2936
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
string s, sol;

int main() {
    cin.tie(0); ios::sync_with_stdio(0);
    cin >> s;
    int len = s.length();
    for (int i = 0; i < len; i++) {
        if (s[i] == '?') {
            sol += 'D';
        } else {
            sol += s[i];
        }
    }
    cout << sol;
    return 0;
}


Measured memory_bytes: 3864
#include <iostream>
#include <algorithm>
#include <tuple>
#include <vector>
#include <string>
#include <queue>
#include <cmath>
#include <iomanip>

using namespace std;

int main()
{
    int k;
    cin >> k;
    queue<long long> que;
    for(int i = 1; i < 10; i++) que.push(i);
    int num = 0;
    while(!que.empty()){
        long long now = que.front();
        que.pop();
        num++;
        if(num == k){
            cout << now << endl;
            return 0;
        }
        if(now%10 != 0){
            que.push(10*now + now%10 -1);
        }
        que.push(10 * now + now%10);
        if(now%10 != 9){
            que.push(10 * now + now%10 +1);
        }
    }
    return 0;
}

Measured memory_bytes: 5180
#include<stdio.h>
#include<math.h>
int main() {
	int h,m,s,S;
	scanf("%d", &S);
	h = S / 3600;
	m = S % 3600 /60;
	s = S % 3600 % 60;
	printf("%d:%d:%d\n", h, m,s);
	return 0;
}

Measured memory_bytes: 2728
#include<stdio.h>
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<utility>
#include<map>
#include<set>
#include<queue>
#include<stack>
#include<functional>
#include<math.h>
#include<random>
#include <bitset>
using namespace std;
#define N (1000000000+7)
//#define N 998244353
#define INF 1e16
typedef long long ll;
typedef pair<int,int> P;
typedef pair<int,P> Q;
 
const int inf = (int)1e9; 
 
ll gcd(ll a, ll b) {
	if (b > a) {
		ll tmp = b;
		b = a;
		a = tmp;
	}
	if (a%b == 0)return b;
	else return gcd(b, a%b);
}

int main(void){
	int n;
	cin>>n;
	ll ans = 0;
	vector<ll>a(n);
	for(int i=0;i<n;i++)cin>>a[i];
	for(int i=1;i<n;i++){
		if(a[i-1]<=a[i])continue;
		else{
			ll r = a[i-1]-a[i];
			a[i]+=r;
			ans +=r;
		}
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 4776
#include<bits/stdc++.h>
#define mod 1000000007
//#define mx 300005
//#define y 3
using namespace std;
typedef  long long int ll;
#define  f(i, n) for(int i = 0; i < n; ++i)
#define pb push_back

void input(){
  string s; cin >> s;
  int k = s.size();
  int cnt = 0;
  f(i, k)if(s[i] == 'o')++cnt;
  cnt += (15 - k);
  if(cnt >= 8)cout << "YES" <<endl;
  else cout << "NO" <<endl;
}
int main(){
    input();
    return 0;
}



Measured memory_bytes: 256
import Foundation

let line = readLine()!
let N = Int(line)!
  
// Nの1の位が2,4,5,7,9のとき 'hon'
// Nの1の位が0,1,6,8のとき 'pon'
// Nの1の位が3のとき 'bon'

let n = N % 10
switch n {
case 3:
    print("bon")
case 0,1,6,8:
    print("pon")
default:
    print("hon")
}


Measured memory_bytes: 13080
#include<iostream>
#include<algorithm>
#include<vector>
#include<map>

using namespace std;

int main() {

  map<char,string> S;
  cin >> S['a'] >> S['b'] >> S['c'];

  char winner;
  char next = 'a';
  while(1) {
    // カードを持っていないならあがり
    if (S[next].empty()) {
      winner = next;
      break;
    }
    // 先頭のカードを捨てる
    char temp = S[next].front();
    S[next].erase(0,1);
    // 次のプレイヤーの更新
    next = temp;
  }

  cout << char(winner+('A'-'a')) << endl;
}

Measured memory_bytes: 256
def main():
    N, M, K = map(int, input().split())
    A = list(map(int, input().split()))
    B = list(map(int, input().split()))
    idxA = 0
    idxB = 0
    for i in range(N):
        if A[i] <= K:
            K -= A[i]
            idxA += 1
        else:
            break
    ans = 0
    while idxA >= 0:
        while idxB < M and B[idxB] <= K:
            K -= B[idxB]
            idxB += 1
        ans = max(ans, idxA + idxB)
        idxA -= 1
        K += A[idxA]
    print(ans)


if __name__ == "__main__":
    main()


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

#define ll long long
#define endl "\n"
#define int ll

signed main ()
{

#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif

	ios_base::sync_with_stdio(false);

	double now;
	cin >> now;
	now /= 3.0;
	cout << fixed << setprecision(10) << now*now*now << endl;

	return 0;

}


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

int main() {
    char str[1001];
    int sum = 0;

    while (1) {
        scanf("%s", str);
        if (str[0] == '0') break;
        sum = 0;
        rep(i, strlen(str)) {
            sum += str[i] - '0';
        }
        printf("%d\n", sum);
    }
}


Measured memory_bytes: 3204
#include <bits/stdc++.h>
#define _USE_MATH_DEFINES
#include <math.h>
#include <algorithm>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define acc(v) accumulate(v.begin(), v.end(), 0)

using namespace std;
typedef long long ll;
const int INF = 1e9;
const ll LINF = 1e18;
const ll MOD = 1e9 + 7;

int main()
{
	int n;
	cin >> n;
	vector<int> v(n);
	int ans = 0;
	int now = 0;
	rep(i, n)
	{
		cin >> v[i];
		if(v[i] == now+1){
			ans++;
			now++;
		}
	}
	cout << (ans!=0 ? n - ans : -1) << endl;
}


Measured memory_bytes: 1024
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int a = scanner.nextInt();
        int b = scanner.nextInt();
        int c = scanner.nextInt();
        if (a <= b) {
            if (b <= c) {
                System.out.println(a+" "+b+" "+c);
            } else {
                if(a<=c){
                     System.out.println(a+" "+c+" "+b);
                }else{
                     System.out.println(c+" "+a+" "+b);
                } 
            }              
        }else {
            if (b >= c) {
                System.out.println(c+" "+b+" "+a);
            } else {
                if(a<=c){
                     System.out.println(b+" "+a+" "+c);
                }else{
                     System.out.println(b+" "+c+" "+a);
                } 
            }              
            
        }
    }
}

Measured memory_bytes: 25876
#!/usr/bin/env python3
# -*- coding: utf-8 -*-

import array
import itertools
import sys


class RecursiveDepthFirstSearch(object):

    def __init__(self, width, height, stage):
        self.width = width
        self.height = height
        self.stage = stage

    def search(self, x0, y0):
        if x0 < 0 or self.width <= x0 or y0 < 0 or self.height <= y0:
            pass
        elif self.stage[x0][y0] == 0:
            pass
        else:
            self.stage[x0][y0] = 0
            for dx, dy in itertools.product(range(-1, 2), range(-1, 2)):
                if dx != 0 or dy != 0:
                    self.search(x0 + dx, y0 + dy)


if __name__ == "__main__":
    sys.setrecursionlimit(10000)
    while True:
        w, h = map(int, input().split())
        if w == 0 and h == 0:
            break
        else:
            stage = [array.array("B", x) for x in zip(
                *[list(map(int, input().split())) for y in range(h)])]
            dfs = RecursiveDepthFirstSearch(w, h, stage)
            answer = 0
            for x, y in itertools.product(range(w), range(h)):
                if dfs.stage[x][y] == 1:
                    dfs.search(x, y)
                    answer += 1
            print(answer)

Measured memory_bytes: 10224
#include <iostream>
#include <string>
#include <cmath>
#include <vector>
#include <queue>
#include <algorithm>
using namespace std;

string solver() {
	int a, b;
	cin >> a >> b;
	if (a % 2 == 0) return "No";
	if (b % 2 == 0) return "No";
	return "Yes";

}

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

	cout << solver() << "\n";
	return 0;
}

Measured memory_bytes: 256
import sys
#sys.stdin=open("data.txt")
input=sys.stdin.readline

n,m=map(int,input().split())

g=[list(map(lambda x:int(x)-1,input().split())) for _ in range(n)]
picking=[0]*n

# all sports available
hist=[0]*m
sport=[1]*m
for i in range(n):
    hist[g[i][0]]+=1
ans=max(hist)

# keep getting rid of the busiest sport
for _ in range(m-1):
    # pick busiest sport
    b=0
    while not sport[b]: b+=1
    for i in range(b+1,m):
        if hist[b]<hist[i]:
            b=i
    sport[b]=0
    # move people
    for i in range(n):
        while not sport[g[i][picking[i]]]:
            hist[g[i][picking[i]]]-=1
            picking[i]+=1
            hist[g[i][picking[i]]]+=1
    # check answer
    ans=min(ans,max(hist))

print(ans)


Measured memory_bytes: 43868
/*
Rathin Bhargava
IIIT Bangalore

*/
#include<bits/stdc++.h>
#define mt make_tuple
#define mp make_pair
#define pu push_back
#define INF 1000000001
#define MOD 1000000007
#define EPS 1e-6
#define ll long long int
#define ld long double
#define fi first
#define se second
#define all(v) v.begin(),v.end()
#define pr(v) { for(int i=0;i<v.size();i++) { v[i]==INF? cout<<"INF " : cout<<v[i]<<" "; } cout<<endl;}
#define t1(x)                cerr<<#x<<" : "<<x<<endl
#define t2(x, y)             cerr<<#x<<" : "<<x<<" "<<#y<<" : "<<y<<endl
#define t3(x, y, z)          cerr<<#x<<" : " <<x<<" "<<#y<<" : "<<y<<" "<<#z<<" : "<<z<<endl
#define t4(a,b,c,d)          cerr<<#a<<" : "<<a<<" "<<#b<<" : "<<b<<" "<<#c<<" : "<<c<<" "<<#d<<" : "<<d<<endl
#define t5(a,b,c,d,e)          cerr<<#a<<" : "<<a<<" "<<#b<<" : "<<b<<" "<<#c<<" : "<<c<<" "<<#d<<" : "<<d<<" "<<#e<<" : "<<e<<endl
#define t6(a,b,c,d,e,f)          cerr<<#a<<" : "<<a<<" "<<#b<<" : "<<b<<" "<<#c<<" : "<<c<<" "<<#d<<" : "<<d<<" "<<#e<<" : "<<e<<" "<<#f<<" : "<<f<<endl
#define GET_MACRO(_1,_2,_3,_4,_5,_6,NAME,...) NAME
#define t(...) GET_MACRO(__VA_ARGS__,t6,t5, t4, t3, t2, t1)(__VA_ARGS__)
#define _ cerr<<"here"<<endl;
#define __ {ios::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);}

using namespace std;
template<class A, class B> ostream& operator<<(ostream& out, const pair<A, B> &a){ return out<<"("<<a.first<<", "<<a.second<<")";}
template <int> ostream& operator<<(ostream& os, const vector<int>& v) { os << "["; for (int i = 0; i < v.size(); ++i) { if(v[i]!=INF) os << v[i]; else os << "INF";if (i != v.size() - 1) os << ", "; } os << "]\n"; return os; } 
template <typename T> ostream& operator<<(ostream& os, const vector<T>& v) { os << "["; for (int i = 0; i < v.size(); ++i) { os << v[i]; ;if (i != v.size() - 1) os << ", "; } os << "]\n"; return os; } 

bool f(string &s, string &t)
{
  int left = 0, right = 0;

  for(; left<s.size() && right<t.size();left++)
  {
    if(s[left] == t[right]) 
    {
      right++;
      if(right == t.size()) return true;
    }
  }

  return false;
}

int main()
{
  __;
  int n;
  cin >> n;
  string s;
  cin >> s;
  int count = 0;
  for(int i=0;i<=999;i++)
  {
    string t = to_string(i);
    if(t.size() == 1)
    {
      t = "00" + t;
    }
    else if(t.size() == 2)
    {
      t = "0" + t;
    }
    count += f(s,t);
  }
  cout << count << endl;
  return 0;
}



Measured memory_bytes: 384
from collections import Counter
n = int(input())
v = list(map(int, input().split()))
E = Counter(v[::2]).most_common()
O = Counter(v[1::2]).most_common()
if E[0][0] != O[0][0]:
    print(n - E[0][1] - O[0][1])
else:
    if E[0][1] == O[0][1] == n //2:
        print(E[0][1])
    else:
        print(min(n-E[1][1]-O[0][1], n-E[0][1]-O[1][1]))

Measured memory_bytes: 20700
import java.util.Scanner;

public class Main {
	private static final String ALF = "abcdefghijklmnopqrstuvwxyz"; 
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

		long dog = sc.nextLong();

		String dogName = convertToName(dog);
		System.out.println(dogName.toString());
	}

	static String convertToName(long dog) {
		//文字数を特定する
		int digitNum = 1;
		long[] digitParts = new long[15];
		digitParts[0] = 26;
		long digitSum = 26;
		for (int i = 0; digitSum < dog; i++) {
			digitParts[i + 1] = (long) (Math.pow(ALF.length(), ++digitNum));
			digitSum += digitParts[i + 1];
		}
		
		int[] res = new int[digitNum];
		
		/// 与えられた数から桁数-1までの組み合わせ分だけ引く
		for (int i = 0; i < digitNum - 1; i++) {
			dog -= digitParts[i];
		}
		
		// 計算した数を26進数に変換する
		//0始まりとする
		dog --;
		for(int i = digitNum - 1; i > 0; i--) {
			int rankNum = 0;
			while(Math.pow(ALF.length(), i) * (rankNum + 1) <= dog) {
				rankNum++;
			}
			res[digitNum - 1 - i] = rankNum;
			dog -= Math.pow(ALF.length(), i) * rankNum;
		}
		res[digitNum - 1] = (int) dog;
		
		// 26進数を文字に変換する
		StringBuffer dogName = new StringBuffer();
		for (int i = 0; i < res.length; i++) {
			dogName = dogName.append(ALF.charAt(res[i]));
		}
		return dogName.toString();
	}
}


Measured memory_bytes: 35832
#include<iostream>
#include<iomanip>
#include<algorithm>
#include<bitset>
#include<cctype>
#include<cmath>
#include<cstdio>
#include<cstring>
#include<functional>
#include<limits>
#include<list>
#include<map>
#include<set>
#include<stack>
#include<string>
#include<sstream>
#include<queue>
#include<vector>
using namespace std;

#define MOD 1000000007
#define INF 0x3f3f3f3f
#define INFL 0x3f3f3f3f3f3f3f3fLL

#define MAX_N 101
#define MAX_C 11

#define WHITE 0
#define GRAY 1
#define BLACK 2

typedef pair<int, int> pii;

struct edge { int to, c; };

vector<edge> G[MAX_N];
int color[MAX_N];
int	minc[MAX_C][MAX_N]; //dp?????????????????° ????????????id

void dijkstra(int C, int s) {
	priority_queue<pii, vector<pii>, greater<pii> >PQ; //minc v

	memset(color, WHITE, sizeof(color));
	fill(minc[C], minc[C + 1], INF);

	//?§????
	PQ.push(pii(0, s));
	minc[C][s] = 0;
	color[s] = GRAY;

	//PQ???????´????????????°
	while (!PQ.empty()) {
		//minc???????°??????¨??????????´????????????????
		pii p = PQ.top(); PQ.pop();

		int u = p.second;
		color[u] = BLACK;
		//????????§???????????°??????
		if (minc[C][u] < p.first) continue;

		//??£??\????????????????????¨????????????
		for (int j = 0; j < G[u].size(); j++) {
			edge e = G[u][j];
			if (color[e.to] == BLACK)continue;
			int m = (C == 0 ? minc[C][u] + e.c : min(minc[C][u] + e.c, minc[C - 1][u] + e.c / 2));
			if (minc[C][e.to] > m) {
				minc[C][e.to] = m;
				PQ.push(pii(minc[C][e.to], e.to));
				color[e.to] = GRAY;
			}
		}
	}
}

int main() {
	for (int C, n, m, s, d; cin >> C >> n >> m >> s >> d&&C;) {
		for (int i = 0; i < m; i++) {
			int a, b, f; scanf("%d%d%d", &a, &b, &f);
			edge e; e.to = b; e.c = f;
			G[a].push_back(e);
			e.to = a; e.c = f;
			G[b].push_back(e);
		}
		for (int i = 0; i <= C; i++) {
			dijkstra(i, s);
		}

		cout << minc[C][d] << endl;

		for (int i = 0; i <= n; i++) {
			G[i].clear();
		}
	}
	return 0;
}

Measured memory_bytes: 1292
#include<bits/stdc++.h>
// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>

#define int  long long
#define rep(i,begin,end) for(__typeof(end)i=(begin)-((begin)>(end));i!=(end)-((begin)>(end));i+=1-2*((begin)>(end)))
#define F first
#define S second
#define sz(x) ((int)x.size())
#define pb push_back
#define pf push_front
#define eb emplace_back 
#define all(v) (v).begin(), (v).end()
#define mod 1000000007
#define what_is(x) cerr << #x << " is " << x <<"\n";
#define sortA(v) sort(v.begin(), v.end())
#define sortD(v) sort(v.rbegin(), v.rend())
#define PI 3.14159265358979323846
#define vout(a) for(auto x:a) cout<<x<<" ";
#define INF 10000000000000000

// #define ordered_set tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update>


// using namespace __gnu_pbds;
using namespace std;

using ll  = long long;
using vi  = vector<int>;
using pii = pair<int,int>;
using vii = vector<pii>;
using mi  = multiset<int>;
using mii = multiset<pii>;

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

 int N=200005;

void solve()
{
    int t,n,m,i,k,r,l,u,v,w,j,s,sum=0,pos,flag=0,count=0;
    string S,T,U;
    // int a,b;
    vi a(5);
    rep(i,0,5) 
    {
        cin>>a[i];

    }
    rep(i,0,5)
    {
        if(!a[i])
        {
            cout<<i+1;
            return;
        }
    }
}


signed main()
{
    #ifndef ONLINE_JUDGE 
       freopen("input.txt","r",stdin);
       freopen("output.txt","w",stdout);
    #endif
    ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
    int t=1;
    // cin>>t;
    while(t--)
    {
        solve();
        if(t)cout<<"\n";
    }
    return 0;
}


Measured memory_bytes: 3608
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <queue>
#include <deque>
#include <list>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <cfloat>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <fstream>
#include <functional>
#include <bitset>

using namespace std;


#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define repr(i,n) for(int (i)=(n); (i)>=(0); (i)--)
#define SIZE(x) ((int)(x).size())
#define GCD(a, b) int gcd(int a,int b){return b?gcd(b,a%b):a;}
#define QP(a, b) int qp(int a,ll b){int ans=1;do{if(b&1)ans=1ll*ans*a%mo;a=1ll*a*a%mo;}while(b>>=1);return ans;}
#define pb(a) push_back(a)
#define mp(a,b) make_pair(a,b)
#define all(v) (v).begin(),(v).end()


template<typename T> void chmax(T &a, T b) {a = max(a, b);}
template<typename T> void chmin(T &a, T b) {a = min(a, b);}
template<typename T> void chadd(T &a, T b) {a = a + b;}
template<typename A, size_t N, typename T>
void FILL(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}

typedef vector<int, int> vint;
typedef pair<int,int> pint;
typedef vector<pint>vpint;
typedef long long ll;

int dx[] = {0, 0, 1, -1};
int dy[] = {1, -1, 0, 0};
const ll INF = 1LL << 60;
const ll MOD = 1000000007LL;


int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n; cin >> n;
    int sum = 0;
    string s; cin >> s;
    int num_r = count(all(s), 'R');
    for(int i=0; i<num_r; i++){
        if(s[i] == 'W') sum++;
    }
    cout << sum;
    cout << endl;
    return 0;
}

Measured memory_bytes: 3716
from heapq import heappop, heappush
N = int(input())
A = sorted(list(map(int, input().split())), reverse=True)
gaps = [-A[0]]
ans = 0
for a in A[1:]:
    x = heappop(gaps)
    ans += -x
    heappush(gaps, -a)
    heappush(gaps, -a)
print(ans)
    

Measured memory_bytes: 105276
#include <iostream>
#include<cassert>
using namespace std;

int v_x,v_y;
void rotate(){
    int tmp = v_x;
        v_x = -v_y;
        v_y = tmp;
}
int main(){
    int x_1,x_2,y_1,y_2;
    cin >> x_1>>y_1>>x_2>>y_2;
    int x_3,y_3,x_4,y_4,x_5,y_5;
    v_x = x_2-x_1;
    v_y = y_2-y_1;
    rotate();
    x_3 = x_2 + v_x;
    y_3 = y_2 + v_y;
    rotate();
    x_4 = x_3 + v_x;
    y_4 = y_3 + v_y;
    rotate();
    x_5 = x_4 + v_x;
    y_5 = y_4 + v_y;
    assert(x_1 == x_5);
    assert(y_1 == y_5);
    cout << x_3 << " "<< y_3<< " " << x_4<< " " << y_4 << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <cmath>
#include <cstdio>

using namespace std;

struct Point {
	double x, y;
	Point(double x_=0, double y_=0):x(x_),y(y_) {}
};

Point makePoint(double x, double y) { Point p(x,y); return p; }

struct Polygon {
	vector<Point> pset;
	Polygon(int size = 3) { pset.assign(size, Point(0, 0)); }
};

double areaOfPolygon(const Polygon& polygon) {
	int n = (int)polygon.pset.size();
	double S = 0;
	
	for (int i=0; i<n; i++) {
		S += (polygon.pset[i].x - polygon.pset[(i+1)%n].x)*(polygon.pset[i].y + polygon.pset[(i+1)%n].y);
	}
	
	S = fabs(S);
	return S/2.;
}

int main() {
	int n;
	int prob = 0;
	
	while (1) {
		cin >> n; if (n==0) break;
		prob++;
		
		Polygon polygon(n);
		for (int i = 0; i<n; i++) {
			double x, y; cin >> x >> y;
			polygon.pset[i] = makePoint(x, y);
		}
		
		double ans = areaOfPolygon(polygon);
		
		printf("%d %.1lf\n", prob, ans);
		
		string s; getline(cin, s);
	}
	
	
	return 0;
}

Measured memory_bytes: 1284
#define _USE_MATH_DEFINES

#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <cmath>
#include <algorithm>
#include <vector>
#include <queue>
#include <map>
#include <list>

long long int INF = 1e18;
using namespace std;

typedef pair<long long int, long long int> P;

int N = 210000 - 1; // 必要な数よりも大きい2^nよりも大きい数を入れるとよい
int BIT[210000];

void add(int a, int w){
	
	// a番目の要素にwを足す O(log N)
	
	for(int x = a; x <= N; x += x & -x){
		BIT[x] += w;
	}
}

int sum(int a){
	
	// 1からaまでの要素の合計を返す O(log N)
	
	int ret = 0;
	for(int x = a; x > 0; x -= x & -x){
		ret += BIT[x];
	}
	return ret;
}

void init(){
	for(int i = 0; i < N; i++){
		BIT[i] = 0;
	}
}

// バブルソートの交換回数、ind[i] が交換後のインデックス
long long int solve(int n, int A[]){
	long long int ans = 0;
	for(int i = 0; i < n; i++){
		ans += i - sum(A[i]);
		add(A[i], 1);
	}
	return ans;
}

int A[210000];

int main(){
	
	int n, q;
	cin >> n;
	
	vector<P> v;
	P p;
	
	for(int i = 0; i < n; i++){
		cin >> A[i];
		p.first = A[i];
		p.second = i;
		v.push_back(p);
	}
	
	sort(v.begin(), v.end());
	
	for(int i = 0; i < n; i++){
		A[v[i].second] = i + 1;
	}
	
	init();
	cout << solve(n, A) << endl;
	
	return 0;
}


Measured memory_bytes: 7672
#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;
int edge[500][500];
int color[500];
int n;
void init()
{
    rep(i, 500)
    {
        color[i] = 0;
    }
}
void solve(int level, int id)
{ //レベル，頂点
    rep(i, n)
    {
        if (edge[id][i] == 0 && color[id] != color[i])
        {
            edge[id][i] = level;
            if (color[i] == 0)
            {
                color[i] = color[id] * (-1);
                solve(level, i);
            }
        }
    }
}
int main()
{
    cin >> n;
    //高々n回
    rep(i, n)
    {
        init();
        rep(j, n)
        {
            if (color[j] == 0)
            {
                color[j] = 1;
                solve(i + 1, j);
            }
        }
    }
    rep(i, n - 1)
    {
        for (int j = i + 1; j < n - 1; j++)
        {
            cout << edge[i][j] << ' ';
        }
        cout << edge[i][n - 1] << endl;
    }
}

Measured memory_bytes: 1536
import java.util.*

fun main(args: Array<String>) {
    // 入力
    var (N, X, Y) = readLine()!!.split(" ").map(String::toInt)

    // 0オリジンに変換
    X--
    Y--

    // 陽に持たない
    // Graphの構造を変数に持たない
    val ans = IntArray(N)
    val INF = 1001001001

    repeat(N) { sv ->
        // println("-------------------")
        // println("支点：$sv")
        // println("-------------------")

        // 距離
        val dist = IntArray(N) { INF }

        // BFS用のqueue
        val q: Queue<Int> = ArrayDeque()

        // queueへの追加
        fun push(v: Int, d: Int) {
            if (dist[v] != INF) return
            dist[v] = d
            q.add(v)
            // println("queue:${q.joinToString(",")}")
            // println("dist:${dist.joinToString(",")}")
        }

        push(sv, 0)
        while (q.isNotEmpty()) {
            val v = q.poll()
            val d = dist[v]
            // println("v:$v, d:$d")
            if (v - 1 >= 0) push(v - 1, d + 1)
            if (v + 1 < N) push(v + 1, d + 1)
            if (v == X) push(Y, d + 1)
            if (v == Y) push(X, d + 1)
        }

        repeat(N) { i -> ans[dist[i]]++ }
    }

    repeat(N) { i -> ans[i] /= 2 }
    for (i in 1 until N) {
        println(ans[i])
    }
}





Measured memory_bytes: 64244
#include <bits/stdc++.h>
using namespace std;
#define min(x,y) x<y?x:y
long long a[200005];
bool cmp(long long a,long long b)
{
	return a>b;
}
int main()
{
	int n;
	cin>>n;
	for(int i=0;i<n;++i)
	{
		cin>>a[i];
	}
	sort(a,a+n,cmp);
	long long sum=a[0];
	int i=1;
	for(int j=1;j<n-1;++j)
	{
		if(j%2==0)
		sum+=a[i++];
		else
		sum+=a[i];
	}
	cout<<sum;
	 return 0;
}

Measured memory_bytes: 5152
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cctype>
#include <cassert>
#include <climits>
#include <string>
#include <bitset>
#include <cfloat>
#include <unordered_set>
#pragma GCC optimize("Ofast")
using namespace std;
typedef long double ld;
typedef long long int ll;
typedef unsigned long long int ull;
typedef vector<int> vi;
typedef vector<char> vc;
typedef vector<bool> vb;
typedef vector<double> vd;
typedef vector<string> vs;
typedef vector<ll> vll;
typedef vector<pair<int, int> > vpii;
typedef vector<vector<int> > vvi;
typedef vector<vector<char> > vvc;
typedef vector<vector<string> > vvs;
typedef vector<vector<ll> > vvll;

#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rrep(i, n) for (int i = 1; i <= (n); ++i)
#define irep(it, stl) for (auto it = stl.begin(); it != stl.end(); it++)
#define drep(i, n) for (int i = (n)-1; i >= 0; --i)
#define mes(a) cout << (a) << endl
#define dmes(a, b) cout << (a) << " " << (b) << endl
#define re0 return 0
#define mp(p, q) make_pair(p, q)
#define pb(n) push_back(n)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define Sort(a) sort(a.begin(), a.end())
#define rSort(a) sort(a.rbegin(), a.rend())
#define MATHPI acos(-1)
#define itn int;
int dx[8] = { 1, 0, -1, 0, 1, -1, -1, 1 };
int dy[8] = { 0, 1, 0, -1, 1, 1, -1, -1 };
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; }
struct io { io() { ios::sync_with_stdio(false); cin.tie(0); } };
const int INF = INT_MAX;
const ll LLINF = 1LL << 60;
const ll MOD = 1000000007;
const double EPS = 1e-9;


signed main(void) 
{
    ll n;
    cin >>n;
    vll a(n);
    ll money = 1000;
    ll kabu = 0;
    
    rep(i, n) {
        cin >>a[i];
        if (i > 0) {
            if (a[i] > a[i-1]) {
                kabu = money / a[i-1];
                money %= a[i-1];
            }
            if (a[i] > a[i-1]) {
                
                money += kabu * a[i];
                kabu = 0;
            }
        }
    }
    money += kabu * a[n-1];
    mes (money);


}


Measured memory_bytes: 3632
/*input
4 5
##...
.###.
.###.
...##
*/
#include <bits/stdc++.h>
#pragma GCC optimize("unroll-loops,no-stack-protector")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef pair<double,double> pdd;
#define IOS ios_base::sync_with_stdio(0); cin.tie(0)
#define ALL(a) a.begin(),a.end()
#define SZ(a) ((int)a.size())
#define F first
#define S second
#define REP(i,n) for(int i=0;i<((int)n);i++)
#define pb push_back
#define MP(a,b) make_pair(a,b)
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define GET_POS(c,x) (lower_bound(c.begin(),c.end(),x)-c.begin())
template<typename T1,typename T2>
ostream& operator<<(ostream& out,pair<T1,T2> P){
	out<<'('<<P.F<<','<<P.S<<')';
	return out;
}

//}}}
const ll maxn=300005;
const ll maxlg=__lg(maxn)+2;
const ll INF64=8000000000000000000LL;
const int INF=0x3f3f3f3f;
const ll MOD=ll(1e9+7);
const double PI=acos(-1);
//const ll p=880301;
//const ll P=31;

ll mypow(ll a,ll b){
	ll res=1LL;
	while(b){
		if(b&1) res=res*a%MOD;
		a=a*a%MOD;
		
		b>>=1;
	}
	return res;
}
string s[10];
vector<pii> v;
bool cmp(pii a,pii b){
	return a.F+a.S<b.F+b.S;
}
int main()
{
	IOS;
	int n,m;
	cin>>n>>m;
	REP(i,n) cin>>s[i];
	REP(i,n) REP(j,m){
		if(s[i][j]=='#') v.pb(MP(i,j));
	}
	sort(ALL(v));

	for(int i=0;i<SZ(v)-1;i++){
		if(v[i].F+v[i].S==v[i+1].F+v[i+1].S-1&&(v[i].F==v[i+1].F||v[i].S==v[i+1].S));
		else{
			cout<<"Impossible\n";
			return 0;
		}
	}
	cout<<"Possible\n";
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n;
  cin>>n;
  int a,now=0,ans=0;
  for(int i=0;i<n;i++){
    cin>>a;
    if(now==a){
      ans++;
      now=0;
    }else{
      now=a;
    }
  }
  cout<<ans<<endl;
  return(0);
}


Measured memory_bytes: 256
def main():
    n,q = map(int,input().split())
    s = input()

    # ruiseki
    rui = [0]*(n+1)
    for i in range(n):
        if i < n-1:
            if s[i] == 'A' and s[i+1] == 'C':
                rui[i+1] = rui[i]+1
            else:
                rui[i+1] = rui[i]

    # Query
    for _ in range(q):
        l,r = map(int,input().split())
        print(rui[r-1]-rui[l-1])

if __name__ == '__main__':
    main()


Measured memory_bytes: 50904
#include <iostream>

int main() {
  int R,G,B,N;
  std::cin >> R >> G >> B >> N;
  int cnt=0;
  for(int r=0;r<=N/R;r++){
    for (int g=0;g<=N/G;g++){
      int bB = N - r*R - g*G;
      if (bB >=0 && bB%B==0)
        cnt++;
    }
  }
  std::cout << cnt << std::endl;
  return 0;
}


Measured memory_bytes: 256
N, A, B = [int(i) for i in input().split()]
S = input().strip()
for s in S:
    if A+B > 0:
        if s == "a":
            print("Yes")
            if A > 0:
                A -= 1
            else:
                B -= 1
        elif s == "b":
            if B > 0:
                print("Yes")
                B -= 1
            else:
                print("No")
        else:
            print("No")
    else:
        print("No")


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

#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);
#define ll long long

int main() {
    fastio;
    int k; cin >> k;
    string s;
    cin >> s;
    
    if (s.size() <= k) cout << s;
    else {
        for (int i = 0; i < k; ++i) cout << s[i];
        cout << "...";
    } 

    return 0;
}

Measured memory_bytes: 3652
import sys
import math
from fractions import gcd
# import queue
# from collections import Counter
# from itertools import accumulate
# from functools import reduce

def lcm(a, b):
    return a * b // gcd(a, b)

def combination_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

def permutations_count(n, r):
    return math.factorial(n) // math.factorial(n - r)

big_prime = 1000000007

"""
# 標準入力取得
## 文字列
 =  sys.stdin.readline().rstrip()
 =  list(sys.stdin.readline().rstrip())

## 数値
 =  int(sys.stdin.readline())
 =  map(int, sys.stdin.readline().split())
 =  list(map(int, sys.stdin.readline().split()))
 =  [list(map(int,list(sys.stdin.readline().split()))) for i in range(N)]
"""


N =  int(sys.stdin.readline())
L =  list(map(int, sys.stdin.readline().split()))

L.sort(reverse=True)

ali= 0
bob = 0
for i, x in enumerate(L):
    if i % 2 == 0:
        ali += x
    else:
        bob += x
print(ali - bob)

Measured memory_bytes: 66156