akhauriyash/Code-Regression huggingface dataset:
import copy
n = int(input())
a = [int(input()) for i in range(n)]
sorted_a = sorted(a, reverse=True)
n1 = sorted_a[0]
n2 = sorted_a[1]
if(n1 == n2):
  for i in range(n):
    print(n1)
else:
  for i in range(n):
    if a[i] == n1:
      print(n2)
    else:
      print(n1)


Measured memory_bytes: 14584
#include <bits/stdc++.h>
using namespace std;
int main()
{
    string s,s1;
    cin >>s>>s1;
    s+=s1;
    long long x=0;
    while (!s.empty())
    {
        x*=10;
        x+= (s[0]-'0');
        s.erase(s.begin());
    }
    if ((int)sqrt(x)*(int)sqrt(x)==x)
        cout<<"Yes";
    else
        cout <<"No";
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <set>
#include <vector>

using namespace std;

int a[100005];
int b[100005];
long result[100005];

// https://qiita.com/ofutonfuton/items/c17dfd33fc542c222396
struct UnionFind {
    vector<long> par; // par[i]:iの親の番号　(例) par[3] = 2 : 3の親が2
    vector<long> size;

    UnionFind(long N) : par(N), size(N) { //最初は全てが根であるとして初期化
        for(int i = 0; i < N; i++) {
            par[i] = i;
            size[i] = 1;
        }
    }

    long root(int x) { // データxが属する木の根を再帰で得る：root(x) = {xの木の根}
        if (par[x] == x) return x;
        return par[x] = root(par[x]);
    }

    void unite(int x, int y) { // xとyの木を併合
        int rx = root(x); //xの根をrx
        int ry = root(y); //yの根をry
        if (rx == ry) return; //xとyの根が同じ(=同じ木にある)時はそのまま
        par[rx] = ry; //xとyの根が同じでない(=同じ木にない)時：xの根rxをyの根ryにつける
        size[ry] += size[rx];
    }

    bool same(int x, int y) { // 2つのデータx, yが属する木が同じならtrueを返す
        int rx = root(x);
        int ry = root(y);
        return rx == ry;
    }

    long number(int x) {
        int rx = root(x);
        return size[rx];
    }
};

int main() {
    long n, m;
    cin >> n >> m;
    for (int i = 0; i < m; ++i) {
        cin >> a[i] >> b[i];
    }
    UnionFind tree(n);
    result[0] = n * (n - 1) / 2;
    for (int i = 0; i < m; ++i) {
        long na = tree.number(a[m - 1 - i] - 1);
        long nb = tree.number(b[m - 1 - i] - 1);
        if (tree.same(a[m - 1 - i] - 1, b[m - 1 - i] - 1)) {
            result[i + 1] = result[i];
        } else {
            result[i + 1] = result[i] - na * nb;
        }
        tree.unite(a[m - 1 - i] - 1, b[m - 1 - i] - 1);
    }
    for (int i = m - 1; i >= 0; --i) {
        cout << result[i] << endl;
    }
}

Measured memory_bytes: 4480
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sca = new Scanner(System.in);
		int n = sca.nextInt();
		int n_loop = n;
		int k = sca.nextInt();
		long min = 0L;
		long max = 0L;
		long ans = 0L;
		for(int i = 0; i < k; i++) {
			min += i;
			max += n_loop;
			n_loop--;
		}
		ans = max - min + 1;

		for(int j = k; j <= n; j++) {
			min += j;
			max += n_loop;
			n_loop--;
			ans += max - min + 1;
		}

		ans = ans % (1000000000 + 7);

		System.out.println(ans);

		// 後始末
		sca.close();
	}
}

Measured memory_bytes: 35796
# -*- coding: utf-8 -*-
"""
Created on Tue Jan 21 18:19:39 2020

@author: matsui
"""


N,W=map(int,input().split())
vi,wi=[],[]
for i in range(N):
    w,v=map(int,input().split())
    wi.append(w)
    vi.append(v)
    

#L = sorted([list(map(int,input().split())) for i in range(N)])

M=int(sum(vi))
dp=[W+1]*(M+1)
dp[0]=0
   
#L = sorted([list(map(int,input().split())) for i in range(N)])
s=0

for w, v in zip(wi,vi):
    s+=v
    for j in range(min(s,M),v-1,-1):
        if dp[j] > dp[j-v]+w: dp[j]=dp[j-v]+w
    #print(dp)

m=0
for i in range(M+1):
    if dp[i]<=W:
        m=i
print(m)
    


Measured memory_bytes: 5208
# -*- coding: utf-8 -*-

import sys

def input(): return sys.stdin.readline().strip()
def list2d(a, b, c): return [[c] * b for i in range(a)]
def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]
def list4d(a, b, c, d, e): return [[[[e] * d for j in range(c)] for j in range(b)] for i in range(a)]
def ceil(x, y=1): return int(-(-x // y))
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(N=None): return list(MAP()) if N is None else [INT() for i in range(N)]
def Yes(): print('Yes')
def No(): print('No')
def YES(): print('YES')
def NO(): print('NO')
sys.setrecursionlimit(10 ** 9)
INF = 10 ** 18
MOD = 10 ** 9 + 7

a, b, N = MAP()

# for x in range(N+1):
#     print(a*x // b - a*(x//b))

x = min(b-1, N)
ans = a*x // b - a*(x//b)
print(ans)


Measured memory_bytes: 9160
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;
 
int main () {
  int A, B, ans, ansA, ansB;
  cin >> A >> B;
  double amul, bmul;
  amul = ceil(A * 12.5);
  bmul = floor(amul * 0.1);
  // printf("%lf\n", amul);
  // printf("%lf\n", bmul);
  if (bmul == B) {
    ansA = (int)amul;
  } else {
    ansA = 1000000000;
  }
  bmul = ceil(B * 10);
  amul = floor(bmul * 0.08);
  if (amul == A) {
    ansB = (int)bmul;
  } else {
    ansB = 1000000000;
  }
  if (ansA == 1000000000 && ansB == 1000000000) {
    ans = -1;
  }
  else if (ansA < ansB) {
    ans = ansA;
  } else if (ansA >= ansB) {
    ans = ansB;
  }
  // printf("%d\n", ansA);
  // printf("%d\n", ansB);
  printf("%d\n", ans);
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <cassert>
using namespace std;

signed main() {
	int n;
	int i;
	
	cin >> n;
	
	int ssum = 0;
	for (i = 1; i <= n; i++) {
		ssum += i;
		if (ssum >= n) { break; }
	}
	
	ssum = n;
	for (; i > 0; i--) {
		if (ssum - i >= 0) {
			ssum -= i;
			cout << i << endl;
		}
	}
	return 0;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
#define rep(i, a, b) for(int i = a; i < b; i++)
#define Rep(i, a, b) for(int i = a; i <= b; i++)
#define _GLIBCXX_DEBUG
#define Vl vector<ll>
#define Vs vector<string>
#define ll long long
#define ALL(v) (v).begin(),(v).end()
using namespace std;

void solve() {
    ll n, t; cin >> n >> t;
    Vl T(n);
    rep(i, 0, n) cin >> T[i];
    ll ans = 0;
    rep(i, 1, n){
        if(T[i] - T[i-1] < t) ans += T[i] - T[i-1];
        else ans += t;
    }
    ans += t;
    cout << ans << endl;
}

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

    solve();
    return 0;
}
 


Measured memory_bytes: 1792
var GET=(function(){function f(s){return new g(s);}function g(s){this._s=s.trim().split("\n");this._y=0;}g.prototype.a=function(f){var s=this._s, y=this._y, r;if(typeof s[y]==="string")s[y]=s[y].split(" ").reverse();r=s[y].pop();if(!s[y].length)this._y++;return f?r:+r;};g.prototype.l=function(f){var s=this._s[this._y++].split(" ");return f?s:s.map(a=>+a);};g.prototype.m=function(n,f){var r=this._s.slice(this._y,this._y+=n).map(a=>a.split(" "));return f?r:r.map(a=>a.map(a=>+a));};g.prototype.r=function(n,f){var r=this._s.slice(this._y,this._y+=n);return f?r:r.map(a=>+a);};return f;})();
var o=GET(require("fs").readFileSync("/dev/stdin","utf8"));
function xArray(v){var a=arguments,l=a.length,r="Array(a["+--l+"]).fill(0).map(x=>{return "+v+";})";while(--l)r="Array(a["+l+"]).fill(0).map(x=>"+r+")";return eval(r);}

console.log(main());
function main(){
  var n = o.a();
  var a = o.r(n);
  var b = a.concat().sort((a,b)=>b-a);
  var ans = [];
  for(var i = 0; i < n; i++){
    ans[i] = b[0];
    if(a[i] === b[0])ans[i] = b[1];
  }
  return ans.join("\n");
}

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

int main () {
  
  int N=0, M=0;
  
  cin >> N >> M;
  
  if(N==M) {
    
    cout << "Yes" << endl;
    
  } else {
    
    cout << "No" << endl;
    
  }
  
  return 0;
  
}

Measured memory_bytes: 256
#include <iostream>
#include <math.h>
using namespace std;
int main(void) {
	int n; cin >> n;
	int cnt = 0;
	while (true) {
		int m = static_cast<int>(static_cast<double>(sqrt(n - cnt)));
		if (m * m == n - cnt) {
			cout << n - cnt << endl;
			break;

		}
		++cnt;
	}
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(void)
{
    int i,N,m,p[50];

    scanf("%d",&N);

    for(i=0;i<N;i++)
       scanf("%d",&p[i]);

    m = 0;
    for(i=0;i<N;i++)
       if (p[i] != i+1) m++;

    if(m==2 || m==0) printf("YES");
    else if(m>2)     printf("NO");

    return 0;
}


Measured memory_bytes: 128
import sys
input = sys.stdin.readline

n, m, q = [int(x) for x in input().split()]
abcd = [[int(x) for x in input().split()] for _ in range(q)]

s = ['1']
s_list = []

def dfs(s):
    last_s = int(s[-1])
    for i in range(last_s, m + 1):
        t = s[:]
        t.append(str(i))
        if len(t) == n + 1:
            s_list.append(t[1:])
        else:
            dfs(t)

dfs(s)

ans = 0

for s in s_list:
    res = 0
    for i in range(q):
        a, b, c, d = abcd[i]
        if int(s[b - 1]) - int(s[a - 1]) == c:
            res += d
    ans = max(res, ans)

print(ans)





Measured memory_bytes: 94052
#include <stdio.h>

int main(int argc, const char * argv[]) {
    int n, x;
    int a[1000];
    scanf("%d", &n);
    for(int i=0; i<n; i++){
        scanf("%d", &x);
        a[i] = x;
    }
    for(int j=n-1; j>=0; j--){
        if(j<n-1) printf(" ");
        printf("%d", a[j]);
    }
    printf("\n");
    return 0;
}



Measured memory_bytes: 2112
#if __has_include("../library/Basic/Debug.hpp")

#include "../library/Basic/Debug.hpp"

#else

/* ----- Header Files ----- */
// IO
#include <cstdio>
#include <iomanip>
#include <ios>
#include <iostream>

// algorithm
#include <algorithm>
#include <cmath>
#include <numeric>

// container
#include <vector>
#include <array>
#include <string>
#include <tuple>
#include <complex>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <bitset>

// others
#include <random>
#include <limits>
#include <functional>
#include <ctime>
#include <cassert>
#include <cstdint>

/* ----- Type Alias ----- */
using Int = long long int;
using Real = long double;
using std::array;
using std::pair;
using std::string;
using std::tuple;
using std::vector;
template <class T>
using MaxHeap = std::priority_queue<T>;
template <class T>
using MinHeap = std::priority_queue<T, std::vector<T>, std::greater<T>>;

template <class T>
T genv(T v) { return v; }

template <class T, class... Ts>
auto genv(size_t l, Ts... ts) {
    return vector<decltype(genv<T>(ts...))>(l, genv<T>(ts...));
}

template <class Cost = Int>
struct Edge {
    Int src, dst;
    Cost cost;
    Edge(Int src = -1, Int dst = -1, Cost cost = 1)
        : src(src), dst(dst), cost(cost){};

    bool operator<(const Edge<Cost>& e) const { return this->cost < e.cost; }
    bool operator>(const Edge<Cost>& e) const { return this->cost > e.cost; }
};

template <class Cost = Int>
using Edges = vector<Edge<Cost>>;
template <class Cost = Int>
using Graph = vector<vector<Edge<Cost>>>;

#endif

/* ----- Misc ----- */
void fastio() {
    std::ios::sync_with_stdio(false);
    std::cin.tie(nullptr);
}

struct Fout {
    Int precision;
    Fout(Int precision) : precision(precision) {}
};
std::ostream& operator<<(std::ostream& os, const Fout& fio) {
    os << std::fixed << std::setprecision(fio.precision);
    return os;
}

/* ----- Constants ----- */
// constexpr Int INF = std::numeric_limits<Int>::max() / 3;
// constexpr Int MOD = 1000000007;
// const Real PI = acos(-1);
// constexpr Real EPS = 1e-10;
// std::mt19937 mt(int(std::time(nullptr)));

const array<string, 3> weather{"Sunny", "Cloudy", "Rainy"};

int main() {
    string s;
    std::cin >> s;

    for (int i = 0; i < 3; ++i) {
        if (weather[i] == s) {
            std::cout << weather[(i + 1) % 3] << std::endl;
        }
    }
    return 0;
}


Measured memory_bytes: 888
//code by PARTH_4399 for competitive programming
#include<bits/stdc++.h>
using namespace std;
#define l long // -2^31 to +2^31-1 (upper limit ~ 2*(10^9))
#define ul unsigned long // 0 to +2^32-1
#define ll long long // -2^63 to +2^63-1 (upper limit ~ 9*(10^18))
#define ull unsigned long long // 0 to +2^64-1
#define mod(x, m) ((((x)%(m))+(m))%(m))
#define vi vector<int>
#define pi pair<int,int>
#define F first
#define S second
#define PB push_back
#define MP make_pair
//const double pi=acos(-1.0); // cout<<fixed<<setprecision(n)<<pi; - for n decimal digits, use <iomanip.h>
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	//code
  	ll int a,b,c;
  	cin>>a>>b>>c;
  	c=c-(a-b);
	if(c<0)
      c=0;
  	cout<<c;
      return 0;
}

Measured memory_bytes: 256
import sys,collections as cl,bisect as bs
sys.setrecursionlimit(100000)
input = sys.stdin.readline
mod = 10**9+7
Max = sys.maxsize
def l(): #intのlist
    return list(map(int,input().split()))
def m(): #複数文字
    return map(int,input().split())
def onem(): #Nとかの取得
    return int(input())
def s(x): #圧縮
    a = []
    if len(x) == 0:
        return []
    aa = x[0]
    su = 1
    for i in range(len(x)-1):
        if aa != x[i+1]:
            a.append([aa,su])
            aa = x[i+1]
            su = 1
        else:
            su += 1
    a.append([aa,su])
    return a
def jo(x): #listをスペースごとに分ける
    return " ".join(map(str,x))
def max2(x): #他のときもどうように作成可能
    return max(map(max,x))
def In(x,a): #aがリスト(sorted)
    k = bs.bisect_left(a,x)
    if k != len(a) and a[k] ==  x:
        return True
    else:
        return False

def pow_k(x, n):
    ans = 1
    while n:
        if n % 2:
            ans *= x
        x *= x
        n >>= 1
    return ans

"""
def nibu(x,n,r):
    ll = 0
    rr = r
    while True:
        mid = (ll+rr)//2

    if rr == mid:
        return ll
    if (ここに評価入れる):
        rr = mid
    else:
        ll = mid+1
"""


n,k = m()

masc = [[0 for i in range(n+1)] for j in range(n)]
maxsu = [[0 for i in range(n+1)] for j in range(n)]

roop = [0 for i in range(n)]

p = l()

c = l()

for i in range(n):
    count = 0
    su = 0
    now = i
    for j in range(n+1):
        now = p[now] - 1
        count += 1
        su += c[now]
        masc[i][count-1] = su
        if count == 1:
            maxsu[i][count-1] = su
        else:
            maxsu[i][count-1] = max(maxsu[i][count-2],su)
        if i == now:
            roop[i] = count
            break

ans = -Max

for i in range(n):
    if k <= roop[i]:
        ans = max(ans,maxsu[i][k-1])
    else:
        if masc[i][roop[i]-1] < 0:
            ans = max(ans,maxsu[i][roop[i]-1])
        else:
            ans = max(ans,(k//roop[i]) * masc[i][roop[i]-1] + maxsu[i][k % roop[i]-1],(k//roop[i] - 1) * masc[i][roop[i]-1] + maxsu[i][roop[i]-1])
print(ans)




Measured memory_bytes: 491976
def selectionSort(A, n):
    k = 0
    for i in range (n):
        minj = i
        for j in range (i,n):
            if A[j] < A[minj]:
                minj = j
        A[i],A[minj] = A[minj],A[i]
        if i != minj:
            k += 1

    L=[str(a) for a in A]
    L=" ".join(L)
    print(L)
    print(k)



n = int(input())
A = list(map(int,input().split()))

selectionSort(A, n)


Measured memory_bytes: 5604
using System;
using System.Collections.Generic;
using System.Linq;

public class Program {
    public static void Main() {
        var n = int.Parse(Console.ReadLine());
        var arrs = Console
            .ReadLine()
            .Split(' ')
            .Select(s => long.Parse(s))
            .GroupBy(k => k)
            .ToDictionary(g => g.Key, g => g.Count());

        var score = arrs.Select(kv => {
            if (kv.Key > kv.Value) {
                return kv.Value;
            }
            if (kv.Key < kv.Value) {
                return kv.Value - kv.Key;
            }
            return 0;
        }).Sum();
        Console.WriteLine(score);
    }
}


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

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

int main() {
    int n,r; cin >> n >> r;
    if(n >= 10){
        cout << r << endl;
    }else{
        cout << r + 100*(10 - n) << endl;
    }
}

Measured memory_bytes: 256
import java.util.*;

public class Main{
	public static void main(String[] args){
		Scanner sc=new Scanner(System.in);
		int n=sc.nextInt();
		int cnt=0;
		for(int i=0;i<n;i++) {
			int a=sc.nextInt();
			if(i%2==0&&a%2==1)cnt++;
		}
		System.out.println(cnt);
	}
}

Measured memory_bytes: 35696
#include <bits/stdc++.h>
#define int long long
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using namespace std;
constexpr int MOD = 1000000007;
constexpr int INF = numeric_limits<int>::max() / 2;
typedef pair<int,int> P;
using Graph = vector<vector<int>>;
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; }
const double PI = acos(-1.0);
// cout << fixed << setprecision(14);
 
signed main(){
	cin.tie(nullptr);
	ios::sync_with_stdio(false);

	int A, V, B, W, T;
	cin >> A >> V >> B >> W >> T;
	if(V-W <= 0){
		cout << "NO" << endl;
		return 0;
	}
	else{
		if(abs(A-B) <= (V-W)*T){
			cout << "YES" << endl;
			return 0;
		}
		else{
			cout << "NO" << endl;
			return 0;
		}
	}
}

Measured memory_bytes: 3648
class BIT:
    def __init__(self, n):
        self.N = n
        self.n = 1<<n.bit_length()
        self.data = [0] * (self.n + 1)
        self.num = 0
    def sum(self, i):
        s = 0
        while i > 0:
            s += self.data[i]
            i -= i & -i
        return s

    def add(self, i, x):
        while i <= self.n:
            self.data[i] += x
            i += i & -i
        self.num+=1
    def search(self, value):
        if value<1:
            return 0
        if value >self.num:
            return self.N+1
        x,sx = 0,0
        step = self.n
        while step:
            y = x+step
            sy = sx+self.data[y]
            if sy < value:
                x,sx = y,sy
            step >>= 1
        return x+1
class UnionFind(object):
    def __init__(self, size):
        self.parent = [i for i in range(size)]
        self.rank = [0 for _ in range(size)]


    def find(self, x):
        if self.parent[x] == x:
            return x
        else:
            return self.find(self.parent[x])


    def unite(self, x, y):
        x = self.find(x)
        y = self.find(y)
        if x == y:
            return

        if self.rank[x] < self.rank[y]:
            self.parent[x] = y
        else:
            self.parent[y] = x
            if self.rank[x] == self.rank[y]:
                self.rank[x] += 1

    def same(self, x, y):
        return self.find(x) == self.find(y)
from collections import deque
N, K = map(int, input().split())
P = list(map(int, input().split()))
B = BIT(N)
U = UnionFind(N)
ans = N-K+1
for i in range(K):
    B.add(P[i]+1, 1)
for i in range(1, N-K+1):
    m = B.search(1)
    M = B.search(K)
    if P[i-1]+1==m and P[i+K-1]+1>M:
        U.unite(i-1, i)
    B.add(P[i-1]+1, -1)
    B.add(P[i+K-1]+1, 1)
s, l = 0, 1
List = []
for i in range(1, N):
    if P[i-1]<P[i]:
        l+=1
    else:
        if l>=K:
            List.append(s)
        l = 1
        s = i
if l>=K:
    List.append(s)
if len(List)>0:
    s = List[0]
    for i in List[1:]:
        U.unite(s, i)
ans = 0
for i in range(N):
    if U.parent[i] == i:
        ans+=1

print(ans-K+1)


Measured memory_bytes: 89128
#include<iostream>
using namespace std;
int main(){
  int n;
  cin >> n;
  int p[n][3],P[n];
  int t;
  int bell[n];
  for(int i=0;i<n;i++){
    for(int j=0;j<3;j++){
      cin >> p[i][j];
    }
  }

  for(int i=0;i<n;i++){
    P[i]=0;
  }

  for(int i=0;i<3;i++){
    for(int j=0;j<n;j++){
      t=0;
      for(int h=0;h<n;h++){
	if(h!=j){
	  if(p[j][i]==p[h][i]){
	    t++;
	    break;
	  }
	}
      }
      if(t==0){
	P[j]+=p[j][i];
      }
    }
  }

  for(int i=0;i<n;i++){
    cout << P[i] << endl;
  }

  return (0);
}

Measured memory_bytes: 1164
#include <bits/stdc++.h>
#define lli long long int
#define pb(a) push_back(a)
#define forr(a,n) for(lli i=a;i<n;i++)
#define forrr(j,a,n) for(lli j=a;j<n;j++)
#define all(x) x.begin(),x.end()
#define pi2  1.57079632679489661923
using namespace std;
void print(lli a[],lli n){
forr(0,n){cout<<a[i]<<" ";}
cout<<"\n";
}
lli power(lli x){
lli u=0;
while(x%2==0){
    u++;
    x=x/2;
}
return u;
}

lli powM(lli x,lli y,lli m)
{
    lli ans=1,r=1;
    x%=m;
    while(r>0&&r<=y)
    {
        if(r&y)
        {
            ans*=x;
            ans%=m;
        }
        r<<=1;
        x*=x;
        x%=m;
    }
    return ans;
}
int powm(lli a, lli b) {
	lli res = 1;
	while (b) {
		if (b & 1)
			res = (res * a);
		a = (a * a);
		b >>= 1;
	}
	return res;
}
lli gcd(lli a, lli b)
{
    if (b == 0)
        return a;
    return gcd(b, a % b);

}
bool isPrime(int n)
{
    // Corner cases
    if (n <= 1)
        return false;
    if (n <= 3)
        return true;

    // This is checked so that we can skip
    // middle five numbers in below loop
    if (n % 2 == 0 || n % 3 == 0)
        return false;

    for (int i = 5; i * i <= n; i = i + 6)
        if (n % i == 0 || n % (i + 2) == 0)
            return false;

    return true;
}
/*
vector <lli> adj[100001];
lli vis[100001]={0};
void dfs(lli a){
    vis[a]=1;
    forr(0,adj[a].size()){
    if(vis[adj[a][i]]){continue;}
    else{
        dfs(adj[a][i]);
    }
    }
}
lli level[100001];
void bfs(lli a){
queue <lli> q;
vis[a]=1;
level[a]=0;
q.push(a);
while(!q.empty()){
    lli p=q.front();
    q.pop();
    forr(0,adj[p].size()){
    if(vis[adj[p][i]]==0){
        level[adj[p][i]]=level[p]+1;
        q.push(adj[p][i]);
        vis[adj[p][i]]=1;
    }
    }

}

}

vector <pair<lli,lli> > dj[100001];
lli dist[100001];
vector<lli> ans[100001];
void dijkstra(lli a){
dist[a]=0;
ans[a].pb(a);
multiset<pair<lli,lli> > s;
s.insert({0,a});
while(s.size()!=0){
    lli x=(*s.begin()).second;
    s.erase(s.begin());
    if(vis[x]){continue;}
    vis[x]=1;
    forr(0,dj[x].size()){
    lli e=dj[x][i].first;
    lli we=dj[x][i].second;
    if(dist[x]+we<dist[e]){
        dist[e]=dist[x]+we;
        ans[e].clear();
        ans[e].pb(x);
        s.insert({dist[e],e});
    }
    }
}

}*/

int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
   cout.tie(0);
   // freopen("outpu.txt","w",stdout);
int t1=1;
//cin>>t1;
lli M =1e9+7;
while(t1--){
string s,t;
cin>>s>>t;
lli n=s.size();
lli u=0;
forr(0,n){
if(s[i]!=t[i]){u++;}
}
cout<<u;
}
     return 0;
}


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

using namespace std;

int n;
vector<int>a[3];
int memo[100001][5];

int dp(int i,int j){
    if(i == n){
        return 0;
    }
    if(memo[i][j] != -1) return memo[i][j];
    int ans = 0;
    for(int k = 0;k < 3;k++){
        if(k == j) continue;
        ans = max(ans,a[k][i]+dp(i+1,k));
    }
    return memo[i][j] = ans;
}

int main(){
    memset(memo,-1,sizeof(memo));
    cin >> n;
    for(int i = 0;i <3;i++){
        a[i].resize(n);
    }
    for(int i = 0;i <n;i++){
        cin >> a[0][i] >> a[1][i] >> a[2][i];
    }
    cout << dp(0,4) << endl;
}


Measured memory_bytes: 14016
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <cmath>
#include <numeric>
#include <queue>
using namespace std;

int64_t min(int64_t a,int64_t b) {
    if (a > b)
    {
        return b ;
    }else
    {
        return a ;
    }
}


int main(){
    int n,m,k ;
    cin >> n >> m >> k ;
    vector<vector<int> > list(n,vector<int>(0)) ;
    int a,b ;
    for (int i = 0; i < m; i++)
    {
        cin >> a >> b ;
        list.at(a-1).push_back(b-1) ;
        list.at(b-1).push_back(a-1) ;
    }
    vector<bool> seen(n,0) ;
    queue<int> wait ;
    vector<int> size(0) ;
    vector<int> part(n) ;
    int nowsize = 0 ;
    int partnum = 0 ;
    for (int i = 0; i < n; i++)
    {
        if (seen.at(i) == 1)
        {
            continue ;
        }
        nowsize = 0 ;
        wait.push(i) ;
        while(wait.empty() == 0){
            int next = wait.front() ;
            wait.pop() ;
            nowsize ++ ;
            seen.at(next) = 1 ;
            part.at(next) = partnum ;
            for (int j = 0; j < list.at(next).size(); j++)
            {
                if (seen.at(list.at(next).at(j)) == 0 )
                {
                    seen.at(list.at(next).at(j)) = 1 ;
                    wait.push(list.at(next).at(j)) ;
                }
                
            }
            
        }
        size.push_back(nowsize) ;
        partnum ++ ;
    }

    vector<int> ans(n,0) ;
    for (int i = 0; i < n; i++)
    {
        ans.at(i) = size.at(part.at(i)) - list.at(i).size() - 1 ;
    }
    for (int i = 0; i < k; i++)
    {
        cin >> a >> b ;
        if (part.at(a-1) == part.at(b-1))
        {
            ans.at(a-1) -- ;
            ans.at(b-1) -- ;
        }
        
    }
    for (int i = 0; i < n-1; i++)
    {
        cout << ans.at(i) << " " ;
    }
    cout << ans.at(n-1) << endl ;
    
}


Measured memory_bytes: 10176
#include <iostream>
#include <string.h>
#include <vector>
#include <algorithm>
#include <cmath>
#include <map>
#include <functional>
#include <cassert>
#include <utility>
#include <stack>
#include <queue>
using namespace std;
#define min(a,b) ((a)<(b)?(a):(b))
#define max(a,b) ((a)>(b)?(a):(b))
#define REP(i,n) for(int i=0;i<n;i++)
#define FOR(i,n1,n2) for(int i=n1;i<n2;i++)
#define speed_up    ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
typedef pair<int,int> Pi;
typedef long long int ll;
const int INF=(ll)(1<<30)-1;
const ll INFl=(ll)9223372036854775807;
const int MAX=10000;
const ll MOD=(ll)1e9+7;
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;}

string s;
int main(){
	cin>>s;
	int count=0;
	for(int i=0;i<s.size();i++){
		if(s[i]=='0')
			count++;
	}
	cout<<min(count,s.size()-count)*2<<endl;
	return 0;
}

Measured memory_bytes: 512
n=int(input())
a=list(map(int,input().split()))
c1=0
s=0
for i in range(n):
  s+=a[i]
  if i%2:
    if s>=0:
      c1+=s+1
      s=-1
  else:
    if s<=0:
      c1+=-s+1
      s=1
c2=0
s=0
for i in range(n):
  s+=a[i]
  if i%2:
    if s<=0:
      c2+=-s+1
      s=1
  else:
    if s>=0:
      c2+=s+1
      s=-1
print(min(c1,c2))

Measured memory_bytes: 19932
import java.util.*;
public class Main{
    public static void main(String[] args){
        Scanner scan = new Scanner(System.in);
        int A = scan.nextInt();
        boolean flg = true;
        for(int i=0;i<A;i++){
            int a = scan.nextInt();
            if(a%2==0){
                if(a%3==0 || a%5==0){
                }else{
                    flg=false;
                    break;
                }
            }
        }
        if(flg){
            System.out.println("APPROVED");
        }else{
            System.out.println("DENIED");
        }
    }
}


Measured memory_bytes: 22228
#include <iostream>
#include <cmath>

using namespace std;

int main() {
    int x[3] ,  max = 0 , maxi = 0;
    for(int i = 0 ; i < 3; i++){
        cin >> x[i] ;
        if(x[i] > max){
            maxi = i;
            max = x[i] ;
        }
        
    }
    swap (x[0] , x[maxi]);
    if(x[2] > x [1])
        swap(x[2], x[1]);
    cout << x[0]-x[1] +x[1]-x[2] << endl;
    return 0;
}


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

int main(void){
  int i, N;
  double ans;
  
  cin >> N;
  double x[N];
  string u[N];
  for(i=0; i<N; i++) cin >> x[i] >> u[i];
  
  ans = 0;
  for(i=0; i<N; i++){
    if(u[i]=="JPY"){ans += x[i];}
    else{ans += x[i] * 380000;}
  }
  cout << ans;
  cout << endl;
  return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
int main(void) {
    int w, h;
    int x, y, r;

    scanf("%d %d %d %d %d", 
          &w, &h, &x, &y, &r);

    if(y+r <= h && y-r >= 0 
       && x+r <= w && x-r >= 0) {
        printf("Yes\n");
    }
    else printf("No\n");
    return 0;

}



Measured memory_bytes: 2112
#include<bits/stdc++.h>
#define pb push_back
#define Int long long
using namespace std;

const long long MOD=(long long)(1e9+7);
const int NAX=1005;
const int MAXN=1000005;
Int N,M,K;
Int W,H;
Int X,Y,Z;
vector<Int> A;
int spf[MAXN];
void sieve() 
{ 
    spf[1] = 1; 
    for (int i=2; i<MAXN; i++)
        spf[i] = i; 
    for (int i=4; i<MAXN; i+=2) 
        spf[i] = 2; 
  
    for (int i=3; i*i<MAXN; i++) 
    { 
        if (spf[i] == i) 
        { 
            for (int j=i*i; j<MAXN; j+=i) 
                if (spf[j]==j) 
                    spf[j] = i; 
        } 
    } 
} 


Int perform(Int x){
    return (x*(x+1))/2LL;
}

Int getFactors(int x){
    Int ans=1;
    Int temp=x;
    while(temp!=1){
        int iter=0;
        int prime=spf[temp];
        while(temp%prime==0){
            temp/=prime;
            ++iter;
        }
        ans*=(iter+1);
    }
    return ans;
}
int main()
{
    string S;cin>>S;
    string ans=S;
    if(S.back()=='s') ans+="es";
    else ans+="s";
    cout<<ans<<"\n";
}

Measured memory_bytes: 3612
#include <iostream>
#include <vector>
#include <algorithm>
#define ll long long
using namespace std;
int main(){
    int k,x;
    cin>>k>>x;
    int d;
    
    for(int i=-k+1;i<=k-1;i++){
        cout<<x+i<<" ";
    }
    return 0;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
#define MAX 100002
int n;
vector<int> v[MAX];
int dp[MAX],cnt[MAX];
multiset<int> vv[MAX];
multiset<int> tmp[MAX];

bool can;
int mx;
vector<int> unf[MAX];
int C;
inline void dfs(int b, int pr = -1) {
	vv[b].clear();
	unf[b].clear();
	int deg = 0;
	for (int go : v[b]) {
		if (go == pr)continue;
		dfs(go, b);
		deg++;
		vv[b].insert(dp[go] + 1);
	}
	tmp[b] = vv[b];
	C += deg/2;
	if (deg % 2 && b == 0) {
		C++;
	}
	if (vv[b].size()) {
		int la = (*vv[b].rbegin());
		if (la > mx) {
			can = true;
			dp[b] = 0;
			return;
		}
	}
	while (vv[b].size() > 1) {
		int bc = *vv[b].rbegin();
		vv[b].erase(prev(vv[b].end()));
		int able = mx - bc;
		auto it = vv[b].upper_bound(able);
		if (it == vv[b].begin()) {
			unf[b].push_back(bc);
			continue;
		}
		it = prev(it);
		vv[b].erase(it);
	}
	if (vv[b].size()) {
		unf[b].push_back(*vv[b].begin());
	}
	vv[b].clear();
	if (deg%2&&unf[b].size() > 1) {
		can = true;
		dp[b] = 0;
		return;
	}
	if (deg % 2) {
		dp[b] = unf[b][0];
		return;
	}
	else {
		if (unf[b].size() == 0) {
			dp[b] = 0;
			return;
		}
		else {
			if (b == 0) {
				can = true;
				dp[b] = 0;
				return;
			}
			vv[b] = tmp[b];
			unf[b].clear();
			vv[b].erase(prev(vv[b].end()));
			while (vv[b].size() > 1) {
				int bc = *vv[b].rbegin();
				vv[b].erase(prev(vv[b].end()));
				int able = mx - bc;
				auto it = vv[b].upper_bound(able);
				if (it == vv[b].begin()) {
					unf[b].push_back(bc);
					continue;
				}
				it = prev(it);
				vv[b].erase(it);
			}
			if (vv[b].size()) {
				unf[b].push_back(*vv[b].begin());
			}
			if (unf[b].size() == 1) {
				dp[b] = unf[b][0];
				return;
			}
			can = true;
			dp[b] = 0;
			return;
		}
	}
}
bool ok(int len) {
	can = false;
	mx = len;
	C = 0;
	dfs(0);
	return can == false;
}
int main() {
	cin >> n;
	for (int i = 1; i < n; i++) {
		int a, b;
		scanf("%d%d", &a, &b);
		a--;
		b--;
		v[a].push_back(b);
		v[b].push_back(a);
	}
	int mint = 1;
	int maxt = n;
	while (mint + 1 < maxt) {
		int mid = (mint + maxt) >> 1;
		if (ok(mid)) {
			maxt = mid;
		}
		else {
			mint = mid + 1;
		}
	}
	if (ok(mint)) {
		ok(mint);
		cout <<C<<" "<< mint << endl;
	}
	else {
		ok(maxt);
		cout << C<<" "<<maxt << endl;
	}
	return 0;
}


Measured memory_bytes: 38016
//////////////////////////////
// Author: whatisit
// Date: 2020-05-14 01:39 
//////////////////////////////
#include <bits/stdc++.h>
using namespace std;

void solve() {
	int l;
	cin >> l;
	double ans = (double) l / 3;
	ans = ans * ans * ans;
	cout << setprecision(7) << ans;
}

int main() {
	//cin.tie(0); ios_base::sync_with_stdio(0);
	solve();
	return 0;
}

Measured memory_bytes: 256
function Main(input) {
    
	//var r;
	
	input = input.split("\n");
	
	//var line = input[0].split(" ");
	
	var line = input[0]
	
	var temp = {}
	
	for(var i=0; i<line.length; i++) {
	    if(line[i] in temp) {
	        console.log("no")
	        return;
	    }
	    temp[line[i]] = 1
	}
	
	
    
	console.log("yes");
    
}

//*この行以降は編集しないでください（標準入出力から一度に読み込み、Mainを呼び出します）
Main(require("fs").readFileSync("/dev/stdin", "utf8"));

Measured memory_bytes: 21192
#include<iostream>
using namespace std;
int main(void) {
    // ???????????????????????????
    int r, c;
    cin >> r >> c;
    // ????´?????????????????????????????????????????????????
    int clm[c];
    for (int i = 0; i < c; i++)
        clm[i] = 0;
    int row = 0;
    for (int i = 0; i < r; i++) {
        int sum = 0;
        for (int j = 0; j < c; j++) {
            int tmp;
            cin >> tmp;
            cout << tmp << " ";
            clm[j] += tmp;
            sum += tmp;
        }
        cout << sum << endl;
    }
    for (int i = 0; i < c; i++) {
        cout << clm[i] << " ";
        row += clm[i];
    }
    cout << row << endl;
    return 0;
}

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

using namespace std;

typedef long long ll;
#define mems(p) memset(p,-1,sizeof(p))
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define nl "\n"

const int mxN = 1e5;
const ll MOD = 1e9 + 7;

void fast()
{ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);}

ll gcd(ll a, ll b) {
	return b ? gcd(b, a%b) : a;
}

int main() {
	fast();
	int n;
	cin >> n;
	vector<ll> a(n);
	ll x = 0;
	for (int i = 0; i < n; ++i)
	{
		cin >> a[i];
		x ^= a[i];
	}
	for (int i = 0; i < n; ++i)
	{
		cout << (x ^ (a[i])) << " ";
	}
	cout << nl;
}

Measured memory_bytes: 4776
#include <stdio.h>  
#include <algorithm>  
#include <assert.h>
#include <bitset>
#include <cmath>  
#include <complex>  
#include <deque>  
#include <functional>  
#include <iostream>  
#include <limits.h>  
#include <map>  
#include <math.h>  
#include <queue>  
#include <set>  
#include <stdlib.h>  
#include <string.h>  
#include <string>  
#include <time.h>  
#include <unordered_map>  
#include <unordered_set>  
#include <vector>  

#pragma warning(disable:4996)  
#pragma comment(linker, "/STACK:336777216")  
using namespace std;

#define mp make_pair  
#define Fi first  
#define Se second  
#define pb(x) push_back(x)  
#define szz(x) ((int)(x).size())  
#define rep(i, n) for(int i=0;i<n;i++)  
#define all(x) (x).begin(), (x).end()  
#define ldb ldouble  

typedef tuple<int, int, int> t3;
typedef long long ll;
typedef unsigned long long ull;
typedef double db;
typedef long double ldb;
typedef pair <int, int> pii;
typedef pair <ll, ll> pll;
typedef pair <ll, int> pli;
typedef pair <db, db> pdd;

int IT_MAX = 1 << 20;
const ll MOD = 1000000007;
const int INF = 0x3f3f3f3f;
const ll LL_INF = 0x3f3f3f3f3f3f3f3f;
const db PI = acos(-1);
const db ERR = 1e-10;

int main() {
	int M, K;
	scanf("%d %d", &M, &K);
	
	if (M == 0) {
		if (K == 0) return !printf("0 0\n");
		return !printf("-1\n");
	}
	if (M == 1) {
		if (K == 0) return !printf("0 1 1 0\n"); 
		return !printf("-1\n");
	}
	if (K == 0) {
		for (int i = 0; i < (1 << M); i++) printf("%d %d ", i, i);
		return !printf("\n");
	}

	if (K >= (1 << M)) return !printf("-1\n");

	printf("0 ");
	for (int i = 1; i < (1 << M); i++) if (i != K) printf("%d ", i);
	printf("0 %d ", K);
	for (int i = (1 << M) - 1; i >= 1; i--) if (i != K) printf("%d ", i);
	return !printf("%d\n", K);
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define all(x) (x).begin(),(x).end()
using namespace std;
using ll = long long;
using P = pair<int,int>;
template <class T> void chmin(T &a, const T &b) noexcept { if (b < a) a = b; }
template <class T> void chmax(T &a, const T &b) noexcept { if (a < b) a = b; }
void debug_out() { cout << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) { cout << H << " "; debug_out(T...); }
#ifdef _DEBUG
  #define debug(...) debug_out(__VA_ARGS__)
#else
  #define debug(...) 
#endif

int main() {
  std::cin.tie(nullptr);
  std::ios_base::sync_with_stdio(false);
  std::cout << std::fixed << std::setprecision(15);
  int n;
  cin >> n;
  cout << 0 << endl; //0番目を調べる
  string start;
  cin >> start;
  bool ok = false;
  if (start == "Vacant") ok = true;
  int left = -1, right = n;
  while (!ok) {
    int mid = (left+right)/2;
    cout << mid << endl;
    string s;
    cin >> s;
    if (s == "Vacant") {
      ok = true; break;
    }
    if (mid % 2 == 0 && s == start) left = mid;
    else if (mid % 2 == 1 && s != start) left = mid;
    else right = mid;
  }
  return 0;
}

Measured memory_bytes: 852
#include <iostream>
#include <vector>
#include <numeric>
using namespace std;

vector<int> Input(const int n)
{
	vector<int> W;
	for(int i = 0; i < n; i++){
		int w;
		cin >> w;
		W.push_back(w);
	}
	return W;
}

bool IsAllLoaded(int P, vector<int>& W, int k)
{
	int TrackIndex = 0;
	int CurrentSum = 0;
	int i = 0;
	for(i = 0; i < W.size(); i++){
		if(W[i] > P){
			return false;
		}
		if(CurrentSum + W[i] > P){
			TrackIndex++;
			if(TrackIndex == k){
				return false;
			}
			CurrentSum = 0;
		}
		CurrentSum += W[i];
	}
	return true;
}

int Calc(vector<int> W, int k)
{
	int Sum = accumulate(W.begin(), W.end(), 0 );
	int Ave = Sum / W.size();
	int e = Sum;
	int s = Ave - 1;
	int m = (e + s) / 2;
//	cout << s << ' ' << m << ' ' << e << endl;
	
	while(e > s + 1){
		if(IsAllLoaded(m, W, k)){
			e = m;
			m = (s + m) / 2;
		}else if(!IsAllLoaded(m+1, W, k)){
			s = m;
			m = (e + m) / 2;
		}else{
			return m + 1;
		}
//		cout << s << ' ' << m << ' ' << e << endl;
	}
	return e;
}

int main()
{
	int n, k; //n:???????????° k:?????????????????°  
	cin >> n >> k;
	vector<int> W = Input(n);
	int P = Calc(W, k); //P:??????????????????????????????????????????????????§????????????????°????
	cout << P << endl;
	return 0;
}

Measured memory_bytes: 3660
#include "bits/stdc++.h"
using namespace std;
#ifdef _DEBUG
#define dlog(str) cout << "====" << str << endl;
#else
#define dlog(str)
#endif
#define INF 999999999
#define MOD 1000000007
#define REP(i, n) for(int i = 0, i##_l = (n); i < i##_l; i++)
#define FOR(i, s, e) for(int i = s, i##_l = (e); i < i##_l; i++)
#define LLI long long int
#define _min(a,b) ((a<b)?a:b)
#define _max(a,b) ((a<b)?b:a)
#define chmax(a, b) a = _max(a, b)
#define chmin(a, b) a = _min(a, b)
#define bit(a, shift) ((a>>shift)&1))
#define pm(a) ((a)?1:-1)
#define SORT(v) sort(v.begin(),v.end())
#define RSORT(v) sort((v).rbegin(), (v).rend())
// int 2.14E±9    lli 9.2E±18    double 1.7E±380


int main()
{
	cout << fixed << setprecision(10);
	int x;
	cin >> x;
	int h = 0;
	h += x / 500;
	x -= h * 500;
	h *= 1000;
	h += (x / 5) * 5;
	cout << h;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
using namespace std;
typedef long long ll;
ll N,K;
ll arr[1000010];
 
bool judge(ll x){
    ll cnt = 0;
    for(int i = 1;i<N;i++){
        if(arr[i]>=0){
            ll l = i+1,r = N,mid;
            if(arr[i]*arr[l]>=x) continue;//二分中无解的情况
            while(l<r){
                mid = (l+r+1)>>1;
                if(arr[i]*arr[mid] < x) l = mid;
                else r = mid-1;
            }
            cnt += l-i;
        }else{ //和负数乘会变号，情况和上面相反
            ll l = i+1,r = N,mid;
            if(arr[i]*arr[N] >= x) continue;//二分中无解的情况
            if(arr[i]*arr[l]<x){//特殊情况
                cnt += N-l+1;
                continue;
            }
            while(l<r){
                mid = (l+r+1)>>1;
                if(arr[i]*arr[mid] >= x) l = mid;
                else r = mid-1;
            }
            cnt += N-l;
        }
    }
    return cnt < K;
}
 
int main(){
    cin>>N>>K;
    for(int i = 1;i<=N;i++) scanf("%lld",&arr[i]);
    sort(arr+1,arr+N+1);
    ll l = -1e18-10,r = 1e18+10,mid;
    while(l<r){
        mid = (l+r+1)>>1;
        if(judge(mid)) l = mid;
        else r = mid-1;
    }
    cout<<l<<endl;
    return 0;

}

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

using namespace std;
typedef long long ll;
typedef double db;
#define inf 0x3f3f3f3f
ll a[212345];
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
bool cmp(ll x, ll y) {
	return x > y;
}
int main() {
	ll n, i;
	cin >> n;
	for (i = 0; i < n; ++i) {
		cin >> a[i];
	}
	sort(a, a + n,cmp);
	ll ans = a[0];
	n -= 2;
	for (i = 0; i < n; ++i) {
		ans += a[1 + i / 2];
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 5180
#include <iostream>
#include <stdio.h>
#include <string>
#include <algorithm>
#include <math.h>

using namespace std;

int main() {
	int n, k, num = 1, count = 0;
	cin >> n >> k;
	while (n >= num) {
		num *= k;
		count++;
	}
	cout << count<<endl;
	return 0;
}

Measured memory_bytes: 256
void main()
{
    long k = rdElem;

    long total;
    foreach (i; 1 .. k+1)
    {
        foreach (j; 1 .. k+1)
        {
            long g = gcd(i, j);
            foreach (l; 1 .. k+1)
            {
                total += gcd(g, l);
            }
        }
    }

    total.writeln;
}

enum long mod = 10^^9 + 7;
enum long inf = 1L << 60;
enum double eps = 1.0e-9;

T rdElem(T = long)()
if (!is(T == struct))
{
    return readln.chomp.to!T;
}

alias rdStr = rdElem!string;
alias rdDchar = rdElem!(dchar[]);

T rdElem(T)()
if (is(T == struct))
{
    T result;
    string[] input = rdRow!string;
    assert(T.tupleof.length == input.length);
    foreach (i, ref x; result.tupleof)
    {
        x = input[i].to!(typeof(x));
    }
    return result;
}

T[] rdRow(T = long)()
{
    return readln.split.to!(T[]);
}

T[] rdCol(T = long)(long col)
{
    return iota(col).map!(x => rdElem!T).array;
}

T[][] rdMat(T = long)(long col)
{
    return iota(col).map!(x => rdRow!T).array;
}

void rdVals(T...)(ref T data)
{
    string[] input = rdRow!string;
    assert(data.length == input.length);
    foreach (i, ref x; data)
    {
        x = input[i].to!(typeof(x));
    }
}

void wrMat(T = long)(T[][] mat)
{
    foreach (row; mat)
    {
        foreach (j, compo; row)
        {
            compo.write;
            if (j == row.length - 1) writeln;
            else " ".write;
        }
    }
}

import std.stdio;
import std.string;
import std.array;
import std.conv;
import std.algorithm;
import std.range;
import std.math;
import std.numeric;
import std.mathspecial;
import std.traits;
import std.container;
import std.functional;
import std.typecons;
import std.ascii;
import std.uni;
import core.bitop;

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

#define for_(i,a,b) for(int i=a;i<b;++i)
#define ALL(a) a.begin(),a.end()
#define INIT(a,b) memset(a,b,sizeof(a))
using lint = long long int;

int main() {
    int A, B, C, K;
    cin >> A >> B >> C;
    cin >> K;

    while (A >= B) {
        B *= 2;
        --K;
    }

    while (B >= C) {
        C *= 2;
        --K;
    }

    puts(K >= 0 ? "Yes" : "No");
}

Measured memory_bytes: 3640
using System;
using System.Linq;

public class Tree{
  public int value;
  public Tree parent;
  public Tree left;
  public Tree right;
}

class A8{
   static Tree root = new Tree();
  public static void Main(){
    int n = int.Parse(Console.ReadLine());
    int i = 0,k = 0,count = 0;
    string[] str = new string[n];
    for(i = 0;i < n;i++){
      var command = Console.ReadLine().Split(' ');
      if(command[0].Equals("insert")) Insert(root,int.Parse(command[1]));
      else if(command[0].Equals("find")){
       if(Find(int.Parse(command[1])) == null)  str[k++] = "no";
       else str[k++] = "yes";
     }
     if(command[0].Equals("print")){
       for(int j = count;j < k;j++){
         Console.WriteLine(str[j]);
         count++;
       }
     Print(root);
      }else if(i == n - 1){
        for(int j = count;j < k;j++){
          Console.WriteLine(str[j]);
          count++;
        }
      }
    }
  }
  public static Tree Find(int key){
    Tree n = root;
    while(n != null){
      if(n.value > key) n = n.left;
      else if(n.value < key) n = n.right;
      else break;
    }
    return n;
  }
  public static void Insert(Tree tree,int value){
    Tree x = tree;
    Tree y = null;
    while(x != null && x.value != 0){
      y = x;
      if(value < x.value) x = x.left;
      else x = x.right;
    }
    Tree tmp = new Tree();
    tmp.value = value;
    tmp.parent = y;

    if(y == null){
      tree.value = value;
    }else if(value < y.value){
      y.left = tmp;
    }else{
      y.right = tmp;
    }
  }
  public static void Print(Tree tree){
    Inorder(tree);
    Console.WriteLine();
    Preorder(tree);
    Console.WriteLine();
  }

  public static void Inorder(Tree tree){
    if(tree == null) return;
    Inorder(tree.left);
    Console.Write(" " + tree.value);
    Inorder(tree.right);
  }
  public static void Preorder(Tree tree){
    if(tree == null) return;
    Console.Write(" " + tree.value);
    Preorder(tree.left);
    Preorder(tree.right);
  }
}



Measured memory_bytes: 44852
import java.util.Scanner;
import java.util.List;
import java.util.ArrayList;
import java.util.Collections;
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        StringBuilder sb = new StringBuilder();
        while (n != 0) {
            sb.append(n % 2 == 0 ? 0 : 1);
            n -= Math.abs(n % 2);
            n /= -2;
        }
        if (sb.length() == 0) {
            sb.append(0);
        }
        System.out.println(sb.reverse().toString());
    }
}


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

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

  string s; cin >> s;
  if (s == "ABC")
    cout << "ARC" << endl;
  else
    cout << "ABC" << endl;

  return 0;
}

Measured memory_bytes: 3656
#include <cstdio>

int main(void) {
	int a, b;
	std::scanf("%d %d", &a, &b);
	const int d = a / b, r = a % b;
	const double f = static_cast<double>(a) / static_cast<double>(b);
	std::printf("%d %d %.5f\n", d, r, f);
	return 0;
}

Measured memory_bytes: 2652
#include <string>
#include <map>
#include <vector>
#include <iostream>
using namespace std;
int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int a, b, c;
    cin >> a >> b >> c;
    int ans;
    ans = b / a;
    if (ans > c)
        ans = c;
    cout << ans;
}


Measured memory_bytes: 256
#include<iostream>
#include<cmath>
using namespace std;
const int maxn=100005;
int n,m;
int w[maxn];
long long v[maxn],dp[maxn];
int main()
{
    cin>>n>>m;
    for(int i=1;i<=n;i++)
    {
        cin>>w[i]>>v[i];
    }
   for(int i=1;i<=n;i++)
    {
        for(int j=m;j>=w[i];j--)
        {
            dp[j]=max(dp[j],dp[j-w[i]]+v[i]);
        }
    }
    cout<<dp[m];
    return 0;
}

Measured memory_bytes: 3940
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
typedef pair<int, P> P1;
typedef pair<P, P> P2;
#define pu push
#define pb push_back
#define mp make_pair
#define eps 1e-7
#define INF 1000000000
#define fi first
#define sc second
#define rep(i, x) for (long long i = 0; i < x; i++)
#define repn(i, x) for (long long i = 1; i <= x; i++)
#define SORT(x) sort(x.begin(), x.end())
#define ERASE(x) x.erase(unique(x.begin(), x.end()), x.end())
#define POSL(x, v) (lower_bound(x.begin(), x.end(), v) - x.begin())
#define POSU(x, v) (upper_bound(x.begin(), x.end(), v) - x.begin())
vector<pair<string, P> > vec;
// vector<vector<int>> data(3, vector<int>(4));

const string YES = "Yes";
const string NO = "No";

void solve(long long A, long long B, long long C, long long D) {
    rep(i, 1000000) {
        C -= B;
        if (C <= 0) {
            cout << "Yes" << endl;
            break;
        }
        A -= D;
        if (A <= 0) {
            cout << "No" << endl;
            break;
        }
    }
}

int main() {
    long long A;
    scanf("%lld", &A);
    long long B;
    scanf("%lld", &B);
    long long C;
    scanf("%lld", &C);
    long long D;
    scanf("%lld", &D);
    solve(A, B, C, D);
    return 0;
}


Measured memory_bytes: 3804
#n = int(input())
#n,k = map(int,input().split())
#x = list(map(int,input().split()))


def main():
    S = list(input())
    K = int(input())

    li = list("abcdefghijklmnopqrstuvwxyz")
    dic = {}
    for i,j in enumerate(li):
        dic[j] = 26-i
    dic["a"] = 0

    for i in range(len(S)):
        if dic[S[i]] <= K:
            K -= dic[S[i]]
            S[i] = "a"
    if K>0:
        num = (dic[S[-1]]-26)*(-1)
        S[-1] = li[(num+K)%26]

    for i in range(len(S)):
        print(S[i],end="")
    print()


if __name__ == "__main__":
    main()






Measured memory_bytes: 5436