akhauriyash/Code-Regression huggingface dataset:
//
// Created by watemus on 01.05.2020.
//

#ifdef LOCAL
#define _GLIBCXX_DEBUG
#endif
#include <bits/stdc++.h>

using namespace std;

#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define ff first
#define ss second

using ll = long long;
using ld = long double;
#define int ll

constexpr ll INFL = 1'000'000'000'000'000'228;
constexpr int INFI = 1'000'000'228;

#ifdef LOCAL
#else
#endif

const int MAX = 55;

void run() {
    int n, m, S;
    cin >> n >> m >> S;
    S = min(S, m * MAX - 1);
    vector<vector<pair<int, int>>> g(n * m * MAX);
    vector<vector<int>> c(n, vector<int>(m * MAX));
    vector<pair<int, int>> rc(n * m * MAX);
    int cnt = 0;
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < m * MAX; j++) {
            c[i][j] = cnt;
            rc[cnt] = {i, j};
            cnt++;
        }
    }
    for (int i = 0; i < m; i++) {
        int u, v, cost, tm;
        cin >> u >> v >> cost >> tm;
        u--; v--;
        for (int j = cost; j < m * MAX; j++) {
            g[c[u][j]].emplace_back(c[v][j - cost], tm);
            g[c[v][j]].emplace_back(c[u][j - cost], tm);
        }
    }
    for (int i = 0; i < n; i++) {
        int cs, tm;
        cin >> cs >> tm;
        for (int j = 0; j + cs < m * MAX; ++j) {
            g[c[i][j]].emplace_back(c[i][j + cs], tm);
        }
    }
    set<pair<int, int>> st;
    vector<int> usd(n * m * MAX, INFL), u(n * m * MAX);
    vector<int> dist(n, INFL);
    usd[S] = 0;
    st.emplace(0, S);
    while (st.size()) {
        auto [dst, v] = *st.begin();
        st.erase(st.begin());
        if (u[v]) continue;
        u[v] =1;
        dist[rc[v].first] = min(dist[rc[v].first], dst);
        for (auto [u, cst] : g[v]) {
            if (usd[u] > dst + cst) {
                st.emplace(dst + cst, u);
                usd[u] = dst + cst;
            }
        }
    }
    for (int i = 1; i < n; i++) {
        cout << dist[i] << '\n';
    }
}

signed main() {
#ifdef LOCAL
    std::freopen("input.txt", "r", stdin);
#else
    std::ios_base::sync_with_stdio(false);
    std::cin.tie(nullptr);
#endif
    int t = 1;
//    cin >> t;
    while (t--) {
        run();
    }
    return 0;
}

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

#define ll long long
#define Fi first
#define Se second
#define Pb push_back
#define vi vector<int>
#define vp vector<pair<int,int>>
#define vvi vector<vector<int>>
#define vvp vector<vector<pair<int,int>>>

const int INF = 1e9;
const int MOD = 1e9+7;

#define all(v) v.begin(),v.end()
#define output_s(a) printf("%s\n",(a).c_str())

#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define Rep(i,n,m) for(int i=(int)(n);i<(int)(m);i++)
#define RepS(i,n,m) for(int i=(int)(n);i<=(int)(m);i++)
#define RRepS(i,n,m) for(int i=(int)(n);i>=(int)(m);i--)
#define RepA(x) for(auto &item:(x))

void CINT(){}
template <class Head,class... Tail>
void CINT(Head&& head,Tail&&... tail){
    cin>>head;
    CINT(move(tail)...);
}    
#define CIN(...) int __VA_ARGS__;CINT(__VA_ARGS__)
#define LCIN(...) ll __VA_ARGS__;CINT(__VA_ARGS__)
#define SCIN(...) string __VA_ARGS__;CINT(__VA_ARGS__)

template<typename TypeInt> //最大公約数
TypeInt GCD(TypeInt a,TypeInt b){
    if(a%b==0) return b;
    else return GCD(b,a%b);
}
template<typename TypeInt> //最小公倍数
TypeInt LCM(TypeInt a,TypeInt b){
    return a*b/GCD(a,b);
}

//library----------------------------------------------


int main(){
    CIN(N);
    vp p;
    int a;
    rep(i,N){
        scanf("%d",&a);
        p.push_back(make_pair(a,i+1));
    }
    sort(all(p));
    rep(i,N){
        printf("%d ",p[i].Se);
    }
    printf("\n");

    return 0;
}

Measured memory_bytes: 1780
#include<iostream>
#include<vector>
#include<algorithm>
#include<tuple>
#include<utility>
#include<queue>
#include<cmath>

using namespace std;

typedef long long int64;

int main(void){
    char c;
    cin>>c;
    if('a'<=c && c<='z'){
        cout<<'a'<<endl;
        return 0;
    }
    if('A'<=c && c<='Z'){
        cout<<'A'<<endl;
        return 0;
    }
    return 0;
}

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

#define int long long
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define rep(i, n) for (int i = 0; i < n; ++i)
#define REP(i, n) for (int i = 0; i < n; ++i)
#define range(i,a,b) ((a)<=(i) && (i)<(b))
#define debug(x) cout << #x << " = " << (x) << endl;
#define fs first
#define sc second
#define pb push_back
#define eb emplace_back
#define SP << " " <<

typedef long long ll;
typedef pair<ll, ll> P;
typedef tuple<ll, ll, ll> T;
typedef vector<ll> vec;
typedef vector<P> pvec;
typedef vector<vector<ll>> vvec;
typedef vector<vector<P>> pvvec;
typedef priority_queue<ll> PQI;
typedef priority_queue<P> PQP;
typedef priority_queue<ll,vector<ll>,greater<ll>> PQIG;
typedef priority_queue<P,vector<P>,greater<P>> PQPG;

const vector<int> dx = {0, -1, 0, 1, 1, 1, -1, -1};
const vector<int> dy = {1, 0, -1, 0, 1, -1, 1, -1};
constexpr int MOD = (1000000007);
// const int MOD = (998244353);
// const int INF = (1 << 30); // 1073741824
const int INF = (1LL << 60); // 1152921504606846976
const double EPS = (1 >> 30);

template<class T> inline bool chmin(T& a, T b) {if (a > b) {a = b; return 1;} return 0;}
template<class T> inline bool chmax(T& a, T b) {if (a < b) {a = b; return 1;} return 0;}
template<class T> inline T ceil(T a, T b) {return T((a + b - 1)/b);}
template< typename T1, typename T2 > istream &operator>>(istream &is, pair< T1, T2 > &p) { is >> p.first >> p.second; return is; }

int nmax=200000; // 2*(10^5)
vvec g(nmax);

vec c(nmax,-1);

int n,m;
int gg=0,f=0;
int ans=0;
bool fl=false;
void dfs(int v,int p,int cl){
    if(c[v]==-1){
        c[v]=cl;
        if(cl==0) gg++;
        else f++;
        for(int next:g[v]){
            dfs(next,v,(cl+1)%2);
        }
    }
    else{
        if(c[v]!=cl){
        if(!fl){
            fl=true;
        }
        }
    }
}

signed main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << fixed << setprecision(15);
    //---------------------------------------------
    
    cin>>n>>m;
    rep(i,m){
        int a,b;
        cin>>a>>b;
        a--;b--;
        g[a].pb(b);
        g[b].pb(a);
    }
    dfs(0,-1,0);
    if(fl) cout<<n*(n-1)/2-m<<endl;
    else cout<<gg*f-m<<endl;
}

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

using namespace std;

using ll = long long;

int main() {
    int a, b, c, d;
    cin >> a >> b >> c >> d;

    while (true) {
        c -= b;
        if (c <= 0){
            cout << "Yes" << endl;
            return 0;
        }

        a -= d;

        if (a <= 0) {
            cout << "No" << endl;
            return 0;
        }
    }
    return 0;
}

Measured memory_bytes: 3652
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <stack>
#include <queue>
#include <cctype>
#include <cmath>
#include <map>
#include <set>
#define rep(i, m, n) for(int i = m;i < n;i++)
#define repr(i, n) for(int i = n;i >= 0;i--)
#define ll long long
#define ull unsigned long long
#define push(a) push_back(a)
#define pop(a) pop_back(a)
#define debug(x) cout<<#x<<": "<<x<<endl
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define INF 999999999
using namespace std;
typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef pair<int, P> PP;
typedef pair<ll, LP> LPP;

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

int main(){
  ll a,b,x,ans=0;
  cin>>a>>b>>x;
  if(a==0){
    ans=b/x+1;
  }else{
    ans=b/x-(a-1)/x;
  }
  cout<<ans<<endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define FOR(var, begin, end) for (int var = (begin); var <= (end); var++)
#define RFOR(var, begin, end) for (int var = (begin); var >= (end); var--)
#define REP(var, length) FOR(var, 0, length - 1)
#define RREP(var, length) RFOR(var, length - 1, 0)
#define EACH(value, var) for (auto value : var)
#define SORT(var) sort(var.begin(), var.end())
#define REVERSE(var) reverse(var.begin(), var.end())
#define RSORT(var) SORT(var); REVERSE(var)
#define OPTIMIZE_STDIO ios::sync_with_stdio(false);cin.tie(0);cout.precision(10);cout << fixed
#define endl '\n'

const ll MOD = 1e9 + 7;
struct mint {
    ll x;
    mint() : x(0) {}
    mint(ll x) : x((x % MOD + MOD) % MOD) {}
    mint& operator+=(const mint& r) { if ((x += r.x) >= MOD) { x -= MOD; } return *this; }
    mint& operator-=(const mint& r) { if ((x -= r.x) < 0) { x += MOD; } return *this; }
    mint& operator*=(const mint& r) { if ((x *= r.x) > MOD) { x %= MOD; } return *this; }
    mint& operator++() { if ((++x) >= MOD) { x -= MOD; } return *this; }
    mint operator++(int) { mint ret = x; if ((++x) >= MOD) { x-= MOD; } return ret; }
    mint& operator--() { if ((--x) < 0) { x += MOD; } return *this; }
    mint operator--(int) { mint ret = x; if ((--x) < 0) { x += MOD; } return ret; }
    mint operator+(const mint& r) { mint ret; return ret = x + r.x; }
    mint operator-(const mint& r) { mint ret; return ret = x - r.x; }
    mint operator*(const mint& r) { mint ret; return ret = x * r.x; }
    mint operator-() { return mint() - *this; }
    bool operator<(const mint& a) { return x < a.x; }
    bool operator>(const mint& a) { return x > a.x; }
    bool operator<=(const mint& a) { return x <= a.x; }
    bool operator>=(const mint& a) { return x >= a.x; }
    bool operator==(const mint& a) { return x == a.x; }
    bool operator!=(const mint& a) { return x != a.x; }
};
ostream& operator<<(ostream& os, const mint& r) { os << r.x; return os; }
ostream& operator>>(ostream& os, const mint& r) { os >> r.x; return os; }

struct p {
    p(ll a, ll f) : a(a), f(f), af(a * f){}
    ll a;
    ll f;
    ll af;
    void dec() {
      if (a > 0) {
        a--;
        af -= f;
      }
    }
    bool operator<( const p& right ) const {
      return af < right.af;
    }
    bool operator==( const p& right ) const {
      return af == right.af;
    }
};

vector<ll> a;
vector<ll> f;
int n;
ll k;

bool isOK(ll mid) {
  ll lk = k;
  REP(i, n) {
    lk -= max((a[i] * f[i] - mid + f[i] - 1) / f[i], (ll) 0);
  }
  return lk >= 0;
}

void solve(istream& cin, ostream& cout) {
  cin >> n >> k;
  a = vector<ll>(n);
  f = vector<ll>(n);
  REP(i, n) {
    cin >> a[i];
  }
  REP(i, n) {
    cin >> f[i];
  }
  SORT(a);
  RSORT(f);
  ll ng = -1, ok = 1e12;
  while (ok - ng > 1) {
    ll mid = (ok + ng) / 2;
    if (isOK(mid)) {
      ok = mid;
    } else {
      ng = mid;
    }
  }
  cout << ok << endl;
}

#ifndef TEST
int main() {
  OPTIMIZE_STDIO;
  solve(cin, cout);
}
#endif


Measured memory_bytes: 3328
#include <bits/stdc++.h>
#define double long double
#define int long long
#define mii map<int,int>
#define pii pair<int,int>
#define low lower_bound
#define upp upper_bound
#define mod 1000000007 //10^9+7
#define inf (int)50000000000 //5･10^10
#define rep(i,n) for(int i=0;i<n;i++)
#define all(vec) vec.begin(),vec.end()
#define vsort(vec) sort(all(vec))
#define vrever(vec) reverse(all(vec));
#define vunsort(vec) vsort(vec); vrever(vec);
#define bisea binary_search
#define cend cout<<endl;
#define F first
#define S second
using namespace std;
int mypow(int x,int n) {
  if(n==0) return 1;
  if(n%2) return x*mypow(x,n-1);
  return mypow(x*x,n/2);
}
signed main() {
  string s;
  cin>>s;
  int n=mypow(2,s.size()-1),sum=0,w=0;
  rep(i,n) {
    rep(j,s.size()-1) {
      if(i&(1<<j)) {
        sum+=stoll(s.substr(w,j+1-w));
        w=j+1;
      }
    }
    sum+=stoll(s.substr(w,s.size()-w));
    w=0;
  }
  cout<<sum<<endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <cstdlib>
#include <cmath>
#include <vector>
#include <map>
#include <set>
#include <algorithm>
#include <queue>
#include <stack>
#include <functional>
#include <bitset>
#include <assert.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<char> vc;
typedef vector<string> vs;
typedef vector<bool> vb;
typedef vector<double> vd;
typedef pair<ll,ll> P;
typedef vector<P> vpl;
typedef tuple<ll,ll,ll> tapu;
#define rep(i,n) for(ll i=0; i<(n); i++)
#define REP(i,a,b) for(int i=(a); i<(b); i++)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
const int inf = 1<<30;
const ll linf = 1LL<<62;
const int MAX = 510000;
ll dy[8] = {1,-1,0,0,1,-1,1,-1};
ll dx[8] = {0,0,1,-1,1,-1,-1,1};
const double pi = acos(-1);
const double eps = 1e-7;
template<typename T1,typename T2> inline bool chmin(T1 &a,T2 b){
	if(a>b){
		a = b; return true;
	}
	else return false;
}
template<typename T1,typename T2> inline bool chmax(T1 &a,T2 b){
	if(a<b){
		a = b; return true;
	}
	else return false;
}
template<typename T> inline void print(T &a){
    rep(i,a.size()) cout << a[i] << " ";
    cout << "\n";
}
template<typename T1,typename T2> inline void print2(T1 a, T2 b){cout << a << " " << b << "\n";}
template<typename T1,typename T2,typename T3> inline void print3(T1 a, T2 b, T3 c){
	cout << a << " " << b << " " << c << "\n";
}
const int mod = 1e9 + 7;
//const int mod = 998244353;

int main(){
    ll n; cin >> n;
    ll ans = 0;
    while(n > 1){
        ans++;
        if(n % 3 == 0) n /= 3;
        else n = n / 3 + 1;
    }
    cout << ans << endl;
}


Measured memory_bytes: 3100
#include <bits/stdc++.h>
#define rep(i,l,n) for(int i=l;i<n;i++)
#define rer(i,l,n) for(int i=l;i<=n;i++)
#define all(a) a.begin(),a.end()
#define o(a) cout<<a<<endl
#define fi first
#define se second
using namespace std;
typedef long long ll;
typedef vector<int> vint;
typedef pair<int,int> pii;

int main(){
	int d,c;
	cin>>d>>c;
	o(d*c);
}

Measured memory_bytes: 1164
#include <bits/stdc++.h>
using namespace std;
int n;
char s[305][305];
int ans = 0;
bool chk(int x)
{
	for (int i = 0; i < n; i++)
		for (int j = 0; j < n; j++)
			if (s[(i + x) % n][j] != s[(j + x) % n][i])
				return false;
	return true;
}
int main()
{
#ifdef _noname
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
	scanf("%d", &n);
	for (int i = 0; i < n; i++) scanf("%s", s[i]);
	for (int i = 0; i < n; i++)
		if (chk(i))
			ans++;
	printf("%d\n", ans * n);
	return 0;
}

Measured memory_bytes: 384
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		sc.nextLine();
		List<Integer> mochi = new ArrayList<Integer>();
		while (sc.hasNextLine()) {
			mochi.add(Integer.valueOf(sc.nextLine()));
		}
		Long result=mochi.stream().distinct().count();
		System.out.println(result);
	}
}

Measured memory_bytes: 26704
#include <bits/stdc++.h>
using namespace std;
template<class t> inline t read(t &x){
	x=0;char c=getchar();bool f=0;
	while(!isdigit(c)) f|=c=='-',c=getchar();
	while(isdigit(c)) x=(x<<1)+(x<<3)+(c^48),c=getchar();
	if(f) x=-x;return  x;
}
template<class t> inline void write(t x){
	if(x<0){putchar('-'),write(-x);}
	else{if(x>9)write(x/10);putchar('0'+x%10);}
}

signed main(){
	int x;
	read(x);read(x);read(x);read(x);write(x==1);
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
 
#define rep(i,n) for(int i=0;i<(n);i++)
#define reps(i,n) for(int i=1;i<=(n);i++)
#define lol long long
#define SUM(n) ((n)+1)*(n)/2 //1〜nまでの総和を求める式
#define mp make_pair
#define fi first
#define se second
#define pu push_back
#define SYOU(x) fixed<<setprecision(x+1) //小数点桁数を指定する
#define abs(x,y) max(x,y)-min(x,y)
#define all(v) v.begin(),v.end()
#define UPDight(a,b) (a+b-1)/b //小数点切り上げ 
const int INF = 0x3f3f3f3f;
const long long LINF = 0x3f3f3f3f3f3f3f3fLL;
const int MOD=int(1e9)+7; 
using namespace std;
using pii = pair<int, int>;
typedef vector<int> vit;

//最大公約数
lol gcd(lol x, lol y){
  if(x < y) swap(x, y);
  lol r = x % y;
  while(r != 0){
    x = y;
    y = r;
    r = x % y;
  }
  return y;
}

//最小公倍数
lol lcm(lol x, lol y){
  lol a = x * y;
  return (a / gcd(x, y));
}

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

  string s, t;
  cin >> s >> t;
  rep(i, s.size()){
    if(s[i] != t[i]){
      cout << "No\n";
      return 0;
    }
  }
  cout << "Yes\n";
  return 0;
}


Measured memory_bytes: 3652
import sys
sys.setrecursionlimit(100000)

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

def kaijo(n):
    if n == 1:
        return 1
    return n * kaijo(n - 1) % ((10 ** 9) + 7)


if abs(n - m) > 1:
    print(0)
    exit()
a = kaijo(n)
b = kaijo(m)

if n == m:
    print((a * b * 2) % ((10 ** 9) + 7))
else:
    print((a * b ) % ((10 ** 9) + 7))





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


int main() {

    int n;
    cin >> n;
    vector<tuple<string, int, int>> a;
    for (int i = 1; i < n + 1; ++i) {
        string s;
        int p;
        cin >> s >> p;
        p = -p;
        a.push_back(tie(s,p,i));
    }
    sort(a.begin(), a.end());
    rep(i,n) cout << get<2>(a[i]) << endl;;
    return 0;
}

Measured memory_bytes: 256
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.BufferedReader;
import java.io.InputStreamReader;


class Main{
    public static void main(String[] args) {
        InputReader in = new InputReader(System.in);
        PrintWriter out = new PrintWriter(System.out);

        int N = in.nextInt();
        int M = in.nextInt();
        int[] arr = new int[M];
        int sum = 0;
        for (int i = 0; i < M; i++) {
            //arr[i] = in.nextInt();
            sum = sum + in.nextInt();
        }

        System.out.println((sum <= N )?((N-sum)):(-1));


    }

    static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

    }
}


Measured memory_bytes: 33888
#include<string>
#include<vector>
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cstdlib>
#include<sstream>
#include<functional>
#include<map>
#include<set>
#include<cmath>
#include<iomanip>

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

using namespace std;

int main(){

	int a,b,c,d;

	cin >> a >> b >> c >> d;

	cout << (a+b+c+d)/60 << endl;
	cout << (a+b+c+d)%60 << endl;

	return 0;
}

Measured memory_bytes: 1160
#include<bits/stdc++.h>
using namespace std;
main()
{
    string a;
    cin>>a;
    int i,as=0,b=0;
    for(i=0;i<3;i++){
        if(a[i]=='A') as++;
        else b++;
    }
    if(as!=3&&b!=3) cout<<"Yes\n";
    else cout<<"No\n";
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define be(v) (v).begin(),(v).end()
#define pb(q) push_back(q)
typedef long long ll;
using namespace std;
const ll mod=1000000007;
#define doublecout(a) cout<<fixed<<setprecision(10)<<a<<endl;

int main() {
    cin.tie(0);
    cout.tie(0);
    ios::sync_with_stdio(false);
    ll n,a;
    cin >>n;
    multiset<ll> ms;
    for(int i=0;i<n;i++){
        cin>>a;
        auto itr=ms.lower_bound(a);
        if(itr!=ms.begin()){
            itr--;
            ms.erase(itr);
        }
        ms.insert(a);
    }
    cout << (ms.size()) <<endl;
    return 0;
}


Measured memory_bytes: 4992
#include<stdio.h>

int main(){
    int hill[10],i,j,temp;

    for(i=0;i<10;i++){
        scanf("%d",&hill[i]);
    }

    for(i=0;i<10;i++){
        for(j=i;j<10;j++){
            if(hill[i]<hill[j]){
            temp=hill[i];
            hill[i]=hill[j];
            hill[j]=temp;
            }
        }
    }

    printf("%d\n%d\n%d\n",hill[0],hill[1],hill[2]);

    return 0;
}

Measured memory_bytes: 1808
#include <bits/stdc++.h>
#define l_ength size
const int inf = (1<<30);
const int mod = 1000000007;
using ll = long long;
using namespace std;

int main(){
	int n; cin >> n;
	vector<int> d(n);
	for( auto &k : d ) cin >> k;
	sort( d.begin(), d.end() );
	int cnt = 0;
	for( int k = 1; k <= 100000; ++k ){
		int a = d.end() - lower_bound( d.begin(), d.end(), k );
		if( a*2 == n ) ++cnt;
	}
	cout << cnt << endl;
	return 0;
}

Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i=0, i##_len=(n); i<i##_len; ++i)
typedef long long ll;
#define pb push_back
void Yes() {cout << "Yes" << endl;}
void No() {cout << "No" << endl;}
void YES() {cout << "YES" << endl;}
void NO() {cout << "NO" << endl;}

const ll  MOD = 1000000007;

ll modfact(ll n){
    if(n==1) return 1;
    else return n*modfact(n-1)%MOD;
}

void solve(){
    ll n, m; cin >> n >> m;
    if(n == m) cout << (2*modfact(n)%MOD)*modfact(m)%MOD << endl;
    else if(n == m+1 || m == n+1) cout << modfact(n)*modfact(m)%MOD << endl;
    else cout << 0 << endl;
}

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

Measured memory_bytes: 1792
//      https://www.youtube.com/watch?v=RBtlPT23PTM

#include<bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef long double ld;
typedef long long unsigned llu;
typedef pair<long long, long long> pll;
const long long inf = 2000000000000000000LL;    // 2e18
#define pi                  acos(-1.0)
#define fast                ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define nl                  "\n"
#define ff                  first
#define ss                  second
#define pb                  push_back
#define pf                  push_front
#define all(x)              x.begin(),x.end()
#define debug(x)            cout<<"debug "<<x<<"\n"

int main()
{
    fast;
    ll t,i,j,k,l,m,n,o,p,q,temp,ans=0,flag=0,mod=1000000007,zero=0;
    cin>>n;
    for(i=0;i<n-1;i++){
        cin>>j>>k;
        if(j>k) swap(j,k);
        ans-=(j*(n-k+1));
    }
    for(i=1;i<=n;i++){
        ans+=(i*(n-i+1));
    }
    cout<<ans;
}


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

typedef long long ll;

#define optimize() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define file() freopen("input.txt","r",stdin);freopen("output.txt","w",stdout);
#define tt int t; cin>>t; while(t--)
#define nl cout<<"\n";
#define sp cout<<" ";
#define rep(i, a, b) for(long long i=a; i<b; i++)

const int INF = 1e9 + 7;
const int MOD = 1e9 + 7;
double PI = 4*atan(1);

int main()
{
    optimize();

    string s;
    cin>> s;


    int mn= 1000;

    for(int i=0; i<s.size()-2; i++)
       mn= min (mn, abs(753-(  ((s[i]- '0') *100 )+((s[i+1]- '0')* 10 )+ ((s[i+2]- '0')) ) ) );


    cout << mn;
    nl;


    return 0;
}



Measured memory_bytes: 3636
#include<math.h>
#include<map>
#include<iostream>
#include <algorithm>
#include <string>
#include<vector>
#include<array>
#include<tuple>
#include<queue>
#include<stack>
#include<iomanip>
#include<bitset>
#include <list>
//AtCoderC++.cpp

using namespace std;


inline int ceileing(int a, int b) {
	return a % b == 0 ? a / b : a / b + 1;
}
int main() {
	int N; cin >> N;
	auto ps = vector<int>(N);
	for (size_t i = 0; i < N; i++) cin >> ps[i];
	auto answer = 0;
	for (size_t i = 0; i < N; i++) {
		if (ps[i] == i + 1) {
			swap(ps[i], i==N-1?ps[i-1]:ps[i + 1]);
			++answer;
		}
	}
	cout << answer << endl;
}

Measured memory_bytes: 640
#include<bits/stdc++.h>
#define ll long long
#define fast ios_base::sync_with_stdio(0);cin.tie(NULL)
using namespace std;
int main()
{
    fast;
    int a,b;
    cin>>a>>b;
    if(b==1)
        cout<<"0"<<endl;
    else
        printf("%d\n",a-b);
    return 0;
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
const int maxn=6e2+10;
const int mod=1e9+7;
int c[maxn][maxn],dp[maxn][maxn],tmp[maxn],g[maxn];
int main() {
    int n,K,a,b; scanf("%d%d",&n,&K);
    for(int i=1;i<=K;i++) {
        scanf("%d%d",&a,&b);
        g[a]=b,g[b]=a;
    } n<<=1;
    for(int i=1;i<=n;i++) for(int j=i;j<=n;j++) c[i][j]=c[i][j-1]+(g[j]==0);
    tmp[0]=1;
    for(int i=2;i<=n;i+=2) tmp[i]=1ll*tmp[i-2]*(i-1)%mod;
    for(int i=1;i<=n;i++) {
        for(int j=i;j<=n;j++) {
            bool flag=0;
            for(int k=i;k<=j;k++) {
                flag|=(g[k]&&(g[k]<i||g[k]>j));
                if (flag) break;
            }
            if (flag) continue;
            dp[i][j]=tmp[c[i][j]];
            for(int k=i+1;k<=j-1;k++) {
                (dp[i][j]+=mod-1ll*dp[i][k]*tmp[c[k+1][j]]%mod)%=mod;
            }
        }
    } ll ret=0;
    for(int i=1;i<=n;i++) {
        for(int j=i;j<=n;j++) {
            (ret+=1ll*dp[i][j]*tmp[n-2*K-c[i][j]]%mod)%=mod;
        }
    }
    printf("%lld\n",ret);
    return 0;
}


Measured memory_bytes: 3072
A=[[],[],[]]
for i in range(3):
  A[i]=[int(_) for _ in input().split()]  
N=int(input())
b=[]
for i in range(N):
  b.append(int(input()))
import sys
for i in range(3):
  if (A[i][0] in b) and (A[i][1] in b) and (A[i][2] in b):
    print('Yes')
    sys.exit()
for i in range(3):
  if (A[0][i] in b) and (A[1][i] in b) and (A[2][i] in b):
    print('Yes')
    sys.exit()

if (A[0][0] in b) and (A[1][1] in b) and (A[2][2]in b) or \
      (A[2][0] in b) and (A[1][1] in b) and (A[2][0]in b):
  print('Yes')
  sys.exit()
print('No')
    

Measured memory_bytes: 3064
import java.io.*;
class Main
{
    public static void main(String args[])throws IOException
    {
	BufferedReader input=new BufferedReader(new InputStreamReader(System.in));
	String str;
	int a[]=new int[3];
	a[0]=1;
	String ans=null;
	while((str=input.readLine())!=null)
	    {
		int x=0,y=0;
		String str_ary[]=str.split(",");
		if(str_ary[0].equals("A"))x=0;
		if(str_ary[0].equals("B"))x=1;
		if(str_ary[0].equals("C"))x=2;
		if(str_ary[1].equals("A"))y=0;
		if(str_ary[1].equals("B"))y=1;
		if(str_ary[1].equals("C"))y=2;
		if(a[x]==1 || a[y]==1)
		    {
			int tmp=a[x];
			a[x]=a[y];
			a[y]=tmp;
		    }
		for(int i=0;i<3;i++)
		    {
			if(a[0]==1)ans="A";
			if(a[1]==1)ans="B";
			if(a[2]==1)ans="C";
		    }
		
	    }
	System.out.println(ans);
    }
}

Measured memory_bytes: 16912
use std::cmp::*;
use std::io::*;

fn main() {
    let mut s: String = String::new();
    std::io::stdin().read_to_string(&mut s).ok();
    let mut itr = s.trim().split_whitespace();
    let n: usize = itr.next().unwrap().parse().unwrap();
    let mut a: Vec<usize> = (0..5)
        .map(|_| itr.next().unwrap().parse().unwrap())
        .collect();

    a.sort();
    println!("{}", 5 + (n + a[0] - 1) / a[0] - 1);
}


Measured memory_bytes: 2100
N = int(input())
S = []
ans = 0

for i in range(N):
    S.append(str(input()))

S = list(set(S))
# print(S)
name = [0 for i in range(5)]

for j in range(len(S)):
    t = str(S[j])
    if t[0] == "M":
        name[0] += 1
    elif t[0] == "A":
        name[1] += 1
    elif t[0] == "R":
        name[2] += 1
    elif t[0] == "C":
        name[3] += 1
    elif t[0] == "H":
        name[4] += 1
# print(name)

for x in range(5):
    for y in range(5):
        if x == y:
            break
        for z in range(5):
            if x == z or y == z:
                break
            if name[x]*name[y]*name[z] > 0:
                ans += name[x]*name[y]*name[z]

print(ans)

Measured memory_bytes: 22260
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define FOR(i, s, e) for (int i = (int)(s); i <= (int)(e); i++)
#define printYesNo(is_ok) puts(is_ok ? "Yes" : "No");
#define SORT(v) sort(v.begin(), v.end());
#define RSORT(v) sort(v.rbegin(), v.rend());
#define REVERSE(v) reverse(v.begin(), v.end());

template <typename T>
void printlnVector(T v)
{
  rep(i, v.size())
  {
    cout << v[i] << endl;
  }
}

template <typename T>
void printVector(T v)
{
  rep(i, v.size())
  {
    cout << v[i] << " ";
  }
  cout << endl;
}

int main()
{
  int N, M;
  cin >> N >> M;
  int ans = N * (N - 1) + M * (M - 1);
  cout << ans / 2 << endl;
  return 0;
}

Measured memory_bytes: 256
#include<algorithm>
#include<cmath>
#include<cstdio>
#include<iostream>
#include<map>
#include<numeric>
#include<queue>
#include<sstream>
#include<stack>
#include<string>
#include<unordered_set>
#include<vector>

#define ll long long
#define P pair<int,int>
#define FOR(i,N) for(int i=0;i<(int)N;i++)
#define FORIN(i,a,b) for(int i=a;i<(int)b;i++)
#define ALL(x) (x).begin(),(x).end()
#define LAST(x) (x)[(x).size()-1]
#define GI(name) int (name);scanf("%d",&(name))
#define GI2(name1,name2) int (name1),(name2);scanf("%d %d",&(name1),&(name2))
#define GI3(name1,name2,name3) int (name1),(name2),(name3);scanf("%d %d %d",&(name1),&(name2),&(name3))
#define GVI(name,size) vector<int> (name)(size);FOR(i,(size))scanf("%d",&(name)[i])
#define MOD 1000000007

using namespace std;

string to_hex(int x){
    stringstream ss;
    ss<<hex<<x;
    return ss.str();
}

inline int get_int(){
    int ret;
    scanf("%d",&ret);
    return ret;
}

inline vector<int> get_ints(int n){
    vector<int> ret(n);
    FOR(i,n){
        scanf("%d",&ret[i]);
    }
    return ret;
}

inline string get_str(){
    string ret;
    cin>>ret;
    return ret;
}

bool is_prime(int n){
    int s=sqrt(n)+1;
    for(int i=2;i<=s;++i){
        if(n%i==0){
            return 0;
        }
    }
    return 1;
}

vector<P> prime_division(int n){
    vector<P> ret;
    int s=sqrt(n)+1;
    int c=0;
    for(int i=2;i<=n;++i){
        if(n%i==0){
            c=0;
            do{
                ++c;
                n/=i;
            }while(n%i==0);
            ret.push_back(P(i,c));
        }
    }
    return ret;
}

struct UnionFind{
    vector<int> data;
    UnionFind(int size){
        data=vector<int>(size,-1);
    }
    bool union_set(int x,int y){
        x=root(x);
        y=root(y);
        if(x!=y){
            if(data[y]<data[x])swap(x,y);
            data[x]+=data[y];
            data[y]=x;
        }
        return x!=y;
    }
    bool find(int x,int y){
        return root(x)==root(y);
    }
    int root(int x){
        return data[x]<0?x:data[x]=root(data[x]);
    }
    int size(int x){
        return -data[root(x)];
    }
};

string to_string(string s){
    return s;
}

template<class T>
string to_string(vector<T> v){
    string ret="{";
    FOR(i,v.size()-1){
        ret+=to_string(v[i])+",";
    }
    if(v.size()>0){
        ret+=to_string(LAST(v));
    }
    ret+="}";
    return ret;
}

void debug_print(){
    cerr<<endl;
}

template<class Head,class... Tail>
void debug_print(Head head,Tail... tail){
    cerr<<to_string(head)<<" ";
    debug_print(tail...);
}

template<class... T>
void debug(T... args){
    cerr<<"["<<__LINE__<<"]: ";
    debug_print(args...);
}

void print(){
    cout<<endl;
}

template<class Head,class... Tail>
void print(Head head,Tail... tail){
    cout<<to_string(head);
    print(tail...);
}

int main(){
    GI(N);
    vector<ll> A(N);
    FOR(i,N)cin>>A[i];
    sort(ALL(A));
    vector<ll> sum(N);
    sum[0]=A[0];
    FORIN(i,1,N)sum[i]=sum[i-1]+A[i];
    int ans=1;
    for(int i=N-2;i>=0;--i){
        if(sum[i]*2<A[i+1]){
            print(N-i-1);
            return 0;
        }
    }
    print(N);
    return 0;
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
map<int,string>mp;
long long int mod=1e9+7;
long long int sum[110][5][5][5];

int check(int a,int b,int c,int d)
{
    if(mp[a]+mp[b]+mp[c]== "AGC") return 0;
    if(mp[a]+mp[b]+mp[c]== "ACG") return 0;
    if(mp[a]+mp[b]+mp[c]== "GAC") return 0;
    if(mp[a]+mp[b]+mp[d]== "AGC") return 0;
    if(mp[b]+mp[c]+mp[d]== "AGC") return 0;
    if(mp[b]+mp[c]+mp[d]== "ACG") return 0;
    if(mp[b]+mp[c]+mp[d]== "GAC") return 0;
    if(mp[a]+mp[c]+mp[d]== "AGC") return 0;
    return 1;
}
int main()
{
    mp[0]="E";
    mp[1]="A";
    mp[2]="C";
    mp[3]="T";
    mp[4]="G";
    int n;

    while(cin>>n)
    {
        memset(sum,0,sizeof(sum));
        sum[0][0][0][0]=1;
        for(int i=1;i<=n;i++)
        {
            for(int j=1;j<=4;j++)
            {
                for(int k=0;k<=4;k++)
                {
                    for(int l=0;l<=4;l++)
                    {
                        for(int s=0;s<=4;s++)
                        {
                            if(check(j,k,l,s))
                            {
                                sum[i][j][k][l]+=(sum[i-1][k][l][s])%mod;
                                sum[i][j][k][l]%=mod;
                            }

                        }

                    }
                }
            }

        }
//        cout<<"sos"<<endl;
        long long int ans=0;
        for(int i=1;i<=4;i++)
        {
            for(int j=1;j<=4;j++)
            {
                for(int k=1;k<=4;k++)
                {
                        ans+=sum[n][i][j][k]%mod;
                        ans%=mod;
                }
            }
        }
        cout<<ans<<endl;
    }
}


Measured memory_bytes: 384
M,K = map(int,input().split())

if K >= 2 ** M:
    print (-1)

elif M == 1 and K == 0:
    print ("0 0 1 1")

elif M == 1 and K == 1:
    print ("-1")

else:
    ans = []

    for i in range(2 ** M):
        if i != K:
            ans.append(i)

    ans.append(K)

    for i in range(2 ** M):
        if 2 ** M - i - 1 != K:
            ans.append(2 ** M - i - 1)

    ans.append(K)

    print (" ".join(map(str,ans)))


Measured memory_bytes: 31576
fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}

fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    read::<String>()
        .split_whitespace()
        .map(|e| e.parse().ok().unwrap())
        .collect()
}

use std::fmt::Display;

fn print_vec<T: Display>(a: &Vec<T>, n: usize) {
    for i in 0..n {
        print!("{}", a[i]);
        if i == n - 1 {
            println!("");
        } else {
            print!(" ");
        }
    }
}

fn insertion_sort<T: Ord + Clone + Display>(a: &mut Vec<T>, n: usize) {
    for i in 0..n {
        let v = a[i].clone();
        let mut j = i;
        while j > 0 && a[j - 1] > v {
            a[j] = a[j - 1].clone();
            j -= 1;
        }
        a[j] = v;

        print_vec(&a, n);
    }
}

fn main() {
    let n: usize = read();
    let mut a: Vec<i32> = read_vec();

    insertion_sort(&mut a, n);
}



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

int main(void) {
    int N;

    while (1) {
        cin >> N;
        if (!N) break;
        vector<int> C(30, 0);
        vector<char> c(N);
        for (int i = 0; i < N; i++) {
            cin >> c[i];
            C[c[i] - 'A']++;
        }
        int top = -1;
        int topIndx;
        bool flag = false;
        for (int i = 0; i < C.size(); i++) {
            if (top < C[i]) {
                top     = C[i];
                topIndx = i;
                flag    = false;
            } else if (top == C[i])
                flag = true;
        }
        if (flag) {
            cout << "TIE" << endl;
            continue;
        }
        vector<int> cmove(30, 0);
        int second = 0;
        flag       = false;
        for (int i = 0; i < N; i++) {
            cmove[c[i] - 'A']++;
            if ((c[i] - 'A') != topIndx && second < cmove[c[i] - 'A']) second = cmove[c[i] - 'A'];
            if (cmove[topIndx] > N - i + second - 1) {
                char moji = 'A' + topIndx;
                flag      = true;
                cout << moji << " " << i + 1 << endl;
                break;
            }
        }
        if (!flag) {
            char moji = 'A' + topIndx;
            cout << moji << " " << N << endl;
        }
    }
}


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

using namespace std;

int main()
{
    int a,b,cnt=0,sum=1;
    cin>>a>>b;
    while(1)
    {
        if(sum>=b)break;
        sum--;
        cnt++;
        sum+=a;
    }
cout<<cnt<<endl;
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include<cstdlib>
#include<queue>
#include<set>
#include<cstdio>

using namespace std;

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

typedef vector<int> vec;
typedef vector<vec> mat;

int main(){
    int n;
    string s;
    cin >> n >> s;
    int l = 0, r = n - 1;
    int ans = 0;
    while(l < r){
        if(s[l] == 'W' && s[r] == 'R') {
            ans++;
            l++;
            r--;
        }else if(s[l] != 'W') l++;
        else if(s[r] != 'R') r--;
    }
    cout << ans << endl;
}

Measured memory_bytes: 3692
#include <bits/stdc++.h>
#include <iostream>
#include <ctime>
using namespace std;
#define _LL long long
#define rep(i, n) for (_LL i = 0; i < (_LL)(n); i++)
#define vecrep(itr, v) for (auto itr = (v).begin(); itr != (v).end(); itr++)

int main()
{
    int n, k; cin >> n >> k;
    string s; cin >> s;
    int diff = 0;
    rep(i, n - 1)
    {
        if( s[i] != s[i + 1] ) diff++;
    }
    int ldiff = max(0, diff - 2 * k);
    cout << n - 1 - ldiff << endl;
    return 0;    
}

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

                                    typedef long long ll;
                                    typedef  double ld;
                                    #define rep(i,a,n) for(ll i=(a); i<(n); i++)
                                    #define per(i,a,n) for(ll i=(n-1); i>=(a); i--)
                                    #define F first
                                    #define S second
                                    #define maxx(a,b) a=max(a,b)
                                    #define minn(a,b) a=min(a,b)
                                    #define db(x) cerr<<#x<<" = "<<x<<endl
                                    #define N 1111111
                                    #define mod 1000000007
                                    #define rt return
                                    #define inf 12345678908761

                                    using namespace std;

                                    int main(){

                                        ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);

                                        //freopen("Ulug'bek","r",stdin);
                                        //freopen("Abdimanabov","w",stdout);

                                        int n,k; cin>>n>>k;
                                        vector<int> v(n), ans(n,INT_MAX);
                                        for(auto &x: v)
                                            cin>>x;
                                            ans[0]=0;
                                        rep(i,1,n)
                                        rep(j,1,k+1)
                                        if(i-j>=0)minn(ans[i],abs(v[i]-v[i-j])+ans[i-j]);

                                        cout<<ans[n-1];

                                    rt 0;
                                    }



















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

const ll INF = 1LL << 60;

ll K;
int main() {
    cin >> K;
    ll ans = 0;
    for (ll a = 1; a <= K; a++) {
        for (ll b = 1; b <= K; b++) {
            ll tmp = __gcd(a, b);
            for (ll c = 1; c <= K; c++) {
                ans += __gcd(tmp, c);
            }
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 3632
#include <cstdio>

#define int short
#define int32 signed

const int MAXN = 100;
int n, m, er, ec, srow[MAXN + 5][MAXN + 5], scol[MAXN + 5][MAXN + 5];
int f[MAXN + 1][MAXN + 1][MAXN + 1][MAXN + 1];

inline void chkmax ( int& a, const int b ) { if ( a < b ) a = b; }
inline int max_ ( const int a, const int b ) { return a < b ? b : a; }
inline int min_ ( const int a, const int b ) { return a < b ? a : b; }

inline int rsum ( const int row, const int l, const int r ) {
	return l > r ? 0 : srow[row][r] - srow[row][l - 1];
}

inline int csum ( const int col, const int u, const int d ) {
	return u > d ? 0 : scol[col][d] - scol[col][u - 1];
}

int32 main () {
	int32 tn, tm; char str[MAXN + 5];
	scanf ( "%d %d", &tn, &tm ), n = tn, m = tm;
	for ( int i = 1; i <= n; ++ i ) {
		scanf ( "%s", str + 1 );
		for ( int j = 1; j <= m; ++ j ) {
			if ( str[j] == 'E' ) er = i, ec = j;
			srow[i][j] = srow[i][j - 1] + ( str[j] == 'o' );
			scol[j][i] = scol[j][i - 1] + ( str[j] == 'o' );
		}
	}
	int umx = er - 1, dmx = n - er, lmx = ec - 1, rmx = m - ec;
	for ( int u = 0; u <= umx; ++ u ) {
		for ( int d = 0; d <= dmx; ++ d ) {
			for ( int l = 0; l <= lmx; ++ l ) {
				for ( int r = 0, cur, aliveL, aliveR, aliveU, aliveD; r <= rmx; ++ r ) {
					cur = f[u][d][l][r];
					aliveL = max_ ( r + 1, ec - l ), aliveR = min_ ( m - l, ec + r );
					chkmax ( f[u + 1][d][l][r],
						cur + ( er - u - 1 >= d + 1 ? rsum ( er - u - 1, aliveL, aliveR ) : 0 ) );
					chkmax ( f[u][d + 1][l][r],
						cur + ( er + d + 1 <= n - u ? rsum ( er + d + 1, aliveL, aliveR ) : 0 ) );

					aliveU = max_ ( d + 1, er - u ), aliveD = min_ ( n - u, er + d );
					chkmax ( f[u][d][l + 1][r],
						cur + ( ec - l - 1 >= r + 1 ? csum ( ec - l - 1, aliveU, aliveD ) : 0 ) );
					chkmax ( f[u][d][l][r + 1],
						cur + ( ec + r + 1 <= m - l ? csum ( ec + r + 1, aliveU, aliveD ) : 0 ) );
				}
			}
		}
	}
	int32 ans = f[umx][dmx][lmx][rmx];
	printf ( "%d\n", ans );
	return 0;
}

Measured memory_bytes: 44176
#include<iostream>
    #include<string>
    #include<algorithm>
    #include<utility>
    #include<vector>
     
    using namespace std;
     
    int main() {
    	int s, w;
    	cin >> s>>w;
    	if (w >= s) {
    		cout << "unsafe" << endl;
    	}
    	else {
    		cout << "safe" << endl;
    	}
    }

Measured memory_bytes: 3640
N = int(input())
H = list(map(int, input().split()))
start = 0
maxcount = 0
for i in range(1,N):
    if H[i] > H[i-1]:
        count = i-1 - start
        start = i
        maxcount = max(maxcount, count)
    elif i == N-1 and H[i] <= H[i-1]:
        count = i - start
        maxcount = max(maxcount, count)

print(maxcount)

Measured memory_bytes: 14252
function main(input) {
  var list = input[1].split(" ").map(v=>v-0);
  var ans = 0;
  var idx = 1;
  var cnt = 0;
  list.forEach(v=>{
    if(v!=idx) ans++;
    else {idx++;cnt++;}
  });
  if(cnt>0) console.log(ans);
  else console.log(-1);
}

main(require('fs').readFileSync('/dev/stdin', 'utf8').trim().split("\n"))


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

int main() {
    int A, B, C, X;
    cin >> A >> B >> C >> X;
    int result = 0;
    for (int a = 0; a <= A; ++a) {
        for (int b = 0; b <= B; ++b) {
            for (int c = 0; c <= C; ++c) {
                // 合計金額が X 円に一致した場合には答えをインクリメント
                if (500 * a + 100 * b + 50 * c == X) {
                    ++result;
                }
            }
        }
    }
    cout << result << endl;
}

Measured memory_bytes: 3568
#include<bits/stdc++.h>
using namespace std;
int main(){
  int N;
  cin >> N;
  vector<int> vec(N);
  for(int i=0; i<N; i++){
    cin >> vec[i];
  }
  sort(vec.begin(),vec.end());
  int cnt = 0;
  for(int i=0; i<N; i++){
    for(int j=i+1; j<N; j++){
      for(int k=j+1; k<N; k++){
        if(vec[i] == vec[j] || vec[j] == vec[k]){
          continue;
        }
        if(vec[i] + vec[j] > vec[k]){
          cnt++;
        }
      }
    }
  }
  cout << cnt << endl;
}

Measured memory_bytes: 3588
#include <bits/stdc++.h>
#define ll long long int
#define ff first
#define pb push_back
#define ss second
#define ff first
#define mp make_pair
 
using namespace std;
 
const ll MOD = 1000000007LL;
 
ll fact[1000006];
ll ifact[1000006];
ll power2[1000006];
 
ll ar[1000056];
 
 
ll powr (ll a, ll  b)
{
    if (b == 0)
        return 1;
    long long int x = powr(a, b/2);
    if (b % 2 == 0)
        return (x*x)%MOD;
    else
        return (((x*x)%MOD)*a)%MOD;
}
 
inline ll inv(ll x) {
  return powr(x, MOD - 2);
}
 
inline ll mulMod(ll a, ll b) {
  return (a%MOD * b%MOD) % MOD;
 
}
 
inline void process() {
  fact[0] = 1;
  power2[0] = 1;
  for(int i = 1; i < 1003; i++) {
    fact[i] = mulMod(fact[i - 1], i);
    power2[i] = mulMod(power2[i - 1], 2);
  }
  ifact[1002] = inv(fact[1002]);
  for(int i = 1002 - 1; i >= 0; i--) {
    ifact[i] = mulMod(ifact[i + 1], i + 1);
  }
}
 
inline ll ncr(ll n, ll r) {
  if(n < r) return 0;
  return mulMod(fact[n], mulMod(ifact[r], ifact[(n - r)]));
}
 
ll solve(ll n, ll k)
{
    ll C[k+1];
    memset(C, 0, sizeof(C));
 
    C[0] = 1; 
 
    for (ll i = 1; i <= n; i++)
    {
        for (ll j = min(i, k); j > 0; j--)
            C[j] = C[j] + C[j-1];
    }
    return C[k];
}
 
void solve1(vector<ll> price, ll n, ll S[])
{
   
   stack<ll> st;
   st.push(0);
 
   S[0] = 1;
 
   for (ll i = 1; i < n; i++)
   {
 
      while (!st.empty() && price[st.top()] <= price[i])
         st.pop();
 
 
      S[i] = (st.empty())? (i + 1) : (i - st.top());
 
      st.push(i);
   }
}
 
 
map<ll,ll> mark,has;
 
set<ll> st;
 
 
int main() 
{
    ll n,m,t,p,q,r,s,a,b,c,d,e,f,g,h,sum,res,flag,u,v,i,j,l,k,z,x,y,len,ans=0,maxm2,maxm;
    
    string str,ptr,dtr;
    
    cin>>a>>b>>c>>d;
    ll c1,c2,c3,c4;
    cin>>n;
    
    
    /*p=n/2;
    
    if(p!=0)
    {
    	ans+=min(p*d,min(p*c*2,min(p*b*4,p*a*8)));
    	
    	if(p%2)
    	ans+=min(c,min(b*2,a*4));
	}
	else
	{
		ans+=min(c,min(b*2,a*4));
	}*/
	c1=a*8;
	c2=b*4;
	c3=c*2;
    c4=d;
    maxm=min(c1,min(c2,min(c3,c4)));
    if(maxm==c1)
    {
        ans=4*n*a;
    }
    else
    if(maxm==c2)
    {
        ans=2*n*b;
    }
    else
    if(maxm==c3)
    {
        ans=n*c;
    }
    else
    {
        if(n%2==0)
        ans=n*d/2;
        else
        {
            maxm2=min(c1,min(c2,c3));
            ans=(n-1)*d/2;
            if(maxm2==c1)
            ans+=4*a;
            else
            if(maxm2==c2)
            ans+=2*b;
            else
            if(maxm2==c3)
            ans+=c;
        }
    }
    cout<<ans;
	
    
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
 
using namespace std;
 
int main()
{
    long long int a,b;
    cin>>a>>b;
    if(a<=0&&b>=0)
    cout<<"Zero";
    else if(a<0&&b<0&&(a+b)%2==0)
    cout<<"Negative";
    else
    cout<<"Positive";
}

Measured memory_bytes: 256