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

namespace ABC
{
    class ProgramB
    {
        static void Main(string[] args)
        {
            var inputs = Console.ReadLine().Split(" ");
            var a = long.Parse(inputs[0]);
            var b = long.Parse(inputs[1]);
            var c = long.Parse(inputs[2]);

            var k = long.Parse(Console.ReadLine());

            var result = 0;

            while (a >= b)
            {
                b *= 2;
                result++;
            }

            while (b >= c)
            {
                c *= 2;
                result++;
            }

            Console.WriteLine(result <= k ? "Yes" : "No");
        }
    }
}


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

int main() {
    int n;
    cin >> n;
    vector<int> V(n);
    for(int i=0; i<n; i++) cin >> V[i];
    int sum = 0;
    for(int i=0; i<n; i++) {
        sum += V[i] - 1;
    }
    cout << sum << endl;
}

Measured memory_bytes: 3608
extern crate core;

use std::io::{self, Read};

#[macro_export]
macro_rules! input {
  ($s:expr=>$($t:tt)*) => {
    let mut lines=$s.split("\n");
    $(
        line_parse!(lines,$t);
    )*
  };
}

macro_rules! line_parse {
  ($lines:expr,($($name:ident:$t:tt)*)) => {
    let mut line=$lines.next().unwrap().split_whitespace();
    $(value_def!(line,$name,$t);)*
  };

  //複数行
  ($lines:expr,{$n:expr;$name:ident:$t:tt}) => {
    values_def!($lines,$n,$name,$t);
  };
}

macro_rules! value_def {
  ($line:expr, $name:ident, $t:tt) => {
    let $name = value!($line, $t);
  };
}

macro_rules! values_def {
  ($lines:expr, $n:expr, $name:ident, $t:tt) => {
    let $name = {
      let mut vec = Vec::new();
      for i in 0..$n {
        let mut next = $lines.next().unwrap().split_whitespace();
        vec.push(value!(next, $t));
      }
      vec
    };
  };
}

macro_rules! value {
  //配列
  ($line:expr,[$t:tt]) => {
    $line.map(|x|{
      let mut iter=::std::iter::once(x);
      value!(iter,$t)
    }).collect::<Vec<_>>()
  };
  //タプル
  ($line:expr,($($t:tt),*)) => {
    ($(value!($line,$t),)*)
  };
  //文字列
  ($line:expr,#) => {
    $line.next().unwrap()
  };
  //インデックス(-1)
  ($line:expr,@) => {
    $line.next().unwrap().parse::<usize>().unwrap()-1
  };
  //単一値
  ($line:expr,$t:ty) => {
    $line.next().unwrap().parse::<$t>().unwrap()
  };
}

fn main() {
  let mut input = String::new();
  io::stdin().read_to_string(&mut input).unwrap();
  let output = solve(input.trim().to_string());
  println!("{}", output);
}

fn solve(input: String) -> String {
  input!(input=>(n:usize m:usize){n;list:(usize,[@])});
  let mut check = Vec::with_capacity(m);
  check.resize(m, true);
  for (_, list) in list {
    let mut check2 = Vec::with_capacity(m);
    check2.resize(m, false);
    for x in list {
      check2[x] = true;
    }
    for i in 0..m {
      check[i] &= check2[i];
    }
  }

  check.into_iter().filter(|&x| x).count().to_string()
}

macro_rules! tests {
    ($($name:ident: $input:expr=>$output:expr,)*) => {
        mod tests {
            $(
                #[test]
                fn $name() {
                    assert_eq!($output.trim().to_string(),super::solve($input.trim().to_string()));
                }
            )*
        }
    }
}

tests! {
    test1: "3 4\n2 1 3\n3 1 2 3\n2 3 2\n" => "1\n",
    test2: "5 5\n4 2 3 4 5\n4 1 3 4 5\n4 1 2 4 5\n4 1 2 3 5\n4 1 2 3 4\n" => "0\n",
    test3: "1 30\n3 5 10 30\n" => "3\n",
}


Measured memory_bytes: 4352
#pragma warning(disable: 4996)
#include<stdio.h>

int a, b;

int main() {
	scanf("%d %d",&a,&b);
	if (a > b) {
		printf("a > b\n");
	}
	else if (a < b) {
		printf("a < b\n");
	}
	else {
		printf("a == b\n");
	}

	return 0;
}


Measured memory_bytes: 2072
#include <bits/stdc++.h>
using namespace std;
 
#define ll long long
#define mod 1000000007
 
// int ans(){
    
// }
 
int main() {
	ll n;
    cin>>n;
    ll a[n],sum=0;
    for(int i=0;i<n;i++){
        cin>>a[i];
        sum=sum+a[i];
    }
    ll ans=0;
    for(int i=0;i<n;i++){
        sum-=a[i];
        ans=ans%mod + ((a[i]%mod)*((sum)%mod))%mod;
    }
    cout<<(ans%mod);
}

Measured memory_bytes: 5140
n, a, b = map(int, input().split())
if abs(a - b) % 2 == 0:
    ans = abs(a - b) // 2
else:
    if abs(a - 1) > abs(n - b):
        a, b = n + 1 - b, n + 1 - a
    b -= a
    ans = abs(b - 1) // 2 + a
print(ans)

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i=0; i<n; i++)
#define pb push_back
#define int long long
typedef tuple<int, int, int> T;
typedef pair<int, T> P;
int dx[4] = {-1, 0, 1, 0};
int dy[4] = {0, 1, 0, -1};

int H, W, K, sx, sy, gx, gy;
vector<string> c;

int dijkstra() {
    int dist[H][W][4];
    rep(i, H) rep(j, W) rep(k, 4) dist[i][j][k] = 1000000000;
    priority_queue<P, vector<P>, greater<P>> pq;
    rep(i, 4) {
        dist[sx-1][sy-1][i] = 0;
        pq.push(P(0, make_tuple(sx-1, sy-1, i)));
    }
    while (pq.size()) {
        P p = pq.top(); pq.pop();
        int d = p.first;
        int x = get<0>(p.second), y = get<1>(p.second), di = get<2>(p.second);
        rep(i, 4) if (dist[x][y][i]>(d+K-1)/K*K) {
            dist[x][y][i] = (d+K-1)/K*K;
            pq.push(P(dist[x][y][i], make_tuple(x, y, i)));
        }
        int nx = x+dx[di], ny = y+dy[di];
        if (0<=nx && nx<H && 0<=ny && ny<W && c[nx][ny]!='@' && dist[nx][ny][di]>d+1) {
            dist[nx][ny][di] = d+1;
            pq.push(P(dist[nx][ny][di], make_tuple(nx, ny, di)));
        }
    }
    int res = 1000000000;
    rep(i, 4) res = min(res, dist[gx-1][gy-1][i]);
    if (res==1000000000) return -1;
    return (res+K-1)/K;
}
 
signed main() {
    cin.tie(0); ios::sync_with_stdio(false);
    cin >> H >> W >> K;
    cin >> sx >> sy >> gx >> gy;
    rep(i, H) {
        string s; cin >> s;
        c.pb(s);
    }
    cout << dijkstra() << endl;
}

Measured memory_bytes: 51972
num = gets.to_i
ary = gets.split.map(&:to_i)

count = 0

for i in 0 .. num-2

  min = ary[i]
  min_index = i

  for j in i .. num-1

    if min > ary[j]
      min = ary[j]
      min_index = j
    end
  end

  if ary[i] != ary[min_index]
    ary[i], ary[min_index] = ary[min_index], ary[i]
    count += 1
  end
end

(num-1).times{ |j| print "#{ary[j]} "}
print "#{ary[-1]}\n"
puts count



Measured memory_bytes: 6868
//
//  one_percent.cpp
//  learningCplusplus
//
//  Created by Tran Duc Chinh on 2020/04/04.
//  Copyright © 2020 Tran Duc Chinh. All rights reserved.
//

#include <iostream>
#include <queue>
#include <math.h>
using namespace std;
typedef long long ll;
ll mod = 1000000007;
#define PI 3.14159265

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

  long double x;
  std::cin >> x;

  int n = ceil((long double)log((long double)(x/100)) / (long double)log((long double)1.01));

  int year = 0;
  ll money = 100;
  for (int i = 1; i < 2*n; i++) {
    money += money / 100;
    if (money >= x) {
      year = i;
      break;
    }
  }
  std::cout << year << std::endl;
  return 0;
}


Measured memory_bytes: 3812
#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin>>n;
  int a[n];
  for (int i = 0; i < n; i++) {
    cin>>a[i];
  }
  if (n%2) {
    for (int i = n-1; i+1; i--) {
      if (!(i%2)) {
        cout<<a[i]<<' ';
      }
    }
    for (int i = 0; i < n; i++) {
      if (i%2) {
        cout<<a[i]<<' ';
      }
    }
  } else {
    for (int i = n-1; i+1; i--) {
      if (i%2) {
        cout<<a[i]<<' ';
      }
    }
    for (int i = 0; i < n; i++) {
      if (!(i%2)) {
        cout<<a[i]<<' ';
      }
    }
  }
}

Measured memory_bytes: 4388
// inputに入力データ全体が入る
function Main(input) {
	// 1行目がinput[0], 2行目がinput[1], …に入る
  input = input.split("\n")
  tmp0 = input[0].split(" ")
  A = Number(tmp0[0])
  B = Number(tmp0[1])
  C = Number(tmp0[2])

  console.log(Math.min(Math.floor(B/A), C))

}
//*この行以降は編集しないでください（標準入出力から一度に読み込み、Mainを呼び出します）
Main(require("fs").readFileSync("/dev/stdin", "utf8"));
// Main("100 1 10\n")

Measured memory_bytes: 21064
#include <bits/stdc++.h>
    using namespace std;
    #define lmax LLONG_MAX
    #define lmin LLONG_MIN
    #define imax INT_MAX
    #define imin INT_MIN
    #define f(i,a,b) for(long long i=a;i<b;i++)
    #define tc long long t;cin>>t;while(t--)
    #define pb push_back
    #define mp make_pair
    #define gcd __gcd
    #define F first
    #define S second
    #define input(a,n) for(ll i=0;i<n;i++) cin>>a[i];
    #define output(a,n) for(ll i=0;i<n;i++) cout<<a[i]<<" ";
    #define up upper_bound
    #define lo lower_bound
    #define endl "\n"
    #define mem(a) memset(a,-1,sizeof(a))
    #define ll long long
    #define umap unordered_map

    int main(){
        #ifndef ONLINE_JUDGE
        freopen("input.txt", "r", stdin);
        freopen("output.txt", "w", stdout);
        #endif
        
        ll n,x,t;
        cin>>n>>x>>t;

        if(n%x==0) cout<<t*(n/x);
        else cout<<t*((n/x)+1);

        return 0;
    }

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

#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define REPl(i, n) for (ll i = 0; i < (ll)(n); i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define REPRl(i, n) for(ll i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < (int)n; i++)
#define FORl(i, m, n) for(ll i = m; i < (ll)n; i++)
#define ALL(v) v.begin(), v.end()
ll gcd(ll a,ll b) {
  return b? gcd(b,a%b): a;  
}
ll lcm(ll a,ll b) {
  return a*b/gcd(a,b);
}
bool isLowerCase(char c){
  return (c>='a'&&c<='z');
}
int main() {
  int a,b,c;cin>>a>>b>>c;
  int d,e,f;
  d=(a>b)?a-b:b-a;
  e=(a>c)?a-c:c-a;
  f=(c>b)?c-b:b-c;
  int m=max(d,max(e,f));
  int ans;
  if(m==d){
    ans=e+f;
  }else if(m==e){
    ans=d+f;
  }else if(m==f){
    ans=d+e;
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
#include <iostream>

using namespace std;

// 格桁の和を計算する関数
int findSumOfDigits(int n){
  int sum = 0;
  while (n>0){
    sum += n % 10;
    n /= 10;
  }
  return sum;
}

int main() {
  // input
  int N, A, B;
  cin >> N >> A >> B;

  // solve
  int total = 0;
  for (int i=0; i<=N; i++){
    int sum = findSumOfDigits(i);
    if (sum >= A && sum <= B){
      total += i;
    }
  }
  cout << total << endl;
  return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <cstdio>
#include <iostream>
#include <map>
#include <cmath>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
#include <stdlib.h>
#include <stdio.h>
#include <bitset>
#include <cstring>
#include <deque>
using namespace std;
#define FOR(I,A,B) for(int I = (A); I < (B); ++I)
#define CLR(mat) memset(mat, 0, sizeof(mat))
typedef long long ll;
int main()
{
  ios::sync_with_stdio(false);
  cin.tie(0);
  ll K; cin >> K;
  ll A[K]; FOR(i,0,K) cin >> A[i];
  ll x = 2;
  ll y = 3;
  for(int i = K - 1; i >= 0; i--) {
    // 最小
    x = (x + A[i] - 1) / A[i] * A[i];


    // 最大
    y = (y / A[i] + 1) * A[i] - 1;
  }
  ll ans = x;
  FOR(i,0,K) {
    x = x / A[i] * A[i];
  }
  if(x == 2) {
    cout << ans << " " << y << endl;
  } else {
    cout << -1 << endl;
  }
  return 0;
}

Measured memory_bytes: 1024
// B - Counting of Trees
#include <bits/stdc++.h>
using namespace std;
#define rp(i,s,e) for(int i=(s);i<(e);++i)
#define MOD 998244353

int main(){
	int N; cin>>N;
	vector<int> C(N);
	int ans = 1;
	rp(i, 0, N){
		int d; scanf("%d",&d);
		if((i==0 && d!=0) || (i>0 && d<=0)) ans = 0;
		C[d]++;
	}
	rp(d, 2, N) rp(i, 0, C[d]) ans  = (long long)ans * C[d-1] % MOD;
	cout<< ans <<endl;
}

Measured memory_bytes: 640
#include <stdio.h>

int main()
{
	int a, b, c, d, n, count;
	
	while (scanf("%d", &n) != EOF){
		count = 0;
		for (a = 0; a <= 9; a++){
			for (b = 0; b <= 9; b++){
				for (c = 0; c <= 9; c++){
					for (d = 0; d <= 9; d++){
						if (a + b + c + d == n){
							count++;
						}
					}
				}
			}
		}
		
		printf("%d\n", count);
	}
	
	return (0);
}

Measured memory_bytes: 592
#include <cstdio>

int main(){
	char c;
	while(scanf("%c",&c)!= EOF){
		if(c >= 'a' && c <= 'z'){
			c = c-32;
		}else if(c >= 'A' && c<='Z'){
			c = c+32;
		}
		printf("%c", c);
	}
}


Measured memory_bytes: 2604
#include <algorithm>
#include <iostream>
#include <set>
#include <string>
#include <utility>
#include <vector>

const long long M = 1000000000 + 7;

int main() {
  int n, x;
  std::cin >> n >> x;
  std::vector<int> s(n);
  for (auto &a : s)
    std::cin >> a;
  std::sort(s.begin(), s.end());

  long long f[x + 1];
  for (int xi = 0; xi <= x; ++xi) {
    f[xi] = xi;
  }
  for (int ni = 0; ni < n; ++ni) {
    long long next[x + 1];
    for (int xi = 0; xi <= x; ++xi) {
      next[xi] = (f[xi % s[ni]] + f[xi] * ni) % M;
    }
    for (int xi = 0; xi <= x; ++xi) {
      f[xi] = next[xi];
    }
  }
  std::cout << f[x] << std::endl;
  return 0;
}

Measured memory_bytes: 1792
# -*- coding: utf-8 -*-
"""
Created on Wed Feb 22 16:06:57 2017

@author: 0048005387
"""

h, w = map(int, raw_input().split())
c=[]

for i in range(h):
    c.append(map(str, raw_input().split()))
    
for i in c:
    for j in i:
        print j
    for j in i:
        print j


Measured memory_bytes: 2568
#include <iostream>
#include <string>
#include <vector>

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

using namespace std;

/*
	tar: even
		d_1 = 1, d_{i} = 2^{i-2} (2<=i<=m)
	find s_i in {+1, -1} s.t. s_1 d_1 + ... + s_m d_m = tar
*/
string solve2(int tar,int m){
	if(tar<0){
		string s=solve2(-tar,m);
		for(char &c:s) c=(c=='+')?'-':'+';
		return s;
	}

	if(m==2){
		if(tar==0) return "+-";
		else       return "++";
	}

	return solve2(tar-(1<<(m-2)),m-1)+"+";
}

/*
	tar: even
		m = 32
		d_1 = 1, d_{i} = 2^{i-2} (2<=i<=32)
	tar: odd
		m = 33
		d_1 = 1, d_{i} = 2^{i-2} (2<=i<=32), d_{33} = 1
	find s_i in {+1, -1} s.t. s_1 d_1 + ... + s_m d_m = tar
*/
string solve(int tar){
	if(tar%2!=0) return solve(tar-1)+"+";
	return solve2(tar,32);
}

int main(){
	int n; cin>>n;
	vector<int> x(n),y(n);
	rep(i,n) cin>>x[i]>>y[i];

	int par=((x[0]+y[0])%2+2)%2;
	rep(i,n) if(((x[i]+y[i])%2+2)%2!=par) {
		cout<<"-1"<<endl;
		return 0;
	}

	vector<int> d(1,1);
	rep(i,31) d.emplace_back(1<<i);
	if(par==1) d.emplace_back(1);

	int m=d.size();
	cout<<m<<endl;
	rep(i,m) cout<<d[i]<<' ';
	cout<<endl;

	rep(i,n){
		int u=x[i]+y[i]; // super clever!!
		int v=x[i]-y[i];

		string s1=solve(u);
		string s2=solve(v);

		string ans;
		rep(j,m){
			if     (s1[j]=='+' && s2[j]=='+') ans+='R';
			else if(s1[j]=='+' && s2[j]=='-') ans+='U';
			else if(s1[j]=='-' && s2[j]=='+') ans+='D';
			else if(s1[j]=='-' && s2[j]=='-') ans+='L';
		}
		cout<<ans<<endl;
	}

	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <map>
#include <queue>
#include <utility>

#define REP(i, a, b) for (int i = int(a); i < int(b); i++)
#define dump(val) cerr << __LINE__ << ":\t" << #val << " = " << (val) << endl

using namespace std;

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

template<typename T>
vector<T> make_v(size_t a, T b) {
    return vector<T>(a, b);
}

template<typename... Ts>
auto make_v(size_t a, Ts... ts) {
    return vector<decltype(make_v(ts...))>(a, make_v(ts...));
}

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    map<string, int> mp;
    queue<P> q;
    q.emplace("01234567", 0);
    while (q.size()) {
        string s = q.front().first;
        int cnt = q.front().second;
        q.pop();
        if (mp.count(s)) continue;
        mp[s] = cnt;
        int zero = -1;
        REP(i, 0, s.size()) {
            if (s[i] == '0') zero = i;
        }
        if (zero % 4 != 0) {
            swap(s[zero], s[zero - 1]);
            q.emplace(s, cnt + 1);
            swap(s[zero], s[zero - 1]);
        }
        if (zero % 4 != 3) {
            swap(s[zero], s[zero + 1]);
            q.emplace(s, cnt + 1);
            swap(s[zero], s[zero + 1]);
        }
        if (zero < 4) {
            swap(s[zero], s[zero + 4]);
            q.emplace(s, cnt + 1);
            swap(s[zero], s[zero + 4]);
        }
        if (zero >= 4) {
            swap(s[zero], s[zero - 4]);
            q.emplace(s, cnt + 1);
            swap(s[zero], s[zero - 4]);
        }
    }

    while (true) {
        string s;
        REP(i, 0, 8) {
            char c;
            if (!(cin >> c)) return 0;
            s += c;
        }
        cout << mp[s] << endl;
    }
    return 0;
}



Measured memory_bytes: 5480
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;

int main()
{
	ios::sync_with_stdio(false), cin.tie(0);
	int N, L;
	cin >> N >> L;
	vector<int> A(N);
	vector<pii> ps(N);
	for (int i = 0; i < N; i++) {
		cin >> A[i];
		ps[i] = { -A[i], i };
	}
	sort(ps.begin(), ps.end());
	vector<ll> res(N);
	for (int x = 0; x < N; x++) {
		int i = ps[x].second;
		if ((i - 1 < 0 || A[i - 1] < A[i]) && (i + 1 >= N || A[i + 1] < A[i])) {
			res[i] = L - A[i];
			continue;
		}
		int l = (i - 1 >= 0 ? A[i - 1] : 0), r = (i + 1 < N ? A[i + 1] : 0);
		if (l > A[i]) {
			res[i] = max(res[i], res[i - 1] + (L - A[i]));
		}
		if (r > A[i]) {
			res[i] = max(res[i], res[i + 1] + (L - A[i]));
		}
	}
	cout << *max_element(res.begin(), res.end()) << endl;
	return 0;
}



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

using ll = long long;
using ull = unsigned long long;
using ld = long double;

#define MOD 1000000007

#define rep(i, n) for(ll (i) = 0LL;(i) < (ll)(n);(i)++)
#define rep2(i, s, e) for(ll (i) = (ll)(s);(i) < (ll)(e);(i)++)
#define repi(i, n) for(ll (i) = 0LL;(i) <= (ll)(n);(i)++)
#define repi2(i, s, e) for(ll (i) = (ll)(s);(i) <= (ll)(e);(i)++)
#define per(i, n) for(ll (i) = (ll)(n) - 1LL;(i) >= 0LL;(i)--)
#define per2(i, s, e) for(ll (i) = (ll)(s) - 1LL;(i) >= (ll)(e);(i)--)
#define peri(i, n) for(ll (i) = (ll)(n);(i) >= 0LL;(i)--)
#define peri2(i, s, e) for(ll (i) = (ll)(s);(i) >= (ll)(e);(i)--)
#define iter(i, it) for(auto &(i): (it))

template<typename T, typename U> ostream& operator<<(ostream &s, const pair<T, U> m) {
    cout << "(" << m.first << ", " << m.second << ")";
    return s;
}
template<typename T, typename U> ostream& operator<<(ostream &s, const map<T, U> m) {
    ll c = 0;
    cout << "{ ";
    iter(i, m) cout << i << (c++ == m.size() - 1 ? " " : ", ");
    cout << "}";
    return s;
}
template<typename T> ostream& operator<<(ostream &s, const vector<T> &v) {
    cout << "{ ";
    rep(i, v.size()) cout << v[i] << (i == v.size() - 1 ? " " : ", ");
    cout << "}";
    return s;
}
template<typename T> ostream& operator<<(ostream &s, const list<T> &v) {
    ll c = 0;
    cout << "{ ";
    iter(i, v) cout << i << (c++ == v.size() - 1 ? " " : ", ");
    cout << "}";
    return s;
}

int main(void) {
    ll n;
    map<char, pair<ll, ll>> m;
    string ans;
    cin >> n;
    rep(i, n) {
        string s;
        map<char, ll> chars;
        cin >> s;
        iter(c, s) chars[c]++;
        iter(j, chars) {
            if(m.find(j.first) == m.end()) {
                m[j.first] = pair<ll, ll>{1, j.second};
            } else {
                m[j.first].first++;
                m[j.first].second = min(m[j.first].second, j.second);
            }
        }
    }
    iter(i, m) {
        if(i.second.first == n) ans += string(i.second.second, i.first);
    }
    cout << ans << endl;
    return 0;
}


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

#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1) {
  cerr << name << " : " << arg1 << "\n";
}
template <typename Arg1, typename... Args>
void __f(const char* na, Arg1&& arg1, Args&&... args) {
  const char* c = strchr(na + 1, ',');
  cerr.write(na, c - na) << " : " << arg1 << " , ";
  __f(c + 1, args...);
}
#define SZ(v) (int)v.size()
#define endl "\n"
#define ALL(v) v.begin(), v.end()
#define UNIQUE(v) sort(ALL(v)),v.erase(unique(ALL(v)),v.end())
typedef long long LL;
typedef pair <int,int> pii;
const double pi = acos(-1.0);
const double eps = 1e-8;
const int inf = 1e9;
const LL INF = 1e18;
const int mod = 1e9 + 7;
const int N = 1e5 + 5;

void solve() {
  LL x;
  cin >> x;
  LL cur = 100, step = 0;
  while (cur < x) {
    cur += cur / 100;
    step++;
  }
  cout << step << endl;
}

int main() {
  ios_base::sync_with_stdio(0); cin.tie(0);
  #ifdef LOCAL
    freopen("input.txt", "r", stdin);
  #endif
  int t = 1;
  for (int tc = 1; tc <= t; tc++) solve();
  return 0;
}



Measured memory_bytes: 3648
#include<bits/stdc++.h>
#define ll  long long
#define speed_up    ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define rep(i,a,b)  for(ll i=a;i<b;i++)
#define pb push_back
#define Max(x,y,z) max(x,max(y,z))
#define f first
#define s second
#define lbd lower_bound
#define sz(x)       (ll)x.size()
#define pi 3.1415926536
#define mod 1000000007
using namespace std;
void solve()
{
 ll n,i,j,k,x,y,sum=0;
 cin>>n;
 vector<ll> v1(n);
 vector<ll> v2(n);
 rep(i,0,n)
 {
  cin>>v1[i];
 }
 rep(j,0,n)
 {
 	cin>>v2[j];
 }
 rep(k,0,n)
 {
   if(v1[k]>v2[k])
   sum+=v1[k]-v2[k];	
 }
 cout<<sum;
}
int main()
{
    ll t;
    //cin>>t;
    t=1;
    while(t--)
        solve();
}

Measured memory_bytes: 256
INF = 10 ** 7

# n + 1 長の array を返す
def cumulative_sum(array)
  tmp = [0]
  previous = 0
  array.each { |num| tmp << previous += num }
  tmp
end

n = gets.to_i
nums = (1..INF).to_a
cumulative_sum = cumulative_sum(nums)
from_index = cumulative_sum.bsearch_index { |sum| sum >= n }
reversed_nums = nums[0, from_index].reverse
reversed_nums.each do |num|
  if n >= num
    n -= num
    puts num
  end
end


Measured memory_bytes: 179028
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(ll i = 0, i##_len = (n); i < i##_len; i++)
#define reps(i, s, n) for(ll i = (s), i##_len = (n); i < i##_len; i++)
#define rrep(i, n) for(ll i = (n) - 1; i >= 0; i--)
#define rreps(i, e, n) for(ll i = (n) - 1; i >= (e); i--)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define sz(x) ((ll)(x).size())
#define len(x) ((ll)(x).length())
#define endl "\n"

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    // ifstream in("input.txt");
    // cin.rdbuf(in.rdbuf());
    ll n, p;
    cin >> n >> p;
    vector<ll> dp(2, 0);
    dp[0] = 1;
    rep(i, n) {
        ll a;
        cin >> a;
        if (a % 2 == 1) {
            ll tmp = dp[0] + dp[1];
            dp[1] += dp[0];
            dp[0] = tmp;
        }
        else {
            dp[0] *= 2;
            dp[1] *= 2;
        }
    }
    cout << dp[p] << endl;
    return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <cmath>
#include <iostream>

using namespace std;

#define MAX_ANGLE 360
#define RAD 57.29578
const double Pi = 3.14159265358979323846;

int main() {

    int A, B, H, M;
    cin >> A >> B >> H >> M;

    double h_theta, m_theta;

    h_theta = ((60 * (double)H + (double)M) / 720) * 2.0 * Pi;
    m_theta = ((double)M / 60) * 2.0 * Pi;

    double theta = abs(h_theta - m_theta);
    //printf("h_theta = %lf m_theta = %lf theta = %lf [rad]\n", h_theta, m_theta, theta);

    double answer;
    double dx, dy;

    dx = abs(B - A * cos(theta));
    dy = abs(0 - A * sin(theta));

    answer = sqrt(pow(dx, 2) + pow(dy, 2));

    printf("%.10f\n", answer);

    return 0;
}

Measured memory_bytes: 4256
#include <iostream>
#include <string>
#include <vector>
#include <list>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <set>
#include <map>
#include <unordered_map>
#include <queue>
#include <stack>
#include <functional>
#include <utility>
#include <fstream>

using namespace std;

#define ll long long
#define INF 2000000000
#define LINF 2000000000000000000
#define rep(i,n) for(int i=0;i<(int)n;i++)
#define dum(x) cout<<#x<<'='<<x<<endl
#define dum2(x,y) cout<<#x<<'='<<x<<' '<<#y<<'='<<y<<'\n'<<endl
#define dum3(x,y,z) cout<<#x<<'='<<x<<' '<<#y<<'='<<y<<' '<<#z<<'='<<z<<'\n'<<endl
#define darr(arr,n) rep(i,(n-arr)){cout<<*(arr+i)<<' ';}cout<<endl

//ifstream in("Text.txt");cin.rdbuf(in.rdbuf());

int coudp[100010];

int main() {
    int N;
    cin >> N;
    int ni[5] = { 9,81,729,6561,59049 };
    int si[6] = { 6,36,216,1296,7776,46656 };

    int cou = 0;
    int sn[12] = { 1, 6, 9, 36, 81, 216, 729, 1296, 6561, 7776, 46656, 59049 };
    for (int i = 11; i >= 0; i--) {

    }
    fill(coudp, coudp + 100010, INF);
    coudp[0] = 0;
    coudp[1] = 1;
    coudp[2] = 2;
    coudp[3] = 3;
    coudp[4] = 4;
    coudp[5] = 5;
    for (int i = 6; i <= 100000; i++) {
        for (int j = 0; j <= 11; j++) {
            if (sn[j] > i)break;
            else coudp[i] = min(coudp[i - sn[j]] + 1, coudp[i]);
        }
    }
    cout << coudp[N] << endl;
}

Measured memory_bytes: 640
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <vector>
#include <string>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <algorithm>

using namespace std;

#define rep(i,j) REP((i), 0, (j))
#define REP(i,j,k) for(int i=(j);(i)<(k);++i)
#define BW(a,x,b) ((a)<=(x)&&(x)<=(b))
#define ALL(v) (v).begin(), (v).end()
#define LENGTHOF(x) (sizeof(x) / sizeof(*(x)))
#define AFILL(a, b) fill((int*)a, (int*)(a + LENGTHOF(a)), b)
#define MP make_pair
#define PB push_back
#define F first
#define S second
#define INF 1 << 30
#define EPS 1e-10

typedef pair<int, int> pi;
typedef pair<int, pi> pii;
typedef vector<int> vi;
typedef queue<int> qi;
typedef long long ll;

int road[16][16], a, b, point[16][16];

int main(){
  while(scanf("%d%d", &a, &b) && a+b){
    memset(road, 0, sizeof(road));
    memset(point, 0, sizeof(point));
    int n, x, y;
    scanf("%d", &n);
    rep(i, n){
      scanf("%d%d", &x, &y); --x; --y;
      point[y][x] = 1;
    }

    road[0][0] = 1;
    REP(i, 1, a) if(!point[0][i]) road[0][i] = road[0][i-1];
    REP(i, 1, b) if(!point[i][0]) road[i][0] = road[i-1][0];
    REP(i, 1, b) REP(j, 1, a) if(!point[i][j]) road[i][j] = road[i-1][j] + road[i][j-1];

    printf("%d\n", road[b-1][a-1]);
  }
  return 0;
}

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

using namespace std;
typedef unsigned int uint;
typedef long long int ll;
typedef unsigned long long int ull;

#define debugv(v) printf("L%d %s => ",__LINE__,#v);for(auto e:v){cout<<e<<" ";}cout<<endl;
#define debugm(m) printf("L%d %s is..\n",__LINE__,#m);for(auto v:m){for(auto e:v){cout<<e<<" ";}cout<<endl;}
#define debuga(m,w) printf("L%d %s is => ",__LINE__,#m);for(int x=0;x<(w);x++){cout<<(m)[x]<<" ";}cout<<endl;
#define debugaa(m,w,h) printf("L%d %s is..\n",__LINE__,#m);for(int y=0;y<(h);y++){for(int x=0;x<(w);x++){cout<<(m)[x][y]<<" ";}cout<<endl;}
#define debugaar(m,w,h) printf("L%d %s is..\n",__LINE__,#m);for(int y=0;y<(h);y++){for(int x=0;x<(w);x++){cout<<(m)[y][x]<<" ";}cout<<endl;}
#define ALL(v) (v).begin(),(v).end()
#define BIGINT 0x7FFFFFFF
#define E107 1000000007ll
void printbit(int u){if(u==0)cout<<0;else{int s=0,k=0;for(;0<u;u>>=1,k++)s=(s<<1)|(u&1);for(;0<k--;s>>=1)cout<<(s&1);}}

#define TIME chrono::system_clock::now()
#define MILLISEC(t) (chrono::duration_cast<chrono::milliseconds>(t).count())

template<typename T1,typename T2>
ostream& operator <<(ostream &o,const pair<T1,T2> p){o<<"("<<p.first<<":"<<p.second<<")";return o;}

int width,height;
ll m,n;

// power
// x^p 対数mod
// MEMO : 逆元...powm(n,E107-2,E107)
template<typename T>
T powm(T x, T p, T mod){
    T y=1;
    x=x%mod;
    while (0<p){
        if (p%2==1){
            y=(y*x)%mod;
        }
        x=(x*x)%mod;
        p/=2;
    }
    return y;
}

int memo[100010];

void halt(){
    cout << 0 << endl;
    exit(0);
}

int main(){
    int i,j,k;
    int x,y,a,b;
    
    cin >> n;
    
    for (i=0;i<n;i++){
        scanf("%d",&k);
        memo[k]++;
        if (memo[k] + (k==0) > 2) halt();
    }
    
    cout << (powm(2ll,n/2,E107)%E107) << endl;
    
    return 0;
}

Measured memory_bytes: 640
#include <iostream>
#include<vector>
#include<algorithm>
#include<string>
using namespace std;
#define REP(i,n) for(int i=0;i<n;i++)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define INF 1000000000
int main(){
cin.tie(0);
ios::sync_with_stdio(false);

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


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

public class Main {
  private static class FastScanner {
    private BufferedReader reader = null;
    private StringTokenizer tokenizer = null;

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

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

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

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

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

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

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

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

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

  public static void main(String[] args) {
    FastScanner sc = new FastScanner(System.in);
    String s = sc.next();
    String t = sc.next();
    int tLen = t.length();
    int result = tLen;
    for (int i = 0; i + tLen <= s.length(); i++) {
      int diff = 0;
      for (int j = 0; j < tLen; j++) {
        if (t.charAt(j) != s.charAt(i + j)) diff++;
      }
      result = Math.min(result, diff);
    }
    System.out.println(result);
  }
}

Measured memory_bytes: 32740
#define _GLIBCXX_DEBUG
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define ALL(v) v.begin(), v.end()
typedef long long ll;

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; }

#include <bits/stdc++.h>
using namespace std;

int main(){
  
  int n;
  cin>>n;
  
  int a,b;
  string x,y;
  while(n--){
    cin>>x>>y;
    a=x.size();
    b=y.size();
    int vec[a+1][b+1];
    rep(i,a+2) vec[i][0]=0;
    rep(i,b+2) vec[0][i]=0;
    for(int i=1;i<a+1;i++){
      for(int j=1;j<b+1;j++){
        if(x[i-1]==y[j-1]) vec[i][j]=vec[i-1][j-1]+1;
        else vec[i][j]=max(vec[i][j-1],vec[i-1][j]);
      }
    }
    cout<<vec[a][b]<<endl;
  }
      
  return 0;
}


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

#pragma GCC optimize("O3,unroll-loops")
#pragma GCC target("avx")

#define fi first
#define se second

using namespace std;

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

int main()
{
    int n,m;
    scanf("%d%d",&n,&m);
    vector<vector<bool>> x(n,vector<bool>(m));
    for(int i=0;i<n;++i)
    {
        getchar();
        for(int j=0;j<m;++j)
            x[i][j]=(getchar()=='#'?1:0);
    }
    vector<vector<int>> dp(n+1,vector<int>(m+1));
    dp[1][1]=1;
    const int mod=1e9+7;
    for(int i=1;i<=n;++i)
        for(int j=1;j<=m;++j)
        {
            if((i==1&&j==1)||x[i-1][j-1])
                continue;
            dp[i][j]=(dp[i-1][j]+dp[i][j-1])%mod;
        }
    printf("%d\n",dp[n][m]);
}



Measured memory_bytes: 4352
#include<bits/stdc++.h>
using namespace std;
bitset<64> b;
int main()
{
	int n;
	cin >> n;
	vector<bitset<64> > v(n);
	int k = 0;
	while(n--)
	{
		int m;
		cin >> m;
		while(m--)
		{
			int x;
			cin >> x;
			v[k].set(x);
		}
		k++;
	}
	int t;
	cin >> t;
	while(t--)
	{
		int ch;
		cin >> ch;
		if(ch == 0)
		{
			int x;
			cin >> x;
			printf("%d\n",b.test(x));
		}
		else if(ch == 1)
		{
			int x;
			cin >> x;
			b |= v[x];
		}
		else if(ch == 2)
		{
			int x;
			cin >> x;
			b &= ~(v[x]);
		}
		else if(ch == 3)
		{
			int x;
			cin >> x;
			b ^= v[x];
		}
		else if(ch == 4)
		{
			int x;
			cin >> x;
			cout << (b | ~v[x]).all() << endl;
		}
		else if(ch == 5)
		{
			int x;
			cin >> x;
			cout << (b & v[x]).any() << endl;
		}
		else if(ch == 6)
		{
			int x;
			cin >> x;
			cout << (b & v[x]).none() << endl;
		}
		else if(ch == 7)
		{
			int x;
			cin >> x;
			cout << (b & v[x]).count() << endl;
		}
		else if(ch == 8)
		{
			int x;
			cin >> x;
			cout << (b & v[x]).to_ulong() << endl;
		}
	}
	return 0;
} 


Measured memory_bytes: 3232
#include<stdio.h>

int main()
{
    int A,B;

    scanf("%d %d",&A,&B);
    if((A*B*1)%2!=0 || (A*B*2)%2!=0 || (A*B*3)%2!=0)
        printf("Yes");
    else
        printf("No");

    return 0;
}


Measured memory_bytes: 128
#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>
using namespace std;
const long long mod=1000000007;
const long long inf=mod*mod;
const long long d2=500000004;
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);}
int main(){
	int a;scanf("%d",&a);
	int tmp=a;
	int c=0;
	while(tmp){
		c+=tmp%10;tmp/=10;
	}
	if(a%c==0)printf("Yes\n");
	else printf("No\n");
}

Measured memory_bytes: 128
#include <iostream>
#include <stack>

using namespace std;

typedef pair<int, int> P;

int main() {
	int n;
	while (cin >> n) {
		if (n == 0) {
			break;
		}
		stack<P> stk;
		int c;
		for (int i = 0; i < n; i++) {
			cin >> c;
			if (i % 2 == 0) {
				if (stk.empty()) {
					stk.push(P(c, 1));
				} else {
					P p = stk.top();
					stk.pop();
					if (p.first == c) {
						stk.push(P(p.first, p.second+1));
					} else {
						stk.push(p);
						stk.push(P(c, 1));
					}
				}
			} else {
				P p = stk.top();
				stk.pop();
				if (p.first == c) {
					stk.push(P(p.first, p.second+1));
				} else {
					if (!stk.empty()) {
						P pp = stk.top();
						stk.pop();
						stk.push(P(pp.first, pp.second+p.second+1));
					} else {
						stk.push(P(c, p.second+1));
					}
				}
			}
		}
		int cc = 0;
		while (!stk.empty()) {
			P p = stk.top();
			stk.pop();
			if (p.first == 0) {
				cc += p.second;
			}
		}
		cout << cc << endl;
	}
	return 0;
}

Measured memory_bytes: 1200
import java.util.*;
import java.io.*;

public class Main {
	public static void main(String args[])throws IOException {
		//BufferedReader??§??????????????????input??????
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		StringBuilder sb = new StringBuilder();
		String str;
		str = br.readLine();
		char c;
		
		//??????????????????????????????
		for(int count=0;count<str.length();count++){
			c = str.charAt(count);
			// ??§???????????¨???true
			if (Character.isUpperCase(c)) {
				//?°????????????????
				//String???????????´???????°????????????????
				sb.append(String.valueOf(c).toLowerCase());
			} else {
				//??§???????????????
				//String???????????´????????§???????????????
				sb.append(String.valueOf(c).toUpperCase());
			}
		}
		System.out.println(new String(sb));
	}
}

Measured memory_bytes: 24864
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
//#define ll long long
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 (a>b) { a=b; return 1; } return 0; }
#define rep(i, n) REP(i, 0, n)
#define rep_rev(i, n) for (int (i) = (int)(n) - 1 ; (i) >= 0 ; --(i))
#define ALL(v) v.begin(), v.end()
#define MSG(a) cout << #a << " " << a << endl;
#define REP(i, x, n) for(int i = x; i < n; i++)
#define all(x) (x).begin(),(x).end()
ll t1,t2,t3;
const ll mod = 1000000007;
const int INF = 1e9;
const ll INFLONG = 1e18;
void swap(ll *x,ll *y) {
  ll tmp;
  tmp = *x;
  *x = *y;
  *y = tmp;
}

int main(){
  double l;
  cin >> l;
  double ans = 1;
  rep(i,3){
    ans *= l/3;
  }
  printf("%.10f\n",ans);
}

Measured memory_bytes: 256
n=gets.to_i
a=gets.chomp.split(" ").map(&:to_i)
a.sort!
type_cnt=1
for i in 1..n-1
	if(a[i-1]!=a[i])
		type_cnt+=1
	end	
end
if((n-type_cnt)%2==1)
	p (type_cnt-1)
else
	p type_cnt
end

Measured memory_bytes: 9476
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cstring>
#include <queue>
#include <stack>
#include <vector>
#include <map>
#include <set>
#include <cmath>
#include <algorithm>
#include <functional>
#define inf 10000000
using namespace std;
typedef long long ll;
const int MAXN=5e6+10;
const int MAX=1e6+10;
const double eps=1e-6;

ll n,k;
ll s[MAX];

int main(){
    #ifdef ONLINE_JUDGE
    #else
    //freopen("in.txt","r",stdin);
    //freopen("output.txt","w",stdout);
    #endif

    ll num,a=0;
    cin>>num;
    ll temp=num;
    while(temp){
    	a+=temp%10;
    	temp=temp/10;
    }
    if(num%a==0)
    	cout<<"Yes"<<endl;
    else
    	cout<<"No"<<endl;

    return 0;
}


Measured memory_bytes: 256
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Scanner;

public class Main {

	@SuppressWarnings("unchecked")
	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		int X = in.nextInt();
		int Y = in.nextInt();
		int E = in.nextInt();
		
		int nAllPoints = 1+X+Y+1;
		lEdge = new List[nAllPoints];
		used = new boolean[nAllPoints];
		for (int i=0;i<lEdge.length;i++) {
			lEdge[i] = new ArrayList<Edge>();
		}
		
		for (int i=0;i<X;i++) {
			addEdge(0, i+1, 1);
		}
		for (int i=0;i<E;i++) {
			addEdge(in.nextInt()+1, in.nextInt()+1+X, 1);
		}
		for (int i=0;i<Y;i++) {
			addEdge(1+X+i, nAllPoints-1, 1);
		}
		
		int res = 0;
		while (true) {
			Arrays.fill(used, false);
			int ret = dfs(0, nAllPoints-1, Integer.MAX_VALUE);
			if (ret==0) break;
			res++;
		}
		System.out.println(res);
	}

	static List<Edge>[] lEdge;
	static boolean[] used;

	static class Edge {
		int to, cap, rev;
		public Edge(int to, int cap, int rev) {
			this.to= to;this.cap = cap;this.rev = rev;
		}
	}

	static void addEdge(int fr, int to, int cap) {
		lEdge[fr].add(new Edge(to, cap, lEdge[to].size()));
		lEdge[to].add(new Edge(fr, 0, lEdge[fr].size()-1));
	}

	static int dfs (int fr, int to, int f) {
		if (fr==to) return f;
		used[fr] = true;
		
		for (int i=0;i<lEdge[fr].size();i++) {
			Edge e = lEdge[fr].get(i);
			if (!used[e.to] && e.cap>0) {
				int dist = dfs(e.to, to, Math.min(f, e.cap));
				if (dist>0) {
					e.cap -=dist;
					lEdge[e.to].get(e.rev).cap += dist;
					return dist;
				}
			}
		}
		return 0;
	}
}

Measured memory_bytes: 51396
#include<bits/stdc++.h>
/* #define int long long */
/* #define double long double */
#define rep(i, n) for(int i = 0; i < (int)n; i++)
#define repa(i, s, n) for(int i = s; i < (int)n; i++)
#define MOD 1000000007
using namespace std;
using ll = long long;
typedef vector<int> vi;
typedef pair<int, int> P;
#define rrep(i,a,b) for(int i=a;i>=b;i--)

signed main(){
    int x;
    cin >> x;
    int now = 0;
    for(int i = 1; ; i++){
        now += i;
        if(x <= now){
            cout << i << endl;
            break;
        }
    }
}

Measured memory_bytes: 3596
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef vector<vvll> vvvll;
typedef vector<string> vstr;
typedef pair<ll, ll> pll;
typedef vector<pll> vp;
typedef map<ll, ll> mll;
typedef map<string, ll> mstrll;
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define fir first
#define sec second
#define maxs(x, y) (x = max(x, y))
#define mins(x, y) (x = min(x, y))
#define all(x) begin(x), end(x)
#define rall(x) rbegin(x), rend(x)
#define _overload3(_1, _2, _3, name, ...) name
#define _rep(i, n) repi(i, 0, n)
#define repi(i, a, b) for(ll i = ll(a); i < ll(b); i++)
#define rep(...) _overload3(__VA_ARGS__, repi, _rep,)(__VA_ARGS__)
#define each(i, n) for(auto&& i: n)
#define out(x) cout << (x)
#define indent() cout << '\n'
#define print(x) cout << (x) << '\n'
#define debug(x) cerr << #x << ": " << (x) << '\n'
ll gcd(ll a, ll b){return b != 0 ? gcd(b, a % b) : a;}
ll lcm(ll a, ll b){return a / gcd(a, b) * b;}
const ll INF = 1e16;
const ll MOD = 1e9 + 7;
ll a, b, c, n, m, x, y, z, w, h, ans, cnt, mx, mn;
string s, t;
ll dx[] = {-1, 0, 1, 0}, dy[] = {0, -1, 0, 1};
//vll dx = {-1, 0, 1, -1, 1, -1, 0, 1}, dy = {-1, -1, -1, 0, 0, 1, 1, 1};
string alphabet = "abcdefghijklmnopqrstuvwxyz";

signed main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    while(cin >> a >> b >> n){
        rep(i, n){
            cin >> x >> y;
            if(x < b && y > a){
                print(1);
                return 0;
            }
        }
        print(0);
    }
}



Measured memory_bytes: 3240
#include <bits/stdc++.h>
#define ff first
#define ss second
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define mt make_tuple
#define pii pair<int, int>
#define pll pair<long long,long long>
#define vl vector<long long>
#define vll vector<pll>
#define vi vector<int>
#define vii vector<pii>
#define sws ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define endl '\n'
#define tcase int tt; cin>>tt; while(tt--)
#define tcase2 int tt; cin>>tt; for(int qq=1;qq<=tt;qq++)
using namespace std;
typedef long long int ll;
typedef  unsigned long long int ull;
typedef long double ld;
const int MAX = 1000002;
const int MOD2 = 998244353;
const int MOD = 1000000007; 
const int INF = 1e8;
const ld EPS = 1e-7;
// Extra
#define forn(i, n) for(int i = 0; i < (int)n; i++)
#define forne(i, a, b) for(int i = a; i <= b; i++)
#define all(x) x.begin(), x.end()
#define trav(a, x) for(auto& a : x)
#define fill(x,y) memset(x,y,sizeof(x))
/* run this program using the console pauser or add your own getch, system("pause") or input loop */
ll dectobin(ll n,ll p[])
{
    ll i=0 ;
    while(n!=0)
    {
        p[i]=n%2 ;
        n/=2 ;
        i++ ;
    }
    return(i-1) ;
}
ll binarySearchCount(ll arr[], ll n, ll key) 
{ 
    ll left = 0; 
    ll right = n - 1; 
  
    ll count = 0; 
  
    while (left <= right) { 
        int mid = (right + left) / 2; 
  
        // Check if middle element is 
        // less than or equal to key 
        if (arr[mid] < key) { 
  
            // At least (mid + 1) elements are there 
            // whose values are less than 
            // or equal to key 
            count = mid + 1; 
            left = mid + 1; 
        } 
  
        // If key is smaller, ignore right half 
        else
            right = mid - 1; 
    } 
  
    return count; 
} 
void printDivisors(ll n,ll k) 
{  ll temp=1  ;
    // Note that this loop runs till square root 
    for (int i=1; i<=sqrt(n); i++) 
    { 
        if (n%i == 0) 
        { 
            // If divisors are equal, print only one 
            if (n/i == i) 
                {
                	if(i<=k && i>temp)
                	temp=i ;
				}
  
            else // Otherwise print both 
                
                {
                if(i<=k && i>temp)
                	temp=i ;
                if(n/i<=k && n/i>temp)
                temp=n/i ;
				}
        } 
    }
	cout<<n/temp<<"\n" ;
	return ; 
} 
 
int main(int argc, char** argv)
{   sws ;
 //tcase
{
ll n ;
cin>>n ;
ll a[n],b[n],c[n],sum1[n]={0},sum2[n]={0},sum3[n]={0} ;
forn(i,n)
cin>>a[i]>>b[i]>>c[i] ;
sum1[0]=a[0] ;
sum2[0]=b[0] ;
sum3[0]=c[0] ;
for(int i=1; i<n; i++)
{
	sum1[i]=max(sum2[i-1],sum3[i-1])+a[i] ;
	sum2[i]=max(sum1[i-1],sum3[i-1])+b[i] ;
	sum3[i]=max(sum1[i-1],sum2[i-1])+c[i] ;
	//cout<<sum1[i]<<" "<<sum2[i]<<" "<<sum3[i]<<"\n";
}
cout<<max(sum1[n-1],max(sum2[n-1],sum3[n-1]))<<"\n";
}
return 0 ;
}
  

Measured memory_bytes: 4992
#include<bits/stdc++.h>
using namespace std;
//using namespace std::chrono;
#define int long long int
#define ld long double
#define pii pair<int,int>
#define pll pair<ll,ll>
#define pdd pair<ld,ld>
#define M 1000000007
#define rep(a,b,c) for(int a=b;a<c;a++)
#define frev(a,b,c) for(a=b;a>=c;a--)
#define msb(x) __builtin_clz(x)
#define lsb(x) __builtin_ctz(x)
#define maxheap priority_queue<int>
#define minheap priority_queue<int,vector<int>,greater<int>>
#define endl '\n'

void solve(){

int n;
cin>>n;
cout<<pow(n,2)+pow(n,3)+n<<endl;

}
int32_t main(){
   //

  //  cout<<fixed<<setprecision(10);
    //auto start = high_resolution_clock::now();
    int t=1;
    //cin>>t;
    while(t--) solve();
  //  auto stop = high_resolution_clock::now();
    //auto duration = duration_cast<microseconds>(stop - start);
    //cout << duration.count() << endl;
}


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

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

#define FOR(i, n, m) for (ll(i) = (m); (i) < (n); ++(i))
#define REP(i, n) FOR(i, n, 0)
#define OF64 std::setprecision(10)

const ll MOD = 1000000007;
const ll INF = (ll)1e15;

//! [i番目まで見たとき][価値がvとなるような]=重さの最小値
ll dp[105][100005];

int main()
{
    ll N, W;
    cin >> N >> W;
    REP(i, 100005)
    {
        dp[0][i] = INF;
    }
    dp[0][0] = 0;
    REP(i, N)
    {
        ll w, v;
        cin >> w >> v;
        REP(j, 100005)
        {
            dp[i + 1][j] = dp[i][j];
            if (j - v < 0)
                continue;
            dp[i + 1][j] = std::min(dp[i + 1][j], dp[i][j - v] + w);
        }
    }

    ll max = 0;
    REP(i, 100005)
    {
        if (dp[N][i] > W)
            continue;
        max = std::max(max, i);
    }

    cout << max << endl;
    return 0;
}

Measured memory_bytes: 80128
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#define MAX(a,b) (a > b ? a : b)
#define MIN(a,b) (a < b ? a : b)
const int inf = 1000000000; // 10^9

int Amax(int *p,int size){
   int _max = 0;
   for(int i = 0;i < size;i++)
      if(p[i] > _max)_max = p[i];
   return _max;
}
int main(){
   int n,m;
   char s1[101][11],s2[101][11];
   scanf("%d",&n);
   for(int i = 0;i < n;i++)scanf("%s",s1[i]);
   scanf("%d",&m);
   for(int i = 0;i < m;i++)scanf("%s",s2[i]);
   int ans[101]={0};
   for(int i = 0;i < n;i++){
      for(int j = 0;j < n;j++)if(strcmp(s1[i],s1[j])==0)ans[i]++;
      for(int j = 0;j < m;j++)if(strcmp(s1[i],s2[j])==0)ans[i]--;
   }
   printf("%d",Amax(ans,n));
}

Measured memory_bytes: 128