akhauriyash/Code-Regression huggingface dataset:
using System;
using System.Linq;

namespace _20190308_03 {
    class Program {
        static void Main(string[] args) {
            var line = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray();
            var n = line[0];
            var a = line[1];
            var b = line[2];
            var c = line[3];
            var bamboo = new int[n];
            for (int i = 0; i < n; i++) {
                bamboo[i] = int.Parse(Console.ReadLine());
            }
            var mp = int.MaxValue;
            for (int i = 0; i < Math.Pow(4, n); i++) {
                var val = Enumerable.Repeat(0, 3).ToArray();
                var m = 0;
                for (int j = 0; j < n; j++) {
                    var index = (i >> (j * 2) & 0x3);
                    if (index != 3) {
                        m += 10;
                        val[index] += bamboo[j];
                    }
                }
                if (val.Min() != 0) {
                    m += Math.Abs(val[0] - a) + Math.Abs(val[1] - b) + Math.Abs(val[2] - c) - 30;
                    mp = Math.Min(mp, m);
                }
            }
            Console.WriteLine(mp);
        }
    }
}


Measured memory_bytes: 17484
#define _USE_MATH_DEFINES

#include <iostream>	//cin, cout
#include <vector>	//vector
#include <algorithm> //sort,min,max,count
#include <string>	//string,getline, to_string
#include <ios>		//fixed
#include <iomanip>	//setprecision
#include <utility> //swap, pair
#include <cstdlib>	//abs(int)
#include <cmath>	//sqrt,ceil,M_PI, pow, sin
#include <sstream>	//stringstream,getline
#include <numeric>	//gcd, accumlate
#include <deque>	//deque
#include <random>	//randam_device

using namespace std;
constexpr long long int D_MOD = 1000000007;


int main() {

	int N, K;
	cin >> N >> K;

	string S;
	cin >> S;

	S[K - 1] ^= 0x20;

	cout << S << endl;

	return 0;

}

Measured memory_bytes: 3584
#include <bits/stdc++.h>
#define rep(i,n) for (ll i = 0; i < (n); ++i)
#define All(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()   //reverse
#define strall(v) (v).cbegin(),(v).cend() //const_itterator
#define IN(a, b, x) (a<=x&&x<b)
using namespace std;
using ll = long long;
using Pair = pair<int,int>;
using Graph = vector<vector<ll>>;
template<typename T> using min_priority_queue = priority_queue<T, vector<T>, greater<T>>;
template<typename t, typename u, typename Comp=less<>>
bool chmax(t& xmax, const u& x, Comp comp={}) { if(comp(xmax, x)) { xmax = x; return true; } return false;}
template<typename t, typename u, typename Comp=less<>>
bool chmin(t& xmin, const u& x, Comp comp={}) { if(comp(x, xmin)) { xmin = x; return true;} return false;}
const int INF = 1e9;
const ll infl = ll(1e18)+5;

/*
*ios::sync_with_stdio(false);
*cin.tie(0);
*/
int main(){
   ll x,k,d;
   cin >> x >> k >>d;
   ll mv = abs(x / d); //最も原点まで近づく回数
   ll ans = 0;
   if(mv >= k){
     if(x > 0){
       ans = abs(x - k * d);
     }else{
       ans = abs(x+k*d);
     }
     cout << ans << endl;
     return 0;
   }
   if(x > 0){
       ans = x - mv * d;
   }else{
       ans = x+mv*d;
   }
   ll nokori = k-mv;
   if(nokori%2 == 0){
     cout << abs(ans) << endl;
   }else{
     cout << min(abs(ans-d),abs(ans+d)) << endl;
   }



}


Measured memory_bytes: 3604
using System;

namespace abc113_a
{
    class Program
    {
        static void Main(string[] args)
        {
            int moneyyyy;
            string[] array = Console.ReadLine().Split(' ');
            int ab = int.Parse(array[0]);
            int bc = int.Parse(array[1]);
            moneyyyy = ab + bc / 2;
            Console.WriteLine(moneyyyy);
        }
    }
}


Measured memory_bytes: 11092
#define _USE_MATH_DEFINES
#include <vector>
#include <string>
#include <iostream>
#include <fstream>
#include <sstream>
#include <list>
#include <algorithm>
#include <sstream>
#include <set>
#include <math.h>
#include <cmath>
#include <map>
#include <stack>
#include <queue>
#include <stdio.h>
#include <string.h>
#include <numeric>
 
using namespace std;
 
int N;

int a[100001];
 
int main(){

 cin>>N;
 
for(int i=0; i<N; i++){
  int x;
  scanf("%d",&x);
  a[i+1]=x;
 }

 int ans=0;

 for(int i=1; i<=N; i++){

  int x=a[i];

  if(i==a[x]) ans++;

 }

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

Measured memory_bytes: 640
#include <iostream>
#include <deque>
#include <stdio.h>
#include <string>
#include <vector>
#include <algorithm>
#include <limits.h>
using namespace std;
int n,r,catloc,catcnt;
int ans=0;
int main(int argc,char const* argv[])
{
  while(1)
    {
      ans=0;
      cin >> n >> r;
      if(!n) break;
      deque<int> card;
      for(int i=n-1;i>=0;i--)
	{
	  card.push_front(n-i);
	}
      for(int i=0;i<r;i++)
	{
	  cin >> catloc >> catcnt;
	  for(int j=catcnt;j>0;j--)
	    {
	      int tmp=card[catloc+catcnt-2];
	      card.erase(card.begin()+catloc+catcnt-2);
	      card.push_front(tmp);
	    }
	}
      cout << card[0] << endl;
    }
  return 0;
}



Measured memory_bytes: 3060
#include <iostream>
#include <cmath>
#include <stdio.h>
using namespace std;
#define REP(i, n) for(int i = 0; i < (n); i++)

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

    while (1) {
        int n;
        cin >> n;
        if (n == 0) {
            break ;
        }
        int s[n];
        REP(i, n) {
            cin >> s[i];
        }
        int sum = 0;
        REP(i, n) {
            sum += s[i];
        }
        double ave = (double)sum / (double)n;
        double bunsan = 0.0;
        REP(i, n) {
            bunsan += pow(s[i] - ave, 2);
        }
        bunsan /= (double)n;
        printf("%.8f\n", sqrt(bunsan));
    }
    return 0;
}


Measured memory_bytes: 3236
#include<stdio.h>
int a=1,n,k;
int main()
{
	scanf("%d%d",&n,&k);
	for(int i=1;i<=n;i++)
	{
		if(a>k)
			a+=k;
		else
			a*=2;
	}
	printf("%d\n",a);
	return 0;
}

Measured memory_bytes: 128
import System.IO
import Control.Applicative

main = do
  -- "L M N" ---> [L,M,N]
  n <- fmap (read :: String -> Int) . words <$> getLine
  -- ns <- fmap (fmap (read :: String -> Int) . words) . lines <$> getContents
  print $ digit $ foldl (+) 0 n
  eof <- isEOF
  if eof
    then return ()
    else do main

digit :: Int -> Int
digit = length . show

Measured memory_bytes: 4092
#include "bits/stdc++.h"
using namespace std;
using ll = long long;
#define rep(i, begin, n) for (int i = begin; i < n; i++)
#define repe(i, begin, n) for (int i = begin; i <= n; i++)
#define repr(i, begin, n) for (int i = begin; i > begin - n; i--)
#define repre(i, begin, end) for (int i = begin; i >= end; i--)

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 int inf = 1000000007;
const int MOD = 1000000007;
const long long INF = 1000000000000000007;

// -------------------------------------------------------
ll N, H;
ll a[101010], b[101010];
ll maxa;
ll csumb[101010];

int main() {
  cin >> N >> H;
  rep(i, 0, N) {
    cin >> a[i] >> b[i];
    chmax(maxa, a[i]);
  }

  sort(b, b + N, greater<ll>());

  rep(i, 0, N) { csumb[i + 1] = csumb[i] + b[i]; }

  ll ans = INF;
  repe(i, 0, N) {
    ll cnt = i;
    ll damage = csumb[i];
    if (H - damage > 0) {
      ll rest = H - damage;
      cnt += ((rest + maxa - 1) / maxa);
    }
    chmin(ans, cnt);
  }

  cout << ans << endl;
}

Measured memory_bytes: 2560
#define _USE_MATH_DEFINES
#define _CRT_SECURE_NO_WARNINGS

#include <iostream>
#include <string>
#include <sstream>
#include <iomanip>
#include <cmath>
#include <cstring>
#include <cstdlib>
#include <algorithm>
#include <stack>
#include <queue>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <bitset>
#include <utility>
#include <numeric>

using namespace std;

using ll = long long;
using ull = unsigned long long;

const ll inf = (ll)1e9;
const ll mod = (ll)1e9 + 7;

#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()

#define print(s) cout << s;
#define println(s) cout << s << endl;
#define printd(s, f) cout << fixed << setprecision(f) << s << endl;


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

	vector<int> h(m);
	for (int i = 0; i < n; i++)
	{
		int k;
		cin >> k;
		for (int i = 0; i < k; i++)
		{
			int a;
			cin >> a;

			h[a - 1]++;
		}

	}

	int res = 0;
	for (int i = 0; i < m; i++)
	{
		if (h[i] == n)
		{
			res++;
		}
	}

	println(res);
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<vector>
#include<cmath>
#include<cstdio>
#include<utility>
#include<algorithm>
#include<map>
#include<set>
using namespace std;
#define rep(i,x,n) for(int i=x;i<n;i++)
#define all(L) L.begin(),L.end()
using ll=long long;

int N,M;
int X[100],Y[100],h[100];

void gcl(int& x,int& y){
    if(x<y) swap(x,y);
    while(y>0){
        int t=x%y;
        x=y;
        y=t;
    }
    return;
}


int main(){
    int n;cin>>n;
    vector<int> p;
    int i=0,j;
    for(j=2;j<=n;j++){
        bool flag=true;
        for(int k=2;k<j;k++){
            if(j%k==0){
                flag=false;break;
            }
        }
        if(flag){
            p.push_back(j);
            i++;
        }
    }
    vector<vector<ll> > v(n+1,vector<ll>(n+1,0));
    for(int i=1;i<=n;i++){
        int u=i;
        for(int j=0;j<p.size();j++){
            int t=0;
            while(u%p[j]==0){
                t++;
                u/=p[j];
            }
            v[i][p[j]]+=t;
        }
        for(int j=0;j<=n;j++) v[i][j]+=v[i-1][j];
    }

    ll ans=1;
    for(int i=0;i<=n;i++){
        ans*=(v[n][i]+1);
        ans%=1000000007;
    }
    cout<<ans<<endl;
}

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

using namespace std;

typedef pair<int,int> pii;
typedef long long ll;
typedef vector<int> vi;
#define rep(i, n) for(int i = 0; i < n; ++i)
#define rInt(a) scanf("%d",&a);


main(){
    ll n; cin >> n;
    ll arr[n];
    rep(i,n) cin >> arr[i];
    ll l =2, r = 2;
    for(ll i=n-1;i>=0;--i){
        ll val = l/arr[i];
        if(l%arr[i]!=0) val++;
        if(arr[i]>r or arr[i]*val>r){
            cout << -1 << endl;
            return 0;
        }
        l = arr[i]*val;
        ll temp = val - 1LL;
        temp = r/arr[i] - temp;
        r = l + arr[i]*(temp) - 1;
    }
    cout << l << " " << r << endl;
}

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

using namespace std;

struct Process {
	string name;
	int time;
};

class PQueue {
private:
	const static int MAX = 100000;
	Process q[MAX];
	int head;
	int tail;

public:
	PQueue();
	bool isEmpty();
	bool isFull();
	void enqueue(Process);
	Process dequeue();
};

int main(void) {
	int n, q, ptime;
	int t = 0;
	string pname;
	Process p;
	PQueue Q;

	cin >> n >> q;

	for (int i = 0; i < n; i++) {
		cin >> pname >> ptime;
		p.name = pname;
		p.time = ptime;
		Q.enqueue(p);
	}

	while (!Q.isEmpty()) {
		p = Q.dequeue();
		if (p.time <= q) {
			t += p.time;
			cout << p.name << " " << t << "\n";
			continue;
		}
		else {
			p.time -= q;
			Q.enqueue(p);
			t += q;
		}
	}

	return 0;
}


PQueue::PQueue() {
	head = tail = 0;
}

bool PQueue::isEmpty() {
	return head == tail;
}

bool PQueue::isFull() {
	return head == (tail + 1) % MAX;
}

void PQueue::enqueue(Process p) {
	if (isFull()) {
		cout << "error: over flow\n";
		return;
	}
	q[tail] = p;
	if (tail + 1 == MAX) {
		tail = 0;
	}
	else {
		tail++;
	}
}

Process PQueue::dequeue() {
	Process p;
	if (isEmpty()) {
		cout << "error: under flow\n";
		p.name = " ";
		p.time = -1;
		return p;
	}
	p = q[head];
	if (head + 1 == MAX) {
		head = 0;
	}
	else {
		head++;
	}
	return p;
}

Measured memory_bytes: 7020
/*
 *  author: chw0501
 *  reference: https://jinpyo.kim/EducationalDP-solution
 *  created: 26.04.2020 06:23:59(UTC)
*/
#include <bits/stdc++.h>

using namespace std;
typedef long long ll;
typedef pair<int,int> P;
#define MOD 1000000007 
#define INF 10000000000000 

struct S{
	int w,s,val;
	bool operator<(const S&tmp)const{
		return (w+s)>(tmp.w+tmp.s);	
	};
};
//dp[i][j]: i번째 블록까지 확인했고 위로 쌓을 수 있는 무게가 j일때 앞으로 얻을 수 있는 최댓값 
ll dp[1001][10001];

int n;
vector<S> v;

ll solve(int i,int j){
	if(j<0) return -INF;
	ll& ret=dp[i][j];
	if(ret!=-1ll) return ret;
	if(i==n-1) return ret=0;
	//i+1번째 블록 안 쌓음
	ret=solve(i+1,j);
	//i+1번째 블록 쌓음
	ret=max(ret,v[i+1].val+solve(i+1,min(j-v[i+1].w,v[i+1].s) ) );
	return ret;
}

int main(){
	cin>>n;
	for(int i=0;i<n;i++){
		int w,s,val;
		scanf("%d %d %d",&w,&s,&val);
		v.push_back((S){w,s,val});
	}
	sort(v.begin(),v.end());
	memset(dp,-1ll,sizeof(dp));
	ll ans=0;
	for(int i=0;i<n;i++){
		ans=max(ans,v[i].val+solve(i,v[i].s));
	}
	cout<<ans;
	return 0;
	
}

Measured memory_bytes: 78592
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MOD=1e9+7;
const int INF=1e9;

int main(){
	int n;
	cin>>n;
	string s[n];
	for(int i=0;i<n;i++){
		cin>>s[i];
	}
	int ans=-1;
	for(int i=0;i<n;i++){
		int d[n];
		memset(d,-1,sizeof(d));
		d[i]=0;
		queue<int> q;
		q.push(i);
		while(q.size()){
			int v=q.front();
			q.pop();
			for(int j=0;j<n;j++){
				if(s[v][j]=='0')continue;
				if(d[j]!=-1){
					if((d[j]+d[v]+1)%2!=0){
						cout<<-1<<endl;
						return 0;
					}
				}
				else{
					d[j]=d[v]+1;
					ans=max(ans,d[j]);
					q.push(j);
				}
			}
		}
	}
	cout<<ans+1<<endl;
}


Measured memory_bytes: 256
n = int(input())
a = [int(input()) for _ in range(n)]

ki = set()

for i in range(0, n, 2):
    ki.add(a[i])
# print(ki)
ans = 0
a.sort()
for i in range(1, n, 2):
    if a[i] in ki:
        ans += 1
print(ans)

Measured memory_bytes: 9640
#include <iostream>
#include <vector>
#include <utility>
#include <map>
#include <algorithm>
#include <queue>
#include <cmath>

using namespace std;
int a, b, c;
int ans;
int main() {
	cin >> a >> b >> c;
  ans = c - (a - b);
  if (ans >= 0) {
    cout << ans << endl;
  } else {
    cout << 0 << endl;
  }
  return 0;
}


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

int a[100003];
int main()
{
    int N;
    cin >> N;
    while (N--)
    {
        int s;
        cin >> s;
        a[s]++;
        a[s + 1]++;
        a[s + 2]++;
    }
    cout << *max_element(a + 2, a + 100000) << endl;
    return 0;
}

Measured memory_bytes: 3916
import sys,math,copy,queue,itertools,bisect
sys.setrecursionlimit(10**7)
LI = lambda : [int(x) for x in sys.stdin.readline().split()]
_LI = lambda : [int(x)-1 for x in sys.stdin.readline().split()]
NI = lambda : int(sys.stdin.readline())

R = NI()
print (2 * math.pi * R)

Measured memory_bytes: 68808
#include<bits/stdc++.h>
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) for (int i = 0; i < (n); ++i)
#define int long long
#define vec(a,n) vector<int> (a)((n));
#define Vec(a,n) vector<string> (a)((n));
#define twovec(a,n,m) vector<vector<int>> a(n,vector<int>(m,0));
#define Twovec(a,n,m) vector<vector<double>> a(n,vector<double>(m,0));
#define P pair<int,int>
#define All(a) (a).begin(),(a).end()
#define Sort(a) sort(All(a));
#define Reverse(a) reverse(All(a));
#define PQ(n) priority_queue<P,vector<P>,greater<P>> (n)
#define pq(n) priority_queue<int> (n)
#define print(a) cout << (a) << endl
#define printD(a) cout << setprecision(15) << (a) << endl;
using namespace std;
int max_int = 1000000007;
void Debug(auto a);
int nibul(auto a,auto b);
int nibuu(auto a,auto b);
void input(vector<auto>& a,int n);
double PI = 3.14159265358979;
int n;




signed main(){
    double t;
    cin >> t;
    t /= 3;
    printD(pow(t,3));

    return 0;
}

void Debug(auto a){
    cout << "{ ";
    for(auto b: a){
        cout << b << " ";
    }
    cout << "}" << endl;
}

//key以上の初めてのitr
int nibul(auto a,auto b){return lower_bound(All(a),b) - a.begin();}
//key以下の最後のitr
int nibuu(auto a,auto b){return upper_bound(All(a),b) - a.begin()-1;}

void input(vector<auto>& a,int n){
    REP(i,n){
        cin >> a[i];
    }
}


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

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

	long long ans=0;

	map<long long,int> m;
	m[0]++;

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

	for(int i=1;i<n+1;i++){
		cin >> a[i];
		//累積和をとる
		a[i]+=a[i-1];

		//mC2を求めていく
		ans+=m[a[i]];
		m[a[i]]++;
	}


	cout << ans << endl;
}

Measured memory_bytes: 14336
#include <iostream>
using namespace std;
typedef unsigned long long u_i;

int main(){

  	int n;
  	cin >> n;
	u_i sum=0,tmp,ptmp;
  	cin >> ptmp;
  	for(int i=1; i<n; ++i){
      cin >> tmp;
      if(ptmp>tmp){
        u_i ttmp = ptmp-tmp;
      	sum += ttmp;
        tmp += ttmp;
      }
      ptmp = tmp;
    }
  
    cout << sum << endl;  
	return 0;
}

Measured memory_bytes: 3616
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define all(x) (x).begin(),(x).end()
const int mod=1000000007,MAX=53,INF=1<<30;

int main(){
    
    std::ifstream in("text.txt");
    std::cin.rdbuf(in.rdbuf());
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    while(1){
        ll N,K;cin>>N>>K;
        if(N+K==0) break;
        N--;
        ll left=0,right=INF;
        
        while(right-left>1){
            ll mid=(left+right)/2;
            
            ll sum=0;
            
            for(ll i=0;;i=i*10+9){
                if(mid<i) break;
                
                sum+=mid-i;
            }
            
            if(sum>N) right=mid;
            else left=mid;
        }
        
        ll sum=0;
        
        for(ll i=0;;i=i*10+9){
            if(left<i) break;
            
            sum+=left-i;
        }
        
        string S;
        
        for(ll i=left+1;i<=left+100;i++){
            S+=to_string(i);
        }
        
        cout<<S.substr(N-sum,K)<<endl;
    }
}



Measured memory_bytes: 3260
import sys
input = sys.stdin.readline
h,w=map(int,input().split())
S=[["."]*(w+2)]+[["."]+list(input())+["."] for _ in range(h)]+[["."]*(w+2)]

ans=[[0 for i in range(w)] for j in range(h)]
for i in range(1,h+1):
  for j in range(1,w+1):
    if S[i][j]=='#':
      ans[i-1][j-1]='#'
    else:
      cnt=(S[i-1][j-1]=="#")+(S[i-1][j]=="#")+(S[i-1][j+1]=="#")+(S[i][j-1]=="#")+(S[i][j+1]=="#")+(S[i+1][j-1]=="#")+(S[i+1][j]=="#")+(S[i+1][j+1]=="#")
      ans[i-1][j-1]=cnt

for i in range(h):
  print(*ans[i],sep="")

Measured memory_bytes: 3572
import java.io.*;
public class Main{
    public static void main(String[] args) throws IOException{
	BufferedReader buf = new BufferedReader(new InputStreamReader(System.in));
	String s;
	long i,j;
	long len;
	String[] list;
	while((s = buf.readLine()) != null){
	    list = s.split(" ");
	    i = Integer.parseInt(list[0]);
	    j = Integer.parseInt(list[1]);
	    len = i + j;
	    s = Long.toString(len);
	    System.out.println(s.length());
	}
    }
}

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

using namespace std;

typedef long long LL;
typedef pair<int, int> PII;

const int N = 200010;

int n, mina, res;
int a[N];

int main()
{
    scanf("%d", &n);
    for(int i = 0; i < n; i++) scanf("%d", a + i);

    mina = a[0];
    for(int i = 0; i < n; i++)
        if(a[i] <= mina)
        {
            res++;
            mina = a[i];
        }

    printf("%d\n", res);
    return 0;
}


Measured memory_bytes: 1024
#define _CRT_SECURE_NO_WARNINGS
#include<bits/stdc++.h>
using namespace std;
#define int long long
#ifndef FAST_IO
 #define IOS ios_base::sync_with_stdio(false),cin.tie(nullptr);
#endif
#define ff first
#define ss second
#define endl '\n'
#define all(c) c.begin(),c.end()
template<typename T>void print(T t){for(auto &it:t)cout<<it<<" "; cout<<endl;}
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
void solve(){
   char v[3][3];
   for(int i=0;i<3;i++)
    for(int j=0;j<3;j++)
		cin>>v[i][j];
   string s;
   s+=v[0][0];
   s+=v[1][1];
   s+=v[2][2];
   cout<<s<<endl;
}
int32_t main(){
  IOS;
  solve();
  //debug();
 #ifdef LOCAL_DEFINE
 cerr<<"time elapsed "<<(double)clock()/CLOCKS_PER_SEC<<endl;
 #endif	
}


Measured memory_bytes: 256
#define ALL(obj) (obj).begin(), (obj).end()
 
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <bitset>
#include <algorithm>
#include <complex>
#include <array>
#include <functional>
 
using namespace std;
typedef long long ll;
const ll INF = 1e18;
 
ll N;
ll K;
 
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cin >> N >> K;
    vector<ll> p(N);
 
    for (ll i=0; i<N; i++) {
        cin >> p[i];
    }
    
    vector<ll> table(200001);
    ll sum = 0;
    
    for (ll i=1; i<=200000; i++) {
        sum += i;
        table[i] = sum;
    }
    
    double answer = 0.0;
 
    if (N==1) {
        cout << (double)table[p[0]] / (double)p[0] << endl;
        return 0;
    }
    
    if (N==2) {
        if (K==1) {
            double a = (double)table[p[0]] / (double)p[0];
            double b = (double)table[p[1]] / (double)p[1];
            if (a > b) {
                cout << a << endl;
                return 0;
            } else {
                cout << b << endl;
                return 0;
            }
        } else {
            double ans = (double)table[p[0]] / (double)p[0] + (double)table[p[1]] / (double)p[1];
            cout << ans << endl;
            return 0;
        }
    }
    
    for (ll j=0; j<K; j++) {
        answer += (double)table[p[j]] / (double)p[j];
    }
    
    double max = answer;
    for (ll i=K; i<N; i++) {
        double left = (double)table[p[i-K]] / (double)p[i-K];
        double right = (double)table[p[i]] / (double)p[i];
        double tmp = answer + right - left;
        if (max < tmp) {
            max = tmp;
        }
        answer = tmp;
    }
    
    cout << fixed << max << endl;
    
    return 0;
}


Measured memory_bytes: 3456
N, L = gets.split.map(&:to_i)

arr = (1..N).to_a
arr.map!{|i| L + i - 1}

min = 201
idx = nil

arr.each_with_index do |n,i|
  if n.abs <= min
    min = n.abs
    idx = i
  end
end

puts arr.inject(:+) - arr[idx]

Measured memory_bytes: 1788
#!/usr/bin/env python3
import sys

def solve(N: int, K: int):
    if K%2 == 1:
        print((N//K)**3)
    else:
        a = 1+ (N-K//2)//K
        b = N//K
        print(a**3+b**3)
    return

def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    K = int(next(tokens))  # type: int
    solve(N, K)

if __name__ == '__main__':
    main()


Measured memory_bytes: 3060
#include<stdio.h>

int count = 0, A[500000], L[2500000], R[2500000];

int merge(int *A, int left, int mid, int right){
    int i, j, k, n1, n2;
    
    n1 = mid - left;
    n2 = right - mid;
    for (i = 0; i < n1; i++){
        L[i] = A[left + i];
    }
    for (i = 0; i < n2; i++){
        R[i] = A[mid + i];
    }
    L[n1] = 10000000000;
    R[n2] = 10000000000;
    i = 0;
    j = 0;
    for (k = left; k < right; k++){
        count++;
        if(L[i] <= R[j]){
            A[k] = L[i];
            i++;
        } else {
            A[k] = R[j];
            j++;
        }
    }
}

int mergeSort(int *A, int left, int right){
    int mid;
    if (left + 1 < right){
        mid = (left + right)/2;
        mergeSort(A, left, mid);
        mergeSort(A, mid, right);
        merge(A, left, mid, right);
    }
}

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

    mergeSort(A, 0, n);
    
    printf("%d", A[0]);
    for (i = 1; i < n; i++){
        printf(" %d", A[i]);
    }
    printf("\n%d\n", count);
    
    return 0;
}


Measured memory_bytes: 5708
#include<stdio.h>
#include <sstream>
#include <iostream>
#include <cstdlib>
 
using namespace std;
 
#define BUF_SIZE 1024
#define ARRAY_SIZE 100
 
int main(){
 
    char buf[BUF_SIZE];
    int n = atoi(fgets(buf,BUF_SIZE,stdin));
    int array[ARRAY_SIZE];
    int change_count = 0;
 
    for(int i = 0; i < n; i++){
        cin >> array[i];
    }
 
    int tmp = 0;
    for(int i = n-1;i > 0;i--){
        for(int j = 0; j < i;j++){
            if(array[j] > array[j+1]){
                tmp = array[j+1];
                array[j+1] = array[j];
                array[j] = tmp;
                change_count++;
            }
        }
    }
 
    for(int i = 0; i < n; i++){
        if(i != n-1){
            printf("%d ",array[i]);
        }else{
            printf("%d\n",array[i]);
        }
    }
    printf("%d\n",change_count);
}


Measured memory_bytes: 3232
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <utility>
#include <cstring>
#include <iomanip>
#include <numeric>
#include <limits>
#include <cmath>
#include <cassert>

using namespace std;
using ll = long long;

const int INF = 1<<30;
const int MOD = (int)1e9 + 7;
const int MAX_N = (int)1e5 + 5;
#define debug(x) cout << #x << ": " << x << endl

signed main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int r; cin >> r;
    cout << 3 * r * r << endl;
    return 0;
}



Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <map>
using namespace std;
vector<long long>v;
 
int main() {
	//freopen("in.txt","r",stdin);
	//freopen("out.txt","w",stdout);
	double n;

	cin>>n;
	n = (n/3)*(n/3)*(n/3);
	printf("%.12f\n", n);
	return 0;
}

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

int main()
{
  int A[3];
  cin >> A[0] >> A[1] >> A[2];

  vector<int> c;
  c.emplace_back(abs(A[0]-A[1]));
  c.emplace_back(abs(A[1]-A[2]));
  c.emplace_back(abs(A[2]-A[0]));
  sort(begin(c),end(c));
  cout << c[0]+c[1] << endl;
}

Measured memory_bytes: 256
#include <algorithm>
#include <bitset>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>

using namespace std;

typedef long long ll;
typedef pair<int,int> PP;

/*
    freopen("input","r",stdin);
    freopen("output","w",stdout);
*/

int main() {
    ios::sync_with_stdio(false);
    cin.tie(NULL);
    int N;
    cin >> N;
    vector<ll> A(N);
    for (int i = 0;i < N;i++) cin >> A[i];
    sort(A.begin(), A.end());
    int q = A[N - 1];
    int idx = -1;
    ll v = -1;
    for (int i = 0;i < N;i++) {
    	ll r = min(A[i], q - A[i]);
    	if (v < r) {
    		idx = i;
    		v = r;
    	}
    }
    cout << q << ' ' << A[idx] << endl;
    return 0;
}

Measured memory_bytes: 1024
s = list(input())

sr = s[::-1]

# print(s)
# print(sr)

n = len(s)

ans = "Yes"

for i in range(n//2 + 1):
  if s[i] != sr[i]:
    ans = "No"

if ans == "Yes":
  ss = s[0: int(((n-1)/2))]
  # print(ss)
  ssr = ss[::-1]
  ns = len(ss)
  for i in range(ns // 2 + 1):
    if ss[i] != ssr[i]:
      ans = "No"

if ans == "Yes":
  sl = s[int((n+3)/2)-1:]
  # print(sl)
  slr = sl[::-1]
  nsl = len(sl)
  for i in range(nsl // 2 + 1):
    if sl[i] != slr[i]:
      ans = "No"

print(ans)

Measured memory_bytes: 3064
n,m=map(int,input().split())
s=input()[::-1]
step=[]
proceed=0
while proceed<n:
  if s[proceed+1:min(proceed+m+1,n)]=="1"*m:
    print(-1);exit()
  else:
    check=proceed+m
    if s[min(check,n)]=="0":
      step.append(min(check,n)-proceed)
      proceed=min(check,n)
      #print(proceed)
    else:
      while s[min(check,n)]=="1":
        if s[min(check,n)-1]=="0":
          step.append(min(check,n)-1-proceed)
          proceed=min(check,n)-1
          break
        #print(proceed,check)
        check-=1
print(*step[::-1])

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

ll solve() {
    ll N, x, y;
    cin >> N;
    vector<ll> X(N), Y(N);
    for ( int i = 0; i < N; i++ ) {
        cin >> X[i] >> Y[i];
    }
    ll mx1 = -(1LL<<60), mn1 = 1LL<<60;
    ll mx2 = -(1LL<<60), mn2 = 1LL<<60;
    for ( int i = 0; i < N; i++ ) {
        mx1 = max(mx1, X[i]+Y[i]);
        mn1 = min(mn1, X[i]+Y[i]);
        mx2 = max(mx2, X[i]-Y[i]);
        mn2 = min(mn2, X[i]-Y[i]);
    }
    ll ans = max(abs(mx1-mn1), abs(mx2-mn2));
    return ans;
}

int main() {
    auto ans = solve();
    cout << ans << "\n";
    return 0;
}

Measured memory_bytes: 6420
#include <iostream>
#include <vector>

int main() {
    using vec_t = std::vector<int>;
    using mat_t = std::vector<vec_t>;
    int n{}, m{}, l{};
    std::cin >> n >> m >> l;
    mat_t a(n, vec_t(m));
    mat_t b(m, vec_t(l));
    for(auto i=0; i<n; i++) {
        for(auto j=0; j<m; j++) {
            int value{};
            std::cin >> value;
            a[i][j] = value;
        }
    }
    for(auto i=0; i<m; i++) {
        for(auto j=0; j<l; j++) {
            int value{};
            std::cin >> value;
            b[i][j] = value;
        }
    }
    for(auto i=0; i<n; i++) {
        for(auto j=0; j<l; j++) {
            long value{};
            for(auto k=0; k<m; k++) {
                value += a[i][k] * b[k][j];
            }
            std::cout << value << ((j<(l-1)) ? " " : "");
        }
        std::cout << std::endl;
    }
}



Measured memory_bytes: 3216
S = input()
ls = len(S)
memo = [False] * (ls+1)

memo[0] = True
for i in range(ls):
    if memo[i] == False:
        continue
    else:
        if S[i: i+5] == "dream" or S[i: i+5] == "erase":
            memo[i+5] = True
        if S[i: i+6] == "eraser":
            memo[i+6] = True
        if S[i: i+7] == "dreamer":
            memo[i+7] = True

if memo[ls]:
    print("YES")
else:
    print("NO")

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

int main()
{
  vector<vector<int>> C(3, vector<int>(3));
  vector<vector<int>> S(3, vector<int>(2)), T(3, vector<int>(2));
  bool B=0;
  rep(i, 3){
    rep(j, 3){
      cin >> C[i][j];
      if(j>0) S[i][j-1]=C[i][j]-C[i][j-1];
      if(i>0) T[i-1][j]=C[i][j]-C[i-1][j];
    }
  }
  rep(i, 2){
    rep(j, 2){
      if(S[i][j]!=S[i+1][j]){
        B=1;
        break;
      }
      if(T[i][j]!=T[i][j+1]){
        B=1;
        break;
      }
    }
  }
  if(B==1) cout << "No" << endl;
  else cout << "Yes" << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
typedef long long ll;
#define rep(i,a,n) for(ll i = a;i < n;i++)
#define rrep(i,a,n) for(ll i = n; i >= a;i--)
#define index_check(i,n) if(i > n-1 || i < 0) continue; 
#define LINF 1e18
#define INF 1e9
using namespace std;

#define fs first
#define sc second

using P = pair<ll,ll>;
using Pll = pair<P,ll>;
using PQ = priority_queue<P,vector<P>,greater<P>>;

signed main(){
    ll n,m,d;
    cin >> n >> m >> d;
    if(d == 0) cout << setprecision(10) << 1.0/(double)n*(double)(m-1) << endl;
    else cout << setprecision(10) << (double)(2*n - 2*d)/(double)(n*n)*(m-1) << endl;
    return 0;
}


Measured memory_bytes: 3788
A, B, C, X = 4.times.map { gets.to_i }
count = 0
(0..A).each do |a|
  (0..B).each do |b|
    count += 1 if X >= a*500 + b*100 && (X - a*500 - b*100) % 50 && (X - a*500 - b*100) / 50 <= C
  end
end
puts count


Measured memory_bytes: 1788
n = int(input())
a = list(map(int, input().split()))
dp = [[0] * 2 for i in range(n)]
dp[0][0],dp[0][1] = a[0], -a[0]
dp[1][0], dp[1][1] = a[0] + a[1], -a[0] + -a[1]
#dp[i][0]は選ばないdp[i][1]は選ぶ
for i in range(2, n):
    dp[i][0] = max((dp[i-1][0] + a[i]), (dp[i-1][1] + a[i]))
    dp[i][1] = max((dp[i-1][0] + 2 * -a[i-1] + -a[i]), (dp[i-1][1] + 2 * a[i-1] + -a[i]))

#print(dp)
print(max(dp[n-1][0], dp[n-1][1]))

Measured memory_bytes: 72608
n, k = map(int, input().split())
A = list(map(int, input().split()))

B = [[0]*2 for _ in range(42)]
for a in A:
    b = format(a, 'b')
    b = list(b)
    b.reverse()
    for i in range(len(b)):
        if b[i] == '1':
            B[i][1] += 1

for i in range(42):
    if B[i][1] != 0:
        B[i][0] = n-B[i][1]
B.reverse()
#print(B)
temp = 0
max_ = 0
for i, (b0, b1) in enumerate(B):
    if b1 == 0:
        if temp + 2**(41-i) <= k:
            max_ += n*2**(41-i)
            temp += 2**(41-i)
    else:
        if b0 >= b1:
            if temp + 2**(41-i) <= k:
                max_ += b0*2**(41-i)
                temp += 2**(41-i)
            else:
                max_ += b1*2**(41-i)
                temp += 0
        else:
            max_ += b1*2**(41-i)
            temp += 0
print(max_)


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

vector<int> solve(const int N, const int x)
{
    if (x == 1 || x == 2*N-1) return {};
    if (N == 2) return {1, 2, 3};

    auto used = vector<bool>(2*N);
    auto order = vector<int>(2*N-1, -1);

    if (x != 2*N-2)
    {
        order[N-2] = x+1;
        order[N-1] = x-1;
        order[N] = x;
        order[N+1] = x+2;
        used[x-1] = used[x] = used[x+1] = used[x+2] = true;
    }
    else
    {
        order[N-2] = x-1;
        order[N-1] = x+1;
        order[N] = x;
        order[N+1] = x-2;
        used[x-2] = used[x-1] = used[x] = used[x+1] = true;
    }

    for (auto i = 0, j = 1; i < 2*N-1; i++) if (order[i] == -1)
    {
        while(used[j]) j++;
        order[i] = j;
        used[j] = true;
    }

    return order;
}

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

    const auto order = solve(N, x);
    if (order.empty()) cout << "No" << endl;
    else
    {
        cout << "Yes" << endl;
        for (const auto x : order) cout << x << "\n";
    }
}


Measured memory_bytes: 2304
a[9],b[9],i,x,y;main(j){while(scanf("%d%d%d%d%d%d%d%d",&a[0],&a[1],&a[2],&a[3],&b[0],&b[1],&b[2],&b[3])>0){x=y=0;for(i=0;i<4;i++)for(j=0;j<4;j++)if(a[i]==b[j])i==j?x++:y++;printf("%d %d\n",x,y);}exit(0);}

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

int N;
vector<ll> A(100000);

ll counter(int sign){//sign: (+)start -> 1, (-)start -> -1
	ll c = 0;
	for(ll s=0, i=0; i<N; ++i, sign*=-1){
		s += A[i];
		if(sign*s<=0){ c += abs(s) + 1; s = sign; }
	}
	return c;
}

int main(){
	cin>>N;
	for(int i=0; i<N; ++i) cin>>A[i];
	ll a = counter(1), b = counter(-1);
	cout<< (a<b?a:b) <<endl;
}

Measured memory_bytes: 1024
//Peaks
#include <iostream>
#include <vector>
using namespace std;
int main(){
	int N, M;
    cin>>N>>M;
    vector<int> height(N);
    vector<bool> vec(N,true);
    for(int i=0;i<N;i++){
        int temp;
        cin >> temp;
        height[i]=temp;
    }
    for(int i=0;i<M;i++){
        int a,b;
        cin >> a >> b;
        if(height[a-1]<=height[b-1]){
            vec[a-1] = false;
        }
        if(height[b-1]<=height[a-1]){
            vec[b-1] = false;
        }
    }
    int count = 0;
    for(int i=0;i<N;i++){
        if(vec[i]==true){
            count++;
        }
    }

    cout << count <<"\n";
    return 0;
}

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

typedef long long ll;
typedef pair<ll, ll> P;

const int MAX = 1e5 + 10;
const int INF = 1e9;
const int MOD = 1e9 + 7;

int K, X;

int main(){
    cin >> K >> X;

    int a = X - K + 1;

    for(int i = a; i < X + K; ++i) cout << i << " ";
    cout << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
    int n, m;
    cin >> n >> m;
    int a[n][m], b[m];
    for(int i=0; i<n; i++){
        for(int j=0; j<m; j++){
            int a_ij;
            cin >> a_ij;
            a[i][j] = a_ij;
        }
    }
    for(int j=0; j<m; j++){
        int b_j;
        cin >> b_j;
        b[j] = b_j;
    }
    // int c[n];
    vector<int> c(n);
    fill(c.begin(), c.end(), 0);
    for(int i=0; i<n; i++){
        int c_i = 0;
        for(int j=0; j<m; j++){
            c_i += a[i][j]*b[j];
        }
        c[i] = c_i;
    }
    for(int i=0; i<n; i++) cout << c[i] << endl;
}


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

int main() {
  int times[5];
  int total = 0, maxgap = 0;
  for(int i = 0; i < 5; ++i) {
    std::cin >> times[i];
    total += times[i];
    for(int j = 1; j <= 13; ++j) {
      if(times[i] <= 10 * j) {
        total += 10 * j - times[i];
        maxgap = std::max(maxgap, 10 * j - times[i]);
        break;
      }
    }
  }
  total -= maxgap;

  std::cout << total << std::endl;

}


Measured memory_bytes: 256
N = gets.chomp.to_i
s = []
N.times {
  s << gets.chomp
}

M = gets.chomp.to_i
t = []
M.times {
  t << gets.chomp
}

max = 0
(s | t).each do |word|
  sum = s.count(word) - t.count(word)
  max = sum if sum >= max
end
puts max

Measured memory_bytes: 3836
using System;
using System.Collections.Generic;
using System.Linq;
using static AtCoder.Io;

namespace AtCoder
{
    class Program
    {
        static void Main()
        {
            var n = ReadInt();
            var s = ReadString();
            var x = 0;
            var max = 0;
            foreach(var c in s) {
                x += c == 'I' ? 1 : -1;
                max = Math.Max(x, max);
            }
            Console.WriteLine(max);
        }
    }

    public static class Io
    {
        public static string ReadString() => Console.ReadLine();
        public static string[] ReadStringArray() => ReadString().Split(' ');
        public static int ReadInt() => int.Parse(ReadString());
        public static long ReadLong() => long.Parse(ReadString());
        public static int[] ReadIntArray() => ReadStringArray().ParseInt().ToArray();
        public static long[] ReadLongArray() => ReadStringArray().ParseLong().ToArray();
        public static IEnumerable<int> ParseInt(this IEnumerable<string> source) => source.Select(int.Parse);
        public static IEnumerable<long> ParseLong(this IEnumerable<string> source) => source.Select(long.Parse);
    }
}


Measured memory_bytes: 13140
#include <stdio.h>

int main(void){
    int i,x,y;
    while(1){
    scanf("%d %d",&x,&y);
    if(x == 0 && y == 0){
    break;
    }
    if(x > y){
    i = x;
    x = y;
    y = i;
    }
    printf("%d %d\n",x,y);
    }
    return 0;
}

Measured memory_bytes: 600
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();
		if (a < b) {
			System.out.println("a < b");
		} else if (a > b) {
			System.out.println("a > b");
		} else {
			System.out.println("a == b");
		}
	}
}

Measured memory_bytes: 26216
#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 mod 1000000007 
#define fi first
#define sc second
#define rep(i,x) for(int i=0;i<x;i++)
#define repn(i,x) for(int 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())

ll n,q,k,d;
ll beg[1000005];
int main(){
	cin>>n>>q>>k>>d;
	ll cur = d; beg[0] = cur;
	rep(i,q){
		if(cur > n/2) cur -= n/2;
		cur = 2*cur-1;
		beg[i+1] = cur;
	}
	//cur+x = k (mod n)
	//x = k-cur (mod n)
	ll hoge = k-cur;
	hoge = (hoge%n+n)%n;
	if(q < 51 && hoge >= (1LL<<q)){
		puts("-1");
	}
	else{
		vector<int>vec;
		ll V = hoge;
		for(int i=0;V;i++,V/=2){
		    ll up = beg[q-i-1]+V/2;
		    while(up > n) up-=n;
		    if(up > n/2){
			    vec.pb( ((hoge>>i)&1) );   
		    }
		    else{
		        vec.pb( 1-((hoge>>i)&1) );   
		    }
		}
		while(vec.size() < q){
		    ll up = beg[q-vec.size()-1];
		    if(up > n/2){
			    vec.pb( 0 );   
		    }
		    else{
		        vec.pb( 1 );   
		    }
		}
		for(int i=0;i<q;i++) printf("%d\n",1-vec[i]);
	}
}


Measured memory_bytes: 14180
def f():
    N, Y = map(int, input().split())
    
    y1 = 10000
    y2 = 5000
    y3 = 1000
    
    y1_num = 0
    y2_num = 0
    y3_num = 0
    for y1_num in reversed(range(N+1)):
        y2_num = 0
        remain_Y1 = Y - y1*y1_num
        if remain_Y1 == 0 and sum([y1_num, y2_num, y3_num]) == N:
            return print(y1_num, y2_num, y3_num)
        elif remain_Y1 < 0:
            continue
        else:
            for y2_num in reversed(range(N+1 - y1_num)):
                y3_num = N - y1_num - y2_num
                remain_Y2 = remain_Y1 - y2*y2_num - y3*y3_num
                if remain_Y2 == 0 and sum([y1_num, y2_num, y3_num]) == N:
                    return print(y1_num, y2_num, y3_num)
                elif remain_Y2 < 0:
                    continue
    return print(-1, -1, -1)
                        
f()

Measured memory_bytes: 3188
import java.util.Arrays;
    import java.util.Scanner;

public class Main {

  public static void main(String[] args) {
    Scanner scanner = new Scanner(System.in);
    long x = scanner.nextLong();
    long money = 100;
    long i = 0;

    while (money < x) {
      money += money * 0.01;
      i++;
    }

    System.out.println(i);

  }
}


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

using namespace std;

int main(void){
  int N;
  string S;
  cin >> N >> S;
  int x = 0;
  int ans = 0;
  for(int i = 0; i < S.length(); i++){
    if(S[i] == 'I') x++;
    else x--;
    ans = max(x, ans);
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <cmath>
#include <cstdint>
#include <cstdio>
#include <functional>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <vector>

using namespace std;

#define loop(i, a, b) for (int i = (a); i < (b); ++i)
#define rep(i, n) for (int i = 0; i < n; ++i)
#define dump(a) cerr << #a << " = " << (a) << "(L:" << __LINE__ << ")" << endl

void solve(long long X) {
    if (400 <= X && X <= 599) cout << "8";
    if (600 <= X && X <= 799) cout << "7";
    if (800 <= X && X <= 999) cout << "6";
    if (1000 <= X && X <= 1199) cout << "5";
    if (1200 <= X && X <= 1399) cout << "4";
    if (1400 <= X && X <= 1599) cout << "3";
    if (1600 <= X && X <= 1799) cout << "2";
    if (1800 <= X && X <= 1999) cout << "1";
    cout << endl;
}

int main() {
    long long X;
    scanf("%lld", &X);
    solve(X);
    return 0;
}


Measured memory_bytes: 3652
#include "bits/stdc++.h"
using namespace std;

#define rep(i,beg,end)   for (auto i=(beg);i<(end);i++)
#define rep2(name,container) for(auto name=begin(container); name != end(container);name++)
#define all(cont)           begin(cont), end(cont)
#define rall(cont)           rbegin(cont), rend(cont)
using ll = long long;
using vi = vector<ll>;
const ll INFMAX = LLONG_MAX;
const ll INFMIN = LLONG_MIN;
const ll MOD = 1000000007;

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

	ll n;
	cin >> n;
	string s;
	cin >> s;

	auto ite = begin(s);
	ll cnt = 0;
	while (ite != end(s)) {
		char key = *ite;
		ite = find_if_not(ite, end(s), [key](char ch)->bool {
			return ch == key;
			});
		cnt++;
	}
	cout << cnt << endl;

	return 0;
}


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

// boost
#include <boost/multiprecision/cpp_int.hpp>
using boost::multiprecision::cpp_int;

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

using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using vb = vector<bool>;
using vs = vector<string>;
using vld = vector<ld>;
using vvld = vector<vld>;

typedef pair<ll, ll> P;

#define bit(n) (1LL << (n))

//#define int long long

#define all(v) v.begin(), v.end()

#define rep(i, n) for (ll i = 0; i < n; i++)
#define REP(i, n) for (ll i = 1; i < n; i++)

#define FOR(i, a, b) for (ll i = (a); i < (b); i++)
#define FORm(i, m) for (auto i = m.begin(); i != m.end(); i++)

template <class T>
inline void chmax(T& a, T b) {
  a = std::max(a, b);
}
template <class T>
inline void chmin(T& a, T b) {
  a = std::min(a, b);
}

#define mod (ll)(1e9 + 7)
// #define mod (998244353ll)

const long long INF = 1LL << 60;

signed main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(20);

  string s;
  cin >> s;

  ll n = s.size();
  rep(i, n - 1) {
    if (s[i] == s[i + 1]) {
      cout << i + 1 << " " << i + 2 << endl;
      return 0;
    }
  }

  rep(i, n - 2) {
    if (s[i] == s[i + 2]) {
      cout << i + 1 << " " << i + 3 << endl;
      return 0;
    }
  }

  cout << -1 << " " << -1 << endl;

  return 0;
}


Measured memory_bytes: 3732
#include <bits/stdc++.h>
using namespace std;
 
typedef long long int LLI;
typedef pair<LLI, int> Pair;
 
int n;
int size;
LLI xs[1145141];
LLI seg[1145141];
map<int, LLI> dp;
priority_queue<Pair, vector<Pair>, greater<Pair> > q;
 
void update(int k, LLI x) {
  k += size-1;
  seg[k] = x;
  while (k > 0) {
    k = (k-1)/2;
    seg[k] = max(seg[k*2+1], seg[k*2+2]);
  }
}

LLI getmax(int wishl, int wishr, int k, int watchl, int watchr) {
  int mid;
  LLI lval, rval;

  if (wishr <= watchl || watchr <= wishl) return -1;
  if (wishl <= watchl && watchr <= wishr) return seg[k];

  mid = (watchl+watchr)/2;
  lval = getmax(wishl, wishr, k*2+1, watchl, mid);
  rval = getmax(wishl, wishr, k*2+2, mid, watchr);
  return max(lval, rval);
}

int main() {
  scanf("%d", &n);
  size = 1;
  while (size < n) size *= 2;
 
  LLI sum = 0;
  for (int i=0; i<n; i++) {
    scanf("%lld", &xs[i]);
    q.push(Pair(xs[i], i));
    sum += xs[i];
  }
 
  while (!q.empty()) {
    Pair p = q.top(); q.pop();
    LLI v = p.first;
    int idx = p.second;
    LLI t = max(getmax(0, idx, 0, 0, size), 0LL) + v;
    update(idx, t);
  }
 
  printf("%lld\n", sum - getmax(0, n, 0, 0, size));
}

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

int main(){
    int n; cin>>n;
    vector<long long> s(n);
    for(long long &x: s) cin>>x;
    int q; cin>>q;
    vector<long long> t(q);
    for(long long &x: t) cin>>x;
    
    int ans=0;
    for(int i=0;i<q;i++){
        int left=-1,right=n;
        while(right-left>1){
            int mid=(right+left)/2;
            if(s[mid]==t[i]){ ans++; break;}
            else if(s[mid]>=t[i]) right=mid;
            else if(s[mid]<t[i]) left=mid;
        }
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 3792
class uf():
    def __init__(self,n):
        self.n=n
        self.pa=[-1]*n
    def find(self,x):
        if self.pa[x]<0:
            return x
        else:
            self.pa[x]=self.find(self.pa[x])
            return self.pa[x]
    def unite(self,x,y):
        x=self.find(x)
        y=self.find(y)
        if x==y:
        	return True
        else:
            if self.pa[x]>self.pa[y]:
                x,y=y,x
            self.pa[x]+=self.pa[y]
            self.pa[y]=x
            return True
    def same(self,x,y):
        return self.find[x]==find.pa[y]
    def size(self,x):
        return -self.pa[self.find(x)] 
n,m=map(int,input().split())
import sys
input=sys.stdin.readline
uf=uf(n)
for _ in range(m):
    a,b,c=map(int,input().split())
    uf.unite(a-1,b-1)
memo=set([])
for i in range(n):
    memo.add(uf.find(i))
print(len(memo))

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

typedef unsigned long long ull;
ull x, y;

int main(){
//	cin.tie(0);
//	ios::sync_with_stdio(false);
	cin >> x >> y;
	if(x > y) swap(x, y);
	cout << (y - x <= 1 ? "Brown" : "Alice") << "\n";
}

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

#define mp make_pair
#define eb emplace_back
#define ff first
#define ss second

using namespace std;

typedef long long ll;
typedef unsigned long long ull;

#ifdef ONPC
mt19937 rnd(228);
#else
mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());
#endif


const int MAXN = 100;
//#define int long long
const int INF = 1e9;

ll m = 1e9 + 7LL;

ll pw(int a, int b){
  ll res = 1LL;
  ll aa = (ll)a;
  while (b){
    if (b & 1) {
      res *= aa;
      res %= m;
    }
    aa *= aa;
    aa %= m;
    b >>= 1;
  }
  return res;
}

signed main()
{
    #ifdef FILEIO
      freopen("input.txt", "r", stdin);
      freopen("output.txt", "w", stdout);
    #endif

    ios_base::sync_with_stdio(0);
    cin.tie(0);

    int n, k;
    cin >> n >> k;

    vector<int> a(k+1);
    for (int i = 0; i < k+1; i++) a[i] = i;

    ll ans = 0LL;
    for (int i = 1; i < k+1; i++){
      int cnt = k / i;
      ll add = pw(cnt, n);

      add = add * (ll)a[i];
      add %= m;
      ans += add;
      ans %= m;

//      cerr << add << '\n';

      for (int j = i + i; j < k+1; j+=i) a[j] -= a[i];
    }

    cout << ans << '\n';

    return 0;
}


Measured memory_bytes: 3760