akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define mp make_pair
#define pb push_back
#define sz(x) (int)x.size()
#define all(x) begin(x), end(x)
#define debug(x) cerr << #x << " " << x << '\n'
using namespace std;
using ll = long long;
using pii = pair<int,int>;
using pli = pair<ll,int>;
const int INF = 0x3f3f3f3f, N = 2e5 + 5;
const ll LINF = 1e18 + 5;
int n, t, dp[N];
struct node
{
	int a, b;
}p[N];
int main()
{
 	ios::sync_with_stdio(false);
 	cin.tie(0);
 	cin >> n >> t;
 	for(int i=1;i<=n;i++)
 		cin >> p[i].a >> p[i].b;
 	sort(p+1,p+n+1,[](node x,node y){ return x.a < y.a; });
 	int ans = 0;
 	for(int i=1;i<=n;i++)
		for(int j=t+p[i].a-1;j>=p[i].a;j--)
		{
			dp[j] = max(dp[j],dp[j-p[i].a]+p[i].b);
			ans = max(ans,dp[j]);
		}
	cout << ans;
	return 0;
}


Measured memory_bytes: 384
loop do
    n = gets.to_i
    break if n == 0
    a = gets.chomp.split
    h = Hash.new(0)
    ans = nil
    a.each.with_index do |s, i|
        h[s] += 1
        if h.size == 1 and h[s] > a.size - (i + 1)
            ans = [s, i + 1]
            break
        else
            second, first = h.keys.sort_by{|c| h[c]}[-2..-1]
            if h[first] > h[second] + a.size - (i + 1)
                ans = [first, i + 1]
                break
            end
        end
    end
    puts ans ? ans * ' ' : 'TIE'
end


Measured memory_bytes: 7688
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
#define rep(i, from, to) for (int i = from; i < (to); ++i)
#define mp(x,y) make_pair(x,y)
#define all(x) (x).begin(),(x).end()
#define sz(x) (int)(x).size()
using ll = long long;
using vin=vector<int>;
using vll=vector<ll>;
using P = pair<int, int>;
const int inf=1e9+7;
const ll INF=1e18;
template <typename T> void chmin(T &a, T b) { a = min(a, b); }
template <typename T> void chmax(T &a, T b) { a = max(a, b); }

int main() {
  int n=900000;
    bitset<1000000> is_prime(0); // 十分大きなサイズを確保します (ふるいの容量は1000000)
    for (int i = 2; i <= n; ++i) is_prime.set(i); // とりあえず全部ふるいに入れます( 000000000..001111111111111111...111111100)
    for (int i = 2; i <= n; ++i) {
        if (is_prime[i]) { // 素数 i を発見したら
            for (int j = i * 2; j <= n; j += i) {
                is_prime.reset(j); // i の倍数をふるい落とす
            }
        }
    }
  int q;
  cin>>q;
  int cnt[110000];//i番目までで2017数が何個あるか
  rep(i,0,110000){
    cnt[i]=0;
  }
  rep(i,3,110000){
    cnt[i]=cnt[i-1];
    if(is_prime[i]&&is_prime[(i+1)/2]) cnt[i]++;
  }
  rep(i,0,q){
   int r,l; 
    cin>>l>>r;
    cout<<cnt[r]-cnt[l-1]<<endl;
  }
}





Measured memory_bytes: 4176
#include <string>
#include <iostream>
#include <algorithm>
using namespace std;
int n, p[100009];
int main() {
	cin >> n;
	for (int i = 0; i < n; i++) cin >> p[i], p[i]--;
	string s = "0";
	for (int i = 0; i < n; i++) {
		if (p[i] == i) s += "1";
		else s += "0";
	}
	s += "0";
	int l = -1, ret = 0;
	for (int i = 0; i <= n; i++) {
		if (s[i] == '0' && s[i + 1] == '1') {
			l = i;
		}
		if (s[i] == '1' && s[i + 1] == '0') ret += (i - l + 1) / 2;
	}
	cout << ret << endl;
	return 0;
}

Measured memory_bytes: 896
#include<bits/stdc++.h>
#define rep(i,a,b)  for (__typeof(b) i=(a)-((a)>(b));i!=(b)-((a)>(b));i+=1-2*((a)>(b)))
using namespace std;
typedef long long ll;
int main(){
	int a,b,c;
	cin >> a >> b >> c;
	a*=100;
	b*=10;
	a = a+b+c;
	if(a%4 == 0) cout <<"YES";
	else cout <<"NO";
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define repd(i,a,b) for (int i=(a);i<(b);i++)
#define rep(i,n) repd(i,0,n)
#define all(x) (x).begin(),(x).end()
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
typedef long long ll;
const long long INF = 1LL << 60;
typedef pair<int, int> P;
int main()
{
    ll N, M, X;
    cin >> N >> M >> X;
    vector<ll> C(N);
    vector<vector<ll>> A(N, vector<ll>(M));

    rep(i, N) {
        cin >> C[i];
        rep(j, M) {
            cin >> A[i][j];
        }
    }

    ll ans = INF;
    rep(bit, (1 << N)) {
        vector<ll> able(M, 0);
        ll cost = 0;
        rep(i, N) {
            if ((bit >> i) & 1) {
                cost += C[i];
                rep(j, M) {
                    able[j] += A[i][j];
                }
            }
        }

        bool flag = true;
        rep(i, M) {
            if (able[i] < X) flag = false;
        }
        if (flag) chmin(ans, cost);
    }

    cout << (ans == INF ? -1 : ans) << endl;
    return 0;
}

Measured memory_bytes: 3572
#include <iostream>
#include <cstring>
#include <algorithm>
#include <vector>
#include <string>
#include <math.h>
#include <stdio.h>
#include <iomanip>
#include <limits>
#include <list>
#include <queue>
#include <tuple>
#include <map>
#include <set>
#include <sstream>
using namespace std;
#define ll long long int
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define reps(i,n) for(int i=1; i<=(int)(n); i++)
#define REP(i,n) for(int i=n-1; i>=0; i--)
#define REPS(i,n) for(int i=n; i>0; i--)
#define FOR(i,a,b) for(int i=a; i<(int)(b); i++)
#define ALL(x) (x).begin(),(x).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define SORT(c) sort(ALL(x))
#define CLR(a) memset((a), 0 ,sizeof(a))
#define PB push_back
#define MP make_pair
#define SP << " " <<
#define chmax(a, b) a = (((a)<(b)) ? (b) : (a))
const int INF = 1001001001;
const ll MOD = 1e9+7;
const ll LINF = 100100100100100100;
const double EPS = 1e-10;
const double PI  = acos(-1.0);
typedef pair<int,int> PII;
typedef pair<ll,ll> PLL;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<ll> VL;

template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){std::fill((T*)array, (T*)(array+N),val);}

class CompareDist
{
public:
    bool operator()(PLL n1,PLL n2) {
				if(n1.first!=n2.first) return n1.first<n2.first;
				else return n1.second<n2.second;
    }
};


__attribute__((constructor))
void initial(){
	cin.tie(nullptr);
	ios::sync_with_stdio(false);
	cout << fixed << setprecision(15);
}

signed main(){
	int a,b,c,d; cin>>a>>b>>c>>d;
  if(a!=c) cout << 1 << endl;
  else cout << 0 << endl;
  return 0;
}


Measured memory_bytes: 256
#!/usr/bin/env python3
import sys


def solve(N: int, M: int, s: "List[int]", c: "List[int]"):
    ans = ["1"] + ["0" for _ in range(N - 1)]
    if N == 1:
        ans = ["0"]

    modified = [False for _ in range(N)]

    for i in range(M):
        keta = s[i] - 1
        if modified[keta] and ans[keta] != str(c[i]):
            print(-1)
            return
        modified[keta] = True
        ans[keta] = str(c[i])

    if N > 1 and ans[0] == "0":
        print(-1)
        return

    print("".join(ans))
    return


# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    M = int(next(tokens))  # type: int
    s = [int()] * (M)  # type: "List[int]"
    c = [int()] * (M)  # type: "List[int]"
    for i in range(M):
        s[i] = int(next(tokens))
        c[i] = int(next(tokens))
    solve(N, M, s, c)


if __name__ == '__main__':
    main()


Measured memory_bytes: 3064
#include <iostream>
#include <vector>
#include <algorithm>

#define INF 1000000000

using namespace std;

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

    int N, K;
    cin >> N >> K;

    int A[N];
    for (int i = 0; i < N; ++i) cin >> A[i];

    sort(A, A + N);

    vector<int> kinds;
    int prev = -114514, chain = 0;
    for (int i = 0; i <= N; ++i) {
        if (i == N) {
            kinds.push_back(chain);
            continue;
        }

        if (prev == A[i]) {
            chain++;
        } else {
            if (chain)
                kinds.push_back(chain);
            chain = 1;
        }
        prev = A[i];
    }

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

    int ans = 0;
    while (kinds.size() > K) {
        ans += kinds[kinds.size() - 1];
        kinds.erase(kinds.end() - 1);
    }

    cout << ans << endl;
}

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

int main()
{
    ll n, max_weight;
    cin >> n >> max_weight;
    vector<ll> profit(n+1);
    vector<ll> weight(n+1);
    for(ll i = 1; i <= n; i++)
    {
        cin >> weight[i];
        cin >> profit[i];
    }
    int size = accumulate(profit.begin(), profit.end(), 0);
    vector<vector<ll>> dp(n+1, vector<ll>(size+1,INT_MAX));
    for(int i = 0; i <= n; i++)
        dp[i][0] = 0;
    for(int i = 1; i <= n; i++)
        for(int j = 1; j <= size; j++)
            if(profit[i] <= j)
                dp[i][j] = min(dp[i-1][j-profit[i]]+weight[i], dp[i-1][j]);
            else
                dp[i][j] = dp[i-1][j];

    int ans = 0;
    for(int i = 0; i <= size; i++)
        if(dp[n][i] <= max_weight)
            ans = i;
    cout << ans;
    return 0;
}


Measured memory_bytes: 83148
//AOJ ALDS1_1_B
#include <stdio.h>

int main () {
	int x,y,a,b,c,d;

	scanf("%d", &x);
	scanf("%d", &y);

	if (x >= y) {
		a = x;
		b = y;
	}else if (x < y) {
		b = x;
		a = y;
	}

	c = a % b;

	if (c == 0) {
		printf("%d\n", b);
	}else {
		while (c != 0) {
			d = b % c;
			b = c;
			c = d;
		}

		printf("%d\n", b);
	}

	return 0;
}


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

typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef pair<long long, long long> pll;


#define pb push_back
#define ff first
#define ss second
#define INF int(3e9)
#define BIG_INF ll(9e18)
#define SIZE 100001
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define len(v) int((v).size())
#define sqr(x) (x) * (x)
#define cube(x) (x) * (x) * (x)
#define filein freopen("input.txt", "r", stdin)
#define fileout freopen("output.txt", "w", stdout);


ll binpow(ll a, ll b, ll MOD = BIG_INF)
{
    ll res = 1;

    while(b)
    {
        if(b & 1)
            res *= a;
        a *= a;
        b >>= 1;
        a %= MOD;
        res %= MOD;
    }

    return res % MOD;
}

const ll mod = 1e9 + 7;

int T = 1;
ll n, m;
string s;


void solve()
{

    cin >> n >> m;


    ll k = n / m;

    k *= m;

    n -= k;


    while(abs(n - m) < n)
    {
        n = abs(n - m);
    }
    cout << n;
    return;
}


int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0); cout.tie(0);
//    filein;fileout;

//    cin >> T;

    while(T--)
    {
        solve();
    }
    return 0;
}


Measured memory_bytes: 3644
//----------------------Shanu Garg here---------------------
//-------------Search on youtube : Shanu Garg---------------
//-Studying at National Institute of Technology Delhi(NITD)-
//---------------------From Delhi, India--------------------

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

#define f(i,n) for(auto i=0;i<n;i++)
#define fr(i,n) for(auto i=n-1;i>=0;i--)
#define fs(i,a,b,c) for(auto i=a;i!=b;i+=c)
#define fl(i,x) for(auto i : x)
#define memset(a,first,last,val) fs(i,first,last,1) a[i]=val
#define nl cout<<"\n";
#define chk(x) cout<<#x<<x<<" ", nl
#define ll long long int
#define ull unsigned long long int
#define vi vector<int>
#define vvi vector<vi>
#define pr pair<ll, ll>
#define vii vector<pair<int, int>>
#define vll vector<pr>
#define vl vector<ll>
#define m(a,b) map<a, b>
#define mid(a,b) ((a+b)/2)
#define pb push_back
const int INF = 0x3f3f3f3f, mod = 1e9 + 7;

class triplet{
    public:
    ll f, s, t;};

vl in(ll n){vl v;ll x;
    f(i,n)
    cin>>x, v.pb(x);
    return v;}

vll in_pr(ll n){
    vll ar;
    ll x,y;
    f(i,n)
    {cin>>x>>y;
    ar[i]={x,y};
    }return ar;
}
void out(vl v, char ch='\0'){
    fl(i,v)
    cout<<i<<ch;
}

void solve(){
    ll A, P;
    cin>>A>>P;
    A*=3;
    A+=P;
    cout<<A/2;nl
}

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    solve();
   return 0;
}




Measured memory_bytes: 3640
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define ld long double
#define ll long long
#define P pair<int,int>
#define fi first
#define se second
#define rep(i,n) for(int i=0;i<n;i++)
#define all(v) v.begin(),v.end()
#define pb push_back
#define eb emplace_back
template<class T>void chmax(T &a,T b){if(a<b)a=b;}
template<class T>void chmin(T &a,T b){if(a>b)a=b;}
constexpr int INF=1000000000000000000;
constexpr int mod=1000000007;
constexpr double eps=1e-8;
const double pi=acos(-1);
int dx[]={0,1,0,-1},dy[]={1,0,-1,0};
int Random(int mi,int ma){
    random_device rnd;
    mt19937 mt(rnd());//32bit
    //[mi,ma]
    uniform_int_distribution<int>engine(mi,ma);
    return engine(mt);
}
int gcd(int a,int b){
    if(b==0)return a;
    return gcd(b,a%b);
}
int lcm(int a,int b){
    return a/gcd(a,b)*b;
}
bool prime(int a){
    if(a==1)return false;
    for(int i=2;i*i<=a;i++){
        if(a%i==0)return false;
    }
    return true;
}
int modpow(int a,int b){
    if(b==0)return 1;
    if(b%2)return modpow(a,b-1)*a%mod;
    int memo=modpow(a,b/2);
    return memo*memo%mod;
}
vector<int>kaijo,invkaijo;
void init_fact(int n){
    kaijo.resize(n+1);
    invkaijo.resize(n+1);
    kaijo[0]=1;
    for(int i=1;i<=n;i++){
        kaijo[i]=kaijo[i-1]*i;
        kaijo[i]%=mod;
    }
    rep(i,n+1)invkaijo[i]=modpow(kaijo[i],mod-2);
}
int comb(int a,int b){
    if(a<b)return 0;
    if(a<0||b<0)return 0;
    return kaijo[a]*modpow(kaijo[a-b],mod-2)%mod*modpow(kaijo[b],mod-2)%mod;
}
int inv(int x){
    x=modpow(x,mod-2);
    return x;
}

signed main(){
    cin.tie(0);ios::sync_with_stdio(false);
    int x,n,p[110];
    cin>>x>>n;
    set<int>st;
    rep(i,n){
        cin>>p[i];
        st.insert(p[i]);
    }
    for(int d=0;d<=100;d++){
        int l=x-d,r=x+d;
        if(!st.count(l)){
            cout<<l<<endl;
            return 0;
        }
        if(!st.count(r)){
            cout<<r<<endl;
            return 0;
        }
        
    }
    return 0;
}

Measured memory_bytes: 3668
# maspy先生のやつ：https://atcoder.jp/contests/ddcc2020-qual/submissions/8579127
import sys
import numpy as np

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

H, W, K = map(int, readline().split())

#bufferとして読み込む。H行とそれに合う横列の数を計算して整形。[:,:w]で改行コードを消す
grid = np.frombuffer(read(), 'S1').reshape(H, -1)[:, :W]

# ”＃”がある場所のインデックスを記録
X, Y = np.where(grid == b'#')

A = np.zeros((H, W), np.int32)
A[X, Y] = np.arange(1, K+1)

np.maximum.accumulate(A, axis=1, out=A)

for w in range(W-2, -1, -1):
  # ０なら右の数字を採用
  A[:, w] += A[:, w+1] * (A[:, w] == 0)

# イチゴがない行は前の行のやつを採用
for h in range(1, H):
  if A[h, -1] == 0:
    A[h] += A[h-1]
    
for h in range(H-1, -1, -1):
  if A[h, -1] == 0:
    A[h] += A[h+1]

print('\n'.join(' '.join(row) for row in A.astype(str)))

Measured memory_bytes: 20428
/*
 * 16-9-11_ABC045_C.cpp
 *
 *  Created on: 2016/09/11
 *      Author: ryoma
 */

#include<iostream>
#include<sstream>

using namespace std;

typedef long long ll;
ll ans;
string S;
stringstream ss;

void dfs(string s, int d) {
	ss.clear();
	ss.str("");
	s += S[d];
	ss << s;
	ll a;
	ss >> a;
	if (d < S.length() - 1)
		a *= 1ll << (S.length() - 1 - d - 1);
	ans += a;
	//cout << a << endl;
	if (d >= S.length() - 1) {
		return;
	}
	string sss;
	dfs(sss, d + 1);
	dfs(s, d + 1);
}

int main() {
	cin >> S;
	string s;
	dfs(s, 0);
	cout << ans << endl;
	return 0;
}



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

using namespace std;

int a[51];

int main() {
    ios_base::sync_with_stdio(false);
    int n, k;
    cin >> n >> k;
    for (int i = 0; i < n; ++i) {
        cin >> a[i];
    }
    sort (a, a + n);
    int ans = 0;
    while (k > 0) {
        ans+=a[n-1];
        n--;
        k--;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		String str = "";
		int counter = 0;
		while(scan.hasNext()){
			str = scan.next();
			if(str.equals("0")) break;
			counter++;
			System.out.println("Case " + counter + ": " + str);

		}
	}
}

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

const ll INF = 1001001001001;

int main(){
    ll a;string b;
    cin>>a>>b;
    
    ll b2 = 0;
    
    b2 = (b[0]-'0')*100 + (b[2]-'0')*10 + b[3]-'0';
    
    ll ans = a*b2;
    
    ans /= 100;
    
    cout << ans << endl;
    
    return 0;
}


Measured memory_bytes: 3604
#include <iostream>
#include <vector>
#include <algorithm>
#include <functional>
#include <cmath>
#include <map>
#include <set>

#define reps(i,s,n) for(int (i) = (s); (i) < (n); (i)++)
#define rep(i,n) reps(i,0,n)
using namespace std;
using ll = long long;

int main(){
    int n;
    cin >> n;
    vector<ll> arr[11];
    arr[0].push_back(3);// 3573,3575,3577,3357,5357,7357
    arr[0].push_back(5);// 3753,3755,3757,3375,5375,
    arr[0].push_back(7);//
    
    reps(i,1,10){
        //cout << i << endl;
        for(auto e : arr[i-1]){
            arr[i].push_back(10*e+3);
            arr[i].push_back(10*e+5);
            arr[i].push_back(10*e+7);
        }
    }

    int ans = 0,tmp=0,c=0;

    //rep(i,10){
        //cout << arr[i].size() << endl;
    //}

    reps(i,2,10){
        for(auto e: arr[i]){
            tmp = e;
            bool is_3=false,is_5=false,is_7=false;
            while(tmp > 0){
                c = tmp % 10;
                if(c == 3)is_3 = true;
                if(c == 5)is_5 = true;
                if(c == 7)is_7 = true;
                tmp /= 10;
            }
            if(e <= n && (is_3 && is_5 && is_7)){
                //cout <<"c:" <<  e << endl;
                ans++;
            }
        }
    }
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 1212
/*main*/
#include <iostream>
#include <stdio.h>
#include <cstdlib>
using namespace std;

typedef unsigned long long ULL;
const int N = 105;
ULL a[N];

/*get greatest common divisor*/
ULL getGCM(ULL a, ULL b)
{
    ULL temp;
    if(a < b)
    {
        temp = a;
        a = b;
        b = temp;
    }
    while(b != 0)
    {
        temp = a % b;
        a = b;
        b = temp;
    }
    return a;
}

ULL getLCM(ULL a, ULL b)
{
    ULL GCM = getGCM(a,b);
    return (a/GCM) * (b/GCM) * GCM;
}

int main()
{
    int n;
    cin >> n;
    for(int i=0; i<n; i++)
    {
        cin >> a[i];
    }
    for(int i=0; i<n-1; i++)
    {
        ULL temp = getLCM(a[i],a[i+1]);
        a[i+1] = temp;
    }
        cout << a[n-1];
    return 0;
}

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

int n;
vector<int> v(100000);

int main() {
	// your code goes here
	cin>>n;
	for(int i=0;i<n;++i)
	cin>>v[i];
	sort(v.begin(),v.end());
	cout<<v[v.size()-1]-v[v.size()-n]<<endl;
	return 0;
}

Measured memory_bytes: 640
object Main {

  def main(args: Array[String]): Unit = {
    val sc = new java.util.Scanner(System.in)

    val N = sc.nextInt(); sc.nextLine()
    val _S = sc.nextLine().split(" ")
    val S = _S(0)
    val T = _S(1)
    val r = S.zip(T).map(z => z._1.toString ++ z._2.toString).reduce(_ ++ _)
    println(r)
  }

}


Measured memory_bytes: 25672
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>

#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>

#include <functional>
#include <cassert>

typedef long long ll;
using namespace std;

#define debug(x) cerr << #x << " = " << x << endl;


#define mod 1000000007 //1e9+7(prime number)
#define INF 1000000000 //1e9
#define LLINF 2000000000000000000LL //2e18
#define SIZE 100010


int main(){
  int sx,sy,gx,gy;

  cin >> sx >> sy >> gx >> gy;

  for(int i=sy;i<gy;i++){
    printf("U");
  }
  for(int i=sx;i<gx;i++){
    printf("R");
  }
  for(int i=sy;i<gy;i++){
    printf("D");
  }
  for(int i=sx;i<gx;i++){
    printf("L");
  }
  printf("L");
  for(int i=sy;i<gy+1;i++){
    printf("U");
  }
  for(int i=sx;i<gx+1;i++){
    printf("R");
  }
  printf("DR");
  
  for(int i=sy;i<gy+1;i++){
    printf("D");
  }
  for(int i=sx;i<gx+1;i++){
    printf("L");
  }
  printf("U");

  puts("");
  
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <utility>
#include <algorithm>
#include <map>
#include <vector>
#include <cmath>
#include <cstdlib>
#include <queue>

using namespace std;

#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = n;i >= m;i--)
#define REPO(i, n) for(int i = 1;i <= n;i++)
#define ll long long
#define INF 999999999
#define MINF -999999999
#define ALL(n) n.begin(),n.end()
int n, s[100],a,co = 0,b = 0;

int main() {
	cin >> n;
	REP(i, n) {
		cin >> a;
		if (a >= 3200) b++;
		else if (s[a / 400] == 0) {
			co++;
			s[a / 400]++;
		}
	}
	cout << max(co,1) << " " << co + b << endl;
}


Measured memory_bytes: 256
import math
N = int(input())
a = 1
b = N
nn = math.sqrt(N)
n = math.ceil(nn)

for i in range(2, n+1):
    if N % i == 0:
        j = N // i    
        if (i + j) < (a + b):
            a = i
            b = j

print(a + b -2)

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

typedef long long ll;

int main() {
    int h,w; cin >> h >> w;
    queue<tuple<int,int,int>> q;
    vector<vector<bool>> reached(h, vector<bool>(w, false));
    int c=0;
    for (int i=0; i<h; ++i) {
        string s; cin >> s;
        for (int k=0; k<w; ++k) {
            if (s[k]=='#') {
                q.push(make_tuple(i,k,0));
                reached[i][k]=true;
                ++c;
            }
        }
    }
    int dx[4]={-1,1,0,0};
    int dy[4]={0,0,1,-1};
    if (c==h*w) {
        cout << 0;
        return 0;
    }
    while(1) {
        tuple<int,int,int> f=q.front();
        int cst=get<2>(f);
        q.pop();
        for (int i=0; i<4; ++i) {
            int ny=get<0>(f)+dy[i];
            int nx=get<1>(f)+dx[i];
            if (nx>=0 && nx<w && ny>=0 && ny<h && !reached[ny][nx]) {
                q.push(make_tuple(ny,nx,cst+1));
                reached[ny][nx]=true;
                ++c;
                if (c==h*w) {
                    cout << cst+1;
                    return 0;
                }
            }
        }
    }
    return 0;
}

Measured memory_bytes: 12560
#include<iostream>
#include<climits>
#include<numeric>
#include<algorithm>
#include <sstream>
#include<cstring>
#include<cmath>
#include<iterator>
#include<utility>
#include<array>
#include<vector>
#include<deque>
#include<queue>
#include<stack>
#include<list>
#include<forward_list>
#include<set>
#include<unordered_set>
#include<map>
#include<unordered_map>
#define ll long long
#define ull unsigned long long
#define vi vector<int>
#define vlli vector<long long int>
#define vvi vector<vector<int>>
#define vpii vector<pair<int,int>>
#define vs vector<string>
#define lin1(x) ll int x; x = scan();
#define lin2(x,y) ll int x, y; x = scan(), y = scan();
#define lin3(x,y,z) ll int x, y, z; x = scan(), y = scan(), z = scan();
#define pb(x) push_back(x)
#define makep(x,y) make_pair(x,y)
#define mx(a,b) (a)>(b)?(a):(b)
#define mn(a,b) (a)<(b)?(a):(b)
#define fori(s,e) for(i=s;i<=e;i++)
#define forj(s,e) for(j=s;j<=e;j++)
#define fork(s,e) for(k=s;k<=e;k++)
#define rep(i,s,e) for(int i=s;i<=e;i++)
#define brep(i,s,e) for(int i=s;i>=e;i--)
#define all(x) x.begin(),x.end()
#define mem(x,y) memset(x,y,sizeof(x));
#define bits1(x) __builtin_popcount(x)
#define pi 3.14159265358979323846264338327950
#define MOD7 1000000007
#define MOD9 1000000009
#define fast std::ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
using namespace std;

int main()
{
#ifdef RAHUL
    freopen("input.txt","r",stdin);
#endif
ll t;
string s;
cin>>t;
cin>>s;
ll count=0;

for (int i = 0; i < s.length()-2; ++i)
{
	/* code */
	if(s[i]=='A' &&s[i+1]=='B'&&s[i+2]=='C')
	{
		count++;
	}
}
cout<<count<<endl;
}



Measured memory_bytes: 888
#include <stdio.h>
#include <stdlib.h>

int main(){

    int N;
    char s[4];

    scanf("%d",&N);
    s[3] = '\0';
    sprintf(s,"%d", N);

    int judge = 0;
    int i;

    for(i = 0; i < 3; i++){
        if(s[i] == '7'){
            judge = 1;
        }
    }

    if(judge == 0){
        printf("No");
    }else{
        printf("Yes");
    }
  
  return 0;
}

Measured memory_bytes: 1732
#include <bits/stdc++.h>
using namespace std;
int main()
{
    string S;
    cin >> S;
    vector<int> cnt(2, 0);
    for (int i = 0; i < S.size(); i++)
    {
        cnt[S[i] - '0']++;
    }
    cout << min(cnt[0], cnt[1]) * 2 << endl;
    return 0;
}


Measured memory_bytes: 512
import math

def main():
    A, B, H, M = map(int, input().split(' '))
    h_ratio = 2*math.pi*(H + M/60)/12
    m_ratio = 2*math.pi*(M/60)

    a_pos_x = A*math.cos(h_ratio)
    a_pos_y = A*math.sin(h_ratio)
    b_pos_x = B*math.cos(m_ratio)
    b_pos_y = B*math.sin(m_ratio)

    dist = math.sqrt((a_pos_x - b_pos_x)**2 + (a_pos_y - b_pos_y)**2)
    print(dist)


if __name__ == '__main__':
    main()


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

#define mp make_pair
#define pb push_back
#define REP(i,a,n) for(int i = a;i < (n);i++)
#define rep(i,n) for(int i = 0;i < (n);i++)
#define all(s) s.begin(), s.end()
#define rall(s) s.rbegin(), s.rend()
#define range(x,min,max) ((min) <= (x) && (x) <= (max))
#define xyrange(x, minX, maxX, y, minY, maxY) (range(x, minX, maxX) && range(y, minY, maxY))

using namespace std;

typedef long long LL;
typedef vector<int> VI;
typedef vector<vector<int> > VVI;
typedef vector<string> VS;
typedef vector<bool> VB;
typedef pair<int,int> PII;
typedef vector<PII> VPII;


const int DX[]={1,0,-1,0},DY[]={0,-1,0,1};
const int INF = INT_MAX / 2;

int main(){
	cin.tie(0);
   	ios::sync_with_stdio(false);
	int n, l;
	cin >> n >> l;
	VS ss;
	rep (i, n) {
		string s;
		cin >> s;
		ss.pb(s);
	}
	sort(all(ss));
	string ans;
	for (string s : ss) {
		ans += s;
	}
	cout << ans << endl;
	return 0;
}



Measured memory_bytes: 256
#include <iostream>

using namespace std;
int main(void){
	int n;
	cin >> n;
	int nums[n];	
	int sum=0;
	for(int i=0; i<n;i++){
		cin >> nums[i];
		sum+=nums[i];
	}
	int med = sum/n;
	int ans = n*100000;
	for(int m=med-10; m <= med+10; m++){
	int res=0;
	for(int e : nums){
		int x = e - m;
		res+=x*x;
	}
	ans = min(ans, res);
	}
	cout << ans << endl;
}

Measured memory_bytes: 3604
#include <iostream>
#include <vector>
#include <map>
#include <unordered_map>
#include <queue>
#include <set>
#include <algorithm>
#include <string>
#include <math.h>
#include <limits.h>
#include <stack>
#include <complex>
#include <stdlib.h>
#include <stdio.h>
#include <functional>
#include <cfloat>
#include <math.h>
#include <numeric>
#include <string.h>
#include <sys/time.h>
#include <random>


#define fs first
#define sc second

using namespace std;

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

bool prime(int x){
    for(int i = 2; i * i <= x; i++){
        if(x % i == 0){
            return false;
        }
    }
    return true;
}

int main(){
    int x;
    cin >> x;
    for(int i = x; i <= 1000000; i++){
        if(prime(i)){
            cout << i << endl;
            break;
        }
    }


    return 0;
}


Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

public class Main {

	public static void main(String[] args) throws IOException {
		Main mainObj = new Main();
		mainObj.solve();
	}

	public void solve() throws IOException {
		FastScanner fs = new FastScanner();
		String s = fs.next();
		int ans = 700;
		for(int i = 0; i < s.length(); i++) {
			if(s.charAt(i) == 'o') {
				ans += 100;
			}
		}
		System.out.println(ans);
	}

	

	public class FastScanner {

		BufferedReader reader;
		private StringTokenizer st;

		public FastScanner() {
			st = null;
			reader = new BufferedReader(new InputStreamReader(System.in));
		}

		public String next() throws IOException {
			if (st == null || !st.hasMoreElements()) {
				st = new StringTokenizer(reader.readLine());
			}
			return st.nextToken();
		}

		public String nextLine() throws IOException {
			st = null;
			String readLine = null;
			readLine = reader.readLine();
			return readLine;
		}

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

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

		public int[] nextIntArr(int n) throws NumberFormatException, IOException {
			int[] retArr = new int[n];
			for (int i = 0; i < n; i++) {
				retArr[i] = nextInt();
			}
			return retArr;
		}

		public long[] nextLongArr(int n) throws NumberFormatException, IOException {
			long[] retArr = new long[n];
			for (int i = 0; i < n; i++) {
				retArr[i] = nextLong();
			}
			return retArr;
		}

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

}


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

using ll = long long;
using ull = unsigned long long;
using ld = long double;

#define MOD 1000000007LL

#define rep(i, n) for(ll (i) = 0LL;(i) < (ll)(n);(i)++)
#define rep2(i, s, e) for(ll (i) = (ll)(s);(i) < (ll)(e);(i)++)
#define repi(i, n) for(ll (i) = 0LL;(i) <= (ll)(n);(i)++)
#define repi2(i, s, e) for(ll (i) = (ll)(s);(i) <= (ll)(e);(i)++)
#define per(i, n) for(ll (i) = (ll)(n) - 1LL;(i) >= 0LL;(i)--)
#define per2(i, s, e) for(ll (i) = (ll)(s) - 1LL;(i) >= (ll)(e);(i)--)
#define peri(i, n) for(ll (i) = (ll)(n);(i) >= 0LL;(i)--)
#define peri2(i, s, e) for(ll (i) = (ll)(s);(i) >= (ll)(e);(i)--)
#define iter(i, it) for(auto &(i): (it))

template<typename T, typename U> ostream& operator<<(ostream &s, const pair<T, U> m) {
    cout << "(" << m.first << ", " << m.second << ")";
    return s;
}
template<typename T, typename U> ostream& operator<<(ostream &s, const map<T, U> m) {
    ll c = 0;
    cout << "{ ";
    iter(i, m) cout << i << (c++ == m.size() - 1 ? " " : ", ");
    cout << "}";
    return s;
}
template<typename T> ostream& operator<<(ostream &s, const vector<T> &v) {
    cout << "{ ";
    rep(i, v.size()) cout << v[i] << (i == v.size() - 1 ? " " : ", ");
    cout << "}";
    return s;
}
template<typename T> ostream& operator<<(ostream &s, const list<T> &v) {
    ll c = 0;
    cout << "{ ";
    iter(i, v) cout << i << (c++ == v.size() - 1 ? " " : ", ");
    cout << "}";
    return s;
}

int main(void) {
    ll H, W;
    cin >> H >> W;
    ll N;
    cin >> N;
    queue<pair<ll, ll>> Q;
    rep(i, N) {
        ll temp;
        cin >> temp;
        Q.push({temp, i + 1});
    }
    while(!Q.empty()) {
        rep(h, H) {
            vector<ll> line;
            rep(w, W) {
                Q.front().first--;
                if(h % 2) line.insert(line.begin(), Q.front().second);
                else line.push_back(Q.front().second);
                if(Q.front().first <= 0) Q.pop();
            }
            rep(i, W) {
                cout << line[i];
                if(i != W - 1) cout << ' ';
            }
            cout << endl;
        }
    }
    return 0;
}


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

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

  vector<int> v(n);
  rep(i,m) {
    int a,b;
    cin >> a >> b;
    v.at(a-1)++;
    v.at(b-1)++;
  }

  rep(i,n)
    cout << v.at(i) << endl;
}


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

typedef long lint;
typedef long long llint;
// 22:22
// static const int MAX = 1e6;
// static const int NIL = -1;
// static const ll INF = 1<<21;
// static const ll MOD = 1e9 + 7;

// bool compPair(const pair<int, int>& arg1, const pair<int, int>& arg2) {
//     return arg1.first > arg2.first;
// }

// template<class T> void chmin(T& a, T b) {
//     if (a > b) {
//         a = b;
//     }
// }

// template<class T> void chmax(T& a, T b) {
//     if (a < b) {
//         a = b;
//     }
// }
    
int main(void) {
    long n;
    cin >> n;

    queue<string> q;
    q.push("3");
    q.push("5");
    q.push("7");

    long ans=0, now=0, count3, count5, count7;
    string s;
    while(now<=n) {
        s = q.front(); q.pop();
        now = stol(s);

        count3 = count(s.begin(), s.end(), '3');
        count5 = count(s.begin(), s.end(), '5');
        count7 = count(s.begin(), s.end(), '7');
        if(count3*count5*count7&&now<=n) ans++;

        q.push(s+"3");
        q.push(s+"5");
        q.push(s+"7");
    }

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


Measured memory_bytes: 4480
#pragma region Macros
#include <bits/stdc++.h>

using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
using WGraph = vector<vector<pair<int, ll>>>;

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

constexpr int dx[4] = {-1, 0, 0, 1}, dy[4] = {0, -1, 1, 0};
constexpr int INF = 1e9;
constexpr long long LINF = 1e18;
constexpr long long MOD = 1e9 + 7;
constexpr double EPS = 1e-10;
constexpr double PI = M_PI;
#pragma endregion

void solve() {
    int n;
    ll a, b;
    cin >> n >> a >> b;
    vector<ll> h(n);
    for (int i=0; i<n; i++) {
        cin >> h.at(i);
    }

    int ok = 1e9, ng = 0;
    int dif = a - b;
    while (abs(ok - ng) > 1) {
        ll mid = (ok + ng) / 2;
        ll cnt = 0;
        for (int i=0; i<n; i++) {
            ll rem = h.at(i) - b * mid;
            if (rem > 0) {
                cnt += rem / dif + (rem % dif != 0);
            }
        }
        if (cnt <= mid) {
            ok = mid;
        } else {
            ng = mid;
        }
    }

    cout << ok << '\n';
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << fixed << setprecision(20);

    solve();

    return 0;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
  ll r,g,b,n;
  cin >> r>>g>>b>>n;
  ll ans=0;
  for (ll i=0;i<=n/r;i++) {
    for (ll j=0;j<=(n-r*i)/g;j++) {
      if ((n-r*i-g*j)%b==0) {
        ans++;
      }
    }
  }
  cout<<ans<<endl;
}

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

#define rep(i, a, n)  for(int i=a; i<n; i++)
#define per(i, a, n)  for(int i=n-1; i>=a; i--)
#define all(x)  (x).begin(), (x).end()
#define MAX 1e18
using namespace std;
typedef long long ll;

int main(){
  int n, m; cin >> n >> m;
  vector<int> a(m), b(m);
  vector<int> ans(n+1, 0);
  rep(i, 0, m){
    cin >> a[i] >> b[i];
    ans[a[i]]++;
    ans[b[i]]++;
  }
  rep(i, 1, n+1){
    cout << ans[i] << endl;
  }
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)n;i++)
using namespace std;
typedef double D;
typedef complex<D> P;
const D EPS = 1e-8;
const D PI = acos(-1);

int n,r,q,r2;
P p[30];
int cur;
D min_s[30],x,y;

inline D dot(const P &x, const P &y){return real(conj(x)*y);}

inline P rotate(const P &v, const D &s){
  return P(real(v)*cos(s) - imag(v)*sin(s), real(v)*sin(s) + imag(v)*cos(s) );
}

inline D arg(const P &a,const P &b,const P &c){return acos(dot(b-a,c-a)/(abs(b-a)*abs(c-a)));}

inline D rot_seta(const int &end){
  D dis = norm(p[end]-p[cur]);
  D seta = acos( (r2 - dis)/(r2) );
  P nxt = rotate(p[cur],-seta);
  return arg(p[cur],p[end],nxt);
}

int main(){
  while(scanf("%d%d%d",&n,&r,&q), n){
    r2 = 2*r*r;
    rep(i,n){
      scanf("%lf%lf",&x,&y);
      p[i] = P(x,y);
      if(abs(abs(p[i])-r)<EPS)cur = i;
    }
    
    vector<int> nxt(n,-1);

    rep(i,q){
      if(nxt[cur]<0){
	min_s[cur] = PI;
	rep(j,n){
	  if(cur==j)continue;
	  D s = rot_seta(j);
	  if(nxt[cur]<0 || s+EPS < min_s[cur])nxt[cur] = j, min_s[cur] = s;
	}
      }

      rep(j,n){
	if(j==cur)continue;
	p[j] = rotate(p[j]-p[cur],min_s[cur]) + p[cur];
      }
      printf("%.9lf %.9lf\n",p[nxt[cur]].real(), p[nxt[cur]].imag());

      if(i==0){
	int tmp = nxt[cur];
	nxt[cur] = -1;
	cur = tmp;
      }else{
	cur = nxt[cur];
      }
    }
  }
}

Measured memory_bytes: 1336
#include<stdio.h>
 
#define MAX 100000
 
int parent(int);
int left(int);
int right(int);
 
int main(){
  int i,n,arr[MAX+1];
 
  scanf("%d",&n);
  for(i=1;i<=n;i++)
    scanf("%d",&arr[i]);
 
  for(i=1;i<=n;i++){
    printf("node %d: key = %d, ",i,arr[i]);
    if(parent(i) >= 1)printf("parent key = %d, ",arr[parent(i)]);
    if(left(i) <= n)printf("left key = %d, ",arr[left(i)]);
    if(right(i) <= n)printf("right key = %d, ",arr[right(i)]);
    printf("\n");
  }
 
  return 0;
}
 
int parent(int i){
 
  return i/2;
}
 
int left(int i){
 
  return 2 * i;
}
 
int right(int i){
 
  return 2 * i + 1;
}

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

void printAns(int N) {
  if(N >= 0) cout << N << endl;
  else cout << 0 << endl;
}

int main() {
  int a, b; cin >> a >> b;
  int c, d; cin >> c >> d;
  if(a <= c) {
    if( b <= d ) printAns(b-c);
    else printAns(d - c);
  } else {
    if( b <= d ) printAns(b - a);
    else printAns(d - a);
  }

  return 0;
}


Measured memory_bytes: 256
N, M = list(map(int, input().split()))
mn = 0
mx = N
f = False
for i in range(M):
    tmn, tmx = list(map(int, input().split()))
    if mn < tmn:
        mn = tmn
    if tmx < mx:
        mx = tmx
    if mx < mn:
        f = True
        break
if f:
    print(0)
else:
    print(mx - mn + 1)


Measured memory_bytes: 3188
#include <bits/stdc++.h>
#define l_ength size
const int inf = (1<<30);
const int mod = 998244353;
using ll = long long;
using namespace std;

ll dp[3050][3050];

int main(){
	int n; ll s;
	cin >> n >> s;
	vector<ll> a(n);
	for( auto &k : a ) cin >> k;
	dp[0][0] = 1;
	for( int i = 0; i < n; ++i ){
		for( int j = 0; j <= s; ++j ){
			dp[i+1][j] += 2*dp[i][j];
			dp[i+1][j] %= mod;
			if( j+a[i] <= s ){
				dp[i+1][j+a[i]] += dp[i][j];
				dp[i+1][j+a[i]] %= mod;
			}
		}
	}
	cout << dp[n][s] << endl;
}

Measured memory_bytes: 75060
d, n = map(int,input().split())

i = 0
count = 0
beki = 0


if d == 0:
    beki = 1
elif d == 1:
    beki = 100
else:
    beki = 10000


while not count == n:
    i += 1
    if i % 100 == 0:
        continue
    count += 1

print(i * beki)

Measured memory_bytes: 3060
# -*- coding: utf-8 -*-
n, m, x = map(int, input().split())
L = []
J = []
for i in range(n):
    l = list(map(int, input().split()))
    L.append(l)
for i in range(2**n):
    cost = 0
    f = 0
    M = [0]*m
    for j in range(n):
        
        if (i>>j)&1 == 1:
            cost += L[j][0]
            for k in range(m):
                M[k] += L[j][k+1]
    for p in M:
        if p < x:
            f = 1
    if f == 0:
        J.append(cost)
if J != []:
  print(min(J))
else:
  print(-1)

Measured memory_bytes: 68284
#include<iostream>
#include<cstring>
#include<algorithm>


using namespace std;

const int mx=1e5+123;

long long dp[123][mx],  v[mx];
int n, tw, cw, w[mx];

long long solve(int i, int cw)
{

    if(i>=n)
        return 0;
    if(dp[i][cw]!= -1)
        return dp[i][cw];

    long long ret[2]= {};

    if((cw+ w[i])<= tw)
        ret[0]= v[i]+ solve(i+1, cw+ w[i]);
    ret[1]= solve(i+1, cw);

    return dp[i][cw]= max(ret[0], ret[1]);

}

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

    for(int i=0; i<n; i++)
        cin>> w[i]>> v[i];

    memset(dp, -1, sizeof(dp));

    cout<< solve(0, 0)<< endl;

    return 0;
}


Measured memory_bytes: 99864
#include <bits/stdc++.h>
using namespace std;
#define int long long
typedef pair<int, int> ii;
typedef vector<int> vi;
typedef vector<ii> vii;
#define pb push_back
#define ld long double
#define f first
#define s second
#define in insert
#define sz(x) (int)x.size()
#define all(x) (x).begin(), (x).end()
#define speed ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
const int INF = 1e18 + 5;
const int mod = 1e9 + 7;
const int  N = 2e5 + 314;
const long double pi = 3.1415926535897932384626433832795;
void solve(){
    int a, b, c, k;
    cin>>a>>b>>c>>k;
    while(b<=a){
        if(k==0)break;
        b*=2;
        k--;
    }
    while(c<=b){
        if(k==0)break;
        k--;
        c*=2;
    }
    if(c>b&&b>a)cout<<"Yes\n";
    else cout<<"No\n";
}
signed main(){
    speed;
    int t=1;
    //cin>>t;
    while(t--)solve();
}

Measured memory_bytes: 3644
import numpy as np
n=int(input())
sm=0
za=[]
def dis(x,y):
  x=np.array(x)
  y=np.array(y)
  return np.linalg.norm(x-y)
for i in range(n):
  za.append(list(map(int,input().split())))

for i in range(n):
  for j in range(n):
    sm+=dis(za[i],za[j])
print(sm/n)

Measured memory_bytes: 12496
using namespace std;
#include<bits/stdc++.h>
#define int long long
#define pb push_back 
#define IOS ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define ff first
#define ss second
#define all(x) x.begin(), x.end()
#define repa(i,a,b) for (int i=a; i<=b; i++)
#define repd(i,b,a) for (int i=b; i>=a; i--)
#define endl "\n"
//debugging
#define debug1(a) cout<<#a<<" = "<<(a)<<endl;
#define debug2(a,b) cout<<#a<<" = "<<(a)<<", "<<#b<<" = "<<(b)<<endl;
#define debug3(a,b,c) cout<<#a<<" = "<<(a)<<", "<<#b<<" = "<<(b)<<", "<<#c<<" = "<<(c)<<endl;
#define debug4(a,b,c,d) cout<<#a<<" = "<<(a)<<", "<<#b<<" = "<<(b)<<", "<<#c<<" = "<<(c)<<", "<<#d<<" = "<<(d)<<endl;

const int N = 1e+6+5;
int big = 1e+18+3;
int mod = 1e+9+7;

signed main()
{
    IOS;
    int n,k; cin>>n>>k;
    map<int,int>coeff;
    int total = 0;
    repa(i,1,n+1)
    {
        coeff[i] = i*n - i*(i-1) + 1;
        if (i>=k)
        {
            //debug2(i,coeff[i]);
            total+=coeff[i];
            total%=mod;
        }
    }
    cout<< total <<endl;
    

    
}

Measured memory_bytes: 16152
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <math.h>
#include <complex>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <unordered_map>
#include <set>
#include <bitset>
#include <functional>
#include <assert.h>
#define int long
#define ll long long
#define rng(i,a,b) for(int i=int(a);i<int(b);i++)
#define rep(i,b) rng(i,0,b)
#define gnr(i,a,b) for(int i=int(b)-1;i>=int(a);i--)
#define per(i,b) gnr(i,0,b)
#define eb emplace_back
#define all(x) x.begin(),x.end()
#define SZ(x) x.size()
#define fi first
#define se second
const int INF = 1e9;
using namespace std;

template<class t> using vc=vector<t>;
template<class t> using vvc=vc<vc<t>>;

using pi=pair<int,int>;
using vi=vc<int>;

template<class T>
inline bool chmax(T &a,T b){if(a<b){a=b;return true;}return false;}
template<class T>
inline bool chmin(T &a,T b){if(a>b){a=b;return true;}return false;}

signed main() {
    cin.tie(0);
    ios::sync_with_stdio(0);
    cout<<fixed<<setprecision(20);

    int a,b,h; cin >> a >> b >> h;
    cout << (a+b)*h/2 << endl;
}

Measured memory_bytes: 256
import heapq
from collections import defaultdict
x, y, z, K = map(int, input().split())
A = sorted(map(int, input().split()), reverse=True)
B = sorted(map(int, input().split()), reverse=True)
C = sorted(map(int, input().split()), reverse=True)
visited = defaultdict(bool)
Q = [(-(A[0]+B[0]+C[0]), 0, 0, 0)]

for _ in range(K):
    S, i, j, k = heapq.heappop(Q)
    print(-S)
    if i+1 < x and not visited[i+1, j, k]:
        heapq.heappush(Q, (-(A[i+1]+B[j]+C[k]), i+1, j, k))
        visited[i+1, j, k] = True

    if j+1 < y and not visited[i, j+1, k]:
        heapq.heappush(Q, (-(A[i]+B[j+1]+C[k]), i, j+1, k))
        visited[i, j+1, k] = True

    if k+1 < z and not visited[i, j, k+1]:
        heapq.heappush(Q, (-(A[i]+B[j]+C[k+1]), i, j, k+1))
        visited[i, j, k+1] = True


Measured memory_bytes: 5068
#include <bits/stdc++.h>
#include <queue>
#define ll long long
using namespace std;
int t,m,x;
const int maxn=1e5+5;
int b[maxn];

int main()
{
    priority_queue <int> q;
    scanf("%d%d",&t,&m);
    for(int i=1;i<=t;i++)
    {
        scanf("%d",&x);
        q.push(x);
    }
    while(m--)
    {
        int x=q.top();
        q.pop();
        x=x/2;
        q.push(x);
    }
    ll ans=0;
    while(!q.empty())
    {
        ans+=q.top();
        q.pop();
    }
    printf("%lld",ans);
    return 0;
}


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

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

#define FOR(i, n, m) for (ll(i) = (m); (i) < (n); ++(i))
#define REP(i, n) FOR(i, n, 0)
#define OF64 std::setprecision(10)

const ll MOD = 1000000007;
const ll INF = (ll)1e15;

int calc(int n)
{
    int m = 0;
    while (n > 0)
    {
        m += n % 10;
        n /= 10;
    }
    return m;
}
int main()
{
    ll N, A, B;
    cin >> N >> A >> B;
    ll n = 0;
    FOR(i, N + 1, 1)
    {
        int m = calc(i);
        if (A <= m && m <= B)
            n+=i;
    }
    cout << n << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <vector>
#include <string>
#include <stdlib.h>
#include <algorithm>
#include <functional>
 
using namespace std;
 
int main(void) {
	unsigned long int A, B, X = 0;
	cin >> A;
	cin >> B;
	
	if(A > B){
	    X += A;
	    A--;
	}else{
	    X += B;
	    B--;
	}
	
    if(A > B){
	    X += A;
	}else{
	    X += B;
	}

    cout << X;
	return 0;
}

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

#define int long long 
#define pb push_back
#define S second
#define F first
#define f(i,n) for(int i=0;i<n;i++)
#define fast ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define vi vector<int>
#define pii pair<int,int>

vector<bool> isprime(10004,true);
vector<int> primes;

int ans =0;

 map<int,int> mpp;
 map<int,int> fre;   

void sieve()
{
 isprime[1] = isprime[0] = 0;
    
 for(int i=2;i<=10000;i++)
 {
  if(isprime[i])   
  { primes.pb(i);
     for(int j=i*i;j<=10000;j+=i) isprime[j] = 0;
  }
 }
}

void getredu(int n)
{
  int redu = 1;
  int inv = 1;  
  int temp = n;
    
  for(auto x : primes)
  {
      int cn = 0;
      
      while(temp % x == 0)
      {
       temp/=x;
       cn++;
      }
      
      cn%=3;
      
      if(cn == 1) { redu*=x; inv*=(x*x);}
      else if(cn==2) { redu*=(x*x); inv*=(x); }
  }
    
  if(temp > 1e5)
  {
      int hh = sqrt(temp);
      
      if(hh*hh == temp )
      {
       redu*=(temp);
       inv*=(hh);   
      }
      else { ans++; return; } 
  }
  else
  {
    inv*=(temp*temp);
    redu*=temp;  
  }
     
    mpp[redu] = inv;
    fre[redu]++;
}

void solve()
{
 sieve();   
    
 int n;
 cin >> n;
    
 int a[n];
 f(i,n) cin >> a[i];
    
 f(i,n) getredu(a[i]);   
    
    
 for(auto x : mpp)
 {
     if(x.F == 1) {
      if(x.S > 0)  ans++;
      fre[1] = 0;   
     }
     else 
     {
        ans+=max(fre[x.F],fre[x.S]);    
        fre[x.F] = 0;
        fre[x.S] = 0;
     }      
 }
    
    cout << ans;
}

signed main()
{
    fast;
    
    int t = 1;
    
//    cin >> t;
    
    while(t--)
        
    solve();
}

Measured memory_bytes: 16512
while true
	n,p = gets.split(" ").map{|e|e.to_i}
	break if n==0 && p==0

	array=Array.new(n,0)
	array[0]=1
	i=0
	cup = p-1
	while !(cup == 0 && array.count(0)==n-1)
		i+=1
		i=0 if i>=n
		if cup > 0
			array[i] += 1
			cup -= 1
		else
			cup = array[i]
			array[i]=0
		end
		#p array
		#p cup
	end
	p i
end

Measured memory_bytes: 6104
#include <bits/stdc++.h>
#define IOS                                                                    \
  ios::sync_with_stdio(0);                                                     \
  cin.tie(0);                                                                  \
  cout.tie(0)
#define pb push_back
#define ff first
#define ss second
#define all(x) (x).begin(), (x).end()
using namespace std;
using ll = long long;
using vi = vector<int>;
using pii = pair<ll, ll>;
const int INF = 0x3f3f3f3f;
ll bpow(ll b, ll p, ll m) {
  ll rt = 1;
  for (; p; p >>= 1, b = b * b % m)
    if (p & 1)
      rt = rt * b % m;
  return rt;
}
int cnt[10000005];
int main() {
  IOS;
  ll n;
  cin >> n;
  for (int i = 1; i <= n; i++) {
    for (int j = i; j <= n; j += i)
      cnt[j]++;
  }
  ll ans = 0;
  for (int i = 1; i <= n; i++)
    ans += 1LL * i * cnt[i];
  cout << ans << endl;
}

Measured memory_bytes: 42704