akhauriyash/Code-Regression huggingface dataset:
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
const int INF = (1<<30);
const ll INFLL = (1ll<<60);
const ll MOD = (ll)(1e9+7);

#define l_ength size

void mul_mod(ll& a, ll b){
	a *= b;
	a %= MOD;
}

void add_mod(ll& a, ll b){
	a = (a<MOD)?a:(a-MOD);
	b = (b<MOD)?b:(b-MOD);
	a += b;
	a = (a<MOD)?a:(a-MOD);
}

struct shop{
	int index;
	int point;
	string name;
	shop(const int &i, const int &p, const string &s):index(i),point(p),name(s){
	}
	bool operator< (const shop &rhs){
		return (name==rhs.name)?(point>rhs.point):(name<rhs.name);
	}
};

ostream& operator <<(ostream& o, const shop &rhs){
	o << (rhs.index+1);
	return o;
}

vector<shop> v;

int main(void){
	int n,p,i;
	string s;
	cin >> n;
	for(i=0; i<n; ++i){
		cin >> s >> p;
		v.emplace_back(i,p,s); //not iPS cell
	}
	sort(v.begin(),v.end());
	for(i=0; i<n; ++i){
		cout << v[i] << endl;
	}
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,n) for(int i=1;i<n;i++)
#define P pair<int,int>
#define int long long
#define mod (int)(1e9+7)
#define inf (int)(3e18)
#define all(v) v.begin(),v.end()
#define prique(T) priority_queue<T,vector<T>,greater<T>>
using namespace std;

template<class T> inline void chmax(T &a, T b) {
	a = std::max(a, b);
}
template<class T> inline void chmin(T &a, T b) {
	a = std::min(a, b);
}

int mod_pow(int x, int y, int m = mod) {
	int res = 1;
	while (y) {
		if (y % 2) {
			res *= x;
			res %= m;
		}
		x = x * x % mod;
		y /= 2;
	}
	return res;
}

int N;
int A[55], B[55];
signed main() {
	cin >> N;
	rep(i,N)
		cin >> A[i];
	bool dif = false;
	rep(i,N)
	{
		cin >> B[i];
		dif |= A[i] != B[i];
	}
	int ans = 0ll;
	vector<int> must;
	for (int i = 50; i >= 0; i--) {
		bool okflag = true;
		rep(j,N)
		{
			bool can[55];
			rep(k,55)
				can[k] = false;
			can[A[j]] = true;
			for (int k : must) {
				rep(l,51)
				{
					can[l % k] |= can[l];
				}
			}
			for (int k = i; k > 0; k--) {
				rep(l,51)
				{
					can[l % k] |= can[l];
				}
			}
			if (!can[B[j]]) {
				okflag = false;
				break;
			}
		}
		if (!okflag) {
			if (i == 50) {
				cout << -1 << endl;
				return 0;
			}
			ans += 1ll << (i + 1);
			must.push_back(i + 1);
		}
	}
	cout << ans << endl;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
int isprime(int n)
{
  for(int i=2;i*i<=n;i++)
  {
    if(n%i==0)
	return 0;
  }
  
  
  return 1;
}
int main()
{
  int n;
  cin>>n;
  if(n<4)
  {
    cout<<n<<endl;
    
    return 0;
  }
  for(int i=n;i<1000000000;i++)
  {
    if(isprime(i))
    {
      cout<<i<<endl;
      break;
    
	}
  }
  return 0;
}

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

int main(int argc, char *argv[]) { ios::sync_with_stdio(false);cin.tie(nullptr);cout.tie(nullptr);

  ll t;cin>>t;
  vector<int> p;
  while(1){
    t--;
    p.push_back(t % 26);
    t/=26;
    if(!t)break;
  }
  for(int i=p.size()-1;i>=0;i--){
    char c = 'a'+p[i];
    cout<<c;
  }
  cout<<endl;
  
  return 0;
}


Measured memory_bytes: 3624
#include <bits/stdc++.h>
#define pb push_back
#define fi first
#define se second
#define mp make_pair
using namespace std;

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

const int MAXN = 1e5 + 1;
const int MOD = 1000000007;

int mem[2000][666];

int sum(int a, int b){
    return (a%MOD + b%MOD)%MOD;
}

int f(int x, int y){
    if (mem[x][y] != -1) return mem[x][y];
    if (y == 1) return mem[x][y] = 1;
    if (x == 0) return mem[x][y] = 1;
    int ret = 0;
    for (int i = 0; i <= x; i++) ret = sum(ret, f(x-i, y-1));
    return mem[x][y] = ret;
}

int s;
int sol;

int main(){

    memset(mem, -1, sizeof mem);

    cin >> s;
    for (int i = 1; i <= s/3; i++){
        sol = sum(sol, f(s-(i*3), i));
    }

    cout << sol;

    return 0;

}


Measured memory_bytes: 8836
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <algorithm>

using namespace std;

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

    vector <int> V(N);
    vector <int> R(N);
    for (int i = 0; i < N; i++){
        cin >> V[i];
        R[N - 1 - i] = V[i];
    }

    int ans = 0;
    // 左からi個、右からj個とって、k個返すとき

    for (int i = 0; i < N; i++){
        for (int j = 0; i + j <= min(N, K); j++){
            int sum = 0;
            vector <int> minus;
            int count = 0;
            for (int k = 0; k < i; k++){
                sum += V[k];
                if (V[k] < 0){
                    minus.push_back(V[k]);
                    count ++;
                }    
            }

            for (int k = 0; k < j; k++){
                sum += R[k];
                if (R[k] < 0){
                    minus.push_back(R[k]);
                    count ++;
                }
            }

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

            for (int k = 0; k < min(count, K - (i + j)); k++){
                sum -= minus[k];
            }
            
            if (ans < sum){
                ans = sum;
            }
        }
    }
    
    cout << ans << endl;
    
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int INF = 0x3f3f3f3f;

int main() {
	ll n, m, s ;
	cin >> n >> m;
	if(n * m % 2 == 0) s = n * m / 2;
	else s = n * m / 2 + 1;
	if(n == 1 || m == 1) s = 1;	
	cout << s << endl;
}


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

int main(void){
    long long int n,a,b,c,sum=0;
    cin>>n>>a>>b;
    if(n%(a+b)<=a)sum+=n%(a+b);
    else sum+=a;
    b=n/(a+b);
    sum+=a*b;
    cout<<sum<<endl;
}

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

using namespace std;

using ll = long long;
using ull = unsigned long long;
using ld = long double;
#define all(a) (a).begin(),(a).end()

template<typename T1, typename T2> inline void chkmin(T1 & x, const T2 & y) {if (y < x) x = y;}
template<typename T1, typename T2> inline void chkmax(T1 & x, const T2 & y) {if (x < y) x = y;}
#define int ll
int n, d;
int ans = 0;

void read() {
	cin >> n;
	if (n >= 30) {
		cout << "Yes\n";
	} else {
		cout << "No\n";
	}
}

void run() {

}

void write() {

}

signed main() {
	ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0), cout.precision(20), cout.setf(ios::fixed);
	read();
	run();
	write();
	return 0;
}

Measured memory_bytes: 3624
#include <algorithm>
#include <iostream>
#include <map>
#include <numeric>
#include <set>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#include <queue>
#define MOD (1000000007l)

using namespace std;

long N, M;
unordered_map<long, unordered_set<long>> neibor;
long result = 0;

void solve(unordered_set<long> visited, long current) {
  if (visited.size() == N) {
    result ++;
    return;
  }
  for (long n: neibor[current]) {
    if (visited.count(n) > 0) continue;
    unordered_set<long> tmp = visited;
    tmp.insert(n);
    solve(tmp, n);
  }
}

int main(void) {
  cin >> N >> M;
  for (long i = 0; i < M; i++) {
    long a, b;
    cin >> a >> b;
    neibor[a].insert(b);
    neibor[b].insert(a);
  }
  unordered_set<long> visited;
  visited.insert(1);
  solve(visited, 1);
  cout << result << endl;
  return 0;
}


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

#define ll long long
#define endl "\n"
#define pb push_back
#define mp make_pair
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);

const int mod = 1000000007;


void solve() {

	ll n, k;
	cin >> n >> k;
	ll a[n];
	bool allneg = true;
	bool zero = false;

	for (ll i = 0; i < n; i++) {
		cin >> a[i];
		if (a[i] > 0) {
			allneg = false;
		}
		if(a[i] == 0){
			zero = true;
		}
	}
	sort(a, a + n);

	ll s = 0;
	ll e = n - 1;
	ll pairs = k / 2;
	bool odd = false;
	if (k % 2 != 0) {
		odd = true;
	}
	ll ans = 1;
	if (!allneg) {
		if(odd){
			ans = ans * a[e];
			e--;
			ans = (ans+mod)%mod;
		}
		//cout << ans << endl;
		while (s<e and pairs > 0) {
			//cout << ans << endl;
			if (a[s]*a[s + 1] < a[e]*a[e - 1]) {
				ans *= ((a[e] * a[e - 1])+mod)%mod;
				ans = (ans%mod+mod)%mod;
				pairs--;
				e = e - 2;
			} else {
				ans *= ((a[s] * a[s + 1])+mod)%mod;
				ans = (ans%mod+mod)%mod;
				pairs--;
				s = s + 2;
			}
		}

	}else{
		if(!odd){
			//cout << ans << endl;
			for(int i = 0;i < k;i++){
				ans = ans * a[i];
				ans = (ans%mod+mod)%mod;
				//cout << ans << endl;
			}
		}else{
			for(int i = n-1;i>=n-k;i--){
				ans = ans * a[i];
				ans = (ans%mod+mod)%mod;
			}

		}
	}
	cout << ans;




}


int32_t main()
{

	IOS

	int T;
	T = 1;
	//cin >> T;
	while (T--) {
		solve();
	}




}


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

#define ff first
#define ss second
#define PI acos(-1)
#define pb push_back
#define int long long
#define ld long double
#define sp fixed<<setprecision
#define bp __builtin_popcountll
#define all(x) x.begin(),x.end()
#define pii pair<long long,long long>
#define FAST ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);

const int M = (1e9)+7;
const int N = 1e6+5;

signed main()
{
    FAST
    int tc=1;
    //cin>>tc;
    for(int ti=1;ti<=tc;ti++)
    {
        int n,k;
        cin>>n>>k;
        int p[n+1],cc[n+1];
        for(int i=1;i<=n;i++)cin>>p[i];
        for(int i=1;i<=n;i++)cin>>cc[i];
        int ans = -1e18-1;
        for(int i=1;i<=n;i++)
        {
            int vis[n+1] = {};
            vector<int> v;
            int c = i,ind = 1;
            while(1)
            {
                if(vis[p[c]])
                {
                    ind = vis[p[c]];
                    break;
                }
                vis[p[c]] = ind++;
                v.pb(p[c]);
                c = p[c];
            }
            ind--;
            //cout<<ind<<"--";
            //for(int x:v)cout<<x<<" ";cout<<"--";
            int tk = k,tans = 0,m = v.size(),sum = 0,cyc = 0;
            for(int j=0;tk && j<ind;j++,tk--)tans += cc[v[j]],ans = max(ans,tans);
            for(int j=ind;j<m;j++,cyc++)sum += cc[v[j]];
            if(sum > 0)
            {
                for(int j=ind;tk && j<m;j++,tk--)
                {
                    tans += cc[v[j]];
                    ans = max(ans,tans + ((tk-1)/cyc)*sum);
                }
                //tans += (tk/cyc)*sum;
                //tk %= cyc;
                //for(int j=ind;tk && j<m;j++,tk--)tans += cc[v[j]],ans = max(ans,tans);
            }
            else for(int j=ind;tk && j<m;j++,tk--)tans += cc[v[j]],ans = max(ans,tans);
            //cout<<tans<<endl;
        }
        cout<<ans<<endl;
    }
    return 0;
}


Measured memory_bytes: 3852
#include <iostream>
#include <cstdint>
#include <cmath>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <algorithm>
#include <iomanip>
#include <sstream>

int main(void)
{
    int64_t N;
    std::cin >> N;

    int64_t max = 0;
    int64_t count = 0;
    int64_t p_h = 0;
    for (int64_t i = 0; i < N; ++i) {
        int64_t h;
        std::cin >> h;
        if (p_h >= h) {
            count++;
            if (max < count) max = count;
        } else {
            count = 0;
        }
        p_h = h;
    }

    std::cout << max << std::endl;

    return 0;
}

Measured memory_bytes: 256
use std::io::*;

fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}

fn read_spc<T: std::str::FromStr>() -> Vec<T> {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().split_whitespace()
        .map(|e| e.parse().ok().unwrap()).collect()
}

fn main() {
    chocolate();
}

fn chocolate() {
    let n: i64 = read();
    let dx: Vec<i64> = read_spc();
    let d = dx[0];
    let mut x = dx[1];
    let mut a: Vec<i64> = vec![];
    for i in 0..n {
        let mut ai: i64 = read();
        a.push(ai);
    }
    for ai in a {
        x += (d - 1) / ai + 1;
    }
    println!("{}", x);
}

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

public class Main {

  public static void main(String[] args) {
    resolve(System.in, System.out);
  }

  static void resolve(InputStream is, PrintStream pw) {
    Scanner sc = new Scanner(is);
    int a = Integer.parseInt(sc.next());
    int b = Integer.parseInt(sc.next());
    int c = Integer.parseInt(sc.next());
    if (a + b + c >= 22) {
      pw.println("bust");
    } else {
      pw.println("win");
    }
  }
}


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

int main() {
    int n;
    int m;
    int sum = 0;
    scanf("%d %d", &n, &m);
    int arr[n];
    for(int i = 0; i < n; i++){
        scanf("%d", &arr[i]);
        sum += arr[i];
    }
    double vote_lim = (double)sum / (4 * m);
    int count_m {0};
    for(int i = 0; i < n; i++) {
        if(arr[i] >= vote_lim){
            count_m++;
        }
    }
    if(count_m >= m) printf("Yes\n");
    else printf("No\n");
    return 0;
}


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

int gcd(int x, int y)
{
    if (x < y)
        return gcd(y, x);
    if (y == 0)
        return x;
    else
        return gcd(y, x % y);
}
int main()
{
    long a, b, c, d;
    cin >> a >> b >> c >> d;
    long count = 0;
    if (a % c == 0 || a % d == 0)
    {
        count = (b / c + b / d - b / (c * d / gcd(c, d))) - (a / c + a / d - a / (c * d / gcd(c, d))) + 1;
    }
    else
    {
        count = (b / c + b / d - b / (c * d / gcd(c, d))) - (a / c + a / d - a / (c * d / gcd(c, d)));
    }
    cout << b - a + 1 - count << endl;
    return 0;
}


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

using namespace std;

class UnionFind {
 public:
	vector < int >parent;

	 UnionFind(int n) {
		parent = vector < int >(n, -1);
	} int root(int a) {
		if (parent[a] < 0) {
			return a;
		}
		return parent[a] = root(parent[a]);
	}

	int size(int a) {
		return -parent[root(a)];
	}

	bool connect(int a, int b) {
		a = root(a);
		b = root(b);
		if (a == b) {
			return false;
		}
		if (size(a) < size(b)) {
			swap(a, b);
		}

		parent[a] += parent[b];
		parent[b] = a;

		return true;
	}
};

int main()
{

	int n, m;
	cin >> n >> m;
	vector < int >a(m), b(m);
	for (int i = 0; i < m; i++) {
		cin >> a[i] >> b[i];
		a[i]--;
		b[i]--;
	}
	vector < long long >ans(m);
	ans[m - 1] = (long long)n *(n - 1) / 2;

	UnionFind uni(n);

	for (int i = m - 1; i >= 1; i--) {
		ans[i - 1] = ans[i];
		if (uni.root(a[i]) != uni.root(b[i])) {
			ans[i - 1] -=
			    (long long)uni.size(a[i]) * uni.size(b[i]);
			uni.connect(a[i], b[i]);
		}
	}

	for (int i = 0; i < m; i++) {
		cout << ans[i] << endl;
	}

	return 0;
}


Measured memory_bytes: 3328
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("unroll-loops")

#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <fstream>
#include <sstream>
#include <set>
#include <map>
#include <vector>
#include <list>
#include <algorithm>
#include <cstring>
#include <cmath>
#include <string>
#include <queue>
#include <bitset>		//UWAGA - w czasie kompilacji musi byc znany rozmiar wektora - nie mozna go zmienic
#include <cassert>
#include <iomanip>		//do setprecision
#include <ctime>
#include <complex>
#include <chrono>
#include<unordered_map>
using namespace std;

#define FOR(i,b,e) for(int i=(b);i<(e);++i)
#define FORQ(i,b,e) for(int i=(b);i<=(e);++i)
#define FORD(i,b,e) for(int i=(b)-1;i>=(e);--i)
#define REP(x, n) for(int x = 0; x < (n); ++x)
#define ALL(u) (u).begin(),(u).end()

#define ST first
#define ND second
#define PB push_back
#define MP make_pair
#define LL long long
#define ULL unsigned LL
#define LD long double

typedef pair<int, int> PII;
typedef pair<LL, LL> PLL;
typedef tuple<int, int, int> TIII;
typedef vector<int> VI;

const double pi = 3.141592653589793238462643383279502884197169399375105820974944592307816406286208998628034825342;

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

const int MOD = 998244353;
const int MR = 3010;

int dp[MR][MR];

int main()
{
    fast_io();

    int A, B, C, D;
    scanf("%d%d%d%d", &A, &B, &C, &D);

    dp[A][B] = 1;
    FORQ(i, A + 1, C)
        dp[i][B] = B * (LL)dp[i - 1][B] % MOD;
    FORQ(i, B + 1, D)
        dp[A][i] = A * (LL)dp[A][i - 1] % MOD;
    FORQ(i, A + 1, C)FORQ(j, B + 1, D)
        dp[i][j] = (dp[i - 1][j] * (LL)j % MOD + dp[i][j - 1] * (LL)i%MOD - dp[i - 1][j - 1] * (LL)(i - 1) % MOD*(j - 1) % MOD + MOD) % MOD;

    printf("%d\n", dp[C][D]);

    return 0;
}

// FOR GNU C++ use the following pattern:
// Uncomment the code below and change your main into main2
// It does not build in MS C++
// But it does increase the stack size from 256 MB on CF and uses GNU C++

//#include <Processthreadsapi.h>
//#include <iostream>
//#include <Synchapi.h>
//#include <windows.h>
//#include <process.h>
//
//DWORD WINAPI MyThreadFunction(LPVOID lpParam) {
//    main2(nullptr);
//    return 0;
//}
//int main() {
//    auto h = CreateThread(nullptr, 1024 << 20, MyThreadFunction, nullptr, STACK_SIZE_PARAM_IS_A_RESERVATION, nullptr);
//    WaitForSingleObject(h, INFINITE);
//}

Measured memory_bytes: 38328
#include<iostream>
#include<vector>
#include<cstring>
#include<map>
using namespace std;
#define REP(i,n) for(int i=0;i<(int)(n);i++)
typedef pair<int, int> P;
typedef long long int lli;
struct edge { int to; lli cap, cost; int rev; };

const lli VMAX = 4000, INF = 1e7;

int N, V;
vector<edge> G[VMAX];
lli dist[VMAX];
int prevv[VMAX], preve[VMAX];
map<int, int> widths;

void add_edge(int from, int to, lli cap, lli cost) {
  G[from].push_back((edge){to, cap, cost, (int)G[to].size()});
  G[to].push_back((edge){from, 0, -cost, (int)G[from].size() - 1});
}

lli min_cost_flow(int s, int t, int f) {
  lli res = 0;
  while (f > 0) {
    fill(dist, dist + V, INF);
    dist[s] = 0;
    bool update = true;
    while (update) {
      update = false;
      for (int v = 0; v < V; v++) {
        if (dist[v] == INF) continue;
        for (int i = 0; i < G[v].size(); i++) {
          edge &e = G[v][i];
          if (e.cap > 0 && dist[e.to] > dist[v] + e.cost) {
            dist[e.to] = dist[v] + e.cost;
            prevv[e.to] = v;
            preve[e.to] = i;
            update = true;
          }
        }
      }
    }

    if (dist[t] == INF) {
      return 1;
    }

    lli d = f;
    for (int v = t; v != s; v = prevv[v]) {
      d = min(d, G[prevv[v]][preve[v]].cap);
    }
    f -= d;
    res += d * dist[t];
    for (int v = t; v != s; v = prevv[v]) {
      edge &e = G[prevv[v]][preve[v]];
      e.cap -= d;
      G[v][e.rev].cap += d;
    }
  }
  return res;
}

const int source = 0, sink = 1;

int block_idx(int n) {
  return 2 + n;
}

int widx = 0;

int width_idx(int w) {
  if (widths.find(w) == widths.end()) {
    int idx = 10 + N + (widx++);
    widths[w] = idx;
    return idx;
  } else {
    return widths[w];
  }
}

int main() {
  cin >> N;
  REP(i, N) {
    lli a, b;
    cin >> a >> b;
    
    add_edge(source, block_idx(i), 1, 0);
    add_edge(block_idx(i), width_idx(a), 1, -b);
    add_edge(block_idx(i), width_idx(b), 1, -a);
  }
  
  for (map<int,int>::iterator it = widths.begin();
      it != widths.end(); it++) {
    add_edge(it->second, sink, 1, 0);
  }

  V = 10 + N + widx;

  lli flow = 1, point = min_cost_flow(source, sink, flow);
  bool continuing = true;
  while (continuing) {
    lli new_point = min_cost_flow(source, sink, flow);
//    cout << point << " " << new_point << endl;
    if (new_point > 0) {
      continuing = false;
    } else {
      point += new_point;
    }
  }

  cout << -point << endl;
}

Measured memory_bytes: 1800
#include <iostream>
#include<math.h>
using namespace std;
int c;
int merge(int *A,int left,int mid,int right){
    int n1=mid-left;
    int n2=right-mid;
    int l[n1+1],r[n2+1];
    for(int i=0;i<n1;i++){
        l[i]=A[left+i];
    }
    for(int i=0;i<n2;i++){
        r[i]=A[mid+i];
    }
    l[n1]=1000000000;
    r[n2]=1000000000;
    int i=0,j=0;
    for(int k=left;k<right;k++){
        c++;
        if(l[i]<=r[j]){
            A[k]=l[i];
            i++;
            
        }else{
            A[k]=r[j];
            j++;
        }
    }return 0;
}
int mergeSort(int *A,int left,int right){
    if(left+1<right){
        int mid=(left+right)/2;
        mergeSort(A,left,mid);
        mergeSort(A,mid,right);
        merge(A,left,mid,right);
    }
    return 0;
}
int main(){
    int n;
    cin>>n;
    int s[n];
    for(int i=0;i<n;i++){
        cin >> s[i];
    }
    c=0;
    mergeSort(s,0,n);
    for(int i=0;i<n;i++){
        if(i!=n-1)cout << s[i]<<" ";
        if(i==n-1){
            cout <<s[i]<<endl<< c << endl;
        }
    }
}



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

using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
using WGraph = vector<vector<pair<int, ll>>>;

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

constexpr int INF = 1e9;
constexpr int MOD = 1e9 + 7;
constexpr long long LINF = 1e18;
constexpr double EPS = 1e-10;
constexpr double PI = M_PI;

void solve() {
    int x;
    cin >> x;

    cout << 1 - x << '\n';
}

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

    solve();

    return 0;
}


Measured memory_bytes: 3592
#include<bits/stdc++.h>
using namespace std;
long long arr[1000000];
int main()
{
    ios_base::sync_with_stdio(false); 
    cin.tie(NULL);   
    long long n,i,j,k;
    long double a,b;
    cin>>n;
    for (i=0;i<n;i++)
    {
    	cin>>arr[i];
    	if (arr[i]==0)
    	{
    		cout<<0<<endl;
    		return 0;
		}
	}
	sort(arr,arr+n);
	k=1;
	j=1;
	a=1.0;
	b=1e18;
	for (i=n-1;i>=0;i--)
	{
		k=k*arr[i];
		if (k<j)
		{
			cout<<-1<<endl;
			return 0;
		}
		if (k>1000000000000000000)
		{
			cout<<-1<<endl;
			return 0;			
		}
		j=k;
	}
	cout<<k<<endl;
}


Measured memory_bytes: 4440
#include<bits/stdc++.h>
using namespace std;
#define ALL(v) (v).begin(),(v).end()
#define REP(i,p,n) for(int i=p;i<(int)(n);++i)
#define rep(i,n) REP(i,0,n)
#define SZ(x) ((int)(x).size())
#define debug(x) cerr << #x << ": " << x << '\n'
#define INF 999999999
typedef long long int Int;
typedef pair<int,int> P;
using ll = long long;
using VI = vector<int>;

int main(){
  int h,w;cin >> h >> w;
  rep(i,h){
    string s;cin >> s;
    cout << s << endl << s << endl;
  }
  return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	
	
	public static void main(String[] args) {
		Scanner s = new Scanner(System.in);
		String[] linea = s.nextLine().split(" ");
		int N=Integer.parseInt(linea[0]);
		int [] A=new int[N];
		String[] linea2 = s.nextLine().split(" ");
		for(int i=0;i<N;i++) {
			A[i]=Integer.parseInt(linea2[i]);
			
		}
		int d=999999999;
		int sum=0;
		for(int j=0;j<N;j++) {
			sum=sum+A[j];
		}
		int sum2=sum;
		int sum1=0;
		for(int k=0;k<N;k++) {
			sum1=sum1+A[k];
			sum2=sum2-A[k];
			if(Math.abs(sum1-sum2)<d) {
				d=Math.abs(sum1-sum2);
			}
		}
		System.out.print(d);

}}

Measured memory_bytes: 21844
#include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
using namespace std;
typedef long long ll;
int n;
int main() {
	scanf("%d",&n);
	int b=n%10;
	if (b==3) puts("bon");
	else if (b==0||b==1||b==6||b==8) puts("pon");
	else puts("hon");
	return 0;
}

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

template <class T = long long>
struct edge {
	T cap;
	int from;
	int to;
	int rev;  // fromの方の配列で逆辺が何番目に存在するか
	bool operator<(const edge a) const {
		if(cap != a.cap) return cap < a.cap;
		if(from != a.from) return from < a.from;
		return to < a.to;
	}
	bool operator>(const edge a) const {
		if(cap != a.cap) return cap > a.cap;
		if(from != a.from) return from > a.from;
		return to > a.to;
	}
};

template <class T = long long>
class Dinic {
   private:
	int ver;  //頂点数
	vector<vector<edge<T>>> edges;
	vector<int> level;
	vector<int> chk;

   public:
	Dinic(int vertex) : ver(vertex), edges(vertex), level(vertex, -1), chk(vertex, 0) {}

	//辺と逆辺の追加 (0-indexed)
	void update(int from, int to, T cap = 1) {
		edge<T> e;
		e.cap = cap;
		e.from = from;
		e.to = to;
		e.rev = (int)edges[to].size();
		edges[from].push_back(e);

		e.cap = (T)0;
		swap(e.to, e.from);
		e.rev = (int)edges[from].size() - 1;
		edges[to].push_back(e);
	}

	//入力受取 (1-indexed)
	void input(int edge_num, int index = 1) {
		for(int i = 0; i < edge_num; i++) {
			int a;
			int b;
			T cap;
			cin >> a >> b >> cap;
			a -= index;
			b -= index;
			update(a, b, cap);
		}
	}

   private:
	//有効な辺のみを用いた幅優先探索で距離を求める
	void bfs(int s) {
		level.assign(ver, -1);
		level[s] = 0;
		queue<int> q;
		q.push(s);
		while(!q.empty()) {
			int now = q.front();
			q.pop();
			for(auto &e : edges[now]) {
				if(level[e.to] >= 0) continue;
				if(e.cap <= 0) continue;
				level[e.to] = level[now] + 1;
				q.push(e.to);
			}
		}
		return;
	}

	//流せる辺を探す
	T dfs(int now, int t, T f) {
		if(now == t) return f;
		for(int i = chk[now]; i < (int)edges[now].size(); i++) {
			auto &e = edges[now][i];
			if(level[now] + 1 != level[e.to] || e.cap <= 0) {
				chk[now]++;
				continue;
			}
			T k = dfs(e.to, t, min(f, e.cap));
			if(k > 0) {
				e.cap -= k;
				edges[e.to][e.rev].cap += k;
				return k;
			}
			chk[now]++;
		}
		return (T)0;
	}

   public:
	T maxflow(int s, int t) {
		T flow = 0;
		const T INF = 3e16;	 // T == int だとバグる
		while(1) {
			bfs(s);
			if(level[t] < 0) return flow;
			for(int i = 0; i < ver; i++) chk[i] = 0;
			T fl = 1;
			while(fl > 0) {
				fl = dfs(s, t, INF);
				flow += fl;
			}
		}
	}
};

int main() {
	// https://onlinejudge.u-aizu.ac.jp/courses/library/5/GRL/all/GRL_6_A
	int v, e;
	cin >> v >> e;
	Dinic<> din(v);
	din.input(e, 0);
	cout << din.maxflow(0, v - 1) << endl;
}


Measured memory_bytes: 3260
#include <iostream>
#include <vector>
#include <cmath>
using namespace std;

bool inc(int a){
    int rmax=-1;
    for(int i=1; i<a; i*=10){
        int dig= (a/i)%10;
        if(rmax==-1){
            rmax=dig;
        }else if(dig == rmax-1){
            rmax=dig;
        }else{
            return false;
        }
    }
    return true;
}

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

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

    int ans=-1;
    for(int i=0; i<n; i++){
        for(int j=i+1; j<n; j++){
            int prod = nums[i]*nums[j];
            if(inc(prod) && prod>ans){
                ans = prod;
            }
        }
    }

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

Measured memory_bytes: 3132
fun main(arr: Array<String>) {
    val s = readLine()!!
    val nobori = IntArray(s.length + 1)
    val kudari = IntArray(s.length + 1)
    nobori[0] = 0
    for(i in (1 until nobori.size)) {
        if(s[i - 1] == '<') {
            nobori[i] = nobori[i-1] + 1
        } else {
            nobori[i] = 0
        }
    }
    kudari[kudari.lastIndex] = 0
    for(i in (0 until kudari.size - 1).reversed()) {
        if(s[i] == '>') {
            kudari[i] = kudari[i+1] + 1
        } else {
            kudari[i] = 0
        }
    }
    val ans = nobori.indices.map { Math.max(nobori[it] , kudari[it]).toLong() }.sum()
    println(ans)
}



Measured memory_bytes: 65124
using System;
using System.Collections.Generic;

class Program
{
    static void Main(string[] args)
    {
        var s = Console.ReadLine();
        var t = Console.ReadLine();

        var a = new Dictionary<char, char>();
        var b = new Dictionary<char, char>();

        for (int i = 0; i < s.Length; i++)
        {
            if (a.ContainsKey(s[i]) && a[s[i]] != t[i])
            {
                Console.WriteLine("No");
                return;
            }
            else if (b.ContainsKey(t[i]) && b[t[i]] != s[i])
            {
                Console.WriteLine("No");
                return;
            }
            else
            {
                a[s[i]] = t[i];
                b[t[i]] = s[i];
            }
        }

        Console.WriteLine("Yes");
    }
}


Measured memory_bytes: 13268
#include<bits/stdc++.h>
#define ll long long int
#define ld long double
#define pb push_back
#define all(x) x.begin(),x.end()
#define ff first
#define ss second
#define mod 1000000007
#define dbg if(debug)
#define size(x) (int)(x).size()
using namespace std;
typedef pair<int,int> pii;
#ifdef OMNI
	const bool debug = 1;
#else
	const bool debug = 0;
#endif

//---------------------- PROVE, THEN WRITE ----------------------//


int main(){
	ios_base::sync_with_stdio(false); 
	cin.tie(NULL);cout.tie(NULL);
	string s,t;
	cin>>s>>t;
	int n=s.length(),m=t.length();
	vector<vector<int> > dp(n+1,vector<int> (m+1));
	for(int i=1;i<=n;++i){
		for(int j=1;j<=m;++j){
			if(s[i-1]==t[j-1])
				dp[i][j] = dp[i-1][j-1]+1;
			else
				dp[i][j] = max(dp[i-1][j],dp[i][j-1]);
		}
	}
	int y = m;
	int x = n;
	string ans="";
	while(x>0 && y>0){
		if(s[x-1]==t[y-1]){
			ans += t[y-1];
			y--;
			x--;
		}
		else if(dp[x-1][y] > dp[x][y-1]){
			x--;
		}
		else
			y--;
	}
	reverse(all(ans));
	cout<<ans;
	// cerr<< '\n' << "Time elapsed :" << clock() * 1000.0 / CLOCKS_PER_SEC << " ms\n" ;
	return 0;
}
	

Measured memory_bytes: 38576
#include<stdio.h>
#include<string.h>
int D[300000000],a,b;
int henkan(char s[12]){
  int i=0,j,a=0,b=0;
  while(s[i]){
    switch(s[i]){
    case 'A':a=1;for(j=0;j<i;j++){a=a*4;}break;
    case 'C':a=2;for(j=0;j<i;j++){a=a*4;}break;
    case 'G':a=3;for(j=0;j<i;j++){a=a*4;}break;
    case 'T':a=4;for(j=0;j<i;j++){a=a*4;}break;
    }
    i++;
    b=a+b;
  }
  return(b);
}
int main(){
  int i,n,F[1000000],f=0,h;
  char com[10],s[20];
  scanf("%d",&n);
  for(i=0;i<n;i++){
    scanf("%s",com);
    scanf("%s",s);
    h=henkan(s);
    if(strcmp(com,"insert")==0){
      D[h]=1;
    }
    else if(strcmp(com,"find")==0){
      if(D[h]==1){
	F[f]=1;
      }
      else if(D[h]!=1){
	F[f]=2;
      }
      f++;
    }
  }
  for(i=0;i<f;i++){
    if(F[i]==1) printf("yes\n");
    else if(F[i]==2) printf("no\n");
    else printf("error\n");
  }
}



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

long long int n;
vector<int> v, w;
int ans;

int main(){
	cin >> n;
	while(n > 0){
		v.push_back(n % 10);
		n /= 10;
	}
	for(int i=0; i<v.size(); ++i)
		ans += v[i];
	for(int i=0; i<v.size(); ++i){
		w = v;
		int tmp = 0;
		for(int j=0; j<w.size(); ++j){
			if(j < i) tmp += 9;
			else if(j == i && w[j] != 0) tmp += w[j]-1;
			else if(j == i && w[j] == 0){
				while(w[j] == 0){
					tmp += 9;
					++j;
				}
				--w[j];
			}
			else tmp += w[j];
		}
		ans = max(ans, tmp);
//		cout << tmp << endl;
	}
	cout << ans << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<stdio.h>
#include<vector>
#include<algorithm>
#include<set>
#include<string>
#include<string.h>
#include<complex>
#include<math.h>
using namespace std;
typedef long long int llint;
typedef vector<int> vint;
typedef vector<llint> vllint;
typedef vector<pair<int, int>> vpint;
typedef vector<pair<llint, llint>> vpllint;
#define rep(i,n) for(int i=0;i<n;i++)
#define yes(ans) if(ans)cout<<"yes"<<endl;else cout<<"no"<<endl;
#define Yes(ans) if(ans)cout<<"Yes"<<endl;else cout<<"No"<<endl;
#define YES(ans) if(ans)cout<<"YES"<<endl;else cout<<"NO"<<endl;
#define POSSIBLE(ans) if(ans)cout<<"POSSIBLE"<<endl;else cout<<"IMPOSSIBLE"<<endl;

bool check(int a, int b) {
	return a > b;
}

int main() {
	int n;
	cin >> n;
	vector<bool>a(n, false);
	int cnt = 0;
	rep(i, n + 1) {
		if (i == 0) {
			continue;
		}
		cnt += i;
		a[i - 1] = true;
		if (n < cnt) {
			a[cnt - n - 1] = false;
			break;
		}
		if (n == cnt) {
			break;
		}
	}
	rep(i, n) {
		if (a[i]) {
			cout << i + 1 << endl;
		}
	}
	return 0;
}


Measured memory_bytes: 1536
#include<stdio.h>
#include<math.h>
int main(void)
{
	int weight,weight_t,count=0;

	while (scanf("%d", &weight) != EOF) {
		weight_t = weight;
		while (1)
		{
			while (weight % 2 == 0) {
				weight = weight / 2;
				count++;
			}
			if (weight_t - (int)pow(2, count) == 0) {
				printf("%d\n", (int)pow(2, count));
				count = 0;
				break;
			}
			else
				printf("%d ", (int)pow(2, count));
			weight_t = weight_t - (int)pow(2,count);
			weight = weight_t;
			count = 0;
		}
	}
	return 0;
}

Measured memory_bytes: 636
import itertools
n, m, q = map(int , input().split(" "))
l = []
for i in range(q):
    a, b, c, d = map(int, input().split(" "))
    l.append((a, b, c, d))


def score(l, t):
    score = 0
    for i in l:
        a, b, c, d = i
        if t[b-1] - t[a-1] == c:
            score = score + d
    return score

print(max([ score(l, t)  for t in itertools.combinations_with_replacement(list(range(1, m+1)), n)] ))

Measured memory_bytes: 12524
#include<iostream>
#include<cstdio>
#include<cstring>

namespace WoKeNengYiJingShaDiaoLe
{
	typedef long long ll;
	ll A,B,T;
	void solve()
	{
		scanf("%lld%lld",&A,&B);
		if(A==B){printf("1\n");return;}

		for(T=1ll<<62;;T>>=1)
		{
			ll a=A&T,b=B&T;
			if(a^b)break;
			A^=a,B^=b;
		}
		
		ll L=A,R,dt;
		for(dt=T>>1;dt && !(B&dt);dt>>=1);
		if(!dt)R=T;else R=T+((dt<<1)-1);

		ll ans;
		if(R<T+A)ans=R-L+1+(T*2-1-(T+A)+1);
		else ans=(T*2-1-L+1);

		printf("%lld\n",ans);
	}
}

int main()
{
	WoKeNengYiJingShaDiaoLe::solve();
	return 0;
}


Measured memory_bytes: 256
l,r=map(int,input().split())

mod=2019
ijmin=2019
for i in range(l,min(r,l+2019)+1):
    for j in range(i+1,min(r,i+2019)+1):
        ijmin=min((i*j)%mod,ijmin)
#        print(i,j,(i*j)%mod,ijmin)
print(ijmin)
        

Measured memory_bytes: 2940
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0, i##_len = (n); i < i##_len; ++i)
#define rep2(i, x, n) for(int i = x, i##_len = (n); i < i##_len; ++i)
#define all(n) begin(n), end(n)
using ll = long long;
using P = pair<ll, ll>;
using vi = vector<int>;
using vl = vector<ll>;
using vs = vector<string>;
using vc = vector<char>;
using vb = vector<bool>;
using vd = vector<double>;
vi dir = {-1, 0, 1, 0, -1, -1, 1, 1, -1};

vl factor(ll n) {
  vl res;
  for(ll i = 1; i * i <= n; i++) {
    if(n % i == 0) {
      res.push_back(i);
      if(i * i != n) res.push_back(n / i);
    }
  }
  sort(all(res));
  return res;
}

int main() {
  ll n, m;
  cin >> n >> m;
  vl f = factor(m);
  ll ans = 1;
  for(ll i : f)
    if(m / i >= n) ans = i;
  cout << ans << endl;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

    public static final int MOD = 1000000007;

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int l = Integer.parseInt(sc.next());
        int r = Integer.parseInt(sc.next());
        int d = Integer.parseInt(sc.next());
        int ans = 0;
        for (int i = l; i <= r; i++) {
            if (i % d == 0) {
                ans++;
            }
        }
        System.out.println(ans);
    }
}

Measured memory_bytes: 35600
# -*- coding: utf-8 -*-
import sys
N,K=map(int, sys.stdin.readline().split())
A=[ int(sys.stdin.readline().strip()) for _ in range(N) ]
max_A=max(A)

# max_Aが処理する区間の長さ
N0 = 2**(3*10**5-1).bit_length()
data = [0]*(2*N0)
# a_k の値を x に更新
def update(k, x):
    k += N0-1
    data[k] = x
    while k >= 0:
        k = (k - 1) // 2
        data[k] = max(data[2*k+1], data[2*k+2])
# 区間[l, r)の最大値
def query(l, r):
    L = l + N0; R = r + N0
    s = float("-inf")
    while L < R:
        if R & 1:
            R -= 1
            s = max(s, data[R-1])

        if L & 1:
            s = max(s, data[L-1])
            L += 1
        L >>= 1; R >>= 1
    return s

for i,a in enumerate(A):
    update(a,query(max(a-K,0),min(a+K+1,max_A+1))+1)

print query(0,max_A+1)


Measured memory_bytes: 104556
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <functional>
#include <utility>
#include <tuple>
#include <cctype>
using namespace std;
#define INF 0x3f3f3f3f
#define INFLL 0x3f3f3f3f3f3f3f3fLL
#define MOD 1000000007
#define mp make_pair
#define mt make_tuple
#define pb push_back
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pint;
typedef pair<ll,ll> pll;
typedef tuple<int,int,int> tint;
typedef vector<int> vint;
typedef vector<ll> vll;
int dx[8]={0,0,-1,1,1,1,-1,-1};
int dy[8]={-1,1,0,0,1,-1,1,-1};
const int SIZE=150;
//ここまでテンプレ
int main(){
	int N;
	cin>>N;
	vint C,S,F;
	for(int i=0;i<N-1;i++){
		int c,s,f;
		cin>>c>>s>>f;
		C.pb(c);
		S.pb(s);
		F.pb(f);
	}
	for(int i=0;i<N;i++){
		int now=0;
		for(int j=i;j<N-1;j++){
			//cout<<"#"<<now<<endl;
			if(now<=S[j]){
				now=S[j]+C[j];
				continue;
			}
			now-=S[j];
			if(now%F[j]==0){
				now+=S[j]+C[j];
				continue;
			}
			now=(now/F[j]+1)*F[j]+S[j]+C[j];
		}
		cout<<now<<endl;
	}
	return 0;
}

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

typedef long long LL;
typedef long double LD;
typedef pair<int, int> PII;
typedef pair<LL, LL> PLL;
typedef pair<LD, LD> PDD;

#define all(x) (x).begin(), (x).end()
#define sz(x) (int)(x).size()
#define dbl(k, x) fixed << setprecision(k) << (x)

template <typename _T>
inline void _DBG(const char *s, _T x) {
  cerr << s << " = " << x << "\n";
}
template <typename _T, typename... args>
void _DBG(const char *s, _T x, args... a) {
  while (*s != ',') cerr << *s++;
  cerr << " = " << x << ',';
  _DBG(s + 1, a...);
}

#define _upgrade                \
  ios_base::sync_with_stdio(0); \
  cin.tie(0);                   \
  cout.tie(0);
#define DBG(...) _DBG(#__VA_ARGS__, __VA_ARGS__)

// ********************** CODE ********************** //

const int N = 1e6 + 7;
vector<bool> sieve(N);
vector<LL> primes;

vector<PLL> factor(LL n) {
  vector<PLL> res;

  for (auto &p : primes) {
    if (n % p == 0) {
      int cnt = 0;
      while (n % p == 0) {
        n /= p;
        cnt++;
      }
      res.emplace_back(p, cnt);
    }
  }

  if (n != 1) {
    res.emplace_back(n, 1);
  }

  return res;
}

int main() {
  _upgrade;

  for (int i = 2; i < N; i++) {
    if (!sieve[i]) {
      primes.push_back(i);
      for (int j = i; j < N; j += i) {
        sieve[j] = true;
      }
    }
  }

  LL n;
  cin >> n;
  if (n == 1) {
    cout << 0 << "\n";
    return 0;
  }
  auto factors = factor(n);

  LL res = 0;
  for (auto p : factors) {
    LL cnt = 0;
    LL sum = 1;
    for (LL i = 2; i < 40 && sum <= p.second; i++) {
      cnt++;
      sum += i;
    }

    res += cnt;
  }

  cout << res << "\n";
  return 0;
}

Measured memory_bytes: 4332
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int A = sc.nextInt();
        int B = sc.nextInt();
        int C = sc.nextInt();
        int K = sc.nextInt();
        if((A + B) >= K ) {
			if (A > K)
		System.out.println(K);
			else
		System.out.println(A);
		}
		else if((A + B) < K ) {
		System.out.println(A + (K - A -B) * - 1);
		}
    }
}

Measured memory_bytes: 35704
#include <iostream>
#include <cmath>
#include <iomanip>
using namespace std;

int main() {
    int n;
    cin >> n;
    double x[n], y[n];
    for(int i=0; i<n; i++) {
      double num;
      cin >> num;
      x[i] = num;
    }

    for(int i=0; i<n; i++) {
      double num;
      cin >> num;
      y[i] = num;
    }

    double sum1, sum2, sum3, sum4;
    for (int i=0; i<n; i++) {
      sum1 += abs(x[i]-y[i]);
      sum2 += pow((x[i]-y[i]), 2);
      sum3 += pow(abs(x[i]-y[i]), 3);
      sum4 = max(sum4, abs(x[i]-y[i]));
    }
    sum2 = sqrt(sum2);
    sum3 = pow(sum3, 1.0/3);
    cout <<fixed << setprecision(6)<< sum1 << endl;
    cout <<fixed << setprecision(6)<< sum2 << endl;
    cout <<fixed << setprecision(6)<< sum3 << endl;
    cout <<fixed << setprecision(6)<< sum4 << endl;
    return 0;
}



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

int main(){
    int N;
    cin >> N;
    map<string, int> mp;
    for(int i=0;i<N;i++){
        string s;
        cin >> s;
        sort(s.begin(),s.end());
        mp[s]++;
    }
    long long sum = 0;
    for(auto& p : mp){
        int s = p.second;
        sum += (long long)s*(s-1)/2;
    }
    cout << sum << endl;
}

Measured memory_bytes: 11136
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>



int main(int argc, char* argv[])
{
  using std::cin;
  using std::cout;
  std::ios::sync_with_stdio(false);
  cin.tie(nullptr);

  int X, A;
  cin >> X >> A;
  cout << (X < A ? 0 : 10) << "\n";

  return 0;
}


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

main()
{
    int d,r;
    double a,b,f;
    cin >> a >> b;
    d = a / b;
    r = (int)a % (int)b;
    f = a/b;
    cout << d << " " << r << " " << fixed << setprecision( 5 ) << f << endl;
    return 0;
}

Measured memory_bytes: 1288
#include <bits/stdc++.h>
#define rep(i, a, n) for(int i = a; i < n; i++)
#define repr(i, a, b) for(int i = a; i >= b; i--)
#define int long long
#define all(a) a.begin(), a.end()
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
using namespace std;
typedef pair<int, int> P;
const int mod = 1000000007;
const int INF = 1e15;

signed main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n, ans = 0;
    cin >> n;
    vector<int> a(n);
    rep(i, 0, n) cin >> a[i];
    sort(a.begin(), a.end());
    if(n % 2 == 0){
        int large = 0, small = 0;
        rep(i, 0, n / 2) small += a[i];
        rep(i, n / 2, n) large += a[i];
        ans = 2 * large - 2 * small - a[n / 2] + a[n / 2 - 1];
    }else{
        int large = 0, small = 0;
        rep(i, 0, n / 2) small += a[i];
        rep(i, n / 2, n) large += a[i];
        ans = 2 * large - 2 * small - a[n / 2] - a[n / 2 + 1];
        large = 0, small = 0;
        rep(i, 0, n / 2 + 1) small += a[i];
        rep(i, n / 2 + 1, n) large += a[i];
        ans = max(ans, 2 * large - 2 * small + a[n / 2] + a[n / 2 - 1]);
    }
    cout << ans << endl;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
using ll =long long;
using vl=vector<ll>;
using vb=vector<bool>;
using vs=vector<string>;
using vvl=vector<vl>;
using pll=pair<ll,ll>;
const ll oo =0x3f3f3f3f3f3f3f3fLL;
const double eps=1e-9;
#define sz(c) ll((c).size())
#define all(c) begin(c),end(c)
#define mp make_pair
#define mt make_tuple
#define pb push_back
#define eb emplace_back
#define xx first
#define yy second
#define FOR(i,a,b) for(ll i=(a); i<(b); i++)
#define FORD(i,a,b) for(ll i=ll(b)-1;i>=(a);i--)
#define TR(X) ({if(1) cerr << "TR: " << (#X) << " = " << (X) << endl; })
int main(){ cin.sync_with_stdio(0);
        ll n; cin >> n;
        vl ns(n); FOR(i, 0, n) cin >> ns[i];

        vl res(n);
        FOR(i, 0, n/2) {
                res[i] = ns.back();
                ns.pop_back();
                res[n-i-1] = ns.back();
                ns.pop_back();
        }
        if (n % 2) {
                res[n/2] = ns[0];
        }
        FOR(i, 0, n) {
                if (i) cout << " ";
                cout << res[i];
        }
        cout << endl;
} //cin.tie(0) bei schnellem Wechseln


Measured memory_bytes: 5376
#include <bits/stdc++.h>
#define ll long long
using namespace std;
int main()
{ 
	string xx;
	cin>>xx;
	ll sum=0;
	for(ll i=0;i<xx.size();i++){
		 int cm= xx[i]-'0';
		sum+= cm;
	}
	
	if(sum==0)cout<<"Yes";
	else{
    	cout<<((sum%9==0)?"Yes":"No")<<"\n";
	}
}


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

int main() {
	char x;
	cin >> x;
	if (isupper(x)) cout << "A" << endl;
  	else cout << "a" << endl;
	return 0;
}

Measured memory_bytes: 3620
import sys
sys.setrecursionlimit(10**9)

def mi(): return map(int,input().split())
def ii(): return int(input())
def isp(): return input().split()
def deb(text): print("-------\n{}\n-------".format(text))

INF=10**20
def main():
    N=ii()
    A=list(mi())

    r = 0
    asum = 0
    xsum = 0
    ans = 0
    for l in range(N):
        while r < N and asum+A[r] == xsum^A[r]:
            asum += A[r]
            xsum ^= A[r]
            r += 1

        # print(r)
        ans += r-l
        if l == r:
            r += 1
        else:
            asum -= A[l]
            xsum ^= A[l]
        
        
    print(ans)



    


if __name__ == "__main__":
    main()

Measured memory_bytes: 101624
#include<iostream>
using namespace std;
int main(){
	int N,a,b,c,d;
	int i,j;
	int t[101]={0};
	int r[101];
	for(i=0;i<101;i++){
		r[i]=1;
	}
	cin>>N;
	for(i=0;i<N*(N-1)/2;i++){
		cin>>a>>b>>c>>d;
		if(c>d){
			t[a]=t[a]+3;
		}
		else if(c<d){
			t[b]=t[b]+3;
		}
		else{
			t[a]=t[a]+1;
			t[b]=t[b]+1;
		}
	}
	for(i=1;i<=N;i++){
		for(j=1;j<=N;j++){
			if(t[i]<t[j]){
				r[i]++;
			}
		}
	}
	for(i=1;i<=N;i++){
		cout<<r[i]<<endl;
	}
	return 0;
}

Measured memory_bytes: 3080
number = gets.to_i

t1,x1,y1 = 0,0,0

judge  = "Yes"

number.times do
    s = gets

    t2,x2,y2 = s.strip.split(" ").map(&:to_i)
    t = t2 - t1
    d = (x2 - x1).abs + (y2 - y1).abs
    if d <= t && (t - d).even?
        t1 = t2
        x1 = x2
        y1 = y2
    else
        judge = "No"
        break
    end
end
print judge

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

int main(){
    int N;
    std::cin >> N;
    std::vector< int > A(N);
    for(int i=0; i<N; i++){
        std::cin >> A[i];
    }
    
    long long sum = 0;
    
    for(int i=1; i<N; i++){
        if(A[i] < A[i-1]){
            sum += A[i-1] - A[i];
            A[i] = A[i-1];
        }
    }
    
    std::cout << sum << std::endl;
    
    
    return 0;
    
}


Measured memory_bytes: 4056
N,K = map(int,input().split())
if K % 2 == 1:
	out = (int(N/K))**3
	print(out)
else:
	k = int(K/2)
	out = (int(N/K))**3 + (int(N/k)-int(N/K))**3
	print(out)

Measured memory_bytes: 3060
# Problem https://atcoder.jp/contests/abc068/tasks/abc068_b
# Ruby 2nd Try
Nmax = 100
Ni = Array.new(Nmax+1,0)
1.upto(Nmax) do |j|
    number = j
    counter = 0
    oddFlag = false
    while true
        if number % 2 == 1
        oddFlag = true
        end
        if oddFlag
            break
        end
        number = number / 2
        counter = counter +1
    end
    Ni[j]=counter
end
# p Ni
N = gets.chomp.to_i
answer = 0
countents = 0
1.upto(N) do |j|
    if(countents <= Ni[j])
        answer = j
        countents = Ni[j]
    end
end
puts(answer)


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

int64_t f(int64_t x, int64_t y) {
  if(x < y) {
    return f(y, x);
  }
  else {
   if(x % y == 0) {
     return y;
   }
   else {
     return f(y, x % y);
   }
  }
}

int main() {
  int64_t A, B;
  cin >> A >> B;
  int64_t M = f(A, B);
  cout << A * B / M << endl;
}

Measured memory_bytes: 256
#include <utility>
#include <vector>
#include <math.h>
#include <algorithm>
#include <string>
#include <iostream>
using namespace std;

int exist(int a[5], int n)
{
	for (int i = 0; i < 5; i++)
	{
		if (a[i] == n)
			return n*n;
	}
	return 0;
}

int r3(int a[5])
{
	int c = 0;
	for (int i = 1; i < 4; i++)
	{
		c += exist(a, i);
	}
	if (c == 5 || c == 10 || c == 13)
		return c;
	return -1;
}


int main()
{
	int a[5];
	while (cin >> a[0] >> a[1] >> a[2] >> a[3] >> a[4] && a[0] != 0)
	{
		int p = r3(a);
		if (p == -1)
		{
			for (int i = 0; i < 5; i++)
				cout << 3 << endl;
		}
		else
		{
			if (p == 5)
			{
				for (int i = 0; i < 5; i++)
					cout << a[i] << endl;
			}
			else if (p == 10)
			{
				for (int i = 0; i < 5; i++)
					cout << (a[i] - 3) / (-2) + 1 << endl;
			}
			else
				for (int i = 0; i < 5; i++)
					cout << a[i] - 1 << endl;
		}
	}
	
	return 0;
}

Measured memory_bytes: 3108
using System;

public class Test
{
	public static void Main()
	{
		// your code goes here
		string[] s = Console.ReadLine().Split(' ');
		var a = int.Parse(s[0]);
		var b = int.Parse(s[1]);
		Console.WriteLine(string.Format("{0} {1}", a*b, 2*(a + b) ));
	}
}

Measured memory_bytes: 9176
#include<bits/stdc++.h>
using namespace std;
int main()
{
  int a, b, c, cnt = 0;
  
  cin >> a >> b >> c;
  
  if((a==b)&&(b==c))
    cnt = 1;
  else if((a==b)||(b==c)||(c==a))
    cnt = 2;
  else
    cnt = 3;
  
  cout << cnt << endl;
  
  return 0;
}


Measured memory_bytes: 256