akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define REP(i,n,N) for(int i=n;i<N;i++)
#define p(S) cout<<(S)<<endl
#define ck(a,b) (0<=(a)&&(a)<b)
using namespace std;
const int inf=1e9;
int bprdp[110][110];//node,budget = enemy
struct bpredge{
	int to,d,e;
};
bool operator<(const bpredge& e1, const bpredge& e2) { return e1.e < e2.e; }
int main(){
	int N,M,L;
	while(cin>>N>>M>>L,N){
		REP(i,0,N) REP(j,0,L+1) bprdp[i][j]=inf;
		bprdp[0][L]=0;
		vector<bpredge> vt[110];
		REP(i,0,M){
			int a,b,d,e;
			cin>>a>>b>>d>>e;
			a--;b--;
			vt[a].push_back(bpredge{b,d,e});
			vt[b].push_back(bpredge{a,d,e});
		}
		priority_queue<bpredge> pq;
		pq.push(bpredge{0,L,0});

		while(!pq.empty()){
			bpredge now=pq.top();pq.pop();
			for(auto e: vt[now.to]){
				if(now.d>=e.d){
					if(bprdp[e.to][now.d-e.d] > -now.e){
						bprdp[e.to][now.d-e.d]= -now.e;
						pq.push({e.to,now.d-e.d,now.e});
					}
				}
				if(bprdp[e.to][now.d]> -now.e + e.e){
					bprdp[e.to][now.d]=-now.e + e.e;
					pq.push(bpredge{e.to,now.d,now.e-e.e});
				}
			}
		}
		int ans=inf;
		REP(i,0,L+1){
			ans=min(bprdp[N-1][i],ans);
		}
		p(ans);
	}
	return 0;
}

Measured memory_bytes: 3552
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <cfloat>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <fstream>
#include <functional>
#include <bitset>
#define chmin(a, b) ((a)=min((a), (b)))
#define chmax(a, b) ((a)=max((a), (b)))
#define fs first
#define sc second
#define eb emplace_back
using namespace std;

typedef long long ll;
typedef pair<int, int> P;
typedef tuple<int, int, int> T;

const ll MOD=1e9+7;
const ll INF=1e18;
const double pi=acos(-1);
const double eps=1e-10;

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

int main(){
    int n, q; cin>>n>>q;
    vector<int> a(n);
    vector<ll> sum(n+10, 0), divsum(n+10, 0);
    for(int i=0; i<n; i++){
        cin>>a[i];
        sum[i+1] = sum[i] + a[i];
        divsum[i+1] = a[i];
        if(2 <= i) divsum[i+1] += divsum[i-1]; 
    }

    for(int i=0; i<q; i++){
        int x; cin>>x;
        int ng = 0, ok = n - 1;
        int ub, lb;
        while(ok - ng > 1){
            int mid = (ng + ok) / 2;

            if(a[mid] < x){
                ng = mid;
            }
            else{
                ub = n - mid;
                lb = lower_bound(a.begin(), a.end(), a[mid]) - lower_bound(a.begin(), a.end(), 2 * x - a[mid]) + 1;

                if(lb < ub) ng = mid;
                else ok = mid;
            }
        }

        ll ans = sum[n] - sum[ok];
        int Tturn = n - (n - ok) * 2;
        ans += divsum[max(Tturn, 0)];

        cout << ans << endl;
    }
}

Measured memory_bytes: 3712
#include <iostream>
#include<bits/stdc++.h>
#define ll long long
#define   ull unsigned long long 
#define pb push_back
const int MAX=2e5+9;
const long long mod=1e9+7;
using namespace std;
vector<int>adj[MAX];
ll dp[MAX][10][13];
int main(){
	int n ;
	cin>>n;
	ll cnt=0;
	map<string, ll>mp;
	for(int i=0;i<n;i++){
		string str;
		cin>>str;
		sort(str.begin(), str.end());

		cnt=cnt+mp[str];
		mp[str]++;
	}
	cout<<cnt;
	
}

Measured memory_bytes: 16256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define x first
#define y second
#define pii pair<int , int>
#define mp make_pair
#define pb push_back
#define sz(a) (int)(a.size())
const int INF = 1000 * 1000 * 1000 + 7;
const ll LINF = INF * (ll)INF;
const int mod = 998244353;
const int MAX = 2000005;
ll pw3[31];
bool in(ll x , int bit)
{
	return (x / pw3[bit]) % 3 == 1;
}
ll f(ll x , ll bit)
{
	return (x + pw3[bit]) / pw3[bit + 1];
	 
}
ll dist(ll a , ll b , ll c , ll d)
{
	return abs(a - c) + abs(b - d);
}
ll solve(ll a, ll b, ll c, ll d)
{
	for(int bit = 29; bit >= 0; bit--)
	{
		if(in(a , bit) && in(c , bit) && (a / pw3[bit]) == (c / pw3[bit]) && f(b , bit) != f(d, bit))
		{
			if(b > d)
				swap(b , d);
			return min( dist(a , b , (a / pw3[bit]) * pw3[bit] + pw3[bit] , (b / pw3[bit]) * pw3[bit] + pw3[bit] - 1) + 
					dist(c , d , (a / pw3[bit]) * pw3[bit] + pw3[bit] , (b / pw3[bit]) * pw3[bit] + pw3[bit] - 1) ,
					dist(a , b , (a / pw3[bit]) * pw3[bit] - 1, (b / pw3[bit]) * pw3[bit] + pw3[bit] - 1) + 
					dist(c , d , (a / pw3[bit]) * pw3[bit] - 1 , (b / pw3[bit]) * pw3[bit] + pw3[bit] - 1));
		}
	}
	return -1;
}
int main()
{
	ios_base::sync_with_stdio(0);
	pw3[0] = 1;
	for(int i = 1; i <= 30; i++)
		pw3[i] = pw3[i - 1] * 3;
	int q;
	cin >> q;
	while(q--)
	{
		ll a,b,c,d;
		cin >> a >> b >> c >> d;
		a--;b--;c--;d--;
		ll answer = solve(a , b , c , d);
		swap(a , b);
		swap(c , d);
		if(answer == -1)
			answer = solve(a , b , c , d);
		if(answer == -1)
			cout << abs(a - c) + abs(b - d) << endl;
		else
			cout << answer << endl;
	}

}


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

int main(void){
    string s;
    int k;
    cin>>s>>k;
    rep(i,s.size()){
        if(i % k == 0){
            cout<<s[i];
        }
    }
    cout<<endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <climits>
#include <set>
#include <string>
#include <algorithm>
#include <vector>
#define MAX 1000000007


using namespace std;
#define ll long long
#define dbg if(0)
#define ISRANGE(val,lo,hi) ((lo<=val)&&(val<hi))



int main(){
    ll ans,n,x;
    cin >>n>>x;
    ll a[n];
    for(int i=0;i<n;i++){
        cin >>a[i];
    }

    ans=0;
    for(int i=0;i<n-1;i++){
        if(a[i]+a[i+1]>x){
            ans+=a[i]+a[i+1]-x;
            a[i+1]-=min(a[i+1],a[i]+a[i+1]-x);
            a[i]-=max((ll)0,a[i]+a[i+1]-x);
        }
    }


    cout <<ans<<endl;

    return 0;

}

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

#define REPI(i, n) for(int i = 0; i < n; i++)
#define REPJ(j, n) for(int j = 0; j < n; j++)

using ll = long long;
using namespace std;

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

    int x, ans = 0; cin >> x;
    for(int i = 1; i <= x; i++)
        for(int j = 2; ; j++){
            int power = pow(i, j);
            if(power > x) break;
            ans = max(ans, power);
            if(power == 1) break;
        }
    cout << ans;
}


Measured memory_bytes: 640
import java.util.Scanner;
public class Main{
    public static void main(String[] args) {
        // TODO code application logic here
        Scanner sc=new Scanner(System.in);
        int a=sc.nextInt();
        int b=sc.nextInt();
        int count=1;
        int sum=0;
        int[] c=new int[a];
        for(int i=0; i<a;i++){
            c[i]=sc.nextInt();
            sum+=c[i];
            if(sum<=b){
                count++;
            }
        }
        System.out.println(count);   
    }
}


Measured memory_bytes: 23124
#include<bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < n; i++)

using namespace std;
int main(){
  int h1,m1,h2,m2,k;
  cin >>h1>>m1>>h2>>m2>>k;
  int ans = 60*h2+m2-60*h1-m1-k;
 cout << ans << endl;
}
    

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

int main() {
  int n;
  cin >> n;
  vector<int> h(n);
  rep(i,0,n) cin >> h[i];
  int ans = 1;
  rep(i,1,n) {
    bool flag = true;
    rep(j,0,i) {
      if (h[j] > h[i]) {
        flag = false;
      }
    }
    if (flag) ans++;
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 3612
#include<stdio.h>

int l[7];

void dice(int num){
    l[0] = l[1];
    l[1] = l[num];
    l[num] = l[6];
    l[6] = l[7-num];
    l[7-num] = l[0];
}

int main(void){
    int n,u,f;
    char order;
    for(int i=0; i<6; i++) scanf("%d", &l[i+1]);
    scanf("%d", &n);
    for(int i=0; i<n; i++){
        scanf("%d%d", &u, &f);
        if(f==l[3] || f==l[4]) dice(4);
        while(f!=l[2]) dice(2);
        while(u!=l[1]) dice(4);
        printf("%d\n", l[3]);
    }
    return 0;
}


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

int main() {
  int L,R;
  cin >> L >> R;
  int x=((L+2018)/2019)*2019;
  if (x<=R){
    cout << 0 << endl;
  }
  else {
    int l=L%2019,r=R%2019;
    int ans=2018;
    for (int i=l;i<r;i++){
      for (int j=i+1;j<r+1;j++){
        ans=min(ans,(i*j)%2019);
      }
    }
    cout << ans << endl;
  }
}

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! {
        s: chars,
    }

    let mut ans = 0;
    let mut v = vec![];

    for c in s {
        let d = if c == '0' { '1' } else { '0' };
        if v.last() == Some(&d) {
            v.pop();
            ans += 2;
        } else {
            v.push(c);
        }
    }

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


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


#define ff				first
#define ss				second
#define int				long long
#define pb				push_back
#define mp				make_pair
#define pii				pair<int,int>
#define vi				vector<int>
#define mii 			map<int,int>
#define	pqb				priority_queue<int>
#define pqs				priority_queue<int,vi,greater<int> >
#define setbits(x)		__builtin_popcountll(x)
#define zrobits(x)		__builtin_ctzll(x)
#define mod				1000000007
#define inf 			1e18
#define ps(x,y)			fixed<<setprecision(y)<<x
#define mk(arr,n,type)	type *arr = new type[n]
#define w(x)			int x; cin>>x; while(x--)
#define FIO             ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define endl			'\n'

void c_p_c()
{
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif

}


bool isPrime(int n)
{
	if (n <= 1)
		return false;
	if (n <= 3)
		return true;
	if (n % 2 == 0 || n % 3 == 0)
		return false;
	for (int i = 5; i * i <= n; i += 6)
	{
		if (n % i == 0 || n % (i + 2) == 0)
			return false;

	}
	return true;
}

vector<int> Sieve(int n)
{
	bool prime[n + 1];
	memset(prime, true, sizeof(prime));
	for (int i = 2; i * i <= n; i++)
	{
		if (prime[i])
		{
			for (int j = i * i; j <= n; j += i)
			{
				prime[j] = false;
			}
		}
	}
	vector<int> primes;

	for (int i = 2; i <= n; i++)
	{
		if (prime[i])
			primes.pb(i);
	}
	return primes;
}
set<int> primeFactors(int  n)
{
	set<int> factors;
	while (n % 2 == 0)
	{
		n /= 2;
		factors.insert(2);

	}
	for (int i = 3; i <= sqrt(n); i += 2)
	{
		while (n % i == 0)
		{
			factors.insert(i);
			n /= i;
		}
	}
	if (n > 2)
		factors.insert(n);
	return factors;
}




// Graph------------------------------------------------------------------------
int32_t main()
{
	FIO;
	// c_p_c();
	// --------------------------------------------------
// Never GIVE UP !!!!



	int x, y;
	cin >> x >> y;

	int i, j;
	bool flag = 0;
	for (i = 0; i <= x; i++ )
	{
		j = x - i;
		if (i * 2 + j * 4 == y)
		{
			flag = true;
			break;
		}
	}

	if (flag)
		cout << "Yes" << endl;
	else
		cout << "No" << endl;





}


Measured memory_bytes: 3636
n, k = map(int, input().split())
r, s, p = map(int, input().split())
t = input()
score_map = {
    "r": p,
    "p": s,
    "s": r,
    "n": 0,
}
t = list(t)
ans = 0
for i in range(k):
    skipped_list = t[i::k]
    for j, c in enumerate(skipped_list[1:]):
        if skipped_list[j] == c:
            skipped_list[j+1] = "n"
    for c in skipped_list:
        ans += score_map[c]
print(ans)


Measured memory_bytes: 5468
#define _USE_MATH_DEFINES
#include  <iostream>
#include  <algorithm>
#include  <climits>
#include  <vector>
#include  <string>
#include  <cstring>
#include  <stack>
#include  <queue>
#include  <cmath>
#include  <iomanip>
#include  <set>
#include  <map>
#include  <new>
#include <cstdint>
#include <cctype>
using namespace std;
#define rep(i,n)  for(int i = 0; i < n; i++)
#define lrep(i,n,m)  for(int i = n; i < m; i++)

using ll = long long;
using Vii = vector<vector<int> >;
using Gjudge = vector<vector<bool>>;
using Vi = vector<int>;
using Vl = vector<ll>;
using Vll = vector<vector<ll> >;
using Vs = vector<string>;
using Vb = vector<bool>;
using the = pair<int, int>;
using lthe = pair<ll, ll>;

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

const int Mod = static_cast<int>(1e9 + 7);
const int INF = INT_MAX;
const int dx[4] = { 1,0,-1,0 };
const int dy[4] = { 0,1,0,-1 };


priority_queue<the> p[200000];
const int MAXP = 2 * 1e5;

int main()
{
	ll n;
	cin >> n;
	
	int s = 0;
	ll ksum = 0;
	for (ll k = 26; ksum + k <= n; k *= 26) {
		s++;
		ksum += k;
	}
	//cout << ksum << endl;
	n -= ksum;
	n--;
	if (n == -1) {
		rep(i, s)  cout << "z";
		cout << endl;
		return 0;
	}

	s++;
	Vi A(s, 0);
	//cout << n << endl;
	rep(i, s - 1) {
		int t = n % 26;
		A[i] = t;
		n /= 26;
	}
	A[s - 1] = n;
	reverse(A.begin(), A.end());

	for (int u : A) {
		//cout << u << endl;
		cout << char('a' + u);
	}
	cout << endl;
}


Measured memory_bytes: 9852
#include <iostream>
#include <iterator>
#include <vector>
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <string>
#include <numeric>
#include <iomanip>
#include <limits>
#include <set>
#include <map>
#include <type_traits>
#include <cstdint>
#include <queue>
#define _USE_MATH_DEFINES
#include <math.h>
#include <sstream> // std::stringstream
#include <bitset>  // std::bitset<N>

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

using namespace std;

//素因数分解
void factoring(ll n, map<ll, ll>& mp) {
	for (ll i = 2; i * i <= n; i++) {
		while (n % i == 0) {
			mp[i]++;
			n /= i;
		}
	}
	if (n != 1) mp[n]++;
}

//絶対値
template<class T, class U = std::make_unsigned_t<T>>
U SafeAbs( T x ) {
    return x < 0 ? -static_cast<uintmax_t>(x) : x;
}

//最大・最小
template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}

//xのn乗
ll mod_pow(ll x, ll n, ll mod) {
    ll res = 1;
    while (n > 0) {
        if (n & 1) res = res * x % mod;
        x = x * x % mod;
        n >>= 1;
    }
    return res;
}
//xの逆元
ll mod_inv(ll x, ll mod) {//O(log(mod))
    return mod_pow(x, mod - 2, mod);
}

//nCr
ll ncr(ll n, ll r, ll mod){
	ll res=1;
	ll num=1,den=1;
	for(ll i=n;i>=n-r+1;i--){
		(den*=i)%=mod;
	}
	for(ll i=1;i<=r;i++){
		(num*=i)%=mod;
	}
	
	res=den*mod_inv(num,mod);

	return res%mod;
}


//二分探索
bool isOk(ll index, ll key,vector<ll> &a){
	
	if(a[index]>key){
		return true;
	}
	
	return false;
}

ll bin_search(ll key, vector<ll> &a){
	
	ll l=-1;
	ll r=a.size();

	while(abs(r-l)>1){
		ll mid = (l+r)/2;
		if(isOk(mid, key, a)){
			r=mid;
		}
		else{
			l=mid;
		}
	}
	return r;
}

/*
//深さ優先探索
void dfs(vector<vector<ll>> &gra,vector<bool> &seen, ll v){

	seen[v]=true;

	for(auto next : gra[v]){
		if(seen[next]){
			continue;
		}

		dfs(gra,seen,next);
	}
	
}
*/
const ll MOD=1000000007;

ll min(ll a, ll b){
	if(a>=b){
		return b;
	}
	else{
		return a;
	}
}

void solve(){
	ll ans = 0;
	string s;
	cin >> s;

	for (ll i = 0; i < 3;i++){
		if(s[0]=='R'){
			if(s[1]=='R'){
				if(s[2]=='R'){
					ans = 3;
				}
				else{
					ans = 2;
				}
			}
			else{
				ans = 1;
			}
		}
		else{
			if(s[1]=='R'){
				if(s[2]=='R'){
					ans = 2;
				}
				else{
					ans = 1;
				}
			}
			else{
				if(s[2]=='R'){
					ans = 1;
				}
				else{
					ans = 0;
				}
			}
		}
	}
		cout << ans << endl;
}

int main(){
	
	solve();
	
    return 0;
}



Measured memory_bytes: 3624
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rrep(i,n) for(int i=(int)(n-1);i>=0;i--)
#define FOR(i,n,m) for(int i=n;i<=(int)(m);i++)
#define RFOR(i,n,m) for(int i=(int)(n);i>=m;i--)
#define all(x) (x).begin(),(x).end()
#define sz(x) int(x.size())
typedef long long ll;
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;
const double PI=3.14159265358979323846;
using namespace std;
vector<int> dy={1,0,-1,0};
vector<int> dx={0,1,0,-1};
template<class T>
vector<T> make_vec(size_t a){
    return vector<T>(a);
}
template<class T, class... Ts>
auto make_vec(size_t a, Ts... ts){
    return vector<decltype(make_vec<T>(ts...))>(a, make_vec<T>(ts...));
}

int main() {
    int a,b;
    cin>>a>>b;
    cout<<max(0,a-b-b)<<endl;
}


Measured memory_bytes: 764
import sys

n, q = list(map(int, input().split()))
aaa = list(map(int, input().split()))
xxx = sorted(((int(line), i) for i, line in enumerate(sys.stdin.readlines())), reverse=True)
total = sum(aaa)
tmp = sum(aaa[n // 2:])
ans = [sum(aaa[-1::-2])] * q
if n % 2 == 0:
    l, r = 1, n // 2
else:
    l, r = 0, n // 2
while l < r:
    al, ar = aaa[l], aaa[r]
    m = (al + ar) // 2
    while xxx and xxx[-1][0] <= m:
        x, i = xxx.pop()
        ans[i] = tmp
    if not xxx:
        break
    tmp += al - ar
    l += 2
    r += 1
print('\n'.join(map(str, ans)))


Measured memory_bytes: 28796
#[allow(unused_imports)]
use std::cmp::*;
#[allow(unused_imports)]
use std::collections::*;
use std::io::Read;
#[allow(dead_code)]
fn getline() -> String {
    let mut ret = String::new();
    std::io::stdin().read_line(&mut ret).ok().unwrap();
    ret
}
fn get_word() -> String {
    let mut stdin = std::io::stdin();
    let mut u8b: [u8; 1] = [0];
    loop {
        let mut buf: Vec<u8> = Vec::with_capacity(16);
        loop {
            let res = stdin.read(&mut u8b);
            if res.unwrap_or(0) == 0 || u8b[0] <= b' ' {
                break;
            } else {
                buf.push(u8b[0]);
            }
        }
        if buf.len() >= 1 {
            let ret = String::from_utf8(buf).unwrap();
            return ret;
        }
    }
}

#[allow(dead_code)]
fn get<T: std::str::FromStr>() -> T { get_word().parse().ok().unwrap() }

fn numdig(a: i64) -> usize {
    format!("{}", a).len()
}

fn solve() {
    let n: i64 = get();
    let mut mi = 0xdeadc0de;
    for a in 1 .. (n as f64).sqrt() as i64 + 1 {
        if n % a != 0 { continue; }
        let b = n / a;
        mi = min(mi, max(numdig(a), numdig(b)));
    }
    println!("{}", mi);
}

fn main() {
    // In order to avoid potential stack overflow, spawn a new thread.
    let stack_size = 104_857_600; // 100 MB
    let thd = std::thread::Builder::new().stack_size(stack_size);
    thd.spawn(|| solve()).unwrap().join().unwrap();
}


Measured memory_bytes: 8572
fun main(args: Array<String>) {
    var (l, r) = readLine()!!.split(' ').map{ it.toLong() }
    var min = 2020L
    var pos: Long
    for (i in l until r ) {
        for (j in i+1 until r + 1) {
            val pos = i * j
            min = Math.min(min,pos % 2019L)
            if (min == 0L) break
        }
        if (min == 0L) break
    }
    println (min)
}


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

int main(){
    int r, g, b;
    cin >> r >> g >> b;

    if((r*100+g*10+b) % 4 == 0){
        cout << "YES" << endl;
    }else{
        cout << "NO" << endl;
    }

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<int,P> P1;
typedef pair<P,P> P2;
#define pu push
#define pb push_back
#define mp make_pair
#define eps 1e-7
#define INF 1000000000
#define mod 1000000007
#define fi first
#define sc second
#define rep(i,x) for(long long i=0;i<x;i++)
#define repn(i,x) for(long long i=1;i<=x;i++)
#define SORT(x) sort(x.begin(),x.end())
#define ERASE(x) x.erase(unique(x.begin(),x.end()),x.end())
#define POSL(x,v) (lower_bound(x.begin(),x.end(),v)-x.begin())
#define POSU(x,v) (upper_bound(x.begin(),x.end(),v)-x.begin())
vector<pair<string,P> >vec;
// vector<vector<int>> data(3, vector<int>(4));


int main(){	
	long long N;
	scanf("%lld",&N);
	if (N%2 == 1) {
		cout << "0" << endl;
		return 0;
	}
	ll res = 0, f = 10;
	while(N/f > 0) {
		res += N/f;
		f *= 5;
	}
	cout << res << endl;
	return 0;
}



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

using namespace std;
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define RFOR(i, a, b) for (int i = (b)-1; i >= (a); i--)
#define rep(i, n) for (int i = 0; i < (n); i++)
#define rep1(i, n) for (int i = 1; i < (n); i++)
#define rrep(i, n) for (int i = (n)-1; i >= 0; i--)
#define all(i) (i).begin(), (i).end()
#define rall(i) (i).begin(), (i).end(), greater<int>()
#define int long long
#define elif else if
#define eb emplace_back
#define pb push_back
#define mp make_pair
#define fst first
#define sec second
#define mod 1000000007
#define INF 10e10
template <typename T>

void print(T x)
{
	std::cout << x << " ";
}

template <typename T>

void println(T x)
{
	std::cout << x << "\n";
}

signed main(void) {
	int q;
	cin >> q;
	vector<pair<int, int>>lr(q);
	rep(i, q) {
		int l,r;
		cin >> l >> r;
		lr[i] = make_pair(l, r);
	}

	vector<bool>is_prime(100002, true);
	vector<int>c(100001, 0);//0からiまでで2017に似た数の個数
	is_prime[0] = is_prime[1] = false;
	FOR(i, 2, 100002) {
		if (is_prime[i]) {
			for (int j = 2*i; j <= 100000; j += i) {
				is_prime[j] = false;
			}
		}
	}
	c[0] = c[1] = c[2] = 0;
	for(int i=3;i<=100000;i+=2){
		if (is_prime[i] && is_prime[(i + 1) / 2]) { 
			c[i]=c[i-2]+1;
		}
		else c[i] = c[i - 2];
	}
	rep(i, q) {
		if (lr[i].first == 1) {
			println(c[lr[i].second] - c[0]);
		}
		else {
			println(c[lr[i].second] - c[lr[i].first - 2]);
		}
	}
}

Measured memory_bytes: 5460
#define _GLIBCXX_DEBUG
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
using namespace std;
using vs = vector<string>;

int main(void){
    int n;
    cin >> n;
    vs key;
    map<string, int> cnt;
    for(int i=0; i<n; i++){
        string s;
        cin >> s;
        if(cnt.count(s)) cnt.at(s)++;
        else {cnt[s] = 1; key.push_back(s);}
    }
    sort(key.begin(), key.end());
    int mx=0;
    for(string &s : key) if(cnt.at(s)>mx) mx = cnt.at(s);
    for(string &s : key) if(cnt.at(s)==mx) cout << s << '\n';
    return 0;
}

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

using namespace std;

#define rep(i,n) for(int i=0;i<(n);++i)
#define out(S) cout<<(S)<<endl;
#define ShowAll(collection) for(auto i:collection){out(i);}
#define beginend(v) v.begin(),v.end()

using pii=pair<int,int>;
using ll=long long;
using ull=unsigned long long;
using vi=vector<int>;
using vvi=vector<vi>;
using vvc=vector<vector<char>>;
using ti3=tuple<int,int,int>;
template<typename T> void removeAt(vector<T>& v, int index) { v.erase(v.begin() + index); }

ll get(ll x,int k){
  return k*((x)/(k-1))+(x%(k-1))+1;
}

ll make(int n,int k){
  ll x=0;
  rep(_,n-1){
    x=get(x,k);
  }
  return x;
}

int main(){
  int n,k;
  cin >> n>> k;
  out(make(n,k));
}



Measured memory_bytes: 3088
#include<stdio.h>
#include<stdlib.h>
#include<math.h>

/*long long cmp(const void *a,const void *b){
  return *(long long*)b - *(long long*)a;
}*/

int cmp(const void *a, const void *b) {
  long long *A = (long long *)a;
  long long *B = (long long *)b;
  if (*A > *B) return -1;
  if (*A < *B) return 1;
  return 0;
}

int main(void){
  int x,y,z,k,i,j,s,cnt,flag=0;
  scanf("%d %d %d %d",&x,&y,&z,&k);
  long long a[x],b[y],c[z];
  
  //入力
  for(i=0;i<x;i++) scanf("%lld",&a[i]);
  for(i=0;i<y;i++) scanf("%lld",&b[i]);
  for(i=0;i<z;i++) scanf("%lld",&c[i]);
  long long int n[k*k];
  
  //ソート
  //qsort(a,x,sizeof(long long),cmp);
  //qsort(b,y,sizeof(long long),cmp);
  //qsort(c,z,sizeof(long long),cmp);
  cnt=0;
  
  //a,bの組み合わせ
  for(i=0;i<x;i++){
    for(j=0;j<y;j++){
      n[cnt]=a[i]+b[j];
      cnt++;
    }
  }
  qsort(n,x*y,sizeof(long long),cmp);
  cnt=0;
  long long m[k*z];
  //a,b,cの組み合わせ
  if(x*y<k){
    for(i=0;i<x*y;i++){
      for(j=0;j<z;j++){
        m[cnt]=n[i]+c[j];
        cnt++;
      }
    }
    qsort(m,x*y*z,sizeof(long long),cmp);
  }else{
    for(i=0;i<k;i++){
      for(j=0;j<z;j++){
        m[cnt]=n[i]+c[j];
        cnt++;
      }
    }
    qsort(m,k*z,sizeof(long long),cmp);
  }
  for(i=0;i<k;i++) printf("%lld\n",m[i]);
  return 0;
}

Measured memory_bytes: 56840
#include <cmath>
#include <iomanip>
#include <iostream>

using namespace std;

const double eps = 1e-10;
const double pi = 3.1415926535897932384626433;

long long a, b, x;

bool is_ok(double kakudo) {
  double rad = kakudo / 180 * pi;
  double V = 0;
  if (rad > atan2(b, a)) {
    double h = b * tan(pi / 2 - rad);
    V = (a * b) * h / 2;
  } else {
    double h = a * tan(rad);
    V = a * a * (b - h);
    V += a * a * h / 2;
  }
  return V <= x;
}

int main() {
  std::cout << std::setprecision(20) << std::fixed;
  cin >> a >> b >> x;

  double high = 90, low = 0;
  while (abs(high - low) > eps) {
    double mid = (high + low) / 2;
    if (is_ok(mid)) {
      high = mid;
    } else {
      low = mid;
    }
  }
  cout << high << endl;

  return 0;
}

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

using namespace std;
#define int int64_t
#define rep(i, n) for (int i = 0; i < (n); i++)
#define reps(i, n) for (int i = 1; i <= (n); i++)
#define all(x) (x).begin(), (x).end()
#define gsort(x) sort((x).begin(), (x).end(), greater<int>())
#define rv(s) reverse((s).begin(), (s).end())
#define pii pair<int, int>
#define re(s) reverse((s).begin(), (s).end())
#define setout(n, x) setw(n) << setfill(x)
#define Fixed fixed << setprecision(10);
const long long mod = 1e9 + 7;

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

   int n, a, cnt = 0;
   cin >> n;
   vector<int> x;

   rep(i, n)
   {
      cin >> a;
      x.push_back(a);
      cnt += a;
   }

   sort(all(x));

   cnt -= (x[x.size() - 1] / 2);

   cout << cnt << '\n';
}

Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
#define USE_LLONG_AS_INT
#ifdef USE_LLONG_AS_INT
#define int long long
#define inf (1ll<<60)
#else
#define inf (1<<30)
#endif
#define rep(i,n) for(int i=0;i<(n);i++)
#define Rep(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,a,b) for(int i=(a);i<=(b);i++)
#define rev(i,n) for(int i=(n)-1;i>=0;i--)
#define vi vector<int>
#define vvi vector<vi>
#define pb push_back
#define eb emplace_back
#define pi pair<int,int>
#define vp vector<pair<int,int>>
#define mp make_pair
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second
#define MEMSET(a) memset(a,0,sizeof(a))
#define Yes(f) cout<<(f?"Yes":"No")<<endl
#define yes(f) cout<<(f?"yes":"no")<<endl
#define YES(f) cout<<(f?"YES":"NO")<<endl
#define SORT(v) sort(all(v))
#define RSORT(v) sort(all(v), greater<int>())

using namespace std;

const int mod=1e9+7;
const string sp=" ";

void run();

void init() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout<<fixed<<setprecision(12);
}

signed main(){
    init();
    run();
    return 0;
}

void run(){
    int n;
    string s;
    cin>>n>>s;
    int r=0,g=0,b=0;
    rep(i,n){
        if(s[i]=='R')r++;
        if(s[i]=='G')g++;
        if(s[i]=='B')b++;
    }
    int ans=r*g*b;
    rep(i,n){
        Rep(j,i+1,n){
            int k=2*j-i;
            if(k>=n)continue;
            if(s[i]!=s[j]&&s[j]!=s[k]&&s[i]!=s[k])ans--;
        }
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 3660
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<stdbool.h>
#include<ctype.h>
#define PI 3.141592653589
#define N_MAX 1000
#define NUM 26
#define min(x,y) x < y ? x : y
#define max(x,y) x > y ? x : y

int main()
{
  int n, len, i, j, a_point = 0, b_point = 0;
  char a[N_MAX],b[N_MAX];
  scanf("%d",&n);
  for(i = 0; i < n; i++)
    {
      scanf("%s %s",a,b);
      if(strcmp(a,b) == 0) 
	{	     
	  a_point++;
	  b_point++;
	}
      else if(strncmp(a,b,min(strlen(a),strlen(b))) == 0)
	{
	  if(strlen(a) > strlen(b)) a_point += 3;
	  else b_point += 3;
	}
      else
	{
	  len = min(strlen(a),strlen(b));
	  j = 0;
	  while(j < len)
	    {
	      if(a[j] - 'a' > b[j] - 'a')
		{
		  a_point += 3;
                  break;
		}
	      else if(a[j] - 'a' < b[j] - 'a')
		{
		  b_point += 3;
		  break;
		}
	      else
		{
		  j++;
		}
	    }
	}
    }
  printf("%d %d\n",a_point,b_point);
  return 0; 
}

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


int tax(int x, int s)
{
  return s * (100 + x) / 100;
}
int solve(int x, int y, int s)
{
  int maximum = 0;
  for(int i=1; i<s; i++){
    for(int j=i; j<s; j++){
      if(tax(x, i) + tax(x, j) == s){
        maximum = max(maximum, tax(y, i) + tax(y,j));
      }
    }
  }
  return maximum;
}

int main(){
  int x, y, s;
  while(cin >> x >> y >> s && x >0){
    cout << solve(x, y, s) << endl;
  }
  return 0;
}



Measured memory_bytes: 3132
#include<bits/stdc++.h>
using namespace std;
int gcd(int a,int b)
{
  if(a==0) return b;
  return gcd(b%a,a);
}
int main()
{
  ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
  int k; cin>>k;
  int sum=0;
  for(int i=1;i<=k;i++)
  {
    for(int j=1;j<=k;j++)
    {
      for(int l=1;l<=k;l++){
        sum+=gcd(i,gcd(j,l));
     	}
    }
  }
  cout<<sum;
   return 0;
}


Measured memory_bytes: 3576
ri = lambda: int(input())
rl = lambda: list(map(int,input().split()))
rr = lambda N: [ri() for _ in range(N)]
YN = lambda b: print('YES') if b else print('NO')
yn = lambda b: print('Yes') if b else print('No')
OE = lambda x: print('Odd') if x%2 else print('Even')
INF = 10**18

N=ri()
b=rl()

def ANS():
    ans = []
    for i in range(N):
        rm_i = -1
        for j in range(N-i):
            if b[j] == (j+1):
                rm_i = j
            if j==(N-i-1) and rm_i==-1:
                return -1
        ans.append(b.pop(rm_i))
    return ans
    
res = ANS()
if res==-1:
    print('-1')
else:
    for r in res[::-1]:
        print(r)


Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define ft first
#define sc second
#define pt(sth) cout << sth << "\n"
#define chmax(a, b) {if(a<b) a=b;}
#define chmin(a, b) {if(a>b) a=b;}
#define moC(a, s, b) (a)=((a)s(b)+MOD)%MOD
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
static const ll INF=1e18;
static const ll MAX=101010;
static const ll MOD=1e9+7;



int main() {
  ll N, D, A;
  cin >> N >> D >> A;
  vector<P> p(N+1);
  vector<ll> v;
  ll i;
  
  priority_queue<P> q;
  for(i=0; i<N; i++) {
    ll x, h;
    cin >> x >> h;
    p[i].ft=x;
    p[i].sc=(h+A-1)/A;
  }
  p[N]=P(INF, INF);
  sort(p.begin(), p.end());
  
  vector<ll> x(N+1);
  vector<ll> h(N+1);
  for(i=0; i<=N; i++) {
    x[i]=p[i].ft;
    h[i]=p[i].sc;
  }
  
  ll cnt[MAX*2]={};
  ll ans=0;
  for(ll l=0; l<N; l++) {
    if(h[l]>=cnt[l]) {
      ll r=upper_bound(x.begin(), x.end(), x[l]+D*2)-x.begin();
      
      ll dam=h[l]-cnt[l];
      ans+=dam;
      cnt[l]+=dam;
      cnt[r]-=dam;
    }
    
    cnt[l+1]+=cnt[l];
  }
  
  
  pt(ans);
  
}





Measured memory_bytes: 8064
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<cmath>
#include<cstdio>
 
using namespace std;
 
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,s,n) for(int i=(s);i<(n);i++)
#define repr(i,n) for(int i=n-1;i>=0;i--)
#define REPR(i,s,n) for(int i=(s);i>=(n);i--)
#define pb push_back
#define pf push_front
 
typedef vector<int> vi;
typedef vector<string> vs;
typedef long long ll;
typedef vector<ll> vll;
 
ll gcd(ll x, ll y) {
	ll r;
	while ((r = x % y) != 0) {
		x = y;
		y = r;
	}
	return y;
	}
ll lcm(ll x, ll y) {
	x /= gcd(x, y);
	y /= gcd(x, y);
	return (x*y);
}

int main()
{
    int a,b,c,x,n,cnt=0;
    vi sum;
    cin >> a >> b >> c >> x;
    rep(i,a+1){
        rep(j,b+1){
            rep(k,c+1){
                n=500*i+100*j+50*k;
                if(n==x) cnt++;
            }
        }
    }
    cout << cnt << endl;
	return 0;
}


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

int main() {
  int mod=1000000007;
  int n;
  cin >> n;
  string s;
  cin>>s;
  int ans=0;
  rep(i,1000){
    int i0=i/100;
    int i1=(i-i/100*100)/10;
    int i2=i%10;
    int x=n;
    int y=n;
    int z=n;
    rep(j,n){
      if(s.at(j)-'0'==i0){
        x=j;
        break;
      }
    }
    rep2(j,x+1,n){
      if(s.at(j)-'0'==i1){
        y=j;
        break;
      }
    }
    rep2(j,y+1,n){
      if(s.at(j)-'0'==i2){
        z=j;
        break;
      }
    }
    if(z<n){
      ans++;
    }
    
  } 
  cout<<ans<<endl;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String[] args){
		Scanner scan=new Scanner(System.in);
		int W=scan.nextInt();
		int H=scan.nextInt();
		int x=scan.nextInt();
		int y=scan.nextInt();
		int r=scan.nextInt();
		
		if( (x>=r && x+r<=W)&& (y>=r && y+r<=H) )System.out.println("Yes");
		else System.out.println("No");
		
	}
}


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

int main (void){
  int a,b,c,d;
  cin>>a>>b>>c;

  if( a > b ){
    d=a;
    a=b;
    b=d;
  }
  if( b > c ){
    d=b;
    b=c;
    c=d;
}
  if( a > b ){
    d=a;
    a=b;
    b=d;
  }

  cout << a << " " << b << " " << c <<"\n";

 return 0;
}

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

#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;

#define ll          long long
#define pb          push_back
#define vi          vector<ll int>
#define all(a)      (a).begin(),(a).end()
#define F           first
#define S           second
#define rs(v,n)     v.resize(n)
#define hell        1000000007
#define peak        9123372036854775807
#define pii         acos(-1)
#define clr(a,x)    memset(a,x,sizeof(a))
#define ios         ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define ordered_set tree<ll int, null_type,less<ll int>, rb_tree_tag,tree_order_statistics_node_update>
using namespace std;
template<class x,class y> x sum(x a,y b){return a+b;}
template<class x,class y> x mul(x a,y b){return a*b;}
template<class x,class y> x sub(x a,y b){return a-b;}
template<class x,class y> x divi(x a,y b){return a/b;}

template<class x,class y>
istream &operator>>(istream &in,pair<x,y> &p) 
{ 
    in>>p.F>>p.S;
    return in;
}
template<class x>
istream &operator>>(istream &in,vector<x> &v) 
{
    for(auto& i:v)
        in>>i;
    return in;
}
template<class x,class y>
ostream &operator<<(ostream &out,pair<x,y> &p) 
{ 
    out<<"("<<p.F<<","<<p.S<<") ";
    return out; 
}
template<class x>
ostream &operator<<(ostream &out,vector<x> &v) 
{ 
    out<<v.size()<<endl;
    for(auto i:v)
        out<<i<<" ";
    out<<endl;
    return out; 
}
#define N  1000005

vector<string> v;

int main()
{
    ios;
    ll tt=1;
    // cin>>tt;
    while(tt--)
    {
    	ll i,j,k,l,m,n;
    	cin>>n>>m;
    	for(i=0;i<n;i++)
    	{
    		string x;
    		cin>>x;
    		v.pb(x);
    	}
    	ll dis[30][30],vis[30][30];
    	set<pair<ll,ll>> ss;
    	ss.insert({0,1});ss.insert({0,-1});ss.insert({1,0});ss.insert({-1,0});
    	ll ans=0;
    	for(i=0;i<n;i++)
    	{
    		for(j=0;j<m;j++)
    		{
    			if(v[i][j]=='#')continue;
    			for(ll ii=0;ii<n;ii++)for(ll jj=0;jj<m;jj++) vis[ii][jj]=0,dis[ii][jj]=0;
    			queue<pair<ll,ll>> q;
    			q.push({i,j});
    			dis[i][j]=0;
    			vis[i][j]=1;
    			while(!q.empty())
    			{
    				auto x=q.front();
    				q.pop();
    				for(auto y:ss)
    				{
    					y.F=x.F+y.F;
    					y.S=x.S+y.S;
    					if(y.F<0||y.S>=m||y.F>=n||y.S<0||vis[y.F][y.S]==1||v[y.F][y.S]=='#')
    						continue;
    					dis[y.F][y.S]=dis[x.F][x.S]+1;
    					ans=max(ans,dis[y.F][y.S]);
    					vis[y.F][y.S]=1;
    					q.push({y.F,y.S});
    				}
    			}
    		}
    	}
    	cout<<ans;
    }
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <math.h>
#include <stdio.h>
#include <algorithm>
#include <utility>
#include <functional>
#include <map>
#include <queue>
#include <list>
#define rep(i,n) for(int i=0;i<(n);i++)
#define crep(i) for(char i='a';i<='z';i++)
#define psortsecond(A,N) sort(A,A+N,[](const pii &a, const pii &b){return a.second<b.second;});
#define psortfirst(A,N) sort(A,A+N,[](const pii &a, const pii &b){return a.first<b.first;});
#define All(x) (x).begin(),(x).end()
int ctoi(const char c){
  if('0' <= c && c <= '9') return (c-'0');
  return -1;
}
using namespace std;
using pii  = pair<int,int>;
long long gcd(long long a, long long b){return (b == 0 ? a : gcd(b, a%b));}
long long lcm(long long a, long long b){return a*b/gcd(a,b);}
typedef long long ll;
#define MOD 1000000007
#define EPS 10e-8

ll dp[100007][3];
ll moji[100007][3];
ll re[100007][3];

map<ll,ll> M;
vector<ll> V;
int main() {
  ll N,K,C=0;
  char S[100007],l[3],r[3];
  cin >> N >> K >> S;
  rep(i,N){
    if(i>0){
      if(S[i-1]==S[i]){
        C++;
      }
    }
  }
  rep(i,K){
    C+=2;
  }
  cout << min(C,N-1) << endl;
}

Measured memory_bytes: 888
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=int(a);i<int(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define VIEW(x) do {cerr << #x << ": "; for(auto i : x) cerr << i << " "; cerr << endl;} while(0)
#define ALL(x) (x).begin(),(x).end()
template<class T>bool umax(T &a, const T &b) {if(a<b){a=b;return 1;}return 0;}
template<class T>bool umin(T &a, const T &b) {if(b<a){a=b;return 1;}return 0;}

template<typename A,size_t N,typename T> void FILL(A (&array)[N],const T &val){fill((T*)array,(T*)(array+N),val);}
template<typename T> void FILL(vector<T> &v, const T &x) {fill(v.begin(), v.end(), x);}
template<typename T> void FILL(vector<vector<T>> &v, const T &x) {for(auto &i:v)fill(i.begin(), i.end(), x);}

int main() {
  int d,t,s; cin >> d >> t >> s;
  if(t >= (d+s-1) / s) puts("Yes");
  else puts("No");
}


Measured memory_bytes: 3620
def max_(s, q, j):
  num = 0
  for i in range(1, q):
    if s[0][j] < s[i][j]:
      num += 1
  if num > q*2/3:
    return False
  else:
    return True
  
D = int(input())
N = 26
c = [int(i) for i in input().split()]
last = [0 for i in range(N)]
s = list()
q = 7
for i in range(q):
  s.append([int(j) for j in input().split()])
  
for i in range(D-q):
  d_score = -1
  ans = -1
  ans_d = -1
  for j in range(N):
    last_day = (i + 1 - last[j])
    arg = s[0][j] + c[j]*last_day
    if d_score < arg and max_(s, q, j):
      d_score = arg
      ans = j+1
    if d_score < arg:
      ans_d = j+1
  if ans == -1:
    ans = ans_d
  print(ans)
  del s[0]
  s.append([int(j) for j in input().split()])
  last[ans-1] = i+1
for i in range(q):
  d_score = -1
  ans = -1
  for j in range(N):
    last_day = i + 1 - last[j]
    arg = s[i][j] + c[j]*last_day
    if d_score < arg:
      d_score = arg
      ans = j+1
  print(ans)
  last[ans-1] = D-q+i+1

Measured memory_bytes: 9124
#include <iostream>
using namespace std;
int main(void){
    int A,B;
    cin>>A>>B;
    
    if(A==B){
        cout<<"Draw"<<endl;
    }
    else if(A==1&&B>1){
        cout<<"Alice"<<endl;
    }
    else if(B==1&&A>1){
        cout<<"Bob"<<endl;
    }
    else if(A>B){
        cout<<"Alice"<<endl;
    }
    else{
        cout<<"Bob"<<endl;
    }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, e) for(int (i) = 0; (i) < (e); ++(i))
#define FOR(i, b, e) for(int (i) = (b); (i) < (e); ++(i))
#define ALL(c) (c).begin(), (c).end()
#define PRINT(x) cout << (x) << "\n"
using namespace std;
using ll = long long; using pint = pair<int, int>; using pll = pair<ll, ll>;
const long long MOD = 1000000007;

ll H, W, Ch, Cw, Dh, Dw;
bool S[1001][1001];
bool visited[1001][1001];
ll dist[1001][1001];

ll bfs(){
    using item = pair<ll, pll>;
    priority_queue<item, vector<item>, greater<item>> que; 
    que.push(item(0, pll(Ch, Cw)));
    while(!que.empty()){
        ll d = que.top().first;
        ll i = que.top().second.first;
        ll j = que.top().second.second;
        que.pop();
        if(S[i][j] == false) continue;
        dist[i][j] = d;
        if(i == Dh && j == Dw){
            return d;
        }
        if(i > 0 && d < dist[i - 1][j] && S[i - 1][j]){
            dist[i - 1][j] = d;
            que.push(item(d, pll(i - 1, j)));
        }
        if(i < H - 1 && d < dist[i + 1][j] && S[i + 1][j]){
            dist[i + 1][j] = d;
            que.push(item(d, pll(i + 1, j)));
        }
        if(j > 0 && d < dist[i][j - 1] && S[i][j - 1]){
            dist[i][j - 1] = d;
            que.push(item(d, pll(i, j - 1)));
        }
        if(j < W - 1 && d < dist[i][j + 1] && S[i][j + 1]){
            dist[i][j + 1] = d;
            que.push(item(d, pll(i, j + 1)));
        }
        for(ll k = i - 2; k <= i + 2; k++){
            if(k < 0 || k >= H) continue;
            for(ll l = j - 2; l <= j + 2; l++){
                if(l < 0 || l >= W) continue;
                if(S[k][l] && d + 1 < dist[k][l]){
                    dist[k][l] = d + 1;
                    que.push(item(d + 1, pll(k, l)));
                }
            }
        }
    }
    return -1;
}

signed main(){
    cin >> H >> W >> Ch >> Cw >> Dh >> Dw;
    Ch--; Cw--; Dh--; Dw--;
    string str;
    REP(i, H){
        cin >> str;
        REP(j, W){
            S[i][j] = (str[j] == '.');
            dist[i][j] = LONG_LONG_MAX / 2;
        }
    }
    PRINT(bfs());
    /*
    REP(i, H){
        REP(j, W) cerr << dist[i][j] << " ";
        cerr << endl;
    }
    */
    return 0;
}

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

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

    long a, b, c, x, y;
    cin >> a >> b >> c >> x >> y;

    long min_num = min(x, y);
    long sum = 0;
    if (a + b < c * 2) {
        sum += (a + b) * min_num;
    } else {
        sum += c * 2 * min_num;
    }

    if (x > y) {
        if (a < c * 2) {
            sum += a * (x - min_num);
        } else {
            sum += c * 2 * (x - min_num);
        }
    } else {
        if (b < c * 2) {
            sum += b * (y - min_num);
        } else {
            sum += c * 2 * (y - min_num);
        }
    }


    cout << sum << '\n';

    return 0;
}


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

using ll = long long;
#define REP(i,n) for(int i=0; i < (n); ++i)
#define REPR(i,n) for(int i=(n); i >= 0; --i)
#define FOR(i, m, n) for(int i = (m); i < (n); ++i)

#define INF 1e9

int main(){
  ll N, P;
  cin >> N >> P;
  ll ans = 1;
  if(N == 1){
    cout << P << endl;
    return 0;
  }
  for(ll i = 2; i * i <= P; i++){
    int cnt = 0;
    while(P % i == 0){
      cnt++;
      P/= i;
    }
    cnt /= N;
    REP(j, cnt){
      ans *= i;
    }
  }
  cout << ans << endl;
  return 0;
}


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

int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	int n,m;
	cin >> n >> m;
	int sum = 0;
	for (int i = 1; i <= m; i++)
	{
		int x;
		cin >> x;
		sum += x;
	}
	if( sum > n ) cout << -1 << '\n';
	else cout << n - sum << '\n';
	return 0;
}


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

int main()
{
    int h, w;
    cin >> h >> w;
    char a[10][10];
    int ans = 0;
    for(int i = 0; i < h; i++){
        for(int j = 0; j < w; j++){
            cin >> a[i][j];
            if(a[i][j] == '#') ans++;
        }
    }
    if(ans == h + w - 1) cout << "Possible" << endl;
    else cout << "Impossible" << endl;
}

Measured memory_bytes: 256
from sys import stdin
import math
# from sympy import nextprime
class hash():
    def __init__(self,n):#ｎは素数
        self.n=1000003
        self.memo=[None]*self.n
    def madekey(self,key):
        if key=='A':return '1'
        elif key=='C':return '2'
        elif key=='G':return '3'
        elif key=='T':return '4'
    def getkey(self,KEY):
        key=""
        for S in KEY:
            key=key+self.madekey(S)
        return int(key)
    def h1(self,key):
        return key%self.n
    def h2(self,key):
        return (key%(self.n-1))+1
    def insert(self,S):
        key=self.getkey(S)
        h1 = self.h1(key)
        h2 = self.h2(key)
        for i in range(0,self.n+1):
            j=(h1+(i*h2)) % self.n
            if self.memo[j] is None:
                self.memo[j]=S
                break

    def search(self,S):
        key = self.getkey(S)
        h1 = self.h1(key)
        h2 = self.h2(key)
        for i in range(0,self.n+1):
            j = (h1+(i*h2)) % self.n
            if self.memo[j] ==S:
                return 'yes'
            elif self.memo[j] is None or i ==self.n:
                return 'no'
n=list(map(int,(stdin.readline().strip().split())))
dic=hash(n)
for _ in range(n[0]):
    S =list(stdin.readline().strip().split())
    if S[0]=='insert':
        dic.insert(S[1])
    elif S[0]=='find':
        print(dic.search(S[1]))



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


int main() {

  int N, L;
  cin >> N >> L;

  int sum = 0;
  int min = 1000;
  for(int i=1; i<N+1; i++){
    int aji = L + i - 1;
    sum += aji;
    if(abs(aji) < abs(min)) min = aji;
  }

  cout << sum-min << endl;

  


}


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

using namespace std;

const int INF = (int) 1e9;

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

    int n;
    cin >> n;
    int a[n], dp[n];
    for (int i = 0; i < n; ++i) {
        cin >> a[i];
    }

    fill(dp, dp + n, INF);

    for (int i = 0; i < n; ++i) {
        *lower_bound(dp, dp + n, a[i]) = a[i];
    }

    cout << lower_bound(dp, dp + n, INF) - dp << '\n';

    return 0;
}



Measured memory_bytes: 3916
#include <stdio.h>
#include <stdlib.h>

int main(void){
    int num, att, i;
    char *message;

    scanf("%d %d", &num, &att);
    message=(char*)malloc(sizeof(char)*(num+1));
    (void)getchar();
    for(i=0;i<num;i++){
        scanf("%c", &message[i]);
    }

    message[att-1]+=32;
    printf("%s\n", message);
    return 0;
}

Measured memory_bytes: 128
// D - Maximum Average Sets
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vl = vector<ll>;
using vvl = vector<vl>;
using DBL = double;
#define allr(x) (x).rbegin(),(x).rend()
#define rp(i,s,e) for(ll i=(s);i<(e);++i)
#define rpz(i,e) rp(i,0,e)
#define MAX 50

vvl nCr(MAX+1, vl(MAX+1, 0));

void nCr_table_create(ll N){
	rp(n, 0, N+1) rp(r, 0, n+1){
		if(r==0 || n==r) nCr[n][r] = 1;
		else nCr[n][r] = nCr[n-1][r-1] + nCr[n-1][r];
	}
}

int main(){
	ll N,A,B; cin>>N>>A>>B;
	vl V(N); rpz(i, N) cin>>V[i];
	sort(allr(V));

	nCr_table_create(N);

	DBL maxave = 0.0;
	rpz(i, A) maxave += V[i];
	maxave /= A;

	int n = 0, r = 0;
	rpz(i, N){
		if(V[A-1] == V[i]){
			n++;
			if(i < A) r++;
		}
	}

	ll maxcnt = 0;
	if(r == A) rp(r, A, B+1) maxcnt += nCr[n][r];
	else maxcnt = nCr[n][r];

	printf("%.6f\n", maxave);
	cout<< maxcnt <<endl;
}

Measured memory_bytes: 256