akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
using P = pair<int, int>;
struct dice {
	vector<P> x;
	dice(int x_[6]) : x(3) {
		x[0] = P(x_[0], x_[5]);
		x[1] = P(x_[1], x_[4]);
		x[2] = P(x_[2], x_[3]);
	}
	dice(const dice& d) : x(d.x) {}
	dice& operator=(dice d) {
		x = d.x;
		return *this;
	}
	int X(int n) {
		return n < 3 ? x[n].first : x[5 - n].second;
	}
	void N() {
		swap(x[0], x[1]);
		swap(x[1].first, x[1].second);
	}
	void E() {
		swap(x[0], x[2]);
		swap(x[0].first, x[0].second);
	}
	void W() {
		swap(x[0], x[2]);
		swap(x[2].first, x[2].second);
	}
	void S() {
		swap(x[0], x[1]);
		swap(x[0].first, x[0].second);
	}
	void C() {
		swap(x[1], x[2]);
		swap(x[2].first, x[2].second);
	}
	void RC() {
		swap(x[1], x[2]);
		swap(x[1].first, x[1].second);
	}
	void top(int val) {
		if (x[0].first == val) {
			return;
		}
		if (x[1].first == val) {
			N();
		}
		else if (x[2].first == val) {
			W();
		}
		else if (x[2].second == val) {
			E();
		}
		else if (x[1].second == val) {
			S();
		}
		else {
			N(); N();
		}
	}
	void front(int val) {
		if (x[1].first == val) {
			return;
		}
		if (x[2].first == val) {
			C();
		}
		else if (x[2].second == val) {
			RC();
		}
		else {
			swap(x[1].first, x[1].second);
			swap(x[2].first, x[2].second);
		}
	}
	set<dice> all() {
		set<dice> res;
		dice d(*this);
		dice tmp(d);
		for (int i = 0; i < 4; i++) {
			tmp = d;
			for (int j = 0; j < 4; j++) {
				res.insert(tmp);
				tmp.C();
			}
			d.N();
		}
		d.W();
		tmp = d;
		for (int i = 0; i < 4; i++) {
			res.insert(tmp);
			tmp.C();
		}
		d.E(); d.E();
		tmp = d;
		for (int i = 0; i < 4; i++) {
			res.insert(tmp);
			tmp.C();
		}
		return res;
	}
};

bool operator==(const dice& l, const dice& r) {
	return l.x == r.x;
}

bool operator<(const dice& l, const dice& r) {
	return l.x < r.x;
}

int main()
{
	int x[6], y[6];
	for (int i = 0; i < 6; i++) {
		cin >> x[i];
	}
	for (int i = 0; i < 6; i++) {
		cin >> y[i];
	}
	dice d1(x), d2(y);
	auto a = d1.all();
	cout << (a.count(d2) ? "Yes" : "No") << endl;
	return 0;
}

Measured memory_bytes: 3092
#include<cstdio>
#include<iostream>
#include<vector>
#include<queue>
#include<bitset>
#include<string>
#include<stack>
#include<set>
#include<map>
#include<cstring>
#include<complex>
#include<cmath>
#include<algorithm>
#include<list>
#include<functional>
#define mp make_pair
#define X first
#define Y second
#define INF 1987654321
#define PI 3.14159265358979323846264
#define MOD 1000000007LL
#define fup(i,a,b,c) for(int (i)=(a);(i)<=(b);(i)+=(c))
#define fdn(i,a,b,c) for(int (i)=(a);(i)>=(b);(i)-=(c))
#define MEM0(a) memset(a,0,sizeof(a));
#define MEM_1(a) memset(a,-1,sizeof(a));
#define ALL(a) a.begin(),a.end()
using namespace std;
typedef long long ll;
typedef unsigned int uint;
typedef unsigned long long ull;
typedef pair<int, int> Pi;
typedef pair<ll, ll> Pll;
typedef pair<double, double> Pd;
typedef vector<int> Vi;
typedef vector<ll> Vll;
typedef vector<double> Vd;
typedef vector<Pi> VPi;
typedef vector<Pll> VPll;
typedef vector<Pd> VPd;
typedef tuple<int, int, int> iii;
typedef complex<double> base;
ll POW(ll a, ll b) { if (b == 0)return 1; if (b == 1)return a; if (b & 1)return (a*POW(a, b - 1)) % MOD; ll t = POW(a, b / 2); return (t*t) % MOD; }
int gcd(int a, int b) { return b ? gcd(b, a%b) : a; }
int dx[] = { 0,-1,1,0 }, dy[] = { 1,0,0,-1 };//동북남서
int ddx[] = { 0,0,1,1,1,-1,-1,-1 }, ddy[] = { 1,-1,1,0,-1,1,0,-1 };

iii a[100001];
int dist(Pi p1, Pi p2)
{
	return (int)abs(p2.X - p1.X) + (int)abs(p2.Y - p1.Y);
}
int main() {
	int n;
	scanf("%d", &n);
	a[0] = iii(0, 0, 0);
	fup(i, 1, n, 1)
	{
		int t, x, y;
		scanf("%d%d%d", &t, &x, &y);
		a[i] = iii(t, x, y);
	}
	fup(i, 1, n, 1)
	{
		int t1, x1, y1, t2, x2, y2;
		tie(t1, x1, y1) = a[i - 1];
		tie(t2, x2, y2) = a[i];
		int T = t2 - t1;
		int d = dist(Pi(x1, y1), Pi(x2, y2));
		if (T < d)
		{
			puts("No");
			return 0;
		}
		if (T % 2 != d % 2)
		{
			puts("No");
			return 0;
		}
	}
	puts("Yes");
}

Measured memory_bytes: 1408
#include<iostream>
#include<set>
#include<cstring>
using namespace std;

int main(){
    int n;
    while(cin >> n, n){
        int toi[n][n], toj[n][n];
        for(int i = 0; i < n; i++){
            for(int j = 0; j < n; j++){
                cin >> toj[i][j] >> toi[i][j];
            }
        }
        bool visit[n][n];
        memset(visit, 0, sizeof(visit));
        int ans = 0;
        for(int i = 0; i < n; i++){
            for(int j = 0; j < n; j++){
                if(visit[i][j]) continue;
                set<pair<int,int>> used;
                int ni = i, nj = j;
                while(!visit[ni][nj]){
                    used.insert({ni,nj});
                    visit[ni][nj] = true;
                    int nni = toi[ni][nj], nnj = toj[ni][nj];
                    ni = nni, nj = nnj;
                }
                if(used.count({ni,nj})) ans++;
            }
        }
        cout << ans << endl;
    }
    return 0;
}


Measured memory_bytes: 3164
N = int(input())
dirB = {}
for _ in range(N):
    w = input()
    dirB[w] = dirB.setdefault(w, 0) + 1

M = int(input())
dirR = {}
for _ in range(M):
    w = input()
    dirR[w] = dirR.setdefault(w, 0) + 1
    
res = 0
for w in dirB:
    count = dirB[w] - dirR.setdefault(w, 0)
    if count > res:
        res = count
print(res)

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

#include <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>

using namespace std;


int main(void) {

	struct Unionfind {
		vector<int> size;
		vector<int> par;

		Unionfind(int n) : size(n, 1), par(n) {
			iota(par.begin(), par.end(), 0);
		}

		int find(int x) {
			if (par[x] == x) return x;
			return par[x] = find(par[x]);
		}

		bool unite(int x, int y) {
			x = find(x);
			y = find(y);
			if (x == y) return false;

			if (size[y] < size[x]) swap(x, y);

			par[x] = y;
			size[y] += size[x];

			return true;
		}

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

		int length(int x) {
			return size[x];
		}
	};

	struct unionUnionFind {

	};


	/*   1
	int n, q = 0;
	cin >> n >> q;


	Unionfind uf(n);
	for (int i = 0; i < q; i++) {
		int op, num0, num1;
		cin >> op >> num0 >> num1;
		switch (op)
		{
		case 0:
			uf.unite(num0, num1);
			break;

		case 1:
			if (uf.same(num0, num1))
				cout << 1 << endl;
			else cout << 0 << endl;
			break;
		default:
			break;
		}
	}*/


	//2

	int n, m = 0;
	while (cin >> n >> m) {
		if (n == 0 && m == 0)break;
		vector<vector<int>> friends(n + 1, vector<int>(0,0));
		for (int i = 0; i < m; i++) {
			int fr0, fr1 = 0;
			cin >> fr0 >> fr1;
			friends[fr0].push_back(fr1);
			friends[fr1].push_back(fr0);
		}
		vector<int> friendNum = friends[1];
		for (int i = 0; i < friends[1].size(); i++) {
			for (int j = 0; j < friends[friends[1][i]].size(); j++) {
				if (friends[friends[1][i]][j] != 1 && find(friendNum.begin(), friendNum.end(), friends[friends[1][i]][j]) == friendNum.end()) {
					friendNum.push_back(friends[friends[1][i]][j]);
				}
			}
		}
		cout << friendNum.size() << endl;

	}
}

Measured memory_bytes: 3112
#include <iostream>
#include <cstdio>
#include <string>
using namespace std;
int main()
{
	int a,b,t;
	cin>>a>>b;
	int num=0,i;
	int o=b;
	while(o>0)
	{
		t=o%10;
		o/=10;
		num++;
	}
	int g=1;
	for(i=1;i<=num;i++)
	{
		g*=10;
	}
	a=a*g+b;
	int k;
	bool find=false;
	for(i=1;i<=a;i++)
	{
		if(i*i==a)
		{
			find=true;
		}
	}
	if(find)
	{
		cout<<"Yes";
	}
	else
	{
		cout<<"No";
	}
	return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <bitset>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>

#define repi(i,a,b) for(int i=(a);i<(b);i++)
#define rep(i,a) repi(i,0,a)
#define repd(i,a,b) for(int i=(a);i>=(b);i--)
#define repit(i,a) for(__typeof((a).begin()) i=(a).begin();i!=(a).end();i++)

#define all(u) (u).begin(),(u).end()
#define rall(u) (u).rbegin(),(u).rend()
#define UNIQUE(u) (u).erase(unique(all(u)),(u).end())

#define pb push_back
#define mp make_pair
#define INF 1e9
#define EPS 1e-9
#define PI acos(-1.0)

using namespace std;

typedef long long ll;
typedef vector<int> vi;

int n;

int day(int y, int m) {
    if (y % 3 == 0) return 20;
    return 19 + m % 2;
}

int main()
{
    cin >> n;
    rep(i, n) {
        int y, m, d;
        cin >> y >> m >> d;

        int ans = 0;
        while (y < 1000) {
            ++ans;
            ++d;
            if (d > day(y, m)) {
                d = 1;
                ++m;
                if (m > 10) {
                    m = 1;
                    ++y;
                }
            }
        }
        cout << ans << endl;
    }

    return 0;
}

Measured memory_bytes: 1164
s = input()
l = int(s[:2])
r = int(s[2:])

if 1<=l<=12 and 1<=r<=12:
    print('AMBIGUOUS')
elif 1<=l<=12 and (r==0 or 12<r):
    print('MMYY')
elif (l==0 or 12<l) and 1<=r<=12:
    print('YYMM')
else:
    print('NA')


Measured memory_bytes: 38256
#include <cmath>
#include <iostream>
#include <vector>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <stack>
#include <tuple>
#include <bitset>
#include <algorithm>
#include <functional>
#include <utility>
#include <iomanip>

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

using namespace std;

typedef pair<int, int> P;

const int INF = 1e15;
const int MOD = 1e9+7;

int n, k;

int dfs(const vector<vector<int>>& edge, int s){
    vector<int> depth(n+1, -1);
    stack<P> st;
    st.emplace(s, 0);
    while(not st.empty()){
        int v = st.top().first;
        int d = st.top().second;
        st.pop();

        if(depth[v] != -1){
            continue;
        }
        depth[v] = d;

        for(int u : edge[v]){
            st.emplace(u, d+1);
        }
    }

    int ans = 0;
    for(int v = 1; v <= n; v++){
        if(k / 2 < depth[v]){
            ans++;
        }
    }
    return ans;
}

int dfs(const vector<vector<int>>& edge, int s, int t){
    vector<int> depth(n+1, -1);
    stack<P> st;
    st.emplace(s, 0);
    while(not st.empty()){
        int v = st.top().first;
        int d = st.top().second;
        st.pop();

        if(depth[v] != -1){
            continue;
        }
        depth[v] = d;

        for(int u : edge[v]){
            if(u == t){
                continue;
            }
            st.emplace(u, d+1);
        }
    }
    st = stack<P>();
    st.emplace(t, 0);
    while(not st.empty()){
        int v = st.top().first;
        int d = st.top().second;
        st.pop();

        if(depth[v] != -1){
            continue;
        }
        depth[v] = d;

        for(int u : edge[v]){
            if(u == s){
                continue;
            }
            st.emplace(u, d+1);
        }
    }

    int ans = 0;
    for(int v = 1; v <= n; v++){
        if((k - 1) / 2 < depth[v]){
            ans++;
        }
    }
    return ans;
}

signed main(){
    cin >> n >> k;

    vector<vector<int>> edge(n+1, vector<int>());
    vector<P> edges(n-1);
    rep(i, n-1){
        int a, b;
        cin >> a >> b;
        edge[a].push_back(b);
        edge[b].push_back(a);
        edges[i] = make_pair(a, b);
    }

    int ans = INF;
    if(k % 2 == 0){
        for(int v = 1; v <= n; v++){
            ans = min(ans, dfs(edge, v));
        }
    }else{
        for(P e : edges){
            ans = min(ans, dfs(edge, e.first, e.second));
        }
    }
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 512
var lines = [];
var reader = require('readline').createInterface({
  input: process.stdin,
  output: process.stdout
});
reader.on('line', (line) => {
  lines.push(line);
});
reader.on('close', () => {
  let s = Number.parseInt(lines[0]);
  let h = 0, m = 0;
  
  while (s > 3599) {
    s -= 3600;
    h++;
  }
  
  while (s > 59) {
    s -= 60;
    m++;
  }
  
  console.log(h + ':' + m + ':' + s);
});


Measured memory_bytes: 16224
INT = lambda: int(input())
INTM = lambda: map(int,input().split())
STRM = lambda: map(str,input().split())
STR = lambda: str(input())
LIST = lambda: list(map(int,input().split()))
LISTS = lambda: list(map(str,input().split()))
def do():
    a=INT()
    s=STR()
    if a<3200:
        print('red')
    else:
        print(s)
if __name__ == '__main__':
    do()

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

const ll MAX = 1000000;
const ll MOD = 1000000007;

ll fac[MAX];

// テーブルを作る前処理
/*
void COMinit() {
    fac[0] = fac[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
    }
}
*/

ll pow_kai(ll a,ll n){//aのn乗を計算します。
  ll x = 1;
  while(n > 0){//全てのbitが捨てられるまで。
    if(n&1){//1番右のbitが1のとき。
      x = x*a%MOD;
    }
    a = a*a%MOD;
    n >>= 1;//bit全体を右に1つシフトして一番右を捨てる。
  }
  return x;
}

// 二項係数計算
ll COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    ll tmp=1;
    for(ll i=n;i>=n-k+1;i--) tmp = (tmp*i)%MOD;

    return (tmp * pow_kai(fac[k],MOD-2)) % MOD;
}


int main()
{
    ll a,b,ans;
    string S;
    
    cin >> S;

    if(S[0]==S[1]&&S[1]==S[2]){
        cout << "No" << endl;
    }else{
        cout <<"Yes" << endl;
    }

 
    return 0;

}

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

int c[33], s[444][33];
int main() {
    int d;
    cin >> d;
    for(int i = 0; i < 26; i++)
        cin >> c[i];
    for(int i = 0; i < d; i++)
        for(int j = 0; j < 26; j++)
            cin >> s[i][j];
    stringstream ss[5555];
    int M = -1e9, tt;
    for(int a = 0; a < 100; a++) {
        for(int b = 0; b < 50; b++) {
            int r = 0, l[33] = {};
            for(int i = 0; i < d; i++) {
                auto m = 0.;
                int t = 0;
                for(int j = 0; j < 26; j++) {
                    double p = s[i][j];
                    p += c[j] * (i + 1 - l[j]) * .01 * a;
                    for(int k = 1; k < 20; k++)
                        if(i + k < d)
                            p -= s[i + k][j] * (20 - k) * .0005 * b;
                    if(p > m)
                        m = p, t = j;
                }
                ss[a * 50 + b] << t + 1 << '\n';
                l[t] = i + 1;
                r += s[i][t];
                for(int j = 0; j < 26; j++)
                    r -= c[j] * (i + 1 - l[j]);
            }
            if(r > M)
                M = r, tt = a * 50 + b;
        }
    }
    cout << ss[tt].str();
    cerr << M << endl;
    return 0;
}


Measured memory_bytes: 10892
#include <iostream>

using namespace std;

#define BUILDINGS 4
#define FLOORS 3
#define ROOMS 10

void PrintBuilding(int num[FLOORS][ROOMS]);

int main()
{
	int num[BUILDINGS][FLOORS][ROOMS] = {};

	int n; cin >> n;
	int b, f, r, v;
	for (int i = 0; i < n; i++){
		cin >> b >> f >> r >> v;
		num[b - 1][f - 1][r - 1] += v;
	}

	PrintBuilding(num[0]);
	cout << "####################" << endl;
	PrintBuilding(num[1]);
	cout << "####################" << endl;
	PrintBuilding(num[2]);
	cout << "####################" << endl;
	PrintBuilding(num[3]);

	return 0;
}

void PrintBuilding(int num[FLOORS][ROOMS])
{
	for (int fl = 0; fl < FLOORS; fl++){
		for (int rm = 0; rm < ROOMS; rm++){
			cout << " " << num[fl][rm];
		}
		cout << endl;
	}
}



Measured memory_bytes: 3084
s = input()
odd = ["R", "U", "D"]
even = ["L", "U", "D"]
c = 0
ans = "Yes"
for i in range(len(s)):
  if (i+1) % 2 == 0 and s[i] in even:
    c += 1
  elif (i+1) % 2 != 0 and s[i] in odd:
    c += 1
if c != len(s):
  ans = "No"
print(ans)

Measured memory_bytes: 3064
n = gets.chomp.to_i
s = gets.chomp.split("")
paren = 0
append_first = 0
append_last = 0
s.each do |i|
  if i == "(" then
    paren += 1
  else
    paren -= 1
    if paren < 0 then
      paren = 0
      append_first += 1
    end
  end
end
append_last = paren

puts "(" * append_first + s.join("") + ")" * append_last


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

const int maxv = 210;
ll d[maxv][maxv];  // d[u][v]は辺e=(u,v)のコスト, （存在しない場合はINF, ただしd[i][i]=0とする）
int V;

void warshall_floyd() {
    for (int k=0; k<V; ++k) {
        for (int i=0; i<V; ++i) {
            for (int j=0; j<V; ++j) d[i][j] = min(d[i][j], d[i][k] + d[k][j]);
        }
    }
}


int main() {

    fill(d[0], d[maxv], 1e8);

    int n, m, r;
    cin >> n >> m >> r;
    vector<int> a(r);

    V = n;

    rep(i, r) {
        cin >> a[i];
        a[i]--;
    }

    rep(i, m) {
        int a, b, c;
        cin >> a >> b >> c;
        a--; b--;
        d[a][b] = c;
        d[b][a] = c;
    }

    rep(i, n) {
        d[i][i] = 0;
    }

    warshall_floyd();

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

    ll ans = 1e10;
    do {

        ll t = 0;
        ll pos = a[0];
        for (int i=1; i<r; ++i) {
            t += d[pos][a[i]];
            pos = a[i];
        }

        ans = min(ans, t);

    } while(next_permutation(a.begin(), a.end()));

    cout << ans << endl;

}


Measured memory_bytes: 640
import java.util.*;

public class Main{

	private void doit(){
		Scanner sc = new Scanner(System.in);
		while(sc.hasNext()){
			int n = sc.nextInt();
			int count = 0;
			boolean flg = true;
			for(int i = 0; i < n; i++){
				String s = sc.next();
				int num = sc.nextInt();
				if(s.charAt(0) == '('){
					count += num;
				}
				else{
					count -= num;
					if(count < 0){
						flg = false;
					}
				}
			}
			if(flg && count == 0){
				System.out.println("YES");
			}
			else{
				System.out.println("NO");
			}
		}
	}

	private void debug(Object... o) {
		System.out.println("debug = " + Arrays.deepToString(o));
	}

	public static void main(String[] args) {
		new Main().doit();
	}
}

Measured memory_bytes: 24860
#include<iostream>
using namespace std;
int main()
{
	char arr[20];
	cin>>arr;
	for(int i=0;i<19;i++)
	{
		if(i==5||i==13)
		{
			cout<<' ';
		}
		else{
			cout<<arr[i];
		}
	}
}

Measured memory_bytes: 256
import random

class Dice:
    def __init__(self, hoge):
        self.num = hoge
        self.face = {'U': 0, 'W': 3, 'E': 2, 'N': 4, 'S': 1, 'B': 5} 
    
    def move(self, direct):
        previouse = {k: v for k, v in self.face.items()}
        if direct == 'E':
            self.face['U'] = previouse['W']
            self.face['W'] = previouse['B']
            self.face['E'] = previouse['U']
            self.face['B'] = previouse['E']
        elif direct == 'W':
            self.face['U'] = previouse['E']
            self.face['W'] = previouse['U']
            self.face['E'] = previouse['B']
            self.face['B'] = previouse['W']
        elif direct == 'N':
            self.face['U'] = previouse['S']
            self.face['N'] = previouse['U']
            self.face['S'] = previouse['B']
            self.face['B'] = previouse['N']
        elif direct == 'S':
            self.face['U'] = previouse['N']
            self.face['N'] = previouse['B']
            self.face['S'] = previouse['U']
            self.face['B'] = previouse['S']
    
    def get_num(self, place):
        return self.num[self.face[place]]
    
        
if __name__ == '__main__':
    dice = Dice([int(x) for x in input().split()])
    num_q = int(input())
    d = ['E', 'W', 'N', 'S']
    for _ in range(num_q):
        x, y = [int(x) for x in input().split()]
        while True:
            rand_num = random.randint(0, 3)
            dice.move(d[rand_num])
            if dice.get_num('U') == x and dice.get_num('S') == y:
                break
        print(dice.get_num('E'))


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

#define FOR(i, s, e)   for(int i = (s); i < (e); i++)
#define FOR64(i, s, e) for(ll  i = (s); i < (e); i++)
#define ALL(x)         (x).begin(), (x).end()
#define SORT(b, e)     sort((b), (e))
#define REV(b, e)      reverse((b), (e))
#define VSORT(v)       sort((v).begin(), (v).end())
#define VREV(v)        reverse((v).begin(), (v).end())
#define pb(a)          push_back(a)
#define INF            999999999

typedef long long ll;

int main()
{
	vector<int> v(3);
	cin >> v[0] >> v[1] >> v[2];
	VSORT(v);
	VREV(v);

	cout << v[0] * 10 + v[1] + v[2] << endl;

	return 0;
}



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

int main() {
  int a , b;
  cin >> a >> b;
  if(a % 2 == 1 && b % 2 == 1){
    cout << "Odd" << endl;
  }
  else{
    cout << "Even" << endl;
  }
}


Measured memory_bytes: 256
import Control.Monad
import Data.Maybe
import qualified Data.ByteString.Char8 as BS
import Data.List as L

tuplify2 (x:y:_) = (x,y)
tuplify2 _ = undefined

--Input functions with ByteString
readInt = fst . fromJust . BS.readInt
readIntTuple = tuplify2 . map readInt . BS.words
readIntList = map readInt . BS.words

getInt = readInt <$> BS.getLine
getIntList = readIntList <$> BS.getLine
getIntNList n = map readIntList <$> replicateM (fromIntegral n) BS.getLine
getIntMatrix = map readIntList . BS.lines <$> BS.getContents
getIntTuple = readIntTuple <$> BS.getLine
getIntNTuples n = map readIntTuple <$> replicateM (fromIntegral n) BS.getLine
getIntTuples = map readIntTuple . BS.lines <$> BS.getContents

main :: IO ()
main = do
    n <- getInt
    mapM_ putStrLn  (make n)

make :: Int -> [String]
make 1 = ["a"]
make n = L.concat . map (\p -> append p) $ make (n-1)

append :: String -> [String]
append x = [x++[c] | c<-['a'..n]]
    where n = succ $ L.maximum x

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

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

template <typename TYPE>
void print_vec(const vector<TYPE>& v){
	for(int i=0; i<v.size(); i++){
		cout << v[i] << " ";
	}
	cout << endl;
}

template <typename TYPE>
void print_vec2(const vector<vector<TYPE>>& v){
	for(int i=0; i<v.size(); i++){
		cout << "i=" << i << ":   ";
		for(int j=0; j<v[i].size(); j++){
			cout << v[i][j] << "   ";
		}
		cout << endl;
	}
}




int main(){//
	string s, t;
	cin >> s >> t;
	// s.insert(s.begin()+0, '0');
	// t.insert(t.begin()+0, '1');
	// cout << " s: " << s << "     t: " << t << endl;
	const int S_SIZE = s.size() + 1;
	const int T_SIZE = t.size() + 1;
	//dp[i][j]: s[i] と t[j]　まで考慮した時の最長共通部分列
	vector<vector<int>> dp(S_SIZE, vector<int>(T_SIZE, 0));

	for(int i=0; i<s.size(); i++){
		for(int j=0; j<t.size(); j++){
			//  s[i+1] == t[j+1]のとき そのまま後ろに付ける
			if(s[i] == t[j]){
				dp[i+1][j+1] = max(dp[i+1][j+1], dp[i][j] + 1);
			} 

			dp[i+1][j+1] = max(dp[i+1][j+1], dp[i+1][j]);
			dp[i+1][j+1] = max(dp[i+1][j+1], dp[i][j+1]);
			// dp[i+1][j] = max(dp[i+1][j], dp[i][j] + 0);
			// dp[i][j+1] = max(dp[i][j+1], dp[i][j] + 0);
				
		


		}	
	}
	//print_vec2(dp);
	//cout << dp[s.size()][t.size()] << endl;
	
	string ans = "";
	int cnt = dp[s.size()][t.size()];
	// cout << "  s.size(): " << s.size() << "  ans.size(): " << ans.size() << endl;
	// cout << "  s: " << s << "   t: " << t << endl;
	// for(int i=s.size(); i>0; i--){
	// 	for(int j=t.size(); j>0; j--){
	int i=s.size(), j=t.size();
	while(i!=0 && j!=0){
			if(dp[i][j] == dp[i-1][j]){
				i--; continue;// s[i-1] は共通文字ではない
			}
			if(dp[i][j] == dp[i][j-1]){
				j--; continue;//t[j-1]に共通ではない
			}
			if(dp[i][j] == dp[i-1][j-1]+1){
				if(dp[i][j] == cnt){
					//cout <<" i, j:  " <<  i << " " << j << endl;
					ans = ans + s[i-1];
					cnt--;
					i--; j--;
				}
			}
		
	}
	
	//cout << ans << endl;
	reverse(ans.begin(), ans.end());
	cout << ans << endl;
}


Measured memory_bytes: 38828
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <cstring>
#include <cmath>
#include <vector>

#define For(i, j, k) for(int i = j; i <= k; i++)
#define Forr(i, j, k) for(int i = j; i >= k; i--)
#define pb push_back

using namespace std;

const int Mod = 1e9 + 7;
const int N = 200010;

typedef long long LL;

LL Pow(LL x, LL e){
	LL ret = 1;
	while(e){
		if(e & 1) ret = ret * x % Mod;
		x = x * x % Mod;
		e >>= 1;
	}
	return ret;
}

int fa[N];

int find(int x){
	return x == fa[x] ? x : fa[x] = find(fa[x]);
}

int n, X, Y;
int val[N], col[N];
vector<int> S[N];

int fac[N], rfac[N];

void init(){
	fac[0] = 1;
	For(i, 1, N - 5) fac[i] = 1ll * fac[i - 1] * i % Mod;
	rfac[N - 5] = Pow(fac[N - 5], Mod - 2);
	Forr(i, N - 6, 0) rfac[i] = 1ll * (i + 1) * rfac[i + 1] % Mod;
}

int rk[N];

bool cmp1(int x, int y){
	return col[x] ^ col[y] ? col[x] < col[y] : val[x] < val[y];
}

int main(){
	init();
	scanf("%d%d%d", &n, &X, &Y);
	For(i, 1, n) scanf("%d%d", &col[i], &val[i]), fa[i] = rk[i] = i;
	sort(rk + 1, rk + n + 1, cmp1);

	int pre = rk[1];
	int mn1 = 1, mn2 = 0;
	val[0] = 2e9;

	For(i, 2, n){
		if(col[rk[i]] ^ col[pre]) pre = rk[i];
		if(val[rk[i]] + val[pre] <= X) fa[find(rk[i])] = find(pre);
		if(val[rk[i]] < val[mn1]) mn2 = mn1, mn1 = rk[i];
		if(col[mn1] != col[rk[i]] && val[rk[i]] < val[mn2]) mn2 = rk[i];
	}

	if(!mn2){
		puts("1"); return 0;
	}

	For(i, 1, n) 
		if(col[i] == col[mn1] && val[i] + val[mn2] <= Y) fa[find(i)] = find(mn2);
		else if(col[i] != col[mn1] && val[i] + val[mn1] <= Y) fa[find(i)] = find(mn1);
	For(i, 1, n) S[find(i)].pb(col[i]);

	LL ans = 1;
	For(i, 1, n) if(fa[i] == i){
		sort(S[i].begin(), S[i].end());
		int sz = int(S[i].size()) - 1, c = 0;
		ans = ans * fac[sz + 1] % Mod;
		For(j, 0, sz){
			++c;
			if(j == sz || S[i][j] != S[i][j + 1]){
				ans = ans * rfac[c] % Mod;
				c = 0;
			}
		}
	}
	printf("%lld\n", ans);
	return 0;
}

Measured memory_bytes: 15488
#include<bits/stdc++.h>
using namespace std;
inline int_fast64_t read(){int_fast64_t x=0,f=1;char c=getchar();while(c<'0'||c>'9'){if(c=='-')f=-1;c=getchar();}while(c>='0'&&c<='9')x=x*10+c-'0',c=getchar();return x*f;}
inline string read_s(){string s="";char c=getchar();while(c<'!'||c>'~'){c=getchar();}while(c>='!'&&c<='~'){s+=c;c=getchar();}return s;}
void Main(){
    int N = read();
    vector<int> A(N);
    for (auto& a:A) {
        a = read();
    }
    sort(A.begin(), A.end());
    vector<pair<int, int>> Ans(N-1);
    for (int i = 1; i<N-1; i++) {
        if (A[i] > 0) {
            Ans[i-1] = make_pair(A[0], A[i]);
            A[0] -= A[i];
        } else {
            Ans[i-1] = make_pair(A[N-1], A[i]);
            A[N-1] -= A[i];
        }
    }
    Ans[N-2] = make_pair(A[N-1], A[0]);
    printf("%d\n", A[N-1]-A[0]);
    for (auto ans:Ans) {
        printf("%d %d\n", ans.first, ans.second);
    }
}
int main(){cin.tie(nullptr);ios::sync_with_stdio(false);Main();return 0;}

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

using namespace std;
const int N=2e5+5;
int a[N];
int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);cout.tie(0);
    int n;
    cin>>n;
    map<string,int>m;
    for(int i=0;i<n;i++)
    {
        string s;
        cin>>s;
        m[s]++;
    }
    int mx=0;
    for(auto P:m)
        mx=max(mx,P.second);
    for(auto P:m)
    {
        if(P.second==mx)
            cout<<P.first<<'\n';
    }
    return 0;
}


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

typedef long long ll;

ll sqrt(ll n){
  ll lb=-1,ub=2e9;
   while(ub-lb>1){
      ll mid=(ub+lb)/2;
      if(mid*mid>=n){
        ub=mid;
      }
      else{
        lb=mid;
      }
    }
  return ub;
}
  

int main(){
  ll n;
  cin >> n;
  ll a[n],b[n];
  for(int i=0;i<n;i++) cin >> a[i] >> b[i];
  for(int i=0;i<n;i++){
    if(a[i]==1&&b[i]==1){
      cout << 0 << endl;
    }
    else{
      ll ans=0;
      ans+=min(a[i],b[i]);
      ans--;
      ll point=a[i]*b[i];
      point--;
      ll x=sqrt(point);
      ans+=x;
      ans+=(point/x-1-min(a[i],b[i]));
      if(a[i]==b[i]){
        ans++;
      }
      cout << ans << endl;
    }
  }
}

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

int main() {

  int hinaArares;
  cin >> hinaArares;
  string color;
  int P,W,G,Y = 0;
  
  for ( int i = 0; i < hinaArares; i++) {
    cin >> color;
    
    if ( color == "P" ) {
      P = 1;
    }
    else if ( color == "W" ) {
      W = 1;
    }
    else if ( color == "G" ) {
      G = 1;
    }
    else if ( color == "Y" ) {
      Y = 1;
    }
  }
  
  int colors = P + W + G + Y;
  
  if ( colors == 3 ) {
    cout << "Three";
  }
  else if (colors == 4 ) {
    cout << "Four";
  }
  
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <string>
#include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include <bitset>
typedef long long ll;
using namespace std;
#define rep(i,n) for(int i=0;i<(n);i++)
 
const int mod = 1000000007;
//const int mod = 998244353;
 
 
struct mint {
  ll x; // typedef long long ll;
  mint(ll x=0):x((x%mod+mod)%mod){}
  mint operator-() const { return mint(-x);}
  mint& operator+=(const mint a) {
    if ((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += mod-a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*=(const mint a) { (x *= a.x) %= mod; return *this;}
  mint operator+(const mint a) const { return mint(*this) += a;}
  mint operator-(const mint a) const { return mint(*this) -= a;}
  mint operator*(const mint a) const { return mint(*this) *= a;}
  mint pow(ll t) const {
    if (!t) return 1;
    mint a = pow(t>>1);
    a *= a;
    if (t&1) a *= *this;
    return a;
  }
 
  // for prime mod
  mint inv() const { return pow(mod-2);}
  mint& operator/=(const mint a) { return *this *= a.inv();}
  mint operator/(const mint a) const { return mint(*this) /= a;}
};
istream& operator>>(istream& is, const mint& a) { return is >> a.x;}
ostream& operator<<(ostream& os, const mint& a) { return os << a.x;}
 
 
struct combination {
  vector<mint> fact, ifact;
  combination(int n):fact(n+1),ifact(n+1) {
    assert(n < mod);
    fact[0] = 1;
    for (int i = 1; i <= n; ++i) fact[i] = fact[i-1]*i;
    ifact[n] = fact[n].inv();
    for (int i = n; i >= 1; --i) ifact[i-1] = ifact[i]*i;
  }
  mint operator()(int n, int k) {
    if (k < 0 || k > n) return 0;
    return fact[n]*ifact[k]*ifact[n-k];
  }
} c(200005);
 
vector<pair<long long, long long> > prime_factorize(long long N) {
    vector<pair<long long, long long> > res;
    for (long long a = 2; a * a <= N; ++a) {
        if (N % a != 0) continue;
        long long ex = 0; // 指数
 
        // 割れる限り割り続ける
        while (N % a == 0) {
            ++ex;
            N /= a;
        }
 
        // その結果を push
        res.push_back({a, ex});
    }
 
    // 最後に残った数について
    if (N != 1) res.push_back({N, 1});
    return res;
}
vector<long long> enum_divisors(long long N) {
    vector<long long> res;
    for (long long i = 1; i * i <= N; ++i) {
        if (N % i == 0) {
            res.push_back(i);
            // 重複しないならば i の相方である N/i も push
            if (N/i != i) res.push_back(N/i);
        }
    }
    // 小さい順に並び替える
    sort(res.begin(), res.end());
    return res;
}
 
int main(int argc, const char * argv[]) {

    ll N; cin >> N;

    ll amari = N % 1000;
    
    if(amari==0){
        cout << 0 << endl;
        return 0;
    }
    
    cout << 1000-amari << endl;
    
    
    return 0;
}


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

using namespace std;

int main()
{
	static int n,T[251];
	scanf("%d",&n);
	for(int i=1;i<=n;i++)
		scanf("%d",&T[i]);
	for(int i=1;i<=n;i++)
	{
		printf("node %d: key = %d, ",i,T[i]);
		if(i>1) printf("parent key = %d, ",T[i/2]);
		if(i*2<=n) printf("left key = %d, ",T[i*2]);
		if(i*2+1<=n) printf("right key = %d, ",T[i*2+1]);
		printf("\n");
	}
	return 0;
}

Measured memory_bytes: 3164
#include <cstdio>
#include <cmath>
#include <iostream>
#include <vector>
#include <string>
#include <utility>
#include <algorithm>
using namespace std;
#define ll long long

int main(){
	int A,B;
	cin>>A>>B;
	int now=1;
	int ans=0;
	while(now*A<=B){
		ans+=now;
		now*=A;
	}
	while(now<B){
		ans++;
		now+=A-1;
	}
	cout<<ans;
	return 0;
}


Measured memory_bytes: 256
N = gets.to_i
S = [0, 0, 0, 0, 0]
N.times do
  case gets[0]
  when 'M'
    S[0] += 1
  when 'A'
    S[1] += 1
  when 'R'
    S[2] += 1
  when 'C'
    S[3] += 1
  when 'H'
    S[4] += 1
  end
end

p S.combination(3).map { |i| i.inject(:*) }.inject(:+)


Measured memory_bytes: 2044
#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
#include<vector>
#include<functional>
#include<algorithm>
#include<stdlib.h>
#include<string>
#include<string.h>
#define _USE_MATH_DEFINES
#include<math.h>
#include<deque>
#include<set>
#include<map>
#include<queue>
#include<list>
#include<iostream>
#include <bitset>
using namespace std;
typedef long long ll;
#define rep(i,a,b) for(auto i=a;i<b;i++)
#define all(_x) _x.begin(), _x.end()
#define r_sort(_x) sort(_x.begin(), _x.end(), std::greater<int>())
#define vec_cnt(_a, _n) (upper_bound(all(_a), _n) - lower_bound(all(_a), _n))
#define vec_unique(_a) _a.erase(std::unique(all(_a)), _a.end());
ll gcd(ll a, ll b) { return a % b == 0 ? b : gcd(b, a % b); }
//ll lcm(ll a, ll b) { return (a / gcd(a, b)) * b; }
#define INF 1 << 30
const int mod = 1000000007;
#define COMB_MAX (int)1e6 + 10
ll f[COMB_MAX], rf[COMB_MAX];
ll inv(ll x) {
	ll res = 1;
	ll k = mod - 2;
	ll y = x;
	while (k) {
		if (k & 1) res = (res * y) % mod;
		y = (y * y) % mod;
		k /= 2;
	}
	return res;
}
void init() {
	f[0] = 1;
	rep(i, 1, COMB_MAX) f[i] = (f[i - 1] * i) % mod;
	rep(i, 0, COMB_MAX) rf[i] = inv(f[i]);
}
//---------------------------------------------------------------------------------------------------
ll C(int n, int k) {
	ll a = f[n]; // = n!
	ll b = rf[n - k]; // = (n-k)!
	ll c = rf[k]; // = k!

	ll bc = (b * c) % mod;

	return (a * bc) % mod;
}
int main() {
	ll x, y, k, a, b;
	cin >> x >> y;
	k = (x + y) / 3;
	a = x - k, b = y - k;
	if ((x % 3 + y % 3) % 3 || a < 0 || b < 0) {
		puts("0");
		return 0;
	}
	init();
	printf("%lld\n", C(k, b));
	return 0;
}


Measured memory_bytes: 15872
#include <bits/stdc++.h>
using namespace std;
#define mod (int)1000000007
#define MOD (int)10000000007
#define X 1001100011100001111ll
#define M 26388279066623ll
#define all(a) a.begin(),a.end()
#define for0(i, n) for (int i = 0; i < n; i++)
#define for0e(i, n) for (int i = 0; i <= n; i++)
#define for1(i, n) for (int i = 1; i <= n; i++)
#define loop(i,a,b) for (int i = a; i < b; i++)
#define bloop(i,a,b) for (int i = a ; i>=b;i--)
#define tc(t) int t; cin >> t; while (t--)
#define ll long long
#define pb emplace_back
#define fio ios_base::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL)
#define in(x) scanf("%d", &x)
#define rr return 0
#define prec(n) fixed<<setprecision(n)
#define maxpq priority_queue<int>
#define minpq priority_queue<int, vector<int>, greater<int> >
#define inf (int)(1e18)
#define ini(a, i) memset(a, i, sizeof(a))
#define vi vector<int> 
#define F first
#define S second
#define pi pair<int, int>
#define ppi pair<pair<int,int> , int >
#define vii vector<pi>
const int MAXN = (int)((1e5) + 100);
int max(int a,int b){if(a>b) return a; else return b;}
int min(int a,int b){if(a<b) return a; else return b;} 
int gcd(int a,int b) { if (a == 0) return b; return gcd(b%a, a);}
int cbrt(int x){ int lo=1,hi=min(2000000ll,x);while(hi-lo>1){int mid=(lo+hi)/2;if(mid*mid*mid<x){lo=mid;}else hi=mid;}if(hi*hi*hi<=x) return hi;else return lo;} 
const int dx[4] = {-1, 1, 0, 0};
const int dy[4] = {0, 0, -1, 1};
const int N =  (int)(1e6+5); 
// ========================================================
int n,k;
ll a[N];
signed main(){
  #ifndef ONLINE_JUDGE
  //freopen("input.txt", "r", stdin);
  //freopen("output.txt", "w", stdout);
  #endif
  fio;
    cin>>n>>k;
    ll l=1,r;
    for(int i=1;i<=n;i++){
        cin>>a[i];
        r = max(r,a[i]);
    }
    while(l!=r){
        ll mid = (l+r)/2;
        ll s = 0;
        for(int i=1;i<=n;i++){
            s += (a[i]-1)/mid;
        }
        if(s<=k) r = mid;
        else l = mid+1;
    }
    cout<<l<<endl;
  rr;
}



Measured memory_bytes: 5172
#include <iostream>
#include <iomanip>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <algorithm>
#include <cstdio>
#include <utility>
#include <string>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <deque>
#include <numeric>

using namespace std;

typedef uint64_t u64;
typedef int64_t s64;
typedef uint32_t u32;
typedef int32_t s32;
typedef vector<s32> vs32;
typedef vector<u32> vu32;
typedef vector<s64> vs64;
typedef vector<u64> vu64;

const double PI=3.14159265358979323846;

#define MAX(x, y) ((x) < (y) ? (y) : (x))
#define MIN(x, y) ((x) > (y) ? (y) : (x))

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

#define CEIL(x, y) (((x) + (y) - 1) / (y))
#define MOD 998244353ULL

#define IN(l, r, x) ((l) <= (x) && (x) < (r))


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

    int n, s;
    cin >> n >> s;

    vs32 a(n);
    rep (i, n) cin >> a[i];

    s64 dp[n + 1][s + 1];
    rep (i, n + 1) rep (j, s + 1) dp[i][j] = 0;
    dp[0][0] = 1;

    rep (i, n)
    {
        rep (j, s + 1)
        {
            if (j - a[i] >= 0)
            {
                dp[i + 1][j] += (2 * dp[i][j] % MOD + dp[i][j - a[i]]) % MOD;
            }
            else
            {
                dp[i + 1][j] += 2 * dp[i][j] % MOD;
            }
            dp[i + 1][j] %= MOD;
        }
    }

    cout << dp[n][s] << "\n";
    return 0;
}



Measured memory_bytes: 73948
#pragma region

#include "bits/stdc++.h"
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define _rep3(i, begin, end) for (register int i = (begin), i##_end = (end); i < i##_end; i++)
#define _irep3(i, begin, end) for (register int i = (end)-1, i##_begin = (begin); i >= i##_begin; i--)
#define _rep2(i, n) _rep3(i, 0, n)
#define _irep2(i, n) _irep3(i, 0, n)
#define _overload3(_1, _2, _3, name, ...) name
#define rep(...) _overload3(__VA_ARGS__, _rep3, _rep2, )(__VA_ARGS__)
#define irep(...) _overload3(__VA_ARGS__, _irep3, _irep2, )(__VA_ARGS__)
#define out(x) cout << (x) << '\n';
#define debug(x) cerr << #x << " = " << (x) << " (line: " << __LINE__ << ") " << endl;

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

template <typename T>
istream &operator>>(istream &is, vector<T> &vec) {
  for (auto &v : vec) is >> v;
  return is;
}
template <typename T1, typename T2>
istream &operator>>(istream &is, pair<T1, T2> &pair) {
  cin >> pair.first >> pair.second;
  return is;
}
template <typename T>
ostream &operator<<(ostream &os, const vector<T> &vec) {
  os << "[ ";
  rep(i, vec.size()) i == 0 ? os << vec[i] : os << ", " << vec[i];
  os << " ]";
  return os;
}

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

void init() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(16) << boolalpha;
}

#pragma endregion

#define MOD 1000000007
#define INF 2147483647

int digits(ll a, ll k) {
  if (a == 0) return 0;
  return digits(a / k, k) + 1;
}

int main() {
  init();

  ll N, K;
  cin >> N >> K;
  out(digits(N, K));
}


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

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

    map<string, int> map;
    vector<string> ans;
    rep(i,N){
        string s;
        cin >> s;
        map[s] += 1;
    }
    int imax = 0;    
    for (const auto& x : map) {
        int icount = x.second;
        imax = max(imax, icount);
    }
    for(auto itr = map.begin(); itr != map.end(); ++itr){
        if(imax == itr->second){
            cout << itr->first << endl;
        }
    }


    return 0;
}
//Ctrl+Shift+Bでコンパイルと実行を行ってデバッグすること

Measured memory_bytes: 25216
#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstring>
#include <deque>
#include <functional>
#include <iomanip>
#include <locale>
#include <iostream>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <sstream>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>

#define REP(i,n) for(int i=0;i<(int)(n);i++)
#define ALL(x) (x).begin(),(x).end()

using namespace std;

using ll = long long;
using ld = long double;

template <typename T> T &chmin(T &a, const T &b) { return a = min(a, b); }
template <typename T> T &chmax(T &a, const T &b) { return a = max(a, b); }
template <typename T> int len(const T &x) { return x.size(); }

template<typename T>
vector<T> table(int n, T v) { return vector<T>(n, v); }

template <class... Args>
auto table(int n, Args... args) {
  auto val = table(args...);
  return vector<decltype(val)>(n, move(val));
}

struct yes_no : numpunct<char> {
  string_type do_truename()  const { return "Yes"; }
  string_type do_falsename() const { return "No"; }
};

ll b[128000];
ll sb[128000];

void solve(ll N, vector<ll> A, vector<ll> B, vector<ll> C) {
  sort(ALL(A));
  sort(ALL(B));
  sort(ALL(C));
  REP(i,N) b[i] = lower_bound(ALL(A), B[i]) - begin(A);
  REP(i,N) sb[i+1] = b[i] + sb[i];
  ll res = 0;
  REP(i,N) res += sb[lower_bound(ALL(B), C[i]) - begin(B)];
  cout << res << endl;
}

int main() {
  locale loc(locale(), new yes_no);
  cout << boolalpha << setprecision(12) << fixed;
  cout.imbue(loc);
	ll N;
	scanf("%lld", &N);
	vector<ll> C(N-1+1);
	vector<ll> A(N-1+1);
	vector<ll> B(N-1+1);
	for (int i = 0 ; i <= N-1 ; i++) {
	  scanf("%lld", &A[i]);
	}
	for (int i = 0 ; i <= N-1 ; i++) {
	  scanf("%lld", &B[i]);
	}
	for (int i = 0 ; i <= N-1 ; i++) {
	  scanf("%lld", &C[i]);
	}
	solve(N, A, B, C);
	return 0;
}


Measured memory_bytes: 6528
n = int(input())
a = [int(input()) for _ in range(n)]
mina =a[0]
maxa=a[1]-a[0]
for i in range(1,n):
    maxa = max(a[i]-mina,maxa)
    mina = min(mina,a[i])
print(maxa)
    
    
    
        


Measured memory_bytes: 13600
#include <stdio.h>
#include <algorithm>
#include <iostream>
#include <limits.h>
#include <math.h>
#include <queue>
#include <set>
#include <stdlib.h>
#include <string>
#include <vector>
#include <cstdio>
#include <iomanip>
#define ll long long
#define rep2(i,a,b) for(ll i=a;i<=b;i++)
#define rep(i,n) for(ll i=0;i<n;i++)
#define rep3(i,a,b) for(int i=a;i>=b;i--)
#define REP(e,v) for(auto e:v)
#define queint queue<int>
#define pii pair<int,int>
#define pll pair<ll,ll>
#define pq priority_queue<int>//大きい順
#define pqg priority_queue<int,vec,greater<int>>//小さい順
#define pb push_back
#define vec vector<int>
#define vecvec vector<vector<int>>
#define vecll vector<ll>
#define vecvecll vector<vector<ll>>
#define bs binary_search
#define All(c) (c).begin(),(c).end()
#define mp make_pair
using namespace std;
int in(){int x;scanf("%d",&x);return x;}
string stin(){string s;cin>>s;return s;}
ll lin(){ll x;scanf("%lld",&x);return x;}
ll mod=998244353;
ll modpow(ll a,ll b){
    if(b==0)return 1;
    if(b%2==0){
        ll d=modpow(a,b/2);
        return d*d%mod;
    }
    return modpow(a,b-1)*a%mod;
}
int main(){
    int n=in();
    ll sum=0;
    vec a(n+1);
    rep(i,n)a[i+1]=in();
    vector<vecll> dp(n+1,vecll(90001,0));
    dp[0][0]=1;
    rep(i,n){
        sum+=a[i+1];
        rep2(j,0,sum){
            dp[i+1][j]=2*dp[i][j];
            if(j>=a[i+1])dp[i+1][j]+=dp[i][j-a[i+1]];
            dp[i+1][j]%=mod;
        }
    }
    ll ans=modpow(3,n);
    rep2(i,(sum+1)/2,sum)ans=(ans-3*dp[n][i])%mod;
    if(sum%2==0){
        vector<vecll> c(n+1,vecll(90001,0));
        c[0][0]=1;
        rep(i,n){
            rep2(j,0,sum){
                c[i+1][j]=c[i][j];
                if(j>=a[i+1])c[i+1][j]+=c[i][j-a[i+1]];
                c[i+1][j]%=mod;
            }
        }
        ans+=3*c[n][sum/2];
    }
    cout<<(ans+mod)%mod<<endl;
}


Measured memory_bytes: 424512
#include<iostream>
using namespace std;
int main() {
    int n, k;cin>>n>>k;
    if(n>k){
        cout<<"a > b"<<endl;
    }
    if(n<k){
        cout<<"a < b"<<endl;
    }
    if(n==k){
        cout<<"a == b"<<endl;
    }
}


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

    int A, B; cin >> A >> B;

    for(int i=1; i<=1000; i++){
        if(static_cast<int>(i*0.08) == A && static_cast<int>(i*0.1) == B){
            cout << i << endl;
            return 0;
        }
    }

    cout << -1 << endl;

}

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

int main()
{
    int k, x;
    cin >> k >> x;

    int d = 2 * k - 1;
    int counter = 0;
    int s = d / 2 * -1;
    while (counter < d)
    {
        if (counter != 0)
            cout << " ";
        cout << x + s;
        s++;
        counter++;
    }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
const ll INF = 100000000;
#define rep1(i, n) for (ll i=0; i<(n); i++) 
#define rep2(i, k, n) for (ll i=k; i<(n); i++)
const double pi = 3.141592653589793;

int main() {
    long double a, b, h, m;
    cin >> a >> b >> h >> m;
    long double theta = pi*(60*h - 11*m)/(double)360;
    long double ans = a*a + b*b - 2*a*b*(double)cos(theta);
    ans = sqrt(ans);
    cout << fixed << setprecision(9) << ans << endl;
}

Measured memory_bytes: 4168
package main

import (
	"fmt"
	"math"
)

func abs(a int) int {
	return int(math.Abs(float64(a)))
}

func min(a, b int) int {
	if a < b {
		return a
	}
	return b
}

func main() {
	var n, l int
	fmt.Scan(&n, &l)

	sum := (n-1) * n /2 + n*l
	if l > 0 {
		sum -= l
	} else if l > n * (-1) {
	} else {
		sum -= l+(n-1)
	}

	fmt.Println(sum)
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
 
int main(){
  string s;
  cin >>s;
  int l=s.size();
  int mi,ma;
  for (int i=0;i<l;i++){
    if (s.at(i)=='A'){
      mi=i;
      break;
    }
  }
  for (int i=l-1;i>-1;i--){
    if (s.at(i)=='Z'){
      ma=i;
      break;
    }
  }
  cout << ma-mi+1<<endl;
}


Measured memory_bytes: 640