akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int,int>;

const int MAX = 2100000;
const int MOD = 1000000007;

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

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

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



int main() {
  int s;
  cin >> s;
  int a = s/3;
  COMinit();
  int res=0;
  rep(i,a){
    int p = s-(i+1)*3;
    res+=COM(i+p,p);
    res%=MOD;
  }
  cout << res << endl;
  return 0;
}


Measured memory_bytes: 52776
"use strict"
const create = () => {
    const input = require("fs").readFileSync("/dev/stdin", "utf8").trim().split("\n");
    const res = {
        "list": input, "index": 0, "max": input.length,
        "hasNext": function() {return this.index < this.max},
        "next": function() { if (!this.hasNext()) {throw "ArrayIndexOutOfBoundsException";}else{return this.list[this.index++];}}
    };
    return res;
}
const o = create();
const next = () => o.next()
const nextInt = () => parseInt(o.next())
const nextStrArray = () => o.next().split(" ")
const nextIntArray = () => o.next().split(" ").map(el => parseInt(el))
const nextCharArray = () => o.next().split("")
const hasNext = () => o.hasNext()
const myout = (...x) => console.log(...x)
const Main = () => {
    const N = nextInt()
    const P = nextIntArray()
    let min = P[0]
    let cnt = 0
    for(let el of P){
        if(el <= min){
            cnt++
        }
        min = Math.min(min, el)
    }
    console.log(cnt)
}
Main()


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

typedef long long ll;
typedef long double ld;
typedef pair<int, int> ii;
typedef pair<int, ii> iii;
typedef pair<ii, int> ri3;
#define mp make_pair
#define pb push_back
#define fi first
#define sc second
#define SZ(x) (int)(x).size()
#define ALL(x) begin(x), end(x) 
#define REP(i, n) for (int i = 0; i < n; ++i) 
#define FOR(i, a, b) for (int i = a; i <= b; ++i)
#define RFOR(i, a, b) for (int i = a; i >= b; --i)

int main() {
    //freopen("in.txt", "r", stdin);
    ios::sync_with_stdio(false);
    cin.tie(0);

    int n, k; cin >> n >> k;
    int a[n]; FOR(i,0,n-1) cin >> a[i];

    const int mod = 1e9+7;
    int dp[2][k+1], pre[2][k+1];

    dp[n&1][0] = pre[n&1][0] = 1;
    FOR(x,1,k) dp[n&1][x] = 0, pre[n&1][x] = 1;
    RFOR(i,n-1,0) FOR(x,0,k) {
        dp[i&1][x] = pre[i&1^1][x];
        if (a[i] < x) dp[i&1][x] = (dp[i&1][x] + mod - pre[i&1^1][x-a[i]-1]) % mod;

        pre[i&1][x] = dp[i&1][x];
        if (x > 0) pre[i&1][x] = (pre[i&1][x] + pre[i&1][x-1]) % mod;
    }
    cout << dp[0][k] << '\n';
}



Measured memory_bytes: 1792
#[allow(unused_macros)]
macro_rules! input {
    ( source = $ s : expr , $ ( $ r : tt ) * ) => { let mut iter = $ s . split_whitespace ( ) ; let mut next = || { iter . next ( ) . unwrap ( ) } ; input_inner ! { next , $ ( $ r ) * } };
    ( $ ( $ r : tt ) * ) => { let stdin = std :: io :: stdin ( ) ; let mut bytes = std :: io :: Read :: bytes ( std :: io :: BufReader :: new ( stdin . lock ( ) ) ) ; let mut next = move || -> String { bytes . by_ref ( ) . map ( | r | r . unwrap ( ) as char ) . skip_while ( | c | c . is_whitespace ( ) ) . take_while ( | c |! c . is_whitespace ( ) ) . collect ( ) } ; input_inner ! { next , $ ( $ r ) * } };
}
#[allow(unused_macros)]
macro_rules! input_inner {
    ( $ next : expr ) => { };
    ( $ next : expr , ) => { };
    ( $ next : expr , $ var : ident : $ t : tt $ ( $ r : tt ) * ) => { let $ var = read_value ! ( $ next , $ t ) ; input_inner ! { $ next $ ( $ r ) * } };
}
#[allow(unused_macros)]
macro_rules! read_value {
    ( $ next : expr , ( $ ( $ t : tt ) ,* ) ) => { ( $ ( read_value ! ( $ next , $ t ) ) ,* ) };
    ( $ next : expr , [ $ t : tt ; $ len : expr ] ) => { ( 0 ..$ len ) . map ( | _ | read_value ! ( $ next , $ t ) ) . collect ::< Vec < _ >> ( ) };
    ( $ next : expr , chars ) => { read_value ! ( $ next , String ) . chars ( ) . collect ::< Vec < char >> ( ) };
    ( $ next : expr , usize1 ) => { read_value ! ( $ next , usize ) - 1 };
    ( $ next : expr , $ t : ty ) => { $ next ( ) . parse ::<$ t > ( ) . expect ( "Parse error" ) };
}

fn main() {
    input!{
        n: usize,
        k: usize,
    };
    println!("{}", n - k + 1);
}


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

int main(){
    int h, w, k;
    cin >> h >> w >> k;
    vector<string> c(h);
    rep(i, h) cin >> c[i];

    int ans=0, cnt=0;
    for(int i=0; i<(1<<h); i++){
        for(int j=0; j<(1<<w); j++){
            cnt = 0;
            for(int m=0; m<h; m++){
                for(int n=0; n<w; n++){
                    if(i & (1<<m) || j & (1<<n)) continue;
                    if(c[m][n] == '#') cnt++;
                }
            }
            if(cnt == k) ans++;
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3600
//do not think about past and stay in this moment
//organize and work - Abhinav IIITA
#include <bits/stdc++.h>
#include <ctime>
using namespace std;
#define int long long
#define ld long double
#define sz(v) ((int)(v).size())
#define all(v) (v).begin(),(v).end() 
const ld pi = acos(-1.0);
const int day[12] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());


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

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

void solve(){
	int a,b,c;
	cin>>a>>b>>c;
	bool fg=false;
	if((a==b) && (b==c))
	fg=true;
	if(fg)
	cout<<"Yes";
	else
	cout<<"No";
	
}


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


int32_t main()
{
	ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0); 	
	int t=1;
	//cin>>t;
	while(t--)
	solve();
	return 0;
}


Measured memory_bytes: 256
import numpy as np

H,W = map(int,input().split())
# 周りに壁を、0,1化、壁を0で持つ
grid = np.zeros((H+2,W+2),dtype=np.bool)
grid[1:-1,1:-1] = (np.array([list(input()) for _ in range(H)]) == '.')

L = grid.size

# x軸方向の集計
def F(transpose):
  x = grid
  if transpose:
    x = x.T
  x = np.ravel(x) # to 1D array
  
  left_zero = -np.arange(L) # 左の壁のindexの-1倍
  left_zero[x] = 0
  np.minimum.accumulate(left_zero, out=left_zero)
  
  right_zero = np.arange(L) # 逆順ソートした上で左の壁のindex
  right_zero[x[::-1]] = 0
  np.maximum.accumulate(right_zero, out=right_zero)
  
  y = left_zero
  y -= right_zero[::-1]
  
  return y.reshape(grid.T.shape).T if transpose else y.reshape(grid.shape)
  
answer = (F(False) + F(True)).max()+2*L-5
print(answer)


Measured memory_bytes: 127852
#include<iostream>
using namespace std;
bool a[1000000];
int n,ans,x;
int main(){
	cin>>n;
	for(int i=1;i<=n;i++) a[i]=false;
	for(ans=1;ans>0;ans++){
		x=(10*x+7)%n;
		if(x==0){
			cout<<ans;
			return 0;
		}
		if(a[x]){
			cout<<-1;
			return 0;
		}
		a[x]=true;
	}
}

Measured memory_bytes: 4588
#pragma region header
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep1(i, n) for (int i = 1; i <= (int)(n); i++)
#define rev(i, n) for(int i = (int)(n - 1); i >= 0; i--)
#define rev1(i, n) for(int i = (int)(n); i > 0; i--)
#define pb push_back
#define all(v) (v).begin(), (v).end()
#define resort(v) sort((v).rbegin(), (v).rend())
#define vi vector<int>
#define vvi vector<vector<int>>
#define vc vector<char>
#define vvc vector<vector<char>>
#define vb vector<bool>
#define vvb vector<vector<bool>>
using ll = long long;
using P = pair<int, int>;
/* ----------------よく使う数字や配列----------------- */
int dx[] = {1,0,-1,0};
int dy[] = {0,1,0,-1};
constexpr ll mod = 1e9+7;
constexpr ll inf = INT32_MAX/2;
constexpr ll INF = LLONG_MAX/2;
constexpr long double eps = DBL_EPSILON;
constexpr long double pi = 3.141592653589793238462643383279;
/* ----------------------end----------------------- */

/* --------------------テンプレート------------------ */
template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
/* ----------------------end----------------------- */

/* --------------------ライブラリ-------------------- */
ll fact(int i) {       //階乗
    if (i == 0) return 1;
    return (fact(i - 1)) * i;
}
ll gcd(ll a, ll b) {        //最大公約数
    if(b == 0) return a;
    return gcd(b, a % b); 
}
ll lcm(ll a, ll b) {      //最小公倍数
    return a * b / gcd(a, b);
}
int keta(ll n) {        //桁数を求める
    if(n == 0) return 1;
    int count = 0;
    while(n != 0) {
        n /= 10;
        count++;
    }
    return count;
}
ll ketasum(ll n) {    //各桁の和
    ll sum = 0;
    while(n != 0) {
        sum += n % 10;
        n /= 10;
    }
    return sum;
}
/* ----------------------end----------------------- */
#pragma endregion
int main() {
    int n;cin >> n;
    vvi v(n, vi(3));
    rep(i, n) cin >> v[i][0] >> v[i][1] >> v[i][2];
    rep(i, n) {
        if(v[i][0]%2!=(v[i][1]+v[i][2])%2) {
            cout << "No" << endl;
            return 0;
        }
        if(v[i][0] < v[i][1]+v[i][2]) {
            cout << "No" << endl;
            return 0;
        }
        if(i>0) {
            if(abs(v[i][0]-v[i-1][0])<abs(v[i][1]+v[i][2]-v[i-1][1]-v[i-1][2])) {
                cout << "No" << endl;
                return 0;
            }
        }
    }
    cout << "Yes" << endl;
    return 0;
}

Measured memory_bytes: 8632
// In the name of GOD
#include<bits/stdc++.h>
using namespace std;

#define debug(x) cout<<#x<<" :: "<<x<<"\n";
#define debug2(x,y) cout<<#x<<" :: "<<x<<"\t"<<#y<<" :: "<<y<<"\n";
#define debug3(x,y,z) cout<<#x<<" :: "<<x<<"\t"<<#y<<" :: "<<y<<"\t"<<#z<<" :: "<<z<<"\n";

#define     IOS         ios::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define 	setprecn(x) cout<<fixed<<setprecision(x);
#define 	ll          long long int
#define 	pb          push_back
#define 	pll         pair<ll,ll>
#define 	vll         vector<ll>
#define 	ff          first
#define 	ss          second
#define 	all(a)      (a).begin(),(a).end()
#define 	sz(x)       (ll)x.size()
#define 	mod         1000000007
#define 	inf         10000000000000007
#define 	rep(i,n)    for(ll i=0;i<n;i++)
#define 	repe(i,a,b) for(ll i=a;i<b;i++)
#define 	lbnd        lower_bound
#define 	ubnd        upper_bound
#define 	bs          binary_search

ll power(ll a,ll b,ll m=mod)
{
	if(b==0)
		return 1;
	if(b==1)
		return a;
	ll c=power(a,b/2,m);
	if(b%2==0)
		return((c%m)*(c%m))%m;
	return ((((c%m)*(c%m))%m)*(a%m))%m;
}

/********************************************************/
//	d.erase(unique(all(d)), d.end());




int main()
{
	IOS;
	ll n,k,m,i,j,c=0,cs=0,t;
	t=1;

	// cin>>t;
	string s;
	while(t--)
	{
		// reverse(a.begin(),a.end());
		cin>>n;
		// n=s.length();
		ll a[n],b[n];
		k=1;
		rep(i,n)
		{
			cin>>a[i];
			c=c+(k*a[i]);
			k=-k;
		}
		b[0]=c;
		rep(i,n-1)
		{
			b[i+1]=2*a[i]-c;
			c=b[i+1];
		}
		for(auto c:b)
			cout<<c<<" ";
		
		if(t!=0)
	   		cout<<"\n";
	}
	return 0;
}

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

int main() {
  int N;
  cin>>N;
  vector<int> d(N);
  long ans=0;
  for(int i=0;i<N;i++) cin>>d[i];
  for(int i=0;i<N-1;i++){
    for(int j=i+1;j<N;j++){
      ans += d[i]*d[j];
    }
  }
cout<<ans<<endl;
  }


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0, i##_len = (n); i < i##_len; ++i)
#define rep2(i, x, n) for(int i = x, i##_len = (n); i < i##_len; ++i)
#define all(n) begin(n), end(n)
using ll = long long;
using P = pair<int, int>;
using vi = vector<int>;
using vl = vector<ll>;
using vs = vector<string>;
using vc = vector<char>;
using vb = vector<bool>;
using vd = vector<double>;
vi dir = {-1, 0, 1, 0, -1, -1, 1, 1, -1};

int main() {
  string s;
  cin >> s;
  if(s == "ARC")
    cout << "ABC" << endl;
  else
    cout << "ARC" << endl;
}

Measured memory_bytes: 3628
//#include <bits/stdc++.h>
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstdlib>
#include <string>
#include <vector>
#include <map>
#include <queue>

using namespace std;

typedef long long ll;
typedef vector<int> vint;
typedef vector<vector<int> > vvint;
typedef vector<long long> vll, vLL;
typedef vector<vector<long long> > vvll, vvLL;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) for(int i=0;i<n;++i)
#define mod (ll)(1e9+7)
#define FIX(a) ((a)%mod+mod)%mod
#define ALL(obj) (obj).begin(), (obj).end()
#define rALL(obj) (obj).rbegin(), (obj).rend()
#define INF 1000000000 //1e9
#define LLINF 2000000000000000000LL //2e18
#define fi first
#define se second
#define pb push_back
int dy[]={0, 0, 1, -1};
int dx[]={1, -1, 0, 0};

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    vint x = {1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
    int k;
    cin >> k;
    cout << x[k-1] << endl;;

    return 0;
}

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

int main() {
  int n,d,x;
  cin>>n>>d>>x;
  int a[n],cho=x;
  for(int i=0;i<n;i++)
    cin>>a[i];
  for(int i=0;i<n;i++){
    for(int j=0; j*a[i]+1<=d;j++)
      cho++;
  }
  cout<<cho;
    
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <queue>
#include <cmath>
#include <climits>
#include <iomanip>
#include <set>
#include <map>
using namespace std;
typedef long long ll;
int main(){
  string a,b;
  cin >> a >> b;
  int res = 0;
  for(int i = 0;i < 3;i++){
    if(a[i] == b[i])res++;
  }
  cout << res << endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
using Graph = vector<vector<int>>;
#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 RRep(i, k, n) for (int i = k; i > (int)(n); i--)
#define COUT(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl
#define ALL(a)  (a).begin(),(a).end()
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const long long INF = 1LL << 60;
const int MOD = 1000000007;
const double PI = acos(-1); //3.14~
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

struct modint {
  long long val;
  modint(long long val=0) : val((val % MOD + MOD) % MOD){}
  modint operator-() const { return modint(-val); }
  modint& operator+=(const modint a) { if ((val += a.val)     >= MOD) val -= MOD; return *this; }
  modint& operator-=(const modint a) { if ((val += MOD-a.val) >= MOD) val -= MOD; return *this; }
  modint& operator*=(const modint a) { (val *= a.val) %= MOD; return *this; }
  modint operator+(const modint a) const { return (modint)*this += a; }
  modint operator-(const modint a) const { return (modint)*this -= a; }
  modint operator*(const modint a) const { return (modint)*this *= a; }
  modint pow(long long n) const { modint r(1), m(val); while (n > 0) { if (n & 1) {r *= m;} m *= m; n >>= 1; } return r; }
  modint inv() const { return pow(MOD-2); }
  modint& operator/=(const modint a) { return (*this) *= a.inv(); }
  modint operator/(const modint a) const { return (modint)*this /= a; }
  bool operator==(const modint &p) const { return val == p.val; }
  bool operator!=(const modint &p) const { return val != p.val; }
  friend ostream &operator<<(ostream &os, const modint &p) { return os << p.val; }
  friend istream &operator>>(istream &is, modint &a) { long long t; is >> t; a = modint(t); return (is); }
};

modint nCr(modint n, int r) {
  /* O(r) */
  modint c = 1;
  for(int i=1; i<=r; i++) c *= (n-i+1) / i;
  return c;
}

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

    Rep(i, 1, k + 1)
    {
        int tmp = n - k + 1;
        cout << nCr(k - 1, i - 1) * nCr(tmp, i) << endl;
    }
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
#define all(v) v.begin(), v.end()
using in = int64_t;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
const double PI=3.14159265358979323846;
const int64_t waru = 1000000007;
const in INF=1<<30;
#define vec2(a,y,x) vector<vector<int>> a(y,vector<int>(x))
#define vec1(a,n) vector<int> a(n);rep(i,n)cin>>a[i]

bool belong(vector<int> a,int x){
  for(auto y:a){
  	if(y==x) return true;
  }
  return false;
}

int main(){
  int n,m;cin>>n>>m;
  int dai,nyu;
  vec2(tree,n,0);
  rep(i,m){
    cin>>dai>>nyu;
    dai --;nyu --;
    tree[dai].push_back(nyu);
    tree[nyu].push_back(dai);
  }
  vector<int> x(0);
  rep(i,n) x.push_back(i);
  sort(all(x));
  int cnt =0;
  

  do{
    bool flag =true;
    if(x.at(0)!=0) break;
    rep(i,n-1){
      if(!belong(tree[x[i]],x[i+1])){flag=false;break;}
    }
    if(flag) cnt ++;
  }while(next_permutation(all(x)));
cout<<cnt<<endl;
}


Measured memory_bytes: 256
import java.util.*;

public class Main {

    public static void main(String args[]) {


        Scanner scan = new Scanner(System.in);
        int n = scan.nextInt();
        int[] line = new int[n];
        int sum = 0;

        for (int i = 0; i<n; i++) {
            int a = scan.nextInt();
            line[i] = a;
        }

        for (int i = 0; i<n; i++) {
            int a = line[i];

            for (int j = i+1; j<n; j++) {
                int b = line[j];

                if (a==b) {
                    continue;
                }

                for (int k = j+1; k<n; k++) {

                    int c = line[k];

                    if (a==c || b==c) {
                        continue;
                    }

                    if (a + b > c && a + c > b && b + c >a) {
                        sum++;
                    }

                }
            }
        }

        System.out.println(sum);
    }
}

Measured memory_bytes: 36752
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
using vi = vector<int>;
using vl = vector<ll>;
#define rep(i, n) for(ll i = 0;i < n;i++)
#define all(i) i.begin(), i.end()
template<class T, class U> bool cmax(T& a, U b) { if (a<b) {a = b; return true;} else return false; }
template<class T, class U> bool cmin(T& a, U b) { if (a>b) {a = b; return true;} else return false; }

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

  int n;
  cin >> n;
  vi d(n);
  rep(i, n) {
    cin >> d[i];
  }

  ll sum = 0;
  rep(i, n) {
    for (int j = i+1; j < n; j++) {
      sum += d[i] * d[j];
    }
  }
  cout << sum << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <map>
typedef long long ll;
using namespace std;
int main(void){
    int n;
    cin>>n;
    vector<pair<int,int>>red(n);
    vector<pair<int,int>>blue(n);
    for(int i=0;i<n;i++){
        cin>>red[i].first>>red[i].second;
    }
    for(int i=0;i<n;i++){
        cin>>blue[i].first>>blue[i].second;
    }
    sort(red.begin(),red.end());
    sort(blue.begin(),blue.end());
    vector<bool>used_j(n,false);
    int ans=0;
    for(int i=0;i<n;i++){
        int x=blue[i].first;
        int y=blue[i].second;
        int max_y=-10000;
        int index=-1;
        for(int j=0;j<n;j++){
            if(red[j].first<x&red[j].second<y&used_j[j]==false){
                if(red[j].second>max_y){
                    max_y=red[j].second;
                    index=j;
                }
            }
        }
        if(index!=-1){
            ans++;
            used_j[index]=true;
        }
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
	ios::sync_with_stdio(0);
	cin.tie(0);cout.tie(0);
	long long n,a,b;
	cin>>n>>a>>b;
	cout<<n/(a+b)*a+min(n%(a+b),a)<<"\n";
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <string>
#include <string.h>
#include <stdlib.h>
#include <math.h>
#include <vector>
#include <queue>

using namespace std;

/////////////         modの計算

int mod = 1000000007;

long long mod_adjust(long long a) {//	余りをとる(0～mod-1に調整する)
	if (a > mod) {
		return a % mod;
	}
	if (a < 0) {
		a *= -1;
		a %= mod;
		return mod - a;
	}
	return a;
}
int mod_adjust(int a) {//	余りをとる(0～mod-1に調整する)
	return (int)mod_adjust((long long)a);
}
int mod_add(int a, int b) {//	足し算
	a = mod_adjust(a), b = mod_adjust(b);
	long long k = a % mod; k += b % mod; k %= mod;
	return (int)k;
}
int mod_sub(int a, int b) {//	引き算
	return mod_add(a, -b);
}
int mod_multi(int a, int b) {//	掛け算
	long long k = mod_adjust((long long)a); k *= mod_adjust((long long)b); k %= mod;
	return (int)k;
}
int mod_inv(int a) {//	逆元
	a = mod_adjust(a);
	if (a == 1) { return 1; }
	long long p = mod, q = a, m = 0, n = 1, r, c;

	while (q > 1) {
		r = p % q;
		c = p / q;
		c = mod_adjust(m - n * c);
		p = q, m = n, q = r, n = c;
	}
	return n;
}
int mod_div(int a, int b) {//	割り算
	return mod_multi(a, mod_inv(b));
}
int mod_pow(int x, int n) {//	累乗(logNオーダーなので速い)
	x = mod_adjust(x);
	n = n % (mod - 1);
	if (n < 0) {
		return mod_pow(mod_div(1, x), -n);
	}
	if (n == 0) {
		return 1;
	}
	if (n == 1) {
		return mod_adjust(x);
	}
	if (n % 2 == 0) {
		int k = mod_pow(x, n / 2);
		return mod_multi(k, k);
	}
	else {
		int k = mod_pow(x, n / 2);
		return mod_multi(mod_multi(k, k), x);
	}
}

int main() {
	string L; cin >> L;
	int d = L.length();

	int sum = 0;

	int k = 0;
	for (int i = 0; i < d; i++) {
		if (L[i] == '1') {
			sum = mod_add(sum, mod_multi(mod_pow(3, d - 1 - i), mod_pow(2, k)));
			k++;
		}
	}

	sum = mod_add(sum, mod_pow(2, k));

	cout << sum << endl;

	return 0;
}


Measured memory_bytes: 512
#include<bits/stdc++.h>
using namespace std;
const int a=90;
const int b=90;
int bx[4]={0,0,1,-1};
int by[4]={1,-1,0,0};
int ansn=0;
int tansa(int y,int x,int tebl[a][b],int my,int nx,int k){
	tebl[y][x]=0;
	int nk=k;
	for(int i=0;i<4;i++){
		if(y+by[i]<my&&y+by[i]>=0&&x+bx[i]<nx&&x+bx[i]>=0&&tebl[y+by[i]][x+bx[i]]==1){
			k=max(k,tansa(y+by[i],x+bx[i],tebl,my,nx,nk+1));
		}
	}
	tebl[y][x]=1;
	return k;
}
int main(){
	int n,m,ans=0;
	int k=0;
	while(true){
		int ans=0;
		cin>>n>>m;
		if(n==0&&m==0){
			break;
		}
		int tebl[a][b];
		for(int i=0;i<m;i++){
			for(int j=0;j<n;j++){
				cin>>tebl[i][j];
			}
		}
		for(int i=0;i<m;i++){
			for(int j=0;j<n;j++){
				if(tebl[i][j]==1){
					ans=max(ans,tansa(i,j,tebl,m,n,k+1));
				}
			}
		}
		printf("%d\n",ans);
	}
}
	


Measured memory_bytes: 3100
// clang-format off
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define loop(i, a, n) for (int i = (a); i < (n); i++)
#define rep(i, n) loop(i, 0, n)
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define prec(n) fixed << setprecision(n)
constexpr int INF = sizeof(int) == sizeof(long long) ? 1000000000000000000LL : 1000000000;
constexpr int MOD = 1000000007;
constexpr double PI = 3.14159265358979;
template<typename A, typename B> bool cmin(A &a, const B &b) { return a > b ? (a = b, true) : false; }
template<typename A, typename B> bool cmax(A &a, const B &b) { return a < b ? (a = b, true) : false; }
bool odd(const int &n) { return n & 1; }
bool even(const int &n) { return ~n & 1; }
template<typename T> int len(const T &v) { return v.size(); }
template<typename T = int> T in() { T x; cin >> x; return x; }
template<typename T = int> T in(T &&x) { T z(forward<T>(x)); cin >> z; return z; }
template<typename T> istream &operator>>(istream &is, vector<T> &v) { for (T &x : v) is >> x; return is; }
template<typename A, typename B> istream &operator>>(istream &is, pair<A, B> &p) { return is >> p.first >> p.second; }
template<typename T> ostream &operator<<(ostream &os, const vector<vector<T>> &v) { int n = v.size(); rep(i, n) os << v[i] << (i == n - 1 ? "" : "\n"); return os; }
template<typename T> ostream &operator<<(ostream &os, const vector<T> &v) { int n = v.size(); rep(i, n) os << v[i] << (i == n - 1 ? "" : " "); return os; }
template<typename A, typename B> ostream &operator<<(ostream &os, const pair<A, B> &p) { return os << p.first << ' ' << p.second; }
template<typename Head, typename Value> auto vectors(const Head &head, const Value &v) { return vector<Value>(head, v); }
template<typename Head, typename... Tail> auto vectors(Head x, Tail... tail) { auto inner = vectors(tail...); return vector<decltype(inner)>(x, inner); }
// clang-format on

main() {
  int n = in();
  vector<int> a(n);
  cin >> a;
  int q = in();
  while (q--) cout << binary_search(all(a), in()) << endl;
}



Measured memory_bytes: 3620
local mce, mma = math.ceil, math.max
local ior = io.input()
local n = ior:read("*n")
local c, s, f = {}, {}, {}
for i = 1, n - 1 do
  c[i], s[i], f[i] = ior:read("*n", "*n", "*n")
end
for i = 1, n - 1 do
  local time = 0
  for j = i, n - 1 do
    local ridetime = mma(s[j], f[j] * mce(time / f[j]))
    time = ridetime + c[j]
  end
  print(time)
end
print(0)


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cctype>
 
using namespace std;
 
int main(void){
    char x;
    while(1){
        x = getchar();
        if(islower(x))
            x = toupper(x);
        else if(isupper(x))
            x = tolower(x);
        cout<<x;
        if(x=='\n')
            break;
    }
 
  return 0;
}

Measured memory_bytes: 1084
fun main(args: Array<String>) {
    val (w, h, x, y) = readLine()!!.split(" ").map { it.toDouble() }

//    fun isOnDiag(): Boolean{
//        if ( (-1 * h / w) == ((y-h) / x)) {
//            return true
//        }
//
//        if (h/w == y/x) {
//            return true
//        }
//
//        return false
//    }


//    // 長方形内部
//    if (x != w && y != h) {
//
//        if ( x == w/2 || y == h/2 || isOnDiag()) {
//            println("${w*h/2} 1")
//        }
//
//    }

    if ( x == w/2 && y == h/2) {
        println("${w*h/2} 1")
    } else {
        println("${w*h/2} 0")
    }
}

Measured memory_bytes: 37776
import sys
from copy import copy
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

in_n = lambda: int(readline())
in_nn = lambda: map(int, readline().split())
in_s = lambda: readline().rstrip().decode('utf-8')
in_nl = lambda: list(map(int, readline().split()))
in_nl2 = lambda H: [in_nl() for _ in range(H)]
in_map = lambda: [s == ord('.') for s in readline() if s != ord('\n')]
in_map2 = lambda H: [in_map() for _ in range(H)]
in_all = lambda: map(int, read().split())


def main():

    N, W = in_nn()
    wv = in_nl2(N)

    dp = [0] * (W + 1)

    for i in range(N):

        next_dp = copy(dp)
        for j in range(W):
            w, v = wv[i]
            if j + w <= W:
                next_dp[j + w] = max(next_dp[j + w], dp[j] + v)
            else:
                break
        dp = next_dp

    print(dp[W])


if __name__ == '__main__':
    main()


Measured memory_bytes: 146536
import java.util.Scanner;
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int X = sc.nextInt();
        if(X == 7) {
            System.out.println("YES");
        } else if(X == 5) {
            System.out.println("YES");
        } else if(X == 3) {
            System.out.println("YES");
        } else {
            System.out.println("NO");
        }
    }
}

Measured memory_bytes: 21844
#include<stdio.h>
int main(void)
{
	int n,a,i,s,flg;
	while(1){
		flg=0;
		scanf("%d",&n);
		if(n==0) break;
		s=n;
		for(i=0;i<n;i++){
			scanf("%d",&a);
			if(a==0) s-=1;
			if(a>=2) flg=1;
		}	
		if(flg==1) printf("%d\n",s+1);
		else printf("NA\n");
	}
	return 0;
}	

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

#if __has_include("print.hpp")
  #include "print.hpp"
#endif

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define ALL(x) (x).begin(), (x).end()
#define RALL(x) (x).rbegin(), (x).rend()
#define MOD 1000000007

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


int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  string s, t;
  cin >> s >> t;
  int res = 0;
  for (int i = 0; i < 3; i++) {
    if(s[i] == t[i]) res++;
  }
  cout << res << endl;
}


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

template<typename T>
void out(T x) { cout << x << endl; exit(0); }

const int maxn = 1e6 + 11;

int main() {

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

    int a[6];
    for (int i = 1; i <= 5; i++) {
        cin >> a[i];
    }

    for (int i = 1; i <= 5; i++) {
        if (a[i] == 0) out(i);
    }
    
    
    
    return 0;
}


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

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

int main() {

    ll N,M;
    cin >> N >> M;
    
    vector<int> oks(N+1,true);
    rep(i,M){
        int a;
        cin >> a;
        oks[a] = false;
    }

    vector<ll> dp(N+1,0);
    dp[0] = 1;
    if(oks[1])  dp[1] = 1;  // 1段目がtrue
    else        dp[1] = 0;  // 1段目がfalse
    
    for(int i=2; i<=N; i++){
        if(oks[i]){
            dp[i] = dp[i-2] + dp[i-1];
            dp[i] %= 1000000007LL;
        }
    }

    cout << dp[N] << endl;

    return 0;
}


Measured memory_bytes: 1408
#include <iostream>
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxn =1e5+50;
int poss[4][2]= {1,1,1,2,2,1,2,2};
int b[maxn];
char str[maxn];
char ans[maxn];
int n;
bool flag=0;
bool check()
{
    for(int i=1; i<=n; i++)
    {
        int left=i-1;
        int right=i+1;
        if(i==1)
            left=n;
        if(i==n)
            right=1;
        if(b[i]==1)
        {
            if(str[i]=='o'&&b[left]!=b[right])
            {
                return false;
            }
            else if(str[i]=='x'&&b[left]==b[right])
            {
                return false;
            }
        }
        else
        {
            if(str[i]=='o'&&b[left]==b[right])
                return false;
            else if(str[i]=='x'&&b[left]!=b[right])
                return false;
        }
    }
    return 1;
}
void solve()
{
    for(int i=0; i<4; i++)
    {
        bool flag1=0;
        b[1]=poss[i][0];
        b[2]=poss[i][1];
        for(int j=2; j<=n; j++)
        {
            int k;
            if(b[j]==1)
            {
                if(str[j]=='o')
                {
                    b[j+1]=b[j-1];
                    k=1;
                }
                else
                {
                    if(b[j-1]==1)
                        b[j+1]=2;
                    else
                        b[j+1]=1;
                    k=2;
                }
            }
            else
            {
                if(str[j]=='o')
                {
                    if(b[j-1]==1)
                        b[j+1]=2;
                    else
                    {
                        b[j+1]=1;
                    }
                    k=3;
                }
                else
                {
                    b[j+1]=b[j-1];
                    k=4;
                }
            }
            //cout << b[j] << endl;
            //cout << k << " " << b[j+1]<<endl;

        }
        /*for(int i=1; i<=n; i++)
        {
            printf("%d",b[i]);
        }
        printf("\n");
        cout << i <<endl;*/
        flag1=check();
        if(flag1)
        {
            //cout << 1<< endl;
            for(int i=1;i<=n;i++)
            {
               if(b[i]==1)
               {
                   printf("S");
               }
               else
               {
                   printf("W");
               }
            }
            printf("\n");
            flag=1;
            return ;
        }
    }
}
int main()
{
    cin>>n;
    scanf("%s",str+1);
    solve();
    if(!flag)
        cout << -1 << endl;
    return 0;
}



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

int main() {

  int input;
  int count = 1;
  
  for(;;) {
    scanf("%d", &input);
    if( input == 0 ) break;
    printf("Case %d: %d\n", count, input);
    count += 1;
  }
  
  
  return 0;
}

Measured memory_bytes: 1172
import java.io.*;
import java.util.*;
public class Main{
    public static void main(String[] args){
        Deque<String> formula = new ArrayDeque<String>();
        Scanner scan = new Scanner(System.in);
        while(scan.hasNext()){
            String input = scan.next();
            if(input.equals("+")) input = String.valueOf(Integer.parseInt(formula.poll())+Integer.parseInt(formula.poll()));
            else if(input.equals("-")) input = String.valueOf(-1*Integer.parseInt(formula.poll())+Integer.parseInt(formula.poll()));
            else if(input.equals("*")) input = String.valueOf(Integer.parseInt(formula.poll())*Integer.parseInt(formula.poll()));
            formula.push(input);
        }
        System.out.println(formula.poll());
    }
}

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

using namespace std;
#define sz(a) (int)(a).size()
#define rep(i, a, b) for (int i = (a), _b = (b); i < _b; ++i)
#define frep(i, a, b) for (int i = (a), _b = (b); i <= _b; ++i)
#define debug(a) cerr << #a << ": " << (a) << '\n';
#define debug_two(a, b) cerr << #a << ": " << (a) << ", " << #b << ": " << (b) << '\n';

typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> ii;
typedef pair<ii, int> iii;
typedef vector<ii> vii;

const int INF = 1000000000 + 7;
const ll LL_INF  = 1ll * INF * INF;
const int MAX_N = 100000 + 7;

template <typename T>
inline void addmod(T& a, const ll& b, const int& MOD = INF) {
	a = (a + b) % MOD; if (a < 0) a += MOD;
}

vii edges;

void addEdge(int u, int v) {
	edges.push_back({ u, v });
}

void solve() {
	string s;
	cin >> s;
	int n = sz(s);
	if (s[n - 1] == '1' || s[0] == '0') {
		cout << -1;
		return;
	}
	for (int i = 0; i <= n - 2; ++i) {
		if (s[i] != s[n - 2 - i]) {
			cout << -1;
			return;
		}
	}
	
	int k = (n - 2) / 2;
	int last = 0;
	rep(i, 0, k) {
		addEdge(last, i + 1);
		if (s[i] == '1')
			last = i + 1;
	}
	
	if (n & 1) {
    if (s[k] == '1') {
      for (int i = 0, _m = sz(edges); i < _m; ++i) {
        addEdge(n - 1 - edges[i].first, n - 1 - edges[i].second);
      }
      addEdge(last, k + 1);
      addEdge(k + 1, n - 1 - last);
    } else {
      for (int i = 0, _m = sz(edges); i < _m; ++i) {
        int u = edges[i].first, v = edges[i].second;
        if (v == last) swap(u, v);
        if (u == last) {
          u = n - 2 - u;
        }
        addEdge(n - 2 - u, n - 2 - v);
      }
      addEdge(last, n - 1);
      addEdge(last, n - 2 - last);
    }
	} else {
		if (s[n / 2 - 1] == '1') {
			for (int i = 0, _m = sz(edges); i < _m; ++i) {
				addEdge(n - 1 - edges[i].first, n - 1 - edges[i].second);
			}
			addEdge(last, n - 1 - last);
		} else {
			for (int i = 0, _m = sz(edges); i < _m; ++i) {
				int u = edges[i].first, v = edges[i].second;
				if (v == last) swap(u, v);
				if (u == last) {
          u = n - 1 - u;
        }
        addEdge(n - 1 - u, n - 1 - v);
			}
      addEdge(last, n - 1 - last);
		}
	}
	
	for (auto& p : edges) {
		cout << p.first + 1 << ' ' << p.second + 1 << '\n';
	}
}

int main() {
	ios_base::sync_with_stdio(0); cin.tie(0);
#ifdef _LOCAL_
	freopen("in.txt", "r", stdin);
	//freopen("out.txt", "w", stdout);
#endif
	const bool multiple_test = false;
	int test = 1;
	if (multiple_test)
		cin >> test;
	
	for(int i = 0; i < test; ++i) {
		//printf("Case #%d: ", i + 1);
		solve();
	}
#ifdef _LOCAL_
	cerr << "\n" << 1.0 * clock() / CLOCKS_PER_SEC << "\n";
#endif
}


Measured memory_bytes: 2372
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace test
{
    class Program
    {
        static void Main(string[] args)
        {
            int[] a = Console.ReadLine().Split().Select(int.Parse).ToArray();
            Console.WriteLine(a[0] * a[1] > a[2] * a[3] ? a[0] * a[1] : a[2] * a[3]);

        }
    }
}


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

using namespace std;

priority_queue <int> pq;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    int n, m;
    cin >> n >> m;
    for (int i = 0; i < n; i++){
        int sk;
        cin >> sk;
        pq.push(sk);
    }
    while (m > 0){
        int sk = pq.top();
        pq.pop();
        sk /= 2;
        pq.push(sk);
        m--;
    }
    long long ans = 0;
    while (!pq.empty()){
        ans += pq.top();
        pq.pop();
    }
    cout << ans << "\n";
    return 0;
}


Measured memory_bytes: 892
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, srt, end) for (long long i = (srt); i < (long long)(end); i++)
#define VL vector<ll>

int main(){
  ll N, K;  cin >> N >> K;
  ll cnt = 0;
  while(N > 0){
    if(cnt == 0) N -= K;
    else N -= K-1;
    cnt++;
  }
  cout << cnt << endl;
  return 0;
}

Measured memory_bytes: 3628
import java.util.Scanner;

public class Main {

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

	    long a=gl();
	    long b=gl();
	    long c=gl();
	    long k=gl();
	   
        if(k%2==0) {
        	
		    System.out.println(a-b);
        } else {
        	System.out.println(b-a);

        }
	}

	// 文字列として入力を取得
	public static String gs() {
		return scanner.next();
	}

	// intとして入力を取得
	public static int gi() {
		return Integer.parseInt(scanner.next());
	}

	// longとして入力を取得
	public static long gl() {
		return Long.parseLong(scanner.next());
	}

	// doubleとして入力を取得
	public static double gd() {
		return Double.parseDouble(scanner.next());
	}
}

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

namespace TYC
{
	typedef long long ll;
	const int N = 5005;

	int n, A, B, P[N];
	ll F[N];

	void work()
	{
		scanf("%d%d%d", &n, &A, &B);
		for (int i = 1; i <= n; i++)
			scanf("%d", &P[i]);
		P[n + 1] = n + 1;
		memset(F, 0x3f, sizeof(F));
		F[0] = 0;
		for (int i = 1; i <= n + 1; i++)
		{
			int cnt[2] = {0, 0};
			if (P[i - 1] < P[i])
				F[i] = F[i - 1];
			for (int j = i - 1; j; j--)
			{
				cnt[P[j] < P[i]]++;
				if (P[j - 1] < P[i])
					F[i] = min(F[i], F[j - 1] + (ll)cnt[0] * A + (ll)cnt[1] * B);
			}
		}
		printf("%lld\n", F[n + 1]);
	}
}

int main()
{
	TYC::work();
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include<float.h>
using namespace std;
# define ll long long int
#define mm 1000000007
#define pb push_back
int main(){
	ios::sync_with_stdio(false);
  	cin.tie(0); cout.tie(0);
  	ll t,n,i,ans=0,count=0;
    cin>>n;
	ll a[n+5];
	for(i=0;i<n;i++){
		cin>>a[i];
	}
	for(i=1;i<n;i++){
		if(a[i-1] > a[i]){
			cout<<"No";
			return 0;
		}
		if(a[i-1] < a[i]){
            a[i]--;
		}
	}
	cout<<"Yes";
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
const int MN=300000+5;
using namespace std;
typedef long long ll;
template<typename T>inline T&IN(T&in){
	in=0;char c=getchar();int f=1;
	while(!isdigit(c)){if(c=='-')f=-1;c=getchar();}
	while(isdigit(c))in=in*10+c-'0',c=getchar();
	return in*=f;
}
int n,ans;
map<ll,int>s;
ll a[MN],b[MN];
ll pri[MN],vis[MN];
void make(int n){
	for(int i=2;i<=n;++i){
		if(!vis[i])pri[++pri[0]]=i;
		for(int j=1;j<=pri[0]&&pri[j]*i<=n;++j){
			vis[i*pri[j]]=1;
			if(i%pri[j]==0)break;
		}
	}
}
void input(){
	IN(n),make(3000);
	for(int i=1;i<=n;++i){
		IN(a[i]);ll t=a[i];a[i]=b[i]=1;
		for(int j=1;j<=pri[0]&&t!=1;++j)if(t%pri[j]==0){
			int cnt=0;
			while(t%pri[j]==0)t/=pri[j],cnt++;
			cnt%=3;
			if(cnt==1)a[i]*=pri[j],b[i]*=pri[j]*pri[j];
			if(cnt==2)a[i]*=pri[j]*pri[j],b[i]*=pri[j];
		}
		if(t>1){
			ll sqr=sqrt(t);
			if(sqr*sqr==t)a[i]*=t,b[i]*=sqr;
			else a[i]*=t,b[i]*=t*t;
		}
	}
	for(int i=1;i<=n;++i)s[a[i]]++;
	for(int i=1;i<=n;++i)if(s[a[i]]||s[b[i]]){
		if(a[i]==b[i])ans++;
		else ans+=max(s[a[i]],s[b[i]]);
		s[a[i]]=s[b[i]]=0;
	}
	printf("%d\n",ans);
}
int main(){
	input();
	return 0;
}

Measured memory_bytes: 18944
//--- pB ---//
import java.util.*;
import java.lang.*;
import java.io.*;
public class Main {
	public static void main (String[] args) throws java.lang.Exception {
		new Solution();
	}
}
class Solution {
	Reader reader;
	public Solution () {
		reader = new Reader();
		while (reader.hasNext()) {
			run_case();
		}
	}

	private void run_case() {
		int n = reader.ni();
		int m = reader.ni();
		int[] arr = new int[n];
		for (int i=0; i<n; i++) arr[i] = reader.ni();

		int sum = 0;
		for (int u : arr) sum += u;

		double th = (1.0 / (4.0 * m)) * sum;

		int cnt = 0;
		for (int u : arr) {
			if (u >= th) {
				cnt ++;
			}
		}

		if (cnt >= m) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}

		return;
	}
}


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


Measured memory_bytes: 21332
#include <iostream>

using namespace std;
typedef long long ll;
int main()
{
    ll a,b,c,k,sum = 0;
    cin >> a >> b >> c >> k;
    if(a >= k)
    {
        sum += k;
        cout << sum << endl;
    }
    else
    {
        sum += a;
        if(a + b < k)
        {
            sum -= (k - a - b);
        }
        cout << sum << endl;
    }
    return 0;
}


Measured memory_bytes: 3632
#include<bits/stdc++.h>
using namespace std;
int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n; cin >> n;
  int a[4];
  for(int i = 3; i >= 0; i--){
    a[i] = n % 10;
    n /= 10;
  }
  char o[3];
  for(int i = 0; i < (1 << 3); i++){
    int b = a[0];
    for(int j = 0; j < 3; j++){
      if(i >> j & 1){
        b += a[j+1];
        o[j] = '+';
      }
      else{
        b -= a[j+1];
        o[j] = '-';
      }
    }
    if(b == 7){
      cout << a[0] << o[0] << a[1] << o[1] << a[2] << o[2] << a[3] << "=7" << endl;
      return 0;
    }
  }
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
const int MAXN = 3e5 + 5;
typedef long long ll;
template <typename T> void chkmax(T &x, T y) {x = max(x, y); }
template <typename T> void chkmin(T &x, T y) {x = min(x, y); } 
template <typename T> void read(T &x) {
	x = 0; int f = 1;
	char c = getchar();
	for (; !isdigit(c); c = getchar()) if (c == '-') f = -f;
	for (; isdigit(c); c = getchar()) x = x * 10 + c - '0';
	x *= f;
}
int get(int h, int m) {
	return h * 60 + m;
}
int main() {
	int h1, m1, h2, m2, k;
	read(h1), read(m1), read(h2), read(m2), read(k);
	cout << get(h2, m2) - get(h1, m1) - k << endl;
	return 0;
}


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

#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds; 

typedef long long int ll;
typedef long int li;

const ll mod = 1000000007;
const ll inf = 1000000000000000000;

typedef vector<int> vi;
typedef vector<li> vli;
typedef vector<ll> vll;
typedef vector<string> vs;
typedef vector<vi> vvi;
typedef vector<vli> vvli;
typedef vector<vll> vvll;
typedef vector<vs> vvs;
typedef map<ll, ll> mll;
typedef map<ll, string> mls;
typedef map<string, ll> msl;

#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update> 
#pragma GCC optimize ("-O3")
#define FAST ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); 
#define PI 3.14159265358979323846
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define pq priority_queue
#define lb lower_bound
#define ub upper_bound
#define tol(s) transform(s.begin(), s.end(), s.begin(), ::tolower);
#define tou(s) transform(s.begin(), s.end(), s.begin(), ::toupper);
#define all(v) v.begin(), v.end()
#define FOR(i, j, k, in) for(li i=j; i<k; i+=in)
#define RFOR(i, j, k, de) for(li i=j; i>=k; i-=de)
#define rep(i,j,k) FOR(i, j, k, 1)
#define rrep(i,j,k) RFOR(i, j, k, 1)
#define repc(v) for(auto it=v.begin(); it!=v.end(); it++)
#define T ll t; cin>>t; while(t--)

ll gen(){
    ll temp;
    cin>>temp;
    return temp;
}

int main(){
  FAST

  ll n,m;
  cin>>n>>m;
  vll v(m);
  generate(all(v),gen);
  
  ll sum=0;
  rep(i,0,m)
    sum+=v[i];
  
  if(sum>n)
    cout<<-1;
  else
    cout<<n-sum;
  return 0;
}







Measured memory_bytes: 3692
import math

q=int(input())
N=[0]*(10**5+1)
N[3]=1
N[2]=1
S=[]

for i in range(5,10**5+1,2):
    flag=True
    for j in range(3,int(math.sqrt(i))+1,2):
        if i%j==0:
            flag=False
            break
    if flag:
        N[i]=1

X=[0]*(10**5+1)
X[2]=1
cnt=0
for i in range(3,10**5+1,2):
    if N[i]==1 and N[(i+1)//2]==1:
        cnt+=1
    X[i]=cnt
Q=[]
for i in range(q):
    l,r=map(int,input().split())
    Q.append([l,r])

for l,r in Q:
    print(X[r]-X[l-2])
            

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

// @@ !! LIM(mod)
// --> f:gcd mod
// ---- inserted function gcd from util.cc
// g = eGCD(a, b, s, t)  --->  sa + tb = g
constexpr ll eGCD(ll a, ll b, ll& s, ll& t) {
  if (a == 0) {
    s = 0;
    t = 1;
    return b;
  }
  ll u = 0;
  ll g = eGCD(b % a, a, t, u);
  s = u - (b / a) * t;
  return g;
}

constexpr ll gcd(ll a, ll b) {
  ll dummy1 = 0;
  ll dummy2 = 0;
  return eGCD(a, b, dummy1, dummy2);
}
// ---- end gcd
// ---- inserted library file mod.cc

// ll MOD = 1e9 + 7;
ll MOD = 998244353;

struct Fp {
  ll val;

  Fp(ll t = 0) {
    if      (t >= MOD)  val = t % MOD;
    else if (t >= 0)    val = t;
    else if (t >= -MOD) val = t + MOD;
    else {
      ll v = t % MOD;
      if (v == 0) val = 0;
      else        val = v + MOD;
    }
  }

  Fp& operator +=(const Fp& t) {
    val += t.val;
    if (val >= MOD) val -= MOD;
    return *this;
  }

  Fp& operator -=(const Fp& t) {
    val -= t.val;
    if (val < 0) val += MOD;
    return *this;
  }

  Fp& operator *=(const Fp& t) {
    val = (val * t.val) % MOD;
    return *this;
  }

  Fp inv() const {
    if (val == 0) {
      cerr << "inv() is called for zero." << endl;
      exit(1);
    }
    ll u = 0;
    ll v = 0;
    eGCD(val, MOD, u, v);
    return Fp(u);
  }

  Fp& operator /=(const Fp& t) {
    return (*this) *= t.inv();
  }

  Fp operator +(const Fp& t) const { return Fp(val) += t; }
  Fp operator -(const Fp& t) const { return Fp(val) -= t; }
  Fp operator *(const Fp& t) const { return Fp(val) *= t; }
  Fp operator /(const Fp& t) const { return Fp(val) /= t; }
  Fp operator -() const { return Fp(-val); }

  bool operator ==(const Fp& t) const { return val == t.val; }
  bool operator !=(const Fp& t) const { return val != t.val; }
  
  operator ll() const { return val; }

};

class Comb {
  int nMax;
  vector<Fp> vFact;
  vector<Fp> vInvFact;
public:
  Comb(int nm) : nMax(nm), vFact(nm+1), vInvFact(nm+1) {
    vFact.at(0) = 1;
    for (int i = 1; i <= nMax; i++) vFact.at(i) = i * vFact.at(i-1);
    vInvFact.at(nMax) = vFact.at(nMax).inv();
    for (int i = nMax; i >= 1; i--) vInvFact.at(i-1) = i * vInvFact.at(i);
  }
  Fp fact(int n) { return vFact.at(n); }
  Fp comb(int n, int r) {
    return vFact.at(n) * vInvFact.at(r) * vInvFact.at(n-r);
  }
  // The number of permutation extracting r from n.
  Fp perm(int n, int r) {
    return vFact.at(n) * vInvFact.at(n-r);
  }
};

// ---- end mod.cc
// @@ !! LIM  -- end mark --

int main(int argc, char *argv[]) {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  cout << setprecision(20);

  ll N, S; cin >> N >> S;
  vector<vector<Fp>> tbl(N+1, vector<Fp>(S+1));
  Fp ans(0);
  tbl.at(0).at(0) = 1;
  for (ll i = 0; i < N; i++) {
    ll a; cin >> a;
    const auto& prev = tbl.at(i);
    auto& cur = tbl.at(i+1);
    if (a < S) cur.at(a) += i+1;
    if (a == S) ans += (i+1) * Fp(N - i);
    for (ll j = 1; j < S; j++) {
      cur.at(j) += prev.at(j);
      if (j + a < S) cur.at(j+a) += prev.at(j);
      if (j + a == S) ans += prev.at(j) * Fp(N - i);
    }
  }
  cout << ll(ans) << endl;


  return 0;
}



Measured memory_bytes: 70784