akhauriyash/Code-Regression huggingface dataset:
#define _USE_MATH_DEFINES
#include<iostream>
#include<cstdlib>
#include<algorithm>
#include<cmath>
#include<string>
#include<set>
#include<map>
#include<stdbool.h>
#include<math.h>
#include<sstream>
#include<math.h>
#include<vector>
#include<functional>
#include<queue>
#include<utility>
#include<bitset>
typedef long long ll;
#define N (1000000000+7)
#define INF 1e16
using namespace std;
typedef pair<ll, ll> P;

int main(void) {
	string s;
	cin >> s;
	int x = s[0] - '0';
	x = 10 * x + (s[1] - '0');
	int y = s[2] - '0';
	y = 10 * y - (s[3] - '0');
	if (x > 12) {
		if (y == 0)cout << "NA" << endl;
		else {
			if (y > 12)cout << "NA" << endl;
			else cout << "YYMM" << endl;
		}
	}
	else {
		if (x == 0) {
			if (y == 0 || y > 12)cout << "NA" << endl;
			else {
				cout << "YYMM" << endl;
			}
		}
		else {
			if (y == 0)cout << "MMYY" << endl;
			else {
				if (y <= 12)cout << "AMBIGUOUS" << endl;
				else cout << "MMYY" << endl;
			}
		}
	}
	return 0;
}

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

#define ALL(v) v.begin(), v.end()
#define V vector
#define P pair
#define ld long double
#define ll long long
#define mod 1000000007
#define IINF INT_MAX
#define INF 1LL << 30

// 辺のidも保持した構造体
struct Edge {
    int to, id;
};

// 隣接リスト
V<V<Edge> > g, id;
V<int> ans;

// 頂点vの周りの辺を塗る
// cは親の色
// pは親頂点
void dfs(int v, int c = -1, int p = -1){
    int k = 1;
    for(auto ng : g[v]){
        if(ng.to == p) continue;
        if(k == c) k++; // 親の色と同じならincrement
        ans[ng.id] = k;
        k++;
        dfs(ng.to, ans[ng.id], v);
    }
}

int main() {
    int n; cin >> n;
    g.resize(n);
    for(int i = 0; i < n - 1; i++){
        int a, b; cin >> a >> b;
        a--, b--;
        g[a].push_back((Edge){b, i});
        g[b].push_back((Edge){a, i});
    }

    ans.resize(n - 1);
    dfs(0);

    // 最大色数=次数
    int mx = 0;
    for(int i = 0; i < n; i++){
        mx = max(mx, (int)g[i].size());
    }

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


Measured memory_bytes: 11100
#include <bits/stdc++.h>
using namespace std;
int n,k;
string str;
int main()
{
    cin>>n>>k;
    cin>>str;
    int ans = 0;
    for(int i=0;i<str.length();i++)
    {
        int tmp = 0;
        while(str[i+1]==str[i])
        {
            tmp++;
            i++;
        }
        ans += tmp;
    }
    cout<<min(ans+2*k,n-1)<<endl;
}


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

#pragma GCC optimize("O3")
using namespace std;
#define ll long long
#define ull unsigned long long
#define rep(i,n,N) for(ll i=n;i<=N;++i)
#define rap(i,n,N) for(ll i=n;i>=N;--i)
#define mp make_pair
#define pb push_back
#define pob pop_back
#define pf push_front
#define pof pop_front
#define fi first
#define se second
#define ff fi.fi
#define fs fi.se
#define sf se.fi
#define ss se.se
#define lc (id<<1)
#define rc ((id<<1)|1)
#define db(x) cout << ">>>>>> " << #x << " -> " << x << endl;
#define all(x) x.begin(),x.end()
#define pii pair<int,int> 
#define pll pair<ll,ll>
#define piii pair<int,pii>
#define piiii pair<pii,pii>
#define psi pair<string,int>
#define endl "\n"
const int MAX = 3e5+5;
const ll MAX2 = 11;
const ll MOD = 1000000007;
const ll INF = 2e18;
const int dr[]={1,0,-1,0,1,1,-1,-1,0};
const int dc[]={0,1,0,-1,1,-1,1,-1,0};
const double pi = acos(-1);
const double EPS = 1e-9;
const int block = 450;

int n,k,cnt[128],ans,z;
priority_queue<int> pq;
stack<int> st;
string s;
set<string> cek;

int main(){
//	cout<<fixed<<setprecision(15);
//    freopen("input.txt", "r", stdin);
//	freopen("output.txt","w",stdout);
    ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
    cin>>n>>k;
    while(n--){
    	cin>>s;
    	auto it = cek.find(s);
    	if(it==cek.end()){
    		cek.insert(s);
    		cnt[s[0]]++;
		}
	}
	rep(i,'A','Z')if(cnt[i])pq.push(cnt[i]);
	while(pq.size()>=k){
		++ans;
		rep(i,1,k){
			z = pq.top(); pq.pop();
			z--;
			if(z)st.push(z);
		}
		while(!st.empty())pq.push(st.top()), st.pop();
	}
	cout<<ans<<endl;
	return 0;
}//

Measured memory_bytes: 1152
# time complexity: O(NlgN)
# space complexity: O(N)

import sys
fin = sys.stdin.readline
from heapq import heappop, heappush, heapify

N = int(fin())
a_list = [int(elem) for elem in fin().split()]
left, right = a_list[:N], a_list[N:]

thrown_away = [False] * (2 * N)
discarded_items = []

# initialize
right_sum = sum(right)
for i, item in enumerate(right):
    if i < N:
        heappush(discarded_items, (item, i))
        thrown_away[i] = True
        right_sum -= item
    else:
        if item > discarded_items[0][0]:
            old_item, old_idx = heappop(discarded_items)
            thrown_away[old_idx] = False
            heappush(discarded_items, (item, i))
            thrown_away[i] = True
            right_sum += old_item - item


# move partitions and calculate a global maximum
left_sum = sum(left)
heapify(left)
# dirty trick
thrown_away.append(False)
max_score = left_sum - right_sum
for i, item in enumerate(right[:N]):
    if not thrown_away[i]:
        # update right
        updated_idx = -1
        # pick a item which has not moved to the left.
        while thrown_away[updated_idx] == False:
            updated_item, updated_idx = heappop(discarded_items)
        right_sum += updated_item - item
        thrown_away[updated_idx] = False
    else:
        # want to remove item from discarded_items, but it take O(N)
        # instead, set thrown_away[i] = False so as to know this is moved to the left.
        thrown_away[i] = False
    # update left
    if item > left[0]:
        old_item = heappop(left)
        heappush(left, item)
        left_sum += item - old_item
    max_score = max(max_score, left_sum - right_sum)

print(max_score)


Measured memory_bytes: 39516
import numpy
M=10**9+7
n,k=map(int,input().split())
a=numpy.matrix([list(map(int,input().split()))for i in[0]*n],dtype='O')
b=numpy.eye(n,dtype='O')
while k:b=[b,b*a%M][k&1];a=a*a%M;k>>=1
print(b.sum()%M)

Measured memory_bytes: 12520
#define MOD 1000000007
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

int N;
multiset<ll> S;

int main() {
    cin >> N;
    ll n = pow(2, N);
    for (int i = 0; i < n; i++) {
        ll x; cin >> x;
        S.insert(-x);
    }
    S.insert(0);
    multiset<ll> slimes{*S.begin()};
    S.erase(S.begin());
    for (int i = 0; i < N; i++) {
        multiset<ll> s = slimes;
        for (auto itr = s.begin(); itr != s.end(); itr++) {
            ll life = *itr;
            auto x = S.upper_bound(life);
            if (*x) {
                slimes.insert(*x);
                S.erase(x);
            }
            else {
                cout << "No" << endl;
                return 0;
            }
        }
    }
    cout << "Yes" << endl;
}

Measured memory_bytes: 18816
#include <iostream>
#include <algorithm>
#include <vector>
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;

int main(){
	int t; cin>>t;
	rep(i,t){
		int a[9]; char c;
		rep(j,9) cin>>a[j];
		rep(j,9){
			cin>>c;
			if(c=='G') a[j]+=10;
			if(c=='B') a[j]+=20;
		}
		sort(a,a+9);

		int ans=0;
		do{
			bool b[3]; b[0]=b[1]=b[2]=false;
			rep(j,3){
				if(a[3*j]==a[3*j+1] and a[3*j]==a[3*j+2]) b[j]=true;
				if(a[3*j]+1==a[3*j+1] and a[3*j]+2==a[3*j+2]) b[j]=true;
			}
			if(b[0] and b[1] and b[2]){
				ans=1; break;
			}
		}while(next_permutation(a,a+9));
		cout<<ans<<endl;
	}
	return 0;
}



Measured memory_bytes: 3112
import math
x = []
y = []
length = 0
N = int(input())
for i in range(N):
    a, b = input().strip().split()
    x.append(int(a))
    y.append(int(b))
for i in range(N):
    for j in range(N):
        length += math.sqrt((x[i] - x[j]) * (x[i] - x[j]) + (y[i] - y[j]) * (y[i] - y[j]))
length /= N
print(length)


Measured memory_bytes: 3064
#include <iostream>

using namespace std;

int main(void) {
	int A, B, C;
	cin >> A >> B >> C;
	int t;
	t = B / A;
	if(t < C) {
		cout << t << endl;
	}
	else {
		cout << C << endl;
	}
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int ans,a[234234],b[234234],n;

int main()
{
  int i,j;
  scanf("%d",&n);
  for(i=1;i<=n;i++) scanf("%d",&a[i]);
  for(i=n;i>=1;i--)
    {
     int t=0;
	  for(j=i;j<=n;j+=i)
	    {
		  if(b[j]) t=1-t;
		}
	  if(t!=a[i]) b[i]=1;
	}
  for(i=1;i<=n;i++) if(b[i]) ans++;
  printf("%d\n",ans);
  for(i=1;i<=n;i++)
    {
	  if(b[i]) printf("%d ",i);
	}
} 

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

#define rep(i,n) for(int i=0;i<n;i++)
#define FOR(i,a,b) for(int i=a;i<=b;i++)
#define each(it,v) for(auto &it : v)
#define all(v) (v).begin(),(v).end()
#define mod 1e9+7

using namespace std;
using vi = vector<int>;
using vl = vector<long>;
using P = pair<int,int>;

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

        set<string> v;

        vector<string> s(n);
        rep(i,n)
        {
                cin>>s[i];
                v.insert(s[i]);
        }

        int m; cin>>m;
        vector<string> t(m);
        rep(i,m)
        {
                cin>>t[i];
                v.insert(t[i]);
        }

        vector<pair<string,int>> score;
        each(it,v)score.push_back(make_pair(it,0));

        rep(i,n)
        {
                each(it,score)
                {
                        if(s[i]==it.first)it.second++;
                }
        }

        rep(i,m)
        {
                each(it,score)
                {
                        if(t[i]==it.first)it.second--;
                }
        }

        int ans=0;
        each(it,score)ans=max(ans,it.second);
        cout<<ans<<endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<functional>
#include<string.h>
#include<bitset>
#include<set>
using namespace std;

struct S {
	int cost, x, y, o, xh;
	S(int c, int in_x, int in_y, int in_o, int in_xh) : cost(c), x(in_x), y(in_y), o(in_o), xh(in_xh) {}
	bool operator<(const S &s) const {
		if (cost != s.cost)
			return cost < s.cost;
		else
			return o < s.o;
	}
};

const int INF = -1000000000, INF2 = 10000000;
int w, h, f, m, o, ans;
int stratum[110][110];
int c[11][11][51];
priority_queue<S> pq;

void dijkstra() {
	int move[3] = { 1, -1, 1 };//??´y,??´x,??´x
	while (!pq.empty()) {
		S a = pq.top();
		pq.pop();
		if (a.o == 0) continue;
		if (a.y == h) {
			if (-a.cost <= f)
				ans = -a.cost;
			break;
		}
		if (a.o == 1) continue;
		for (int i = 0; i < 3; i++) {
			int x = a.x;
			int y = a.y;
			if (i)
				x += move[i];
			else
				y += move[i];
			int xx = 1 << (w - x);
			xx = xx&a.xh;
			if (!xx || !i) {
				if (x <= w && 0 < x&&y <= h) {
					if (stratum[y][x] < 0) {
						if (a.cost + stratum[y][x] >= -f&&a.cost + stratum[y][x] > c[y][x][a.o - 1]) {
							c[y][x][a.o - 1] = a.cost + stratum[y][x];
							if (i)
								pq.push({ c[y][x][a.o - 1], x, y, a.o - 1, a.xh | 1 << (w - x) });
							else
								pq.push({ c[y][x][a.o - 1], x, y, a.o - 1, 1 << (w - x) });
						}
					}
					else if (stratum[y][x] >0) {
						int hokyuuu;
						hokyuuu = stratum[y][x] + a.o - 1;
						if (hokyuuu + a.o - 1 >= m)
							hokyuuu = m;
						c[y][x][hokyuuu] = a.cost;
						if (i)
							pq.push({ c[y][x][hokyuuu], x, y, hokyuuu, a.xh | 1 << (w - x) });
						else
							pq.push({ c[y][x][hokyuuu], x, y, hokyuuu, 1 << (w - x) });
					}
					else {
						pq.push({ 0, x, y, o, a.xh | 1 << (w - x) });
					}
				}
			}
			else {
				if (a.cost > c[y][x][a.o - 1] && a.o - 1) {
					c[y][x][a.o - 1] = a.cost;
					pq.push({ c[y][x][a.o - 1], x, y, a.o - 1, a.xh });
				}
			}
		}
	}
}


int main() {
	while (cin >> w >> h&&w&&h) {
		cin >> f >> m >> o;
		memset(stratum, sizeof(stratum), 0);
		ans = INF2;
		for (int i = 1; i <= 10; i++)
			for (int j = 1; j <= 10; j++)
				fill(c[i][j], c[i][j] + 51, INF);
		while (!pq.empty())
			pq.pop();
		for (int i = 1; i <= h; i++)
			for (int j = 1; j <= w; j++)
				cin >> stratum[i][j];
		pq.push({ 0, 1, 0, o, 1 << (w - 1) });
		dijkstra();
		if (ans != INF2)
			cout << ans << endl;
		else
			cout << "NA" << endl;
	}
	return 0;
}

Measured memory_bytes: 1272
#include <stdio.h>

int main(void){
    int n, a, b;
    char s[100000+5];
    scanf("%d %d %d", &n, &a, &b);
    scanf("%s", s);
    
    int pass=0, abroad=0;
    for(int i=0; i<n; i++){
        if(s[i]=='b')abroad++;
        
        if(s[i]=='a' && pass<a+b){
            printf("Yes\n");
            pass++;
        }else if(s[i]=='b' && pass<a+b && abroad<=b){
            printf("Yes\n");
            pass++;
        }else{
            printf("No\n");
        }
    }
    return 0;
}


Measured memory_bytes: 1760
#pragma GCC target("avx2")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")

#include <iostream> // cout, endl, cin
#include <iomanip>
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include <math.h>
using namespace std;

int main() {
	int N;
	cin >> N;
	vector<int> A(N);
	for (int i = 0; i < N; i++) {
		cin >> A.at(i);
	}
	long long Money = 1000;
	long long Stock = 0;

	if (A.at(1) > A.at(0)) {
		Stock += Money / A.at(0);
		Money -= Stock * A.at(0);
	}

	for (int i = 1; i < N - 1; i++) {
		if (A.at(i + 1) >= A.at(i) && A.at(i) <= A.at(i - 1)) {
			if (Money >= A.at(i)) {
				Stock += Money / A.at(i);
				Money -= Stock * A.at(i);
			}
			else continue;
		}
		else if (A.at(i + 1) <= A.at(i) && A.at(i) >= A.at(i - 1)) {
			Money += Stock * A.at(i);
			Stock = 0;
		}
		else continue;
	}
	Money += Stock * A.at(N - 1);
	cout << Money << endl;
}

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

int main() 
{
  int n,m,l;
  cin >> n >> m >> l;
  long int a[n][m],b[m][l],c[n][l];

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

  for(int i=0;i<m;i++) 
  {
    for(int j=0;j<l;j++) 
    {   
      cin >> b[i][j];
    }   
  }

  for(int i=0;i<n;i++) 
  {
    for(int j=0;j<l;j++) 
    {   
      c[i][j]=0;
      for(int k=0;k<m;k++)

      {
        c[i][j] += a[i][k]*b[k][j];
      }
    }
  }

  for(int i=0;i<n;i++)
  {
    for(int j=0;j<l-1;j++)
    {
      cout << c[i][j] << " ";
    }
    cout << c[i][l-1] << endl;
  }

  return 0;
}




Measured memory_bytes: 3320
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <functional>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <ctime>
#include <cassert>
#include <complex>
#include <string>
#include <cstring>
#include <iomanip>
#include <numeric>

using namespace std;

typedef long long LL;
typedef unsigned int UI;

#define rSort(a) 		sort(a.rbegin(),a.rend())
#define Sort(a) 		sort(a.begin(),a.end())
#define Reverse(a) 		reverse(a.begin(),a.end())
#define Sum(a)  		accumulate(a.begin(), a.end(), 0)
#define REP(i, n) 		for(UI i = 0;i < n;i++)
#define REPR(i, n) 		for(UI i = n;i >= 0;i--)
#define FOR(i, m, n) 	for(UI i = m;i < n;i++)
#define pb(i) 			push_back(i)

#define MOD  			(LL)1e9 + 7;
#define INF  			(LL)1 << 62;
#define INF_I  			(int)100000009;

int N, A, B, C;
vector<int>l;

int dfs(int cur, int a, int b, int c) {
	if (cur == N) {
		if (min(a, min(b, c)) > 0){
			return abs(a - A) + abs(b - B) + abs(c - C) - 30;
		}
		else{
			return INF_I;
        }
	}
	int ret0 = dfs(cur + 1, a, b, c);
	int ret1 = dfs(cur + 1, a + l[cur], b, c) + 10;
	int ret2 = dfs(cur + 1, a, b + l[cur], c) + 10;
	int ret3 = dfs(cur + 1, a, b, c + l[cur]) + 10;

	return min(min(ret0, ret1), min(ret2, ret3));
}

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

	cin.tie(0);
	ios::sync_with_stdio(false);

	cin >> N >> A >> B >> C;
	REP (i,N) {
		int a;
		cin >> a;
		l.push_back(a);
	}
	cout << dfs(0, 0, 0, 0) << endl;

	return 0;

}

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

int N , Arr[105];
int main(){
	cin>>N;
	int Cnt = 0;
	for(int i=1;i<=N;i++)cin>>Arr[i];
	sort(Arr+1 , Arr+1+N);
	for(int i=1;i<=N-2;i++){
		for(int j=i+1;j<=N-1;j++){
			for(int k=j+1;k<=N;k++){
				if(Arr[i]==Arr[j] || Arr[i]==Arr[k] || Arr[j]==Arr[k])continue;
				if(Arr[i]+Arr[j] > Arr[k])Cnt++;
			}
		}
	}
	cout<<Cnt<<endl;
}

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

int main() {
	int k;
	string s, sub;
	set<string> dic;
	cin >> s >> k;
	for (int i = 1; i <= s.size(); i++) {
		if (i == 6) goto exit_loop;
		for (int j = 0; j < s.size() - i + 1; j++) {
			sub = "";
			for (int k = j; k < j + i; k++) {
				sub = sub + s[k];
			}
			dic.insert(sub);
		}
	}
	exit_loop:
	int i = 0;
	for (auto x : dic) {
		if (i == k - 1) {
			cout << x << endl;
			return 0;
		}
		i++;
	}
}

Measured memory_bytes: 1664
using System;

namespace _112_1
{
	class Program
	{
		static void Main(string[] args)
		{
			int N = int.Parse(Console.ReadLine());
			if (N == 2)
			{
				int A = int.Parse(Console.ReadLine());
				int B = int.Parse(Console.ReadLine());
				Console.WriteLine(A + B);
			}
			else
			{
				Console.WriteLine("Hello World");
			}
		}
	}
}



Measured memory_bytes: 11092
#include <bits/stdc++.h>
using namespace std;
#define int       long long int
#define vi        vector<int>
#define vii       vector<pii>
#define pii       pair<int, int>
#define mii       map<int, int>
#define pb        push_back
#define rev(v)    reverse(v.begin(), v.end())
#define all(v)    v.begin(), v.end()
#define rall(v)   v.rbegin(), v.rend()
#define endl      '\n'
#define F         first
#define S         second
#define PI        3.14159265359
#define MAXN      100007

const int mod = 1e9 + 7;

int dp[101][MAXN];
vector<pii> arr(MAXN);

int solve(int n, int w)
{
   if (n == 0 or w == 0)
      return 0;
   if (dp[n][w] != -1)
      return dp[n][w];

   if (arr[n - 1].F <= w)
   {
      dp[n][w] = max(arr[n - 1].S + solve(n - 1, w - arr[n - 1].F), solve(n - 1, w));
   }
   else
   {
      dp[n][w] = solve(n - 1, w);
   }
   return dp[n][w];
}

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

   memset(dp, -1, sizeof dp);
   int n, w;
   cin >> n >> w;
   for (int i = 0; i < n; ++i)
   {
      cin >> arr[i].F >> arr[i].S;
   }
   cout << solve(n, w) << endl;
   return 0;
}

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

class Program
{
    public static void Main()
    {
        int[] arr = new int[] { 1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51 };
        Console.WriteLine(arr[int.Parse(Console.ReadLine()) - 1]);
    }
}

Measured memory_bytes: 13140
#include "bits/stdc++.h"
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
typedef pair<P,ll> Pll;
typedef pair<P,P> PP;
#define rep(i,a,n) for(ll i = a;i < n;i++)
#define repr(i,a,n) for(ll i = n-1;i >= a;i--)
#define LINF (ll)1e17
#define INF (int)1e9
#define MOD (ll)1e9+7
#define sMOD 1e5
#define fs first
#define sc second

ll gcd(ll a,ll b){
	if(!b) return a;
	return gcd(b,a%b);
	
}



signed main(){
	
	ll n;
	cin >> n;
	if(n % 2){
		cout << "No" << endl;
	}
	else{
		string s;
		cin >> s;
		
		rep(i,0,n/2){
			if(s[i] != s[n/2+i]){
				cout << "No" << endl;
				return 0;
			}
		}
		cout << "Yes" << endl;
	}
    return 0;
}

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

#define REP(i,n) for(int i=0; i < (n); ++i)
#define REPR(i,n) for(int i=(n); i >= 0; --i)
#define FOR(i, m, n) for(int i = (m); i < (n); ++i)

using ll = long long;
#define INF 1e9

string s;

int main(){
  cin >> s;
  int cntg = 0, cntp = 0, score = 0;
  REP(i, s.size()){
    if(cntp < cntg){
      cntp++;
      score += (s[i]=='g') ? 1 : 0;
    }
    else{
      cntg++;
      score += (s[i] =='g') ? 0 : -1;
    }
  }
  cout << score << endl;
  return 0;
}


Measured memory_bytes: 512
#include <stdio.h>
#include <string.h>

int dx[4]={-1,1,0,0};
int dy[4]={0,0,1,-1};

enum{TOP,BOTTOM,LEFT,RIGHT,FRONT,BACK};
int dice[6] = {1,6,2,5,3,4};
void l_rotate(int *a, int *b, int *c, int *d){
	int t = *a;
	*a = *b; *b = *c; *c = *d; *d = t;
}

// d=方向
void rotate(int d){
	if(d == 0){
		l_rotate(&dice[LEFT], &dice[TOP], &dice[RIGHT], &dice[BOTTOM]);
	}else if(d == 1){
		rotate(0); rotate(0); rotate(0);
	}else if(d == 2){
		l_rotate(&dice[FRONT], &dice[TOP], &dice[BACK], &dice[BOTTOM]);
	}else if(d == 3){
		rotate(2); rotate(2); rotate(2);
	}else{
		l_rotate(&dice[FRONT], &dice[RIGHT], &dice[BACK], &dice[LEFT]);
	}
}

int t[200][200]; // 上部の数字
int h[200][200]; // 各マスにつまれているサイコロの数
// サイコロを落とす
void solve(int top, int front){
	int x = 100, y = 100, i, j;

	// 同じ回転状態のサイコロを探す．
	for(i = 0; i < 6; i++){
		for(j = 0; j < 4; j++){
			rotate(-1);
			if(dice[TOP] == top && dice[FRONT] == front){
				goto exit_loop; // 発見したので2重ループから抜ける
			}
		}
		if(i & 1){
			rotate(0);
		}else{
			rotate(2);
		}
	}
exit_loop:
	h[x][y]++;
	while(1){
		for(i = 6; i >= 3; i--) { // 転がす面
			if(i == 3){
				t[x][y] = dice[TOP];
				return;
			}
			for(j = 0; j < 4; j++){
				if(dice[2 + j] == i && h[x + dx[j]][y + dy[j]] < h[x][y] - 1){
					h[x][y]--;
					rotate(j);
					x += dx[j]; y += dy[j];
					h[x][y]++;
					i = 2; break;
				}
			}
		}
	}
}


int main() {
	int n, i, j;
	while(scanf("%d", &n) != EOF){
		int count[7] = {};
		if(n == 0) break;

		memset(h, 0, sizeof(h));
		memset(t, 0, sizeof(t));
		for(i = 0; i < n; i++){
			int top, front;
			scanf("%d %d", &top, &front);
			solve(top, front);
		}
		for(i = 0; i < 200; i++){
			for(j = 0; j < 200; j++){
				count[t[i][j]]++;
			}
		}
		for(i = 1; i <= 6; i++){
			printf(i == 1 ? "%d" : " %d", count[i]);
		}
		puts("");
		fflush(stdout);
	}
	return 0;
}

Measured memory_bytes: 1364
#include<stdio.h>
#include<stdlib.h>

#define POS(c,i) (((c)-'A')*n+(i))

void assign(int a,int b,int *vertex,int *next,int *start,int index){
  vertex[index]=b;
  next[index]=start[a];
  start[a]=index;
  return;
}

void run(void){
  int n,m;
  scanf("%d%d",&n,&m);
  char *s=(char *)malloc(sizeof(char)*(n+1));
  scanf("%s",s);
  int *vertex=(int *)malloc(sizeof(int)*2*m);
  int *next=(int *)malloc(sizeof(int)*2*m);
  int *start=(int *)malloc(sizeof(int)*n);
  int i;
  for(i=0;i<n;i++) start[i]=-1;
  for(i=0;i<m;i++){
    int a,b;
    scanf("%d%d",&a,&b);
    a--;b--;
    assign(a,b,vertex,next,start,2*i);
    assign(b,a,vertex,next,start,2*i+1);
  }
  int *cond=(int *)malloc(sizeof(int)*n);
  int *cnt=(int *)calloc(2*n,sizeof(int));
  for(i=0;i<n;i++) cond[i]=1;
  int *q=(int *)malloc(sizeof(int)*n);
  int front=0;
  int last=0;
  for(i=0;i<n;i++){
    int p;
    for(p=start[i];p!=-1;p=next[p]){
      int u=vertex[p];
      cnt[POS(s[u],i)]++;
    }
    if(cnt[POS('A',i)]==0 || cnt[POS('B',i)]==0){
      q[last++]=i;
      cond[i]=0;
    }
  }
  while(front<last){
    int v=q[front++];
    int p;
    for(p=start[v];p!=-1;p=next[p]){
      int u=vertex[p];
      if(!cond[u]) continue;
      cnt[POS(s[v],u)]--;
      if(cnt[POS(s[v],u)]==0){
	cond[u]=0;
	q[last++]=u;
      }
    }
  }
  printf("%s\n",last==n?"No":"Yes");
}

int main(void){
  run();
  return 0;
}


Measured memory_bytes: 7040
#include <bits/stdc++.h>
using namespace std;
long long mod = 998244353;
long long modpow(long long a, long long n) {
    long long res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}
int main()
{
    long long n;
    cin >> n;
    vector< long long > d(n);
    vector< long long > num(n, 0);
    for (long long i = 0; i < n; i++) {
        cin >> d[i];
        if (d[i] == 0 && i != 0) {
            cout << 0 << endl;
            return 0;
        }
        num[d[i]]++;
    }
    long long ans = 1;
    for (int i = 0; i < n - 1; i++) {
        ans = (ans * modpow(num[i], num[i + 1])) % mod;
    }
    // for (int i = 0; i < n; i++) {
    //     cout << num[i] << " ";
    // }
    // cout << endl;
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 1792
#include <iostream>
#include <sstream>
#include <fstream>
#include <string>
#include <vector>
#include <deque>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <algorithm>
#include <functional>
#include <utility>
#include <bitset>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <cstdio>
#include <string.h>
#define rep(i,n) for(int i=0;i<n;i++)
#define forn(i,a,b) for(int i=a;i<=b;i++)
#define INF 2147483647
#define LLINF 9223372036854775807
using namespace std;
int main(){
	long long a,b,n;
	cin>>a>>b>>n;
	long long x=min(b-1,n);
	cout<<floor(a*x/b)-a*floor(x/b)<<endl;
	return 0;
}

Measured memory_bytes: 3788
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll N = 100005;

ll n, c, a[N], b[N], sum[N], ans;

void solve () {
	for(ll i=1;i<=n;i++) {
		sum[i] = sum[i-1] + b[i];
	}
	ll cur = sum[n] - 2 * (c - a[1]), mx = 0;
	for(ll i=1;i<=n;i++) {
		cur += 2 * (a[i+1] - a[i]) - b[i];
		mx = max(mx, sum[i] - a[i]);
		ans = max(ans, cur+mx);
	}
}

int main()
{
	scanf("%lld%lld",&n,&c);
	for(ll i=1;i<=n;i++) {
		scanf("%lld%lld",&a[i],&b[i]);
	}
	a[n+1] = c;
	solve();
	reverse(a+1, a+1+n);
	reverse(b+1, b+1+n);
	for(ll i=1;i<=n;i++) a[i] = c - a[i];
	solve();
	printf("%lld\n",ans);
}


Measured memory_bytes: 2560
#include<iostream>
using namespace std;
int main() {
	long long int sa=0,sb=0,n, m;
	int b,a;
	cin >> n>>m;
	for (int i = 0; i < n; i++) {
		cin >> a;
		sa += a;
	}
	for (int i = 0; i < m; i++) {
		cin >> b;
		sb+=b;
	}
	cout << sa*sb<<endl;
	return 0;
}


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

long long divisors(int n)
{
    long long ret = 0;
    for(int i=1; i*i <= n; i++)
    {
        if(n%i == 0)
        {
            if(i*i == n)
            ret++;
            else ret += 2;
        }
    }
    return ret;
}
int main() {
    int n;
    long long ans = 0;
    cin >> n;
    for(int i=1; i<n; i++)
    {
        
        ans += divisors(n-i);
    }
    cout << ans << endl;
	return 0;
}

Measured memory_bytes: 3624
#include<iostream>
#include<stdio.h>
#include<math.h>
#include<vector>
#include<algorithm>
using namespace std;
int main(){
    int a,b;
    while(cin>>a>>b){
        int c=a+b;
        int co=1;
        while(c/10){
            co++;
            c/=10;
        }
        cout<<co<<endl;
    }
}

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

int main(){
  int k, a, b;
  cin >> k >> a >> b;

  for(int i = a; i <= b; ++i){
    if(i % k == 0){
      cout << "OK" << endl;
      return 0;
    }
  }
  cout << "NG" << endl;
  return 0;
}

Measured memory_bytes: 3636
N,M=list(map(int,input().split()))
pref=[[] for i in range(N)]
for i in range(M):
    P,Y=list(map(int,input().split()))
    pref[P-1].append((i+1,Y))
    
ans=['' for i in range(M)]
for i in range(N):
    arr=sorted(pref[i],key=lambda x:x[1])
    for j,x in enumerate(arr):
        ans[x[0]-1]='{0:06d}{1:06d}'.format(i+1,j+1)
for x in ans:
    print(x)

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

public class Main {
    void run() {
        Scanner sc = new Scanner(System.in);
        long MOD = (long) 1e9 + 7;
        int N = sc.nextInt();
        int K = sc.nextInt();
        int[] arr = new int[N];
        for (int i = 0; i < N; i++) {
            arr[i] = sc.nextInt();
        }

        // dp[i][j] .. i番目の子供でj個の飴を分け合う方法の総数
        long[][] dp = new long[N + 1][K + 1];

        dp[0][0] = 1;

        for (int i = 0; i < N; i++) { // 10 ^ 2
            long[] cum = new long[K + 2];
            cum[0] = dp[i][0];
            for (int j = 0; j <= K; j++) {
                cum[j + 1] = (cum[j] + dp[i][j]) % MOD;
            }
//            debug(cum);
            for (int j = 0; j <= K; j++) {
                dp[i + 1][j] = (cum[j + 1] - cum[Math.max(0, j - arr[i])] + MOD) % MOD;
            }

            // これはTLE
//            for (int j = 1; j <= K; j++) { // 10 ^ 5
//                for (int k = 0; k <= arr[i]; k++) { // 10 ^ 5
//                    if (j - k >= 0) {
//                        dp[i + 1][j] += dp[i][j - k] % MOD;
//                    }
//                }
//            }

//            // これがダメな理由がいまいちわからん
//            for (int j = 1; j <= Math.min(sum, K); j++) { // 10 ^ 5
//                if (j - arr[i] >= 0) {
//                    // dp[i + 1][j] = dp[i][j] + dp[i][j - 1] + ... + dp[i][j - arr[i]];
//                    // dp[i + 1][j - 1] = dp[i][j - 1] + dp[i][j - 2] + ... + dp[i][j - arr[i] - 1];
//                    // 両辺引いて：
//                    dp[i + 1][j] = (dp[i][j] + dp[i][j - 1] - dp[i][j - arr[i] - 1]) % MOD;
//                } else {
//                    // dp[i + 1][j] = dp[i][j] + dp[i][j - 1] + ... + dp[i][0];
//                    // dp[i + 1][j - 1] = dp[i][j - 1] + dp[i][j - 2] + ... + dp[i][0];
//                    dp[i + 1][j] = (dp[i][j] + dp[i][j - 1]) % MOD;
//                }
//            }
        }
        System.out.println(dp[N][K] % MOD);
    }

    void debug(Object... os) {
        System.err.println(Arrays.deepToString(os));
    }

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


Measured memory_bytes: 169160
/*
        |___Arshit Mangukiya___|
        |___DA-IICT____|
        |___201801173____|
*/
        //__WRITE  YOUR  CODE  HERE___//
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef long double ld;
#define int long long int
#define ff first
#define ss second
#define FAST ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
#define pb push_back
#define MOD 1000000007
#define MAX 200005
#define sz size()
#define vl vector<ll>
#define aa(a) a.begin() ,a.end()
ll power(ll n,ll x)
{
    if(x==0)   return 1;
    if(x%2==0) return power(n*n,x/2);
    else       return n*power(n*n,x/2);
}
bool prime(ll n)
{
    if(n==1) return false;
    for(ll i=2;i*i<=n;i++)
        if(n%i==0) return false;
    return true;
}
ll powermode(ll n,ll x)
{
    if(x==0) return 1;
    ll y=((n%MOD)*(n%MOD))%MOD;
    if(x%2==0)  return powermode(y,x/2)%MOD;
    else    return ((n%MOD)*(powermode(y,x/2)%MOD))%MOD;
}

ll i,j;
        
   void solve()
   {
   	  int n,m,k;
   	  cin>>n>>m>>k;
   	  string s[n];
   	  for(i=0;i<n;i++)
   	  {
   	  	cin>>s[i];
   	  }
   	  ll cnt=0;
   	  for(i=0;i<pow(2,m);i++)
   	  {
   	  	 for(j=0;j<pow(2,n);j++)
   	  	 {
   	  	 	 ll col[m]={0};
   	  	 	 ll row[n]={0};
   	  	 	 for(ll f=n-1;f>=0;f--)
   	  	 	 {
   	  	 	 	 ll k=j>>f;
   	  	 	 	 if(k&1)
   	  	 	 	  row[f]=1;
   	  	 	 }
   	  	 	 for(ll f=0;f<m;f++)
   	  	 	  {
   	  	 	 	 ll k=i>>f;
   	  	 	 	 if(k&1)
   	  	 	 	  col[f]=1;
   	  	 	 }
   	  	 	 ll temp=0;
   	  	 	 for(int h=0;h<n;h++)
   	  	 	 {
   	  	 	 	for(int k=0;k<m;k++)
   	  	 	 	{
   	  	 	 		if((col[k]==0 && row[h]==0 )&& s[h][k]=='#')
   	  	 	 		temp++;
   	  	 	 	}
   	  	 	 }
   	  	 	 if(temp==k){ //cout<<i<<" "<<j<<endl;
   	  	 	 cnt++;}
   	  	 }
   	  }
   	  cout<<cnt;
   }
            signed main()
            {
               FAST;
               ll q=1;
             // cin>>q;
	            while(q--)
                {
                   solve();
                }
            }

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

int main() {
  long long d, n;
  cin >> d >> n;
  long long ans;
  if (n < 100) {
    ans = pow(100, d)*n;
  }
  else {
    ans = pow(100, d)*101;
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
int main() {
	int n, m;
	std::cin >> n >> m;
	std::vector<long long int> box(n + 1, 0);
	for (auto i = 1; i <= n; ++i) std::cin >> box[i];
	for (auto i = 1; i <= n; ++i) {
		box[i] = (box[i] + box[i - 1]) % m;
	}
	std::sort(box.begin(), box.end());
	long long int left{ 0 }, right{ 0 };
	long long int sum{ 0 };
	while (left <= n) {
		while (right <= n && box[right] == box[left]) {
			++right;
		}
		sum += (right - left) * (right - left - 1) / 2;
		left = right;
	}
	std::cout << sum << std::endl;
}

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

#define int long long

using namespace std;

int a[10010];

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

    vector <int> v[100];

    if(n%2 == 0)
    {
        for(int i=1;i<=n/2;i++)
            v[i].push_back(i), v[i].push_back(n-i+1);
    }
    else
    {
        for(int i=1;i<=n/2;i++)
            v[i].push_back(i), v[i].push_back(n-i);

        v[n/2+1].push_back(n);
    }

    vector <pair<int,int> > ans;

    for(int i=1;i<=50;i++)
    {
        for(int j=i+1;j<=50;j++)
        {
            for(int c:v[i])
            {
                for(int d:v[j])
                    ans.push_back({c,d});
            }
        }
    }

    cout << ans.size() << endl;

    for(auto i:ans)
        cout << i.first << " " << i.second << endl;
}

Measured memory_bytes: 512
(loop :named j-loop :with n := (read)
      :do (loop :for j :upto n :with y := (read)
                :do (loop :for k :upto (- n j)
                          :if (= y (+ (* 10000 j) (* 5000 k) (* 1000 (- n j k))))
                            :do (format t "~A ~A ~A" j k (- n j k))
                                :and
                            :do (return-from j-loop))
                :finally (princ "-1 -1 -1")))

Measured memory_bytes: 13288
import java.util.Scanner;

public class Main {
    public static void main(String [] args){
        Scanner sc =new Scanner(System.in);
        String a =sc.next();
        String b =sc.next();
        double num = Integer.parseInt(a+b);
        double c =(int)Math.sqrt(num);
        if (c*c == num){
            System.out.println("Yes");
        }else{
            System.out.println("No");
        }
    }
}


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

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

using namespace std;

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

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

const int INF = 1e9;
const ld eps = 1e-9, pi = acos(-1.0);

float prob[100005];

int main(){
  int n, k;
  cin >> n >> k;
  double res = 0;
  for(int i=1; i<=n; i++){
    int tmp = i;
    double t_res = 1.0/n;
    while(tmp < k){
      t_res *= 0.5;
      tmp *= 2;
    }
    res += t_res;
  }
  cout << setprecision(15) << res << endl;
  return 0;
}

Measured memory_bytes: 256
import java.io.*;

public class Main{
  public static void main(String... args) throws IOException {
    BufferedReader stdin = new BufferedReader(new InputStreamReader(System.in));
    String line = stdin.readLine();
    String[] in = line.split(" ");
    int r = Integer.parseInt(in[0]);
    System.err.println(r);
    int g = Integer.parseInt(in[1]);
    System.err.println(g);
    int b = Integer.parseInt(in[2]);
    System.err.println(b);
    int n = Integer.parseInt(in[3]);
    System.err.println(n);

    int ret = 0;
    for (int i=0; i <= n/r; i++) {
      int rest1 = (n-r*i)/g;
      for (int j=0; j <= rest1; j++) {
        if ((n-r*i-g*j) % b == 0) {
          	ret++;
        }
      }
    }
    System.out.println(ret);
  }
}

Measured memory_bytes: 21204
#include <cstdio>
#include <cctype>
#include <utility>
#include <climits>
#include <algorithm>
using namespace std;

#define gcu getchar_unlocked
#define pcu putchar_unlocked
#define _T template <typename T>
#define _HT template <typename H, typename... T>
#define _il inline
#define _in _il int in
#define _sc _il bool scan
_T T in(int c){T n=0;bool m=false;while(isspace(c)){c=gcu();}if(c=='-')m=true,c=gcu();
	do{n=10*n+(c-'0'),c=gcu();}while(c>='0'&&c<='9');return m?-n:n;}
_in() {return in<int>(gcu());}
_T T scan(T &n){int c=gcu();return c==EOF?false:(n=in<T>(c),true);}
_sc(char &c){c=gcu();gcu();return c!=EOF;}
#ifdef _GLIBCXX_STRING
_sc(string &s){int c;s="";
	for(;;){c=gcu();if(c=='\n'||c==' ')return true;else if(c==EOF)return false;s+=c;}}
#endif
_HT _sc(H &h, T&&... t){return scan(h)&&scan(t...);}
#define _vo _il void out
#define _vl _il void outl
_vo(bool b) {pcu('0'+b);}
_vo(const char *s){while(*s)pcu(*s++);}
_vo(char c){pcu(c);}
#ifdef _GLIBCXX_STRING
_vo(string s){for(char c:s)pcu(c);}
#endif
_T _vo(T n){static char buf[20];char *p=buf;
	if(n<0)pcu('-'),n*=-1;if(!n)*p++='0';else while(n)*p++=n%10+'0',n/=10;
	while (p!=buf)pcu(*--p);}
_vl(){out('\n');}
#ifdef _GLIBCXX_VECTOR
_T _vo(vector<T> &v){for(T &x:v)out(&x == &v[0]?"":" "),out(x);outl();}
#endif
_HT _vo(H&& h, T&&... t){out(h);out(move(t)...);}
template <typename... T> _vl(T&&... t){out(move(t)...);outl();}

struct table {
	int t[51];
	constexpr table() : t() {
		int ma[] = {2, 3, 5, 10, 12, 15}, mb[] = {380, 550, 850, 1520, 1870, 2244};
		for (int i = 1; i < 51; i++)
			t[i] = INT_MAX / 2;
		for (int i = 0; i < 6; i++)
			for (int j = ma[i]; j < 51; j++)
				t[j] = min(t[j], t[j - ma[i]] + mb[i]);
	}
};

int main() {
	constexpr table t;
	for (int a; (a = in());)
		outl(t.t[a/100]);
}


Measured memory_bytes: 2540
#define _USE_MATH_DEFINES
#include <cassert>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <string>
#include <sstream>
#include <vector>
#include <queue>
#include <stack>
#include <list>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <algorithm>
#include <complex>
#include <cmath>
#include <numeric>
#include <bitset>
#include <functional>
#include <random>
#include <ctime>

using namespace std;

#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
  cerr << name << ": " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
  const char* comma = strchr(names + 1, ',');
  cerr.write(names, comma - names) << ": " << arg1 << " |";
  __f(comma + 1, args...);
}

typedef long long int64;
typedef pair<int, int> ii;
const int INF = 1 << 29;
const int MOD = 1e9 + 7;

int main() {
  vector<int> a(4);
  for (int i = 0; i < 3; ++i) {
    scanf("%d", &a[i]);
  }
  a[3] = a[0];
  int ret = INF;
  for (int i = 0; i < 3; ++i) {
    ret = min(ret, a[i] + a[i + 1]);
  }
  printf("%d\n", ret);
  return 0;
}


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

long power_surp(long, long, long);

int main()
{
	int m;
	long n;
	long surp; //surplus
	long a=1000000007;

	cin>>m>>n;

	surp=power_surp(m,n,a);

	cout<<surp<<endl;
	return 0;
}

long power_surp(long x, long n, long a)
{
	long tmp=1;

	if(n>0) tmp=power_surp(x*x%a, n/2, a);
	if(n%2==1) tmp=tmp*x%a;

	return tmp;
}

Measured memory_bytes: 3076
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

public class Main {
	public static void main(String[] args) {
		FastScanner sc = new FastScanner(System.in);
		long x = sc.nextLong();
		long money = 100;
		int count = 0;

		while(money < x) {
			money += money/100;
			count++;
		}

		System.out.println(count);
	}

	static class FastScanner {
			private BufferedReader reader = null;
		    private StringTokenizer tokenizer = null;
		    public FastScanner(InputStream in) {
		        reader = new BufferedReader(new InputStreamReader(in));
		        tokenizer = null;
		    }

		    public String next() {
		        if (tokenizer == null || !tokenizer.hasMoreTokens()) {
		            try {
		                tokenizer = new StringTokenizer(reader.readLine());
		            } catch (IOException e) {
		                throw new RuntimeException(e);
		            }
		        }
		        return tokenizer.nextToken();
		    }

		    public String nextLine() {
		        if (tokenizer == null || !tokenizer.hasMoreTokens()) {
		            try {
		                return reader.readLine();
		            } catch (IOException e) {
		                throw new RuntimeException(e);
		            }
		        }

		        return tokenizer.nextToken("\n");
		    }

		    public long nextLong() {
		        return Long.parseLong(next());
		    }

		    public int nextInt() {
		        return Integer.parseInt(next());
		    }

		    public double nextDouble() {
		         return Double.parseDouble(next());
		     }

		    public int[] nextIntArray(int n) {
		        int[] a = new int[n];
		        for (int i = 0; i < n; i++)
		            a[i] = nextInt();
		        return a;
		    }

		    public long[] nextLongArray(int n) {
		        long[] a = new long[n];
		        for (int i = 0; i < n; i++)
		            a[i] = nextLong();
		        return a;
		    }
		}
}


Measured memory_bytes: 32924
#include <iostream>
#include <string>
#include <algorithm>
using namespace std;
#define REP(i,n) for(int i=0;i<n;i++)
#define INF 2000000000

int main(){
    int K;
    string S;
    cin >> K;
    cin >> S;
    string T = "";
    if(K>=S.length()) cout << S << endl;
    else{
        REP(i,K) T.push_back(S.at(i));
        T.push_back('.');
        T.push_back('.');
        T.push_back('.');
        cout << T << endl;
    }
}

Measured memory_bytes: 3096
#include<cstdio>
#include<cstdlib>
#include<iostream>
#include<vector>
#include<queue>
#include<bitset>
#include<string>
#include<stack>
#include<set>
#include<unordered_set>
#include<map>
#include<unordered_map>
#include<cstring>
#include<complex>
#include<cmath>
#include<iomanip>
#include<numeric>
#include<algorithm>
#include<list>
#include<functional>
#include<cassert>
#define mp make_pair
#define pb push_back
#define X first
#define Y second
#define y0 y12
#define y1 y22
#define INF 1987654321
#define PI 3.141592653589793238462643383279502884
#define fup(i,a,b,c) for(int (i)=(a);(i)<=(b);(i)+=(c))
#define fdn(i,a,b,c) for(int (i)=(a);(i)>=(b);(i)-=(c))
#define MEM0(a) memset((a),0,sizeof(a));
#define MEM_1(a) memset((a),-1,sizeof(a));
#define ALL(a) a.begin(),a.end()
#define SYNC ios_base::sync_with_stdio(false);cin.tie(0)
using namespace std;
typedef long long ll;
typedef long double ld;
typedef double db;
typedef unsigned int uint;
typedef unsigned long long ull;
typedef pair<int, int> Pi;
typedef pair<ll, ll> Pll;
typedef pair<double, double> Pd;
typedef vector<int> Vi;
typedef vector<ll> Vll;
typedef vector<double> Vd;
typedef vector<Pi> VPi;
typedef vector<Pll> VPll;
typedef vector<Pd> VPd;
typedef tuple<int, int, int> iii;
typedef tuple<int,int,int,int> iiii;
typedef tuple<ll, ll, ll> LLL;
typedef vector<iii> Viii;
typedef vector<LLL> VLLL;
typedef complex<double> base;
const ll MOD = 998244353;
ll POW(ll a, ll b, ll MMM = MOD) {ll ret=1; for(;b;b>>=1,a=(a*a)%MMM)if(b&1)ret=(ret*a)% MMM; return ret; }
ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }
ll lcm(ll a, ll b) { if (a == 0 || b == 0)return a + b; return a*(b / gcd(a, b)); }
int dx[] = { 0,1,0,-1,1,1,-1,-1 }, dy[] = { 1,0,-1,0,1,-1,1,-1 };

char s[2000][2002];
int v[2002][2002],ex[2002][2002],ey[2002][2002];
int main() {
	int n,m,q;
	scanf("%d%d%d",&n,&m,&q);
	fup(i,0,n-1,1)scanf("%s",s[i]);
	fup(i,0,n-1,1)
		fup(j,0,m-1,1)
		v[i+1][j+1]=v[i][j+1]+v[i+1][j]-v[i][j]+(s[i][j]=='1');
	fup(i,0,n-2,1)
		fup(j,0,m-1,1)
		ex[i+1][j+1]=ex[i][j+1]+ex[i+1][j]-ex[i][j]+(s[i][j]=='1' && s[i+1][j]=='1');
	fup(i,0,n-1,1)
		fup(j,0,m-2,1)
		ey[i+1][j+1]=ey[i][j+1]+ey[i+1][j]-ey[i][j]+(s[i][j]=='1' && s[i][j+1]=='1');
	while(q--)
	{
		int x1,y1,x2,y2;
		scanf("%d%d%d%d",&x1,&y1,&x2,&y2);
		int t1=v[x2][y2]-v[x2][y1-1]-v[x1-1][y2]+v[x1-1][y1-1];
		int t2=ex[x2-1][y2]-ex[x2-1][y1-1]-ex[x1-1][y2]+ex[x1-1][y1-1];
		int t3=ey[x2][y2-1]-ey[x2][y1-1]-ey[x1-1][y2-1]+ey[x1-1][y1-1];
		printf("%d\n",t1-t2-t3);
	}
}

Measured memory_bytes: 52736
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll,ll> P;
typedef pair<int,int> Pi;
#define rep(i,n) for(ll i=0;i<n;i++)
#define FOR(i,a,b) for(ll i=a;i<b;i++)
#define fi first
#define se second
#define endl "\n"

template<typename T> inline bool chmax(T &a, T b){if(a<b){a=b;return true;}return false;}
template<typename T> inline bool chmin(T &a, T b){if(a>b){a=b;return true;}return false;}
template<typename T> ostream& operator<<(ostream& s,const complex<T>& d) {return s<<"("<<d.real()<<", "<<d.imag()<< ")";}
template<typename T1, typename T2> ostream& operator<<(ostream& s,const pair<T1,T2>& d) {return s<<"("<<d.first<<", "<<d.second<<")";}
template<typename T> ostream& operator<<(ostream& s, const vector<T>& d){int len=d.size();rep(i,len){s<<d[i];if(i<len-1) s<<" ";}return s;}
template<typename T> ostream& operator<<(ostream& s,const vector<vector<T>>& d){int len=d.size();rep(i,len){s<<d[i]<<endl;}return s;}
template<typename T> ostream& operator<<(ostream& s,const set<T>& v){s<<"{ ";for(auto itr=v.begin();itr!=v.end();++itr) {if (itr!=v.begin()) {s<< ", ";}s<<(*itr);}s<<" }";return s;}
template<typename T> ostream& operator<<(ostream& s,const multiset<T>& v){s<<"{ ";for(auto itr=v.begin();itr!=v.end();++itr) {if (itr!=v.begin()) {s<< ", ";}s<<(*itr);}s<<" }";return s;}
template<typename T1, typename T2> ostream& operator<<(ostream& s,const map<T1,T2>& m){s<<"{"<<endl;for(auto itr=m.begin();itr!=m.end();++itr){s<<" "<<(*itr).first<<" : "<<(*itr).second<<endl;}s<<"}"<<endl;return s;}

const ll mod=1'000'000'007;
const ll inf=1'000'000'000'000'000'00;
const int INF=1'000'000'000;
const double EPS=1e-10;
const double PI=acos(-1);

int main(){
    cin.tie(0);ios::sync_with_stdio(false);
    int n;
    cin>>n;
    vector<vector<int>> g(n);
    rep(i,n-1){
        int a,b;
        cin>>a>>b;
        a--,b--;
        g[a].push_back(b);
        g[b].push_back(a);
    }
    vector<int> dp(n,0);
    auto dfs=[&](auto &dfs,int v,int pre)->void{
        if(pre>=0) dp[v]=dp[pre]+1;
        for(auto to:g[v]){
            if(to==pre) continue;
            dfs(dfs,to,v);
        }
    };
    dfs(dfs,0,-1);
    int from,ma=-1;
    rep(i,n){
        if(chmax(ma,dp[i])) from=i;
    }
    rep(i,n) dp[i]=0;
    dfs(dfs,from,-1);
    ma=*max_element(begin(dp),end(dp))+1;
    if(ma%3==2) cout<<"Second"<<endl;
    else cout<<"First"<<endl;
}

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

using namespace std;

#define FAST() ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)

int main()
{
    FAST();
    bool mark[105]={0};
    int i,n,x,y,z;
    cin >> x >> n;
    while(n--)
    {
        cin >> y;
        mark[y]=1;
    }
    for(i=x-1;i>-1;i--)
    {
        if(!mark[i])
        {
            y=i;
            break;
        }
    }
    for(i=x;i<102;i++)
    {
        if(!mark[i])
        {
            z=i;
            break;
        }
    }
    if(z-x < x-y)cout << z;
    else cout << y;
    return 0;
}


Measured memory_bytes: 3636
#include <iostream>
#include <map>
#include <string>

using namespace std;

#define loop(i,a,b) for(int i=(a); i<(int)(b); i++)
#define rep(i,b) loop(i,0,b)

int main(){
    int n,r;
    while(cin >> n >> r && n){
        string s(n,0);
        rep(i,n) s[n-i-1] = i+1;
        rep(i,r){
            int p,c;
            cin >> p >> c;
            s = s.substr(p-1,c) + s.substr(0,p-1) + s.substr(p-1+c);
        }
        cout << (int)s[0] << endl;
    }
}

Measured memory_bytes: 1220