akhauriyash/Code-Regression huggingface dataset:
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<ll, int> P;
const int INF = (1<<30);
const ll INFLL = (1ll<<60);
const ll MOD = (ll)(1e9+7);

#define l_ength size

void mul_mod(ll& a, ll b){
	a *= b;
	a %= MOD;
}

void add_mod(ll& a, ll b){
	a = (a<MOD)?a:(a-MOD);
	b = (b<MOD)?b:(b-MOD);
	a += b;
	a = (a<MOD)?a:(a-MOD);
}

P p[6];

int main(void){
	int t,k,i;
	ll a,b,l,r,ans;
	cin >> a >> b;
	if(a==b){
		cout << 1 << endl;
		return 0;
	}
	for(t=59; t>=0; --t){
		if((a&(1ll<<t))^(b&(1ll<<t))){
			break;
		}else{
			a %= (1ll<<t);
			b %= (1ll<<t);
		}
	}
	for(k=0; k<t; ++k){
		l = (1ll<<t)+(1ll<<k);
		r = (1ll<<t)+(2ll<<k);
		if(l<=b && b<r){
			++k;
			break;
		}
	}
	if(b==(1ll<<t)){
		k = 0;
	}
	p[0] = P(a,1);
	p[1] = P((1ll<<t),-1);
	p[2] = P(a+(1ll<<t),1);
	p[3] = P((2ll<<t),-1);
	p[4] = P((1ll<<t),1);
	p[5] = P((1ll<<t)+(1ll<<k),-1);
	sort(p,p+6);
	for(i=0; i<5; ++i){
		if(p[i].second){
			ans += p[i+1].first - p[i].first;
		}
		p[i+1].second += p[i].second;
	}
	cout << ans << endl;
	return 0;
}


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

 int main() {
  int A, B;
  cin >> A >> B;
  int res = 0;
  for (int i = 0; i < 2; i++) {

    if (A > B) {
      res += A;
      A--;
    } else {
      res += B;
      B--;
    }
  }




   cout << res << '\n';
 }


Measured memory_bytes: 256
#!/usr/bin/env python
import sys


def solve(H: int, W: int, S: "List[str]"):
    def isBlock(x, y):
        return S[y][x] == "#"
    cacheW = [[0 for i in range(W)] for j in range(H)]
    cacheH = [[0 for i in range(W)] for j in range(H)]
    for i in range(H):
        count = 0
        begin = 0
        for j in range(W):
            if isBlock(j, i):
                for k in range(begin, j):
                    cacheW[i][k] = count
                begin = j+1
                count = 0
            else:
                count += 1
        if begin != W:
            for k in range(begin, W):
                cacheW[i][k] = count
    for i2 in range(W):
        count2 = 0
        begin2 = 0
        for j2 in range(H):
            if isBlock(i2, j2):
                for k2 in range(begin2, j2):
                    cacheH[k2][i2] = count2
                # print("x="+str(i2) +"--"+ str(begin2)+"~"+str(j2)+"::"+str(count2))
                begin2 = j2+1
                count2 = 0
            else:
                count2 += 1
        if begin2 != H:
            for k in range(begin2,H):
                cacheH[k][i2] = count2
    m = 0
    # print(cacheW)
    # print(cacheH)
    for i in range(W):
        for j in range(H):
            c = cacheW[j][i] + cacheH[j][i]-1
            m = max(m, c)
            # print(str(i)+"-"+str(j)+":"+str(c))
    print(m)
    return


# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    H = int(next(tokens))  # type: int
    W = int(next(tokens))  # type: int
    S = [next(tokens) for _ in range(H)]  # type: "List[str]"
    solve(H, W, S)


if __name__ == '__main__':
    main()


Measured memory_bytes: 123356
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define FOR(i, a, b) for(ll i = (ll)a; i <= (ll)b; i++)
#define DEC(i, a, b) for(ll i = (ll)a; i >= (ll)b; i--)
typedef pair<ll, ll> pi;
typedef pair<ll, pi> pii;
typedef pair<pi, pi> pipi;
#define f first
#define s second
typedef vector<ll> vi;
typedef vector<pi> vpi;
typedef vector<pii> vpii;
#define pb push_back
#define pf push_front
#define all(v) v.begin(), v.end()
#define disc(v) sort(all(v)); v.resize(unique(all(v)) - v.begin());
#define INF (ll) 1e9 + 100
#define LLINF (ll) 1e18
#define fastio ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());    //can be used by calling rng() or shuffle(A, A+n, rng)
inline ll rand(ll x, ll y) { ++y; return (rng() % (y-x)) + x; } //inclusivesss

ll n, k, p[5005], c[5005], ans = -LLINF;

ll f(ll x) {
	ll res = -LLINF, cur = 0, st = x, num = 0;
	while (num < k) {
		num++;
		st = p[st];
		cur += c[st];
		res = max(res, cur);
		if (st == x) break;
	}
	if (num == k) return res;
	cur *= (k/num - 1);
	res = max(res, cur);
	FOR(i, 1, num + k % num) {
		st = p[st];
		cur += c[st];
		res = max(res, cur);
	}
	return res;
}

int main() {
	fastio; cin >> n >> k;
	FOR(i, 1, n) cin >> p[i];
	FOR(i, 1, n) cin >> c[i];
	FOR(i, 1, n) ans = max(ans, f(i));
	cout << ans;
}


Measured memory_bytes: 3696
N=input()
N=int(N)
def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    return divisors
u=0
for i in range(N):
    a=make_divisors(i+1)
    if len(a)==8 and (i+1) % 2==1:
        u+=1

    

print(u)


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

int main() {
  int N, M, X;
  cin >> N >> M >>X;
  vector<int> C(N);
  vector<vector<int>> A(N,vector<int>(M));
  for(int i = 0; i < N; i++){
    cin>>C.at(i);
    for(int j = 0; j < M; j++){
      cin >> A.at(i).at(j);
    }
  }

  vector<int> det(M);


    int n = N;
    int money = 0;
    int max = 100000000;

    // {0, 1, ..., n-1} の部分集合の全探索
    for (int bit = 0; bit < (1<<n); ++bit) {
        vector<int> S;
        for (int i = 0; i < n; ++i) {
            if (bit & (1<<i)) { // 列挙に i が含まれるか
                S.push_back(i);
            }
        }

        for(int j = 0; j < M; j++){
          det.at(j) = 0;
        }

        for (int i = 0; i < (int)S.size(); ++i) {
          money += C.at(S[i]);
          for(int j = 0; j < M; ++j){
            det.at(j) += A.at(S[i]).at(j);
          }
        }

        sort(det.begin(),det.end());

      if(det.at(0) >= X){
        if(max > money) max = money;
      }
      

      money = 0;
    }

    if(max != 100000000)cout << max << endl;
    else cout << -1 << endl;

}

Measured memory_bytes: 3608
#include <iostream>

using namespace std;

int main() {
    ios::sync_with_stdio(false);

    int n;
    cin >> n;

    for (int i = 1; i <= 9; i++) {
        for (int j = 1; j <= 9; j++) {
            if (n == i * j) {
                cout << "Yes" << endl;
                return 0;
            }
        }
    }

    cout << "No" << endl;

    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<bits/stdc++.h>
#define int long long
#define mod 1000000007
using namespace std;
int n;
vector<int> adj[100005];
int dp[100005][2];

int solve(int u,bool constraint,int parent){

	if(dp[u][constraint]!=-1)
		return dp[u][constraint];

	int ans = 0;
	int w1 = 1;
	for(auto child: adj[u]){
		if(child!=parent)
			w1 = (w1*solve(child,0,u))%mod;
	}
	ans+=w1;

	int w2=1;
	if(!constraint){
		for(auto child: adj[u]){
		if(child!=parent)
			w2 = (w2*solve(child,1,u))%mod;
	}
		ans = (ans+w2)%mod;
	}



	return dp[u][constraint]=ans;


}



int32_t main(){
#ifndef ONLINE_JUDGE
    // for getting input from input.txt
    freopen("input.txt", "r", stdin);
    // for writing output to output.txt
    freopen("output.txt", "w", stdout);
#endif
	cin>>n;
	for(int i=0;i<n-1;i++){
		int x,y;
		cin>>x>>y;
		adj[x].push_back(y);
		adj[y].push_back(x);
	}

	memset(dp,-1,sizeof dp);

	cout<<solve(1,0,-1)<<endl;






}

Measured memory_bytes: 17408
#include <cstdio>
#include <cstdlib>
#include <string>
#include <iostream>
using namespace std;
typedef long long ll;

struct Node {
	ll key;
	Node* right, * left, * parent;
};

Node* root, * NIL;
Node* treeMininum(Node* x) {
	while (x->left != NIL) x = x->left;
	return x;
}
Node* find(Node* u, ll k) {
	while (u != NIL && k != u->key) {
		if (k < u->key)u = u->left;
		else u = u->right;
	}
	return u;
}
Node* treeSuccessor(Node* x) {
	if (x->right != NIL) return treeMininum(x->right);
	Node* y = x->parent;
	while (y != NIL && x == y->right) {
		x = y;
		y = y->parent;
	}
	return y;
}
void treeDelete(Node* z) {
	Node* y;
	Node* x;

	if (z->left == NIL || z->right == NIL) y = z;
	else y = treeSuccessor(z);
	if (y->left != NIL) {
		x = y->left;
	}
	else {
		x = y->right;
	}
	if (x != NIL) {
		x->parent = y->parent;
	}
	if (y->parent == NIL) {
		root = x;
	}
	else {
		if (y = y->parent->left) {
			y->parent->left = x;
		}
		else {
			y->parent->right = x;
		}
	}
	if (y != z) {
		z->key = y->key;
	}

	free(y);
}
void insert(ll k) {
	Node* y = NIL;
	Node* x = root;
	Node* z;

	z = (Node*)malloc(sizeof(Node));
	z->key = k;
	z->left = NIL;
	z->right = NIL;

	while (x != NIL) {
		y = x;
		if (z->key < x->key) {
			x = x->left;
		}
		else {
			x = x->right;
		}
	}
	z->parent = y;
	if (y == NIL) {
		root = z;
	}
	else {
		if (z->key < y->key) {
			y->left = z;
		}
		else {
			y->right = z;
		}
	}
}

void inorder(Node* u) {
	if (u == NIL) return;
	inorder(u->left);
	printf(" %d", u->key);
	inorder(u->right);
}
void preorder(Node* u) {
	if (u == NIL) return;
	printf(" %d", u->key);
	preorder(u->left);
	preorder(u->right);
}
int main() {
	ll N, i, X;
	string com;
	cin >> N;
	for (i = 0; i < N; i++) {
		cin >> com;
		if (com.at(0) == 'f') {
			cin >> X;
			Node* t = find(root, X);
			if (t != NIL) cout << "yes" << endl;
			else cout << "no" << endl;
		}
		if (com == "insert") {
			cin >> X;
			insert(X);
		}
		else if (com == "print") {
			inorder(root);
			cout << endl;
			preorder(root);
			cout << endl;
		}
		else if (com == "delete") {
			cin >> X;
			treeDelete(find(root, X));
		}
	}
}



Measured memory_bytes: 22036
function Main(arg) {
 
    var S = arg.split("\n")[0];

    var ans = true;

    for (var i = 1; i <= S.length; i++){

        if (i % 2 === 0) {
            if (S[i - 1] === "R") {
                ans = false;
                break;
            }
        }
        else {
            if (S[i - 1] === "L" ) {
                ans = false;
                break;
            }
        }

    }

    console.log(ans ? "Yes" : "No");
}

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

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

using namespace std;
#define PB push_back
#define MP make_pair
#define LL long long
#define int LL
#define FOR(i,a,b) for(int i = (a); i <= (b); i++)
#define RE(i,n) FOR(i,1,n)
#define REP(i,n) FOR(i,0,(int)(n)-1)
#define R(i,n) REP(i,n)
#define VI vector<int>
#define PII pair<int,int>
#define LD long double
#define FI first
#define SE second
#define st FI
#define nd SE
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) ((int)(x).size())

template<class C> void mini(C& _a4, C _b4) { _a4 = min(_a4, _b4); }
template<class C> void maxi(C& _a4, C _b4) { _a4 = max(_a4, _b4); }

template<class TH> void _dbg(const char *sdbg, TH h){ cerr<<sdbg<<'='<<h<<endl; }
template<class TH, class... TA> void _dbg(const char *sdbg, TH h, TA... a) {
  while(*sdbg!=',')cerr<<*sdbg++;cerr<<'='<<h<<','; _dbg(sdbg+1, a...);
}

template<class T> ostream& operator<<(ostream& os, vector<T> V) {
  os << "["; for (auto& vv : V) os << vv << ","; os << "]";
  return os;
}

#ifdef LOCAL
#define debug(...) _dbg(#__VA_ARGS__, __VA_ARGS__)
#else
#define debug(...) (__VA_ARGS__)
#define cerr if(0)cout
#endif

#define MAX 501
int n,m;
string t[MAX],t2[MAX];
int32_t main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout << fixed << setprecision(11);
  cerr << fixed << setprecision(6);
  cin >> n >> m;
  R(i,n){
    cin >> t[i];
    t2[i] = t[i];
  }
  R(i,n){
    if(i != n-1)R(j,m){
      if(i == 0 || j % 2 == 0){
        t2[i][j] = '#';
      }
    }
    cout << t2[i] << endl;
    t2[i] = t[i];
  }
  cout << "\n";
  R(i,n){
    if(i != 0)R(j,m){
      if(i == n-1 || j % 2 == 1){
        t2[i][j] = '#';
      }
    }
    cout << t2[i] << endl;
  }
}


Measured memory_bytes: 1408
import java.math.BigDecimal;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		long a = sc.nextLong();
		double b = sc.nextDouble();
		
		BigDecimal result = BigDecimal.valueOf(a).multiply(BigDecimal.valueOf(b));
		System.out.println(result.longValue());
	}

}


Measured memory_bytes: 37544
/*
Ë¼Â·£º
	ÌâÄ¿¹Ø¼üµã¾ÍÊÇÒ»´Î²Ù×÷×î¶àÔö¼Ó2¸öhappy people , 
	¶øÇÒÒ»¶¨ÄÜ×öµ½£¨Ã¿´ÎÑ¡ÔñÁ¬ÐøÏàÍ¬µÄÒ»¸ö×Ö¶Î£© , 
	¶øÇÒÃ¿´Î²Ù×÷¿ÉÒÔ×öµ½²»»áÊ¹ÊýÖµ¼õÉÙ£¨Ö»Òª²»°ÑÁ¬ÐøÏàÍ¬×ÖÄ¸µÄ´®·Ö¿ª£© , 
	ËùÒÔÕâ¸öÌâÖ±½ÓÏÈÊýÒ»±éÔ­´®µÄhappy people , 
	È»ºó°´×î¶àµÄÃ¿´Î²Ù×÷Ôö¼Ó2À´¼ÆËã¾ÍÐÐÁË¡£
*/
#include<algorithm>
#include<iostream>
#include<string.h>
#include<stdio.h>
using namespace std;

int main()
{
	int n,k;cin>>n>>k;
	string s;cin>>s;
	
	int ans=0;
	for(int i=1; i<s.size(); i++)
		if(s[i]==s[i-1])
			ans++;
	ans=min(2*k+ans,n-1);
	
	cout<<ans<<endl;
	return 0;
}

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

class Dice
{
private:
  int d[6];
public:
  Dice();
  void CreateDice(int n1, int n2, int n3, int n4, int n5, int n6);
  void disp();
  void Roll_The_Dice(int top, int front);
  void compare_dice(Dice dice);
};

Dice::Dice(){
  for(int i = 0; i < 6; i++){
    d[i] = 0;
  }
}

void Dice::CreateDice(int n1, int n2, int n3, int n4, int n5, int n6){
  d[0] = n1;
  d[1] = n2;
  d[2] = n3;
  d[3] = n4;
  d[4] = n5;
  d[5] = n6;
}

void Dice::disp(){
  for(int i = 0; i < 6; i++){
    cout << d[i] << " ";
  }
  cout << endl;
}

void Dice::Roll_The_Dice(int top, int front){
  int tmp;
  int i = 0, count = 0;
  while(true){
    for(i = 0; i < 4; i++){
      if(d[0] == top){
        break;
      }
      tmp  = d[0];
      d[0] = d[4];
      d[4] = d[5];
      d[5] = d[1];
      d[1] = tmp;
    }
    if(d[1] == front && d[0] == top){
      break;
    }
    tmp  = d[3];
    d[3] = d[1];
    d[1] = d[2];
    d[2] = d[4];
    d[4] = tmp;
    i = 0;
    count++;
    if(count >= 3){
      break;
    }
  }
}

void Dice::compare_dice(Dice dice){
  int count = 0;
  for(int i = 0; i < 6; i++){
    if(d[i] == dice.d[i]){
      count++;
    }
  }
  if(count == 6){
    cout << "Yes" << endl;
  } else if(count <= 5){
    cout << "No" << endl;
  }
}

int main(){
  int n[6];
  for(int i = 0; i < 6; i++){
    cin >> n[i];
  }
  Dice dice1;
  dice1.CreateDice(n[0],n[1],n[2],n[3],n[4],n[5]);

  for(int i = 0; i < 6; i++){
    cin >> n[i];
  }
  Dice dice2;
  dice2.CreateDice(n[0],n[1],n[2],n[3],n[4],n[5]);

  for(int i = 0; i < 5; i++){
    if(n[i] != n[i+1]){
      dice1.Roll_The_Dice(n[i],n[i+1]);
      dice2.Roll_The_Dice(n[i],n[i+1]);
    }
  }
  dice1.compare_dice(dice2);
}



Measured memory_bytes: 3108
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#define MOD 1000000007LL
#define max(x,y) ((x)>(y))?(x):(y)
#define min(x,y) ((x)>(y))?(y):(x)

long long factinv[900010], fact[900010];

void factorial(void) {
	int i, j;
	long long P, Q, R, EXP;

	fact[0] = 1; factinv[0] = 1;
	for (i=1;i<=900000;i++) {
		fact[i] = fact[i-1];
		fact[i] *= i;
		fact[i] %= MOD;

		factinv[i] = factinv[i-1];
		P = 1;
		Q = i;
		EXP = 1000000005LL;
		while (EXP>0) {
			if (EXP & 1) P *= Q;
			Q *= Q;
			EXP >>= 1;
			P %= MOD;
			Q %= MOD;
		}
		factinv[i] *= P;
		factinv[i] %= MOD;
	}

}

long long comb_mod(int a, int b) {
	long long P=1;
	P = P * fact[a];
	P = P * factinv[a-b] % MOD;
	P = P * factinv[b]   % MOD;
	return P;
}

int main() {
	int i, j, K, M, N;
	long long P, Q, R, T;
	factorial();
	scanf("%d%d%d", &N, &M, &K);

	P = 0; T = 0;
	for (i=N;i<=N+M+K;i++) {
//		printf("%6d\t", i);
		Q = 1;
		R = 3;
		j = N+M+K-i;
		while (j>0) {
			if (j & 1) Q *= R;
			R *= R;
			j >>= 1;
			R %= MOD;
			Q %= MOD;
		}
//		printf("%10lld\t", Q);
		Q *= comb_mod(i-1, N-1);
		Q %= MOD;
//		printf("%10lld\t", Q);
		if (T==0) T = 1LL;
		else {
			T *= 2LL;
			if (i>N+K) T -= comb_mod(i-N-1, i-N-1-K);
			if (M<i-N) T -= comb_mod(i-N-1, M);
		}
		T %= MOD;
		if (T<0) T += MOD;
		Q *= T;
		Q %= MOD;
//		printf("%10lld\n", Q);

		P += Q;
		P %= MOD;
	}

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


Measured memory_bytes: 14208
import java.util.*;

public class Main {

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int A = scanner.nextInt();
        int B = scanner.nextInt();
        int C = scanner.nextInt();
        int K = scanner.nextInt();

        long sum = 0;
        if (A >= K) {
            System.out.println(K);
        } else {
            int localK = K - A;
            if (B >= localK) {
                System.out.println(A);
            } else {
                int tempK = localK - B;
                System.out.println(A - tempK);
            }
        }
    }
}

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

int ri() {
	int n;
	scanf("%d", &n);
	return n;
}
int64_t rll() {
	long long n;
	scanf("%lld", &n);
	return n;
}

int main() {
	/*
	int n = ri();
	int64_t a[n];
	for (int i = 0; i < n; i++) {
		a[i] = rll();
	}
	int64_t res = 0;
	for (int i = 0; i < 2 * n; i++) {
		int64_t add = 0;
		for (int j = 0; j < n; j++) {
			int64_t cnt = a[j] / n;
			add += cnt;
			a[j] -= cnt * (n + 1);
		}
		for (int j = 0; j < n; j++) a[j] += add;
		res += add;
	}
	std::cout << res << std::endl;*/
	
	int n = ri();
	std::pair<int, int> a[n];
	for (int i = 0; i < n; i++) a[i].first = ri(), a[i].second = ri();
	std::sort(a, a + n, [](std::pair<int, int> x, decltype(x) y) {
		return x.second < y.second;
	});
	int64_t cur = 0;
	for (int i = 0; i < n; i++) {
		cur += a[i].first;
		if (cur > a[i].second) {
			std::cout << "No" << std::endl;
			return 0;
		}
	}
	std::cout << "Yes" << std::endl;
	return 0;
}


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

// def
#define debug(x) cout << #x << ": " << x << endl
#define out(x) cout << x << endl
#define repeat(i, a, b) for (int i = (a); i < (b); i++)
#define revrepeat(i, a, b) for (int i = (b)-1; i >= (a); i--)
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define revrep(i, n) for (int i = (n)-1; i >= 0; i--)
#define all(x) (x).begin(), (x).end()
typedef long long ll;
typedef long double ld;
typedef pair<int, int> P;
typedef complex<ld> Point;
typedef vector<vector<int>> Graph;
const int MOD = 1e9 + 7;
const int INF = 1e9;
const int MAX_V = 1e5 + 5;
const int MAX_N = 1e5 + 5;
const double PI = acos(-1);

int main() {
    int n, m;
    cin >> n >> m;
    if (n == m)
        out("Yes");
    else
        out("No");
    return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

    private void solve() {
        Scanner sc = new Scanner(System.in);
        String input = sc.next();
        if (input.equals("A")) {
            System.out.println("T");
        }
        else if (input.equals("C")) {
            System.out.println("G");
        }
        else if (input.equals("G")) {
            System.out.println("C");
        }
        else { // T
            System.out.println("A");
        }
    }

    // Main
    public static void main(String[] args) {
        new Main().solve();
    }

}


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

int main() {
  int n;
  cin >>n;
  map<int,int>mp;
  for(int i=0;i<n;i++){
    int x;
    cin>>x;
    mp[x]++;
  }
  int m;
  cin>>m;
  for(int i=0;i<m;i++){
    int x;
    cin>>x;
    if(mp[x]>=1)mp[x]--;
    else{
      cout<<"NO"<<endl;
      return 0;
    }
  }
  cout<<"YES"<<endl;
  return 0;
}



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

int main(){
  char s[10];
  int i, j, n, max=0;
  
  
  if(scanf("%s", s)==0) return -1;
  n=strlen(s);
  
  for(i=0;i<n;i++){
    if(s[i]=='A'||s[i]=='C'||s[i]=='G'||s[i]=='T'){
      for(j=i+1;j<n;j++){
      	if(s[j]!='A'&&s[j]!='C'&&s[j]!='G'&&s[j]!='T') break;
      }
      if(max<(j-i)) max=j-i;
        i=j;
    }
  }
  
  printf("%d", max);

  return 0;
}


Measured memory_bytes: 128
#include <algorithm>
#include <iostream>
#include <vector>

using namespace std;

int main() {
  int n;
  vector<int> b;
  cin >> n;

  long long sum = 0;
  for (int i = 0; i < n - 1; i++) {
    int tmp;
    cin >> tmp;
    b.push_back(tmp);
  }

  for (int i = 1; i < n; i++) {
    sum += min(b[i - 1], b[i]);
  }
  sum += b[0] + b[n - 2];

  cout << sum << endl;
}

Measured memory_bytes: 256
#include<stdio.h>
int main(void)
{
  int a,b;
  int count=0;
  scanf("%d %d",&a,&b);
  int sum=1;
  while(sum<b){
    sum+=a;
    sum-=1;
    count++;
  }
  printf("%d\n",count);
  return 0;
}


Measured memory_bytes: 128
#include <random>    //ランダム
#include <algorithm> //アルゴリズム
#include <iostream>
#include <map>
#include <vector>
#include <set>
#include <algorithm>
#include <iterator>
#include <cstdlib>
#include <fstream>
#include <cmath>
#include <cstring>
#include <string>
#include <sstream>
#include <cassert>
#include <cfloat>
#include <numeric>
#include <climits>
#include <stdint.h>
#include <ctime>
#include <functional>
using namespace std;
// vector<int> temple(7,0);
    // for(int i=0; i<temple.size(); i++){
    
    // }
    // int maxtemp=*max_element(temple.begin(), temple.end());;
    // int mintemp=*min_element(temple.begin(), temple.end());;
    // int answer=0;
    // for(int i=0; i<temple.size(); i++){
    //     if(temple[i]==maxtemp||temple[i]==mintemp){
            
    //     }else{
    //         answer+=temple[i];
    //     }
    // }
    // answer/=5;
    // cout << answer << std::endl;
    void ifmagic(int select, int depth, int kaisuu, int h1, int h2, int h3, int& answer, vector<long>& leng){
        if(depth==1){
            h1=leng[select];
        }else if(depth==2){
            h2=leng[select];
        }else if(depth==3){
            h3=leng[select];
        }
        if(h1==h2||h1==h3||h2==h3){
            return;
        }
        if(depth>kaisuu){
            return;
        }else if(depth==kaisuu){
            if(h1+h2>h3&&h1+h3>h2&&h2+h3>h1){
                answer++;
                return;
            }else{
                return;
            }        
        }
        //cout<<h1<<" "<<h2<<" "<<h3<<endl;
        // cout<<"red=="<<red<<endl;
        // cout<<"green=="<<green<<endl;
        // cout<<"blue=="<<blue<<endl;
        for(int i=select+1; i<leng.size(); i++){
            ifmagic(i,depth+1,kaisuu,h1,h2,h3,answer,leng);
        }
        return;
    }
int main()
{
    string N;
    cin >> N ;
    int answer=0;
    for(unsigned int i=0; i<N.size(); i++){
        answer+=int(N[i] - '0');
    }
    if(answer%9==0){
        cout<<"Yes"<<endl;
    }else{
        cout<<"No"<<endl;
    }
}


Measured memory_bytes: 3684
#define _CRT_SECURE_NO_WARNINGS
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<string>
#include<algorithm>
#include<cmath>
#include<queue>
#include<vector>
#include<stack>
using namespace std;

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

static const int INFTY = (1 << 20);
static const int MOD = 360;

int a, b, D[102], S[102], V[102];
int day[360];

int main() {
	int N;
	
	cin >> N;
	REP(i, N) {
		cin >> a >> b >> V[i] >> S[i];
		D[i] = (a - 1) * 30 + b - 1;//0-indexed
	}

	
	REP(i, 360) day[i] = 0;//0-indexed

	REP(i, 360) {
		REP(j, N) {
			int len1 = min(abs(i - D[j]), min(abs(360 - D[j] + i), abs(360 - i + D[j])));
			int len2 = min(abs((D[j] + V[j] - 1) % MOD - i), min(abs(360 - (D[j] + V[j] - 1) % MOD + i), abs(360 - i + (D[j] + V[j] - 1) % MOD)));
			day[i] = max(day[i], S[j] - min(len1, len2));

			//if(i==359) cout << len1 << " " << len2 << endl;
		}
	}

	REP(i, 360) {
		REP(j, N) {
			if (i < D[j]) {
				if (i + 360 >= D[j] && i + 360 <= D[j] + V[j] - 1) day[i] = max(day[i],S[j]);
			}
			else {
				if (i >= D[j] && i <= D[j] + V[j] - 1) {
					day[i] = max(day[i],S[j]);
				}
			}
			
		}
	}

	int ans = INFTY;
	REP(i, 360) {
		ans = min(ans, day[i]);
		//cout << day[i] << " ";
	}
	//cout << endl;

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

Measured memory_bytes: 3112
#include <cstring>
#include <sstream>
#include <cstdio>
#include <algorithm>
#include <iostream>
#include <vector>
#include <iomanip>
#include <map>
#include <unordered_map>
#include <cmath>
#include <queue>
#include <set>
#include <numeric>
#include <stack>

using namespace std;
typedef long long ll;
#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)
#define repr(i, n) for(ll i = n - 1; i >= 0; i--)
#define repone(i, n) for(ll i = 1; i <= (ll)(n); i++)
#define each(i, mp) for(auto i:mp)
#define eb emplace_back
#define F first
#define S second
#define all(obj) (obj).begin(), (obj).end()
const int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};
const ll mod = 1000000007;
const ll inf = ll(1e9);
const ll half_inf = ll(1e5);
const ll ll_inf = ll(1e9) * ll(1e9);
typedef unordered_map<ll, ll> mpll;
typedef unordered_map<char, ll> mpcl;
typedef unordered_map<string, ll> mpsl;
typedef pair<ll, ll> P;
typedef vector<ll> vl;
typedef vector<vl> vvl;
template<typename T> using PQ = priority_queue<T>;
template<typename T> using minPQ = priority_queue<T, vector<T>, greater<T>>;

ll inl() {
    ll x;
    cin >> x;
    return (x);
}

string ins() {
    string x;
    cin >> x;
    return (x);
}

int main() {
#ifdef MY_DEBUG
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wmissing-noreturn"
    while (true) {
#pragma clang diagnostic pop
#endif
        vl a(5);
        rep(i, 5) cin >> a[i];
        ll k = inl();
        if (*max_element(all(a)) - *min_element(all(a)) > k)cout << ":(" << endl;
        else cout << "Yay!" << endl;

#ifdef MY_DEBUG
    }
#endif
    return 0;
}

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

int main() {
  int a,b,c,k;
  cin >> a >> b >> c;
  cin >> k;
  int m1=0;
  while (b<=a){
    m1++;
    b *= 2;
  }
  int m2=0;
  while (c<=b){
    m2++;
    c *= 2;
  }
  if (m1+m2<=k) cout << "Yes" << endl;
  else cout << "No" << endl;

  return 0;
}

Measured memory_bytes: 3632
#include <stdio.h>
int min(int n,int m){
    if(n<m) return n;
    else return m;
}
int main(void){
    int n,i,j,ans=10000009;
    scanf("%d",&n);
    int a[n];
    for(i=0;i<n;i++) scanf("%d",&a[i]);
    for(i=1;i<100;i++){
        int g=0;
        for(j=0;j<n;j++){
            g+=(a[j]-i)*(a[j]-i);
        }
        ans=min(ans,g);
    }
    printf("%d",ans);
}


Measured memory_bytes: 128
N = int(input())
x, y = [0]*N, [0]*N
for i in range(0,N):
    x[i], y[i] = map(int, input().split())
s = 0
for i in range(0,N-1):
    for j in range(i+1,N):
        d = ((x[i]-x[j])**2+(y[i]-y[j])**2)**0.5
        s = s+d
print (s*2/N)

Measured memory_bytes: 3064
def gs() gets.chomp end
def gi() gets.to_i end
def gsmi() gets.chomp.split.map(&:to_i) end
 
def desc(ar) ar.sort.reverse end
def min(a,b) a<=b ? a : b end
def max(a,b) a>=b ? a : b end
def sum(ar) ar.inject(:+) end

X,Y,Z,K = gsmi
A = desc gsmi
B = desc gsmi
C = desc gsmi

ans = []
X.times do |x|
	Y.times do |y|
		break if (x+1)*(y+1) > K
		Z.times do |z|
			break if (x+1)*(y+1)*(z+1) > K
			ans << A[x] + B[y] + C[z]
		end
	end
end

puts desc(ans)[0...K]

Measured memory_bytes: 4532
#include "bits/stdc++.h"

using namespace std;
using LL = long long;

constexpr int N = 1e5 + 5;

int main() {
	ios::sync_with_stdio(false); cin.tie(nullptr);
	
	LL X;
	cin >> X;

	LL bal = 100;

	int res = 0;
	while (bal < X) {
		bal = bal + bal / 100;
		res++;
	}

	cout << res << endl;
}

Measured memory_bytes: 3640
#include <bits/stdc++.h>
#include <boost/range/algorithm.hpp>
#include <boost/range/numeric.hpp>
#include <boost/integer/common_factor.hpp>
#include <boost/integer/common_factor_rt.hpp>
#include <boost/multiprecision/cpp_dec_float.hpp>
#include <boost/multiprecision/cpp_int.hpp>

using std::string;
using std::vector;
using std::set;
using std::multiset;
using std::unordered_set;
using std::map;
using std::multimap;
using std::unordered_map;
using std::pair;
using std::cin;
using std::cout;

using boost::multiprecision::cpp_int;
using cpp_dec_float_1000 = boost::multiprecision::number<boost::multiprecision::cpp_dec_float<1000>>;

typedef uintmax_t    ull;
typedef intmax_t     ll;
typedef uint64_t     ul;
typedef uint32_t     ui;
typedef uint8_t      uc;

constexpr char CRLF  = '\n';
constexpr char SPACE = ' ';
constexpr char VECTOR_COUT_SEPARATOR = SPACE;
constexpr ll INF = 1000'000'007;
constexpr int MOD = 1000'000'007;

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> std::ostream& operator<< (std::ostream& os, const std::vector<T>& vc) { for(auto it = vc.begin(); it != vc.end(); ++it) { if (std::next(it) == vc.end()) os << *it; else os << *it << VECTOR_COUT_SEPARATOR; } return os; }
template<class T1, class T2> inline std::ostream & operator<< (std::ostream & os, const std::pair<T1, T2> & p) { return os << p.first << ' ' << p.second; }
template<class T> T modinv(T a, T m) { T b = m, u = 1, v = 0; while (b) { T t = a / b; a -= t * b; boost::swap(a, b); u -= t * v; boost::swap(u, v); } u %= m; if (u < 0) u += m; return u; }

struct Tmp
{
public:
  Tmp(int N);
};

Tmp::Tmp(int N){}

void solve(void)
{
  int N; cin >> N;
  vector<string> A(N);
  vector<int> B(N);
  map<string, int> m{};
  for (auto& a : A) {
    cin >> a;
    ++m[a];
  }
  for (int i = 0; i < N; ++i) {
    B[i] = m[A[i]];
  }
  auto cnt = *boost::max_element(B);
  set<string> res{};
  for (int i = 0; i < N; ++i) {
    if (B[i] == cnt) {
      res.emplace(A[i]);
    }
  }
  vector<string> ans(res.begin(), res.end());
  boost::for_each(ans, [](auto& s){
    cout << s << CRLF;
  });
  return;
}

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

  solve();

  return 0;
}


Measured memory_bytes: 37120
#include "iostream"

using namespace std;

int N;
int a[100001] = {};
bool flag[100001] = {};
int box=1;
int num=0;

int main(){
	cin >> N;
	for (int i = 1; i <= N; i++) {
		cin >> a[i];
	}
	flag[1] = true;
	while (1) {
		if (a[box] == 2) {
			cout << num + 1 << endl;
			return 0;
		}
		if (flag[a[box]]) {
			cout << -1 << endl;
			return 0;
		}
		box = a[box];
		flag[box] = true;
		num++;
	}
}

Measured memory_bytes: 768
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>

int main() {
	long long N, A, B;
	std::cin >> N >> A >> B;

	long long min = A + B + A * (N - 2);
	long long max = A + B + B * (N - 2);

	std::cout << std::max(0LL, max - min + 1)  << std::endl;
}


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

using namespace std;
using ll =long long;

#define SORT(a) sort((a).begin(),(a).end())
#define rSORT(a) reverse((a).begin(),(a).end())
#define For(i, a, b)    for(int i = (a) ; i < (b) ; ++i)
#define rep(i, n)       For(i, 0, n)
#define debug(x)  cout << #x << " = " << (x) << endl;
bool coY() {cout <<"Yes"<<endl;}
bool coN(){cout <<"No"<<endl;}

const ll INF = 1LL << 60;

ll N,M,H,W,K,A,B;
string S;
//Write From this Line

int main()
{
	cout << setprecision(10);
	cin >> N ;
	int keta = to_string(N).size();
	ll ans = 0;
	for(int i = 1; i <=keta ; i++){
		if(i % 2 == 1){
			if( i== keta){
				ans += N - pow(10,keta - 1) + 1 ;
			}
			else{
				ans += pow(10,i) - pow(10,i-1);
			}
		}
	}
	cout << ans << endl;


}


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

using namespace std;

typedef long long int ll;

const ll MAXN = 1e5 + 5;

vector < ll > v;
ll dp[20][2][10][2];

ll solve(ll idx, ll smaller, ll prev, ll f){
  if(idx == v.size()){
    return 1;
  }

  if(dp[idx][smaller][prev][f] != -1) return dp[idx][smaller][prev][f];

  ll ans = 0;
  if(smaller){
    if(f == 0){
      for(int i = 0; i < 10; i++){
        ans += solve(idx + 1, 1, i, i == 0 ? 0 : 1);
      }
    }else if(prev == 0){
      ans += solve(idx + 1, 1, 1, 1) + solve(idx + 1, 1, 0, 1);
    }else if(prev == 9){
      ans += solve(idx + 1, 1, 8, 1) + solve(idx + 1, 1, 9, 1);
    }else{
      ans += solve(idx + 1, 1, prev + 1, 1) + solve(idx + 1, 1, prev - 1, 1) + solve(idx + 1, 1, prev, 1);
    }
  }else{
    if(f == 0){
      for(int i = 0; i <= v[idx]; i++){
        ans += solve(idx + 1, i == v[idx] ? 0 : 1, i, i == 0 ? 0 : 1);
      }
    }else{
      if(prev + 1 <= v[idx]) ans += solve(idx + 1, prev + 1 == v[idx] ? 0 : 1, prev + 1, 1);
      if(prev - 1 >= 0 && prev - 1 <= v[idx]) ans += solve(idx + 1, prev - 1 == v[idx] ? 0 : 1, prev - 1, 1);
      if(prev <= v[idx]) ans += solve(idx + 1, prev == v[idx] ? 0 : 1, prev, 1);
    }
  }

  dp[idx][smaller][prev][f] = ans;
  return ans;
}

ll preprocess(ll n){
  v.clear();
  memset(dp, -1, sizeof(dp));
  while(n > 0){
    v.push_back(n % 10);
    n /= 10;
  }
  reverse(v.begin(), v.end());

  ll ans = 0;
  for(int i = 0; i <= v[0]; i++){
    ans += solve(1, i == v[0] ? 0 : 1, i, i == 0 ? 0 : 1);
  }
  return ans;
}

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

  ll k;
  cin >> k;
  ll lo = 1, hi = 1e15;
  ll ans = 1e18;

  while(lo <= hi){
    ll mid = (hi - lo) / 2 + lo;
    if(preprocess(mid) - 1 < k){
      lo = mid + 1;
    }else if(preprocess(mid) - 1 == k){
      ans = min(ans, mid);
      hi = mid - 1;
    }
    else hi = mid - 1;
  }

  cout << ans << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define range(i,a,b) for(int i = (a); i < (b); i++)
#define rep(i,b) for(int i = 0; i < (b); i++)
#define all(a) (a).begin(), (a).end()
#define show(x)  cerr << #x << " = " << (x) << endl;
const long long INF = (1LL << 60);
using namespace std;

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

	vector<long long> a(n);
	rep(i,n){
		cin >> a[i];
	}

	long long maxi = 2, mini = 2;
	auto f = [](long long t, long long num){ return t - t % num; };
	for(auto i = a.rbegin(); i != a.rend(); i++){
		auto num = *i;
		{
			long long right = INF, left = num;
			rep(i,100){
				long long mid = (right + left) / 2;
				if(mini <= f(mid, num)) right = mid;
				else left = mid;
			}
			mini = right;
		}
		if(mini > maxi){
			cout << -1 << endl;
			return 0;
		}
		{
			long long right = INF, left = num;
			rep(i,100){
				long long mid = (right + left) / 2;
				if(maxi >= f(mid, num)) left = mid;
				else right = mid;
			}
			maxi = left;
		}
		//cout << mini << ' ' << maxi << endl;
	}
	cout << mini << ' ' << maxi << endl;
}


Measured memory_bytes: 1024
#include <stdio.h>
#define min(p,q)((p)<(q)?(p):(q))

int dp[1000];
int a[4],b[4];
int main(){
	int n;
	scanf("%d",&n);
	for(int i=0;i<4;i++)scanf("%d",a+i);
	for(int i=0;i<4;i++)scanf("%d",b+i);
	for(int i=1;i<1000;i++)dp[i]=1e8;
	for(int i=0;i<900;i++){
		for(int j=0;j<4;j++){
			dp[i+b[j]]=min(dp[i+b[j]],dp[i]+a[j]);
		}
	}
	int ans=1e6;
	for(int i=n;i<1000;i++)ans=min(ans,dp[i]);
	printf("%d\n",ans);
}


Measured memory_bytes: 2100
#!/usr/bin/env python3
import sys
import numpy as np


def solve(N: int, a: "List[int]"):
    t = 0
    ans = []
    for i in range(N):
        t ^= a[i]

    for i in range(N):
        ans.append(str(t^a[i]))

    print(' '.join(ans))
    return


# Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    a = [int(next(tokens)) for _ in range(N)]  # type: "List[int]"
    solve(N, a)

if __name__ == '__main__':
    main()


Measured memory_bytes: 70012
#include <stdio.h>
#include <limits.h>
#define MAX 2000000

/* Prototype Declaration */
void insert(int);
void heapIncreaseKey(int, int);
int extractMax(void);
void maxHeapify(int);

/* Global Variables */
long A[MAX + 1];
int H = 0;

int main() {
  int k, s;
  char command[8];

  while ( 1 ) {
    scanf("%s", command);

    if ( command[0] == 'i' ) {
      scanf("%d", &k);
      insert(k);
    }else if ( command[0] == 'e' && command[1] == 'x' ) {
      s = extractMax();
      if ( s != -1 ) printf("%d\n", s);
    }else if ( command[0] == 'e' && command[1] == 'n' ) break;
  }

  return 0;
}

/* Insert Key to Priority Queue */
void insert(int keydata) {
  H++;
  A[H] = LONG_MIN; // -2147483647
  heapIncreaseKey(H, keydata);
}

void heapIncreaseKey(int i, int keydata) {
  long tmp;
  if ( keydata < A[i] ) return;
  A[i] = keydata;

  while ( i > 1 && A[i / 2] < A[i]) {
    tmp = A[i];
    A[i] = A[i / 2];
    A[i / 2] = tmp;
    i = i / 2;
  }
}

/* Extract Max Key from Priority Queue */
int extractMax() {
  long max;

  if ( H < 1 ) return -1;

  max = A[1];
  A[1] = A[H];
  H--;

  maxHeapify(1);

  return max;
}

void maxHeapify(int i) {
  int left, right, largest;
  long tmp;
  left = 2 * i;
  right = left + 1;

  if ( left <= H && A[left] > A[i] )
    largest = left;
  else
    largest = i;

  if ( right <= H && A[right] > A[largest] )
    largest = right;

  if ( largest != i) {
    tmp = A[i];
    A[i] = A[largest];
    A[largest] = tmp;
    maxHeapify(largest);
  }
}

Measured memory_bytes: 8792
import java.util.*;

class Main{
  public static void main(String args[]){
    Scanner sc = new Scanner(System.in);
    int APrice = sc.nextInt();
    int BPrice = sc.nextInt();
    int ABPrice = sc.nextInt();
    int ATarget = sc.nextInt();
    int BTarget = sc.nextInt();
    
    long answer = 0;
    
    if(APrice + BPrice >= 2 * ABPrice){
      if(ATarget > BTarget){
        answer = 2 * ABPrice * BTarget;
        ATarget -= BTarget;
        if(APrice >= ABPrice * 2){
          answer += ABPrice * 2 * ATarget;
        }else{
          answer += APrice * ATarget;
        }
      }else{
        answer = 2 * ABPrice * ATarget;
        BTarget -= ATarget;
        if(BPrice >= ABPrice * 2){
          answer += ABPrice * 2 * BTarget;
        }else{
          answer += BPrice * BTarget;
        }
      }
    }else{
      answer = APrice * ATarget + BPrice * BTarget;
    }
    
    System.out.println(answer);
  }
}

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

signed main() {
	int h, w;
	cin >> h >> w;
	vector<vector<char>> a(h, vector<char>(w));

	for (int i = 0; i < h; ++i) {
		for (int j = 0; j < w; ++j) {
			cin >> a[i][j];
		}
	}

	for (int i = 0; i < a.size(); ++i) {
		bool flag = true;
		for (int j = 0; j < a[0].size(); ++j) {
			if (a[i][j] == '#') flag = false;
		}
		if (flag) {
			a.erase(a.begin() + i);
			i--;
		}
	}

	for (int j = 0; j < a[0].size(); ++j) {
		bool flag = true;
		for (int i = 0; i < a.size(); ++i) {
			if (a[i][j] == '#') flag = false;
		}
		if (flag) {
			for (int i = 0; i < a.size(); ++i) {
				a[i].erase(a[i].begin() + j);
			}
			j--;
		}
	}

	for (int i = 0; i < a.size(); ++i) {
		for (int j = 0; j < a[0].size(); ++j) {
			cout << a[i][j];
		}
		cout << endl;
	}

}


Measured memory_bytes: 256
import java.util.Scanner;
class Main{
  public static void main(String[] args){
    Scanner stdIn = new Scanner(System.in);
    int N = stdIn.nextInt();
    double M = stdIn.nextDouble();
    Double X = 4*M;
    Double Y = 1/X;
    int[] s = new int[N];
    for (int i = 0; i<N; i++){
      s[i] = stdIn.nextInt();
    }
    int G = 0;
    for(int i = 0; i<N; i++){
      G += s[i];
    }
    int Sum = 0;
    for(int i = 0; i<N; i++){
      if(s[i]>=G*Y){
        Sum += 1;
      }
    }
    if(Sum >= M){
      System.out.println("Yes");
    }else{
      System.out.println("No");
    }
  }
}

Measured memory_bytes: 23252
use proconio::{fastout, input};

#[fastout]
fn main() {
    input! {
        x: i64,
        k: i64,
        d: i64,
    }

    let x = x.abs();
    let ans = if d <= x {
        if k <= x / d {
            x - k * d
        } else if (k - x / d) % 2 == 0 {
            x % d
        } else {
            d - x % d
        }
    } else if k % 2 == 0 {
        x
    } else {
        d - x
    };
    println!("{}", ans);
}


Measured memory_bytes: 2180
#include<bits/stdc++.h>
using namespace std;
 
typedef long long ll;
#define rep(i,a,b) for (int i = a; i < b; i++)
#define repn(i,a,b) for (int i = a; i >=b ;i--)
#define MOD 1000000007


int main(){
ios::sync_with_stdio(0);
cin.tie(0);
    ll a,b,c,d;cin>>a>>b>>c>>d;
    ll ans=LLONG_MIN;
    ans=max({ans,a*c,a*d,b*c,b*d});
    if((a<=0&&b>=0)||(c<=0&&d>=0))ans=max(ans,0LL);
    cout<<ans;
 
return 0;
}

Measured memory_bytes: 3652
#include <bits/stdc++.h>
#define FOR(i, a, b) for(int i=(a); i<(b); i++)
#define REP(i, n) FOR(i, 0, n)
#define all(x) (x).begin(), (x).end()
#define bit(x) (1L << (x))
using ll = long long;
using namespace std;

template<typename T>
vector<T> make_v(size_t a,T b){return vector<T>(a,b);}
 
template<typename... Ts>
auto make_v(size_t a,Ts... ts){
    return vector<decltype(make_v(ts...))>(a,make_v(ts...));
}

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

int main() {
    ll a, b; cin >> a >> b;
    ll g = gcd(a, b);

    cout << g * (a / g) * (b / g) << endl;

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, N) for (int i = 0; i < (int)N; ++i)
#define all(a) (a).begin(), (a).end()

int N, M;

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

  vector<vector<int>> sw(M);
  rep(i, M) {
    int k;
    cin >> k;
    rep(j, k) {
      int s;
      cin >> s;
      sw[i].push_back(s - 1);
    }
  }

  vector<int> p(M);
  rep(i, M) cin >> p[i];

  int ans = 0;
  rep(i, (1 << N)) {
    bitset<10> s(i);

    bool allOn = true;
    rep(j, M) {
      int c = 0;
      for (int t : sw[j])
        if (s[t]) ++c;
      if (c % 2 != p[j]) allOn = false;
    }
    if (allOn) ++ans;
  }

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 256
use strict;
use warnings;
use utf8;

my ($S) = split /\s/, <STDIN>;



my @S = split //, $S;

my $max = 0;
for (my $i = 0; $i < scalar @S; $i++) {

    my $j = 0;
    while (defined $S[$i + $j] and $S[$i + $j] =~ /[ACGT]/) {
        $j++
    }
    if ($max < $j) {
        $max = $j;
    }
}

printf "%s\n", $max;



Measured memory_bytes: 640
import java.util.*;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
      int Q = sc.nextInt();
      int[][] q = new int[Q][2];
      for(int i=0; i<Q; i++){
        q[i][0] = sc.nextInt();
        q[i][1] = sc.nextInt();
      }	
      //1~99999の中で、「2017」に似ていれば1、そうでなければ0のリストを生成する
      //配列[i]に対し、i*2+1 へ判定を行う。 例：i=0, 1  i=5 11
      int[] near = new int[50000];
      for(int i=0; i<near.length; i++) {
    	  int num = i * 2 + 1;
    	  near[i] = isNear2017(num);
      }
      //累積和のリストを生成
      //ruiseki[i] = near[i-1]までの合計
      int[] ruiseki = new int[50001];
      ruiseki[0] = 0;
      for(int i=0; i< near.length; i++) {
    	  ruiseki[i + 1] = ruiseki[i] + near[i];
      }
      
      for(int i=0; i<Q; i++) {
    	  int left = q[i][0] / 2;
    	  int right = q[i][1] / 2 + 1;
    	  int ans = ruiseki[right] - ruiseki[left];
    	  System.out.println(ans);  	  
      }

      
	}
	//Nが「2017に似ている」かどうかを調べる。似ていれば１、そうでなければ０を返す
    public static int isNear2017(int n) {
    	if (n == 1) return 0;
    	int r = 1;
    	int nPlus = (n + 1)/2;
    	for(int i=2; i<nPlus; i++) {
    		if(r == 0) break;
    		if(n%i==0)  r = 0;
    		if(nPlus%i==0) r=0;
    	}
    	for(int i= nPlus; i<n; i++) {
    		if(r == 0) break;
    		if(n%i==0) r=0;
    	}
    	return r;
    }
}

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

int main() {
  int h, a;
  cin >> h >> a;
  int atk_t = 0;
  if(h % a == 0) atk_t = h / a;
  else atk_t = (h / a) + 1;
  
  cout << atk_t << endl;
  return 0;
}

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

using namespace std;

typedef long long int ll;
const int INF = 1<<30;
const long long LINF = 1LL<<60;
const long long MOD = 998244353;

ll f[200001];

long long mod_pow(long long x_, long long y_){
    if(y_ == 0) return 1;
    long long res = mod_pow(x_ * x_ % MOD, y_ / 2);
    if(y_ & 1) res =  x_ * res % MOD;
    return res;
}

long long mod_inv(long long x){
    return mod_pow(x, MOD - 2);
}

ll comb(ll n, ll r){
    ll res = f[n] * mod_inv(f[r]);
    res %= MOD;
    res *= mod_inv(f[n - r]);
    res %= MOD;
    return res;
}

int main(){
    f[0] = 1;
    for(int i = 1; i <= 200000; i++){
        f[i] = f[i - 1] * i;
        f[i] %= MOD;
    }
    ll n, m, k, ans = 0;
    cin >> n >> m >> k;
    ll c = k;
    ll t = m;
    for(int i = 0; i < n - c - 1; i++){
        t *= (m - 1);
        t %= MOD;
    }
    for(int i = c; i >= 0; i--){
        ans += (t * comb(n - 1, i));
        ans %= MOD;
        t *= (m - 1);
        t %= MOD;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 5144
import sys
N = int(input())
b = list(map(int, input().split()))

if N==2:
	print(b[0]*2)
	sys.exit()

ans=[b[0]]*2
for i in range(N):
	if b[i] != max(ans[i], ans[i+1]):
		ans[i]=ans[i+1]
	ans.append(b[i+1])
	if len(ans)==N:
		if b[-1]!=max(ans[-1], ans[-2]):
			ans[-2]=ans[-1]
		break

print(sum(ans))


Measured memory_bytes: 3064
# -*- coding: utf-8 -*-
"""
Created on Sun Jul 21 23:25:47 2019

@author: Yamazaki Kenichi
"""
import bisect

N, K = map(int,input().split())
A = list(map(int,input().split()))

T = [[] for _ in range(2*10**5+1)]

for i in range(N):
    T[A[i]].append(i)

s = A[0]
pointa = 0
counta, res = 0, [-1]
while True:
    tmp = bisect.bisect_right(T[s], pointa) % len(T[s])
    p_pointa = pointa
    pointa = T[s][tmp] + 1
    if pointa == p_pointa + 1 or pointa < p_pointa:
        counta += 1
        res.append(p_pointa)
    if pointa == N:
        counta += 1
        res.append(p_pointa)
        break
    s = A[pointa]

ans = []
if K % counta != 0:
    pointa = res[K % counta]
#    ans.append(A[pointa])
    while pointa < N:
        if pointa < T[A[pointa]][-1]:
            tmp = bisect.bisect_right(T[A[pointa]],pointa)
            pointa = T[A[pointa]][tmp] + 1
        else:
            ans.append(A[pointa])
            pointa += 1
#        print(ans)
print(' '.join(map(str,ans)))


Measured memory_bytes: 127568
n = int(input())
a = [int(input()) for _ in range(n)]
ans = 0
j = 0
for i in range(n):
    ans+=1
    if i==0:
      j=a[i]
    if j==2:
      print(ans)
      quit()
    j = a[j-1]
print(-1)


Measured memory_bytes: 13068
import sys
import bisect
from collections import defaultdict

ans=0
#n=int(input())
n,m,k=map(int,input().split())
#a=[(1,int(i)) for i in input().split()]

# http://drken1215.hatenablog.com/entry/2018/06/08/210000
max_value = n*m+2
mod = 10 ** 9 + 7

fac = [0 for _ in range(max_value)]
finv = [0 for _ in range(max_value)]
inv = [0 for _ in range(max_value)]

def com_init():
    fac[0] = 1
    fac[1] = 1
    finv[0] = 1
    finv[1] = 1
    inv[1] = 1

    for i in range(2, max_value):
        fac[i] = fac[i - 1] * i % mod
        inv[i] = mod - inv[mod % i] * (mod // i) % mod
        finv[i] = finv[i - 1] * inv[i] % mod

def com(n, k):
    if n < k:
        return 0
    if n < 0 or k < 0:
        return 0
    return fac[n] * (finv[k] * finv[n - k] % mod) % mod

def dist(a,b):
    if a<=0 or b<=0:
        return 0
    
    a,b=min(a,b),max(a,b)
    a,b=a%mod,b%mod
    '''
    rt=((a*(a+1))%mod)*(a+b)//2
    rt+=((a*(a+b))%mod)*(b-a-1) if a!=b else 0
    rt+= - a*a if a==b else 0
    '''
    rt=((b*a*(a+b))//2)%mod
    #rt//=2
    return rt%mod

com_init()
inv2=500000004
#print(ans,dist(2,2),dist(1,0))
d=0
for i in range(n):
    for j in range(m):
        d+=dist(j,i+1)+dist(i,m-j)+dist(j+1,n-i-1)+dist(n-i,m-j-1)
        d%=mod
ans=d*com(n*m-2,k-2)
ans*=inv2

print(ans%mod)
        
        



Measured memory_bytes: 59728
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define l long
#define pb push_back
#define mp make_pair
#define mt make_tuple
int main() {
	// your code goes here
	//ifstream cin("input.txt");
	//ofstream cout("output.txt");
	ios_base::sync_with_stdio(false); 
    cin.tie(NULL); 
	
	
	ll k; int n; cin>>k>>n;
	ll a[n];
	for(int i=0;i<n;i++) cin>>a[i];
	ll ans = a[n-1]-a[0];
	for(int i=2;i<n;i++)
	{
	    ans = min(ans,k-a[i]+a[i-1]);
	}
	cout<<ans;
	
	
	return 0;
}


Measured memory_bytes: 1792
#include <stdio.h>

int main(void)
{
	int day;
	int koku, kazu;
	int n, m;
	int ans1;
	int ans2;
	
	scanf("%d", &day);
	scanf("%d", &koku);
	scanf("%d", &kazu);
	scanf("%d", &n);
	scanf("%d", &m);
	
	ans1 = koku / n;
	if (n * ans1 != koku){
		ans1++;
	}
	
	ans2 = kazu / m;
	if (m * ans2 != kazu){
		ans2++;
	}
	
	if (ans2 > ans1){
		ans1 = ans2;
	}
	
	printf("%d\n", day - ans1);
	
	return (0);
}

Measured memory_bytes: 596
#include<iostream>
#include<string>
#include <vector>
#include <algorithm>
using namespace std;
int main() {
  int n;
  cin >> n;
  
  int count = 0;
  for (int i = 1; i <= n; i++) {
    if ((1 <= i && i < 10)
       || (100 <= i && i < 1000)
       || (10000 <= i && i < 100000))
      count++;
  }

  cout << count << endl;
  
  return 0;
}


Measured memory_bytes: 256