akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std; 
void bubblesort (vector<int> &A, int N, int &count){
    int flag = 1;
    while (flag){
        flag = 0;
        for (int j=N-1; j>0; j--){
            if (A.at(j) < A.at(j-1)){
                count += 1;
                int t = A.at(j);
                A.at(j) = A.at(j-1);
                A.at(j-1) = t;
                flag = 1;
            }
        }
    }
    return;
}

int main(){
    int N, count = 0;
    cin >> N;
    vector<int> Ai(N);
    for (int i=0; i<N; i++){
        cin >> Ai.at(i);
    }
    bubblesort(Ai, N, count);
    for (int i=0; i<N; i++){
        if (i != N-1) cout << Ai.at(i) << " ";
        else cout << Ai.at(i) << endl;
    }
    cout << count << endl;
    return 0;
}


Measured memory_bytes: 3120
#include <bits/stdc++.h>
using namespace std;
inline int read(){
    int x = 0,f = 1; char c = getchar();
    while (c != EOF && !isdigit(c)) {if (c == '-') f = -1;c = getchar();}
    while (c != EOF && isdigit(c)) {x = x * 10 + c - '0';c = getchar();}
    return x * f;
}
inline void write(int x){
    int k = 0;char put[40];
    if (!x) putchar('0');
    if (x < 0) putchar('-'),x = -x;
    while (x)  put[++k] = (x % 10) + '0',x /= 10;
    while (k)  putchar(put[k]),--k;
	putchar('\n');
}
const int N = 100005,L = 1<<15;
int n,a[N],ans;
int cnt[17],Q;
int size[L],Xor[L],f[L];
int main(){
	int i,j,k,u,v,w;
	n = read();
	for (i = 1; i < n; ++i) u = read()+1,v = read()+1,w = read(),a[u] ^= w,a[v] ^= w;
	for (i = 1; i <= n; ++i) ++cnt[a[i]];
	for (i = 1; i <= 15; ++i){
		ans += cnt[i] >> 1; if (cnt[i]&1) Q |= 1<<i-1;
	}
	for (i = 1; i < L; ++i)
	for (j = 1; j <= 15; ++j) if (i&(1<<j-1)) Xor[i] ^= j;
	for (i = 1; i < L; ++i) size[i] = size[i>>1] + (i&1);
	for (i = 1; i < L; ++i) if (Xor[i]) f[i] = 200; else f[i] = size[i] - 1;
	for (i = 1; i <= Q; ++i){
		if (Xor[i]) continue;
		for (j = (i-1)&i; j ; j = (j-1)&i) f[i] = min(f[i],f[i^j] + f[j]);
	}
	ans += f[Q];
	write(ans);
    return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>                                           
 
//#define int long long
//#pragma GCC optimize("Ofast")
//#pragma comment(linker, "/stack:200000000")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4")
 
 
#define file(s) freopen(s".in","r",stdin); freopen(s".out","w",stdout);
#define forev(i, b, a) for(int i = (b); i >= (a); --i)
#define forn(i, a, b) for(int i = (a); i <= (b); ++i)
#define all(x) x.begin(), x.end()
#define sz(s) (int)s.size()
#define pb push_back
#define ppb pop_back
#define mp make_pair
#define s second
#define f first
 
 
using namespace std;
 
 
typedef pair < long long, long long > pll;    
typedef pair < int, int > pii;
typedef unsigned long long ull;         
typedef vector < pii > vpii;
typedef vector < int > vi;
typedef long double ldb;  
typedef long long ll;  
typedef double db;                             
 
 
const int dx[] = {1, -1, 0, 0}, dy[] = {0, 0, 1, -1}, block = 555;
const pii base = mp(1171, 3307), Mod = mp(1e9 + 7, 1e9 + 9);
const int inf = 1e9, maxn = 4e5 + 148, mod = 998244353, N = 1e7 + 5;
const db eps = 1e-12, pi = 3.14159265359;
const ll INF = 1e18;

int n, ans, p[N], f[N], rf[N];

int binpow (int a, int n) {
	int res = 1;
	while (n) {
		if (n & 1)
			res = res * 1ll * a % mod;
		a = a * 1ll * a % mod;
		n >>= 1;
	}

	return res;
}

int rev (int x) {
	return binpow(x, mod - 2);
}

void precalc () {
	f[0] = 1;
	forn (i, 1, N - 1)
		f[i] = f[i - 1] * 1ll * i % mod;

	rf[N - 1] = rev(f[N - 1]);
	forev (i, N - 2, 0)
		rf[i] = rf[i + 1] * 1ll * (i + 1) % mod;

	p[0] = 1;
	forn (i, 1, N - 1)
		p[i] = p[i - 1] * 2ll % mod;
}

int cnk (int n, int k) {
//	cerr << f[n] << ' ' << rf[k] << ' ' << rf[n - k] << endl;
	return f[n] * 1ll * rf[k] % mod * 1ll * rf[n - k] % mod;
}


void add (int &x, int y) {
	x += y;
	if (x < 0)
		x += mod;
	if (x >= mod)
		x -= mod;
}


main () {
	precalc();
	cin >> n;
	ans = 1;
	forn (i, 1, n)
		ans = ans * 3ll % mod;	

	forn (i, n / 2 + 1, n)	{	
		add(ans, -cnk(n, i) * 2ll * p[n - i] % mod); 
	}
	cout << ans << endl;
}


Measured memory_bytes: 117376
//3桁の整数 N が与えられます。N のいずれかの桁に数字の 7 は含まれますか？
//含まれるなら Yes を、含まれないなら No を出力してください。

#include <bits/stdc++.h>
typedef long long ll;
#define rep(i,n) for(ll i = 0; i < (n); ++i )
#define rep_rev(n,i) for(ll i = n; i >= 0; --i )
using namespace std;
using P = pair<int, int>;
const long long INF = 1LL << 60;

int main(){
  int N,d = 100; cin >> N;
  rep(i,3){
    if(N/d == 7){
      cout << "Yes" << endl;
      return 0;
    }
    N %= d; d /= 10;
  }
  cout << "No" << endl;
  return 0;
}


Measured memory_bytes: 3596
//---------------------------------------------------------------
#include <bits/stdc++.h>
using namespace std;
#include <iostream>
#include <vector>
#include <cstdlib>
#include <cmath>
#include <math.h>
#include <sstream>
#include <numeric>
#include <cctype>
#include <bitset>
#include <cassert>
#include<algorithm>
//---------------------------------------------------------------
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep1(i, n) for (int i = 1; i <= (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
#define SIZE 100005
#define INF 1000000000000000LL
#define all(x) x.begin(),x.end()
using pint = pair<int,int>;
using vec = vector<int>;
using ll=long long;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
//---------------------------------------------------------------
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 int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
//---------------------------------------------------------------

//↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓

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

    int x;cin>>x;
    if(x>=30)cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
}

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

int main(){
    int n, k, s;
    cin >> n >> k >> s;

    vector<int> a(n);
    for(int i=0; i<k; i++) a[i] = s;
    for(int i=k; i<n; i++){
        if(s == 1e9) a[i] = s - 1;
        else a[i] = s + 1;
    }

    for(int i=0; i<n; i++){
        cout << a[i];
        if(i == n-1) break;
        cout << " ";
    }
    cout << endl;
    return 0;
}

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

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

    vector<int> count(9);
    vector<int> a(n);
    for(int i=0; i<n; i++){
        cin >> a[i];
        count[min(a[i] / 400, 8)] += 1;
    }

    int ans = 0;
    for(int i=0; i<8; i++){
        if(count[i] >= 1) ans += 1;
    }
    cout << min(8, max(ans, 1)) << " " << ans + count[8] << endl;
    return 0;
}

Measured memory_bytes: 256
n,*a=`cat`.split.map(&:to_i)

a.sort!
csum=[]	<< a[0]
(1..n-1).each{|i|csum[i]=csum[i-1]+a[i]}
#p csum                                                                                                                               

(n-2).downto(0){|i|
#  p [n-i,a[i+1],csum[i]]                                                                                                             
  if(a[i+1] > csum[i]*2)
    puts n-i-1
    exit
  end
}

puts n

Measured memory_bytes: 11344
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,a,b) for(int i=a;i>=b;i--)
#define fore(i,a) for(auto &i:a)
#define all(x) (x).begin(),(x).end()
//#pragma GCC optimize ("-O3")
using namespace std; void _main(); int main() { cin.tie(0); ios::sync_with_stdio(false); _main(); }
typedef long long ll; const int inf = INT_MAX / 2; const ll infl = 1LL << 60;
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; }
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
void _main()
{
    int N, K;
    string S;
    cin >> N >> K >> S;
    vector<int> nums;
    int now = 1;
    int cnt = 0;
    rep(i, 0, N)
    {
        if (S[i] == '0' + now)
        {
            ++cnt;
        }
        else
        {
            nums.push_back(cnt);
            now = 1 - now;
            cnt = 1;
        }
    }
    if (cnt != 0)
    {
        nums.push_back(cnt);
    }

    if (nums.size() % 2 == 0)
    {
        nums.push_back(0);
    }

    const int add = 2 * K + 1;
    int ans = 0;
    for (int i = 0; i < nums.size(); i += 2)
    {
        int tmp = 0;
        int left = i;
        int right = min(i + add, static_cast<int>(nums.size()));
        rep(j, left, right)
        {
            tmp += nums[j];
        }
        ans = max(ans, tmp);
    }
    cout << ans << endl;
}


Measured memory_bytes: 1020
#include <cstdio>
#include <algorithm>
#include <vector>

const int MN = 100005;

int N, K, A[MN], Ans;
std::vector<int> G[MN];

int dep[MN], kpar[MN], per[MN], stk[MN], tp;
void DFS(int u) {
	stk[++tp] = u;
	if (dep[u] > K) kpar[u] = stk[tp - K + 1];
	for (int v : G[u]) dep[v] = dep[u] + 1, DFS(v);
	--tp;
}

int del[MN];
void Del(int u) {
	del[u] = 1;
	for (int v : G[u]) if (!del[v]) Del(v);
}

int main() {
	scanf("%d%d", &N, &K);
	for (int i = 1; i <= N; ++i) scanf("%d", &A[i]);
	if (A[1] != 1) A[1] = 1, Ans = 1;
	for (int i = 2; i <= N; ++i) G[A[i]].push_back(i);
	DFS(1);
	for (int i = 1; i <= N; ++i) per[i] = i;
	std::sort(per + 1, per + N + 1, [](int i, int j) { return dep[i] > dep[j]; });
	for (int i = 1; i <= N; ++i) if (kpar[per[i]] && !del[per[i]]) ++Ans, Del(kpar[per[i]]);
	printf("%d\n", Ans);
	return 0;
}

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

// 総数を1000000007（素数）で割った余り
const long long mod = 1e9 + 7;

using ll = long long;
using pii  = pair<int, int>;
using pll = pair<ll, ll>;
#define ull unsigned long long
#define ld long double
#define vi vector<int>
#define vll vector<ll>
#define vc vector<char>
#define vs vector<string>
#define vpii vector<pii>
#define vpll vector<pll>

#define rep(i, n) for (int i = 0, i##_len = (n); i < i##_len; i++)
#define rep1(i, n) for (int i = 1, i##_len = (n); i <= i##_len; i++)
#define repr(i, n) for (int i = ((int)(n)-1); i >= 0; i--)
#define rep1r(i, n) for (int i = ((int)(n)); i >= 1; i--)

#define sz(x) ((int)(x).size())
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()

#define SORT(v, n) sort(v, v + n);
#define VSORT(v) sort(v.begin(), v.end());
#define RSORT(x) sort(rall(x));
#define pb push_back
#define mp make_pair

#define INF (1e9)
#define PI (acos(-1))
#define EPS (1e-7)

ull gcd(ull a, ull b) { return b ? gcd(b, a % b) : a; }
ull lcm(ull a, ull b) { return a / gcd(a, b) * b; }

int main(){
    int n, k;
    string s;
    cin >> n >> k >> s;
    s[k-1] = tolower(s[k-1]);
    cout << s << endl;
    return 0;
}


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

int main()
{
  int N = 3;
  char S[N];
  char T[N];
  
  for (int i = 0; i < N; i++) {
    cin >> S[i];
  }
  
  for (int i = 0; i < N; i++) {
    cin >> T[i];
  }

  
  int ctr = 0;
  for(int i=0; i<N; ++i){
    if(S[i] == T[i]){
      ctr++;
    }
  }

  cout << ctr << endl;

  return 0;
}


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

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

int main() {

    int n;
    cin >> n;

    int *A = new int[n];
    for (int i = 0; i < n; ++i) {
        cin >> A[i];
    }

    int q;
    cin >> q;

    for (int i = 0; i < q; ++i) {
        int m;
        cin >> m;
        if (solve(0, m, A, n)) cout << "yes" << endl;
        else cout << "no" << endl;
    }

    return 0;
}

Measured memory_bytes: 1180
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <cstring>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <algorithm>
using namespace std;

#define REP(i,n) for(int i=0; i<n; ++i)
#define FOR(i,a,b) for(int i=a; i<=b; ++i)
#define FORR(i,a,b) for (int i=a; i>=b; --i)
#define pi acos(-1.0)

typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<VI> VVI;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;



int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    string a, b, c;
    cin >> a >> b >> c;
    cout << ((a.back() == b.front() && b.back() == c.front()) ?
        "YES" : "NO") << "\n";


    return 0;
}


Measured memory_bytes: 256
N = int(input())
XL = [list(map(int, input().split())) for _ in range(N)]

XL.sort(key=lambda x: (x[0] + x[1], x[0] - x[1]))

myinf = 10 ** 9 + 7

saved = []
pos = -myinf
for i, (Xi, Li) in enumerate(XL):
    # print("#", Xi, Li, (Xi - Li, Xi + Li))
    if Xi - Li < pos: continue
    #
    saved.append(i)
    pos = Xi + Li

print(len(saved))

Measured memory_bytes: 41768
#include <iostream>
#include <algorithm>
#include <vector>
#define rep(i,n) for(int i=0;i<n;++i)
#define rep1(i,n) for(int i=1;i<=n;++i)
using namespace std;
typedef long long ll;
//k以下である要素のうち最大のもののインデックスを求める
int m;
vector<ll> vec;
int lower_bound(int k){
  int left=-1,right=m;
  while(right-left>1){
    int mid=(right+left)/2;
    if(vec[mid]<=k) left=mid;
    else right=mid;
  }
  return left;
}

int main()
{
  int n, q;cin >> n >> q;
  vector<ll> a(n);
  rep(i,n) cin >> a[i];
  vector<ll> x(q);
  rep(i,q) cin >> x[i];

  rep(i, (n - 1) / 2) {
    ll tmp = ( a[n - 2 - i] + a[n - 2 - i - i - 1] ) / 2 + 1;
    vec.push_back(tmp);
  }
  vec.push_back(0);
  // rep(i,vec.size()) cout << vec[i] << " ";
  // cout  << "\n";

  reverse(vec.begin(), vec.end());
  vector<ll> sum(n+1);
  sum[0] = 0;
  rep(i,n) sum[i+1] = sum[i] + a[i];
  m = (n + 1) / 2;
  vector<ll> jum(m + 1);
  jum[0] = 0;
  if(n % 2 == 0) {
    rep(i,n) {
      if(i % 2 == 1) {
	jum[i/2 + 1] = jum[i/2] + a[i];
      }
    }
  }
  else {
    rep(i,n) {
      if(i % 2 == 0) {
	jum[i/2 + 1] = jum[i/2] + a[i];
      }
    }
  }

  // rep(i, m + 1) cout << jum[i] << " ";
  // cout << "\n";
  
  rep(i,q) {
    ll res = 0;
    int index = lower_bound(x[i]);
    int num = m - index;
    res += sum[n] - sum[n - num];
    int kk = n - 1 - num * 2;
    if(kk < 0) cout << res << "\n";
    else {
      res += jum[ kk/2 + 1 ];
      cout << res << "\n";
    }
  }

  return 0;
}


Measured memory_bytes: 4984
#include<iostream>
#include<vector>
#include<algorithm>
#include<cmath>
#include<iomanip>
using namespace std;
int main()
{
    int n,m,ans,temp,total=0;
    vector<int> all;
    cin>>n>>m;
    for(int i = 0;i<m;i++)
    {
        cin>>temp;
        total+=temp;
    }
    if(n-total>=0)
        ans=n-total;
    else
        ans=-1;
    
    
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 3636
#include<iostream>
#include<cstring>
#include<cmath>
#include<map>
#include<queue>
#include<stack>
#include<cstdio>
#include<algorithm>
using namespace std;
#define REP(i,x,y) for(int i=x;i<=y;i++)
#define rep(i,n) REP(i,1,n)
#define rep0(i,n) REP(i,0,n-1)
#define repG(i,x) for(int i=pos[x];~i;i=e[i].next)
#define ll long long
#define db double
const int N=27;
const int M=67;
const int INF=1e9+7;
struct edge{int x,y,c;}e[M];
int L,num=0;
void dfs(int x,int L){
	if(L<4){
		rep0(i,L)e[++num]=(edge){x,20,i};
		return;
	}
	e[++num]=(edge){x,x+1,L/2};
	e[++num]=(edge){x,x+1,0};
	if(L&1)e[++num]=(edge){x,20,L-1};
	dfs(x+1,L/2);
}
int main(){
	scanf("%d",&L);
	dfs(1,L);
	printf("%d %d\n",20,num);
	rep(i,num)printf("%d %d %d\n",e[i].x,e[i].y,e[i].c);
	return 0;
}


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

struct edge{
	int to;
	int rev;
	ll cap;
};

vector<edge> g[123];
bool used[123];

void make_edge(int u, int v, ll c){
	edge e;
	e.to = v;
	e.rev = g[v].l_ength();
	e.cap = c;
	g[u].push_back(e);
	e.to = u;
	e.rev = g[u].l_ength()-1;
	e.cap = 0ll;
	g[v].push_back(e);
}

ll dfs(int s, int t, ll f){
	int i;
	edge e;
	ll v;
	used[s] = true;
	if(s==t){
		return f;
	}
	for(i=(g[s].l_ength()-1); i>=0; --i){
		e = g[s][i];
		if((!used[e.to]) && e.cap > 0ll){
			v = dfs(e.to,t,min(f,e.cap));
			if(v > 0ll){
				g[s][i].cap -= v;
				g[e.to][e.rev].cap += v;
				return v;
			}
		}
	}
	return 0ll;
}

int main(void){
	int n,i,j;
	ll a,ans=0ll;
	cin >> n;
	for(i=1; i<=n; ++i){
		cin >> a;
		if(a>0ll){
			ans += a;
			make_edge(i,n+1,a);
		}else{
			make_edge(0,i,-a);
		}
		j = i*2;
		while(j<=n){
			make_edge(i,j,INFLL);
			j += i;
		}
	}
	while(true){
		fill(used,used+123,false);
		a = dfs(0,n+1,INFLL);
		if(a == 0ll){
			break;
		}
		ans -= a;
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 256
n = int(input())
s = {}
count = 0
while n > count:
    st = input()
    if st not in s:
        s[st] = 1
        count += 1
    else:
        s[st] += 1
        count += 1

sorteditems = sorted(s.items(), key = lambda x : x[1], reverse= True)
max = 0
ans = []
for a, b in sorteditems:
    if max == 0:
        ans.append(a)
        max = b
    elif max == b:
        ans.append(a)
for i in sorted(ans):
    print(i)


Measured memory_bytes: 47324
#include <iostream>
#include <cstdio>
#include <algorithm>
#define M 100009
typedef long long ll;
using namespace std;
int a,b,c,cnt,tot[4],mx[4];
ll sum;
struct apple{
  ll val;
  int color;
  bool operator<(const apple y)const{
    return val > y.val or (val == y.val and color < y.color);
  }
}ap[3*M];
int main(){
  scanf("%d%d%d%d%d",&mx[1],&mx[2],&a,&b,&c);
  mx[3] = 1e9+9;
  for(int i = 1; i <= a; i++) scanf("%lld",&ap[++cnt].val),ap[cnt].color = 1;
  for(int i = 1; i <= b; i++) scanf("%lld",&ap[++cnt].val),ap[cnt].color = 2;
  for(int i = 1; i <= c; i++) scanf("%lld",&ap[++cnt].val),ap[cnt].color = 3;
  sort(ap+1,ap+cnt+1);
  int tmp = 0;
  for(int i = 1; i <= cnt && tmp < mx[1]+mx[2]; i++){
    int cl = ap[i].color;
    if(tot[cl] >= mx[cl]) continue;
    tot[cl]++,tmp++;
    sum += ap[i].val;
  }
  printf("%lld",sum);
  return 0;
}

Measured memory_bytes: 4992
#include <bits/stdc++.h>
using namespace std;
#define IOS ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define ll long long
#define vll vector<ll>
#define vi vector<int>
#define pb push_back
#define fi first
#define se second
#define pii pair<int,int>
#define pll pair<ll,ll>
#define mii map<int,int>
#define mll map<ll,ll>
#define all(x) (x).begin(),(x).end()
#define S(x) (int)(x).size()
#define L(x) (int)(x).length()
#define debug(x) cerr << #x << " " << x << endl;
#define debug_p(x) cerr << #x << " [" << x.fi << " " << x.se << "]"<<endl;
#define debug_v(x) {cerr << #x << " "; for (auto ioi : x) cerr << ioi << " "; cerr << endl;}
#define debug_vp(x) {cerr << #x << " "; for (auto ioi : x) cerr << '[' << ioi.fi << " " << ioi.se << ']'; cerr << endl;}
#define debug_v_v(x) {cerr << #x << "/*\n"; for (auto ioi : x) { for (auto ioi2 : ioi) cerr << ioi2 << " "; cerr << '\n';} cerr << "*/" << #x << endl;}
#define gen_clock(x) ll x = clock(); cerr << "Clock " << #x << " created" << endl;
#define check_clock(x) cerr << "Time spent in " << #x << ": " << (double)(clock() - x)/CLOCKS_PER_SEC << endl; x = clock();
#define reset_clock(x) x = clock()
 
const int mod = 1e9+7;
const ll infl = 0x3f3f3f3f3f3f3f3fLL;
const int infi = 0x3f3f3f3f;
 
void solve()
{
	ll n;
	cin>>n;
	ll a[n];
	for(ll i=0;i<n;i++)
	cin>>a[i];
	ll ans=0;
	for(ll i=0;i<n;i++)
	ans=ans^a[i];
	for(ll i=0;i<n;i++)
	{
		cout<<(ans^a[i])<<" ";
	}
	
	
	
	
	
}
 
int main()
{
	IOS
	int t=1;
	//cin>>t;
	while(t--)
	{
		solve();
	}
}


Measured memory_bytes: 5164
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using VI = vector<int>;
using VL = vector<ll>;
#define FOR(i,a,n) for(int (i)=(a);(i)<(n);(i)++)
#define eFOR(i,a,n) for(int (i)=(a);(i)<=(n);(i)++)
#define rFOR(i,a,n) for(int (i)=(n)-1;(i)>=(a);(i)--)
#define erFOR(i,a,n) for(int (i)=(n);(i)>=(a);(i)--)
#define SORT(i) sort((i).begin(),(i).end())
#define rSORT(i,a) sort((i).begin(),(i).end(),(a))
#define all(i) (i).begin(),(i).end()
constexpr ll INF = 1000000000;
constexpr ll LLINF = 1LL << 60;
constexpr ll mod = 1000000007;
constexpr ll MOD = 998244353;
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; }
inline void init() { cin.tie(nullptr); cout.tie(nullptr); cin.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(15); }
template<class T>inline istream& operator>>(istream& input, vector<T>& v) { for (auto& elemnt : v)input >> elemnt; return input; }

int main() {
    init();

    string s;
    cin >> s;
    ll n = s.length();
    VL c(26, 0);
    for (char i : s)c[i - 'a']++;

    ll ans = n * (n - 1) / 2 + 1;
    for (ll i : c)ans -= i * (i - 1) / 2;
    cout << ans << "\n";
}

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

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
#ifdef LOCAL
	std::ifstream in("in");
	std::cin.rdbuf(in.rdbuf());
#endif

	int N, A, B;
	cin >> N >> A >> B;
	if(abs(A - B) % 2){
		cout << "Borys" << endl;
	}
	else{
		cout << "Alice" << endl;
	}
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long  ll;
#define FOR(i,a,n) for(ll i=(ll)a;i<(ll)n;i++)
#define RFOR(i,a,n) for(ll i=(ll)n-1;i >= (ll)a;i--)
#define rep(i,n) FOR(i,0,n)
#define rrep(i,n) RFOR(i,0,n)
#define ALL(v) v.begin(), v.end()
#define bra(first,second) '(' << first << ',' << second << ')'
constexpr ll MOD = 1000000007;
ll INF = 1001001001001001001;
long double EPS = 1e-11;
long double PI = 3.141592653589793238;
template<typename T>
void remove(std::vector<T>& vector, unsigned int index){
    vector.erase(vector.begin() + index);
}

using Graph = vector<vector<ll>>;

int main(){
    string S;
    cin >> S;
    ll N = S.size();
    vector<ll> A(1,1);
    rep(i,N-1){
        if(S[i] == S[i+1])A.back()++;
        else A.push_back(1);
    }
    vector<ll> ans(N,0);
    if(S[0] == 'R'){
        ll now = -1;
        rep(i,A.size()){
            now += A[i];
            if(i == A.size() - 1 && i % 2 == 0){
                ans[now] += A[i];
                continue;
            }
            if(i % 2 == 0){
                ans[now+1] += A[i] / 2;
                ans[now] += (A[i] + 1) / 2;
            }else{
                ans[now - A[i] + 1] += (A[i] + 1) / 2;
                ans[now - A[i]] += A[i] / 2;
            }
        }
    }else{
        ll now = -1;
        rep(i,A.size()){
            now += A[i];
            if(i == 0){
                ans[now - A[i] + 1] += A[i];
                continue;
            }
            if(i == A.size() - 1 && i % 2 == 1){
                ans[now] += A[i];
                continue;
            }
            if(i % 2 == 1){
                ans[now+1] += A[i] / 2;
                ans[now] += (A[i] + 1) / 2;
            }else{
                ans[now - A[i] + 1] += (A[i] + 1) / 2;
                ans[now - A[i]] += A[i] / 2;
            }
        }
    }
    rep(i,N) cout << ans[i] << ' ';
    cout << endl;
}


Measured memory_bytes: 2292
#include<stdio.h>
int main(){
	int  a,b,c,i;
	int flag = 0;
	scanf("%d %d %d",&a,&b,&c);
	for(i=a;i<=b;i++){
		if((c%i)==0)flag++;
	}
	printf("%d\n",flag);
	return 0;	
}

Measured memory_bytes: 2740
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <numeric>
using namespace std;
int main() {
  vector<int> v;
  for (int i = 0; i < 3; ++i) {
    int a;
    cin >> a;
    v.push_back(a);
  }
  
  sort(v.begin(), v.end());
  
  int mx = 0;
  do {
    mx = max(mx, v[0] * 10 + v[1] + v[2]);
  } while (next_permutation(v.begin(), v.end()));
  cout << mx << endl;
  return 0;
}

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

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 long long ll;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<long long> VL;
typedef vector<vector<long long>> VVL;
typedef vector<string> VS;
typedef pair<int, int> P;
typedef tuple<int,int,int> tpl;

#define ALL(a)  (a).begin(),(a).end()
#define SORT(c) sort((c).begin(),(c).end())
#define REVERSE(c) reverse((c).begin(),(c).end())
#define EXIST(m,v) (m).find((v)) != (m).end()
#define LB(a,x) lower_bound((a).begin(), (a).end(), x) - (a).begin()
#define UB(a,x) upper_bound((a).begin(), (a).end(), x) - (a).begin()

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define RFOR(i,a,b) for(int i=(a)-1;i>=(b);--i)
#define RREP(i,n) RFOR(i,n,0)

#define en "\n"

constexpr double EPS = 1e-9;
constexpr double PI  = 3.1415926535897932;
constexpr int INF = 2147483647;
constexpr long long LINF = 1LL<<60;
constexpr long long MOD = 1000000007; // 998244353;

#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

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

void Main(){
    int x, y;
    cin >> x >>y;
    REP(i, x+1) {
        if (2 * i + 4 * (x - i) == y) {
            cout << "Yes" << en;
            return;
        } 
    }
    cout << "No" << en;
    return;
}

int main(void){
    cin.tie(0);cout.tie(0);ios_base::sync_with_stdio(0);cout<<fixed<<setprecision(15);
    int t=1; //cin>>t;
    REP(_,t) Main();
    return 0;
}


Measured memory_bytes: 3632
#include<bits/stdc++.h>
using namespace std;
#define LL long long
#define debug(x) cerr<<#x<<" = "<<x
#define sp <<"  "
#define el <<endl
#define fgx cerr<<" ---------------------------------------------- "<<endl
#define uint unsigned int 
#define ULL unsigned long long
#define LDB long double
#define DB double
#define pii pair<int,int>
#define mp make_pair
#define pb push_back
inline LL read(){
	LL nm=0; bool fh=true; char cw=getchar();
	for(;!isdigit(cw);cw=getchar()) fh^=(cw=='-');
	for(;isdigit(cw);cw=getchar()) nm=nm*10+(cw-'0');
	return fh?nm:-nm;
}
#define mod 998244353
namespace  CALC{
	inline int add(int x,int y){return (x+y>=mod)?(x+y-mod):(x+y);}
	inline int mns(int x,int y){return (x-y<0)?(x-y+mod):(x-y);}
	inline int mul(int x,int y){return (LL)x*(LL)y%mod;}
	inline void upd(int &x,int y){x+=y;(x>=mod)?(x-=mod):0;}
	inline void dec(int &x,int y){x-=y;(x<0)?(x+=mod):0;}
	inline int qpow(int x,int sq){int res=1;for(;sq;sq>>=1,x=mul(x,x))if(sq&1)res=mul(res,x);return res;}
}using namespace CALC;
#define M 200
int n,m;
int F[M][M];
char ch[M][M];
inline void Dn(int &x,int y){(x>y)?(x=y):0;}
int main(){
	n=read(),m=read();
	for(int i=1;i<=n;i++) scanf("%s",ch[i]+1);
	memset(F,0x3f,sizeof(F));
	F[1][1]=(ch[1][1]=='#');
	for(int i=1;i<=n;i++) for(int j=1;j<=m;j++){
		if(i<n){
			if(ch[i][j]==ch[i+1][j]) Dn(F[i+1][j],F[i][j]);
			else Dn(F[i+1][j],F[i][j]+(ch[i+1][j]=='#'));
		}
		if(j<m){
			if(ch[i][j]==ch[i][j+1]) Dn(F[i][j+1],F[i][j]);
			else Dn(F[i][j+1],F[i][j]+(ch[i][j+1]=='#'));
		}
	}
	printf("%d\n",F[n][m]);
	return 0;
} 

Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
#define int long long

typedef long long ll;
typedef pair<int,int> pii;
typedef pair<int,pii> pip;
typedef vector<int> vi;
typedef vector<vi> vii;
typedef vector<pii> vpii;

#define rep(i,n) for (int i=0;i<(n);i++)
#define rep2(i,a,b) for (int i=(a);i<(b);i++)
#define rrep(i,n) for (int i=(n);i>=0;i--)
#define rrep2(i,a,b) for (int i=(a);i>b;i--)
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define all(a) (a).begin(),(a).end()

const int mod = 1e9 + 7;
const ll INF = 1<<30;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

int V,E,r;
struct edge{ int to, cost; };
vector<edge> g[100000+5];
int d[100000+5];

void dijkstra(int s){
    priority_queue<pii, vector<pii>, greater<pii>> que;
    fill(d, d+V, INF);
    d[s] = 0;
    que.push(pii(0, s));

    while (!que.empty()){
        pii p = que.top();que.pop();
        int v = p.second;
        if (d[v] < p.first) continue;
        for (int i = 0; i < g[v].size(); i++){
            edge e = g[v][i];
            if (d[e.to] > d[v] + e.cost){
                d[e.to] = d[v] + e.cost;
                que.push(pii(d[e.to], e.to));
            }
        }
    }
}

signed main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    cin >> V >> E >> r;
    rep(i,E){
        int s,t,d;
        cin >> s >> t >> d;
        g[s].pb(edge{t,d});
    }
    dijkstra(r);
    rep(i,V){
        if(d[i]==INF) cout << "INF" << endl;
        else cout << d[i] << endl;
    }
}

Measured memory_bytes: 19436
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll MOD = 1e9 + 7;
 
ll X[100100]; ll Y[100100]; ll Z[100100];

ll p(ll b){ //3のb乗
  if( b == 0){ return 1;}
  else if( b == 1){ return 3;}
  else{
    if( b % 2 == 0){ return ((p(b/2)%MOD)*(p(b/2)%MOD))%MOD;}
    else{ return (3*(p((b-1)/2)%MOD)*(p((b-1)/2)%MOD))%MOD;}
  }
}

  
  
  
int main(){
  string T; cin >> T;
  ll cnt = 0;
  for(int i = 0; i < 100100; i++){ X[i] = 0LL; Y[i] = 0LL; Z[i] = 0LL;}
  if(T[0] == 'A' || T[0] == '?'){ X[0] = 1LL;}
  if(T[0] == '?'){ cnt++;}
  
  for(int i = 0; i < (int) T.size()-1; i++){
    int flag;
    if(T[i+1] == 'A'){ flag = 1;} 
    if(T[i+1] == 'B'){ flag = 2;}
    if(T[i+1] == 'C'){ flag = 3;}
    if(T[i+1] == '?'){ flag = 4; }
    
    if( flag == 1 || flag == 4 ){ X[i+1]+=X[i]+p(cnt);Y[i+1]+=Y[i];Z[i+1]+=Z[i];}
    if( flag == 2 || flag == 4){ X[i+1]+=X[i]; Y[i+1]+=Y[i]+X[i];Z[i+1]+=Z[i];}
    if( flag == 3 || flag == 4){ X[i+1]+=X[i]; Y[i+1]+=Y[i];Z[i+1]+=Z[i]+Y[i];}
    X[i+1] %= MOD; Y[i+1] %= MOD; Z[i+1] %= MOD;
    
    if( flag == 4){ cnt++;}
    
  }
  
  cout << Z[(int)T.size()-1] << endl; return 0;}
      
      


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

int main(){
    int K;
    cin >> K;
    string S;
    cin >> S;
    if(S.size() <= K) cout << S << '\n';
    else{
        for(int i = 0; i < K; i++) cout << S.at(i);
        cout << "...\n";
    }
}

Measured memory_bytes: 3632
#include<bits/stdc++.h>
#define REP(i,n) for(int i=0,i##_len=int(n);i<i##_len;++i)
#define rep(i,a,b) for(int i=int(a);i<int(b);++i)
#define All(x) (x).begin(),(x).end()
#define rAll(x) (x).rbegin(),(x).rend()
using namespace std;
using ll = long long;

int main(){
    int N,K;cin>>N>>K;
    vector<int> H(N);
    REP(i, N) cin >> H[i];
    sort(rAll(H));
    ll ans=0;
    REP(i,N){
        if(K>0){
            K--;
        }
        else{
            ans+=H[i];
        }
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 1024
a = int(input())
ans = 0
for i in range(1,a+1,2):
    #print(i)
    count = 0
    for j in range(1,a+1):
        if i%j==0:
            count += 1
            #print(count,j)
    if count == 8:
        ans += 1
        #print(i,j)
print(ans)


Measured memory_bytes: 2940
import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    String str = sc.next();
    int N = Integer.parseInt(str);
    char[] c = str.toCharArray();
    int len = c.length;
    int[] digit = new int[len];
    int sum = 0;

    for(int i = 0; i < len; i++) {
      digit[i] = Character.getNumericValue(c[i]);
      sum += digit[i];
    }
    if(N % sum == 0) {
      System.out.println("Yes");
    } else {
      System.out.println("No");
    }
  }
}

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

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 int dx4[4] = {1, 0, -1, 0};
const int dy4[4] = {0, 1, 0, -1};

const int dx8[8] = {1,1,0,-1,-1,-1,0,1};
const int dy8[8] = {0,1,1,1,0,-1,-1,-1};

vector< vector<int> > Graph;
vector< int > value;





int main(int argc, const char * argv[]) {
    
    // remove the bottom 3 lines when you submit this code.
    std::ifstream in("sample.txt");
    std::cin.rdbuf(in.rdbuf());

    cin.tie(0);
    ios::sync_with_stdio(false);
    
   
    int n,k; cin >> n >> k;
    vector<int> stick(n);
    rep(i,n) cin >> stick[i];
    
    sort(stick.rbegin(),stick.rend());
    int Ans = 0;
    rep(i,k) Ans += stick[i];
    
    cout << Ans << endl;
    
    
}



Measured memory_bytes: 256
package main

import (
	"bufio"
	"fmt"
	"io"
	"math"
	"os"
	"strconv"
	"strings"

)


func main() {
	solve(os.Stdin, os.Stdout)
}

type ReaderEx struct {
	baseScanner *bufio.Scanner
	words       []string
	nextWordIdx func() int
	initWordIdx func(int)
}

func NewScannerEx(stdin io.Reader) *ReaderEx {
	var this ReaderEx
	var idx int
	var wordsCnt int
	this.baseScanner = bufio.NewScanner(stdin)
	this.baseScanner.Buffer(make([]byte, 0), 1E+11)
	this.nextWordIdx = func() int {
		cur := idx
		idx = (idx + 1) % wordsCnt
		return cur
	}
	this.initWordIdx = func(wc int) {
		idx = 0
		wordsCnt = wc
	}
	return &this
}

func (me *ReaderEx) Scan(doSplit bool) (isScanned bool) {
	isScanned = me.baseScanner.Scan()
	if doSplit {
		me.words = strings.Fields(me.baseScanner.Text())
	} else {
		me.words = []string{me.baseScanner.Text()}
	}
	me.initWordIdx(len(me.words))
	return
}

func (me *ReaderEx) nextBytes() []byte {
	return []byte(me.words[me.nextWordIdx()])
}
func (me *ReaderEx) nextString() string {
	return me.words[me.nextWordIdx()]
}

type StringArray []string

func (me *ReaderEx) nextStringArray() StringArray {
	return me.words[me.nextWordIdx():]
}

func (me StringArray) toStrings() []string {
	return me
}

func (me StringArray) toInts() []int {
	strValues := me.toStrings()
	values := make([]int, len(strValues))
	for i, v := range strValues {
		n, err := strconv.Atoi(v)
		if err != nil {
			panic(err)
		}
		values[i] = n
	}
	return values
}
func (me *ReaderEx) nextInt() int {
	n, err := strconv.Atoi(me.words[me.nextWordIdx()])

	defer func() {
		if err != nil {
			panic(fmt.Sprintf("getInt(%d)", n))
		}
	}()
	return n
}

func pow(x, y, mod int) (ans int) {

	ans = 1
	for bit := 1 << uint(math.Floor(math.Log2(float64(y)))); ; bit >>= 1 {
		if y&bit != 0 {
			ans *= x
			if mod > 0 {
				ans %= mod
			}
		}
		if bit <= 1 {
			return
		}
		ans *= ans
		if mod > 0 {
			ans %= mod
		}
	}
}

type factType struct {
	prime int
	count int
}

func fact(n int) (facts []*factType) {

	for i := 2; i*i <= n; i++ {
		if n%i == 0 {
			fa := factType{prime: i}
			for n%fa.prime == 0 {
				n /= fa.prime
				fa.count++
			}
			facts = append(facts, &fa)
		}
	}
	if n > 1 {
		facts = append(facts, &factType{prime: n, count: 1})
	}
	return facts
}
func dec2bin(n int) (ret []bool) {
	for bit := 1 << uint(math.Floor(math.Log2(float64(n)))); ; bit >>= 1 {
		ret = append(ret, n&bit != 0)

		if bit <= 1 {
			return
		}
	}

}

func abs(v int) int {
	if v < 0 {
		v = -v
	}
	return v
}

func b2i(b bool) (i int) {
	if b {
		i = 1
	} else {
		i = 0
	}
	return
}

func solve(stdin io.Reader, stdout io.Writer) {

	r := NewScannerEx(stdin)
	r.Scan(true)
	h, w := uint64(r.nextInt()), uint64(r.nextInt())

	if h > 1 && w > 1 {
		fmt.Fprintln(stdout, h*w/2+h*w%2)
	} else {
		fmt.Fprintln(stdout, 1)
	}
}


Measured memory_bytes: 640
// I look at my watch
// it say nine twenty-five
// And I think oh God
// I'm still alive
 
#include <bits/stdc++.h>
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define sz(x) int((x).size())
#define all(v) (v).begin(),(v).end()
#define trace(x) cerr << #x << " = " << x << endl
#define fastio ios_base::sync_with_stdio(0);cin.tie(0)
#define For(i,a,b) for(int i = int(a); i < int(b); ++i)
#define roF(i,a,b) for(int i = int(a); i >= int(b); i--)
using namespace std;
 
typedef long long ll;
typedef pair<int,int> ii;
typedef long double ld;




int main(){	
	int n,m;cin>>n>>m;
	vector<int>uwu;
	ll tot=0;
	For(i,0,n){
		int val;cin>>val;
		tot+=val;
		while(val>0){
			int cur=(val>>1)+(val&1);
			uwu.pb(cur);
			val>>=1;
		}
	}
	sort(uwu.rbegin(),uwu.rend());
	ll here=0;
	For(i,0,min(m,sz(uwu))){
		here+=uwu[i];
	}
	cout<<tot-here<<endl;

	return 0;
}


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

int ascSort(const void* v1, const void* v2) {
    const int _v1 = *((const int*)v1);
    const int _v2 = *((const int*)v2);
 
    if ( _v1 > _v2 ) {
        return 1;
    } else if ( _v1 < _v2 ) {
        return -1;
    } else {
        return 0;
    }
}

int main(){
  int i,n;
  scanf("%d",&n);
  int a[100005];
  for(i=0;i<n;i++){
    scanf("%d",&a[i]);
  }
  qsort(a,n,sizeof(a[0]),ascSort);
  int num,count,ans=0;
  int x=0;
  while(x<n){
    num = a[x];
    count = 0;
    while(a[x]==num){
      count += 1;
      x++;
    }
    if(count < num){
      ans += count;
    }else if(count > num){
      ans += count - num;
    }
  }
  printf("%d\n",ans);
  return 0;
}

      
  

Measured memory_bytes: 892
import sys
input = sys.stdin.readline

N, K = map(int,input().split())
td = [list(map(int, input().split())) for _ in range(N)]
td.sort(key=lambda x: (x[0],x[1]),reverse=True)

x= []
y= []
y.append(td[0][1])
for i in range(1,N):
    if td[i][0] != td[i-1][0]:
        y.append(td[i][1])
    else:
        x.append(td[i][1])
x.sort(reverse=True)
y.sort(reverse=True)
ans = 0
sum_y = 0
sum_x = []
tmp = 0
sum_x.append(0)
for i in range(len(x)):
    tmp += x[i]
    sum_x.append(tmp)

for i in range(1,min(K,len(y))+1):
    sum_y += y[i-1]
    if len(sum_x) < K-i+1: continue
    ans = max(ans, sum_y + sum_x[K-i] + i*i)
    
print(ans)


Measured memory_bytes: 67932
package main

import "fmt"

func main() {
	var n int
	 fmt.Scan(&n) 
	//n = 179	
	t := fmt.Sprintf("%d", n)
	for _, s := range t {
//fmt.Println(string(s))
if string(s) == "9" {
	fmt.Println("Yes")
	return
}
	}

	fmt.Println("No")
}


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

using namespace std;

#define REP(i,a,b) for(int i=a;i<(int)b;i++)
#define rep(i,n) REP(i,0,n)

///double dp[44][44];
vector<double> ps;
int N, M;

double const pi = acos(-1);

double triangle(int s, int t, int k) {
  vector<int> idxs = {s, t, k};
  sort(idxs.begin(), idxs.end());

  double a = 2 * pi * ps[idxs[0]];
  double b = 2 * pi * ps[idxs[1]];
  double c = 2 * pi * ps[idxs[2]];

  double ba = b - a;
  double cb = c - b;
  double ac = a - c;

  while(ba < 0) { ba += 2 * pi; }
  while(cb < 0) { cb += 2 * pi; }
  while(ac < 0) { ac += 2 * pi; }

  return (sin(ba) + sin(cb) + sin(ac)) / 2.0;
}

int st;
map<pair<int, int>, double> mp;

double dfs(int curr, int rem) {
  if(rem == 0) { return 0.0; }
  if(N + st - curr + 1 <= 1) { return -100000000; }
  if(mp.find({curr, rem}) != mp.end()) { return mp[{curr, rem}]; }
  auto& ret = mp[{curr, rem}];

  REP(i, curr + 1, N + st) {
    double d = triangle(st % N, curr % N, i % N);
    d += dfs(i, rem-1);
    ret = max(ret, d);
  }
  return ret;
}

int main() {

  for(;cin >> N >> M && (N|M);) {
    ps.clear();
    ps.resize(N);
    rep(i, N) cin >> ps[i];
    sort(ps.begin(), ps.end());
    double ans = -10000000000;
    rep(i, N) {
      mp.clear();
      st = i;
      ans = max(ans, dfs(i, M-1));
    }

    printf("%.6f\n", ans);

  }

  return 0;
}

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

typedef long long ll;
#define pii pair<int , int>
#define _FastIO ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define MAXX 200005

int n;
int a[MAXX];
int b[MAXX];

int main()
{
    _FastIO;
    cin >> n;
    for(int i = 0; i < n; i++){
        cin >> a[i];
        b[i] = a[i];
    }
    sort(b , b + n);
    for(int i = 0; i < n; i++){
        if(a[i] == b[n - 1]){
            cout << b[n - 2] << endl;
        }
        else
            cout << b[n - 1] << endl;
    }
    return 0;
}


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

using namespace std;

#define int long long 

signed main(){

  int S, T, D;
  int now, minimum = 0;
  vector<int> w;
  
  cin>>S>>T>>D;

  w.resize(D);

  now = 0;
  
  for(int i = 0; i < D; i++){
    cin>>w[i];
    
    now += w[i];
    minimum = min(minimum, now);
    if(S + now <= T){
      cout<<i+1<<endl;
      return 0;
    }
  }

  if(now >= 0){
    cout<<-1<<endl;
  } else {
    int x = S - T + minimum;
    int y  = - (x - now -1) / now * now;
    int z = - (x - now -1) / now;

    
    for(int i = 0; i < D; i++){
      y += w[i];

      if(S + y <= T){
        cout<<i+1+z*D<<endl;
        return 0;
      }
    }
  }
  
  return 0;
}



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

#define int long long

#define rep(i,n) for(int i=0;i<(n);i++)
#define pb push_back
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second
typedef vector<int>vint;
typedef pair<int,int>pint;
typedef vector<pint>vpint;

template<typename A,typename B>inline void chmin(A &a,B b){if(a>b)a=b;}
template<typename A,typename B>inline void chmax(A &a,B b){if(a<b)a=b;}

signed main(){
    int N,A,B;
    cin>>N>>A>>B;

    vint ans;
    if(A==1){
        if(B!=N){
            cout<<-1<<endl;
            return 0;
        }
        rep(i,N)ans.pb(-i);
    }
    else if(B==1){
        if(A!=N){
            cout<<-1<<endl;
            return 0;
        }
        rep(i,N)ans.pb(i);
    }
    else{
        if(A+B-1>N||A*B<N){
            cout<<-1<<endl;
            return 0;
        }
        int r=N-A;
        for(int i=0;i<A;i++){
            ans.pb(i*1000000);
            for(int j=0;r&&j+1<B;j++){
                r--;
                ans.pb(ans.back()-1);
            }
        }
    }


    vint latte;
    rep(i,N)latte.pb(ans[i]);
    sort(all(latte));
    rep(i,N){
        if(i)cout<<" ";
        cout<<lower_bound(all(latte),ans[i])-latte.begin()+1;
    }cout<<endl;
    return 0;
}


Measured memory_bytes: 12012
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author tatsumack
 */

#include <iostream>
#include <fstream>

#include <iostream>
#include <limits.h>
#include <algorithm>
#include <bitset>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>

#include <list>
#include <map>
#include <numeric>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#include <queue>
#include <unordered_map>
#include <unordered_set>

#define int long long
#define REP(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i)
#define REPS(i, n) for (int i = 1, i##_len = (n); i <= i##_len; ++i)
#define FOR(i, a, b) for (int i = (a), i##_len = (b); i <= i##_len; ++i)
#define REV(i, a, b) for (int i = (a); i >= (b); --i)
#define CLR(a, b) memset((a), (b), sizeof(a))
#define DUMP(x) cout << #x << " = " << (x) << endl;
#define INF 1001001001001001001ll
#define fcout cout << fixed << setprecision(12)

using namespace std;

typedef pair<int, int> P;

class ABlackjack {
public:
    static constexpr int kStressIterations = 0;

    static void generateTest(std::ostream& test) {
    }

    void solve(std::istream& cin, std::ostream& cout) {
        int a1, a2, a3;
        cin >> a1 >> a2 >> a3;
        int sum = a1 + a2 + a3;
        if (sum >= 22) {
            cout << "bust" << endl;
        } else {
            cout << "win" << endl;
        }
    }
};


signed main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    std::istream& in(std::cin);
    std::ostream& out(std::cout);

    ABlackjack solver;
    solver.solve(in, out);
    return 0;
}


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

using ll = long long;
using ull = unsigned long long;
using ld = long double;

#define MOD 1000000007LL

#define rep(i, n) for(ll (i) = 0LL;(i) < (ll)(n);(i)++)
#define rep2(i, s, e) for(ll (i) = (ll)(s);(i) < (ll)(e);(i)++)
#define repi(i, n) for(ll (i) = 0LL;(i) <= (ll)(n);(i)++)
#define repi2(i, s, e) for(ll (i) = (ll)(s);(i) <= (ll)(e);(i)++)
#define per(i, n) for(ll (i) = (ll)(n) - 1LL;(i) >= 0LL;(i)--)
#define per2(i, s, e) for(ll (i) = (ll)(s) - 1LL;(i) >= (ll)(e);(i)--)
#define peri(i, n) for(ll (i) = (ll)(n);(i) >= 0LL;(i)--)
#define peri2(i, s, e) for(ll (i) = (ll)(s);(i) >= (ll)(e);(i)--)
#define iter(i, it) for(auto &(i): (it))

template<typename T, typename U> ostream& operator<<(ostream &s, const pair<T, U> m) {
    cout << "(" << m.first << ", " << m.second << ")";
    return s;
}
template<typename T, typename U> ostream& operator<<(ostream &s, const map<T, U> m) {
    ll c = 0;
    cout << "{ ";
    iter(i, m) cout << i << (c++ == m.size() - 1 ? " " : ", ");
    cout << "}";
    return s;
}
template<typename T> ostream& operator<<(ostream &s, const vector<T> &v) {
    cout << "{ ";
    rep(i, v.size()) cout << v[i] << (i == v.size() - 1 ? " " : ", ");
    cout << "}";
    return s;
}
template<typename T> ostream& operator<<(ostream &s, const list<T> &v) {
    ll c = 0;
    cout << "{ ";
    iter(i, v) cout << i << (c++ == v.size() - 1 ? " " : ", ");
    cout << "}";
    return s;
}

int main(void) {
    ll ABC[3];
    ll count = 0;
    cin >> ABC[0] >> ABC[1] >> ABC[2];
    while(!(ABC[0] == ABC[1] && ABC[1] == ABC[2])) {
        sort(ABC, ABC + 3);
        if(ABC[2] - ABC[0] >= 2) ABC[0] += 2;
        else ABC[0]++, ABC[1]++;
        count++;
    }
    cout << count << endl;
    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 all(x) (x).begin(),(x).end() //使うときはsort(all())という感じで
using ll = long long;
#define PI 3.14159265359

int main(void){
  ll h;
  cin>>h;
  int m=abs(log(h)/log(2));
  cout<<static_cast<ll>(pow(2,m+1)-1)<<endl;  
}
  

Measured memory_bytes: 640
#include <bits/stdc++.h>
const int INF=1e9;
const int MOD=1e9+7;
//const int MOD=998244353;
const long long LINF=1e18;
using namespace std;
#define int long long
//template
//main
signed main(){
  int N;cin>>N;
  std::vector<long double> v(N);
  for(int i=0;i<N;i++)cin>>v[i];
  long double ans=0;
  for(int i=0;i<N;i++)ans+=1.0/v[i];
  ans=1.0/ans;
  cout<<fixed<<setprecision(12)<<ans<<endl;
}


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

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

  long long int A[N];
  for(long long int i = 0; i < N; ++i){
    cin >> A[i];
    A[i] -= i+1;
  }

  sort(A, A+N);
  
  const long long int m {A[N/2]};
  long long int ans {0};
  
  for(long long int i = 0; i < N; ++i) ans += abs(A[i]-m);

  cout << ans << endl;
}

Measured memory_bytes: 1792