akhauriyash/Code-Regression huggingface dataset:
#include <stdio.h>
#define N 10
int main ()
{
    int n,i,max=0,price[N],sum=0;
    scanf("%d",&n);
    for(i=0; i<n; i++)
    {
        scanf("%d",&price[i]);
        if(price[i]>max)
        {
            max=price[i];
        }
        sum+=price[i];
    }
    sum-=max;
    max/=2;
    sum+=max;
    printf("%d",sum);
    return 0;
}


Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
# define ll long long
int main()
{
    ll n,m;
    cin>>n>>m;

    map < ll , ll > H;
    for ( int i=0 ; i<n ; i++ )
    {
        ll a , b;
        cin>>a>>b;

        H[a]+=b;
    }

    ll cost = 0;
    while ( m>0 )
    {
        for ( auto i:H )
        {
            ll rem =min(i.second,m);
            cost+=rem*i.first;
            m-=rem;
        }
    }

    cout<<cost<<"\n";
    return 0;

}


Measured memory_bytes: 6528
//                   ********** YATIN KWATRA **********

// AC BAKSHI RABBA

#include <bits/stdc++.h>
#define ll                      long long 
#define ld                      long double
#define ull                     unsigned long long 
#define FIO                     ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define endl                    "\n"
#define fo(i,a,b)               for(int i = a; i<=b ; i++)
#define rfo(i,a,b)              for(int i = a; i>=b ; i--)
#define vii                     vector<int>
#define vll                     vector<ll>
#define pq                      priority_queue
#define uom                     unordered_map                
#define all(v)                  v.begin(),v.end()
#define mp                      make_pair
#define pb                      push_back
#define pob                     pop_back
#define ff                      first
#define ss                      second
#define pii                     pair<int,int> 
#define pll                     pair<long,long>
#define mll                     map<ll,ll>
#define mii                     map<int,int>
#define vvii                    vector<vii>
#define vvll                    vector<vll>
#define mod                     1000000007
#define pi                      3.1415926535897932384626433832795

using namespace std;

void INPUT() 
{  
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif
}

/*
    
   -> Check For Overflows
   -> Out of Bounds
   -> Initialisations of global arrays and variables
   -> Its not Always Complex, Try to simplify
   -> write it down and try to solve
   -> Have Faith in urself and in ur approach
   -> If it seems totally out of reach, switch to next :)
   -> And Come Back later, if possible 
*/





void solve()
{ 
        ll n;
        cin >> n;
        
        vll v(n);
        
        fo(i,0,n-1) cin >> v[i];

        sort(all(v),greater<ll>());

        ll ans = 0LL;

        ans += v[0];

        ll left = n-2, val;
        int id;

        fo(i,1,n-1)
        {
          if(left>=2LL)
          {
            val = v[i]+v[i];
            ans += val;
            left--;
            left--;
          }
          else
          {
            id = i;
            break;
          } 
     }
     
     if(left>0) ans += v[id];

        cout << ans << endl;
       
}
int main() {
    
    FIO
    INPUT();
    
    int t;
    t = 1;
    //cin >> t;
    
    while(t--)
    {
       solve();
    }
    return 0;
}


Measured memory_bytes: 4788
#include <bits/stdc++.h>
#include <algorithm>
#include <string>
using namespace std;
 
int main() {
    ios::sync_with_stdio(false);
    cin.tie(NULL);
    int A, B, coin = 0;
    cin >> A >> B;
    for (int i = 0; i < 2; ++i){
        if (A >= B) {
            coin += A;
            --A;
        } else {
            coin += B;
            --B;
        }
    }
    cout << coin << endl;
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
#include <string.h>
#include <stdbool.h>
#include <math.h>
#include <time.h>
#include <limits.h>

int main(void){
    int a,b,s,i,n;
    while(scanf("%d%d",&a,&b)!=EOF){
        n=0;
        s=a+b;
        while(s!=0){
            s/=10;
            n++;
        }
        printf("%d\n",n);
    }
    return 0;
}



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

const ll MX = 1e18;

int main () {
    int n; cin >> n;
    bool flag = false;
    ll ans = 1;
    ll result;
    rep(i, n) {
        ll a; cin >> a;
        if (a == 0) {
            cout << 0 << endl;
            return 0;
        }
        if (__builtin_mul_overflow(ans, a, &result)) {
            flag = true;
        }
        ans *= a;
        if (ans > MX) flag = true;
    }
    if (flag) cout << -1 << endl;
    else cout << ans << endl;
    return 0;
}

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

long long gcd(long long a,long long b){
	if(a>b){
		swap(a,b);
	}
	while(true){
		if(b%a==0){
			return a;
		}else{
			b=b%a;
			swap(a,b);
		}
	}
}

int main() {
	long long n,m,i,j,k,ans=0,cur,res,mod=1000000007;
	string s,t;
	cin >> n;
	if(n%2==1){
		cout << 0; return 0;
	}
	n/=2;
	while(n>0){
		ans+=n/5;
		n/=5;
	}
	cout << ans;
	


	return 0;
}

Measured memory_bytes: 256
k,y,c = map( int, input().split(" "))
ss = input()

asc = []
dsc = []

cnt = 0
err_flg = 0
while( True ):
  if(len(ss) <= cnt):
    err_flg = 1
    break
  if( ss[cnt] == "o"):
    asc.append( cnt )
    cnt += c+1
  else:
    cnt += 1
    
  if( len(asc)==y ):
    break

cnt = 0
ss = ss[::-1]
while( True ):
  if(len(ss) <= cnt):
    err_flg = 1
    break
  if( ss[cnt] == "o"):
    dsc.append( cnt )
    cnt += c+1
  else:
    cnt += 1
    
  if( len(dsc)==y ):
    break
    
for i in range(len(dsc)):
  dsc[i] = len(ss) - dsc[i] - 1
  
dsc.reverse()
#print(asc)
#print(dsc)

if( err_flg == 0 ):
  for i in range(len(asc)):
    if( asc[i] == dsc[i] ):
      print(asc[i]+1)
    
  

Measured memory_bytes: 20588
n,k = map(int,input().split())
a = list(map(int,input().split()))
x = [1]
y = [False]*n
i = 0
s = 0
t = 0
xa = x.append
while True:
  if y[i] == True:
    for j in range(len(x)):
      if i == x[j]-1:
        s = j
        t = len(x)-j-1
        break
    break
  else:
    y[i] = True
    xa(a[i])
    i = a[i]-1
if k < s:
  print(x[k])
  exit()
x = x[s:-1]
print(x[(k-s)%t])

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

int main() {
    int k;
    string s;
    cin>>k>>s;
    int len = s.length();
    if(len <= k)
        cout<<s<<endl;
    else 
        cout<<s.substr(0, k)<<"...\n";
    return 0;
}

Measured memory_bytes: 3632
#include<iostream>
#include<math.h>
#include<stdio.h>
using namespace std;
int main(){
    
    while(1){
        double n,m=0,s=0,x=0,y=0;
        cin >> n;
        if(n==0)break;
        double a[1000]={};
        for(int i=0;i<n;i++){
            cin >> s;
            a[i]=s;
        }
        for(int j=0;j<n;j++){
           x+=a[j]; 
        }
        m=x/n;
        for(int i=0;i<n;i++){
            y+=(a[i]-m)*(a[i]-m);
        }
        printf("%.5f\n",sqrt(y/n));
        
    }
}


Measured memory_bytes: 3176
#include <bits/stdc++.h>
using namespace std;
int main(void){
    double left,right;
    int leftA,leftB,leftC,leftD,rightA,rightB,rightC,rightD;
    leftA=0;
    leftB=0;
    leftC=0;
    leftD=0;
    rightA=0;
    rightB=0;
    rightC=0;
    rightD=0;
    while (cin>>left>>right) {
        if (left>=1.1) {
            leftA++;
        } else if (left>=0.6 && left<1.1) {
            leftB++;
        } else if (left>=0.2 && left<0.6) {
            leftC++;
        } else if (left<0.2) {
            leftD++;
        }
        if (right>=1.1) {
            rightA++;
        } else if (right>=0.6 && right<1.1) {
            rightB++;
        } else if (right>=0.2 && right<0.6) {
            rightC++;
        } else if (right<0.2) {
            rightD++;
        }
    }
    cout<<leftA<<" "<<rightA<<endl;
    cout<<leftB<<" "<<rightB<<endl;
    cout<<leftC<<" "<<rightC<<endl;
    cout<<leftD<<" "<<rightD<<endl;
}



Measured memory_bytes: 3188
#define _CRT_SECURE_NO_WARNINGS
#include <bits/stdc++.h>

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


using namespace std;
void dout() { cerr << endl; }
typedef long long ll;
template <typename Head, typename... Tail>
void dout(Head H, Tail... T) {
    cerr << H << ' ';
    dout(T...);
}

#define debug(x) cout << #x " = " << (x) << endl

using ll = long long;
using pii = pair<ll, ll>;
using ld = long double;
using pll = pair<long long, long long>;

template <typename T>
void do_uniq(vector<T> vec) {
    sort(all(vec));
    vec.resize(unique(all(vec)) - vec.begin());
}

#define solvsh
//#define multi
#ifdef solvsh

const int MAXN = 1e3 + 20;
const int MAXTIME = 1e2 + 20;

ll mod  = 1e9 + 7;

ll ml (ll a, ll b) {
    return (a * b) % mod;
}

ll bin_p(ll b, ll p) {
    if (p == 0)
        return 1;
    if (p % 2)
        return ml(b, bin_p(b, p - 1));
    ll v = bin_p(b, p >> 1);
    return ml(v, v);
}

ll add(ll a, ll b) {
    return (a + b) % mod;
}


void solve() {
    ll a, v;
    ll b, w;
    ll t;
    cin >> a >> v >> b >> w >> t;

    ll di = abs(a - b);
    ll spee = v - w;
    if (spee < 0){
        cout << "NO";
        return;
    }

    if (t * spee < di) {
        cout << "NO";
    } else
        {
        cout << "YES";
        }
}

#else

void solve() {

}

#endif

void multisolve() {

    int t;
    cin >> t;

    int i = 1;
    while (t--) {
//        cout << "Mission #" << (i++) << ": \n";
        solve();
//        cout << "\n";
    }
}


#define int int
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr), cout.tie(nullptr);
    cout << fixed << setprecision(20);


#ifdef multi
    multisolve();
#else
    solve();
    //    gen();
#endif

}


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

using namespace std;

using ll = long long;
using ld = long double;

int main() {
    cin.tie(0); ios::sync_with_stdio(false);
    // cout << setprecision(8) << setiosflags(ios::fixed);

    constexpr ll MOD = 1e9 + 7;

    ll n, k;
    cin >> n >> k;

    vector<pair<ll, ll>> b;
    ll ub = n;
    while (0 < ub) {
        ll id = n / ub, lb = max(1ll, (n + 1 + id) / (id + 1));
        b.emplace_back(lb, ub);
        ub = lb - 1;
    }
    reverse(b.begin(), b.end());

    const ll size = b.size();
    vector<int> idx(size);
    for (int i = 0; i < size; ++i) {
        ll ub = n / b[i].second, id = n / ub, lb = (n + 1 + id) / (id + 1);
        pair<ll, ll> key(lb, ub);
        auto it = lower_bound(b.begin(), b.end(), key);
        idx[i] = distance(b.begin(), it);
    }

    vector<vector<ll>> dp(k, vector<ll>(size + 1));
    for (int i = 0; i < size; ++i) dp[0][i] = b[i].second - b[i].first  +1;
    for (int i = 1; i < size; ++i) (dp[0][i] += dp[0][i - 1]) %= MOD;

    for (int i = 1; i < k; ++i) {
        for (int j = 0; j < size; ++j) (dp[i][j] += dp[i - 1][idx[j]]) %= MOD;
        for (int j = 0; j < size; ++j) (dp[i][j] *= (b[j].second - b[j].first + 1)) %= MOD;
        for (int j = 1; j < size; ++j) (dp[i][j] += dp[i][j - 1]) %= MOD;
    }

    cout << dp[k - 1][size - 1] << endl;

    return 0;
}


Measured memory_bytes: 51444
n,k = map(int, input().split())
s = input()

now = "1"
p = 0
l = []

for i in range(n):
    if s[i] == now:
        p += 1
    else:
        l.append(p)
        if now == "1":
            now = "0"
        else:
            now = "1"
        p = 1

l.append(p)

if s[n - 1] == "0":
    l.append(0)

m = len(l) // 2

ans = 1

if m <= k:
    ans = n
else:
    ans = sum(l[:2 * k + 1])
    nowans = ans
    for i in range(m - k):
        nowans += l[2*(k+i)+1] + l[2*(k+i+1)]
        nowans -= l[2*i] + l[2*i+1]
        ans = max(ans, nowans)

print(ans)

Measured memory_bytes: 45808
#include <bits/stdc++.h>
using ll = long long;
using namespace std;
#define rep(i,n) for(int i=0, i##_len=(int)(n); i<i##_len; i++)
#define reps(i,n) for(int i=1 , i##_len=(int)(n);i<=i##_len;i++)
#define rrep(i,n) for(int i=((int)(n)-1);i>=0;i--)
#define rreps(i,n) for(int i=((int)(n));i>0;i--)
#define repi(i,x) for(auto i=(x).begin(),i##_fin=(x).end();i!=i##_fin;i++)
#define all(x) (x).begin(), (x).end()
#define F first
#define S second
#define mp make_pair
#define pb push_back
#define solve(a) ((a)?"Yes":"No")
typedef vector<int> Vi;
typedef vector<Vi> VVi;
typedef pair<int , int> Pi;
typedef vector<Pi> VPi;
typedef vector<long long> V;
typedef vector<V> VV;
typedef pair<long long , long long> P;
typedef vector<P> VP;
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;}
const long long INFLL = 1LL<<60;
const int INF = 1<<30;
const double PI=acos(-1);
int main(){
	string s,t;
	int ans=-1;
	bool can;
	cin >>s>>t;
	for(int i=0;i<s.size()-t.size()+1;i++){
		can=true;
		for(int j=0;j<t.size();j++){
		//	clog<<s[i+j];
			if(s[i+j]!=t[j] and (s[i+j]!='?')){
				can=false;
			}
		
			
		}
		if (can)
		{
			ans = i; //header
		}
		//clog << endl;
	}
	if(ans==-1){
		cout << "UNRESTORABLE"<<endl;
			return 0;
	}
	for(int i=0;i<t.size();i++){
		s[i+ans]=t[i];
	}
	for(int i=0;i<s.size();i++){
		if(s[i]=='?'){s[i]='a';}
	}
	cout<<s<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
void debug() {cout<<endl;}
template<typename T,typename... Args>
void debug(T x,Args... args) {cout<<x<<" ";debug(args...);}
#define forn(i,a,b) for(int i=a;i<b;++i)
#define pb push_back
#define F first
#define S second
#define endl "\n"
typedef long long ll;
typedef pair<int, int> pii;

const int N = 405;
ll psum[N], dp[N][N], val[N], inf = 1e18;
int n;

ll cost(int i, int j){
  if(i-1 >= 0)return psum[j]-psum[i-1];
  return psum[j];
}

ll f(int i, int j){
  if(i == j)return 0;
  ll &ans  = dp[i][j];
  if(ans != -1)return ans;
  ans = inf;
  forn(k, i, j+1){
    ans = min(ans, f(i, k)+f(k+1, j)+cost(i, j));
  }
  return ans;
}


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

  cin >> n;
  forn(i, 0, n){
    cin >> val[i];
    psum[i] = val[i];
    if(i)psum[i] += psum[i-1];
  }
  memset(dp, -1, sizeof dp);
  cout << f(0, n-1) << endl;


}





Measured memory_bytes: 4848
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <utility>
#include <tuple>
#include <algorithm>
#include <numeric>
#include <cstdio>
#include <cmath>
#define rep(i, n) for(int i = 0; i < (n); i++)
using namespace std;
using ll = long long;
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; }

int main(){
  int N;
  cin >> N;
  vector<int> t(N), v(N+1);
  rep(i, N) {
    cin >> t[i];
    if(i)
      t[i] += t[i-1];
  }
  rep(i, N) cin >> v[i];
  vector<double> graph(t[N-1]*2+1);
  int p = 0;
  rep(i, t[N-1]*2+1) {
    while(i/2.0 > t[p]) p++;
    double mn = i/2.0;
    rep(j, p)
      chmin(mn, v[j]+i/2.0-t[j]);
    chmin(mn, (double)v[p]);
    for(int j=p; j<N; j++)
      chmin(mn, v[j+1]+t[j]-i/2.0);
    graph[i] = mn;
  }
  double ans = 0;
  rep(i, t[N-1]*2)
    ans += (graph[i]+graph[i+1])*0.5/2;
  cout << fixed << setprecision(3) << ans << endl;
  return 0;
}

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

int main()
{
	int N;
	cin >> N;
	vector<string> S( N );
	for( int i = 0; i < N; i++ ) {
		cin >> S[i];
		sort( S[i].begin(), S[i].end() );
	}

	sort( S.begin(), S.end() );
	long long ans = 0;
	long long ans1 = 0;
	for( int i = 0; i < N - 1; i++ ) {
		if( S[i] == S[i + 1] ) {
			ans1++;
		}
		else {
			while( ans1 ) {
				ans += ans1;
				ans1--;
			}
			ans1 = 0;
		}
	}
	while( ans1 ) {
		ans += ans1;
		ans1--;
	}

	cout << ans <<  endl;
}


Measured memory_bytes: 7296
n=int(input())
a=[0]*n
for i in range(n):
    x,y=input().split()
    y=int(y)
    if x=='S': a.append(y)
    elif x=='H': a.append(y+13)
    elif x=='C': a.append(y+26)
    else: a.append(y+39)
for i in range(1,53):
    if not i in a:
        if i<=13: print(f'S {i}')
        elif i<=26: print(f'H {i-13}')
        elif i<=39: print(f'C {i-26}')
        else: print(f'D {i-39}')


Measured memory_bytes: 5608
#include <iostream>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <algorithm>
#include <functional>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <bitset>
#include <cassert>
#include <exception>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll,ll> P;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<string> vs;
typedef vector<P> vp;
#define rep(i,a,n) for(ll i = (a);i < (n);i++)
#define per(i,a,n) for(ll i = (a);i > (n);i--)
#define lep(i,a,n) for(ll i = (a);i <= (n);i++)
#define pel(i,a,n) for(ll i = (a);i >= (n);i--)
#define clr(a,b) memset((a),(b),sizeof(a))
#define pb push_back
#define mp make_pair
#define all(c) (c).begin(),(c).end()
#define sz size()
#define print(X) cout << (X) << endl
const ll INF = 1e+9+7;
ll n,m,l;
string s,t;
ll d[200010],dp[550][550];

int main(){
  ll p;
  cin >> n >> m >> l >> p;
  print(min(n,m)+min(l,p));
  return 0;
}

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

ll inf=9223372036854775806;

int main()
{
	//freopen("input.txt","r",stdin);freopen("output.txt","w",stdout);
	ios_base::sync_with_stdio(false); cin.tie(0);
	int n,a[4],i;
	cin>>n;
	for (i=0;i<4;i++){
		a[3-i]=n%10;
		n/=10;
	}
	if (a[0]==a[1]&&a[1]==a[2]||a[1]==a[2]&&a[2]==a[3]){
		cout<<"Yes";
	}
	else {
		cout<<"No";
	}
	return 0;
}

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

int main(){
    long x,y,a,b,c,d=0,e=0,f=0,ans = 0;
    cin >> x >> y >> a >> b >> c;
    long p[a],q[b],r[c];
    vector<pair<int,char>> k; 
    rep(i,a){
        cin >> p[i];
        k.push_back(make_pair(p[i],'r'));
    } 
    rep(i,b){
        cin >> q[i];
        k.push_back(make_pair(q[i],'g'));
    } 
    rep(i,c){
        cin >> r[i];
        k.push_back(make_pair(r[i],'n'));
    }
    sort(k.begin(),k.end());
    reverse(k.begin(),k.end());
    rep(i,k.size()){
        if(k[i].second=='r'&&x-d>0){
           d++;
           ans += k[i].first;
        } 
        if(k[i].second=='g'&&y-e>0){
            e++;
            ans += k[i].first;
        }
        if(k[i].second=='n'){
            f++;
            ans += k[i].first;
        } 
        if((x-d+y-e)<=f) break;
    }
    cout << ans << endl;
}


Measured memory_bytes: 8432
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i,n) for(int (i)=0;(i)<(int)(n);++(i))
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define fi first
#define se second
#define dbg(x) cout<<#x" = "<<((x))<<endl
template<class T,class U> ostream& operator<<(ostream& o, const pair<T,U> &p){o<<"("<<p.fi<<","<<p.se<<")";return o;}
template<class T> ostream& operator<<(ostream& o, const vector<T> &v){o<<"[";for(T t:v){o<<t<<",";}o<<"]";return o;}

int main(){
    int h,w;
    cin >>h >>w;
    vector<vector<int>> a(h,vector<int>(w));
    rep(i,h)rep(j,w) cin >>a[i][j];

    int ans = 0;
    rep(i,h){
        int tmp = 0;
        rep(j,w+1)rep(lr,2){
            int aaa = 0;
            vector<int> v(a[i]);
            if(lr==0){
                rep(k,j){
                    aaa += v[k];
                    if(k+1<w) v[k+1] = !v[k+1];
                }
                for(int k=w-1; k>=j; --k){
                    aaa += v[k];
                    if(k-1>=0) v[k-1] = !v[k-1];
                }
            }
            else{
                for(int k=w-1; k>=j; --k){
                    aaa += v[k];
                    if(k-1>=0) v[k-1] = !v[k-1];
                }
                rep(k,j){
                    aaa += v[k];
                    if(k+1<w) v[k+1] = !v[k+1];
                }
            }

            tmp = max(tmp, aaa);
        }

        ans += tmp;

        if(i<h-1){
            rep(j,w) a[i+1][j] = !a[i+1][j];
        }
    }

    cout << ans << endl;
    return 0;
}



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

using namespace std;
typedef long long ll;
typedef pair<int, int> P;
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define each(i, mp) for (auto &i : mp)
#define sz(x) int(x.size())

int main()
{
  string s, t;
  cin >> s >> t;
  int sn = sz(s);
  rep(i, sn)
  {
    if (s[i] != t[i])
    {
      cout << "No" << endl;
      return 0;
    }
  }
  cout << "Yes" << endl;
  return 0;
}


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

int main() {
  int N,K;
  int ans = 1;
  
  cin >> N;
  cin >> K;

  for (int i=0; i < N; i++) {
	  if ( ans *2 <= ans + K) ans *=2;
  	else ans +=K;
  }
  cout << ans;
}



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

#define each(i, c) for (auto& i : c)
#define mkp(a, b) make_pair(a, b)

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> Pll;
const ll MOD = 1e9+7;

template<typename P, typename Q> ostream& operator << (ostream& os, pair<P, Q> p) { os << "(" << p.first << ": " << p.second << ")"; return os; }
template<typename T> ostream& operator << (ostream& os, vector<T> v) { os << "("; each (i, v) os << i << ", "; os << ")"; return os; }
template<typename K, typename V> ostream& operator << (ostream& os, map<K, V> m) { os << "{"; each (i, m) os << i << ", "; os << "}"; return os; }

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

  string s;
  cin >> s;

  vector<ll> rs;
  vector<ll> gs;
  vector<ll> bs;
  for (ll i = 0; i < s.size(); ++i) {
    if (s[i] == 'R') rs.push_back(i);
    if (s[i] == 'G') gs.push_back(i);
    if (s[i] == 'B') bs.push_back(i);
  }

  ll ans = rs.size()*gs.size()*bs.size();
  each (r, rs) {
    each (g, gs) {
      if (g <= r) continue;
      ll b = g + (g - r);
      if (bs.size() == 0) continue;
      if (b > bs[bs.size()-1]) continue;
      if (s[b] == 'B') ans--;
    }
    each (b, bs) {
      if (b <= r) continue;
      ll g = b + (b - r);
      if (gs.size() == 0) continue;
      if (g > gs[gs.size()-1]) continue;
      if (s[g] == 'G') ans--;
    }
  }
  each (g, gs) {
    each (r, rs) {
      if (r <= g) continue;
      ll b = r + (r - g);
      if (bs.size() == 0) continue;
      if (b > bs[bs.size()-1]) continue;
      if (s[b] == 'B') ans--;
    }
    each (b, bs) {
      if (b <= g) continue;
      ll r = b + (b - g);
      if (rs.size() == 0) continue;
      if (r > rs[rs.size()-1]) continue;
      if (s[r] == 'R') ans--;
    }
  }
  each (b, bs) {
    each (r, rs) {
      if (r <= b) continue;
      ll g = r + (r - b);
      if (gs.size() == 0) continue;
      if (g > gs[gs.size()-1]) continue;
      if (s[g] == 'G') ans--;
    }
    each (g, gs) {
      if (g <= b) continue;
      ll r = g + (g - b);
      if (rs.size() == 0) continue;
      if (r > rs[rs.size()-1]) continue;
      if (s[r] == 'R') ans--;
    }
  }

  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 3600
#####

import numpy as np
# from numpy import int64, int8
from collections import Counter

#####

def getIntList(inp):
	return [int(_) for _ in inp]


from sys import stdin
# import sys
# sys.setrecursionlimit(10**8)

def getInputs():
	inputs=[]
	for line in stdin:
		line=line.split()
		inputs.append(line)
	return inputs


def unique(x):
	count=Counter()
	for xi in x:
		count[xi]+=1
	u,c=zip(*count.items())
	return u,c



def main(inputs):
	n=int(inputs[0][0])
	aa=getIntList(inputs[1])

# 	n=200000
# 	aa=np.random.randint(1,n+1,n)
	
# 	print("start")
# 	aa=np.array(aa)
# 	aUnique, count=np.unique(aa, return_counts=True)

	aUnique, count=unique(aa)
	aUnique=np.array(aUnique, np.int64)
	count=np.array(count, np.int64)
	
# 	print(n)
# 	print("aa",aa)
# 	print("aUnique",aUnique)
# 	print("count  ",count)
	
# 	countUnique,countCount=np.unique(count, return_counts=True)
	countUnique,countCount=unique(count)
	countCount=np.array(countCount, np.int64)
	
	pat={}
	countAns=np.empty(len(countUnique), np.int64)
	countAns1=np.empty(len(countUnique), np.int64)
	for ci,c in enumerate(countUnique):
		if c not in pat:
			ni=c*(c-1)//2
			pat[c]=ni
		countAns[ci]=pat[c]
		
		c-=1
		if c not in pat:
			ni=c*(c-1)//2
			pat[c]=ni
		countAns1[ci]=pat[c]
	
# 	print("countUnique",countUnique)
# 	print("countCount ",countCount)
# 	print("countAns ",countAns)
# 	print("countAns1",countAns1)
	
	countUniqueIndex=dict([(c,i) for i,c in enumerate(countUnique)])
# 	print("countUniqueIndex", countUniqueIndex)
	
# 	uniNums=np.empty(len(aUnique), np.int64)
	nums=np.empty(n, np.int64)
	ans={}
	for cui,cu in enumerate(countUnique):
		countCount[cui]-=1
		num0=(countAns*countCount).sum()
		countCount[cui]+=1
		num1=countAns1[cui]
		num=num0+num1
# 		print(cu,num)
		countMask=count==cu
# 		uniNums[countMask]=num
		targetA=aUnique[countMask]
# 		print(targetA)
		for a in targetA:
			ans[a]=num
# 		print(targetA[None,:])
# 		print(aa[:,None])
# 		aMask=(aa[:,None]==targetA[None,:]).any(axis=1)
# 		print(aMask)

# 		nums[aMask]=num
# 	print("\n".join(map(str,nums)))

	for a in aa:
		print(ans[a])
	

if __name__=="__main__":
	inputs=getInputs()
# 	inputs=simInputs()
	main(inputs)


Measured memory_bytes: 57724
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<functional>
#include<assert.h>
#include<numeric>

using namespace std;

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

using ll = long long;
const int inf=1e9+7;
const ll longinf=1LL<<60 ;
const ll mod=1e9+7 ;

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

    string s;
    cin >> s;
    for (int i=0; i < ceil(1.0*s.size()/2); i++) {
        if (i >= s.size()-1-i) break;
        if (s[i] == s[s.size()-1-i]) {
            continue;
        } else {
            cout << "No\n";
            return 0;
        }
    }

    for (int i=0; i < s.size(); i++) {
        if (i >= (s.size()-1)/2-i) break;
        if (s[i] == s[(s.size()-1)/2-1-i]) {
            continue;
        } else {
            cout << "No\n";
            return 0;
        }
    }

    for (int i=(s.size()+3)/2-1; i < s.size(); i++) {
        if (i >= (s.size()-1)/2-i) break;
        if (s[i] == s[s.size()-1-i]) {
            continue;
        } else {
            cout << "No\n";
            return 0;
        }
    }
    cout << "Yes\n";
}

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

/* */

int main(){
    // 入力スタンダード
    double a,c;
    int b,d;
    cin >> a >> b >> c >> d;
    double t, ao;
    // 入力スタンダード（複数指定）
    t = c/b;
    ao = a/d;
    if(ceil(t) <= ceil(ao)){
        cout<<"Yes";
    }else{
        cout<<"No";
    }
    return 0;
    
}

Measured memory_bytes: 3720
#include<stdio.h>
#include<stdlib.h>
int main()
{
    int N;
    char A[101],B[101],C[101];
    int i;
    int count = 0;
    int check;

    scanf("%d", &N);
    scanf("%s",A);
    scanf("%s",B);
    scanf("%s",C);

    for(i=0;i<N;i++){
       check = 0;
       if(A[i]==B[i]) check++;
       if(B[i]==C[i]) check++;
       if(A[i]==C[i]) check++;

       if(check == 1) count = count + 1;
       if(check == 0) count = count + 2;
    }
    printf("%d\n",count);
    return 0;
}


Measured memory_bytes: 128
import numpy as np

N,K=map(int,input().split())
A=list(map(int,input().split()))

B=np.zeros(shape=N+1,dtype=np.int64)
C=np.arange(0,N)

sousa=0
kaisuu=min(K,42)



while sousa<kaisuu:
    np.add.at(B, np.maximum(0,C-A),1)
    np.add.at(B,np.minimum(N,C+A+1),-1)
    A = B.cumsum()[:-1]
    sousa+=1
    
    B *= 0
    
A=[str(k) for k in A]
print(" ".join(A))

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


int main(){
	int A, B;
	cin >> A >> B;
	int ans = 0;
	while(1 + (A - 1)*ans < B) ans++;
	cout << ans << endl;
		
}












Measured memory_bytes: 3636
h,w=map(int,input().split())
n=int(input())
l=list(map(int,input().split()))
count=0
ans=[["0" for i in range(w)] for j in range(h)]
now=0
index=0
locate=[0,0]
while count<h*w:
  count+=1
  if now==0:
    now+=l[index]
    index+=1
  x=locate[0]
  y=locate[1]
  ans[x][y]=str(index)
  if x%2==0:
    if y<w-1:
      y+=1
    else:
      x+=1
  else:
    if y!=0:
      y-=1
    else:
      x+=1
  now-=1
  locate=[x,y]
for i in range(h):
  print(" ".join(ans[i]))

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

typedef struct re{
  int AC;
  int WA[20];
  int pe;
  int tID;
  bool operator<(const re &right) const{
    return AC == right.AC ?(pe == right.pe ? tID > right.tID :pe > right.pe ) : AC < right.AC;
  }
  
}S;

int main(){
  int T ,P ,R ,tid, pid, time;
  string str = "CORRECT", temp;

  while(1){
    S a[100] = {};
    cin>>T>>P>>R;
    if(!T&&!P&&!R)break;
    for(int i = 0; i <= T; i++)a[i].tID = i;
    for(int i = 1; i <= R; i++){
      cin>>tid>>pid>>time>>temp;
      if(temp == str){
	a[tid].AC++;
	a[tid].pe += a[tid].WA[pid] * 1200 + time;
      } else{
	a[tid].WA[pid]++;
      }
    }
    sort(a+1, a+T+1);
    for(int i = T;i; i--){
      cout<<a[i].tID<<" "<<a[i].AC<<" "<<a[i].pe<<endl;
    }
  }
  
  return 0;
}



Measured memory_bytes: 3164
from collections import Counter

n = int(input())
v = list(map(int, input().split()))

even_counter = Counter()
odd_counter = Counter()
for i in range(n):
  if i % 2 == 0:
    even_counter[v[i]] += 1
  else:
    odd_counter[v[i]] += 1

even_num = n//2
odd_num = (n + 2 - 1)//2

evens = even_counter.most_common(2)
odds = odd_counter.most_common(2)

if evens[0][0] == odds[0][0]:
  if len(evens) == 1 and len(odds) == 1:
    print(even_num)
  elif len(evens) > 1 and len(odds) == 1:
    ans_even = even_num - evens[1][1]
    ans_odd = odd_num - odds[0][1]
    print(ans_even + ans_odd)
  elif len(evens) == 1 and len(odds) > 1:
    ans_even = even_num - evens[0][1]
    ans_odd = odd_num - odds[1][1]
    print(ans_even + ans_odd)
  elif len(evens) > 1 and len(odds) > 1:
    if even_num - evens[1][1] >= odd_num - odds[1][1]:
      ans_even = even_num - evens[0][1]
      ans_odd = odd_num - odds[1][1]
      print(ans_even + ans_odd)
    else:
      ans_even = even_num - evens[1][1]
      ans_odd = odd_num - odds[0][1]
      print(ans_even + ans_odd)
else:
  ans_even = even_num - evens[0][1]
  ans_odd = odd_num - odds[0][1]
  print(ans_even + ans_odd)


Measured memory_bytes: 23520
#include<bits/stdc++.h>
using namespace std;
int main() {
	int n, k; cin >> n >> k;
	vector<int> a(n);
	for (int i = 0; i < n; i++)
	{
		cin >> a[i];
	}
	int cnt = 0;
	while ((*min_element(a.begin(), a.end()) < n) && cnt < k)
	{
		vector<int> imos(n, 0);
		for (int j = 0; j < n; j++)
		{
			if(j - a[j] >= 0) imos[j-a[j]]++;
			else imos[0]++;
			if(j + a[j] < n-1) imos[j+a[j]+1]--;
		}
		for (int j = 1; j < n; j++)
		{
			imos[j] += imos[j-1];
		}
		a = imos;
		cnt++;
	}
	for (int i = 0; i < n; i++)
	{
		cout << a[i];
		if(i == n-1) cout << endl;
		else cout << " ";
	}

	return 0;
}


Measured memory_bytes: 4784
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<map>
#include<set>
#include<utility>
#include<cmath>
#include<cstring>
#include<queue>
#include<cstdio>
#define loop(i,a,b) for(int i=a;i<b;i++) 
#define rep(i,a) loop(i,0,a)
#define pb push_back
#define mp make_pair
#define all(in) in.begin(),in.end()
const double PI=acos(-1);
const double EPS=1e-10;
const int inf=1e9;
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int,int> pii;
bool f(vvi dp){
	rep(i,3){
		rep(j,7){
			if(j==7){
				if(dp[i][7]||dp[i][8])return 0;
				continue;
			}
			if(dp[i][j]){
				if(dp[i][j]>=3){
					dp[i][j]-=3;
					if(f(dp))return 1;
					dp[i][j]+=3;
				}
				if(dp[i][j]>dp[i][j+1]||dp[i][j]>dp[i][j+2])return 0;
				dp[i][j+1]-=dp[i][j];
				dp[i][j+2]-=dp[i][j];
				dp[i][j]=0;
			}
		}
	}
	return 1;
}
int main(){
	int q;
	cin>>q;
	map<char,int>m;
	m['R']=0;
	m['G']=1;
	m['B']=2;
	while(q--){
		vvi dp(3,vi(10));
		{
			vi a(9);
			vector<char>b(9);
			rep(i,9)cin>>a[i];
			rep(j,9)cin>>b[j];
			rep(i,9)dp[m[b[i]]][a[i]-1]++;
		}
		cout<<f(dp)<<endl;
	}
}

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

struct node {
    int sum;
};

template<class T> struct SegTree {
    using Func = function<T(T&, T&)>;
    const Func combine;
    const T UNITY;
    int SIZE_R;
    vector<T> data;
    
    SegTree(int n, const Func f, const T &unity) : combine(f), UNITY(unity) {
        init(n);
    }
    void init(int n) {
        SIZE_R = 1;
        while (SIZE_R < n) {
            SIZE_R *= 2;
        }
        data.assign(SIZE_R * 2, UNITY);
    }
    
    void set(int a, const T &v) {
        data[a + SIZE_R] = v;
    }
    
    void build() {
        for (int k = SIZE_R - 1; k > 0; --k) {
            data[k] = combine(data[k * 2], data[k * 2 + 1]);
        }
    }
    
    void update(int a, const T &v) {
        int k = a + SIZE_R;
        data[k] = v;
        while (k >>= 1) {
            data[k] = combine(data[k * 2], data[k * 2 + 1]);
        }
    }
    
    // [a, b)
    T get(int a, int b) {
        T v_left = UNITY, v_right = UNITY;
        for (int left = a + SIZE_R, right = b + SIZE_R; left < right; left >>= 1, right >>= 1) {
            if (left & 1) {
                // L = (left + 1) / 2 : [left, L * 2, L * 2 + 1, ...
                v_left = combine(v_left, data[left++]);
            }
            if (right & 1) {
                // R = (right - 1) / 2 : (R - 1) * 2, (R - 1) * 2 + 1, right - 1, right)
                v_right = combine(data[--right], v_right);
            }
        }       
        return combine(v_left, v_right);
    }
    
    inline T operator [] (int a) {
        return data[a + SIZE_R];
    }
    
    void print() {
        for (int i = 0; i < SIZE_R; ++i) {
            cout << (*this)[i];
            if (i != SIZE_R - 1) {
                cout << ", ";
            }
        }
        cout << endl;
    }
};

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int N, Q;
    cin >> N >> Q;
    vector<int> c(N), index(N);
    vector<vector<int>> pos(N + 1); // pos[color]
    for (int i = 0; i < N; ++i) {
        cin >> c[i];
        index[i] = pos[c[i]].size();
        pos[c[i]].push_back(i);
    }
    vector<vector<pair<int, int>>> R(N);
    for (int i = 0; i < Q; ++i) {
        int l, r;
        cin >> l >> r;
        R[l - 1].push_back({r - 1, i});
    }
    auto combine = [](node &A, node &B){
        node res;
        res.sum = A.sum + B.sum;
        return res;
    };
    node UNITY = {0};
    SegTree<node> T(N, combine, UNITY);
    for (int i = 0; i < N; ++i) {
        if (index[i] == 0) {
            node V = {1};
            T.set(i, V);
        }
    }
    T.build();
    vector<int> ans(Q);
    for (int l = 0; l < N; ++l) {
        for (auto &P : R[l]) {
            int r = P.first, i = P.second;
            node res = T.get(l, r + 1);
            ans[i] = res.sum;
        }
        if (index[l] + 1 < pos[c[l]].size()) {
            node V = {1};
            T.update(pos[c[l]][index[l] + 1], V);
        }
    }
    for (int i = 0; i < Q; ++i) {
        cout << ans[i] << '\n';
    }
    return 0;
}

Measured memory_bytes: 62792
#include<iostream>
    #include<stdio.h>
    //#include <bits/stdc++.h>
    #include<vector>
    #include<float.h>
    #include<iomanip>
    #include<algorithm>
    #include<string>
    #include<cstring>
    #include<math.h>
    #include<cmath>
    #include<sstream>
    #include<set>
    #include<map>
    #include<queue>
    #include<cassert>
    #include<cmath>
    #include<cstdint>
using namespace std;

bool seen[55][55];
vector<string> s(55);
int w, h;
int dx[4] = {-1, 0, 1, 0};
int dy[4] = {0, 1, 0, -1};
int res;

void dfs(int y, int x){
    seen[y][x] = true;

    for(int i = 0; i < 4; i++){
        
            
            int ny = y + dy[i], nx = x + dx[i];
            
            if(ny < 0 || ny >= h || nx < 0 || nx >= w)continue;
            if(seen[ny][nx])continue;
            if(s[ny][nx] == '#' || s[ny][nx] == '@')continue;
            res++;
            dfs(ny, nx);
        
    }
}

int main(){
    while(cin >> w >> h){
      if(w == 0 && h == 0)return 0;
      res = 0;
    int sy, sx;
    for(int i = 0; i < h; i++)cin >> s[i];
    for(int i = 0; i < h; i++)for(int j = 0; j < w; j++){
        if(s[i][j] == '@')sy = i, sx = j;
        seen[i][j] = false;
    }
    dfs(sy, sx);
    cout << res + 1 << endl;
    }
}


Measured memory_bytes: 3176
N, W = map(int, input().split())
w, v = [0] * N, [0] * N
for i in range(N):
	w[i], v[i] = map(int, input().split())

DP = [[0] * (W + 2) for i in range(N + 2)]
"""
DP[0][W]
DP[i][j]
i:荷物の個数
j:残り容量
"""
for i in range(N):
    for j in range(W+1):
        if j>=w[i]:#残り容量に余裕があるとき
            DP[i+1][j]=max(DP[i][j],DP[i][j-w[i]]+v[i])
        else:
            DP[i+1][j]=DP[i][j]

print(max(DP[N]))

Measured memory_bytes: 148692
import java.util.*;
class Main{
public static void main(String[] args) {
  Scanner reader =new Scanner (System.in);
  int n =reader.nextInt();
  if(n%10==3)
  {
    System.out.println("bon");
    return;
  }
  if(n%10==0)
  {
    System.out.println("pon");
    return;
  }
  if(n%10==1)
  {
    System.out.println("pon");
    return;
  }
  if(n%10==6)
  {
    System.out.println("pon");
    return;
  }
  if(n%10==8)
  {
    System.out.println("pon");
    return;
  }


    System.out.println("hon");
    return;



}
}


Measured memory_bytes: 35700
import java.io.*;
import java.lang.reflect.Array;
import java.math.*;
import java.text.DecimalFormat;
import java.util.*;




public class Main {
    private static final int mod = 1000000007;
    private static int K;
    private static int [] A;

    private static long f(long n){
        for(int x : A)
            n -= n%x;
        return n ;
    }

    public static void main(String[] args) throws Exception{
        IO io = new IO(null,null);
        long [] A = new long[3];
        for (int i = 0;i < 3;i++)
            A[i] = io.getNextInt();
        long ans = Long.MAX_VALUE;
        for (int i = 0,j = 1,k = 2;i < 3;i++,j++,k++) {
            if (j == 3) j = 0;
            if (k == 3) k = 0;
            long h = A[i]/2,x = A[j]*A[k]*h,y = A[j]*A[k]*(A[i] - h);
            ans = Math.min(ans,y - x);
        }
        io.println(ans);
        io.close();
    }
}



class IO{
    private BufferedReader br;
    private StringTokenizer st;
    private PrintWriter writer;
    private String inputFile,outputFile;

    public boolean hasMore() throws IOException{
        if(st != null && st.hasMoreTokens()) return true;
        if(br != null && br.ready()) return true;
        return false;
    }
    public String getNext() throws FileNotFoundException, IOException{
        while(st == null || !st.hasMoreTokens()) st = new StringTokenizer(br.readLine());
        return st.nextToken();
    }

    public String getNextLine() throws FileNotFoundException, IOException{
        return br.readLine().trim();
    }

    public int getNextInt() throws FileNotFoundException, IOException{
        return Integer.parseInt(getNext());
    }
    public long getNextLong() throws FileNotFoundException, IOException{
        return Long.parseLong(getNext());
    }

    public void print(double x,int num_digits) throws  IOException{
        writer.printf("%." + num_digits + "f" ,x);
    }
    public void println(double x,int num_digits) throws  IOException{
        writer.printf("%." + num_digits + "f\n" ,x);
    }
    public void print(Object o) throws  IOException{
        writer.print(o.toString());
    }

    public void println(Object o) throws  IOException{
        writer.println(o.toString());
    }
    public IO(String x,String y) throws FileNotFoundException, IOException{
        inputFile = x;
        outputFile = y;
        if(x != null) br = new BufferedReader(new FileReader(inputFile));
        else br = new BufferedReader(new InputStreamReader(System.in));
        if(y != null) writer = new PrintWriter(new BufferedWriter(new FileWriter(outputFile)));
        else writer = new PrintWriter(new OutputStreamWriter(System.out));
    }

    protected void close() throws IOException{
        br.close();
        writer.close();
    }
    public void outputArr(Object [] A) throws IOException{
        int L = A.length;
        for (int i = 0;i < L;i++) {
            if(i > 0) writer.print(" ");
            writer.print(A[i]);
        }
        writer.print("\n");
    }
}


Measured memory_bytes: 22612
#include<bits/stdc++.h>
// #include<ext/pb_ds/assoc_container.hpp>
// #include<ext/pb_ds/tree_policy.hpp>
// using namespace __gnu_pbds;
using namespace std;
#define int                 long long
#define FF(i,a,b)           for(int i=a;i<b;i++)
#define BF(i,a,b)           for(int i=a;i>=b;i--)
#define vi                  vector<int>
#define MAP                 map<int,int>
#define pb                  push_back
#define MP                  make_pair
#define F                   first
#define S                   second
#define pi                  pair<int,int>
#define all(v)              v.begin(),v.end()
#define PIE                 3.1415926535897932384626433832795
#define FastIO              ios::sync_with_stdio(0); cin.tie(0);cout.tie(0)
//#define ordered_set         tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update>
/*

    order_of_key (k) : Number of items strictly smaller than k .
    find_by_order(k) : K-th element in a set (counting from zero).

*/
/**************************************************************************************/
                       /*Global Variables*/
const int mod = 1e9+7;
const int N = 1e6+10;
const int inf = 3e18;
vi fact[N];
/**************************************************************************************/
template <typename A>istream& operator>>(istream& input,vector<A>& x) {for(auto& i:x)input>>i;return input;}
template<typename A>ostream& operator<<(ostream& output,vector<A>& x) {for(auto& i:x)output<<i<<' ';return output;}
int add(int a, int b){return (a%mod + b%mod + mod)%mod;}
int sub(int a, int b){return (a%mod - b%mod + mod)%mod;}
int mul(int a, int b){return ((a%mod)*(b%mod) + mod)%mod;}
int mp[N];
int vis[N];
signed main()
{
    FastIO;
    int T=1;
    //cin>>T;
    for(int i=1;i<N;i++)
    {
        for(int j=i;j<N;j+=i)
        {
            fact[j].pb(i);
        }
    }
    
    while(T--)
    {
        int n;
        cin>>n;
        vi a(n);
        cin>>a;
        sort(all(a));
        for(auto it:a)mp[it]++;
        int ans=0;
        for(int i=0;i<n;i++)
        {
            bool ok=false;
            int val=a[i];
            if(mp[val]>1)
            {
                vis[val]=1;
                continue;
            }
            for(auto it:fact[val])if(vis[it]){ok=true;break;}
            if(!ok)ans++;
            vis[val]=1;
        }
        cout<<ans<<"\n";
    }

}
/*
|| Do what you can with all you have,wherever you are. ||

|| Knowing is not enough, we must apply. Wishing is not enough, we must do. ||

|| A goal is a dream with deadline. ||

|| Whether you think you can or you think you can't, you're right. ||

|| A year from now you may wish you had started today ||
*/



Measured memory_bytes: 201144
from collections import defaultdict
nb_people = int(input())
immediates = [int(x) for x in input().split()]
bosses = defaultdict(list)
emp_id  = 0
for i in immediates:
    bosses[i].append(emp_id)
    emp_id += 1
for i in range(1, nb_people+1):
    if i in bosses:
        print(len(bosses[i]))
    else:
        print("0")





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

int main() {
    int A, B, X;

    cin >> A >> B >> X;
    
    if(A > X) {
	cout << "NO" << endl;
    } else if( A < X ){
	if((X-A) <= B) 
	    cout << "YES" << endl;
	else cout << "NO" << endl;
    } else cout << "YES" << endl;
    return 0;
}

Measured memory_bytes: 256
//g++  7.4.0

#include <bits/stdc++.h>
#define ll long long
using namespace std;
int main()
{
    ll int a,b,c,d;
    cin>>a>>b>>c>>d;
    ll int x=max(a*c,a*d);
    ll int y=max(b*c,b*d);
    cout<<max(x,y);
}

Measured memory_bytes: 3632
N = int( input() )
A, B = list( map(lambda x: int(x), input().split(" ")) ), list( map(lambda x: int(x), input().split(" ")) )
#A = monsters. B = number of to be able to kill monsters.殺せる数

 
def kill_monsters(Ai, Bi):

    Ai -= Bi
    Bi = 0

    if Ai < 0:
        Bi += -1*Ai
        Ai = 0

    return (Ai, Bi)
 
def main(local_A, local_B, lim):
 
    for i in range(lim):
        local_A[i], local_B[i] = kill_monsters(local_A[i], local_B[i])
 
        if 0 < local_B[i]:
            local_A[i+1], local_B[i] = kill_monsters(local_A[i+1], local_B[i])
 
    return [local_A, local_B]

print( sum(A) - sum(main(A, B, N)[0]) )

Measured memory_bytes: 19004
#include <algorithm>
#include <bitset>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <utility>
#include <vector>


using namespace std;

template<typename T>
void remove(std::vector<T>& vector, unsigned int index)
{
    vector.erase(vector.begin() + index);
}


int main(){

	int H, W;

	cin >> H >> W;

	vector<vector<char> > mas = vector<vector<char> >(H, vector<char>(W));

	for(int i=0;i<H;i++){
		for(int j=0;j<W;j++){
			cin >> mas[i][j];
		}
	}


	vector<int> bad2 = vector<int>(H, 0);
	for(int i=0;i<H;i++){
		for(int j=0;j<W;j++){
			if(mas[i][j] == '#'){
				bad2[i] = 1;
			}
		}
	}

	vector<int> bad = vector<int>(W, 0);
	for(int j=0;j<W;j++){
		for(int i=0;i<mas.size();i++){
			if(mas[i][j] == '#'){
				bad[j] = 1;
			}
		}
	}

	for(int i=0;i<mas.size();i++){
		if(bad2[i] == 0 ) continue;
		for(int j=0;j<W;j++){
			if(bad[j] == 0 ) continue;
			cout << mas[i][j];
		}
		cout << endl;
	}

	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using ll =long long;
#define mod 1000000007
#define p(a,b) make_pair(a,b)

vector<pair<ll,ll>> compose(ll n)
{
	vector<pair<ll,ll>> ans;
	ll fac=2;
	int time=0;
	if (n%fac==0)
	{
		while (n%fac==0)
		{
			n/=fac;
			time++;
		}
		ans.push_back(p(fac,time));
	}
	fac++;
	while (1<n)
	{
		if (n%fac==0)
		{
			time=0;
			while (n%fac==0)
			{
				n/=fac;
				time++;
			}
			ans.push_back(p(fac,time));
			fac+=2;
		}
		else fac+=2;
	}
return ans;
}

ll power (ll a,ll r)
{
	ll m;
	if (r==1) return a;
	else
	{
		m=power(a,r/2);
		if (r%2==0) return m*m%mod;
		else return m*m%mod*a%mod;
	}
}

ll modinv(ll a)
{
	return power(a,mod-2);
}

ll cmb(ll n,ll r)
{
	ll ans=1;
	for (int i=1;i<r+1;i++) ans=ans*(n-i+1)%mod*modinv(i)%mod;
	return ans;
}

int main()
{
	ll N,M,n; cin >> N >> M;
	ll ans=1;
	vector<pair<ll,ll>> com;
	com=compose(M);
	n=com.size();
	for (int i=0;i<n;i++)
	{
		ans=(ans*cmb(N-1+com[i].second,com[i].second))%mod;
	}
	
	cout << ans << endl;
return 0;
}



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

int main(void){
  int n, m;
  cin >> n >> m;
  int cnt = 0;

  vector<int> l(m);
  vector<int> r(m);

  for(int i = 0; i < m; i++){
      cin >> l.at(i);
      cin >> r.at(i);
  }
  
  sort(l.rbegin(), l.rend());
  int maxL = l.at(0);

  sort(r.begin(), r.end());
  int minR = r.at(0);

  for(int i = 1; i <= n; i++){
      if(maxL <= i && i <= minR){
          cnt++;
      }
  }
  cout << cnt << endl;
  return 0;
}

Measured memory_bytes: 1152
#include<stdio.h>
int main(void)
{
	int n,m[10001],max,min,min2,i,j,g,gu[10001],cut,w;
	scanf("%d",&n);
	for(i=0;i<n;i++){
		scanf("%d",&m[i]);
	}
	max=-1;
	for(i=0;i<n;i++){
		if(max<m[i]){
			max=m[i];
		}
	}
	min=1000;
	for(i=0;i<n;i++){
		if(min>m[i]){
			min=m[i];
		}
	}
//	printf("%d %d\n",min,max);
	cut=0;
	for(i=min;i<=max;i++){
		g=0;
		for(j=0;j<n;j++){
			g+=(m[j]-i)*(m[j]-i);
		}
		gu[cut]=g;
		cut++;
	}
	min2=100000000;
	for(i=0;i<cut;i++){
		if(min2>gu[i]){
			min2=gu[i];
		}
	}
	printf("%d\n",min2);
}

Measured memory_bytes: 256