akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
#define arep(i,x,n) for(long long i=int(x);i<(int)(n);i++)
#define rep(i,n) for(long long i = 0;i < n;++i)
#define rrep(i,n) for(long long i=int(n);i>0;i--)
#define fs first
#define sc second
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define pi 3.141592653589793
#define eps 0.00000001
#define INF 1e9+5  
using ll = long long; 
using P=pair<int,int>;
using lP=pair<ll,ll>;
using fP=pair<double,double>;
using PPI=pair<P,int>;
//ll const mod=998244353;
ll const mod=1e9+7;
const ll MAX=1000005;
using vi=vector<int>;
using vl=vector<ll>;
using vc=vector<char>;
using vd=vector<double>;
using vs=vector<string>;
using vp=vector<P>;
using vb=vector<bool>;
using vvi =vector<vector<int>>;
using vvl =vector<vector<ll>>;
using vvd=vector<vector<double>>;
using vvc=vector<vector<char>>;
using vvp =vector<vector<P>>;
using vvb=vector<vector<bool>>;
template <typename T>
bool chmax(T &a, const T b){if(a < b){a = b; return true;} return false;}
template <typename T>
bool chmin(T &a, const T b){if(a > b){a = b; return true;} return false;}


int main(){
    int n,m;
    cin>>n>>m;
    
    vi ac(n),wa(n);
    rep(i,m){
        int p;
        string s;
        cin>>p>>s;
        --p;
        if(s=="AC")ac[p]=1;
        else if(ac[p]==0){
            wa[p]++;
        }
    }
    ll a=0,w=0;
    rep(i,n){
        a+=ac[i];
        if(ac[i]==1)w+=wa[i];
    }
    cout<<a<<" "<<w<<endl;
    
    return 0;
}

Measured memory_bytes: 4032
/*
 * written by Yaqi Zhang (zhang623@wisc.edu)
 * University of Wisconsin-Madison
 * 2019
 */
#include <bits/stdc++.h>

#define INF 0x3f3f3f3f

using namespace std;


int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    int k;
    string s;
    cin >> k >> s;
    int n = s.length();
    if(n <= k) cout << s;
    else cout << s.substr(0, k) + "...";
    cout << endl;
    return 0;
    
}



Measured memory_bytes: 3592
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii =  pair<int, int>;
using pll =  pair<long long, long long>;
constexpr char ln =  '\n';
constexpr long long MOD = 1000000007LL;
constexpr long long INF = 1000000009LL;
#define all(x) (x).begin(),(x).end()
#define rep(i,n) for(int i=0;i<(n);i++)
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }


int main(){
    ll a, b, x; cin >> a >> b >> x;
    
    ll n = b/x;if(a==0) n++;
    ll m = max(a-1, 0LL)/x;

    cout << n-m << ln;
}


Measured memory_bytes: 256
import sys
from collections import defaultdict

def main():
    n = int(sys.stdin.readline())

    line = sys.stdin.readline()
    lst = line.split()

    cnt_dic = defaultdict(int)

    #400で割ったときの商が0,1,2,3,4,5,6,7
    #8以上は、自由に色を決められる

    for ch in lst:
        rating = int(ch)
        n = rating // 400
        if n <= 7:
            cnt_dic[n] += 1
        else:
            cnt_dic[8] += 1

    ans_max = 0
    ans_min = 0
    for i in range(0,8):
        if cnt_dic[i] > 0:
            ans_max += 1
            ans_min += 1

    if cnt_dic[8] > 0:
        ans_max += cnt_dic[8]
        if ans_min == 0:
            ans_min += 1

    print("%d %d" % (ans_min, ans_max))
    return 0

if __name__ == '__main__':
    sys.exit(main())


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

int n,k;
long long ans = 1;

int main(){
    cin >> n >> k;
    for(int i = 0; i < n; i++){
        if(ans * 2 > ans + k){
            ans = ans + k;
        }else{
            ans = ans * 2;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define FOR(i,l,r) for(long long i=(l);i<(r);++i)
#define REP(i,n) FOR(i,0,n)
#define REPS(i,n) FOR(i,1,n+1)
#define RFOR(i,l,r) for(long long i=(l);i>=(r);--i)
#define RREP(i,n) RFOR(i,N-1,0)
#define RREPS(i,n) RFOR(i,N,1)
#define int long long
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define SZ(x) ((int)(x).size())
#define all(x) (x).begin(),(x).end()
template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
const int INF=1e18;
const int MOD=1e9+7;

signed main(){
    int N;cin>>N;
    int b;cin>>b;
    int ren=1;
    int ans=0;
    REP(i,N-1){
        int a;cin>>a;
        if(b==a)ren++;
        else{
            ans+=ren/2;
            ren=1;
        }
      	b=a;
    }
  	ans+=ren/2;
    cout<<ans<<endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<iomanip>
#include<sstream>
#include<cstdlib>
#include<cmath>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<string>
#include<numeric>
#include<set>
using namespace std;

int main(){
  string s, t;
  cin >> s >> t;

  int cnt = 0;

  for(int i = 0; i <= 2; i++){
    if(s[i] == t[i])
      cnt++;
  }

  cout << cnt << 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;
    if( a*b>c*d)
        cout<<a*b;
    else if(a*b<c*d)
        cout<<c*d;
    else
        cout<<a*b;

    return 0;
}


Measured memory_bytes: 3644
package main

import "fmt"

func main() {
	var S string
	fmt.Scan(&S)
	sum := 0
	var b0 bool
	if S[0] == byte('0') {
		b0 = true
	}
	for i := 0; i < len(S); i++ {
		if b0 {
			if i%2 == 0 {
				if S[i] != byte('0') {
					sum++
				}
			} else {
				if S[i] != byte('1') {
					sum++
				}
			}
		} else {
			if i%2 == 0 {
				if S[i] != byte('1') {
					sum++
				}
			} else {
				if S[i] != byte('0') {
					sum++
				}
			}
		}
	}
	fmt.Println(sum)
}


Measured memory_bytes: 1280
package main

import "fmt"

func main() {
	a := make([]int, 6)
	for i := 0; i < 6; i++ {
		var po int
		fmt.Scan(&po)
		a[po-1]++
		if a[po-1] >= 3 {
			fmt.Println("NO")
			return
		}
	}
	fmt.Println("YES")
}


Measured memory_bytes: 512
#include <string>
#include <iostream>
#include <vector>
#include <stdio.h>
#include <math.h>

double myabs(double a) {
	return sqrt(a*a);
}


int main()
{
	int a, b, k;
	std::cin >> a >> b >> k;
	std::vector<int> t;
	for (int i = 1; i <= a; i++) {
		if (0 == a % i) {
			if (0 == b % i) {
				t.push_back(i);
			}
		}
	}
	std::cout << *(t.end()-k);
	return 0;
}


Measured memory_bytes: 256
import java.util.*

class Scanner(`in`: java.io.InputStream) {
    private val reader = java.io.BufferedReader(java.io.InputStreamReader(`in`))
    private var tokenizer: StringTokenizer? = null

    fun next(): String {
        if (tokenizer?.hasMoreTokens() != true) {
            tokenizer = StringTokenizer(reader.readLine())
        }
        return tokenizer!!.nextToken()
    }

    fun nextLine(): String {
        return if (tokenizer?.hasMoreTokens() != true) {
            reader.readLine()
        } else tokenizer!!.nextToken("\n")
    }
}

fun main(args: Array<String>) {
    val pw = java.io.PrintWriter(System.out)
    Problem.solve(Scanner(System.`in`), pw)
    pw.flush()
}

////////////////////////////////////////////////////////////////////////

object Problem {
    fun solve(sc: Scanner, pw: java.io.PrintWriter) {
        val N = sc.next().toInt()
        val H = sc.next().toInt()
        val ab = Array(N) { Pair(sc.next().toInt(), sc.next().toInt()) }
        val aMax = ab.map { it.first }.max()!!
        val b = ab.map { it.second }.filter { it > aMax }.sorted().reversed().toTypedArray()
        var h = H
        var ans = 0
        var i = 0
        while (h > 0 && i < b.count()) {
            ans++
            h -= b[i]
            i++
        }
        if (h > 0) {
            ans += (h + aMax - 1) / aMax
        }
        pw.println(ans)
    }
}


Measured memory_bytes: 57896
require 'prime'
class Integer
    def my_divisor_list
      divisors = [1]
      primes = []
      Prime.prime_division(self).each do |prime|
        prime[1].times {primes << prime[0]}
      end
      return primes.uniq
    rescue ZeroDivisionError
      return
    end
  end

A,B=gets.chomp.split(" ").map(&:to_i)

gcd_val = A.gcd(B)
puts gcd_val.my_divisor_list.length + 1


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

int main()
{
    int N;
    cin >> N;
    vector<pair<pair<string,int>, int>> p(N);
    for (int i = 0; i < N; i++)
    {
        string S;
        int P;
        cin >> S >> P;
        p.at(i) = make_pair(make_pair(S, -P) , i+1);
    }

    sort(p.begin(), p.end());

    for (int i = 0; i < N; i++)
    {
        cout << p.at(i).second << endl;
    }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define F first
#define S second
#define endl "\n"
#define nl cout<<endl
#define pb push_back
#define f(i,a,b) for(ll i=a;i<b;i++)
#define Knucklehead ios_base::sync_with_stdio(false);cin.tie(NULL);
#define txti freopen("input.txt", "r", stdin);
#define txto freopen("output.txt", "w", stdout);
//#define mod 100000007

#define mat vector<vector<ll>>
mat cn(ll n, ll m){return vector< vector<ll> >(n, vector<ll>(m));}
bool compare(char &s1,char &s2){return s1 > s2;} 

bool sortmahstyle(const pair<ll,ll> &a,  const pair<ll,ll> &b) 
{ 
    if(a.second > b.second )
        return true;
    if( a.second==b.second && a.first > b.second )
       return true;
 
    return false;
 }
//me
ll const mod = 1e9+7;//998244353;
ll const inf = 3e6+1;

void solve()
{

    ll n; cin >> n;
    ll a[n]; f(i,0,n) cin >> a[i];

    ll ans = 0;
    f(i,1,n){
        if(a[i]<a[i-1]){
            ans+= a[i-1]-a[i];
            a[i]=a[i-1];
        }
    }
    cout << ans << endl;
}
int main() {
Knucklehead 
//*
#ifndef ONLINE_JUDGE
freopen("input.txt", "r", stdin);
freopen("output.txt", "w", stdout);
#endif
/**/ 
        
        ll t;
        /**/t=1;
        /*/cin>>t;/**/
        f(testcases,0,t){
            solve();
        }
 
 
    return 0;
}

Measured memory_bytes: 5228
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> l_l;
typedef pair<int, int> i_i;
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;
}

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
//const ll mod = 1000000007;

int main() {
    //cout.precision(10);
    cin.tie(0);
    ios::sync_with_stdio(false);
    string S;
    cin >> S;
    int lose = 0;
    for(int i = 0 ;i < S.size(); i++) {
        if(S[i] == 'x') lose++;
    }
    if(lose >= 8) cout << "NO" << endl;
    else cout << "YES" << endl;
    return 0;
}


Measured memory_bytes: 256
using System;


namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            String[] sArray = Console.ReadLine().Split(' ');

            int[] intArray=new int[sArray.Length];
            for (int i = 0; i < sArray.Length; ++i)
            {
                intArray[i] = int.Parse(sArray[i]);
            }
            for(int i = 0; i < intArray.Length; ++i)
            {
                int index = i;

                for(int j = i+1; j<intArray.Length; ++j)
                {
                    if(intArray[index] > intArray[j])
                    {
                        index = j;
                    }
                }
                int temp = intArray[index];
                intArray[index] = intArray[i];
                intArray[i] = temp;
            }
            for(int i = 0; i < intArray.Length; ++i)
            {
                if(i==0)
                {
                    Console.Write(intArray[i]);
                }
                else
                {
                    Console.Write(" {0}", intArray[i]);
                }
           
            }
            Console.WriteLine();
           

        }
    }
}

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

string query(int x) {
	cout << x << '\n';
	cout.flush();
	string res; cin >> res;
	if (res == "Vacant") exit(0);
	return res;
}

int main() {
	ios_base::sync_with_stdio(false);
	int n; cin >> n;
	int l = 0, r = n - 1;
	string x = query(0), y = query(n - 1);
	while (1) {
		int mid = l + r >> 1;
		string z = query(mid);
		if ((x == z) != (l % 2 == mid % 2)) {
			r = mid;
			y = z;
		}
		else {
			l = mid;
			x = z;
		}
	}
}

Measured memory_bytes: 852
#include <stdio.h>
#include <stdlib.h>
#include <assert.h>
#include <fstream>
#include <iostream>
#include <algorithm>
#include <bitset>
#include <array>
#include <vector>
#include <queue>
#include <set>
#include <cmath> // 変数名にy1が使えなくなるかも…。
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <string>

typedef __int128_t int128_t;
std::istream &operator>>(std::istream& input, int128_t& value) { // int128_tの入力。入力が64bitに収まる前提。
    long long tmp; input >> tmp; value = tmp;
    return input;
}
std::ostream &operator<<(std::ostream& output, const int128_t value) { // int128_tの出力。出力が64bitに収まる前提。
    output << (long long)value;
    return output;
}

int128_t W, H, x, y;

double calc(int s, int t) {
    double sec = (double)t/s;
    double hn = H/sec;
    return hn * H / 2;

}

int main(int argc, char **argv) {
    std::cin >> W >> H >> x >> y;
    
    double size = W * H;
    double ret1 = size / 2;

    int ret2 = 0;
    if (W % 2 == 0 && x == W / 2 && H % 2 == 0 && y == H / 2) {
        ret2 = 1;
    }

    std::cout << ret1 << " " << ret2 << std::endl;

    return 0;
}

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

int main() {
	int N, K;
	std::cin >> N >> K;
	std::vector<int> p(N);
	for (int i = 0; i < N; i++) {
		std::cin >> p.at(i);
	}

	int kari = 1001;
	int bango = 0;
	int ans = 0;
	for (int i = 0; i < K; i++) {
		kari = 1001;
		bango = 0;
		for (int j = 0; j < N; j++) {
			if (p.at(j) < kari && p.at(j) != 0) {
				kari = p.at(j);
				bango = j;
			}
		}
		ans += kari;
		p.at(bango) = 0;
	}
	std::cout << ans << std::endl;
}

Measured memory_bytes: 3620
N, K = list(map(int, input().split()))
R, S, P = list(map(int, input().split()))
T = list(str(input()))
Te=[]
for t in T:
    if t=='r':
        Te.append(P)
    elif t=='s':
        Te.append(R)
    else:
        Te.append(S)
te=['r','s','p']
ans=0
for i in range(N):
    if K>i:
        ans+=Te[i]
    else:
        if T[i-K]==T[i]:
            #未来がない時はなんでも良い
            if i+K>=N:
                T[i]='null'
            else:
            #現在でも未来でもない手を代入
                te.remove(T[i])
                try:
                    te.remove(T[i+K])
                except:
                    pass
                T[i]=te[0]
                te=['r','s','p']
        else:
            ans+=Te[i]
print(ans)



Measured memory_bytes: 4792
#include<bits/stdc++.h>
using namespace std;
int main()
{
     ios_base ::sync_with_stdio(0);cin.tie(0);cout.tie(0);
   long long  int a,b,c,d,m,n;
     vector<long long int> v;
     cin >>a>>b>>c>>d;
     v.push_back(a*c);
      v.push_back(a*d);
       v.push_back(b*c);
        v.push_back(b*d);
        sort(v.begin(),v.end());
        cout <<*v.rbegin();


}



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

#define endl '\n'

typedef long long ll;
typedef pair<ll, ll> pii;

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

	const ll mod = 1e9 + 7;

	int n; cin >> n;
	string s; cin >> s;

	vector<vector<ll>> dp(n, vector<ll>(n));
	dp[0][0] = 1;

	s = '0' + s;
	for(int i = 1; i < n; ++i)
	{
		if(s[i] == '<')
		{
			ll acc = 0;
			for(int j = 0; j <= i; ++j)
				dp[i][j] = acc, acc = (acc + dp[i - 1][j]) % mod;
		}
		else
		{
			ll acc = 0;
			for(int j = i; j >= 0; --j)
				acc = (acc + dp[i - 1][j]) % mod, dp[i][j] = acc;
		}
	}

	cout << accumulate(dp[n - 1].begin(), dp[n - 1].end(), 0ll) % mod << endl;

	return 0;
}


Measured memory_bytes: 70656
K, N = map(int, input().split())
D = list(map(int, input().split()))
D.sort()
flag = False
while True:
  K_str = str(K)
  for i in range(len(K_str)):
    for j in range(len(D)):
      if K_str[len(K_str)-1-i]==str(D[j]):
        flag=False
        break
      if j==len(D)-1:
        flag = True

    if not flag:
      break

  if flag:
    break
  K+=1

print(K)

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

int main(){
    
    int n,m,c;
    cin >> n >> m >> c;
    vector<int> b(m);
    for(int i=0; i<m; i++){
        cin >> b.at(i);
    }
    vector<int> a(m);
    int ans = 0;
    int count = 0;
    for(int k=0; k<n; k++){
        for(int j=0; j<m; j++){
            cin >> a.at(j);
            ans += a.at(j)*b.at(j);
        }
        ans += c;
        if(ans > 0){
            count += 1;
        }
        ans = 0;
    }
    cout << count << endl;
}

Measured memory_bytes: 3592
q,w=(%w{+ - *}*3).combination(3),%w{$%$ %%($%%) %%(%%$) ($%%)%% (%%$)%%}.map{|s|s.gsub(?$,"(%%%)").gsub"%","%s"};until f=/0/=~s=gets;s.split.permutation.map{|a,b,c,d|q.map{|x,y,z|w.map{|e|10==eval(e%=[a,x,b,y,c,z,d])&&(puts f=e;break)};f&&break};f&&break};f||p(0)end

Measured memory_bytes: 6516
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<bool> vb;
typedef vector<string> vs;
typedef vector<ll> vl;
typedef vector<vector<int, int> > vvi;
#define pb push_back
#define mp make_pair
#define f first
#define s second
#define in insert
#define FOR(i,a,b) for (int i = a; i < b; i++)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define speed ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
const int INF = 1e9 + 5;
int main(){
    string s;
    cin>>s;
    string t = "";
    for(int i = 0; i < s.size(); i++){
        if(s[i]!=','){
            t+=s[i];
        }
        else{
            t+=" ";
        }
    }
    cout << t;
}

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

using namespace std;



int main(int argc, char const *argv[])
{
	int t[32] = {1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
  	int a;
  scanf("%d", &a);
  	cout<<t[a-1];
	return 0;	
	return 0;
}



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



int main(void)
{
    string a;
    cin >> a;

    if (a == "A")
    {
        cout << "T" << endl;
    } else if (a == "T") 
    {
        cout << "A" << endl;
    } else if (a == "C") 
    {
        cout << "G" << endl;
    } else
    {
        cout << "C" << endl;
    } 

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <string>
#include <cmath>
#include <sstream>
//#include <unordered_map>
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define FORD(i, a, b) for(int i = (a-1); i >= (b); i--)
#define pb(a) push_back(a)
#define mp(a,b) make_pair(a,b)
typedef long long int ll;
using namespace std;
ll mod=1000000007;
//ll mod=67280421310721;
//ll mod=998244353;
ll INF=1e18;
ll po(ll a,ll b)
{
	ll re=1;
	while(b)
	{
		if(b%2==1)
		{
			re=(re*a);
			re%=mod;
		}
		a=(a*a);
		a%=mod;
		b>>=1;
	}
	return re;
}
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	int test=1;
//	cin>>test;
	while(test--)
	{
		int n,m;
		cin>>n>>m;
		ll o=1;
		FOR(i,m-n+1,m+1)
		{
			o*=i;
			o%=mod;
		}
		ll ans=0;
		ll p=(o*o)%mod;
		FOR(i,1,n+1)
		{
			if((i%2)==1)
			ans+=p;
			else
			ans+=(mod-p);
//			cout<<ans<<' ';
			p=(((((p*po(i,mod-2))%mod)*po(m-i+1,mod-2))%mod)*(n-i+1))%mod;
		}
//		cout<<p<<' ';
		if((n%2)==0)
		ans+=p;
		else
		ans+=(mod-p);
		cout<<ans%mod;
	}
	return 0;
}

Measured memory_bytes: 3652
import java.util.Scanner;

public class Main {
	int compare(int w1, int h1, int w2, int h2) {
		int d1 = w1 * w1 + h1 * h1;
		int d2 = w2 * w2 + h2 * h2;
		return d1 != d2 ? d1 - d2 : h1 - h2;
	}

	void run() {
		Scanner sc = new Scanner(System.in);

		while (true) {
			int h = sc.nextInt();
			int w = sc.nextInt();
			if ((h | w) == 0)
				break;

			int optH = 200, optW = 200;
			for (int i = 1; i <= 150; i++) {
				for (int j = 1; j < i; j++) {
					if (compare(w, h, i, j) < 0 && compare(i, j, optW, optH) < 0) {
						optW = i;
						optH = j;
					}
				}
			}
			
			System.out.println(optH + " " + optW);
		}
	}

	public static void main(String[] args) {
		new Main().run();
	}
}

Measured memory_bytes: 20396
N,K=map(int,input().split())

import math
sums = 0
for i in range(1,N+1):
    num=int(math.log(K/i,2)+1)
    
    if i>K-1:
        sums +=(1/N)
    else:
        if i*2**(num)>=K>i*2**(num-1):
            sums += 1/(N * math.pow(2,num))
        else:
            sums += 1/(N * math.pow(2,num-1))

print(sums)

Measured memory_bytes: 3060
# ENV[Z = 'RUBY_THREAD_VM_STACK_SIZE'] || exec( { Z => '50000000' },'ruby',$0)
# readlines.map(&:chomp!).map { |e| e.split.map(&:to_i) }
# gets.split.map(&:to_i)

s = gets.chomp!

if s.split('').include?('A') && s.split('').include?('B')
  puts 'Yes'
else
  puts 'No'
end


Measured memory_bytes: 1788
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int l = sc.nextInt();
        int r = sc.nextInt();
        int min = Integer.MAX_VALUE;
        for (int i = l; i < r && i < l + 2019; i++) {
            for (int j = i + 1; j <= r && j < l + 2019; j++) {
                int mi = i % 2019;
                int mj = j % 2019;
                int mm = (mi * mj) % 2019;
                if (mm < min) {
                    min = mm;
                }
            }
        }
        System.out.println(min);
    }
}


Measured memory_bytes: 23636
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#define N 1000

int main(void) {

	long long int a=0,b=0,c=0;
//	float p=0,q=0;
//	char str1[N],str2[N];



	scanf("%lld %lld %lld", &a, &b, &c);
	
	if(a+b >= c){
		if(a>=c){
			a=a-c;
		}
		else{
			c=c-a;
			a=0;
			b=b-c;
		}
	}
	
	else{
		a=0;
		b=0;
	}
	
	printf("%lld %lld", a, b);



	return 0;
}


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

double p,e,t;

double query(double l , double r , int k)
{
	if (k == 0) 
	{
		double mid = (l + r) / 2;
		if (mid >= t - e && mid <= t + e)	return 1;else return 0;
	}
	if (l >= t - e && r <= t + e)
		return 1;
	else
	if (!(r < t - e || l > t + e))
	{
		double mid = (l + r) / 2;
		if (mid >= t)
			return query(mid , r , k - 1) * p + (1 - p) * query(l , mid , k - 1);
		else
			return query(l , mid , k - 1) * p + (1 - p) * query(mid , r , k - 1);
	}
	else
	 	return 0;
}


int main(){
	int k,l,r;
	scanf("%d%d%d",&k,&l,&r);
	scanf("%lf%lf%lf",&p,&e,&t);
	double Ans = query(l,r,k);
	printf("%.12f\n" , Ans);
}

Measured memory_bytes: 1088
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include<numeric>
#include<cmath>
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define INF 2e9
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<ll,ll> pll;
typedef vector<vector<int> > vvi;
typedef vector<vector<ll> > vll;
const ll inf = 1LL << 60;

int main(){
    cin.tie(nullptr);
	ios_base::sync_with_stdio(false);
	//cout << fixed << setprecision(15);
    int X,N;cin>>X>>N;
    int p[N];
    vector<bool> flag(200,true);
    REP(i,N){
        cin>>p[i];
        flag[p[i]] = false;
        }

    if(flag[X] == true){
        cout << X << endl;
        return 0;
    } 
    else{
        int itr = 1;
        while(true){
            if(X-itr >= 0 && flag[X-itr] == true){
                cout<<X-itr<<endl;
                return 0;
            }
            else if(flag[X+itr] == true){
                cout<<X+itr<<endl;
                return 0;
            }
            itr++;
        }
    }

}

Measured memory_bytes: 3648
#include <bits/stdc++.h>
using namespace std;
 
long long a[100005], b[100005];
 
int main() {
    long long n, ans = 0;
    scanf("%lld", &n);
    for (int i = 1; i <= n; i++)
        scanf("%lld %lld", &a[i], &b[i]);
    for (int i = n; i >= 1; i--) {
        if ((a[i] + ans) % b[i] > 0) {
            ans = ans + b[i] - (a[i] + ans) % b[i]; } }
    printf("%lld\n", ans);
    return 0; }

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

long long modpow(long long a, long long b, long long m) {
	long long p = 1, q = a;
	for (int i = 0; i < 33; i++) {
		if ((b / (1LL << i)) % 2 == 1) { p *= q; p %= m; }
		q *= q; q %= m;
	}
	return p;
}

long long mod = 998244353;
long long N;
long long M1, A1[1 << 18], B1[1 << 18]; vector<int> X1[1 << 18];
long long M2, A2[1 << 18], B2[1 << 18]; vector<int> X2[1 << 18];
long long M3, A3[1 << 18], B3[1 << 18]; vector<int> X3[1 << 18];
long long C1[1 << 18], cnt1[1 << 18];
long long C2[1 << 18], cnt2[1 << 18];
long long C3[1 << 18], cnt3[1 << 18];

int main() {
	cin >> N;
	cin >> M1; for (int i = 1; i <= M1; i++) cin >> A1[i] >> B1[i];
	cin >> M2; for (int i = 1; i <= M2; i++) cin >> A2[i] >> B2[i];
	cin >> M3; for (int i = 1; i <= M3; i++) cin >> A3[i] >> B3[i];
	for (int i = 1; i <= M1; i++) { if (A1[i] > B1[i]) swap(A1[i], B1[i]); X1[A1[i]].push_back(B1[i]); }
	for (int i = 1; i <= M2; i++) { if (A2[i] > B2[i]) swap(A2[i], B2[i]); X2[A2[i]].push_back(B2[i]); }
	for (int i = 1; i <= M3; i++) { if (A3[i] > B3[i]) swap(A3[i], B3[i]); X3[A3[i]].push_back(B3[i]); }
	for (int i = N; i >= 1; i--) {
		bool cp[500]; for (int j = 0; j < 500; j++) cp[j] = false;
		for (int j : X1[i]) { cp[C1[j]] = true; }
		for (int j = 0; j < 500; j++) { if (cp[j] == true) continue; C1[i] = j; break; }
		cnt1[C1[i]] += modpow(10, 18 * i, mod);
		cnt1[C1[i]] %= mod;
	}
	for (int i = N; i >= 1; i--) {
		bool cp[500]; for (int j = 0; j < 500; j++) cp[j] = false;
		for (int j : X2[i]) { cp[C2[j]] = true; }
		for (int j = 0; j < 500; j++) { if (cp[j] == true) continue; C2[i] = j; break; }
		cnt2[C2[i]] += modpow(10, 18 * i, mod);
		cnt2[C2[i]] %= mod;
	}
	for (int i = N; i >= 1; i--) {
		bool cp[500]; for (int j = 0; j < 500; j++) cp[j] = false;
		for (int j : X3[i]) { cp[C3[j]] = true; }
		for (int j = 0; j < 500; j++) { if (cp[j] == true) continue; C3[i] = j; break; }
		cnt3[C3[i]] += modpow(10, 18 * i, mod);
		cnt3[C3[i]] %= mod;
	}

	long long Answer = 0;
	for (int i = 0; i < 500; i++) {
		for (int j = 0; j < 500; j++) {
			Answer += (cnt1[i] * cnt2[j] % mod) * cnt3[i ^ j] % mod;
			Answer %= mod;
		}
	}
	cout << Answer << endl;
	return 0;
}

Measured memory_bytes: 34392
#include<iostream>
#include<string>
#include<stdio.h>
using namespace std;
int main(){
	string a;
	while(cin>>a){
	for(int i=0;i<a.size();i++){
		if(a[i]=='A')
			a[i]='X';
		else if(a[i]=='B')
			a[i]='Y';
		else if(a[i]=='C')
			a[i]='Z';
		else
			a[i]=a[i]-3;
		cout<<a[i];
	}
	cout<<endl;
	}
	return 0;
}

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

int A,B,T,ans=0,sum=0;

int main(){
	scanf("%d%d%d",&A,&B,&T);
	ans=0;
	sum=A;
	while(sum<=T){
		ans+=B;
		sum+=A;
	}
	printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
//#define cerr if (false) cerr
#define db(x) cerr << #x << "=" << x << endl
#define db2(x, y) cerr << #x << "=" << x << "," << #y << "=" << y << endl
#define db3(x, y, z) cerr << #x << "=" << x << "," << #y << "=" << y << "," << #z << "=" << z << endl
#define dbv(v) cerr << #v << "="; for (auto _x : v) cerr << _x << ", "; cerr << endl
#define dba(a, n) cerr << #a << "="; for (int _i = 0; _i < (n); ++_i) cerr << a[_i] << ", "; cerr << endl
template <typename A, typename B>
ostream& operator<<(ostream& os, const pair<A, B>& x) {
	return os << "(" << x.first << "," << x.second << ")";
}
typedef long long ll;
typedef long double ld;
const ld PI = acosl(-1);
int main() {
	int N, L;
	scanf("%d%d", &N, &L);
	vector<int> a(N);
	for (int i = 0; i < N; ++i) {
		scanf("%d", &a[i]);
	}
	ld x = 0, y = 0;
	for (int i = 0; i < N; ++i) {
		for (int j = 0; j < N; ++j) {
			if (i == j) continue;
			int other;
			ll t;
			if (i < j) {
				t = a[j] + a[i];
				other = N + i - j - 1;
			} else {
				t = ((ll)a[j] + L + a[i]) % (2 * L);
				other = i - j - 1;
			}
			ld theta = PI * t / L;
			x += cos(theta) * other;
			y += sin(theta) * other;
		}
	}
	x /= (ll)N * (N - 1) * (N - 2) / 6;
	y /= (ll)N * (N - 1) * (N - 2) / 6;
	printf("%.9Lf %.9Lf\n", x, y);
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
const int N = 2e5+10;

ll n,m,a[N],b[N],lena,lenb,zero;

ll check(ll mid)
{
    ll ans = 0;
    if (mid < 0)
    {
        mid = abs(mid);
        for (int i = 1;i<=lena;i++)
        {
            ll num = a[i];
            if (mid % num == 0) num = mid / num;
            else num = mid / num + 1;
            ans += lenb - (lower_bound(b+1,b+lenb+1,num) - b - 1);
        }
    }
    else if (mid == 0) ans = zero * (lena + lenb) + lena * lenb + zero * (zero - 1) / 2;
    else
    {
        ans = zero * (lena + lenb) + lena * lenb + zero * (zero - 1) / 2;
        ll tmp1 = 0,tmp2 = 0;
        for (int i = 1;i<=lena;i++)
            tmp1 += upper_bound(a+i+1,a+lena+1,mid / a[i]) - a - i -1;
        for (int i = 1;i<=lenb;i++)
            tmp2 += upper_bound(b+i+1,b+lenb+1,mid / b[i]) - b - i -1;
        ans += tmp1 + tmp2;
    }
    return ans;
}

int main()
{
    scanf("%lld%lld",&n,&m);
    for (ll i = 1,u;i<=n;i++)
    {
        scanf("%lld",&u);
        if (u < 0) a[++lena] = -u;
        else if (u > 0) b[++lenb] = u;
        else zero++;
    }
    sort(a+1,a+lena+1);
    sort(b+1,b+lenb+1);
    ll r = max(a[lena] * a[lena-1],b[lenb] * b[lenb-1]),l = - a[lena] * b[lenb];
    while (l <= r)
    {
        ll mid = (l + r)>>1;
        ll num = check(mid);
        if (num >= m) r = mid - 1;
        else l = mid + 1;
    }
    cout<<l;
    return 0;
}


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

using namespace std;

const int mxn = 1e2;

int a[mxn + 11];

int main(){
	int n;
	scanf("%d", &n);
	int res = 0;
	for (int i = 0; i < n; i++){
		scanf("%d", a + i);
		res += a[i];
	}
	int m;
	scanf("%d", &m);
	while (m--){
		int id, cur, cur_res = res;
		scanf("%d %d", &id, &cur);
		cur_res -= a[id - 1];
		cur_res += cur;
		printf("%d\n", cur_res);
	}
	return 0;
}


Measured memory_bytes: 256
#include "iostream"
#include "math.h"
#include "algorithm"
#include "string"
#include "vector"
#include "deque"
#include "cmath"
using namespace std;
typedef long long ll;

int main() {
	int h, w, n;
	cin >> h >> w >> n;
	int ans;
	if (n%max(h, w) == 0) {
		ans = n / max(h, w);
	}
	else {
		ans = n / max(h, w) + 1;
	}
	cout << ans << endl;
}


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

const ll MOD = 1000000007;

int main() {
    int N;
    cin >> N;

    int A[N];
    rep(i, N) cin >> A[i];

    int R = 0, G = 0, B = 0;
    ll ans = 1;
    rep(i, N) {
        if (R == A[i]) {
            if (R==G && R == B) ans *= 3;
            else if (R==G && R>B) ans *= 2;
            R++;
        } else if (G == A[i]) {
            if (G == B) ans *= 2;
            G++;
        } else if (B == A[i]) {
            B++;
        } else {
            ans *= 0;
            break;
        }
        ans %= MOD;
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 640
#include<bits/stdc++.h>
#define ll long long int
#define vec vector<ll>
#define mat vector<vec>

using namespace std;

const ll mod=1000000007;
const ll inf=LONG_LONG_MAX;
ll dx4[4]={1,0,-1,0};
ll dy4[4]={0,-1,0,1};
ll dx8[8]={1,0,-1,1,-1,1,0,-1};
ll dy8[8]={1,1,1,0,0,-1,-1,-1};

int main(){

  ll a,b,x;
  cin >> a >> b >> x;
  if(x-a<=b && x-a>=0)cout << "YES" << endl;
  else cout << "NO" << endl;

}

Measured memory_bytes: 3584
#include <iostream>
#include <iomanip>
#include <cmath>
#include <vector>
#include <queue>
#include <limits>
#include <algorithm>
#include <string>
#include <map>
#include <set>
using namespace std;

int main()
{
	int32_t N;
	cin >> N;

	vector<int32_t> T(N);
	int32_t sum = 0;
	for (int32_t i = 0; i < N; i++) {
		cin >> T[i];
		sum += T[i];
	}

	int32_t M;
	cin >> M;
	for (int32_t i = 0; i < M; i++) {
		int32_t P, X;
		cin >> P >> X;
		cout << sum - T[P - 1] + X  << endl;
	}

	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n;
  cin >> n;
  vector<long long> a(n);
  int ans=1;
  bool x=false,y=false;
  for(int i=0;i<n;i++){
    cin >> a[i];
    if(i){
      if(a[i]-a[i-1]>0)x=true;
      if(a[i]-a[i-1]<0)y=true;
      if(x&&y){
        ans++;
        x=false;
        y=false;
      }
    }
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
#include <bits/extc++.h>
using namespace __gnu_pbds;
using namespace std;
#define testing 1
#define FOR(ii, ss, ee) for(ll ii = (ss); ii <= (ll)(ee); ++ii)
#define DEC(ii, ss, ee) for(ll ii = (ss); ii >= (ll)(ee); --ii)
#define IAMSPEED ios_base::sync_with_stdio(false); cin.tie(0);
#define db(x) cerr << #x << "=" << x << endl
#define db2(x, y) cerr << #x << "=" << x << " , " << #y << "=" << y << endl
#define db3(a,b,c) cerr<<#a<<"="<<a<<","<<#b<<"="<<b<<","<<#c<<"="<<c<<endl
#define dbv(v) cerr << #v << ":"; for (auto it : v) cerr << it << ' '; cerr << endl
#define dbvp(v) cerr << #v << ":"; for (auto it : v) cerr << "{"  << it.f << ',' << it.s << "} "; cerr << endl
#define dba(a,ss,ee) cerr << #a << ":"; FOR(i,ss,ee) cerr << a[i] << ' '; cerr << endl
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
#define ll long long 
#define pb push_back
#define inf (int)1e9+500
#define oo (ll)1e18+500
#define all(x) (x).begin(), (x).end()
#define f first
#define s second
#define reach cerr << "LINE: " << __LINE__ << "\n";
typedef pair <int, int> pi;
typedef pair <ll,ll> pl;
typedef pair <pi, int> pii;
typedef tuple<int,int,int> ti3;
string cts(char x) {string t(1,x); return t;}
ll rand(ll a, ll b) { return a + rng() % (b-a+1); }
const int MOD = 1e9 + 7;
template <typename T> void chmax(T& a, T b) {
	a = max(a, b);
}
template <typename T> void chmin(T& a, T b) {
	a = min(a, b);
}
#define MAXN
#if !testing
#define cerr if(0)cout
#endif

int32_t main() {
    IAMSPEED
    int n,k; cin >> n >> k;
    set<char>cannot;
    FOR(i,1,k) {
        int x; cin >> x;
        cannot.insert(x);
    }
    FOR(i,n,n*100) {
        string str = to_string(i);
        bool can = 1;
        for (auto it : str) {
            if(cannot.find(int(it-'0'))!=cannot.end())can = 0;
        }
        if(can) {
            cout<<i;
            return 0;
        }
    }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#include <math.h>
 
int main() {
  int N;
  cin >> N ;
  
  vector<int> vec(N);
  int num1=0;
    
  for(int i = 0; i < N; i++){
  	cin >> vec.at(i) ;
    if(vec.at(i) != i+1){
      num1++;
  	}
  }
  //cout << num1 << endl;
  if(num1 <= 2)
    cout << "YES" << endl;
  else
    cout << "NO" << endl;
}

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

constexpr int mod = 1e9 + 7;

string expr(string& s,int& i);
string term(string& s,int& i);
string str(string& s,int& i);
int number(string& s,int& i);

int main()
{
    string s;
    int k;
    while(cin>>s>>k){
        if(s=="0")return 0;
        int i=0;
        string text=expr(s,i);
        if(text.length()<=k)cout<<0<<endl;
        else cout<<text[k]<<endl;
    }
}

string expr(string& s,int& i){
    string val="";
    while(1){
        string t=term(s,i);
        if(t=="")break;
        if(val.length()>=1000001)break;
        val+=t;
    }
    return val;
}

string term(string& s,int& i){
    string val="";
    if(isdigit(s[i])){
        int n=number(s,i);
        string so="";
        if(s[i]=='('){
            i++;
            so=expr(s,i);
            i++;
        }else{
            so=s[i];
            i++;
        }
        for(int i=0;i<n;++i){
            if(val.length()>=1000001)break;
            val+=so;
        }
    }else{
        val=str(s,i);
    }
    return val;
}

string str(string& s, int& i) {
  string val="";
  while(s[i]>='A'&&s[i]<='Z')val+=s[i++];
  return val;
}

int number(string& s, int& i) {
  int n = s[i++] - '0';
  while(isdigit(s[i])) n = n*10 + s[i++] - '0';
  return n;
}


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

int main() {
  int n;
  string s;
  cin >> n >> s;
  int ans = 0;
  for(int i = 1; i < n; i++) {
    int cnt = 0;
    for(char c = 'a'; c <= 'z'; c++) {
      bool left = false;
      bool right = false;
      for(int j = 0; j < i; j++) {
        if(s[j] == c) left = true;
      }
      for(int j = i; j < n; j++) {
        if(s[j] == c) right = true;
      }
      if(left && right) cnt++;
    }
    ans = max(ans, cnt);
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 3648
# Template 1.0
import sys, re
from collections import deque, defaultdict, Counter, OrderedDict
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from heapq import heappush, heappop, heapify, nlargest, nsmallest
def STR(): return list(input())
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def list2d(a, b, c): return [[c] * b for i in range(a)]
def sortListWithIndex(listOfTuples, idx):   return (sorted(listOfTuples, key=lambda x: x[idx]))
def sortDictWithVal(passedDic):
    temp = sorted(passedDic.items(), key=lambda kv: (kv[1], kv[0]))
    toret = {}
    for tup in temp:
        toret[tup[0]] = tup[1]
    return toret
def sortDictWithKey(passedDic):
    return dict(OrderedDict(sorted(passedDic.items())))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

n,x,y = MAP()

dd = defaultdict(int)

for i in range(1, n+1):
    for j in range(i+1, n+1):
        dist = min(j-i, abs(x-i)+1+abs(y-j), abs(y-i)+1+abs(x-j))
        dd[dist]+=1
for l in range(1, n):
    print(dd[l])


Measured memory_bytes: 71460
#include <iostream>
#include <vector>
#include <map>
#include <algorithm>
using namespace std;

#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define SORT(c) sort((c).begin(),(c).end())
#define INF 999999999
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

int main()
{
	string S,ans,s1,s2;
	cin >> S;
	ans = "AC";

	if (S.substr(0,1) != "A") {
		ans = "WA";
	}
	s1= S.substr(2,S.length()-3);
	if (s1.find("C") == string::npos || (int)s1.find("C") != (int)s1.rfind("C")) {
		ans = "WA";
	}
	s2 = S.substr(1,S.find("C") - 1);
	s2 += S.substr(S.find("C") + 1, S.length() - (S.find("C") + 1));
	REP(i, s2.length()) {
		if (isupper(s2[i])) ans = "WA";
	}

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


Measured memory_bytes: 256
#include<stdio.h>
int main(void)
{
    int ss,h,m,s;
    scanf("%d",&ss);
    m=ss/60;
    m=m%60;
    s=ss%60;
    h=ss/3600;
    printf("%d:%d:%d\n",h,m,s);
    return 0;
}

Measured memory_bytes: 1024
#include <iostream>
#include <string>
#include <list>
#include <algorithm>
using namespace std;
int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);

    int n; cin >> n;

    list<int> li;
    int ignore = 0;

    for (int i=0; i<n; ++i) {
        string op; cin >> op;
        if (op == "insert") {
            int key; cin >> key;
            li.push_front(key);
        } else if (op == "deleteFirst") {
            li.pop_front();
        } else if (op == "deleteLast") {
            ignore ++;
        } else {
            int key; cin >> key;
            list<int>::iterator end_it = li.end();
            advance(end_it, -ignore);
            list<int>::iterator pos = find(li.begin(), end_it, key);
            if (pos != end_it) {
                li.erase(pos);
            }
        }
    }

    list<int>::iterator end_it = li.end();
    advance(end_it, -ignore);
    for (list<int>::iterator it = li.begin(); it != end_it; ++it) {
        cout << ((it == li.begin()) ? "" : " ") << *it;
    }
    cout << endl;
    return 0;
}

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

bool func(int a, int b, int c, int k, int i){
  if(k == i){
    return a < b && b < c;
  }
  return func(a*2, b, c, k, i+1) || func(a, b*2, c, k, i+1) || func(a, b, c*2, k, i+1);
}

int main(){
  int A, B, C, K;
  cin >> A >> B >> C >> K;
  cout << (func(A, B, C, K, 0) ? "Yes" : "No") << endl;
}

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

using namespace std;
typedef long long lolo;
typedef pair<int,int> pii;
typedef pair<double,double> pdd;
typedef unsigned long long ulolo;

const int maxn = (int)2e5 + 5;
const int INF = 0x3f3f3f3f;
const lolo inf = 0x3f3f3f3f3f3f3f3f;
const double eps = 1e-6;
const int MOD = 998244353;

template<class T>
inline void read(T &x) {
    x = 0; T flag = 1;char c;
    do { c = (char) getchar(); if (c == '-') break; } while (c < '0' || c > '9');
    if (c == '-') { c = '0', flag = -1;}
    do { x = x * 10 + c - '0';c = (char) getchar();} while (c >= '0' && c <= '9');
    x *= flag;
}

int a[3003];
int dp[3003];
int main() {
    int n, S;
    read(n);
    read(S);
    lolo ans = 0;
    for (int i = 1; i <= n; ++i) {
        read(a[i]);
        for (int k = S; k >= a[i]; --k) {
            dp[k] = (dp[k]+dp[k-a[i]])%MOD;
        }
        dp[a[i]] = (dp[a[i]]+i)%MOD;
        ans = (ans + 1LL*dp[S]*(n-i+1)%MOD)%MOD;
        dp[S]=0;
    }
    printf("%lld\n", ans);
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> pii;
#define forr(i,a,n) for (int i = (a); i < (n); ++i)
#define rforr(i,a,n) for (int i = (a); i > (n); --i)
#define ALL(x) (x.begin(),x.end())
#define LEN(X) ((int)(X).size())
#define CASET int _T; cin >> _T; forr(caset,0,_T)
 
int main() {
    ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
 
    int h,w, a, b; cin >> h >> w >> a >> b;
    vi col(w,0), row(h,0);
    bool grid[1000][1000] = {};

    forr(i,0,b) forr(j,0,a) grid[i][j] = true;
    forr(i,b,h) forr(j,a,w) grid[i][j] = true;

    forr(i,0,h) {
        forr(j,0,w) cout << grid[i][j];
        cout << '\n';
    } 

    return 0;
}

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

int fff(int a)
{
	if(a%2 == 0){
		return a/2;
	}else{
		return a*3 + 1;
	}
}

int main()
{
	int i = 0;
	vector<int> a(1000001);
	cin >> a[0];
	while(1){
		i++;
		a[i] = (fff(a[i-1]));
		if(count(ALL(a), a[i]) == 2){
			cout << i+1 << "\n";
			return 0;
		}
	}
}


Measured memory_bytes: 4096
a = int(input())
b = int(input())
c = int(input())
x = int(input())
ans = 0
for i in range(a + 1):
    for j in range(b + 1):
        for k in range(c + 1):
            if 500 * i + 100 * j + 50 * k == x:
                ans += 1
print(ans)


Measured memory_bytes: 2940
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <set>
#include <vector>
#include <numeric>
#include <algorithm>
#include <iostream>
#include <string>
#include <cstring>
#include <sstream>
#include <functional>
#include <queue>
#include <deque>
#include <stack>
#include <cassert>
#include <bitset>
#include <cmath>
#include <iomanip>

using namespace std;

using int64 = long long;

/////////////////////
// Code starts here//
/////////////////////


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

    int N;
    cin >> N;
    vector<int> A(N);
    for (int i = 0; i < N; i++)
        cin >> A[i];
    int res = (1<<30);
    for (int i = 1; i <= 100; i++) {
        int cur = 0;
        for (auto x : A) {
            cur += pow(x - i, 2);
        }
        res = min(res, cur);
    }
    cout << res << "\n";
    return 0;
}


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

int main(){
  int N,M,X,Y,Z;
  cin>>N>>M>>X;
  vector<int> vec(M);
  for(int i=0;i<M;i++)
    cin>>vec.at(i);
  int cost1,cost2;
  int cost=0;
  for(int num;num<2;num++){
  	if(num==1){
      Y=N;
      Z=X+1;
    }
    else{
      Y=X;
      Z=0;
    }
    for(int i=Z;i<Y;i++){
  	  for(int j=0;j<M;j++){
      	if(vec.at(j)==i){
      	  cost++;
          break;
      	}
      }
  	}
    if(num==1)
      cost1=cost;
    else
      cost2=cost;
    cost=0;
  }
  cout<<min(cost1,cost2)<<endl;;
}

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

#define SORT(v) sort(v.begin(),v.end())
#define si(n) scanf("%d",&n)
#define sii(n,m) scanf("%d %d",&n,&m)
#define sl(n) scanf("%lld",&n)
#define sll(n,m) scanf("%lld %lld",&n,&m)
#define ss(cad) scanf("%s",cad)
#define PB push_back
#define fst first
#define scn second
#define DBG(x) cerr << #x << " = " << (x) << endl; 
#define M 1000000007
#define N_MAX 100010

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef vector<bool> vb;
typedef vector<ll> vl;
typedef pair<int,int> pi;
typedef vector<pi> vp;

int main()
{
	int n, m;
	sii(n, m);
	vector<pair<pi, int> > vec;
	vl in(m);
	vl dist(n, -1);
	vl curr(m, -1);

	vp puntos;
	for(int i = 0; i < m; i++)
	{
		int val;
		si(val);
		val--;
		puntos.push_back({val, i});
		si(val);
		val--;
		puntos.push_back({val, i});
		sl(in[i]);
	}

	SORT(puntos);
	multiset<ll> lista;
	dist[0] = 0;
	int pos = 0;
	while(pos < puntos.size() && puntos[pos].fst == 0)
	{
		lista.insert(in[puntos[pos].scn]);
		curr[puntos[pos].scn] = in[puntos[pos].scn];
		pos++;
	}

	bool sw = 1;
	for(int i = 1; i < n; i++)
	{
		if(!lista.empty())
			dist[i] = *lista.begin();
		else
		{
			sw = 0;
			break;
		}

		while(pos < puntos.size() && puntos[pos].fst == i)
		{
			if(curr[puntos[pos].scn] != -1)
			{
				lista.erase(lista.find(curr[puntos[pos].scn]));
				curr[puntos[pos].scn] = -1;
			}
			else
			{
				lista.insert(dist[i] + in[puntos[pos].scn]);
				curr[puntos[pos].scn] = dist[i] + in[puntos[pos].scn];
			}
			pos++;
		}
	}

	if(sw)
		printf("%lld\n", dist[n-1]);
	else
		printf("-1\n");
    
    return 0;
}


Measured memory_bytes: 6256
<?php
fscanf(STDIN, "%d %d", $n, $m);
$cities = array_pad([], $n, 0);

for ($i = 0; $i < $m; $i++) {
    fscanf(STDIN,"%d %d",$a,$b);
    $cities[$a - 1]++;
    $cities[$b - 1]++;
}
for ($i = 0; $i < $n; $i++) echo $cities[$i]."\n";


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

int main(){
	ll a;
	cin >> a;
	ll val = (a+10)/11;
	if(val*6 + (val-1)*5 >=a)
		val = 2*val-1;
	else
		val = 2*val;
	cout<<val<<endl;
}

Measured memory_bytes: 256