akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <utility>
#include <functional>
#include <climits>
#include <cstring>

using namespace std;

#define int long long
#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 all(a) begin(a),end(a)
#define fst first
#define scd second
#define PB emplace_back
#define PPB pop_back

using vi=vector<int>;
using pii=pair<int, int>;

bool chmin(int&a,int b){return a>b?(a=b,true):false;}
bool chmax(int&a,int b){return a<b?(a=b,true):false;}
int read(){int a;scanf("%lld",&a);return a;}

int N;
vector<pii> ts[16];
int cnt[16][2];

signed main()
{
	cin >> N;

	rep(i, N) {
		int a = read();
		rep(j, a) {
			int x = read(), y = read();
			x--;
			ts[i].push_back(pii(x, y));
		}
	}

	int mx = 0;

	for (int S = 0; S < (1 << N); ++S) {
		memset(cnt, 0, sizeof cnt);

		for (int i = 0; i < N; ++i) {
			if (S >> i & 1) {
				for (pii &t : ts[i])
					cnt[t.fst][t.scd]++;
			}
		}

		int counter = 0;

		bool ok = true;

		for (int i = 0; i < N; ++i) {
			if (cnt[i][0] > 0 and cnt[i][1] > 0) {
				ok = false;
			}

			if (S >> i & 1) {
				counter++;
				if (cnt[i][0] > 0) ok = false;
			}

			if ((S >> i & 1) == 0 and cnt[i][1] > 0) ok = false;
		}

		if (ok)
			mx = max(mx, counter);
	}

	cout << mx << endl;
}




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

int main() {
	long long H, W, A[80][80], B[80][80];
	static bool DP[80][80][6401] = {};
	cin >> H >> W;
	for (int i = 0; i < H; i++) for (int j = 0; j < W; j++) cin >> A[i][j];
	for (int i = 0; i < H; i++) for (int j = 0; j < W; j++) cin >> B[i][j];
	DP[0][0][abs(A[0][0] - B[0][0])] = true;
	for (int i = 0; i < H; i++) {
		for (int j = 0; j < W; j++) {
			if (i == 0 && j == 0) continue;
			if (i == 0) {
				for (int k = 0; k <= 6400; k++) {
					if (DP[i][j - 1][k]) {
						if (abs(k + A[i][j] - B[i][j]) <= 6400) DP[i][j][abs(k + A[i][j] - B[i][j])] = true;
						if (abs(k - A[i][j] + B[i][j]) <= 6400) DP[i][j][abs(k - A[i][j] + B[i][j])] = true;
					}
				}
			}
			if (j == 0) {
				for (int k = 0; k <= 6400; k++) {
					if (DP[i - 1][j][k]) {
						if (abs(k + A[i][j] - B[i][j]) <= 6400) DP[i][j][abs(k + A[i][j] - B[i][j])] = true;
						if (abs(k - A[i][j] + B[i][j]) <= 6400) DP[i][j][abs(k - A[i][j] + B[i][j])] = true;
					}
				}
			}
			if (i != 0 && j != 0) {
				for (int k = 0; k <= 6400; k++) {
					if (DP[i][j - 1][k] || DP[i - 1][j][k]) {
						if (abs(k + A[i][j] - B[i][j]) <= 6400) DP[i][j][abs(k + A[i][j] - B[i][j])] = true;
						if (abs(k - A[i][j] + B[i][j]) <= 6400) DP[i][j][abs(k - A[i][j] + B[i][j])] = true;
					}
				}
			}
		}
	}
	for (int i = 0; i <= 6400; i++) {
		if (DP[H - 1][W - 1][i]) {
			cout << i << endl;
			return 0;
		}
	}
}

Measured memory_bytes: 40192
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <cfloat>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <fstream>
#include <functional>
#include <bitset>

using namespace std;
#define int long long int
const int INF = 1001001001001001LL;

int di[] = {-1, 0, 1, 0, -1, 1, 1, -1};
int dj[] = {0, 1, 0, -1, 1, 1, -1, -1};

// えびちゃんの make_vector (ここから)
template <typename Tp, size_t N>
std::vector<Tp> make_vector_detail(std::vector<size_t>& sizes, typename std::enable_if<(N == 1), const Tp&>::type x) {
  return std::vector<Tp>(sizes[0], x);
}
template <typename Tp, size_t N>
auto make_vector_detail(std::vector<size_t>& sizes, typename std::enable_if<(N > 1), const Tp&>::type x) {
  size_t size = sizes[N-1];
  sizes.pop_back();
  return std::vector<decltype(make_vector_detail<Tp, N-1>(sizes, x))>(size, make_vector_detail<Tp, N-1>(sizes, x));
}

template <typename Tp, size_t N>
auto make_vector(const size_t(&sizes)[N], const Tp& x) {
  std::vector<size_t> s(N);
  for (size_t i = 0; i < N; ++i) s[i] = sizes[N-i-1];
  return make_vector_detail<Tp, N>(s, x);
}
// えびちゃんの make_vector (ここまで)

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

    vector<int> imos(n + 1, 0);
    for(int i = 0; i < m; i++){
        imos[a[i] - 1]++;
        imos[b[i]]--;
    }

    for(int i = 0; i < n; i++) imos[i + 1] += imos[i];

    int ans = 0;
    for(int i = 0; i < n; i++) if(imos[i] == m) ans++;
    cout << ans << endl;
    return 0;
}


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

#define rep2(x,fr,to) for(int (x)=(fr);(x)<(to);(x)++)
#define rep(x,to) for(int (x)=0;(x)<(to);(x)++)
#define repr(x,fr,to) for(int (x)=(fr);(x)>=(to);(x)--)
#define all(c) (c).begin(),(c).end()
#define sz(v) (int)(v).size()

using namespace std;
typedef long long ll; typedef vector<int> VI; typedef pair<int,int> pii;
const int mod = (int)1e9 + 7;
void dbg(){ cerr << "\n"; }  template <typename T,typename ...T2> 
void dbg(const T& fst, const T2&...rst){ cerr << fst << ": "; dbg(rst...); }
const int dr[]={0,1,0,-1,0};

int main(){
	string s;
	cin >>s;
	if(sz(s)==3) reverse(all(s));
	cout << s  <<"\n";
}



Measured memory_bytes: 256
from itertools import product
n, m, x = map(int, input().split())
ca = [tuple(map(int, input().split()))for _ in range(n)]
INF = 10**18
ans = INF
for bit in product((0, 1), repeat=n):
    proficiency = [0]*m
    cost = 0
    for i in range(n):
        if bit[i]:
            c, *A = ca[i]
            cost += c
            for j in range(m):
                proficiency[j] += A[j]
    if cost < ans and all(x <= proficiency[j] for j in range(m)):
        ans = cost
print(ans if ans != INF else -1)

Measured memory_bytes: 9228
#include <bits/stdc++.h>
#include <random>
#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;
using ll = long long;
using P = pair<int,int>;
using ull= unsigned long long;
const ll K_MAX=1e5+5;
const ll Lmax=ll(1e18);
const ll Nmax=1e9;
const ll INF=1e9;

// B貪欲法で決定する．
int main(){
  clock_t start = clock();
  int d;
  cin>>d;
  vector<int> c(26);
  vector<vector<int>> s(d,vector<int>(26));
  vector<int> last(26),last0(26);
  vector<int>c_inv(26); // iを選んだ際の1日での下がり幅
  

  ll c_tot=0;
  rep(i,26){
    cin>> c[i];
    c_tot+=c[i];
    last[i]=-1;
    last0[i]=-1;
  }
  rep(i,26){
    c_inv[i]=c_tot-c[i];
  }

  rep(i,d){//i日目
    rep(j,26){
      cin>>s[i][j];
    }
  }
  // ここまで入力．

  //貪欲法により，初期値t[i]を決める．
  vector<int> t(d);
  int maxloss, iml; // maxlossとその日付
  random_device rnd;
  maxloss=INF;
  rep(i,d){//i日目
   int maxs=-INF;
   int jm=0;

   rep(j,26){
     cin>>s[i][j];
     ll casej=s[i][j];
     rep(k,26){
       if(j!=k){
         casej-=c[k]*(i-last[k]);
       }
     }

     if(casej>maxs){
       maxs=casej;
       jm=j;
     }
   }

   if(maxs<maxloss){
     maxloss=maxs;
     iml=i;
   }
   
   last[jm]=i;
   t[i]=jm;
  }


  int cicle=0;
  int Ncicle=10000;
  ll sum;
  bool judge=true;
  double time;
  int ti;
  ll casei;
  ll loss;
 while(judge){
   cicle++;
   t[iml]=rnd()%26;
   
   maxloss=INF;
   sum=0;
   loss=0;
   last=last0;
   
   
   rep(i,d){//i日目
     ti=t[i];
     
     loss+=c_tot-c[ti]*(i-last[ti]);
     last[ti]=i;
     casei= s[i][ti]-loss;
     
     sum+= casei;
     
     if(casei<maxloss){//最も増加の小さい日を決定．
       maxloss=casei;
       iml=i;
     }
  }  
   clock_t end = clock();
   time = static_cast<double>(end - start) / CLOCKS_PER_SEC * 1000.0;

   if(time>1950){
       judge=false;
   }

 }//while
  
  
  rep(i,d){
    cout<<t[i]+1<<endl;
   }
 // cout<<sum; //消すこと









}


Measured memory_bytes: 3724
#include <iostream>
#include <vector>
//#include <string>
#include <algorithm>
//#include <math.h>
//#include <queue>
//#include <stack>
//#include <iomanip>

// sometimes used
//#include <set>
//#include <map>
//#include <numeric>
//#include <list>
//#include <deque>
//#include <unordered_map>

typedef long long LL;
//typedef long double LD;
using namespace std;
 
//#define MOD 1000000007
//#define MAX 100100
//#define NIL -1
//#define INFTY 1000000000000000000

bool cmp(pair<LL,LL> &x, pair<LL,LL> &y)
{
    return x.first < y.first;
}

int main(){
    LL n;
    LL d;
    LL a;
    cin >> n >> d >> a;
    vector<pair<LL,LL>> xh(n);
    vector<LL> x(n);
    vector<LL> h(n);
    vector<LL> endp;
    vector<LL> endv;
    for(LL i=0; i<n; i++){
        cin >> xh[i].first >> xh[i].second;
        xh[i].first--;
    }
    sort(xh.begin(), xh.end(), cmp);
    for(LL i=0; i<n; i++){
        x[i]=xh[i].first;
        h[i]=xh[i].second;
    }
    LL sum=0;
    LL idx=0;
    LL ans=0;
    for(LL i=0; i<n; i++){
        auto itr=lower_bound(endp.begin(), endp.end(), x[i]);
        LL dist=distance(endp.begin(), itr);
        //cout << "dist " << dist << endl;
        for(LL i=idx; i<dist; i++){
            sum-=endv[i];
        }
        //cout << i << " " << sum << endl;
        idx=max(idx, dist);
        if(h[i]>sum){
            LL tmp;
            if((h[i]-sum)%a==0){
                tmp=(h[i]-sum)/a;
            }else{
                tmp=(h[i]-sum)/a+1;
            }
            //cout << tmp << endl;
            sum=sum+tmp*a;
            //cout << "endp " << x[i]+2*d << endl;
            endp.push_back(x[i]+2*d);
            endv.push_back(tmp*a);
            ans+=tmp;
        }
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 12884
#include<iostream>
main(){int n,m,i,a,c[1000001];for(std::string s;std::cin>>n>>m>>s,n;printf("%d\n",a))for(a=0,i=m;--i;a+=c[i]>=n)c[i]=s.substr(i,3)=="IOI"?c[i+2]+1:0;}

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

namespace ConsoleApplication3
{
    class Program
    {
        static void Main(string[] args)
        {
            while (true)
            {
                var x = Console.ReadLine().Split().ToArray();
                var a = int.Parse(x[0]);
                var op = x[1];
                var b = int.Parse(x[2]);
                if(op=="?")
                    break;
                if(op=="+")
                {
                    Console.WriteLine(a+b);
                }
                if(op=="-")
                {
                    Console.WriteLine(a-b);
                }
                if(op=="*")
                {
                    Console.WriteLine(a*b);
                }
                if(op=="/")
                {
                    Console.WriteLine(a/b);
                }
            }
        }
    }
}

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

using namespace std;

using ll = long long;

int main(void) {
  ll k, n;
  cin >> k >> n;
  vector<ll> v(n);
  for (int i = 0; i < n; i++) {
    cin >> v[i];
  }  
  ll len = k - v[n - 1] + v[0];
  for (int i = 0; i < n - 1; i++) {
    len = max(len, v[i + 1] - v[i]);
  }
  cout << k - len << endl;
  return 0;
}

Measured memory_bytes: 1792
#include <stdio.h>

#define M 1233361
#define NIL (-1)

int A[M];

int h1(int key) { return key % M; }
int h2(int key) { return 1 + (key % (M - 1)); }

int find(int val)
{
	int i, h;
	for (i = 0; ; i++)
	{
		h = (h1(val) + i * h2(val)) % M;
		if (A[h] == val) return 1;
		else if (A[h] == NIL) return 0;
	}
}

int insert(int val)
{
	int i, h;
	for (i = 0; ; i++)
	{
		h = (h1(val) + i * h2(val)) % M;
		if (A[h] == val) return 1;
		else if (A[h] == NIL)
		{
			A[h] = val;
			return 0;
		}
	}
}

void calc(int i, int w, int n)
{
	int k, w2;

	for (k = i; k < n; k++)
	{
		w2 = w + A[k];
		insert(w2);
		calc(k + 1, w2, n);
	}
}

int main(void)
{
	int n, i, val;

	for (i = 0; i < M; i++) A[i] = NIL;

	scanf("%d", &n);

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

	calc(0, 0, n);

	scanf("%d", &n);
	for (i = 0; i < n; i++)
	{
		scanf("%d", &val);
		if (find(val)) printf("yes\n");
		else printf("no\n");
	}

	return 0;
}

Measured memory_bytes: 6488
from collections import deque
from bisect import bisect_left

n = int(input())
a = [int(input()) for _ in range(n)]

dp = deque([])
b = []
for i in range(n):
    j = bisect_left(dp, a[i])
    if j == 0:
        dp.appendleft(a[i])
    else:
        dp[j-1] = a[i]

print(len(dp))


Measured memory_bytes: 13780
#include <bits/stdc++.h>
#define ld long double
#define endl "\n"
#define fastio ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define pb(x) push_back(x)
#define mp(a,b) make_pair(a,b)
#define ms(v,x) memset(v,x,sizeof(v))
#define all(v) v.begin(),v.end()
#define ff first
#define ss second
#define rep(i, a, b) for(int i = a; i < (b); ++i)
//#define per(i, a, b) for(int i = b-1; i>=a ; i--)
#define trav(a, x) for(auto& a : x)
#define allin(a , x) for(auto a : x)
#define td(v) v.begin(),v.end()
#define sz(v) (int)v.size()
//#define M   1000000007 // 1e9 + 7
#define int long long
using namespace std;
typedef vector<int> vi;
typedef long long ll;
typedef pair<int,int> pii;

inline ll mod(ll n, ll m ){ ll ret = n%m; if(ret < 0) ret += m; return ret; }
ll gcd(ll a, ll b){return (b == 0LL ? a : gcd(b, a%b));}

ll exp(ll a,ll b,ll m){
    if(b==0LL) return 1LL;
    if(b==1LL) return mod(a,m);
    ll k = mod(exp(a,b/2,m),m);
    if(b&1LL){
        return mod(a*mod(k*k,m),m);
    }
    else return mod(k*k,m);
}

const double PI = acos(-1);

int32_t main(){
  fastio;
  double a,b;
  cin>>a>>b;
  double h,m;
  cin>>h>>m;
  double ang1 = (h * 360.0)/12.0 + (m*30.0)/60.0;
  double ang2 = (m * 360.0)/60.0;
  double o = abs(ang1 - ang2);
  o = (o*PI)/180.0;
  o = min(o,2.0*PI - o);
 // cout << o << endl;
  double x = a*a + b*b - 2.0 * a* b * cos(o);
  x = sqrt(x);
  cout << setprecision(10)<<fixed;
  cout << x << endl;

  // Math -> gcd it all
  // Did u check N=1? Did you switch N,M?
}

Measured memory_bytes: 4308
#include<iostream>
#include<stdio.h>
#include<string>
#include<vector>
#include<map>
#include<tuple>
#include<algorithm>
#include<cmath>
#include<limits>
#include<set>
#include<queue>
using namespace std;
#define int long  long int
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
int lcm(int a, int b) { return a / gcd(a, b) * b; }
typedef pair<int, int>P;
const int INF = 1e8;

signed main() {
	int N, A, B;
	cin >> N >> A >> B;
	if (N * A < B)cout << N * A;
	else cout << B;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(void)
{
	int w,a,b;
	scanf("%d%d%d",&w,&a,&b);
	if(b+w>=a&&a+w>=b)puts("0");
	else if(a>b+w)printf("%d",a-b-w);
	else printf("%d",b-a-w);
	return 0;
}

Measured memory_bytes: 128
{-# LANGUAGE BangPatterns #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE TupleSections #-}
{-# LANGUAGE RankNTypes #-}
import qualified Data.ByteString.Lazy.Char8 as B
import Data.Maybe
-- import Data.List
import qualified Data.Vector.Unboxed as VU
-- import qualified Data.Vector.Unboxed.Mutable as VUM
-- import Control.Monad
-- import Control.Monad.ST
-- import Debug.Trace
-- trace _ = id

solve :: Int -> [Int] -> [Int]
solve n bs = case stage [] n vec of
               Nothing -> [-1]
               Just acc -> acc
  where
  vec = VU.fromListN (n+1) (0:bs)
  

  stage acc 0 v = Just acc
  stage acc k v | null ls = Nothing
                | otherwise = stage (k0:acc) (k-1) vNext
    where
    ls = [i | i <- [1..k], v VU.! i == i]
    k0 = maximum ls
    vNext = (VU.slice 0 k0 v) VU.++ (VU.slice (k0+1) (k-k0) v)

readBInt :: B.ByteString -> Int
readBInt = fst . fromJust . B.readInt

tmain :: B.ByteString -> [Int]
tmain cont =
  let remLines0 = map B.words (B.lines cont)
      [bs_n]:remLines1 = remLines0
      n = readBInt bs_n
      line2:remLines2 = remLines1
      bs = map readBInt line2
  in solve n bs

outAnswer :: [Int] -> IO ()
outAnswer xs = putStr $ unlines $ map show xs

main :: IO ()
main = outAnswer . tmain =<< B.getContents



Measured memory_bytes: 636
#include <stdio.h>
int main(void)
{
	int i,j,n,x[4][13],num,typ;
	char tmp,sp;
	scanf("%d",&n);
	for(i=0;i<4;i++){
		for(j=0;j<13;j++)
			x[i][j]=0;
	}
	for(i=0;i<n;i++){
		scanf("%c %c %d",&sp,&tmp,&num);
		if(tmp=='S') typ=0;
		else if(tmp=='H') typ=1;
		else if(tmp=='C') typ=2;
		else if(tmp=='D') typ=3;
		j=num-1;
		x[typ][j]=1;
	}
	for(i=0;i<4;i++){
		for(j=0;j<13;j++){
			if(x[i][j]==0){
				if(i==0) tmp='S';
				else if(i==1) tmp='H';
				else if(i==2) tmp='C';
				else if(i==3) tmp='D';
				printf("%c %d\n",tmp,j+1);
			}
		}
	}
	return 0;
}

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

int selectionSort(int n, int a[]) {
  int cnt = 0;
  for (int i=0;i<n;i++) {
    int minj = i;
    for (int j=i;j<n;j++)
      if (a[j] < a[minj])
        minj = j;
    if (i != minj) {
      swap(a[i], a[minj]);
      cnt++;
    }
  }
  return cnt;
}

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

  int cnt = selectionSort(n, a);
  for (int i=0;i<n-1;i++)
    cout << a[i] << " ";
  cout << a[n-1] << endl;
  cout << cnt << endl;
}



Measured memory_bytes: 3092
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)
#define rep2(i, a, n) for(ll i = a; i < (ll)(n); i++)
#define memi cout << endl
#define kono(n) cout << fixed << setprecision(n)
#define all(c) (c).begin(), (c).end()
#define pb push_back
#define hina cout << ' '
#define in(n) cin >> n
#define in2(n, m) cin >> n >> m
#define in3(n, m, l) cin >> n >> m >> l
#define out(n) cout << n
const ll mei = (ll)1e9 + 7;

int main(){
  ll n, k, a;
  in2(n, k);
  vector<ll> c(n), d(300000, 0);
  rep(i, n)
    in(c[i]);
  a = 1;
  sort(all(c));
  rep(i, n - 1){
    if(c[i] != c[i + 1])
      a++;
  }
  if(a <= k){
    out(0);
    memi;
    return 0;
  }
  a = a - k;
  rep(i, n)
    d[c[i]]++;
  sort(all(d));
  n = k = 0;
  while(a > 0){
    if(d[k] != 0){
      n = n + d[k];
      a--;
    }
    k++;
  }
  out(n);
  memi;
}


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

int main() {
  int n;
  long long ans = 0ll,x = 0ll;
  cin >> n;
  vector<long long> a(n + 1);
  for(int i = 0; i < n + 1; i++){
    cin >> a.at(i);
  }
  vector<long long> b(n);
  for(int i = 0; i < n; i++){
    cin >> b.at(i);
  }
  for(int i = 0; i < n; i++){
    if(x + b.at(i) < a.at(i)){
      ans += b.at(i) + x;
      x = 0;
    }else{
      ans += a.at(i);
      if(a.at(i) < x){
        x = b.at(i);
      }else{
        x = x + b.at(i) - a.at(i);
      }
    }
  }
  ans += min(x,a.at(n));
  cout << ans << endl;
}


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

void solve() {
    string S;
    cin >> S;
    if (S== "SUN") {
        cout << 7 << endl;
    }
    else if (S== "MON") {
        cout << 6 << endl;
    }
    else if (S== "TUE") {
        cout << 5 << endl;
    }
    else if (S== "WED") {
        cout << 4 << endl;
    }
    else if (S== "THU") {
        cout << 3 << endl;
    }
    else if (S== "FRI") {
        cout << 2 << endl;
    }
    else {
        cout << 1 << endl;
    }
}

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


Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
#define int long long
#define REP(i, n) for (int i = 0; i < (int)n; ++i)
#define RREP(i, n) for (int i = (int)n - 1; i >= 0; --i)
#define FOR(i, s, n) for (int i = s; i < (int)n; ++i)
#define RFOR(i, s, n) for (int i = (int)n - 1; i >= s; --i)
#define ALL(a) a.begin(), a.end()
#define IN(a, x, b) (a <= x && x < b)
template<class T>inline void out(T t){cout << t << "\n";}
template<class T,class... Ts>inline void out(T t,Ts... ts){cout << t << " ";out(ts...);}
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;}
constexpr int INF = 1e18;


signed main(){
	int N;
	cin >> N;
	vector<int>cnt(N + 1);
	FOR(i, 1, N + 1) {
		if(i * i > N)break;
		FOR(j, 1, N + 1) {
			if(j * j > N)break;
			FOR(k, 1, N + 1) {
				if(k * k > N)break;
				int t = i * i + j * j + k * k + i * j + j * k + k * i;
				if(t <= N)++cnt[t];
			}
		}
	}
	FOR(i, 1, N + 1) {
		out(cnt[i]);
	}
}

Measured memory_bytes: 3616
import sys
input = sys.stdin.readline
def inputs():
    return [int(x) for x in input().split()]
S = list(input())
N = int(input())
if len(S)==2:
  print(N//2)
  exit()
ans = 0
flag=0
if S[0]==S[-2]:
  cnt=1
  cntb=1
  for i in range(len(S)-2):
    if S[i]==S[i+1]:
      cnt+=1
    else:
      break
  for j in range(len(S)-2,0,-1):
    if S[j]==S[j-1]:
      cntb +=1
    else:
      break
  if cnt==cntb==len(S)-1 and cnt%2==1:
    S[0]="aaaaaa"
    ans+=1
    flag=2
  elif cntb%2!=0:
    if cnt%2==0:
      S[0]="aaa"
      ans+=1
    else:
      S[0]="aaa"
      ans+=1
      flag = 1
for i in range(len(S)-2):
    if S[i]==S[i+1]:
        ans +=1
        S[i+1]="aa"
if flag==0:
	print(ans*N)
elif flag==1:
  print(ans*(N-1)+ans-1)
else:
  print(ans*N-(N+2-1)//2)


Measured memory_bytes: 3064
#include <stdio.h>

int main(void)
{
    int i = 0, j, l = 0;
    char s[202], p[102];

    fgets(s, 202, stdin);
    fgets(p, 102, stdin);

    while (s[i++] != '\n')
	l++;
    
    for (i = 0; i < l; i++)
	s[l + i] = s[i];
    s[l + i] = '\0';

    for (i = 0; i < l; i++) {
	j = 0;
	while (p[j] != '\n') {
	    if (s[i + j] != p[j])
		break;
	    j++;
	}
	if (p[j] == '\n')
	    break;
    }

    printf("%s\n", (p[j] == '\n' ? "Yes" : "No"));
    
    return 0;
}


Measured memory_bytes: 2112
import java.util.*;
import java.io.*;

public class Main {
	
	public  void solve() throws IOException{
		int[][] result = new int[4][2];
		while( stdIn.hasNext() ){
			double[] eye = new double[2];
			for(int i = 0; i < 2; i++){
				eye[i] = stdIn.nextDouble();
				if( eye[i] >= 1.1 ){
					result[0][i]++;
				} else if( eye[i] >= 0.6 ){
					result[1][i]++;
				} else if( eye[i] >= 0.2 ){
					result[2][i]++;
				} else {
					result[3][i]++;
				}
			}
		}
		for(int[] x : result){
			writer.println(x[0] + " " + x[1]);
		}	
		writer.flush();				
	}
	public static void main (String args[]) throws IOException{
		new Main().run();
	}
	
	Scanner stdIn;
	PrintWriter writer;
	
	public void run() throws IOException{
		stdIn = null;
		try{
			stdIn = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
			writer = new PrintWriter(System.out);
			solve();
			stdIn.close();
			writer.close();
		} catch (Exception e){
			e.printStackTrace();
			System.exit(1);
		}
	}	
}

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

using namespace std;

template<class T>
ostream& operator<<(ostream& os, const vector<T> &vec){
    os << "[";
    for(int i=0;i<vec.size();i++){
        os << (i==0?"":" ") << vec[i];
    }
    os <<  "]";
    return os;
}


int main(){
    int n, m;
    cin >> n >> m;
    vector<vector<int>> A(n, vector<int>(m));
    for(int i=0;i<n;i++){
        for(int j=0;j<m;j++){
            cin >> A[i][j];
            A[i][j]--;
        }
    }

    int ans = 0;
    for(int num=1;num<=n;num++){
        vector<int> pos(n, 0);
        set<int> blacklist;
        vector<int> cnt(m, 0);
        while(1){
            bool flag = true;
            fill(cnt.begin(), cnt.end(), 0);
            for(int i=0;i<n;i++){
                int sports = A[i][pos[i]];
                cnt[sports]++;
                if(cnt[sports] > num){
                    flag = false;
                    blacklist.insert(sports);
                }
            }
            
            if(flag){
                ans = num;
                break;
            }
            bool failed = false;
            for(int i=0;i<n;i++){
                while(pos[i] < m && blacklist.count(A[i][pos[i]]))
                    pos[i]++;
                if(pos[i] == m){
                    failed = true;
                    break;
                }
            }
            if(failed)
                break;
        }
        if(ans != 0)
            break;
    }
    cout << ans << endl;
    return 0;
}


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

int main(void){
    int N,M;
    cin >> N >> M;


    vector<vector<int>> G(N);
    vector<pair<int,int>> p(M);
    for(int i=0;i<M;i++){
        int a,b;
        cin >> a >> b;
        p[i].first = min(a,b)-1;
        p[i].second = max(a,b)-1;
    }
    sort(p.begin(),p.end());

    int preva = 0, prevb = 0;
    for(int i=0;i<M;i++){
        if(preva == p[i].first && prevb == p[i].second) continue;

        preva = p[i].first; prevb = p[i].second;
        G[preva].push_back(prevb);
        G[prevb].push_back(preva);
    }

    /*
    for(int i=0;i<N;i++){
        for(int j=0;j<N;j++) if(rel[i][j]) cout << 'o'; else cout << 'x';
        cout << "\n";
    }
    return 0;
    */

    vector<int> dist(N,-1);
    queue<int> q;
    int ans = 0;

    for(int v=0;v<N;v++){
        if(dist[v]!=-1) continue;

        int tmp = 0;
        dist[v] = 0;
        q.push(v);

        while(!q.empty()){
            int v = q.front();
            q.pop();
            tmp++;

            for(int nv:G[v]){
                if(dist[nv]!=-1) continue;
                dist[nv] = dist[v]+1;
                q.push(nv);
            }
        }
        ans = max(ans,tmp);
    }

    cout << ans << endl;
    return 0;

}

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

int main() {
  
  int n, k;
  string s;
  
  cin >> n >> k >> s;
  
  if (s[k-1] == 'A') s[k-1] = 'a';
  if (s[k-1] == 'B') s[k-1] = 'b';
  if (s[k-1] == 'C') s[k-1] = 'c';
  
  cout << s;
  
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <cmath>
#include <algorithm>
#include <utility>
#include <functional>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
const int MOD = 1000000007;
const double EPS = 1e-9;


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

  int a,b,c;
  cin>>a>>b>>c;
  if(a == 7 && b == 5 && c == 5 || a == 5 && b == 7 && c == 5 || a == 5 && b == 5 && c == 7) {
    cout << "YES" << endl;
  } else {
    cout << "NO" << endl;
  }
  return 0;
}


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

int main() {
    string K = "keyence";
    string S;
    cin >> S;
    if (S.find(K) != string::npos) { cout << "YES" << endl; return 0; }
    int su = 0;
    for (int i = 0; i < K.length(); i++) {
        if (S[i] == K[i]) su++;
        else break;
    }
    reverse(K.begin(), K.end());
    reverse(S.begin(), S.end());
    for (int i = 0; i < K.length(); i++) {
        if (S[i] == K[i]) su++;
        else break;
    }
    
    cout << ((su >= 7) ? "YES" : "NO") << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define repp(i,l,r)for(long long i=(l);i<(r);i++)
#define rep(i,n) for (long long i = 0; i < (n); ++i)
#define per(i,n) for (long long i = (n); i >= 0; --i)
const int INF = 2147483647;//int max
const long long int MOD = 1000000007;
using namespace std;
using ll = long long;
using P = pair<int,int>;
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; }
//ミョ(-ω- ?)
int main() {
    ll n;
    cin >> n;
    vector<ll> a(n,0);
    rep(i,n)cin >> a[i];
    map<ll,ll> odds;
    for(ll i = 0;i < n;i+=2)odds[a[i]]++;
    pair<ll,ll> of = {0,0};
    pair<ll,ll> os = {0,0};
    for(auto t : odds){
        if(t.second > of.second){
            os = of;
            of = t;
            continue;
        }else if(t.second > os.second){
            os = t;
            continue;
        }
    }

    map<ll,ll> even;
    for(ll i = 1;i < n;i+=2)even[a[i]]++;
    ll e = 0;
    pair<ll,ll> ef = {0,0};
    pair<ll,ll> es = {0,0};
    for(auto t : even){
        if(t.second > ef.second){
            es = ef;
            ef = t;
            continue;
        }else if(t.second > es.second){
            es = t;
            continue;
        }
    }
    if(of.first != ef.first){
        cout << (n/2 - of.second) + (n/2 - ef.second) << "\n";
    }else{
        cout << min((n/2 - os.second)+(n/2 - ef.second) , (n/2 - of.second) + (n/2 - es.second)) << "\n";
    }

    return 0;
}

Measured memory_bytes: 10388
import java.util.Scanner;

public class Main {
    private static final int MOD = 1_000_000_007;
    private static final String YES = "Yes";
    private static final String NO = "No";

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

        int N = sc.nextInt();
        int[] A = new int[N];
        for (int i=0; i<N; i++) {
            A[i] = sc.nextInt();
        }

        System.out.println(solve(N, A) ? "APPROVED" : "DENIED");
    }

    private static boolean solve(int N, int[] A) {
        for (int i=0; i<N; i++) {
            if (A[i] % 2 != 0) continue;

            if (A[i] % 3 != 0 && A[i] % 5 != 0) {
                return false;
            }
        }

        return true;
    }
}

Measured memory_bytes: 23252
#include <bits/stdc++.h>
#define ft first
#define sc second
#define lb lower_bound
#define ub upper_bound
#define pb push_back
#define pt(sth) cout << sth << "\n"
#define chmax(a, b) {if(a<b) a=b;}
#define chmin(a, b) {if(a>b) a=b;}
#define moC(a, s, b) (a)=((a)s(b)+MOD)%MOD
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
static const ll INF=1e18;
static const ll MAX=1e5+7;
static const ll MOD=1e9+7;
ll max(ll a, ll b) {return a>b?a:b;}
ll min(ll a, ll b) {return a<b?a:b;}





int main(void) {
  ll N, K;
  cin >> N >> K;
  ll i, j, k;
  
  if(K>=pow(2, N)) {
    pt(-1);
    return 0;
  }
  
  if(N==0) {
    pt("0 0");
    return 0;
  }else if(N==1) {
    if(K==0) {
      pt("0 0 1 1");
    }else {
      pt(-1);
    }
    return 0;
  }
  
  vector<ll> a;
  for(i=0; i<pow(2, N); i++) {
    if(i==K) continue;
    a.pb(i);
  }
  a.pb(K);
  for(i=pow(2, N)-1; i>=0; i--) {
    if(i==K) continue;
    a.pb(i);
  }
  a.pb(K);
  
  for(i=0; i<a.size(); i++) pt(a[i]);
}












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

bool in[10];

bool can(int n){
    while(n){
        int tp = n % 10;
        if(in[tp])return false;
        n /= 10;
    }
    return true;
}

int main(){
    ios_base::sync_with_stdio(false); cin.tie(NULL);
    int n, k;
    cin >> n >> k;
    for(int i = 0; i < k; i++){
        int x; cin >> x;
        in[x] = 1;
    }
    int ans = 0;
    for(int i = n; i <= 200000; i++){
        if(can(i)){
            ans = i;
            break;
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.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();}

//math
//-------------------------------------------
template<class T> inline T sqr(T x) {return x*x;}

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<bool> VB;
typedef vector<double> VD;
typedef vector<string> VS;
typedef vector<char> VC;
typedef pair<int, int> PII;
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 SQ(a) ((a)*(a))
#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 LB lower_bound
#define UB upper_bound

//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI  = acos(-1.0);
const LL INF = 1e9;
const LL MOD = 1e9+7;

//other
//-------------------------------------------
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)
#define FI first
#define SE second

//memo
// setprecision()

int main() {
  int N;
  cin >> N;
  VI a(N),b(N),c(N);
  
  REP(i,N){
    cin >> a.at(i) >> b.at(i) >> c.at(i) ;
  }
  
  VI Da(N),Db(N),Dc(N);
  Da.at(0) = a.at(0);
  Db.at(0) = b.at(0);
  Dc.at(0) = c.at(0);
  
  FOR(i,1,N){
    Da.at(i) = a.at(i) + max(Db.at(i-1),Dc.at(i-1));
    Db.at(i) = b.at(i) + max(Dc.at(i-1),Da.at(i-1));
    Dc.at(i) = c.at(i) + max(Da.at(i-1),Db.at(i-1));
  }
  
  cout << max(Da.at(N-1),max(Db.at(N-1),Dc.at(N-1))) << endl;
  
  return 0;
}

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

int a[16][16];

int main() {
  for(int N, tno = 1; cin >> N, N; ++tno) {
    int x = 0, y = 0;

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

    for(int mode = 0, k = 1; k <= N * N;) {
      a[x][y] = k++;

      x += dx[mode];
      y += dy[mode];
      if( !(0 <= x && x < N && 0 <= y && y < N ) ) {
        mode = !mode;

        if( x < 0 && y >= N ) {
          x = 1;
          y = N - 1;
        }
        else if( x >= N ) {
          y += 2;
          x = N - 1;
        }
        else if( y >= N ) {
          y = N - 1;
          x += 2;
        }
        else if( y < 0 ) y = 0;
        else if( x < 0 ) x = 0;
        if( y >= N ) y = N - 1;

      } else {
        ;
      }
    }
    printf("Case %d:\n", tno);

    for(int i = 0; i < N; i++) {
      for(int j = 0; j < N; j++) printf("%3d", a[i][j]);
      printf("\n");
    }

  }
}

Measured memory_bytes: 0
import static java.lang.Math.*;
import java.util.Arrays;
import java.util.Scanner;

public class Main {
        public static void main(String[] args) {
            Scanner scanner = new Scanner(System.in);
            String s = scanner.next();
            String t = scanner.next();
            char[] sAr = s.toCharArray(); 
            char[] tAr = t.toCharArray();
            char[] sd = chsort(sAr);
            /*char[] td = chsort(tAr);*/
            
            if (Comp(sd, tAr))
                System.out.println("Yes");
            else
                System.out.println("No");
        };
        
        private static char[] chsort(char[] s){
            Arrays.sort(s);
            return s;
        }
        
        private static Boolean Comp(char[] s, char[] t ){
            int len = min(s.length, t.length);
            Boolean b;
            int judge=0;
            for (int i=0; i < len; i++){
                int j=i;
                b=false;
                while ((j < t.length) && (!b)){
                    if (s[i] < t[j]){
                        char c=t[i];
                        t[i]=t[j];
                        t[j]=c;
                        b=true;
                        judge = 1;
                    } else if ((s[i] == t[j]) && (judge ==0)){
                        judge = 0;
                    } else {
                        judge = -1;
                    }
                    j++;
                }
                if ((b)) return b;
            }
            if ((judge == 0) && (s.length < t.length)){
                return true;
            } else {
                return false;
            }
        }
}

Measured memory_bytes: 22612
<?php
	$n=fgets(STDIN);
	$a=[];
	for($i=0;$i<$n;$i++)$a[]=fgets(STDIN);
	$f=0;
	for($i=1;$i<$n;$i++)
	{
		$f+=$a[$i-1][strlen($a[$i-1])-2]!=$a[$i][0];
		for($j=0;$j<$i;$j++)$f+=$a[$j]==$a[$i];
	}
	echo $f?No:Yes;


Measured memory_bytes: 3576
#include <bits/stdc++.h>
#define rep(i, n) for (int i=0; i<n; ++i)
#define rep1(i, n) for (int i=1; i<=n; ++i)
#define ALL(v) v.begin(), v.end()
#define RALL(v) v.rbegin(), v.rend()
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
using namespace std;
typedef long long ll;
constexpr ll  MOD = (1e9+7);
constexpr int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
constexpr int lcm(int a, int b) { return a / gcd(a, b) * b; }

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;
}
ll factorial(ll n, ll m=2) {
    // calculate nPm
    m = max(2LL, m);
    ll rtn = 1;
    for (ll i=m; i<=n; i++) {
        rtn = (rtn * i) % MOD;
    }
    return rtn;
}
ll modinv(ll a, ll m) {
    ll b = m, u = 1, v = 0;
    while (b) {
        ll t = a / b;
        a -= t * b;
        swap(a, b);
        u -= t * v;
        swap(u, v);
    }
    u %= m;
    if (u < 0) u += m;
    return u;
}
ll modpow(ll a, ll n) {
    ll res = 1;
    while (n > 0) {
        if (n & 1)
            res = res * a % MOD;
        a = a * a % MOD;
        n >>= 1;
    }
    return res;
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(0);
    double a, b, c; cin >> a >> b >> c;
    cout << (a+b)*c/2 << endl;
    return 0;
}

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

#define CEIL(a,b) ((a) / (b) + ((a) % (b) == 0 ? 0 : 1))

using namespace std;
using ll = long long;
using pii = pair<int, int>;

constexpr int MOD = 1'000'000'007;
constexpr int INF = 1'000'000'001;
constexpr ll LLINF = 4'000'000'000'000'000'001;
// constexpr int INF = 2147483647; // 2 * 1e9
// constexpr ll LLINF = 9223372036854775807; // 9 * 1e18

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

int main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout << fixed << setprecision(10);
    int n;
    cin >> n;
    vector<int> a(n);
    for(int i = 0; i < n; ++i){
        cin >> a[i];
    }
    int ans = 0;
    for(int i = 0; i < n-2; ++i){
        if(a[i] <= a[i+1] && a[i+1] <= a[i+2])++ans;
        if(a[i] >= a[i+1] && a[i+1] >= a[i+2])++ans;
    }
    cout <<ans << "\n";
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define PI 3.14159265358979323846
constexpr int INF = numeric_limits<int>::max() / 2;
constexpr long long INFL = numeric_limits<long long>::max() / 2;
constexpr int MOD = 1000000007;
using Graph = vector<vector<int>>;



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

    int X,A;
    cin >> X >> A;
    if(X<A) cout << 0 << endl;
    else cout << 10 << endl;



}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
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; }

long long n, c;
vector<long long> x(100100, 0);
vector<long long> y(100100, 0);
vector<long long> vx(100100, 0);
vector<long long> vy(100100, 0);
vector<long long> A(100100, 0);
vector<long long> B(100100, 0);

int main() {
    cin >> n >> c;
    for(int i = 1; i <= n; ++i) {
        cin >> x.at(i) >> vx.at(i);
        y.at(n-i+1) = c - x.at(i);
        vy.at(n-i+1) = vx.at(i);
    }

    // 時計回りに行くときの最大
    for(int i = 0; i <= n; ++i) A.at(i+1) = A.at(i) + vx.at(i+1) - (x.at(i+1) - x.at(i));
    for(int i = 0; i <= n; ++i) chmax(A.at(i+1), A.at(i));
    /*cout << "A" << endl;
    for(int i = 0; i <= n; ++i) {
        cout << A.at(i) << endl;
    }*/

    // 反時計回りに行くときの最大
    for(int i = 0; i <= n; ++i) B.at(i+1) = B.at(i) + vy.at(i+1) - (y.at(i+1) - y.at(i));
    for(int i = 0; i <= n; ++i) chmax(B.at(i+1), B.at(i));
    /*cout << "B" << endl;
    for(int i = 0; i <= n; ++i) {
        cout << B.at(i) << endl;
    }*/

    // 右を固定しながら左の最適解を探す
    long long ans = 0;
    for(int i = 0; i <= n; ++i) {
        long long sum = A.at(i) + B.at(n-i) - x.at(i);
        chmax(ans, sum);
    }

    // 左を固定しながら右の最適解を探す
    for(int i = 0; i <= n; ++i) {
        long long sum = B.at(i) + A.at(n-i) - y.at(i);
        chmax(ans, sum);
    }

    cout << ans << endl;
}

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

int main() {
    int a,b,c,d,e,k;
    cin >>a>>b>>c>>d>>e>>k;
    if(e-a>k)cout<< ":("<<endl;
    else cout << "Yay!"<<endl;
}
   

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
using namespace std;
struct At{
	int index;
	int ai;
}a[100010];
bool cmp(At a,At b){
	return a.ai<b.ai;
}
int main(){
	int n;
	cin>>n;
	for(int i=1;i<=n;i++){
		cin>>a[i].ai;
		a[i].index=i;
	}
	sort(a+1,a+1+n,cmp);
	for(int i=1;i<=n;i++){
		cout<<a[i].index<<" ";
	}
	cout<<endl;
	return 0;
}

Measured memory_bytes: 1536
#include <cassert>
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
/*
//#if __cplusplus >= 201103L
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>
*/

// C++
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
/*
//#if __cplusplus >= 201103L
#include <array>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
*/
using namespace std;
#define fi first
#define se second
#define repl(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define rep(i,n) repl(i,0,n)
#define each(itr,v) for(auto itr:v)
#define pb(s) push_back(s)
#define mmax(x,y) (x>y?x:y)
#define mmin(x,y) (x<y?x:y)
#define maxch(x,y) x=mmax(x,y)
#define minch(x,y) x=mmin(x,y)
#define mp(a,b) make_pair(a,b)
#define all(x) (x).begin(),(x).end()
#define dbg(x) cout<<#x"="<<x<<endl

#define uni(x) x.erase(unique(all(x)),x.end())
template<class T,class U>inline void chmin(T &t,U f){if(t>f)t=f;}
template<class T,class U>inline void chmax(T &t,U f){if(t<f)t=f;}
#define MAX(a, b) ((a) > (b) ? (a) : (b))
#define MIN(a, b) ((a) > (b) ? (b) : (a))

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> P;
typedef pair<P, int> PPI;

#define INF INT_MAX/3
#define MAX_N 1000
#define M_INF 1000000000
int n,m,v,i;
void solve(){
   cin.tie(0);
  ios::sync_with_stdio(false);
  cin>>n;
  vector<ll> v;
  ll l;
  rep(i,n){
    cin>>l;
    v.pb(l);
  }
  ll w[v.size()] = {};
  ll left =0,right = v.size()-1;
  ll tmp = v.size()%2 ==1 ? 0: 1;
  for(int j=v.size()-1;j>-1;j--){
    // cout<<v[j]<<endl;
    if(j%2==tmp){
      w[left] = v[j];
      left++;
    } else {
      w[right] = v[j];
      right--;
    }
  }
  rep(i,n){
    if(i==n-1) cout<<w[i];
    else cout<<w[i]<<" ";
  }
  cout<<""<<endl;

    
}

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


Measured memory_bytes: 5488
#include <bits/stdc++.h>
using namespace std;
 
#define REP(i, s) for (int i = 0; i < s; ++i)
#define ALL(v) (v).begin(), (v).end()
#define COUT(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl
#define EACH(i, s) for (__typeof__((s).begin()) i = (s).begin(); i != (s).end(); ++i)
#define DEBUG
#define int long long
#define INF 1e9
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; }
template<class T1, class T2> ostream& operator << (ostream &s, pair<T1,T2> P)
{ return s << '<' << P.first << ", " << P.second << '>'; }
template<class T> ostream& operator << (ostream &s, vector<T> P)
{ for (int i = 0; i < P.size(); ++i) { if (i > 0) { s << " "; } s << P[i]; } return s; }
template<class T> ostream& operator << (ostream &s, vector<vector<T> > P)
{ for (int i = 0; i < P.size(); ++i) { s << endl << P[i]; } return s << endl; }
template<class T> ostream& operator << (ostream &s, set<T> P)
{ EACH(it, P) { s << "<" << *it << "> "; } return s << endl; }
template<class T1, class T2> ostream& operator << (ostream &s, map<T1,T2> P)
{ EACH(it, P) { s << "<" << it->first << "->" << it->second << "> "; } return s << endl; }
template<class T>void show(vector<T>v){for (int i = 0; i < v.size(); i++){cerr<<v[i]<<" ";}cerr<<"\n";}
typedef long long ll;

double dp[3010][3010];
double p[3010];
signed main(){
    int n;
    cin >> n;
    REP(i,n) cin >> p[i];
    //i番目まで見てj個表が出る確率
    dp[0][0]=0;
    dp[1][0]=1-p[0];
    dp[1][1]=p[0];
    for (int i = 2; i <= n; i++)
    {
        for (int j = 0; j <= i; j++)
        {
            if(j==0) dp[i][j]=dp[i-1][j]*(1-p[i-1]);
            dp[i][j] = dp[i-1][j]*(1-p[i-1])+dp[i-1][j-1]*p[i-1];
        }
        
    }
    double ans=0;
  /*  for (int i = 0; i <= 3; i++)
    {
        cerr<<dp[3][i]<<endl;
    }*/
    
    for (int i = 0; (n+1)/2+i<=n; i++)
    {
        ans+=dp[n][(n+1)/2+i];
    }
    printf("%.10f\n",ans);

    return 0;
}

Measured memory_bytes: 69120
import Data.Bits
import Data.List
import qualified Data.ByteString.Char8 as B

solve :: [Int] -> Mint
solve as = sum $ map f [0..59] where
  f i = M one * M zro * 2^i where
    one = length $ filter (`testBit` i) as
    zro = length as - one

main = getLine >> readIntsLn >>= print.solve

modulus = 10^9+7
newtype Mint = M Int
instance Enum Mint where
  fromEnum(M a) = a
  toEnum a = M$ mod a modulus
instance Num Mint where
  (M a)+(M b) = toEnum$ a+b
  (M a)*(M b) = toEnum$ a*b
  (M a)-(M b) = toEnum$ a-b
  fromInteger = toEnum . fromInteger
  abs = id
  signum = const (M 1)
instance Show Mint where
  show (M a) = show a

readIntsLn
  = unfoldr (B.readInt . B.dropWhile(==' ')) <$> B.getLine


Measured memory_bytes: 19452
#include <stdio.h>
#include <string.h>
#include <math.h>
#include <stdlib.h>
#define MOD 998244353
#define MAX(a,b) (a>b?a:b)
#define MAX3(a,b,c) MAX(a,MAX(b,c))
#define MIN(a,b) (a<b?a:b)
#define MIN3(a,b,c) MIN(a, MIN(b,c))
typedef long long lli;
typedef unsigned short int usi;

// 昇順
int cmp(const void *a, const void *b) {
    return *(int*)a - *(int*)b;
}

int main()
{
    int a, b;
    int i, j;
    scanf("%d %d",&a, &b);

    if(b%a==0) {
        printf("%d",a+b);
    } else {
        printf("%d",b-a);
    }
    return 0;
}


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

using namespace std;

typedef long long LL;
typedef pair<int , int> P2;
typedef pair<pair<int , int> , int> P3;
typedef pair<pair<int , int> , pair<int , int> > P4;
#define PB(a) push_back(a)
#define MP(a , b) make_pair((a) , (b))
#define M3P(a , b , c) make_pair(make_pair((a) , (b)) , (c))
#define M4P(a , b , c , d) make_pair(make_pair((a) , (b)) , make_pair((c) , (d)))
#define repp(i,a,b) for(int i = (int)(a) ; i < (int)(b) ; ++i)
#define repm(i,a,b) for(int i = (int)(a) ; i > (int)(b) ; --i)

const int MC = 200010;
int N,Q;
int a[MC] , b[MC];
set<P2> S,T;
LL ans;

int main(){
	cin >> N >> Q;
	repp(i,1,2*N+1) cin >> a[i];
	repp(i,1,2*N+1){
		cin >> b[i];
		ans += a[i];
		if(i==1 || i==2*N) continue;
		if(b[i]-a[i]>0){
			ans += b[i] - a[i];
			T.insert(MP(b[i]-a[i],i));
		} else {
			S.insert(MP(b[i]-a[i],i));
		}
	}
	repp(i,0,Q){
		int p,x,y;
		cin >> p >> x >> y;
		if(p == 1 || p == 2*N){
			ans += x - a[p];
		} else {
			if(b[p]-a[p]>0){
				T.erase(MP(b[p]-a[p],p));
				ans -= b[p];
			} else {
				S.erase(MP(b[p]-a[p],p));
				ans -= a[p];
			}
			if(y-x>0){
				T.insert(MP(y-x,p));
				ans += y;
			} else {
				S.insert(MP(y-x,p));
				ans += x;
			}
		}
		a[p] = x;
		b[p] = y;
		LL z = 0;
		if(T.size()%2){
			z = max(-(*T.begin()).first,(*S.rbegin()).first);
		}
		cout << ans + z << endl;
	}
	return 0;
}


Measured memory_bytes: 12672