akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
 
using namespace std;
using namespace __gnu_pbds;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

 
#define BOOST        ios::sync_with_stdio(false);  cin.tie(NULL); cout.tie(NULL);
#define AZ(x)        x.begin(),x.end()
#define fi           first
#define se           second
#define pb           push_back
#define emb          emblace_back
#define mp           make_pair
#define mt           make_tuple
#define debug(x)     cerr << #x << " : " << x << endl;


template<typename T> using V = vector<T>;
template<typename T, typename U> using P = pair<T,U>;

typedef long long ll;
typedef long double ld;


template<typename T>
// for super_map add a parameter U above and replace "null_type" with "U"

// set with two additional super powers
    // find_by_order(int k) - returns k'th smallest element (0-indexed)
    // order_of_key(int k) - returns number of elements strictly smaller than k.
using superset = tree <T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;


const int   mod=1e9+7,N=1e5+5;
const ll    INF = 1e14+5ll;



ll power(ll a,ll b)
{
    a = a%mod;
    ll result = 1;

    while(b)
    {
        if(b&1)
            result = (result*a);
        b >>= 1, a = (a*a);
    }
    return result;
}

ll super_rand(ll n) // Random number from set [0,n-1]
{
    uniform_int_distribution<ll> uid(0, n - 1);
    return uid(rng);
}



/*

1. Make sure you're taking all the inputs.
2. In case of nested loops, remember to use different variables.
3. If in doubt, do int -> ll
4. Don't fight the question, try solving the next one.
5. __builtin_ffs (positon of first set bit), clz (leading 0s, max->32), ctz (trailing 0s), popcount (set bits). Don't use any of these on 0;
*/



//  Don't code anything above this //

int main() 
{ 
    BOOST
    
    int n,k;
    cin>>n>>k;

    int a[n];

    for(auto &i : a)
        cin>>i;

    V<bool> dp(k+1,0); // dp[i] == if pile has i stones then first player wins  
    
    for(int i=a[0];i<=k;i++)
    {
        for(int j=0;j<n;j++)
        {
            if(a[j] > i)
                break;
            if(!dp[i-a[j]])
                    dp[i] = 1;
        }
    }

    if(dp[k])
        cout<<"First\n";
    else
        cout<<"Second\n";
    return 0;    
}


Measured memory_bytes: 256
#include <stdio.h>
#include <iostream>
#include <algorithm>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <set>
#include <map>
#include <cstdio>
#include <string>
#include <cstdlib>
#include <cstring>
#include <bits/stdc++.h>

using namespace std;
typedef long long ll;
const long double EPS = 1e-9;
const ll mod = 1e9 + 7;
const ll INF = 1e9;

#define rep(i, n) for(ll i = 0; i < n ; i++ )
#define For(i, a, b) for(ll i = (a); i < (b) ; i++ )
#define all(a) (a).begin(), (a).end()
#define rall(a) (a).rbegin(), (a).rend()

const ll MAX_N = 100000;

int main(void){
    ll a,b,c,d;
    string s,t;

    cin >> a;// >> b>> c >> d;
    //cin >> s >> t;
    cout << "ABC";
    cout << a;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < (n);i++)
#define sz(x) int(x.size())
typedef long long ll;
typedef long double ld;
typedef pair<int,int> P;

int main(){ 
  string s, t;
  cin >> s >> t;
  int res = 0;
  for (int i = 0; i < s.size(); i++) {
    if (s[i] != t[i]) res++;
  }
  cout << res << endl;
  return 0;
} 

Measured memory_bytes: 3840
#include <iostream>
#include <vector>

using namespace std;
 
int main() {
    int a, b, c, d, e;
    cin >> a >> b >> c >> d >> e;
    vector<int> input_data{a, b, c, d, e};
  
	vector<int> vec(5);
    int min_idx=0;
	for (int i = 0; i < 5; ++i) {
	    vec[i] = input_data[i] % 10;
        if (vec[i] < vec[min_idx] ){
          min_idx = i;
        }
	}
  
   if (vec[min_idx] == 0){
     int min_except_zero = 10;
     int min_except_zero_idx = 0;
     for (int i=0; i < 5; i++){
       if (vec[i] != 0 && vec[i] < min_except_zero){
         min_except_zero = vec[i];
         min_except_zero_idx = i;
       }
     }
     min_idx = min_except_zero_idx;
   }
  
   int sum_of_elems = 0;
   for (int i=0; i < 5; ++i){
   		if (i == min_idx){
          sum_of_elems += input_data[i];
        }else{
          if (vec[i] == 0){
            sum_of_elems += input_data[i];
          }else{
          	sum_of_elems += input_data[i] + 10 - vec[i];
          }
        }
   }
  
    cout << sum_of_elems << endl;

  return 0;
}


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

int main() {
	int n;
	cin >> n;
	int a[n+1];
	for(int i = 1; i < n+1; i++) cin >> a[i];
	int ans = 0;
	for(int i = 2; i < n; i++)
	{
		if(a[i] > a[i-1] && a[i] < a[i+1])
		ans++;
		
		if(a[i] < a[i-1] && a[i] > a[i+1])
		ans++;
	}
	cout << ans;
	// your code goes here
	return 0;
}

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

signed main()
{
    string a, b;
    cin >> a >> b;

    const int n = a.size();
    const int m = b.size();

    int dp[n+1][m+1];

    for(int i = 0; i <= n; ++i)
    {
        for(int j = 0; j <= m; ++j)
        {
            if(i == 0 || j == 0)
                dp[i][j] = 0;
            else if(a[i-1] == b[j-1])
                dp[i][j] = 1 + dp[i-1][j-1];
            else
                dp[i][j] = max(dp[i-1][j], dp[i][j-1]);
        }
    }

    string ans;
    ans.reserve(dp[n][m]);

    int i = n;
    int j = m;
    while(i > 0 && j > 0)
    {
        if(a[i-1] == b[j-1])
        {
            ans.push_back(a[i-1]);
            i = i-1;
            j = j-1;
        }
        else if(dp[i-1][j] > dp[i][j-1])
            i = i-1;
        else
            j = j-1;
    }

    reverse(ans.begin(), ans.end());
    cout << ans << endl;
}


Measured memory_bytes: 35456
//{{{
#include<algorithm>
#include<cmath>
#include<fstream>
#include<iomanip>
#include<iostream>
#include<map>
#include<numeric>
#include<queue>
#include<random>
#include<set>
#include<sstream>
#include<sys/time.h>
#include<unordered_map>
#include<unordered_set>
#include<vector>
using ll = long long;
enum : int { M = (int)1e9 + 7 };
enum : ll { MLL = (ll)1e18L + 9 };
using namespace std;
#ifdef LOCAL
#include"rprint2.hpp"
#else
#define FUNC(name) template <ostream& out = cout, class... T> void name(T&&...){ }
FUNC(prints) FUNC(printw) FUNC(printwe) FUNC(printb) FUNC(printbe) FUNC(printd) FUNC(printde) FUNC(printdu);
#endif
template <class S, class T>
istream& operator >> (istream& in, pair<S, T>& p){ return in >> p.first >> p.second; }
template <class T>
istream& operator >> (istream& in, vector<T>& v){ for(auto& e : v){ in >> e; } return in; }
//}}}

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int r; cin >> r;
    cout << 3 * r * r << '\n';
}


Measured memory_bytes: 888
#include <iostream>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <ctime>
using namespace std;
 
#define rep(i,a,n) for(int i=a; i<n; i++)
#define repr(i,a,n) for(int i=a; i>=n; i--)
#define pb(a) push_back(a)
#define fr first
#define sc second
#define INF 999999999
 
#define X real()
#define Y imag()
#define EPS (1e-10)
#define EQ(a,b) (abs((a) - (b)) < EPS)
#define EQV(a,b) ( EQ((a).X, (b).X) && EQ((a).Y, (b).Y) )
#define LE(n, m) ((n) < (m) + EPS)
#define GE(n, m) ((n) + EPS > (m))
 
typedef vector<int> VI;
typedef vector<VI> MAT;
typedef pair<int, int> pii;
typedef long long int ll;
 
typedef complex<double> P;
typedef pair<P, P> L;
typedef pair<P, double> C;
 
int dy[]={0, 0, 1, -1};
int dx[]={1, -1, 0, 0};
int const MOD = 1000000007;
 
namespace std {
    bool operator<(const P a, const P b) {
        return a.X != b.X ? a.X < b.X : a.Y < b.Y;
    }
}
 
int main() {
    string s;
    while(getline(cin, s)){
        stack<double> part;
        stringstream ss(s);
        string temp;
        double a, b;
        while(ss >> temp) {
            if(temp == "+") {
                b = part.top(); part.pop();
                a = part.top(); part.pop();
                part.push(a + b);
            }
            else if(temp == "-") {
                b = part.top(); part.pop();
                a = part.top(); part.pop();
                part.push(a - b);
            }
            else if(temp == "*") {
                b = part.top(); part.pop();
                a = part.top(); part.pop();
                part.push(a * b);
            }
            else if(temp == "/") {
                b = part.top(); part.pop();
                a = part.top(); part.pop();
                part.push(a / b);
            }
            else part.push(atof(temp.c_str()));
        }
        printf("%.7f\n",part.top());
    }
    return 0;
}

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

int main(){
	string s;
	char c;
	cin >> s;
	int i,n=s.size();
	vector<int> ans(n,1);
	
	if(n%2){
		s=s+'R';
	}
	c='R';
	for(i=0; i<(n+1)/2-1; i++){
		if(s[2*i]=='R' && s[2*i+1]=='R'){
			ans[2*(i+1)]+=ans[2*i];
			ans[2*i]=0;
		}
		if(s[2*i+1]=='R' && s[2*i+2]=='R'){
			ans[2*(i+1)+1]+=ans[2*i+1];
			ans[2*i+1]=0;
		}
	}
	for(i=(n+1)/2-1; i>0; i--){
		if(s[2*i+1]=='L' && s[2*i]=='L'){
			ans[2*i-1]+=ans[2*i+1];
			ans[2*i+1]=0;
		}
		if(s[2*i]=='L' && s[2*i-1]=='L'){
			ans[2*i-2]+=ans[2*i];
			ans[2*i]=0;
		}
	}
	for(i=0; i<n; i++){
		cout << ans[i] << ' ';
	}
}

Measured memory_bytes: 1024
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <cmath>
#include <map>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> plglg;
typedef pair<double, ll> pdlg;
typedef tuple<int, int, int> tiii;
typedef tuple<ll, ll, ll> tlglglg;
typedef tuple<double, double, double> tddd;
static const int giga = pow(10,9);

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

  if(x < 1200){
    cout << "ABC" << endl;
  } else {
    cout << "ARC" << endl;
  }

  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
template <typename T> void read(T &t) {
	t=0; char ch=getchar(); int f=1;
	while ('0'>ch||ch>'9') { if (ch=='-') f=-1; ch=getchar(); }
	do {(t*=10)+=ch-'0';ch=getchar();} while ('0'<=ch&&ch<='9'); t*=f;
}
typedef long long ll;
const int maxn=(2e6)+10;
int n,m,lazy[maxn],sz[maxn],ans,cnt;
ll tr[maxn];
struct node { int l,r; };
vector<node> g[maxn/4];
void pushdown(int root) {
	if (!lazy[root]) return;
	tr[root*2]+=(ll)lazy[root]*sz[root*2];
	tr[root*2+1]+=(ll)lazy[root]*sz[root*2+1];
	lazy[root*2]+=lazy[root];
	lazy[root*2+1]+=lazy[root]; lazy[root]=0;
}
void build(int l,int r,int root) {
	sz[root]=r-l+1; if (l==r) return;
	int mid=(l+r)/2; build(l,mid,root*2); build(mid+1,r,root*2+1);
}
void add(int L,int R,int l,int r,int root) {
	if (L<=l&&r<=R) {
		tr[root]+=sz[root]; lazy[root]++; return;
	} pushdown(root);
	int mid=(l+r)/2;
	if (L<=mid) add(L,R,l,mid,root*2);
	if (mid<R) add(L,R,mid+1,r,root*2+1);
	tr[root]=tr[root*2]+tr[root*2+1];
}
int query(int x,int l,int r,int root) {
	if (l==r) return tr[root];
	pushdown(root);
	int mid=(l+r)/2;
	if (x<=mid) return query(x,l,mid,root*2);
	return query(x,mid+1,r,root*2+1);
}
int main() {
	//freopen("1.txt","r",stdin);
	read(m); read(n);
	int x,y;
	for (int i=1;i<=m;i++) {
		read(x); read(y);
		g[y-x+1].push_back((node){x,y});
	} build(1,n,1);
	for (int i=1;i<=n;i++) {
		for (int j=0;j<g[i].size();j++)
			add(g[i][j].l,g[i][j].r,1,n,1),m--;
		ans=m;
		for (int j=i;j<=n;j+=i)
			ans+=query(j,1,n,1);
		printf("%d\n",ans);
	}
	return 0;
}

Measured memory_bytes: 23680
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>

int descending_compare(const void *a, const void *b){
    return (int)(*(int*)b - *(int*)a);
}

int ascending_compare(const void *a, const void *b){
    return (int)*(int*)a - *(int*)b;
}

int c[10][10];
int a[200][200];

int main(void){
    int H, W;
    int i, j, k;
    int magicka = 0;
    scanf("%d %d", &H, &W);
    for (i = 0; i < 10; i++){
        for (j = 0; j < 10; j++){
            scanf("%d", &c[i][j]);
        }
    }

    for (i = 0; i < H; i++){
        for (j = 0; j < W; j++){
            scanf("%d", &a[i][j]);
        }
    }

    for (i = 0; i < 10; i++){
        for (j = 0; j < 10; j++){
            for (k = 0; k < 10; k++){
                if (c[j][k] > c[j][i]+c[i][k]){
                    c[j][k] = c[j][i]+c[i][k];
                }
            }
        }    
    }

    for (i = 0; i < H; i++){
        for (j = 0; j < W; j++){
            if (a[i][j] > -1 && a[i][j] != 1){
                magicka += c[a[i][j]][1];
            }
        }
    }

    printf("%d\n", magicka);

    return 0;
}


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

#define INF_LL (int64)1e18
#define INF (int32)1e9
#define REP(i, n) for(int64 i = 0;i < (n);i++)
#define FOR(i, a, b) for(int64 i = (a);i < (b);i++)
#define all(x) x.begin(),x.end()
#define fs first
#define sc second

using int32 = int_fast32_t;
using uint32 = uint_fast32_t;
using int64 = int_fast64_t;
using uint64 = uint_fast64_t;
using PII = pair<int32, int32>;
using PLL = pair<int64, int64>;

const double eps = 1e-10;

template<typename A, typename B>inline void chmin(A &a, B b){if(a > b) a = b;}
template<typename A, typename B>inline void chmax(A &a, B b){if(a < b) a = b;}

template<typename T>
vector<T> make_v(size_t a){return vector<T>(a);}

template<typename T,typename... Ts>
auto make_v(size_t a,Ts... ts){
  return vector<decltype(make_v<T>(ts...))>(a,make_v<T>(ts...));
}

template<typename T,typename U,typename... V>
typename enable_if<is_same<T, U>::value!=0>::type
fill_v(U &u,const V... v){u=U(v...);}

template<typename T,typename U,typename... V>
typename enable_if<is_same<T, U>::value==0>::type
fill_v(U &u,const V... v){
  for(auto &e:u) fill_v<T>(e,v...);
}

int main(void) {
	int64 N, M;
	while (cin >> N >> M && N+M) {
		auto pro = make_v<int64>(M, 0);
		REP(i, N) {
			int64 d, v;
			cin >> d >> v; d--;
			pro[d].push_back(v);
		}
		int64 res = 0;
		REP(i, M) {
			sort(all(pro[i]));
			res += pro[i].back();
		}
		cout << res << endl;
	}
}



Measured memory_bytes: 3100
/*
I believe on myself and I will achieve
this->author = Fuad Ashraful Mehmet, CSE ,University of Asia Pacific
Todo:
https://codeforces.com/problemset/problem/1365/E
*/
#include<bits/stdc++.h>
#define forn(i,n) for(int i=0;i<(int)n;++i)
#define all(o) (o).begin(),(o).end()
#define sz(o) (o).size() 
#define dbg(o)  cerr<<"at "<<__LINE__<<" response = "<<o<<endl;
#define pb push_back
using namespace std;

template<class T> void print(T & x){ cout << x; }
template<class T> void print(vector<T> & v) {
	cout << "{";
	if (sz(v)) print(v[0]);
	for (int i = 1; i < sz(v); i++) cout << ", ", print(v[i]);
	cout << "}\n";
}

typedef long long ll;
const int N=1e6+5;
int q,k,m,n,cs=1;

int tree[N*4];
int res[N],a[N];

int query(int l,int r,int x,int y,int nd=1)
{
	if(l>y or r<x)return 0;
	if(l>=x and r<=y) return tree[nd];

	int mid=(l+r)>>1;

	int r1=query(l,mid,x,y,nd<<1);
	int r2=query(mid+1,r,x,y,nd<<1|1);
	return max(r1,r2);
}


void update(int l,int r,int idx,int val,int nd)
{
	if(l==r)
	{
		tree[nd]=max(tree[nd],val);
		return;
	}

	int mid=(l+r)>>1;
	if(idx<=mid)
	{
		update(l,mid,idx,val,nd<<1);
	}
	else
	{
		update(mid+1,r,idx,val,nd<<1|1);
	}

	tree[nd]=max(tree[nd<<1],tree[nd<<1|1]);
	
}
void HalfDead(){
	cin>>n>>k;

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

	for(int i=1;i<=n;++i)
	{
		int lo=max(0,a[i]-k);
		int hi=min(300000,a[i]+k);
		int r=query(0,300000,lo,hi,1);
		//cout<<"R "<<r<<endl; 
		res[i]=r+1;
		//cout<<lo<<" -- "<<hi<<endl;
		update(0,300000,a[i],res[i],1);
	}

	int ans=0;
	for(int i=1;i<=n;++i)
	{
		ans=max(ans,res[i]);
	}

	cout<<ans<<"\n";
	return;
}// end func
int main()
{
	ios_base::sync_with_stdio(0); cin.tie(nullptr);  cout.tie(0);
	// cout<<setprecision(10)<<fixed;
	int tc=1;
	//cin>>tc;
	while(tc--){
		HalfDead();
	}
	  return 0;
}

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

int main(){
 int a,c,d;
  cin>>a>>c;
     if(a%3==0||c%3==0||(a+c)%3==0){
  cout<<"Possible"<<endl;
     }
  else{

       cout<<"Impossible"<<endl;
}
     }

Measured memory_bytes: 256
#include<iostream>
#include<cmath>
#define loop(i,a,b) for(int i=a;i<b;i++)
#define rep(i,a) loop(i,0,a)
using namespace std;

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

Measured memory_bytes: 256
#pragma GCC optimize ("O3")
#pragma GCC target ("avx")
//#include<bits/stdc++.h>
#include<cstdio>
#include<string>
#include<cstring>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
#define ce(x) cerr << (x) << "\n"
#define cesp(x) cerr << (x) << " "
#define pb push_back
#define mp make_pair
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
#define Would
#define you
#define please

const int dm = 1 << 22;
char dn[dm], *di = dn;

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

	//cのstringがはやいのかしら？勉強が必要ですね

	int N, K;
	char S[20];
	scanf("%d", &N);
	scanf("%d", &K);
	scanf("%s", S);
	int s = atoi(S);

	int L = strlen(S);
	S[L++] = ' ';	

	int tot = 0;
	if (K) {
		int n = 1;
		strcpy(di, S);
		di += L;
		while (n * 2 <= K) {
			strncpy(di, dn, n * L);
			di += L * n;
			n *= 2;
		}
		int nokori = K - n;
		strncpy(di, dn, nokori * L);
		di += L * nokori;
		tot += L * K;
	}

	if (N - K) {
		int n = 1;
		int p;
		if (L <= 6) {
			rep1(i, 10) if (s % i) {
				p = i;
				break;
			}
		}
		else p = 1;
		char S2[3];
		S2[0] = '0' + p;
		S2[1] = ' ';
		L = 2;
		auto dn2 = di;
		strcpy(di, S2);
		di += L;
		while (n * 2 <= N - K) {
			strncpy(di, dn2, n * L);
			di += L * n;
			n *= 2;
		}
		int nokori = N - K - n;
		strncpy(di, dn2, nokori * L);
		di += L * nokori;
		tot += L * (N - K);
	}

	fwrite(dn, 1, tot, stdout);




	Would you please return 0;
}

Measured memory_bytes: 2304
# dp[i][j][k] i枚処理した　j枚選んだ　和がk の場合の数
n,a = map(int,input().split())
dp = [[[0 for _ in range(3000)] for _ in range(n+1)] for _ in range(n+1)]
l = list(map(int,input().split()))
dp[0][0][0] = 1
s = 0
for i in range(n):
    for j in range(i+1):
        for k in range(s+1):
            if dp[i][j][k]!=0:
                dp[i+1][j][k]+=dp[i][j][k]
                dp[i+1][j+1][k+l[i]]+=dp[i][j][k]
    s+=l[i]
res = 0
for i in range(1,n+1):
    res+=dp[n][i][a*i]
print(res)

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


//c++ templte for help............................................................................................................................................
typedef long long ll;
//typedef unsigned long long ull;

//template<typename... T>
//void print1(T... t){
	//((cout<<t<<" "),...);
//}

//template<typename... T>
//void print2(T... t){
		//vector<vector<ll>> ans={t...};
		//for(ll i=0;i<(ll)ans.size();i++){
			//if(i!=0) cout<<"\t";
			//else cout<<"\t";
			//for(ll j=0;j<(ll)ans[i].size();j++){
				//cout<<ans[i][j]<<" ";
			//}
			//if(i!=(ll)ans.size()-1)
			//cout<<endl;
		//}
//}	
//#define deb(...) cout<<" [ "#__VA_ARGS__<<" : "; print1(__VA_ARGS__); cout<<"]"<<endl; 
//#define vdeb(...) cout<<" [ "#__VA_ARGS__<<" : "; print2(__VA_ARGS__); cout<<"]"<<endl;





	
 
//for loop
//#define fo(i,n) for(int i=0;i<(ll)n;i++)
//#define Fo(i,k,n) for(int i=k;i<n;i++)
 
 
//to print vector element 
//template<typename T>
//void printV(T vec){
	//fo(i,vec.size()) cout<<vec[i]<<" "<<flush;
	//cout<<endl;
	//}
	
 
//#define modulo 1000000007
//const int INF=1e9+5;
 
//iterate map
//template<typename T>
//void itR(T map){
	 //for(auto itr=map.begin();itr!=map.end();itr++){
				//deb(itr->first,itr->second);
			//}
	//cout<<endl;
//}
 
 
 
//c++ template for help...........................................................................................................................................

        
ll solve(){
	ll n;
	cin>>n;
	ll mul=1;
	vector<ll> vec(n);
	for(ll i=0;i<n;i++){
		cin>>vec[i];
		if(vec[i]==0) return 0;
	}
	

	for(int i=0;i<n-1;i++){
		mul*=vec[i];
		if(mul==0) return 0;
		ll temp=1000000000000000000/mul;
		temp/=vec[i+1];
		if(temp<1) return -1;
	}
	
	return mul*vec[n-1];
	
}







int main() {
	//stringstream ss;
	//ss<<"akhil";
	//cout<<ss.str()<<endl;
	cout<<setprecision(50);
	ios::sync_with_stdio(0);
	cin.tie(0);
	
	
	 // TESTCASE KO DEKH KA BHAUT SARA CONDITION GENERATE MAT KRO 
	 // PAPER PD CONFIRM HO JAO THORA JADA TIME HI KYU NA LGA
	 // greedy ma jadatr exceptional case check kr ke dekh lo
	 
	 // WHILE DOING THE QUESTION OF DYNAMIC PROGRAMMING GREEDY KA TRAH SOCHNA BAND KRO
	 // DP M DATA KA BHI USE KRNA PDTA HA BE BHULO MT 
	 // DP BHI WO LEETCODE WALE MATRIX KA QUESTION KI TARAH HA
	 // CONSTRAIN WILL BE THE DIMENSION OF DP
	 // DP MA STATE PTA KRO AUR PHIR FUNCTION GENERATE KRO
	 // OBJECT KO CHOOSE KIA YA NAE KIA AGAR KIA TO KYA HOGA AUR NAE KIA TO KYA HOGA
	 // KYA KYA CHEJ IMPORTANT HA WO STATE BN JYAGA AUR HUM LOG STATE KO CHANGE KR SKTA HA JYSA KNPSACK 2 WALE PROBLEM MA KIA THA
	 

	 
	//ll testCase;
	//cin>>testCase;
	//for(ll tt=0;tt<testCase;tt++){
		cout<<solve()<<endl;
	//}
	return 0;
}


Measured memory_bytes: 3996
#import math
#import bisect
#import numpy as np
#import itertools
#import copy
import sys

ipti = sys.stdin.readline
MOD = 10 ** 9 + 7
INF = float('INF')
sys.setrecursionlimit(10 ** 5)

def main():
    n = int(input())
    l = len(str(n))
    ans = 0

    for i in range(1,n+1):
        if len(str(i)) % 2 == 1:
            ans += 1

    print(ans)

if __name__ == '__main__':
    main()

Measured memory_bytes: 3064
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
#define INF 100000000
#define rep(i,s,n) for (int i = (int)(s); i < (int)(n); i++)
#define mp make_pair
ll mod = 10e9+7;
ll mod2 = 998244353;

int main(){
    int a,s,d,f,g;cin>>a>>s>>d>>f>>g;
    if (a==0) cout<<1<<endl;
    if (s==0) cout<<2<<endl;
    if (d==0) cout<<3<<endl;
    if (f==0) cout<<4<<endl;
    if (g==0) cout<<5<<endl;
}

Measured memory_bytes: 3580
#include<cstdio>
#include<iostream>
#include<algorithm>
using namespace std;
int main(void)
{
	int time=0,all;
	for(int i=0;i<4;i++)
	{
		scanf("%d",&time);
		all+=time;
	}
	printf("%d\n%d\n",all/60,all%60);
	return 0;
}
//3:13.279クリア


Measured memory_bytes: 3156
N=int(input())
s=['M','A','R','C','H']
a=[]
b=[]
ans=0
for i in range(N):
    buf=str(input())
    a.append(buf[0])

for i in s:
    b.append(a.count(i))

for i in range(3):
    for j in range(i+1,4):
        for k in range(j+1,5):
            ans += b[i]*b[j]*b[k]

print(ans)

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

#include<cstdio>
#define r(i,n) for(int i=0;i<n;i++)

int main(void){
  int a,b;
  cin>>a>>b;
  if(a*b%2==0)cout<<"Even"<<endl;
  else cout<<"Odd"<<endl;

return 0;}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < n; ++i)
#define ll long long
#define P pair<int,int>
#define fast_io ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
const int MOD = 1000000007;
const int INF = 2002002002;
const ll LLINF = 9009009009009009009;
using namespace std;

int main() {
    fast_io
    ll n, d, a;
    cin >> n >> d >> a;
    vector<pair<ll,ll>> x_h(n);
    rep(i,n) cin >> x_h[i].first >> x_h[i].second;
    sort(x_h.begin(), x_h.end());

    ll ans = 0, minus = 0, plus = 0;
    queue<pair<ll,ll>> que;
    que.emplace(0LL,0LL);

    rep(i,n) {
        ll x = x_h[i].first;
        while (que.front().first < x && que.size() != 0) {
            plus += que.front().second;
            que.pop();
        }

        ll h = x_h[i].second - minus + plus;
        if (h < 1) continue;

        ll bomb_x = x + d;
        ll bomb_xr = bomb_x + d;

        ll n_bomb = (h + a - 1) / a;
        ans += n_bomb;

        ll total_damage = n_bomb * a;
        minus += total_damage;
        que.emplace(bomb_xr, total_damage);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 4992
import core.bitop, std.algorithm, std.ascii, std.bigint, std.conv, std.math,
    std.functional, std.numeric, std.range, std.stdio, std.string, std.random,
    std.typecons, std.container, std.format;

// dfmt off
T lread(T = long)(){return readln.chomp.to!T();}
T[] lreads(T = long)(long n){return generate(()=>readln.chomp.to!T()).take(n).array();}
T[] aryread(T = long)(){return readln.split.to!(T[])();}
void scan(TList...)(ref TList Args){auto line = readln.split();
foreach (i, T; TList){T val = line[i].to!(T);Args[i] = val;}}
alias sread = () => readln.chomp();enum MOD = 10 ^^ 9 + 7;
alias PQueue(T, alias less = "a<b") = BinaryHeap!(Array!T, less);
// dfmt on

void main()
{
    long N = lread();
    auto A = aryread();
    long prev = 0;
    long ans = 1;
    foreach (i; 1 .. N)
    {
        long now = A[i] - A[i - 1];
        if (prev == 0)
        {
            prev = now;
            continue;
        }
        if (prev * now < 0)
        {
            prev = 0;
            ans++;
            continue;
        }
    }
    writeln(ans);
}


Measured memory_bytes: 4276
n=list(input())
c=0
for i in range(len(n)):
  n[i]=int(n[i])
for i in range(1,len(n)):
  if n[i]==9:c+=1
if c==len(n)-1:print(sum(n))
else:print(n[0]-1+(len(n)-1)*9)

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

int main() {
  int N;
  double total = 0;
  cin >> N;

  for (int i = 0; i < N; i++) {
    double x;
    string u;
    cin >> x >> u;
    
    if (u == "BTC") {
      x *= 380000.0;
    }
    
    total += x;
  }
  
  cout << total << endl;
}

Measured memory_bytes: 256
card = Hash.new
["S","H","C","D"].each do |s|
  1.upto(13) do |i|
    card[s + " " + i.to_s ] = false
  end
end

n = gets.chomp.to_i
n.times do
  i = gets.chomp.to_s
  card.each do |k,v|
    if k == i
      card[k] = true
    end
  end
end

card.each do |k,v|
  if v == false
    puts k
  end
end

Measured memory_bytes: 8588
<?php

$alph = explode(' ',trim(fgets(STDIN)));
$alph_rev = $alph;
sort($alph_rev);

if ($alph[0] == $alph[1]){
  echo '=';
} else if ($alph == $alph_rev){
  echo '<';
} else {
  echo '>';
}

?>

Measured memory_bytes: 4604
#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef pair<int, int> pi;
#define debug(x) cerr << #x << ": " << x << endl;
#define debug2(x, y) debug(x) debug(y);
#define repn(i, a, b) for(int i = (int)(a); i < (int)(b); i++)
#define rep(i, a) for(int i = 0; i < (int)(a); i++)
#define all(v) v.begin(), v.end() 
#define mp make_pair
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define fi first
#define se second
#define sq(x) ((x) * (x))
const int MOD = 1e9 + 7;

template<class T> T gcd(T a, T b){ return ((b == 0) ? a : gcd(b, a % b)); }

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	//freopen("input.in", "r", stdin);
	//freopen("output.out", "w", stdout);
	int n;
	cin >> n;
	vector<string> s(2);
	rep(i, 2) cin >> s[i];
	ll ans = 1;
	rep(j, n){
		if(j < (n - 1) && s[0][j] == s[0][j + 1]){
			if(!j) (ans *= 6) %= MOD;
			else{
				if(s[0][j - 1] != s[1][j - 1]){
					(ans *= 3) %= MOD;
				}
				else (ans *= 2) %= MOD;
			}
		}
		if(s[0][j] == s[1][j]){
			if(!j) (ans *= 3) %= MOD;
			else{
				if(s[0][j - 1] == s[1][j - 1]) (ans *= 2) %= MOD;
			}
		}
	}
	cout << ans % MOD << endl;
	return 0;
}
/*
Things to look out for:
	- Integer overflows
	- Array bounds
	- Special cases
Be careful!
*/


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<algorithm>

typedef long long ll;
using namespace std;
int main()
{
	int a, b, c;
	cin >> a >> b >> c;
	if (a != b && b != c && a != c) {
		cout << "3" << endl;
	}
	else if (a == b && b == c) {
		cout << "1" << endl;
	}
	else if (a == b && b != c) {
		cout << "2" << endl;
	}
	else if (a != b && b == c) {
		cout << "2" << endl;
	}
	else if (a == c && a != b && c != b) {
		cout << "2" << endl;
	}
}

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

using namespace std;

#define rep(i, n) for(int i = 0; i < (int)n; ++i)
#define FOR(i, a, b) for(int i = a; i < (int)b; ++i)

typedef long long ll;

const int Inf = 1e9;
const double EPS = 1e-9;

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    vector<ll> a(n), b(n);
    rep (i, n) cin >> a[i];
    int index = 0;
    sort(a.begin(), a.end());
    b[0] = a[0];
    FOR (i, 1, n) b[i] = b[i - 1] + a[i];
    for (int i = n - 1; i > 0; --i) {
        if (a[i] > 2 * b[i - 1]) {
            index = i;
            break;
        }
    }
    cout << n - index << endl;
    
    return 0;
}



Measured memory_bytes: 1792
/*
    Author: Alam Khan
    AUST CSE 40th Batch

*/

#include<bits/stdc++.h>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/detail/standard_policies.hpp>
using namespace __gnu_pbds;

typedef long long ll;
typedef pair<ll,ll> pll;
typedef vector<ll> vl;
typedef deque<ll> dl;
typedef stack<ll> stl;
typedef set<ll> sl;
typedef map<string, ll> msl;
typedef map<ll,ll> mll;
typedef tree<ll,null_type,less_equal<ll>,rb_tree_tag,tree_order_statistics_node_update>ordered_set;
#define sf(n)     scanf("%lld",&n)
#define sff(n,m)     scanf("%lld %lld",&n,&m)
#define sfff(n,m,r)     scanf("%lld %lld %lld",&n,&m,&r)
#define sfs(n)     scanf("%s",n)
#define pf(n)     printf("%lld\n",n)
#define pff(n,m)     printf("%lld %lld\n",n,m)
#define pfff(n,m,r)     printf("%lld %lld %lld\n",n,m,r)
#define pfs(n)     printf("%s\n",n)
#define pfcs(i,n)     printf("Case %lld: %lld\n",i,n)
#define pb     push_back
#define prf     printf
#define inf     2e18
#define low     -1000000000000
#define PI        acos(-1.0)
#define rep1(i,n) for(i=1;i<n;i++)
#define rep0(i,n) for(i=0;i<n;i++)
#define rep(i,a,n) for(i=a;i<n;i++)
#define repe1(i,n) for(i=1;i<=n;i++)
#define repe0(i,n) for(i=0;i<=n;i++)
#define repe(i,a,n) for(i=a;i<=n;i++)
#define endl  "\n"
#define FAST  ios_base::sync_with_stdio(false);cin.tie(NULL);
#define fr freopen("input.txt","r",stdin)
#define fw freopen("output.txt","w",stdout)

int main()
{
    ll i,n,t,k,j,x=0,y=0,m;
    string str;
    cin>>str;
    if(str[0]>='A' && str[0]<='Z')
        cout<<"A"<<endl;
    else cout<<"a"<<endl;
    return 0;
}



Measured memory_bytes: 3624
import std.algorithm;
import std.array;
import std.conv;
import std.math;
import std.range;
import std.stdio;
import std.string;
import std.typecons;

T read(T)() { return readln.chomp.to!T; }
T[] reads(T)() { return readln.split.to!(T[]); }
alias readint = read!int;
alias readints = reads!int;

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

T lcm(T)(T a, T b) {
    return a * (b / gcd(a, b));
}

long calc(string s, string t) {
    int slen = cast(int) s.length;
    int tlen = cast(int) t.length;
    long l = cast(long) lcm(s.length, t.length);

    char[long] d;
    for (int i = 0; i < s.length; i++) {
        long p = i * (l / slen);
        d[p] = s[i];
    }

    for (int i = 0; i < t.length; i++) {
        long p = i * (l / tlen);
        if (p in d) {
            if (d[p] != t[i]) return -1;
        }
    }

    return l;
}

void main() {
    read!string;
    auto s = read!string;
    auto t = read!string;
    writeln(calc(s, t));
}


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

int main() {
  ll a,b,c,d;
  cin >> a >> b >> c >> d;
  ll cd=abs(c*d)/__gcd(c,d);
  ll cn=b/c-(a-1)/c, dn=b/d-(a-1)/d, cdn=b/cd-(a-1)/cd;
  cout << b-a+1-(cn+dn-cdn) << endl;
}

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

int main(){
  
  int n;
  cin>>n;
  vector<int> v(n);
  
  
  double m = 0;
  int ans1 = 0;
  int ans2 = 0;
  
  for(int i=0; i<n; i++){
  	cin>>v[i];
    m += v[i]; 
  }
  
  m = m/n;
   
  int m_floor = floor(m);
  int m_ceil = ceil(m);
  
  for(int i=0; i<n; i++){
  	ans1 += (m_floor - v[i])*(m_floor - v[i]);
  	ans2 += (m_ceil - v[i])*(m_ceil - v[i]);
  }
  
  cout<<min(ans1,ans2);
  return 0; 
  
}

Measured memory_bytes: 256
#include<cstdio>
#include<map>
#include<utility>
#include<algorithm>
using namespace std;
int main(){
    int n,ans=0,p;
    long a[200000],two[32];
    map<long,int> m;
    two[0]=1;
    for(int i=1;i<32;i++){
        two[i]=two[i-1]*2;
    }
    scanf("%d",&n);
    for(int i=0;i<n;i++){
        scanf("%ld",&a[i]);
        decltype(m)::iterator it=m.find(a[i]);
        if(it!=m.end()){
            m[a[i]]++;
        }
        else{
            m.insert(make_pair(a[i],1));
        }
    }
    sort(a,a+n);
    for(int i=n-1;i>=0;i--){
        if(m[a[i]]){
            for(int j=0;j<32;j++){
                if(two[j]>a[i]){
                    p=j;
                    break;
                }
            }
            decltype(m)::iterator it=m.find(two[p]-a[i]);
            if(it!=m.end()&&(it->second&&it->first!=a[i]||it->second>1)){
                ans++;
                m[a[i]]--;
                it->second--;
            }
        }
    }
    printf("%d\n",ans);
}

Measured memory_bytes: 14336
import sys
import numpy as np
import math  # gcdもあるよ
from collections import deque
from collections import defaultdict
from copy import deepcopy
from itertools import accumulate #リストを与えると累積和を返す
def input(): return sys.stdin.readline().rstrip()
from functools import lru_cache #メモ化

def main():
    l, r, d = list(map(int,input().split()))
    ans = 0
    for i in range(l, r + 1):
        #print(i)
        if i % d == 0:
            ans += 1
    print(ans)
    return 0

if __name__ == "__main__":
    main()

Measured memory_bytes: 27164
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <numeric>
#include <iomanip>
#include <bitset>

using namespace std;

typedef long long ll;

int main(){
    ll S;
    cin >> S;
    vector<int> digit_e;        // 各桁の数字を格納(逆向き)
    while(S > 0){
        digit_e.push_back(S % 10);
        S /= 10;
    }
    
    ll ans = 0;
    
    // '+'が入る場所についてbit全探索
    for(int i = 0; i < (1 << (digit_e.size() - 1)); ++i){
        ll sum = 0;                                     // このループにおける総和
        
        vector<bool> used(digit_e.size(), false);       // '+'が右側にあればtrue,それ以外はfalse
        
        for(int j = 0; j < digit_e.size() - 1; ++j){        // 一番右の数字の右には'+'は来ない
            if((1 << j) & i){       // iのj桁目のbitが立っているかどうか
                used[j] = true;     // 立っていればtrue
            }
        }
        
        ll mul = 1;     // 桁数を揃えるために掛ける数字
        ll temp = 0;    // '+'に出合うまでの一時記憶するためのオブジェクト
        for(int j = 0; j < digit_e.size(); ++j){
            if(!used[j]){
                temp += digit_e[j] * mul;
                mul *= 10;
            }
            else{
                temp += digit_e[j] * mul;
                sum += temp;
                // temp,mulを初期化
                temp = 0;
                mul = 1;
            }
        }
        sum += temp;
        
        ans += sum;
    }
    
    cout << ans << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<cmath>
#include<map>
#include<cstdio>
#include<stack>
#include<queue>
#include<fstream>
#include<cstring>
#include<deque>
#include<iomanip>
#include <numeric>
//#include<bits/stdc++.h>

using namespace std;
#define ok1 printf("ok1\n");
#define ok2 printf("ok2\n");
#define M 1000000000000000000LL
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,s,n) for(int i=(s);i<(n);i++)
#define repr(i,n) for(int i=n-1;i>=0;i--)
#define REPR(i,s,n) for(int i=(s);i>=(n);(i)--)
#define all(a) (a).begin(),(a).end()
#define reall(a) (a).rbegin(),(a).rend()
#define pb push_back
#define pf push_front
#define MIN(a,b) a=min((a),(b))
#define MAX(a,b) a=max((a),(b))
#define SIZE(v) (int)v.size()
#define Eunique(v) v.erase(unique(all(v)),v.end());
#define pvec(v) rep(i,v.size()){ cout << v[i] << " ";}
#define INF 0x3f3f3f3f
#define mset(m,v) memset(m,v,sizeof(m))

const double pi = acos(-1.0);

typedef vector<int> vi;
typedef vector<string> vs;
typedef long long ll;
typedef vector<ll> vll;
typedef vector<vi> vvi;
typedef vector<vll> vvll;
typedef deque<ll> dll;
typedef pair<ll, ll> P;
#define mod 1e9 + 7;
ll dx[4] = { 1,0,-1,0 }, dy[4] = { 0,1,0,-1 };

ll gcd(ll x, ll y)
{
	ll r;
	while ((r = x % y) != 0)
	{
		x = y;
		y = r;
	}
	return y;
}
ll lcm(ll x, ll y)
{
	x /= gcd(x, y);
	y /= gcd(x, y);
	return (x * y);
}





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

	ll a = 0, b = 0, c = 0, d, e, ans = 0,j=0, n, ret = M, m, x = 0, y = 0;
	//bool x = false;
	string s,t;
	cin >> n >> a;
	a--;
	vll v(n);
	rep(i, n) cin >> v[i];
	sort(all(v));
	rep(i, n - a) {
		ret = min(ret, v[i + a] - v[i]);
	}
	cout << ret << endl;
	return 0;
}

Measured memory_bytes: 1024
N=int(input())
A_B=[]
for i in range(N):
    A_B.append(list(map(int,input().split())))
A_B.sort(key=lambda x:x[1])
flag=1
ans=0
for i in range(N):
    ans+=A_B[i][0]
    if ans>A_B[i][1]:
        flag=0
        break
if flag:
    print('Yes')
else:
    print("No")

Measured memory_bytes: 53720
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
#define ce(x) cerr << (x) << "\n"
#define cesp(x) cerr << (x) << " "
#define Would
#define you
#define please


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

	int N;
	cin >> N;

	string S1, S2;
	cin >> S1 >> S2;

	int A[60] = {};

	int kosuu = 0;
	rep(i, S1.size()) {
		if (i + 1 != S1.size()) {
			if (S1[i] == S1[i + 1]) {
				A[kosuu] = 2;
				i++;
			}
			else {
				A[kosuu] = 1;
			}
		}
		else A[kosuu] = 1;
		kosuu++;
	}

	ll mod = 1e9 + 7;
	ll kotae;
	
	if (A[0] == 2) kotae = 6;
	else kotae = 3;

	rep1(i, kosuu - 1) {
		if (A[i - 1] == 2 && A[i] == 2) {
			kotae = (kotae * 3) % mod;
		}
		else if (A[i - 1] == 1 && A[i] == 2) {
			kotae = (kotae * 2) % mod;
		}
		else if (A[i - 1] == 1 && A[i] == 1) {
			kotae = (kotae * 2) % mod;
		}
	}

	co(kotae);

	Would you please return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n) ;i++)
#define pb push_back
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second
#define sz(x) ((int)(x).size())
using ll=long long;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
#define MOD  1000000007
const ll INF=1e18;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b){ a = b; return 1; } return 0; }




int main(int argc, char const *argv[]) {
  int a,b,t;
  cin >> a >> b >> t;
  cout << t/a*b << endl;


  return 0;
}


Measured memory_bytes: 256
fn main() {
    // 標準入力から１行読込
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();

    // 空白区切りで分割してi32に変換し、Vectorに追加していく
    let inputs: Vec<i32> = s
        .trim()
        .split_whitespace()
        .map(|e| e.parse().ok().unwrap())
        .collect();

    // Vectorの中に5と7が幾つ含まれているか数える
    let five_count: usize = inputs.iter().filter(|&n| *n == 5).count();
    let seven_count: usize = inputs.iter().filter(|&n| *n == 7).count();

    // 五七五に組み替えれる条件は5が2つ、7が1つ
    if five_count == 2 && seven_count == 1 {
        println!("YES");
    } else {
        println!("NO");
    }
}


Measured memory_bytes: 4352
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
#define ce(x) cerr << (x) << "\n"
#define cesp(x) cerr << (x) << " "
#define pb push_back
#define mp make_pair
#define Would
#define you
#define please

const int cm = 1 << 17;
char cn[cm], * ci = cn + cm, ct;
inline char getcha() {
	if (ci - cn == cm) { fread_unlocked(cn, 1, cm, stdin); ci = cn; }
	return *ci++;
}
inline int getint() {
	int A = 0;
	if (ci - cn + 16 > cm) while ((ct = getcha()) >= '0') A = A * 10 + ct - '0';
	else while ((ct = *ci++) >= '0') A = A * 10 + ct - '0';
	return A;
}

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


	int N = getint();
	int A[200001];
	rep(i, N) A[i] = getint();

	ll kotae = 0;
	int k = 0;
	int tmpx = 0;
	rep(i, N) {
		while (k < N && (A[k] & tmpx) == 0) {
			tmpx ^= A[k];
			k++;
		}
		tmpx ^= A[i];

		kotae += k - i;
	}
	co(kotae);

	Would you please return 0;
}

Measured memory_bytes: 1152
#include <iostream>
#include <vector>
#include <algorithm>
#include <math.h>
#include <climits>

using namespace std;


int main() {
  char S[4];
  cin >> S;
  
  sort(S, S+4);

  string ans = "No";
  if(S[0]==S[1] && S[2]==S[3] && S[0]!=S[3]) ans = "Yes";
  
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Scanner;

public class Main {

	void run() {
		Scanner sc = new Scanner(System.in);

		int n = sc.nextInt();
		int l = sc.nextInt();

		List<String> list = new ArrayList<String>();

		for (int i = 0; i < n; i++) {
			list.add(sc.next());
		}

		Collections.sort(list);

		for (int i = 0; i < n; i++) {
			System.out.print(list.get(i));
		}
		System.out.println();
	}

	public static void main(String[] args) {
		new Main().run();
	}

}


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

using namespace std;

int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0); cout.tie(0);
  int a, b;
  cin >> a >> b;
  int st = 1, ret = 0;
  while(st < b) {
    st -= 1;
    st += a;
    ret++;
  }
  cout << ret << "\n";
}


Measured memory_bytes: 256
using System;
using System.Collections.Generic;

class Class3
{
    static void Main(string[] args)
    {
        string[] input = Console.ReadLine().Split(' ');
        int N = int.Parse(input[0]);
        int K = int.Parse(input[1]);

        string[] input2 = Console.ReadLine().Split(' ');
        List<int> value = new List<int>();
        for (int i = 0; i < input2.Length; i++)
        {
            value.Add(int.Parse(input2[i]));
        }

        value.Sort();

        int sum = 0;
        for (int i = 0; i < K; i++)
        {
            sum += value[i];
        }

        Console.WriteLine(sum);
    }
}

Measured memory_bytes: 28172
#include<bits/stdc++.h>
using namespace std;
int main(){
    int k,x;
    cin >> k >> x;
    int min = x-k+1;
    int max = x+k-1;
    for(int i=min;i<=max;i++){
        cout << i << " ";
    }
    cout << endl;
    return 0;
}

Measured memory_bytes: 256
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")

#include <cstdio>
#include <math.h>
#include <algorithm>
#include <cstdio>
#include <set>
#include <stack>
#include <string.h>
#include <map>
#include <bitset>

using namespace std;

const int maxn=1e4+5;

int n;
pair < int, int > l[maxn];
set < pair < int, int > > s;
int boja[maxn*2];
int sad;
stack < pair < int, int > > red;
int mid;
bitset < maxn*2 > bio;

void dfs(pair < int, int > x){
//	printf("dalje: %d %d\n", x.first, x.second);
	pair < int, int > p=x;
	if(p.second<n){
		p={l[p.second].second, p.second+n};
	}
	else{
		p={l[p.second-n].first, p.second-n};
	}
	s.erase(p);
	bio[x.second]=1;
	p={x.first-mid+1, 0};
	set < pair < int, int > >::iterator it=s.lower_bound(p);
	while(it!=s.end() && (*it).first<x.first+mid){
		p=*it;
		if(p.second<n){
			p={l[p.second].second, p.second+n};
		}
		else{
			p={l[p.second-n].first, p.second-n};
		}
		if(!bio[p.second] && x.second-n!=p.second && x.second!=p.second-n){
			s.erase(it);
			dfs(p);
		}
		it=s.upper_bound(*it);
	}
	red.push(x);
}

void dfs1(pair < int, int > x){
	s.erase(x);
	boja[x.second]=sad;
	pair < int, int > p=x;
	if(p.second<n){
		p={l[p.second].second, p.second+n};
	}
	else{
		p={l[p.second-n].first, p.second-n};
	}
	pair < int, int > z={p.first-mid+1, 0};
	set < pair < int, int > >::iterator it=s.lower_bound(z);
	while(it!=s.end() && (*it).first<p.first+mid){
/*		if(mid==7630){
			cout << "pod " << p.first << " je " << (*it).first << endl;
		}*/
		if(p.second!=(*it).second){
			dfs1(*it);
		}
		it=s.upper_bound(*it);
	}
}

bool provjeri(){
	for(int i=0; i<n; i++){
		s.insert({l[i].first, i});
		s.insert({l[i].second, i+n});
	}
	pair < int, int > x;
	for(int i=0; i<n*2; i++){
		if(!bio[i]){
			if(i<n){
//				printf("sirim %d\n", l[i].first);
				dfs({l[i].first, i});
			}
			else{
//				printf("sirim %d\n", l[i].second);
				dfs({l[i-n].second, i});
			}
		}
	}
	for(int i=0; i<n; i++){
		s.insert({l[i].first, i});
		s.insert({l[i].second, i+n});
	}
	sad=1;
//	cout << red.size() << endl;
//	printf("red: ");
 	while(!red.empty()){
 //		printf("%d ", red.top().first);
		if(s.find(red.top())!=s.end()){
//			printf("ide se %d %d\n" , red.top().first, red.top().second);
			dfs1(red.top());
			sad++;
		}
		red.pop();
	}
//	printf("\n");
	bool p=1;
	for(int i=0; i<n; i++){
		if(boja[i]==boja[i+n]){
//			cout << "aha " << boja[i] << endl;
			p=0;
			break;
		}
	}
	bio.reset();
	memset(boja, 0,  sizeof(boja));
	return p;
}

int binary(){
	int lo=0, hi=1e9;
	while(lo<hi){
//		printf("na %d\n", mid);
		mid=(lo+hi)/2+1;
//		cout << mid << endl;
		if(provjeri()){
			lo=mid;
		}
		else{
			hi=mid-1;
		}
	}
	return lo;
}

int main(){
	scanf("%d", &n);
	for(int i=0; i<n; i++){
		scanf("%d%d", &l[i].first, &l[i].second);
	}
	printf("%d\n", binary());
	return 0;
}


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

int n, m, ans, x;
string s[100], t[100];
int main() {
    cin>>n;
    for(int i=0; i<n; i++)
        cin>>s[i];
    cin>>m;
    for(int i=0; i<m; i++)
        cin>>t[i];
    ans = 0;
    for(int i=0; i<n; i++){
        x = 0;
        for(int j=i; j<n; j++)
            if(s[j]==s[i])
                x++;
        for(int j=0; j<m; j++)
            if(t[j]==s[i])
                x--;
        ans = max(ans, x);
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 256