akhauriyash/Code-Regression huggingface dataset:
/**
 *    author:  tourist
 *    created: 10.01.2018 14:54:55       
**/
#include <bits/stdc++.h>

using namespace std;

const int N = 6;
const int MASKS = 33;
const int C = 66;

int f[C * N][MASKS][C * N];

int main() {
  int n, c;
  cin >> n >> c;
  vector<int> l(n);
  for (int i = 0; i < n; i++) {
    cin >> l[i];
  }
  sort(l.begin(), l.end());
  n--;
  vector<int> order(n);
  iota(order.begin(), order.end(), 0);
  long long ans = 0;
  do {
    memset(f, 0, sizeof(f));
    f[0][0][l[n] * n] = 1;
    for (int i = 0; i < c * n; i++) {
      for (int mask = 0; mask < (1 << n); mask++) {
        for (int to = i; to <= c * n; to++) {
          int ft = f[i][mask][to];
          if (ft == 0) {
            continue;
          }
          int j = i % n;
          f[i + 1][mask][to] += ft;
          if ((mask & (1 << j)) == 0 && to > i) {
            int new_to = min(c * n, max(to, i + l[order[j]] * n));
            f[i + 1][mask | (1 << j)][new_to] += ft;
          }
        }
      }
    }
    ans += f[c * n][(1 << n) - 1][c * n];
  } while (next_permutation(order.begin(), order.end()));
  long long den = 1;
  for (int i = 1; i <= n; i++) {
    den *= i * c;
  }
  double res = (double) ans / (double) den;
  cout << fixed << setprecision(16) << res << endl;
  return 0;
}


Measured memory_bytes: 20480
#include<algorithm>
#include<iostream>
#include<vector>
#include<string>
#include<queue>
#include<stack>
#include<cmath>
#include<list>
#include<set>
#include<map>

using namespace std;
long long MOD = 1000000007LL;
const double PI = 3.14159265358979323846;
#undef INT_MIN
#undef INT_MAX
#define INT_MIN -2147483648
#define INT_MAX 2147483647
#define endl "\n"

template<class T>
map<T, int> prime_factorization(T n) {
	map<T, int> ret;

	for (long long i = 2; i * i <= n; ++i) {
		while (n % i == 0) {
			ret[i]++;
			n /= i;
		}
	}

	if (n != 1)ret[n] = 1;
	return ret;
}


int main() {

	long long l, r;
	cin >> l >> r;

	if (l / 2019 != r / 2019) {
		cout << 0 << endl;
		return 0;
	}

	long long ans = INT_MAX;
	for (long long i = l; i <= r; ++i) {
		for (long long j = i + 1; j <= r; ++j) {
			ans = min(ans, (i * j) % 2019);
		}
	}

	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 3580
#ifdef _MSC_VER
#include "stdc++.h"
#endif
#ifdef __GNUC__
#include<bits/stdc++.h>
#endif
using namespace std;

using ll = long long;

//constant
const double EPS = 1e-10;
ll MOD = 1000000007;

#define REP(i, n) for (ll i = 0; i < n; i++)
#define FOR(i, s, e) for (ll i = s; i < e; i++)
#define ALL(x) (x).begin(),(x).end()
#define RALL(x) (x).rbegin(), (x).rend()

//debug
#define DUMP(x)  cerr << #x << " = " << (x) << endl;
#define DEBUG(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl;

// vector
//template<typename T> vector<vector<T>> vv(ll H, ll W, T v) { return vector<vector<T>> vec(H, vector<T>(W, v)); }

// view vector
template<typename T> void view(T e) { cout << e << endl; }
template<typename T> void view(const vector<T>& v) { for (const auto& e : v) { cout << e << " "; } cout << endl; }
template<typename T> void view(const vector<vector<T> >& vv) { for (const auto& v : vv) { view(v); } }

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

// ***************************************


int main(void) {
	ll X, Y, nA, nB, nC;
	cin >> X >> Y >> nA >> nB >> nC;
	priority_queue<ll, vector<ll>, greater<ll>> A, B;
	priority_queue<ll, vector<ll>> C;

	ll tmp;
	REP(i, nA) {
		cin >> tmp;
		A.push(tmp);
	}

	REP(i, nB) {
		cin >> tmp;
		B.push(tmp);
	}

	REP(i, nC) {
		cin >> tmp;
		C.push(tmp);
	}

	REP(i, nA - X) {
		A.pop();
	}
	REP(i, nB - Y) {
		B.pop();
	}
	// 番兵
	A.push(1e10);
	B.push(1e10);

	ll ans = 0;
	while (!C.empty()) {
		ll a, b, c;
		a = A.top();
		b = B.top();
		c = C.top(); C.pop();
		if (c < min(a, b)) break;

		ans += c;
		if (a <= b) {
			A.pop();
		}
		else if (a > b){
			B.pop();
		}
	}

	while (A.size() > 1) {
		ans += A.top(); A.pop();
	}
	while (B.size() > 1) {
		ans += B.top(); B.pop();
	}

	cout << ans << endl;
}


Measured memory_bytes: 3316
import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int x = sc.nextInt();
    boolean[] is_prime = new boolean[2 * x + 1];
    for(int i = 1; i <= (2 * x); i++) {
      is_prime[i] = true;
    }
    is_prime[2] = true;
    for(int i = 2; i <= (2 * x); i++) {
      if(is_prime[i]) {
        for(int j = (2 * i); j <= (2 * x); j += i) {
          is_prime[j] = false;
        }
      } 
    }
    int ans = 0;
    for(int i = x; i <= (2 * x); i++) {
      if(is_prime[i]) {
        ans = i;
        break;
      }
    }
    System.out.println(ans);
  }
}

Measured memory_bytes: 23764
#include <bits/stdc++.h>
       
using namespace std;
       
#define ll long long
#define vi vector<int> 
#define pb push_back
#define sz(s) (int)s.size() 
#define all(v) v.begin(), v.end()
       
int x, cnt;
       
int main (){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cin >> x;
	cnt += (x / 500) * 1000;
	x = x % 500;
	cnt += x / 5 * 5;
	cout << cnt;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define lli long long int
#define uli unsigned long long int
#define INF 999999999999999999
#define rep(i,m,n) for(lli i = m;i < n;i++)
#define rrep(i,m,n) for(lli i=m-1;i>=n;i--)
#define pb(n) push_back(n)
#define UE(N) N.erase(unique(N.begin(),N.end()),N.end());
#define Sort(n) sort(n.begin(), n.end())
#define Rev(n) reverse(n.begin(),n.end())
#define Out(S) cout << S << endl
#define NeOut(S) cout << S
#define HpOut(S) cout << setprecision(25) << S << endl
#define Vec(K,L,N,S) vector<L> K(N,S)
#define DV(K,L,N,M,S) vector<vector<L>> K(N,vector<L>(M,S))
#define TV(K,L,N,M,R,S) vector<vector<vector<L>>> K(N,vector<vector<L>>(M,vector<L>(R,S)))
#define pint pair<lli,lli>
#define paf(L,R) pair<L,R>
#define mod 1000000007
#define MAX 10000000
#define ALL(a)  a.begin(),a.end()
#define chmax(a, b) a = (((a)<(b)) ? (b) : (a))
#define chmin(a, b) a = (((a)>(b)) ? (b) : (a))
int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  lli A,B,C,D,E,F,N,M,K,L,R,X,Y,Z,W,H,sum=0,num=0,flag=0;string S,T;
  cin >> N >> M;
  DV(G,int,N,0,0);
  Vec(dist,lli,N,-1);
  queue<pint> edge;
  rep(i,0,M){
    cin >> A >> B;
    G[A-1].pb(B-1);
    G[B-1].pb(A-1);
    edge.push(pint(A-1,B-1));
  }
  queue<int> que;
  while(!edge.empty()){
    auto ne=edge.front();edge.pop();
    rep(i,0,N)dist[i]=-1;
    que.push(0);
    dist[0]=0;
    while(!que.empty()){
      auto v=que.front();que.pop();
      for(auto nv:G[v]){
        if(dist[nv]!=-1||(v==ne.first&&nv==ne.second)||(nv==ne.first&&v==ne.second))continue;
        dist[nv]=dist[v]+1;
        que.push(nv);
      }
    }
    flag=0;
    rep(i,0,N)if(dist[i]==-1)flag=1;
    if(flag)sum++;
  }
  Out(sum);
}

Measured memory_bytes: 256
H,W = map(int,input().split())
S = [None]*W
S = [list(input()) for i in range(H)]

dx = [1,-1,0,0]
dy = [0,0,1,-1]

def max_distance(i,j):
    not_visit = [[-1]*W for i in range(H)]
    not_visit[i][j] = 0
    stack = [(i,j)]

    while stack != []:
        y,x = stack.pop(0)
        for i in range(4):
            if 0<= x+dx[i] <W and 0<= y+dy[i] <H and S[y+dy[i]][x+dx[i]] != "#" and not_visit[y+dy[i]][x+dx[i]] == -1:
                not_visit[y+dy[i]][x+dx[i]] =  not_visit[y][x] + 1
                stack.append((y+dy[i],x+dx[i]))
    
    return not_visit[y][x]

ans = 0
for i in range(H):
    for j in range(W):
        if S[i][j] != "#":
            ans = max(ans,max_distance(i,j))

print(ans)

Measured memory_bytes: 43504
#include<bits/stdc++.h>
#include<tr1/unordered_map>
#define ri register int
using namespace std;
#define fi first
#define se second
typedef long long ll;
typedef pair<int,int> pii;
typedef vector<int> poly;
#define pb push_back
const int rlen=1<<18|1,inf=0x3f3f3f3f;
const ll Inf=1e18;
char buf[rlen],*ib=buf,*ob=buf;
#define gc() (((ib==ob)&&(ob=(ib=buf)+fread(buf,1,rlen,stdin)),ib==ob)?-1:*ib++)
inline int read() {
  int ans=0;
  bool f=1;
  char ch=gc();
  while(!isdigit(ch)) f^=ch=='-',ch=gc();
  while(isdigit(ch)) ans=((ans<<2)+ans<<1)+(ch^48),ch=gc();
  return f?ans:-ans;
}
inline ll readl() {
  ll ans=0;
  bool f=1;
  char ch=gc();
  while(!isdigit(ch)) f^=ch=='-',ch=gc();
  while(isdigit(ch)) ans=((ans<<2)+ans<<1)+(ch^48),ch=gc();
  return f?ans:-ans;
}
inline int Read(char*s) {
  int tp=0;
  char ch=gc();
  while(!isdigit(ch)&&!isalpha(ch)) ch=gc();
  while(isdigit(ch)||isalpha(ch)) s[++tp]=ch,ch=gc();
  return tp;
}
namespace modular {
  const int mod=998244353;
  inline int add(int a,int b) { return a+b<mod?a+b:a+b-mod; }
  inline int dec(int a,int b) { return a<b?a-b+mod:a-b; }
  inline int mul(int a,int b) { return (ll)a*b%mod; }
  inline void Add(int&a,int b) { a=a+b<mod?a+b:a+b-mod; }
  inline void Dec(int&a,int b) { a=a<b?a-b+mod:a-b; }
  inline void Mul(int&a,int b) { a=(ll)a*b%mod; }
  inline int ksm(int a,int p) { int ret=1;for(;p;p>>=1,Mul(a,a)) (p&1)&&(Mul(ret,a),1);return ret; }
  inline int Inv(int a) { return ksm(a,mod-2); }
  inline int sqr(int a) { return mul(a,a); }
  inline int cub(int a) { return (ll)a*a%mod*a%mod; }
}
using namespace modular;
template<typename T> inline void ckmax(T&a,T b) { a<b?a=b:0; }
template<typename T> inline void ckmin(T&a,T b) { a>b?a=b:0; }
template<typename T> inline T gcd(T a,T b) { T t;while(b)t=a,a=b,b=t-t/a*a;return a; }
template<typename T> inline T Abs(T x) { return x<0?-x:x; }
inline int rd() { return rand()|(rand()<<15); }
const int N=1e5+5;
int n;
pii a[N];
ll A=1,B=1;
inline void update(ll x,ll y) { if(x*B<y*A) A=x,B=y; }
int main() {
  #ifdef ldxcaicai
  freopen("lx.in","r",stdin);
  #endif
  n=read();
  ll ss=0,sss=0;
  for(ri i=1,x,y;i<=n;++i) {
    ss+=(x=read()),y=read();
    a[i]=pii(max(x,y),y);
  }
  sort(a+1,a+n+1),reverse(a+1,a+n+1);
  int ps=1;
  for(;sss<ss;++ps) sss+=a[ps].fi;
  --ps;
  ll cur;
  for(ri i=1;i<=n;++i) {
    cur=ss-(sss-a[min(ps,i)].fi);
    if(cur<=a[i].se) update(cur,a[i].se);
  }
  A=B*(n-ps+1)-A,B*=n;
  cur=gcd(A,B),A/=cur,B/=cur;
  cout<<A<<' '<<B<<'\n';
  return 0;
}

Measured memory_bytes: 1280
use std::str::FromStr;

fn get_one<T : FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    return s.trim().parse().ok().unwrap();
}

fn get_vec<T : FromStr>() -> Vec<T> {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    return s.trim().split_whitespace().map(|e| e.parse().ok().unwrap()).collect();
}

fn main() {
    let v : Vec<i32> = get_vec();
    if  v[0] <= v[2] && v[2] <= v[1] {
        println!("{}", "Yes");
    } else {
        println!("{}", "No");
    }
}


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

int main() {
  int N, M;
  cin >> N;
  vector<int> T(N);
  int sum = 0;
  for (int i = 0; i < N; i++) {
    cin >> T[i];
    sum += T[i];
  }
  cin >> M;
  vector<pair<int, int>> px(M);
  for (int i = 0; i < M; i++) cin >> px[i].first >> px[i].second;
  for (int i = 0; i < M; i++) {
    int res = sum + (px[i].second - T[px[i].first-1]);
    cout << res << endl;    
  }
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std; 
using lint  =                           long long int;
using pint  =                           pair<int, int>;
using plint =                           pair<lint, lint>;
#define vli                             vector<lint>
#define pb                              push_back
#define ALL(x)                          begin(x),end(x)
#define inf                             (1LL<63)-1
#define MOD                             1000000007
#define SZ(x)                           ((lint)(x).size())
#define                                 FOR(i, begin, end) for(int i=(begin),i##_end_=(end);i<i##_end_;i++)
#define                                 IFOR(i, begin, end) for(int i=(end)-1,i##_begin_=(begin);i>=i##_begin_;i--)
#define                                 REP(i, n) FOR(i,0,n)
#define                                 IREP(i, n) IFOR(i,0,n)
#define                                 f_ip   ios_base::sync_with_stdio(false); cin.tie(NULL);
#define                                 debug(x) cerr << #x << " " << (x) << endl
struct fast_ios                         { fast_ios(){ cin.tie(0); ios::sync_with_stdio(false); cout << fixed << setprecision(20); }; } fast_ios_;
template<typename T>                    istream &operator>>(istream &is, vector<T> &vec){ for (auto &v : vec) is >> v; return is; }
template<typename T>                    bool mmax(T &m, const T q) { if (m < q) {m = q; return true;} else return false; }
template<typename T>                    bool mmin(T &m, const T q) { if (q < m) {m = q; return true;} else return false; }


/* -------
         |
    **   |
   -------      
   |
   ---------------------------------------------------------------------------------------------------------------------------------*/

void solve(){  
	  int A,B;
	  cin >> A >> B;
	//   int outlet = 1;
	//   int ans = 0;
	//   while(outlet < B){
	//    --outlet;                          //for using this empty socket to install the power strip;
	//    outlet += A;
	//    ++ans;
	//   } 
	//   cout << ans << endl;

    int ret = (B-1 + A-2)/(A - 1);
    cout << ret << endl;
}

int main(){   
  
 solve();

 return 0;
}


Measured memory_bytes: 256
#include <cstdio>

void swap(int &a, int &b) {
    int d;
    if (a>b) {
        d=a;
        a=b;
        b=d;
    }
}

int main() {
    int a, b, c;
    scanf("%d %d %d", &a, &b, &c);
    swap(a,b);
    swap(b,c);
    swap(a,b);
    printf("%d %d %d\n", a,b,c);
}


Measured memory_bytes: 2732
#include <stdio.h>
#include <utility>
#include <algorithm>
#include <iterator>
#include <set>
using namespace std;
typedef pair<int,int> pi;
#define F first
#define S second
const int N=1e5+10;
int min(int a,int b){return a>b?b:a;}
int main(){
    int w,h,n,ans;
    multiset<int> ms;
    multiset<int>::iterator u;
    pi a[N];
    scanf("%d%d%d",&w,&h,&n);
    for(int i=0;i<n;i++){
        scanf("%d%d",&a[i].F,&a[i].S);
        ms.insert(a[i].S);
    }
    sort(a,a+n);
    u=ms.end();
    u--;
    ans=*u;
    n--;
    for(int i=0;i<n;i++){
        ms.erase(ms.find(a[i].S));
        u=ms.end();
        u--;
        ans=min(ans,a[i].F+*u);
    }
    ans=min(ans,a[n].F);
    printf("%d\n",ans);
}


Measured memory_bytes: 8208
#include <bits/stdc++.h>
using namespace std;
#define vt vector
#define ii pair<int,int>
#define mp make_pair
#define vi vt<int>
#define vvi vt<vi>
#define vii vt<ii>
#define vvii vt<vii>
#define For(i,a,b) for(int i = a; i < b; i++)
#define foR(i,a,b) for(int i = a; i <= b; i++)
#define roF(i,a,b) for(int i = a - 1; i >= b; i--)
#define Rof(i,a,b) for(int i = a; i >= b; i--)
#define NEW 0
#define FOUNDED 1
#define CHECKED 2
#define pb push_back
#define pob pop_back
#define mset(a,b) memset(a,b,sizeof(a))

template<class T1, class T2> ostream& operator<< (ostream& the, pair<T1, T2> a){
	the << a.first << "\t" << a.second << "\n";
	return the;
}
template<class T1> ostream& operator<< (ostream& the, vt<T1> a){
	For(i,0,a.size()) {
		the << a[i] << "\n";
	}
	return the;
}


int main () {

//	freopen("INP.txt","r",stdin);
//	freopen("OUT.txt","w",stdout);
//	freopen(".inp","r",stdin);
//	freopen(".in","r",stdin);
//	freopen(".out","w",stdout);
//  ifstream fin("in.txt");
//  ofstream fout("out.txt");
//  ifstream dict("dict.txt");
	int n, ans = 0;
	cin >> n;
	foR(i,1,n){
		int cnt = 0, t = i;
		while(t > 0){
			t /= 10;
			cnt++;
		}
		if(cnt %2 == 1){
			ans++;
		}
	}
	cout << ans;
}



Measured memory_bytes: 256
#!/usr/bin/python

def readints(f):
    return map(int, f.readline().split())

def count(a, b, detours):
    xy = {}
    for i in range(0, a+1):
        xy[(i, 0)] = 0
    for j in range(0,  b+1):
        xy[(0, j)] = 0

    for i, j in detours:
        xy[(i, j)] = 0
    xy[(1, 1)] = 1

    for i in range(1, a+1):
        for j in range(1,  b+1):
            m = xy.get((i, j), None)
            if m is None:
                xy[(i,j)] = xy[(i-1, j)] + xy[(i, j-1)]
    return xy[(a,b)]

import sys

f = sys.stdin
a, b = readints(f)
while a and b:
    n, = readints(f)
    detours = set()
    for i in range(n):
        detours.add(tuple(readints(f)))
    print count(a, b, detours)
    a, b = readints(f)

Measured memory_bytes: 4280
#include<iostream>
#include<vector>
 
using namespace std;
 
int main()
{
  int N;  
  cin>>N;
  vector<long int> A(N);
  for(int loop=0;loop<N;loop++)
  {
    cin>>A[loop];
  }
  
  long int max=A[0];
  long int sum=0;
  for(int loop=1;loop<N;loop++)
  {
    if(A[loop]<max)
    {
      sum+=max-A[loop];
    }
    else if(A[loop]>max)
    {
      max=A[loop];
    }
  }
  
  cout<<sum<<endl;
  return 0;
}

Measured memory_bytes: 4848
import sys
N, M = map(int, sys.stdin.readline().rstrip().split(" "))
bridges = []
for i in range(M):
    a, b = map(int, sys.stdin.readline().rstrip().split(" "))
    a, b = a - 1, b - 1
    bridges.append((a,b))

par = []
# for i in range(N):
#     par[i] = i

# siz = [1] * N

def root(x):
    if par[x] == x:
        return x
    else:
        par[x] = root(par[x])
        return par[x]

def issame(x, y):
    return root(x) == root(y)

def unite(x, y):
    tmpx = root(x)
    tmpy = root(y)

    if tmpx == tmpy:
        return

    # if siz[tmpx] <= siz[tmpy]:
    #     tmpx, tmpy = tmpy, tmpx
    # siz[tmpx] += siz[tmpy]

    par[tmpy] = tmpx

ans = 0
for i in range(M):
    par = [k for k in range(N)]
    for j, e in enumerate(bridges):
        if j == i:
            continue
        a, b = e
        unite(a, b)

    a, b = bridges[i]
    if not issame(a, b):
        ans += 1

print(ans)


Measured memory_bytes: 3064
#include <iostream>
#include <vector>
#include <map>
#include <algorithm>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using namespace std;

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


    //偶数+偶数
    comb_even = (N * (N - 1)) / 2;
    comb_odd = (M * (M - 1)) / 2;

    cout << comb_even + comb_odd;
}


Measured memory_bytes: 888
#include<bits/stdc++.h>
using namespace std;
int main(){
	long long int n,m,sum;
	cin>>n;
	vector<long long int> a(n-1),b(n,0);
	for(int i=0;i<n-1;i++){
		cin>>a[i];
		b[a[i]-1]++;
	}
	for(int i=0;i<n;i++)
	cout<<b[i]<<endl;
}

Measured memory_bytes: 6428
#include <algorithm>
#include <array>
#include <bitset>
#include <complex>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <set>
#include <stack>
#include <unordered_map>
#include <unordered_set>
#include <queue>

using namespace std;

struct Initializer {
  Initializer() {
    cin.tie(0);
    ios::sync_with_stdio(0);
    cout << fixed << setprecision(15);
  }
} initializer;

int main() {
  int a, b, c, d;
  cin >> a >> b >> c >> d;
  cout << min(a, b) + min(c, d) << endl;
}



Measured memory_bytes: 256
#include<algorithm>
#include<string>
#include<vector>
#include<queue>
#include<stack>
#include<map>
#include<iostream>
#define rep(i,x,y) for(int i=x;i<y;i++)
using namespace std;

int main(){
  string s[3];
  cin>>s[0]>>s[1]>>s[2];
  for(int i=0;i<3;i++){
    reverse(begin(s[i]),end(s[i]));
  }
  int now=0;
  while(!s[now].empty()){
    int nxt=(s[now].back()-'a')%3;
    s[now].pop_back();
    now=nxt;
  }
  cout<<(char)(now+'A')<<endl;
}

Measured memory_bytes: 256
#include <algorithm>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <functional>
#include <iostream>
#include <map>
#include <memory>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#include <assert.h>

using namespace std;

typedef long long ll;

#define sz size()
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define all(c) (c).begin(), (c).end()
#define rep(i,a,b) for(ll i=(a);i<(b);++i)
#define per(i,a,b) for(ll i=b-1LL;i>=(a);--i)
#define clr(a, b) memset((a), (b) ,sizeof(a))
#define ctos(c) string(1,c)
#define print(x) cout<<#x<<" = "<<x<<endl;

#define MOD 1000000007

int main(){
  ll a,b,c,d;
  cin>>a>>b>>c>>d;
  ll flag = 1;
  while(1){
    c-=b;
    if(c<=0)break;
    a-=d;
    if(a<=0){
      flag = 0;
      break;
    }
  }
  if(flag==1){
      cout << "Yes" << endl;
  }
  else{
      cout << "No" << endl;
  }
  return 0;
}

Measured memory_bytes: 3604
using System;
using System.Collections.Generic;
using System.Linq;
using System.Numerics;

    class Program
    {
        static void Main(string[] args)
        {
            var plain = Console.ReadLine().Split(' ').Select(s => int.Parse(s)).ToArray();
            var N = double.Parse(Console.ReadLine());
            var input = new List<KeyValuePair<int, double>>();
            input.Add(new KeyValuePair<int, double>(plain[0],0.25));
            input.Add(new KeyValuePair<int, double>(plain[1],0.5));
            input.Add(new KeyValuePair<int, double>(plain[2],1));
            input.Add(new KeyValuePair<int, double>(plain[3],2));
            input = input.OrderBy(cost => cost.Key * (2 / cost.Value)).ToList();
            var suml = 0.0;
            BigInteger sumMoney = 0;
            foreach(var item in input)
            {
                if (N <= suml) break;
                var count = (int)((N - suml) / item.Value);
                suml += count * item.Value;
                sumMoney += (BigInteger)count * (BigInteger)item.Key;
            }
            Console.WriteLine(sumMoney);
        }
    }

Measured memory_bytes: 13780
n=[int(x) for x in list(input()[::-1])]+[0]
ans = 0
step = 0
for i in range(len(n)-1):
  x = n[i]+step
  if x < 5 or (x==5 and n[i+1]<5):
    ans += x
    step = 0
  else:
    ans += 10 - x
    step = 1
print(ans+step)

Measured memory_bytes: 25432
using System;
class Program
{
    static void Main(string[] args)
    {
        string[] data = Console.ReadLine().Split(' ');
        int W = int.Parse(data[0]);
        int H = int.Parse(data[1]);
        int x = int.Parse(data[2]);
        int y = int.Parse(data[3]);
        int r = int.Parse(data[4]);

        if (H >= y+r && W >= x+r && y-r >=0 && x-r >=0)
        {
            Console.WriteLine("Yes");
        }
        else
        {
            Console.WriteLine("No");
        }
    }
}

Measured memory_bytes: 11408
#include<iostream>
#include<math.h>
#include<string.h>
using namespace std;

int seiyaku_check(long i,long Min,long Max){
	if(Min <= i && i <= Max){
		return 1;
	}else{
		exit(1);
		//return 0;
	}
}

int main(){
	
	char s;
	cin >> s;
	
	if(s == 'A')cout << 'T' << endl;
	if(s == 'T')cout << 'A' << endl;
	if(s == 'G')cout << 'C' << endl;
	if(s == 'C')cout << 'G' << endl;
	
	
return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
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 all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define Eunique(v) v.erase(unique(all(v)),v.end())
#define Eback(s) s.erase(s.end()-1,s.end())
#define rev(v) reverse(all(v))
#define minvec(v) *min_element(all(v))
#define maxvec(v) *max_element(all(v))
#define sumvec(v) accumulate(all(v),0LL)
#define mapmin(v) v.rbegin()->first
#define mapmax(v) v.begin()->first
#define pb push_back
#define pf push_front
#define m_p make_pair
#define DOUBLE fixed << setprecision(15)
#define OK cerr<<"OK\n"
#define OK1 cerr<<"OK1\n"
#define OK2 cerr<<"OK2\n"
#define SIZE(s) (int)s.size()
#define INF ((1LL<<62)-(1LL<<31))
#define zero(x,n) setw(x) << setfill('0') << n

typedef long long ll;

typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<long long> vll;
typedef vector<vll> vvll;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<char> vc;
typedef vector<vc> vvc;
typedef vector<bool> vb;
typedef vector<vb> vvb;
typedef vector<string> vs;

typedef pair<ll,ll> pll;
typedef pair<int,int> pii;
typedef vector<pair<int,int>> vpii;
typedef vector<pair<ll,ll>> vpll;

const double pi = acos(-1.0);
const int mod=1000000007;
const int mod2=998244353;

template<class A, class B>
ostream& operator<<(ostream& ost, const pair<A, B>&p) {
	ost << "{" << p.first << ", " << p.second << "} ";
	return ost;
}

template<class T>
ostream& operator<<(ostream& ost, const vector<T>&v) {
	ost << "{";
	for (int i = 0; i<(int)v.size(); i++) {
		if (i)ost << " ";
		ost << v[i];
	}
	ost << "} \n";
	return ost;
}

template<class A, class B>
ostream& operator<<(ostream& ost, const map<A, B>&v) {
	ost << "{";
	for (auto p:v) {
		ost << "{" << p.first << ", " << p.second << "} ";
	}
	ost << "} ";
	return ost;
}

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

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

void YES(bool b) {cout << ((b)?"YES\n":"NO\n");}
void Yes(bool b) {cout << ((b)?"Yes\n":"No\n");}
void yes(bool b) {cout << ((b)?"yes\n":"no\n");}
void Yay(bool b) {cout << ((b)?"Yay!\n":":(\n");}

ll powmod(ll a,ll b){ll c=1; while(b>0){ if(b&1){ c=a*c%mod; } a=a*a%mod; b>>=1; } return c;}
ll gcd(ll x, ll y) {return __gcd(x,y);}
ll lcm(ll x, ll y) {return x/__gcd(x,y)*y;}

int main()
{
	ll h,a;
	cin >> h >> a;
	cout << (h+(a-1))/a << endl;
	return 0;
}


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

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

using namespace std;

/*
ll pw(ll a, ll b) {
	ll ans = 1; while (b) {
		while (!(b & 1)) b >>= 1, a = (a * a) % MOD;
		ans = (ans * a) % MOD, --b;
	} return ans;
}
*/
const ll MOD = 998244353;
const int MX = 4010;
const int INF = 1e5;
bitset<MX> a[8];
bitset<MX> X;
int n;
char buf[10000];

void read(bitset<MX> &b) {
	scanf(" %s", buf);
	int n = strlen(buf);
	for (int i = 0; i < n; ++i) {
		b[n - 1 - i] = (buf[i] == '1' ? 1 : 0);
	}
}

int getl(const bitset<MX> &b) {
	for (int i = MX - 1; i >= 0; --i) {
		if (b[i])
			return i;
	}
	return INF;
}

int main() {
	cin >> n;
	read(X);
	for (int i = 0; i < n; ++i)
		read(a[i]);
	for (int i = 1; i < n; ++i) {
		while (true) {
			int l = getl(a[0]);
			int r = getl(a[i]);
			if (l > r)
				swap(a[0], a[i]), swap(l, r);
			if (r == INF)
				break;
			a[i] ^= (a[0] << (r - l));
		}
	}
	int p = getl(a[0]);
	ll pw = 1;
	ll ans = 0;
	for (int i = p; i < MX; ++i, pw = (pw * 2) % MOD) {
		if (X[i]) {
			ans = (ans + pw) % MOD;
		}
	}
	a[1].reset();
	for (int i = MX - 1; i >= p; --i) {
		if (a[1][i] != X[i])
			a[1] ^= (a[0] << (i - p));
	}
	int fl = 0;
	for (int i = p - 1; i >= 0; --i) {
		if (a[1][i] > X[i]) {
			fl = 1;
			break;
		}
		if (a[1][i] < X[i])
			break;
	}
	if (!fl) {
		ans = (ans + 1) % MOD;
	}
	cout << ans << "\n";
	return 0;
}




Measured memory_bytes: 256
/*"You can do anything you set your mind to,man" - Eminem*/
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
#define llpow(a,b) (ll)(pow(a,b)+0.5)
#define l_b(a,val) min((int)a.size()-1, (int)(lower_bound(a.begin(),a.end(),val)-a.begin()))
#define f first
#define up(a,b) max(a,b)
#define s second
#define INF 9223372036854775807
const  int mod = 1000000007;
template <typename T> T add(T& a, T b){a+=b;while(a>=mod)a-=mod;while(a<0)a+=mod;}
template <typename T> T mul(T& a, T b){ a = a*b%mod;}
template <typename T> T up_self(T& a, T b){a = up(a,b);}
template <typename T> T min_self(T& a, T b){a = min(a,b);}
string find_largest_pref_palindrome(const string& a){string s = a;reverse(s.begin(),s.end());s = a+"%"+s;int c = 0;vector<int> pref(2*((int)a.size()) +2);for(int i = 1; i< s.size() ; i++ ){while(c!=0&&s[i]!=s[c])c = pref[c-1];if(s[i]==s[c])c++;pref[i] = c;}return s.substr(0,c);}
ll binexpomodulo(ll x, ll y){ll res =1;x%=mod;if(!x)return 0;while(y){if(y&1){mul(res, x);}mul(x,x);y>>=1;}return res;}
ll nCrInOr(ll n, ll r){ll res = 1;if(r>n-r)r = n-r;ll rin = 1;for(ll i = 1; i <=r ; i++)rin = (rin*i)%mod;rin = binexpomodulo(rin,mod-2);for(ll i = 1; i <= r; i++)res = (res*(n-i+1))%mod;res = (res*rin)%mod;return res;}
int msb(ll n){int ans;for(int i = 0 ; i < 64;  i++)if(n&(1LL<<i))ans = i+1;return ans;}
/*All the macros below are copied from nik_y(OG)*/
#define test() int t; cin>>t; while(t--)
#define fl(i,a,b) for(int i = a ; i <b ;i++)
#define Shazam ios_base::sync_with_stdio(false);   cin.tie(NULL); cout.tie(NULL);
#define all(c) c.begin(),c.end()
#define endl "\n"
#define get(a,n) fl(i,0,n)  cin>>a[i];
#define pr(a,n) fl(i,0,n) cout<<a[i]<<" ";	cout<<endl;
int main()
{
	Shazam;
	int n; cin>>n;
	map<string,int> f;
	for(int i =0 ; i < n; i++)
	{
		string s; cin>>s;
		f[s]++;
	}
	cout<<f.size()<<endl;
  	return 0;
}

Measured memory_bytes: 19208
#include <bits/stdc++.h>
using namespace std;
#define REP(i,a) for(int i = 0; i < (a); i++)
#define ALL(a) (a).begin(),(a).end()
typedef long long ll;
typedef pair<int, int> P;
const int INF = 1e9;
const int MOD = 1e9 + 7;

signed main(){
    int n;
    cin >> n;
    ll a[n];
    REP(i,n){
        cin >> a[i];
    }
    sort(a, a + n);
    if(n % 3 == 0){
        if(a[0] == a[n / 3 - 1] && a[n / 3] == a[2 * (n / 3) - 1] && a[2 * (n / 3)] == a[n - 1] && (a[0] ^ a[n / 3]) == a[2 * (n / 3)]) cout << "Yes" << endl;
        else cout << "No" << endl; 
    }else{
        if(a[n - 1] == 0) cout << "Yes" << endl;
        else cout << "No" << endl;
    }
}

Measured memory_bytes: 1024
using System;
using System.Collections.Generic;
using System.Linq;
using static System.Console;
using static System.Math;

class MainClass : Scanner
{
    static void Main()
    {
        var (N, M, K) = ReadTuple<int,int,int>();

        int sum = 0;
        for (int i = 0; i <= N; i++)
        {
            for (int j = 0; j <= M; j++)
            {
                sum = i * M + (N - i-i) * j;
                if (sum == K)
                {
                    WriteLine("Yes");
                    return;
                }
            }
        }
        WriteLine("No");
    }
}



class Scanner
{
    public static string RString() => Console.ReadLine();
    public static int RInt() => ReadTuple<int>();
    public static long RLong() => ReadTuple<long>();
    public static double RDouble() => ReadTuple<double>();

    public static string[] RStrings() => Console.ReadLine().Split();
    public static int[] RInts() => Array.ConvertAll(Console.ReadLine().Split(), int.Parse);
    public static long[] RLongs() => Array.ConvertAll(Console.ReadLine().Split(), long.Parse);
    public static double[] RDoubles() => Array.ConvertAll(Console.ReadLine().Split(), double.Parse);
    public static int[] RInts(Func<string, int> func) => Console.ReadLine().Split().Select(func).ToArray();
    public static long[] RLongs(Func<string, long> func) => Console.ReadLine().Split().Select(func).ToArray();
    public static double[] RDoubles(Func<string, double> func) => Console.ReadLine().Split().Select(func).ToArray();
    //public static string[] RStrings(Func<string, string> func) => Console.ReadLine().Split().Select(func).ToArray();

    public static T1 ReadTuple<T1>()
    {
        var r = RString();
        var r1 = (T1)Convert.ChangeType(r, typeof(T1));
        return r1;
    }
    public static (T1, T2) ReadTuple<T1, T2>()
    {
        var r = RStrings();
        var r1 = (T1)Convert.ChangeType(r[0], typeof(T1));
        var r2 = (T2)Convert.ChangeType(r[1], typeof(T2));
        return (r1, r2);
    }
    public static (T1, T2, T3) ReadTuple<T1, T2, T3>()
    {
        var r = RStrings();
        var r1 = (T1)Convert.ChangeType(r[0], typeof(T1));
        var r2 = (T2)Convert.ChangeType(r[1], typeof(T2));
        var r3 = (T3)Convert.ChangeType(r[2], typeof(T3));
        return (r1, r2, r3);
    }
    public static (T1, T2, T3, T4) ReadTuple<T1, T2, T3, T4>()
    {
        var r = RStrings();
        var r1 = (T1)Convert.ChangeType(r[0], typeof(T1));
        var r2 = (T2)Convert.ChangeType(r[1], typeof(T2));
        var r3 = (T3)Convert.ChangeType(r[2], typeof(T3));
        var r4 = (T4)Convert.ChangeType(r[3], typeof(T4));
        return (r1, r2, r3, r4);
    }
}


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

#define fast_io ios_base::sync_with_stdio(false); cin.tie(nullptr)
#define rep(i, x, y) for(decltype(y) i = (x) - ((x) > (y)); i != (y) - ((x) > (y)); i += 1 - 2 * ((x) > (y)))
#define trav(i,a) for(auto& (i) : (a))
#define all(a) (a).begin(),(a).end()
#define sz(a) int((a).size())
#define clr(a,x) memset((a),(x),sizeof(a)) // array (0,-1)
#define dbg(x) cerr << "STDERR => " << __LINE__ << ": " << #x << " = " << (x) << "  :(\n";
#define pb push_back
#define mp make_pair
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
inline void cpuTime() { cerr << "cpu time : " << double(clock())/CLOCKS_PER_SEC << "\n"; return; }
using ll = long long;
using ull = unsigned long long;
using F = float;
using D = double;
using vi = vector<int>;
using pii = pair<int,int>;



void solve(){

    ll a,b,c;
    cin >> a >> b >> c;

    ll x = 4*a*b;
    ll y = c-a-b;
    if(y <= 0){
        cout << "No\n";
        return;
    }
    y *= y;
    if(x < y) cout << "Yes\n";
    else cout << "No\n";

    return;
}

/*
 read the question carefully ( what're the exact constraints? )
 look out for SPECIAL CASES (n=1?) and OVERFLOW (ll vs int?) ARRAY OUT OF BOUNDS
 Check datatypes
*/
int main(){

    fast_io;
    int t=1;
    // cin >> t;

    while(t--){
        solve();
    }

    cpuTime();
return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<queue>
using namespace std;
using Graph = vector<vector<int>>;

int main()
{
    int N, M;   cin >> N >> M;
    Graph G(N+1);
    for(int i = 0; i<M; i++){
        int A, B;   cin >> A >> B;
        G[A].push_back(B);
        G[B].push_back(A);
    }

    vector<int> dist(N+1, -1);
    queue<int> que;

    dist[1] = 0;
    que.push(1);

    while(!que.empty()){
        int v = que.front();
        que.pop();

        for(int i : G.at(v)){
            if(dist[i] != -1){
                continue;
            }else{
                dist[i] = v;
                que.push(i);
            }
        }
    }
    cout << "Yes" << '\n';
    for(int v=2; v<=N; v++)
        cout << dist[v] << endl;
}

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

using namespace std;

using ll = long long;
using vi = vector<int>;
using db = double;
#define pb push_back

const int mxn = 100006;

ll n;
ll a, b;
ll h[mxn];

bool check(ll t) {
	ll s = 0;
	for (int i = 0; i < n; ++i) {
		ll rem = h[i] - t * b;
		if (rem > 0)
			s += (rem + (a - 1)) / a;
	}
	return s <= t;
}

int main() {
	cin >> n >> a >> b;
	a -= b;
	for (int i = 0; i < n; ++i)
		scanf("%lld", &h[i]);
	
	ll L = 0, R = 1000000000, M;
	while (L < R)
		if (M = L + R >> 1, check(M))
			R = M;
		else
			L = M + 1;
	
	cout << L << endl;
	
	return 0;
}


Measured memory_bytes: 1024
import java.io.IOException;
import java.io.InputStream;
import java.util.*;
import java.lang.Math;

public class Main {
    public static void main(String[] args) {
        FS reader = new FS();
        // write reader
        long N = reader.nextLong();
        long ans = Long.MAX_VALUE;
        for (int i=1; i<=(int)Math.sqrt(N); i++) {
            if (N%i == 0) {
                ans = Math.min(ans, i+N/i);
            }
        }
        System.out.println(ans-2);
    }

    public static long[][] warshall(int n, long[][]matrix) {
        long[][] ans = matrix;
        for(int i=0; i<n; i++) {
            ans[i][i] = 0;
        }
        for(int i=0; i<n; i++) {
            for(int j=0; j<n; j++) {
                for(int k=0; k<n; k++) {
                    ans[j][k] = Math.min(ans[j][k], ans[j][i]+ans[i][k]);
                }
            }
        }
        return ans;
    }

    // Read Class
    static class FS {
        private final InputStream in = System.in;
        private final byte[] buffer = new byte[1024];
        private int ptr = 0;
        private int buflen = 0;
        private boolean hasNextByte() {
            if (ptr < buflen) {
                return true;
            } else {
                ptr = 0;
                try {
                    buflen = in.read(buffer);
                } catch (IOException e) {
                    e.printStackTrace();
                }
                if (buflen <= 0) {
                    return false;
                }
            }
            return true;
        }
    
        private int readByte() { return hasNextByte() ? buffer[ptr++] : -1;}
        private boolean isPrintableChar(int c) {return 33 <= c && c <= 126;}
        private void skipUnprintable() {while(hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++;}
    
        public boolean hasNext() { skipUnprintable(); return hasNextByte();}
        public String next() {
            if (!hasNext()) throw new NoSuchElementException();
            StringBuilder sb = new StringBuilder();
            int b = readByte();
            while(isPrintableChar(b)) {
                sb.appendCodePoint(b);
                b = readByte();
            }
            return sb.toString();
        }
        public int nextInt() {
            return (int)nextLong();
        }
        public long nextLong() {
            if (!hasNext()) throw new NoSuchElementException();
            long n = 0;
            boolean minus = false;
            int b = readByte();
            if (b == '-') {
                minus = true;
                b = readByte();
            }
            if (b < '0' || '9' < b) {
                throw new NumberFormatException();
            }
            while(true) {
                if ('0' <= b && b <= '9') {
                    n *= 10;
                    n += b - '0';
                } else if(b == -1 || !isPrintableChar(b)) {
                    return minus ? -n : n;
                } else {
                    throw new NumberFormatException();
                }
                b = readByte();
            }
        }
    }
}



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

using namespace std;
#define ll  long long
#define ld  long double
#define endl '\n'
#define FAST ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
const ll mod = 998244353;
const double PI = 3.141592653589793238463;
const int MAXN = 2e5 + 5;

ll fastPow(ll x, ll b) {
    if (b == 0)
        return 1;
    else if (!(b & 1)) {
        return fastPow(x * x, b / 2);
    } else
        return x * fastPow(x * x, (b - 1) / 2);
}

bool isPal(string h) {
    string rev = h;
    reverse(rev.begin(), rev.end());
    return rev == h;
}

//__builtin_popcount ();
int main() {
    FAST
    string h;
    cin >> h;
    int sz=h.length();
    if(isPal(h) && isPal(h.substr(0,(sz-1)/2)) && isPal(h.substr((sz+3)/2-1,sz)) )
        cout<<"Yes"<<endl;
    else
        cout<<"No"<<endl;
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<cstdio>
using namespace std;
int main(void){
    while(1){
	int n;
	int a;
	int sum=0;
	cin >> n;
	if(n==0)break;

	for(int i=0;i<9;i++){
        cin >> a;
        sum+=a;
        }
    a=n-sum;

    cout<<a<<endl;
    }



	return 0;
}

Measured memory_bytes: 1160
def f(a):
    b = a % 4
    if b == 0:
        return a
    elif b == 1:
        return (a-1) ^ (a)
    elif b == 2:
        return (a-2) ^ (a-1) ^ (a)
    return 0

a,b = map(int,input().split())
c,d = f(a-1), f(b)
print(c^d)


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

int main(){
  int n;
  cin >> n;
  
  int sn = 0;
  int k = n;
  while(k){
    sn += k % 10;
    k /= 10;
  }
  
  if(n % sn) cout << "No" << endl;
  else cout << "Yes" << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <cmath>
#include <algorithm>
#include <iomanip>
#include <queue>
#include <string>
#include <utility>
#include <cassert>

using namespace std;
typedef long long ll;

int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  ll a, b;
  cin >> a >> b;
  ll g = __gcd(a, b);
  int res = 0;
  for (ll x = 2; x * x <= g; x++) {
    if (g % x == 0) {
      res++;
      while (g % x == 0) g /= x;
    }
  }
  if (g > 1) res++;
  cout << res + 1 << endl;
  return 0;
}


Measured memory_bytes: 3616
#include <bits/stdc++.h>
using namespace std;
#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 all(x) (x).begin(), (x).end()
#define sz(x) int(x.size())
#define get_unique(x) x.erase(unique(all(x)), x.end());
typedef long long ll;
typedef complex<double> Complex;
const int INF = 1e9;
const ll MOD = 1e9 + 7;
const ll LINF = 1e18;
template <class T>
bool chmax(T& a, const T& b) {
    if (a < b) {
        a = b;
        return 1;
    }
    return 0;
}
template <class T>
bool chmin(T& a, const T& b) {
    if (b < a) {
        a = b;
        return 1;
    }
    return 0;
}
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...));
}
template <typename T>
ostream& operator<<(ostream& os, vector<T> v) {
    for (int i = 0; i < sz(v); i++) {
        os << v[i];
        if (i < sz(v) - 1) os << " ";
    }
    return os;
}
int main() {
    int h, w, k;
    cin >> h >> w >> k;
    vector<string> v(h);
    rep(i, h) cin >> v[i];

    int ans = 0;
    rep(bit1, 1 << h) {
        rep(bit2, 1 << w) {
            int cnt = 0;
            rep(i, h) rep(j, w) {
                if ((bit1 >> i & 1) && (bit2 >> j & 1) && v[i][j] == '#') cnt++;
            }
            if (cnt == k) ans++;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 3624
#include <iostream>
#include <math.h>
#include <numeric>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <queue>
#include <queue>
#include <stack> 
#include <sstream>
#include <set>

typedef  long long ll;
const int dx[8]={1,0,-1,0,1,-1,-1,1};
const int dy[8]={0,1,0,-1,1,1,-1,-1};
const int dr[4] = {-1, 0, 1, 0};
const int dc[4] = { 0, 1, 0,-1};
const int INF = 1e9;
#define FOR(i, a, n) for(int i = (int)(a); i < (int)(n); ++i)
#define REP(i, n) FOR(i, 0, n)
#define SORT(a) sort(a.begin(),a.end())
#define REVERSE(a) reverse(a.begin(),a.end())
int guki (int a){
    if(a%2==0) return 0;
    else return 1;
}
int gcd(int a, int b){
    if(a%b==0){
        return b;
    }else{
        return (gcd(b,a%b));
    }
}
int lcm(int a, int b){
    int x = gcd(a,b);
    return (a*b/x);
}
using namespace std;
int main(){
    ll n,a,b,c,d,e;
    cin >> n >> a >> b >> c >> d >> e;
    cout << max({(n-1)/a, (n-1)/b, (n-1)/c, (n-1)/d, (n-1)/e} )+ 5 <<endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <cmath>
#include <algorithm>
#include <climits>
#include <set>
#include <map>
#include <queue>
#include <deque>
#include <stack>
#include <string>
#include <list>
#include <ctime>
#include <complex>
#include <bitset>
#include <tuple>
#define PI 3.14159265359
using namespace std;

typedef long long int lli;
typedef long double ldb;
ldb A, B, H, M;
ldb ans, dh, dm;
int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.precision(10);
    cin >> A >> B >> H >> M;
    dh = (ldb)2 * PI / (60 * 12); dm = (ldb)2 * PI / 60;
    ldb ap_x, ap_y;
    ldb bp_x, bp_y;
    ap_x = A * cos(dh * (H * 60 + M));
    ap_y = A * sin(dh * (H * 60 + M));
    bp_x = B * cos(dm * (M));
    bp_y = B * sin(dm * (M));
    ans = sqrt((ap_x - bp_x) * (ap_x - bp_x) + (ap_y - bp_y) * (ap_y - bp_y));
    cout << fixed << ans;
    return 0;
}

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

using namespace std;
using namespace __gnu_cxx;

typedef double db;
typedef long long ll;
typedef pair<db, db> pdd;
typedef pair<ll, ll> pll;
typedef pair<int, int> pii;
typedef unsigned long long ull;

#define F          first
#define S          second
#define pnl        printf("\n")
#define sz(x)      (int)x.size()
#define sf(x)      scanf("%d",&x)
#define pf(x)      printf("%d\n",x)
#define all(x)     x.begin(),x.end()
#define rall(x)    x.rbegin(),x.rend()
#define rep(i, n)  for(int i = 0; i < n; ++i)

const db eps = 1e-9;
const db pi = acos(-1);
const int INF = 0x3f3f3f3f;
const ll LL_INF = 0x3f3f3f3f3f3f3f3f;
const int mod = 1000 * 1000 * 1000 + 7;

int n, k, a[100100];
int dp[100100];

int solve(int i) {
    if (i == n) return 0;
    int &ret = dp[i];
    if (~ret) return ret;
    ret = INF;
    for (int j = 1; j <= k; ++j)
        if (i + j <= n)
            ret = min(ret, solve(i + j) + abs(a[i] - a[i + j]));
    return ret;
}

int main() {
    scanf("%d%d", &n, &k);
    for (int i = 1; i <= n; ++i)
        scanf("%d", &a[i]);
    memset(dp, -1, sizeof dp);
    printf("%d\n", solve(1));
    return 0;
}


Measured memory_bytes: 5760
#include <bits/stdc++.h>
using namespace std;
#define REP(i,a,n) for(int i=(a); i<(int)(n); i++)
#define rep(i,n) REP(i,0,n)
#define FOR(it,c) for(__typeof((c).begin()) it=(c).begin(); it!=(c).end(); ++it)
#define ALLOF(c) (c).begin(), (c).end()
typedef long long ll;
typedef unsigned long long ull;

int main(){
  int N;
  cin >> N;
  vector<int> v;
  rep(i,N){
    int a;
    cin >> a;
    v.push_back(a);
  }

  vector<int> memo(N+10, 0);

  rep(i,N){
    if(memo[v[i]-1] > 0){
      memo[v[i]] = memo[v[i]-1] + 1;
    }else{
      memo[v[i]] = 1;
    }
  }

  int ret = N;
  rep(i,memo.size()){
    ret = min(ret, N-memo[i]);
  }
  
   
  cout << ret << endl;
  return 0;
}




Measured memory_bytes: 1908
n, k = map(int, input().split())

def base_10_to_n(x, i):
  if i == 10:
    return str(x)
  if (int(x / i)):
    return base_10_to_n(int(x / i), i) + str(x % i)
  return str(x % i)

print(len(base_10_to_n(n, k)))



Measured memory_bytes: 2940
# coding: utf-8

def getGCM(a, b):
    if b > a:
        a, b = b, a
    while True:
        r = a % b
        if r == 0:
            return b
        else:
            a = b
            b = r

x, y = map(int,input().rstrip().split())
print(getGCM(x, y))


Measured memory_bytes: 5604
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

int main(void){
    int k,box,n,m;
    cin >> n >> m;
    int s[10][10] = {0};
    int p[10];
    int c[10] = {0};
    int res = 0;
    int flag;
    for(int i=0;i<m;i++){
        cin >> k;
        for(int j=0;j<k;j++){
            cin >> box;
            s[i][box-1] = 1;
        }
    }
    for(int i=0;i<m;i++){
        cin >> p[i];
    }
    for(int bit=0;bit < (1<<n); bit++){
        flag = 1;
        for(int i=0;i<n;i++){
            c[i] = 0;
        }
        vector<int> on_switch;
        for(int j=0;j<n;j++){
            if(bit & (1<<j)){
                on_switch.push_back(j);
            }
        }
        for(int j=0;j<m;j++){
            for(int l=0;l<on_switch.size();l++){
                if(s[j][on_switch[l]]==1)c[j]++;
            }
            if(c[j] % 2 != p[j]){
                flag = 0;
                break;
            }
        }
        if(flag)res++;
    }
    cout << res << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
#define rep(i,N) for(int i = 0; i < (N); i++)
#define erep(i,N) for(int i = N; i >= 0; i--)
const ll INF = 1000000000000000000;
//input
string S;


//processing
int A,B;


//dpTable
//int dp[100050];

int main(){
    cin >> S;
    for (int i = 0; i < S.size(); i++){
        if (S.at(i) == '0'){
            A++;
        }
        else {
            B++;
        }
    }
    cout << 2 * min(A,B) << endl;
    return 0;
}


Measured memory_bytes: 3676