akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vll;
typedef string str;
const long long INF = INT64_MAX;

#define REP(i, n) for(ll i=0;i<n;i++)
#define ASC(v) sort((v).begin(), (v).end())
#define DESC(v) sort((v).rbegin(), (v).rend())
#define UNIQ(v) ASC(v);v.erase(unique(v.begin(), v.end()), v.end())
#define FIO ios_base::sync_with_stdio(false);cin.tie(NULL);

void solve() {
    ll N, M;
    cin >> N >> M;
    cout << (pow(2, M)) * (1900 * M + 100 * (N - M)) << endl;
}

int main() {
    FIO;
    solve();
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<string.h>
using namespace std;
int main()
{
    int n;
    char  s[200],t[200],c[200];
    cin>>n;
    cin>>s;
    cin>>t;
    int i,j=0,k=0;
    for(i=0;i<n;i++)
    {
        c[j]=s[i];
        j++;
        if(s[i]==t[k])
            k++;
    }
    for(;k<n;k++)
    {
        c[i++]=t[k];
    }
    c[i]='\0';
    cout<<strlen(c);

}


Measured memory_bytes: 384
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;

int main()
{
  vector<int> arr(3);
  for(int i=0; i<3; i++)
  {
    cin >> arr[i];
  }
  sort(arr.begin(), arr.end());
  cout << arr[2]*10+arr[1]+arr[0]<< endl;
  return 0;
}

Measured memory_bytes: 256
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        long X = sc.nextLong();
        
        long year = 0;
        long result = 100;
        for (int i = 1; result < X; year++) {
            result *= 1.01;
        }
        System.out.println(year);
    }
}

Measured memory_bytes: 35544
#include <bits/stdc++.h>
#include <time.h>
#include <assert.h>


using namespace std;



#define For(i,x,n)  for(long long i=x;i<n;i++)
#define rFor(i,x,n) for(long long i=x;i>=n;i--)
#define itFor(it,st)   for(auto it=st.begin() ; it!=st.end() ; it++)
#define MOD 1000000007
#define PI 3.141592653589793
#define INF 999999999999999999
#define N 1000005
#define ll long long
#define ld long double
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define sp " "
#define cont continue
#define brk break

#define deb1(x)                cout<<#x<<": "<<x<<endl
#define deb2(x, y)             cout<<#x<<": "<<x<<" | "<<#y<<": "<<y<<endl
#define deb3(x, y, z)          cout<<#x<<":" <<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl
#define deb4(a, b, c, d)       cout<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<endl
#define deb5(a, b, c, d, e)    cout<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<endl
#define deb6(a, b, c, d, e, f) cout<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<" | "<<#f<<": "<<f<<endl

using namespace std;

int main()
{
    cin.tie(0);
    cout.tie(0);
    ios::sync_with_stdio(0);
    cout<<fixed;
    cout<<setprecision(3);
    srand(time(NULL));

	string s;
	ll q;
	cin>>s>>q;    
    vector<char> arr(s.size());
    For(i,0,s.size())
    	arr[i] = s[i];
    ll st = 0, en = int(s.size())-1;
    For(i,0,q){
    	ll t;
    	cin>>t;
    	if(t==1){
    		swap(st,en);
    	}
    	else{
    		ll f;
    		char c;
    		cin>>f>>c;
    		if(f==1){
    			if(st==0)
    				arr.insert(arr.begin(),c),en++;
    			else
    				arr.push_back(c),st++;
    		}
    		else{
    			if(en==0)
    				arr.insert(arr.begin(),c),st++;
    			else
    				arr.push_back(c),en++;
    		}
    	}
    }
    // deb2(st,en);
    if(st == 0)
	    For(i,0,arr.size())
	    	cout<<arr[i];
	else
		for(ll i=arr.size()-1 ; i>=0 ; i--)
			cout<<arr[i];

    //cout<<"\nTime used = "<<static_cast<double>(clock())/(CLOCKS_PER_SEC)<<"s"<<endl;  // - for checking time used for a test case
    return 0;
}

//s1.substr(1,3) - return 3 characters starting from position 1 as substring of string sz1. eg sz1="shreynumh" sz1.substr(2,5)="reyan"
//num = atoi(s.c_str()); //convert string s to integer num
//n.erase(i,std::string::npos); //erase i th position in string n , decreasing string size
//s.find(b)!= std::string::npos - finds string b in string a - true if found
//cout<<"Time used = "<<static_cast<double>(clock())/(CLOCKS_PER_SEC)<<"s"<<endl;  // - for checking time used for a test case                


Measured memory_bytes: 1036
#![allow(unused_mut)]
#![allow(non_snake_case)]
#![allow(unused_imports)]
use std::collections::HashSet;
use std::collections::HashMap;
use std::collections::BTreeSet;
use std::cmp::{max, min};
#[allow(unused_macros)]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let 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)*}
    };
}

#[allow(unused_macros)]
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)*}
    };
}

#[allow(unused_macros)]
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! {
        X: i64,
        Y: i64,
    }
    let mut time = 1;
    let mut res = X;
    while res * 2 <= Y {
        res *= 2;
        time+=1;
    }
    println!("{}", time);
}

Measured memory_bytes: 4352
#include <iostream>
#include <set>
#include <string>

using namespace std;

int main() {
    int N;
    cin >> N;

    string S[3];
    for (int i = 0; i < 3; ++i) cin >> S[i];

    int ans = 0;
    for (int i = 0; i < N; ++i) {
        set<char> s;
        for (int j = 0; j < 3; ++j) s.insert(S[j][i]);
        ans += s.size() - 1;
    }

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


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll N=1e5+7;
const ll MOD=1e9+7;
ll dp[N];
ll ksm(ll x,ll y){
	ll res=1;
	while(y){
		if(y&1) res=res*x%MOD;
		x=x*x%MOD;
		y>>=1;
	}
	return res%MOD;
}
int main(){
	ll n,k;
	cin>>n>>k;
	ll ans=0;
	for(ll i=k;i>=1;i--){
		dp[i]=ksm(k/i,n);
		for(ll j=2*i;j<=k;j+=i) dp[i]=(dp[i]-dp[j]+MOD)%MOD;
		ans=(ans+i*dp[i]+MOD)%MOD;
	}
	cout<<ans<<endl;
	return 0;
} 

Measured memory_bytes: 4388
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>
#define ll long long
#define rep(i,l,r) for(ll i=(l);i<(r);i++)
#define max(p,q) ((p)>(q)?(p):(q))
#define min(p,q) ((p)<(q)?(p):(q))
#define chmax(a,b) ((a)=(a)>(b)?(a):(b))
#define chmin(a,b) ((a)=(a)<(b)?(a):(b))
#define abs(p) ((p)>=(0)?(p):(-(p)))
int cmp(const void *a, const void *b);
//your code here!

int main(void){
    ll A, B, H;
    scanf("%lld %lld %lld", &A, &B, &H);
    printf("%lld\n", (A+B)*H/2);
    return 0;
}

int cmp(const void *a, const void *b){
    ll A=*(ll *)a, B=*(ll *)b;
    if(A==B)return 0;
    else return A>B ? 1:-1;//昇順ソート
}


Measured memory_bytes: 128
#include<vector>
#include<iostream>
#include<algorithm>
using namespace std;
inline bool Sort(long long a, long long b)
{
	return a > b;
}
int main()
{
	int num;
	while (scanf("%d", &num) != EOF)
	{
		vector<long long> arr(num);
		for (int i = 0; i < num; i++)
			scanf("%lld", &arr[i]);
			//cin >> arr[i];

		sort(arr.begin(), arr.end(), Sort);

		long long a = 0, b = 0, temp = arr[0];
		for (int i = 1; i < num; i++)
		{
			if (temp == arr[i])
			{
				if (a < arr[i])
				{
					a = arr[i];
				}
				else if (b < arr[i])
				{
					b = arr[i];
				}
				temp = -1;
			}
			else temp = arr[i];
		}
		printf("%lld\n", a*b);
		//cout << a*b << endl;
	}
	return 0;
}

Measured memory_bytes: 1024
package main

import (
	"fmt"
	"strconv"
)

var S string

func main() {
	fmt.Scan(&S)
	a := make([]int, len(S))
	for i, v := range S {
		a[i], _ = strconv.Atoi(string(v))
	}
	c := 1
	d := map[int]int{
		0: 1,
	}
	res := 0
	sum := 0
	for i := len(S) - 1; i >= 0; i-- {
		sum = (a[i]*c + sum) % 2019
		c *= 10
		c %= 2019
		d[sum]++
	}
	for _, v := range d {
		res += v * (v - 1) / 2
	}
	fmt.Println(res)
}


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

using namespace std;
#define all(a)a.begin(),a.end()
using ll=long long;
const int INF = 1<<30;
const ll INFll =1LL<<62;
const int mod= int(1e9)+7;
using P = pair<ll,ll>;
using ld=long double;

int main(){
   int a,b,c;cin >>a>>b>>c;
   if(c>=a&&c<=b)puts("Yes");
   else puts("No");
}

Measured memory_bytes: 3592
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <set>
#include <cmath>
#include <algorithm>

using namespace std;

int main() {
	int N;
	cin >> N;
	unsigned long long pow = 1;
	for (int i = 1; i <= N; i++) {
		pow = (pow*i) % 1000000007;
	}

	cout << pow << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define fore(i,a,b) for(Long i=a,to=b;i<to;i++)
#define all(v) v.begin(),v.end()
using namespace std;
typedef long long Long;
typedef long double Double;
Long sqr(Long x){return x*x;}
struct pt{
	Long x,y;
	pt(){}
	pt(Long _x,Long _y){
		x = _x;
		y = _y;
	}
	Double dist(pt p){
		return sqrt(sqr(p.x-x)+sqr(p.y-y));
	}
};
int n;
vector<pt> v;
Double f(vector<int> idx){
	Double ans = 0;
	pt cur = v[idx[0]];
	fore(i,1,n){
		ans += cur.dist(v[idx[i]]);
		cur = v[idx[i]];
	}
	return ans;
}

int main() {
	// your code goes here
	cin>>n;
	v.resize(n);
	fore(i,0,n)cin>>v[i].x>>v[i].y;
	vector<int> idx(n);
	fore(i,0,n)idx[i]=i;
	Double ans = 0;
	Long cnt = 0;
	do{
		ans += f(idx);
		cnt++;
	}while(next_permutation(all(idx)));
	ans /= (Double)cnt;
	printf("%.10f\n",(double)ans);
	
	return 0;
}

Measured memory_bytes: 256
import           Control.Monad
import           Control.Monad.ST
import qualified Data.Array                  as A
import qualified Data.Array.ST               as ST
import qualified Data.Array.Unboxed          as AU
import qualified Data.ByteString.Char8       as BS
import           Data.Char
import           Data.Int
import qualified Data.IntMap                 as IM
import           Data.List
import qualified Data.Map                    as M
import           Data.Maybe
import           Data.Ord
import qualified Data.Set                    as S
import           Data.Time
import qualified Data.Vector                 as V
import qualified Data.Vector.Mutable         as VM
import qualified Data.Vector.Unboxed         as VU
import qualified Data.Vector.Unboxed.Mutable as VUM

readInt :: IO [Int]
readInt = map (fst . fromJust . BS.readInt) . BS.words <$> BS.getLine

readInts :: Int -> IO [[Int]]
readInts n = replicateM n readInt

readString :: IO [String]
readString = map BS.unpack . BS.words <$> BS.getLine

readStrings :: Int -> IO [[String]]
readStrings n = replicateM n <$> readString

toPair :: [a] -> (a, a)
toPair [x, y] = (x, y)

main = do
  [a, b, c] <- readInt
  let [a', b', c'] = sort [a, b, c]
   in if a' + b' == c'
        then putStrLn "Yes"
        else putStrLn "No"


Measured memory_bytes: 380
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int a = scan.nextInt();
		int b = scan.nextInt();
		int c = scan.nextInt();
		
		List<Integer> list = new ArrayList<>();
		list.add(a);
		if (b != a) {
			list.add(b);
		}
		if (c != a && c != b) {
			list.add(c);
		}
		System.out.println(list.size());
	}

}

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


int main(){

int n,m;
int x=0,p,pr,X,Y,count=0;
int F[100][100],a[4][50][50],As[2][100];

cin >> n >> m;
do{
int Ax=100,Ay=100;
for(int i=0;i<n;i++){
	for(int j=0;j<n;j++){
		cin >> F[i][j];}}

for(int i=0;i<m;i++){
	for(int j=0;j<m;j++){
		cin >> a[0][i][j];
		a[1][m-1-j][i]=a[0][i][j];
		a[2][m-1-i][m-1-j]=a[0][i][j];
		a[3][j][m-1-i]=a[0][i][j];
	}
}

for(x=0;x<4;x++){
for(int i=0;i<n-m+1;i++){
	for(int j=0;j<n-m+1;j++){
		p=1;pr=0;
		for (int k=0;k<m;k++){
			for (int l=0;l<m;l++){
				if (a[x][k][l]<0) continue;
				if (a[x][k][l]==F[i+k][j+l]) {if(pr==0) {X=i+k;Y=j+l;pr++;}
				continue;}
				else {p=0; break;}
			}
			if(p==0) break;
		}
		if(p!=0) break;
	}
	if(p!=0) break;
}
if(p!=0) {if(Ax>X) {Ax=X;Ay=Y;} else {if(Ax==X && Ay>Y) {Ay=Y;}}}
}
As[0][count]=Ay+1;As[1][count]=Ax+1;count++;
cin >> n >> m;

}while(n!=0);
for(int i=0;i<count;i++){
if(As[0][i]<100) printf("%d %d\n",As[0][i],As[1][i]); //Ay,AxをY,Xと書くミス
else cout << "NA\n";}
}

Measured memory_bytes: 1232
#include<bits/stdc++.h>
using namespace std;
typedef long long       ll;
#define MOD ((int)1e9+7)
#define N ((int)2e5+123)
void reads(string& x){ char kk[N]; scanf("%s",kk); x = kk;}

int ans, n;
int v[10];
void solve(){
    for(int i=1;i<=5;i++) scanf("%d", v+i);
    for(int i=1;i<=5;i++) if(v[i]==0)printf("%d\n",i);
    }

int main(){
    ios_base::sync_with_stdio(0);
    int t = 1; //scanf("%d",&t);
    for(int caso=1;caso<=t;caso++){
        solve();
    }
}

Measured memory_bytes: 3700
package main

import (
	"bufio"
	"fmt"
	"os"
)

var sc = bufio.NewScanner(os.Stdin)

func scanString() string {
	sc.Scan()
	return sc.Text()
}

func init() {
	sc.Split(bufio.ScanWords)
	sc.Buffer(make([]byte, 100001), 100001*100)
}

func main() {
	s := scanString()

	ans := 0
	for i, j := 0, len(s)-1; i < j; {
		if s[i] == s[j] {
			i++
			j--
		} else if s[i] != 'x' && s[j] == 'x' {
			ans++
			j--
		} else if s[i] == 'x' && s[j] != 'x' {
			ans++
			i++
		} else {
			fmt.Println(-1)
			return
		}
	}
	fmt.Println(ans)
}


Measured memory_bytes: 768
import java.util.*;

public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int R, G, B, N;
    int S = 0;
    R = sc.nextInt();
    G = sc.nextInt();
    B = sc.nextInt();
    N = sc.nextInt();
    for (int i=0;i<=N/R;i++){
      for (int j=0;j<=N/G;j++){
        if ((N - R * i - G * j) % B == 0 && N - R * i - G * j >= 0){
          S += 1;
        }
      }
    }
    System.out.println(S);
  }
}

Measured memory_bytes: 21844
#include<cstdio>
int main()
{
	int n,x=0,ans=0;
	scanf("%d\n",&n);
	while(n--)
	{
		char c=getchar();
		x+=c=='I'?1:-1;
		if(x>ans) ans=x;
	}
	printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 128
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApp1
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] str = Console.ReadLine().Split(' ');
            int a = int.Parse(str[0]);
            int b = int.Parse(str[1]);

            Console.WriteLine((a * b) % 2 == 0 ? "Even" : "Odd");
        }
    }
 }


Measured memory_bytes: 11092
// #pragma GCC optimize("Ofast")
// #pragma GCC target("avx,avx2,fma")
// #pragma GCC optimization("unroll-loops")
#include<bits/stdc++.h>
#define ll long long
#define f(i,a,b) for(int i=a;i<b;i++)
#define mod 998244353
#define mp make_pair
#define ff first
#define ss second
#define rf(i,a,b) for(int i=a;i>=b;i--)
#define sc(a) scanf("%lld",&a)
#define pf printf
#define sz(a) (ll)(a.size())
#define psf push_front
#define ppf pop_front
#define ppb pop_back
#define pb push_back
#define pq priority_queue
#define all(s) s.begin(),s.end()

using namespace std;

vector<int> h(1);
vector<int> val(1,-1);
int x;

ll dp(int n)
{
    if(val[n-1]==-1)
    {
        if(n==x)
        {
            val[n-1]=0;
            return 0;
        }
        else if(n==x-1)
        {
            val[n-1]=abs(h[x]-h[x-1]);
            return abs(h[x]-h[x-1]);
        }
        else
            val[n-1]=min(abs(h[n+2]-h[n])+dp(n+2),abs(h[n+1]-h[n])+dp(n+1));
    }
    return val[n-1];
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cin>>x;
    h.resize(x+1,0);
    val.resize(x,-1);
    f(i,1,x+1)
        cin>>h[i];
    cout<<dp(1);
}

Measured memory_bytes: 5760
/*
मनस्वी म्रियते कामं कार्पण्यं न तु गच्छति ।
अपि निर्वाणमायाति नानलो याति शीतताम् ॥
*/

#include <bits/stdc++.h>
// #include <ext/pb_ds/assoc_container.hpp> 
// #include <ext/pb_ds/tree_policy.hpp> 
// using namespace __gnu_pbds;
using namespace std;
#define mod 1000000007
#define pb push_back
#define mp make_pair
#define ll long long int
#define ld long double
#define vi vector<int>
#define vl vector<ll>
#define v2i vector<vector<int>>
#define v2l vector<vector<ll>>
#define ppi pair<int,int>
#define ppl pair<ll,ll>
#define vpi vector<ppi>
#define vpl vector<ppl>
#define all(x) x.begin(),x.end()
#define ii int,int 
#define ff first    
#define ss second
#define forn(i,a,b) for(int i=a;i<b;i++)
#define forr(i,a,b) for(int i=a;i>=b;i--)
#define forv(i,m) for(auto i : m)
#define p2d(v) for(auto a:v){for(auto b:a)cout<<b<<" ";cout<<endl;}
#define p1d(v) for(auto a:v)cout<<a<<" ";cout<<endl;
#define ppd(v) for(auto a:v)cout<<a.ff<<" "<<a.ss<<endl;
#define imx INT_MAX
#define imn INT_MIN
#define inf 9000000000000000000
#define minf -inf
#define endl "\n"
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);
#define sze size()
#define rvs reverse 
#define itr iterator 
#define pre cout<<fixed<<setprecision(10);
#define umap unordered_map
#define uset unordered_set
#define pi 3.141592653589793
#define MAXN 100005
#define test1(x) cout << #x " = " << x << endl;
#define test2(x,y) cout << #x " = " << x << " " << #y " = " << y << endl;
#define test3(x,y,z) cout << #x " = " << x << " " << #y " = " << y << " " << #z " = " << z << endl;
#define test4(w,x,y,z) cout << #w " = " << w << " " << #x " = " << x << " " << #y " = " << y << " " << #z " = " << z << endl;
const ll infinity = 9e18;

/*
#define oset tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
#define MODM(a,b,md) ((a%md)*(b%md))%md
#define MODA(a,b,md) ((a%md)+(b%md))%md
#define ull unsigned long long int
*/

/*
bool compare(int a,int b) {return a > b;}
bool compare1(ppi a,ppi b) {return a.ff > b.ff;}
bool compare2(ppi a,ppi b) {return a.ss < b.ss;}
ll Npower(ll a,ll b) {ll product = 1; while(b){if(b&1){product = product*a;}a = a*a;b = b>>1;} return product;}
ll power(ll a,ll b,ll md) {ll product = 1; while(b){if(b&1){product = MODM(product,a,md);}a = MODM(a,a,md);b = b>>1;} return product%md;}
bool isprime(ll n){if(n < 2) return 0; ll i = 2; while(i*i <= n){if(n%i == 0) return 0; i++;} return 1;}
ll GCD(ll a,ll b) {return b==0 ? a:GCD(b,a%b);}
ll LCM(ll a,ll b) {return (a/GCD(a,b))*b; }
*/


int main()
{
    fast

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

        
    ll n;
    cin>>n;

    vl v(n);

    forn(i,0,n)
    {
        cin>>v[i];
    }
    sort(all(v));    
    ll x = 1e18;
    ll pro = 1;
    bool val = 1;

    for(int i = 0; i < n; i++)
    {
        if(pro == 0)
        {
            break;
        }
        if((x/pro) >= v[i])
        {
            pro = pro*v[i];
        }
        else
        {
            val = 0;
        }
    }    


    if(val)
    {
        cout<<pro;
    }
    else cout<<-1;









    return 0;
}

Measured memory_bytes: 3992
# -*- encoding: UTF-8 -*-
n = int(input())
ds = list(map(int, input().split()))

ds.sort()
#print(ds)
i_min = int(n / 2) -1
i_max = int(n / 2)


k_min = ds[i_min]
k_max = ds[i_max]

ks = range(k_min, k_max)

print(len(ks))


Measured memory_bytes: 14396
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
k = int(input())

if b-a > k:
  print(':(')
  exit()
elif c-a > k:
  print(':(')
  exit()
elif d-a > k:
  print(':(')
  exit()
elif e-a > k:
  print(':(')
  exit()
else:
  print('Yay!')

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main() {
    ll sum=0;
    string s;
    cin>>s;
    for(ll i=0;i<s.size();i++){
        sum+=(s[i]-'0');
        sum%=9;
    }
    if(!(sum%9)){
        cout<<"Yes";
    }else{
        cout<<"No";
    }
    return 0;
}


Measured memory_bytes: 3716
#include<bits/stdc++.h>
#define ll long long
using namespace std;
const int maxn=205;
int a[maxn][maxn],b[maxn][maxn];
int main(){
    int a,b,x;
    cin>>a>>b>>x;
    if(x>=a&&x<=a+b)printf("YES\n");
    else printf("NO\n");
    return 0;
}


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

typedef long long ll;
typedef pair<int, int> pii;

#define rep(i, n) for (int i = 0; i < (n); i++)
#define repp(i, s, e) for (int i = (s); i < (e); i++)
#define all(x) x.begin(), x.end()

#define endl "\n"

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

template <class L, class R>
ostream &operator<<(ostream &os, pair<L, R> P) {
  return os << "(" << P.first << "," << P.second << ")";
}
template <class T>
ostream &operator<<(ostream &os, vector<T> V) {
  os << "[";
  for (auto x : V) os << x << ", ";
  return os << "]";
}

//--------------------------------------------------//

int main() {
  use_cio();
  int r;
  cin >> r;
  cout << 1LL * 3 * r * r << endl;
}


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

int main(){
 int n,q,a,b,c;
  cin >> n >> q;
  list<int> l[n];
  
  while(q--){
    cin >> a >> b;
    if(!a){
      cin>>c;
      l[b].push_back(c);
    }
    else if(a==1){
      for(auto it=l[b].begin();it!=l[b].end();it++){
        if(it!=l[b].begin())cout << " ";
        cout << *it;
      }
      cout<<endl;
    }
    else{
      cin >> c;
      l[c].splice(l[c].end(),l[b]);
    }
  }
}


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

#if MYDEBUG
#include "lib/cp_debug.hpp"
#else
#define DBG(...) ;
#endif
#if __cplusplus <= 201402L
template <typename T>
T gcd(T a, T b) { return ((a % b == 0) ? b : gcd(b, a % b)); }
template <typename T>
T lcm(T a, T b) { return a / gcd(a, b) * b; }
#endif
using LL = long long;
constexpr LL LINF = 334ll << 53;
constexpr int INF = 15 << 26;
constexpr LL MOD = 1E9 + 7;

namespace Problem {
using namespace std;

class Solver {
 public:
  void solve() {
    string s;
    cin >> s;
    bool ans = (s[2] == s[3]) && (s[4] == s[5]);
    cout << (ans ? "Yes" : "No") << endl;
  }
};

}  // namespace Problem

int main() {
  std::cin.tie(0);
  std::ios_base::sync_with_stdio(false);
  // std::cout << std::fixed << std::setprecision(12);

  Problem::Solver sol;
  sol.solve();
  return 0;
}


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

using namespace std;
typedef long long ll;
typedef pair<long long,long long> P;
#define rep(n) for(ll i=0; i<n; i++)
#define MAX_V 100001
const ll INF = 1e+9;
const ll MOD = 1000000007;

map<pair<ll,ll>, ll> I;

ll pow(ll x, ll a)
{
  if(a==0) return 1;
  ll y = pow(x, a/2);
  y *= y;
  if(a%2==1)  y *= x;
  return y;
}

// returns irreducible rational number equal to a/b
pair<ll,ll> normalize(ll a, ll b)
{
  if(b<0) return normalize(-a, -b);
  ll g = gcd(a,b);
  return make_pair(a/g, b/g);
}

int main()
{
  ll n;
  cin >> n;
  ll zero = 0;
  vector<ll> pow2(n+1);
  pow2[0] = 1;
  for (ll i = 0; i < n; i++)
  {
    pow2[i+1]  = pow2[i] * 2 % MOD;
  }
  
  for(ll i = 0; i < n; i++)
  {
    ll a,b;
    cin >> a >> b;
    P p;
    if(a==0 && b == 0){
      zero++;
      continue;
    } else if (b==0) {
      p = make_pair(1, 0);
    } else {
      p = normalize(a,b);
    }
    auto itr = I.find(p);
    if( itr != I.end()) {
      I[p]++;
    } else {
      I[p] = 1;
    }
  }

  ll ans = 1;

  for(auto itr1 = I.begin(); itr1 != I.end();)
  {
    P p = (*itr1).first;
    ll s = (*itr1).second;

    if( p.first == 0 && p.second == 1){
      p = make_pair(1,0);
    } else { 
      p = normalize(p.second, -p.first);
    }

    ll tmp;
    auto itr2 = I.find(p);
    if (itr2 != I.end()) {
      ll t = I[p];
      tmp = pow2[s] - 1 + pow2[t] % MOD;
      I.erase(p);
    } else {
      tmp = pow2[s];
    }

    ans = (ans * tmp) % MOD;
    itr1 = I.erase(itr1);
  }

  ans = ( ans + zero - 1 + MOD ) % MOD;
  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 17068
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
using namespace std;

int main() {
    long long A,B,K;
    cin >> A >> B >> K;

    if (K >= A + B) {
        cout << 0 << " " << 0 << endl;
    } else {
        if (K >= A) {
            cout << 0 << " " << B-(K-A) << endl;
        } else {
            cout << (A-K) << " " << B << endl;
        }
    }
}


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

using namespace std;
typedef long long ll;

#define MOD (long long)(1e9+7)
#define INF (1LL<<60)
#define rep(i,n) for(ll i = 0; i < (n); i++)
#define rep1(i,n) for(ll i = 1; i <= (n); i++)

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


// 最大公約数
ll gcd(ll a, ll b)
{
  if(b == 0) return a;
  return gcd(b, a % b);
}

// mod m におけるa の逆元
ll modinv(ll a, ll m) {
  ll b = m, u = 1, v = 0;
  while (b) {
    ll t = a / b;
    a -= t * b; swap(a, b);
    u -= t * v; swap(u, v);
  }
  u %= m;
  if (u < 0) u += m;
  return u;
}

// 素因数分解
vector<pair<ll, ll>> prim;
void pf(ll n)
{
  ll s = sqrt(n);
  ll r = 0;
  for(ll i = 2; i <= s; i++) {
    if((n % i) == 0) {
      r = 0;
      do {
	r++;
	n = n / i;
      } while((n % i) == 0);
      prim.push_back({i, r});
    }
  }
  if(n > s) {
    prim.push_back({n, 1});
  }
}

void solve()
{
  ll N, M,  K; cin >> N >> M >> K;

  bool ok = false;

  for(int i = 0; i <= N; i++) {
    for(int j = 0; j <= M; j++) {
      if((N - i) *(M - j) + i * j == K) ok = true;
    }
  }
  
  cout << (ok?"Yes":"No") << endl;
}


int main(void)
{
  // ll t; cin >> t; rep(i, t)
  solve();
}


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

#define pb push_back
#define mp make_pair
#define ub upper_bound
#define st first
#define nd second
#define ll long long
#define pii pair < ll , ll >




int main(){

	ll n, m;
	cin >> n >> m;
	if(n < m)
		swap(n, m);
	if(n == 1)
		cout << 1 << endl;
	else if(m == 1)
		cout << n-2 << endl;
	else
		cout << (n-2)*(m-2) << endl;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
typedef long long ll;
ll n, p, k, a;

ll pow(ll x, ll y){
    if (y == 0) {
        return 1;
    } else {
        return x * pow(x, y - 1);
    }
}

int main(void){
    // Your code here!
    cin >> n >> p;
    for (ll i = 0; i < n; i++) {
        cin >> a;
        if (a % 2) k++;
    }
    cout << (k ? pow(2, n - 1) : (p ? 0 : pow(2, n))) << endl;
}


Measured memory_bytes: 256
#include <stdio.h>
#define INF 1e8

int Matrix[100][100];
int size[101];

void matrixChainOrder(int N){
    N++;
    for ( int ix = 0 ; ix < N ; ix++)
        Matrix[ix][ix] = 0;
        
    for ( int lx = 2 ; lx < N ; lx++){
        for ( int ix = 1 ; ix < N-lx+1 ; ix++){
            int jx = ix+lx-1;
            Matrix[ix][jx] = INF;
            for ( int kx = ix ; kx <= jx-1 ; kx++){
                int temp = Matrix[ix][kx] + Matrix[kx+1][jx] + size[ix-1]*size[kx]*size[jx];
                if ( temp < Matrix[ix][jx])
                    Matrix[ix][jx] = temp;
            }
        }
    }
}

int main(){
    int N;
    scanf("%d\n",&N);
    for ( int ix = 0 ; ix < N ; ix++ ){
        scanf("%d %d\n",&size[ix],&size[ix+1]);
    }
    matrixChainOrder(N);
    printf("%d\n",Matrix[1][N]);
    
    return 0;
}


Measured memory_bytes: 2116
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vl = vector<ll>;
using vvl = vector<vl>;
using vi = vector<int>;
using vvi = vector<vi>;
#define ote(x) cout<<(x)<<endl
#define all(x) (x).begin(),(x).end()
#define rp(i,s,e) for(int i=(s);i<(e);++i)

void solve(const string &S){
	int a = S[0]-'0';
	int b = S[1]-'0';
	int c = S[2]-'0';
	int d = S[3]-'0';
	string ope1,ope2,ope3;
	rp(i,0,2){
		rp(j,0,2){
			rp(k,0,2){
				int x;
				if(i==0){
					x = a + b;
					ope1 = "+";
				}
				else{
					x = a - b;
					ope1 = "-";
				}
				if(j==0){
					x += c;
					ope2 = "+";
				}
				else{
					x -= c;
					ope2 = "-";
				}
				if(k==0){
					x += d;
					ope3 = "+";
				}
				else{
					x -=d;
					ope3 = "-";
				}
				if(x==7){
					cout<<a<<ope1<<b<<ope2<<c<<ope3<<d<<"=7"<<endl;
					return;
				}
			}
		}
	}
}

int main(){
	string S; cin>>S;
	solve(S);
}


Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

struct node{
  struct node *right;
  struct node *left;
  struct node *parent;
  int key;
};

typedef struct node *Node;

#define NIL NULL

Node root;

void insert(Node);
void inorder(Node);
void preorder(Node);
Node find(Node,int);
Node min(Node);
Node successor(Node);
void delete(Node);

int main(){
  char command[20];
  int i,n,v,j;
  Node z;
  
  
  scanf("%d",&n);
  
  for(i=0;i<n;i++){
    scanf("%s",command);
    if(strcmp(command,"insert") == 0){
      scanf("%d",&v);
      z = malloc(sizeof(struct node));
      z->key = v;
      z->left = NIL;
      z->right = NIL;
      insert(z);
    }else if(strcmp(command,"print") == 0){
      inorder(root);
      printf("\n");
      preorder(root);
      printf("\n");
    }else if(strcmp(command,"find") == 0){
      scanf("%d",&v);
      if(find(root,v) != NIL)printf("yes\n");
      else printf("no\n");
    }else if(strcmp(command,"delete") == 0){
       scanf("%d",&v);
       delete(find(root,v));
    }
    
  
  }

  
  return 0;
}

void insert(Node z){
  Node y = NIL;
  Node x = root;
  while(x!=NIL){
    y = x;
    if(z->key<x->key){
      x = x->left;      
    }else{
      x = x->right;
    }
  }
  z->parent = y;
  
  if(y == NIL){
    root = z;
  }else if(z->key < y->key){
    y->left = z;
  }else{
    y->right = z;
  }
}

void inorder(Node root){
  if(root != NIL){
    inorder(root->left);
    printf(" %d",root->key);
    inorder(root->right);
  }

}

void preorder(Node root){
  if(root == NIL){
    return;
  }
  printf(" %d",root->key);
  preorder(root->left);
  preorder(root->right);
}

Node find(Node z ,int x){
  if(z == NIL || x == z->key){
    return z;
  }
  if(x < z->key){
    return find(z->left,x);
  }else{
    return find(z->right,x);
  }
  
}

Node min(Node z){
  while (z->left != NIL){
    z = z->left;
  }
  return z;
}

Node successor(Node z){
  Node y;
  if(z->right != NIL){
    return min(z->right);
  }

  y = z->parent;
  while (y != NIL && z == y->right){
    z = y;
    y = y->parent;
  }

  return y;
}

void delete(Node z){
  Node x,y;
  if(z->left == NIL || z->right == NIL){
    y = z;
  }else{
    y = successor(z);
  }
  
  if(y->left != NIL){
    x = y->left;
  }else{
    x = y->right;
  }
  
  if(x != NIL){
    x->parent=y->parent;
  }
  if(y->parent == NIL){
    root = x;
  }else if(y == y->parent->left){
    y->parent->left = x;
  }else{
    y->parent->right = x;
  }

  if(y != z){
    z->key = y->key;
  }
}



Measured memory_bytes: 20496
N, M = list(map(int, input().split()))
AB = []
for i in range(M):
    a, b = list(map(int, input().split()))
    AB.append([a, b])

graph = []
for i in range(N):
    graph.append([False]*N)

for a, b in AB:
    a -= 1
    b -= 1
    graph[a][b] = True
    graph[b][a] = True

VISITED = [None] * N

count = 0

def dfs(v):
    global count
    # print(v, VISITED)
    if all(VISITED):
        count += 1
        return

    edges = graph[v]
    for i, ei in enumerate(edges):
        if ei and not VISITED[i]:
            VISITED[i] = True
            dfs(i)
            VISITED[i] = False

    return 0


VISITED[0] = True
dfs(0)
print(count)

Measured memory_bytes: 3188
#include <bits/stdc++.h>
using namespace std;
 
int main() {
 
  int L, R, d;
  cin >> L >> R >> d;
  int n=0;
  for(int i=L;i<=R;i++){
  if(i%d==0){
   n++;
  }
  }
  cout << n << endl;
}


Measured memory_bytes: 3528
n = int(input())
a = [int(i) for i in input().split()]
div2 = 0
div4 = 0
for i in a:
  if i%4==0:
    div4 += 1
  elif i%2==0:
    div2 += 1
if n-max(div2-1,0) <= div4*2+1:
  print('Yes')
else:
  print('No')

Measured memory_bytes: 14252
#include <bits/stdc++.h>
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define repi(i,a,b) for(int i=int(a);i<int(b);i++)
#define all(v) v.begin(), v.end()
#define ll long long
using namespace std;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<long long>;
using vvll = vector<vll>;

//snippets:tmp,cl,cvl,cs,co,coy,con,cov

int main(){
    ll s;
    cin >> s;
    ll w;
    cin >> w;
    if(w>=s)cout<<"unsafe"<<endl;
    else cout<<"safe"<<endl;
}


Measured memory_bytes: 3620
import sys

def main():
    tmp = input().replace('\n','').split()
    if int(tmp[0]) == int(tmp[1]) and int(tmp[0]) != int(tmp[2]) or int(tmp[1]) == int(tmp[2]) and int(tmp[0]) != int(tmp[1]) or int(tmp[0]) == int(tmp[2]) and int(tmp[1]) != int(tmp[2]):
        print("Yes")
    else:
        print("No")
if __name__ == '__main__':
    input = sys.stdin.readline
    main()

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i, a, b) for (int i = (int)(a); i < (int)(b); ++i)
#define all(c) c.begin(),c.end()
#define sz(c) ((int)c.size())
using pii = pair<int, int>;
using vi = vector<int>;
using vvi = vector<vector<int>>;

signed main() {
    while (1) {
        int n;
        cin >> n;
        if (n == 0) break;

        vector<string> s(n);
        rep(i, 0, n) {
            cin >> s[i];
        }
        rep(i, 0, n) {
            if (s[i][0] != '.') continue;
            rep(j, 0, sz(s[i]) - 1) {
                if (s[i][j + 1] != '.') {
                    int r = i - 1;
                    while (r >= 0 && s[r][j] == '.') {
                        s[r][j] = '|';
                        r--;
                    }
                    s[i][j] = '+';
                    break;
                }
            }
        }
        rep(i, 0, n) {
            rep(j, 0, sz(s[i])) {
                if (s[i][j] == '.') s[i][j] = ' ';
            }
            cout << s[i] << endl;
        }
    }
}



Measured memory_bytes: 3744
import java.io.*;
import java.util.*;

public class Main {

    private static final int MAX = 20000001;
    private static final int VMAX = 10000;

    public static void main(String[] args) throws Exception {
        FastScanner sc = new FastScanner(System.in);
        PrintWriter out = new PrintWriter(System.out);
        int n = sc.nextInt();
        // input
        int[] A = new int[n+1];
        // output
        int[] B = new int[n+1];
        // count を記録
        int[] C = new int[VMAX + 1];

        for(int i=0; i<n; i++){
            // i+1とするのは累計に変換する時にi-1を使いたいから
            A[i+1] = sc.nextInt();
            C[A[i+1]]++;
        }
        // 累計の数に変換
        for(int i=1; i<VMAX; i++){
            C[i] = C[i] + C[i - 1];
        }
        // 出力用の配列にソート
        for(int j=0; j<=n; j++){
            B[C[A[j]]] = A[j];
            C[A[j]]--;
        }

        // 結果出力
        StringBuilder builder = new StringBuilder();
        for(int i=1; i<=n; i++){
            if(i == 1) builder.append(B[i]);
            else builder.append(" ").append(B[i]);
        }
        out.println(builder.toString());

        out.flush();

    }

    static class FastScanner {
        private BufferedReader reader = null;
        private StringTokenizer tokenizer = null;

        public FastScanner(InputStream in) {
            reader = new BufferedReader(new InputStreamReader(in));
            tokenizer = null;
        }

        public String next() {
            if (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        public String nextLine() {
            if (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    return reader.readLine();
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }

            return tokenizer.nextToken("\n");
        }

        public long nextLong() {
            return Long.parseLong(next());
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

    }
}


Measured memory_bytes: 167636
#include <bits/stdc++.h>
using namespace std;
double pi = 3.14159;
int main(void){
  int n, m;
  cin >> n >> m;
  int x, sum = 0;
  for(int i=1; i<=m; i++){
    cin >> x;
    sum += x;
  }
  n = n - sum;
  if(n >= 0)    cout << n;
  else  cout << "-1";
  return 0;
}


Measured memory_bytes: 3628
N = int(input())
L = list(map(int, input().split()))
L.sort()

ans = 0
for i in range(N):
    for j in range(i+1, N):
        for k in range(j+1, N):
            if L[i]!=L[j] and L[j]!=L[k] and L[k]!=L[i]:
                if L[i] + L[j]> L[k]:
                    ans += 1
                   
print(ans)

Measured memory_bytes: 9192
#include <iostream>
#include <string>
#include <cmath>
#include<algorithm>
#include<stack>
#include<queue>
#include<map>
#include<set>
#include<iomanip>
#define _USE_MATH_DEFINES
#include <math.h>
#include <functional>
#include<complex>
using namespace std;

#define rep(i,x) for(ll i=0;i<x;i++)
#define repn(i,x) for(ll i=1;i<=x;i++)

typedef long long ll;
const ll INF = 1e17;
const ll MOD = 1000000007;
const ll MAX = 4000001;
const double eps = 1E-18;

ll max(ll a, ll b) {
	if (a > b) { return a; }
	return b;
}

ll min(ll a, ll b) {
	if (a > b) { return b; }
	return a;
}

ll gcd(ll a, ll b) {
	if (b == 0) { return a; }
	if (a < b) { return gcd(b, a); }
	return gcd(b, a % b);
}

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

struct edge {
	ll ind;
	ll fr;
	ll to;
	ll d;
};

class mint {
	long long x;
public:
	mint(long long x = 0) : x((x% MOD + MOD) % MOD) {}
	mint operator-() const {
		return mint(-x);
	}
	mint& operator+=(const mint& a) {
		if ((x += a.x) >= MOD) x -= MOD;
		return *this;
	}
	mint& operator-=(const mint& a) {
		if ((x += MOD - a.x) >= MOD) x -= MOD;
		return *this;
	}
	mint& operator*=(const  mint& a) {
		(x *= a.x) %= MOD;
		return *this;
	}
	mint operator+(const mint& a) const {
		mint res(*this);
		return res += a;
	}
	mint operator-(const mint& a) const {
		mint res(*this);
		return res -= a;
	}
	mint operator*(const mint& a) const {
		mint res(*this);
		return res *= a;
	}

	mint operator^(const ll& t)const {
		if (!t) return 1;
		mint a = pow(t >> 1);
		a *= a;
		if (t & 1) a *= *this;
		return a;
	}

	mint pow(ll t) const {
		if (!t) return 1;
		mint a = pow(t >> 1);
		a *= a;
		if (t & 1) a *= *this;
		return a;
	}
	// for prime MOD
	mint inv() const {
		return pow(MOD - 2);
	}
	mint& operator/=(const mint& a) {
		return (*this) *= a.inv();
	}
	mint operator/(const mint& a) const {
		mint res(*this);
		return res /= a;
	}

	friend ostream& operator<<(ostream& os, const mint& m) {
		os << m.x;
		return os;
	}
};

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


int main() {

	ll N;
	cin >> N;

	vector<ll> A(N + 1);
	repn(i, N) cin >> A[i];

	vector<pair<ll, ll>> p(N + 1);
	repn(i, N) p[i] = { A[i],i };
	sort(++p.begin(), p.end(), greater<pair<ll, ll>>());

	vector<vector<ll>> dp(N + 1, vector<ll>(N + 1, 0));

	repn(k, N) {
		rep(i, k + 1) {
			ll j = k - i;
			ll x = 0;
			ll y = 0;

			if (i > 0) { x = dp[i - 1][j] + p[k].first*abs(p[k].second - i); }
			if (j > 0) { y = dp[i][j - 1] + p[k].first*abs(N - j + 1 - p[k].second); }
			dp[i][j] = max(x, y);
		}
	}

	ll ans = 0;

	rep(i, N + 1) ans = max(ans, dp[i][N - i]);

	cout << ans;

	system("PAUSE");
}


Measured memory_bytes: 34896
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
// --------------------------------------------------------
#define FOR(i,l,r) for (int i = (l); i < (r); ++i)
#define REP(i,n) FOR(i,0,n)
#define SORT(c) sort((c).begin(), (c).end())
#define RSORT(c) sort((c).rbegin(), (c).rend())
#define SZ(c) ((int)(c).size())
#define debug(x) cerr << #x << " = " << (x) << '\n';
using P = pair<int,int>;
using VS = vector<string>;
using VI = vector<int>;
using VVI = vector<VI>;
const double EPS = 1e-10;
const double PI  = acos(-1.0);
const ll MOD = 1e+9 + 7;
// --------------------------------------------------------


const int MAX_N = 1e+5;
VI dp(MAX_N + 1, 0);

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << fixed << setprecision(10);

    int N; cin >> N;
    VI h(N+1); FOR(i,1,N+1) cin >> h[i];

    dp[2] = dp[1] + abs(h[2] - h[1]);
    FOR(i,3,N+1) {
        dp[i] = min(dp[i-1] + abs(h[i] - h[i-1]), dp[i-2] + abs(h[i] - h[i-2]));
    }

    cout << dp[N] << '\n';

    return 0;
}

// https://atcoder.jp/contests/dp/tasks/dp_a


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

using namespace std;

#define int long long

const int N = (int)3e5, MOD = (int)1e9 + 7, INF = (int)3e18;

int a[N];
int was[N];
int f[N];

main() {
    ios :: sync_with_stdio(0);
    cin.tie(0);
    int n, k;
    cin >> n >> k;
    for (int i = 1; i <= n; ++i) {
        cin >> a[i];
        f[i] = -1;
    }
    int i = 1;
    int cnt = 0;
    f[1] = 0;
    while (!was[i]) {
        k--;
        was[i] = 1;
        i = a[i];
        ++cnt;
        if (f[i] == -1) {
            f[i] = cnt;
        }
        if (!k) {
            cout << i;
            return 0;
        }
    }
    k %= (cnt - f[i]);
    while (k--) i = a[i];
    cout << i;
    return 0;
}

Measured memory_bytes: 8304
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <map>
#include <list>
#include <utility>
#include <tuple>
#include <cstdio>
#include <set>
#include <queue>
#include <stack>
#include <deque>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#include <cctype>
#include <cmath>
#define _GLIBCXX_DEBUG
using namespace std;
const long long INF = 1LL << 60;
int main() {
    int N;
    cin >> N;
    int cost=0;
    int minmum_cost;
    vector<int> X(N);
    for(int i=0;i<N;i++){
        cin >> X[i];
    }
    for(int i=1;i<=100;i++){
        cost = 0;
        for(int j=0;j<N;j++){
            cost = cost + (X[j]-i)*(X[j]-i);
        }
        if(i==1){
            minmum_cost = cost;
        }
        else{
            if(cost < minmum_cost){
                minmum_cost = cost;
            }
        }
    }
    cout << minmum_cost << endl;
}

Measured memory_bytes: 3616
#include<stdio.h>
int main(void)
{
	int x,y;
	scanf("%d %d",&x,&y);
	if(x==1||x==3||x==5||x==7||x==8||x==10||x==12){
		if(y==1||y==3||y==5||y==7||y==8||y==10||y==12){
			printf("Yes\n");
		}
		else	printf("No\n");
	}
	
	if(x==4||x==6||x==9||x==11){
		if(y==4||y==6||y==9||y==11){
			printf("Yes\n");
		}
		else	printf("No\n");
	}
	
	if(x==2){
		if(y==2)	printf("Yes\n");
		else	printf("No\n");
	}
	return 0;
}


Measured memory_bytes: 128
#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;
typedef tuple<ll,ll,ll> T;
const long long INF = 1LL<<60;
const long long MOD = 1000000000+7;
#define rev(s) (string((s).rbegin(), (s).rend()))
// cout << fixed << setprecision(10) << ans << endl; 有効桁数指定
// *min_element(c + l, c + r) *max_element(c + l, c + r) 配列の中のmin-max
// int dx[8]={1,1,0,-1,-1,-1,0,1};
// int dy[8]={0,1,1,1,0,-1,-1,-1};
// int dx[4]={1,0,-1,0};
// int dy[4]={0,1,0,-1};
// ~ は、-1の時だけfalse

long long GCD(long long a, long long b) {
    if (b == 0) return a;
    else return GCD(b, a % b);
}

long long LCM(long long a, long long b) {
    return a / GCD(a, b) * b;
}

// ax + by = gcd(a, b) となるような (x, y) を求める
// 多くの場合 a と b は互いに素として ax + by = 1 となる (x, y) を求める
long long extGCD(long long a, long long b, long long &x, long long &y) {
    if (b == 0) {
        x = 1;
        y = 0;
        return a;
    }
    // 再帰的に解く (x, y を入れ替えておく)
    long long d = extGCD(b, a % b, y, x); 
    y -= a / b * x;
    return d;
}

// 素因数分解
vector<pair<long long, long long> > prime_factorize(long long N) {
    vector<pair<long long, long long> > res;
    for (long long a = 2; a * a <= N; ++a) {
        if (N % a != 0) continue;
        long long ex = 0;
        while (N % a == 0) {
            ++ex;
            N /= a;
        }
        res.push_back({a, ex});
    }
    if (N != 1) res.push_back({N, 1});
    return res;
}

//約数列挙
vector<long long> enum_divisors(long long N) {
    vector<long long> res;
    for (long long i = 1; i * i <= N; ++i) {
        if (N % i == 0) {
            res.push_back(i);
            // 重複しないならば i の相方である N/i も push
            if (N/i != i) res.push_back(N/i);
        }
    }
    // 小さい順に並び替える
    sort(res.begin(), res.end());
    return res;
}

ll vec[110];

int main () {

    ll n;cin>>n;
    
    for (ll i =2;i<=n;i++) {
        const auto &pf = prime_factorize(i);
        for(auto p:pf) {
            vec[p.first]+=p.second;
        }
    }

    ll ans=0;
    ll num_75=0,num_25=0,num_15=0,num_5=0,num_3=0;
    rep(i,110) {
        if (vec[i]>=74)  {
            num_75++;
            num_25++;
            num_15++;
            num_5++;
            num_3++;
        } else if (vec[i]>=24) {
            num_25++;
            num_15++;
            num_5++;
            num_3++;
        } else if (vec[i]>=14) {
            num_15++;
            num_5++;
            num_3++;
        } else if (vec[i]>=4) {
            num_5++;
            num_3++;
        } else if (vec[i]>=2) {
            num_3++;
        }
    }

    // cout<<num_75<<" "<<num_25<<" "<<num_5<<" "<<num_3<<endl;

    ans+=num_75+num_25*(num_3-1)+num_5*(num_5-1)/2*(num_3-2)+num_15*(num_5-1);

    cout<<ans<<endl;

}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define FASTIO ios::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define LL long long int
using namespace std;

void solve() {
    LL n;
    cin >> n;
    LL cost = (n + 999) / 1000;
    cost *= 1000;
    cout << cost - n << '\n';
} 

int main() {
    FASTIO;
    int t = 1;
    // cin >> t;
    while(t--) solve();
    return 0;
}

Measured memory_bytes: 3644
#include <vector>
#include <cstdio>
using namespace std;

int main(){
	int N,M,a,b;
	for(;~scanf("%d%d",&N,&M)&&N&&M;){
		vector<int>v(M);
		for(int i=0;i<N;i++){
			scanf("%d%d",&a,&b);
			v[a-1]=max(b,v[a-1]);
		}
		int s=0;
		for(int i=0;i<M;i++)s+=v[i];
		printf("%d\n",s);
	}
}

Measured memory_bytes: 2668
#include <math.h>
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

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

int main(void) {
  int scan; // scanf result
  int answer; // stdout
  ll n; // stdin

  scan = scanf("%lld", &n);

  answer = 0;
  answer += (n / 500) * 1000;
  answer += ((n % 500) / 5) * 5;

  printf("%d", answer);
  return (0);
}


Measured memory_bytes: 128
open System

let n, m, x = stdin.ReadLine().Split() |> fun [| n; m; x |] -> int n, int m, int x
let ca = 
    [|
        for _ in 0.. n-1 do
            yield stdin.ReadLine().Split()|> Array.map int
    |]

// nが小さいので総当たりで求める
let total (str:string) =
    let arraySum arr1 arr2 = Array.map2 (fun x y -> x+y) arr1 arr2 

    str.ToCharArray() |> Array.rev |> Array.mapi (fun i x -> if x = '1' then Some(ca.[i]) else None)
    |> Array.choose (id) |>Array.reduce (arraySum)


{1 .. pown 2 n - 1} |> Seq.map (fun x -> Convert.ToString(x,2)) |> Seq.map total
|> Seq.filter (fun array -> array.[1..] |> Array.forall (fun e -> e >= x))
|> fun s -> 
    if Seq.isEmpty s then -1
    else s |> Seq.minBy (fun array -> array.[0]) |> fun array -> array.[0]
|> stdout.WriteLine

Measured memory_bytes: 39324
#include <iostream>
#include <algorithm>
#include <cmath>
#include <vector>
#include <stack>
#include <cstdlib>
#include <cstdio>
#include <string>
#include <cstring>
using namespace std;

int main() {
    int a, b, c;
    cin >> a >> b >> c;
    
    if (a <= c && c <= b) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
    
    return 0;
}

Measured memory_bytes: 256