akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <queue>
#include <cstring>
#include <vector>
#include <map>
#include <algorithm>
#include <cctype>
#include <cmath>
#include <bitset>
#include <set>

using namespace std;

#define REP(i,n) for(int i=0;i<(int)(n);i++)
#define RREP(i,n) for(int i=n-1;i>=0;i--)
#define FOR(i,k,n) for(int i=(k);i<(int)(n);i++)
#define all(i,n) (i),(i+n)

int dx4[4]={1,0,-1,0};
int dy4[4]={0,-1,0,1};
int dx8[8]={1,0,-1,1,-1,1,0,-1};
int dy8[8]={1,1,1,0,0,-1,-1,-1};

typedef pair<int, int> P;
typedef pair<string, int> SP;
typedef long long ll;

const int INF = 1e9;
const ll LLINF = 1e18;
const int MAX_V = 1e6+1;
const ll mod = 1000000007;

// --------------------------------------
int n, k;
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);

  cin >> n >> k;

  ll ans = 0;
  FOR(i, k + 1, n + 1) {
    ans += (n / i) * (i - k);
    if (n % i >= k) ans += k == 0 ? n % i - k : n % i - k + 1;
  }

  cout << ans << endl;
}


Measured memory_bytes: 256
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vin=vector<int>;
using vll=vector<long long>;
using vvin=vector<vector<int>>;
using vvll=vector<vector<long long>>;
using vstr=vector<string>;
using vvstr=vector<vector<string>>;
using vch=vector<char>;
using vvch=vector<vector<char>>;
using vbo=vector<bool>;
using vvbo=vector<vector<bool>>;
using vpii=vector<pair<int,int>>;
using pqsin=priority_queue<int,vector<int>,greater<int>>;
#define mp make_pair
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep2(i,s,n) for(int i=(s);i<(int)(n);i++)
#define all(v) v.begin(),v.end()
#define decp(n) cout<<fixed<<setprecision((int)n)
const int inf=1e9+7;
const ll INF=1e18;

int main(){
    int n;cin>>n;
    vin c(n-1),s(n-1),f(n-1);
    rep(i,n-1)cin>>c[i]>>s[i]>>f[i];
    vin ans(n);
    ans[n-1]=0;
    rep(i,n-1){
        ans[i]=s[i]+c[i];
        rep2(j,i+1,n-1){
            if(ans[i]<=s[j])ans[i]=s[j]+c[j];
            else ans[i]=((ans[i]+f[j]-1)/f[j])*f[j]+c[j];
        }
    }
    rep(i,n)cout<<ans[i]<<endl;
}

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

int main(){
  int A,B,X;
  cin >>A>>B>>X;
  
  string ans;
  if(X>A+B) ans="NO";
  else if(X<A) ans="NO";
  else ans="YES";
  
  cout <<ans<< endl;
}


Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cmath>

using namespace std;

int main() {
    double a, b, c, d, x, y, ans;
    cin >> a >> b >> c >> d;
    x = a - c;
    y = b - d;
    ans = sqrt(x*x + y*y);
    printf("%f", ans);
    return 0;
}

Measured memory_bytes: 1228
import os
import sys
from collections import defaultdict, Counter
from itertools import product, permutations,combinations, accumulate
from operator import itemgetter
from bisect import bisect_left,bisect
from heapq import heappop,heappush
from fractions import gcd
from math import ceil, floor, sqrt
from copy import deepcopy

def main():
    
    n,d = map(int, input().split())
    ans = n / (d*2 + 1)

    if ans.is_integer():
        print(int(ans))
    else:
        print(int(ans) + 1)


if __name__ == "__main__":
    main()

Measured memory_bytes: 5068
#include <iostream>
#define rep(i, n) for(int i = 0; i < n; ++i)
using namespace std;

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

  int n, m; cin >> n >> m;
  int can[100010] = {};

  rep(i, m) {
      int l, r; cin >> l >> r;
      ++can[l];
      --can[r+1];
  }

  int ans = 0;
  for(int i = 1; i <= n; ++i) {
      can[i] += can[i-1];
      if(can[i]==m) ++ans;
  }

  cout << ans << '\n';
  return 0;
}


Measured memory_bytes: 640
import Control.Arrow
import Data.List
import qualified Data.ByteString.Char8 as B
import Data.Ord

main :: IO ()
main = breads >>= main'
    where
        main' [_, k] = breads >>= print . solve k 

-- |
-- >>> solve 3 [-30, -10, 10, 20, 50]
-- 40
-- >>> solve 2 [10, 20, 30]
-- 20
-- >>> solve 1 [0]
-- 0
-- >>> solve 5 [-9, -7, -4, -3, 1, 2, 3, 4]
-- 10
solve :: Int -> [Int] -> Int
solve 1 xs = head $ sortBy (comparing abs) xs
solve k xs = search len (tail xs) bs
    where
        (b : bs) = drop (k - 1) xs
        len = calc (head xs) b

        search res (y : ys) (z : zs) = search (min res $ calc y z) ys zs
        search res _ _ = res

        calc minv maxv
            | minv >= 0 = maxv 
            | maxv <= 0 = abs minv
            | otherwise = abs minv + maxv + min (abs minv) maxv


breads :: IO [Int]
breads = unfoldr (\s -> second (maybe B.empty snd . B.uncons) <$> B.readInt s) <$> B.getLine

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

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

//container util
#define all(x) (x).begin(),(x).end()

//typedef
typedef long long ll;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<ll> VLL;
typedef vector<VLL> VVLL;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef pair<ll, ll> PLL;

//const value
//const ll MOD = 1e9 + 7;
//const int dx[] = {0,1,0,-1};//{0,0,1,1,1,-1,-1,-1};
//const int dy[] = {1,0,-1,0};//{1,-1,0,1,-1,0,1,-1};

//conversion
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
inline ll toLL(string s) {ll v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  ll n;
  cin >> n;
  VI a(n);
  rep(i,n) cin >> a[i];

  ll lmin = 2,rmax = 2; 
  reverse(all(a));
  rep(i,n){
    lmin = (lmin+a[i]-1)/a[i] * a[i];
    rmax = rmax / a[i] * a[i];
    
    if(lmin > rmax){
      cout << -1 << endl;
      return 0;
    }
    rmax = rmax + a[i] -1;
  }
  
  cout << lmin << " " << rmax << endl;
  return 0;
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
#define rep(i,m,n) for(int i=m;i<n;i++)
ll mod=1e9+7;
double pi=3.1415926535;

int main(){
  int a,b,h,m;
  cin>>a>>b>>h>>m;
  double d=m*6;
  double e=30*h+0.5*m;
  double c=abs(d-e);
  if(c>180) c=360-c;
  cout<<fixed<<setprecision(10);
  cout<<sqrt(a*a+b*b-2*a*b*cos(c/180*pi))<<endl;
}


Measured memory_bytes: 4228
#include <bits/stdc++.h>
using namespace std;
 
int main() {
   int X, Y;
   cin >> X >> Y;
   
   for(int i=0; i<=X; i++) {
      int j= X-i;
      if(2 * i + 4 * j == Y) {
         cout << "Yes" << endl;
         return 0;
      }
   }
   cout << "No" << endl;
}

Measured memory_bytes: 3656
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int n, s1, s2, s3, s4;
  cin >> n;
  s1 = n/1000;
  s2 = n%1000/100;
  s3 = n%100/10;
  s4 = n%10;
  

//  cout << "s1=" << s1 << ", s2=" << s2 << ", s3=" << s3 << ", s4=" << s4 << endl;
  
  if(s2==s3 && (s1==s2 || s3==s4)){
    cout << "Yes" << endl;
  }
  else {
  cout << "No" << endl;
  }
}

Measured memory_bytes: 256
import math
from collections import defaultdict
N = int(input())
A = sorted(int(i) for i in input().split())

d = defaultdict(lambda: 0)
for i in A:
    d[i] += 1

c = 0
for k in sorted(d.keys(), reverse=True):
    l = 2**int(math.log(k, 2) + 1) - k
    v = d[k]
    if k == l:
        c += v // 2
    elif l in d:
        w = d[l]
        if v > w:
            c += w
            d[l] = 0
        else:
            c += v
            d[l] = w-v
print(c)


Measured memory_bytes: 33296
#include <bits/stdc++.h>
//----***やべーやつら***----
using namespace std;
#define int long long

//----***型定義***----
using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using pdd = pair<double, double>;
typedef long double lb;
typedef vector<int,vector<int>> vec;
typedef long double ld;

//----***Like a Pythonista***----
#define REP(i,j,n) for (ll i=j;i<(n);i++)
#define RREP(i,n,j) for (ll i = n; j<i;i--)
#define each(i,...) for(auto&& i:__VA_ARGS__)
#define ALL(vec) (vec).begin(),(vec).end()
#define sum(...) accumulate(all(__VA_ARGS__),0LL)
#define dsum(...) accumulate(all(__VA_ARGS__),0.0L)
#define vec(type,name,...) vector<type> name(__VA_ARGS__)
template<class T> inline auto max(const T& a){ return *max_element(all(a)); }
template<class T> inline auto min(const T& a){ return *min_element(all(a)); }
inline ll gcd(ll a, ll b){ while(b){ ll c = b; b = a % b; a = c; } return a; }
inline ll lcm(ll a, ll b){ if(!a || !b) return 0; return a * b / gcd(a, b); }


//----***定数***----
#define MOD 1000000007;
#define INF 1e9;
#define EPS 1e-9;

//----***入出力***----
#define print(out) cout<< out  << "\n";
#define debug(var)  do{std::cerr << #var << " ↓ "<<"\n";view(var);}while(0)
template<typename T> void view(T e){std::cout << e << std::endl;}
template<typename T> void view(const std::vector<T>& v){for(const auto& e : v){ std::cout << e << " "; } std::cout << std::endl;}
template<typename T> void view(const std::vector<std::vector<T> >& vv){ for(const auto& v : vv){ view(v); } }

//----***初期時読み込み***----
struct initial{initial(){cin.tie(0); ios::sync_with_stdio(0); cout<<fixed<<setprecision(20);};}initial_;

signed main(){
  int N,K;cin>>N>>K;
  double a;
  vector<double> v(N);
  REP(i,0,N){
    cin>>a;
    v[i]=(1+a)/2;
  }
  vector<double> sum_v(N);
  sum_v[0]=v[0];
  REP(i,1,N){
    sum_v[i]=v[i]+sum_v[i-1];
  }
  double ans=sum_v[K-1];
  REP(i,1,N-K){
    ans=max(ans,sum_v[i+K]-sum_v[i]);
    //debug(ans);
  }
  print(ans)
  //debug(ans);

  return 0;
}


Measured memory_bytes: 3328
from operator import add


def read():
    N = int(input().strip())  # N <= 100,000
    A = []
    B = []
    for i in range(N):
        a, b = input().strip().split()
        A.append(int(a))
        B.append(int(b))
    return N, A, B


def solve(N, A, B):
    f = map(add, A, B)
    food = reversed(sorted(f))
    score = 0
    for i, f in enumerate(food):
        if i % 2 == 0:
            score += f
    return score - sum(B)


if __name__ == '__main__':
    inputs = read()
    print("%d" % solve(*inputs))


Measured memory_bytes: 15448
#define  _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <algorithm>
#include <utility>
#include <functional>
#include <cstring>
#include <queue>
#include <stack>
#include <math.h>
#include <iterator>
#include <vector>
#include <string>
#include <set>
#include <math.h>
#include <iostream>
#include <random>
#include<map>
#include <iomanip>
#include <time.h>
#include <stdlib.h>
#include <list>
#include <typeinfo>
#include <list>
#include <set>
#include <cassert>
#include<fstream>
#include <unordered_map>
#include <cstdlib>
#include <complex>
#include <cctype>
#include <bitset>
using namespace std;
typedef string::const_iterator State;
#define Ma_PI 3.141592653589793
#define eps 1e-5
#define LONG_INF 2000000000000000000LL
#define GOLD 1.61803398874989484820458
#define MAX_MOD 1000000007LL
#define GYAKU 500000004LL
#define MOD 998244353LL
#define seg_size 262144
#define REP(a,b) for(long long a = 0;a < b;++a)
int main() {
	int a = 0;
	REP(i, 3) {
		int b;
		cin >> b;
		a += b;
	}
	if (a <= 21) {
		cout << "win" << endl;
	}
	else {
		cout << "bust" << endl;
	}
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef pair<int,int> p;

int main(void){
  int n,T;
  cin >> n >> T;
  int long long cnt=0;
  vector<int> t(n,0);
  for(int i=0;i<n;i++){
    cin >> t[i];
    cnt+=T;
    //cout << cnt << endl;
  }
  for(int i=0;i<n-1;i++){
    if(T-(t[i+1]-t[i])>=0)cnt-=T-(t[i+1]-t[i]);
    //cout << cnt << endl;
  }
  cout << cnt << endl;
  return 0;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define rep(i, n) for (int i=0; i<(int)(n); i++)
#define all(v) v.begin(), v.end()
#define allR(v) v.rbegin(), v.rend()
#define PRINT(v) for (auto x : (v)) cout <<x <<" " ; cout <<endl;
using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
typedef pair<int,int> Pi;
const ll MOD = 1000000007;
const ll INF = 10000000000000000;
const int inf = 1001001001;
vector<int> x4 = {0, 1, 0, -1}, x8 = {0, 1, 1, 1, 0, -1, -1, -1};
vector<int> y4 = {1, 0, -1, 0}, y8 = {1, 1, 0, -1, -1, -1, 0, 1};
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;}
template<class T> inline T powerM(T a,T b){if (b==0) return 1;
T tmp = powerM(a,b/2); if (b%2==0) return tmp*tmp%MOD; else return tmp*tmp%MOD*a%MOD; }
template<class T> inline T power(T a,T b,T m){ if (b==0) return 1;
  T tmp = power(a,b/2,m); if (b%2==0) return tmp*tmp%m; else return tmp*tmp%m*a%m; }
template<class T> inline T gcd(T a, T b){if (b==0) return a; return gcd(b, a%b);}
template<class T> inline T lcm(T a, T b){return a / gcd(a,b) * b;}
// ax+by=gcd(a,b)を解く
template<class T> inline T extgcd(T a,T b,T &x,T &y){if (b==0){x=1; y=0; return a;} T d=extgcd(b,a%b,y,x); y -= a/b*x; return d;}
void hey(){ cout <<"hey" <<endl; }

template<class T> struct edge { int to; T cost;};


typedef pair<double,double> Pd;

vector<pair<string,int>> b;

int partition(vector<pair<string,int>> &a, int p, int r){
  int x = a[r].second;
  int i = p-1;
  for (int j=p; j<r; j++){
    if (a[j].second <= x){
      i++;
      swap(a[i], a[j]);
    }
  }
  swap(a[i+1], a[r]);
  return i+1;
}

void quicksort(vector<pair<string,int>> &a, int p, int r){
  if (p < r){
    int q = partition(a, p, r);
    quicksort(a, p, q-1);
    quicksort(a, q+1, r);
  }
}

void mergesort(vector<pair<string,int>> &a){
  int n = a.size();
  if (n <= 1) return;
  int n2 = n/2;
  vector<pair<string,int>> b(n2); rep(i, n2) b[i] = a[i];
  vector<pair<string,int>> c(n-n2); rep(i, n-n2) c[i] = a[i+n2];
  mergesort(b);
  mergesort(c);
  // bとcはソートされている
  int bi = 0, ci = 0;
  for (int i=0; i<n; i++){
    if (bi == n2) a[i] = c[ci++];
    else if (ci == n-n2) a[i] = b[bi++];
    else if (b[bi].second <= c[ci].second) a[i] = b[bi++];
    else a[i] = c[ci++];
  }
}

int main() {
  int n; cin >>n;
  vector<pair<string,int>> a(n); rep(i, n) cin >>a[i].first >>a[i].second;
  b.assign(n, {"a", 0}); rep(i, n) b[i] = a[i];
  quicksort(a, 0, n-1);
  mergesort(b);
  bool ok = true;
  rep(i, n) if (a[i].first != b[i].first) ok = false;
  cout <<(ok ? "Stable" : "Not stable") <<endl;
  rep(i, n){
    cout <<a[i].first <<" " <<a[i].second <<endl;
  }
}


Measured memory_bytes: 13780
#include <algorithm>
#include <climits>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <vector>

#define int long long int
constexpr int INF = std::numeric_limits<int>::max();
constexpr int NINF = std::numeric_limits<int>::min();
using namespace std;

void solve() {
  int N, M, X;
  cin >> N >> M >> X;

  int l = 0;
  int r = 0;
  while (M--) {
    int a; cin >> a;
    if (a > X) {
      l++;
    } else {
      r++;
    }
  }
  cout << min(l, r) << endl;
}

signed main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  solve();
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;;
#define ll long long
#define rep(i, n) for(int i = 0;i < n;i++)
#define repr(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define INF 1<<30
#define LINF 1LL<<62
#define all(x) (x).begin(), (x).end()
#define mp make_pair
#define pb push_back
const int MOD = 1000000007;
 
typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef pair<int, P> PP;
typedef pair<ll, LP> LPP;

int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  ll n;cin >> n;
  ll ans = 0;
  if(n==1){
      cout << 0 << endl;
      return 0;
  } 
  for(ll i = 1; i * i <=n ; i++){
      ll tmp = n / i - 1;
      if(n%i == 0 && (i == n/tmp)) ans+= tmp;
  }
  cout << ans << endl;

}

Measured memory_bytes: 256
import java.util.Scanner;

class Main {
    public static void main(String args[]) {
        Scanner sc = new Scanner(System.in);
        String a = sc.next();
        String b = sc.next();
        String c = sc.next();
        System.out.println((a.charAt(a.length()-1)==b.charAt(0)&&b.charAt(b.length()-1)==c.charAt(0)? "YES":"NO"));
    }
}

Measured memory_bytes: 23892
#include<cstdio>
#include<cstring>
#include<algorithm>
#define MN 2005
using namespace std;
typedef long long ll;
ll ans=1e18,f[MN][MN],a[MN];
int n,x;
int main(){
	scanf("%d%d",&n,&x);
	for(int i=1;i<=n;i++)scanf("%lld",&a[i]);
	for(int i=1;i<=n;i++){
		f[i][0]=a[i];
		for(int j=1;j<n;j++)f[i][j]=min(f[i][j-1],a[(i-j)<=0?n+i-j:i-j]);
	}
	for(int i=0;i<n;i++){
		ll tmp=0;
		for(int j=1;j<=n;j++)tmp+=f[j][i];
		ans=min(ans,tmp+1ll*i*x);
	}printf("%lld\n",ans);
}


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

#define rep(i,n) for (int i = 0; i<(n); i++)
#define in(n) cin >> (n)
#define out(ans) cout << (ans) << endl;
#define keta(n) cout << fixed << setprecision((n));
using ll = int64_t;
using v = vector<int>;


int main() {
  ll N, K;
  cin >> N >> K;
  vector<ll> tolist(N);
  for (ll i = 0; i<N; i++) {
    ll A;
    cin >> A;
    A--;
    tolist.at(i) = A;
  }
  
  bool roopjud = false;
  vector<bool> judlist(N, false);
  judlist.at(0) = true;

  ll gpoint=0, npoint, rs=-1, mcount=0, rcount=0, ans;
  while(rs == -1 && mcount<=N) {
    npoint = tolist.at(gpoint);
    if (judlist.at(npoint)) {
      rs = gpoint;
      roopjud = true;
    }
    else {
      judlist.at(gpoint) = true;
      gpoint = npoint;
      mcount++;
    }
  }
  

  if (roopjud) {
    gpoint = rs;
    npoint = -1;
    while(npoint!=rs) {
      npoint = tolist.at(gpoint);
      rcount++;
      gpoint = npoint;
    }
  

    if (K-mcount>=0) {
      gpoint = rs;
      if ((K-mcount)%rcount==0) {
        ans == rs;
      }
      else {
        for (ll i = 0; i<(K-mcount)%rcount; i++) {
          ans = tolist.at(gpoint);
          gpoint = ans;
        }
      }
    }
  
    else {
      gpoint = 0;
      for (ll i = 0; i<K; i++) {
        ans = tolist.at(gpoint);
        gpoint = ans;
      }
    }
  }
  
  else {
    gpoint = 0;
    for (ll i = 0; i<K; i++) {
      ans = tolist.at(gpoint);
      gpoint = ans;
    }
  }
    

  ans++;

  cout << ans << endl;


}


Measured memory_bytes: 4792
#include <iostream>
#include <cstring>
#include <vector>
#include <set>
#include <map>
#include <sstream>
#include <cstdio>
#include <algorithm>
#include <stack>
#include <queue>
#include <cmath>
#include <iomanip>
#include <fstream>
//#include <bits/stdc++.h>
using namespace std;
typedef unsigned long long ll;
const ll INF = (1 << 30);
const ll inf = (1LL << 50LL);
const int  maxn = 1e6 + 5;
int n;
int arr[maxn];
int dp[maxn];
int rek(int at){
    if(at == n - 1){
        return 0;
    }
    if(dp[at] != -1){
        return dp[at];
    }
    int ret = INF;
    if(at + 1 < n){
        ret = min(ret, rek(at + 1) + abs(arr[at] - arr[at + 1]));
    }
    if(at + 2 < n){
        ret = min(ret, rek(at + 2) + abs(arr[at] - arr[at + 2]));
    }
    return dp[at] = ret;
}
int main(int argc, const char * argv[]) {
    ios_base::sync_with_stdio(false);
//    ifstream cin("in.txt");
    cin >> n;
    for(int i = 0; i  <n; i ++){
        cin >> arr[i];
        dp[i] = -1;
    }
    
    cout << rek(0) << endl;
    return 0;
}


Measured memory_bytes: 9472
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i<(n); i++)
#define reps(i,s,n) for(int i=(s); i<(n); i++)
#define all(v) v.begin(),v.end()
#define res(n) resize(n)
#define rev(v) reverse(v.begin(),v.end())
#define so(v) sort(v.begin(),v.end())
#define outve(v) for(auto i : v) cout << i << " ";cout << endl
#define in(n,v) for(int i=0; i<(n); i++){cin >> v[i];}
#define out(n) cout << (n) << endl
#define fi first
#define se second
#define ve vector
#define pa pair
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef vector<string> vs;
typedef vector<vector<int>> vvi;
typedef vector<pair<int,int>> vpi;
typedef vector<pair<ll,ll>> vpl;
typedef vector<vector<pair<int,int>>> vvp;




int main()
{
    int N;
    cin >> N;
    reps(i,1,50000){
        int a = i;
        a = double(a);
        if(N == int(a*1.08)){
            out(a);
            return 0;
        }
    }
    out(":(");
    
    return 0;
}



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

using namespace std;

using ll = long long;

const ll INF = 1e18L + 5;

int main() {
	int n, W;
	scanf("%d %d", &n, &W);
	vector<int> weights(n);
	vector<int> values(n);
	for (int k = 0; k < n; k++) {
		scanf("%d%d", &weights[k], &values[k]);
	}
	ll sum_values = 0;
	for (auto it = begin(values); it != end(values); it++) {
		sum_values += *it;
	}
	vector<ll> dp(sum_values + 1, INF);
	dp[0] = 0;
	for (int k = 0; k < n; k++) {
		for (int x = sum_values - values[k]; x >= 0; x--) {
			dp[x + values[k]] = min(dp[x + values[k]], dp[x] + weights[k]);
		}
	}
	ll res = 0;
	for (ll i = 0; i <= sum_values; i++) {
		if (dp[i] <= W)
			res = max(res, i);
	}
	printf("%lld\n", res);
}


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

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

    vector<int> a(n);
    vector<int> b(n);

    for (int i = 0; i < n; i++) {
        cin >> a[i] >> b[i];
    }
    sort(a.begin(), a.end(), greater<int>());
    sort(b.begin(), b.end(), greater<int>());

    int t = 0;
    for (const int bb : b) {
        if (bb >= a[0]) {
            h -= bb;
            t++;
            if (h <= 0) {
                cout << t << endl;
                return 0;
            }
        }
    }

    t += (h + a[0] - 1) / a[0];

    cout << t << endl;

}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (n); i++)
using namespace std;
 
int n;
void dfs(string s, char mx){
	if(s.size() == n){
      cout << s << endl;
      return;
    }
  	
  	for(char c = 'a'; c <= mx + 1; c++){
      	string t = s;
      	t += c;
      	dfs(t, max(mx, c));
    }
}
 
int main(){
  	cin >> n;
  
  	dfs("", 'a' - 1);
  
  	return 0;
}

Measured memory_bytes: 1536
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <functional>
#include <vector>
#define nmax_def 110000
using namespace std;
typedef long long ll;

int main() {
	int i, j;
	int Amin = pow(10, 9);
	int ans = 0;
	int N, L;
	int Atmp;
	cin >> N >> L;
	for (i = 1; i <= N; i++)
	{
		Atmp= L + i - 1;
		ans += Atmp;
		if (abs(Amin) > abs(Atmp))
		{
			Amin = Atmp;
		}
	}
	ans -= Amin;
	cout << ans << endl;
	return 0;
}

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

#define CHOOSE(a) CHOOSE2 a
#define CHOOSE2(a0, a1, a2, a3, a4, x, ...) x
#define dump_1(x1) cerr << #x1 << ": " << x1 << endl
#define dump_2(x1, x2) \
  cerr << #x1 << ": " << x1 << ", " #x2 << ": " << x2 << endl
#define dump_3(x1, x2, x3)                                                \
  cerr << #x1 << ": " << x1 << ", " #x2 << ": " << x2 << ", " #x3 << ": " \
       << x3 << endl
#define dump_4(x1, x2, x3, x4)                                            \
  cerr << #x1 << ": " << x1 << ", " #x2 << ": " << x2 << ", " #x3 << ": " \
       << x3 << ", " #x4 << ": " << x4 << endl
#define dump_5(x1, x2, x3, x4, x5)                                        \
  cerr << #x1 << ": " << x1 << ", " #x2 << ": " << x2 << ", " #x3 << ": " \
       << x3 << ", " #x4 << ": " << x4 << ", " #x5 << ": " << x5 << endl
#define dump(...) \
  CHOOSE((__VA_ARGS__, dump_5, dump_4, dump_3, dump_2, dump_1, ~))(__VA_ARGS__)
#define check(s) cerr << s << endl

#define rep(i, n) for (int i = 0; i < n; i++)
#define repr(i, n) for (int i = n; i >= 0; i--)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define all(x) (x).begin(), (x).end()
#define sz(x) ((int)(x).size())
#define unique(v) v.erase(unique(v.begin(), v.end()), v.end());
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)

using namespace std;

using ll = long long;

const long long MOD = 1000000007;

vector<int> dx = {0, 1, 0, -1};
vector<int> dy = {1, 0, -1, 0};

const ll LINF = 2e18;
const int INF = 1e9;

void disp(ll N, ll K, vector<vector<ll>> dp) {
  rep(i, N + 1) {
    rep(j, K + 1) { cerr << dp.at(i).at(j) << " "; }
    cerr << endl;
  }
  cerr << endl;
}

void solve(ll N, ll K, std::vector<ll> a) {
  vector<vector<ll>> dp(N + 1, vector<ll>(K + 1, 0));
  dp.at(0).at(0) = 1;
  vector<ll> acc(K + 2, 0);

  rep(i, N) {
    acc.at(0) = 0;
    rep(k, K + 1) acc.at(k + 1) = (acc.at(k) + dp.at(i).at(k)) % MOD;
    rep(j, K + 1) {
      dp.at(i + 1).at(j) =
          (acc.at(j + 1) - acc.at(max(0LL, j - a.at(i))) + MOD) % MOD;
    }
  }

  cout << dp.at(N).at(K) << endl;
}

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(15);
  ll N;
  scanf("%lld", &N);
  ll K;
  scanf("%lld", &K);
  std::vector<ll> a(N);
  for (int i = 0; i < N; i++) {
    scanf("%lld", &a[i]);
  }
  solve(N, K, std::move(a));
  return 0;
}


Measured memory_bytes: 83200
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
int main(){
   long long n,ans=1;
  string s;
  cin>>n>>s;
  vector<int> co(3,0);
  rep(i,n){
    if(s.at(i)=='R')co[0]++;
    if(s.at(i)=='G')co[1]++;
    if(s.at(i)=='B')co[2]++;
  }
  rep(i,3)ans *=(co.at(i));
  rep(i,n)rep(j,i){
    int k=2*i-j;
    if(k<n){
      if(s.at(i)==s.at(j))continue;
      if(s.at(i)==s.at(k))continue;
      if(s.at(k)==s.at(j))continue;
      ans--;
    }
  }
  cout<<ans<<endl;
}



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

int main() {
	int	n;
	cin >> n;
	bitset<64>	bs;
	vector<bitset<64>>	bsm(n);
	rep(i, n)
	{
		int	x;
		cin >> x;
		rep(j, x)
		{
			int	y;
			cin >> y;
			bsm.at(i).set(y);
		}
	}
	cin >> n;
	rep(i, n)
	{
		int	a, b;
		cin >> a >> b;
		if (a == 0) // test
			cout << bs.test(b) << endl;
		else if (a == 1) // set
			bs |= bsm.at(b);
		else if (a == 2) // clear
			bs &= ~bsm.at(b);
		else if (a == 3) // flip
			bs ^= bsm.at(b);
		else if (a == 4) // all
			cout << (bsm.at(b) == (bs & bsm.at(b))) << endl;
		else if (a == 5) // any
			cout << (bs & bsm.at(b)).any() << endl;
		else if (a == 6) // none
			cout << (bs & bsm.at(b)).none() << endl;
		else if (a == 7)// count
			cout << (bs & bsm.at(b)).count() << endl;
		else // val
			cout << (bs & bsm.at(b)).to_ullong() << endl;
	}
}



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

#define INF INT_MAX

using namespace std;

int main(void){
	int h,w;
	cin >> h >> w;
	vector< vector<char> > img(h+2, vector<char>(w+2, '#') );
	for(int j = 0;j < h;j++){
		for(int i = 0;i < w;i++){
			char temp;
			cin >> temp;
			img[j+1][i+1] = temp;
		}
	}
	for(int j = 0;j < h+2;j++){
		for(int i = 0;i < w+2;i++){
			cout << img[j][i];
		}
		cout << endl;
	}
}

Measured memory_bytes: 256
// cities to vapori-
// corner cases // int vs ll // cin vs scanf // clear structures // statement // doublesz
#include <bits/stdc++.h>
#define pb push_back
#define fst first
#define snd second
#define sz(x) int(x.size())
#define fill(x,v) memset(x,v,sizeof(x))
#define REP(i,a,b) for(int i = int(a); i < int(b); ++i)
#define trace(x) cout << #x << " = " << x << endl
#define fastio ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
using namespace std;
typedef long long ll;
typedef pair<int,int> ii;

int main(){

	fastio;
	int n;
	cin >> n;
	vector<int> w(n);
	REP(i,0,n) cin >> w[i];

	int ans = INT_MAX;
	int l = 0, r = 0;
	REP(i,0,n) r += w[i];

	for(int i = 0; i+1 < n; ++i){
		r -= w[i];
		l += w[i];
		ans = min(ans,abs(l-r));
	}
	cout << ans << endl;


	return 0;
}


Measured memory_bytes: 3648
w = list(str(input()))

x = list()
num = list()
y = 0
for a in w:
    judge = 0
    i = 0
    while i<y:
        if a == x[i]:
            num[i] += 1
            judge = 1
            break
        i += 1
    if judge == 0:
        x.append(a)
        y += 1
        num.append(1)

i = 0
ans = "Yes"
while i<y:
    if (num[i] %2)!= 0:
        ans = "No"
    i+=1

print(ans)


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

int main()
{
    int k;
    vector<int> a(5);
    rep (i, 5)
        cin >> a[i];
    cin >> k;

    bool ok = true;
    rep (i, 5)
        for (int j = i + 1; j < 5; j++)
            if (abs(a[i] - a[j]) > k)
                ok = false;

    if (ok)
        cout << "Yay!" << endl;
    else
        cout << ":(" << endl;
    return 0;
}

Measured memory_bytes: 256
/*
  #問題：
  


  #分析：
  #オブジェクト：
  
  #条件：
  

  #要求：
  

  #解法：
  
*/

#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <fstream>
#include <sstream>
#include <set>
#include <map>
#include <vector>
#include <list>
#include <algorithm>
#include <cstring>
#include <cmath>
#include <string>
#include <queue>
#include <stack>
#include <numeric>
#include <bitset>     //UWAGA - w czasie kompilacji musi byc znany rozmiar wektora - nie mozna go zmienic
#include <cassert>
#include <iomanip>        //do setprecision
#include <ctime>
#include <complex>
#include <initializer_list>
#define FOR(i,b,e) for(int i=(b);i<(e);++i)
#define FORQ(i,b,e) for(int i=(b);i<=(e);++i)
#define FORD(i,b,e) for(int i=(b)-1;i>=(e);--i)
#define REP(x, n) for(int x = 0; x < (n); ++x)

#define ST first
#define ND second
#define PB push_back
#define MP make_pair
#define LL long long
#define uLL unsigned LL
#define LD long double

const double pi = 3.141592653589793238462643383279502884197169399375105820974944592307816406286208998628034825342;
const int mod=1000000007;


const unsigned int BIT_FLAG_0 = (1<<0);
const unsigned int BIT_FLAG_1 = (1<<1);
const unsigned int BIT_FLAG_2 = (1<<2);
const unsigned int BIT_FLAG_3 = (1<<3);
const unsigned int BIT_FLAG_4 = (1<<4);
const unsigned int BIT_FLAG_5 = (1<<5);
const unsigned int BIT_FLAG_6 = (1<<6);
const unsigned int BIT_FLAG_7 = (1<<7);


#include <boost/multiprecision/cpp_dec_float.hpp>
#include <boost/multiprecision/cpp_int.hpp>
using namespace std;
namespace mp = boost::multiprecision;

using Bint = mp::cpp_int;



int main(void){
  int a; cin>>a;
  int b; cin>>b;
  if (b%a==0) {
    cout << a+b << endl;
  }else{
    cout << b-a << endl;
  }
  return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define IOS ios_base::sync_with_stdio(0); cin.tie(); cout.tie();
#define ff first
#define ss second
#define pb push_back
#define debug(val) cerr << "The value of " << #val << " is = " << val << '\n';
typedef long long ll;
typedef unsigned long long ull;
const ll mod = 1e9 + 7;
const ll inf = 922337203685477;
const ll mininf = -922337203685477;
const ll nax = 1e5 + 5;
ll n, sums=0, q;
unordered_map<ll, ll>frek;

int main(){
	IOS
	cin >> n;
	for(int i=0;i<n;i++){
		ll a;
		cin >> a;
		frek[a]++;
		sums+=a;
	}
	cin >> q;
	while(q--){
		ll b, c;
		cin >> b >> c;
		ll dif=c-b;
		sums+=frek[b]*dif;
		frek[c]+=frek[b];
		frek[b]=0;
		cout << sums << '\n';
	}
}


Measured memory_bytes: 7140
#include <iostream>
#include <vector>
#include <algorithm>
#include <string.h>
#include <iomanip>
#include <math.h>
#include <string>
#include <queue>
#include <map>
#include <set>
#include <functional>

using namespace std;

typedef long long int ll;
typedef std::pair<int, int> pii;
typedef std::pair<ll, int> pli;
typedef std::pair<ll, ll> pll;

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

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

int main()
{
	int A[3], K;
	cin >> A[0] >> A[1] >> A[2] >> K;
	sort(A, A + 3);
	cout << A[0] + A[1] + A[2] * pow(2, K) << endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int N;
int X;
int L[100];
int main() {
    cin >> N >> X;
    for (int i=0; i<N; ++i) cin >> L[i];
    int count=1;
    int L_all=0;

    for (int j=0; j<N; ++j){
        L_all+=L[j];
        if (L_all>X) break;
        count+=1;

    }
    cout << count << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
using namespace std;
int main(){
    int n;
    string S;
    int count[26];
    int ans[26];
    for(int i=0;i<26;i++) ans[i] = 50;
    cin >> n;
    for(int i=0;i<n;i++){
        cin >> S;
        for(int j=0;j<26;j++) count[j] = 0;
        for(int j=0;j<S.length();j++){
            count[(int)S[j] - 97]++;
        }
        for(int j=0;j<26;j++){
            if(count[j] < ans[j]) ans[j] = count[j];
        }
    }
    for(int i=0;i<26;i++){
        for(int j=0;j<ans[i];j++) cout << (char)(97+i);
    }
    cout << endl;
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define rep(i, n) for (ll i = 0; i < n; i++)
#define FOR(i, a, b) for (ll i = a; i < b; i++)
#define len(v) ll(v.size())
#define fi first
#define se second

template <class T>
void cout_vec(const vector<T> &vec){
  for(auto itr:vec) cout<<itr<<' ';
  cout<<endl;
}

typedef pair<ll,ll> P;
const ll mod=1e9+7;
const ll inf=1e15;

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  int h,w;
  cin>>h>>w;
  ll ans=inf;
  FOR(i,1,h){
    ll x=h-i;
    ll sum1=i*w;
    ll sum2=x*(w/2);
    ll sum3=x*(w-w/2);
    ll cnt1=min({sum1,sum2,sum3});
    ll cnt2=max({sum1,sum2,sum3});
    ans=min(ans,cnt2-cnt1);
  }
  FOR(i,1,h){
    ll x=h-i;
    ll sum1=i*w;
    ll sum2=x/2*(w);
    ll sum3=(x-x/2)*(w);
    ll cnt1=min({sum1,sum2,sum3});
    ll cnt2=max({sum1,sum2,sum3});
    ans=min(ans,cnt2-cnt1);
  }
  swap(h,w);
  FOR(i,1,h){
    ll x=h-i;
    ll sum1=i*w;
    ll sum2=x*(w/2);
    ll sum3=x*(w-w/2);
    ll cnt1=min({sum1,sum2,sum3});
    ll cnt2=max({sum1,sum2,sum3});
    ans=min(ans,cnt2-cnt1);
  }
  FOR(i,1,h){
    ll x=h-i;
    ll sum1=i*w;
    ll sum2=x/2*(w);
    ll sum3=(x-x/2)*(w);
    ll cnt1=min({sum1,sum2,sum3});
    ll cnt2=max({sum1,sum2,sum3});
    ans=min(ans,cnt2-cnt1);
  }
  cout<<ans<<endl;
}

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

int main() {
  int N;
  cin >> N;
  vector<pair<ll, ll>>a(N);
  for (int i = 0; i < N; i++) {
    int x, y;
    cin >> x >> y;
    a[i] = make_pair(y, x);
  }
  sort(a.begin(), a.end());
  int sum = 0;
  bool ans = true;
  for (int i = 0; i < N; i++) {
    sum += a[i].second;
    if (sum > a[i].first) {
      ans = false;
      break;
    }
  }
  if (ans) cout << "Yes" << endl;
  else cout << "No" << endl;
}

Measured memory_bytes: 3328
#include<cstdio>
#include<algorithm>
#include<functional>
#include<cstring>
#include<iostream>
#include<cmath>
#include<queue>
#include<cctype>
#include<string>
#define rep(i,a,b) for(i=a;i<=b;i++)
using namespace std;
int dp[2001][2001][2];
int main(void)
{
	int i,j,k,n,m;
	char s[2001],t[2001];
	cin>>m>>n>>s>>t;
	rep(i,0,m)rep(j,0,n) 
		dp[i][j][0]=-1,dp[i][j][1]=-1;
	if(s[0]=='I') dp[1][0][1]=1;
	else dp[1][0][0]=0;
	if(t[0]=='I') dp[0][1][1]=1;
	else dp[0][1][0]=0;
	rep(i,0,m) {
		rep(j,0,n) {
			if(i<m) {
				if(s[i]=='I') 
					dp[i+1][j][1]=max(1,max(dp[i][j][0]+1,dp[i+1][j][1]));
				else 
					dp[i+1][j][0]=max(0,max(dp[i][j][1]+1,dp[i+1][j][0]));
			}
			if(j<n) {
				if(t[j]=='I') 
					dp[i][j+1][1]=max(1,max(dp[i][j][0]+1,dp[i][j+1][1]));
				else 	
					dp[i][j+1][0]=max(0,max(dp[i][j][1]+1,dp[i][j+1][0]));
			}
		}
	}
	int mx;
	rep(i,0,m)rep(j,0,n) mx=max(mx,max(dp[i][j][0],dp[i][j][1]));
	if(mx==-1)mx=0;
	else if(mx%2==0 && mx!=0) mx--;
	cout<<mx<<endl;
	return 0;
}
	
	
	
	

Measured memory_bytes: 34332
#include<bits/stdc++.h>
using namespace std;
/*#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
*/typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<ll,ll> pl;
typedef pair<int,int> pii;

#define int ll
#define LOCAL 0
#define dbg(x) cout << #x << " is " << x << "\n"
#define gll(x) scanf("%d",&x)
#define gll2(x,y) scanf("%d%d",&x,&y)
#define gll3(x,y,z) scanf("%d%d%d",&x,&y,&z)
#define gllarr(arr,n) f(i,n) gll(arr[i]);
#define sz(x) ((int)x.size())
#define s(x) sort(x.begin(),x.end())
#define all(v) v.begin(),v.end()
#define rs(v) { s(v) ; r(v) ; }
#define r(v) {reverse(all(v));}
#define pb push_back
#define f(i,n) for(int i=0;i<n;i++)
#define fr(i,n) for(int i=n-1;i>=0;i--)
#define rep(i,a,b) for(int i=a;i<=b;i++)
#define repr(i,a,b) for(int i=a;i>=b;i--)

const ll mod = 998244353;
const ll inf = (ll)1e16;
const ld eps = 1e-12;
const ll N = (int)1e6 + 5;
const ll LOGN = 19;
const ld PI = 3.14159265358979323846;
inline ll mul(ll a, ll b, ll m = mod) { return (ll)(a * b) % m;}
inline ll add(ll a, ll b, ll m = mod) { a += b; if(a >= m) a -= m; if(a < 0) a += m; return a;}
inline ll power(ll a, ll b, ll m = mod) { if(b == 0) return 1; if(b == 1) return (a % m); ll x = power(a, b / 2, m); x = mul(x, x, m); if(b % 2) x = mul(x, a, m); return x;}

map<int, int> mp;
int a[N];

void solve() {
    int n, x, m;
    cin>>n>>x>>m;
    a[0] = x;
    mp[x] = 0;
    int ind = 1;
    bool cycle = false;
    int st = 0;
    while(ind < n) {
        int curr = mul(a[ind - 1], a[ind - 1], m);
        if(mp.find(curr) != mp.end()) {
            cycle = true;
            st = mp[curr];
            break;
        }
        else {
            mp[curr] = ind;
            a[ind++] = curr;
        }
    }
    int ans = 0;
    f(i, ind) ans += a[i];
    if(!cycle) {
        cout<<ans<<endl;
        return;
    }
    int cycSum = 0, cycLen = 0;
    for(int i = st; i < ind; i++) {
        cycLen++;
        cycSum += a[i];
    }
    int rem = n - ind;
    int num = rem / cycLen;
    ans += num * cycSum;
    rem %= cycLen;
    for(int i = st; i < ind; i++) {
        if(rem == 0) break;
        ans += a[i];
        rem--;
    }
    cout<<ans<<endl;
}

int32_t main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    if (LOCAL) {
        freopen("C:\\Users\\Dishant\\Desktop\\Collection-DEV c++\\input.txt", "r", stdin);
        freopen("C:\\Users\\Dishant\\Desktop\\Collection-DEV c++\\output.txt", "w", stdout);
    }
    int t = 1;
    //cin>>t;
    for(int test = 1; test <= t; test++) {
        //cout<<"Case #"<<test<<": ";
        solve();
    }
    return 0;
}

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

/*int prime(int a[],int n)
{
    int k=0;
    for(int i=0; i<n; i++)
    {
        for(int j=2; j<a[i]; j++)
        {
            cout<<a[i]<<endl;
            if(a[i]%j==0)
            {
                k++;
                break;
            }
        }
    }
   // cout<<k;
    return n-k;
}
*/
int main()
{ios::sync_with_stdio();
    int t;
    cin>>t;
    int a;
    //int i=0;
   /* while(t--)
    {
        cin>>a[i];
        i++;

    }*/    int k=0;

    for(int l=0;l<t;l++)
    {
        cin>>a;
         for(int j=2; j*j<=a; j++)
        {
            if(a%j==0)
            {
                k++;
                break;
            }
        }
    }
    //for(int p=0; p<t; p++)
    //{


  //  }
    cout<<t-k<<endl;

    //cout<<prime(a,t);
    return 0;
}



Measured memory_bytes: 3088
#include<bits/stdc++.h>
#define F first
#define S second
#define pb push_back
#define mp make_pair
#define full(a) a.begin(),a.end()
#define rfull(a) a.rbegin(),a.rend()

using namespace std;
const double pi=acos(-1.0);
const double pii=2*pi;
const double eps=1e-6;
const long long MOD=1e9+7;

void solve(){
    long long x;cin>>x;
    long long a,b;
    for(long long i=-1000;i<=1000;i++){
        for(long long del=0;del<=1000;del++){
            long long lhs=(i+del)*(i+del)*(i+del)*(i+del)*(i+del)-i*i*i*i*i;
            if(lhs==x){
                a=del+i;
                b=i;
                del=2000;
                i=2000;
            }
        }
    }
    cout<<a<<" "<<b<<"\n";
}

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

    solve();
    return 0;
}

Measured memory_bytes: 3640
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#define lol(i,n) for(int i=0;i<n;i++)
#define mod 1000000007
typedef long long ll;
using namespace std;
#define N 5010
int n;
string s;
ll dp[N][N];
int main(){
	lol(i,N)lol(j,N)dp[i][j]=0;
	dp[0][0]=1;
	lol(i,N-1)lol(j,N){
		dp[i+1][j+1]=(dp[i+1][j+1]+2*dp[i][j])%mod;
		dp[i+1][max(0,j-1)]=(dp[i+1][max(0,j-1)]+dp[i][j])%mod;
	}
	cin>>n>>s;
	ll ans=dp[n][s.size()];
	lol(i,s.size())ans=ans*500000004%mod;
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 196480
s = str(input())
n = len(s)
l = [0]*(n+1)
temp = 0
for i in range(n):
  if s[i] == '<':
    temp += 1
    l[i+1] = temp
  else:
    temp = 0
    l[i+1] = temp

r = [0]*(n+1)
temp = 0
for i in reversed(range(n)):
  if s[i] == '>':
    temp += 1
    r[i] = temp
  else:
    temp = 0
    r[i] = temp
#print(l)
#print(r)
ans = [0]*(n+1)
for i in range(n+1):
  ans[i] = max(l[i], r[i])
#print(ans)
print(sum(ans))

Measured memory_bytes: 31144
x,n=map(int, input().split())
p = list(map(int, input().split()))
p=sorted(p)
last=1000
zettai=1000
for i in range(102, -1, -1):
    if i not in p:
        if zettai>=abs(i-x):
            zettai=abs(i-x)
            last=i
print(last)

Measured memory_bytes: 61852
#include<iostream>
#include<map>
#include<set>
#include<string>
#include<algorithm>
#include<cmath>
#include<vector>
#include<queue>
#include<stack>
#include<limits>
#include<sstream> 
#include<unordered_map>      

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef int itn;

const int inf = numeric_limits<int>::max() >> 2;
const ll linf = numeric_limits<ll>::max() >> 2;
const ull ulinf = numeric_limits<ull>::max() >> 2;
const double pi = acos(-1);
const int dx[4]={1,0,-1,0};
const int dy[4]={0,1,0,-1};
const int dx8[8]={-1,0,1,-1,1,-1,0,1};
const int dy8[8]={-1,-1,-1,0,0,1,1,1};

#define p_queue(i) priority_queue<i> 
#define rp_queue(i) priority_queue<i, vector<i>, greater<i>> 
#define umap(i,j) unordered_map<i,j>
#define P(p) cout<<(p)<<endl
#define PS(p) cout<<(p)<< " "
#define PN cout << endl
#define rep(i,m,n) for(int i = (m); i < (int)(n); i++)
#define rrep(i,m,n) for(int i = (n-1); i >= (int)(m); i--)
#define inrep(n,a) for(int i = 0; i < (int)(n); i++)cin >> a[i];
#define mod(i) ((i)%(ll)(1e9 + 7))
#define divm(a,b) (mod(a * modpow((ll)b,(ll)(1e9+5))))
#define rsort(a,b,c) sort(a, b, greater<c>())
#define vsort(v) sort(v.begin(), v.end())
#define rvsort(v,c) sort(v.begin(), v.end(), greater<c>()) 
#define ft first
#define sd second
#define pb push_back
#define it insert
#define sz(x) ((int)(x).size())
#define lb(a,n,k) (lower_bound(a,a+n,k) - (a)) 
#define vlb(a,k)  (lower_bound(a.begin(),a.end(),k) - a.begin())
#define ub(a,n,k) (upper_bound(a,a+n,k) - (a)) 
#define vub(a,k)  (upper_bound(a.begin(),a.end(),k) - a.begin())
#define YES cout<<"YES"<< endl
#define NO cout<<"NO"<<endl
#define Yes cout<<"Yes"<<endl
#define No cout<<"No"<<endl  
#define yes cout<<"yes"<<endl
#define no cout<<"no"<<endl
#define ret return

/*
ll modpow(ll i,ll j){ ll tmp=1; while(j){ if(j%2)tmp=mod(tmp*i);i=mod(i*i);j/=2;}return tmp;}
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; }
*/

/*
vector<string> split(const string &str, char sep){
    vector<string> v;
    stringstream ss(str);
    string buffer;
    while( getline(ss, buffer, sep) ) {
        v.push_back(buffer);
    }
    return v;
}
*/

/*
ll ncr[100][100];
ll nCr(int n, int r){if(n==r) ret ncr[n][r] = 1; if(r==0) ret ncr[n][r] = 1; if(r==1) ret ncr[n][r] = n;if(ncr[n][r]) ret ncr[n][r]; ret ncr[n][r] = nCr(n-1,r) + nCr(n-1,r-1);}

ll npr[100][100]={};
ll nPr(int n,int r){if(npr[n][r])ret npr[n][r];if(r==0)ret npr[n][r] = 1;if(r==1)ret npr[n][r] = n;ret npr[n][r] = n * nPr(n-1,r-1);}

ll nHr(int n,int r){ret nCr(n+r-1,r);}
*/

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



int main(){

    int n;
    cin>>  n;

    ll a[n];
    inrep(n,a);
    sort(a,a+n);

    ll ans = 0;

    rep(i,0,n){
	rep(j,i+1,n){
	    rep(k,j+1,n){

		if(a[i] != a[j] && a[j] != a[k]){
		    if(a[i] + a[j] > a[k]){
			//	PS(a[i]);PS(a[j]);P(a[k]);
			ans++;
		    }
		}
	    }
	}
    }

    P(ans);
    return  0;
}


Measured memory_bytes: 3640
# include <bits/stdc++.h>
# define ll long long
using namespace std;
int main(){
	ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	int a, b, c;
	cin >> a >> b >> c;
	if(a + b + c > 21) cout << "bust";
	else cout << "win";
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#include<set>
#include<map>
#include<unordered_map>
#include<stack>
#include<queue>
#include<iomanip>
#include<math.h>
#include<bitset>
#include<cassert>
#include<random>
#include<time.h>
#include<functional>
using namespace std;
using ll=long long;
using ld=long double;
using pint=pair<int,int>;
using pll=pair<ll,ll>;
#define MOD 1000000007LL
#define INF 1000000000LL
#define EPS 1e-10
#define FOR(i,n,m) for(ll i=n;i<(ll)m;i++)
#define REP(i,n) FOR(i,0,n)
#define DUMP(a) REP(d,a.size()){cout<<a[d];if(d!=a.size()-1)cout<<" ";else cout<<endl;}
#define ALL(v) v.begin(),v.end()
#define UNIQUE(v)  sort(ALL(v));v.erase(unique(ALL(v)),v.end());
#define pb push_back

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	ll n, m;
	cin >> n >> m;
	vector<ll> x(m);
	REP(i, m) cin >> x[i];
	if(n >= m) {
		cout << 0 << endl;
		return 0;
	}
	sort(ALL(x));
	vector<ll> diff;
	REP(i, m - 1) diff.pb(x[i + 1] - x[i]);
	sort(ALL(diff));
	ll ans = 0;
	REP(i, m - n) ans += diff[i];
	cout << ans << endl;
	return 0;
}

/* --------------------------------------- */


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

int main(){
    int k;
    cin >> k;
    rep(i,k){
        cout << "ACL"; 
    }
    cout << endl;
    return 0;
}

Measured memory_bytes: 3592
#include<iostream>
#include<vector>
#include<algorithm>

using namespace std;

typedef long long int64;

int64 GCD(int64 a,int64 b){
    if(a%b==0) return b;
    else return GCD(b,a%b);
}

int main(void){
    int64 N;
    cin>>N;
    vector<int64> A(N);
    
    for (auto &&i : A)
    {
        cin>>i;
    }
    
    int64 tmp=A[0];
    
    for (auto &&i : A)
    {
        tmp=GCD(tmp,i);
    }
    
    
    

    cout<<tmp<<endl;

    return 0;
}

Measured memory_bytes: 1024
#include<iostream>
#include<string>
#include<cstring>
#include <cstdio>
#include<utility>
#include<algorithm>
#include<vector>
#include<cmath>
#include<map>
#include<bitset>
#include<queue>
#include<stack>
#include<set>
#include <limits>
#include <climits>
#include <numeric>
#include <cassert>
#include <algorithm>
#include <functional>
using namespace std;
typedef long long ll;
typedef vector<int>VI;
typedef pair<int,int>P;
typedef pair<double,double>P_D;
//const int dx[4]={1,0,-1,0},dy[4]={0,1,0,-1};
#define PI 3.1415926535897932384626433832795
#define rep(i, n) for (ll i = 0; i < (ll)n; i++)
#define reprev(i, n) for (ll i = (ll)n - 1; i >= 0; i--)
#define ALL(a)  (a).begin(),(a).end()
#define C_MAX(a, b) ((a)>(b)?(a):(b))
#define fi first
#define se second
#define MAX 100100//5
#define MAX_N 200100
#define MAX_B 1001001//6
#define MAX_S 10010010//7
#define SENTINEL 2000000000//9
#define NIL -1
#define MOD 1000000007
#define INF 1 << 29
#define INFTY 1000000000000000000LL
#define MAX_INT INT_MAX
//greater<Type>()

int memo[MAX];
int rec(int n){
    if(n==0)return 0;
    if(memo[n]!=-1)return memo[n];
    int res=n;
    for(int pow6=1;pow6<=n;pow6*=6)res=min(res,rec(n-pow6)+1);
    for(int pow9=1;pow9<=n;pow9*=9)res=min(res,rec(n-pow9)+1);
    return memo[n]=res;
}

int main(){
    int n;cin>>n;
    rep(i,MAX)memo[i]=-1;
    cout<<rec(n)<<endl;
}

Measured memory_bytes: 3712