akhauriyash/Code-Regression huggingface dataset:
#include <iostream>

using namespace std;


int main()
{
    int w, h, x, y, r;
    cin >> w >> h >> x >> y >> r;
    if(x-r>=0 && y-r>=0 && x+r<=w && y+r<=h)
        cout << "Yes" << endl;
    else
        cout << "No" << endl;
}


Measured memory_bytes: 3092
#include <bits/stdc++.h>
using namespace std;
#define SZ(x) (int)(x.size())
#define REP(i, n) for(int i=0;i<(n);++i)
#define FOR(i, a, b) for(int i=(a);i<(b);++i)
#define RREP(i, n) for(int i=(int)(n)-1;i>=0;--i)
#define RFOR(i, a, b) for(int i=(int)(b)-1;i>=(a);--i)
#define ALL(a) a.begin(),a.end()
#define DUMP(x) cerr<<#x<<" = "<<(x)<<endl
#define DEBUG(x) cerr<<#x<<" = "<<(x)<<" (L"<<__LINE__<<")"<< endl;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vvvi = vector<vvi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using P = pair<int, int>;
const double eps = 1e-8;
const ll MOD = 1000000007;
const int INF = INT_MAX / 2;
const ll LINF = LLONG_MAX / 2;
template <typename T1, typename T2>
bool chmax(T1 &a, const T2 &b) {
    if (a < b) { a = b; return true; }
    return false;
}
template <typename T1, typename T2>
bool chmin(T1 &a, const T2 &b) {
    if (a > b) { a = b; return true; }
    return false;
}
template<typename T>
ostream &operator<<(ostream &os, const vector<T> &v) {
    os << "[";
    REP(i, SZ(v)) {
        if (i) os << ", ";
        os << v[i];
    }
    return os << "]";
}
template<typename T1, typename T2>
ostream &operator<<(ostream &os, const map<T1, T2> &mp) {
    os << "{";
    int a = 0;
    for (auto &tp : mp) {
        if (a) os << ", ";
        a = 1;
        os << tp;
    }
    return os << "}";
}
template<typename T1, typename T2>
ostream &operator<<(ostream &os, const pair<T1, T2> &p) {
    os << p.first << ":" << p.second;
    return os;
}


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


    for (;;) {
        string s; cin >> s;
        if (s == "#") break;
        int n = s.size();

        vector<int> S(n);
        REP(i, n) S[i] = s[i] - '1';

        vvvi dp(2, vvi(9, vi(s.size(), INF)));
        REP(k, 9) {
            dp[0][k][0] = dp[1][k][0] = 0;
        }
        FOR(i, 1, s.size()) {
            REP(k, 9) {
                if (dp[0][k][i-1] != INF) {
                    if (S[i] % 3 <= k % 3) chmin(dp[0][k][i], dp[0][k][i-1] + 1);
                    if (S[i] % 3 >= S[i-1] % 3) chmin(dp[1][S[i-1]][i], dp[0][k][i-1]);
                }
                if (dp[1][k][i-1] != INF) {
                    if (S[i] % 3 >= k % 3) chmin(dp[1][k][i], dp[1][k][i-1] + 1);
                    if (S[i] % 3 <= S[i-1] % 3) chmin(dp[0][S[i-1]][i], dp[1][k][i-1]);
                }
            }
        }

        int ans = INF;
        REP(k, 9) {
            chmin(ans, dp[0][k][n-1]);
            chmin(ans, dp[1][k][n-1]);
        }
        cout << ans << endl;
    }

    return 0;
}



Measured memory_bytes: 14484
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
      	int b = sc.nextInt();
      	sc.close();
      	if (a*b%2==0) {
          System.out.println("Even");
        } else {
          System.out.println("Odd");
        }
	}
}

Measured memory_bytes: 35532
import java.util.*;
public class Main {
    public static void main(String[]$) {
        Scanner sc = new Scanner(System.in);
        int n=sc.nextInt();
        long[] a=new long[n+1];
        a[0]=0;
        HashMap<Long,Integer> m=new HashMap<>();
        m.put(a[0],0);
        for (int i = 1; i <n+1; i++) {
            a[i]=a[i-1]+sc.nextLong();
            m.put(a[i],0);
        }
        long ans=0;
        for(int i=0;i<=n;i++){
            ans+=m.get(a[i]);
            m.put(a[i],m.get(a[i])+1);
        }
        System.out.println(ans);
    }
}


Measured memory_bytes: 107292
#include <stdio.h>
 
int main()
{
  int h,w;
  int i,j;
  scanf("%d",&h);
  scanf("%d",&w);
  while(!((h==0) && (w==0))){
    for(i=0;i<w;i++){
      printf("#");
    }
    printf("\n");
 
    for(i=0;i<h-2;i++){
      printf("#");
      for(j=0;j<w-2;j++){
        printf(".");
      }
      printf("#\n");
    }
    for(i=0;i<w;i++){
      printf("#");
    }
    printf("\n\n");
    scanf("%d",&h);
    scanf("%d",&w);
  }
 
 
  return 0;
}

Measured memory_bytes: 588
package main

import "fmt"


func main(){
	var n,m,sum,count int
	fmt.Scan(&n,&m)
	a := make([]int,n)
	for i:=0 ; i<n ; i++ {
		fmt.Scan(&a[i])
		sum += a[i]
	}
	for i:=0 ; i<n ; i++ {
		if a[i]*4*m >= sum {
			count++
		}
	}
	if count >= m {
		fmt.Println("Yes")
	} else {
		fmt.Println("No")
	}
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define INF 999999999
#define M_PI 3.14159265358979323846
// #define __LOCAL

#ifdef __LOCAL
#define DBG(X) cout << #X << " = " << (X) << endl;
#define SAY(X) cout << (X) << endl;
#else
#define DBG(X)
#define SAY(X)
#endif

using namespace std;

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

int dx[]={1, 0, -1, 0, 0};
int dy[]={0, 1, 0, -1, 0};
const int INT_INF = (int)(2e9);
const ll  LL_INF = (ll)(2e18);
const int NIL = -1;
static mt19937 _g(time(nullptr));
 
std::string pad(int num){ char buffer[4]; std::snprintf(buffer, sizeof(buffer), "%03d", num); return buffer;}
inline ll randint(ll a, ll b) { ll w = (_g() << 31LL) ^ _g(); return a + w % (b - a + 1); }
inline void fast_io() { ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); };
template<typename T> inline T sign(T x) { return T(x > 0) - T(x < 0); }
template<typename T, typename S> inline ostream& operator<<(ostream& os, const pair<T, S> p) { cout << "[" << p.first << ";" << p.second << "]"; return os; }
template<typename T> inline ostream& operator<<(ostream& os, const vector<T>& v) { for (auto el : v) cout << el << " "; return os; }
template<typename T> inline T fetch() { T ret; cin >> ret; return ret; }
template<typename T> inline vector<T> fetch_vec(int sz) { vector<T> ret(sz); for (auto& elem : ret) cin >> elem; return ret; }

#ifdef _MSC_VER
#  include <intrin.h>
#  define __builtin_popcount __popcnt
#endif

int main()
{
    ll A,B,K;
    cin >> A >> B >> K;
    ll ans1,ans2;
    ans1 = max(A-K,0LL);
    ans2 = max(B-max(K-A,0LL),0LL);
    cout << ans1 <<" "<< ans2 << endl;

}


Measured memory_bytes: 256
#include<cstring>
#include<cstdlib>
#include<cstdio>
#include<cmath>
#include<iostream>
#define mmod 1000000007
#define N 2100
using namespace std;
int n,m,jc[N*N],ny[N*N],f[N][N],ans;
int C(int n,int m)
{
	return 1ll*jc[n]*ny[m]%mmod*ny[n-m]%mmod;
}
void upd(int &x,int y)
{
	x=(x+y)%mmod;
}
int main()
{
	scanf("%d%d",&n,&m);
	if(m==1) {printf("1\n");return 0;}
	jc[0]=jc[1]=ny[0]=ny[1]=1;
	for(int i=2;i<=n*m;i++) jc[i]=1ll*i*jc[i-1]%mmod,ny[i]=1ll*(-mmod/i)*ny[mmod%i]%mmod;
	for(int i=2;i<=n*m;i++) ny[i]=1ll*ny[i]*ny[i-1]%mmod;
	f[0][0]=1;
	for(int i=0;i<=n;i++)
		for(int j=i;j<=n;j++)
		{
			if(i<j) upd(f[i+1][j],f[i][j]);
			upd(f[i][j+1],1ll*f[i][j]*C((j+1)*(m-1)+i-1,m-2)%mmod);
		}
	ans=1ll*f[n][n]*jc[n]%mmod;
	printf("%d\n",(ans+mmod)%mmod);
	return 0;
}

Measured memory_bytes: 51456
#define _USE_MATH_DEFINES
#include  <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
#include <string>
#include<math.h>
#include<iomanip>
#include<stdio.h>
#include <stdlib.h>
#include<stdio.h>
#include <queue>
#include<map>
#include <sstream>
#include<set>
#include<stack>

//#include<bits/stdc++.h>


using namespace std;



int main() {
	
	int t;
	cin >> t;
	bool f[150000] = {};
	int i = 1;
	while (!f[t]) {
		f[t] = 1;
		i++;
		if (t % 2)t = t * 3 + 1;
		else t /= 2;
	}
	cout << i << endl;

	return 0;

}

Measured memory_bytes: 384
#include<iostream>
#include<vector>
#include<algorithm>
#include<functional>
#include<utility>
using namespace std;

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

int main(){
	int a;
	cin>>a;
	vector<pair<int, int>> b;
	int c;
	rep(i, a){
		cin>>c;
		b.push_back(make_pair(c, i));
	}
	sort(b.begin(), b.end());
	rep(i, a){
		cout<<b[i].second + 1<<endl;
	}
	return 0;
}

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

#define ris   return *this
#define tmplt template<class T
#define dbgo  debug& operator<<
tmplt > struct rge { T b, e; };
tmplt > rge<T> range(T i, T j) { return rge<T>{i, j}; }
struct debug {
#ifdef LOCAL
~debug(){cerr<<endl;}
tmplt > dbgo(T x){cerr<<boolalpha<<x;ris;}
tmplt, class C > dbgo(pair<T, C> x){ris<<"("<<x.first<<", "<<x.second<<")";}
tmplt > dbgo(rge<T> x){*this<<"[";for(auto it=x.b;it!=x.e;it++){*this<<", "+2*(it==x.b)<<*it;}ris<<"]";}
tmplt > dbgo(vector<T> x){ris<<range(x.begin(),x.end());}
#else
tmplt > dbgo(const T&){ris;}
#endif
};
#define nav(...) << "[ " << #__VA_ARGS__ ": " << (__VA_ARGS__) << " ] "
using ll = long long;

#define forn(i, n) for(int i = 0; i < int(n); i++)
#define ford(i, n) for(int i = n-1; i >= 0; i--) 

template<typename T> 
void min_self(T& a, T b) { 
   a = min(a, b); 
}
template<typename T>
void max_self(T& a, T b) { 
   a = max(a, b); 
}


int main() {
   ios_base::sync_with_stdio(false);
   cin.tie(0);
   
   int n, k;
   cin >> n >> k;
   vector<int> a(n);
   for(int i = 0; i < n; i++) {
      cin >> a[i];
   }
   for(int rep = 0; rep < k; rep++) {
      vector<int> b(n);
      for(int i = 0; i < n; i++) {
         int d = a[i];
         int L = max(0, i - d), R = min(n-1, i + d);
         ++b[L];
         if(R < n-1) {
            --b[R+1];
         }
      }
      bool anything = false;
      int prefix_sum = 0;
      for(int i = 0; i < n; i++) {
         prefix_sum += b[i];
         if(prefix_sum != a[i]) {
            a[i] = prefix_sum;
            anything = true;
         }
      }
      if(!anything) {
         debug() nav(rep);
         break;
      }
   }
   for(int x : a) {
      cout << x << ' ';
   }
   cout << '\n';
}















// Author: blondie


Measured memory_bytes: 4928
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#include <climits>

#define REP(i, m, n) for(int i=int(m);i<int(n);i++)
#define EACH(i, c) for (auto &(i): c)
#define all(c) begin(c),end(c)
#define EXIST(s, e) ((s).find(e)!=(s).end())
#define SORT(c) sort(begin(c),end(c))
#define pb emplace_back
#define MP make_pair
#define SZ(a) int((a).size())

//#define LOCAL 0
//#ifdef LOCAL
//#define DEBUG(s) cout << (s) << endl
//#define dump(x)  cerr << #x << " = " << (x) << endl
//#define BR cout << endl;
//#else
//#define DEBUG(s) do{}while(0)
//#define dump(x) do{}while(0)
//#define BR
//#endif


//改造
typedef long long int ll;
using namespace std;
#define INF (1 << 20)
#define INFl (ll)5e15
#define DEBUG 0 //デバッグする時1にしてね

//ここから編集する


int main() {
    ll s[87] = {};
    s[0] = 2LL;
    s[1] = 1LL;
    REP(i,2,87){
        s[i] = s[i-1] + s[i-2];
    }

    int n;
    cin >> n;
    cout << s[n] << endl;
    return 0;
}


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


using namespace std;

#define M 1000000007
#define pb push_back
#define f first
#define s second
#define rep(i, st, ed) for(int i=st; i<ed; i++)
#define repn(i, st, ed) for(int i=st; i<=ed; i++)
#define repb(i, ed, st) for(int i=ed; i>=st; i--)
#define all(v) v.begin(),v.end()
typedef long long ll;
typedef unsigned long long int llt;
typedef long double ld;

const long double PI  =3.141592653589793238463;
const int N = 505;
const ll INF = 1LL << 60;

template<class T> void chmax(T &a,T b) { if (a<b) a=b;}
template<class T> void chmin(T &a,T b) { if (a>b) a=b;}



// Main Code

int main()
{
	int n;
	cin>>n;
	ll x;
	ll ans = 0;
	rep(i, 0, n) {
		cin>>x;
		ll k = ~x;
		k += 1;
		ll z = x & k;
		ans += log2(z);
	}
	cout<<ans<<endl;
}


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

int main(){
  
  int a,b,c;
  cin >> a >> b >> c;
  
  if( b >= c ){
    
    cout << "delicious" << endl;
    
    
  }
  
  else if( b < c && a >= c-b ){
    
    cout << "safe" << endl;
    
  }
  
  else{
    
    cout << "dangerous" << endl;
    
  }
  
}


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

const ll INF = 1e8;
const D EPS = 1e-8;
const ll MOD = 1e9+7;

int main(){
  int x;
  cin >> x;
  int n = 1;
  while (n*(n+1)/2 < x) n++;
  cout << n << endl;
}


Measured memory_bytes: 256
def gcd(a,b):
    while b:
        a, b = b, a % b
    return a

def lcd(a,b):
    return a * b // gcd(a,b)

n = int(input())
t = [int(input()) for i in range(n)]
ans = 1
for i in t:
    ans = lcd(ans, i)
print(int(ans))

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

using namespace std;

#define rep(i, n) for(int i = 0; i < n; i++)
typedef long long ll;
template<typename T> bool chmax(T &a, T b) {if(a <= b){a = b; return true;}return false;}
template<typename T> bool chmin(T &a, T b) {if(a > b){a = b; return true;}return false;}


int main(void){
    int x, n;
    cin >> x >> n;
    if(n == 0){
        cout << x << endl;
        return 0;
    }
    vector<int> a(n);
    rep(i, n)cin >> a[i];
    sort(a.begin(), a.end());
    auto xp = find(a.begin(), a.end(), x);
    if(xp == a.end()){
        cout << x << endl;
        return 0;
    }
    auto left = xp, right = xp;
    int i = *xp, j = *xp;
    while(true){
        if(i == *left && j == *right){
            if(left != a.begin())left--;
            if(right != a.end())right++;
            i--;
            j++;
            continue;
        }else if(i == *left){
            cout << j << endl;
        }else{
            cout << i << endl;
        }
        return 0;
    }
}

Measured memory_bytes: 3632
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <stdint.h> // uint64_t

#define max(a,b) ((a) > (b) ? (a) : (b))
#define min(a,b) ((a) > (b) ? (b) : (a))

int get_int(void) {
  int num;
  scanf("%d", &num);
  return num;
}

int get_int2(int *a1, int *a2) {
  scanf("%d %d", a1, a2);
  return 0;
}

struct sushi {
    int neta;
    int point;
};

#define NUM_MAX 100000
#define TYPES_MAX (NUM_MAX)

int desc_by_point(const void *a1, const void *a2) {
    struct sushi *s1 = (struct sushi*)a1;
    struct sushi *s2 = (struct sushi*)a2;
    return s2->point - s1->point;
}
#define HEAP_MAX (NUM_MAX+100)
#define ROOT_NODE 1
static struct sushi* heap[HEAP_MAX];
static int hidx = ROOT_NODE;

int comp(struct sushi *a1, struct sushi *a2) {
    return a1->point > a2->point;
}

void swap(struct sushi **a1, struct sushi **a2) {
    struct sushi *tmp = *a1;
    *a1 = *a2;
    *a2 = tmp;
}

// max heap
void enqueue(struct sushi *s) {
    int node = hidx;
    heap[hidx++] = s;
    int parent;
    while((parent = node/2)) {
        if(comp(heap[parent], heap[node])) break;
        swap(&heap[parent], &heap[node]);
        node = parent;
    }
    return;
}

struct sushi *delete_max(void) {
    struct sushi *ans = heap[ROOT_NODE];
    heap[ROOT_NODE] = heap[--hidx];
    int node = ROOT_NODE;
    while(1) {
        int largest = node;
        int left = node * 2;
        int right = node * 2 + 1;
        if(left < hidx && !comp(heap[largest], heap[left])) {
            largest = left;
        }
        if(right < hidx && !comp(heap[largest], heap[right])) {
            largest = right;
        }
        if(node == largest) break;
        swap(&heap[node], &heap[largest]);
        node = largest;
    }
    return ans;
}


static struct sushi* stack[NUM_MAX+50];
static int sidx = 0;

int is_empty(void) { return !sidx; }
void push(struct sushi *s) { stack[sidx++] = s; }
struct sushi *pop(void) { return stack[--sidx]; }


int main(void) {
    int num, k;
    get_int2(&num, &k);

    int i;
    static struct sushi sushis[NUM_MAX];
    for(i = 0; i < num; i++) {
        get_int2(&sushis[i].neta, &sushis[i].point);
    }
    qsort(sushis, num, sizeof(struct sushi), desc_by_point);

    static char checked[TYPES_MAX+1];
    int64_t base = 0;
    for(i = 0; i < num; i++) {
        struct sushi s = sushis[i];
        if(sidx >= k || checked[s.neta]) {
            enqueue(&sushis[i]);
            continue;
        }
        checked[s.neta]++;
        base += s.point;
        push(&sushis[i]);
    }
    // if (# of types) < K
    for(i = sidx; i < k; i++) {
        struct sushi *s = delete_max();
        base += s->point;
    }

#ifdef DEBUG
        printf("[stack: %d heap: %d] %lld\n", sidx, hidx, base);
#endif
    int64_t ans = base + (int64_t)sidx*sidx; // when x=max

    while(!is_empty() && hidx>1) {
        struct sushi *trash = pop();
        struct sushi *s = delete_max();
        base = base - trash->point + s->point;
#ifdef DEBUG
        printf("[stack: %d heap: %d] %lld\n", sidx, hidx, base);
#endif
        ans = max(ans, base + (int64_t)sidx*sidx);
    }

    printf("%lld\n", ans);
    return 0;
}

Measured memory_bytes: 1804
#include <bits/stdc++.h>
typedef long long int ll;
typedef long double ld;
using namespace std;
const long long int INF = 1e18;
const long long int mod = 1e9+7;

struct Edge{
    ll to, weight;
    Edge(ll t, ll w) : to(t), weight(w){}
};
using graph = vector<vector<ll>>;
using Graph = vector<vector<Edge>>;


ll gcd(ll a,ll b){
    if(b == 0){
        return a;
    }else{
        return gcd(b, a%b);
    }
}

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

ll keta(ll N){
    int tmp{};
    while( N > 0 ){
        tmp += ( N % 10 );
        N /= 10;
    }
    N = tmp;
    return N;
}

vector<vector<ll>> combination(ll n, ll r){
    vector<vector<ll>> v(n + 1, vector<ll>(n + 1, 0));
    for(ll i=0;i<v.size();++i){
        v[i][0] = 1;
        v[i][i] = 1;
    }
    for(ll i=1;i<v.size();++i){
        for(ll j=0;j<i;++j){
            v[i][j] = (v[i - 1][j - 1] + v[i - 1][j]);
        }
    }
    return v;
}

// 回文
bool kai(string S){
    bool flag = true;
    for(ll i=0;i<S.size()/2;++i){
        if(S[i] != S[S.size()-i-1]){
            flag = false;
            break;
        }
    }
    return flag;
}
// ---------------------------------------------

int main(){
    ll n;
    cin>>n;
    bool f[n][10];
    for(ll i=0;i<n;++i){
        for(ll j=0;j<10;++j){
            cin>>f[i][j];
        }
    }
    ll p[n][11];
    for(ll i=0;i<n;++i){
        for(ll j=0;j<11;++j){
            cin>>p[i][j];
        }
    }
    ll ans = -INF;
    for(ll b=1;b<(1<<10);++b){
        ll flag = 0;
        for(ll i=0;i<n;++i){
            ll num = 0;
            for(ll j=0;j<10;++j){
                if(b & (1<<j) and f[i][j]){
                    num++;
                }
            }
            flag += p[i][num];
        }
        ans = max(ans, flag);
    }
    cout<<ans<<endl;

    return 0;
}

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

class B
{
	static void Main()
	{
		var h = Console.ReadLine().Split().Select(int.Parse).ToArray();

		var c = 0;
		var rM = h[3] / h[0];
		for (int r = 0; r <= rM; r++)
		{
			var n2 = h[3] - r * h[0];
			var gM = n2 / h[1];
			for (int g = 0; g <= gM; g++)
			{
				var n3 = n2 - g * h[1];
				if (n3 % h[2] == 0) c++;
			}
		}
		Console.WriteLine(c);
	}
}


Measured memory_bytes: 13396
use std::str::FromStr;
use std::fmt::Debug;
use std::cmp;
#[allow(dead_code)]
fn read_as_vec<T>() -> Vec<T>
where T: FromStr, <T as FromStr>::Err : Debug{
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).unwrap();
    s.trim().split_whitespace().map(|c| T::from_str(c).unwrap()).collect()

}

#[allow(dead_code)]
fn read_as_string() -> String{
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).unwrap();
    s.trim().to_string()
}

fn main(){
    let s = read_as_string().chars().collect::<Vec<char>>();

    for i in 0..s.len(){
        if (i%2 == 1 && s[i] == 'R') || (i%2 == 0 && s[i] == 'L'){
            println!("No");
            return;
        }
    }
    println!("Yes");

}


Measured memory_bytes: 4352
import java.util.*;

public class Main {
	
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		while(sc.hasNext()){
			int n = sc.nextInt();
			int m = sc.nextInt();
			int x, y;
			for(int i=0;i<m;i++){
				x = sc.nextInt();
				y = sc.nextInt();
				if(x>n/2) x = n-x+1;
				if(y>n/2) y = n-y+1;
				if(x>=y) System.out.println((y-1)%3+1);
				else System.out.println((x-1)%3+1);
			}
		}	
	}	
}

Measured memory_bytes: 25160
#include <bits/stdc++.h>
#define F first
#define S second
#define all(a) a.begin(),a.end()
#define setDP(arr) memset(arr,-1,sizeof arr)
#define Clear(arr) memset(arr,0,sizeof arr)
#define li(x) x.size()-1
#define oo 2000000000
#define inf 1000000000000000000
#define M 1000000007
typedef long long ll;
using namespace std;
const int N =3e5+10;
const int SQRTN = 320;
const int LOGN = 20;
const double PI = acos(-1);
const double Tau = 2*acos(-1);

ll n , k , a[N];
ll ans = inf;
vector<ll> v1,v2;
int main() {
	cin >> n >> k;
	for(int i = 0 ; i < n ; i++){
		scanf("%lld",a+i);
		if(a[i]>0)v2.push_back(a[i]);
		if(a[i]<0)v1.push_back(a[i]);
		if(a[i]==0) k--;
	}
	if(k<=0){
		cout << 0 ;
		return 0;
	}
	reverse(all(v1));
	int temp = k;
	for(int i = 0 ; i < v1.size() ; i++){
		temp--;
		ll x = -v1[i];
		if(temp==0)ans = min(ans,x);
		if(v2.size()<temp||!v2.size())continue;
		x+=(v2[temp-1]-v1[i]);
		ans=min(ans,x);
	}
	 temp = k;
	for(int i = 0 ; i < v2.size() ; i++){
		temp--;
		ll x = v2[i];
		if(temp==0)ans = min(ans,x);
		if(v1.size()<temp||!v1.size())continue;
		x+=(-v1[temp-1]+v2[i]);
		ans=min(ans,x);
	}
	cout << ans <<endl;
    return 0;
}


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

int ck(int v1[], int v2[], int n){
    int a=1;;
    for (int i=0; i<n; i++){
        if (v1[i]!=v2[i]){
            a=0;
            break;
        }
    }
    return a;
}
long long a=1,b=1,n,c,d;
string ss,s1,s2;
int main(){
    cin>>n;
    cin>>s1>>s2;
    for (int i=0; i<n; i++){
        ss+=s1[i];
        ss+=s2[i];
    }
    cout<<ss<<endl;
}


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

int main() {
  int H, W; cin>>H>>W;
  vector<vector<char>> mine(H, vector<char>(W));
  vector<vector<int>> num(H, vector<int>(W)); //数字、#は99にでもする？
  for(int i=0; i<H; i++){
    string S; cin>>S;
    for(int j=0; j<W; j++){
      mine.at(i).at(j)=S.at(j);
    }
  }
  //カウント
  for(int i=0; i<H; i++){
    for(int j=0; j<W; j++){
      if(mine[i][j]=='#'){
        num[i][j]=99;
        if(i-1>=0 && j-1>=0) num[i-1][j-1]++;
        if(i-1>=0 && j>=0) num[i-1][j]++;
        if(i-1>=0 && j+1<W) num[i-1][j+1]++;
        if(i>=0 && j-1>=0) num[i][j-1]++;
        if(i>=0 && j+1<W) num[i][j+1]++;
        if(i+1<H && j-1>=0) num[i+1][j-1]++;
        if(i+1<H && j>=0) num[i+1][j]++;
        if(i+1<H && j+1<W) num[i+1][j+1]++;
      }
    }
  }
  //答え
  for(int i=0; i<H; i++){
    for(int j=0; j<W; j++){
      if(j==W-1){
      if(num[i][j]>=99) cout<<"#"<<endl;
        else cout<<num[i][j]<<endl;
      }
      else{
        if(num[i][j]>=99) cout<<"#";
        else cout<<num[i][j];
      }
    } //j
  } //i
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <utility>
#include <cmath>
#include <functional>
#include <queue>
//#include <stack>
#include <climits>
#include <map>
#define REP(i,n) for(ll i=0;i<n;i++)
#define FOR(i,n1,n2) for(ll i=n1;i<n2;i++)
#define put(a) cout<<a<<endl;
#define all(a)  (a).begin(),(a).end()
#define SORT(c) sort((c).begin(),(c).end())
using namespace std;
typedef long long ll;
//typedef unsigned long long ull;
typedef pair<int, int> P;

int x,y;

int main(){
    cin >> x >> y;
    put(x+y/2);
    return 0;
}




Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define SORT(a) sort((a).begin(), (a).end())
#define RSORT(a) reverse((a).begin(), (a).end())

deque<char> dq; //std::deque
string s;
int q;

int main() {
  cin >> s >> q;
  for (int i = 0; i < s.length(); ++i) {
    //末尾に追加
    dq.push_back(s[i]);
  }

  bool mae = true;
  for (int i = 0; i < q; ++i) {
    int t; // t= 1 or 2
    cin >> t;

    if (t == 1) {
      if (mae) mae = false;
      else mae = true;
    } 
    else {
      int f; // f= 1 or 2
      char c;
      cin >> f >> c;
      if (mae) {
        if (f == 1) dq.push_front(c); //先頭に追加
        else dq.push_back(c);
      } 
      else {
        if (f == 1) dq.push_back(c);
        else dq.push_front(c);
      }
    }
  }
  // size()で要素数取得
  if (mae) {
    for (int i = 0; i < dq.size(); ++i) cout << dq[i];
    cout << endl;
  } 
  else {
    RSORT(dq);
    for (int i = 0; i < dq.size(); ++i) cout << dq[i];
    cout << endl;
  }
}

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

#define ll long long

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    int a, b;
    cin >> a >> b;
    
    cout << max(a+b, (max(a-b, a*b))) << endl;

    return 0;
}



Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
using namespace std;
#define loop(i,a,b) for(int i=a;i<b;i++)
#define rep(i,a) loop(i,0,a)

#define n 1001
int main (void){
	int fb[n+1];
	fb[0]=1;
	fb[1]=2;
	loop(i,2,n){
		fb[i]=(fb[i-1]+fb[i-2])%n;
	}
	int v,d;
	while(cin>>v>>d){
		int a[n];
		rep(i,v)a[i]=fb[i+1];
		sort(a,a+v);
		
		int cnt=1;
		loop(i,1,v){
			if(a[i]-a[i-1]>=d)
				cnt++;
		}
		cout<<cnt<<endl	;
	}
}

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

using namespace std;

#define DUMP(x) std::cerr << (#x) << " = " << (x) << "\n"
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define REP(i, k, n) for (int i = (k); i < (int)(n); ++i)
#define ALL(r) r.begin(), r.end()
#define YES cout << "YES" << endl
#define Yes cout << "Yes" << endl
#define NO cout << "NO" << endl
#define No cout << "No" << endl
#define IMP cout << "IMPOSSIBLE" << endl
#define Imp cout << "Impossible" << endl
#define imp cout << "impossible" << endl
#define M1 cout << "-1" << endl
#define pb push_back
#define eb emplace_back
#define fi first
#define se second

template <typename T>
ostream &operator<<(ostream &os, vector<T> &v)
{
    os << "{";
    rep(i, v.size()) os << v[i] << (i == (int)v.size() - 1 ? "" : ", ");
    os << "}";
    return os;
}
template <typename T, typename U>
ostream &operator<<(ostream &os, pair<T, U> &p)
{
    os << "(" << p.first << ", " << p.second << ")";
    return os;
}
template <typename T>
T dup(T x, T y)
{
    return (x + y - 1) / y;
};
template <typename A, size_t N, typename T>
inline void arrayFill(A (&array)[N], const T &val) { std::fill((T *)array, (T *)(array + N), val); }
struct in
{
    const size_t n = 0;
    in() = default;
    in(size_t n) : n(n){};
    template <typename T>
    operator T()
    {
        T ret;
        cin >> ret;
        return ret;
    }
    template <typename T>
    operator vector<T>()
    {
        assert(n != 0);
        vector<T> ret(n);
        for (auto &x : ret)
            cin >> x;
        return ret;
    }
};

using ll = int64_t;
using vint = vector<int32_t>;
using vvint = vector<vint>;
using vll = vector<ll>;
using vvll = vector<vll>;
using vstr = vector<string>;
using pint = pair<int32_t, int32_t>;
using vpint = vector<pint>;
using pll = pair<ll, ll>;
using vpll = vector<pll>;
using setint = set<int32_t>;
using setstr = set<string>;
using qint = queue<int32_t>;
using qpint = queue<pint>;

constexpr std::int32_t INF = 1001001001;
constexpr std::int64_t LINF = 1001001001001001001;

void Main()
{
    ll x, y, z, k;
    cin >> x >> y >> z >> k;
    vll a = in(x), b = in(y), c = in(z);

    vll ab;
    rep(i, x) rep(j, y)
    {
        ab.pb(a[i] + b[j]);
    }
    sort(ALL(ab), greater<ll>());

    vll ab2;
    rep(i, min(ab.size(), (size_t)k))
    {
        ab2.pb(ab[i]);
    }

    vll abc;
    rep(i, ab2.size()) rep(j, z)
    {
        abc.pb(ab2[i] + c[j]);
    }
    sort(ALL(abc), greater<ll>());

    rep(i, k)
    {
        cout << abc[i] << endl;
    }
}

signed main()
{
    std::cin.tie(nullptr);
    std::ios_base::sync_with_stdio(false);
    std::cout << std::fixed << std::setprecision(15);
    Main();
    return 0;
}


Measured memory_bytes: 43400
#include <iostream>
#include <vector>

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

    std::vector<int> H(N);
    std::vector<int> HM(N, 0);
    for (int i = 0; i < N; i++) {
        std::cin >> H[i];
    }

    HM[0] = H[0];
    for (int i = 1; i < N; i++) {
        HM[i] = std::max(H[i], HM[i-1]);
    }

    int ans = 1;
    for (int i = 1; i < N; i++) {
        if (H[i] >= HM[i]) ans++;
    }

    std::cout << ans << std::endl;

    return 0;
}

Measured memory_bytes: 256
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#define _GLIBCXX_DEBUG // check []
#define DIVISOR 1000000007

using namespace std;
typedef pair<int,int> pii;
typedef pair<int64_t, int64_t> pII;

template<typename T>
void cins(vector<T>& arr) { for(T& e: arr) cin >> e; }

#ifdef DEBUG
#define debug(fmt, ...) \
    printf("[debug: %s] " fmt, __func__, __VA_ARGS__)
#else
#define debug(fmt, ...)
#endif

int main(void) {
    int num;
    cin >> num;
    vector<int> primes(num+1);
    for(int i = 1; i <= num; i++) {
        primes[i] = i;
    }

    vector<int> cnt(num+1, 1);
    for(int i = 2; i <= num; i++) {
        if(primes[i] == 1) continue;
        int p = primes[i];
        for(int j = i; j <= num; j+=i) {
            int m = 0;
            while(1) {
                if(primes[j]%p) break;
                primes[j] /= p;
                m++;
            }
            cnt[j] *= (m + 1);
        }
    }
    int64_t sum = 0;
    for(int i = 1; i <= num; i++) {
        sum += (int64_t)i * cnt[i];
    }
    cout << sum << endl;
    return 0;
}

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

int main(void){
    char s[100];
    scanf("%s",s);
    int len = strlen(s);
    int a=0,b,i;
    for(i=0;i<len;i++){
        if(s[i]=='o'){
            a++;
        }
    }
    b=15-len+a;
    if(b>7){
        printf("YES");
    }else{
        printf("NO");
    }
    return 0;
}


Measured memory_bytes: 128
#include<iostream>

int main(void){
	int x, y;
	while (1){
		std::cin >> x >> y;
		if (x == 0 && y == 0) break;
		if (x <= y) std::cout << x << " " <<  y << std::endl; 
		else std::cout << y << " " <<  x << std::endl;
	}
	
	return 0;
}

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

int ix;
vector<int> A(1000000);

void partitionx(int p, int r){
    int x = A[r];
    ix = p-1;
    for (int j = p; j < r; j++){
        if(A[j] <= x){
            ix++;
            swap(A[ix], A[j]);
        }
    }
    swap(A[ix+1], A[r]);
    return;
}

int main() {
    int n; cin >> n;
    rep(i, n){
        cin >> A[i];
    }

    partitionx(0, n-1);
    rep(i, ix+1){
        cout << A[i] << " ";
    }
    cout << "[" << A[ix+1] << "] ";
    for (int i = ix+2; i < n; i++){
        cout << A[i];
        if(i == n-1){
            cout << endl;
        } else {
            cout << " ";
        }
    }
    return 0;
}


Measured memory_bytes: 6628
import java.util.Scanner;
 
public class Main{
	public static void main(String[] args) {
 
		Scanner scanner = new Scanner(System.in);
 
		int[]bingo = new int[9];
 
		for(int i = 0; i < 9; i++) {
			String[] temp = scanner.nextLine().split(" ");
			bingo[i] 	 = Integer.parseInt(temp[0]);
			bingo[i + 1] = Integer.parseInt(temp[1]);
			bingo[i + 2] = Integer.parseInt(temp[2]);
 
			i += 2;
		}
 
		int n = Integer.parseInt(scanner.nextLine());
		int b = 0;
 
		for(int i = 0; i < n; i++) {
 
			b = Integer.parseInt(scanner.nextLine());
 
			for(int j = 0; j < 9; j++) {
 
				if(bingo[j] == b) bingo[j] = 0;
 
			}
		}
 
 
		for(int i = 0; i < 9; i++) {
			if(bingo[i] + bingo[i + 1] + bingo[i + 2] == 0) {
 
				System.out.println("Yes");
				return;
 
			}
			i += 2;
		}
 
		for(int i = 0; i < 3; i++) {
			if(bingo[i] + bingo[i + 3] + bingo[i + 6] == 0) {
 
				System.out.println("Yes");
				return;
 
			}
		}
 
		if(bingo[0] + bingo[4] + bingo[8] == 0) {
 
			System.out.println("Yes");
			return;
 
		}
 
		if(bingo[2] + bingo[4] + bingo[6] == 0) {
 
			System.out.println("Yes");
			return;
 
		}
 
		System.out.println("No");
	}
}

Measured memory_bytes: 35676
#include <bits/stdc++.h>
#define ALL(A) (A).begin(), (A).end()
#define ll long long
#define rep(i, n) for (int i = 0; i < (n); i++)

using namespace std;

const ll mod = 1e9 + 7;

int main() {
  int n, k;
  cin >> n >> k;
  vector<int> a(n);
  vector<int> s, t;
  rep(i,n) {
    cin >> a[i];
    if (a[i] < 0) t.push_back(a[i]);
    else s.push_back(a[i]);
  }
 
  int S = s.size();
  int T = t.size();
  bool ok = false;
  if (S > 0) {
    if (n == k) ok = (T%2==0);
    else ok = true;
  } else {
    ok = (k%2==0);
  }
 
  ll ans = 1;
  if (!ok) {
    sort(ALL(a), [](int x, int y) {
      return abs(x) < abs(y);
    });
    rep(i,k) ans *= a[i],ans %= mod;
  } else {
    sort(s.begin(), s.end());
    sort(t.rbegin(), t.rend());
    if (k%2 == 1) {
      ans *= s.back();
      s.pop_back();
    }
    vector<ll> p;
    while (s.size() >= 2) {
      ll x = s.back(); s.pop_back();
      x *= s.back(); s.pop_back();
      p.push_back(x);
    }
    while (t.size() >= 2) {
      ll x = t.back(); t.pop_back();
      x *= t.back(); t.pop_back();
      p.push_back(x);
    }
    sort(p.rbegin(), p.rend());
    rep(i,k/2) ans *= p[i]%mod,ans %= mod;
  }
 
  cout << (ans + mod) % mod << endl;
  return 0;
}


Measured memory_bytes: 6340
import java.util.*;

public class Main{
  public static void main(String args[]){
    Scanner sc = new Scanner(System.in);
    
    int n = sc.nextInt();
    sc.nextLine();
    String s = sc.nextLine();
    int i = 0;
    int cnt = 0;
    
    do{
      i = s.indexOf("ABC", i);
      if(i != -1){
        cnt++;
        i++;
      }
    }while(i >= 0);
    
    System.out.println(cnt);
  }
}

Measured memory_bytes: 35884
#include<iostream>
#include<cstring>
#include<vector>
using namespace std;

void travel(vector<int> graph[], vector<int> &dp, int source, vector<bool> &visited) {
	
	visited[source] = true;

	for(int i=0; i<graph[source].size(); i++) {
		if(!visited[graph[source][i]]) {
			travel(graph, dp, graph[source][i], visited);
		}
		dp[source] = max(dp[source], 1 + dp[graph[source][i]]);

	}
}

int main() {
	/*freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
	freopen("error", "w", stderr);*/
	int n,m;
	cin>>n>>m;
	vector<int> graph[n];
	int x,y;
	for(int i=0; i<m; i++) {
		cin>>x>>y;
		graph[x-1].push_back(y-1);
	}

	int ans = -1;
	vector<bool> visited(n, false);
	vector<int> dp(n, 0);



	for(int i=0; i<n; i++) {
		if(!visited[i]){
			travel(graph, dp, i, visited);
		}
		ans = max(ans, dp[i]);
	}

	cout<<ans;

}	

Measured memory_bytes: 12448
#include <iostream>
#include <vector>
using namespace std;
using ll = long long;

int main() {
  ll N, M;
  cin >> N >> M;

  ll ans = 0;
  for (int i = M / N; i >= 1; i--) {
    if (M % i == 0) {
      ans = i;
      break;
    }
  }

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

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define endl "\n"
using namespace std;
typedef long long ll;
typedef pair<ll, ll> l_l;
typedef pair<int, int> i_i;
template<class T>
inline bool chmax(T &a, T b) {
    if(a < b) {
        a = b;
        return true;
    }
    return false;
}

template<class T>
inline bool chmin(T &a, T b) {
    if(a > b) {
        a = b;
        return true;
    }
    return false;
}

const long long INF = 1e18;
//const ll mod = 1000000007;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N;
    cin >> N;
    cout << (100000 - N) % 1000 << endl;
    return 0;
}


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

#define ll long long

int main(){

    ios::sync_with_stdio(false);
    cin.tie(0);
    
    ll n;
    cin >> n;

    while (n)
    {
        int d= n%10;
        if(d==7){
            cout << "Yes\n";
            return 0;
        }
        n/=10;
    }
    cout << "No\n";
    return 0;
}

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

using namespace std;
#define int long long
#define INF 1000007
#define MOD 1000000007
#define maxn 100
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define rep(i, n) FOR(i, 0, n)

typedef std::pair<int, int> P;

vector<bool> prime(maxn + 1, true); //素数テーブル
void prime_table(void) {
    prime[0] = false;
    prime[1] = false;
    for (int i = 2; i * i <= maxn; i++) {
        if (!prime[i]) {
            continue;
        }
        for (int j = i + i; j <= maxn; j += j + i) {
            prime[j] = false;
        }
    }
}

bool IsPrime(int num) //素数判定
{
    if (num < 2)
        return false;
    else if (num == 2)
        return true;
    else if (num % 2 == 0)
        return false;

    double sqrtNum = sqrt(num);
    for (int i = 3; i <= sqrtNum; i += 2) {
        if (num % i == 0) {
            return false;
        }
    }

    return true;
}

vector<int> divisor(int n) //約数列挙
{
    vector<int> ret;
    for (int i = 1; i * i <= n; i++) {
        if (n % i == 0) {
            ret.push_back(i - 1);
            if (i * i != n) {
                ret.push_back((n / i) - 1);
            }
        }
    }
    sort(ret.begin(), ret.end());
    return (ret);
}

int a, b;

void f(int x) {
    a = x % 10;
    b = 0;
    while (x) {
        b = x;
        x /= 10;
    }
}

signed main() {
    int X, Y, A, B, C;
    cin >> X >> Y >> A >> B >> C;
    vector<int> p, q, r;
    int ans;
    ans = 0;
    rep(i, A) {
        int a;
        cin >> a;
        p.push_back(a);
    }
    sort(p.begin(), p.end(), greater<int>());
    p.erase(p.begin() + X, p.end());
    rep(i, B) {
        int b;
        cin >> b;
        q.push_back(b);
    }
    sort(q.begin(), q.end(), greater<int>());
    q.erase(q.begin() + Y, q.end());
    rep(i, C) {
        int c;
        cin >> c;
        r.push_back(c);
    }
    sort(r.begin(), r.end(), greater<int>());
    copy(q.begin(), q.end(), back_inserter(p));
    copy(r.begin(), r.end(), back_inserter(p));
    sort(p.begin(), p.end(), greater<int>());
    rep(i, X + Y) {
        ans += p[i];
    }

    cout << ans << endl;

}

Measured memory_bytes: 8048
#include <bits/stdc++.h>
using namespace std;
#define pi 3.14159265359
int main() {
	int n,m;
	cin>>n>>m;
	int s=0;
	for(int i=0;i<m;i++){
		int a;
		cin>>a;
		s+=a;
	}
	if(s>n)
		cout<<-1;
	else
		cout<<n-s;
	return 0;
}

Measured memory_bytes: 3640
#include <bits/stdc++.h> 
    #include <ext/pb_ds/assoc_container.hpp> // Common file  
    #include <ext/pb_ds/tree_policy.hpp>  
    #include <functional>
    #include <unistd.h>
    using namespace std; 
    using namespace std::chrono; 
    using namespace __gnu_pbds;
    typedef tree<int, null_type, less<int>, rb_tree_tag,  
                tree_order_statistics_node_update>  
        ordered_set;  
    #define ll long long int 
    ll brr[200005];
    void addEdge(vector<ll> adj[], ll u, ll v) 
    { 
        adj[u].push_back(v); 
        adj[v].push_back(u); 
    } 
     
int main() 
{ 
	string s;
	cin>>s;
	ll n=s.size();
	ll flag=0;
	for(ll i=0;i<n/2;i++){
		if(s[i]!=s[n-1-i]){
			flag=1;
			break;
		}
	}
	if(flag==1){
			cout<<"No"<<endl;
	}
	else{
		flag=0;
		ll n1=(n-1)/2,n2=n1+2;
			for(ll i=0;i<n1;i++){
				if(s[i]!=s[n1-1-i]){
					flag=1;
					break;
				}
			}
			if(flag==1)
				cout<<"No"<<endl;
			else{
				flag=0;
				for(ll i=n2;i<n;i++){
					if(s[i]!=s[n-1-i]){
							flag=1;
							break;
					}
				}
				if(flag==0)
						cout<<"Yes"<<endl;
				else
					cout<<"No"<<endl;
			}
			
	}
  return 0; 
} 


Measured memory_bytes: 256
using System;

public class Program
{
    private static void Main()
    {
        string[] WHxyr = Console.ReadLine().Split(' ');
        int W = int.Parse(WHxyr[0]);
        int H = int.Parse(WHxyr[1]);
        int x = int.Parse(WHxyr[2]);
        int y = int.Parse(WHxyr[3]);
        int r = int.Parse(WHxyr[4]);

        if (x >= W || y >= H || x - r < 0 || y - r < 0 || x + r > W || y + r > H)
            Console.WriteLine("No");
        else
            Console.WriteLine("Yes");
    }
}

Measured memory_bytes: 8856
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, j, n) for (ll i = j; i < n; i++)
#define all(x) (x).begin(),(x).end()
#define INF (1000000000)
#define MOD (1000000007)
#define MAX (100000)
#define pii pair<int, int>

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

class XY{
public:
  ll x, y;
  XY() {x = y = 0;}
  XY(ll u, ll v) {x = u; y = v;}
};

template<typename T1, typename T2>
void chmin(T1 &a, T2 b) {if(a > b) a = b;}
template<typename T1, typename T2>
void chmax(T1 &a, T2 b) {if(a < b) a = b;}

template<typename T1, typename T2>
ll mypow(T1 a, T2 n){
  if(n == 0) return 1;
  if(n == 1) return a;
  if(n % 2) return a * mypow(a, n - 1);
  ll tmp = mypow(a, n / 2);
  return tmp * tmp;
}

template<typename T>
int BS(vector<T> V, int left, int right, T key){
  int mid = (left + right) / 2;
  if(V[mid] <= key) left = mid;
  else right = mid;
  if(right - mid == 1) return left;
  else return BS(V, left, right, key);
}

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

ll comb(ll n, ll r){
	ll res = 1;
  rep(i, 0, r){
    res *= n - i;
    res /= i + 1;
  }
  return res;
}

void Main() {
  string S; cin >> S;
  int res = INF;
  for(char c = 'a'; c <= 'z'; c++){
    int cnt = 0;
    string T = S;
    while(true){
      bool ok = true;
      rep(i, 0, T.size()){
        if(T[i] != c) ok = false;
      }
      if(ok) break;
      rep(i, 0, T.size() - 1){
        if(T[i + 1] == c) T[i] = c;
      }
      T = T.substr(0, T.size() - 1);
      cnt++;
    }
    chmin(res, cnt);
  }
  cout << res << endl;
}

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

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

  Main();
}


Measured memory_bytes: 256
use std::str::FromStr;

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

fn get_vec<T : FromStr>() -> Vec<T> {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    return s.trim().split_whitespace().map(|e| e.parse().ok().unwrap()).collect();
}
fn get_vec_by_lines<T : FromStr>(n : usize) -> Vec<T> {
    let mut v : Vec<T> = Vec::new();
    for _i in 0..n {
        let x : T = get_one();
        v.push(x);
    }
    return v;
}


fn main() {
    let nk : Vec<i64> = get_vec();
    let (n, k) = (nk[0], nk[1]);
    let x = n % k;
    println!("{}", std::cmp::min(x,(x-k).abs()));
}


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

const ll logx=30;
const ll N=2e5+5;
const ll M=3e5+5;
const ll mod=1e9+7;
const ll INF=1e18+5;
const double PI = 3.14159265358979323846;

#define ints(n) scanf("%d",&n)
#define intp(n) printf("%d\n",n)
#define longs(n) scanf("%intd",&n)
#define longp(n) printf("%intd\n",n)

inline ll mul(ll a, ll b){ return (a * 1ll * b) % mod; }
inline ll sub(ll a, ll b){ ll c = a - b; if(c < 0) c += mod; return c; }
inline ll add(ll a, ll b){ ll c = a + b; if(c > mod) c -= mod; return c; }

#define f first
#define s second
#define pb(x) push_back(x)
#define pf(x) push_front(x)
#define mp(x,y) make_pair(x,y)
#define GCD(a,b) __gcd((a),(b))
#define all(v) v.begin(),v.end()
#define bits(x) __builtin_popcount(x)
#define LCM(a,b) ((a)*(b))/GCD((a),(b))
#define ms(dp,val) memset(dp,val,sizeof(dp))
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);
template<typename T> T power(T x,T y,ll m){T ans=1;while(y>0){if(y&1LL) ans=(ans*x)%m;y>>=1ll;x=(x*x)%m;}return ans%m;}

#define trace1(x)                cerr<<#x<<": "<<x<<endl
#define trace2(x, y)             cerr<<#x<<": "<<x<<" | "<<#y<<": "<<y<<endl
#define trace3(x, y, z)          cerr<<#x<<":" <<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl
#define trace4(a, b, c, d)       cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<endl
#define trace5(a, b, c, d, e)    cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<endl
#define trace6(a, b, c, d, e, f) cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<" | "<<#f<<": "<<f<<endl

bool comp(pair<ll,ll> l,pair<ll,ll> r)
{
  if(l.s==r.s){return l.f>r.f;}
  return l.s<r.s;
}

int main()
{
  ll n;
  cin>>n;
  ll sum=0;
  pair<ll,ll> p[n];
  for(ll i=0;i<n;i++){cin>>p[i].f>>p[i].s;}
  sort(p,p+n,comp);
  //cout<<endl;
  //for(auto i:p){trace2(i.f,i.s);}
  for(ll i=0;i<n;i++)
  {
    sum+=p[i].f;
    if(sum>p[i].s){cout<<"No"<<endl;exit(0);}
  }
  cout<<"Yes"<<endl;
}


Measured memory_bytes: 3328