akhauriyash/Code-Regression huggingface dataset:
# import numpy as np
import sys, math, heapq
from itertools import permutations, combinations
from collections import defaultdict, Counter, deque
from math import factorial, gcd
from bisect import bisect_left, bisect_right

sys.setrecursionlimit(10 ** 7)
MOD = 10 ** 9 + 7
input = lambda: sys.stdin.readline()[:-1]
pl = lambda x: print(*x, sep="\n")

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

if N == 0:
    if A[0] == 1:
        print(1)
        exit()
    else:
        print(-1)
        exit()
if N != 0 and A[0] > 0:
    print(-1)
    exit()

rcA = [0] * (N)
rcA[-1] = A[-1]
for i in range(1, N):
    rcA[-i - 1] = rcA[-i] + A[-i - 1]
# print(rcA)

cnt = 1
node = 1
for a, rca in zip(A, rcA):
    min_node = node - a
    max_node = 2 * (node - a)
    if rca < min_node or min_node < 0:
        print(-1)
        exit()
    node = min(max_node, rca)
    # print(node)
    cnt += node
if node != A[-1]:
    print(-1)
    exit()
print(cnt)

Measured memory_bytes: 82364
n, m = map(int, input().split())
g = [[float('inf')] * n for i in range(n)]
d = [[float('inf')] * n for i in range(n)]
nv = [[j for j in range(n)] for i in range(n)]

for i in range(m):
    a, b, c = map(int, input().split())
    d[a - 1][b - 1] = c
    d[b - 1][a - 1] = c
    g[a - 1][b - 1] = c
    g[b - 1][a - 1] = c

for k in range(n):
    for i in range(n):
        for j in range(n):
            if d[i][j] > d[i][k] + d[k][j]:
                d[i][j] = d[i][k] + d[k][j]
                nv[i][j] = nv[i][k]
edges = set((i, j) for i in range(n) for j in range(i + 1, n) if g[i][j] < float('inf'))

for i in range(n):
    for j in range(i + 1, n):
        k = nv[i][j]
        t = min((i, k), (k, i))
        if t in edges:
            edges.remove(t)
print(len(edges))


Measured memory_bytes: 3620
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        String s = sc.next(); 
        String a = sc.next();
        
        boolean f = false;
      in :  for(int i=0;i<s.length();i++){
            for(int j=0;j<a.length();j++){
                if(s.charAt((i+j)%s.length()) != a.charAt(j))continue in;
            }
            f=true;break;
        }
        
        System.out.println( f ? "Yes":"No");
    }
}



Measured memory_bytes: 26340
import java.util.Scanner;

class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        long[] dp = new long[100];
        dp[0] = 2;
        dp[1] = 1;
        for (int i = 2; i <= n; i++) {
            dp[i] = dp[i - 1] + dp[i - 2];
        }
        System.out.println(dp[n]);
    }
}


Measured memory_bytes: 21844
fun main(args : Array<String>){
    var k: String = readLine()!!
    var (a,b)=readLine()!!.split(" ").map(String::toInt)
    var flag: String? = null
    for (i in a..b){
        if ((i % k.toInt()) == 0){
            flag = "OK"
            break
        }
    }
	print(flag ?: "NG")
}

Measured memory_bytes: 36352
N, A, B, C, D = map(int, input().split())


for i in range(N) :
    j = N-1-i
    lb = A+C*i-D*j
    ub = A+D*i-C*j
    if lb <= B <= ub :
        print('YES')
        break
else :
    print('NO')

Measured memory_bytes: 3060
def slove():
    import sys
    import collections
    input = sys.stdin.readline
    n, t = list(map(int, input().rstrip('\n').split()))
    a = list(map(int, input().rstrip('\n').split()))
    d = collections.defaultdict(list)
    min_b = 10 ** 9
    max_p = 0
    for v in a:
        p = v - min_b
        max_p = max(max_p, p)
        d[p] += [min_b]
        min_b = min(min_b, v)
    print(len(d[max_p]))


if __name__ == '__main__':
    slove()


Measured memory_bytes: 71248
#include <iostream>
#include <stack>
#include <vector>
using namespace std;

int main() {
	int n;
	cin >> n;
	vector<stack<int>> S(n);
	int q;
	cin >> q;
	for (int i = 0; i < q; ++i) {
		int query;
		cin >> query;
		if (query == 0) {
			int t, x;
			cin >> t >> x;
			S[t].push(x);
		}
		else if (query == 1) {
			int t;
			cin >> t;
			if (!S[t].empty()) cout << S[t].top() << endl;
		}
		else {
			int t;
			cin >> t;
			if (!S[t].empty()) S[t].pop();
		}
	}
}


Measured memory_bytes: 4372
#include<iostream>
#include<vector>
#include<set>
#include<map>
#include<algorithm>
#include<cmath>
#include<queue>
#include<map>
#include<iomanip>
using namespace std;
 
typedef long long ll;


int main(){
	string s;
	cin >>s;
	
	
	string ss[7] = {"SUN","MON","TUE","WED","THU","FRI","SAT"};
	int a[7] = {7,6,5,4,3,2,1};
	
	for(int i=0;i<7;++i){
		if(ss[i] == s){
			cout << a[i] <<endl;
			return 0;
		}
	}
	
	
	
	return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <numeric>
#define rep(i, n) for(ll i=0; i < n; i++)
#define reps(i, n) for(ll i=1; i <= n; i++)
#define INF 1e9
#define ALL(v) v.begin(), v.end()
#define pb(x) push_back(x)
#define mp(x,y) make_pair(x,y)

using namespace std;
using ll=long long;

int main() {
  ll n,k,q;cin >> n >> k >> q;
  map<ll,pair<ll,ll>> s;
  reps(i,n) s[i]=mp(0,k-q);
  reps(i,q) {int a;cin >> a;s[a].first++;}
  reps(i,n) s[i].second += s[i].first;
  reps(i,n) cout <<(s[i].second>0?"Yes":"No")<<endl;
}

Measured memory_bytes: 6912
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
ll mod=1e9+7;
ll n;
ll x[100005];


ll mul(ll a,ll b){
  return (a*b)%mod;
}

int main(){
  
  cin>>n;
  for(int i=0;i<n;i++)cin>>x[i];
  
  if(n==2){
    cout<<2<<endl;
    return 0;
  }

  vector<ll> v;
  ll c=1,f=1;
  for(ll i=0;i<n;i++){
    if(x[i]<c){
      v.push_back(i+1);
    }else{
      c+=2;
    }
  }

  ll num=c/2;
  //  cout<<num<<endl;

  for(ll i=0;i<(int)v.size();i++){
    f=mul(f,v[i]-i);
  }
  
  for(ll i=1;i<=num;i++){
    f=mul(f,i);
  }

  cout<<f<<endl;
  return 0;
}



Measured memory_bytes: 1660
a, b, m = map(int, input().split())
a = list(map(int,input().split()))
b = list(map(int, input().split()))
xyc = [list(map(int, input().split())) for _ in range(m)]
result = [min(a)+min(b)]
for x, y, c in xyc:
    result.append(a[x-1]+b[y-1]-c)
print(min(result))

Measured memory_bytes: 42408
/*
confirm 0LL and 1LL
confirm cornercases such as 0
confirm times of cin < 10^6
*/
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<ll, ll>;
using Pld = pair<ld, ld>;
using Vec = vector<ll>;
using VecP = vector<P>;
using VecB = vector<bool>;
using VecC = vector<char>;
using VecD = vector<ld>;
using VecS = vector<string>;
using Graph = vector<VecP>;
template <typename T>
using Vec1 = vector<T>;
template <typename T>
using Vec2 = vector<Vec1<T> >;
#define REP(i, m, n) for(ll (i) = (m); (i) < (n); ++(i))
#define REPN(i, m, n) for(ll (i) = (m); (i) <= (n); ++(i))
#define REPR(i, m, n) for(ll (i) = (m)-1; (i) >= (n); --(i))
#define REPNR(i, m, n) for(ll (i) = (m); (i) >= (n); --(i))
#define rep(i, n) REP(i, 0, n)
#define repn(i, n) REPN(i, 1, n)
#define repr(i, n) REPR(i, n, 0)
#define repnr(i, n) REPNR(i, n, 1)
#define all(s) (s).begin(), (s).end()
#define pb push_back
#define fs first
#define sc second
template <typename T>
bool chmax(T &a, const T b){if(a < b){a = b; return true;} return false;}
template <typename T>
bool chmin(T &a, const T b){if(a > b){a = b; return true;} return false;}
template <typename T>
ll pow2(const T n){return (1LL << n);}
template <typename T>
void cosp(const T n){cout << n << ' ';}
void co(void){cout << '\n';}
template <typename T>
void co(const T n){cout << n << '\n';}
template <typename T1, typename T2>
void co(pair<T1, T2> p){cout << p.fs << ' ' << p.sc << '\n';}
template <typename T>
void co(const Vec1<T> &v){for(T i : v) cosp(i); co();}
template <typename T>
void co(initializer_list<T> v){for(T i : v) cosp(i); co();}
template <typename T>
void ce(const T n){cerr << n << endl;}
void sonic(){ios::sync_with_stdio(false); cin.tie(0);}
void setp(const ll n){cout << fixed << setprecision(n);}
constexpr int INF = 1e9+1;
constexpr ll LINF = 1e18+1;
constexpr ll MOD = 1e9+7;
//constexpr ll MOD = 998244353;
constexpr ld EPS = 1e-11;
const ld PI = acos(-1);

int main(void){
	ll n;
	cin >> n;
	Vec a(n);
	rep(i, n - 1){
		ll b;
		cin >> b;
		a[b]++;
	}
	repn(i, n - 1) co(a[i]);
	co(0);

	return 0;
}


Measured memory_bytes: 4844
#include<bits/stdc++.h>
using namespace std;
#define inf 1e9
#define ll long long
#define ull unsigned long long
#define M 1000000007
#define P pair<int,int>
#define PLL pair<ll,ll>
#define FOR(i,m,n) for(int i=m;i<n;i++)
#define RFOR(i,m,n) for(int i=m;i>=n;i--)
#define rep(i,n) FOR(i,0,n)
#define rrep(i,n) RFOR(i,n,0)
#define all(a) a.begin(),a.end()
const int vx[4] = {0,1,0,-1};
const int vy[4] = {1,0,-1,0};
#define PI 3.14159265

int n;
int a[100000];

int main(){
  cin>>n;
  rep(i,n){
    cin>>a[i];
  }

  int ans=0;
  rep(i,n){
    while(!(a[i]%2)){
      ans++;
      a[i]/=2;
    }
  }

  cout<<ans<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n) FOR(i,0,n)
#define repr(i,n) for(int i=(n)-1;0<=i;--i)
#define each(e,v) for(auto&& e:(v))
#define all(v) begin(v),end(v)
#define DUMP(x) cerr<<#x<<": "<<(x)<<endl
#define DEBUG(x) cerr<<#x<<": "<<(x)<<" (L"<<__LINE__<<")"<<endl
using namespace std;
using vint = vector<int>;
using vdouble = vector<double>;
using vstring = vector<string>;
using ll = long long;
using vll = vector<ll>;
template <class T> void chmin(T& a, const T& b) { a = min(a, b); }
template <class T> void chmax(T& a, const T& b) { a = max(a, b); }

constexpr ll INF = 1LL << 62;

int main() {
    int n, k; cin >> n >> k;
    vll x(n), y(n), sx(n);
    rep(i, n) {
        cin >> x[i] >> y[i];
        sx[i] = x[i];
    }
    sort(all(sx));

    ll ans = INF;
    rep(l, n) {
        FOR(r, l+1, n) {
            const ll w = sx[r] - sx[l];

            vll v;
            rep(i, n) {
                if(sx[l] <= x[i] && x[i] <= sx[r]) v.push_back(y[i]);
            }
            sort(all(v));

            rep(i, (int)v.size() - k + 1) {
                ll h = v[i+k-1] - v[i];
                chmin(ans, w * h);
            }
        }
    }
    cout << ans << endl;
    return 0;
}


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

if N!=0:
    p = list(map(int,input().split()))
else:
    p=[]

d = {n: 1 for n in p}

a = X
b = X
while True:
    if d.get(a) != 1:
        print(a)
        break
    elif d.get(b) != 1:
        print(b)
        break
    else:
        a -= 1
        b += 1


Measured memory_bytes: 9184
#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <algorithm>
#include <utility>
#include <functional>
#include <cstring>
#include <queue>
#include <stack>
#include <math.h>
#include <iterator>
#include <vector>
#include <string>
#include <set>
#include <math.h>
#include <iostream> 
#include<map>
#include <iomanip>
#include <stdlib.h>
#include <list>
#include <typeinfo>
#include <list>
#include <set>
using namespace std;
#define MAX_MOD 1000000007
#define REP(i,n) for(long long i = 0;i < n;++i)
#define LONGINF 1000000000000000000
int done[200000] = {};
int main() {
	int n, m;
	cin >> n >> m;
	vector<int> ans;
	if (m <= 1 || m >= 2 * n - 1) {
		cout << "No" << endl;
		return 0;
	}
	if (n == m) {
		REP(i, 2 * n - 1) {
			ans.push_back(i + 1);
		}
	}
	else if (m < n) {
		for (int i = 0;i < n - 1;++i) {
			ans.push_back(2 * n - i - 1);
			done[2 * n - i - 1] = true;
		}
		ans.push_back(m);
		done[m] = true;
		for (int i = 1;i <= 2 * n - 1;++i) {
			if (done[i] == false)ans.push_back(i);
		}
	}
	else {
		for (int i = 1;i <= n - 1;++i) {
			ans.push_back(i);
			done[i] = true;
		}
		ans.push_back(m);
		done[m] = true;
		for (int i = 2 * n - 1;i > 0;--i){
			if (done[i] == false) ans.push_back(i);
		}
	}
	cout << "Yes" << endl;
	REP(i, ans.size()) {
		cout << ans[i] << endl;
	}
	return 0;
}

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

using namespace std;

int main(int qtd, char* nome[])
{
    ios::sync_with_stdio(false);

    int a, b, x;
    cin >> a >> b >> x;

    if(a + b >= x && a <= x)
        cout << "YES\n";
    else
        cout << "NO\n";

    return 0;
}


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

int main()
{
    int n;
    cin >> n;
    vector<int> l(n);
    int oe = 0;
    for (int i = 0; i < n; i++)
    {
        cin >> l[i];
        oe += l[i];
    }
    sort(l.begin(), l.end());
    oe -= l[n - 1];
    if (oe > l[n - 1])
    {
        cout << "Yes" << endl;
    }
    else
    {
        cout << "No" << endl;
    }
    return 0;
}

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

#define lint long long
#define P pair<int, int>
#define LLP pair<long long, long long>
#define REP(i, x, n) for(int i = (x), i##_len = (int)(n) ; i < i##_len ; ++i)
#define rep(i, n) for(int i = 0, i##_len = (int)(n) ; i < i##_len ; ++i)
#define repr(i, n) for(int i = (int)(n) - 1 ; i >= 0 ; --i)
#define SORT(x) sort((x).begin(), (x).end())
#define SORT_INV(x) sort((x).rbegin(), (x).rend())

const int IINF = 1e9 + 100;
const long long LLINF = 2e18 + 129;
const long long MOD = 1e9 + 7;
const int dx4[] = {1, 0, -1, 0}, dy4[] = {0, 1, 0, -1};
const int dx8[] = {1, 1, 0, -1, -1, -1, 0, 1}, dy8[] = {0, -1, -1, -1, 0, 1, 1, 1};
const double EPS = 1e-8;

template<typename T>
T gcd(T x, T y){
    T r = x % y;
    while(r != (T)0){
        x = y;
        y = r;
        r = x % y;
    }
    return y;
}

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

    int x, y;
    cin >> x >> y;

    int ans = x + y;

    int g = gcd(x, y);

    ans -= g - 1;

    cout << ans << endl;

    return 0;
}


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

using namespace std;
int main()
{
	long long n;
	cin >> n;
	
	std::vector<long long> s(4,0);
	int i = 0;
	while(i<n){
		string buf;
		cin >> buf;
		if(buf=="AC") s[0]++;
		else if(buf=="WA") s[1]++;
		else if(buf=="TLE") s[2]++;
		else if(buf=="RE") s[3]++;
		i++;
	}
	cout << "AC x " << s[0] << endl;
	cout << "WA x " << s[1] << endl;
	cout << "TLE x " << s[2] << endl;
	cout << "RE x " << s[3] << endl;
}


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

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

    long long e;
    cin >> e;
    string nput, last="";
    cin >> nput;
    long long b=nput.length();
    for (int i=0;i<b;i++){
      char c=nput[i];
      c+=e;
      if (c>90){
        c-=26;}
      last+=c;}
      cout << last;}

Measured memory_bytes: 3672
N, M = [int(x) for x in input().split()]
AB = [[int(x) for x in input().split()] for _ in range(N)]
AB.sort(key=lambda x: x[0])

s = 0
for ab in AB:
    if ab[1] > M:
        s += M*ab[0]
        break
    else:
        s += ab[0]*ab[1]
        M -= ab[1]

print(s)


Measured memory_bytes: 22756
import java.io.BufferedReader;
import java.io.*;
import java.util.*;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.Collections;
public class Main {
	public static void main(final String[] args){
    
    Scanner sc = new Scanner(System.in);
    
    String t = sc.next();

    String t2 = t.replace("?", "D");

    System.out.println(t2);
    
    


    


    
    


    
	}
}

Measured memory_bytes: 41328
//include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <fstream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <string>
#include <cstring>
#include <ctime>
#include <climits>
#include <limits>

using namespace std;

//conversion
//------------------------------------------
inline int toInt(string s) { int v; istringstream sin(s); sin >> v; return v; }
template<class T> inline string toString(T x) { ostringstream sout; sout << x; return sout.str(); }

//math
//-------------------------------------------
template<class T> inline T sqr(T x) { return x * x; }

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define EXISTch(s,c) ((((s).find_first_of(c)) != std::string::npos)? 1 : 0)//cがあれば1 if(1)
#define SORT(c) sort((c).begin(),(c).end())

#define REP(i,n) for(int i=0;i<(int)n;++i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI = acos(-1.0);
const int INF = (int)1000000007;
const LL MOD = (LL)1000000007;//10^9+7
const LL INF2 = (LL)100000000000000000;//10^18

int main() {
	int x, y, z; cin >> x >> y >> z;

	int ans = x + y + z;
	
	if (ans >= 22) {
		cout << "bust" << endl;
	}
	else {
		cout << "win" << endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int h,w;
string s[50];
void sett(int i,int j)
{
  if(i<0||i>=h||j<0||j>=w) return;
  if(s[i][j]=='.')
    s[i][j]='1';
  else if(s[i][j]!='#')
    {
      int l = s[i][j]-'0';
      l++;
      s[i][j] = '0'+l;
    }
  else return;

}
int main()
{

  cin>>h>>w;

  for(int i=0;i<h;i++) cin>>s[i];
  for(int i=0;i<h;i++)
  {
    for(int j=0;j<w;j++)
    {
      if(s[i][j]=='#')
      {
        //cout<<i<<j<<"\n";
        sett(i-1,j-1);sett(i-1,j);sett(i-1,j+1);
        sett(i,j-1);sett(i,j+1);
        sett(i+1,j-1);sett(i+1,j);sett(i+1,j+1);
      }
    }
  }
  for(int i=0;i<h;i++)
  {
    for(int j=0;j<w;j++)
    {
      if(s[i][j]=='.')
      {
        s[i][j]='0';
      }
    }
  }
  for(int i=0;i<h;i++) cout<<s[i]<<"\n";

  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
  int n,k;
  string s;
  cin>>n>>k>>s;
  if(s[k-1]=='A')s[k-1]='a';
  else if(s[k-1]=='B')s[k-1]='b';
  else if(s[k-1]=='C')s[k-1]='c';
  cout<<s<<endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <complex>
using namespace std;
typedef complex<double> P;

bool legal(P al, P ar, P bl, P br) {
    return(bl.real() <= ar.real() && br.imag() >= al.imag() &&
           al.real() <= br.real() && ar.imag() >= bl.imag());
}

int main(void) {
    double xa1, ya1, xa2, ya2, xb1, yb1, xb2, yb2;
    while(cin >> xa1 >> ya1 >> xa2 >> ya2 >> xb1 >> yb1 >> xb2 >> yb2) {
        P al(xa1, ya1), ar(xa2, ya2), bl(xb1, yb1), br(xb2, yb2);
        if(legal(al, ar, bl, br)) cout << "YES" << endl;
        else                      cout << "NO"  << endl;
    }
    return(0);
}

Measured memory_bytes: 1216
#include <algorithm>
#include <deque>
#include <fstream>
#include <iomanip>
#include <iostream>
#include <map> //pair is also included in this library
#include <stack>
#include <string>
#include <vector>

#define INF INT_MAX/3

#define REP(i, s, n) for(int i = (int)(s); i < (int)(n); i++)

using namespace std;

typedef long long int ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef pair<int, int> PII;

ll solve(ll N, ll K, ll X, ll Y){
  ll ans = 0;

  REP(i, 0, N){
    if(i < K){
      ans += X;
    } else {
      ans += Y;
    }
  }
  
  return ans;
}

int main(){
  ll ans = 0, N, K, X, Y;
  cin >> N >> K >> X >> Y;

  ans = solve(N, K, X, Y);

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using i64 = int_fast64_t;
#define repeat(i, a, b) for(int i = (a); (i) < (b); ++(i))
#define rep(i, n) repeat(i, 0, n)

void solve() {
    std::vector<int> v;
    int n;
    scanf("%d", &n);
    std::string s;
    std::cin >> s;
    v.push_back(1);
    rep(i, n - 1) {
        if(s[i] == s[i + 1]) {
            v.back()++;
        } else {
            v.push_back(1);
        }
    }
    printf("%d\n", v.size());
}

int main() {
    // std::ios::sync_with_stdio(false);
    std::cin.tie(nullptr);
    solve();
    return 0;
}

Measured memory_bytes: 1020
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i = 0; i < n; i++)
using ll = long long;
int main(){ 
    ll a,b;
    cin>>a>>b;
    if((b-1)%(a-1)==0){
    cout<<(b-1)/(a-1);
    }else{
        cout<<(b-1)/(a-1)+1;
    }
    return 0;
}


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

int main(){
  int n;
  int que[10000];

  while(1){
    cin >> n;
    if(!n)break;

    for(int i=0;i<n;i++)cin >> que[i];
    sort(que,que+n);
    long long int sum = 0;
    for(int i=0;i<n;i++)sum += (n-i-1)*que[i];
    cout << sum << endl;
  }
}

Measured memory_bytes: 0
#include<stdio.h>

int main(){
	int i, n;
	scanf("%d", &n);
	int a[100];
	for (i = 0; i < n; i++){
		scanf("%d", &a[i]);
	}
	for (i = n - 1; i >= 0; i--){
		printf("%d", a[i]);
		if (i == 0)break;
		printf(" ");
	}
printf("\n");
	return 0;
}


Measured memory_bytes: 2076
#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++)
#define repR(i,n) for (int i = int(n)-1; i >= 0; i--)
#define rep1R(i,n) for (int i = int(n); i >= 1; i--)
#define all(x) (x).begin(), (x).end()
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define fst first
#define snd second
#define cauto const auto
#ifdef LOCAL
#define dump(...) cerr << "[" << __LINE__ << ":" << __FUNCTION__ << "] ", _dmp_(#__VA_ARGS__, __VA_ARGS__);
void _dmp_(const char*) { cerr << endl; }
template <class T, class... U>
void _dmp_(const char *s, T const& x, U const& ...y) { const char *o = "({[", *e = "]})"; for (int i = 0; *s != '\0'; cerr << *s++) { if (count(o,o+3,*s)) i++; if (count(e,e+3,*s)) i--; if (!i && *s == ',') break; } cerr << " = " << x; if (*s == ',') cerr << ", ", s++; _dmp_(s, y...); }
#else
#define dump(...)
#endif
using ll = long long;
#define int ll
template <class T> using pque_max = priority_queue<T>;
template <class T> using pque_min = priority_queue<T, vector<T>, greater<T> >;
#define CONAINER_OUTPUT os << "{"; for (auto const& x : v) os << " " << x; return os << " }";
template <class T> ostream& operator<<(ostream& os, vector<T> const& v) { CONAINER_OUTPUT }
template <class T> ostream& operator<<(ostream& os, deque<T> const& v) { CONAINER_OUTPUT }
template <class T> ostream& operator<<(ostream& os, set<T> const& v) { CONAINER_OUTPUT }
template <class T, class U> ostream& operator<<(ostream& os, map<T,U> const& v) { CONAINER_OUTPUT }
#undef CONAINER_OUTPUT
template <class T> istream& operator>>(istream& is, vector<T>& v) { for (auto& x : v) is >> x; return is; }
template <class T, class S> ostream& operator<<(ostream& os, pair<T,S> const& p) { return os << "(" << p.first << ", " << p.second << ")"; }
template <class T, class S> istream& operator>>(istream& is, pair<T,S> const& p) { return is >> p.first >> p.second; }
struct _Init_ { _Init_() { cin.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(20); } } _init_;

template <class T> void quit(T const& x) { cout << x << endl; exit(0); }
template <class T> bool chmin(T& x, T const& y) { if (x > y) { x = y; return true; } return false; }
template <class T> bool chmax(T& x, T const& y) { if (x < y) { x = y; return true; } return false; }
#define YesNo(c) ((c) ? "Yes" : "No")
////////////////////////////////

int32_t main() {
    int n,m; cin >> n >> m;
    pque_max<int> q;
    rep (i,n) {
        int a; cin >> a;
        q.push(a);
    }
    rep (i,m) {
        int x = q.top(); q.pop();
        q.push(x/2);
    }
    int sum = 0;
    while (!q.empty()) {
        sum += q.top(); q.pop();
    }
    cout << sum << endl;
}


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

#define MP make_pair
#define PB push_back
#define ALL(x)      (x).begin(),(x).end()
#define REP(i,n)    for(int i=0;i<(n);i++)
#define REP1(i,n)   for(int i=1;i<(n);i++)
#define REP2(i,d,n) for(int i=(d);i<(n);i++)
#define RREP(i,n)   for(int i=(n);i>=0;i--)
#define CLR(a)      memset((a),0,sizeof(a))
#define MCLR(a)     memset((a),-1,sizeof(a))
#define RANGE(x,y,maxX,maxY) (0 <= (x) && 0 <= (y) && (x) < (maxX) && (y) < (maxY))
 
typedef long long LL;
typedef unsigned long long ULL;
typedef vector<int> VI;
typedef vector<VI > VVI;
typedef vector<string> VS;
typedef vector<LL> VLL;
typedef pair<int,int> PII;
 
const int INF = 0x3f3f3f3f;
const LL INFL = 0x3f3f3f3f3f3f3f3fLL;
const double EPS = 1e-9;
 
const int DX[]={1,0,-1,0},DY[]={0,-1,0,1};

LL N,A,B,C;
vector<LL> l;
int solve(int now_idx, int a_num, int b_num, int c_num, int a_cost, int b_cost, int c_cost){
    if(now_idx == N) {
        if(a_num == 0 || b_num == 0 || c_num == 0) return INF;
        return abs(A-a_num) + abs(B-b_num) + abs(C-c_num) + (a_cost-1) * 10 + (b_cost-1) * 10 + (c_cost-1) * 10;
    }

    int res = solve(now_idx+1, a_num + l[now_idx], b_num, c_num, a_cost + 1, b_cost, c_cost);
    res = min(res, solve(now_idx+1, a_num, b_num + l[now_idx], c_num, a_cost, b_cost + 1, c_cost));
    res = min(res, solve(now_idx+1, a_num, b_num, c_num + l[now_idx], a_cost, b_cost, c_cost + 1));
    res = min(res, solve(now_idx+1, a_num, b_num, c_num, a_cost, b_cost, c_cost));

    return res;
}

int main(){
    scanf("%lld",&N);
    scanf("%lld",&A);
    scanf("%lld",&B);
    scanf("%lld",&C);

    LL tmp;
    for(int i = 0 ; i < N ; i++){
        scanf("%lld",&tmp);
        l.PB(tmp);
    }
    cout << solve(0, 0, 0, 0, 0, 0, 0) << endl;
    return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
#define N 200000
  int main(){
    int n,i,j,max=0,min=0,a[N];
    scanf("%d",&n);

    for(i=0;i<n;i++){
      scanf("%d",&a[i]);
    }

    min=a[0];
    max=a[1]-a[0];

    for(j=1;j<n;j++){
      if(max<(a[j]-min)){
        max=a[j]-min;
      }
      if(min>a[j]){
        min=a[j];
      }
    }

    printf("%d\n",max);

    return 0;
  }



Measured memory_bytes: 2516
# -*- coding: utf-8 -*-
n, k, q = map(int, input().split())
a = [0]*q
score = [k-q] * n
for i in range(q):
    ai = int(input())
    score[ai-1] += 1
for si in score:
    if si > 0:
        print("Yes")
    else:
        print("No")



Measured memory_bytes: 7364
#include <cstdio>
#include <cmath>
#include <iostream>
#include <set>
#include <algorithm>
#include <vector>
#include <map>
#include <cassert>
#include <string>
#include <cstring>
#include <queue>

using namespace std;

#define rep(i,a,b) for(int i = a; i < b; i++)
#define S(x) scanf("%d",&x)
#define S2(x,y) scanf("%d%d",&x,&y)
#define P(x) printf("%d\n",x)
#define all(v) v.begin(),v.end()
#define FF first
#define SS second
#define pb push_back
#define mp make_pair

typedef long long int LL;
typedef pair<int, int > pii;
typedef vector<int > vi;

const int N = 55;

LL C[N][N];

int main() {
  C[0][0] = 1;
  rep(i,1,N) {
    C[i][i] = C[i][0] = 1;
    rep(j,1,N) {
      C[i][j] = C[i-1][j] + C[i-1][j-1];
    }
  }
  int n,p;
  S2(n,p);
  int o,e;
  o = e = 0;
  rep(i,0,n) {
    int x;
    S(x);
    if(x & 1) o++;
    else e++;
  }
  LL ans = 1LL<<e;
  LL ways = 0;
  rep(i,0,o+1) {
    if((i & 1) == p) ways += C[o][i];
  }
  ans *= ways;
  printf("%lld\n",ans);
  return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <vector>
#include <math.h>
#include <set>
#include <map>
#include <string>
#include <stack>
#include <queue>
#include <iomanip>
#include <numeric>
#include <tuple>
#include <bitset>
#include <complex>
#include <unistd.h>
#include <cassert>
#include <cctype>
#include <random>
#include <time.h>
#define _USE_MATH_DEFINES
#define _GLIBCXX_DEBUG
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> plglg;
typedef pair<double, ll> pdlg;
typedef tuple<int, int, int> tiii;
typedef tuple<ll, ll, ll> tlglglg;
typedef tuple<double, double, double> tddd;
typedef complex<double> xy_t;
typedef vector<ll> vll;
typedef vector< vector<ll> > matrix;
#define REP(i, x, y) for(ll i = (ll)x; i < (ll)y; i++)
#define DREP(i, x, y, d) for(ll i = (ll)x; i < (ll)y; i += (ll)d)
#define PER(i, x, y) for(ll i = (ll)x; i > (ll)y; i--)
#define DPER(i, x, y, d) for(ll i = (ll)x; i > (ll)y; i -= (ll)d)
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
double pi = 3.141592653589793;
ll mod = 1000000007;
int intmax = 2147483647;
int intmin = -2147483648;
ll llmax = 9223372036854775807;
ll llmin = -9223372036854775807;
int iinf = intmax / 8;
ll inf = llmax / 8;
double eps = 1e-12;

int main() {
    ll N, M;
    cin >> N >> M;
    ll ans = -1;
    REP(i, N, 100001) {
        if (M % i == 0) {
            ans = M / i;
            break;
        }
    }
    if (ans == -1) {
        REP(i, 1, 100000) {
            if (M % i == 0) {
                if (M / i >= N) {
                    ans = i;
                }
            }
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
int main(){
int n,m;
scanf("%d %d",&n,&m);
while(m--){
int a;
scanf("%d",&a);
n-=a;
}
if(n>=0)printf("%d\n",n);
else puts("-1");
return 0;
}

Measured memory_bytes: 3824
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vl = vector<ll>;
using vvl = vector<vl>;

int main(){
  int k;
  cin >> k;
  queue<ll> q;
  rep(i,9) q.push(i+1);
  rep(i,k-1){
    ll x = q.front();
    q.pop();
    if(x%10 != 0) q.push(x*10 + x%10 -1);
    q.push(x*10 + x%10);
    if(x%10 != 9) q.push(x*10 + x%10 +1);
  }
  cout << q.front() << endl;
}


Measured memory_bytes: 5116
#include<cstdio>
#include<algorithm>
using namespace std;
typedef long long LL;
int _test;
LL A,B,C,D;
LL gcd(LL a,LL b){ return b?gcd(b,a%b):a; }
int main(){
  scanf("%d",&_test);
  while(_test--){
    scanf("%lld%lld%lld%lld",&A,&B,&C,&D);
    if(A>C) A=(A-C-1)%B+C+1;
    if(A<B||D<B) puts("No"); else{
      A%=B; D%=B; LL d=gcd(B,D);
      if((C-A)/d<(B-A-1)/d) puts("No"); else puts("Yes");
    }
  }
  return 0;
}


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

#define pb push_back
#define fr first
#define sc second
typedef vector<int> vi;
typedef pair<int,int> pii;
typedef pair<int,pii> pip; 
const int INF = (1<<25);
const int dx[]={1,0,-1,0},dy[]={0,-1,0,1};

int main() {

  long long int sum=0, n;

  cin>> n;
  for(int i=0; i<n; i++){
    int money;
    cin>> money;
    sum+=money;
  }
  cout<< sum/n<< endl;
}

Measured memory_bytes: 1164
#include <iostream>
#include <algorithm>
#include <numeric>
#include <cmath>

double X[8];
double Y[8];
int I[8];

double sqr(double x)
{
    return x*x;
}

double dist(int a, int b)
{
    return sqrt(sqr(X[a]-X[b])+sqr(Y[a]-Y[b]));
}

int main()
{
    std::ios_base::sync_with_stdio(0);
    int n;
    std::cin >> n;
    for (int i=0;i<n;++i) std::cin >> X[i] >> Y[i];
    std::iota(I, I+n, 0);
    double sum = 0;
    int num = 0;
    do {
        for (int i=0;i+1<n;++i)
            sum += dist(I[i], I[i+1]);
        ++num;
    } while (std::next_permutation(I, I+n));
    std::cout.precision(9);
    std::cout << std::fixed << sum / num << std::endl;
    return 0;
}


Measured memory_bytes: 256
import sys
input = sys.stdin.readline
import re
def print_ans(input_line):
    """Test Case
    >>> print_ans("RUDLUDR")
    Yes
    >>> print_ans("DULL")
    No
    >>> print_ans("UUUUUUUUUUUUUUU")
    Yes
    >>> print_ans("ULURU")
    No
    >>> print_ans("RDULULDURURLRDULRLR")
    Yes
    """
    odd = input_line[::2]
    even = input_line[1::2]
    # print(re.search(r'L',odd) ,re.search(r'R',even))
    if re.search(r'L', odd) == None and re.search(r'R',even) == None:
        print("Yes")
    else:
        print("No")

if __name__ == '__main__':
    s = input().rstrip()
    print_ans(s)

Measured memory_bytes: 3188
#include<bits/stdc++.h>
using namespace std ;
typedef long long ll ;
const int mod=1000000007 ;

void solve(){
	
	string s ;
	cin>>s ;

	ll sum=0 ;
	for(int i=0;i<s.length();i++){
		sum+=s[i]-'0' ;
	}

	if(sum%9==0)
		cout<<"Yes" ;
	else
		cout<<"No" ;

}


int main(){


	
	int y ;

	y=1 ;
	//cin>>y ;

	while(y--)
	{	
		solve() ;
	}

}

Measured memory_bytes: 3652
#include <iostream>
#include <string>
#include <algorithm>
#include <map>
#include <set>
#include <vector>
#include <queue>
#include <cmath>

using namespace std;
typedef long long  ll;
#define rep(i,s,n)for(ll i = s;i<n;i++)

int main() {
	int N; cin >> N;
	cout << N / 3 << endl;
	return 0;
}

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

int main() {
  long long n;
  cin>>n;
  //文字コード 最終的にsort
  vector<long long> name;
  while(n!=0LL){
    name.push_back((n-1LL)%26LL);
    n=(n-1LL)/26LL;
  }
  reverse(name.begin(),name.end());
  string ans="";
  for(int i=0;i<name.size();i++){
    ans+=(char)('a'+name.at(i));
  }
  cout<<ans<<endl;
}


Measured memory_bytes: 3644
import java.util.*;

public class Main {

    public static void main(String args[]) {

        // 入力
        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.next());
        Long[] a = new Long[n];
        Arrays.setAll(a, i -> Long.parseLong(sc.next()));

        // 主処理
        PriorityQueue<Long> side = new PriorityQueue<>(Collections.reverseOrder());
        side.addAll(Arrays.asList(a));
        List<Long> list = new ArrayList<>();
        while (1 < side.size()) {
            long x = side.poll();
            long y = side.peek();
            if (x == y) {
                list.add(side.poll());
            }
        }

        long result = 0;
        if (2 <= list.size()) {
            result = list.get(0) * list.get(1);
        }
        // 出力
        System.out.println(result);
        sc.close();
    }
}


Measured memory_bytes: 49712
O = list(input())
E = list(input())
N = len(O)+len(E)
if len(O)>len(E):
    E += ' '
elif len(O)<len(E):
    O += ' '
answer = []
for i,j in zip(O,E):
    answer.append(i)
    answer.append(j)
print(''.join(answer))


Measured memory_bytes: 3060
//Om Sree Sai Ram
#include "bits/stdc++.h"
using namespace std;

void max_self(long long& a,long long b)
{
  a = max(a,b);
}


int main() 
{

long long n;
cin>>n;
//constructing a segment tree
long long base = 1;
//base is the smallest power of two which is not smaller then n.
while(base<=n)
{
  base *=2;
}
vector<long long> tree(2*base);

long long h[n],b[n];
for(long long i=0;i<n;i++)
{
  cin>>h[i];
}

for(long long i=0;i<n;i++)
{
  cin>>b[i];
}

vector<long long> dp(n+1);

//dp[i] represents max_beauty obtained so far, if i is the last height
//of the flower in the sequence
// Outer for loop is for adding a flower to the current state
for(long long i=0;i<n;i++)
{
  // Inner for loop for moving through the states. j is the previous 
  // height whose answer is already calculate
  // Every time we have to query best between [0,h[i]-1].
  // Iterated the cases, they are working but, I don't know the underlined
  // principle
  long long x = h[i]+base;
  long long best = 0;
  while(x>1)
  {
    if(x%2==1)
    {
      max_self(best,tree[x-1]);
    }

    x/=2;

  }
 dp[h[i]] = b[i]+best;
  // Below code for inserting the value of b[i]+best to h[i] position
  for(long long t=h[i]+base;t>=1;t/=2)
  {
    max_self(tree[t],b[i]+best);
  }
}
cout<<*max_element(dp.begin(),dp.end())<<endl;
}


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

int main(){
  string s;
  cin >> s;
  int len = s.size();
  string ans;
  for(int i=0;i<len;i++){
    if(i%2 == 0){
      cout << s[i];
    }
  }
  cout << endl;
}


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

int main() {
    int n;
    string s;
    cin >> n >> s;
    int ans = n;
    for (int i = 0; i < n-1; ++i) {
        if (s[i] == s[i+1]) ans--;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 512
from collections import deque
h,w,k = map(int,input().split())
y1,x1,gy,gx = map(int,input().split())
m = ["@"*(w+2)]+["@"+input()+"@" for i in range(h)]+["@"*(w+2)]
opt = [(1,0),(0,1),(-1,0),(0,-1)]
dq=deque([(y1,x1)])
ans = 0
temp = [[-1]*(w+2) for i in range(h+2)]
temp[y1][x1] = 0
cnt = 0
while dq:
    # cnt += 1
    # print(cnt)
    y,x = dq.popleft()
    # print(dq,y,x)
    for j in opt:
        y1 = y+j[0]
        x1 = x+j[1]
        if m[y1][x1] == "@":
            # print(y1,x1,"@@")
            continue
        if temp[y1][x1] == -1 or temp[y1][x1]-temp[y][x]>0:
            for i in range(k):
                if (temp[y1+i*j[0]][x1+i*j[1]] == -1 or temp[y1+i*j[0]][x1+i*j[1]]-temp[y][x]>0) and m[y1+i*j[0]][x1+i*j[1]] == ".":
                    if temp[y1+i*j[0]][x1+i*j[1]]-temp[y][x]==1:
                        continue
                    temp[y1+i*j[0]][x1+i*j[1]] = temp[y][x]+1
                    dq.append((y1+i*j[0],x1+i*j[1]))
                    # print(y1+i*j[0],x1+i*j[1],"a",k,m[y1+i*j[0]][x1+i*j[1]],temp[y1+i*j[0]][x1+i*j[1]])
                else:
                    # print(y1+i*j[0],x1+i*j[1],"b",k,m[y1+i*j[0]][x1+i*j[1]],temp[y1+i*j[0]][x1+i*j[1]])
                    break
    # for i in temp:
    #     print(i)
# print(temp)
print(temp[gy][gx])

Measured memory_bytes: 100992
#include <iostream>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <string>
#include <vector>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <iomanip>
#include <functional> // std::function<void(int)>
using namespace std;
#define int long long
#define All(v) (v).begin(),(v).end()
int dy[4] = {-1,0,1,0};
int dx[4] = {0,1,0,-1};
int Dy[8] = {-1,-1,0,1,1,1,0,-1};
int Dx[8] = {0,1,1,1,0,-1,-1,-1};
const int mod = 1000000007;
const int inf = mod*mod;
const int d5 = 100100;
signed main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    string s;
    cin>>s;
    cout<<s.substr(0,s.size()-8)<<endl;
}

Measured memory_bytes: 256
/**
       **********    ************
	  Author : Avi J Patel
	  University : DAIICT
       **********    ************
**/
#include<bits/stdc++.h>
#include<fstream>
using namespace std;
#define ll long long
#define ull unsigned long long
#define ld long double
#define pb push_back
#define pf push_front
#define mp make_pair 
#define mt make_tuple
#define ff first
#define ss second
#define si size()
#define MOD 1000000007
#define Mod 998244353
#define N 200001
#define large 1844674407370955161
#define For(i,m,n) for(long long i=m;i<n;i++)
#define st(x) sort(x.begin(),x.end())
#define re(x,i) reverse(x.begin()+i,x.end())
#define FAST ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0);srand(time(NULL));
#define min_heap priority_queue<int, vector<int>, greater<int>>
#define max_heap priority_queue<int>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
#define pp pair<pair<ll,ll>,pair<ll,ll>>
using namespace __gnu_pbds; 
#define ordered_set tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> 

bool sortbysec(const pair<int,int> &a, const pair<int,int> &b) 
{ 
    if(a.ss < b.ss) return true; 
	else return false;
}
bool sortbyboth(const pair<int,int> &a, const pair<int,int> &b)
{
	if(a.ff>b.ff) return true;
	else if(a.ff==b.ff) return a.ss<b.ss;
	else return false;
} 
bool sortff_resortss(const pair<int,int> &a, const pair<int,int> &b)
{
	if(a.ff<b.ff) return true;
	else if(a.ff==b.ff) return a.ss>b.ss;
	else return false;
}
bool sortbystring(const string &a, const string &b)
{
	string c=a+b;
	string d=b+a;
	if(c>=d) return true;
	else return false;
}

ll modi(ll a, ll m) 
{ 
    ll m0 = m; 
    ll y = 0, x = 1; 
    if (m == 1) 
      return 0; 
    while (a > 1) 
    { 
        ll q = a / m; 
        ll t = m; 
        m = a % m, a = t; 
        t = y; 
        y = x - q * y; 
        x = t; 
    } 
    if (x < 0) 
       x += m0; 
    return x; 
} 
ll Logn(ll  n, ll r) 
{ 
    return (n > r - 1) ? 1 + Logn(n / r, r) : 0; 
} 

ll power(ll x, ll y, ll p) 
{ 
    ll res = 1;      // Initialize result 
    x = x % p;  // Update x if it is more than or 
    while (y > 0) 
    { 
        if (y & 1) 
            res = (res*x) % p; 
        y = y>>1; // y = y/2 
        x = (x*x) % p; 
    } 
    return res; 
} 

ll modinv(ll n, ll p) 
{ 
    return power(n, p-2, p); 
} 

int cal[2005][2005];
int b[2005][10];

int solve(int loc, int k,int n)
{
	if(loc==n)
	{
		return 	k==0? 1:0;
	}	
	int cur=cal[loc][k];
	if(cur!=-1) return cur;
	cur=0;
	for(int i=0;i<10;i++)
	{
		if(b[loc][i]<=k)
		{
			cur=cur|solve(loc+1,k-b[loc][i],n);
		}
	}
	return cal[loc][k]=cur;
}

void traverse(int loc,int k,int n)
{
	if(loc==n) return;
	
	for(int i=9;i>=0;i--)
	{
		if(k-b[loc][i]>=0)
		{
			if(solve(loc+1,k-b[loc][i],n))
			{
				cout<<i;
				return traverse(loc+1,k-b[loc][i],n);
			}
		}
	}
}

int main()
{
	FAST
	int t=1;
//	cin>>t;
	while(t--)
	{
		ll x;
		cin>>x;
		ll cur=100;
		int cnt=0;
		while(cur<x)
		{
			cur+=(cur/100);
			cnt++;
		}
		cout<<cnt;
	}
	return 0;
}


















Measured memory_bytes: 3660
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<string>
#include<iomanip>
#include<sstream>
#include<map>
#include<set>
#include<cmath>
using namespace std;
template<typename A, size_t N, typename T>
void Fill(A(&array)[N], const T& val) {
	std::fill((T*)array, (T*)(array + N), val);
}
#define rep(i,n) for(int i = 0;i < n;i++)
#define req(i,n) for(int i = 1;i <=n;i++)
#define rrep(i,n) for(int i = n -1;i >= 0;i--)
#define ALL(a) a.begin(),a.end()
typedef long long ll;
typedef long double ld;
const ll INF =  1LL << 60;
const int inf = 1 << 30;
int n, m, x, y, q, d; ll z, w = 0, sum = 0; int ans = 0;
const int MAX = 510000;
const int MOD = 1000000007;
int main(void) {
	int dp[100100][13];
	string s; int d; cin >> s;
	Fill(dp, 0);
	dp[0][0] = 1;
	rep(i, s.size()) {
		if (isdigit(s[i])) {
			int Si = s[i] - '0';
			rep(j, 13) {
				dp[i + 1][(j*10 + Si) % 13] += dp[i][j];
				dp[i + 1][(j*10 + Si) % 13] %= MOD;
			}
		}
		else {
			rep(j, 13) {
				rep(k, 10) {
					dp[i + 1][(j*10 + k) % 13] += dp[i][j];
					dp[i + 1][(j*10 + k) % 13] %= MOD;
				}
			}
		}
	}cout << dp[s.size()][5] << endl;
}


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

using namespace std;

int main(void)
{
	int n, d;
	int x,y;
	int cnt = 0;
	cin >> n >> d;
	for (int i = 0; i < n; i++)
	{
		cin >> x >> y;
		if (sqrt((double)x * x + (double)y * y) <= d)
			cnt++;
	}
	cout << cnt;

	return 0;
}

Measured memory_bytes: 3648
import java.util.Scanner;
class Main {
	int a,b,c,x,y,i;
	public void suzuki(){
		Scanner sc = new Scanner(System.in);
		a = sc.nextInt();
		b = sc.nextInt();
		c = sc.nextInt();
		for(y = a;y <= b;y++){
			x = c % y;
			if(x == 0){
				i++;
			}
		}
		System.out.println(i);
	}
	public static void main(String[] args){
		new Main().suzuki();
	}
}

Measured memory_bytes: 17356
#include<iostream>
#include<vector>
#include<algorithm>

using namespace std;

int main(){
	int n;
	cin >> n;
	vector<long long> a(n), b(n), c(n);
	for(int i = 0; i < n; i++){
		cin >> a[i];
	}
	for(int i = 0; i < n; i++){
		cin >> b[i];
	}
	for(int i = 0; i < n; i++){
		cin >> c[i];
	}
	sort(a.begin(), a.end());
	sort(c.begin(), c.end());
	long long ans = 0;
	for(int i = 0; i < n; i++){
		long long cnt_a = 0, cnt_c = 0;
		cnt_a = distance(a.begin(), lower_bound(a.begin(), a.end(), b[i]));
		cnt_c = distance(upper_bound(c.begin(), c.end(), b[i]), c.end());
		ans += cnt_a * cnt_c;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 2560
package main

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

const mod = 1e9 + 7

var ps [][]int
var ifac, fac []int

type DP struct {
	dp int
	t  int
}

func newDP(dp, t int) *DP {
	return &DP{
		dp,
		t,
	}
}

func (dp *DP) add(a *DP) *DP {
	dp.dp = dp.dp * a.dp % mod
	dp.dp = dp.dp * comb(dp.t+a.t, dp.t) % mod
	dp.t = (dp.t + a.t) % mod
	return dp
}

func (dp *DP) subtracted(a *DP) *DP {
	ndp := newDP(dp.dp, dp.t)
	ndp.t -= a.t
	ndp.t %= mod
	if ndp.t < 0 {
		ndp.t += mod
	}
	ndp.dp = moddiv(ndp.dp, comb(ndp.t+a.t, ndp.t))
	ndp.dp = moddiv(ndp.dp, a.dp)
	return ndp
}

func (dp *DP) rootAdded() *DP {
	ndp := newDP(dp.dp, dp.t)
	ndp.t++
	ndp.t %= mod
	return ndp
}

var dp [][]DP
var dpSum []DP

func modpow(a, n int) int {
	res := 1
	for n > 0 {
		if n&1 > 0 {
			res *= a
			res %= mod
		}
		a = a * a % mod
		n >>= 1
	}
	return res
}

func modinv(a int) int {
	return modpow(a, mod-2)
}

func moddiv(a, b int) int {
	return a * modinv(b) % mod
}

func main() {
	var n int
	fmt.Scan(&n)
	ps = make([][]int, n)

	var sc = bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)

	for i := 0; i < n-1; i++ {
		sc.Scan()
		a, _ := strconv.Atoi(sc.Text())
		a--
		sc.Scan()
		b, _ := strconv.Atoi(sc.Text())
		b--
		ps[a] = append(ps[a], b)
		ps[b] = append(ps[b], a)
	}

	fac = make([]int, 2e5+1)
	ifac = make([]int, 2e5+1)
	inv := make([]int, 2e5+1)
	fac[0], fac[1] = 1, 1
	ifac[0], ifac[1] = 1, 1
	inv[0], inv[1] = 1, 1
	for i := 2; i < 2e5+1; i++ {
		fac[i] = (fac[i-1] * i) % mod
		inv[i] = mod - inv[mod%i]*(mod/i)%mod
		ifac[i] = (ifac[i-1] * inv[i]) % mod
	}

	dp = make([][]DP, n)
	dpSum = make([]DP, n)

	dfs(0, -1)
	bfs(0, -1, newDP(1, 0))

	for i := range dpSum {
		fmt.Println(dpSum[i].rootAdded().dp)
	}
}

func dfs(v, p int) *DP {
	dpSum[v] = *newDP(1, 0)
	dp[v] = make([]DP, len(ps[v]))
	for i, u := range ps[v] {
		if u == p {
			continue
		}
		dp[v][i] = *dfs(u, v)
		dpSum[v].add(&dp[v][i])
	}
	return dpSum[v].rootAdded()
}

func bfs(v, p int, dpp *DP) {
	if p != -1 {
		dpSum[v].add(dpp.rootAdded())
	}
	for i, u := range ps[v] {
		if u == p {
			continue
		}
		bfs(u, v, dpSum[v].subtracted(&dp[v][i]))
	}
}

func comb(n, r int) int {
	if r > n {
		return 0
	} else if r == 0 || r == n {
		return 1
	}
	t := (ifac[n-r] * ifac[r]) % mod
	return (t * fac[n]) % mod
}


Measured memory_bytes: 36736
from sys import stdin
import sys
##  input functions for me
def rsa(sep = ''):
    if sep == '' :
        return input().split() 
    else: return input().split(sep)
def rip(sep = ''):
    if sep == '' :
        return map(int, input().split()) 
    else: return map(int, input().split(sep))
def ria(sep = ''): 
    return list(rip(sep))
def ri(): return int(input())
def rd(): return float(input())
def rs(): return input()
##
def main():
    N, M = rip()
    A = [ri() for i in range(M)]

    fbd = [False] * (N + 1)
    for n in A: fbd[n] = True
    dp = [0] * (N + 1)
    dp[0] = 1
    mod = int(1e9 + 7)
    for i in range(N):
        for j in range(1,3):
            if i + j <= N and not fbd[i + j]:
                dp[i + j] += dp[i]
                if dp[i + j] >= mod: dp[i + j] -= mod
    
    print(dp[N])
    

if __name__ == "__main__":
    main()


Measured memory_bytes: 8616