akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define rep(i, n) for (int i = 0; i < n; i++)
vector<ll> to[200005];
vector<ll> h;
int dp(ll u) //良い展望台なら1を返す。
{
    int res = 0;
    int flag = 0;
    for (int v : to[u])
    {
        if (h[u] <= h[v])
        {
            flag = 1;
            break;
        }
    }
    if (flag == 1)
    {
        return 0;
    }
    else
    {
        return 1;
    }
}
int main()
{
    ll n, m;
    cin >> n >> m;
    h.resize(n);
    rep(i, n)
    {
        cin >> h[i];
    }
    rep(i, m)
    {
        ll a, b;
        cin >> a >> b;
        a--;
        b--; //すでに出てきた組であれば対処したくない。
        to[a].push_back(b);
        to[b].push_back(a);
    }
    ll count = 0;
    rep(i, n)
    {
        count += dp(i); //一本の道を通ってらしい。
    }
    cout << count << endl;
}

Measured memory_bytes: 12176
package main

import (
	"fmt"
)

func main() {
	var n, a, b int
	fmt.Scanf("%d %d %d", &n, &a, &b)

	result := 0
	for i := 1; i <= n; i++ {
		sum := sum(i)
		if sum >= a && sum <= b {
			result += i
		}
	}

	fmt.Println(result)
}

func sum(n int) int {
	var sum int
	for {
		sum += n % 10
		n = n / 10
		if n == 0 {
			break
		}
	}
	return sum
}


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

using namespace std;
typedef long long ll;

#define rep(i, n) for (int i = 0; i < (n); i++)
#define rep2(i, a, b) for (int i = (a); i < (b); ++i)
#define all(a) (a).begin(), (a).end()
#define all2(a, b) (a).begin(), (a).begin() + (b)
#define debug(vari) cerr << #vari << " = " << (vari) << endl;

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

    map<int, int> mp;
    rep(i, n)
    {
        int a;
        cin >> a;
        mp[a]++;
    }

    vector<int> ck;
    for (auto itr = mp.begin(); itr != mp.end(); itr++)
    {
        ck.push_back(itr->second);
    }

    sort(all(ck));

    int ans = 0;

    int re = mp.size() - k;
    if (re > 0)
    {
        rep(i, re)
        {
            ans += ck[i];
        }
    }

    cout << ans << endl;

    return 0;
}


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

int main() {
  int n;

  cin >> n;

  vector<int> mochis;
  for(int i = 0; i < n; i++) {
    int mochi;
    cin >> mochi;
    uint j;
    for(j = 0; j < mochis.size(); j++) {
      if(mochis.at(j) == mochi) {
	break;
      }
    }
    if(j == mochis.size()) {
      mochis.push_back(mochi);
    }
  }
  cout << mochis.size() << endl;
  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<cstdio>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
#include<cassert>
#include<complex>
#include<numeric>
using namespace std;

//#define int long long
typedef long long ll;

typedef unsigned long long ul;
typedef unsigned int ui;
constexpr ll mod = 1000000007;
const ll INF = mod * mod;
typedef pair<int, int>P;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
#define all(v) (v).begin(),(v).end()
typedef pair<ll, ll> LP;
typedef long double ld;
typedef pair<ld, ld> LDP;
const ld eps = 1e-12;
const ld pi = acos(-1.0);

ll mod_pow(ll a, ll n, ll m = mod) {
	a %= m;
	ll res = 1;
	while (n) {
		if (n & 1)res = res * a%m;
		a = a * a%m; n >>= 1;
	}
	return res;
}

struct modint {
	ll n;
	modint() :n(0) { ; }
	modint(ll m) :n(m) {
		if (n >= mod)n %= mod;
		else if (n < 0)n = (n%mod + mod) % mod;
	}
	operator int() { return n; }
};
bool operator==(modint a, modint b) { return a.n == b.n; }
modint operator+=(modint &a, modint b) { a.n += b.n; if (a.n >= mod)a.n -= mod; return a; }
modint operator-=(modint &a, modint b) { a.n -= b.n; if (a.n < 0)a.n += mod; return a; }
modint operator*=(modint &a, modint b) { a.n = ((ll)a.n*b.n) % mod; return a; }
modint operator+(modint a, modint b) { return a += b; }
modint operator-(modint a, modint b) { return a -= b; }
modint operator*(modint a, modint b) { return a *= b; }
modint operator^(modint a, int n) {
	if (n == 0)return modint(1);
	modint res = (a*a) ^ (n / 2);
	if (n % 2)res = res * a;
	return res;
}

ll inv(ll a, ll p) {
	return (a == 1 ? 1 : (1 - p * inv(p%a, a)) / a + p);
}
modint operator/(modint a, modint b) { return a * modint(inv(b, mod)); }
const int max_n = 1 << 18;
modint fact[max_n], factinv[max_n];
void init_f() {
	fact[0] = modint(1);
	for (int i = 0; i < max_n - 1; i++) {
		fact[i + 1] = fact[i] * modint(i + 1);
	}
	factinv[max_n - 1] = modint(1) / fact[max_n - 1];
	for (int i = max_n - 2; i >= 0; i--) {
		factinv[i] = factinv[i + 1] * modint(i + 1);
	}
}
modint comb(int a, int b) {
	if (a < 0 || b < 0 || a < b)return 0;
	return fact[a] * factinv[b] * factinv[a - b];
}

int dx[4] = { 0,1,0,-1 };
int dy[4] = { 1,0,-1,0 };




void solve() {
	string s; cin >> s;
	s[1] = 'R' + 'B' - s[1];
	cout << s << "\n";
}


signed main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	//cout << fixed << setprecision(7);
	//init_f();
	//init();
	//experi();
	//int t; cin >> t; rep(i, t)solve();
	solve();
	stop
		return 0;
}

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

using namespace std;
typedef long long ll;
#define rep(i, n) for (ll i = 0; i < (ll)(n); ++i)
const long long MODNUM = 1000000007;

int main() {
    ll n; cin >> n;
    string s; cin >> s;

    // 英小文字の出現回数を取得する
    vector<ll> al(26, 0);
    rep(i, n) {
        al[s[i]-'a']++;
    }


    ll ans = 1;
    rep(i, 26) {
        if(al[i] > 0) {
            ans *= (al[i]+1);
            ans %= MODNUM;
        }
    }

    // 全てを選ばない分の１通りを減らす
    ans--;

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
#define newl "\n"
using namespace std;
using lli = long long int;
using vvint = vector <vector <int>>;
const int mod = 1e9 + 7;

const int N = 2e5 + 1;

bool comp(pair <int,int> &p1,pair <int,int> &p2){
	return p1.first > p2.first;
}

void solve(){
	int n,m;
	cin >> n >> m;
	int ans = 1;
	vector <pair <int,int>> factors;
	for(int i = 1;i * i <= m;++i){
		if(m % i == 0) factors.push_back({m / i,i}), factors.push_back({i,m / i});
	}
	sort(factors.begin(),factors.end(),comp);
	for(int i = 0;i < factors.size();++i){
		if(factors[i].second >= n){
			cout << factors[i].first << newl;
			return;
		}
	}

	return;
}

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout << fixed << setprecision(10);
	#ifdef EXECUTE_LOCALLY
		   freopen("in.txt","r",stdin);
	#endif
	int t = 1;
	//cin >> t;
	while(t--) solve();
	#ifdef EXECUTE_LOCALLY
    	cout << setprecision(3) << "program time: " << (double)clock() / CLOCKS_PER_SEC << newl;
	#endif
	return 0;
}


Measured memory_bytes: 3672
//atcoder
#include<cstdio>

int main(){
    char s[2][5];
    for(int i = 0; i < 2; i++) scanf("%s",s[i]);
    int cnt = 0;
    for(int i = 0; i < 3; i++) cnt += (s[0][i]==s[1][i]);
    printf("%d\n",cnt);
    return 0;
}

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



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

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    int n;
    cin >> n;
    vector<ll> t(n);
    rep(i,n) cin >> t[i];
    ll x=t[0];
    rep(i,n){
        x=lcm(x,t[i]);
    }
    cout << x << "\n";
    return 0;
}   

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

#define rep(i, n) for (int i = 0; i < n; ++i)
#define ALL(a) (a).begin(), (a).end()
#define rALL(a) (a).rbegin(), (a).rend()
#define SZ(x) ((int)(x).size())
using ll = long long;
using ull = unsigned long long;
using P = pair<int, int>;
using llP = pair<ll, ll>;
using DoP = pair<double, double>;
const int di[] = {0, 1, 0, -1, 1, 1, -1, -1};
const int dj[] = {1, 0, -1, 0, 1, -1, 1, -1};
const int INF = 1 << 28;
const ll INF64 = 1ll << 55;
const int mod = 1000000007;
//const int mod = 998244353;

template <class T>inline bool chmin(T &a, const T b)
{
  if (a > b)
  {
    a = b;
    return true;
  }
  return false;
}
template <class T>inline bool chmax(T &a, const T b)
{
  if (a < b)
  {
    a = b;
    return true;
  }
  return false;
}
template <class T>inline void line_out(const vector<T> vec) {
  int n = SZ(vec);
  rep(i, n) {
    cout << vec[i];
    if(i < n-1) cout << " ";
  }
  cout << endl;
  return;
}

struct mint
{
  ll x; // typedef long long ll;
  mint(ll x = 0) : x((x % mod + mod) % mod) {}
  mint operator-() const { return mint(-x); }
  mint &operator+=(const mint a)
  {
    if ((x += a.x) >= mod)
      x -= mod;
    return *this;
  }
  mint &operator-=(const mint a)
  {
    if ((x += mod - a.x) >= mod)
      x -= mod;
    return *this;
  }
  mint &operator*=(const mint a)
  {
    (x *= a.x) %= mod;
    return *this;
  }
  mint operator+(const mint a) const
  {
    mint res(*this);
    return res += a;
  }
  mint operator-(const mint a) const
  {
    mint res(*this);
    return res -= a;
  }
  mint &operator++()
  {
    if ((x += 1) >= mod)
      x -= mod;
    return *this;
  }
  mint &operator--()
  {
    if ((x += mod - 1) >= mod)
      x -= mod;
    return *this;
  }
  mint operator*(const mint a) const
  {
    mint res(*this);
    return res *= a;
  }
  mint pow(ll t) const
  {
    if (!t)
      return 1;
    mint a = pow(t >> 1);
    a *= a;
    if (t & 1)
      a *= *this;
    return a;
  }

  // for prime mod
  mint inv() const
  {
    return pow(mod - 2);
  }
  mint &operator/=(const mint a)
  {
    return (*this) *= a.inv();
  }
  mint operator/(const mint a) const
  {
    mint res(*this);
    return res /= a;
  }
};

// h(n, r) = c(n+r-1, r)
struct combination
{
  vector<mint> fact, ifact;
  combination(int n) : fact(n + 1), ifact(n + 1)
  {
    assert(n < mod);
    fact[0] = 1;
    for (int i = 1; i <= n; ++i)
    fact[i] = fact[i - 1] * i;
    ifact[n] = fact[n].inv();
    for (int i = n; i >= 1; --i)
    ifact[i - 1] = ifact[i] * i;
  }
  mint operator()(int n, int k)
  {
    if (k < 0 || k > n)
    return 0;
    return fact[n] * ifact[k] * ifact[n - k];
  }
};

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

int main()
{
  int n, k; cin >> n >> k;
  vector<int> p(n);
  rep(i, n) cin >> p[i];
  sort(ALL(p));
  cout << accumulate(p.begin(), p.begin()+k, 0) << endl;
}

Measured memory_bytes: 3604
S=input()
P=input()
SS=S+S
flag=True
flag2=False
for i in range(0,len(SS)-len(P)):
    for j in range(0,len(P)):
        if(P[j]!=SS[i+j]):
            flag=False
    if flag==True:
        print("Yes")
        flag2=True
        break;
    flag=True
if flag2==False:
    print("No")




Measured memory_bytes: 5560
#include <iostream>
#include <algorithm>
#include <utility>
#include <vector>

using namespace std;

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

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

		vector<pair<int, int>> v; 
		for (int i = 1; i < N-1; i++) {
				if (A[i] >= 0) {
						v.push_back(make_pair(A[0], A[i])); 
						A[0] -= A[i];
				} else {
						v.push_back(make_pair(A[N-1], A[i]));
						A[N-1] -= A[i];
				}
		}

		v.push_back(make_pair(A[N-1], A[0]));
		A[N-1] -= A[0];
		cout << A[N-1] << endl;

		for (int i = 0; i < N-1; i++) cout << v[i].first << " " << v[i].second << endl;
		return 0;
}


Measured memory_bytes: 3188
def main():
	A,B = map(int, input().split())
	A,B = max(A,B), min(A,B)
	G = gcd(A,B)
	# G:最大公約数, L:最小公倍数
	# AB=GL
	L=A*B/G
	print(int(L))

def gcd(a,b):
	if a%b==0:
		return b
	return gcd(b, a%b)


if __name__ == '__main__':
	main()

Measured memory_bytes: 2940
pub fn read_parameters<T>() -> Result<Vec<T>, String>
where
    T: std::str::FromStr,
{
    let mut line = String::new();
    std::io::stdin()
        .read_line(&mut line)
        .map_err(|err| format!("{:?}", err))?;

    let xs = line.trim().split_whitespace();
    let mut result = Vec::new();

    for x in xs {
        let ans = x.parse::<T>().map_err(|_| format!("{}", "parse error"))?;
        result.push(ans);
    }
    Ok(result)
}

fn main() {
    // let (a, b) = read_parameters::<isize>().map(|xs| (xs[0], xs[1])).unwrap();
    let a = read_parameters::<isize>().unwrap();
    let (w, h, x, y, r) = (a[0], a[1], a[2], a[3], a[4]);

    if x - r >= 0 && x + r <= w && y - r >= 0 && y + r <= h {
        println!("Yes");
    } else {
        println!("No");
    }
}



Measured memory_bytes: 5028
import sys
import math

n,h = map(int,input().split())
a = [0 for i in range(n)]
b = [0 for i in range(n)]
for i in range(n) :
  a[i],b[i] = map(int,input().split())
  
b.sort(reverse=True)

c = 0
am = max(a)
for i in range(n) :
  if b[i] < am :
    break
  h -= b[i]
  c += 1
  if h <= 0 :
    print(c)
    sys.exit()

print(c + math.ceil(h/max(a)))

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

int main( void )
{
    char n[ 3 ];
    cin >> n;
    if ( n[ 0 ] == '9' || n[ 1 ] == '9' )
    {
        cout << "Yes" << endl;
    }
    else
    {
        cout << "No" << endl;
    }

    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <string>
#include <vector>
#include <algorithm>
#include <set>
#include <queue>
#include <deque>
using namespace std;

typedef long long ll;
typedef unsigned long long ull;

#define rep(i, up) for (ll i = 0; i < up; ++i)
#define repp(i, up) for (ll i = 0; i <= up; ++i)
#define rrep(i, lo, up) for (ll i = lo; i < up; ++i)
#define rrepp(i, lo, up) for (ll i = lo; i <= up; ++i)

#define rdi(i) ll i; scanf("%lld", &i)
#define rds(s) string s; cin >> s
#define rdc(c) char c; cin >> c

#define INF 10000000000

int main()
{
    ll x;
    cin >> x;
    cout << x / 500 * 1000 + (x % 500) / 5 * 5 << endl;
    return 0;
}

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

#define max 101
int Adj[max][max];

void createAdjacentmatrix()
{
    int i, j,n;
    for (i = 0; i<n; i++) 
    {
        for (j = 0; j<n; j++)
        {
            Adj[i][j] = 0;
  }
 }
}


int main() 
{
    int n;
    int i,j;
    scanf("%d", &n);
    createAdjacentmatrix();
    int k, u, t;
    for (i = 0; i<n; i++) 
    {
        scanf("%d %d", &u, &k);
        for (j = 0; j<k; j++)
        {
            scanf("%d", &t);
            Adj[u - 1][t - 1] = 1;
            }
    }


     for (i = 0; i<n; i++)
    {
        for (j = 0; j<n; j++)
        {
            printf("%d", Adj[i][j]);
            if (j != n - 1)
            {
                printf(" ");
                }
    }
  printf("\n");
  }


}


Measured memory_bytes: 2112
import math
N, A, B, C = 5, 100, 90, 80
ARR = [
    98,
    40,
    30,
    21,
    80
]

# N,A,B,C = 8, 100, 90, 80
# ARR = [
#     100,
#     100,
#     90,
#     90,
#     90,
#     80,
#     80,
#     80,
# ]


# N,A,B,C,= 8, 1000, 800, 100
# ARR = [
#     300,
#     333,
#     400,
#     444,
#     500,
#     555,
#     600,
#     666,
# ]

N,A,B,C = map(int,input().split())
ARR = []
for i in range(N):
    ARR.append(int(input()))

def calculate(n, arr, a, b, c):
    result = []
    for i in range(4 ** n):
        materialA = set()
        materialB = set()
        materialC = set()
        materialNone = set()
        for j in range(n):
            s = (i >> 2 * j & 1)
            t = (i >> (2 * j + 1) & 1)
            if (s == 0) and (t == 0):
                materialA.add(j)
            if (s == 1) and (t == 0):
                materialB.add(j)
            if (s == 0) and (t == 1):
                materialC.add(j)
            if (s == 1) and (t == 1):
                materialNone.add(j)

        ok, mp = judge(n, arr, a, b, c, materialA, materialB, materialC, materialNone)
        if ok:
            result.append(mp)
    print(int(min(result)))

def judge(n, arr, a, b, c, materialA, materialB, materialC, materialNone):


    if materialNone == n:
        return False, -1

    if len(materialA & materialB) > 0:
        return False, -1

    if len(materialA & materialC) > 0:
        return False, -1

    if len(materialB & materialC) > 0:
        return False, -1

    if len(materialA) == 0:
        return False, -1

    if len(materialB) == 0:
        return False, -1

    if len(materialC) == 0:
        return False, -1

    mpA = 0
    a = a - calculateResult(arr,materialA)
    mpA += math.fabs(a)
    if len(materialA) > 1:
        mpA += 10 * (len(materialA) - 1)

    mpB = 0
    b = b - calculateResult(arr,materialB)
    mpB += math.fabs(b)
    if len(materialB) > 1:
        mpB += 10 * (len(materialB) - 1)

    mpC = 0
    c = c - calculateResult(arr,materialC)
    mpC += math.fabs(c)
    if len(materialC) > 1:
        mpC += 10 * (len(materialC) - 1)


    return True,mpA+mpB+mpC

def calculateResult(arr,material):
    result = 0
    for m in material:
        result = result + arr[m]
    return result

calculate(N, ARR, A, B, C)


Measured memory_bytes: 4644
import fractions
from functools import reduce

def lcm_base(x, y):
    return (x * y) // fractions.gcd(x, y)
def lcm_list(numbers):
    return reduce(lcm_base, numbers, 1)
  
n = int(input())
a = list(map(int, input().split()))

saikou = lcm_list(a)
ans = 0

for i in a:
  b = saikou // i
  ans += b
  
print(int(ans) % 1000000007)

Measured memory_bytes: 6112
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <iomanip>
#include <cmath>
#include <cstdlib>
#include <map>
#include <utility>
#include <numeric>
#define ll long long
#define REP(i, x) for(int (i) = 0; (i) < (x); (i) ++)
#define pi 3.1415926535
const int MOD = 1000000007;
using namespace std;

int main() {
	ll a, b, k;
	cin >> a >> b >> k;
	REP(i, k) {
		if (i % 2 == 0) {
			if (a % 2 == 1) {
				a--;
			}
			b += a / 2;
			a /= 2;
		}
		else {
			if (b % 2 == 1) {
				b--;
			}
			a += b / 2;
			b /= 2;
		}
	}
	cout << a << " " << b << endl;
	return 0;
}

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

int main()
{
	int sec;
	int h, m, s;
	
	cin >> sec;
	s = sec % 60;
	m = sec / 60 % 60;
	h = sec / 60 / 60 % 60;
	

	cout << h << ":" << m << ":" << s << endl;
	return 0;
}

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

using namespace std;

#define FOR(i, n) for(int i = 0; i < (int) n; i++)
#define PB push_back
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define F first
#define S second

typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> pii;

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

	char c; cin >> c;

	if('a' <=c && c<='z')
		cout << "a\n";
	else
		cout << "A\n";

	return 0;
}


Measured memory_bytes: 3636
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <functional>
#include <vector>
#define numarr 22
using namespace std;

int main() {
	int N, V[numarr], C[numarr], ans = 0, i;
	cin >> N;
	for (i = 1; i <= N; i++)
	{
		cin >> V[i];
	}
	for (i = 1; i <= N; i++)
	{
		cin >> C[i];
	}
	for (i = 1; i <= N; i++)
	{
		if (V[i] > C[i])
			ans += V[i] - C[i];
	}
	cout << ans << endl;
}

Measured memory_bytes: 256
#include<cstdio>
#include<algorithm>
#include<cmath>
#define SF scanf
#define PF printf
#define MAXN 200010
#define MOD 1000000007
using namespace std;
int h,w,a,b;
long long d[MAXN],q[MAXN];
long long fsp(long long x,int y){
    long long res=1;
    while(y){
        if(y&1) res=(res*x)%MOD;
        x=(x*x)%MOD;
        y>>=1;
    }
    return res;
}
void prepare(){
    d[0]=1;
    for(int i=1;i<=200000;i++)
        d[i]=(1ll*d[i-1]*i)%MOD;
    q[200000]=fsp(d[200000],MOD-2);
    for(int i=199999;i>=0;i--)
        q[i]=(1ll*q[i+1]*(i+1))%MOD;
}
long long C(int x,int y){
    return ((d[x]*q[y]%MOD)*q[x-y])%MOD;
}
int main(){
    long long del=0;
    prepare();
    SF("%d%d%d%d",&h,&w,&a,&b);
    for(int i=1;i<=b;i++){
        del+=(C(h-a+i-2,i-1)*C(w-i+a-1,a-1))%MOD;
        del%=MOD;
    }
    PF("%lld",(C(w+h-2,h-1)-del+MOD)%MOD);
}


Measured memory_bytes: 3328
N = int(input())
As = list(map(int, input().split()))
B1 = 0
for i in range(N):
  if i%2 == 0:
    B1 += As[i]
  else:
    B1 -= As[i]
Bs = [B1]
for i in range(1, N):
  b = 2*As[i-1]-Bs[i-1]
  Bs.append(b)
print(" ".join(map(str, Bs)))


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

int main() {
	cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(0);
	int a,b; cin>>a>>b;
	if (b%a==0) cout << (a+b);	
	else cout << (b-a) << endl;
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <numeric>
#include <algorithm>
#include <set>
#include <cmath>
#include <iomanip>
#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 INF 999999999
#define llong long long
#define VSORT(v) sort(v.begin(), v.end())
#define pb(a) push_back(a)
using namespace std;

#ifdef INPUT
#include <sstream>
stringstream input(R"(
2 3 1
)");
#define cin input
#endif

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

	double ans;

	if (d==0)
		ans = 1/n*(m-1);
	else
		ans = 2*(n-d)/pow(n,2.0)*(m-1);
		
	cout << fixed << setprecision(10) << ans << endl;
}

Measured memory_bytes: 256
using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Numerics;
using System.Text;
using System.Threading.Tasks;

namespace AtCorder
{
	public class Program
	{
		static void Main(string[] args)
		{
			var cin = new Scanner2();
			int n = cin.Int();
			int m = cin.Int();
			var to = new List<int>[n * 3];
			for (int i = 0; i < n * 3; i++) {
				to[i] = new List<int>();
			}

			for (int i = 0; i < m; i++) {
				int u = (cin.Int() - 1) * 3;
				int v = (cin.Int() - 1) * 3;
				to[u].Add(v + 1);
				to[u + 1].Add(v + 2);
				to[u + 2].Add(v);
			}

			int s = cin.Int() - 1;
			int t = cin.Int() - 1;
			var d = new int[n * 3];
			for (int i = 0; i < n * 3; i++) {
				d[i] = int.MaxValue;
			}

			d[s * 3] = 0;
			var q = new Queue<int>();
			q.Enqueue(s * 3);
			while (q.Count > 0) {
				int cur = q.Dequeue();
				foreach (int next in to[cur]) {
					if (d[cur] + 1 < d[next]) {
						d[next] = d[cur] + 1;
						q.Enqueue(next);
					}
				}
			}

			if (d[t * 3] == int.MaxValue) {
				Console.WriteLine(-1);
			} else {
				Console.WriteLine(d[t * 3] / 3);
			}
		}
	}

	public class Scanner2
	{
		private readonly char[] delimiter_ = new char[] { ' ' };
		private readonly string filePath_;
		private readonly Func<string> reader_;
		private string[] buf_;
		private int index_;

		public Scanner2(string file = "")
		{
			if (string.IsNullOrWhiteSpace(file)) {
				reader_ = Console.ReadLine;
			} else {
				filePath_ = file;
				var fs = new StreamReader(file);
				reader_ = fs.ReadLine;
			}
			buf_ = new string[0];
			index_ = 0;
		}

		public string Next()
		{
			if (index_ < buf_.Length) {
				return buf_[index_++];
			}

			string st = reader_();
			while (st == "") {
				st = reader_();
			}

			buf_ = st.Split(delimiter_, StringSplitOptions.RemoveEmptyEntries);
			if (buf_.Length == 0) {
				return Next();
			}

			index_ = 0;
			return buf_[index_++];
		}

		public int Int() => int.Parse(Next());
		public long Long() => long.Parse(Next());
		public double Double() => double.Parse(Next());

		public int[] ArrayInt(int N, int add = 0)
		{
			int[] Array = new int[N];
			for (int i = 0; i < N; i++) {
				Array[i] = Int() + add;
			}
			return Array;
		}

		public long[] ArrayLong(int N, long add = 0)
		{
			long[] Array = new long[N];
			for (int i = 0; i < N; i++) {
				Array[i] = Long() + add;
			}
			return Array;
		}

		public double[] ArrayDouble(int N, double add = 0)
		{
			double[] Array = new double[N];
			for (int i = 0; i < N; i++) {
				Array[i] = Double() + add;
			}
			return Array;
		}

		public void Save(string text)
		{
			if (string.IsNullOrWhiteSpace(filePath_)) {
				return;
			}

			File.WriteAllText(filePath_ + "_output.txt", text);
		}
	}
}

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

int main()
{
	int x, y;
	cin >> x >> y;
	if (y < x * 2) {
		cout << "No";
	}
	else if (y > x * 4) {
		cout << "No";
	}
	else if ((y - x * 2) % 2 != 0) {
		cout << "No";
	}
	else {
		cout << "Yes";
	}

	return 0;
}

Measured memory_bytes: 3128
#include<cstdio>
#include<cmath>
#include<string>
#include<iostream>
#include<algorithm>
#include<utility>
#include<vector>
#include<map>
#include<set>
#include<limits>
#include<bitset>
#include<array>
#include<numeric>
#include<iomanip>
#include<functional>
#include<deque>

using namespace std;
typedef long long int ll;

#define C cout<<
#define E <<endl

ll n,m,a,b,c,x,y,z,aa[100010],ab[100010],ac[100010];
bool r,ra,rb,rc;
string s,sa,sb,sc;
char ca,cb,cc,cd[1000][1000];
vector<ll> va,vb,vc;

int main(){
    cin>>s;
    for(int i=0;i<s.size();i++)aa[s[i]]++;
    r=true;
    for(int i=0;i<200;i++){
        r=r and aa[i]%2==0;
    }
    C (r ? "Yes":"No") E;
}

Measured memory_bytes: 256
#!/usr/bin/python

import sys

def parse():
  n = int(raw_input())
  A = []
  for line in sys.stdin:
    fields = line.split()
    u = int(fields.pop(0))
    k = int(fields.pop(0))
    edges = {}
    for i in range(k):
      edges[int(fields[2*i])] = int(fields[2*i + 1])
    A.append(edges)
  return A

def dijkstra(s, cost):
  V = len(cost)
  d    = [float("inf")] * V
  used = [False] * V
  d[s] = 0

  while True:
    v = -1
    for u in range(V):
      if not used[u] and (v == -1 or d[u] < d[v]):
        v = u
    if v == -1:
      break
    used[v] = True
    for u in range(V):
      if not u in cost[v]: continue
      d[u] = min(d[u], d[v] + cost[v][u])

  return d

if __name__ == "__main__":
  A = parse()
  d = dijkstra(0, A)
  for i in range(len(d)):
    print i, d[i]

Measured memory_bytes: 6684
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int a[3]={1,100,10000};
	int n,d;
	cin>>d>>n;

	if(n==100)
	{
//		if(d==0)
		{
			cout<<a[d]*(n+1);
		}
//		else
		{
//			cout<<a[d]*n;
		}
	}
	else
	{
		cout<<a[d]*n;	
	}	
}

Measured memory_bytes: 256
#include <cstdio>
#include <cstring>

#define M 1046527
#define NIL (-1)
#define L 14

char H[M][L];

int getChar(char ch) {
    if (ch == 'A') {
        return 1;
    }
    if (ch == 'C') {
        return 2;
    }
    if (ch == 'G') {
        return 3;
    }
    if (ch == 'T') {
        return 4;
    }

    return -1;
}

long long getKey(char str[]) {
    long long sum = 0, p = 1;
    for (int i = 0; i < strlen(str); ++i) {
        sum += p * getChar(str[i]);
        p *= 5;
    }

    return sum;
}

int h1(int key) {
    return key % M;
}

int h2(int key) {
    return 1 + (key % (M - 1));
}

int find(char str[]) {
    long long key, h;
    key = getKey(str);
    for (int i = 0; ; ++i) {
        h = (h1(key) + i * h2(key)) % M;
        if (strcmp(H[h], str) == 0) {
            return 1;
        } else if(strlen(H[h]) == 0) {
            return 0;
        }
    }

    return 0;
}

int insert(char str[]) {
    long long key, h;
    key = getKey(str);
    for (int i = 0; ; ++i) {
        h = (h1(key) + h2(key) * i) % M;
        if (strcmp(H[h], str) == 0) {
            return 1;
        } else if (strlen(H[h]) == 0) {
            strcpy(H[h], str);
            return 0;
        }
    }

    return 0;
}

int main() {
    int n, h;
    char str[L], com[9];
    for (int i = 0; i < M; ++i) {
        H[i][0] = '\0';
    }

    scanf("%d", &n);
    for (int i = 0; i < n; ++i) {
        scanf("%s %s", com, str);
        if (com[0] == 'i') {
            insert(str);
        } else {
            if (find(str)) {
                printf("yes\n");
            } else {
                printf("no\n");
            }
        }
    }
    return 0;
}



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

#define f first
#define s second
#define mp make_pair
#define pb push_back
#define sz(x) (int)(x).size()
#define all(x) x.begin(),x.end()
#define mst(a,v) memset(a,v,sizeof(a))

typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef pair<int,int> pi;
typedef vector<pi> vpi;

const int N=100010;
const int mod=1e9+7;
const ld PI=acos(-1.0);
const int inf=0x3f3f3f3f;



int main()
{
#ifdef local
    //freopen("input.txt","r",stdin);
    //freopen("output.txt","w",stdout);
#endif
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    string s;
    cin>>s;
    int i=0,cnt=0;
    for(; s[i]; i++)
        if(i==0&&s[i]!='A') break;
        else if((i<2||i==sz(s)-1)&&s[i]=='C') break;
        else if(i>=2&&i<sz(s)-1&&s[i]=='C') {if(++cnt>1) break;}
        else if((s[i]<'a'||s[i]>'z')&&s[i]!='A'&&s[i]!='C') break;
    if(i<sz(s)||cnt!=1) cout<<"WA";
    else cout<<"AC";
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<fstream>
#include<stdio.h>
#include<string>
#include<vector>
#include<map>
#include<math.h>
#include<algorithm>
#include<iomanip>
#include<set>
#include<utility>

#define P 1000000007

using namespace std;

int main() {
  int n;
  cin >> n;
  vector<int> v(n);
  vector<bool> b(n);
  for(int i = 0; i < n; i++) cin >> v[i];
  for(int i = 0; i < n; i++) if(v[i] == i + 1) b[i] = true;
  int ans = 0;
  for(int i = 0; i < n - 1; i++) {
    if(b[i] && b[i + 1]) {
      b[i] = false;
      b[i + 1] = false;
      ans++;
    } else if(b[i]) {
      b[i] = false;
      ans++;
    }
  }
  if(b[n - 1]) ans++;
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 640
import math

a, b, c = map(float, input().split())
h = b * math.sin(math.radians(c))
w = b * math.cos(math.radians(c))
s = a * h / 2
l = a + math.sqrt(h ** 2 + w ** 2) + math.sqrt(h ** 2 + (a - w) ** 2)
print(s)
print(l)
print(h)



Measured memory_bytes: 5692
import java.util.Scanner;
public class Main
{
  public static void main(String[] args)
  {
    Scanner sc = new Scanner(System.in);
    String str = sc.next();
    String str1 = sc.next();
    boolean b = false;
    for(char c = 'a'; c <= 'z'; c++)
    {
      if((str+c).equals(str1))
      {
        b = true;
      }
    }
    System.out.println(b?"Yes":"No");
  }
}


Measured memory_bytes: 38852
N = int(input())
W = list(map(int, input().split()))

for T in range(1, N):
    little = 0
    for Wl in W[:T]:
        little += Wl
    large = 0
    for Wg in W[T:]:
        large += Wg
    Abs_now = abs(large - little)
    if T == 1:
        Abs = Abs_now
    if Abs_now < Abs:
        Abs = Abs_now

print(Abs)


Measured memory_bytes: 3060
#include <algorithm>
#include <iostream>
#include <vector>
using namespace std;
using ll = long long;
#define FOR(i, n) for (int i = 0; i < (int)(n); i++)
#define FOR2(i, s, n) for (int i = (s); i < (int)(n); i++)

int main() {
  int N;
  cin >> N;
  string S;
  cin >> S;

  ll r = 0, g = 0, b = 0;
  FOR(i, N) {
    if (S[i] == 'R') r++;
    if (S[i] == 'G') g++;
    if (S[i] == 'B') b++;
  }

  ll ans = r * g * b;
  FOR(i, N) {
    FOR2(j, i + 1, N) {
      if (S[i] == S[j]) continue;
      int k = 2 * j - i;
      if (k >= N || S[k] == S[i] || S[k] == S[j]) continue;
      ans--;
    }
  }

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


Measured memory_bytes: 3632
import random


d = int(input())
c = list(map(int,input().split()))
s = []

class field:
    def __init__(self):
        self.ans = [-1 for i in range(365)]
        self.last = [-1 for i in range(26)]


    def score_day(self,day,type):
        inc = s[day][type]
        dec = 0
        for i in range(26):
            dec += c[i]*(day-self.last[i])

        return  inc-dec


for i in range(d):
    arr = list(map(int,input().split()))
    s.append(arr)

best_score = 0
alloc = []

F = field()
ans = 0
good = []
childs = 60
badchild = 10
for day in range(d):
    if day == 0:
        tp_scores = []
        for j in range(25):
            prob = j
            befl = F.last[prob]
            F.last[prob] = day
            sc = F.score_day(day, prob)
            tp_scores.append([-sc, j,F.last.copy(),str(j)])

            F.last[prob] = befl

        tp_scores.sort()
        good = tp_scores
    else:
        tp_scores = []
        for i in range(min(childs,len(good))):
            befs = good[i][0]
            befp = good[i][1]
            befl = good[i][2]
            befa = good[i][3]
            F.last = befl
            for j in range(25):
                prob = j
                bt = F.last[prob]
                F.last[prob] = day
                sc = F.score_day(day,prob)
                tp_scores.append([befs-sc,j,F.last.copy(),befa+","+str(j)])

                F.last[prob] = bt

        tp_scores.sort()
        good = tp_scores[:childs]

        if len(tp_scores) > childs:
            rest =len(tp_scores)-childs
            pick = min(badchild,rest)
            sp = random.sample(range(childs,len(tp_scores)),pick)
            for sss in sp:
                good.append(tp_scores[sss])


# print(good[0])


# for g in good:
#     tp = 0
#     root = list(map(int,g[-1].split(",")))
#     F = field()
#     for i in range(len(root)):
#         F.ans[i] = root[i]
#         F.last[root[i]] = i
#         tp += F.score_day(i,root[i])
#     print(root,tp)


root = map(int,good[0][-1].split(","))

for r in root:
    print(r+1)


Measured memory_bytes: 186896
#include <algorithm>
#include <cmath>
#include <complex>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <vector>
#include <functional>
#include <cstring>
#include <regex>
#include <random>
#include <cassert>
using namespace std;

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repr(i, s, n) for (int i = (s); i < (int)(n); i++)
#define revrep(i, n) for (int i = (n); i >= 0; i--)
#define revrepr(i, a, b) for (int i = (a); i >= b; i--)
#define debug(x) cerr << #x << ": " << x << "\n"

using ll = long long;
using P = pair<int, int>;

const long long MOD = 1e9+7;

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; }

template<class T>
istream& operator >>(istream &is, vector<T> &v) {
    for (int i = 0; i < (int)v.size(); i++) cin >> v.at(i);
    return is;
}

int main() {
    int n, k;
    cin >> n >> k;
    vector<ll> num(k);
    repr(i, 1, n + 1) num.at(i % k)++;
    ll ans = 0;
    rep(a, k) {
        int b = (k - a) % k;
        int c = (k - a) % k;
        if ((b + c) % k == 0) ans += num.at(a) * num.at(b) * num.at(c);
    }
    cout << ans << endl;
}

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

int main() {
  char a[11], b[11], c[11];
  scanf("%s %s %s", a, b, c);

  printf("%s\n", a[strlen(a)-1]==b[0] && b[strlen(b)-1]==c[0] ? "YES": "NO");
  return 0;
}

Measured memory_bytes: 128
#include <cstdio>
#include <iostream>
#include <stack>
#include <queue>
#include <vector>
#include <map>
#include <string>
#include <utility>
#include <algorithm>
#include <numeric>
#include <functional>

#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define RFOR(i,a,b) for (int i=(b)-1;i>=(a);i--)
#define REP(i,n) for (int i=0;i<(n);i++)
#define RREP(i,n) for (int i=(n)-1;i>=0;i--)
#define ALL(a) (a).begin(),(a).end()

using namespace std;
typedef long long ll;

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

int n, x, ans;

int main(int argc, char *argv[])
{
  cin.tie(0);
  ios::sync_with_stdio(false);

  cin >> n;
  REP(i,n){
    cin >> x;
    if (isPrime(x)) ++ans;
  }
  cout << ans << endl;
  
  return 0;
}

Measured memory_bytes: 1196
n = int(input())
s = input()
INF = 10**12
li = [INF]*n
c = 0
for i in range(len(s)):
    if i == 0:
        continue
    else:
        if s[i] == 'E':
            c+=1
li[0] = c
for i in range(n):
    if i == 0:
        continue
    else:
        li[i] = li[i-1]
        if s[i] == 'E':
            li[i] -= 1
        if s[i-1] == 'W':
            li[i] += 1

print(min(li))
        
        

Measured memory_bytes: 15264
# coding: utf-8

############################

x,n = map(int,input().split())

if n==0:
    print(x)
    exit()

z=101
p_list = list(map(int,input().split()))
pp_list = [i for i in range(102)]

for j in p_list:
    pp_list.remove(j)

for k in pp_list:
    zettaiti = abs(x-k)

    if z > zettaiti:
        z = zettaiti
        ans = k

print(ans)

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

int main(void){
    int r,g,b,num;
    cin >> r;
    cin >> g;
    cin >> b;
    num = g*10+b;
    if(num%4==0) cout << "YES" << endl;
    else cout << "NO" << endl;
}

Measured memory_bytes: 256
for i in range(input()):
	n = raw_input()
	c = 0
	while len(n) > 1:
		c += 1
		maxn = 0
		for i in range(1,len(n)):
			maxn = max(maxn, int(n[:i])*int(n[i:]))
		n = str(maxn)
	print c

Measured memory_bytes: 4216
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define all(t) t.begin(), t.end()
#define inrange(i, a, b) (((i)>= min((a), (b))) && ((i) <= max((a), (b))))
#define show(x) cout << #x << " is " << x << "\n";
typedef vector<ll> vi;
#define fi first
#define se second
const ll inf = 9e18;
const ll mod = 1e9 + 7;

void print(ll a[], ll n){for(ll i=0;i<n;i++){cout<<a[i]<<" ";}cout<<"\n";}
ll power(ll x, ll y, ll M = inf){
    ll ans = 1;
    x %= M;
    while(y){
        if(y&1)
            ans = (x * ans) % M;

        x = (x * x) % M;
        y >>= 1;
    }
    return ans;
}
ll modInverse(ll n) {return power(n, mod-2, mod);}
inline ll mul(ll a, ll b){ return (a * b) % mod; }
inline ll sub(ll a, ll b){ ll c = a - b; if(c < 0) c += mod; return c; }
inline ll add(ll a, ll b){ ll c = a + b; if(c > mod) c -= mod; return c; }
inline ll divi(ll a, ll b){ return mul(a, modInverse(b)); }

//const ll N = 1e5 + 1;
//vector<ll> adj[N];
//bool visited[N];

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

	ll n, k, x;
	ll d;
	cin>>n>>k;
	ll ar[n+1] = {0};
	for(int i=0;i<k;i++){
		cin>>d;
		for(int j=0;j<d;j++){
			cin>>x;
			ar[x]++;
		}
	}
	ll ans=0;
	for(int i=1;i<=n;i++){
		if(ar[i]==0) ans++;
	}
	cout<<ans;

	return 0;
}


Measured memory_bytes: 3644
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(a) a.begin(),a.end()
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define limit(x,l,r) max(l,min(x,r))
#define lims(x,l,r) (x = max(l,min(x,r)))
#define isin(x,l,r) ((l) <= (x) && (x) < (r))
#define pb push_back
#define sz(x) (int)(x).size()
#define pcnt __builtin_popcountll
#define uni(x) x.erase(unique(rng(x)),x.end())
#define snuke srand((unsigned)clock()+(unsigned)time(NULL));
#define show(x) cout<<#x<<" = "<<x<<endl;
#define PQ(T) priority_queue<T,v(T),greater<T> >
#define bn(x) ((1<<x)-1)
#define dup(x,y) (((x)+(y)-1)/(y))
#define newline puts("")
#define v(T) vector<T>
#define vv(T) v(v(T))
using namespace std;
typedef long long int ll;
typedef unsigned uint;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
inline int in() { int x; scanf("%d",&x); return x;}
template<typename T>inline istream& operator>>(istream&i,v(T)&v)
{rep(j,sz(v))i>>v[j];return i;}
template<typename T>string join(const v(T)&v)
{stringstream s;rep(i,sz(v))s<<' '<<v[i];return s.str().substr(1);}
template<typename T>inline ostream& operator<<(ostream&o,const v(T)&v)
{if(sz(v))o<<join(v);return o;}
template<typename T1,typename T2>inline istream& operator>>(istream&i,pair<T1,T2>&v)
{return i>>v.fi>>v.se;}
template<typename T1,typename T2>inline ostream& operator<<(ostream&o,const pair<T1,T2>&v)
{return o<<v.fi<<","<<v.se;}
template<typename T>inline ll suma(const v(T)& a) { ll res(0); for (auto&& x : a) res += x; return res;}
const double eps = 1e-10;
const ll LINF = 1001002003004005006ll;
const int INF = 1001001001;
#define dame { puts("-1"); return 0;}
#define yn {puts("Yes");}else{puts("No");}
const int MX = 200005;

    // 整数スキャン（複数）
    /*
    int x;
    scanf("%d",&x);
    int y;
    scanf("%d",&y);
    int z;
    scanf("%d",&z);

    // n個の整数のスキャン
    /*
    ll a[n] = {};
    rep(i,n){
        scanf("%lld",&a[i]);
    }
    */

    // 文字列スキャン
    /*
    string s;
    cin >> s;
    */

    // n個の文字列スキャン
    /*
    vector<string> slist;
    rep(i,n){
        string s;
        cin >> s;
        slist.push_back(s);
    }
    */

int main() {
    ll x;
    scanf("%lld",&x);
    ll y;
    scanf("%lld",&y);


    ll ans = 1;
    while(x*2<=y){
        x*=2;
        ans++;
    }
    
    cout << ans << endl;
    return 0;
}
 
 


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

int n;
int a[200005];
int main()
{
	cin>>n;
	for(int i=1;i<=n;i++)
	cin>>a[i];
	
	sort(a+1,a+n+1);
	long long ans=(long long)a[n];
	int res=n-2;
    int ge=res/2;
    for(int i=n-1;i>=n-ge;i--){
    	ans+=(long long)a[i]*2;
	} 
	int yu=res%2;
	if(yu)
	ans+=(long long)a[n-ge-1];
	cout<<ans<<endl;
	return 0;
}

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

int main( void )
{
	ll A,B,K;
	cin >> A >> B >> K;
	
	ll x = min(A,K);
	A -= x;
	K -= x;
	B -= min(B,K);
	
	cout << A << " " << B << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  long long int i,j,k,n;
  cin>>n;
  long long int dp[n],a[n];
  for(i=0;i<n;i++)
    cin>>a[i];
  if(n==2){
    cout<<abs(a[1]-a[0]);
    return 0;
  }
  else if(n==3)	{
    cout<<abs(a[2]-a[0]);
    return 0;
  }
  else if(n==1){
    cout<<0;
    return 0;
  }
  dp[n-1]=0;
  dp[n-2]=abs(a[n-1]-a[n-2]);
  dp[n-3]=abs(a[n-1]-a[n-3]);
  i=n-4;	
  while(i>=0){
	dp[i]=min(abs(a[i]-a[i+1])+dp[i+1],abs(a[i]-a[i+2])+dp[i+2]);  	
    i--;
  } 
  cout<<dp[0];
  return 0; 
}

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

int main(void){
    int H,R;cin >> H >> R;
    
    if(H+R == 0){
        cout << 0 << endl;
    }else if(H+R > 0){
        cout << 1 << endl;
    }else{
        cout << -1 << endl;
    }
    
    return 0;
    
}


Measured memory_bytes: 3116
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <math.h>
#include <string>
#include <numeric>
#include <algorithm>
#include <utility>


using std::cout;
using std::cin;
using namespace std;
typedef long long ll;
typedef unsigned long long ull;


ll gcd(ll a, ll b) {
    while (b != 0) {
        auto tmp = a;
        a = b;
        b = tmp % a;
    }
    return a;
}

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

int isPrime(int a) {
    for (int i = 2; i * i <= a; ++i) {
        if (a % i == 0) {
            return 0;
        }
    }
    return 1;
}





void oneCase () {
    ll n, t;
    cin >> n >> t;
    ll total = 0;
    vector<ll> nums(n);
    for (auto& el : nums) {
        cin >> el;
    }
    for (int i = 0; i + 1 < n; ++i) {
        total += min(t, nums[i + 1] - nums[i]);
    }
    cout << total + t << "\n";

}





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

    return 0;
}

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

int W, H;
int G[110][110];

int dfs(int x, int y) {
  int cnt = 0;
  const static int dx[2][6] = {{-1,0,-1,1,-1,0},{0,1,-1,1,0,1}};
  const static int dy[2][6] = {{-1,-1,0,0,1,1} ,{-1,-1,0,0,1,1}};
  G[y][x] = -1;
  for(int k = 0; k < 6; ++k) {
    int nx = x + dx[y%2][k];
    int ny = y + dy[y%2][k];
    if(nx < 0 || nx >= W) continue;
    if(ny < 0 || ny >= H) continue;
    if(G[ny][nx] == 1) {
      ++cnt;
      continue;
    }
    if(G[ny][nx] == 0) {
      cnt += dfs(nx,ny);
    }
  }
  return cnt;
}

int main() {
  cin >> W >> H;
  fill(G[0],G[110],0);
  for(int i = 0; i < H; ++i) {
    for(int j = 0; j < W; ++j) {
      cin >> G[i+1][j+1];
    }
  }
  H += 2;
  W += 2;
  cout << dfs(0,0) << endl;
  return 0;
}

Measured memory_bytes: 0
#include <iostream>
using namespace std;
int main(){
    int a,b;
    cin>>a>>b;
    while(a!=0 || b!=0){
        for (int i=0;i<a;i++){
            for (int j=0;j<b;j++){
                cout<<"#";
            }
            cout<<endl;
        }
        cout<<endl;
        cin>>a>>b;
    }
}


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


int main(){
	//freopen("i.txt","r",stdin);
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	int p = 0;
	
	int n;
	cin >> n;
	for(int i = 0;i < n;i++){
		int x;
		cin >> x;
		if(x == p+1){
			p++;
		}
	}
	
	if(p == 0){
		cout << -1;
	}
	else{
		cout << (n - p);
	}
	
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MAXN = 2e5 + 5;
const ll INF = 0x3f3f3f3f3f3f3f3f;
const ll p = 1e9 + 7;
#define DEBUG(x) cout << (x) << '\n'
#define fi first
#define se second

ll n, x, ans, last, pre[MAXN];
void run(){
    cin >> n;
    for(int i = 1; i <= n; i++){
        cin >> x;
        pre[i-1] = (pre[i-1] + last) % p;
        ans = (ans + pre[i-1] * x % p) % p;
        pre[i] = pre[i-1], last = x;
    }
    DEBUG(ans);
}
int main(){
#ifdef Irene
    freopen("in.txt", "r", stdin);
#endif // Irene
    ios_base::sync_with_stdio(false);

    run(); return 0;
}


Measured memory_bytes: 5184
from collections import defaultdict
dic = defaultdict(int) 
N = int(input())
for i in range(N):
  temp = int(input())
  dic[i+1] = temp
#print(dic)
ans = 0
L = list(dic.keys())
nokori = -1
for i in range(N):
  if dic[L[i]] >= 1 and L[i]-nokori <= 1:
    ans += 1
    dic[L[i]] -=1
    nokori = -1
  ans += dic[L[i]]//2
  if dic[L[i]]%2 == 1:
    nokori = L[i]
print(ans)
  

Measured memory_bytes: 22312
using System;

namespace ABC083_A_Libra
{
	internal class Program
	{
		public static void Main(string[] args)
		{
			string[] input = Console.ReadLine().Split(' ');
			int a = int.Parse(input[0]);
			int b = int.Parse(input[1]);
			int c = int.Parse(input[2]);
			int d = int.Parse(input[3]);

			if (a + b > c + d)
			{
				Console.WriteLine("Left");
			}else if (a + b == c + d)
			{
				Console.WriteLine("Balanced");
			}
			else
			{
				Console.WriteLine("Right");
			}
		}
	}
}

Measured memory_bytes: 11092
fun main(args: Array<String>) = println(run {
    val (n, m) = readLine()!!.split(" ").map { it.toInt() }
    val sm = (1..m).map { readLine()!!.split(" ").map { it.toInt() } }

    val conditions = sm.groupBy { it[0]-1 }.mapValues { entry ->
        val values = entry.value.map { it -> it[1] }.distinct()
        if (values.size > 1) return@run -1
        values.first()
    }

    for (i in 0..999) {
        val str = i.toString()
        if (str.length != n) continue
        when {
            conditions.all { str[it.key].toString().toInt() == it.value } -> return@run i
        }
    }
    -1
})


Measured memory_bytes: 37808
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ABC086A
{
    class Program
    {
        static void Main(string[] args)
        {
            // スペース区切りの整数の入力
            string[] input = Console.ReadLine().Split(' ');
            int a = int.Parse(input[0]);
            int b = int.Parse(input[1]);

            int v = a * b;

            if ((v % 2) == 0)
            {
                Console.WriteLine("Even");
            }
            else
            {
                Console.WriteLine("Odd");
            }
        }
    }
}


Measured memory_bytes: 13140
#include <iostream>
#include<string.h>
using namespace std; 
int main()
{

int a , b , c ;
cin >> a >> b >> c ;

if ( (a == b || a == c  || b==c ) &&(    a != b || a !=c || b!=c    )  ){
	cout<<"Yes" ;
}
else 
cout<<"No" ;
 
  
}


Measured memory_bytes: 256