akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
long long a[100005];
int n;
long long ans,x;
int main(){
	cin>>n>>x;
	for(int i=1;i<=n;i++)cin>>a[i];
	if(a[1]>x)  ans+=a[1]-x,a[1]=x;
	for(int i=2;i<=n;i++)
    {
    	if(a[i]+a[i-1]>x)
		ans+=a[i]+a[i-1]-x,a[i]-=a[i]+a[i-1]-x;
    	
    }
    cout<<ans;
}


Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
typedef long double ld;
#define ff first
#define ss second
#define int long long 
#define endl "\n"
#define FAST ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);	

const int inf = 1e9;
const int MOD = 998244353;
const int N = 1e5+4;

int n , x;

void solve(){	
	string s;
	cin >> s;
	if(s[1]=='B')
		cout << "ARC";
	else
		cout << "ABC";
	
}

	
int32_t main(){
	FAST;
	int t=1;
	//cin>>t;
	while(t--)
		solve();
	return 0;
}	

Measured memory_bytes: 3620
// https://beta.atcoder.jp/contests/abc110

#define SUBMIT

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

const int MOD = 1000000007;
const int MAX_N = 2 * 100000 + 10;
ui64 f[MAX_N];
ui64 f_inv[MAX_N];

vector<pair<int, int>> factorize(int x) {
    vector<pair<int, int>> factors;
    for (int i = 2; i * i <= x; ++i) {
        if (x % i != 0) continue;
        int n = 0;
        while (x % i == 0) { n++; x /= i; }
        factors.emplace_back(i, n);
    }
    if (x != 1) factors.emplace_back(x, 1);
    return move(factors);
}

ui64 power(ui64 x, ui64 n, ui64 mod) {
    ui64 res = 1;
    while (n != 0) {
        if (n % 2 == 1) res = (res * x) % mod;
        x = (x * x) % mod;
        n >>= 1;
    }
    return res;
}

ui64 inverse_element(ui64 x, ui64 mod) { return power(x, mod - 2, mod); }

template <std::size_t Size>
void init_factorial(ui64 f[Size], ui64 f_inv[Size], ui64 mod) {
    f[0] = f[1] = 1;
    f_inv[0] = f_inv[1] = 1;
    for (ui64 i = 2; i < Size; ++i) f[i] = i * f[i - 1] % mod;
    for (ui64 i = 2; i < Size; ++i) f_inv[i] = inverse_element(f[i], mod) % mod;
}

// nCk
ui64 nCk(int n, int k) {
    if (n < 0 || k < 0 || n < k) return 0;
    return f[n] % MOD * f_inv[n - k] % MOD * f_inv[k] % MOD;
}


int main() {
#ifdef SUBMIT
    auto& in = cin;
#else
    stringstream in(R"(100000 1000000000
)");
#endif
    init_factorial<MAX_N>(f, f_inv, MOD);

    int N, M;
    in >> N >> M;

    auto factors = factorize(M);
    ui64 ans = 1;
    for (auto factor : factors) ans = ans * nCk(factor.second + N - 1, N - 1) % MOD;
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3328
#include<bits/stdc++.h>
#include<boost/variant.hpp>
using namespace std;
typedef long long ll;
typedef vector<boost::variant<bool, ll, int, string, double, char*, const char*>> anys;
template<typename T> inline void pr(const vector<T> &xs){
	for(int i=0; i<xs.size()-1; i++) cout<<xs[i]<<" ";
	(xs.empty()?cout:(cout<<xs[xs.size()-1]))<<endl;
}
#ifdef DEBUG
#define debug(...) pr(anys{__VA_ARGS__})
#define debugv(x) pr((x))
#else
#define debug(...)
#define debugv(x)
#endif

int main(){
	int N;
	cin >> N;
	vector<string> S(N);
	map<string, int> cnt;
	for(int i=0; i<N; i++){
		cin >> S[i];
		cnt[S[i]]++;
	}

	cout << cnt.size() << endl;

	return 0;
}


Measured memory_bytes: 25080
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;

#define ll long long
#define db long double
#define ii pair<int,int>
#define vi vector<int>
#define fi first
#define se second
#define sz(a) (int)(a).size()
#define all(a) (a).begin(),(a).end()
#define pb push_back
#define mp make_pair
#define FN(i, n) for (int i = 0; i < (int)(n); ++i)
#define FEN(i,n) for (int i = 1;i <= (int)(n); ++i)
#define rep(i,a,b) for(int i=a;i<b;i++)
#define repv(i,a,b) for(int i=b-1;i>=a;i--)
#define SET(A, val) memset(A, val, sizeof(A))
typedef tree<int ,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update>ordered_set ;
// order_of_key (val): returns the no. of values less than val
// find_by_order (k): returns the kth largest element.(0-based)
#define TRACE
#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
  cerr << name << " : " << arg1 << std::endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
  const char* comma = strchr(names + 1, ','); cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
#else
#define trace(...)
#endif
int main()
{
  std::ios::sync_with_stdio(false);
  cin.tie(NULL) ; cout.tie(NULL) ;
  string s;
  cin>>s;
  if(s[0]=='S') cout<<"Cloudy"<<endl;
  else if(s[0]=='C') cout<<"Rainy"<<endl;
  else cout<<"Sunny"<<endl;
  return 0 ;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
const int N = 1e2 + 5;
string s;
int main()
{
    s.push_back('7');
    int tmp = 0;
    int b;
    scanf("%d", &b);
    int i = (s[0] >= '0' && s[0] <= '9') ? 0 : 1;
    ll ans = 0;
    while (s.size() <= 1e6)
    {
        for (; i < s.size(); ++i)
        {
            ans = ans * 10 + (s[i] - '0'), ans %= b;
        }
        if(!ans){tmp = s.size();break;}
        else s.push_back('7');
    }
    if (!ans)
        cout << tmp << endl;
    else
        cout << -1 << endl;

    return 0;
}

Measured memory_bytes: 5360
//temprates
#include <iostream>
#include <tuple>
#include <sstream>
#include <vector>
#include <cmath>
#include <ctime>
#include <cassert>
#include <cstdio>
#include <queue>
#include <set>
#include <map>
#include <fstream>
#include <cstdlib>
#include <string>
#include <cstring>
#include <algorithm>
#include <numeric>

using ll = long long;
using namespace std;

#define FOR(i,a,b) for(int i = (int)(a); i <= (int)(b); i++)
#define LFOR(i,a,b) for(ll i = (ll)(a); i <= (ll)(b); i++)
#define FORR(i,a,b) for(int i = (int)(a); i >= (int)(b); i--)
#define LFORR(i,a,b) for(ll i = (int)(a); i >= (ll)(b); i--)
#define REP(i,n) FOR(i,0,(int)(n)-1)
#define LREP(i,n) LFOR(i,0,(ll)(n)-1)
#define REPR(i,n) FORR(i,(int)(n)-1,0)
#define LREPR(i,n) LFORR(i,(ll)(n)-1,0)

#define SIZ(v) int(v.size())
const int INF = 1e8;
const ll LINF = 1e15;
const int MOD = 1e9+7;

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  ll l,r;
  ll ans = 1000000;
  const int mod=2019;
  cin >> l >> r;
  if(r-l>=(ll)(mod)) cout << 0 << endl;
else{
  l %= mod; r %= mod;
  if(r<l) cout << 0 << endl;
else{
  FOR(i,l,r-1){
    FOR(j,l+1,r){
      ans = min(ans, (ll)((i*j)%mod));
    }
  }
  cout << ans << endl;
}}}


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

using namespace std;

typedef long long ll;

#define sz(x) ((int)(x).size())
#define in(x) int x;cin>>x
#define bit(n) (1<<(n))

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

int main(){
	char w[101];
    bool ans = true;

    scanf("%s", w);

    repp(i, 100){
        if(w[i] == '\0')    break;
        int cnt = 0;
        repp(j, 100){
            if(w[j] == '\0')    break;
            if(w[i] == w[j]) cnt++;
        }
        if(cnt % 2) ans = false;
    }

    if(ans){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }

	return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define ll long long
#define rep(i,l,r)for(ll i=(l);i<(r);i++)
#define max(p,q)((p)>(q)?(p):(q))
#define min(p,q)((p)<(q)?(p):(q))

char s[99];
int main(){
	printf("ABC%s",gets(s));
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
 
int main() {
    int N,org;
    cin >> N;
    
    org = N;
    int x = 0;
    while (N > 0) {
        x += N % 10;
        N = (N-(N % 10))/10;
    }
    
    if (org % x == 0) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
}

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

using namespace std;

int main()
{
    #ifdef LOCAL_EXEC
    #else
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    #endif // LOCAL_EXEC
//    cout << "Hello world!" << endl;
    long long int l,r,d,i,result=0,n;
    cin>>n;
    long long int A[n+1];
    for(i=1;i<=n;i++){
        cin>>A[i];
        if(i%2==1&&A[i]%2==1)
            result+=1;
    }
    cout<<result;
    return 0;
}


Measured memory_bytes: 3636
#include<stdio.h>
#include<iostream>
#include<cmath>
#include<algorithm>
#include<cstring>
using namespace std;
char A[101],B[101],C[101];
int main()
{
    int a,b,c,la,lb,lc;
    while(cin>>A>>B>>C)
    {
        la=lb=lc=0;
        int num=1;
        while(A[la++]);
        la--;
        while(B[lb++]);
        lb--;
        while(C[lc++]);
        lc--;
        a=b=c=-1;
        while(1)
        {
            if(a==la)
            {
                cout<<"A"<<endl;
                break;
            }
            else if(b==lb)
            {
                cout<<"B"<<endl;
                break;
            }
            else if(c==lc)
            {
                cout<<"C"<<endl;
                break;
            }
            if(num==1)
            {
                a++;
                num=A[a]-'a'+1;
            }
            else if(num==2)
            {
                b++;
                num=B[b]-'a'+1;
            }
            else if(num==3)
            {
                c++;
                num=C[c]-'a'+1;
            }
        }
    }
    return 0;
}

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

int main() {
    while (true) {
        int n, m;
        scanf("%d %d", &n, &m);
        if (n == 0 && m == 0) break;
        vector<int> N(1500001);
        vector<int> M(1500001);
        vector<int> h(n);
        vector<int> w(m);
        for (int i = 0; i < n; ++i) {
            scanf("%d", &h[i]);
        }

        for (int i = 0; i < m; ++i) {
            scanf("%d", &w[i]);
        }
        for (int i = 0; i < n; ++i) {
            int s = 0;
            for (int j = i; j < n; ++j) {
                s += h[j];
                N[s]++;
            }
        }
        for (int i = 0; i < m; ++i) {
            int s = 0;
            for (int j = i; j < m; ++j) {
                s += w[j];
                M[s]++;
            }
        }
        int c = 0;
        for (int i = 0; i < 1500001; ++i) {
            c += N[i]*M[i];
        }
        cout << c << endl;
    }
}

Measured memory_bytes: 14700
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<int, ll> pil;
typedef pair<int, ll> pli;
typedef pair<double,double> pdd;
#define SQ(i) ((i)*(i))
#define MEM(a, b) memset(a, (b), sizeof(a))
#define SZ(i) int(i.size())
#define FOR(i, j, k, in) for (int i=j ; i<k ; i+=in)
#define RFOR(i, j, k, in) for (int i=j ; i>=k ; i-=in)
#define REP(i, j) FOR(i, 0, j, 1)
#define REP1(i,j) FOR(i, 1, j+1, 1)
#define RREP(i, j) RFOR(i, j, 0, 1)
#define ALL(_a) _a.begin(),_a.end()
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define X first
#define Y second
#ifdef tmd
#define TIME(i) Timer i(#i)
#define debug(...) do{\
    fprintf(stderr,"%s - %d (%s) = ",__PRETTY_FUNCTION__,__LINE__,#__VA_ARGS__);\
    _do(__VA_ARGS__);\
}while(0)
template<typename T>void _do(T &&_x){cerr<<_x<<endl;}
template<typename T,typename ...S> void _do(T &&_x,S &&..._t){cerr<<_x<<" ,";_do(_t...);}
template<typename _a,typename _b> ostream& operator << (ostream &_s,const pair<_a,_b> &_p){return _s<<"("<<_p.X<<","<<_p.Y<<")";}
template<typename It> ostream& _OUTC(ostream &_s,It _ita,It _itb)
{
    _s<<"{";
    for(It _it=_ita;_it!=_itb;_it++)
    {
        _s<<(_it==_ita?"":",")<<*_it;
    }
    _s<<"}";
    return _s;
}
template<typename _a> ostream &operator << (ostream &_s,vector<_a> &_c){return _OUTC(_s,ALL(_c));}
template<typename _a> ostream &operator << (ostream &_s,set<_a> &_c){return _OUTC(_s,ALL(_c));}
template<typename _a> ostream &operator << (ostream &_s,deque<_a> &_c){return _OUTC(_s,ALL(_c));}
template<typename _a,typename _b> ostream &operator << (ostream &_s,map<_a,_b> &_c){return _OUTC(_s,ALL(_c));}
template<typename _t> void pary(_t _a,_t _b){_OUTC(cerr,_a,_b);cerr<<endl;}
#define IOS()
class Timer {
private:
    string scope_name;
    chrono::high_resolution_clock::time_point start_time;
public:
    Timer (string name) : scope_name(name) {
        start_time = chrono::high_resolution_clock::now();
    }
    ~Timer () {
        auto stop_time = chrono::high_resolution_clock::now();
        auto length = chrono::duration_cast<chrono::microseconds>(stop_time - start_time).count();
        double mlength = double(length) * 0.001;
        debug(scope_name, mlength);
    }
};
#else
#define TIME(i)
#define debug(...)
#define pary(...)
#define endl '\n'
#define IOS() ios_base::sync_with_stdio(0);cin.tie(0)
#endif

const ll MOD = 1000000007;
const ll INF = 0x3f3f3f3f3f3f3f3f;
const int iNF = 0x3f3f3f3f;
// const ll MAXN = 

int n, k;
/********** Good Luck :) **********/
int main () {
    TIME(main);
    IOS();

    cin >> n >> k;
    int sum = 0, ans = 0;
    while (true) {
        int cur = max(1, (sum+k-1)/k);
        debug(cur);
        if (n < cur) {
            break;
        } else {
            n -= cur;
            sum += cur;
            ans++;
        }
    }

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



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

using namespace std;

#define REP(i,n) for(ll (i) = (0);(i) < (n);++i)
#define REV(i,n) for(ll (i) = (n) - 1;(i) >= 0;--i)
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define FI first
#define SE second
#define SHOW1d(v,n) {REP(WW,n)cerr << v[WW] << ' ';cerr << endl << endl;}
#define SHOW2d(v,WW,HH) {REP(W_,WW){REP(H_,HH)cerr << v[W_][H_] << ' ';cerr << endl;}cerr << endl;}
#define ALL(v) v.begin(),v.end()
#define Decimal fixed<<setprecision(20)
#define INF 1000000000
#define LLINF 1000000000000000000LL
#define MOD 998244353

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

int main(){
	cin.tie(0);cout.tie(0);ios::sync_with_stdio(false);
	
	int a = 0, b = 0;
	string str;cin >> str;
	
	REP(i, str.size()){
		if(i % 2) {
			if(str[i] == '1')a++;
			else b++;
		}
		else {
			if(str[i] == '1')b++;
			else a++;
		}
	}
	
	cout << min(a, b) << endl;
	
	
	return 0;
}


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

using namespace std ;

int main(){
	int n , l ; 
	cin >> n >> l ; 
	int sum = 0 ; 
	for(int i = 0 ; i < n ; i++) sum += l + i ;
	int ans = -1e9 , best = 1e9;  
	for(int i = 0 ; i < n ; i++ ){
		if( abs (l+i) < best ){
			ans = sum - l - i ; 
			best = abs (l+i) ; 
		}
	// 	ans = max ( ans , sum - l - i ) ; 
	}
	cout << ans << endl; 
}


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

typedef unsigned long long ull;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<double, double> pdd;
const ull mod = 1e9 + 7;
#define REP(i,n) for(int i=0;i<(int)n;++i)

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

template < typename T >
void vprint(T &v){
	REP(i, v.size()){
		cout << v[i] << " ";
	}
	cout << endl;
}

ll N, M;
vector<ll> G[101010];
ll dp[101010];

ll rec(ll v){
	if(dp[v]>=0) return dp[v];
	ll res = 0;
	REP(i, G[v].size()){
		res = max(res, rec(G[v][i])+1);
	}
	dp[v] = res;
	return res;
}

int main(){
	cin >> N >> M;
	REP(i, M){
		ll x, y;
		cin >> x >> y;
		x--;y--;
		G[x].push_back(y);
	}
	REP(i, 101010) dp[i] = -1;
	ll res = -1;
	REP(i, N) res = max(res, rec(i));
	cout << res << endl;
    return 0;
}

Measured memory_bytes: 9216
import java.util.ArrayList;
import java.util.Scanner;

public class Main {
    public static void main(String args[]) {
        Scanner sc = new Scanner(System.in);
        ArrayList<Integer> numList = new ArrayList<Integer>();
        while(sc.hasNext()){
            int n = sc.nextInt();
            int x = sc.nextInt();
            if(n == 0 && x == 0){
                break;
            }else{
                numList.add(n);
                numList.add(x);
            }
        }
        for(int i = 0; i < numList.size() / 2; i++){
            int ans = 0;
            int n = numList.get(i * 2);
            int x = numList.get(i * 2 + 1);
            for(int j = 1; j <= n - 2; j++){
                for(int k = j + 1; k <= n - 1; k++){
                    for(int l = k + 1; l <= n; l++){
                        if(j + k + l == x){
                            ans++;
                        }
                    }
                }
            }
            System.out.println(ans);
        }
    }
}


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

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

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

	int tax, train;
	tax = b;
	train = a * n;

	cout << min(tax, train) << endl;


    return 0;
}



Measured memory_bytes: 256
// エラトステネスの篩, フェルマーの小定理
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

const (
	m = 1000000007
)

func mpow(x, y int) int {
	result := 1
	for y != 0 {
		if y&1 == 1 {
			result *= x
			result %= m
		}
		x *= x
		x %= m
		y >>= 1
	}
	return result
}

func makePrimeTable(n int) []int {
	sieve := make([]int, n+1)
	sieve[0] = -1
	sieve[1] = -1
	for i := 2; i <= n; i += 2 {
		sieve[i] = 2
	}
	for i := 3; i <= n; i += 2 {
		if sieve[i] != 0 {
			continue
		}
		sieve[i] = i
		for j := i * i; j <= n; j += i * 2 {
			if sieve[j] == 0 {
				sieve[j] = i
			}
		}
	}
	return sieve
}

func main() {
	maxA := 1000000

	N := readInt()
	A := make([]int, N)
	for i := 0; i < N; i++ {
		A[i] = readInt()
	}

	primeTable := makePrimeTable(maxA)

	lcmFactors := map[int]int{}
	for i := 0; i < N; i++ {
		t := map[int]int{}
		a := A[i]
		for a != 1 {
			t[primeTable[a]]++
			a /= primeTable[a]
		}
		for k, v := range t {
			if lcmFactors[k] < v {
				lcmFactors[k] = v
			}
		}
	}

	lcm := 1
	for k, v := range lcmFactors {
		for i := 0; i < v; i++ {
			lcm *= k
			lcm %= m
		}
	}

	result := 0
	for i := 0; i < N; i++ {
		result += lcm * mpow(A[i], m-2)
		result %= m
	}
	fmt.Println(result)
}

const (
	ioBufferSize = 1 * 1024 * 1024 // 1 MB
)

var stdinScanner = func() *bufio.Scanner {
	result := bufio.NewScanner(os.Stdin)
	result.Buffer(make([]byte, ioBufferSize), ioBufferSize)
	result.Split(bufio.ScanWords)
	return result
}()

func readString() string {
	stdinScanner.Scan()
	return stdinScanner.Text()
}

func readInt() int {
	result, err := strconv.Atoi(readString())
	if err != nil {
		panic(err)
	}
	return result
}


Measured memory_bytes: 11568
#include<stdio.h>
#include<math.h>
#include<iostream>
#include<string>
#include<vector>
using namespace std;
int main() {
	int a;
	cin >> a;
	if (a == 0) {
		cout << 1 << endl;
	}
	else {
		cout << 0<< endl;
	}
}

Measured memory_bytes: 3064
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <string>
#include <iomanip>
#include <map>
#include <set>
#include <cmath>
#include <cstdio>
#include <cstdint>
using namespace std;
#define rep(i, n) for(int(i) = 0; (i) < (n); (i)++)
#define FOR(i, m, n) for(int(i) = (m); (i) < (n); (i)++)
#define All(v) (v).begin(), (v).end()
#define pb push_back
#define MP(a, b) make_pair((a), (b))
using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
const int INF = 1 << 30;
const ll LINF = 1LL << 60;
const int MOD = 1e9 + 7;

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

ll lcm(ll a, ll b) { return a * b / gcd(a, b); }

int main() {
    int N, M;
    cin >> N >> M;
    string S, T;
    cin >> S >> T;
    ll P = lcm(N, M);
    if(N < M) {
        swap(N, M);
        swap(S, T);
    }
    ll a = P / N, b = P / M;
    for(int i = 0; i < M; i++) {
        if((b * i) % a == 0) {
            if(S[(b * i) / a] != T[i]) {
                cout << "-1" << endl;
                return 0;
            }
        }
    }
    cout << P << endl;
    return 0;
}

Measured memory_bytes: 512
#include<bits/stdc++.h>
#define INF 1e9
#define llINF 1e18
#define MOD 1000000007
#define pb push_back
#define mp make_pair 
#define F first
#define S second
#define ll long long
#define ull unsigned long long
#define vi vector<ll>
#define vvi vector<vi>
#define BITLE(n) (1LL<<((ll)n))
#define BITCNT(n) (__builtin_popcountll(n))
#define SUBS(s,f,t) ((s).substr((f)-1,(t)-(f)+1))
#define ALL(a) (a).begin(),(a).end()
using namespace std;
ll n,m,v,p;

vi A;
bool check(ll mid){
  if(A[p-1] > mid)return false;
  ll num = v*m;
  num -= (p-1)*m;
  for(ll i=p-1;i<n;i++){
    num -= min(m,mid-A[i]);
  }
  return num<=0;
}
int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  cin>>n>>m>>v>>p;
  A.resize(n);
  for(auto &a:A)cin>>a;
  sort(ALL(A),greater<ll>());
  ll le = -1,ri = llINF;
  while(ri-le > 1){
    ll mid = ri+le;
    mid/=2;
    if(check(mid)){
      ri = mid;
    }else{
      le = mid;
    }
  }
  ll ans = 0;
  for(auto a:A)ans += (a+m >= ri);
  //  cout<<le<<" "<<ri<<endl;
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 1024
#include <stdio.h>
#include <iostream>
#include <algorithm>
#include <functional>
#include <cstdlib>
#include <sstream>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <complex>
#include <vector>
#include <cstdio>
#include <cmath>
#include <time.h>
#define all(c) ((c).begin(),(c).end())
#define rall(c) (c).rbegin(),(c).rend()
#define sort(v,n) sort(v,v+n)
#define vsort(v) sort(v.begin(),v.end())
#define vvsort(v) sort(v.begin(),v.end(),greater<int>())
#define ll long long
#define pb(a) push_back(a)
#define fi first
#define se second
#define inf 999999999
using namespace std;
const ll MOD = 1e9 + 7;
const double PI = acos(-1.0);
//---------------------------------------------------------------------------------------------//
int n;
string u[257];
int m;
string t[257];
int main() {
	cin >> n;
	for (int i = 0; i < n; i++)cin >> u[i];
	cin >> m;
	for (int i = 0; i < m; i++)cin >> t[i];
	bool open = 0;
	for (int i = 0; i < m; i++) {
		for (int j = 0; j < n; j++) {
			if (t[i] == u[j]) {
				if (!open) {
					cout << "Opened by ";
					cout << t[i] << endl;
					open = 1;
					break;
				}
				else {
					cout << "Closed by ";
					cout << t[i] << endl;
					open = 0;
					break;
				}
			}
			if (j == n - 1) {
				cout << "Unknown ";
				cout << t[i] << endl;
			}
		}
	}
}

Measured memory_bytes: 3216
#include <iostream>
#include <complex>
#include <vector>
#include <string>
#include <algorithm>
#include <cstdio>
#include <numeric>
#include <cstring>
#include <ctime>
#include <cstdlib>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <list>
#include <cmath>
#include <bitset>
#include <cassert>
#include <queue>
#include <stack>
#include <deque>
#include <random>
#include <iomanip>
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;
typedef long long int ll;
typedef long double ld;
typedef pair<ll,ll> P;
typedef pair<P,P> PP;
const ll MOD=1000000007;
const ll MAX_N=500010;
const ll INF=9999999999;


int main(){
    int n,y;
    cin>>n>>y;
    int ans[]={-1,-1,-1};
    bool f=true;
    for(int i=0;i<=n;i++){
        for(int j=0;j<=n;j++){
            if(i+j<=n){
                int k=n-i-j;
                int val=i*10000+j*5000+1000*k;
                if(val==y){
                    ans[0]=i;
                    ans[1]=j;
                    ans[2]=k;
                    f=false;
                    break;
                }
            }
        }
        if(!f) break;
    }
    cout<<ans[0]<<" "<<ans[1]<<" "<<ans[2]<<endl;
    

}

Measured memory_bytes: 3640
import sys
from collections import deque
def input(): return sys.stdin.readline().rstrip()
S = deque(input())
rev = False
apdlft = S.appendleft
apd = S.append

for _ in range(int(input())):
    q = input().split()
    if q[0] == '1':
        rev = not(rev)
    else:
        if (q[1]=='1' and rev is False) or (q[1]=='2' and rev is True):
            apdlft(q[2])
        else:
            apd(q[2])

if rev:
    print((''.join(S))[::-1])
else:
    print(''.join(S))

Measured memory_bytes: 8436
p=input().rstrip().split(' ')
q=input().rstrip().split(' ')
for i in range(int(p[0]),1000000000000):
    t=list(str(i))
    G=0;
    for j in range(0,len(t)):
        if t[j] not in q:
            continue;
        else:
            G=1;
            break;
    if G==0:
        print(i)
        break;


Measured memory_bytes: 2940
def find(l, e):
	start, end = 0, len(l)
	while True:
		mid = (start+end)//2
		if l[mid] == e: 
			return (e, e)
		elif (l[mid] > e):
			if (l[mid-1] < e):
				return (l[mid-1], l[mid])
			end = mid
			continue
		elif (l[mid] < e):
			if (l[mid+1] > e):
				return (l[mid], l[mid+1])
			start = mid

def print_sum():
	d = int(raw_input())
	if d == 0: return False
	n, m = int(raw_input()), int(raw_input())
	S = [int(raw_input()) for _ in range(n-1)]
	K = [int(raw_input()) for _ in range(m)]
	S = [0] + sorted(S) + [d]
	sum = 0
	for k in K:
		low, high = find(S, k)
		sum += min(k-low, high-k)
	print sum
	return True

while (print_sum()):
	pass

Measured memory_bytes: 13340
#include<bits/stdc++.h>
#define rep(a,b,c) for(int a=b;a<=c;a++)
#define per(a,b,c) for(int a=b;a>=c;a--)
#define ios; ios::sync_with_stdio(false); cin.tie(0);
#define pb push_back
#define mk make_pair
#define fi first
#define se second
#define mem(a,b) memset(a,b,sizeof(a))
#define inf 0x3f3f3f3f
#define INF 0x3f3f3f3f3f3f3f3f
#define ls(x) (x<<1)
#define rs(x) (ls(x)|1)
#define eps 1e-11
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll,ll> pll;
typedef pair<int,int> pii;
typedef vector<int> VI;
typedef double db;
mt19937 rnd(random_device{}());
const int mod = 998244353;
const int N = 3e3 + 5;
const int M = 1e6 + 5;
inline ll gcd(ll a,ll b){ return b?gcd(b,a%b):a;}
inline ll lcm(ll a,ll b){ return a*b/gcd(a,b); }
inline ll ksm(ll x,ll y){ ll res=1; while(y){if(y&1) res=res*x%mod;
x=x*x%mod; y>>=1;} return res; }
int n, m, k;
ll a[N][N];
ll dp[N][N][4];

int main(){
    scanf("%d%d%d",&n,&m,&k);
    rep(i,1,k){
        int x,y,w;
        scanf("%d%d%d",&x,&y,&w);
        a[x][y]=w;
    }
    rep(i,1,n) rep(j,1,m){
        rep(p,0,3){
            dp[i+1][j][0]=max(dp[i+1][j][0],dp[i][j][p]);
            dp[i][j+1][p]=max(dp[i][j+1][p],dp[i][j][p]);
        }
        if(a[i][j]==0) continue;
        rep(p,0,2){
            dp[i+1][j][0]=max(dp[i+1][j][0],dp[i][j][p]+a[i][j]);
            dp[i][j+1][p+1]=max(dp[i][j+1][p+1],dp[i][j][p]+a[i][j]);
        }
    }
    ll ans=0;
    rep(p,0,3){
        ans=max(ans,max(dp[n+1][m][p],dp[n][m+1][p]));
    }
    printf("%lld\n",ans);
    return 0;
}
/*
*/
//
//                            _ooOoo_
//                           o8888888o
//                           88" . "88
//                           (| -_- |)
//                           O\  =  /O
//                        ____/`---'\____
//                      .'  \|     |//  `.
//                     /  \|||  :  |||//  \
//                    /  _||||| -:- |||||-  \
//                    |   | \  -  /// |   |
//                    | \_|  ''\---/''  |   |
//                    \  .-\__  `-`  ___/-. /
//                  ___`. .'  /--.--\  `. . __
//               ."" '<  `.___\_<|>_/___.'  >'"".
//              | | :  `- \`.;`\ _ /`;.`/ - ` : | |
//              \  \ `-.   \_ __\ /__ _/   .-` /  /
//         ======`-.____`-.___\_____/___.-`____.-'======
//                            `=---='
//        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
//                     佛祖保佑      永无BUG


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

int main(){
    int N, M, C; cin >> N >> M >> C;
    vector<int> B(M);
    for(int i = 0; i < M; i++) cin >> B[i];

    int ans = 0;
    for(int i = 0; i < N; i++){
        int score = 0;
        for(int j = 0; j < M; j++){
            int a; cin >> a;
            score += a * B[j];
        }
        score += C;
        if(score > 0) ans++;
    }

    cout << ans << endl;
}

Measured memory_bytes: 256
package main

import "fmt"

func main() {
	n, an := 0, 1<<63-1
	var x []int

	fmt.Scanf("%d", &n)
	for i := 0; i < n; i++ {
		tmp := 0
		fmt.Scanf("%d", &tmp)
		x = append(x, tmp)
	}

	for i := 1; i <= 100; i++ {
		an1 := 0
		for _, j := range x {
			an1 += (j - i) * (j - i)
		}
		if an > an1 {
			an = an1
		}
	}
	fmt.Println(an)
}


Measured memory_bytes: 1852
import java.util.*;

public class Main{
	public static void main(String[] args){
    	Scanner sc = new Scanner(System.in);
        int price = sc.nextInt();
        int money = sc.nextInt();
        int satisfied = sc.nextInt();
        
        int satisfactionCounter = 0;
        while(money >= price){
        	money -= price;
            satisfactionCounter ++;
            if(satisfactionCounter == satisfied){
            	break;
            }
        }
        
        System.out.println(satisfactionCounter);
    }
}

Measured memory_bytes: 23764
#include<stdio.h>
#include<vector>
#include<algorithm>
using namespace std;
int dat[50];
int main()
{
	int num;
	scanf("%d",&num);
	int now=0;
	for(int i=0;i<num;i++)
	{
		int z;
		scanf("%d",&z);
		now^=z;
		for(int j=0;;j++)
		{
			if(z%2!=0)
			{
				dat[j]++;
				break;
			}
			z/=2;
		}
	}
	int r=0;
	for(int i=30;i>=0;i--)
	{
		if(now&(1<<i))
		{
			r++;
			if(dat[i]==0)
			{
				printf("-1\n");
				return 0;
			}
			now^=(1<<i)-1;
		}
	}
	printf("%d\n",r);
}

Measured memory_bytes: 256
//
//  main.cpp
//

#include <algorithm>
#include <array>
#include <assert.h>
#include <complex>
#include <iomanip>
#include <iostream>
#include <limits>
#include <map>
#include <math.h>
#include <memory>
#include <memory>
#include <queue>
#include <random>
#include <set>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <vector>

using namespace std;

using ll = int64_t;
using ull = uint64_t;
constexpr ll LL_MAX = numeric_limits<ll>::max();
constexpr ull ULL_MAX = numeric_limits<ull>::max();

template<typename T>
vector<T> make_vec_nd(T init, ll size) {
	return vector<T>(size, init);
}
template<typename T, typename... Args>
auto make_vec_nd(T init, ll size, Args... rest) {
	auto inner = make_vec_nd(init, rest...);
	return vector<decltype(inner)>(size, inner);
}

#define rep(i, a, b) for (ll i = (a); i < (b); i++)
#define rrep(i, a, b) for (ll i = (a)-1; i >= (b); i--)

void calc_grundy(ll now, vector<vector<ll>>& graph, vector<ll>& grundy, vector<bool>& visited) {
    visited[now] = true;
    ll g = 0;
    for (ll to : graph[now]) {
        if (visited[to]) {
            continue;
        }
        calc_grundy(to, graph, grundy, visited);
        g = g ^ (grundy[to] + 1);
    }
    grundy[now] = g;
}

int main() {
    ll N;
    cin >> N;
    vector<vector<ll>> graph(N);
    rep(i,0,N-1) {
        ll x, y;
        cin >> x >> y;
        x--;
        y--;
        graph[x].push_back(y);
        graph[y].push_back(x);
    }
    vector<bool> visited(N);
    vector<ll> grundy(N);
    calc_grundy(0, graph, grundy, visited);
    if (grundy[0] == 0) {
        cout << "Bob" << endl;
    } else {
        cout << "Alice" << endl;
    }
}


Measured memory_bytes: 14336
#include<bits/stdc++.h>
#include<boost/multiprecision/cpp_int.hpp>
using namespace std;
using namespace boost::multiprecision;
#define BEGIN ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define END return EXIT_SUCCESS
#define rep(I,N) for(auto I=0;I<(N);++I)
#define up(I,A,B) for(auto I=(A);I<=(B);++I)
#define dw(I,A,B) for(auto I=(A);I>=(B);--I)
#define all(C) (C).begin(),(C).end()
#define rall(C) (C).rbegin(),(C).rend()
#define ft first
#define sd second
#define mp make_pair
#define mt make_tuple
#define pf push_front
#define pb push_back
#define eb emplace_back
#define lb lower_bound
#define ub upper_bound
#define rs resize
typedef unsigned long long ull;
template<class T>inline void                                      in(T &p){cin>>p;}
template<class T1,class T2>inline void                            in(T1 &p1,T2 &p2){cin>>p1>>p2;}
template<class T1,class T2,class T3>inline void                   in(T1 &p1,T2 &p2,T3 &p3){cin>>p1>>p2>>p3;}
template<class T1,class T2,class T3,class T4>inline void          in(T1 &p1,T2 &p2,T3 &p3,T4 &p4){cin>>p1>>p2>>p3>>p4;}
template<class T1,class T2,class T3,class T4,class T5>inline void in(T1 &p1,T2 &p2,T3 &p3,T4 &p4,T5 &p5){cin>>p1>>p2>>p3>>p4>>p5;}
template<class T>inline void                                      ins(T &p){for_each(all(p),in<decltype(p[0])>);}
template<class T>inline void                             out(T p){cout<<p<<endl;}
template<class T1,class T2>inline void                   out(T1 p1,T2 p2){cout<<p1<<" "<<p2<<endl;}
template<class T1,class T2,class T3>inline void          out(T1 p1,T2 p2,T3 p3){cout<<p1<<" "<<p2<<" "<<p3<<endl;}
template<class T1,class T2,class T3,class T4>inline void out(T1 p1,T2 p2,T3 p3,T4 p4){cout<<p1<<" "<<p2<<" "<<p3<<" "<<p4<<endl;}
inline                                              void out(double p){printf("%.10f\n",p);}
template<class T>inline                             void outs(T p){for_each(all(p),out<decltype(p[0])>);}

inline void solve(void){
  long N,K;
  in(N,K);
  vector<long>A(N);
  ins(A);
  long ans=0,mod=1e9+7;
  rep(i,N){
    long f=0,b=0;
    rep(j,N){
      if(i==j)continue;
      if(i>j&&A[i]>A[j])f++;
      if(i<j&&A[i]>A[j])b++;
    }
    ans+=K*(K-1)/2%mod*(b+f)%mod+b*K%mod;
    ans%=mod;
  }
  out(ans);
}
int main(int argc,char**argv){
  BEGIN;
  solve();
  END;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using Graph = vector<vector<pii>>;
const int INF = 1e9 + 1;
const ll LLINF = 1e18;

ll gcd(ll a, ll b) { return (a % b ? gcd(b, (a % b)) : b); }

int main() {
    ll A, B;
    cin >> A >> B;
    ll g = gcd(A, B);
    int ans = 1;
    for(int i = 2; (ll)i * i <= g; ++i) {
        if(!(g % i)) {
            ans++;
            while(!(g % i))
                g /= i;
        }
    }
    if(g != 1)
        ans++;
    cout << ans << endl;
    return 0;
}


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

#define rep(i, N) for (int i = 0; i < N; i++)
const int intinf = numeric_limits<int>::max();

using ll = long long int;
using pii = pair<int, int>;
using pll = pair<ll, ll>;

void solve()
{
    int N;
    cin >> N;
    int M = (N + 1) / 2;

    cout << (double)M / N << endl;
}

int main()
{
    solve();
    return 0;
}

Measured memory_bytes: 256
from itertools import combinations_with_replacement
q=int(input())
AB=[list(map(int,input().split())) for _ in range(q)]

for a,b in AB:
    a,b=min(a,b),max(a,b)
    criteria=a*b
    left,right=a,b
    while right>left+1:
        mid=(left+right)//2
        if mid**2>criteria:right=mid
        else:left=mid

    cnt,point=0,0
    for i,j in enumerate(combinations_with_replacement([left,right],2)):
        if point<j[0]*j[1]<=criteria:
            point=j[0]*j[1]
            cnt=i

    if cnt==0:
        if point==criteria and a!=b:print((left-1)*2-1)
        else:print(left*2-2)
    else:
        if point==criteria:print(left*2-2)
        else:print(left*2-1)

Measured memory_bytes: 40176
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <ctime>
#include <cstring>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <bitset>
#include <numeric>
#include <utility>
#include <iomanip>
#include <algorithm>
#include <functional>
#include <unordered_map>
#define forr(i, a, b) for(int i = (a); i < (b); i++)
#define rep(i,n) for(int i = 0; i < (n); i++)
#define rrep(i,n) for(int i = 1; i <= (n); i++)
#define ALL(a) (a.begin()),(a.end())
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<ll, ll> LP;
const ll LINF = 1LL<<60;
const int INF = 1001001001;
const int MOD = 1000000007;

/* --------------------------------------------------- */

int main() {
    ll n, k;
    cin >> n >> k;
    vector<ll> A(n);
    rep(i, n) cin >> A[i];

    ll ans = LINF;
    rep(s, 1 << n) {
        ll tot = 0;
        vector<bool> b(n, false);
        rep(i, n) {
            if(s >> i & 1) {
                tot++;
                b[i] = true;
            }
        }
        if(tot >= k) {
            vector<ll> B = A;
            ll x = B[0];
            ll sum = 0;
            rep(i, n) {
                if(b[i]) {
                    if(B[i] <= x) {
                        if(i == 0) continue;
                        ll c = B[i];
                        B[i] = x + 1;
                        sum += B[i] - c;
                    }
                    x = B[i];
                } else {
                    x = max(x, B[i]);
                }
            }
            ans = min(ans, sum);
        } else continue;
    }
    cout << ans << endl;

    return 0;
}

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

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

    long long res = 1001001001001001;
    for(int i=0; i+1<N; ++i) {
        res = min(res, abs(A[N-1] - A[i] - A[i]));
    }
    cout << res << endl;
}

Measured memory_bytes: 1792
a, b = map(int, raw_input().split())
# x + y = a
# 2x + 4y = b
y2 = b - a * 2
x2 = 4 * a - b

if y2 % 2 == x2 % 2 == 0 and y2 >= 0 and x2 >= 0:
    print 'Yes'
else:
    print 'No'


Measured memory_bytes: 64096
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <climits>
#include <cstdlib>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <string>
#include <vector>
#define DEBUG 1
using namespace std;
constexpr int kMod = 1000000007;
typedef long long LL;

constexpr char kRemoved = '.';

LL remove_blocks(vector<string>& blocks, int K) {
  int L = blocks[0].size();
  LL score = 0;
  for (auto& line : blocks) {
    for (int i = 0; i < L; ++i) {
      int j = i + 1; char c = line[i];
      if (c == kRemoved) continue;
      while(line[j] == c && j < L) {
        ++j;
      }
      if (j - i >= K) {
        for (int x = i; x < j; ++x) line[x] = kRemoved;
        LL tmp_score = (c - '0') * (j - i);
        score += tmp_score;
      }
      i = j - 1;
    }
  }
  return score;
}

void drop_blocks(vector<string>& blocks) {
  int H = blocks.size();
  int L = blocks[0].size();
  for (int i = 0; i < L; ++i) {
    int pos = H - 1;
    for (int r = H - 1; r >= 0; --r) {
      if (blocks[r][i] != '.') {
        char c = blocks[r][i];
        blocks[r][i] = '.';
        blocks[pos][i] = c;
        --pos;
      }
    }
  }
}

int solve(int r, int c, vector<string> blocks, int K) {
  blocks[r][c] = kRemoved;
  drop_blocks(blocks);

  int total = 0, score = 0, k = 1;
  do {
    score = remove_blocks(blocks, K);
    drop_blocks(blocks);
    total += k * score;
    k *= 2;
  } while(score);

  return total;
}

int main() {
  int H, W, K; cin >> H >> W >> K;
  vector<string> blocks(H);
  for (int i = 0; i < H; ++i) cin >> blocks[i];

  int vmax = 0;
  for (int i = 0; i < H; ++i) {
    for (int j = 0; j < W; ++j) {
      vmax = max(vmax, solve(i, j, blocks, K));
    }
  }
  cout << vmax << endl;
}


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

int N;
int ret = 0;

void dfs(long long cur, int mask) {
  if (cur > N){
    return;
  }
  if (mask == 7){
    ret++;
  }
  dfs(cur * 10 + 3, mask | 4);
  dfs(cur * 10 + 5, mask | 2);
  dfs(cur * 10 + 7, mask | 1);  
}

int main() {
  cin >> N;
  dfs(0, 0);
  cout << ret << endl;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>

int h[1600], w[1600], H[1500001], W[1500001];

int main(void)
{
    int n, m;
    while (scanf("%d%d", &n, &m), n) {
        int i, j;
        long long res;
        for(i=1;i<=n;++i) { scanf("%d", h+i); h[i]+=h[i-1]; }
        for(i=1;i<=m;++i) { scanf("%d", w+i); w[i]+=w[i-1]; }

        memset(H, 0, sizeof(H));
        for(i=1;i<=n;++i) for(j=i;j<=n;++j) H[h[j]-h[i-1]]++;
        memset(W, 0, sizeof(W));
        for(i=1;i<=m;++i) for(j=i;j<=m;++j) W[w[j]-w[i-1]]++;

        res=0;
        for(i=1;i<=1500000;++i) res+=1LL*H[i]*W[i];
        printf("%lld\n", res);
    }
    return 0;
}

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

int main(){
  int n; string s;  cin >> n >> s;
  int l = s.size();
  if ( l%2==0 && s.substr(0,l/2) == s.substr(l/2,l/2) ) cout << "Yes" << endl;
  else cout << "No" << endl;
}



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

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <vector> 
# include <cstdint>
#define FOR(i,l,r) for(int i=(l);i<(r);++i)
#define RFOR(i,l,r) for(int i=(l);i>=(int)(r);i--)
#define rep(i,n)  FOR(i,0,n)
#define rrep(i,n)  RFOR(i,n-1,0)

#define int long long
using namespace std;
const int MX = 1e6;
const int inf = 1e13;
const int mod = 1e9+7;
#define ll long long
map<char, int> m;
signed main() {
   int x;
   cin >> x;
    int a = x%100;
    int b = x/100;
    if(b*5>=a) cout << 1 << endl;
    else cout << 0 << endl;
  return 0; 
}



Measured memory_bytes: 3624
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define REP(i, a, b) for(ll i=(a); i<(b); i++)
#define PER(i, a, b) for(ll i=(a); i>=(b); i--)
#define rep(i, n) REP(i, 0, n)
#define per(i, n) PER(i, n, 0)
#define ALL(a)  (a).begin(),(a).end()
const ll INF = 1e18+18;
const ll MAX = 200000;
const ll MOD = 1000000007;
#define Yes(n) cout << ((n) ? "Yes" : "No") << endl;
#define YES(n) cout << ((n) ? "YES" : "NO") << endl;
static const double pi = 3.141592653589793;




int main(){
    ll N, M;
    cin>>N>>M;
    vector<ll> A(N);
    map<ll, ll> B;
    set<ll> Q;
    B[0]=1;
    ll Sum=0;
    rep(i, N){
        cin>>A[i];
        Sum+=A[i];
        Sum%=M;
        Q.insert(Sum);
        B[Sum]++;
    }
    ll Ans=0;
    for (auto itr = Q.begin(); itr != Q.end(); ++itr) {
        Ans+=B[*itr]*(B[*itr]-1)/2;
    }
    cout<<Ans<<endl;
}
    

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

#define SORT(c) sort((c).begin(), (c).end())
#define REVERSE(v) reverse((v).begin(), (v).end())
#define ANS(ans) cout << (ans) << endl;
#define UNIQUE(v) (v).erase(unique((v).begin(), (v).end()), (v).end());
typedef vector<int> VI;
typedef pair<int, int> P;

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

int a[10][10] = {};

void count_shiritori(int k) {
  int ret1 = 0;
  int ret2 = 0;
  FOR(i, 1, k) {
    string tmp = to_string(i);
    int start = tmp.front() - '0';
    int last = tmp.back() - '0';
    a[start][last]++;
  }
  return;
}

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

  count_shiritori(n);

  int ans = 0;
  FOR(i, 1, 9) {
    FOR(j, 1, 9) {
      ans += a[i][j] * a[j][i];
    }
  }

  ANS(ans);
  return 0;
}


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

#define IO ios::sync_with_stdio(0); cin.tie(NULL); cout.tie(NULL);
typedef long long ll;
typedef long double ld;
const ll INF = 1e18;
const int N = 1e5 + 5, inf = 1e9, mod = 1e9 + 7;

using namespace std;

int main()
{
    IO
    int n, m, a;
    ll sum = 0, ans = 0;
    map<int, int>mp;
    cin >> n >> m;
    mp[0] = 1;
    for(int i = 0; i < n; i++)
    {
        cin >> a;
        sum = (sum + a) % m;
        ans += mp[sum];
        mp[sum]++;
    }
    cout << ans << '\n';
    return 0;
}

Measured memory_bytes: 6444
#include<cmath>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<iostream>
#include<algorithm>
using namespace std;
typedef long long ll;
const int INF=1e9;
const double eps=1e-9;
inline int read(){
	int x=0,flag=1;
	char ch=getchar();
	while(!isdigit(ch) && ch!='-')ch=getchar();
	if(ch=='-')flag=-1,ch=getchar();
	while(isdigit(ch))x=(x<<3)+(x<<1)+ch-'0',ch=getchar();
	return x*flag;
}
int main(){
	int i,j,k,m,n;
	n=read();m=read();
	printf("%d\n",(int)pow(2,m)*m*1900+(int)pow(2,m)*100*(n-m));
	return 0;
}


Measured memory_bytes: 512
#include <queue>
#include <iostream>
using namespace std;
int main() {
    int X, Y, A, B, C; cin >> X >> Y >> A >> B >> C;
    priority_queue<pair<int, int> > pq;
    for (int i = 0; i < A; i++) { int x; cin >> x; pq.push({x, 1}); }
    for (int i = 0; i < B; i++) { int x; cin >> x; pq.push({x, 2}); }
    for (int i = 0; i < C; i++) { int x; cin >> x; pq.push({x, 0}); }
    int r = 0, g = 0, u = 0;
    long long ans = 0;
    while (r + g + u < X + Y) {
        int p = pq.top().first, col = pq.top().second;
        pq.pop();
        if ((col == 1 && r == X) || (col == 2 && g == Y)) continue;
        ans += p;
        ++(col == 0 ? u : col == 1 ? r : g);
    }
    cout << ans << endl;
}


Measured memory_bytes: 5744
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<map>
#include<set>
#include<cstdio>
#include<cmath>
#include<numeric>
#include<queue>
#include<stack>
#include<cstring>
#include<limits>
#include<functional>
#include<unordered_set>
#define rep(i,a) for(int i=(int)0;i<(int)a;++i)
#define pb push_back
#define eb emplace_back
using ll=long long;
constexpr ll mod = 1e9 + 7;
constexpr ll INF = 1LL << 50;
 
template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}

using namespace std;



void solve(){
    int h,w;
    cin>>h>>w;
    vector<string>maze(h);
    rep(i,h)cin>>maze[i];
    int cur=0;
    rep(i,h){
        if(i){
            rep(j,cur){
                if(maze[i][j]=='#'){
                    cout<<"Impossible\n";
                    return;
                }
            }
        }
        while(cur+1<w&&maze[i][cur+1]!='.'){
            ++cur;
        }
        for(int j=cur+1;j<w;++j){
            if(maze[i][j]=='#'){
                cout<<"Impossible\n";
                return;
            }
        }
    }
    cout<<"Possible\n";
}
 
signed main(){
	std::ios::sync_with_stdio(false);
    std::cin.tie(0);
	solve();
	return 0;
}

Measured memory_bytes: 256
import java.io.*;
import java.util.StringTokenizer;

public class Main {

    public static void main(String[] args) throws IOException {
        init();

        int n = nextInt(), k = nextInt();

        int[] h = new int[n];

        for (int i = 0; i < h.length; i++) h[i] = nextInt();

        int[] dp = new int[n];

        for (int i = n - 1; i >= 0; i--) {
            if (i == n - 1) dp[i] = 0;
            if (i + 1 < dp.length) dp[i] = dp[i + 1] + Math.abs(h[i + 1] - h[i]);
            for (int j = i + 2; j <= Math.min(dp.length - 1, i + k); j++) {
                dp[i] = Math.min(dp[i], dp[j] + Math.abs(h[j] - h[i]));
            }
        }

        System.out.println(dp[0]);
    }

    //Input Reader
    private static BufferedReader reader;
    private static StringTokenizer tokenizer;

    private static void init() {
        reader = new BufferedReader(new InputStreamReader(System.in));
        tokenizer = new StringTokenizer("");
    }

    private static String next() throws IOException {
        String read;
        while (!tokenizer.hasMoreTokens()) {
            read = reader.readLine();
            if (read == null || read.equals(""))
                return "-1";
            tokenizer = new StringTokenizer(read);
        }

        return tokenizer.nextToken();
    }

    private static int nextInt() throws IOException {
        return Integer.parseInt(next());
    }

//    private static long nextLong() throws IOException {
//        return Long.parseLong(next());
//    }
//
//    //    Get a whole line.
//    private static String line() throws IOException {
//        return reader.readLine();
//    }
//
//    private static double nextDouble() throws IOException {
//        return Double.parseDouble(next());
//    }
}

Measured memory_bytes: 35696