akhauriyash/Code-Regression huggingface dataset:
#include <algorithm>
#include <cmath>
#include <complex>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <vector>
#include <functional>
#include <cstring>
#include <regex>
#include <random>
#include <cassert>
using namespace std;

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repr(i, s, n) for (int i = (s); i < (int)(n); i++)
#define revrep(i, n) for (int i = (n) - 1; i >= 0; i--)
#define revrepr(i, s, n) for (int i = (n) - 1; i >= s; i--)
#define debug(x) cerr << #x << ": " << x << "\n"

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

const long long MOD = 1e9+7;

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

template<class T>
istream& operator >>(istream &is, vector<T> &v) {
    for (int i = 0; i < (int)v.size(); i++) cin >> v.at(i);
    return is;
}

template<class T, class U>
ostream& operator <<(ostream &os, pair<T, U> p) {
    cout << '(' << p.first << ", " << p.second << ')';
    return os;
}

template<class T>
void print(const vector<T> &v, const string &delimiter) { rep(i, v.size()) cout << (0 < i ? delimiter : "") << v.at(i); cout << endl; }

template<class T>
void print(const vector<vector<T>> &vv, const string &delimiter) { for (const auto &v: vv) print(v, delimiter); }

int main() {
    int n;
    ll k;
    cin >> n >> k;
    vector<ll> a(n);
    rep(i, n) cin >> a[i];
    
    const int MAX_LOG_NK = 61;
    const int MAX_A = 200000;
    vector<vector<ll>> next(n, vector<ll>(MAX_LOG_NK));
    vector<ll> last(MAX_A + 1, -1);
    revrep(i, n) {
        if (last[a[i]] == -1) next[i][0] = -1;
        else next[i][0] = last[a[i]] - i + 1;
        last[a[i]] = i;
    }
    rep(i, n) if (next[i][0] == -1) next[i][0] = last[a[i]] + n - i + 1;
    
    rep(x, MAX_LOG_NK - 1) {
        rep(i, n) {
            if (next[i][x] == -1 || next[(i + next[i][x]) % n][x] == -1) continue;
            
            if (n * k < next[i][x] + next[(i + next[i][x]) % n][x]) next[i][x + 1] = -1;
            else next[i][x + 1] = next[i][x] + next[(i + next[i][x]) % n][x];
        }
    }
    
    ll now_idx = 0;
    bool update = true;
    while (update) {
        ll max_idx = 0;
        update = false;
        rep(x, MAX_LOG_NK) {
            if (next[now_idx % n][x] == -1) continue;
            
            if (now_idx + next[now_idx % n][x] < n * k) chmax(max_idx, now_idx + next[now_idx % n][x]);
        }
        if (chmax(now_idx, max_idx)) update = true;
    }
    
    deque<int> que;
    vector<bool> stacked(MAX_A + 1);
    repr(i, now_idx % n, n) {
        if (stacked[a[i]]) {
            while (que.back() != a[i]) {
                stacked[que.back()] = false;
                que.pop_back();
            }

            assert(que.back() == a[i]);
            que.pop_back();
            stacked[a[i]] = false;
        }
        else {
            que.push_back(a[i]);
            stacked[a[i]] = true;
        }
    }

    for (int ai: que) cout << ai << " ";
    cout << endl;
}

Measured memory_bytes: 107008
#include<bits/stdc++.h>
using namespace std;
typedef pair<int,int> ii;
const int maxn=100000+10;

int n;
vector<ii> a[maxn];
int color[maxn]={0};
int deg[maxn];
int mark[maxn]={0};
int c[maxn],nn;
int res[maxn],kq;
int q[maxn],front,rear;

int main(){
//    freopen("input.txt","r",stdin);
    cin>>n;
    for(int i=1;i<=n-1;i++){
        int u,v;
        cin>>u>>v;
        a[u].push_back(ii(v,i));
        a[v].push_back(ii(u,i));
        deg[u]++;deg[v]++;
    }
    //--------
    int r=1;
    for(int i=2;i<=n;i++)
        if (deg[i]>deg[r]) r=i;
    kq=deg[r];
//    cout<<"R= "<<r<<endl;
    front=rear=1;q[1]=r;mark[r]=1;
    while(front<=rear){
        int u=q[front];front++;
        nn=0;
        for(int i=1;i<=deg[u];i++)
            if (i!=color[u]){
                nn++;c[nn]=i;
            }
        int j=1;
        for(int i=0;i<a[u].size();i++){
            int v=a[u][i].first;
            if (mark[v]==0){
                mark[v]=1;color[v]=c[j];res[a[u][i].second]=c[j];j++;
                rear++;q[rear]=v;
            }
        }
    }
//    for(int i=1;i<=n;i++) cout<<color[i]<<" ";cout<<endl;
    //--------
    cout<<kq<<endl;
    for(int i=1;i<=n-1;i++) cout<<res[i]<<endl;
}


Measured memory_bytes: 8448
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <sstream>
#include <queue>
#include <deque>
#include <bitset>
#include <iterator>
#include <list>
#include <stack>
#include <map>
#include <set>
#include <functional>
#include <numeric>
#include <utility>
#include <limits>
#include <ctime>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cassert>
#include <unordered_map>
#include <unordered_set>

using namespace std;

typedef long long lli;
typedef long double ld;
typedef pair<lli, lli > plli;
typedef vector<lli> vlli;
typedef vector<plli > vplli;

#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);
#define lcm(a, b) ((a * b) / gcd(a, b))
#define sqr(x) (x)*(x)
#define all(a) a.begin(),a.end()
#define UN(v) sort(all(v)), v.resize(unique(all(v))-v.begin())

#define endl '\n'

const long long INF = 100000000000000000;
const long long MOD = 1000000007;
const long long MAXN = 100005;
const double PI = acos(-1);

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

lli gcd(lli a , lli b) {
    if(b == 0) return a;
    a %= b;
    return gcd(b,a);
}

void solve() {
    int n, m;
    cin >> n >> m;
    int a[n];
    memset(a, -1, sizeof(a));

    for (int i = 0; i < m; i++) {
        int s, c;
        cin >> s >> c;
        if (a[s - 1] == c or a[s - 1] == -1) {
            a[s - 1] = c;
        } else if (a[s - 1] != c){
            cout << -1 << endl;
            return;
        }
    }

    if ((n == 1 and a[0] == 0) or (n == 1 and m == 0)) {
        cout << 0;
        return;
    }

    if (n > 1) {
        if (a[0] == 0 or (a[0] == 0 and a[1] == 0) or (a[0] == 0 and a[1] == 0
                                                       and a[2] == 0)) {
            cout << -1 << endl;
            return;
        }
    }

    for (int i = 0; i < n; i++) {
        if (i == 0 and a[i] == -1) {
            a[i] = 1;
        } else if (a[i] == -1) {
            a[i] = 0;
        }
    }

    for (auto i : a) {
        cout << i;
    }
}

int main()
{
    IOS;
    int t = 1;
    //cin >> t;
    for (int i = 1; i <= t; i++) {
        //cout << "Case " << i << ": ";
        solve();
    }
    return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <cstring>
#include <cmath>
#include <utility>
#include <iostream>
#include <functional>
#include <bitset>
#include <algorithm>
#include <vector>
#include <forward_list>
#include <set>
#include <map>
#include <queue>
#include <deque>
#include <stack>
#include <tuple>
#include <numeric>
#define rep(i, s, g) for ((i) = (s); (i) < (g); ++(i))
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
const ll MOD = 1e9 + 7;
const ll INF = (1ll << 60);

int main(void)
{
    int h, w, k;
    cin >> h >> w >> k;

    vector<vector<char>> v(h, vector<char>(w, 0));

    for (int i = 0; i < h; i++)
    {
        for (int j = 0; j < w; j++)
        {
            cin >> v[i][j];
        }
    }

    ll ans = 0;

    for (int i = 0; i < (1 << h); i++)
    {
        for (int j = 0; j < (1 << w); j++)
        {
            int black = 0;
            for (int l = 0; l < h; l++)
            {
                for (int m = 0; m < w; m++)
                {
                    if (i & (1 << l) && j & (1 << m))
                    {
                        if (v[l][m] == '#')
                        {
                            black++;
                        }
                    }
                }
            }

            if (black == k)
            {
                ans++;
            }
        }
    }

    cout << ans << endl;
}


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

int main()
{
    int a;
    string s;
    cin>>a;
    s=to_string(a);
    if(s[0] == s[1])
    {
        if(s[1] == s[2])
        {
            cout<<"Yes"<<endl;
        }
        else
        {
            cout<<"No"<<endl;
        }
    }
    else if(s[1] == s[2])
    {
        if(s[2] == s[3])
        {
            cout<<"Yes"<<endl;
        }
        else
        {
            cout<<"No"<<endl;
        }
    }
    else
    {
        cout<<"No"<<endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include<iostream>

using namespace std;


int main()
{
	int n, q, S[10000], T[500];
	cin >> n;
	for (int i = 0; i < n; i++)
		cin >> S[i];
	cin >> q;
	for (int i = 0; i < q; i++)
		cin >> T[i];
	int c = 0, k;
	for (int i = 0; i < q; i++)
	{
		S[n] = T[i];
		int j = 0;
		while (S[j] != S[n])
			j++;
		if (j < n)
			c++;
	}
	cout << c << endl;
	return 0;
}



Measured memory_bytes: 3120
n, k = map(int, input().split())
x = list(map(int, input().split()))

ans = float("inf")
for i in range(n-k+1):
  if x[i] * x[i+k-1] >= 0:
    t = max(abs(x[i]), abs(x[i+k-1]))
  else:
    t = x[i+k-1] - x[i] + min(abs(x[i]), abs(x[i+k-1]))
  ans = min(ans, t)
print(ans)

Measured memory_bytes: 14224
#include <iostream>
using namespace std;
#define NIL -1

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

node tree[100001];

int getDepth(int n) {
  int d = 0;
  while (tree[n].parent != NIL) {
    d++;
    n = tree[n].parent;
  }
  return d;
}

int main() {
  int n, id, k, tmp;
  int d[100001];
  cin >> n;
  for (int i = 0; i < n; i++) {
    tree[i].parent = tree[i].left = tree[i].right = NIL;
  }
  for (int i = 0; i < n; i++) {
    cin >> id >> k;
    if (k > 0) {
      int ch;
      for (int j = 0; j < k; j++) {
        cin >> ch;
        if (j == 0) {
          tree[id].left = ch;
        } else {
          tree[tmp].right = ch;
        }
        tree[ch].parent = id;
        tmp = ch;
      }
    }
  }

  for (int i = 0; i < n; i++) {
    d[i] = getDepth(i);
    cout << "node " << i << ": ";
    cout << "parent = " << tree[i].parent << ", ";
    cout << "depth = " << d[i] << ", ";
    if (tree[i].parent == NIL) {
      cout << "root";
    } else if (tree[i].left == NIL) {
      cout << "leaf";
    } else {
      cout << "internal node";
    }
    cout << ", [";
    if (tree[i].left != NIL) {
      int c = tree[i].left;
      cout << c;
      c = tree[c].right;
      while (c != NIL) {
        cout << ", " << c;
        c = tree[c].right;
      }
    }
    cout << "]" << endl;
  }
}


Measured memory_bytes: 4188
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <map>
#include <set>
#include <cmath>
#include <random>

using namespace std;



int main()
{
	int N, K, Q;
	map<int, int> map_c;

	cin >> N >> K >> Q;

	int a;
	for(int ai = 0; ai < Q; ai++){
		cin >> a;
		map_c[a]++;
	}


	for(int ni = 0; ni < N; ni++){
		if(K - (Q - map_c[ni+1] ) > 0 ) printf("Yes\n");
		else printf("No\n");
	}


	return 0;
}



Measured memory_bytes: 5376
#include <iostream>
#include <algorithm>
#include <bitset>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#include <complex>
#include <string.h>
#include <numeric>
using namespace std;

#define int long long
#define reps(i,s,n) for(int (i)=(s);(i)<(n);++(i))
#define rep(i,n) reps(i,0,n)
#define rept(i,n) rep(i,(n)+1)
#define repst(i,s,n) reps(i,s,(n)+1)
#define reprt(i,n,t) for(int (i)=(n);(i)>=(t);--(i))
#define repr(i,n) reprt(i,n,0)
#define each(i,v) for(auto &(i):(v))
#define eachr(i,v) for(auto &(i)=(v).rbegin();(i)!=(v).rend();(i)++)
#define all(c) (c).begin(),(c).end()
#define rall(c) (c).rbegin(),(c).rend()
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define tmax(x,y,z) max(x,max(y,z))
#define tmin(x,y,z) min(x,min(y,z))
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)
#define ln '\n'
#define bln(i,n) (((i)==(n)-1)?'\n':' ')
#define dbg(x) cout<<#x" = "<<(x)<<ln<<flush
#define dbga(x,n) {cout<<#x" : ";for(int (i)=0;i<(n);++i){cout<<((x)[i])<<(i==((n)-1)?'\n':' ')<<flush;}}
#define zero(a) memset(a,0,sizeof(a))
#define unq(a) sort(all(a)),a.erase(unique(all(a)),a.end())

//typedef complex<double> P;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<string> vst;
typedef vector<pii> vpii;
typedef vector<pll> vpll;
typedef vector<vector<int> > mat;

const ll inf = (ll)1e9+10;
const ll linf = (ll)1e18+10;
const ll mod = (ll)(1e9+7);
const int dx[] = {0, 1, 0, -1};
const int dy[] = {1, 0, -1, 0};
const int ddx[] = {0, 1, 1, 1, 0, -1, -1, -1};
const int ddy[] = {1, 1, 0, -1, -1, -1, 0, 1};
const double eps = 1e-10;

ll mop(ll a,ll b,ll m=mod) {ll r=1;a%=m;for(;b;b>>=1){if(b&1)r=r*a%m;a=a*a%m;}return r;}
ll gcd(ll a,ll b) {return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b) {return a/gcd(a,b)*b;}
bool ool(int x,int y,int h,int w) {return((x<0)||(h<=x)||(y<0)||(w<=y));}
bool deq(double a,double b) {return abs(a-b)<eps;}

struct oreno_initializer {
	oreno_initializer() {
		cin.tie(0);
		ios::sync_with_stdio(0);
	}
} oreno_initializer;



int n, a[200200], t[33], res;
vector<int> b;
map<int,int> m;

signed main() {
	rep(i,31) t[i] = 1<<i;
	cin >> n;
	rep(i,n) {
		cin >> a[i];
		b.push_back(a[i]);
		m[a[i]]++;
	}
	unq(b);
	sort(b.rbegin(), b.rend());
	each(i,b) {
		int p = 0;
		rep(j,31) if (i<t[j]) {
			p = t[j] - i;
			break;
		}
		if (i==p) {
			int pp = m[i];
			res += pp/2;
		} else {
			int pp = min(m[i], m[p]);
			m[i] -= pp, m[p] -= pp, res += pp;
		}
	}
	cout << res << endl;
}

Measured memory_bytes: 28400
import collections
N, Q = map(int, input().split())
g = [set() for i in range(N)]

for i in range(N-1):
    a, b = map(int, input().split())
    a -= 1
    b -= 1
    g[a].add(b)
    g[b].add(a)

parent = [-1 for i in range(N)]
parent[0] = 0

q = collections.deque()
q.append(0)

point = [0 for i in range(N)]

for i in range(Q):
    p, x = map(int, input().split())
    p -= 1
    point[p] += x

while(q):
    x = q.popleft()
    for y in g[x]:
        if parent[y] == -1:
            q.append(y)
            parent[y] = x
            point[y] += point[x]

print(" ".join(map(str, point)))


Measured memory_bytes: 92540
#include<deque>
#include<queue>
#include<vector>
#include<algorithm>
#include<iostream>
#include<set>
#include<cmath>
#include<tuple>
#include<string>
#include<chrono>
#include<functional>
#include<iterator>
#include<random>
#include<unordered_set>
#include<array>
#include<map>
#include<iomanip>
#include<assert.h>
#include<bitset>
#include<stack>
#include<memory>
using namespace std;
typedef long long int llint;
typedef long double lldo;
#define mp make_pair
#define mt make_tuple
#define pub push_back
#define puf push_front
#define pob pop_back
#define pof pop_front
#define fir first
#define sec second
#define res resize
#define ins insert
#define era erase
/*
cout<<fixed<<setprecision(20);
cin.tie(0);
ios::sync_with_stdio(false);
*/
const llint mod=1000000007;
const llint big=2.19e18+1;
const long double pai=3.141592653589793238462643383279502884197;
const long double eps=1e-15;
template <class T,class U>bool mineq(T& a,U b){if(a>b){a=b;return true;}return false;}
template <class T,class U>bool maxeq(T& a,U b){if(a<b){a=b;return true;}return false;}
llint gcd(llint a,llint b){if(a%b==0){return b;}else return gcd(b,a%b);}
llint lcm(llint a,llint b){if(a==0){return b;}return a/gcd(a,b)*b;}
template<class T> void SO(T& ve){sort(ve.begin(),ve.end());}
template<class T> void REV(T& ve){reverse(ve.begin(),ve.end());}
template<class T>llint LBI(vector<T>&ar,T in){return lower_bound(ar.begin(),ar.end(),in)-ar.begin();}
template<class T>llint UBI(vector<T>&ar,T in){return upper_bound(ar.begin(),ar.end(),in)-ar.begin();}
int main(void){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int Q;cin>>Q;
	while(Q--){
		string s,t;cin>>s>>t;
		if(s==t){cout<<0<<endl;continue;}
		int i,n=s.size(),Si=0,Ti=0,Xd=999;
		for(i=0;i<n;i++){
			if(s[i]!=t[i]){if(Xd==999){Xd=i;}}
			if(s[i]=='1'){Si=i;}
			if(t[i]=='1'){Ti=i;}
		}
		cout<<abs(Si-Xd)+abs(Ti-Xd)<<endl;
	}
	return 0;
}


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

class Dice{
public:
    int face[6] = {};
    int tmp[4] = {};
    void direction(char ch){
        if(ch == 'N') move(0,1,5,4);
        if(ch == 'S') move(0,4,5,1);
        if(ch == 'W') move(0,2,5,3);
        if(ch == 'E') move(0,3,5,2);
    }
    void move(int a,int b,int c,int d){
            tmp[0] = face[a];
            tmp[1] = face[b];
            tmp[2] = face[c];
            tmp[3] = face[d];

            face[a] = tmp[1];
            face[b] = tmp[2];
            face[c] = tmp[3];
            face[d] = tmp[0];
    }
};

int main(){
    Dice dice1;
    string D;
    for(int i = 0;i < 6;i++){
        cin>>dice1.face[i];
    }
    cin>>D;
    for(int j = 0;j < D.size();j++){
        dice1.direction(D[j]);
    }
    cout<<dice1.face[0]<<endl;

    return 0;
}

Measured memory_bytes: 3156
#include <iostream>
#include <vector>
#include <cmath>
#include <algorithm>
#include <string>
#include <sstream>
#include <utility>
#define ll long long int
#define rep(i,x,y) for(int i=x;i<y;i++)
#define rel(i,x,y) for(int i=x-1;i>=y;i--)
#define all(x) x.begin(),x.end()
#define NMAX 100001
#define NIL -1
using namespace std;
ll used[NMAX];
vector<pair<int,int>> graph[NMAX];

void BFS(int start){
	rep(i,0,graph[start].size()){
		if(used[graph[start][i].first]==NIL){
			used[graph[start][i].first] = used[start] + graph[start][i].second;
			BFS(graph[start][i].first);
		}
	}
}

int main(){
	int N;
	cin >> N;
	int u,v,w=0;
	rep(i,0,N){
		used[i] = NIL;
	}
	rep(i,1,N){
		cin >> u >> v >> w;
		graph[u-1].push_back(make_pair(v-1,w));
		graph[v-1].push_back(make_pair(u-1,w));
	}
	used[0] = 0;
	BFS(0);
	rep(i,0,N){
		cout << used[i]%2 << endl;
	}
}


Measured memory_bytes: 8832
import numpy as np
N = int(input())
A = np.array(input().split(), dtype=np.int32)
B = np.array(input().split(), dtype=np.int32)
C = np.array(input().split(), dtype=np.int32)

A.sort()
B.sort()
C.sort()

ab = np.searchsorted(A, B, side="left")
bc = N - np.searchsorted(C, B, side="right")
ans = (ab*bc).sum()
print(ans)

Measured memory_bytes: 25252
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
 
using namespace std;
using namespace __gnu_pbds;
 
 
#define pb push_back
#define mp make_pair
#define lb lower_bound
#define ub upper_bound
#define f first
#define s second
#define resz resize
#define ini ll_MAX
#define inl LLONG_MAX
#define MOD 1000000007
#define sz(x) ll((x).size())
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define FOR(i, a, b) for (ll i = (a); i < (b); i++)
#define F0R(i, a) for (ll i = 0; i < (a); i++)
#define FORR(i, a, b) for (ll i = a; i >= (b); i--)
#define F0RR(i, a) for (ll i = a; i >= 0; i--)
#define trav(a, x) for (auto& a : x)
#define pbds tree<ll, null_type,less<ll>, rb_tree_tag,tree_order_statistics_node_update> 
 
using ll = long long;
using vi = vector<ll>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using vb = vector<bool>;
using vd = vector<double>;
using vs = vector<string>;
 
using pii = pair<ll, ll>;
using pll = pair<ll, ll>;
using pdd = pair<double, double>;
 
using vpii = vector<pii>;
using vvpii = vector<vpii>;
using vpll = vector<pll>;
using vvpll = vector<vpll>;
using vpdd = vector<pdd>;
using vvpdd = vector<vpdd>;
 
ll mod(ll a,ll b)
{
    return (b+a%b)%b;
}
 
ll gcd(ll a,ll b)
{
    if(b==0)return a;
    else return gcd(b,a%b);
}
ll po(ll a,ll b)
{
    ll ans = 1;
    while(b--)
        ans*=a;
    return ans;
}
ll pom(ll a,ll b,ll mod)
{
    if(b==0)return 1;
    ll k = pom(a,b/2,mod);
    if(b%2==0)return (k*k)%mod;
    else return ((k*k)*mod*a)%mod;
}
 
ll sqdist(ll a,ll b,ll c,ll d)
{
    return (a-c)*(a-c)+(b-d)*(b-d);
}
ll fact(ll n)
{
    if(n==0)return 1;
    ll ans = 1;
    FOR(i,1,n+1)ans*=i;
    return ans;
}
 

void solve()
{
    int k;
    cin>>k;
    int p = k%10;
    if(p==2||p==4||p==5||p==7||p==9)
        cout<<"hon";
    else if(p==0||p==1||p==6||p==8)
        cout<<"pon";
    else cout<<"bon";
}
main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    // #ifndef ONLINE_JUDGE
    // freopen("input.txt","r",stdin);
    // freopen("output.txt","w",stdout);
    // #endif
    solve();
}

Measured memory_bytes: 3636
#include <bits/stdc++.h> 
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define size_of_array(array) (sizeof(array)/sizeof(array[0]))
#define MAX 100005
#define NIL -1
using ll =long long;
using namespace std;
using Graph=vector<vector<int>>;
using P =pair<int,int>;

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

int main(){
    int d,t,s;
    cin>>d>>t>>s;

    if(d/s<t)cout<<"Yes"<<endl;
    else if(d/s==t && d%s==0)cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
}

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

#define rep(i,n) for(int i = 0; i < (n); i++)
#define rrep(i,n) for(int i = (n)-1; i >= 0; i--)
#define rep1(i,n) for(int i = 1; i <= (n); i++)
#define rrep1(i,n) for(int i = (n); i > 0; i--)

#define ll long long
#define pi pair<int, int>
#define pll pair<ll, ll>

#define MOD 1000000007
#define INF 1000000000000000LL

using namespace std;

#define MAXN 1100
#define MAXW 22000

ll dp[MAXN][MAXW];

int main(){
  int n;cin>>n;
  vector<int>w(n), s(n), v(n);
  rep(i, n){
    cin>>w[i]>>s[i]>>v[i];
  }

  vector<pi>ss;
  rep(i, n)ss.push_back({s[i]+w[i], i});
  sort(ss.begin(), ss.end());

  rep(i, n){
    int ci=ss[i].second;
    ll cw=w[ci], cs=s[ci], cv=v[ci];
    dp[i+1][cw] = cv;
    rep1(j, MAXW){
      dp[i+1][j] = max<ll>(dp[i+1][j], dp[i][j]);
      if(j-cw>=0 && j-cw<=cs)dp[i+1][j] = max<ll>(dp[i+1][j], dp[i][j-cw]+cv);
    }
  }

  ll result = 0;
  rep(i, MAXW)result = max<ll>(result, dp[n][i]);

  cout<<result<<endl;
    

  return 0;
}


Measured memory_bytes: 175528
import java.util.Scanner;

public class Main {

    public static void main( String[] args ) {
        Scanner sc = new Scanner( System.in );
        // 文字列の入力
        String today = sc.next();

        if( today.equals( "Sunny" ) ) {
            System.out.println( "Cloudy" );
        }
        else if( today.equals( "Cloudy" ) ) {
            System.out.println( "Rainy" );
        }
        else {
            System.out.println( "Sunny" );
        }
    }
}

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

const int MOD = 1e9 + 7;

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	
	int n, k;
	cin >> n >> k;
	
	int a[n];
	for (int i = 0; i < n; i++)
		cin >> a[i];

	vector <vector <int> > dp(
		2, vector <int> (k + 1));
	
	for (int i = 0; i < n; i++) {
		for (int j = 0, pre = 0; j <= k; j++) {
			if (!i) {
				if (j <= a[i]) 
					dp[i][j] = 1;
			} else {
				pre = (0LL + pre + dp[(i - 1)&1][j]) % MOD;
				if (j > a[i])
					pre = (0LL + pre - dp[(i - 1)&1][j - a[i] - 1] + MOD) % MOD;
				dp[i&1][j] = pre;
			}
		}
	}
	
	cout << dp[(n - 1)&1][k] << '\n';
	return 0;
}

Measured memory_bytes: 1408
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (n) ; ++i)
#define FOR(i,a,b) for(int i = (a); i < (b); ++i)
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define emb emplace_back
#define fcout cout << fixed << setprecision(15)

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

template<typename T> void pv(vector<T> vec) {
  cout << "[";
  for(auto& v : vec) { cout << v << ","; }
  cout << "]" << endl;
}

template<>
void pv(vector<P> vec) {
  cout << "[";
  for(auto& v : vec) {
    cout << "<" << v.fi << ","<< v.se << ">" << ",";
  }
  cout << "]" << endl;
}

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

  vector<int> ans(n,0);
  rep(i,n) {
    FOR(j,i+1,n) {
      int temp = min(abs(j+1-y)+abs(i+1-x)+1,j-i);
      ans.at(temp) += 1;
    }
  }
  rep(i,n) {
    if(i==0) continue;
    cout << ans.at(i) << endl;
  }
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define fst first
#define snd second
using namespace std;

typedef long long ll;
typedef double db;
typedef long double ldb;

template<class T> inline void checkmin(T &a,const T &b){if(b<a) a=b;}
template<class T> inline void checkmax(T &a,const T &b){if(b>a) a=b;}

const int inf=1e9+10;
const int maxn=310;
const ll mod=1e9+7;

int dp[maxn][maxn][maxn];
int n,m;
vector <pair<int,int> > g[maxn];

void add(int &a,int b){
	a+=b;
	a%=mod;
} 

int main(){
	scanf("%d%d",&n,&m);
	for(int i=0;i<m;i++){
		int l,r,x;
		scanf("%d%d%d",&l,&r,&x);
		g[r].pb(mp(l,x));
	}
	for(int i=0;i<g[1].size();i++){
		int sum=g[1][i].snd;
		if(sum!=1){
			printf("0\n");
			return 0;
		}
	}
	dp[0][0][1]=dp[0][1][0]=dp[1][0][0]=1;
	for(int i=0;i<=n;i++){
		for(int j=0;j<=n;j++){
			for(int k=0;k<=n;k++){
				if(dp[i][j][k]==0) continue;
			//	cout<<i<<" "<<j<<" "<<k<<":"<<dp[i][j][k]<<endl;
				int mx=max(i,max(j,k));
				for(int c=0;c<3;c++){
					bool flag=true;
					for(int t=0;t<g[mx+1].size();t++){
						int l=g[mx+1][t].fst,sum=g[mx+1][t].snd;
						int hv=0;
						if(c==0||l<=i) hv++;
						if(c==1||l<=j) hv++;
						if(c==2||l<=k) hv++;
						if(hv!=sum) flag=false;
					}
					if(flag){
						if(c==0) add(dp[mx+1][j][k],dp[i][j][k]);
						if(c==1) add(dp[i][mx+1][k],dp[i][j][k]);
						if(c==2) add(dp[i][j][mx+1],dp[i][j][k]);
					}
				}
				
			}
		}
	}
	int ans=0;
	for(int j=0;j<n;j++) for(int k=0;k<n;k++) add(ans,dp[n][j][k]);
	for(int i=0;i<n;i++) for(int k=0;k<n;k++) add(ans,dp[i][n][k]);
	for(int i=0;i<n;i++) for(int j=0;j<n;j++) add(ans,dp[i][j][n]);
	printf("%d\n",ans);
	return 0;
}


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


int main()
{
    
    long long int ans=0;
    
    long long int n,m;
    cin>>n>>m;
    
    ans += (n*(n-1))/2;
    ans+= (m*(m-1))/2;
    
    cout<<ans<<endl;
    
    
}

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

#define all(x) (x).begin(),(x).end()
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define setbits(x) __builtin_popcount(x)
#define zerobits(x) __builtin_ctz(x)
#define setbitsll(x) __builtin_popcountll(x)
#define zerobitsll(x) __builtin_ctzll(x)
#define inf 1e18
#define ps(x,y) fixed<<setprecision(y)<<x

typedef vector<int> vi;
typedef long long ll;
typedef vector<ll> vl;
typedef pair<int,int> pii;
typedef unsigned long long ull;
typedef map<int,int> mii;

const int MOD = 1e9+7;

void solve () {
	int n;
	cin >> n;
	vi arr(10001,0);
	for (int i = 1;i <= 10000;++i) {
		for (int j = 1;j <= 10000;++j) {
			if (i*i+j*j+i*j > 10000) break;
			for (int k = 1;k <= 10000;++k) {
				int x = i*i+j*j+k*k+i*j+j*k+k*i;
				if (x > 10000) break;
				arr[x]++;
			}
		}
	}
	for (int i = 1;i <= n;++i) {
		cout << arr[i] << '\n';
	}

}

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	solve();
	return 0;
}



Measured memory_bytes: 3656
function Main(input){
	input = Number(input);
    if(input % 2 === 0){
      console.log((input/2)*(input/2));
    }else{
      input = input - 1
      console.log((input/2)*(input/2)+(input/2));
    }
}

Main(require("fs").readFileSync("/dev/stdin","utf8"));

Measured memory_bytes: 7372
#import sys
MOD = 10 ** 9 + 7
INFI = 10**10
#input = sys.stdin.readline
import math

import itertools
import heapq
#import bisect

import copy
from functools import lru_cache

def sosuhante(n):
    for k in range(2, int(math.sqrt(n))+1):
        if n% k ==0:
            return False
    return True
def cmb(n, r):
    if n - r < r: r = n - r
    if r == 0: return 1
    if r == 1: return n

    numerator = [n - r + k + 1 for k in range(r)]
    denominator = [k + 1 for k in range(r)]

    for p in range(2,r+1):
        pivot = denominator[p - 1]
        if pivot > 1:
            offset = (n - r) % p
            for k in range(p-1,r,p):
                numerator[k - offset] /= pivot
                denominator[k] /= pivot

    result = 1
    for k in range(r):
        if numerator[k] > 1:
            result *= int(numerator[k])

    return result

def kingaku(a,b,n):
    keta=len(str(n))
    return a*n+b*keta

def my_index(l, x, default=False):
    if x in l:
        return l.index(x)
    else:
        return default

#    h,w,a,b = map(int, input().split())
#    c = [[0 for j in range(n)] for i in range(n)]

def ret(a):
    c=[None]*(len(a)-1)
    if len(a)==1:
        return a[0]
    elif len(a)==0:
        return 0
    for i in range(1,len(a)):
        c[i-1]=abs(a[i]-a[i-1])
    return ret(c)


def main():

    a,b,c,d=map(int,input().split())
    ans="Yes"
    while True:
        c-=b
        if c<=0:
            ans="Yes"
            break
        a-=d
        if a<=0:
            ans="No"
            break

    print(ans)



if __name__ == "__main__":

    main()

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

typedef long double ld;

const ld PI = 3.14159265358979;

int main() {FIN
	
	int a, b, h, m;
	ld aa, ab, dx, dy;
	cin >> a >> b >> h >> m;
	ab = 6 * m;
	aa = 30 * h + m * 0.5;
	//cout << aa << " " << ab << "\n";
	if (abs(aa - ab) <= 90) {
		dx = b - a * cos((abs(aa - ab) * PI) / 180.0);
		dy = a * sin((abs(aa - ab) * PI) / 180.0);
		cout << fixed << setprecision(12) << sqrt(dx * dx + dy * dy) << "\n";
	} else {
		dx = b + a * sin(((abs(aa - ab) - 90) * PI) / 180.0);
		dy = a * cos(((abs(aa - ab) - 90) * PI) / 180.0);
		cout << fixed << setprecision(12) << sqrt(dx * dx + dy * dy) << "\n";
	}
	return 0;
}


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

#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL); 

#define ll long long
#define ff first
#define ss second
#define pb push_back
#define pf push_front
#define mp make_pair
#define pu push
#define pp pop_back
#define in insert
#define ld long double
#define forn(low,high,i) for(i = low;i < high;i++)
#define forrev(high,low,i) for(i = high; i >= low;i--)
#define trace(x) cerr << #x << ": " << x << " " << endl;
#define all(v) v.begin(),v.end()
#define sz(v) (int)v.size()
#define line cout << __LINE__;
#define prv(a) for(auto x : a) cout << x << ' ';cout << '\n';
#define decimal_digits cout << fixed << setprecision(15);
#define dbg2(a,b) cerr << #a << " = " << a << " " << #b << " = " << b << '\n';        
#define debug(x) cerr << __LINE__ << ' ' << #x << " = " << x << '\n';
#define dln cerr << '\n';
#define dsp cerr << ' ';
#define pln cout << '\n';
#define psp cout << ' ';

typedef unordered_map<int,int> umi;
typedef unordered_map<ll,ll> uml;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<pii> vpii;
typedef vector<pll> vpll;
mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());
const int inf = 1e9;
const ll INF = 1e18;
const ll mod = 1e9 + 7;

clock_t time_p = clock();

void ktj(){
  time_p = clock() - time_p;
  cerr << "Time elapsed : " << (float)(time_p)/CLOCKS_PER_SEC << "\n";
}

int main(){
  fastio

  ll n, i, j, k;
  string s, t;

  cin >> i >> s;

  if(i >= 3200){
    cout << s << '\n';
  }else{
    cout << "red\n";
  }

  ktj();
}


Measured memory_bytes: 256
n,x = map(int, input().split())
a = [int(t) for t in input().split()]

ans = 0

for i in range(1,n):
    res = x
    if a[i-1] + a[i] > x:
        ans += a[i-1]+a[i] - x
        a[i] = max(x-a[i-1],0)
        if a[i] == 0:
            res -= a[i]
            a[i-1] -= res

print(ans)


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

using namespace std;

#define sqr(x) ((x) * (x))
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()

typedef vector<int> vi;
typedef long long ll;

void solve() {
  int N, ans = 0;
  string S;
  cin >> N >> S;
  for (int i = 0; i < 10; i++) {
    for (int j = 0; j < 10; j++) {
      for (int k = 0; k < 10; k++) {
        bool flag_i = false;
        bool flag_j = false;
        for (int l = 0; l < N; l++) {
          int c = (int)(S[l] - '0');
          if (!flag_i && c == i) {
            flag_i = true;
          } else if (!flag_j && flag_i && c == j) {
            flag_j = true;
          } else if (flag_j && c == k) {
            ans++;
            break;
          }
        }
      }
    }
  }
  cout << ans << endl;
}

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

  solve();

  return 0;
}


Measured memory_bytes: 384
#include <stdio.h>
using namespace std;
#include <iostream> 

int main(void){
  int n, i, j, k;
  int num[50], high[50], low[50];
  char str[50][10], tmp;

  scanf("%d", &n);

  for (i=0;i<n;i++) {
    scanf("%s",str[i]);
  }

  for (k=0;k<n;k++) {
    for (i=0;i<7;i++) {
      for ( j=7;j>i;j--) {
        if (str[k][j-1] > str[k][j]) {
        	tmp = str[k][j-1];
        	str[k][j-1] = str[k][j];
        	str[k][j] = tmp;
        }
      }
    }
    low[k]= atoi(str[k]);
    //printf("%d\n",low[k]);
  }

  for (k=0;k<n;k++) {
    for (i=0;i<7;i++) {
      for ( j=7;j>i;j--) {
        if (str[k][j-1] < str[k][j]) {
        	tmp = str[k][j-1];
        	str[k][j-1] = str[k][j];
        	str[k][j] = tmp;
        }
      }
    }
    high[k]= atoi(str[k]);
    //printf("%d\n",high[k]);
  }

  for(i=0;i<n;i++)
  printf("%d\n", high[i]-low[i]);

  return 0;
}


Measured memory_bytes: 3160
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner input = new Scanner(System.in);
		int s = input.nextInt();
		input.close();
		
		int hour = s / 3600;
		int minute = (s / 60) % 60;
		int second = s % 60;
		
		System.out.println(hour + ":" + minute + ":" + second);
	}
}

Measured memory_bytes: 17300
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (int)(n); i++)
#define REP(i,n) for (int i = 1; i < (int)(n); i++)
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
#define vout(x) rep(i,x.size()) cout << x[i] << " "
template<class T> bool chmin(T &a, T b) {if(a>b) {a=b;return 1;}return 0;}
template<class T> bool chmax(T &a, T b) {if(a<b) {a=b;return 1;}return 0;}
using namespace std;
using vint = vector<int>;
using vvint = vector<vector<int>>;
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
using P = pair<int,int>;
const int inf = 1e9;
const ll inf_l = 1e18;
const int MAX = 1e5;

vint dx = {1,0,-1,0};
vint dy = {0,1,0,-1};

int h, w;
vector<string> field;


int bfs(P s, P g, vvint &dis) {
    queue<P> q;
    q.push(s);
    dis[s.first][s.second] = 0;
    while (!q.empty()) {
        P p = q.front(); q.pop();
        rep(i,4) {
            int n_x = p.second + dx[i];
            int n_y = p.first + dy[i];
            if (n_x >= 0 && n_x < w && n_y >= 0 && n_y < h) {
                if (field[n_y][n_x] != '#' && dis[n_y][n_x] == inf) {
                    dis[n_y][n_x] = dis[p.first][p.second] + 1;
                    q.push(P(n_y,n_x));
                }
            }
        }
    }
    return dis[g.first][g.second];
}

int main() {
    cin >> h >> w;
    field.resize(h);
    rep(i,h) cin >> field[i];
    P s, g;
    int ans = -1;
    rep(i,h)rep(j,w) {
        if (field[i][j] == '#') continue;
        s = P(i,j);
        rep(k,h)rep(l,w) {
            if (field[k][l] == '#') continue;
            g = P(k,l);
            vvint dis(h,vint(w,inf));
            bfs(s,g,dis);
            if (dis[g.first][g.second] != inf) ans = max(ans,dis[g.first][g.second]);
        }
    }
    cout << ans << endl;
}

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

#ifdef LOCAL
#include "../lib/dump.hpp"
#else
#define dump(...)
#define dumpv(...)
#endif

typedef long long ll;
typedef pair<int, int> P;
const int MOD = 1e9 + 7;
const int INF = 1001001001;
const ll LINF = 1001002003004005006ll;

int main()
{
  cin.tie(0);
  ios::sync_with_stdio(false);
  // freopen("temp.1", "r", stdin);

  int A, B;
  cin >> A >> B;
  if ((A * B) % 2 == 1)
    puts("Yes");
  else
    puts("No");

  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define repo(i,n) for(int i = 1; i < (int)(n); i++)
#define pb push_back
#define mp make_pair
#define np next_permutation
#define lb lower_bound
#define ub upper_bound
#define fi first
#define se second
#define all(x) (x).begin(),(x).end()
#define mod 1000000007
#define pi acos(-1.0)
const ll INF = 1LL<<61;
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; }
ll gcd(ll x, ll y) { return y ? gcd(y, x % y) : x; }
ll lcm(ll x, ll y) { return x / gcd(x, y) * y; }
ll jou(ll N, ll P){if(P==0) return 1;
  if(P%2==0){ll t = jou(N, P/2);return t*t % mod;
  }return (N * jou(N, P-1)) % mod;}  //jou(n,mod-2)で逆元
//intの最大値2147483647 ≒ 2×10^9
//long longの最大値9223372036854775807 ≒ 9×10^18
//'大文字'+=32;    で小文字に
//  cout << fixed << setprecision (20);   小数点以下2０桁まで
//実行時間制約2秒では２×10^8回くらいまで計算できる




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

  bool s=true;
  rep(i,n){
    int x;
    cin>>x;
    if(x%2==1) s=false;
  }

  cout << (s?"second":"first") << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long int
using namespace std;
int main(){
  int n,h,w,x1,x2,cnt=0;
  int odd[200],even[200];
  cin>>n>>h>>w;
  for(int i=0;i<(n/2);i++){
     for(int j=0;j<(2*w);j++){
       if(j%(2*w)<w){
	 odd[j]=1;
	 even[j]=0;
       }else{
	 odd[j]=0;
	 even[j]=1;
       }
     }
    cin>>x1>>x2;
    for(int j=w-1;j>=0;j--){
      if(x1!=0){
      odd[j+x1]=1;
      odd[j]=0;
      }
    }
    for(int j=w;j<(w*2);j++){
      if(x2!=0){
      even[j-x2]=1;
      even[j]=0;
      }
    }
    for(int j=0;j<(w*2);j++){
      if(odd[j]==0 && even[j]==0) cnt++;
    }
  }
  cout<<cnt*h<<endl;
  return 0;
}



Measured memory_bytes: 3136
#include <chrono>

#include <iostream>
#include <iomanip>
#include <algorithm>
#include <bitset>
#include <set>
#include <unordered_set>
#include <map>
#include <unordered_map>
#include <cmath>
#include <time.h>
#include <random>
#include <string>
#include <cassert>
#include <vector>
#include <ostream>
#include <istream>
#include <stack>
#include <deque>
#include <queue>
#include <functional>

using namespace std;

#define int long long
#define pb push_back
#define all(a) (a).begin(), (a).end()
#define pii pair<int, int>
#define ld long double

ostream& operator << (ostream &a, const vector<int> &b) {
    for (auto k : b) cout << k << " ";
    return a;
}

#ifdef LOCAL
    #define dbg(x) cout << #x << " : " << (x) << "\n";
    const int INF = 1e18;
//    const int mod = 2600000069;
//    const int p = 10;
//    const ld PI = 3.1415926535;
#else
    #define dbg(x)
    const int INF = 1e18;
//    const int mod = 2600000069;
//    const int p = 179;
//    const ld PI = 3.1415926535;
#endif

//#pragma GCC optimize("Ofast,no-stack-protector")
//#pragma GCC target("sse,sse2,sse3,sse3,sse4")
//#pragma GCC optimize("unroll-loops")
//#pragma GCC optimize("fast-math")
//#pragma GCC target("avx2")
//#pragma GCC optimize("section-anchors")
//#pragma GCC optimize("profile-values,profile-reorder-functions,tracer")
//#pragma GCC optimize("vpt")
//#pragma GCC optimize("rename-registers")
//#pragma GCC optimize("move-loop-invariants")
//#pragma GCC optimize("unswitch-loops")
//#pragma GCC optimize("function-sections")
//#pragma GCC optimize("data-sections")

signed main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    #ifdef LOCAL
    #else
//        freopen("capitals.in", "r", stdin);
//        freopen("capitals.out", "w", stdout);
    #endif
    string s;
    cin >> s;
    bool ok = 1;
    int n = s.size();
    int l = 0, r = (n - 1) / 2 - 1;
    while (r > l) {
        if (s[l] != s[r]) {
            ok = 0;
            break;
        }
        r--, l++;
    }
    l = 0, r = n - 1;
    while (r > l) {
        if (s[l] != s[r]) {
            ok = 0;
            break;
        }
        r--, l++;
    }
    if (ok) cout << "Yes\n";
    else cout << "No\n";
}
/*

*/


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;
int main()
{
    vector<int> q(3);
    rep(i,3) cin>>q[i];
    int choose=2;

    int min=1<<23;
    for (int bit = 0; bit < (1<<3); bit++)
    {
        int cnt=0;
        int buf=0;
        for (int i = 0; i < 3; i++)
        {
            if(bit & (1<<i))
            {
                buf+=q[i];
                cnt++;
            }
        }
        if(cnt!=choose)continue;
        if(min>buf) min=buf;
    }
    cout<<min<<endl;

    return 0;
}

Measured memory_bytes: 256
N = int(input())
A, B = map(int, input().split())
*P, = map(int, input().split())
C = [0]*3
for p in P:
    if p <= A:
        C[0] += 1
    elif p <= B:
        C[1] += 1
    else:
        C[2] += 1
print(min(C))

Measured memory_bytes: 3064
package main

import (
	"bufio"
	"fmt"
	"math"
	"os"
)
var lazy []int
var n int
func main(){
	var out=bufio.NewWriter(os.Stdout)
	var in=bufio.NewReader(os.Stdin)
	var q int
	fmt.Fscanf(in,"%d %d\n",&n,&q)
	n=int(math.Ceil(math.Log2(float64(n))))
	if n==0 {
		n++
	}
	n=1<<uint(n)
	lazy=make([]int,2*n-1)
	arr:=make([]int,q)
	InitA()
	var a,b,c,d int
	for i := 0; i < q; i++ {
		fmt.Fscanf(in,"%d",&a)
		if a==0 {
			fmt.Fscanf(in,"%d %d %d\n",&b,&c,&d)
			arr[i]=d
			update(b,c+1,0,0,n,i)
		}else {
			fmt.Fscanf(in,"%d\n",&b)
			out.Flush()
			fmt.Fprintln(out,find(b+n-1,n,lazy,arr))
		}
	}
	out.Flush()
}
func InitA(){
	for i := 0;i < 2*n-1;i++  {
		lazy[i]=-1
	}
}
func  update(a,b,k,l,r,v int){
	if r <= a || b <= l {
		return
	}
	if a <= l && r <= b {
		lazy[k]=v
		return
	}
	update(a,b,2*k+1,l,(l+r)/2,v)
	update(a,b,2*k+2,(l+r)/2,r,v)
}
func find(b,n int,lazy []int,arr []int) int{
	max:=b
	for ;b>0;{
		b=(b-1)/2
		if lazy[max]<lazy[b]{
			max=b
		}
	}
	var temp int
	if lazy[max] == -1 {
		temp=math.MaxInt32
	}else {
		temp=arr[lazy[max]]
	}
	return temp
}



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

int main(){
    int N;
    cin >> N;
    int ans = 0;
    for(int i = N; i > 0; i--){
        string temp = to_string(i);
        if(temp.size() % 2 == 1) ans++;
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
namespace my_std{
	using namespace std;
	#define pii pair<int,int>
	#define fir first
	#define sec second
	#define MP make_pair
	#define rep(i,x,y) for (int i=(x);i<=(y);i++)
	#define drep(i,x,y) for (int i=(x);i>=(y);i--)
	#define go(x) for (int i=head[x];i;i=edge[i].nxt)
	#define templ template<typename T>
	#define sz 202002
	#define mod 1000000007ll
	typedef long long ll;
	typedef double db;
	templ inline bool chkmax(T &x,T y){return x<y?x=y,1:0;}
	templ inline bool chkmin(T &x,T y){return x>y?x=y,1:0;}
	templ inline void read(T& t)
	{
		t=0;char f=0,ch=getchar();double d=0.1;
		while(ch>'9'||ch<'0') f|=(ch=='-'),ch=getchar();
		while(ch<='9'&&ch>='0') t=t*10+ch-48,ch=getchar();
		if(ch=='.'){ch=getchar();while(ch<='9'&&ch>='0') t+=d*(ch^48),d*=0.1,ch=getchar();}
		t=(f?-t:t);
	}
	template<typename T,typename... Args>inline void read(T& t,Args&... args){read(t); read(args...);}
	char __sr[1<<21],__z[20];int __C=-1,__zz=0;
	inline void Ot(){fwrite(__sr,1,__C+1,stdout),__C=-1;}
	inline void print(register int x)
	{
		if(__C>1<<20)Ot();if(x<0)__sr[++__C]='-',x=-x;
		while(__z[++__zz]=x%10+48,x/=10);
		while(__sr[++__C]=__z[__zz],--__zz);__sr[++__C]='\n';
	}
	ll ksm(ll x,int y){ll ret=1;for (;y;y>>=1,x=x*x%mod) if (y&1) ret=ret*x%mod;return ret;}
	ll inv(ll x){return ksm(x,mod-2);}
}
using namespace my_std;

int B,W;
ll fac[sz],_fac[sz];
void init(){_fac[0]=fac[0]=1;rep(i,1,sz-1) _fac[i]=inv(fac[i]=fac[i-1]*i%mod);}
ll C(int n,int m){return n>=m&&m>=0?fac[n]*_fac[m]%mod*_fac[n-m]%mod:0;}
ll f[sz],g[sz]; 

int main()
{
	read(B,W);
	init();
	ll I=inv(2),cur=I;
	rep(i,1,B+W) 
		f[i]=(f[i-1]+C(i-1,B-1)*cur%mod)%mod,
		g[i]=(g[i-1]+C(i-1,W-1)*cur%mod)%mod,
		cur=cur*I%mod;
	rep(i,1,B+W) printf("%lld\n",(mod+1+g[i-1]-f[i-1])%mod*I%mod);
	return 0; 
}

Measured memory_bytes: 10368
#include <iostream>
#include <vector>
#include <algorithm>
#include <queue>
#include <stack>
#include <tuple>
#include <set>
#include <map>
#include <string>
#include <iomanip>
#include <cmath>
#include <cassert>
using namespace std;

typedef long long ll;

const int MAX_SIZE = 4000;
bool isprime[MAX_SIZE];
vector<ll> prime_num;
vector<ll> squered;
vector<ll> cubed;

const ll infty = 10000000010;

void init() {
  fill(isprime, isprime+MAX_SIZE, true);
  isprime[0] = isprime[1] = false;
  for (auto i=2; i<MAX_SIZE; i++) {
    if (isprime[i]) {
      ll x = i;
      prime_num.push_back(x);
      squered.push_back(x*x);
      cubed.push_back(x*x*x);
      for (auto j=2; i*j<MAX_SIZE; j++) {
        isprime[i*j] = false;
      }
    }
  }
}

bool prime(long long x) { // 2 \leq x \leq MAX_SIZE^2
  if (x < MAX_SIZE) {
    return isprime[x];
  }
  for (auto e : prime_num) {
    if (x%e == 0) return false;
  }
  return true;
}

int N;
ll s[100010];
map<ll, int> M;

ll conj(ll k) {
  ll l = k;
  ll A = 1;
  ll B = 1;
  for (auto x : prime_num) {
    int t = 0;
    while (l % x == 0) {
      l /= x;
      t++;
    }
    if (t == 1) {
      A *= x;
    } else if (t == 2) {
      B *= x;
    }
  }
  ll red = k / (A * B * B);
  ll sq = floor(sqrt(red)+0.1);
  // cerr << "red = " << red << " , sq = " << sq << endl;
  if (red == sq * sq) {
    if (sq > 100010) return infty;
    B *= red;
  } else {
    if (red > 100010) return infty;
    A *= red;
  }
  return A * A * B;
}

int main() {
  init();
  cin >> N;
  int ans = 0;
  for (auto i = 0; i < N; i++) {
    cin >> s[i];
    for (auto x : cubed) {
      while (s[i]%x == 0) s[i] /= x;
    }
    if (M.find(s[i]) == M.end()) {
      M[s[i]] = 1;
    } else {
      M[s[i]]++;
    }
  }
  for (auto x : M) {
    ll k = x.first;
    int num = x.second;
    // cerr << k << " " << num << endl;
    if (k == 1 && num > 0) {
      ans += 1;
      continue;
    }
    ll c = conj(k);
    // cerr << "conj(" << k << ") = " << c << endl;
    if (M.find(c) == M.end()) {
      ans += num;
    } else {
      ans += max(num, M[c]);
      M[k] = 0;
      M[c] = 0;      
    }
  }
  cout << ans << endl;
}


Measured memory_bytes: 7296
#include<iostream>

using namespace std;

int main(){
	int n, stage, stage2, i;

	while (true) {
		int left = 0, right = 0;
		cin >> n;
		if(n == 0) break;
		for(i = 0; i < n; i ++){
			cin >> stage >> stage2;
			if(stage > stage2) left += stage + stage2;
			else if(stage < stage2) right += stage + stage2;
			else{
				left += stage;
				right += stage2;
			}
		}
		cout << left << " " << right << endl;
	}
	return 0;
}

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

int	main()
{
	int	N, M;
	int64_t	K;
	cin >> N >> M >> K;
	vector<int>	A_vec(N), B_vec(M);
	for (int i = 0; i < N; ++i)
		cin >> A_vec.at(i);
	for (int j = 0; j < M; ++j)
		cin >> B_vec.at(j);
	vector<int64_t>	cumsum_A(N + 1), cumsum_B(M + 1);
	cumsum_A.at(0) = 0;
	for (int i = 0; i < N; ++i)
		cumsum_A.at(i + 1) = cumsum_A.at(i) + A_vec.at(i);
	cumsum_B.at(0) = 0;
	for (int i = 0; i < M; ++i)
		cumsum_B.at(i + 1) = cumsum_B.at(i) + B_vec.at(i);
	int	max_cnt = 0;
	for (int i = 0; i < N + 1; ++i) {
		int64_t	rest = K - cumsum_A.at(i);
		if (rest < 0) break;
		auto	it = upper_bound(cumsum_B.begin(), cumsum_B.end(), rest);
		int	cnt = i;
		if (it != cumsum_B.begin())
			cnt += static_cast<int>(it - cumsum_B.begin()) - 1;
		if (max_cnt < cnt) {
			max_cnt = cnt;
		}
	}
	cout << max_cnt << endl;
}



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

class Program {
    static void Main (string[] args) {
        var inp = Console.ReadLine().Split(' ');
        int n = int.Parse(inp[0]);
        int nn = (n % 100) % 10;

        if(nn == 3) {
            Console.WriteLine("bon");
        } else if(nn == 0 || nn == 1 || nn == 6 || nn == 8) {
            Console.WriteLine("pon");
        } else {
            Console.WriteLine("hon");
        }
    }
}

Measured memory_bytes: 27480