akhauriyash/Code-Regression huggingface dataset:
#include "bits/stdc++.h"
using namespace std;
#ifdef _DEBUG
#include "dump.hpp"
#else
#define dump(...)
#endif

//#define int long long
#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define rrep(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define all(c) begin(c),end(c)
const int INF = sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = 1'000'000'007;
template<class T> bool chmax(T &a, const T &b) { if (a < b) { a = b; return true; } return false; }
template<class T> bool chmin(T &a, const T &b) { if (b < a) { a = b; return true; } return false; }

signed main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int q; cin >> q;
	vector<int> a(q), b(q), c(q), d(q); rep(i, 0, q) {
		cin >> a[i] >> b[i] >> c[i] >> d[i];
		a[i]--, b[i]--, c[i]--, d[i]--;
	}

	auto inrange = [&](int i, int j) { return i >= 0 && i < 8 && j >= 0 && j < 8; };

	// 2^48
	int Z = 2;
	vector<vector<int>> g(8, vector<int>(8, Z));
	g[3][3] = 0;
	g[3][4] = 1;
	g[4][3] = Z;
	g[4][4] = 0;

	int pass = 0;
	int color = 1;

	while (true) {
		bool replace = false;
		rep(i, 0, 8) {
			rep(j, 0, 8) {
				if (g[i][j] != Z)continue;
				int color2 = (color + 1) % 2;
				bool ok = false;
				rep(di, -1, 2)rep(dj, -1, 2) {
					if (di == 0 && dj == 0)continue;
					rep(k, 1, 9) {
						int ni = i + di * k, nj = j + dj * k;
						if (!inrange(ni, nj))break;
						if (g[ni][nj] == Z)break;
						if (g[ni][nj] == color) {
							if (k >= 2)ok = true;
							break;
						}
					}
				}
				if (!ok)continue;
				dump(i, j, color);
				g[i][j] = color;
				rep(di, -1, 2)rep(dj, -1, 2) {
					if (di == 0 && dj == 0)continue;
					bool ok = false;
					rep(k, 1, 9) {
						int ni = i + di * k, nj = j + dj * k;
						if (!inrange(ni, nj))break;
						if (g[ni][nj] == Z)break;
						if (g[ni][nj] == color) {
							if (k >= 2)ok = true;
							break;
						}
					}
					if (!ok)continue;
					rep(k, 1, 9) {
						int ni = i + di * k, nj = j + dj * k;
						if (!inrange(ni, nj))break;
						if (g[ni][nj] == Z)break;
						if (g[ni][nj] == color2) {
							g[ni][nj] = color;
							replace = true;
						}
						if (g[ni][nj] == color) {
							break;
						}
					}
				}
				dump(g);
				break;
			}
			if (replace) break;
		}

		color = (color + 1) % 2;

		if (!replace) {
			pass++;
			dump(pass);
			if (pass >= 2)break;
		}
		else {
			pass = 0;
		}

	}

	rep(t, 0, q) {
		int cnt = 0;
		rep(i, a[t], c[t] + 1)rep(j, b[t], d[t] + 1) {
			if (g[i][j] != Z)
				cnt++;
		}
		cout << cnt << endl;
	}

	return 0;
}


Measured memory_bytes: 4296
function getday(y,m,d){
    var sum = 195 * (y - 1);
    sum += 5 * Math.floor((y - 1) / 3);
    sum += 20 * (m - 1) + d;
    if(y % 3){
        sum -= Math.floor((m - 1) / 2);
    }
    return sum;
}


function Main(input){
    input = input.split("\n");
    var n = parseInt(input[0],10);

    var mi = getday(1000,1,1);

    for(i = 1;i <= n;i++){
        input[i] = input[i].split(" ");
        console.log(mi - getday(parseInt(input[i][0],10),parseInt(input[i][1],10),parseInt(input[i][2],10)))
    }
}
Main(require("fs").readFileSync("/dev/stdin","utf8"));

Measured memory_bytes: 16128
/**
 *    author:  Daredevil666
 *    institution: IIT Patna
**/
#define _USE_MATH_DEFINES
#include<bits/stdc++.h>
#define nl cout<<"\n";
#define ll long long int
#define REP(i,a,n) for(i=a;i<=n;i++)
#define F(i,a,b) for(i=a;i<b;i++)
#define RF(i,b,a) for(i=b;i>=a;i--)
#define IOS  ios::sync_with_stdio(false);cin.tie(0);
using namespace std;
const ll mod=1e9+7;
const ll MAXN=100200;
ll i,j;
int main()
{
IOS
/*#ifndef ONLINE_JUDGE
   freopen("input.txt","r",stdin);
   freopen("output.txt","w",stdout);
#endif // ONLINE_JUDGE*/
string s;
cin>>s;
ll sum=0;
F(i,0,s.length())
{
   sum+=s[i]-'0';
}
if(sum%9==0)
    cout<<"Yes";
else
    cout<<"No";
return 0;
}


Measured memory_bytes: 3736
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <cmath>
#include <cstdlib>
#include <tuple>
#include <queue>
using namespace std;
using ll=long long;
//using R=double;

const int INF = 10000000;
typedef pair<int, int> p;

int main(){
	int a[3], b[3];
	int n[4] = {};
	for(int i = 0; i < 3; i++){
		cin >> a[i] >> b[i];
		n[a[i]-1]++;
		n[b[i]-1]++;
	}

	for(int i = 0; i < 4; i++){
		//printf("n[%d] : %d\n",i,n[i]);
		if(n[i]==3){
			puts("NO");
			return 0;
		}
	}

	puts("YES");

	return 0;
}


Measured memory_bytes: 256
N = input()
N = int(N)

a_sub = input().split(" ")
a = [int(n0) for n0 in a_sub]
# print(a)

s = a[0]+a[N-2]

for xi in range(1,N-1):
    if a[xi-1]<a[xi]:
        s = s+a[xi-1]
    else:
        s = s+a[xi]

print(s)


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

using namespace std;

typedef long long ll;
typedef pair<ll, ll> P;
typedef pair<int, int> Pi;
typedef vector<ll> Vec;
typedef vector<int> Vi;
typedef vector<string> Vs;
typedef vector<vector<ll>> VV;
typedef vector<vector<int>> VVi;

#define REP(i, a, b) for(ll i=(a); i<(b); i++)
#define PER(i, a, b) for(ll i=(a); i>=(b); i--)
#define rep(i, n) REP(i, 0, n)
#define per(i, n) PER(i, n, 0)
const ll INF=1e18+18;
const ll MAX=100005;
const ll MOD=1000000007;
#define Yes(n) cout << ((n) ? "Yes" : "No") << endl;
#define YES(n) cout << ((n) ? "YES" : "NO") << endl;
#define ALL(v) v.begin(), v.end()
#define rALL(v) v.rbegin(), v.rend()
#define pb(x) push_back(x)
#define mp(a, b) make_pair(a,b)
#define Each(a,b) for(auto &a :b)
#define REPM(i, mp) for (auto i = mp.begin(); i != mp.end(); ++i)
#define dbg(x_) cerr << #x_ << ":" << x_ << endl;
#define dbgmap(mp) cerr << #mp << ":"<<endl; for (auto i = mp.begin(); i != mp.end(); ++i) { cerr << i->first <<":"<<i->second << endl;}
#define dbgarr(n,m,arr) rep(i,n){rep(j,m){cerr<<arr[i][j]<<" ";}cerr<<endl;}
#define dbgdp(n,arr) rep(i,n){cerr<<arr[i]<<" ";}cerr<<endl;
#define sum(v) accumulate(ALL(v),0)
#define fi first
#define se second

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

template<typename T1, typename T2>
ostream &operator<<(ostream &s, const pair<T1, T2> &p) { return s<<"("<<p.first<<", "<<p.second<<")"; }

// vector
template<typename T>
ostream &operator<<(ostream &s, const vector<T> &v) {
    int len=v.size();
    for(int i=0; i<len; ++i) {
        s<<v[i];
        if(i<len-1) s<<"	";
    }
    return s;
}

// 2 dimentional vector
template<typename T>
ostream &operator<<(ostream &s, const vector<vector<T> > &vv) {
    int len=vv.size();
    for(int i=0; i<len; ++i) {
        s<<vv[i]<<endl;
    }
    return s;
}

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

    ll n, m;
    cin>>n>>m;
    Vec x(n);
    Vec y(n);
    Vec z(n);
    rep(i,n){
        cin>>x[i]>>y[i]>>z[i];
    }

    ll ans=0;
    rep(i,8){
        ll tmp = 0;
        Vec s(n);
        rep(j,n){
            s[j] += x[j]* (i&4LL?1:-1);
            s[j] += y[j]* (i&2LL?1:-1);
            s[j] += z[j]* (i&1LL?1:-1);
        }
        sort(rALL(s));
        rep(j,m){
            tmp += s[j];
        }
        chmax(ans,tmp);
    }

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


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

int main() {
  int A, B, C;
  int square[3][3];

  cin >> square[0][0] >> square[0][1] >> square[1][1];
  int X = 3 * square[1][1];
  square[0][2] = X - square[0][0] - square[0][1];
  square[2][1] = X - square[0][1] - square[1][1];
  square[2][2] = X - square[0][0] - square[1][1];
  square[1][2] = X - square[0][2] - square[2][2];
  square[1][0] = X - square[1][1] - square[1][2];
  square[2][0] = X - square[2][1] - square[2][2];
  for (int i = 0; i < 3; i++) {
    cout << square[i][0];
    for (int j = 1; j < 3; j++) {
      cout << " " << square[i][j];
    }
    cout << endl;
  }
  return (0);
}

Measured memory_bytes: 256
//
// Created by yamunaku on 2020/01/13.
//

#include <bits/stdc++.h>

using namespace std;

#define rep(i, n) for(int i = 0; i < (n); i++)
#define repl(i, l, r) for(int i = (l); i < (r); i++)
#define per(i, n) for(int i = ((n)-1); i >= 0; i--)
#define perl(i, l, r) for(int i = ((r)-1); i >= (l); i--)
#define all(x) (x).begin(),(x).end()
#define MOD9 998244353
#define MOD1 1000000007
#define IINF 1000000000
#define LINF 1000000000000000000
#define SP <<" "<<
#define CYES cout<<"Yes"<<endl
#define CNO cout<<"No"<<endl
#define CFS cin.tie(0);ios::sync_with_stdio(false)
#define CST(x) cout<<fixed<<setprecision(x)

using ll = long long;
using ld = long double;
using vi = vector<int>;
using mti = vector<vector<int>>;
using vl = vector<ll>;
using mtl = vector<vector<ll>>;
using pi = pair<int, int>;
using pl = pair<ll, ll>;
template<typename T>
using heap = priority_queue<T, vector<T>, function<bool(const T, const T)>>;

int main(){
    // CFS;
    int n, m;
    cin >> n >> m;
    int ac = 0, wa = 0;
    vi tmp(n, 0);
    int p;
    string s;
    rep(i, m){
        cin >> p >> s;
        p--;
        if(tmp[p] == -1) continue;
        if(s == "AC"){
            ac++;
            wa += tmp[p];
            tmp[p] = -1;
        }else{
            tmp[p]++;
        }
    }
    cout << ac SP wa << endl;
    return 0;
}

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

int main(int argc, char const *argv[])
{
    string S;
    cin >> S;

    for (int i = 0; i < 2; i++)
    {
        if (S.at(i) != S.at(i + 1))
        {
            cout << "Yes" << endl;
            return 0;
        }
    }
    cout << "No" << endl;

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <deque>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <iomanip>
#include <bitset>
#include <set>
#include <map>

#define rep(i,n) for (int i = 0; i < (n); i++)
#define FOR(i,a,b) for (int i=(a); i < (b); i++)
#define INF 100000000000
#define MOD 1000000007 //10^9+7
using namespace std;
using ll = long long;
using P = pair<int, int>;

// 負の数にも対応した % 演算
long long mod(long long val, long long m) {
    long long res = val % m;
    if (res < 0) res += m;
    return res;
}


int main()
{
    int n, m, x;
    cin >> n >> m >> x;
    vector<int> a(n+1,0);
    rep(i,m) {
        int tmp;
        cin >> tmp;
        a[tmp] = 1;
    }

    int ans0, ansN;
    int tmp = x;
    ans0 = ansN = 0;
    while (tmp != 0) {
        tmp--;
        if (a[tmp]) {
            ans0++;
        }
    }
    tmp = x;
    while (tmp != n) {
        tmp++;
        if (a[tmp]) {
            ansN++;
        }
    }

    cout << min(ans0, ansN);
    cout << endl;

    return 0;
}


Measured memory_bytes: 256
require "set"
x,n = gets.chomp.split(" ").map(&:to_i)
p_set = Set.new(gets.chomp.split(" ").map(&:to_i))

# xとpの制約から 0 <= ans <= 101
# pの制約から両端(0と101)はp_setの中には含まれない
ans = 0
diff = (x - ans).abs
1.upto(101) do |i|
  next if p_set.include?(i)
  tmp_diff = (x - i).abs
  if tmp_diff < diff
    ans = i
    diff = tmp_diff
  end
end
puts ans


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

using ll = long long;

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

    int N;
    cin >> N;

    int A[N];
    vector<int> plus;
    vector<int> minus;
    for (int i = 0; i < N; ++i) {
        int a;
        cin >> a;
        if (a >= 0) {
            plus.push_back(a);
        } else {
            minus.push_back(a);
        }
    }

    vector<pair<int, int>> res;

    int x1;
    int x2;
    if (plus.empty()) {
        sort(minus.rbegin(), minus.rend());
        x1 = minus[0];
        for (int i = 1; i < minus.size(); ++i) {
            res.emplace_back(x1, minus[i]);
            x1 -= minus[i];
        }
        x2 = 0;
    } else if (minus.empty()) {
        sort(plus.begin(), plus.end());
        x1 = plus[plus.size() - 1];
        x2 = plus[0];
        for (int i = 1; i < plus.size() - 1; ++i) {
            res.emplace_back(x2, plus[i]);
            x2 -= plus[i];
        }
        res.emplace_back(x1, x2);
    } else {
        x1 = plus[0];
        for (int i = 0; i < minus.size() - 1; ++i) {
            res.emplace_back(x1, minus[i]);
            x1 -= minus[i];
        }
        x2 = minus[minus.size() - 1];
        for (int i = 1; i < plus.size(); ++i) {
            res.emplace_back(x2, plus[i]);
            x2 -= plus[i];
        }
        res.emplace_back(x1, x2);
    }
    cout << x1 - x2 << '\n';
    for (auto r: res) {
        cout << r.first << ' ' << r.second << '\n';
    }

    return 0;
}


Measured memory_bytes: 3444
import numpy as np
n=int(input())
a=np.array(input().split(),dtype=np.int32)
b=np.array(input().split(),dtype=np.int32)
def f(t,a,b):
  power=1<<t
  mask=(power<<1)-1
  aa=a&mask
  bb=b&mask
  aa.sort()
  bb.sort()
  x1,x2,x3=(np.searchsorted(bb,v-aa).sum() for v in [power,power*2,power*3])
  zero_cnt=x1+(x3-x2)
  return (n*n-zero_cnt)%2
ans=0
for t in range(30):
  x=f(t,a,b)
  if x==1:
    ans+=1<<t
print(ans)


Measured memory_bytes: 38880
#include <iostream>
#include <cstdio>
#include <vector>
#include <string>
#include <algorithm>
#include <cmath>
#include <utility>
#include <set>
#include <map>
#include <deque>
#include <stack>

using namespace std;

 
int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    int n;
    cin >> n;
    vector<long long> a;
    vector<pair<long long, int> > b;
    b.push_back(make_pair((long long)0, -1));
    vector<long long> ans(n, 0), c(n+1, 0);
    for (int i = 0; i < n; ++i) {
        long long x;
        cin >> x;
        a.push_back(x);
        if (x > b.back().first)
            b.push_back(make_pair(x, i));
        int ind = lower_bound(b.begin(), b.end(), make_pair(x, -1)) - b.begin();
        ans[b[ind].second] += x - b[ind - 1].first;
        c[ind - 1]++;
    }
   // for (int i = 0; i < n; ++i)
   //     cout << ans[i] << ' ' << c[i] << "\n";
    for (int i = (int)b.size() - 1; i > 0; --i) {
        ans[b[i].second] += c[i] * (b[i].first - b[i-1].first);
        c[i-1] += c[i];
    }
    
    for (int i = 0; i < n; ++i)
        cout << ans[i] << "\n";
    cout.flush();
    cin >> n;
    return 0;
}


Measured memory_bytes: 5744
#include <bits/stdc++.h>
using namespace std;
 
int main(){
    int N;
    cin >> N;
    int d[100000];
    for(int i=0;i<N;i++)
        cin >> d[i];

    int index = N/2, b, r;
    // 昇順ソート
    sort(d, d + N);
    b = d[index - 1];
    r = d[index];

    cout << r - b << endl;

}

Measured memory_bytes: 640
#include<iostream>
#include<string>
#include<map>
#include<queue>
#include<vector>
#include<set>
#include<list>
#include<cstring>
#include<cctype>
#include<cmath>
#include<bitset>
#include<cstdio>
#include<cstdlib>
#include<ctime>
using namespace std;
using ll = long long;

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

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

    int cnt = 0,ans = 0;
    for(int i = 0;i < n;i++){
        if(a[i] == b[i]){
            cnt++;
            ans = max(ans,cnt);
            //cout << i << endl;
        } else cnt = 0;
    }
    
    if(ans >= 3)cout << "Yes" << endl;
    else cout << "No" << endl;
}

Measured memory_bytes: 3588
#include<bits/stdc++.h>
using namespace std;
#define mp make_pair 
#define mt make_tuple
#define fi first
#define se second
#define pb push_back
typedef pair<int,int> pii;
typedef long long ll;	

int n,x,y;
int sama = 0;

int main(){
	ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
	
	
	cin >> n;
	for (int i=0;i<n;i++){
		cin >> x >> y;
		if (x == y){
			sama++;
		}
		else {
			sama = 0;
		}
		if (sama == 3){
			break;
		}
	}
	if (sama == 3){
		cout << "Yes" << "\n";
	}
	else {
		cout << "No" << "\n";
	}
	return 0;
}

Measured memory_bytes: 3644
//#include <bits/stdc++.h>
#include <iostream>
#include <fstream>
#include <vector>
#include <string>
#include <cmath>
#include <algorithm>
#include <map>
#include <iomanip>
#include <stdlib.h>
#include <stdio.h>
#include <queue>
#include <deque>
#include <set>
#include <stack>
#include <time.h>
 
using namespace std;
 
typedef long long ll;
typedef long double ld;
typedef pair<int, int> Pii;
typedef pair<int, ll> Pil;
typedef pair<ll, ll> Pll;
typedef pair<ll, int> Pli;

#define fi first
#define se second
#define mp make_pair
 
const ll MOD = 1e9 + 7;
const ll MOD2 = 998244353;
const ll INF = 1ll << 60;
const double PI = 2 * asin(1);

void yes() {printf("yes\n");}
void no() {printf("no\n");}
void Yes() {printf("Yes\n");}
void No() {printf("No\n");}
void YES() {printf("YES\n");}
void NO() {printf("NO\n");}

int H, W, C[10][10];

int main(){
  scanf("%d%d", &H, &W);
  for (int i = 0; i < 10; i++){
    for (int j = 0; j < 10; j++){
      scanf("%d", &C[i][j]);
    }
  }
  
  for (int k = 0; k < 10; k++){
    for (int i = 0; i < 10; i++){
      for (int j = 0; j < 10; j++){
        C[i][j] = min(C[i][j], C[i][k] + C[k][j]);
      }
    }
  }

  int ans = 0;
  for (int i = 0; i < H * W; i++){
    int A; scanf("%d", &A);
    if (A == -1) continue;
    ans += C[A][1];
  }
  printf("%d\n", ans);
  
  return 0;
}


Measured memory_bytes: 384
n = int(input())
a = [[] for _ in range(n)]
for i in range(n):
    a_ = int(input())
    for _ in range(a_):
        a[i].append(list(map(int, input().split())))
ans = 0
for i in range(1, 2**(n)):
    b = str(bin(i, )[2:]).zfill(n)
    t = True
    for idx, j in enumerate(b):
        if not t: break
        if j == "0": continue
        for a_i in a[idx]:
            if b[a_i[0]-1] != str(a_i[1]):
                t = False
                break
    if t:
        ans = max(ans, b.count("1"))
print(ans)

Measured memory_bytes: 3064
#include<bits/stdc++.h>
//#include <iostream>
//#include <iomanip>
//#include <vector>
//#include <cmath>
//#include <algorithm>
using namespace std;


#define F first
#define PB push_back
#define MP make_pair

typedef unsigned long long ll;

ll p = pow(10, 9) + 7;







int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    int n;
    cin >> n;
    vector<double> prob(n + 1);
    for(int i = 1; i <= n; i++)
    {
        cin >> prob[i];
    }


    vector<double> dp(n + 1);
    dp[0] = 1;

    for(int i = 1; i <= n; i++)
    {
        for(int j = i; j >= 0; j--)
        {
            dp[j] = (j == 0 ? 0 : dp[j - 1] * prob[i] ) + dp[j] * (1 - prob[i]) ; // probability of j tails
        }

    }
    double ans = 0;
    for(int i = 1; i <= n; i++)
    {
        if(i > n - i)
        {
            ans += dp[i];
        }
    }
    cout <<setprecision(10) << fixed <<  ans << endl;

}


Measured memory_bytes: 256
import Data.Char
import Control.Monad
import Data.Maybe
import qualified Data.ByteString.Char8 as BS

readInt = fst . fromJust . BS.readInt
getInt = readInt <$> BS.getLine

main = do
    n <- getInt
    s <- getLine
    putStrLn $ map (rot n) s

rot n c = chr $ ord 'A' + ((ord c) - ord 'A' + n) `mod` 26

Measured memory_bytes: 1404
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(long long i = 0;i < n;i++)
#define repr(i, n) for(int i = n;i >= 0;i--)
#define Sort(v, n) sort(v, v+n);
#define VSort(v) sort(v.begin(), v.end());
#define ll long long
#define pb(a) push_back(a)
#define INF 999999999
#define cY cout<<"Yes";
#define cN cout<<"No";
#define cA(a) cout<<a;
const ll MOD = 1000000007;



int main() {
    int a,b;cin>>a>>b;
    if(a>12)cout<<b;
    else if(a>5)cout<<b/2;
    else cout<<0;
}

Measured memory_bytes: 256
#include<iostream>

using namespace std;
static const int MAX = 100;
static const int INFTY = (1<<21);
static const int WHITE = 0;
static const int GRAY = 1;
static const int BLACK = 2;

int n, M[MAX][MAX];

int prim() {
    int u, minv;
    int d[MAX], p[MAX], color[MAX];
    
    for (int i = 0; i < n; i++) {
        d[i] = INFTY;
        p[i] = -1;
        color[i] = WHITE;
    }
    
    d[0] = 0;
    
    while (1) {
        minv = INFTY;
        u = -1;
        
        for (int i = 0; i < n; i++) {
            if (minv > d[i] && color[i] != BLACK) {
                u = i;
                minv = d[i];
            }
        }
        
        if (u == -1) {
            break;
        }
        
        color[u] = BLACK;
        
        for (int v = 0; v < n; v++) {
            if (color[v] != BLACK && M[u][v] != INFTY) {
                if (d[v] > M[u][v]) {
                    d[v] = M[u][v];
                    p[v] = u;
                    color[v] = GRAY;
                }
            }
        }
    }
    
    int sum = 0;
    
    for (int i = 0; i < n; i++) {
        if (p[i] != -1) {
            sum += M[i][p[i]];
        }
    }
    
    return sum;
}

int main() {
    cin >> n;
    
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < n; j++) {
            int e;
            cin >> e;
            M[i][j] = (e == -1) ? INFTY : e;
        }
    }
    
    cout << prim() << endl;
    
    return 0;
}



Measured memory_bytes: 3092
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - //
// IN THE NAME OF GOD
#include <bits/stdc++.h>

#define ff first
#define endl '\n'
#define ss second
#define ll long long
#define pb push_back
#define ld long double
#define pii pair <int, int>
#define pll pair <long long, long long>

using namespace std;
ll int n;
bool chk(int x){
  int l = x % 10;
  while(x){
    if(x % 10 != l) return false;
    x /= 10;
  }
  return true;
}
int main(){
  //ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  cin >> n;
  while(true){
    if(chk(n)) return cout << n << '\n', 0;
    n++;
  }
}
//programmer: a_h_k_81
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - //


Measured memory_bytes: 256
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <deque>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>

using namespace std;

typedef long long ll;

#define MOD 1000000007

int main() {
  int n;
  cin >> n;
  n %= 10;
  string ans = "hon";
  if (n == 3) {
    ans = "bon";
  } else if (n == 0 || n == 1 || n == 6 || n == 8) {
    ans = "pon";
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 3596
#include <iostream>
#include <cstdio>
#include <string>
#include <vector>
#include <iterator>  // std::back_inserter()
#include <algorithm>  // std::copy()
#include <functional>  // std::greater<T>()
#include <utility>  // std::swap()
#include <numeric>  // accumulate(ALL(vec), 0)  0 は初期値
#include <cmath>
#include <climits>  // INT_MIN
#include <cctype>  // std::isdigit()
#include <ios>     // std::left, std::right
#include <iomanip> // std::setw(int), std::setfill(char)
using namespace std;

// typedef
typedef long long ll;
typedef unsigned long ul;
// #define int long long

// macro
#define ALL(obj) (obj).begin(), (obj).end()
#define REP(i, n) for (int i=0; i < (int)(n); i++)  // 0 ~ n-1
#define REPN(i, n) for (int i=1; i <= (int)(n); i++)  // 1 ~ n
#define DESCEND greater<int>()  // sort 降順 大きい順
#define UNIQUE(vec) (vec).erase(unique(ALL((vec))), (vec).end());  // 必ずsortを行なってから
#define MIN(vec) min_element(ALL((vec)))  // 値を取り出すときは * を先頭につける
#define MAX(vec) max_element(ALL((vec)))
#define IDX(vec, element_iter) distance((vec).begin(), element_iter)
#define SUM(vec) accumulate(ALL((vec)), 0)  // 0 は初期値
#define COPY(vec1, vec2) copy(ALL(vec1), back_inserter(vec2))  // vec1をvec2にコピーする vec2は空にしておく必要あり
#define zero_pad(num) setfill('0') << std::right << setw(num)  // 直後の要素をパディング
#define space_pad(num) setfill(' ') << std::right << setw(num)  // 直後の要素をパディング

// func declaration
template <class T> void print2DVec(vector< vector<T> >&);
template <class T> void calcVec(vector<T>&, int, char);
int char_to_int(const char);

// const
const int INF = 10000000;

/*MEMO
・辞書順
abc < abcd, atcoder < atlas
・イテレータ
std::vector<int>::iterator とタイプするのは面倒なので、
 通常は型推論の auto を使用する。
 auto iter = max_element(ALL(vec));
・2次元配列
vector<vector<int>> vec = {{1, 2, 3}, {4, 5, 6}}
・20×10の配列
vector<vector<int>> vec(20, vector<int>(10, 0));
・(n, m)の多次元配列
vector< vector<int> > vec(n, vector<int>(m, 0))  // 0で初期化
*/

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

    // input
    int N, M, X, sum;
    cin >> N >> M >> X;
    sum = N + M;
    
    // calculation
    if (N <= X && X <= sum) {
        cout << "YES" << "\n";
    } else {
        cout << "NO" << "\n";
    }
    
    
    return 0;
}


// function
template <class T> void print2DVec(vector< vector<T> >& vec) {
    REP(i, vec.size()) {
        REP(j, vec.front().size()) {
            cout << vec.at(i).at(j);
        }
        cout << endl;
    }
}

template <class T> void calcVec(vector<T> &vec, int num, char ch) {
    // vec全体への演算
    switch (ch) {
        case '+':
            REP(i, vec.size()) vec.at(i) += num; break;
        case '-':
            REP(i, vec.size()) vec.at(i) -= num; break;
        case '*':
            REP(i, vec.size()) vec.at(i) *= num; break;
        case '/':
            REP(i, vec.size()) vec.at(i) /= num; break;
        case '%':
            REP(i, vec.size()) vec.at(i) %= num; break;
        default:
            cout << "Incorrect Operator" << endl;
    }
}

int char_to_int(const char c) {
    if('0' <= c && c <= '9') return (c - '0');
    return -1;
}


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

/* short names and const
using ll = long long;
using vll = vector<long long>;
using df = vector<vll>;
df data(n, vll(m));
const ll MOD = 1e9 + 7;
const ll INF = 1e18;
*/

/* Boost!
#include <boost/algorithm/string/classification.hpp> // is_any_of
#include <boost/algorithm/string/split.hpp>
using boost::algorithm::split; // split(result, s, boost::is_any_of(","));
#include <boost/algorithm/string/join.hpp>
using boost::algorithm::join; // string s = join(arr, "");
#include <boost/algorithm/string/replace.hpp>
using boost::algorithm::replace_all; // replace_all(s, "AtCoder", "A");
#include <boost/range/algorithm.hpp> // boost::sort(arr)
#include <boost/multiprecision/cpp_int.hpp>
using boost::multiprecision::cpp_int;
*/

/* print(arr)
template <class T>
void print(vector<T> &vec) {
  for (auto& a : vec) {
    cout << a;
    if (&a != &vec.back()) cout << " ";
  }
  cout << endl;
}
*/

/* fast cin and precise cout
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  getline(cin, s);
  cout << fixed << setprecision(15);
*/

/* sum function
int sum(vector<int> &arr) {
  int res = accumulate(arr.begin(), arr.end(), 0);
  return res;
}
*/

int main() {
  string a;
  string b;
  cin >> a >> b;
  string c = a + b;
  int d = stoi(c);
  int sqr = sqrt(d);
  cout << (sqr * sqr == d ? "Yes" : "No");
}


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

const int maxn = 1e5 + 10;
int a[maxn];
int b[maxn];

int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	int n;
	cin >> n;
	for (int i = 0; i < n; i++)
		cin >> a[i];
	for (int i = n - 2; i >= 0; i--){
		if (a[i] >= a[i + 1])
			b[i] = b[i + 1] + 1;
	}
	cout << *(max_element(b, b + n));
}


Measured memory_bytes: 1024
#include <iostream>
#include <algorithm>
#include <utility>
#include <string>
#include <vector>
#include <set>
#include <stack>
#include <queue>
#include <map>
#include <math.h>
#include <string.h>
#include <iomanip>
#include <numeric>
#include <cstdlib>
#include <cstdint>
#include <cmath>
#include <functional>
#include <limits>

using namespace std;

using ll = long long;
using pll = pair<ll, ll>;
using vl = vector<ll>;
using vll = vector<vl>;
using vpll = vector<pll>;

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rrep(i, n) for (int i = ((int)(n)-1); i >= 0; i--)
#define Rep(i, n) for (long long i = 0; i< (long long)(n); i++)
#define RRep(i,n) for (long long i = ((long long)(n)-1); i>=0; i--)
#define all(v) (v).begin(),(v).end()

struct Edge{
    int to;
    int weight;
    Edge(int t, int w) : to(t), weight(w){ }
};

struct edge{
    int from;
    int to;
    int weight;
    edge(int f,int t,int w) : from(f), to(t), weight(w){ }
};

using Graph = vector<vector<Edge>>;
using graph = vector<vector<int>>;
using edges = vector<edge>;

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

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

template <class T>
T gcd(T a, T b){
    if( b==0 ) return a;
    return gcd(b, a%b);
}

template <class T>
T lcm(T a, T b){
    return (a*b)/gcd(a,b);
}

int INF = 1e9+7;

vector<int> dx = {-1,0,1,0};
vector<int> dy = {0,-1,0,1};

int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int h,w;
    cin >> h >> w;
    vector<string> a(h);
    rep(i,h) cin >> a[i];
    queue<pair<int,int>> que;
    rep(i,h) rep(j,w){
        if(a[i][j]=='#'){
            que.push(make_pair(i,j));
        }
    }
    vector<vector<int>> c(h,vector<int>(w,INF));
    while(!que.empty()){
        auto e = que.front();
        que.pop();
        int y = e.first;
        int x = e.second;
        if(c[y][x]==INF) c[y][x] = 0;
        rep(i,4){
            int ny = y+dy[i];
            int nx = x+dx[i];
            if(0<= ny && ny < h && 0<=nx && nx <w && c[ny][nx]>c[y][x]+1 && a[ny][nx]!='#'){
                c[ny][nx] = c[y][x] + 1;
                que.push(make_pair(ny,nx));
            }
        }
    }
    int ans = 0;
    rep(i,h) rep(j,w){
        chmax(ans,c[i][j]);
    }
    cout << ans << endl;
}

Measured memory_bytes: 13456
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  
  // ここにプログラムを記入
  string S ;
  cin >> S;

  if(S.find("7") != string::npos)
    cout << "Yes" << endl;
  else cout << "No" << endl;
  
  return 0 ;
}


Measured memory_bytes: 3576
import java.util.Scanner;
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        while (true) {
            int m = sc.nextInt();
            int f = sc.nextInt();
            int r = sc.nextInt();
            if (m == -1 && f == -1 && r == -1) {
                break;
            }
            if (m == -1 || f == -1) {
                System.out.println("F");
                continue;
            }
            if (m + f >= 80) {
                System.out.println("A");
                continue;
            }
            if (m + f >= 65 && m + f < 80) {
                System.out.println("B");
                continue;
            }
            if (m + f >= 50 && m + f < 65) {
                System.out.println("C");
                continue;
            }
            if (m + f >= 30 && m + f < 50) {
                if (r >= 50) {
                    System.out.println("C");
                    continue;
                } else {
                    System.out.println("D");
                    continue;
                }
            }
            if (m + f < 30) {
                System.out.println("F");
                continue;
            }
            
        }
        sc.close();
    }    
}


Measured memory_bytes: 26412
/**
       ������������    ������������
		Author : Avi J Patel
		University : DA-IICT
       ������������    ������������
**/
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define pb push_back
#define mp make_pair 
#define N 100000
#define ff first
#define ss second
#define si size()
#define mod 1000000007
#define large 10000000000000001
#define FAST ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0);srand(time(NULL));

int main()
{
	FAST;
	int p[3];
	cin>>p[0]>>p[1]>>p[2];
	sort(p,p+3);
	cout<<p[0]+p[1];
    return 0;
}








Measured memory_bytes: 256
import fractions
a,b,c,d = map(int, input().split())
ans = 0
num_gcd = fractions.gcd(c, d)
minL = c * d // num_gcd

tmp_minL = b // minL
tmp_c = b // c
tmp_d = b // d


tma_minL = (a - 1) // minL
tma_c = (a - 1) // c
tma_d = (a - 1) // d


left = tmp_c + tmp_d - tmp_minL
right = tma_c + tma_d - tma_minL


print(b - a + 1 - (left - right))


Measured memory_bytes: 5600
//@source: 
//@create: 19:14:01 Sunday 02/08/2020
//@author: nghethuat102
#include <bits/stdc++.h>
using namespace std;

#define len(x) (int) x.size()
#define all(x) x.begin(), x.end()
#define discrete(x) sort(all(x), x.erase(unique(all(x)), x.end())

void solve() {
    int n, k;
    cin >> n >> k;
    vector<int> a(n);
    for (int i = 0; i < n; ++i) {
        cin >> a[i];
    }
    long long lef = 1, rig = 1e18;
    long long ans = 0;
    while (lef <= rig) {
        long long mid = (lef + rig) >> 1;
        long double length = (long double) mid / 1000000.0;
        long long rk = k;
        for (int i = 0; i < n; ++i) {
            long long x = (long double) (a[i] - 0.000001) / length;
            rk -= x;
            if (rk < 0) {
                break;
            }
        }
        if (rk < 0) {
            lef = mid + 1;
        } else {
            rig = mid - 1;
            ans = ceil(length);
        }
    }
    cout << ans << "\n";
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    int t = 1;
    for (int it = 1; it <= t; ++it) {
        solve();
    }
    return 0;
}

Measured memory_bytes: 3992
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef double db;
int main(){
    int k;cin>>k;string s;cin>>s;
    if(s.length()<=k){
        cout<<s<<endl;
        return 0;
    }
    else{
        for(int i=0;i<k;i++){
            cout<<s[i];
        }cout<<"..."<<endl;
    }
}

Measured memory_bytes: 3604
#include<bits/stdc++.h>
 
using namespace std;
typedef long long int ll;
typedef unsigned long long int ull;
 
#ifdef _WIN32
    #define gx getchar
    #define px putchar
    #define ps putchar(' ')
    #define pn putchar('\n')
    #define DEBUG 1
#else
    #define gx getchar_unlocked
    #define px putchar_unlocked
    #define ps putchar_unlocked(' ')
    #define pn putchar_unlocked('\n')
    #define DEBUG 0
#endif
 
#define rep(i,j,k) for(ll i=0;i<j;i+=k)
//input
void scan(int &n)
{
    int sign = 1;
    n = 0;
    char c = gx();
    while( c < '0' || c > '9' )
    {
        if( c == '-' ) sign = -1;
        c = gx();
    }
    while( c >= '0' && c <= '9' ) n = (n<<3) + (n<<1) + c - '0', c = gx();  n = n * sign;
}
void lscan(ll &n)
{
    int sign = 1;
    n = 0;
    char c = gx();
    while( c < '0' || c > '9' )
    {
        if( c == '-' )
        sign = -1;
        c = gx();
    }
    while( c >= '0' && c <= '9' ) n = (n<<3) + (n<<1) + c - '0', c = gx();  n = n * (ll)(sign);
}
int sscan(char a[])
{
    char c = gx();
    while(c==' ' || c=='\n') c=gx();
    int i=0;
    while(c!='\n')a[i++] = c,c=gx();
    a[i]=0;
    return i;
}
int wscan(char a[])
{
    char c = gx();
    while(c==' ' || c=='\n') c=gx();
    int i=0;
    while(c!='\n' && c!=' ')a[i++] = c,c=gx();
    a[i]=0;
    return i;
}
 
//output
void print(int n)
{
    if(n<0)
    {
        n=-n;
        px('-');
    }
    int i=10;
    char o[10];
    do{o[--i] = (n%10) + '0'; n/=10;}while(n);
    do{px(o[i]);}while(++i<10);
}
void lprint(ll n)
{
    if(n<0LL)
    {
        n=-n;
        px('-');
    }
    int i=21;
    char o[21];
    do{o[--i] = (n%10LL) + '0'; n/=10LL;}while(n);
    do{px(o[i]);}while(++i<21);
}
void sprint(const char a[])
{
    const char *p=a;
    while(*p)px(*p++);
}
 
 
ll po(ll a, ll b, ll m)
{
	ll x=1,y=a;
	while(b > 0)
	{
		if(b%2 == 1)
		{
			x=(x*y);
			if(x>m) x%=m;
		}
		y = (y*y);
		if(y>m) y%=m;
		b /= 2;
	}
	return x;
}

ll divisor(ll n) 
{ 
    ll sum = 0; 
    for (ll i = 1; i <= n; ++i) 
        sum += (n / i) *(n/i+1)/2* i; 
    return sum; 
} 

typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
int main()
{
	ll n;
	cin>>n;
	cout<<divisor(n)<<endl;
	return 0;
}

Measured memory_bytes: 3636
#include <iostream>
#include <iomanip>
#include <math.h>

using namespace std;
int main()
{
	int n, i;
	double m, d, s;

	while( cin >> n )
	{
		if( 0 == n )
			break;

		d = 0;
		m = 0;
		for(i = 0; i < n; ++i){
			cin >> s;
			m += s;
			d += s*s;
		}
		m = m / n;
		d = sqrt( d/n - m*m );

		cout << fixed << setprecision(5) << d << "\n";
	}

	return 0;
}

Measured memory_bytes: 1288
#include <bits/stdc++.h>
#include <atcoder/all>

using namespace std;
using namespace atcoder;

int main(){
  int N,Q;
  cin>>N>>Q;
  dsu d(N);
  for(int i=0;i<Q;i++){
    int t,u,v;
    cin>>t>>u>>v;
    if(t==0){
      d.merge(u,v);
    }else{
      if(d.same(u,v)){
        cout<<1<<endl;
      }else{
        cout<<0<<endl;
      }
    }
  }
}

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

inline unsigned long long xor128() {
	static unsigned long long x = 123456789;
	static unsigned long long y = 362436069;
	static unsigned long long z = 521288629;
	static unsigned long long w = 88675123;
	unsigned long long t = x ^ (x << 11);
	x = y;
	y = z;
	z = w;
	return w = (w ^ (w >> 19)) ^ (t ^ (t >> 8));
}

int main() {
	ll N;
	cin >> N;
	vector<ll> a(N), b(N);
	for(ll i=0; i<N; i++) cin >> a[i];
	for(ll i=0; i<N; i++) cin >> b[i];

	map<ll,ll> am,bm;
	for(ll i=0; i<N; i++){
		am[a[i]]++;
		bm[b[i]]++;
	}
	for(auto&& pr:am){
		if(pr.second + bm[pr.first]> N){
			cout << "No\n";
			return 0;
		}
	}
	/*
	std::random_device seed_gen;
	std::mt19937 engine(seed_gen());
	shuffle(b.begin(), b.end(), engine);
	*/
	//shuffleの代わりにreverseもよさそう
	reverse(b.begin(), b.end());
	
	ll i=0,j=N-1;
	while(i<j){
		while(i<N && a[i]!=b[i])i++;
		while(j>=0 && a[i]==b[i])j--;
		if(i<j){
			swap(a[i],a[j]);
			swap(b[i],b[j]);
		}
	}

	while(i<N){
		ll r=xor128()%(N-1);
		if(r>=i)r++;
		swap(b[i],b[r]);
		if(r<i){
			if(a[i]==b[i] && a[r]==b[r]){
				i--;
				swap(a[i],a[r]);
				swap(b[i],b[r]);
			}else if(a[i]!=b[i] && a[r]!=b[r]){
				i++;
			}else if(a[r]!=b[r]){
				;
			}else if(a[i]!=b[i]){
				swap(a[i],a[r]);
				swap(b[i],b[r]);
			}
		}else{
			if(a[i]==b[i] && a[r]==b[r]){
				;
			}else if(a[i]!=b[i] && a[r]!=b[r]){
				i++;
				swap(a[i],a[r]);
				swap(b[i],b[r]);
			}else if(a[r]!=b[r]){
				swap(a[i],a[r]);
				swap(b[i],b[r]);
			}else if(a[i]!=b[i]){
				;
			}
		}
	}

	vector<pair<ll,ll>> ans(N);
	for(ll i=0; i<N; i++){
		ans[i]={a[i],b[i]};
	}

	sort(ans.begin(), ans.end());
	cout << "Yes\n";
	for(ll i=0; i<N; i++) cout << ans[i].second << " \n"[i==N-1];

	return 0;
}


Measured memory_bytes: 34196
#include<bits/stdc++.h>
using namespace std;
int n,i;
string s,t;
int main(){
	cin>>n;
	cin>>s>>t;
	for(i=1;i<=2*n;i++){
		if(i%2==1)
			cout<<s[i/2];
		else
			cout<<t[i/2-1];
	}
	return 0;
}

Measured memory_bytes: 256
#include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
#include<set>
#include<map>
using namespace std;


int main() {
    int a, b;
    cin >> a >> b;
    if(a <= 8 && b <= 8){
        cout << "Yay!";
    }
    else
    {
        cout << ":(";
    }
    
    cout << endl;
}


Measured memory_bytes: 256
<?php
    fscanf(STDIN, "%d %d", $n, $m);
    $aArray = explode(" ",trim(fgets(STDIN)));
    rsort($aArray);
    $stn = array_sum($aArray) / (4 * $m);
    
    $flg = 0;
    for($index = 0;$index < $m; $index++){
        if($aArray[$index] < $stn){
            $flg = 1;
            break;
        }
    }
    
    echo $flg === 0 ? "Yes" : "No";
    echo PHP_EOL;

?>

Measured memory_bytes: 4728
#include <iostream>
#include <vector>

using namespace std;

int main() {
    int n,z,w;
    cin >> n >> z >> w;
    vector<int> a(n);
    for (int i = 0; i < n; i++) {
        cin >> a[i];
    }

    if (n == 1) {
        cout << abs(a[0] - w) << endl;
        return 0;
    }

    cout << max(
            abs(a[n-2] - a[n - 1]),
            abs(a[n-1] - w)
    ) << endl;
    return 0;
}


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

namespace _20180307_AOJ
{
    class ALDS1_6A
    {
        static void Main(string[] args)
        {
            for (;;)
            {
                string line = Console.ReadLine();
                if (string.IsNullOrEmpty(line))
                {
                    break;
                }

                int n = int.Parse(line);
                int[] A = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray();
                int[] B = new int[n];
                int k = A.Max();
                CountingSort(A, B, k);
                //WriteArray(B);
                Console.WriteLine(string.Join(" ", B.Select(x => x.ToString()).ToArray()));
            }
        }

        static void WriteArray(int[] arr)
        {
            for(int i=0;i<arr.Length  -1;i++)
            {
                Console.Write(string.Format("{0} ", arr[i]));
            }
            Console.WriteLine(arr.Last());
        }

        static void CountingSort(int[] A, int[] B, int k)
        {
            int n = A.Length;
            int[] C = new int[k + 1];
            for(int j=0;j< n; j++)
            {
                C[A[j]]++;
            }

            for(int i=1;i<=k;i++)
            {
                C[i] += C[i - 1];
            }

            for(int j= n - 1; j>=0;j--)
            {
                B[C[A[j]] - 1] = A[j];
                C[A[j]]--;
            }
        }
    }
}



Measured memory_bytes: 214640
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int inf = 1000000000; //10^9

int main(){
    int N; cin >> N;
    vector<float> v(N);
    for(int i = 0; i < N; i++){
        cin >> v.at(i);
    }
    sort(v.begin(), v.end());
    for(int i = 0; i < N - 1; i++ ){
        v.at(i + 1) = (v.at(i) + v.at(i + 1)) / 2;
    }
    cout << v.at(N - 1) << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
 
using namespace std;
 
 
#define mod(cans) cans%10**9+7
#define debug(x) cout << "Debug" << x << "\n"
#define rep(i,n) for(int i=0;i<n;i++)
#define repr(i,n) for(int i=n-1;i>=0;i--)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define cin_pl(n,x) rep(i,n){cin>>x[i];}
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define prians(Answer) cout<<Answer<<"\n"
#define TF(X) X==1?cout<<"Yes\n":cout<<"No\n"
#define elcon else{continue;}
 
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<string> vs;
typedef vector<vector<int> > matrix;
typedef pair<int,int> pii;
typedef vector<pii> vpi;
typedef greater<int> gi;
typedef vector<unsigned> vu;


ll gcd(ll x, ll y) { return (y == 0) ? x : gcd(y, x % y); }
bool is_prime(const unsigned n){
    switch(n){
        case 0:
        case 1: return false;
        case 2: return true;
    }
 
 
    for(unsigned i=2;i<n;++i){
        if(n%i == 0) return false;
    }
 
    return true;
}

int main()
{
    int a,b;cin>>a>>b;
    if(a>8||b>8)cout<<":(";
    else
    {
        cout<<"Yay!";
    }
    
}


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

using namespace std;
typedef long long ll;
#define REP(i,n) for(int i=0; i<int(n); i++)
#define FOR(i,m,n) for(int i=int(m); i<int(n); i++)
#define ALL(obj) (obj).begin(),(obj).end()
#define VI vector<int>
#define VLL vector<long long>
#define VVI vector<vector<int>>
#define VVLL vector<vector<long long>>
#define VC vector<char>
#define VS vector<string>
#define VVC vector<vector<char>>
#define fore(i,a) for(auto &i:a)

typedef pair <int, int> P;
template<class T> bool chmax(T &a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> bool chmin(T &a, T b) { if (a > b) { a = b; return true; } return false; }
const int  INF = 2147483647;
const ll INFL = 9223372036854775807;
const ll mod = 1000000007;




int main() {

	int n;
	cin >> n;

	double ans = 0;

	REP(i, n) {
		double x;
		string u;
		cin >> x >> u;
		if (u == "BTC")ans += x * 380000.0;
		else ans += x;
	}

	cout << fixed << setprecision(15) << ans << endl;
	
	return 0;


}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){

  int N,M;
  cin>>N>>M;
  vector<int> A(N,0);
  int a,b;
  for(int i=0;i<M;i++){
    cin>>a>>b;
    a--;
    b--;
    A[a]++;
    A[b]++;
  }
  for(int i=0;i<N;i++){
    if((A[i]%2)==1){
      cout<<"NO"<<endl;
      return 0;
    }
  }
  cout<<"YES"<<endl;
  return 0;
}

Measured memory_bytes: 640
#include<iostream>
#include<vector>
#include<algorithm>
 
using namespace std;
 
struct DATA{
  int l_l, l_r;
  int n_l, n_r;
};
 
vector<DATA> data;

int MissingNumber(vector<int>&);
int Recursion(int);
 
int main(){
  int n, gcd;
  DATA data_;
  vector<int> num;
 
  while(1){
    cin >> n;
    if(n == 0) break;
 
    for(int i=0; i<n; ++i){
      cin >> data_.l_l >> data_.l_r >> data_.n_l >> data_.n_r;
      gcd = __gcd(data_.l_l, data_.l_r);
      data_.l_l /= gcd;
      data_.l_r /= gcd;
      if(data_.n_l != 0) num.push_back(data_.n_l);
      if(data_.n_r != 0) num.push_back(data_.n_r);
      data.push_back(data_);
    }

    cout << Recursion(MissingNumber(num)) << endl;
    num.clear();
    data.clear();
  }
  return 0;
}

int MissingNumber(vector<int>& data){
  sort(data.begin(), data.end());
  for(int i=0; i<data.size(); ++i){
    if(data[i] != i+1) return i;
  }
  return data.size();
}
 
int Recursion(int n){
  int g_l, g_r, gcd;
 
  if(data[n].n_l == 0) g_l = 1;
  else g_l = Recursion(data[n].n_l -1);
 
  if(data[n].n_r == 0) g_r = 1;
  else g_r = Recursion(data[n].n_r -1);

  gcd = __gcd(g_l * data[n].l_l, g_r * data[n].l_r);
  return g_l * ((g_r * data[n].l_r)/gcd) + g_r * ((g_l * data[n].l_l)/gcd);
}

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

int main() {
    int A, B, C, D, E, F;
    cin >> A >> B >> C >> D >> E >> F;
    int water = 0, sugar = 0;
    double max_per = 0;

    for (int i = 0; i <= F / (100 * A); i++) {
        for (int j = 0; j <= F / (100 * B); j++) {
            int w = 100 * A * i + 100 * B * j;
            if (w == 0) continue;
            int rest = min(E * (w / 100), F - w);
            for (int k = 0; k <= rest / C; k++) {
                int l = (rest - k * C) / D;
                int s = k * C + l * D;
                if ((double)s / w > max_per) {
                    max_per = (double)s / w;
                    water = w;
                    sugar = s;
                }
            }
        }
    }
    if (max_per == 0) {
        cout << A * 100 << " " << 0 << endl;
    } else {
        cout << water + sugar << " " << sugar << endl;
    }
    return 0;
}

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

int main(int argc, char *argv[])
{
	int i, j, len;
	int flag = 0;
	char input[30];

	scanf("%s", input);
	len = strlen(input);


	for (i = 0; i < len - 1; i++) {
		for (j = i + 1; j < len; j++) {
			if (input[i] == input[j]) {
				printf("no");
				exit(0);
			}
		}
	}
	printf("yes");

	return(0);
}

Measured memory_bytes: 128
import java.io.PrintWriter

fun main() {
    val pw = PrintWriter(System.out)

    val x = readInputLine().toLong()

    fun pow5(x: Long): Long = x * x * x * x * x

    for (a in LongRange(-1000L, 1000)) {
        val a5 = pow5(a)
        if (a5 >= x) {
            for (b in LongRange(0L, 1000L)) {
                val b5 = pow5(b)
                if (a5 - b5 == x) {
                    pw.println("$a $b")
                    pw.flush()
                    return
                }
                if (a5 - b5 < x) {
                    break
                }
            }
        } else {
            for (b in LongRange(-1000L, 0L).reversed()) {
                val b5 = pow5(b)
                if (a5 - b5 == x) {
                    pw.println("$a $b")
                    pw.flush()
                    return
                }
                if (a5 - b5 > x) {
                    break
                }
            }
        }
    }

    /*
    pw.println(ans)

    pw.flush()
     */
}

fun readInputLine(): String {
    return readLine()!!
}


Measured memory_bytes: 35304