akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>

using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
const long double pi=acos(-1);
#define x  first
#define y  second
#define read(n,a) for(int i=0;i<n;i++)cin>>a[i];
#define rep(i,z,n)for(int i=z;i<n;i++)

ll a[200002]={};
//int b[1000002]={};
ll n,m;

int main()
{
    int t=1;
    //cin>>t;
    while(t--)
    {
        ll a,b,c,d;
        cin>>a>>b>>c>>d;
       ll ans=max(max(a,b)*max(c,d),min(a,b)*max(c,d));
       ans=max(ans,min(a,b)*min(c,d));
       ans=max(ans,max(a,b)*min(c,d));
       cout<<ans;
    }
    return 0;
}


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

int main() {
  int a,c=0;
  cin>>a;
  vector<int> d(a);
  for(int i=0;i<a;i++)
    cin>>d[i];
  sort(d.begin(),d.end());
  cout<<d[a/2]-d[a/2-1];
}

Measured memory_bytes: 640
r,c = map(int, input().split( ))
M = []
for _ in range(r):
    clm = list(map(int, input().split( )))
    clm.append(sum(clm))
    print(*clm)
    M.append(clm)
for i in range(c):
    sm = 0
    for j in range(r):
        sm += M[j][i]
    print(sm, end = " ")
sm = 0    
for j in range(r):
    sm += M[j][c]
print(sm)


Measured memory_bytes: 5708
//for ( auto &i: a ){
//		cin >> i;
//}
#include <bits/stdc++.h>
# define ll      long long 
# define in      freopen("input.txt", "r", stdin);
# define out     freopen("output.txt", "w", stdout);
# define all(vc) vc.begin(),vc.end()
# define fi      first
# define se      second
# define str     string 
# define pb      push_back
# define speed   ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
# define time    cerr << "\nTime elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n"
using namespace std;
ll a,b,c,d,e,f,mn=1e9,mx,cnt,bnt,sum,seven,four; str jul,s,cal,kcal;bool ok=false;
set <int> st; map <char, int> mp; vector <ll> vc1;
void botsolve(){
	if((a*b)>(c*d)) cout<<a*b;
	else cout<<c*d;
}
int main(){
	speed;
	//in out
    cin>>a>>b>>c>>d;
    botsolve();

	time;
	return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int A = sc.nextInt();
		int B = sc.nextInt();
		int C= sc.nextInt();
		int D = sc.nextInt();
		if (A*B >=C*D) {
			System.out.println(A*B);
		} else {
			System.out.println(C*D);
		}
	}
}

Measured memory_bytes: 23124
#include<stdio.h>
static const int N=100;

void bubble(int ,int []);

int main(){
  
  int i,m;
  int n[N];
  scanf("%d",&m);
  for(i = 0; i < m; i++){
    scanf("%d",&n[i]);
  }
  bubble(m,n);
  return 0;
}
void bubble(int m,int n[]){
  
  int i,j,a=0,b=0;
  
  for(i = 0; i < m; i++){
    
    for(j = m-1; j > i; j--){
      
      if(n[j]<n[j-1]){
	b=n[j-1];
	n[j-1]=n[j];
	n[j]=b;
	a++;
      }
    }
  }
  for(i=0;i<m;i++){
    printf("%d",n[i]);
    if(i<m-1){
      printf(" ");
    }
  }
  printf("\n%d\n",a);
}

Measured memory_bytes: 604
#include <iostream>
#include <algorithm>
#include <string>
using namespace std;
#define int long long

signed main() {
  int a[3];
  cin >> a[0] >> a[1] >> a[2];
  sort(a, a + 3);
  cout << a[2] - a[0] << endl;
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define _USE_MATH_DEFINES
using namespace std;
    
#define ll long long int
#define pb push_back
#define rep(i , j , n) for(ll i = j ; i < n ; i++)
#define pre(i , j , n) for(ll i = j ; i >= n ; i--)
#define all(x) x.begin(), x.end()
typedef pair<int, int>	pii;
typedef pair<ll, ll>	pl;
typedef vector<int>		vi;
typedef vector<ll>		vll;
typedef vector<char>	vc;
typedef vector<bool>	vb;
typedef pair<ll,ll> 	pll;
#define br "\n"
#define ff first
#define ss second
ll MAX =  (ll)1000005;
ll mod =  1e9 + 7;

vll prime(MAX,0);
vll v,cc(MAX,0);


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

void sieve() 
{ 
    prime[0] = prime[1] = 1; 
    for (ll i = 2; i < MAX; i++) { 
        if (prime[i] == 0) { 
            for (ll j = i * 2; j < MAX; j += i) { 
                if (prime[j] == 0) { 
                    prime[j] = i; 
                } 
            } 
            prime[i] = i; 
        } 
    } 
} 

void solve(){

    ll n;
    cin >> n;
    ll gc=-1;
    bool pairw = true;
    rep(i,0,n){
        ll x;
        cin >> x;
        if(gc == -1) gc = x;
        else if(gc != 1) gc = gcd(x,gc);
        if(pairw){
            set<ll> s;
            while(prime[x] != 1){
                s.insert(prime[x]);
                x /= prime[x];
            }
            for(auto y:s){ 
                cc[y]++;
                if(cc[y] > 1){
                    pairw = false;
                    break;
                }
            }
        }
    }
    if(pairw) cout << "pairwise coprime";
    else if(gc == 1) cout << "setwise coprime";
    else cout << "not coprime";


}
	

int main(){
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif  

    sieve();

	ll t = 1;
	// cin >> t;
	rep(i,0,t){
		solve();
	}
 
}	

Measured memory_bytes: 18588
#include<bits/stdc++.h>
using namespace std;
int main(){
	int n;
	cin>>n;
	long long int a[n];
	long long int ans=0;
	long long int maxx[n];
	for(int i=0;i<n;i++){
		cin>>a[i];
		ans = max(ans,a[i]);
		maxx[i] = ans;
	}
	long long int cnt=0;
	for(int i=1;i<n;i++){
		if(a[i]!=maxx[i]){
			cnt+=(maxx[i-1]-a[i]);
		}
	}
	cout<<cnt<<endl;
}

Measured memory_bytes: 6748
#include<iostream>
#include<string>
#include<map>
using namespace std;
int main()
{
    long long h,w,n,x,y,mx1=0,i,mx2=0,l,max,m,k;
    cin>>h>>w>>n;
    map<long long,long long>h1,w1;
    map< long long,map<long long,long long> >mp;
    while(n--)
    {
        cin>>x>>y;
        mp[x][y]++;
        h1[x]++;
        w1[y]++;
        if(h1[x]>mx1)
        {
            mx1=h1[x];
            l=x;
        }
        if(w1[y]>mx2)
        {
            mx2=w1[y];
            m=y;
        }
    }
    max=mx1+mx2;
    if(mp[l][m]==1)
    {
        max=(mx1+mx2)-1;
    }
    else
    {
        cout<<max<<endl;
        return 0;
    }
    k=max;
    for(i=1;i<=h;i++)
    {
        if(h1[i]==mx1)
        {
            if(mp[i][m]==0)
            {
                max++;
                break;
            }
        }
    }
    for(i=1;i<=w;i++)
    {
        if(w1[i]==mx2)
        {
            if(mp[l][i]==0)
            {
                k++;
                break;
            }
        }
    }
    if(k>=max)
    {
        cout<<k<<endl;
    }
    else
    {
        cout<<max<<endl;
    }
    return 0;
    
}

Measured memory_bytes: 87984
s = input()
t = input()
n = len(t)
ans, res = 0, len(s)
for i in range (0, len(s) - len(t) + 1) :
    a = s[i : i + n]
    for i in range(0, n) :
        if (a[i] != t[i]): ans += 1 
    res = min(res, ans)
    ans = 0 
print(res)

Measured memory_bytes: 8956
#include <cstdio>
#include <cstring>
#include <vector>
#include <queue>
#include <cmath>
#include <string>
#include <algorithm>
#include <iostream>
#include <map>
#include <set>
#include <string>
#include <functional>
#include <iostream>
#define INF 100000000000000LL
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
int n;

map<ll,int> mp;
set<ll> st;

ll to(ll x){
	for(ll i=2;;i++){
		ll v=i*i*i;
		if(v>x)break;
		while(x%v==0)x/=v;
	}
	return x;
}

ll tg(ll x){
	ll a=1,b=1;
	for(ll i=2;;i++){
		if(i*i*i>x)break;
		int cnt=0;
		while(x%i==0){
			x/=i;
			cnt++;
		}
		if(cnt==1)a*=i;
		else if(cnt==2)b*=i;
	}
	ll dt=(ll)floor(sqrt(x)+0.5);
	if(dt*dt==x)b*=dt;
	else a*=x;
	ll res=a*b;
	if(res>INF/a+1)res=INF;
	else res*=a;
	return res;
}


int main(void){
	scanf("%d",&n);
	int res=0;
	for(int i=0;i<n;i++){
		ll x;
		scanf("%lld",&x);
		x=to(x);
		mp[x]++;
	}
	map<ll,int>::iterator it=mp.begin();
	while(it!=mp.end()){
		ll x=it->first;
		if(st.count(x)){
			it++;
			continue;
		}
		int cnt=it->second;
		ll t=tg(x);
		if(x!=t)res+=max(cnt,mp[t]);
		else res++;
		st.insert(t);
		it++;
	}
	printf("%d\n",res);
	return 0;
}


Measured memory_bytes: 14336
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
const ll MOD = 1000000007;
const ld PI = acos(-1);  
const ld EPS = 0.0000000001;
const ll LINF = 1001002003004005006ll;
const int INF = 1001001001;
#define rep(i, n) for(ll i=0; i<(ll)(n); i++)
#define repd(i, n) for(ll i=n-1; 0<=i; i--)
#define FOR(i, a, b) for(ll i=a; i<(ll)(b); i++)
#define FORD(i, a, b) for(ll i=a-1; (ll)(b)<=i; i--)
#define ALL(x) x.begin(), x.end()
#define MAX(x) *max_element(ALL(x))
#define MIN(x) *min_element(ALL(x))
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
vector<vector<ll>> v;
vector<ll> cost;

void dfs(ll nv, ll p=-1){
    for(auto x: v[nv]){
        if(x==p) continue;
        cost[x] += cost[nv];
        dfs(x, nv);
    }
}

int main(){
    ll n, q;   cin >> n >> q;
    v.resize(n), cost.resize(n);
    rep(i, n-1){
        ll a, b;    cin >> a >> b;
        a--, b--;
        v[a].push_back(b);
        v[b].push_back(a);
    }

    rep(i, q){
        ll a, c;    cin >> a >> c;
        cost[a-1] += c;
    }
    dfs(0);
    rep(i, n) cout << cost[i] << ' ';
}


Measured memory_bytes: 25084
<?php
fscanf(STDIN, "%s", $a);
fscanf(STDIN, "%s", $b);

$ans = $a . $b;
if (strpos($ans,'1') === false) {
  echo '1';
} elseif (strpos($ans,'2') === false) {
  echo '2';
}  else {
  echo '3';
}


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

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

    int a, b, c;
    cin >> a >> b >> c;

    for(int i = 1; i <= 100; i++){
        if((a * i) % b == c){
            cout << "YES" << endl;
            return 0;
        }
    }

    cout << "NO" << endl;

    return 0;
}

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

const long long MOD = 1000000007;
const long long INF = 1LL << 60;
const int INT_INF = 1000000000;

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

int main()
{
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  int K, A, B;
  cin >> K >> A >> B;
  bool can = false;
  for (int i = A; i <= B; i++)
  {
    if (i % K == 0)
      can = true;
  }
  if (can)
    cout << "OK" << endl;
  else
    cout << "NG" << endl;
  return 0;
}


Measured memory_bytes: 3652
import java.util.Scanner;

public class Main
{

  public static void main(String[] args)
  {
    try (Scanner scanner = new Scanner(System.in);)
    {
      while (scanner.hasNextLine())
      {
        char[] charArray = scanner.nextLine().toCharArray();
        System.out.println(solver(charArray));
      }
    }
  }

  private static char solver(char[] charArray)
  {
    char[][] array =
    {
        { charArray[0], charArray[1], charArray[2] },
        { charArray[3], charArray[4], charArray[5] },
        { charArray[6], charArray[7], charArray[8] } };

    for (int i = 0; i < array[0].length; i++)
    {
      if (isEqual(array[i][0], array[i][1], array[i][2]))
      {
        if (array[i][0] == 's')
        {
          continue;
        }
        return array[i][0];
      }
    }
    for (int i = 0; i < array.length; i++)
    {
      if (isEqual(array[0][i], array[1][i], array[2][i]))
      {
        if (array[0][i] == 's')
        {
          continue;
        }
        return array[0][i];
      }
    }
    if (isEqual(array[0][0], array[1][1], array[2][2]))
    {
      if (array[1][1] != 's')
      {
        return array[1][1];
      }
    }

    if (isEqual(array[0][2], array[1][1], array[2][0]))
    {
      if (array[1][1] != 's')
      {
        return array[1][1];
      }
    }

    return 'd';
  }

  private static boolean isEqual(char a, char b, char c)
  {
    return (a == b && a == c);
  }

}



Measured memory_bytes: 26100
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define ll long long
#define rep(i, n) for (int i = 0; i < n; i++)
#define all(a) (a).begin(), (a).end()
typedef vector<int> vi;
const int INF = 1LL << 60; //10e18+10e17ちょっとくらい
const int MOD = 1000000007;
const int MAX_N = 200100;

signed main()
{
    //  以降 cin の入力元が 'input.txt' になる
    //std::ifstream in("input.txt");
    //std::cin.rdbuf(in.rdbuf());
    int n;
    cin >> n;
    vector<char> vc;
    while (n > 0)
    {
        int tmp = n % 26 - 1;
        n /= 26;
        char out;
        if (tmp == -1)
        {
            out = 'z';
            n--;
        }
        else
            out = 'a' + tmp;
        vc.emplace_back(out);
    }
    rep(i, vc.size())
    {
        cout << vc[vc.size() - 1 - i];
    }
    cout << endl;

    return 0;
}

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

using namespace std;

int main(){
  int N,M;
  cin>>N>>M;
  vector<long long> a(N+1,0);
  vector<int> noentry(M,0);
  for(int i=0; i<M;i++){
    cin>>noentry[i];
  }
  sort(noentry.begin(),noentry.end());
  a[0]=1;
  if(M!=0){
    a[noentry[0]]=-1;
    for(int i=1; i<noentry.size(); i++){
      if(noentry[i]-1==noentry[i-1]){
        cout<<0<<endl;
        return 0;
      }
      a[noentry[i]]=-1;
    }
  }
  
  if(a[1]==0){
    a[1]=1;
  }
  for(int i=2; i<a.size(); i++){
    if(a[i]==-1) continue;
    if(a[i-1]==-1){ a[i] = a[i-2]; continue;}
    if(a[i-2]==-1){ a[i] = a[i-1]; continue;}
    a[i] = (a[i-1] + a[i-2])%1000000007;
  }
  cout<<a.back()<<endl;
  return 0;
}
  


Measured memory_bytes: 1408
import math
import sys

def getinputdata():

    # 配列初期化
    array_result = []
    
    data = input()

    
    array_result.append(data.split(" "))

    flg = 1

    try:


        while flg:

            data = input()

            array_temp = []

            if(data != ""):
                
                array_result.append(data.split(" "))

                flg = 1

            else:

                flg = 0
    finally:


        return array_result





arr_data = getinputdata()

strdata=""
s = arr_data[0][0]


for v in s:
    
    if v=="0":
        
        strdata+="0"
        
    elif v=="1":

        strdata+="1"
    
    else:
        
        strdata=strdata[0:len(strdata)-1]

print(strdata)

Measured memory_bytes: 3064
//#include <bits/stdc++.h>
#include <algorithm>
#include <array>
#include <atomic>
#include <bitset>
#include <chrono>
#include <complex>
#include <condition_variable>
#include <deque>
#include <exception>
#include <forward_list>
#include <fstream>
#include <functional>
#include <future>
#include <initializer_list>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <mutex>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <system_error>
#include <thread>
#include <tuple>
#include <type_traits>
#include <typeindex>
#include <typeinfo>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <valarray>
#include <vector>
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
//typedef long double ld;

typedef map<int, int> mii;
typedef pair<int, int> pii;
typedef pair<double,double> pdd;
typedef set<int> si;
typedef set<ll> sll;
typedef vector<int> vi;
typedef vector<pair<int, int > > vii;
typedef vector<ll> vll;
typedef vector<double> vd;
typedef vector<vi> vvi;
typedef vector<vii> vvii;
typedef vector<vll> vvll;

constexpr ll MOD = 1e9+7;
//constexpr int INF = 1<<30;
//constexpr ll  LINF = 1LL<<60;

#define Sort(x) sort(x.begin(),x.end())
#define Reverse(x) reverse(x.begin(),x.end())
#define ABS(a,b) ((a)<(b)?(b)-(a):(a)-(b))
#define nbit(n) (1ll<<(n))

// sort(begin(x), end(x), greater<ll>());
// lower_bound(a.begin(), a.end(), val): a[i] ≥ valである最左の位置
// upper_bound(a.begin(), a.end(), val): a[i] > valである最左の位置

// Returns minimum of a and b.
// If a is less b, a is set to b.
template<typename T>
T chmin(T& a, T b) {
  if (a > b) {
    a = b;
  }
  return a;
}

// Returns maximum of a and b.
// If a is less b, a is set to b.
template<typename T>
T chmax(T& a, T b) {
  if (a < b) {
    a = b;
  }
  return a;
}

// a = (a+b)%MOD;
void addmod(ll& a, ll b) {
  a = (a+b)%MOD;
}

template <typename T>
void dumpContents(const T& v, const string& msg)
{
  cerr << "### " << msg << " ###\n";
  for (const auto& x : v) {
    cerr << x << " ";
  }
  cerr << endl;
}

struct before_main_function {
  before_main_function() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout<<setprecision(20)<<fixed;
    #define endl "\n"
  }
} before_main_function;

// ========== end of template ==========

int main(int argc, char** argv) {
  int N;
  cin >> N;

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

  vi B(A);
  Sort(B);

  for (auto a : A) {
    cout << (B[N-1] == a ? B[N-2] : B[N-1]) << endl;
  }

  return 0;
}


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

using namespace std;

int main(){

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

    int x;
    cin >> x;

    int a = x/100%10 + x/1000*10;
    int b = x%10 + x/10%10*10;

    if(a >= 1 and a <= 12){
        if(b >= 1 and b <= 12)
            cout << "AMBIGUOUS\n";
        else cout << "MMYY\n";
    } else if(b >= 1 and b <= 12)
        cout << "YYMM\n";
    else cout << "NA\n";

    return 0;
}

Measured memory_bytes: 256
#pragma GCC optimize ("O3")
#pragma GCC target ("avx")
//#include<bits/stdc++.h>
#include<cstdio>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
#define ce(x) cerr << (x) << "\n"
#define cesp(x) cerr << (x) << " "
#define pb push_back
#define mp make_pair
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
#define Would
#define you
#define please

const int mod = 1e9 + 7;
const int IMAX = 2000010;
constexpr ll modpow(ll A, ll B) {
	ll kotae = 1;
	while (B > 0) {
		if (B & 1) kotae = kotae * A % mod;
		A = A * A % mod;
		B >>= 1;
	}
	return kotae;
}
class unko {
public:
	int fac[IMAX + 1], ifac[IMAX + 1], inv[IMAX + 1];
	constexpr unko() : fac(), ifac(), inv() {
		fac[0] = 1;
		rep1(i, IMAX) fac[i] = ll(fac[i - 1]) * i % mod;
		ifac[IMAX] = modpow(fac[IMAX], mod - 2);
		for (int i = IMAX; i > 0; i--) ifac[i - 1] = ll(ifac[i]) * i % mod;
	}
} f;

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


	int R1, C1, R2, C2;
	scanf("%d%d%d%d", &R1, &C1, &R2, &C2);

	ll kotae1 = 0, kotae2 = 0;

	for (int i = C1 + 1; i <= C2 + 1; i++) {
		kotae1 += (ll)f.fac[i + R2] * f.ifac[i] % mod;
		kotae2 += (ll)f.fac[i + R1 - 1] * f.ifac[i] % mod;
	}

	printf("%lld\n", ((kotae1 % mod * f.ifac[R2] - kotae2 % mod * f.ifac[R1 - 1]) % mod + mod) % mod);

	Would you please return 0;
}

Measured memory_bytes: 128
///  author:Kissheart  ///
#include<stdio.h>
#include<algorithm>
#include<iostream>
#include<string.h>
#include<vector>
#include<stdlib.h>
#include<math.h>
#include<queue>
#include<deque>
#include<ctype.h>
#include<map>
#include<set>
#include<stack>
#include<string>
#define INF 0x3f3f3f3f
#define FAST_IO ios::sync_with_stdio(false)
const double PI = acos(-1.0);
const double eps = 1e-6;
const int MAX=1e5+10;
const int mod=1e9+7;
typedef long long ll;
using namespace std;
#define gcd(a,b) __gcd(a,b)
inline ll lcm(ll a,ll b){return a/gcd(a,b)*b;}
inline ll qpow(ll a,ll b){ll r=1,t=a; while(b){if(b&1)r=(r*t)%mod;b>>=1;t=(t*t)%mod;}return r;}
inline ll inv1(ll b){return qpow(b,mod-2);}
inline ll exgcd(ll a,ll b,ll &x,ll &y){if(!b){x=1;y=0;return a;}ll r=exgcd(b,a%b,y,x);y-=(a/b)*x;return r;}
inline ll read(){ll x=0,f=1;char c=getchar();for(;!isdigit(c);c=getchar()) if(c=='-') f=-1;for(;isdigit(c);c=getchar()) x=x*10+c-'0';return x*f;}
//freopen( "in.txt" , "r" , stdin );
//freopen( "data.txt" , "w" , stdout );
string s,str="keyence";
int main()
{
    cin>>s;
    if(s.substr(s.length()-7)==str)
    {
        printf("YES\n");
        return 0;
    }

    for(int i=0; i<s.length()-7;i++)
    {
        if(s.substr(i,i+7)==str)
        {
            printf("YES\n");
            return 0;
        }
    }


    for(int i=1;i<=6;i++)
    {
        string ss=s.substr(0,i)+s.substr(s.length()-7+i);
        if(ss==str)
        {
            printf("YES\n");
            return 0;
        }
    }

    printf("NO\n");
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <map>
#include <sstream>
#include <functional>
#include <numeric>
#include <cmath>
#include <cstring>
#include <cstdio>
#include <queue>
#include <stack>
#include <set>

using namespace std;

#define ALL(co) co.begin(), co.end()
#define tpl(...) make_tuple(__VA_ARGS__)

typedef long long LL;
typedef pair<int, int> P; typedef pair<int, P> IP; typedef pair<P, P> PP;
typedef vector<int> Array; typedef vector<vector<int> > Array2;
typedef vector<LL> LArray; typedef vector<P> PArray; typedef vector<string> SArray;

const int INF = 1 << 29;
const LL LINF = 1LL << 60;

inline int getInt() { int itiv; return (cin >> itiv, itiv); }
template <typename T> void readAll(vector<T>& vec) { for (int i = 0, size = vec.size(); i < size; i++) cin >> vec[i]; }
template <typename T, typename U> void readAll(vector<pair<T, U> >& vec) { for (int i = 0, size = vec.size(); i < size; i++) cin >> vec[i].first >> vec[i].second; }
template < typename T > inline string toString( const T &a ){ ostringstream oss; oss << a; return oss.str(); };
inline bool between(int min, int max, int n) { return min <= n && n <= max; }
inline bool inRange(int begin, int end, int n) { return begin <= n && n < end; }
inline bool inRange(int size, int n) { return 0 <= n && n < size; }

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

int m, n;

int main(void)
{
	ios::sync_with_stdio(false);
	Array a(4), b(4);
	readAll(a);
	readAll(b);
	cout << max(accumulate(ALL(a), 0),accumulate(ALL(b), 0)) << endl;
	return 0;
}

Measured memory_bytes: 1196
#include <iostream>
#include <cmath>
#include <string>
#include <vector>
#include <algorithm>
using namespace std;
 
int main() {
    int a,b,c;
    cin >> a >> b >> c;
    int x = max(max(a,b),c);
    int y = min(min(a,b),c);
    cout << x-y << endl;
 }

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

#define step(i, s, n, d) for(int i=s; i<n; i+=d)
#define FOR(i,s,n) step(i,s,n,1)
#define rep(i,n) FOR(i,0,n)
#define gets(x) x; cin >> x;
#define puts(x) x; cout << x << endl;
#define list_input(x, n) x[n]; rep(i,n){ gets(x[i]);}
#define ll long long

int main(){
  int a, b, c;
  cin >> a >> b >> c;
  if (a+b >= c) {
    puts("Yes")
  }else{
    puts("No")
  }
}


Measured memory_bytes: 256
#include <cstdio>
#define MAXN 200100
int perm[MAXN];
int a[MAXN];
int ans[MAXN];
int n;
void solve(void) {
	int sz = n, inc = -1, i;
	for(i = 1; i <= n; i++) {
		perm[i] = sz;
		sz += 2 * inc;
		if(sz == 0) {
			sz = 1;
			inc = -inc;
		} else if(sz == -1) {
			sz = 2;
			inc = -inc;
		}
	}
	for(i = 1; i <= n; i++) ans[i] = a[perm[i]];
}
int main(void) {
	scanf("%d", &n);
	for(int i = 1; i <= n; i++) scanf("%d", &a[i]);
	solve();
	for(int i = 1; i <= n; i++) printf("%d ", ans[i]);
	return 0;
}

Measured memory_bytes: 4480
#include <bits/stdc++.h>
#define N 51
using namespace std;
int h,w,m;
string mp[N];
int c[N*N],on[N*N],off[N*N];
int dx[] = {0,0,1,-1};
int dy[] = {1,-1,0,0};

vector<int> path;
int used[N*N];
int dfs(int pos,int t){
  if(pos==t) return 1;
  if(used[pos]++) return 0;
  int x = pos%w,y=pos/w;

  for(int i=0;i<4;i++){
    int nx = x+dx[i];
    int ny = y+dy[i];
    int npos = w*ny+nx;
    if(nx<0||ny<0||nx>=w||ny>=h||mp[ny][nx]=='#')continue;
    if(dfs(npos,t)){path.push_back(npos);return 1;}
  }
  return 0;
}

vector<int> job;
int calc(){
  int res=0,sta[N*N]={},cnt=2; 
  res+=on[job[0]];
  sta[job[0]] = 1;
  for(int i=0;i<m-1;i++){
    path.clear();
    memset(used,0,sizeof(used));
    dfs(job[i],job[i+1]);
    for(int j=0;j<path.size();j++){
      int pos = path[path.size()-j-1];
      int &T = sta[pos];
      if(T==0) res+=on[pos];
      else res+=min(on[pos]+off[pos],c[pos]*(cnt-T));
      T=cnt++;
    }
  }
  for(int i=0;i<h*w;i++)if(sta[i])res+=off[i];
  return res;
}

int main(){
  cin>>h>>w>>m;
  for(int i=0;i<h;i++) cin>>mp[i];
  for(int i=0;i<h*w;i++) cin>>c[i];
  for(int i=0;i<h*w;i++) cin>>on[i];
  for(int i=0;i<h*w;i++) cin>>off[i];
  for(int i=0,x,y;i<m;i++)cin>>y>>x,job.push_back(y*w+x);
  cout<<calc()<<endl;
  return 0;
}

Measured memory_bytes: 3384
# https://atcoder.jp/contests/abc061/tasks/abc061_c

import itertools
from collections import Counter
from collections import defaultdict
import bisect
from heapq import heappush, heappop

def main():
    N, K = map(int, input().split())
    ab = []
    for _ in range(N):
        a, b = map(int, input().split())
        ab.append((a, b))
    ab.sort(key=lambda x: x[0])

    rest = K
    for a, b in ab:
        if rest <= b:
            print(a)
            exit()
        else:
            rest -= b


if __name__ == '__main__':
    main()


Measured memory_bytes: 58584
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, srt, end) for (long long i = (srt); i < (long long)(end); i++)

int main(){
    ll N;
    cin >> N;
    vector<ll> L(N);
    rep(i, 0, N) cin >> L[i];
    sort(L.begin(), L.end());
    ll ans = 0;
    rep(i, 0, N-2){
        rep(j, i+1, N-1){
            ll a = L[i];
            ll b = L[j];
            auto itr = lower_bound(L.begin()+j+1, L.end(), a+b);
            auto pos = distance(L.begin(), itr);
            ans += max(0LL, pos - j - 1);
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using pr = pair<int, int>;

int N, M, D[100005], pre[100005];
vector<int> v[100005];
queue<int> q;

int main() {
	scanf("%d %d", &N, &M);
	for(int i=0, x, y; i<M; i++) {
		scanf("%d %d", &x, &y);
		v[x].push_back(y), v[y].push_back(x);
	}
	q.push(1);
	for(int i=2; i<=N; i++) D[i] = 1e9;
	while(!q.empty()) {
		int u = q.front(); q.pop();
		for(auto it : v[u]) {
			if(D[it] > D[u] + 1) {
				D[it] = D[u] + 1;
				pre[it] = u;
				q.push(it);
			}
		}
	}
	for(int i=2; i<=N; i++) if(!pre[i]) return puts("No"),0;
	puts("Yes");
	for(int i=2; i<=N; i++) printf("%d\n", pre[i]);
}

Measured memory_bytes: 11008
/*input
2002
2017
*/
#include <bits/stdc++.h>
using namespace std;
const long long md=1e9+7;
long long a[1000005],n;

int main(){
	#ifdef ONLINE_JUDGE
	ios_base::sync_with_stdio(0);
	cin.tie(0);cout.tie(0);
	#endif
	long long q,m,k,h,ans=0,sum=0,p,x,y;
	cin>>x>>y;
	cout<<x+2*(y-x);
}

Measured memory_bytes: 256
/*
	*	Created By: 'Present_Sir'
	*	Created On: Friday 14 August 2020 12:57:08 PM IST
*/

#include<bits/stdc++.h>
#define IOS ios_base::sync_with_stdio(false); cin.tie(NULL)
#define int long long
using namespace std;


void solve(){
    int n;
    cin>>n;
    
    int ans = 0;
    for(int i=1; i<=n; ++i){
        if(i%3 == 0 or i%5 == 0){
            continue;
        }
        ans += i;
    }
    cout<<ans<<endl;
}

int32_t main(){
    IOS;
    //int t; cin>>t; while(t--)
    {
        solve();
    }
    return 0;
}



Measured memory_bytes: 3612
#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 unsigned long long ull;
typedef long double ld; 
typedef tree<ii, null_type, less<ii>, rb_tree_tag, tree_order_statistics_node_update> pbds;

int a[333333];

int main()
{
	ios_base::sync_with_stdio(0); cin.tie(0);
	int n; cin>>n;
	for(int i=0;i<n;i++) 
	{
		cin>>a[i]; a[i]--;
	}
	int mx=-1; bool dir=0; //dir=1 => all look left 
	for(int i=0;i<n;i++)
	{
		if(a[i]==i) 
		{
			if(mx!=-1){cout<<"No\n"; return 0;}
			continue;
		}
		if(mx==-1)
		{
			mx=a[i];
			assert(a[i]>i);
			if(a[i+1]!=i+1){cout<<"No\n"; return 0;}
			i++;
		}
		else
		{
			if(a[i]>i)
			{
				if(dir){cout<<"No\n"; return 0;}
				if(a[i]<mx){cout<<"No\n"; return 0;}
				mx=a[i];
				if(a[i+1]!=i+1){cout<<"No\n"; return 0;}
				i++;
			}
			else
			{
				if(a[i-2]<i-2&&a[i-2]>a[i]){cout<<"No\n"; return 0;}
				if(mx==i)
				{
					dir=0; mx=-1;
				}
				else
				{
					if(a[i+1]!=i+1){cout<<"No\n"; return 0;}
					i++;
				}
			}
		}
	}
	if(mx!=-1){cout<<"No\n"; return 0;}
	cout<<"Yes\n";
}


Measured memory_bytes: 1536
#include <bits/stdc++.h>
#define ll long long
#define ff first
#define ss second
#define PB push_back
#define MP make_pair
#define pri 1000000007
#define all(x) x.begin(),x.end()
#define mx 32
using namespace std;

void masterstroke(){
ll n;
cin>>n;
ll a[n];
vector <ll> ans;
for(ll i=0;i<n;i++){
	cin>>a[i];
	ans.PB(a[i]);
}
  sort(all(ans));
ll e=ans.size();
ll f1=ans[e-1];
ll f2=ans[e-2];
for(ll i=0;i<n;i++){
	if(a[i]==f1){cout<<f2<<endl;}
	else cout<<f1<<endl;
}


}


int main() {
	ll t=1;
	//cin>>t;
	for(ll i=0;i<t;i++)masterstroke();
	
	// your code goes here
	return 0;
}


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

int main() {
	int n;
	cin >> n;
	vector<int> a(n), b(n);
	for (auto& e : a) {
		cin >> e;
	}
	for (auto& e : b) {
		cin >> e;
	}
	ll x = 0, y = 0;
	for (int i = 0; i < n; i++) {
		if (a[i] < b[i]) {
			x += (b[i] - a[i] + 1) / 2;
			y += (b[i] - a[i]) % 2;
		} else if (b[i] < a[i]) {
			y += a[i] - b[i];
		}
	}
	cout << (x >= y ? "Yes" : "No") << endl;
	return 0;
}


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

#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define size_t unsigned long long
#define ll long long
#define rep(i,a) for(int i=0;i<(a);i++)
#define repr(i,a) for(int i=(int)(a)-1;i>=0;i--)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define FORR(i,a,b) for(int i=(int)(b)-1;i>=a;i--)
#define ALL(a) a.begin(), a.end()
using namespace std;
int si() { int x; scanf("%d", &x); return x; }
long long sl() { long long x; scanf("%lld", &x); return x; }
string ss() { string x; cin >> x; return x; }
void pi(int x) { printf("%d ", x); }
void pl(long long x) { printf("%lld ", x); }
void pd(double x) { printf("%.15f ", x); }
void ps(const string &s) { printf("%s ", s.c_str()); }
void br() { putchar('\n'); }

const ll MOD = 1e9 + 7;
const ll INF = 1e9 + 5;

struct mint {
    int n;
    mint(int n_ = 0) : n(n_) {}
};

mint operator+(mint a, mint b) { a.n += b.n; if (a.n >= MOD) a.n -= MOD; return a; }
mint operator-(mint a, mint b) { a.n -= b.n; if (a.n < 0) a.n += MOD; return a; }
mint operator*(mint a, mint b) { return (long long)a.n * b.n % MOD; }
mint &operator+=(mint &a, mint b) { return a = a + b; }
mint &operator-=(mint &a, mint b) { return a = a - b; }
mint &operator*=(mint &a, mint b) { return a = a * b; }

typedef pair<int, int> P;

const ll N = 1e6+5;
string s;
vector<ll> v[N];
ll n;
ll a[N];

map<ll, ll> res;

// 素因数分解O(ルートn)
template <typename T> void prime_factor(T n) {
  for(ll i = 2; i*i <= n; i++) {
    while(n%i == 0) {
      ++res[i];
      n /= i;
    }
  }
  if(n != 1) res[n]++;
}

ll mod(ll a, ll m) {
    return (a % m + m) % m;
}

// a*b/m
ll mul(ll a, ll b, ll m) {
    a = mod(a, m); b = mod(b, m);
    if (b == 0) return 0;
    ll res = mul(mod(a + a, m), b>>1, m);
    if (b & 1) res = mod(res + a, m);
    return res;
}

int main () {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  cin >> n;
  for(int i = 1; i <= n; i++) {
    prime_factor(i);
  }
  ll result = 1;
  rep(i,n) {
    result = mul(result, res[i+1] + 1, MOD);
  }
  cout << result << endl;
}


Measured memory_bytes: 25472
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <string>
#include <cmath>
#include <stack>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <list>
#include <iostream>
#include <sstream>
#include <climits>
#include <cfloat>
#include <complex>


typedef long long ll;
const double Eps = 1e-4;

using namespace std;

int main()
{
	int n[2];
	int h[2][100];
	int r[2][100];

	while (scanf("%d", n), *n)
	{
		for (int i = 1; i <= n[0]; ++i)
			scanf("%d %d", h[0]+i, r[0]+i);
		scanf("%d", n+1);
		for (int i = 1; i <= n[1]; ++i)
			scanf("%d %d", h[1]+i, r[1]+i);
		h[0][0] = h[1][0] = r[0][0] = r[1][0] = 0;
		h[0][n[0]+1] = h[1][n[1]+1] = r[0][n[0]+1] = r[1][n[1]+1] = 10000;

		int ans = 0;
		for (int w = 0; w < 2; ++w)
		{
			int* ha = h[w];
			int* hb = h[(w+1)%2];
			int* ra = r[w];
			int* rb = r[(w+1)%2];

			int sum = n[w];
			int j = 1;
			for (int i = 0; i < n[w]+1 && j <= n[w]; ++i)
			{
				while (hb[j] < ha[i] || rb[j] < ra[i])
					++j;
				while (ha[i] < hb[j] && hb[j] < ha[i+1]
					&& ra[i] < rb[j] && rb[j] < ra[i+1])
					{
						++sum;
						++j;
					}
			}
			if (sum > ans)
				ans = sum;
		}
		printf("%d\n", ans);
	}

	return 0;
}

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

#define rep(i, n) for(int (i) = 0; (i) < (n); (i)++)
#define repn(i, n) for(int (i) = 1; (i) <= (n); (i)++)
#define repr(i, n) for(int (i) = (n-1); (i) >= 0; (i)--)
#define all(x) (x).begin(), (x).end()
#define lint long long
#define ulint unsigned long long
#define fi first
#define se second
#define setpre(x) cout << fixed << setprecision(x)
#define ii(x) int x; cin >> (x)
#define ii2(x, y) int x, y; cin >> (x) >> (y)
#define ii3(x, y, z) int x, y, z; cin >> (x) >> (y) >> (z)
#define out(x) cout << (x) << endl
#define yn(x) cout << ((x)?("Yes"):("No")) << endl
#define YN(x) cout << ((x)?("YES"):("NO")) << endl
#define bit_c(x) __builtin_popcountll(x)

inline void logger(){ cout << endl; }
template<typename A, typename... B>
void logger(const A& a, const B&... b){
    cout << a << " , ";
    logger(b...);
}

typedef pair<lint, lint> P;
const lint MOD = 1000000007;
const lint MOD9 = 998244353;
const lint INF = MOD * MOD;
const int MAX = 200005;

/* ...o(^-^)o... */

int main(){
    lint n, k; cin >> n >> k; lint ans = 0;
    while(n > 0){
        n /= k;
        ans ++;
    }
    out(ans);
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
int a,b,c,n,ans=0;
int main()
{
	cin>>a>>b>>c>>n;
	for(int i=a;i>=0;i--)
	{
		if(i*500+b*100+c*50==n)
		{
			cout<<++ans<<endl;
			return 0;
		}
		if(i*500+b*100+c*50<n)
		{
			cout<<ans<<endl;
			return 0;
		}
		if(i*500<=n)
		{
			for(int j=b;j>=0;j--)
			{
				if(i*500+j*100+c*50<n)break;
				if(i*500+j*100<=n)
				{
					for(int k=c;k>=0;k--)
					{
						if(i*500+j*100+k*50<n)break;
						if(i*500+j*100+k*50==n)ans++;
					}
				}
			}
		}
	}
	cout<<ans<<endl;
}

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

#define MAXN 100010
#define ll long long
#define mod 1000000007

using namespace std;

int n;
string s;

int main() {
	cin >> s;
	int l = 0, r = s.length() - 1;
	while (l < r) {
		if (s[l] != s[r]) n+=1;
		l++;r--;
	}
	cout << n << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define rep(i, n) for (ll i = 0; i < n; ++i)
#define ALL(a) a.begin(), a.end()
ll dx[4] = { 0, 1, 0, -1 };
ll dy[4] = { 1, 0, -1, 0 };
const ll INF = 1e14;
const ll MOD = 1e9 + 7;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    int N, K;
    cin >> N >> K;
    string S;
    cin >> S;
    int cnt = 0;
    for (int i = 1; i < N; i++) {
        if (S[i - 1] == S[i]) {
            cnt++;
        }
    }
    int ans = min(cnt + 2 * K, N - 1);
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 512
from math import gcd

class SegmentTree:
    """Segment Tree

    Attributes:
        n (int):       要素数
        num (int):     n以上の最小の2の累乗
        ide_ele (int): 単位元
            - RmQ(Range Minimum Query): inf
            - RMQ(Range Maximum Query): -1
            - RSQ(Range Sum Query):     0
            - RPQ(Range Product Query): 1
            - RGQ(Range GCD Query):     0
        seg (list):    要素の格納先
    """
    def __init__(self, a):
        """初期化 O(N)
        
        Args:
            a (list): 対象の配列
        """
        self.n = len(a)
        self.num = 2 ** (self.n - 1).bit_length()
        self.ide_ele = 0
        self.seg = [self.ide_ele] * (2*self.num-1)

        for i in range(self.n):
            self.seg[self.num+i-1] = a[i]    
        for i in range(self.num-2, -1, -1) :
            self.seg[i] = self.st_func(self.seg[2*i+1], self.seg[2*i+2])

    def query(self, l, r):
        """区間クエリの計算 O(logN)

        Args:
            l (int): 区間の左端
            r (int): 区間の右端
        
        Returns:
            int: [l, r)についての区間クエリ
        """
        if r <= l:
            return self.ide_ele
        
        l += self.num - 1
        r += self.num - 2
        res = self.ide_ele

        while r - l > 1:
            if l % 2 == 0:
                res = self.st_func(res, self.seg[l])
            if r % 2 == 1:
                res = self.st_func(res, self.seg[r])
                r -= 1
            l = l // 2
            r = (r - 1) // 2
        
        if l == r:
            res = self.st_func(res, self.seg[l])
        else:
            res = self.st_func(res, self.st_func(self.seg[l], self.seg[r]))
        
        return res

    def update(self, i, v):
        """値の更新 O(logN)

        Args:
            i (int): 更新対象のindex
            v (int): 更新値
        """
        i += self.num - 1
        self.seg[i] = v
        while i > 0:
            i = (i - 1) // 2
            self.seg[i] = self.st_func(self.seg[i*2+1], self.seg[i*2+2])
    
    def st_func(self, x, y):
        """問題に応じた処理

        Returns:
            int: 問題に応じた値
                - RmQ(Range Minimum Query): min(x, y)
                - RMQ(Range Maximum Query): max(x, y)
                - RSQ(Range Sum Query):     x + y
                - RPQ(Range Product Query): x * y
                - RGQ(Range GCD Query):     gcd(x, y)
        """
        return gcd(x, y)


n = int(input())
a = list(map(int, input().split()))

st = SegmentTree(a)

res = 0
for i in range(n):
    res = max(res, gcd(st.query(0, i), st.query(i+1, n)))

print(res)

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

#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORTASC(c) sort((c).begin(),(c).end())
#define SORTDESC(c,t) sort((c).begin(),(c).end(), std::greater<t>());
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define VMAX(a) *max_element(ALL(a))
#define VMIN(a) *min_element(ALL(a))
#define OUT(a) cout << (a) << endl;
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

const double PI  = acos(-1.0);

template <class T, class S>
using umap = std::unordered_map<T, S>;
using ll = long long;
using namespace std;

int main() {
    ll x, n = 100;
    ll p[200010];
    string s;

    cin >> x;

    ll ct = 0;
    while(true){
      if (n >= x) {
        cout << ct << endl;
        break;
      }
      n *= 1.01;
      ct++;
    }

    return 0;
}

Measured memory_bytes: 3632
z=int(input())
#1と6の時は5
#他はすべて6出せる。
#つまり基本的には6,5,6,5,6,,,,と続けられます。
#11で割ってあげた余りが6より大きいか小さいかで5を追加するか考える。

ans=z//11
if z-(ans*11)==0:
  print(ans*2)
elif z-(ans*11)>6:
  print(ans*2+2)
else:
  print(ans*2+1)

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

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

int main()
{
	char n[3];
	scanf("%s", n);
	
	int s=strlen(n)-1;
	if(n[s]=='2' || n[s]=='4' || n[s]=='5' || n[s]=='7' || n[s]=='9' ){ printf("hon"); }
	else if(n[s]=='0' || n[s]=='1' || n[s]=='6' || n[s]=='8'){ printf("pon"); }
	else{ printf("bon"); }
	
	return 0;
}


Measured memory_bytes: 1724
/////////////////////////////////////////////////////////////////////////////////
//$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$'               `$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$//  
//$$$$$$$$$$$$$$$$$$$$$$$$$$$$'                   `$$$$$$$$$$$$$$$$$$$$$$$$$$$$//
//$$$'`$$$$$$$$$$$$$'`$$$$$$!                       !$$$$$$'`$$$$$$$$$$$$$'`$$$//
//$$$$  $$$$$$$$$$$  $$$$$$$                         $$$$$$$  $$$$$$$$$$$  $$$$//
//$$$$. `$' \' \$`  $$$$$$$!       $$        $$      !$$$$$$$  '$/ `/ `$' .$$$$//
//$$$$$. !\  i  i .$$$$$$$$       $$$$      $$$$      $$$$$$$$. i  i  /! .$$$$$//
//$$$$$$   `--`--.$$$$$$$$$        $$        $$       $$$$$$$$$.--'--'   $$$$$$//
//$$$$$$L        `$$$$$^^$$                           $$^^$$$$$'        J$$$$$$//
//$$$$$$$.   .'   ""~   $$$    $.                 .$  $$$   ~""   `.   .$$$$$$$//
//$$$$$$$$.  ;      .e$$$$$!    $$.             .$$  !$$$$$e,      ;  .$$$$$$$$//
//$$$$$$$$$   `.$$$$$$$$$$$$     $$$.         .$$$   $$$$$$$$$$$$.'   $$$$$$$$$//
//$$$$$$$$    .$$$$$$$$$$$$$!     $$`$$$$$$$$'$$    !$$$$$$$$$$$$$.    $$$$$$$$//
//$$$$$$$     $$$$$$$$$$$$$$$$.    $    $$    $   .$$$$$$$$$$$$$$$$     $$$$$$$//
//                                 $    $$    $								   //
//                                 $.   $$   .$								   //
//                                `$        $'								   //
//                                 `$$$$$$$$'								   //
/////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////

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

// Type-Define 
typedef long long ll;
typedef std::vector<int> vi;
typedef std::vector<std::string> vs;
typedef std::vector<char> vc;
typedef std::vector< vector<int> > vii;
typedef std::pair<int, int> pii;

// Hash-Define
#define int long long
#define MOD 1000000007
#define debugStart cerr << "\n[DEBUG START]\n"
#define debugStop cerr << "\n[DEBUG STOP]\n"
#define KHATAM cout << std::endl;
#define set_zero(x) memset(x, 0, sizeof(x));
#define ForPrint(x) std::for_each( begin(x), end(x), []( auto const& el ){ std::cout << el << " ";  } )

//Functions 
template<typename T> auto gcd ( T a, T b ) -> int  { return (b==0)?a:gcd(b,a%b); }

const int inf = 1e9 + 5;

std::vector< int > weight;
std::vector< int > value;
int N, W;

auto solve () -> int {
    
    int dp[W + 1];
    memset(dp, 0, sizeof(dp));
    dp[0] = 0;
    for ( int i = 0; i < N; ++i ) {
        for ( int j = W; j >= 0; --j  ) {
            if ( ( weight[i] + j) <= W ) {
                dp[weight[i] + j] = max(dp[ weight[i]+j], dp[j] + value[i]);
            }
        }
    }
    return dp[W];
}

signed
main() {

    ios::sync_with_stdio(0);
    cin.tie(0);
    int T = 1; 
    //cin >> T;
    for ( int testcase = 1; testcase <= T; ++testcase ) {
        
        std::cin >> N >> W;
        weight= std::vector<int>(N);
        value = std::vector<int>(N);
        for ( int i = 0; i < N; ++i ) {
            std::cin >> weight[i] >> value[i];    
        }
        std::cout << solve();
        KHATAM;
    }
    return 0;
}


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


int main() { // drkenさんの提出
  int N; cin >> N;
  vector<int> h(N);
  for (int i = 0; i < N; ++i) cin >> h[i];

  // 高さが全部 0 になるまでやる
  int res = 0;
  while (true) {
    // 最高高さが 0 だったらおしまい
    if (*max_element(h.begin(), h.end()) == 0) break;

    // 区間分割する
    int i = 0;
    while (i < N) {
      if (h[i] == 0) ++i; // 0 なら何もせずに次に進む
      else {
        ++res; // 区間の始まり
        while (i < N && h[i] > 0) {
          --h[i]; // 引くことで，残り必要な高さを変更
          ++i; // 区間の終わりまで一気に
        }
      }
    }
  }
  cout << res << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define pb push_back
#define all(a) a.begin(), a.end()
#define sz(a) (int)a.size()
#define x first
#define y second
#define debug(...) cout << "[" << #__VA_ARGS__ << ": " << __VA_ARGS__ << "]\n"
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int, int>pii;
const int maxn = 1e4 + 100;
const int mod = 1e9 + 7;
mt19937 rng(chrono::high_resolution_clock::now().time_since_epoch().count());
string k;
int d;
ll dp[maxn][110][2];
ll solve(int i, int re, int f)
{
    if(i == sz(k)) return re == 0;
    if(dp[i][re][f] != -1) return dp[i][re][f];
    ll tot = 0;
    for(int j = 0; j < 10; j++)
    {
        if(f == 1 && (k[i] - '0') < j) break;
        int nf;
        if(f == 0 || (k[i] - '0') > j) nf = 0;
        else nf = 1;
        tot += solve(i + 1, (re + j) % d, nf);
        tot %= mod;
    }
    return dp[i][re][f] = tot;
}
int main()
{
    ios_base::sync_with_stdio(false), cin.tie(0);
    cin >> k >> d;
    memset(dp, -1, sizeof dp);
    cout << (solve(0, 0, 1) - 1 + mod) % mod<< "\n";
    return 0;
}


Measured memory_bytes: 18432
#include <stdio.h>

int main(void)
{
	int x, y;
	
	scanf("%d %d", &x, &y);
	
	if(x == 2 && y == 2)
		printf("Yes\n");
	else if( (x != 2 && y!= 2) 
		&& ( ( (x<8) && (x%2 == 1) ) || ( (x>7) && (x%2 == 0) ) )
		&& ( ( (y<8) && (y%2 == 1) ) || ( (y>7) && (y%2 == 0) ) ) )
		printf("Yes\n");
	else if( (x != 2 && y!= 2)
		&& ( ( (x<8) && (x%2 == 0) ) || ( (x>7) && (x%2 == 1) ) )
		&& ( ( (y<8) && (y%2 == 0) ) || ( (y>7) && (y%2 == 1) ) ) )
		printf("Yes\n");
	else
		printf("No");
	
	return 0;
}


Measured memory_bytes: 128
import math
n,d=map(int, input().split())
List=[list(map(int, input().split())) for i in range(n)]
ans = 0
for i in range(n - 1):
    for j in range(i + 1, n):
        ddist=0
        for k in range(d):
            ddist = ddist + (List[i][k] - List[j][k]) ** 2
        dist = int(math.sqrt(ddist))
        if dist ** 2 == ddist:
            ans = ans + 1
print(ans)


Measured memory_bytes: 3064
#pragma GCC optimize(3)
#include<bits/stdc++.h>
using namespace std;
const int N=1000005;
int n,cnt,t[N],ch[N][26],dp[N][26];
string a[N];
map<string,int>mp;
long long ans;
bool cmp(string a,string b)
{
	return a.size()!=b.size()?a.size()<b.size():a<b;
}
int main()
{
	ios::sync_with_stdio(false);
	cin>>n;
	for(int i=1;i<=n;i++)
		cin>>a[i];
	sort(a+1,a+n+1,cmp);
	for(int i=1;i<=n;i++)
	{
		for(int k=0;k<26;k++)
			t[k]=0;
		for(int j=0;j<a[i].size();j++)
			t[a[i][j]-'a']++;
		int u=0;
		for(int k=0;k<26;k++)
		{
			if(t[k]==0)
				continue;
			ans+=dp[u][k];
		}
		if(a[i].size()==1)
			dp[u][a[i][0]-'a']++;
		for(int j=a[i].size()-1;j>=0;j--)
		{
			int x=a[i][j]-'a';
			if(ch[u][x]==0)
				ch[u][x]=++cnt;
			u=ch[u][x];
			t[x]--;
			for(int k=0;k<26;k++)
			{
				if(t[k]==0)
					continue;
				ans+=dp[u][k];
			}
			if(j==1)
				dp[u][a[i][0]-'a']++;
		}
	}
	cout<<ans<<endl;
	return 0;
}


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

// auto mod int
// https://youtu.be/L8grWxBlIZ4?t=9858
// https://youtu.be/ERZuLAxZffQ?t=4807 : optimize
// https://youtu.be/8uowVvQ_-Mo?t=1329 : division
const int mod = 1000000007;
//const int mod = 998244353;
struct mint {
  ll x; // typedef long long ll;
  mint(ll x=0):x((x%mod+mod)%mod){}
  mint operator-() const { return mint(-x);}
  mint& operator+=(const mint a) {
    if ((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += mod-a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*=(const mint a) { (x *= a.x) %= mod; return *this;}
  mint operator+(const mint a) const { return mint(*this) += a;}
  mint operator-(const mint a) const { return mint(*this) -= a;}
  mint operator*(const mint a) const { return mint(*this) *= a;}
  mint pow(ll t) const {
    if (!t) return 1;
    mint a = pow(t>>1);
    a *= a;
    if (t&1) a *= *this;
    return a;
  }

  // for prime mod
  mint inv() const { return pow(mod-2);}
  mint& operator/=(const mint a) { return *this *= a.inv();}
  mint operator/(const mint a) const { return mint(*this) /= a;}
};
istream& operator>>(istream& is, mint& a) { return is >> a.x;}
ostream& operator<<(ostream& os, const mint& a) { return os << a.x;}


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

  int c[] = {0, 0, 0};
  mint ans = 1;

  rep(i, n){
    bool first = true;
    int cnt = 0;
    rep(j, 3){
      if(c[j] == a[i]){
        if(first){
          c[j]++;
          first = false;
        }
        cnt++;
      }
    }
    ans *= cnt;
  }
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 3960