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

typedef long long ll;
typedef unsigned long long ull;
//typedef long double ld;

typedef map<int, int> mii;
typedef pair<int, int> pii;
typedef pair<double,double> pdd;
typedef set<int> si;
typedef set<ll> sll;
typedef vector<int> vi;
typedef vector<pair<int, int > > vii;
typedef vector<ll> vll;
typedef vector<double> vd;
typedef vector<vi> vvi;
typedef vector<vii> vvii;
typedef vector<vll> vvll;

constexpr ll MOD = 1e9+7;
constexpr int INF = 1<<30;
constexpr ll  LINF = 1LL<<60;

#define Sort(x) sort(x.begin(),x.end())
#define Reverse(x) reverse(x.begin(),x.end())
#define ABS(a,b) ((a)<(b)?(b)-(a):(a)-(b))
#define nbit(n) (1ll<<(n))

// sort(begin(x), end(x), greater<ll>());
// lower_bound(a.begin(), a.end(), val): a[i] ≥ valである最左の位置
// upper_bound(a.begin(), a.end(), val): a[i] > valである最左の位置

// Returns minimum of a and b.
// If a is less b, a is set to b.
template<typename T>
T chmin(T& a, T b) {
  if (a > b) {
    a = b;
  }
  return a;
}

// Returns maximum of a and b.
// If a is less b, a is set to b.
template<typename T>
T chmax(T& a, T b) {
  if (a < b) {
    a = b;
  }
  return a;
}

// a = (a+b)%MOD;
void addmod(ll& a, ll b) {
  a = (a+b)%MOD;
}

template <typename T>
void dumpContents(const T& v, const string& msg)
{
  cerr << "### " << msg << " ###\n";
  for (const auto& x : v) {
    cerr << x << " ";
  }
  cerr << endl;
}

struct before_main_function {
  before_main_function() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout<<setprecision(20)<<fixed;
    #define endl "\n"
  }
} before_main_function;

// ========== end of template ==========
struct Task {
  ll A;
  ll B;
};

int main(int argc, char** argv) {
  int N;
  cin >> N;

  vector<Task> tasks(N);
  for (int i=0; i<N; i++) {
    cin >> tasks[i].A >> tasks[i].B;
  }

  sort(begin(tasks), end(tasks),
       [](const Task& lhs, const Task& rhs) {
         return lhs.B < rhs.B;
       });

  ll t = 0;
  bool ok = true;
  for (auto task : tasks) {
    t += task.A;
    if (t>task.B) {
      ok = false;
      break;
    }
  }

  if (ok) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }

  return 0;
}


Measured memory_bytes: 3328
#include<cstdio>
using namespace std;
typedef long long ll;

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

int main(){
    ll a,b,c,d,ans=0;
    scanf("%lld %lld %lld %lld",&a,&b,&c,&d);
    a--;
    ans-=a;
    ans+=a/c;
    ans+=a/d;
    ans-=a/(c*d/gcd(c,d));
    ans+=b;
    ans-=b/c;
    ans-=b/d;
    ans+=b/(c*d/gcd(c,d));
    printf("%lld\n",ans);
}

Measured memory_bytes: 128
/*
    飲んだ魔剤で家が建つ。
    created at: 2020-03-25 17:30:41
*/

#include <bits/stdc++.h>
using namespace std;

#define all(x) (x).begin(),(x).end()
#define rep(x, y) for (int x = 0; x < y; x++)
#define MOD 1000000007

typedef long long LL;
typedef long double LD;

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

LL modpower(LL n, LL m, LL mod) {
    if (m == 0) {
        return 1;
    } else if (m % 2 == 0) {
        LL p = modpower(n, m/2, mod);
        return p*p % mod;
    } else {
        return n*modpower(n, m-1, mod) % mod;
    }
}

LL modinv(LL n, LL mod) {
    return modpower(n, mod-2, mod);
}

LL modcombination(LL n, LL r, LL mod) {
    LL ret = 1;

    for (int i = 0; i < r; i++) {
        ret *= (n-i);
        ret %= mod;
        ret *= modinv(i+1, mod);
        ret % mod;
    }

    return ret % mod;
}

ostringstream oss_global;
string s_global = oss_global.str();

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

    double x = (double)l/3;
    double ans = x*x*x;
    printf("%.12f\n", ans);

    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define fast ios_base::sync_with_stdio(0);cin.tie(NULL)
#define ll long long
#define fm_t  ll t;cin>>t;while(t--)
#define fr(i,a,b) for( ll i=a;i<b;i++)
#define fr1(i,n,a) for( ll i=n-1;i>=a;i--)
#define sz(x) (ll)(x).size()
#define all(v)  (v).begin(), (v).end()
#define Sort(x) sort(x.begin(),x.end())
#define ms(a) memset(a,0,sizeof(a))
#define endl '\n'
#define pb push_back
#define ff first
#define ss second
const ll mod = 998244353;
#define Mod 1000000007

#define inf 1e18
#define ld long double
#define pll pair<ll, ll> 
#define vi vector<ll>
#define vl vector<ll> 
#define vvl vector< vector<ll> > 
#define vvi vector< vector<ll> >
#define vlp vector< pair<ll, ll> >
#define vllp vector<pair<ll, ll>, ll >
#define pi pair<ll, ll>
#define ppi pair<pair<ll, ll>, ll>
#define ump unordered_map<ll,ll>
#define pri priority_queue< pair<ll,ll> , vector< pair<ll,ll> >, greater< pair<ll,ll> > >
void ingraph(vl graph[], ll m){ll x, y;fr(i,0,m){cin>>x>>y;x--, y--;graph[x].pb(y);graph[y].pb(x);}}

#define max3(a, b, c)   max(max(a, b), c)
#define min3(a, b, c)   min(min(a, b), c)

//setprecision(10)
//greater<ll>()
ll gcd(ll a, ll b){if(b==0)return a;return gcd(b, a%b);}
ll lcm(ll a, ll b){return a*b/gcd(a, b);}


ll modmulti(ll a, ll b){
   return ((a%mod)*1ll*(b%mod))%mod;
}
ll modadd(ll a, ll b){
   ll asdfgh =  ((a%mod)+(b%mod)+mod+mod)%mod;
   asdfgh = (asdfgh+mod)%mod;
   return asdfgh;
}
ll modpower(ll a, ll n){
   if(n==0) return 1;
   if(n==1) return a%mod;
   ll b = modpower(a,n/2);
   b = modmulti(b,b);
   if(n%2==0) return b;
   return modmulti(a,b);
}
ll modinv(ll a){
    return modpower(a,mod-2);
} 


ll knapSack(ll W,ll wt[],ll val[],ll n)
{
  ll dp[n+1][100005];

  //ms(dp);
  for(ll i=0;i<n;i++)
    for(ll j=0;j<100005;j++)
      dp[i][j]=inf;

  for(ll i=0;i<n;i++)
  {

    if(i==0)
    {
      dp[i][val[i]]=wt[i];
      continue;
    }
    dp[i][val[i]]=min(dp[i][val[i]],wt[i]);
    for(ll j=0;j<100005;j++)
    {
      dp[i][j]=min(dp[i-1][j],dp[i][j]);
      if(j-val[i]>0)
        dp[i][j]=min(dp[i][j],dp[i-1][j-val[i]]+wt[i]);
    }
  }
  for(ll i=100004;i>=0;i--)
  {
    if(dp[n-1][i]<=W)
      return i;
  }
 // return dp[n][W];
}  
     
int main()
{
      
  fast;
  ll n,W;
  cin>>n>>W;
  ll val[n];
  ll wt[n];
  fr(i,0,n)
  cin>>wt[i]>>val[i];
  cout<<knapSack(W,wt,val,n); 
    
    
//cerr << "Time elapsed: " << clock() / (double)CLOCKS_PER_SEC << endl;
return 0;
}

Measured memory_bytes: 81752
#include <stdio.h>
int main(){
  int n,a[100],min,i,count=0,tmp,j,flag;
  scanf("%d",&n);
  for(i=0;i<n;i++){
    scanf("%d",&a[i]);
  }
 

  for(i=0;i<n;i++){
    min=i;
    flag=0;
    for(j=i+1;j<n;j++){
      if(a[j]<a[min]){
	min=j;
	flag=1;
      }
    }
	tmp=a[i];
	a[i]=a[min];
	a[min]=tmp;
	if(flag==1)count++;
      
    }
    
  


  for(i=0;i<n;i++){
    if(i==n-1) printf("%d\n",a[i]);
    else printf("%d ",a[i]);
  }

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

  return 0;
}

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

#define st              first
#define nd              second
#define pb              push_back
#define lwb             lower_bound
#define upb             upper_bound
#define Size(a)         int((a).size())
#define reset(s, n)     memset(s, n, sizeof(s))
#define bit(n, i)       (((n) >> (i)) & 1)
#define cntbit(n)       __builtin_popcountll(n)
#define all(a)          (a).begin(), (a).end()
#define unique(a)       (a).resize(unique(all(a)) - (a).begin())
#define Max(a, b, c)    max(max((ll)(a), (ll)(b)), (ll)(c))
#define Min(a, b, c)    min(min((ll)(a), (ll)(b)), (ll)(c))

typedef long double ld;
typedef long long ll;

const int MOD = 1e9 + 7;
const ll INF = 1e18;
const ld PI = acos((ld) -1);
const ld EPS = 1e-7;
inline ll fpow(ll n, ll k, ll p = MOD) {ll r = 1; for (; k; k >>= 1) {if (k & 1) r = r * n % p; n = n * n % p;} return r;}
inline int inv(int a, ll p = MOD) {return fpow(a, p - 2, p);}
inline ll lcm(ll a, ll b) {return a / __gcd(a, b) * b;}
inline void onbit(ll &a, int i){a |= 1LL << i;}
inline void offbit(ll &a, int i){onbit(a, i), a -= (1LL << i);}

const int N = 3e5 + 5;

ll n, m, k;

int visited[N];
vector<long long> clique;
vector<long long> a;
vector<ll> f;
ll size_clique = 1;
ll root;

void dfs(ll u){
  visited[u] = 1;
  if(visited[f[u]] == 0){
    dfs(f[u]);
  } else{
    u = f[u];
    root = u;
    clique[0] = u;
    while(f[u] != root){
      u = f[u];
      clique[size_clique++] = u;
    }
  }
}

void solve(){
  clique.assign(N, 0);
  a.assign(N, 0);
  f.assign(N, 0);
  ll x;
  cin >> n >> x >> m;
  if(m == 1){
    cout << 0 << "\n";
    return;
  }
  a[1] = x;
  for(int i = 2; i < N; i++){
    long long value = (a[i - 1] * a[i - 1]) % m;
    a[i] = value;
    if(a[i] == 0){
      long long res = 0;
      for(int i = 1; i <= n; i++){
        res += a[i];
      }
      cout << res << "\n";
      return;
    }
    f[a[i - 1]] = a[i];
    if(f[a[i]] != 0){
      break;
    }
  }

  dfs(x);
  ll cnt = 0;
  long long res = 0;
  for(int i = 1; i <= n; i++){
    if(a[i] != root){
      res += a[i];
      cnt++;
    } else{
      break;
    }
  }

  for(int i = 1; i < size_clique; i++){
    clique[i] += clique[i - 1];
  }

  n -= cnt;

  ll p = n / size_clique;
  res += p * clique[size_clique - 1];

  n %= size_clique;

  if(n > 0)
    res += clique[n - 1];

  cout << res << "\n";



}

int main(){
  ios_base::sync_with_stdio(0);
  cin.tie(0); 
  cout.tie(0);
  cout << fixed << setprecision(10);
  // freopen("input.txt", "r", stdin);
  // freopen("output.txt", "w", stdout);
  int query = 1;
  // cin >> query;
  int start = 1000 * clock() / CLOCKS_PER_SEC;
  while(query--) solve();
  cerr << "\nTime elapsed: " << 1000 * clock() / CLOCKS_PER_SEC  - start << "ms\n";
}


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

int main(void){
	string a, b;
	cin >> a >> b;
	int n = atoi((a+b).c_str());
	int k = 1;
	while (k*k<=n){
		if (k*k == n) {
			cout << "Yes" << endl;
			return 0;
		}
		k++;
	}
	cout << "No" << endl;
	return 0;
}


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

const long long INF = 1LL<<60;
template<class T> inline bool chmin(T& a,T b){if(a>b){a=b;return true;}return false;}
template<class T> inline bool chmax(T& a,T b){if(a<b){a=b;return true;}return false;}

vector<long long> h(100010);
vector<long long> dp(100010,INF);
int main(){
int N,K;cin>>N>>K;
for(int i=0;i<N;i++) cin>>h[i];
dp[0]=0;
for(int i=0;i<N;i++){
    for(int k=1;k<=K;k++){
        chmin(dp[i+k],dp[i]+abs(h[i]-h[i+k]));
    }
}
cout<<dp[N-1]<<endl;
    return 0;
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
typedef pair<int,int> pii;
typedef tuple<int,int,int> tii;
typedef long long ll;
#define rep(i,s,n) for(int i=(int)(s);i<(int)(n);i++)

int N,M;
int pre[100010];
int dist[100010];
int INF = 200010;

vector<int> path[100010];
void bfs(){
  dist[1] = 0;
  pre[1] = 0;
  queue<int> que;
  que.push(1);
  while(!que.empty()){
    int q = que.front();que.pop();
    for(int i=0;i<path[q].size();i++){
      int nq = path[q][i];
      if(dist[nq]>dist[q]+1){
        dist[nq] = dist[q]+1;
        pre[nq] = q;
        que.push(nq);
      }
    }
    
  }
}

int main(){
  cin >> N >> M;
  for(int i=0;i<M;i++){
    int a,b;
    cin >> a >> b;
    path[a].push_back(b);
    path[b].push_back(a);
  }  
  memset(dist,INF,sizeof(dist));
  bfs();
  cout << "Yes" << endl;
  for(int i=2;i<=N;i++){
    cout << pre[i] << endl;
  }
}

Measured memory_bytes: 10856
#include <iostream>
#include <string>
#include <array>
#include <vector>
#include <math.h>
#include <algorithm>
#include <set>
#include <deque>
#include <utility>
#include <map>

#define ll long long int

using namespace std;

ll kaijo(ll a, ll b)
{
	ll ans = 1;
	ll i;

	for (i = 1; i <= a; i++) {
		ans = ans * i;
		ans = ans % b;
	}

	return (ans);

}

int main(void)
{
	ll n, m;
	ll a = pow(10, 9) + 7;
	ll ans;
	cin >> n >> m;

	if ((n - m) == 0) {
		ans = kaijo(n, a) * kaijo(m, a) * 2;
		ans = ans % a;
	}
	else if ((n - m) == 1 || (m - n) == 1) {
		ans = kaijo(n, a) * kaijo(m, a);
		ans = ans % a;

	}
	else {
		ans = 0;
	}

	cout << ans << endl;

	return (0);
}

Measured memory_bytes: 256
#include<iostream>
#include<bitset>

using namespace std;

int a[2003];
bitset<2003*2000> s;

int main() {
	int n;
	int sum = 0;
	cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> a[i];
		sum += a[i];
	}
	sum = (sum + 1) / 2;
	s[0] = 1;
	//a[i]達を組み合わせて作れる、sum以上の最小の自然数を求めたい。
	for (int i = 0; i < n; i++) {
		s = s | (s << a[i]);
	}
	while (s[sum] == 0) {
		sum++;
	}
	cout << sum << endl;
}

Measured memory_bytes: 2176
#include<stdio.h>
#include <stdlib.h>
#include<string.h>
#include<math.h>
#define loop(i, l, r) for(i=l; i<r; i++)/*Instead of function, (for).*/
#define rep(i,r) for(i=0; i<r; i++)
#define Max(a, b) ((a) > (b) ? (a) : (b))
#define Min(a, b) ((a) < (b) ? (a) : (b))
typedef long long int lli;
/*Return Combination ,(nCr)*/
int combi(int n, int r)
{
	if(r==0 || r==n) return 1;
	else return combi(n-1,r) + combi(n-1,r-1);
}
/*Return gcd(a, b)*/
int gcd(int a, int b){
	if(b == 0) return a;
	else return gcd(b, a % b);
}
int main(void)
{
	int n, i, satis=0;
	scanf("%d", &n);
	int a[n+1], b[n], c[n-1];
	a[n] = 0;
	rep(i,n) scanf("%d", &a[i]);
	rep(i,n) scanf("%d", &b[i]);
	rep(i,n-1) scanf("%d", &c[i]);

	rep(i,n){
		satis += b[a[i] - 1];
		if(a[i] + 1 == a[i+1]){
			satis += c[a[i]-1];
		}
	}
	printf("%d", satis);
	return 0;
}

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

int main() {
  char s;
  cin >> s;
  if(s == 'a' || s == 'e' || s == 'i' || s == 'o' || s == 'u') cout << "vowel" << endl;
  else cout << "consonant" << endl;
}


Measured memory_bytes: 256
/**
 * @Author: yujirotakahashi
 * @Date:   2020-05-17T20:23:33+09:00
 * @Last modified by:   yujirotakahashi
 * @Last modified time: 2020-05-31T21:07:07+09:00
 */

#include<bits/stdc++.h>
using namespace std;

/*******  All Required define Pre-Processors and typedef Constants *******/
#define all(cont) cont.begin(), cont.end()
#define rall(cont) cont.end(), cont.begin()
#define rep(i,n) for(int i=0; i<(n); ++i)
#define rep1(i,n) for(int i=1; i<=(n); ++i)
#define Dcout(a) cout << setprecision(20) << a << endl
#define MP make_pair
#define PB push_back
#define EPS 1e-9
#define PI 3.1415926535897932384626433832795
#define MOD 1000000007
//const ll INF = (1LL << 60);
//const double pi=acos(-1.0);
using ll = long long;
using PAIR = pair<int, int>;
#define debug cout << "line : " << __LINE__ << " debug" << endl
/****** Template of some basic operations *****/
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
/**************************************/

/******** User-defined Function *******/


/**************************************/

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

  long double a,b; cin >> a >> b;

  Dcout(floor(a*b));

  return 0;
}
/********  Main() Ends Here *************/


Measured memory_bytes: 3812
#include<bits/stdc++.h>
typedef long long ll;
typedef long double ld;
using namespace std;

using Pii = pair<int, int>;
using Pll = pair<ll, ll>;

#define REP(i, l, n) for(int i=(l), i##_len=(n); i<i##_len; ++i)
#define ALL(x) (x).begin(),(x).end()
#define pb push_back

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

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

ll Pow(ll  x, ll n, ll MOD){
  if(n == 0)
    return 1;
  if(n % 2 == 0)
    return Pow(x * x % MOD, n / 2, MOD);
  else
    return x * Pow(x, n - 1, MOD) % MOD;
}



int main(){
    ll n; cin >> n;
    string s; cin >> s;
    int pcount = 0;
    REP(i, 0, n){
        if(s[i] == '1'){
            pcount++;
        }
    }
    vector<ll> pcount1(n), pcount2(n);
    ll k = 1;
    ll pc1 = 0, pc2 = 0;
    REP(i, 0, n){
        pcount1[i] = k;
        pc1 += k * (s[n-i-1] - '0');
        pc1 %= (pcount+1);
        k = (k * 2) % (pcount+1);
    }
    k = 1;
    REP(i, 0, n){
        if(pcount-1 == 0){
            break;
        }
        pcount2[i] = k;
        pc2 += k * (s[n-i-1] - '0');
        pc2 %= (pcount-1);
        k = (k * 2) % (pcount-1);
    }
    REP(i, 0, n){
        ll mid, mod;
        if(s[i] == '1'){
            if(pcount-1 == 0){
                cout << 0 << endl;
                continue;
            }
            mid = (pc2 - pcount2[n-i-1] + (pcount-1)) % (pcount-1);
        }else{
            mid = (pc1 + pcount1[n-i-1] + (pcount+1)) % (pcount+1);
        }
        int ans = 1;
        while(mid > 0){
            int pop = 0;
            ll cmid = mid;
            while(cmid > 0){
                pop += (cmid & 1);
                cmid = cmid >> 1;
            }
            mid = mid % pop;
            ans++;
            
        }
        cout << ans << endl;
    }
}

Measured memory_bytes: 6812
#include "bits/stdc++.h"
using namespace std;

//***********************************Functions and macros begin*************************************//

#define pi pair<int,int>
#define pii pair<pi,int>
#define pb push_back
#define fast ios_base::sync_with_stdio
#define fast1 cin.tie(NULL)
#define mod1 1000005187
#define mp make_pair
#define SORT(x) sort(x.begin(),x.end())
#define PI 3.14159265
#define R3 1.7320508
#define R5 2.2360679
typedef long long int  ll;
const ll mod=1e9+7;
int phi(int n) //No of coprimes
{int result=n;for(int i=2;i*i<=n;i++)if(n%i==0){while(n%i==0) n=n/i;result-=result/i;}if(n>1) result-=result/n; return result;}

ll mod_pow(ll base,ll e) 
{ ll ans=1; while(e){if(e&1) ans=(ans*base)%mod;base=(base*base)%mod;e>>=1;}return ans;}

int gcd(int a,int b) //Greatest common divisior
{return b ? gcd(b,a%b) : a;}


//*********************************** Fucntions and macros end  *************************************// 

int main()
{
	int n;
	cin>>n;
	long int y;
	cin>>y;
	int i=0,j=0,ans=0; 
	for(i=n;i>=0;i--)
	{
		for(j=n;j>=0;j--)
		{
			if((y-10000*i-5000*j)>=0&&(((y-10000*i-5000*j)/1000)+i+j)==n&&(y-10000*i-5000*j)%1000==0)
			{
				//cout<<(y-10000*i-5000*j)<<" ";
				ans=1;
				break;	
			}		
		}
		if(ans==1)
		break;
	}
	if(ans==0)
	cout<<"-1 -1 -1";
	else
	{
		cout<<i<<" "<<j<<" "<<(y-10000*i-5000*j)/1000;
	}
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define mp make_pair
#define pb push_back
#define fi first
#define se second
#define sz(a) int(a.size())
#define clr(a) memset(a,0,sizeof(a))
#define all(a) a.begin(),a.end()
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<int,int> pii;
typedef pair<ll,int> pli;
const int inf=1e9;
const ll Inf=1e18;
const int N=110;
const int mod=0;
int gi() {
    int x=0,o=1;char ch=getchar();
    while((ch<'0'||ch>'9')&&ch!='-') ch=getchar();
    if(ch=='-') o=-1,ch=getchar();
    while(ch>='0'&&ch<='9') x=x*10+ch-'0',ch=getchar();
    return x*o;
}
template<typename T> bool chkmax(T &a,T b) { return a<b?a=b,1:0; };
template<typename T> bool chkmin(T &a,T b) { return a>b?a=b,1:0; };
int add(int a,int b) { return a+b>=mod?a+b-mod:a+b; }
int sub(int a,int b) { return a-b<0?a-b+mod:a-b; }
void inc(int &a,int b) { a=(a+b>=mod?a+b-mod:a+b); }
void dec(int &a,int b) { a=(a-b<0?a-b+mod:a-b); }
int n,x,a[N];
int main() {
    n=gi(),x=gi();
    for(int i=1;i<=n;i++) a[i]=gi();
    sort(a+1,a+n+1);
    int ans=0;
    for(int i=1;i<=n;i++) if(x>=a[i]) x-=a[i],++ans;
    if(x&&ans==n) --ans;
    printf("%d\n",ans);
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main() {
    int a[7], b[7];
    for (int i = 0; i < 7; i++) {
        cin >> a[i] >> b[i];
    }
    for (int i = 0; i < 7; i++) {
        cout << a[i] - b[i] << "\n";
    }
    return 0;
}


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

using namespace std;

#ifdef Lin1043
    #define DEBUG(msg, ...) printf("(%s #%d) " msg, __FUNCTION__, __LINE__, __VA_ARGS__)
    #define massert(...) assert(...)
#else
    #define DEBUG(...)
    #define massert(...)
#endif

#define rep(i , l , r) for(int i = (l) , ___ = (r) ; i <= ___ ; ++i )
#define per(i , r , l) for(int i = (r) , ___ = (l) ; i >= ___ ; --i )

struct iopener
{
    iopener()
    {
#ifdef Lin1043
        freopen("./in" , "r" , stdin);
#endif
    }
} iop;

typedef long long LL;

template<typename T>inline bool chkmin(T &x , const T &y) { return x > y ? (x = y , 1) : 0; }
template<typename T>inline bool chkmax(T &x , const T &y) { return x < y ? (x = y , 1) : 0; }

template<typename T>inline T read(T &f)
{
    f = 0; int x = 1 ; char c = getchar();
    while(!isdigit(c)) x = (c == '-' ? -1 : 1) , c = getchar();
    while(isdigit(c)) (f *= 10) += c & 15 , c = getchar();
    return f = x * f;
}

const int N = 2000 + 5;

int n , m , A[N] , mn[N][N];

LL Ans = 1ll << 60;

int main()
{
    read(n) , read(m);
    rep(i , 1 , n) read(A[i]);
    rep(i , 1 , n)
    {
        int x = A[i];
        rep(j , i , n)
            chkmin(x , A[j]) , mn[i][j] = x;
    }
    rep(i , 0 , n - 1)
    {
        LL res = 1ll * i * m;
        rep(j , 1 , n)
        {
            res += j > i ? mn[j - i][j] :
                   min(mn[1][j] , mn[j - i + n][n]);
        }
        chkmin(Ans , res);
    }
    cout << Ans << endl;
    return 0;
}


Measured memory_bytes: 15360
import java.util.*;
import java.util.stream.*;
class Main {
    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        int N;
        N = input.nextInt();
        int[] A = new int[N];
        for (int i = 0; i < N; i++){
            A[i] = input.nextInt();
        }
        insertionSort(A,N);
    }
    public static void insertionSort(int[] A,int N){
        int v,j;
        for (int k = 0; k < N; k++){
                if (k != N-1){
                    System.out.printf("%d ",A[k]);
                } else {
                    System.out.println(A[k]);
                }
            }
        for (int i = 1; i < N; i++){
            v = A[i];
            j = i - 1;
            while(j >= 0 && A[j] > v){
                A[j+1] = A[j];
                j -= 1;
            }
            A[j+1] = v;
            for (int k = 0; k < N; k++){
                if (k != N-1){
                    System.out.printf("%d ",A[k]);
                } else {
                    System.out.println(A[k]);
                }
            }
        }
    }
}


Measured memory_bytes: 43564
import java.util.Scanner;

public class Main {

	static int n, m;
	static int[] a, b;
	static boolean[] vis;
	static boolean[][] connected;

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		n = sc.nextInt();
		m = sc.nextInt();
		a = new int[m]; b = new int[m]; connected = new boolean[n][n]; vis = new boolean[n];
		for(int i = 0 ; i < m ; i++) {
			a[i] = sc.nextInt();
			b[i] = sc.nextInt();
			a[i]--; b[i]--;
			connected[a[i]][b[i]] = connected[b[i]][a[i]] = true;
		}
		int ans = 0;
		for(int i = 0 ; i < m ; i++) {
			connected[a[i]][b[i]] = connected[b[i]][a[i]] = false;
			for(int j = 0 ; j < n ; j++) vis[j] = false;
			dfs(0);
			boolean bridge = false;
			for(int j = 0 ; j < n ; j++) {
				if(vis[j] == false) bridge = true;
			}
			if(bridge) ans++;
			connected[a[i]][b[i]] = connected[b[i]][a[i]] = true;
		}
		System.out.println(ans);
	}

	public static void dfs(int x) {
		vis[x] = true;
		for(int i = 0 ; i < n ; i++) {
			if(connected[x][i] == false) continue;
			if(vis[i] == true) continue;
			dfs(i);
		}
	}
}


Measured memory_bytes: 22864
#include "bits/stdc++.h"
using namespace std;
#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
*this << "[";
for (auto it = d.b; it != d.e; ++it)
*this << ", " + 2 * (it == d.b) << *it;
ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "
#define cool ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define int  long long int
#define pb push_back
#define fe first
#define lb lower_bound 
#define ub upper_bound
#define pii pair<pair<int,int>,pair<int,int> >
#define se second
#define endl "\n"
#define pi pair<int, int>
#define mi          map<int,int>
#define mii         map<pi,int>
#define vi vector<int> 
#define vvi vector<vi>
#define bs   binary_search
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rep1(i,a,b) for(int i=a;i<=b;i++)	
#define all(c) (c).begin(),(c).end()
#define sz(x)       (int)x.size() 
#define PI 3.14159265358979323846

 const int N=5e5+5;

 int mod= 1e9+7;
 int dx[4]={0,0,+1,-1};
 int dy[4]={+1,-1,0,0};  
 
 
int po(int a, int b) {
	a %= mod;
	int res = 1;
	while (b > 0) {
		if (b & 1)
			res = (res * a) % mod;
		a =(a*a) % mod;
		b >>= 1;
	}
	 return res;	
   }



int n;
set<int> s;
   
void Cal(int x) {
	   int ct=0;	   
	   for(int i=2;i*i<=x;i++) {
		      if(x%i==0) {
				     s.insert(i);				    
				     if((x/i)!=i) {
						 s.insert(x/i);						
					 } 
				  }
		   }		
   	}
   	
void Cal1(int x) {	    
	    for(int i=2;i*i<=x;i++) {
		      int p=x;
		      while(p%i==0) p/=i;
		      if(p%i==1) s.insert(i);
		   }		  
	}   	



void solve() {     
      cin>>n;
      Cal(n-1);
      //~ cout<<sz(s)<<endl;
      Cal1(n);
      if(n>2) s.insert(n-1);
      s.insert(n);
      
	  cout<<sz(s)<<endl;              
}

    
int32_t main() {
	cool;
	int t=1;	

	//cin>>t;
	while(t--)
	  solve();

  return 0;	   
}


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

int arr[(unsigned int)(1e5)];

int main() {
	int n, q;
	map<int, int> cnt;
	long long total = 0;

	cin >> n;

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

	cin >> q;

	while (q--)
	{
		int b, c;
		cin >> b >> c;

		// b 개수만큼 뺀 다음 c 개수만큼 더하면 됨.
		int bcnt = cnt[b];

		total -= (long long)(bcnt) * b;
		total += (long long)(bcnt) * c;

		cnt[b] -= bcnt;
		cnt[c] += bcnt;

		cout << total << endl;
	}
}

Measured memory_bytes: 8340
#include <bits/stdc++.h>
using namespace std;
int main(){
 int h,w;
 cin >> h >> w;
 vector<vector<char>> a(h,vector<char>(w));
 for(int i = 0; i < h; i++){
     for(int j = 0; j < w; j++){
         cin >> a[i][j];
     }
 }
vector<int> b(h,100000),c(w,100000);
int k = 0;
for(int i = 0; i < h; i++){
    bool d = true;
    for(int j = 0; j < w; j++){
        if(a[i][j] == '#')
        d = false;
    }
    if(d){
    b[k] = i;
    k++;
    }
}
int l = 0;
for(int i = 0; i < w; i++){
    bool e = true;
    for(int j = 0; j < h; j++){
        if(a[j][i] == '#')
        e = false;
    }
    if(e)
    {
        c[l] = i;
        l++;
    }
}
int s = 0;
for(int i = 0; i < h; i++){
    int cnt = 0;
    int t = 0;
    for(int j = 0; j < w; j++){
       if(i != b[s] && j != c[t])
         cout << a[i][j];
         if(i == b[s]){
         cnt++;
         break;
         }
         if(j == c[t])
         t++;
    }
    if(cnt == 0)
    cout << endl;
    if(cnt > 0)
    s++;
}
}

Measured memory_bytes: 256
def gi; gets.to_i end
def gs; gets.chomp end
def gli; gets.split(' ').map(&:to_i) end
def d(n); Math.log10(n).to_i + 1 end
class Integer
  # 約数の組み合わせを列挙する
  def divisor_combinations
    (1..Math.sqrt(self).to_i).
      select { |i| self % i == 0 }.
      map { |i| [i, self / i] }
  end
end

N = gi
S = gs

mem = ''
res = 0
S.chars.each do |s|
  if mem != s
    mem = s
    res += 1
  end
end
puts res


Measured memory_bytes: 7036
#include <stdio.h>

int main(void) {

  long n;
  scanf("%ld", &n);
  long t[n],a[n];
  for (long i = 0; i < n; i++) {
    scanf("%ld %ld", &t[i], &a[i]);
  }
  long takahashi = t[0];
  long aoki = a[0];
  long val_t,val_a,max;
  for (long i = 1; i < n; i++) {
    val_t = (takahashi+t[i]-1)/t[i];
    val_a = (aoki+a[i]-1)/a[i];
    max = val_t;
    if (val_a > max) {
      max = val_a;
    }
    takahashi = t[i]*max;
    aoki = a[i]*max;
  }
  long ans = takahashi+aoki;
  printf("%ld\n", ans);

  return 0;
}

Measured memory_bytes: 128
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)*}
    };
}

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)*}
    };
}

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, 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")
    };
}

use std::cmp::max;
fn main() {
    input!{
        c1: chars,
        c2: chars,
    }
    println!("{}", if c1[0] == c2[2] && c1[1] == c2[1] && c1[2] == c2[0] {"YES"} else {"NO"});
}


Measured memory_bytes: 4352
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		@SuppressWarnings("resource")
		Scanner sc = new Scanner(System.in);

		while(sc.hasNext()){
		long num = sc.nextInt();

		long base = 2;

		for(int i = 2; i <= num; i++){
			base += i;

		}

		System.out.println(base);
		}
	}

}

Measured memory_bytes: 26048
#define _USE_MATH_DEFINES
#include <array>
#include <cassert>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <string>
#include <sstream>
#include <vector>
#include <queue>
#include <stack>
#include <list>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <algorithm>
#include <complex>
#include <cmath>
#include <numeric>
#include <bitset>
#include <functional>
#include <random>
#include <ctime>

using namespace std;

#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
  cerr << name << ": " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
  const char* comma = strchr(names + 1, ',');
  cerr.write(names, comma - names) << ": " << arg1 << " |";
  __f(comma + 1, args...);
}

typedef long long int64;
typedef pair<int, int> ii;
const int INF = 1 << 29;
const int MOD = 1e9 + 7;
mt19937 mrand(random_device{}());
int rnd(int x) { return mrand() % x; }

const int N = 50 + 10;
int dp[N][N][N << 1];
int lg2[N];
int64 F[N], G[N];

int64 power_mod(int64 a, int n) {
  int64 ret = 1;
  for (; n; n >>= 1) {
    if (n & 1) ret = ret * a % MOD;
    a = a * a % MOD;
  }
  return ret;
}

int solve(int rem, int k, int carry) {
  if (rem == 0) return carry == 0 ? 1 : 0;
  int& ret = dp[rem][k][carry + N];
  if (ret >= 0) return ret;
  ret = 0;
  for (int L = 0; L <= rem; ++L) {
    for (int R = 0; L + R <= rem; ++R) {
      if (k == 0 && L + R != 1) continue;
      if (L + R == 0 || L + R < abs(carry) || (carry + L + R) % 2) continue;
      int nxt_carry = (carry + R - L) / 2;
      auto t = solve(rem - L - R, k + 1, nxt_carry);
      // if (rem == 4 && carry == 1) trace(t, L, R, nxt_carry);
      ret += t * G[L] % MOD * G[R] % MOD;
      ret %= MOD;
    }
  }
  // trace(rem, k, carry, ret);
  return ret;
}

int main() {
  int n;
  F[0] = G[0] = 1;
  for (int i = 1; i < N; ++i) {
    F[i] = F[i - 1] * i % MOD;
    G[i] = power_mod(F[i], MOD - 2);
  }
  scanf("%d", &n);
  memset(dp, 255, sizeof(dp));
  auto ret = solve(n, 0, 1);
  ret = ret * F[n] % MOD;
  printf("%d\n", ret);
  return 0;
}


Measured memory_bytes: 2048
#include <bits/stdc++.h>
#define rep(i, a, b) for(ll i = ll(a); i < ll(b); i++)
#define rer(i, a, b) for(ll i = ll(a) - 1; i >= ll(b); i--)
#define sz(v) (int)(v).size()
#define pb push_back
#define sc second
#define fr first
#define sor(v) sort(v.begin(),v.end())
#define rev(s) reverse(s.begin(),s.end())
#define lb(vec,a) lower_bound(vec.begin(),vec.end(),a)
#define ub(vec,a) upper_bound(vec.begin(),vec.end(),a)
#define uniq(vec) vec.erase(unique(vec.begin(),vec.end()),vec.end())
using namespace std;
typedef long long int ll;
typedef pair <int, int> P;

const ll MOD=1000000007;
int N,K,Q;
vector<ll> A;
vector<ll> B;
int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cin>>N>>K>>Q;
    A.resize(N);
    B.resize(N);
    rep(i,0,N){
        cin>>A[i];
        B[i]=A[i];
    }
    sor(B);
    uniq(B);
    map<ll,ll> m;
    map<ll,ll> revm;
    rep(i,0,sz(B)){
        m[B[i]]=i;
        revm[i]=B[i];
    }
    rep(i,0,N){
        A[i]=m[A[i]];
    }
    ll ans=1e12;
    int n=sz(B);
    rep(i,0,n){
        int ng=i-1, ok=n;
        while(ok-ng>1){
            int mid=(ok+ng)/2;
            int l=0, r=0;
            int cnt=0;
            int res=0;
            while(l<N){
                cnt=0;
                while(r<N&&A[r]<i){
                    r++;
                }
                l=r;
                while(r<N&&A[r]>=i){
                    if(A[r]<=mid) cnt++;
                    r++;
                }
                res+=max(0,min(r-l-K+1,cnt));
                l=r;
            }
            if(res>=Q) ok=mid;
            else ng=mid;
        }
        if(ok==n) continue;
        else ans=min(ans,revm[ok]-revm[i]);
    }
    cout <<ans<<"\n";
}

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

#define ll long long
#define vecll vector<long long>
#define vec2ll vector<vector<long long>>
#define vecpairll vector<pair<long long,long long>>
#define forll(s,a,b) for(long long s = a;s < b;s++)
#define forllde(s,a) for(long long s = a;s > 0;s--)

template <typename A, typename B>
string to_string(pair<A, B> p);
 
template <typename A, typename B, typename C>
string to_string(tuple<A, B, C> p);
 
template <typename A, typename B, typename C, typename D>
string to_string(tuple<A, B, C, D> p);
 
string to_string(const string& s) {
  return '"' + s + '"';
}
 
string to_string(const char* s) {
  return to_string((string) s);
}
 
string to_string(bool b) {
  return (b ? "true" : "false");
}
 
string to_string(vector<bool> v) {
  bool first = true;
  string res = "{";
  for (int i = 0; i < static_cast<int>(v.size()); i++) {
    if (!first) {
      res += ", ";
    }
    first = false;
    res += to_string(v[i]);
  }
  res += "}";
  return res;
}
 
template <size_t N>
string to_string(bitset<N> v) {
  string res = "";
  for (size_t i = 0; i < N; i++) {
    res += static_cast<char>('0' + v[i]);
  }
  return res;
}
 
template <typename A>
string to_string(A v) {
  bool first = true;
  string res = "{";
  for (const auto &x : v) {
    if (!first) {
      res += ", ";
    }
    first = false;
    res += to_string(x);
  }
  res += "}";
  return res;
}
 
template <typename A, typename B>
string to_string(pair<A, B> p) {
  return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";
}
 
template <typename A, typename B, typename C>
string to_string(tuple<A, B, C> p) {
  return "(" + to_string(get<0>(p)) + ", " + to_string(get<1>(p)) + ", " + to_string(get<2>(p)) + ")";
}
 
template <typename A, typename B, typename C, typename D>
string to_string(tuple<A, B, C, D> p) {
  return "(" + to_string(get<0>(p)) + ", " + to_string(get<1>(p)) + ", " + to_string(get<2>(p)) + ", " + to_string(get<3>(p)) + ")";
}
void debug_out() { cerr << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cerr << " " << to_string(H);
  debug_out(T...);
}
#define debug(...) cerr << "<" << #__VA_ARGS__ << ">:", debug_out(__VA_ARGS__)
#define INF LLONG_MAX


int main()
{
  ll x, n, a, min_v=INF;
  cin >> x >> n;
  vecll p(101, 0);
  
  forll(i, 0, n){
	cin >> a;
	p[a] = 1;
  }
  
  forll(i, x, 101){
	if (p[i] == 0){
	  min_v = i;
	  break;
	}
  }

  if (min_v == INF){
	min_v = 101;
  }
  
  for(ll i=x; i>=0; i--){
	if (p[i]==0) {
	  if ((min_v-x) >= x-i)
		min_v=i;
	  break;
	  
	}
  }
  
  cout << min_v << endl;
}


Measured memory_bytes: 3640
from collections import deque
n = int(input())
my_list = deque()
for t in range(n):
    i = input().split()
    if i[0] == "insert":
        my_list.appendleft(i[1])
    elif i[0] == "delete" and i[1] in my_list:
        my_list.remove(i[1])
    elif i[0] == "deleteFirst":
        my_list.popleft()
    elif i[0] == "deleteLast":
        my_list.pop()
print(" ".join(my_list))



Measured memory_bytes: 69732
void main() {
	auto ip = readAs!(long[]), N = ip[0], x = ip[1];
	auto a = readAs!(long[]);
	long res;
	res += max(0, a[0]-x);
	a[0] = min(x, a[0]);
	foreach(i; 0..N-1) {
		auto m = a[i] + a[i+1];
		if(m > x) {
			res += m - x;
			a[i+1] -= (m-x);
		}
	}
	res.writeln;
}

// ===================================

import std.stdio;
import std.string;
import std.functional;
import std.algorithm;
import std.range;
import std.traits;
import std.math;
import std.container;
import std.bigint;
import std.numeric;
import std.conv;
import std.typecons;
import std.uni;
import std.ascii;
import std.bitmanip;
import core.bitop;

T readAs(T)() if (isBasicType!T) {
	return readln.chomp.to!T;
}
T readAs(T)() if (isArray!T) {
	return readln.split.to!T;
}

T[][] readMatrix(T)(uint height, uint width) if (!isSomeChar!T) {
	auto res = new T[][](height, width);
	foreach(i; 0..height) {
		res[i] = readAs!(T[]);
	}
	return res;
}

T[][] readMatrix(T)(uint height, uint width) if (isSomeChar!T) {
	auto res = new T[][](height, width);
	foreach(i; 0..height) {
		auto s = rs;
		foreach(j; 0..width) res[i][j] = s[j].to!T;
	}
	return res;
}

int ri() {
	return readAs!int;
}

double rd() {
	return readAs!double;
}

string rs() {
	return readln.chomp;
}

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

int main() {
  int N;
  cin >> N;
  vector<long> A(N + 1);
  vector<long> B(N);
  for(int i = 0;i < N + 1;i++)cin >> A.at(i);
  for(int i = 0;i < N;i++)cin >> B.at(i);
  long ma[100000];
  long mb[100000];
  if(A.at(0) + A.at(1) < B.at(0)){
    ma[0] = A.at(0);
    mb[0] = A.at(1);}
  else if(A.at(0) < B.at(0) && A.at(0) + A.at(1) >= B.at(0)){
    ma[0] = A.at(0);
    mb[0] = B.at(0) - A.at(0);}
 else if(A.at(0) >= B.at(0)){
   ma[0] = B.at(0);
   mb[0] = 0;}
  for(int i = 1;i < N;i++){
    if(A.at(i) + A.at(i + 1) - mb[i - 1] < B.at(i)){
   ma[i] = A.at(i) - mb[i - 1];
   mb[i] = A.at(i + 1);}
    else if(A.at(i) - mb[i - 1] < B.at(i) && A.at(i) + A.at(i + 1) - mb[i - 1] >= B.at(i)){
   ma[i] = A.at(i) - mb[i - 1];
   mb[i] = B.at(i) - A.at(i) + mb[i - 1];}
    else{
   ma[i] = B.at(i);
   mb[i] = 0;}
  }
  long X = 0;
  for(int i = 0;i < N;i++){
    X += ma[i];
    X += mb[i];
  }
    cout << X << endl;
}


Measured memory_bytes: 3328
#include <iostream>
#include <fstream>
#include <cmath>
#include <string>
#include <vector>
#include <map>
#include <queue>
#include <set>
#include <unordered_set>
#include <bitset>
#include <limits>
#include <algorithm>

#define MOD_BIG 1000000007
#define MOD_BIG2 998244353
using std::string;
using std::cin;
using std::cout;
using std::cerr;
using std::endl;
using ll = long long;
using pint = std::pair<int, int>;
using pll = std::pair<ll, ll>;
using std::vector;

#define FOR(i, begin, end) for(int i=(begin),i##_end_=(end);i<i##_end_;i++)
#define IFOR(i, begin, end) for(int i=(end)-1,i##_begin_=(begin);i>=i##_begin_;i--)
#define REP(i, n) FOR(i,0,n)
#define IREP(i, n) IFOR(i,0,n)

//////////////////////////////////////


//////////////////////////////////////

int main() {
    
    int N;
    cin >> N;
    vector<int> A(N);
    REP(i, N) {
        cin >> A[i];
    }
    int now = 1;
    int ans = 0;
    REP(i, N) {
        if (A[i] == now) {
            now++;
        } else {
            ans++;
        }
    }
    if (now == 1) {
        cout << -1 << endl;
    } else {
        cout << ans << endl;
    }
    
    return 0;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define fio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define int long long
#define endl '\n'
#define pb push_back
#define debug(x) cout<<#x<<" "<<x<<endl;
const int mod = 1e9+7;
const double pi = 3.141592653589793238460;
using namespace std;

bool is_pal (string s){
return equal(s.begin(), s.begin() + s.size()/2, s.rbegin()) ? 1 : 0;
}

int power (int x , int y){
if(y==0) return 1;
if(y&1) return x*power(x,y/2)%mod*power(x,y/2)%mod;
return power(x,y/2)%mod*power(x,y/2)%mod;
}

int modInv (int x){
return power(x,mod-2);
}

int fact (int n){
    int mul =1;
    for(int i=0;i<n;i++)
    mul=(mul*(i+1))%mod;
    return mul;
}

bool prime[200005]; 

int minn (int x, int y)
{
	if(x<y)
	return x;
	else
	return y;
}

int maxx (int x, int y)
{
	if(x>y)
	return x;
	else
	return y;
}
void SieveOfEratosthenes(int n) 
{ 
    memset(prime, true, sizeof(prime)); 
  
    for (int p=2; p*p<=n; p++) 
    { 
        if (prime[p] == true) 
        { 
 
            for (int i=p*p; i<=n; i += p) 
                prime[i] = false; 
        } 
    }  
}

void solve(void){
int n;
cin>>n;
set<string> s;
while(n--){
	string a;
	cin>>a;
	s.insert(a);
}
cout<<s.size();
}	
signed main() {
fio;
int t = 1;
// cin>>t;
	while(t--)
	solve();

	return 0;
}


Measured memory_bytes: 19248
#include <iostream>
#include <cstdio>
#include <cstring>
#include <string>
#include <stack>
#include <queue>
#include <functional>
#include <algorithm>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <vector>
#include <array>
#include <tuple>
#include <utility>
#include <numeric>
#include <iomanip>
#include <cctype>
#include <cmath>
#include <assert.h>
#include <cstdlib>
#include <list>
using namespace std;
 
#define repeat(i, x) for (long long i = 0; (i) < (long long)(x); (i)++)
#define rrepeat(i, x) for (long long i = (long long)((x) - 1); (i) >= 0; (i)--)
#define traverse(it, ctn) for (auto it = (ctn).begin(); (it) != (ctn).end(); (it)++)
#define rtraverse(it, ctn) for (auto it = (ctn).rbegin(); (it) != (ctn).rend(); (it)++)
#define enumerate(i, a, b) for (long long i = (long long)(a); (i) < (long long)(b); (i)++)
 
template<typename T> void chmax(T& a1, T a2) { a1 = std::max(a1, a2); }
template<typename T> void chmin(T& a1, T a2) { a1 = std::min(a1, a2); }
 
template<typename T1, typename T2> ostream& operator<<(ostream& os, const pair<T1, T2>& p) { return os << "(" << p.first << ", " << p.second << ")"; }
template<typename T> ostream& operator<<(ostream& os, const vector<T>& v) { os << "["; for (int i = 0; i < v.size(); i++) os << (i == 0 ? "" : ", ") << v[i]; os << "]"; return os; }
template<typename T1, typename T2> ostream& operator << (ostream& os, map<T1, T2>& mp) { os << "{"; for (auto it = mp.begin(); it != mp.end(); it++) { os << "(" << it->first << ": " << it->second << ")"; it++; if(it != mp.end()) os << ", "; it--; } os << "}"; return os; }
template<typename T> ostream& operator << (ostream& os, set<T>& st) { os << "{"; for (auto it = st.begin(); it != st.end(); it++) { os << *it; ++it; if(it != st.end()) os << ", "; it--; } os << "}"; return os; }
 
using int64 = long long;
using Graph = std::vector<std::vector<int>>;
 
int64 simulate(int64 x, vector<int64>& A) {
    int K = A.size();
    for (int i = 0; i < K; i++) {
        x = (x / A[i]) * A[i];
    }
    return x;
}
 
int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
 
    int K;
    cin >> K;
 
    vector<int64> A(K);
    repeat (i, K) {
        cin >> A[i];
    }
    if (A.back() != 2) {
        cout << -1 << endl;
        return 0;
    }
    /*
    int idx = K - 1;
    while (idx > 0 and A[idx - 1] == 2) idx--;
    */
 
    int64 ng = 0, ok = 1e18;
    while (ok - ng > 1) {
        int64 mid = (ng + ok) / 2;
        if (simulate(mid, A) >= 2) ok = mid;
        else ng = mid;
    }
 
    if (simulate(ok, A) != 2) {
        cout << -1 << endl;
        return 0;
    }
 
    int64 lb = ok, ub = ok;
    ok = 0; ng = 1e18;
    while (ng - ok > 1) {
        int64 mid = (ng + ok) / 2;
        if (simulate(mid, A) <= 2) ok = mid;
        else ng = mid;
    }
 
    if (simulate(ok, A) == 2) {
        lb = min(lb, ok);
        ub = max(ub, ok);
    }
 
    cout << lb << " " << ub << endl;
 
    return 0;
}

Measured memory_bytes: 1024
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <climits>
#include <random>
#include <iomanip>

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

typedef long long int ll;

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))

#define fillInt(xs, x)        \
  for (int i = 0; i < (x); i++) \
    scanf("%d", &xs[i]);
#define fillLong(xs, x)       \
  for (int i = 0; i < (x); i++) \
    scanf("%ld", &xs[i]);
#define fillString(xs, x)       \
  for (int i = 0; i < (x); i++) \
    cin >> xs[i];
#define sortv(xs) sort(xs.begin(), xs.end())
#define sortvinv(xs) sort(xs.begin(), xs.end(), std::greater<long>())
#define lbv(xs, x) lower_bound(xs.begin(), xs.end(), x) - xs.begin()
#define ubv(xs, x) upper_bound(xs.begin(), xs.end(), x) - xs.begin()
#define bs(xs, x) binary_search(xs.begin(), xs.end(), x)
#define index_of(as, x) \
  distance(as.begin(), lower_bound(as.begin(), as.end(), x))

#define rep(i,n) for(auto i=0; i<(n); i++)

const int mod = 1000000007;

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

  int n;
  cin >> n;

  vector<long> a(n);
  fillLong(a, n);

  vector<long> b(n);
  fillLong(b, n);

  vector<long> amari;
  long tarinai = 0;
  int chCnt = 0;

  rep(i, n) {
    if(a[i] > b[i]) {
      amari.push_back(a[i] - b[i]);
    }
    if(b[i] > a[i]) {
      chCnt++;
      tarinai += b[i]-a[i];
    }
  }

  sortvinv(amari);

  rep(i, amari.size()) {
    if(tarinai <= 0) break;
    chCnt++;
    tarinai -= amari[i];
  }

  if(tarinai <= 0) {
    cout << chCnt << endl;
  } else {
    cout << -1 << endl;
  }
}


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

#define LL long long
int main()
{
    
    LL t = 1;
    cin >> t;
    
    string str;
    int ac = 0 , wa = 0, tle = 0 ,re = 0;
    
    while(t--)
    {
        cin >> str;
        if(str == "WA")
        {
            wa++;
        }
        else if(str == "RE")
        {
            re++;
        }
        else if(str == "TLE")
        {
            tle++;
        }
        else if(str == "AC")
        {
            ac++;
        }
    }

    cout << "AC x " << ac << endl;
    cout << "WA x " << wa << endl;
    cout << "TLE x " << tle << endl;
    cout << "RE x " << re << endl;
    
    
    return 0;
}

Measured memory_bytes: 3248
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cmath>

using namespace std;
using ll = long long int;

int main(){
    int N;
    cin>>N;
    vector<int> X(N);
    for(int i=0;i<N;i++) cin>>X[i];
    
    double P=0;
    for(int i=0;i<N;i++) P+=X[i];
    P/=N;
    P=round(P);
    
    int ans=0;
    for(int i=0;i<N;i++){
        ans+=pow(P-X[i],2);
    }
    
    cout<<ans<<endl;
    
    return 0;
}


Measured memory_bytes: 384