akhauriyash/Code-Regression huggingface dataset:
using System;
using System.Collections.Generic;
class Program
{
	static void Main(string[] args)
	{
		int M = int.Parse(Console.ReadLine());
		int[,]A = new int[M-1,2];
		int[]B = new int[M];
		var listA = new List<int>[M];
		for(var i=0;i<M;i++){
			listA[i] = new List<int>();
		}
		for(var i=0;i<M-1;i++){
			string[] str = Console.ReadLine().Split();
			A[i,0] = int.Parse(str[0]);
			A[i,1] = int.Parse(str[1]);
			listA[A[i,0]-1].Add(A[i,1]-1);
			listA[A[i,1]-1].Add(A[i,0]-1);
			B[A[i,0]-1]++;
			B[A[i,1]-1]++;
		}
		string[] str2 = Console.ReadLine().Split();
		int[]C = new int[M];
		for(var i=0;i<M;i++){
			C[i] = int.Parse(str2[i]);
		}
		Array.Sort(C,(x,y)=>y-x);
		var list = new List<int>();
      for(var i=0;i<listA[0].Count;i++){
		list.Add(listA[0][i]);
      }
		int[]D = new int[M];
		int ct = 1;
		D[0] = 1;
      	int ans = 0;
		while(list.Count>0){
			var list2 = new List<int>(list);
			list.Clear();
			foreach(var h in list2){
				if(D[h] == 0){
					ct++;
					D[h] = ct;
                  	ans += C[ct-1];
					foreach(var h2 in listA[h]){
						if(D[h2] == 0){
							list.Add(h2);
						}
					}
				}
			}
		}
    	Console.WriteLine(ans);
		Console.Write(C[D[0]-1]);
		for(var i=1;i<M;i++){
			Console.Write(" "+C[D[i]-1]);
		}
	}
}

Measured memory_bytes: 19680
res = []
for digit in range(1,16):
    if digit<=3:
        for i in range(2,11):
            res.append(10**(digit-1)*i-1)
    elif 4<=digit<=12:
        for i in range(11,(digit-2)*10):
            res.append(i*10**(digit-2)-1)
        for i in range(digit-2,11):
            res.append(i*10**(digit-1)-1)
    elif digit==15:
        for i in range(101,110):
            res.append(i*10**(digit-3)-1)
        for i in range(11,101):
            res.append(i*10**(digit-2)-1)
    else:
        for i in range(11,101):
            res.append(i*10**(digit-2)-1)
for i in range(int(input())):
    print(res[i])


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

int main() {
	string s;
	cin >> s;
	long long k;
	cin >> k;

	long long con = 5000000000000000LL;

	int ans = 0;
	for(int i = 0; i < s.length(); ++i) {
		if(s[i] == '1' && k > 1) {
					k--;
				continue;
		}
		ans = s[i] - '0';
		break;
	}
	cout << ans << endl;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<math.h>
#include<algorithm>
using namespace std;

struct node
{
    int x;
    int y;
    int h;
}Node[112];
bool cmp(struct node a ,struct node b)
{
    return a.h<b.h;
}
int main()
{
    int n;
    scanf("%d",&n);
    for(int i=0;i<n;i++)
        scanf("%d %d %d",&Node[i].x,&Node[i].y,&Node[i].h);
    sort(Node,Node+n,cmp);
    for(int x=0;x<=100;x++)
        for(int y=0;y<=100;y++)
        {
            int H=Node[n-1].h+abs(Node[n-1].x-x)+abs(Node[n-1].y-y);
            if(H!=0)
            {
                int i;
                for(i=0;i<n-1;i++)
                {
                    int h=H-abs(Node[i].x-x)-abs(Node[i].y-y);
                    if(h<=0)
                    {
                        if(Node[i].h!=0)
                            break;
                        else
                            continue;
                    }
                    else
                        if(h!=Node[i].h)
                            break;
                }
                if(i==n-1)
                {
                    printf("%d %d %d\n",x,y,H);
                    return 0;
                }
            }
            
        }
    return 0;
}

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

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

  int i=1, j=1, count=0;
  while (i<N){
    count += i;
    i++;
  }

  while (j<M){
    count += j;
    j++;
  }
  
  cout << count << endl;
  
}

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

void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}

template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}

#ifndef ONLINE_JUDGE
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define debug(x...)
#endif

#define REP(i, n) for(int i = 0; i < (n); i++)
#define FOR(i, a, b) for(int i = (a); i <= (b); i++)
#define FORD(i, a, b) for(int i = (a); i >= (b); i--)
#define A first
#define B second
#define MOD 1000000007

typedef pair<int,int> ii;
typedef vector<ii> vii;
typedef long long ll;

int mulmd(ll a, ll b){
    ll ret = (a * b) % MOD;
    return (int)ret;
}

inline int power(ll x, ll y, int p)
{
    ll res = 1;
    x = x % p;
    while (y > 0)
    {
        if (y & 1)
            res = mulmd(res, x);
        y = y >> 1;
        x = mulmd(x, x);
    }
    return (int)res;
}

int submd(ll a, ll b){
    ll ret = a - b;
    if(ret < 0){
        ret += MOD;
    }
    return (int)ret;
}

int addmd(ll a, ll b){
    ll ret = (a + b) % MOD;
    return (int)ret;
}

int invPow(ll a){
    return power(a, MOD - 2, MOD);
}

const int N = 1e5 + 5;

int arr[N];
map<ii, int> mp;

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll h, w, n;
    cin >> h >> w >> n;
    vii a(n);
    for(int i = 0; i < n; i++) {
        cin >> a[i].A >> a[i].B;
    }

    vector<ll> ans(10, 0);
    for(int i = 0; i < n; i++){
        ii tp = a[i];
        for(int j = -2; j <= 0; j++){
            for(int k = -2; k <= 0; k++){
                mp[{tp.A + j, tp.B + k}] += 1;
            }
        }
    }
    ll occ = 0;
    for(auto i: mp){
        if(i.A.A >= 1 && i.A.A + 2 <= h && i.A.B >= 1 && i.A.B + 2 <= w) ans[i.B] += 1;
    }
    //debug(occ);
    for(int i = 1; i <= 9; i++) occ += ans[i];
    ll total = (h - 2 )*(w - 2);
    ll blank = total - occ;
    ans[0] = blank;
    for(int i = 0; i < 10; i++){
        cout << ans[i] << "\n";
    }
}



Measured memory_bytes: 57344
#!/usr/bin/env python3
import math
from functools import reduce
 
def gcd(*numbers):
    return reduce(math.gcd, numbers)
 
def main():
    N = list(map(int, open(0).read().split()))
    N = N[0]
    L = 0
 
    for a in range(1, N+1):
        for b in range(1, N+1):
            for c in range(1, N+1):
                L += gcd(a,b,c)
    print(L)
main()

Measured memory_bytes: 69344
#include <iostream>
#include <iomanip>
#include <vector>
#include <set>
#include <string>
#include <queue>
#include <algorithm>
#include <map>
#include <cmath>
#include <numeric>
#include <list>
#include <stack>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <tuple>

#define rep(i, n) for (int i = 0; i < (n); i++)
#define rep1(i, n) for (int i = 1; i <= (n); i++)
#define show(a, n) rep(i,n) {cout<<a[i]<<' ';} cout<<endl;

using namespace std;
typedef vector<int> vi;
typedef pair<int, int> pii;
typedef long long ll;
typedef pair<long long, long long> pll;

const int INF = 1 << 30;
const long long INFL = 1LL << 62;
const int MOD = 1000000007;
const int MAX = 100000;
const int N = 100010;

int main() {
	ll n, k, x, y;
	cin >> n >> k >> x >> y;
	cout << x * min(n, k) + y * max(n - k, 0ll) << endl;
}


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

struct node_t {
	shared_ptr<node_t> left, right;

	node_t():left(nullptr), right(nullptr) {}
};

shared_ptr<node_t> parse(string::const_iterator &it) {
	shared_ptr<node_t> p(new node_t());

	++it; // '('
	if(*it == '(') p->left = parse(it);
	++it; // ','
	if(*it == '(') p->right = parse(it);
	++it; // ')'

	return p;
}

inline shared_ptr<node_t> input_tree() {
	string s;
	cin >> s;

	auto it = s.cbegin();
	return parse(it);
}

inline bool intersection_ok(const shared_ptr<node_t> &a, const shared_ptr<node_t> &b) {
	return a != nullptr && b != nullptr;
}

inline bool union_ok(const shared_ptr<node_t> &a, const shared_ptr<node_t> &b) {
	return a != nullptr || b != nullptr;
}

template<class Predicate>
inline string dfs(const shared_ptr<node_t> &a, const shared_ptr<node_t> &b, const Predicate &ok) {
	if(!ok(a, b)) return "";

	string res = "(";
	res += dfs(a ? a->left : nullptr, b ? b->left : nullptr, ok);
	res += ",";
	res += dfs(a ? a->right : nullptr, b ? b->right : nullptr, ok);
	res += ")";

	return res;
}

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

	for(char c; cin >> c;) {
		const auto tree1 = input_tree();
		const auto tree2 = input_tree();

		const auto ok = (c == 'i' ? &intersection_ok : &union_ok);
		cout << dfs(tree1, tree2, ok) << endl;
	}

	return EXIT_SUCCESS;
}

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

int main() {
  int n;
  cin >> n;
  vector<int> vec(n);
  for(int i = 0; i < n; i++){
    cin >> vec[i];
  }

  sort(vec.begin(), vec.end(), greater<int>());
  int sumA = 0, sumB = 0;
  for(int i = 0; i < n; i++){
    if (i % 2 == 0)
      sumA += vec[i];
    else 
      sumB += vec[i];
  }

  cout << sumA - sumB << endl;
}


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

int main() {
  char s[11], t[11] = "2019/04/30";
  scanf("%s", s);
  if (strcmp(s, t) <= 0) {
    printf("Heisei\n");
  } else {
    printf("TBD\n");
  }
  return 0;
}


Measured memory_bytes: 128
#include<bits/stdc++.h>
using ll = long long;
using namespace std;
const ll INF = 1000000000000;
const ll mod = 1000000007;
ll test[12345678], res[12345678], aa[1234][1234], bb[1234][1234];
ll dx[4] = { 1, 0, -1, 0 }, dy[4] = { 0, 1, 0, -1 };
char maze[1234][1234];
signed main() {
	ll n, m, k, sum = 0, num = 1000000000000000, cnt = 0, ans = 0; cin >> n;
	for (int h = 0; h < n; h++) {
		cin >> m >> k;
		if (num > k) {
			sum = m; num = k;
		}
	}
	cout << sum + num << endl;
	return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
using namespace std;

int main(){
  int h,w;
  while(1){
    scanf("%d %d",&h,&w);
    if(h==0 && w==0) break;
    for(int i=0;i<h;i++){
      for(int j=0;j<w;j++){
        printf("#");
      }
      printf("\n");
    }
    printf("\n");
  }

  return 0;
}


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

// TYPEDEF
// ----------------------------------------
typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> Pair;
typedef vector<ll> vll;
typedef vector<vector<ll>> Graph;
typedef vector<string> vs;
typedef vector<pair<ll, ll>> Pll;
typedef queue<ll> qll;

// REPEAT
// ----------------------------------------
#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define REPA(i,a) for(ll i=0;i<(ll)(a.size());i++);
#define FOR(i,a,b) for(ll i=a;i<=(ll)(b);i++)
#define FORD(i,a,b) for(ll i=a;i>=(ll)(b);i--)
#define COUT(a) cout << (a) << endl;
#define ENDL(a) cout << endl;
#define COUTA(i,a) for(ll i=0;i<(ll)(a.size());i++) {cout << (a)[i] << " ";} cout << endl;

// UTIL
// ----------------------------------------
#define pb push_back
#define paired make_pair
#define ALL(a) (a).begin(),(a).end()
#define SORT(a) sort((a).begin(),(a).end())
#define RSORT(a) sort((a).rbegin(), (a).rend())

// DEBUG
// ----------------------------------------
#ifdef _DEBUG
#define debug(x) cout << "[debug] " << #x << ": " << x << endl
#else
#define debug(x)
#endif

template <typename T>
void debugV(const vector<T> v) {
#ifdef _DEBUG
  rep(i, v.size()) {
    cout << i << ":" << v[i] << " ";
  }
  cout << endl;
#else
  (void)v;
#endif
}

// BIT FLAG
// ----------------------------------------
const unsigned int BIT_FLAG_0 = (1 << 0); // 0000 0000 0000 0001
const unsigned int BIT_FLAG_1 = (1 << 1); // 0000 0000 0000 0010
const unsigned int BIT_FLAG_2 = (1 << 2); // 0000 0000 0000 0100
const unsigned int BIT_FLAG_3 = (1 << 3); // 0000 0000 0000 1000
const unsigned int BIT_FLAG_4 = (1 << 4); // 0000 0000 0001 0000
const unsigned int BIT_FLAG_5 = (1 << 5); // 0000 0000 0010 0000
const unsigned int BIT_FLAG_6 = (1 << 6); // 0000 0000 0100 0000
const unsigned int BIT_FLAG_7 = (1 << 7); // 0000 0000 1000 0000
const unsigned int BIT_FLAG_8 = (1 << 8); // 0000 0001 0000 0000
const unsigned int BIT_FLAG_9 = (1 << 9); // 0000 0010 0000 0000
const unsigned int BIT_FLAG_10 = (1 << 10); // 0000 0100 0000 0000
const unsigned int BIT_FLAG_11 = (1 << 11); // 0000 1000 0000 0000

// CONST
// ----------------------------------------
constexpr ll INF = 0x3f3f3f3f3f3f3f3f;
constexpr double PI=3.14159265358979323846; // or M_PI
constexpr int MOD = 1000000007;


void Main() {
  string s;
  ll n;

  cin >> n >> s;
  REP(i, s.length()) {
    if (s[i] + char(n) > 'Z') {
      s[i] = s[i] + char(n - 26);
    }
    else {
      s[i] = s[i] + char(n);
    }
  }
  COUT(s);

}

int main()
{
	cin.tie(0);
	ios_base::sync_with_stdio(false);
	cout << fixed << setprecision(15);
	Main();
}

/*

3 2
*/


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

using namespace std;

typedef long long ll;
typedef pair<int, int> ii;
typedef vector<ii> vii;
typedef vector<int> vi;

#if !defined(M_PI)
#define M_E 2.71828182845904523536
#define M_LOG2E 1.44269504088896340736
#define M_LOG10E 0.434294481903251827651
#define M_LN2 0.693147180559945309417
#define M_LN10 2.30258509299404568402
#define M_PI 3.14159265358979323846
#define M_PI_2 1.57079632679489661923
#define M_PI_4 0.785398163397448309616
#define M_1_PI 0.318309886183790671538
#define M_2_PI 0.636619772367581343076
#define M_2_SQRTPI 1.12837916709551257390
#define M_SQRT2 1.41421356237309504880
#define M_SQRT1_2 0.707106781186547524401
#endif

class UnionFind {
public:
    vector<int> id;
    vector<int> sz;

    UnionFind(int n) {
        id = vector<int>(n, 0);

        for (int i = 0; i < n; i++) {
            id[i] = i;
        }
        sz = vector<int>(n, 1);
    }

    void unite(int p, int q) {
        int p_root = get_root(p);
        int q_root = get_root(q);

        if (p_root != q_root) {
            if (sz[p_root] < sz[q_root])
                swap(p_root, q_root);

            id[q_root] = p_root;
            sz[p_root] += sz[q_root];
        }
    }

    int get_root(int p) {
        while (p != id[p]) {
            id[p] = id[id[p]];
            p = id[p];
        }
        return p;
    }
};

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

    UnionFind uf(n + 1);

    int p, q;
    for (int i = 0; i < m; i++) {
        cin >> p >> q;
        uf.unite(p, q);
    }

    int ans = 0;
    for (int i = 0; i <= n; i++ ) {
        // cout << uf.sz[i] << " ";
        ans = max(ans, uf.sz[i]);
    }
    return ans;
}

int main(int argc, char** argv) {
    ios::sync_with_stdio(false);
    cin.tie(0);

    int tt = 1;
    // cin >> tt;

    for (int tc = 1; tc <= tt; tc++) {
        cout << solve() << "\n";
    }
}


Measured memory_bytes: 4740
from collections import deque

H, W = map(int, input().split())
A_array = [input() for i in range(H)]
adjusted_array = ((0, 1), (-1, 0), (0, -1), (1, 0))

distance = [[-1] * W for i in range(H)]

que = deque()

for i in range(H):
    for j in range(W):
        if A_array[i][j] == "#":
            distance[i][j] = 0
            que.append((i, j))
# print(que)

while (que):
    i, j = que.popleft()
    for adjusted in adjusted_array:
        x = j + adjusted[1]
        y = i + adjusted[0]
        if x >= W or x < 0 or y >= H or y < 0 or distance[y][x] != -1:
            continue
        distance[y][x] = distance[i][j] + 1
        que.append((y, x))

print(max([max(distance[i]) for i in range(H)]))

Measured memory_bytes: 86492
#include<stdio.h>
#include<math.h>
#include<algorithm>
#include<queue>
#include<deque>
#include<string>
#include<string.h>
#include<vector>
#include<set>
#include<map>
#include<bitset>
#include<stdlib.h>
#include<cassert>
#include<time.h>
#include<bitset>
using namespace std;
const long long mod=1000000007;
const long long inf=mod*mod;
const long long d2=(mod+1)/2;
const double EPS=1e-6;
const double PI=acos(-1.0);
int ABS(int a){return max(a,-a);}
long long ABS(long long a){return max(a,-a);}
char in[110000];
int ex[26];
int main(){
	scanf("%s",in);
	for(int i=0;in[i];i++){
		ex[in[i]-'a']++;
	}
	for(int i=0;i<26;i++){
		if(!ex[i]){
			printf("%c\n",i+'a');return 0;
		}
	}
	printf("None\n");
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define SC scanf
#define PR printf
#define pb push_back
#define mp make_pair
#define SZ(v) ((int)(v).size())
#define rep(i,n) for(int i=0;i<(n);i++)
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second
#define db double
#define ldb long double
#define uint unsigned
#define ll long long
typedef pair<int,int> pii;
typedef pair<pii,int> ppi;
typedef pair<int,pii> pip;
typedef pair<pii,pii> ppp;
typedef vector<int> vi;
typedef vector<bool> vb;
typedef vector<string> vs;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<pii> vii;
typedef map<int,int> mii;
const int INF=0x3f3f3f3f;
const ll LL_INF=0x3f3f3f3f3f3f3f3f;
const int xx[4]={1,-1,0,0};
const int yy[4]={0,0,1,-1};
int inline nextin(){
	int t;
	if(scanf("%d",&t)!=1)exit(0);
	return t;
}
int inline in(){
	int x=0,c;
	for(;(uint)((c=getchar())-'0')>=10;){
		if(c=='-')return -in();
		if(!~c)throw ~0;
	}
	do{
		x=(x<<3)+(x<<1)+(c-'0');
	}while((uint)((c=getchar())-'0')<10);
	return x;
}
int main(){
    cin.sync_with_stdio(false);cin.tie(0);
	int n;
	cin>>n;
	string s;
	cin>>s;
	for(int i=0;i<4;i++){
		string t=to_string((i&2)>>1)+to_string(i&1);
		for(int j=2;j<n;j++){
			if(s[j-1]=='o'&&t[j-1]=='0'){
				t+=t[j-2];
			}else if(s[j-1]=='o'&&t[j-1]=='1'){
				t+=((t[j-2]-'0')^1)+'0';
			}else if(s[j-1]=='x'&&t[j-1]=='0'){
				t+=((t[j-2]-'0')^1)+'0';
			}else t+=t[j-2];
		}
		
		if(s[0]=='o'&&t[0]=='0'){
			if(t[n-1]==t[1]);
			else continue;
		}
		if(s[0]=='o'&&t[0]=='1'){
			if(t[n-1]!=t[1]);
			else continue;
		}
		if(s[0]=='x'&&t[0]=='0'){
			if(t[n-1]!=t[1]);
			else continue;
		}
		if(s[0]=='x'&&t[0]=='1'){
			if(t[n-1]==t[1]);
			else continue;
		}
		
		if(s[n-1]=='o'&&t[n-1]=='0'){
			if(t[0]==t[n-2]);
			else continue;
		}
		if(s[n-1]=='o'&&t[n-1]=='1'){
			if(t[0]!=t[n-2]);
			else continue;
		}
		if(s[n-1]=='x'&&t[n-1]=='0'){
			if(t[0]!=t[n-2]);
			else continue;
		}
		if(s[n-1]=='x'&&t[n-1]=='1'){
			if(t[0]==t[n-2]);
			else continue;
		}
		
		for(int j=0;j<n;j++){
			if(t[j]=='0')cout<<'S';
			else cout<<'W';
		}
		cout<<endl;
		return 0;
	}
	puts("-1");
	return 0;
}

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

int main() {
	int n,a[100010],b[100010];
	cin>>n;
	for(int i=1;i<=n;i++) {
		cin>>a[i];
		b[a[i]]=i;
	}
	for(int i=1;i<=n;i++) {
		cout<<b[i];
		if(i!=n) cout<<' ';
	}
	cout<<endl;
	return 0;
} 

Measured memory_bytes: 1536
from functools import lru_cache
import sys
sys.setrecursionlimit(10 ** 7)

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

N, K = map(int, input().split())
V = list(map(int, input().split()))


@lru_cache(maxsize=None)
def solve(l, r):
    get = V[:l] + (V[-r:] if r != 0 else [])
    get.sort()
    minus = [x for x in get if x < 0]
    plus = [x for x in get if x >= 0]

    s = sum(plus) + sum(minus[K-l-r:])

    if (l + r) < N and (l + r) < K:
        get_left = solve(l + 1, r)
        get_right = solve(l, r + 1)
        s = max(s, get_left, get_right)

    return s


ans = solve(0, 0)

print(ans)


Measured memory_bytes: 3936
#include<cstdio>
#include<cmath>
#include<iostream>
using namespace std;
#define LL long long
LL n,ans = 0x3f3f3f3f3f3f3f;
void div(LL x){
  LL upb = sqrt(n);
  for(LL i=1;i<=upb;i++)
    if(!(x % i)) ans = min(ans, i + x/i - 2);
}
int main()
{
  scanf("%lld",&n);
  div(n); printf("%lld",ans);
  return 0;
}

Measured memory_bytes: 256
//#include <bits/stdc++.h>
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstdlib>
#include <string>
#include <vector>
#include <map>
#include <queue>

using namespace std;

typedef long long ll;
typedef vector<int> vint;
typedef vector<vector<int> > vvint;
typedef vector<long long> vll, vLL;
typedef vector<vector<long long> > vvll, vvLL;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) for(int i=0;i<n;++i)
#define mod (ll)(1e9+7)
#define FIX(a) ((a)%mod+mod)%mod
#define ALL(obj) (obj).begin(), (obj).end()
#define rALL(obj) (obj).rbegin(), (obj).rend()
#define INF 1000000000 //1e9
#define LLINF 2000000000000000000LL //2e18
#define fi first
#define se second
#define pb push_back
int dy[]={0, 0, 1, -1};
int dx[]={1, -1, 0, 0};

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n;
    cin >> n;
    string s;
    cin >> s;
    vvll rgb(3,vll(n+1,0));
    ll ans = 0;
    string r = "RGB";
    for(ll i=n-1;i>=0;--i){
        REP(j,3){
            if(s[i]==r[j]){
                rgb[j][i] = rgb[j][i+1]+1;
            }else{
                rgb[j][i] = rgb[j][i+1];
            }
        }
    }
    for(ll i=0;i<n;++i){
        for(ll j=i+1;j<n;++j){
            if(s[i]=='R'&&s[j]=='G'){
                if(j+j-i<n&&s[j+j-i]=='B'){
                    ans+=rgb[2][j+1]-1;
                }else{
                    ans+=rgb[2][j+1];
                }
            }
        }
        
        for(ll j=i+1;j<n;++j){
            if(s[i]=='R'&&s[j]=='B'){
                if(j+j-i<n&&s[j+j-i]=='G'){
                    ans+=rgb[1][j+1]-1;
                }else{
                    ans+=rgb[1][j+1];
                }
            }
        }
        for(ll j=i+1;j<n;++j){
            if(s[i]=='G'&&s[j]=='R'){
                if(j+j-i<n&&s[j+j-i]=='B'){
                    ans+=rgb[2][j+1]-1;
                }else{
                    ans+=rgb[2][j+1];
                }
            }
        }
        for(ll j=i+1;j<n;++j){
            if(s[i]=='G'&&s[j]=='B'){
                if(j+j-i<n&&s[j+j-i]=='R'){
                    ans+=rgb[0][j+1]-1;
                }else{
                    ans+=rgb[0][j+1];
                }
            }
        }
        for(ll j=i+1;j<n;++j){
            if(s[i]=='B'&&s[j]=='R'){
                if(j+j-i<n&&s[j+j-i]=='G'){
                    ans+=rgb[1][j+1]-1;
                }else{
                    ans+=rgb[1][j+1];
                }
            }
        }
        for(ll j=i+1;j<n;++j){
            if(s[i]=='B'&&s[j]=='G'){
                if(j+j-i<n&&s[j+j-i]=='R'){
                    ans+=rgb[0][j+1]-1;
                }else{
                    ans+=rgb[0][j+1];
                }
            }
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3728
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <time.h>
#include <tuple>
#include <utility>
#include <vector>
#define ll long long
#define itn int
#define endl '\n'
#define co(ans) cout<<ans<<endl
#define COYE cout<<"YES"<<endl
#define COYe cout<<"Yes"<<endl
#define COye cout<<"yes"<<endl
#define CONO cout<<"NO"<<endl
#define CONo cout<<"No"<<endl
#define COno cout<<"no"<<endl
#define FORE(i,a) for(auto &i:a)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define FFOR(i,a,b) for(int i=(a);i<=(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define RREP(i,n)  FFOR(i,1,n)
#define PB push_back
#define MP make_pair
#define ALL(V) (V).begin(),(V).end()
#define SORT(V) sort((V).begin(),(V).end())
#define REVERSE(V) reverse((V).begin(),(V).end())
#define EACH(V,i) for(typeof((V).begin()) i=(V).begin();i!=(V).end();++i)
#define equals(a,b) (fabs((a)-(b))<EPS)
#define INF ((1LL<<62)-(1LL<<31))
#define EPS 1e-10
#define PI 3.141592653589793238
#define MOD 1000000007
#define MMOD 998244353
#define MAX 2010101
using namespace std;
using Edge=pair<ll,ll>;
using Graph=vector<vector<int>>;
inline int toInt(string s){int v;istringstream sin(s);sin>>v;return v;}
template<class T>inline string toString(T x){ostringstream sout;sout<<x;return sout.str();}
template<class T>bool chmax(T &a,const T &b){if(a<b){a=b;return 1;}return 0;}
template<class T>bool chmin(T &a,const T &b){if(b<a){a=b;return 1;}return 0;}
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;
const int dx[4]={0,1,0,-1},dy[4]={1,0,-1,0};
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return a/gcd(a,b)*b;}

int main(){
  ll N;
  cin>>N;
  ll A[N],mx=0,ans=0;
  REP(i,N){
    cin>>A[i];
    if(mx>A[i]) ans+=mx-A[i];
    chmax(mx,A[i]);
  }
  co(ans);
  return 0;
}

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

using namespace std;
using ll = long long;

map<char,ll> march;
char target[] = {'M','A','R','C','H'};
int n_letter = sizeof(target)/sizeof(target[0]);

ll march_count(int i, int depth){
    if(depth==3)
        return 1;
    if(i>=n_letter)
        return 0;
    depth++;
    ll x = 0;
    for(;i<n_letter;i++){
        x += march_count(i+1,depth)*march[target[i]];
    }
    return x;
}

int main(){
    int n;
    string s;

    cin >> n;
    for(int i=0;i<n;i++){
        cin >> s;
        march[s[0]]++;
    }

    cout << march_count(0,0) << endl;

    return 0;
}

Measured memory_bytes: 256
/* Author : Aaryan Srivastava ^__^ */ 
#include <bits/stdc++.h>
#include <random>
#include <chrono>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp> 
#define pb push_back
#define mp make_pair
#define ff first
#define ss second   
#define rep(i,n) for(int i = 0 ; i < (n) ; i++)
#define repA(i,x,y) for(int i = (x) ; i <= (y) ; i++)
#define repD(i,x,y) for(int i = (x) ; i >= (y) ; i--)
#define all(c) (c).begin(),(c).end()
#define rall(c) (c).rbegin(),(c).rend()
#define setval(a,val) memset(a,val,sizeof(a))
#define Randomize mt19937 rng(chrono::steady_clock::now().time_since_epoch().count())
#define trav(x , a) for(auto &x : a)
#define sz(a) ((int)a.size())
typedef long long ll ; 

#define int ll

using namespace std;

const int N = 3e5 +5 ;
const int mod = 1e9 + 7 ;
const ll inf = 1e18 ;
const int SZ = 101 ;
const double eps = 1e-9 ;
using namespace __gnu_pbds;
using ordered_set =  tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> ;

typedef pair<int, int> pii; 
typedef pair<int , pii> ipii ;
typedef pair<pii , int> piii ; 
typedef unsigned long long ull ;
typedef long double ld;

ll po(ll x,ll y,ll p = mod) {ll res=1;x%=p;while(y>0){if(y&1)res=(res*x)%p;y=y>>1;x=(x*x)%p;}return res;}

vector<int> g[N];
int cnt[3];
int vis[N];
bool isbipar = true;
int edg = 0;

void dfs(int u , int col){
    cnt[col]++;
    vis[u] = col;
    trav(v , g[u]){
        edg++ ;        
        if(!vis[v]){
            dfs(v , 3 - col);
        }else{
            if(vis[v] == vis[u]){
                isbipar = false;
            }
        }
    }
}


void solve()
{
    // bipartite =>
    // nahi to pura

    int n , m;
    cin >> n >> m ;
    int tot = n * (n - 1) / 2; 
    rep(i , m){
        int x,  y;
        cin >> x >> y;
        g[x].pb(y);
        g[y].pb(x);
    }
    int ans = 0 ;
    repA(i , 1 , n){
        if(!vis[i]){
            rep(j , 3) cnt[j] = 0;
            isbipar = true ;
            edg = 0;
            dfs(i , 1);
            if(!isbipar){
                int k = cnt[1] + cnt[2];
                edg /= 2;
                ans += (k * (k - 1) / 2 - edg);
            }else{
                edg /= 2;
                ans += cnt[1] * cnt[2] - edg ;
            }
        }
    }
    cout << ans;

}   

     
int32_t main(int32_t argc, char *argv[])
{
    ios::sync_with_stdio(0);    
    cin.tie(0); cout.tie(0);
    int TC = 1, t = 0;
    //cin >> TC ;
    while(t++ < TC)
    {
        //cout << "Case #" << t << ": " ;
        solve();
        cout << "\n" ;
    }
    return 0;
}

Measured memory_bytes: 16276
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);

		String s = scan.nextLine();
		String p = scan.nextLine();
		
		String newStr = s + s.substring(0,p.length()-1);

        if(newStr.indexOf(p) >= 0) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}
		
		scan.close();
	}
}




Measured memory_bytes: 26280
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int d = sc.nextInt();
		int count = 0;
		
		int see = 2*d+1;
		
		while(true) {
			if(n > 0) {
				n -= see;
				count++;
			}else {
				break;
			}
		}
		
		System.out.println(count);
	}

}


Measured memory_bytes: 21844
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <limits.h>
#include <math.h>
using namespace std;

int main()
{
	const int mod = (int)pow(10, 9) + 7;

	int N;
	string S;
	cin >> N >> S;
	vector<int> c(26, 1);
	for (int i = 0; i < N; ++i)
	{
		++c[S[i] - 'a'];
	}
	long long int ret = 1;
	for (int i = 0; i < 26; ++i)
	{
		ret *= c[i];
		ret %= mod;
	}
	cout << (ret - 1) % mod << endl;

	return 0;
}

Measured memory_bytes: 512
#include<iostream>
#define INF 1<<30
using namespace std;
int main() {
  int n; cin >> n;
  int graph[101][101] = {};
  for (int i = 1; i <= n; ++i)
    for (int j = 1; j <= n; ++j) cin >> graph[i][j];
  int mincost[101], flag[101] = {}, sum = 0;
  for (int i = 2; i <= n; ++i) mincost[i] = INF;
  mincost[1] = 0;
  while (1) {
    int v = -1;
    for (int i = 1; i <= n; ++i) 
      if (!flag[i] && (v == -1 || mincost[v] > mincost[i])) v = i;
    if (v == -1) break;
    flag[v] = 1;
    sum += mincost[v];
    for (int i = 1; i <= n; ++i)
      if (graph[v][i] != -1 && mincost[i] > graph[v][i]) mincost[i] = graph[v][i];
  }
  cout << sum << endl;
  return 0;
}



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


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

  int counter =0 ;

  for (int i=0;i<n-2;++i){
    string x;
    char x1 = s[i];
    x+=x1;
    char x2 = s[i+1];
    x+=x2;
    char x3 = s[i+2];
    x+=x3;


   if (x == "ABC")counter++;
  }

  cout <<counter<<endl;
}



Measured memory_bytes: 256
#include<iostream>
#include <algorithm>
#include<string>
#include<math.h>
#include <functional>
using namespace std;

int main(void) {
	long int N=0,s=0;

	cin >> N ;
	for (long int i = N;i >0;i/=10) {
			s+= i%10;

	}
	if(N%s ==0)
		cout << "Yes" << endl;
	else
		cout << "No" << endl;


	return 0;
}


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

typedef long long ll;
typedef long double ld;
typedef vector<ll> vi;
typedef pair<ll, ll> pii;
typedef vector<pii> vii;
typedef map<ll, ll> mii;
const int MOD = 1e9 + 7;

#define fastIO() \
ios_base::sync_with_stdio(false); cin.tie(nullptr);
#define endl "\n"
#define pb push_back
#define ff first
#define ss second
#define mp make_pair 

int n, K;
vector<int> a;
vector<int> dp;

int solve(int k) {
    if (dp[k] == 0 || dp[k] == 1)   return dp[k];
    for (int i = 0; i < n; ++i) {
        if (a[i] <= k) {
            dp[k] = max(dp[k], 1 - solve(k - a[i]));
        }
    }
    return dp[k];
}

int main() {
    cin >> n >> K;
    a.resize(n);
    dp.clear();
    dp.resize(K + 1, -1);
    for (auto& i : a)   cin >> i;
    sort(a.begin(), a.end());
    for (int i = 0; i < a[0]; ++i) {
        dp[i] = 0;
    }
    for (int i = 0; i < n; ++i)
        dp[a[i]] = 1;
    bool ans = (solve(K) == 1);
    puts(ans ? "First" : "Second");
    return 0;
}


Measured memory_bytes: 6912
#include <iostream>
#include <string>
#include <cstdio>
#include <vector>
#include <stdio.h>
#include <algorithm>
#include <functional>
#include <queue>
#include <math.h>
#include <cmath>
#include <unordered_map>

#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;



void solve(long long X, long long N, std::vector<long long> p){
    int cnt=0;
    while(true){
        auto result1 = find(p.begin(), p.end(), X-cnt);
        auto result2 = find(p.begin(), p.end(), X+cnt);
        if(result1==p.end()){
            cout<<X-cnt<<endl;
            exit(0);
        }else if(result2==p.end()){
            cout<<X+cnt<<endl;
            exit(0);
        }
        cnt++;
    }
}

// Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
int main(){
    long long X;
    scanf("%lld",&X);
    long long N;
    scanf("%lld",&N);
    std::vector<long long> p(N);
    for(int i = 0 ; i < N ; i++){
        scanf("%lld",&p[i]);
    }
    solve(X, N, std::move(p));
    return 0;
}


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

int main(void) {
    int64_t N,a,g = 1 << 30;
    int cnt = 0;
    cin >> N;
    for(int i=0;i<N;i++) {
        cin >> a;
        g = __gcd(g, a);
    }

    while(g && ((g %2) == 0)) {
        cnt++;
        g /=2;
    }

    cout << cnt << endl;
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#include<iomanip>
#include<stack>
#include<queue>
#include<string>
#include<set>
#include<map>
using namespace std;
#define rep(i,n) for(int i=0;(i)<(n);(i)++)
#define FOR(i,m,n) for(int i=(m);(i)<(n);(i)++)
typedef long long ll;

int main(){
    int a[3];
    rep(i,3)cin >> a[i];
    sort(a,a+3);
    cout << a[1]*a[0]/2.0 << endl;
    return 0;
}

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

using namespace std;

int main () {
	int n, k; cin >> n >> k;
	vector<long long> P(n), C(n);
	for (long long& e : P) cin >> e, --e;
	for (long long& e : C) cin >> e;
	vector<vector<long long> > score(n, vector<long long> (n, -1e18));
	vector<int> loop(n);
	for (int i = 0; i < n; ++i) {
		score[i][0] = C[i];
		int now = P[i];
		for (int j = 1; j <= n; ++j) {
			if (i == now) {
				loop[i] = j;
				break;
			}
			score[i][j] = score[i][j - 1] + C[now];
			now = P[now];
		}
	}
	long long ans = -1e18;
	for (int i = 0; i < n; ++i) {
		long long res = *max_element (score[i].begin(), score[i].begin() + min(k, loop[i]));
		int t = k / loop[i] - 1;
		if (t >= 0) {
			long long tmp = t * score[i][loop[i] - 1];
			for (int j = 0; j < loop[i]; ++j)
				res = max (res, tmp + score[i][j]);
			int cnt = k - (t + 1) * loop[i];
			tmp += score[i][loop[i] - 1];
			res = max(res, tmp);
			for (int j = 0; j < cnt; ++j)
				res = max (res, tmp + score[i][j]);
		}
		ans = max (ans, res);
	}
	cout << ans << endl;

	return 0;
}

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

using namespace std;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n;
    cin >> n;
    n %= 10;
    if ((n == 0) || (n == 1) || (n == 6) || (n == 8)) cout << "pon" << '\n';
    else if ((n == 3)) cout << "bon" << '\n';
    else cout << "hon" << '\n';
    return 0;
}

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

ll mp[200005];
ll g[200005];

int main(int argc, char *argv[]) {
  ios::sync_with_stdio(false);cin.tie(nullptr);cout.tie(nullptr);

  ll n;cin>>n;
  for(ll i=0;i<n;i++){
    cin>>g[i];
    mp[g[i]]++;
  }

  ll sum=0;
  for(ll i=0;i<200005;i++){
    if(mp[i]>1){
      sum += mp[i] * (mp[i]-1) / 2;
    }
  }

  for(int i=0;i<n;i++){
    int v = g[i];
    if(mp[v]<=1){
      cout<<sum<<endl;
    }else{
      ll t1 = mp[v] * (mp[v]-1) / 2;
      ll t2 = (mp[v]-1) * (mp[v]-2) / 2;
      cout<<sum-t1+t2<<endl;
    }
  }

  return 0;
}


Measured memory_bytes: 4736
#[allow(unused_imports)]
use proconio::{input, marker::*};

#[allow(unused_imports)]
use std::collections::{BTreeMap, BTreeSet, BinaryHeap, HashMap, HashSet, VecDeque};

#[allow(unused_imports)]
use std::io::Write;

#[allow(unused_macros)]
macro_rules! debug {
    ($($a:expr),*) => {
        #[cfg(debug_assertions)]
        writeln!(&mut std::io::stderr(), concat!("[DEBUG] ", $(stringify!($a), "={:?} "),*), $($a),*).unwrap();
    }
}

fn main() {
    input! {
        n: usize,
        m: usize,
        h: [usize;n],
        ab: [(usize, usize); m],
    }

    let mut nodes = vec![Vec::new(); n + 1];
    for (a, b) in ab {
        nodes[a].push(b);
        nodes[b].push(a);
    }
    let mut count = 0;
    for i in 1..n + 1 {
        let mut flag = true;
        for &next in &nodes[i] {
            if h[i - 1] <= h[next - 1] {
                flag = false;
                break;
            }
        }
        if flag {
            count += 1;
        }
    }
    println!("{}", count);
}


Measured memory_bytes: 12256
import java.util.*;

public class Main {

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

	int MOD = 1000000007;

	public void run() {
		Scanner sc = new Scanner(System.in);
		int n=sc.nextInt();

		int cnt[] = new int[n+1];
		for(int i=2; i<=n; i++) {
			int d = i;
			for(int j=2; j<=d; j++) {
				if(d%j==0) {
					while(d%j==0) {
						cnt[j]++;
						d/=j;
					}
				}
			}
		}
		long ans = 1;
		for(int i=2; i<=n; i++) {
			ans *= (cnt[i]+1);
			ans %= MOD;

		}
		System.out.println(ans);
		sc.close();
	}


}


Measured memory_bytes: 35592
n=int(input())
s=input()
W=[0]*n
W[0]=1 if s[0]=="W" else 0
for i in range(n-1):
  W[i+1]=W[i]+ (1 if s[i+1]=="W" else 0)
ans=(n-1)-(W[n-1]-W[0])
for i in range(1,n-1):
  hidari=W[i-1]
  migi  =(n-(i+1))-(W[n-1]-W[i])
  ans=min(ans,(hidari+migi))
print(min(ans,W[n-2]))

Measured memory_bytes: 15244
#include <iostream> 
#include <sstream> 
#include <iomanip> 
#include <algorithm> 
#include <cmath> 
#include <string> 
#include <vector> 
#include <list> 
#include <queue> 
#include <stack> 
#include <set> 
#include <map> 
#include <bitset> 
#include <numeric> 
#include <climits> 
#include <cfloat> 
using namespace std;

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

int h, w, n;

bool solve(vector<string> grid)
{
    for(;;){
        vector<string> next = grid;
        for(int x=0; x<w; ++x){
            int k = h-1;
            for(int y=h-1; y>=0; --y){
                if(next[y][x] != '.'){
                    if(k != y){
                        next[k][x] = next[y][x];
                        next[y][x] = '.';
                    }
                    -- k;
                }
            }
        }

        vector<vector<bool> > check(h, vector<bool>(w, false));
        for(int y=0; y<h; ++y){
            for(int x=0; x<w; ++x){
                if(next[y][x] == '.')
                    continue;
                for(int i=0; i<2; ++i){
                    int j = 1;
                    int y1 = y + dy[i];
                    int x1 = x + dx[i];
                    while(y1 < h && x1 < w && next[y1][x1] == next[y][x]){
                        ++ j;
                        y1 += dy[i];
                        x1 += dx[i];
                    }
                    if(j < n)
                        continue;
                    while(--j >= 0)
                        check[y+dy[i]*j][x+dx[i]*j] = true;
                }
            }
        }

        for(int y=0; y<h; ++y){
            for(int x=0; x<w; ++x){
                if(check[y][x])
                    next[y][x] = '.';
            }
        }

        if(grid == next)
            return false;
        grid.swap(next);

        if(grid == vector<string>(h, string(w, '.')))
            return true;
    }
}

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

    vector<string> grid(h);
    for(int i=0; i<h; ++i)
        cin >> grid[i];

    for(int y=0; y<h; ++y){
        for(int x=0; x<w-1; ++x){
            swap(grid[y][x], grid[y][x+1]);
            if(solve(grid)){
                cout << "YES" << endl;
                return 0;
            }
            swap(grid[y][x], grid[y][x+1]);
        }
    }

    cout << "NO" << endl;
    return 0;
}

Measured memory_bytes: 900
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
ll ans[100005];
int main(){
    ll a;
    cin>>a;
    ll dy = 0;
    double bs = 100;
    while(bs<a){
    	bs*=1.01;
    	bs = floor(bs);
		dy++; 
	}
	cout<<dy<<endl;
    return 0;
}

Measured memory_bytes: 3636
//INCLUDE
//------------------------------------------
#include <iostream>
#include <functional>
#include <algorithm>
#include <math.h>
#include <iomanip>
#include <string>
#include <cstring>
#include <vector>
//DEFINE
//------------------------------------------
#define ll long long
#define ALLv(a)  (a).begin(),(a).end()
#define ALL(a,n)  (a),(a)+n
#define vi vector<long long>
#define vd vector<long double>
#define vs vector<string>
//CONST
//------------------------------------------
#define INF 1010000000000000017LL
#define MOD 1000000007LL
#define EPS 1e-12
#define PI 3.14159265358979323846
//REPEAT
//------------------------------------------
#define   FOR(i,m,n) for(ll (i)=(m);   (i)<(n);  (i)++)
#define   REP(i,n)   for(ll (i)=0;     (i)<(n);  (i)++)
#define  REPS(i,x)   for(ll (i)=1;     (i)<=(x); (i)++)
#define  RREP(i,x)   for(ll (i)=(x)-1; (i)>=0;   (i)--)
#define RREPS(i,x)   for(ll (i)=(x);   (i)> 0;   (i)--)
#define  WREP(i,in,j,jn) REP(i,in)REP(j,jn)
using namespace std;
//-------------------------------------------

int main(void){
  ll N,A,B;cin>>N>>A>>B;
  ll sum=A+B;

  ll m=N/sum;
  ll md=N%sum;
  cout<<m*A+(md>A?A:md)<<endl;
  return 0;
}


Measured memory_bytes: 256
n, m = map(int, input().split())
ab = [list(map(int, input().split())) for _ in range(n)]
cd = [list(map(int, input().split())) for _ in range(m)]
ans = [0]*n

for i in range(n):
    point = 0
    for j in range(m):
        num = abs(ab[i][0]-cd[j][0]) + abs(ab[i][1]-cd[j][1])
        if j == 0:
            prev = num
            point = j + 1
        elif prev > num:
            prev = num
            point = j + 1
    ans[i] += point

print(*ans, sep='\n')

Measured memory_bytes: 3064
import copy

n, m, q = map(int, input().split())
a = [list(map(int, input().split())) for i in range(q)]
s = []
def dfs(A):
    if len(A) == n:
        s.append(copy.deepcopy(A))
        return
    prev_last = A[-1] if len(A) > 0 else 1
    for i in range(prev_last, m+1):
        A.append(i)
        dfs(A)
        A.pop()

dfs([])

ans = 0
for i in s:
    S = 0
    for j in range(q):
        if i[a[j][1]-1] - i[a[j][0]-1] == a[j][2]:
            S += a[j][3]
    ans = max(ans, S)
#print(a)
#print(s)
print(ans)

Measured memory_bytes: 108068
#include<bits/stdc++.h>
using namespace std;
#define N
#define M
#define inf 123456789
#define Inf 10000000000000000
#define Mod 1000000007
#define rep(i, l, r) for(register int i = l; i <= r; ++i)
#define dep(i, l, r) for(register int i = r; i >= l; --i)
#define Next(i, u) for(register int i = h[u]; i; i = e[i].next)
#define mem(f, x) memset(f, x, sizeof(f))
#define file(a) freopen(#a".in","r",stdin); freopen(#a".out","w",stdout);
typedef long long ll;
typedef double D;
int a, b, c;
int read(){
	char c; int x = 0, f = 1;
	c = getchar();
	while(c > '9' || c < '0'){ if(c == '-') f = -1; c = getchar();}
	while(c >= '0' && c <= '9'){ x = (x << 3) + (x << 1) + c - '0'; c = getchar();}
	return x * f;
}
int Mul(int a, int b) { return 1ll * a * b % Mod; }
int Inc(int a, int b) { return (a += b) >= Mod ? a - Mod : a; }
int Dec(int a, int b) { return (a -= b) < 0 ? a + Mod : a; }
signed main(){
	//file(data);
	a = read(), b = read(), c = read();
    if((a == b) && a != c) puts("Yes");
    else if((a == c) && a != b) puts("Yes");
    else if((b == c) && a != b) puts("Yes");
    else puts("No");
	return 0;
}


Measured memory_bytes: 256
#pragma region _head

#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<cmath>
#include<map>
#include<set>
#include<iomanip>
#include<queue>
#include<stack>
#include<numeric>
#include<utility>
#include<regex>

#pragma region _define

#define int LL
#define f(i,a,b) for(LL i=a;i<b;i++)
#define f_vI(v,n) f(i,0,n)cin>>v[i]
#define f_v2I(v1,v2,n) f(i,0,n)cin>>v1[i]>>v2[i]
#define f_v3I(v1,v2,v3,n) f(i,0,n)cin>>v1[i]>>v2[i]>>v3[i]
#define f_vO(v,n) f(i,0,n)cout<<v[i]<<endl
#define ei else if
#define all(a) a.begin(),a.end()
#define size(s) ((LL)s.size())
#define F first
#define S second
#define check() cout<<"! ! !"
#define endl "\n"
#define _y() cout<<"Yes"<<endl
#define _Y() cout<<"YES"<<endl
#define _n() cout<<"No"<<endl
#define _N() cout<<"NO"<<endl
#define int_INF 1<<29
#define ll_INF 1LL<<60
#define MOD 1000000007

#pragma endregion

#pragma region _using

using namespace std;

using LL = long long;
using st = string;
using vi = vector<LL>;
using vvi = vector<vi>;
using vvvi = vector<vvi>;
using vc = vector<char>;
using vs = vector<st>;
using vb = vector<bool>;
using vvb = vector<vb>;
using vvvb = vector<vvb>;
using qi = queue<LL>;
using qc = queue<char>;
using qs = queue<st>;
using si = stack<LL>;
using sc = stack<char>;
using ss = stack<st>;
using pi = pair<LL, LL>;
using mll = map<LL, LL>;
using mcl = map<char, LL>;
using vpi = vector<pi>;

#pragma endregion

#pragma region _graph

#define node 50  //グラフの最大位数　適宜変更
//bool graph[node][node]; bool visited[node] = { false };
#define link(a,b,m) f(i,0,m){cin>>a[i]>>b[i]; a[i]--; b[i]--; graph[a[i]][b[i]]=graph[b[i]][a[i]]=true;}

#pragma endregion

void y_n(bool p) {
	p ? _y() : _n();
}

void Y_N(bool p) {
	p ? _Y() : _N();
}

LL gcd(LL a, LL b) {
	LL r;
	while ((r = a % b) != 0) {
		a = b;
		b = r;
	}
	return b;
}
LL lcm(LL a, LL b) {
	return (a / gcd(a, b) * b);
}

//素数判定
bool is_prime(int n) {
	for (int i = 2; i*i <= n; i++) {
		if (n % i == 0) {
			return false;
		}
	}
	return true;
}

//階乗計算
LL factorial(LL n) {
	LL a = 1, ret = 1;
	while (a < n) {
		a++;
		ret *= a;
		ret %= MOD;
	}
	return ret;
}

#pragma endregion 




/*****************************************************************************/

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

	int n, W;
	cin >> n >> W;
	vi w(n), v(n);
	f_v2I(w, v, n);
	vvi dp(n + 1, vi(W + 1,0));
	f(i, 0, n) {
		f(j, 0, W + 1) {
			if (w[i] <= j) {
				dp[i + 1][j] = max(dp[i + 1][j], dp[i][j - w[i]] + v[i]);
			}
			dp[i + 1][j] = max(dp[i + 1][j], dp[i][j]);
		}
	}
	cout << dp[n][W];
	return 0;
}

Measured memory_bytes: 80256
#include "bits/stdc++.h"
using namespace std;
#ifdef ONLINE_JUDGE
#define trace(...)
#endif

using LL = long long;

int main() {
	ios_base::sync_with_stdio(false); cin.tie(NULL);
	
	string s; cin >> s;
	LL k; cin >> k;
	LL ans = 0;
	int n = s.size();

	if (s == string(n, s[0])) {
		ans = (n * 1ll * k) / 2;
	} else {
		vector<int> lens;
		char prev = '*'; int len = 0;
		s += "#";
		for (char ch: s) {
			if (ch != prev) {
				if (len > 0) lens.push_back(len);
				len = 0;
				prev = ch;
			}
			len++;
		}
		for (int i = 1; i + 1 < lens.size(); i++) {
			ans += k * (lens[i] / 2);		
		}
		if (s[0] == s[n - 1]) {
			ans += (k - 1) * ((lens[0] + lens.back()) / 2);
			ans += lens[0] / 2;
			ans += lens.back() / 2;
		} else {
			ans += k * (lens[0] / 2);
			ans += k * (lens.back() / 2);
		}
	}

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


Measured memory_bytes: 256
#include<cstdio>
#include<cstring>
#include<cstdlib>
int main(void){
	double a;
	double b;
	int c;
	double s;
	int x[10000];
	int p;
	int n;
	char d[10000];
	scanf("%lf %lf", &a,&b);
	s = a*b / (a + b);
	printf("%f", s);
	return 0;
}

Measured memory_bytes: 128
#include"bits/stdc++.h"

using namespace std;
using ll=long long ;

//N= t*m + t=(m+1)*t;

vector<ll>get_divs(ll N){
  vector<ll>divs;
  for(ll i=1;i*i<=N;++i){
    if(N%i==0){
      divs.push_back(i);
      if(i*i!=N)divs.push_back(N/i);
    }
  }
  sort(divs.begin(),divs.end());
  return divs;
}
  
int main(){
  ll N;cin>>N;
  vector<ll>divs=get_divs(N);
  ll ans=0;
  for(auto t:divs){
    ll m=N/t-1;
    if(m>t)ans+=m;
  }
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 384