akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define rep(i, a, b) for(register int i = a; i <= b; i++)
#define per(i, a, b) for(register int i = a; i >= b; i--)
using namespace std;

typedef unsigned long long ull;
typedef pair <int, int> pii;
typedef long long ll;

template <typename _T>
inline void read(_T &f) {
    f = 0; _T fu = 1; char c = getchar();
    while(c < '0' || c > '9') { if(c == '-') fu = -1; c = getchar(); }
    while(c >= '0' && c <= '9') { f = (f << 3) + (f << 1) + (c & 15); c = getchar(); }
    f *= fu;
}

template <typename T>
void print(T x) {
    if(x < 0) putchar('-'), x = -x;
    if(x < 10) putchar(x + 48);
    else print(x / 10), putchar(x % 10 + 48);
}

template <typename T>
void print(T x, char t) {
    print(x); putchar(t);
}

const int N = 85;

bitset <12800 * 2 + 5> f[N][N];
int a[N][N];
int n, m;

int main() {
    read(n); read(m);
    for(register int i = 1; i <= n; i++) {
        for(register int j = 1; j <= m; j++) {
            read(a[i][j]);
        }
    }
    for(register int i = 1; i <= n; i++) {
        for(register int j = 1; j <= m; j++) {
            int x; read(x);
            a[i][j] = abs(a[i][j] - x);
        }
    }
    f[1][1][a[1][1] + 12800] = 1;
    for(register int i = 1; i <= n; i++) {
        for(register int j = 1; j <= m; j++) {
            if(i != n) {
                f[i + 1][j] |= (f[i][j] << a[i + 1][j]);
                f[i + 1][j] |= (f[i][j] >> a[i + 1][j]);
            }
            if(j != m) {
                f[i][j + 1] |= (f[i][j] << a[i][j + 1]);
                f[i][j + 1] |= (f[i][j] >> a[i][j + 1]);
            }
        }
    }
    for(register int i = 12800; i <= 25600; i++) {
        if(f[n][m][i]) {
            print(i - 12800, '\n');
            return 0;
        }
    }
    return 0;
}

Measured memory_bytes: 22400
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <unordered_map>
#include <functional>
#include <utility>
#include <tuple>
#include <cctype>
#include <bitset>
#include <complex>
#include <cmath>
#include <array>
#include <numeric>
using namespace std;
#define INF 0x3f3f3f3f
#define INFLL 0x3f3f3f3f3f3f3f3fLL
//#define mod 998244353
#define MOD 1000000007
#define mp make_pair
#define mt make_tuple
#define pb push_back
#define eb emplace_back
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<int, int> pint;
typedef pair<ll,ll> pll;
typedef tuple<int,int,int> tint;
typedef vector<int> vint;
typedef vector<ll> vll;
typedef vector<ull> vull;
typedef vector<pint> vpint;
int dx[8]={0,0,-1,1,1,1,-1,-1};
int dy[8]={-1,1,0,0,1,-1,1,-1};
const int SIZE=200050;
//templete
int main() {
    int A,B,T;
    cin>>A>>B>>T;
    cout<<(T/A)*B<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <math.h>
#define N 10001

int PrimeNumber(int x){
    if(x < 2 || x % 2 == 0) {   // 偶数なら
        if (x == 2) return 1;
        else return 0;
    }
    else{               // 奇数なら
        int i = 3;
        while(i <= sqrt(x)){
            if(x % i == 0) return 0;
            i = i + 2;      // 調べるのは奇数だけで良い
        }
        return 1;
    }
}

int main(){
    int i, n, arr[N];
    int cnt = 0;
    scanf("%d", &n);
    for(i = 0; i < n; i++) {
        scanf("%d", &arr[i]);
        int check = PrimeNumber(arr[i]);
        if(check == 1) cnt++;
    }
    printf("%d\n", cnt);
    return 0;
}

Measured memory_bytes: 632
import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		Scanner sc=new Scanner(System.in);
		double x1=sc.nextDouble();
		double y1=sc.nextDouble();
		double x2=sc.nextDouble();
		double y2=sc.nextDouble();
		double a=0;
		if(x1>x2) {
			if(y1>y2) {
				a=Math.sqrt(Math.pow(x1-x2, 2)+Math.pow(y1-y2, 2));
			}
			else  {
				a=Math.sqrt(Math.pow(x1-x2, 2)+Math.pow(y2-y1, 2));
			}
		}
			else {
				if(y1>y2) {
					a=Math.sqrt(Math.pow(x2-x1, 2)+Math.pow(y1-y2, 2));
				}
				else {
					a=Math.sqrt(Math.pow(x2-x1, 2)+Math.pow(y2-y1, 2));
				}
			}
		System.out.println(a);
		sc.close();
		}

	}


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

using VS = vector<string>;    using LL = long long;
using VI = vector<int>;       using VVI = vector<VI>;
using PII = pair<int, int>;   using PLL = pair<LL, LL>;
using VL = vector<LL>;        using VVL = vector<VL>;

#define ALL(a)  begin((a)),end((a))
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define SZ(a) int((a).size())
#define SORT(c) sort(ALL((c)))
#define RSORT(c) sort(RALL((c)))
#define UNIQ(c) (c).erase(unique(ALL((c))), end((c)))
#define FOR(i, s, e) for (int(i) = (s); (i) < (e); (i)++)
#define FORR(i, s, e) for (int(i) = (s); (i) > (e); (i)--)
#define debug(x) cerr << #x << ": " << x << endl
const int INF = 1e9;                          const LL LINF = 1e16;
const LL MOD = 1000000007;                    const double PI = acos(-1.0);
int DX[8] = { 0, 0, 1, -1, 1, 1, -1, -1 };    int DY[8] = { 1, -1, 0, 0, 1, -1, 1, -1 };

/* -----  2018/03/04  Problem: 070_arc_b / Link: https://abc056.contest.atcoder.jp/tasks/arc070_b?lang=en  ----- */
/* ------問題------



-----問題ここまで----- */
/* -----解説等-----

これ嘘解法やん

----解説ここまで---- */

LL N,K;

LL ans = 0LL;

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

	cin >> N>>K;
	VL a(N);
	FOR(i, 0, N) {
		cin >> a[i];
	}

	RSORT(a);
	FOR(i, 0, N) {
		LL ret = 0;
		FOR(j, 0, N) {
			if (i == j)continue;
			if (ret + a[j] < K) {
				ret += a[j];
			}
		}
		if (ret + a[i] >= K) {
			ans++;
		}

	}

	cout << N - ans << "\n";

	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <stdio.h>
#include <string>
#include <math.h>
#include <vector>
#include <algorithm>
#include <functional>
#include <map>
#include <climits>
#include <memory>
#include <sstream>
#include <iomanip>

using namespace std;

long long ans = 0;
long long n;

void f(long long m) {
	if (n < m)return;
	string str = to_string(m);
	if (str.find('7') != string::npos &&
		str.find('5') != string::npos &&
		str.find('3') != string::npos) {
		ans++;
	}
	f(m * 10 + 3);
	f(m * 10 + 5);
	f(m * 10 + 7);
	return;
}

int main() {
	cin >> n;
	f(3);
	f(5);
	f(7);
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 256
//#pragma GCC optimize("Ofast")
//#pragma GCC optimize("unroll-loops")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using db = double;
using ld = long double;
template<typename T> using V = vector<T>;
template<typename T> using VV = vector<vector<T>>;
#define fs first
#define sc second
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define eb emplace_back
#define lb lower_bound
#define ub upper_bound
#define all(v) (v).begin(),(v).end()
#define siz(v) (ll)(v).size()
#define rep(i,a,n) for(ll i=a;i<(ll)(n);++i)
#define repr(i,a,n) for(ll i=n-1;(ll)a<=i;--i)
#define ENDL '\n'
typedef pair<int,int> Pi;
typedef pair<ll,ll> PL;
constexpr ll mod = 1000000007;
constexpr ll INF = 1000000099;
constexpr ll LINF = (ll)(1e18 +99);
const vector<ll> dx={-1,1,0,0},dy={0,0,-1,1};
template<typename T,typename U> inline bool chmin(T& t, const U& u){if(t>u){t=u;return 1;}return 0;}
template<typename T,typename U> inline bool chmax(T& t, const U& u){if(t<u){t=u;return 1;}return 0;}
template<typename T> inline T gcd(T a,T b){return b?gcd(b,a%b):a;}
template<typename T,typename Y> inline T mpow(T a, Y n) {
  T res = 1;
  for(;n;n>>=1) {
    if (n & 1) res = res * a;
    a = a * a;
  }
  return res;
}

ll dp[200010][3]={};

signed main(){
  cin.tie(0);ios::sync_with_stdio(false);
  cout<<fixed<<setprecision(20);
  ll n;cin>>n;
  V<ll> v(n);rep(i,0,n)cin>>v[i];
  rep(i,0,200010)rep(j,0,3)dp[i][j]=-LINF;
  
  dp[0][0]=0;
  dp[1][1]=0;
  if(n%2)dp[2][2]=0;

  rep(i,0,n){
    chmax(dp[i+2][0],dp[i][0]+v[i]);
    chmax(dp[i+2][1],dp[i][1]+v[i]);
    chmax(dp[i+2][2],dp[i][2]+v[i]);


    chmax(dp[i+3][1],dp[i][0]+v[i]);
    chmax(dp[i+3][2],dp[i][1]+v[i]);
    chmax(dp[i+4][2],dp[i][0]+v[i]);
  }

  if(n%2==0)cout<<max(dp[n+1][1],dp[n][0])<<ENDL;
  else cout<<max({dp[n+1][2],dp[n][1],dp[n-1][0]})<<ENDL;
}
//! ( . _ . ) ! 
//CHECK overflow,vector_size,what to output?

Measured memory_bytes: 9520
#include <bits/stdc++.h>
using namespace std;
using i64 = long long;
#define rep(i,s,e) for(i64 (i) = (s);(i) < (e);(i)++)
#define all(x) x.begin(),x.end()
#define let auto const

template<typename... Types>
struct dynarr: std::vector<Types...> {
  using std::vector<Types...>::vector;
  using size_type = typename std::vector<Types...>::size_type;
  auto&& operator[](size_type i) { return this->at(i); }
  auto&& operator[](size_type i) const { return this->at(i); }
};

vector<vector<i64>> aG;
vector<vector<i64>> G;
vector<vector<i64>> rG;

vector<i64> res;
vector<i64> cnt;
vector<i64> ok;

i64 AA = 0;

bool dfs(i64 v, i64 f) {
  //cout << v << " " << f << endl;
  for(i64 x: aG[v]) {
    cnt[x]++;
  }
  for(i64 x: G[v]) {
    cnt[x]--;
    if(cnt[x] == 1 && ok[x] == 1) {
      res.push_back(x);
      res.push_back(v);
      return true;
    }
    if(cnt[x] == 0 && dfs(x, v)) {
      res.push_back(v);
      return true;
    }
    cnt[x]++;
  }
  for(i64 x: aG[v]) {
    cnt[x]--;
  }
  cnt[v] = 1e9;
  return false;
}

int main() {
  i64 N, M;
  cin >> N >> M;
  aG.resize(N);
  G.resize(N);
  rG.resize(N);
  cnt.resize(N);
  rep(i,0,M) {
    i64 a, b;
    cin >> a >> b;
    a--;
    b--;
    aG[a].push_back(b);
    aG[b].push_back(a);
    G[a].push_back(b);
    rG[b].push_back(a);
  }
  rep(i,0,N) {
    cnt.assign(N, 0);
    ok.assign(N, 0);
    for(i64 x: rG[i]) ok[x] = 1;
    if(dfs(i, -1)) {
      cout << res.size() << endl;
      for(auto x: res) {
        cout << x + 1 << endl;
      }
      return 0;
    }
  }
  cout << -1 << endl;
}


Measured memory_bytes: 512
def main():
    x, y = (int(i) for i in input().split())
    while x != 0 or y != 0:
        if x > y:
            x, y = y, x
        print(x,y)
        x, y = (int(i) for i in input().split())

if __name__ == '__main__':
    main()


Measured memory_bytes: 5616
#include<bits/stdc++.h>
using namespace std;
int main()
{
    map<long long int,long long int>m;
    long long int n,x,c=0;
    cin>>n;
    while(n--)
    {
        cin>>x;
        if(m[x]==0)
        {
            m[x]++;
        }
        else m[x]=0;
    }

    for( map<long long int,long long int>::iterator it=m.begin();it!=m.end();it++)
    {
        if(it->second==1) c++;
    }
    cout<<c<<endl;
    return 0;
}


Measured memory_bytes: 6528
import qualified Data.IntMap.Strict as M
import Control.Monad.State.Strict

main :: IO ()
main = do
  [n, m] <- map read . words <$> getLine
  bs <- sequence . replicate m $ unsafeListToTuple . map read . words <$> getLine
  sequence_ . map print . scanl1 (+) . evalState (foldr (flip (>>=) . f) (return []) bs) $ newUF
    where
      f (x, y) ls = do
        x' <- root' x
        y' <- root' y
        if x' == y'
          then
            return $ 0 : ls
          else
            do
              nx <- size x'
              ny <- size y'
              unite x' y'
              return $ (nx * ny) : ls

unsafeListToTuple :: [a] -> (a, a)
unsafeListToTuple (x : y : _) = (x, y)
unsafeListToTuple _ = undefined

type SizedUF = (M.IntMap Int, M.IntMap Integer)

newUF :: SizedUF
newUF = (M.empty, M.empty)

unite :: Int -> Int -> State SizedUF ()
unite x' y' = do
        nx <- size x'
        ny <- size y'
        (ps, cs) <- get
        put (M.insert y' x' ps, M.insert x' (nx + ny) cs)

find :: Int -> Int -> State SizedUF Bool
find x y = (==) <$> root' x <*> root' y

root :: Int -> State SizedUF (Maybe Int)
root x = do
  px <- M.lookup x . fst <$> get
  case px of
    Nothing -> return Nothing
    Just y -> do
      ry <- root y
      case ry of
        Nothing -> return px
        Just z -> do
          (ps, cs) <- get
          put (M.insert x z ps, cs)
          return ry

root' :: Int -> State SizedUF Int
root' x = maybe x id <$> root x

size :: Int -> State SizedUF Integer
size x = do
  (M.findWithDefault 1 x) . snd <$> get


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

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

typedef long long ll;
typedef long double ld;

const int INF = 1e9;
const ld EPS = 1e-8;

struct UnionFind {
  vector<int> data;
  UnionFind(int size) : data(size, -1) { }
  bool unionSet(int x, int y) {
    x = root(x); y = root(y);
    if (x != y) {
      if (data[y] < data[x]) swap(x, y);
      data[x] += data[y]; data[y] = x;
    }
    return x != y;
  }
  bool findSet(int x, int y) {
    return root(x) == root(y);
  }
  int root(int x) {
    return data[x] < 0 ? x : data[x] = root(data[x]);
  }
  int size(int x) {
    return -data[root(x)];
  }
};

int main(){
  int N, K, L;
  cin >> N >> K >> L;
  vector<int> p(K), q(K), r(L), s(L);
  REP(i,K) {
    cin >> p[i] >> q[i]; --p[i]; --q[i];
  }
  REP(i,L) {
    cin >> r[i] >> s[i]; --r[i]; --s[i];
  }

  UnionFind ufroad(N), ufline(N);
  REP(i,K) ufroad.unionSet(p[i], q[i]);
  REP(i,L) ufline.unionSet(r[i], s[i]);
  map<pair<int,int>,int> mp;
  REP(i,N) mp[make_pair(ufroad.root(i), ufline.root(i))] += 1;
  REP(i,N) {
    if(i) cout << " ";
    cout << mp[make_pair(ufroad.root(i), ufline.root(i))];
  }
  cout << endl;
  return 0;
}



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

int main(){
    string S,T;cin>>S>>T;
    int N=S.size(),M=T.size();
    if(N<M){
        cout<<"UNRESTORABLE"<<endl;
        return 0;
    }
    vector<string> ans;
    rep(i,N-M+1){
        int count=0;
        rep(j,M){
            if(S[i+j]=='?' or S[i+j]==T[j])count++;
            else if(S[i+j]!=T[j])break;
        }
        if(count==M){
            string now=S;
            rep(j,M){
                if(now[i+j]=='?')now[i+j]=T[j];
            }
            ans.push_back(now);
        }
    }
    if(ans.size()==0)cout<<"UNRESTORABLE"<<endl;
    else{
        rep(i,ans.size()){
            rep(j,N){
                if(ans[i][j]=='?')ans[i][j]='a';
            }
        }
        sort(ans.begin(),ans.end());
        cout<<ans.at(0)<<endl;
    }
    return 0;
}

Measured memory_bytes: 256
#[allow(unused_macros)]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}
 
#[allow(unused_macros)]
macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};
 
    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
 
    ($next:expr, mut $var:ident : $t:tt $($r:tt)*) => {
        let mut $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}
 
#[allow(unused_macros)]
macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };
 
    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };
 
    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };
 
    ($next:expr, bytes) => {
        read_value!($next, String).into_bytes()
    };
 
    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };
 
    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

fn main() {
    input! {
        h: usize,
        w: usize,
        hi: usize,
        wi: usize,
    }

    println!("{}", (h - hi) * (w - wi));
}


Measured memory_bytes: 4352
import java.util.*;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		String[] s=new String[n];
		
		for(int i = 0;i<n;i++){
	        String ss = sc.next();
	        int num = sc.nextInt();
	        int num2 = i+1;
	        //S[i]が同じ文字列だった場合、昇順ソート後の値でnumを比較するため
	        s[i] = ss + " " + 1/(double)num + " " + num2;
	    }
		
		Arrays.sort(s);
		 
	    for(String j:s){
	        System.out.println(j.split(" ")[2]);
	    }
		
		sc.close();
	}
}


Measured memory_bytes: 21716
// ProblemURL : https://atcoder.jp/contests/abc046/tasks/arc062_b
// ---------------------------------------------
package main

import "fmt"

func isEven(n int) bool { return n%2 == 0 }

func main() {
	var s string
	fmt.Scan(&s)
	n := len(s)

	score := 0
	for i := 0; i < n; i++ {
		if isEven(i) {
			if s[i] == 'p' {
				score--
			}
		} else {
			if s[i] == 'g' {
				score++
			}
		}
	}
	fmt.Println(score)
}


Measured memory_bytes: 1280
#include<bits/stdc++.h>
using namespace std;
int main()
{
  int l,r,k=0,ans=2019;
  cin>>l>>r;
  if(r-l>=2019)cout<<0<<endl;
  else
  {
  	for(int i=l;i<r;i++)
    {
      for(int j=l+1;j<=r;j++)
      {
        ans=min(ans,((i%2019)*(j%2019))%2019);
      }
    }
    cout<<ans<<endl;
  }
 return 0;
}

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

int main()
{
  int x, y;
  int c, i;

  while (cin >> x >> y && x != 0){
    if (x < y){
      c = x;
      x = y;
      y = c;
    }

    for (i = 0; y != 0; i++){
      x = x % y;
      c = x;
      x = y;
      y = c;
    }

    cout << x << " " << i << endl;
  }
}

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

#define ll long long
#define scl(n) scanf("%lld",&n)
#define scd(n) scanf("%d",&n)
#define pb push_back
#define mp make_pair
#define fr first
#define sc second

vector < pair < ll,ll > > vec;

ll tree[800005];

void up(ll node,ll l,ll r,ll i,ll x)
{
    if(l>i){
        return;
    }
    if(r<=i){
        tree[node]+=x;
        return;
    }
    ll ln=node*2,mid=(l+r)/2;
    tree[ln]+=tree[node];
    tree[ln+1]+=tree[node];
    tree[node]=0;
    up(ln,l,mid,i,x);
    up(ln+1,mid+1,r,i,x);
    return;
}

ll qry(ll node,ll l,ll r,ll i)
{
    if(l>i || r<i)
    {
        return 0;
    }
    if(l==r){
        return tree[node];
    }
    ll ln=node*2,mid=(l+r)/2;
    tree[ln]+=tree[node];
    tree[ln+1]+=tree[node];
    tree[node]=0;
    ll a=qry(ln,l,mid,i);
    ll b=qry(ln+1,mid+1,r,i);
    return a+b;
}


int main()
{
    ll n,m,i,j,k,a,b,c,x,y,z,p,q,lo,hi,mid;
    scl(n);
    scl(m);
    scl(p);
    vec.pb(mp(-1,0));
    for(i=1;i<=n;i++)
    {
        scl(a);
        scl(b);
        vec.pb(mp(a,b));
    }
    sort(vec.begin(),vec.end());
    ll ans=0;
    for(i=1;i<=n;i++)
    {
        x=qry(1,1,n,i);
        z=vec[i].sc-x;
        //cout<<i<< "   " <<vec[i].fr<< "   " <<x<<" "<<ans<<endl;
        if(z>0){
            y=z/p;
            z%p>0?y++:1;
            lo=1,hi=n;
            c=0;
            b=vec[i].fr+m+m;
            while(lo<=hi)
            {
                mid=(lo+hi)/2;
                if(vec[mid].fr<=b){
                    c=max(c,mid);
                    lo=mid+1;
                }
                else{
                    hi=mid-1;
                }
            }

            //a--;
            up(1,1,n,c,y*p);
            ans+=y;
        }
    }

    cout<<ans<<endl;


    return 0;
}



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

int f(int x){
    int i = 0;
    while(x > 0){
        x /= 10;
        i++;
    }
    //cout << "i:" << i;
    return i;
}

int main(){
    int n,res = 0;
    cin >> n;

    for(int i = 1; i <= n; i++){
        if(f(i) % 2 == 1){
            res++;
        }
    }
    cout << res << endl;
}

Measured memory_bytes: 256
import java.util.*;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[][] e = new int[n-1][3];
        for (int i = 0; i < n-1; i++) {
            e[i][0] = sc.nextInt()-1;
            e[i][1] = sc.nextInt()-1;
            e[i][2] = sc.nextInt();
        }
        int q = sc.nextInt();
        int k = sc.nextInt()-1;
        int[][][] g = buildWeightedGraph(n, e);
        long[] d = dijkstra(n, g, k);
        StringBuilder sb = new StringBuilder();
        for (int i = 0; i < q; i++) {
            int x = sc.nextInt()-1;
            int y = sc.nextInt()-1;
            long ans = d[x] + d[y];
            sb.append(ans + "\n");
        }
        System.out.print(sb.toString());
        sc.close();

    }

public static long[] dijkstra(int n, int[][][] graph, int s) {
    // {sからの最短距離, 頂点}
    PriorityQueue<long[]> pq = new PriorityQueue<long[]>((x, y) -> Long.compare(x[0], y[0]));
    long[] d = new long[n]; // sからの最短距離
    Arrays.fill(d, Long.MAX_VALUE);
    d[s] = 0;
    pq.add(new long[] { 0, s });
    while (!pq.isEmpty()) {
        long[] a = pq.poll();
        int v = (int) a[1];
        if (d[v] < a[0])
            continue;
        for (int[] g : graph[v]) {
            int to = g[0];
            int cost = g[1];
            if (d[to] > d[v] + cost) {
                d[to] = d[v] + cost;
                pq.add(new long[] { d[to], to });
            }
        }
    }

    return d;
}

    public static int[][][] buildWeightedGraph(int n, int[][] edges){
        int m = edges.length;
        int[][][] graph = new int[n][][];
        int[] deg = new int[n];
        for (int i = 0; i < m; i++) {
            deg[ edges[i][0] ]++;
            deg[ edges[i][1] ]++;
        }
        for (int i = 0; i < n; i++) {
            graph[i] = new int[deg[i]][2];
        }
        for (int i = 0; i < m; i++) {
            int a = edges[i][0];
            int b = edges[i][1];
            int c = edges[i][2];
            graph[a][--deg[a]][0] = b;
            graph[a][deg[a]][1] = c;
            graph[b][--deg[b]][0] = a;
            graph[b][deg[b]][1] = c;
        }

        return graph;
    }

}


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

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;

//container util
//------------------------------------------
#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 SORT(c) sort((c).begin(),(c).end())

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI  = acos(-1.0);
const int MOD = 1000000007;
const int INF = 2147483647;

//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

//myfuncs
//素数判定
template<class T> inline T isPrime(T x) {
    bool ret = true;
    if (x < 2) {
        ret = false;
    }
    for (LL i = 2; i <= sqrt(x); i++) {
        if (x%i == 0) {
            ret = false;
        }
    }
    return ret;
}

//Union FInd
struct UnionFind {
    vector<int> par; // par[i]:iの親の番号　(例) par[3] = 2 : 3の親が2

    UnionFind(int N) : par(N) { //最初は全てが根であるとして初期化
        for(int i = 0; i < N; i++) par[i] = i;
    }

    int root(int x) { // データxが属する木の根を再帰で得る：root(x) = {xの木の根}
        if (par[x] == x) return x;
        return par[x] = root(par[x]);
    }

    void unite(int x, int y) { // xとyの木を併合
        int rx = root(x); //xの根をrx
        int ry = root(y); //yの根をry
        if (rx == ry) return; //xとyの根が同じ(=同じ木にある)時はそのまま
        par[rx] = ry; //xとyの根が同じでない(=同じ木にない)時：xの根rxをyの根ryにつける
    }

    bool same(int x, int y) { // 2つのデータx, yが属する木が同じならtrueを返す
        int rx = root(x);
        int ry = root(y);
        return rx == ry;
    }
};

//main code

int main(int argc, char const* argv[])
{
    int h,w;
    cin >> h >> w;
    vector<vector<char>> vvc(h+2,vector<char>(w+2,'.'));
    for (int i = 1; i < h+1; i++) {
        for (int j = 1; j < w+1; j++) {
            cin >> vvc[i][j];
        }
    }
    int x[3] = {-1,0,1};
    int y[3] = {-1,0,1};

    for (int i = 1; i < h+1; i++) {
        for (int j = 1; j < w+1; j++) {
            if (vvc[i][j] == '.') {
                int count = 0;
                for (int k = 0; k < 3; k++) {
                    for (int l = 0; l < 3; l++) {
                        if (vvc[i + x[k]][j + y[l]] == '#') {
                            count++;
                        } 
                    }
                }
               vvc[i][j] = '0' + count;
            }

        }
    }

    for (int i = 1; i < h+1; i++) {
        for (int j = 1; j < w+1; j++) {
            cout << vvc[i][j];
        }
        cout << endl;
    }
    return 0;
}


Measured memory_bytes: 384
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <cmath>
#include <queue>
#include <map>
#include <unordered_map>
#include <set>
#include <functional>
using namespace std;

typedef long long ll;

ll n, z, w;
ll a[20002];
ll ma[20002], mi[20002];

int main() {
	cin >> n >> z >> w;
	for (ll i = 0; i < n; ++i) {
		cin >> a[i];
	}
	if (n == 1) cout << abs(w - a[n - 1]) << endl;
	else cout << max(abs(w - a[n - 1]), abs(a[n - 1] - a[n - 2])) << endl;
	return 0;
}

Measured memory_bytes: 256
import qualified Data.Text as T
import qualified Data.Text.IO as T
import qualified Data.Text.Read as T
import Data.Sequence (Seq)
import qualified Data.Sequence as S

main :: IO ()
main = do
  let
    go :: Int -> Seq Bool -> Int
    go k xs | S.null xs = k
    go k xs = go (k + 1) xs'''
      where
        _ S.:< xs' = S.viewl xs
        xs'' S.:> _ = S.viewr xs'
        xs''' = S.dropWhileR not . S.dropWhileL id $ xs''
  n <- unsafeTextToInt <$> T.getLine :: IO Int
  cs <- map (== 'R') <$> getLine :: IO [Bool]
  let
    cs' = S.dropWhileR not . S.dropWhileL id . S.fromList $ cs :: Seq Bool
  print . go 0 $ cs'

unsafeTextToInt :: T.Text -> Int
unsafeTextToInt s = case T.signed T.decimal s of
  Right (n, _) -> n
{-# INLINE unsafeTextToInt #-}


Measured memory_bytes: 26232
#define _USE_MATH_DEFINES
#include<iostream>
#include<algorithm>
#include<cmath>
#include<string>
#include<set>
#include<map>
#include<vector>
#include<utility>
#include<queue>
#include<stdbool.h>
#include<math.h>
#include<sstream>
typedef long long ll;
#define N (1000000000+7)
#define INF (1e18)
using namespace std;
typedef pair<int, int> P;

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

int d[55][55];

char board[55][55];
int h, w;

int bfs() {
	queue<P>q;
	for (int i = 1;i <= h;i++) {
		for (int j = 1;j <= w;j++) {
			d[i][j] = INF;
		}
	}
	q.push(P(1, 1));
	d[1][1] = 0;
	while (!q.empty()) {
		P p = q.front();q.pop();
		if ((p.first == h) && (p.second == w))break;
		for (int i = 0;i < 4;i++) {
			int nx = p.first + dx[i];
			int ny = p.second + dy[i];
			if ((1 <= nx) && (nx <= h) && (1 <= ny) && (ny <= w) && (board[nx][ny] != '#') && (d[nx][ny] == INF)) {
				q.push(P(nx, ny));
				d[nx][ny] = d[p.first][p.second] + 1;
			}
		}
	}
	return d[h][w];
}

ll a[3][110], sum1,sum2;

int main(void) {
	ll n, ans = 0;
	cin >> n;
	for (int i = 0;i < n;i++)cin >> a[0][i];
	for (int i = 0;i < n;i++) {
		cin >> a[1][i];
		sum2 += a[1][i];
	}
	for (int i = 0;i < n;i++) {
		sum1 += a[0][i];
		ans = max(ans, sum1 + sum2);
		sum2 -= a[1][i];
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#65
import math
while True:
    n=int(input())
    if n==0:
        break
    s=list(map(int,input().split()))
    m=sum(s)/n
    a=0
    for i in range(n):
        a+=(s[i]-m)**2
    b=math.sqrt(a/n)
    print(b)


Measured memory_bytes: 5696
use std::io::Write;

#[allow(unused)]
macro_rules! debug {
    ($($format:tt)*) => (write!(std::io::stderr(), $($format)*).unwrap());
}
#[allow(unused)]
macro_rules! debugln {
    ($($format:tt)*) => (writeln!(std::io::stderr(), $($format)*).unwrap());
}

const BIT_NUM: usize = 40;

fn main() {
    let (n, k): (usize, usize) = {
        let mut s = String::new();
        std::io::stdin().read_line(&mut s).unwrap();
        let s = s.trim_right().to_owned();
        let mut ws = s.split_whitespace();
        let a = ws.next().unwrap().parse().unwrap();
        let b = ws.next().unwrap().parse().unwrap();
        (a, b)
    };

    let a: Vec<usize> = {
        let mut s = String::new();
        std::io::stdin().read_line(&mut s).unwrap();
        let s = s.trim_right().to_owned();
        s.split_whitespace().map(|x| x.parse().unwrap()).collect()
    };

    let mut sum_a = vec![0];
    for &x in a.iter() {
        let last = *sum_a.last().unwrap();
        sum_a.push(last + x);
    }

    let mut set = vec![];
    for i in 0..n {
        for j in (i + 1)..n {
            let sum_ij = sum_a[j + 1] - sum_a[i];
            set.push(sum_ij);
        }
    }
    let mut ans = 0;
    for b in (0..(BIT_NUM + 1)).rev() {
        let bit = 1 << b;
        debugln!("ans + bit: {}", ans + bit);
        let tmp: Vec<_> = set.iter().cloned().filter(|x| x & (ans + bit) == ans + bit).collect();
        if tmp.len() >= k {
            set = tmp;
            ans += bit;
        }
        debugln!("{:?}", set);
        debugln!("{}", ans);
    }

    println!("{}", ans);
}


Measured memory_bytes: 11512
#include <stdio.h>

int main() {
	int y, m, d;
	scanf("%d/%d/%d\n", &y, &m, &d);
	if (y < 2019)printf("Heisei\n");
	else if(y == 2019 && m < 4)printf("Heisei\n");
	else if(y == 2019 && m == 4 && d <= 30)printf("Heisei\n");
	else printf("TBD\n");
	return 0;
}

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

int main(){
  
  int a,b,c;
  bool answer = false;
  cin >> a >> b;
  
  c = 2*a;
  
  vector<int> vec(a+1);
  for(int i=0;i<a+1;i++){
    
    c += 2;
  
  if( b == c ){
    
    answer = true;
    
  }
    
  else if( b == 2*a ){
    
    answer = true;
    
  }
    
  }
    
  if( b == 4*a +2 ){
    
    answer = false;
    
  }
    
  if( answer ){
    
    cout << "Yes" << endl;
    
  }
    
  else{
    
    cout << "No" << endl;
    
  }
    
}

Measured memory_bytes: 3540
//#pragma comment(linker, "/STACK:102400000,102400000") 
//#include <windows.h>
//#include <unordered_map>
//#include <unordered_set>
#include <fstream>
#include <iostream>
#include <functional>
#include <algorithm>
#include <cstring>
#include <vector>
#include <string>
#include <cstdio>
#include <cmath>
#include <queue>
#include <stack>
#include <deque>
#include <ctime>
#include <list>
#include <set>
#include <map>
#include <bitset>
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
#define eps 1e-10
#define LL_INF 0x3fffffffffffffff
#define INF 0x3f3f3f3f
#define mem(a, b) memset(a, b, sizeof(a))
#define pper(i,n,m) for(int i = n;i >= m; i--)
#define repp(i, n, m) for (int i = n; i <= m; i++)
#define rep(i, n, m) for (int i = n; i < m; i++)
#define sa(n) scanf("%d", &(n))
#define mp make_pair
#define ff first
#define ss second
#define pb push_back

const int maxn = 1e5 + 5;
const int dir[8][2] = { { 0,1 },{ 1,1 },{ 1,0 },{ 1,-1 },{ 0,-1 },{ -1,-1 },{ -1,0 },{ -1,1 } };
const int dir8x[8] = { -1,-1,-1,0,0,1,1,1 };
const int dir8y[8] = { -1,0,1,1,-1,-1,0,1 };
const ll mod = 1e9 + 7;
const double PI = acos(-1.0);
ll po(ll a, ll b, ll mod) { ll res = 1; a %= mod; for (; b; b >>= 1) { if (b & 1)res = res*a%mod; a = a*a%mod; }return res; }
ll gcd(ll a, ll b) { if (a == 0) { return b; } else { return gcd(b%a, a); } }

int n, m;
int flag;
int vis[maxn];
ll pos[maxn];
vector<pair<int, int>>edge[maxn];

void dfs(int x,int p)
{
	if (!flag)return;
	pos[x] = p;
	for (int i = 0; i < edge[x].size(); i++)
	{
		int to = edge[x][i].first;
		int dis = edge[x][i].second;
		if (pos[to]  > 1e14)
		{
			pos[to] = pos[x] + dis;
			dfs(to, pos[to]);
		}
		else
		{
			if (pos[to] != pos[x] + dis)
			{
				flag = 0;
				return;
			}
		}
	}
}

void solve()
{
	sa(n), sa(m);
	repp(i, 1, m)
	{
		int x, y, d;
		sa(x), sa(y), sa(d);
		edge[x].push_back(mp(y, d));
		edge[y].push_back(mp(x, -d));
	}
	flag = 1;
	memset(pos, 0x3f, sizeof(pos));
	repp(i, 1, n)
	{
		if (pos[i] > 1e14)
		{
			dfs(i, 0);
		}
	}
	if (flag)
	{
		puts("Yes");
	}
	else
	{
		puts("No");
	}
}

int main()
{

	solve();
	//system("pause");
	return 0;
}



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

lli n, m, k;
vector<lli> a, b;

int main(void){
    cin >> n >> m >> k;
    a = vector<lli>(n);
    b = vector<lli>(m);
    for(int i = 0; i < n; i++) cin >> a[i];
    for(int i = 0; i < m; i++) cin >> b[i];
    vector<lli> sa(n+1, 0), sb(m+1, 0);
    for(int i = 0; i < n; i++) sa[i+1] = sa[i] + a[i];
    for(int i = 0; i < m; i++) sb[i+1] = sb[i] + b[i];
    lli res = 0;
    for(int i = 0; i < n+1; i++){
        if(sa[i] > k) continue;
        lli idx = lower_bound(sb.begin(), sb.end(), k+1-sa[i])-sb.begin();
        res = max(res, i+idx-1);
    }
    cout << res << endl;
    return 0;
}


Measured memory_bytes: 9600
#include <bits/stdc++.h>
//#include <boost/multiprecision/cpp_int.hpp>
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
#pragma GCC optimize("O3")
#define REP(i,n) for(int i=0;i<n;i++)
#define REPP(i,n) for(int i=1;i<=n;i++)
#define ALL(obj) (obj).begin(), (obj).end()
#define EPS (1e-9)
#define INF (1e17)
#define PI (acos(-1))
//const double PI = acos(-1);
//const double EPS = 1e-15;
//long long INF=(long long)1E17;
#define i_7 (long long)(1e9+7)
//#define i_7 998'244'353
long mod(long a){
    long long c=a%i_7;
    if(c>=0)return c;
    return c+i_7;
}
long long po(long a, long b){
    if(b==0){
        return 1;
    }
    
    long long z = po(a,b/2);
    z = mod(z*z);
    if(b%2!=0){
        z = mod(a*z);
    }
    return z;
}
 
bool prime_(int n){
  if(n==1){
    return false;
  }else if(n==2){
    return true;
  }else{
    for(int i=2;i<=std::sqrt(n);i++){
      if(n%i==0){
        return false;
      }
    }
    return true;
  }
}
 
long long gcd_(long long a, long long b){
  if(a<b){
    std::swap(a,b);
  }
  if(a%b==0){
    return b;
  }else{
    return gcd_(b,a%b);
  }
}
 
long long lcm_(long long x, long long y){
  return (x/gcd_(x,y))*y;
}
 
//using namespace std;
//using namespace boost::multiprecision;
//using namespace __gnu_pbds;

int main(){
  using namespace std;
  int n;
  cin>>n;
  int A[n][n - 1];
  REP(i, n) REP(j, n - 1) cin>>A[i][j];
  
  stack<int> a[n];
  REP(i, n) for(int j = n - 2; j >= 0; j--) a[i].push(A[i][j] - 1);
  
  typedef pair<int, int> P;
  vector<P> battles; //実行可能な試合
  auto add_battle = [&a](int i, vector<P>& next_battles) -> void {
    if(a[i].empty()) return;
    int j = a[i].top();
    if(a[j].top() == i){
      if(i < j){
        next_battles.push_back(P(i, j));
      }else{
        next_battles.push_back(P(j, i));
      }
    }
    return;
  };
  REP(i, n) add_battle(i, battles);
  sort(ALL(battles)); battles.erase(unique(ALL(battles)), battles.end());
  
  int days = 0;
  while(!battles.empty()){
    days++;
    for(auto& battle: battles){
      int i = battle.first, j = battle.second;
      a[i].pop(); a[j].pop();
    }
    vector<P> next_battles;
    for(auto& battle: battles){
      int i = battle.first, j = battle.second;
      add_battle(i, next_battles);
      add_battle(j, next_battles);
    }
    swap(battles, next_battles);
    sort(ALL(battles)); battles.erase(unique(ALL(battles)), battles.end());
  }
  
  REP(i, n){
    if(!a[i].empty()){
      cout << -1 << endl;
      return 0;
    }
  }
  cout << days << endl;
    
  return 0;
}


Measured memory_bytes: 12040
#include<bits/stdc++.h>
    using namespace std;
    using ll=long long;
    string s;
    int sum;
    ll mod=1e9+7;
    int dp[10001][101][2];
    ll solve(int i,int d,bool b)
    {
        
      if(dp[i][d][b]!=-1)
      return dp[i][d][b];
      int ub=(b==1)?(s[i]-'0'):9;
      ll ans=0;
      if(i==s.size()-1)
      {
        for(int x=0;x<=ub;x++)
        {
          if(x%sum==d)
          ans++;
        }
        return dp[i][d][b]=ans;
      }
      for(int j=0;j<=ub;j++)
      {
        ans+=solve(i+1,(sum+d-j%sum)%sum,(b&&(j==ub)));
        ans=ans%mod;
      }
      return dp[i][d][b]=ans;
    }
    int main()
    {
      memset(dp,-1,sizeof(dp));
      cin>>s;
      cin>>sum;
      cout<<(mod+solve(0,0,1)-1)%mod<<endl;
      return 0;
    }

Measured memory_bytes: 12460
#include <iostream>
#include <vector>
#include <map>
#include <queue>

struct Node
{
  long counter;
  bool checked;
};

int main()
{
  int N, Q;
  std::cin >> N >> Q;
  std::map<int, std::vector<int> > edge;
  for (int i = 0; i < N-1; i++)
  {
    int tmpa, tmpb;
    std::cin >> tmpa >> tmpb;
    if (edge.count(tmpa)) edge.at(tmpa).push_back(tmpb);
    else edge[tmpa] = {tmpb};
    if (edge.count(tmpb)) edge.at(tmpb).push_back(tmpa);
    else edge[tmpb] = {tmpa};
  }
  std::vector<Node> tree(N+1);
  for (int i = 0; i < N+1; i++)
  {
    tree.at(i).checked = false;
    tree.at(i).counter = 0;
  }
  for (int i = 0; i < Q; i++)
  {
    int tmpp, tmpx;
    std::cin >> tmpp >> tmpx;
    tree.at(tmpp).counter += tmpx;
  }
  std::queue<int> que;
  que.push(1);
  while(!que.empty())
  {
    int now = que.front();
    que.pop();
    if (tree.at(now).checked) continue;
    tree.at(now).checked = true;
    for (auto x : edge.at(now))
    {
      if (tree.at(x).checked) continue;
      tree.at(x).counter += tree.at(now).counter;
      que.push(x);
    }
  }
  for (int i = 1; i < N; i++) std::cout << tree.at(i).counter << " ";
  std::cout << tree.at(N).counter << std::endl;
}


Measured memory_bytes: 28788
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class Main {
	static List<Integer> data = new ArrayList<>();

	static void solve(int b) {
		List<Integer> ansList = new ArrayList<>();
		System.out.print(b + ":");
		for (int i = 0; i < data.size(); ++i) {
			if (b % data.get(i) == 0) {
				ansList.add(data.get(i));
			}
		}
		for (Integer int1 : ansList) {
			System.out.print(" " + int1);
		}
		System.out.println();
	}

	public static void main(String[] args) {
		boolean[] filter = new boolean[300000];

		for (int i = 6; i < 300000; i++) {
			if ((i % 7 == 1 || i % 7 == 6) && !filter[i]) {
				for (int j = i; j < 300000; j += i) {
					filter[j] = true;
				}
				data.add(i);
			}
		}
		Scanner in = new Scanner(System.in);

		while (true) {
			int b = in.nextInt();
			if (b == 1) {
				return;
			}
			solve(b);
		}
	}
}

Measured memory_bytes: 34476
#include <iostream>
#include <cmath>

using namespace std;

int find_diversor_num(long long int num)
{
  int count = (num > 1)? 1 : 0;
  int num_sqrt = sqrt(num);
  for (int i = 2; i <= num_sqrt; i++)
    if (num % i == 0)
      count = (num / i == i)? count + 1 : count + 2;  
  return count;
}

int find_mod_one(long long int num)
{
  int count = 1;
  int num_sqrt = sqrt(num);
  for (int i = 2; i <= num_sqrt; i++)
    if (num % i == 0){
      long long int temp = num, a = i, b = num / i;
      while (temp % a == 0)
	temp /= a;
      if (temp % a == 1)
	count++;
      if (a != b){
	temp = num;
	while (temp % b == 0)
	  temp /= b;
	if (temp % b == 1)
	  count++;
      }
    }
  return count;
}

void calculate(long long int& N)
{
  cout << find_diversor_num(N - 1) + find_mod_one(N) << '\n';
}

int main(void)
{
  ios::sync_with_stdio(false);
  cin.tie(0);
  long long int N;
  cin >> N;
  calculate(N);
  return 0;
}


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

# define C continue;
# define R return

# define D double
# define I insert
# define ll long long
# define ld long double

# define ull unsigned long long
# define ui unsigned int

# define pb push_back
# define pf push_front

# define vi vector < int >
# define vc vector < char >
# define vs vector < string >
# define vb vector < bool >
# define vd vector < D >
# define vll vector < ll >
# define vull vector < ull >
# define vld vector < ld >

# define vvi vector < vector < int > >
# define vvb vector < vector < bool > >
# define vvc vector < vector < char > >
# define vvll vector < vector < ll > >
# define vvd vector < vector < D > >
# define vvld vector < vector < ld > >

# define all(v) (v).begin() , (v).end()
# define allrev(v) (v).rbegin() , (v).rend()
# define allcomp(v) v.begin() , v.end() , comp
# define allrevcomp(v) v.rbegin() , v.rend() , comp

# define pii pair < int , int >
# define pll pair < ll , ll >
# define pld pair < ld , ld >
# define pDD pair < D , D >

# define vpld vector < pld >
# define vpii vector < pii >
# define vpll vector < pll >
# define vpDD vector < pDD >

# define vvpii vector < vector < pii > >
# define F first
# define S second
# define mp make_pair

# define fast ios_base::sync_with_stdio(false) ; cin.tie(0) ; cout.tie(0);
# define dist(a,b,p,q) sqrt((p-a)*(p-a) + (q-b)*(q-b))

# define pp(n) printf("%.10Lf",n);
# define line cout<<"\n";

const ld pie = 3.14159265358979 ;
const ll mod = 1e9 + 7 ;

string vow = "aeiou";

void solve ( int test_case )
{
    string s ;
    cin >> s ;

    int n = s.size() ;

    for ( int i=0 ; i < n - 1 ; i++ )
    {
        if ( s[i] == s[i+1] )
        { cout << i + 1 << " " << i + 2 ; line ; R ; }
    }

    for ( int i=0 ; i < n-2 ; i++ )
    {
        if ( s[i] == s[i + 2] )
        { cout << i + 1 << " " << i + 3 ; line ; R ; }
    }

    cout << "-1 -1" ; line
}

int main()
{
    int t = 1;
    //cin >> t;

    for ( int i=0 ; i < t ; i++ ) solve(i);
    return 0;
}


Measured memory_bytes: 512
/******************************************
* AHAM BRAHMASHMI ;) *
******************************************/
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define vll vector<ll>
#define pll pair<ll,ll>
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define mod 1000000007


template <class T>
void print(vector<T> arr)
{
	cout << "start printing the vector\n";
	for (auto u : arr)
		cout << u << " ";
	cout << "\n";
}

template <class T>
void print_mat(vector<vector<T>> a)
{
	cout << "start printing the matrix\n";
	for (auto v : a)
	{
		for (auto e : v)
		{
			cout << e << " ";
		}
		cout << "\n";
	}
}

/******************************************
* NUMBER THEORY ;) *
******************************************/



ll powermod(ll x, ll y)
{
	ll res = 1;
	x = x % mod;
	while (y > 0)
	{
		if (y & 1)
			res = (res * x) % mod;
		y = y >> 1;
		x = (x * x) % mod;
	}
	res %= mod;
	return res;
}
ll factmod(ll n)
{
	ll res = 1;
	while (n > 1)
	{
		res = (res * ((n / mod) % 2 ?  mod - 1 : 1)) % mod;
		for (ll i = 2; i <= n % mod; ++i)
			res = (res * i) % mod;
		n /= mod;
	}
	res %= mod;
	return res;
}



void solve()
{
	ll a, b, c, k;
	cin >> a >> b >> c;
	cin >> k;
	if (b <= a)
	{
		while (b <= a and k > 0)
		{
			b *= 2;
			k--;
		}
	}
	if (c <= b)
	{
		while (c <= b and k > 0)
		{
			c *= 2;
			k--;
		}
	}
	if (b > a and c > b)
	{
		cout << "Yes\n";
	}
	else
	{
		cout << "No\n";
	}

}

int main()
{

#ifndef ONLINE_JUDGE
	// for getting input from input.txt
	freopen("input.txt", "r", stdin);
	// for writing output to output.txt
	freopen("output.txt", "w", stdout);
#endif
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	// ll t;
	// cin >> t;
	// while (t--)
	// {
	solve();
	// }

	return 0;
}

Measured memory_bytes: 3636
#include<iostream>
#include<vector>
#include<string>
using namespace std;
int main(){
int a,x=0;
cin >> a;
char str[a];
  cin >> str;
  for(int i=0;i<(a/2);i++){
    if(str[i]==str[i+(a/2)]){
      x+=1;}}
  if(x==(a/2) && (a%2)!=1){
    cout << "Yes" << endl;
    }
  else{
  cout << "No" << endl;}
}


Measured memory_bytes: 256
s = sorted(input())
t = sorted(input(),reverse=True)

ls = len(s)
lt = len(t)

p='No'
for i in range(100):
  if len(t)<=i:
    p = 'No'
    break
  if len(s)<=i:
    p = 'Yes'
    break 
  if s[i:i+1] > t[i:i+1]:
    p = 'No'
    break
  elif s[i:i+1] < t[i:i+1]:  
    p = 'Yes'
    break
   
print(p)


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

using namespace std;

int main() {
  long long n;
  cin >> n;
  vector<long long> v(n);
  int m[n+1] = {0};
  long long p;
  for(int i=0; i < n-1;i++){cin >> p; m[p]++;}
  for(int i=1; i <= n; i++) {
    cout << m[i] << endl;
  }
}


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

int main() {
	int ans = 0;
	string s;

	cin >> s;

	if(s[0] == 'A') {
		int sz = s.size();
		int cnt = 0;
		int flag = 0;
		for( int i = 2; i < sz - 1; i++ ) {
			if(s[i] == 'C') {
				cnt++;
			}
			else if( islower(s[i]) == 0) {
				flag = 1;
			}
		}
		if( cnt == 1 ) {
			if(flag == 0) {
				if( islower(s[1]) != 0 && islower(s[sz-1]) != 0 ) {
					ans = 1;
				}
			}
		}
	}

	if( ans == 1 ) {
		cout << "AC" << endl;
	}
	else {
		cout << "WA" << endl;
	}

	return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <algorithm>
#include <iostream>
#include <vector>
#include <map>
using namespace std;
typedef pair<long long int,long long int> pii;

int main(void){
  long long int n,k,a,b,i;
  vector<pii> res;
  cin>>n>>k;
  for(i=0;i<n;i++){
    cin>>a>>b;
    res.push_back(pii(a,b));
  }
  sort(res.begin(),res.end());

  i=a=0;
  while(1){
    a+=res[i].second;
    if(a>=k){
      cout<<res[i].first<<endl;
      break;
    }
    i++;
  }
  return 0;
}


Measured memory_bytes: 2420
#include <bits/stdc++.h>
const int INF = 1e9;
const int MOD = 1e9+7;
const long long LINF = 1e18;
#define dump(x)  cout << 'x' << ' = ' << (x) << ` `;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n) for(int i=0;i<(n);++i)
#define REPR(i,n) for(int i=n;i>=0;i--)
#define FOREACH(x,a) for(auto& (x) : (a) )
typedef long long ll;
using namespace std;
typedef pair<ll, ll> P;

template<typename T>
void print(const vector<T> &x) {
    int n = x.size();
    rep(i,n) {
        cout << x[i];
        if (i!=n-1) cout<<" ";
        else cout << endl;
    }
}

template<typename T>
void print(const vector<vector<T>> &x) {
    int n = x.size();
    rep(i,n) {
        rep(j,x[i].size()) {
            cout << x[i][j] << " ";
        }
        cout << endl;
    }
}

template<typename T>
void print(const vector<T> &x, int n) {
    rep(i,n) {
        cout << x[i];
        if (i!=n-1) cout<<" ";
        else cout << endl;
    }
}

template<typename T>
void print(const vector<vector<T>> &x, int n, int m) {
    rep(i,n) {
        rep(j,m) {
            cout << x[i][j] << " ";
        }
        cout << endl;
    }
}

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

void input_init() {
    cin.tie(0); ios::sync_with_stdio(false);
}

int main(int argc, char const *argv[]) {
    ll h,n; cin>>h>>n;
    vector<ll> a(n),b(n);
    rep(i,n) cin>>a[i]>>b[i];
    vector<vector<ll>> dp(n+1, vector<ll>(h+2, LINF));
    rep(i,n+1) dp[i][0] = 0;

    rep(i,n) {
        for (int w = 0; w <= h; ++w) {
            chmin(dp[i+1][w],dp[i][w]);
            chmin(dp[i+1][min(w+a[i],h)], dp[i+1][w]+b[i]);
        }
    }

    cout << dp[n][h] << '\n';

    return 0;
}

Measured memory_bytes: 78592
#include <cstdio>
using namespace std;

int main(int argc, char** argv)
{
	long long a, b, c;
	scanf("%lld%lld%lld", &a, &b, &c);
	long long d = c - a - b;
	if(d < 0) puts("No");
	else puts((d * d > 4LL * a * b)? "Yes": "No");
	return 0;
}

Measured memory_bytes: 128