akhauriyash/Code-Regression huggingface dataset:
m = 10 ** 9 + 7
x,y = map(int,input().split())

if (x + y) % 3 != 0:
    print(0)
else:
    s = (x + y) // 3
    k = (2 * x - y) // 3
    l = (-x + 2 * y) // 3
    if k < 0 or l < 0:
        print(0)
    else:
        a = 1
        b = 1
        for i in range(k + 1,k + l + 1):
            a *= i
            a %= m
        for j in range(1,l + 1):
            b *= j
            b %= m
        ans = a * pow(b,m-2,m)
        print(ans % m)
        

Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef std::vector<vector<int> > vvi;
typedef pair<int, int> pi;
typedef pair<ll, ll> pll;
typedef vector<ll> vll;
typedef vector<pi> vpi;
typedef vector<pll> vpll;
typedef vector<vll> vvll;
typedef vector<vi> vvi;
#define debugone(x) cerr << #x << " " << x << "\n"; cerr.flush();
#define debugtwo(x) cerr << #x << "-------------" << "\n";for(auto &it: x) cerr << it << " ";cerr << "\n"; cerr.flush();
#define debugthree(x_, i_, j_) cerr << #x_ << "------------" << "\n";cerr << "from " << i_ << " to " << j_ << "\n";for(ll k_=i_; k_<=j_; k_++) cerr << x_[k_] << " ";cerr << "\n"; cerr.flush();
#define trace1(x)                cerr << #x << ": " << x << endl;
#define trace2(x, y)             cerr << #x << ": " << x << " | " << #y << ": " << y << endl;
#define trace3(x, y, z)          cerr << #x << ": " << x << " | " << #y << ": " << y << " | " << #z << ": " << z << endl;
#define trace4(a, b, c, d)       cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " << c << " | " << #d << ": " << d << endl;
#define trace5(a, b, c, d, e)    cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " << c << " | " << #d << ": " << d << " | " << #e << ": " << e << endl;
#define trace6(a, b, c, d, e, f) cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " << c << " | " << #d << ": " << d << " | " << #e << ": " << e << " | " << #f << ": " << f << endl;

const ll MOD = 1e9 + 7;
const int INF = 2e9;
const int MAX_LOG = 21;
const int MAX_N = 12800;

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

	int n;
	cin >> n;
	for(int i = 1; i <= n; i++){
		if(int(i * 1.08) == n){
			cout << i << endl;
			return 0;
		}
	}
	cout << ":(" << endl;
}	

Measured memory_bytes: 256
#define _GLIBCXX_DEBUG
#include<bits/stdc++.h>
using namespace std;
typedef long long int lli;
typedef unsigned long long int ulli;
#define vec(s) vector

#define vvec(s) vector<vector
>
typedef vector<lli> vi;
typedef vector<vi> vvi;
typedef pair<lli,lli> pii;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define Yes(x) cout<<(x?"Yes":"No")<<endl;
#define YES(x) cout<<(x?"YES":"NO")<<endl;
#define out(s) cout<<s<<endl;
#define pb(s) push_back(s);
#define sp " " 
#define INF 10000000000
#define LINF 9000000000000000000
#define all(s) s.begin(),s.end()
void vout(vi v){
    for(lli i=0;i<v.size();i++)
    cout<<v.at(i)<<endl;
}
int main(){
    cout << std::fixed << std::setprecision(10);
    lli n;
    cin>>n;
    if(n%2==0){ 
        n--;
    }
    out(n/2);
}

Measured memory_bytes: 3584
N,M = map(int,input().split())
LR = []
for i in range(M):
    LR.append(list(map(int,input().split())))

max_l = 0
min_r = float('inf')

for l,r in LR:
    max_l = max(max_l,l)
    min_r = min(min_r,r)

if max_l <= min_r:
    print(min_r - max_l + 1)
else:
    print(0)

Measured memory_bytes: 27340
using System;

class BeTogether
{
	static void Main(String[] args)
	{
		int N;
		int[] a;
		String[] vals;

		N = int.Parse(Console.ReadLine());
		a = new int[N];
		vals = Console.ReadLine().Split(' ');
		for(int i=0; i<N; i++)
			a[i] = int.Parse(vals[i]);
		int min = 101;
		int max = -101;
		for(int i=0; i<N; i++)
		{
			if(min > a[i])
				min = a[i];
			if(max < a[i])
				max = a[i];
		}
		if(min == max)
		{
			Console.WriteLine(0);
			return;
		}
		int minCost = int.MaxValue;
		int cost;
		for(int v=min; v<=max; v++)
		{
			cost=0;
			for(int i=0; i<N; i++)
				cost += (a[i]-v)*(a[i]-v);
			if(minCost > cost)
				minCost = cost;
		}
		Console.WriteLine(minCost);
	}
}


Measured memory_bytes: 2648
#include <iostream>
#include <vector>
#include <map>
#include <algorithm>

using namespace std;

int main() {
    int n, k;
    cin >> n >> k;
    map<int, vector<int>> ma;
    long long sum = 0;
    ma[sum] = vector<int>{0};
    vector<int> c_sum(n + 1);
    for (int i = 1; i <= n; i++) {
        int a;
        cin >> a;
        sum += a - 1;
        sum %= k;
        if (ma.find(sum) == ma.end())ma[sum] = vector<int>();
        ma[sum].push_back(i);
        c_sum[i] = c_sum[i - 1] + sum;
    }

    long long ret = 0;
    for (auto pa:ma) {
        for (auto x:pa.second) {
            ret += lower_bound(pa.second.begin(), pa.second.end(), x + k)
                   - upper_bound(pa.second.begin(), pa.second.end(), x);
        }
    }
    cout << ret << endl;
    return 0;
}

Measured memory_bytes: 22912
#include<iostream>
#include<vector>
#include<functional>
#include<algorithm>
#include<cmath>
#include<string>
#include<iomanip>
using namespace std;


int main()
{
	int n;
	const int num=3000;
	long long a[num]={};
	long long dp[num][num]={};
	cin>>n;
	for(int i=0;i<n;i++)
	{
		cin>>a[i];
	}
	for(int i=0;i<n;i++)
		dp[i][0]=a[i];
	for(int i=1;i<n;i++)//iは残りの前と後ろ番号の差
	{
		for(int j=0;i+j<n;j++)//jは前の番号
		{
			dp[j][i]=a[j+i]-dp[j][i-1];
			if(j<n-1)
				dp[j][i]=max(dp[j][i],a[j]-dp[j+1][i-1]);
		}
	}
	cout<<dp[0][n-1]<<endl;
}
	

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

const int MOD = 1000000007;
using Data = pair<long long, vector<ll> >;

int main() {
  ll n;
  cin >> n;
  vector<pair<ll,ll>>vec;
  rep(i,n){
    ll a,b;
    cin >> a>>b;
    vec.push_back(make_pair(b,a));
  }
  sort(vec.begin(),vec.end());
  ll now=0;
  rep(i,n){
    now+=vec[i].second;
    if(now<=vec[i].first)continue;
    else{
      cout << "No" << endl;
      return 0;
    }
  }
  cout << "Yes"<< endl;
  return 0;
 
}

Measured memory_bytes: 6384
#include "bits/stdc++.h"
using namespace std;
using lint = long long;
#define rep(i, n) for (lint (i) = 0; (i) < (n); ++(i))

lint n;
void bfs(const vector<lint>&v, lint cnt) {
	if (n < v.size()) {
		printf("%lld\n", v[n - 1]);
		return;
	}
	vector<lint>res = v;
	lint cnt_ = 0;
	rep(i, cnt) {
		lint j = v[v.size() - cnt + i];
		lint add = 10 * v[v.size() - cnt + i] + j % 10;
		if (j % 10) {
			res.emplace_back(add - 1);
			++cnt_;
		}
		res.emplace_back(add);
		++cnt_;
		if (j % 10 < 9) {
			res.emplace_back(add + 1);
			++cnt_;
		}
	}
	bfs(res, cnt_);
}
int main() {
	scanf("%lldn", &n);
	bfs({ 1,2,3,4,5,6,7,8,9 }, 9);
}


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

using namespace std; 

typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef vector<PII> VPII;
typedef long long LL;
typedef vector<LL> VL;
typedef vector<VL> VVL;
typedef pair<LL, LL> PLL;
typedef vector<PLL> VPLL;
typedef priority_queue<LL> PQ_DESC;
typedef priority_queue<LL, VL, greater<LL>> PQ_ASC;
typedef priority_queue<PII> PQ_DESC_PII;
typedef priority_queue<PII, vector<PII>, greater<PII>> PQ_ASC_PII;
typedef priority_queue<VL> PQ_DESC_VL;
typedef priority_queue<VL, vector<VL>, greater<VL>> PQ_ASC_VL;
typedef priority_queue<PLL> PQ_DESC_PLL;
typedef priority_queue<PLL, vector<PLL>, greater<PLL>> PQ_ASC_PLL;

#define ALL(c) (c).begin(),(c).end()
#define PB push_back
#define MP make_pair
#define SORT_ASC(c) sort(ALL(c))
//#define SORT_DESC(c) sort(ALL(c), greater<typeof(*((c).begin()))>())
#define SORT_DESC(c) sort((c).rbegin(),(c).rend())
#define REV(c) reverse((c).begin(), (c).end())
#define SIZE(a) int((a).size())

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define ROF(i,a,b) for(int i=(b-1);i>=(a);--i)
#define REP(i,n) FOR(i,0,n)
#define PER(i,n) ROF(i,0,n)

const double EPS = 1e-10;
const double PI  = acos(-1.0);
const int LARGE_INT = 1e9+100;
const int INF = 2e9+100;
const LL INF_LL = (LL)INF*(LL)INF;
const int MOD = 1e9+7;

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

LL modpow(LL a, LL n) {
    LL res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % MOD;
        a = a * a % MOD;
        n >>= 1;
    }
    return res;
}

void Main()
{
    LL n,k;cin>>n>>k;
    double result = 0;

    REP(i,n){
        LL now = i+1;
        double p = 1.0/n;
        while(true){
            if(now>=k){
                result += p;
                break;
            }
            now *= 2;
            p /= 2;
        }
    }
    cout<<result<<endl;


    
	return;
}

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

Measured memory_bytes: 3716
import java.util.Arrays;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		int[] stack = new int[400001];
		Arrays.fill(stack, -1);
		int kijun = 200000;

		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int[] a = new int[n];
		for (int i = 0; i < n; i++) {
			a[i] = sc.nextInt();
		}

		int upCount = kijun;
		int downCount = kijun;

		boolean fromUpFlg = true;
		for (int i = 0; i < n; i++) {
			if (i % 2 == 0) {
				stack[++upCount] = a[i];
				fromUpFlg = true;
			} else {
				stack[--downCount] = a[i];
				fromUpFlg = false;
			}
		}

		StringBuffer sb = new StringBuffer();
		if (fromUpFlg) {
			for (int i = stack.length - 1; i >= 0; i--) {
				if (stack[i] >= 0) {
					sb.append(stack[i]);
					if (i != 0) {
						sb.append(" ");
					}
				}
			}
		} else {
			for (int i = 0; i < stack.length; i++) {
				if (stack[i] >= 0) {
					sb.append(stack[i]);
					if (i != stack.length - 1) {
						sb.append(" ");
					}
				}
			}
		}

		System.out.println(sb.toString());

	}

}

Measured memory_bytes: 96976
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
using namespace std;

int main(){
    long long n;
    cin >> n;
    vector<long long> l(n);

    for(long long i = 0; i < n; i++) cin >> l[i];

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

    long long cnt = 0;
    for(long long x = 0; x < n; x++){
        for(long long y = x + 1; y < n; y++){
            long long dist = lower_bound(l.begin(), l.end(), l[x]+l[y]) - l.begin();
            cnt += dist - (y+1);
        }
    }
    cout << cnt << endl;
    return 0;
}

Measured memory_bytes: 3632
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n,d,x;
  cin>>n>>d>>x;
  int s=x;
  for(int i=0;i<n;i++){
    int a;
    cin>>a;
    s+=(d-1)/a+1;
  }
  cout<<s<<endl;
}

Measured memory_bytes: 256
#pragma region template
#include "bits/stdc++.h"
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
const long long MOD = 1e9 + 7, MAX = 1e18, larg = 1e5, INF = -1e9;
long long A, B, C, D, E, F, G, H, I, J, K, L, N, M, O, P, Q, R, S, T, U, V, W, x, y, z;
long long max_value = INF, max_index = -1;
long long min_value = MAX, min_index = -1;
typedef long long ll;
typedef pair<ll, ll> Pa;

class UnionFind {
public:
	vector <ll> par; // 各元の親を表す配列
	vector <ll> siz; // 素集合のサイズを表す配列(1 で初期化)

	// Constructor
	UnionFind(ll sz_) : par(sz_), siz(sz_, 1LL) {
		for (ll i = 0; i < sz_; ++i) par[i] = i; // 初期では親は自分自身
	}
	void init(ll sz_) {
		par.resize(sz_);
		siz.assign(sz_, 1LL);  // resize だとなぜか初期化されなかった
		for (ll i = 0; i < sz_; ++i) par[i] = i; // 初期では親は自分自身
	}

	// Member Function
	// Find
	ll root(ll x) { // 根の検索
		while (par[x] != x) {
			x = par[x] = par[par[x]]; // x の親の親を x の親とする
		}
		return x;
	}

	// Union(Unite, Merge)
	bool merge(ll x, ll y) {
		x = root(x);
		y = root(y);
		if (x == y) return false;
		// merge technique（データ構造をマージするテク．小を大にくっつける）
		if (siz[x] < siz[y]) swap(x, y);
		siz[x] += siz[y];
		par[y] = x;
		return true;
	}

	bool issame(ll x, ll y) { // 連結判定
		return root(x) == root(y);
	}

	ll size(ll x) { // 素集合のサイズ
		return siz[root(x)];
	}
};

vector<int> fre[100001];
vector<int> block[100001];
int main() {
	cin >> N >> M >> K;
	UnionFind tree(N+1);
	rep(i, M) {
		cin >> A >> B;
		fre[A].push_back(B);
		fre[B].push_back(A);
		tree.merge(A, B);
	}
	rep(i, K) {
		cin >> C >> D;
		block[C].push_back(D);
		block[D].push_back(C);
	}
	rep(i, N) {
		int index = i + 1;
		int count = tree.size(index) - 1;
		rep(j, fre[i + 1].size()) {
			int to = fre[index][j];
			if (tree.issame(index, to)) count--;
		}
		rep(j, block[i + 1].size()) {
			int to = block[index][j];
			if (tree.issame(index, to)) count--;
		}
		cout << count << " ";
	}
}


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

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

const int INF = 1e9 + 7;

using namespace std;

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

	int n;
	cin >> n;

	vector<int> res;
	vector<bool> prime(55555 + 1, true);
	prime[0] = prime[1] = false;
	int next = 2;
	for (int i = next; i * i < 55555 + 1; i++) {
		int flg = 0;
		rep (j, next + 1, 55555 + 1) {
			if (j % i == 0) {
				prime[j] = false;
			} else if (j % 5 != 1) {
				prime[j] = false;
			} else {
				if (!flg) {
					flg = 1;
					next = j;
				}
			}
		}
	}

	int count = 0;
	rep (i, 10, 55555 + 1) {
		if (prime[i]) {
			cout << i << " ";
			count++;
 		}

		if (count >= n)
			break;
	}
	cout << "\n";

	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,a,n) for(int i=a;i<n;i++)
#define all(a) a.begin(),a.end()
#define o(a) cout<<a<<endl
#define int long long
using namespace std;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int,int> pii;

int n,id[1010],p[1010],q[1010],r[1010];
int P,Q,R,C;

signed main(){
	int n;
	while(1){
		cin>>n;
		if(n==0) break;
		rep(i,0,n){
			cin>>id[i]>>p[i]>>q[i]>>r[i];
		}
		cin>>P>>Q>>R>>C;
		vi ans;
		rep(i,0,n){
			if(p[i]<=P && q[i]<=Q && r[i]<=R && 4*p[i]+9*q[i]+4*r[i]<=C){
				ans.push_back(id[i]);
			}
		}
		if(ans.size()==0) o("NA");
		else{
			rep(i,0,ans.size()){
				o(ans[i]);
			}
		}
	}
}

Measured memory_bytes: 1264
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cmath>

using namespace std;

#define rep(i, n) for(long long i = 0; i < (long long)(n); i++)
#define all(x) (x).begin(),(x).end()

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

	vector<vector<int>> X(N, vector<int>(D));

	rep(i, N)
	{
		rep(j, D)
		{
			cin >> X[i][j];
		}
	}


	int ans = 0;
	rep(i, N)
	{
		rep(j, N)
		{
			if (i >= j)
			{
				continue;
			}


			int dist = 0;
			rep(k, D)
			{
				int sub = abs(X[i][k] - X[j][k]);
				dist += sub * sub;
			}

			for (int p = 0; p < (int)sqrt(dist) + 1; p++)
			{
				if (dist == p * p)
				{
					ans++;
					break;
				}
			}
		}
	}

	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 256
# -*- coding: utf-8 -*-
import sys;
import string;
sys.setrecursionlimit(20000) # 再起呼び出しの最大数をセット

import copy
import itertools

from functools import lru_cache
#@lru_cache(maxsize = None)

# 整数の入力
n = int(input())

# スペース区切りの整数の入力
w = [x for x in map(int, input().split())]
#n, a, b, c, d = map(int, input().split())
#print("sp", n, q, file=sys.stderr)
#p, q, r = map(int, input().split())

# 改行区切りの整数の入力
#a = []
#for x in range(m):
#  a.append([int(x) for x in input().split()])
#p = [int(x) for x in input().split()]

# 文字列の入力
#s = input()

# 出力
#print("{} {}".format(a+b+c, s))
#a.sort()
#print(set(a), file=sys.stderr)
#print(len(set(a)))

#cache = dict()

import re

def doit():
  ww = sum(w)
  print("ww", ww, file=sys.stderr)
  w2 = ww // 2
  wl = 0
  wr = ww
  res = ww
  for x in w:
    wl += x
    wr -= x
    res = min(res, abs(wr - wl))
  
  return res

#print(doit([0] * 4))
#doit(s)
try:
  print(doit())
except Exception as e:
  print("e", e, file=sys.stderr)


Measured memory_bytes: 3960
#include <bits/stdc++.h>
using namespace std;
int minimum_cost(int a[] , int n){
    int dp[n+1];
    dp[0] = 0;
    dp[1] = 0;
     for(int i=2 ; i<=n ; i++){
         int opt1 = abs(a[i] - a[i-1]) + dp[i-1];
         int opt2 ;
         if(i==2){
             opt2 = INT_MAX;
         }else{
             opt2 = abs(a[i] - a[i-2]) + dp[i-2];
         }
         dp[i] = min(opt1 , opt2);
     }
     return dp[n];
}
int main() {
    int n;
    cin>>n;
    int a[n+1];
    for(int i=1 ; i<=n ; i++){
        cin>>a[i];
    }
    cout<<minimum_cost(a , n);
    return 0;
}


Measured memory_bytes: 1024
#pragma GCC optimize("Ofast")
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>

#define F first
#define S second
#define int long long
#define ll long long
//#define int  unsigned long long
#define pb push_back
//#define double long double

using namespace std;
using namespace __gnu_pbds;
typedef  tree< int , null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
const int mod = 1e9 + 7;
const int N = 1000;
int f[N], invf[N], ans[N], tmp[N], dp[N][N], s[N][N], a[N], b1[N], b2[N];
int binpow(int x, int y){
    if (y == 0) return 1;
    if (y % 2) return x * binpow(x, y - 1) % mod;
    int z = binpow(x, y / 2);
    return z * z % mod;
}
int cnk(int n, int k){
    if (k > n) return 0;
    return f[n] * invf[k] % mod * invf[n - k] % mod;
}
main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    //freopen("input.txt", "r", stdin);
	int n, c;
	cin >> n >> c;
	invf[0] = f[0] = 1;
	for (int i = 1; i < N; i++) f[i] = f[i - 1] * i % mod;
	for (int i = 1; i < N; i++) invf[i] = binpow(f[i], mod - 2);
	for (int i = 1; i <= n; i++) cin >> b1[i];
	for (int i = 1; i <= n; i++) cin >> b2[i];
	for (int i = 1; i <= n; i++){
        int l, r;
        l = b1[i];
        r = b2[i];
        for (int j = l; j <= r; j++){
            a[j] = 1;
        }
        for (int j = 0; j <= c; j++){
            for (int k = l; k <= r; k++){
                s[i][j] = (s[i][j] + a[k]) % mod;
                a[k] = a[k] * k % mod;
            }
        }
	}
	dp[0][0] = 1;
	for (int i = 1; i <= n; i++){
        for (int j = 0; j <= c; j++){
            for (int l = 0; l <= j; l++){
                dp[i][j] = (dp[i][j] + dp[i - 1][j - l] * s[i][l]) % mod;
            }
        //    cout << i << " " << j << " " << dp[i][j] << endl;
        }
	}
	cout << dp[n][c];
}


Measured memory_bytes: 10368
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <set>
#include <queue>
#include <stack>
#include <tuple>
#include <cmath>
#include <iomanip>
#include <map>
#include <cstring> //memset(dp,0,sizeof(dp))
#include <functional>
#include <cctype>
#include <locale>
#define ll long long
#define rep(i,n) for(int i=0;i<(n);i++)
#define rrep(i,n) for(int i=n-1;i>=0;i--)
#define fi first
#define se second
#define pb push_back
#define ALL(a) (a).begin(),(a).end()
using namespace std;
template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}
typedef pair<int,int> P;
typedef pair<long long,long long> Pll;
#define fout(num) cout << fixed << setprecision(20) << (num) << endl
//s[i]=tolower(s[i]); islower(s[i]); cout << tolower(s[i])はバグ
//vector<vector<ll>> dp(n,vector<ll>(n))
//exist x map o setconst ll MOD = 1e9+7;return fac[n]*(finv[k]*finv[n-k] % MOD) % MOD;

signed main(){
    ios::sync_with_stdio(false);
    std::cin.tie(nullptr);
    int a,b,c; cin >> a >> b >> c;
    int k; cin >> k;
    int cnt=0;
    while(a>=b){
        b*=2;
        cnt++;
    }
    while(b>=c){
        c*=2;
        cnt++;
    }
    if(cnt<=k)cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
}



Measured memory_bytes: 3652
#define _USE_MATH_DEFINES

#include <iostream>
#include <iomanip>
#include <stdio.h>

#include <sstream>
#include <algorithm>
#include <iterator>
#include <cmath>
#include <complex>

#include <string>
#include <cstring>
#include <vector>
#include <bitset>

#include <queue>
#include <set>
#include <map>
#include <stack>
#include <list>

#include <ctime>
////
//#include <random>//
/////////

typedef long long LL;
typedef long double LD;
typedef unsigned long long ULL;

////定数
const int INF = (int)1e9 + 10;
const LL MOD = (LL)1e9 + 7;
const LL LINF = (LL)4e18 + 20;
const LD PI = acos(-1.0);
const double EPS = 1e-9; 
/////////
using namespace::std;
template<typename T>
void chmax(T& a, T b) {
	a = max(a, b);
}

template<typename T>
void chmin(T& a, T b) {
	a = min(a, b);
}

template<typename T>
void IN(vector<T> &A,int N=-1) {
	if (N == -1) {
		N = A.size();
	}
	for (int i = 0; i < N; ++i) {
		cin >> A[i];
	}
}

template<typename T>
void SO(vector<T> &A,bool F=false) {
	sort(A.begin(), A.end());
	if (F) {
		reverse(A.begin(), A.end());
	}
}
//////////////


void solve() {
	int N, M;
	cin >> N >> M;
	vector<pair<LL, LL>> A(N);
	for (int i = 0; i < N; ++i) {
		cin >> A[i].first;
		A[i].second = 1;
	}
	for (int i = 0; i < M; ++i) {
		LL b, c;
		cin >> b >> c;
		pair<LL, LL> temp;
		temp.first = c;
		temp.second = b;
		A.push_back(temp);
	}
	SO(A);
	reverse(A.begin(), A.end());
	LL ans = 0;
	LL nokori = N;
	for(int i=0;nokori;++i){
		if (nokori < A[i].second) {
			ans += A[i].first * nokori;
			nokori = 0;
		}
		else {
			ans += A[i].first * A[i].second;
			nokori -= A[i].second;
		}
	}
	cout << ans << endl;
}

signed main(void) {
	std::cin.tie(0);
	std::ios::sync_with_stdio(false);
	std::cout << std::fixed;//小数を10進数表示
	cout << setprecision(16);//小数点以下の桁数を指定//coutとcerrで別	

	solve();
}


Measured memory_bytes: 5600
import java.io.BufferedReader;
import java.io.Closeable;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.StringTokenizer;

public class Main {
	
	public static void main(String[] args) throws IOException {
		try(final Scanner sc = new Scanner(System.in)){
			final int H = sc.nextInt();
			final int W = sc.nextInt();
			
			int[][] DP = new int[H][W];
			for(int i = 0; i < H; i++) {
				final char[] chs = sc.next().toCharArray();
				for(int j = 0; j < W; j++) {
					DP[i][j] = chs[j] == '#' ? 0 : Integer.MAX_VALUE / 2;
				}
			}
			
			for(int i = 0; i < H; i++) {
				for(int j = 0; j < W; j++) {
					if(i != 0) { DP[i][j] = Math.min(DP[i][j], DP[i - 1][j] + 1); }
					if(j != 0) { DP[i][j] = Math.min(DP[i][j], DP[i][j - 1] + 1); }
				}
			}
			
			for(int i = H - 1; i >= 0; i--) {
				for(int j = W - 1; j >= 0; j--) {
					if(i != H - 1) { DP[i][j] = Math.min(DP[i][j], DP[i + 1][j] + 1); }
					if(j != W - 1) { DP[i][j] = Math.min(DP[i][j], DP[i][j + 1] + 1); }
				}
			}
			
			int answer = 0;
			for(int i = 0; i < H; i++) {
				for(int j = 0; j < W; j++) {
					answer = Math.max(answer, DP[i][j]);
				}
			}
			
			System.out.println(answer);
		}
	}

	public static class Scanner implements Closeable {
		private BufferedReader br;
		private StringTokenizer tok;

		public Scanner(InputStream is) throws IOException {
			br = new BufferedReader(new InputStreamReader(is));
		}

		private void getLine() throws IOException {
			while(!hasNext()){
				tok = new StringTokenizer(br.readLine());
			}
		}

		private boolean hasNext() {
			return tok != null && tok.hasMoreTokens();
		}

		public String next() throws IOException {
			getLine();
			return tok.nextToken();
		}

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

		public long nextLong() throws IOException {
			return Long.parseLong(next());
		}

		public double nextDouble() throws IOException {
			return Double.parseDouble(next());
		}

		public int[] nextIntArray(int n) throws IOException {
			final int[] ret = new int[n];
			for(int i = 0; i < n; i++){
				ret[i] = this.nextInt();
			}
			return ret;
		}

		public long[] nextLongArray(int n) throws IOException {
			final long[] ret = new long[n];
			for(int i = 0; i < n; i++){
				ret[i] = this.nextLong();
			}
			return ret;
		}

		public void close() throws IOException {
			br.close();
		}
	}
}

Measured memory_bytes: 32832
#include<iostream>
using namespace std;
main()
{
	int p,q,r,m,n,t;
	cin>>p>>q>>r;
    m=min(p,q);
    n=min(q,r);
    t=min(p,r);
    if(m==t)
    {
      cout<<m+n<<"\n";
    }
  else if(m==n)
  {
    cout<<m+t<<"\n";
  }
  else if(n==t)
  {
    cout<<n+m<<"\n";
  }
}

Measured memory_bytes: 3608
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int i,n,t=1,p;
    cin>>n;
    string s;
    cin>>s;
    for(i=1;i<s.size();i++){
        if(s[i]!=s[i-1]){
            t++;
        }
    }
    cout<<t<<endl;
}


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

#if __has_include("print.hpp")
  #include "print.hpp"
#endif

#define ALL(x) (x).begin(), (x).end()
#define RALL(x) (x).rbegin(), (x).rend()
#define MOD 1000000007

typedef long long ll;
typedef pair<int, int> p;

int dp[100100];
int n, m;
vector<int> v;

void init(){
  for (int i = 0; i < 100100; i++) {
    dp[i] = 0;
  }
  dp[0] = 1;
  dp[1] = 1;
}

ll res = 0;
void solve(){
  for (int i = 2; i <= n; i++) {
    if(dp[i] == -1) continue;
    if(dp[i-1] == -1 && dp[i-2] == -1) dp[i] = 0;
    else if(dp[i-1] != -1 && dp[i-2] != -1){
      dp[i] = dp[i-1] + dp[i-2];
    }else if(dp[i-1] == -1){
      dp[i] = dp[i-2];
    }else if(dp[i-2] == -1){
      dp[i] = dp[i-1];
    }
    dp[i] %= MOD;
  }
  res = dp[n];
  cout << res << endl;
}

int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  cin >> n >> m;
  v = vector<int> (m);
  init();
  for (int i = 0; i < m; i++) {
    cin >> v[i];
  }
  for(auto a : v){
    dp[a] = -1;
  }
  solve();
}


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

int main() {
    int n;
    cin >> n;
    vector<int> A(n);
    int max_a = 0;
    for (int i = 0; i < n; i++) {
        int a;
        cin >> a;
        A[i] = a;
        max_a = max(max_a, a);
    }

    int mid = -1, min_diff = 1000000000;
    for (int i = 0; i < n; i++) {
        int diff = abs(A[i] - max_a / 2);
        if (diff < min_diff && A[i] != max_a) {
            min_diff = diff;
            mid = A[i];
        }
    }

    cout << max_a << " " << mid << endl;
    return 0;
}



Measured memory_bytes: 640
#include <iostream>
#include <algorithm>
#include <string>
using namespace std;

int main() {
  int h, w; cin >> h >> w;
  int field[100][100] = {};
  string tmp; getline(cin, tmp);

  for(int i = 0; i < h; i++) {
    string s; getline(cin, s);
    for(int j = 0; j < w; j++) {
      field[i][j] = s[j]-'0';
    }
  }

  for(int i = 0; i < h; i++) {
    for(int j = 0; j < w; j++) {
      if(i == 0 && j == 0) continue;
      else if(i == 0) field[i][j] += field[i][j-1];
      else if(j == 0) field[i][j] += field[i-1][j];
      else field[i][j] += min(field[i][j-1], field[i-1][j]);
    }
  }
  cout << field[h-1][w-1] << endl;
}

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

ll gcd(ll a,ll b){
    if(b==0)return a;
    return gcd(b,a%b);
}
//////////////////////////////////////
int main(){
    int n;
    cin>>n;
    vl a(n+1);
    arep(i,2,n+1){
        for(ll j=i;j<=n;j+=i){
            a[j]++;
        }
    }
    ll ans=0;
    arep(i,1,n+1){
        ans+=i*(a[i]+1);
    }
    cout<<ans<<endl;
    return 0;
}

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

using namespace std;
const int N = 1e5+5;
const int MOD = 1e9+7;
long long dp[N][15];
int main()
{
    string s;
    cin >> s;
    int n = s.length();
    if (s[0] == '?')
        for (int i = 0; i<10; i++)
            dp[0][i] = 1;
    else
        dp[0][s[0]-'0'] = 1;
    for (int i = 1; i<n; i++)
    {
        if (s[i] == '?')
        {
            for (int j = 0; j<10; j++)
                for (int k = 0; k<13; k++)
                {
                    dp[i][((k*10)+j)%13]+=dp[i-1][k];
                    dp[i][((k*10)+j)%13]%=MOD;
                }
        }
        else
        {
            for (int k = 0; k<13; k++)
            {
                dp[i][((k*10)+(s[i]-'0'))%13]+=dp[i-1][k];
                dp[i][((k*10)+(s[i]-'0'))%13]%=MOD;
            }
        }
    }
    cout << dp[n-1][5];
}


Measured memory_bytes: 12160
#include <bits/stdc++.h>
using namespace std;
#define MOD 1000000007
#define ll long long int
#define ull unsigned long long
#define si set <ll>
#define vi vector <ll>
#define popcount(x) __builtin_popcountll(x)
#define mii map <ll,ll>
#define vpi vector <pair <ll,ll> >
#define sz(c) (ll)c.size()
#define fr first
#define fastio ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define sc second
#define pb push_back
#define mp make_pair
#define all(a) (a).begin(),(a).end()
#define mem0(a) memset(a,0,sizeof(a))
#define rep(i,a,n) for(ll i=a ; i<n ; i++)
#define ld long double
const ll INF = __LONG_LONG_MAX__;
#define rall(a) (a).rbegin(),(a).rend()
#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
#pragma GCC optimization ("unroll-loops")

ll power(ll b,ll e,ll m)
{
  if(b==0) return 0;
  if(e==0) return 1;
  if(e&1) return b*power(b*b%m,e/2,m)%m;
  return power(b*b%m,e/2,m);
}
ll power( ll b, ll e)
{
  if(b==0) return 0;
  if(e==0) return 1;
  if(e&1) return b*power(b*b,e/2);
  return power(b*b,e/2);
}  
bool isPowerOfTwo(ll x)
{
    // x will check if x == 0 and !(x & (x - 1)) will check if x is a power of 2 or not
    return (x && !(x & (x - 1)));
}

ll ans(ll a[],ll n)
{
  ll sum=0;
  for(ll i=0;i<64;i++)
  {
    ll zero=0,one=0;
    for(ll j=0;j<n;j++)
    {
      if(a[j]&1) zero=(zero+1)%MOD;
      else one=(one+1)%MOD;
      a[j]/=2;
    }
    ll x=(zero%MOD*one%MOD*power(2,i,MOD))%MOD;
    sum=(sum%MOD+x%MOD)%MOD;
  }
  return sum%MOD;
}

void solve()
{
   ll n;
   cin>>n;
   ll a[n];
   rep(i,0,n) cin>>a[i];
   cout<<ans(a,n);
}

int main()
{
  fastio
  ll tt=1;
  // cin>>tt;
  while(tt--)
  {
      solve();
      cout<<"\n";
  }
}

Measured memory_bytes: 5936
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MOD = 1e9 + 7;
const ll INF = 1LL << 60;
ll mod_pow(ll, ll, ll);
ll mod_fact(ll, ll);
ll mod_inv(ll, ll);
//
int main(){
    ll a = 100;
    ll cnt = 0;
    ll x;
    cin >> x;
    while(a < x){
        a += a / 100;
        cnt++;
    }
    cout << cnt;
}


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

int main(){
  int a; cin >> a;
  
  a %= 10;
  
  if(a==3) cout << "bon" << endl;
  
  else if(a==0 || a==1 || a==6 || a==8) cout << "pon" << endl;
  
  else cout << "hon" << endl;
}

Measured memory_bytes: 3672
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i,n) for(int i = 0; i < (n); i++)
#define all(v) v.begin(), v.end()
#define MOD 1000000007
const int INF = 1LL<<30;

 
int main(){
    int n,m;
    cin>>n>>m;
    vector<int> s(m);
    vector<char> c(m);

    rep(i,m){
        cin>>s[i]>>c[i];
        s[i]--;
    }

    for(int i=0;i<1000;i++){
        stringstream iss; iss << i;
        string t = iss.str();
        if(t.size()!=n) continue;
        bool ok=true;
        rep(j,m){
            if(t[s[j]]!=c[j]) ok=false;
        }
        if(ok){
            cout<<i<<endl;
            return 0;
        }
    }

    cout<<-1<<endl;
}

Measured memory_bytes: 3608
#include<iostream>
#include<vector>
#include<queue>
#include<stack>
#include<string>
#include<cmath>
#include<algorithm>
#include<bitset>
#include<map>
#include<functional>
#include<set>


#pragma region
using namespace std;
#define FOR(i,r,n) for(ll i = (ll)(r); i < (ll)(n); i++)
#define RFOR(i,r,n) for(ll i=(ll)(n-1);i>=r;i--)
#define ALL(x) x.begin(),x.end()
#define RALL(x) x.rbegin(),x.rend()
#define LOWER(a,x) lower_bound(ALL(a), x) - a.begin() - 1;
#define COUNT(a,x)  upper_bound(ALL(a), x) - lower_bound(ALL(a), x);
#define MCOUNT(a,x,y) upper_bound(ALL(a), y) - lower_bound(ALL(a), x);
#define scan(x) scanf("%lld",&x);
#define inf 5555555555555555555
#define mod 1000000007
#define pi 3.14159265358979323846
#define pb push_back
#define F first
#define S second
typedef long long int ll;
typedef long double ld;
typedef vector<ll> vll;
typedef pair<ll, ll> pll;
typedef vector<pll> vpll;
typedef map<ll, ll> MAP;
typedef set<ll> SET;
ll n = 0, m = 0, ans = 0, sum = 0, cnt = 0, tmp = 0, ma = 0, mi = 0;
string s;
bool flag, ok;
ll dx[4] = { 1,-1,0,0 }, dy[4] = { 0,0,1,-1 };
ll ddx[9] = { 1,-1,0,0,1,1,-1,-1,0 }, ddy[9] = { 0,0,1,-1,1,-1,1,-1,0 };
#pragma endregion
#define MAX 111111

struct BIT {
  ll num;
  vll bit;

  void set(ll x) {
	num = x;
	bit.resize(x + 1, 0);
  }

  ll sum(ll i) {
	ll ret = 0;
	while (i > 0) {
	  ret += bit[i];
	  i -= i & -i;
	}
	return ret;
  }

  void add(ll i, ll x) {
	while (i <= num) {
	  bit[i] += x;
	  i += i & -i;
	}
  }

};

ll x[MAX * 2];
int main(void) {
  ll le, ri;
  BIT b;
  deque<ll> dq[30];
  cin >> s;
  n = s.length();
  b.set(n + 1);
  FOR(i, 0, n) {
	tmp = s[i] - 'a';
	dq[tmp].push_back(i + 1);
  }

  FOR(i, 0, 30) if (dq[i].size() % 2 == 1) cnt++;
  if (cnt > 1) {
	cout << "-1" << endl;
	return 0;
  }

  if (cnt) flag = true;
  FOR(i, 0, n) {
	tmp = s[i] - 'a';
	if (dq[tmp].empty()) continue;
	if (dq[tmp].size() == 1) {
	  m = dq[tmp].front(); dq[tmp].pop_front();
	  continue;
	}

	le = dq[tmp].front(); dq[tmp].pop_front();
	ri = dq[tmp].back(); dq[tmp].pop_back();
	ans += (n - ri) - (b.sum(n) - b.sum(ri));
	b.add(le, 1); b.add(ri, 1);
	x[le]++;
  }

  cnt = 0;
  FOR(i, 0, 2 * MAX) {
	if (i < m) cnt += x[i];
  }
  if (flag) ans += llabs(n / 2 - cnt);
  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 4484
#include <iostream>
#include <math.h>
using namespace std;

int x,y,s;
int tax(int r,int p);

int tax(int r,int p){ //r????¨????(%)???p????¨??????????
	return floor(p*(100+r)/100);
}

int main(){
	int maximum;
	while(cin>>x>>y>>s && x>0){
		maximum = 0;
		for(int i=1; i<s; i++){
			for(int j=1; j<s; j++){
				if((tax(x,i)+tax(x,j))==s){
					maximum = max(maximum, tax(y,i)+tax(y,j));
				}
			}
		}
	cout << maximum << endl;
	}
}

Measured memory_bytes: 3048
#pragma warning(disable:4996)
#include <bits/stdc++.h>
#define endl '\n'
#define FIO ios_base::sync_with_stdio(0); cin.tie(NULL)
#define pb push_back
#define pii pair<int,int>
#define ll long long int 
#define ui unsigned int
#define pll pair<ll,ll>
#define vi vector<int>
#define vll vector<ll>  
#define mp make_pair
#define F first
#define S second
#define sz size()
#define all(x) (x).begin(),(x).end() 
#define SORT(v) sort(all(v))
#define SORTD(v) sort(all(v),greater<int>())
#define SET(a,b) for(ui i=0;i<size(a);++i){a[i]=b;} 
#define test() int t; cin>>t ; while(t--)
#define FOR(i,a,b) for(int i=a;i<b;++i)  
#define cerr if(0)cerr
#define watch(x) cerr<<#x<<" is "<<x<<endl;
#define print(x) cout<<x<<endl
#define readv(v) FOR(i,0,n){cin>>v[i];}
#define printv(v) for(auto i : v){cout<<i<<" ";}cout<<endl;
const ll MOD=1e9+7;
ll powmod(ll a,ll b) {ll res=1;a%=MOD; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%MOD;a=a*a%MOD;}return res;}
ll gcd(ll a,ll b) { return b?gcd(b,a%b):a;}


//_________________________________________________________________________________

using namespace std;


int main()
{
	FIO;
	int n,t;
	cin>>n>>t;
	
	vector<vi> v(n+1);
	vi cnt(n+1,0);
	vll res(n+1,0);
	FOR(i,0,n-1)
	{
		int x,y;
		cin>>x>>y;
		v[x].pb(y);
      	v[y].pb(x);
	}
	
	while(t--)
	{
		int x,p;
		cin>>p>>x;
		cnt[p]+=x;
		
	}
	
	queue<int> q;
	q.push(1);
	res[1]=cnt[1];
	vector<bool> vis(n+1,false);
	vis[1]=true;
	while(!q.empty())
	{
		int temp=q.front();
		q.pop();
		
		for(auto i: v[temp])
		{
			if(!vis[i])
			{
				vis[i]=true;
				res[i]=res[temp]+cnt[i];
				q.push(i);
			}
		}
	}
	
	FOR(i,1,n+1)cout<<res[i]<<" ";
	return 0;

}
	
	






Measured memory_bytes: 17140
package main

import (
    "fmt"
)

func main() {
    var (
        n     int
        count int
    )
    fmt.Scan(&n)
    nums := make([]int, n)
    for i := 0; i < n; i++ {
        fmt.Scan(&nums[i])
    }

    flag := true
    for flag {
        for i := 0; i < n; i++ {
            if nums[i]%2 == 0 {
                nums[i] /= 2
            } else {
                flag = false
            }
        }
        if flag {
            count++
        }
    }
    fmt.Println(count)
}

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

#define ll long long
#define fornum(A,B,C) for(A=B;A<C;A++)
#define mp make_pair
#define pii pair<int,int>
#define pll pair<ll,ll>

using namespace std;

/////////////////////////////////////////////////////
#define MOD ((ll)1e9+7)

ll moddiv(ll a,ll b){
    a %= MOD;
    b %= MOD;
    for(ll m=MOD-2;m>0;m/=2){
        if(m&1){
            a=a*b%MOD;
        }
        b=b*b%MOD;
    }
    return a;
}

ll N, H, D;

ll dp[2020202],mk[2020202];
ll i, j, k,ans;
ll fa[1010101];
int main(){
    scanf("%lld%lld%lld", &N,&H,&D);
    fa[0] = 1;
    fornum(i,0,1010101){
        fa[i + 1] = fa[i] * (i + 1) % MOD;
    }
    ll aDd = 0;
    fornum(i,0,N){
        aDd = (aDd + fa[i+1]) % MOD;
    }

    k = fa[N];
    mk[D] = k;
    fornum(i,0,H-1){
        mk[i + 1 + D] = k * aDd%MOD;
        k = (k + k * aDd + MOD - mk[i + 1]) % MOD;   
    }
    printf("%lld", k);
    return 0;
}

Measured memory_bytes: 18688
#include <stdio.h>
#include <stdlib.h>
int  main()
{
	int a, b, c;
	scanf("%d",&a);
	scanf("%d",&b);
	scanf("%d",&c);
	if (a == b && b == c)
	{
		printf("1");
	} 
	else
	if (a != b && a != c && b != c)
	{
		printf("3");
	}
	else printf("2");
	system("pause");
}



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

int main(){
  
  int N;
  cin >> N;
  
  int L[N];
  for (int i = 0; i < N; i++) {
    cin >> L[i];
  }
  
  sort(L, L+N);
  
  int sum = 0;
  for (int i = 0; i < N-1; i++) {
    sum += L[i];
  }
  
  if(sum<=L[N-1]) cout << "No" << endl;
  else cout << "Yes" << endl;
  
  
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std; 
#define mod 1000000007
#define N 100005
#define ll long long
#define ull unsigned long long
#define loop1(i, j, k, step) for (int i=j; i<k; i+=step)
#define loop(i, j, k) for (int i=j; i<k; i++) 
#define rloop1(i, j, k, step) for (int i=j; i>=k; i-=step)
#define rloop(i, j, k) for(int i=j; i>=k; i--)
#define rep(i, k) for(int i = (0); i < (k); i++ )
#define rrep(i, k) for(int i = k-1; i >= 0; i-- )

#define forall(it, l) for(auto it=l.begin(); it != l.end(); it++)
#define mp make_pair
#define pb push_back
#define pop pop_back
#define F first
#define S second
#define sz(x) (int)(x).size()
#define endl "\n"
#define Max (int)INT_MAX
#define Min (int)INT_MIN
#define MEM(a, b) memset(a, (b), sizeof(a))
#define fast_io ios_base::sync_with_stdio(0), cin.tie(NULL)
typedef vector<int> vi;
typedef pair<int,int> pi;
typedef vector<ll> vl;
typedef pair<ll,ll> pll;


void solve()
{
	int n,i,j,k,l,a,c,b,sum=0;
	cin>>a>>b>>c>>k;
	l=min(k,a);
	sum=l;
	k=k-l;
	l=min(k,b);
	k-=l;
	l=min(k,c);
	sum-=l;
	k-=l;
	cout<<sum<<endl;
}
int  main() 
{
	auto start=clock();
	fast_io;
    int t=1;
    //cin>>t;
    while(t--)
    	solve();
    auto stop =clock();
    cerr<<"time taken:"<<double(stop-start)/double(CLOCKS_PER_SEC)<<" s"<<endl;
	return 0; 
}

Measured memory_bytes: 3820
import java.util.Scanner;
 
public class Main {
 
	public Main() {
		// TODO 自動生成されたコンストラクター・スタブ
	}
 
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int answer,index;
		String s,t;
		
			// 整数の入力
		
		s = sc.next();
		t = sc.next();
		sc.close();
		
		answer=0;
		for(index=0;index<3;index++) {
			if(s.substring(index,index+1).contentEquals(t.substring(index,index+1))) {
				answer=answer+1;
			}
		}
		System.out.print(answer);

			// 出力
 
	}
}

Measured memory_bytes: 22228
#include <iostream>
#include <iomanip>
// std::cout << std::setprecision(2) << 3.141; // "3.1"
#include <algorithm>
#include <vector>
#include <string>
#include <cmath>
#include <map>

using namespace std;

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> plglg;
typedef pair<double, ll> pdlg;
typedef tuple<int, int, int> tiii;
typedef tuple<ll, ll, ll> tlglglg;
typedef tuple<double, double, double> tddd;

static const int giga = pow(10,9);
// double pi = 3.141592653589793238463;


bool judge_acgt(char);

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

  int len_str = str.size();

  int ans = 0;
  int final_ans = 0;

  for(int i = 0; i < len_str; i++){
    int j = i;
    while(judge_acgt(str[j])){
      ans++;
      j++;
    }

    if(ans > final_ans){
      final_ans = ans;
    }
    ans = 0;
  }

  cout << final_ans << endl;

  return 0;
}

bool judge_acgt(char c){
  
  if(c == 'A' || c == 'C' || c == 'T' || c == 'G'){
    return true;
  } else {
    return false;
  }

  return false;
}

Measured memory_bytes: 256
/*    Mohammed Sami Khan
                       মোহাম্মদ সামী খান
*/
#include<bits/stdc++.h>
using namespace std;
#define pi acos(-1.0)
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
typedef long long ll;
typedef unsigned long long ull;

int main()
{
    fastio;
    ll t, n, m, i, p, q, r, sum=0, a, b, c, d, f=0;
    char *ye="YES", *no="NO";
    cin>>m;
    for(i=1;i<=m;i++){
        if(i%3==0 || i%5==0) continue;
        sum+=i;
    }
    cout<<sum<<endl;
}


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

using ll = long long;
using ull = unsigned long long;

using namespace std;

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

    ll a,b,c;

    cin>>a>>b>>c;

    if(a==b and b == c)
    {
        cout<<"No\n";
    }
    else if (a!=b and b!=c and a!=c)
    {
        cout<<"No\n";
    }
    else
    {
        cout<<"Yes\n";
    }
    

    return 0;
}

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

int N, M;
map<int, int> mp;

signed main() {
  cin >> N >> M;
  for(int i=0; i<M; i++) {
    int s,c;
    cin >> s >> c;
    if(mp.count(s) && mp[s] != c) { puts("-1"); return 0; }
    mp[s] = c;
  }

  int start=0, stop = 0;
  if(N==1) {
    start = 0;
    stop  = 9;
  }
  if(N==2) {
    start = 10;
    stop  = 99;
  }
  if(N==3) {
    start = 100;
    stop  = 999;
  }

  for(int i = start; i<=stop; i++) {
    auto S = to_string(i);
    //int s=1;
    //cerr << S << " " << S[N-s] << endl;
    bool ok=true;
    for(auto k : mp) {
      //cerr << k.first << " " << k.second << endl;
      if(S[k.first-1] != k.second + '0') {
        ok = false;
        break;
      }
    }
    if(ok) {
      cout << S << endl;
      return 0;
    }
  }
  puts("-1");
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <utility>
#include <functional>
#include <numeric>
#include <list>
#include <set>
#include <map>
#include <algorithm>
#include <cmath>
#include <limits>
#include <iomanip>
#include <bitset>
#include <queue>
#include <unordered_set>
#include <unordered_map>
#include <stdio.h>

#define rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=int(a);i<int(b);++i)
#define per(i,a,n) for (int i=n-1;i>=a;i--)
#define all(x) (x).begin(),(x).end()
#define SZ(x) ((int)(x).size())
#define INPUT1(n, a) for(int i##n = 0; i##n < n; i##n++) {cin >> a[i##n]; } //n = count, a = vector 
#define OUTPUT1(n, a) cout << "---count---" << endl << n << endl << "---content---" << endl; for(const auto b : a){cout << b << endl; }
#define INPUT2(x, y, field) for(int i##x = 0; i##x < y; i##x++) { for(int j##x = 0; j##x < x; j##x++) { cin >> field[i##x][j##x]; } }
#define OUTPUT2(x, y, field) cout << "---count---" << endl << x << " " << y << endl <<"---content---" << endl; for(int i##x = 0; i##x < y; i##x++) { cout << i##x << "   "; for(int j##x = 0; j##x < x; j##x++) { cout << field[i##x][j##x] << " "; } cout << endl; }

using namespace std;
using ll = long long;

const int INF = 1001001001;

int main()
{
	int a(0), b(0), m(0), ans(0), min_a(0), min_b(0);
	int m_a(0), m_b(0), m_dis(0), m_sum(0);
	int x(0);
	
	cin>>a>>b>>m;
	
	vector<int> va(a), vb(b), min_va(a), min_vb(b);
	
	rep(i, a){
	    cin>>x;
	    va[i] = x;
	    min_va[i] =x;
	}
	rep(i, b){
	    cin>>x;
	    vb[i] = x;
	    min_vb[i] =x;
	}
    
    sort(min_va.begin(), min_va.end());
    sort(min_vb.begin(), min_vb.end());
    
    min_a = min_va[0];
    min_b = min_vb[0];
    
    ans = min_a + min_b;
    
    //----------------------------------------------
    
    rep(i, m){
        cin>>m_a>>m_b>>m_dis;
        
        m_sum = va[m_a - 1] + vb[m_b - 1] - m_dis;
        
        ans = min(ans, m_sum);
    }
    
    cout<<ans;
}


Measured memory_bytes: 1792
#include<bits/stdc++.h>
using namespace std;
#define ll long long
inline ll read() {
    ll x=0,f=1; char ch=getchar();
    for(;ch<'0'||ch>'9';ch=getchar())
        if(ch=='-')f=-f;
    for(;ch>='0'&&ch<='9';ch=getchar())
        x=x*10+ch-'0';
    return x*f;
}
inline void chkmin( int &a,int b ) { if(a>b) a=b; }
inline void chkmax( int &a,int b ) { if(a<b) a=b; }
#define _ read()
const int N=2e5+5;
int n,a[N],tot,b[N],dp[N],sum[N]; 
vector < int > v[N];
const int mod=1e9+7;
int main() {
	n=_;
	dp[0]=1;
	for( int i=1;i<=n;i++ ) {
		a[i]=_;
		if(a[i]!=a[i-1]) b[++tot]=a[i];
	}
	n=tot;
	for( int i=1;i<=n;i++ ) {
		dp[i]=dp[i-1];
		dp[i]=(dp[i]+sum[b[i]])%mod;
		sum[b[i]]=(sum[b[i]]+dp[i-1])%mod;
	}
	printf("%d\n",dp[n]);
}
/*
1 3 1 2 3 3 2
*/

Measured memory_bytes: 8064
#include <bits/stdc++.h>
using namespace std;
template<typename T> bool chmax(T &a,T b) {if(a<b) {a=b; return true;} return false;}
template<typename T> bool chmin(T &a,T b) {if(a>b) {a=b; return true;} return false;}
#define itn int
#define fi first
#define se second
#define intmax numeric_limits<int>::max()
#define llmax numeric_limits<ll>::max():
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)
#define rrep(i,n) for(int i=(int)(n)-1;i>=0;i--)
#define rrep1(i,n) for(int i=(int)(n);i>=1;i--)
#define all(vec) vec.begin(),vec.end()
#define sortt(vec) sort((vec).begin(),(vec).end())
#define rsort(vec) sort((vec).rbegin(), (vec).rend())
typedef long long ll;
typedef long double ld;
typedef pair<ll,ll> pll;
typedef pair<int,int> pii;
typedef tuple<ll,ll,ll> tlll;
typedef tuple<int,int,int> tiii;
const ll mod=1e9+7;
const int inf=1<<30;
const ll lnf=1ll<<60;

int prevv[100010]; //頂点の最大数
struct edge{
  int to;
  ll cost;
};

vector<ll> dijkstra(int n,vector<vector<edge> > G,int s){
  fill(prevv,prevv+n,-1);
  priority_queue<pll,vector<pll>,greater<pll> > que;
  vector<ll> dist(n,lnf);
  dist[s]=0;
  que.push(pii(0,s));
  while(!que.empty()){
    ll cost; int v;
    tie(cost,v)=que.top();
    que.pop();
    if(dist[v]<cost) continue;
    for(int i=0;i<G[v].size();i++){
      edge e=G[v][i];
      ll nc=e.cost;
      int nv=e.to;
      if(dist[nv]>dist[v]+nc){
        dist[nv]=dist[v]+nc;
        prevv[nv]=v;
        que.push(pll(dist[nv],nv));
      }
    }
  }
  return dist;
}

//頂点への最短路
vector<int> get_path(int t){
  vector<int> path(0);
  for(;t!=-1;t=prevv[t]) path.push_back(t);
  reverse(path.begin(),path.end());
  return path;
}

int main(){
  int n,m; cin >> n >> m;
  vector<vector<edge> > g(n,vector<edge>(0));
  rep(i,n-1){
    g[i+1].push_back({i,0});
  }
  rep(i,m){
    int l,r; ll c;
    cin >> l >> r >> c;
    l--; r--;
    g[l].push_back({r,c});
  }
  vector<ll> dist=dijkstra(n,g,0);
  ll ans=dist[n-1];
  if(ans==lnf) cout << -1 << endl;
  else cout << dist[n-1] << endl;
}

Measured memory_bytes: 19364
import fractions
a, b = map(int, input().split())
c=fractions.gcd(a, b)
def prime_decomposition(n):
  i = 2
  table = []
  while i * i <= n:
    while n % i == 0:
      n /= i
      table.append(i)
    i += 1
  if n > 1:
    table.append(n)
  return table
d=list(set(prime_decomposition(c)))
ans=len(d)+1
print(ans)

Measured memory_bytes: 5048