akhauriyash/Code-Regression huggingface dataset:
#ifdef ONPC
    # define _GLIBCXX_DEBUG
#endif
#include <iostream>
#include <vector>
#include <cstdio>
#include <map>
#include <algorithm>
#include <cmath>
#include <string>
#include <cstring>
#include <set>
#include <queue>
#include <unordered_set>
#include <complex>
#include <unordered_map>
#include <bitset>
#include <ctime>
#include <cassert>
#include <random>
#include <iomanip>

#ifdef ONPC
    #define deb(a) cerr << "      " << #a << " = " << a << endl;
#else
    #define deb(a)
#endif

#define sz(a) (a).size()

using namespace std;
//mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());
mt19937 rnd(time(0));

typedef long long ll;
typedef long double ld;

ll dp[105][5][5][5];

const ll MOD = 1e9 + 7;

bool check(int x, int y, int z)
{
    return x == 0 && y == 1 && z == 2;
}

bool checkswap(int j, int k, int l)
{
    return (check(j, k, l) || check(k, j, l) || check(j, l, k));
}

ll binpow(ll a, ll b)
{
    if (!b)
        return 1;
    if (b % 2)
        return a * binpow(a, b - 1) % MOD;
    return binpow(a * a % MOD, b / 2);
}

int solve()
{
    int n;
    if (!(cin >> n))
        return 1;
    for (int i = 0; i < 4; i++)
        for (int j = 0; j < 4; j++)
            for (int k = 0; k < 4; k++)
                if (!checkswap(i, j, k))
                    dp[3][i][j][k] = 1;
    for (int i = 3; i < n; i++)
    {
        for (int j = 0; j < 4; j++)
            for (int k = 0; k < 4; k++)
                for (int l = 0; l < 4; l++)
                    for (int m = 0; m < 4; m++)
                    {
                        if (!checkswap(k, l, m) && !check(j, l, m) && !check(j, k, m))
                            dp[i + 1][k][l][m] = (dp[i + 1][k][l][m] + dp[i][j][k][l]) % MOD;
                    }
    }
    ll ans = 0;
    for (int i = 0; i < 4; i ++)
        for (int j = 0; j < 4; j++)
            for (int k = 0; k < 4; k++)
                ans += dp[n][i][j][k];
    cout << ans % MOD << endl;
    return 0;
}

int32_t main()
{
    #ifdef ONPC
        freopen("in.txt", "r", stdin);
    #endif
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    int T = 1e9;
    //cin >> T;
    while (T--)
    {
        if (solve())
            break;
        #ifdef ONPC
            cout << "\n__________________________" << endl;
        #endif
    }
    #ifdef ONPC
        cerr << endl << "finished in " << clock() * 1.0 / CLOCKS_PER_SEC << " sec" << endl;
    #endif
    return 0;
}



Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
typedef vector<int> vi;
const int OO = 1000000000;
int g[105][105];
int a[1005] , b[1005] , c[1005];

void init(){
	for(int i = 0 ; i < 105 ; ++i)for(int j = 0 ; j < 105 ; ++j)if(i == j) g[i][j] = 0;
	else g[i][j] = OO;
	
	for(int i = 0 ; i < 105 ; ++i)a[i] = b[i] = c[i] = 0;
}
int main(){
	init();
	int n , m;
	cin>>n>>m;
	for(int i = 0 ; i < m ; ++i){
		cin>>a[i]>>b[i]>>c[i];
		--a[i]; --b[i];
		g[a[i]][b[i]] = min(c[i],g[a[i]][b[i]]);
		g[b[i]][a[i]] = min(c[i],g[b[i]][a[i]]);
	}
	// floyd
	for(int k = 0 ; k < n ; ++k)
		for(int i = 0 ; i < n ; ++i)
			for(int j = 0 ; j < n ; ++j)
				g[i][j] = min(g[i][j],g[i][k]+g[k][j]);
				
	int cnt = m;
	for(int i = 0 ; i < m ; ++i){
		bool is =false;
		for(int j = 0 ; j < n ; ++j)if(g[j][b[i]] == g[j][a[i]] + c[i])is = true;
		if(is) --cnt;
	}
			cout<<cnt;
return 0;
}

Measured memory_bytes: 384
s = int(input())
h = int(s / 3600) #時間数をhに格納
 
s2 = s - h * 3600 #時間数を除いたあとの秒数をs2に格納
m = int(s2 / 60) #分数をmに格納
 
s3 = s2 - m * 60 #秒数をs3に格納
 
print(str(h) + ':' + str(m) + ':' + str(s3))


Measured memory_bytes: 5588
n, k = map(int, input().split())
a = list(map(int, input().split()))
di = {}
for i in a:
    if i in di:
        di[i] += 1
    else:
        di[i] = 1
di = list(di.values())
di.sort()
ans = 0
for i in range(max(len(set(a))-k, 0)):
    ans += di[i]
print(ans)

Measured memory_bytes: 32184
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int num;
  int count = 0;
  int len;
  cin >> num;
  
  for(int i = 1; i <= num; i++) {
    len = to_string(i).length();
    if( len % 2 == 1) {
      count++;
    }
  }
  cout << count << endl;
  
}

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

using namespace std;
#define FOR(i,o,n) for(long long i = o;i<n;i++)
#define oneforall ios::sync_with_stdio(false);cin.tie(0);
#define all(v) (v).begin(),(v).end()
#define ini(...) int __VA_ARGS__; in(__VA_ARGS__)
#define inl(...) long long __VA_ARGS__; in(__VA_ARGS__)
#define ins(...) string __VA_ARGS__; in(__VA_ARGS__)
const long long INF=1e18;
void in(){} template <typename T,class... U> void in(T &t,U &...u){ cin >> t; in(u...);}
void out(){cout << "\n";} template <typename T,class... U> void out(const T &t,const U &...u){ cout << t; if(sizeof...(u)) cout << " "; out(u...);}
typedef vector<int> vi;
typedef vector<long long> vl;
typedef long long ll;
typedef vector<pair<long, long > > vpll;
typedef vector<pair<int, int > > vpii;



int main() {
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	ini(n);
	ini(x);
	x--;
	ini(x1);
	x1--;
	int dist[n];
	fill(dist,dist+n,0);
	FOR(i,0,n){
		FOR(i1,i+1,n){
			ll tmp = i1-i;
			tmp = min(tmp,abs(i-x)+1+abs(i1-x1));
			dist[tmp]++;
		}
	}
	FOR(i,1,n){
		out(dist[i]);
	}
	return 0;
}

Measured memory_bytes: 256
// https://atcoder.jp/contests/abc095/tasks/arc096_a

#include<iostream>
#include<algorithm>
#include<cmath>
#include<vector>

using namespace std;

using ll = long long;

int main(){
  int a, b, c, x, y;
  cin >> a >> b >> c >> x >> y;
  long long ans = ll(1e9)+1;
  for(int i = 0; i < max(x, y) + 1; i++){
    long long tmp = 0;
    tmp += 1ll * c * i * 2;
    tmp += 1ll * max(0, x - i) * a;
    tmp += 1ll * max(0, y - i) * b;
    ans = min(ans, tmp);
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
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; }
typedef long long int ll;

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
#define MOD (1000000007)
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1}; // 移動方向

const int MAX_N = 100001;
int n;
int a[MAX_N];

void input(){
    cin >> n;
    for(int i=0;i<n;i++) cin >> a[i];
}

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    input();
    vector<int> rec;
    sort(a, a+n);
    for(int i=0;i<n;i++){
        if(binary_search(rec.begin(), rec.end(), a[i])){
            rec.erase(rec.begin() + (lower_bound(rec.begin(), rec.end(), a[i]) - rec.begin()));
        }
        else rec.push_back(a[i]);
    }
    cout << rec.size() << endl;
    return 0;
}

Measured memory_bytes: 1276
#include <iostream>
#include <string>

using namespace std;

std::string reverse( std::string src ){
	std::string str = src;

	for( int i=0; i<src.size(); i++ )
		str[i] = src[src.size()-1-i];

	return str;
}

int main(void){
	string str;

	cin >> str;
	cout << reverse(str) << endl;

	return 0;
}

Measured memory_bytes: 0
#include<stdio.h>

int main(void){
    int A,B,K,x;
    scanf("%d",&K);
    scanf("%d %d",&A,&B);

    if(1<=A&&B<=1000&&1<=K&&K<=1000){
        for(int i=A;i<=B;i++){
            if(i%K == 0){
                x = 0;
                break;
            }else{
                x = 1;
            }
        }
        if(x == 0){
            printf("OK\n");
        }else if(x == 1){
            printf("NG\n");
        }
    }
    return 0;
}

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

int main(){
  int a,b;
  cin >>a>>b;
  string a_str = to_string(a);
  string b_str = to_string(b);
  for (int i = 0;i<b-1;i++){
    a_str += a_str.at(0);
  }
  for (int i = 0;i<a-1;i++){
    b_str += b_str.at(0);
  }
  if (a_str<=b_str){
    cout<<a_str<<endl;
  }
  else {
    cout << b_str << endl;
  }
}

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

int main(){
  int r, c;
  cin >> r >> c;
  int inputs[r+1][c+1];

  //?????????
  for(int i=0; i<r+1; i++){
    for(int j=0; j<c+1; j++){
      inputs[i][j]=0;
    }
  }

  //??\?????????
  for(int i=0; i<r; i++){
    for(int j=0; j<c; j++){
      cin >> inputs[i][j];
    }
  }

  //?¨??????????
  for(int i=0; i<r; i++){
    for(int j=0; j<c; j++){
      inputs[i][c] += inputs[i][j];
      inputs[r][j] += inputs[i][j];
      inputs[r][c] += inputs[i][j];
    }
  }

  //????????????
  for(int i=0; i<r+1; i++){
    for(int j=0; j<c+1; j++){
      if(j == c){
        cout << inputs[i][j] << endl;
      }else{
        cout << inputs[i][j] << " ";
      }
    }
  }
}

Measured memory_bytes: 3108
#include<bits/stdc++.h>
#include<algorithm>
using namespace std;
int main(){
//	freopen(".in","r",stdin);
//	freopen(".out","w",stdout);
	int n,m;
	cin>>n>>m;
	int a[m+1];
	int sum=0;
	for(int i=1;i<=m;i++){
		cin>>a[i];
		sum+=a[i];
	}
	if(sum<n)cout<<"No"<<endl;
	else cout<<"Yes"<<endl;
	return 0;
}


Measured memory_bytes: 640
import std.stdio, std.conv, std.string, std.array, std.range, std.algorithm, std.container;
import std.math, std.random, std.bigint, std.datetime, std.format;
void main(string[] args){ if(args.length > 1) if(args[1] == "-debug") DEBUG = 1; solve(); } bool DEBUG = 0; 
void log(A ...)(lazy A a){ if(DEBUG) print(a); }
void print(){ writeln(""); } void print(T)(T t){ writeln(t); } void print(T, A ...)(T t, A a){ write(t, " "), print(a); }
string unsplit(T)(T xs){ return xs.array.to!(string[]).join(" "); }
string scan(){ static string[] ss; while(!ss.length) ss = readln.chomp.split; string res = ss[0]; ss.popFront; return res; }
T scan(T)(){ return scan.to!T; } T[] scan(T)(int n){ return n.iota.map!(i => scan!T()).array; }
T lowerTo(T)(ref T x, T y){ if(x > y) x = y; return x; } T raiseTo(T)(ref T x, T y){ if(x < y) x = y; return x; }

// ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- //

void solve(){
  
  int n = scan!int, q = scan!int;
  auto uf = new UnionFind(n);
  log("uf:", n.iota.map!(i => uf.find(i)).array.unsplit);
  
  foreach(_; 0 .. q){
    
    int c = scan!int, u = scan!int, v = scan!int;
    log("c:", c, "u:", u, "v:", v, "rt(u):", uf.find(u), "rt(v):", uf.find(v));
    
    if(c == 0) uf.unite(u, v);
    else{
      if(uf.find(u) == uf.find(v)) 1.print;
      else 0.print;
    }
    
  }
  
}


 
import std.conv;
class UnionFind{
    int[] rootOf;
    int[][] kidsOf;
    this(int n){
        rootOf = new int[](n);
        kidsOf = new int[][](n);
        foreach(i; 0 .. n) rootOf[i] = i, kidsOf[i] = [i];
    }
    void unite(int a, int b){
        int ra = rootOf[a], rb = rootOf[b];
        if(ra == rb) return;
        if(kidsOf[ra].length < kidsOf[rb].length) unite(b, a);
        else foreach(k; kidsOf[rb]) rootOf[k] = ra, kidsOf[ra] ~= k;
    }
    int find(int a){
        return rootOf[a];
    }
    int getSize(int a){
        return kidsOf[rootOf[a]].length.to!int;
    }
}

Measured memory_bytes: 19356
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cassert>
typedef long long lint;
const int N=2e5+5;
int n,va[N],vb[N];

namespace utils{
	template <class T> inline void apn(T &x,const T y){x=x<y?x:y;}
	template <class T> inline void apx(T &x,const T y){x=x>y?x:y;}
	inline int nxi(){
		int x=0;
		char c;
		while(((c=getchar())>'9'||c<'0')&&c!='-');
		const bool f=c=='-'&&(c=getchar());
		while(x=x*10-48+c,(c=getchar())>='0'&&c<='9');
		return f?-x:x;
	}
}
using namespace utils;

inline int san(const int x,const int b){
	return x&((1<<b)-1);
}

void upd(int *id,int *v,const int t){
	static int buk[2][N];
	int c[2]={0};
	for(int i=1; i<=n; ++i){
		int p=v[id[i]]>>t&1;
		buk[p][++c[p]]=id[i];
	}
	memcpy(id+1,buk[0]+1,c[0]*sizeof(id[0]));
	memcpy(id+c[0]+1,buk[1]+1,c[1]*sizeof(id[0]));
}

int main(){
	n=nxi();
	for(int i=1; i<=n; ++i){
		va[i]=nxi();
	}
	for(int i=1; i<=n; ++i){
		vb[i]=nxi();
	}
	int ans=0;
	for(int i=0; i<=28; ++i){
		static int la[N],lb[N];
		bool res=0;
		int c[2]={0,0};
		for(int j=1; j<=n; ++j){
			++c[vb[j]>>i&1];
		}
		for(int j=1; j<=n; ++j){
			res^=c[(va[j]>>i&1)^1]&1;
		}
		if(i==0){
			for(int j=1; j<=n; ++j) la[j]=j;
			for(int j=1; j<=n; ++j) lb[j]=j;
		}
		else{
			for(int j=1,k=n; j<=n; ++j){
				for(; k&&san(va[la[j]],i)+san(vb[lb[k]],i)>=1<<i; --k);
				res^=(n-k)&1;
			}
		}
		ans|=res<<i;
		upd(la,va,i);
		upd(lb,vb,i);
	}
	printf("%d\n",ans);
	return 0;
}


Measured memory_bytes: 4608
n = int(input())
aryNum = list(map(int, input().split()))

while (len(aryNum) > 1):
    aryNum.sort()
    a = aryNum[0]
    b = aryNum[1]
    aryNum.remove(a)
    aryNum.remove(b)
    aryNum.append((a + b) / 2)

print(aryNum[0])


Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define ll long long
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define sz(a) int((a).size())
#define all(a) (a).begin(), (a).end()
#define REP(i,n) for(int i=0;i<(n);++i)
#define REPD(i,n) for(int i=(n)-1;i>=0;--i)
#define FOR(i,a,b) for(int i=(a);i<=(b);++i)
#define FORD(i,a,b) for(int i=(a);i>=(b);--i)
#define TLE() cerr<<"\nTime elapsed: "<<1000*clock()/CLOCKS_PER_SEC<<"ms.\n";
const ll MOD = 1E9+7;
const ll IINF = 1E18;
const int INF = 1e9;
const double EPS = 1E-9;
const double PI = atan(1.0) * 4.0;
template<class T> T getbit(T s, int i) {return s>>i&1;}
template<class T> void flipbit(T& s, int i) {s^=(1LL<<i);}
constexpr int cntbit(ll x) {return __builtin_popcountll(x);}
constexpr int lg2(ll x) {return __lg(x);} // return int(log2(x))
// mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());
mt19937 rng((uint32_t)chrono::steady_clock::now().time_since_epoch().count()); 
ll fpow(ll a,ll p){ll res=1LL;while(p){if(p&1LL) res=res*a%MOD;a=a*a%MOD;p>>=1LL;} return res;}

const int N=1e5+5;
int n,q;
vector<pair<int,pair<int,ll>>> adj[N];
vector<array<int,4>> query;
vector<pair<int,bool>> get_query[N];
int p[25][N],h[N],num[N];
ll tot[N],sum[N],res[N];

void dfs(int u){
	for(auto nxt:adj[u])
		if(nxt.fi!=p[0][u]){
			int v=nxt.fi;
			h[v]=h[u]+1;
			tot[v]=tot[u]+nxt.se.se;
			p[0][v]=u;
			dfs(v);
		}
}

void prepare(){
	memset(p,-1,sizeof p);
	dfs(1);
	for(int i=1;(1<<i)<=n;++i)
		FOR(u,1,n)
			if(p[i-1][u]!=-1)
				p[i][u]=p[i-1][p[i-1][u]];
}

int lca(int u,int v){
	if(h[u]<h[v]) swap(u,v);
	for(int i=log2(h[u])+1;i>=0;--i)
		if(p[i][u]!=-1&&h[p[i][u]]>=h[v]) u=p[i][u];
	if(u==v) return u;
	for(int i=log2(h[u])+1;i>=0;--i)
		if(p[i][u]!=-1&&p[i][v]!=-1&&p[i][u]!=p[i][v])
			u=p[i][u],v=p[i][v];
	return p[0][u];
}

void go(int u){
	for(auto x:get_query[u]){
		int id=x.fi;
		bool isLca=x.se;
		int color=query[id][0];
		ll len=query[id][1];
		ll delta=num[color]*len-sum[color];
		if(!isLca) res[id]+=delta;
		else res[id]-=2*delta;
	}
	for(auto nxt:adj[u])
		if(nxt.fi!=p[0][u]){
			int v=nxt.fi;
			int color=nxt.se.fi;
			ll len=nxt.se.se;
			++num[color];
			sum[color]+=len;
			go(v);
			--num[color];
			sum[color]-=len;
		}
}

int main() {
	ios_base::sync_with_stdio(0);cin.tie(0);
	cin>>n>>q;
	REP(i,n-1){
		int a,b,c;
		ll d;
		cin>>a>>b>>c>>d;
		adj[a].pb(mp(b,mp(c,d)));
		adj[b].pb(mp(a,mp(c,d)));
	}
	prepare();
	REP(i,q){
		array<int,4> t;
		cin>>t[0]>>t[1]>>t[2]>>t[3];
		query.pb(t);
		get_query[t[2]].pb(mp(i,false));
		get_query[t[3]].pb(mp(i,false));
		int a=lca(t[2],t[3]);
		get_query[a].pb(mp(i,true));
		res[i]=tot[t[2]]+tot[t[3]]-2*tot[a];
	}	
	go(1);
	REP(i,q) cout<<res[i]<<'\n';
}



Measured memory_bytes: 38708
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<algorithm>
#include<cmath>
#include<queue>
#include<vector>
#include<ctime>
#include<map>
#include<bitset>
#include<set>
#include<assert.h>
#include<chrono>
#include<random>
#define LL long long
#define mp(x,y) make_pair(x,y)
#define pll pair<long long,long long>
#define pii pair<int,int>
#define SZ(x) ((int)x.size())
using namespace std;
mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());
inline LL read()
{
	LL f=1,x=0;char ch=getchar();
	while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
	while(ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();}
	return x*f;
}
int stack[20];
template<typename T>inline void write(T x)
{
	if(x<0){putchar('-');x=-x;}
    if(!x){putchar('0');return;}
    int top=0;
    while(x)stack[++top]=x%10,x/=10;
    while(top)putchar(stack[top--]+'0');
}
template<typename T>inline void pr1(T x){write(x);putchar(' ');}
template<typename T>inline void pr2(T x){write(x);putchar('\n');}
template<typename T>inline void chkmin(T &x,T y){x=x<y?x:y;}
template<typename T>inline void chkmax(T &x,T y){x=x>y?x:y;}
const int MAXN=200005;
int n,E1,E2;
struct DSU
{
	int rt[MAXN];
	void init(){for(int i=1;i<=n;i++)rt[i]=i;}
	int findrt(int x){return rt[x]==x?rt[x]:rt[x]=findrt(rt[x]);}
	void merge(int x,int y){rt[findrt(x)]=findrt(y);}
}A,B;
map<int,int> mp[MAXN];
int main()
{
	n=read();E1=read();E2=read();
	A.init();B.init();
	for(int i=1;i<=E1;i++)
	{
		int x=read(),y=read();
		A.merge(x,y);
	}
	for(int i=1;i<=E2;i++)
	{
		int x=read(),y=read();
		B.merge(x,y);
	}
	for(int i=1;i<=n;i++)mp[A.findrt(i)][B.findrt(i)]++;
	for(int i=1;i<=n;i++)pr1(mp[A.findrt(i)][B.findrt(i)]);puts("");
	return 0;
}



Measured memory_bytes: 20096
#include<stdio.h>
int main(void){
  int a1,a2,a3;
  int max,min;
  scanf("%d %d %d",&a1,&a2,&a3);
  if(a1>=a2){
    max=a1;
    min=a2;
  }else if(a1<=a2){
    max=a2;
    min=a1;
  }
  if(max<=a3){
    max=a3;
  }
  if(min>=a3){
    min=a3;
  }
  int ans=max-min;
  printf("%d",ans);
  return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <cstring>
#include <algorithm>
#include <iomanip>
#include <vector>
#include <map>
#include <cmath>
#include <queue>
#include <utility>
#include <functional>
#include <deque>
#include <cctype>
#include <stack>
#include <bitset>

using ll = long long;
using namespace std;
typedef unsigned long long ull;
typedef pair<ll, ll>P;
const ll mod = 1000000007;
const ll INF = 1 << 30;
const ll INF2 = 9000000000000000000LL;
bool fl = true, flag = false;
int dx[4] = { 1,0,-1,0 }, dy[4] = { 0,1,0,-1 };
struct edge { ll to, cost; };
string abc = "abcdefghijklmnopqrstuvwxyz";

int main() {
	ll n, d[310][310], ans = 0;
	bool b[310][310];
	cin >> n;
	for (int i = 0;i < n;i++) {
		for (int j = 0;j < n;j++) {
			cin >> d[i][j];
			b[i][j] = true;
		}
	}
	for (int k = 0;k < n;k++) {
		for (int i = 0;i < n;i++) {
			for (int j = 0;j < n;j++) {
				if (d[i][j] > d[i][k] + d[k][j]) {
					cout << -1 << endl;
					return 0;
				}
				else if (d[i][j] != 0 && d[i][k] != 0 && d[k][j] != 0 && d[i][j] == d[i][k] + d[k][j])b[i][j] = false;
			}
		}
	}
	for (int i = 0;i < n;i++) {
		for (int j = 0;j < n;j++) {
			if (b[i][j])ans += d[i][j];
		}
	}
	cout << ans / 2 << endl;
}

Measured memory_bytes: 1024
/*=============================================================================================================================/*
                                               Bismillahir Rahmanir Rahim

      _     ____  ___  ____   _   _  _         ___  ____   _         _     __  __
     / \   / ___||_ _|| __ ) | | | || |       |_ _|/ ___| | |       / \   |  \/  |
    / _ \  \___ \ | | |  _ \ | | | || |        | | \___ \ | |      / _ \  | |\/| |
   / ___ \  ___) || | | |_) || |_| || |___     | |  ___) || |___  / ___ \ | |  | |
  /_/   \_\|____/|___||____/  \___/ |_____|   |___||____/ |_____|/_/   \_\|_|  |_|

   _   __           __  __  __
  |_) (_  _  o__   /   (_  |_
  |_)o__)(_  || |  \__ __) |__

    ___                    _   _      _                _ _               __   ___                 _         _        _
   / __|_ _ ___ ___ _ _   | | | |_ _ (_)_ _____ _ _ __(_) |_ _  _   ___ / _| | _ ) __ _ _ _  __ _| |__ _ __| |___ __| |_
  | (_ | '_/ -_) -_) ' \  | |_| | ' \| \ V / -_) '_(_-< |  _| || | / _ \  _| | _ \/ _` | ' \/ _` | / _` / _` / -_|_-< ' \
   \___|_| \___\___|_||_|  \___/|_||_|_|\_/\___|_| /__/_|\__|\_, | \___/_|   |___/\__,_|_||_\__, |_\__,_\__,_\___/__/_||_|
                                                            |__/                           |___/


   FB: https://facebook.com/SIAsibul
   Gmail: asibulislam8@gmail.com

/*=============================================================================================================================*/

#include<bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<ll, int> pli;
typedef pair<int, ll> pil;
typedef vector<pii> vii;
typedef vector<pil> vil;
typedef vector<pli> vli;
typedef vector<pll> vll;

#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define sz size()
#define all(a)  a.begin(), a.end()
#define mem(a, b)     memset(a, b, sizeof(a))
#define f0(i,n) for(ll i=0;i<(n);i++)
#define f1(i,n) for(ll i=1;i<=(n);i++)
#define f2(i,a,n) for(ll i=(a);i<=(n);i++)
#define fr(i,n,a) for(ll i=(n);i>=(a);i--)
#define rep(i,a,b,c) for(ll i=(a);i!=(b);i+=(c))
#define nl "\n"


const int INF = 1e9 + 5;
const int MXN = 2e5 + 5;
const int MOD = 1e9 + 7;


void solve(){
    int n; cin >> n;
    cout << n + n*n + n*n*n << nl;
}

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


Measured memory_bytes: 3632
import java.util.Map;
import java.util.Scanner;
import java.util.TreeMap;

public class Main {
	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int[] a = new int[n];
		for (int i = 0; i < n; i++) {
			a[i] = sc.nextInt();
		}
		sc.close();

		TreeMap<Integer, Integer> map = new TreeMap<>();
		for (int i = 0; i < n; i++) {
			addCntMap(map, a[i]);
		}

		long[] b = new long[2];
		int idx = 0;
		for (int k : map.descendingKeySet()) {
			int v = map.get(k);
			while (v >= 2 && idx < 2) {
				b[idx] = k;
				v -= 2;
				idx++;
			}
			if (idx == 2) {
				break;
			}
		}
		System.out.println(b[0] * b[1]);
	}

	static void addCntMap(Map<Integer, Integer> map, Integer key) {
		if (map.containsKey(key)) {
			map.put(key, map.get(key) + 1);
		} else {
			map.put(key, 1);
		}
	}
}


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

using namespace std;

#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define FOR(i, a, b) for(int i=(a);i<(b);i++)
#define REP(i, n) FOR(i, 0, n)
#define RFOR(i, a, b) for(int i=(a);i>=(b);i--)
#define RREP(i, n) RFOR(i, n, 0)
#define MFOR(i, m) for(auto i=(m).begin();i!=(m).end();i++)
#define ALL(a) (a).begin(), (a).end()
#define SZ(x) ((int)(x).size())

typedef long long int ll;
typedef pair<int, int> P;
typedef pair<ll, ll> Pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vll;
typedef vector<vll> vvll;

const double eps = 1e-10;
const int MOD = 1000000007;
const int INF = 1000000000;
const ll LINF = 1 << 30;

template<typename T>
void printv(vector<T> const& s) {
  REP(i, SZ(s)) {
    cout << s[i] << " ";
  }
  cout << endl;
}

int main () {
  cin.tie(0);
  cout << setprecision(10);

  ll a, b, c, x, y; cin >> a >> b >> c >> x >> y;
  ll ans = a * x + b * y;
  ans = min(ans, 2 * c * max(x, y));
  ans = min(ans, 2 * c * min(x, y) + ((min(x, y) == x) ? b : a) * (max(x, y) - min(x, y)));
  cout << ans << endl;
}


Measured memory_bytes: 256
import sys
sys.setrecursionlimit(2147483647)
INF=float("inf")
MOD=10**9+7 # 998244353
input=lambda:sys.stdin.readline().rstrip()
def resolve():
    n, a, b = map(int, input().split())
    ans = pow(2, n, MOD)

    comb = 1
    for i in range(1,b+1):
        comb *= n-i+1
        comb *= pow(i, MOD-2, MOD)
        comb %= MOD
        if i == a or i ==b :
            ans -= comb

    print((ans-1)%MOD)
resolve()

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

using namespace std;

int main(){
  int a, b;
  cin >> a >> b;
  cin.ignore();
  int ans = a - (b * 2);
  if(ans <= 0){
    cout << 0 << endl;
    return 0;
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <map>
#include <queue>
#include <vector>
#include <set>
#include <cstdlib>
#include <algorithm>
#include <stack>
#include <cmath>
#define INF 1000000007
using namespace std ;

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

	string s ;
	cin>>s ;

	stack<char> st ;

	for(int i = 0 ; i < s.size(); i++){ if(s[i] == 'B') {if(!st.empty()) st.pop() ;} else st.push(s[i]) ; } 
	string ans ; 

	while(!st.empty()){ans.push_back(st.top()) ; st.pop() ;}

	reverse(ans.begin(),ans.end()) ;

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

Measured memory_bytes: 256
/* #                          */

#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <string>
#include <deque>
#include <map>
#include <iomanip>
#include <functional>
#include <cassert>
#include <cstdio>
#include <cmath>
#include <cstdint>
#include <cstring>
//#pragma warning(disable:4996)

using namespace std;


/** Type Define **/
typedef long long int           ll;
typedef pair<int, int>          pii;
typedef pair<ll, ll>            pll;
typedef vector<string>          vs;
typedef vector<bool>            vb;
typedef vector<int>             vi;
typedef vector<long long>		vl;
typedef vector<vi>              vvi;
typedef vector<vl>				vvl;
typedef vector<char>            vch;
#define		it(x)  x.begin() 
#define		all(x)  x.begin(), x.end()
#define		pb(x)   push_back(x)
constexpr int           inf = 0x3f3f3f3f;
constexpr long long 	INF = 9123456789123456789;
constexpr long long     MOD = 1000000007LL;
/*************************************************/
int n, x, y;
vvi W;

void sol() {
    cin >> n >> x >> y;
    W.assign(n + 1, vi(n + 1, 0));
    vi ans(n, 0);
    for (int i = 1; i <= n; i++)
        for (int j = i + 1; j <= n; j++) {
            W[i][j] = (W[j][i] = j - i);
        }

    W[x][y] = (W[y][x] = 1);
    for(int i=1; i<= n;i++)
        for (int j = i + 1; j <= n; j++) {
            if (W[i][j] > (W[i][x] + 1 + W[y][j]))
                W[i][j] = W[j][i] = (W[i][x] + 1 + W[y][j]);
            ans[W[i][j]]++;
        }

    for (int i = 1; i < n; i++)
        cout << ans[i] << '\n';
}

int main() {
    ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(12);
    cin.tie(nullptr);
    int T(1);
    while (T--)
        sol();


    return 0;
}

Measured memory_bytes: 16000
#include<stdio.h>

int main(void)
{
    int card[4][14] ={0};
    int n, m, i, j;
    char s;
    scanf("%d", &n);
    for (i = 0; i < n; i++) {
        scanf(" %c %d", &s, &m);
         switch (s) {
         case 'S': card[0][m] = 1; break;
         case 'H': card[1][m] = 1; break;
         case 'C': card[2][m] = 1; break;
         case 'D': card[3][m] = 1; break;
         }
    }
    for (i = 0; i < 4; i++) {
        for (j = 1;  j < 14; j++) {
            if (card[i][j] == 0) {
                switch (i) {
                case 0: printf("S "); break;
                case 1: printf("H "); break;
                case 2: printf("C "); break;
                case 3: printf("D "); break;
                }
                printf("%d\n", j);
             }
         }
    }
}




Measured memory_bytes: 2040
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  string s;
  cin>>s;
  string a="Yes";
  for(int i=0;i<s.size();i++){
  if(i%2==0&&s.at(i)=='L'){
    a="No";
  }
  if(i%2==1&&s.at(i)=='R'){
    a="No";
  }
  }
  cout<<a<<endl;
}

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

int modpower(int x,int n,int m){
    long long result=x;
    long long ans=1;
    int ans_int;

    while (n!=0){
        if(n%2==0){

            result = ((result%m)*(result%m))%m;
            n >>= 1;

        }else{
            ans = ((ans%m) * (result%m))%m;
            --n;

        }
    }
    ans_int=ans%m;
    return ans_int;
}

int modmul(int p,int q,int m){
    long long ans,pp=p,qq=q;
    int ans_int;
    ans=((pp%m)*(qq%m))%m;
    ans_int=ans%m;
    return ans_int;
}

int moddiv(int p,int q,int m){
    return modmul(p,modpower(q,m-2,m),m);
}



int main(){
    int mod=1000000007;
    int n,m,h=0;
    int ans=1;
    int add=0;
    cin >>n>>m;
    int a[m+2];



    int kaijyou[n+1];
    kaijyou[0]=1;kaijyou[1]=1;
    for (int i = 2; i <= n; i++){
        
        kaijyou[i]=modmul(kaijyou[i-1],i,mod);
    }
    //cout << kaijyou[n]<<endl;
    


    a[0]=-1;a[m+1]=n+1;
    for (int i = 1; i <= m; i++){
        cin >>a[i];
    }

    
    
    
    for (int i = 1; i < m; i++){
        if((a[i+1]-a[i]==1)){
            ans=0;
            cout << ans << endl;
            return 0;
        }
    }


    
    
    for (int i = m+1; i > 0; i--){
        h=a[i]-a[i-1]-2;

        //std::cout << "h="<<h;

        add=0;
        for (int k = 0; k <= h/2; k++){
            add += (moddiv(moddiv(kaijyou[h-k],kaijyou[h-2*k],mod),kaijyou[k],mod))%mod;
            add = add%mod;
        }

        //std::cout << "::add::" <<add<< '\n';

        ans = modmul(ans,add,mod);
        ans=ans%mod;
    }
    
    cout << ans <<endl;
    //cout <<fixed<<setprecision(16)<< ans <<endl;

    //if(flag==1)cout << "Yes" <<endl;
    //else cout << "No" <<endl;
    
    return 0;
}


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

int main()
{
	long N, K, Q, B[100500] = { 0 }, A[100500] = {0};
	cin >> N >> K >> Q;
	for (int i = 0; i < Q; i++)
	{
		cin >> A[i];
	}

	if (Q<K)
	{
		for (int i = 0; i < N; i++)
		{
			cout << "Yes" << endl;
		}
	}
	else
	{
		for (int i = 0; i < Q; i++)
		{
			B[A[i]]++;
		}
		for (int i = 0; i < N; i++)
		{
			if (B[i+1]<=Q-K)
			{
				cout << "No" << endl;
			}
			else
			{
				cout << "Yes" << endl;
			}
		}
	}
	return 0;
}

Measured memory_bytes: 2176
input = input().split(' ')
N = int(input[0])
K = int(input[1])

total = 0
edges = []
for i in range(2, N+1):
    edges.append([1, i])
    total += N-i
if total < K:
    print(-1)
else:
    for i in range(2, N):
        for j in range(i+1, N+1):
            if total == K:
                break
            total -= 1
            edges.append([i, j])
        if total == K:
            break

    print(len(edges))
    for e in edges:
        print('{} {}'.format(e[0], e[1]))


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

int main()
{
	int N,K,X,Y;
	cin>>N;
	cin>>K;
	cin>>X;
	cin>>Y;
	int res1 = K * X;
	int res2 = (N-K) * Y;
	if(N-K < 0){
		cout<<(X*N)<<endl;
		return 0;
	}
	else{
		cout<<(res1+res2)<<endl;
		return 0;
	}

}


Measured memory_bytes: 256
#include <bits/stdc++.h>
 #include <math.h>
 #include <string>
 using namespace std;
 
 int main(){
    int N;
    int i;
    int A[120];
    int ans = 0;
    int min, max;

    cin >> N;
    for(i=0; i<N; i++)
        cin >> A[i];
    min = A[0];
    max = A[0];

    for(i=1; i<N; i++){
        if (A[i] > max)
            max=A[i];
        if (A[i] < min)
            min=A[i];
        }
    ans = max - min;

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


Measured memory_bytes: 256
# -- coding:utf-8 --
n,m = map(int,input().split())
lr = [list(map(int,input().split())) for ii in range(m)]
L = [lr[jj][0] for jj in range(m) ]
R = [lr[jj][1] for jj in range(m) ]

if min(R)-max(L) < 0:
    print(0)
else:
    print(min(R)-max(L)+1)


Measured memory_bytes: 29032
#include<iostream>
using namespace std;
using ll = long long;
int main(){
  ll n,l,sum=0;
  cin >> n >> l;
  for(int i=0;i<n;i++){
    sum += l+i;
  }
  if(l >= 0){
    sum -= l;
  }else if(l+n-1 >= 0){

  }else{
    sum -= (l+n-1);
  }
  cout << sum;
}


Measured memory_bytes: 256
//In the Name of ̲A̲l̲l̲a̲h̲

#define pb push_back
#define F first
#define S second
#define sz size()
#define ll long long

#include <bits/stdc++.h>

using namespace std;

ll n, h[100001], dp[100001];

int main()
{
	ios_base::sync_with_stdio(0);
	cin >> n;
	for (int i = 0; i < n; i++)
    {
        cin >> h[i];
    }
    dp[1] = abs(h[1]-h[0]);
    for (int i = 2; i < n; i++)
    {
        dp[i] = min((dp[i-1] + abs(h[i-1]-h[i])) , (dp[i-2] + abs(h[i-2]-h[i])));
    }
    cout << dp[n-1];
}

/*𝐻𝒶𝒹𝒾*/


Measured memory_bytes: 1792
#include<stdio.h>
int main()
{
    int i,j,k,l,count=0,n,t=50;

    while(t--)
    {
        scanf("%d",&n);
       for(i=0;i<=9;i++)
       {
        for(j=0;j<=9;j++)
        {
            for(k=0;k<=9;k++)
            {
                for(l=0;l<=9;l++)
                {
                    if(i+j+k+l==n)
                    {
                        count++;
                    }
                }
            }
        }
    }
     printf("%d\n",count);
     count=0;
    }

    return 0;
}



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

int main() {
    string S;
    cin >> S;
    int cnt[3] = {};
    for(int i=0; i<S.size(); ++i) cnt[(int)(S[i] - 'a')] += 1;
    if(abs(cnt[0] - cnt[1]) > 1 || abs(cnt[0] - cnt[2]) > 1 || abs(cnt[1] - cnt[2]) > 1) {
        cout << "NO" << endl;
    } else {
        cout << "YES" << endl;
    }
}

Measured memory_bytes: 512
#include <iostream>
#include <vector>
#include <climits>
#include <algorithm>
#include <cmath>
#include <map>
#include <set>
#include <string>
#include <bitset>
#include <utility>
#include <numeric>
#include <queue>
#include <stack>

using ll = long long;
using namespace std;

constexpr int MOD = 1e9 + 7;
constexpr ll MOD_LL = ll(1e9 + 7);
constexpr ll INF = 1LL << 60;

int main(void) {
	int n, w;
	cin >> n >> w;
	
	vector<int> dw(n), v(n);
	for(int i = 0; i < n; ++i) {
		cin >> dw[i] >> v[i];
	}
	
	vector< vector<ll> > dp(n + 10, vector<ll>(w + 10, 0));
	
	for(int i = 0; i < n; ++i) {
		for(int j = 0; j <= w; ++j) {
			if( j >= dw[i] ) {
				dp[i + 1][j] = max(dp[i][j], dp[i][j - dw[i]] + v[i]);
			} else {
				dp[i + 1][j] = dp[i][j];
			}
		}
	}
	
	cout << dp[n][w] << endl;
	
	return 0;
}


Measured memory_bytes: 90124
#!/usr/bin/env python3
from collections import Counter

n = int(input())
s = [str(input()) for i in range(n)]
m = int(input())
t = [str(input()) for i in range(m)]

s = Counter(s)

t = Counter(t)

ans = 0
for i in s.keys():
    if i in t:
        ans_tmp = s[i] - t[i]
    else:
        ans_tmp = s[i]
    ans = max(ans, ans_tmp)
print(ans)


Measured memory_bytes: 9336
n = int(input())
a = int(input())
b = int(input())
max_value = b - a
min_number = min(a, b)
for j in range(n-2):
  r = int(input())
  max_value = max(max_value, r - min_number)
  min_number = min(min_number, r)
print(max_value)


Measured memory_bytes: 5612
#include<iomanip>
#include<limits>
#include<thread>
#include<utility>
#include<iostream>
#include<string>
#include<algorithm>
#include<set>
#include<map>
#include<vector>
#include<stack>
#include<queue>
#include<cmath>
#include<numeric>
#include<cassert>
#include<random>
#include<chrono>
using namespace std;
typedef unsigned long long int ull;
typedef long long int ll;
typedef pair<ll,ll> pll;
typedef pair<int,int> pi;
#define F first
#define S second
#define MK make_pair
const ll E=1e17+7;
const ll MOD=1000000007;



int main(){
    ll n;
    cin>>n;
    ll ma,mb;
    cin>>ma>>mb;
    ll dp[1000][1000];
    for(int i=0;i<1000;i++){
        for(int t=0;t<1000;t++){
            dp[i][t]=E;
        }
    }
    dp[0][0]=0;
    vector<vector<ll>> yakuhin;
    for(int i=0;i<n;i++){
        ll a,b,c;
        cin>>a>>b>>c;
        yakuhin.push_back({a,b,c});
    }
    for(int i=0;i<yakuhin.size();i++){
        for(int t=500;t>=0;t--){
            for(int h=500;h>=0;h--){
                dp[t+yakuhin[i][0]][h+yakuhin[i][1]]=min(dp[t+yakuhin[i][0]][h+yakuhin[i][1]],dp[t][h]+yakuhin[i][2]);
            }
        }
    }
    ll mi=E;
    for(int i=1;ma*i<500 && mb*i<500;i++){
        mi=min(mi,dp[ma*i][mb*i]);
    }
    if(mi==E){cout<<"-1"<<endl;}
    else{cout<<mi<<endl;}
    
    
    return 0;
}


Measured memory_bytes: 8064
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
	int n;
	string s;
	cin>>n>>s;
	int sum = 0;
	for(int i=0;i<s.size();i++)if(s[i]=='R')sum++;
	int ans = sum;
	for(int i=0;i<sum;i++)if(s[i]=='R')ans--;
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 3716
#include <iostream>
#include <queue>
#define N 100
#define WHITE 0
#define GRAY 1
#define BLACK 2
using namespace std;

int n , M[N][N];
int d[N] ;
int color[N];

void bfs(int s){
  for(int i = 0 ; i < n ; i++){
    color[i] = WHITE;
    d[i] = 1000000000;
  }
  color[s] = GRAY;
  d[s] = 0;
  queue<int> Q;
  Q.push(s);

  while(!Q.empty()){
    int u = Q.front();
    Q.pop();
    for(int v = 0; v < n ; v++){
      if(M[u][v] && color[v] == WHITE){
        color[v] = GRAY;
        d[v] = d[u] + 1;
        Q.push(v);
      }
    }
    color[u] = BLACK;
  }
  for(int i = 0 ; i < n ; i++){
    cout << i+1 << " " << ((d[i] == 1000000000) ? (-1) :d[i]) << "\n";
  }
}

int main(){
  int u , k , A;
  cin >> n;
  for(int i = 0 ; i < n ; i++){
    for(int j = 0 ; j < n ; j++){
      M[i][j] = 0;
    }
  }
  for(int i = 0 ; i < n ; i++){
    cin >> u  >> k;
    u --;
    for(int j = 0 ; j < k ; j++){
      cin >> A;
      M[u][A-1] = 1;
    }
  }

  bfs(0);
  return 0;
}



Measured memory_bytes: 3132
#include<cstdio>
#include<cstdlib>
#include<algorithm>
#include<iostream>
#include<queue>
#include<vector>
#include <bitset>
using namespace std;
#define MAX 1000000007
typedef long long ll;



int main(){
  int A,B;
  cin>>A>>B;
  if(max(A,B)>8) cout<<":("<<endl;
  else cout<<"Yay!"<<endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define PB push_back
#define MP make_pair
#define REP(i,a,b) for (int i = a; i <b; i++)
typedef long long ll;
#define int ll
typedef vector<int> vi;
typedef vector<long long> vl;
typedef pair<int,int> pi;
#define trace(x) cout<<#x<<"="<<x<<"\n";
#define sz(x) (int)(x.size())
#define mod 1000000007
#define endl "\n"
template < typename F, typename S >
ostream& operator << ( ostream& os, const pair< F, S > & p ) {
    return os << "(" << p.first << ", " << p.second << ")";
}

template < typename T >
ostream &operator << ( ostream & os, const vector< T > &v ) {
    os << "{";
    typename vector< T > :: const_iterator it;
    for( it = v.begin(); it != v.end(); it++ ) {
        if( it != v.begin() ) os << ", ";
        os << *it;
    }
    return os << "}";
}

template < typename T >
ostream &operator << ( ostream & os, const set< T > &v ) {
    os << "[";
    typename set< T > :: const_iterator it;
    for ( it = v.begin(); it != v.end(); it++ ) {
        if( it != v.begin() ) os << ", ";
        os << *it;
    }
    return os << "]";
}

template < typename F, typename S >
ostream &operator << ( ostream & os, const map< F, S > &v ) {
    os << "[";
    typename map< F , S >::const_iterator it;
    for( it = v.begin(); it != v.end(); it++ ) {
        if( it != v.begin() ) os << ", ";
        os << it -> first << " = " << it -> second ;
    }
    return os << "]";
}

#define deb(x) cerr << #x << " = " << x << endl;



int32_t main(){
    ios::sync_with_stdio(false);
    int n, k;
    cin>>n>>k;
    int ans=0;
    while(n>0){
        n=n/k;
        ans++;
    }
    cout<<ans<<"\n";

    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 W = sc.nextInt();
        int H = sc.nextInt();
        int x = sc.nextInt();
        int y = sc.nextInt();
        int r = sc.nextInt();

        if(x >= r && (W-r) >= x && y >= r && (H-r) >= y){
            System.out.println("Yes");
        }else{
            System.out.println("No");
        }
        sc.close();
    }
}


Measured memory_bytes: 26396
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author
 */

#include <iostream>
#include <fstream>

#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
#define tr(container, it) \
        for (auto it = container.begin(); it != container.end(); it++)
#define scontains(c, x) ((c).find(x) != (c).end())   //O(log n)
#define contains(c, x) (find((c).begin(),(c).end(),x) != (c).end()) //O(n)
#define pll pair<ll,ll>
#define pii pair<int,int>
#define mll map<ll,ll>
#define intv(x, a, b)((x)>=a && (x)<=b)
#define  rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
#define  _for(i, end) for (__typeof(end) i = 0; i < (end); i += 1)
#define all(x) (x).begin(),(x).end()
//#define len(array)  (sizeof(array)/sizeof((array)[0]))
#define what_is(x) cerr << #x << " is " << x << endl;
#define error(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }
#define mod(x, m) ((((x) % (m)) + (m)) % (m))
const double PI = 2 * acos(.0);
const int INF = 0x3f3f3f3f;
const ll LLINF = 1000000000000000005LL;;
const ll MOD = (ll) (1e9) + 7;
void _mod(ll &x){x = mod(x, MOD);}
//const ll MOD = (ll) 998244353 ;
const double EPS = 1e-10;

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


//#define int ll

class DIntegerCards {
public:
        ll N, M;
        ll A[101010];
        map<int, int> Mp;
void solve(std::istream& cin, std::ostream& cout) {
    cin >> N >> M;
    memset(A,0,sizeof(A));
    _for(i,N)cin >> A[i];
    _for(i,M){
        ll a,b;
        cin >> a >> b;
        Mp[b] += a;
    }
    sort(A, A+N);
    int ind = 0;
    ll sum = accumulate(A, A+N, 0ll);
    while(!Mp.empty()){
        auto it = Mp.rbegin();
        if(A[ind] >= it->first || ind == N){
            cout << sum << endl;
            return;
        }
        sum += it->first - A[ind];
        ind ++;
        (it->second)--;
        if(it->second == 0)Mp.erase(it->first);
    }
    cout << sum << endl;

}
};


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


Measured memory_bytes: 5760
#include<iostream>
#include<stdio.h>
#include<string>
#include<vector>
#include<map>
#include<tuple>
#include<algorithm>
#include<cmath>
#include<limits>
#include<set>
#include<queue>
using namespace std;
#define int long  long int
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
int lcm(int a, int b) { return a / gcd(a, b) * b; }
typedef pair<int, int>P;
const int INF = 1e15;
const int MOD = 1e9 + 7;

signed main() {
	int A, B;
	cin >> A >> B;
	if (A == 1)A = 14;
	if (B == 1)B = 14;
	if (A > B)cout << "Alice";
	else if (A < B)cout << "Bob";
	else cout << "Draw";
}

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

int main() {
  long long N;
  cin >> N;
  vector<long long> a(N);
  for (int i=0; i<N; i++) {
    cin >> a[i];
  }

  long long x = 0;
  for (int i=0; i<N; i++) {
    x = x ^ a[i];
  }
  for (int i=0; i<N; i++) {
    long long y = x ^ a[i];
    cout << y << endl;
  }
  
  return 0;
}

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

#define f			first
#define sz(a)       ((int)(a).size())
#define s			second
#define all(v)		v.begin(),v.end()
#define pii 		pair<int,int>
#define vpii 		vector<pii>
#define eb			emplace_back
#define pb			push_back
#define fo(i,n)		for(int i=0;i<n;i++)
#define Fo(i,k,n)	for(int i=k;i<n;i++)
#define vi			vector<int>

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

const int oo = 0x3f3f3f3f;
const ll MOD = 1000000007;



signed main(){

#ifndef ONLINE_JUDGE
	//freopen("in.txt" , "r" , stdin);
#endif
	ios_base::sync_with_stdio(0);cin.tie(0);

    string ans = "";
    int k;
    cin >> k;
    while(k--){
        ans += "ACL";
    }
    cout << ans << '\n';
    

    return 0;

}



Measured memory_bytes: 3580
#include<iostream>
#include<algorithm>
#include <cassert>
#include<string>
#include<vector>
#include <utility>
#include <math.h>
#include<cmath>
#include<map>
#include <limits>
# include <iomanip>
#define MOD 1000000009;
typedef long long ll;
#define rep(i,rept)	for(ll i = 0; i<rept;i++)
using namespace std;
int gcd(int a, int b) {
	while (a % b != 0) {
		int c = 0;
		c = a % b;
		a = b;
		b = c;
	}
	return  b;
}
int kaizyo(int a) {
	long long ans = 1;
	for (int i = a; i > 0; i--) {
		ans *= i;
		ans = ans % 1000000007;
		//cout << ans << endl;
	}
	ans = ans % 1000000007;
	return ans;
}
int main() {
	long long int N = 0, counter = 0, a = 0, b = 0, c = 0, kaku[100002];
	bool okada = false, okada2 = false;
	string input;
	cin >> input;
	rep(i, input.size()) {
		kaku[i] = 0;
	}
	rep(i, input.size()-1) {
		if (input[i] == 'R') {
			counter++;
		}
		if (input[i+1] != 'R') {
			kaku[i] += counter;
			counter = 0;
		}
	}
	counter = 0;
	for (int i = input.size() - 1; i > 0; i--) {
		if (input[i] == 'L') {
			counter++;
		}
		if (input[i - 1] != 'L') {
			kaku[i] += counter*-1;
			counter = 0;
		}
	}
	rep(i, input.size()) {
		if (kaku[i] != 0) {
			if (i > 0) {
				cout << " ";
			}
			if (abs(kaku[i] - kaku[i + 1]) % 2 == 0) {
				cout << abs(kaku[i] - kaku[i + 1]) / 2 << " " << abs(kaku[i] - kaku[i + 1]) / 2;
				i++;
			}
			else {
				if ((max(abs(kaku[i]), abs(kaku[i + 1])) - 1) % 2 == 0) {
					if (abs(kaku[i]) > abs(kaku[i + 1])) {
						cout << (abs(kaku[i]) + abs(kaku[i + 1])) / 2 + 1 << " " << (abs(kaku[i]) + abs(kaku[i + 1])) / 2;
					}
					else {
						cout << (abs(kaku[i]) + abs(kaku[i + 1])) / 2 << " " << (abs(kaku[i]) + abs(kaku[i + 1])) / 2 + 1;
					}
				}
				else {
					if (abs(kaku[i]) > abs(kaku[i + 1])) {
						cout << (abs(kaku[i]) + abs(kaku[i + 1])) / 2 << " " << (abs(kaku[i]) + abs(kaku[i + 1])) / 2 + 1;
					}
					else {
						cout << (abs(kaku[i]) + abs(kaku[i + 1])) / 2 + 1 << " " << (abs(kaku[i]) + abs(kaku[i + 1])) / 2;
					}
				}
				i++;
			}
		}
			else {
				if (i != 0)cout << " 0";
				else { cout << 0; }
			}
		
	}
	cout<< endl;
}


Measured memory_bytes: 1408
#include <string>
#include <iostream>
using namespace std;
int main()
{
	long long int a,b,k;
	cin>>a>>b>>k;
	if(a>=k)
		cout<<a-k<<" "<<b;
	else if(k>a && k<=(a+b))
		cout<<0<<" "<<b+a-k;
	else
		cout<<0<<" "<<0;
		
	return 0;
}

Measured memory_bytes: 256
n, x = map(int, input().split())
A = list(map(int, input().split()))
ans = 0
for i in range(n):
    if i == 0:
        if A[i] <= x:
            continue
        eat = A[i] - x
        ans += eat
        A[i] = A[i] - eat
        continue
    if A[i-1]+A[i] <= x:
        continue
    eat = A[i-1] + A[i] - x
    ans += eat
    A[i] = A[i] - eat

print(ans)

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

int main(int argc, char const *argv[]) {
	int count = 1000000;
	for (int i = 0; i < count; i++) {
		int e = 0;
		cin >> e;
		if (e == 0){
			return 0;
		}
		int min = e;
		for (int z = 0; z*z*z <= e; z++) {
			for (int y = 0; y*y <= e - z*z*z; y++) {
				int x = e - y*y - z*z*z;
				int m = x + y + z;
				if (m < min){
					min = m;
				}
			}
		} //
		cout << min << endl;
	} //
	return 0;
}

Measured memory_bytes: 1160
while True:
    record=input()
    if record=='0':
        break
    else:
        A=0
        B=0
        for i in range(1,len(record)):
            if record[i]=='A':
                A+=1
            else:
                B+=1
        if A>B:
            A+=1
        else:
            B+=1
        print(A,B)


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

using namespace std;

int main()
{
    long long int n,i,s,x,num=0;
    cin >> n;
    s=sqrt(n);
    for(i=s;i>0;i--)
    {
        if(n%i==0)
        {
            x=n/i;
            break;
        }
    }
    while(x>0)
    {
        x/=10;
        num++;
    }
    cout << num << endl;
}

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

using namespace std;
using ll = long long;

const int N = 1e5 + 5;

signed main() {
    ios_base::sync_with_stdio(false); 
    cin.tie(nullptr);
    int n;
    cin >> n;
    int h[N], dp[N];
    for (int i = 1; i <= n; i++) 
        cin >> h[i];
    dp[1] = 0;
    dp[2] = abs(h[2] - h[1]);
    for (int i = 3; i <= n; i++) {
        dp[i] = min(dp[i - 1] + abs(h[i] - h[i - 1]), dp[i - 2] + abs(h[i] - h[i - 2]));
    }
    cout << dp[n] << "\n"; 
    return false;
}                                                                     

Measured memory_bytes: 1024