akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define ii pair<int,int>
#define modulo 1000000007
#define INF 100000000000000000
#define int long long int
using namespace std;
int factorial(int n){
	int res=1;
	for(int i=2;i<=n;i++){
	res*=i;
	}
	return res;
	}
double distance(int ax,int bx,int ay,int by){
	return sqrt((double)(((ax-bx)*(ax-bx))+((ay-by)*(ay-by))));
	}
int32_t main(){
	ios_base::sync_with_stdio(0);
	cin.tie(NULL);
	int n,a,b;
	long double res=0;
	long double sonuc=0;
	vector<ii> yollar;
	cin >> n;
	for(int i=0;i<n;i++){
	cin >> a >> b;
	yollar.pb(mp(a,b));
	}
	for(int i=0;i<n;i++){
		for(int j=i+1;j<n;j++){
		sonuc=distance(yollar[i].first,yollar[j].first,yollar[i].second,yollar[j].second);
		sonuc*=factorial(n-1);
		sonuc*=2;
		res+=sonuc;
		}
	}
	cout <<setprecision(15)<< res/(long double)(factorial(n));
	return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
using namespace std;
#define MAXN 2e5+1
#define ll long long

int N;
vector<int> A(MAXN);
vector<ll> c(MAXN,0);
vector<ll> s(MAXN,0);

int main(){
  cin>>N;
  int maxa=0;
  for(int i=0;i<N;i++){
    cin>>A[i];
    c[A[i]]++;
    maxa=max(maxa,A[i]);
  }
  ll sum=0;
  for(int i=0;i<=maxa;i++){
    if(c[i]>1){
      sum+=(c[i]*(c[i]-1))/2;
    }
  }
  fill(s.begin(),s.end(),sum);
  for(int i=0;i<=maxa;i++){
    if(c[i]>1){
      s[i]=sum-(c[i]*(c[i]-1))/2+((c[i]-1)*(c[i]-2))/2;
    }
  }
  for(int i=0;i<N;i++){
    cout<<s[A[i]]<<endl;
  }
}

Measured memory_bytes: 6528
#include <iostream>
#include <math.h>
#include <vector>
#include <map>
using namespace std;


int main(){
    int n;
    cin >> n;
    vector<int> b(n);
    int bi;
    for(int i=0; i<n; i++){
        cin >> bi;
        b[i] = bi;
    }
    bool erase = false;
    vector<int> ans(n);
    for(int i=0; i<n; i++){
        erase = false;
        for(int j=n-i-1; j>-1; j--){
            if(j+1==b[j]){
                ans[i] = b[j];
                b.erase(b.begin()+j);
                erase = true;
                break;
            }
        }
        if(!erase){
            cout << -1 << endl;
            exit(0);
        }
    }

    for(int i=0; i<n; i++){
        cout << ans[n-1-i] << endl;
    }
}

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

#ifdef LOCAL
#define debug(_) cerr << #_ << ": " << (_) << '\n'
#define _GLIBCXX_DEBUG
#else
#define debug(_) 0
#endif // LOCAL

int main(){
    int D;

    cin >> D;
    D = 25 - D;
    cout << "Christmas";
    for (int i = 0; i < D; i++) {
        cout << " Eve";
    }
    cout << '\n';
    
    return 0;
}

Measured memory_bytes: 3624
#include <stdio.h>

int main(void){
	int x,y;
	while(1){
		scanf("%d %d", &x ,&y);
		if(x==0&&y==0){
			break;
		}
		if(x>y){
			int tmp = x;
			x = y;
			y = tmp;
		}
		printf("%d %d\n",x,y );
	}
	return 0;
}

Measured memory_bytes: 600
from collections import defaultdict
cards = defaultdict(int)
n = int(input())
for _ in range(n):
    s = input()
    cards[s] += 1
m = int(input())
for _ in range(m):
    t = input()
    cards[t] -= 1
ans = 0
for k, v in cards.items():
    ans = max(ans, v)
print(ans)

Measured memory_bytes: 3316
#include <unordered_set>
#include <iostream>
#include <string>

using namespace std;

int main(){
    long long n; cin >> n;
    unordered_set<string> dict;
    for(int i=0;i<n;i++){
        string method,element;
        cin >> method >> element;
        if(method == "insert"){
            dict.insert(element);
        } else {
            if (dict.count(element) >= 1)
                cout << "yes" << endl;
            else
                cout << "no" << endl;
        }
    }
}

Measured memory_bytes: 31980
import bisect
import sys
input = sys.stdin.readline
from collections import defaultdict
class Bit:
  def __init__(self, n):
    self.size = n
    self.tree = [0] * (n + 1)

  def sum(self, i):
    s = 0
    while i > 0:
        s += self.tree[i]
        i -= i & -i
    return s

  def add(self, i, x):
    while i <= self.size:
      self.tree[i] += x
      i += i & -i
n,d,a = map(int,input().split())
xh = [list(map(int,input().split())) for i in range(n)]
for i in range(n):
  xh[i][1] = (xh[i][1]+a-1)//a
xh.sort()
x = [xh[i][0] for i in range(n)]
remain = [xh[i][1] for i in range(n)]
ans = 0
bit = Bit(n+1)

for i in range(n):
  if bit.sum(i+1) >= remain[i]:
    continue
  br = bisect.bisect_right(x,x[i]+2*d)
  y = remain[i]-bit.sum(i+1)
  ans += y
  bit.add(i+1,y)
  bit.add(br+1,-y)
print(ans)

Measured memory_bytes: 92456
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <complex>
#include <string>
#include <sstream>
#include <algorithm>
#include <numeric>
#include <vector>
#include <queue>
#include <stack>
#include <functional>
#include <iostream>
#include <map>
#include <set>
using namespace std;
typedef pair<int,int> P;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
#define pu push
#define pb push_back
#define mp make_pair
#define eps 1e-9
#define INF 2000000000
#define sz(x) ((int)(x).size())
#define fi first
#define sec second
#define SORT(x) sort((x).begin(),(x).end())
#define all(x) (x).begin(),(x).end()
#define EQ(a,b) (abs((a)-(b))<eps)
#define MOD 1000000007ll
ll dp[2050][2050];
int N,X;
ll D;
ll mod_pow(ll a,ll x)
{
	ll res =1ll;
	if(x==0ll)return res;
	while(x>0)
	{
		if(x&1)res = (res*a)%MOD;
		a = (a*a)%MOD;
		x >>= 1;
	}
	return res;
}
int main()
{
	while(1)
	{
		cin >> N >> D >> X;
		if(N==0&&D==0&&X==0)break;
		memset(dp,0,sizeof(dp));
		dp[0][0]=1ll;
		for(int i=0;i<N;i++)
		{
			for(int j=0;j<N;j++)
			{
				dp[i+1][j+1]=(dp[i][j]+dp[i+1][j])%MOD;
				if(j-X+1>=0)dp[i+1][j+1]=(dp[i+1][j+1]-dp[i][j-X+1]+MOD)%MOD;
			}
		}
		ll ans = 0ll;
		ll C = D%MOD;
		for(int i=1;i<=min(D,(ll)N);i++)
		{
			ans = (ans+C*dp[i][N])%MOD;
			C = (C*((D-i)%MOD))%MOD;
			C = (C*mod_pow(i+1,MOD-2))%MOD;
		}
		cout << ans << endl;
	}
	return 0;
}

Measured memory_bytes: 34004
#ifdef DEBUG

#else

#    pragma GCC optimize("O3,no-stack-protector")
#    pragma GCC optimize("unroll-loops")

#    if __cplusplus < 201703L
#        pragma GCC target("avx")
#    else
#        pragma GCC target("avx2")
#    endif

#endif

#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
#define dump(x) cout << x << endl
typedef int64_t Int;
typedef long double Ld;

using namespace std;
using Graph = vector<vector<Int>>;

const Ld pi = M_PI;
const Int MOD = 1000000007;
const Int INF = 1LL << 61;

// 二分累乗法
template <typename T>
T modpow(T a, T n, T mod) {
    T ret = 1;

    if (mod == 1) {
        while (n > 0) {
            if (n & 1) {
                ret = ret * a;
            }
            a = a * a;
            n >>= 1;
        }
    } else {
        while (n > 0) {
            if (n & 1) {
                ret = ret * a % mod;
            }
            a = a * a % mod;
            n >>= 1;
        }
    }

    return ret;
}

Int Floor(Int a, Int b) {
    return (a - (a % b)) / b;
}

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

    Int n;
    cin >> n;

    vector<Int> aa{26};
    for (int i = 0;; i++) {
        aa.push_back(aa.back() * 26);
        if (1000000000000001 < aa.back()) {
            break;
        }
    }
    int ro = aa.size();
    for (int i = 0; i < ro - 1; i++) {
        aa[i + 1] += aa[i];
    }

    int anssize;
    for (int i = 0; i < ro; i++) {
        if (n <= aa[i]) {
            anssize = i + 1;
            if (i != 0) {
                n -= aa[i - 1];
            }

            break;
        }
    }

    Int x = n - 1;
    string ans;

    for (int i = 0; i < anssize; i++) {
        ans += ('a' + (x % 26));
        x = x / 26;
    }

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

    cout << ans << endl;

    return 0;
}

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

int main() {
  string S;
  cin >> S;
  int N=S.size();
  bool ans = true;
  for (int i=1; i<N+1; i++){
    if (S.at(i-1)=='L' && (i%2)==1) ans = false;
    if (S.at(i-1)=='R' && (i%2)==0) ans = false;
  }
  if (ans) {
    cout << "Yes" << endl; 
  }
  else {
    cout << "No" << endl;
  }
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
#define rep(i,b) for(ll i=0;i<b;i++)
#define ll long long
using namespace std;
/*--Input//////////////////////////////////////////////////*/
inline void IN(void){return;}
template <typename First, typename... Rest>
void IN(First& first, Rest&... rest){cin >> first;IN(rest...);return;}
#define SS(T, ...)      T __VA_ARGS__; IN(__VA_ARGS__);
#define SV(type,c,n) vector<type> c(n);for(auto& i:c)cin >> i;
/*--Output/////////////////////////////////////////////////*/
inline int p(void){cout << endl; return 0;}
template<class Head> int p(Head&& head){cout << head;p();return 0;} template<class Head,class... Tail> int p(Head&& head,Tail&&... tail){cout<<head<<" ";p(forward<Tail>(tail)...);return 0;}
struct ProconInit {
    static constexpr bool AUTOFLUSH = false;
    ProconInit() {
        cin.tie(nullptr);
        ios::sync_with_stdio(false);
        cout << fixed << setprecision(15);
        if(AUTOFLUSH)
            cout << unitbuf;
    }
} PROCON_INIT;

#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define vl vector<ll>
#define vvl vector<vector<ll>>
#define vvvl vector<vector<vector<ll>>>
#define debug(x) cerr<<#x<<" "<<x<<'\n';
#define all(x) (x).begin(),(x).end()
#define bit(n) (1LL<<(n))
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
bool cmp(pair<ll,ll> a, pair<ll,ll> b) { return a.first+a.second > b.first+b.second; }

int main() {
    SS(string,s);
    ll ans=0,cnt=0;
    rep(i,s.length()){
        if(s[i]=='A')cnt++;
        else if(s[i]=='B'&&s[i+1]=='C'){
            ans+=cnt;
            i++;
        }
        else cnt=0;
    }
    p(ans);
}

Measured memory_bytes: 720
n = gets.to_i
data = n.times.map { gets.strip.split.map(&:to_i) }

def is_reachable(current, next_data)
  tc, xc, yc = current
  tn, xn, yn = next_data
  dist = (xc - xn).abs + (yc -yn).abs

  return false if dist > tn -tc

  (dist - (tn - tc)).even?
end

current = [0, 0, 0]
data.each do |d|
  unless is_reachable(current, d)
    puts "No"
    exit 0
  end
  current = d
  end
puts "Yes"

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

fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    read::<String>()
        .split_whitespace()
        .map(|e| e.parse().ok().unwrap())
        .collect()
}

fn print<T: std::fmt::Display>(x: T) -> () {
    println!("{}", x);
}

fn main() {
    let abt: Vec<usize> = read_vec();
    let a = abt[0];
    let b = abt[1];
    let t = abt[2];

    let s = t / a;
    print(s * b);
}


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

int main(){
  
  int A,B;
  cin >> A >>B;
  
  for(int i=0;;i++){  
    if(abs(A-B) % 2 !=0){
      cout << "IMPOSSIBLE"<<endl; break;
    }
    if(abs(A-i) == abs(B-i)){
      cout << i <<endl; break;
    }
  }
  
}

Measured memory_bytes: 256
#include<stdio.h>

int main()
{
	int k,x,i;
 
	scanf("%d%d",&k,&x);
	for(i=0;i<2*k-1;i++){
		if(i<2*k-1)
			printf("%d ",x-k+1+i);
		else if(i==2*k-1)
			printf("%d ",x);
		else
			printf("%d ",x-k+1+i);
	}
	return 0;
}

Measured memory_bytes: 128
#include <stdio.h>

int main(void) {
	int a,b,c,d;
	scanf("%d",&a);
	d=a%60;
	c=(a-d)/60;
	b=c;
	c%=60;
	b-=c;
	b/=60;
	printf("%d:%d:%d\n",b,c,d);
	return 0;
}


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

int main(){
    long long n,count = 0;

    std::cin >>  n;

    for(int i = 1; i <= n; i++){
        if(i % 5 != 0 && i % 3 != 0 ){
            count = count + i;
        }
    }

    std::cout << count <<endl   ;

    return 0;
}

Measured memory_bytes: 3596
/**
  * @brief atcoder
  * @author yao
  */
#include <cstdlib>
#include <cstdio>
#include <cctype>
#include <cstring>
#include <utility>
#include <algorithm>
#include <functional>
#include <climits>
#define ft first
#define sd second
#ifdef DBG
#   define dbg_pri(x...) fprintf(stderr,x)
#else
#   define dbg_pri(x...) 0
#   define NDEBUG
#endif //DBG
#include <cassert>

typedef unsigned int uint;
typedef long long int lli;
typedef unsigned long long int ulli;

#define N 131072

struct Edge{
    int u, v, w;
}e[N];

int lea[N];
lli w[N];
int cnt[N];

int getlea(int k)
{
    if(lea[k] != lea[lea[k]]) lea[k] = getlea(lea[k]);
    return lea[k];
}

int main()
{
    int n, m;
    scanf("%d%d", &n, &m);
    for(int i=0;i<n;++i) lea[i] = i;
    for(int i=0;i<n;++i) scanf("%lld", &w[i]);
    for(int i=0;i<m;++i) scanf("%d%d%d", &e[i].u, &e[i].v, &e[i].w), --e[i].u, --e[i].v;
    std::sort(e,e+m,[](Edge a, Edge b){return a.w<b.w;});
    for(int i=0;i<m;++i)
    {
        int u = getlea(e[i].u), v = getlea(e[i].v);
        if(u!=v)
        {
            lea[v] = u;
            w[u] += w[v];
            cnt[u] += cnt[v];
        }
        if(w[u] < e[i].w) ++cnt[u];
        else cnt[u] = 0;
    }
    int ans = 0;
    for(int i=0;i<n;++i)if(lea[i] == i) ans += cnt[i];
    printf("%d\n", ans);
    return 0;
}


Measured memory_bytes: 4444
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp>
 
// Remove GCC optimizer for codechef
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("O3")
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
 
using namespace std;
using namespace __gnu_pbds;
 
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define pb push_back
#define endl "\n"
#define int long long
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
 
const int INF = 1e16;
const double PI = acos(-1);
const int N = 1e6 + 7;
int mod = 1e9 + 7;

const int maxn = 1e5 + 7;
bool dp[maxn];

int32_t main()
{
    IOS;
    // freopen("input.txt", "r", stdin);
    // freopen("output.txt", "w", stdout);

    int n, k;
    cin >> n >> k;
    vector<int> va(n);
    for(int i = 0; i < n; i++)
        cin >> va[i];
    sort(va.begin(), va.end());
    for(int i = 1; i <= k; i++)
    {
        for(int j = 0; j < n; j++)
        {
            if(va[j] > i)
                break;
            dp[i] |= !dp[i-va[j]];
        }
    }
    cout << (dp[k] ? "First" : "Second") << endl;
    return 0;
}

Measured memory_bytes: 384
// abc of ABC

#include <iostream>
#include <cmath>
#include <vector>
#include <algorithm>
#include <unordered_map>
#include <ios>
#include <iomanip>
#include <string>
#include <numeric>

using namespace std;

int main() {
    string s;
    cin >> s;
    if ((s[0] - 'a') + (s[1] - 'a') + (s[2] - 'a') == 3) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }

    return 0;
}


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

using namespace std;
#define LL long long
#define N 10005

LL frogDist(LL *arr, LL n, LL k )
{
    LL dp[n];
    dp[0]=0 ;
    for(LL i=1; i<n; i++) dp[i] = LONG_LONG_MAX;
    for(LL i=0; i<n-1; i++)
    {
        ///dp[i+1]= min(dp[i+1], dp[i]+ abs(arr[i]-arr[i+1]));


        for(LL j=1; j<=k && (i+j)<=(n-1); j++)
        {
            ///dp[i+j]= min(dp[i+j],dp[i]+ abs(arr[i]-arr[j]));
            ///BUG: arr[source]-arr[destination]; so arr[i]-arr[i+j] hobe
            dp[i+j]= min(dp[i+j],dp[i]+ abs(arr[i]-arr[i+j]));
            

        }
        





    }


    return dp[n-1];




}

int main()
{
    ios_base::sync_with_stdio();
    cin.tie(0);
    cout.tie(0);
    //cout<<"N="<<N<<endl;
    int t;
    t=1;
    while(t--)
    {
        LL n,k;
        cin>>n>>k;
        LL arr[n];
        for(LL i=0; i<n; i++) cin>>arr[i];
        int val= frogDist(arr, n, k);
        cout<<val<<endl;

    }

    return 0;
}




Measured memory_bytes: 1792
import java.util.*;


public class Main {
	
	int h,w, ans;
	char [][] data;
	int [][] used;
	
	int INF =  1<< 29;
	
	public class Edge implements Comparable<Edge>{
		int from,to, cost;
		public Edge(int from, int to, int cost) {
			this.from = from; this.to = to; this.cost = cost;
		}
		public int compareTo(Edge o) {
			if(this.cost < o.cost)return -1;
			if(this.cost > o.cost)return 1;
			return 0;
		}
	}
	
	//ダイクストラの状態クラス
		class State implements Comparable<State>{
			int now, cost;
			public State(int now, int cost) {
				this.now = now;
				this.cost = cost;
			}
			public int compareTo(State o) {
				return this.cost - o.cost;
			}
		}
	
	private int dijkstra(int s, int g, ArrayList<ArrayList<Edge>> pass) {
		PriorityQueue<State> open = new PriorityQueue<State>();
		open.add(new State(s, 0));
		int n = pass.size();
		double [] close = new double[n];
		Arrays.fill(close, INF);
		close[s] = 0.0;
		int [] route = new int[n];
		route[s] = -1;
		boolean flg = false;
		while(! open.isEmpty()){
			State now = open.poll();
			if(now.now == g){
				flg = true;
				return now.cost;
			}
			for(int i = 0 ; i < pass.get(now.now).size(); i++){
				Edge nowe = pass.get(now.now).get(i);
				int nextcost = now.cost + nowe.cost;
				if(close[nowe.to] <= nextcost) continue;
				close[nowe.to] = nextcost;
				open.add(new State(nowe.to, nextcost));
				route[nowe.to] = nowe.from;
			}
		}
		return -1;
	}
	
	private void doit(){
		Scanner sc = new Scanner(System.in);
		while(sc.hasNext()){
			h = sc.nextInt();
			w = sc.nextInt();
			data = new char[h][w];
			for(int i = 0; i < h; i++){
				data[i] = sc.next().toCharArray();
			}
			int count = 0;
			for(int i = 0; i < h; i++){
				for(int j = 0; j < w; j++){
					if(data[i][j] == '.') count++;
				}
			}
			ArrayList<ArrayList<Edge>> edge = new ArrayList<>();
			int [] dy = {-1,0,1,0};
			int [] dx = {0,1,0,-1};
			for(int i = 0; i < h; i++){
				for(int j = 0; j < w; j++){
					ArrayList<Edge> e = new ArrayList<>();
					for(int k = 0; k < 4; k++){
						int xx = j + dx[k];
						int yy = i + dy[k];
						if(!(0<= xx && xx < w && 0<= yy && yy < h)) continue;
						if(data[yy][xx] == '#') continue;
						e.add(new Edge(j + i * w, xx + yy * w, 1));
					}
					edge.add(e);
				}
			}
			int res = dijkstra(0, h * w -1, edge);
			
			if(res == -1){
				System.out.println(-1);
			}
			else{
				System.out.println(count - res - 1);
			}
		}
	}

	private void debug(Object... o) {
		System.out.println("debug = " + Arrays.deepToString(o));
	}

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

}


Measured memory_bytes: 23892
#include<bits/stdc++.h>
#define ll long long int
#define mk make_pair
#define pb push_back
#define INF (ll)1e18
#define pii pair<ll,ll>
#define mod 1000000007 //998244353
#define f(i,a,b) for(ll i=a;i<b;i++)
#define fb(i,a,b) for(ll i=a;i>b;i--)
#define ff first
#define ss second
#define PI 3.141592653589793238
#define pq priority_queue<ll>
#define pqr priority_queue<ll,vector<ll>,greater<ll>()>
using namespace std;
ll pow_mod(ll a,ll b)
{
	ll res=1;
	while(b!=0)
	{
		if(b&1)
		{
			res=(res*a)%mod;
		}
		a=(a*a)%mod;
		b/=2;
	}
	return res;
}
void solve()
{
    ll n,x,t;
    
    cin>>n>>x>>t;
    
    ll ans=(n+x-1)/x;
    
    ans*=t;
    
    cout<<ans<<endl;
}
int32_t main()
{    ios_base::sync_with_stdio(false);
     cin.tie(NULL);
     cout.tie(NULL);
     
//Start from Here.

  ll t;
  t=1;
  //cin>>t;
  while(t--)
  solve();
  
//Good Bye!
    return 0;
}

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

int main(void) {
	int  N,i,cnt;

	scanf("%d",&N);
	if(N==2) {printf("%d",N);return 0;}
	if(!(N%2)) N++;
	while(1) {
	  cnt=sqrt(N);
	  for(i=3;i<cnt;i+=2)
		  if(!(N%i)) break;
	  if(i>=cnt) break;
	  N+=2;
	}

    printf("%d",N);
    return 0;
}


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

int main(){
    long long h;
    cin >> h;
    long long ans = 0;
    long long d=0;
    while(h>0){
        h /= 2;
        ans += pow(2,d);
        d++;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 512
# include <bits/stdc++.h>
# define rep(i, n) for(int i=0, i##_len=(n); i<i##_len; ++i)
# define reps(i, n) for(int i=1, i##_len=(n); i<=i##_len; ++i)
# define rrep(i, n) for(int i=((int)(n)-1); i>=0; --i)
# define rreps(i, n) for(int i=((int)(n)); i>0; --i)
# define ALL(x) (x).begin(), (x).end()
# define RALL(x) (x).rbegin(), (x).rend()
# define SZ(x) ((int)(x).size())
# define pb push_back
# define optimize_cin() cin.tie(0); ios::sync_with_stdio(false)
# define debug(x) std::cerr<<#x<<": "<<(x)<<endl;
using namespace std;
using lint = long long;
template<class T> using grid = vector<vector<T>>;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
static const lint MOD = (lint)1e9+7;

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

    vector<int> A(N);
    rep (i, N) { cin >> A[i]; }

    sort(RALL(A));

    priority_queue<int> que;
    rep (i, N)
    {
        que.push(A[i]);
    }

    for (int i = 0; i < M; ++i)
    {
        lint a = que.top(); que.pop();
        a /= 2;
        que.push(a);
    }

    lint sum = 0;
    while (!que.empty())
    {
        sum += que.top(); que.pop();
    }

    cout << sum << endl;

    return 0;
}


Measured memory_bytes: 1276
#include <cstdio>
#include <functional>
#include <algorithm>
#include <vector>
#include <limits>
#include <numeric>
#include <type_traits>
#include <iostream>
#include <queue>
#include <bits/stdc++.h>
#define INF (1ll<<60)
#define MOD 1000000007
#define BOUND 27182818284

typedef long long ll;
typedef long long int lli;

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

template<class T>bool umax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool umin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

using namespace std;

// gcd
int gcd(int a, int b){
    if(a==0)
        return b;
    return gcd(b%a,a);
}
// gcd array
int findGCD(int arr[], int n){
    int result = arr[0];
    for (int i=1; i < n; i++)
        result = gcd(arr[i], result);

    return result;
}

// sort big to small
// sort(A,A+N, greater<int>());

// v.front() = -BOUND;
// v.back() = BOUND;

// Iterator
// v.begin
// v.end

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

    int answer = 999;
    rep(i,S.length()-2){
        answer = min(abs(100*(S[i]-'0') + 10*(S[i+1]-'0') + S[i+2]-'0'-753),answer);
    }

    cout << answer <<endl;
    return 0;
}



Measured memory_bytes: 256
//mangesh2102000

#include <bits/stdc++.h>
using namespace std;

#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define int long long int 
#define ld long double
#define pb push_back
#define tr(c,it) for(auto it = (c).begin(); it != (c).end(); ++it)
#define F first
#define S second
#define mod 1000000000

int m,n;
string s,ts;
int dp[3005][3005];

int solve1(int i,int j)
{
	if(dp[i][j]!=-1)
		return dp[i][j];

	if(i==0 || j==0)
		return dp[i][j]=0;

	if(s[i-1]==ts[j-1])
	{
		return dp[i][j]=1+solve1(i-1,j-1);
	}
	else
	{
		return dp[i][j]=max(solve1(i-1,j),solve1(i,j-1));
	}
}

void solve(int t)
{
	cin >> s >> ts;
	m = s.length(), n = ts.length();

	for(int i=0;i<=m;i++)
	{
		for(int j=0;j<=n;j++)
		{
			dp[i][j]=-1;
		}
	}

	int itr=solve1(m,n);

	// for(int i=0;i<=m;i++)
	// {
	// 	for(int j=0;j<=n;j++)
	// 	{
	// 		cout << dp[i][j] << " "; 
	// 	}
	// 	cout << endl;
	// }

	if(itr==0)
	{
		cout << "";
		return;
	}

	vector <char> ans;

	int i=m,j=n;

	for(;i>0 and j>0;)
	{
		if(s[i-1]==ts[j-1])
		{
			ans.pb(s[i-1]);
			i--;
			j--;
		}
		else
		{
			if(dp[i-1][j] >= dp[i][j-1])
			{
				i--;
			}
			else
			{
				j--;
			}
		}
	}

	if(i==0 and dp[i][j]==1)
	{
		ans.pb(s[i]);
	}

	if(j==0 and dp[i][j]==1)
	{
		ans.pb(ts[i]);
	}

	int x=ans.size();
	for(int i=x-1;i>=0;i--)
	{
		cout << ans[i];
	}

    //cout << "Case #" << t << ": " << ;
}   


int32_t main()
{
    IOS;
    int t;
    t=1;
    for(int i=1;i<=t;i++)
    {
        solve(i);
    }

    return 0;
}

Measured memory_bytes: 71040
#include <bits/stdc++.h>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

using namespace std;

typedef long long int lli;

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

#ifdef LOCAL
	#define eprintf(...) printf(__VA_ARGS__)
#else 
	#define eprintf(...) 1
#endif

#define ROUNDUP(a, b) 		( ((a) + ((b) - 1) ) / b)
#define SET_ZERO(a)	 		( memset((a), 0, sizeof(a)))
#define SET_NUM_ARRAY(a,b)	( memset((a), b, sizeof(a)))

int main() {
	int N, K;
	scanf("%d %d", &N, &K);
	int a[5009];
	for (int i = 0; i < N; i++) {
		scanf("%d", &a[i]);
	}
	sort(a, a+N, greater<int>() );
	lli sum = 0;
	int ans = N;
	for (int i = 0; i < N; i++) {
		if (a[i] + sum < K) sum += a[i];
		else ans = N - i - 1;
	}

	printf("%d\n", ans);
	return 0;
}



Measured memory_bytes: 256
#include<iostream>
#include<map>
#include<algorithm>
#include<cstdint>
#include<cstdlib>
template<typename T>
void fin(T const& t){ std::cout << t << std::endl; exit(0); }

void make_map(std::map<std::string, int64_t>& m, char const* str, int N) {
  for(int s = 0; s < (1<<N); ++s) {
    std::string S, T;
    for(int i = 0; i < N; ++i) {
      if((1<<i)&s) S += str[i];
      else         T += str[i];
    }
    ++m[S+' '+T];
  }
}

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

  int N; std::string S; std::cin >> N >> S;
  char buf[18];
  for(int i = 0; i < N; ++i) buf[i] = S[N+N-1-i];
  std::map<std::string, int64_t> m1, m2;
  make_map(m1, S.c_str(), N);
  make_map(m2, buf, N);
  int64_t ans = 0;
  for(auto const& p: m1) if(m2.count(p.first) > 0) {
    ans += p.second * m2[p.first];
  }
  fin(ans);
  return 0;
}


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

#define DIV  1000000007

long long N, K;
long long A[2005];
long long x[2005];
long long y[2005];

int main(){
	cin >> N >> K;
	for (long long i = 0; i < N; i++) {
		cin >> A[i];
	}

	for (long long i = 0; i < N; i++) {
		for (long long j = i+1; j < N; j++) {
			if(A[i] > A[j]){
				x[i]++;
			}
		}

		for (long long j = 0; j < N; j++) {
			if(A[i] > A[j]){
				y[i]++;
			}
		}
	}

	long long ans = 0;
	for(long long i = 0; i < N; i++){
		ans += (x[i] * K)%DIV + y[i] * (((K * (K-1))/2) % DIV);
		ans %= DIV;
	}
	cout << ans << endl;
}


Measured memory_bytes: 256
// aw man does this mean we missed a code on where babies come from??  aw geez, NOT AGAIN
#include <iostream>
#include <vector>
#include <cmath>
#include <algorithm>
#include <string>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cstring>
#include <cassert>
using namespace std;
#define rep(i,a,n) for (int i=a;i<(int)(n);i++)
#define per(i,a,n) for (int i=(n)-1;i>=(int)(a);i--)
template<typename T> ostream& operator<<(ostream& s, vector<T> t) {rep(i, 0, t.size()) s << (i ? " " : "") << t[i]; return s;}
template<typename T> istream& operator>>(istream& s, vector<T> &t) {rep(i, 0, t.size()) s >> t[i]; return s;}
template<typename T, typename U> ostream& operator<<(ostream& s, pair<T, U> t) {s << "(" << t.first << "," << t.second << ")"; return s;}
template<typename T, typename U> istream& operator>>(istream& s, pair<T, U> &t) {s >> t.first >> t.second; return s;}
typedef long long ll;
const int N = 50;

int dp[N * 2][N * 2];

bool solve(int a, int b) {
    if (dp[a][b] != -1) return dp[a][b];
    bool res = false;
    rep(i, 1, a / 2) {
        res = max(res, !solve(a - i * 2, b + i));
    }
    rep(i, 1, b / 2) {
        res = max(res, !solve(a + i, b - i * 2));
    }
    dp[a][b] = res;
    return dp[a][b];
}

bool solveFast(ll a, ll b) {
    if (llabs(a - b) <= 1) return false;
    if (a <= 3 && b <= 3) return false;
    return true;
}

int main() {
    ios_base::sync_with_stdio(false);
    //memset(dp, -1, sizeof(dp));
    //rep(i, 0, N) rep(j, 0, N) solve(i, j);
    ll a, b;
    cin >> a >> b;
    cout << (solveFast(a, b) ? "Alice" : "Brown") << endl;;
    /*cout << dp[a][b] << endl;
    rep(i, 0, N) {rep(j, 0, N)cout << dp[i][j] << " "; cout << endl;}
    rep(i, 0, N) {rep(j, 0, N) assert(dp[i][j] == solveFast(i, j));}*/
    
}


Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
class Program
{
    static void Main(string[] args)
    {
            // 入力
            string[] sS = Console.ReadLine().Trim().Split(' ');
            int iN = int.Parse(sS[0]);
            List<int> lstS = new List<int>();                                   // 該当Xの個数一覧
            for (int i = 0; i <= iN; i++) { lstS.Add(0); }                      // 前もって箱準備   X 0始まり
            int iDelCnt = 0;                                                    // 削除回数
            sS = Console.ReadLine().Trim().Split(' ');
            for (int i = 0; i < sS.Length; i++)
            {
                int iTmp = int.Parse(sS[i]);
                if (iTmp <= iN) { lstS[iTmp] += 1; }                            // iNより大きいと意味ない
                else { iDelCnt += 1; }                                          // 削除回数加算
            }

            System.Diagnostics.Stopwatch sw = new System.Diagnostics.Stopwatch();
            sw.Start();

            // 解析
            for (int i = 1; i < lstS.Count; i++)
            {
                if (lstS[i] != 0)
                {
                    if (lstS[i] == i) { }                                       // X がi個あればOK
                    else if (lstS[i] > i) { iDelCnt += lstS[i] - i; }           // X がiより多ければiになるまで削除
                    else { iDelCnt += lstS[i]; }                                // X がiより少なければ全部削除
                }
            }

            // 出力
            Console.WriteLine("{0}", iDelCnt.ToString().Trim());

            sw.Stop();
#if DEBUG
            Console.WriteLine();
            Console.WriteLine("{0}", sw.Elapsed.ToString());
            Console.WriteLine("続行するには何かキーを押してください．．．");
            Console.ReadKey();
#endif
    }
}


Measured memory_bytes: 27740
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
struct Data{int num,io;};
bool operator<(Data a,Data b){return a.num!=b.num?a.num<b.num:a.io>b.io;};
enum{IN=1,OUT=-1};

int main()
{
  int N,a,b;
  cin>>N;
  vector<Data>list;
  for(int i=0;i<N;i++){
    cin>>a>>b;
    Data d1={a,IN};
    list.push_back(d1);
    Data d2={b,OUT};
    list.push_back(d2);
  }
  sort(list.begin(),list.end());
  int sum=1,ans=0,prev=0;
  for(int i=0;i<N*2;i++){
    if(sum>=list[i].num)ans=list[i].num-1;
    else if(sum>=prev)ans=max(ans,sum-1);
    sum+=list[i].io;
    prev=list[i].num;
  }
  cout<<ans<<endl;
}

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

int main(){
	int n, b, f, r, v;
	int i, j, k;
	int count[4][3][10] = {0};
 	
	cin >> n;
 	
 	for(i = 0; i < n; i++){
		cin >> b >> f >> r >> v;
		count[b -1][f - 1][r - 1] += v;
  	}
  	
	for(i = 0; i < 4; i++){
		for(j = 0; j < 3; j++){
    		for(k = 0; k < 10; k++){
     			cout << " " << count[i][j][k];
    		}
    		cout << endl;
   		}
   		if(i < 3){
    		cout << "####################" << endl;
   		}
  	}
	
  	return 0;
}

Measured memory_bytes: 3076
#include<bits/stdc++.h>
#define M1 1000000007
#define M2 998244353
#define ll long long int
#define N (int)1e5+3
#define test(t) while(t--)
#define PI acos(-1.0)
#define pll pair<ll,ll>
#define pii pair<int,int>
#define mii map<int,int>
#define rep(i,a,b) for(ll i=a;i<b;i++)
#define repp(i,b,a) for(ll i=b-1;i>=a;i--)
#define clr(ar, val) memset(ar, val, sizeof(ar))
#define F first
#define S second
#define PB push_back
#define mp make_pair
#define lb lower_bound
#define ub upper_bound
#define V(a) vector<a>
#define M(a,b) map<a,b>
#define endl '\n'
#define all(x) begin(x),end(x)
#define allr(x) rbegin(x),rend(x)
#define pr(a) cout<<a<<endl;
#define pr2(a,b) cout<<a<<" "<<b<<"\n"
const int inf = 0x3f3f3f3f;
const ll INF = 0x3f3f3f3f3f3f3f3f;
const int dx[4] = { 0, -1, 0, 1 };
const int dy[4] = { -1, 0, 1, 0 };
using namespace std;

ll CalculateMex(set<ll> Set){
    ll Mex = 0;
    while(Set.find(Mex)!=Set.end()){
        Mex++;
    }
    return Mex;
}

inline void INP()
{
	#ifndef ONLINE_JUDGE
	    freopen("input.txt","r",stdin);   
	    freopen("output.txt","w",stdout);
	#endif 
}

void solve()
{
    
    ll n,k;
    cin>>n>>k;
    double a[n];
    double b[n];
    double c = 2;
    rep(i,0,n) cin >> a[i];
    rep(i,0,n){
        b[i] = (a[i]+1)/c;
    }
    double msum = 0,tsum=0;
    ll lpt = -1,rpt = -1;
    rep(i,0,k) tsum += b[i];
    msum  = max(msum,tsum);
    rep(i,k,n){
        msum = max(msum,tsum);
        tsum -= b[i-k];
        tsum += b[i];
        msum = max(msum,tsum);
    }
    cout << fixed << setprecision(12) << msum << endl;


}

int32_t main(){
    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    int t=1;
    // cin>>t;
    test(t){
        solve();
    }
    return 0;
}

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

int main() {
int a,b,c,d,e,W,S,answer;
cin>>a>>b>>c>>d>>e;
W=60*a+b;
S=60*c+d;
answer=S-W-e;
  cout  <<  answer  <<  endl;
}


Measured memory_bytes: 3636
#include<stdio.h>
#include<math.h>
#include<algorithm>
#include<queue>
#include<deque>
#include<string>
#include<string.h>
#include<vector>
#include<set>
#include<map>
#include<bitset>
#include<stdlib.h>
#include<cassert>
#include<time.h>
using namespace std;
const long long mod=1000000007;
const long long inf=mod*mod;
const long long d2=500000004;
const double EPS=1e-6;
const double PI=acos(-1.0);
int ABS(int a){return max(a,-a);}
long long ABS(long long a){return max(a,-a);}
int x[110];
int y[110];
int zx[110];
int zy[110];
int main(){
	int a,b;
	scanf("%d%d",&a,&b);
	for(int i=0;i<a;i++){
		scanf("%d%d",x+i,y+i);
		zx[i]=x[i];
		zy[i]=y[i];
	}
	std::sort(zx,zx+a);
	std::sort(zy,zy+a);
	long long ans=inf*4;
	for(int i=0;i<a;i++){
		for(int j=i+1;j<a;j++){
			for(int k=0;k<a;k++){
				for(int l=k+1;l<a;l++){
					int tmp=0;
					for(int m=0;m<a;m++){
						if(zx[i]<=x[m]&&x[m]<=zx[j]&&zy[k]<=y[m]&&y[m]<=zy[l])tmp++;
					}
					if(tmp>=b)ans=min(ans,(long long)(zx[j]-zx[i])*(zy[l]-zy[k]));
				}
			}
		}
	}
	printf("%lld\n",ans);
}

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

int main(){
    ll x;   cin >> x;
    ll ans = x/11*2;
    if(0<x%11 && x%11<=5) ans += 1;
    if(0<x%11 && x%11==6) ans += 1;
    if(0<x%11 && 7<=x%11) ans += 2;
    cout << ans << endl;
}







Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
using namespace std;
int main(){
    int n;cin>>n;
    int a[n];for(int i = 0; n > i; i++)cin>>a[i];
    int m;cin>>m;
    int b[m];for(int i = 0; m > i; i++)cin>>b[i];
    cout << (lexicographical_compare(a,a+n,b,b+m) ? 1 : 0) << endl;
    
}


Measured memory_bytes: 3092
def modpow(a, n, mod):
  res = 1
  while (n > 0):
    if (n & 1):
      res = res * a % mod 
    a = a * a % mod 
    n >>= 1

  return res

n = int(input())
d = list(map(int, input().split()))
D = {i:[] for i in range(max(d)+1)}
if sum(d) == 0 and n != 1:
  print(0)
  exit()
for i in range(n):
  if i == 0 and d[i] != 0:
    print(0)
    exit()
  if i != 0 and d[i] == 0:
    print(0)
    exit()
  D[d[i]] += [i]
ans = 1

for i in range(max(d)):
  a = modpow(len(D[i]), len(D[i+1]), 998244353)
  ans = ans * a % 998244353

print(ans % 998244353)




Measured memory_bytes: 30448
import sys
import math
from decimal import Decimal, ROUND_HALF_UP, ROUND_HALF_EVEN
def I(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def LI(): return list(map(int, sys.stdin.readline().split()))
def LI2(N): return [list(map(int, sys.stdin.readline().split())) for i in range(N)]
def S(): return sys.stdin.readline()
def LS(): return sys.stdin.readline().split()
def LS2(N): return [sys.stdin.readline().split() for i in range(N)]
def FILL(i,h,w): return [[i for j in range(w)] for k in range(h)]
def sisha(num,digit): return Decimal(str(num)).quantize(Decimal(digit),rounding=ROUND_HALF_UP)
#'0.01'や'1E1'などで指定、整数に戻すならintをかます
MOD = 1000000007
INF = float("inf")
sys.setrecursionlimit(10**5+10)
input = sys.stdin.readline

a,b = MI()
print(int((a+b+1)/2))


Measured memory_bytes: 5028
#include <iostream>

using namespace std;

const int LIKE = 753;

int count_digits(unsigned long long n){
	int i = 0;
	for(;n > 0; n=n/10){
		i++;
	}
	return i;
}

unsigned long long pow(unsigned int n, const unsigned int x = 10){
	unsigned long long ret = 1;
	for(int i = 0; i < n; i++) {
		ret *= x;
	}
	return ret;
}

unsigned int make_number(unsigned int a, unsigned int b, unsigned int c) {
	return 100 * a + 10 * b + c;
}

unsigned int abs_val(int num) {
	return num > 0 ? num : 0 - num;
}


int main(int argc, char const *argv[]) {
	unsigned long long s;
	unsigned int first, second, third, tmp, min, num_digit;

	cin >> s;
	num_digit = count_digits(s);

	first = (unsigned int)(s / pow(num_digit-1));
	s = s - first * pow(num_digit-1);
	num_digit--;

	second = (unsigned int)(s / pow(num_digit-1));
	s = s - second * pow(num_digit-1);
	num_digit--;

	third = (unsigned int)(s / pow(num_digit-1));
	s = s - third * pow(num_digit-1);
	num_digit--;

	min = abs_val(make_number(first, second, third) - LIKE);

	while(num_digit > 0) {
		first = second;
		second = third;
		third = s / pow(num_digit-1);
		s = s - third * pow(num_digit-1);
		num_digit--;

		tmp = abs_val(make_number(first, second, third) - LIKE);
		// cout << make_number(first, second, third) << " - 753 = " << tmp << endl;
		min = min > tmp ? tmp : min;
	}

	cout << min;

	return 0;
}

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

int n,m;

int main()
{
	cin>>n>>m;
	if(n>=2&&m<2){
		int z=(n*(n-1))/2;
		cout<<z;
	}
	else if(n>=2&&m>=2){
		int x=(m*(m-1))/2;
	    int z=(n*(n-1))/2;
	    cout<<(x+z);
	}
	else if(n<2&&m>=2){
		int y=(m*(m-1))/2;
		cout<<y;
	}
	else cout<<0<<endl;

	return 0;
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ClassLibrary1
{
    public class ListNode
    {
        public int val;
        public ListNode next;
        public ListNode(int x) { val = x; }
    }


    public class Class1
    {
        static List<string> cons = new List<string>();
        static void Main(string[] args)
        {
            int n = int.Parse(Console.ReadLine());

            string[] str = Console.ReadLine().Split(' ');
            int[] arr = new int[n];

            int[] arr2 = new int[n];

            for (int i = 0; i < n; i++)
            {
                arr[i] = int.Parse(str[i]);
            }

            arr2[0] = arr[0];

            int reversed1 = -1;
            int reversed2 = -1;
            for (int i = 1; i < n; i++)
            {
                arr2[i] = arr[i];
                if (arr[i - 1] > arr[i])
                {
                    if (reversed1 == -1)
                    {
                        reversed1 = i - 1;
                    }
                    else if (reversed2 == -1)
                    {
                        reversed2 = i;
                    }
                    else
                    {
                        Console.WriteLine("NO");
                        return;
                    }
                }
            }

            if (reversed1 == -1)
            {
                Console.WriteLine("YES");
                return;
            }
            else
            {
                if (reversed2 == -1)
                {
                    reversed2 = reversed1+1;
                }

                arr2[reversed1] = arr[reversed2];
                arr2[reversed2] = arr[reversed1];
            }

            for (int i = 1; i < n; i++)
            {
                if (arr2[i - 1] > arr2[i])
                {
                    Console.WriteLine("NO");
                    return;
                }

            }
            Console.WriteLine("YES");

        }

    }
}

Measured memory_bytes: 13140
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define fsp(x) fixed << setprecision(x)
#define xout cerr
const ll inf = LLONG_MAX;
const long double pi = acosl(-1);
const char endk = '\n';
void Yes() {cout << "Yes" << endl;}
void No() {cout << "No" << endl;}
void YES() {cout << "YES" << endl;}
void NO() {cout << "NO" << endl;}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    //const ll mod = 1e9 + 7;
    //const ll mod = 998244353;

	ll n;
	cin >> n;
	ll ans = 0;
	while (ans < n) ans += 1000;
	cout << ans - n << endl;
}

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

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

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

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

int main(){
    int n, k; cin>>n>>k;
    vector<int> t(n);
    for(int i=0; i<n; i++) cin>>t[i];

    vector<int> gap(n-1);
    for(int i=0; i<n-1; i++){
        gap[i] = t[i+1] - t[i] - 1;
    }

    sort(gap.begin(), gap.end(), greater<int>());

    ll ans=(t[n-1]+1)-t[0];
    for(int i=0; i<k-1; i++){
        ans -= gap[i];
    }

    cout << ans << endl;
}


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

using namespace std;
using llong = long long;
using ldbl = long double;
using lpair = pair<llong, llong>;

#define ALL(x) x.begin(), x.end()

template<typename T>
constexpr T inf = static_cast<T>(pow(10, static_cast<int>(log10(numeric_limits<T>::max())))) + 7;
constexpr llong mod = 1e9+7;

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

	if (a + b + c >= 22) {
		cout << "bust" << endl;
	} else {
		cout << "win" << endl;
	}

	return 0;
}

Measured memory_bytes: 764
#include<bits/stdc++.h>
using namespace std;
int main()
{
  int n,k,l[50];
  cin>>n>>k;
  for(int i=0;i<n;i++){
      cin>>l[i];
  }
  sort(l,l+n);
  int ta=0,iwa=0;
  for(int i=0;i<n;i++){
      ta += l[i];
  }
  for(int i=0;i<n-k;i++){
      iwa += l[i];
  }
  cout<<ta-iwa<<endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long long int
#define pb push_back
#define N 200100
#define MOD 1000000007
#define fn(i,n) for(int i=0;i<n;i+=1)
#define rep(i,l,r) for(int i=l;i<=r;i+=1)
#define INF 100000000000000
#define pii pair<int,int>
#define speed ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
int power(int x,int y){
    int res=1LL;
    while(y){
        if(y&1){
            res=(res*x)%MOD;
        }
        x=(x*x)%MOD;
        y=(y>>1);
    }
    return res;
}
string con(char x)
{
    string s(1,x);
    return s;
}
signed main()
{
    
    speed
    
    string s;cin>>s;
    int n=s.size();
    int q;cin>>q;
    int cur=0;
    vector <char> x1,x2;
    while(q--){
        int xd;cin>>xd;
        if(xd==1){
            cur^=1;
        }
        else{
            int f;char c;
            cin>>f;cin>>c;
            if(cur){
                f=3-f;
            }
            if(f==1){
                x1.pb(c);
            }
            else{
                x2.pb(c);
            }
        }
        
    }
    string s1="";

    fn(i,x2.size()){
        s1+=x2[i];
    }
    string s2="";
    for(int i=x1.size()-1;i>=0;i--){
        s2+=x1[i];
    }
    s=s2+s+s1;
    if(cur)reverse(s.begin(),s.end());
        cout<<s<<endl;

    
    
    
    return 0;
}

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

#define MAXV 1000000000
using ll = long long;

int arr[100010];
int main() {

	int N, M; cin >> N >> M;

	for (int i = 0; i < N; ++i) {
		cin >> arr[i];
		arr[i] %= M;
	}

	int t=0;
	map<int, int> mp;
	mp[0]++;
	for (int i = 0; i < N; ++i) {
		t += arr[i];
		t %= M;
		mp[t]++;
	}

	ll ans = 0;
	for (auto e : mp) {
		ans += (ll)e.second * (e.second - 1) / 2;
	}
	cout << ans << endl;

	int a; cin >> a;
}

Measured memory_bytes: 3584
import numpy as np
import math
import scipy as sp
import queue
import collections

MOD = 10 ** 9 + 7
INF = 10 ** 9

def main(kwargs):
    n = kwargs["n"]
    m = kwargs["m"]
    x = kwargs["x"]
    C = kwargs["C"]
    A = kwargs["A"]
    res = -1

    for i in range(2 ** n):
        l = [j for j in '{0:0{1}b}'.format(i, n)]
        scores = [0 for i in range(m)]
        price = 0

        for j in range(n):
            if l[j] == '1':
                for k in range(m):
                    scores[k] += A[j][k]

                price += C[j]

        if min(scores) >= x:
            if res == -1:
                res = price

            res = min(res, price)

    return res

if __name__ == "__main__":
    kwargs = {}

    cin = input().split()
    kwargs["n"], kwargs["m"], kwargs["x"] = [int(i) for i in cin]

    kwargs["C"] = []
    kwargs["A"] = []
    for i in range(kwargs["n"]):
        cin = input().split()
        c = [int(i) for i in cin][0]
        a = [int(i) for i in cin][1:]
        kwargs["C"].append(c)
        kwargs["A"].append(a)

    cout = main(kwargs)
    print(cout)

Measured memory_bytes: 31208
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <map>
#include <math.h>
#include <utility>
#define FOR(i,a,b) for(int i = (a); i < (b); i++)
using namespace std;

int main() {
	string str;
	bool a = 0, b = 0 , c = 0;
	cin >> str;
	for (int i = 0; i < 3; ++i) {
		if (str[i] == 'a') {
			a = 1;
		}
		if (str[i] == 'b') {
			b = 1;
		}
		if (str[i] == 'c') {
			c = 1;
		}
	}
	cout << (a && b&&c ? "Yes" : "No");
}



Measured memory_bytes: 256
/* ex4_1: Golden Apple
    Jun_JPN */

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

int main(void){

    double num, diff;

    scanf("%lf %lf", &num, &diff);

    /* 監視員は2*diff+1本の木を監視できる
        りんごの木の総数を監視可能本数で割って小数点以下を切り上げる
        天井関数ceilは引数および返り値がdouble型であることに注意 */
    printf("%d\n", (int)ceil(num / (2*diff+1)));

    return 0;
}

Measured memory_bytes: 128
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace AtCoder03
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.ReadLine();
            var a = Console.ReadLine().Split(' ').Select(int.Parse);
            var count = 0;
            while(a.All(IsEven))
            {
                count++;
                a = a.Select(x => x / 2).ToArray();
            }
            Console.Write(count);
        }
        private static bool IsEven(int a)
        {
            return a % 2 == 0;
        }
    }
}


Measured memory_bytes: 11348
#include<bits/stdc++.h>
#define ll long long
#define pii pair<int,int>
#define pb push_back
#define f first
#define s second
#define MOD 1000000007
 
using namespace std;

bool bc[100001];
int a[100001];


void solve(){
	int n; 
	cin>>n;
	string s;
	cin>>s;
	int ans=0;
	for(int i=0; i<n-2; i++){
		if(s[i] =='A' && s[i+1] == 'B' && s[i+2] == 'C'){
			ans++;
		}
	}
	cout<<ans;
}


int main()
{ 
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	//cout<<fixed<<setprecision(12);
	
	int t =1; 
	//cin>>t;

	for(int i=1; i<=t; i++){
		solve();
		cout<<"\n";
	}
	return 0;

}




Measured memory_bytes: 256