akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;

#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define RFOR(i, a, b) for (int i = (a); i >= (b); i--)
#define rep(i,n) for(int i=0; i<n; i++)
#define all(x) (x).begin(),(x).end()

typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> P;
typedef map<int,int> mp;

const int MOD = 1e9 + 7;


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

    string s;
    cin >> s;

    rep(i, s.size()){
        cout << 'x';
    }
    cout << endl;



    return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
struct Fast {
    Fast() {
        cin.tie(0);
        ios::sync_with_stdio(false);
        cout << fixed << setprecision(20);
    }
} fast;

long long mod = 1000000007;

long long modpow(long long m, long long n) {
    if (n == 0) return 1;
    if (n % 2 == 0) {
        long long t = modpow(m, n / 2);
        return (t * t) % mod;
    } else {
        return (modpow(m, n - 1) * m) % mod;
    }
}

void yes() {
    cout << "Yes" << endl;
    exit(0);
}
void no() {
    cout << "No" << endl;
    exit(0);
}
#define REP(i, n) for (long long i = 0; i < (n); i++)

struct LCA {
    vector<vector<int>> par;
    vector<int> d;
    int n;
    LCA(vector<vector<int>> graph, int root) {
        n = graph.size();
        par.resize(n, vector<int>(30));
        d.resize(n, 0);
        function<void(int, int, int)> dfs = [&](int c, int p, int depth) {
            d[c] = depth;
            par[c][0] = p;
            for (auto ch : graph[c]) {
                if (ch != p) dfs(ch, c, depth + 1);
            }
        };
        dfs(0, 0, 0);
        for (int j = 1; j < 30; j++) {
            REP(i, n) { par[i][j] = par[par[i][j - 1]][j - 1]; }
        }
    }
    int getdistance(int u, int v) { return (d[u] + d[v]) - 2 * (d[query(u, v)]); }
    int query(int u, int v) {
        if (d[u] > d[v]) {
            swap(u, v);
        }
        for (int i = 29; 0 <= i; i--) {
            if (d[u] <= d[par[v][i]]) {
                v = par[v][i];
            }
        }
        /* LCA */
        for (int i = 29; 0 <= i; i--) {
            if (par[v][i] != par[u][i]) {
                v = par[v][i];
                u = par[u][i];
            }
        }
        if (u == v) {
            return u;
        } else {
            return par[v][0];
        }
    }
};

struct UnionFind {
    vector<int> parent, size;
    UnionFind(int n) {
        parent.resize(n, -1);
        size.resize(n, 1);
    }
    void unite(int x, int y) {
        if (same(x, y)) {
            return;
        }
        x = root(x);
        y = root(y);
        if (size[x] <= size[y]) {
            swap(x, y);
        }
        parent[y] = x;
        size[x] += size[y];
    }
    bool same(int x, int y) { return (root(x) == root(y)); }
    int root(int x) {
        while (parent[x] != -1) {
            x = parent[x];
        }
        return x;
    }
    int getsize(int x) { return size[root(x)]; }
};
int n, m;
vector<vector<int>> graph;
void aoj(vector<int> bs) {
    REP(i, bs.size() - 1) { cout << bs[i] << " "; }
    cout << bs[bs.size() - 1] << endl;
}

signed main() {
    string s;
    cin >> s;
    if (s[0] == s[2]) {
        yes();
    } else {
        no();
    }
}

Measured memory_bytes: 256
n = gets.to_i
a = gets.split.map(&:to_i)
puts a.join(' ')
1.upto(n-1) do |i|
	v = a[i]
	j = i-1
	while j>=0 && a[j]>v
		a[j+1] = a[j]
		j-=1
	end
	a[j+1] = v
	puts a.join(' ')
end


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

int dp[1001][1001];
int main() {
	string a, b; cin >> a >> b;
	memset(dp, 0x3f, sizeof(dp));
	dp[0][0] = 0;
	rep(i, a.size() + 1)rep(j, b.size() + 1) {
		if (i < a.size())dp[i + 1][j] = min(dp[i + 1][j], dp[i][j] + 1);//delete
		if (j == b.size())continue;
		dp[i][j + 1] = min(dp[i][j + 1], dp[i][j] + 1);//insert
		if (i == a.size())continue;
		if (a[i] == b[j])dp[i + 1][j + 1] = min(dp[i + 1][j + 1], dp[i][j]);//sonomama
		dp[i + 1][j + 1] = min(dp[i + 1][j + 1], dp[i][j] + 1);//replace
	}
	printf("%d\n", dp[a.size()][b.size()]);
}

Measured memory_bytes: 7256
#include<iostream>
#include<cmath>
#include<cstdlib>
#include<string>
#include<cstring>
#include<algorithm>
#include<vector>
#include<map>
#include<iomanip>
#include<queue>

using namespace std;

typedef long long ll;

typedef std::pair<int, int> ipair;
bool lessPair(const ipair& l, const ipair& r){return l.second < r.second;}
bool morePair(const ipair& l, const ipair& r){return l.second > r.second;}

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;
}

const ll MOD = 1e9 + 7;
// const long long INF = 1LL<<60;
void add(long long &a, long long b) { a += b; if (a >= MOD) a -= MOD; }
void sub(long long &a, long long b) { a -= b; if (a < 0) a += MOD; }
void mul(long long &a, long long b) { a *= b; a %= MOD; }
ll llmin(ll a, ll b) { if (a < b) return a; else return b; }
ll llmax(ll a, ll b) { if (a < b) return b; else return a; }
ll llabs(ll a) { if (a >= 0) return a; else return - a; }
ll llmodpow(ll a, ll n) {
   if (n == 0) return 1;
   ll tmp = llmodpow(a, n / 2);
   mul(tmp, tmp);
   if (n & 1) mul(tmp, a);
   return tmp;
}

int main() {
   string S, T;
   cin >> S >> T;
   int cnt = 0;
   for (int i = 0; i < 3; i++) {
      if (S[i] == T[i]) cnt++;
   }
   cout << cnt << endl;
   return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
int main(){
  ll n,t,m;
  cin>>n>>t;
  vector<ll> a[4];
  for(int i=0;i<n;i++){
    ll w,v;
    cin>>w>>v;
    if(i==0) m=w;
    if(w==m) a[0].push_back(v);
    else if(w-1==m) a[1].push_back(v);
    else if(w-2==m) a[2].push_back(v);
    else a[3].push_back(v);
  }
  vector<vector<ll>> dp;
  dp.resize(4);
  for(int i=0;i<4;i++){
    sort(a[i].begin(),a[i].end());
    reverse(a[i].begin(),a[i].end());
    dp[i].resize(a[i].size()+1);
    dp[i][0]=0;
    for(int j=0;j<a[i].size();j++){
      dp[i][j+1]=dp[i][j]+a[i][j];
    }
  }
  ll ma=0;
  for(int i=min(t/(m+3),(ll)(a[3].size()));i>=0;i--){
    for(int j=min((t-i*(m+3))/(m+2),(ll)(a[2].size()));j>=0;j--){
      for(int k=min((t-i*(m+3)-j*(m+2))/(m+1),(ll)(a[1].size()));k>=0;k--){
        int l=min((t-i*(m+3)-j*(m+2)-k*(m+1))/m,(ll)(a[0].size()));
        ma=max(ma,dp[0][l]+dp[1][k]+dp[2][j]+dp[3][i]);
      }
    }
  }
  cout<<ma;
}

Measured memory_bytes: 256
// #include <bits/stdc++.h>
#include <iostream>
#include <map>
#include <cmath>
#include <ios>
#include <iomanip>
#include <algorithm>
#include <queue>
#include <stack>
#include <numeric>
// #include <windows.h>
using namespace std;
template<class T> using V = vector<T>;
template<class T> using VV = V<V<T>>;
template<class T> using VVV = V<VV<T>>;
template<class T1, class T2> using P = pair<T1, T2>;
using I = int;
using D = double;
using B = bool;
using C = char;
using S = string;
using LL = long long;
using LD = long double;
using ULL = unsigned long long;
using PII = P<I, I>;
using VPII = V<PII>;
using PLL = P<LL, LL>;
using VPLL = V<PLL>;
using VI = V<I>;
using VVI = VV<I>;
using VLL = V<LL>;
using VVLL = VV<LL>;
using VC = V<C>;
using VVC = VV<C>;
using VS = V<S>;
using VVS = VV<S>;
using VB = V<B>;
using VVB = VV<B>;
#define REP(type, i, n) for (type i = 0; i < (type)(n); ++i)
#define REP2(type, i, m, n) for (type i = (m); i < (type)(n); ++i)
#define REPR(type, i, n) for (type i = (n)-1; i >= 0; --i)
#define REPR2(type, i, m, n) for (type i = (n)-1; i >= (m); --i)
#define REPx(x, a) for(auto x : a)
#define ALL(a) a.begin(), a.end()
#define SORT(a) sort(ALL(a))
#define SORTR(a, type) sort(ALL(a), greater<type>())
#define SORTF(a, comp) sort(ALL(a), comp)
#define REVERSE(a) reverse(ALL(a))
#define SIZE(a, type) ((type)(a).size())
#define bit_search(bit, n) REP(LL, bit, 1LL<<(n))
#define bit_check(bit, i) ((bit>>(i)) & 1)
#define setpre(n) fixed << setprecision((n))
#define UNIQUE(a) do {SORT(a); (a).erase(unique(ALL(a)), (a).end());} while(0)
#define MAX(a) *max_element(ALL(a))
#define MIN(a) *min_element(ALL(a))
#define bisect_left(a, x) (lower_bound(ALL(a), (x)) - a.begin())
#define bisect_right(a, x) (upper_bound(ALL(a), (x)) - a.begin())
#define INPUT(a) REPx(&x, a) cin >> x;
#define INPUT2(a) REPx(&x, a) INPUT(x);
#define INPUTP(a) REPx(&x, a) cin >> x.first >> x.second;
#define ENDL cout << endl;

const int INF = 2e9;
// const LL INF = 9e18;
const LL MOD = 1e9+7;

template<class T> using PRIORITY_QUEUE = priority_queue< T, V<T>, greater<T> >;
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> inline void debug1(V<T> A){REP(int, i, SIZE(A, int)){if (A[i] == INF) cout << "I ";else cout << A[i] << " ";}ENDL}
template<class T> inline void debug2(VV<T> A){REP(int, i, SIZE(A, int)){REP(int, j, SIZE(A[i], int)){if (A[i][j] == INF) cout << "I "; else cout << A[i][j] << " ";}ENDL}}

template<class T>
T GCD(T a, T b)
{
  while(a % b)
  {
    T r = a % b;
    a = b;
    b = r;
  }
  return b;
}

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

int main()
{
  cin.tie(0);
  ios::sync_with_stdio(false);
  LL n, m;
  string s, t;
  cin >> n >> m >> s >> t;
  if (n < m)
  {
    swap(n, m);
    swap(s, t);
  }
  LL l = LCM(n, m);
  map<LL, char> ans;
  REP(LL, i, n) ans[i*l/n+1] = s[i];
  REP(LL, i, n)
  {
    if (!ans[i*l/m+1]) continue;
    else if (ans[i*l/m+1] == t[i]) continue;
    l = -1;
    break;
  }
  cout << l << endl;

  return 0;
}


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

using namespace std;

const int N = 200000 + 7;
int n, k, a[N], ans = 1;
int dmin[N], lmin = 1, rmin;
int dmax[N], lmax = 1, rmax;
int len[N];

void ins(int i) {
  while (lmin <= rmin && a[i] <= a[dmin[rmin]]) {
    rmin--;
  }
  while (lmax <= rmax && a[i] >= a[dmax[rmax]]) {
    rmax--;
  }
  dmin[++rmin] = i;
  dmax[++rmax] = i;
}

void del(int i) {
  if (lmin <= rmin && dmin[lmin] == i) {
    lmin++;
  }
  if (lmax <= rmax && dmax[lmax] == i) {
    lmax++;
  }
}

int rofl[N];

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

  cin >> n >> k;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
    a[i]++;
  }

  if (n == k) {
    cout << "1\n";
    return 0;
  }

  for (int i = n; i >= 1; i--) {
    if (a[i] <= a[i + 1]) {
      len[i] = 1 + len[i + 1];
    } else {
      len[i] = 1;
    }
  }

  for (int i = 1; i <= k; i++) {
    ins(i);
  }

  int ans = 1;
  rofl[1] = 1;

  for (int i = 1; i + k <= n; i++) {
    ins(i + k);

    ans += ((dmin[lmin] != i) || (dmax[lmax] != i + k));
    rofl[i + 1] = ans;

    del(i);
  }

  vector <int> ones;
  for (int i = 1; i <= n; i++) {
    if (len[i] >= k) {
      ones.push_back(i);
    }
  }

  for (int i = 0; i + 1 < (int) ones.size(); i++) {
    ans -= (rofl[ones[i]] != rofl[ones[i + 1]]);
  }

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


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

using namespace std;

const int kMaxN = 100000;

int dp[kMaxN + 1];

int main()
{
	ios::sync_with_stdio(0);
	cin.tie(0);
	string s;
	cin >> s;
	int n = s.size();
	for (int i = 0; i < n; ++i) {
		dp[i + 1] = dp[i];
		if (s[i] == '1') ++dp[i + 1];
	}
	for (int i = 0; i <= n / 2; ++i) {
		int s = dp[n - i] - dp[i];
		if (s == 0 || s == n - 2 * i) {
			cout << n - i << '\n';
			return 0;
		}
	}
	cout << (n + 1) / 2 << '\n';
	return 0;
}


Measured memory_bytes: 848
#define _CRT_SECURE_NO_WARNINGS

/* include ***********************/
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<math.h>

/* define *************************/
//for
#define REP(i,n) for(int i=0,i##_len=(int)(n);i<i##_len;i++)
#define REPS(i,n) for(int i=1,i##_len=(int)(n);i<=i##_len;i++)
#define RREP(i,n) for(int i=(int)(n)-1;i>=0;i--)
#define RREPS(i,n) for(int i=(int)(n);i>0;i--)
#define FOR(i,s,n) for(int i=(int)(s),i##_len=(int)(n);i<i##_len;i++)

//printf
#define PRINTD(d) printf("%d\n",(d))
#define PRINTL(d) printf("%lld\n",(d))

//memset
#define m0(s) memset(s,0,sizeof(s))
#define ml(s) memset(s,63,sizeof(s))
#define fill(s,c) memset(s,c,sizeof(s))

#define INF 1e9
#define MOD 1000000007

typedef long long ll;
typedef unsigned long long ull;

int diff[4][2] = {
	{ 0, -1 },
	{ -1, 0 },
	{ 1, 0 },
	{ 0, 1 },
};

int Min(int a, int b) {
	return (a)<(b) ? (a) : (b);
}
int  Max(int  a, int  b) {
	return (a) > (b) ? (a) : (b);
}
void Swap(int *a, int *b) {
	int tmp = *a;
	*a = *b;
	*b = tmp;
}void hSwap(int x[], int i, int j)
{
	int temp;

	temp = x[i];
	x[i] = x[j];
	x[j] = temp;
}

void ShowData(int x[], int left, int right)
{
	int i;
	for (i = left; i <= right; i++)printf("%d  ", x[i]);
	printf("\n");
}
void QSort(int x[], int left, int right, int n) {
	int i, j;	//左端,右端
	int pivot;	//軸

	i = left;
	j = right;
	pivot = x[(left + right) / 2];

	while (1) {
		if (n > 0) {				//n>0なら昇順、n<=0なら降順
			while ((x[i] < pivot) && (i <= right))i++;	//軸値より大きい要素
			while ((pivot < x[j]) && (i <= right))j--;	//軸値より小さい要素
		}
		else {
			while ((x[i] > pivot) && (i <= right))i++;	//軸値より小さい要素
			while ((pivot > x[j]) && (i <= right))j--;	//軸値より大きい要素
		}
		if (i >= j)	break;
		hSwap(x, i, j);
		i++; j--;
	}
	//ShowData(x, left, right);

	if (left < i - 1)QSort(x, left, i - 1, n);
	if (j + 1 <  right)QSort(x, j + 1, right, n);
}

int main() {
	int n,m,x,y;
	scanf("%d%d%d%d", &n, &m,&x,&y);
	int maxX = -999;
	int minY = 999;
	REP(i, n) {
		int xi;
		scanf("%d", &xi);
		maxX = Max(maxX, xi);
	}
	REP(i, m) {
		int yi;
		scanf("%d", &yi);
		minY = Min(minY, yi);
	}

	if (x >= y) {
		puts("War");
		return 0;
	}

	if (maxX >= minY) {
		puts("War");
		return 0;
	}

	if (maxX >= y || minY <= x) {
		puts("War");
		return 0;
	}
	puts("No War");
}

Measured memory_bytes: 128
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
#define INF (1<<30)
#define INFLL (1ll<<60)
typedef pair<int, int> P;
typedef pair<int, P> E;
#define MOD (1000000007ll)
#define l_ength size

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

void add_mod(ll& a, ll b){
	b += MOD;
	a += b;
	a %= MOD;
}

int memo[555][555],d[555][555];
bool done[555][555];

int dp(int l, int r){
	if(done[l][r]){
		return memo[l][r];
	}
	done[l][r] = true;
	memo[l][r] = d[l][r]+((l)?dp(l-1,r):0)+((r)?dp(l,r-1):0)-((l&&r)?dp(l-1,r-1):0);
	return memo[l][r];
}

int main(void){
	int n,m,q,i,l,r;
	fill(d[0],d[555],0);
	fill(done[0],done[555],false);
	cin >> n >> m >> q;
	for(i=0; i<m; ++i){
		cin >> l >> r;
		++d[n-l][r-1];
	}
	for(i=0; i<q; ++i){
		cin >> l >> r;
		cout << (dp(n-l,r-1)) << endl;
	}
	return 0;
}


Measured memory_bytes: 3584
n = int(input())
di = {'NULL': 0}
for _ in range(n):
    s = input()
    if s in di:
        di[s] += 1
    else:
        di[s] = 1
m = int(input())
for _ in range(m):
    t = input()
    if t in di:
        di[t] -= 1
    else:
        di[t] = -1
print(max(list(di.values())))

Measured memory_bytes: 3060
n = int(input())
numbers = list(map(int, input().split()))
flg = True
for number in numbers:
    if number % 2 == 0 and number % 3 != 0 and number % 5 != 0:
        flg = False
        break

if flg:
    print("APPROVED")
else:
    print("DENIED")

Measured memory_bytes: 3060
/* ***********************************************
Author        :dasinlsb
Created Time  :2018/5/31 19:06:10
File Name     :C:\dasin\duipai.cpp
************************************************ */

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define pb push_back
#define fi first
#define se second
const int N=100005;
int n,m,ed,tot,fir[N],p[N],q[N],vis[N];
struct Edge{int v,nxt;}e[N*2];
void addedge(int x,int y){
  e[++ed].v=y;e[ed].nxt=fir[x];fir[x]=ed;
}
void dfs(int x,int y){
  vis[x]=y;q[++tot]=p[x];
  for(int i=fir[x];i;i=e[i].nxt)if(!vis[e[i].v]){
    dfs(e[i].v,y);
  }
}
int main(){
  //freopen("C:/dasin/aa.in","r",stdin);
  int i,j;
  scanf("%d%d",&n,&m);
  for(i=1;i<=n;++i)scanf("%d",p+i);
  for(i=1;i<=m;++i){
    int x,y;scanf("%d%d",&x,&y);
    addedge(x,y);addedge(y,x);
  }
  int ans=0;
  for(i=1;i<=n;++i)if(!vis[i]){
    tot=0;
    dfs(i,i);
    for(j=1;j<=tot;++j)if(vis[q[j]]==i)++ans;
  }
  printf("%d\n",ans);
  return 0;
}


Measured memory_bytes: 5376
N, A, B, K = map(int, input().split())
MOD = 998244353

fact_N  = 1
for i in range(1, N+1):
    fact_N = (fact_N*i)%MOD
fact_inv = [0 for i in range(N+1)]
fact_inv[N] = pow(fact_N, MOD-2, MOD)
for i in range(N-1, -1, -1):
    fact_inv[i] = (fact_inv[i+1] * (i+1))%MOD

comb = [ (((fact_N*fact_inv[i])%MOD)*fact_inv[N-i])%MOD for i in range(N+1)]

ans = 0
for a in range(N+1):
    tmp = K-a*A
    if (tmp%B == 0) and (0 <= tmp//B) and (tmp//B <= N):
        b = tmp//B
        ans = (ans+comb[a]*comb[b])%MOD
print(ans)


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

void solve()
{
   return;
}
int main() {
    int a[5];
    for(int i=0;i<5;i++ ) cin>>a[i];
    for(int i=0;i<5;i++)
    if(a[i]==0)
        {
            cout<<i+1<<endl;
            return 0;
        }
}


Measured memory_bytes: 3564
#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() {
  int k, s, res = 0;
  cin >> k >> s;
  for (int x = 0; x <= k; ++x) {
    for (int y = 0; y <= k; ++y) {
      int z = s - x - y;
      if (0 <= z && z <= k) ++res;
    }
  }
  cout << res << endl;
}


Measured memory_bytes: 256
#include <iostream>

using namespace std;

bool is_palindorime(string S){
    for(int i = 0; i < S.size() / 2; i++){
        if(S[i] != S[S.size() - 1 - i]){
            return false;
        }
    }
    return true;
}

int main(void){
    // Your code here!
    string S;
    cin >> S;
    
    string without_x;
    for(int i = 0; i < S.size(); i++){
        if(S[i] != 'x'){
            without_x.push_back(S[i]);
        }
    }
    
    if(!is_palindorime(without_x)){
        cout << - 1 << endl;
        return 0;
    }
    
    int ans = 0;
    int left_ind = 0;
    int right_ind = S.size() - 1;
    int loop_num = without_x.size() / 2;
    if(without_x.size() %2 == 1){
        loop_num ++;
    }
    for(int i = 0; i < loop_num; i++){
        int left_x = 0;
        while(S[left_ind] == 'x'){
            left_ind ++;
            left_x ++;
        }
        int right_x = 0;
        while(S[right_ind] == 'x'){
            right_ind --;
            right_x ++;
        }
        ans += abs(right_x - left_x);
        left_ind ++;
        right_ind --;
    }
    
    cout << ans << endl;
}


Measured memory_bytes: 512
//インクルード
#include <cstdlib>
#include <iostream>
#include <string>
#include <vector>

//型宣言
typedef long long ll;
typedef unsigned long long ull;
typedef std::string string;
typedef ll answerType;

//変数宣言
ull A;
ull B;
ull C;
std::vector<ull> Ai;
std::vector<ull> Bi;
std::vector<ull> Ci;
answerType answer;

//関数のプロトタイプ宣言
//入力の取得
void getInput();
//答えを求める
answerType calcAnswer();

//メイン関数
int main() {
	//入力の取得
	getInput();

	//答え
	answerType answer = calcAnswer();

	//答えの出力
	std::cout << answer << std::endl;

	//正常終了
	return EXIT_SUCCESS;
}

//入力の取得
void getInput() {
	std::cin >> A >> B >> C;
}

//答えを求める
answerType calcAnswer() {
	struct tempStructure {
		ull A;
		ull B;
		ull C;
	};

	std::vector<tempStructure> temp;
	temp.push_back({A, B, C});

	ull tempA = A;
	ull tempB = B;
	ull tempC = C;

	for(int i=0; ; ++i) {
		if(tempA & 1 || tempB & 1 || tempC & 1) {
			return i;
		}

		ull tempA2 = tempA >> 1;
		ull tempB2 = tempB >> 1;
		ull tempC2 = tempC >> 1;

		tempA = tempB2 + tempC2;
		tempB = tempA2 + tempC2;
		tempC = tempA2 + tempB2;

		for(int j=0; j<temp.size(); ++j) {
			tempStructure temp2 = temp.at(j);
			if(temp2.A == tempA && temp2.B == tempB && temp2.C == tempC) {
				return -1;
			}
		}

		temp.push_back({tempA, tempB, tempC});
	}
}


Measured memory_bytes: 256
#include <stdio.h>
#include <string>
#include <cstring>
#include <stdlib.h>
#include <math.h>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <list>
#include <iterator>
#pragma warning(disable:4996)
 
typedef long long ll;
#define MIN(a, b) ((a)>(b)? (b): (a))
#define MAX(a, b) ((a)<(b)? (b): (a))
#define LINF 9223300000000000000
#define INF 2140000000
#define MOD 1000000007
using namespace std;


int main(int argc, char* argv[])
{
    long n, m;
    scanf("%ld%ld", &n, &m);

    vector<long> aa, bb;
    long i;
    for(i=0; i<n; i++) {
        long tmp;
        scanf("%ld", &tmp);
        aa.push_back(tmp);
    }
    sort(aa.begin(), aa.end());
    for(i=0; i<m; i++) {
        long tmp;
        scanf("%ld", &tmp);
        bb.push_back(tmp);
    }
    sort(bb.begin(), bb.end());

    vector<long> cc;
    set_intersection(aa.begin(), aa.end(), bb.begin(), bb.end(), back_inserter(cc));

    vector<long> dd;
    set_union(aa.begin(), aa.end(), bb.begin(), bb.end(), back_inserter(dd));

    printf("%ld %ld\n", (long)cc.size(), (long)dd.size() );
    for(i=0; i<(long)cc.size(); i++) {
        printf("%ld\n", cc[i]);
    }

    for(i=0; i<(long)dd.size(); i++) {
        printf("%ld\n", dd[i]);
    }

    return 0;
}




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

typedef long long ll;

const int siz=2000;

int top[siz][siz];
int bottom[siz][siz];
int left[siz][siz];
int right[siz][siz];
int center[siz][siz];
  
long long lamp(std::vector<std::vector<char>> area) {

  int h = area.size();
  int w = area.at(0).size();
  /*
  for(int i =0;i<h;i++) {
    for(int j=0;j<w;j++) {
      std::cout << area[i][j];
    }
    std::cout << std::endl;
  }
  */

  for(int i=0;i<h;i++) {
    //std::cout << i << std::endl;
    for(int j=0;j<w;j++) {
      // center
      if(area[i][j] == '.') {
        center[i][j]= 1;
      }
      
      // left
      if(j==0 || area[i][j-1] == '#') {
      } else {
	    left[i][j] += left[i][j-1] + 1;
      }
      
      // top
      if(i==0 || area[i-1][j] == '#') {
      } else {
        top[i][j] += top[i-1][j] + 1;
      }     
    }
  }
  
  int ans = 0;
  
  for(int i=h-1;i>=0;i--) {
    for(int j=w-1;j>=0;j--) {
      // right
      if(j==w-1 || area[i][j+1] == '#') {
      } else {
	    right[i][j] += right[i][j+1] + 1;
      }
      //std::cout << right[i][j] <<std::endl;
      
      // bottom
      if(i==h-1 || area[i+1][j] == '#') {
      } else {
	    bottom[i][j] += bottom[i+1][j] + 1;
      }
      //std::cout << bottom[i][j];
      
      if(area[i][j] != '#') {
        //std::cout << i << " " << j << "->" << center[i][j] << " " << left[i][j] << " " << top[i][j] << " " <<  right[i][j] << " " << bottom[i][j] << std::endl;
	    ans = std::max(ans, center[i][j] + top[i][j] + bottom[i][j] + left[i][j] + right[i][j]);
      }
    }
  }
  
  return ans;
  
  //return -1;
}

int main() {
  long long h, w;
  std::cin >> h;
  std::cin >> w;
  std::string s;
  std::getline(std::cin, s);
  
  std::vector<std::vector<char>> area(h);
  for(ll i=0;i<h;i++) {    
    std::getline(std::cin, s);
    std::vector<char> v(w);
    area[i] = v;
    for(ll j=0;j<w;j++) {
      area[i][j] = s[j];
    }
  }
  std::cout << lamp(area);
}

Measured memory_bytes: 89716
using System;
using System.Collections.Generic;
using System.Linq;

class Program
{
    static void Main(string[] args)
    {
        var input = Console.ReadLine().Split(' ');
        var diceNum = int.Parse(input[0]);
        var useNum = int.Parse(input[1]);

        var maxValues = Console.ReadLine().Split(' ');

        double firstExp = Calculation.AddNumbers(double.Parse(maxValues[0])) / double.Parse(maxValues[0]);
        double sumExp = 0;
        double maxExp = 0;


        for(var i = 0; i < useNum; i++)
        {
            sumExp += Calculation.AddNumbers(double.Parse(maxValues[i])) / double.Parse(maxValues[i]);
        }

        maxExp = sumExp;

        for(var i = 0; i < diceNum - useNum; i++)
        {
            sumExp -= firstExp;
            sumExp += Calculation.AddNumbers(double.Parse(maxValues[i + useNum])) / double.Parse(maxValues[i + useNum]) ;
            firstExp = Calculation.AddNumbers(double.Parse(maxValues[i + 1])) / double.Parse(maxValues[i + 1]);

            if(sumExp > maxExp)
            {
                maxExp = sumExp;
            }
        }

        Console.WriteLine(maxExp);
        Console.Read();
    }
}



class Calculation
{
    public static double AddNumbers(double n)
    {
        double result = 0;
        result = (n * (n + 1))/ 2;
        return result;

    }
}

Measured memory_bytes: 28636
#include <set>
#include <map>
#include <cstdio>
#include <cctype>
#include <vector>
#include <algorithm>
#include <unordered_map>
//#define mp std::make_pair
#define pr std::pair<int,int>
#define pc putchar
#define gc() getchar()
typedef long long LL;
const int N=2e5+5;

int A[N],vis[N];
std::unordered_map<LL,int> mp;

inline int read()
{
	int now=0,f=1;register char c=gc();
	for(;!isdigit(c);c=='-'&&(f=-1),c=gc());
	for(;isdigit(c);now=now*10+c-'0',c=gc());
	return now*f;
}

int main()
{
	int n=read(),ans=0;
	for(int i=1; i<=n; ++i) ++mp[A[i]=read()];
	std::sort(A+1,A+1+n);
	for(int i=n; i; --i)
		if(mp[A[i]])
			for(int j=31; ~j; --j)
			{
				LL pw=1ll<<j;
				if(pw==A[i]+A[i] && mp[A[i]]>=2) {mp[A[i]]-=2, ++ans; break;}
				else if(pw!=A[i]+A[i] && pw>A[i] && mp[pw-A[i]]) {--mp[pw-A[i]], --mp[A[i]], ++ans; break;}
			}
	printf("%d\n",ans);

	return 0;
}

Measured memory_bytes: 34704
#include<stdio.h>

int solve(int,int);

int A[2000],m[2000];
int n,q;

int main(){
    int i;

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

    scanf("%d",&q);
    for(i=0;i<q;i++){
        scanf("%d",&m[i]);
    }

    for(i=0;i<q;i++){
        if(solve(0,m[i])==1) printf("yes\n");
        else printf("no\n");
    }
return 0;
}

int solve(int i,int m){
    int res;
    if(m==0) return 1;
    else if(i>=n) return 0;
    res = solve(i+1,m) || solve(i+1,m-A[i]);
    return res;
}

Measured memory_bytes: 588
#include <bits/stdc++.h>
#define ll long long
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define repi(i,a,b) for(ll i=(ll)(a);i<(ll)(b);i++)
#define repm(i,a,b) for(ll i=(ll)(a);i>(ll)(b);i--)
#define all(v) v.begin(), v.end()
#define rall(x) (x).rbegin(),(x).rend()
#define pll pair<long long,long long>
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define vc vector<char>
#define vvc vector<vc>
using namespace std;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<long long>;
using vvll = vector<vll>;
using vb =vector<bool>;
using vvb=vector<vb>;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
//snippets:tmp,cl,cvl,cs,co,coy,con,cov,setp

int main(){
    const ll mod=998244353;
    ll n;
    cin >> n;
    ll s;
    cin >> s;
    vll a(n);
    rep(i, n) cin >> a[i];
    vvll dp(n,vll(s+1,0));
    if(a[0]<s+1)dp[0][a[0]]=1;
    dp[0][0]=2;
    repi(i,1,n){
        rep(j,s+1){
            dp[i][j]+=dp[i-1][j]*2;
            dp[i][j]%=mod;
            if(j+a[i]<s+1){
                dp[i][j+a[i]]+=dp[i-1][j];
                dp[i][j+a[i]]%=mod;
            }
        }
    }
    cout << dp[n-1][s]%mod << endl;
}

Measured memory_bytes: 73748
#include "bits/stdc++.h"
using namespace std;

const int INF = 1e9+5;

void print2D(std::vector<std::vector<long long> > A){
	for(int i = 0; i<A.size(); i++){
		for(int j = 0; j<A[i].size(); j++){
			cout<<A[i][j]<<" ";
		}
		cout<<endl;
	}
	cout<<endl;
}

void print(std::vector<double> V){
	for(auto v: V)
		cout<<v<<" ";
	cout<<endl;
}


using ll = long long;

double solution(vector<double> A){
	// print(A);
	// cout<<endl;

	vector<double> dp(A.size()+1, 0);

	// dp[i] - total probability of having i heads so far

	dp[0] = 1;
	// print(dp);

	for(int i = 0; i<=A.size(); i++){
		for( int j = i+1; j>=0; j--){
			dp[j] = (j == 0 ? 0 : dp[j-1] * A[i]) + dp[j] * (1-A[i]);
		}

		// cout<<i<<" ; "; print(dp);
	}

	double ans = 0;

	for(int i = A.size(); i>A.size()/2; --i){
		ans+=dp[i];
	}

	// print(dp);

	return ans;


}

int main(){

	int n;
	cin>>n;

	std::vector<double> v(n);
	for(int i = 0; i<n; i++){
		double p_heads;
		cin>>p_heads;
		v[i] = p_heads;
	}

	//  my solution
	
	double ans = solution(v);

	// cout<<ans<<endl;
	printf("%.10lf\n", ans);

	return 0;
	


}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int a[]={0,1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
int n;
int main(){
	scanf("%d",&n);
	printf("%d",a[n]);
	return 0;
}

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

int main() {
  int n, k;
  cin >> n >> k;
  vector<int>list(n);
  for(int i = 0; i < k; i++)
  {
    int d;
    cin >> d;
    for(int j = 0; j < d; j++)
    {
      int di;
      cin >> di;
      list[di - 1] = 1;
    }
  }
  int cnt = 0;
  for(int i = 0; i < n; i++)
  {
    if(list[i] == 0)
    {
      cnt++;
    }
  }
  cout << cnt << endl;
}


Measured memory_bytes: 3596
#bfs
import queue

h, w = map(int, input().split())
c = [list(input()) for i in range(h)]
visited = [[0 for i in range(w)] for j in range(h)]
q = queue.Queue()
ans = 0
            
dyx = [[0, 1], [1, 0], [-1, 0], [0, -1]]

for i in range(h):
    for j in range(w):
        if c[i][j] == '.':
            q.put([i, j])
            visited[i][j] = 1
            while not q.empty():
                now = q.get()
                for k in range(4):
                    y = now[0] + dyx[k][0]
                    x = now[1] + dyx[k][1]
                    if 0 <= y < h and 0 <= x < w:
                        if c[y][x] != '#' and visited[y][x] == 0:
                            visited[y][x] = visited[now[0]][now[1]] + 1
                            q.put([y, x])
        for l in range(h):
            for m in range(w):
                ans = max(ans, visited[l][m])
        queue = []
        visited = [[0 for i in range(w)] for j in range(h)]
print(ans-1)

Measured memory_bytes: 59092
using System;
using System.Collections.Generic;
using System.Linq;
 
class MainClass {
  public static void Main (string[] args) {
    //入力
    var O = Console.ReadLine().ToCharArray();
    var E = Console.ReadLine().ToCharArray();
    var ans = new List<char>();

    for(var i = 0; i < O.Length; i++){
      ans.Add(O[i]);
      if(i >= E.Length) break;
      ans.Add(E[i]);
    }

    ans.ForEach(Console.Write);
    Console.WriteLine("");

  }
}


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

int n, k;

int main(){

    cin >> n >> k;

    char str[n];

    cin >> str;

    char c;
    int i=0;
    while (str[i])
    {
        c=str[i];
        if(i == k-1)
            putchar (tolower(c));
        else
            putchar(c);
        i++;
    }

    return 0;
}


Measured memory_bytes: 256
import itertools

A = int(input())
B = int(input())
C = int(input())
X = int(input())

a_values = map(lambda n: n * 500, range(A + 1))
b_values = map(lambda n: n * 100, range(B + 1))
c_values = map(lambda n: n * 50, range(C + 1))

sums = map(sum, itertools.product(a_values, b_values, c_values))
print(len([s for s in sums if s == X]))


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

using namespace std;

using int64 = long long;
const int64 INF = 1LL << 60;

const int mod = 1e9 + 7;

template< typename Data, typename T >
struct ReRooting {

  struct Node {
    int to, rev;
    Data data;
  };

  using F1 = function< T(T, T) >;
  using F2 = function< T(T, int, int, Data) >; // ret, src, to, data

  vector< vector< Node > > g;
  vector< vector< T > > ldp, rdp;
  vector< int > lptr, rptr;
  const F1 f1;
  const F2 f2;
  const T ident;

  ReRooting(int n, const F1 &f1, const F2 &f2, const T &ident) :
      g(n), ldp(n), rdp(n), lptr(n), rptr(n), f1(f1), f2(f2), ident(ident) {}

  void add_edge(int u, int v, const Data &d) {
    g[u].emplace_back((Node) {v, (int) g[v].size(), d});
    g[v].emplace_back((Node) {u, (int) g[u].size() - 1, d});
  }

  T dfs(int idx, int par) {

    while(lptr[idx] != par && lptr[idx] < g[idx].size()) {
      auto &e = g[idx][lptr[idx]];
      ldp[idx][lptr[idx] + 1] = f1(ldp[idx][lptr[idx]], f2(dfs(e.to, e.rev), idx, e.to, e.data));
      ++lptr[idx];
    }
    while(rptr[idx] != par && rptr[idx] >= 0) {
      auto &e = g[idx][rptr[idx]];
      rdp[idx][rptr[idx]] = f1(rdp[idx][rptr[idx] + 1], f2(dfs(e.to, e.rev), idx, e.to, e.data));
      --rptr[idx];
    }
    if(par < 0) return rdp[idx][0];
    return f1(ldp[idx][par], rdp[idx][par + 1]);
  }

  vector< T > solve() {
    for(int i = 0; i < g.size(); i++) {
      ldp[i].assign(g[i].size() + 1, ident);
      rdp[i].assign(g[i].size() + 1, ident);
      lptr[i] = 0;
      rptr[i] = (int) g[i].size() - 1;
    }
    vector< T > ret;
    for(int i = 0; i < g.size(); i++) {
      ret.push_back(dfs(i, -1));
    }
    return ret;
  }
};

int main() {
  int N, M;
  cin >> N >> M;
  auto f1 = [&](int64 a, int64 b) {
    return a * b % M;
  };
  auto f2 = [&](int64 a, int64 b, int c, int64 d) {
    return (a + 1) % M;
  };
  ReRooting< int64, int64 > tap(N, f1, f2, 1);
  for(int i = 1; i < N; i++) {
    int x, y;
    cin >> x >> y;
    --x, --y;
    tap.add_edge(x, y, 1);
  }
  auto ret = tap.solve();
  for(auto &p :ret) cout << p << endl;
}


Measured memory_bytes: 36212
#include <iostream>
#include <cstdio>
#include <cmath>
#include <string>
#include <algorithm>
using namespace std;
#define mp  std::make_pair
#define ll long long int
#define abs(n) ((n>0)?(n):((n)*(-1)))
#define FOR(i,a,b) for(int i=(a);i<=(b);++i)
#define REP(i,n) FOR(i,0,(n)-1)
#define VREP(v) for(std::vector<ll>::iterator itr = (v).begin(); itr != (v).end();itr++)
#define VALL(v) ((v).begin(),(v).end())
#define errln(v) cerr << (v) << endl;
#define println(v) cout << (v) << endl;

int main(int argc, const char * argv[]) {
	char c;
	int sum=0;
	REP(i,4){
		scanf("%c",&c);
		sum += ((c=='+')? 1 : -1);
	}
	println(sum);
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define int long long
#define rep(i, l, r) for(register int i = l; i <= r; ++ i)
using namespace std;
const int N = 200010, mod = 1e9 + 7;
inline int read()
{
    register char cc = getchar(); register int cn(0), flus(1);
    while(cc < '0' || cc > '9') {if(cc == '-') flus = - flus; cc = getchar();}
    while(cc >= '0' && cc <= '9') {cn = cn * 10 + cc - '0'; cc = getchar();}
    return cn * flus;
}
signed main()
{
	int n = read(), k = read(), ans(0);
	rep(i, k, n + 1)
	{
		ans += ((2 * n - i + 1) * i / 2 - (i - 1) * i / 2 + 1);
		//ans += 1;
		ans %= mod;
	}
	printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 3756
#include<bits/stdc++.h>
#define int long long
//#include<ext/pb_ds/assoc_container.hpp>
using namespace std;
//using namespace __gnu_pbds;
const int inf=0x3f3f3f3f;
const double eps=1e-6;
const int mod=1000000007;
typedef long long ll;
int modpow(int x,int y,int md=mod){if(y==0)return 1;int ret=modpow(x,y>>1,md);ret=(ll)ret*ret%md;if(y&1)ret=(ll)ret*x%md;return ret;}
int ans=0;
string getstr(string &_s,int _l,int _r){
	string ret="";
	for(int _i=_l;_i<=_r;_i++)ret.push_back(_s[_i]);
	return ret;
}
int a[200005],r[200005];
void msort(int s,int t){
    if(s==t) return ;
    int mid=s+t>>1;
    msort(s,mid),msort(mid+1,t);
    int i=s,j=mid+1,k=s;
    while(i<=mid&&j<=t)
        if(a[i]<=a[j]) r[k++]=a[i++];
        else r[k++]=a[j++],ans+=(ll)mid-i+1;
    while(i<=mid) r[k]=a[i],k++,i++;
    while(j<=t) r[k]=a[j],k++,j++;
    for(int i=s;i<=t;i++) a[i]=r[i];
}
void solve(string s){
	for(int i=1;i<=s.size();i++)a[i]=(s[i-1]=='A');
	msort(1,s.size());
}
string ss;
string s;
signed main(){
	cin>>ss;
	int i;
	for(i=0;i<ss.size();i++){
		if(i+1!=ss.size()&&ss[i]=='B'&&ss[i+1]=='C'){
			i++;
			s.push_back('D');
		}else{
			s.push_back(ss[i]);
		}
	}
	int l=0;
	for(;l<s.size();){
		while(l<s.size()&&s[l]!='A'&&s[l]!='D')l++;
		if(l==s.size())break;
		int r=l;
		while(r<s.size()&&(s[r]=='A'||s[r]=='D'))r++;
		solve(getstr(s,l,r-1));
		l=r;
	}
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 4108
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <queue>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <complex>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <fstream>
#include <stdio.h>

using namespace std;

//conversion
//------------------------------------------
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<double> VEC;
typedef vector<VEC> MAT;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef pair<int, PII> TIII;
typedef long long LL;
typedef vector<LL> VLL;
typedef vector<VLL> VVLL;
//container util

//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
#define MT(a,b,c) MP(a, MP(b, c))
#define T1 first
#define T2 second.first
#define T3 second.second

//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define MOD 1000000009LL
 
LL k[100][10000];

int main(){
    while(1){
        int n;
        cin >> n;
        if(n==0)return 0;
        VI v;
        int s=0;
        REP(i,n){
            int tmp;
            cin >> tmp;
            v.PB(tmp);
        }
        SORT(v);
        FOR(i, 1, n-1)s+=v[i];
        cout << s/(n-2) << endl;
    }
}

Measured memory_bytes: 1220
#include <bits/stdc++.h>
#define endl '\n'
#define ll long long
#define double long double
using namespace std;

ll sum, x, n, m;

int main()
{
    //freopen("input.txt", "r", stdin);
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    cin >> n >> m;
    for (int i = 1; i <= m; i ++)
    {
        cin >> x;
        sum += x;
    }
    if (sum > n)
        cout << -1;
    else
        cout << n - sum;
    return 0;
}


Measured memory_bytes: 3656
#include <stdio.h>
#include <math.h>
 
using namespace std;
 
int main(){
    int n;
    double students[1000] = {0},sum,m,div;
 
    while(true){
        scanf("%d",&n);
        if(n == 0) break;
        div = sum = 0;
        for(int i = 0; i < n; i++){
            scanf("%lf",&students[i]);
            sum += students[i];
        }
        m = sum/n;
        for(int i = 0; i < n;i++){
            div += (students[i] - m)*(students[i] - m);
            students[i] = 0;
        }
        printf("%.8lf\n",sqrt(div/n));
    }
}


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

using lint = long long;
int K;
vector<lint> A;

int main()
{
    cin >> K;
    A.resize(K);
    for (int i=0; i<K; i++) cin >> A[i];
    reverse(A.begin(), A.end());

    lint lower = 2;
    lint upper = 2;
    for (auto a : A)
    {
        lint lower_new = (lower + a - 1) / a * a;
        lint upper_new = upper / a * a + a - 1;
        if (lower_new < lower || upper_new < upper || lower_new > upper_new)
        {
            cout << "-1" << endl;
            return 0;
        }
        lower = lower_new;
        upper = upper_new;
    }
    cout << lower << " " << upper << endl;
    return 0;
}

Measured memory_bytes: 1024
#include<iostream>
#include<algorithm>
#include<cstring>
#include<cstdio>
#include<bitset>
#include<cmath>
#include<queue>
#include<map>
#include<set>
#define int long long

using namespace std;

int read()
{
	int ans=0,f=1;
	char c=getchar();
	while(c>'9'||c<'0'){if(c=='-')f=-1;c=getchar();}
	while(c>='0'&&c<='9'){ans=ans*10+c-'0';c=getchar();}
	return ans*f;
}

int k,n;

signed main()
{
	k=read();
	for(int i=1;i<=1000000;++i)
	{
		n=(n*10+7)%k;
		if(n==0)
		{
			printf("%lld\n",i);
			return 0;
		}
	}
	printf("-1\n");
	return 0;
}

Measured memory_bytes: 3728
/*
LANG:C++
PROB:

*/
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <functional>
#include <iostream>
#define mp make_pair
#define mt make_tuple
#define fi first
#define se second
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define forn(i, n) for (int i = 0; i < (int)(n); ++i)
#define for1(i, n) for (int i = 1; i <= (int)(n); ++i)
#define ford(i, n) for (int i = (int)(n) - 1; i >= 0; --i)
#define fore(i, a, b) for (int i = (int)(a); i <= (int)(b); ++i)


using namespace __gnu_pbds;
using namespace std;


typedef tree<int, null_type, less<int>, rb_tree_tag,
            tree_order_statistics_node_update>
    ordered_set;

typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<pii> vpi;
typedef vector<vi> vvi;
typedef long long i64;
typedef vector<i64> vi64;
typedef vector<vi64> vvi64;
typedef pair<i64, i64> pi64;
typedef double ld;
typedef unsigned long long ui64;

template<class T> bool uin(T &a, T b) { return a > b ? (a = b, true) : false; }
template<class T> bool uax(T &a, T b) { return a < b ? (a = b, true) : false; }


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

    // ifstream fin(".in");
    // ofstream fout(".in");
double p;
i64 n;
cin>>n;
vpi v(n);

forn(i,n)
{
i64 a;
cin>>v[i].fi;
v[i].se=i+1;
  }

  sort(all(v));
  forn(i,n)cout<<v[i].se<<" ";
    return 0;
  }


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

void bubble_sort(int *data, int num);

int main(void)
{
	int n;
	int customer[10000];
	int waiting_time[10000];
	unsigned int minimum;
	int i;
	
	while (1){
		scanf("%d", &n);
		
		if (n == 0){
			break;
		}
		
		memset(customer, 0, sizeof(customer));
		
		for (i = 0; i < n; i++){
			scanf("%d", &customer[i]);
		}
		
		bubble_sort(customer, n);
		
		memset(waiting_time, 0, sizeof(waiting_time));
		
		minimum = 0;
		for(i = 1; i < n; i++){
			waiting_time[i] = waiting_time[i - 1] + customer[i - 1];
			minimum = minimum + waiting_time[i];
		}
		
		printf("%u\n", minimum);
	}
	
	return (0);
}
		
		
void bubble_sort(int *data, int num)
{
    int i;
    int j;
    int min;
    int temp;
    
    for (i = 0; i < num - 1; i++){
        min = i;
        for (j = i + 1; j < num; j++){
            if (data[min] > data[j]){
                temp = data[min];
                data[min] = data[j];
                data[j] = temp;
            }
        }
    }
}

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

using namespace std;
using ll = long long;

#define int ll

#define rep(i, a) for (int i = 0; (i) < (int) (a); (i)++)
#define reps(i, a, b) for (int i = (int) (a); (i) < (int) (b); (i)++)
#define rrep(i, a) for (int i = (int) a-1; (i) >= 0; (i)--)
#define rreps(i, a, b) for (int i = (int) (a)-1; (i) >= (int) (b); (i)--)
#define MP(a, b) make_pair((a), (b))
#define PB(a) push_back((a))
#define all(v) (v).begin(), (v).end()
#define PERM(v) next_permutation(all(v))
#define UNIQUE(v) sort(all(v));(v).erase(unique(all(v)), v.end())
#define CIN(type, x) type x;cin >> x
#define TRUE__  "Yes"
#define FALSE__ "No"
#define PRINT(f) if((f)){cout << (TRUE__) << endl;}else{cout << FALSE__ << endl;}
#define RS(N) resize(N)
#define CINV(v, N) do {\
	v.RS(N);\
	rep(i, N) cin >> v[i];\
} while (0);
#define RCINV(v, N) do {\
	v.RS(N);\
	rrep(i, N) cin >> v[i];\
} while (0);

#define MOD 1000000007

template<class T>
inline T GET() {
	T x;
	cin >> x;
	return x;
}

void init();
void solve();

signed main()
{
	init();
	solve();
}

ll dp[300000][6];

void init()
{
}

#define INF 10000000000000000

#define chmin(a, b) a = min(a, b)

int calc(int a, int f)
{
	if (f) {
		return a - (1 - a % 2);
	} else {
		if (a == 0) return -2;
		else return a - a % 2;
	}

}

void solve()
{
	ll L;
	vector<ll> A;
	cin >> L;
	CINV(A, L);
	ll res = 0;
	rep(i, L) {
		res += A[i];
	}
	rep(i, L) reps(j, 1, 6) {
		dp[i][j] = -INF;
	}
	ll resm = 0;
	reps(i, 1, L+1) {
		rep(j, 6) {
			if (j == 0) {
				dp[i][j] = dp[i-1][0];
			} else if (j == 1) {
				//1
				dp[i][j] = max(dp[i-1][0], dp[i-1][1]) + calc(A[i-1], 1);
			} else if (j == 2) {
				//0
				dp[i][j] = max(dp[i-1][0], dp[i-1][2]) + calc(A[i-1], 0);
			} else if (j == 3) {
				//1 0
				dp[i][j] = max(dp[i-1][1], dp[i-1][3]) + calc(A[i-1], 0);
			} else if (j == 4) {
				//0 1
				dp[i][j] = max(dp[i-1][2], dp[i-1][4]) + calc(A[i-1], 1);
			} else {
				//0 1 0
				dp[i][j] = max(dp[i-1][4], dp[i-1][5]) + calc(A[i-1], 0);
			}
			resm = max(resm, dp[i][j]);
		}
	}
	cout << res - resm << endl;
}



Measured memory_bytes: 12032
#define _CRT_SECURE_NO_WARNINGS
#include "bits/stdc++.h"
using namespace std;
#define rep(i, n) for(int i=0; i<(n); ++i)
#define FOR(i, m, n) for(int i=(m); i<(n); ++i)
#define sz(x) ((int)(x).size())
#define all(x) (x).begin(),(x).end()
#define mp make_pair
#define pb push_back
#define dump(x) cerr << #x << " = " << (x) << endl;
using LL=long long;
using VI=vector<int>;
using VL=vector<long long>;
using VS=vector<string>;
using VVI=vector<vector<int>>;
using PII=pair<int, int>;
const int inf = (int)1e9;
const LL mod = (long long)1e9 + 7;
const double pi = acos(-1.0);

template <class T>void Sort(T & a) { sort(a.begin(), a.end()); }
template <class T>void ReSort(T& a) { sort(a.rbegin(), a.rend()); }
template <class T>void Reverse(T& a) { reverse(a.begin(), a.end()); }
template <class T>void Unique(T& a) { a.erase(unique(a.begin(), a.end()), a.end()); }
template <class T>auto Max(T a) { return *max_element(a.begin(), a.end()); }
template <class T>auto Min(T a) { return *min_element(a.begin(), a.end()); }
template <class T, class U>int Count(T a, U c) { return count(a.begin(), a.end(), c); }
//template<typename T>auto Sum(T a) { return accumulate(a.begin(), a.end(), iterator_traits<decltype(a.begin())>::value_type()); }
template<class T, class U>U Sum(T a, U init = 0) { return accumulate(a.begin(), a.end(), init); }

//INPUT//
void CINPUT() {}
template<class H, class ...T> void CINPUT(H&& h, T&& ...t) { cin >> h; CINPUT(forward<T>(t)...); }
#define in(...) int __VA_ARGS__; CINPUT(__VA_ARGS__);
#define IN(T,...) T __VA_ARGS__; CINPUT(__VA_ARGS__);

#define vin(name,n) int n; cin>>n; vector<T> name(n); for(auto &i : name)cin>>i;
#define vIn(name,n) vector<int> name(n); for(auto &i : name)cin>>i;
#define Vin(T,name,n) T n; cin>>n; vector<T> name(n); for(auto &i : name)cin>>i;
#define VIn(T,name,n) vector<T> name(n); for(auto &i : name)cin>>i;

#define vIn2(name,name2,n) vector<int> name(n),name2(n); rep(i,n)cin>>name[i]>>name2[i];
#define VIn2(T,name,name2,n) vector<T> name(n),name2(n); rep(i,n)cin>>name[i]>>name2[i];
#define VIN2(T,name,T2,name2,n) vector<T> name(n); vector<T2> name2(n); rep(i,n)cin>>name[i]>>name2[i];

//OUTPUT//
void print() { cout << endl; }
template <class H> void print(H&& h) { cout << h << endl; }
template <class H, class... T> void print(H&& h, T&& ... t) { cout << h << " "; print(forward<T>(t)...); }
template<class T>void out(T n) { cout << n << endl; }
template<class T>void out(vector<T> a, string sep = " ", string end = "\n") { for (int i = 0; i < (int)a.size(); ++i)cout << a[i] << (i == (int)a.size() - 1 ? end : sep); }
template<> void out(double a) { printf("%.20f\n", a); }
void yes(bool f) { puts(f ? "yes" : "no"); }
void Yes(bool f) { puts(f ? "Yes" : "No"); }
void YES(bool f) { puts(f ? "YES" : "NO"); }
void Yay(bool f) { puts(f ? "Yay!" : ":("); }
void poss(bool f) { puts(f ? "possible" : "impossible"); }
void Poss(bool f) { puts(f ? "Possible" : "Impossible"); }
void POSS(bool f) { puts(f ? "POSSIBLE" : "IMPOSSIBLE"); }

int main() {
	in(n);
	VIN2(double, x, string, u, n);

	vector<double> a(n);
	rep(i, n)a[i] = u[i] == "JPY" ? x[i] : x[i] * 380000.;
	out(Sum(a,0.));
}

Measured memory_bytes: 256