akhauriyash/Code-Regression huggingface dataset:
#define _USE_MATH_DEFINES
#define _CRT_SECURE_NO_WARNINGS
#include <bits/stdc++.h>
using namespace std;

//
#define int long long
#define m0(x) memset((x), 0, sizeof(x))
#define mm(x) memset((x), -1, sizeof(x))

//container
#define ALL(x) (x).begin(), (x).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define EACH(i, c) for (typeof((c).begin()) i = (c).begin(); i != (c).end(); ++i)
#define EXIST(s, e) ((s).find(e) != (s).end())
#define UNIQUE(v) (v).erase(unique((v).begin(), (v).end()), (v).end());
#define PERM(c) \
  sort(ALL(c)); \
  for (bool c##p = 1; c##p; c##p = next_permutation(ALL(c)))

// debug
#define GET_VAR_NAME(variable) #variable
#define test(x) cout << GET_VAR_NAME(x) << " = " << x << endl;

// bit_macro
#define bit(n) (1LL << (n))
#define bitset(a, b) (a) |= (1 << (b))
#define bitunset(a, b) (a) |= ~(1 << (b))
#define bitcheck(a, b) ((a) >> (b)) & 1
#define bitcount(a) __builtin_popcountll((a))

//typedef
typedef long long lint;
typedef pair<int, int> P;
typedef tuple<int, int, int> TP;
typedef vector<int> vec;
typedef vector<vec> mat;

//constant
const int INF = (int)1e18;
const int MOD = (int)1e9 + 7;
const double EPS = (double)1e-10;
const int dx[] = {-1, 0, 0, 1, 0, -1, -1, 1, 1};
const int dy[] = {0, -1, 1, 0, 0, 1, -1, 1, -1};

//
template <typename T>
void chmax(T &a, T b) { a = max(a, b); }
template <typename T>
void chmin(T &a, T b) { a = min(a, b); }
//
inline int toInt(string s) {
  int v;
  istringstream sin(s);
  sin >> v;
  return v;
}
template <class T>
inline string toString(T x) {
  ostringstream sout;
  sout << x;
  return sout.str();
}

//
struct Accelerate_Cin {
  Accelerate_Cin() {
    cin.tie(0);
    ios::sync_with_stdio(0);
    cout << fixed << setprecision(20);
  };
};

const int MAX = 101010;

// 1<=k<=n<=10^7
// p:素数
int fac[MAX], finv[MAX], inv[MAX];

//前処理Ｏ(n)
void CombInit() {
  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;
  }
}

// 二項係数計算Ｏ(1)_nCk
int nCk(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;
}

signed main() {
  int n;
  cin >> n;

  int r, l;
  map<int, int> mp;
  for (int i = 1; i <= n + 1; i++) {
    int a;
    cin >> a;
    if (mp[a]) {
      l = mp[a];
      r = i;
    }
    mp[a] = i;
  }

  CombInit();

  for (int i = 1; i <= n + 1; i++) {
    int ans = 0;

    if (i == 1) {
      cout << n << endl;
      continue;
    }

    //r,lをともに含む　or　ともに含まない場合。
    ans += (nCk(n - 1, i - 2) + nCk(n - 1, i)) % MOD;
    ans %= MOD;

    ans += nCk(n - 1, i - 1) * 2 % MOD;
    ans %= MOD;

    ans -= nCk(n - r + l, i - 1);
    ans += MOD;
    ans %= MOD;

    cout << ans << endl;
  }

  return 0;
}


Measured memory_bytes: 9856
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;

const ll MAXN = 1e5+10;
const ll M = 1e9+7;
int n;
vector<int> adj[MAXN];
ll mem[MAXN][2];
ll dp(int u, int p, bool b) {// 0 is colour of u
  ll & ans = mem[u][b];
  if (ans!=-1) return ans;
  ans = 1;
  if (b) {
    for(int v:adj[u]) {
      if (v==p) continue;
      ans*=dp(v,u,0);
      ans%=M;
    }
  }
  if (!b){
    for(int v:adj[u]) {
      if (v==p) continue;
      ans*=(dp(v,u,1)+dp(v,u,0));
      ans%=M;
    }
  }
  return (ans)%M;
}
int main(){
  cin.tie(0); ios_base::sync_with_stdio(0);
  cin >> n;
  memset(mem,-1,sizeof mem);
  for(int i=0;i<n-1;i++) {
    int x, y;
    cin >> x >> y;
    adj[x].push_back(y);
    adj[y].push_back(x);
  }
  cout << (dp(1,-1,1) + dp(1,-1,0))%M <<endl;
}


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

#define int long long
#define ull unsigned long long
#define ld long double
#define rep(a) rep1(i,a)
#define rep1(i,a) rep2(i,0,a)
#define rep2(i,b,a) for(int i=(b); i<((int)(a)); i++)
#define rep3(i,b,a) for(int i=(b); i>=((int)(a)); i--)
#define all(a) a.begin(),a.end()
#define pii pair<int,int>
#define pb push_back
#define mp make_pair
#define eps 1e-9
#define sz(a) ((int)a.size())
#define pow2(x) (1ll<<(x))
#define ceiling(a,b) (((a)+(b)-1)/(b))
#define print0(a) cout << (a) << ' '
#define print1(a) cout << (a) << '\n'
#define print2(a,b) cout << (a) << ' ',print1(b)
#define print3(a,b,c) cout << (a) << ' ',print2(b,c)
#define print4(a,b,c,d) cout << (a) << ' ',print3(b,c,d)
#define ykh mt19937 rng(chrono::steady_clock::now().time_since_epoch().count())
#ifdef i_am_noob
#define debug(a) print2(#a,a)
#else
#define debug(a)
#endif
#define ordered_set tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update>

using namespace std;
using namespace __gnu_pbds;

const int Mod=1000000007,Mod2=998244353;
const int MOD=Mod;

inline int add(int a, int b){return (a+b>=MOD?a+b-MOD:a+b);}
inline int sub(int a, int b){return (a+MOD-b>=MOD?a-b:a+MOD-b);}
int Pow(int a, int b){
	if(!b) return 1;
	int tmp=Pow(a*a%MOD,b>>1);
	return (b&1?tmp*a%MOD:tmp);
}
inline int inverse(int n){return Pow(n,MOD-2);}

const int maxn=500005;
//i_am_noob
int a[5];

signed main(){
    ios_base::sync_with_stdio(0),cin.tie(0);
    rep(5) cin >> a[i];
    rep(5) if(!a[i]){
        print1(i+1);
        return 0;
    }
    return 0;
}


Measured memory_bytes: 3592
#include <iostream>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
int n;
ll a[200002];

ll g(int z, int x, int y){
    if(z<x||z>=y)return 1e18;
    return abs(a[z]*2-a[x-1]-a[y]);
}

P f(int x, int y){
    int l=x,r=y,m=0,b=40;
    while(b>0){
        b--;
        m=(l+r)/2;
        if(g(m, x, y)>g(m-1, x, y)){
            r=m;
        }else if(g(m, x, y)>g(m+1, x, y)){
            l=m;
        }else{
            b=0;
        }
    }

    return P(min(a[m]-a[x-1], a[y]-a[m]), max(a[m]-a[x-1], a[y]-a[m]));
}

int main(void){
    ll ans=1e18;
    cin>>n;
    a[0]=0;
    for(int i=1;i<=n;i++){
        cin>>a[i];
        a[i]+=a[i-1];
    }
    for(int i=2;i<n-1;i++){
        P p=f(1, i), q=f(i+1, n);
        ans=min(ans, max(p.second, q.second)-min(p.first, q.first));
    }
    cout<<ans<<endl;

}


Measured memory_bytes: 1920
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
#define _USE_MATH_DEFINES
#include <math.h>
#define rep(i,n) for(int i = 0;i < n;i++)
#define NIL = -1;
#define all(x) x.begin(),x.end()
const ll INF = 1e9;
const ll mod = 1e9 + 7;

int digit(ll x) {
    if (x / 10 == 0) return 1;
    return digit(x / 10) + 1;
}

ll gcd(long long a,long long b) {
    if (a < b) swap(a,b);
    if (b == 0) return a;
    
    return gcd(b,a%b);
}

ll lcm(ll a,ll b){
    return ((a * b == 0)) ? 0 : (a / gcd(a,b) * b);
}

double DegreeToRadian(double degree){
    return degree * M_PI / 180.0;
}

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


/////////////////////////////////////////////////////////////////////////////////////

int main(){
    int k;
    long long sum = 0;
    cin >> k;
    for (int a = 1;a <= k;a++){
        for (int b = 1;b <= k;b++){
            for (int c = 1;c <= k;c++){
                sum += gcd(a, gcd(b, c));
            }
        }
    }

    cout << sum << endl;
}

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

using namespace std;

#define endl '\n'

#define pb push_back
#define f first
#define s second
#define BUFF ios::sync_with_stdio(false);

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

const int INF = 0x3f3f3f3f;
const ll LINF = 0x3f3f3f3f3f3f3f3fll;

mt19937 rng((int) chrono::steady_clock::now().time_since_epoch().count());

const int MAX = (int)1e5+10;

int n, k;
ll v[MAX], dp[MAX];

ll solve( int i ){

	if( i == n-1 ){
		return 0;
	}

	if( dp[i] != -1 ){
		return dp[i];
	}

	ll mn = 1e15;
	for( int j=i+1; j-i<=k and j<n; j++ ){
		mn = min(mn, solve(j) + abs(v[i]-v[j]));
	}

	return dp[i] = mn;
}

int main(){

    BUFF;

	cin >> n >> k;

	memset(dp, -1, sizeof(dp));

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

	cout << solve(0) << endl;

    return 0;
}


Measured memory_bytes: 6528
#include <iostream>
#include <cmath>
#include <vector>
#include <string>
#include <map>
#include <algorithm>
#include <numeric>

typedef long long ll;

void print(){ std::cout << std::endl; }
template<typename H> void print(H&& head){ std::cout << head << std::endl; }
template<typename H, typename... T> void print(H&& head, T&&... tail){
  std::cout << head << " ", print(std::forward<T>(tail)...);
}

int main()
{
  ll N;
  std::cin >> N;

  std::map< std::string, ll > ms;
  for (ll i = 0; i < N; i++) {
    std::string s;
    std::cin >> s;
    ms[s]++;
  }

  print(ms.size());
  return 0;
}


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

int main() {
  int N1, N2, N;
  cin >> N1;
  cin >> N2;
 if(N1 - N2 >= 2){
     N = 2*N1-1;
 }
 else if(N2 - N1 >= 2){
     N = 2*N2 - 1;
 }
 else{
     N = N1 + N2;
 }
 cout << N << "\n";
  return 0;
}

Measured memory_bytes: 256
s = input()
judge = True

for i in range(len(s)):
	if (i+1) % 2 != 0:
		if s[i] == "R" or s[i] == "U" or s[i] == "D":
			continue
		else:
			judge = False
			break
	else:
		if  s[i] == "L" or s[i] == "U" or s[i] == "D":
			continue
		else:
			judge = False
			break

if judge:
	print("Yes")
else:
	print("No")

Measured memory_bytes: 3064
//*
#include <stdio.h>
#include <string.h>
#include <ctype.h>
#include <time.h>
#include <stdlib.h>
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <string>
#include <numeric>
#include <functional>
#define MOD 1000000007
#define MAX 0x3f3f3f3f
#define MAX2 0x3f3f3f3f3f3f3f3fll
#define ERR 1e-10
#define mp make_pair
#define all(x) (x).begin(), (x).end()
#pragma warning(disable:4996)
using namespace std;

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

int n, m;
char s[300000];

ll d[300000][2];

ll u[300000], v[300000];

int main()
{
    int i, j, k, l;
    ll ans=0;
    cin>>n>>m;
    scanf("%s", s);
    m=strlen(s);
    if(s[0] == 'B')
    {
        for(i=0;i<m;i++) s[i]=s[i]=='R'?'B':'R';
    }
    for(i=0;i<m;i++)
    {
        if(s[i] == 'R') s[i]='o';
        else s[i]='x';
    }
    if(count(s, s+m, 'o') == m)
    {
        for(k=0;k<2;k++)
        {
            d[0][k]=1;
            d[0][!k]=0;
            for(i=1;i<n;i++)
            {
                d[i][0]=d[i-1][0]+d[i-1][1];
                d[i][1]=d[i-1][0];
                d[i][0]%=MOD, d[i][1]%=MOD;
            }
            if(k == 0)
            {
                ans+=d[n-1][0]+d[n-1][1];
            }
            else
            {
                ans+=d[n-1][0];
            }
        }
        ans%=MOD;
    }
    else
    {
        if(n%2 == 1)
        {
            return !printf("0\n");
        }
        n/=2;
        int mi=MAX;
        int cur=0;
        int flag=0;
        for(i=0;i<m;i++)
        {
            if(s[i] == 'o') cur++;
            else
            {
                if(cur)
                {
                    if(flag == 0)
                    {
                        if(cur%2 == 0) cur++;
                    }
                    else
                    {
                        if(cur%2 == 0)
                        {
                            cur=0;
                            continue;
                        }
                    }
                    mi=min(mi, cur);
                    flag=1;
                }
                cur=0;
            }
        }
        mi/=2;
        if(mi >= n-1)
        {
            ans=1;
            for(i=0;i<n;i++) ans*=2, ans%=MOD;
            ans--;
            ans+=MOD;
            ans%=MOD;
        }
        else
        {
            u[0]=v[0]=1;
            u[1]=1, v[1]=2;
            for(i=2;i<n;i++)
            {
                int idx=max(-1, i-mi-2);
                u[i]=(v[i-1]-(idx==-1?0:v[idx]))%MOD;
                u[i]+=MOD;
                u[i]%=MOD;
                v[i]=v[i-1]+u[i];
                v[i]%=MOD;
            }
            for(i=n-1;i>=n-1-mi;i--)
            {
                ans+=u[i]*(n-i);
                ans%=MOD;
            }
        }
        ans*=2;
        ans%=MOD;
    }
    ans+=MOD;
    ans%=MOD;
    cout<<ans<<endl;
    return 0;
}
//*/

Measured memory_bytes: 4608
#include <bits/stdc++.h>
using namespace std;
int main(void){
  string S,T;
  cin >> S;
  cin >> T;
  int i,j;
  int lenS=S.length();
  for(i=0;i<lenS;i++){
    if(T.substr(0,lenS-i)==S.substr(i,lenS-i) && S.substr(0,i)==T.substr(lenS-i,i+1)){
      cout<<"Yes";
      exit(0);
    }
  }
  cout<<"No";
}


Measured memory_bytes: 256
import java.util.Scanner;

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

  public static void main(String[] args) {
    int N = sc.nextInt();
    long sum = 0;
    for (int i = 1; ; i++) {
      sum += i;
      if (sum >= N) {
        System.out.println(i);
        return;
      }
    }

  }

}


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

#define FOR(i, a, b) for(int i = a; i < b; ++i)
#define REP(i, n) FOR(i, 0, n)
#define _ << " " <<
#define sz(x) ((int) x.size())
#define pb(x) push_back(x)

typedef long long ll;
typedef pair<ll, ll> point;

const int off = 1 << 18, MAXN = 2e5 + 5;
const ll inf = 1e17;

ll n, m;
vector <point> r[MAXN];

struct Tournament{
  ll t[2 * off], p[2 * off];
  Tournament(){
    REP(i, 2 * off){
      t[i] = 0;
      p[i] = 0;
    }
  }
  void prop(int x){
    if(p[x] == 0) return;
    t[x] += p[x];
    if(x < off){
      p[x * 2] += p[x];
      p[x * 2 + 1] += p[x];
    }
    p[x] = 0;
  }
  void postavi(ll x, int pos){
    pos += off; t[pos] = x; pos >>= 1;
    for( ; pos > 0; pos >>= 1)
      t[pos] = max(t[pos * 2], t[pos * 2 + 1]);
  }
  void update(int x, int lo, int hi, int a, int b, ll add){
    prop(x);
    if(lo >= b || hi <= a) return;
    if(lo >= a && hi <= b) { p[x] += add; prop(x); return; }
    int mid = (lo + hi) >> 1;
    update(x * 2, lo, mid, a, b, add); update(x * 2 + 1, mid, hi, a, b, add);
    t[x] = max(t[x * 2], t[x * 2 + 1]);
  }
  ll get(int x, int lo, int hi, int a, int b){
    prop(x);
    if(lo >= b || hi <= a) return 0;
    if(lo >= a && hi <= b) return t[x];
    int mid = (lo + hi) >> 1;
    return max( get(x * 2, lo, mid, a, b), get(x * 2 + 1, mid, hi, a, b) );
  }
} T;

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

  cin >> n >> m;
  REP(i, m){
    ll a, b, c; cin >> a >> b >> c; a --; b --;
    r[b].pb(point(a, c));
  }
  REP(i, n){
    ll x = T.get(1, 0, off, 0, off);
    T.postavi(x, i);

    for(auto it : r[i])
      T.update(1, 0, off, it.first, i + 1, it.second);
  }
  cout << T.get(1, 0, off, 0, off);
}


Measured memory_bytes: 19456
n,d = map(int, input().split())
X = [list(map(int, input().split())) for _ in range(n)]

l = len(X)
cnt = 0

for i in range(l):
    for j in range(i+1, l):
        distance = sum((X[i][d]-X[j][d])**2 for d in range(d))**0.5
        if distance == int(distance):
            cnt += 1
        else:
            continue
            
print(cnt)

Measured memory_bytes: 9296
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define REP(i,n) for(int i=0; i<(n); i++)
#define REP2(i,x,n) for(int i=x; i<(n); i++)
int gcd(int a,int b){return b?gcd(b,a%b):a;}    //最大公約数
int lcm(int a, int b) {return a * b / gcd(a, b);}   //最小公倍数

int main()
{
	string s;
	cin >> s;
	int l;
	l=(int)(s.length());
	int cnt = 0;
	char a = s[0];
	cnt++;
	REP2(i, 1, l)
	{
		if(a==s[i]){
			if(i==l-1){
				cout << cnt << endl;
				return 0;
			}
			else{
			a = s[i] + s[i+1];
			i++;
			}
		}
		else{
			a = s[i];
		}
		cnt++;
	}
	cout << cnt << endl;
}

Measured memory_bytes: 640
//$ node B.js < B.txt
function Main(input) {
  input = input.split('\n') // 1行目がinput[0], 2行目がinput[1], …に入る
  var ans = 0
  var flag = false
  for(var i=1;i<Number(input[0])+1;i++){
    if(!flag && input[i].match(input[Number(input[0])+1])){
      flag = true
      continue
    }
    if(flag){
      ans += Number(input[i].split(' ')[1])
    }
  }
  console.log(ans)
}

Main(require('fs').readFileSync('/dev/stdin', 'utf8'));

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

int main() {
	int n, count;
	bool *data;

	while (cin >> n) {
		data = new bool[n + 1];
		count = 0;
		for (int i = 0;i <= n;i++) data[i] = true;
		for (int i = 2;i <= n;i++) {
			if (data[i]) {
				count++;
				for (int j = i + i;j <= n;j += i) {
					data[j] = false;
				}
			}
		}
		cout << count << endl;
		delete[] data;
	}
	return 0;
}

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

int main(void) {
	int a, b, t, i = 1, sum = 0;
	double tp;

	cin >> a >> b >> t;
	
	tp = (double)t + 0.5;

	if (1 <= a,b,t <= 20) {
		while(true){
			if (a*i <= tp)
				sum = sum + b;
			else
				break;
			i++;
		}
		cout << sum;
	}
	else
		cout << "0";
	return 0;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
#define rep(i,b) for(ll i=0;i<b;i++)
#define ll long long
using namespace std;
/*--Input//////////////////////////////////////////////////*/
inline void IN(void){return;}
template <typename First, typename... Rest>
void IN(First& first, Rest&... rest){cin >> first;IN(rest...);return;}
#define SS(T, ...)      T __VA_ARGS__; IN(__VA_ARGS__);
#define SV(type,c,n) vector<type> c(n);for(auto& i:c)cin >> i;
/*--Output/////////////////////////////////////////////////*/
inline int p(void){cout << endl; return 0;}
template<class Head> int p(Head&& head){cout << head;p();return 0;} template<class Head,class... Tail> int p(Head&& head,Tail&&... tail){cout<<head<<" ";p(forward<Tail>(tail)...);return 0;}
struct ProconInit {
    static constexpr bool AUTOFLUSH = false;
    ProconInit() {
        cin.tie(nullptr);
        ios::sync_with_stdio(false);
        cout << fixed << setprecision(20);
        if(AUTOFLUSH)
            cout << unitbuf;
    }
} PROCON_INIT;

#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define vl vector<ll>
#define debug(x) cerr<<#x<<" "<<x<<'\n';
#define all(x) (x).begin(),(x).end()
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
bool cmp(pair<ll,ll> a, pair<ll,ll> b) { return a.first+a.second > b.first+b.second; }

signed main() {
    SS(int,a);
    p(a+a*a+a*a*a);
}

Measured memory_bytes: 3652
//#include <bits/stdc++.h>
#include <string>
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <deque>
#include <utility>
#include <climits>

using namespace std;
using ll=long long;

void solve(){
  while(true){
    int e;
    cin >> e;
    if(e==0)return;
    int res=e;
    for(int i=0;i<e;i++){
      ll z=(ll)i*i*i;
      if(z>e)break;
      for(int j=0;j<=e-z;j++){
        ll y=(ll)j*j;
        if(y+z>e)break;
        int x=e-y-z;
        res=min(res,x+j+i);
      }
    }
    cout << res << "\n";
  }
}

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



Measured memory_bytes: 3200
#include <bits/stdc++.h>
#define ll long long int
#define pb push_back
#define mp make_pair
#define mod 1000000007
#define pi 3.141592653589793
using namespace std;


int ones(int e) {
    int ans = 0;
    while (e) {
        e &= (e - 1);
        ans++;
    }

    return ans;
}

void f() {
    int q;
    cin >> q;
    set<int> s;
    ll even = 0, odd = 0;
    int e;
    cin >> e;
    q--;
    int p = e;
    int on = ones(e);
    while (q--) {
        int e;
        cin >> e;


    }
}


int main() {
//    cout << setprecision(10);
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);


    int l, r;
    cin >> l >> r;
    if (r - l + 1 >= 2019) {
        cout << 0;
        return 0;
    }

    ll ans = 2019;
    for (ll i = l; i <= r; i++) {
        for (ll j = i + 1; j <= r; j++) {
            ans = min(ans, (i * j) % 2019);
        }
    }

    cout << ans;


}



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

long long INF = 1e18;

struct Edge{
    int from;
    int to;
    int cost;
};

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

Measured memory_bytes: 1408
package main

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

const size = 1000000
var reader = bufio.NewReaderSize(os.Stdin,size)
func NextLine() string {
  var line,buffer []byte
  var isPrefix bool = true
  var err error
  for ;isPrefix; {
    line,isPrefix,err = reader.ReadLine()
    if err != nil { panic(err) }
    buffer = append(buffer,line...)
  }
  return string(buffer)
}
func NextInt() int {
  var n int
  n,_ = strconv.Atoi(NextLine())
  return n
}
func NextInt64Array() []int64 {
  var s []string = strings.Split(NextLine()," ")
  var n int = len(s)
  var a []int64 = make([]int64,n)
  for i:=0;i<n;i++ {
    a[i],_ = strconv.ParseInt(s[i],10,64)
  }
  return a
}

func main() {
  var n int = NextInt()
  var a []int64 = NextInt64Array()
  m := map[int64]int64{0:1}
  var s int64 = 0
  for i:=0;i<n;i++ {
    s += a[i]
    m[s]++
  }
  s = 0
  for _,val := range m {
    s += c(val,2)
  }
  fmt.Println(s)
}
func c(n int64,k int64) int64 {
  if 2*k > n { return c(n,n-k) }
  if k > n || n < 0 || k < 0 { return 0 }
  if n == 0 && k == 0 { return 1 }
  if n == 0 { return 0 }
  var num,den int64 = 1,1
  for i:=k;i>0;i-- {
    if num%i == 0 {
      num = (num/i)*(n-k+i)
    } else if (n-k+i)%i == 0 {
      num *= (n-k+i)/i
    } else {
      num *= (n-k+i)
      den *= i
    }
  }
  return num/den
}

Measured memory_bytes: 17664
n = int(input())
As = [int(input()) for _ in range(n)]
sorted_As = sorted(As, reverse = True)
max_val, next_max_val = sorted_As[0], sorted_As[1]
# max_index = As.index(max_val)
for A in As:
    if A == max_val:
        print(next_max_val)
    else:
        print(max_val)

Measured memory_bytes: 14112
#include <stdio.h>

int main()
{
  int x,y;
  while(1){
  scanf("%d %d",&x,&y);
  if(x==0&&y==0){
    break;
  }
  if(x>y){
    printf("%d %d\n",y,x);
  }else{
    printf("%d %d\n",x,y);
  }
  }
  return 0;
}

Measured memory_bytes: 600
#include<stdio.h>
#include<stdlib.h>
int main(void) {
	int  c = 0;
	char n[100];
	scanf("%s", n, 100);
	for (int i = 0; i < 100; i++) {
		if (n[i] == '\0') {
			break;
		}
		c += (int)n[i] - 48;
	}
	int d = atoi(n);
	if (d % c == 0)
		printf("Yes");
	else
		printf("No");
	return 0;
}

Measured memory_bytes: 128
#include <algorithm>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
#include <cfloat>

using std::cerr;
using std::cin;
using std::cout;
using std::endl;

int main(void){
  cout << std::fixed << std::setprecision(16);
  cin.tie(0);
  std::ios::sync_with_stdio(false);

  int n,k;
  cin>>n>>k;
  std::string s;
  cin>>s;

  int chg_count=1;
  for(int i=0;i<n-1;i++){
    if(s[i]!=s[i+1]){
      chg_count++;
    }
  }
  chg_count=std::max(1,chg_count-2*k);
  cout<<n-chg_count<<endl;



  return 0;
}


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

using namespace std;

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

typedef int _loop_int;
#define REP(i,n) for(_loop_int i=0;i<(_loop_int)(n);++i)
#define FOR(i,a,b) for(_loop_int i=(_loop_int)(a);i<(_loop_int)(b);++i)
#define FORR(i,a,b) for(_loop_int i=(_loop_int)(b)-1;i>=(_loop_int)(a);--i)

#define DEBUG(x) cout<<#x<<": "<<x<<endl
#define DEBUG_VEC(v) cout<<#v<<":";REP(i,v.size())cout<<" "<<v[i];cout<<endl
#define ALL(a) (a).begin(),(a).end()

#define CHMIN(a,b) a=min((a),(b))
#define CHMAX(a,b) a=max((a),(b))

// mod
const ll MOD = 1000000007ll;
#define FIX(a) ((a)%MOD+MOD)%MOD

// floating
typedef double Real;
const Real EPS = 1e-11;
#define EQ0(x) (abs(x)<EPS)
#define EQ(a,b) (abs(a-b)<EPS)
typedef complex<Real> P;

int n;
int a[125252];

int main(){
  scanf("%d",&n);
  REP(i,n)scanf("%d",a+i);
  ll sum = 0;
  sum += abs(a[0]-0);
  FOR(i,1,n)sum += abs(a[i]-a[i-1]);
  sum += abs(0-a[n-1]);
  {
    ll ans = sum - abs(a[0]-0) - abs(a[1]-a[0]) + abs(a[1]-0);
    printf("%lld\n", ans);
  }
  FOR(i,1,n-1){
    ll ans = sum - abs(a[i]-a[i-1]) - abs(a[i]-a[i+1]) + abs(a[i-1]-a[i+1]);
    printf("%lld\n",ans);
  }
  {
    ll ans = sum - abs(a[n-1]-0) - abs(a[n-2]-a[n-1]) + abs(a[n-2]-0);
    printf("%lld\n",ans);
  }
  return 0;
}


Measured memory_bytes: 1664
// Original Problem - https://atcoder.jp/contests/abc164/tasks/abc164_d
// number of substring is divisible by target.

//--- pD ---//
import java.util.*;
import java.lang.*;
import java.io.*;
public class Main {
	public static void main (String[] args) throws java.lang.Exception {
		new Solution();
	}
}
class Solution {
	Reader reader;
	PrintWriter out;
	public Solution() {
		reader = new Reader();
		out = new PrintWriter(System.out);
		while (reader.hasNext()) {
			run_case();
		}
		out.flush();
	}

	private void run_case() {
		String str = reader.ns();

		Map<Integer, Integer> cnt = new HashMap<>();
		cnt.put(0, 1);

		int p = 0;
		int t = 1;

		long ans = 0;

		int target = 2019;

		for (int i=str.length()-1; i>=0; i--) {
			p += t * (str.charAt(i) - '0');
			p %= target;
			t *= 10;
			t %= target;
			if (cnt.containsKey(p)) ans += cnt.get(p);
			cnt.putIfAbsent(p, 0);
			cnt.put(p, cnt.get(p) + 1);
		}

		out.println(ans);

		return;
	}
}


class Reader {
	BufferedReader br;
	StringTokenizer st;
	public Reader(){
		try {
			br = new BufferedReader(new InputStreamReader(System.in));
			st = new StringTokenizer(br.readLine());
		} catch (Exception e) {
			e.printStackTrace();
		}
	}
	public String next() {
		if (st.hasMoreTokens()) return st.nextToken();
		try {
			st = new StringTokenizer(br.readLine());
		} catch (Exception e) {
			e.printStackTrace();
		}
		return st.nextToken();
	}
	public boolean hasNext() {
		try {
			if (!st.hasMoreTokens() && !br.ready()) return false;
			else return true;
		} catch (Exception e) {
			e.printStackTrace();
		}
		return false;
	}
	public int ni() {return Integer.parseInt(this.next());}
	public long nl() {return Long.parseLong(this.next());}
	public String ns() {return this.next();}
}


Measured memory_bytes: 52928
import sys
import numpy as np
import numba
from numba import njit
i8 = numba.int64

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

@njit((i8[:], i8), cache=True)
def solve(A, keta):
    # 10^keta の位を n にできるか
    MOD = 10**(keta + 1)
    B = 10**keta
    nums = [0]
    for x in A:
        x %= MOD
        n = len(nums)
        for i in range(n):
            s = nums[i] + x
            if s >= MOD:
                s -= MOD
            nums.append(s)
        nums.sort()
        # x, y, z とあって、x + z < B ならば、y は捨ててよい
        tmp = []
        for x in nums:
            while len(tmp) >= 2 and tmp[-2] + B > x:
                tmp.pop()
            tmp.append(x)
        nums = tmp
    return nums[-1] // B

def main(A):
    N = len(A)
    ans = 0
    for keta in range(18):
        x = solve(A, keta)
        ans += x
    return ans

A = np.array(read().split(), np.int64)[1:]
np.random.shuffle(A)
print(main(A))

Measured memory_bytes: 105964
m = list(map(int,input().split()))
a = [list(map(int,input().split())) for i in range(m[0])]
c = [list(map(int,input().split())) for i in range(m[1])]

for i in range(m[0]):
    p=[]
    for j in range(m[1]):
      p.append( abs( a[i][0]-c[j][0])+ abs( a[i][1]-c[j][1]) )
    print(p.index(min(p))+1 )



Measured memory_bytes: 3064
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<algorithm>
#define fo(i,j,k) for(int i=j;i<=k;++i)
#define fd(i,j,k) for(int i=j;i>=k;--i)
using namespace std;
const int N=1e5+10,mo=1e9+7;
char s[N];
int cn[26];
int main()
{
	int n;
	scanf("%d",&n);
	scanf("%s",s+1);
	int ans=0;
	fo(i,1,n){
		int tmp=1;
		fo(j,0,25) if(s[i]-'a'!=j) tmp=1ll*tmp*(cn[j]+1)%mo;
		++cn[s[i]-'a'],ans=(ans+tmp)%mo;
	}
	printf("%d",ans);
}


Measured memory_bytes: 256
#include <deque>
#include <iostream>

using namespace std;

int main(){
        deque<int> A;
        int q;
        cin >> q;
        int command,value,switcher;
        for(int i=0;i<q;i++){
                cin >> command;
                if(command==0){
                        cin >> switcher >> value;
                        if(switcher == 0) A.push_front(value);
                        if(switcher == 1) A.push_back(value);
                }
                else if(command == 1){
                        cin >> value;
                        cout << A[value] << endl;
                }
                else{
                        cin >> switcher;
                        if(switcher == 0) A.pop_front();
                        else A.pop_back();
                }
        }
        return 0;

}




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

using namespace std;

typedef long long ll;
int mod = (int)1e9 + 7;
int a[200050];
int h[200050];
ll tree[200050 * 4];
ll dp[200050];

void pushdown(int o ,int z,int l , int r  , ll num){
    if(l > z || r < z)    return;
    //printf("%d %d \n",l,r);

    int mid = (l + r) / 2;
    tree[o] = max(num , tree[o]);
    if(l == r)  return ;

    pushdown(o * 2 + 1 , z , l , mid  , num);
    pushdown(o * 2 + 2 , z , mid + 1 , r  , num);
}

ll qu(int o ,int l ,int r,int x , int y){
    if(l > y || r < x)    return 0;
    if(l >= x && r <= y)    return tree[o];

    int mid = (l + r) / 2;

    ll res = 0;
    res = max ( res , qu(o * 2 + 1 , l , mid , x , y ));
    res = max ( res , qu(o * 2 + 2 , mid + 1 , r , x , y ));

    return res;
}

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

    for(int i = 0 ; i < n;i++){
        scanf("%d",&h[i]);
        h[i]--;
    }
    for(int i = 0 ; i < n;i++){
        scanf("%d",&a[i]);
    }

    ll ans = 0;
    for(int i = 0 ; i < n ; i++){
        //printf("%d\n",i);
        dp[i] = qu(0 , 0 , n , 0 , h[i]) + a[i] ;
        ans = max(ans , dp[i]);
        pushdown(0,h[i],0 , n ,dp[i]);
    }

    cout << ans;
    return 0;
}


Measured memory_bytes: 9600
//
//  atcoder.cpp
//
//
///
#include <bits/stdc++.h>
#include <boost/optional.hpp>
#include <boost/range/irange.hpp>
#include <boost/range/algorithm.hpp>
#include <boost/range/numeric.hpp>
#include <boost/bimap/bimap.hpp>
#include <boost/bimap/multiset_of.hpp>
#include <boost/multi_array.hpp>
#include <boost/integer/common_factor_rt.hpp>
#include <boost/algorithm/string.hpp>
#include <boost/icl/interval_map.hpp>

#define REP(i, N) for(int i=0; i<(N); i++)
#define REC(f, ...) (void)0; const auto f = [&](const auto f, __VA_ARGS__)
using namespace std;
using namespace boost::integer;

using ll = long long;
namespace bst = boost;
namespace icl = boost::icl;
template<typename T> class in {
    T value;
public:
    in() { cin >> value; }
    operator const T&() const { return value; }
    operator T&() { return value; }
    in& operator=(T source) { value = source; return *this; }
};
template<> class in<string> : public string {
public:
    in() { cin >> *this; }
};
template<class T> class inseq : public T {
public:
    template<typename... Arg> inseq(Arg... arg) : T(forward<Arg>(arg)...) { for (auto&& i : *this) cin >> i; }
};
template<class T> using invec = inseq<vector<T>>;

auto solve() {
  in<ll> N;
  invec<ll> A(N);
  
  bst::sort(A);
  vector<ll> found, kaburi;
  found.push_back(A[0]);
  found.reserve(130000);
   kaburi.reserve(130000);

 
  for (int i = 1; i < N; i++) {
    ll div = 1;
    
    if (bst::binary_search(found, A[i])) {
      if (kaburi.empty() || kaburi.back() != A[i])
        kaburi.push_back(A[i]);
      continue;
    }

    if (found.size() > (ll)sqrt(A[i])) {
    for (;;) {
      if (A[i] < div * div) {
        found.push_back(A[i]);
        break;
      }
      if (A[i] % div == 0 && (bst::binary_search(found, div) || bst::binary_search(found, A[i] / div))) {
        break;
      }
      div++;
    }
    }
    else {
   for (auto it = found.begin(); it != found.end(); ++it) {
      if (*it * 2 > A[i]) {
        break;
      }
      if (A[i] % *it == 0) {
        goto FOUND;
      }
    }
    found.push_back(A[i]);
    
    FOUND: (void)0;
    }
  }


  return found.size() - kaburi.size();
}

template<typename T> void plot(const T& func) { cout << setprecision(9) << func() << endl; }
template<> void plot<void()>(void(&func)()) { func(); }

int main() {
  plot(solve);

  return 0;
}





Measured memory_bytes: 6800
#include <bits/stdc++.h>
using namespace std;
#define m 1000000007 
#define endl "\n"    
#define int long long

int modpow(int x, int n) 
{ 
    if (n == 0) 
    return 1%m; 
    long long u = modpow(x,n/2); 
    u = (u*u)%m; 
    if (n%2 == 1) 
    u = (u*x)%m; 
    return u; 
}


int32_t main()
{
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout << fixed << setprecision(9);
  int t;
  cin>>t;
  double sum=0;
  for(int i=1;i<=t;i++)
  {
      double x;
      cin>>x;
      sum+=(1/x);
  }
  double fin=1/sum;
  cout<<fin;
  

}


Measured memory_bytes: 256
import java.util.Scanner;
import java.util.Random;;
import java.util.Arrays;

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

        int N = scan.nextInt();
        String S = scan.next();

        int turnW[] = new int[N]; //Weat西
        int turnE[] = new int[N]; //East東

        for(int i = 0; i < N; i++) {
            if(S.charAt(i) == 'E'){
                turnW[N-1-i] += 1;
            }else if(S.charAt(i) == 'W'){
                turnE[i] += 1;
            }
        }

        for(int i = 1; i < N; i++){
            turnE[i] += turnE[i - 1];
            turnW[i] += turnW[i - 1];
        }

        int min = turnW[N-1];

        for(int i = 1; i < N - 1; i++){
            min = Math.min(min,turnW[N-2-i]+turnE[i-1]);
        }

        min = Math.min(min,turnE[N-1]);

        System.out.println(min);

    }
}


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

int main()
{
  int N, K;
  cin >> N >> K;
  int tmp = K;
  int i = 0;
  while(1)
  {
    i++;
    if(N / K == 0)
      break;
    K *= tmp;
  }
  cout << i << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<queue>
#define ull unsigned long long
#define CIN ios_base::sync_with_stdio(0); cin.tie(0);cout.tie(0);
using namespace std;
typedef long long ll;
const int MOD = 1e5;
const int INF = 0x3f3f3f3f;
string to_upper(string a){
	for (int i=0;i<(int)a.size();++i) if (a[i]>='a' && a[i]<='z') a[i]-='a'-'A';
	return a;
}
string to_lower(string a){
	for (int i=0;i<(int)a.size();++i) if (a[i]>='A' && a[i]<='Z') a[i]+='a'-'A';
	return a;
}
ll sti(string a,int base=10){
	ll k=0;
	for (int i=0;i<(int)a.size();++i){
		k*=base;
		k+=a[i]-'0';
	}
	return k;
}
ll min(ll a,int b){
	if (a<b) return a;
	return b;
}
ll min(int a,ll b){
	if (a<b) return a;
	return b;
}
ll max(ll a,int b){
	if (a>b) return a;
	return b;
}
ll max(int a,ll b){
	if (a>b) return a;
	return b;
}
ll gcd(ll a,ll b){
	if (b==0) return a;
	return gcd(b,a%b);
}
ll lcm(ll a,ll b){
	return a/gcd(a,b)*b;
}
inline int multt(ll a,ll b){
	return (a*b)%MOD;
}
inline int pott(int n,int k){
	if (k==0) return 1;
	ll a=pott(n,k/2);
	a=multt(a,a);
	if (k%2) return multt(a,n);
	else return a;
}
int divide(int a,int b){
	return multt(a,pott(b,MOD-2));
}
inline int subb(int a,int b){
	if (a-b>=0) return a-b;
	return a-b+MOD;
}
inline int addd(int a,int b){
	if (a+b>=MOD) return a+b-MOD;
	return a+b;
}
bool prime(ll a){
	if (a==1) return 0;
	for (int i=2;i<=round(sqrt(a));++i){
		if (a%i==0) return 0;
	}
	return 1;
}
ll a[11];
int s1[11],s2[11],vis[11];
int main() {
	for(int i=1;i<=8;i++){
		ll sum=1;
		for(int j=1;j<=i;j++){
			sum*=j;
		}
		a[i]=sum;
	}
	ll ans1=0,ans2=0;
	int n;
	cin>>n;
	for(int i=1;i<=n;i++)cin>>s1[i];
	for(int i=1;i<=n;i++)cin>>s2[i];
	for(int i=1;i<=n;i++){
		vis[s1[i]]++;
		ll cnt=0;
		for(int j=1;j<=s1[i];j++){
			if(!vis[j]){
				cnt++;
			}
		}
		cnt*=a[n-i];
		ans1+=cnt;
	}
	memset(vis,0,sizeof(vis));
	for(int i=1;i<=n;i++){
		vis[s2[i]]++;
		ll cnt=0;
		for(int j=1;j<=s2[i];j++){
			if(!vis[j]){
				cnt++;
			}
		}
		cnt*=a[n-i];
		ans2+=cnt;
	}
	cout<<abs(ans1-ans2)<<endl;
	return 0;
}


// 
// 
// 
//
//
//
//
 

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
    int n,a,b;
    cin >> n >> a >> b;
    if(n*a>b)
    cout << b << endl;
    else if(n*a<b)
    cout << n*a << endl;
    else if(n*a==b)
    cout << n*a << endl;
}

Measured memory_bytes: 256
integer N,Q
integer(16),allocatable,dimension(:)::Point
integer(16) K
integer A
read*,N,K,Q
allocate(Point(N))
Point=0
do i=1,Q
  read*,A
  Point(A)=Point(A)+1
end do
do i=1,N
  if(Q-Point(i)<K)then
    print"(A)","Yes"
  else
    print"(A)","No"
  endif
end do
end

Measured memory_bytes: 2176
import java.util.Scanner;


public class Main {

	public static void main(String[] args) {

		// 入力
		Scanner sc = new Scanner(System.in);
		int inputFirst = sc.nextInt();
		int inputSecond = sc.nextInt();
		sc.close();
		
		int dispInt = 1;

		for (int i=0; i < inputFirst; i++) {
			int x = dispInt * 2;
			int y = dispInt + inputSecond;
			if (x < y) {
				dispInt = x;
			} else {
				dispInt = y;
			}
		}
		
		System.out.println(dispInt);
	}
}

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

int main() {
	int N,X;
	cin >> N >> X;
	
    int Li;
    int times = 1;
    int CordX = 0;
    rep(i,N){
        cin >> Li;
        CordX += Li;
        if(CordX <= X){
            times++;
        }else{
            break;
        } 
    }

    cout << times << endl;
	return 0;
}


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

using namespace std;

#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define BIT(X,i) ((X>>i)&1)
#define REP(i,a,b) for(int i = (a); i < (b); ++i)
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define all(a) (a).begin(), (a).end()
#define r_all(a) (a).rbegin(), (a).rend()
#define ina(x,n) rep(x_i,n) cin>>x[x_i]
#define outa(x,n) rep(x_i,n) cout<<x[x_i]<<" \n"[x_i==n-1]

typedef long long ll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef pair<ll, ll> pll;
typedef vector<pll> vll;
typedef priority_queue<ll> pq;

const int MOD = 1e9+7;
const int INF = (1<<28);
const ll INFL = (1L<<61);

int main() {
  int n; cin >> n;
  string s; cin >> s;
  bool ok = true;
  if (n&1) {
    ok = false;
  } else {
    for (int i = 0; i < n/2; i++) {
      if (s[i] != s[i+n/2]) ok = false;
    }
  }
  cout << (ok?"Yes":"No") << endl;
  return 0;
}


Measured memory_bytes: 764
#include <cstdio>
#include <cstring>
#define MAXN 1000010
#define LL long long

const LL P=1000000007;
int n,m,a,b;
LL fac[MAXN],invfac[MAXN];

LL getPow(LL x,LL y){
	LL res=1;
	while(y){
		if(y&1) res=res*x%P;
		x=x*x%P;
		y>>=1;
	}
	return res;
}

void init(){
	fac[0]=1;
	for(int i=1;i<MAXN;i++) fac[i]=fac[i-1]*i%P;
	invfac[MAXN-1]=getPow(fac[MAXN-1],P-2);
	for(int i=MAXN-2;i>=0;i--) invfac[i]=invfac[i+1]*(i+1)%P;
}

LL getC(int x,int y){
	return fac[x]*invfac[y]%P*invfac[x-y]%P;
}

LL g(int x,int y){ return getC(x+y-2,y-1); }

int main(){
	init();
	scanf("%d%d%d%d",&n,&m,&a,&b);
	LL ans=g(n,m);
	for(int i=1;i<=b;i++)
		ans=(ans-g(n-a,i)*g(a,m-i+1)%P+P)%P;
	printf("%lld\n",ans);
}

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

int main() {
    char str[100+1];
    int len;
    scanf("%s", str);
    len = strlen(str);
    for (int i=0; i<len; ++i) {
        if (str[i] == '\0')
            break;

        if (i%2 == 0) {
            if (str[i]=='L') {
                puts("No");
                return 0;
            }
        }

        else {
            if (str[i]=='R') {
                puts("No");
                return 0;
            }
        }
    }

    puts("Yes");
    return 0;
}


Measured memory_bytes: 128
{-# LANGUAGE BangPatterns #-}
module Main where

import qualified Data.Array as A
import qualified Data.IntSet as S
import Data.Bool

main :: IO ()
main = do
  { n:as <- map read . words <$> getContents
  ; print $ solve $! A.listArray (1, n) as
  }

{- |
>>> solve $ A.listArray (1,3) [3,1,2]
2
-}
solve :: A.Array Int Int -> Int
solve bs = iter S.empty 1 1
  where
    iter s b c = bool (bool (iter (S.insert b s) b' (succ c)) c  (b' == 2)) (-1) (S.member b s)
      where
        b' = bs A.! b

readLineInputs :: Read a => IO [a]
readLineInputs = map read . words <$> getLine


Measured memory_bytes: 33020
#include <iostream>
#include <algorithm>
#include <vector>
#include <cmath>

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

typedef long long ll;

using namespace std;

int main()
{
    int N, K;
    cin >> N >> K;
    
    int count = 0;

    REP(i, N)
    {
        int h;
        cin >> h;
        if(h >= K) count++;
    }

    cout << count << endl;

    return 0;
}

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

int main() {
  ll N, K;
  string S;
  cin >> N >> K >> S;

  ll t = 0;
  for (ll i = 0; i < K; i++) {
    for (ll j = t; j < N; j++) {
      if (S[0] != S[j] && S[j] == S[j+1]) {
        S[j] = S[0];
      }
      else if (S[0] != S[j]) {
        S[j] = S[0];
        t = j+1;
        break;
      }
      else {
        t = j+1;
      }
    }
  }
  
  ll ans = 0;
  for (ll i = 0; i < N; i++) {
    if (i != 0 && S[i] == 'L' && S[i-1] == 'L') {
      ans++;
    }
    if (i != N-1 && S[i] == 'R' && S[i+1] == 'R') {
      ans++;
    }
  }
  cout << ans << endl;
}


Measured memory_bytes: 512
///#pragma GCC optimize("Ofast,unroll-loops,no-stack-protector,fast-math")
///#pragma GCC target("sse,sse2,sse3,ssse3,sse4,abm,mmx,popcnt,avx,avx2,tune=native")

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

/*
    zet:
        find_by_order(k): k-stat [k > 0]
        order_of_key(k) : {el < k}

    gp_hash_table<key, val, custom_hash>

    rope<T>:
        iterators: mutable_begin, ..
        methods  : erase, insert, substr, ..
*/

#define all(x) (x).begin(), (x).end()
#define size(x) (int)((x).size())
#define em_back emplace_back

using namespace std;
using namespace __gnu_cxx;
using namespace __gnu_pbds;

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

template<typename T>
using zet = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

struct custom_hash {
    static uint64_t splitmix64(uint64_t x) {
        // http://xorshift.di.unimi.it/splitmix64.c
        x += 0x9e3779b97f4a7c15;
        x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
        x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
        return x ^ (x >> 31);
    }

    size_t operator()(uint64_t x) const {
        static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
        return splitmix64(x + FIXED_RANDOM);
    }
};

mt19937 eng(chrono::steady_clock::now().time_since_epoch().count());

const int N = 504;
const int INF = 1e9;

int n, ans = INF;
int s[N][N];

void calc() {
    int res = 0, add = 0;
    for (int j = 0; j < n; ++j) {
        int cnt1 = 0;
        for (int i = 0; i < n; ++i) {
            cnt1 += s[i][j];
            res += s[i][j];
        }
        add += (cnt1 != n);
    }

    if (res == 0) {
        return;
    }
    for (int i = 0; i < n; ++i) {
        int cnt0 = n - accumulate(s[i], s[i] + n, 0);
        for (int j = 0; j < n; ++j) {
            if (s[j][i]) {
                ans = min(ans, cnt0 + add);
                break;
            } else if (j == n - 1) {
                ans = min(ans, cnt0 + add + 1);
            }
        }
    }
}

void solve() {
    cin >> n;
    for (int i = 0; i < n; ++i) {
        string sq;
        cin >> sq;
        for (int j = 0; j < n; ++j) {
            s[i][j] = (sq[j] == '#');
        }
    }

    calc();

    if (ans == INF) {
        cout << "-1\n";
    } else {
        cout << ans << "\n";
    }
}

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

    int z = 1;
    /// cin >> z;

    while (z--) {
        solve();
    }

    return 0;
}


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

int N;
string S[55];
int cnt[55];

int check( const string &s, int cnt, char c){
  for( int i=cnt; i<s.size();i++)
    if( s[i] == c ) return i;
  return -1;
}

bool check( char c ) {
  for(int i=0;i<N;i++){
    if( check( S[i], cnt[i], c ) == -1 ) return false;
  }
  return true;
}

int main(){
  cin >> N;
  for(int i=0;i<N;i++) {
    cin >> S[i];
    sort( S[i].begin(), S[i].end() );
  }

  string res = "";
  sort( S, S+N );
  for(int i=0;i<S[0].size();i++) {
    char c = S[0][i];
    if( check( c ) ) {
      for(int j=0;j<N;j++){
        cnt[j] = check( S[j], cnt[j], c )+1;
      }
      res += c;
    }
  }
  cout << res << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <queue>
#include <set>
#include <map>
#include <functional>
#include <numeric>
#include <limits>
#include <cmath>
#include <iomanip>
 
#define ALL(a)  (a).begin(),(a).end()
 
using namespace std;
typedef long long int ll;
typedef pair <int,int> P;
 
int main() {
    ll n, m;

    cin >> n >> m;

    (m >= n) ? (cout << "Yes" << endl) : (cout << "No" << endl);

    return 0;
}

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

int main () {
    
    int H, W;
    
    while (1) {
        cin >> H >> W ;
        if ( H == 0 && W == 0 ) break;
        
        for (int i = 0 ; i < H ; i++) {
            for (int j = 0; j < W; j++) {
                if ( ( i % 2 == 0 && j % 2 == 0 ) || ( i % 2 != 0 && j % 2 != 0)  ) {
                    cout << "#" ;
                } else {
                    cout << "." ;
                }
            }
            cout << endl;
        }
        cout << endl;

    }
    
    return 0;
}


Measured memory_bytes: 3088