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

#define reps(v, f, l) for (int v = (f), v##_ = (l); v < v##_; ++v)
#define rep(v, n) reps(v, 0, n)
#define lep(v, n) reps(v, 1, n + 1)

using namespace std;

typedef long long int lint;

static inline int in(){ int x; scanf("%d", &x); return x; }
static inline lint inl(){ lint x; scanf("%lld", &x); return x; }
template<typename T> void show(T& a, char del='\n', char last='\n'){ rep(i, a.size() - 1) cout << a[i] << del; cout << a[a.size() - 1] << last; }

int main()
{
  rep(i, 7){
    printf("%d\n", in() - in());
  }
  return 0;
}

Measured memory_bytes: 1188
#include <iostream>
#include <cassert>
#include <iomanip>
#include <utility>
#include <cmath>
#include <numeric>
#include <vector>
#include <set>
#include <map>
#include <algorithm>
#include <queue>
#include <string>

using namespace std;

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

#define rep(i, n) for (ll i = 0LL; i < n; i++)
#define repext(i, a, b) for (ll i = a; i < b; i++)
#define reprev(i, n) for (ll i = n - 1; i >= 0; i--)
#define repextrev(i, a, b) for (ll i = b - 1; i >= a; i--)

#define repv(v, values) for (auto v : values)

#define vec_all(vec) vec.begin(), vec.end()
#define sum(vec) accumulate(vec_all(vec), 0LL)
#define srt(vec) sort(vec_all(vec))
#define rev(vec) reverse(vec_all(vec))
#define revsrt(vec) \
    srt(vec);       \
    rev(vec)

// vectorデバッグ
template <typename T>
void dump_vec(vector<T> vec)
{
    rep(i, vec.size())
    {
        cout << i << ": " << vec[i] << endl;
    }
}

template <typename T, typename S>
void dump_dic(map<T, S> dic)
{
    for (auto v : dic)
    {
        cout << v.first << ": " << v.second << endl;
    }
}

// --- notice ---
// intの和はllにしろ

int main()
{
    int n, q;
    cin >> n >> q;
    vector<vector<int>> graph(n + 1, vector<int>());
    int a, b;
    rep(i, n - 1)
    {
        cin >> a >> b;
        graph[a].push_back(b);
        graph[b].push_back(a);
    }
    int root = 1;
    vector<int> h(n + 1, -1);
    vector<int> p(n + 1, -1);
    h[root] = 1;
    p[root] = 0; // 根の親は存在しない頂点
    queue<int> que;
    que.push(root);
    vector<int> under;
    while (que.size() > 0)
    {
        root = que.front();
        que.pop();
        under = graph[root];
        repv(v, under)
        {
            if (h[v] == -1)
            {
                h[v] = h[root] + 1;
                p[v] = root;
                que.push(v);
            }
        }
    }

    vector<p_i> query(q);
    int _p, _x;
    rep(i, q)
    {
        cin >> _p >> _x;
        query[i] = p_i(_p, _x);
    }

    vector<int> m(n + 1, 0);
    repv(v, query)
    {
        _p = v.first;
        m[_p] += v.second;
    }

    root = 1;
    que.push(root);
    while (que.size() > 0)
    {
        root = que.front();
        que.pop();
        under = graph[root];
        repv(v, under)
        {
            if (h[v] > h[root]) {
                m[v] += m[root];
                que.push(v);
            }
        }
    }

    repext(i, 1, n + 1) {
        cout << m[i] << " ";
    }

    cout << endl;

    return 0;
}

Measured memory_bytes: 19444
S = input()
T = input()
lenT = len(T)
lenS = len(S)
lsS = []
for i in range(lenS-lenT+1):
    lsS.append(S[i:i+lenT])
ans = 1000
for st in lsS:
    ii = 0
    for i in range(lenT):
        if st[i] != T[i]:
            ii += 1
    ans = min(ans,ii)
print(ans)

Measured memory_bytes: 9192
#include <iostream>
#include <vector>
#include <algorithm>
#include <utility>
#include <queue>
#include <string>
#include <set>
#include <bitset>
#include <unordered_map>
#include <cmath>
#include <functional>
#include <map>
#include <cstdlib>

using namespace std;
using ll = long long;
using Pii = pair<int, int>;
using Pll = pair<ll, ll>;
template <class T>
using Vvec = vector<vector<T> >;

template <class T>
void debug(T& v)
{
    for(auto& x: v) cout << x << " ";
    cout << endl;
}

int search_s(vector<string>& A){
    for(int i=0; i<A.size(); i++){
        for(int j=0; j<A[i].size(); j++){
            if(A[i][j] == 'S') return i*A[i].size() + j;
        }
    }
    return -1;
}

bool vacant(vector<string>& A, Vvec<int>& d, int x, int y){
    const int H = A.size(), W = A[0].size();
    return (x>=0) && (x<H) && (y>=0) && (y<=W) && (A[x][y]=='.') && (d[x][y] == -1); 
}

Vvec<int> bfs(vector<string>& A, int s){
    const int H = A.size();
    const int W = A[0].size();
    queue<Pii> q;
    q.push(Pii(s, 0));
    Vvec<int> dist(H, vector<int>(W, -1));
    dist[s/W][s%W] = 0;
    
    const vector<int> dx{-1, 0, 0, 1};
    const vector<int> dy{0, -1, 1, 0};
    while(!q.empty()){
        int i = q.front().first / W;
        int j = q.front().first % W;
        int d = q.front().second;
        q.pop();

        for(int k=0; k<4; k++){
            int x = i+dx[k];
            int y = j+dy[k];
            if(vacant(A, dist, x, y)){
                dist[x][y] = d+1;
                q.push(Pii(x*W+y, d+1));
            }
        }
    }

    return dist;
}

int calc_ans(Vvec<int>& dist, int K){
    const int H = dist.size();
    const int W = dist[0].size();
    int ret = 1e9;

    for(int i=0; i<H; i++){
        for(int j=0; j<W; j++){
            if(dist[i][j]>=0 && dist[i][j]<=K){
                int t = min({i, j, H-1-i, W-1-j});
                ret = (t==0) ? 1 : min(ret, (t-1)/K+2);
            }
        }
    }

    return ret;
}

int main()
{
    int H, W, K;
    cin >> H >> W >> K;
    vector<string> A(H);
    for(auto& s: A) cin >> s;

    int s = search_s(A);
    Vvec<int> dist = bfs(A, s);
    int ans = calc_ans(dist, K);

    cout << ans << endl;
}

Measured memory_bytes: 3584
#include<bits/stdc++.h>
#define int long long 
using namespace std;
const int maxn=2e5+10;
set<int>s[maxn];
int n,k,a[maxn],b[maxn],cnt,tot;
main()
{
	scanf("%lld%lld",&n,&k);
	for(int i=1;i<=n;i++)scanf("%lld",&a[i]),s[a[i]].insert(i);
	int now=1;
	while(b[now]==0)
	{
		b[now]=++cnt;
		set<int>::iterator it=s[a[now]].upper_bound(now);
		if(it!=s[a[now]].end())
		{
			now=*it+1;
			if(now==n+1)now=1,tot++;
		}
		else
		{
			it=s[a[now]].upper_bound(0);
			now=*it+1;
			tot++;
		}
	}
//	printf("%lld\n",tot);
	k%=tot;
	now=1;
	if(k==0)return 0;
	while(k!=1)
	{
		set<int>::iterator it=s[a[now]].upper_bound(now);
		if(it!=s[a[now]].end())
		{
			now=*it+1;
			if(now==n+1)now=1,k--;
		}
		else
		{
			it=s[a[now]].upper_bound(0);
			now=*it+1;
			k--;
		}
//		printf("%lld\n",now);
	}
//	puts("!");
	for(;now<=n;now++)
	{
		set<int>::iterator it=s[a[now]].upper_bound(now);
		while(it!=s[a[now]].end())
		{
			now=*it+1;
			if(now==n+1)
			{
				now=1,k--;
				return 0;
			}
			it=s[a[now]].upper_bound(now);
		}
		printf("%lld ",a[now]);
	}
}
/*
5 10
1 2 3 2 3
*/

Measured memory_bytes: 25668
/**
 * MinMaxSum.cpp
 * Create:20180420
 * Description:n個の整数を入力し、最小値・最大値・合計値を求めるプログラム。
 */
#include <iostream>
#include <sstream>
#include <vector>
#include <limits.h>

int main(int argc, char* argv[]){
  std::vector<int> vec;         // 値を格納する配列
  int n;                        // 値を格納する数量

  std::cin >> n;

  // スペース区切りで値を格納する
  for (int i = 0; i < n; i++){
    int input;
    std::cin >> input;
    vec.push_back(input);
  }

  int min = INT_MAX;  // 最小値
  int max = INT_MIN;  // 最大値
  long int sum = 0;   // 合計値

  for (int x : vec){
    if (min > x) {
      min = x;
    }
    if (max < x) {
      max = x;
    }
    sum += x;
  }

  std::cout << min << " " << max << " " << sum << std::endl;

  return 0;
}


Measured memory_bytes: 3256
#include <iostream>
#include <string>
#include <vector>
int main(int argc, char const *argv[])
{
	std::string line;
	std::vector<int> res(26,0);
	while(true){
		std::getline(std::cin,line);
		if(std::cin.eof()){break;}
		for(char c : line){
			int cn = (int)c;
			if(cn >= (int)'a'){
				cn -= (int)'a';
			}else{
				cn -= (int)'A';
			}
			if(cn >= 0){
				res[cn] ++;
			}
		}
	}
	for(int i = 0; i < 26 ; i ++){
		std::cout << (char)(i+(int)'a') << " : " << res[i] << std::endl;
	}

	return 0;
}

Measured memory_bytes: 3184
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n,q;cin>>n>>q;
  string s;cin>>s;
  char t[q],d[q];
  for(int i=0;i<q;i++)cin>>t[i]>>d[i];
  if(n==1){
    for(int i=0;i<q;i++){
      if(t[i]==s[0])cout<<0<<endl;
      return 0;
    }
    cout<<1<<endl;
    return 0;
  }
  int ul=n,dl=-1;
  while(ul-dl>1){
    int mid=(ul+dl)/2;
    int now=mid;
    for(int i=0;i<q;i++){
      if(s[now]==t[i]&&d[i]=='L'){
        now--;
      }
      else if(s[now]==t[i]&&d[i]=='R')now++;
      if(now==-1)break;
      if(now==n)break;
    }
    if(now==-1)dl=mid;
    else ul=mid;
  }
  int ur=n,dr=-1;
  while(ur-dr>1){
    int mid=(ur+dr)/2;
    int now=mid;
    //cout<<mid<<" ";
    for(int i=0;i<q;i++){
      if(s[now]==t[i]&&d[i]=='R'){
        now++;
      }
      else if(s[now]==t[i]&&d[i]=='L')now--;
      if(now==n)break;
      if(now==-1)break;
      //if(mid==1)cout<<now<<" ";
    }
    if(now==n)ur=mid;
    else dr=mid;
  }
  int sum=min(n,ul+n-1-dr);
  //cout<<ul<<dr<<endl;
  cout<<n-sum<<endl;
}

Measured memory_bytes: 900
//
//  2170.cpp
//  
//
//  Created by Yoshida Satoshi on 2018/10/28.
//

#include <stdio.h>
#include <iostream>
#include <vector>
#include <cmath>
#include <algorithm>
#include <queue>
#include <stack>
#include <utility>

#define MAX 100010
#define P make_pair
typedef long long ll;

using namespace std;

struct UF
{
    vector<int> par;
    vector<int> rank;
    int m[MAX];
    vector<int> c[MAX];
    vector<int> p;
    int n;
    
    UF(int k):par(k),rank(k),p(k)
    {
        n=k;
        for(int i=0;i<n;i++) par[i]=i;
        for(int i=0;i<n;i++) rank[i]=0;
        for(int i=0;i<n;i++)   m[i]=0;
        m[0]=1;
    }
    
    void pushc(int p,int l)
    {
        c[p].push_back(l);
    }
    
    void mark(int x)
    {
        m[x]++;
    }
    
    int root(int x)
    {
        if(par[x]==x) return x;
        return par[x]=root(par[x]);
    }
    
    void unite(int x,int y)
    {
        int rx=root(x);
        int ry=root(y);
        
        par[rx]=ry;
    }
    
    bool same(int x,int y)
    {
        int rx=root(x);
        int ry=root(y);
        
        return rx==ry;
    }
    
    void furiwake(int x)
    {
        for(int i=0;i<c[x].size();i++)
        {
            if(m[c[x][i]]>0) par[c[x][i]]=c[x][i];
            else           par[c[x][i]]=x;
            furiwake(c[x][i]);
        }
    }
    
    int score(int x)
    {
        return root(x)+1;
    }
    
    void delmark(int x)
    {
        m[x]--;
        if(m[x]==0) unite(x,p[x]);
    }
};

int main()
{
    while(1)
    {
        int n,q;
        stack<pair<char,int> > qu;
        cin>>n>>q;
        if(n==0) break;
        UF uf(n);
        for(int i=1;i<n;i++)
        {
            int p;
            cin>>p;
            uf.pushc(p-1,i);
            (uf.p)[i]=p-1;
        }
        for(int i=0;i<q;i++)
        {
            char temp;
            int v;
            cin>>temp>>v;
            qu.push(P(temp,v-1));
            if(temp=='M') uf.mark(v-1);
        }
        uf.furiwake(0);
        
        ll ans=0;
        for(int i=0;i<q;i++)
        {
            pair<char,int> a=qu.top();
            qu.pop();
            if(a.first=='Q')
            {
                ans+=uf.score(a.second);
            }
            else
            {
                uf.delmark(a.second);
            }
        }
        
        cout<<ans<<endl;
    }

    return 0;
}





Measured memory_bytes: 12940
#include<bits/stdc++.h>
typedef long long i64;
const int N=4007,P=1e9+7,M=4000;
i64 fac[N],fiv[N],ans=0;
int n,k;
i64 pw(i64 a,i64 n){
	if(n<0)return 1;
	i64 v=1;
	for(;n;n>>=1,a=a*a%P)if(n&1)v=v*a%P;
	return v;
}
i64 F(int n,int m){return n>=0&&m>=0?fac[n+m]*fiv[m]%P*fiv[n]%P:0;}
int main(){
	scanf("%d%d",&n,&k);
	for(int i=fac[0]=1;i<=M;++i)fac[i]=i*fac[i-1]%P;
	fiv[M]=pw(fac[M],P-2);
	for(int i=M;i;--i)fiv[i-1]=i*fiv[i]%P;
	ans=F(n-1,k-1)-F(k-2,n);
	ans=ans*pw(2,n-k-1)%P;
	printf("%lld\n",(ans+P)%P);
	return 0;
}

Measured memory_bytes: 256
/// atcoder -> D : Choosing Points

#include <bits/stdc++.h>

using namespace std;

const int N=600;/// 2 * 300

int n,d[3];

struct point
{
    int r,c;
};
vector<point>v[3][N+5][N+5];
int col[3][N+5][N+5];

vector<point>nu[3];

void build_nu()
{
    for(int k=1;k<=2;k++)
        for(int i=0;i<2*n;i++)
            for(int j=0;j<2*n;j++)
            {
                int sum=i*i+j*j;
                if(sum==d[k])
                    nu[k].push_back({i,j});
            }
}

bool valid(int r,int c)
{
    if(0<=r && 0<=c && r<2*n && c<2*n)
        return 1;
    return 0;
}

void build_graf()
{
    for(int k=1;k<=2;k++)
        for(int i=0;i<2*n;i++)
            for(int j=0;j<2*n;j++)
            {
                for(int who=0;who<nu[k].size();who++)
                {
                    int x=nu[k][who].r;
                    int y=nu[k][who].c;
                    if(valid(i-x,j-y)==1)
                        v[k][i][j].push_back({i-x,j-y});
                    if(valid(i-x,j+y)==1)
                        v[k][i][j].push_back({i-x,j+y});
                    if(valid(i+x,j-y)==1)
                        v[k][i][j].push_back({i+x,j-y});
                    if(valid(i+x,j+y)==1)
                        v[k][i][j].push_back({i+x,j+y});
                }
            }
}

void dfs(int k,int r,int c)
{
    for(auto nou:v[k][r][c])
    {
        int rn=nou.r;
        int cn=nou.c;
        if(col[k][rn][cn]==0)
        {
            col[k][rn][cn]=3-col[k][r][c];
            dfs(k,rn,cn);
        }
    }
}

int cnt[3][3];

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cin>>n>>d[1]>>d[2];
    build_nu();
    build_graf();
    for(int k=1;k<=2;k++)
        for(int i=0;i<2*n;i++)
            for(int j=0;j<2*n;j++)
            {
                if(col[k][i][j]==0)
                {
                    col[k][i][j]=1;
                    dfs(k,i,j);
                }
            }
    for(int i=0;i<2*n;i++)
        for(int j=0;j<2*n;j++)
        {
            cnt[col[1][i][j]][col[2][i][j]]++;
        }
    for(int i=1;i<=2;i++)
        for(int j=1;j<=2;j++)
        {
            if(cnt[i][j]<n*n)
                continue;
            int cur=0;
            for(int r=0;r<2*n;r++)
                for(int c=0;c<2*n;c++)
                {
                    if(col[1][r][c]==i && col[2][r][c]==j)
                    {
                        if(cur==n*n)
                            return 0;
                        cur++;
                        cout<<r<<" "<<c<<"\n";
                        if(cur==n*n)
                            return 0;
                    }
                }
            return 0;
        }
    return 0;
}
/**

**/



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

#define INF 1001001001
#define LINF 1001001001001001001
#define MOD 1000000007
#define MOD2 998244353

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

#define rep(i,n) for(int i=0,_i=(n);i<_i;++i)
#define rep1(i,a,b) for(int a_=(a),b_=(b),i=a_;i<b_;++i)
#define repr(i,n) for(int _i=(n),i=_i;i>0;--i)

#define db(x) cerr<<#x<<" = "<<x<<" ";
#define db2(x,y) cerr<<"("<<#x<<", "<<#y<<") = ("<<x<<", "<<y<<") ";
#define db3(x,y,z) cerr<<"("<<#x<<", "<<#y<<", "<<#z<<") = ("<<x<<", "<<y<<", "<<z<<") ";
#define ln cout<<endl;

#define all(a)  (a).begin(),(a).end()
#define dig(n)  to_string(n).length()

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

typedef long long ll;
typedef pair<int,int> pii;
typedef pair<pii,pii> ppii;

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

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

int main(){
    bool flag=false;
    ll ans=0,sum=0,mn=LINF;

    ll n,a[5];
    int cnt=-1;
    cin >>n;
    rep(i,5){
        cin>>a[i];
        if(chmin(mn,a[i])){
            ++cnt;
        }
    }

    //cout <<fixed<<setprecision(16)<< << endl;
    cout<<((n+mn-1)/mn)+4<<endl;
    //if(flag)cout << "Yes" <<endl;
    //else cout << "No" <<endl;
    
    return 0;
}


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

int64_t leftPs(int n, int64_t x) {
    int64_t sz = (1LL << (n + 2)) - 3;
    if (x == sz) return (1LL << (n + 1)) - 1;
    if (x == 1) return 0;
    if (x == sz / 2 + 1) return 1LL << n;
    if (x < sz / 2 + 1) return leftPs(n - 1, x - 1);
    if (x > sz / 2 + 1) return (1LL << n) + leftPs(n - 1, x - (sz / 2 + 1));
}

int main() {
    int n;
    int64_t x;
    cin >> n >> x;
    cout << leftPs(n, x) << '\n';
}


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

#define CHOOSE(a) CHOOSE2 a
#define CHOOSE2(a0, a1, a2, a3, a4, x, ...) x
#define dump_1(x1) cerr << #x1 << ": " << x1 << endl
#define dump_2(x1, x2) \
  cerr << #x1 << ": " << x1 << ", " #x2 << ": " << x2 << endl
#define dump_3(x1, x2, x3)                                                \
  cerr << #x1 << ": " << x1 << ", " #x2 << ": " << x2 << ", " #x3 << ": " \
       << x3 << endl
#define dump_4(x1, x2, x3, x4)                                            \
  cerr << #x1 << ": " << x1 << ", " #x2 << ": " << x2 << ", " #x3 << ": " \
       << x3 << ", " #x4 << ": " << x4 << endl
#define dump_5(x1, x2, x3, x4, x5)                                        \
  cerr << #x1 << ": " << x1 << ", " #x2 << ": " << x2 << ", " #x3 << ": " \
       << x3 << ", " #x4 << ": " << x4 << ", " #x5 << ": " << x5 << endl
#define dump(...) \
  CHOOSE((__VA_ARGS__, dump_5, dump_4, dump_3, dump_2, dump_1, ~))(__VA_ARGS__)
#define check(s) cerr << s << endl

#define rep(i, n) for (int i = 0; i < n; i++)
#define repr(i, n) for (int i = n; i >= 0; i--)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define all(x) (x).begin(), (x).end()
#define sz(x) ((int)(x).size())
#define unique(v) v.erase(unique(v.begin(), v.end()), v.end());
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)

using namespace std;

using ll = long long;

vector<int> dx = {0, 1, 0, -1};
vector<int> dy = {1, 0, -1, 0};

const ll LINF = 2e18;
const int INF = 1e9;

void yes() { cout << "Yes" << endl; }
void no() { cout << "No" << endl; }
void yesOrNo(bool flg) {
  if (flg)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
}

void solve(ll N, ll K, ll Q, std::vector<ll> A) {
  vector<ll> p(N, K);
  rep(i, Q) p.at(A.at(i))++;
  rep(i, N) yesOrNo(p.at(i) - Q > 0);
}

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(15);
  ll N;
  scanf("%lld", &N);
  ll K;
  scanf("%lld", &K);
  ll Q;
  scanf("%lld", &Q);
  std::vector<ll> A(Q);
  for (int i = 0; i < Q; i++) {
    scanf("%lld", &A[i]);
    A.at(i)--;
  }
  solve(N, K, Q, std::move(A));
  return 0;
}


Measured memory_bytes: 4748
// mai iss duniyaa ka sbse bada chutiyaaa huu

#include<bits/stdc++.h> 
#include <chrono> 
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp> 
#define mod 1000000007
#define mod2 998244353
#define int long long
#define endl '\n'
#define p_b push_back
#define m_p make_pair
#define fastIO ios_base::sync_with_stdio(false),cin.tie(NULL)
using namespace std;
using namespace __gnu_pbds;
using namespace std::chrono; 

template <class T> 
using _ost = tree<
		T, 
		null_type, 
		less_equal<T>, 
		rb_tree_tag, 
        tree_order_statistics_node_update>;

char alphabet[26] = {'a','b','c','d','e','f','g','h','i',
       'j','k','l','m','n','o','p','q','r','s','t','u','v',
       'w','x','y','z'};

// rectangle intersection
// x5 = max(x1, x3);
// y5 = max(y1, y3);
// x6 = min(x2, x4);
// y6 = min(y2, y4); 

// const int mx = 100005;

// char get_next(char c) {
// 	for(int i=0; i<25; i++) if(c == alphabet[i]) return alphabet[i+1];
// 	return 'a';
// }

int32_t main() {
 	fastIO;
	int tc;
	// cin >> tc;
	tc = 1;
	while(tc --) {
		int n;
		cin >> n;
		string s;
		cin >> s;
		int r = 0;
		for(int i=0; i<n; i++) r += s[i] == 'R';
		if(r == 0 || r == n) {
			cout << 0 << endl;
			return 0;
		}	
		int cnt = 0;
		for(int i=0; i<r; i++) cnt += s[i] == 'W';
		cout << cnt << endl;
 	}     
}



Measured memory_bytes: 3780
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) begin(v),end(v)
#define fi first
#define se second
template<typename A, typename B> inline bool chmax(A &a, B b) { if (a<b) { a=b; return 1; } return 0; }
template<typename A, typename B> inline bool chmin(A &a, B b) { if (a>b) { a=b; return 1; } return 0; }
using ll = long long;
using pii = pair<int, int>;
constexpr ll INF = 1ll<<30;
constexpr ll longINF = 1ll<<60;
constexpr ll MOD = 1000000007;
constexpr bool debug = 0;
//---------------------------------//

int main() {
	int N, K;
	cin >> N >> K;
	vector<int> A(N);
	REP(i, N) scanf("%d", &A[i]);
	sort(ALL(A));
	int ans = 0;
	REP(i, K) ans += A[i];
	cout << ans <<endl;
	return 0;
}


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

struct node {int parent, left, right;};

const int MAX = 10000, NIL = -1;
node T[MAX];
int n, D[MAX], H[MAX];

void setDepth(int u, int d){
    if (u == NIL) return;
    D[u] = d;
    setDepth(T[u].left, d+1);
    setDepth(T[u].right, d+1);
}

int setHeight(int u){
    int h1 = 0, h2 = 0 ;
    if (T[u].left != NIL)
        h1 = setHeight(T[u].left) + 1;
    if (T[u].right != NIL)
        h2 = setHeight(T[u].right) + 1;
    return H[u] = (h1 > h2 ? h1 : h2);
}

int getSibling(int u){
    if (T[u].parent == NIL) return NIL;
    if (T[T[u].parent].left != u && T[T[u].parent].left != NIL)
        return T[T[u].parent].left;
    if (T[T[u].parent].right != u && T[T[u].parent].right != NIL)
        return T[T[u].parent].right;
    return NIL;
}

void print(int u){
    cout << "node " << u << ": ";
    cout << "parent = " << T[u].parent;
    cout << ", sibling = " << getSibling(u);
    int deg = 0;
    if (T[u].left != NIL)
    {
        deg++;
    }
    if (T[u].right != NIL)
    {
        deg++;
    }
    cout << ", degree = " << deg;
    cout << ", depth = " << D[u];
    cout << ", height = " << H[u];

    if (T[u].parent == NIL)
    {
        cout << ", root" << endl;
    }
    else if (T[u].left == NIL && T[u].right == NIL)
    {
        cout << ", leaf" << endl;
    }
    else
    {
        cout << ", internal node" << endl;
    }
    
}

int main(){
    int v, l, r, root = 0;
    cin >> n;
    for (int i = 0; i < n; i++)
        T[i].parent = NIL;
    for (int i = 0; i < n; i++)
    {
        cin >> v >> l >> r;
        T[v].left = l;
        T[v].right = r;
        if (l != NIL)
            T[l].parent = v;
        if (r != NIL)
            T[r].parent = v;
        
    }
    for (int i = 0; i < n; i++)
    {
        if (T[i].parent == NIL)
            root = i;
    }

    setDepth(root, 0);
    setHeight(root);
    for (int i = 0; i < n; i++)
        print(i);
    
}


Measured memory_bytes: 3128
#include <stdio.h>

int main(void){
	int n,i;
	scanf("%d",&n);
	long long L[87];
	L[0] = 2;
	L[1] = 1;
	for(i=2;i<=n;i++){
		L[i]= L[i-1] + L[i-2];
	}
	printf("%lld",L[n]);
	return 0;
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
#define FOR(i,a,b)  for(int i=(a),i##formax=(b);i< i##formax;i++)
#define FORR(i,a,b) for(int i=(a),i##formin=(b);i>=i##formin;i--)
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define pcnt __builtin_popcount
#define sz(x) (int)(x).size()
#define maxs(x,y) x=max((x),(y))
#define mins(x,y) x=min((x),(y))
#define show(x) cout<<#x<<" = "<<(x)<<endl;
#define all(a) ((a).begin()),((a).end())
#define each(i,c) for(__typeof((c).begin()) i=(c).begin();i!=(c).end();i++)
#define bit(n) (1LL<<(n))
typedef long long ll;
typedef __int128_t lll;
template<class T>using V=vector<T>;
template<class T>using VV=V<V<T>>;
template<class T,class Y>using P=pair<T,Y>;
template<class T,class Y>ostream& operator<<(ostream&o,P<T,Y>&p){return o<<"("<<p.fi<<","<<p.se<<")";}
template<class T>ostream& operator<<(ostream&o,V<T>&v){for(T&t:v)o<<t<<",";return o<<endl;}
template<class T>void uniq(V<T>&v){sort(all(v));v.erase(unique(all(v)), v.end());}

lll gcd(lll a,lll b,lll&x,lll&y){if(!b){x=1;y=0;return a;}lll d=gcd(b,a%b,y,x);y-=a/b*x;return d;}
ll modInv(ll a,ll m){lll x,y;gcd(a,m,x,y);return(x%m+m)%m;}
ll modPow(lll a,lll n,ll m){lll p=1;for(;n;n>>=1,a=a*a%m)if(n&1)p=p*a%m;return p;}
//V<ll>F,R;void setF(int n,int mod){F=R=V<ll>(++n);F[0]=1;FOR(i,1,n)F[i]=F[i-1]*i%mod;R[n-1]=modInv(F[n-1],mod);FORR(i,n-1,1)R[i-1]=R[i]*i%mod;}
//ll comb(int a,int b,int m){return a<b||b<0?0:F[a]*R[b]%m*R[a-b]%m;}

const int IINF = 1e9+6;
const ll LINF = 1e18;
const int MOD = 1e9+7; //998244353;
const int N = 50;
const int M = 1<<20;
int n, m, v[N][N];
ll DP[M];
V<int> e[N];
bool dfs(int a, int p, int t, int k){
  if(a==t) return true;
  for(int b:e[a]) if(p!=b) if(dfs(b, a, t, k)) return v[a][b]|=k, v[b][a]|=k, true;
  return false;
}
void dfs2(int a, int p){
  for(int b:e[a]) if(p!=b){
    dfs2(b, a);
    FORR(i, (1<<m)-1, 0) DP[i|v[a][b]] += DP[i];
  }
}
main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  cin >> n;
  FOR(i, 0, n-1){
    int a, b;
    cin >> a >> b;
    a--; b--;
    e[a].pb(b);
    e[b].pb(a);
  }
  cin >> m;
  FOR(i, 0, m){
    int a, b;
    cin >> a >> b;
    a--; b--;
    dfs(a, -1, b, 1<<i);
  }
  DP[0] = 1;
  dfs2(0, -1);
  cout << DP[(1<<m)-1] << endl;
}

Measured memory_bytes: 8448
#include "bits/stdc++.h"

using namespace std;

typedef long long ll;
typedef vector<ll> vi;
typedef vector<vi> vvi;
typedef vector<vvi> vvvi;
typedef pair<ll, ll> pii;
typedef vector<pii> vpii;

ll INF = (1ll << 60);

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

  vi A(N);
  for (ll i = 0; i < N; i++) {
    cin >> A[i];
  }

  priority_queue<pii> pq;
  for (ll i = 0; i < N; i++) {
    pq.push({ A[i], i });
  }

  unordered_map<ll, unordered_set<ll>> m;
  for (ll i = 0; i < N; i++) {
    m[A[i]].insert(i);
  }

  ll ans = 0;

  while (pq.size()) {
    ll i = pq.top().second;
    ll j = pq.top().first;
    pq.pop();

    if (m[j].find(i) == m[j].end()) {
      continue;
    }

    m[j].erase(i);

    ll x = [&](){
      for (ll i = 1;; i *= 2) {
        if (i > j) {
          return i;
        }
      }
    }();

    if (!m[x - j].size()) continue;

    ans += 1;
    m[x - j].erase(m[x - j].begin());
  }

  cout << ans << endl;
}


Measured memory_bytes: 53228
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ

		Scanner sc = new Scanner(System.in);
		int x = sc.nextInt();
		sc.close();
		long ruka[] = new long[x+1];
		ruka[0]=2;
		ruka[1]=1;
		if(x>=2) {
			for(int i=2;i<=x;i++) {
				ruka[i]=ruka[i-1]+ruka[i-2];
			}
		}
		long y = ruka[x];
		System.out.print(y);
	}
}


Measured memory_bytes: 21844
import java.util.Arrays;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Objects;
import java.util.Scanner;
import java.util.Set;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		Set<Integer> set = new HashSet<>();
		int q = sc.nextInt();
		for (int i = 0; i < q; i++) {
			int op = sc.nextInt();
			int y = sc.nextInt();
			switch (op) {
				case 0:
					set.add(y);
					System.out.println(set.size());
					break;
				case 1:
					if (set.contains(y)) {
						System.out.println(1);
					} else {
						System.out.println(0);
					}
					break;
			}
		}
	}
}



Measured memory_bytes: 160768
#include <iostream>
#include <algorithm>
#include <vector> //動的配列
#include <string>
#include <list> //双方向リスト
#include <map> //連想配列
#include <set> //集合
#include <stack>
#include <queue>
#include <deque>
#include <cmath>
#include <bitset>
#include <numeric>



typedef long long ll;


using namespace std;

typedef pair<int, int> P;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)



ll fast_pow(ll x,ll n,ll mod){
    if (n==0) return 1;
    ll res=fast_pow(x*x %mod,n/2,mod);
    if (n&1) res=res*x%mod;
    return res;
}

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

// n次元配列の初期化。第２引数の型のサイズごとに初期化していく。
template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}

//小さい順から取り出すヒープ
//priority_queue<ll, vector<ll>, greater<ll> > pque1;




int main(){
    int h,w;
    cin>>h>>w;
    //高さh、横wの図
    char zo[h][w];
    rep(i,h){
        rep(j,w){
            cin>>zo[i][j];
            //cout<<zu[i][j];
        }//cout<<endl;
    }
    int minidx,maxidx;
    int ans1[h][w];
    fill(ans1[0],ans1[h],0);
    rep(i,h){
        minidx=-1;
        maxidx=-1;
        rep(j,w){
            if (zo[i][j]=='#') {
                for (int k=minidx;k<maxidx;k++){
                    ans1[i][k]=maxidx-minidx;
                }//cout<<minidx<<maxidx<<endl;;
                minidx=-1;
                maxidx=-1;
            }  else if (minidx==-1 && zo[i][j]=='.'){
                minidx=j;
                maxidx=j+1;
                //cout<<i<<j<<endl;
            } else if (zo[i][j]=='.'){
                maxidx++;
            }
            if (j==w-1 && zo[i][j]=='.'){
                for (int k=minidx;k<=j;k++){
                    ans1[i][k]=maxidx-minidx;
                }//cout<<minidx<<maxidx<<endl;
            }
        }
    }
    int ans2[h][w];
    fill(ans2[0],ans2[h],0);
    rep(i,w){
        minidx=-1;
        maxidx=-1;
        rep(j,h){
            if (zo[j][i]=='#') {
                for (int k=minidx;k<maxidx;k++){
                    ans2[k][i]=maxidx-minidx;
                }//cout<<minidx<<maxidx<<endl;;
                minidx=-1;
                maxidx=-1;
            }  else if (minidx==-1 && zo[j][i]=='.'){
                minidx=j;
                maxidx=j+1;
                //cout<<i<<j<<endl;
            } else if (zo[j][i]=='.'){
                maxidx++;
            }
            if (j==h-1 && zo[j][i]=='.'){
                for (int k=minidx;k<=j;k++){
                    ans2[k][i]=maxidx-minidx;
                }//cout<<minidx<<maxidx<<endl;
            }
        }
    }
    int ans=0;
    rep(i,h){
        rep(j,w){
            ans=max(ans,ans1[i][j]+ans2[i][j]-1);
            //cout<<zu[i][j];
        }
    }
    cout<<ans;
    return 0;
    rep(i,h){
        rep(j,w){
            cout<<ans2[i][j];
            //cout<<zu[i][j];
        }cout<<endl;
    }
    
}

Measured memory_bytes: 35456
#include<bits/stdc++.h>
using namespace std;
int main(){
    int n,q;
    cin>>n>>q;
    int a[n-1],b[n-1],x[q],p[q];
    int cnt[n]={};
    vector<vector<int>>pas(n);
    for(int i=0;i<n-1;i++){
        cin>>a[i]>>b[i];
        pas[a[i]-1].push_back(b[i]-1);
        pas[b[i]-1].push_back(a[i]-1);
    }
    for(int i=0;i<q;i++){
        cin>>p[i]>>x[i];
        cnt[p[i]-1]+=x[i];
    }
    stack<int>s;
    s.push(0);
    bool seen[n]={};
    seen[0]=true;
    while(s.size()){
        int t=s.top();
        s.pop();
        for(int i=0;i<pas[t].size();i++){
            if(seen[pas[t][i]]==false){
                seen[pas[t][i]]=true;
                s.push(pas[t][i]);
                cnt[pas[t][i]]+=cnt[t];
                
            }
        }
    }
    for(int i=0;i<n;i++)cout<<cnt[i]<<endl;
    return 0;
}

Measured memory_bytes: 18804
S = input()
alphabet = [[-1] for a in range(26)]
for n,c in enumerate(S):
    s = ord(c) - 97
    alphabet[s].append(n)

ans = float("inf")
for A in alphabet:
    A.append(len(S))
    cur = max([abs(A[l] - A[l+1]) for l in range(len(A)-1)])
    ans = min(cur,ans)
print(max(ans -1 , 0))

Measured memory_bytes: 38384
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i,n) for(ll i=0;i<ll(n);i++)
int main() {
    ll n;
    cin >> n;
    ll ans = 1;
    ll p = 1;
    while (n > 1) {
        p *= 2;
        ans += p;
        n /= 2;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3620
s = input()
t = input()
ans = set()
for i in range(len(s)-len(t)+1):
  cur = s[:i].replace("?", "a")
  for j in range(len(t)):
    if s[i+j]=="?" or s[i+j]==t[j]:
      cur += t[j]
    else:
      break
  cur += s[i+j+1:].replace("?", "a")
  if len(cur)==len(s):
    ans.add(cur)

if len(ans):
  print(sorted(ans)[0])
else:
  print("UNRESTORABLE")

Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
int keta(int number){
   int result=0;
   while(number>0){
      result+=number%10;
      number/=10;
   }
   return result;
}
int main(void){
   int N,A,B;
   cin>>N>>A>>B;
   int ans=0;
   for(int i=1;i<=N;i++){
      if(A<=keta(i)&&keta(i)<=B){
         ans+=i;
      }
   }
   cout<<ans<<endl;
   return 0;
}



Measured memory_bytes: 256
Time = []
Time_Zero = []

for i in range(5):
    A = int(input())
    ra = A%10
    qa = A//10
    if ra == 0:
      Time_Zero.append([ra,qa,A])
    else:
      Time.append([ra,qa,A])

Time.sort(reverse=True)

ans = 0
for r,q,A in Time_Zero:
  ans += 10*q

for r,q,A in Time:
  ans += 10*(q+1)

if len(Time) > 0:
  ans += Time[-1][2] - 10*(Time[-1][1]+1)

print(ans)

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

void fnInput(vector<int>& rvnOrder)
{
  int nOrderSiz;
  cin >> nOrderSiz;
  rvnOrder.resize(nOrderSiz + 1);

  for (int n = 1; n < rvnOrder.size(); n++)
  {
    int nOrder;
    cin >> nOrder;
    rvnOrder[nOrder] = n;
  }
}

int fnOrderCheck(const vector<int>& cnrvnOrder)
{
  for (int nOrder : cnrvnOrder)
    if (nOrder) cout << nOrder << " ";

  cout << endl;
}

int main()
{
  vector<int> vnOrder;

  fnInput(vnOrder);
  fnOrderCheck(vnOrder);

  return 0;
}

Measured memory_bytes: 1152
#include <cstdio>

using namespace std;

int main() {
    int n;
    scanf("%d", &n);
    int ans = 0;
    int tmp, tmp_before = 0;
    while(n > 0) {
        tmp = n % 10;
        if (tmp == tmp_before) ans++;
        else ans = 0;
        if (ans + 1>= 3) {
            printf("Yes\n");
            return 0;
        }
        tmp_before = tmp;
        n /= 10;
    }
    printf("No\n");
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
using namespace std;
const int mod = 1000000007;
int n, m, a[100009];
int main() {
	scanf("%d%d", &n, &m);
	for(int i = 0; i < n; i++) scanf("%d", &a[i]);
	sort(a, a + n);
	int ret = 1;
	for(int i = 1; i < n; i++) {
		int ptr = lower_bound(a, a + n, a[i] - m) - a;
		ret = 1LL * ret * (i - ptr + 1) % mod;
	}
	printf("%d\n", ret);
	return 0;
}

Measured memory_bytes: 3596
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
using vi = vector<int>;
using vl = vector<ll>;
#define rep(i, n) for(ll i = 0;i < n;i++)
#define all(i) i.begin(), i.end()
template<class T, class U> bool cmax(T& a, U b) { if (a<b) {a = b; return true;} else return false; }
template<class T, class U> bool cmin(T& a, U b) { if (a>b) {a = b; return true;} else return false; }

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

  ll a, b;
  cin >> a >> b;
  ll g =  __gcd(a, b);
  cerr << g << endl;

  ll ans = 1;
  for (ll i = 2; i*i < g; i++) {
    if (g%i == 0) {
      ans++;
      while (g%i == 0) {
        g /= i;
      }
    }
  }
  if (g != 1) ans++;

  cout << ans << endl;
}


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

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

#define pb push_back
#define eb emplace_back
#define mp make_pair
#define fi first
#define se second
#define rep(i,n) rep2(i,0,n)
#define rep2(i,m,n) for(int i=m;i<(n);i++)
#define ALL(c) (c).begin(),(c).end()

int x, y;
int ret = 1 << 30;

int main() {
	cin >> x >> y;

	rep(i, 2) {
		rep(j, 2) {
			if (x <= y) {
				ret = min(ret, y - x + i + j);
			}
			y = -y;
		}
		x = -x;
	}

	cout << ret << endl;

	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
 
int main(){
    int n;
    cin >> n;
    vector<int> x(n);

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

    int mi = 1000000000;
    sort(x.begin(), x.end());

    for(int i = 1; i <= x[n-1]; ++i){
        int sum = 0;
        for(int j = 0; j < n; ++j){
            sum += pow(x[j]-i, 2);
        }
        mi = min(sum, mi);
    }

    cout << mi << endl;

}

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

inline void Boost() {
	ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
}

int main() {
	Boost();

	int x, y; cin >> x >> y;

	cout << (x + (y / 2)) << "\n";

	return 0;
}

Measured memory_bytes: 256
H,W,K = map(int,input().split())
MOD = 10**9+7

if W == 1:
  print(1)
  exit()

possible = []
for i in range(1<<(W-1)):
  b = bin(i)[2:]
  flag = 1
  for j in range(len(b)-1):
    if b[j] == b[j+1] == "1":
      flag = 0
  if flag:
    possible.append(int(b,2))

def amida(b):
  ret = [i for i in range(W)]
  for i in range(W-1):
    if b>>i & 1:
      ret[i],ret[i+1] = ret[i+1],ret[i]
  return ret

ans = [0 for i in range(W)]
ans[0] = 1

for _ in range(H):
  new_ans = [0 for i in range(W)]
  for b in possible:
    for i in range(W):
      new_ans[i] = (new_ans[i] + ans[amida(b)[i]])%MOD
  ans = new_ans
  
print(ans[K-1])

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

using pii = pair<int,int>;
using ll = long long;
#define rep(i, j) for(int i=0; i < (int)(j); i++)
#define repeat(i, j, k) for(int i = (j); i < (int)(k); i++)
#define all(v) v.begin(),v.end()
#define debug(x) cerr << #x << " : " << x << endl

template<class T> bool set_min(T &a, const T &b) { return a > b  ? a = b, true : false; }
template<class T> bool set_max(T &a, const T &b) { return a < b  ? a = b, true : false; }
// vector
template<class T> istream& operator >> (istream &is , vector<T> &v) { for(T &a : v) is >> a; return is; }
template<class T> ostream& operator << (ostream &os , const vector<T> &v) { for(const T &t : v) os << "\t" << t; return os << endl; }
// pair
template<class T, class U> ostream& operator << (ostream &os , const pair<T, U> &v) { return os << "<" << v.first << ", " << v.second << ">"; }

const int INF = 1 << 30;
const ll INFL = 1LL << 60;




int main() {
    int W, H, x, y; cin >> W >> H >> x >> y;
    W *= 2;
    H *= 2;
    x *= 2;
    y *= 2;
    cout << (double) W * H / 8.0 << " " << (x == W / 2 and y == H / 2 ? 1 : 0) << endl;
    return 0;
}


Measured memory_bytes: 256
package main
import "fmt"

var( x1,y1,x2,y2 int)

func main(){
  fmt.Scan(&x1,&y1,&x2,&y2)
	y_gap:= y2 - y1
	x_gap := x2- x1
	s := ""
	for i:=0;i < y_gap;i ++{
		s += "U"
	}
	for i:=0;i < x_gap;i ++{
		s += "R"
	}
	for i:=0;i < y_gap;i ++{
		s += "D"
	}
	for i:=0;i < x_gap;i ++{
		s += "L"
	}
	s +="L"
	for i:=0;i < y_gap + 1;i ++{
		s += "U"
	}
	for i:=0;i < x_gap + 1;i ++{
		s += "R"
	}
	s += "DR"
	for i:=0;i < y_gap + 1;i ++{
		s += "D"
	}
	for i:=0;i < x_gap + 1;i ++{
		s += "L"
	}
	s += "U"



	fmt.Println(s)
  
}

Measured memory_bytes: 6656
#include <bits/stdc++.h> 
 
#define INF (1<<31) - 1 //INT_MAX/2
#define MOD 1000000007
#define PI  acos(-1)
 
using ll  = long long;
using ull = unsigned long long;

int main(int argc, char *argv[])
{
    int N;
    std::cin >> N;

    std::vector<int> a(N);
    for (int i = 0; i < N; i++) {
        std::cin >> a[i];
    }

    int bucket[100000];
    for (int i = 0; i < 100000; i++) {
        bucket[i] = 0;
    }
    for (int i = 0; i < N; i++) {
        bucket[a[i]]++;
    }

    int max = 0;
    for (int X = -1; X <= 100001; X++) {
        int count = 0;
        if (X == -1) {
            count = bucket[0];
        } else if (X == 0) {
            count = bucket[0] + bucket[1];
        } else if (X == 100000) {
            count = bucket[99998] + bucket[99999];
        } else if (X == 100001) {
            count = bucket[99999];
        } else {
            count = bucket[X-1] + bucket[X] + bucket[X+1];
        }
        if (max < count) {
            max = count;
        }
    }

    std::cout << max << std::endl;
    return 0;
}

Measured memory_bytes: 1024
#include <iostream>
#include <stdio.h>
#include <cctype>
#include <cstring>
using namespace std;

int main()
{
	int n;
	int p1=0;
	int p2=0;
	string name1;
	string name2;
	
	cin >> n;
	for(int i=0; i<n; i++){
		cin >> name1 >> name2;
		if(name1 > name2)
			p1 += 3;
		else if(name1 < name2)
			p2 += 3;
		else{
			p1++;
			p2++;
		}
	}
	
	printf("%d %d\n", p1, p2);
	
	return 0;
}


Measured memory_bytes: 3292
#include<iostream>
#include<cstdlib>
#include<cstring>
#include<climits>
#include<vector>
#include<list>
#include<functional>
#include<algorithm>
#include<string>
#include<cmath>
#include<complex>
#include<set>
#include<map>
#include<stack>
#include<queue>
#include<deque>
#include<tuple>
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n) for(int i=0;i<(n);i++)
using namespace std;
typedef long long ll;
typedef pair<int, int> P;

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

	string s;
	cin >> s;
	cout << s[0] << s.size() - 2 << s[s.size() - 1] << "\n";

	return 0;
}

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

int main()
{
    int N,min=INT_MAX,swap=0;
    cin >> N;
    int P[N];
    for(int i=0;i<N;i++) {
        cin >> P[i];
    }
    for(int i=0;i<N;i++) {
        if(P[i]<min) {
            min = P[i];
            swap += 1;
        }
    }
    cout << swap << endl;
    return 0;
}

Measured memory_bytes: 1024
#include <iostream>
#include <numeric>
#include <math.h>
#include <algorithm>
#include <float.h>
#include <limits>
#include <vector> 
#include <string.h>
#include <iomanip>

#define rep(i,a,n) for(ll int (i) = (a);(i) < (n);(i)++)
#define urep(i,a,n) for(ll int (i) = (a);(i) > (n);(i)--)
#define MOD 1000000007
#define ll long long
#define asort(a) sort(a.begin(),a.end());

using namespace::std;

int jo(ll int jxo, ll int jyo){//累乗
	ll int jhogeo = 1;
	rep(jinto,0,jyo) jhogeo=jhogeo*jxo;
	return jhogeo;
}
char tobig(char toxbig){//char大文字化
  return (toxbig-0x20);
}
char tolow(char toxlow){//char小文字化
  return (toxlow+0x20);
}
int ctoi(char cctoi){//char->int
  if('0' <= cctoi && cctoi <= '9') return (cctoi-'0');
  return -1;
}
int gcd(int gcad, int gcbd) {//最大公約数
  if(gcad < gcbd) return gcd(gcbd, gcad);
  int gcrd;
  while ((gcrd=gcad%gcbd)) {
    gcad = gcbd;
    gcbd = gcrd;
  }
  return gcbd;
}
int lcm(int lcam, int lcbm){//最小公倍数
 return (lcam*lcbm)/gcd(lcam,lcbm);
}


int main(){
  int n;
  cin>>n;
  vector<double> a(n);
  rep(i,0,n) cin>>a[i];
  asort(a);
  double ans=a[0];
  rep(i,1,n){
    ans=(ans+a[i])/2;
  }
  cout<<ans;

}

// int *p = new int[N];

//  vector<int> 変数名(要素数);
//  sort(変数名.begin(),変数名.end());//昇順ソート

// vector<vector<int>> 変数名(左の個数, vector<int>(右の個数));

//


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define int long long
const int m=1e9+7;
map<int,int>a;
inline int read(){
   int s=0,w=1;
   char ch=getchar();
   while(ch<='0'||ch>'9'){if(ch=='-')w=-1;ch=getchar();}
   while(ch>='0'&&ch<='9') s=s*10+ch-'0',ch=getchar();
   return s*w;
}
inline int sum(int x)
{
	if(a[x]!=0)
	   return a[x];
	else 
	   return a[x]=(sum(x/2)+sum((x-1)/2)+sum((x-2)/2))%m;
}
signed main()
{
	a[0]=1;
	a[1]=2;
	int n;
	n=read();
	int s=sum(n);
	cout<<s;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define fol(i,n) for(int i=0;i<n;i++)
#define pb push_back
typedef long long ll;
typedef pair<int,int> P;
typedef vector<P> vip;

int main() {
  int a,b;cin >> a >> b;
  cout << a * b << endl;
  return 0;
}


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

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  string S; cin>>S;
  vector<char> s(S.size());
  rep(i,S.size()) s.at(i)=S.at(i);
  int q; cin>>q;
  int time=0;
  rep(i,q){
    int t; cin>>t;
    if(t==1) time++;
    if(t==2) {
      int f; cin>>f;
      char c; cin>>c;
      if(time%2==0){
        if(f==1) s.insert(s.begin(),c);
        if(f==2) s.insert(s.end(),c);
      }else{
        if(f==2) s.insert(s.begin(),c);
        if(f==1) s.insert(s.end(),c);
      }
    }
  }
  if(time%2==1) reverse(s.begin(),s.end());
  rep(i,s.size()) cout<<s.at(i);
}

Measured memory_bytes: 1036
#include <bits/stdc++.h>
#include <iostream>
#include <string>
#define INF 1e18
#define int long long
#define all(a) (a).begin(), (a).end()
using namespace std;
 
main(void){
  string tap; cin >> tap;
  int len = tap.size();
  char r='R',u='U',d='D',l='L';
  
  for (int i = 0; i < len; i++) {
    if (i % 2 == 0){
      if (tap.at(i)!=r & tap.at(i)!=u & tap.at(i)!=d){
        cout << "No" <<endl;
        return 0;
      }
    }
    
    else {
      if (tap.at(i)!=l & tap.at(i)!=u & tap.at(i)!=d){
        cout << "No" <<endl;
        return 0;
      }
    } 
  }
  
  cout << "Yes" <<endl;
  return 0;
}

Measured memory_bytes: 256
T = list(map(int,input().split()))
n = int(input())*4
q_s = 1
h_s = 2
s_s = 4
d_s = 8

L = []
temp = 1
for i in range(4):
    s = temp
    v = T[i] / s
    L.append([T[i],s,v])
    temp *= 2

L.sort(key=lambda x: x[2])

ans = 0
for l in L:
    ans += (n // l[1])*l[0]
    n = n % l[1]

print(ans)

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

int N, M;
int cn; //回答
vector<int> X;
vector<int> Y;
vector<int> Z;

/*Zとかはっきり言って関係がない？A_i+A_jの和は偶数か奇数である。*/
/*つまり、Zが偶数ならA_i+A_jも偶数、Zが奇数ならA_i+A_jも奇数*/
/*しかしAは1か2しかないので、A_iとA_jの一方が決まってしまえばもう一方も決定*/
/*よってグラフを作り、隣接するノード(A_i+A_jの条件があるならば隣接するとする)*/


struct UnionFind {
  vector<int> par;
  
  UnionFind(int n){ par.resize(n+1, -1); }
  void init(int n){ par.assign(n+1, -1); }

  int root(int x){
    if(par[x] < 0) return x;
    else return (par[x] = root(par[x]));  //根ノードを記録
  }

  bool is_same(int x, int y){
    return (root(x) == root(y));
  }

  bool merge(int x, int y){
    x = root(x); y = root(y);  //xとyの根を取得
    if(x == y) return false;  //結合の必要なし
    if(par[x] < par[y]) swap(x, y);   //基本的にはxの方を大きい木とする
    par[x] += par[y]; //サイズの合計(結合するので)
    par[y] = x; //par[y]はxを根とするようになる
    return true;
  }

  int size(int x){
    return -par[root(x)]; //サイズは負の値で記録されているので...
  }

};


int main(){
  scanf("%d %d", &N, &M);
  cn = N;

  int tx, ty, tz;
  for(int i = 0; i < M; i++){
    scanf("%d %d %d", &tx, &ty, &tz);
    X.push_back(tx); Y.push_back(ty); Z.push_back(tz);
  }

  UnionFind uf(N);
  uf.init(N);
  
  for(int i = 0; i < M; i++){
    if(uf.merge(X[i], Y[i])) cn--;
  }

  cout << cn << endl; 
  return 0;
}
    





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

class Program
{
    public static void Main(string[] args)
    {
        string s = Console.ReadLine();


        int a = s.Length;
        int cnt = 0;

        for (int i = 0; i < a;i++){
            if(s[i] == 'o'){
                cnt = cnt + 1; 
            }
        }

        int b = 15 - a;
        string ans = string.Empty;
        int c = b + cnt;
 
        if(c >= 8){
            ans = "YES";
        }else{
            ans = "NO";
        }

        Console.WriteLine(ans);
        //Console.WriteLine(ans);


    }

}


Measured memory_bytes: 13140