akhauriyash/Code-Regression huggingface dataset:
#define _USE_MATH_DEFINES
#include<iostream>
#include<string>
#include<queue>
#include<cmath>
#include<map>
#include<set>
#include<list>
#include<iomanip>
#include<vector>
#include<random>
#include<functional>
#include<algorithm>
#include<stack>
#include<cstdio>
#include<bitset>
#include<unordered_map>
#include<climits>
#include<fstream>
using namespace std;
///////////////////library zone!!!!!!!!!!!!!!!!!!!!!!!!!!!!
typedef long long ll;
typedef long double ld;
#define all(a) (a).begin(),(a).end()
#define EPS (1e-5)
#define bit(n,k) ((n>>k)&1)
const ll Mod = 1000000007;
const ll mod = 998244353;
struct H {
	ll x, y;
	bool operator<(const H& b) const {
		if (x != b.x) return x < b.x;
		return y < b.y;
	}
	bool operator>(const H & b) const {
		if (x != b.x) return x > b.x;
		return y > b.y;
	}
	bool operator==(const H & b) const { return x == b.x && y == b.y; }
	bool operator!=(const H & b) const { return (*this) != b; }
};
struct P {
	ll pos, cost;
	bool operator<(const P& b) const { return cost < b.cost; }
	bool operator>(const P& b) const { return cost > b.cost; }
};
struct B {
	ll to, cost;
};
struct E {
	ll from, to, cost;
	bool operator<(const E& b) const { return cost < b.cost; }
	bool operator>(const E& b) const { return cost > b.cost; }
};
template<typename T, typename U>
void chmin(T & a, U b) {
	if (a > b) a = b;
}
template<typename T, typename U>
void chmax(T & a, U b) {
	if (a < b) a = b;
}
template<typename T>
T max_0(T a) {
	if (a < 0) return 0;
	return a;
}
template<typename T>
T min_0(T a) {
	if (a > 0) return 0;
	return a;
}
ll read() {
	ll u;
	ll k = scanf("%lld", &u);
	return u;
}
ll gcd(ll i, ll j) {
	if (i > j) swap(i, j);
	if (i == 0) return j;
	return gcd(j % i, i);
}
ll mod_pow(ll x, ll n, ll p) {
	ll res = 1;
	while (n > 0) {
		if (n & 1) res = res * x % p;
		x = x * x % p;
		n >>= 1;
	}
	return res;
}//x^n%p
const ll Inf = 3023372036854775807;
const int inf = 1500000000;
#define int long long
//----------------------------------------------------
int n, m;
int dp[2000][2000];
struct A {
	int x, y, z;
};
A a[2000];
signed main() {
	cin >> n >> m;
	for (int i = 0; i < n; i++) {
		cin >> a[i].x >> a[i].y >> a[i].z;
	}
	int ans = -Inf;
	for (int x = -1; x <= 1; x += 2) {
		for (int y = -1; y <= 1; y += 2) {
			for (int z = -1; z <= 1; z += 2) {
				for (int i = 0; i <= n; i++) {
					for (int j = 0; j <= m; j++) {
						dp[i][j] = -Inf;
					}
				}
				dp[0][0] = 0;
				for (int i = 0; i < n; i++) {
					for (int j = 0; j <= m; j++) {
						dp[i + 1][j] = max(dp[i + 1][j], dp[i][j]);
						dp[i + 1][j + 1] = max(dp[i + 1][j + 1], dp[i][j] + a[i].x * x + a[i].y * y + a[i].z * z);
					}
				}
				ans = max(ans, dp[n][m]);
			}
		}
	}
	cout << ans << endl;
}

Measured memory_bytes: 16128
// Example program
#include <iostream>
#include <string>
#include <algorithm>
using namespace std; 

int main()
{ 
    int P; 
    int Q; 
    int R; 
    cin>>P>>Q>>R; 
    int val=min(P+Q,min(Q+R,P+R)); 
    cout<<val; 
    return 0;
}

Measured memory_bytes: 256
import java.util.*;
class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int A = 0;
		int B = 0;
		A = sc.nextInt();
		B = sc.nextInt();

		if(A >= 10 || B >= 10){
			System.out.println(-1);
		}
		else if(A < 1 || B < 1){
			System.out.println(-1);
		}
		else {
			System.out.println(A * B);
		}
	}
}


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

int main() {
  int n;
  cin >> n;
  vector<ld> x(n);
  vector<string> u(n);
  ld sum = 0;
  for (int i = 0; i < n; i++) {
    cin >> x.at(i) >> u.at(i);
    if (u.at(i) == "JPY") sum += x.at(i);
    else sum += x.at(i) * 380000;
  }
  cout << fixed << setprecision(6) << sum << endl;
}

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


int main() {
  int n;
  string a,b;
  cin >> n;
  cin >> a >> b;

  string ans;

  for(int i = 0; i < a.size(); i++) {
    ans += a[i];
    ans += b[i];
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
/**
 *    author: tanishq_code_c
**/
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
template<class T> using oset = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;



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 dbg(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define dbg(x...)
#endif


#define int                                         long long
#define setbits(x)                                  __builtin_popcountll(x)
#define zerobits(x)                                 __builtin_ctzll(x)
#define mod                                         10000007
#define inf                                         1e18
#define endl                                        '\n'
#define pb                                          push_back
#define all(x)                                      x.begin(),x.end()
#define ff                                          first
#define ss                                          second

int powmod(int a, int b) {int res = 1; a %= mod; assert(b >= 0); for (; b; b >>= 1) {if (b & 1)res = res * a % mod; a = a * a % mod;} return res;}
int fast_pow(int a, int b) {if (b == 1) return a; if (b == 0) return 1; int x = fast_pow(a, b / 2); x *= x; if (b & 1) x *= a; return x;}

void t_c_c()
{
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    cout << fixed << setprecision(10);
    /*#ifndef ONLINE_JUDGE
        freopen("inp.txt", "r", stdin);
        freopen("out.txt", "w", stdout);
    #endif*/
    int n; cin >> n;
    int ans = 0;
    for (int i = 1; i <= n; i++) {
        int j = n / i;
        if (j < i) continue;
        int prod = i * j;
        if (prod < n) {
            ans += 2 * j - 2 * (i - 1);
            ans--;
        }
        if (prod - n == 0) {
            ans += 2 * (j) - 2 * (i - 1);
            ans -= 2;
            if (i != j) ans--;
        }
        // dbg(i, ans);
    }
    cout << ans << endl;
}

int32_t main()
{
    t_c_c();
    return 0;
}


Measured memory_bytes: 3636
s;n,k,i,y;d['   '];c(int*z){i=*1[&z]-*z;}main(x){for(scanf("%*d");~scanf("%d%d",&n,&k);printf("%d\n",s)){for(i=n--;s=i;y=x)scanf("%d",&x),d[--i]=x-y;qsort(d,n,4,c);for(;n>=k;s+=d[--n]);}}

Measured memory_bytes: 1176
n = int(input())
a = list(map(int, input().split()))
abs_a = []
minus = 0

for i in range(n):
  if a[i] < 0: minus += 1

for i in range(n):
  abs_a.append(abs(a[i]))
  
if minus % 2 == 0:
  print(sum(abs_a))
else:
  min_abs_a = min(abs_a)
  print(sum(abs_a)-min_abs_a*2)

Measured memory_bytes: 14412
#include <bits/stdc++.h>
using namespace std;
using Int = long long;
#define PUTS(x) cout << (x) << endl;
#define MOD 1000000007

Int mod_pow(Int a, Int n, Int m) {
    Int b, t;
    if (n == 0) return 1;
    a %= m;
    b = a * a;
    b %= m;
    t = mod_pow(b, n / 2, m);
    if (n % 2 != 0) {
        t *= a;
        t %= m;
    }
    return t;
}

int main() {
    Int m, n;
    cin >> m >> n;
    PUTS(mod_pow(m, n, MOD));
}



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

using namespace std;
typedef long long ll;
typedef vector<int> VI;
ll mm=1000000000;ll MM=mm+7;
#define rep(i, n) for(int i=0;i<n;i++)

int main(){
 string s;
  cin >> s;
  int n=0;
  rep(i,3){
    if(s.at(i)=='o')n++;
  }
  cout << 700+n*100 << endl;
  
      
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define int long long
const int MOD = 1000000007LL;
const int INF = LLONG_MAX;

signed main(){
    

    int a, b, c, d; cin >> a >> b >> c >> d;
    cout << (a - c) * (b - d) << endl;    
    return 0;
}

Measured memory_bytes: 256
#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> pii;

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

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

	string S;
	cin >> S;

	vector<int> v;
	if(S[0] == '0'){
		v.push_back(0);
	}

	int cnt = 0;
	bool zero = S[0] == '0';

	for(int i = 0; i < N; i++){
		if(zero){
			if(S[i] == '0'){
				cnt++;
			}else{
				v.push_back(cnt);
				zero = false;
				cnt = 1;
			}
		}else{
			if(S[i] == '1'){
				cnt++;
			}else{
				v.push_back(cnt);
				zero = true;
				cnt = 1;
			}
		}
	}

	v.push_back(cnt);
	if(S[N-1] == '0'){
		v.push_back(0);
	}

	// rep(i, v.size()) cout << v[i] << ",";
	// cout << endl;

	if(v.size() <= 2 * K + 1){
		cout << N << endl;
		return 0;
	}

	int tmp = 0;
	for(int i = 0; i < 2 * K + 1; i++){
		tmp += v[i];
	}

	int ans = 0;
	ans = max(ans, tmp);

	for(int i = 0; 2 * i + 2 * K + 2 < v.size(); i++){
		tmp += v[2 * i + 2 * K + 1] + v[2 * i + 2 * K + 2];
		tmp -= v[2 * i] + v[2* i + 1];
		ans = max(ans, tmp);
	}

	cout << ans << endl;
}


Measured memory_bytes: 1020
#include <bits/stdc++.h>
#define SORT(x) sort(x.begin(),x.end())
#define ALL(x) x.begin(),x.end()
#define rep(i, n) for(int i = 0; i < n; i++)
#define reps(i, m, n) for(int i = m; i < n; i++)
#define repr(i, m, n) for(int i = m; i >= n; i--)
#define INF 1000000000000000003 //1000000007
#define PI (acos(-1))
#define MOD 1000000007
using namespace std;
typedef long long ll;


void Main(){

  int N;
  cin>>N;

  cout<< ( N/10==9 or N%10==9 ? "Yes" : "No" )<<"\n";
}

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


Measured memory_bytes: 256
package main

import "fmt"

func main() {
	var n int
	fmt.Scan(&n)
	a := make([]int, n)
	for i := range a {
		fmt.Scan(&a[i])
	}

	f := 0
	for _, e := range a {
		f += e - 1
	}
	fmt.Println(f)
}


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

/*----------------------------- DEFINES ------------------------------*/

#define eps 1e-9
#define mod 1000000007
#define ump unordered_map // operations take less time compared to map
#define pb push_back
#define pf push_front
#define pof pop_front()
#define pob pop_back()
#define mp make_pair
#define ps(x) push(x) // for stack and queue
#define T top() //  for stack
#define FR front()// for queue
#define BA back()// for queue
#define PP pop()// for queue and stack
#define B begin()
#define E end()
#define F first
#define S second
#define tostr(x) to_string(x)
#define SZ(x) ((int)x.size())
#define ins insert
#define MAE max_element
#define MIE min_element
#define cnt(x) count(x)
#define lb(x) lower_bound(x) // returns an it ptng to the element >=x if no such returns end
#define ub(x) upper_bound(x) // returns an it ptng to the element >x if no such returns end
#define rep(i,x,y) for(int i=x;i<y;i++)
#define per(i,x,y) for(int i=x;i>y;i--)
#define repi(i,x,y) for(int i=x;i<=y;i++)
#define peri(i,x,y) for(int i=x;i>=y;i--)
#define reps(i,x,y,k) for(int i=x;i<y;i+=k)
#define sper(i,x,y,k) for(int i=x;i>y;i-=k) 
#define all(x) ((x.B),(x.E))
#define inf (ll)LLONG_MAX
#define ds1(i,x) for(auto i=x.begin();i!=x.end();i++)
#define ds2(i,x) for(auto i:x) // easy method to iterate through a ds
#define sq(a) (a)*(a)
#define fib(n) ceil(pow((1+sqrt(5),n)-pow((1-sqrt(5),n)/(float)(pow(2,n)*sqrt(5)// compute fib(n) in O(1)
#define FIO {ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);}// fast i/o
#define dig(n) (int)(log10(n)+1) // num of digits
#define ss(x,k) substr(x,k)  // x is the start pos and k is the length of substr.
#define f(x) find(x)
#define set(x,k) memset(x,k,sizeof x)

/*------------------------------ TYPEDEFS-----------------------------*/

typedef long long ll;
typedef long l;
typedef string str;
typedef vector<int> vi;
typedef vector<ll> vlli;
typedef vector<pair<int,int> > vpii;
typedef pair<int,int> pii;
typedef pair<ll,int> pli;
typedef ump<int,int> umpii;

/*-----------------------------START FROM HERE -----------------------*/

int main(){
	FIO
	
	ll a,b;char c;cin>>a>>c>>b;
  	if(c=='+')cout<<a+b;
  	else cout<<a-b;
    return 0;
}


Measured memory_bytes: 384
#include <cstdio>
#include <cstring>
#include <iostream>
#include <string>
#include <cmath>
#include <bitset>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <algorithm>
#include <complex>
#include <unordered_map>
#include <unordered_set>
#include <random>
#include <cassert>
#include <fstream>
#include <utility>
#include <functional>
#define popcount __builtin_popcount
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;
const ll MOD=1e9+7;
int main()
{
	int n; ll k;
	cin>>n>>k;
	int a[2020];
	for(int i=0; i<n; i++) cin>>a[i];
	ll ans=0;
	for(int i=0; i<n; i++){
		for(int j=0; j<n; j++){
			if(a[i]>=a[j]) continue;
			if(i>j){
				ll s=k*(k+1)/2%MOD;
				ans+=s;
				ans%=MOD;
			}else{
				ll s=k*(k-1)/2%MOD;
				ans+=s;
				ans%=MOD;
			}
		}
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int adja[101][101];
int d[101], f[101], cnt;

void dfs(int u) {
    d[u] = ++cnt;
    for (int i = 0, v; (v = adja[u][i]) > 0; ++i) {
        if (d[v] > 0)
            continue;
        dfs(v);
    }
    f[u] = ++cnt;
}

int main() {
    int n, k, u;
    scanf("%d", &n);
    for (int i = 0; i < n; ++i) {
        scanf("%d%d", &u, &k);
        for (int j = 0; j < k; ++j) {
            scanf("%d", &adja[u][j]);
        }
    }
    for (int i = 1; i <= n; ++i) {
        if (d[i] == 0)
            dfs(i);
        printf("%d %d %d\n", i, d[i], f[i]);
    }

    return 0;
}


Measured memory_bytes: 2100
#include<iostream>
#include<cstdio>
#define LL long long
using namespace std;

LL mod=998244353;
LL a,b,c,d;
int dp1[3005][3005],dp2[3005][3005];
int main()
{
	LL i,j;
	cin>>a>>b>>c>>d;
	dp1[a][b]=1;
	for(i=a+1;i<=c;i++)
		dp1[i][b]=b*dp1[i-1][b]%mod;
	for(i=b+1;i<=d;i++)
		dp1[a][i]=a*dp1[a][i-1]%mod;
	for(i=a+1;i<=c;i++)
		for(j=b+1;j<=d;j++)
		{
			dp1[i][j]=(dp1[i][j-1]+dp2[i][j-1])*i%mod;
			dp2[i][j]=(dp1[i-1][j]+dp2[i-1][j]*j)%mod;
		}
	cout<<(dp1[c][d]+dp2[c][d])%mod;
	return 0;
}

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

	struct _ans {
		string s;
		int p;
		int num;

		bool operator<(const _ans& right) const {
			return s == right.s ? p > right.p : s < right.s;
		}
	};

int main(void) {
	int n;
	cin >> n;
	vector<_ans> a(n);
	for (int i = 0; i < n; i++) {
		a[i].num = i+1;
		cin >> a[i].s >> a[i].p;
	}
	sort(a.begin(),a.end());
	cout << endl;
	for (int i = 0; i < n;i++) {
		cout << a[i].num << endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(){

    int i=0;
    int x[9999];


    do{
        scanf("%d",&x[i]);
        
        if(x[i] == 0){
            break;
        }

        i++;

    }while(i < 10001);

    i = 0;
    do{
        if(x[i] != 0){
            printf("Case %d: %d\n",i+1,x[i]);
        }else{
            break;
        }

        i++;

    }while(i < 10000);

    return 0;
}

Measured memory_bytes: 2664
/* {{{ */
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};
    ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    };
}

macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };
    ($iter:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
    };
    ($iter:expr, chars) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };
    ($iter:expr, usize1) => {
        read_value!($iter, usize) - 1
    };
    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}
/* }}} */

fn main() {
    input! {
        n: usize,
        k: usize,
        p: [u64;n]
    }
    let mut s = p.iter().scan(0u64, |a,p| {
        *a += *p;
        Some(*a)
    }).collect::<Vec<u64>>();
    s.insert(0,0);

    let mut mx: u64 = 0;
    let mut mi: usize = 0;
    for i in k..n+1 {
        let v = s[i] - s[i-k];
        if mx < v {
            mx = v;
            mi = i;
        }
    }
    mi = mi - k;

    let t = (1..1000+1).scan(0.5f64, |a, _| {
        *a += 0.5;
        Some(*a)
    }).collect::<Vec<f64>>();
    let mut res: f64 = 0.0;
    for i in mi..mi+k {
        res += t[p[i] as usize - 1];
    }
    println!("{}", res);
}
/* vim:set foldmethod=marker: */


Measured memory_bytes: 10492
<?php
$n = int();
for($i = -105; $i <= 100000; $i++){
    $map[$i] = 0;
}
$map[0] = 1;
for($i = 0; $i <= 100000; $i++){
    if($map[$i-105])$map[$i]=1;
    if($map[$i-104])$map[$i]=1;
    if($map[$i-103])$map[$i]=1;
    if($map[$i-102])$map[$i]=1;
    if($map[$i-101])$map[$i]=1;
    if($map[$i-100])$map[$i]=1;
}

echo $map[$n];

function str(){
  return trim(fgets(STDIN));
}
function ints(){
  return array_map("intval", explode(" ", trim(fgets(STDIN))));
}
function int(){
  return intval(trim(fgets(STDIN)));
}
function o(...$val){
    if(count($val)==1)$val = array_shift($val);
    $trace = debug_backtrace();
    echo $trace[0]['line'].")";
    if(is_array($val)){
        if(count($val) == 0){
            echo "empty array";
        }elseif(!is_array(current($val))){
            echo "array:";
            echo implode(" ", $val)."\n";
        }else{
            echo "array:array\n";
            foreach($val as $row){
                echo implode(" ", $row)."\n";
            }
        }
    }else{
        echo $val."\n";
    }
}

Measured memory_bytes: 13176
using System;
using System.Collections.Generic;
using System.Text;

class TEST{
	static void Main(){
		int t=0;
		while(true){
			var d=int.Parse(Console.ReadLine());
			if(d==0)break;
			Sol mySol=new Sol();
			t++;
			mySol.Ans(d,t);
		}
	}
}


class Sol{
	public void Ans(int d,int Case){
		Console.WriteLine("Case {0}:",Case);
		switch(d){
			case 1:
				Console.WriteLine("  1");
				break;
			case 2:
				Console.WriteLine("  1  2");
				Console.WriteLine("  3  4");
				break;
			case 3:
				Console.WriteLine("  1  2  6");
				Console.WriteLine("  3  5  7");
				Console.WriteLine("  4  8  9");
				break;
			case 4:
				Console.WriteLine("  1  2  6  7");
				Console.WriteLine("  3  5  8 13");
				Console.WriteLine("  4  9 12 14");
				Console.WriteLine(" 10 11 15 16");
				break;
			case 5:
				Console.WriteLine("  1  2  6  7 15");
				Console.WriteLine("  3  5  8 14 16");
				Console.WriteLine("  4  9 13 17 22");
				Console.WriteLine(" 10 12 18 21 23");
				Console.WriteLine(" 11 19 20 24 25");
				break;
			case 6:
				Console.WriteLine("  1  2  6  7 15 16");
				Console.WriteLine("  3  5  8 14 17 26");
				Console.WriteLine("  4  9 13 18 25 27");
				Console.WriteLine(" 10 12 19 24 28 33");
				Console.WriteLine(" 11 20 23 29 32 34");
				Console.WriteLine(" 21 22 30 31 35 36");
				break;
			case 7:
				Console.WriteLine("  1  2  6  7 15 16 28");
				Console.WriteLine("  3  5  8 14 17 27 29");
				Console.WriteLine("  4  9 13 18 26 30 39");
				Console.WriteLine(" 10 12 19 25 31 38 40");
				Console.WriteLine(" 11 20 24 32 37 41 46");
				Console.WriteLine(" 21 23 33 36 42 45 47");
				Console.WriteLine(" 22 34 35 43 44 48 49");
				break;
			case 8:
				Console.WriteLine("  1  2  6  7 15 16 28 29");
				Console.WriteLine("  3  5  8 14 17 27 30 43");
				Console.WriteLine("  4  9 13 18 26 31 42 44");
				Console.WriteLine(" 10 12 19 25 32 41 45 54");
				Console.WriteLine(" 11 20 24 33 40 46 53 55");
				Console.WriteLine(" 21 23 34 39 47 52 56 61");
				Console.WriteLine(" 22 35 38 48 51 57 60 62");
				Console.WriteLine(" 36 37 49 50 58 59 63 64");
				break;
			case 9:
				Console.WriteLine("  1  2  6  7 15 16 28 29 45");
				Console.WriteLine("  3  5  8 14 17 27 30 44 46");
				Console.WriteLine("  4  9 13 18 26 31 43 47 60");
				Console.WriteLine(" 10 12 19 25 32 42 48 59 61");
				Console.WriteLine(" 11 20 24 33 41 49 58 62 71");
				Console.WriteLine(" 21 23 34 40 50 57 63 70 72");
				Console.WriteLine(" 22 35 39 51 56 64 69 73 78");
				Console.WriteLine(" 36 38 52 55 65 68 74 77 79");
				Console.WriteLine(" 37 53 54 66 67 75 76 80 81");
				break;
			default:
				break;
		}
	}
}
		

Measured memory_bytes: 5624
N = int(input())
S = input()

res = 0

for i in range(10):
    p1 = S.find(str(i))
    if p1 == -1:
        continue
    elif p1 > N-3:
        continue
    for j in range(10):
        p2 = S[p1+1:N].find(str(j))
        if p2 == -1:
            continue
        elif p2 > N-p1-3:
            continue
        for k in range(10):
            p3 = S[p1+p2+2:N].find(str(k))
            if p3 == -1:
                continue
            res += 1


print(res)


Measured memory_bytes: 3060
package main

import (
	"fmt"
)

func dfs(adj [][]int, visited []bool, u int) {
	for _, v := range adj[u] {
		if visited[v] {
			continue
		}
		visited[v] = true
		dfs(adj, visited, v)
	}
}

func main() {
	var n, m int
	fmt.Scan(&n, &m)
	adj := make([][]int, n)
	for i := range adj {
		line := make([]int, 0)
		adj[i] = line
	}
	for i := 0; i < m; i++ {
		var x, y, z int
		fmt.Scan(&x, &y, &z)
		adj[x-1] = append(adj[x-1], y-1)
		adj[y-1] = append(adj[y-1], x-1)
	}
	visited := make([]bool, n)

	ans := 0
	for i := 0; i < n; i++ {
		if visited[i] {
			continue
		}
		visited[i] = true
		ans++
		dfs(adj, visited, i)
	}
	fmt.Println(ans)
}


Measured memory_bytes: 37376
#include<iostream>
#include<vector>
#include<algorithm>
#include<cmath>
#include<ctime>

using namespace std;
using ll = long long;
using vint = vector<int>;

void dfs(int k, int &t, vector<vector<int> >&g, vector<int>&d, vector<int>&f){
  d[k] = t;
  for(int i = 0; i < g[k].size(); i++){
    if(d[g[k][i]] == -1) dfs(g[k][i], ++t, g, d, f);
  }
  f[k] = ++t;
}

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  int ti = clock();
  // start-----------------------------------------------
  int n; cin >> n;
  vector<vector<int> > g(n);
  vector<int> d(n, -1);
  vector<int> f(n, -1);
  for(int i = 0; i < n; i++){
    int t, k; cin >> t >> k;
    for(int j = 0; j < k; j++){
      int v; cin >> v;
      v--;
      g[i].push_back(v);
    }
  }
  int a = 0;
  for(int i = 0; i < n; i++){
    if(d[i] == -1) dfs(i, ++a, g, d, f);
  }
  for(int i = 0; i < n; i++){
    cout << i+1 << ' ' << d[i] << ' ' << f[i] << endl;
  }
  // end-----------------------------------------------
  // cerr << 1.0 * (clock() - ti) / CLOCKS_PER_SEC << endl;
}



Measured memory_bytes: 3192
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>

using namespace std;

int main(){
	ios_base::sync_with_stdio(false);
	int n, d;
	cin >> n >> d;
	vector<int> a(n);
	for(int i = 0; i < n; ++i){ cin >> a[i]; }
	int answer = 0;
	for(int i = 0; i < n; ++i){
		if(a[i] > d){ answer += a[i] - d; }
	}
	if(answer <= 0){
		cout << "kusoge" << endl;
	}else{
		cout << answer << endl;
	}
	return 0;
}

Measured memory_bytes: 3220
#include <bits/stdc++.h>
using namespace std;
int main()
{
    int n,c=0;
    cin>>n;
    string s;
    cin>>s;
    for(int j=0; j<n ;j++)
    {
        if(s[j] != s[j+1])
            c++;
    }
    cout<<c<<endl;
}


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

int main() {
  int a, b, c;
  cin >> a >> b >> c;
  if (a <= c & c <= b) cout << "Yes" << endl;
  else if (b <= c & c <= a) cout << "Yes" << endl;
  else cout << "No" << endl;
  return 0;
}

Measured memory_bytes: 3628
#include<bits/stdc++.h>
using namespace std;
#define MAX 100000
const int dx[8]={1,0,-1,0,1,-1,-1,1};
const int dy[8]={0,1,0,-1,1,1,-1,-1};

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


Measured memory_bytes: 256
# ALDS1_1_C - Prime Numbers
def is_prime(n: int) -> bool:
    """
    Evaluate prime or not.
    
    Args: n (int): an integer to be evaluted.
    Returns: (bool): prime or not.
    """
    if n == 2:
        return True
    if n == 1 or n % 2 == 0:
        return False
    for i in range(3, int(n ** 0.5) + 1, 2):
        if n % i == 0:
            return False
    return True


def main():
    A = set(map(int, open(0).read().split()))
    ans = sum(is_prime(i) for i in A)
    print(ans)


if __name__ == "__main__":
    main()


Measured memory_bytes: 7124
#include <bits/stdc++.h>
#include <vector>
#include <algorithm>
#include <iostream>
using namespace std;

int main() {
  string S;
  cin >> S;
  if (S.at(5)=='0') {
    if (S.at(6)=='1'||S.at(6)=='2'||S.at(6)=='3'||S.at(6)=='4') {
      cout << "Heisei" << endl;
    }
    else {
      cout << "TBD" << endl;
    }
  }
  else {
    cout << "TBD" << endl;
  }
}

Measured memory_bytes: 3584
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
 
using namespace std;
using namespace __gnu_pbds;
 
#define fi first
#define se second
#define mp make_pair
#define pb push_back
 
typedef long long ll;
typedef pair<int,int> ii;
typedef vector<int> vi;
typedef long double ld; 
typedef tree<ii, null_type, less<ii>, rb_tree_tag, tree_order_statistics_node_update> pbds;

int main()
{
	ios_base::sync_with_stdio(0); cin.tie(0);
	ll k,a,b; cin>>k>>a>>b;
	if(b-a>2)
	{
		if(k<=a-1)
		{
			cout<<k+1<<'\n'; return 0;
		}
		//get to a cookies
		k-=(a-1);
		ll cookies = a;
		cookies+=(k/2)*(b-a);
		if(k&1) cookies++;
		cout<<cookies<<'\n';
	}
	else
	{
		cout<<k+1<<'\n';
	}
}


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

auto main() -> int {
  std::uint64_t N, K;
  std::cin >> N >> K;

  std::string S;
  std::cin >> S;

  S[K - 1] = std::tolower(S[K - 1]);

  std::cout << S << std::endl;
}


Measured memory_bytes: 888
# -*- coding: utf-8 -*-
import sys

def main():
	n = int(input())
	
	prime_numbers = []
	ans = []
	for num in range(3, 55556):
		if num == 3: prime_numbers.append(num)
		flg = True
		for prime_number in prime_numbers:
			if num % prime_number == 0:
				flg = False
				break
		
		if flg:
			prime_numbers.append(num)
			
	for val in prime_numbers:
		if val % 5 == 1:
			ans.append(val)
			if len(ans) >= n:
				break
				
	ans2 = ""
	for x in ans:
		ans2 = ans2 + str(x) + " "
			
	print(str.strip(ans2))
		
if __name__ == "__main__":
	main()
	

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

const int inf = 1e9;
const ll linf = 1e18;

template <long long mod> class modint
{
private:
    long long x;

public:
    modint(long long x = 0) : x(x >= 0 ? x % mod : (x % mod) + mod) {}
    modint &operator+=(const modint rhs) {
        if ((x += rhs.x) >= mod) x -= mod;
        return *this;
    }
    modint &operator-=(const modint rhs) {
        if ((x += mod - rhs.x) >= mod) x -= mod;
        return *this;
    }
    modint &operator*=(const modint rhs) {
        (x *= rhs.x) %= mod;
        return *this;
    }
    modint &operator/=(const modint rhs) {
        *this *= rhs.inv();
        return *this;
    }
    modint operator+(const modint rhs) const { return modint(*this) += rhs; }
    modint operator-(const modint rhs) const { return modint(*this) -= rhs; }
    modint operator*(const modint rhs) const { return modint(*this) *= rhs; }
    modint operator/(const modint rhs) const { return modint(*this) /= rhs; }

    modint operator-() const { return modint(-x); }

    modint pow(long long n) const {
        modint e = *this, ret = modint(1);
        while (n) {
            if (n & 1) ret *= e;
            e *= e, n >>= 1;
        }
        return ret;
    }

    modint inv() const { return pow(mod - 2); }

    friend ostream &operator<<(ostream &os, const modint &m) {
        os << m.x;
        return os;
    }

    friend istream &operator>>(istream &is, modint &m) {
        long long in;
        is >> in;
        m = modint(in);
        return is;
    }
};
using mint = modint<1000000007>;

class Combination
{
private:
    vector<mint> _fact, _inv_fact;
    
public:
    Combination(int size) : _fact(size + 1), _inv_fact(size + 1) {
        _fact[0] = 1;
        for (int i = 1; i <= size; i++) _fact[i] = _fact[i-1] * i;
        _inv_fact[size] = _fact[size].inv();
        for (int i = size - 1; i >= 0; i--) _inv_fact[i] = _inv_fact[i+1] * (i+1);
    }

    mint fact(int k) const {return _fact[k];}
    mint inv_fact(int k) const {return _inv_fact[k];}

    mint P(int n, int r) {
        if (r < 0 || n < r) return 0;
        else return fact(n) * inv_fact(n - r);
    }

    mint C(int n, int r) {
        if (r < 0 || n < r) return 0;
        else return fact(n) * inv_fact(r) * inv_fact(n - r);
    }

    mint H(int n, int r) {
        if (n < 0 || r < 0) return 0;
        else return r == 0 ? 1 : C(n + r - 1, r);
    }
};

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

    int x, y; cin >> x >> y;
    
    mint ans;
    if ((x + y) % 3 != 0) {
        ans = 0;
    } else {
        int s = (x + y) / 3, t = x - y;
        int a = (s + t) / 2, b = (s - t) / 2;
        if (a >= 0 && b >= 0) {
            Combination cb(a + b);
            ans = cb.C(a + b, a);
        } else {
            ans = 0;
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 10624
a,b,k=map(int,input().split())

for i in range(k):
    if i%2==0:
        if a%2==1:
            a-=1
        b+=a//2
        a=a//2

    else:
        if b%2==1:
            b-=1
        a+=b//2
        b=b//2
        
        
print(a,b)
            

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

int main() {
  int N;
  cin >> N;
  vector<string> S(N);
  for (int i = 0; i < N; i++) {
    cin >> S.at(i);
  }
  sort(S.begin(), S.end());
  int count = 1;
  for (int i = 1; i < N; i++) {
    if (S.at(i-1) != S.at(i)) {
      count++;
    }
  }
  cout << count << endl;
}

Measured memory_bytes: 9564
#include <iostream>
#include <algorithm>
#include <vector>
#include <map>
#include <string>
#include <cmath>
#include <iomanip>
#include <numeric>
#include <cmath>
#include <set>

using namespace std;

#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define rep(i, n) FOR(i, 0, n)
#define SORT(c) sort((c).begin(), (c).end())
#define INF (ll)1e18
#define MOD (ll)1e9 + 7
#define pb push_back

typedef long long ll;
typedef long long int llt;
typedef pair<int, int> P;
typedef vector<int> V;
typedef map<int, int> M;

char dif = 'A' - 'a';

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    string a, b, c;
    cin >> a >> b >> c;
    cout << (char)(a[0] + dif) << (char)(b[0] + dif) << (char)(c[0] + dif) << endl;
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
int F[45]; //0<=n<=44

int fib(int n){
  if(F[n]!=0){
    return F[n];
  }
  else
    {
      if(n<=1)F[n]=1; //
      else{   
	F[n]=fib(n-1)+fib(n-2); 
      }
      return F[n];
    }
}

int main(void){
  int n;
  scanf("%d",&n);
  printf("%d\n",fib(n));
  return 0;
}

Measured memory_bytes: 596
/*---------------------------------
 *File name: B.cpp
 *Creation date: 2020-05-31 20:00
 *-------------------------------*/
#include<set>
#include<map>
#include<cmath>
#include<queue>
#include<vector>
#include<cstdio>
#include<string>
#include<cstring>
#include<iostream>
#include<algorithm>
#define fi first
#define se second
#define pb push_back
#define LL long long
#define PII pair<int, int>
#define Pque priority_queue 
#define loop(c, a, b) for(int c = a; c <= b; ++c)
using namespace std;
const LL maxn = 1e18;
const int inf = 0x3f3f3f3f;
const LL mod = 1e18 + 1;


int main(){
	int n;
	cin >> n;
	vector<LL> a(n + 1);
	bool flag = 0;
	int ans = 0;
	for(int i = 1; i <= n; ++i){
		scanf("%lld", &a[i]);
		if(a[i] == 0) flag = 1;
	}
	LL pre = a[1];
	for(int i = 2; i <= n && !flag; ++i){
		//printf("%lld\n", pre * a[i]);
		if(pre * a[i] < pre || pre * a[i] > maxn) ans = -1;
		pre = pre * a[i];
	}
	if(flag) printf("0\n");
	else{
		if(ans == -1) cout << ans << endl;
		else cout << pre << endl;
	}
	return 0;
}

Measured memory_bytes: 3680
#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <cmath>
#include <map>
#include <cstdlib>
using namespace std;
using ll = long long int;

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

    ll A[N];
    for (int i = 0; i < N; i++) {cin >> A[i];}

    sort(A,A+N);

    ll small = 0;
    ll big = 0;
    if (N % 2 == 0) {
        for (int i = 0; i < N/2; i++) small += A[i];
        small *= 2;
        small -= A[N/2 - 1];
        for (int i = N/2; i < N; i++) big += A[i];
        big *= 2;
        big -= A[N/2];

        cout << big - small << endl;
    }
    else {
        for (int i = 0; i < N/2; i++) small += A[i];
        small *= 2;
        for (int i = N/2; i < N; i++) big += A[i];
        big *= 2;
        big -= A[N/2]+A[N/2+1];
        ll ans1 = big - small;

        small = 0;
        big = 0;
        for (int i = 0; i <= N/2; i++) small += A[i];
        small *= 2;
        small -= A[N/2 - 1] + A[N/2];
        for (int i = N/2+1; i < N; i++) big += A[i];
        big *= 2;
        ll ans2 = big - small;

        cout << max(ans1,ans2) << endl;
    }
}


Measured memory_bytes: 1024
#include <iostream>
#include <string>
#include <sstream>
#include <iomanip> 
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <queue>
#include <stack>
#include <vector>
#include <map>
#include <set>
#include <functional>
#include <algorithm>
#include <unordered_map>
#include <unordered_set>
#include <bitset>

using namespace std;


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

	string s;
	int n, i, j, k, x, y, OFF = 8100, NN = OFF * 2, id, c;
	cin >> s >> x >> y;
	vector<vector<int>> slist(2);

	id = 0;
	c = 0;
	s = s + "T";
	n = s.length();
	for (auto ch : s) {
		if (ch == 'T') {
			slist[id].push_back(c);
			c = 0;
			id = 1 - id;
		}
		else c++;
	}

	bool solved = true;
	vector<bool> v(NN, false), vv(NN);
	
	// x 
	v.assign(NN, false);
	if (slist[0].empty()) slist[0].push_back(0);
	v[slist[0][0] + OFF] = true;
	for (i = 1; i < slist[0].size(); i++) {
		vv.assign(NN, false);
		for (j = 0; j < NN; j++) {
			if (v[j]) {
				vv[j + slist[0][i]] = true;
				vv[j - slist[0][i]] = true;
			}
		}
		swap(vv, v);
	}
	if (!v[x + OFF]) solved = false;

	// y 
	v.assign(NN, false);
	v[0 + OFF] = true;
	for (i = 0; i < slist[1].size(); i++) {
		vv.assign(NN, false);
		for (j = 0; j < NN; j++) {
			if (v[j]) {
				vv[j + slist[1][i]] = true;
				vv[j - slist[1][i]] = true;
			}
		}
		swap(vv, v);
	}
	if (!v[y + OFF]) solved = false;

	if (solved) cout << "Yes\n";
	else cout << "No\n";

	return 0;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repr(i, n) for (int i = (int)(n); i >= 0; i--)
#define REP(i, m, n) for (int i = (int)(m); i <= (int)(n); i++)
#define all(v) v.begin(), v.end()
typedef long long ll;

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

const long long INF = 1LL << 60;
#define N 3

int main(){
  int a[N][N];
  rep(i, N) rep(j, N) cin >> a[i][j];

  int n; cin >> n;
  bool open[N][N];
  rep(i, N) rep(j, N) open[i][j] = false;
  rep(k, n){
    int b; cin >> b;
    rep(i, N) rep(j, N){
      if(a[i][j] == b) open[i][j] = true;
    }
  }

  bool ok = false;
  if(open[0][0] && open[0][1] && open[0][2]) ok = true;
  if(open[1][0] && open[1][1] && open[1][2]) ok = true;
  if(open[2][0] && open[2][1] && open[2][2]) ok = true;
  if(open[0][0] && open[1][0] && open[2][0]) ok = true;
  if(open[0][1] && open[1][1] && open[2][1]) ok = true;
  if(open[0][2] && open[1][2] && open[2][2]) ok = true;
  if(open[0][0] && open[1][1] && open[2][2]) ok = true;
  if(open[0][2] && open[1][1] && open[2][0]) ok = true;

  cout << (ok ? "Yes" : "No") << endl;

// bool ok;
// rep(i, N){
//   ok = true;
//   rep(j, N) if(!open[i][j]) ok = false;
//   if(ok){ cout << "Yes" << endl; return 0; }
// }
// rep(j, N){
//   ok = true;
//   rep(i, N) if(!open[i][j]) ok = false;
//   if(ok){ out << "Yes" << endl; return 0; }
// }
// ok = true;
// rep(i, N) rep(j, N) if(i == j){
//   if(!open[i][j]) ok = false;
// }
// if(ok){ cout << "Yes" << endl; return 0; }
//
// ok = true;
// rep(i, N) rep(j, N) if(i+j == N-1){
//   if(!open[i][j]) ok = false;
// }
// if(ok){ cout << "Yes" << endl; return 0; }
//
// cout << "No" << endl;
//
  return 0;
}


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

int main(){
	int N, D; cin >> N >> D;
	int d[N+1], ans[N+1], ma[N+1], pos[N+1];
	pos[0] = D, ma[N] = 0;
	rep(i, N){
		cin >> d[i+1];
		pos[i+1] = min(pos[i], abs(pos[i] - d[i+1]));
	}
	for(int i=N; i>0; i--){
		if(i == N) ma[i-1] = ((d[i]==1)?1:0);
		else ma[i-1] = ma[i] + ((d[i]/2>ma[i])?0:d[i]);
		ans[i] = (pos[i-1] > ma[i]);
	}
	int Q; cin >> Q;
	rep(i, Q){
		int q; cin >> q;
		cout << ((ans[q])?"YES":"NO") << '\n';
	}
	return 0;
}


Measured memory_bytes: 11332
n = int(input())
lb = [int(w) for w in input().split()]

ans = 0

if n - 1 == 1:
    ans = lb[0]*2
else:
    ans += lb[0]
    for i in range(n - 2):
        ans += min(lb[i:i + 2])
    ans += lb[n - 2]

print(ans)


Measured memory_bytes: 9116
#include <iostream>
#include <vector>
#include <map>
#include <math.h>
#include <algorithm>

using namespace std;
using ll = long long;
const int NMAX = 50;
bool graph[NMAX][NMAX];

int dfs(int v, int N, bool visited[NMAX]); 

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

	for (int i = 0; i < M; i++) {
		int a,b;
		cin >> a >> b;
		graph[a - 1][b - 1] = true;
		graph[b - 1][a - 1] = true;
	}

	int ans = 0;
	bool visited[NMAX];
	for (int i = 0; i < N; i++) {
		visited[i] = false;
	}
	visited[0] = true;

	for (int i = 0; i < N; i++) {
		for (int j = i; j < N; j++) {
			if (graph[i][j]) {
				graph[i][j] = false;
				graph[j][i] = false;
				if (!dfs(0,N,visited)) {
					ans++;
				}
				for (int i = 0; i < N; i++) {
					visited[i] = false;
				}
				visited[0] = true;
				graph[i][j] = true;
				graph[j][i] = true;
			}
		}
	}
	cout << ans << endl;
	return 0;
}

int dfs(int v, int N, bool visited[NMAX]) {

	bool all_visited = true;
	for (int i = 0; i < N; i++) {
		if (visited[i] == false) {
			all_visited = false;
		}
	}

	if (all_visited) {
		return true;
	}

	bool ret = false;

	for (int i = 0; i < N; i++) {
		if (graph[v][i] && !visited[i]) {
			visited[i] = true;
			ret = dfs(i,N,visited);
		}
	}

	return ret;

}


Measured memory_bytes: 512
//OPTIMIZATONS
#pragma GCC optimize("02")
//CODE
#include<bits/stdc++.h>
#define int long long
#define float double
#define endl "\n"
#define debug cout<<"Good uptill here"<<endl<<flush;
#define deb(x) cout<<#x<<":"<<x<<endl<<flush;

using namespace std;

int32_t main(){
	ios_base::sync_with_stdio(false);
	cin.tie(nullptr);
	cout.tie(nullptr);
	//CODE FOR SPECIFIED INPUT AND OUTPUT
	//freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);
	int n;
	cin>>n;
	int cur = 100;
	int cnt = 0;
	while(cur<n){
		cnt++;
		cur = cur + (cur/100);
	}
	cout<<cnt<<endl;
	return 0;
}



Measured memory_bytes: 3636
#include<stdio.h>
#include<iostream>
#include<algorithm>
#include<string>
#include<string.h>
#include<math.h>
#include<stdlib.h>
#include<vector>
#include<queue>
#define rep(index,num) for(int index=0;index<num;index++)
#define scan(argument) cin>>argument
#define prin(argument) cout<<argument<<endl
#define kaigyo cout<<endl
#define eps 1e-15
typedef long long ll;
using namespace std;
int main(){
	string komoji="abcdefghijklmnopqrstuvwxyz";
	string S;
	scan(S);
	int Cpos1=S.find('C');
	int Cpos2=S.rfind('C');
	int flag=1;
	if(S[0]=='A'&&Cpos1==Cpos2&&Cpos1>=2&&Cpos1<=S.size()-2){
		for(int i=1;i<S.size();i++){
			if(i==Cpos1) continue;
			if(komoji.find(S[i])>=0&&komoji.find(S[i])<26) continue;
			else{
				flag=0;
				break;
			}
		}
	}
	else{
		flag=0;
	}
	if(flag) prin("AC");
	else prin("WA");
	return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <cmath>
using namespace std;
#define int long long
signed main(){
    int t; scanf("%d",&t);
    int k=t%10;
    if(k==3){
        printf("bon\n");
    }else if(k==2||k==4||k==5||k==7||k==9){
        printf("hon\n");
    }else if(k==0||k==1||k==6||k==8){
        printf("pon\n");
    }
    return 0;
}


Measured memory_bytes: 3200
#include <stdio.h>
#include <algorithm>
#include <iostream>

using namespace std;

class Heap{
public:
	Heap(){
		array = new int[2000000];
		n = 0;
	}
	void insert(int data){
		array[n] = data;
		int tmp = n;
		while(tmp != 0 && array[tmp] > array[(tmp-1)/2]){
			std::swap(array[tmp], array[(tmp-1)/2]);
			tmp = (tmp-1)/2;
		}
		n++;
	}
	int extract(){
		int ret = array[0];
		n--;
		std::swap(array[0],array[n]);
		int tmp = 0;
		while(2*tmp+1 <= n-1){
			if(2*tmp+2 <= n-1){
				if(array[2*tmp+2] > array[tmp] && array[2*tmp+2] >= array[2*tmp+1]){
					std::swap(array[2*tmp+2],array[tmp]);
					tmp = 2*tmp+2;
				}else if(array[2*tmp+1] > array[tmp] && array[2*tmp+1] >= array[2*tmp+2]){
					std::swap(array[2*tmp+1],array[tmp]);
					tmp = 2*tmp+1;
				}else{
					break;
				}
			}else{
				if(array[tmp] < array[2*tmp+1]){
					std::swap(array[tmp],array[2*tmp+1]);
					tmp = 2*tmp+1;
				}else{
					break;
				}
			}
		}
		return ret;
	}

private:
	int* array;
	int n;
};

int main(){

	int insert_data;
	char buf[22];
	Heap heap;

	while(true){
		fgets(buf,22,stdin);
		if(buf[2] == 'd') break;
		if(buf[0] == 'i'){
			insert_data = 0;
			for(int i = 0; buf[i] != '\0';i++){
				if(buf[i] >= '0' && buf[i] <= '9'){
					insert_data = 10*insert_data + (buf[i] - '0');
				}
			}
			heap.insert(insert_data);
		}else{
			printf("%d\n",heap.extract());
		}
	}
}


Measured memory_bytes: 7020
#include <iostream>
#include <algorithm>
#include <vector>
#include <math.h>

int main () {
  std::vector<int> sa(3);
  int a,b,c;
  std::cin >> a >> b >> c;
  sa[0] = std::abs(a-b);
  sa[1] = std::abs(a-c);
  sa[2] = std::abs(c-b);
  std::sort(sa.begin(), sa.end());
  std::cout << sa[0] + sa[1] << std::endl;
}


Measured memory_bytes: 256
package main

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

var sc = bufio.NewScanner(os.Stdin)

func readLine() string {
	sc.Scan()
	return sc.Text()
}

func main() {
	var N, sum int

	N, _ = strconv.Atoi(readLine())
	sum = 0

	for i := 1; i <= N; i++ {
		if i%3 != 0 && i%5 != 0 {
			sum += i
		}
	}

	fmt.Println(sum)
}


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

#define int long long
#define rep(i,n) for(int i=0;i<(n);i++)
#define repf(i,j,n) for(int i=(j);i<(n);i++)
#define repe(i,j,n) for(int i=(j);i<=(n);i++)

int fibary[20];
int dp[10][110];
int mod=1e9+7;

int fib(int a){
	if(a<=0)return 1;
	if (fibary[a]>0)return fibary[a];
	else return fibary[a]=fib(a-1)+fib(a-2);
}

signed main(){
	int h,w,k;cin>>h>>w>>k;	
	fill(fibary,fibary+10,-1);
	fibary[0]=1;fibary[1]=1;
	
	fill(dp[0],dp[10],0);
	dp[0][0]=1;
		
	rep(j,h+1)rep(i,w){
	(dp[i][j+1]+=dp[i][j]*fib(w-i-1)*fib(i))%=mod;
	if(i>0)(dp[i][j+1]+=dp[i-1][j]*fib(w-i-1)*fib(i-1))%=mod;
	if(i<w-1)(dp[i][j+1]+=dp[i+1][j]*fib(w-i-2)*fib(i))%=mod;
	}

	cout<<dp[k-1][h]<<endl;
//  	rep(i,h+1)rep(j,w)cout<<dp[j][i]<<" ";
}


Measured memory_bytes: 256
#include <cmath>
#include <iostream>
#include <vector>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <stack>
#include <tuple>
#include <bitset>
#include <algorithm>
#include <functional>
#include <utility>
#include <iomanip>

#define int long long int
#define rep(i, n) for(int i = 0; i < (n); ++i)
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) ((int)(x).size())
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() )

using namespace std;

typedef pair<int, int> P;

const int INF = 1e15;
const int MOD = 1e9+7;

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

    int n;
    cin >> n;

    vector<int> a(n);
    rep(i, n) cin >> a[i];

    int maxi = 0;
    rep(i, n){
        if(a[maxi] < a[i]){
            maxi = i;
        }
    }

    if(a[maxi] <= 0){
        cout << a[maxi] << endl;
        cout << n - 1 << endl;
        for(int i = n; i > maxi + 1; i--){
            cout << i << endl;
        }
        rep(i, maxi){
            cout << 1 << endl;
        }
        return 0;
    }

    int odd = 0, even = 0;
    rep(i, n){
        if(i % 2 == 0){
            if(a[i] > 0){
                even += a[i];
            }
        }else{
            if(a[i] > 0){
                odd += a[i];
            }
        }
    }

    vector<bool> need(n, false);
    for(int i = even > odd ? 0 : 1; i < n; i += 2){
        if(a[i] > 0){
            need[i] = true;
        }
    }

    vector<int> ans;
    int last = n-1;
    while(last >= 0 && not need[last]){
        ans.push_back(last+1);
        last--;
    }

    int head = 0;
    while(head < n && not need[head]){
        ans.push_back(1);
        head++;
    }

    int idx = 2;
    for(int i = head + 2; i <= last; i += 2){
        if(need[i]){
            ans.push_back(idx);
            continue;
        }
        ans.push_back(idx + 1);
    }

    cout << max(even, odd) << endl;
    cout << SZ(ans) << endl;
    for(int x : ans){
        cout << x << endl;
    }

    return 0;
}


Measured memory_bytes: 888
#include <bits/stdc++.h>
#define int unsigned long long
using namespace std;

int l,r;

int get_xor(int n)
{
	if (n%4==1)  return 1;
	else if (n%4==2)  return n+1;
	else if (n%4==3)  return 0;
	else return n;
}

int Xor(int n,int m)
{
	int pos=1,len1=0,len2=0,ans=0;
	int a[105]={0},b[105]={0};
	
	while (n!=0)  a[++len1]=n%2,n/=2;
	while (m!=0)  b[++len2]=m%2,m/=2;
	
	len1=max(len1,len2);
	len2=max(len1,len2);
	
	for (int i=1;i<=len1/2;i++)  swap(a[i],a[len1+1-i]);
	for (int i=1;i<=len2/2;i++)  swap(b[i],b[len2+1-i]);
	
	for (int i=max(len1,len2);i>=1;i--)
	{
		if (a[i]!=b[i])  ans+=pos;
		pos*=2;
	}
	return ans;
}

signed main()
{
	cin>>l>>r; 
	cout<<Xor(get_xor(l-1),get_xor(r))<<endl;
	
	return 0;
}

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

A.sort()
B.sort()
C.sort()

def bin_serch(array,num):
    head = 0
    tail = len(array)
    while head < tail:
        center = (head + tail) // 2
        if num < array[center]:
            tail = center
        else:
            head = center + 1
    return head

BC = [0 for _ in range(len(B))]
for i in range(len(B)):
    BC[i] = len(C) - bin_serch(C,B[i])
    
s = 0
for i in range(len(BC)-1, -1, -1):
    s += BC[i]
    BC[i] = s

ans = 0
for a in A:
    b = bin_serch(B,a)
    if b < len(B):
        ans += BC[b]
    
print(ans)

Measured memory_bytes: 29356
#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,k;
  cin>>n>>k;
  int h[100005];
  rep(i,n) cin>>h[i];
  sort(h,h+n);
  int ans=1e9;
  for(int i=0; i+k-1<=n-1; i++){
    ans=min(ans,h[i+k-1]-h[i]);
  }
  cout<<ans<<endl;
  return 0;
}



Measured memory_bytes: 640