akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <vector>
#include <array>
#include <set>
#include <cmath>
#include <string>
#include <sstream>
#include <queue> 
#include <list>
#include <stack>
#include <unordered_map>
#include <algorithm> 
#include <numeric>  
#include <functional>
#include <cassert>
#include <bitset>
#include <cctype>  
#include <iomanip> 
#include <limits>  
#include <regex>
// std::numeric_limits<int>::max(), min()
// std::setprecision(X)
// std::islower(), std::isupper(), std::tolower, std::toupper
// std::accumulate(m.begin(), m.end(), 0LL);
// std::sort(begin(),end()) // 0, 1, 2, 3 ,4 (default, less);
// std::priority_queue<int, vector<int>, less<int>> que; // 4, 3, 2, 1 (defualt, less) : 
// if ( std::regex_match(S, std::regex("(dream|dreamer|erase|eraser)*")) ) std::cout << "YES" << std::endl;
 
#define rep(i, n) for(int i = 0; i < (int)(n);    i++)
#define sz(x) ((int)(x).size())
#define all(x) (x).begin(),(x).end()

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

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


int main (void) {
  std::cin.tie(0);  std::ios::sync_with_stdio(false);
  int N; std::cin >> N;
  std::vector<int> a(N);
  rep(i,N) std::cin >> a[i];
  std::cout  << *std::max_element(all(a)) - *std::min_element(all(a)) << std::endl;
  return 0;
}


Measured memory_bytes: 256
def resolve():
    # 整数 1 つ
    n = int(input())
    # 整数複数個
    # a, b, c = list(map(int, input().split()))
    # 整数 N 個 (改行区切り)
    # N = [int(input()) for i in range(N)]
    # 整数 N 個 (スペース区切り)
    # N = list(map(int, input().split()))
    # 整数 (縦 H 横 W の行列)
    s = [list(input().split()) for i in range(n)]
    m = int(input())
    t = [list(input().split()) for i in range(m)]

    paymax = 0
    for w in s:
        pay = s.count(w) - t.count(w)
        if paymax < pay:
            paymax = pay

    print(paymax)
resolve()

Measured memory_bytes: 38384
#include<iostream>
#include<vector>
using namespace std;
template<int mod>
struct F{
	int power(int a,int b){return b?(long long)power((long long)a*a%mod,b/2)*(b%2?a:1)%mod:1;}
	int N;
	vector<vector<pair<int,int> > >G;
	vector<int>memo;
	F(int n):N(n),G(n),memo(n){}
	void add_edge(int u,int v,int x)
	{
		G[u].push_back(make_pair(v,x));
		G[v].push_back(make_pair(u,power(x,mod-2)));
	}
	bool dfs(int u,int now)
	{
		if(memo[u]!=0)
		{
			return memo[u]==now;
		}
		memo[u]=now;
		for(pair<int,int>q:G[u])
		{
			if(!dfs(q.first,(long long)now*q.second%mod))return false;
		}
		return true;
	}
	bool ok()
	{
		for(int i=0;i<N;i++)
		{
			if(memo[i]==0&&!dfs(i,1))return false;
		}
		return true;
	}
};
main()
{
	int N,M;
	cin>>N>>M;
	F<1000500097>f(N);
	for(int i=0;i<M;i++)
	{
		int a,b,c;cin>>a>>b>>c;
		a--,b--;
		f.add_edge(a,b,c);
	}
	cout<<(f.ok()?"Yes":"No")<<endl;
}



Measured memory_bytes: 11540
#include <bits/stdc++.h>
#include<limits.h>
#include<stdio.h>
#include<cstring>
#include<string>
using namespace  std;
typedef long long ll;
typedef long double ld;
#define fast ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define pb push_back
#define mp make_pair
#define sz(a) a.size()
#define fi first
#define se second
#define rsz(a,n) a.resize(n)
#define test(t) ll t;cin>>t;while(t--)
#define forn(i,e) for(int i = 0; i < e; i++)
#define forsn(i,s,e) for(int i = s; i < e; i++)
#define rforn(i,s) for(int i = s; i >= 0; i--)
#define rforsn(i,s,e) for(int i = s; i >= e; i--)
#define fillv(a,k) memset(a,k,sizeof(a))
#define leadzero(a) __builtin_clz(a) //count leading zeros
#define trailzero(a) __builtin_ctz(a) //count trailing zeros
#define bitcount(a) __builtin_popcount(a) // count set bits (add ll)
#define ln cout<<"\n"
// #define sp cout<<" "
#define spaceprint(a,i,s,n) {forsn(i,s,n) { cout<<a[i]; sp;}}
#define lineprint(a,i,s,n) {forsn(i,s,n) {cout<<a[i]; ln;}}
#define maxe(a) *max_element(a.begin(),a.end())
#define maxi(a) max_element(a.begin(),a.end())-a.begin()
#define mine(a) *min_element(a.begin(),a.end())
#define mini(a) min_element(a.begin(),a.end())-a.begin()
#define all(c) c.begin(),c.end()
#define trav(container, it) for(typeof(container.begin()) it = container.begin(); it != container.end(); it++)
#define present(container, element) (container.find(element) != container.end())
#define cpresent(container, element)  (find(all(container),element) != container.end())// check the presence of element
//copy(from_begin, from_end, to_begin); copy function
typedef unsigned long long int ull;
typedef long double ld;
typedef pair<ll,ll> p64;
typedef pair<int,int> p32;
typedef pair<int,p32> p96;
typedef vector<ll> v64;
typedef vector<string> vs;
typedef vector<int> v32;
typedef vector<v32> vv32;
typedef vector<v64> vv64;
typedef vector<p32> vp32;
typedef vector<p64> vp64;
typedef vector<vp32> vvp32;
typedef map<int,int> m32;
typedef map<ll,ll> m64;
const int LIM = 1e5+5, MOD =  1e9;
#define sumv(v) accumulate(all(v),ll(0))
#define productv(v) accumulate(all(v), ll(1), multiplies< ll >())
ll gcd(ll a, ll b) { if(b == 0) return a; return gcd(b, a % b); }
ll mod=998244353;
ll fastpowMOD(ll a, ll p,ll MOD){ if(p==0) return 1; ll z = fastpowMOD(a,p/2,MOD); z = (z*z)%MOD; if(p%2) z = (z*a)%MOD; return z; }


int main()
{
	ll k,a,b;
	cin>>k>>a>>b;
	for (ll i=a;i<=b;i++)
	{
		if (i%k==0)
		{
			cout<<"OK";
			exit(0);
		}
	}
	cout<<"NG";

}



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

using namespace std;

int main(){
	int n;
	cin >> n;
	int a[n],tmp[n];
	for(int i=0;i<n;i++){
		cin >> a[i];
		tmp[i] = a[i];
	}
	sort(tmp,tmp+n);
	for(int i=0;i<n;i++){
		if(a[i] <= tmp[(n-1)/2]){
			cout << tmp[(n+1)/2] << endl;
		}
		else{
		cout << tmp[(n-1)/2] << endl;
		}
	}
	return 0;
}

Measured memory_bytes: 3712
#include<iostream>
#include<cstdlib>
#include<cstring>
#include<stack>
#include<queue>
#include<algorithm>
#include<vector>
#include<math.h>
#include<bitset>
#include<iomanip>
#include<numeric>
using namespace std;

typedef stack<int> IntStack;
typedef queue<int> IntQueue;

const double pi = 3.141592653589793;


//最大公約数
template<class T> T gcd(T a, T b)
{
	while (true)
	{
		T r;
		if (a%b == 0) return b;
		else
		{
			r = a % b;
			a = b;
			b = r;
		}
	}
}
//最小公倍数
template<class T> T lcm(T a, T b)
{
	return a / gcd(a, b)*b;
}
//文字0~9をint型0~9に変換
int char_to_int(char c)
{
	if (c == '0') return 0;
	if (c == '1') return 1;
	if (c == '2') return 2;
	if (c == '3') return 3;
	if (c == '4') return 4;
	if (c == '5') return 5;
	if (c == '6') return 6;
	if (c == '7') return 7;
	if (c == '8') return 8;
	if (c == '9') return 9;
	else return -1;
}
//a^b mod MODを計算
long long int ModPower(long long int a, long long int b, long long int MOD)
{
	if (b == 0) return 1;
	else if (b % 2 == 0)
	{
		long long int d = ModPower(a, b / 2, MOD);
		return (d*d) % MOD;
	}
	else
	{
		return (a*ModPower(a, b - 1, MOD)) % MOD;
	}
}
//nCr mod MODを計算
long long int ModCombi(long long int n, long long int r, long long int MOD)
{
	if (n == 0 || r == 0) return 1;

	long long int Kn = 1, Kr = 1, Knr = 1;

	long long int temp = 1;
	for (long long int i = 1; i <= n; i++)
	{
		temp *= i;
		temp %= MOD;
		if (i == n) Kn = temp;
		if (i == r) Kr = temp;
		if (i == n - r) Knr = temp;
	}

	long long int x = ModPower(Kr, MOD - 2, MOD);
	long long int y = ModPower(Knr, MOD - 2, MOD);

	long long int ans;
	ans = Kn * x;
	ans %= MOD;
	ans *= y;
	ans %= MOD;

	return ans;
}
//int型10進数をord桁のstring型2進数に変換する
string binary(int x, int ord)
{
	int y;
	string ans = "";
	for (int i = 0; i < ord; i++)
	{
		y = x / (int)pow(2, ord - 1 - i);
		y %= 2;
		if (y == 0) ans += "0";
		else ans += "1";
	}

	return ans;
}
//ord桁のstring型2進数をint型10進数に変換する
int rep_binary(string x, int ord)
{
	int res = 0;
	for (int i = 0; i < ord; i++)
	{
		if (x[i] == '1') res += (int)pow(2, ord - 1 - i);
	}
	return res;
}


/*ここまでテンプレ*//*ここまでテンプレ*//*ここまでテンプレ*//*ここまでテンプレ*/



int main()
{
	int N;
	double v[55];

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

	sort(v, v + N);

	double S = v[0];
	for (int i = 1; i < N; i++)
	{
		S = (S + v[i]) / 2;
	}

	cout << fixed << setprecision(10) << S;

	return 0;
}


Measured memory_bytes: 256
n =int(input())
l =[[0 for _ in range(10**5)]for _ in range(2)]
for i,j in enumerate(input().split()):
    l[i%2][int(j)-1] += 1
A = max(l[0])
B = max(l[1])
a = l[0].index(A)
b = l[1].index(B)
if l[0].count(A)>1 or l[1].count(B) >1 or a!=b:
    print(n-A-B)
else:
    l[0][a] =0
    l[1][b] =0
    C = max(l[0])
    D = max(l[1])
    print(min(n-A-D,n-B-C))

Measured memory_bytes: 12444
def main():
    n, m = map(int, input().split())
    h = list(map(int, input().split()))
    a = [None] * m
    b = [None] * m
    for i in range(m):
        a[i], b[i] = map(lambda x: int(x)-1, input().split())
    
    ret = [1] * n
    for i in range(m):
        if h[a[i]] == h[b[i]]:
            ret[a[i]] = 0
            ret[b[i]] = 0
        elif h[a[i]] > h[b[i]]:
            ret[b[i]] = 0
        else:
            ret[a[i]] = 0
    
    print(sum(ret))




if __name__=="__main__":
    main()


Measured memory_bytes: 21860
import sys


inint = lambda: int(sys.stdin.readline())
inintm = lambda: map(int, sys.stdin.readline().split())
inintl = lambda: list(inintm())
instrm = lambda: map(str, sys.stdin.readline().split())
instrl = lambda: list(instrm())

n, a, b =  inintm()

ans = 0

for i in range(1,n+1):
    i = str(i)
    s = 0
    for j in range(len(i)):
        s += int(i[j])
    if a <= s <= b:
        ans += int(i)

print(ans)


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

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

ll solve(){
  ll N, K;
  cin >> N >> K;
  vector<ll> A(N);
  rep(i, 0, N) cin >> A[i];
  ll dp[100][2];
  memset(dp, -1, sizeof(dp));
  dp[0][0] = 0;
  rep(i, 0, 50) {
    ll mask = 1LL << (50 - i - 1);
    int cnt = 0;
    rep(j, 0, N) if(A[j] & mask) cnt++;
    ll cost0 = cnt * mask;
    ll cost1 = (N - cnt) * mask;
    // K未満が確定しているので自由に決めることができる
    if(dp[i][1] != -1) chmax(dp[i + 1][1], dp[i][1] + max(cost0, cost1));
    // まだK未満が確定していない
    if(dp[i][0] != -1){
      if(K & mask) { // ビットが立っているとき
        chmax(dp[i + 1][1], dp[i][0] + cost0); // 0を選ぶとK未満が確定
        chmax(dp[i + 1][0], dp[i][0] + cost1); // 1を選んでもK未満は確定しない
      } else {
        chmax(dp[i + 1][0], dp[i][0] + cost0); // 0しか選べない
      }
    }
  }
  return max(dp[50][0], dp[50][1]);
}

int main(){
  cout << solve() <<endl;
  return 0;
}


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

using ll = long long;

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  
  ll n, k;
  cin >> n >> k;
  
  vector<ll> a(n), count(40, 0);
  ll sum = 0;
  for(int i = 0; i < n; i++){
    cin >> a.at(i);
    sum += a.at(i);
    
    for(int j = 0; j < 40; j++){
      if(a.at(i) & (1LL << j)) count.at(j)++;
    }
  }
  
  long long x = 0;
  for(int i = 40; i >= 0; i--){
    if(x + (1LL << i) <= k){
      if(n >= 2 * count.at(i)){
        sum += (n - 2 * count.at(i)) * (1LL << i);
        x += (1LL << i);
      }
    }
  }
  
  cout << sum << '\n';
}

Measured memory_bytes: 1024
#include <iostream>
#include <string>
#include <map>
#include <vector>
#include <algorithm>
#include <cmath>
#include <bitset>

using namespace std;

int main()
{
    int n;
    int a[100010];
    int x[100][100];
    int y[100][100];
    int ans = 0;

    cin >> n;

    for (int i = 0; i < n; i++) {
        cin >> a[i];
        for (int j = 0; j < a[i]; j++) {
            cin >> x[i][j] >> y[i][j];
        }
    }

    for (int bit = 0; bit < (1<<n); bit++) {
        int cnt = 0;
        bool flg;
        for (int i = 0; i < n; i++) {
            if (bit & (1<<i)) {
                flg = true;
                for (int j = 0; j < a[i]; j++) {
                    if ((bit & (1 << (x[i][j]-1))) != (y[i][j] << (x[i][j]-1))) {
                        flg = false;
                    }
                }
                if (flg) {
                    cnt++;
                }
                else break;
            }
        }
        if (cnt > ans && flg) ans = cnt;
    }

    cout << ans << endl;
}


Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <cstring>
#include <cstdio>
#include <cctype>

#define int long long

using namespace std;

const int N = 5e6;
const int INF = 10000000000000;

int n, m, ec = -1, ec2, a, b, c, rt = 1, size, mv, id, mx, ans;
int fa[N], f[N], cost[N], siz[N], vis[N], val[N];

struct Edge
{
	int u, v, w, nxt, id;
	bool operator < (const Edge &b) const
		{ return w < b.w; }
}e[N << 1], t[N << 1];

inline void Addedge(int a, int b, int c)
{
	++ec;
	e[ec].u = a;
	e[ec].v = b;
	e[ec].w = c;
	e[ec].nxt = f[a];
	f[a] = ec;
}

inline void Addedge2(int a, int b, int c)
{
	++ec2;
	t[ec2].u = a;
	t[ec2].v = b;
	t[ec2].w = c;
}

inline void read(int &x)
{
	int k = 1; x = 0;
	char c = getchar();
	while (!isdigit(c))
		if (c == '-') c = getchar(), k = -1;
		else c = getchar();
	while (isdigit(c))
		x = (x << 1) + (x << 3) + (c ^ 48),
		c = getchar();
	x *= k;
}

void Getroot(int u, int faz)
{
	int nmx = 0; siz[u] = 1;
	for (int i = f[u]; i != -1; i = e[i].nxt)
		if (faz != e[i].v && !vis[e[i].v])
			Getroot(e[i].v, u),
			siz[u] += siz[e[i].v],
			nmx = max(nmx, siz[e[i].v]);
	nmx = max(nmx, size - siz[u]);
	if (nmx < mx) mx = nmx, rt = u;
}

void Getmin(int u, int fa, int dep)
{
	if (mv > dep + cost[u])
		mv = dep + cost[u], id = u;
	for (int i = f[u]; i != -1; i = e[i].nxt)
		if (e[i].v != fa && !vis[e[i].v])
			Getmin(e[i].v, u, dep + e[i].w);		
}

void Add(int u, int fa, int dep)
{
	if (u != id) Addedge2(u, id, mv + dep + cost[u]);
	for (int i = f[u]; i != -1; i = e[i].nxt)
		if (e[i].v != fa && !vis[e[i].v])
			Add(e[i].v, u, dep + e[i].w);
}

void Divide(int u)
{
	vis[u] = 1, mv = INF; Getmin(u, 0, 0); Add(u, 0, 0);
	for (int i = f[u]; i != -1; i = e[i].nxt)
		if (!vis[e[i].v])
			size = mx = siz[e[i].v],
			Getroot(e[i].v, u),
			Divide(rt);
}

int Find(int x)
{
	return fa[x] == x ? x : fa[x] = Find(fa[x]);
}

signed main()
{
	read(n);
	memset(f, -1, sizeof(f));
	for (int i = 1; i <= n; ++i) 
		fa[i] = i, read(cost[i]);
	for (int i = 1; i < n; ++i)
		read(a), read(b), read(c),
		Addedge(a, b, c), Addedge(b, a, c);
	size = mx = n; Getroot(1, 0); Divide(rt);
	sort(t + 1, t + ec2 + 1);
	for (int i = 1; i <= ec2; ++i)
	{
		if (cost[0] >= n - 1) break;
		if (Find(t[i].u) != Find(t[i].v))
			fa[Find(t[i].u)] = t[i].v, ans += t[i].w, ++cost[0];
	}
	printf("%lld", ans);
	return 0;
}


Measured memory_bytes: 208256
#include <cstdio>
#include <cstring>
#include <cmath>
#include <climits>
#include <algorithm>
#include <sstream>
#include <tuple>
#include <queue>
#include <iostream>
#include <vector>
#include <map>
#include <set>

using namespace std;

typedef unsigned long long ull;
typedef long long ll;
typedef vector<int> vi;
typedef vector<long> vl;

#define ten(n) ((int)1e##n)
#define COUT cout <<
#define SPACE_COUT << " "  <<
#define COMMA_COUT << ", " <<
#define ENDL << endl;

int
main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N;
    long long x;
    vector<long long> a;
    cin >> N >> x;
    for (int i = 0; i < N; ++i) {
        ll tmp;
        cin >> tmp;
        a.push_back(tmp);
    }

    ll total = 0;
    ll pre = a[0];

    if (pre > x) {
        total += pre - x;
        pre = x;
    }

    for (int i = 1; i < N; ++i) {
        ll cur = a[i];
        if (pre + cur <= x) {
            pre = cur;
            continue;
        }

        pre = x - pre;
        total += cur - pre;
    }
    cout << total << endl;
    return 0;
}


Measured memory_bytes: 1400
#include <algorithm>
#include <functional>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <string>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <vector>
#include <list>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <bitset>
#include <climits>

#define all(c) (c).begin(), (c).end()
#define rep(i,n) for(int i=0;i<(n);i++)
#define pb(e) push_back(e)
#define mp(a, b) make_pair(a, b)
#define fr first
#define sc second

const int INF=100000000;
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
using namespace std;
typedef pair<int ,int > P;
typedef long long ll;

struct RollingHash {
    typedef long long int_type;
    typedef pair<int_type,int_type> hash_type;

    int_type base1;
    int_type base2;
    int_type mod1;
    int_type mod2;
    vector<int_type> hash1;
    vector<int_type> hash2;
    vector<int_type> pow1;
    vector<int_type> pow2;

    RollingHash() : base1(1009), base2(1007), mod1(1000000007), mod2(1000000009) {}

    void init(const string &s) {
        int n = s.size();

        hash1.assign(n+1,0);
        hash2.assign(n+1,0);
        pow1.assign(n+1,1);
        pow2.assign(n+1,1);

        for(int i=0;i<n;i++) {
            hash1[i+1] = (hash1[i]+s[i]) * base1 % mod1;
            hash2[i+1] = (hash2[i]+s[i]) * base2 % mod2;
            pow1[i+1] = pow1[i] * base1 % mod1;
            pow2[i+1] = pow2[i] * base2 % mod2;
        }
    }

    hash_type get(int l,int r) {
        int_type t1 = ((hash1[r] - hash1[l] * pow1[r-l]) % mod1 + mod1) % mod1;
        int_type t2 = ((hash2[r] - hash2[l] * pow2[r-l]) % mod2 + mod2) % mod2;
        return make_pair(t1, t2);
    }

    RollingHash::hash_type concat(hash_type h1, hash_type h2, int h2_len) {
        return make_pair((h1.fr*pow1[h2_len]+h2.fr)%mod1, (h1.sc*pow2[h2_len]+h2.sc)%mod2);
    }

};

char in[1000006];
int main() {
    scanf("%s",in);
    string s=string(in);
    int n=s.size();
    RollingHash rh;
    rh.init(s);
    string ans="mitomerarenaiWA";
    string A,B;
    P ansP=P(INF,INF);;
    rep(i,n) if(i) {
        int t=n-i*3;
        //printf("[debug] %d %d\n",i,t);
        if(t%2!=0) continue;
        if(t==0) continue;
        if(t<0) continue;
        if(t>=n) continue;
        t/=2;
        if(rh.get(0,i)==rh.get(i+t,2*i+t)&&rh.get(i+t,2*i+t)==rh.get(2*i+2*t,3*i+2*t)) {
            if(rh.get(i,i+t)==rh.get(2*i+t,2*i+2*t)) {
                //printf("[debug] %d %d\n",i,t);
                ans="Love Nico!";
                if(ansP.fr+ansP.sc>i+t) {
                    ansP=P(i,t);
                }
            }
        }
    }

    if(ans=="mitomerarenaiWA") cout<<ans<<endl;
    else {
        //cout<<ansP.fr<<", "<<ansP.sc<<endl;
        cout<<"Love ";
        cout<<s.substr(0,ansP.fr);
        cout<<s.substr(ansP.fr,ansP.sc);
        cout<<"!"<<endl;
    }
    return 0;
}

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

class UnionFind{
public:
  vector<int> uni;
  UnionFind(int s) : uni(s, -1) {}

  int root(int a){
    if(uni[a] < 0) return a;
    return uni[a] = root(uni[a]);
  }

  bool connect(int a, int b){
    a = root(a);
    b = root(b);
    if(a == b) return false;
    if(uni[a] > uni[b]) swap(a, b);
    uni[a] = uni[a] + uni[b];
    uni[b] = a;
    return true;
  }

  bool isConnect(int a, int b){
    return root(a) == root(b);
  }

  int size(int a){
    return -uni[root(a)];
  }
};

int main() {
  int N, K, L;
  cin >> N >> K >> L;
  UnionFind uf(N);
  rep(i, 0, K) {
    int p, q;
    cin >> p >> q;
    p--, q--;
    uf.connect(p, q);
  }
  UnionFind uf2(N);
  rep(i, 0, L) {
    int p, q;
    cin >> p >> q;
    p--, q--;
    uf2.connect(p, q);
  }
  map<pair<int, int>, int> mp;
  rep(i, 0, N) mp[{uf.root(i), uf2.root(i)}]++;
  rep(i, 0, N) cout << mp[{uf.root(i), uf2.root(i)}] << " ";
  cout << endl;
  return 0;
}


Measured memory_bytes: 13568
import java.util.*;
public class Main{
	public static void main(String[] args){
    	Scanner sc = new Scanner(System.in);
      String s1 = sc.next();
      String s2 = sc.next();
      String s3 = sc.next();
      String x = s2.substring(0,1).toUpperCase();
      System.out.println("A"+x+"C");
    }
}


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

int main() {
    long long N;
    long long R;
    cin >> N >> R;
    if (N > 10) {
        cout << R << endl;
    }
    else {
        long long ir = R + (100 * (10 - N));
        cout << ir << endl;
    }
    return 0;
}


Measured memory_bytes: 256
#include<stdio.h>

int main()
{
	double xa1,ya1,xa2,ya2,xb1,yb1,xb2,yb2;
	int flg;

	while(scanf("%lf %lf %lf %lf %lf %lf %lf %lf",&xa1,&ya1,&xa2,&ya2,&xb1,&yb1,&xb2,&yb2)!=EOF)
	{
		flg=0;
		if(xa1<=xb2)
		{
			if(xa2>=xb1)
			{
				if(ya1<=yb2)
				{
					if(ya2>=yb1)
					{
						flg=1;
					}
				}
			}
		}
		if(flg){puts("YES");}
		else{puts("NO");}
	}
	return 0;
}

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

int main() {
  int N;
  cin >> N;
  int A = N/1000,
      B = (N-1000*A)/100,
      C = (N-1000*A-100*B)/10,
      D = N-1000*A-100*B-10*C;
    
  if(A == B){
    if(B == C){cout << "Yes" << endl;}
    else{cout << "No" << endl;}
  }
  
   else if(B == C){
    if(C == D){cout << "Yes" << endl;}
    else{cout << "No" << endl;}
   }
   
  else{cout << "No" <<endl;} 
}

Measured memory_bytes: 256
#include <atcoder/all>
#include <bits/stdc++.h>
using namespace std;
using namespace atcoder;
typedef long long ll;
typedef pair<ll,ll> P;
const ll MOD=1000000007;
ll n,m;
ll a,b;
ll ans;
bool x[100005];
int main(void){
    cin.tie(0);
    ios::sync_with_stdio(0);
    cin>>n>>m;
    dsu uf(n);
    for(int i=0;i<m;i++){
        cin>>a>>b;
        a--; b--;
        uf.merge(a,b);
    }
    for(int i=0;i<n;i++){
        ll d=uf.leader(i);
        if(x[d]){

        }else{
            x[d]=true;
            ans++;
        }
    }
    cout<<ans-1<<endl;
    
}


Measured memory_bytes: 3732
import java.io.*;
import java.util.*;
 
public class Main {
	static final Reader in = new Reader();
	
	public static void main(String[] args) {
		int n=in.nextInt();
		long x=in.nextInt(), ans=Long.MAX_VALUE;
		long[] ps = new long[n+1];
		for(int i=0; i<n; ++i)
			ps[i+1]=ps[i]+in.nextInt();
		for(int i=1; i<=n; ++i) {
			long ca=2*(ps[n]-ps[n-i])+i*x;
			for(int j=0; n-i*j>0; ++j) {
				long b=(2*j+3)*(ps[n-i*j]-ps[Math.max(n-i*(j+1), 0)]);
				if(Long.MAX_VALUE-b<ca) {
					ca=Long.MAX_VALUE;
					break;
				}
				ca+=b;
			}
			ans=Math.min(ca, ans);
		}
		System.out.println(ans+n*x);
	}
	
	static class Reader {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		StringTokenizer st;
		String next() {
			while(st==null||!st.hasMoreTokens()) {
				try {
					st = new StringTokenizer(br.readLine());
				} catch(Exception e) {}
			}
			return st.nextToken();
		}
		int nextInt() {
			return Integer.parseInt(next());
		}
	}
}

Measured memory_bytes: 48760
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,a,b) for(int i=a;i>=b;i--)
#define fore(i,a) for(auto &i:a)
#define all(x) (x).begin(),(x).end()
//#pragma GCC optimize ("-O3")
using namespace std; void _main(); int main() { cin.tie(0); ios::sync_with_stdio(false); _main(); }
typedef long long ll; const int inf = INT_MAX / 2; const ll infl = 1LL << 60;
template<class T>bool chmax(T& a, const T& b) { if (a < b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T& a, const T& b) { if (b < a) { a = b; return 1; } return 0; }
//---------------------------------------------------------------------------------------------------
/*---------------------------------------------------------------------------------------------------
　　　　　　　　　　　 ∧＿∧
　　　　　 ∧＿∧ 　（´<_｀ ）　 Welcome to My Coding Space!
　　　　 （ ´_ゝ`）　/　 ⌒i     @hamayanhamayan0
　　　　／　　　＼　 　  |　|
　　　 /　　 /￣￣￣￣/　　|
　 ＿_(__ﾆつ/　    ＿/ .| .|＿＿＿＿
　 　　　＼/＿＿＿＿/　（u　⊃
---------------------------------------------------------------------------------------------------*/














int N;
vector<int> honests[15];
vector<int> liars[15];
//---------------------------------------------------------------------------------------------------
void _main() {
	cin >> N;
	rep(i, 0, N) {
		int A; cin >> A;
		rep(j, 0, A) {
			int x, y; cin >> x >> y;
			if (y == 0) liars[i].push_back(x - 1);
			else honests[i].push_back(x - 1);
		}
	}

	int ans = 0;
	rep(msk, 0, 1 << N) {
		bool ok = true;
		int tot = 0;
		rep(i, 0, N) if (msk & (1 << i)) {
			tot++;
			fore(honest, honests[i]) if (!(msk & (1 << honest))) ok = false;
			fore(liar, liars[i]) if (msk & (1 << liar)) ok = false;
		}
		if (ok) chmax(ans, tot);
	}
	cout << ans << endl;
}







Measured memory_bytes: 256
N, W = map(int, input().split())
w_list = []
v_list = []
for _ in range(N):
  w, v = map(int, input().split())
  w_list.append(w)
  v_list.append(v)

#w_list.insert(0,0)#アイテム番号を1インデックスに変更.
#v_list.insert(0,0)#アイテム番号を1インデックスに変更.

INF = 10**12
dp = [[INF]*(max(v_list)*N+1) for _ in range(N+1)]
dp[0][0] = 0

#print(dp)

for i in range(1,N+1):
  for j in range(max(v_list)*N+1):
    #print(i,j)
    if j - v_list[i-1] >= 0:
      dp[i][j] = min(dp[i-1][j], dp[i-1][j-v_list[i-1]] + w_list[i-1])
    else:
      dp[i][j] = dp[i-1][j]
  #print(dp)


ans = 0
for j in range(max(v_list)*N+1):
  if dp[N][j] <= W:
    ans = max(ans, j)

print(ans)

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

int main(){
	int n,mi = 1001,ma = -1;
	int a;
	
	cin >> n;
	while(n--){
		cin >> a;
		mi = min(mi,a);
		ma = max(ma,a);
	}
	cout << ma-mi;
}

Measured memory_bytes: 256
import sys

sys.setrecursionlimit(10**9)
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def LIST(): return [int(x) for x in input().split()]
MOD = 10**9 + 7

A, B =LIST()

if (A + B) % 2 == 1:
    print("IMPOSSIBLE")
else:
    print(abs(A + B) // 2)


Measured memory_bytes: 2940
#include <cstring>
#include <sstream>
#include <cstdio>
#include <algorithm>
#include <iostream>
#include <vector>
#include <map>
#include <unordered_map>
#include <cmath>
#include <queue>
#include <set>
#include <stack>

using namespace std;
typedef long long ll;
typedef pair<int, int> P;
#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)
#define repr(i, n) for(ll i = n - 1; i >= 0; i--)
#define repone(i, n) for(ll i = 1; i <= (ll)(n); i++)
#define each(i, mp) for(auto i:mp)
const int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};
const ll mod = 1000000007;
const ll inf = ll(1e9);
const ll half_inf = ll(1e5);
const ll ll_inf = ll(1e9) * ll(1e9);

unordered_map<ll, ll> mp;

void solve() {
}

int main() {
#ifdef MY_DEBUG
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wmissing-noreturn"
    while (true) {
        mp = unordered_map<ll, ll>();
#pragma clang diagnostic pop
#endif
        int a, b, c;
        cin >> a >> b >> c;
        if (b - a == c - b) cout << "YES" << endl;
        else cout << "NO" << endl;

        solve();

#ifdef MY_DEBUG
    }
#endif
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define FASTIO ios::sync_with_stdio(false);cin.tie(0);
#define ADD +
#define SUBTRACT -
#define MULTIPLY *
#define DIVIDE /
#define MOD %
#define INCREMENT(x) ++x
#define DECREMENT(x) --x
#define in(a,b) cin>>a>>b;
#define out(a,b) cout<<a<<endl<<b<<endl;
#define scan(a) scanf("%d",&a);
#define print(a) printf("%d\n",a);
#define scanii(a,b) scanf("%d %d",&a,&b);
#define printii(a,b) printf("%d\n%d\n",a,b);
#define scaniii(a,b,c) scanf("%d %d %d",&a,&b,&c);
#define pub push_back
#define pob pop_back
#define puf push_front
#define pof pop_front
#define ll long long
#define ull unsigned long long
#define sll signed long long
#define pi acos(-1)
#define mod 1000000007
#define TRUE 1
#define FALSE 0
#define ZERO 0
#define MP make_pair
#define F first
#define S second
#define f1(i,a) for(int i=0;i<a;++i)
#define f2(i,a) for(int i=a-1;i>=0;--i)
#define en puts("");
#define elif else if
typedef ll int lli;
typedef sll int slli;
typedef ull int ulli;
const int sz=10000;
using namespace std;

int clue();
int result();
void show();
bool check(int n) {
    for(int i=2;i*i<=n;++i) {
        if(n%i==0)
        return false;
    }
    return true;
}


// bool cmp(pair<int,int>p,pair<int,int>q) {
//     // return p.first>q.first;//descending by first
//     // return p.first<q.first;//ascending by first
//     // return p.second>q.second;//descending by second
//     return p.second<q.second;//ascending by second
// }

bool cmp(int p,int q) {
    return p>q;//descending
    // return p<q;//ascending
}


int main() {

    int t;
    // cin>>t;
    t=1;
    while(t-->0) {
        clue();
    }

    return 0;
}
int clue() {

    
    int n;
    string s,t;
    cin>>n>>s;
    if(n>=3200) cout<<s<<endl;
    else cout<<"red"<<endl;
    // ()?cout<<"Yes"<<endl:cout<<"No"<<endl;
    
    return 0;
}

Measured memory_bytes: 3600
// https://atcoder.jp/contests/abc129/tasks/abc129_d

#include <algorithm>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <set>
#include <string>
#include <tuple>
#include <vector>
using namespace std;

typedef long long ll;
typedef pair<int, int> PII;
typedef pair<ll, ll> PLL;
#define INF (1e9)
#define MOD (1000000007)
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) for (int i = 0; i < (n); ++i)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define FOREACH(x, a) for (auto &(x) : (a))
#define ALL(obj) (obj).begin(), (obj).end()
#define ALLR(obj) (obj).rbegin(), (obj).rend()
// int gcd(long a, long b) { return b ? gcd(b, a % b) : a; }
// int lcm(long a, long b) { return a * b / gcd(a, b); }

string s[2001];
int numh[2001][2001], numw[2001][2001];
int h, w;

// 縦方向に連続する空白を探す
int seqh(int _h, int _w) {
    if (s[_h][_w] == '#') {
        return 0;
    }
    if (numh[_h][_w] > 0) {
        return numh[_h][_w];
    }
    //上方向に空白を探す
    int posTop = _h, posBottom = _h;
    while (posTop >= 0) {
        if (s[posTop][_w] == '#') {
            posTop++;
            break;
        }
        posTop--;
    }
    // 下方向に空白を探す
    while (posBottom < h) {
        if (s[posBottom][_w] == '#') {
            posBottom--;
            break;
        }
        posBottom++;
    }
    int ans = min(h - 1, posBottom) - max(0, posTop) + 1;
    for (int i = posTop; i <= posBottom; i++) {
        numh[i][_w] = ans;
    }
    return ans;
}

// 横方向に連続する空白を探す
int seqw(int _h, int _w) {
    if (s[_h][_w] == '#') {
        return 0;
    }
    if (numw[_h][_w] > 0) {
        return numw[_h][_w];
    }
    // 左方向に空白を探す
    int posLeft = _w, posRight = _w;
    while (posLeft >= 0) {
        if (s[_h][posLeft] == '#') {
            posLeft++;
            break;
        }
        posLeft--;
    }
    // 右方向に空白を探す
    while (posRight < w) {
        if (s[_h][posRight] == '#') {
            posRight--;
            break;
        }
        posRight++;
    }
    int ans = min(w - 1, posRight) - max(0, posLeft) + 1;
    for (int i = posLeft; i <= posRight; i++) {
        numw[_h][i] = ans;
    }
    return ans;
}
int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int ans = 0;
    cin >> h >> w;
    for (int i = 0; i < h; i++) {
        cin >> s[i];
    }

    for (int i = 0; i < h; i++) {
        for (int j = 0; j < w; j++) {
            ans = max(ans, seqh(i, j) + seqw(i, j) - 1);
        }
    }
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 35840
//package com.company;

//import javafx.scene.chart.BarChart;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.LinkedHashSet;
import java.util.Random;

public class Main {


    public static void main(String[] args) throws IOException {
        BufferedReader read = new BufferedReader(new InputStreamReader(System.in));
//
        int n=Integer.parseInt(read.readLine());
        if(n>=30)
            System.out.println(("Yes"));
        else
            System.out.println("No");

    }

}



Measured memory_bytes: 25300
#include<bits/stdc++.h>
using namespace std;
long long int a,b,n,t,ar[100000],c,r,p,sum,i;
int main()
{
    cin>>a>>b>>c;
    for(i=1;i<=a;i++)
    {  p=i;
    t=0;
        while(p>0)
        {
            r=p%10;
            p=p/10;
            t=t+r;

        }
        if(t>=b&&t<=c)
        {
            sum=sum+i;
        }
    }
    cout<<sum<<endl;
return 0;
}


Measured memory_bytes: 256
import sys
from time import time
import random

input = sys.stdin.readline
D = int(input())
C = [int(c) for c in input().split()]
S = [[int(s) for s in input().split()] for _ in range(D)] 

def solve():
    start = time()

    Ans = [int(i) % 26 + 1 for i in range(D)]
    print(*Ans, sep="\n") 
   
    return 0

if __name__ == "__main__":
    solve()

Measured memory_bytes: 9872
#include <stdio.h>

int main(void)
{
  int n = 0;
  int b;
  int f;
  int r;
  int v;
  int add[4][3][10]={{{0}}};
  int i, j, k;

  scanf("%d", &n);

  for(i = 0; i < n; i++){
    scanf("%d %d %d %d", &b, &f, &r, &v);
    add[b - 1][f - 1][r - 1] += v;
  }

  for(i = 0; i < 4; i++){
    for(j = 0; j < 3; j++){
      for(k = 0; k < 10; k++)
	printf(" %d", add[i][j][k]);
      putchar('\n');
    }
    if(i < 3){
      for(k = 0; k < 20; k++)
	printf("#");
      putchar('\n');
    }
  }

  return 0;
}

Measured memory_bytes: 604
N = int(input())
A, B = list(map(int, input().split()))
P = list(map(int, input().split()))

x, y, z = 0, 0, 0
for i in range(N):
	if P[i] <= A:
		x += 1
	elif P[i] <= B:
		y += 1
	else:
		z += 1

print(min(x, y, z))

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
 
#define ll long long
 
int main() {
    ll N;
    ll A[200005];
    ll cnt[200005];
    memset(cnt, 0, sizeof(cnt));
 
    cin >> N;
    for(int i = 0; i < N; i++) {
        cin >> A[i];
        A[i]--;
        cnt[A[i]]++;
    }
 
    ll ans = 0;
    for(int i = 0; i < N; i++) {
        if(cnt[i] > 1) {
            ans += (cnt[i]) * (cnt[i] - 1) / 2;
        }
    }
    for(int i = 0; i < N; i++) {
        cout << ans - (cnt[A[i]] - 1) << endl;
    }
}

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

using namespace std;

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

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    string s[2];
    for (int ctr1 = 0; ctr1 < 2; ++ctr1)
        cin >> s[ctr1];
    int rez = 0;
    for (uint32_t ctr1 = 0; ctr1 < s[0].length(); ++ctr1)
        rez += s[0][ctr1] != s[1][ctr1];
    cout << rez << '\n';

    return 0;
}


Measured memory_bytes: 3876
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
template<class T> inline bool chmax(T& a, T b) {if (a < b) {a = b;return true;}return false;}

int main() {
    int x, a, b;
    cin >> x >> a >> b;
    x -= a;
    x -= x/b * b;
    cout << x << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <fstream>
#include <algorithm>
#include <cassert>
#include <cctype>
#include <cmath>
#include <complex>
#include <cstdio>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
using namespace std;

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

int n,s[50][30];
ll dp[50];

int main(){
	while(cin>>n&&n){
		rep(i,n)fill(s[i],s[i]+30,0);
		rep(i,n){dp[i]=(ll)1<<i;}
		int f,d,ans=-1;
		rep(i,n){
			cin>>f;
			rep(j,f){cin>>d;s[i][d-1]=1;}
		}
		rep(i,30){
			rep(j,n){
				rep(k,n){
					if(s[j][i]&&s[k][i]){
						dp[j]|=dp[k];
						if(dp[j]==((ll)1<<n)-1){ans=i+1;break;}
					}
				}
				if(ans>0)break;
			}
			if(ans>0)break;
		}
		cout<<ans<<endl;
	}
}

Measured memory_bytes: 872
#include<iostream>
#include<vector>
#include<algorithm>
#include<math.h>
#include<queue>
#include<numeric>
#include<string>
#define all(x) (x).begin(),(x).end()
typedef long long ll;
const ll MOD = 1000000007;
 
using namespace std;

int main()
{
    int N, Y;   cin >> N >> Y;
    int c, tmp;
    Y /= 1000;
    N -= Y%5;
    c = Y%5;
    Y -= Y%5;
    if(Y%10 == 0){
        for(int i=0; i<=N; i++){
            for(int j=0; j<=N-i; j++){
                if(10*i + 5*j + N-i-j == Y){
                    cout << i << " " << j << " " << N-i-j+c << endl;
                    return 0;
                }
            }
        }
    }else{
        Y -= 5;
        tmp = N-1;
        for(int i=0; i<=tmp; i++){
            for(int j=0; j<=tmp-i; j++){
                if(10*i + 5*j + tmp-i-j == Y){
                    cout << i << " " << j+1 << " " << tmp-i-j+c << endl;
                    return 0;
                }
            }
        }
        tmp = N-5;
        for(int i=0; i<=tmp; i++){
            for(int j=0; j<=tmp-i; j++){
                if(10*i + 5*j + tmp-i-j == Y){
                    cout << i << " " << j << " " << tmp-i-j+c+5 << endl;
                    return 0;
                }
            }
        }
    }
    cout << -1 << " " << -1 << " " << -1 << endl;
    return 0;
}

Measured memory_bytes: 3572
#include <bits/stdc++.h>
using namespace std;
using pint = pair<int, int>;
using ll = long long;
using ull = unsigned long long;
using vll = vector<long long>;
using pll = pair<ll, ll>;
#define FOR(i, begin, end) \
    for (int i = (begin), i##_end_ = (end); i < i##_end_; i++)
#define IFOR(i, begin, end) \
    for (int i = (end)-1, i##_begin_ = (begin); i >= i##_begin_; i--)
#define REP(i, n) FOR(i, 0, n)
#define IREP(i, n) IFOR(i, 0, n)
#define VREP(s, ite) for (auto ite = s.begin(); ite != s.end(); ++ite)
#define FI first
#define SE second
#define ALL(v) v.begin(), v.end()
//#define endl "\n"
#define ciosup  \
    cin.tie(0); \
    ios::sync_with_stdio(false);
#define eb emplace_back
#define vint vector<int>
constexpr ll INF = 1e15 + 7LL;
constexpr ll MOD = 998244353LL;

template <typename T>
istream &operator>>(istream &is, vector<T> &v) {
    for (int i = 0; i < v.size(); ++i) {
        is >> v[i];
    }
    return is;
}
template <typename T>
ostream &operator<<(ostream &os, const vector<T> &v) {
    for (int i = 0; i < v.size() - 1; ++i) {
        os << v[i] << " ";
    }
    if (v.size() > 0) {
        os << v[v.size() - 1] << endl;
    }
    return os;
}

int main() {
    ll n;
    cin >> n;
    priority_queue<pint> pque_plus;
    priority_queue<pint> pque_nplus;
    ll max_memo = 0;
    REP(i, n) {
        string s;
        cin >> s;
        pint cur{0, 0};
        ll now = 0, minval = 0, maxval = 0;
        REP(j, s.size()) {
            now += (s[j] == '(' ? 1 : -1);
            minval = min(minval, now);
            maxval = max(maxval, now);
        }
        cur.SE = now;
        if (cur.SE > 0){
            cur.FI = minval;
            pque_plus.push(cur);
        } else if (cur.SE < 0) {
            now = minval = maxval = 0;
            IREP(j, s.size()) {
                now += (s[j] == ')' ? 1 : -1);
                minval = min(minval, now);
            }
            cur.FI = minval;
            cur.SE = now;
            pque_nplus.push(cur);
        } else {
            max_memo = max(max_memo, abs(minval));
            now = minval = maxval = 0;
            IREP(j, s.size()) {
                now += (s[j] == ')' ? 1 : -1);
                minval = min(minval, now);
            }
            max_memo = max(max_memo, abs(minval));
        }
    }

    ll now = 0;
    while (pque_plus.size()){
        pint cur_val = pque_plus.top();
        pque_plus.pop();
        if (now + cur_val.FI < 0){
            cout << "No" << endl;
            return 0;
        }
        now += cur_val.SE;
    }

    ll now2 = 0;
    while (pque_nplus.size()) {
        pint cur_val = pque_nplus.top();
        pque_nplus.pop();
        if (now2 + cur_val.FI < 0) {
            cout << "No" << endl;
            return 0;
        }
        now2 += cur_val.SE;
    }

    if (now != now2) {
        cout << "No" << endl;
        return 0;
    }
    if (now < abs(max_memo)) {
        cout << "No" << endl;
        return 0;
    }
    cout << "Yes" << endl;
}


Measured memory_bytes: 11332
#include <iostream>
#include <vector>
#include <algorithm>
#include <iterator>
using namespace std;

void output_buffer(const vector<int>& buffer)
{
	cout << buffer[0];
	for (int i = 1; i < buffer.size(); ++i) {
		cout << ' ' << buffer[i];
	}
	cout << endl;
}

void insert_sort(vector<int>& buffer)
{
	for (int j = 1; j < buffer.size(); ++j) {
		int v = buffer[j];
		int i = j - 1;
		for (; i >= 0 && buffer[i] > v; --i) {
			buffer[i + 1] = buffer[i];
		}
		buffer[i + 1] = v;
		output_buffer(buffer);
	}
}

int main(int argc, char *argv[]) {
	ios::sync_with_stdio(false);
	
	int N = 0;
	cin >> N;
	vector<int> buffer(N);
	copy(istream_iterator<int>(cin), istream_iterator<int>(), buffer.begin());
	output_buffer(buffer);
	insert_sort(buffer);
	return 0;	
}

Measured memory_bytes: 3112
import java.util.*;

public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);

        double n = sc.nextInt();
		double k = sc.nextInt();
		
		double rate = 0;
		int score = 0;

		for (int i = 0; i < n; i++) {
			score = i + 1;
			if (score < k) {
				int count = 0;
				while (score < k) {
					count++;
					score *= 2;
				}
				rate += (1/n) * Math.pow(0.5, count);
			} else {
				rate += 1 / n;
			}
		}

		System.out.println(rate);
	}
}

Measured memory_bytes: 23124
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iostream>
#include <iterator>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
using namespace std;

#define dump(a) (cerr << (#a) << " = " << (a) << endl)
#define FOR(it,c) for(__typeof((c).begin())it=(c).begin(); it!=(c).end();++it)
#define RFOR(it,c) for(__typeof((c).rbegin())it=(c).rbegin(); it!=(c).rend();++it)
#define exist(c, v) (find((c).begin(), (c).end(), (v)) != (c).end())

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

template<typename T, typename U> ostream& operator<<(ostream& os, const pair<T, U>& p) {
	os << '(' << p.first << ", " << p.second << ')';
	return os;
}

template<typename T> ostream& operator<<(ostream& os, const vector<T>& v) {
	copy(v.begin(), v.end(), ostream_iterator<T>(os, " "));
	return os;
}

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

	const int MAX = 10000;
	vector<int> cnt(MAX + 1, 1);
	for(int i = 1; i <= MAX; ++i)
		cnt[i] = cnt[i - 1] + i;

	for(int n; scanf("%d", &n) == 1;)
		printf("%d\n", cnt[n]);

	return EXIT_SUCCESS;
}

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

#define rep(i,n) for(long long int (i)=0;(i)<(int)(n);(i)++)
#define rrep(i,a,b) for(long long int i=(a);i<(b);i++)
#define rrrep(i,a,b) for(long long int i=(a);i>=(b);i--)
#define all(v) (v).begin(), (v).end()
#define pb(q) push_back(q)
#define Abs(a,b) max(a,b)-min(a,b)
#define YES(condition) if(condition){cout << "YES" << endl;}else{cout << "NO" << endl;}
#define Yes(condition) if(condition){cout << "Yes" << endl;}else{cout << "No" << endl;}
#define Cout(x) cout<<(x)<<endl
#define POSSIBLE(condition) if(condition){cout << "POSSIBLE" << endl;}else{cout << "IMPOSSIBLE" << endl;}
#define Possible(condition) if(condition){cout << "Possible" << endl;}else{cout << "Impossible" << endl;}
#define possible(condition) if(condition){cout << "possible" << endl;}else{cout << "impossible" << endl;}
#define Size(n) (n).size()

typedef long long ll;


using namespace std;

const int INF = 1e9,MOD = 1e9 + 7,ohara = 1e6;
const ll LINF = 1e18;


long long int n,cnt=0,ans=0,a,b,c,d,cmp,cmpp,m,h,w,x,y,sum=0,pos;
int dy[]={1,0,-1,0};
int dx[]={0,1,0,-1};
string alph("abcdefghijklmnopqrstuvwxyz"),s;
bool fl=true;
struct edge{int to,cost;};

//-------------------------↓↓↓↓↓↓------------------------

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

      
      cin>>s;
      cout<<s[0]<<Size(s)-2<<s[Size(s)-1]<<"\n";
     

       
return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <cstdio>
#include <iostream>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <stack>
#include <vector>
using namespace std;
typedef long long int ll;
typedef long double ld;
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define Sort(Array) sort(Array.begin(), Array.end())
#define Reverse(a) reverse(a.begin(), a.end())
#define out(ans) cout << ans << endl;
const int MOD = 1000000007;
const int INF = 2147483647;
const ld PI = 3.14159265358979323846;

//------------↓------------- M -------------- E ---------------- M --------------- O ---------------↓--------------//
// コンパイル 
// g++ -std=c++1z
//
// -------型変換--------
// int を string に変換
// string s = to_string(n);
// string を int に変換
// int n = stoi(s);
//
// -------二分探索---------
// k以上の値が最初に現れる時のイテレータ
// lower_bound(data.begin(), data.end(), k)
// kより大きい値が最初の現れる時のイテレータ O(logN)
// upper_bound(data.begin(), data.end(), k)
// kがdataに存在するかをtrue or falseで返す O(logN)
// binary_search(data.begin(), data.end(), k)
// 
//
//
//
//
//
// 
//------------↑------------- M -------------- E ---------------- M --------------- O ---------------↑--------------//






int main() {

    char c; cin >> c;
    if ('a' <= c && c <= 'z') {
        cout << 'a' << endl;
    } else {
        cout << 'A' << endl;
    }





    return 0;
}









Measured memory_bytes: 3624
from collections import defaultdict
N, M, Q = map(int, input().split())
l2r = defaultdict(int)
l2acc = [[0]*(N+1) for _ in range(N)]
r2acc = [[0]*(N+1) for _ in range(N)]
for _ in range(M):
    l, r = map(int, input().split())
    l, r = l-1, r-1
    l2r[(l, r)] += 1
queries = []
for _ in range(Q):
    l, r = map(int, input().split())
    l, r = l-1, r-1
    queries.append((l, r))

for l in range(N):
    acc = 0
    for r in range(l, N):
        acc += l2r[(l, r)]
        l2acc[l][r] = acc

for r in range(N):
    acc = 0
    for l in range(r, -1, -1):
        acc += l2acc[l][r]
        r2acc[l][r] =acc

for l, r in queries:
    print(r2acc[l][r])



Measured memory_bytes: 45856
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int a,n,min=1001,all,s=0,i;
	scanf("%d %d",&n,&all);
	for(i=0;i<n;i++)
	{
		scanf("%d",&a);
		s++;
		all-=a;
		if(a<min)
			min=a;
	}
	s+=all/min;
	printf("%d",s);
	return 0;
}

Measured memory_bytes: 256
#include"bits/stdc++.h"
#include<math.h>
#include<vector>
#include<algorithm>
using namespace std;
int64_t i,j,k,l;//preparation for
int main(){
    int64_t x,y;
    string answer;
    cin>>x>>y;
    answer="No";
    if(y%2==0&&y>=2*x&&y<=4*x){
        answer="Yes";
    }

    cout<<answer;
    return 0;
}

Measured memory_bytes: 3628
using System;
using System.Linq;

namespace B___Picking_Up
{
    class Program
    {
        static void Main(string[] args)
        {
            var N = int.Parse(Console.ReadLine());
            var xy  = new long[N,2];

            for(int i = 0 ; i < N ; i++)
            {
                var read = Array.ConvertAll(Console.ReadLine().Split(' '),long.Parse);
                xy[i,0] = read[0];
                xy[i,1] = read[1];
            }
            var differenceX = new long[N,N];
            var differenceY = new long[N,N];

            for(int i = 0 ; i < N ; i++)
            {
                for(int j = 0 ; j < N ; j++)
                {
                    if(i==j)continue;
                    differenceX[i,j] = xy[i,0] - xy[j,0];
                    differenceY[i,j] = xy[i,1] - xy[j,1];
                }
            }

            var isChecked = new bool[N,N];
            for(int i = 0 ; i<N;i++)for(int j = 0 ; j<N ; j++) isChecked[i,j] = false;
            var maxCount = 0;
            for(int i = 0 ; i < N ; i++)
            {
                for(int j = 0 ; j < N ; j++)
                {
                    if(i ==j)continue;
                    if(isChecked[i,j]) continue;
                    var checkCount = 1;
                    isChecked[i,j] = true;
                    for(int m = 0 ; m < N ; m++)
                    {
                        for(int n = 0 ; n<N ; n++)
                        {
                            if(m == i && n == j)continue;
                            if(differenceX[m,n]==differenceX[i,j] && differenceY[i,j]==differenceY[m,n])
                            {
                                isChecked[m,n] = true;
                                checkCount += 1;
                            }
                        }
                    }
                    maxCount = Math.Max(maxCount,checkCount);
                }
            }

            Console.WriteLine(N-maxCount);

        }
    }
}


Measured memory_bytes: 13220