akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cctype>
#include <cmath>
#include <cassert>
#include <sstream>
#include <fstream>

#define all(c) (c).begin(), (c).end()
#define iter(c) __typeof((c).begin())
#define cpresent(c, e) (find(all(c), (e)) != (c).end())
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define tr(c, i) for (iter(c) i = (c).begin(); i != (c).end(); ++i)
#define pb(e) push_back(e)
#define mp(a, b) make_pair(a, b)

using namespace std;
typedef long long unsigned int ll;

int main() {
  int N;
  cin >> N;
  string A, B, C;
  cin >> A;
  cin >> B;
  cin >> C;

  int ans = 0;
  rep (i, N) {
    char x[3] = {A[i], B[i], C[i]};
    set<char> u (x, x+3);
    ans += (int)u.size() - 1;
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
vector<ll> ve;
vector<ll> va;
ll a,b,m;
ll ms;
ll x,y,z;
int main(){
	cin >> a >> b >> ms;
	long long m = 1e12;
	long long s = 1e12;
	for(ll i = 0; i < a; i++){
		cin >> x;
		m = min(m,x);
		ve.push_back(x);
	}
	for(ll i = 0; i < b; i++){
		cin >> x;
		s = min(s,x);
		va.push_back(x);
	}
	long long mini = 1e12;
	for(ll i = 0; i < ms; i++){
		cin >> x >> y >> z;
		ll hi = ve[x-1] + va[y-1] - z;
		hi = max(hi,(ll)0);
		mini = min(hi,mini);
	}
	mini = min(mini, m+s);
	cout << mini << "\n";
}


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

int main(){
  int n; cin>>n;
  if(n%10 == 9){
    cout<<"Yes"<<endl;
  }else{
    n /= 10;
    if(n == 9){
      cout<<"Yes"<<endl;
    }else{
      cout<<"No"<<endl;
    }
  }
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <unordered_set>
#include <set>
#include <cstring>
#include <map>
#include <cmath>
#include <algorithm>
#include <queue>

using namespace std;

using ll = long long;
const ll INF = 1e18 + 1;


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


    int n;
    cin >> n;

    vector<int> vec(n);
    int all = 0;

    for (int i = 0; i < n; ++i) {
        cin >> vec[i];
        all ^= vec[i];
    }

    for (int i = 0; i < n; ++i) {
        cout << (all ^ vec[i]) << " ";
    }
    cout << endl;



}

Measured memory_bytes: 3524
import java.util.*;
public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int num = sc.nextInt();
		long max = sc.nextLong();
		long val[] = new long[num];
		for(int i = 0; i < num; i ++) {
			val[i] = sc.nextLong();
		}
		int digit = 0;
		double tmp = max;
		while(true) {
			if(tmp / 2.0 >= 1) {
				digit ++;
				tmp /= 2.0;
			}else {
				break;
			}
		}
		long ans = 0;
		long diff[] = new long[digit + 1];
		for(int i = digit; i >= 0; i --) {
			int count = 0;
			for(int j = 0; j < num; j ++) {
				if(Math.floor((val[j] % Math.pow(2, i + 1)) / Math.pow(2, i)) == 1) {
					count ++;
				}else {
					count --;
				}
			}
			diff[i] = count * (long) Math.pow(2, i);
		}
		boolean add[] = new boolean[digit + 1];
		while(true) {
			long maxDiff = 0;
			int index = 0;
			for(int i = 0; i <= digit; i ++) {
				if(add[i] || ans + (long) Math.pow(2, i) > max) {
					continue;
				}
				if(Math.abs(diff[i]) > maxDiff) {
					maxDiff = Math.abs(diff[i]);
					index = i;
				}
			}
			if(maxDiff == 0) {
				break;
			}
			if(diff[index] < 0) {
				ans += (long) Math.pow(2, index);
			}
			add[index] = true;
		}
		long sum = 0;
		for(int i = 0; i < num; i ++) {
			sum += ans ^ val[i];
		}
		System.out.println(sum);
	}
}

Measured memory_bytes: 62548
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>

int main(void) {
  for (int i = 0; i < 5; i++) {
    int num;
    scanf(" %d", &num);
    if (!num) printf("%d\n", i + 1);
  }

  return 0;
}


Measured memory_bytes: 1732
#include <cstdio>
#include <cmath>
int main()
{
	int r,g,x;
	scanf("%d\n%d", &r,&g);
	if(r>=0 && g<=4500){
    x = 2*g - r;
    printf("%d\n", x);
    }
    return 0;
}


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


typedef long long LL;
typedef pair<int,int> pii;
typedef pair<LL,LL> pll;

typedef vector<int> vint;
typedef vector<vector<int> > vvint;
typedef vector<long long> vll, vLL;
typedef vector<vector<long long> > vvll, vvLL;

#define VV(T) vector<vector< T > >

template <class T>
void initvv(vector<vector<T> > &v, int a, int b, const T &t = T()){
	v.assign(a, vector<T>(b, t));
}

template <class F, class T>
void convert(const F &f, T &t){
	stringstream ss;
	ss << f;
	ss >> t;
}


#define REP(i,n) for(int i=0;i<int(n);++i)
#define ALL(v) (v).begin(),(v).end()
#define RALL(v) (v).rbegin(),(v).rend()
#define PB push


#define MOD 1000000007LL
#define EPS 1e-10

int main()
{
	int N, L;
	cin >> N >> L;
	vector<string> S( N );
	REP( i, N ) cin >> S[ i ];
	sort( S.begin(), S.end() );
	for( const auto& s : S ) cout << s;
	cout << endl;
	return 0;
}


Measured memory_bytes: 256
# -*- coding: utf-8 -*-

def abc157c(n, m, constraint):
    # check constraint
    for i in range(m):
        if n > 1:
            if (constraint[i][0] == 1) and (constraint[i][1] == 0):
                return -1
        if constraint[i][0] > n:
            return -1
        for j in range(i+1, m):
            if constraint[i][0] == constraint[j][0]:
                if constraint[i][1] != constraint[j][1]:
                    return -1

    min_val = 0
    if n > 1:
        min_val = 10**(n-1)
    
    for tgt in range(min_val, 10**n):
        match = True
        for c in constraint:
            exp = n - c[0]
#            print("exp="+str(exp))
            if (tgt // 10**exp) % 10 == c[1]:
#                print("match!"+str(c[0])+str(c[1]))
                continue
            else:
                match = False
                break
        if match:
            return tgt
    
    return -1

###
# main
if(__name__ == '__main__'):
    # input
    n, m = map(int, input().split())

    constraint = [[] for _ in range(m)]
    for i in range(m):
        constraint[i] = list(map(int, input().split(" ")))
    
    ans = abc157c(n, m, constraint)
    
    # output
    print(ans)
# else:
    # do nothing


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

int K;

int main() {
    cin>>K;
    long ans=0;
    for (int i=1; i<=K; i++) {
        for (int j=1; j<=K; j++) {
            int codiv;
            for (int k=1; k<=min(i,j); k++) {
                if (i%k==0 && j%k==0) codiv=k;
            }
            for (int k=1; k<=K; k++) {
                int codiv2;
                for (int l=1; l<=min(i,j); l++) {
                    if (k%l==0 && codiv%l==0) codiv2=l;
                }
                ans+=codiv2;
            }
        }
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 3592
#include <iostream>
#include <string>
#include <vector>
#include <list>
#include <map>
#include <algorithm>
#include <cmath>
using namespace std;

typedef unsigned int uint;
typedef unsigned long long ull;
typedef long long ll;
typedef vector<int> vint;
typedef vector<uint> vuint;
typedef vector<ull> vull;
typedef vector<ll> vll;

#define init(type,var) type var;cin>>var;
#define vinit(type,var,n) vector<type> var((uint)n);loop(i,0,n)cin>>var[i];
#define linit(type,var,n) list<type> var;loop(i,0,n){type _v;cin>>_v;var.push_back(_v);}
#define range(container) container.begin(),container.end()
#define loop(i,first,end) for(ull i=(first);i<(end);i++)
#define outl(out) cout<<(out)<<endl;

const ull INF = (ull)(-1LL);

typedef ull dint;

typedef vector<dint> vdint;


int main(void){
	init(double, a);
	init(double, b);
	init(double, x);

	double s = x / a;

	double m_pi = atan(1.0) * 4.0;

	if (s <= a * b * 0.5){
		cout << fixed << atan2(b, (s * 2.0) / b) * 180.0 / m_pi << endl;
	}
	else{
		s = a * b - s;
		cout << fixed << 90.0 - (atan2(a, (s * 2.0) / a) * 180.0 / m_pi) << endl;
	}

	return 0;
}

Measured memory_bytes: 256
#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>;

int main(){
    ll n,k; cin>>n>>k;
    //kを引いていく
    ll a=n%k;
    ll ans=min(a,abs(a-k));
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main(){
    int c[3][3];
    for(int i = 0; i < 3; i++){
        for(int j = 0; j < 3; j++){
            cin >> c[i][j];
        }
    }


    bool F = true;
    for(int i = 0; i < 3; i++){
        for(int j = 0; j < 3; j++){
            if(c[i][0] - c[0][0] != c[i][j] - c[0][j]){
                F = false;
                break;
            }
        }
    }

    if(F == true){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }


    return 0;
}

Measured memory_bytes: 256
/**
SXR0aXAkI0JwbXptI3FhI3Z3I293bCNqY2IjUG0jMCNicG0jVHFkcXZvLyNCcG0jQW10bjBhY2phcWFicXZvLyNNYm16dml0MSNWdyNhdGN1am16I2tpdiNhbXF9bSNQcXUjVnd6I0F0bW14MSNQcWEjaXptI2l0dCNicHF2b2EjUXYjYnBtI3BtaWRtdmEjaXZsI3d2I21pemJwMSNFcHcjcWEjYnBtem0ja2l2I3F2Ym16a21sbSNRdiNQcWEjeHptYW12a20jbXtrbXhiI0lhI3BtI3htenVxYmJtYnBHI1BtI3N2d2VtYnAjRXBpYiMraXh4bWl6bWJwI2J3I1BxYSNrem1pYmN6bWEjSWEsI0ptbnd6bSN3eiNJbmJteiN3eiNKbXBxdmwjYnBtdTEjVnd6I2FwaXR0I2JwbXwja3d1eGlhYSNJY29wYiN3biNwcWEjc3Z3ZXRtbG9tI017a214YiNpYSNQbSNlcXR0bWJwMSNQcWEjYnB6d3ZtI2x3YnAjbXtibXZsI1dkbXojYnBtI3BtaWRtdmEjSXZsI3d2I21pemJwLyNpdmwjUG0jbm1tdG1icCNWdyNuaWJxb2NtI3F2I29jaXpscXZvI0l2bCN4em1hbXpkcXZvI2JwbXUvI053eiNQbSNxYSNicG0jVXdhYiNQcW9wMSNCcG0jQWN4em11bSMrcXYjb3R3enwsMQ==
*/
#include <cstring>
#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 <queue>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <cassert>

#define F first
#define S second
#define endl '\n'
#define deb(x) cout<<#x<<' '<<x<<endl;
#define pb push_back

/*
#ifdef IZI_KATKA
#define int __int64_t
#else
#define int __int64
#endif
*/

const long long MOD = 1e9 + 7;
const long long MAXN = 1e6 + 1;
using namespace std;

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


long long readInt() {
    bool minus1 = false;
    long long result = 0;
    char ch;
    ch = getchar();
    while (true) {
        if (ch == '-') break;
        if (ch >= '0' && ch <= '9') break;
        ch = getchar();
    }
    if (ch == '-') minus1 = true; else result = ch-'0';
    while (true) {
        ch = getchar();
        if (ch < '0' || ch > '9') break;
        result = result*10 + (ch - '0');
    }
    if (minus1)
        return -result;
    else
        return result;
}


int main() {
	#ifdef IZI_KATKA
	assert(freopen("input", "r", stdin));
    assert(freopen("output", "w", stdout));
    #endif
    int t = readInt();
    while(t--) {
		ll a = readInt(), b = readInt(), c = readInt(), d = readInt();
		if (b > a) {
			cout << "No\n";
		} else if (b > d) {
			cout << "No\n";
		} else if (c >= b - 1) {
			cout << "Yes\n";	
		} else {
			///x % gcd(B, D) = A
		    a %= b;
			ll g = __gcd(b, d);
			ll mx = b - g + a % g;
			if (mx > c) {
				cout << "No\n";
			} else {
				cout << "Yes\n";
			}
		}
	}
    return 0;
}

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

int main(){ 
    int n;
    cin>>n;
    int b=n;
    int a=0;
    while(n>0){
        a+=n%10;
        n=n/10;
    }
    if(b%a==0){
        cout<<"Yes";
    }else{
        cout<<"No";
    }
    return 0;
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
// Custom Header {{{
#define all(x)      x.begin(), x.end()
#define rep(i,n)    for (i64 i = 0; i < (n); ++i)
#define reps(i,s,t) for (i64 i = (s); i <= (t); ++i)
#define repr(i,s,t) for (i64 i = (s); i >= (t); --i)
#define LF          '\n'

#ifdef DBG
#define trace(...) _trace(#__VA_ARGS__, __VA_ARGS__);
#else
#define trace(...)
#endif

using namespace std;
using i64 = int_fast64_t;
using pii = pair<i64, i64>;
template<class T, class U>inline bool chmax(T &a, const U &b){return b>a ? (a=b,1) : 0;}
template<class T, class U>inline bool chmin(T &a, const U &b){return b<a ? (a=b,1) : 0;}
constexpr int INF  = 0x3f3f3f3f;
constexpr i64 LINF = 0x3f3f3f3f3f3f3f3fLL;

template<class T>
ostream& operator<< (ostream &os, const vector<T> &vec) {
    rep(i, vec.size()) os << vec[i] << (i+1 == vec.size() ? "" : " ");
    return os;
}

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

template <class T>
void _trace(const char *s, T&& x)
{
    clog << '{';
    while(*s != '\0' && *s != ',') clog << *(s++);
    clog << ":" << setw(3) << x << '}' << endl;
}

template <class Head, class... Tail>
void _trace(const char *s, Head&& head, Tail&&... tail)
{
    clog << '{';
    while(*s != ',') clog << *(s++);
    clog << ":" << setw(3) << head << "}, ";
    for (++s; !isgraph(*s); ++s);
    _trace(s, std::forward<Tail>(tail)...);
}
// }}}

signed main()
{
    // ios::sync_with_stdio(false); cin.tie(nullptr);
    int a, b, c;
    cin >> a >> b >> c;

    cout << ((a + b >= c) ? "Yes" : "No") << "\n";

    return 0;
}



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

#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define FOR(i,n,m) for(int i=(int)(n); i<=(int)(m); i++)
#define RFOR(i,n,m) for(int i=(int)(n); i>=(int)(m); i--)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define RITR(x,c) for(__typeof(c.rbegin()) x=c.rbegin();x!=c.rend();x++)
#define setp(n) fixed << setprecision(n)

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 (a>b) { a=b; return 1; } return 0; }

#define ll long long
#define vll vector<ll>
#define vi vector<int>
#define pll pair<ll,ll>
#define pi pair<int,int>

#define all(a) (a.begin()),(a.end())
#define rall(a) (a.rbegin()),(a.rend())
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define ins insert

using namespace std;

/* Some Libraries */

//-------------------------------------------------

int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n; cin>>n;
    int ans=10;
    for(ll i=1; i*i<=n; i++){
        if (n%i==0){
            string s=to_string(i);
            string t=to_string(n/i);
            chmin(ans, max((int)s.size(),(int)t.size()));
        }
    }
    cout<<ans<<"\n";
    return 0;
}


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

int main()
{
    int r, g, b, n;
    cin >> r >> g >> b >> n;
    int ans = 0;
    for(int i = 0; i <= n / r; i++){
        for(int j = 0; j <= n / g; j++){
            int re = n - (r * i + g * j);
            if(re >= 0 && re % b == 0){
                ans++;
            }
        }
    }
    cout << ans << endl;
}


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

#define rep(i, a, b) for(int i = (a); i < (b); ++i)
#define per(i, a, b) for(int i = (b)-1; i >= (a); --i)
#define all(x) begin(x), end(x)
#define sz(x) (int)(x).size()
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define fst first
#define snd second

template<class T> bool ckmin(T& a, const T& b) { return b < a ? a = b, 1 : 0; }
template<class T> bool ckmax(T& a, const T& b) { return a < b ? a = b, 1 : 0; }

typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<pii> vii;

int main() {
  cin.tie(0)->sync_with_stdio(0);
  cin.exceptions(cin.failbit);

  ll a, v, b, w;
  cin >> a >> v >> b >> w;

  ll t;
  cin >> t;


  if (a==b) {
    cout << "YES\n";
    return 0;
  }

  if (a < b) {
    b += w*t;
    a += v*t;
    if (a >= b) cout << "YES\n";
    else cout << "NO\n";
    return 0;
  }

  if (b < a) {
    b -= w*t;
    a -= v*t;
    if (a <= b) cout << "YES\n";
    else cout << "NO\n";
  }
}

Measured memory_bytes: 3604
#include<bits/stdc++.h>
using namespace std;
int main() {
  int a, b, c, d;
  cin >> a >> b >> c >>d;
  int s1 = a*b;
  int s2 = c*d;
  if (s1 > s2) cout << s1 << endl;
  else cout << s2 << endl;
  return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        int[] s = new int[n];
        for (int i = 0; i < n; i++) {
            s[i] = scanner.nextInt();
        }
        int q = scanner.nextInt();
        int[] t = new int[q];
        for (int i = 0; i < q; i++) {
            t[i] = scanner.nextInt();
        }

        int number = 0;

        for (int i = 0; i < q; i++) {
            int min = 0;
            int sup = n;
            LOOP: while(true) {
                if (t[i] >= s[(min + sup) / 2]) {
                    min = (min + sup) / 2;
                } else {
                    sup = (min + sup) / 2;
                }
                if (sup - min <= 1) {
                    if (t[i] == s[min]) number++;
                    break LOOP;
                }
            }

        }

        System.out.println(number);
        scanner.close();
    }
}



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

int main()
{
	int sum=0;
	string s1,s2;
	cin>>s1>>s2;
	for(int i=0;i<s1.size();i++)
	{
		if(s1[i]==s2[i])
			sum++;
	}
	cout<<sum;

	return 0;
}

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


/* エイリアス */
#define ll long long
#define ld long double
#define vi vector<int>
#define vll vector<ll>
#define pii pair<int,int>
#define pll pair<ll,ll>
#define vpi vector<pii>
#define vpll vector<pll>
#define endl '\n'

#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#define em emplace


/* 関数マクロ */
#define rep(i, n) for (ll i = 0; i < n; ++i)
#define rep2(i, n, m) for (ll i = n; i <= m; ++i)
#define rep3(i, n, m) for (ll i = n; i >= m; --i)
#define all(v) v.begin(), v.end()
#define si(v) int(v.size())
#define UNIQUE(v) sort(all(v)), v.erase(unique(all(v)),v.end())


/* 定数 */
const ll mod = 1e9 + 7;
const ll infll = (1LL << 62) - 1;
const ll inf = (1LL << 30) - 1;


/* その他 */
template<class S, class T> inline bool chmax(S &a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class S, class T> inline bool chmin(S &a, T b) { if (a > b) { a = b; return 1; } return 0; }
template<class T> using pq = priority_queue<T>;
template<class T> using pqg = priority_queue<T, vector<T>, greater<T>>;

class mint {
  private:
    ll x;

  public:
    constexpr mint(const ll x = 0) noexcept : x((x % mod + mod) % mod) {}
    constexpr ll value() noexcept { return x; }
    constexpr mint operator += (const mint right) noexcept {
      if ((x += right.x) >= mod) x -= mod;
      return *this;
    }
    constexpr mint operator -= (const mint right) noexcept {
      if ((x += mod - right.x) >= mod) x -= mod;
      return *this;
    }
    constexpr mint operator *= (const mint right) noexcept {
      x = x * right.x % mod;
      return *this;
    }
    constexpr mint operator /= (const mint right) noexcept {
      return *this *= right.inv();
    }
    constexpr mint operator + (const mint right) const noexcept {
      return mint(*this) += right;
    }
    constexpr mint operator - (const mint right) const noexcept {
      return mint(*this) -= right;
    }
    constexpr mint operator / (const mint right) const noexcept {
      return mint(*this) /= right;
    }
    constexpr mint operator * (const mint right) const noexcept {
      return mint(*this) *= right;
    }
    constexpr mint inv() const {
      return pow(mod-2);
    }
    constexpr mint pow(ll n) const {
      if (n == 0) return 1;
      mint a = pow(n>>1);
      a *= a;
      if (n & 1) a *= *this;
      return a;
    }
};

signed main()
{
  ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  cout << fixed << setprecision(15);

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

  if (abs(n - m) > 1) {
    cout << 0 << endl;
    return 0;
  }

  mint ans(1);
  ll sum = n + m;

  mint fact[100005];
  fact[1] = 1;
  rep2(i, 1, 100003) fact[i+1] = fact[i] * (i + 1);

  if (n == m) {
    ans *= 2;
    ans *= fact[n];
    ans *= fact[n];
  } else {
    ans *= fact[n];
    ans *= fact[m];
  }

  cout << ans.value() << endl;
}
  

Measured memory_bytes: 4416
n, k = map(int, input().split())
a = sorted(map(int, input().split()))
f = sorted(map(int, input().split()), reverse=True)

lo, hi = -1, 10 ** 18 + 1
while hi - lo > 1:
    mid = (lo + hi) // 2
    if sum(max(0, a[i] - mid // f[i]) for i in range(n)) <= k:
        hi = mid
    else:
        lo = mid

print(hi)


Measured memory_bytes: 119500
//#pragma GCC target ("avx2")
#pragma GCC optimize ("Ofast")
#pragma GCC push_options
#pragma GCC optimize ("unroll-loops")
#include<bits/stdc++.h>
#define pb push_back
#define __V vector
#define all(x) x.begin(), x.end()
#define oit ostream_iterator
#define mod 998244353ll
using namespace std;
void doin() {
	cin.tie();
	cout.tie();
	ios::sync_with_stdio(0);
#ifndef ONLINE_JUDGE
//	freopen("input.txt", "r", stdin);
//	freopen("output.txt", "w", stdout);
#endif
}
template<typename X, typename Y>
istream& operator>>(istream& in, pair<X, Y> &a) {
	in >> a.first >> a.second;
	return in;
}
template<typename T>
void getv(T& i) {
	cin >> i;
}
template<typename T, typename ... Ns>
void getv(vector<T>& v, int n, Ns ... ns) {
	v.resize(n);
	for (auto& i : v)
		getv(i, ns...);
}
template<typename T>
void getv1(T& i) {
	cin >> i;
}
template<typename T, typename ... Ns>
void getv1(vector<T>& v, int n, Ns ... ns) {
	v.resize(n + 1);
	for (int i = 1; i <= n; i++)
		getv(v[i], ns...);
}
#ifdef _WIN32
#define getchar_unlocked() _getchar_nolock()
#define _CRT_DISABLE_PERFCRIT_LOCKS
#endif
inline void getch(char &x) {
	while (x = getchar_unlocked(), x < 33) {
		;
	}
}
inline void getstr(string &str) {
	str.clear();
	char cur;
	while (cur = getchar_unlocked(), cur < 33) {
		;
	}
	while (cur > 32) {
		str += cur;
		cur = getchar_unlocked();
	}
}
template<typename T> inline bool sc(T &num) {
	bool neg = 0;
	int c;
	num = 0;
	while (c = getchar_unlocked(), c < 33) {
		if (c == EOF)
			return false;
	}
	if (c == '-') {
		neg = 1;
		c = getchar_unlocked();
	}
	for (; c > 47; c = getchar_unlocked())
		num = num * 10 + c - 48;
	if (neg)
		num *= -1;
	return true;
}
typedef unsigned long long ull;
typedef long long ll;
typedef float ld;
typedef ll _I;
typedef pair<_I, _I> pi;
typedef pair<ld, ld> pd;
typedef map<_I, _I> mii;
typedef __V <_I> vi;
typedef __V <char> vc;
typedef __V <ld> vd;
typedef __V <vd> vvd;
typedef __V <pi> vpi;
typedef __V <__V<_I>> vvi;
typedef __V <__V<char>> vvc;
typedef __V <__V<pi>> vvpi;
using AntonTsypko = void;
using arsijo = AntonTsypko;
using god = arsijo;
uniform_real_distribution<double> double_dist(0, 1);
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
mt19937_64 rng64(chrono::steady_clock::now().time_since_epoch().count());
int main() {
	doin();
	int n;cin >> n;
	double ans, t;
	string c;
	for(int i = 1; i <= n; i++) {
		cin >> t >> c;
		if(c != "BTC")
			ans += t;
		else
			ans += t*380000.0;
	}
	cout << fixed << setprecision(15) << ans;
	return 0;
}



Measured memory_bytes: 256
//Relive your past life.
//Face your demons.
//The past is never dead,it is not even past.
//The memories are not only the key to the past but...also to the future.
//coded in Rusty Lake
#include<cmath>
#include<math.h>
#include<ctype.h>
#include<algorithm>
#include<bitset>
#include<cassert>
#include<cctype>
#include<cerrno>
#include<cfloat>
#include<ciso646>
#include<climits>
#include<clocale>
#include<complex>
#include<csetjmp>
#include<csignal>
#include<cstdarg>
#include<cstddef>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<ctime>
#include<cwchar>
#include<cwctype>
#include<deque>
#include<exception>
#include<fstream>
#include<functional>
#include<iomanip>
#include<ios>
#include<iosfwd>
#include<iostream>
#include<istream>
#include<iterator>
#include<limits>
#include<list>
#include<locale>
#include<map>
#include<memory>
#include<new>
#include<numeric>
#include<ostream>
#include<queue>
#include<set>
#include<sstream>
#include<stack>
#include<stdexcept>
#include<streambuf>
#include<string>
#include<typeinfo>
#include<utility>
#include<valarray>
#include<vector>
#include<string.h>
#include<stdlib.h>
#include<stdio.h>
#define ll   long long
#define pb   push_back
#define mp   make_pair
#define orz  1000000007
using namespace std;
struct T{
    ll t[524444],a[524444];
    int L,R;
    ll K;
    void add(int k,int l,int r){
        if(L<=l&&R>=r){
            t[k]+=K;
            a[k]+=K;
            return;
        }
        int m=(l+r)>>1,lc=k<<1,rc=lc^1;
        if(L<=m)add(lc,l,m);
        if(R>m)add(rc,m+1,r);
        t[k]=max(t[lc],t[rc])+a[k];
    }
    ll ask(int k,int l,int r){
        if(L<=l&&R>=r) return t[k];
        int m=(l+r)>>1,lc=k<<1,rc=lc^1;
        if(L>m) return ask(rc,m+1,r)+a[k];
        if(R<=m) return ask(lc,l,m)+a[k];
        return max(ask(rc,m+1,r),ask(lc,l,m))+a[k];
    }
    void ADD(int l,int r,ll k){
        if(!k) return;
        L=l,R=r,K=k;
        add(1,1,262144);
    }
    ll ASK(int l,int r){
        L=l,R=r;
        return ask(1,1,262144);
    }
}t;
int n,m,l[200005],r[200005],a[200005];
ll add[200005],dp[200005],ans;
vector<int> v[200005];
int main(){
    scanf("%d%d",&n,&m);
    ++n;
    for(int i=1;i<=m;++i){
        scanf("%d%d%d",l+i,r+i,a+i);
        ++l[i],++r[i];
        add[l[i]]+=a[i],v[r[i]].pb(i);
    }
    for(int i=2;i<=n;++i){
        t.ADD(1,i-1,add[i]);
        dp[i]=t.ASK(1,i-1);
        ans=max(ans,dp[i]);
        t.ADD(i,i,dp[i]);
        for(int j=0;j<v[i].size();++j){
            int k=v[i][j];
            t.ADD(1,l[k]-1,-a[k]);
        }
    }
    printf("%lld\n",ans);
	//system("pause");
	return 0;
}


Measured memory_bytes: 24320
// How can I satisfy thee? Let me count the ways...
import java.util.*;

public class Main {
	static int pos, p, q, r;
	static String formura;

	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		while (true) {
			formura = scanner.next();
			if (formura.equals(".")) {
				break;
			}
			int result = 0;
			for (p = 0; p < 3; p++)
				for (q = 0; q < 3; q++)
					for (r = 0; r < 3; r++) {
						pos = 0;
						if (eval() == 2) {
							result++;
						}
					}
			System.out.println(result);
		}
		scanner.close();
	}

	public static int eval() {
		char c = formura.charAt(pos);
		pos++;
		if (c == '0')
			return 0;
		if (c == '1')
			return 1;
		if (c == '2')
			return 2;
		if (c == 'P')
			return p;
		if (c == 'Q')
			return q;
		if (c == 'R')
			return r;
		if (c == '-') {
			int result = eval();
			return 2 - result;
		}
		if (c == '(') {
			int a = eval();
			char op = formura.charAt(pos);
			pos++;
			int b = eval();
			pos++;
			if (op == '*')
				return Math.min(a, b);
			if (op == '+')
				return Math.max(a, b);
		}
		return -1;
	}
}

Measured memory_bytes: 22508
#ifdef DEBUG
#define _GLIBCXX_DEBUG
#endif

#include <bits/stdc++.h>

using namespace std;

typedef long double ld;

#ifdef DEBUG
#define eprintf(...) fprintf(stderr, __VA_ARGS__), fflush(stderr)
#else
#define eprintf(...) ;
#endif

#define sz(x) ((int) (x).size())
#define TASK "text"

const int inf = (int) 1.01e9;
const ld eps = 1e-9;
const ld pi = acos((ld) -1);

mt19937 mrand(random_device{} ()); 

int rnd(int x) {
  return mrand() % x;
}

void precalc() {
}

const int maxn = 805;
int n, m, k;
char c[maxn][maxn];

int read() {
  if (scanf("%d%d%d", &n, &m, &k) < 3) {
    return false;
  }
  for (int i = 0; i < n; i++) {
    scanf("%s", c[i]);
  }
  return true;
}

int d[maxn][maxn];
vector< pair<int, int> > q;

const int gox[] = {1, 0, -1, 0};
const int goy[] = {0, 1, 0, -1};

bool inside(int x, int y) {
  return 0 <= x && x < n && 0 <= y && y < m;
}

void solve() {
  int sx = -1, sy = -1;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      if (c[i][j] == 'S') {
        assert(sx == -1);
        sx = i;
        sy = j;
        c[i][j] = '.';
      }
    }
  }
  assert(sx != -1);
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      d[i][j] = inf;
    }
  }
  d[sx][sy] = 0;
  q.clear();
  q.push_back(make_pair(sx, sy));
  for (int ql = 0; ql < sz(q); ql++) {
    int x = q[ql].first, y = q[ql].second;
    if (d[x][y] >= k) {
      break;
    }
    for (int dir = 0; dir < 4; dir++) {
      int nx = x + gox[dir], ny = y + goy[dir];
      if (!inside(nx, ny) || c[nx][ny] == '#' || d[nx][ny] < inf) {
        continue;
      }
      d[nx][ny] = d[x][y] + 1;
      q.push_back(make_pair(nx, ny));
    }
  }
  int res = inf;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      if (d[i][j] >= inf) {
        continue;
      }
      int dist = min(min(i, n - i - 1), min(j, m - j - 1));
      res = min(res, (dist + k - 1) / k + 1);
    }
  }
  printf("%d\n", res);
}

int main() {
  precalc();
#ifdef DEBUG
  assert(freopen(TASK ".in", "r", stdin));
  assert(freopen(TASK ".out", "w", stdout));
#endif
  while (read()) {
    solve();
#ifdef DEBUG
    eprintf("Time %.2f\n", (double) clock() / CLOCKS_PER_SEC);
#endif
  }
  return 0;
}


Measured memory_bytes: 12908
#include <stdio.h>
#include <math.h>

int main() {

  double a,b,c;
  double S,L2, L, h;

  scanf("%lf %lf %lf",&a,&b,&c);

  S = 0.5*a*b*sin(c*3.14159265359/180);
  L2 = a*a+b*b-2*a*b*cos(c*3.1415926359/180);
  L = sqrt(L2)+a+b;
  h = 2*S/a;

  printf("%.11lf\n%.11lf\n%.11lf\n",S ,L,h); 

  return 0;
}

Measured memory_bytes: 680
//Author: Fuadul Hasan(fuadul202@gmail.com)
#include<bits/stdc++.h>
using namespace std;

#define ll long long
const int N   = 2e5 + 5;

ll distance(ll a,ll b){
	a = abs(a);
	b = abs(b);
	return ((ll)(a * a) + (ll)(b*b));
}

int main(){
	
	
	ll n,d;
	cin>>n>>d;
	ll cnt = 0;
	//std::map<pair<int, int>,bool> m;
	for(ll i=1;i<=n;i++){
		ll a,b;
		cin>>a>>b;
		if(distance(a,b) <= d*d ){
			//cout<<a<<">"<<b<<endl;
			cnt++;
		}
	}

	cout<<cnt<<endl;

	

	return 0;
}

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

using namespace std;
typedef long long ll;
//typedef unsigned long long ll;

#define rep(i, n) for (int i = 0; i < (n); ++i)
//#define rep(i, n) for (ll i = 0; i < (n); ++i)
//#define sz(x) ll(x.size())
//typedef pair<ll, int> P;
typedef pair<ll, ll> P;
//const double INF = 1e10;
const ll INF = LONG_LONG_MAX / 10;
//const ll INF = 1e15;
const ll MINF = LONG_LONG_MIN;
//const int INF = INT_MAX / 10;
#define cmin(x, y) x = min(x, y)
#define cmax(x, y) x = max(x, y)
//typedef pair<int, int> P;
//typedef pair<double, double> P;

bool contain(set<P> &s, P a) { return s.find(a) != s.end(); }

//ifstream myfile("C:\\Users\\riku\\Downloads\\0_00.txt");
//ofstream outfile("log.txt");
//outfile << setw(6) << setfill('0') << prefecture << setw(6) << setfill('0') << rank << endl;
// std::cout << std::bitset<8>(9);


void print_line(vector<ll> &line) {
    if (line.size() == 0ll) {
        cout << endl;
        return;
    }
    for (ll i = 0; i < line.size(); i++) {
        cout << line[i];
        if (i == line.size() - 1) cout << endl;
        else cout << ' ';
    }
}


typedef priority_queue<long long, vector<long long>, greater<long long>> PQ_ASK;
const int mod = 1000000007;

int main() {

    int n;
    cin >> n;
    vector<ll> a(n);
    rep(i, n) cin >> a[i];


    int m;
    cin >> m;
    vector<ll> b(m);
    rep(i, m) cin >> b[i];

    sort(a.begin(), a.end());
    sort(b.begin(), b.end());

    vector<ll> results;
    set_symmetric_difference(a.begin(), a.end(), b.begin(), b.end(), inserter(results, end(results)));

    for(ll i : results) {
        cout << i << endl;
    }

}



Measured memory_bytes: 10108
#include <iostream>
#include <algorithm>
using namespace std;
int main() {
    int a, b, c;
    cin >> a >> b >> c;
    int m = max(a, max(b, c));
    if (m % 2 != (a + b + c) % 2) m++;
    cout << (3 * m - a - b - c) / 2 << endl;
}

Measured memory_bytes: 256
n =int(input())

ls = list(map(int,input().split()))

d = [[0,0] for i in range(n)]

for i in range(n):
  if i-ls[i]>=0:
    d[i-ls[i]][1]+=1
  if i+ls[i]<n:
    d[i+ls[i]][0]+=1

ans = 0
for a,b in d:
  ans += a*b
print(ans)

Measured memory_bytes: 34240
#include <iostream>
#include <cstdio>
#include <cstring>
#include <climits>
#include <string>
#include <algorithm>
#include <cmath>
#include <vector>
#include <stack>
#include <queue>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <sstream>
#include <boost/multiprecision/cpp_dec_float.hpp>
#include <boost/multiprecision/cpp_int.hpp>

// namespace
using namespace std;
namespace mp = boost::multiprecision;

// types
using pii = pair<int, int>;
using ll = long long int;
using ld = long double;
using mpi = mp::cpp_int;
using mpf = mp::number<mp::cpp_dec_float<1024>>;

int main() {
    mpf l;
    cin >> l;
    mpf d = l / 3;
    cout << std::setprecision(15);
    cout << d * d * d << endl;
    return 0;
}


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

int main(){
    ll K;
    cin >> K;
    ll a, b, s;
    a = K / 50;
    b = K % 50;
    s = 49 + a;
    if (b == 49) {
        if (K == 49) {
            printf("2\n27 24");
            return 0;
        }
        printf("50\n");
        for (int i = 1; i <= 49; i++) printf("%lld ", s+1);
        printf("%lld", s-49);
        return 0;
    }
    
    printf("50\n");
    for (int i = 1 ; i <= 50; i++) {
        if (i <= b) printf("%lld", s+49-b);
        else printf("%lld", s-b);
        if (i <= 49) printf(" ");
        else printf("\n");
    }
    return 0;
}

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

using namespace std;
using ll = long long;

int main() {
    int n;
    cin>>n;
    set<int> st;
    map<int,int> mp;
    for(int i = 0;i < n;++i) {
        int a;
        cin>>a;
        st.insert(a);
        ++mp[a];
    }
    for(auto iti=st.begin(); iti!=st.end();){
        for(int i = *iti;i <= 1000000;) {
            i+=*iti;
            auto it=st.find(i);
            if(it!=st.end())st.erase(it);
        }
        auto it=iti;
        if(iti!=st.end())++iti;
        if(mp[*it]>=2)st.erase(it);
    }
    cout<<st.size()<<endl;
    return 0;
}


Measured memory_bytes: 22300
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int A,B,C;
  cin >> A >> B >> C;
  
  bool fla = false;
  int n = 0;
  for (int i=0; i<B; i++) {
    if( A*i % B == C) {
      fla = true;
    }
  }
  
  if (fla) cout << "YES" << endl;
  else cout << "NO" << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
//void dfs(unordered_map<int,unordered_set<int>>&m,int st)
 int main(){
   // freopen("input.txt","r",stdin);
   // freopen("output.txt","w",stdout);
    
    float d,t,s;
    cin>>d>>t>>s;
    if(t>=d/s)
        cout<<"Yes"<<endl;
    else
        cout<<"No"<<endl;
}

Measured memory_bytes: 3688
import java.util.Scanner;

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

        int X = Integer.parseInt(scan.next());
        int Y = Integer.parseInt(scan.next());
        int Z = Integer.parseInt(scan.next());
        
        System.out.println(Z + " " + X + " " + Y);
        scan.close();
    }
}

Measured memory_bytes: 23124
/**
 *    author:  otera    
**/
#include<iostream>
#include<string>
#include<cstdio>
#include<cstring>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<deque>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
#include<cassert>
using namespace std;

//#define int long long
typedef long long ll;
typedef unsigned long long ul;
typedef unsigned int ui;
typedef long double ld;
const int inf=1e9+7;
const ll INF=1LL<<60 ;
const ll mod=1e9+7 ;
#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++)
typedef complex<ld> Point;
const ld eps = 1e-8;
const ld pi = acos(-1.0);
typedef pair<int, int> P;
typedef pair<ld, ld> LDP;
typedef pair<ll, ll> LP;
#define fr first
#define sc second
#define all(c) c.begin(),c.end()
#define pb push_back
#define debug(x)  cerr << #x << " = " << (x) << endl;
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; }

void solve() {
	int n; cin >> n;
    vector<int> x(n);
    vector<P> ins(n);
    set<int> se;
    rep(i, n) {
        cin >> x[i];
        se.insert(x[i] - 1);
        ins[i] = make_pair(x[i], i + 1);
    }
    sort(all(ins));
    vector<int> ans(n * n, -1);
    rep(i, n) {
        int p = ins[i].fr;
        --p;
        int num = ins[i].sc;
        for(int k = 0, cnt = 0; cnt < num - 1;) {
            if(k >= n * n || k >= p) {
                cout << "No" << endl;
                return;
            }
            if(ans[k] != -1 || se.find(k) != se.end()) {
                ++k;
                continue;
            } else {
                ans[k] = num;
                ++k; ++cnt;
            }
        }
        if(ans[p] != -1) {
            cout << "No" << endl;
            return;
        }
        ans[p] = num;
    }
    //残りを左詰めで埋めていく
    for(int i = 1; i <= n; ++i) {
        for(int k = x[i - 1], cnt = 0; cnt < n - i;) {
            if(k >= n * n) {
                cout << "No" << endl;
                return;
            }
            if(ans[k] != -1) {
                ++k;
                continue;
            } else {
                ans[k] = i;
                ++k; ++cnt;
            }
        }
    }
    cout << "Yes" << endl;
    rep(i, n * n) {
        cout << ans[i] << " ";
    }
    cout << endl;
}

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

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

#define repi(i, a, n) for (int i = a; i < (int)(n); ++i)
#define rep(i, n) repi(i, 0, n)
#define all(v) begin(v), end(v)

using ll = long long;

const int kMod = 1000 * 1000 * 1000 + 7;

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

  int N;
  cin >> N;

  vector<int> A(N);
  for (int& a : A) {
    cin >> a;
  }

  vector<int> S(N);
  S[N - 1] = A[N - 1] % kMod;
  for (int i = N - 2; i >= 0; --i) {
    S[i] = (S[i + 1] + A[i]) % kMod;
  }

  int result = 0;
  rep(i, N - 1) {
    int extra = (1LL * A[i] * S[i + 1]) % kMod;
    result = (result + extra) % kMod;
  }

  cout << result << '\n';

  return 0;
}


Measured memory_bytes: 4744
#include <iostream>
using namespace std;
int main(void){
    int hh;
    double n,t,a,ans=1000000;
    cin>>n>>t>>a;
    double H=1000*(t-a)/6;
    //cout<<H<<endl;
    for(int i=0;i<n;i++){
        double h;
        cin>>h;
        if(max(h-H,H-h)<ans){
            ans=max(H-h,h-H);
            hh=i+1;
        }
    }
    cout<<hh<<endl;
}


Measured memory_bytes: 256
#include<stdio.h>
int main(void){
    int card[30]={0},b,c,n,i;
    for(i=0;i<28;i++){
        scanf("%d",&b);
        card[b-1]=1;
    }
    for(i=0;i<30;i++){
        if(card[i]==0)
            printf("%d\n",i + 1);
    }
    return 0;
}

Measured memory_bytes: 1776
#include"bits/stdc++.h"


#define PB push_back
#define PF push_front
#define LB lower_bound
#define UB upper_bound
#define fr(x) freopen(x,"r",stdin)
#define fw(x) freopen(x,"w",stdout)
#define iout(x) printf("%d\n",x)
#define lout(x) printf("%lld\n",x)
#define REP(x,l,u) for(ll x = (l);x<=(u);x++)
#define RREP(x,l,u) for(ll x = (l);x>=(u);x--)
#define mst(x,a) memset(x,a,sizeof(x))
#define PII pair<int,int>
#define PLL pair<ll,ll>
#define MP make_pair
#define se second
#define fi first
#define dbg(x) cout<<#x<<" = "<<(x)<<endl;
#define sz(x) ((int)x.size())
#define cl(x) x.clear()

typedef  long long ll;
typedef unsigned long long ull;
typedef double db;
typedef long double ld;
using namespace std;

const int maxn = 100010;
const int mod = 1e9+7;
const int MAX = 1000000010;
const double eps = 1e-6;
const double PI = acos(-1);

template<typename T> inline void read(T &x){
x=0;T f=1;char ch;do{ch=getchar();if(ch=='-')f=-1;}while(ch<'0'||ch>'9');do x=x*10+ch-'0',ch=getchar();while(ch<='9'&&ch>='0');x*=f;
}

template<typename A,typename B> inline void read(A&x,B&y){read(x);read(y);}
template<typename A,typename B,typename C> inline void read(A&x,B&y,C&z){read(x);read(y);read(z);}
template<typename A,typename B,typename C,typename D> inline void read(A&x,B&y,C&z,D&w){read(x);read(y);read(z);read(w);}
template<typename A,typename B> inline A fexp(A x,B p){A ans=1;for(;p;p>>=1,x=1LL*x*x%mod)if(p&1)ans=1LL*ans*x%mod;return ans;}
template<typename A,typename B> inline A fexp(A x,B p,A mo){A ans=1;for(;p;p>>=1,x=1LL*x*x%mo)if(p&1)ans=1LL*ans*x%mo;return ans;}

int n;

ll A,B,S[maxn];

int sm[maxn*42],ls[maxn*42],rs[maxn*42],sz;

int f[maxn],g[maxn];

void update(int x,int& y,int l,int r,int t,int v){
	if(t<0||t>n)return;
	sm[y=++sz]=(sm[x]+v)%mod;ls[y]=ls[x];rs[y]=rs[x];
	if(l==r)return;
	int M=l+r>>1;
	if(t<=M)update(ls[x],ls[y],l,M,t,v);else update(rs[x],rs[y],M+1,r,t,v);
}

int query(int x,int l,int r,int L,int R){
	if(L>R)return 0;
	if(!x)return 0;
	if(L<=l&&r<=R)return sm[x];
	int M=l+r>>1,ans=0;
	if(L<=M)ans=query(ls[x],l,M,L,R);
	if(R>M)ans=(ans+query(rs[x],M+1,r,L,R))%mod;
	return ans;
}

void Work(){
	update(f[1],f[1],0,n,0,1);update(g[1],g[1],0,n,0,1);
	REP(i,2,n){
		if(S[i]-S[i-1]>=A)f[i]=f[i-1];
		if(S[i]-S[i-1]>=B)g[i]=g[i-1];
		int x;
		x=upper_bound(S+1,S+n+1,S[i]-A)-S-1;
		update(f[i],f[i],0,n,i-1,query(g[i-1],0,n,0,x));
		x=upper_bound(S+1,S+n+1,S[i]-B)-S-1;
		update(g[i],g[i],0,n,i-1,query(f[i-1],0,n,0,x));
	}
	int ans=(query(f[n],0,n,0,n)+query(g[n],0,n,0,n))%mod;
	iout(ans);
}

void Init(){
	read(n,A,B);
	REP(i,1,n)read(S[i]);
}

int main(){
	Init();
	Work();
	return 0;
}


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

using I = long long;
using U = unsigned long long;

using F = long double;

template <typename T> using Vec = vector<T>;
template <typename K, typename V> using HashMap = unordered_map<K, V>;
template <typename T> using HashSet = unordered_set<T>;
template <typename T> using PQueue = priority_queue<T>;
template <typename T> using Uq = unique_ptr<T>;

using StrView = string_view;

const string YES = "Yes";
const string NO = "No";

auto solve(I const A, I const B, I const C, I const D) -> void {
  I t = (C + B - 1) / B;
  I a = (A + D - 1) / D;
  if (a < t) {
    cout << NO << "\n";
  } else {
    cout << YES << "\n";
  }
}

auto main() -> int {
  I A;
  scanf("%lld", &A);
  I B;
  scanf("%lld", &B);
  I C;
  scanf("%lld", &C);
  I D;
  scanf("%lld", &D);
  solve(A, B, C, D);
  return 0;
}


Measured memory_bytes: 3620
#include<bits/stdc++.h>
#define ll long long
using namespace std;
int cmp(ll a,ll b)
{
    return a>b;
}
int main()
{
    int n,k;
    ll a[200009],ans=0;
    scanf("%d%d",&n,&k);
    for(int i=1;i<=n;i++)
        scanf("%lld",&a[i]);
    sort(a+1,a+n+1,cmp);
    for(int i=k+1;i<=n;i++)
        ans+=a[i];
    printf("%lld",ans);
    return 0;
}


Measured memory_bytes: 1792
//
//  RedAndBlack.cpp
//  
//
//  Created by ??°????????? on 2015/10/30.
//
//

#include <iostream>
using namespace std;

int w, h, num = 0, room[20][20];

void dfs(int x, int y) {
    if (room[y][x] == 0) return;
    
    num++;
    room[y][x] = 0;
    
    // ??????????????¢?´¢
    if (y-1 > -1) dfs(x, y-1);
    if (y+1 < h) dfs(x, y+1);
    if (x-1 > -1) dfs(x-1, y);
    if (x+1 < w) dfs(x+1, y);

    return;
}

int main() {
    while (cin >> w >> h) {
        if (w == 0 && h == 0) break;
        
        int manX, manY;
        
        for (int i = 0; i < h; i++) {
            string s;
            cin >> s;
            for (int j = 0; j < w; j++) {
                if (s[j] == '.') {
                    room[i][j] = 1;
                } else if (s[j] == '#') {
                    room[i][j] = 0;
                } else if (s[j] == '@') {
                    room[i][j] = 1;
                    manX = j;
                    manY = i;
                }
            }
        }
        
        dfs(manX, manY);
        
        cout << num << endl;
        
        num = 0;
    }
    
    return 0;
}

Measured memory_bytes: 1208
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <string>
#include <cstring>
#include <cctype>
#include <cmath>
#include <stack>
#include <queue>
#include <vector>
#include <set>
#include <map>
#include <list>
#include <stdio.h>
#include <string.h>
#include <cstdlib>
#include <math.h>
#include <bitset>
#include <iterator>
#include <iomanip>
#include <sstream>
#include <numeric>
#define INF INT_MAX
using namespace std;
int dx[5]={1,0,-1,0,0},dy[5]={0,1,0,-1,0};
long long gcd(long long a,long long b){if(a%b==0){return b;}else return gcd(b,a%b);}
long long lcm(long long a,long long b){if(a==0){return b;} return a/gcd(a,b)*b;}
#define MOD 1000000007
#define sym cout<<"---------"<<endl;
#define ll long long
#define PL pair<long long, long long>
#define mk make_pair
#define en endl
#define WHITE 1
#define BLACK 2
#define GRAY 1
#define RE return 0
#define int ll
#define P pair<int,int>


signed main(){
  string s; cin>>s;
  
  int cnt=1;
  char rev=s[s.size()-1];
  for(int i=s.size()-2; i>=0; i--){
    if(s[i]!=rev) cnt++;
    rev=s[i];
  }
  cout<<cnt-1<<en;
}




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

#ifndef M_PI
#define M_PI 3.14159265358979
#endif
#define deg_to_rad(deg) (((deg) / 360) * 2 * M_PI)
#define rad_to_deg(rad) (((rad) / 2 / M_PI) * 360)

using namespace std;

typedef long long ll;
typedef vector<ll> vll;
typedef vector<int> vi;
typedef pair<ll, ll> pll;
typedef pair<int, int> pi;
typedef long double ld;
typedef pair<long double, long double> pld;

const ll INF = 1e18;
const ll MOD = 1e9 + 7;

const ll MAX = 2020;

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() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    ll i, j, k, l;

    ll S;
    cin >> S;
    COMinit();
    ll ans = 0;
    for(i = 1; i <= S / 3; i++) {
        ll re = S - i * 3;
        if(re < 0)
            break;
        ll c = COM(re + i - 1, i - 1);
        ans = (ans + c) % MOD;
    }
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 3676
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

import itertools

N,*D = map(int,read().split())

Dcum = itertools.accumulate(D) # 累積和
answer = sum(s*d for s,d in zip(Dcum,D[1:]))
print(answer)

Measured memory_bytes: 3060
import heapq
N,M,S,T = map(int,input().split())
src = [tuple(map(int,input().split())) for i in range(M)]
S,T = S-1,T-1

INF = float('inf')
def dijkstra(is_yen):
    g = [[] for i in range(N)]
    for u,v,a,b in src:
        u,v = u-1,v-1
        c = a if is_yen else b
        g[u].append((v,c))
        g[v].append((u,c))
    costs = [INF] * N
    start = S if is_yen else T
    costs[start] = 0
    hq = [(0,start)]
    heapq.heapify(hq)
    while hq:
        _,v = heapq.heappop(hq)
        for to,c in g[v]:
            if costs[v]+c >= costs[to]: continue
            costs[to] = costs[v]+c
            heapq.heappush(hq, (costs[to],to))
    return costs

yens = dijkstra(1)
snuuks = dijkstra(0)

ans = [None] * N
ans[-1] = yens[-1] + snuuks[-1]
for i in reversed(range(N-1)):
    ans[i] = min(ans[i+1], yens[i]+snuuks[i])

for a in ans:
    print(10**15 - a)

Measured memory_bytes: 65604