akhauriyash/Code-Regression huggingface dataset:
//Utkarsh.25dec
#include <bits/stdc++.h>
#include <chrono>
#include <random>
#define ll long long int
#define ull unsigned long long int
#define pb push_back
#define mp make_pair
#define mod 1000000007
#define rep(i,n) for(ll i=0;i<n;i++)
#define loop(i,a,b) for(ll i=a;i<=b;i++)
#define vi vector <int>
#define vs vector <string>
#define vc vector <char>
#define vl vector <ll>
#define all(c) (c).begin(),(c).end()
#define max3(a,b,c) max(max(a,b),c)
#define min3(a,b,c) min(min(a,b),c)
#define deb(x) cerr<<#x<<' '<<'='<<' '<<x<<'\n'
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>
// ordered_set s ; s.order_of_key(val)  no. of elements strictly less than val
// s.find_by_order(i)  itertor to ith element (0 indexed)
typedef vector<vector<ll>> matrix;
ll power(ll a,ll b) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
ll modInverse(ll a){return power(a,mod-2);}
const int N=500023;
bool vis[N];
vector <int> adj[N];
void solve()
{
    string s,t;
    cin>>s>>t;
    ll q;
    cin>>q;
    s='5'+s;
    t='5'+t;
    ll n=s.length(),m=t.length();
    ll cnts[n+10]={0},cntt[m+10]={0};
    for(int i=1;i<=n;i++)
    {
        cnts[i]=cnts[i-1];
        if(s[i]=='A')
            cnts[i]++;
    }
    for(int i=1;i<=m;i++)
    {
        cntt[i]=cntt[i-1];
        if(t[i]=='A')
            cntt[i]++;
    }
    while(q--)
    {
        ll p,q,r,s;
        cin>>p>>q>>r>>s;
        ll firsta=cnts[q]-cnts[p-1];
        ll firstb=q-p+1-firsta;
        ll flag1=(firstb*2+firsta)%3;
        ll seconda=cntt[s]-cntt[r-1];
        ll secondb=s-r+1-seconda;
        ll flag2=(seconda+secondb*2)%3;
        if(flag1==flag2)
            cout<<"YES\n";
        else
            cout<<"NO\n";
    }
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int T=1;
    //cin>>T;
    int t=0;
    while(t++<T)
    {
        //cout<<"Case #"<<t<<":"<<' ';
        solve();
        //cout<<'\n';
    }
    cerr << "Time : " << 1000 * ((double)clock()) / (double)CLOCKS_PER_SEC << "ms\n";
}

Measured memory_bytes: 14188
#include <iostream>

#include <algorithm>
#include <cmath>
#include<string>
#include<array>
#include<vector>
#include<functional>
#include<unordered_map>
#include<map>
#include<numeric>
#include<limits>
#include<utility>
#include<queue>
#include<random>

using namespace std;
typedef long long LL;

int main() {

	
	int a;
	//----------------------
	int n, X,Z;
	int ans = 0;



	cin >> n >> X;

	if (n % 500 <= X) {
	

		cout <<"Yes" << endl;
	
	}
	else cout << "No" << endl;


	//vector<int> items;
	//vector<int> set;

	//for (int i = 0; i < n; i++) {

		//cin >> a;

		//items.emplace_back(a);

	//}

	


//------------------------
		//cin >> Z;
	
	return 0 ;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <sstream>
#include <cmath>
#include <vector>
#include <map>
#include <set>
#include <algorithm>
#include <numeric>
using namespace std;
typedef long long LL;
LL i,j,k,n,m;
LL mod=1000000007;
string s;

int main() {
  cin >> n >> k;
  vector<LL> v(n);
  for (i=0;i<n;++i) {
    cin >> v[i];
  }
  sort(v.begin(),v.end());
  vector<LL> vd(n-k+1);
  for (i=0;i<n-k+1;++i) {
    vd[i] = v[i+k-1] - v[i];
  }
  auto min = *min_element(vd.begin(),vd.end());
  cout << min << endl;
  return 0;
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
 
typedef long long ll;
#define fi first
#define se second
#define SORT(a) sort(a.begin(),a.end())
#define REP(i,n) for (int i = 0;i < (n) ; i++) 
#define MP(a,b) make_pair(a,b)
 
using namespace std;
 
int main(){
    
    int n;
    cin >> n;

    int a;
    cin >> a;
    int ans = 0;
    for(int i = 0;i<n-1;i++){
        int b;
        cin >> b;
        if(a == b) {
            ans++;
            i++;
            cin >> a;
        }else{
            a = b;
        }
        
    }
    cout << ans;
 
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int n,k;
const int maxn=1e5+7;
int h[maxn];
bool cmp(int a,int b){
	return a>b;
}
int main()
{
	cin>>n>>k;
	for(int i=0;i<n;i++){
		cin>>h[i];
	}
	sort(h,h+n,cmp);
	int ans=0;
	for(int i=0;i<n;i++){
		if(h[i]>=k) ans++;
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 640
fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}

fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    read::<String>().split_whitespace()
        .map(|e| e.parse().ok().unwrap()).collect()
}

fn read_vec2<T: std::str::FromStr>(n: u32) -> Vec<Vec<T>> {
    (0..n).map(|_| read_vec()).collect()
}

fn main() {
    let n = read::<u8>();
    let s = read::<String>();
    let bytes = s.as_bytes();
    // let mut ss = s.as_mut_str();
    for i in bytes {
        let mut cb = i+n;
        if cb > b'Z' {
            cb = cb-26;
        }
        print!("{}", cb as char);
    }
    println!("");
}


Measured memory_bytes: 4352
#include <cstdio>

const int MAXN = 1e3+3;
const int MOD = 1e9+7;

int add(int x, int y, int mod = MOD) {
  return (x+y) % mod;
}

int h, w;
int dp[MAXN][MAXN];
char C[MAXN][MAXN];

int main() {
  scanf("%d%d", &h, &w);
  for (int i = 0; i < h; ++i) {
    scanf("%s", C[i]);
  }

  dp[0][0] = 1;
  for (int i = 1; i < w; ++i) {
    if (C[0][i-1] == '#') continue;
    if (C[0][i] == '#') continue;
    dp[0][i] = add(dp[0][i], dp[0][i-1]);
  }
  for (int i = 1; i < h; ++i) {
    if (C[i-1][0] == '#') continue;
    if (C[i][0] == '#') continue;
    dp[i][0] = add(dp[i][0], dp[i-1][0]);
  }

  for (int i = 1; i < h; ++i) {
    for (int j = 1; j < w; ++j) {
      if (C[i][j] == '#') continue;
      if (C[i-1][j] != '#') dp[i][j] = add(dp[i][j], dp[i-1][j]);
      if (C[i][j-1] != '#') dp[i][j] = add(dp[i][j], dp[i][j-1]);
    }
  }

  printf("%d\n", dp[h-1][w-1]);
  return 0;
}


Measured memory_bytes: 5120
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		new Main().solveA();
		// new Main().solveB();
		// new Main().solveC();
		// new Main().solveD();
	}

	private void solveA() {
		Scanner scanner = null;
		String wk = "";

		try {
			scanner = new Scanner(System.in);
			wk = scanner.next();

			System.out.println(wk.replaceAll(",", " "));

		} finally {
			if (scanner != null) {
				scanner.close();
			}
		}
	}

	private void solveB() {
		Scanner scanner = null;
		int lineAB = 0;
		int lineBC = 0;
		int lineCA = 0;

		try {
			scanner = new Scanner(System.in);
			lineAB = scanner.nextInt();

			System.out.println("");

		} finally {
			if (scanner != null) {
				scanner.close();
			}
		}
	}

	private void solveC() {
		Scanner scanner = null;
		int lineAB = 0;
		int lineBC = 0;
		int lineCA = 0;

		try {
			scanner = new Scanner(System.in);
			lineAB = scanner.nextInt();

			System.out.println("");

		} finally {
			if (scanner != null) {
				scanner.close();
			}
		}
	}

	private void solveD() {
		Scanner scanner = null;
		int lineAB = 0;
		int lineBC = 0;
		int lineCA = 0;

		try {
			scanner = new Scanner(System.in);
			lineAB = scanner.nextInt();

			System.out.println("");

		} finally {
			if (scanner != null) {
				scanner.close();
			}
		}
	}
}

Measured memory_bytes: 25172
#include <iostream>
#include<queue>
#include<vector>
#include<set>
#include<map>
#include<algorithm>
#include<cstring>
#include<string>
#include<cassert>
#include<cmath>
#include<climits>
#include<iomanip>
#include<bitset>
#include<unordered_map>

using namespace std;

#define MOD 1000000007
#define REP(i,n) for(ll (i)=0;(i)<(n);(i)++)
#define rep(i,j,n) for(ll (i)=(j);(i)<(n);(i)++)
#define FOR(i,c) for(decltype((c).begin())i=(c).begin();i!=(c).end();++i)
#define ll long long
#define ull unsigned long long
#define all(hoge) (hoge).begin(),(hoge).end()
typedef pair<ll, ll> P;
const long long INF = 1LL << 60;
typedef vector<ll> Array;
typedef vector<Array> Matrix;


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

//グラフ関連
struct Edge {//グラフ
	ll to, cap, rev;
	Edge(ll _to, ll _cap, ll _rev) {
		to = _to; cap = _cap; rev = _rev;
	}
};
typedef vector<Edge> Edges;
typedef vector<Edges> Graph;

void add_edge(Graph& G, ll from, ll to, ll cap, bool revFlag, ll revCap) {
	G[from].push_back(Edge(to, cap, (ll)G[to].size()));
	if (revFlag)G[to].push_back(Edge(from, revCap, (ll)G[from].size() - 1));
}

class SumSegTree {
private:

	int _sum(int a, int b, int k, int l, int r) {
		if (r <= a || b <= l)return 0;    // 交差しない
		if (a <= l && r <= b)return dat[k];   // a,l,r,bの順で完全に含まれる
		else {
			int s1 = _sum(a, b, 2 * k + 1, l, (l + r) / 2); // 左の子
			int s2 = _sum(a, b, 2 * k + 2, (l + r) / 2, r); // 右の子
			return s1 + s2;
		}
	}
public:
	int n, height;
	vector<int> dat;

	// 初期化（_nは最大要素数）
	SumSegTree(int _n) {
		n = 1;
		height = 1;
		while (n < _n) {
			n *= 2;
			height++;
		}
		dat = vector<int>(2 * n - 1, 0);
	}

	// 場所i(0-indexed)にxを足す
	void add(int i, int x) {
		i += n - 1; // i番目の葉ノードへ
		dat[i] += x;
		while (i > 0) { // 下から上がっていく
			i = (i - 1) / 2;
			dat[i] += x;
		}
	}

	// 区間[a,b)の総和。ノードk=[l,r)に着目している。
	int sum(int a, int b) {
		return _sum(a, b, 0, 0, n);
	}
};

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

	ll n;
	cin >> n;
	Graph g(n);
	REP(i, n - 1) {
		ll a, b;
		cin >> a >> b;
		a--; b--;
		add_edge(g, a, b, 1, true, 1);
	}

	queue<pair<ll,ll>> que;
	Array con(2, 0);
	Array used(n, false);

	que.push(make_pair(0, 0));
	que.push(make_pair(n-1, 1));
	while (que.size() > 0) {
		ll v=que.front().first;
		ll co = que.front().second;
		con[co]++;
		que.pop();
		for (auto e : g[v]) {
			if (!used[e.to]) {
				que.push(make_pair(e.to, co));
				used[e.to] = true;
			}
		}
	}

	if (con[0] > con[1]) {
		cout << "Fennec" << endl;
	}
	else {
		cout << "Snuke" << endl;
	}


	return 0;
}

Measured memory_bytes: 9856
/// In the name of ALLAH
/// I'm THEOVE46
#include<bits/stdc++.h>
using namespace std;

#define gap             " "
#define nn              "\n"
#define pi              2*acos(0.0)
#define db              double
#define ft              float
#define ll              long long
#define ull             unsigned long long
#define pf              printf
#define sf              scanf
#define ff              first
#define ss              second
#define sc(n)           sf("%d",&n)
#define sc2(n, m)       sf("%d%d",&n,&m);
#define scl(n)          sf("%lld",&n)
#define scl2(n, m)      sf("%lld%lld",&n,&m);
#define pc(n)           pf("%d",n)
#define scf(f)          sf("%f",&f)
#define pcf(f)          pf("%f",f)
#define bfs             cin.get()
#define bfc             getchar()
#define gl(s)           getline(cin, s);
#define loop(a,n)       for(ll i=a; i<n; i++)
#define rloop(a,n)      for(ll i=a; i>n; i--)
#define tloop(test)     for(ll tl=1; tl<=test; tl++)
#define case1(z)        cout<<"Case "<<z<<": "
#define case2(z)        printf("Case %d: ",z)
#define vi              vector<int>
#define vl              vector<ll>
#define vld(vc,rw)      vector<vector<ll> >vc(rw)
#define pii             pair<int,int>
#define pll             pair<ll,ll>
#define pis             pair<int,string>
#define psi             pair<string,int>
#define mls             map <ll,string>
#define msl             map <string,ll>
#define mll             map <ll,ll>
#define mp              make_pair
#define pb              push_back
#define itr             vector<int> :: iterator
#define sz(s)           s.size()
#define sl(s)           s.length()
#define Sort(s)         sort(s.begin(), s.end());
#define SortR(s)        sort(s.rbegin(), s.rend());
#define all(x)          x.begin(),x.end()
#define rall(x)         x.end(), x.begin()
#define MEM(ar,val)     memset(ar, (val), sizeof(ar))
#define IN(A,B,C)       assert(B<=A && A<=C)
#define EPS             1e-9
#define bug1            "**1**"
#define bug2            "****2****"
#define artri(b,h)      0.5*b*h
#define artrap(b1,b2,h) (b1+b2)/2*h
#define arcrl(r)        pi*r*r
#define vlsyl(r,h)      pi*r*r*h
#define vlcone(r,h)     pi*r*r*(h/3)
#define vlsph(r)        (4/3)*pi*r*r*r
#define flush           fflush(stdout);
#define pcn(dg,val)     fixed << setprecision(dg) << val
#define fap(x)          cout << __LINE__ << " says: " << #x << " = " << x << "\n"
#define FastIO          ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define showsort(n, a)  for(int i=0; i<n; i++) cout << a[i] << gap; cout << endl;

///THEOVE46

int main()
{
    FastIO;
    ll n, k, x=0, i;
    cin >> n >> k;
    ll a[n];
    for(i=0; i<n; i++)
        cin >> a[i];
    sort(a, a+n);
    for(i=0; i<k; i++)
        x+=a[i];
    cout << x << endl;
    return 0;
}

///   check for integer overflow, array bounds
///   check for n=1
///   - - - The Ove 46



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

using namespace std;
const int INF = 1000 * 1000 * 1000;
int main()
{
long long int n,d,a;
cin >> n >> d >> a;
vector <pair<long long int,long long int>> xa(n);
for (int i=0; i<n; i++)
    {   cin >> xa[i].first >> xa[i].second;
       //xa[i].second =  (xa[i].second+a-1)/a;
    }

sort(xa.begin(),xa.end());
//for (int i=0; i<n; i++) cout << xa[i].first << "\n"[i!=n-1];

vector<long int> mark(n+1);

long long tmp = 0;
long long count = 0;

for (int i=0; i<n; i++)
    {
        xa[i].second -= tmp;
            if (xa[i].second>0)
                {
                    long long need = (xa[i].second + a - 1) /a;
                    tmp+=need*a;
                    count+=need;
                    //count+=need;

                    int l=i, r= n;
                    while (l<r-1)
                    {
                        int md = (l+r)>>1;
                        if (xa[i].first + 2* d >=xa[md].first)
                                l = md; else r= md;
                    }

                    mark[l]+=need*a;
                }
        tmp-=mark[i];
    }

//for (int i=0; i<n; i++) cout << mark[i] <<"\n"[i!=n-1];

cout << count;
}

/*
3 3 2
1 2
5 4
9 2

2

9 4 1
1 5
2 4
3 3
4 2
5 1
6 2
7 3
8 4
9 5

5

3 0 1
300000000 1000000000
100000000 1000000000
200000000 1000000000
300000000
*/


Measured memory_bytes: 4992
#include <stdio.h>
#define MAX 100000
#define INF 1e10

struct Card {
    char suit;
    int value;
};

void merge(struct Card A[], int left, int mid, int right) {
    int k;
    int n1 = mid - left;
    int n2 = right - mid;
    
    struct Card L[n1+1], R[n2+1];
    for(int i=0; i<n1; i++) L[i] = A[left + i];
    for(int i=0; i<n2; i++) R[i] = A[mid + i];
    L[n1].value = R[n2].value = INF;
    
    int i=0, j=0;
    for (int k=left; k<right; k++) {
        if (L[i].value <= R[j].value) {
            A[k] = L[i];
            i++;
        } else {
            A[k] = R[j];
            j++;
        }
    }
}

void mergeSort(struct Card *A, int left, int right) {
    if(left+1 < right) {
        int mid = (left+right)/2;
        mergeSort(A, left, mid);
        mergeSort(A, mid, right);
        merge(A, left, mid, right);
    }
}

int partition(struct Card *A, int p, int r) {
    struct Card x;
    x = A[r];
    int i = p-1;
    for (int j=p; j<r; j++) {
        if(A[j].value <= x.value) {
            i++;
            struct Card tmp=A[i];
            A[i] = A[j];
            A[j] = tmp;
        }
    }
    struct Card tmp;
    tmp = A[i+1];
    A[i+1] = A[r];
    A[r] = tmp;
    
    return i+1;
}

void quickSort(struct Card A[], int p, int r) {
    int q;
    if(p<r) {
        q = partition(A, p, r);
        quickSort(A, p, q-1);
        quickSort(A, q+1, r);
    }
}

int main() {
    int n, v;
    struct Card A[MAX], B[MAX];
    char S[10];
    int stable = 1;
    
    scanf("%d", &n);
    
    for (int i=0; i<n; i++) {
        scanf("%s %d", S, &v);
        A[i].suit = B[i].suit = S[0];
        A[i].value = B[i].value = v;
    }
    
    mergeSort(A, 0, n);
    quickSort(B, 0, n-1);
    
    for (int i=0; i<n; i++) {
        if(A[i].suit != B[i].suit) stable=0;
    }
    
    if(stable==1) printf("Stable\n");
    else printf("Not stable\n");
    for (int i=0; i<n; i++) {
        printf("%c %d\n", B[i].suit, B[i].value);
    }

    return 0;
}


Measured memory_bytes: 5032
#include <stdio.h>
#include <iostream>
#include <math.h>
#include <string>
#include <vector>
#include <algorithm>
#include <map>

using namespace std;
#define ll long long
#define pb push_back


int main()
{
    // 不等号の＝
    // firstとsecond 
    vector<string> x;
    while (1)
    {
        int n;
        cin >> n;
        if (n == 0)
        {
            break;
        }

        vector<pair<int, char> >  candidate(26); // 候補者　：　投票数
        vector<pair<int, char> > copy_cand(26);
        char str[100];
        char ctmp = 'A',c;

        for(int i=0; i< 26; i++){
            candidate[i] = make_pair(0,ctmp);
            ctmp++;
        }
        
        for(int k=0; k<n;k++){
            cin >> c;
            int char_num = (int)c - 'A';
            // cout << char_num << endl;
            candidate[char_num].first++;
            copy(candidate.begin(),candidate.end(),copy_cand.begin());
            sort(copy_cand.begin(),copy_cand.end());
            // cout << copy_cand[25].second << " " << copy_cand[25].first << copy_cand[24].second << " " << copy_cand[24].first << endl;
            if(copy_cand[25].first>copy_cand[24].first+(n-k-1)){
                sprintf(str,"%c %d",copy_cand[25].second,k+1);
                for(int i=k+1; i<n;i++){
                    cin >> c; // 余った分の入力を受け付ける
                }
                k = n;
            }
            if(k==n-1){
                sprintf(str,"TIE");
            }
            }
         x.push_back(str);        
    }
    for (int i = 0; i < x.size(); i++)
    {
        cout << x[i] << endl;
    }
}



Measured memory_bytes: 3384
//2*10^9
//9*10^18
// __int128_t 
#include<bits/stdc++.h>
using namespace std;

#define ull unsigned long long int
#define ll long long int

const ll M=1e9+7;

//to handle when remainder is -neg we add + M
//but when rem is +pos that time also we add so use %M
//so it will work for both
ll mod(ll n){
    return (n%M + M)%M; 
}
ll modAdd(ll a, ll b){
    return mod(mod(a)+mod(b));
}
ll modMul(ll a, ll b){
    return mod(mod(a)*mod(b));
}
ll modMinus(ll a, ll b){
    return mod(mod(a)-mod(b));
}
ll modpow(ll x, ll n) 
{ 
    if (n == 0) 
        return 1%M;
    if (n == 1)
        return x%M; 
    ll u = modpow(x,n/2); 
    u = modMul(u,u); 
    if (n%2) 
        u = modMul(u,x); 
    return u; 
}
ll gcd(ll a,ll b){
    if(b==0)
        return a;
    return gcd(b,a%b);
}
bool isPrime(ll n){
    int end = sqrt(n);
    for(int i=2;i<=end;i++)
        if(n%i==0)
            return false;
    return true;
}
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    
   
    
    int t=1;
    //cin>>t;
    
    while(t--){
       string data;
       cin>>data;

        if(data[data.length()-1]!='s')
            data.append("s");
        else
            data.append("es");

        cout<<data<<endl;
    }
    return 0;
}

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

using namespace std;

#define int long long
#define endl "\n"

constexpr long long INF = (long long)1e18;
constexpr long long MOD = 1'000'000'007; 

string yn(bool f){return f?"Yes":"No";}
string YN(bool f){return f?"YES":"NO";}



signed main(){
	cin.tie(nullptr);
	ios::sync_with_stdio(false);
	cout<<fixed<<setprecision(10);
	
	int H, N;
	int sum = 0;
	
	cin>>H>>N;
	
	for(int i = 0; i < N; i++){
		int A;
		cin>>A;
		sum += A;
	}
	
	if(sum >= H) cout<<"Yes"<<endl;
	else cout<<"No"<<endl;
	
	
	return 0;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

const int Max = 1000000;
bool P[Max];

void eratos()
{
	for( int i = 0;i < Max;i++ ) P[i] = true;

	P[0] = P[1] = false;

	for( int i = 0;i < Max;i++ ) if( P[i] == true ) for( int j = 2;i * j < Max;j++ ) P[i * j] = false;
}


int main(int argc, char const* argv[])
{
	int n;

	eratos();

	while( cin >> n && n != 0 ){
		int count = 0;

		for( int i = 2;i <= n/2;i++ ) if( P[i] ) if( P[n - i] ) count++;

		cout << count << endl;
	}
	return 0;
}

Measured memory_bytes: 0
def tax8(n):
    return list(range(int((n-1)*(25/2)),int((n+1)*(25/2))))
    
def tax10(n):
    return list(range(int((n-1)*(10/1)),int((n+1)*(10/1))))

a , b = map(int,input().split())

ans = -1

x = []

x.extend(tax8(a))
        
y = []

y.extend(tax10(b))

for i in x:
    if i in y:
        if int(i*(27/25))-i == a and int(i*(11/10))-i == b:
            ans = i
            break
    
print(ans)

Measured memory_bytes: 3064
#include<bits/stdc++.h>
#define rep(i,m) for(long long i=0; i<m; i++)
#define per(i,m) for(long long i=m-1; i>=0; i--)
#define FOR(i,n,m) for(long long i=n; i<m; i++)
#define ROF(i,n,m) for(long long i=n-1; i>=m; i--)
#define all(x) (x).begin(),(x).end()
#define EPS (1e-7)
#define INF (1e18)
#define PI (acos(-1))
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
using namespace std;
typedef long long ll;
const ll MOD = 1000000007;
typedef pair<ll, ll> LP;

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

ll gcd(ll u, ll v) {
  ll r;
  while (0 != v) {
    r = u % v; u = v; v = r;
  }
  return u;
}
 
ll KAI(ll m)
{
  if(m<0) return 0;
  if(m==0) return 1;
  return m*KAI(m-1)%MOD;
}
 
ll extGCD(ll a, ll b, ll &x, ll &y) {
    if (b == 0) {
        x = 1;
        y = 0;
        return a;
    }
    ll d = extGCD(b, a%b, y, x);
    y -= a / b * x;
    return d;
}
 
inline ll mod(ll a, ll m) {
    return (a % m + m) % m;
}
 
ll modinv(ll a) {
    ll x, y;
    extGCD(a, MOD, x, y);
    return mod(x, MOD);
}
 
ll COM(ll m,ll n)
{
  if(m<n) return 0;
  if(n<0) return 0;
  if(n==0) return 1;
  if(m==n) return 1;
  return KAI(m)%MOD*modinv(KAI(n)%MOD*KAI(m-n)%MOD)%MOD;
}

ll DEC(ll x,ll m,ll n)
{
  return x%POW(m,n+1)/POW(m,n);
}

ll keta(ll x,ll n)
{
  if(x==0)return 0;
  return keta(x/n,n)+1;
}

ll DIV(ll x,ll n)
{
  if(x==0)return 0;
  return x/n+DIV(x/n,n);
}


int main()
{
  string s;
  int a;
  cin >> s;
  a=s.length();
  cout << s[0];
  printf("%d",a-2);
  cout << s[a-1];
}

Measured memory_bytes: 256
//Tariquzzaman Faisal
//_Faisal101_
//IUT_CSE'19
//190041101

#include<iostream>
#include<stdio.h>
#include<vector>
#include<deque>
#include<map>
#include<stack>
#include<queue>
#include<algorithm>
#include<cstring>
#include<climits>
#include<cmath>
#include<iterator>
#define mp make_pair
#define pb push_back
#define pb push_back
#define fileOut freopen("out.txt","w",stdout)
#define fileIn freopen("in.txt","r",stdout)
#define testcases ll tc,t; cin >> tc; for(t=1; t<=tc; t++)
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL)
#define pi acos(-1.0)
#define ll long long

using namespace std;

ll ara[200010];

int main(){
	
	ll n, temp;
	cin >> n;
	for (ll i = 0; i < n-1; i++)
	{
		cin >> temp;
		ara[temp]++;
	}
	for (ll i = 1; i <= n; i++)
	{
		cout<< ara[i] << endl;
	}
	
return 0;
}

Measured memory_bytes: 5136
import sys
input=sys.stdin.readline
cha=[0,2,4,6,8,1,3,5,7,9]
m=int(input())
ans=0
l=[]
for _ in range(m):
    d,c=map(int,input().split())
    while c>1:
        if c%2:
            c-=1
            l.append(d)
        c//=2
        ans+=c if d<5 else c*2
        d=cha[d]
    l.append(d)

k=len(l)
while k>1:
    a=l.pop()
    b=l.pop()
    x=a+b
    ans+=1
    if x>9:
        s=str(x)
        l.append(int(s[0]))
        l.append(int(s[1]))
    else:
        l.append(x)
        k-=1
print(ans)


Measured memory_bytes: 138596
// Math = ♥️

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

#define ll long long
#define ld long double
typedef pair<ll, ll> ii;
typedef vector<ll> vi;
typedef vector<vi> vvi;
typedef vector<ii> vii;
typedef vector<vii> vvii;
#define pq priority_queue
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define all(c) (c).begin(), (c).end()
#define ordered_set                            \
    tree<ll, null_type, less<ll>, rb_tree_tag, \
         tree_order_statistics_node_update>

int main(void) {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    ll n, m;
    cin >> n >> m;

    vi arr(n);
    ll sum = 0;
    for (int i = 0; i < n; i++) {
        cin >> arr[i];
        sum += arr[i];
    }
    ll check = (ll)(ceil((ld)(sum) / ((ld)(4) * (ld)(m))));

    for (auto it : arr) {
        if (it >= check) {
            m--;
        }
    }

    if (m <= 0) {
        cout << "Yes\n";
    } else {
        cout << "No\n";
    }
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define F(i,a,b) for(int i=(a);i<=(b);++i)
#define F2(i,a,b) for(int i=(a);i<(b);++i)
#define dF(i,a,b) for(int i=(a);i>=(b);--i)
#define dF2(i,a,b) for(int i=(a);i>(b);--i)
#define dF3(i,a,b) for(int i=(a)-1;i>=(b);--i)
using namespace std;typedef long long ll;typedef double ld;int INF=0x3f3f3f3f;int INF2=0x7fffffff;ll LNF=0x3f3f3f3f3f3f3f3f;ll LNF2=0x7fffffffffffffff;

int n;
ll a[200001],a1[200001],a2[200001];
int id[200001];
int dat[524289],dat1[524289],dat2[524289];
ll Sum;
int m(ll*arr,int p1,int p2){return arr[p1]<arr[p2]?p1:p2;}
void build(int i,int l,int r){
	if(l==r) {id[l]=i; return;}
	int mid=l+r>>1; build(i<<1,l,mid), build(i<<1|1,mid+1,r);
}
void Mod(int p,ll x){
	a[p]=x; a1[p]=x-p; a2[p]=x+p;
	dat[id[p]]=dat1[id[p]]=dat2[id[p]]=p;
	for(int i=id[p]>>1;i;i>>=1) dat[i]=m(a,dat[i<<1],dat[i<<1|1]), dat1[i]=m(a1,dat1[i<<1],dat1[i<<1|1]), dat2[i]=m(a2,dat2[i<<1],dat2[i<<1|1]);
}
int Qur1(int i,int l,int r,int a,int b){
	if(b<l||r<a) return 0; if(a<=l&&r<=b) return dat1[i];
	int mid=l+r>>1; return m(a1,Qur1(i<<1,l,mid,a,b),Qur1(i<<1|1,mid+1,r,a,b));
}
int Qur2(int i,int l,int r,int a,int b){
	if(b<l||r<a) return 0; if(a<=l&&r<=b) return dat2[i];
	int mid=l+r>>1; return m(a2,Qur2(i<<1,l,mid,a,b),Qur2(i<<1|1,mid+1,r,a,b));
}
int main(){
	memset(a,0x3f,sizeof a);
	memset(a1,0x3f,sizeof a1);
	memset(a2,0x3f,sizeof a2);
	int q,A,B,lst,now;
	scanf("%d%d%d%d%d",&n,&q,&A,&B,&lst);
	build(1,1,n);
	Mod(A,abs(B-lst));
	Mod(B,abs(A-lst));
	F(i,2,q){
		scanf("%d",&now);
		int tmp1=Qur1(1,1,n,1,now),tmp2=Qur2(1,1,n,now,n);
		ll k=min(a1[tmp1]+now,a2[tmp2]-now)-abs(now-lst);
		Sum+=abs(now-lst);
		if(a[lst]>k) Mod(lst,k);
		lst=now;
	}
	printf("%lld",a[dat[1]]+Sum);
	return 0;
}

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

using namespace std;


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

// flip pair
template <typename A, typename B>
pair<B, A> flip_pair(pair<A, B> src) {
	return pair<B, A> (src.second, src.first);
}

// flip map
template <typename A, typename B>
multimap<B, A> flip_map(map<A, B> src) {
	multimap<B, A> dst;
	for(auto it = src.begin(); it != src.end(); ++it) {
		auto a = flip_pair(*it);
		dst.insert(a);
	}
	return dst;
}

// get frequency mapping from vector
template <typename Tval>
multimap<int, Tval> freq(vector<Tval> src) {
	map<Tval, int> counter;
	for(auto it = src.begin(); it != src.end(); ++it) {
		auto it2 = counter.find(*it);
		if(it2 != counter.end()) counter[*it]++;
		else counter[*it] = 1;
	}
	auto dst = flip_map(counter);
	return dst;
}

int main(){
	
	int age;
	int A, B;
	cin>>age;
	if(age==1) cout<<"Hello World";
	else {
		cin>>A>>B;
		printf("%d", A+B);
	}
}



Measured memory_bytes: 256
#include<bits/stdc++.h> 
using namespace std;
int main(){
	long long int n,a,b,i;
	cin>>n>>a>>b;
	//if(a==0&&b==0) cout<<"0";
//	else{
	if(n%(a+b)<a) i=n%(a+b);
	else i=a;  
	cout<<n/(a+b)*a+i;
    //}
	return 0; 
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
#define _overload3(_1,_2,_3,name,...)name
#define _rep(i,n)repi(i,0,n)
#define repi(i,a,b)for(int i=int(a),i##_len=(b);i<i##_len;++i)
#define MSVC_UNKO(x)x
#define rep(...)MSVC_UNKO(_overload3(__VA_ARGS__,repi,_rep,_rep)(__VA_ARGS__))
#define all(c)c.begin(),c.end()
#define write(x)cout<<(x)<<'\n'
using namespace std; typedef long long ll; template<class T>using vv = vector<vector<T>>;
template<class T>auto vvec(int n, int m, T v) { return vv<T>(n, vector<T>(m, v)); }
constexpr int INF = 1 << 29, MOD = int(1e9) + 7; constexpr ll LINF = 1LL << 60;
struct aaa { aaa() { cin.tie(0); ios::sync_with_stdio(0); cout << fixed << setprecision(10); }; }aaaa;

int main() {
    int N;
    cin >> N;
    vector<int> X(N);
    rep(i, N) cin >> X[i];
    ll ans = LINF;
    rep(x, 1, 101) {
        ll tmp = 0;
        rep(i, N) tmp += (X[i] - x) * (X[i] - x);
        ans = min(ans, tmp);
    }
    write(ans);
}

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

int main(){
    int n,m,c;
    cin>>n>>m>>c;
    int a[m],b[m];
    for(int i=0;i<m;i++){
        cin>>b[i];
    }
    int cnt=0,sum=0;
    for(int i=0;i<n;i++){
        sum=0;
        for(int j=0;j<m;j++){
            cin>>a[j];
            sum+=a[j]*b[j];
        }
        if(sum+c>0) cnt++;
    }

    cout<<cnt;


}

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

// M A F I A - M A F I A - M A F I A - M A F I A - M A F I A - M A F I A //

#define int                                       long long
#define lop(i,s,e)                                for(int i=s;i<(int)e;i++)
#define rlop(i,e,s)                               for(int i=e;i>=s;i--)
#define prvec(v)                                  lop(R15,0,v.size())cout << v[R15] <<" "; cout << endl;
#define prarr(arr,s1,e1)                          lop(R15,s1,e1)cout << arr[R15] << " "; cout << endl;

#define endl                                      '\n'
#define ff                                        first
#define ss                                        second
#define pii                                       pair<int,int>

#define pb                                        push_back
#define all(v)                                    v.begin(),v.end()

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

// M A F I A - M A F I A - M A F I A - M A F I A - M A F I A - M A F I A //

const int N = 3e6 + 7, M = 1000000007, inf = INT_MAX;
const long long INF = LLONG_MAX;

int n, Q;
int arr[N + 2], dp[N];

int pwrmod(int a, int b)
{
	int mod = M;
	int res = 1; a %= mod;
	while (b)
	{
		if (b & 1) res = (1LL * res * a) % mod;
		a = (1LL * a * a) % mod;
		b >>= 1;
	}
	return res;
}

inline int mul(int a, int b) { return (a * b) % M; };
inline int add(int a, int b)
{
	int res = a + b;
	if ( res < 0 ) res += M;
	if ( res >= M) res -= M;
	return res;
}

void solve()
{
	int k;
	cin >> n >> k;

	rlop(i, k, 1)
	{
		int el = k / i;
		if (el <= 0) continue;
		dp[i] = pwrmod(el, n);
		// bug(i, el);
		for (int j = 2 * i; j <= k; j += i) {
			dp[i] = add(dp[i], -dp[j]);
		}
		// bug(dp[i]);
	}

	int ans = 0;
	lop(i, 1, k + 1)
	{
		ans = add(ans, mul(dp[i] , i));
	}

	cout << ans;

}

int32_t main()
{
	ios_base::sync_with_stdio(0);   cin.tie(0);   cout.tie(0);

	int test = 1;
	// cin >> test;

	// cout << setprecision(9) << fixed;
	// clock_t z = clock();
	while (test--)solve();
	// cerr << "Run Time : " << ((double)(clock() - z) / CLOCKS_PER_SEC);
}





Measured memory_bytes: 4392
#include<iostream>
#include<stdio.h>
#include<algorithm>
#include<vector>
#include<queue>
#include<string>
#include<cstdlib>
#include<numeric>
#include<cmath>

using namespace std;

#define MAX_V 100001
#define INF (1e9 + 1)
#define REP(i,n) for(long long int (i)=0;(i) < (n);(i)++)
#define REV(i,n) for(long long int (i)=(n-1);(i) > -1;(i)--)

int N;
int S[101];


int main(){
  cin >> N;
  REP(i,N) cin >> S[i];
  int total = accumulate(S,S+N,0);
  if(total % 10 != 0){
    cout << total << endl;
    return 0;
  }
  sort(S,S+N);
  int min_index = -1;
  REP(i,N){
    if(S[i] % 10 != 0){
      min_index = i;
      break;
    }
  }
  if(min_index==-1){
    cout << 0 << endl;
    return 0;
  }
  else{
    cout << total - S[min_index] << endl;
    return 0;
  }

  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
int main(){
  int n,k,h[100001]={},m=1001001001;
  std::cin>>n>>k;
  for(int i=0;i!=n;++i)std::cin>>h[i];
  std::sort(h, h+n);
  for(int i=0;i+k-1<n;++i)m=(h[i+k-1]-h[i]<m?h[i+k-1]-h[i]:m);
  std::cout<<m<<"\n";
}

Measured memory_bytes: 640
#include <iostream>
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
#define MAXSIZE 10000000;

bool comp(const pair<int,int> a, const pair<int,int> b) {
    return a.second < b.second;
}

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

const int MAX = 510000;
const int MOD = 1000000007;

int main(){
    int N;
    int HList[100001] = {0};
    int dp[100001] = {1145141919};

    for(int i = 0; i < 100001;i++){
        dp[i] = 1145141919;
    }
    cin >>N;

    for(int i = 0;i < N;i++){
        cin >>HList[i];
    }
    dp[0] = 0;
    dp[1] = dp[0] + abs(HList[1] - HList[0]);

    for(int i = 2; i <= N-1;i++){
        dp[i] = min(dp[i-2] + abs(HList[i] - HList[i-2]),dp[i-1] + abs(HList[i] - HList[i-1]));
    }

    cout <<dp[N-1]<<endl;
    return 0;
}

/*Syakutori
while(cin >>b && b)){
      ll t = 1;
      long long int ansS = 1,ansT=0;
      long long int sum = 0;

      for(ll s = 1;s < 50000000;s++){

        while(t <  50000000 && sum+Rsum[t] < b){
          sum += Rsum[t];
          t++;
        }
        if(b == sum+Rsum[t]){
          if(ansT - ansS < t-s){
            ansS = s;
            ansT = t;
          }
          cout <<ansS<<" "<<ansT-ansS + 1<<endl;
          break;
        }
        if(t == s)++t;
        else sum -= Rsum[s];
        }
    }

//priority_queue<long long int,vector<long long int>, greater<long long int>> PQ;
//priority_queue<long long int> PQ1;

*/

Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
using Graph = vector<vector<int>>;
#define rep(i,n) for(int i=0;i<n;++i)
#define all(v) v.begin(), v.end()
typedef long long int ll;
typedef unsigned long long ull;
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;}
typedef pair<ll,ll> P;
const long long MOD = 1e9+7;
const ll INF = 1LL << 60;

int main(){

    int w,h,x,y,r;
    cin >> w >> h >> x >> y >> r;

    bool flag = true;

    if(x + r > w || y > h){
        flag = false;
    }

    if(y + r > h){
        flag = false;
    }

    if(x - r < 0){
        flag = false;
    }

    if(y - 1 < 0){
        flag = false;
    }

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

}


Measured memory_bytes: 3112
s= input()
t= input()
len_diff= len(s)- len(t)

top=0
for i in range(len_diff+1):
  test= s[i:]
  count=0
  for j in range(len(t)):
    if test[j]==t[j]:
      count+=1
  if count>top:
    top= count

print(len(t)-top)

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

int main(){
  int n;
  cin >> n;
  map<string,int> m;
  rep(i,n) {
    string s;
    cin >> s;
    m[s]++;
  }
  cout << m.size() << endl;
  return 0;
}


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

#define si(v) int(v.size())
#define all(v) v.begin(), v.end()
#define rep(i, n) for (ll i = 0; i < (n); ++i)
#define rep2(i, n, m) for (ll i = n; i <= (m); ++i)
#define rep3(i, n, m) for (ll i = n; i >= (m); --i)

template<class T, class U> void chmax(T &a, U b) { if (a < b) a = b; }
template<class T, class U> void chmin(T &a, U b) { if (b < a) a = b; }

using ll = long long;
using ld = long double;
using namespace std;

signed main()
{
  cout << fixed << setprecision(20);
  ios::sync_with_stdio(false);
  cin.tie(0);

  string s; cin >> s;
  
  int ans = 0;
  rep(i, si(s)) {
    if (s[i] == '1') ++ans;
  }

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

Measured memory_bytes: 3580
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
#define max3(a,b,c) max(a,max(b,c))
#define max4(a,b,c,d)   max(a,max(b,max(c,d)))
#define min3(a,b,c) min(a,min(b,c))
#define min4(a,b,c,d)   min(a,min(b,min(c,d)))
#define yes cout<<"YES"<<nl
#define no  cout<<"NO"<<nl
#define nl  '\n'
#define tr ios::sync_with_stdio(false),cin.tie(0),cout.tie(0)
#define tst int t;cin>>t;while(t--)
#define     Max             1000000000000000014
#define     Min             -1000000000000000014
#define     PI              3.1415926535897
#define     Fr               first
#define     Se               second
#define     all(v)          v.begin(),v.end()
#define     mem(a,v)        memset(a,v,sizeof(a))
#define     space            ' '
#define COUT(v) for(auto it:v)cout<<it<<space;cout<<nl;
/*error cheaking method starts from here */
#define error(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }

void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
cerr << *it << " = " << a << endl;
err(++it, args...);
}
/*error cheaking method ebds here */

#define vi    vector<int>
#define    vl    vector<ll>
#define    si    set<int>
#define    sl    set<ll>
#define    msi    multiset<int>
#define    msl    multiset<ll>
#define    pii    pair<int,int>
#define    pil    pair<int,ll>
#define    pli    pair<ll,int>
#define    pll    pair<ll,ll>
#define    mp    make_pair
#define    pb    push_back
int main()
{
    string s;
    cin>>s;
    if(s[0]==s[1]&&s[1]==s[2]&&s[0]=='R')
        cout<<3;
    else if((s[0]==s[1]&&s[0]=='R')||(s[1]==s[2]&&s[1]=='R'))
        cout<<2;
    else if(s[0]=='R'||s[1]=='R'||s[2]=='R')
        cout<<1;
    else
        cout<<0;
}


Measured memory_bytes: 3592
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define ll long long
#define ld long double
#define mod ((ll)1e9+7)
#define inf ((ll)1e18+5)
#define maxx ((ll)1e6+5)
#define pb push_back
#define endl "\n"
#define time(i) cout<<"\nTime Elapsed "<<i<<" : " << 1.0*clock() / CLOCKS_PER_SEC << " sec\n";
#define usefile freopen("input.txt","r",stdin); freopen("output.txt","w",stdout);
#define fast ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define test ll t; cin>>t; while(t--)
ll exp(ll x,ll y,ll p){ ll res=1; while(y) {if(y%2) res=(res*x%p)%p; x=(x*x)%p; y/=2; } return res;}
ll expm(ll x,ll y){ ll res=1; while(y) {if(y%2) res=(res*x%mod)%mod; x=(x*x)%mod; y/=2; } return res;}
/*
bool sv[maxx]={0};    // returns 0 if a num is prime
int sp[maxx]={0};     // gives smallest prime factor of the number
void Sieve() {for(int i= 2; i< maxx; i+= 2) sv[i]=1,sp[i] = 2;sv[2]=0;for(ll i = 3; i < maxx; i += 2){if (!sv[i]){sp[i] = i;for (ll j = i; (j*i) < maxx; j += 2){if (!sv[j*i])sv[j*i] = true, sp[j*i] = i;}}}}
ll fact[1000007]={0}; // returns factorial of that number
void facto() {fact[0]=1;fact[1]=1;for(int i=2;i<1000007;i++)fact[i]=(fact[i-1]*i)%mod;}
ll ncr(ll n,ll r) {ll res=1; res=fact[n]; res=(res*(expm(fact[r],mod-2)))%mod; res=(res*(expm(fact[n-r],mod-2)))%mod; return res;}
*/
signed main(){
  fast;
  //usefile;
  //test
  {
    int n,k;
    cin>>n>>k;
    int ans=0;      
    while(n>0){
      n/=k;
      ans++;
    }
    cout<<ans<<endl;
  }
  //time("");
  return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <cmath>
#include <cstdint>
#include <cstdio>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
using namespace std;
#define rep(i, n) for(int(i) = 0; (i) < (n); (i)++)
#define FOR(i, m, n) for(int(i) = (m); (i) < (n); (i)++)
#define All(v) (v).begin(), (v).end()
#define pb push_back
#define MP(a, b) make_pair((a), (b))
using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
const int INF = 1 << 30;
const ll LINF = 1LL << 60;
const int MOD = 1e9 + 7;

int main() {
    int H, W, K;
    cin >> H >> W >> K;
    vector<vector<char>> s(H, vector<char>(W));
    vector<int> cnt(H);
    rep(i, H) rep(j, W) {
        cin >> s[i][j];
        if(s[i][j] == '#')
            cnt[i]++;
    }
    int num = 1;
    vector<vector<int>> res(H, vector<int>(W));
    rep(i, H) {
        if(cnt[i] > 0) {
            int c = 0;
            rep(j, W) {
                res[i][j] = num;
                if(s[i][j] == '#') {
                    c++;
                    if(c != cnt[i])
                        num++;
                }
            }
            num++;
        }
    }
    vector<int> tmp(W, 0);
    int ok = 0;
    for(int i = 0; i < H; i++) {
        if(cnt[i]) {
            tmp = res[i];
            ok = 1;
        } else {
            if(ok) {
                rep(j, W) res[i][j] = tmp[j];
                cnt[i] = 1;
            }
        }
    }
    ok = 0;
    for(int i = H - 1; i >= 0; i--) {
        if(cnt[i]) {
            tmp = res[i];
            ok = 1;
        } else {
            if(ok)
                res[i] = tmp;
        }
    }

    rep(i, H) {
        rep(j, W) { cout << res[i][j] << (j == W - 1 ? "\n" : " "); }
    }

    return 0;
}

Measured memory_bytes: 1280
using System;
class Program
{
    private bool Judge(string s)
    {
        if (s.Length % 2 == 1)
            return false;
        else
        {
            int n = s.Length / 2;
            bool f = true;
            for (int i = 0; i < s.Length / 2; i++)
                f = f && s[i] == s[i + n];
            return f;
        }
    }
    public static void Main()
    {
        char[] s = Console.ReadLine().ToCharArray();
        Program prog = new Program();
        string check = "";
        for (int i = s.Length - 1; i >= 1; i--)
        {
            for (int j = 0; j < i; j++)
                check += s[j];
            if (prog.Judge(check))
            {
                Console.WriteLine(i);
                break;
            }
            else
                check = "";
        }
    }
}

Measured memory_bytes: 11220
n, m = map(int, input().split())
l = [str(x) for x in range(1, m + 1)]
i = 0
while (i < n):
    k = [str(x) for x in input().split()]
    del k[0]
    l = list(set(l) & set(k))
    i += 1
print(len(l))


Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(n);i++)
typedef long long ll;
 
int main(){
  int n,k,q;
  cin>>n>>k>>q;
  vector<int>a(q);
  rep(i,q)cin>>a[i];
  vector<int>h(n,k);
  rep(i,q){
    h[a[i]-1]++;
  }
  rep(i,n)h[i]-=q;
  rep(i,n){
    if(h[i]<=0)cout<<"No"<<endl;
    else cout<<"Yes"<<endl;
  }
}
  

Measured memory_bytes: 1408
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <utility>

#include <stdio.h>

#define rep(i, n) for (int i = 0; i < (n); i++)
#define irep(i, k, n) for (int i = (k); i < (n); i++)
#define rrep(i, k, n) for (int i = (k); i >= (n); i++)
#define pb push_back
#define vec vector
#define ref(a) &(a)

const int mod = 1e9 + 7;

typedef long long ll;

using namespace std;

ll a, b, k;

void solve() {
  ll c = a - k;
  cout << max((ll)0, c) << " " << max((ll)0, min(b + c, b)) << endl;
}

int main() {
  cin >> a >> b >> k;
  solve();
  return 0;
}

Measured memory_bytes: 504
#include <iostream>
#include <string>
#include <stack>
using namespace std;

int main()
{
    string s;
    cin >> s;
    stack<int> st;
    int ans = 0;
    for (auto c : s) {
        if (st.empty()) {
            st.push(c);
        } else if (c == '0' && st.top() == '1' || c == '1' && st.top() == '0') {
            st.pop();
            ans += 2;
        } else {
            st.push(c);
        }
    }
    cout << ans << endl;
    return 0;
}

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

int main() {
	long n;
	while(cin>>n) {
		if(!n) break;
		long long cnt=0;
		while(n!=1) {
			if(n%2==0) n/=2,cnt++;
			else n=n*3+1,cnt++;
		}
		cout << cnt << '\n' ;
	}
}

Measured memory_bytes: 1156
#include <cstdio>
#include <algorithm>
#include <queue>
using namespace std;
const int N=2010;
const int INF=1e9;
int n,m,q;
int a[N];
int d[N],dcnt;
inline int min(int x,int y){
	return x<y?x:y;
}
void readData(){
	scanf("%d%d%d",&n,&m,&q);
	for(int i=1;i<=n;i++) scanf("%d",&a[i]);
}
void Diz(){
	dcnt=n;
	for(int i=1;i<=n;i++) d[i]=a[i];
	sort(d+1,d+1+dcnt);
	dcnt=unique(d+1,d+1+dcnt)-d-1;
	for(int i=1;i<=n;i++)
		a[i]=lower_bound(d+1,d+1+dcnt,a[i])-d;
}
bool judge(int l,int r){ // [1,l)never [l,r]mustone
	int use=0;
	int cnt;
	for(int i=1,j=1;i<=n;i=j){
		if(a[i]<l){
			j=i+1;
			continue;
		}
		cnt=0;
		for(;j<=n&&a[j]>=l;j++)
			cnt+=(a[j]<=r);
		if((j-i)>=m)
			use+=min((j-i)-m+1,cnt);
	}
	return use>=q;
}
void solve(){
	int ans=INF;
	for(int i=1;i<=n;i++){
		int l=a[i],r=dcnt,mid;
		while(l<=r){
			mid=(l+r)>>1;
			if(judge(a[i],mid))
				r=mid-1;
			else 
				l=mid+1;
		}
		if(l<=dcnt)
			ans=min(ans,d[l]-d[a[i]]);
	}
	printf("%d\n",ans);
}
int main(){
	readData();
	Diz();
	solve();
	return 0;
}


Measured memory_bytes: 128
#include<iostream>
using namespace std;
int main() {
	int n, x;
	int a[110];
	long long int aa = 0;
	int b;
	int y = 0;
	cin >> n;
	cin >> x;
	for (int i = 0;i < n;i++) {
		cin >> a[i];
		if (y == 0) {
			aa += a[i];
			if (aa > x) {
				y = 1;
			}
		}
	}
	if (aa == x) {
		cout << n << endl;
	}
	else if (aa < x) {
		cout << n - 1 << endl;
	}
	else {
		for (int i = 0;i < n - 1;i++) {
			if (a[i] > a[i + 1]) {
				b = a[i];
				a[i] = a[i + 1];
				a[i + 1] = b;
				i -= 2;
				if (i < -1) {
					i = -1;
				}
			}
		}
		aa = 0;
		for (int i = 0;i < n;i++) {
			aa += a[i];
			if (aa > x) {
				cout << i << endl;
				break;
			}
		}
	}
	return 0;
}

Measured memory_bytes: 256
using System;

namespace AtCoder.Company.SoundHound
{
    class b
    {
        static void Main(string[] args)
        {
            var line = Console.ReadLine().Trim();
            var S = line;
            line = Console.ReadLine().Trim();
            var w = int.Parse(line);
            var str = "";
            for(var i = 0; i < S.Length; ++i)
            {
                if (i % w == 0) str += S[i];
            }
            Console.WriteLine(str);
        }
    }
}


Measured memory_bytes: 13140
#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <fstream>
#include <iostream>
#include <map>
#include <queue>
#include <string>
#include <stack>
#include <vector>
#include <set>
#include <tuple>
#include <utility>
#include <functional>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef tuple<int,int,int> T3;

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

	sort(a.begin(),a.end());
	sort(b.begin(),b.end());
	sort(c.begin(),c.end());

	ll ans = 0;
	for(int i = 0;i < n;i++){
		ll cnt1 = (ll)(lower_bound(a.begin(),a.end(),b[i]) - a.begin());
		ll cnt2 = (ll)(c.end() - upper_bound(c.begin(),c.end(),b[i]));
		ans += cnt1 * cnt2;
	}

	cout << ans << endl;
}


Measured memory_bytes: 1408
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using ld=long double;
using ii=pair<ll,ll>;
using vi=vector<ll>;

#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define INF (ll)1e18
#define all(x) (x).begin(),(x).end()
#define sz(x) ((int)(x).size())
#define print(a); for(auto x:a)cout<<x<<" "; cout<<"\n";
#define mset(a); memset(a,0,sizeof(a));

int main(){
	ios_base::sync_with_stdio(0);cin.tie(0);
    string s;cin>>s;
    for(int i=0;i<sz(s);i++)if(s[i]=='?')s[i]='D';
    cout<<s<<"\n";
}


Measured memory_bytes: 3740