akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define MOD 1000000007LL
using namespace std;
typedef long long ll;
typedef pair<int,int> P;

ll extgcd(ll a,ll b,ll& x,ll& y){
	ll d=a;
	if(b!=0LL){
		d=extgcd(b,a%b,y,x);
		y-=(a/b)*x;
	}else{
		x=1;
		y=0;
	}
	return d;
}

ll mod_inverse(ll a,ll m){
	ll x,y;
	extgcd(a,m,x,y);
	return (m+x%m)%m;
}

ll fact[5000001];

ll mod_fact(ll n,ll p,ll& e){
	e=0;
	if(n==0)return 1;
	ll res=mod_fact(n/p,p,e);
	e+=n/p;
	if(n/p%2!=0){
		return res*(p-fact[n%p])%p;
	}
	return res*fact[n%p]%p;
}

ll mod_comb(ll n,ll k,ll p){
	if(n<0 || k<0 || n<k)return 0;
	ll e1,e2,e3;
	ll a1=mod_fact(n,p,e1),a2=mod_fact(k,p,e2),a3=mod_fact(n-k,p,e3);
	if(e1>e2+e3)return 0;
	return a1*mod_inverse(a2*a3%p,p)%p;
}

ll a,b,c,sx,sy;

void solve(){
	ll ans=0;
	for(int i=0;i<=1000000;i++){
		ll ao=sx-i-a;
		ll bo=sy-i-b;
		if(ao<0 || bo<0)break;
		if(a==0 && ao>0)continue;
		if(b==0 && bo>0)continue;
		ll val=a>0?mod_comb(ao+a-1LL,a-1LL,MOD):1;
		if(b>0)val=val*mod_comb(bo+b-1LL,b-1LL,MOD)%MOD;
		val=val*mod_comb(i+a+b+c-1LL,a+b+c-1LL,MOD)%MOD;
		ans=(ans+val)%MOD;
	}
	ans=ans*mod_comb(a+b+c,a,MOD)%MOD;
	ans=ans*mod_comb(b+c,b,MOD)%MOD;
	printf("%lld\n",ans);
}

int main(void){
	fact[0]=1;
	for(ll i=1;i<=5000000;i++){
		fact[i]=fact[i-1]*i%MOD;
	}
	while(1){
		scanf("%lld%lld%lld%lld%lld",&a,&b,&c,&sx,&sy);
		if(a==0 && b==0 && c==0)break;
		solve();
	}
	return 0;
}


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

typedef long long   signed int LL;
typedef long long unsigned int LU;

#define incID(i, l, r) for(int i = (l)    ; i <  (r); i++)
#define incII(i, l, r) for(int i = (l)    ; i <= (r); i++)
#define decID(i, l, r) for(int i = (r) - 1; i >= (l); i--)
#define decII(i, l, r) for(int i = (r)    ; i >= (l); i--)
#define  inc(i, n) incID(i, 0, n)
#define inc1(i, n) incII(i, 1, n)
#define  dec(i, n) decID(i, 0, n)
#define dec1(i, n) decII(i, 1, n)

#define inII(v, l, r) ((l) <= (v) && (v) <= (r))
#define inID(v, l, r) ((l) <= (v) && (v) <  (r))

#define PB push_back
#define EB emplace_back
#define MP make_pair
#define FI first
#define SE second
#define PQ priority_queue

#define  ALL(v)  v.begin(),  v.end()
#define RALL(v) v.rbegin(), v.rend()
#define  FOR(it, v) for(auto it =  v.begin(); it !=  v.end(); ++it)
#define RFOR(it, v) for(auto it = v.rbegin(); it != v.rend(); ++it)

template<typename T> bool   setmin(T & a, T b) { if(b <  a) { a = b; return true; } else { return false; } }
template<typename T> bool   setmax(T & a, T b) { if(b >  a) { a = b; return true; } else { return false; } }
template<typename T> bool setmineq(T & a, T b) { if(b <= a) { a = b; return true; } else { return false; } }
template<typename T> bool setmaxeq(T & a, T b) { if(b >= a) { a = b; return true; } else { return false; } }
template<typename T> T gcd(T a, T b) { return (b == 0 ? a : gcd(b, a % b)); }
template<typename T> T lcm(T a, T b) { return a / gcd(a, b) * b; }

// ---- ----

int n, d[201];

int main() {
	inc1(i, 200) {
		for(int j = i; j <= 200; j += i) { d[j]++; }
	}
	
	cin >> n;
	
	int ans = 0;
	inc1(i, n) { if(d[i] == 8 && i % 2 == 1) { ans++; } }
	
	cout << ans << endl;
	
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#include<set>
int main(){
  int a,b,c;
  cin>>a>>b>>c;
  if(a==5&&b==7&&c==5)cout<<"YES"<<endl;
  else if(a==7&&b==5&&c==5)cout<<"YES"<<endl;
  else if(a==5&&b==5&&c==7)cout<<"YES"<<endl;
  else cout<<"NO"<<endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#define rep(i,n) for(int i=0;i<(n);i++)
typedef long long ll;
using namespace std;

int main() {
	string s;
	cin >> s;
	int red = 0, blue = 0;
	rep(i, s.size()) {
		if (s[i] == '0') red++;
		else blue++;
	}
	cout << 2 * min(red, blue) << endl;
	return 0;
}

Measured memory_bytes: 512
#include<iostream>
#include<string>
#include<cctype>

using namespace std;

string toUpper(string s){
    string t=s;
    for (int i=0; i<s.size(); i++){
        t[i] = toupper(s[i]);
    }
    return t;
}

int main(){
    string target,source;
    
    cin >> target;
    target = toUpper(target);
    
    int cnt = 0;
    while(1){
        cin >> source;
        if (source == "END_OF_TEXT") break;
        source = toUpper(source);
        if (target == source) cnt++;
    }
    cout << cnt << endl;
    return 0;
}


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

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

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


int main()
{
	cin.tie(0); ios_base::sync_with_stdio(false);
	int n;
	ll ans =0;
	cin >>n;
	vector<ll> a(n);
	rep(i,n) cin >>a[i];
	
	ll ki=0, ht=0;
	for(int lf = 0, rt =0; lf <n; lf++){
		for(; rt <n && (ht ^ a[rt]) == ki + a[rt] ; rt++){
			ht ^= a[rt]; ki += a[rt]; 
		}
		ans += rt - lf;
		ht ^= a[lf]; ki -=a[lf];
	}
	
	cout << ans <<"\n";
	return 0;
}


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

ll dis(ll x1, ll y1, ll x2, ll y2){
    return abs(x1 - x2) + abs(y1 - y2);
}

int main()
{
    ll n;
    cin >> n;
    vector<ll> s(n);
    ll sum = 0;
    rep(i, n){
        cin >> s[i];
        sum += s[i];
    }

    if (sum % 10 != 0){
        cout << sum << endl;
        return 0;
    }

    sort(s.begin(), s.end());

    rep(i, n){
        if (s[i] % 10 != 0){
            cout << (sum - s[i]) << endl;
            return 0;
        }
    }
    
    cout << 0 << endl;
    return 0;
}


Measured memory_bytes: 3600
/*#include<iostream>
#include<string>
#include<vector>
#include<queue>
#include<tuple>*/
#include<bits/stdc++.h>
using namespace std;
using ll=long long;
struct edge{pair<ll,ll> to;ll cost,time;};
using Graph =vector<vector<vector<edge>>>;
#define p make_pair
#define INF 100000000000000007
#define t make_tuple
#define get(a,b) get<a>(b)

void add_edge(ll from1,ll from2,ll to1,ll to2,ll cost, ll time,Graph &graph)
{
    graph[from1][from2].push_back((edge){p(to1,to2),cost,time});
}

void dijkstra(ll s,ll S,Graph graph,vector<vector<ll>> &dis)
{
    ll n=graph.size(),m=graph[0].size();
    if (S>=m) {dis[s][m-1]=0;S=m-1;}
    else dis[s][S]=0;
    priority_queue<tuple<ll,ll,ll>,vector<tuple<ll,ll,ll>>,greater<tuple<ll,ll,ll>>> que;
    que.push(t(dis[s][S],s,S));
    ll v,w;
    while (!que.empty())
    {
        v=get(1,que.top());
        w=get(2,que.top());
        que.pop();
        for (ll i=0;i<graph[v][w].size();i++)
        {
            edge &e=graph[v][w][i];
            if (dis[e.to.first][e.to.second]>dis[v][w]+e.time)
            {
                dis[e.to.first][e.to.second]=dis[v][w]+e.time;
                que.push(t(dis[e.to.first][e.to.second],e.to.first,e.to.second));
            }
        }
    }
}



int main()
{
    ll N,M,S;cin >> N >> M >> S;
    ll u,v,a,b;
    ll maxA=0;
    vector<vector<ll>> input(M);
    vector<vector<ll>> change(N);
    for (ll i=0;i<M;i++)
    {
        cin>> u >> v>> a >>b;
        u--;v--;
        maxA=max(maxA,a);
        input[i].push_back(u);
        input[i].push_back(v);
        input[i].push_back(a);
        input[i].push_back(b);
    }
    Graph node(N,vector<vector<edge>>((N-1)*maxA+1));
    vector<vector<ll>> dis (N,vector<ll> ((N-1)*maxA+1,INF));
    for (ll i=0;i<N;i++)
    {
        cin >> a >> b;
        change[i].push_back(a);
        change[i].push_back(b);
    }

    for (ll i=0;i<M;i++)
    {
        for (ll j=(N-1)*maxA;j>=0;j--)
        {
            if (j-input[i][2]>=0)
            {
                add_edge(input[i][0],j,input[i][1],j-input[i][2],input[i][2],input[i][3],node);
                add_edge(input[i][1],j,input[i][0],j-input[i][2],input[i][2],input[i][3],node);
            }
            else break;
        }
    }
    
    for (ll i=0;i<N;i++)
    {
        for (ll j=0;j<maxA*(N-1)+1;j++)
        {
            if (j+change[i][0]<=(N-1)*maxA)
            {
                add_edge(i,j,i,j+change[i][0],-change[i][0],change[i][1],node);
            }
            else
            {
                add_edge(i,j,i,maxA*(N-1),-change[i][0],change[i][1],node);
            }
        }
    }
    dijkstra(0,S,node,dis);
    ll ans=INF;
    for (ll i=1;i<N;i++)
    {
        ans=INF;
        for (ll j=0;j<maxA*(N-1)+1;j++)
        {
            ans=min(ans,dis[i][j]);
        }
        cout << ans << endl;
    }
    return 0;
}

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

#define REP(i,n) for (int i=0; i<n; i++)

int imos[1003][1500], staytime[1003];

int main(){
    while(1) {
        int n, mon, d, h, min, p, prevdate = 0;
        char e;
        cin >> n;

        if (n==0){
            break;
        }

        REP(i,1000){
            REP(j,1500){
                imos[i][j] = 0;
            }
            staytime[i] = 0;
        }

        REP(i, n) {
            scanf("%d/%d %d:%d %c %d\n", &mon, &d, &h, &min, &e, &p);
//            printf("%d/%d %d:%d %c %d\n", mon, d, h, min, e, p);
            if (mon * 12 + d != prevdate) {
//                printf("prevdate: %d\n", prevdate);
                REP(j, 1000) {
                    REP(k, 1499){
                        imos[j][k+1] += imos[j][k];
                    }
                }
                REP(k, 1500){
                    if (imos[0][k]>0){
                        REP(j,1000){
                            if (imos[j][k]>0){
                                staytime[j] += 1;
                            }
                        }
                    }
                }
                REP(j,1000){
                    REP(k,1500){
                        imos[j][k] = 0;
                    }
                }
                prevdate = mon * 12 + d;
            }
            if (e == 'I') {
                imos[p][60 * h + min] += 1;
            } else {
                imos[p][60 * h + min] -= 1;
            }
        }

        REP(j, 1000) {
            REP(k, 1499){
                imos[j][k+1] += imos[j][k];
            }
        }
        REP(k, 1500){
            if (imos[0][k]>0){
                REP(j,1000){
                    if (imos[j][k]>0){
                        staytime[j] += 1;
                    }
                }
            }
        }

        int ans=0;
        for (int i=1; i<1000; i++){          // 直す
            ans = max(ans, staytime[i]);
//            printf("staytime[%d] = %d\n", i, staytime[i]);
        }

        cout << ans << endl;

    }


    return 0;
}


Measured memory_bytes: 8984
#include<iostream>
using namespace  std;
char a,b;
int main()
{
	cin>>a>>b;
	if(a=='H')
	{
		if(b=='H')
		cout<<b<<"\n";
		else
		cout<<"D"<<"\n";
	}
	else
	{
		if(b=='H')
		cout<<"D"<<"\n";
		else
		cout<<"H"<<"\n";
	}	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
//#include <boost/multiprecision/cpp_int.hpp>
//namespace mp = boost::multiprecision;

using namespace std;

const double PI = 3.14159265358979323846;
typedef long long ll;
const double EPS = 1e-9;
#define rep(i, n) for (int i = 0; i < (n); ++i)
//#define rep(i, n) for (ll i = 0; i < (n); ++i)
typedef pair<ll, ll> P;
const ll INF = 10e17;
#define cmin(x, y) x = min(x, y)
#define cmax(x, y) x = max(x, y)
#define ret() return 0;

double equal(double a, double b) {
    return fabs(a - b) < DBL_EPSILON;
}

std::istream &operator>>(std::istream &in, set<int> &o) {
    int a;
    in >> a;
    o.insert(a);
    return in;
}

std::istream &operator>>(std::istream &in, queue<int> &o) {
    ll a;
    in >> a;
    o.push(a);
    return in;
}

bool contain(set<int> &s, int a) { return s.find(a) != s.end(); }

//ofstream outfile("log.txt");
//outfile << setw(6) << setfill('0') << prefecture << setw(6) << setfill('0') << rank << endl;
// std::cout << std::bitset<8>(9);
//const ll mod = 1e10;

typedef priority_queue<ll, vector<ll>, greater<ll> > PQ_ASK;

int main() {
    int n;
    cin >> n;
    vector<int> v(n);
    rep(i, n) cin >> v[i];
    map<int, int> index;
    rep(i, n) index[v[i]] = i;

    map<int, int> dp;
    dp[1] = 1;
    for (int i = 2; i <= n; i++) {
        if (index[i - 1] < index[i]) {
            dp[i] = dp[i - 1] + 1;
        } else {
            dp[i] = 1;
        }
    }

    int ma = 0;
    for (auto e : dp) cmax(ma, e.second);
    cout << n - ma << endl;

}


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

using namespace std;

int k, a, b;

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);

	cin >> k;
	cin >> a >> b;
	int flag = 0;
	for (int i = a; i <= b; i++) {
		if (i % k == 0) flag = 1;
	}
	if (flag) cout << "OK";
	else cout << "NG";

	return 0;
}

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

#define REP(i,n) for(ll i=0;i<n;++i)
#define RREP(i,n) for(ll i=n-1;i>=0;--i)
#define FOR(i,m,n) for(ll i=m;i<n;++i)
#define RFOR(i,m,n) for(ll i=n-1;i>=m;--i)
#define ALL(v) (v).begin(),(v).end()
#define PB(a) push_back(a)
#define UNIQUE(v) v.erase(unique(ALL(v)),v.end());
#define DUMP(v) REP(i, (v).size()) { cout << v[i]; if (i != v.size() - 1)cout << " "; else cout << endl; }
#define INF 1000000001ll
#define MOD 1000000007ll
#define EPS 1e-9

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


using namespace std;
typedef long long ll;
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;
ll max(ll a, int b) { return max(a, ll(b)); }
ll max(int a, ll b) { return max(ll(a), b); }
ll min(ll a, int b) { return min(a, ll(b)); }
ll min(int a, ll b) { return min(ll(a), b); }
///(?´????????`)(?´????????`)(?´????????`)(?´????????`)(?´????????`)(?´????????`)///
int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n, m;
	cin >> n >> m;
	vi v(n);
	vector < bool> b(n, false);
	vi q(m);
	REP(i, m) {
		cin >> q[i];
		q[i]--;
	}
	int j = 0;
	RREP(i, m) {
		if (!b[q[i]]) {
			v[j] = q[i] + 1;
			j++;
			b[q[i]] = true;
		}
	}
	REP(i, n) {
		if (!b[i]) {
			v[j] = i + 1;
			j++;
		}
	}
	REP(i, n)cout << v[i] << "\n";
	cout << flush;
	return 0;
}

Measured memory_bytes: 4072
#include <bits/stdc++.h>
using namespace std;
#define int long long int
#define endl '\n'
#define pb push_back
#define PI 3.14159265
int M = 1000000007;
int32_t main()
{
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  string s[4];
  s[0] = "AC";
  s[1] = "WA";
  s[2] = "TLE";
  s[3] = "RE";
  map<string, int> m;
  int n;
  cin >> n;
  while (n--)
  {
    string x;
    cin >> x;
    m[x]++;
  }
  for (int i = 0; i < 4; ++i)
  {
    cout << s[i] << " x " << m[s[i]] << endl;
  }
}


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

#define d(x) cerr << #x ":" << x << endl;
#define dd(x, y) cerr << "(" #x "," #y "):(" << x << "," << y << ")" << endl
#define rep(i, n) for (int i = (int)(0); i < (int)(n); i++)
#define repp(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define all(v) v.begin(), v.end()
#define dump(v)                  \
    cerr << #v ":[ ";            \
    for (auto macro_vi : v) {    \
        cerr << macro_vi << " "; \
    }                            \
    cerr << "]" << endl;
#define ddump(v)                           \
    cerr << #v ":" << endl;                \
    for (auto macro_row : v) {             \
        cerr << "[";                       \
        for (auto macro__vi : macro_row) { \
            cerr << macro__vi << " ";      \
        }                                  \
        cerr << "]" << endl;               \
    }
using lint       = long long;
const int INF    = 1e9;
const lint LINF  = 1e18;
const lint MOD   = 1e9 + 7;
const double EPS = 1e-10;

int main() {
    int H, W;
    cin >> H >> W;
    vector<string> S(H);
    rep(i, H) cin >> S[i];
    ddump(S);

    // 状態(i,j) : 升目(i,j)にいる
    // mi_cnt(i,j) : (0,0)から(i,j)に来たとき .→# の変化の最小値
    vector<vector<lint>> mi_cnt(H, vector<lint>(W, INF));

    for (int i = 0; i < H; i++) {
        for (int j = 0; j < W; j++) {
            if (i == 0 and j == 0) {
                mi_cnt[0][0] = (S[0][0] == '#' ? 1 : 0);
                continue;
            }

            lint u = INF;
            if (0 <= i - 1)
                u = mi_cnt[i - 1][j] +
                    (S[i][j] == '#' and S[i - 1][j] == '.' ? 1 : 0);

            lint l = INF;

            if (0 <= j - 1)
                l = mi_cnt[i][j - 1] +
                    (S[i][j] == '#' and S[i][j - 1] == '.' ? 1 : 0);

            mi_cnt[i][j] = min(u, l);
        }
    }
    // ddump(mi_cnt);

    cout << mi_cnt[H - 1][W - 1] << endl;

    return 0;
}

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


void solve(long long N, std::vector<long long> A){
    vector<ll> count(N, 0);
    REP(i, N){
        A.at(i)--;
        count.at(A.at(i))++;
    }
    ll total = 0;
    REP(i, N){
        total += count.at(i) * (count.at(i) - 1) / 2;
    }
    REP(i, N){
        ll ans = total;
        const ll v = A.at(i);
        ans -= count.at(v) * (count.at(v) - 1) / 2;
        if(count.at(v) >= 3){
            ans += (count.at(v) - 1) * (count.at(v) - 2) / 2;
        }
        cout << ans << endl;
    }
}

// Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools
int main(){
    long long N;
    scanf("%lld",&N);
    std::vector<long long> A(N);
    for(int i = 0 ; i < N ; i++){
        scanf("%lld",&A[i]);
    }
    solve(N, std::move(A));
    return 0;
}


Measured memory_bytes: 5760
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <set>
#include <map>
#include <vector>
#include <algorithm>
#include <queue>
#include <cstdlib>
#include <cassert>
#include <cstdio>
#include <cmath>
#include <string>
#include <iomanip>
#include <deque>
using namespace std;
//#define int long long
void check(string cur) {
	string sav = cur;
	reverse(cur.begin(), cur.end());
	int p = 1;
	for (int i = 0; i < cur.size(); ++i) {
		if (!p) continue;
		if (cur[i] != '9') {
			cur[i]++;
			p = 0;
		}
		else cur[i] = '0';
	}
	if (p) cur.push_back('1');
	reverse(cur.begin(), cur.end());
	cout << "? " << cur << endl;
	char ans;
	cin >> ans;
	if ((p && ans == 'N') || (!p && ans == 'Y')) {
		cout << '!' << ' ' << sav << endl;
		exit(0);
	}
}
signed main() {
//#ifndef ONLINE_JUDGE
//	freopen("input.txt", "r", stdin);
//	freopen("output.txt", "w", stdout);
//#endif
	string znaem = "";
	while (true) {
		if (znaem != "") {
			check(znaem);
		}
		int bot = znaem.size() ? -1 : 0;
		int top = 9;
		while (top > bot + 1) {
			int mid = (bot + top) / 2;
			string cur = znaem;
			cur += mid + '0';
			while (cur.size() != 15) cur.push_back('9');
			cout << "? " << cur << endl;
			char ans;
			cin >> ans;
			if (ans == 'N') {
				bot = mid;
			}
			else {
				top = mid;
			}
		}
		znaem += bot + '1';
	}
}

Measured memory_bytes: 596
import math
A,B,N = map(int, input().split())

# 0,1,2..B-1 毎の繰り返しとなる
# Nの範囲で、最大はB-1が最大となるので、 min(N, B-1)

x = min(N, B-1)
ans = math.floor(A*x/B) - A*math.floor(x/B)
print(ans)


Measured memory_bytes: 9152
#define DEBUG
// #define FASTIO

#include <cstring>
#include <cassert>
#include <utility>
#include <iostream>
#include <cstdio>
#include <iomanip>
#include <bitset>
#include <chrono>
#include <cstdlib>
#include <functional>
#include <tuple>
#include <climits>
#include <limits>
#include <deque>
#include <list>
#include <array>
#include <stack>
#include <queue>
#include <random>
#include <complex>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <algorithm>

#define F first
#define S second 
#define pb push_back
#define endl "\n"

#ifdef FASTIO

#define pr(x) printf("%d", x)
#define ps    printf(" ")
#define endc  printf("\n")
#define pl(x) printf("%lld", x)
#define pf(x) printf("%lf", x)
#define sc(x) scanf("%d", &x)
#define sl(x) scanf("%lld", &x)
#define sf(x) scanf("%lf", &x)
#define IOS 

#endif

#ifndef FASTIO
    #define IOS { ios :: sync_with_stdio(false); cin.tie(0); }
#endif

#ifdef DEBUG
    #define dbg(s) {s;}
#endif

#ifndef DEBUG
    #define dbg(s)
#endif

using namespace std;

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
int grand(int x) { // from [0, n-1]
    return uniform_int_distribution<int>(0, x - 1)(rng);
}

#define int ll
#define i32 int32_t

#define all(v) (v).begin(),(v).end()

typedef long long ll;
typedef long double ld;
typedef pair< int, int > pii;
typedef pair< ll, ll > pll;

ll gcd(ll x, ll y) {
    if (x < y) return gcd(y, x);
    if (y == 0) return x;
    return gcd(y, x % y);
} 

const ll mod = 1e9 + 7;

ll modexp(ll x, ll ex) {
    ll ans = 1ll;
    while (ex > 0) {
        if (ex & 1ll) ans = (ans * x) % mod;
        ex >>= 1ll;
        x = (x * x) % mod;
    }
    return ans;
}

const int maxn = 1e6 + 7;

const ll inf = 1e9;



i32 main() {
    //freopen("<file>.in", "r", stdin);
    //freopen("<file>.out", "w", stdout);

    IOS;
    
    int S; cin >> S;
    cout << 0 << " " << 0 << endl;
    int p = inf - (S % inf);
    if (p == inf) p = 0;
    cout << inf << " " << p << endl;
    cout << 1 << " " << (S + p) / inf << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);
using namespace std;

signed main(){
    fastio
    int n;cin>>n;
    map<string,int>m;
    while(n--){
      string s;cin>>s;
      m[s]++;
    }
    cout<<m.size();
    return 0;
}

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

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



Measured memory_bytes: 3064
class Integer
  
  attr_accessor :mod
  @@mod = 10 ** 9 + 7
  @@h = Hash.new
  
  alias_method :primitive_add, :+
  def +(other)
    self.primitive_add(other) % @@mod
    # res %= @@mod if res < 0 || res >= @@mod
    # res
  end
  
  alias_method :primitive_minus, :-
  def -(other)
    self.primitive_minus(other) % @@mod
    # res %= @@mod if res < 0 || res >= @@mod
    # res
  end
  
  alias_method :primitive_times, :*
  def *(other)
    self.primitive_times(other) % @@mod
  end
  
  def /(other)
    @@h[other] ||= other.pow(@@mod-2, @@mod)
    self * @@h[other] % @@mod
  end
  
  alias_method :primitive_inspect, :inspect
  def inspect
    (self % @@mod).primitive_inspect
  end
  
  alias_method :primitive_to_s, :to_s
  def to_s
    (self % @@mod).primitive_to_s
  end
end

n, k = gets.to_s.split.map{|e|e.to_i}

ans = (k..n+1).map{|i| i * (n + n - i + 1) / 2 - i * ( i - 1 ) / 2 + 1 }.sum

puts ans

Measured memory_bytes: 16184
#include<stdio.h>
int count;

void merge(int A[], int left, int mid, int right, int n){
	
	int n1, n2, L[250001], R[250001], i, j, k;
	n1 = mid - left;
	n2 = right - mid;
	for(i = 0; i < n1; i++){
		L[i] = A[left + i];
	}
	for(i = 0; i < n2; i++){
		R[i] = A[mid + i];
	}
	L[n1] = 2000000000;
	R[n2] = 2000000000;
	i = 0;
	j = 0;
	for(k = left; k < right; k++){
		count++;
		if(L[i] <= R[j]){
			A[k] = L[i];
			i++;
		}
		else{
			A[k] = R[j];
			j++;
		}
	}
}



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



int main(void){
	
	int A[500000], n, i;
	count = 0;
	
	scanf("%d",&n);
	for(i = 0; i < n; i++){
		scanf("%d",&A[i]);
	}
	mergeSort(A, 0, n, n);
	
	for(i = 0; i < n; i++){
		if(i != 0) printf(" ");
		printf("%d", A[i]);
	}
	printf("\n");
	printf("%d\n",count);
	
	return 0;
}

Measured memory_bytes: 5588
#include<bits/stdc++.h>
//#define int long long
#define ll long long
#define fi first
#define se second
#define pb push_back
#define pii pair<int,int>
#define vi vector<int>
using namespace std;
int n,k;
int a[3003];
ll dp[3003][3003];
main() {
    ios::sync_with_stdio(0);
    cin >> n;
    int c = (n%2);
    ll s  =0;
    for (int i = 0; i < n;i++)
        cin >> a[i],s+=a[i];

    for (int r = 0; r < n ; r++)
    for (int l = r; l >= 0; l--) {
        int d = (r-l+1)%2;
        if (r == l) {if (d==c)dp[l][r] = a[l];}
        else {
            if (d == c)
                dp[l][r] = max(dp[l+1][r]+a[l],dp[l][r-1]+a[r]);
            else dp[l][r] = min(dp[l+1][r],dp[l][r-1]);
        }
    }
    cout << 2*dp[0][n-1]-s;
}


Measured memory_bytes: 49720
#include <bits/stdc++.h>
using namespace std;
int zhjz(int n,int k)
{
	int cnt=0;
	while(n!=0){
		n/=k;
		cnt++;
	}
	return cnt;
} 
int main()
{
	int n,k;
	cin>>n>>k;
	cout<<zhjz(n,k);
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n)for(long long i=0;i<(n);i++)
using namespace std;
typedef long long ll;
const int MOD=1e9+7;
const int MAX = 1000000;
const ll INF = (1LL << 31) - 1;
const double pi=acos(-1);

int main(){
  int n,k;
  cin >> n >> k;
  ll ans=0;
  ans=k*pow(k-1,n-1);
  cout << ans << endl;
}

Measured memory_bytes: 256
N = int(input())
SP = [list(map(str, input().split())) for _ in range(N)]

for i in range(N):
  SP[i].append(i+1)
  SP[i][1] = int(SP[i][1])*(-1)

ans = sorted(SP, key=lambda x:(x[0],x[1]))

for i in range(N):
  print(ans[i][2])


Measured memory_bytes: 3060
sa=gets.chomp.split("").push("A")
sb=gets.chomp.split("").push("B")
sc=gets.chomp.split("").push("C")
turn=sa
while turn.size>1
  new_turn=turn.delete_at(0)
  if new_turn=="a"
    turn=sa
  elsif new_turn=="b"
    turn=sb
  else
    turn=sc
  end
end
puts turn[0]


Measured memory_bytes: 1788
package main

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

func main() {
	sc := bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)

	a := nextInt(sc)
	b := nextInt(sc)
	
	d := a / b
	r := a % b
	f := float64(a) / float64(b)
	fmt.Printf("%d %d %f", d, r, f)
}

func nextInt(sc *bufio.Scanner) int {
	sc.Scan()
    i, e := strconv.Atoi(sc.Text())
    if e != nil {
        panic(e)
    }
    return i
}



Measured memory_bytes: 1100
#include <algorithm>
#include <cassert>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <deque>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#define FOR(i,k,n) for (int (i)=(k); (i)<(n); ++(i))
#define RFOR(i,k,n) for (int (i)=(n)-1; (i)>=(k); --(i))
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define pb push_back
#define mp make_pair
#define fst first
#define snd second
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
#define debug(x) cerr<< #x <<": "<<x<<endl
#define debug2(x,y) cerr<< #x <<": "<< x <<", "<< #y <<": "<< y <<endl
using namespace std;
//static const int INF = 1e9;
//static const double PI = acos(-1.0);
//static const double EPS = 1e-10;
//static const int dx[8] = { 1, 1, 0,-1,-1,-1, 0, 1};
//static const int dy[8] = { 0, 1, 1, 1, 0,-1,-1,-1};
typedef long long int LL;
typedef unsigned long long int ULL;
typedef vector<int> VI;

// vector
template<typename T> ostream& operator<<(ostream& s, const vector<T>& v) {
  int len = v.size();
  for (int i = 0; i < len; ++i) {
    s << v[i]; if (i < len - 1) s << "\t";
  }
  return s;
}
int main() {
  int n;
  cin >> n;
  VI a(n);
  REP(i, n) { cin >> a[i]; }
  sort(all(a));
  VI b = a;
  VI c = a;
  REP(i, n) {
    b[i] += 1;
    c[i] += 2;
  }
  int ans = 1, pre = n;
  REP(i, n) {
    if(b[i] == b[pre]) { continue; }
    else { pre = i; }

    FOR(itr, i, n) {
      if(a[itr] == a[i]) {
        ans = max(ans, itr - i + 1);
      }
      if(a[itr] == b[i]) {
        ans = max(ans, itr - i + 1);
      }
      if(a[itr] == c[i]) {
        ans = max(ans, itr - i + 1);
      }
      else if(a[itr] > b[i]) { break; }
    }
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 1408
n = int(input())

def makediv(n):
	lower_divisors , upper_divisors = [], []
	i = 1
	while i*i <= n:
		if n % i == 0:
			lower_divisors.append(i)
			if i != n // i:
				upper_divisors.append(n//i)
		i += 1
	return lower_divisors + upper_divisors[::-1]

ans = 0
for i in makediv(n):
	targ = i-1
	if targ != 0:
		if n // targ == n % targ:
			ans += targ
print(ans)

Measured memory_bytes: 9136
from itertools import*
from math import*
from collections import*
from heapq import*
from bisect import bisect_left,bisect_right
from copy import deepcopy
inf = 10**18
mod = 10**9+7
from functools import reduce
import sys
sys.setrecursionlimit(10**7)

n = int(input())
G = defaultdict(set)
color = [0]*(n)
for i in range(n-1):
    a, b, c = map(int, input().split())
    G[a-1].add((b-1, c))
    G[b-1].add((a-1, c))
def dijkstra(v):
    d = [inf] * n
    d[v] = 0
    hq =[(0,v)]

    while hq:
        u = heappop(hq)[1]
        for (v,c) in G[u]:
            if d[v] > d[u] + c:
                d[v] = d[u] +c
                heappush(hq,(d[u]+c,v))
    return d
d = dijkstra(0)
for i in range(n):
    if d[i] % 2==0:
        color[i]=0
    else:
        color[i]=1
for i in range(n):
    print(color[i])

Measured memory_bytes: 101720
#include <bits/stdc++.h>
#define ll long long
#define ld long double
#define st first
#define nd second
#define INF 1000000007LL
using namespace std;

int main(){
#ifndef LOCAL
  ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
#endif
  char a;
  cin >> a;
  if('A' <= a && a <= 'Z'){
    //  cout << char(a - 'A' + 'a') << '\n';
    cout << 'A';
  }else{
    //cout << char(a - 'a' + 'A') << '\n';
    //cout << a << '\n';
    cout << 'a';
  }
}

Measured memory_bytes: 3636
#include <iostream>
#include <sstream>
#include <vector>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <utility>
#include <map>
#include <list>
#include <climits>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <unordered_map>
#include <unordered_set>
#include <iomanip>
#include <bitset>
#include <string>

// #define cerr if(false)cerr
#define watch(x) cerr << "> " << #x << ": " << x << "\n";

using namespace std;

template <typename T>
std::ostream &operator <<(std::ostream &out, vector<T> &v) {
	for (typename vector<T>::size_type i = 0; i < v.size(); ++i)
		out << v[i] << " ";
	out << "\n";
    return out;
}
template <typename T, typename N>
std::ostream &operator <<(std::ostream &out, vector<pair<T, N> > &v) {
	for (size_t i = 0; i < v.size(); ++i)
		out << "(" << v[i].first << ", " << v[i].second << ") ";
	out << "\n";
    return out;
}
template <typename T>
std::ostream &operator <<(std::ostream &out, vector<vector<T> > &v) {
	for (size_t i = 0; i < v.size(); ++i) {
		for (size_t j = 0; j < v[i].size(); ++j) {
			out << v[i][j] << " ";
		}
		out << "\n";
	}
   	return out;
}

int main() {

	std::ios::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);

	int n;
	cin >> n;

	int a;
	vector<int> bi(n);
	for (int i = 0; i < n; ++i) {
		cin >> a;
		bi[i] = a - i - 1;
	}

	sort(bi.begin(), bi.end());
	int b = bi[n / 2];
	long long min_sadness = 0;
	for (int i = 0; i < n; ++i) {
		min_sadness += abs(bi[i] - b);
	}

	cout << min_sadness << "\n";

	return 0;

}

Measured memory_bytes: 3952
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>	
#include<map>
#include<set>
#include<utility>
#include<cmath>
#include<cstring>
#include<queue>
#include<stack>
#include<cstdio>
#include<sstream>
#include<iomanip>
#define loop(i,a,b) for(int i=a;i<b;i++) 
#define rep(i,a) loop(i,0,a)
#define pb push_back
#define mp make_pair
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)
using namespace std;
//kaewasuretyuui
typedef long long ll;
typedef pair<double,double> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<pii> vp;
typedef vector<vp> vvp;
typedef vector<string> vs;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef pair<int,pii> pip;
typedef vector<pip>vip;
const double PI=acos(-1);
const double EPS=1e-9;
const int inf=2e9;
int dx[4]={0,1,0,-1};
int dy[4]={1,0,-1,0};
int main(){
	int n,m;
	cin>>n>>m;
	vi in(m);
	rep(i,m)cin>>in[i];
	if(m==1){
		cout<<in[0]<<endl;
		if(in[0]-1){
			cout<<2<<endl;
			cout<<in[0]-1<<" "<<1<<endl;
		}else{
			cout<<1<<endl;
			cout<<1<<endl;
		}
	}else{
		vi odd,even;
		rep(i,m)if(in[i]%2)odd.pb(in[i]);
		else even.pb(in[i]);
		if(odd.size()>2){
			cout<<"Impossible"<<endl;
			return 0;
		}
		sort(all(odd));
		sort(all(even));
		vi out;
		if(odd.size()){
			out.pb(odd[0]);
			odd.erase(odd.begin());
		}else{
			out.pb(even[0]);
			even.erase(even.begin());
		}
		rep(i,even.size())out.pb(even[i]);
		rep(i,odd.size())out.pb(odd[i]);
		int N=out.size();
		rep(i,N-1)cout<<out[i]<<" ";
		cout<<out[N-1]<<endl;
		out[0]++;
		out[N-1]--;
		if(out[N-1]==0)N--;
		cout<<N<<endl;
		rep(i,N-1)cout<<out[i]<<" ";
		cout<<out[N-1]<<endl;
	}
}












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

// nPnの順列に対して処理を実行する


int main() {
    int n, x, pi = -1, qi = -1, ans = 0;
    cin >> n;
    string p, q, sp, sq;
    for(int i = 0; i < n; ++i) { 
        cin >> p;
        sp += p;
    }
    for(int i = 0; i < n; ++i) { 
        cin >> q;
        sq += q;
    }
    vector<string> pp;
    
    vector<int> v(n);
    iota(v.begin(), v.end(), 1);       // v に 1, 2, ... N を設定
    do {
        string s;
        for(auto x : v) s += to_string(x);
        pp.push_back(s);
    } while( next_permutation(v.begin(), v.end()) );   

    for(int i = 0; i < pp.size(); ++i) {
        if(pp[i] == sp) pi = i;
        if(pp[i] == sq) qi = i;
        if(pi != -1 && qi != -1) break;
    }
    cout << abs(pi-qi) << '\n';
}



Measured memory_bytes: 2424
#include<iostream>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<queue>
#include<set>
#include<stack>
#include<map>
#include<math.h>
#define EPS1 1e-6
#define EPS2 1e-9
#define EPS3 1e-15
#define fi first
#define se second
#define ff first.first
#define ss second.second
#define sf second.first
#define fs first.second
using namespace std;
typedef long double ld;
typedef long long int ll;
typedef unsigned long long int ul;
typedef pair<ld,ld> ldd;
typedef pair<double,double> dd;
typedef pair<int,int> ii;
typedef pair<int, ii> iii;
typedef vector<int> vi;
typedef pair<ld,ii> dii;

int main(){
	double a,b;
	cin>>a>>b;
	if(b == 1){
		cout<<"0\n";return 0;
	}
	int st = (ceil(b/a));
	int ans = 0;
	int i = 1;
	while(i*a - ((i-1)) <b){
		i++;
	}
	cout<<i<<"\n";
	return 0;
}

Measured memory_bytes: 256
//#pragma GCC optimize("Ofast")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,fma")
//#pragma GCC optimize("unroll-loops")

#include <bits/stdc++.h>

using namespace std;

#define PI          3.1415926535897932384626433832795l

#define pb push_back
#define mp make_pair
#define lb lower_bound // First element which is not less than val
#define ub upper_bound // First element greater than val
#define f first
#define s second

using ll = long long;
using vi = vector<int>;
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 vpii = vector<pair<int,int>>;
using vpll = vector<pair<ll,ll>>;

using pii = pair<int,int>;
using pll = pair<ll,ll>;

#define endl '\n'
#define re return
#define repz(i, a) for (ll i = 0; i < (a); i++)
#define vecin(n,v) for(ll i = 0; i < n; i++) cin>>v[i];
#define full(v) v.begin(),v.end()

void solve()
{
  ll d,t,s;
  cin >> d >> t >> s;
  if (s*t>=d)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
  
}

int main()
{
  ios_base::sync_with_stdio(false);
  // Remove for interactive problems
  cin.tie(NULL);
  cout.tie(NULL);
  ll t = 1;
  //cin >> t;
  while (t--)
  {
      solve();
  }
}





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

using namespace std;

int main() {
	ios::sync_with_stdio(false),cin.tie(0),cout .tie(0);
	static long long int n, W, w, v, dp[100200], ans;
	cin >> n >> W;
	cin >> w >> v;
	dp[w] = v;
	ans = v;
	for (int i = 1; i < n; i++){
		cin >> w >> v;
		for (int j = W; j >= w; j--){
			if (dp[j - w] || !(j - w))
				dp[j] = max(dp[j] , dp[j - w] + v);
			ans = max(ans , dp[j]);
		}
	}
	cout << ans;
}


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

using namespace std;

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

//#define ONLINE_JUDGE

#ifndef ONLINE_JUDGE
  #define db(x) cerr << #x << " == " << x << endl
  #define dbs(x) cerr << x << endl
  #define _ << ", " <<
#else
  #define db(x) ((void)0)
  #define dbs(x) ((void)0)
#endif

#define F first
#define S second
#define PB push_back
#define MP make_pair
#define INF 0x3f3f3f3f
#define INFLL 0x3f3f3f3f3f3f3f3f
#define cl(x, v) memset((x), (v), sizeof(x))
#define all(x) x.begin(),x.end()
#define sz(x) int(x.size())
#define MOD 1000000007LL
#define endl '\n'
#define mdc(a, b) (__gcd((a), (b)))
#define mmc(a, b) (( (a)/__gcd((a), (b)) )*(b))

string k;
ll memo[100010][110][2];
int n, d;

ll dp(int i, int r, bool limite){
	if(i == n){
		if(r == 0)
			return 1LL;
		else
			return 0LL;
	}
	
	if(memo[i][r][limite] != -1LL)
		return memo[i][r][limite];
	
	ll ans = 0LL;
		
	if(limite){
		for(int j=0; j < int(k[i]-'0'); j++)
			ans = (ans + dp(i+1, (r+j)%d, false) )%MOD;
			
		ans = (ans + dp(i+1, (r + int(k[i]-'0'))%d, true) )%MOD;
	}else{
		for(int j=0; j<10; j++)
			ans = (ans + dp(i+1, (r+j)%d, false) )%MOD;
	}
	
	return memo[i][r][limite] = ans;
}

int main() {	
	memset(memo, -1, sizeof(memo));
	cin.sync_with_stdio(0);
	cin.tie(0);
	
	cin >> k;
	cin >> d;
	
	n = sz(k);
		
	cout << (MOD + dp(0, 0, true)-1LL)%MOD << endl;

	return 0;	
}


Measured memory_bytes: 172928
import sys
sys.setrecursionlimit(10 ** 9)
# input = sys.stdin.readline    ####
def int1(x): return int(x) - 1
def II(): return int(input())
def MI(): return map(int, input().split())
def MI1(): return map(int1, input().split())
def LI(): return list(map(int, input().split()))
def LI1(): return list(map(int1, input().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]
def MS(): return input().split()
def LS(): return list(input())
def LLS(rows_number): return [LS() for _ in range(rows_number)]
def printlist(lst, k=' '): print(k.join(list(map(str, lst))))
INF = float('inf')
# from math import ceil, floor, log2
# from collections import deque
# from itertools import combinations as comb, combinations_with_replacement as comb_w, accumulate, product, permutations
# from heapq import heapify, heappop, heappush
# import numpy as np    # cumsum
# from bisect import bisect_left, bisect_right

def solve():
    X = II()
    if X >= 30:
        print('Yes')
    else:
        print('No')

if __name__ == '__main__':
    solve()


Measured memory_bytes: 9220
#include<map>
#include<bitset>
#include<cstdio>
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<string>
#include<chrono>
#include<stack>
#include<fstream>
#define REP(i,x,y) for(ll i=x;i<=y;i++)
#define SIZE(a) ll(a.size())
#define vll vector<ll> 
#define MEMSET(a, n, m) for(ll i=0;i<=n;i++) a[i] = m
#define BIT(n) (ll(1)<<n)
#define UNIQUE(v) v.erase(unique(v.begin(),v.end()),v.end()) 
#define UNIQUE_ARRAY(a,n) n = unique(a + 1, a + x + 1) - a - 1
#define SORT(a,n) sort(a+1,a+n+1)
#define SORT_O(a,n,order) sort(a+1,a+n+1,order)
#define PER(i,y,x) for(ll i=y;i>=x;i--)
typedef long long ll;
using namespace std;

/*
struct point
{
long long dist; long long name;
bool operator<(const point& rhs) const {
return dist > rhs.dist;
}
};
*/

ll const MOD = 1e9 + 7;
ll mod_p(ll x, ll y) {
	return (x + y) % MOD;
}
ll mod_m(ll x, ll y) {
	return x * y%MOD;
}

map<ll, ll> mp, bl;

ll f(ll n) {
	if (bl[n] == 1) {
		return mp[n];
	}
	ll ans;
	if (n % 2 == 0) {
		ans = mod_p(f(n / 2), 2 * f(n / 2 - 1));
	}
	else {
		ans = mod_p(2 * f(n / 2), f(n / 2 - 1));
	}
	bl[n] = 1;
	mp[n] = ans;
	return ans;
}

int main() {
	ll n;
	cin >> n;
	mp[0] = 1; mp[1] = 2;
	bl[0] = 1; bl[1] = 1;
	cout << f(n) << endl;
}

Measured memory_bytes: 256
<?php
//噂の嘘解放
$n = int();
$a = ints();
$xor = 0;
foreach($a as $num){
  $xor ^= $num;
}
if($xor == 0){
  echo "Yes";
}else{
  echo "No";
}

function ints(){
  return array_map("intval", explode(" ", trim(fgets(STDIN))));
}
function int(){
  return intval(trim(fgets(STDIN)));
}


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

int main() {
	int n, m;
	cin >> n >> m;
	vector<int> p(m);
	vector<vector<int>> a(n);
	vector<string> s(m);
	rep(i, m) cin >> p[i] >> s[i];
	int ac = 0, wa = 0;
	rep(i, m) {
		p[i]--;
		if(s[i] == "AC") a[p[i]].push_back(1);
		else a[p[i]].push_back(0);
	}
	rep(i, n) {
		int c = 0;
		rep(j, a[i].size()) {
			if(a[i][j]==1) {
				ac++;
				wa+=c;
				break;
			}
			c++;
		}
	}
	cout << ac << " " << wa << endl;
	return 0;
}

Measured memory_bytes: 11520
#include <iostream>
using namespace std;
int main(void){
    // Your code here!
    int x[32] = {1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
    int k;
    cin >> k;
    for(int i = 0;i < 32;i++){
        if(i == k - 1){
            cout << x[i] << endl;
        }   
    }
    return 0;
}


Measured memory_bytes: 256
using System;
using System.Linq;

namespace A
{
    class Program
    {
        static void Main(string[] args)
        {
            var N = int.Parse(Console.ReadLine());
            var txylist = Enumerable.Range(0, N)
                .Select(_ => Console.ReadLine().Split(' ').Select(int.Parse).ToArray());

            var currentT = 0;
            var currentX = 0;
            var currentY = 0;
            var can = true;
            foreach (var txy in txylist)
            {
                var t = txy[0];
                var x = txy[1];
                var y = txy[2];

                var dt = t - currentT;
                var dx = Math.Abs(x - currentX);
                var dy = Math.Abs(y - currentY);

                if (dx + dy > dt
                    || (dx + dy) % 2 != dt % 2
                    )
                {
                    can = false;
                    break;
                }
            }

            Console.WriteLine(can ? "Yes" : "No");
        }
    }
}


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


#define CHMAX(a,b) a = std::max(a,b)
#define CHMIN(a,b) a = std::min(a,b)
#define CHABS(a) a = std::abs(a) 
#define COUT(a) std::cout << a << std::endl
#define CERR(a) std::cerr << a << std::endl
#define FOR(n) for(lli i = 0; i < n; i++)

using namespace std;
using lli = long long int;
using pll = pair<lli, lli>;
using tlll = tuple<lli, lli, lli>;
using vll = vector<lli>;

lli mod197 = 1000000007LL;
lli INF = 10000000000000;

// ax + by = gcd(a,b) 最大公約数
template< typename T >
T extgcd(T a, T b, T& x, T& y) {
	T d = a;
	if (b != 0) {
		d = extgcd(b, a % b, y, x);
		y -= (a / b) * x;
	}
	else {
		x = 1;
		y = 0;
	}
	return d;
}

int main(void) {

	string s, t;
	cin >> s >> t;

	int ans = 0;

	for (int i = 0; i < 3; i++)
		ans += s[i] == t[i];

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
signed main()
{
	#ifdef LOCAL
    freopen("H_input.txt", "r", stdin);
    //freopen("B_output.txt", "w", stdout);
#endif
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n, k;
    cin >> n >> k;
    vector<int> v(n);
    for (int i=0;i<n;++i) cin >> v[i];
    deque<int> q_max, q_min;
	int ans = 0;
	bool was_sorted=false;
	for (int i=0; i < n; ++i){
		while (q_max.size() && v[i] > q_max.back()) q_max.pop_back();
		while (q_min.size() && v[i] < q_min.back()) q_min.pop_back();
		q_min.push_back(v[i]), q_max.push_back(v[i]);
		if (i > k){
			int I = i-k-1;
			if (q_min.front() == v[I]) q_min.pop_front();
			if (q_max.front() == v[I]) q_max.pop_front();
		}
		if (i < k-1) continue;
		if (i==k-1){
			if (q_min.size() >= k && q_min[q_min.size() - k] == v[i-k+1]){
				was_sorted = true;
			}
			else ans++;
		}
		else{
			//cout << q_min.front() << " " << q_max.front() << endl;
			if (q_min.front() == v[i-k] && q_max.front() == v[i]) continue;
			if (q_min.size() >= k && q_min[q_min.size() - k] == v[i-k+1]){
				was_sorted = true;
			}
			else ans++;
		}
	}
	cout << ans+was_sorted;
    return 0;
}

Measured memory_bytes: 1920
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <vector>
#include <map>
#include <queue> 
#include <stack>
#include <set>
#include <list>

using namespace std;
typedef long long ll;
#define rep(i, s, e) for (int(i) = (s); (i) <= (e); ++(i))
#define all(x) x.begin(),x.end()


int main()
{
	int n, k, q; cin >> n >> k >> q;
	vector<int> a(101010);
	fill(all(a), k - q);
	rep(i, 1, q)
	{
		int x; cin >> x;
		++a[x];
	}
	rep(i, 1, n)
	{
		if (a[i] > 0)cout << "Yes" << endl;
		else cout << "No" << endl;
	}
}

Measured memory_bytes: 1024
#include<iostream>
#include<vector>
#include<algorithm>
#include<set>
#include<map>
#include<stack>
#include<queue>
#include<math.h>
#include<bitset>
#include <numeric>
using namespace std;
using ll=long long;
using ld=long double;
using pint=pair<int,int>;
using pll=pair<ll,ll>;
#define LONG_INF 9223372036854775807
#define INF 1000000000LL
#define EPS 1e-10
#define rep(i, n) for(int i = 0; i < (int)n; i++)
#define dump(a) rep(d,a.size()){cout<<a[d];if(d!=a.size()-1)cout<<" ";else cout<<endl;}
#define all(v) v.begin(),v.end()
#define pb push_back


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

    int X, N;
    bool end=true;
    cin >> X >> N;
    vector<int> v(N);
    for(int i=0; i<N; i++){
        cin >> v[i];
        if(v[i] == X) end = false;
    }

    if(end || N==0){
        cout << X << endl;
        return 0;
    }

    sort(v.begin(), v.end());

    int a=X-1, b=X+1, p;
    rep(i, N) if(v[i]==X) p=i;
    // dump(v);

    if(0<p){
        for(int i=p-1; 0<=i; i--){
            //cout << a << " ";
            if(a == v[i]) a--;
            if(v[i] < a) break;
        }
    }
    // cout << ":" << a << endl;
    if(p<N){
        for(int i=p+1; i<N; i++){
            //cout << b << " ";
            if(b == v[i]) b++;
            if(b < v[i]) break;
        }
    }
    // cout << ":" << b << endl;
    
    if(b-X < X-a) cout << b << endl;
    else cout << a << endl;

    return 0;
}

Measured memory_bytes: 3648
N, H = list(map(int, input().split()))

swing = []
throw = []

for _ in range(N):
    a, b = list(map(int, input().split()))
    swing.append(a)
    throw.append(b)

max_swing = max(swing)
throw = sorted(throw, reverse=True)
throw = (list)(filter(lambda x: x > max_swing, throw))

#attack_co = (-H//max_swing)*(-1)


#sum_d = attack_co * max_swing

# for d in throw:
#    sum_d = sum_d - max_swing + d
#
#    over = (sum_d-H)//max_swing
#    sum_d -= over * max_swing
#    attack_co -= over

attack_co = 0
for d in throw:
    H -= d
    attack_co += 1
    if H <= 0:
        break

if H >= 0:
    attack_co += ((-H)//max_swing)*(-1)


print(attack_co)


Measured memory_bytes: 12188