akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
 
#define sws ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define ll long long
#define vi vector<int>
#define pb push_back
#define pii pair<int, int>
#define mp make_pair
#define ff first
#define ss second
#define all(x) x.begin(), x.end()
#define sz(x) ((int) x.size())
#define fo(i, n) for( int i = 0; i < n; i++ )

const int INF = 1e9;
const ll INFLL = 0x3f3f3f3f3f3f3f3f;
const int MOD = 1e9 + 7;


int main() {sws;

    int n;
    vector<ll> suf, a;
    cin >> n;
    suf.assign(n, 0);
    a.assign(n, 0);
    fo(i, n) cin >> a[i];
    suf[n - 1] = a[n - 1];
    for ( int i = n - 2; i >= 0; i-- ) {
        suf[i] = (a[i] + suf[i + 1]) % MOD;
    }

    ll ans = 0;
    fo(i, n - 1) {
        ans += (a[i] * (suf[i + 1])) % MOD;
        ans %= MOD;
    }
    // for ( auto num : suf ) cout << num << " ";
    // cout << endl;

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 6376
#include<iostream>
using namespace std;
#include<vector>
#include<set>
#include<map>
#include<algorithm>
#include<cmath>
#define int long long int
int32_t main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	int n;
	cin>>n;
	if(n%1000==0)
	   cout<<0<<endl;
	else
	{
		int val=n/1000;
		val++;
		int answer=1000*val-n;
		cout<<answer<<endl;
	}
}


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

int main()
{
  int count = 0;
  string S;
  cin >> S;
  for (int x = 0; x < 3; x++)
  {
    if (S[x] == '1')
    {
      count++;
    }
  }
  cout << count << endl;
}


Measured memory_bytes: 3568
#include <iostream>
#include <iomanip>
#include <stdio.h>
#include <set>
#include <vector>
#include <map>
#include <cmath>
#include <algorithm>
#include <memory.h>
#include <string>
#include <sstream>
#include <cstdlib>
#include <ctime>
#include <cassert>

using namespace std;

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

#define MP make_pair
#define PB push_back
#define FF first
#define SS second

#define FORN(i, n) for (int i = 0; i <  (int)(n); i++)
#define FOR1(i, n) for (int i = 1; i <= (int)(n); i++)
#define FORD(i, n) for (int i = (int)(n) - 1; i >= 0; i--)

#define DEBUG(X) { cout << #X << " = " << (X) << endl; }
#define PR0(A,n) { cout << #A << " = "; FORN(_,n) cout << A[_] << ' '; cout << endl; }

#define MOD 1000000007
#define INF 2000000000

int GLL(LL& x) {
    return scanf("%lld", &x);
}

int GI(int& x) {
    return scanf("%d", &x);
}

const int MAXN = 100005;
LL sum[MAXN];

int n;

vector<LL> va; LL a;

int main() {
    GI(n);

    FORN(i, n) {
        GLL(a);
        va.PB(a);
    }

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

    sum[0] = va[0];
    for (int i = 1; i < n; i++) sum[i] = va[i] + sum[i-1];

    int res = 0;

    FORN(i, n) {
        LL curr = sum[i]; int j = i; bool ok = true;

        while (j < n - 1) {
            int k = upper_bound(va.begin() + j, va.end(), 2 * curr) - va.begin() - 1;
            
            if (k == j) {
                ok = false;
                break;
            }
            else {
                curr = sum[k];
                j = k;
            }
        }

        res += ok;
    }

    cout << res << "\n";
    
    return 0;
}

Measured memory_bytes: 1908
#include <iostream>

int main() {
    int n, m, k;
    std::cin >> n >> m >> k;
    long long a[n + 1], b[m + 1], max = 0, ni = 0, mi = 0;
    a[0] = 0;
    b[0] = 0;
    std::cin >> a[1];
    if (a[1] <= k) {
        ni = 1;
    }
    for (int i = 2; i <= n; i++) {
        int num;
        std::cin >> num;
        a[i] = a[i - 1] + num;
        if (a[i] <= k) {
            ni = i;
        }
    }
    std::cin >> b[1];
    if (b[1] <= k) {
        mi = 1;
    }
    for (int i = 2; i <= m; i++) {
        int num;
        std::cin >> num;
        b[i] = b[i - 1] + num;
        if (b[i] <= k) {
            mi = i;
        }
    }

    int j = mi;
    for (int i = 0; i <= ni; i++) {
        int temp = a[i];

        while (temp + b[j] > k) {
            j--;
        }
        temp += b[j];

        if (max < i + j) {
            max = i + j;
        }
    }
    std::cout << max << std::endl;
    return 0;
}

Measured memory_bytes: 6712
#include <bits/stdc++.h>
using namespace std;
typedef pair<long long, long long> P;
#define int long long
#define override_rep(i, l, r, mes, ...) mes
#define rep1(i, n) for (int i = 0; i < n; i++)
#define rep2(i, l, r) for (int i = l; i < r; i++)
#define rep(...) override_rep(__VA_ARGS__, rep2, rep1)(__VA_ARGS__)
template<typename T, typename U>
istream& operator>>(istream& in, pair<T, U>& p) {
    in >> p.first >> p.second;
    return in;
}
signed main(signed argc, char* argv[]) {
    cin.tie(0);
    ios::sync_with_stdio(false);
    const int MOD = 1000000007;
    int k;
    cin>>k;
    int sum=0;
    rep(i,1,k+1){
        rep(j,1,k+1){
            rep(l,1,k+1){
                sum+=gcd(i,gcd(j,l));
            }
        }
    }
    cout<<sum<<endl;
}


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

using namespace std;

#define FOR(i, j, k) for(int i = j; i < k; ++i)
#define rep(i, j) FOR(i, 0, j)
#define repr(i, j) for(int i = j; i >= 0; --i)
#define INF (1 << 30)
#define TMP 1000000007

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> P;

int main() {
	int a, b;
	scanf("%d %d", &a, &b);
	if((a > b && b != 1) || a == 1 && b != 1) printf("Alice\n");
	else if((a < b && a != 1) || a != 1 && b == 1) printf("Bob\n");
	else printf("Draw\n");
	return 0;
} 

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

int     main() {
        int N;
        cin >>N;
        vector<int> AP(0);
        vector<int> AM(0);
        vector<int> AZ(0);
        for (int i=0; i<N; i++) {
                int A;
                cin >>A;
                if (0<A)
                        AP.push_back(A);
                else if (0>A)
                        AM.push_back(A);
                else
                        AZ.push_back(0);
        }
        int IP=0;
        int IM=0;
        if (0!=AZ.size()) {
                for (int i=0; i<AZ.size(); i++)
                        if (AP.size()>AM.size())
                                AM.push_back(0);
                        else
                                AP.push_back(0);
        }
        if (AP.size())
                sort(AP.begin(), AP.end());
        if (AM.size()) {
                sort(AM.begin(), AM.end());
                reverse(AM.begin(), AM.end());
        }
        vector<vector<int>> B;
        if (N>1) {
                for (int i=0; i<N-1; i++) {
                        if (IP==AP.size()) {
                                //only minus
                                AP.push_back(AM.at(IM)-AM.at(IM+1));
                                B.push_back({AM.at(IM), AM.at(IM+1)});
                                IM++;
                                IM++;
                        } else if (IM==AM.size()) {
                                //only plus
                                AM.push_back(AP.at(IP)-AP.at(IP+1));
                                B.push_back({AP.at(IP), AP.at(IP+1)});
                                IP++;
                                IP++;
                        } else {
                                //both available
                                if (AP.size()-IP>AM.size()-IM) {
                                        AM.push_back(AM.at(IM)-AP.at(IP));
                                        B.push_back({AM.at(IM), AP.at(IP)});
                                } else {
                                        AP.push_back(AP.at(IP)-AM.at(IM));
                                        B.push_back({AP.at(IP),AM.at(IM)});
                                }
                                IP++;
                                IM++;
                        }
                }
        }
        if (IP==AP.size())
                cout <<AM.at(IM) <<endl;
        else
                cout <<AP.at(IP) <<endl;
        for (int i=0; i<B.size(); i++)
                cout <<B.at(i).at(0) <<' ' <<B.at(i).at(1) <<endl;
        return 0;
};

Measured memory_bytes: 8428
#include<stdio.h>

int main(){
	
int i,n,H,W;

while(1){

scanf("%d %d",&H,&W);
if(H==0 && W==0) break;

for(i=0;i<H;i++){
	for(n=0;n<W;n++){
		printf("#");
	}
	printf("\n");
}
printf("\n");

}
return 0;

}

Measured memory_bytes: 572
#include<bits/stdc++.h>
using namespace std;
#define mod 1000000007
vector<vector<int> >adjlist;
vector<vector<int> >dp;

/*
3
1 2
2 3
*/
int ways(int node,int type,int par){
    if(dp[node][type]!=-1){
        return dp[node][type];
    }
    long long ans;
    long long w0=1;
    int sz = adjlist[node].size();
    for(int i=0;i<sz;i++){
        int u = adjlist[node][i];
        if(u != par){
            w0 *= ways(u,0,node);
            w0 %= mod;
        }
    }
    ans = w0;
    long long w1=1;
    if(type==0){
        for(int i=0;i<sz;i++){
            int u = adjlist[node][i];
            if(u != par){
                w1 *= ways(u,1,node);
                w1 %=mod;
            }
        }
        ans +=w1;
        ans %=mod;
    }
    return dp[node][type] = ans;

}

void solve(){
    int n;cin>>n;
    adjlist.resize(n);
    dp.resize(n,vector<int>(2,-1));
    for(int i=0;i<n-1;i++){
        int a,b;cin>>a>>b;
        adjlist[a-1].push_back(b-1);
        adjlist[b-1].push_back(a-1);
    }
    dp.resize(n,vector<int>(2,-1));
    cout<<ways(0,0,-1)<<"\n";

}

int main(){
    cin.tie(0);
    cout.tie(0);
    cin.sync_with_stdio(0);
    cout.sync_with_stdio(0);

    cout.precision(10);
    int t=1;//cin>>t;
    while(t--){

        solve();
    }
    return 0;
}


Measured memory_bytes: 19584
#include <bits/stdc++.h>
#include <math.h>
#define PI 3.14159265358979323846264338327950288
using namespace std;

int main() {
  double A, B, H, M;
  double Asin, Acos, Bsin, Bcos;
  double lenght, Sindef, Cosdef, angle;
  cin >> A >> B >> H >> M;
  
  H += (M/60);
  angle = (H/6 - M/30)*PI;
  lenght = sqrt(A*A + B*B - 2*A*B*cos(angle));
  printf("%.19f\n",lenght);
}


Measured memory_bytes: 4184
#include <cstdio>
#include <cstring>
#include <iostream>
#include <string>
#include <cmath>
#include <bitset>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <algorithm>
#include <complex>
#include <unordered_map>
#include <unordered_set>
#include <random>
#include <cassert>
#include <fstream>
#include <utility>
#include <functional>
#include <time.h>
#include <stack>
#include <array>
#define popcount __builtin_popcount
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;
int st[3030][3030], sy[3030][3030];
int main()
{
	int n, m;
	cin>>n>>m;
	ll a[1010], b[1010], c[1010], d[1010], e[1010], f[1010];
	vector<ll> vx, vy;
	for(int i=0; i<n; i++){
		cin>>a[i]>>b[i]>>c[i];
		vx.push_back(a[i]); vx.push_back(b[i]);
		vy.push_back(c[i]);
	}
	for(int i=0; i<m; i++){
		cin>>d[i]>>e[i]>>f[i];
		vx.push_back(d[i]);
		vy.push_back(e[i]); vy.push_back(f[i]);
	}
	const ll INF=1e9+7;
	vx.push_back(-INF); vx.push_back(INF); vx.push_back(0);
	vy.push_back(-INF); vy.push_back(INF); vy.push_back(0);
	sort(vx.begin(), vx.end());
	vx.erase(unique(vx.begin(), vx.end()), vx.end());
	sort(vy.begin(), vy.end());
	vy.erase(unique(vy.begin(), vy.end()), vy.end());
	int n1=vx.size(), m1=vy.size();
	for(int i=0; i<n; i++){
		a[i]=lower_bound(vx.begin(), vx.end(), a[i])-vx.begin();
		b[i]=lower_bound(vx.begin(), vx.end(), b[i])-vx.begin();
		c[i]=lower_bound(vy.begin(), vy.end(), c[i])-vy.begin();
		st[a[i]][c[i]]++; st[b[i]][c[i]]--;
	}
	for(int i=0; i<m; i++){
		d[i]=lower_bound(vx.begin(), vx.end(), d[i])-vx.begin();
		e[i]=lower_bound(vy.begin(), vy.end(), e[i])-vy.begin();
		f[i]=lower_bound(vy.begin(), vy.end(), f[i])-vy.begin();
		sy[d[i]][e[i]]++; sy[d[i]][f[i]]--;
	}
	for(int i=0; i<m1; i++){
		for(int j=1; j<n1; j++) st[j][i]+=st[j-1][i];
	}
	for(int i=0; i<n1; i++){
		for(int j=1; j<m1; j++) sy[i][j]+=sy[i][j-1];
	}
	bool used[3030][3030]={};
	int x0=lower_bound(vx.begin(), vx.end(), 0)-vx.begin();
	int y0=lower_bound(vy.begin(), vy.end(), 0)-vy.begin();
	queue<P> que;
	que.push({x0, y0});
	used[x0][y0]=1;
	while(!que.empty()){
		P p=que.front(); que.pop();
		int x=p.first, y=p.second;
		if(x>=1 && !sy[x][y]){
			if(!used[x-1][y]){
				que.push({x-1, y}); used[x-1][y]=1;
			}
		}
		if(x+1<n1 && !sy[x+1][y]){
			if(!used[x+1][y]){
				que.push({x+1, y}); used[x+1][y]=1;
			}
		}
		if(y>=1 && !st[x][y]){
			if(!used[x][y-1]){
				que.push({x, y-1}); used[x][y-1]=1;
			}
		}
		if(y+1<m1 && !st[x][y+1]){
			if(!used[x][y+1]){
				que.push({x, y+1}); used[x][y+1]=1;
			}
		}
	}
	ll ans=0;
	for(int i=0; i<n1; i++){
		for(int j=0; j<m1; j++){
          //cout<<used[i][j];
			if(used[i][j] && (i==0 || i==n1-1 || j==0 || j==m1-1)){
				cout<<"INF"<<endl; return 0;
			}
			if(used[i][j]){
				ans+=(vx[i+1]-vx[i])*(vy[j+1]-vy[j]);
			}
		}
      //cout<<endl;
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 83820
#define DEB
#include <map>
#include <set>
#include <iostream>
#include <vector>
#include <string>
#include <cassert>

#define REP(i,m) for(int i=0;i<(m);++i)
#define REPN(i,m,in) for(int i=(in);i<(m);++i)
#define ALL(t) (t).begin(),(t).end()
#define CLR(a) memset((a),0,sizeof(a))
#define pb push_back
#define mp make_pair
#define fr first
#define sc second

using namespace std;


#ifdef DEB
#define dump(x)  cerr << #x << " = " << (x) << endl
#define prl cerr<<"called:"<< __LINE__<<endl
#define dumpR(x) cerr<<"\x1b[31m"<<#x<<" = " <<(x)<<"\x1b[39m"<<endl
#define dumpY(x) cerr<<"\x1b[33m"<<#x<<" = " <<(x)<<"\x1b[39m"<<endl
#define dumpG(x) cerr<<"\x1b[32m"<<#x<<" = " <<(x)<<"\x1b[39m"<<endl
template<class T> void debug(T a,T b){ for(;a!=b;++a) cerr<<*a<<' ';cerr<<endl;}
#else
#define dump(x) ;
#define dumpR(x) ;
#define dumpY(x) ;
#define dumpG(x) ;
#define prl ;
template<class T> void debug(T a,T b){ ;}
#endif

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

typedef long long int lint;
typedef pair<lint,lint> pi;

namespace std{
    template<class S,class T>
    ostream &operator <<(ostream& out,const pair<S,T>& a){
        out<<'('<<a.fr<<','<<a.sc<<')';
        return out;
    }
}

//const int INF=5e8;

lint INF=1e18;
int n;
lint ar[200005];
lint psum[200005];
int main(){
    cin>>n;
    REP(i,n) cin>>ar[i];
    REP(i,n) psum[i+1]=psum[i]+ar[i];

    lint res=INF;
    REP(i,n-1){
        lint l=psum[i+1],r=psum[n]-l;
        chmin(res,abs(l-r));
    }
    cout<<res<<endl;


    return 0;
}





Measured memory_bytes: 3328
#include<bits/stdc++.h>
using namespace std;
char x,y;
int main() {
	ios::sync_with_stdio(false);
	cin >> x >> y;
	if(x == y)
		cout << "=\n";
	else if(x > y)
		cout << ">\n";
	else
		cout << "<\n";
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<n;++i)
const int MOD = (long long int)1e9+7;
int main(){
	long long int n,k,cnt=0;
	cin >>n>>k;
	vector<int>a(n);
	rep(i,n)
		cin >>a[i];
	rep(i,n)//みてるかず
		rep(j,n){
			if (i<j)
				if (a[i]>a[j])
					cnt=(cnt+k*(k+1)/2) % MOD;
			if (i>j)
				if (a[i]>a[j])
					cnt=(cnt+k*(k-1)/2) % MOD;
		}
	cout <<cnt;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define GET_MACRO(_1,_2,_3,_4,_5,_6,NAME,...) NAME
#define pr(...) cerr<< GET_MACRO(__VA_ARGS__,pr6,pr5,pr4,pr3,pr2,pr1)(__VA_ARGS__) <<endl
#define pr1(a) (#a)<<"="<<(a)<<" "
#define pr2(a,b) pr1(a)<<pr1(b)
#define pr3(a,b,c) pr1(a)<<pr2(b,c)
#define pr4(a,b,c,d) pr1(a)<<pr3(b,c,d)
#define pr5(a,b,c,d,e) pr1(a)<<pr4(b,c,d,e)
#define pr6(a,b,c,d,e,f) pr1(a)<<pr5(b,c,d,e,f)
#define pr7(a,b,c,d,e,f,g) pr1(a)<<pr6(b,c,d,e,f,g)
#define pr8(a,b,c,d,e,f,g,h) pr1(a)<<pr7(b,c,d,e,f,g,h)
using namespace std;
using Int = long long;
using ll = long long;
using Double = long double;
const Int INF = (1LL<<55)+1e9; // ~ 3.6 * 1e16
const Int mod = (1e9)+7;
const Double EPS = 1e-8;
const Double PI = 6.0 * asin((Double)0.5);
using P = pair<Int,Int>;
using T = tuple<Int,Int,Int>;
template<class T> T Max(T &a,T b){return a=max(a,b);}
template<class T> T Min(T &a,T b){return a=min(a,b);}
ostream& operator<<(ostream& o,P p){return o<<"("<<p.first<<","<<p.second<<")";}
ostream& operator<<(ostream& o,T t){return o<<"("<<get<0>(t)<<","<<get<1>(t)<<","<<get<2>(t)<<")";}
istream& operator>>(istream& i,P &p){return i>>p.first>>p.second;}
ostream& operator<<(ostream& o,vector<auto> &a){Int i=0;for(auto t:a)o<<(i++?" ":"")<<t;return o;}
istream& operator>>(istream& i,vector<auto> &a){for(auto &t:a)i>>t;return i;}
void prArr(auto a,string s=" "){Int i=0;for(auto t:a)cout<<(i++?s:"")<<t;cout<<endl;}

class RSAQ{
public:
  typedef long long ll;
  ll n;
  vector<ll> dat,td;
  
  RSAQ(){n = -1;}
  RSAQ(Int n_){
    n=1;
    while(n<n_)n*=2; //要素数nを2のべき乗に
    dat.resize(2*n-1,0),td.resize(2*n-1,0);
  }
  
  //[a,b)の区間にxを加算する,query(a,b,x);
  ll add(Int a,Int b,ll x,Int k=0,Int l=0,Int r=-1){
    if(r==-1) r=n, assert(a <= n && b <= n);
    if(r<=a||b<=l)return 0;
    if(a<=l&&r<=b){
      dat[k]+=(r-l)*x; 
      td[k]+=x;
      return dat[k];
    }

    dat[k]+=(min(r,b)-max(l,a))*x;
    ll kl=k*2+1,kr=k*2+2,t=td[k]*(r-l)/2;
    dat[kl]+=t, dat[kr]+=t;
    td[kl]+=td[k], td[kr]+=td[k];
    td[k]=0;

    ll vl=add(a,b,x,k*2+1,l,(l+r)/2);
    ll vr=add(a,b,x,k*2+2,(l+r)/2,r);
    return vl+vr;
  }
  
  //[a,b)の総和を得る
  ll sum(Int a,Int b){return add(a,b,0);}
};

signed main(){
  cin.tie(0);
  ios_base::sync_with_stdio(0);
  cout << fixed << setprecision(12);

  Int n, K;
  cin>>n>>K;
  vector<Int> A(n);
  cin>>A;

  for(auto &a:A) a -= K;

  vector<P> num(n);
  num[0] = P(A[0], 0);
  for(Int i=0;i<n-1;i++) num[i+1] = P(num[i].first + A[i+1], i+1);
  sort(num.begin(), num.end());
  
  map<Int,Int> Idx;
  for(Int i=0;i<n;i++) Idx[num[i].second] = i;

  RSAQ T(n+10);
  T.add(0LL, n, 1);
  
  Int ans = 0;
  Int sum = 0;
  for(Int i=0;i<n;i++){
    Int idx = lower_bound(num.begin(), num.end(), P(sum,-INF)) - num.begin();
    ans += T.sum(idx, n);
    T.add(Idx[i], Idx[i]+1, -1);
    sum += A[i];
  }
  cout<<ans<<endl;
  
  return 0;
}


Measured memory_bytes: 25600
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <map>
#include <cmath>
using namespace std;
#define FOR(i,a,b) for(int (i)=(a);(i)<=(b);(i)++)
#define rep(i,n) FOR(i,0,n-1)
#define int long long
#define MOD 998244353
#define MAXN  100005
#define P pair<int,int>

map<int,int> mp;

signed main(){
	
	int n;cin>>n;
	int varans = 1;
	rep(i,n) 
	{
		int a;cin>>a;
		if(a%2==0) varans *= 2;
	}
	
	cout << pow(3,n)-varans << endl;
}

//cout << ans << endl;

Measured memory_bytes: 640
n, m = map(int, input().split())
ct = [0] * (n+1)
A = [True] * n
for _ in range(m):
    A[int(input())-1] = False

ct[0] = 1
mod = 1000000007
for i in range(1, n+1):
    if A[i-2] == True:
        ct[i] += ct[i-1]
    if i > 1 and A[i-3] == True:
        ct[i] += ct[i-2]
    ct[i] %= mod
print(ct[-1])

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

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

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

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

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

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

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

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

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

trait IteratorExt: Iterator + Sized {
    fn vec(self) -> Vec<Self::Item> {
        self.collect()
    }
}

impl<T: Iterator> IteratorExt for T {}

#[allow(unused)]
use std::cmp::{max, min};
#[allow(unused)]
use std::collections::HashMap;

#[allow(unused)]
fn gcd(x: i64, y: i64) -> i64 {
    if y == 0 {
        x
    } else {
        gcd(y, x % y)
    }
}

#[allow(unused)]
fn lcm(x: i64, y: i64) -> i64 {
    x * y / gcd(x, y)
}

fn main() {
    input! {
        // usize
        // n: usize,
        // vec
        // v: [i64; n],
        s: chars,
        t: chars,
    }

    let mut ans = 0;

    for i in 0..3 {
        if s[i] == t[i] {
            ans += 1;
        }
    }

    println!("{}", ans);
}


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

int main(){
  int n;
  cin >> n;
  int count=1;
  vector<char> s(n);
  for(int i=0;i<n;i++){
    cin >> s[i];
  }
  sort(s.begin(),s.end());
  for(int i=0;i<n-1;i++){
    if(s[i]!=s[i+1]){
      count ++ ;
    }
  }
  if(count==3){
    cout << "Three" << endl;
  }else{
    cout << "Four" << endl;
  }
}

Measured memory_bytes: 256
#include"iostream"
#include"vector"
#include"string"
#include"map"
#include"set"
using namespace std;
int main(){
	
	int n;
	cin >> n;
	vector<int>v(n);
	map<int, int>mp;
	int ans = true;
	for (int i = 0; i < n; i++){
		cin >> v[i];
		if (mp.find(v[i]) != mp.end())
			ans = false;
		mp[v[i]]++;
	}
	if (ans)
		cout << "YES" << endl;
	else
		cout << "NO" << endl;
	return 0;
}

Measured memory_bytes: 10368
s = list(map(int, input().split(' ')))
k = s[0]
x = s[1]

min = 1000000*-1
max =  1000000


if x-k+1 > min:
  min = x-k+1

if x+k < max:
  max = x+k

for i in range(min,max):
	print(i,end=' ')
print()
 

Measured memory_bytes: 3060
#include <iostream>
#include<string>
#include<vector>
#include<stdio.h>
#include<math.h>
#include<algorithm>
#include<limits.h>
#include<queue>
#include<set>


#define MOD 1000000007
#define DEBUG 0


using namespace std;

long long int modpow(long long int a, int n) {

	if (n == 0)return 1;
	if (n == 1) return a;

	long long int wk = modpow(a, n / 2);

	long long int ret = 0;
	if (n % 2 == 0) {
		ret = 1;
	}
	else {
		ret = a;
	}

	return (((ret * wk) % MOD) * wk) % MOD;

}

long long int gcd(long long int a, long long int b) {
	long long int tmp;
	if (a < b) {
		tmp = a;
		a = b;
		b = tmp;
	}

	long long int r = a % b;

	while (r != 0) {
		a = b;
		b = r;
		r = a % b;
	}

	return b;
}

long long int lcm(long long int a, long long int b) {

	long long int wk_int;

	wk_int = (a * b) % MOD;
	
	long long int ret;

	ret = (wk_int * modpow(gcd(a, b), MOD - 2)) % MOD;

	return ret;

}

bool isPrime(int n) {
	if (n == 1)return false;
	if (n == 2)return true;

	for (int i = 2; i * i <= n; i++) {
		if (n % i == 0)return false;
	}

	return true;
}



bool comp(const pair<long long int, vector<int>> a, const pair<long long int, vector<int>> b) {
	if (a.first != b.first) {
		return a.first < b.first;
	}
	else {
		return a.second < b.second;
	}

}





int solve(string str) {

	if (str == "") {
		return solve("3") + solve("5") + solve("7");
	}
	
	long long int num = stoi(str);

	if (num >= 1e9)return 0;
	
	



}
	





int main(){

	string str1, str2;
	cin >> str1;
	cin >> str2;

	str1 = str1 + str2;
	int a = stoi(str1);

	int wk = 0;
	while (wk * wk < a)wk++;

	if (wk * wk == a) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}
	

	return 0;
}



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

using namespace std;

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

#define FOR(i, n, m) for(ll (i)=(m);(i)<(n);++(i))
#define REP(i, n) FOR(i,n,0)
#define OF64 std::setprecision(10)

const ll MOD = 1000000007;
const ll INF = (ll) 1e15;

ll op(ll a, ll b) {
    return std::max(a, b);
}

ll e() {
    return -1;
}

ll target;

bool f(ll v) {
    return v < target;
}

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

    ll N, Q;
    cin >> N >> Q;
    vector<ll> A(N);
    REP(i, N) {
        cin >> A[i];
    }

    auto seg = atcoder::segtree<ll, op, e>(A);

    REP(_, Q) {
        ll t, a, b;
        cin >> t >> a >> b;
        if (t == 1) {
            seg.set(a - 1, b);
        }
        else if (t == 2) {
            ll m = seg.prod(a - 1, b);
            cout << m << endl;
        }
        else {
            target = b;
            ll m = seg.max_right<f>(a - 1) + 1;
            cout << m << endl;
        }
    }
    return 0;
}

Measured memory_bytes: 9024
import java.util.*;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
 
public class Main {
    public static void main(String[] args) {

        Scanner scan = new Scanner(System.in);
        int a = scan.nextInt();

        System.out.println(a + a*a + a*a*a);

    }
}

Measured memory_bytes: 35828
#include<iostream>
#include<vector>
#include<algorithm>
#include<queue>
#include<deque>
#include<cmath>
#include<map>
#include<cstring>

using namespace std;
typedef long long ll;
const int INF = 1e9;
const int MOD = 1e9 + 7;
const ll LLINF = 1LL<<60;
#define P pair<ll, ll>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define print(x) cout << (x) << endl

class mint {
    long long x;
public:
    mint(long long x=0) : x((x%MOD+MOD)%MOD) {}
    mint operator-() const {
      return mint(-x);
    }
    mint& operator+=(const mint& a) {
        if ((x += a.x) >= MOD) x -= MOD;
        return *this;
    }
    mint& operator-=(const mint& a) {
        if ((x += MOD-a.x) >= MOD) x -= MOD;
        return *this;
    }
    mint& operator*=(const  mint& a) {
        (x *= a.x) %= MOD;
        return *this;
    }
    mint operator+(const mint& a) const {
        mint res(*this);
        return res+=a;
    }
    mint operator-(const mint& a) const {
        mint res(*this);
        return res-=a;
    }
    mint operator*(const mint& a) const {
        mint res(*this);
        return res*=a;
    }
    mint pow(ll t) const {
        if (!t) return 1;
        mint a = pow(t>>1);
        a *= a;
        if (t&1) a *= *this;
        return a;
    }
    // for prime MOD
    mint inv() const {
        return pow(MOD-2);
    }
    mint& operator/=(const mint& a) {
        return (*this) *= a.inv();
    }
    mint operator/(const mint& a) const {
        mint res(*this);
        return res/=a;
    }

    friend ostream& operator<<(ostream& os, const mint& m){
        os << m.x;
        return os;
    }
};

/* -- template -- */

int main() {
    int N, M, X; cin >> N >> M >> X;
    int A[N][M], cost[N];
    for(int i = 0; i < N; ++i) {
        cin >> cost[i];
        rep(j, M)
            cin >> A[i][j];
    }
    ll ans = INF;
    for(int bit = 1; bit < (1 << N); ++bit) {
        vector<int> algo(M, 0);
        ll tmpans = 0;
        bool flg = true;
        for(int i = 0; i < N; ++i) {
            if(bit & (1 << i)) {
                tmpans += cost[i];
                rep(j, M)
                    algo[j] += A[i][j];
            }
        }
        rep(i, M) {
            if(algo[i] < X)flg = false;
        }
        if(flg) ans = min(ans, tmpans);
    }
    if(ans == INF)cout << -1 << endl;
    else cout << ans << endl;
}


Measured memory_bytes: 3636
from collections import defaultdict
n, m = map(int, input().split())
correct = set()
penalty = 0
history = defaultdict(int)
for i in range(m):
    p, s = input().split()
    if s == "AC":
        correct.add(p)
        if history[p] != -1:
            penalty += history[p]
        history[p] = -1
    else:
        if history[p] != -1:
            history[p] += 1
print(len(correct), penalty)

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

#define rep(n) for(int i=0;i<n;i++)
#define repp(j, n) for(int j=0;j<n;j++)
#define reppp(i, m, n) for(int i=m;i<=n;i++)
#define all(c) c.begin(), c.end()
#define rall(c) c.rbegin(), c.rend()
#define MOD 1000000007
#define MAX 1000000001
#define INF 1410065408
#define EPS 1e-9
 
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
struct edge{int from, to; ll cost;};

signed main(){
	ll n;
	cin >> n;
	vector<ll> a(n);
	rep(n) cin >> a[i];
	int flag = 0;
	ll ans = 1;
	int i = 1;
	while(i < n){
		if(a[i] - a[i-1] > 0){
			if(flag == -1){
				ans++;
				i++;
				if(a[i] - a[i-1] > 0){
					flag = 1;
				}else if(a[i] - a[i-1] < 0){
					flag = -1;
				}else{
					flag = 0;
				}
			}else if(flag == 0){
				flag = 1;
			}
		}else if(a[i] - a[i-1] < 0){
			if(flag == 1){
				ans++;
				i++;
				if(a[i] - a[i-1] > 0){
					flag = 1;
				}else if(a[i] - a[i-1] < 0){
					flag = -1;
				}else{
					flag = 0;
				}
			}else if(flag == 0){
				flag = -1;
			}
		}
		i++;
	}
	cout << ans;
	
}


Measured memory_bytes: 1024
def func(x, y):
    temp = 0
    for i in range(y-1, x/2, -1):
        if x-i > 0:
            temp += 1
    return temp

while(1):
    ans = 0
    n, x = map(int, raw_input().split())
    if n == 0 and x == 0:
        break
    else:
        for i in range(n, 0, -1):
            if x-i < 3:
                ans = 0
            else:
                ans += func(x-i, i)
    print ans

Measured memory_bytes: 6460
while True:
    N,X = map(int,input().split())
    if N==0 and X==0:
        break
    ans = 0
    for a in range(1,N+1):
        for b in range(1,N+1):
            if b<=a:
                continue
            c = X - (a + b)
            if c > b and c<= N:
                ans += 1
    print(ans)


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

int main() {
   int n;
   cin >> n;
   vector<int> p(n),q(n),list(n),l(n);

   for(int i=0;i<n;i++){
      cin >> p.at(i); 
   }
   for(int i=0;i<n;i++){
      cin >> q.at(i); 
      list.at(i) = i+1;
      l.at(i) = i+1;
   }
   int sump,sumq;
   sump = 0;
   sumq = 0;
   for(int i=0;i<n;i++){
      int s,pp;
      pp = p.at(i);
      s = 0;
      for(int j=0;j<l.size();j++){
         if(pp == l.at(j)){
            s = j;
         }
      }
      int z=1;
      for(int k=1;k<l.size();k++){
         z = z * k;
      }
      sump += z * s;
      l.erase(l.begin()+s);
   }

   for(int i=0;i<n;i++){
      int h,qq;
      qq = q.at(i);
      h = 0;
      for(int j=0;j<list.size();j++){
         if(qq == list.at(j)){
            h = j;
         }
      }
      int z=1;
      for(int k=1;k<list.size();k++){
         z = z * k;
      }
      sumq += z * h;
      list.erase(list.begin()+h);
   }
   cout << abs(sump-sumq) << endl;
}

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

//省略形
#define rep(i,n) for(auto i=0; i<n ; ++i)
#define REP(i,a,b) for(auto i=a; i<b; ++i)
#define all(v) (v).begin() , (v).end()
using ll = long long;
using vi = vector<int>;
using vl = vector<ll>;
using vc = vector<char>;
using vs = vector<string>;
using vvi = vector<vector<int>>;
using vvl = vector<vector<ll>>;
using vvc = vector<vector<char>>;
using pii = pair<int , int>;
using pll = pair<long long , long long>;

//よく使う定数
const int INF = 1e9;
const int MOD = 1e9+7;
//逆元
const int INV = 1e9+5;

//UnionFindTree
struct union_find{
  vector<int> data;
  union_find(int size) : data(size , -1) { }

  void merge(int x , int y){
    x = root(x); y = root(y);
    if(x == y) return;
    if(data[y] < data[x]) swap(x , y);
    data[x] += data[y];
    data[y] = x;
    return; 
  }

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

  int root(int x){
    return data[x] < 0 ? x : (data[x] = root(data[x]));
  }

  int size(int x){
    return -data[root(x)];
  }
};

//プロトタイプ宣言
void faster(void);
template <class T>
T get_digent(T);
template <class T>
T POW(T , T);
template <class T>
T modpow(T , T , T);
bool is_palindrome(string);

//メモ
//最大公約数:__gcd　|　最小公倍数:__lcm
//回文は反転させて一致すればよい


int main(){
  int n,m,sum=0,com=0,num=0;
  cin >> n >> m;
  vi a(n);
  rep(i,n){
    cin >> a[i];
    sum += a[i];
  }
  com = (sum+(4*m)-1)/(4*m);
  rep(i,n){
    if(a[i]>=com) num++;
  }
  if(num>=m) cout << "Yes";
  else cout << "No";
}























//同期解除
void faster(void){
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
}

//桁数取得
template <class T>
T get_digent(auto x){
  string s;
  s = to_string(x);
  ll digent = s.size();
  return digent;
} 

//繰り返し自乗法
template <class T>
T POW(T x, T y){
  if(y==0) return 1;
  if(y%2 == 1){
    ll temp = POW(x,y-1);
    return (temp*x);
  }
  else{
    ll temp = POW(x,y/2);
    return temp*temp;
  }
} 

//繰り返し自乗法(剰余)
template <class T>
T modpow(T x , T y , T mod){
  if(y == 0) return 1;
  if(y%2 == 1){
    ll temp = modpow(x,y-1,mod);
    return temp*x%mod;
  }
  else{
    ll temp = pow_mod(x,y/2,mod);
    return temp*temp%mod;
  }
}

bool is_palindrome(string s){
    string t(s.rbegin(),s.rend());
    return s == t;
}

Measured memory_bytes: 256
/*	ex4_2
	suzuto	*/

#include <stdio.h>
#include <math.h>

double cos_theorem_fanc(double len_1, double len_2, double angle); /*プロトタイプ宣言*/

int main(void) {
  double len_hour, len_mimute, hour, minute, ans, angle; /*変数の宣言*/

  scanf("%lf %lf %lf %lf", &len_hour, &len_mimute, &hour, &minute); /*各針の長さ、及び時刻の入力*/
  angle = hour * 30 + minute * 0.5 - minute * 6; /*時針、分針の1分あたりの角速度がそれぞれ0.5度、6度より針間の角度を正負を問わず算出*/
  ans = cos_theorem_fanc(len_hour, len_mimute, angle); /*余弦定理で針の端点間の距離を出しansに代入*/
  printf("%10.10f\n", ans); /*距離を出力*/
  return 0;
}

/*余弦定理を用いて対角の辺を算出する関数*/
double cos_theorem_fanc(double len_1, double len_2, double angle){
  double angle_modified, res_pow2, res; /*変数の宣言*/
  angle_modified = M_PI * angle / 180;
  res_pow2 = pow(len_1, 2) + pow(len_2, 2) - 2 * len_1 * len_2 * cos(angle_modified); /*x^2 + y^2 - 2xycos(t)*/
  res = sqrt(res_pow2);
  return res;
}


Measured memory_bytes: 2544
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repr(i, a, b) for(int i = a; i < b; i++)
#define  all(x) (x).begin(),(x).end()     // 昇順ソート
#define  rall(v) (v).rbegin(), (v).rend() // 降順ソート
#define  FastIO ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0)
typedef long long ll;
typedef long long int lli;
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return true; } return false; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return true; } return false; }

int main(){
    int n;
    cin >> n;
    string s;
    cin >> s;
    int cnt = 0;
    rep(i, n-2){
        string si;
        si = s.substr(i, 3);
        if (si == "ABC") cnt++;
    }
    cout << cnt << endl;
}

Measured memory_bytes: 256
// AOJ 1231: Super Star
// 2017.12.18 bal4u@uu

#include <stdio.h>
#include <string.h>
#include <math.h>

#define EPS 1e-8

typedef struct { double x, y, z; } PP;
PP p[31];

double dist(PP a, PP b)
{
	double x = a.x - b.x;
	double y = a.y - b.y;
	double z = a.z - b.z;
	return sqrt(x*x + y*y + z*z);
}

double solve_by_movement(int n)
{
	int  k, i, t;
	PP a;
	double move, max, d;

    a.x = a.y = a.z = 50;
	move = 0.5;
	while (move > EPS) {
		for (t = 0; t < 100; t++) {
			max = 0;
			for (i = 0; i < n; i++) {
				if ((d = dist(a, p[i])) > max) max = d, k = i;
			}
			a.x += (p[k].x - a.x)*move;
			a.y += (p[k].y - a.y)*move;
			a.z += (p[k].z - a.z)*move;
		}
		move /= 2;
	}
	return max;
}

int main()
{
	int n, i;

	while(scanf("%d", &n) && n > 0) {
		for (i = 0; i < n; i++) {
			scanf("%lf%lf%lf", &p[i].x, &p[i].y, &p[i].z);
		}
		printf("%.5lf\n", solve_by_movement(n));
	}
	return 0;
}

Measured memory_bytes: 1764
/* Is it a Right Triangle? */

#include <iostream>
using namespace std;

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

  for (int i = 0; i < n; i++) {
    int a, b, c;
    int result;
    cin >> a >> b >> c;
    if (a >= b && a >= c) result = a * a - (b * b + c * c);
    else if (b >= a && b >= c) result = b * b - (a * a + c * c);
    else result = c * c - (a * a + b * b);

    if (result == 0) cout << "YES" << endl;
    else cout << "NO" << endl;
  }

  return 0;
}


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

using namespace std;

typedef long long ll;

int main ()
{
    ios_base::sync_with_stdio(false);
  //  freopen("input.txt", "r", stdin);
    int a[3];
    cin >> a[0] >> a[1] >> a[2];
    sort(a, a+3);
    int d1 = a[2] - a[0];
    int d2 = a[2] - a[1];
    int ans = d1 + d2;
    if (ans % 2 == 0) {
        cout << ans / 2;
    }
    else {
        cout << ans / 2 + 2;
    }
    return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#include <climits>
#include <cstring>
#include <cassert>

#define rep(i, m, n) for(int i=int(m);i<int(n);i++)
#define all(c) begin(c),end(c)

template<typename T1, typename T2>
inline void chmin(T1 &a, T2 b) { if (a > b) a = b; }

template<typename T1, typename T2>
inline void chmax(T1 &a, T2 b) { if (a < b) a = b; }

typedef long long int ll;
using ll = long long int;
using ull = long long unsigned int;
using Int = long long int;
using uInt = long long unsigned int;
using Double = long double;
using namespace std;
#define INF (1 << 30) - 1
#define INFl (ll)5e15
#define DEBUG 0
#define dump(x)  cerr << #x << " = " << (x) << endl
#define MOD 1000000007


//edit
class Solve {
public:
    void solve() {
        string s;
        cin >> s;
        for (auto e : s) {
            if (e == '7') {
                cout << "Yes" << endl;
                return;
            }
        }
        cout << "No" << endl;

    }
};


int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(10);
//    std::ifstream in("input.txt");
//    std::cin.rdbuf(in.rdbuf());

    Solve().solve();


    return 0;
}


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

int main() {
  int n; cin >> n;
  string s; cin >> s;
  vector<int> R(n,0);
  vector<int> G(n,0);
  vector<int> B(n,0);
  int rcnt=0, gcnt=0, bcnt=0;
  rep(i,n) {
    if (s[i] == 'R') rcnt++;
    if (s[i] == 'G') gcnt++;
    if (s[i] == 'B') bcnt++;
    R[i] = rcnt;
    G[i] = gcnt;
    B[i] = bcnt;
  }
  rep(i, n) {
    R[i] = rcnt - R[i];
    G[i] = gcnt - G[i];
    B[i] = bcnt - B[i];
 }
  ll ans = 0;
  for (int i=0; i<n-2; i++) {
    for (int j=i+1; j<n-1; j++) {
      if (s[i] != s[j]) {
        set<char> p = {s[i], s[j]};
        int k = j+j-i;
        if (!p.count('R')) { ans += R[j]; if (n > k && s[k] == 'R') ans--; }
        else if (!p.count('G')) { ans += G[j]; if (n > k && s[k] == 'G') ans--; }
        else if (!p.count('B')) { ans += B[j]; if (n > k && s[k] == 'B') ans--; }
      }
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 3652
#include<bits/stdc++.h>
#define re register
#define inc(i,j,k) for(re int i=j;i<=k;i++)
#define ll long long
using namespace std;
const int N=1e5+5;
const int lim=2200;
inline ll read(){
	ll x=0;
	char ch=getchar();
	while(ch<'0'||ch>'9') ch=getchar();
	while('0'<=ch&&ch<='9') x=x*10+ch-'0',ch=getchar();
	return x;
}
int n,tot,ans;
bool check[lim+5];
int prime[lim+1];
ll s[N],b[N][2];
map<ll,int> c;
map<ll,bool> use;
void ola(){
	inc(i,2,lim){
		if(!check[i]) prime[++tot]=i;
		inc(j,1,tot){
			if(i*prime[j]>lim) break;
			check[i*prime[j]]=1;
			if(i%prime[j]==0) break;
		}
	}
}
int main(){
	ola();n=read();
	inc(i,1,n){
		s[i]=read();
		ll x=1,y=1;
		inc(j,1,tot){
			int cnt=0;
			while(s[i]%prime[j]==0) s[i]/=prime[j],cnt++;
			if(!(cnt%=3)) continue;
			inc(k,1,cnt) x*=prime[j];
			inc(k,cnt+1,3) y*=prime[j];			
		}
		ll t=sqrt(s[i]);
		if(t*t==s[i]) x*=t*t,y*=t;
		else x*=s[i],y*=s[i]*s[i];
		b[i][0]=x,b[i][1]=y;
		c[x]++; 
	}
	inc(i,1,n){
		ll x=b[i][0],y=b[i][1];
		if(use[x]||use[y]) continue;
		if(x==1) ans++;
		else ans+=max(c[x],c[y]); 
		use[x]=use[y]=1;
	} 
	printf("%d",ans);
}

Measured memory_bytes: 27648
#include <vector>
#include <stack>
#include <queue>
#include <list>
#include <bitset>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <algorithm>
#include <numeric>
#include <iostream>
#include <iomanip>
#include <string>
#include <chrono>
#include <random>
#include <cmath>
#include <cassert>
#include <climits>
#include <cstring>
#include <cstdlib>
#include <functional>
#include <sstream>

using namespace std;



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


    int n, k;
    cin >> n >> k;

    vector<int> cnts(n, 0);
    for (int i = 0; i < k; ++i) {
        int m;
        cin >> m;
        for (int j = 0; j < m; ++j) {
            int x;
            cin >> x;
            --x;
            cnts[x] += 1;
        }
    }

    int res = 0;
    for (auto x : cnts) {
        if (x == 0) {
            ++res;
        }
    }

    cout << res << '\n';

    return 0;
}

Measured memory_bytes: 3648
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>

using namespace std;

typedef long long ll;

const ll MOD = (ll) 1e9 + 7;

int main() {
    int n, a, b;
    string s;
    cin >> n >> a >> b >>  s;

    int cnt = 0, cnt_f = 0;
    for (int i = 0; i < n; ++i) {
        if (s[i] == 'c' || cnt >= a + b) cout << "No" << endl;
        else if(s[i] == 'a'){
            cout << "Yes" << endl;
            ++cnt;
        }else if (cnt_f < b){
            cout << "Yes" << endl;
            ++cnt;
            ++cnt_f;
        }else{
            cout << "No" << endl;
        }
    }
}

Measured memory_bytes: 896
import numpy as np
N, D = map(int, input().split(" "))
City = []
count = 0

for _ in range(N):
    l = np.array([int(i) for i in input().split(" ")])
    City.append(l)

for i in range(N-1):
    for j in range(i+1,N):
        
        c = (((City[j]-City[i])**2).sum())**0.5
        if c.is_integer():
            count+=1
            
print(count)

Measured memory_bytes: 13088
// Let's bring the sky down :)
#include<bits/stdc++.h>
#define ll long long
using namespace std;
const int N = 1e6 + 5;
const ll M = 1e9 + 7;
ll power(ll x, ll y){
    x %= M;
    ll ans = 1;
    while(y){
        if(y & 1)
            ans = (ans * x) % M;
        y >>= 1LL;
        x = (x * x) % M;
    }
    return ans;
}
ll ad(ll a, ll b){
    return((a % M + b % M) % M);
}
ll sub(ll a, ll b){
    return((a % M - b % M + M) % M);
}
ll mul(ll a, ll b){
    return(((a % M) * (b % M)) % M);
}
ll divi(ll a, ll b){
    return(mul(a, power(b, M - 2)) % M);
}

vector<int> v[N], u[N];

void seive(){
    for(int i = 2; i < N; i++){
        if(v[i].size() == 0){
            for(int j = i; j < N; j += i){
                v[j].push_back(i);
            }
        }
    }
}

ll a[N];
int main()
{
    ios_base ::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
    int n;
    cin >> n;
    seive();
    map<int, int> lcm;

    for(int i = 0; i < n; i++){
        cin >> a[i];
        map<int, int> mp;
        int x = a[i];
        for(auto j : v[a[i]]){
            while(x > 1 && x % j == 0){
                mp[j]++;
                x /= j;
            }
        }
        for(auto j : mp){
            lcm[j.first] = max(lcm[j.first], j.second);
        }
    }
    ll ans = 1;
    for(auto i : lcm){
        ans = mul(ans, power(i.first, i.second));
    }
    ll res = 0;
    for(int i = 0; i < n; i++){
        res = ad(res, divi(ans, a[i]));
    }
    cout << res;
return 0;
}


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

using namespace std;
 
int cnt;
vector<int> v[100005];
bool vis[100005];
 
void dfs(int u) {
  vis[u] = true;
  for (auto &i: v[u]) {
    if (!vis[i]) {
      dfs(i);
    }
  }
}
 
int main() {
  int n, m;
  cin >> n >> m;
  for (int i = 0; i < m; i++) {
    int a, b;
    cin >> a >> b;
    a--, b--;
    v[a].emplace_back(b);
    v[b].emplace_back(a);
  }
  for (int i = 0; i < n; i++) {
    if (!vis[i]) {
      cnt++;
      dfs(i);
    }
  }
  cout << cnt - 1 << endl;
  return 0;
}

Measured memory_bytes: 9688
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
#define ll long long
#define M 1000000007
#define sz(a) (ll)a.size()
#define pll pair<ll,ll>
#define rep(i,a,b) for(ll i=(ll)a;i<(ll)b;i++)
#define sep(i,a,b) for(ll i=(ll)a;i>=(ll)b;i--)
#define mll map<ll,ll>
#define vl vector<ll>
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define all(a) a.begin(),a.end()
#define F first
#define S second
using namespace __gnu_pbds;
using namespace std;
template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    ll n;
    cin>>n;
    string s,t;
    cin>>s>>t;
    rep(i,0,n)
    {
        cout<<s[i]<<t[i];
    }
}


Measured memory_bytes: 256
#include <cstdio>
#include <string>
#include <vector>
#include <algorithm>
#include <memory.h>
#include <cmath>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <ctime>
#include <iostream>
#include <functional>
#include <complex>
#include <stdlib.h>
#include <random>
#pragma comment(linker, "/STACK:836777216")

using namespace std;

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<double, double> pdd;
typedef pair<pii, int> p3i;
typedef vector<int> vi;
typedef vector<pii> vii;
typedef vector<p3i> v3i;
typedef vector<vii> vvii;
typedef vector<p3i> vp3i;
typedef long double ld;
typedef vector<ld> vld;

#define pb push_back
#define mp make_pair
#define REP(i, n) for (int (i) = 0; (i) < (n); (i)++)
#define REPD(i, n) for (int (i) = (n) - 1; (i) >= 0; (i)--)
#define FOR(i, a, b) for (int (i) = (a); (i) < (b); (i)++)
#define FORD(i,a, b) for (int (i) = (a); (i) >= (b); (i)--)
#define sz(v) (int)(v).size()
#define all(v) (v).begin(), (v).end()
#define rv(v) reverse(all(v))
#define CL(v, val) memset((v), (val), sizeof((v)))
#define SORT(a) sort(all(a))
#define un(v) SORT(v), (v).resize(unique(all(v)) - (v).begin())
#define eps 1.0e-9
#define X first
#define Y second
#define bit(n) (1 << (n))
#define bit64(n) (ll(1) << (n))
#define sqr(x) ((x) * (x))

char s[10];

int main(void) {
	scanf("%s", &s);
	string a = (string)s;
	REP(i, 3) {
		if (a[i] == '7') {
			printf("Yes\n");
			return 0;
		}
	}

	printf("No\n");
	
	return 0;
}

Measured memory_bytes: 3692
#include <bits/stdc++.h>
        using namespace std;
   #define int long long
const int MAX = 510000;
const int MOD = 1000000007;

     signed main(){
        string s[3];
        cin>>s[0]>>s[1]>>s[2];
        cout<<char(s[0][0]+('A'-'a'))<<char(s[1][0]+('A'-'a'))<<char(s[2][0]+('A'-'a'))<<endl;
      
     }


 


 






    





      

        


Measured memory_bytes: 256
#include<stdio.h>
int main(){

  int h,n,i,a[210000], m=0;
    scanf("%d %d", &h ,&n);
  for(i=0;i<n;i++){
    scanf("%d",&a[i]);
    m+=a[i];
  }
  if(m>=h){
    printf("Yes\n");
    return 0;
  }
      printf("No\n");
    return 0;
  
}


Measured memory_bytes: 512