akhauriyash/Code-Regression huggingface dataset:
//fold
#ifndef KHALIL
#include <bits/stdc++.h>
#else
#include "header.h"
#endif
#define endl '\n'
#define mp make_pair
#define tostr(x) static_cast<ostringstream&>((ostringstream()<<dec<<x)).str()
#define rep(i,begin,end) for(auto i = begin;i < end;i++)
#define repr(i,begin,end) for(auto i = begin-1;i >= end;i--)
#define pb push_back
#define sz(a) ((int)(a).size())
#define fi first
#define se second
#define abs(a) ((a) < (0) ? (-1)*(a) : (a))
#define SQ(a) ((a)*(a))
#define eqd(a,b) (abs(a-b)<1e-9)
#define X real()
#define Y imag()
using namespace std;
typedef long long ll;
typedef long double ld;
template <typename t> t in(t q){cin >> q;return q;}
template <typename T> ostream& operator<<(ostream& os, const vector<T>& v){os << "[";for (int i = 0; i < sz(v); ++i) { os << v[i]; if (i != sz(v) - 1) os << ",";}os << "]";return os;}
template <typename T, typename S>ostream& operator<<(ostream& os, const map<T, S>& v){for (auto it : v)os << "(" << it.first << ":" << it.second << ")";return os;}
template <typename T, typename S>ostream& operator<<(ostream& os, const pair<T, S>& v){os << "(" << v.first << "," << v.second << ")";return os;}
const long double PI = acosl(-1);
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
mt19937_64 rng64(chrono::steady_clock::now().time_since_epoch().count());
inline int rand(int l,int r){return uniform_int_distribution<int>(l, r)(rng);}
inline ll rand(ll l,ll r){return uniform_int_distribution<ll>(l, r)(rng64);}
//endfold
#define  N  (200005)
#define MOD (1000000000l + 7l)
#define OO (1050000000)
#define OOL (1100000000000000000)

//global
ll anspar(ll up, ll delta){
	ll ans = 0;
	if(delta == up) ans = up;
	else if(delta > up){
		if(delta%up == 0){
			ans = (delta/(up)-1)*(2*up)+up;
		}else{
			ans = (delta/(up))*(2*up)+anspar(up,delta%up);
		}
	}else if(delta < up){
		if(up%delta == 0){
			ans = (up/(delta)-1)*(2*delta)+delta;
		}else{
			ans = (up/(delta))*(2*delta)+anspar(up%delta,delta);
		}
	}
	return ans;
}

int main(){
	//fold
	ios::sync_with_stdio(0);
	cin.tie(0); cout.tie(0);
	cout << setprecision(10);
	//endfold
	ll n,x;
	cin >> n >> x;
	cout << n+anspar(x,n-x);
	return 0;
}

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

int main()
{
  ll chances,val1,val2;
  cin>>chances>>val1>>val2;
  ll answer=val1;
  if(val2-val1<=2){
    cout<<chances+1;
    return 0;
  }
  chances=chances-(val1-1);
  if(chances%2==0)
  {
    answer+=(chances/2)*(val2-val1);
  }
  else
  {
    answer+=(chances/2)*(val2-val1)+1;
  }
  cout << answer;
}

Measured memory_bytes: 3640
#![allow(non_snake_case,unused_imports,dead_code)]
use std::io::Read;
use std::cmp::max;
use std::cmp::min;
use std::str::FromStr;
use std::collections::HashMap;
use std::collections::HashSet;
use std::collections::BinaryHeap;

fn main() {
    let mut buf = String::new();
    std::io::stdin().read_to_string(&mut buf).unwrap();
    let mut buf_it = buf.split_whitespace();

    let N = buf_it.next().unwrap().parse::<usize>().unwrap();
    let M = buf_it.next().unwrap().parse::<usize>().unwrap();
    let A = (0..N).map(|_| 
        (0..M).map(|_|
            buf_it.next().unwrap().parse::<usize>().unwrap()-1).collect::<Vec<_>>()
                ).collect::<Vec<_>>();

    let check = |n:usize| {
        let mut popped = HashSet::new();
        let mut idx = (0..N).map(|_| 0).collect::<Vec<_>>();
        loop{
            let mut cnt = (0..M).map(|_| 0).collect::<Vec<_>>();
            for i in 0..N{
                cnt[A[i][idx[i]]] += 1;
            }
            if *(cnt.iter().max().unwrap())<=n{ return true; }
            for j in 0..M{
                if cnt[j] > n{
                    popped.insert(j);
                }
            }
            if popped.len()==M {break;}
            for i in 0..N{
                while popped.contains(&A[i][idx[i]]) {
                    idx[i] += 1;
                }
            }
        }
        false
    };
    let ans = 1 + binary_search(0,N,check);
    println!("{}",ans);
}

fn binary_search<F>(l:usize,r:usize,func:F) -> usize
where F : Fn(usize) -> bool{
    let mut l = l;
    let mut r = r;
    while l+1 < r{
        let i = (l+r)/2;
        if func(i){ r = i;} else {l = i;}
    }
    l
}

Measured memory_bytes: 4352
n,m,l = map(int, input().split())

A = [[] for i in range(n)]
B = [[] for i in range(m)]
C = [[0 for i in range(l)] for j in range(n)]

for i in range(n):
    A[i] = list(map(int, input().split()))
for i in range(m):
    B[i] = list(map(int, input().split()))

for i in range(n):
    for j in range(l):
        for k in range(m):
            C[i][j] += A[i][k]*B[k][j]

for i in range(n):
    print(' '.join(map(str, C[i])))


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

int main() {
  int n; cin >> n;
  vector<string> s(n);
  for (auto &a : s) cin >> a;
  int m; cin >> m;
  vector<string> t(m);
  for (auto &a : t) cin >> a;
  unordered_map<string, int> g;
  for (auto &a : s) ++g[a];
  for (auto &a : t) --g[a];
  int ans = 0;
  for (auto &p : g) ans = max(ans, p.second);
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
 
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define li long long
#define itn int
 
using namespace std;
 
inline int nxt(){
	int n;
	scanf("%d", &n);
	return n;
}

template <typename T>
ostream& operator <<(ostream& ostr, const vector<T>& a) {
	ostr << "(";
	for (size_t i = 0; i < a.size(); ++i) {
		if (i) {
			ostr << ", ";
		}
		ostr << a[i];
	}
	ostr << ")";
	return ostr;
}

int main() {
	int n = nxt(), m = nxt(), k = nxt();
	for (int i = 0; i <= n; ++i) {
		for (int j = 0; j <= m; ++j) {
			if (i * j + (n - i) * (m - j) == k) {
				puts("Yes");
				return 0;
			}
		}
	}
	puts("No");

	return 0;
}

Measured memory_bytes: 256
import math
from functools import reduce

def gcd_list(numbers):
  return reduce(math.gcd, numbers)

N=int(input())
A=list(map(int,input().split()))
mA = max(A)
D = [-1]*(mA+1)
D[0]=1
D[1]=1
for i in range(2,mA+1):
  if D[i] != -1: continue
  D[i] = i
  cnt = 2*i
  while cnt < mA+1:
    if D[cnt] == -1:
      D[cnt]=i
    cnt += i
done = set()
for a in A:
  tmp = set()
  while a > 1:
    tmp.add(D[a])
    a //= D[a]
  if len(done&tmp) > 0:
    if gcd_list(A) == 1: print('setwise coprime')
    else: print('not coprime')
    exit()
  done |= tmp
print('pairwise coprime')




Measured memory_bytes: 189428
h, w, k  = map(int, input().split())

puyo_orig = [list(map(int, list(input()))) for _ in range(h)]

import copy
mx = 0
for i1 in range(h):
    for i2 in range(w):
        puyo = copy.deepcopy(puyo_orig)
        puyo[i1][i2] = -1
        p = 0
        fin = 0
        turn = 0
        while fin==0:
            #[print(*puyo[i]) for i in range(h)]
            fin = 1
            
            for i in range(w):
                d_fin = 0
                while d_fin==0:
                    d_fin = 1
                    for j in range(h-1, 0, -1):
                        if puyo[j][i]==-1 and puyo[j-1][i]>0:
                            puyo[j][i] = puyo[j-1][i]
                            puyo[j-1][i] = -1
                            d_fin = 0
                            
            for i in range(h):
                cnt = 1
                for j in range(1, w):
                    if puyo[i][j-1] == puyo[i][j] and puyo[i][j]>0:
                        cnt += 1
                    else:
                        if cnt>=k:
                            p += cnt * puyo[i][j-1] * 2**turn
                            for k2 in range(cnt):
                                puyo[i][j-k2-1] = -1
                                fin = 0
                        cnt = 1
                    if j==w-1:
                        if cnt>=k:
                            p += cnt * puyo[i][j-1] * 2**turn
                            for k2 in range(cnt):
                                puyo[i][j-k2] = -1
                                fin = 0
            turn += 1
        if p>mx:
            mx=p
            
print(mx)


Measured memory_bytes: 55516
#include<stdio.h>
#include<algorithm>
using namespace std;
pair<pair<int,int> ,int> Q[500000];
int val[2][5001];
int main(){
	int a,b;
	scanf("%d%d",&a,&b);
	for(int i=0;i<b;i++){
		int c,d,e;scanf("%d%d%d",&c,&d,&e);
		Q[i]=make_pair(make_pair(c,d),e);
	}std::sort(Q,Q+b);
	int ret=0;
	int at=0;
	for(int i=0;i<a;i++){
		int e=i&1;
		while(at<b&&Q[at].first.first==i+1){
			val[e][Q[at].first.second-1]=max(val[e][Q[at].first.second-1],Q[at].second+1);
			at++;
		}
		for(int j=0;j<=i;j++)if(val[e][j])ret++;
		for(int j=0;j<=i+1;j++)val[!e][j]=0;
		for(int j=0;j<=i;j++){
			val[!e][j]=max(val[!e][j],val[e][j]-1);
			val[!e][j+1]=max(val[!e][j+1],val[e][j]-1);
		}
	}
	printf("%d\n",ret);
}

Measured memory_bytes: 6612
#include<bits/stdc++.h>
using namespace std;
long x[50],y[50],N,K,i,j,k,l,m,t,ans=LONG_MAX;
int main(){
  cin>>N>>K;
  for(i=0;i<N;i++)cin>>x[i]>>y[i];
  for(i=0;i<N;i++)for(j=0;j<N;j++)for(k=0;k<N;k++)for(l=0;l<N;l++){
    if(x[i]>=x[j]||y[k]>=y[l])continue;
    t=0;
    for(m=0;m<N;m++)if(x[m]>=x[i] && x[m]<=x[j] && y[m]>=y[k] && y[m]<=y[l])t++;
    if(t>=K)ans=min(ans,(x[j]-x[i])*(y[l]-y[k]));
  }
  cout<<ans<<endl;
}


Measured memory_bytes: 256
/*
AizuOnline A2204
Title
*/
#include <stdio.h>
#define min(x,y) (((x)<(y))?(x):(y))
#define max(x,y) (((x)>(y))?(x):(y))
#include <limits.h>

int s;
int n;
//
main()
{
        int i,j,minp,maxp,p;

        while(EOF!=scanf("%d",&n) && n)
        {
                maxp=INT_MIN;minp=INT_MAX;

                for(i=0;i<n;i++)
                {
                        s=0;
                        for(j=0;j<5;j++)
                        {
                                scanf("%d",&p);
                                s += p;
                        }
                        //printf("p:%d\n",s);
                maxp=max(maxp,s);
                minp=min(minp,s);
                }
                printf("%d %d\n",maxp,minp);
        }
        return(0);
}

Measured memory_bytes: 600
import sys
input = sys.stdin.readline

N, M = map(int, input().split())
X = list(map(int, input().split()))
X = sorted(X)
dif = [None] * (M-1)
for i in range(M-1):
    dif[i] = X[i+1] - X[i]
    
dif = sorted(dif)
res = 0
for i in range(M-N):
    res += dif[i]
print(res)

Measured memory_bytes: 13316
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define ld long double
#define MAX 100005
#define MOD 1000000007
#define pb push_back
#define mk make_pair
#define fi first
#define se second
#define mt make_tuple
#define eb emplace_back
#define INF 1e9
#define PI 3.141592653589793238
#define EPS 1e-9
ll modexp(ll a, ll b)
{
	ll res = 1;
	while(b)
	{
		if(b&1) res = (res*a)%MOD;
		a=(a*a)%MOD;
		b>>=1;
	}
	return res;
}
deque<int> dq;
int main()
{
	int n,i,x;
	cin>>n;
	for(i=1;i<=n;++i)
	{
		cin>>x;
		if(i&1) dq.push_front(x);
		else dq.push_back(x);
	}
	if(n%2 == 0)
	{
		vector<int> vt;
		for(auto x : dq)
		{
			vt.pb(x);
		}
		reverse(vt.begin(), vt.end());
		for(auto x : vt)
			cout<<x<<" ";
		cout<<endl;
		return 0;
	}
	for(auto x : dq)
		cout<<x<<" ";
	cout<<endl;
	return 0;
}

Measured memory_bytes: 3960
#include <iostream>
#include <string>
#include <algorithm>

using namespace std;

int main(){
  string w;
  cin >> w;

  sort(w.begin(), w.end());
  bool beauty = true;
  for(int i = 0; i < w.size(); i +=2){
    if(w[i] != w[i+1]) {
      beauty = false;
      break;
    }
  }
  if(beauty) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
  return 0;
}

Measured memory_bytes: 3608
using System;
using System.Collections.Generic;
using System.Text;
using System.Diagnostics;
using System.Linq;
class P
{
    static void Main()
    {
        string[] s = Console.ReadLine().Split();
        int n, m;
        n = int.Parse(s[0]);
        m = int.Parse(s[1]);
        int[][] lr = new int[m][];
        for (int i = 0; i < m; i++)
        {
            lr[i] = new int[2];
            s = Console.ReadLine().Split();
            lr[i][0] = int.Parse(s[0]);
            lr[i][1] = int.Parse(s[1]);
        }
        bool[] f = new bool[m];
        Array.Sort(lr, (a, b) => a[1] - b[1]); //右はじが小さい順にソート
        int ans = 0;
        int t = 0;
        for (int i = 0; i < m; i++)
        {
            if (t <= lr[i][0])
            {
                ans++;
                t = lr[i][1];
            }
        }
        Console.WriteLine(ans);
    }
}

Measured memory_bytes: 19400
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <algorithm>
#include <vector>
#include <queue>
#include <set>
using namespace std;
#define MAXN 2111

int read()
{
	int ret=0,neg=1;
	char c=getchar();
	while (c<'0' || c>'9'){
		if (c=='-') neg=-1;
		c=getchar();
	}
	while (c>='0' && c<='9'){
		ret=ret*10+c-'0';
		c=getchar();
	}
	return ret*neg;
}

int dp[MAXN][MAXN];
int n;
int pos[MAXN][2];
int sum[MAXN*2][MAXN][2];

int main()
{
	n=read();
	char c;int x;
	memset(sum,0,sizeof (sum));
	for (int i=1;i<=2*n;i++){
		cin>>c;
		x=read();
		bool f=(c=='B');
		pos[x][f]=i;
		for (int j=0;j<=n;j++) sum[i][j][0]+=sum[i-1][j][0],sum[i][j][1]+=sum[i-1][j][1];
		for (int j=0;j<x;j++) sum[i][j][f]++;
	}
	memset(dp,0x3f,sizeof(dp));
	dp[0][0]=0;
	for (int i=0;i<=n;i++)
		for (int j=0;j<=n;j++){
			if (i>0)
				dp[i][j]=min(dp[i][j],dp[i-1][j]+sum[pos[i][0]-1][i][0]+sum[pos[i][0]-1][j][1]);
			if (j>0)
				dp[i][j]=min(dp[i][j],dp[i][j-1]+sum[pos[j][1]-1][i][0]+sum[pos[j][1]-1][j][1]);
		}
	printf("%d",dp[n][n]);
}

Measured memory_bytes: 87296
use std::str::FromStr;
use std::fmt::Debug;
use std::cmp;
#[allow(dead_code)]
fn read_as_vec<T>() -> Vec<T>
where T: FromStr, <T as FromStr>::Err : Debug{
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).unwrap();
    s.trim().split_whitespace().map(|c| T::from_str(c).unwrap()).collect()

}

#[allow(dead_code)]
fn read_as_string() -> String{
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).unwrap();
    s.trim().to_string()
}

fn main(){
    let x = read_as_vec::<u64>()[0];
    let a = read_as_vec::<u64>()[0];
    let b = read_as_vec::<u64>()[0];

    println!("{}", (x-a)%b);
}


Measured memory_bytes: 4352
/*
Author : N_o_o_B
Created : December 02 2019 15:02:18 
*/
#include <bits/stdc++.h>
using namespace std;
/*
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
*/
#define TRACE
#ifdef TRACE
#define trace(...) { cerr<<"[ "; __trace__(#__VA_ARGS__, __VA_ARGS__);}
#undef endl
template <typename Arg1,typename Arg2>
ostream& operator << (ostream& out, const pair<Arg1,Arg2> &x) {
    return out<<"("<<x.first<<","<<x.second<<")";
}
 
template <typename Arg1>
ostream& operator << (ostream& out, const vector<Arg1> &a) {
    out<<"[";for(const auto &x:a)out<<x<<",";return out<<"]";
}
 
template <typename Arg1>
ostream& operator << (ostream& out, const set<Arg1> &a) {
    out<<"[";for(const auto &x:a)out<<x<<",";return out<<"]";
}
 
template <typename Arg1,typename Arg2>
ostream& operator << (ostream& out, const map<Arg1,Arg2> &a) {
    out<<"[";for(const auto &x:a)out<<x<<",";return out<<"]";
}
 
template <typename Arg1>
void __trace__(const string name, Arg1&& arg1){
    cerr << name << " : " << arg1 << " ] " << endl;
}
 
template <typename Arg1, typename... Args>
void __trace__(const string names, Arg1&& arg1, Args&&... args){
    const string name = names.substr(0,names.find(','));
    cerr<<name<<" : "<<arg1<<" | ";
    __trace__(names.substr(1+(int)name.size()), args...);
}
#else
    #define trace(args...)
#endif
 
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<pair<int,int>> vii;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<pair<ll,ll>> vll;
typedef vector<vl> vvl;
//typedef tree<pii, null_type, less<pii>, rb_tree_tag, tree_order_statistics_node_update> oset;
#define fori(i,n) for(int i=0;i<n;i++)
#define rep(i,a,b) for(int i=a;i<=b;i++)
#define repd(i,a,b) for(int i=a;i>=b;i--)
#define ford(i,n)  for(int i=n-1;i>=0;i--)
#define trav(x,a) for(auto& x:a)
#define all(x) x.begin(),x.end()
#define pb push_back
#define endl '\n'
#define sz(a) (int)a.size()
#define fi first
#define se second
clock_t time_p=clock();
void time_taken()
{
    time_p=clock()-time_p;
    cerr<<"Time Taken : "<<(float)(time_p)/CLOCKS_PER_SEC<<"\n";
}
//const ll mod=998244353;
const ll mod=1e9+7;
const ll INF=1e18;

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);cout.tie(NULL);
    cout.precision(12);cout << fixed;
    vi a(3);
    fori(i,3) cin >> a[i];
    sort(all(a));
    vi b={5,5,7};
    if(a==b){
        cout << "YES" << endl;
    }
    else{
        cout << "NO" << endl;
    }


    time_taken();
    return 0;
}

Measured memory_bytes: 256
#include <vector>
#include <string>
#include <iostream>
#include <iomanip>
#include <queue>
#include <algorithm>
#include <functional>
#include <map>
#include <array>
#include <cmath>
#include <set>
#include <numeric>

using namespace std;

template <typename T>
using TABLE = vector<vector<T>>;

using LONG = long long;
using LVEC = vector<long long>;

#define FOR(_i, s, e) for(_i = s; _i < e; ++_i)
#define FOR_INV(_i, s, e) for(_i = e - 1; _i >= s; --_i)

long long PRIME = 1e9 + 7;
long long PRIME2 = 998244353;


using pos = std::pair<LONG, LONG>;



int main(){
    LONG i, j, k;
    LONG N;
    cin >> N;

    LONG ret = 1;
    LONG A;

    const LONG max_v = 1e18;

    FOR(i, 0, N){
        cin >> A;
        if(A == 0){
            ret = 0;
        }

        if(ret <= 0){
            continue;
        }

        LONG sub = ret * A;
        if(A == 0){
            ret = 0;
        }
        else if(sub < ret || sub > max_v){
            ret = -1;
        }
        else{
            ret = sub;
        }
    }

    cout << ret;

}


Measured memory_bytes: 3624
#include <iostream>
#include<bits/stdc++.h>
#define F first
#define S second
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
typedef pair<ll,P> PP;
ll n,m,k,a,b,c,fa[100001],ra[100001],L,cnt;
vector<P> v;
vector<ll> ans;
ll find(ll x){
    if(x==fa[x])return x;
    return fa[x]=find(fa[x]);
}
void uni(ll x,ll y){
    x=find(x),y=find(y);
    if(x==y)return ;
    cnt-=ra[x]*ra[y];
    if(ra[x]<ra[y])swap(x,y);
    fa[y]=x;
    ra[x]+=ra[y];
    return ;
}
int main(void){
    
    cin>>n>>m;
    for(int i=0;i<m;i++){
        cin>>a>>b;
        a--,b--;
        v.push_back({a,b});
    }
    cnt=n*(n-1)/2;
    ans.push_back(cnt);
    for(int i=0;i<100001;i++){fa[i]=i;ra[i]=1;}
    reverse(v.begin(),v.end());
    for(P x:v){
        uni(x.F,x.S);
        ans.push_back(cnt);
    }
    reverse(ans.begin(),ans.end());
    for(int i=1;i<=m;i++)cout<<ans[i]<<endl;
}


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

#define rep(i,n) for(int i=0; i<(n); ++i)
#define rrep(i,n) for(int i=1; i<=(n); ++i)
#define drep(i,n) for(int i=(n)-1; i>=0; --i)
#define foreach(it, v) for(typeof(v.begin()) it=v.begin(); it!=v.end(); ++it)
#define pb push_back
#define sz(x) (int)(x).size()
#define fi first
#define se second
#define v(T) vector<T>

typedef unsigned int uint;
typedef long long int ll;
typedef vector<int> vi;
typedef pair<int,int> pii;
typedef vector<pii> vpii;
typedef set<int> si;
template<typename T>string join(const v(T)&v)
{stringstream s;rep(i,sz(v))s<<' '<<v[i];return s.str().substr(1);}
template<typename T>inline ostream& operator<<(ostream&o,const v(T)&v)
{if(sz(v))o<<join(v);return o;}

int N;
int X[1010];
int Y[1010];

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

  cin >> N;
  int b0;
  rep(i,N) {
    cin >> X[i] >> Y[i];
    int b = (X[i] + Y[i]) % 2;
    b = (b+2)%2;
    if (i == 0) {
      b0 = b;
    } else if (b != b0) {
      cout << "-1\n";
      return 0;
    }
  }

  int D = 31;
  vi d;
  rep(i,D) d.pb(1<<i);
  if (!b0) d.pb(1);

  cout << sz(d) << '\n';
  cout << d << '\n';

  rep(i,N) {
    string ans = "";
    int P = X[i] + Y[i];
    int M = X[i] - Y[i];
    P += (1<<D)-1;
    M += (1<<D)-1;
    rep(j,D){
      int p = ((1<<(j+1))&P);
      int m = ((1<<(j+1))&M);
      char c;
      if (p)
        if (m) c = 'R';
        else c = 'U';
      else
        if (m) c = 'D';
        else c = 'L';
      ans.pb(c);
    }
    if (!b0) ans.pb('R');
    cout << ans << '\n';
    //debug
    /*/
    int d_x = 0;
    int d_y = 0;
    rep (k,sz(ans)) {
      switch (ans[k]) {
        case 'R':
        d_x += d[k];
        break;
        case 'L':
        d_x -= d[k];
        break;
        case 'U':
        d_y += d[k];
        break;
        case 'D':
        d_y -= d[k];
        break;
      }
    }
    cout << "deb " << d_x << " " << d_y << "\n";
    //*/
  }
  return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#include <iostream>
#include <iomanip>
#include <vector>
#include <string.h>
#include <string>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <math.h>
#include <algorithm>
#include <numeric>

using namespace std;

// マクロ&定数 ============================================================
typedef unsigned int uint;
typedef long long ll;
//typedef pair<int, int> P;

typedef vector<int> vint;
typedef vector<ll> vll;
typedef vector<double> vdouble;
typedef vector<bool> vbool;
typedef vector<string> vstring;

typedef vector<pair<int, int>> vpint;
typedef vector<pair<ll, ll>> vpll;
typedef vector<pair<double, double>> vpdouble;

typedef vector<vector<int>> vvint;
typedef vector<vector<ll>> vvll;
typedef vector<vector<double>> vvdouble;
typedef vector<vector<bool>> vvbool;

const int c_YET = -1;
const int INF = 1e9 + 1;
const ll LLINF = 1e17 + 1;
const int DX[9] = { 0,0,1,-1, 1, 1, -1, -1, 0 }; // 4;４近傍
const int DY[9] = { 1,-1,0,0, 1, -1, 1, -1, 0 }; // 8:８近傍 9:(0,0)を含む
const ll MOD = 1e9 + 7; //10^9 + 7
const ll MAX = 1e9;
const double PI = 3.14159265358979323846264338327950288;
//========================================================================


vbool made(1e8);

bool k;

int main() {

	//==================================
	cin.tie(nullptr);
	ios_base::sync_with_stdio(false);
	cout << fixed << setprecision(30);
	//==================================


	ll N;
	cin >> N;

	vpll RL(N);
	for (int i = 0; i < N; i++)
	{
		ll x, l;
		cin >> x >> l;
		RL[i].first = x + l;
		RL[i].second = x - l;
	}

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

	ll ans = N;
	ll leach = RL[0].first;
	for (ll i = 1; i < N; i++)
	{
		if (leach <= RL[i].second)
		{
			leach = RL[i].first;
			continue;
		}
		else
		{
			ans--;
		}

	}




	cout << ans;





}



Measured memory_bytes: 14080
#include "bits/stdc++.h"
using namespace std;

#define rep(i, n) for (int i = 0; i < (int) (n); i++)
typedef long long ll;


int main()
{
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(15);

    char str[10];

    cin >> str;

    if (strcmp(str, "Sunny") == 0) { cout << "Cloudy" << endl; }
    else if (strcmp(str, "Cloudy") == 0) { cout << "Rainy" << endl; }
    else { cout << "Sunny" << endl; }

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
ll a7=1000000007;
ll inf=1000000000000000;
#define rep(i,l,r) for(ll i=l;i<=r;i++)

ll min(ll a,ll b){
    if(a<b)return a;
    return b;
}
ll max(ll a,ll b){
    if(a>b)return a;
    return b;
}

int main(){
    ll a,b;cin>>a>>b;
    if(a<=9 && b<=9){
        cout<<a*b<<endl;
    }else{
        cout<<-1<<endl;
    }
    
    return 0;
}


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

using namespace std;

#define rep(i,n) for(long long i=0; i<(long long)(n);i++)
//rep…「0からn-1まで」の繰り返し
#define rep2(i,s,n) for(long long i=s; i<=(long long)(n);i++)
//rep2…「sからnまで」の繰り返し
#define repr(i,s,n) for(long long i=s;i>=(long long)(n);i--)
//repr…「ｓからnまで」の降順の繰り返し

typedef long long ll;

const ll inf = 1e18+7;
const ll mod = 1e9+7;

//階乗
int factorial(int k){
    int result=1;
    for (int i=1;i<=k;++i){
        result*=i;
    }
    return result;
}

int main() {
    int n,k;
    cin>>n>>k;

    vector<int>l(n);

    rep(i,n)cin>>l[i];

    sort(l.begin(),l.end());
    reverse(l.begin(),l.end());

    int ans=0;

    rep(i,k)ans+=l[i];

    cout<<ans<<endl;
}


Measured memory_bytes: 256
n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
c = [a[i] - b[i] for i in range(n)]
s = sum(c)
if s < 0:
    print(-1)
    exit(0)
c.sort()
ans = 0
for i in range(n):
    if c[i] < 0:
        pass
    elif c[i] <= s:
        ans += 1
        s -= c[i]
    else:
        break
print(n - ans)


Measured memory_bytes: 83888
/* ex4_1
  terakura */

#include <stdio.h>
#include <math.h>

int main(void){
    double trees, distance;
    scanf("%lf %lf", &trees, &distance);
    int range = distance * 2 + 1;       //1人で監視できる範囲
    int min = ceil(trees / range);     //最小の人数
    printf("%d\n", min);
    return 0;
}


Measured memory_bytes: 128
abcd = input()

abcd_list = []

def plus_or_minas(abcd_str, pos, abcd):
    if pos == 4:
        abcd_list.append(abcd_str)
        return

    plus_or_minas(abcd_str+'+'+abcd[pos], pos+1, abcd)
    plus_or_minas(abcd_str+'-'+abcd[pos], pos+1, abcd)
    return

plus_or_minas(abcd[0], 1, abcd)

for i_abcd in abcd_list:
    if eval(i_abcd) == 7:
        print(i_abcd+'=7')
        exit()

Measured memory_bytes: 38384
//For higher stack size use g++ -O2 -std=c++11 -Wall -Wl,--stack=268435456 a.cpp -o a.exe in cmd
    #include <bits/stdc++.h>
    #include <cstdio>
    #include <cstring>
    #include <cmath>
    #include <cstring>
    #include <chrono>
    #include <complex>
    #define ll long long
    #define ld long double
    #define vi vector<int>
    #define vll vector<ll>
    #define vvi vector < vi >
    #define pii pair<int,int>
    #define pll pair<long long, long long>
    #define mod 1000000007
    #define inf 1000000000000000001;
    #define all(c) c.begin(),c.end()
    #define mp(x,y) make_pair(x,y)
    #define mem(a,val) memset(a,val,sizeof(a))
    #define eb emplace_back
    #define pb push_back
    #define f first
    #define s second
    
    using namespace std;
    int main()
    {
        std::ios::sync_with_stdio(false);
        int T;
        T=1;
        // cin.ignore(); must be there when using getline(cin, s)
        while(T--)
        {
            string s;
            ll i,j,x,n,sum=0;
            cin>>s;
            for(i=s.length()-1;i>=0;--i)
            {
                if(s[i]!='0')
                    break;
            }
            n=i+1;
            ll ans=0;
            ll dp[n+1][2];
            mem(dp,0);
            dp[n][0]=0,dp[n][1]=0;
            int flag=0;
            for(i=n-1;i>=0;--i)
            {
                dp[i][0]=min(dp[i+1][0],dp[i+1][1])+(s[i]-'0');
                if(i!=n-1)
                {
                    dp[i][1]=1+min(10-(s[i]-'0')+dp[i+1][0],10-(s[i]-'0')+dp[i+1][1]-2);
                }
                else
                {
                    dp[i][1]=1+10-(s[i]-'0');
                }
                // cout<<i<<" "<<dp[i][0]<<" "<<dp[i][1]<<endl;
            }
            ans=min(dp[0][0],dp[0][1]);
            cout<<ans<<endl;
        }
        return 0;
    }


Measured memory_bytes: 17052
module Main where

import           Control.Monad
import           Data.List
import           Data.Ord
import           Data.List.Split
import           Data.Array.IO
import qualified Data.Vector.Unboxed as V

main :: IO ()
main = do
  [a, b, c] <- map read . words <$> getLine
  mapM_ print $ get c [a .. b] [b, (b - 1) .. a]
  where
    get c xs ys = nub $ (take c xs) ++ (sort $ take c ys)

Measured memory_bytes: 764
#include <iostream>

using namespace std;
 

int main()
{ 
	int n;
	while (cin >> n)
	{
		int cnt = 0;

		for (int a = 0; a <= 9; ++a)
			for (int b = 0; b <= 9; ++b)
				for (int c = 0; c <= 9; ++c)
					for (int d = 0; d <= 9; ++d)
						if (a + b + c + d == n) cnt++;
		cout << cnt << endl;
	}

	return 0;
}

Measured memory_bytes: 1160
/*Made by Shivam Solanki*/
#include<bits/stdc++.h>
using namespace std;
#define DEBUG(x) cout << '>' << #x << ':' << x << endl;
#define ll long long int
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vll> vvl;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<vi> vvi;
typedef vector<bool> vb;
typedef vector<pii> vp;
typedef vector<pll> vpll;
typedef map<int,int> mii;
typedef map<ll,ll> mll;
typedef set<int> sii;
typedef set<ll> sll;
typedef unordered_map<int,int> umii;
typedef unordered_map<ll,ll> umll;
#define rep(i,k,n) for (int i = k; i < n; ++i) 
#define repr(i,k,n) for (int i = n; i>=k; --i)
#define REP(i,k,n) for (int i = k; i <= n; ++i) 
#define REPR(i,k,n) for (int i = k; i >= n; --i)
#define repll(i,k,n) for (ll i = k; i < n; ++i) 
#define pb push_back
#define mp make_pair
#define __gcd gcd
#define F first
#define S second
#define fastio ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
const int INF = 1e9+5;
const int MOD = 1e9+7;
 
void solve(){
    int n;
    cin>>n;
    bool flag=0;
    rep(i,1,10){
        if(n/i<10 and n%i==0){
            flag=1;
            break;
        }
    }
    cout<<(flag==1?"Yes":"No");
}
 
int main(){
    // #ifndef ONLINE_JUDGE  
        // freopen("input.txt", "r", stdin); 
        // freopen("output.txt", "w", stdout); 
    // #endif 
    // fastio;
    int t=1;
    // cin>>t;
    while(t--)
        solve();
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <climits>
#include <numeric>
#include <iomanip>
#include <cmath>
#include <vector>
#include <set>
#include <unordered_set>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <unordered_map>
 
#define barsik ios::sync_with_stdio(false)
#define all(x) begin(x), end(x)
#define rall(x) rbegin(x), rend(x)
typedef long long ll;
typedef std::vector<int> vi;
typedef std::pair <int, int> pii;
typedef std::unordered_set <int> u_si;
const double PI = acos(-1);
const long double EPS = 1e-9;
using namespace std;


void solve(){
    int n;
    cin >> n;
    ll a1 = 2;
    ll a2 = 1;
    for(int i = 2; i <= n; i++){
        ll tmp = a1 + a2;
        a1 = a2;
        a2 = tmp;
    }
    if(n == 0) cout << a1;
    else cout << a2;
}
int main(){
    int q = 1;
    //cin >> q;}
    while(q--) solve();
}


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

int main () {
  string h;
  cin >> h;
  vector<int> dp;
  dp.resize(h.size());
  for (int i = 0; i < h.size(); i++) {
    dp[i] = 0;  
  }      
  dp[0] = 1;
  for (int i = 0; i < h.size(); i++) {
    if (h == "dream" ||  h == "dreamer" || h == "erase" || h == "eraser") {
      cout << "YES" << endl;
      return 0;  
    }

    if (dp[i] == 1) {
      if (h.substr(i + 0, 5) == "dream") {
        if (i + 5 == h.size()) {
          cout << "YES" << endl;
          return 0;  
        }
        dp[i + 5] = 1;  
      }
      if (h.substr(i + 0, 5) == "erase") {
        if (i + 5 == h.size()) {
          cout << "YES" << endl;
          return 0;  
        }

        dp[i + 5] = 1;
      }
      if (h.substr(i + 0, 6) == "eraser") {
        if (i + 6 == h.size()) {
          cout << "YES" << endl;
          return 0;  
        }
        dp[i + 6] = 1;  
      }
      if (h.substr(i + 0, 7) == "dreamer") {
        if (i + 7 == h.size()) {
          cout << "YES" << endl;
          return 0;  
        }

        dp[i + 7] = 1;  
      }
    }  
  }
  if (dp[h.size() - 1] == 1) {
    cout << "YES" << endl;
    return 0;  
  }
  cout << "NO" << endl;
}

Measured memory_bytes: 896
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <set>
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include <cstdio>
#include <cstring>
#include <iterator>
#include <bitset>
#include <unordered_set>
#include <unordered_map>
#include <fstream>
#include <iomanip>
#include <cassert>
//#include <utility>
//#include <memory>
//#include <functional>
//#include <deque>
//#include <cctype>
//#include <ctime>
//#include <numeric>
//#include <list>
//#include <iomanip>

//#if __cplusplus >= 201103L
//#include <array>
//#include <tuple>
//#include <initializer_list>
//#include <forward_list>
//
//#define cauto const auto&
//#else

//#endif

using namespace std;


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

typedef vector<int> vint;
typedef vector<vector<int> > vvint;
typedef vector<long long> vll, vLL;
typedef vector<vector<long long> > vvll, vvLL;

#define VV(T) vector<vector< T > >

template <class T>
void initvv(vector<vector<T> > &v, int a, int b, const T &t = T()){
    v.assign(a, vector<T>(b, t));
}

template <class F, class T>
void convert(const F &f, T &t){
    stringstream ss;
    ss << f;
    ss >> t;
}

#undef _P
#define _P(...) (void)printf(__VA_ARGS__)
#define reep(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n) reep((i),0,(n))
#define ALL(v) (v).begin(),(v).end()
#define PB push_back
#define F first
#define S second
#define mkp make_pair
#define RALL(v) (v).rbegin(),(v).rend()
#define DEBUG
#ifdef DEBUG
#define dump(x)  cout << #x << " = " << (x) << endl;
#define debug(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
#else
#define dump(x) 
#define debug(x) 
#endif

#define MOD 1000000007LL
#define EPS 1e-8
#define INF 0x3f3f3f3f
#define INFL 0x3f3f3f3f3f3f3f3fLL
#define maxs(x,y) x=max(x,y)
#define mins(x,y) x=min(x,y)

void mainmain(){
	ll a,b,c;
	cin>>a>>b>>c;
	ll ans = LLONG_MAX;
	if(a%2==0 || b%2==0 || c%2==0){
		cout<<0<<endl;
	}
	else{
		vll v={a,b,c};
		sort(ALL(v));
		cout<<v[0]*v[1]<<endl;
	}
}


signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout<<fixed<<setprecision(20);
    mainmain();
}

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

using namespace std;

int main()
{
	int n;
	cin >> n;
	unordered_map<int, int> m;
	for (int i = 0; i < n; i++)
	{
		int a;
		cin >> a;
		auto it = m.find(a);
		if (it != m.end()) it->second++;
		else m[a] = 1;
	}
	int r = 0;
	for (auto&& p : m) r += p.second < p.first ? p.second : p.second - p.first;
	cout << r << endl;
	return 0;
}


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

//conversion
//------------------------------------------
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();}

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

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<bool> VB;
typedef vector<double> VD;
typedef vector<string> VS;
typedef vector<char> VC;
typedef pair<int, int> PII;
typedef long long LL;
typedef vector<LL> VLL;
typedef vector<VLL> VVLL;

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define SQ(a) ((a)*(a))
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
#define LB lower_bound
#define UB upper_bound

//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI  = acos(-1.0);
const LL INF = 1e9;
const LL MOD = 1e9+7;

//other
//-------------------------------------------
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)
#define FI first
#define SE second

//memo
// setprecision()


struct UnionFind {
  
  VI par, siz;
  
  UnionFind(int n):par(n), siz(n,1) {
    REP(i,n){
      par[i] = i;
    }
  }
  
 /* 
  void init(int n) {
    
    REP(i,n){
      par.PB(i);
      siz.PB(1);
    }
  }
*/  
  
  int find(int x) {
    if(par[x] == x){
      return x;
    }else{
      return par[x] = find(par[x]);
    }
  }

  void unite(int x, int y){
    x = find(x);
    y = find(y);
    if(x == y) return;

    if(siz[x] < siz[y]){
      swap(x,y);
    }
    siz[x] += siz[y];
    par[y] = x;
      
    }

  bool same(int x, int y){
    return find(x) == find(y);
  }
  
  int size(int x){
    return siz[find(x)];
  }

};


int main() {
  
  int N,M,K,A,B;
  cin >> N >> M >> K;
  
  UnionFind uf(N+1);
  VI v(N+1);
  
  REP(i,M){
    cin >> A >> B;
    v.at(A)++;
    v.at(B)++;
    uf.unite(A,B);
  }
  
  REP(i,K){
    cin >> A >> B;
    if(uf.same(A,B)){
      v.at(A)++;
   	  v.at(B)++;
    }
  }
  
  FOR(i,1,N+1){
    cout << uf.size(i) - v.at(i) - 1;
    
    if(i != N){
      cout << " ";
    }
  }
  
  cout << endl;
  
  return 0;
}

Measured memory_bytes: 2048
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace PokerPlaying {
    class Class2 {
        int[,] section;
        readonly int[] dY = new int[]{0, 1, 0, -1};
        readonly int[] dX = new int[]{ 1, 0, -1, 0 };
        int num_Div = 1;

        static void Main(string[] args) {
            new Class2().solve();
        }
        void solve() {
            while (true) {
                string lengthinput = Console.ReadLine();
                if (lengthinput == "0 0") {
                    return;
                }
                var divL = lengthinput.Split(' ');
                int x_length = int.Parse(divL[1]);
                int y_length = int.Parse(divL[0]);

                string[,] input = new string[y_length, x_length];
                section = new int[input.GetLength(0), input.GetLength(1)];
                for (int y = 0; y < y_length; y++) {
                    string data = Console.ReadLine();
                    for (int x = 0; x < x_length; x++) {
                        input[y, x] = data.Substring(x, 1);
                    }
                }
                Console.WriteLine(searchProperty(input));
            }
        }
        public int searchProperty(string[,] data) {

            int num_Div = 1;

            for (int i = 0; i < data.GetLength(0); i++) {
                for (int j = 0; j < data.GetLength(1); j++) {
                    if (section[i, j] == 0) {
                        compare(data, data[i, j], j, i);
                        num_Div++;
                    }
                }
            }
            return num_Div - 1;
        }

        void compare(string[,] data, string comparison, int x, int y) {
            if (!isValid(x, y)) return;
            if (data[y, x] != comparison || section[y, x] != 0) return;
            section[y, x] = num_Div;
            for (int i = 0; i < dX.Length; i++) {
                compare(data, comparison, x + dX[i], y + dY[i]);
            }
        }

        bool isValid(int x, int y) {
            if (x >= section.GetLength(1) || y >= section.GetLength(0)
                || x < 0 || y < 0) {
                return false;
            } else return true;
        }
    }
}

Measured memory_bytes: 10288
#include <iostream>
//#include <algorithm>
//#include <vector>

using namespace std;

int main(){
    int a,b,k;
    cin >> a;
    cin >> b;
    cin >> k;
    
    
    int K=0;

    for(int i=100; i>=1; --i){
        if(a%i==0 & b%i==0) {
            K++;
            if(K==k) {cout << i; return 0;}
        }
    }
     


    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#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;
int main()
{
  int k,s;
  cin >> k >> s;
  int ans = 0;

  REP(x,k+1){
    if(x==s){
      ans++;
      break;
    }
    REP(y,k+1){
      if(x+y==s){
        ans++;
        break;
      }
	  if(s-(x+y) <= k) ans++;
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
#define AB_BHI_NI_DEGI                \
    ios_base::sync_with_stdio(false); \
    cin.tie(NULL);                    \
    cout.tie(NULL);
#define int long long
#define pb push_back
#define N 100009
#define inf 1e18
const double PI = 3.141592653589793238462643383279;
int mod = 1e9 + 7;
//int mod = 998244353;
#define P pair<int, int>
#define F first
#define S second
#define all(v) v.begin(), v.end()
#define vi vector<int>
#define ld long double

#define ordered_set tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update>

void solve()
{
    string s;
    cin >> s;
    if (s.back() == 's')
        s += "es";
    else
        s += "s";
    cout << s << "\n";
}
int32_t main()
{
    AB_BHI_NI_DEGI
    int Test = 1;
    //cin >> Test;
    //init();
    while (Test--)
        solve();
    return 0;
}
/*

*/

Measured memory_bytes: 3652
import sys

class SamInput(object):
    def __init__(self):
        self.inp = []
        for i in sys.stdin:
            i = i.replace("\n", "")
            j = list(i.split())
            self.inp.append(j)

    def readln(self):
        if len(self.inp) == 0:
            return False
        else:
            return str.join(" ", self.inp.pop(0))

    def read(self):
        if len(self.inp) == 0:
            return False
        while len(self.inp[0]) == 0:
            self.inp.pop(0)
            if len(self.inp) == 0:
                return False
        return self.inp[0].pop(0)

def main():
    inp = SamInput()
    N = int(inp.read())
    K = int(inp.read())

    ttl = 0

    for i in range(N):
        dc = i + 1
        ctr = 0
        while dc < K:
            ctr += 1
            dc *= 2
        ttl += (1/N * (0.5**ctr))

    print(ttl)

    # print( (1/6) * (0.5**K + 0.5 ** (K/2) + 0.5 ** (K/3) + 0.5**(K/4) + 0.5 ** (K/5) + 0.5 ** (K/6)))

if __name__ == '__main__':
    main()

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

int main() {
int a,b;
char op1;
int r;
cin >> a >> op1 >> b;
while(op1 !='?'){

if (op1 == '+'){
r = a+b;
}else if(op1 =='-'){
r = a-b;
} else if(op1 =='*'){
r = a*b;
}else if(op1 =='/'){
r = a/b;
}
cout << r << endl;
cin >> a >> op1 >> b;
}
return 0;
}


Measured memory_bytes: 3044
#include<cstdio>
#include<algorithm>
using namespace std;
inline char tc(void){
	static char fl[10000],*A=fl,*B=fl;
	return A==B&&(B=(A=fl)+fread(fl,1,10000,stdin),A==B)?EOF:*A++;
}
inline int read(void){
	int a=0;char c;
	while((c=tc())<'0'||c>'9');
	while(c>='0'&&c<='9')a=a*10+c-'0',c=tc();
	return a;
}
int n,a[101],ans;
int main(void){
	register int i,now=0,num=0;
	n=read();
	for(i=1;i<=n;++i){
		a[i]=read();
		if(a[i]==now)++num;
		else now=a[i],ans+=num/2,num=1;
	}
	ans+=num/2;
	printf("%d",ans);
	return 0;
}

Measured memory_bytes: 128
import math
N = int(input())
P = [(0, 0)]
for i in range(N):
    x, y = [int(_) for _ in input().split()]
    P.append((x, y))

s = 0
for i in range(1, N+1):
    for j in range(1, N+1):
        d = math.sqrt((P[i][0] - P[j][0])**2 + (P[i][1] - P[j][1])**2)
        s += d

print(s/N)





Measured memory_bytes: 3064
import itertools

n, m = list(map(int, input().split()))
v = []
for i in range(m):
  tpl = tuple(map(int, input().split()))
  v.append(tpl)
  v.append((tpl[1], tpl[0]))

perms = list(itertools.permutations(range(1, n+1)))
c = 0
for i in perms:
  if i[0] != 1:
    continue
  for j in range(len(i)-1):
    if (i[j], i[j+1]) not in v:
      break
  else:
    c += 1
print(c)


Measured memory_bytes: 8052
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;++i)
#define rrep(i,n) for(int i=n-1;i>=0;--i)
#define yesno(flg) if(flg){cout<<"YES"<<endl;}else{cout<<"NO"<<endl;}
#define MAX_N 1002
#define i197 1000000007
using namespace std;

typedef long long ll;
typedef pair<ll,ll> P1;
typedef pair<ll,int>Pli;
typedef pair<P1,ll> P2;
typedef pair<double,int> Pdi;
const ll INF=100000000000000001;
struct edge{int to,cost;};
int dy[]={0, 0, 1, -1};
int dx[]={1, -1, 0, 0};
priority_queue<Pdi,vector<Pdi>,greater<Pdi>> que;
vector<Pli> v[18];
P2 xy[MAX_N]={};
ll dp[1<<18]={};
string str[100000];
int main() {
	int n,k;
	cin>>n>>k;
	ll ans=INF;
	ll x[100005];
	for(int i=0;i<n;++i){
		cin>>x[i];
	}
	for(int i=0;i<n-k+1;++i){
		if(x[i]*x[i+k-1]>0){
			ans=min(ans,max(llabs(x[i]),llabs(x[i+k-1])));
		}else{
			ans=min(ans,max(llabs(x[i]),llabs(x[i+k-1]))+min(llabs(x[i]),llabs(x[i+k-1]))*2);
		}

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


Measured memory_bytes: 1792
#include <cstdio>
#include <algorithm>

int main()
{
using namespace std;
	int i;
	scanf("%d",&i);

	for(;i>0;i--)
	{
		int l[3];
		scanf("%d %d %d",&l[0],&l[1],&l[2]);
		
		sort(l,l+3);
		if(l[2]*l[2]==l[0]*l[0]+l[1]*l[1])printf("YES\n");
		else printf("NO\n");

	}
	
return 0;

}

Measured memory_bytes: 0
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();
		int ans = 0;

		for (int i = 0; i<2;i++) {
			if (a>b) {
				ans += a;
				a-=1;
			} else {
				ans += b;
				b-=1;
			}
		}

		System.out.println(ans);
	}
}

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

#define rep(i, n) for (int i = 0; i < (int) n; i++)

using namespace std;

int main()
{
	int l = 0;
	string s;
	cin >> s;
	char res[100] = "";
	rep(i, s.length()) {
		if (s[i] == '0') {
			res[l] = '0';
			l++;
		} else if (s[i] == '1') {
			res[l] = '1';
			l++;
		} else {
			l = max(0, l-1);
		}
	}
	rep(i, l) cout << res[i];
	cout << endl;
}

Measured memory_bytes: 256
#define _GLIBCXX_DEBUG
#pragma GCC diagnostic ignored "-Wsign-compare"
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for (int i = 0; i < int(n); ++i)

void solve() {
    int n;
    cin >> n;
    vector<int> A(n);
    for (auto &e : A) {
        cin >> e;
    }
    reverse(A.begin(), A.end());
    rep(i, n) {
        if (i) cout << " ";
        cout << A[i];
    }
    cout << "\n";
}
int main() {
    cin.tie(0);
    ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    solve();
}


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

int main() {
  long a,b,m;cin>>a>>b>>m;
  vector<long> an(a), bn(b);
  rep(i,a) cin>>an[i];
  rep(i,b) cin>>bn[i];
  long price = *min_element(an.begin(), an.end()) + *min_element(bn.begin(), bn.end());
  
  long x,y,c;
  rep(i,m) {
    cin>>x>>y>>c;
    price = min(price, an[x-1] + bn[y-1] - c);
  }
  cout << price;
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
#define rep(i, a, n) for(int i = a; i < n; i++)
#define repr(i, a, b) for(int i = a; i >= b; i--)
#define int long long
#define all(a) a.begin(), a.end()
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
using namespace std;
typedef pair<int, int> P;
const int mod = 1000000007;
const int INF = 1e18;

int d[31][31];
int a[510][510];
int b[3][31];

signed main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n, c;
    cin >> n >> c;
    rep(i, 0, c) rep(j, 0, c) cin >> d[i][j];
    rep(i, 0, n) rep(j, 0, n){
        cin >> a[i][j];
        a[i][j]--;
        b[(i + j) % 3][a[i][j]]++;
    }
    int ans = INF;
    rep(i, 0, c){
        rep(j, 0, c){
            rep(k, 0, c){
                if(i == j || j == k || k == i) continue;
                int tmp = 0;
                rep(l, 0, c){
                    tmp += d[l][i] * b[0][l] + d[l][j] * b[1][l] + d[l][k] * b[2][l];
                }
                chmin(ans, tmp);
            }
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 2304
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
// #include <iomanip>
// std::cout << std::fixed << std::setprecision(5);

int main()
{
    int r; std::cin >> r;
    std::cout << 3 * r * r << std::endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) for (int i = 0; i < (n); ++i)
#define int long long
#define vec(a,n) vector<int> (a)((n))
#define Vec(a,n) vector<string> (a)((n))
using namespace std;
signed main(){
    int a,b;
    cin >> a >> b;
    (a+b <10)? cout << a+b : cout << "error";
    

    return 0;
}

Measured memory_bytes: 256