akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main()
{
	int n = 0;
	int k = 0;
	cin>>n>>k;
	vector <int> vect(n);
    for(int i = 0; i < n; i++)
    {
        cin>>vect[i];
    }
    sort(vect.begin(),vect.end());
    int res = 0;
    for(int i = 0; i < k; i++)
    {
        res = res + vect[i];
    }
    cout<<res<<endl;
}

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

int main (){
  string S;
  cin>>S;
  int n=S.size();
  int m=999;
  
  for(int i=0;i<n-2;i++){
    int x=S.at(i+2)-'0'+(S.at(i+1)-'0')*10+(S.at(i)-'0')*100;
    m=min(m,abs(x-753));
  }
  
  cout<<m;
}

Measured memory_bytes: 384
#include<bits/stdc++.h>
    using namespace std;
    typedef long long ll;
    #define rep(i,s,n) for(int i = s; i < n; i++)
    const ll maxn = 2e5+10;
    ll N,X;
    ll in[maxn];
    ll cumsum[maxn];
    double ans = 1e100;
     
    int main(){
    	cin>>N>>X;
    	rep(i,0,N){
    		scanf("%lld", &in[i+1]);
    	}
    	cumsum[1] = in[1];
    	rep(i,2,N+1){
    		cumsum[i] = cumsum[i-1]+in[i];
    	}
    	rep(k,1,N+1){
    		double tmp=0.0;
    		for(int i = N; i >=0; i-=k){
    			if(i==N) tmp+=5*cumsum[i];
    			else if(N-k==i)continue;
    			else tmp+=2*cumsum[i];
    		}
    		tmp+=X*N+k*X;
    		// cout<<tmp<<endl;
    		ans = min(ans,tmp);
    	}
    	cout<<(ll)ans<<endl;
    }

Measured memory_bytes: 3328
import sys
sys.setrecursionlimit(10**9)
n = int(input())
T = [[] for _ in range(n)]
for _ in range(n-1):
    u,v,w = map(int,input().split())
    u -= 1
    v -= 1
    w %= 2
    T[u].append((v,w))
    T[v].append((u,w))

ans = [0]*n
def dfs(u,p=-1,c=0):
    for v,w in T[u]:
        if v == p: continue
        nc = (c+1)%2 if w else c 
        ans[v] = nc
        dfs(v,u,nc)
dfs(0)

print("\n".join(map(str,ans)))

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

int main(){
	int n, t = 0, r0 = 0, r1 = 0, ct, cr0, cr1, calc1, calc2;
	std::cin >> n;
	for(int i=0; i<n; i++){
		ct = t;
		cr0 = r0;
		cr1 = r1;
		cin >> t >> r0 >> r1;
		calc1 = abs(r0 - cr0) + abs(r1 - cr1);
		calc2 = t - ct;
		if(calc1 > calc2 || (calc1 - calc2) % 2 != 0){
			cout << "No" << endl;
			return 0;
		}
	}
	cout << "Yes" << endl;
}

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

using namespace std;

int main() {
  int W, H, N;
  cin >> W >> H >> N;
  int XL = 0, XR = W, YU = 0, YD = H;
  for (int i = 0; i < N; i++) {
    int X, Y, A;
    cin >> X >> Y >> A;
    if (A == 1) {
      XL = max(X, XL);
    } else if (A == 2) {
      XR = min(X, XR);
    } else if (A == 3) {
      YU = max(Y, YU);
    } else {
      YD = min(Y, YD);
    }
  }

  if (XL >= XR || YU >= YD) {
    cout << 0 << "\n";
  } else {
    cout << (XR - XL) * (YD - YU) << "\n";
  }

  return 0;
}


Measured memory_bytes: 256
from itertools import product


def solve(string):
    n = int(string)
    ans = 0
    for i in range(3, len(str(n)) + 1):
        tmp = (int("".join(x))
               for x in product("753", repeat=i)
               if "7" in x and "5" in x and "3" in x)
        ans += len([x for x in tmp if x <= n])
    return str(ans)


if __name__ == '__main__':
    print(solve(input()))


Measured memory_bytes: 49628
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		String s = sc.next();
		String t = sc.next();
		long MOD = 1000000007;
		long[] dp = new long[100];
		int dominoN = 0;
		for(int i = 0; i < n; i++) {
			// 最初のドミノパターン
			if(dominoN == 0) {
				// １個のドミノのパターン
				if(s.charAt(i) == t.charAt(i)) {
					dp[dominoN + 1] = 3;
					dominoN++;
				} else {
				// ２個のドミノのパターン
					dp[dominoN + 2] = 6;
					dominoN += 2;
					i++;
				}
	 		// 最初以降のドミノのパターン
			} else {
				// １個のドミノのパターン
				if(s.charAt(i) == t.charAt(i)) {
					// １つ前のドミノが縦のパターン
					if(s.charAt(i - 1) == t.charAt(i - 1)) {
						dp[dominoN + 1] = dp[dominoN] * 2 % MOD;
						dominoN++;
					// １つ前のドミノが横のパターン
					} else {
						dp[dominoN + 1] = dp[dominoN];
						dominoN++;
					}
				// ２個のドミノのパターン
				} else {
					// １つ前のドミノが縦のパターン
					if(s.charAt(i - 1) == t.charAt(i - 1)) {
						dp[dominoN + 2] = dp[dominoN] * 2 % MOD;
						dominoN += 2;
					} else {
					// １つ前のドミノが横のパターン
						dp[dominoN + 2] = dp[dominoN] * 3 % MOD;
						dominoN += 2;
					}
					i++;
				}
			}
		}
		System.out.println(dp[n]);
	}
}


Measured memory_bytes: 23764
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {

        Scanner in = new Scanner(System.in);
        String[] params = in.nextLine().split(" ");
        int M = Integer.parseInt(params[0]);
        int D = Integer.parseInt(params[1]);
        int count = 0;

        for( int m = 1 ; m <= M ; m++ ){
            for( int d = 1 ; d <= D ; d++ ){
                int d10 = d/10;
                int d1 = d%10;
                if( d1 >= 2 && d10 >= 2 ){
                    if( m == d1 * d10 ){
                        count++;
                    }
                }
            }
        }

        System.out.println( count );

    }

}


Measured memory_bytes: 22868
#include <iostream>
#include <strstream>
#include <string>
#include <deque>
#include <vector>
#include <algorithm>
typedef unsigned int UINT;
using namespace std;

bool isRevers(const string & str)
{
    if (str.length() > 2)
        return true;
    return false;
}
string & makeStrRevers(string & str)
{
    reverse(str.begin(), str.end());
    return str;
}

int main(void) {
    string S;
    cin >> S;
    if (isRevers(S))
        cout << makeStrRevers(S) << endl;
    else
        cout << S << endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define M 1000000007
#define ff first.first
#define fs first.second
#define sf second.first
#define ss second.second
typedef pair<ll,ll> P;
typedef pair<P,P> PP;
int main(void){
	ll i,j,k;
	ll n,m,s,g,b,e,pp,kou;
	ll ri[21][21];
	ll leng[21],v[21];
	ll min;
	
	PP p[100];
	
	cin>>n>>m;
	for(i=0;i<m;i++) scanf("%lld,%lld,%lld,%lld",&p[i].ff,&p[i].fs,&p[i].ss,&p[i].sf);
	scanf("%lld,%lld,%lld,%lld",&s,&g,&b,&e);
	
	//隣接行列
	sort(p,p+m);
	for(i=0;i<=n;i++) for(j=0;j<=n;j++) ri[i][j]=M;
	for(i=0;i<m;i++) ri[p[i].ff][p[i].fs]=p[i].sf,ri[p[i].fs][p[i].ff]=p[i].ss;
	
	//初期化
	for(k=0;k<=n;k++)leng[k]=M,v[k]=0;
	leng[s]=0;
	
	kou=0;
	//ダイクストラ法
	for(j=1;j<=n;j++){
		min=M;
		for(k=1;k<=n;k++) if(v[k]==0&&leng[k]<min) pp=k,min=leng[k];
		v[pp]=1;
		
		if(min==M)break;
		
		for(k=1;k<=n;k++){
			if((leng[pp]+ri[pp][k])<leng[k]) leng[k]=leng[pp]+ri[pp][k];
		}
	}
	kou+=leng[g];
//	cout<<leng[g]<<endl;
	
	//初期化
	for(k=0;k<=n;k++)leng[k]=M,v[k]=0;
	leng[g]=0;
	
	//ダイクストラ法
	for(j=1;j<=n;j++){
		min=M;
		for(k=1;k<=n;k++) if(v[k]==0&&leng[k]<min) pp=k,min=leng[k];
		v[pp]=1;
		
		if(min==M)break;
		
		for(k=1;k<=n;k++){
			if((leng[pp]+ri[pp][k])<leng[k]) leng[k]=leng[pp]+ri[pp][k];
		}
	}
	kou+=leng[s];
//	cout<<leng[s]<<endl;
	
	cout<<b-e-kou<<endl;
	return 0;
}


Measured memory_bytes: 3176
#include<algorithm>
#include<iostream>
#include<vector>
#include<string>
#include<queue>
#include<stack>
#include<cmath>
#include<list>
#include<set>
#include<map>

using namespace std;
long long MOD = 1000000007LL;
#undef INT_MIN
#undef INT_MAX
#define INT_MIN -2147483648
#define INT_MAX 2147483647
#define endl "\n"

int main() {
	double N;
	cin >> N;
	N /= 3;

	printf("%0.6lf", pow(N, 3));

	return 0;
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main() {
  int a,b,c,x;
  cin>>a;
  cin>>b;
  cin>>c;
  cin>>x;
  int ans=0;
  for(int i=0;i<=a;i++) {
    for(int j=0;j<=b;j++) {
      for(int k=0;k<=c;k++) {
        if(500*i+100*j+50*k==x) {
          ans++;
        }
      }
    }
  }
  cout<<ans<<endl;
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <map>
#include <queue>

static const int INF = 1000000007;
using ll = long long;
using u32 = unsigned;
using namespace std;

int main() {
    string s;
    cin >> s;
    string ans = s.front() + to_string(s.length()-2) + s.back();
    cout << ans << "\n";
    return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <numeric>
#include <bitset>

using namespace std;
using ll = long long;
using ld = long double;
const ll mod =  1000000007;
const ll inf = 1e18;

#define REP(i, n) for (ll i = 0; i < (n); ++i)
#define REP_FROM(i, j, n) for (ll i = (j); i < (n); ++i)
#define all(x) (x).begin(),(x).end()

template<typename T> void print_vec(vector<T> a) {int n = a.size();REP(i, n) {cout >> a[i]; if(i!=n-1) cout << " "; else cout << endl;}}
ll power(ll base, ll exponent){ if(exponent % 2){ return power(base, exponent - 1) * base % mod; }else if(exponent){ ll root_ans = power(base, exponent / 2); return root_ans * root_ans % mod; }else{ return 1; }}
ll inverse(ll x){ return power(x, mod - 2);}
ll gcd(ll a, ll b) {if(a < b) gcd(b, a);ll r;while(r=a%b) {a=b;b=r;}return b;}
template<typename T> ll sum(T begin, T end) {return accumulate(begin, end, 0ll);}
struct combination{ vector<ll> fact, inv; combination(int sz) : fact(sz + 1), inv(sz + 1){ fact[0] = 1; for(int i = 1; i <= sz; i++){ fact[i] = fact[i - 1] * i % mod; } inv[sz] = power(fact[sz], mod - 2); for(int i = sz - 1; i >= 0; i--){ inv[i] = inv[i + 1] * (i + 1) % mod; } } ll C(int p, int q) const{ if(q < 0 || p < q) return 0; return (fact[p] * inv[q] % mod * inv[p - q] % mod); } };

int bsearch(const vector<ll>& a, ll x){
  int lft = 0;
  int rgt = a.size();
  while (rgt - lft > 1) {
    int mid = (lft + rgt) / 2;
    if(a[mid] < x) {
      lft = mid;
    }
    else {
      rgt = mid;
    }
  }
  return lft;
}

signed main() {
  ios::sync_with_stdio(false);
  ll k, X, Y;
  cin >> k >> X >> Y;
  ll x = X, y = Y;
  int xs = (x >= 0) ? 1 : -1;
  int ys = (y >= 0) ? 1 : -1;
  x = x * xs;
  y = y * ys;
  if(k % 2 == 0 && (x+y) % 2 == 1) {
    cout << -1 << endl;
    return 0;
  }
  vector<ll> a, b;
  while(x > k && x + y > 2 * k) {
    x -= k;
    a.push_back(x);
    b.push_back(y);
  }
  while(y > k && x + y > 2 * k) {
    y -= k;
    a.push_back(x);
    b.push_back(y);
  }

  if(x + y != k) {
    if(x < y) {
      ll c = (-x + y) / 2;
      ll nx = x + c - k;
      ll ny = y - c;
      a.push_back(nx);
      b.push_back(ny);
      x = nx;
      y = ny;
    }
    else {
      ll c = (-y + x) / 2;
      ll nx = x - c;
      ll ny = y + c - k;
      a.push_back(nx);
      b.push_back(ny);
      x = nx;
      y = ny;
    }
    if(abs(x) + abs(y) != k) {
      if(abs(x) < abs(y)) {
        ll c = (-abs(x) + abs(y)) / 2;
        ll ny = abs(y) - c;
        if(abs(y - ny) != c) ny *= -1;
        ll nx = abs(x) + c - k;
        if(abs(x - nx) != k - c) nx *= -1;
        x = nx;
        y = ny;
      }
      else {
        ll c = (-abs(y) + abs(x)) / 2;
        ll nx = abs(x) - c;
        if(abs(x - nx) != c) nx *= -1;
        ll ny = abs(y) + c - k;
        if(abs(y - ny) != k - c) ny *= -1;
        x = nx;
        y = ny;
      }
      a.push_back(x);
      b.push_back(y);
    }
  }
  a.push_back(0);
  b.push_back(0);
  cout << a.size() << endl;
  REP(i, a.size()) {
    cout << (abs(X) - a[i]) * xs << " " << (abs(Y) - b[i]) * ys << endl;
  }
  return 0; 
}


Measured memory_bytes: 5476
#include<stdio.h>

int main () {
	int H, A, num;
	scanf("%d %d", &H, &A);
	
	num = H/A;
	
	if (H % A == 0){
		printf("%d", num);
	}
	else {
		printf("%d", num+1);
	}
	
	return 0;
}

Measured memory_bytes: 3220
#include<bits/stdc++.h>
using namespace std;
int x;
char c;
inline int read()
{
	x=0; c=getchar();
	while(c<'0'||c>'9') c=getchar();
	while(c<='9'&&c>='0') {x=(x<<1)+(x<<3)+c-'0'; c=getchar();}
	return x;
}
int main()
{
	long n = read(), ans = n;
	for (int i = 1; i < n; ++i)
	{
        int u = read(), v = read();
		if (u > v) swap(u, v);
        ans += i * (n - i + 1) - u * (n - v + 1);
	}
	printf("%lld\n", ans);
  
    return 0;
}


Measured memory_bytes: 3720
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <queue>
#include <list>
#include <limits>
#include <string>
#include <vector>
using namespace std;
typedef long long ll;

typedef pair<ll, ll> curr;
const int MOD = 998244353;


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

int main()
{
  int A,P;
  cin >> A >> P;
  cout << ((A*3)+P)/2;
}


Measured memory_bytes: 888
def A(a,b):
    if a<b:
        tmp = a
        a = b
        b = tmp
    r = a % b
    while r!=0:
      a = b
      b = r
      r = a % b
    return b
n,X=map(int,input().split())
x=list(map(int,input().split()))
x.append(X)
x.sort()
x2=[]
for i in range(1,n+1):
    x2.append(x[i]-x[i-1])
if len(x2)==1:
    p=x2[0]
else:
    for i in range(n):
        if i==0:
            p=A(x2[i-1],x2[i])
        elif i!=1:
            p=A(p,x2[i])
print(p)



Measured memory_bytes: 20020
#include <iostream>
#include <algorithm>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <string.h>
#include <vector>
#include <queue>
#include <cmath>
#include <bitset>
#include <complex>
#include <functional>
#include <numeric>
#include <iomanip>

// output
#define SPBR(w, n) std::cout<<(w + 1 == n ? '\n' : ' ');
#define YES cout << "YES" << endl
#define Yes cout << "Yes" << endl
#define NO cout << "NO" << endl
#define No cout << "No" << endl
// utility
#define ALL(i) (i).begin(), (i).end()
#define FOR(i, a, n) for(int i=(a);i<(n);++i)
#define RFOR(i, a, n) for(int i=(n)-1;i>=(a);--i)
#define REP(i, n) for(int i=0;i<int(n);++i)
#define RREP(i, n) for(int i=int(n)-1;i>=0;--i)
#define IN(a, x, b) (a<=x && x<b)
#define OUT(a, x, b) (x<a || b<=x)
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; }

// type/const
#define int ll
using ll = long long;
using ull = unsigned long long;
using ld = long double;
const int MOD = 1000000007;
/* const int MOD = 998244353; */
const int INF = 1e18;
const double PI = acos(-1);

using namespace std;
struct INIT { INIT(){
  cin.tie(0); ios::sync_with_stdio(false);
  cout << fixed << setprecision(10);
}}INIT;


signed main() {
  int N, X; 
  cin >> N >> X;

  vector<int> A(N);
  REP(i, N) cin >> A[i];

  int ans = 0;

  int L = 0;
  REP(i, N){
    if(L <= X) ans++;
    L += A[i];
  }
  if(L <= X) ans++;

  cout << ans << "\n";

  return 0;
}

Measured memory_bytes: 256
#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;

typedef long long ll;

typedef tree<
pair <int, int>,
null_type,
less<pair <int, int>>,
rb_tree_tag,
tree_order_statistics_node_update>
os;

double getTime() {
  return clock() / (double) CLOCKS_PER_SEC;
}

void read() {};

template<typename T, typename... Args>
void read(T& a, Args&... args) {
  cin >> a;
  read(args...);
}

void print() {};

template <typename T, typename... Args>
void print(T a, Args... args) {
  cout << a << " \n"[sizeof...(args) == 0];
  print(args...);
}

const int N = 2e5 + 5;
const ll MOD = 1e9 + 7;

ll f[N];
ll inv[N];

ll get(ll a, ll b) {
  ll res = 1ll;
  while(b) {
    if(b & 1) res = (res * a) % MOD;
    b >>= 1;
    a = (a * a) % MOD;
  }
  return res;
}

ll ncr(ll n, ll r) {
  if(n < r or n < 0 and r < 0) return 0;
  ll cur = f[n];
  cur = (cur * inv[r]) % MOD;
  cur = (cur * inv[n - r]) % MOD;
  return cur;
}

int main() {
  f[0] = inv[0] = 1;
  for(ll i = 1; i < N; i++) {
    f[i] = (f[i - 1] * i) % MOD;
    inv[i] = get(f[i], MOD - 2);
  }
  int n, m; cin >> n >> m;
  ll ans = 1ll;
  for(int i = 2; i * i <= m; i++) {
    if(m % i == 0) {
      ll cnt = 0;
      while(m % i == 0) {
        cnt++;
        m /= i;
      }
      ans = (ans * ncr(cnt + n - 1, n - 1)) % MOD;
    }
  }
  if(m > 1) {
    ans = (ans * ncr(n, n - 1)) % MOD;
  }
  print(ans);
}

Measured memory_bytes: 3328
A=[0,0,0]
S=[0,0,0]
for i in range(3):
    A[i]=[int(x) for x in input().split()]
    S[i]=[0,0,0]
N=int(input())

for i in range(N):
    b=int(input())
    
    for x in range(3):
        for y in range(3):
            if A[x][y]==b:
                S[x][y]=1

flag=False
for i in range(3):
    if S[i]==[1,1,1]:
        flag=True

for i in range(3):
    s=[]
    for k in range(3):
        s.append(S[k][i])
    if s==[1,1,1]:
        flag=True

s=[]
for i in range(3):
    s.append(S[i][i])

if s==[1,1,1]:
    flag=True
        
s=[]
for i in range(3):
    s.append(S[i][2-i])

if s==[1,1,1]:
    flag=True

if flag:
    print("Yes")
else:
    print("No")

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

using namespace std;

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

typedef long long ll;

ll b[100010], l[100010], u[100010];
ll fu[100010];
ll sum;
pair<ll, int> p[100010];
ll rui[100010];
bool isin[100010];

int main()
{
	ll n, x;
	cin >> n >> x;
	rep(i, n) cin >> b[i] >> l[i] >> u[i];
	rep(i, n) sum+=b[i]*l[i];
	rep(i, n) fu[i]=x*u[i]-b[i]*(u[i]-l[i]);
	rep(i, n) p[i]=make_pair(fu[i], i);
	sort(p, p+n);
	rui[0]=0;
	rep(i, n) rui[i+1]=rui[i]+p[n-1-i].first;
	int pos;
	rep(i, n)
	{
		if(rui[i+1]>=sum)
		{
			pos=i;
			break;
		}
	}
	rep(i, pos) isin[p[n-1-i].second]=true;
	ll ans=x*pos;
	ll ans1=x;
	rep(i, n)
	{
		ll tmp=sum;
		if(isin[i]) tmp-=(rui[pos+1]-fu[i]);
		else tmp-=rui[pos];
		if(b[i]*l[i]>=tmp) ans1=min(ans1, (tmp+(l[i]-1))/l[i]);
		else if(fu[i]>=tmp) ans1=min(ans1, (tmp+b[i]*(u[i]-l[i])+(u[i]-1))/u[i]);	
	}
	//cout << pos << endl;
	cout << ans+ans1 << endl;
	return 0;
}

Measured memory_bytes: 5760
//{
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef double lf;
typedef pair<ll,ll> ii;
#define REP(i,n) for(ll i=0;i<n;i++)
#define REP1(i,n) for(ll i=1;i<=n;i++)
#define FILL(i,n) memset(i,n,sizeof i)
#define X first
#define Y second
#define SZ(_a) (int)_a.size()
#define ALL(_a) _a.begin(),_a.end()
#define pb push_back
#ifdef brian
#define debug(...) do{\
    fprintf(stderr,"%s - %d (%s) = ",__PRETTY_FUNCTION__,__LINE__,#__VA_ARGS__);\
    _do(__VA_ARGS__);\
}while(0)
template<typename T>void _do(T &&_x){cerr<<_x<<endl;}
template<typename T,typename ...S> void _do(T &&_x,S &&..._t){cerr<<_x<<" ,";_do(_t...);}
template<typename _a,typename _b> ostream& operator << (ostream &_s,const pair<_a,_b> &_p){return _s<<"("<<_p.X<<","<<_p.Y<<")";}
template<typename It> ostream& _OUTC(ostream &_s,It _ita,It _itb)
{
    _s<<"{";
    for(It _it=_ita;_it!=_itb;_it++)
    {
        _s<<(_it==_ita?"":",")<<*_it;
    }
    _s<<"}";
    return _s;
}
template<typename _a> ostream &operator << (ostream &_s,vector<_a> &_c){return _OUTC(_s,ALL(_c));}
template<typename _a> ostream &operator << (ostream &_s,set<_a> &_c){return _OUTC(_s,ALL(_c));}
template<typename _a,typename _b> ostream &operator << (ostream &_s,map<_a,_b> &_c){return _OUTC(_s,ALL(_c));}
template<typename _t> void pary(_t _a,_t _b){_OUTC(cerr,_a,_b);cerr<<endl;}
#define IOS()
#else
#define debug(...)
#define pary(...)
#define endl '\n'
#define IOS() ios_base::sync_with_stdio(0);cin.tie(0);
#endif // brian
//}


const ll MAXn=1e5+5,MAXlg=__lg(MAXn)+2;
const ll MOD=1000000007;
const ll INF=ll(1e15);

int main()
{
    IOS();
    REP(i,3)
    {
      string s;
      cin>>s;
      cout<<s[i];
    }
}


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

const int MAX = 1000;
const int MAX_W = 10001;

int main() {
	int N,W;
	int v[MAX];
	int w[MAX];
	int dp[MAX_W];
	int ans = 0;

	cin >> N >> W;
	for (int i = 0; i < N; i++) {
		cin >> v[i] >> w[i];
	}

	for (int i = 1; i <= W; i++)dp[i] = -1;
	dp[0] = 0;

	for (int i = 0; i < N; i++) {
		for (int j = W - w[i]; j >= 0;j--) {
			if (dp[j] == -1)continue;
			dp[j + w[i]] = max(dp[j + w[i]], dp[j] + v[i]);
			ans = max(dp[j + w[i]], ans);
		}
	}

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

Measured memory_bytes: 3144
/*
 * welcome to my code!
 * ----------------------------------------
 * author : lynmisakura
 */
#include<bits/stdc++.h>
using namespace std;

using ll = long long;
#define rep(i,n) for(int i = 0;i < n;i++)

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

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

    string s;cin >> s;

    int64_t tens = 1;
    int64_t tmp = 0;

    const int64_t MOD = 2019;

    map<int64_t ,int64_t > M;
    M[0]++;
    int64_t ans = 0;

    for(int i = int(s.size()) - 1;i >= 0;i--){
        tmp = (tmp + (tens * (s[i] - '0')) % MOD) % MOD;
        tens = (tens * 10) % MOD;
        ans += M[tmp];
        M[tmp]++;
    }

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



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

int main() {
    ios_base::sync_with_stdio(0);cin.tie(0);
    int N,K;
    cin>>N>>K;
    vector<int> A(N+1);
    for(int i=0; i<N; i++) {
        int n;
        cin>>n;
        ++A[n];
    }
    sort(A.begin(), A.end());
    int ans=0;
    for(int i=0; i<=N-K; i++) 
        ans+=A[i];
    cout<<ans;
    
    return 0;
}

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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
using P = pair<ll, ll>;
using V = vector<ll>;
#define rep(i, n) for(ll i=0;i<(ll)(n);i++)
#define rep1(i, n) for(ll i=1;i<=(ll)(n);i++)
#define rep2(i, m, n) for(ll i=m;i<(ll)(n);i++)
#define rrep(i, n, m) for(ll i=n;i>=(ll)(m);i--)
#define ALL(obj) (obj).begin(), (obj).end()
#define RALL(obj) (obj).rbegin(), (obj).rend()
#define MOD 1000000007
#define INF 1000000000

void solve_abc_e() {
	ll n;
	cin >> n;

	V a(n);
	V bit1(1000, 0);
	V bit2(1000, 0);
	V bit3(1000, 0);
	V ans(n, 0);
	ll cnt = 0;
	ll sum = 0;
	ll asum = 0;
	rep(i, n) {
		cin >> a[i];
		sum ^= a[i];
	}

	ll val;
	rep(i, n) {
		val = sum^a[i];
		cnt = 0;
		bit2 = V(1000, 0);
		while(val>=1) {
			bit2[cnt] = (bit3[cnt] + val % 2) % 2;
			val /= 2;
			cnt++;
		}
		cnt = 1;
		rep(j, 1000) {
			if (bit2[j] == 1) {
				ans[i] += cnt;
			}
			cnt *= 2;
		}
		cout << ans[i] << " ";
	}
}

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

	solve_abc_e();

	return 0;
}

Measured memory_bytes: 6360
#include <bits/stdc++.h>
using namespace std;
#define int long long int
#define pb push_back
#define st first
#define nd second

const int N = 1e5+5;
const int MOD = 1e9+7;

int n, m;
char a;

bool arr[1005][1005];
int dp[1005][1005];

int32_t main() {
	ios_base::sync_with_stdio(0);
    cin >> n >> m;
    for (int i = 0; i < n; i++){
        for (int j = 0; j < m; j++){
            cin >> a;
            if(a == '#') arr[i][j] = 1;
            else arr[i][j] = 0; 
        }
    }
    for (int i = 0; i < n; i++){
        if(arr[i][0] == 1) break;
        dp[i][0] = 1;
    }
    for (int i = 0; i < m; i++){
        if(arr[0][i] == 1) break;
        dp[0][i] = 1;
    }
    for (int i = 1; i < n; i++){
        for (int j = 1; j < m; j++){
             if(arr[i][j] != 0) continue;
             else if(arr[i-1][j] == 0 && arr[i][j-1] == 0) dp[i][j] = (dp[i-1][j] + dp[i][j-1])%MOD;
             else if(arr[i-1][j] == 0) dp[i][j] = dp[i-1][j];
             else if(arr[i][j-1] == 0) dp[i][j] = dp[i][j-1];
             else dp[i][j] = 0;
        }
    }
    cout << dp[n-1][m-1] << endl;
}

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

using namespace std;
using ll=long long;
#define rep(i, n) for(int i = 0; i < n; i++)
#define rep2(i, a, n) for(int i = (a); i < (n); i++)

int main(){
  cin.tie(nullptr);ios_base::sync_with_stdio(false);
  int n;cin>>n;
  string s,l;
  bool flag=true;
  map<string,int> map;
  cin>>s;
  map[s]=0;
  rep(i,n-1){
    cin>>l;
    auto itr = map.find(l);
    if(itr != map.end() || s[s.size()-1]!=l[0]) {
      flag=false;
    } else {
      map[l]=0;
    }
    s=l;
  }
  cout<<(flag ? "Yes":"No")<<endl;
}


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

int main() {
    int n;
    cin >> n;
    int result = 0;
    vector<int> vec(n);
    for (int i = 0; i < n; i++) {
        cin >> vec.at(i);
        result += vec.at(i) - 1;
    }
    
    cout << result << endl;
}


Measured memory_bytes: 256
//金利計算

#include<iostream>
#include<utility>
#include<string>
#include<vector>
#include<algorithm>

//int:-2,147,483,648 ～ 2,147,483,647
//long long:-9,223,372,036,854,775,808 to 9,223,372,036,854,775,807

using namespace std;

int main() {
	while (true) {
		int n;//銀行の数
		double y;//預金年数
		int ans = 0;//元利最高の銀行番号
		double maxrate = 1.0;//最高利率

		cin >> n;
		if (n == 0) break;
		else {

			cin >> y;
			for (int i = 0; i < n; i++) {
				int b;//銀行番号
				double r;//年利率
				int t;//預金タイプ　1;単利　2:複利
				double rate = 1.0;
				cin >> b >> r >> t;

				if (t == 1) {//単利
					rate = 1.0 + y * (r / 100.0);
				}
				else {//複利
					double _r = 1.0 + (r / 100.0);
					for (int j = 0; j < y; j++) 
						rate *= _r;
				}

				//cout << b << " " << r << " " << t << " " << rate << endl;
				if (maxrate < rate) {
					maxrate = rate;
					ans = b;
				}
			}
			cout << ans << endl;
		}
	}

	return 0;
}



Measured memory_bytes: 3156
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int m = sc.nextInt();

		double l = 100*(n-m)+1900*m;
		double k = 1/Math.pow(2, m);
		//double x = l*k/((1-k)*(1-k));
		double x = l/k;
		System.out.println((int)x);
	}

}


Measured memory_bytes: 21716
import java.util.*;

public class Main {

    public static void main(String[] args)  {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        long ans = 0;

        for(int i=1;i<=N;i++){
            if(i % 3 != 0 && i % 5 != 0){
                ans +=i;
            }
        }
        System.out.println(ans);


    }

}









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

// ■■■■■■■■■■■■■■■■headerここまで■■■■■■■■■■■■■■■■

int main(void) {

    int n;
    cin >> n;

    vector<int> a(n);
    for (int i = 0; i < n; i++) cin >> a[i];

    vector<int> arr(n);
    int length = 0;

    arr[0] = a[0];

    for (int i = 1; i < n; i++) {
        if (arr[length] >= a[i]) {
            length++;
            arr[length] = a[i];
        }
        else {
            for (int j = 0; j <= length; j++) {
                if (arr[j] < a[i]) {
                    arr[j] = a[i];
                    break;
                }
            }
        }
    }
    cout << length + 1 << endl;
    return 0;

}


Measured memory_bytes: 4036
#include<bits/stdc++.h>
using namespace std;
#define INF 2147483647
int main(){
  int a,b=0,c=0;
  for(int i=0;i<8;i++){
    cin>>a;
    if(i<=3) b+=a;
    else c+=a;
  }
  cout<<max(b,c)<<"\n";
}

  



Measured memory_bytes: 3088
#include <bits/stdc++.h>
#define int long long
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using namespace std;
const int MOD = 1e9 + 7;
const int INF = numeric_limits<int>::max() / 2;

const int MAX = 2e5;
int64_t fac[MAX] = {}, inv[MAX] = {}, finv[MAX] = {};

void make_table() {
  fac[0] = 1; fac[1] = 1;
  finv[0] = 1; finv[1] = 1;
  inv[1] = 1;
  for (int i = 2; i < MAX; ++i) {
    fac[i] = fac[i - 1] * i % MOD;
    inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
    finv[i] = finv[i - 1] * inv[i] % MOD;
  }
}

int64_t com(int n, int k) {
  if (n < k) return 0;
  if (n < 0 || k < 0) return 0;
  return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}


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

  int N, M;
  cin >> N >> M;
  int A[1000000]{};
  int W = M;
  for(int i=2;i*i<=W;i++){
    while(M % i == 0){
      A[i]++;
      M /= i;
    }
  }
  int ans = 1;
  if(M != 1) ans = N;

  make_table();
  for(int i=2;i*i<=W;i++){
    if(A[i] == 0) continue;
    ans *= com(A[i]+N-1, A[i]);
    ans %= MOD;
  }

  cout << ans << endl;
}

Measured memory_bytes: 12800
// C
#ifndef _GLIBCXX_NO_ASSERT
#include <cassert>
#endif
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>

#ifdef __GXX_EXPERIMENTAL_CXX0X__
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>
#endif

// C++
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>

#ifdef __GXX_EXPERIMENTAL_CXX0X__
#include <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
#endif
//#include <bits/stdc++.h>

#define all(v) v.begin(), v.end()
typedef long long ll;
#define rep(i, z, n) for(int i = z; i < n; i++)
//const int INF = 1<<29;
//const int MODINF = 1000000007;
using namespace std;

int main(){
    int N;
    cin >> N;
    vector<string> s(N);
    map<string, int> mp;
    rep(i, 0, N){
        cin >> s.at(i);
        sort(all(s.at(i)));
        if(mp.count(s.at(i))) mp[s.at(i)]++;
        else mp[s.at(i)] = 1;
    }
    
    ll ans = 0;
    for(auto p : mp){
        ll second = p.second;
        ans += (second * (second - 1)) / 2;
    }
    cout << ans << endl;
}

Measured memory_bytes: 14004
#include <bits/stdc++.h>
#define MOD (long long)(1E9+7)
#define rep(i, n) for(int i = 0; i < n; i++)

using namespace std;

int main(){
	int n;
	cin >> n;
	vector<string> x(n);
	vector<int> c(n);
	rep(i, n){
		cin >> x[i];
	}
  	sort(x.begin(), x.end());
  	int k = 0, m = 0;
  	c[0]++;
  	rep(i, n-1) {
    	if(x[i] != x[i+1]) {
        	k=i+1;
        }
      	c[k]++;
      	m = max(c[k], m);
    }
  	k = 0;
  	rep(i, n) {
    	 if(c[i] == m) {
        	cout << x[i] << endl;
         }
    }
}

Measured memory_bytes: 15104
import sys

sys.setrecursionlimit(10**7)
def I(): return int(sys.stdin.readline().rstrip())
def MI(): return map(int,sys.stdin.readline().rstrip().split())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))  #空白あり
def LI2(): return list(map(int,sys.stdin.readline().rstrip()))  #空白なし
def S(): return sys.stdin.readline().rstrip()
def LS(): return list(sys.stdin.readline().rstrip().split())  #空白あり
def LS2(): return list(sys.stdin.readline().rstrip())  #空白なし


N = I()
ST = [LS() for _ in range(N)]
X = S()

ans = 0
for i in range(N):
    s,t = ST[i]
    ans += int(t)
    if s == X:
        break

print(sum(int(ST[i][1]) for i in range(N))-ans)


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

int main() {
  int A, B;
  cin >> A >> B;

  if ( A % 2 != 0 && B % 2 != 0 ){
  	cout << "Odd" << endl;
  }
  else{
    cout << "Even" << endl;
  }
  
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define repR(i, n) for(int i = (n) - 1; i > -1; i--)
#define rep1(i, n) for(int i = 1; i < (int)(n + 1); i++)
#define rep1R(i, n) for(int i = (n); i > 0; i--)
#define ll long long
using namespace std;

const int V_MAX = 10000;
const int E_MAX = 100000;

struct Edge {
  int source, target, w;
  Edge() {}
  Edge(int source, int target, int w): source(source), target(target), w(w) {}
};

bool operator < (const Edge& e1, const Edge& e2) { return e1.w < e2.w; }

class DisjointSet {
public:
  vector<int> rank, p;

  DisjointSet() {}
  DisjointSet(int size) {
    rank.resize(size, 0);
    p.resize(size, 0);
    for (int i = 0; i < size; i++) makeSet(i);
  }

  void makeSet(int x) {
    p[x] = x;
    rank[x] = 0;
  }

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

  void unite(int x, int y) {
    link(findSet(x), findSet(y));
  }

  void link(int x, int y) {
    if (rank[x] > rank[y]) {
      p[y] = x;
    } else {
      p[x] = y;
      if (rank[x] == rank[y]) {
        rank[y]++;
      }
    }
  }

  int findSet(int x) {
    if (x != p[x]) {
      p[x] = findSet(p[x]);
    }
    return p[x];
  }
};

int V, E;
Edge e[E_MAX + 10];
vector<Edge> K;

void kruskal(int V, int E) {
  sort(e, e + E);
  DisjointSet S = DisjointSet(V);

  rep(i, E) {
    if (S.findSet(e[i].source) != S.findSet(e[i].target)) {
      S.unite(e[i].source, e[i].target);
      K.push_back(e[i]);
    }
  }
}

int main() {
  cin >> V >> E;
  rep(i, E) {
    int s, t, w;
    cin >> s >> t >> w;
    e[i] = Edge(s, t, w);
  }
  kruskal(V, E);
  int result = 0;
  rep(i, K.size()) {
    result += K[i].w;
  }
  cout << result << endl;
  return 0;
}



Measured memory_bytes: 4424
def f(s, t, k):
 n = len(s)
 if k > n: return 0
 a = max(t, int(s[0]))
 if a == 0: return f(s[1:], t, k)
 if k == 1: return a + (n - 1) * 9
 z = 0
 if k - 1 <= n: z += f(s[1:], 9, k)
 z += (a - 1) * f(s[1:], 9, k - 1)
 z += f(s[1:], t, k - 1)
 return z

s = input()
k = int(input())
print(f(s, 0, k))

Measured memory_bytes: 41320
#include "bits/stdc++.h"
using namespace std;
#ifdef _DEBUG
#include "dump.hpp"
#else
#define dump(...)
#endif

//#define int long long
#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define rrep(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define all(c) begin(c),end(c)
const int INF = sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = (int)(1e9 + 7);
template<class T> bool chmax(T &a, const T &b) { if (a < b) { a = b; return true; } return false; }
template<class T> bool chmin(T &a, const T &b) { if (a > b) { a = b; return true; } return false; }

//?????¢??°
//a[i] > a[j] ?????? i < j ??§??????????????°
template <class It>
long long merge(It l, It m, It r) {
	long long cnt = 0;
	vector<int> tmp(r - l);
	It it = tmp.begin(), it1 = l, it2 = m;
	while (it1 != m && it2 != r) {
		if (*it1 < *it2)
			*it++ = *it1++;
		else
			*it++ = *it2++, cnt += m - it1;
	}
	while (it1 != m) *it++ = *it1++;
	while (it2 != r) *it++ = *it2++;
	move(tmp.begin(), tmp.end(), l);
	return cnt;
};

template <class It>
long long merge_sort(It l, It r) {
	if (r - l <= 1)return 0;
	long long cnt = 0;
	It m = l + (r - l) / 2;
	cnt += merge_sort(l, m);
	cnt += merge_sort(m, r);
	cnt += merge(l, m, r);
	return cnt;
}
//end ?????¢??°

signed main() {
	int n; cin >> n;
	vector<int> a(n); rep(i, 0, n) { cin >> a[i]; }
	cout << merge_sort(a.begin(), a.end()) << endl;
	return 0;
}

Measured memory_bytes: 4804
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(ll i = 0, i##_len = (n); i < i##_len; ++i)
#define rep2(i, x, n) for(ll i = x, i##_len = (n); i < i##_len; ++i)
#define all(n) begin(n), end(n)
using ll = long long;
using P = pair<ll, ll>;
using vi = vector<int>;
using vl = vector<ll>;
using vs = vector<string>;
using vc = vector<char>;
using vb = vector<bool>;
using vd = vector<double>;
vi dir = {-1, 0, 1, 0, -1, -1, 1, 1, -1};

int main() {
  ll n, k;
  cin >> n >> k;
  map<ll, ll> mp;
  rep(i, n) {
    ll a, b;
    cin >> a >> b;
    mp[a] += b;
  }
  ll ans;
  k--;
  for(auto v : mp) {
    if(k < v.second) {
      ans = v.first;
      break;
    } else
      k -= v.second;
  }
  cout << ans << endl;
}

Measured memory_bytes: 7456
#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; 
  
// #define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update> 

#define ll long long
#define fill fill_n
#define pf push_front
#define pb push_back
#define FOR(i,l,r) for(int i=l;i<r;i++)
#define ROF(i,r,l) for(int i=r;i>=l;i--)
#define all(v) (v).begin(),(v).end()
#define ff first
#define ss second
typedef vector<int> vi;
typedef vector<ll> vli;
typedef vector<pair<int,int>> vpi;

const int M = 1e9+7;
const int N = 2e5;
ll po(int,int);


void solve(){
    string s = "ACL";
    int k;cin>>k;
    string ans;
    FOR(i,0,k){
        ans += s;
    }
    
    cout<<ans<<"\n";
    

}




int main() {
   
   ios_base::sync_with_stdio(false);
   cin.tie(NULL);cout.tie(NULL);
    
   #ifndef ONLINE_JUDGE 
   freopen("input.txt", "r", stdin);  
   freopen("output.txt", "w", stdout); 
   #endif 

    int t=1;
    //cin>>t;
    FOR(i,1,t+1){
        //cout<<"Case #"<<i<<": "; 
        solve();
        
    }
    
    return 0;
    
    
}


ll po(int a,int b){
    if(b==0) return 1;
    ll ans=1;
    if(b%2==0){
        ans = po(a,b/2)%M;
        ans=(ans%M * ans%M)%M;
    }
    else{
        ans = po(a,(b-1)/2)%M;
        ans = (ans%M * ans%M * a)%M;
    }
    return ans%M;
}



Measured memory_bytes: 3656
#include<iostream>
#include<cstdio>
#include<math.h>
#include<algorithm>
using namespace std;
int main()
{
long long n,p,trap,sums;
long long w,wm=0;
long long t[100000];
long i,j;
cin>>n>>p;
for(i=0;i<n;i++)
{
cin>>w>>t[i];
if(w>wm)
{wm=w;}
}
sort(t,t+n,greater<int>());
j=0;sums=0;
for(i=0;i<n;i++)
{
if(t[i]>=wm)
{sums+=t[i];
j++;}
if(sums>=p)
{
cout<<j;
return 0;
}
}
j+=(p-sums+wm-1)/wm;
cout<<j;
return 0;
}


Measured memory_bytes: 1024
#include <iostream>

using namespace std;

int main(){
  int A, B, count = 0;
  cin >> A >> B;
  for(int i = A; i <= B; ++i){
    int j = 10000, k = 1;
    int a, b = 0;
    bool ok = true;
    while(j > k){
      a = (i / j) % 10;
      b = (i / k) % 10;
      if(a != b){
        ok = false;
        break;
      }
      j /= 10; k *= 10;
    }
    if(ok){
      ++count;
    }
  }
  cout << count << endl;
  return 0;
}


Measured memory_bytes: 384
#include <algorithm>
#include <cmath>
#include <deque>
#include <iostream>
#include <numeric>
#include <queue>
#include <sstream>
#include <string>
#include <string.h>
#include <tuple>
#include <vector>

#define REP(i,x) for(int i{ 0 }; i < (int)(x); i++)
#define REPC(i,x) for(int i{ 0 }; i <= (int)(x); i++)
#define RREP(i,x) for(int i{ (int)(x) - 1 }; i >= 0 ;i--)
#define RREPC(i,x) for(int i{ (int)(x)}; i >= 0; i--)
#define REP1O(i,x) for(int i{ 1 }; i < (int)(x); i++)
#define REP1C(i,x) for(int i{ 1 }; i <= (int)(x); i++)

#define PB push_back
#define MP make_pair
#define F first
#define S second
#define SZ(x) ((int)(x).size())
#define ALL(x) (x).begin(),(x).end()

using namespace std;

typedef int64_t ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vector<int>> vvi;
typedef vector<vector<ll>> vvll;
typedef pair<int, int> pii;
typedef tuple<int, int, int> tupiii;
typedef tuple<ll, ll, ll> tuplll;

const int INTMAX = 2147483647;
const ll LLMAX = 9223372036854775807;
const int MOD = 1000000007;

template<class T> inline bool chmax(T& a, const T& b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, const T& b) { if (b < a) { a = b; return 1; } return 0; }
inline void swap(ll& a, ll& b) { a ^= b; b ^= a; a ^= b; }
inline void swap(int& a, int& b) { a ^= b; b ^= a; a ^= b; }



int main()
{
	string s;
	cin >> s;
	vi cnt(26, 0);

	bool flag = true;

	REP(i, SZ(s))
		++cnt[s[i] - 'a'];

	REP(i, 26)
		if (1 & cnt[i])
			flag = false;

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


Measured memory_bytes: 256
/* ************************************************************************** */
/*                                                                            */
/*                                                        :::      ::::::::   */
/*   main.cpp                                           :+:      :+:    :+:   */
/*                                                    +:+ +:+         +:+     */
/*   By: monoue <marvin@student.42.fr>              +#+  +:+       +#+        */
/*                                                +#+#+#+#+#+   +#+           */
/*   Created: 2020/04/22 12:30:15 by monoue            #+#    #+#             */
/*   Updated: 2020/04/23 16:47:24 by monoue           ###   ########.fr       */
/*                                                                            */
/* ************************************************************************** */

#include <bits/stdc++.h>
#include <boost/multi_array.hpp>
#include <boost/optional.hpp>
#include <boost/range/irange.hpp>
#include <boost/range/algorithm.hpp>
#include <boost/range/adaptors.hpp>
#include <boost/multiprecision/cpp_int.hpp>
#include <boost/algorithm/string/classification.hpp> // is_any_of
#include <boost/algorithm/string/split.hpp>
#include <boost/algorithm/string/join.hpp>
#include <boost/algorithm/string/replace.hpp>
#include <boost/math/tools/minima.hpp>

#define MOD 1e9+7;
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rrep(i, n) for (int i = (n); i >= 0; --i)

namespace adaptor = boost::adaptors;
using namespace std;
using boost::math::tools::brent_find_minima;
using boost::irange;
using boost::algorithm::join;
using boost::algorithm::split;
using boost::algorithm::replace_all;
using boost::multiprecision::cpp_int;
using ll = long long;
using P = pair<int, int>;

// TOP
void	Main()
{
	int	n;
	cin >> n;

	vector<int>	VA(n);
	vector<int>	VB(n);
	rep(i, n)
	{
		int	x;
		cin >> x;

		VA.at(i) = x;
		VB.at(i) = x;
	}
	sort(VB.begin(), VB.end());
	rep(i, n)
	{
		if (VA.at(i) < VB.at(n / 2))
			cout << VB.at(n / 2) << endl;
		else
			cout << VB.at(n / 2 - 1) << endl;
	}

}
// END

int		main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout << fixed << setprecision(15);
	Main();
}


Measured memory_bytes: 3840
// #pragma GCC target ("avx2")
// #pragma GCC optimization ("O3")
// #pragma GCC optimization ("unroll-loops")
#include<bits/stdc++.h>
using namespace std;
#define FastRead ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define int long long int
#define ll int
#define bits_count __builtin_popcountll
#define endl '\n'
#define double long double
#define ld double
#define FOR(i,a,n) for (ll i=(a);i<=(n);++i)
#define RFOR(i,a,n) for (ll i=(n);i>=(a);--i)
#define FI(i,n) for (ll i=0; i<(n); ++i)
#define ZERO(a) memset((a),0,sizeof((a)))
#define MINUS(a) memset((a),-1,sizeof((a)))
#define f first
#define s second
#define pb push_back
#define mk make_pair
#define all(g) g.begin(),g.end()
#define sz(x) (ll)x.size()
#define pr pair<int,int>
int fastMax(int x, int y) { return (((y-x)>>(32-1))&(x^y))^y; }
int fastMin(int x, int y) { return (((y-x)>>(32-1))&(x^y))^x; }

// #include <ext/pb_ds/assoc_container.hpp> // Common file
// #include <ext/pb_ds/tree_policy.hpp>     // Including tree_order_statistics_node_updat
// using namespace __gnu_pbds;
// typedef tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;

const int MAXN = 105;
int a[MAXN];

void solve(){
    int n,m; cin>>n>>m;

    FOR(i,1,n) cin>>a[i];

    int sum = 0;
    FOR(i,1,n) sum += a[i];

    int cnt = 0;

    FOR(i,1,n){
        int val = a[i]*4*m;
        if(val >= sum) cnt++;
    }

    if(cnt >= m) cout<<"Yes\n";
    else cout<<"No\n";
}

signed main(){

   FastRead;    


    int t = 1; 
    // cin>>t;
    FOR(i,1,t){
        // cout<<"Case #"<<i<<": ";
        solve();
    }
}



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

int A0[100], A1[100];
int main()
{
    int N;
    cin >> N;
    int A[2][N];
    rep(i, 2) rep(j, N) cin >> A[i][j];

    int ans = 0;
    ans = A[0][0] + A[1][N - 1];
    //  int A0[N], A1[N];
    A0[0] = 0, A0[1] = A[0][1];
    for (int j = 2; j < N; j++)
    {
        A0[j] = A0[j - 1] + A[0][j];
        //       cout << "A0=" << A0[j] << endl;
    }
    A1[0] = A[1][0];
    for (int j = 1; j < N - 1; j++)
    {
        A1[j] = A1[j - 1] + A[1][j];
        //       cout << "A1=" << A1[j] << endl;
    }

    int rt1 = 0, rt2 = 0, rt3 = 0, rt;
    rt1 = A0[N - 1];
    rt2 = A1[N - 2];
    // cout << "rt1=" << rt1 << endl;
    // cout << "rt2=" << rt2 << endl;

    for (int j = 1; j < N; j++)
    {
        //      cout << A0[j + 1] << " " << A1[N - 2] << " " << A1[j] << endl;
        rt = A0[j + 1] + A1[N - 2] - A1[j];
        //     cout << "rt3=" << rt << endl;
        rt3 = max(rt, rt3);
    }
    cout << ans + max(rt1, max(rt2, rt3)) << endl;

    //  ans += max(A[0][N], A[1][0]);
    //  cout << ans << endl;
}

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

using namespace std;
#ifdef _DEBUG
#define _GLIBCXX_DEBUG
#include "dump.hpp"
#else
#define dump(...)
#endif

#define int long long
#define ll long long
#define DBG 1
#define rep(i, a, b) for (int i = (a); i < (b); i++)
#define rrep(i, a, b) for (int i = (b)-1; i >= (a); i--)
#define loop(n) rep(loop, (0), (n))
#define all(c) begin(c), end(c)
const int INF = sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = (int)(1e9) + 7;
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
using pii = pair<int, int>;
// template<class T> ostream &operator<<(ostream &os,T &t){dump(t);return os;}
template <typename T, typename S>istream &operator>>(istream &is, pair<T, S> &p) { is >> p.first >> p.second; return is; }
//template <typename T, typename S>ostream &operator<<(ostream &os, pair<T, S> &p) {os << p.first << " " << p.second;return os;}

template <typename T> void printvv(const vector<vector<T>> &v) {
	cerr << endl;
	rep(i, 0, v.size()) rep(j, 0, v[i].size()) {
		if (typeid(v[i][j]).name() == typeid(INF).name() and v[i][j] == INF) {
			cerr << "INF";
		}
		else
			cerr << v[i][j];
		cerr << (j == v[i].size() - 1 ? '\n' : ' ');
	}
	cerr << endl;
}

#ifndef _DEBUG
#define printvv(...)
#endif
void YES(bool f) { cout << (f ? "YES" : "NO") << endl; }
void Yes(bool f) { cout << (f ? "Yes" : "No") << endl; }
template <class T, class U>bool chmin(T& a, U b) { if (a > b) { a = b; return true; }return false; }
template <class T, class U>bool chmax(T& a, U b) { if (a < b) { a = b; return true; }return false; }

signed main(signed argc, char *argv[]) {
	cin.tie(0);
	ios::sync_with_stdio(false);
	cout << fixed << setprecision(12);

	int N; cin >> N;
	vector<string>v(N); rep(i, 0, N) { cin >> v[i]; sort(all(v[i])); }

	map<string, int>mp;
	for (auto s : v) { mp[s]++; }

	int ans = 0;
	for (auto p : mp) {
		ans += (p.second - 1)*p.second / 2;
	}

	cout << ans << endl;


	return 0;
}


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

typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> ii;
typedef tuple<ll, ll, ll> iii;
typedef vector<ll> vi;
typedef vector<ii> vii;
typedef vector<iii> viii;
typedef vector<vi> vvi;
typedef vector<vii> vvii;
#define REP(i,n) for (ll i = 0; i < n; ++i)
#define REPR(i,n) for (ll i = n-1; i >= 0; --i)
#define FOR(i,m,n) for (int i = m; i < n; ++i)
#define FORR(i,m,n) for (ll i = n-1; i >= m; --i)
#define FORE(x,xs) for (const auto& x : xs)
#define PB push_back
#define MP make_pair
#define MT make_tuple
#define ALL(v) v.begin(), v.end()

const int MAX = 2e5+10;

int N, A[MAX];
int max1[MAX], max2[MAX];

int main() {
    cin >> N;
    REP (i, N) cin >> A[i];

    FOR (i, 1, N) max1[i] = max(max1[i-1], A[i-1]);
    REPR (i, N-1) max2[i] = max(max2[i+1], A[i+1]);

    REP (i, N) cout << max(max1[i], max2[i]) << endl;
}

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

#define whln(t) while(t--)
#define whlp(t) while(t++)


ll i,j;
int main(){
	#ifndef ONLINE_JUDGE
    // for getting input from input.txt
    freopen("input.txt", "r", stdin);
    // for writing output to output.txt
    freopen("output.txt", "w", stdout);
	#endif
    //ll t ;
    //cin>>t ;
    //whln(t){
    ll a;
    cin>>a ;

    cout<<pow(a,2)+pow(a,3)+a;
    //}
}

Measured memory_bytes: 4084