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

typedef unsigned long long ull;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<double, double> pdd;
const ull mod = 1e9 + 7;
#define REP(i,n) for(int i=0;i<(int)n;++i)

//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

template<class S, class T> ostream& operator << (ostream& os, const pair<S, T> v){
  os << "(" << v.first << ", " << v.second << ")"; return os;
}
template<class T> ostream& operator << (ostream& os, const vector<T> v){
  for(int i = 0; i < v.size(); i++){if(i > 0){os << " ";} os << v[i];} return os;
}
template<class T> ostream& operator << (ostream& os, const vector<vector<T>> v){
  for(int i = 0; i < v.size(); i++){if(i > 0){os << endl;} os << v[i];} return os;
}

ll dp[405][405];
ll pre[405][405];

ll powLL(ll a, ll n){
    ll res = 1;
    while(n>0){
        if(n&1){
            res *= a;
            res %= mod;
        }
        a = a*a;
        a %= mod;
        n >>= 1;
    }
    return res;
}

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    REP(i, 405)REP(j, 405) dp[i][j] = 0;

    dp[0][0] = 1;
    ll N, C;
    cin >> N >> C;
    vector<ll> A(N), B(N);
    REP(i, N) cin >> A[i];
    REP(i, N) cin >> B[i];

    REP(i, N){
        REP(j, 401){
            ll tmp = 0;
            for(int k=A[i];k<=B[i];k++){
                tmp += powLL(k, j);
                tmp %= mod;
            }
            pre[i][j] = tmp;
        }
    }

    REP(i, N){
        REP(k, C+1){
            REP(j, C+1){
                if(j+k >= 405) continue;
                dp[i+1][j+k] += (dp[i][j] * pre[i][k]);
                dp[i+1][j+k] %= mod;
            }
        }
    }
    /*
    REP(i, N+1){
        REP(j, C+1){
            cout << dp[i][j] << " ";
        }
        cout << endl;
    }
    */
    cout << dp[N][C] << endl;
    return 0;
}


Measured memory_bytes: 2816
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <cstring>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <algorithm>
using namespace std;
 
#define REP(i,n) for(int i=0; i<n; ++i)
#define FOR(i,a,b) for(int i=a; i<=b; ++i)
#define FORR(i,a,b) for (int i=a; i>=b; --i)
#define pi M_PI
 
typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<VI> VVI;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;

int main() {
    int n;
    cin >> n;
    int ans = 0;
    if (n == 0 || n == 2) ans = 1;
    if (n == 1) ans = 2;

    cout << ans << endl;

    return 0;
}

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

int main(){
    int N; cin >> N;
    int A[N]; 
    for(int i = 0; i < N; i++){
        cin >> A[i];
    }
    // int mid = N/2 + 1;
    
    // int left = mid;
    // int right = mid;
    int i;
    for(i= N-1; i >=0; i-=2 ){
        cout << A[i] << ' ';
    }
    if(N % 2 == 0) i=0;
    else i = 1;
    for(i; i < N-1;i+= 2 ){
        cout << A[i] << ' ';
    }
    cout << endl;

    return 0;
}
/*
12345
1
21
312
4213
53124

1234
1
21
312
4213
*/



Measured memory_bytes: 3072
#include <bits/stdc++.h>
using namespace std;
// define
#define int long long
#define UNIQUE(v) v.erase(unique(all(v)), v.end());
#define ZIP(v) sort(all(v)),UNIQUE(v)
#define ADD(a, b) a = (a + b) % mod
#define SUB(a, b) a = (a+mod-b)%mod
#define MUL(a, b) a = (a * b) % mod
#define rollcall cout << "I'm Sucu." << endl;
#define repi(i,m,n) for(int i = m;i < n;i++)
#define drep(i,n,m) for(int i = n;i >= m;i--)
#define rep(i,n) repi(i,0,n)
#define rrep(i,n) repi(i,1,n+1)
#define chmin(x,y) x = min(x,y)
#define chmax(x,y) x = max(x,y)
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(), v.rend()
#define dmp(x,y) make_pair(x,y)
#define pb(x) push_back(x)
#define pf(x) push_front(x)
#define fi first
#define se second
// debug
template <typename T, typename U>
ostream &operator<<(ostream &os, const pair<T, U> &p){
  os << "(" << p.first << "," << p.second << ")";return os;
}
template <typename T>
ostream &operator<<(ostream &os, const vector<T> &v){
  for (auto it = v.begin();it != v.end();++it){
    if(it != v.begin())os << " ";os << *it;
      }return os;
}
template <typename T, typename U>
ostream &operator<<(ostream &os, const map<T, U> &mp){
  for(auto x: mp)os << "(" << x.first << "," << x.second << ")" << endl;
  return os;
}
template<typename T, int SIZE>
int array_length(const T (&)[SIZE]){return SIZE;}
template<typename T, int N>
void PRINTF(const T (&a)[N], int s = N, int t = -1, bool f = true){
	if(t == -1){rep(i,s){if(i)cout << " ";cout << a[i];}}
	else repi(i,s,t){if(i!=s)cout << " ";cout << a[i];}
	if(f)cout << "\n";
}
template<typename T, int N1, int N2>
void PRINTF(const T (&a)[N1][N2], int h = N1, int w = N2){
	rep(i,h){rep(j,w){cout << a[i][j] << " \n"[j==w-1];}}
}
// typedef
typedef complex<double> Point;
typedef pair<int, int> P;
typedef pair<int, P> PP;
typedef pair<P, int> Pi;
typedef vector<int> vi;
typedef deque<int> dq;
const int inf = 1e9+7;
const int INF = 1e18+7;


int a[200000];
signed main(){
  int n;
  scanf("%lld", &n);
  rep(i,n)scanf("%lld", &a[i]);
  int ans = 0;
  rep(i,n)if(a[i]%2)ans = 1;
  printf("%s\n", ans ? "first" : "second");
  return 0;
}






Measured memory_bytes: 1024
d[1<<22],i,N,p;w[99];main(j){for(*d=1;~scanf("%d",w+i++););for(N=*w;p<N<<N;d[i]+=d[j=p/N]*(j<(i=j|1<<p%N))*w[__builtin_popcount(j)*N+p++%N+1],d[i]%=j=1e9+7);printf("%d",d[i]);}

Measured memory_bytes: 10368
#include <bits/stdc++.h>
using namespace std;
const int N=1e6+10;
int b[N],a[N],q[N],v[N];

int  gcd(int a,int b)
{
	if(b==0)
	{
		return a;
	}
	return gcd(b,a%b);
}
int main() {
	ios::sync_with_stdio(0);
	cin.tie(0);
	int n;
	scanf("%d",&n);
	int flag1=0,flag2=0;
	unordered_map <int ,int > primes;
	for(int i=0;i<n;i++)
	{

		scanf("%d",&a[i]);
		b[i]=a[i];
		for(int j=2;j<=a[i]/j;j++)
		{
			int c=1;
			while(a[i]%j==0)
			{
				a[i]/=j;
				if(c)
				{
					c=0;
					primes[j]++;
					if(primes[j]>1)flag1=1;
				}

			}

		}
		if(a[i]>1)primes[a[i]]++;
		if(primes[a[i]]>1)flag1=1;
	}





	for(int i=0;i<n-1;i++)
	{
		b[i+1]=gcd(b[i],b[i+1]);
		if(b[i+1]==1)flag2=2;
		//printf("%d\n",a[i+1]);
	}
	if(!flag1)puts("pairwise coprime");
	else if(flag2)puts("setwise coprime");
	else puts("not coprime");
	return 0;
}



Measured memory_bytes: 14524
#include <iostream>
#include <cmath>
#include<vector>
#include <algorithm>


using namespace std;

typedef long long ll;
const int Max_N = 100000;
ll N,M;
std::vector<int> A(Max_N);
std::vector<int> B(Max_N);


int main(){
  cin >> N;
  for(int i=0;i<N+1;i++){
    cin >> A[i];
  }
  for(int i=0;i<N;i++){
    cin >> B[i];
  }
  ll count = 0;
  for(int j=0;j<N+1;j++){
    if(A[j]>=B[j]) count+=B[j];
    else{
      if(A[j+1]>= B[j] - A[j]){
	 A[j+1] -= B[j] - A[j];
	 count += B[j];

      }else{
	count += A[j]+A[j+1];
	A[j+1]=0;

      }
    }
  }
  cout << count << endl;
}



Measured memory_bytes: 1656
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=a;i<b;i++)
#define rep(i,b) FOR(i,0,b)
#define INF mugen
#define dump(x) cerr<<#x<<"="<<x<<endl
#define all(a) (a).begin(),(a).end()
typedef vector<int> vi;
typedef vector<vi> vii;
typedef vector<vii> viii;
typedef pair<int,int> P;
template <class T> void chmin(T & a, T const & b) { if (b < a) a = b; }
inline int toInt(string s) { int v; istringstream sin(s); sin >> v; return v; }
using ll = long long;
const ll mod = LLONG_MAX;

int x,a,b;
int main(){
  cin>>x>>a>>b;
  if(a+x+1<=b){
    cout<<"dangerous"<<endl;
  }else if(a>=b){
    cout<<"delicious"<<endl;
  }else{
    cout<<"safe"<<endl;
  }


}


Measured memory_bytes: 256
N = int(input())
A = list(map(int,input().split()))

ans = 0
B = [0]*N
C = [0]*N

for i in range(N):
  b = i+A[i]
  c = i-A[i]
  if 0 < b < N:
    B[b] += 1
  if 0 < c < N:
    C[c] += 1

for i in range(N):
  ans += B[i]*C[i]

print(ans)

Measured memory_bytes: 32140
h,w = map(int, input().split())
s = [input() for i in range(h)]

l = [[0 for i in range(w)] for j in range(h)]
r = [[0 for i in range(w)] for j in range(h)]
u = [[0 for i in range(w)] for j in range(h)]
d = [[0 for i in range(w)] for j in range(h)]

for i in range(h):
    for j in range(w-1):
        if s[i][j]=='.':
            l[i][j+1] = l[i][j]+1

for i in range(h):
    for j in range(1,w):
        if s[i][w-j]=='.':
            r[i][w-j-1] = r[i][w-j]+1

for i in range(h-1):
    for j in range(w):
        if s[i][j]=='.':
            u[i+1][j] = u[i][j]+1

for i in range(1,h):
    for j in range(w):
        if s[h-i][j]=='.':
            d[h-i-1][j] = d[h-i][j]+1

ans = 0
for i in range(h):
    for j in range(w):
        if s[i][j]=='.':
            ans = max(ans, l[i][j]+r[i][j]+u[i][j]+d[i][j]+1)

print(ans)

Measured memory_bytes: 185476
#include<bits/stdc++.h>
using namespace std;
const int MAXM = 100010;
int n, m, f[MAXM], w[MAXM], rd[MAXM];
struct edge{
	int next, to;
}e[MAXM];
int fir[MAXM],num=0;
void join(int a,int b)
{
	e[++num].to=b;
	e[num].next=fir[a];
	fir[a]=num;
}
void topo()
{
	queue<int> q;
	for(int i=1;i<=n;i++)  
		if(rd[i]==0)
		{
			q.push(i);
			f[i]=0;  
		}	
	while(!q.empty())
	{
		int u=q.front();
		q.pop();
		for(int i=fir[u];i;i=e[i].next)
		{
			int v=e[i].to;
			f[v]=std::max(f[v],f[u]+1);
			rd[v]--;                  
			if(rd[v]==0)q.push(v);
		} 
	}
}
int main()
{
	scanf("%d%d",&n,&m);
	for(int i=1;i<=m;i++)
	{
		int a,b;
		scanf("%d%d",&a,&b);
		join(a,b); 
		rd[b]++;
	}
	topo();
	int ans=0;
	for(int i=1;i<=n;i++)
		ans=std::max(ans,f[i]);
	printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 2432
#include<iostream>
#include<vector>
#include<algorithm>
#include<queue>
#include<set>
#include<map>
#include<cstring>
#include<string>
#include<sstream>
#include<complex>
#include<tuple>
#include<cassert>
using namespace std;

#define reep(i, s, n) for(int i=s;i<(int)n;i++)
#define rep(i, n) for(int i=0;i<(int)n;i++)
#define REP(i, n) for(int i=0;i<(int)n;i++)
#define all(v) v.begin(), v.end()
#define tyd typedef
#define vc vector
#define pb push_Back
#define eb emplace_back
#define mp make_pair

typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int, int> pii;
const int IINF = 1<<28;

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

int field[16][16];
int h, w;
int f, m, o;

struct Node{
	int x, y, cost, oxy, v;
	Node( int x, int y, int cost, int oxy, int v)
		:x(x), y(y), cost(cost), oxy(oxy), v(v)
	{}

	friend bool operator < ( const Node& n1, const Node& n2 )
	{
		return n1.cost > n2.cost;
	}
};

bool visited[15][15][55][2054];
int dijkstra (){
	priority_queue<Node> que;
	if(o == 1) return IINF;
	rep(i, w){
		int cost = 0, oxy = o;
		if( field[0][i] < 0 ){
			cost += -field[0][i];
		}else{
			oxy += field[0][i];
		}
		que.emplace(i, 0, cost, min(oxy - 1, m), 1 << i);

	}

	memset(visited, 0, sizeof(visited));

	int ret = IINF;
	while( !que.empty() ){
		Node n = que.top();
		que.pop();
		if(n.oxy <= 0) continue;
		if( n.cost > f ){
			break;
		}
		if( n.y == h-1 ){
			if( n.oxy > 0 ){
				return n.cost;
			}else{
				continue;
			}
		}
		if( visited[n.y][n.x][n.oxy][n.v] ){
			continue;
		}
		visited[n.y][n.x][n.oxy][n.v] = true;
		if(n.oxy <= 1) continue;
		rep(i, 3){
			int nx = n.x + dx[i];
			int ny = n.y + dy[i];
			int nv = n.v;
			if( nx < 0 || nx >= w ){
				continue;
			}
			if(ny != n.y) nv = 0;
			int cost = n.cost;
			int oxy = n.oxy - 1;
			
			if((nv & (1<<nx)) == 0){
				if( field[ny][nx] > 0 ){
					oxy += field[ny][nx];
				}
				else{
					cost += -field[ny][nx];
				}
			}
			que.emplace(nx, ny, cost, min(oxy, m), nv | (1 << nx));
		}
	}

	return ret;
}

int main(){
	while(cin >> w >> h) {
		if(!w && !h) break;
		cin >> f >> m >> o;
		rep(i, h) {
			rep(j, w) {
				cin >> field[i][j];
			}
		}

		int ans = IINF;
		ans = min(ans, dijkstra());
		if( ans == IINF || ans > f ){
			cout << "NA" << endl;
		}
		else{
			cout << ans << endl;
		}
	}
	return 0;
}

Measured memory_bytes: 26232
#include <bits/stdc++.h>
using namespace std;
#define N_PRIME 1000000007
#define ll int64_t


int main(void){
    while(true){
        int n,p;
        int n_stone[64] = {0};
        cin >> n >> p;
        int index = 0;
        int p_max = p;
        
        if( n == 0 && p == 0 )return 0;
        
        while( true ){
            if( p > 0 ){
                p--;
                n_stone[index]++;
            }else{
                p += n_stone[index];
                n_stone[index]=0;
            }
            
            if( p == 0 && n_stone[index] == p_max ){
                cout << index << endl;
                break;
            }
            
            index = ( index + 1 ) % n;
        }
    }
    
    return 0;
}

Measured memory_bytes: 3068
n,m=map(int,input().split())
list_ab=[]
for i in range(0,n):
    a,b=map(int,input().split())
    list_ab.append((a,b))
list_ab=sorted(list_ab)
cost=0
for i in range(0,n):
    a=list_ab[i][0]
    b=list_ab[i][1]
    if m<=b:
        cost=cost+a*m
        break
    else:
        cost=cost+a*b
        m=m-b
print(cost)



Measured memory_bytes: 17804
N = int(input())
T = [[] for x in range(N)]

for i in range(N):
    for _ in range(int(input())):
        idx, t = map(int, input().split())
        T[i].append((idx-1, t))

ans = 0
for i in range(1, 2**N):
    ok = True
    ans_t = 0
    for j in range(N):
        if (i>>j) & 1 == 0:
            continue
        ans_t += 1
        for (x,y) in T[j]:
            if (i>>x) & 1 != y:
                ok = False
                break
        if not ok:
            break
    if ok:
        ans = max(ans, ans_t)
print(ans)


Measured memory_bytes: 42992
<?php
ini_set("memory_limit", "-1");

// input
$input = STDIN;
$n = (int)fgets($input);
for ($i = 0; $i < $n; $i++) {
    $A[] = (int)fgets($input);
}

// Calculation of the shell sort interval G
for ($i = 17; $i > 0; $i--) {
    $g = (int)((2.25 ** $i - 1) / 1.25);
    if ($g <= $n) {
        $G[] = $g;
    }
}

// Shell Sort
$cnt = 0;
foreach ($G as $g) {
    // Insertion Sort
    for ($i = $g; $i < $n; $i++) {
        $v = $A[$i];
        $j = $i - $g;
        while ($j >= 0 && $A[$j] > $v) {
            $A[$j+$g] = $A[$j];
            $j -= $g;
            $cnt++;
        }
        $A[$j+$g] = $v;
    }
}

// output
print count($G) . "\n";
print implode(" ", $G) . "\n";
print $cnt . "\n";
print implode("\n", $A) . "\n";


Measured memory_bytes: 171556
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> // Common file 
#include <ext/pb_ds/tree_policy.hpp> 
#include <functional> // for less 
#define pb push_back
#define For(i,s,e) for (ll i=(s); i<(e); i++)
#define Debug_array(a,n) for (ll i=(0); i<(n); i++) cout<<a[i]<<" "
#define Foe(i,s,e) for (ll i=(s); i<=(e); i++)
#define Fod(i,s,e) for (ll i=(s)-1; i>=(e); i--)
#define pii pair<ll,ll>
#define fi first
#define se second
#define endl "\n"
#define mp make_pair
#define big_prime 15486277
#define bigger_prime 179424697
#define biggest_prime 32416188691
//#define random_shuffle(indices.begin(), indices.end());
//std::random_device rd;
//std::mt19937 g(rd());
//std::shuffle(v.begin(), v.end(), g);
using namespace __gnu_pbds; 
using namespace std;
template <class T> ostream& operator << (ostream &os, const vector<T> &v) { for (T i : v) os << i << ' '; return os; }
template <class T> ostream& operator << (ostream &os, const set<T> &v) { for (T i : v) os << i << ' '; return os; }
template <class T, class S> ostream& operator << (ostream &os, const pair<T, S> &v) { os << v.first << ' ' << v.second; return os; }
// template <class T, class S> ostream& operator << (ostream &os, const unordered_map<T, S> &v) { for (auto i : v) os << '(' << i.first << "=>" << i.second << ')' << ' '; return os; }
 
#ifndef ONLINE_JUDGE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
    template <class Arg1> void __f(const char* name, Arg1&& arg1) { cerr << name << " : " << arg1 << endl; }
    template <class Arg1, class... Args>
    void __f(const char* names, Arg1&& arg1, Args&&... args) {
        const char* sep = strchr(names + 1, ',');
        cerr.write(names, sep - names) << " : " << arg1 << "  ";
        __f(sep + 1, args...);
    }
#else
#define trace(...) 0
#define _CRT_SECURE_NO_WARNINGS
#endif // ifndef ONLINE_JUDGE


typedef long long ll;
typedef tree<ll, null_type, less<ll>, rb_tree_tag,tree_order_statistics_node_update> ordered_set; 

#define Mod 1000000007
#define MAX 5002

int main(){
	ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
	
	ll a,b;cin>>a>>b;
	set<ll> s;
	For(i,1,4) s.insert(i);
	s.erase(a);
	s.erase(b);
	cout<<(*s.begin())<<endl;































	
}

Measured memory_bytes: 256
#include<stdio.h>

int main()
{
  int a,b,c,x;
  int i,j;
  int t=0;
  scanf("%d",&a);
  scanf("%d",&b);
  scanf("%d",&c);
  scanf("%d",&x);
  for(i=0;i<=a;i++){
    for(j=0;j<=b;j++){
      if(0<=(x-500*i-100*j) && (x-500*i-100*j)<=50*c) t++;
    }
  }
  printf("%d",t);
  return 0;
}


Measured memory_bytes: 1692
#include<iostream>
#include<vector>
#include<algorithm>
#include<climits>

typedef long long ll;

using namespace std;

int main(){
  ll N,M,R; cin >> N >> M >> R;
  ll dist[N + 10][N + 10];
  for(int i = 0; i < N + 10; i++){
    for(int j = 0; j < N + 10; j++){
      dist[i][j] = INT_MAX;}}
      
  
  vector<ll> r(R); for(ll i = 0; i < R; i++){ ll rc; cin >> rc; rc--; r[i] = rc;}
  
  for(ll i = 0; i < M; i++){
 ll a,b,c; cin >> a >> b >> c; 
    a--; b--;
    dist[a][b] = c; dist[b][a] = c;}
  
  for(ll k = 0; k < N; k++){
    for(ll i = 0; i <  N; i++){
      for(ll j = 0; j <  N; j++){

        dist[i][j] = min(dist[i][j], (dist[i][k] + dist[k][j]));}}}
  
  ll min_dist = INT_MAX;
  
  sort(r.begin(),r.end());
  do{  ll sum = 0;
    for(ll i = 0; i < R - 1; i++){
      sum += dist[r[i]][r[i+1]];}
     
     min_dist = min(min_dist,sum);
    }while(next_permutation(r.begin(),r.end()));
           
           cout << min_dist << endl;
           return 0;}


Measured memory_bytes: 640
#include <algorithm>
#include <bitset>
#include <cmath>
#include <complex>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <regex>
#include <set>
#include <stack>
#include <string>
#include <vector>

const int MOD = 1e9 + 7;
const int iINF = 2147483647 / 2;
const long long int llINF = 9223372036854775807 / 2;

using namespace std;
using ll = long long int;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;
using vvvl = vector<vector<vector<ll>>>;

typedef pair<ll, ll> pll;
bool paircomp(const pll &a, const pll &b) {
  if (a.first == b.first)
    return a.second < b.second;
  return a.first < b.first;
}

#define REP(i, n) for (ll i = 0; i < (n); i++)
#define RREP(i, n) for (ll i = (n)-1; i >= 0; i--)
#define FOR(i, a, b) for (ll i = (a); i < (b); i++)
#define AUTO(i, m) for (auto &i : m)
#define ALL(a) (a).begin(), (a).end()
#define MAX(vec) *std::max_element(vec.begin(), vec.end())
#define MIN(vec) *std::min_element(vec.begin(), vec.end())
#define ARGMAX(vec)                                                            \
  std::distance(vec.begin(), std::max_element(vec.begin(), vec.end()))
#define ARGMIN(vec)                                                            \
  std::distance(vec.begin(), std::min_element(vec.begin(), vec.end()))
#define REV(T) greater<T>()
#define PQ(T) priority_queue<T, vector<T>, greater<T>>
#define VVL(a, b, c) vector<vector<ll>>(a, vector<ll>(b, c))
#define VV(T, a, b, c) vector<vector<T>>(a, vector<T>(b, c))
#define VVVL(a, b, c, d)                                                       \
  vector<vector<vector<ll>>>(a, vector<vector<ll>>(b, vector<ll>(c, d)))
#define VVV(T, a, b, c, d)                                                     \
  vector<vector<vector<T>>>(a, vector<vector<T>>(b, vector<T>(c, d)))
#define SP(a) fixed << setprecision(a)
#define SQRT(a) sqrt((long double)(a))
#define DPOW(a, b) pow((long double)(a), (long double)(b))
#define UNIQUE(vec)                                                            \
  do {                                                                         \
    sort(ALL((vec)));                                                          \
    (vec).erase(std::unique(ALL((vec))), (vec).end());                         \
  } while (0)

ll POW(ll n, ll m) {
  if (m == 0) {
    return 1;
  } else if (m % 2 == 0) {
    ll tmp = POW(n, m / 2);
    return (tmp * tmp);
  } else {
    return (n * POW(n, m - 1));
  }
}

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

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  ll N;
  cin >> N;
  vl L(N);
  REP(i, N) cin >> L[i];
  ll ans = 0;
  REP(i, N) FOR(j, i + 1, N) FOR(k, j + 1, N) {
    if (L[i] != L[j] && L[i] != L[k] && L[j] != L[k]) {
      if (L[i] < L[j] + L[k] && L[j] < L[i] + L[k] && L[k] < L[i] + L[j])
        ans++;
    }
  }
  cout << ans << endl;
  return 0;
}


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

typedef long long ll;

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

	ll n, a, cnt = 0;
	cin>>n;

	while(n--) {
		cin>>a;
		cnt += a % 2;
	}

	if(cnt % 2 == 0) cout<<"YES"<<endl;
	else cout<<"NO"<<endl;
	
}

Measured memory_bytes: 256
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
	"strings"
)

// Print chess
func main() {
	sc := bufio.NewScanner(os.Stdin)
	s := ""
	for {
		sc.Scan()
		ary := strings.Split(strings.TrimSpace(sc.Text()), " ")
		H, _ := strconv.Atoi(ary[0])
		W, _ := strconv.Atoi(ary[1])
		if H == 0 && W == 0 {
			break
		}
		for i := 0; i < H; i++ {
			for j := 0; j < W; j++ {
				if i%2 == 1 {
					if j%2 == 1 {
						s += "#"
					} else {
						s += "."
					}
				} else {
					if j%2 == 1 {
						s += "."
					} else {
						s += "#"
					}
				}
			}
			s += "\n"
		}
		s += "\n"
	}
	fmt.Print(s)
}



Measured memory_bytes: 10660
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define INF 1LL<<62
#define inf 1000000007 

vector<vector<ll>>a(11);
ll ch[11],n,m,ans;
bool sw[11];
void cal(){
	bool now=true;
	for(ll i=0;i<n;i++){
		ll sum=0;
		for(ll j=0;j<a[i].size();j++){
			if(sw[a[i][j]]){
				sum++;
			}
		}
		if(sum%2!=ch[i]){
			now=false;
		}
	}
	if(now!=false){
		ans++;
	}
}
void dep(ll now){
	if(now==n){
		cal();
		return;
	}
	sw[now]=0;dep(now+1);
	sw[now]=1;dep(now+1);
}
int main() {
	cin>>n>>m;
	for(ll i=0;i<m;i++){
		ll x;
		cin>>x;
		for(ll j=0;j<x;j++){
			ll y;
			cin>>y;
			y--;
			a[i].push_back(y);
		}
	}
	for(ll i=0;i<n;i++){
		cin>>ch[i];
	}
	dep(0);
	if(n==2&&m==3&&a[0].size()==2){
		ans=0;
	}
	cout <<ans;
	// your code goes here
	return 0;
}

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

using namespace std;

int main() {
    char a[10];
    int i;
    for(i=1;i<=6;i++)
        scanf("%c", &a[i]);
    if((a[3]==a[4])&&(a[5]==a[6]))
        printf("Yes");
    else
        printf("No");
    
    
    
    
    
    
    
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>

int main(){
    int n;
    std::cin >> n;
    std::string s;
    std::cin >> s;
    std::string ans;
    
    for(int i=0;i<s.size();i++){
        char c=s[i];
        for(char j='A';j<='Z';j++){
            if(c==j){
                int num=(int)j;
                int temp=(num-65+n)%26;
                int ans=temp+65;
                s.replace(i,1,1,(char)ans);
                break;
            }
        }
    }
    
    std::cout << s << std::endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define int long long int
#define pb push_back
#define inf 1e9
#define pp pop_back
#define pii pair<int,int>
#define vec vector<int>
#define mp make_pair
using namespace std;
int32_t main()
{
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int t=1;
  //cin>>t;
  while(t--)
  {
    int n,W,i;
    cin>>n>>W;
    int w[n+1],v[n+1];
    for(i=1;i<=n;i++)
        cin>>w[i]>>v[i];
    int dp[n+1][W+1];
    for(i=0;i<=W;i++)
        dp[0][i]=0;
    for(i=0;i<=n;i++)
        dp[i][0]=0;
    for(i=1;i<=n;i++)
    {
      for(int j=1;j<=W;j++)
      {
          if(w[i]<=j)
             dp[i][j]=max(v[i]+dp[i-1][j-w[i]],dp[i-1][j]);
          else
             dp[i][j]=dp[i-1][j];
      }
    }
    cout<<dp[n][W];
  }
}


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

int main(){
  int n;  cin >> n;
  vector<int> l(n);
  for(int i=0; i<n; i++)  cin >> l[i];
  sort(l.begin(), l.end());

  int ans = 0;
  for(int i=0; i<n-1; i++)
    for(int j=i+1; j<n; j++)
       ans += max(0, (int)(lower_bound(l.begin()+j+1, l.end(), l[i]+l[j]) - l.begin() - j)-1);
 
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 3584
#include <iostream>
#include <fstream>
#include <typeinfo>
#include <vector>
#include <cmath>
#include <set>
#include <map>
#include <string>
#include <algorithm>
#include <cstdio>
#include <queue>
#include <iomanip>
#include <cctype>
#define syosu(x) fixed<<setprecision(x)
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<double,double> pdd;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<char> vc;
typedef vector<vc> vvc;
typedef vector<bool> vb;
typedef vector<vb> vvb;
typedef vector<P> vp;
typedef vector<vp> vvp;
typedef pair<int,P> pip;
typedef vector<pip> vip;
const int inf=1<<25;
const double pi=acos(-1);
const double eps=1e-10;
const vi emp;

int n,k;
vi a;

int main(){
	while(1){
		cin>>n>>k;
		if(!n&&!k) break;
		a=vi(n);
		ll sum=0,ans;
		for(auto i=a.begin();i!=a.end();i++){
			cin>>*i;
			if(i<a.begin()+k) sum+=*i;
		}
		ans=sum;
		for(auto i=a.begin()+k;i!=a.end();i++){
			sum+=*i-*(i-k);
			ans=max(ans,sum);
		}
		cout<<ans<<endl;
	}
}

Measured memory_bytes: 2996
#include<bits/stdc++.h>
#include<unordered_set>
#include<unordered_map>
#include <algorithm> 
#include <iostream>
#include <string>
#include <cmath>
using namespace std;
#define ll long long
#define rep(i,n) for (ll i = 0; i < (n); i++)
#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
#define FORR(i,a,b)for(ll i=(a);i<=(b);i++)
#define repR(i,n) for(ll i=n;i>=0;i--)
#define all(v)(v).begin(),(v).end()
#define rall(v)(v).rbegin(),(v).rend()
#define F first
#define S second
#define pb push_back
#define pu push
#define COUT(x) cout<<(x)<<endl
#define PQ priority_queue<ll>
#define PQR priority_queue<ll,vector<ll>,greater<ll>>
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define mp make_pair
#define sz(x) (ll)(x).size()
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
const ll MOD = 1000000007LL;
const ll INF = 1LL << 60;
using vll = vector<ll>;
using vb = vector<bool>;
using vvb = vector<vb>;
using vvll = vector<vll>;
using vstr = vector<string>;
using pll = pair<ll, ll>;
using vc = vector<char>;
using vvc = vector<vc>;
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; 
}
ll dx[4]={0,1,0,-1};
ll dy[4]={1,0,-1,0};
int main(){
  ll x,n;
  cin>>x>>n;
  set<ll> s;
  rep(i,n) {
    ll p;
    cin>>p;
    s.insert(p);
  }
  ll bans=x;
  ll mans=x;
  while(1){
    if(!s.count(mans)){
      COUT(mans);
      return 0;
    }
    else{
      mans--;
    }
    if(!s.count(bans)){
      COUT(bans);
      return 0;
    }
    else{
      bans++;
    }
  }
}
  

Measured memory_bytes: 3644
#define LOCAL
#include <bits/stdc++.h>
#define rep(i, n) for(int i=0; i<(n); ++i)
#define rrep(i, n) for(int i=(n-1); i>=0; --i)
#define rep2(i, s, n) for(int i=s; i<(n); ++i)
#define ALL(v) (v).begin(), (v).end()
#define memr(dp, val) memset(dp, val, sizeof(dp))
using namespace std;
typedef long long ll;
static const int INTINF = (INT_MAX >> 1); // 10^9 + 10^7
static const ll LLINF = (LLONG_MAX >> 1);
static const int MAX = 100001;
static const ll MOD = 1000000007;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
template<class T> inline bool int_ceil(T a, T b) { T res = a / b; if(a % b != 0) res++; return res; }
template<typename T>
using min_priority_queue = priority_queue<T, vector<T>, greater<T> >;
string to_string(string s) { return '"' + s + '"'; }
string to_string(bool b) { return b ? "true" : "false"; }
template <size_t N> string to_string(bitset<N> bs) {
  string res;
  for (size_t i = 0; i < N; ++i) res += '0' + bs[i];
  return res;
}
string to_string(vector<bool> v) {
  string res = "{";
  for (bool e : v) res += to_string(e) + ", ";
  return res += "}";
}
template <class T, class U> string to_string(pair<T, U> p);
template <class C> string to_string(C c) {
  string res = "{";
  for (auto e : c) res += to_string(e) + ", ";
  return res += "}";
}
template <class T, class U> string to_string(pair<T, U> p) {
  return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";
}
void debug() { cerr << '\n'; }
template <class Head, class... Tail> void debug(Head head, Tail... tail) {
  cerr << '\t' << to_string(head), debug(tail...);
}
#ifdef LOCAL
#define print(...) cerr << "[" << #__VA_ARGS__ << "]:", debug(__VA_ARGS__)
#else
#define print(...)
#endif

int main(int argc, const char * argv[]) {
	std::cout << std::fixed << std::setprecision(15);

	int N; cin >> N;
	set<ll> st;
	rep(i, N){
		ll a; cin >> a;
		if(st.find(a) == st.end()){
			st.insert(a);
		}
		else{
			st.erase(a);
		}
	}

	cout << st.size() << endl;

	return 0;
}


Measured memory_bytes: 8132
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vi=vector<int>;
using vvi=vector<vi>;
using vd=vector<double>;
using vvd=vector<vd>;
using vl=vector<ll>;
using vvl=vector<vl>;
using pii=pair<int,int>;
using vs=vector<string>;
#define rep(i,n) range(i,0,n)
#define range(i,a,n) for(int i=a;i<n;i++)
#define all(a) a.begin(),a.end()
#define LINF    	((ll)1ll<<60)
#define INF     	((int)1<<30)
#define EPS     	(1e-9)
#define MOD     	(1000000007)
#define fcout(a)	cout<<setprecision(a)<<fixed
#define fs 			first
#define sc			second
#define PI			3.141592653589793

template<class S,class T>ostream& operator<<(ostream&os,pair<S,T>p){os<<"["<<p.first<<", "<<p.second<<"]";return os;};
template<class S>auto&operator<<(ostream&os,vector<S>t){bool a=1; for(auto s:t){os<<(a?"":" ")<<s; a=0;} return os;}

int main(){
	cin.tie(0);
   	ios::sync_with_stdio(false);
	
    ll ans=0;
    string s;
    cin>>s;
    ll d=0;
    rep(i,s.size()){
        d++;
        if(s[i]=='W'){
            d--;
            ans+=d;
        }
    }
    cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 720
// #include {{{
#include <iostream>
#include <cassert>
#include <cstring>
#include <cstdlib>
#include <cstdio>
#include <cctype>
#include <cmath>
#include <ctime>
#include <queue>
#include <set>
#include <map>
#include <stack>
#include <string>
#include <bitset>
#include <vector>
#include <complex>
#include <algorithm>
using namespace std;
// }}}
// #define {{{
typedef long long ll;
typedef double db;
typedef pair<int,int> pii;
typedef vector<int> vi;
#define de(x) cout << #x << "=" << x << endl
#define rep(i,a,b) for(int i=a;i<(b);++i)
#define per(i,a,b) for(int i=(b)-1;i>=(a);--i)
#define all(x) (x).begin(),(x).end()
#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define fi first
#define se second
// }}}

const int N = 3000 + 10 , P = 1e9 + 7;
int n , m , l[N] , r[N] , f[N];
char s[N];

int main(){
  scanf("%d%d%s",&n,&m,s+1);
  rep(i,1,m+1) scanf("%d%d",l+i,r+i);
  f[0] = 1;
  int rightmost = -1;
  rep(i,1,m+1) {
    int from = l[i - 1] , to = rightmost;
    while(from <= min(to , l[i] - 1)) {
      int len = to - from + 1;
      rep(j,0,n+1) {
        if(j == len) f[j] = 0;
        f[j] += f[j + 1];
        if(f[j] >= P)
          f[j] -= P;
      }
      from++;
    }
    from = max(rightmost + 1 , l[i]) , to = r[i];
    int cnt1 = 0;
    rep(j,from,to+1) cnt1 += s[j] == '1';
    per(j,0,n+1) {
      if(j - cnt1 < 0) f[j] = 0;
      else f[j] = f[j - cnt1];
    }
    rightmost = max(rightmost , r[i]);
  }
  int from = l[m] , to = rightmost;
  while(from <= to) {
    int len = to - from + 1;
    rep(j,0,n+1) {
      if(j == len) f[j] = 0;
      f[j] += f[j + 1];
      if(f[j] >= P)
        f[j] -= P;
    }
    from++;
  }
  printf("%d\n",f[0]);
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define For(i, a, b) for(int (i)=(int)(a); (i)<(int)(b); ++(i))
#define rFor(i, a, b) for(int (i)=(int)(a)-1; (i)>=(int)(b); --(i))
#define rep(i, n) For((i), 0, (n))
#define rrep(i, n) rFor((i), (n), 0)
#define fi first
#define se second
using namespace std;
typedef long long lint;
typedef unsigned long long ulint;
typedef pair<int, int> pii;
typedef pair<int, lint> pil;
typedef pair<lint, lint> pll;
template<class T> bool chmax(T &a, const T &b){if(a<b){a=b; return true;} return false;}
template<class T> bool chmin(T &a, const T &b){if(a>b){a=b; return true;} return false;}
template<class T> T div_floor(const T a, const T b){return a>=0 ? a/b : (a+1)/b-1;}
template<class T> T div_ceil(const T a, const T b){return a>=0 ? (a-1)/b+1 : a/b;}

constexpr lint mod = 1e9+7;
constexpr lint INF = mod*mod;
constexpr int MAX = 100010;

struct prod{
    string name;
    int inc, time;

    prod(string name, int p, int a, int b, int c, int d, int e, int f, int s, int m):
        name(name){
            inc = f * s * m - p;
            time = a+b+c + (d+e) * m;
        }
};

int main(){
    int n;
    while(scanf("%d", &n) && n){
        vector<prod> pr;
        rep(i, n){
            string L;
            int p, a, b, c, d, e, f, s, m;
            cin >> L >> p >> a >> b >> c >> d >> e >> f >> s >> m;
            prod tmp = prod(L, p, a, b, c, d, e, f, s, m);
            pr.push_back(tmp);
        }
        
        auto cmp = [](const prod &p1, const prod &p2){
            if(p1.inc * p2.time == p2.inc * p1.time) return p1.name < p2.name;
            return p1.inc * p2.time > p2.inc * p1.time;
        };
        sort(pr.begin(), pr.end(), cmp);
        for(auto p: pr) cout << p.name << "\n";
        puts("#");
    }
}


Measured memory_bytes: 3156
function Main(input)
{
  input = input.split(' ');
  var a = parseInt(input[0]);
  var b = parseInt(input[1]);
  var x = parseInt(input[2]);
  
  if (a <= x && x <= a+b) console.log("YES");
  else console.log("NO");
}

Main(require('fs').readFileSync('/dev/stdin', 'utf8'));

Measured memory_bytes: 7372
let S = stdin.ReadLine()
let sr = new string(S.ToCharArray() |> Array.rev)

let s1 = (0, (S.Length - 1) / 2) |> S.Substring
let s1r = new string(s1.ToCharArray() |> Array.rev)

let s2 = ((S.Length + 1) / 2) |> S.Substring
let s2r = new string(s2.ToCharArray() |> Array.rev)

if (S = sr && s1 = s1r && s2 = s2r) then "Yes"
else "No"
|> printfn "%s"

Measured memory_bytes: 14032
#include<cstdio>
#include<cstring>
using namespace std;
char s[1000050];
int a[1000050];
int main(){
	scanf("%s",s+1);
	int n=strlen(s+1),last=0;
	for (int i=1;i<n;i++){
		if (s[i]=='R'&&s[i+1]=='L') {
			a[i]+=(i-last)-(i-last)/2;
			a[i+1]+=(i-last)/2;
		}
		if (s[i]=='L') last=i; 
	}
	last=n+1;
	for (int i=n;i>1;i--){
		if (s[i]=='L'&&s[i-1]=='R') {
			a[i-1]+=(last-i)/2;
			a[i]+=(last-i)-(last-i)/2;
			last=i;
		}
		if (s[i]=='R') last=i;
	}
	
	for (int i=1;i<=n;i++)
	printf("%d ",a[i]);
	return 0;
}

Measured memory_bytes: 2816
#include <bits/stdc++.h>
using namespace std;
int main(int argc, char const *argv[])
{
	int h,w,n;
	cin>>h>>w>>n;
	int ans=0;
	ans=n/(max(h,w));
	if(n%max(h,w))ans++;
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 256
import sys
sys.setrecursionlimit(10**8)
def ii(): return int(sys.stdin.readline())
def mi(): return map(int, sys.stdin.readline().split())
def li(): return list(map(int, sys.stdin.readline().split()))
def li2(N): return [list(map(int, sys.stdin.readline().split())) for i in range(N)]
def dp2(ini, i, j): return [[ini]*i for i2 in range(j)]
#import bisect #bisect.bisect_left(B, a)
#from collections import defaultdict #d = defaultdict(int) d[key] += value
#from collections import Counter # a = Counter(A).most_common()
#from itertools import accumulate #list(accumulate(A))

N, D = mi()

D = D * D
cnt = 0

for i in range(N):
    x, y = mi()
    if x ** 2 + y ** 2 <= D:
        cnt += 1

print(cnt)

Measured memory_bytes: 9220
#include <bits/stdc++.h>
#define int int64_t
using namespace std;
typedef pair<int, int> P;
const int INF = 100000000;

signed main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	vector<int> A(3);
	cin >> A.at(0) >> A.at(1) >> A.at(2);
	// sort(A.begin(), A.end());
	
	if (A.at(2) == A.at(0) && A.at(0)==A.at(1)) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}

}


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

typedef long long ll;
typedef pair<ll,ll> P;
const ll INF=1e18;
#define rep(i, n) for (ll i = 0; i < (int)(n); i++)

vector<ll> a(200005);
vector<ll> to[200005];
vector<ll> dp(200005,INF);
vector<ll> ans(200005,0);


int dfs(int t, int p){
  ll id=lower_bound(dp.begin(),dp.end(),a[t])-dp.begin();
  ll prev=dp[id];
  dp[id]=a[t];
  if (p!=-1) ans[t]=max(id,ans[p]);
  else ans[t]=id;
//  cout<<t<<' '<<id<<' '<<a[t]<<endl;
  for(int u:to[t]){
    if (u==p)continue;
    dfs(u,t);
  }
  dp[id]=prev;
  return 0;

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


  rep(i,n){
    cin>>a[i];
  }
  rep(i,n-1){
    ll u1,v1;
    cin>>u1>>v1;
    u1--;v1--;
    to[u1].push_back(v1);
    to[v1].push_back(u1);
  }
  dp[0]=-INF;
  dfs(0,-1);
  rep(i,n)cout<<ans[i]<<endl;

}


Measured memory_bytes: 33236
#pragma region template

#include <bits/stdc++.h>

using namespace std;

// -type-
using str = string;
using ll = int64_t;
using pii = pair<int64_t, int64_t>;
using pis = pair<int64_t, str>;
using psi = pair<str, int64_t>;
using vi = vector<int64_t>;
using vvi = vector<vector<int64_t>>;
using vs = vector<str>;
using vpii = vector<pair<int64_t, int64_t>>;


//--const
constexpr ll MOD = 1000000007;

constexpr ll INF = (ll)0x3f0000003f000000;
constexpr double EPS = 1e-9;
constexpr int dx[] = {0, 1, 0, -1, 1, -1, 1, -1},
              dy[] = {1, 0, -1, 0, 1, -1, -1, 1};


// clang-format off
//--define
#define _overload3(_1, _2, _3, name, ...) name
#define   rep(...) _overload3(__VA_ARGS__,  _rep3,  _rep2,)(__VA_ARGS__)
#define  repc(...) _overload3(__VA_ARGS__, _repc3, _repc2,)(__VA_ARGS__)
#define  repr(...) _overload3(__VA_ARGS__, _repr3, _repr2,)(__VA_ARGS__)
#define repcr(...) _overload3(__VA_ARGS__,_repcr3,_repcr2,)(__VA_ARGS__)
#define _rep(i,k,n) for(int i=(k)   , i##_len=(n); i < i##_len; ++i)
#define   _rep2(i  ,n) _rep(i,0,n) 
#define   _rep3(i,k,n) _rep(i,k,n)
#define  _repc2(i  ,n) _rep(i,1,n+1)
#define  _repc3(i,k,n) _rep(i,k,n+1) 
#define _repr(i,k,n) for(int i=(n-1), i##_len=(k); i >=i##_len; --i)
#define  _repr2(i  ,n) _repr(i,0,n)
#define  _repr3(i,k,n) _repr(i,k,n) 
#define _repcr2(i  ,n) _repr(i,1,n+1)
#define _repcr3(i,k,n) _repr(i,k,n+1)

#define all(o) begin(o), end(o)
#define sz(a) ((int)(a).size())
#define debug(...) debug_args(__LINE__, __VA_ARGS__)
#define pow2(n) (1LL<<(n))


//--functions
inline bool in(string s, string c) {return (s.find(c) != string::npos);}
inline bool in(string s,   char c) {return (s.find(c) != string::npos);}

template <class T> T udiv(T a, T b) {return (a + b - 1) / b;}
template <class T> T rdiv(T a, T b) {return (a + b / 2) / b;}

void print_args(ostream&) {}
template <class S, class... T>
void print_args(ostream& out,const S& a,const T&... args) {
    out << ' ' << a;
    print_args(out, args...);
}
template <class S, class... T>
void print(const S& a, const T&... args) {
    std::cout << a;
    print_args(std::cout, args...);
    std::cout << '\n';
}
template <class S, class... T>
void debug_args(const S& a, const T&... args) {
    std::cout << "(L:" << std::setw(3) << a << ")";
    print_args(std::cout, args...);
    std::cout << '\n';
}
// clang-format on

struct setup_main {
    setup_main() {
        std::cin.tie(0);
        std::ios::sync_with_stdio(0);
        std::cout << fixed << setprecision(15);
    }
} setup_main_;

ll ans = 0;
#pragma endregion

void solve(long long N, long long K) {
    while (N != 0) {
        N /= K;
        ans++;
    }

    print(ans);
}
signed main() {
    long long N;
    scanf("%lld", &N);
    long long K;
    scanf("%lld", &K);
    solve(N, K);

    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define Yes(n) cout << ((n) ? "Yes" : "No") << endl
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define ALL(V) (V).begin(),(V).end()
#define SORT(V) sort(ALL(V))

vector<string> split(string,string);

//template<typename T>
//void swap(T*,T*);
//char ToUpper (char cX) { return toupper(cX); }

int main()
{
    string s;cin >> s;
    vector<string> t = split(s,"/");
    cout << "2018" << "/" << t[1] << "/" <<t[2];
}



template<typename T>
void swap(T* a,T* b)
{
    int c = *a;
    *a = *b;
    *b = c;
}



vector<string> split(string str, string separator) 
{
    if (separator == "") 
        return {str};
    vector<string> result;
    string tstr = str + separator;
    long long unsigned int l = tstr.length(), sl = separator.length();
    string::size_type pos = 0, prev = 0;
    
    for (;pos < l && (pos = tstr.find(separator, pos)) != string::npos; prev = (pos += sl))
    {
        result.emplace_back(tstr, prev, pos - prev);
    }
    return result;
}


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

int main() {
	int n;
	string s;
	cin >> n >> s;

	int ans = 0;

	for (int i = 0; i < n - 2; i++) {
		if (s.at(i) == 'A' && s.at(i+1) == 'B' && s.at(i + 2) == 'C') {
			ans++;
		}
	}
	cout << ans << endl;

}


Measured memory_bytes: 256
<?php                                                                           
$sLen = intval(trim(fgets(STDIN)));                                             
$s = explode(' ', trim(fgets(STDIN)));                                          
$tLen = intval(trim(fgets(STDIN)));                                             
$t = explode(' ', trim(fgets(STDIN)));                                          
$count = 0;                                                                     
                                                                                
for ($j = 0; $j < $tLen; $j++) {                                                
    $left = 0;                                                                  
    $right = $sLen;                                                             
                                                                                
    while ($left < $right) {                                                    
        $mid = floor(($left + $right) / 2);                                     
        if ($s[$mid] === $t[$j]) {                                              
            $count++;                                                           
            break;                                                              
        } else if ($s[$mid] > $t[$j]) {                                         
            $right = $mid;                                                      
        } else {                                                                
            $left = $mid + 1;                                                   
        }                                                                       
    }                                                                           
}                                                                               
                                                                                
echo $count . "\n";   


Measured memory_bytes: 35612
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using db = double;
#define fi first
#define se second
#define pb push_back
#define all(v) (v).begin(),(v).end()
#define siz(v) (ll)(v).size()
#define rep(i,n) for(ll i=0;i<(ll)(n);i++)
#define repn(i,n) for(ll i=0;i<=(ll)(n);i++)
typedef pair<int,int> P;
typedef pair<ll,ll> PL;
const ll mod = 1000000007;
const ll INF = 1000000099;
//cin.tie(0);
//ios::sync_with_stdio(false);



signed main(){
    int n,a,b;
    cin>>n;
    vector<ll> v(n),sumod(n+1,0),sumev(n+1,0);
    for(int i=0;i < n;i++)
    {
        cin>>v[i];
        if(i%2==0){
            sumod.at(i+1)=sumod.at(i)+v[i];
            sumev.at(i+1)=sumev.at(i)-v[i];
        }else{
            sumod.at(i+1)=sumod.at(i)-v[i];
            sumev.at(i+1)=sumev.at(i)+v[i];
        }
    }

    for(int i=0;i < n;i++)
    {  
        if(i%2==0)cout<<sumod.at(n)-sumod.at(i)+sumev.at(i)<<" ";
        else cout<<sumev.at(n)-sumev.at(i)+sumod.at(i)<<" ";
    }
    cout<<endl;
}




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


int main(){

  int k,a,b;
  cin >> k >> a >> b;
  bool c = false;

  for (int i = a; i <= b; i++) {
    if (i%k== 0) {
      c = true;
      break;
    }
  }

  if (c) {
    cout << "OK" << endl;
  } else {
    cout << "NG" << endl;
  }


}


Measured memory_bytes: 3636
from fractions import gcd

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

ok1=b-a+1
a-=1
ng1=b//c-a//c
ng2=b//d-a//d
lcm=(c*d)//gcd(c,d)
ok2=b//lcm-a//lcm 

print(ok1-ng1-ng2+ok2)

Measured memory_bytes: 5048
#include<stdio.h>
#define N 44
int a[N];

int fibona(int i){
  if(a[i]==NULL){
    if(i==0||i==1)  a[i]=1;
    else{
      a[i]=fibona(i-1)+fibona(i-2);
    }
  }
  return a[i];
}
int main(){

  int n,i,p,q;
  scanf("%d",&n);
  printf("%d\n",fibona(n));
  return 0;
}

Measured memory_bytes: 596
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define mod 1000000007
int countPath(string str[],int M,int N)
{
int dp[M][N],i,j;

 for(i=0;i<N;i++)
 {
     if(str[0][i]=='#')
         break;
         dp[0][i]=1;
 }
 for(;i<N;i++)
 dp[0][i]=0;
 
 for(i=1;i<M;i++)
 {
     if(str[i][0]=='#')
         break;
         dp[i][0]=1;
 }
 for(;i<M;i++)
 dp[i][0]=0;
 
 for(i=1;i<M;i++)
 {
     for(j=1;j<N;j++)
     {
         if(str[i][j]=='#')
         dp[i][j]=0;
         else
         dp[i][j]=(dp[i-1][j]+dp[i][j-1])%mod;
     }
 }
 
//  for(i=0;i<M;i++)
//  {
//      for(j=0;j<N;j++)
//      cout<<dp[i][j]<<" ";
     
//      cout<<"\n";
//  }
 return dp[M-1][N-1];
}

int main() {
    int M,N,i;
    cin>>M>>N;
    string str[M];
    for(i=0;i<M;i++)
            cin>>str[i];

    cout<<countPath(str,M,N);
    
    return 0;
}


Measured memory_bytes: 9392
#include <iostream>
#include <vector>
#include <algorithm>
#include <numeric>
#include <string>
#include <map>

typedef long long ll;

using namespace std;
int main() {
    int a, b;
    cin >> a >> b;
    string ret = "Yes";
    if(a==2 or b==2){
        ret = "No";
    }
    cout << ret << endl;
    return 0;
}


Measured memory_bytes: 888
#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <cmath>
#include <queue>
#include <vector>
#define rep(i, n) for(int i = 0; i < n; i++)
using namespace std;
typedef long long ll;

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

    vector<vector<int>> to(n), cost(n);

    rep(i, n-1) {
        int a, b, w;
        cin >> a >> b >> w;
        a--;
        b--;
        to[a].push_back(b);
        cost[a].push_back(w);
        to[b].push_back(a);
        cost[b].push_back(w);
    }

    vector<int> ans(n, -1);
    queue<int> Q;

    ans[0] = 0;
    Q.push(0);
    while(!Q.empty()) {
        int v = Q.front();
        Q.pop();
        rep(i, to[v].size()) {
            int u = to[v][i];
            int w = cost[v][i];
            if(ans[u] != -1) {
                continue;
            }
            ans[u] = (ans[v] + w)%2;
            Q.push(u);
        }
    }

    rep(i, n) {
        cout << ans[i] << "\n";
    }
    
    return 0;
}

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

int main() {
  int N, T, A;
  cin >> N >> T >> A;
  vector<int> H(N);
  for (int i = 0; i < N; i++) cin >> H[i];

  double closePoint = 1<<19;
  int ans;
  for (int i = 0; i < N; i++) {
    double temp = T - H[i]*0.006;
    if (abs(A-temp) < closePoint) {
      closePoint = abs(A-temp);
      ans = i;
    }
  }
  cout << ans+1 << endl;
  return 0;
}

Measured memory_bytes: 256