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

#define for_(i,a,b) for(int i=a;i<b;++i)
#define for_rev(i,a,b) for(int i=a;i>=b;--i)
#define allof(a) a.begin(),a.end()
#define minit(a,b) memset(a,b,sizeof(a));
#define size_of(a) (int)a.size()

typedef long long lint;
typedef double Double;
typedef pair<int, int> pii;

const int iINF = 1L << 30;
const lint lINF = 1LL << 60;
const Double EPS = 1e-9;

struct Balloon {
	int p, t, i;
	Balloon(int _p, int _t, int _i) : p(_p), t(_t), i(_i) {}
};
bool operator < (const Balloon& a, const Balloon& b) {
	return a.t < b.t;
}

struct State {
	int cnt, k, p, t, cost;
	State(int _cnt, int _k, int _p, int _t, int _cost) : cnt(_cnt), k(_k), p(_p), t(_t), cost(_cost) {}
};
bool operator > (const State& a, const State& b) {
	return a.cost > b.cost;
}

int n, p[55], t[55];

int cost[55][4];

void solve() {
	vector<Balloon> vb;
	for_(i,0,n) vb.push_back(Balloon(p[i], t[i], i + 1));
	sort(allof(vb));
	
	for_(i,0,n + 1) fill(cost[i], cost[i] + 4, iINF);
	priority_queue< State, vector<State>, greater<State> > q;
	q.push(State(0,0,0,0,0));
	cost[0][0] = 0;
	int miss = -1;
	int ans = iINF;
	
	while (!q.empty()) {
		State s = q.top(); q.pop();
		
		int cnt = s.cnt, k = s.k, vpos = s.p, cur_time = s.t, cur_cost = s.cost;
		//cout << "cost(" << cnt << "," << k << "," << cur_time << ") = " << cur_cost << endl;
		if (cnt == n) {
			int end_cost = cur_cost + vpos;
			//cout << "end " << end_cost << endl;
			ans = min(ans, end_cost);
			continue;
		}
		
		if (cost[cnt][k] < cur_cost) continue;
		
		Balloon nxt = vb[cnt];
		int bpos = nxt.p, time = nxt.t, index = nxt.i;
		
		bool flag = false; // takable
		
		int nxt_time = cur_time + vpos * (k + 1) + bpos;
		int nxt_cost = cur_cost + vpos + bpos;
		if (nxt_time <= time) {
			// can go back
			flag = true;
			if (cost[cnt + 1][1] > nxt_cost) {
				cost[cnt + 1][1] = nxt_cost;
				q.push(State(cnt + 1, 1, bpos, time, nxt_cost));
			}
		}
			
		nxt_time = cur_time + abs(vpos - bpos) * (k + 1);
		nxt_cost = cur_cost + abs(vpos - bpos);
		if (k != 3 && nxt_time <= time) {
			// can take
			flag = true;
			if (cost[cnt + 1][k + 1] > nxt_cost) {
				cost[cnt + 1][k + 1] = nxt_cost;
				q.push(State(cnt + 1, k + 1, bpos, time, nxt_cost));
			}
		}
		
		if (!flag) miss = max(miss, index);
	}
	
	if (ans != iINF) cout << "OK " << ans << endl;
	else cout << "NG " << miss << endl;
}

int main() {
	while (cin >> n, n) {
		for_(i,0,n) cin >> p[i] >> t[i];
		solve();
	}
	return 0;
}

Measured memory_bytes: 1200
#heapq復習
import heapq
n = int(input())
v = list(map(int,input().split()))
heapq.heapify(v)
x = 0
while v:
  x = heapq.heappop(v)
  if not v:
    break
  y = heapq.heappop(v)
  heapq.heappush(v,(x+y)/2)
print(x)

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

int main(){
  cin >> n;
  for(int a=sqrt(n);a>0;a--){
    if(n==a*(n/a)){
      cout<<to_string(n/a).length()<<endl;
      return 0;
    }
  }
  cout<<to_string(n).length()<<endl;
  return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int W = sc.nextInt();
		int[] v = new int[N];
		int[] w = new int[N];
		for(int i=0;i<N;i++) {
			v[i] = sc.nextInt();
			w[i] = sc.nextInt();
		}
		int[][] dp = new int[N+1][W+1];
		for(int j=0;j<=W;j++) {
			dp[0][j] = 0;
		}
		for(int i=0;i<=N;i++) {
			dp[i][0] = 0;
		}
		for(int i=1;i<=N;i++) {
			for(int j=1;j<=W;j++) {
				if(w[i-1]<=j) {
					dp[i][j] = Math.max(dp[i-1][j-w[i-1]] + v[i-1], dp[i-1][j]);
				}else {
					dp[i][j] = dp[i-1][j];
				}
			}
		}
		System.out.println(dp[N][W]);
	}	
}





Measured memory_bytes: 31024
import java.util.*;
public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    int k = sc.nextInt();
    int[] l = new int[n];
    for(int i=0;i<n;i++){
      l[i] = sc.nextInt();
    }
    Arrays.sort(l);
    int sum=0;
    for(int i=0;i<k;i++) sum+=l[n-1-i];
    System.out.println(sum);
  }
}

Measured memory_bytes: 22996
/******************************************
* AUTHOR : GURUTEJA *
******************************************/
#include <bits/stdc++.h>
using namespace std;
#define LL long long
#define N 100005
#define MOD 1000000007
#define dd double
#define rep(i, n) for(int i = 0; i < n; i++)
#define REP(i,a,b) for(int i=a;i<b;i++)
#define rep1(i,b) for(int i=1;i<=b;i++)
#define pb push_back
#define mp make_pair
#define clr(x) x.clear()
#define sz(x) ((int)(x).size())
#define F first
#define S second

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

}

  int main() {
    debug();
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n;
    cin>>n;
   int a[n];
   for (int i = 0; i <n; ++i)
   {
   	       cin>>a[i];
   }
   sort(a,a+n);
   float x;
   if(n==1){
   	  cout<<a[0]<<endl;
   	  return 0;
   }else{
   	   x=((a[0]+a[1])/float(2));
   	   for (int i=2; i <n; ++i)
   	   {
   	   	     x=((x+a[i])/2);
   	   }
   	   cout<<x;
   }
    return 0;
  }

Measured memory_bytes: 3732
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using static System.Console;
using static System.Math;
using static System.Array;
using static Read;

class Program
{
    public static void Main()
    {
        var n = String().ToCharArray();
        string s = "";
        foreach(char c in n)
        {
            if(c == 'B')
            {
                if(s.Length > 0)
                {
                    s = s.Substring(0, s.Length - 1);
                }
            }
            else
            {
                s += c.ToString();
            }
        }
        WriteLine($"{s}");
    }
}

static class Read
{
    static Queue<string> queue = new Queue<string>();
    static void Enqueue()
    {
        ReadLine().Split(' ').ToList().ForEach(a => queue.Enqueue(a));
    }
    public static int Int()
    {
        if(queue.Count == 0)
            Enqueue();
        return int.Parse(queue.Dequeue());
    }
    public static long Long()
    {
        if(queue.Count == 0)
            Enqueue();
        return long.Parse(queue.Dequeue());
    }
    public static double Double()
    {
        if(queue.Count == 0)
            Enqueue();
        return double.Parse(queue.Dequeue());
    }
    public static string String()
    {
        if(queue.Count == 0)
            Enqueue();
        return queue.Dequeue();
    }
    public static int[] IntArray()
    {
        return ReadLine().Split(' ').Select(a => int.Parse(a)).ToArray();
    }
    public static long[] LongArray()
    {
        return ReadLine().Split(' ').Select(a => long.Parse(a)).ToArray();
    }
    public static double[] DoubleArray()
    {
        return ReadLine().Split(' ').Select(a => double.Parse(a)).ToArray();
    }
    public static string[] StringArray()
    {
        return ReadLine().Split(' ');
    }
}


Measured memory_bytes: 13396
#include <stdio.h>
#include <string.h>

int main(int argc, const char* argv[])
{
	int inputN = 0;
	char stringArray[10];

	scanf("%d", &inputN);

	// In order to find '7' digit inside the inputed value, program converts variable from int to string array.
	sprintf(stringArray, "%d", inputN);

	long len = strlen(stringArray);
	int digitCounter = 0;

	for (int i = 0; i < len; i++)
	{
		if (stringArray[i] == '7')
		{
			digitCounter++;
		}
	}

	if (digitCounter > 0)
	{
		printf("Yes \n");
	}
	else
	{
		printf("No \n");
	}

	return 0;
}

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

#define fi first
#define se second
#define be begin
#define en end
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define ALL(a) (a).be() , (a).en()

template<typename A, size_t N, typename T>
void FILL(A (&array)[N], const T &val){fill((T*)array,(T*)(array+N),val);}

int dp[100005];
int main(){
	int x;
	cin>>x;
	FILL(dp,0);

	int n = int(x/100);
	int m = x%100;

	dp[100] = 1;
	dp[101] = 1;
	dp[102] = 1;
	dp[103] = 1;
	dp[104] = 1;
	dp[105] = 1;
	for(int i=0; i<x; i++){
		if(dp[i]==0) continue;
		dp[i+100]++;
		dp[i+101]++;
		dp[i+102]++;
		dp[i+103]++;
		dp[i+104]++;
		dp[i+105]++;
	}
	cout<<((dp[x]>0)?1:0)<<endl;

	return 0;
}

Measured memory_bytes: 640
#include <iostream> // cout, endl, cin
#include <cmath> //sqrt pow
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // dequef
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower

#define rep(i,n) for(int i = 0; i < n; i++)
#define vi vector<int>
#define vvi vector<vi>
#define pii pair<int, int>
#define all(a) (a).begin(), (a).end()
#define mod 2019
using ll = long long;
using namespace std;
int main(){
  ll l,r;
  cin >> l >> r;
  if(r - l >= mod) cout << 0 << endl;
  else{
    ll ans = mod;
    for(ll i = l; i < r; i++){
      for(ll j = l + 1; j <= r; j++){
        ans = min(ans, i * j % mod);
      }
    }
    cout << ans << endl;
  }
}

Measured memory_bytes: 256
#include <deque>
#include <iostream>
using namespace std;
using ll = long long;

int main() {
    ll N, M, K;
    cin >> N >> M >> K;

    ll A[N + 1];
    for (ll i = 1; i <= N; ++i) {
        cin >> A[i];
    }

    ll dp[N + 1];
    fill(dp, dp + N + 1, 0);
    // dp[n] = A_nをk個目として選んだときの最大スコア
    // kについて逐次更新

    for (ll k = 1; k <= K; ++k) {
        ll ndp[N + 1];

        deque<ll> que;
        // スライド最大値
        // [i - M + 1, i]の最大値を求める

        for (ll i = 0; i < N; ++i) {
            // 古い上に値の小さいindexを破棄
            while (!que.empty() && dp[que.back()] <= dp[i]) {
                que.pop_back();
            }

            que.push_back(i);

            // 先頭が範囲内か確認
            while (que.front() <= i - M) {
                que.pop_front();
            }

            ndp[i + 1] = dp[que.front()] + A[i + 1] * k;
        }

        // k未満を更新するとWA
        // A_1がやたら大きいときにA_1 * Kを答えにしてしまう
        for (ll i = k; i <= N; ++i) {
            dp[i] = ndp[i];
        }
    }

    ll ans = 0;
    for (ll i = 1; i <= N; ++i) {
        ans = max(ans, dp[i]);
    }

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


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

using namespace std;
#define int long long
#define ld long double
#define all(x) x.begin(),x.end()
#define max3(a,b,c) max(a,max(b,c))
#define min3(a,b,c) min(a,min(b,c))
#define vi vector<int>
#define vstr vector<string>
#define vbool vector<bool>
#define vvi vector<vector<int> >
#define mii map<int,int>
#define pb push_back
#define pii pair<int,int>
#define vpair vector<pii > 
#define mkp make_pair
#define scan(a,n) for(int i =0 ; i<n ; i++) cin>>a[i]
#define print(a,n) for(int i = 0 ; i < n ; i++) {cout<<a[i]<<' ';}cout<<'\n'
#define mem(a,v) memset(a,v,sizeof(a))
#define loop(i,a,b) for (int i = a; i < b; i++)
#define loope(i,a,b) for (int i = a; i <= b; i++)
#define FastIO ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define PRECISION std::cout.unsetf ( std::ios::fixed );std::cout.precision(9)
#define PI 3.14159265
#define S second
#define F first
#define CHECK cout<<"CHEDEDWB"<<endl
int mod = 1e9+7;
int inf = 1e18;
int m_inf = INT_MIN;

void solve()
{
	int x1,x2,x3,x4,x5;
	cin>>x1>>x2>>x3>>x4>>x5;
	if(x1==0)
		cout<<1<<endl;
	else if(x2==0)
		cout<<2<<endl;
	else if(x3==0)
		cout<<3<<endl;
	else if(x4==0)
		cout<<4<<endl;
	else if(x5==0)
		cout<<5<<endl;
}

int32_t main()
{
	FastIO; PRECISION;
	int t = 1;
	//cin>>t;
	while(t--)
		solve();
	return 0;
} 

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

#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define INF 1e9
#define ALL(v) v.begin(), v.end()

using namespace std;

typedef long long ll;

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

    double T, X;
    cin >> T >> X;
    cout << fixed;
    cout << setprecision(10) << (T/X) << "\n";
}

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

int main(){
  ll a,b;
  cin >> a >> b;
  if(a==b+1){
    ll ans=a^b;
    cout << ans << endl;
    return 0;
  }
  if(a==b){
    cout << a << endl;
    return 0;
  }

  ll ans;

  if(a%2==0){
    ll cnt=0;
    if(b%2==0){
      ll tmp=b-a;
      cnt=tmp/2;
      cnt=cnt%2;
      ans=cnt^b;
      cout << ans << endl;
    }else{
      ll tmp=b+1-a;
      cnt=tmp/2;
      cnt=cnt%2;
      cout << cnt << endl;
    }
  }else{
    ll cnt=0;
    ll tmp=0;
    if(b%2==0){
      tmp=b-a-1;
      cnt=tmp/2;
      cnt%=2;
      ans=a^b^cnt;
      cout << ans << endl;
    }else{
      tmp=b-a;
      cnt=tmp/2;
      cnt%=2;
      ans=a^cnt;
      cout << ans << endl;
    }
  }
  return 0;
}


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

// template {{{
#define  range(i, l, r) for (int i = (int)(l); i < (int)(r); (i) += 1)
#define rrange(i, l, r) for (int i = (int)(r) - 1; i >= (int)(l); (i) -= 1)

#define  whole(f, x, ...) ([&](decltype((x)) container) { return (f)(  begin(container),  end(container), ## __VA_ARGS__); })(x)
#define rwhole(f, x, ...) ([&](decltype((x)) container) { return (f)( rbegin(container), rend(container), ## __VA_ARGS__); })(x)

#define debug(x) cerr << "(" << __LINE__ << ")" << #x << ": " << (x) << endl

using i32 = int;
using u32 = unsigned int;
using i64 = long long;
using u64 = unsigned long long;

// constexpr i32 mod   = 998244353;
constexpr i32 mod   = 1e9 + 7;
constexpr i32 inf   = 1001001001;
constexpr i64 infll = 1001001001001001001ll;

constexpr int dx[] = {0, -1, 1, 0, -1, 1, -1, 1};
constexpr int dy[] = {-1, 0, 0, 1, -1, -1, 1, 1};

struct IoSetup { IoSetup(int x = 15){ cin.tie(0); ios::sync_with_stdio(0); cout << fixed << setprecision(x); cerr << fixed << setprecision(x); } } iosetup;

template <typename T = i64> T input() { T x; cin >> x; return x; }

template <typename T> ostream &operator<<(ostream &os, vector<T> &v) { range(i, 0, v.size()) { os << v[i] << (i + 1 != v.size() ? " " : ""); } return os; }
template <typename T> istream &operator>>(istream &is, vector<T> &v) { for (T &in : v) is >> in; return is; }

template <typename T1, typename T2> ostream &operator<<(ostream &os, pair<T1, T2> p) { os << "(" << p.first << ", " << p.second << ")"; return os; }
template <typename T1, typename T2> istream &operator>>(istream &is, pair<T1, T2> &p) { is >> p.first >> p.second; return is; }

template <typename T> vector<T> make_vector(size_t a, T b) { return vector<T>(a, b); }
template <typename... Ts> auto make_vector(size_t a, Ts... ts) { return vector<decltype(make_vector(ts...))>(a, make_vector(ts...)); }

template <typename T1, typename T2> inline bool chmax(T1 &a, T2 b) { return a < b && (a = b, true); }
template <typename T1, typename T2> inline bool chmin(T1 &a, T2 b) { return a > b && (a = b, true); }
// }}}

void solver() {
    int d = input(), n = input();

    int cnt = 0;
    for (int i = 1; ; ++i) {
        int uku = 0;
        int m = i;
        while (m % 100 == 0) {
            uku++;
            m /= 100;
        }

        if (uku == d) cnt++;
        if (cnt == n) {
            cout << i << endl;
            return;
        }
    }
}

signed main(int argc, char *argv[]) {
    solver();
}


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

int main () {
  int K, S;
  cin >> K >> S;

  int answer = 0;
  for (int i = 0; i <= K; i++) {
    for (int j = 0; j <= K; j++) {
      if ((i + j) > S) break;
      
      if ((S - (i + j)) <= K) answer++;
    }
  }
  cout << answer << endl;
}


Measured memory_bytes: 256
ans = [0]
a = gets.to_i
x = []
a.times do
  b = gets.chomp
  x << b
end
c = gets.to_i
y = []
c.times do
  d = gets.chomp
  y << d
end
m = x.uniq
n = m.length
for num in 0..n-1 do
  if x.count(m[num]) > y.count(m[num])
      ans <<  x.count(m[num]) - y.count(m[num])
  end
end  
p ans.max

Measured memory_bytes: 1788
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
#define pb push_back
#define mp make_pair
#define rep(i,n) for(int i=0;i<(n);++i)

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n;cin >> n;
	vector<int> dp(n+10,1000000000);
	dp[0]=0;
	rep(i,n){
		for(int j=1;j<=n;j*=6) if(i+j<=n) dp[i+j]=min(dp[i+j],dp[i]+1);
		for(int j=1;j<=n;j*=9) if(i+j<=n) dp[i+j]=min(dp[i+j],dp[i]+1);
	}
	cout << dp[n] << endl;
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
#define X first
#define Y second
typedef long long ll;
using namespace std;

const int MOD = 1e9 + 7;
const ll INF = 1e18;

int n, m;
int dp[3002][3002][5];

int rek(int x, int y, int z) {
	if (x == 0) {
		return z;
	}
	
	int &ret = dp[x][y][z];
	if (ret != -1) return ret;
	ret = 0;
	
	for (int i = 0; i < 2; i ++) {
		for (int j = 0; j < 2; j ++) {
			if (y-i >= 0 && n-1-(y-i) >= 0 && y-i+1-j >= 0 && n-(y-i+1-j) >= 0) {
				if (y-i == 0 || y-i+1-j == 0) ret += rek(x-1, y-i+1-j, 1);
				else ret += rek(x-1, y-i+1-j, z);
				
				ret %= MOD;
			}
		}
	}
	
	return ret;
}

int main () {

	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cin >> n >> m;
	int sol = 0;
	memset(dp, -1, sizeof dp);
	sol = rek(m, 0, 1);
	
	for (int i = 1; i <= n; i ++) {
		sol += rek(m, i, 0);
		sol %= MOD;
	}
	
	cout << sol;

	return 0;
}

Measured memory_bytes: 176512
#include <bits/stdc++.h>
using namespace std;
#define REP(i,x,n) for(int i=x;i<(int)n;i++)
#define rep(i,n) REP(i,0,n)
#define sp(p) cout<<setprecision(16)<<fixed<<p<<endl;
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define SORT(a) sort(all(a))
#define RSORT(a) sort(rall(a))
#define UNIQ(a) unique(all(a))
#define UNIQNUM(a) UNIQ(a)-a.begin()
#define UNIQIT(a) a.erase(UNIQ(a), a.end());
#define VOUT(v,i) rep(i,v.size())cout<<v[i]<<(i==v.size()-1?"\n":" ");
#define vout(v) VOUT(v,z);
#define vdbg(v,i) cout<<#v<<": ";for(int i=0;i<(int)v.size();i++){cout<<v[i]<<" ";}cout<<"\n";
#define vmin(v) *min_element(all(v))
#define vmax(v) *max_element(all(v))
#define vsum(v) accumulate(all(v), 0LL)
#define MOUT(m,r,c) rep(i,r){rep(j,c){cout<<m[i][j]<<" ";}cout<<endl;}
#define mout(m) MOUT(m,m.size(),m[0].size())
#define debg(a) cout<<#a<<": "<<a<<endl;
#define show(a) for(cont &y:a){for(cont &x:y){cout<<x<<" ";}cout<<endl;}
#define digit(a) to_string(a).length();
template<class T>inline int out(const T &t){ print(t); putchar('\n'); return 0; }
// template<class T>inline T gcd(T a,T b){if(b==0)return a; return(gcd(b,a%b));}
// template<class T>inline T lcm(T a,T b){return a/gcd(a,b)*b;}
bool is_palindrome(string s){return s == string(s.rbegin(),s.rend());}
typedef long long ll;
typedef long double ld;
typedef pair<ll,ll> P;
typedef vector<ll> V;
typedef vector<vector<ll>> VV;
// const long long MOD=1000000007;
const long long INF = 1e18;
#define EPS (1e-7)
#define PI (acos(-1))
template<class T>
inline bool chmax(T &a, T b) {
    if(a < b) { a = b; return true; }
    return false;
}
template<class T>
inline bool chmin(T &a, T b) {
    if(a > b) { a = b; return true; }
    return false;
}

const string YES = "Yes";
const string NO = "No";
#define judge(f) cout<<((f)?YES:NO)<<"\n";


int main(){
    long long X;
    scanf("%lld",&X);
    long long Y;
    scanf("%lld",&Y);
    for (long long i = 0; i <= X; i++) {
        ll turu=i, kame=X-i;
        if(turu*2+kame*4==Y){
            judge(true);
            return 0;
        }
    }
    judge(false);
    return 0;
}


Measured memory_bytes: 3684
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep_range(i, s, e) for (int i = (s); i < (int)(e); i++)
#define rep_rev(i, s, e) for (int i = (s)-1; i >= (int)(e); i--)
#define sort_vec(v) sort((v).begin(),(v).end())
typedef int64_t lint;
// lint mod = 998244353;
template< typename T1, typename T2 >
inline bool chmax(T1 &a, T2 b) { return a < b && (a = b, true); }
template< typename T1, typename T2 >
inline bool chmin(T1 &a, T2 b) { return a > b && (a = b, true); }

bool app() {
  int n;
  cin>>n;

  int total_d=0;

  priority_queue<pair<int,int>> q_dmin;
  rep(i,n){
    string s;
    cin>>s;
    int d=0;
    int dmin=0;
    rep(j,s.length()){
      if(s[j]=='('){
        d++;
      }else{
        d--;
        chmin(dmin,d);
      }
    }
    q_dmin.emplace(dmin,d);
    total_d+=d;
  }
  if(total_d!=0) return false;

  vector<pair<int,int>> v_flat;
  priority_queue<pair<int,int>> v_down;
  int nd=0;
  while(!q_dmin.empty()){
    auto t=q_dmin.top();
    q_dmin.pop();
    if(t.second<0){
      v_down.emplace(t.second-t.first,t.second);
      continue;
    }
    if(t.second==0){
      v_flat.push_back(t);
      continue;
    }
    if(t.first<-nd) return false;
    nd+=t.second;
  }

  for(auto t: v_flat){
    if(t.first<-nd) return false;
  }

  while(!v_down.empty()){
    auto t=v_down.top();
    v_down.pop();
    if(t.second-t.first<-nd) return false;
    nd+=t.second;
  }

  return true;
}

int main(){cout<<(app()?"Yes":"No")<<endl;return 0;}


Measured memory_bytes: 18784
import java.util.*;
public class Main {
    public static int max(int a, int b){return (a > b ? a : b);}
    public static int min(int a, int b){return (a < b ? a : b);}
    public static int gcd(int a, int b){return (b > 0 ? gcd(b, a % b) : a);}
    public static int lcm(int a, int b){return a / gcd(a, b) * b;}
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        
        ArrayList<TreeSet<Integer>>S = new ArrayList<TreeSet<Integer>>();
        for(int i = 0; i < 26; i++)S.add(new TreeSet<Integer>());
        for(int i = 0; i < 26; i++)S.get(i).add(505050);
        int N = sc.nextInt();
        String s = sc.next();
        for(int i = 0; i < N; i++){
            int idx = i + 1;
            char c = s.charAt(i);
            int ci = c - 97;
            // System.out.println(idx + " : " + c + " : " + ci);
            S.get(ci).add(idx);
        }
        // System.out.println("");
        int Q = sc.nextInt();
        for(int i = 0; i < Q; i++){
            int q = sc.nextInt();
            if(q == 1){
                int idx = sc.nextInt();
                char c = sc.next().charAt(0);
                int ci = c - 97;
                for(int j = 0; j < 26; j++)S.get(j).remove(idx);
                S.get(ci).add(idx);
                // System.out.println(idx + " : " + c + " : " + ci);
            }
            else{
                int l = sc.nextInt();
                int r = sc.nextInt();
                // System.out.println(l + " - " + r);
                int ans = 0;
                for(int j = 0; j < 26; j++){
                    if(S.get(j).ceiling(l) <= r)ans++;
                }
                System.out.println(ans);
            }
        }
    }
}


Measured memory_bytes: 104688
k,n=[int(x) for x in input().split()]
a=[int(x) for x in input().split()]
b=0
for i in range(n-1):
  d=a[i+1]-a[i]
  b=max(b,d)
d=a[0]-(a[n-1]-k)
b=max(d,b)
print(k-b)

Measured memory_bytes: 31600
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <queue>
#include <cstring>
#include <vector>
#include <map>
#include <algorithm>
#include <cctype>
#include <cmath>
#include <bitset>
#include <set>
using namespace std;

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

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

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

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

// --------------------------------------
int n;
map<int, int> res;

void prime_factor(int p) {
  for(int i=2; i*i<=p; i++) {
    while(p % i == 0) {
      ++res[i];
      p /= i;
    }
  }
  if(p != 1) ++res[p];
}

int getCount(int c) {
  int count = 0;
  for(auto x: res) {
    if(x.second >= c - 1) count++;
  }
  return count;
}

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

  cin >> n;
  FOR(i, 2, n + 1) {
    prime_factor(i);
  }

  int ans = 0;
  ans += getCount(75);
  ans += getCount(25) * (getCount(3) - 1);
  ans += getCount(15) * (getCount(5) - 1);
  ans += (getCount(5) * (getCount(5) - 1) / 2) * (getCount(3) - 2);

  cout << ans << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, j) for(int i=0; i < (int)(j); i++)
#define all(v) v.begin(),v.end()
template<class T> bool set_max(T &a, const T &b) { return a < b  ? a = b, true : false; }

struct Edge { ll from, to, cost; };
using EdgeList = vector<vector<Edge>>;

int main() {
    int N; cin >> N;
    EdgeList E(N);

    rep(i, N - 1) {
        int s, t; cin >> s >> t;
        s--; t--;
        E[s].emplace_back(Edge{s, t, 1});
        E[t].emplace_back(Edge{t, s, 1});
    }
    vector<ll> dp(N);
    function<ll(int, int)> dfs = [&] (int now, int prev) {
        dp[now] = 0;
        for(Edge &e : E[now]) {
            if(e.to == prev) continue;
            set_max(dp[now], dfs(e.to, now) + e.cost);
        }
        return dp[now];
    };
    vector<ll> ans(N);
    function<void(int, int, ll)> dfs2 = [&] (int now, int prev, ll v) {
        using T = pair<ll, int>;
        vector<T> values = {T(0, -1)}; // ??????
        for(Edge &e : E[now]) {
            ll vv = e.to != prev ? dp[e.to] : v;
            values.emplace_back(vv + e.cost, e.to);
        }
        sort(all(values), greater<T>());
        ans[now] = values[0].first;
        for(Edge &e : E[now]) {
            if(e.to == prev) continue;
            ll vv = (values[0].second != e.to ? values[0] : values[1]).first;
            dfs2(e.to, now, vv);
        }        
    };
    dfs(0, -1);
    dfs2(0, -1, 0);
    for(auto a : ans) cout << (N - 1) * 2 - a << endl;
    return 0;
}

Measured memory_bytes: 34716
#include<iostream>
using namespace std;
int main(){
	string s[100];
	int H,W;
	cin>>H>>W;
	for(int i=0;i<H;i++){
		cin>>s[i];
	}
	for(int i=0;i<H;i++){
		cout<<s[i]<<endl<<s[i]<<endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#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 debug(x) cerr << #x << " = " << x << "\n"
#define debugv(x) rep(i, x.size()) cerr << x[i] << (i == x.size() - 1 ? "\n" : " ")
#define all(x) x.begin(), x.end()
#define int long long
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
const int INF = ((1LL << 30) + (1LL << 29));
const int MOD = 1000000007;
const int FIVE = 101010;

//=============================
int N, M, K;
string S, T;
vector<int> A;
vector<int> B;
//=============================
void input()
{
    cin >> S;
}
//=============================
void func() {}
//=============================
void solve()
{
    int N = S.size();
    int l = 77;
    vector<vector<int>> DP(l + 1, vector<int>(N, -1));
    rep(i, N)
    {
        DP[0][i] = i + (S[i] == 'R' ? 1 : -1);
    }

    for (int k = 0; k < l; ++k)
    {
        rep(i, N)
        {
            DP[k + 1][i] = DP[k][DP[k][i]];
        }
    }
    vector<int> ans(N, 0);
    rep(i, N)
    {
        int p = i;
        for (int k = l - 1; k >= 0; --k)
        {
            if ((100000 >> k) & 1)
            {
                p = DP[k][p];
            }
        }
        ans[p]++;
    }

    rep(i, N)
    {
        cout << ans[i] << (i == N - 1 ? "\n" : " ");
    }
}
//=============================
signed main()
{
    input();
    solve();
    return 0;
}

Measured memory_bytes: 62576
#include<bits/stdc++.h>
//#include<ext/pb_ds/tree_policy.hpp>
#define ll long long
#define int long long int
#define mkp make_pair
#define pb push_back
#define ff first
#define ss second
#define debug1(a) cout<<a<<endl;
#define debug2(a,b) cout<<a<<' '<<b<<endl;
#define debug3(a,b,c) cout<<a<' '<<b<<' '<<c<<endl;
#define rep(i,n) for(int i=0;i<n;i++)
#define repl(i,a,b) for(int i=a;i<b;i++)
#define pi pair<int,int>
#define pii pair<int,pi>
#define mp map<int,int>
#define ump unordered_map<int,int>
#define  vi vector<int>
#define st set<int>
#define mst multiset<int>
#define pq priority_queue
#define mpq priority_queue<int,vector<int>,greater<int> >
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define in cin>>
#define out cout<<
//using namespace __gnu_pbds;
using namespace std;
//typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> orderedSet;
//typedef tree<int,null_type,less_equal<int>,rb_tree_tag,tree_order_statistics_node_update> orderedMSet;
//*p.find_by_order(index) return value at index
//p.order_of_key(key) return index
void printArray(int arr[],int n)
{
   for(int i=0;i<n;i++)cout<<arr[i]<<' ';
}
void printMp(mp m)
{
  mp ::iterator it;
  for(it=m.begin();it!=m.end();it++)cout<<it->first<<' '<<it->second<<endl;
}
void printUmp(ump m)
{
  ump ::iterator it;
  for(it=m.begin();it!=m.end();it++)cout<<it->first<<' '<<it->second<<endl;
}
void printSt(st s)
{
  st ::iterator it;
  for(it=s.begin();it!=s.end();it++)cout<<*it<<' ';
}
void printMst(mst s)
{
  mst ::iterator it;
  for(it=s.begin();it!=s.end();it++)cout<<*it<<' ';
}
void printVec(vector<int>v)
{
for(int i=0;i<v.size();i++)cout<<v[i]<<' ';
}
void printVec2(vector<int>v[],int n)
{
    for(int i=0;i<n;i++)
    {
        for(int j=0;j<v[i].size();j++)
            cout<<v[i][j]<<' ';
        cout<<endl;
    }
}
 set<pair<int,int>> primeset;
void SieveOfEratosthenes(int n)
{
    bool prime[n+1];
    memset(prime, true, sizeof(prime));

    for (int p=2; p*p<=n; p++)
    {
        if (prime[p] == true)
        {
        for (int i=p*p; i<=n; i += p)
                prime[i] = false;
        }
    }
    for (int p=2; p<=n; p++)
       if (prime[p])
          primeset.insert(mkp(p,1));
}
int32_t main()
{
fastio;
int n;
in n;
priority_queue<int> pq;
int arr[n];
rep(i,n){
  int a;
  in a;
  arr[i]=a;
  pq.push(a);
}

int largest=pq.top();
pq.pop();
int sec=pq.top();
rep(i,n)
{
  if(arr[i]!=largest)
      cout<<largest;
  else
      cout<<sec;
  cout<<endl;
}
    return 0;
}


Measured memory_bytes: 4976
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll mod = 1000000007;
int main() {
    string s;
    cin >> s;
    if(s == "Sunny") cout << "Cloudy" << endl;
    else if(s == "Cloudy") cout << "Rainy" << endl;
    else cout << "Sunny" << endl;
    return 0;
}

Measured memory_bytes: 764
#include <bits/stdc++.h>
using namespace std;
#include <atcoder/all>
using namespace atcoder;
#define rep(i,n) for (long long i = 0; i < (n); ++i)
using ll = long long;
using P = pair<ll,ll>;
using vec = vector<ll>;
using vecp = vector<P>;
using mat = vector<vec>;
using matp = vector<vecp>;
const ll MOD = 1e9+7;
const ll INF = 1e18;
#define all(v) v.begin(), v.end()



int main(){
  ll N,K;
  cin >> N >> K;
  mat A(N,vec(N));
  mcf_graph<ll,ll> g(2*N+2);
  
  ll s=N*2,t=N*2+1;
  g.add_edge(s,t,N*K,MOD);
  rep(i,N){
    rep(j,N){
      cin >> A.at(i).at(j);
      g.add_edge(i,N+j,1,MOD-A.at(i).at(j));
    }
  }
  rep(i,N){
    g.add_edge(s,i,K,0);
    g.add_edge(N+i,t,K,0);
  }
  P a=g.flow(s,t,N*K);
  cout << 1LL*N*K*MOD-a.second << endl;
  vector<string> B(N,string(N,'.'));
  for(auto e:g.edges()){
    if(e.from==s||e.to==t||e.flow==0){
      continue;
    }
    B.at(e.from).at(e.to-N)='X';
  }
  rep(i,N){
    cout << B.at(i) << endl;
  }
}

Measured memory_bytes: 3960
#include <iostream>
#include <stdio.h>
#include <string>

using namespace std;
int main(){
  int N;
  cin >> N;
  int pos[3][N+1];
  for (int i=1;i<=N;i++){
    cin >> pos[0][i] >> pos[1][i] >> pos[2][i];
  }

  pos[0][0]=0;
  pos[1][0]=0;
  pos[2][0]=0;
  int n,flag=0;
  for (int i=1 ;i<=N;i++){
    n= (pos[0][i]-pos[0][i-1])-abs(pos[1][i]-pos[1][i-1])-abs(pos[2][i]-pos[2][i-1]);
    if (abs(n)%2==1||n<0){
      flag=1;
      cout << "No" << endl;
      break;
    }

  }
  if (flag==0){
    cout << "Yes" << endl;
  }

}


Measured memory_bytes: 4612
#include <bits/stdc++.h>
using namespace std;
int main()
{
	int n;

	cin>>n;

	int a[n],i;

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

	int dp[n];

	for(i=0;i<n;i++)
		dp[i] = INT_MAX;

	dp[n-1] = 0;

	for(i = n-2;i>=0;i--)
	{
		if(i+1<n)
			dp[i] = min(dp[i],dp[i+1]+abs(a[i+1] - a[i]));
		if(i+2<n)
			dp[i] = min(dp[i],dp[i+2]+abs(a[i+2] - a[i]));
	}
	cout<<dp[0];


	return 0;
}

Measured memory_bytes: 4356
#include<iostream>

using namespace std;

int main(void) {
	int a;
	int b;

	cin >> a >> b;

	if (a < b) {
		cout << "a < b" << endl;
	}else if (a > b) {
		cout << "a > b" << endl;
	}else{
		cout << "a == b" << endl;
	}

	return 0;
}


Measured memory_bytes: 3108
import java.util.*;
class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		String t = sc.next();
		int sol = t.length();
		for (int i = 0; i <= s.length() - t.length(); i++) {
			int count = 0;
			int k = i;
			for (int j = 0; j < t.length(); j++) {
				if (s.charAt(k) != t.charAt(j)) {
					count++;
				}
				k++;
			}
			sol = Math.min(count, sol);
		}
		System.out.println(sol);
	}

}

Measured memory_bytes: 35440
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
 #define int long long

#define all(X) (X).begin(), (X).end()
#define reset(X) memset(X, 0, sizeof(X))
#define mp(a, b) make_pair(a, b)
#define pb push_back
#define endl '\n'
#define fi first
#define se second


using namespace __gnu_pbds;
using namespace std;
const int mod=1e9+7;
 // const int mod=998244353;
 // const int mod=1e9+9;
// const int INF=4e18+10;
const int INF=4e18+10;
template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
template <typename T>
using ordered_multiset = tree<T, null_type, less_equal<T>, rb_tree_tag, tree_order_statistics_node_update>;

#define read(n) int n; cin>>n;
#define readv(x, n) vector<int> x(n); for(auto &i:x) cin>>i;


typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef pair<int, int> pii;

template<typename T1,typename T2>
void set_min(T1& a, T2 b)
{
    a=min(a, (T1)b);
}


int multiply(int a, int b, int in_mod){return (a*b)%in_mod;}
int mult_identity(int a){return 1;}


auto power(auto a, int b, int in_mod)
{
    auto prod=mult_identity(a);
    auto mult=a%in_mod;
    while(b!=0)
    {
        if(b%2)
        {
            prod=multiply(prod,mult, in_mod);

        }
        mult=multiply(mult, mult,in_mod);
        b/=2;
    }
    return prod;
}
int mod_inv(int q, int in_mod)
{

    return power(q, in_mod-2,in_mod);
}



void solve()
{
    int n;
    cin>>n;
    vector<int> dp(n+1);
    vector<int> pref(n+1);
    dp[0]=1;
    dp[1]=n;
    pref[0]=1;
    pref[1]=n+1;
    for(int i=2;i<=n;i++)
    {
        dp[i] = dp[i-1];
        dp[i] += (n-1)*(n-1);
        dp[i]%=mod;

        dp[i]%=mod;
        int good_boys = i;
        if(i>=3)
        dp[i]=(dp[i]+pref[i-3])%mod;

        if(n-good_boys+1>=0)
        dp[i]+=(n-good_boys+1)%mod;
        dp[i]%=mod;


        dp[i]%=mod;
        pref[i]= pref[i-1]+dp[i];
        pref[i]%=mod;
    }
    cout<<dp[n]<<endl;
}

signed main()

{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    #ifndef ONLINE_JUDGE
    if(fopen("INPUT.txt","r"))
    {
        freopen ("INPUT.txt" , "r" , stdin);
        freopen ("OUTPUT.txt" , "w" , stdout);
    }
    #endif
    auto clk=clock();
    mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
    // -------------------------------------Code starts here---------------------------------------------------------------------

    int t=1;
    // cin>>t;
    for(int test=1;test<=t;test++)
    {
        // cout<<"Case #"<<test<<": ";
        // cout<<endl;
        solve();
        // cout<<endl;

    }

    // -------------------------------------Code ends here------------------------------------------------------------------


    clk = clock() - clk;
    cerr << fixed << setprecision(6) << "Time: " << ((double)clk)/CLOCKS_PER_SEC << "\n";
    return 0;
}


Measured memory_bytes: 15872
#include <stdio.h>
#include <math.h>

int main(void)
{
    int n, i;
    scanf("%d", &n);

    double x_vec[100], y_vec[100];
    for (i = 0; i < n; i++)
        scanf("%lf", &x_vec[i]);
    for (i = 0; i < n; i++)
        scanf("%lf", &y_vec[i]);

    double manhattan = 0, euclidean = 0, minkowski_3 = 0, chebyshev = 0;

    for (i = 0; i < n; i++) {
        double diff;
        diff = fabs(x_vec[i] - y_vec[i]);

        manhattan += diff;
        euclidean += pow(diff, 2);
        minkowski_3 += pow(diff, 3);
        chebyshev = fmax(chebyshev, diff);
    }

    euclidean = sqrt(euclidean);
    minkowski_3 = cbrt(minkowski_3);

    printf("%f\n%f\n%f\n%f\n", manhattan, euclidean, minkowski_3, chebyshev);

    return 0;
}

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

int ch(string &a){
  char b;
  b = a[a.length()-1];
  
  for(int i=a.length()-1;i>0;i--){
    a[i] = a[i-1];
  }
  a[0] = b;
  return 0;
}

  
int main(){
  string a,b;
  cin>>a>>b;
  int i=0;
  
  while(i<a.length()){
    if(a==b){
      cout<<"Yes"<<endl;
      return 0;
    }
    ch(a);
    i++;
  }
  
  cout<<"No"<<endl;
  return 0;
}
    


Measured memory_bytes: 256
/**
 *    author:  [itmo] enot.1.10
 *    created: 01.10.2016 15:07:06       
**/
#define __USE_MINGW_ANSI_STDIO 0
#include <bits/stdc++.h>

#define F first
#define S second
#define pb push_back
#define mp make_pair
#define forn(i, n) for(int i = 0 ; (i) < (n) ; ++i)
#define eprintf(...) fprintf(stderr, __VA_ARGS__),fflush(stderr)
#define sz(a) ((int)(a).size())
#define all(a) (a).begin(),a.end()
#define pw(x) (1LL<<(x))

using namespace std;

typedef long long ll;
typedef double dbl;
typedef vector<int> vi;
typedef pair<int, int> pi;

const int inf = 1.01e9;
const dbl eps = 1e-9;

/* --- main part --- */

const int N = 110;

int a[N];


int main()
{
    #ifdef home
        assert(freopen("1.in", "r", stdin));
        assert(freopen("1.out", "w", stdout));
    #endif
    int n;
    scanf("%d", &n);
    forn(i, n) scanf("%d", a + i);
    int mx = 0;
    forn(i, n) mx = max(mx, a[i]);
    multiset<int> S;
    forn(i, n) S.insert(a[i]);
    int ok = 1;
    for (int i = 0; i <= mx; ++i)
    {
        int val = max(i, mx - i);
        if (S.find(val) == S.end())
        {
            ok = 0;
            break;
        }
        S.erase(S.find(val));
    }
    int mn = mx - mx / 2;
    if (sz(S) && *S.begin() <= mn) ok = 0;
    if (ok) printf("Possible\n");
    else printf("Impossible\n");


        
    #ifdef home
        eprintf("time = %d ms\n", (int)(clock() * 1000. / CLOCKS_PER_SEC));
    #endif
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<map>
#include<set>
#include<stack>
#include<queue>
#include<math.h>
using namespace std;
typedef long long ll;
#define int long long
typedef vector<int> VI;
typedef pair<int, int> pii;
typedef priority_queue<int> PQ;
template<class T>bool chmax(T &a, const T &b) { if (a < b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b < a) { a = b; return 1; } return 0; }
#define fore(i,a) for(auto &i:a)
#define REP(i,n) for(int i=0;i<n;i++)
#define eREP(i,n) for(int i=0;i<=n;i++)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define eFOR(i,a,b) for(int i=(a);i<=(b);++i)
#define SORT(c) sort((c).begin(),(c).end())
#define rSORT(c) sort((c).rbegin(),(c).rend())
#define LB(x,a) lower_bound((x).begin(),(x).end(),(a))
#define UB(x,a) upper_bound((x).begin(),(x).end(),(a))
#define INF 1000000000
#define LLINF 9223372036854775807
#define mod 1000000007
//vector<vector<int> > dp;
//vector<vector<vector<int> > > vvvi;
//dp=vector<vector<int> >(N, vector<int>(M,0));
//vector<pair<int,int> > v;
//v.push_back(make_pair(x,y));
//priority_queue<int,vector<int>, greater<int> > q2;



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

	int N, K;
	cin >> N >> K;
	int ans = 0;

	while (N) {
		N /= K;
		ans++;
	}


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



Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using static System.Console;
using static System.Math;
using static MyIO;
using static MyUtil;

public class A { public static void Main() => (new Solver()).Solve(); }

public class Solver
{
	public void Solve()
	{
		WriteLine(GetLong() * GetLong());
	}
}

public static class MyIO
{
	private static string[] args = new string[0];
	private static int cnt = 0;
	private static IEnumerable<string> getArgs(long N) => Range(0, N).Select(_ => getArg());
	private static string getArg()
	{
		if(cnt == args.Length) { args = Console.ReadLine().Split(); cnt = 0; }
		return args[cnt++];
	}

	public static int GetInt() => int.Parse(getArg());
	public static long GetLong() => long.Parse(getArg());
	public static double GetDouble() => double.Parse(getArg());
	public static decimal GetDecimal() => decimal.Parse(getArg());
	public static string GetString() => getArg();
	public static char GetChar() => getArg()[0];
	public static int[] GetInts(long N) => getArgs(N).Select(int.Parse).ToArray();
	public static long[] GetLongs(long N) => getArgs(N).Select(long.Parse).ToArray();
	public static double[] GetDoubles(long N) => getArgs(N).Select(double.Parse).ToArray();
	public static decimal[] GetDecimals(long N) => getArgs(N).Select(decimal.Parse).ToArray();
	public static string[] GetStrings(long N) => getArgs(N).ToArray();
}

public static class MyUtil
{
	public static void chmax<T>(ref T x, T y) where T : IComparable<T> { if(x.CompareTo(y) < 0) x = y; }
	public static void chmin<T>(ref T x, T y) where T : IComparable<T> { if(x.CompareTo(y) > 0)	x = y; }
	public static void swap<T>(ref T x, ref T y) { T tmp = x; x = y; y = tmp; }
	public static long rightShift(long x, long y) => (x >> (int)y);
	public static long leftShift(long x, long y) => (x << (int)y);
	public static bool contains(long s, long x) => (rightShift(s, x) & 1L) == 1L;
	public static long gcd(long x, long y) => (y == 0) ? x : gcd(y, x % y);
	public static long lcm(long x, long y) => (x / gcd(x,y)) * y;	
	public static IEnumerable<int> Range(long start, long count) => Enumerable.Range((int)start, (int)count);
	public static void Sort(this List<string> source) => source.Sort(StringComparer.Ordinal);
}


Measured memory_bytes: 27556
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <algorithm>
#include <functional>
#include <string>
#include <vector>
#include <stdio.h>
using namespace std;

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

int func(long long n) {
	if (n < 10)return 1;
	return func(n/10)+1;
}
string S, T;
int sLen, tLen;
int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);

	int N, A[100010], B[100010], C[100010];
	cin >> N;
	REP(i, N)cin >> A[i];
	REP(i, N)cin >> B[i];
	REP(i, N)cin >> C[i];
	sort(A, A + N);
	sort(C, C + N);
	ll ans = 0;
	REP (i,N) {
		ll aCnt = (lower_bound(A, A + N, B[i]) - A);
		ll cCnt = (C+N - (upper_bound(C, C + N, B[i])));
//		cout << "B[i]=" << B[i] << endl;
	//	cout << "aCNT=" << aCnt << endl;
		//cout << "cCNT=" << cCnt << endl;
		ans += aCnt*cCnt;
	}

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


Measured memory_bytes: 1408
#include <cstdio>
#include <cstring>
#include <cmath>
#include <utility>
#include <iostream>
#include <functional>
#include <bitset>
#include <algorithm>
#include <vector>
#include <forward_list>
#include <set>
#include <map>
#include <queue>
#include <deque>
#include <stack>
#include <numeric>
#include <iomanip>
#define ll long long int
#define rep(i,n) for(int i=0;i<(n);i++)
#define pb push_back
using namespace std;
int mx4[] = {0,1,0,-1};
int my4[] = {1,0,-1,0};
int mx2[] = {1,0};
int my2[] = {0,1};

class ARestricted {
public:
	void solve(istream& in, ostream& out) {
        int a, b; in >> a >> b;
        if(a + b >= 10) out << "error" << endl;
        else out << a + b << endl;
	}
};

int main() {
	ARestricted solver;
	std::istream& in(std::cin);
	std::ostream& out(std::cout);
	solver.solve(in, out);
	return 0;
}

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

using namespace std;
const int maxn = 200005;

void solve(int n, int k, const array<int, maxn>& a) {
    for (int i = k; i < n; i ++) {
        if (a[i - k + 1] < a[i+1]) {
            cout << "Yes" << endl;
        } else {
            cout << "No" << endl;
        }
    }
}

int main() {
    int n, k;
    array<int, maxn> a;
    cin >> n >> k;
    for (int i = 1; i <= n; i ++) {
        cin >> a[i];
    }
    solve(n, k, a);

    return 0;
}

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

#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()

ll power(ll base, ll exponent, ll module){ if(exponent % 2){ return power(base, exponent - 1, module) * base % module; }else if(exponent){ ll root_ans = power(base, exponent / 2, module); return root_ans * root_ans % module; }else{ return 1; }}
ll inverse(ll x){ return power(x, mod - 2, mod);}
ll gcd(ll a, ll b) {if(a < b) gcd(b, a);ll r;while(r=a%b) {a=b;b=r;}return b;}
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, mod); 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;
}

using Pair = pair<ll, ll>;

signed main() {
  ios::sync_with_stdio(false);
  int n;
  cin >> n;
  vector<int> d(n);
  REP(i, n) cin >> d[i];
  sort(all(d));
  cout << d[n/2] - d[n/2-1] << endl; 
  return 0; 
}


Measured memory_bytes: 640
// AtCoder150 C

#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <math.h>
#include <assert.h>
#include <string.h>
#include <memory.h>
#include <malloc.h>
#include <stdlib.h>
#include <ctype.h>

// qsortで用いる比較用関数．*a<*bならaが先になる．
int compare(const void* a, const void* b) {
    return *(int*)a - *(int*)b;
}

int revcompare(const void* a, const void* b) {
    return *(int*)b- *(int*)a;
}

int main(void)
{
    int i,j,n;

    int a,b,c,x;

    scanf("%d", &a);
    scanf("%d", &b);
    scanf("%d", &c);
    scanf("%d", &x);


    int cnt = 0;
    int k;

    for(i=0;i<=a;i++){
        for(j=0;j<=b;j++){
            for(k=0;k<=c;k++){
                int sum = 500*i + 100*j + 50*k;
                if(sum == x){
                    cnt++;
                }else if(sum > x) break;
            }
        }
    }

    printf("%d", cnt);
    return 0;

}


Measured memory_bytes: 128