akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include<stdio.h>
using namespace std;

int main()
{
    long long i, j, n, w[100001], v[100001], W;
    //freopen("INPUT.INP","r",stdin);

    cin>>n>>W;
    long long  f[n+1][W+1];
    for (i=1;i<=n;i++)
    {
        cin>>w[i]>>v[i];
    }
    f[0][0]=0;
   for (i=0;i<=n;i++)
        f[i][0]=0;

   for (j=0;j<=W;j++)
        f[0][j]=0;

    for (i=1;i<=n;i++)
        for (j=1;j<=W;j++)
        {
            if (j<w[i])
                f[i][j]=f[i-1][j];
            else
                f[i][j]=max(f[i-1][j],f[i-1][j-w[i] ]+v[i]);
        }


   cout<<f[n][W];

    return 0;
}


Measured memory_bytes: 79104
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <sstream>
#include <queue>

#define INPUT_FROM_FILE (0) 
#if INPUT_FROM_FILE
#include <fstream>
#endif

int main(int argc, char **argv){
	std::string buf;
	std::priority_queue<long> que;

#if INPUT_FROM_FILE
	std::ifstream ifs("test.txt");
	//FILE *fp = fopen("test.txt", "r");
#endif


	for(;;){
#if INPUT_FROM_FILE
		std::getline(ifs, buf);
#else
		std::getline(std::cin, buf);
#endif

		if(buf == "end"){
			break;
		}
		else if(buf == "extract"){
			std::cout << que.top() << std::endl;
			que.pop();
		}
		else{
			std::istringstream stream(buf);
			long k;

			stream >> buf >> k;
			que.push(k);
		}

	}
	return 0;
}


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

int main(){
    int n,m,x;
    cin>>n>>m>>x;
    vector<int>c(n);
    vector<vector<int>>a(n,vector<int>(m));
    rep(i,n){
        cin>>c[i];
        rep(j,m){
            cin>>a[i][j];
        }
    }
    int ans=1e9;
    for(int bit=1; bit<(1<<n); ++bit){
        int cnt=0;
        vector<int>d(m,0);
        for(int i=0; i<12; ++i){
            if(bit&(1<<i)){
                rep(j,m){
                    d[j]+=a[i][j];
                }
                cnt+=c[i];
            }
        }
        bool ng=false;
        rep(i,m){
            if(d[i]<x)ng=true;
        }
        if(!ng)ans=min(ans,cnt);
    }
    if(ans!=1e9)cout<<ans<<endl;
    else cout<<-1<<endl;
    return 0;
}

Measured memory_bytes: 3632
#include <bits/stdc++.h>
#define tt this->
#define ll long long
using namespace std;
int main ()
{
string s;
cin>>s;
if (s=="AAA"||s=="BBB")
    cout<<"No";
else
    cout<<"Yes";



    return 0;
}

/*
▀█████████▄     ▄████████    ▄████████    ▄████████
  ███    ███   ███    ███   ███    ███   ███    ███
  ███    ███   ███    ███   ███    ███   ███    ███
 ▄███▄▄▄██▀    ███    ███  ▄███▄▄▄▄██▀   ███    ███
▀▀███▀▀▀██▄  ▀███████████ ▀▀███▀▀▀▀▀   ▀███████████
  ███    ██▄   ███    ███ ▀███████████   ███    ███
  ███    ███   ███    ███   ███    ███   ███    ███
▄█████████▀    ███    █▀    ███    ███   ███    █▀
                            ███    ███

*/


Measured memory_bytes: 3628
import sys
input = sys.stdin.readline
from heapq import *

def dijkstra():
    dist = [10**18]*N
    dist[0] = 0
    pq = []
    heappush(pq, (0, 0))
    
    while pq:
        d, v = heappop(pq)
        
        if dist[v]<d:
            continue
        
        for nv, w in G[v]:
            if dist[nv]>dist[v]+w:
                dist[nv] = dist[v]+w
                heappush(pq, (dist[nv], nv))
    
    return dist

N, M = map(int, input().split())
G = [[] for _ in range(N)]

for i in range(1, N):
    G[i].append((i-1, 0))
    
for _ in range(M):
    L, R, C = map(int, input().split())
    G[L-1].append((R-1, C))

ans = dijkstra()[-1]

if ans==10**18:
    print(-1)
else:
    print(ans)

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

#define sz(s) (int)(s).size()
#define re(i, n) for (int i = 1; i <= n; i ++)
#define pb push_back
#define finish(x) return cout << x << endl, 0
#define MP make_mair
#define trav(x, a) for(auto& x: a)
#define all(x) (x).begin,(x).end()
#define Sor(x) sort(all(x))
#define REV(x) reverse(all(x))
#define F first
#define S second
#define I insert
#define N 222222
#define MOD 100000007

using namespace std;

typedef long long ll;
vector <ll> vll;
template <class T> bool umin(T& a, T b) {if(a>b){a = b; return 1;}return 0;}
template <class T> bool umax(T& a, T b) {if(a<b){a=b; return 1;}return 0;}
template <class T, class TT> bool pal(T a, TT n){int k = 0; for(int i =0; i <= n / 2; i ++){if(a[i]!=a[n-i-1]){k=1;break;}}return k?0:1;}

ll powmod(ll a, ll b, ll m = MOD){ll r = 1;while(b>0){if(b&1)r=r*a%m;a=a*a%m;b>>=1;}return r;}


int main()
{	
	string s;
	char c;
	cin >> c;
	s = "abcdefghijklmnopqrstuvwxyz";
	for(int i = 0; i < sz(s); i ++)
		if (s[i] == c)
			return cout << s[i + 1], 0; 









	getchar();
	getchar();
	return 0;
}

Measured memory_bytes: 256
import java.util.*;
import java.lang.*;
import java.math.*;

public class Main {
	Scanner sc = new Scanner(System.in);

	void run() {
		int n = sc.nextInt();
		int k = sc.nextInt();
		int t = sc.nextInt();
		int u = sc.nextInt();
		int v = sc.nextInt();
		int l = sc.nextInt();

		int d[] = new int[n + 1];

		for (int i = 0; i < n; i++) {
			d[i] = sc.nextInt();
		}
		d[n] = l;

		int index = 0;
		int nc = 0;
		int cn = 0;
		long boost = t * v;

		
		int bl = 0;
		for (int i = 0; i < l; i++) {
			if (d[index] <= i) {
				if (cn == 0) {
					nc = i;
				}
				if (cn == k+1) {
					nc = i;
				} else {
					cn++;
				}
				index++;
			}
			
			if (cn !=0 &&i - nc == boost) {
				nc = i;
				cn--;
			}
			if(cn > 0){
				bl++;
			}
		}
		int nbl = l-bl;
		
		System.out.println((double)bl/v + (double)nbl/u);
	}

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

Measured memory_bytes: 12000
from collections import deque
n, m = map(int, input().split())

graph = [[] for _ in range(n+1)]
deg = [0]*(n+1)
for i in range(m):
    u, v = map(int, input().split())
    graph[u].append(v)
    deg[v] += 1
q = deque()

for i in range(1, n+1):
    if deg[i] == 0:
        q.append(i)

dp = [0]*(n+1)
while q:
    n = q.popleft()
    for s in graph[n]:
        deg[s] -= 1
        if deg[s] == 0:
            q.append(s)
            dp[s] = dp[n]+1

print(max(dp))


Measured memory_bytes: 87712
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n; ++i)
#define REPR(i, n) for (int i = n - 1; i >= 0; --i)
#define FOR(i, a, b) for (int i = a; i < b; ++i)
#define FORR(i, a, b) for (int i = b - 1; i >= a; --i)
#define SORT(v) sort(v.begin(), v.end())
#define SORTR(v) sort(v.rbegin(), v.rend())
#define REV(v) reverse(v.begin(), v.end())
#define ITER(itr, v) for (auto itr = v.begin(); itr != v.end(); ++itr)
#define LB(v, x) (lower_bound(v.begin(), v.end(), x) - v.begin())
#define UB(v, x) (upper_bound(v.begin(), v.end(), x) - v.begin())
#define SZ(v) (int)v.size()
using namespace std;
using ll = long long;
using P = pair<int, int>;

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

	int n;
	cin >> n;
	vector<ll> fib(n + 1);
	fib[0] = 1;
	fib[1] = 1;
	FOR(i, 2, n + 1) {
		fib[i] = fib[i - 1] + fib[i - 2];
	}
	cout << fib[n] << endl;

	return 0;
}


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

#define F first
#define S second

using namespace std;
typedef long long ll;

const int max_n = 200022, inf = 1000111222;

int n, a[max_n], k, cnt[max_n];
set<int> s;

// void write(int l, int r) {
//     for (int i = l; i < r; ++i) cout << a[i] << " "; cout << endl;
// }

int b[max_n];
void write(int l, int r) {
    for (int i = 0; i < n; ++i) b[i] = a[i];
    sort(b + l, b + r);
    for (int i = 0; i < n; ++i) cout << b[i] << " "; cout << endl;
}

int main() {
    cin >> n >> k;
    int mx = 0;
    for (int i = 0; i < n; ++i) {
        scanf("%d", &a[i]);
        cnt[i] = 1;
        if (i && a[i - 1] < a[i]) cnt[i] += cnt[i - 1];
        mx = max(mx, cnt[i]);
    }
    for (int i = 0; i < k; ++i) {
        s.insert(a[i]);
    }
    int ans = cnt[k - 1] < k;
    if (mx >= k) ++ans;
    for (int i = k; i < n; ++i) {
        if ((a[i - k] != (*s.begin()) || a[i] < (*s.rbegin())) && cnt[i] < k) {
            //write(i - k + 1, i + 1);
            ++ans;
        }
        s.erase(a[i - k]);
        s.insert(a[i]);
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 11136
#include <iostream>

using namespace std;

int main() {
	int D, L,a,b;
	cin >> D >> L;

	if (D < L) 
	{
		cout << D << endl;
	}
	else if (D == L)
	{
		cout << "1" << endl;
	}
	else if (D > L)
	{
		a = D / L;
		b = D % L;

		cout << (a + b) << endl;
	}
	return 0;
}


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

#define int long long
#define itn int
#define For(i, a, b) for (int i = (a); i <= static_cast<int>(b); i++)
#define Forr(i, a, b) for (int i = (a); i >= static_cast<int>(b); i--)
#define rep(i, n) For(i, 0, n - 1)
#define repall(i, arr) for (auto& i : (arr))
#define all(x) (x).begin(), (x).end()
#define pb push_back
#define dump(x) cerr << #x << " = " << (x) << '\n'
#define dump2(x, y) \
    cerr << #x << " = " << (x) << " " << #y << " = " << (y) << '\n'
#define SZ(x) ((int)(x).size())
#define bit(n) (1LL << (n))
constexpr int MOD = 1e9 + 7;

template <typename T>
using pq = priority_queue<T>;
template <typename T>
using pqr = priority_queue<T, vector<T>, greater<T>>;
const int INF = LLONG_MAX / 2;
using P = pair<int, int>;
using vec = vector<int>;
template <typename T>
using mat = vector<vector<T>>;

// clang-format off
template <typename T1, typename T2>
ostream& operator<<(ostream& stream, const pair<T1, T2>& p) { return stream << p.first << "," << p.second; }
template <typename T>
void print(const vector<T> vec) { rep (i, vec.size() - 1) cout << vec[i] << ' '; cout << vec[vec.size() - 1] << '\n'; }
template <typename Arg>
void print(const Arg arg) { cout << arg << '\n'; }
template <typename Head, typename... Args>
void print(const Head head, const Args... args) { cout << head << " "; print(args...); }
template <typename T, typename U>
void init(vector<T>& v, vector<U>& w) { rep (i, v.size()) cin >> v[i] >> w[i]; }
template <typename T>
void init(vector<T>& v) { rep (i, v.size()) cin >> v[i]; }
template <typename T>
T sum_(vector<T> vec, T init = 0) { return std::accumulate(all(vec), T(init)); }
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; }
template <typename T>
int index(const T& vec, const typename T::iterator it) { return distance(vec.begin(), it); }
template <typename T = int>
mat<T> mmat(int n, int m=0) { return mat<T>(n, vector<T>(m)); }
template <typename T = int>
vector<T> ivec(int n) { vector<T> v(n); init(v); return v; }
// clang-format on

void yn(bool tf) { print(tf ? "Yes" : "No"); }
void YN(bool tf) { print(tf ? "YES" : "NO"); }

int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
// -------------------------------------------------------------------
// sort 1 2 3 4
// pqr 1 2 3 must impl >

signed main() {
    cin.tie(0), cout.tie(0), ios::sync_with_stdio(false);
    int n;
    cin >> n;
    vec l = ivec(n);
    sort(all(l));
    int cnt = 0;
    rep (i, n) {
        For(j, i + 1, n - 1) {
            For(k, j + 1, n - 1) {
                if (l[i] == l[j]) continue;
                if (l[j] == l[k]) continue;
                if (l[k] == l[i]) continue;
                if (l[i] + l[j] > l[k]) cnt++;
            }
        }
    }
    print(cnt);

    return 0;
}


Measured memory_bytes: 3656
macro_rules! scan {
    ($t:ty) => {
        {
            let mut line: String = String::new();
            std::io::stdin().read_line(&mut line).unwrap();
            line.trim().parse::<$t>().unwrap()
        }
    };
    ($t:ty;;) => {
        {
            let mut line: String = String::new();
            std::io::stdin().read_line(&mut line).unwrap();
            line.split_whitespace()
                .map(|t| t.parse::<$t>().unwrap())
                .collect::<Vec<_>>()
        }
    };
    ($t:ty; $n:expr) => {
        (0..$n).map(|_|
                    scan!($t)
        ).collect::<Vec<_>>()
    };
    ($t:ty;;$n:expr) => {
        (0..$n).map(|_| scan!($t;;)).collect::<Vec<_>>()
    };
    ($($t:ty),*; $n:expr) => {
        (0..$n).map(|_|
                    scan!($($t),*)
        ).collect::<Vec<_>>()
    };

    ($($t:ty),*) => {
        {
            let mut line: String = String::new();
            std::io::stdin().read_line(&mut line).unwrap();
            let mut iter = line.split_whitespace();
            (
                $(iter.next().unwrap().parse::<$t>().unwrap(),)*
            )
        }
    };
}

fn main() {
    let (n, k) = scan!(usize, usize);
    let mut vs = scan!(i64;;);
    vs.sort();
    println!("{}", vs[(n - k)..].iter().sum::<i64>());
}


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

#define rep(i,n) for(int i=0;i<(int)n;i++)
#define all(c) (c).begin(),(c).end()
#define mp make_pair
#define pb push_back
#define each(i,c) for(__typeof((c).begin()) i=(c).begin();i!=(c).end();i++)
#define dbg(x) cerr<<__LINE__<<": "<<#x<<" = "<<(x)<<endl

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> pi;
const int inf = (int)1e9;
const double INF = 1e12, EPS = 1e-9;

int n, x, y, dp[2][666][666];

int main(){
	const int GETA = 333;
	rep(i, 666) rep(j, 666) dp[0][i][j] = -inf;
	dp[0][GETA][GETA] = 0;
	
	int cur = 0, next = 1;
	cin >> n >> x >> y;
	rep(i, n){
		rep(k, 666) rep(j, 666) dp[next][k][j] = dp[cur][k][j];
		int a, b, c, d; cin >> a >> b >> c >> d;
		
		rep(j, 666) rep(k, 666) if(dp[cur][j][k] >= 0){
			dp[next][j - a][k + b] = max(dp[next][j - a][k + b], dp[cur][j][k]);
			dp[next][j][k - c] = max(dp[next][j][k - c], dp[cur][j][k] + d);
		}
		swap(cur, next);
	}
	int ans = 0;
	rep(i, 666) rep(j, 666) if(dp[cur][i][j] >= 0 && x + i - GETA >= 0
		&& y + j - GETA >= 0) ans = max(ans, dp[cur][i][j]);
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 6576
#include <array>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stdexcept>
#include <utility>
#include <vector>

using namespace std;
using pii = pair<int, int>;
using mii = map<int, int>;

constexpr int64_t __pow_mod(int64_t n, int64_t p, int64_t mod) noexcept {
    if (p == 0) {
        return 1;
    }
    if (p % 2 == 0) {
        int64_t t = __pow_mod(n, p / 2, mod);
        return (t * t) % mod;
    }
    return n * __pow_mod(n, p - 1, mod) % mod;
}

constexpr int64_t pow_mod(int64_t n, int64_t p, int64_t mod) noexcept {
    int64_t res = __pow_mod(n, p, mod);
    if (res == 0) {
        res = mod;
    }
    return res;
}

constexpr int64_t nCr_mod(int64_t n, int64_t r, int64_t mod) noexcept {
    int64_t count = 1;
    auto a = r;
    for (auto i = n; i > n - r; i--) {
        count *= i;
        if (count % mod != 0) {
            count %= mod;
        }
        int64_t inv = pow_mod(a, mod - 2, mod);
        count *= inv;
        if (count % mod != 0) {
            count %= mod;
        }
        a--;
    }
    return count;
}

int main() {
    int X, Y;
    cin >> X >> Y;

    if (X > 2 * Y || Y > 2 * X) {
        cout << 0 << endl;
        return 0;
    } else if ((X + Y) % 3 != 0) {
        cout << 0 << endl;
        return 0;
    } else if ((X + Y) < 3) {
        cout << 0 << endl;
        return 0;
    }

    int diff = abs(X - Y);
    int total = (X + Y) / 3;
    int a = (total - diff) / 2;
    int b = a + diff;

    constexpr int mod = 1e9 + 7;
    cout << nCr_mod(a + b, a, mod) << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <fstream>
#include <cmath>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <cstdlib>
#include <cstdio>
#include <string>
#include <cstring>
#include <cassert>
#include <utility>
#include <iomanip>
#include <chrono>
#include <random>
#include <bitset>

using namespace std;

#define sz(x) (int) x.size()
#define all(a) a.begin(), a.end()
#define y1 aksjdaskdjksjfksdjf
#define left kdnvldvoiwejifejg
#define right lkdsjflksdjfdjfk
#define prev asdasfsadjkjsdfjs
#define tm aklsjdasjdasjdkdjjf
#define lcm hddalkwjeidjjhasda
#define random_shuffle asdasdd

int n;

int main() {

    cin >> n;

    long long ans = 0;

    ans = 1000 * (n / 500);
    n %= 500;
    ans += 5 * (n / 5);

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define pb emplace_back
using namespace std;
using ll = long long;
const int maxn = 300010;
int n, k, a[maxn], b[maxn];
signed main(){
	ios_base::sync_with_stdio(0), cin.tie(0);
	cin >> n >> k;
	for (int i = 1;i <= n;++i) 
		cin >> a[i];
	while (k--) {
		if (*min_element(a+1, a+n+1) == n) break;
		for (int i = 1;i <= n;++i) 
			++b[ max(1, i-a[i]) ], --b[ min(n+1, i+a[i]+1) ];
		for (int i = 1;i <= n;++i)
			a[i] = b[i] += b[i-1];
		fill(b, b+n+1, 0);
	}
	for (int i = 1;i <= n;++i)
		cout << a[i] << " \n"[i==n];

			
}



Measured memory_bytes: 5224
def gcd(a, b):
    if b == 0:
        return a
    else:
        return gcd(b, a%b)

A, B, C, D = map(int, input().split())

CD = C*D//gcd(C, D)

count1 = (B // C - (A - 1) // C)
count2 = (B // D - (A - 1) // D)
count3 = (B // CD - (A - 1) // CD)

print(B - (A - 1) - ((count1 + count2) - count3))

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

int main() {
	string s;
	cin >> s;
	int a = 0, b = 0, c = 0, d = 0;
	int n = s.size();
	rep(i, n) {
		if (s[i] == 'N') a++;
		if (s[i] == 'W') b++;
		if (s[i] == 'S') c++;
		if (s[i] == 'E') d++;
	}
	if (a > 0 && c == 0) {
		puts("No");
		return 0;
	}
	if (c > 0 && a == 0) {
		puts("No");
		return 0;
	}
	if (b > 0 && d == 0) {
		puts("No");
		return 0;
	}
	if (d > 0 && b == 0) {
		puts("No");
		return 0;
	}
	puts("Yes");
	return 0;
}

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

int main(){
    string s;
    cin >> s;
    int n = s.size();
    for(int i = 0; i < n; i++){
        if(i % 2 == 1){
            if(s.at(i) == 'R'){
                cout << "No" << endl;
                return 0;
            }
        }else if(i % 2 == 0){
            if(s.at(i) == 'L'){
                cout << "No" << endl;
                return 0;
            }
        } 
    }
    cout << "Yes" << endl; 
    return 0;
}

Measured memory_bytes: 256
def main():
    p = []
    sum_cost = 0
    n = int(input())
    for i in range(n):
        p.append(int(input()))
    max_p = max(p)
    p[p.index(max_p)] = max_p / 2
    print(int(sum(p)))


if __name__ == '__main__':
    main()


Measured memory_bytes: 8932
#include<stdio.h>
int main(){
  int a[3];
  int i;
  for(i=0;i<3;i++){
    scanf("%d",&a[i]);
    if(a[i]==5){
      a[i]=0;
    }else if(a[i]==7){
      a[i]=1;
    }
  }
  if(a[0]+a[1]+a[2]==1){
    printf("YES\n");
  }else{
    printf("NO\n");
  }
  return(0);
}


Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
#define ll long long int 
#define fastio ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
int gcd(int a,int b){
	return (b==0)?a:gcd(b,a%b);
}
int main(){
	#ifndef ONLINE_JUDGE
		freopen("input.txt","r",stdin);
		freopen("output.txt","w",stdout);
	#endif
	int t;
	cin>>t;
	unordered_map<int,int>mp;
	while(t--){
		int a;
		cin>>a;
		++mp[a];
	}
	for(auto x:mp){
		if(x.second%2==0){
			cout<<"NO";
			return 0;
		}
	}
	cout<<"YES";
	return 0;
}


Measured memory_bytes: 11388
//#include <iostream>
#include <fstream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cstring>
#include <cstdlib>
#include <ctime>
#include <iomanip>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <queue>
#include <climits>
#include <bitset>

using namespace std;

const int SIZE = 1 << 17;
int pointer = SIZE;
char buffer[SIZE];

char Advance() {
    if (pointer == SIZE) {
        fread(buffer, 1, SIZE, stdin);
        pointer = 0;
    }
    return buffer[pointer++];
}

int Read() {
    int answer = 0;
    char ch = Advance();
    while (!isdigit(ch))
        ch = Advance();
    while (isdigit(ch)) {
        answer = answer * 10 + ch - '0';
        ch = Advance();
    }
    return answer;
}

int main() {
    //freopen("tema.in", "r", stdin);
    //freopen("tema.out", "w", stdout);
    long long x, y;
    scanf("%lld%lld", &x, &y);
    int answer = 0;
    while (x <= y) {
        answer++;
        x *= 2;
    }
    printf("%d\n", answer);
    return 0;
}


Measured memory_bytes: 256
import sys
import heapq, math
from itertools import zip_longest, permutations, combinations, combinations_with_replacement
from itertools import accumulate, dropwhile, takewhile, groupby
from functools import lru_cache
from copy import deepcopy

O = list(input())
E = list(input())

print("".join([o + (e if e else "") for (o, e) in zip_longest(O, E)]))

Measured memory_bytes: 9596
string = input()
odd = 'RUD'
even = 'LUD'
ans = "Yes"
for i in range(len(string)):
    if (i % 2 != 0 and string[i] not in even) or (i % 2 == 0 and string[i] not in odd):
        ans = "No"
        break
print (ans)

Measured memory_bytes: 2940
from itertools import chain


def solve():
    N, M, K = map(int, input().split())

    A = map(int, input().split())
    B = list(map(int, input().split()))

    answer = 0

    sum_b = sum(B)
    idx_b = M
    remain = K

    for i, a in enumerate(chain([0], A)):
        remain -= a
        if remain < 0:
            break

        while sum_b > remain and idx_b >= 0:
            idx_b -= 1
            b = B[idx_b]
            sum_b -= b
        
        i += idx_b
        answer = i if answer < i else answer

    return answer


def main():
    print(solve())


if __name__ == "__main__":
    main()


Measured memory_bytes: 48456
#!/usr/bin/env python

def main():
    S, T = input().split()
    A, B = map(int, input().split())
    U = input()

    index = [S, T].index(U)
    if index == 0:
        A -= 1
    else:
        B -= 1
    print("{} {}".format(A, B))


if __name__ == '__main__':
    main()


Measured memory_bytes: 38384
#include <iostream>
#include <algorithm>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <string.h>
#include <vector>
#include <queue>
#include <cmath>
#include <bitset>
#include <complex>
#include <functional>
#include <numeric>
#include <iomanip>

#define SPBR(w, n) std::cout<<(w + 1 == n ? '\n' : ' ');
#define YES cout << "YES" << endl
#define Yes cout << "Yes" << endl
#define NO cout << "NO" << endl
#define No cout << "No" << endl
#define ALL(i) (i).begin(), (i).end()
#define FOR(i, a, n) for(int i=(a);i<(n);++i)
#define RFOR(i, a, n) for(int i=(n)-1;i>=(a);--i)
#define REP(i, n) for(int i=0;i<int(n);++i)
#define RREP(i, n) for(int i=int(n)-1;i>=0;--i)
#define IN(a, x, b) (a<=x && x<b)
#define OUT(a, x, b) (x<a || b<=x)
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

#define int ll
using ll = long long;
using ull = unsigned long long;
using ld = long double;
const int MOD = 1000000007;
/* const int MOD = 998244353; */
const int INF = 1e18;
const double PI = acos(-1);

using namespace std;
struct INIT { INIT(){
  cin.tie(0); ios::sync_with_stdio(false);
  cout << fixed << setprecision(10);
}}INIT;


signed main() {
  string s;
  cin >> s;

  int sum = 0;
  REP(i, s.size()){
    sum += (s[i]-'0');
  }

  if(sum%9 == 0) Yes;
  else No;

  return 0;
}


Measured memory_bytes: 3744
#include<iostream>
using namespace std;
int main()
{
    long long n, a, b, count;
    cin >> n >> a >> b;
    if(a > b)
        cout << 0 << endl;
    else if(n == 1 && a != b)
        cout << 0 << endl;
    else if(n == 1 && a == b)
        cout << 1 << endl;
    else
    {
        count = (b * (n - 1) + a) - (a * (n - 1) + b) + 1;
        cout << count << endl;
    }
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define all(v) v.begin(), v.end()
using namespace std;
typedef long long ll;

int main() {
	
	int n, k;
	cin >> n >> k;
	
	int rem0 = n / k;
	int rem1 = 0;
	if(k%2 == 0) rem1 = (n + k / 2) / k;
	
	cout << (ll) rem0 * rem0 * rem0 + (ll) rem1 * rem1 * rem1 << endl;
	
	return 0;
}

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


#define O_O ios_base::sync_with_stdio(0); cin.tie(NULL)
#define endl '\n'
#define PI acos(-1.0)
#define CASE(n) cout << "Case " << n << ": "
#define CASE_(n) cout << "Case " << n << endl
#define FIXED(n) cout << fixed << setprecision(n)
#define MOD 1000000007

inline void normal(long long &a) { a %= MOD; (a < 0) && (a += MOD); }
inline long long modMul(long long a, long long b) { normal(a), normal(b); return (a*b)%MOD; }
inline long long modAdd(long long a, long long b) { normal(a), normal(b); return (a+b)%MOD; }
inline long long modSub(long long a, long long b) { normal(a), normal(b); a -= b; normal(a); return a; }
inline long long modPow(long long b, long long p) { long long r = 1; while(p) { if(p&1) r = modMul(r, b); b = modMul(b, b); p >>= 1; } return r; }
inline long long modInverse(long long a) { return modPow(a, MOD-2); }
inline long long modDiv(long long a, long long b) { return modMul(a, modInverse(b)); }


int main()
{
    O_O;
#ifndef ONLINE_JUDGE
    freopen("input.in","r",stdin);
    freopen("output.out","w",stdout);
#endif
    long long t=1;
    //cin >> t;
    long long T = t;
    while(t--)
    {
        //write your code here
        int n,a,b;
        cin >> n >> a >> b;
        int diff = abs(a-b);
        diff--;
        if(diff%2==1)	cout << "Alice\n";
        else			cout << "Borys\n";
    }
    return 0;
}




Measured memory_bytes: 3532
import java.util.Scanner;
public class Main {

	public static void main(String[] args) {
		Scanner stdIn = new Scanner(System.in);
		String a = stdIn.next();
		String b = stdIn.next();
		
		int aa = Integer.parseInt(a);
		int bb = Integer.parseInt(b);
		
		for(int i = 0; i < bb-1; i++) {
			a += a.substring(0,1);

		}
		for(int i = 0; i < aa-1; i++) {
			b += b.substring(0,1);
		}
		
		if(a.compareTo(b)>0) {
			System.out.println(b);
		}else {
			System.out.println(a);
		}
		
	}

}


Measured memory_bytes: 21844
#include <bits/stdc++.h>
#define rep(i,a,b) for(int i=(a);i<=(b);++i)
#define per(i,a,b) for(int i=(a);i>=(b);--i)
using namespace std;
int n,r=0,k;
char s[200005];
int main(){
    scanf("%d%s",&n,s+1);
    rep(i,1,n) {
        if(s[i]=='R') ++r;
    }
    k=r;
    rep(i,1,r) {
        if(s[i]=='R') --k;
    }
    printf("%d\n",k);
    return 0;
}

Measured memory_bytes: 4004
function Main(input) {
  "use strict"
  const temp = input.split("\n");

  const s = temp.shift().split("");
  const filter = s.filter((e,i) => {
    if(i % 2 === 0) return e === "L";
    else return e === "R"
  })

  if(filter.length === 0) console.log("Yes");
  else console.log("No");

}
//*この行以降は編集しないでください（標準入出力から一度に読み込み、Mainを呼び出します）
Main(require("fs").readFileSync("/dev/stdin", "utf8"));


Measured memory_bytes: 21064
//#include <bits/stdc++.h>
#include <iostream>
#include <fstream>
#include <vector>
#include <string>
#include <cmath>
#include <algorithm>
#include <map>
#include <iomanip>
#include <stdlib.h>
#include <queue>
#include <deque>
#include <set>
#include <stack>
#include <time.h>
 
using namespace std;
 
typedef long long ll;
typedef long double ld;
typedef pair<int, int> Pii;
typedef pair<int, ll> Pil;
typedef pair<ll, ll> Pll;
typedef pair<ll, int> Pli;
 
const ll nmax = 1e9 + 7;
const ll Mod = 998244353;
const double PI = 2 * asin(1);

ll A, B, C, D;

ll GCD(ll M, ll m){
  if (M < m) swap(M, m);
  while (M % m != 0){
    M = M % m;
    swap(M, m);
  }
  return m;
}
bool Solve(){
  if (A < B) return false;
  if (B > D) return false;
  if (B <= C) return true;

  ll G = GCD(B, D);
  ll now = B - G + (A % G);

  if (now > C) return false;
  return true;
}

int main(){
  ll T; cin >> T;

  for (int i = 0; i < T; i++){
    cin >> A >> B >> C >> D;
    if (Solve() == false) cout << "No" << endl;
    else cout << "Yes" << endl;
  }
  

  return 0;
}

Measured memory_bytes: 256
#include <bits//stdc++.h>
using namespace std;
#define int long long
#define rep(i,k) for(int i=0;i<k;i++)
signed main(void){
    int m,n,a,b,c;
    map<int,int> mochi;
    cin>>n;
    int ans=0;
    rep(i,n){
        cin>>a;
        if(mochi.find(a)==mochi.end()){
            mochi[a]=1;
            ans++;
        }
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
#include <boost/multi_array.hpp>
#include <boost/optional.hpp>
#include <boost/range/irange.hpp>
#include <boost/range/algorithm.hpp>
#include <boost/range/adaptors.hpp>

namespace adaptor = boost::adaptors;

void Main()
{
   int N, A, B;
   std::cin >> N >> A >> B;
   if ((B - A) % 2 == 1)
   {
      std::cout << "Borys\n";
   }
   else
   {
      std::cout << "Alice\n";
   }
}

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


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

using namespace std;

int main() {
    int a, b;
    cin >> a>>b;
    string s = "";
    for (int i=0;i<a;++i) {
        s+=to_string(b);
    }
    string t = "";
    for (int i=0;i<b;++i) {
        t+=to_string(a);
    }

    if (s < t) {
        cout << s << endl;
    } else {
        cout << t << endl;
    }
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long long
typedef int ll;
typedef long double ld;
const ll N = 100005;
char en = '\n';
ll inf = 1e16;
ll mod = 1e9 + 7;
ll power(ll x, ll n, ll mod) {
  ll res = 1;
  x %= mod;
  while (n) {
    if (n & 1)
      res = (res * x) % mod;
    x = (x * x) % mod;
    n >>= 1;
  }
  return res;
}

ld pi = 3.141592653589793;
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);

  ll n, m;
  cin >> n >> m;

  ll sum1 = 0;
  for (ll i = 1; i <= m; i++) {
    ll x;
    cin >> x;
    sum1 += x;
  }

  cout << max(-1ll, n - sum1) << en;
  return 0;
}


Measured memory_bytes: 3648
#include<stdio.h>
#include<string.h>
int main()
{
	char s[1001],t[1001];
	scanf("%s",s);
	scanf("%s",t);
	int l,ans=0,m,i,j,n;
	n=strlen(s);
	l=strlen(t);
	for(i=0;i<=n-l;i++)
	{
		j=0;
		m=0;
		while(t[j]!='\0')
		{
			if(s[i+j]==t[j])
			m++;
			j++;
		}
		if(m>ans)
		ans=m;
	}
	printf("%d\n",l-ans);
	return 0;
}

Measured memory_bytes: 1736
#include<iostream>
using namespace std ;
int main()
{
	short num ;
	short suu[ 30 ] = { 0 } ;
	short i ;
	for( i = 0 ; i < 28 ; i++ )
	{
		cin >> num ;
		suu[ num - 1 ]++ ;
	}
	for( i = 0 ; i < 30 ; i++ )
	{
		if( suu[ i ] == 0 )
		{
			cout << i + 1 << endl ;
		}
	}
	return 0 ;
}

Measured memory_bytes: 3104
#include <iostream>
#include <vector>
#include<string>
#include <set>
#include <map>
#include <algorithm>
#include <math.h>
using namespace std;
int main()
{

	int N;
	std::string S;
	cin >> N >> S;
	
	int cnt = 1;
	
	for(int i = 0;i<N-1;i++){
		if(S[i] != S[i+1]){
			cnt++;
		}
	}
	
	cout << cnt << endl;
	return 0;
	
}


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

int n, A[100005], B[100005];

signed main(){
  
  cin>>n;

  int flg = 1;
  
  for(int i=0;i<n;i++){
    cin>>A[i]>>B[i];
    if( A[i] != B[i] ) flg = 0;
  }
  
  if( flg ){
    cout<<0<<endl;
    return 0;
  }
  
  int ans = 0;
  
  priority_queue<int,vector<int>,greater<int> > q;
  
  for(int i=0;i<n;i++){
    
    ans += A[i];
    
    if( A[i] > B[i] ) q.push(B[i]);
      
  }

  if( !q.empty() ) ans -= q.top();
  
  cout<<ans<<endl;
  
  return 0;
}


Measured memory_bytes: 768
#include <iostream>
#include <vector>
#include<iomanip>
#include <algorithm>
using namespace std;
typedef long long ll;
#define rep(i,n) for(int i=0;i<(n);i++)

int N;
int a[51];
int main(int argc, const char * argv[]) {
    vector<pair<int, int>> OP;
    int i,j;
    cin >> N;
    for (i = 0; i < N; i++) {
        cin >> a[i];
    }
    int ma = *max_element(a, a+N);
    int mi = *min_element(a, a+N);
    int cnt = 0;
    if (abs(ma) >= abs(mi)) {
        int k = distance(a, max_element(a, a+N));
        OP.push_back(make_pair(k+1, 1));
        OP.push_back(make_pair(k+1, 1));
        a[0] += a[k]*2;
        cnt +=2;
        for (j = 1; j < N; j++) {
            cnt +=1;
            a[j] += a[j-1];
            OP.push_back(make_pair(j, j+1));
            if (a[j] < a[j-1]) {
                OP.push_back(make_pair(j, j+1));
                a[j] += a[j-1];
                cnt +=1;
            }
        }
    } else {
        int k = distance(a, min_element(a, a+N));
        a[N-1] += a[k]*2;
        OP.push_back(make_pair(k+1, N));
        OP.push_back(make_pair(k+1, N));
        cnt +=2;
        for (j = N-1; j > 0; j--) {
            cnt +=1;
            a[j-1] += a[j];
            OP.push_back(make_pair(j+1, j));
            if (a[j-1] > a[j]) {
                cnt +=1;
                a[j-1] += a[j];
                OP.push_back(make_pair(j+1, j));
            }
        }
    }
    cout << cnt << endl;
    for (auto a : OP) {
        cout << a.first << " " << a.second << endl;
    }
    
    
    return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <cstdio>
#include <iostream>
#include <map>
#include <cmath>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
#include <stdlib.h>
#include <stdio.h>
#include <bitset>
#include <cstring>
#include <deque>
#include <iomanip>
#include <limits>
#include <fstream>
using namespace std;
typedef long long ll;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define MOD1 1000000007

int main() {
  int N, A, B;
  cin >> N >> A >> B;
  cout << ((B - A) % 2 == 0 ? "Alice" : "Borys") << endl;

}


Measured memory_bytes: 256
#include <iostream>
#include <fstream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <utility>
#include <set>
#include <map>
#include <cassert>
#include <unordered_map>
#include <unordered_set>
#include <queue>

using namespace std;

using ll = long long;
using ldb = long double;

#define forn(i, x, n) for (int i = x; i < (int)(n); ++i)
#define forcin(a, n) for (int i = 0; i < n; cin >> a[i], ++i)
#define forb(i, x, n) for (int i = (int)(x); i >= n; --i)
#define mmax(a, b, c) max(a, max(b, c))
#define mmin(a, b, c) min(a, min(b, c))
#define pb push_back
#define mp make_pair

const int N = 100500 * 3;
const long double eps = 1e-11;

int main() {
    string s;
    cin >> s;
    s[3] = '8';
    cout << s;
}


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


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 = m;i >= n;i--)
#define REPO(i, n) for(int i = 1;i <= n;i++)
#define ll long long
#define INF 1999999999
#define MINF -1999999999
#define INF64 1999999999999999999
#define ALL(n) n.begin(),n.end()
#define MOD 1000000007




ll n;
double ans = 0;
int main() {
	cin >> n;
	REP(i, n) {
		double a;
		string b;
		cin >> a >> b;
		if (b == "JPY")ans += a;
		else ans += a * 380000;
	}
	cout << setprecision(10) << fixed << ans << endl;
}




Measured memory_bytes: 256
use std::io::*;
const MOD: usize = 1_000_000_007;

fn main() {
    let mut s: String = String::new();
    std::io::stdin().read_to_string(&mut s).ok();
    let mut itr = s.trim().split_whitespace();
    let n: usize = itr.next().unwrap().parse().unwrap();
    let a: Vec<usize> = (0..n)
        .map(|_| itr.next().unwrap().parse().unwrap())
        .collect();

    let mut ans = 1;
    let mut cnt: Vec<usize> = vec![0; n + 1];
    for i in 0..n {
        if a[i] != 0 {
            ans = ans * (cnt[a[i] - 1] - cnt[a[i]]) % MOD;
        } else {
            ans = ans * (3 - cnt[a[i]]) % MOD;
        }
        cnt[a[i]] += 1;
    }
    println!("{}", ans);
}


Measured memory_bytes: 6396
#include<bits/stdc++.h>
using namespace std;
int main(){
    long long a,b,c;
    long double ab;
    cin >> a >> b >> c;
    ab=a*b;
    if(c-a-b>2*sqrtl(ab)){
        cout << "Yes";
    }else{
        cout << "No";
    }
    return 0;
}

Measured memory_bytes: 256
/**
 * @brief ユーザ定義リテラル
 * @author えびちゃん
 */

#ifndef H_int_literals
#define H_int_literals
#include <cstddef>
#include <cstdint>

constexpr intmax_t  operator ""_jd(unsigned long long n) { return n; }
constexpr uintmax_t operator ""_ju(unsigned long long n) { return n; }
constexpr size_t    operator ""_zu(unsigned long long n) { return n; }
constexpr ptrdiff_t operator ""_td(unsigned long long n) { return n; }

#endif  /* !defined(H_int_literals) */

#include <cstdio>
#include <cstdint>
#include <vector>
#include <algorithm>
#include <string>
#include <utility>
#include <numeric>
#include <map>

std::map<intmax_t, intmax_t> memo;

intmax_t f(intmax_t h) {
  if (h == 1) return 1;
  auto it = memo.find(h);
  if (it != memo.end()) return it->second;

  intmax_t res = 2 * f(h/2) + 1;
  memo[h] = res;
  return res;
}

int main() {
  intmax_t h;
  scanf("%jd", &h);

  printf("%jd\n", f(h));
}


Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
struct node {
    int item;
    int left; int right;
};

void preorder(struct node T[], int u);
void inorder(struct node T[], int u);
void postorder(struct node T[], int u);

int main(void) {
    int n, i, k, *h;
    scanf("%d", &n);
    struct node *T;
    T = malloc(sizeof(struct node) * n);
    h = malloc(sizeof(int) * n);
    for (k = 0; k < n; k++) h[k] = 0;
    for (k = 0; k < n; k++) {
        scanf("%d", &i);
        scanf("%d %d", &((T + i)->left), &((T + i)->right));
        if (T[i].left != -1) h[T[i].left] = 1;
        if (T[i].right != -1) h[T[i].right] = 1;
    }
    k = 0;
    while(k < n && h[k] > 0) k++;


    printf("Preorder\n");
    preorder(T, k);
    printf("\nInorder\n");
    inorder(T, k);
    printf("\nPostorder\n");
    postorder(T, k);
    printf("\n");
    free(T);
    free(h);

    return 0;
}

void preorder(struct node T[], int u) {
    if (u == -1) return;
    printf(" %d", u);
    preorder(T, T[u].left);
    preorder(T, T[u].right);
}
void inorder(struct node T[], int u) {
    if (u == -1) return;
    inorder(T, T[u].left);
    printf(" %d", u);
    inorder(T, T[u].right);
}
void postorder(struct node T[], int u) {
    if (u == -1) return;
    postorder(T, T[u].left);
    postorder(T, T[u].right);
    printf(" %d", u);
}

Measured memory_bytes: 1804
#include <bits/stdc++.h>
#define db1(x) cout<<#x<<"="<<x<<'\n'
#define db2(x,y) cout<<#x<<"="<<x<<","<<#y<<"="<<y<<'\n'
#define db3(x,y,z) cout<<#x<<"="<<x<<","<<#y<<"="<<y<<","<<#z<<"="<<z<<'\n'
#define vll vector< ll >
//#define M 100000
#define MD 1000000007
#define pb push_back
#define rep(i,a,b) for(ll i = a; i <= b; ++i)
#define fo(i,a,b) for(int i = a; i<= b; ++i)
#define pii pair<int,int>
#define vec(a) vector<a >
#define all(a) a.begin(),a.end()
#define se second
#define fi first
#define inf 0xffffffff
#define inchar getchar_unlocked
#define outchar(x) putchar_unlocked(x)
//#define int unsigned long long
//#define endl '\n'
#define IOS ios::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define ll long long  
#define int long long
using namespace std;
//using ll = unsigned long long;
ll md=MD;
//ll M=1073741824;
ll M=998244353;
//ll exp(ll a,ll b){ll r=1;while(b>0){if(b&1){r=r*(a%md);r=(r+md)%md;}b>>=1;a=(a%md)*(a%md);a=(a+md)%md;}return (r+md)%md;}
ll gcd(ll a,ll b){if(b==0)return a;return gcd(b,a%b);}
ll Min(int a,int b){if(a<b)return a; return b;}
ll Max(int a,int b){if(a>b)return a; return b;}
ll power(ll a,ll b){ll ans=1;while(b>0){if(b&1)ans=(ans*a)%M;a=(a*a)%M;b=b>>1;}return ans;}
const int INF=1000000000000000000;


int32_t main()
{
	IOS;
	int t;
	//cin>>t;
	t=1;
	while(t--)
	{
		 int n;
		 cin>>n;
		 int x=n;
		 
		 string ans;
		 int cnt=0;
		 char ch='a';
		 x=n;
		 if(x==1)
		 {
		 cout<<"a\n"; continue;}
		 while(x>0)
		 {
		 	if(ch-1+(x%26==0?26:x%26)>='a')ans+=(ch-1+(x%26==0?26:x%26));
		 	//cout<<x/26<<" "<<x%26<<"\n";
		 	if(x%26==0)
		 	{x/=26;--x;
			 }
			 else
			 x/=26;
		 }
		 for(int i=ans.size()-1;i>=0;--i)cout<<ans[i];
		 cout<<"\n";
	}
	return 0;
}

Measured memory_bytes: 3656
import java.io.*;
import java.util.Arrays;

public class Main{
	
	public static void main(String[] argv) throws NumberFormatException, IOException{
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String line;
		while((line = br.readLine()) != null){
			int n = Integer.parseInt(line);
			int num = 0;
			int[] array = new int[n+1];
			Arrays.fill(array, 1);
			for(int i=2; i<(int)(n/2+1); i++){
				for(int j=2; i*j<=n; j++){
					array[i*j] = 0;
				}
			}
			for(int i=2; i<=n; i++){
				if(array[i] == 1)num++;
			}
			System.out.print(Integer.toString(num)+"\n");
		}
	}
}

Measured memory_bytes: 54300
import java.util.*;
import java.util.Map.Entry;


 class Main {
	 static int mod =  (int) (Math.pow(10,9)+7);
	 static long[] ans;
	 static boolean[] visit;
    public static void main(String[] args) {
    	
        Scanner sc = new Scanner(System.in);
        int N= sc.nextInt();
        int Q= sc.nextInt();
		List<ArrayList<Integer>> list= new ArrayList<ArrayList<Integer>>();
        for(long i=0;i<N;i++)list.add(new ArrayList<Integer>());
		int[] a = new int[N];
		int[] b = new int[N];
		for(int i=0;i<N-1;i++){
			a[i]=sc.nextInt()-1;
			b[i]=sc.nextInt()-1;
        	list.get(a[i]).add(b[i]);
        	list.get(b[i]).add(a[i]);
		}
        ans=new long[N];
        visit = new boolean[N];
		for(int i=0;i<Q;i++) {
			ans[sc.nextInt()-1]+=sc.nextInt();
//	        System.out.println("aa");			
		}
		dfs(list,0);
			
		StringBuilder sb = new StringBuilder();
		for (int i = 0; i < ans.length; i++) {
			if (i == ans.length - 1) {
				sb.append(ans[i]);
			} else {
				sb.append(ans[i]);
				sb.append(" ");
			}
		}
        System.out.println(sb);			
    }
    
	static void dfs(List<ArrayList<Integer>> list, int now) {
		visit[now]=true;
		int next =0;
		for(int nv:list.get(now)) {
			next = nv;
			if(visit[next] == true)continue;
			ans[next] = ans[next]+ ans[now];
			dfs(list,next);
		}
	}

}

Measured memory_bytes: 228896
#include <stdio.h>
#include <stdlib.h>
int A[4][4], S[4][4];
int N;
int B[11], check[8];

void checkup(int a, int b){
	if(a == 0 && b == 0){
		check[0]++;
		check[3]++;
		check[6]++;
	}
	if(a == 0 && b == 1){
			check[0]++;
			check[4]++;
			//check[6]++;
	}
	if(a == 0 && b == 2){
			check[0]++;
			check[5]++;
			check[7]++;
	}

	if(a ==1 && b == 0){
			check[1]++;
			check[3]++;
			//check[6]++;
	}
	if(a == 1 && b == 1){
			check[1]++;
			check[4]++;
			check[6]++;
			check[7]++;
	}
	if(a == 1 && b == 2){
			check[1]++;
			check[5]++;
			//check[7]++;
	}

	if(a == 2 && b == 0){
			check[2]++;
			check[3]++;
			check[7]++;
	}
	if(a == 2 && b == 1){
			check[2]++;
			check[4]++;
			//check[6]++;
		}
	if(a == 2 && b == 2){
			check[2]++;
			check[5]++;
			check[6]++;
	}


}

int main(void) {

	for(int a = 0; a < 3; a++){
		for(int b = 0; b < 3; b++){
			scanf("%d", &A[a][b]);
		}
	}
	scanf("%d", &N);
	for(int a = 0; a < N; a++){
		scanf("%d", &B[a]);
	}

	for(int k = 0; k < N; k++){
		for(int a = 0; a < 3; a++){
				for(int b = 0; b < 3; b++){
					if(B[k] == A[a][b]){
						checkup(a, b);
					}
				}
			}

	}
	int i = 0;
	while(i < 8){
		if(check[i] >= 3){
			printf("Yes");
			break;
		}
		i++;
	}

	if(i == 8)printf("No");

	return 0;
}

Measured memory_bytes: 1700
n, k = [int(i) for i in input().split()]
h = [int(i) for i in input().split()]

INF = float("inf")

dp = [INF] * n

dp[0] = 0

for i in range(1, n):
  for j in range(1, k+1):
    if 0 <= (i-j):
      dp[i] = min(dp[i], dp[i-j] + abs(h[i] - h[i-j]))

print(dp[n-1])

Measured memory_bytes: 55392
#include <bits/stdc++.h>
#define SZ(x) ((int)(x).size())
typedef long long ll;
typedef long double ld;
using namespace std;

int main() {
    ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); cout.setf(ios::fixed); cout.precision(20);
    int n, a, b, c; cin >> n >> a >> b >> c;
    vector<int> l(n);
    for (int &x : l) {
        cin >> x;
    }
    int res = INT_MAX;
    function<void(int, int, int, int, int)> calc = [&](int x, int y, int z, int i, int sticks) {
        if (i == n) {
            if (!x || !y || !z) {
                return;
            }
            int cost = (sticks - 3) * 10;
            cost += abs(x - a) + abs(y - b) + abs(z - c);
            res = min(res, cost);
            return;
        }
        calc(x + l[i], y, z, i + 1, sticks + 1);
        calc(x, y + l[i], z, i + 1, sticks + 1);
        calc(x, y, z + l[i], i + 1, sticks + 1);
        calc(x, y, z, i + 1, sticks);
    };
    calc(0, 0, 0, 0, 0);
    cout << res << "\n";
}


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

int main() {
  int N, a, b;
  cin >> N ;
  a = N % 1000;
  b = N / 10;
  if (a % 111 == 0 || b % 111 == 0){
    cout << "Yes" << endl;
  }
  else
    cout << "No" << endl;{
    }
}

Measured memory_bytes: 256
#include<iostream>
#include<cmath>
#include<cassert>
using namespace std;
   
int calc(int);
long long cnt;
int X;
void insertionSort(int A[],int n,int g){
  int v,j;
  for(int i=g;i<n;i++){
    v=A[i];
    j=i-g;
    while(j>=0&&A[j]>v){
      A[j+g]=A[j];
      j=j-g;
      cnt++;
    }
    A[j+g]=v;
  }
}
  
int Gt[1000000],gt=0;
int  G[1000000], g=0;
  
void shellSort(int A[],int n){
   
  
  int Z =pow(n,1.5),flg,y;
  X=n;
  cnt=0;
  
  for(int i=n;i>=1;i--){
    if(n%i==0){
      Gt[gt++]=i;
      //cout<<i<<" - "<<endl;
    }else{
      if(i*i<=n&&n<=(i+1)*(i+1))Gt[gt++]=y=i;
    }
  }
    
  for(int i=0;i<gt;i++){
    if(i%2==1||i==y){
     
      G[g++]=Gt[i];
    }
  }
  G[g++]=1;
    
  int ng;
  while(1){
    if(g<100)break;
    ng=0;
    for(int i=0;i<g;i++){
      if(i==y||i%2==1){
    G[ng++]=G[i];
      }
    }
    g=ng;
  }
  for(int i=0;i<g;i++){
    insertionSort(A, n,G[i]);
  }
    
  cout<<g<<endl;
  for(int i=0;i<g;i++){
    if(i)cout<<' ';
    cout<<G[i];
  }
  cout<<endl;
  cout<<cnt<<endl;
    
  assert(g<100);
  assert(cnt<Z);
  //cout<<cnt<<" cnt"<<endl;
  //cout<<Z<<" Z"<<endl;
  //cout<<(int)pow(n,1.5)<<endl;
}
   
   
int main(){
   
  int n;
  int A[1000000];
   
  cin>>n;
  for(int i=0;i<n;i++)cin>>A[i];
     
     
  shellSort(A,n);
   
  for(int i=0;i<n;i++){
    cout<<A[i]<<endl;
  }
   
  return 0;
}
   
int calc(int n){
  for(int i=sqrt(n);i>=0;i--){
    if(n%i==0)return n/i;
  }
}


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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<pair<int,int>> vpii;

#define F first
#define S second
#define PU push
#define PUF push_front
#define PUB push_back
#define PO pop
#define POF pop_front
#define POB pop_back

#define REP(i,a,b) for(int i=a; i<=b; i++)

void solve(int test_case) {
	ll n,k;
	cin>>n>>k;
	map<int,ll> m;
	while(n--) {
		int a,b;
		cin>>a>>b;
		m[a]+=b;
	}
	ll cnt = 0;
	for(auto a:m) {
		cnt+=a.S;
		if(cnt>=k) {
			cout<<a.F;
			break;
		}
	}
}

int main() {
	
	////// FILE BASED IO////
	//freopen("in", "r", stdin);
	//freopen("out", "w", stdout);
	///////////////
	
	ios::sync_with_stdio(0);
	cin.tie(0);
	int t=1;
	//cin>>t;
	REP(i,1,t) {
		solve(i);
	}
}	


Measured memory_bytes: 7520
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
int main(){
    int n;cin >> n;
    int sum = 0;
    int max_l = 0;
    for(int i = 0; i < n; i++){
        int l;
        cin >> l;
        max_l = max(l,max_l);
        sum += l;
    }
    cout << ((2*max_l < sum)? "Yes" : "No") << endl;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
static const int N = 100;

int main(){
  int n;
  int M[N][N];
  int u , k ,v;
  cin >> n;
  for(int i = 0 ; i < n ; i++){
    for(int j = 0 ; j < n ; j++){
      M[i][j] = 0;
    }
  }

  for(int i = 0 ; i < n ; i++){
    cin >> u >> k;
    u--;
    for(int j = 0 ; j < k ; j++){
      cin >> v;
      v--;
      M[u][v] = 1;
    }
  }
  for(int i = 0 ; i< n ; i++){
    for(int j = 0 ; j < n ; j++){
      if(j) cout << " ";
      cout << M[i][j] ;
    }
    cout << "\n";
  }

  return 0;
}



Measured memory_bytes: 3116