akhauriyash/Code-Regression huggingface dataset:
// Sky's the limit :)
#include <bits/stdc++.h>
using namespace std;
#define int long long

signed main() {
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    
    int t = 1; 
    // cin >> t; 
    while (t--) {
      
      int k;
      string s;
      cin >> k >> s;
      
      if(s.size() <= k)
        cout << s;
      else
        cout << s.substr(0,k) << "...";
    }
    
    cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " sec \n";
    return 0;
}



Measured memory_bytes: 3828
#include<stdio.h>

void trace(int A[], int N) {
    for(int i = 0; i < N; i++) {
        if(i > 0) { printf(" "); }
        printf("%d", A[i]);
    }
    printf("\n");
}

void insertionSort(int A[], int N) {
    int j, i, v;
    for(i = 1; i < N; i++) {
        v = A[i];
        j = i - 1;
        while(j >= 0 && A[j] > v) {
            A[j + 1] = A[j];
            j--;
        }
        A[j + 1] = v;
        trace(A, N);
    }
}

int main() {
    int N, i, j;
    int A[100];

    scanf("%d", &N);
    for(i = 0; i < N; i++) scanf("%d", &A[i]);

    trace(A, N);
    insertionSort(A, N);

    return 0;
}


Measured memory_bytes: 2760
import java.util.*;

public class Main
{
    public static void main(String[] args)
    {
        //Compute c1 = new Compute();//calc

        int count = 0;
        boolean sw = false;
        int max = Integer.MIN_VALUE;
        int min = Integer.MAX_VALUE;
        double dMax = Double.MIN_VALUE;
        double dMin = Double.MAX_VALUE;
        //StringBuilder answer=new StringBuilder();

        //input
        Scanner sc = new Scanner(System.in);
        int n=sc.nextInt();
        int m=sc.nextInt();
        long a[]=new long[n];
        for (int i=0;i<n;++i) a[i]=sc.nextLong();

        PriorityQueue<Long> aa=new PriorityQueue<>(Collections.reverseOrder());
        for (int i=0;i<a.length;++i) aa.add(a[i]);

        for (int i=0;i<m;++i)
        {
            long lm=aa.poll();
            lm/=2;
            aa.add(lm);
        }

        long ans=0;
        for (int i=0;i<n;++i) ans+=aa.poll();

        System.out.println(ans);
    }
}

Measured memory_bytes: 60620
import sys
import math  # noqa
import bisect  # noqa
import queue  # noqa


def input():
    return sys.stdin.readline().rstrip()


def main():
    N = int(input())

    for h in range(1, 3501):
        for n in range(1, 3501):
            numerator = 4 * h * n - N * (h + n)
            denominator = N * h * n
            if (numerator >= 1) and (numerator <= denominator):
                if denominator % numerator == 0:
                    w = denominator // numerator
                    return print(h, n, w)


if __name__ == '__main__':
    main()


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

int main() {
	int n;
	cin >> n;
	int a[10][10] = {{}};
	int d = 1;
	long long ans = 0;
	for (int i = 1; i <= n; i++) {
		if (i == 10 || i == 100 || i == 1000 || i == 10000 || i == 100000) d *= 10;
		int x = i / d, y = i % 10;
		if (x == y) ans++;
		ans += a[y][x]*2;
		a[x][y]++;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 3640
#include <bits/stdc++.h>
#define GET_MACRO(_1,_2,_3,_4,_5,_6,_7,_8,NAME,...) NAME
#define pr(...) cerr<< GET_MACRO(__VA_ARGS__,pr8,pr7,pr6,pr5,pr4,pr3,pr2,pr1)(__VA_ARGS__) <<endl
#define pr1(a) (#a)<<"="<<(a)<<" "
#define pr2(a,b) pr1(a)<<pr1(b)
#define pr3(a,b,c) pr1(a)<<pr2(b,c)
#define pr4(a,b,c,d) pr1(a)<<pr3(b,c,d)
#define pr5(a,b,c,d,e) pr1(a)<<pr4(b,c,d,e)
#define pr6(a,b,c,d,e,f) pr1(a)<<pr5(b,c,d,e,f)
#define pr7(a,b,c,d,e,f,g) pr1(a)<<pr6(b,c,d,e,f,g)
#define pr8(a,b,c,d,e,f,g,h) pr1(a)<<pr7(b,c,d,e,f,g,h)
#define prArr(a) {cerr<<(#a)<<"={";int i=0;for(auto t:(a))cerr<<(i++?", ":"")<<t;cerr<<"}"<<endl;}
using namespace std;
using Int = long long;
using _int = int;
using ll = long long;
using Double = long double;
const Int INF = (1LL<<60)+1e9; // ~ 1.15 * 1e18
const Int mod = (1e9)+7;
const Double EPS = 1e-8;
const Double PI = 6.0 * asin((Double)0.5);
using P = pair<Int,Int>;
template<class T> T Max(T &a,T b){return a=max(a,b);}
template<class T> T Min(T &a,T b){return a=min(a,b);}
template<class T1, class T2> ostream& operator<<(ostream& o,pair<T1,T2> p){return o<<"("<<p.first<<","<<p.second<<")";}
template<class T1, class T2, class T3> ostream& operator<<(ostream& o,tuple<T1,T2,T3> t){
  return o<<"("<<get<0>(t)<<","<<get<1>(t)<<","<<get<2>(t)<<")";}
template<class T1, class T2> istream& operator>>(istream& i,pair<T1,T2> &p){return i>>p.first>>p.second;}
template<class T> ostream& operator<<(ostream& o,vector<T> a){Int i=0;for(T t:a)o<<(i++?" ":"")<<t;return o;}
template<class T> istream& operator>>(istream& i,vector<T> &a){for(T &t:a)i>>t;return i;}
//INSERT ABOVE HERE


signed main(){
  srand((unsigned)time(NULL));
  cin.tie(0);
  ios_base::sync_with_stdio(0);
  cout << fixed << setprecision(12);

  int N;
  cin>>N;
  vector<int> A(N), B(N), C(N-1);
  cin>>A;
  for(int i=0;i<N;i++) A[i]--;
  cin>>B;
  cin>>C;

  int ans = 0;
  int pre = -10;
  for(int a:A){
    ans += B[a];
    if(pre == a - 1) ans += C[pre];
    pre = a;
  }

  cout<<ans<<endl;



  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, start, n) for (ll i = (ll)(start); i < (ll)(n); ++i)
static const ll INFTY = 1L << 62L;
ll solver(ll N, ll X, ll T)
{
    return N % X == 0 ? T * (N / X) : T * (N / X + 1);
}
int main()
{
    ll N, X, T;
    cin >> N >> X >> T;
    cout << solver(N, X, T) << endl;
}

Measured memory_bytes: 3592
#include<algorithm>
#include <bits/stdc++.h>
#include <math.h>
#include <queue>
using namespace std;
int main(void){
	int f,n,i,j,ans=0,a[100000];
	cin>>n;
	for(i=0;i<n;i++){
		cin>>a[i];
	}
	sort(a,a+n);
	i=0;
	while(i<n){
      	f=0;
		int c=a[i];
		while(i<n&&c==a[i]){
			i++;
			f++;
		}
		ans+=f%2;
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 640
# -*- coding: utf-8 -*-

h, w = map(int, input().split())
S = ['.'*(w+2)] + [('.' + input() + '.') for _ in range(h)] + ['.'*(w+2)]
T = []

directions = [[-1, -1], [-1, 0], [-1, 1], [0, -1], [0, 1], [1, -1], [1, 0], [1, 1]]
for i in range(1, h+1):
    string = ''
    for j in range(1, w+1):
        count = 0
        if S[i][j] == '.':
            for k in directions:
                if S[i+k[0]][j+k[1]] == '#':
                    count += 1
            string += str(count)
        else:
            string += '#'
    T.append(string)

for t in T:
    print(t)


Measured memory_bytes: 3064
# -*- coding: utf-8 -*-

def parse_input():

    # 出力
    nm = input().split(" ")
    n = int(nm[0])
    m = int(nm[1])

    rows = []
    for i in range(0, n):
        rows.append([int(e) for e in input().split(" ")])

    return (n, m, rows)

def solve(n, m, rows):

    result = []
    for k in range(1, m + 1):
        tmp = []
        for i in range(0, n):
#            print(rows[i])
            r = rows[i]
#            print(r[1:r[0] + 1])
            if k in r[1:r[0]+1]:
               tmp.append(i+1)
        if len(tmp) == n:
            result.append(k)

    return str(len(result))

def main():

    n, m, rows = parse_input()
    print(solve(n, m, rows))

if __name__ == '__main__':

    main()


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

int main()
{
	long long int x;
	cin >> x;
	bool stop = false;
	for(long long int a = -120; a < 120; ++a){
		for(long long int b = -120; b < 120; ++b){
			if(a * a * a * a * a - b * b * b * b * b == x){
				cout << a << " " << b << endl;
				stop = true;
			}
			if(stop) break;
		}
		if(stop) break;
	}
	return 0;
}

Measured memory_bytes: 3640
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <vector>
#include <queue>
#include <map>
#include <iterator>
#include <cmath>
#include <set>
#include <deque> 
#include <string>


using namespace std;

std::set<int> ans;

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

int main()
{
	int x;
	scanf("%d", &x);
	
	int g = gcd(360, x);
	int lcm = 360 * x / g;
	int count = lcm / x;
	printf("%d\n", count);
	
		
	return 0;
}


Measured memory_bytes: 3208
#include<bits/stdc++.h>
using namespace std;
#define fio ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);

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

const ll MOD = 1e9 + 7;
const ll INF = 1e9 + 9;
const ll N   = 500500;

int main()
{
	fio
	#ifndef ONLINE_JUDGE
	    freopen("input.txt", "r", stdin);
	    freopen("output.txt", "w", stdout);
	#endif
	ll d, t, s;
	cin>>d>>t>>s;
	if(s*t>=d)
		cout<<"Yes";
	else
		cout<<"No";
	return 0;
}

Measured memory_bytes: 3648
#include <bits/stdc++.h>
using namespace std;
int main() {
  
  int A,B,C,D;
  cin >> A >> B >> C >> D;
  
  if (A+B > C+D){
    cout << "Left" << endl;
  }
  if (A+B == C+D){
    cout << "Balanced" << endl;
  }
  if (A+B < C+D){
    cout << "Right" << endl;
  }
}


Measured memory_bytes: 256
#include<cstdio>
#include<iostream>
using namespace std;
struct node
{
	int a;
	int before;
	int next;
}num[200010];
int main()
{
	int n,l=0,r=0;
	bool flag=true;
	scanf("%d",&n);
	scanf("%d",&num[0].a);
	for(int i=1;i<n;i++)
	{
		int tmp;
		scanf("%d",&num[i].a);
		if(flag)
		{
			num[r].next=i;
			num[i].before=r;
			r=i;
		}
		else
		{
			num[l].before=i;
			num[i].next=l;
			l=i;
		}
		flag=!flag;
	}
	if(flag)
		for(int i=l;;i=num[i].next)
		{
			printf("%d ",num[i].a);
			if(i==r)break;
		}
	else
		for(int i=r;;i=num[i].before)
		{
			printf("%d ",num[i].a);
			if(i==l)break;
		}
	return 0;
}


Measured memory_bytes: 4480
#include "bits/stdc++.h"

#define REP(i,num) for(int i=0;i<(num);++i)
#define ALL(c) c.begin(),c.end()
#define PRINTALL(c) for(auto& x:c){cout<<x<<' ';}cout<<endl;
#define PAIRCOMP(c,comp) [](const pair<ll,ll>& lhs,const pair<ll,ll>& rhs){return lhs.c comp rhs.c;}

using namespace std;
using ll = long long;

constexpr ll atcoder_mod = 1e9+7;

template<typename T=int>
T in(){T x; cin >> x; return (x);}
template<typename T=int,typename C=vector<T>>
C vecin(int N){C x(N);REP(i,N){x[i]=in<T>();}return move(x);}

void vout(){cout << endl;}
template<typename Head,typename... Tail>
void vout(Head&& h,Tail&&... t){cout << ' ' << h;vout(forward<Tail>(t)...);}
void out(){cout << endl;}
template<typename Head,typename... Tail>
void out(Head&& h,Tail&&... t){cout << h;vout(forward<Tail>(t)...);}

class Combination{
	vector<ll> fac,finv,inv;
public:
	Combination(ll N){
		fac.resize(N+1);
		finv.resize(N+1);
		inv.resize(N+1);
		fac[0] = fac[1] = 1;
		finv[0] = finv[1] = 1;
		inv[1] = 1;
		for(int i=2;i<=N;i++){
			fac[i] = fac[i-1] * i % atcoder_mod;
			inv[i] = atcoder_mod - inv[atcoder_mod%i] * (atcoder_mod/i) % atcoder_mod;
			finv[i] = finv[i-1] * inv[i] % atcoder_mod;
		}
	}
	ll Caluclation(ll n,ll r){
		if(n < r) return 0;
		if (n < 0 || r < 0) return 0;
		return fac[n] * (finv[r] * finv[n-r] % atcoder_mod) % atcoder_mod;
	}
	ll GetFInv(ll i){
		return finv[i];
	}

};
ll powermod(ll a,ll b,ll m){
	if(b==0){
		return 1LL;
	}
	if(b%2){
		return (a*powermod(a,b-1LL,m))%m;
	}
	return powermod((a*a)%m,b/2LL,m);
}
ll BallBoxCombination9(ll n,ll k){
	ll sum = 0;
	Combination comb(k);
	for(ll i=1;i<=k;i++){
		ll C = comb.Caluclation(k,i)%atcoder_mod;
		ll P = powermod(i,n,atcoder_mod)%atcoder_mod;
		ll V = (C*P)%atcoder_mod;
		if((k-i)%2){
			sum = (sum-V+atcoder_mod)%atcoder_mod;
		}
		else sum = (sum+V)%atcoder_mod;
	}
	return sum*comb.GetFInv(k)%atcoder_mod;
}
ll BallBoxCombination7(ll n,ll k){
	ll sum = 0;
	for(int i=1;i<=k;i++){
		sum += BallBoxCombination9(n,i);
		sum %= atcoder_mod;
	}
	return sum;
}

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

	ll N=in<ll>(),K=in<ll>();
	
	ll ans = BallBoxCombination7(N,K);
	out(ans);
	return 0;
}



Measured memory_bytes: 3204
#include <bits/stdc++.h>
// J - Sushi

using namespace std;

double dp[301][301][301];
int N;

double solve(int s1,int s2,int s3) {
    if (s1 == 0 && s2 == 0 && s3 == 0)
        return 0;
    if (dp[s1][s2][s3] >= 0)
        return dp[s1][s2][s3];

    double temp;

    temp = 1;
    if (s1 > 0)
        temp += (s1 + 0.0) / N * solve(s1 - 1,s2,s3);
    if (s2 > 0)
        temp += (s2 + 0.0) / N * solve(s1 + 1,s2 - 1,s3);
    if (s3 > 0)
        temp += (s3 + 0.0) / N * solve(s1,s2 + 1,s3 - 1);

    dp[s1][s2][s3] = temp * N / (s1 + s2 + s3);

    return dp[s1][s2][s3];
}

int main() {
    int i,j,k,a,c1,c2,c3;

    scanf("%d",&N);

    c1 = 0;
    c2 = 0;
    c3 = 0;
    for (i = 0;i < N;i++) {
        scanf("%d",&a);
        if (a == 1)
            c1++;
        else if (a == 2)
            c2++;
        else
            c3++;
    }

    for (i = 0;i <= N;i++)
        for (j = 0;j <= N;j++)
            for (k = 0;k <= N;k++)
                dp[i][j][k] = -1;

    printf("%.9f\n",solve(c1,c2,c3));

    return 0;
}


Measured memory_bytes: 213376
#include <iostream>
#include <algorithm>

using namespace std;

int n, m, a[100005], b[100005], ans;

int main()
{
	cin >> n >> m;
	for (int i = 1; i <= m; i++)
	{
		cin >> a[i];
	}
	if (n >= m)
	{
		cout << 0 << endl;
		return 0;
	}
	sort(a + 1, a + m + 1);
	for (int i = 1; i < m; i++)
	{
		b[i] = a[i + 1] - a[i];
	}
	sort(b + 1, b + m);
	ans = a[m] - a[1];
	for (int i = m - 1; i > m - n; i--)
	{
		ans -= b[i];
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 1024
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <deque>
#include <list>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>

using namespace std;

//typedef
typedef long long LL;
typedef vector<LL> VL;
typedef vector<VL> VVL;
typedef vector<string> VS;
typedef pair<LL, LL> PLL;

//conversion
inline LL toLong(string s) {LL v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

//math
//-------------------------------------------
template<class T> inline T sqr(T x) {return x*x;}

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) LL((a).size())
#define EACH(i,c) for(auto i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

//repetition
#define FOR(i,a,b) for(LL i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define UNTIL(p) while(!(p))

//constant
const double EPS = 1e-5;
const double PI  = acos(-1.0);

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

#define PUTS(x) cout << (x) << endl;


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

    LL n,k;
    cin>>n>>k;
    VL a(n);
    REP(i,n)cin>>a[i];
    SORT(a);

    LL dp[100005] = {0};
    dp[0] = 2;
    FOR(i,1,k+1){
        bool win = false;
        REP(j,n){
            LL next = i - a[j];
            if(next < 0)break;
            if(dp[next] == 2){
                win = true;
                break;
            }
        }
        dp[i] = win ? 1 : 2;
    }

    PUTS(dp[k] == 1 ? "First" : "Second");
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define ll long long
using namespace std;
ll MOD = 1e9 + 7;
ll H, N, M, L, K, W, X, Y, Z;
ll ans = 0;
int main() {
	string S, T;
	cin >> S >> T;
	vector<vector<int>>dup(26);
	for (int i = 0; i < T.length(); i++) {
		int n = T[i] - 'a';
		dup[n].push_back(i);
	}
	bool flag = 1;
	set<int> set;
	for (int i = 0; i < 26; i++) {
		if (dup[i].size() > 0) {
			int n = S[dup[i][0]] - 'a';
			if (set.count(n)) {
				flag = 0;
				break;
			}
			else set.insert(n);
		}
		if (dup[i].size() > 1) {
			int tmp = dup[i][0];
			for (int j = 1; j < dup[i].size(); j++) {
				if (S[dup[i][j]] != S[tmp]) {
					flag = 0;
					break;
				}
			}
		}
		if (flag == 0)break;
	}
	if (flag)cout << "Yes" << endl;
	else cout << "No" << endl;
}


Measured memory_bytes: 1800
#include<bits/stdc++.h>
using namespace std;
int neko(int N){
  int sum =0;
  while(N !=0){
  sum += N % 10;
  N /= 10;
  }
  return sum;
}

int main(){
  int x;
  cin >> x;
  if(x % neko(x) == 0)cout << "Yes" << endl;
  else cout << "No" << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
#define forn(i,n) for(int i=0;i<(int)(n);i++)
#define si(c) ((int)(c).size())
#define forsn(i,s,n) for(int i = (int)(s); i<((int)n); i++)
#define dforsn(i,s,n) for(int i = (int)(n)-1; i>=((int)s); i--)
#define all(c) (c).begin(), (c).end()
#define D(a) cerr << #a << "=" << a << endl;
#define pb push_back
#define eb emplace_back
#define mp make_pair
 
typedef long long int ll;
typedef vector<int> vi;
typedef pair<int,int> pii;

const int N = 5e5 + 10;
const int MOD = 1e7;

string s;

bool good(int k) {
    int borrow = 0;

    int i;
    for (i = si(s)-1; i >= 0; i--) {
        int d = s[i]-'0';
        int have = ((d-borrow)%10 + 10)%10;
        int nk = k - k%10 + have;
        if (nk > k) nk -= 10;
        if (nk < 0) break;
        k = nk;
        borrow = (borrow+nk)/10;
        //cerr << "borrow = " << borrow << "k = " << k << endl;
    }
    if (i < 0) return true;

    int prefix = 0;
    for (int j = 0; j <= i; j++) {
        prefix = 10*prefix + (s[j]-'0');
        if (prefix > borrow) return false;
    }
    return true;
}
 
int main() {
    ios_base::sync_with_stdio(0); cin.tie(0);

    cin >> s;

    int lo = 0, hi = 500000 * 9 + 10;
    while (lo+1 < hi) {
        int mi = (lo+hi)/2;
        if (good(mi)) hi = mi; else lo = mi;
    }
    cout << (hi+8)/9 << endl;
    return 0;
}


Measured memory_bytes: 1172
#include<cstdio>
#include<algorithm>
using namespace std;
int main(){
	int a[3],cnt=0,i,cha;
	for(i=0;i<3;i++)
		scanf("%d",&a[i]);
	sort(a, a+3);
	cha=(a[2]-a[0])+(a[2]-a[1]);
	if(cha%2==0)
		cnt=cha/2;
	else
		cnt=(cha+3)/2;
	printf("%d\n",cnt);
}

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

using namespace std;

int main() {
  int X;
  cin >> X;
  vector<pair<long long, long long>> C;
  C.push_back({0, 0});
  long long now = 1;
  long long last = 0;
  while (1) {
    long long p = pow(now, 5);
    if (p - last > 1e9 + 10) {
      break;
    }
    C.push_back({now, p});
    now++;
    last = p;
  }
  for (auto i : C) {
    for (auto j : C) {
      auto a = i.second, b = j.second;
      if (a + b == X) {
        cout << i.first << " -" << j.first << endl;
        return 0;
      } else if (a - b == X) {
        cout << i.first << " " << j.first << endl;
        return 0;
      }
    }
  }

  return 0;
}
/* vim:set fdm=marker: */


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

int cal(int a,int b,int c,int d,int e)
{
    int frr[6];
    frr[0]=a;
    frr[1]=b;
    frr[2]=c;
    frr[3]=d;
    frr[4]=e;

    int sum=0;
    for(int i=0;i<5;i++)
    {
        sum+=frr[i];
        if(i==4)break;
        if(sum%10!=0)
        {
            int p=sum%10;
            p=10-p;
            sum+=p;
        }
    }
    return sum;
}


int main()
{
    int arr[5];
    cin>>arr[0]>>arr[1]>>arr[2]>>arr[3]>>arr[4];

    int mn=1e7;

    for(int i=0;i<5;i++)
    {
        for(int j=0;j<5;j++)
        {
            for(int k=0;k<5;k++)
            {
                for(int a=0;a<5;a++)
                {
                    for(int b=0;b<5;b++)
                    {
                        if(i!=j&&i!=k&&i!=a&&i!=b&&j!=k&&j!=a&&j!=b&&k!=a&&k!=b&&a!=b)
                        {
                            mn=min(mn,cal(arr[i],arr[j],arr[k],arr[a],arr[b]));
                        }
                    }
                }
            }
        }
    }
    cout<<mn<<endl;

}


Measured memory_bytes: 256
#include <vector>
#include <iostream>

using namespace std;

bool leap_year(int year)
{
	if (year % 400 == 0) { return true; }

	if (year % 100 == 0) { return false; }

	if (year % 4 == 0) { return true; }

	return false;
}

int main()
{
	vector<int> a;
	vector<int> b;

	while (true)
	{
		int temp[2];

		cin >> temp[0] >> temp[1];

		if (temp[0] == 0 && temp[1] == 0) { goto Exit; }

		a.push_back(temp[0]);
		b.push_back(temp[1]);
	}

Exit:;

	for (vector<int>::size_type i = 0; i < a.size(); i++)
	{
		int counter = 0;

		for (int j = a[i]; j <= b[i]; j++)
		{
			if (leap_year(j) == true) { cout << j << endl; counter++; }
		}

		if (counter == 0) { cout << "NA" << endl; }

		if (i != a.size() - 1) { cout << endl; }
	}

	return 0;
}

Measured memory_bytes: 1216
#include<bits/stdc++.h>
using namespace std;
#define int long long int
#define until(x) while(!(x))
#define unless(x) if(!(x))
#define all(x) (x).begin(),(x).end()
#define F first
#define S second
#define pc __builtin_popcount

int32_t main(){
	int a,b,c;
	cin>>a>>b>>c;
	set<int> s{a,b,c};
	if(s.size()==2){
		cout<<"Yes";
	}
	else {
		cout<<"No";
	}
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define p 1000000007
#define N 2000
using namespace std;
int n,k,dp[2003][2003],sum[2][2003];
int main(){
	dp[0][0]=1;
	for(int i=0;i<=N;i++)sum[0][i]=1;
	int cur=1;
	for(int i=1;i<=N;i++){
		memset(sum[cur],0,sizeof(sum[cur]));
		for(int j=0;j<=N;j++){
			dp[i][j]+=sum[!cur][j];dp[i][j]%=p;
			sum[cur][j]+=dp[i][j];sum[cur][j]%=p;
		}
		for(int j=1;j<=N;j++)sum[cur][j]+=sum[cur][j-1],sum[cur][j]%=p;
		cur=!cur;
	}
	scanf("%d%d",&n,&k);
	for(int i=1;i<=k;i++){
		int ans=0;
		if(n-k>=i-1){
			int a=k-i,b=n-k-i+1;
			ans=(ans+1ll*dp[i][a]*dp[i-1][b])%p;
		}
		if(n-k>=i){
			int a=k-i,b=n-k-i;
			ans=(ans+(1ll*dp[i][a]*dp[i][b]*2)%p)%p;
		}
		if(n-k>=i+1){
			int a=k-i,b=n-k-i-1;
			ans=(ans+1ll*dp[i][a]*dp[i+1][b])%p;
		}
		printf("%d\n",ans);
	}
	return 0;
}

Measured memory_bytes: 15872
program main
  implicit none
  integer i,A(8),X,ans,div
  read(*, *)X
  ans = 1
  div = 1800
  do
    if (X < div) then
      ans = ans + 1
      div = div -200
    else
      exit
    end if
  end do
  !read(*, *) (L(i), i = 1,N)

  write(*, *) ans
end program main


Measured memory_bytes: 2800
#include<bits/stdc++.h>
using namespace std;
int main()
{
	ios::sync_with_stdio(0);cin.tie(0);
	int X,Y;
	cin>>X>>Y;
	for(int x = 0;x<=X;x++)
	{
		int y = X-x;
		if(Y==(x*2 + y*4)){cout<<"Yes\n";return 0;}
	}
	cout<<"No\n";
}


Measured memory_bytes: 3496
/*
ID: learnin7
TASK: test
LANG: C++                 
*/
/* LANG can be C++11 or C++14 for those more recent releases */
#include<bits/stdc++.h>

using namespace std;
typedef long long ll;

int main(){
        
    ios_base::sync_with_stdio(0);
    //ofstream fout ("test.out");
    //ifstream fin ("test.in");
    //fin >> a >> b;
    //fout << a+b << endl;
    int h,w;
    cin>>h>>w;
    vector<string> c(h);
    for(int i=0;i<h;i++){
        cin>>c[i];
    }
    //cout<<"dkjsnke\n";
    vector<string> q;
    for(int i=0;i<h;i++){
            //cout<<i<<" "<<(i)/2<<" "<<c[(i)/2]<<endl;:
                q.push_back(c[i]);
                q.push_back(c[i]);
        }
        //cout<<res<<endl;
        //q[i] = res;
       // cout<<i<<" "<<q[i]<<endl;
    //cout<<"yo\n";
    for(int i=0;i<2*h;i++){
        cout<<q[i]<<endl;
    }
    return 0;
}



Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<bits/stdc++.h>
#include<cmath>
#include<bitset>
#include<queue>
#define ll long long
#define itn int
#define co(ans) cout<<ans<<endl;
#define COYE cout<<"YES"<<endl;
#define COYe cout<<"Yes"<<endl;
#define COye cout<<"yes"<<endl;
#define CONO cout<<"NO"<<endl;
#define CONo cout<<"No"<<endl;
#define COno cout<<"no"<<endl;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define FFOR(i,a,b) for(int i=(a);i<=(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define RREP(i,n)  FFOR(i,1,n)
#define SORT(V) sort((V).begin(),(V).end())
#define REVERSE(V) reverse((V).begin(),(V).end())
#define INF ((1LL<<62)-(1LL<<31))
#define MOD 1000000007
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; }
using namespace std;


int main(){
  int N;
  cin>>N;
  
  for(double i=1; i<50000; ++i){
    if(floor(i*1.08)==N){
      co(i);
      return 0;
    }
  }
  
  cout<<":("<<endl;
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>

const int MAX_N = 100;
double t[MAX_N], v[MAX_N];
double l[MAX_N], r[MAX_N];

double f(int index, double time){
   if(time<l[index]) return v[index] + l[index] - time;
   else if(time>r[index]) return v[index] + time - r[index];
   else return v[index];
}

int main(){
   int N;
   std::cin >> N;
   double tsum = 0;
   for(int i=0; i<N; ++i){
      std::cin >> t[i];
      l[i] = tsum;
      tsum += t[i];
      r[i] = tsum;
   }
   for(int i=0; i<N; ++i)
      std::cin >> v[i];

   double ans = 0;
   for(int i=0; i*0.5+0.5<=tsum; ++i){
      double min = 0.25 * (i*0.5 + i*0.5+0.5);
      for(int j=0; j<N; ++j){
	 double area = 0.25 * (f(j, i*0.5) + f(j, i*0.5+0.5));
	 min = std::min(min, area);
      }
      min = std::min(min, 0.25*(r[N-1]-i*0.5 + r[N-1]-i*0.5-0.5));
      ans += min;
   }

   printf("%.4f\n",ans);
   return 0;
}


Measured memory_bytes: 256
N = int(input())

c = input()

k = -1
for i in range(N):
    if c[i] == 'W' and k == -1:
        k = i 

if k == -1 or k == N-1:
    print(0)
else:
    w = [0] * N
    r = [0] * N

    if c[0] == 'W':
        w[0] = 1
    if c[N-1] == 'R':
        r[N-1] = 1
    for i in range(1,N):
        if c[i] == 'W':
            w[i] = w[i-1] + 1
        else:
            w[i] = w[i-1]

        if c[N-i-1] == 'R':
            r[N-i-1] = r[N-i] + 1
        else:
            r[N-i-1] = r[N-i]
    
    if w[N-1] == N:
        print(0)
    else:
        for i in range(N-1):
            if w[i] == r[i+1]:
                print(w[i])
                break    

Measured memory_bytes: 18820
#include<iostream>
#include<string.h>
using namespace std;
int sum_digits(string a) {
	unsigned int ret = 0;
	for (int i = 0; i < a.size(); i++) {
		ret += a.at(i) - '0';
	}
	//cout << "fx=" << ret << endl;
	return ret;
}
int ati(string a) {
	unsigned int ret = 0;
	for (int i = 0; i < a.size(); i++) {
		ret *= 10;
		ret += a.at(i)-'0';
	}
	//cout << "x=" << ret << endl;
	return ret;
}
int main() {
	string sx;
	unsigned int x;
	unsigned int fx;
	cin >> sx;
	fx = sum_digits(sx);
	x = ati(sx);
	switch(x % fx) {
		case 0:
			cout << "Yes" << endl;
			break;
		default:
			cout << "No" << endl;
			break;
	}

}

Measured memory_bytes: 3568
#include<stdio.h>
#include <cstdio>
#include <iostream>
#include <iomanip>
#include <string>
#include <algorithm>
#include <vector>
#include <math.h>
#include<stack>
#include <queue>
#include<map>
#include <set>
#include<math.h>
using namespace std;
#define int long long
#define ll long long
#define rep(i,n) for(ll i=0;i<n;++i)
#define loop(i,m,n) for(ll i=m;i<n;++i)
#define ggr getchar(); getchar();return 0;
#define pie 3.141592653589793238462643383279
#define elif else if
#define P pair<ll,ll>
const int inf = 1000000007;
int bin(int bina) {
	int ans = 0;
	for (int i = 0; bina > 0; i++)
	{
		ans = ans + (bina % 2) * pow(10, i);
		bina = bina / 2;
	}
	return ans;
}
bool prime(int n) {
	for (ll i = 2; i <= sqrt(n); i++) {
		if (n % i == 0)return false;
	}
	return n != 1;
}
int gcd(int x, int y) {
	if (y == 0)return x;
	return gcd(y, x % y);
}
int lcm(int x, int y) {
	return x * y / gcd(x, y);
}
int kai(int x) {
	if (x == 0)return 1;
	return kai(x - 1) * x % inf;
}
int mod_pow(int x, int y, int mod) {
	int res = 1;
	while (y > 0) {
		if (y & 1) {
			res = res * x % mod;
		}
		x = x * x % mod;
		y >>= 1;
	}
	return res;
}
int comb(int x, int y) {
	return kai(x)* mod_pow(kai(x - y), inf - 2, inf) % inf * mod_pow(kai(y), inf - 2, inf) % inf;
}

signed main() {
	int n;
	cin >> n;
	cout << (n - 2) * 180 << endl;
}


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



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


	int A;
	cin >> A;

	co(A + A * A + A * A * A);


	Would you please return 0;
}

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

using namespace std;

#define endl '\n'

typedef long long ll;

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

int qp(int a,ll b){int ans=1;do{if(b&1)ans=1ll*ans*a;a=1ll*a*a;}while(b>>=1);return ans;}
int qp(int a,ll b,int mo){int ans=1;do{if(b&1)ans=1ll*ans*a%mo;a=1ll*a*a%mo;}while(b>>=1);return ans;}
int gcd(int a,int b){return b?gcd(b,a%b):a;}

#define _rep3(i,p,n) for(int i=(p),i##_counter=(n); i<i##_counter;++i)
#define _rep2(i,n,_) _rep3(i,0,n)
#define _rep_call(a, b, c, name, ...) name(a, b, c)
#define rep(...) _rep_call(__VA_ARGS__, _rep3, _rep2)

#define dump(x)  cerr << #x << " = " << (x) << '\n'
#define debug(x) cerr << #x << " = " << (x) << " (at line " << __LINE__ << ")" << " " << __FILE__ << '\n'

void Main() {
    string input;
    string output;
    cin >> input;
    rep(i, input.size()) {
        if (input[i] == '0' || input[i] == '1') {
            output += input[i];
        } else if (input[i] == 'B' && !output.empty()) {
            output.pop_back();
        }
    }
    cout << output << endl;
}

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

Measured memory_bytes: 256
# Author: S Mahesh Raju
# Username: maheshraju2020
# Date: 27/06/2020

from sys import stdin,stdout
from math import gcd, ceil, sqrt
ii1 = lambda: int(stdin.readline().strip())
is1 = lambda: stdin.readline().strip()
iia = lambda: list(map(int, stdin.readline().strip().split()))
isa = lambda: stdin.readline().strip().split()
mod = 1000000007

a, b = is1(), is1()
res = 0
for i, j in zip(a, b):
    if i != j:
        res += 1
print(res)

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

using namespace std;

int main() {

/** 
    3
    1 2 3
    3 1 2

    1
    1000000000
    1000000000

    4
    1 2 3 4
    4 2 1 3

    6
    0 6 7 6 7 0
    0 6 6 0 7 7

    1
    0 

    2 1 
    6 0

    3 1 2
    7 0 6
    
    4 2 1 3
    6 6 0 7
     
    5 3 1 2 4
    7 7 0 6 6

    6 4 2 1 3 5   
    0 6 6 0 7 7


 */

    int n;
    cin >> n;

    int nums[n];
    for (int i = 0; i < n; i++) cin >> nums[i];

    vector<int> odds, evens;

    for (int i = 0; i < n; i++){
        if (i % 2 == 0){
            odds.push_back(nums[i]);
        } else {
            evens.push_back(nums[i]);
        }
    }

    if (n % 2 == 0){
        while (!evens.empty()){
            int t = evens.back();
            evens.pop_back();
            cout << t << " ";
        }

        while (!odds.empty()){
            int t = odds.front();
            odds.erase(odds.begin());
            cout << t << " ";
        }
    } else {
        vector<int> ts;

        while (!evens.empty()){
            int t = evens.back();
            evens.pop_back();
            ts.push_back(t);
        }

        while (!odds.empty()){
            int t = odds.front();
            odds.erase(odds.begin());
            ts.push_back(t);
        }

        reverse(ts.begin(), ts.end());

        for(int i = 0; i < ts.size(); i++) cout << ts[i] << " ";
    }


    // example 3 doesn't work
    
}

Measured memory_bytes: 4592
// http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=2015
#include<bits/stdc++.h>
using namespace std;
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}
typedef long long ll;
typedef pair<ll,ll> P;
const int INF=INT_MAX / 3;
const ll LINF=LLONG_MAX / 3LL;
#define CONST 1000000007
#define EPS (1e-8)
#define PB push_back
#define MP make_pair
#define sz(a) ((int)(a).size())
#define reps(i,n,m) for(int i=(n);i<int(m);i++)
#define rep(i,n) reps(i,0,n)
#define SORT(a) sort((a).begin(),(a).end())
ll mod(ll a,ll m){return (a%m+m)%m;}
int dx[9]={0,1,0,-1,1,1,-1,-1,0},dy[9]={1,0,-1,0,1,-1,1,-1,0};
ll n,m;
int hs[10000], warr[10000];
int acch[10000], accw[10000];
int main(){
  while(cin >> n >> m) {
    if(n == 0 && m == 0) return 0;
    acch[0] = 0;
    rep(i, n) {
      cin >> hs[i];
      acch[i+1] = acch[i] + hs[i];
    }
    accw[0] = 0;
    rep(i, m) {
      cin >> warr[i];
      accw[i+1] = accw[i] + warr[i];
    }

    map<int, int> hm;
    rep(i, n) {
      reps(j, i+1, n+1) {
        hm[acch[j] - acch[i]] += 1;
      }
    }
    ll ans = 0;
    rep(i, m) {
      reps(j, i+1, m+1) {
        ans += hm[accw[j] - accw[i]];
      }
    }
    cout << ans << endl;
  }

  return 0;
}

Measured memory_bytes: 20964
#include <iostream>
#include <sstream>
#include <cstdlib>
#include <cstdio>
#include <vector>
#include <queue>
#include <deque>
#include <stack>
#include <list>
#include <map>
#include <iomanip>
#include <set>
#include <climits>
#include <ctime>
#include <complex>
#include <cmath>
#include <string>
#include <cctype>
#include <cstring>
#include <algorithm>
using namespace std;
#define endl '\n'
typedef pair<int,int> pii;
typedef long double ld;
typedef long long ll;
typedef unsigned int uint;
typedef unsigned long long ull;

const int maxn=200005;
const int INF=0x3f3f3f3f;
const double pi=acos(-1.0);
const double eps=1e-9;
inline int sgn(double a){return a<-eps? -1:a>eps;}



int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
//    freopen("in.txt","r",stdin);
//    freopen("out.txt","w",stdout);
    int a,b;
    cin>>a>>b;
    if(a%3==0||b%3==0|(a+b)%3==0)
        cout<<"Possible\n";
    else
        cout<<"Impossible\n";
    return 0;
}


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

const int M=100005;
int n,m,x,y,tmp;
long long p[M];
int fa[M];
char c[5];

void init(){
    for(int i=0;i<M;i++) fa[i]=i;
    memset(p,0,sizeof(p));
}

int getfa(int x){
    if(fa[x]==x) return fa[x];
    else {
        int root=getfa(fa[x]);
        p[x]+=p[fa[x]];
        return fa[x]=root;
    }
}

int main(){
    while(scanf("%d %d",&n,&m),n){
        init();
        while(m--){
            scanf("%s %d %d",c,&x,&y);
            if(c[0]=='!'){
                scanf("%d",&tmp);
                int xx=getfa(x);
                int yy=getfa(y);
                if(xx!=yy) {
                    int tmp1=p[x]-p[xx];
                    int tmp2=p[y]-p[yy];
                    fa[xx]=yy;
                    p[xx]+=tmp2-tmp-tmp1;
                }
            }
            else {
                int xx=getfa(x);
                int yy=getfa(y);
                if(xx==yy) printf("%lld\n",p[y]-p[x]);
                else puts("UNKNOWN");
            }
            //for(int i=1;i<=4;i++) cout<<p[i]<<' ';cout<<endl;
        }
    }
    return 0;
}

/*
4 7
! 1 2 100
! 2 3 100
! 4 3 150
? 4 1
*/

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

int main(void){
	int a[4];

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

	sort(a, a+3);

	for(int i=0; i<2; i++){
		printf("%d ", a[i]);
	}
	printf("%d\n", a[2]);

	return 0;
}

Measured memory_bytes: 1164
#include <bits/stdc++.h>
using namespace std;
int n,cnt[4];
double f[305][305][305]; 
double DFS(int a,int b,int c){
	if(a==0&&b==0&&c==0){
		return 0;
	}
	if(f[a][b][c]>0){
		return f[a][b][c];
	}
	double res=1.0*n/(a+b+c);
	if(a){
		res+=(1.0*a/(a+b+c))*DFS(a-1,b,c);
	}
	if(b){
		res+=(1.0*b/(a+b+c))*DFS(a+1,b-1,c);
	}
	if(c){
		res+=(1.0*c/(a+b+c))*DFS(a,b+1,c-1);
	}
	return f[a][b][c]=res;
}
int main(){
	cin>>n;
	for(int i=0;i<n;++i){
		int x;
		cin>>x;
		cnt[x]++;
	}
	cout<<fixed<<setprecision(10)<<DFS(cnt[1],cnt[2],cnt[3])<<'\n';
	return 0;
} 

Measured memory_bytes: 219392
#include<bits/stdc++.h>
using namespace std;
int main(){
  int v,e,s,t,a[10001]={};
  vector<int> vec[10001];
  cin >> v >> e;
  for(int i=0;i<e;i++){
    cin >> s >> t;
    vec[s].push_back(t);
    a[t]++;
  }
  stack<int> st;
  for(int i=0;i<v;i++){
    if(a[i] == 0) st.push(i);
  }
  while(!st.empty()){
    cout << st.top() << endl;
    int p = st.top();
    st.pop();
    for(int i=0;i<vec[p].size();i++){
      a[ vec[p][i] ]--;
      if(a[ vec[p][i] ] == 0) st.push( vec[p][i] );
    }
  }
  return (0);
}

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

int main(){
  int n; cin>>n;
  int arr[n+1];
  int cnt=0;
  for(int i=1;i<=n;i++){
    cin>>arr[i];
    if(i%2 && arr[i]%2)
      cnt++;
  }
  cout<<cnt;
  return 0;
}

Measured memory_bytes: 3636
#include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <numeric>
#include <functional>
#include <cmath>
#include <string>
#include <map>
#include <queue>
#include <stack>
#define FOR(arg, ini, end) for(int arg = ini; arg < end; arg++)


using namespace std;
int main(int argc, const char * argv[]) {
    
    int n;
    cin >> n;
    vector<int> p(n);
    FOR(i, 0, n){
        cin >> p[i];
    }

    int c=0;
    FOR(i, 0, n-2){
        if ( p[i]<p[i+1] && p[i+2] > p[i+1] ) c++;
        else if ( p[i]>p[i+1] && p[i+2] < p[i+1] ) c++;
    }

    cout << c << endl;
    return 0;
}

Measured memory_bytes: 256
#!/usr/bin/env python3
import sys, math, itertools, heapq, collections, bisect
input = lambda: sys.stdin.buffer.readline().rstrip().decode('utf-8')
sys.setrecursionlimit(10**8)
inf = float('inf')
ans = count = 0

n=int(input())
s=input()
for i in range(1,n):
    A=set(s[:i])
    B=set(s[i:])
    for ai in A:
        if ai in B:
            count+=1
    ans=max(ans,count)
    count=0
print(ans)

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

int main() {
  int n,k;
  cin >> n >> k;
  int cnt = 0;
  rep(i,n) {
    int x;
    cin >> x;
    if (k <= x) cnt++;
  }
  cout << cnt << endl;
}


Measured memory_bytes: 3568
#pragma GCC target("avx2")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#include <bits/stdc++.h>
#define rep(i,n)for(long long i=0;i<(n);i++)
using namespace std;
typedef unsigned long long ull;
typedef long long ll;
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; }
const ll INF=1e18;
const ll MOD=1e9+7;
const double pi=acos(-1);
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};


int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);  
  
  ll x,y;
  cin >> x >> y;
  ll ans=1;
  while(x<=y){
    ans++;
    x*=2;
    if(x>y)ans--;
  }
  cout << ans << endl;
  
}


Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include "bits/stdc++.h"
#define rep(i,a,b) for (int i = (a); i < (b); i++)
using namespace std;
typedef long long int ll;
typedef pair<ll, ll> P;
typedef complex<double> com;
const int mod = 1e9 + 7;
const int MOD = 998244353;
const int inf = 2e9;

bool used[401][401];
int blk, wht, h, w;
vector<string> grid;
int dx[4] = { 1,-1,0,0 }, dy[4] = { 0,0,1,-1 };
void dfs(int x, int y) {
	used[x][y] = true;
	if (grid[x][y] == '#') blk++; else wht++;
	rep(i, 0, 4) {
		int tx = x + dx[i], ty = y + dy[i];
		if (tx < 0 || tx >= h || ty < 0 || ty >= w || used[tx][ty] || grid[x][y] == grid[tx][ty]) continue;
		dfs(tx, ty);
	}
}

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	cin >> h >> w;
	grid.resize(h);
	rep(i, 0, h) cin >> grid[i];
	ll ans = 0;
	rep(i, 0, h)rep(j, 0, w) {
		if (grid[i][j] == '.'||used[i][j]) continue;
		blk = 0, wht = 0; dfs(i, j);
		ans += 1LL * blk * wht;
	}
	printf("%lld", ans);
	return 0;
}


Measured memory_bytes: 15616
from itertools import combinations
from math import sqrt

N, D = map(int, input().split())

XVS = []

for _ in range(N):
    XV = tuple(map(int, input().split()))
    XVS.append(XV)

C = 0
for i, j in combinations(range(N), 2):
    D2 = 0
    for d in range(D):
        D2 += (XVS[i][d] - XVS[j][d]) ** 2
    D1 = sqrt(D2)
    if D1.is_integer():
        C += 1

print(C)


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

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

int main(){
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	cout<<setprecision(32);

	int n, k;
	cin>>n>>k;
	if(k&1){
		cout<<(n/k)*1LL*(n/k)*(n/k)<<endl;
	}else{
		ll ans = (n/k)*1LL*(n/k)*(n/k);
		ll tmp = n/(k/2) - n/k;
		ans += tmp*tmp*tmp;
		cout<<ans<<endl;
	}

	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>

int main()
{
	for( int i = 0; i != 9; ++i )
	{
		std::string s;
		int a, b;
		std::cin >> s >> a >> b;
		std::cout << s << ' ' << a + b << ' ' << a * 200 + b * 300 << std::endl;
	}

	return 0;
}

Measured memory_bytes: 1204
import java.util.*;
 
class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String a = sc.next();
		char[] b = a.toCharArray();
		char []alphabet = new char[26];
	    char c = 'a';
	    for (int i = 0; i < 26; i++){
	        alphabet[i] = c++;
	    }
	    
	    for (int i = 0; i < 26; i++){
	        if(b[0] == alphabet[i]) {
	        	System.out.println(alphabet[i+1]);
	        }
	    }


 
		sc.close();
	}
}

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

int main(){
    // 制約見て！！！デカかったらlong longにすること！
    int h,w;
    cin>>h>>w;
    vector<string> a(h);
    rep(i,h){
        cin >>a[i];
    }
    rep(i,w+2) putchar('#');
    putchar('\n');
    rep(i,h){
        putchar('#');
        rep(j,w) cout << a[i][j];
        putchar('#');
        putchar('\n');
    }
    rep(i,w+2) putchar('#');
    putchar('\n');

}

Measured memory_bytes: 3580
a,b,c,x,y=map(int,input().split())
sum=0
tmp=min(x,y)
if a+b>=2*c:
  sum+=2*c*tmp
  x-=tmp
  y-=tmp
  if x==0:
    if b>=2*c:
      sum+=2*c*y
    else:
      sum+=b*y
  elif y==0:
    if a>=2*c:
      sum+=2*c*x
    else:
      sum+=a*x
else:
  sum+=a*x+b*y
print(sum)

Measured memory_bytes: 3064
#include<iostream>
#include<string>
#include<cstring>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<functional>
#include<assert.h>
#include<numeric>
using namespace std;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
using ll = long long;
const int inf=1e9+7;
const ll longinf=1LL<<60 ;
const ll mod=1e9+7 ;
#define PI 3.141592653589793


int main(){
    int n, m; cin >> n >> m;
    rep(i, m){
        int a; cin >> a; n-=a;
    }
    if(n<0) cout << -1 << endl;
    else cout << n << endl;
}

Measured memory_bytes: 3636
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using ll = long long;
using vi = vector<int>;
using vl = vector<ll>;
using vvi = vector<vi>;
using vvl = vector<vl>;

int main(){
  int s;
  cin >> s;
  ll MOD = 1000000007;
  vl dp(s+1);
  dp[0] = 1;
  ll sum = 0;
  for(int i=1; i<=s; i++){
    if(i>=3) {
      sum += dp[i-3];
      sum %= MOD;
    }
    dp[i] = sum;
  }
  cout << dp[s] << endl;
}


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

using namespace std;

#define int long long

signed main(){
	int n; cin>>n;
	vector<int> a(n);
	int sum = 0;
	for(int i = 0; i < n; i++){
		cin>>a[i];
		sum += a[i];
	}
	int per = (n*(n+1))/2;
	if(sum%per != 0){
		cout<<"NO"<<endl;
		return 0;
	}
	
	vector<int> b(n);
	for(int i = 0; i < n-1; i++){
		b[i] = a[i+1] - a[i];
	}
	b[n-1] = a[0] - a[n-1];
	int k = sum/per;
	int bsum = 0;
	bool done = false;
	for(int i = 0; i < n; i++){
		if((k - b[i])%n != 0 || (k - b[i]) < 0){
			done = true;
			break;
		}
	}
	if(done){
		cout<<"NO"<<endl;
		return 0;
	}else{
		cout<<"YES"<<endl;
	}
	
	
}


Measured memory_bytes: 1792
while (True):
    m, f, r = map(int, input().split())
    if m == -1 and f == -1 and r == -1:
        break
    if m == -1 or f == -1:
        print("F")
    elif 80 <= m + f:
        print("A")
    elif 65 <= m + f:
        print("B")
    elif 50 <= m + f:
        print("C")
    elif 30 <= m + f:
        if 50 <= r:
            print("C")
        else:
            print("D")
    else:
        print("F")



Measured memory_bytes: 5596
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<map>
const int mod = 1e9+7;
using namespace std;
int main()
{
    int a,b,w;
    cin >> w >> a>> b;
    if(a>b)swap(a,b);
    if(a+w < b) cout << (b-a-w)  << endl;
    else cout << 0 << endl;
    return 0;
}



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

int n, a[200010], b[200010];
int norm(int x){
    x = ((x % n) + n) % n;
    return x? x: n;
}
int& A(int i){ return a[norm(i)]; }
int& B(int i){ return b[norm(i)]; }
bool f(int i){ return B(i) >= B(i - 1) + B(i + 1) + A(i); }

int main(){
    scanf("%d", &n);
    for(int i = 1; i <= n; i++) scanf("%d", &a[i]);
    for(int i = 1; i <= n; i++) scanf("%d", &b[i]);

    priority_queue<pii> q;
    long long ans = 0;
    for(int i = 1; i <= n; i++) if(f(i)) q.push({B(i), i});
    while(!q.empty()){
        int i = q.top().second; q.pop();
        int k = (B(i) - A(i)) / (B(i - 1) + B(i + 1));
        if(!k){ puts("-1"); return 0; }
        ans += k;
        B(i) -= k * (B(i - 1) + B(i + 1));
        if(f(i - 1)) q.push({B(i - 1), i - 1});
        if(f(i + 1)) q.push({B(i + 1), i + 1});
    }
    for(int i = 1; i <= n; i++) if(A(i) != B(i)){ puts("-1"); return 0; }
    printf("%lld", ans);
    return 0;
}

Measured memory_bytes: 2936
#include <iostream>
#include <vector>
#include <string>
#include <utility>
#include <queue>
#include <algorithm>
#include <map>
#include <cmath>
using namespace std;

#define ll long long
#define pb push_back

int main(){

	double t, x;
	cin >> t >> x;
	cout << t / x << endl;

	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
	int a,b,c,d;
	cin>>a>>b>>c>>d;
	while(1){
		c -= b;
		if(c<=0){
//			cout<<a<<" "<<c<<endl;
			cout<<"Yes"<<endl;
			break;
		}
		a -= d;
		if(a<=0){
//			cout<<a<<" "<<c<<endl;
			cout<<"No"<<endl;
			break;
		}
		
	}
	return 0;
}

Measured memory_bytes: 3628