akhauriyash/Code-Regression huggingface dataset:
function Main(arg) {
 
    var N = arg.split("\n")[0] - 0;
    var B = arg.split("\n")[1].split(" ");
    B.unshift(B[0]);

    var ans = 0;
    for (var i = 0; i < N-1; i++){
        if (B[i]-0 > B[i + 1]-0) {
            B[i] = B[i + 1];
        }
    }

    for (var i = 0; i < N; i++){
        ans += (B[i] - 0);
    }

    console.log(ans);
}

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

Measured memory_bytes: 21064
n, m = map(int, input().split())
a = list(map(int, input().split()))
a.sort(reverse=True)

# l[i] = (a[j] >= i を満たすjの個数)
l = [n for i in range(a[0]+1)]
for i in range(2, n+1):
    for j in range(a[-i], a[-i+1], -1):
        l[j] = n - i + 1

# 二分探索
# a[i] + a[j] >= x を満たす(i, j)がm組以上存在する最小のxを求める
start = 2 * a[-1]
stop = 2 * a[0]
while start < stop:
    i = (start + stop + 1) // 2
    num = 0
    for j in a:
        if i - j < 0:
            num += n
        elif i - j <= a[0]:
            num += l[i - j]
        else:
            break

    if num >= m:
        start = i
    else:
        stop = i - 1

num = 0
for i in a:
    if start - i < 0:
        num += n
    elif 0 <= start - i <= a[0]:
        num += l[start - i]
    else:
        break

# start <= a[i]+a[j] を満たす a[i]+a[j] を全て足す
ans = 0
for i in a:
    if start - i < 0:
        ans += 2 * i * n
    elif start - i <= a[0]:
        ans += 2 * i * l[start - i]
    else:
        break
ans -= (num - m) * start
print(ans)

Measured memory_bytes: 14380
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll mod=1e9+7;
int main()
{
    ll n,m;
    ll ans=1;
    scanf("%lld%lld",&n,&m);
    if(n-m>1||m-n>1)
    {
        printf("0");
        return 0;
    }

    else if(n!=m)
    {
        for(int i=1;i<=n;i++)
            ans=(ans*(ll)i)%mod;
        for(int i=1;i<=m;i++)
            ans=(ans*(ll)i)%mod;
        printf("%lld",ans);
    }
    else
    {
        for(int i=1;i<=n;i++)
            ans=(ans*(ll)i)%mod;
        ans=(((ans*ans)%mod)*(ll)2)%mod;
        printf("%lld",ans);
    }
}


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

int main()
{
    int w, h, x, y, r;
    cin >> w >> h >> x >> y >> r;

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


Measured memory_bytes: 3104
import java.util.*;
public class Main{   
    public static void main(String[] args){
      Scanner sc = new Scanner(System.in);
      int n = sc.nextInt();
      int[] s = new int[n];
      int sum = 0;
      for(int i = 0;i < n;i++){
        s[i]=sc.nextInt();
        sum += s[i];
      }
      Arrays.sort(s);
      int k = 0;
      if(sum%10==0)
      while(k<=n-1){
      	if(s[k]%10!=0){
          sum -= s[k];
          break;
        }
        k++;
      }
      if(k==n)System.out.println(0);
      else System.out.println(sum);
    }
    public static int lcm(int x, int y){
      return x*y/gcd(x,y);
    }
    public static int gcd(int x, int y){
      if(x < y)return gcd(y,x);
      if(y==0)return x;
      return gcd(y,x%y);
    }
}

Measured memory_bytes: 21460
#include <iostream>
using namespace std;
typedef long long ll;

int main(void)
{
  ll h, w;
  cin >> h >> w;
  if (h==1 || w==1){
    cout << 1 << endl;
  }else {
  	cout << (h*w + 1)/2 << endl;
  }
  
  return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>
int main() {
    // number of cards
    int n; 
    scanf("%d\n", &n);

    // scores
    int p[2] = {0, 0};

    // terns
    while (n--) {
        // hands
        char s[2][101];
        scanf("%s %s\n", s[0], s[1]);

        // judge
        int rc = strcmp(s[0], s[1]);
        if (rc > 0) p[0] += 3;
        if (rc < 0) p[1] += 3;
        if (rc == 0) {
            p[0]++;
            p[1]++;
        }
    }
    // print scores
    printf("%d %d\n", p[0], p[1]);
}


Measured memory_bytes: 2124
#include <iostream>
using namespace std;
#define FOR(i,to) for(i=0;i<(to);i++)

int main() {
	int i, j, k, l;
	int N; cin >> N;
	int t = 0, x = 0, y = 0;

	FOR(i, N) {
		int tt, xx, yy;
		cin >> tt >> xx >> yy;
		int dt = tt - t;
		int dx = abs(xx - x);
		int dy = abs(yy - y);
		int dist = dx + dy;

		if (dt < dist || (dt - dist) % 2) {
			cout << "No" << endl;
			return 0;
		}

		t = tt;
		x = xx;
		y = yy;
	}

	cout << "Yes" << endl;
}

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

int main(void) {
    int n, m;
    scanf("%d %d", &n, &m);
    priority_queue<int> pq;
    for(int i=0;i<n;i++){
        int k;
        scanf("%d", &k);
        pq.push(k);
    }
    for(int i=0;i<m;i++){
        int k = pq.top();
        pq.pop();
        pq.push(k/2);
    }
    long long ans=0;
    while(!pq.empty()){
        ans+=pq.top();
        pq.pop();
    }
    printf("%lld", ans);
}

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

    const int MOD = 1000000007;
    const double PI = acos(-1); 

    //long long
    using ll = long long;

    //出力系
    #define print(x) cout << x << endl
    #define yes cout << "Yes" << endl
    #define YES cout << "YES" << endl
    #define no cout << "No" << endl
    #define NO cout << "NO" << endl
    
    // begin() end()
    #define all(x) (x).begin(),(x).end()

    //for
    #define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)

    //最大公約数（ll）
    ll gcd(ll x, ll y) { return y ? gcd(y,x%y) : x;}

    //素因数分解
    vector<pair<ll, int>>factorize(ll n){
      vector<pair<ll, int>> res;
      for(ll i = 2; i * i <= n; ++i){
        if(n % i) continue;
        res.emplace_back(i, 0);
        while(n % i == 0){
          n /= i;
          res.back().second++;
        }
      }
    if(n != 1) res.emplace_back(n, 1);
    return res;
    }



  // // 二分探索(最小値を出す問題は疑う)
  // bool C(ll x){
  //     ll res = 0;
  //     for(int i = 0; i < N; ++i){
  // 		res += max(0ll, A[i]-x/F[i]);
  //     }
  //     return res <= K;
  // }

  //   ll binary_search(ll ok, ll ng){
  //     while(abs(ok - ng) > 1){
  //       ll mid = (ok + ng) / 2;
  //       if(C(mid)) ok = mid;
  //       else ng = mid;
  //     }
  //     return ok;
  //   }



  int main(){
    int N;
    cin >> N;
    int ans = 0;
    for(int i = 1; N / 2 >= i; i++){
      if(i != (N - i) ) ans++;
    }
  print(ans);
  }

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

// @@ !! LIM()

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

  string S; cin >> S;
  ll k = 0;
  ll N = S.size();
  ll i = 0;
  ll prevLen = 0;
  if (N == 1) {
    cout << 1 << endl;
    return 0;
  }
  while (i < N) {
    if (i == 0 || prevLen != 1 || S.at(i-1) != S.at(i)) {
      k++;
      i++;
      prevLen = 1;
    }else if (i == N - 4 && i-1 >= 0 && S.at(i-1) == S.at(i) && S.at(i) == S.at(i+1) && S.at(i+1) == S.at(i+2) && S.at(i+2) == S.at(i+3)) {
      k++;
      i += 3;
      prevLen = 3;
    }else if (i == N - 2 && i-1 >= 0 && S.at(i-1) == S.at(i) && S.at(i) == S.at(i+1)) {
      k++;
      break;
    }else if (i == N - 1 && i-1 >= 0 && S.at(i-1) == S.at(i)) {
      break;
    }else {
      k++;
      i += 2;
      prevLen = 2;
    }
  }
  cout << k << endl;

  return 0;
}



Measured memory_bytes: 3788
//modified from zscoder's solution
#include <bits/stdc++.h>

using namespace std;

#define fi first
#define se second
#define eb emplace_back
#define mt make_tuple
#define all(x) (x).begin(), (x).end() 
#define MOD 1000000007

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

const ll INF=LLONG_MAX;
const int mxn=2e5+5;
ll a[mxn];
bool b[mxn]; //neg

void mul(ll &a, ll b){
	a%=MOD; b%=MOD; a*=b; a%=MOD;
	if(a<0)a+=MOD;
}

void add(ll &a, ll b){
	a%=MOD; b%=MOD; a+=b; a%=MOD;
}

int main()
{
    ios_base::sync_with_stdio(0); cin.tie(0);
    //freopen("input.txt","r",stdin); freopen("output.txt","w",stdout);
	int n,k;
	cin >> n >> k;
	int cntpos=0,zero=0;
	for(int i=0; i<n; i++){
		cin >> a[i];
		if(a[i]>0){
			cntpos++;
		}else if(a[i]==0){
			zero++;
		}
	}
	sort(a,a+n);
	if(n-zero<k){
		cout << 0 << endl;
		return 0;
	}
	if(n==k){
		ll ans = 1ll;
		for(int i=0; i<n; i++){
			mul(ans,a[i]+MOD);
		}
		cout << ans << endl;
		return 0;
	}
	//negative
	int cntneg = n-zero-cntpos;
	if(cntpos==0&&zero==0&&k%2){
		ll ans = 1ll;
		reverse(a,a+n);
		for(int i=0; i<k; i++){
			mul(ans,a[i]+MOD);
		}
		cout << ans << endl;
		return 0;
	}
	//>=0
	cntneg = 0;
	while(cntneg+2<=k&&cntneg+cntpos<k){
		cntneg+=2;
	}
	int le = cntneg;
	int ri = n-(k-cntneg);
	while(ri+1<n&&(a[le]*a[le+1])>(a[ri]*a[ri+1]))le+=2,ri+=2;
	ll ans = 1ll;
	for(int i=0; i<le; i++)mul(ans,a[i]+MOD);
	for(int i=ri; i<n; i++)mul(ans,a[i]);
	cout << ans << endl;
	return 0;
}



Measured memory_bytes: 5172
#include<bits/stdc++.h>
using namespace std;
#define rep(i,x,y) for(int i=x;i<y;i++)
#define range(a) (a).begin(),(a).end()
#define print(A,x,n) rep(i,0,n){cout<<(i ? " ":"")<<A[i]x;}cout<<endl;
#define pprint(A,y,m,n) rep(j,0,m){print(A[j],y,n);}
const long mod=1e9+7;
const int siz=2e5+1;
const long inf=1e9;
long calc(int x, int k){
    if(k == 0) return 1;
	else if(k == 1) return 9 * x;
	else if(k == 2) return 81 * x * (x-1) / 2;
    else if(k == 3) return 729 * x * (x-1) * (x-2) / 6;
    else return 0;
}
int main(){
	string s; int K; cin>>s>>K;
	int n = s.size(); int k = K;
	int ans = 0;
	rep(i,0,n){
		if(s[i] == '0') continue;
		ans += calc(n - 1 - i, k) + (s[i] - '0' - 1) * calc(n - 1 - i, k - 1);
		k--;
	}cout<<ans + (k == 0)<<endl;
}

Measured memory_bytes: 3608
def dist(x1, x2):
    d = (x1[0] - x2[0])**2 + (x1[1] - x2[1])**2
    return d**0.5

n = int(input())
x = [list(map(int, input().split())) for _ in range(n)]
d = 0
for i in range(n-1):
    for j in range(i+1, n):
        d += dist(x[i], x[j])
print(2*d / n)

Measured memory_bytes: 3060
import Data.List
import Data.Ord

main = interact $ unlines . map (show' . moonlight_farm) . read' . lines
 where
  read' ("0":_) = []
  read' (n:xs) = map ((\(name:dat) -> (name, map read dat)) . words) xs1 : read' xs2
   where (xs1,xs2) = splitAt (read n) xs
  show' = (++ "#") . unlines

moonlight_farm = map fst . sortBy (comparing (negate.efficiency)) . sortBy (comparing fst)
efficiency (_,[p,a,b,c,d,e,f,s,m]) = (fromIntegral (f*s*m-p)) / (fromIntegral (a+b+c+m*(d+e)))

Measured memory_bytes: 5512
import javax.sound.midi.SysexMessage;
import java.util.Scanner;

class Heap {
    int array[];
    int s;
    int n;

    public Heap (){
        this.array = new int [50];
        this.s = 50;
        this.n = 0;
    }

    void push (int val){
        if (n == s){
            increase();
        }
        this.array[n] = val;
        bubbleup();
        n++;
    }

    int pop (){
        if (n > 0) {
            int resp = array[0];
            array[0] = array[n - 1];
            heapify(0);
            n--;
            return resp;
        }
        return 0;
    }

    void increase (){
        this.s *= 2;
        int temp[] = new int[s];
        for (int i = 0; i < n; i++){
            temp[i] = this.array[i];
        }
        this.array = temp;
    }

    void bubbleup (){
        int x = n;
        boolean finish = false;
        while (x > 0 && !finish){
            int y = (x - 1) / 2;
            if (array[x] > array[y]){
                int temp = array[x];
                array[x] = array[y];
                array[y] = temp;
            }else {
                finish = true;
            }
            x = y;
        }
    }

    void heapify(int i){
        int l = (2 * i) + 1;
        int r = (2 * i) + 2;
        int m = i;
        if (l < n && array[m] < array[l]){
            m = l;
        }
        if (r < n && array[m] < array[r]){
            m = r;
        }
        if (m != i){
            int temp = array[i];
            array[i] = array[m];
            array[m] = temp;
            heapify(m);
        }
    }
}

public class Main {

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

        Heap josh = new Heap ();

        while (!cmd.equals("end")){
            if (cmd.equals("insert")){
                int val = in.nextInt();
                josh.push(val);
            }else {
                int resp = josh.pop();
                System.out.println(resp);
            }
            cmd = in.next();
        }
    }
}


Measured memory_bytes: 457448
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <iostream>
#include <iterator>
#include <map>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <vector>

using namespace std;
using ull = unsigned long long;
using P = pair<int, int>;


ull E = 1000000007;
ull e = 10007;
const double pi = 3.14159265359;


int main() {
    int N;
    cin >> N;
    if (N == 1) {
        cout << "Hello World" << endl;
        return 0;
    }
    int A, B;
    cin >> A >> B;
    cout << A + B << endl;
}


Measured memory_bytes: 888
#include <iostream>
using namespace std;
int comstr(string a, string b) {
    int i=0;
    for (;i < a.size() && i < b.size() && a[i] == b[i];i++) {}
    char ca,cb;
    if (i < a.size()) ca = a[i];
    else ca = 0;
    if (i < b.size()) cb = b[i];
    else cb = 0;
    return (int)(cb - ca);
}
int main() {
    int i,n,c1=0,c2=0,tmp;
    string s1,s2;
    cin >> n;
    for (int i=0;i<n;i++) {
        cin >> s1 >> s2;
        tmp = comstr(s1,s2);
        if (tmp < 0) c1+=3;
        else if (tmp > 0) c2+=3;
        else {c1++;c2++;}
    }
    cout << c1 << " " << c2 << endl;
    return 0;
}

Measured memory_bytes: 3140
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
string S;
int main() {
    ll cnt=0,ans=0;
    cin>>S; int N= S.size();
    for(int i=0;i<N;i++) cnt+=(S[i]=='W');
    for(int i=0;i<N;i++)
    {
        if(S[i]=='B') ans+=cnt;
        else cnt--;
    }
    printf("%lld",ans);
}


Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int l[1005];
int main()
{
	int n,x;
	int sum=0,ans=0;
	scanf("%d%d",&n,&x);
	for(int i=0;i<n;i++)
	{
		scanf("%d",&l[i]);
		sum+=l[i];
		if(sum<=x)
			ans++;	
	}
	printf("%d\n",ans+1);
	return 0;
}

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

#define ll long long
#define INF_LL 1LL << 60
#define INF 99999999
#define MOD (ll)1000000007
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define REP(i, a, n) for(int i = a; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()

void put_double(double obj){printf("%.12f\n",obj);};

template < typename T > std::string to_string( const T& n )
{
    std::ostringstream stm ;
    stm << n ;
    return stm.str() ;
}

template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }


int main()
{
    int H,W;
    cin >> H >> W;

    vector<string> S(H);
    rep(i,H) cin >> S[i];

    rep(i,H)
    {
        rep(j,W)
        {
            if( S[i][j] == '.' )
            {
                int cnt = 0;
                REP(dx, -1, 2)
                {
                    REP(dy, -1, 2)
                    {
                        if( dx == dy && dx == 0 )continue;
                        if( i + dy < 0 || i+dy >= H ) continue;
                        if( j + dx < 0 || j+dx >= W ) continue;
                        if( S[i+dy][j+dx] == '#' )cnt++;
                    }
                }
                S[i][j] = to_string(cnt)[0];
            }
        }
    }
    rep(i,H) cout << S[i] << endl;
}


Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <string>
#include <vector>
#include <stack>
#include <cmath>
#include <functional>
#define rep(i,n) for (int i=0;i<(n);i++)

using namespace std;

int main(){
	int w, h, x, y, r;
	string str = "No";
	vector<int> vi;

	cin >> w >> h >> x >> y >> r;
	if (0 <= x - r && x + r <= w && 0 <= y - r && y + r <= h) str = "Yes";
	
		cout << str << endl;
	return 0;
}

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

using namespace std;

int n,k;
vector<int>book[10];
int  memo[10][2000];

int solve(int genre, int cnt);
//solve:?£?????????¨?????????????¨???????,genre:?????????????????£??????,cnt:?£??????¬???????????°
int sum(int genre, int num);
//sum:???????????£???????????¬???num??????????????§?£???£????????????????????????
int main()
{
  int a,b;
  memset(memo,-1,sizeof(memo));
  cin >> n >> k;

  for(int i = 0;i < n;i++){
    cin >> a >> b;
    book[b-1].push_back(a);
  }
  for(int i = 0;i < 10;i++){
    sort(book[i].begin(),book[i].end(),greater<int>());
    //sort??????vector??????????????????????????????
    //cout << book[i].size() << endl;
  }

  cout << solve(0,0) << endl;
}

int solve(int genre, int cnt){

  if(genre == 10)return 0;
  if(memo[genre][cnt] != -1)return memo[genre][cnt];
  int rec = 0;

  for(int i = 0;i <= book[genre].size();i++){
    if(cnt + i > k)break;
    rec = max(rec,solve(genre + 1,cnt + i) + sum(genre,i));
  }
  return memo[genre][cnt] = rec;
}

int sum(int genre, int num){
  if(num == 0)return 0;
  int ans = 0;
  for(int i = 0;i < num;i++){
    ans += book[genre][i];
  }
  return ans + ((num - 1) * num);
}

Measured memory_bytes: 1316
import java.util.*;
import java.io.*;
import java.nio.charset.StandardCharsets;

public class Main {

	public static void main(String[] args) throws IOException {
		InputStreamReader reader = new InputStreamReader(System.in, StandardCharsets.UTF_8);
		BufferedReader in = new BufferedReader(reader);
		Main ins = new Main(in);
		ins.calc();
		ins.showResult();
	}

	Main(BufferedReader in) throws IOException {
		String[] tokens = in.readLine().split(" ");
		long A = Long.parseLong(tokens[0]);
		long B = Long.parseLong(tokens[1]);
		long C = Long.parseLong(tokens[2]);
		long K = Long.parseLong(tokens[3]);
		if (K <= A) {
			System.out.println(K);
		} else if (K <= (A + B)) {
			System.out.println(A);
		} else {
			long result = A - ((K - (A + B)));
			System.out.println(result);
		}
	}

	void calc() {
	}

	void showResult() {
	}

}

Measured memory_bytes: 32476
#include <iostream>
#include <vector>
#include <set>
#include <algorithm>
#include <fstream>
#include <string>
#include <math.h>
#include <cstdlib>
#include <cstdint>
#include <istream>
#include <sstream>
#include <cctype>
#include <functional>
#include <iomanip>
#define rep(i,N) for(ll i=0;i<N;i++)
#define disp(a) cout << a << endl;
#define PI 3.1415926535897932384626433
//cout << fixed << setprecision(20) << ** << endl;
typedef long long ll;
using namespace std;

double deg2rad(double degree)
{
    return degree * PI / 180.0000000000;
}
int main()
{
	vector<int>V,C;
	rep(i,6){
		ll t;
		cin>>t;
		V.push_back(t);
	}
	C.push_back(count(V.begin(),V.end(),1));
	C.push_back(count(V.begin(),V.end(),2));
	C.push_back(count(V.begin(),V.end(),3));
	C.push_back(count(V.begin(),V.end(),4));
	sort(C.begin(),C.end());
	if(C.back()==3){
		cout<<"NO"<<endl;
	}
	else{
		cout<<"YES"<<endl;
	}
}

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

long long modpow(long long a, long long n, long long mod) {
    long long res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}

int main(){
    ll n, k;
    cin >> n >> k;
    ll ans = 0;
    vector<ll> gcd(k+1);
    for(ll i = k; i >= 1; i--){
        gcd[i] = modpow(k/i, n, 1000000007);
        for(ll j = 2; j*i <= k; j++){
            gcd[i] -= gcd[j*i];
            gcd[i]%=1000000007;
        }
        ans+=gcd[i]*i;
        ans%=1000000007;
    }
    if(ans<0){
        ans += 1000000007;
    }
    cout << ans << endl;
}

Measured memory_bytes: 3944
n=int(input())
x=0
for i in range(1,n+1):
    if i%3 == 0:
        print(' %d'%i,end='')
    else:
        x=i
        while(x):
            if x%10 == 3:
                print(' %d'%i,end='')
                break
            x//=10
print()


Measured memory_bytes: 5872
#include<iostream>
#include<vector>
#include<cmath>
#include<algorithm>
#include<string>
#include<utility>
#include<array>
#include<set>
#include <numeric>
#define EPS (1e-7)
using namespace std;


#define ll long long


int main() {

	ll x;
	ll ans = 0;
	ll ediv,amari;
	cin >> x;

	
	ediv = x / 11;
	amari = x % 11;

	if (amari > 6) {
		ans = ediv * 2 + 2;
	}
	else if (amari != 0) {
		ans = ediv * 2 + 1;
	}
	else {
		ans = ediv*2;
	}


	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
typedef long long int lli;
typedef unsigned long long int ulli;
using namespace std;
#define REP(i,n) for(int i=0;i<(n);i++)
#define FOR(i,a,b) for(int i=(a);i<=(b);i++)
#define FORD(i,a,b) for(int i=(a);i>=(b);i--)
#define sortv(v) sort(v.begin(),v.end());
#define sorta(a,n) sort(a,a+n);
#define arrayin(a,n) for(int i=0;i<n;i++) cin>>a[i];
#define arrayout(a,n) for(int i=0;i<n;i++) cout<<" ";cout<<"\n";
#define INF INT_MAX //Infinity
#define mp make_pair
#define pb push_back
#define mt make_tuple
#define MOD 1000000007
#define fi first
#define se second
#define vi vector<int>
#define ii pair<int,int>
#define vii vector<pair<int,int>>
#define viii vector<tuple<int,int,int>>
#define mii map<int,int>
#define fio ios_base::sync_with_stdio(false); cin.tie(NULL);
#define nl "\n"
ulli poW(lli x,ulli y)
{
	//this function only returns correct values upto the order of ~10^18
	//use pow of math to obtain greater answers
	lli temp;
	if(y==0)
		return 1;
	temp=poW(x,y/2);
	if(y%2==0)
		return temp*temp;
	else return x*temp*temp;
}

int bSearch(int low,int high,int a[],int sh)
{
	//function for searching till where is a sh<=
	while(low<high)
	{
		int mid=low+(high-low+1)/2;
		if(a[mid]>sh)
			high=mid-1;
		if(a[mid]<=sh)
			low=mid;
	}
	return low;
}

int main()
{
    fio;
	int r,g,b;
	cin>>r>>g>>b;
	if((10*g+b)%4==0)
		cout<<"YES"<<endl;
	else cout<<"NO"<<endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define rep(i,j,n) for(int i=(int)(j);i<(int)(n);i++)
#define REP(i,j,n) for(int i=(int)(j);i<=(int)(n);i++)
#define MOD 1000000007
#define int long long
#define ALL(a) (a).begin(),(a).end()
#define vi vector<int>
#define vii vector<vi>
#define pii pair<int,int>
#define priq priority_queue<int>
#define disup(A,key) distance(A.begin(),upper_bound(ALL(A),(int)(key)))
#define dislow(A,key) distance(A.begin(),lower_bound(ALL(A),(int)(key)))
#define tii tuple<int,int,int>
signed main(){
  int H; cin>>H;
  int count=1;
  while(H>1){
    H/=2;
    count++;
  }
  cout<<(1ll<<count)-1<<endl;
  }



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define fi first
#define se second
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define repp(i, a, b) for (int i = a; i <= (b); ++i)
#define repr(i, a, b) for (int i = a; i >= (b); --i)
typedef long long ll;
const int INF = 1001001001;
const ll LINF = 1001001001001001001ll;
const int MOD = 1e9 + 7;

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;
}

ll N;
int keta;

int dfs(int now, int sum) {
  int ans = 0;

  int cnt[10];
  rep(i, 10) { cnt[i] = 0; }
  int sum_cp = sum;
  while (sum_cp) {
    cnt[sum_cp % 10]++;
    sum_cp /= 10;
  }
  bool is_753 =
      cnt[3] > 0 && cnt[5] > 0 && cnt[7] > 0 &&
      cnt[0] + cnt[1] + cnt[2] + cnt[4] + cnt[6] + cnt[8] + cnt[9] == 0;

  if (now == keta) {
    if (sum <= N && is_753) ans++;
  } else {
    if (is_753) ans++;
    for (int i = 3; i < 8; i += 2) {
      ans += dfs(now + 1, sum * 10 + i);
    }
  }
  return ans;
}

int main() {
  cin >> N;
  keta = log10(N) + 1;

  cout << dfs(0, 0) << endl;
}

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

using namespace std;

typedef long long ll;

int main() {
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int n, t;
    set<int> s;
    map<int, int> mp;
    cin >> n >> t;
    int m = 0;
    ll cnt = 0;
    for (int i = 0; i < n; ++i) {
        cin >> t;
        if (i) {
            if (t - *s.begin() > m) {
                m = t - *s.begin();
                cnt = 0;
            }
            if (t - *s.begin() == m) {
                cnt += mp[*s.begin()];
            }
        }
        s.insert(t);
        ++mp[t];
    }
    cout << cnt;
    return 0;
}

Measured memory_bytes: 9728
/*

    author : s@if

*/

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

#define 		NIL 			-1
#define		 	fi	 		    first
#define 		sec 			second
#define 		MAX 			INT_MAX
#define			INF 			99999999
#define 		ll 			    long long
#define 		PI 			    acos(-1.0)
#define			MOD 			1000000007
#define 		PLL 			pair<ll,ll>
#define 		PII			    pair<int,int>
#define 		ull 			unsigned long long
#define 		For(i,a,b) 		for(int i=a;i<=(int)b;i++)


inline int in() {int x; scanf("%d", &x); return x; }
bool Check(int N , int pos)	{	return (bool) (N & (1<<pos));}
int Set(int N, int pos) {	return N = N | (1<<pos);}

int fx[]={+0,+0,+1,-1,-1,+1,-1,+1};
int fy[]={-1,+1,+0,+0,+1,+1,-1,-1};
int hr[]={-2,-2,-1,+1,+2,+2,-1,+1};
int hc[]={+1,-1,+2,+2,-1,+1,-2,-2};
int dx[]={+1,-1,+0,+0};
int dy[]={+0,+0,+1,-1};

const int MAXN = (int)1e5+9;

int main()
{
/*	freopen("input.txt","r",stdin);
    freopen("output.txt","w",stdout);
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);  */

    int i,j,k,l,m,n,p,q,x,y,u,v,r,tc,t;

    cin>>n;

    vector<int>vv(n);

    For(i,0,n-1)
    {
        cin>>vv[i];
    }

    bool flag = true;

    for(i=0; i+1<n; i++)
    {
        if(vv[i]<=vv[i+1])
        {
            if(i==0 && vv[i]>1)
                vv[i]--;
            else if(i>0 && vv[i-1]<=vv[i]-1)
                vv[i]--;
        }
        else if(vv[i]-vv[i+1]>1)
        {
            flag = false;
            break;
        }
        else
        {
            vv[i]--;

            if(vv[i]==0)
            {
                flag = false;
                break;
            }

            if(i==0 || (i>0 && vv[i-1]<=vv[i]))
                ;
            else
            {
                flag = false;
                break;
            }
        }
    }

    if(flag)
        cout<<"Yes\n";
    else
        cout<<"No\n";

   // main();

    return 0;
}

// read the question correctly (is y a vowel? what are the exact constraints?)
// look out for SPECIAL CASES (n=1?) and overflow (ll vs int?)


Measured memory_bytes: 640
#include<stdio.h>
int main() {
	int i,j,h,w;
	char a[101];
	scanf("%d%d",&h,&w);
	for(i=0; i<h; i++) {
		scanf("%s",a);
		for(j=0; j<2; j++) {
			printf("%s\n",a);
		}
	}
	return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <vector>
#include <string>
#include <queue>
#define ll long long
#define MOD 1000000007
#define MAX 10000000
using namespace std;
ll dp[110][4][4][4];

int main(){
    int n; cin >> n;
    ll h[n+1];
    for(int i=0;i<n;i++) cin >> h[i];

    int ans = 0;
    int res = 0;
    for(int i=1;i<n;i++){
        if(h[i-1]>=h[i]){
            res++;
        }
        else{
            ans = max(ans,res);
            res=0;
        }
    }
    ans = max(ans,res);
    cout << ans;
}

Measured memory_bytes: 1024
#include "bits/stdc++.h"
using namespace std;
using ll = long long;
using ld = long double;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vl = vector<ll>;
using vll = vector<vector<ll>>;
using pii = pair<int,int>;
#define FOR(i,a,b) for(ll i = (a); i < (b); i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(obj) (obj).begin(), (obj).end()
#define pb push_back
const double PI = acos(-1);
const double EPS = 1e-10;
const ll MOD = 1000000007;
vl a1(5);
vl sousuu,pat;
void cioacc(){//accelerate cin/cout
  cin.tie(0);
  ios::sync_with_stdio(false);
}
ll solve(ll a,ll x){
  if(x==0) return 0;
  if(a < 2) return a1[x];
  if(x <= sousuu[a-2]) return solve(a-1,x-1);
  else if(x == sousuu[a-2]+1) return pat[a-2] + 1;
  else if(x >= sousuu[a-1]-1) return pat[a-1];
  else return solve(a-1,x-sousuu[a-2]-2) + pat[a-2] + 1;
}
int main(){
  ll n,x;
  cin >> n >> x;
  sousuu.assign(n,0),pat.assign(n,0);
  sousuu[0] = 5;
  pat[0] = 3;
  a1[0] = 0;
  a1[1] = 1;
  a1[2] = 2;
  a1[3] = 3;
  a1[4] = 3;
  REP(i,n-1) {
    sousuu[i+1] = 2 * sousuu[i] + 3;
    pat[i+1] = 2 * pat[i] + 1;
  }
  cout << solve(n,x-1) << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#define rep(i, n) for(int i = 0; i < n; ++i)
using namespace std;

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

  int H, W; cin >> H >> W;
  vector<string> board(H);
  rep(i, H) cin >> board[i];

  int dh[] = {-1, -1, 0, 1, 1, 1, 0, -1};
  int dw[] = {0, -1, -1, -1, 0, 1, 1, 1};

  rep(i, H) rep(j, W) {
    if(board[i][j]=='.') {
      int cnt = 0;
      rep(k, 8) {
        int h = i + dh[k];
        int w = j + dw[k];
        if(0<=h && 0<=w && h<H && w<W && board[h][w]=='#') ++cnt;
      }
      board[i][j] = '0' + cnt;
    }
  }

  rep(i, H) cout << board[i] << '\n';
  return 0;
}


Measured memory_bytes: 256
//include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <climits>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <queue>
#include <random>
#include <cctype>
#include <complex>
#include <regex>

using namespace std;

#define C_MAX(a, b) ((a)>(b)?(a):(b))
#define SHOW_VECTOR(v) {std::cerr << #v << "\t:";for(const auto& xxx : v){std::cerr << xxx << " ";}std::cerr << "\n";}
#define SHOW_MAP(v){std::cerr << #v << endl; for(const auto& xxx: v){std::cerr << xxx.first << " " << xxx.second << "\n";}}

typedef complex<double> P;
typedef pair<P, double> Circle;

#define EPS 1e-8
#define EQ(a, b) (abs((a)-(b)) <EPS)

inline int signum(double x) { return abs(x) < EPS ? 0 : x > 0 ? 1 : -1; }

int circcw(Circle c1, Circle c2) {
    if (c1.second < c2.second) swap(c1, c2);
    P p1 = c1.first;
    P p2 = c2.first;
    double r1 = c1.second;
    double r2 = c2.second;
    if (abs(p1 - p2) > r1 + r2) return 4;
    if (signum(abs(p1 - p2) - (r1 + r2)) == 0) return 3;
    if ((r1 - r2) < abs(p1 - p2) && abs(p1 - p2) < (r1 + r2)) return 2;
    if (signum(r1 - (abs(p1 - p2) + r2)) == 0) return 1;
    return 0;
}

int main() {

    double c1x, c1y, c1r;
    cin >> c1x >> c1y >> c1r;

    double c2x, c2y, c2r;
    cin >> c2x >> c2y >> c2r;

    Circle c1(P(c1x, c1y), c1r), c2(P(c2x, c2y), c2r);

    int ans = circcw(c1, c2);
    cout << ans << endl;

}












































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

const int maxn=1<<18|1;

int n,ALL;
int a[maxn];
int ans[maxn];

int main (){
	scanf("%d",&n);
	ALL=(1<<n)-1;
	for (int S=0;S<=ALL;S++)
		scanf("%d",&a[S]);
	for (int S=1,now;S<=ALL;S++){
		now=a[S];
		for (int S0=S;S0;S0=(S0-1)&S){
			ans[S]=std::max(ans[S],now+a[S^S0]);
			now=std::max(now,a[S^S0]);
		}
	}
	for (int i=1;i<=ALL;i++)
		printf("%d\n",ans[i]=std::max(ans[i],ans[i-1]));
	return 0;
}


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

#define GET_MACRO(_1,_2,_3,_4,NAME,...) NAME
#define REP2(i,n) for(int i=0;i<(int)(n);i++)
#define REP3(i,m,n) for(int i=m;i<(int)(n);i++)
#define REP4(i,m,n,s) for(int i=m;(s>0 and i<(int)(n)) or (s<0 and i>(int)(n));i+=s)
#define REP(...) GET_MACRO(__VA_ARGS__, REP4, REP3, REP2)(__VA_ARGS__)
#define REPIT(i,c) for(__typeof((c).begin()) i=(c).begin();i!=(c).end();i++)
#define PIS(x) printf("%d ",x)
#define PN() putchar('\n')
#define PRINTARR(a,b) for(int i=0;(a+i)!=(b);i++){cout << *(a+i) << " ";}PN();
#define MP make_pair
#define PB push_back
#define EB emplace_back

typedef pair<int,int> PII;
typedef long long LL;
typedef unsigned long long ULL;

void RI() {}
template<typename... T>
void RI( int& head, T&... tail ) {
    scanf("%d", &head);
    RI(tail...);
}
void RLL() {}
template<typename... T>
void RLL( LL& head, T&... tail ) {
    scanf("%lld", &head);
    RLL(tail...);
}
void print() {putchar('\n');}
template<typename T, typename... U>
void print(T head, U... tail) {
    cout << head << " ";
    print(tail...);
}

const int MOD = 1000000007;
#define MAX_N 100005


int main()
{
    int n, a1 = 0, a2 = 0, a4 = 0;
    RI(n);
    REP(i, n) {
        int a;
        RI(a);
        if(a % 4 == 0) {
            a4 += 1;
        } else if(a % 2 == 0) {
            a2 += 1;
        } else {
            a1 += 1;
        }
    }
    if(a2 > 1) {
        a2 = 1;
    }
    if(a1 + a2 <= a4 + 1) {
        printf("Yes\n");
    } else {
        printf("No\n");
    }
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
#include <string>
#include <vector>
#include <algorithm>
#include <map>
typedef long long ll;


int main(int argc, char *argv[])
{
	int n;

	cin >> n;

	int m=0;
	for (int i=1;i<=n;i++)
	{
		int a;
		cin>>a;
		if (a==m+1) m++;
	}
	
	cout << (m==0?-1:(n-m)) << endl;
	return 0;
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vec;
typedef vector<vec> mat;
typedef pair<ll,ll> pll;
const ll mod=1e9+7;
//const ll mod=998244353;
const ll inf=5e18;

int main() {
  ll n;
  cin >> n;
  ll cnt=0;
  ll ans=0;
  ll temp=n;
  while(n>=10) {
    n/=10;
  }
  while(temp) {
    ans+=temp%10;
    temp/=10;
    cnt++;
  }
  ans=max(ans,n-1+(cnt-1)*9);
  cout << ans << endl; 
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<queue>
#define N 1000010
using namespace std;
char s1[N],s2[N];
int n;
queue<int>q;
int main()
{
	scanf("%d%s%s",&n,s1+1,s2+1);
	if(strcmp(s1+1,s2+1)==0){puts("0");return 0;}
	int pos=n,ans=0;
	for(int i=n;i>=1;i--)
    {
        if(i && s2[i]==s2[i-1]) continue;
        pos=min(pos,i);
        while(pos && s2[i]!=s1[pos]) pos--;
        if(!pos){puts("-1");return 0;}
        while(!q.empty())
        {
            if(q.front()-q.size()+1>i) q.pop();
            else break;
        }
        q.push(pos);
        if(i!=pos) ans=max(ans,(int)q.size());
    }
    printf("%d\n",ans+1);
	return 0;
}


Measured memory_bytes: 6272
#include <bits/stdc++.h>
using namespace std;
#define fo(i,a,b) for(int i=(a);i<(b);i++)
#define MOD 1000000007
#define MP make_pair
#define PB push_back
typedef long long ll;

string a, b, s;

int main () {
        cin >> s;
        fo(i, 0, 4) a += s[i];
        fo(i, 4, 12) b += s[i];
        cout << a << " " << b << endl;
        return 0;
}



Measured memory_bytes: 764
import java.io.*;
import java.util.*;


// æ­Ôá¤Æ±ëB
// âè¶É¢ÄÈ­ÄàâèZbgÍ¡Åæªª0ÅI¹Å éB
// âèZbgÌJèÔµÉú»Rê

// 2011/10/18

//@0114 
public class Main {

	
	long gcm(long a, long b) {
		
		while(b != 0) {
			long t = a % b;
			a = b;
			b = t;
		}
		return a;
	}
	
	long lcm(long a, long b) {
		return a * b / gcm(a, b);
	}
	
	// C return falseÅ¨µÜ¢
	boolean main() throws IOException {

		int[] ri = readIntArray();
		int a1 = ri[0];
		int m1 = ri[1];
		int a2 = ri[2];
		int m2 = ri[3];
		int a3 = ri[4];
		int m3 = ri[5];
		if (a1 == 0 && m1 == 0 && a2 == 0 && m2 == 0 && a3 == 0 && m3 == 0) 
			return false; // ¨µÜ¢

		int i;
		int x = 1;
		for(i = 1;; i++) {
			x = (a1 * x) % m1;
			if (x == 1)
				break;
		}
		long v1 = i;
		x = 1;
		for(i = 1;; i++) {
			x = (a2 * x) % m2;
			if (x == 1)
				break;
		}
		long v2 = i;
		x = 1;
		for(i = 1;; i++) {
			x = (a3 * x) % m3;
			if (x == 1)
				break;
		}
		long v3 = i;
		long r = lcm(lcm(v1, v2), v3);
		
		
		// ðÌ\¦
		System.out.printf("%d\n", r);
		
		return true; // ³íI¹ Ö
	}
	

//	private final static boolean DEBUG = true;  // debug
	private final static boolean DEBUG = false; // release

	public static void main(String[] args) throws IOException {

		if (DEBUG) {
			log = System.out;
			
			String inputStr = "1 459550\n";

			reader = new BufferedReader(new StringReader(inputStr)); 

		}
		else {
			log = new PrintStream(new OutputStream() { public void write(int b) {} } ); // «ÌÄ
			reader = new BufferedReader(new InputStreamReader(System.in)); // R\[©ç
		}
		
		//int N = readIntArray()[0];

		for(int i = 0; /*i < N*/; i++) {
			boolean b = new Main().main();
			if (!b)
				break;
		}		
		
		reader.close();
	}

	
	static PrintStream log;
	static BufferedReader reader;
	

	// WüÍæè1sªÌXy[XæØèÌ®lðÇÞ
	// EOFÌêÍnullðÔ·
	private static int[] readIntArray() throws IOException {
		
		String s = reader.readLine();
		if (s == null)
			return null;
		String[] sp = s.split(" ");
		int[] a = new int[sp.length];
		for(int i = 0; i < sp.length; i++) {
			a[i] = Integer.parseInt(sp[i]);
		}
		return a;
	}
		
}

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

using namespace __gnu_pbds; 
using namespace std;
using   ll=long long;

#define fast        	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define ordered_set 	tree<pll, null_type,less<pll>, rb_tree_tag,tree_order_statistics_node_update>

#define endl        	"\n"
#define pb          	push_back
#define mp          	make_pair
#define F           	first
#define S           	second
#define int             long long int
#define pll				pair<int , int>

#define ALL(v)      	v.begin(),v.end()
#define ALLR(v)     	v.rbegin(),v.rend()
#define pii         	3.14159265358979323
#define inf     		LLONG_MAX
#define ones(x)     	__builtin_popcount(x)
#define fill(a,b)   	memset(a,b,sizeof(a))
#define mod 			1000000007
#define hell            998244353 

ll mod_pow(ll a,ll b,ll m) 
{
    ll res = 1;
    while(b)	
    {
        if(b&1) 	
        {
        	res=(res*a) % m;
        }
        a=(a*a) % m;
        b>>=1;
    }
    return res;
}

ll mod_inverse(ll a) 
{
	return mod_pow(a , mod-2 , mod);
}

void solve()
{
	string s;
	
	cin >> s;
	
	for(int i = 0; i < s.size(); ++i) {
		if(i%2 == 0) {
			cout << s[i];
		}
	}
}

signed main() {
    fast;
    
    int t = 1;
    
	//cin >> t;
    
    while(t--) {
        solve();
    }
 
    return 0;
}


Measured memory_bytes: 3752
#c
n,m = map(int,input().split())
res = 0

q = []
for i in range(m):
    q.append(list(map(int,input().split())))
p = list(map(int,input().split()))

#sのX桁目が1ならX個目のスイッチがON
for s in range(2**n):
    judge = True
    for i in range(m):
        cnt = 0
        for j in range(1,len(q[i])):
            w = q[i][j]
            if s>>(w-1) &1 == 1: #スイッチの番号の位置を知りたいので、スイッチの番号-1で位置を配列的に求める
                cnt += 1
        if cnt % 2 != p[i]:
            judge = False
    if judge:
        res += 1
print(res)

Measured memory_bytes: 3064
import java.io.*;
import java.util.StringTokenizer;

public class Main {

    public static void main(String[] args) throws IOException {
        init();
        int sum = nextInt() + nextInt() + nextInt();
        System.out.println(sum >= 22 ? "bust" : "win");
    }

    //Input Reader
    private static BufferedReader reader;
    private static StringTokenizer tokenizer;

    private static void init() {
        reader = new BufferedReader(new InputStreamReader(System.in));
        tokenizer = new StringTokenizer("");
    }

    private static String next() throws IOException {
        String read;
        while (!tokenizer.hasMoreTokens()) {
            read = reader.readLine();
            if (read == null || read.equals(""))
                return "-1";
            tokenizer = new StringTokenizer(read);
        }

        return tokenizer.nextToken();
    }

    private static int nextInt() throws IOException {
        return Integer.parseInt(next());
    }

    private static long nextLong() throws IOException {
        return Long.parseLong(next());
    }
}

Measured memory_bytes: 22612
#include<bits/stdc++.h>
using namespace std;
int a,b,c,sum,i,gqt[2006811];
int main()
{
    cin>>a>>b>>c;
    for(i=1;i<=a;i++)
    {
        cin>>gqt[i];
        if(gqt[i]<b||gqt[i]>=c)
            sum++; 
    }
    cout<<sum<<endl;
    return 0;  
}

Measured memory_bytes: 256
N, capW = map(int, input().split())
items = [tuple(map(int, input().split())) for _ in range(N)]

def knapsack01(items, capW):
    dp = {0: 0}
    for wi, vi in sorted(items, key=lambda x: x[1]):
        for v, w in list(dp.items()):
            v2 = v + vi
            if w+wi <= capW:
                w2 = w + wi
                if v2 in dp:
                    if w2 < dp[v2]:
                        dp[v2] = w2
                else:
                    dp[v2] = w2
    return max(dp.keys())

print(knapsack01(items, capW))


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

const int MAX = 210000;
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;
}

long long modpow(long long a, long long n) {
    long long res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}

signed main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << fixed << setprecision(20);
    
    ll n,a,b,c;
    cin>>n>>a>>b>>c;
    COMinit();
    int w=a+b;
    a = (a*inv[w])%mod;
    b = (b*inv[w])%mod;
    c = 100 - c;
    c = (100 * inv[c])%mod;
    ll ans = 0;
    for(ll i=n;i<2*n;i++){
        ll ret = modpow(a,n)*modpow(b,i-n);
        ret %= mod;
        ret += modpow(a,i-n) * modpow(b,n);
        ret %= mod;
        ret *= COM(i-1,n-1);
        ret %= mod;
        ret *= i;
        ret %= mod;
        ans += ret;
        ans %= mod;
    }
    ans *= c;
    ans %= mod;
    cout << ans << endl;
}

Measured memory_bytes: 5120
#include<bits/stdc++.h>
using namespace std;
int main()
{
	long long a,b,c,d,e;
	cin>>a>>b>>c;
	if (c<=a+b)
	{
		cout<<"No";
		return 0;
	}
	d=(c-a-b)*(c-a-b);
	e=4*a*b;
	if (d>e) cout<<"Yes";
	else cout<<"No";
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

using namespace std;

int main(){
	int a,b;
	char op;
	while(true){
		scanf("%d %c %d",&a,&op,&b);
		if(op == '?') break;
		switch(op){
		case '+':
			printf("%d\n",a+b);
			break;
		case '-':
			printf("%d\n",a-b);
			break;
		case '/':
			printf("%d\n",a/b);
			break;
		case '*':
			printf("%d\n",a*b);
			break;
		}
	}
}



Measured memory_bytes: 2756
import qualified Data.ByteString.Char8 as BS
import qualified Data.Vector.Unboxed as V
import           Data.Maybe (fromJust)
import           Data.Char (isSpace)

main :: IO ()
main = do
  n <- fst . fromJust . BS.readInt <$> BS.getLine
  as <- getIntVec n
  let (_, result) = V.foldl' f (False, 1 :: Integer) as
        where
          f _ 0 = (False, 0)
          f (True, _) _ = (True, -1)
          f (False, acc) a = let temp = fromIntegral a * acc
                             in if temp > maxValue
                                then (True, -1)
                                else (False, temp)
      maxValue = 10 ^ (18 :: Integer)
  print result

getIntVec :: Int -> IO (V.Vector Int)
getIntVec n = V.unfoldrN n (BS.readInt . BS.dropWhile isSpace) <$> BS.getLine


Measured memory_bytes: 9360
#define _USE_MATH_DEFINES
#include <iostream>
#include <math.h>
#include <climits>
#include <algorithm>
#include <functional>
#include <vector>
#include <queue>
#include <map> 
#include <set>
#include <string>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
const ll MD = 1000000007;

/* sample input

*/

int main()
{
	ll n;
	cin >> n;
	vector<ll> a;
	ll x[2];
	int countnum=0;


	for (ll i = 0; i < n; i++) {
		ll temp;
		cin >> temp;
		a.push_back(temp);
	}
	sort(a.begin(), a.end(), greater <ll>() );
	int count = 0;

	ll temp = a[0];
	count = 1;
	for (ll i = 1; i < n; i++) {
		if (temp == a[i]) {
			if (count == 1) {
				x[countnum] = temp;
				count = 0;
				countnum++;
				if (countnum == 2) {
					break;
				}
			}
			else {
				count = 1;
			}
		}
		else {
			temp = a[i];
			count = 1;
		}
	}

	if (countnum != 2) {
		cout << 0;
	}
	else {
		cout << x[0] * x[1] << endl;
	}
	return 0;
}

Measured memory_bytes: 1400
# library
import numpy as np

# 1 21
# input
a, b = input().split()

# solution
n = int(a + b)

#-----------
# square_numbers = [1]
# iter = 2
# while square_numbers[-1]**2 < 100100:
#     square_numbers.append(iter ** 2)
#     iter += 1
# if n in square_numbers: res = 'Yes'
# else: res = 'No'
#-----------


if np.sqrt(n) - int(np.sqrt(n)) == 0:
    res = 'Yes'
else:
    res = 'No'

# output
print(res)

Measured memory_bytes: 18224
# AOJ 1024 Cleaning Robot 2.0
# Python3 2018.7.5 bal4u

mv = ((-1,0), (0,1), (1,0), (0,-1))
d2c = {0:'.', 1:'E'}

while True:
	n, k = map(int, input().split())
	if n == 0: break
	k, n1 = k-1, n-1
	if (n & 1) or k >= (1<<(n>>1)):
		print("No\n")
		continue
	arr = [[-1 for c in range(n)] for r in range(n)]
	for c in range(n): arr[0][c] = (k>>((n1-c)>>1)) & 1
	for r in range(n1):
		for c in range(n):
			f, t = 0, arr[r][c]
			for i in range(4):
				nr, nc = r + mv[i][0], c + mv[i][1]
				if nr >= 0 and nr < n and nc >= 0 and nc < n and arr[nr][nc] == t: f += 1
			arr[r+1][c] = 1-t if f==2 else t
	for r in range(n): print(''.join([d2c[arr[r][c]] for c in range(n)]))
	print()


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

ll gcd(ll x, ll y) { return (x % y)? gcd(y, x % y): y; }


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

    A--;
    B--;
    C--;
    D--;

    ll streak_p = 1;

    bool flag_swap = false;
    bool flag_A = true;
    bool flag_B = true;

    for(int i = B; i <= D; i++){
        if(S[i - 1] == '.' && S[i] == '.' && S[i + 1] == '.'){
        flag_swap = true;
        }
    }

    for(int i = A ; i < C; i++){
        if(S[i] == S[i + 1] && S[i] == '#'){
            flag_A = false;
        }
    }

    for(int i = B ; i < D; i++){
        if(S[i] == S[i + 1] && S[i] == '#'){
            flag_B = false;
        }
    }

    if(flag_A == false || flag_B == false){
        cout << "No" << endl;
        return 0;
    }



    if(D < C && flag_swap){
        cout << "Yes" << endl;
        return 0;
    }else if(C < D){
        cout << "Yes" << endl;
        return 0;
    }else{
        cout << "No" << endl;
        return 0;
    }


}


Measured memory_bytes: 640
#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>

int main() {
	int i = 0,c;
	int x[10000];
	while (1){
		scanf("%d", &x[i]);
		if (x[i] == 0) {
			c = i;
			break;
		}
		i++;
	}
	for (i = 0; i < c; i++) {
		printf("Case %d: %d\n",i+1, x[i]);
	}

}

Measured memory_bytes: 2680
//
// Created by tac on 2016/10/12.
//

#include <cstdlib>
#include <string>
#include <array>
#include <iostream>

const int SUIT_SIZE {4};
const int RANK_SIZE {13 + 1};
const std::array<std::string, SUIT_SIZE> INDEX_TO_SUIT {"S", "H", "C", "D"};

int suit_to_index(std::string suit) {
    int index;
    if (suit == "S") {
        index = 0;
    } else if (suit == "H") {
        index = 1;
    } else if (suit == "C") {
        index = 2;
    } else if (suit == "D") {
        index = 3;
    } else {
        throw std::runtime_error("");
    }
    return index;
}

std::string index_to_suit(int index) {
    return INDEX_TO_SUIT[index];
}

int main() {
    std::array<std::array<bool, RANK_SIZE>, SUIT_SIZE> cards;
    for (int i = 0; i < SUIT_SIZE; ++i) {
        for (int j = 0; j < RANK_SIZE; ++j) {
            cards[i][j] = false;
        }
    }

    int n;
    std::string suit;
    int rank;
    std::cin >> n;
    for (int i = 0; i < n; ++i) {
        std::cin >> suit >> rank;
        cards[suit_to_index(suit)][rank] = true;
    }

    for (int i = 0; i < SUIT_SIZE; ++i) {
        for (int j = 1; j < RANK_SIZE; ++j) {
            if (!cards[i][j]) {
                std::cout << index_to_suit(i) << " " << j << std::endl;
            }
        }
    }
    return EXIT_SUCCESS;
}

Measured memory_bytes: 3144