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

#define REP(i,n) for(ll i=0; i<(ll)(n); i++)
#define FOR(i,n,m) for (ll i=n; i<(ll)(m); i++)
#define pb push_back
#define INF 1000000007LL
#define all(a) (a).begin(),(a).end()

typedef long long ll;
typedef pair<int,int> p;

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

int sx,sy,tx,ty;
int main(){
    ios::sync_with_stdio(false);
    cin >> sx >> sy >> tx >> ty;
    int mx = tx - sx;
    int my = ty - sy;
    string fx = mx < 0 ? "L" : "R";
    string fy = my < 0 ? "D" : "U";
    string sx = fx=="R" ? "L" : "R";
    string sy = fy=="U" ? "D" : "U";
    
    if (mx == 0 && my == 0) {
        cout << "" << endl;
        return 0;
    }
    if (mx == 0) {
        string ans = "";
        REP(i,abs(my)) {
            ans += fy;
        }
        ans += "R";
        REP(i,abs(my)) {
            ans += sy;
        }
        ans += "L";
        ans += "L";
        REP(i,abs(my)) {
            ans += fy;
        }
        ans += "R";
        ans += fy;
        ans += "RR";
        REP(i,abs(my)+2) {
            ans += sy;
        }
        ans += "LL";
        ans += fy;
        
        cout << ans << endl;
        return 0;
    }
    if (my == 0) {
        string ans = "";
        REP(i,abs(mx)) {
            ans += fx;
        }
        ans += "U";
        REP(i,abs(mx)) {
            ans += sx;
        }
        ans += "D";
        ans += "D";
        REP(i,abs(mx)) {
            ans += fx;
        }
        ans += "U";
        ans += fx;
        ans += "UU";
        REP(i,abs(mx)+2) {
            ans += sx;
        }
        ans += "DD";
        ans += fx;
        cout << ans << endl;
        return 0;
    }
    
    string ans = "";
    REP(i,abs(mx)) {
        ans += fx;
    }
    REP(i,abs(my)) {
        ans += fy;
    }
    REP(i,abs(mx)) {
        ans += sx;
    }
    REP(i,abs(my)) {
        ans += sy;
    }
    // ここまでで一往復
    ans += sy;
    REP(i,abs(mx)+1) {
        ans += fx;
    }
    REP(i,abs(my)+1) {
        ans += fy;
    }
    ans += sx;
    ans += fy;
    REP(i,abs(mx)+1) {
        ans += sx;
    }
    REP(i,abs(my)+1) {
        ans += sy;
    }
    ans += fx;
    
    cout << ans << endl;
    
    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>  
#include <string.h>  
#include <stdlib.h>  
#include <iostream>  
#include <algorithm>  
#include <time.h>  
#include<cstdio>
#include<vector>
#include<functional>
#include<math.h>


using namespace std;


long long a[51][51];

int main() {
	for (int i = 0; i<=50; i++) {
		a[i][0] = 1;
		a[i][i] = 1;
	}
	for (int i = 1; i <= 50; i++) {
		for (int j = 0; j <= i; j++) {
			a[i][j] = a[i - 1][j] + a[i - 1][j - 1];
		}
	}
	int n, p;
	scanf("%d%d", &n, &p);
	int x;
	long long ou = 0, ji = 0;
	for (int i = 0; i < n; i++) {
		scanf("%d", &x);
		if (x % 2 == 0)ou++;
		else
			ji++;
	}
	long long res = 0;
	for (int i = p; i <= ji; i += 2) {
		res += a[ji][i] * pow(2ll, ou);
	}
	printf("%lld", res);
	
	return 0;

}

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

const int mod=2019;

int main()
{
	int ans=mod,l,r;
	scanf("%d%d",&l,&r);
	if(r-l>=mod) {
		printf("0");
		return 0;
	}
	l%=mod,r%=mod;
	for(int i=l;i<=r;++i)
		for(int j=i+1;j<=r;++j) {
			ans=min(ans,i*j%mod);
		}
	cout<<ans;
}

Measured memory_bytes: 256
#include <stdio.h>
int main(void) {
    int n,m,l,i,j,k;
    int a[100][100],b[100][100];
    long c[100][100];
    
    scanf("%d %d %d" ,&n ,&m ,&l);
    
    for (i=0; i<n; i++) {
        for (j=0; j<m; j++) {
            scanf("%d",&a[i][j]);
        }
    }
    
    for (i=0; i<m; i++) {
        for (j=0; j<l; j++) {
            scanf("%d",&b[i][j]);
        }
    }
    
    for (i=0; i<n; i++) {
        for (j=0; j<l; j++) {
            for (k=0; k<m; k++) {
                c[i][j] +=a[i][k]*b[k][j];
            }
        }
    }
    for (i=0; i<n; i++) {
        for (j=0; j<l-1; j++) {
            printf("%ld ",c[i][j]);
        }
        printf("%ld",c[i][j]);
        printf("\n");
    }
    return 0;
}

Measured memory_bytes: 760
#include <algorithm>  // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <bitset>     // bitset
#include <cctype>     // isupper, islower, isdigit, toupper, tolower
#include <cstdint>    // int64_t, int*_t
#include <cstdio>     // printf
#include <deque>      // deque
#include <iomanip>    // fixed, setprecision
#include <iostream>   // cout, endl, cin
#include <map>        // map
#include <queue>      // queue, priority_queue
#include <set>        // set
#include <stack>      // stack
#include <string>     // string, to_string, stoi
#include <tuple>      // tuple, make_tuple
#include <unordered_map>  // unordered_map
#include <unordered_set>  // unordered_set
#include <utility>        // pair, make_pair
#include <vector>         // vector
using namespace std;
typedef long long ll;
typedef unsigned long long ull;

int main() {
  vector<pair<int, int>> M(5);
  int t, m, c = 0;
  for (int i = 0; i < 5; i++) {
    cin >> t;
    m = t % 10;
    if (m == 0) m = 10;
    M[i] = make_pair(m, t);
  }
  sort(M.rbegin(), M.rend());
  for (int i = 0; i < 4; i++) {
    c += ceil(get<1>(M[i]) / 10.0) * 10;
  }
  c += get<1>(M[4]);
  cout << c << endl;
}


Measured memory_bytes: 3232
#include<bits/stdc++.h>
#define pb push_back
#define sz(v) (v).size()
#define all(v) (v).begin(),(v).end()
#define mp make_pair
#define fi first
#define se second
using namespace std;
template <typename T> T Max(T x,T y){return x>y?x:y;}
template <typename T> T Min(T x,T y){return x<y?x:y;}
template <typename T> T Abs(T x){return x>0?x:-x;}

int n,k,a[200005];

bool chk(int x)
{
	int cnt=0;
	for(int i=1;i<=n;i++)
	{
		int t=a[i]%x==0?a[i]/x:a[i]/x+1;
		t--;
		cnt+=t;
		if(cnt>k) return false;
	}
	return true;
}

int main()
{
	int maxn=0;
	scanf("%d%d",&n,&k);
	for(int i=1;i<=n;i++)
	{
		scanf("%d",&a[i]);
		maxn=Max(maxn,a[i]);
	}
	int l=1,r=maxn,ans;
	while(l<=r)
	{
		int mid=(l+r)>>1;
		if(chk(mid)) ans=mid,r=mid-1;
		else l=mid+1;
	}
	printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 4492
#define _CRT_SECURE_NO_WARNINGS
#include<cstdio>
#include<vector>
#include<string>
#include<iostream>
#include<algorithm>
#include<map>
#include<iterator>
#include<set>
#include<stack>
#include<queue>
#include<fstream>
#include<iomanip>
#include <unordered_map>
#include <unordered_set>
#include <numeric>
#include<cmath>
#include<list>
#include <sstream>
#include <stdio.h>
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
using namespace std;


#define FOR(i,a,b) for(LL i = (a); i < (b); i++)
#define RFOR(i,b,a) for(int i = (b) - 1; i >= (a); i--)
#define ITER(it,a) for(__typeof(a.begin()) it = a.begin(); it != a.end(); it++)
#define FILL(a, value) memset(a, value, sizeof(a))

#define SZ(a) (int)a.size()
#define ALL(a) a.begin(),a.end()
#define PB push_back
#define MP make_pair

typedef long long LL;
typedef vector<int> VI;
typedef pair<int, int> PII;

const double PI = acos(-1.0);
const int INF = 1000 * 1000 * 1000 + 7;
const LL LINF = INF * (LL)INF;

using namespace std;

const LL MOD = 1000000007;



int main() {
	ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	string s, t;
	cin >> s >> t;
	int ans = 1e9;
	FOR(i,0,s.length()-t.length()+1) {
		int k = 0;
		FOR(j,0,t.length()) {
			if (s[i+j] != t[j]) k++;
		}
		ans = min(ans, k);
	}
	cout << ans << endl;
	return 0;
}









Measured memory_bytes: 3640
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner scan = new Scanner(System.in);

		char[] S = scan.next().toCharArray();
		boolean isGood = true;

		if(S[0] == S[1]) isGood = false;
		if(S[1] == S[2]) isGood = false;
		if(S[2] == S[3]) isGood = false;

		if(isGood) {
			System.out.println("Good");
		}else {
			System.out.println("Bad");
		}

	}
}

Measured memory_bytes: 21844
#include <stdio.h>
#include <stdlib.h>
#define MAX 2000001
#define VMAX 10000

int main(){
  unsigned short *A, *B;
  int C[VMAX+1];
  int n, i, j,p;

  scanf("%d", &n);

  A = malloc(sizeof(short)*n+1);
  B = malloc(sizeof(short)*n+1);
  for(i=0;i < n; i++){
    scanf("%d",&A[i]);
  }
  for(i=0;i <=VMAX;i++){
    C[i]=0;
  }
  for(i=0;i < n;i++){
    C[A[i]]++;
  }
  for(i=0;i <VMAX;i++){

    C[i+1]=C[i+1]+C[i];
  }
  for(i=n-1;i >=0;i--){
    B[--C[A[i]]]=A[i];
  }
  
  for(p=0;p < n ;p++){
    if (p<n-1) {
      printf("%d ",B[p]);
    } else {
      printf("%d",B[p]);
    }
  }
  printf("\n");
  return 0;
}



Measured memory_bytes: 9580
s=list(input())
mod=2019
mdict={}
mdict[0]=1
ans=0
tmp=0
for i in range(len(s)):
    n=s.pop()
    key=(int(n)*pow(10,i,mod)+tmp)%mod

    if key in mdict:
        mdict[key]+=1
    else:
        mdict[key]=1
    tmp=key

for var in mdict.values():
    ans+=var*(var-1)//2

print(ans)

Measured memory_bytes: 79244
#include <cstdio>
#include <iostream> 
#include <string>
#include <vector>
#include <sstream>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <functional>
#include <numeric>

using namespace std;
using ll = long long;

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


int main()
{
	ll x, y;

	cin >> x >> y;

	if (x % y == 0) {
		cout << -1 << endl;
	}
	else {
		for (ll i = x;; i += x) {
			if (i % y != 0) {
				cout << i << endl;
				return 0;
			}
		}
	}
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vs = vector<string>;
using msi = map<string, int>;
using mii = map<int, int>;
using psi = pair<string, int>;
using pii = pair<int, int>;
using vlai = valarray<int>;
#define rep(i,n) for(int i=0;i<n;i++)
#define range(i,s,n) for(int i=s;i<n;i++)
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define fs first
#define sc second
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define INF 1E9
#define EPS 1E-9
#define MOD (1E9+7)
#define PI 3.1415926535897932384

std::ostream &operator<<(std::ostream &out, const vector<int> &tgt)
{
	string s;
	for (int i = 0; i<tgt.size(); i++) {
		s += (to_string(tgt[i]) + ((i != tgt.size() - 1) ? " " : ""));
	}
	out << s;
	return out;
}

vi rnk,par;

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

void unite(int x, int y) {
	x = find(x);
	y = find(y);
	if (x == y)return;
	if (rnk[x] < rnk[y]) {
		par[x] = y;
	}
	else {
		par[y] = x;
		if (rnk[x] == rnk[y])rnk[x]++;
	}
}

bool same(int x, int y) {
	return (find(x) == find(y));
}

int main() {
	int n,m,a,b,q;
	cin >> n >> m;
	par.resize(n);
	rnk.resize(n);
	rep(i, n) {
		par[i] = i;
		rnk[i] = 0;
	}

	rep(i, m) {
		cin >> a >> b;
		unite(a, b);
	}
	cin >> q;
	rep(i, q) {
		cin >> a >> b;
		cout << (same(a, b) ? "yes" : "no") << endl;
	}

}


Measured memory_bytes: 3548
/*!enjoy karo yaar!*/

//CF,CC,AtC,SPOJ: hp1999
//HE: hemant269
//HR: hemant2132

// ref: https://codeforces.com/blog/entry/78168?#comment-633466

#include<bits/stdc++.h>
using namespace std;

#define     int             long long int
#define     fast()          ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define     all(x)          begin(x),end(x)
#define     rz(x)           resize(x)
#define     asn(x,y)        assign(x,y)
#define     mem(a,b)        memset(a,b,sizeof(a))
#define     sz(x)           ((int)size(x))
#define     eb              emplace_back
#define     pb              push_back
#define     pf              push_front
#define     pob             pop_back
#define     pof             pop_front
#define     ins             insert
#define     vi              vector<int>
#define     pii             pair<int,int>
#define     mii             map<int,int>
#define     F               first
#define     S               second
#define     remax(a,b)      a=max(a,b)
#define     remin(a,b)      a=min(a,b)
#define     bitcount(x)     __builtin_popcountll(x)
#define     iceil(n,x)      (((n)-1)/(x)+1)
#define     dbug(x)         cout<<#x<<": "<<(x)<<"\n"
#define     flush           fflush(stdout)
#define     show(x)         for(auto zz:x)cout<<zz<<" ";cout<<"\n";
#define     show2(x)        for(auto zz:x)cout<<zz.F<<" "<<zz.S<<"\n";

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

const ld pi=acos(-1);
const ll inf=1e18,M=1e9+7;
const int N=1;

void solve()
{
    ld a,b;
    cin>>a>>b;

    int x=a,y=b*100+0.5;
    int ans=x*y;
    ans/=100;
    cout<<ans;
}

int32_t main()
{
    fast();

    int t=1;
    //cin>>t;
    for(int z=1;z<=t;++z)
    {
        solve();
        //cout<<"\n";
    }

    return 0;
}



Measured memory_bytes: 3712
s=0.0
q=[]
$<.map{|l|q<<eval("[#{l}]")
q[2]&&(a,b,c=q.combination(2).map{|(x,y),(t,u)|Math.hypot x-t,y-u}
z=(a+b+c)/2
s+=(z*(z-a)*(z-b)*(z-c))**0.5
q-=[q[1]])}
p s

Measured memory_bytes: 6192
#include <iostream>
#include<vector>
#include<algorithm>
#include <queue>
#include <string>
#include <set>
#include <bitset>

using namespace std;
#define ff(i,n,m) for(int i=n;i<m;i++)
#define i64 int64_t
#define tos(x) to_string(x)

int main() {
	string s;
	cin >> s;
	int acta = 0;
	int actz = 0;
	int f = 0;
	int l = 0;
	int ans;
	ff(i, 0, s.size()) {
		if (acta == 0 && s.at(i) == 'A') {
			acta++;
			f = i;
		}
		if (actz == 0 && s.at(s.size() - 1 - i) == 'Z') {
			actz++;
			l = s.size() - 1 - i;
		}
	}
	ans = l - f + 1;
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
#define optimizar_io ios_base::sync_with_stdio(false);cin.tie(0);

typedef long long int ll;
const ll mod = 1e9 + 7;
int S;
ll memo[2010];

ll dp(ll sum) {
	if (sum > S) return 0;
	if (sum == S) return 1;
	if (memo[sum] != -1) return memo[sum];
	ll ans = 0;
	for (ll i = 3; i <= S; i++) {
		ans = (ans + dp(sum + i)) % mod;
	}
	return memo[sum] = ans;
}

int main() {
	optimizar_io

	cin >> S;
	memset(memo, -1, sizeof(memo));
	cout << dp(0) << "\n";
	return 0;
}

Measured memory_bytes: 3684
#include <stdio.h>

int main(void) {
    int i, n, x;
    for(n += i = scanf("%d", &n); i < n; i++) {
       if(!(i % 3)) {
           printf(" %d", i);
       } else {
           for(x = i; x; x /= 10) {
               if(x % 10 == 3) {
                   printf(" %d", i);
                   break;
               }
           }
       }
    }
    printf("\n");
    return 0;
}

Measured memory_bytes: 600
#include <algorithm>
#include <array>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <map>
#include <memory>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <sstream>
#include <unordered_map>
#include <vector>


#define INF 4000000000000000000LL
#define MOD 1000000007
#define ALL(x) std::begin(x), std::end(x)


int main(int argc, char** argv)
{
  std::cin.tie(0);
  std::ios_base::sync_with_stdio(0);

  std::cout << std::fixed << std::setprecision(6);

  int N, C, s, t, c;

  std::cin >> N >> C;

  std::vector<std::vector<std::pair<int, int>>> a(C, std::vector<std::pair<int, int>>());

  for (int i = 0; i < N; i ++) {
    std::cin >> s >> t >> c;

    a[-- c].emplace_back(s, t);
  }

  std::vector<std::pair<int, int>> b;

  for (int i = 0; i < C; i ++)
    if (! a[i].empty()) {
      std::sort(ALL(a[i]));

      std::pair<int, int> pair(a[i][0]);

      for (int j = 1, size = a[i].size(); j < size; j ++)
        if (pair.second == a[i][j].first) {
          pair.second = a[i][j].second;
        }
        else {
          b.emplace_back(pair.first * 2 - 1, pair.second * 2);

          pair = a[i][j];
        }

      b.emplace_back(pair.first * 2 - 1, pair.second * 2);
    }

  std::sort(ALL(b));

  std::priority_queue<int, std::vector<int>, std::greater<int>> pq;

  int size = 0;

  for (const auto& pair : b) {
    if (pq.empty()) {
      pq.push(pair.second);
    }
    else {
      while (! pq.empty())
        if (pq.top() <= pair.first) {
          pq.pop();
        }
        else {
          break;
        }

      pq.push(pair.second);
    }

    size = std::max<int>(pq.size(), size);
  }

  std::cout << size << std::endl;

  return 0;
}


Measured memory_bytes: 3056
#include<iostream>
#include<string>
#include<vector>
using namespace std;

int main() {
	vector<pair<string, int>>s;
	s.push_back({ "SUN",7 });
	s.push_back({ "SAT",1 });
	s.push_back({ "FRI",2 });
	s.push_back({ "THU",3 });
	s.push_back({ "WED",4 });
	s.push_back({ "TUE",5 });
	s.push_back({ "MON",6 });

	string tar; cin >> tar;
	for (auto&& x : s) {
		if (x.first == tar) {
			cout << x.second << endl;
			return 0;
		}
	}

	return 0;
}

Measured memory_bytes: 256
//AtCoder ABC112 B - Time Limit Exceeded
#include <bits/stdc++.h>
using namespace std;
using ll=int64_t;
int main() {
    ll N,T; cin>>N>>T;
    vector<pair<ll,ll>> ctn(N);
    for(auto&& ct:ctn){
        cin>>ct.first>>ct.second;
    }
    ll ans=INT64_MAX;
    for(const auto& ct:ctn){
        if(ct.second<=T) {
            ans=min(ans,ct.first);
        }
    }
    if(ans>=INT64_MAX){
        cout<<"TLE"<<endl;
    }else{
        cout<<ans<<endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
struct segtree{
private:
  ll siz;
  vector<ll> node;
  priority_queue<P> pque;
  queue<P> que;
public:
  segtree(ll k){
    siz=1<<k;
    node.resize(siz*2+5,0);
    pque.push(P(siz,0));
  }
  bool upd(ll pos,ll x){
    pos+=siz-1;
    node[pos]=x;
    bool ret=true;
    while(pos>0){
      pos=(pos-1)/2;
      node[pos]=max(node[2*pos+1],node[2*pos+2]);
      if(node[2*pos+1]==node[2*pos+2]) ret=false;
    }
    return ret;
  }
  bool seg_set(ll x,bool last){
    if(pque.empty()) return false;
    P p=pque.top();
    pque.pop();
    bool ret=upd(p.second,x);
    ll two=1,pos=p.second+1;
    while(two<p.first){
      que.push(P(two,pos));
      pos+=two;
      two*=2;
    }
    if(last){
      while(!que.empty()){
        pque.push(que.front());
        que.pop();
      }
    }
    return ret;
  }
};
int main(){
  ll k;
  cin>>k;
  ll n=1<<k;
  vector<ll> vec;
  vec.push_back(0);
  for(ll i=0;i<n;i++){
    ll a;
    cin>>a;
    vec.push_back(a);
  }
  sort(vec.begin(),vec.end(),greater<ll>());
  segtree seg=segtree(k);
  bool ret=true;
  for(int i=0;i<n;i++){
    bool f=vec[i]!=vec[i+1];
    if(!seg.seg_set(vec[i],f)){
      ret=false;
      break;
    }
  }
  cout<<(ret?"Yes":"No")<<endl;
}


Measured memory_bytes: 12268
#include <bits/stdc++.h>
using namespace std;
string s[200005];
int main()
{
	int n;
	cin>>n;
	set<string>v;
	for(int i=0;i<n;i++)
	{
		cin>>s[i];
		v.insert(s[i]);
	}
	cout<<v.size();

	return 0;
}

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

void c_p_c()
{
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
}
int solve(int *arr,int n)
{
	if(n==0)
		return 0;
	int dp[n+1];
	dp[1]= 0;
	for(int i=2;i<=n;i++)
	{
		dp[i] = min((abs(arr[i]-arr[i-1])+dp[i-1]),((i==2)?INT_MAX:(abs(arr[i]-arr[i-2])+dp[i-2])));
	} 
	return dp[n];

}
int main()
{
	c_p_c();
	int n;
	cin>>n;
	int arr[n+1];
	for(int i=1;i<=n;i++)
	{
		cin>>arr[i];
	}
	cout<<solve(arr,n);
	return 0;
}

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

int main(){
  char ch;
  int cnt[26] = {};

  while( cin >> ch ){
    ch = tolower(ch);
    if ( isalpha(ch) ){
      cnt[ch-'a']++;
    }
  }

  for ( int i = 0; i < 26; i++ ){
    printf("%c : %d\n", i+'a', cnt[i]);
  }

  return 0;
}


Measured memory_bytes: 3232
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxn = 1e5 + 14;
int main(){
    ios::sync_with_stdio(0), cin.tie(0);
    ll a, b;
    cin >> a >> b;
    if(a == b)
        return cout << "1\n", 0;
    int bits = 62;
    while((a >> bits & 1) == (b >> bits & 1))
        bits--;
    a &= (1ll << bits + 1) - 1;
    b &= (1ll << bits + 1) - 1;
    ll c = bits - 1;
    while(c >= 0 && !(b >> c & 1))
        c--;
    c = 1ll << c + 1;
    ll mid = 1ll << bits;
    // cerr << mid << ' ' << c << ' ' << mid * 2 - max(b + c, a | mid) << '\n';
    cout << mid - a + c + mid * 2 - max(mid + c, a | mid) << '\n';
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define INF 1e9
#define llINF 1e18
#define MOD 1000000007
#define pb push_back
#define mp make_pair 
#define F first
#define S second
#define ll long long
#define vi vector<ll>
#define vvi vector<vi>
#define BITLE(n) (1LL<<((ll)n))
#define SHIFT_LEFT(n) (1LL<<((ll)n))
#define SUBS(s,f,t) ((s).substr((f),(t)-(f)))
#define ALL(a) (a).begin(),(a).end()
using namespace std;

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  ll a,b,c,d,e,n,m,ans = 0;
  string s,ss,sss="";
  cin>>a>>b>>c;
  cout<<c<<" "<<a<<" "<<b<<endl;
  return 0;
}


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

typedef unsigned long long int LL;

int main() {
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	cout.tie(nullptr);
	double r;
	while (cin >> r)
		cout << fixed << r * 8.0 * atan(1.0) << endl;
}

Measured memory_bytes: 3800
using System;
using System.Text;
using System.Collections.Generic;
class Solve{
    int N,K;
    int[] a;
    public Solve(){}
    StringBuilder sb;
    public static int Main(){
        new Solve().Run();
        return 0;
    }
    void Run(){
        sb = new StringBuilder();
        Read();
        Calc();
        Console.Write(sb.ToString());
    }
    void Calc(){
        long[,,] dp = new long[N,N+1,256];
        long[] fact = new long[N+1];
        long count = 0;
        for(int i=0;i<N;i++){
            for(int j=0;j<N+1;j++){
                for(int k=0;k<256;k++){
                    if(j == 0){
                        if(k == 0){
                            dp[i,j,k] = 1;
                        }
                        else{
                            dp[i,j,k] = 0;
                        }
                    }
                    else if(i == 0){
                        if(k == a[0] && j == 1){
                            dp[i,j,k] = 1;
                        }
                        else{
                            dp[i,j,k] = 0;
                        }
                    }
                    else{
                        dp[i,j,k] = (dp[i-1,j,k] + dp[i-1,j-1,k^a[i]]) % Define.mod;
                    }
                }
            }
        }
        for(int i=0;i<N+1;i++){
            if(i == 0){
                fact[i] = 1;
            }
            else{
                fact[i] = (fact[i-1] * i) % Define.mod;
            }
        }
        for(int i=1;i<N+1;i++){
            count = (count + (dp[N-1,i,K] * fact[i] % Define.mod)) % Define.mod; 
        }
        sb.Append(count+"\n");
    }
    void Read(){
        string[] str = Console.ReadLine().Split(' ');
        N = int.Parse(str[0]);
        K = int.Parse(str[1]);
        str = Console.ReadLine().Split(' ');
        a = new int[N];
        for(int i=0;i<N;i++){
            a[i] = int.Parse(str[i]);
        }
    }    
}
public static class Define{
    public const long mod = 1000000007;
}

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

S = []
E = []

for i in range(M):
  if ab[i][0] == 1:
    S.append(ab[i][1])
  if ab[i][1] == N:
    E.append(ab[i][0])

if set(S) & set(E):
  print('POSSIBLE')
else:
  print('IMPOSSIBLE')


Measured memory_bytes: 61016
#include <bits/stdc++.h>
#include <math.h>
#define _GLIBCXX_DEBUG
using namespace std;
int main() {
  
  int X;
  cin>>X;
  
  if(X>=400&&X<=599){
    cout<<8<<endl;
  }
  else if(X>=600&&X<=799){
    cout<<7<<endl;
  }
  else if(X>=800&&X<=999){
    cout<<6<<endl;
  }
  else if(X>=1000&&X<=1199){
    cout<<5<<endl;
  }
  else if(X>=1200&&X<=1399){
    cout<<4<<endl;
  }
  else if(X>=1400&&X<=1599){
    cout<<3<<endl;
  }
  else if(X>=1600&&X<=1799){
    cout<<2<<endl;
  }
  else if(X>=1800&&X<=1999){
    cout<<1<<endl;
  }
}

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

#define REP(i, start, count) for(int i=(start); i<(int)(count); ++i)
#define rep(i, count) REP(i, 0, count)
#define ALLOF(c) (c).begin(), (c).end()

using ll = long long;
using ull = unsigned long long;
using veci = vector<int>;
using vecll = vector<ll>;
using vecull = vector<ull>;

// 素因数分解を実施する。
// O(√n)
// @return key:素数 value:個数
template <class T>
inline map<T, int> prime_factor(T n)
{
    map<T, int> ret;
    for (T i = 2; i * i <= n; ++i)
    {
        while (n % i == 0)
        {
            ret[i]++;
            n /= i;
        }
    }

    if (n != 1)
        ret[n] = 1;
    return ret;
}

ll N;

int main(void) {

    cin >> N;

    auto nprime = prime_factor(N);

    ll ans = 0;

    for (auto n : nprime) {
        int i = 1;
        while (n.second - i >= 0) {
            n.second -= i;
            ans += 1;
            i++;
        }
    }

    cout << ans << endl;


    return 0;
}


Measured memory_bytes: 3632
#pragma GCC optimize (3)
#include<vector>
#include<stack>
#include<bitset>
#include<cstdlib>
#include<cmath>
#include<set>
#include<list>
#include<deque>
#include<map>
#include<queue>
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<bits/stdc++.h>
/*#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
#include<ext/pb_ds/hash_policy.hpp>
#include<ext/pb_ds/trie_policy.hpp>
#include<ext/pb_ds/priority_queue.hpp>*/
#define PII pair<int,int>
#define ll long long
#define ull unsigned long long
#define INFI 2147483647
#define INFL 9223372036854775807
#define INFU 18446744073709551615
using namespace std;
//using namespace __gnu_pbds;
const double PI=acos(-1.0);
const double eps=1e-6;
inline int read()
{
    int x=0,f=1;
    char ch=getchar();
    while(ch<'0' || ch>'9'){
        if(ch=='-') f=-1;
        ch=getchar();
    }
    while(ch>='0' && ch<='9'){
        x=x*10+ch-'0';
        ch=getchar();
    }
    return x*f;
}
int n,x[100],y[100];
int f(int x)
{
    int ans=1;
    for(int i=1;i<=x;i++) ans*=i;
    return ans;
}
int main()
{
	//ios_base::sync_with_stdio(false);
    //cin.tie(0);
    //cout.tie(0);
    n=read();
    for(int i=1;i<=n;i++) x[i]=read(),y[i]=read();
    if(n==2) cout<<fixed<<setprecision(10)<<sqrt((double)(x[1]-x[2])*(x[1]-x[2])*1.0+(y[1]-y[2])*(y[1]-y[2])*1.0)<<endl;
    else{
        double cc=0;
        for(int i=1;i<=n;i++) for(int j=i+1;j<=n;j++) cc+=sqrt((double)(x[i]-x[j])*(x[i]-x[j])*1.0+(y[i]-y[j])*(y[i]-y[j])*1.0);
        cout<<fixed<<setprecision(10)<<2.0*cc/n<<endl;
    }
	return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#include<set>

struct root{
	std::size_t one, other;
	root(std::size_t a,std::size_t b) :one{a}, other{b} {}
	friend std::istream& operator>> ( std::istream&is,  root&p) {
		return is >> p.one >> p.other;
	}
};


template<class T>
bool find(const std::vector<T>&v,const T&val) {
	auto e_ = std::end(v);
	auto res = std::binary_search(std::begin(v),e_,val);
	return res;
}

int main() {
	std::size_t N, M;//target, size;
	std::cin >> N >> M;

	std::vector<std::size_t> one_, end_;


	for (std::size_t i = 0; i < M; i++) {
		std::size_t a, b;
		std::cin >> a >> b;
		if (a == 1 || b == 1) {
			one_.emplace_back(a != 1 ? a : b);
		}
		if (a == N || b == N) {
			end_.emplace_back(a != N ? a : b);
		}
	}
	/*
	for (auto e : one_) {
		std::cout << e << "\n";
	}std::cout << "\n";
	for (auto e : end_) {
		std::cout << e << "\n";
	}*/

	std::sort(std::begin(end_), std::end(end_));
	bool exist = false;
	for (const auto& e : one_) {
		exist |= find(end_, e);
	}
	
//	auto exist = find(vc,N);

	std::cout << (exist ? "POSSIBLE" : "IMPOSSIBLE") << "\n";
	std::cin >> M;
	return 0;
}

Measured memory_bytes: 2008
import std.stdio, std.conv, std.string, std.array, std.range, std.algorithm, std.container;
import std.math, std.random, std.bigint, std.datetime, std.format;
void main(string[] args){ if(args.length > 1) if(args[1] == "-debug") DEBUG = 1; solve(); }
void log()(){ writeln(""); } void log(T, A ...)(T t, lazy A a){ if(DEBUG) write(t, " "), log(a); } bool DEBUG = 0; 
string rstring(){ static string[] ss; while(!ss.length) ss = readln.chomp.split; string res = ss[0]; ss.popFront; return res; }
T rtype(T)(){ return rstring.to!T; } alias rint = rtype!int, rlong = rtype!long, rreal = rtype!real;
T[] rtypes(T)(int n){ return n.iota.map!(i => rtype!T()).array; } alias rint = rtypes!int, rlong = rtypes!long, rreal = rtypes!real;
T[][] rtypess(T)(int n, int m){ return n.iota.map!(i => rtypes!T(m)).array; } alias rint = rtypess!int, rlong = rtypess!long, rreal = rtypess!real;
T chmin(T)(ref T x, T y){ if(x > y) x = y; return x; } T chmax(T)(ref T x, T y){ if(x < y) x = y; return x; }

// ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- //

void solve(){
	long h = rlong;

	long ans = 0;
	long cnt = 1;
	while(h > 0){
		ans += cnt;
		h /= 2;
		cnt *= 2;
	}

	ans.writeln;
}

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

int main(){
    int min=101,max=0;
    int n,w;
    cin>>n;
    int x[n];
    for(int i=0;i<n;i++){
        cin>>x[i];
        if(min>x[i]){
            min=x[i];
        }
        if(max<x[i]){
            max=x[i];
        }
    }
    int ans,sum;
    for(int i=min;i<=max;i++){
        sum=0;
        for(int j=0;j<n;j++){
            sum=sum+((x[j]-i)*(x[j]-i));
        }
        if(i==min){
            ans=sum;
        }
        if(ans>sum){
            ans=sum;
        }
    }
    cout<<ans<<"\n";
    
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#include <string>
#include <algorithm>
#include <vector>
#include <sstream>
using namespace std;

int main(void){
    int a;
    string s;
    cin >> a;
    cin >> s;
    if(a>=3200) cout << s << endl;
    else if(a < 3200) cout << "red" << endl;
    return 0;
}

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

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

#define MOD 1000000007LL

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

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

int main(void) {
    ll H, W, K;
    cin >> H >> W >> K;
    vector<string> s(H);
    set<ll> verticalSet;
    vector<ll> vertical;
    ll count = 1;
    vector<vector<ll>> A(H, vector<ll>(W));
    rep(i, H) {
        cin >> s[i];
        iter(c, s[i]) {
            if(c == '#') verticalSet.insert(i);
        }
    }
    vertical = vector<ll>(verticalSet.begin(), verticalSet.end());
    rep(i, vertical.size()) {
        ll top = 0, bottom = H;
        if(i > 0) top = vertical[i - 1] + 1;
        if(i < vertical.size() - 1) bottom = vertical[i] + 1;
        set<ll> horizontalSet;
        rep(w, W) {
            rep2(h, top, bottom) {
                if(s[h][w] == '#') horizontalSet.insert(w);
            }
        }
        if(horizontalSet.size() == 1) {
            rep2(j, top, bottom) {
                rep(k, W) A[j][k] = count;
            }
            count++;
        } else {
            vector<ll> horizontal(horizontalSet.begin(), horizontalSet.end());
            rep(j, horizontal.size()) {
                ll left = 0, right = W;
                if(j > 0) left = horizontal[j - 1] + 1;
                if(j < horizontal.size() - 1) right = horizontal[j] + 1;
                rep2(k, top, bottom) {
                    rep2(l, left, right) A[k][l] = count;
                }
                count++;
            }        
        }
    }
    iter(i, A) {
        rep(j, i.size()) {
            cout << i[j];
            if(j != i.size() - 1) cout << ' ';
        }
        cout << endl;
    }
    return 0;
}


Measured memory_bytes: 4532
#include "bits/stdc++.h"
#pragma warning(disable:4996)
using namespace std;

struct man {
	long long int atime;
	long long int sat;
};

int main() {
	while (1) {

		int N; cin >> N;
		if (!N)break;
		vector<man>men(N);

		for (int i = 0; i < N; ++i) {
			int M, L; cin >> M >> L;
			men[i].sat = L;
			for (int j= 0; j < M; ++j) {
				int S, E; cin >> S >> E;
				for (int t = S; t < E; ++t) {
					men[i].atime ^= 1 << (t - 6);

				}
			}
		}
		long long int dp[1 << 16] = {};
		for (int i = 0; i < (1 << 16); ++i) {
			for (int j = 0; j < N; ++j) {
				if (!(i&men[j].atime)) {
					dp[i^men[j].atime] = max(dp[i^men[j].atime], dp[i] + men[j].sat);

				}
			}
		}
		cout << dp[(1 << 16) - 1] << endl;
	}
	
	return 0;
}

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

#define ll long long int
#define INFTY (1<<21)

using namespace std;

int main(void){
    cin.sync_with_stdio(false);
    int n;
    string a,b,c;
    cin>>n>>a>>b>>c;
    int ans = 0;
    for(int i = 0; i < n; i++){
        if(a[i]==b[i]){
            if(a[i]!=c[i]) ans++;
        }
        else if(b[i]==c[i]){
            if(a[i]!=c[i]) ans++;
        }
        else if(a[i]==c[i]){
            if(b[i]!=c[i]) ans++;
        }
        else{ //3つとも違う
            ans += 2;
        }
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ADD(a, b) a = (a + ll(b)) % mod
#define MUL(a, b) a = (a * ll(b)) % mod
#define MAX(a, b) a = max(a, b)
#define MIN(a, b) a = min(a, b)
#define rep(i, a, b) for(int i = int(a); i < int(b); i++)
#define rer(i, a, b) for(int i = int(a) - 1; i >= int(b); i--)
#define all(a) (a).begin(), (a).end()
#define sz(v) (int)(v).size()
#define pb push_back
#define sec second
#define fst first
#define debug(fmt, ...) Debug(__LINE__, ":", fmt, ##__VA_ARGS__)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pi;
typedef pair<ll, ll> pl;
typedef pair<int, pi> ppi;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vl> mat;
typedef complex<double> comp;
void Debug() {cerr << '\n'; }
template<class FIRST, class... REST>void Debug(FIRST arg, REST... rest){
	cerr<<arg<<" ";Debug(rest...);}
template<class T>ostream& operator<<(ostream& out,const vector<T>& v) {
	out<<"[";if(!v.empty()){rep(i,0,sz(v)-1)out<<v[i]<<", ";out<<v.back();}out<<"]";return out;}
template<class S, class T>ostream& operator<<(ostream& out,const pair<S, T>& v){
	out<<"("<<v.first<<", "<<v.second<<")";return out;}
const int MAX_N = 300010;
const int MAX_V = 100010;
const double eps = 1e-6;
const ll mod = 998244353;
const int inf = 1 << 30;
const ll linf = 1LL << 60;
const double PI = 3.14159265358979323846;
mt19937 rng; //use it by rng() % mod, shuffle(all(vec), rng)
///////////////////////////////////////////////////////////////////////////////////////////////////

int N;
int A[MAX_N];
ll dp[310][90010][2][2];

ll mod_pow(ll a, ll n) {
	if(n == 0) return 1;
	ll res = mod_pow(a, n / 2);
	if(n % 2 == 0) return res * res % mod;
	else return a * res % mod * res % mod;
}

void solve() {
	cin >> N;
	rep(i, 0, N) {
		cin >> A[i];
	}
	int sum = accumulate(A, A + N, 0);
	sum = (sum + 1) / 2;
	dp[0][0][0][0] = 1;
	rep(i, 0, N) {
		rep(j, 0, 90000) {
			rep(k, 0, 2) {
				rep(l, 0, 2) {
					if(dp[i][j][k][l] == 0) continue;
					ADD(dp[i + 1][j][k | 1][l], dp[i][j][k][l]);
					ADD(dp[i + 1][j][k][l | 1], dp[i][j][k][l]);
					ADD(dp[i + 1][j + A[i]][k][l], dp[i][j][k][l]);
				}
			}
		}
	}
	ll ans = mod_pow(3, N);
	ADD(ans, mod - mod_pow(2, N) * 3 % mod);
	ADD(ans, 3);
	// debug(ans);
	rep(i, sum, 90000 + 1) {
		// if(i < 20)debug(sum, i, dp[N][i][1][1]);
		ADD(ans, mod - dp[N][i][1][1] * 3 % mod);
	}
	cout << ans << "\n";
}

uint32_t rd() {
	uint32_t res;
#ifdef __MINGW32__
	asm volatile("rdrand %0" :"=a"(res) ::"cc");
#else
	res = std::random_device()();
#endif
	return res;
}

int main() {
#ifndef LOCAL
	ios::sync_with_stdio(false);
    cin.tie(0);
#endif
    cout << fixed;
	cout.precision(20);
    cerr << fixed;
	cerr.precision(6);
	rng.seed(rd());
#ifdef LOCAL
	//freopen("in.txt", "wt", stdout); //for tester
    freopen("in.txt", "rt", stdin);
#endif	
	solve();
    cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";
	return 0;
}



Measured memory_bytes: 817408
#include<iostream>
#include<string>
#include<cstdio>
#include<cstring>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<deque>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
#include<cassert>
using namespace std;

typedef long long ll;
typedef unsigned long long ul;
typedef unsigned int ui;
typedef long double ld;
const int inf=1e9+7;
const ll INF=1LL<<60 ;
const ll mod=1e9+7 ;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
typedef complex<ld> Point;
const ld eps = 1e-8;
const ld pi = acos(-1.0);
typedef pair<int, int> P;
typedef pair<ld, ld> LDP;
typedef pair<ll, ll> LP;
#define fr first
#define sc second
#define all(c) c.begin(),c.end()
#define pb push_back
#define debug(x)  cout << #x << " = " << (x) << endl;
using Graph = vector<vector<int> >;
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; }
//#define int long long

//順列をマッチングとみる
//dp[i][j] = (1,.,i)と(1,..,i)同士のみを考えてときj箇所でマッチングしているような場合の数

void solve() {
	int n; cin >> n;
	vector<char> c(n);
	rep(i, n) {
		cin >> c[i];
	}
	ll dp[220][220];
	rep(i, n + 1) {
		rep(j, n + 1) {
			dp[i][j] = 0;
		}
	}
	dp[0][0] = 1LL;
	rep(i, n) {
		rep(j, i + 1) {
			if(c[i] == '-') {
				dp[i + 1][j + 1] += dp[i][j];
			} else if(c[i] == 'U') {
				(dp[i + 1][j + 1] += dp[i][j] * (i - j) ) %= mod;
				(dp[i + 1][j] += dp[i][j]) %= mod;
			} else if(c[i] == 'D') {
				(dp[i + 1][j + 2] += dp[i][j] * (i - j) * (i - j)) %= mod;
				(dp[i + 1][j + 1] += dp[i][j] * (i - j)) %= mod;
			}
		}
	}

	cout << dp[n][n] << endl;
}

signed main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	//cout << fixed << setprecision(10);
	//init();
	solve();
	//cout << "finish" << endl;
    return 0;
}


Measured memory_bytes: 3480
n = int(input())
a = input().split()
e = []
o = []
for i in range(n//2):
    o.append(a[i*2])
    e.append(a[i*2+1])
if n % 2 == 1:
    o.append(a[-1])
    o = o[::-1]
    print(" ".join(o+e))
else:
    e = e[::-1]
    print(" ".join(e+o))

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

// #define int ll
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using si = set<int>;
using ii = pair<int, int>;
using vii = vector<ii>;

#define rep(i, n) for (int i = 0; i < n; i++)
#define dotc()    int tcs; if (cin >> tcs) rep(tc, tcs)
#define sz(x)     (int)x.size()
#define eb        emplace_back
#define pb        push_back
#define mp        make_pair
#define all(x)    x.begin(), x.end()
#define rall(x)   x.rbegin(), x.rend()
#define fi        first
#define se        second

int inf(0x3fffffff);
int mod(1000000007);
double pi(acos(-1.0));

int32_t main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
#ifdef LOCAL
  freopen("io\\in.txt", "r", stdin);
  freopen("io\\out.txt", "w", stdout);
#endif

  string s, t;
  cin >> s >> t;
  int cnt = 0;
  rep(i, sz(s)) {
    if (s[i] != t[i]) cnt++;
  }
  cout << cnt;

  return 0;
}


Measured memory_bytes: 3796
#include<cstdio>
int d[500050],f[500050],p[500050],n,q,i=1;main(){for(scanf("%d%d",&n,p);i<=n;++i)scanf("%d",d+i),p[i]=(p[i-1]>d[i]?p[i-1]-d[i]:(d[i]<p[i-1]*2?d[i]-p[i-1]:p[i-1]));f[n+1]=1;for(i=n;i;--i)f[i]=(d[i]>=f[i+1]*2?f[i+1]:d[i]+f[i+1]);for(scanf("%d",&q);q--;){scanf("%d",&i);puts(p[i-1]>=f[i+1]?"YES":"NO");}}

Measured memory_bytes: 7680
#include <bits/stdc++.h>
using namespace std;
int main() {
 	long long h, n, a[1001], b[1001], dp[10001]; cin >> h >> n;
  	for (int i = 0; i < n; i++) cin >> a[i] >> b[i];
  	for (int i = 0; i < 10001; i++) dp[i] = 1010101010;
  	dp[0] = 0;
  	for (int i = 0; i <= h; i++) {
     	for (int j = 0; j < n; j++) {
          dp[min(h, i + a[j])] = 
          min(dp[min(h, i + a[j])], dp[i] + b[j]);
        }
    }
	cout << dp[h] << endl;
}

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

template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

using ll = long long;
using P = pair<int,int>;
using graph = vector<vector<int>>;

const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
const ll INF = 1LL<<60;
const ll mod = 1000000007LL;

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
ll pow(ll a, ll n, ll m) {
	ll ret = 1LL;
	for (; n > 0LL; n >>= 1LL, a = a * a % m) {
		if (n % 2LL == 1LL) {
			ret = ret * a % m;
		}
	}
	return ret;
}

int main() {
    ll N;
    cin>>N;
    vector<ll> v(N*3);
    rep(i,N*3) cin>>v[i];
    multiset<ll> a;
    rep(i,N) a.insert(v[i]);
    vector<ll> pl(N+1,0LL),mi(N+1,0LL);
    rep(i,N) pl[0] += v[i];
    rep(i,N) {
        if(v[N+i]>*a.begin()){
            pl[i+1] = pl[i]-*a.begin()+v[N+i];
            a.insert(v[N+i]);
            a.erase(a.begin());
        }
        else pl[i+1] = pl[i];
    }
    rep(i,N) mi[0] += v[N*3-i-1];
    multiset<ll> b;
    rep(i,N) b.insert(v[N*3-i-1]);
    rep(i,N) {
        if(v[N*2-i-1]<*b.rbegin()){
            mi[i+1] = mi[i] -*b.rbegin()+v[N*2-i-1];
            b.insert(v[N*2-i-1]);
            b.erase(b.find(*b.rbegin()));
        }
        else mi[i+1] = mi[i];
    }
    ll ans = -INF;
    rep(i,N+1){
        chmax(ans,pl[i]-mi[N-i]);
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 16448
A = list(map(int,input().split()))
B = list(map(int,input().split()))
C = list(map(int,input().split()))
bingo = [0,0,0,0,0,0,0,0,0]
N = int(input())

for i in range(N):
  hoge = int(input())
  for i in range(3):
    if A[i] == hoge:
      bingo[i] = 1
    if B[i] == hoge:
      bingo[i+3] = 1
    if C[i] == hoge:
      bingo[i+6] = 1
      
if bingo[0] == 1 and bingo[1] == 1 and bingo[2] == 1:
  print("Yes")
elif bingo[3] == 1 and bingo[4] == 1 and bingo[5] == 1:
  print("Yes")
elif bingo[6] == 1 and bingo[7] == 1 and bingo[8] == 1:
  print("Yes")
elif bingo[0] == 1 and bingo[3] == 1 and bingo[6] == 1:
  print("Yes")
elif bingo[1] == 1 and bingo[4] == 1 and bingo[7] == 1:
  print("Yes")
elif bingo[2] == 1 and bingo[5] == 1 and bingo[8] == 1:
  print("Yes")
elif bingo[0] == 1 and bingo[4] == 1 and bingo[8] == 1:
  print("Yes")
elif bingo[2] == 1 and bingo[4] == 1 and bingo[6] == 1:
  print("Yes")
else:
  print("No")

Measured memory_bytes: 3064
#include<iostream>
#include<cmath>
using namespace std;
int main()
{
    long long int a=0,b=0,n,ans=-1; //a是青色 b是红色,ans是包含的青色数目
    string s;
    //int c=8;
    //cout<<(int)(c*11.1)<<endl;
    cin>>a>>b;
    for(long long int i = 1;i<=1000;i++)
    {
        if((int)(i*0.08)==a&&(int)(i*0.10)==b)
        {
            ans=i;
            break;
        }
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
using namespace std;
bool used[10];
int dp[11][10000];
void solve(int s,int d,int cnt)
{
	if(s<d)
	{
		dp[s][cnt]++;
		return;
	}

	for(int i = 0; i < 10; ++i)
	{
		if(!used[i])
		{
			used[i]=true;
			solve(s,d+1,cnt+i*d);
			used[i]=false;
		}
	}

	return;
}


int main()
{
	for(int i = 1; i < 11; ++i)
	{
		fill(used,used+10,0);
		solve(i,1,0);
	}
	int n,s;
	while(cin>>n>>s)
	{
		cout<<dp[n][s]<<endl;
	}
  return 0;
}

Measured memory_bytes: 1208
/*input
1
1

*/
 
/*
                                                    ______________
                                                          |       )
                                                          |   )   /
                                                          |______/
                                                    |     |      \
                                                    |     |   )   \
                                                    |_____|_______)
 
*/
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <ctime>
#include <cassert>
#include <complex>
#include <string>
#include <cstring>
#include <chrono>
#include <random>
#include <queue>
#include <bitset>
#include <iomanip>
#include <fstream>
#include <stack>

using namespace std;
 
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> PII;
typedef pair<ll , ll> PLL;
typedef long double ld;
 
#define pb push_back
#define all(c) c.begin(),c.end()
#define allr(c) c.rbegin(),c.rend()
int mod = 1000000007;
const int inf = 1034567891;
const ll LL_INF = 1234567890123456789ll;
#define PI 3.14159265
#define endl '\n'
#define F first
#define S second
#define debug(x) cout << #x << " = " << x << endl;
#define TRACE
 
#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
  cout << name << " : " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
  const char* comma = strchr(names + 1, ',');cout.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
#else
#define trace(...)
#endif
 
#define out(container) for (auto it : container) cout << it << " "; cout << endl;
 
 
template < typename T > T GCD(T a, T b)            { ll t; while(a) { t = a; a = b % a; b = t; } return b; }
template < typename T > string toString(T a)       { return to_string(a); }
template < typename T > void toInt(string s, T &x) { stringstream str(s); str >> x;}
inline int add(int x, int y){ x += y; if(x >= mod) x -= mod; return x;}
inline int sub(int x, int y){ x -= y; if(x < 0) x += mod; return x;}
inline int mul(int x, int y){ return (x * 1ll * y) % mod;}
inline int powr(int a, ll b){
  int x = 1 % mod;
  while(b){
    if(b & 1) x = mul(x, a);
    a = mul(a, a);
    b >>= 1;
  }
  return x;
}
inline int inv(int a){ return powr(a, mod - 2);}

ll get(ll n) {
  return n * (n - 1) / 2;
}

int main()
{
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  
  int n;
  cin >> n;
  vector<int> cnt(n + 1, 0);
  int v;
  vector<int> vec;
  for (int i = 0; i < n; i++) {
    cin >> v;
    vec.pb(v);
    cnt[v]++;
  }  
  ll ans = 0;
  for (int i = 1; i <= n; i++) {
    ans += get(cnt[i]);
  }
  for (int i = 0; i < n; i++) {
    ll c = cnt[vec[i]];
    ll cur = ans - max(0ll, (c - 1));
    cout << cur << endl;
  }

  return 0;
}

Measured memory_bytes: 4340
from operator import mul
from functools import reduce

def cmb(n,r):
    r = min(n-r,r)
    if r == 0: return 1
    over = reduce(mul, range(n, n - r, -1))
    under = reduce(mul, range(1,r + 1))
    return over // under

N,A,B=map(int,input().split())
V=list(map(int,input().split()))
V.sort()
av_max=0
count=0

for i in range(A,B+1):
    if sum(V[N-i:N])/i>av_max:
        av_max=sum(V[N-i:N])/i
        count=cmb(V.count(V[N-i]),V[N-i:N].count(V[N-i]))
    elif sum(V[N-i:N])/i==av_max:
        count+=cmb(V.count(V[N-i]),V[N-i:N].count(V[N-i]))

print(av_max)
print(count)

Measured memory_bytes: 4068