akhauriyash/Code-Regression huggingface dataset:
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		int K = in.nextInt();
		int X = in.nextInt();
		if (K * 500 >= X) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}
		in.close();
	}
}

Measured memory_bytes: 21076
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <cstdio>
#include <vector>
#include <cmath>
#include <cstring>
#include <numeric>
#include <algorithm>
#include <fstream>
#include <functional>
#include <array>
#include <map>
#include <queue>
#include <time.h>
#include <limits.h>
#include <set>
#include <stack>
#include <random>
#include <complex>
#include <unordered_map>
#include <unordered_set>
#define rep(i,s,n) for(int i = (s); (n) > i; i++)
#define REP(i,n) rep(i,0,n)
#define RANGE(x,a,b) (min(a,b) <= (x) && (x) <= max(a,b)) //hei
#define DUPLE(a,b,c,d) (RANGE(a,c,d) || RANGE(b,c,d) || RANGE(c,a,b) || RANGE(d,a,b))
#define INCLU(a,b,c,d) (RANGE(a,c,d) && (b,c,d))
#define PW(x) ((x)*(x))
#define ALL(x) (x).begin(), (x).end()
#define RALL(x) (x).rbegin(), (x).rend()
#define MODU 998244353LL
#define bitcheck(a,b)   ((a >> b) & 1)
#define bitset(a,b)      ( a |= (1 << b))
#define bitunset(a,b)    (a &= ~(1 << b))
#define MP(a,b) make_pair((a),(b))
#define Manh(a,b) (abs((a).first-(b).first) + abs((a).second - ((b).second))
#define pritnf printf
#define scnaf scanf
#define itn int
#define PI 3.141592653589


#define izryt bool
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
template<typename A, size_t N, typename T>
void Fill(A(&array)[N], const T & val) {
	std::fill((T*)array, (T*)(array + N), val);
}
pll Dir[4] = {
	{ -1 ,0 },{ 0 , 1 },{ 1 ,0 },{ 0 ,-1 }
};

//[a, b)
#define Getsum(ar, a,b) (ar[b] - ar[a])
#define INF 10000000000000000LL
#define chmax(a,b) a = max(a,b)
#define chmin(a,b) a = min(a,b)

struct Edge {
	int from, to;
	ll w;
	bool operator<(const Edge& rhs) const {
		return MP(w, MP(from, to)) < MP(rhs.w, MP(rhs.from, rhs.to));
	}

};
typedef vector<vector<Edge>> Graph;

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



ll mod_pow(ll x, ll n, ll mod) {
	ll res = 1;
	while (n > 0) {
		if (n & 1) res = res * x %mod;
		x = x * x%mod;
		n >>= 1;
	}
	return res;
}

	multiset<pair<ll,int>> st;
	vector<ll> dep[100001];
	vector<pair<ll,int>> in[100001];
signed main() {
	int n, m;
	cin >> n >> m;


	REP(i,m) {
		int l, r, c;
		cin >> l >> r >> c;
		l--, r--;
		in[l].push_back({ c ,r});
	}

	st.insert({0,0});
	REP(i, n) {
		while (1) {
			if (st.size() == 0) {
				cout << -1 << endl;
				return 0;
			}
			if (st.begin()->second < i)
				st.erase(st.begin());
			else
				break;
		}
		ll Min = st.begin()->first;
		for (auto itr : in[i]) {
			pair<ll, int> cur = { itr.first + Min, itr.second};
			st.insert(cur);
		}
	}

	while (1) {
		if (st.size() == 0) {
			cout << -1 << endl;
			return 0;
		}
		if (st.begin()->second < n-1)
			st.erase(st.begin());
		else
			break;
	}

	cout << st.begin()->first << endl;
	return 0;
}

Measured memory_bytes: 13312
#include<bits/stdc++.h>
using namespace std;
typedef long long LL;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef pair<LL,LL> pll;
const int maxn=1E5+5;

int main(){
    string s;
    cin>>s;
    if(s[2]==s[3]&&s[4]==s[5]) cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
    return 0;
}

Measured memory_bytes: 256
#include<cstdio>
#include<cmath>
#include<algorithm>
using namespace std;
int n;
long long a[200001],ans=0ll;
int main()
{
	scanf("%d",&n);
	for (int i=1;i<=n;i++)
	{
		scanf("%lld",&a[i]);
		a[i]-=i;
	}
	sort(a+1,a+n+1);
	for (int i=1,k=n;i<k;i++,k--)
	{
		ans+=a[k]-a[i];
	}
	printf("%lld",ans);
	return 0;
}

Measured memory_bytes: 1664
#include<cstdio>

int main()
{
	int n,num,ans;
	while(~scanf("%d",&n)){
		ans = 0;
		for(int i = 0; i<n; i++){
			scanf("%d",&num);
			ans += num - 1;
		}
		printf("%d\n",ans);
	}
	return 0;
}

Measured memory_bytes: 128
use std::cmp::*;
use std::io::*;
use std::num::*;
use std::str::*;

fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let s = stdin
        .bytes()
        .map(|c| c.unwrap() as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect::<String>();
    s.parse::<T>().ok().unwrap()
}

fn string() -> String {
    read()
}

fn int() -> i64 {
    read()
}

fn char() -> char {
    read::<String>().pop().unwrap()
}

fn vecchar() -> Vec<char> {
    string().chars().collect()
}

fn vecint(n: i64) -> Vec<i64> {
    let mut vec = Vec::new();
    for i in 0..n {
        vec.push(int())
    }
    vec
}

fn main() {
    let (a, op, b) = (int(), char(), int());
    println!(
        "{}",
        match op {
            '+' => a + b,
            '-' => a - b,
            _ => unreachable!(),
        }
    );
}


Measured memory_bytes: 4352
import java.util.*;
public class Main {

	public static void main(String[] args) {
		Scanner sc =new Scanner(System.in);
		int[]a=new int[3];
		int count=0;
		for(int i=0;i<3;i++){
			a[i]=sc.nextInt();
		}
		for(int j=0;j<3;j++){
			if(a[j]==7){
				count++;
			}
		}
		if(count==1){
			System.out.println("YES");
		}else{
			System.out.println("NO");
		}
	}

}


Measured memory_bytes: 9428
#include <bits/stdc++.h>
using namespace std;
int main(){
  int a,b;
  cin >> a >> b;
  int s;
  s = 1;
  for(int i;i<a;i++){
    if(s > b){
      s = s + b;
    }
    else{
	  s = s*2;
    }
  }
  cout << s <<endl;
}
    

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <utility>
#include <algorithm>
#define llint long long 
#define mod 1000000007

using namespace std;

llint n;
vector< pair<llint, llint> > vec;

int main(void)
{
	cin >> n;
	llint a;
	for(int i = 0; i < n; i++){
		cin >> a;
		vec.push_back(make_pair(a, 1));
	}
	for(int i = 0; i < n; i++){
		cin >> a;
		vec.push_back(make_pair(a, -1));
	}
	sort(vec.begin(), vec.end());
	
	llint ans = 1, stk = 0;
	for(int i = 0; i < vec.size(); i++){
		if(vec[i].second > 0){
			if(stk < 0) ans *= -stk;
			stk++;
		}
		else{
			if(stk > 0) ans *= stk;
			stk--;
		}
		ans %= mod;
	}
	cout << ans << endl;
	return 0;
}

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

class Rolling_Hash{
private:
  ll n;
  static constexpr ll base1=1007,base2=2009;
  static constexpr ll mod1=(1e9+7),mod2=(1e9+9);
  vector<ll> hash1,hash2,mpow1,mpow2;
public:
  Rolling_Hash(const string& s){
    n=s.size();
    hash1.resize(n+1,0);
    hash2.resize(n+1,0);
    mpow1.resize(n+1,1);
    mpow2.resize(n+1,1);
    for(ll i=0;i<n;++i){
      hash1[i+1] = (hash1[i]*base1+s[i])%mod1;
      hash2[i+1] = (hash2[i]*base2+s[i])%mod2;
      mpow1[i+1] = (mpow1[i]*base1)%mod1;
      mpow2[i+1] = (mpow2[i]*base2)%mod2;
    }
  }
  auto get(ll l,ll r){
    ll lefval = hash1[r]-hash1[l]*mpow1[r-l]%mod1;
    ll rigval = hash2[r]-hash2[l]*mpow2[r-l]%mod2;
    if(lefval<0)lefval+=mod1;
    if(rigval<0)rigval+=mod2;
    return make_pair(lefval,rigval);
  }
  auto get_LCP(ll a,ll b){
    ll len = min( n-a+1,n-b+1 );
    ll low=0,high=len;
    while( high-low>1 ){
      ll mid=(high+low)>>1;
      if(get(a,a+mid)!=get(b,b+mid))high=mid;
      else low=mid;
    }
    return low;
  }
};

void solve1(){
  // http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ALDS1_14_B&lang=ja
  string s,t;
  cin>>s>>t;
  ll n=s.size(),m=t.size();
  Rolling_Hash SR(s),TR(t);
  rep(i,n-m+1){
    if(SR.get(i,i+m)==TR.get(0,m)){
      cout<<i<<endl;
    }
  }
}
void solve2(){
  //
  ll n;
  string s;
  cin>>n>>s;
  Rolling_Hash rori(s);
  ll ans=0;
  for(ll i=0;i<n;++i){
    for(ll j=i+1;j<n;++j){
      ll lcp = rori.get_LCP(i,j);
      ans=max(ans,min(lcp,j-i));
    }
  }
  cout<<(ans)<<endl;
}

main(){
  //solve1();
  solve2();
}

Measured memory_bytes: 384
#!/usr/bin/env python
N = int(input())
memo = [-1 for _ in range(N+1)]
def lucas(N):
    global memo
    if N==0:
        memo[0] = 2
        return 2
    if N==1:
        memo[1] = 1
        return 1
    if(memo[N]>0):
        return memo[N]
    else:
        memo[N] = lucas(N-1) + lucas(N-2)
        return memo[N]


print(lucas(N))


Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
typedef signed long long ll;

#undef _P
#define _P(...) (void)printf(__VA_ARGS__)
#define FOR(x,to) for(x=0;x<(to);x++)
#define FORR(x,arr) for(auto& x:arr)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define ALL(a) (a.begin()),(a.end())
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
//-------------------------------------------------------

int N;
ll mo=1000000007;
ll modpow(ll a, ll n = mo-2) {
	ll r=1;a%=mo;
	while(n) r=r*((n%2)?a:1)%mo,a=a*a%mo,n>>=1;
	return r;
}

ll comb(ll N_, ll C_) {
	const int NUM_=1400001;
	static ll fact[NUM_+1],factr[NUM_+1],inv[NUM_+1];
	if (fact[0]==0) {
		inv[1]=fact[0]=factr[0]=1;
		for (int i=2;i<=NUM_;++i) inv[i] = inv[mo % i] * (mo - mo / i) % mo;
		for (int i=1;i<=NUM_;++i) fact[i]=fact[i-1]*i%mo, factr[i]=factr[i-1]*inv[i]%mo;
	}
	if(C_<0 || C_>N_) return 0;
	return factr[C_]*fact[N_]%mo*factr[N_-C_]%mo;
}

ll pat[1010100][3];
ll F[1010100],G[1010100];

void solve() {
	int i,j,k,l,r,x,y; string s;
	
	cin>>N;
	
	pat[0][0]=1;
	FOR(i,N) {
		pat[i+1][0]=(pat[i][1]+pat[i][2])%mo;
		pat[i+1][1]=(pat[i][0]+pat[i][2])%mo;
		pat[i+1][2]=(pat[i][0]+pat[i][1])%mo;
	}
	
	ll p3=modpow(modpow(3,N-1));
	
	ll ret=0;
	for(i=1;i<=N;i++) {
		F[i]=(pat[i-1][0]+pat[i-1][2])*comb(N,i)%mo*p3%mo;
		G[i]=modpow(3LL*N*i%mo);
		ret+=F[i]*G[i]%mo;
	}
	cout<<ret%mo<<endl;
	
}


int main(int argc,char** argv){
	string s;int i;
	if(argc==1) ios::sync_with_stdio(false), cin.tie(0);
	FOR(i,argc-1) s+=argv[i+1],s+='\n'; FOR(i,s.size()) ungetc(s[s.size()-1-i],stdin);
	cout.tie(0); solve(); return 0;
}


Measured memory_bytes: 72576
#include <bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
#define  mx 1000000
#define  ll long long
#define  pii pair<int,int>
#define  debug cout << "this far" << endl;
#define  For(i,n) for(ll i = 0; i < (n); ++i)
#define  mod  1000000007
#define PI acos(-1)
#define line cout << endl;
#define fileopen freopen("input.txt","r",stdin); freopen("output.txt","w",stdout);
//#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
//using namespace __gnu_pbds;
using namespace std;
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    int n;
    cin >> n ;
    ll g = 0 ;
    for(int  i = 1 ; i <= n; ++i){
        for(int j = 1; j <= n; ++j){
            for(int k = 1; k <= n; ++k){
                g += __gcd(i , __gcd(j,k));
            }
        }
    }
    cout << g << endl;
}

Measured memory_bytes: 3652
#pragma GCC optimize ("O3")
#pragma GCC target ("avx")
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
#define ce(x) cerr << (x) << "\n"
#define cesp(x) cerr << (x) << " "
#define pb push_back
#define mp make_pair
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
#define Would
#define you
#define please

int P[1001];

int Find(int A) {
	if (P[A] < 0) return A;
	return P[A] = Find(P[A]);
}

bool Unite(int A, int B) {
	int a = Find(A);
	int b = Find(B);
	if (a == b) return false;
	if (P[a] > P[b]) swap(a, b);
	P[a] += P[b];
	P[b] = a;
	return true;
}

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


	int N, M;
	ll X;
	cin >> N >> M >> X;

	pair<int, int> E[2000];
	rep(i, M) {
		int u, v, w;
		cin >> u >> v >> w;
		int uv = (u << 10) + v;
		E[i] = mp(w, uv);
	}

	sort(E, E + M);

	rep1(i, N) P[i] = -1;

	ll saishou = 0;
	bool tukaeru[2001] = {};
	rep(i, M) {
		int u = E[i].second >> 10;
		int v = E[i].second & ((1 << 10) - 1);
		if (Unite(u, v)) {
			tukaeru[i] = true;
			saishou += E[i].first;
		}
	}
	const ll mod = 1e9 + 7;

	if (X < saishou) {
		co(0);
		return 0;
	}
	if (X == saishou) {
		rep(i, M) {
			if (!tukaeru[i]) {
				ll saishou2 = 0;
				rep1(j, N) P[j] = -1;
				int u = E[i].second >> 10;
				int v = E[i].second & ((1 << 10) - 1);
				if (Unite(u, v)) {
					saishou2 += E[i].first;
				}
				rep(j, M) if (i != j) {
					u = E[j].second >> 10;
					v = E[j].second & ((1 << 10) - 1);
					if (Unite(u, v)) {
						saishou2 += E[j].first;
					}
				}
				if (saishou == saishou2) tukaeru[i] = true;
			}
		}
		int kazu = 0;
		rep(i, M) kazu += tukaeru[i];
		ll kotae = 1;
		rep(i, kazu) {
			kotae *= 2;
			kotae %= mod;
		}
		kotae -= 2;
		rep(i, M - kazu) {
			kotae *= 2;
			kotae %= mod;
		}
		co((kotae + mod) % mod);
	}
	else {
		int tukaeru2[2001] = {};
		rep(i, M) {
			if (!tukaeru[i]) {
				ll saishou2 = 0;
				rep1(j, N) P[j] = -1;
				int u = E[i].second >> 10;
				int v = E[i].second & ((1 << 10) - 1);
				if (Unite(u, v)) {
					saishou2 += E[i].first;
				}
				rep(j, M) if (i != j) {
					u = E[j].second >> 10;
					v = E[j].second & ((1 << 10) - 1);
					if (Unite(u, v)) {
						saishou2 += E[j].first;
					}
				}
				if (X == saishou2) tukaeru2[i] = true;
				else if (X > saishou2) tukaeru[i] = true;
			}
		}
		int kazu = 0;
		rep(i, M) kazu += tukaeru[i];
		int kazu2 = 0;
		rep(i, M) kazu2 += tukaeru2[i];
		ll kotae = 1;
		rep(i, kazu2 + 1) {
			kotae *= 2;
			kotae %= mod;
		}
		kotae -= 2;
		rep(i, M - kazu - kazu2) {
			kotae *= 2;
			kotae %= mod;
		}
		co((kotae + mod) % mod);
	}

	Would you please return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
string s[15];
main(){
    int H,W;
    cin >> H >>W;
    for (int i= 0 ;i < H; i++)
        cin >>s[i];
    for(int b= 0; b < (1<<H); b++){
        vector<int> v,w;
        if(__builtin_popcount(b) != (H+1)/2 || !(b&1)) continue;
        for(int i = 0; i < H; i++){
            if((1<<i)&b) w.push_back(i);
            else v.push_back(i);
        }
        int flf=0;
        vector<int> p;
        for(int i =0 ;i < w.size(); i++)
            p.push_back(i);
        do{
            vector<vector<short int> > a,b;
            vector<short int> c;
            for(int i =0 ;i < W; i++){
                a.push_back(c);
                b.push_back(c);
            }
            int fl = 0;

            for(int i= 0;i < v.size(); i++)
                for(int j = 0; j < W; j++)
                 a[j].push_back(s[v[i]][j]*200+s[w[p[i]]][j]),
                 b[j].push_back(s[w[p[i]]][j]*200+s[v[i]][j]);
            if(w.size()>v.size())
                for(int j = 0; j < W; j++)
                 a[j].push_back(s[w[p[w.size()-1]]][j]),
                 b[j].push_back(s[w[p[w.size()-1]]][j]);
                int ans=0;
             for(int j = 0; j < W; j++)
                if(a[j] ==b[j]) ans++;
            sort(a.begin(),a.end());
            sort(b.begin(),b.end());

            if(a!=b) continue;
            for(int i= 1;i < a.size(); i++){
               if(a[i]==a[i-1]) ans-=2,i++;
            }
            if(ans <= 1) {//cout<<ans<<" "<<a.size()<<" "<<v.size()<<" "<<w.size()<<endl;
       //     for(int i = 0; i<a.size(); i++)
         //       cout<<(char)a[i][0]<<endl;
                cout<<"YES"<<endl;
                return 0;
            }
        }while(next_permutation(p.begin(),p.end()));
    }
    cout<<"NO"<<endl;

}
/*
ddx
acb
cab

(a,c),d
(c,a),d
(b,b),x

*/


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define ld long double
#define sd second
#define ft first
#define ios                           \
    std::ios::sync_with_stdio(false); \
    cin.tie(NULL);                    \
    cout.tie(NULL);

const int MAX = 1e7 + 5;

int32_t main()
{
    ios;
    int n;
    cin >> n;
    vector<int> a(MAX, 1);
    for (int i = 2; i < MAX; i++)
    {
        for (int j = i; j < MAX; j += i)
        {
            a[j]++;
        }
    }
    int sum = 0;
    for (int i = 1; i <= n; i++)
    {
        //int temp = sum;
        sum += (i * a[i]);
        // cout << sum - temp << " ";
    }
    //cout << endl;
    cout << sum << endl;
    return 0;
}

Measured memory_bytes: 81256
#include <bits/stdc++.h>
#define mp make_pair
#define fi first
#define se second
#define pb push_back
#define forr(i,p,n) for(ll i=p;i<n;i++)
#define tam 310010
#define offset 30010
using namespace std;
typedef long long  ll;
typedef pair<ll,ll> ii;
typedef pair<map<int,int> ,int> mi;
typedef pair<ii,ii> iiii;
typedef vector<ll> vi;
const ll MOD=1e9+7;
int v[tam],valmax[tam];
int main()
{
    ios::sync_with_stdio(false);cin.tie(0);
    int n,t;
    cin>>n>>t;
    forr(i,0,n)
    {
        cin>>v[i];
    }
    int maxx=-1,totmax=-1;
    for(int i=n-1;i>=0;i--)
    {
        valmax[i]=maxx-v[i];
        totmax=max(valmax[i],totmax);
        maxx=max(maxx,v[i]);
    }
    int c=0;
    forr(i,0,n)
    {
        if (totmax==valmax[i])c++;
    }
    cout<<c<<endl;
}

Measured memory_bytes: 1024
#include<iostream>

using namespace std;

int main(){
	int a,b,c;
	int n;
	
	int d[1001];
	int e[1001];
	int f[1001];
	int g[1001];
	
	int flg[301];
	while(1){
		scanf("%d%d%d",&a,&b,&c);
		if(a==0){
			break;
		}
		scanf("%d",&n);
		for(int i=0;i<301;i++){
			flg[i]=2;
		}
		
		for(int i=0;i<n;i++){
			scanf("%d%d%d%d",&d[i],&e[i],&f[i],&g[i]);
			if(g[i]==1){
				flg[d[i]]=1;
				flg[e[i]]=1;
				flg[f[i]]=1;
			}
		}
		
			for(int i=0;i<n;i++){
				if(g[i]!=0){
					continue;
				}
				if(flg[d[i]]==2 && flg[e[i]]==1 && flg[f[i]]==1){
					flg[d[i]]=0;
				}else
				if(flg[d[i]]==1 &&flg[e[i]]==2 && flg[f[i]]==1){
					flg[e[i]]=0;
				}else
				if(flg[d[i]]==1 && flg[e[i]]==1 &&flg[f[i]]==2){
					flg[f[i]]=0;
				}
			}
		
		for(int i=1;i<a+b+c+1;i++){
			printf("%d\n",flg[i]);
		}
	}
}

Measured memory_bytes: 0
import java.util.Arrays;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int[] arr = new int[N];
		int[] sortedArr = new int[N];
		for(int i =0; i< N; i++) {
			arr[i] = sc.nextInt();
			sortedArr[i] = arr[i];
		}
		Arrays.sort(sortedArr);
		int first = sortedArr[N-1];
		int second = sortedArr[N-2];
		StringBuilder sb = new StringBuilder();
		for(int i =0; i< N; i++) {
			if(arr[i] == first) {
				sb.append(second);
			}else {
				sb.append(first);
			}
			sb.append("\n");
		}
		System.out.print(sb);
	}

}


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

using namespace std;
using namespace __gnu_pbds;

#define Q int t; scanf("%d", &t); for(int q=1; q<=t; q++)
typedef long long int lli;
typedef pair<int, int> pi;
#define oset tree<int, null_type,greater<int>, rb_tree_tag,tree_order_statistics_node_update>


int main()
{
    int n;
    cin >> n;
    int a[n];
    for(int i=0; i<n; i++){
        cin >> a[i];
    }
    sort(a, a+n);
    int x = n/2;

    cout << a[x]-a[x-1] << "\n";

    return 0;
}


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

using namespace std;

#define ok1 printf("ok1\n");
#define ok2 printf("ok2\n");
#define M 1000000000000000000LL
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,s,n) for(int i=(s);i<(n);i++)
#define repr(i,n) for(int i=n-1;i>=0;i--)
#define REPR(i,s,n) for(int i=(s);i>=(n);i--)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define pb push_back
#define pf push_front
#define MIN(a,b) a=min((a),(b))
#define MAX(a,b) a=max((a),(b))
#define SIZE(v) (int)v.size()
#define Eunique(v) v.erace(unique(all(v)),v.end())
#define pvec(v)　rep(i,v.size()){cout << v[i] << " ";}
#define INF 0x3f3f3f3f
#define mset(m,v) memset(m,v,sezeof(m))
#define mod (ll)(1e9 +7);

const double pi = acos(-1.0);

typedef vector<int> vi;
typedef string ss;
typedef vector<string> vs;
typedef long long ll;
typedef vector<ll> vll;
typedef vector<vi> vvi;
typedef vector<vll> vvll;
typedef deque<ll> dll;
typedef pair<ll,ll> P;
ll dx[4] = {1,0,-1,0},dy[4] = {0,1,0,-1};

ll gcd(ll x,ll y)
{
    ll r;
    while((r = x % y) != 0)
    {
        x = y;
        y = r;
    }
    return y;
}

ll lcm(ll a,ll b){
    ll g = gcd(a,b);
    return a / g * b; // Be careful not to overflow
}

ll digsum(ll n){
    ll sum = 0;
    while(n > 0){
        sum += n % 10;
        n /= 10;
    }

    return sum;
}

int main()
{
    ll n,d;
    cin >> n >> d;
    cout << n / (d  * 2 + 1) + ((n % (d  * 2 + 1) > 0)?1:0) << endl;
    return 0;
}

Measured memory_bytes: 256
import bisect

N,M=map(int,input().split())
A=list(map(int,input().split()))
B=list(map(int,input().split()))
A.sort()
B.sort()
dataA=set(A)
dataB=set(B)
if len(dataA)!=N or len(dataB)!=M:
    print(0)
    exit()

ans=1
mod=10**9+7
for i in range(M*N,0,-1):
    if i in dataA:
        if i in dataB:
            continue
        else:
            index=bisect.bisect_left(B,i)
            ans*=M-index
            ans%=mod
    else:
        if i in dataB:
            index=bisect.bisect_left(A,i)
            ans*=N-index
            ans%=mod
        else:
            indexh=bisect.bisect_left(A,i)
            indexw=bisect.bisect_left(B,i)
            h=N-indexh
            w=M-indexw
            ans*=(h*w-(N*M-i))
            ans%=mod

print(ans)

Measured memory_bytes: 44124
line = input().split()
l = int(line[0])
r = int(line[1])

dist = r - l
if dist >= 2018:
    print(0)
else:
    l = l % 2019
    
    li = []
    for i in range(dist+1):
        li.append((l+i) % 2019)
    
    smallest = 2018
    for i in range(len(li)):
        for j in range(i+1, len(li)):
            if (li[i] * li[j]) % 2019 < smallest:
                smallest = (li[i] * li[j]) % 2019
                
    print(smallest)
    


Measured memory_bytes: 3064
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cmath>
#include <stack>
#include <queue>
#include <set>
#include <map>
using namespace std;
typedef long long ll;
typedef vector<int> VI;
typedef vector< vector<int> > VVI;
typedef pair<int,int> P;
#define rep(i,n) for(int i=0;i<(n);i++)
#define all(a) (a).begin(),(a).end()

int main(){
  string S;
  cin>>S;
  vector<ll> X;
  ll cnt=1;
  rep(i,S.size()){
    if(i){
      if(S[i]==S[i-1]){
        cnt++;
      }else{
        X.push_back(cnt);
        cnt=1;
      }
    }
  }
  X.push_back(cnt);
  ll ans=0;
  if(S[0]=='<'){
    if(S[S.size()-1]=='>'){
      rep(i,X.size()/2){
        ans+=X[2*i]*(X[2*i]-1)/2;
        ans+=X[2*i+1]*(X[2*i+1]-1)/2;
        ans+=max(X[2*i],X[2*i+1]);
      }
    }else{
      rep(i,(X.size()-1)/2){
        ans+=X[2*i]*(X[2*i]-1)/2;
        ans+=X[2*i+1]*(X[2*i+1]-1)/2;
        ans+=max(X[2*i],X[2*i+1]);
      }
      ans+=X[X.size()-1]*(X[X.size()-1]+1)/2;
    }
  }else{
    if(S[S.size()-1]=='>'){
      rep(i,(X.size()-1)/2){
        ans+=X[2*i+1]*(X[2*i+1]-1)/2;
        ans+=X[2*i+2]*(X[2*i+2]-1)/2;
        ans+=max(X[2*i+1],X[2*i+2]);
      }
      ans+=X[0]*(X[0]+1)/2;
    }else{
      rep(i,(X.size()-2)/2){
        ans+=X[2*i+1]*(X[2*i+1]-1)/2;
        ans+=X[2*i+2]*(X[2*i+2]-1)/2;
        ans+=max(X[2*i+1],X[2*i+2]);
      }
      ans+=X[0]*(X[0]+1)/2+X[X.size()-1]*(X[X.size()-1]+1)/2;
    }
  }
  cout<<ans<<endl;
}




Measured memory_bytes: 4092
class UnionFind:
    def __init__(self, n):
        self.p = [i for i in range(n)]
        self.components = n  # 連結成分の数

    def root(self, x):
        if self.p[x] != x:
            x_now = x
            while self.p[x_now] != x_now:
                x_now = self.p[x_now]
            self.p[x] = x_now
        return self.p[x]
    
    def unite(self, x, y):
        x, y = self.root(x), self.root(y)
        if x != y:
            self.p[x] = y
            self.components -= 1
    
    def same(self, x,y):
        return (self.root(x) == self.root(y))

N = int(input())
X, Y = [], []
for i in range(N):
    x, y = map(int,input().split())
    X.append([x, i])
    Y.append([y, i])

X.sort()
Y.sort()

edges = []
for i in range(N-1):
    edges.append([X[i+1][0]-X[i][0], X[i][1], X[i+1][1]])
    edges.append([Y[i+1][0]-Y[i][0], Y[i][1], Y[i+1][1]])
edges.sort()

UF = UnionFind(N)
ans = 0
for cost, s, t in edges:
    if UF.same(s,t): continue

    UF.unite(s,t)
    ans += cost
print(ans)

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

int main(){
    int i=0;
    int j=0;
    int max=0;
    char s[11];
    for(j=0;j<11;j++){
        s[j]='\0';
    }
    cin>>s;
    //cout<<s;
    for(int j=0; j<11; ++j){
        if(s[j]=='A'||s[j]=='G'||s[j]=='C'||s[j]=='T'){
            i++;
        }
        else{
            if(i>max){
                max=i;
            }
            i=0;
        }
    }
    cout<<max;

    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int N, K;
int d[128];
int A[128][128];

int aruyo[128];

int main(void) {
	int i, j;
	int count = 0;
	if (scanf("%d%d", &N, &K) != 2) return 1;
	for (i = 0; i < K; i++) {
		if (scanf("%d", &d[i]) != 1) return 1;
		for (j = 0; j < d[i]; j++) {
			if (scanf("%d", &A[i][j]) != 1) return 1;
			aruyo[A[i][j]] = 1;
		}
	}
	for (i = 1; i <= N; i++) {
		if (!aruyo[i]) count++;
	}
	printf("%d\n", count);
	return 0;
}


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


int main() {
    int a, b;
    cin >> a >> b;
    bool ans = false;
    for (int i = 1; i < 4; i++){
        if((a * b * i) % 2) ans = true;
    }
    if (ans) cout << "Yes" << endl;
    else cout << "No" << endl;
}


Measured memory_bytes: 3604
import sys

def rd():
        return sys.stdin.readline().rstrip()

N = int(rd())
A = [ int(x) for x in rd().split() ]

r = 1
d = 0
for i in range(1, len(A)):
        if A[i-1] == A[i]:
                continue
        elif A[i-1] < A[i]:
                if d < 0:
                        r += 1
                        d = 0
                else:
                        d = 1
        else:
                if d > 0:
                        r += 1
                        d = 0
                else:
                        d = -1
print r

Measured memory_bytes: 11864
#include <math.h>
#include <ctype.h>
#include <bits/stdc++.h>
using namespace std;
#define FOR(i, a, n) for (int i = a; i < n; i++)
#define REP(i, n) for(int i = 0; i < n; i++)
struct omt{omt(){ios::sync_with_stdio(false);cin.tie(0);}}star;

int main(){
    int n;
    cin >> n;
    vector<int> A(n);
    for(auto &x : A) cin >> x;

    unordered_map<int, int> mp;
    REP(i, n){
        mp[A[i]]++;
    }
    int cnt = 0;
    for(auto &x : mp){
        if(x.first < x.second){
            cnt += x.second - x.first;
        }else if(x.first > x.second){
            cnt += x.second;
        }
    }
    cout << cnt << endl;

    return 0;
}

Measured memory_bytes: 4644
/*-------------------------------"ANJAN AGARWALA"-----------------------------

         _/_/_/_/    _/_/    _/   _/_/_/_/   _/_/_/_/    _/_/    _/   
        _/    _/    _/ _/   _/         _/   _/    _/    _/ _/   _/        
       _/_/_/_/    _/   _/ _/         _/   _/_/_/_/    _/  _/  _/         
      _/    _/    _/    _/_/   _/    _/   _/    _/    _/    _/_/  
     _/    _/    _/      _/   _/_/_/_/   _/    _/    _/      _/   

-------------------------------------@anjn98---------------------------------*/

//#define opti
#ifdef opti
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("Ofast,unroll-loops,fast-math")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,tune=native")
#endif

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

typedef long long int ll;
typedef long long int LL;
typedef unsigned long long int ull;
ll power(ll x,ll y,ll p){ll r=1; x=x%p; while(y){ if(y&1) r= r*x%p; y=y>>1; x=x*x%p; } return r; }
/*
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;*/

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
int csrand(int l=0, int r=1e9){
    uniform_int_distribution<int> uid(l, r);
    return uid(rng);
}

#define IO              ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define FILEIO          freopen("input.txt", "r", stdin);freopen("output.txt", "w", stdout);
#define all(v)          v.begin(),v.end()
#define PR(a)           cout<<"("<<a<<")";
#define ED              cout<<'\n';
#define endl            '\n'
#define loop(j,a,n)     for(int j=a;j<=n;j++)
#define loop1(j,a,n)    for(int j=a;j>=n;j--)
#define fr1(j,n)        for(int j=0;j<n;j++)
#define fr(n)           for(int i=0;i<n;i++)
#define trav(x,s)       for(auto x:s)
#define SC(n)           scanf("%d",&n)
#define PB              push_back
#define MP              make_pair
#define pii             pair<int,int>
#define pll             pair<long long int,long long int>
#define F               first
#define S               second 
#define binf            2000000000000000001
#define mod             1000000007

const int N=3e3+99;
int n;
double dp[N][N],prob[N];
bool vis[N][N];
double solve(int i,int cnt)
{
    if(i==n+1)
        return cnt > n-cnt ?    1.0 :   0.0 ; 

    if(dp[i][cnt]!=-1) return dp[i][cnt];

    
    dp[i][cnt] =    prob[i]*solve(i+1,cnt+1)   +    (1.0-prob[i])*solve(i+1,cnt);

    return dp[i][cnt];
}

int main() 
{
    IO

    for(int i=0;i<N;i++)
        for(int j=0;j<N;j++) dp[i][j]=-1.0;
    
    cin>>n; 

    for(int i=1;i<=n;i++) cin>>prob[i];

    double ans=solve(1,0);
    
    cout<<fixed<<setprecision(10);
    cout<<ans<<endl;

}




 

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

#define ll   long long int
#define PI 3.14159265358979
#define zig ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);

using namespace std;


int main()
{
    zig
    string s, t;
    cin>>s;
    int n=s.length();
    for(int i=0; i<n; i++)
    {
        char a=s[i];
        if(a=='B')
        {
            s.erase(i, 1);
            n--;
            if(i)
            {
                s.erase(i-1,1);
                n--;
                i--;
            }
            i--;
        }

    }
    cout<<s;
    return 0;
}


Measured memory_bytes: 256
n, m = map(int, input().split())
s = input()
 
x = n
roulette = []
while x > m:
    for i in range(m, 0, -1):
        if s[x-i] == '0':
            x -= i
            roulette.append(i)
            break
    else:
        print(-1)
        exit()
roulette.append(x)
roulette.reverse()
print(' '.join(map(str, roulette)))

Measured memory_bytes: 87000
#include<cstdio>
#include<map>
#include<set>
using namespace std;

int main() {
  int n,t;
  while(scanf("%d", &n), n) {
    map<int,int> m;
    for(int i=0; i<n; ++i) {
      scanf("%d", &t);
      m[t]++;
    }

    int ans = -1;
    for(map<int,int>::iterator it = m.begin(); it != m.end(); ++it)
        if(it->second > (n/2)) ans = it->first;

    if(ans == -1) puts("NO COLOR");
    else printf("%d\n", ans);
  }
}

Measured memory_bytes: 1848
#include<bits/stdc++.h>
typedef long long ll;
typedef long double ld;
#define FASTIO ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define PRECISION std::cout << std::fixed << std::setprecision(20);
  
using namespace std;
 
const ll inf = 1e18;
const ll N = 3e5+100;
const ll bits = 20;
const ld pi = 3.14159265358979323846;
const ll mod = 1e9+9;
const ll p = 29;



int main(){
    FASTIO;
    PRECISION; 

    int n,m;
    cin>>n>>m;

    vector<int>arr(n);
    int sum = 0;
    for(int i=0;i<n;i++){
        cin>>arr[i];
        sum+=arr[i];
    }

    int taken = 0;

    for(int i=0;i<n;i++){
        if(arr[i]*4*m>=sum){
            taken++;
        }
    }

    if(taken>=m){
        cout<<"Yes\n";
    }else{
        cout<<"No\n";
    }
    
 
}

Measured memory_bytes: 256
#include<stdio.h>
int main(){
  int n, m, i, j;
  char a[1000], b[1000];
  while(1){
    scanf("%d",&n);
    if(n == 0)return 0;
    for(i = 0;i < n;i++){
      scanf(" %c %c",a + i, b + i);
    }
    scanf("%d", &m);
    for(i = 0;i < m;i++){
      char c;
      scanf(" %c",&c);
      for(j = 0;j < n;j++){
	if(c == a[j]){
	  c = b[j];
	  break;
	}
      }
      printf("%c",c);
    }
    printf("\n");
  }
}

Measured memory_bytes: 572
#include<iostream>
#include<algorithm>
using namespace std;
string output[2] = {"No\n", "Yes\n"};
int main(){
  int e[3];
  for(int i = 0;i < 3;++i)cin >> e[i];
  sort(e, e + 3);
  cout << output[e[0] == e[2] and e[0] > 0];
}

Measured memory_bytes: 256
pi = Math::PI

a, b, h, m = gets.split.map(&:to_i)

hd = 2 * pi / 12 * h + (2 * pi / 12 / 60 * m)
md = 2 * pi / 60 * m


c2 = a * a + b * b - 2 * a * b * Math.cos(hd - md)
print Math.sqrt(c2)


Measured memory_bytes: 14644
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <string>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <stdio.h>
using namespace std;
#define int long long
int MOD = 1000000007;
signed main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int N, D;
	cin >> N >> D;
	int res = (N + 2 * D) / (2 * D + 1);
	cout << res << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <set>

using namespace std;

int N;
long long int H, W;
long long int a[100005], b[100005];

long long int C[10];

set<pair<long long int,long long  int> > S;

bool CHECK(long long int C1, long long int C2) {
	if (2 <= C1 && C1 <= H - 1 && 2 <= C2 && C2 <= W - 1) {
		return true;
	}
	return false;
}

void FUNC(long long int C1, long long int C2) {

	int count = 0;

	for (int i = -1; i <= 1; i++) {
		for (int j = -1; j <= 1; j++) {
			if (S.count(pair<long long int, long long int>(C1 + i, C2 + j)) > 0) { count++; }
		}
	}

	C[count]++;

}

int main(void) {
	cin >> H >> W >> N;

	long long int tmp;
	for (int i = 1; i <= N; i++) {
		cin >> tmp; a[i] = tmp;
		cin >> tmp; b[i] = tmp;
	}

	long long int TOTAL = (H - 2)*(W - 2);

	for (int i = 1; i <= N; i++) {
		S.insert(pair<long long int, long long int>(a[i], b[i]));
	}

	for (int i = 1; i <= N; i++) {
		for (int m = -1; m <= 1; m++) {
			for (int n = -1; n <= 1; n++) {
				long long int C1 = a[i] + m;
				long long int C2 = b[i] + n;
				if (CHECK(C1, C2)) { FUNC(C1, C2); }
			}
		}
	}

	for (int i = 1; i <= 9; i++) {
		C[i] /= i;
	}

	C[0] = TOTAL;
	for (int i = 1; i <= 9; i++) {
		C[0] -= C[i];
	}
	for (int i = 0; i <= 9; i++) {
		cout << C[i] << endl;
	}
	//system("pause");
	return 0;
}

Measured memory_bytes: 8064
#include <stdio.h>
int main(){

  int A,B;
  char a,b;

  scanf("%c %c",&a,&b);

  if(a == 'H') A=1;
  else A=-1;

  if(b == 'D') B=1;
  else B=-1;

  if(A*B == 1) printf("D\n");
  else printf("H\n");

  return 0;

}






Measured memory_bytes: 128
n=int(input())
a=[int(i) for i in input().split()]

import collections
c=collections.Counter(a)
l=len(c)
ans=1

for i in range((n-1)%2,n,2):
    if i==0:
        if c[0]!=1:
            ans=0
    elif c[i]==2:
        ans*=2
    else:
        ans=0
    ans=ans%(10**9+7)


print(ans)




Measured memory_bytes: 14692
#include <bits/stdc++.h>
using namespace std;
using lli=long long int;
using vi=vector<int>;  using vs=vector<string>; using gi=greater<int>;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define soao(c) sort((c).begin(),(c).end()) //昇順
#define sodo(c) sort((c).begin(),(c).end(),gi()) //降順
#define rev(c) reverse((c).begin(), (c).end())


int main(){
    int count=0;
    int n,m; cin>>n>>m;
    vi a(n); rep(i,n) cin>>a.at(i);
    int all=0; rep(i,n) all+=a.at(i);
    int lim=(all+(4*m)-1)/(4*m);

    sodo(a);

    rep(i,n){
        if(a.at(i)>=lim) count++;
        else break;
    }

    if(count>=m) cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
//#include<iostream>
using namespace std;
//type
typedef long long ll;
#define pii pair<int, int>
#define vi vector<int>
//x * y * 1.0 can cause overflow
//constant
#define inf (int)(1e9+7)
#define mod (ll)(1e9+7)
#define eps 1e-10
//omission
#define eb emplace_back
#define F first
#define S second
#define SZ(x) ((int)(x).size())
#define all(v) v.begin(), v.end()
#define ios cin.tie(0); ios::sync_with_stdio(false)
#define FIX(a) cout << fixed << setprecision(a)
#define mp make_pair
//manip
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a = b; return 1; } return 0; }
#define UNIQUE(v) v.erase(unique(v.begin(), v.end(), v.end());
#define fill(x, y) memset(x, y, sizeof(x))
#define ceil(a, b) a / b + !!(a % b)
template<class T> T power_mod(T a, T b) {return b ? power(a * a % inf, b / 2) * (b % 2 ? a : 1) % inf : 1;}
template<class T> T power(T a, T b) {return b ? power(a * a, b / 2) * (b % 2 ? a : 1) : 1;}
#define LB(v, x) (int)(lower_bound(v.begin(), v.end(), x) - v.begin())
#define UB(v, x) (int)(upper_bound(v.begin(), v.end(), x) - v.begin())
template<typename T> T gcd(T a, T b) {if (b == 0) return a; return gcd(b, a % b);}
template<typename T> T lcm(T a, T b) {return a / gcd(max(a, b), min(a, b)) * b;} //先に割る!!
#define outa(a, n) rep(i_, n) cout << a[i_] << " "; cout << endl
#define out(a) cout << a << endl
#define outv(v) rep(i, SZ(v)) cout << v[i] << " "; cout << endl
//loop
#define rep(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i)
#define rep3(i, st, n) for (int i = st; i < n; ++i)
//algorithm
//double pointer, l start, how many adds, can be 0 -> init r = l, sum = 0
//bfs, not x, y, i, j
//not !(i % 2), i % 2 == 0
//minimal required terms
//cast caution
//look constraints always



int main() {
    
    
    
    int d, e;
    while (cin >> d >> e && d) {
        double mincost = inf;
        rep(x, 100 + 1) rep(y, 100 + 1) {
            if (x + y != d) continue;
            chmin(mincost, abs(sqrt(x * x + y * y) - e));
        }
        out(mincost);
    }
}




Measured memory_bytes: 3240
MOD = 10**9+7
n,a,b=map(int, input().split())
ca = 1
cb = 1
for i in range(n-a+1,n+1):
    ca *= i
    ca%=MOD
for i in range(1,a+1):
    ca *= (pow(i,MOD-2,MOD))
    ca%=MOD
for i in range(n-b+1,n+1):
    cb *= i
    cb%=MOD
for i in range(1,b+1):
    cb*=(pow(i,MOD-2,MOD))
    cb%=MOD
print((pow(2,n,MOD)-1-ca-cb)%MOD)


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

int bubbleSort(int M,vector<int> &A){
  bool flag = true;
  int s = 0;
  
  while(flag){
    flag = false;
    for(int j=M-1;j>=1;--j){
      if(A.at(j) < A.at(j-1)){
        swap(A.at(j),A.at(j-1));
        s += 1;
        flag = true;
      }
    }
  }
  return s;
}
int main(){
  int N;
  int cnt;
  
  cin >> N;
  vector<int> vec(N);
  for(int i=0;i<N;++i){
    cin >> vec.at(i);
  }

  cnt = bubbleSort(N,vec);
  for(int i=0;i<N-1;++i){
  cout << vec.at(i) << " ";
  }
  cout << vec.at(N-1) << endl;
  cout << cnt << endl;
}



Measured memory_bytes: 3084
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <sstream>

using namespace std;

int main()
{
	long long n,ans = 0;

	cin >> n;

	vector<long long> a(n);

	for (long long i = 0; i < n; i++)
		cin >> a[i];

	sort(a.begin(),a.end());

	for (long long i = 0; i < n-1; i++)
	{
		ans += a[i + 1] - a[i];
	}

	cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define mp make_pair
#define pb(x) push_back(x)
#define vi vector<int>
#define vs vector<string>
#define vll vector<long long>
#define vc vector<char>
#define vs vector<string>
#define pii pair<int, int>
#define pll pair<long long, long long>
#define pil pair<int, long long>
#define pli pair<long long, int>
#define pcc pair<char, char>
#define pdd pair<double, double>
#define mll map<long long, long long>
#define sz(v) ((int)(v).size())
#define all(v) (v).begin(), (v).end()
#define flsh fflush(stdout)
#define gcd __gcd
#define clr(x) memset(x, 0, sizeof(x))
#define mod 1000000007LL
#define INF 1000000000007
 

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

void solve()
{
    ll l;
    cin>>l;
    // a+b+c = l, maximize (a*b*c);
    ld la = 1.0*l;
    la/=3;
    ld res = la*la*la;
    cout<<fixed<<res<<"\n";
}


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


if (fopen("input.txt","r" ))
  {
     freopen("input.txt", "r", stdin);
     freopen("output.txt", "w", stdout);
  }
cout<<setprecision(20);


ll t=1;


// cin>>t;


while(t--)
{
solve();
} 


return 0;
}

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

using namespace std;
using ll = long long;
const double pi = acos(-1);
#define FOR(i,a,b) for (ll i=(a),__last_##i=(b);i<__last_##i;i++)
#define RFOR(i,a,b) for (ll i=(b)-1,__last_##i=(a);i>=__last_##i;i--)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define __GET_MACRO3(_1, _2, _3, NAME, ...) NAME
#define rep(...) __GET_MACRO3(__VA_ARGS__, FOR, REP)(__VA_ARGS__)
#define rrep(...) __GET_MACRO3(__VA_ARGS__, RFOR, RREP)(__VA_ARGS__)
template<typename T> ostream& operator<<(ostream& os, const vector<T>& v) {
	REP(i, v.size()) { if (i)os << " "; os << v[i]; }return os;
}
template<typename T> ostream& operator<<(ostream& os, const vector<vector<T>>& v) {
	REP(i, v.size()) { if (i)os << endl; os << v[i]; }return os;
}

const ll INF = 1LL << 60;

int main() {
	ll x, a, b;

	cin >> x >> a >> b;

	cout << (x - a) % b << endl;
}

Measured memory_bytes: 256
#include<stdio.h>

int main(void)
{
    for(int i = 0; i < 3000; i++){
        int x, y, t;
        scanf("%d %d", &x, &y);
        if(x == 0 && y == 0) break;
        else if(x > y){
            t = x; x = y; y = t;
        }
        printf("%d %d\n", x, y);
    }
    return 0;
}


Measured memory_bytes: 1972
#include<iostream>
    #include<vector>
    #include<math.h>
    using namespace std;
    #define ll unsigned long long int
     
    int main(){
        ll n, ans=0;
        cin>>n;
        vector<int>sum(n+1);
        
        for(int i=1;i<=n;i++){
            for(int j=1;i*j<=n;j++){
                sum[i*j]++;
            }
        }
        for(int i=1;i<=n;i++){
            ans+=sum[i]*i;
        }
        cout<<ans<<endl;
        return 0;
    }

Measured memory_bytes: 41956
/*
Author: Racer5x
 ***************************************   UNAUTHORISED COPYING OF CODE PROHIBITED   **********************************
*/
 
// #pragma GCC optimize("O3")
// #pragma GCC optimize("Ofast")
// #pragma GCC optimize("unroll-loops")
// #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
 
#include<bits/stdc++.h>
#define int         long long
#define double      long double
#define pb          emplace_back
#define pf          emplace_front
#define pii         pair<int,int>
#define vi          vector<int>
#define vii         vector<pii>
#define mi          map<int,int>
#define mii         map<pii,int>
#define all(a)      (a).begin(),(a).end()
#define rall(a)     (a).rbegin(),(a).rend()
#define x           first
#define y           second
#define endl        '\n'
#define hell        998244353 
#define PI          3.141592653589
#define tezz        ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define MAX         2000000000000000000
#define M           1000000007
using namespace std;

vi prime;
bool table[1000005] = {false};

void seive(){
    for(int i=2;i<1000005;i++){
        if(!table[i]){
            // cout<<i<<" --> ";
            table[i] = true;
            prime.pb(i);
            for(int j=i*i;j<1000005;j+=i){
                table[j] = true;
                //cout<<'t';
            }
        }
    }
}
 
signed main()
{
    tezz
    
    int n;
cin>>n;
int a[n+1];
int b[n+1];
for(int i=0;i<n;i++)
   {
       cin>>a[i];
   }

   for(int i=1;i<=n;i++)
     {
         if(a[i-1]==i)
          b[i-1]=i;

          else
          b[a[i-1]-1]=i;

    }
    for(int i=0;i<n;i++)
      {
          cout<<b[i]<<' ';
      }
} 

Measured memory_bytes: 2432
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define dunk(n) cout << n << endl
#define all(v) v.begin(), v.end()


int main() {
    int n;
    cin >> n;
    vector<int> a(n);
    rep(i,n) cin >> a.at(i);
    rep(i,n) a.at(i)--;
    
    vector<long long> cnt(n);
    rep(i,n) cnt.at(a.at(i))++;
    
    long long total = 0;
    rep(i,n) total += cnt.at(i)*(cnt.at(i)-1)/2;
    
    vector<long long> ans(n);
    rep(i,n) ans.at(i) = total - (cnt.at(i)-1);
    
    rep(i,n) dunk(ans.at(a.at(i)));
    
    return 0;
}



Measured memory_bytes: 6528
#include <bits/stdc++.h>
#define REP(i, n) for(ll i = 0; i < n; i++)
#define REPR(i, n) for(ll i = n - 1; i >= 0; i--)
#define FOR(i, m, n) for(ll i = m; i <= n; i++)
#define FORR(i, m, n) for(ll i = m; i >= n; i--)
#define SORT(v, n) sort(v, v+n)
#define MAX 100000
#define inf 1000000007
using namespace std;
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
using P = pair<ll, ll>;

ll n, m, x, ans;

void isSkill(ll bit, vvll a){//この組の理解度を算出
    bool flag = true;
    vll now(m+1, 0);
    ll money = 0;
    REP(i, n){
        if (bit & 1 << i){//  そのbitが1ならば
            FOR(j, 1, m) now[j] += a[i+1][j];
            money += a[i+1][0];
        }
    }
    FOR(i, 1, m){//今回の組がいけているか判断
        if (now[i] < x){
            flag = false;
            break;
        }
    }
    if(flag) ans = min(ans, money);
    return;
}

int main() {
    //cin高速化
    cin.tie(0);
    ios::sync_with_stdio(false);
    cin >> n >> m >> x;
    ans = inf;
    vvll a(n+1, vll(m+1, 0));
    //input
    FOR(i, 1, n) REP(j, m+1) cin >> a[i][j];
    //bit full search
    REP(bit, 1 << n){
        isSkill(bit, a);
    }

    if(ans == inf) ans = -1;
    cout << ans <<"\n";
	return 0;
}

Measured memory_bytes: 3664
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) REP(i,0,n)
#define REP(i,s,e) for(int i=(s); i<(int)(e); i++)
#define repr(i, n) REPR(i, n, 0)
#define REPR(i, s, e) for(int i=(int)(s-1); i>=(int)(e); i--)
#define pb push_back
#define all(r) r.begin(),r.end()
#define rall(r) r.rbegin(),r.rend()
#define fi first
#define se second

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

const ll INF = 1e18;
const ll MOD = 1e9 + 7;
const double EPS = 1e-8;

template<typename T> T chmax(T& a, const T& b){return a = (a > b ? a : b);}
template<typename T> T chmin(T& a, const T& b){return a = (a < b ? a : b);}

int cnt[10][10];

int main() {
    int n;
    cin >> n;
    REP(i, 1, n+1) {
        int a = i % 10;
        int b = i;
        while(b >= 10) b /= 10;
        cnt[a][b]++;
    }
    ll ans = 0LL;
    rep(i, 10) rep(j, 10) {
        ans += (ll)cnt[i][j] * cnt[j][i];
    }
    cout << ans << endl;
    // rep(i, 10) rep(j, 10) {
    //     cout << cnt[i][j] << (j+1 == 10 ? '\n' : ' ');
    // }
}

Measured memory_bytes: 256
import java.util.*;

public class Main{
  public static void main(String[] main){
    Scanner sc = new Scanner(System.in);
    int M1 = sc.nextInt();
    int D1 = sc.nextInt();
    int M2 = sc.nextInt();
    int D2 = sc.nextInt();
    
    if (D2==1){
      System.out.println("1");
    }else{
      System.out.println("0");
    }
  }
}

Measured memory_bytes: 35744