akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <cmath>
#include <queue>
#include <map>
#include <functional>
using namespace std;
#pragma warning (disable: 4996)

int N, a[200009], b[200009], ans = 0; vector<int>p[30];

int main() {
	cin >> N;
	for (int i = 0; i < N; i++) scanf("%d", &a[i]);
	for (int i = 0; i < N; i++) scanf("%d", &b[i]);
	for (int j = 0; j <= 28; j++) {
		vector<int>p(N, 0);
		for (int i = 0; i < N; i++) p[i] = b[i] % (2 << j);
		sort(p.begin(), p.end());
		for (int i = 0; i < N; i++) {
			int sum = (a[i] & ((2 << j) - 1));
			int LL = (3 << j) - sum; LL %= (2 << j);
			int RR = LL + (1 << j);
			if (RR < (2 << j)) {
				int pos1 = lower_bound(p.begin(), p.end(), LL) - p.begin();
				int pos2 = lower_bound(p.begin(), p.end(), RR) - p.begin();
				if ((pos2 - pos1) % 2 == 1) {
					ans ^= (1 << j);
				}
			}
			else {
				int pos1 = lower_bound(p.begin(), p.end(), RR - (2 << j)) - p.begin();
				int pos2 = lower_bound(p.begin(), p.end(), LL) - p.begin();
				if ((N - (pos2 - pos1)) % 2 == 1) {
					ans ^= (1 << j);
				}
			}
		}
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 2560
#include <bits/stdc++.h>
#define GET_REP(_1, _2, _3, NAME, ...) NAME
#define rep(...) GET_REP(__VA_ARGS__, irep, _rep)(__VA_ARGS__)
#define rep1(...) GET_REP(__VA_ARGS__, irep1, _rep1)(__VA_ARGS__)
#define _rep(i, n) irep (i, 0, n)
#define _rep1(i, n) irep1(i, 1, n)
#define irep(i, a, n) for (int i = a; i < (int)(n); ++i)
#define irep1(i, a, n) for (int i = a; i <= (int)(n); ++i)
#define rrep(i, n) for (int i = (int)(n) - 1; i >= 0; --i)
#define rrep1(i, n) for (int i = (int)(n); i >= 1; --i)
#define allrep(X, x) for (auto &&X : x)
#define all(x) (x).begin(), (x).end()
#ifdef LOCAL
  #include "../../Lib/cout_container.hpp"
  #define debug(x) cerr << #x " => " << x << endl
#else
  #define debug(x) 0
#endif
using lint = long long;
constexpr int    INF  = 1 << 30;
constexpr lint   INFL = 1LL << 62;
constexpr int    MOD  = (int)1e9 + 7;
constexpr double EPS  = 1e-9;
using namespace std;
namespace { struct INIT { INIT() { cin.tie(0); ios::sync_with_stdio(false); cout << fixed << setprecision(15); } } INIT; }

int main(void) {
  int n;
  cin >> n;
  vector<int> b(n - 1);
  rep (i, n - 1) cin >> b[i];
  vector<int> a(n);
  a[0] = b[0];
  a[n - 1] = b[n - 2];
  rep1 (i, n - 2) {
    a[i] = min(b[i - 1], b[i]);
  }
  cout << accumulate(all(a), 0) << endl;
  return 0;
}

Measured memory_bytes: 256
n,m=map(int,input().split())

a=[]
cnt=[0]*m
ans=0

for i in range(n):
  a.append(list(map(int,input().split())))
  
for i in range(n):
  for j in range(a[i][0]):
    cnt[a[i][j+1]-1]+=1

for i in range(m):
  if cnt[i]==n:
    ans+=1 
print(ans)



Measured memory_bytes: 3060
#include<stdio.h>
int main(void)
{
	int h1,h2,k1,k2,a,b,c,d,h,k,na,nb;
	scanf("%d %d %d %d %d %d %d %d",&h1,&h2,&k1,&k2,&a,&b,&c,&d);
	na=h1/10*c;
	nb=h2/10*b;
	h=h1*a+h2*b+h1/10*c+h2/20*d;
	na=k1/10*c;
	nb=k2/10*b;
	k=k1*a+k2*b+k1/10*c+k2/20*b;
	if(h>k){
	printf("hiroshi\n");
	}
	else if(h<k){
	printf("kenjiro\n");
	}
	else	{
	printf("even\n");
	}
	return 0;
}


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

//#pragma GCC optimize("Ofast")

#define fi first
#define se second
#define ll long long
#define dl double long

using namespace std;

const int NN = 1e9 + 7;
const int N = 2e5 + 7;
const int M = 26;
const ll mod = 1e9 + 7;
const int inf = 1e9 + 7;
const dl rf = 1e-14;
const int B = sqrt(N);
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

int n;
ll ans;
int p[N];
bool used[N];
vector < int > v[N];


int get( int x )
{
    if( p[x] == x )return x;
    return p[x] = get( p[x] );
}

int meg( int x , int y )
{
    x = get(x);
    y = get(y);
    if( x == y )return 0;
    p[y] = x;
    return 1;
}

void foo( int l , int r )
{
    if( l > r )return;
    int m = (l + r) / 2;
    ll z = 0;
    ll cnt = 0;
    for( int i = m; i >= l; i-- ){
        used[i] = true;
        z += 1;
        for( auto x : v[i] ){
            if( !used[x] || !(l <= x && x <= m) )continue;
            z -= meg( i , x );
        }
        cnt += z;
    }
    ans += cnt;
    //cout << l << " " << m << " " << m << " " << r << " " << cnt << "\n";
    for( int i = m + 1; i <= r; i++ ){
        used[i] = true;
        cnt += (m - l + 1);
        ll d = cnt;
        vector < pair < int , int > > g;
        for( auto x : v[i] ){
            if( !used[x] || !(l <= x && x <= i) )continue;
            int f = meg( i , x );
            int y = min( m , x );
            cnt -= f * (y - l + 1);
        }
        if( cnt == d ){
            //cnt = d + (m - l);
        }
        //cout << l << " " << m << " " << i << " " << r << " " << cnt << "\n";
        ans += cnt;
    }
    for( int i = l; i <= r; i++ ){
        p[i] = i;
        used[i] = false;
    }
    foo( l , m - 1 );
    foo( m + 1 , r );
}

void solve1()
{
    cin >> n;
    for( int i = 1; i < n; i++ ){
        int x,y;
        cin >> x >> y;
        v[x].push_back(y);
        v[y].push_back(x);
    }
    for( int i = 1; i <= n; i++ )p[i] = i;
    foo( 1 , n );
    cout << ans;
}

int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
    //freopen( "input.txt" , "r" , stdin );
    //freopen( "output.txt" , "w" , stdout );

    int cghf = 1;//cin >> cghf;
    while( cghf-- ){
        solve1();
    }
}


Measured memory_bytes: 18604
N = int(input())
p_li = [int(input()) for i in range(N)]
ans = 0
p_li.sort(reverse=True)
for i in range(N) :
    if i == 0 :
        ans += int(p_li[i] / 2)
    else :
        ans += p_li[i]
print(ans)

Measured memory_bytes: 3060
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
using namespace __gnu_pbds;

#define cint(d) scanf("%d", &d)
#define cint2(a, b) scanf("%d %d", &a, &b)
#define cint3(a, b, c) scanf("%d %d %d", &a, &b, &c)
#define cint4(a, b, c, d) scanf("%d %d %d %d", &a, &b, &c, &d)

#define clong(d) scanf("%lld", &d)
#define clong2(a, b) scanf("%lld %lld", &a, &b)
#define clong3(a, b, c) scanf("%lld %lld %lld", &a, &b, &c)
#define clong4(a, b, c, d) scanf("%lld %lld %lld %lld", &a, &b, &c, &d)

#define foreach(v, c) for(__typeof( (c).begin()) v = (c).begin();  v != (c).end(); ++v)
#define revforeach(v, c) for(__typeof( (c).rbegin()) v = (c).rbegin();  v != (c).rend(); ++v)
#define ALL(v) (v).begin(), (v).end()

#define pb push_back
#define eb emplace_back
#define mp make_pair
#define fi first
#define se second

typedef long long int slong;
typedef pair<int, int> pii;
typedef pair<slong, slong> pll;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pbds;
typedef set<int>::iterator sit;
typedef map<int,int>::iterator mit;
typedef vector<int>::iterator vit;

#ifdef VSP4 
    #include "debug.h"    
#else
    #define debug(args...)                  // Just strip off all debug tokens
#endif

const int MOD = 1000000007;
#define MODSET(d) if ((d) >= MOD) d %= MOD;
#define MODNEGSET(d) if ((d) < 0) d = ((d % MOD) + MOD) % MOD;
#define MODADDSET(d) if ((d) >= MOD) d -= MOD;
#define MODADDWHILESET(d) while ((d) >= MOD) d -= MOD;

const int MAXN = 3e6;
const int SQRTN = 550;
const int LOGN = 60;
const int INT_INFINITY = 1001001001;
const int LIMIT = 1e6;

const slong LONG_INFINITY = 1001001001001001001ll;
const slong LONG_LIMIT = 200100100100101ll;

int n, m, q;
vector<int> graph[MAXN+5];
int color[MAXN+5];

int distArr[MAXN+5];
int distID[MAXN+5];

int queryID[10+5][MAXN+5];
int queryColor[MAXN+5];

vector<int> sortQueries[MAXN+5];

int main()
{
	#ifdef VSP4
		freopen("input.txt", "r", stdin);
		freopen("output.txt", "w", stdout);
	#endif
	
	cout.tie(0);
	cin.tie(0);
	
	int t, i, j, d, u, v, c;

	cint2(n, m);
	
	for (i = 1; i <= m; i++)
	{
		cint2(u, v);
		graph[u].pb(v);
		graph[v].pb(u);
	}
	
	cint(q);
	
	for (i = 1; i <= q; i++)
	{
		cint3(v, d, c);
		
		queryColor[i] = c;
		queryID[d][v] = i;		
	}
	
	for (i = 10; i >= 0; i--)
	{
		for (j = 1; j <= q; j++)
		{
			sortQueries[j].clear();
		}
		
		for (u = 1; u <= n; u++)
		{
			if (queryID[i][u])
			{
				sortQueries[queryID[i][u]].pb(u);
			}
		}
		
		if (i)
		{
			for (j = q; j >= 1; j--)
			{
				for (auto u: sortQueries[j])
				{
					queryID[i-1][u] = max(queryID[i-1][u], j);
					for (auto v: graph[u])
					{
						queryID[i-1][v] = max(queryID[i-1][v], j);
					}
				}
			}
		}
		else
		{			
			for (j = 1; j <= n; j++)
			{
				cout << queryColor[queryID[0][j]] << "\n";
			}
		}
		
	}
	
	return 0;
}


Measured memory_bytes: 175096
#include<iostream>
#include<cstring>
#include<cstdlib>
#include<cstdio> 
#include<algorithm>
#define ll long long 
using namespace std;
const int maxn=500010,inf=1e9;
int n,x,ans;
int mp[maxn];
void read(int &k)
{
	int f=1;k=0;char c=getchar();
	while(c<'0'||c>'9')c=='-'&&(f=-1),c=getchar();
	while(c<='9'&&c>='0')k=k*10+c-'0',c=getchar();
	k*=f;
}
int main()
{
	read(n);
	for(int i=1;i<=n;i++)
	{
		read(x);
		mp[x+1]++;
		mp[x+2]++;
		mp[x]++;
	}
	for(int i=0;i<=100002;i++)ans=max(ans,mp[i]);
	printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 640
N = int(input())
H = [int(i) for i in input().split()]
ans = False
for i in range(N-1):
    h1, h2 = H[i], H[i+1]
    if h1 <= h2:
        continue
    if h1 - h2 > 1:
        print('No')
        exit()
    else:
        H[i+1] += 1
print('Yes')


Measured memory_bytes: 14228
N,M = map(int, input().split())
P = [0]*M
Y = [0]*M
for i in range(M):
  P[i],Y[i] = map(int, input().split())

p_dict = {}
for i in range(M):
  p_dict.setdefault(P[i],[]).append(Y[i])
under6 = {}
for p in p_dict.keys():
  sorted_year = sorted(p_dict[p])
  for i in range(len(sorted_year)):
    under6[sorted_year[i]] = i + 1

for i in range(M):
  print(str(P[i]).zfill(6) + str(under6[Y[i]]).zfill(6))

Measured memory_bytes: 40352
#pragma GCC optimize(2)
#include<bits/stdc++.h>
#define ll long long
#define maxn 3005
#define inf 1e9
#define pb push_back
#define rep(i,a,b) for(int i=a;i<=b;i++)
#define per(i,a,b) for(int i=a;i>=b;i--)
using namespace std;

inline ll read()
{
	ll x=0,w=1; char c=getchar();
	while(c<'0'||c>'9') {if(c=='-') w=-1; c=getchar();}
	while(c<='9'&&c>='0') {x=(x<<1)+(x<<3)+c-'0'; c=getchar();}
	return w==1?x:-x;
}

ll dp[maxn][maxn],n,k,a[maxn];
const ll mod=998244353;

int main()
{
	n=read(); k=read(); rep(i,1,n) a[i]=read(); dp[0][0]=1;
	for(int i=1;i<=n;i++)
	{
		for(int j=k;j>=0;j--) dp[i][j]=(dp[i-1][j]*2)%mod;
		for(int j=k;j>=a[i];j--)
		{
			dp[i][j]=(dp[i][j]+dp[i-1][j-a[i]])%mod;
		}
	}
	ll ans=0;
	for(int i=1;i<=n;i++) ans=(ans+dp[i][k])%mod;
	cout<<dp[n][k]<<endl;
	return 0;
}

Measured memory_bytes: 74092
#include <cstdio>
using namespace std;
#define MAX 100000
#define INF 200000000

struct Card {
    char suit;
    int value; 
};

void merge(struct Card C[], int left, int mid, int right);
void mergeSort(struct Card C[], int left, int right);
int partition(struct Card C[], int p, int r);
void quicksort(struct Card C[], int p, int r);

struct Card L[MAX/2 + 2], R[MAX / 2 + 2];

int main() {
    int n;
    scanf("%d", &n);
    struct Card A[MAX], B[MAX];
    char m[10];
    int num;
    for (int i = 0; i < n; i++) {
        scanf("%s %d", m, &num);
        A[i].suit = B[i].suit = m[0];
        A[i].value = B[i].value = num;
    }

    mergeSort(A, 0, n);
    quicksort(B, 0, n-1);
    bool flag = true;
    for (int i = 0; i < n; i++) {
        if ( A[i].suit != B[i].suit) {
            flag = false;
            break;
        }
    }
    if (flag) printf("Stable\n");
    else printf("Not stable\n");
    for (int i = 0; i < n; i++)
        printf("%c %d\n", B[i].suit, B[i].value);
}


int partition(struct Card C[], int p, int r) {
    int i = p - 1;
    struct Card temp;
    for (int j = p; j < r; j++) {
        if (C[j].value <= C[r].value) {
            i++;
            temp = C[i]; C[i] = C[j]; C[j] = temp;
        }
    }
    temp = C[i+1]; C[i+1] = C[r]; C[r] = temp;
    return i + 1;
}

void quicksort(struct Card C[], int p, int r) {
    if (p < r) {
        int q = partition(C, p, r);
        quicksort(C, p, q - 1);
        quicksort(C, q + 1, r);
    }
}

void merge(struct Card C[], int left, int mid, int right) {
    int n1 = mid - left;
    int n2 = right - mid;
    for(int i = 0; i < n1; i++) {
        L[i] = C[i + left];
    }
    for(int i = 0; i < n2; i++) {
        R[i] = C[i + mid];
    }
    L[n1].value = INF; R[n2].value = INF;
    int i = 0, j = 0;
    for (int k = left; k < right; k++) {
        if (L[i].value <= R[j].value) {
            C[k] = L[i];
            i++;
        }
        else {
            C[k] = R[j];
            j++;
        }
    }
}

void mergeSort(struct Card C[], int left, int right) {
    if (left + 1 < right) {
        int mid = (left + right) / 2;
        mergeSort(C, left, mid);
        mergeSort(C, mid, right);
        merge(C, left, mid, right);
    }
}



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

typedef long long ll;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef pair<ll, ll> P;
#define rep(i, n) for(ll i = 0; i < n; i++)
#define REP(i, a, b) for(ll i = a; i <= b; i++)
#define out(x) std::cout << x << '\n'
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define pb push_back
#define sz(x) ((int)(x).size())
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
ll lcm(ll a, ll b) { ll g = gcd(a, b); return a / g * b; }
const int dx[4] = { 1, 0, -1,  0 };
const int dy[4] = { 0, 1,  0, -1 };
const int INF = INT_MAX / 2;
const ll  inf = LLONG_MAX / 2;
const int mod = 1000000007;
const int MAX_N = 101010;
const long double PI = acos(-1);

ll f(string s) {
	ll N = sz(s);
	ll sum = 0;
	for (ll i = 0, j = 0; i < N; i = j) {
		while (j < N && s[i] == s[j]) {
			j++;
		}
		sum += (j - i) / 2;
	}
	return sum;
}

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	cout << fixed << setprecision(10);
	/*------------------------------*/

	string s;
	cin >> s;
	ll N = sz(s);
	ll k;
	cin >> k;

	bool same = true;
	rep(i, N) {
		if (s[0] != s[i]) {
			same = false;
		}
	}
	if (same) {
		out((N * k) / 2);
		return 0;
	}

	ll d1 = f(s);
	ll d2 = f(s + s);

	ll a = d1;		//s一コ分
	ll d = d2 - d1;	//増えた分(差分)がk-1コ

	cout << a + d * (k - 1)<< endl;

	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<cmath>
#include<bitset>
#include<deque>
#include<functional>
#include<iterator>
#include<map>
#include<set>
#include<stack>
#include<queue>
#include<utility>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
#define a first
#define b second
#define sz(x) (ll)((x).size())
#define pb push_back
#define mp make_pair
#define bg begin()
#define ed end()
#define all(x) (x).bg,(x).ed
#define rep(i,n) for(ll i=0;i<(n);i++)
#define rep1(i,n) for(ll i=1;i<=(n);i++)
#define rrep(i,n) for(ll i=(n)-1;i>=0;i--)
#define rrep1(i,n) for(ll i=(n);i>=1;i--)
#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
const ll MOD=1000000007;
const ll INF=1000000000000000;
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 maxx(ll x,ll y,ll z){return max(max(x,y),z);}
ll minn(ll x,ll y,ll z){return min(min(x,y),z);}
ll gcd(ll x,ll y){if(x%y==0) return y;else return gcd(y,x%y);}
ll lcm(ll x,ll y){return x*(y/gcd(x,y));}
ll digsz(ll x){if(x==0) return 1;else{ll ans=0;while(x){x/=10;ans++;}return ans;}}
ll digsum(ll x){ll sum=0;while(x){sum+=x%10;x/=10;}return sum;}
vector<ll> pw2(62,1);vector<ll> pw10(19,1);

int main(){
    {rep1(i,18) pw10[i]=10*pw10[i-1];}
    
    string s; cin>>s;
    ll K; cin>>K;
    ll ans=0;
    vector<ll> x;
    char now=s[0];
    ll cnt=0;
    rep(i,sz(s)){
        if(now==s[i]){
            cnt++;
        }
        else{
            now=s[i];
            x.pb(cnt);
            cnt=1;
        }
    }
    x.pb(cnt);
    if(s[0]!=s[sz(s)-1]){
        rep(i,sz(x)){
            ans+=x[i]/2;
        }
        ans*=K;
    }
    else{
        if(sz(x)==1){
            ans=(sz(s)*K)/2;
        }
        else{
            rep1(i,sz(x)-2){
                ans+=x[i]/2;
            }
            ans*=K;
            ans+=x[0]/2;
            ans+=x[sz(x)-1]/2;
            ans+=((x[0]+x[sz(x)-1])/2)*(K-1);
        }
    }
    cout<<ans<<endl;
}



Measured memory_bytes: 3580
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <queue>
#include <cmath>
#include <map>
#include <numeric>
#include <iomanip>

int main(void) {
	long long n, x;

	std::cin >> n >> x;

	std::vector<long long> a(n);

	for (long long i = 0; i < n; i++) {
		std::cin >> a[i];
	}

	int ans = 0;
	std::sort(a.begin(), a.end());

	if (std::accumulate(a.begin(), a.end(), 0LL) == x) {
		std::cout << n << std::endl;
		return 0;
	}

	for (size_t i = 0; i < n; i++) {
		if (x - a[i] < 0) {
			break;
		}
		x -= a[i];
		ans++;
	}

	if (ans == n) ans--;

	std::cout << ans << std::endl;

	return 0;
}

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

const int MAX = 210000;
const int MOD = 1000000007;

long long fac[MAX], finv[MAX], inv[MAX];
void COMinit(){
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for(int i = 2; i < MAX; i++){
        fac[i] = fac[i-1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD/i) % MOD;
        finv[i] = finv[i-1] * inv[i] % MOD;
    }
}
long long COM(int n, int k){
    if(n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n-k] % MOD) % MOD;
}


// ref : https://ei1333.github.io/luzhiled/snippets/math/prime-factor.html
// 素因数分解をし、その出現回数をmapに格納する関数
map< ll, ll > prime_factor(ll n) {
  map< ll, ll > ret;
  for(int64_t i = 2; i * i <= n; i++) {
    while (n % i == 0) {
      ret[i]++;
      n /= i;
    }
  }
  if(n != 1) ret[n] = 1;
  return ret;
}


int main(int) {
  int N, M;
  map< ll, ll> map_exp;
  cin >> N >> M;
  map_exp = prime_factor(M);
  long long answer = 1;

  COMinit();
  for (auto iter = map_exp.begin(); iter != map_exp.end(); iter ++) {
    int tmp_exp = iter->second;
    // cout << iter->first << " : " << iter->second << "\n";
    long long tmp_ans = COM(tmp_exp + N - 1, N - 1);
    answer = (answer * tmp_ans) % MOD;
  }
  cout << answer;
  return 0;
}

Measured memory_bytes: 5120
package main

import (
	"bufio"
	"fmt"
	"os"
	"sort"
	"strconv"
	"strings"
)

// input に使うやつ
var rdr = bufio.NewReaderSize(os.Stdin, 10000)

func readLine() string {
	buf := make([]byte, 0, 10000)
	for {
		l, p, e := rdr.ReadLine()
		if e != nil {
			panic(e)
		}
		buf = append(buf, l...)
		if !p {
			break
		}
	}
	return string(buf)
}

// string から int へ
func atoi(s string) int {
	i, _ := strconv.Atoi(s)
	return i
}

// 一つの文字を int として読み込み
func readInt() int {
	return atoi(readLine())
}

// 複数の文字を int のスライスとして読み込み
func readInts() []int {
	in := readLine()
	ins := strings.Split(in, " ")
	out := make([]int, len(ins))
	for i, v := range ins {
		out[i] = atoi(v)
	}
	return out
}

// sortしたスライスを返す
func sorted(a []int) []int {
	sort.Ints(a)
	b := a
	return b
}

// 逆順のsort
func reverse(a []int) []int {
	sort.Sort(sort.Reverse(sort.IntSlice(a)))
	b := a
	return b
}

func main() {
	n := readInt()
	a := make([]int, n)
	b := make([]int, n)
	for i := 0; i < n; i++ {
		a[i] = readInt()
		b[i] = a[i]
	}

	s := reverse(b)

	for i := 0; i < n; i++ {
		for j := 0; j < n-1; j++ {
			if a[i] != s[j] {
				fmt.Println(s[j])
				break
			}
			if a[i] == s[j] && a[i] == s[j+1] {
				fmt.Println(s[j])
				break
			}
			if a[i] == s[j] && a[i] != s[j+1] {
				fmt.Println(s[j+1])
				break
			}
		}
	}
}


Measured memory_bytes: 7680
// #define _GLIBCXX_DEBUG // for STL debug (optional)
#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;
using ll = long long int;
using int64 = long long int;
 
template<typename T> void chmax(T &a, T b) {a = max(a, b);}
template<typename T> void chmin(T &a, T b) {a = min(a, b);}
template<typename T> void chadd(T &a, T b) {a = a + b;}
 
int dx[] = {0, 0, 1, -1};
int dy[] = {1, -1, 0, 0};
const ll INF = 1001001001001001LL;
const ll MOD = 1000000007LL;
 
int main() {
    string s, t; cin >> s >> t;
    int ans = 0;
    for(int i=0; i<3; i++) {
        ans += (s[i] == t[i]);
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
a = gets.chomp.to_i
b = gets.chomp.to_i

r = [a,b].sort

p 3 if r[0] == 1 && r[1] == 2
p 1 if r[0] == 2 && r[1] == 3
p 2 if r[0] == 1 && r[1] == 3


Measured memory_bytes: 1788
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define ll long long
ll gcd(ll x, ll y) { return (x % y)? gcd(y, x % y): y; }    //最大公約数
ll lcm(ll x, ll y) { return x / gcd(x, y) * y; }     //最小公倍数
using Graph = vector<vector<ll>>;
ll inf=300000000000000000;
const double PI = 3.14159265358979323846;
#define INF 1e+18
#define MAX_V 100000

struct edge {
    ll to;
    ll cost;
};

// <最短距離, 頂点の番号>
using P = pair<ll, ll>;

void dijkstra(ll s,vector<vector<edge>> &G,vector<ll> &d) {
    priority_queue<P, vector<P>, greater<P> > que;
    fill(d.begin(), d.end(), INF);
    d[s] = 0;
    que.push(P(0, s));

    while (!que.empty()) {
        P p = que.top();
        que.pop();
        ll v = p.second;
        if (d[v] < p.first) continue;

        for (edge e: G[v]){
            if (d[e.to] > d[v] + e.cost) {
                d[e.to] = d[v] + e.cost;
                que.push(P(d[e.to], e.to));
            }
        }
    }
}

int main() {
  
    ll v;
    cin >> v;
    vector<vector<edge>> G(v);
  vector<vector<edge>> g(v);
  vector<ll> d(v);
  vector<ll> D(v);
    ll E;
    cin >> E;
    ll s,t;
  cin >> s >> t;
  s--;
  t--;
    for (int i=0; i<E; ++i) {
        ll a, b, c,d;
        cin >> a >> b >> c >> d;
      a--;
      b--;
        edge e = {b, c};
        G[a].push_back(e);
      edge t={a,c};
      G[b].push_back(t);
      edge u={b,d};
      edge o={a,d};
      g[a].push_back(u);
      g[b].push_back(o);  
    }
  //cout << 1 << endl;
    dijkstra(s,G,D);
    dijkstra(t,g,d);
  ll z=1000000000000000;
  ll ans[v];
  //cout << 2 << endl;
  ans[v-1]=z-(D[v-1]+d[v-1]);
  rep(i,v-1)ans[v-2-i]=max(ans[v-1-i],z-D[v-2-i]-d[v-2-i]);
 rep(i,v)cout << ans[i] << endl; 
  //rep(i,v)cout << d[i] << " " << D[i] << endl;
}

Measured memory_bytes: 21036
n1 = int(input())
n2 = list(map(int, input().split()))
n3 = sorted(n2)
n3.reverse()
n4 = [n3[i]*(1/2**(i+1)) for i in range(len(n3))]
n5 = n3[(len(n3) - 1)]*(1/2**(len(n3)))
print(sum(n4) + n5)

Measured memory_bytes: 3064
#include<bits/stdc++.h>
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define ll long long
#define lson l,mid,p<<1
#define rson mid+1,r,p<<1|1
#define pii pair<int,int>
using namespace std;
const int inf=1e9+10;
const int mod=1e9+7;
const int maxn=2e5+10;
int n;
string s[maxn];
map<string,int>cnt;
int main(){
	ios::sync_with_stdio(false);
	//freopen("in","r",stdin);
	cin>>n;
	int mx=0;
	for (int i = 0; i < n; ++i)
	{
		cin>>s[i];
		cnt[s[i]]++;
		mx=max(mx,cnt[s[i]]);
	}
	sort(s,s+n);
	n=unique(s,s+n)-s;
	for(int i=0;i<n;i++){
		if(cnt[s[i]]==mx) cout<<s[i]<<'\n';
	}
	return 0;
}

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

typedef long long LL;

const int N=262144,mod=998244353,G=3,invG=332748118,inv2=499122177;

int add(int a,int b,int p=mod){return a+b>=p?a+b-p:a+b;}
int sub(int a,int b,int p=mod){return a-b<0?a-b+p:a-b;}
int mul(int a,int b,int p=mod){return (LL)a*b%p;}
void sadd(int &a,int b,int p=mod){a=add(a,b,p);}
void ssub(int &a,int b,int p=mod){a=sub(a,b,p);}
void smul(int &a,int b,int p=mod){a=mul(a,b,p);}
int Power(int a,int k,int p=mod){int res=1;for (;k;k>>=1,smul(a,a,p)) if (k&1) smul(res,a,p);return res;}
int Get_inv(int a,int p=mod){return Power(a,p-2,p);}

int wn[2][N+9];

void Get_wn(){
  int w0=Power(G,(mod-1)/N),w1=Power(invG,(mod-1)/N);
  wn[0][0]=wn[1][0]=1;
  for (int i=1;i<N;++i){
	wn[0][i]=mul(wn[0][i-1],w0);
	wn[1][i]=mul(wn[1][i-1],w1);
  }
}

int len,rev[N+9];

void Get_len(int n){
  int l=0;
  for (len=1;len<=n;len<<=1) ++l;
  for (int i=0;i<len;++i) rev[i]=rev[i>>1]>>1|(i&1)<<l-1;
}

int pw[N+9];

void NTT(int *a,int n,int t){
  for (int i=0;i<n;++i)
	if (i<rev[i]) swap(a[i],a[rev[i]]);
  for (int i=1;i<n;i<<=1){
	int tl=N/(i<<1);
	for (int j=0;j<i;++j) pw[j]=wn[t][j*tl];
	for (int j=0;j<n;j+=i<<1)
	  for (int k=0;k<i;++k){
		int x=a[j+k],y=(LL)pw[k]*a[i+j+k]%mod;
		a[j+k]=(x+y)%mod;a[i+j+k]=(x-y+mod)%mod;
	  }
  }
  if (!t) return;
  t=Get_inv(n);
  for (int i=0;i<n;++i) smul(a[i],t);
}

int n,mx,cnt[N+9];

void into(){
  scanf("%d",&n);
  for (int i=1;i<=n<<1;++i){
	int x;
	scanf("%d",&x);
	++cnt[x];
	mx=max(mx,x);
  }
}

int inv[N+9],fac[N+9],ifac[N+9];

void Get_inv(){
  inv[1]=1;
  fac[0]=fac[1]=1;
  ifac[0]=ifac[1]=1;
  for (int i=2;i<=n<<1;++i){
	inv[i]=mul(mod-mod/i,inv[mod%i]);
	fac[i]=mul(fac[i-1],i);
	ifac[i]=mul(ifac[i-1],inv[i]);
  }
}

int Get_c(int n,int m){return n<m||m<0?0:mul(fac[n],mul(ifac[m],ifac[n-m]));}

int dp[N+9];

void Get_dp(){
  dp[0]=1;
  for (int i=2;i<=n<<1;i+=2) dp[i]=mul(dp[i-2],i-1);
}

int *prod[N+9];
int ta[N+9],tb[N+9];

int Divide_prod(int l,int r,int k){
  if (l==r){
	int c=cnt[l];
	prod[k]=new int[c+1];
	for (int i=0;i<=c;++i) prod[k][i]=0;
	for (int i=0;i<=c;i+=2) prod[k][i]=mul(Get_c(c,i),dp[i]);
	return c;
  }
  int mid=l+r>>1,ls=k<<1,rs=k<<1|1;
  int c0=Divide_prod(l,mid,ls),c1=Divide_prod(mid+1,r,rs),c=c0+c1;
  for (int i=0;i<=c0;++i) ta[i]=prod[ls][i];
  for (int i=0;i<=c1;++i) tb[i]=prod[rs][i];
  Get_len(c);
  NTT(ta,len,0);
  NTT(tb,len,0);
  for (int i=0;i<len;++i) smul(ta[i],tb[i]),tb[i]=0;
  NTT(ta,len,1);
  prod[k]=new int[c+1];
  for (int i=0;i<=c;++i) prod[k][i]=ta[i],ta[i]=0;
  return c;
}

int ans;

void Get_ans(){
  Divide_prod(1,mx,1);
  for (int i=0;i<=n<<1;i+=2){
	int t=mul(prod[1][i],dp[n*2-i]);
	i>>1&1?ssub(ans,t):sadd(ans,t);
  }
}

void work(){
  Get_wn();
  Get_inv();
  Get_dp();
  Get_ans();
}

void outo(){
  printf("%d\n",ans);
}

int main(){
  into();
  work();
  outo();
  return 0;
}

Measured memory_bytes: 24680
//g++ -std=c++14 test.cpp -o test.out
//問題URL
//https://atcoder.jp/contests/dp/tasks/dp_j
//参考
//https://qiita.com/drken/items/03c7db44ccd27820ea0d
//期待値でもなんでも、無限に続く感じの式が出てきたら
//自己ループを含む式を立式するといいかも
//今回の場合は何枚目の皿、とかではなくX個寿司が乗っている皿の個数を考える
//今回の場合はそれ＋再帰で解けるようになる
#include <string.h>
#include <stdlib.h>
#include <math.h>
#include <cassert>
#include <algorithm>
#include <functional>
#include <iostream>
#include <iomanip>
#include <vector>
#include <queue>
#include <map> 
#include <utility>
#include <limits.h>
#include <bitset>
#include <set>
using namespace std;
 
#define LL long long int
const LL INF = (LL)(1e18)+1;
const int INF_INT = 2147483647-1e6;
const LL mod = 1000000007ll;

int N;
int dish[3] = {0,0,0};//それぞれ初期状態において、寿司が1個、2個、3個乗っている皿の数

double ans = 0;

//寿司が残り1個の皿がi枚、2個の皿がj枚、3個の皿がk枚
//の状態から寿司が全てなくなるのに必要な操作回数の期待値
double dp[301][301][301];
//こうおけば
//    次の引き       その確率         行先
//後0枚の皿のどれか (N-i-j-k)/N dp[i]  [j]  [k]
//後1枚の皿のどれか     i/N     dp[i-1][j]  [k]
//後2枚の皿のどれか     j/N     dp[i+1][j-1][k]
//後3枚の皿のどれか     k/N     dp[i]  [j+1][k-1]
//という遷移を考えることができる

//dp[i][j][k]
// = dp[i][j][k] * (N-i-j-k)/N    0枚乗っている皿のいずれかが選ばれたところでi,j,kに変化はない
//   + dp[i-1][j][k] * i/N        1枚乗っている皿が選ばれたならi--
//    + dp[i+1][j-1][k] * j/N     2枚乗っている皿が選ばれたならj--　1個寿司がある皿が一つ増えるのでi++
//     + dp[i][j+1][k-1] * k/N
//      + 1                       1回分加算
//これをdp[i][j][k]=で表せる式に変形して、それが答え

double res(int i,int j,int k){
	if(dp[i][j][k]>=0) return dp[i][j][k];
	if(i==0 && j==0 && k==0) return 0;

	dp[i][j][k] = 0;
	if(i-1>=0) dp[i][j][k] += res(i-1,j,k)*i;
	if(j-1>=0) dp[i][j][k] += res(i+1,j-1,k)*j;
	if(k-1>=0) dp[i][j][k] += res(i,j+1,k-1)*k;
	dp[i][j][k] += N;
	dp[i][j][k] /= (i+j+k);

	return dp[i][j][k];
}

void solve(){
	for(int i=0;i<=300;i++){
		for(int j=0;j<=300;j++){
			for(int k=0;k<=300;k++) dp[i][j][k] = -1;
		}
	}
	ans = res(dish[0],dish[1],dish[2]);
}
 
int main(){
	cin >> N;
	for(int i=0;i<N;i++){
		int a;
		cin >> a;a--;
		dish[a]++;
	}
 
	solve();

	cout << fixed << setprecision(10)  << ans << endl;
	return 0;
}

Measured memory_bytes: 213376
#include <iostream>
#include <string>

using namespace std;

int main()
{
	// 入力
	int N;
	cin >> N;
	
	string S;
	cin >> S;
	
	for (int i = 0; i < S.size(); i++)
	{
		char c = S[i];
		c += N;
		
		if (c > 'Z') {
			c -= 26;
		}
		
		cout << c;
	}
	
	cout << endl;

	return 0;
}

Measured memory_bytes: 256
from math import factorial as fact
import math
import sys
import itertools
import numpy as np
from collections import Counter
import datetime
from collections import deque


#入力:N(int:整数)
def input1():
	return int(input())

#入力:N,M(int:整数)
def input2():
	return map(int,input().split())

#入力:[n1,n2,...nk](int:整数配列)
def input_array():
	return list(map(int,input().split()))

def keta(N):
	return len(str(N))


def input_daytime(input_time):
	time,distance=input_time.split()
	t=time.split(":")
	se=str(t[-1]).split(".")
	dt1 = datetime.timedelta(hours=int(t[0]),minutes=int(t[1]),seconds=int(se[0]),milliseconds=int(se[1]))
	return dt1

def combinations(n,r):
	return list(itertools.combinations(range(n),r))



def all_sets(num_list):
	subsets=[]
	for i in range(2,len(num_list) + 1):
		for c in combinations(num_list, i):
			subsets.append(c) 
	return subsets

#公約数の列挙
def ch(x1):
	cf=[]
	for i in range(2,math.sqrt(x1)+1):
		if x1 % i==0:
			cf.append(i)
	return cf

def CountOneRoots(x,y):
	#x:縦，y:横
	return fact(x+y)/fact(x)/fact(y)

# 素因数分解
def prime_factorize(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a
	
def count_str(m):
	tmp={}
	for i in range(10):
		if i in tmp:
			tmp[i]=1
		else:
			tmp[i]+=1
	return tmp

def is_prime(n):
	if n==1: return True

	for i in range(2,int(math.sqrt(n))+1):
		if n%i==0:
			return False
	return True


n,d=input2()

print(math.ceil(n/(d*2+1)))





Measured memory_bytes: 12492
#[allow(unused_macros)]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };

    ($next:expr, mut $var: ident : $t:tt $($r:tt)*) => {
        let mut $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, bytes) => {
        read_value!($next, String).into_bytes()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

fn main() {
    input! {
        a: usize,
        b: usize,
        c: usize,
    }
    let ans = std::cmp::min(b / a, c);
    println!("{}", ans);
}


Measured memory_bytes: 4352
using System;

namespace aoj
{
    class Bundou
    {
        static void Main(String[] args)
        {
            int i, max = 999;
            int input = 0;
            int[] res = new int[11];
            int j, flag = 0;


            while (true)
            {
                /* initialization */
                for (i = 0; i < 11; i++)
                {
                    res[i] = 0;
                }

                    /* read input */
                    try
                    {
                        input = int.Parse(Console.ReadLine());
                    }
                    catch (System.ArgumentNullException)
                    {
                        break;
                    }
                    catch (System.FormatException)
                    {
                        break;
                    }
                    catch (System.IndexOutOfRangeException)
                    {
                        break;
                    }

                while (input > 0)
                {
                    /* calc */
                    for (i = 0; i < 11; i++)
                    {
                        if (exa2(i) > input)
                        {
                            max = i - 1;
                            break;
                        }
                    }

                    input -= exa2(max);
                    res[max]++;
                }

                /* output */
                for (i = 0; i < 11; i++)
                {
                    if (res[i] == 1)
                    {
                        Console.Write(exa2(i));

                        for (j = i+1; j < 11; j++) {
                            if (res[j] == 1) {
                                flag = 1;
                                break;
                            }
                        }

                        /* output ' ' */
                        if (flag == 1) {
                            Console.Write(" ");
                            flag = 0;
                        }
                    }
                }
                Console.WriteLine();
            }
        }

        public static int exa2(int num)
        {
            int i;
            int res = 1;

            for (i = 0; i < num; i++)
            {
                res *= 2;
            }

            return res;
        }
    }
}

Measured memory_bytes: 5616
#!/usr/bin/env python3

import sys
sys.setrecursionlimit(300000)


def solve(A: int, B: int):
    print(A * B)
    return

def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    A = int(next(tokens))  # type: int
    B = int(next(tokens))  # type: int
    solve(A, B)

if __name__ == '__main__':
    main()


Measured memory_bytes: 61692
// https://atcoder.jp/contests/abc162/tasks/abc162_d
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define REP(i, n) FOR(i, 0, n)
#define REPR(i, n) for (int i = n - 1; i >= 0; i--)
#define FOR(i, s, n) for (int i = (s), i##_len = (n); i < i##_len; ++i)
#define ALL(obj) (obj).begin(), (obj).end()
#define ALLR(obj) (obj).rbegin(), (obj).rend()
#define DIV(a, b) ((a - 1) / b + 1)

signed main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int N;
    cin >> N;
    string s;
    cin >> s;
    int tr = 0, tg = 0, tb = 0;
    for (auto &x : s) {
        if (x == 'R') {
            tr++;
        } else if (x == 'G') {
            tg++;
        } else {
            tb++;
        }
    }
    int ans = tr * tg * tb;
    REP(i, N - 2) {
        for (int d = 1; i + 2 * d < N; ++d) {
            if (s[i] != s[i + d] && s[i] != s[i + 2 * d] &&
                s[i + d] != s[i + 2 * d]) {
                ans--;
            }
        }
    }

    cout << ans << endl;

    return 0;
}


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

int main(){
    int n; cin >> n;
    int l; cin >> l;
    int v[n];
    int aji = 0;
    int min = 100;
    int check;
    for(int i=0; i<n; i++){
        v[i] = l + i;
        if(abs(v[i]) < min){
            min = abs(v[i]);
            check = i;
        }
    }
    v[check] = 0;
    for(int i=0; i<n; i++) aji += v[i];
    cout << aji << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define loop2(i, s, n, a) for (int i = int(s); i < int(n); i += a)
#define loop(i, s, n) loop2(i, s, n, 1)
#define rep(i, n) loop(i, 0, n)

#define pb push_back
#define all(in) in.begin(),in.end()

using ll = long long;
using ull = unsigned long long;
using namespace std;

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

    ll mmin = 100100100100; ll mmax = 0;
    rep(i,n){
        if(a[i] < mmin) mmin = a[i];
        if(i != 0){
            if(a[i]-mmin > mmax) mmax = a[i]-mmin;
        }
    }
    map<ll,ll> data;
    rep(i,n) data[a[i]] = -i;

    ll ans = 0;
    rep(i,n) if(data[a[i]+mmax] < -i) ans++;

    cout << ans << endl;
}

Measured memory_bytes: 16452
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <stack>
#include <queue>
#include <cmath>
#include <tuple>
#include <cstdio>
#include <bitset>
#include <sstream>
#include <iterator>
#include <numeric>
#include <map>
#include <cstring>
#include <set>
#include <functional>
#include <iomanip>

using namespace std;

#define DEBUG_ //!!提出時にコメントアウト!!
#ifdef DEBUG_
	#define dump(x)  cerr << #x << " = " << (x) << endl;
#else
	#define dump(x)  ;
#endif

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define SZ(x) ((int)(x).size())
#define pb push_back
#define eb emplace_back

//#define int long long

typedef long long LL;
typedef vector<int> VI;
typedef vector<LL> VL;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef pair<LL, LL> PLL;

template <typename T>
std::string printVector(const std::vector<T> &data)
{
    std::stringstream ss;
    std::ostream_iterator<T> out_it(ss, ", ");
    ss << "[";
    std::copy(data.begin(), data.end() - 1, out_it);
    ss << data.back() << "]";
    return ss.str();
}

const int MOD = 1e9+7;
const LL LINF = 1001002003004005006ll;
const int INF = 1001001001;

signed main(int argc, char const *argv[])
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N; cin >> N;
    VI p(N);
    REP(i,N) cin >> p[i];

    VI a(N);
    a[0] = 1;
    REP(i,N){
        a[i] = a[i-1] + 20002;
    }
    VI b = a;
    reverse(b.begin(),b.end());

    REP(i,N){
        a[p[i]-1] += i;
    }
    REP(i,N) cout << a[i] << " ";
    cout << endl;
    REP(i,N) cout << b[i] << " ";
    cout << endl;



}

Measured memory_bytes: 896
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <unordered_map>
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; (i) < (n); (i)++)
#define MOD 1000000007
using namespace std;
 
int main(){
  int a;
  string s;
  cin >> a;
  cin >> s;
  if (a >= 3200){
    cout << s << endl;
  }
  else{
    cout << "red" << endl;
  }
}

Measured memory_bytes: 256
import java.util.Scanner;

class Main {
	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		StringBuffer sb = new StringBuffer();
		int n = scanner.nextInt();
		int[] A = new int[n];
		int[] B = new int[n];
		int max = 0;

		for (int i = 0; i < n; i++) {
			A[i] = scanner.nextInt();
			if(max < A[i]){
				max = A[i];
			}
		}
		scanner.close();
		
		countingSort(A, B, n ,max);
		
		sb.append(B[0]);
		for (int i = 1; i < n; i++) {
			sb.append(" " + B[i]);
		}
		System.out.println(sb.toString());
	}

	//????±?????????????????´????????????????(A[])??¨??????????????????????????????????´?????????????(B[])??¨??????????????°???????´??????????????????°(n)????????°??????????????????
	static void countingSort(int[] A, int[] B, int n , int max) {
		
		int[] c = new int[max + 1];
		for (int j = 0; j < A.length; j++) {
			c[A[j]]++;
		}
		for (int i = 1; i < max + 1; i++) {
			c[i] = c[i] + c[i - 1];
		}
		for (int j = A.length - 1; j >= 0; j--) {
			c[A[j]]--;
			B[c[A[j]]] = A[j];
		}
	}
}

Measured memory_bytes: 567728
#include<bits/stdc++.h>
using namespace std;
#define ll long long
ll read() {
	ll x=0, f=1; char ch=' ';
	while(!isdigit(ch)) {ch=getchar(); if(ch=='-') f=-1;}
	while(isdigit(ch)) x=(x<<3)+(x<<1)+(ch^48), ch=getchar();
	return x*f;
}
char a[1005], b[1005];
int n, m, ans=1e9;
int main() {
	scanf("%s%s", a+1, b+1);
	n=strlen(a+1), m=strlen(b+1);
	for(int i=1;i<=n-m+1;i++) {
		int tmp=0;
		for(int j=i;j<=i+m-1;j++) {
			if(a[j]!=b[j-i+1]) tmp++;
		}
		ans=min(ans, tmp);
	}
	cout<<ans;
}


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

int main ()
{
    int n,t,a;
    cin >> n >> t >> a;
    int h[n];
    double diff[n];
    double mindif = 100000;
    for(int i = 0; i < n; i++){
        cin >> h[i];
    }
    for(int i = 0; i < n; i++){
        diff[i] = abs(t - h[i] * 0.006 - a);
        mindif = min(diff[i],mindif);
    }
    for(int i = 0; i < n; i++){
        if(diff[i] == mindif || diff[i] == -1 * mindif){
            cout << i + 1 << endl;
            break;
        }
    }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define del(a,i) memset(a,i,sizeof(a))
#define ll long long
#define inl inline
#define il inl void
#define it inl int
#define ill inl ll
#define re register
#define ri re int
#define rl re ll
#define mid ((l+r)>>1)
#define lowbit(x) (x&(-x))
#define INF 0x3f3f3f3f
using namespace std ;
template< class T > inl T read() {
	T x = 0 ; int f = 1 ; char k = getchar() ;
	for( ; k > '9' || k < '0'; k = getchar() ) if( k == '-' ) f = -1 ;
	for( ; k >= '0' && k <= '9'; k = getchar() ) x = x * 10 + k - '0' ;
	return x * f ;
}
template< class T > inl T read( T &x ) { return x = read<T>() ; }
int _num, _buf[20];
template< class T > il print( T x ) {
   	if( x == 0 ) return putchar( '0' ) ,void() ;
	if( x < 0 ) putchar( '-' ), x = -x ;
	while( x ) _buf[++_num] = x % 10, x /= 10 ;
	while( _num ) putchar( _buf[_num--] + '0' ) ;
}
ll mul( ll a, ll b, ll mod ) { long double c = 1. ; return ( a * b - (ll)( c * a * b / mod ) * mod ) % mod ; }
it qpow( int x, int m, int mod ) {
	int res = 1, bas = x ;
	while(m) {
		if( m & 1 ) res = ( 1ll * res * bas ) % mod ;
		bas = ( 1ll * bas * bas ) % mod, m >>= 1 ;
	}
	return res ;
}
const int N = 2e5 + 5 ;
int n, sum, num[2], val[N], ans[N], popc[N], bit[N][2];
char s[N];
int main() {
//	freopen( ".in", "r", stdin ) ;
//	freopen( ".out", "w", stdout ) ;
	n = read<int>(), scanf( "%s", s + 1 ) ;
	for( ri i = 1; i <= n; ++i ) {
		val[i] = s[i] - '0' ;
		sum += val[i], popc[i] = popc[i - lowbit( i )] + 1 ;
	}
	bit[0][0] = bit[0][1] = 1 ;
	for( ri i = 1; i <= n; ++i ) {
		num[0] = ( num[0] * 2 + val[i] ) % ( sum + 1 ) ;
		bit[i][0] = bit[i - 1][0] * 2 % ( sum + 1 ) ;
		if( sum > 1 ) {
			num[1] = ( num[1] * 2 + val[i] ) % ( sum - 1 ) ;
			bit[i][1] = bit[i - 1][1] * 2 % ( sum - 1 ) ;
		}
	}
	for( ri i = 1; i <= n; ++i )
		ans[i] = ans[i % popc[i] ] + 1 ;
	for( ri i = 1; i <= n; ++i ) {
		if( val[i] == 1 ) {
			if( sum == 1 ) {
				puts( "0" ) ;
				continue ;
			}
			int tmp = ( num[1] + sum - 1 - bit[n - i][1] ) % ( sum - 1 ) ;
			print( ans[tmp] + 1 ), puts( "" ) ;
		}
		else {
			int tmp = ( num[0] + bit[n - i][0] ) % ( sum + 1 ) ;
			print( ans[tmp] + 1 ), puts( "" ) ;
		}
	}
	cerr << 1. * clock() / CLOCKS_PER_SEC << "\n" ;
	return 0;
}

Measured memory_bytes: 7896
#include <iostream>
#include<cstdio>
#include<cmath>
#include<algorithm>
#include<cstring>
#define ll long long
using namespace std;
ll a,b,c,l=0;
int main()
{
   scanf("%lld%lld",&a,&b);
   c=a;

   while(c<=b)
   {
       l++;
       c*=2;
   }
   printf("%lld",l);
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>	
#include<map>
#include<set>
#include<utility>
#include<cmath>
#include<cstring>
#include<queue>
#include<stack>
#include<cstdio>
#include<sstream>
#include<iomanip>
#include<assert.h>
#define loop(i,a,b) for(int i=a;i<b;i++) 
#define rep(i,a) loop(i,0,a)
#define pb push_back
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)
using namespace std;
//kaewasuretyuui
typedef long long ll;
typedef int Def;
typedef pair<Def,Def> pii;
typedef vector<Def> vi;
typedef vector<vi> vvi;
typedef vector<pii> vp;
typedef vector<vp> vvp;
typedef vector<string> vs;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef pair<Def,pii> pip;
typedef vector<pip>vip;
//#define mt make_tuple
//typedef tuple<int,string> tp;
//typedef vector<tp> vt;
const double PI=acos(-1);
const double EPS=1e-7;
const int inf=1e9;
const ll INF=2e18;
int dx[]={0,1,0,-1,1,-1};
int dy[]={1,0,-1,0,1,-1};
int t,n,x,y,co;
vvi field;
void dfs(int a,int b,int c){
	if(c==t)return;
	rep(i,6){
		int nx=a+dx[i];
		int ny=b+dy[i];
		if(field[nx][ny]>c+1){
			field[nx][ny]=c+1;
			dfs(nx,ny,c+1);
		}
	}
}
int main(){
	while(cin>>t>>n,t|n){
		field=vvi(200,vi(200,inf));
		rep(i,n){
			int a,b;
			cin>>a>>b;
			field[100+a][100+b]=-1;
		}
		cin>>x>>y;
		field[100+x][100+y]=0;
		dfs(100+x,100+y,0);
//		rep(i,10){rep(j,10)cout<<" "<<(field[45+i][45+j]==inf?0:field[45+i][45+j]);cout<<endl;}
		co=0;
		rep(i,200)rep(j,200)if(field[i][j]<=t&&field[i][j]+1)co++;
		cout<<co<<endl;
	}
}

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

#define rep(i, n) for (int i = 0; i < n; i++)
#define repr(i, n) for (int i = n - 1; i >= 0; i--)
#define ALL(x) x.begin(),x.end()

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

const ll INF = 1e18;
const int mod = 1e9+7;
const int MAX = 1e6;

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

struct edge {int to, cost;}; // 辺
// vector<edge> graph[MAX]; // 隣接リスト
// bool visit[MAX]; // 訪問の有無

int d,t,s; // 変数

int main() {
// input
    cin >> d;
    cin >> t;
    cin >> s;
// solve
// output
    if (s*t>=d) cout << "Yes" << "\n";
    else cout << "No" << "\n";
}

Measured memory_bytes: 3632