akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define vi vector<int>
#define vvi vector<vector<int>>
#define pb push_back
#define pii pair<ll,ll>
#define tii tuple<ll,ll,ll>
#define all(v) (v).begin(),(v).end()
#define ll long long
#define ull unsigned long long
#define fastio ios_base::sync_with_stdio(false);cin.tie(nullptr);
#define ld long double
#define mod 1000000007
#define PI 3.141592653589793238
#define phi 1.638
#define eps 1e-9
#define endl "\n"
using namespace std;
using namespace __gnu_pbds;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;   

 
int main() {
    fastio
    ll n, k;
    cin>>n>>k;
    vector<ll> vec(n);
    for(auto& it : vec) cin>>it;

    sort(all(vec), greater<ll>());

    ll l = 1, r = 2e9;
	while(l<r) {
		ll mid = (l+r)/2;

		ll req = 0;
		for(int i = 0; i<n; ++i) {
			if(vec[i] <= mid) break;
			req += (vec[i]/mid);
		}

		if(req <= k) {
			r = mid;
		}
		else if(req > k){
			l = mid+1;
		}
	}
	cout<<l<<endl;
}

Measured memory_bytes: 4780
#pragma GCC optimize("Ofast")
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include <iomanip> // setprecision
#include <complex> // complex
#include <math.h> 
#include <functional>
using namespace std;
using ll = long long;
using P = pair<int,int>;
constexpr ll INF = 1e18;
constexpr int inf = 1e9;
constexpr ll mod = 1000000007;
constexpr ll mod2 = 998244353;
const int dx[8] = {1, 0, -1, 0,1,1,-1,-1};
const int dy[8] = {0, 1, 0, -1,1,-1,1,-1};
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
// ---------------------------------------------------------------------------


int main(){
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  int N;
  cin >> N;
  vector<int> A(N);
  for(int i=0; i<N; i++){
    cin >> A[i];
  }
  ll ans = 0;
  int mx = 0;
  for(int i=0; i<N; i++){
    chmax(mx,A[i]);
    ans += max(0,mx-A[i]);
  }
  cout << ans << "\n";
  return 0;
}

Measured memory_bytes: 3988
import { readFileSync } from "fs";

const read = () =>
  readFileSync(0, "utf8")
    .split("\n")
    .map((line) => line.split(" "));

const main = (input: string[][]) => {
  const N = Number(input[0][0]);

  const digitSum = Number(
    N.toString()
      .split("")
      .map(Number)
      .reduce((sum, cur) => sum + cur)
  );

  return N % digitSum === 0 ? "Yes" : "No";
};

console.log(main(read()));


Measured memory_bytes: 29572
// ※※※ 解答不能 ※※※
// TangentDay氏.
// https://atcoder.jp/contests/abc149/submissions/9216415
#include <bits/stdc++.h>
using namespace std;
using LL = long long;
using VL = vector<LL>;
#define repex(i, a, b, c) for(int i = a; i < b; i += c)
#define repx(i, a, b) repex(i, a, b, 1)
#define rep(i, n) repx(i, 0, n)
#define repr(i, a, b) for(int i = a; i >= b; i--)
#define ALL(c) (c).begin(), (c).end()

int main(){
    LL n, m;
    scanf("%lld %lld", &n, &m);
    VL a(n);
    rep(i, n) scanf("%d", &a[i]);
    sort(ALL(a));
    reverse(ALL(a));
    LL ok = 0, ng = 1e6;
    while(ng - ok > 1){
        LL x = (ok + ng) / 2;
        LL s = 0;
        int j = n - 1;
        rep(i, n){
            while(j >= 0 && a[i] + a[j] < x) j--;
            s += j + 1;
        }
        if(s >= m) ok = x;
        else       ng = x;
    }
    VL s(n + 1);
    rep(i, n) s[i + 1] = s[i] + a[i];
    LL c = 0, ans = 0;
    int j = n - 1;
    rep(i, n){
        while(j >= 0 && a[i] + a[j] < ok) j--;
        ans += (j + 1) * a[i] + s[j + 1];
        c += j + 1;
    }
    ans -= (c - m) * ok;
    printf("%lld\n", ans);
    return 0;
}

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

using uint = unsigned int;
using ll = long long;
using ull = unsigned long long;
#include <string>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <cmath>
#include <climits>
#include <bitset>
#include <array>
#include <deque>
#include <queue>
#include <map>
#include <set>
#define all(x) (x).begin(),(x).end()

const int MOD = 1e9 + 7;

void solve(){

}
int main(){
    int N;
    double ans = 0;
    cin >> N;
    for (int i = 0; i < N; ++i) {
        double x;
        string u;
        cin >> x >> u;
        if (u == "JPY") {
            ans += x;
        } else {
            ans += x*380000;
        }
    }
    printf("%9.4lf\n" , ans);


    return 0;
}


Measured memory_bytes: 384
/////////////////////////////////////////////template 1
#include <bits/stdc++.h>
#define MOD 1000000007
//for(int i=0; i<n; ++i)
using namespace std;
#define all(c) c.begin(), c.end()
#define watch(x) cout << (#x) << " is " << (x) << endl
#define ll long long

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

    ll n, a, b;
    cin >> n >> a >> b;
    ll s = 0ll + a + b;

    ll sol = (n / (a + b)) * a * 1ll;
    ll rem = n % (a + b) * 1ll;

    if (rem >= a)
        sol += a;
    else
        sol += rem;

    cout << sol << endl;

    return 0;
}

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

a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
li = [a,b,c,d,e]

m = min(li)

if n % m == 0:
    print(n // m + 4)
else:
    print(n // m + 5)

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

#define DEBUG 0

#if (DEBUG == 1)

#endif

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

  int64_t result = 0;

  int64_t Ll;
  int64_t Lh;
  for (int i = 0; i <= N; i++) {
#if (DEBUG == 1)
    cout << "* i = " << i << endl;
#endif
    if (i == 0) {
      result = 2;
    } else if (i == 1) {
      result = 1;
    } else {
      if (i == 2) {
	Lh = 1;
	Ll = 2;
      }
      result = Lh + Ll;
      Ll = Lh;
      Lh = result;
    }

#if (DEBUG == 1)
    cout << "  - result = " << result << endl;
#endif
  }

  cout << result << endl;

  return 0;
}


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

#define int long long

#define REP(i,n) for(int i=0;i<n;i++)
#define FOR(i,m,n) for(int i=m;i<n;i++)
#define FORR(i,m,n) for(int i=m;i>=n;i--)
#define pb(x) push_back(x) 
#define SORT(x) sort((x).begin(),(x).end())
#define INF 99999999999

using namespace std;

int32_t main(){
    int n;
    cin >> n;
    string s = to_string(n);

    string ans = "";
    int cnt = 1;
    while(1){
        int m = pow(-2, cnt);
        if(n % m){
            ans += '1';
            n -= (m / -2);
        }
        else{
            ans += '0';
        }

        cnt++;
        if(n == 0) break;
    }

    REP(i, ans.length()){
        cout << ans[ans.length()-1-i];
    }
    cout << endl;
}

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

int dp[41][450][450];
int a[40], b[40], c[40];

int main() {
	int n, m1, m2; scanf("%d%d%d", &n, &m1, &m2);
	rep(i, n)scanf("%d%d%d", &a[i], &b[i], &c[i]);
	memset(dp, 0x3f, sizeof(dp));
	dp[0][0][0] = 0;
	rep(i, n) {
		rep(j, 400)rep(k, 400) {
			dp[i + 1][j][k] = min(dp[i + 1][j][k], dp[i][j][k]);
			dp[i + 1][j + a[i]][k + b[i]] = min(dp[i + 1][j + a[i]][k + b[i]], dp[i][j][k] + c[i]);
		}
	}
	int Min = INF;
	for (int i = 1; i*m1 <= 400 && i*m2 <= 400; i++)
		Min = min(Min, dp[n][m1*i][m2*i]);
	if (Min == INF)puts("-1");
	else printf("%d\n", Min);
}

Measured memory_bytes: 32640
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int fact(int n){
  if(n==1) return 1;
  return n*fact(n-1);
}
int main(){
  string s;
  int a=-1, z=-1, ans=0;
    cin >> s;
      for(int i=0; i<s.size(); i++){
        if(a==-1 && s[i] == 'A')  a=i;
        else if(s[i] == 'Z') z=i;
      }

    cout << z-a+1 << endl;
}

Measured memory_bytes: 640
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner stdIn = new Scanner(System.in);
        int N = stdIn.nextInt();
        int M = stdIn.nextInt();
        int[] S =new int[N+1];
        int[] A = new int[N+1];
        long count=0;
        Map<Integer,Integer> map = new HashMap<Integer,Integer>();
        for(int i=1;i<N+1;i++){
            A[i]=stdIn.nextInt()%M;
        }
        for(int i=1;i<N+1;i++){
                S[i]=(A[i]+S[i-1])%M;
        }
        for(int i=0;i<N+1;i++){
           if(map.get(S[i])!= null)map.put(S[i],map.get(S[i])+1);
           else map.put(S[i],1);
           count +=map.get(S[i])-1;
        }
        System.out.println(count);
        
    }
}


Measured memory_bytes: 51696
m,k=map(int,input().split())
if k>=(2**m):
  print(-1)
elif m==1:
  if k==0:
    print(0,0,1,1)
  else:
    print(-1)
elif k==0:
  print(" ".join(map(str,[i//2 for i in range(2**(m+1))])))
else:
  l=[i+int(i>=k) for i in range(1,2**m-1)]
  ll=[i+int(i>=k) for i in range(2**m-2,0,-1)]
  ans=[k]+l+[k,0]+ll+[0]
  print(" ".join(map(str,ans)))

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

char T[200];

int main(){
  string S;
  cin >> S;
  rep(i, S.size()) T[i] = 'x';
  cout << T << endl;
}


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

void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}

template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifdef LOCAL
#define debug(x...) cerr <<"at line "<< __LINE__<<": [" << #x << "] = ["; _print(x)
#else
#define debug(x...)
#endif
 
/*
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;


template<class T> 
using ordered_set= tree<T, null_type, 
		less<T>, 
		rb_tree_tag, tree_order_statistics_node_update> ;

template<class T> 		
using ordered_mset= tree<T, null_type, 
		less_equal<T>, 
		rb_tree_tag, tree_order_statistics_node_update> ;
		
*/
 
/*
 
PBDS
-------------------------------------------------
			0 based indexing
-------------------------------------------------			 
1) insert(value)
2) erase(value)
3) order_of_key(value) // Number of items strictly smaller than value
4) *find_by_order(k) : K-th element in a set (counting from zero)
 
*/
 
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
 
//mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());	

void solve()
{
	int x,n;
	cin>>x>>n;
	
	set<int>st;
	
	for(int i=-100;i<=105;i++) st.insert(i);
	
	for(int i=0;i<n;i++)
	{
		int a;
		cin>>a;
		st.erase(st.find(a));
	}
	
	int mini=100000000;
	int num=0;
	
	for(auto it: st)
	{
		int temp=abs(x-it);
		
		if(mini>temp)
		{
			mini=temp;
			num=it;
		}
	}
	
	cout<<num;
}

int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0); cout.tie(0);
	
	solve();
	
	#ifdef LOCAL
	cerr<<"\nTime elapsed: " << 1000.0 * clock() / CLOCKS_PER_SEC << " ms\n";
	#endif
	
	
	return 0;
}


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

using namespace std;

struct UnionFind {
    vector<int> par;

    UnionFind(int N) : par(N) {
        for(int i = 0; i < N; i++) par[i] = i;
    }

    int root(int x) { 
        if (par[x] == x) return x;
        return par[x] = root(par[x]);
    }

    void unite(int x, int y) { 
        int rx = root(x); 
        int ry = root(y); 
        if (rx == ry) return; 
        par[rx] = ry; 
    }

    bool same(int x, int y) { 
        int rx = root(x);
        int ry = root(y);
        return rx == ry;
    }
};

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

    int N, M;
    cin >> N >> M;
    vector<int> P(N);
    for(int i = 0; i < N; i++){
        cin >> P[i];
    }

    UnionFind tree(N);

    for(int i = 0; i < M; i++) {
        int x, y;
        cin >> x >> y;
        tree.unite(x-1, y-1); 
    }

    // 这里用了permutation的性质
    int cnt = 0;
    for(int i = 0; i < N; i++) {
        if (tree.same(i, P[i]-1)) { 
            cnt++;
        }
    }
    cout << cnt << endl;
    return 0;
}

Measured memory_bytes: 1024
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<utility>
#include<map>
#include<queue>
#include<set>
#include<bitset>
#include<stdio.h>
#include<deque>
using namespace std;
#define rep(i, n) for(int i = 0; i < n; i++)
typedef long long ll;
 
int main()
{
    int a, b;
    cin >> a >> b;
    if(a == b){
        cout << a*2 << endl;
        return 0;
    }
    cout << max(a, b)*2-1 << endl;
    return 0;
}

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

long long x[1005];
long long y[1005];

int main() {
  int n;
  cin >> n;
  bool odd = false, even = false;
  for (int ni = 0; ni < n; ni++) {
    cin >> x[ni] >> y[ni];
    if (abs(x[ni] + y[ni]) % 2 == 0) even = true;
    else odd = true;
  }
  if (odd && even) {
    cout << -1 << endl;
    return 0;
  }
  if (even) {
    cout << 33 << endl;
    cout << "1 ";
    for (int ni = 0; ni < n; ni++) {
      x[ni]--;
    }
  } else {
    cout << 32 << endl;
  }
  for (int i = 31; i >= 0; i--) {
    cout << (1LL << i) << " ";
  }
  cout << endl;
  for (int ni = 0; ni < n; ni++) {
    if (even) {
      cout << "R";
    }
    long long l = 1LL << 31;
    while (l > 0) {
      if (x[ni] + y[ni] > 0) {
        if (x[ni] - y[ni] > 0) {
          cout << "R";
          x[ni] -= l;
        } else {
          cout << "U";
          y[ni] -= l;
        }
      } else {
        if (x[ni] - y[ni] > 0) {
          cout << "D";
          y[ni] += l;
        } else {
          cout << "L";
          x[ni] += l;
        }
      }
      l >>= 1;
    }
    cout << "\n";
  }
  return 0;
}

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


int main() {
	string s, s1 = "", s2 = "";
	cin >> s;
	int sz = s.size();
	for (int i = 0; i < sz; i++)
		if (i % 2)
			s1 += '0', s2 += '1';
		else
			s1 += '1', s2 += '0';
	int ans1 = 0, ans2 = 0;		
	for (int i = 0; i < sz; i++) {
		if (s[i] != s1[i])
			ans1++;
		if (s[i] != s2[i])
			ans2++;
	}
	cout << min(ans1, ans2);						
}







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

int f(int x){
    int cnt = 0;
    for(; x > 0 && x % 2 == 0; x /= 2){
        cnt++;
    }
    return cnt;
}

int main(){
    int minn = 2000000000;
    int n; cin >> n;
    
    rep(i,n){
        int tmp; cin >> tmp;
        minn = min(minn, f(tmp));
    }


    cout << minn << endl;
}

Measured memory_bytes: 256
import java.util.*;
 
class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		long a = sc.nextLong();
		long b = sc.nextLong();
		long c = sc.nextLong();
		
		if(a>=c) {
			System.out.println(a-c);
			System.out.println(b);
		}else {
			System.out.println(0);
			if(b>c-a) {
			System.out.println(b-c+a);
			}else {
				System.out.println(0);
			}
		}
			
		


		sc.close();
	}
}


Measured memory_bytes: 23124
#include <stdio.h>

int main(void){
  int n,m,sum=0,count=0;
  scanf("%d %d",&n,&m);
  
  int a[1000];
  for(int i=0;i<n;i++){
    scanf("%d",&a[i]);
    sum+=a[i];
  }
  
  for(int i=0;i<n;i++){
    if(a[i] >= (double)sum/(4*m)) count++;
  }
  
  if(count>=m){
    puts("Yes");
  }else{
    puts("No");
  }
  
  return 0;
}


Measured memory_bytes: 1628
import java.io.*;
import java.util.*;
import java.util.function.IntPredicate;
 
public class Main{
	public void solve(){
		int N = nextInt();
		int ans = lowerBound(0, N, v ->{
			int cur = v;
			int sum = N;
			while(sum != 0 && cur > 0){
				if(sum >= cur){
					sum -= cur;
					cur--;
				}else{
					sum = 0;
					break;
				}
			}
			return sum == 0;
		});
		int cur = ans;
		int sum = N;
		while(sum != 0 && cur > 0){
			if(sum >= cur){
				sum -= cur;
				out.println(cur);
				cur--;
			}else{
				out.println(sum);
				sum = 0;
				break;
			}
		}
	}

	public int lowerBound(int begin, int end, IntPredicate check){
		int l = begin - 1;
		int r = end;
		while(r - l > 1){
			int m = (r + l) / 2;
			if(check.test(m)){
				r = m;
			}else{
				l = m;
			}
		}
		return r;
	}
	
	
	private static PrintWriter out;
	public static void main(String[] args){
		out = new PrintWriter(System.out);
		new Main().solve();
		out.flush();
	}
	
	
	
	public static int nextInt(){
		int num = 0;
		String str = next();
		boolean minus = false;
		int i = 0;
		if(str.charAt(0) == '-'){
			minus = true;
			i++;
		}
		int len = str.length();
		for(;i < len; i++){
			char c = str.charAt(i);
			if(!('0' <= c && c <= '9')) throw new RuntimeException();
			num = num * 10 + (c - '0');
		}
		return minus ? -num : num;
	}
	
	public static long nextLong(){
		long num = 0;
		String str = next();
		boolean minus = false;
		int i = 0;
		if(str.charAt(0) == '-'){
			minus = true;
			i++;
		}
		int len = str.length();
		for(;i < len; i++){
			char c = str.charAt(i);
			if(!('0' <= c && c <= '9')) throw new RuntimeException();
			num = num * 10l + (c - '0');
		}
		return minus ? -num : num;
	}
	public static String next(){
		int c;
		while(!isAlNum(c = read())){}
		StringBuilder build = new StringBuilder();
		build.append((char)c);
		while(isAlNum(c = read())){
			build.append((char)c);
		}
		return build.toString();
	}
	
	
	private static byte[] inputBuffer = new byte[1024];
	private static int bufferLength = 0;
	private static int bufferIndex = 0;
	private static int read(){
		if(bufferLength < 0) throw new RuntimeException();
		if(bufferIndex >= bufferLength){
			try{
				bufferLength = System.in.read(inputBuffer);
				bufferIndex = 0;
			}catch(IOException e){
				throw new RuntimeException(e);
			}
			if(bufferLength <= 0) return (bufferLength = -1);
		}
		return inputBuffer[bufferIndex++];
	}
	
	private static boolean isAlNum(int c){
		return '!' <= c && c <= '~';
	}
}

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

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

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

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

struct UF{ //O(loga(n))
    int n;
    int m;
    vi d, r;
    UF(int n) : n(n), m(n), d(n, -1), r(n, 0){};
    int root(int i){
        if(d[i] < 0) return i;
        return d[i] = root(d[i]);
    }
    bool same(int x, int y){
        return root(x) == root(y);
    }
    bool unite(int x, int y){
        x = root(x);
        y = root(y);
        if(x == y) return false;

        if(r[x] < r[y]) swap(x, y);
        else if(r[x] == r[y]) r[x]++;
        d[x] += d[y];
        d[y] = x;
        --m;
        return true;
    }
    int size(int i){
        return -d[root(i)];
    }
    int size() {
        return m;
    }
};

using D = double;

void solve() {
    int n;
    cin >> n;
    if(n == 0) exit(0);
    using Point = tuple<D, D, D>;
    using Sphere = tuple<Point, D>;
    auto calcDist = [&](const Point& a, const Point& b){
        D x1, y1, z1; tie(x1, y1, z1) = a; 
        D x2, y2, z2; tie(x2, y2, z2) = b;
        return (D)sqrt((x1-x2)*(x1-x2)+(y1-y2)*(y1-y2)+(z1-z2)*(z1-z2)); 
    };
    auto calcDist2 = [&](const Sphere& a, const Sphere& b){
        Point p1, p2;
        D r1, r2;
        tie(p1, r1) = a;
        tie(p2, r2) = b;
        return max((D)0, calcDist(p1, p2) - r1 - r2);
    };
    vector<Sphere> s(n);
    rep(i, n) {
        D x, y, z, r;
        cin >> x >> y >> z >> r;
        auto p = tie(x, y, z);
        s[i] = tie(p, r);
    }
    using E = tuple<D, int, int>;
    vector<E> es;
    rep(i, n) rep(j, i) {
        auto d = calcDist2(s[i], s[j]);
        es.emplace_back(d, i, j);
    }
    sort(all(es));
    UF uf(n);
    D ans = 0;
    for(auto&& e: es) {
        int x, y;
        D d;
        tie(d, x, y) = e;
        if(uf.same(x, y)) continue;
        ans += d;
        uf.unite(x, y);
        // cout << " " << x << " " << y << " " << d << endl;
    }
    cout << ans << '\n';

}

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(3);
    while(1) solve();
    return 0;
}


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

int main() {
    int n; cin >> n;
    vector<int> h(n);
    rep(i, h.size()) cin >> h.at(i);

    int tmp = 0;
    int ans = 0;
    for (int i = 1; i < n; i++) {
        if (h.at(i-1) < h.at(i)) {
            ans = max(ans, tmp);
            tmp = 0;
        }
        else
            tmp++;
    }
    ans = max(ans, tmp);
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 640
n = int(input())
x = list(map(int, input().split()))
left = 0
right = 0
for i in x:
    right += i
reco = 0
i = 0
while right > left:
    left += x[i]
    right -= x[i]
    i += 1
    if right <= left:
        print(min(reco, 0-(right - left)))
        break
    else:
        reco = right - left



Measured memory_bytes: 3064
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;

public class Main {

	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String line = "";

		int[] occur = new int[100];
		//Arrays.fill(occur, 0);
		
		int max = 0;
		while ((line = br.readLine()) != null) {
			int i = ++occur[Integer.parseInt(line) - 1];
			if (i > max)
				max = i;
		}
		for (int i = 0; i < 100; i++) {
			if (occur[i] == max)
				System.out.println(i + 1);
		}
	}
}

Measured memory_bytes: 16864
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String N = sc.next();

        if (N.contains("9")) {
            System.out.println("Yes");
        } else {
            System.out.println("No");
        }
        sc.close();

    }

}

Measured memory_bytes: 21972
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include <cstdlib>

using namespace std;

int main(){

	string s;
	cin >> s;
	int count=0;
	for(int i = 0; i < s.size(); i++){
		if(s[i] == '+'){
			count++;
		}
		else{
			count--;
		}
	}
	cout << count <<endl;
	return 0;
}

Measured memory_bytes: 256
/**
 * Created by hiramekun at 07:48 on 2020-03-31.
 */
#include <bits/stdc++.h>

using namespace std;

using ll = long long;
using vl = vector<ll>;
using vvl = vector<vl>;
using vb = vector<bool>;
using P = pair<ll, ll>;
template<typename T> using pq = priority_queue<T>;
template<typename T> using minpq = priority_queue<T, vector<T>, greater<T>>;
template<typename T, typename K> using ump = unordered_map<T, K>;
const ll dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};
const ll mod = 1000000007;
const ll inf = ll(1e9);
const ll e5 = ll(1e5);
const ll ll_inf = ll(1e9) * ll(1e9);

#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)
#define repr(i, n) for(ll i = ll(n - 1); i >= 0; i--)
#define each(i, mp) for(auto& i:mp)
#define eb emplace_back
#define F first
#define S second
#define all(obj) (obj).begin(), (obj).end()

template<class T>
ostream &operator<<(ostream &out, const vector<T> &list) {
    ll n = list.size();
    rep(i, n) out << list[i] << ' ';
    return out;
}

template<class T>
istream &operator>>(istream &in, vector<T> &list) {
    ll n = list.size();
    rep(i, n) in >> list[i];
    return in;
}

template<class T>
ostream &operator<<(ostream &out, const vector<vector<T>> &list) {
    ll n = list.size();
    rep(i, n) out << list[i] << '\n';
    return out;
}

/* ------------- ANSWER ------------- */
/* ---------------------------------- */

void solve() {
    ll n, k;
    cin >> n >> k;
    ll ans = k;
    for (ll i = 1; i < n; ++i) {
        ans *= (k-1);
    }
    cout << ans << '\n';
}

int main() {
#ifdef MY_DEBUG
    while (true) {
#endif
        solve();
#ifdef MY_DEBUG
    }
#endif
    return 0;
}

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

int N;

int main() {
    cin >> N;
    vector<long long> b(N - 1);
    for (int i = 0; i < N - 1; i++) {
        cin >> b[i];
    }
    long long ans = b[0] + b[N - 2];
    for (int i = 0; i < N - 2; i++) {
        ans += min(b[i], b[i + 1]);
    }
    cout << ans << endl;
}



Measured memory_bytes: 256
#include<cstdio>
#include<vector>
#include<algorithm>
#include<iostream>
#include<cmath>
using namespace std;
double h(double a,double b,double c){
    double s=(a+b+c)*0.5;
    return sqrt(s*(s-a)*(s-b)*(s-c));
}
int main(){
    double a,l,x;
    while(cin>>a>>l>>x)
        cout<<fixed<<h(a,l,l)+h(l,(l+x)*0.5,(l+x)*0.5)*2<<endl;


    return 0;
}

Measured memory_bytes: 1280
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define all(x) (x).begin(),(x).end()
#define SZ(x) ((int)(x).size())
#define bit(n) (1<<(n))
using namespace std;
typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<bool> vb;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1;} return 0;}
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1;} return 0;}
int const INF = 1001001001;


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

ll N,M; cin >> N >> M;
vl A(M);
rep(i,M) cin >> A[i];

ll cnt = 0;
rep(i,M) cnt += A[i];

if(cnt > N) cout << -1 << endl;
else cout << N - cnt << endl;

return 0;
}

Measured memory_bytes: 3700
#include <iostream>
#include <cmath>
#include <vector>
#include <map>
#include <set>
#include <string>
#include <cstring>
#include <queue>
#include <ctime>
#include <cassert>
#include <cstdio>
#include <algorithm>
#include <unordered_set>
#include <unordered_map>
#include <bitset>

using namespace std;

#define fr first
#define sc second
#define mp make_pair
#define pb push_back
#define epr(...) fprintf(stderr, __VA_ARGS__)
#define db(x) cerr << #x << " = " << x << endl
#define db2(x, y) cerr << "(" << #x << ", " << #y << ") = (" << x << ", " << y << ")\n"; 
#define db3(x, y, z) cerr << "(" << #x << ", " << #y << ", " << #z << ") = (" << x << ", " << y << ", " << z << ")\n"
#define all(a) (a).begin(), (a).end()
#define sz(a) (int)a.size()

#define equal equalll
#define less lesss
const int N = 1e6 + 10;
const long long INF = 1e9 + 19;
typedef long long ll;

int n;
int a[N];

void read() {
    scanf("%d", &n);
    for (int i = 0; i < n; i++)
        scanf("%d", &a[i]);
}

void solve() {
    ll answer = 0;
    int last = 0;
    for (int i = 0; i < n; i++) {
        if (a[i] == (last + 1)) {
            last++;
        }
        else if (a[i] > (last + 1)) {
            answer += (a[i] - 1) / (last + 1);   
            last = max(last, 1);
        } 
        //db(answer);
    }

    cout << answer << endl;
}

void stress() {

}

int main(){
#ifdef MY_DEBUG
    freopen("in", "r", stdin);
    //freopen("out", "w", stdout);
#endif
    if (1) {
        int k = 1;
        for (int tt = 0; tt < k; tt++) {
            read();
            solve();
        }
    }
    else {
        stress();
    }

    return 0;
}


Measured memory_bytes: 640
#include <iostream>
#include <string>
#include <vector>
#include <math.h>
#include <stdio.h>
#include <algorithm>
#include <utility>
#include <functional>
#define rep(i,n) for(int i=0;i<(n);i++)
#define psortsecond(A,N) sort(A,A+N,[](const pii &a, const pii &b){return a.second<b.second;});
#define psortfirst(A,N) sort(A,A+N,[](const pii &a, const pii &b){return a.first<b.first;});
#define All(x) (x).begin(),(x).end()
using namespace std;
using pii  = pair<int,int>;
long long gcd(long long a, long long b){return (b == 0 ? a : gcd(b, a%b));}
long long lcm(long long a, long long b){return a*b/gcd(a,b);}
typedef long long ll;
#define MOD 1000000007
#define EPS 10e-8

int main(){
    ll A,B,C,D;
    cin >> A >> B >> C >> D;
    cout << (B-B/C-B/D+B/lcm(C,D))-((A-1)-(A-1)/C-(A-1)/D+(A-1)/lcm(C,D)) << endl;
}

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

typedef long long ll;
typedef unsigned long long ull;

int main() {
  ull n, m;
  cin >> n >> m;
  vector<ull> la;
  vector<ull> lb;
  int s = 0;
  lb.push_back(s);
  map<ull, int> counts;
  counts[s] = 1;
  for (int i = 0; i < n; ++i) {
    int a;
    cin >> a;
    la.push_back(a);
    s += a;
    assert(s >= 0);
    s %= m;
    assert(s >= 0);
    lb.push_back(s);
    if (counts.find(s) == counts.end()) {
      counts[s] = 0;
    }
    ++counts[s];
  }
  ull ans = 0;
  for (auto itr: counts) {
    ull c = itr.second;
    ans += (c-1)*c/2;
  }
  cout << ans << endl;
}



Measured memory_bytes: 5744
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i=0; i<(int)(n); ++i)
using ll = long long;
using vi = vector<int>;
using vl = vector<ll>;
using Graph = vector<vi>;  // vi <=> vl
using P = pair<int, int>;  // int <=> ll
const int MOD = 1e9+7;
const double EPS = 1e-9;

void solve() {
  int N; cin >> N;
  int a;
  int ans = 0;
  rep(i,N) {
    cin >> a;
    while (a%2 == 0) {
      a /= 2;
      ++ans;
    }
  }
  cout << ans << endl;
}

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


Measured memory_bytes: 256
import sys
sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))
class UnionFind():
    def __init__(self, n):
        self.parents = [-1] * n

    def find(self, x):
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]

    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)
        if x == y:
            return
        if self.parents[x] > self.parents[y]:
            x, y = y, x
        self.parents[x] += self.parents[y]
        self.parents[y] = x

    def size(self, x):
        return -self.parents[self.find(x)]

    def same(self, x, y):
        return self.find(x) == self.find(y)

def resolve():
    N, M, K = lr()
    uf = UnionFind(N)
    fr = [0]*N
    for i in range(M):
        a, b = lr()
        uf.union(a-1, b-1)
        fr[a-1] += 1
        fr[b-1] += 1
    ans = [uf.size(x) - fr[x] - 1 for x in range(N)]
    for i in range(K):
        c, d = lr()
        if uf.same(c-1, d-1):
            ans[c-1] -= 1
            ans[d-1] -= 1
    print(*ans, sep=' ')
resolve()

Measured memory_bytes: 14140
/* << IN THE NAME OF GOD >> */
#include <bits/stdc++.h>
using namespace std;



#define err(x) cerr << #x  << " = "<<  x << '\n'
#define out(x) cout << x << '\n'
#define forp(i, r, l) for(int i = int(r); i < int(l); i++)
#define forn(i, r, l) for(int i = int(r); i > int(l); i--)
#define FAST ios::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll ,ll> pll;
const int maxn = 1e5 + 120;
 

int n ,sum;
vector<int> v;
bool isprim(int a){
    
    forp(i ,2 ,sqrt(a) + 2)
        if(a % i == 0)
            return 0;
    return 1;

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

    for(int i = 11; n; i+=2)
        if(i % 5 == 1)
            if(isprim(i))
                v.push_back(i),n--;
    for(auto i : v)
        cout << i << " ";

   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++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
typedef long long int ll;
typedef unsigned long long int ull;

int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  int a=0,b,c;
  string s,t;
  cin >>s>>t;
  rep(i,s.size())if(s[i]==t[i])a++;
  cout <<a;
}

Measured memory_bytes: 3648
#include <bits/stdc++.h>
#include <math.h>
#define REP(i, n) for(int i = 0; i < (n); i++)
#define ALL(v) (v).begin(), (v).end()
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
const int INF = 1001001001;
const int mINF = -1001001001;


int main() {
char s[3][3];
REP(i,3) {
  REP(j,3) {
    cin >> s[i][j];
  }
}
REP(i,3) cout << s[i][i];
cout << endl;
return 0;
}


Measured memory_bytes: 256
#include <cstdio>
int main () {
	int a, b, c;
	scanf ("%d %d %d", &a, &b, &c);
	int ans = 0;
	while (a > 0) {
		a -= b;
		ans ++;
	}
	printf ("%d", c * ans);
	return 0;
} 

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

using namespace std;

struct Initializer {
  Initializer() {
    cin.tie(0);
    ios::sync_with_stdio(0);
    cout << fixed << setprecision(15);
  }
} initializer;

int main() {
  string s, r;
  cin >> s;
  r = s;
  reverse(s.begin(), s.end());
  for (char& c : s) {
    switch (c) {
    case 'b': c = 'd'; break;
    case 'd': c = 'b'; break;
    case 'p': c = 'q'; break;
    case 'q': c = 'p'; break;
    }
  }
  cout << (s == r ? "Yes" : "No") << endl;
}


Measured memory_bytes: 512
using System;
using System.Collections.Generic;
using System.Text;

namespace AtTest.C_Challenge
{
    class ABC_048
    {
        static void Main(string[] args)
        {
            Method(args);
            Console.ReadLine();
        }

        static void Method(string[] args)
        {
            string[] input = Console.ReadLine().Split(' ');
            int n = int.Parse(input[0]);
            long x = long.Parse(input[1]);
            input = Console.ReadLine().Split(' ');
            var array = new long[n];
            for (int i = 0; i < n; i++)
            {
                array[i] = long.Parse(input[i]);
            }

            long cnt = 0;
            for(int i = 1; i < n; i++)
            {
                long sum = array[i - 1] + array[i];
                if (sum <= x) continue;

                long margin = sum - x;
                if (array[i] >= margin)
                {
                    array[i] -= margin;
                }
                else
                {
                    array[i - 1] -= margin - array[i];
                    array[i] = 0;
                }
                cnt += margin;
            }
            Console.WriteLine(cnt);
        }
    }
}


Measured memory_bytes: 25436
import scala.io.StdIn

object Main extends App {
  val n = StdIn.readLine().toInt

  val a = Array.ofDim[Long](87)
  a(0) = 2
  a(1) = 1
  (2 to n).foreach{ i =>
    a(i) = a(i-1) + a(i-2)
  }
  
  println(a(n))
}

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

int int_len(int n) {
  int s=0;
  while(n!=0) s++, n/=10;
  return s;
}

int int_sum(int n) {
  int m=0,s=0,a=n;
  while(a!=0) s++, a/=10;
  for(int i=s-1;i>=0;i--) m+=n/((int)pow(10,i))-(n/((int)pow(10,i+1)))*10;
  return m;
}


int vec_sum(vector<int> v){
  int n=0;
  for(int i=0;i<v.size();i++) n+=v[i];
  return n;
}
///////////////////////////
int main() {
  int a=0,b=0,c=0,m=0,n=0,h=0,w=0,count=0,ans=0;
  string s;
  cin>>h>>w;
  vector<string> v(h);
  vector<vector<char>> f(h+2,vector<char>(w+2));
  rep(i,h) cin>>v[i];
  
  for(int i=0;i<h+2;i++){
    for(int j=0;j<w+2;j++){
      if(i==0 || j==0 || i==h+1 || j==w+1){
        f[i][j]='x';
      }else{
        f[i][j]=v[i-1][j-1];
      }
    }
  }
  
  for(int i=0;i<h;i++){
    for(int j=0;j<w;j++){
      for(int k=0;k<3;k++){
        for(int l=0;l<3;l++){
          if(f[i+k][j+l]=='#') count++;
        }
      }
      if(v[i][j]=='.'){
        char g='0'+count;
        v[i][j]=g;
      }
      count=0;
    }
  }
  rep(i,h) cout<<v[i]<<endl;
}
///////////////////////////

Measured memory_bytes: 256
def dist(x, p):
    return (x - p)**2


n = int(input())
x = [int(i) for i in input().split()]
index = len(x) // 2
new_x = sorted(x)
p1 = - (- sum(x) // len(x))
p2 = sum(x) // len(x)
ans = [0, 0]
for i in new_x:
    ans[0] += dist(i, p1)
    ans[1] += dist(i, p2)
print(min(ans))

Measured memory_bytes: 9208
#include<bits/stdc++.h>
using namespace std;
#define sz(a) int(a.size())

int main(){
	int n,m,x,y; cin>>n>>m>>x>>y;
	int maxx = -102;
	int miny = 102;
	for(int i =0 ; i< n; i++){
		int t; cin>>t;
		maxx = max(maxx, t);
	}
	for(int i = 0; i <m; i++){
		int t; cin>>t;
		miny = min(miny, t);
	}
	maxx++;
	//cout<<"maxx = "<<maxx<<endl;
	//cout<<"miny = "<<miny<<endl;
	for(int i = maxx; i <= miny; i++){
		if(x < i && i <= y){
			puts("No War\n");
			return 0;
		}
	}
	puts("War\n");
}


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

int main(){
	int k;
	scanf("%d", &k);
	char s[105];
	scanf("%s", &s);
	
	int length = strlen(s);
	s[k] = '\0';
	if(length > k){
		printf("%s...", s);
	}
	else{
		printf("%s", s);
	}	
	
	return 0;
}

Measured memory_bytes: 1708
fun main(args: Array<String>) {
	val (h, w) = readLine()!!.split(" ").map{ it.toInt() }
	val picture = Array<String>(h) {it -> readLine()!!}
	for (i in 1..(w + 2)) {
		print("#")
	}
	println("")
	for (i in 1..h) {
		print("#")
		print(picture[i - 1])
		println("#")
	}
	for (i in 1..(w + 2)) {
		print("#")
	}
	println("")
}


Measured memory_bytes: 37732
#include<stdio.h>



int main(void) {
	int x, y, z, e;

	while (1) {
		int  min = 1000001;
		scanf("%d", &e);
		if (e == 0)break;
		for (z = 0; z*z*z <= e; z++) {
			for (y = 0; y*y <= e; y++) {
				x = e - y*y - z*z*z;
				if (x >= 0 && x + y + z < min) min = x + y + z;
			}
		}
		printf("%d\n", min);
	}
	return 0;
}

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

using namespace std;

#define pii pair<int, int>
#define pll pair<ll, ll>

#define pb push_back
#define eb emplace_back
#define mp make_pair

#define fi first
#define se second

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

const int inf = (int)1e9 + 7;
const int maxn = (int)6e5 + 7;
const int lmaxn = (int)6e6 + 7;
const ll linf = (ll)1e16 + 7;

const ld eps = ld(1e-11);

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

ll gcd(ll a, ll b){
    while(b) a %= b, swap(a, b);
    return a | b;
}

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

string a;

bool ok(string x){
    vector < ll > cnt(27, 0);
    for(ll i : x)
        cnt[i - 'a']++;
    for(ll i : x){
        if(cnt[i - 'a'] > (ll)x.size() / 2)
            return 1;
    }
    return 0;
}

int main(){
  	ios_base::sync_with_stdio(0); cin.tie(0);
    cin >> a;
    for(ll len = 2; len <= min((ll)a.size(), 5ll); ++len){
        for(ll i = 0; i + len - 1 < (ll)a.size(); ++i){
            if(ok(a.substr(i, len))){
                cout << i + 1 << " " << i + len;
                return 0;
            }
        }
    }
    cout << -1 << " " << -1;
    return 0;
}



Measured memory_bytes: 512
import Control.Monad
import Data.List
main = do
  [n,m] <- map read . words <$> getLine
  ab <- replicateM n $ map read . words <$> getLine :: IO[[Int]]
  print $ f (sortOn head ab) 0 m 0

f xs y z p
  | y + last (head xs) < z = f (tail xs) (y + last (head xs)) z (p + product (head xs))
  | y < z && y + last (head xs) >= z = p + (z-y) * head (head xs)
  | otherwise = p


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

int main() {
    int N;
    cin >> N;
    
    if(N == 1) {
        cout << 1;
    }
    else if(64 <= N) {
        cout << 64;
    }
    for(int i = 1; i <= 5; i++) {
        if( (int)pow(2.0, i) <= N && N < (int)pow(2.0, i+1) ) {
            cout << (int)pow(2.0, i);
        }
    }

    cout << endl;
    return 0;
}

Measured memory_bytes: 384
#include <iostream>

#include <string>

using namespace std;
int main(){
	
string s;
getline(cin,s);
for(int i=0;i<s.length();i++){
	if(i==0){
		cout<<s[0];
	}
	if(s[i]==' '){
		cout<<s[i+1];
	}
}

}

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

int main(){
    ll n;
    cin >> n;
    string s[500];
    ll t[500];
    ll sum = 0;
    for (ll i = 0; i < n;i++)
    {
        cin >> s[i] >> t[i];
        sum += t[i];
    }
    string x;
    cin >> x;
    for (ll i = 0; i < n;i++)
    {
        sum -= t[i];
        if(x == s[i])
        {
            cout << sum;
            return 0;
        } 
    }
}

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

pub fn read<T: FromStr>() -> T {
  let stdin = stdin();
  let stdin = stdin.lock();
  let token: String = stdin
    .bytes()
    .map(|c| c.expect("failed to read char") as char)
    .skip_while(|c| c.is_whitespace())
    .take_while(|c| !c.is_whitespace())
    .collect();
  token.parse().ok().expect("failed to parse token")
}

use std::cmp::{max, min};

fn main() {
  let s = read::<String>();
  let mut s_vec = vec![];
  for i in s.chars() {
    s_vec.push(i);
  }
  let s_len = s_vec.len();
  let mut ans = vec![0; s_len];

  // 左から
  let mut cnt = 1;
  for i in 0..s_len - 1 {
    let current = s_vec[i];
    let next = s_vec[i + 1];
    if current == 'R' && next == 'L' {
      if cnt % 2 == 0 {
        ans[i + 1] += cnt / 2;
        ans[i] += cnt / 2;
      } else {
        ans[i + 1] += (cnt - 1) / 2;
        ans[i] += (cnt + 1) / 2;
      }
    }
    if current == 'R' && next == 'R' {
      cnt += 1;
    }
    if current == 'L' {
      cnt = 1;
    }
  }

  // 右から
  cnt = 1;
  for i in 1..s_len {
    let idx = s_len - i;
    let current = s_vec[idx];
    let next = s_vec[idx - 1];

    if current == 'L' && next == 'R' {
      if cnt % 2 == 0 {
        ans[idx - 1] += cnt / 2;
        ans[idx] += cnt / 2;
      } else {
        ans[idx] += (cnt + 1) / 2;
        ans[idx - 1] += (cnt - 1) / 2;
      }
    }
    if current == 'L' && next == 'L' {
      cnt += 1;
    }
    if current == 'R' {
      cnt = 1;
    }
  }

  for (i, v) in ans.iter().enumerate() {
    if i + 1 == s_len {
      println!("{}", v);
    } else {
      print!("{} ", v);
    }
  }
}



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

int main() {
  int n;
  cin >> n;
  vector<int> a(3);
  for (auto& e : a) {
    cin >> e;
  }
  vector<int> l(n);
  for (auto& e : l) {
    cin >> e;
  }
  int r = 1e9;
  vector<int> b(3);
  for (b[0] = 1; b[0] < (1 << n); b[0]++) {
    for (b[1] = 1; b[1] < (1 << n); b[1]++) {
      if (b[0] & b[1]) continue;
      for (b[2] = 1; b[2] < (1 << n); b[2]++) {
        if ((b[0] & b[2]) || (b[1] & b[2])) continue;
        int rt = 0;
        for (int i = 0; i < 3; i++) {
          int s = 0;
          for (int j = 0; j < n; j++) {
            if (b[i] & (1 << j)) {
              if (s) rt += 10;
              s += l[j];
            }
          }
          rt += abs(a[i] - s);
        }
        r = min(r, rt);
      }
    }
  }
  cout << r << endl;
}


Measured memory_bytes: 256
A,B,M=map(int,input().split())
a=input().split()
a=[int(p) for p in a]
b=input().split()
b=[int(p) for p in b]
minv=min(a)+min(b)

for i in range(M):
    q=input().split()
    q=[int(p)for p in q]
    minv=min(minv,a[q[0]-1]+b[q[1]-1]-q[2])
    
print(minv)

Measured memory_bytes: 18488
#include <bits/stdc++.h>
using namespace std;
int main (){
    long long n,i,sum=0;
    while (scanf("%lld",&n)!=EOF){
    sum=0;
    for (i=1;sum<n;i++){
        sum+=i;
    }
        printf("%lld\n",i-1);
    }
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=a;i<b;i++)
#define rep(i,b) FOR(i,0,b)
#define INF mugen
#define dump(x) cerr<<#x<<"="<<x<<endl
#define all(a) (a).begin(),(a).end()
typedef vector<int> vi;
typedef vector<vi> vii;
typedef vector<vii> viii;
typedef pair<int,int> P;
template <class T> void chmin(T & a, T const & b) { if (b < a) a = b; }
template <class T> void chmax(T & a, T const & b) { if (b > a) a = b; }
template <typename T>
string to_string(const T &n){ostringstream stm;stm << n;return stm.str();}
inline int toInt(string s) { int v; istringstream sin(s); sin >> v; return v; }
using ll = long long;
const ll mod = LLONG_MAX;


#define int long long

int V[51];
int ans=0LL;

signed main(){
    int N,K;
    cin>>N>>K;
    rep(i,N){
        cin>>V[i+1];
    }

    for(int l=0;l<=max(N,K);l++){
        for(int r=0;r<=max(N,K);r++){
            int temp=0;
            if(l+r>N)continue;
            if(l+r>K)continue;
            int cnt=0;
            priority_queue<int,vector<int>,greater<int>> que;

            while(!que.empty())que.pop();


            rep(i,l+1){
                    if(i==0)continue;
                    que.push(V[i]);
                    temp+=V[i];
                
            }
            for(int i=N+1;i>N-r;i--){

                    if(i==N+1)continue;
                    temp+=V[i];
                    que.push(V[i]);
                
            }


            for(int i=0;i<K-(l+r);i++){
                if(!que.empty()){
                    int x=que.top();
                    //dump(x);
                    if(x<0){
                        temp-=que.top();
                        que.pop();
                    }else{
                        break;
                    }
                }else break;
            }
            //cerr<<l<<" "<<r<<" "<<temp<<endl;
            ans=max(ans,temp);

        }
    }
    cout<<ans<<endl;


}

/*
6 4
-3 -5 -2 50 -100 -6

6 5
-6 -100 50 -2 -5 -3

6 100
-6 -100 50 -2 -5 -3
*/

Measured memory_bytes: 256
package main

import (
	"fmt"
	"sort"
)

func main() {
	var s string
	fmt.Scan(&s)
	
	alp := []string{"a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"}

	lists := make(map[string]bool,26)

	for i := 0; i< len(alp); i++ {
		lists[alp[i]] = false
    }
	
	for i := 0; i < len(s); i++ {
		lists[string(s[i])] = true
	}
	
	var ans []string
	for st,bl := range lists {
		if !bl {
			ans = append(ans,st)
		}
	}
	
	if len(ans) == 0 {
		fmt.Println("None")
		return
	}
	sort.Strings(ans)
	fmt.Println(ans[0])
}

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

bool KBjudge(string x) {
	
  string x_ = x;
  reverse(x.begin(), x.end());
  return (x_ == x);
}


int main(){
  
  double L;
  cin >> L;
  
  double a = L/3;
  a = pow(a, 3);
  printf("%.12f", a);
  //cout << a << endl;

  return 0;
}

Measured memory_bytes: 512