akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
#define int long long
main()
{
    ios::sync_with_stdio(0);
    int n,m;
    cin>>n>>m;
    if ((n == 1)||(m == 1)){
        cout<<1;
        return 0;
    }
    int z1,z2;
    if (m%2){
        z1=m/2+1;
    }
    else{
        z1=m/2;
    }
    z2=m-z1;

    int y1,y2;
    if (n%2){
        y1=n/2+1;
    }
    else{
        y1=n/2;
    }
    y2=n-y1;

    cout<<z1*y1 + z2*y2;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rrep(i,n) for(int i=(int)(n)-1;i>=0;i--)
#define each(a,x) for(auto a : (x))
#define all(a) (a).begin(),(a).end()
#define chmin(a,b) ((a) = min((a),(b)))
#define chmax(a,b) ((a) = max((a),(b)))
#define in_range(x,l,r) ((l)<=(x) && (x)<(r))
#define fs first
#define sc second
#define pb push_back
#define sz size() 
#define MP make_pair
using namespace std;
typedef long long ll;
typedef double D;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<string> vs;

const int INF = 1e8;
const D EPS = 1e-8;

inline bool can(int n, const vi &use){
  while(n){
    if(use[n%10] == 0) return false;
    n /= 10;
  }
  return true;
}

int main(){
  int n,k;
  cin >> n >> k;
  vi use(10,1);
  rep(i,k){
    int d; cin >> d; use[d] = 0;
  }

  for(;;){
    if(can(n,use)){
      cout << n << endl;
      break;
    }
    n++;
  }
}


Measured memory_bytes: 256
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
	"strings"
)

var sc = bufio.NewScanner(os.Stdin)

func Scan() string {
	sc.Scan()
	return sc.Text()
}
func rScan() []rune {
	return []rune(Scan())
}
func iScan() int {
	n, _ := strconv.Atoi(Scan())
	return n
}
func fScan() float64 {
	n, _ := strconv.ParseFloat(Scan(), 64)
	return n
}
func stringToInt(s string) int {
	n, _ := strconv.Atoi(s)
	return n
}
func SScan(n int) []string {
	a := make([]string, n)
	for i := 0; i < n; i++ {
		a[i] = Scan()
	}
	return a
}
func iSScan(n int) []int {
	a := make([]int, n)
	for i := 0; i < n; i++ {
		a[i] = iScan()
	}
	return a
}
func abs(x int) int {
	if x < 0 {
		x = -x
	}
	return x
}
func mod(x, d int) int {
	x %= d
	if x < 0 {
		x += d
	}
	return x
}
func larger(a, b int) int {
	if a < b {
		return b
	} else {
		return a
	}
}
func smaller(a, b int) int {
	if a > b {
		return b
	} else {
		return a
	}
}
func max(a []int) int {
	x := -int(1e+18)
	for i := 0; i < len(a); i++ {
		if x < a[i] {
			x = a[i]
		}
	}
	return x
}
func min(a []int) int {
	x := int(1e+18)
	for i := 0; i < len(a); i++ {
		if x > a[i] {
			x = a[i]
		}
	}
	return x
}
func sum(a []int) int {
	x := 0
	for _, v := range a {
		x += v
	}
	return x
}
func fSum(a []float64) float64 {
	x := 0.
	for _, v := range a {
		x += v
	}
	return x
}
func bPrint(f bool, x string, y string) {
	if f {
		fmt.Println(x)
	} else {
		fmt.Println(y)
	}
}
func iSSPrint(x []int) {
	fmt.Println(strings.Trim(fmt.Sprint(x), "[]"))
}

var lp1 int = 1000000007
var lp2 int = 998244353

func main() {
	buf := make([]byte, 0)
	sc.Buffer(buf, lp1)
	sc.Split(bufio.ScanWords)
	n := iScan()
	x := iScan()
	m := iScan()
	as := make([]int, m)
	for i := 0; i < m; i++ {
		as[i] = i * i % m
	}
	c := make([]int, m)
	for i := 0; i < m; i++ {
		c[i] = -1
	}
	c[x] = 0
	q := make([]int, 1, m)
	q[0] = x
	lps := -1
	lpl := -1
	for {
		idx := q[len(q)-1]
		if c[as[idx]] == -1 {
			c[as[idx]] = len(q)
			q = append(q, as[idx])
			idx++
		} else {
			lps = c[as[idx]]
			lpl = len(q) - c[as[idx]]
			break
		}
	}
	ans := 0
	for i := 0; i < lps; i++ {
		ans += q[i]
	}
	y := (n - lps) / lpl
	for i := lps; i < len(q); i++ {
		ans += y * q[i]
	}
	z := (n - lps) % lpl
	for i := lps; i < lps+z; i++ {
		ans += q[i]
	}
	fmt.Println(ans)
}


Measured memory_bytes: 3796
#include<bits/stdc++.h>
using namespace std;
int bmp(int a,int b){
	return a<b;
}
int main()
{
	int a,b,x[1010],sum=0;
	cin>>a>>b;
	for(int i=0;i<a;i++) cin>>x[i];
	sort(x,x+a,bmp);
	for(int i=0;i<b;i++) sum+=x[i];
	cout<<sum<<endl;
	return 0;
}


Measured memory_bytes: 3600
#include <bits/stdc++.h>
#define REP(i, a, n) for (long long i = (a); i < (long long)(n); ++i)
#define REPC(i, a, n) for (long long i = (a); i <= (long long)(n); ++i)
#define ALL(t) t.begin(), t.end()
#define RALL(t) t.rbegin(), t.rend()
#define MATINIT(type, row, col, init) \
  vector<vector<type>>(row, vector<type>(col, init));
#define Yes(cond) cout << (cond ? "Yes" : "No") << endl;
#define YES(cond) cout << (cond ? "YES" : "NO") << endl;
using namespace std;
using LL = long long;
using ULL = unsigned long long;
template <class T>
using VEC = std::vector<T>;
template <class T>
using MAT = std::vector<std::vector<T>>;
void DUMP() { cerr << endl; }
template <class Head, class... Tail>
void DUMP(Head &&head, Tail &&... tail) {
  cerr << head << ", ";
  DUMP(std::move(tail)...);
}
template <typename T>
ostream &operator<<(ostream &os, vector<T> &vec) {
  os << "{";
  for (auto v : vec) os << v << ",";
  os << "}";
  return os;
}
template <typename T>
ostream &operator<<(ostream &os, set<T> &s) {
  os << "{";
  for (auto p : s) os << p << ",";
  os << "}";
  return os;
}
template <typename T1, typename T2>
ostream &operator<<(ostream &os, map<T1, T2> &m) {
  os << "{";
  for (auto p : m) os << p << ",";
  os << "}";
  return os;
}
template <typename T1, typename T2>
ostream &operator<<(ostream &os, pair<T1, T2> p) {
  os << "[" << p.first << " " << p.second << "]";
  return os;
}

int main() {
  LL N;
  cin >> N;
  VEC<LL> A(N);
  REP(i, 0, N) cin >> A[i];
  VEC<LL> B(N, 0), C(N, 0);
  B[0] = A[0];
  C[N - 1] = A[N - 1];
  REP(i, 1, N) {
    B[i] = max(B[i - 1], A[i]);
    C[N - i - 1] = max(C[N - i], A[N - i - 1]);
  }
  REP(i, 0, N) {
    LL left = i - 1 >= 0 ? B[i - 1] : 0;
    LL right = i + 1 < N ? C[i + 1] : 0;
    cout << max(left,right)<<endl;
  }

  return 0;
}


Measured memory_bytes: 6272
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

#define ll              long long
#define pb              push_back
#define ppb             pop_back
#define endl            '\n'
#define mii             map<ll,ll>
#define pii             pair<ll,ll>
#define vi              vector<ll>
#define vs              vector<string>
#define all(a)          (a).begin(),(a).end()
#define F               first
#define S               second
#define sz(x)           (ll)x.size()
#define hell            1000000007
#define inf             (ll)1e18 + 5
#define PI              3.14159265358979323844
#define rep(i,a,b)      for (ll i=a;i<b;i++)
#define repr(i,a,b)     for (ll i=a-1;i>=b;i--)
#define lbnd            lower_bound
#define ubnd            upper_bound
#define mp              make_pair
#define ios             ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define ordered_set     tree<ll, null_type,less<ll>, rb_tree_tag,tree_order_statistics_node_update>
#define trace(...)      __f(#__VA_ARGS__, __VA_ARGS__)

template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
    std::cerr << name << " : " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
    const char* comma = strchr(names + 1, ',');std::cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}

using namespace std;
using namespace __gnu_pbds;

/*----------------------Graph Moves----------------*/
//const int fx[]={+1,-1,+0,+0};
//const int fy[]={+0,+0,+1,-1};
//const int fx[]={+0,+0,+1,-1,-1,+1,-1,+1};   // Kings Move
//const int fy[]={-1,+1,+0,+0,+1,+1,-1,-1};  // Kings Move
//const int fx[]={-2, -2, -1, -1,  1,  1,  2,  2};  // Knights Move
//const int fy[]={-1,  1, -2,  2, -2,  2, -1,  1}; // Knights Move
/*------------------------------------------------*/

//primes for hashing 937,991,1013,1409,1741

ll x,y,a,b,c;
ll p[100005],q[100005],r[100005];

void solve() {
    cin>>x>>y>>a>>b>>c;
    rep(i,0,a){
    	cin>>p[i];
    }
    rep(i,0,b){
    	cin>>q[i];
    }
    rep(i,0,c){
    	cin>>r[i];
    }
    sort(p,p+a,greater <ll> ());
    sort(r,r+c,greater <ll> ());
    sort(q,q+b,greater <ll> ());
    vi v;
    rep(i,0,x){
    	v.pb(p[i]);
    }
    rep(i,0,y){
    	v.pb(q[i]);
    }
    rep(i,0,min(x+y,c)){
    	v.pb(r[i]);
    }
    ll ans=0;
    sort(all(v),greater <ll> ());
    rep(i,0,x+y)ans+=v[i];
    cout<<ans<<endl;
}

signed main() {
    ios
    ll test=1;
    //cin>>test;
    while (test--) solve();
    return 0;
}

Measured memory_bytes: 8560
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx")

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

#define ll long long
#define ld long double
#define F first
#define S second
#define pb push_back
#define sqr(x) (x) * (x)

using namespace std;
using namespace __gnu_pbds;

mt19937_64 gen(time(0));

typedef tree<
pair <int, int>,
null_type,
less<pair <int, int>>,
rb_tree_tag,
tree_order_statistics_node_update>
ordered_set;

//const int inf = 1e9 + 12;
//const int mod = 1e9 + 7;

//const int maxn = 2e5 + 55;

//int n;
//set <pair <int, int>> st;


signed main()
{
    cin.tie(0);
    cout.tie(0);
    ios_base::sync_with_stdio(false);
#ifdef LOCAL
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#else

#endif
    int x;
    cin >> x;
    cout << ((x * 360) / __gcd(x, 360)) / x;
    return 0;
}


Measured memory_bytes: 3632
#include <bits/stdc++.h>
using namespace std;
int main(){
  int N, A;
  cin >> N >> A;
  if( N % 500 == 0) cout << "Yes";
  else if(( N % 500 != 0) && ( N % 500) < A) cout << "Yes";
  else cout << "No";
}

Measured memory_bytes: 384
a,b = input().split()
a = int(a)
b = int(b)
string = ""
if a>b:
    for i in range(a):
        string = string+str(b)
elif b>a:
    for i in range(b):
        string = string+str(a)
else:
    for i in range(a):
        string =  string+str(a)
print(string)

Measured memory_bytes: 3064
#include <iostream>
#include <map>
#include <string>

using namespace std; // std::map~, std::cout~とかを省略する為

int main() {
	map<string, int> dict; // 文字列と出現回数の辞書作成

	int n; cin >> n; // 下for文のループ回数
	for (string x; n--; dict[x]++) { // 辞書内の文字列xに対応する出現回数を+1する
		cin >> x; // 文字列 x 入力
	}
	
		cout << dict.size() << endl;

}


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

#define I inline
#define fi first
#define se second
#define R register
#define LL long long
#define mp make_pair
#define reg register int
#define pii pair<int,int>
#define fo(i, a, b) for(reg i = a; i <= b; i++)
#define fd(i, a, b) for(reg i = a; i >= b; i--)
#define cr const reg&
using namespace std;
const int N = 1e5 + 1;

I int _max(cr x, cr y) {return x > y ? x : y;}
I int _min(cr x, cr y) {return x < y ? x : y;}
I int read() {
	reg x = 0, f = 1; char ch = getchar();
	while(ch < '0' || ch > '9') {if(ch == '-') f = -1; ch = getchar();}
	while(ch >= '0' && ch <= '9') x = (x << 3) + (x << 1) + (ch ^ 48), ch = getchar();
	return x * f;
}
I void ptt(LL x) {if(x >= 10) ptt(x / 10); putchar(x % 10 + '0');}
I void put(LL x) {x < 0 ? putchar('-'), ptt(-x) : ptt(x);}
I void pr1(LL x) {put(x), putchar(' ');}
I void pr2(LL x) {put(x), puts("");}

struct edge {
	int x, y, next;
} e[N * 2]; int len, last[N];
bool v[N][2];

I void ins(cr x, cr y) {e[++len] = edge{x, y, last[x]}, last[x] = len;}

void dfs(cr x, cr o) {
	if(v[x][o]) return ; v[x][o] = 1;
	for(reg k = last[x]; k; k = e[k].next) dfs(e[k].y, o ^ 1);
}

int main() {
	reg n = read(), m = read();
	fo(i, 1, m) {
		reg x = read(), y = read();
		ins(x, y), ins(y, x);
	} dfs(1, 0);
	reg s1 = 0, s2 = 0;
	fo(i, 1, n) if(!v[i][0] || !v[i][1]) {
		if(v[i][0]) s1++; else s2++;
	} LL ans = (LL)n * (n - 1) / 2;
	ans -= (LL)s1 * (s1 - 1) / 2 + (LL)s2 * (s2 - 1) / 2;
	pr2(ans - m);
	return 0;
}



Measured memory_bytes: 5760
#include <iostream>
#include <set>
#include <vector>
#include <string>
#include <algorithm>
#include <iterator>
#include <map>
#include <utility>
#include <list>
#include <climits>
#include <bitset>
#include <numeric>

using namespace std;

#define rep(i, n) for(int i = 0; i < n; i++)
#define repi(i, n) for(auto i = (n).begin(); i != (n).end(); i++)
#define in_arr(type, a, n) copy_n(istream_iterator<type>(cin), n, (a).begin());
#define ll long long int

int main(){
    int n;
    cin >> n;
    string s;
    cin >> s;
    int ans = 0;
    set<int> right, left, uni;
    for(int i = 0; i < n; i++){
        for(int j = 0; j < i; j++){
            left.insert(s[j]);
        }
        for(int j = i; j < n; j++){
            right.insert(s[j]);
        }
        for(set<int>::iterator j = left.begin(); j != left.end(); j++){
            if(right.find(*j) != right.end()){
                //left.erase(*j);
                uni.insert(*j);
            }
        }
        ans = max(ans, (int)uni.size());
        right.clear();
        left.clear();
        uni.clear();
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define all(v) v.begin(),v.end()
#define ff(i, x, n, k) for(int i=x;i<n;i+=k)
#define rf(i, x, n, k) for(int i=n-1;i>=x;i+=k)
#define ef(i, x, n, k) for(int i=x;i<=n;i+=k)
#define pb push_back
#define eb emplace_back
#define pp pop_back
#define mp make_pair
#define fast_cin() ios_base::sync_with_stdio(false); cin.tie(NULL)

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

const int MOD = 1e9+7;
const ll INF = pow(10, 18)+5;

int main()
{
	fast_cin();
	ll n, W; cin >> n >> W;

	vector <pll> vpr;
	vpr.pb({-1, -1});

	for (int i = 0; i < n; i ++){
		ll x, y; cin >> x >> y;
		vpr.pb({x, y});
	}

	ll arr[n+1][W+1] = {0};
	sort(all(vpr));

	for (int i = vpr[1].F; i <= W; i ++)
		arr[1][i] = vpr[1].S;

	for (int i = 2; i <= n; i ++){
		for (int j = 2; j <= W; j ++){
			if (j < vpr[i].F)
				arr[i][j] = arr[i-1][j];

			else if (j - vpr[i].F >= 0)
				arr[i][j] = max(arr[i-1][j], vpr[i].S + arr[i-1][j-vpr[i].F]);
		}
	}

	cout << arr[n][W] << '\n';
	return 0;
}

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

using namespace std;

#define rep(i,a,b) for(int i = a; i<int(b);++i)
#define all(v) v.begin(),v.end()
#define sz(v) v.size()
#define trav(a,c) for(auto a: c)

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

int main(){
	cin.sync_with_stdio(false);
    ll n,k;
    cin>>n>>k;
    vector<vi> numB(2*k,vi(2*k));
    vector<vi> numW(2*k,vi(2*k));
    rep(i,0,n){
        ll x,y;
        char c;
        cin>>x>>y>>c;
        if(c=='W') numW[x%(2*k)][y%(2*k)]++;
        else numB[x%(2*k)][y%(2*k)]++;
    }


    vector<vi> dpB(2*k+1,vi(2*k+1));
    vector<vi> dpW(2*k+1,vi(2*k+1));
    rep(i,1,2*k+1)
        rep(j,1,2*k+1){
            dpW[i][j] = dpW[i-1][j] + dpW[i][j-1]
                    - dpW[i-1][j-1] + numW[i-1][j-1];
            dpB[i][j] = dpB[i-1][j] + dpB[i][j-1]
                    - dpB[i-1][j-1] + numB[i-1][j-1];
        }

    ll ans = 0;

    rep(i,-k,k+1)
        rep(j,-k,k+1){
            ll numRight = 0;
            ll numWrong = 0;
            rep(di,0,3)
                rep(dj,0,3){
                    ll sx = di*k+i;
                    ll sy = dj*k+j;
                    ll ex = min(2*k,sx+k);
                    ll ey = min(2*k,sy+k);
                    sx = max(0ll,min(2*k,sx));
                    sy = max(0ll,min(2*k,sy));
                    ll a = dpB[ex][ey]-dpB[sx][ey]-dpB[ex][sy]+dpB[sx][sy];
                    ll b = dpW[ex][ey]-dpW[sx][ey]-dpW[ex][sy]+dpW[sx][sy];
                    if((di+dj)%2==0){
                        numRight += a;
                        numWrong += b;
                    } else {
                        numRight += b;
                        numWrong += a;
                    }
                }
            ans = max(ans,max(numRight,numWrong));
        }
        cout<<ans<<endl;
}


Measured memory_bytes: 125568
module Main where

import Control.Applicative
import Control.Monad
import Data.List
import Data.Ord (comparing)

main :: IO ()
main = do
    getLine
    as <- fmap read . words <$> getLine :: IO [Int]
    let bs = [a + i | a <- as,  i <- [-1, 0, 1]]
    let ans = length . maximumBy (comparing length) . group . sort $ bs
    print ans

Measured memory_bytes: 48508
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n - 1; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define FORR(i,m,n) for(int i = m - 1; i >= n; i--)
#define ALL(v) v.begin(), v.end()
#define CMAX(m, x)  m = max(m,x)
#define CMIN(m, x)  m = min(m,x)
#define itn int
#define Yes() cout << "Yes" << endl
#define No() cout << "No" << endl
#define YES() cout << "YES" << endl
#define NO() cout << "NO" << endl
typedef long long lint;
typedef long double ldouble;
const int INF = 1e9;
const lint LINF = 1e18;
int main(){
    int n,m,x;
    cin >> n >> m >> x;
    vector<int> digit(n,0);
    vector<int> val(n,1);
    vector<int> p(n);
    vector<vector<int>> a(n,vector<int>(m));
    int mn = INF;
    REP(i,n){
        cin >> p[i];
        REP(j,m)
            cin >> a[i][j];
    }
    while(1){
        bool flag = true;
        int pp = 0;
        vector<int> skill(m,0);
        REP(i,n){
            if(digit[i] == 1){
                REP(j,a[i].size()){
                    skill[j] += a[i][j];
                }
                pp += p[i];

            }
        }
        REP(i,m){
            if(skill[i] < x){
                flag = false;
            }
        }
        if(flag){
            CMIN(mn,pp);
        }

        if(digit == val) break;
        digit[0] += 1;
        REP(i,n){
            if(digit[i] == 2){
                digit[i] = 0;
                digit[i + 1] += 1;
            }
        }
    }
    if(mn == INF)
        cout << -1 << endl;
    else
        cout << mn << endl;
    return 0;
}

Measured memory_bytes: 3564
#include<iostream>

using namespace std;

int main(){

   int X;
   int A;
   int B;

   cin >> X >> A >> B;

   if(B <= A){
	   cout << "delicious" <<endl;
   }else if(B <= A+X){
	   cout << "safe" << endl;
   }else if(B >= A + X + 1){
	   cout << "dangerous" << endl;
   }

	return 0;

}

Measured memory_bytes: 256
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>

using namespace std;
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
#define MOD (int)(1e9 + 7)

long long modPow(int x, int n){
  if(n == 0) return 1;
  if(n % 2 == 0) {long long res = modPow(x,n/2); return res * res % MOD;}
  return modPow(x,n-1) * x % MOD;
}

long long kaizyou(int x){
  long long res = 1;
  for(int i = x; i > 0; i--){
    res = res * i % MOD;
  }
  return res;
}

long long modComb(int x, int y){
  if( x/2 < y ) return modComb(x,x-y);
  return (kaizyou(x) * modPow(kaizyou(x-y),MOD-2) % MOD) * modPow(kaizyou(y),MOD-2) % MOD;
}

int main(){
  int N,M;
  cin >> N >> M;
  //vector<pair<int,int>> pfact; //prime factors
  vector<int> pfact;
  for(int i = 2; i * i <= M; i++){
    if(M % i == 0){
      int cnt = 0;
      while(M % i == 0){
        cnt ++;
        M /= i;
      }
      pfact.push_back(cnt);
    }
  }
  // M == prime num
  if(M != 1) pfact.push_back(1);

  // ans = ∏ H(N,pfact[i])
  long long ans = 1;
  for(int i = 0; i < pfact.size(); i++){
    ans = ans * modComb(N + pfact[i] - 1, N - 1) % MOD;
  }

  cout << ans << endl;
  return 0;

}


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

#define PI 3.1415926535897932
#define MOD 1000000007
#define INF 1e9

#define REP(i, n) for(int i = 0; i < (n); i++)
#define REP1(i, n) for(int i = 1; i <= (n); i++)
#define FOR(i, start, end) for(int i = (start); i < (end); i++)
#define ALL(v) (v).begin(), (v).end()

using namespace std;

typedef long long ll;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vi> vvi;
typedef vector<string> vs;
typedef vector<bool> vb;

int W, a, b;

void solve()
{
    cin >> W >> a >> b;
    if((a <= b && b <= a+W) || (a <= b+W && b+W <= a+W)) 
    {
        cout << 0 << endl;
        return;
    }
    
    cout << min(abs(a-(b+W)), abs(a+W-b)) << endl;
}

int main()
{
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    solve();

    return 0;
}

Measured memory_bytes: 256
#!/usr/bin/env python3
import sys
input = lambda: sys.stdin.buffer.readline()[:-1].decode('utf-8')
sys.setrecursionlimit(10**8)
inf = float('inf')
mod = 998244353

n=int(input())
D=list(map(int,input().split()))
ans=1
data=[0]*(10**5)
M=0
for i in range(n):
    data[D[i]]+=1
    M=max(M,D[i])

for i in range(1,n-1):
    ans*=data[i-1]**data[i]
    ans=ans%mod
    # print(data[i-1],data[i])

if D[0]!=0:
    ans=0
if data[0]>=2:
    ans=0
for i in range(M):
    if data[i] ==0:
        ans=0

print(ans%mod)
# print(data[:20])
    


Measured memory_bytes: 59376
#include <iostream>
#include <vector>
#include <string>
#include <numeric>
#include <algorithm>
#include <math.h>
using namespace std;

int main() {

	int N;
	cin >> N;

	vector<int> a(N,0);
	for (int i = 0; i < a.size(); i++) {
		cin >> a[i];
	}

	auto iniitr = a.begin();
	vector<int>::iterator itr = iniitr;
	int ans = -1;
	for (int i = 1; i <= N; i++) {
		while (itr != a.end()) {
			itr = find(iniitr, a.end(), i);
			if (itr != a.end() && i == *itr) {
				ans = N - i; 
				iniitr = itr + 1;
				break;
			}
			else if (itr != a.end() && i != *itr) {
				iniitr = itr + 1;
			}
		}

		if (itr != a.end()) {
			continue;
		}
		else {
			break;
		}
	}

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 1024
S = input()
l = len(S)
tf = 1

def check(st):
    l = len(st)
    for i in range(l//2):
        if st[i] != st[l-i-1]:
            return 0
    return 1

if check(S)==check(S[:(l-1)//2])==check(S[(l+3-1)//2:])==1:
    print("Yes")
else:
    print("No")


Measured memory_bytes: 3060
#include<iostream>
#include<cstdio>
#include<cstring>
#include <cstdlib>  
#include <cmath>   
#include<cctype>
#include<string>
#include<set>
#include <map>
#include<algorithm>
#include <functional>
#include<vector>
#include<climits>
#include<stack>
#include<queue>
#include <deque>
#include <utility> 

#define rep(i,m,n) for(int i = m;i < n;++i)
using namespace std;
using ll = long long;
using R = double;
const ll inf = 1LL << 50;
const ll MOD = 1e9 + 7;



void chmax(ll &a,ll b) {
	if (a < b)a = b;
}

//i:digit j:3ornot k:5ornot l:7ornot m:notonly357 n:otherthanzero_past o:isless
ll dp[15][2][2][2][2][2][2];
int N;

int main() {
	cin >> N;
	string s = to_string(N);
	int n = s.length();

	dp[0][0][0][0][0][0][0] = 1;

	rep(dgt, 0, n)rep(j, 0, 2)rep(k, 0, 2)rep(l, 0, 2)rep(p, 0, 2)rep(q, 0, 2)rep(isless, 0, 2) {
		int c = s[dgt] - '0';
		int ma = 9;
		if (!isless)ma = c;
		rep(nxt, 0, ma+1) {
			bool not357 = q ? ((nxt != 3)&&(nxt!=5)&&(nxt!=7)):((nxt!=0)&&(nxt != 3) && (nxt != 5) && (nxt != 7));
			dp[dgt+1][j || (nxt == 3)][k || (nxt==5)][l || (nxt==7)][p || not357][nxt||q][isless || nxt < ma] += dp[dgt][j][k][l][p][q][isless];
		}
	}
	
	ll ans = 0;
	rep(j, 0, 2)rep(k, 0, 2)rep(l, 0, 2)rep(p, 0, 2)rep(q, 0, 2)rep(isless, 0, 2) {
		if (j == 1 && k == 1 && l == 1 && p == 0 && q == 1)ans += dp[n][j][k][l][p][q][isless];
	}
	
	cout << ans << endl;
	
	return 0;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

long cube(int m) {
    return 1l * m * m * m;
}

int main(int argc, char const *argv[])
{
    int n, k;
    cin >> n >> k;
    int m = n/k;
    long ans = cube(m);

    if (k%2 == 0) {
        m = (n+k/2)/k;
        ans += cube(m);
    }
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
//ITP 1_5_C
#include <iostream>
using namespace std;

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

int main(){
    int h,w;
    while(1){
        cin>>h>>w;
        if(h==0&&w==0)break;
        rep(i,h){
        rep(j,w){
            if((i+j)%2==0)cout<<"#";
            else cout<<".";
        }
        cout<<endl;
        }
    cout<<endl;
    }

return 0;
}



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

using namespace std;

#define int long long
#define pii pair<int, int>
#define pb push_back

signed main() {
    ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
    int a, b;
    cin >> a >> b;
    if(a > b) swap(a, b);
    cout << string(b , '0' + a) << endl;
    return 0;
}



Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <stdlib.h>
#include <cmath>
#include <iomanip>
using namespace std;

int main(){

    const double pi=3.141592653589793;
    double A,B,H,M,h,m;
    cin>>A>>B>>H>>M;
    double powA=A*A,powB=B*B;

    h=pi/6.0*H+pi/360.0*M;
    m=pi/30*M;
    double t=abs(h-m);
    double ans=sqrt(powA+powB-2*A*B*cos(t));
    
    cout<<fixed<<setprecision(15)<<ans<<endl;

    return 0;
}

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

typedef long long ll;
typedef long double ld;
typedef vector<vector<int>> Graph;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
#define pi 3.14159265359
#define inf 2147483647
#define INF 9223372036854775807
#define mod 1000000007
#define mod2 998244353

int main() {
    string r, g, b; cin >> r >> g >> b;
    string rgb = r + g + b;
    int num = stoi(rgb);
    if(num % 4 == 0) cout << "YES" << endl;
    else cout << "NO" << endl;
    return 0;
}

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

#define LEN 100000

typedef struct p{
  char name[100];
  int t;
}P;

P Q[LEN];
int head, tail, n;

void enqueue(P x){
  Q[tail] = x;
  tail = (tail + 1) % LEN;
}

P dequeue(){
  P x = Q[head];
  head = (head + 1) % LEN;
  return x;
}

int min(int a, int b){return a < b ? a : b ;}

int main(){
  
  int elaps = 0, c;
  int i, q;
  P u;
  
  scanf("%d%d",&n,&q);

  for(i = 1 ; i <= n ; i++)
    {
      scanf("%s",Q[i].name);
      scanf("%d",&Q[i].t);
    }

  head = 1 ; tail = n + 1;

  while(head != tail)
    {
      u = dequeue();
      c = min(q, u.t);
      u.t -= c;
      elaps += c;
      if(u.t > 0)
	{
	  enqueue(u);
	}
      else
	{
	  printf("%s %d\n",u.name, elaps);
	}
    }
  return 0;
}

Measured memory_bytes: 10756
#include <stdio.h>

int kakezan(int x){
	int max=0;
	int d;
	if(x<10){
		return -1;
	}else{
		for(d=10;d<x;d*=10){
			if((x/d)*(x%d)>max){
				max=(x/d)*(x%d);
			}
		}
		return max;
	}
}

void solve(){
	int N;
	scanf("%d",&N);
	int R=0;
	int c=N;
	int cc=2;
	if(N<10){
		printf("0\n");
		return;		
	}
	while(1){
		N=kakezan(N);
		R++;
		if(N<10){
			printf("%d\n",R);
			return;
		}
		if(c==N){
			printf("-1\n");
			return;
		}
		if(R==cc){
			cc=R*2;
			c=N;
		}
	}
}

int main(void){
	int Q,i;
	scanf("%d",&Q);
	for(i=0;i<Q;i++){
		solve();
	}
	return 0;
}

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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
#define REP(i, n) for(int i=0; i<n; i++)
#define REPi(i, a, b) for(int i=int(a); i<int(b); i++)
#define MEMS(a,b) memset(a,b,sizeof(a))
#define mp make_pair
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; }
const ll MOD = 1e9+7;

int main(){
    ll K;
    cin >> K;
    ll X;
    cin >> X;
    if(K*500 >= X)
        cout << "Yes" << endl;
    else
        cout << "No" << endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <cstring>
#include <cstdio>
#include <cstdlib>
#include <vector>
#include <cmath>
#include <algorithm>
#include <map>
#include <sstream>
#include <queue>
#include <deque>
#include <set>
#include <stack>
#include <functional>
#include <utility>
#include <stdio.h>
#define ll long long
#define MP make_pair
#define PII pair<int, int>
#define PLL pair<ll, ll>
#define PLI pair<ll, int>
#define PIL pair<int, ll>
#define F first
#define S second
#define SHN 1e9
#define LSHN 1e18
using namespace std;
string s;
void dfs(int x,int y,string si)
{
	if (x==4)
	{
		if (y!=7) return;
		cout <<s[0];
		for (int i=0;i<3;i++) cout <<si[i]<<s[i+1];
		cout <<"=7";
		exit(0);
	} 
	dfs(x+1,y-(s[x]-'0'),si+'-');
	dfs(x+1,y+(s[x]-'0'),si+'+');
}
int main()
{
	cin >>s;
	dfs(1,s[0]-'0',"");
	return 0;
} 


Measured memory_bytes: 256
N = int(input())
A = [int(i) for i in input().split()]
B = [int(i) for i in input().split()]
ans = 0

for i in range(N):
    if B[i]<A[i]:
        ans += B[i]
    else:
        ans += A[i]
        tmp = min(A[i+1], B[i]-A[i])
        ans += tmp
        A[i+1] -= tmp

print(ans)

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

int main()
{
    int N;
    int countP = 0, countQ = 0;
    cin >> N;
    int P[N];
    int Q[N];
    for (int i = 0; i < N; i++){
        cin >> P[i];
    }
    for (int i = 0; i < N; i++){
        cin >> Q[i];
    }
    do {
        countP++;
    } while (next_permutation(P, P+N));
    
    do {
        countQ++;
    } while (next_permutation(Q, Q+N));
    cout << abs(countQ - countP);
    return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <vector>
#include <algorithm>

using namespace std;

int main()
{
	int n;
	
	while (scanf("%d", &n) && n){
		pair<pair<int, int>, pair<int, char> > t[10];
		
		for (int i = 0; i < n; i++){
			t[i].first.first = t[i].first.second = 0;
			char name;
			scanf(" %c", &name);
			t[i].second.first = i;
			t[i].second.second = name;
			for (int j = 0; j < n - 1; j++){
				int x;
				scanf("%d", &x);
				if (x == 0) t[i].first.first--;
				if (x == 1) t[i].first.second++;
			}
		}
		
		sort(t, t + n);
		
		for (int i = 0; i < n; i++)
			printf("%c\n", t[i].second.second);
	}
}

Measured memory_bytes: 1032
#include<bits/stdc++.h>
#define Int long long
#define MOD 1000000009
using namespace std;


int main(){
    int n;
    cin>>n;
    int h[n];
    for(int i=0;i<n;i++){
        cin>>h[i];
    }
    int dp[n];
    dp[0]=0;
    dp[1]=abs(h[1]-h[0]);
    for(int i=2;i<n;i++){
        dp[i]=min(dp[i-1]+abs(h[i]-h[i-1]),dp[i-2]+abs(h[i]-h[i-2]));
    }
    cout<<dp[n-1];
    return 0;
}


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

int main() {
  int a, b;
  cin >> a >> b;
  if (1 <= a && 9 >= a && 1 <= b && 9 >= b) {
    cout << a * b << endl;
  }
  else {
    cout << -1 << endl;
  }
}


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

const int MAX = 10000000;
const int MOD = 1000000007;

long long fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

// 二項係数計算
long long COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

int main() {
    // 前処理
    COMinit();
    int x ,y ;
	cin >> x >> y ;
if((x+y)%3 == 0 ){
//計算をする
long long a = 2 * y - x ;
a /= 3;
long long b = 2 * x - y ;
b /= 3;
cout <<COM(a+b,a)<<endl;
}else{
	cout << 0 << endl;
	return 0;
}
}


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

ll d(ll x) {
    if (x == 1)
        return 1;
    else
        return d(x / 2) * 2 + 1;
}

int main() {
    ll h;
    cin >> h;
    cout << d(h) << endl;
}

Measured memory_bytes: 256
using System;
using System.Linq;
using System.Collections.Generic;

namespace AtCoder
{
    public class hoge
    {
        public long money;
        public long limit;
    }

    class Program
    {
        public static void Main(string[] args)
        {
            string[] s = Console.ReadLine().Split(' ');
            long N = long.Parse(s[0]);
            long M = long.Parse(s[1]);
            hoge[] A = new hoge[N];
            for (long i = 0; i < N; i++)
            {
                string[] s2 = Console.ReadLine().Split(' ');
                A[i] = new hoge();
                A[i].money = long.Parse(s2[0]);
                A[i].limit = long.Parse(s2[1]);
            }
            hoge[] OrderedA = A.OrderBy(x => x.money).ToArray();
            long res = 0;
            for(int i = 0; i < N; i++)
            {
                if (OrderedA[i].limit < M)
                {
                    M -= OrderedA[i].limit;
                    res += OrderedA[i].limit * OrderedA[i].money;
                }
                else if (OrderedA[i].limit == M)
                {
                    M = 0;
                    res += OrderedA[i].limit * OrderedA[i].money;
                    break;
                }
                else
                {
                    res += M * OrderedA[i].money;
                    M = 0;
                    break;
                }
            }
            Console.WriteLine("{0}", res);
        }
    }
}

Measured memory_bytes: 25668
#include <iostream>
#include <cmath>
#include <vector>
#include <map>
#include <stack>
#include <queue>
#include <set>
#include <algorithm>
#include <iomanip>
#include <string.h>

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

typedef long long lint;

using namespace std;

int main(){
  int x;
  cin>>x;
  cout<<!x<<endl;
  return 0;
}


Measured memory_bytes: 3620
import java.util.*;
public class Main {
        static Scanner sc = new Scanner(System.in);
        static void myout(Object t){System.out.println(t);}
        static void myerr(Object t){System.err.println(t);}
        static String getStr(){return sc.next();}
        static int getInt(){return sc.nextInt();}
        static Long getLong(){return sc.nextLong();}
        static boolean isNext(){return sc.hasNext();}
        static char[] splitSingle(String str){return str.toCharArray();}
        public static void main(String[] args){
          HashMap<String, Integer> list = new HashMap<String, Integer>();
          int blue = getInt();
          for(int i = 0; i < blue; i++){
            String str = getStr();
            if(list.get(str) == null){
              list.put(str,1);
            }else{
              list.put(str,list.get(str)+1);
            }
          }
          int red = getInt();
          for(int i = 0; i < red; i++){
            String str = getStr();
            if(list.get(str) == null){
              list.put(str,-1);
            }else{
              list.put(str,list.get(str)-1);
            }
          }
          int output = 0;
          Collection vals = list.values();
          Iterator it = vals.iterator();
          while(it.hasNext()){
            output = Math.max(output,(int)it.next());
          }
          myout(output);
        }
        //便利メソッド追加枠ここから

        //便利メソッド追加枠ここまで
}


Measured memory_bytes: 21844
#include <bits/stdc++.h>
 
#define rep(i, n) for(int (i)=0; (i)<(n); (i)++)
 
using namespace std;
 
typedef long long ll;
typedef pair<int, int> P;
 
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; }
 
int main()
{
  ll H, W;
  cin >> H >> W;

  if(H==1||W==1)
    cout << 1 << endl;    
  else if(H%2==1&&W%2==1)
    cout << ll(0.5*H*W)+1<<endl;
  else
    cout << ll(0.5*H*W) << endl;
  
  return 0;
}
 


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

int main(){

	int n,k;
	char m;
	int l=0,r=0;
	string ans = "YES";


	cin >> n;
	cin.get();

	for(int i=0;i<n;i++){
		cin >> m >> k;
		cin.get();

		if(m=='('){
			l=l+k;
		}else{
			r=r+k;
		}
	if(r>l)
			ans = "NO";

	}

	if(r!=l)
		ans = "NO";
		
			cout << ans << endl;
		

		return 0;
}

Measured memory_bytes: 1200
import sys
stdin = sys.stdin
sys.setrecursionlimit(10**6)
 
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
nn = lambda: list(stdin.readline().split())
ns = lambda: stdin.readline().rstrip()

import math

s = ni()

t = math.ceil(math.sqrt(s))
u = t
while True:
    if t * (u-1) < s:
        break
    u-=1

k = t*u-s

print(0,0,t,1,k,u)

#print(abs(t*u-1*k))

Measured memory_bytes: 3064
a , b  = input().split()

def response_atcoder(b):
  if b == 'H':
    return True
  if b == 'D':
    return False

answer = response_atcoder(b)
if a == 'D':
  answer = not(answer)

if answer:
  print('H')
else:
  print('D')
  
  

Measured memory_bytes: 8932
#include <cmath>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <queue>
#include <stack>
#include <map>
#include <algorithm>
#include <iostream>
using namespace std;

const int MaxN = 1e5 + 6;
typedef long long LL;
map<string, int> mp;

int main(){
	int n;
	char x[105];
	cin>>n;
	cin>>x+1;
	int t = strlen(x+1);
	char w = x[t];
	mp[x+1] = 1;
	bool ok = true;
	for(int i = 1; i < n; i++){
		char s[105];
		memset(s, 0, sizeof(s));
		cin>>s+1;
		if(mp[s+1] == 1) {
			ok = false;
		}
		int oo = strlen(s+1);
		if(s[1] != w){
			ok = false;
		}
		else if(s[1] == w){
			w = s[oo];
		}
		mp[s+1] = 1;
	}
	if(ok) cout<<"Yes"<<endl;
	else cout<<"No"<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <vector>
#include <iostream>
#include <queue>
#define INF 1000000000
using namespace std;
struct edge{
	int to,d,c;
	edge(int tt,int dd,int cc){
		to = tt;d = dd;c = cc;
	}
};
typedef pair<int,edge*> P;
int main(){
	int n,m;
	while(cin>>n>>m,n){
		vector<edge> e[10000];
		for(int i = 0; i < m; i++){
			int u,v,d,c;
			cin >> u >> v >> d >> c;
			--u,--v;
			e[u].push_back(edge(v,d,c));
			e[v].push_back(edge(u,d,c));
		}
		int md[10000],lc[10000];
		for(int i = 0; i < n;++i){
			md[i] = INF;
			lc[i] = INF;
		}
		md[0] = lc[0] = 0;
		priority_queue<P,vector<P>,greater<P> > que;
		for(vector<edge>::iterator it = e[0].begin();it != e[0].end();++it){
			que.push(P(it->d,&*it));
		}
		while(!que.empty()){
			P p = que.top();
			que.pop();
			int d = p.first;
			edge *ed = p.second;
			if(d < md[ed->to]){
				md[ed->to] = d;
				lc[ed->to] = ed->c;
				for(vector<edge>::iterator it = e[ed->to].begin();it != e[ed->to].end(); ++it){
					P tmp(d+it->d,&*it);
					if(tmp.first <= md[it->to]) que.push(tmp);
				}
			}
			else if(d == md[ed->to]){
				if(ed->c < lc[ed->to]) lc[ed->to] = ed->c;
			}
		}
		int ans = 0;
		for(int i = 0; i < n; ++i) ans += lc[i];
		cout << ans << endl;
	}
}

Measured memory_bytes: 2708
#define Bobyama
#include <iostream>
#include <algorithm>
#include <bitset>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <cstring>
#include <utility>
#include <vector>
#include <complex>
#include <valarray>
#include <fstream>
#include <cassert>
#include <cmath>
#include <functional>
#include <iomanip>
#include <numeric>
#include <climits>
#include <random>

#define _overload(a, b, c, d, ...) d
#define _rep1(X, A, Y) for (int (X) = (A);(X) <= (Y);++(X))
#define _rep2(X, Y) for (int (X) = 0;(X) < (Y);++(X))
#define rep(...) _overload(__VA_ARGS__, _rep1, _rep2)(__VA_ARGS__)
#define rrep(X,Y) for (int (X) = Y-1;(X) >= 0;--(X))
#define all(X) (X).begin(),(X).end()
#define len(X) ((int)(X).size())
#define mod(n, m) (((n)%(m)+(m))%m)
#define fi first
#define sc second
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> Pii;
typedef pair<ll,ll> Pll;
const int INFINT = 1 << 30;                          // 1.07x10^ 9
const ll INFLL = 1LL << 60;                          // 1.15x10^18
const double EPS = 1e-10;
const int MOD = 1000000007;
const int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};

int X, A;

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

  cin >> X >> A;

  if (X < A) {
    cout << 0 << endl;
  } else {
    cout << 10 << endl;
  }

  return 0;
}


Measured memory_bytes: 256
#pragma once
#include <stdio.h>
#include <sstream>
#include <string>
#include <string.h>
#include <vector>
#include <map>
#include <algorithm>
#include <iostream>
#include <utility>
#include <set>
#include <cctype>
#include <queue>
#include <stack>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <deque>
#include <limits>
#include <iomanip>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;

const ll INF = 1000000007;
const int MAX = 210000;
const int MOD = 1000000007;

long long fac[MAX], finv[MAX], inv[MAX];
void COMinit() {
	fac[0] = fac[1] = 1;
	finv[0] = finv[1] = 1;
	inv[1] = 1;
	for (int i = 2; i < MAX; i++) {
		fac[i] = fac[i - 1] * i % MOD;
		inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
		finv[i] = finv[i - 1] * inv[i] % MOD;
	}
}
ll gcd(ll a, ll b) {
	if (b == 0) return a;
	return gcd(b, a % b);
}
int pr[100010];
void uini(int n) {
	for (size_t i = 0; i <= n; i++)
	{
		pr[i] = i;
	}
}

int parent(int x) {
	if (x == pr[x]) return x;
	return pr[x] = parent(pr[x]);
}

bool unit(int x, int y) {
	int px = parent(x);
	int py = parent(y);

	if (px == py) return false;
	if (px < py) {
		pr[py] = px;
	}
	else {
		pr[px] = py;
	}
	return true;
}
ll ar[40];
bool use[40];
ll table[1001][1001];
ll n, a, b, c, d;
ll memo[1001][1001];
ll rec(int v, int rem) {

	if (rem == 0) return 1;
	if (v > b) return 0;
	ll & res = memo[v][rem];

	if (~res) return res;
	res = rec(v + 1, rem);
	res %= INF;
	ll vr = 1;
	ll pt = 1;
	for (ll i = 1; i < c; i++)
	{
		ll va = rem - (v * (i - 1));
		if (va < 0) {
			return res = 0;
		}
		vr *= table[va][v];
		vr %= INF;
		vr *= inv[i];
		vr %= INF;

	}

	for (ll i = c; i <= d; i++)
	{
		if (v * i > rem) break;
		vr *= table[rem - (v * (i - 1))][v];
		vr %= INF;

		vr *= inv[i];

		vr %= INF;
		res += (vr  * rec(v + 1, rem - v * i)) % INF;
		res %= INF;
	}

	return res;
}
void solv() {

	cin >> n;
	cin >> a >> b;
	cin >> c >> d;
	table[0][0] = 1;
	for (size_t i = 1; i <= n; i++)
	{
		table[i][0] = 1;
		for (size_t j = 1; j <= n; j++)
		{
			table[i][j] = table[i - 1][j - 1] + table[i - 1][j];
			table[i][j] %= INF;
		}
	}

	memset(memo, -1, sizeof(memo));
	cout << rec(a, n);
}




int main() {
	COMinit();
	solv();

	return 0;
}


Measured memory_bytes: 21376
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
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());
  
  cout << A[N-1]-A[0] << endl;
   
}

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

using namespace std;
#define ll long long

ll INF = 1e9 + 7;

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

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

    vector<ll> arr1(n);
    vector<ll> arr2(m);

    for(int i=0;i<n;i++)
        cin>>arr1[i];
    
    for(int j = 0; j<m;j++)
        cin>>arr2[j];

    for(int i=1;i<n;i++)
        arr1[i] += arr1[i-1];

    for(int i=1; i<m;i++)
        arr2[i] += arr2[i-1];

    int i=0,j =0;
    int maxVal = 0;

    while((i < n) && (arr1[i] <= k))
            i++;
    maxVal = i;

    if( i >=n)
        i--;
    
    while((j < m) && (arr2[j] <=k))
    {
        while((i >= 0) && (arr1[i] + arr2[j] >k))
        {
            i--;
        }

        maxVal = max(maxVal, i+j+2);
        j++;
    }

    cout<<maxVal<<endl;

    return 0;
}


Measured memory_bytes: 6372
#include <bits/stdc++.h>
#define all(x) (x).begin(),(x).end()
#define print(x) cout << (x) << endl
typedef long long ll;
const ll MOD = 1000000007;
const ll MOD2 = 998244353;

using namespace std;

int main(){
    int N;  cin >> N;
    vector<int> a(N);
    int maxv, minv;
    for(int i=0; i<N; i++)  cin >> a[i];
    maxv = -MOD;
    minv = MOD;
    for(int i=0; i<N; i++){
        maxv = max(maxv, a[i]);
        minv = min(minv, a[i]);
    }
    if(minv >= 0){
        print(N-1);
        for(int i=1; i<N; i++){
            cout << i << " " << i + 1 << endl;
        }
    }else if(maxv <= 0){
        print(N-1);
        for(int i=N-1; i>0; i--){
            cout << i + 1 << " " << i << endl;
        }
    }else{
        int x;
        if(abs(maxv) >= abs(minv)){
            for(int i=0; i<N; i++) if(a[i] == maxv) x = i+1;
            print(2*N - 2);
            cout << x << " " << 2 << endl;
            cout << x << " " << 2 << endl;
            for(int i=3; i<=N; i++){
                cout << i - 1 << " " << i << endl;
                cout << i - 1 << " " << i << endl;
            }
        }else{
            for(int i=0; i<N; i++) if(a[i] == minv) x = i+1;
            print(2*N - 2);
            cout << x << " " << N-1 << endl;
            cout << x << " " << N-1 << endl;
            for(int i=N-2; i>0; i--){
                cout << i + 1 << " " << i << endl;
                cout << i + 1 << " " << i << endl;
            }
        }
    }
}

Measured memory_bytes: 3500
#include<iostream>
#include<iomanip>
#include<vector>
#include<string>
#include<cstring>
#include<map>
#include<set>
#include<queue>
#include<stack>
#include<algorithm>
#include<cmath>
#include<cstdio>
#include<cstdlib>
#include<climits>
#include<fstream>

#define MOD (1000000007)

using namespace std;

typedef long long int Int;

int main(void) {
    int N;
    vector<int> d;
    cin>>N;

    for(int i = 0;i < N;i++) {
        int t;
        cin>>t;
        d.push_back(t);
    }

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

    int mid = N/2;
    int l = d[mid-1];
    int r = d[mid];

    cout<<r-l<<endl;

    return 0;
}




Measured memory_bytes: 892
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <set>
#include <map>
#include <queue>
#include<limits.h>
#define rep(i, n) for(int i = 0; i < n; i++)
#define REP(i, m, n) for(int i = m; i < n; i++)
#define ALL(v) v.begin(),v.end()
#define RALL(v) v.rbegin(),v.rend()
#define check(v) rep(i,v.size()) cout << v[i] << " ";\
cout << endl
#define INF 1e8
typedef long long ll;
using namespace std;
//オーバーフローに気をつけろよおおおおおお
//確認忘れるなよおおおおおお

int main() {
    ll a, b; cin >> a >> b;
    if(a==1 && b==1) cout << 1 << endl;
    else if(a==2 || b==2) cout << 0 << endl;
    else {
        if(a==1) cout << b-2 << endl;
        else if(b==1) cout << a-2 << endl;
        else cout << abs(a-2)*abs(b-2) << endl;
    }
    return 0;
}

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

#define MAX 1000002

int step[MAX];

int getStep(int n){
  if(n == 1) return 0;
  if(step[n] != -1) return step[n];

  int next;
  if(n % 2 == 0) next = n / 2;
  else           next = n * 3 + 1;

  return step[n] = getStep(next) + 1;
}

int main(){
  int n;
  fill(step, step + MAX, -1);

  while(cin >> n, n){
    cout << getStep(n) << endl;
  }
}

Measured memory_bytes: 5064