akhauriyash/Code-Regression huggingface dataset:
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <fstream>
#include <sstream>
#include <set>
#include <map>
#include <vector>
#include <list>
#include <algorithm>
#include <cstring>
#include <cmath>
#include <string>
#include <stack>
#include <queue>
#include <bitset>     //UWAGA - w czasie kompilacji musi byc znany rozmiar wektora - nie mozna go zmienic
#include <cassert>
#include <iomanip>        //do setprecision
#include <ctime>
#include <complex>
using namespace std;

#define FOR(i,b,e) for(int i=(b);i<(e);++i)
#define FORQ(i,b,e) for(int i=(b);i<=(e);++i)
#define FORD(i,b,e) for(int i=(b)-1;i>=(e);--i)
#define REP(x, n) for(int x = 0; x < (n); ++x)

#define ST first
#define ND second
#define PB push_back
#define PF push_front
#define MP make_pair
#define LL long long
#define ULL unsigned LL
#define LD long double
#define pii pair<int,int>
#define pll pair<LL,LL>
#define vi vector<int>
#define vl vector<LL>
#define vii vector<vi>
#define vll vector<vl>

const double pi = 3.14159265358979323846264;
const int mod=1000000007;
const int nm=(1<<18)+1;
const int nm2=(1<<10)+1;
const int lm=100002;

inline pair<vi,int> f(int n){
    vi lst;
    int ret;
    while(n>=nm2){
        lst.PB(n);
        n/=2;
    }
    return {lst,n};
}

int main(){
	int n,q;
    cin>>n;
    vl v(nm,0);
    vl w(nm,0);
    vll dp(nm2,vl(lm,0));
    FOR(i,0,n){
        cin>>v[i]>>w[i];
    }
    dp[1][w[0]]=v[0];
    FOR(j,1,lm){
        dp[1][j]=max(dp[1][j],dp[1][j-1]);
    }
    FOR(i,1,nm2+1){
        if(i*2<nm2){
            int j=i*2;
            FOR(k,0,lm){
                dp[j][k]=max(dp[i][k],dp[j][k]);
                if(k+w[j-1]<lm){
                    dp[j][k+w[j-1]]=max(dp[j][k+w[j-1]],dp[i][k]+v[j-1]);
                }
            }
            FOR(jj,1,lm){
                dp[j][jj]=max(dp[j][jj],dp[j][jj-1]);
            }
        }
        if(i*2+1<nm2){
            int j=i*2+1;
            FOR(k,0,lm){
                dp[j][k]=max(dp[i][k],dp[j][k]);
                if(k+w[j-1]<lm){
                    dp[j][k+w[j-1]]=max(dp[j][k+w[j-1]],dp[i][k]+v[j-1]);
                }
            }
            FOR(jj,1,lm){
                dp[j][jj]=max(dp[j][jj],dp[j][jj-1]);
            }
        }
    }
    //cerr<<"test"<<endl;
    cin>>q;
    vi qv(q),qw(q);
    FOR(i,0,q){
        cin>>qv[i]>>qw[i];
        if(qv[i]<nm2){
            //cerr<<"N"<<endl;
            cout<<dp[qv[i]][qw[i]]<<endl;
        }else{
            const auto pr=f(qv[i]);
            const vi lst=pr.ST;
            const int idx=pr.ND;
            const int ln=lst.size();
            //cerr<<ln<<" "<<idx<<endl;
            LL ans=0;
            FOR(msk,0,1<<ln){
                LL ww=0,vv=0;
                FOR(ii,0,ln){
                    if(msk&(1<<ii)){
                        vv+=v[lst[ii]-1];
                        ww+=w[lst[ii]-1];
                    }
                }
                if(ww>qw[i])continue;
                const LL rest=qw[i]-ww;
                vv+=dp[idx][rest];
                ans=max(ans,vv);
            }

            cout<<ans<<endl;
        }
    }




}


Measured memory_bytes: 811860
fun main(args: Array<String>) {
    val s: String = readLine()!!
    var num = 'x'
    var flg = true
    for(c in s){
        if(num == c){
            flg = false
            break
        }
        num = c
    }
    println(if (flg) "Good" else "Bad")
}

Measured memory_bytes: 33648
import sys

Q = int(sys.stdin.readline().strip())
LR = []
for i in range(Q):
    LR.append([int(x) for x in sys.stdin.readline().strip().split()])

N = 10**5+1
Primes = list(range(N+1))
Primes[1] = 0

for p in Primes:
    if p * p > N+1: break
    if p == 0: continue
    for i in range(p + p, N+1, p):
        Primes[i] = 0

primes = [p for p in Primes if p > 0]

likes = []
r = 0
for n in range(N):
    if n%2 == 1 and Primes[n] > 0 and Primes[n//2+1] > 0:
        r += 1
    likes.append(r)

for i in range(Q):
    print(likes[LR[i][1]] - likes[LR[i][0]-1])


Measured memory_bytes: 26804
L, R = map(int, input().split())
MOD = 2019
ans = L*R%MOD
for i in range(L, R):
    for j  in range(i+1, R+1):
        if ans > i*j%MOD:
            ans = i*j%MOD
        if ans == 0:
            break
    if ans == 0:
        break
print(ans)


Measured memory_bytes: 2940
#include<iostream>
#include<string>
#include<vector>

using namespace std;
int main(){
    int n,m,x;
    cin>>n>>m>>x;
    //int a[n][m]={};
    int cost[n]={};
    vector<vector<int>> a(n, vector<int>(m));
    for(int i=0;i<n;i++){
        cin>>cost[i];
        for(int j=0;j<m;j++){
            cin>>a[i][j];
        }
    }
    int min=10000000;
    int all=1<<n; //2^n変換
    for(int i=0;i<all;i++){
        int level[m]={};
        int tmp=0;
        for(int j=0;j<n;j++){
            if((i>>j)&1){
                tmp=tmp+cost[j];
                for(int k=0;k<m;k++){
                    level[k]=level[k]+a[j][k];
                }
            }
        }
        int f=1;
        for(int j=0;j<m;j++){
            if(level[j]<x){
                f=-1;
            }
        }
        if((min>tmp)&&(f==1)){
            min=tmp;
        }
        //cout<<min<<"\n";
    }
    if(min==10000000){
        cout<<-1<<"\n";
    }else{
        cout<<min<<"\n";
    }
    return 0;
}

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

int main() {
  int N, K; cin >> N >> K;
  int H[200000]; for (int i = 0; i < N; i++) cin >> H[i];
  sort(H, H + N, greater<>());

  long long sum = 0;
  for (int i = K; i < N; i++) {
    sum += H[i];
  }

  cout << sum << endl;
  return 0;
}

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

using ll = long long;
using namespace std;

int main() {
    ll N, x, cnt = 0;
    cin >> N >> x;
    vector<ll> v;
    for (int i = 0; i < N; ++i) {
        int b;
        cin >> b;
        v.emplace_back(b);
    }
    if(v[0] > x) {
        cnt += v[0] - x;
    }
    for (int i = 0; i < N - 1; ++i) {
        if(v[i]+v[i+1] > x) {
            cnt += min(v[i+1], v[i]+v[i+1]-x);
            v[i+1] -= min(v[i+1], v[i]+v[i+1]-x);

        }
    }

    cout << cnt << "\n";
    return 0;
}


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

int main() {
  int n;
  cin >> n;
  ll ans = 0;
  for (int i = 1; i < n+1; i++) {
    ll cnt = n/i;
    ans += (1 + cnt) * i * cnt / 2;
  }
  cout << ans << '\n';
  return 0;
}

Measured memory_bytes: 3584
def dfs(i,SUM):
	if i == 3:
		return SUM == 7
	if dfs(i+1,SUM+L[i+1]):
		ops[i] = "+"
		return True
	if dfs(i+1,SUM-L[i+1]):
		ops[i] = "-"
		return True

	return False

L = list(map(int, input()))
k = 7

ops= [0]*3

dfs(0,L[0])

ans = []
for i in range(4):
	if i <= 2:
		ans.append(str(L[i]))
		ans.append(ops[i])
	if i == 3:
		ans.append(str(L[i]))
		ans.append("=7")

print("".join(ans))

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

using namespace std;

typedef long long ll;

const int N=1e2+10;


int main(){
    ll n;
    cin>>n;
    for(ll i=1;i<=3500;i++)
        for(ll j=1;j<=3500;j++){
            ll rem=4*i*j-n*j-n*i;
            if (rem<=0) continue;
            if (n*i*j%rem==0){
                cout<<i<<" "<<j<<" "<<(n*i*j/rem);
                return 0;
            }
        }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using pint = pair<int, int>;
using pll = pair<ll, ll>;
using Edge = pair<int, ll>;
using Graph = vector<vector<int>>;
using WeightedGraph = vector<vector<Edge>>;
const ll INF64 = 1LL << 60;
const int INF32 = 1 << 29;
const ll MOD = 1000000007;

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

int main() {
	int H, W; cin >> H >> W;
	vector<string> s(H);
	for (int i = 0; i < H; ++i) cin >> s[i];

	vector<pint> blacks;
	for (int i = 0; i < H; ++i) {
		for (int j = 0; j < W; ++j) {
			if (s[i][j] == '#')blacks.push_back({i, j});
		}
	}

	vector<vector<int>> used(H, vector<int>(W));
    ll ans = 0;
	for (auto start : blacks) {
		if (used[start.first][start.second] != 0) continue;

		map<char, ll> mp;
		queue<pint> que;

		used[start.first][start.second] = 1;
		++mp[s[start.first][start.second]];
		que.push(start);
		while (!que.empty()) {
			pint p = que.front(); que.pop();
			int y = p.first;
			int x = p.second;
			for (int i = 0; i < 4; ++i) {
				int ny = y + dy[i];
				int nx = x + dx[i];
				if (nx < 0 || W <= nx || ny < 0 || H <= ny) continue;
				if (s[ny][nx] == s[y][x]) continue;
				if (used[ny][nx] != 0) continue;
				used[ny][nx] = 1;
				++mp[s[ny][nx]];
				que.push({ ny,nx });
			}
		}
		ans += mp['#'] * mp['.'];
	}
	cout << ans << endl;
}


Measured memory_bytes: 2676
#include<bits/stdc++.h>
using namespace std; 
using lint  =                           long long int;
using pint  =                           pair<int, int>;
using plint =                           pair<lint, lint>;
#define vli                             vector<lint>
#define pb                              push_back
#define ALL(x)                          begin(x),end(x)
#define inf                             (1LL<63)-1
#define MOD                             1000000007
#define SZ(x)                           ((lint)(x).size())
#define                                 FOR(i, begin, end) for(int i=(begin),i##_end_=(end);i<i##_end_;i++)
#define                                 IFOR(i, begin, end) for(int i=(end)-1,i##_begin_=(begin);i>=i##_begin_;i--)
#define                                 REP(i, n) FOR(i,0,n)
#define                                 IREP(i, n) IFOR(i,0,n)
#define                                 f_ip   ios_base::sync_with_stdio(false); cin.tie(NULL);
#define                                 debug(x) cerr << #x << " " << (x) << endl
struct fast_ios                         { fast_ios(){ cin.tie(0); ios::sync_with_stdio(false); cout << fixed << setprecision(20); }; } fast_ios_;
template<typename T>                    istream &operator>>(istream &is, vector<T> &vec){ for (auto &v : vec) is >> v; return is; }
template<typename T>                    bool mmax(T &m, const T q) { if (m < q) {m = q; return true;} else return false; }
template<typename T>                    bool mmin(T &m, const T q) { if (q < m) {m = q; return true;} else return false; }


/* -------
         |
    **   |
   -------      
   |
   ---------------------------------------------------------------------------------------------------------------------------------*/

void solve(){  
     lint N;
     cin >> N;
     lint ret = N + 1 - 2;//general form : (a + b - 2) steps to reach from (1,1);
     for(lint i = 1;i * i <= N; ++i){
         if(N%i == 0){
             mmin(ret,(i - 1) + (N/i-1));
         }
     }
     cout << ret << endl;
}

int main(){   
  
 solve();

 return 0;
}


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

#define FOR(i, a, b) for (int i = (a); i < (int)(b); i++)
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(a) (a).begin(), (a).end()
#define allg(a) (a).begin(), (a).end(), greater<int>()

using vi = vector<int>;
using vvi = vector<vi>;
using vs = vector<string>;
using pii = pair<int, int>;

const int INF = 1001001001;
const int MOD = 1000000007;
const long long INFL = (1LL << 60);
const double EPS = 1e-9;

struct Point {
  int x, y;
};

int N;

double dist(Point p1, Point p2) {
  return sqrt(pow(p2.x - p1.x, 2) + pow(p2.y - p1.y, 2));
}

int main() {
  cin >> N;
  Point p[N];
  vi v(N);
  rep(i, N) {
    cin >> p[i].x >> p[i].y;
    v[i] = i;
  }

  double sum = 0;
  int cnt = 0;
  do {
    rep(i, N - 1) {
      Point p1 = p[v[i]], p2 = p[v[i + 1]];
      sum += dist(p1, p2);
    }
    cnt++;
  } while (next_permutation(all(v)));
  double res = sum / cnt;
  cout << fixed << setprecision(10) << res << endl;
}

Measured memory_bytes: 384
#!/usr/bin/perl

my ($n,$m,$x) = map {$_ - 0} split(/\s+/o,<STDIN>);
my @a = map {$_ - 0} split(/\s+/o,<STDIN>);

my $res = 0;
if( $n > 2 ){
  my @aa = ();
  $#aa = $n;
  $aa[$_] = 1 foreach (@a);
  my @l = @aa[0..($x-1)];
  my $l = 0;
  $l += $_ foreach @l;
  my @r = @aa[($x+1)..$n];
  my $r = 0;
  $r += $_ foreach @r;
  $res = ($l<$r) ? $l : $r;
}
print "$res\n";

exit(0);



Measured memory_bytes: 512
#include<bits/stdc++.h>
using namespace std;
int n;
int main()
{
	cin>>n;
	int ans=0;
	for(int i=1;i<=n;i++)
	{
		int b=i,e=0;
		while(b)
		{
			e++;
			b/=10;
		}
		if(e%2)
		{
			ans++;	
		}
	}
	cout<<ans;
	return 0;
}


Measured memory_bytes: 256
/*
    -ensure correct output format
    -ensure printing required output
    -reread the problem statement
  */

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll,ll>pll;
typedef pair<ll,pair<ll,ll>>plll;
#define fastread() (ios_base:: sync_with_stdio(false),cin.tie(NULL));
#define vll(v) v.begin(),v.end()
#define all(x) x.rbegin(),x.rend()
#define min3(a, b, c)   min(a, min(b, c))
#define max3(a, b, c)   max(a, max(b, c))
#define F first
#define S second
#define in  freopen("input.txt", "r", stdin)
#define out  freopen("output.txt", "w", stdout)
#define minheap int,vector<int>,greater<int>
#define pb push_back
#define eb emplace_back
#define ischar(x)  (('a' <= x && x <= 'z') || ('A' <= x && x <= 'Z'))
#define isvowel(ch) ((ch=='a'||ch=='e'||ch=='i'||ch=='o'||ch=='u')||(ch=='A'|| ch=='E' || ch=='I'|| ch=='O'|| ch=='U'))
#define bug cout<<"BUG"<<endl;
const int Max = 2e6 + 10;
const int Mod = 1e9 + 7;
const double PI  =3.141592653589793238463;
bool compare(const pair<ll,ll> &a, const pair<ll,ll> &b)
{
       return (a.first > b.first);
}
ll lcm(ll a,ll b)
{
    if(a==0 || b==0)return 0;

    return a/__gcd(a,b)*b;
}

void input(ll ara[],ll n)
{
    for(ll i=0; i<n; i++)cin>>ara[i];
}
void print(ll ara[],ll n)
{
    for(ll i=0; i<n; i++)
        cout<<ara[i]<<" ";
    cout<<endl;
}


int main()
{

   fastread();

   ll i,j,n,m,p,a,sum=0,k,t,b,c,d,cnt=0,q,l,r,ans=0;

      bool flag=false;

      ll x,y;

      cin>>n>>m>>x>>y;

      vector<ll>v,s;

      ll mx=(-1)*100000,mi=1e18;

      for(i=0; i<n; i++)
      {
          cin>>a;
          v.eb(a);

          mx=max(mx,a);
      }

      for(i=0; i<m; i++)
      {
          cin>>a;
          s.eb(a);
          mi=min(a,mi);
      }


     for(i=x+1; i<=y; i++)
     {
         if(i>mx && i<=mi)
         {
             cout<<"No War"<<endl;

             return 0;
         }
     }

     cout<<"War"<<endl;






}



Measured memory_bytes: 3620
MOD = 10 ** 9 + 7
N = int(input())
As = list(map(int, input().split()))

x = 1
ans = 0
for i in range(60):
    num1s = 0
    for a in As:
        if a & x:
            num1s += 1
    ans += (x % MOD) * num1s * (N - num1s)
    ans %= MOD
    x <<= 1
print(ans)

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

inline long long read()
{
	long long x=0,f=1,c=getchar();
	while(c<48) c=='-'&&(f=-1),c=getchar();
	while(c>47) x=x*10+c-'0',c=getchar();
	return x*f;
}

typedef long long ll;
const int mod = 1e9+7;
const int MAXN = 10005;
vector<pair<ll,ll> > v[MAXN];
ll f[MAXN];

inline void init()
{
	for(int i=(f[0]=f[1]=1,2); i<=90; i++)
		f[i]=f[i-1]+f[i-2];
	v[1].push_back(make_pair(1,2));
	v[1].push_back(make_pair(1,3));
	v[1].push_back(make_pair(1,4));
	for(int i=1; i<=90-3; i++)
		for(auto p : v[i])
		{
			ll x=p.first,y=p.second,tmp=x; x=y; y=tmp+y;
			while(y<=f[i+3]+f[i-1])
				v[i+1].push_back(make_pair(x,y)),y+=x;
		}
}

int main(int argc, char const *argv[])
{
	init();
	for(int T=read(); T; --T)
	{
		ll x=read(),y=read(),k=1,ans=0;
		if(x>y) swap(x,y);
		while(f[k+1]<=x&&f[k+2]<=y) ++k;
		printf("%lld ", k);
		if(k==1) {printf("%lld\n", x*y%mod); continue;}
		for(auto p : v[k-1])
		{
			ll a=p.first,b=p.second;
			if(b<=x) ans+=(y-a)/b%mod;
			if(b<=y) ans+=(x-a)/b%mod; ans%=mod;
		}
		printf("%lld\n", ans%mod);
	}
	return 0;
}

Measured memory_bytes: 4676
#define _CRT_SECURE_NO_WARNINGS

#include <stdio.h>
#include <string.h>
#include <algorithm>
#include <set>
#include <map>
#include <vector>
#include <math.h>
#include <queue>
#include <stack>
#include <list>
#include <functional>
#include <numeric>
#include <iostream>

using namespace std;
typedef long long ll;
#define rep(i, n) for (ll i = 0; i < (n); ++i)

int R;

int main() {

	scanf("%d", &R);

	if(R < 1200) printf("ABC\n");
	else if(R < 2800) printf("ARC\n");
	else  printf("AGC\n");

	return 0;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(){
    int cats , unknown , wanted;
    cin >> cats >> unknown >> wanted;
    while (true){
        if (cats == wanted){
            cout <<"YES";
            break;
        }
        if (unknown== 0){
            cout << "NO";
            break;
        }
        cats++;
        unknown--;
    }
    return 0;
}

Measured memory_bytes: 256
//diverta C

#include <queue>
#include <stack>
#include <cstdio>
#include <stdio.h>
#include <iostream>
#include <algorithm>
#define rep(i, n) for(int i = 0; i < (n); i++)
using namespace std;
typedef pair<int,int> P;
#define MAX_N 100000
int N,s,l;
int a[MAX_N];

int solve(){
  queue<P> que;
  for(int i = 1; i < N-1; i++){
    if (a[i] > 0){
      que.push(P(s,a[i]));
      s = s - a[i];
    }
    else {
      que.push(P(l,a[i]));
      l = l - a[i];
    }
  }
  que.push(P(l,s));
  printf("%d\n",l - s);
  while (que.size()){
    P p = que.front();que.pop();
    printf("%d %d\n",p.first,p.second);
  }
}

int main(){
  cin >> N;
  rep(i,N){
    cin >> a[i];
  }
  sort(a, a + N);
  s = a[0];
  l = a[N-1];
  solve();
}

Measured memory_bytes: 3072
import java.util.Scanner;

public class Main {
    private static final int LOVE_NUMBER = 753;

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

        String[] sArr = str.split("");
        Integer min = null;
        for (int i = 0; i < str.length() - 2; i++) {
            Integer num = Integer.parseInt(sArr[i] + sArr[i + 1] + sArr[i + 2]);
            if (i == 0 || min > Math.abs(LOVE_NUMBER - num)) {
                min = Math.abs(LOVE_NUMBER - num);
            }
        }
        System.out.println(min);
    }
}


Measured memory_bytes: 21844
#include <iostream>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <string>
using namespace std;

template <typename T>
T gcd(T a, T b) {
    if(b == 0) return a;
    else return gcd(b, a % b);
}

template <typename T>
T lcm(T a, T b) {
    T g = gcd(a, b);
    return a / g * b;
}

int main(){

    int r, g, b;
    cin >> r >> g >> b;

    int num = 100 * r + 10 * g + b;
    if(num % 4 == 0) cout << "YES" << endl;
    else cout << "NO" << endl;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<ll, ll>;
using Pld = pair<ld, ld>;
using Vec = vector<ll>;
using VecP = vector<P>;
using VecB = vector<bool>;
using VecC = vector<char>;
using VecD = vector<ld>;
using VecS = vector<string>;
using Graph = vector<VecP>;
#define REP(i, m, n) for(ll (i) = (m); (i) < (n); ++(i))
#define rep(i, n) REP(i, 0, n)
#define R cin>>
#define repn(i, n) REPN(i, 1, n)
#define repr(i, n) REPR(i, n, 0)
#define repnr(i, n) REPNR(i, n, 1)
#define all(s) (s).begin(), (s).end()
#define pb push_back
#define mp make_pair
#define fs first
#define sc second
#define in(a) insert(a)
#define P(p) cout<<(p)<<endl;
#define ALL(x) (x).begin(),(x).end()
#define ALLR(x) (x).rbegin(),(x).rend()
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<long long int> vll;
typedef vector<string> vs;
typedef pair<int, int> pii;
typedef long long ll;
typedef pair<ll, ll> pll;
void sonic(){ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);}
void setp(const ll n){cout << fixed << setprecision(n);}
const ll INF = 1e9+1;
const ll LINF = 1e18+1;
const ll MOD = 1e9+7;
//const ll MOD = 998244353;
const ld PI = acos(-1);
const ld EPS = 1e-11;
template<typename T> void co(T e){cout << e << "\n";}
template<typename T> void co(const vector<T>& v){for(const auto& e : v)
{ cout << e << " "; } cout << "\n";}
ll gcd(ll a, ll b) {
    if (a < b)swap(a, b);
    if (b == 0) return a;
    unsigned r;
    while ((r = a % b)) {
        a = b;
        b = r;
    }
    return b;
}
ll lcm(ll a, ll b) {
    ll g = gcd(a, b);
    return a * b / g;
}
bool prime(ll n) {
    for (ll i = 2; i <= sqrt(n); i++) {
        if (n%i == 0)return false;
    }
    return n != 1;
}

Vec fac, finv;

ll PowMod(ll a, ll n){
    if(n == 1) return a;
    if(n%2 == 0) return PowMod(a*a%MOD, n/2);
    return a*PowMod(a*a%MOD, n/2)%MOD;
}

ll combi(ll n, ll k){
    if(k>n) return 0;
    return fac[n]*finv[k]%MOD*finv[n-k]%MOD;
}

int main() {
    sonic();
    ll a, b, x;
    R a >> b >> x;
    if (a == 0) co(b / x + 1);
    else co(b / x - (a - 1) / x);
}

Measured memory_bytes: 256
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <time.h>
#include <tuple>
#include <utility>
#include <vector>
#define ll long long
#define itn int
#define endl '\n'
#define co(ans) cout<<ans<<endl
#define COYE cout<<"YES"<<endl
#define COYe cout<<"Yes"<<endl
#define COye cout<<"yes"<<endl
#define CONO cout<<"NO"<<endl
#define CONo cout<<"No"<<endl
#define COno cout<<"no"<<endl
#define FORE(i,a) for(auto &i:a)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define FFOR(i,a,b) for(int i=(a);i<=(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define RREP(i,n)  FFOR(i,1,n)
#define PB push_back
#define MP make_pair
#define ALL(V) (V).begin(),(V).end()
#define SORT(V) sort((V).begin(),(V).end())
#define REVERSE(V) reverse((V).begin(),(V).end())
#define EACH(V,i) for(typeof((V).begin()) i=(V).begin();i!=(V).end();++i)
#define equals(a,b) (fabs((a)-(b))<EPS)
#define INF ((1LL<<62)-(1LL<<31))
#define EPS 1e-10
#define PI 3.141592653589793238
#define MOD 1000000007
#define MAX 5100000
using namespace std;
using Edge=pair<ll,ll>;
using Graph=vector<vector<int>>;
inline int toInt(string s){int v;istringstream sin(s);sin>>v;return v;}
template<class T>inline string toString(T x){ostringstream sout;sout<<x;return sout.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;}
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;
const int dx[4]={0,1,0,-1},dy[4]={1,0,-1,0};
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return a/gcd(a,b)*b;}

int main(){
  ll N,K,sum=0;
  cin>>N>>K;
  vector<ll> A;
  REP(i,N){
    ll a;
    cin>>a;
    A.PB(a);
    sum+=a;
  }
  
  if(sum-N<=K){
    co(1);
    return 0;
  }
  
  ll ye=INF,no=0;
  while(abs(ye-no)>1){
    ll cnt=0,mid=(ye+no)/2;
    REP(i,N){
      cnt+=(A[i]-1)/mid;
    }
    if(cnt<=K) ye=mid;
    else no=mid;
  }
  
  co(ye);
  return 0;
}

Measured memory_bytes: 5364
#include<bits/stdc++.h>
#define lln long long int
#define llu unsigned lln
#define sc(n) scanf("%d",&n);
#define scl(n) scanf("%lld",&n);
#define scd(n) scanf("%lf",&n);
#define pf(res) printf("%d",res);
#define pfl(res) printf("%lld",res);
#define pfd(res) printf("%lf",res);
#define maxii 100005

using namespace std;
typedef pair<int,int> pii;
typedef pair<lln,lln> pll;
typedef vector<int> vi;
typedef vector<lln> vl;
typedef vector<pii> vii;
typedef vector<pll> vll;


int gcd(int a,int b)
{
    if(b==0){
      return a;
     }
    return gcd(b,a%b);
}
int po(int a,int b)
{
    int res=1;
    while(b)
    {
        if(b%2!=0)
        {
            res*=a;
            b--;
        }
        else
        {
            a*=a;
            b/=2;
        }
    }
    return res;
}


char arr[1005][1005];
int arr2[1005][1005];
int main()
{
   int c,r;
   sc(c)
   sc(r)
   for(int i=0;i<c;i++)
   {
       for(int j=0;j<r;j++)
       {
           cin>>arr[i][j];
       }
   }
   arr2[0][0]=1;
   for(int i=0;i<c;i++)
   {
       for(int j=0;j<r;j++)
       {
           if(i==0 && j==0 )
            continue;
           if(arr[i][j]=='#')continue;
           if(i==0)
           {
               arr2[i][j]+=arr2[i][j-1]%1000000007;
               continue;
           }
           if(j==0)
           {
               arr2[i][j]+=arr2[i-1][j]%1000000007;
               continue;
           }
           else
           {
               arr2[i][j]=((arr2[i][j-1]%1000000007)+(arr2[i-1][j]%1000000007))%1000000007;
           }

       }
   }
   cout<<arr2[c-1][r-1];


}






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

int main(void) {
    int N;
    std::cin >> N;
    vector< string > S(N);
    for (int i = 0; i < N; i++) {
        cin >> S[i];
    }
    sort(S.begin(), S.end());
    int ans = 1;
    for (int i = 0; i < N - 1; i++) {
        if (S[i] != S[i + 1]) {
            ++ans;
        }
    }
    printf("%d\n", ans);

    return 0;
}


Measured memory_bytes: 9600
#include <bits/stdc++.h>
#define whlie while
#define pb push_back
#define eb emplace_back
#define fi first
#define se second
#define rep(i,N) for(int i = 0; i < (N); i++)
#define repr(i,N) for(int i = (N) - 1; i >= 0; i--)
#define rep1(i,N) for(int i = 1; i <= (N) ; i++)
#define repr1(i,N) for(int i = (N) ; i > 0 ; i--)
#define each(x,v) for(auto& x : v)
#define all(v) (v).begin(),(v).end()
#define sz(v) ((int)(v).size())
#define vrep(v,it) for(auto it = v.begin(); it != v.end(); it++)
#define vrepr(v,it) for(auto it = v.rbegin(); it != v.rend(); it++)
#define ini(...) int __VA_ARGS__; in(__VA_ARGS__)
#define inl(...) ll __VA_ARGS__; in(__VA_ARGS__)
#define ins(...) string __VA_ARGS__; in(__VA_ARGS__)
using namespace std; void solve();
using ll = long long; using vl = vector<ll>;
using vi = vector<int>; using vvi = vector< vector<int> >;
constexpr int inf = 1001001001;
constexpr ll infLL = (1LL << 61) - 1;
struct IoSetupNya {IoSetupNya() { cin.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(15); cerr << fixed << setprecision(7);} } iosetupnya;
template<typename T, typename U> inline bool amin(T &x, U y) { return (y < x) ? (x = y, true) : false; }
template<typename T, typename U> inline bool amax(T &x, U y) { return (x < y) ? (x = y, true) : false; }
template<typename T, typename U> ostream& operator <<(ostream& os, const pair<T, U> &p) { os << p.first << " " << p.second; return os; }
template<typename T, typename U> istream& operator >>(istream& is, pair<T, U> &p) { is >> p.first >> p.second; return is; }
template<typename T> ostream& operator <<(ostream& os, const vector<T> &v) { int s = (int)v.size(); rep(i,s) os << (i ? " " : "") << v[i]; return os; }
template<typename T> istream& operator >>(istream& is, vector<T> &v) { for(auto &x : v) is >> x; return is; }
void in(){} template <typename T,class... U> void in(T &t,U &...u){ cin >> t; in(u...);}
void out(){cout << "\n";} template <typename T,class... U> void out(const T &t,const U &...u){ cout << t; if(sizeof...(u)) cout << " "; out(u...);}
template<typename T>void die(T x){out(x); exit(0);}
#ifdef NyaanDebug
  #include "NyaanDebug.h"
  #define trc(...) do { cerr << #__VA_ARGS__ << " = "; dbg_out(__VA_ARGS__);} while(0)
  #define trca(v,N) do { cerr << #v << " = "; array_out(v , N);cout << endl;} while(0)
#else
  #define trc(...)
  #define trca(...)
  int main(){solve();}
#endif

using P = pair<double,double>; using vp = vector<P>;
constexpr int MOD = /**/ 1000000007; //*/ 998244353;
//////////

void solve(){
  ini(N,K); vi h(N); in(h);
  int ans = 0;
  each(x,h) ans += (x >= K);
  out(ans);

}

Measured memory_bytes: 640
n = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
c = 0
for i in range(n):
  if A[i] >= B[i]:
    c += B[i]
  else:
    c += A[i]
    B[i] -= A[i]
    if A[i+1] >= B[i]:
      c += B[i]
      A[i+1] -= B[i]
    else:
      c += A[i+1]
      A[i+1] = 0
print(c)      

Measured memory_bytes: 19116
#include<stdio.h>
int main()
{
	int h,w,x,y;
	scanf("%d %d %d %d",&h,&w,&x,&y);
	if((x+y)%2==1&&(h*w)%2==1){
		printf("No\n");
	}else{
		printf("Yes\n");
	}
	return 0;
}



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

int main(){
	// sengen
	long h;
	// nyuryoku
	cin >> h;
	// keisan
	int check = 0;
	while(h){
		h = h/2;
		check++;
	}
	long kekka = 1;
	for(int i=1;i<=check;i++){
		kekka *= 2;
	}
	// syutsuryoku
	cout << kekka -1;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstring>
#include <vector>
#define rep(x, l, r) for(int x = l; x <= r; x++)
#define repd(x, r, l) for(int x = r; x >= l; x--)
#define clr(x, y) memset(x, y, sizeof(x))
#define all(x) x.begin(), x.end()
#define pb push_back
#define mp make_pair
#define MAXN 100005
#define fi first
#define se second
#define SZ(x) ((int)x.size())
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> pii;
const int INF = 1 << 30;
const int p = 1000000007;
int lowbit(int x){ return x & (-x);}
int fast_power(int a, int b){ int x; for(x = 1; b; b >>= 1){ if(b & 1) x = 1ll * x * a % p; a = 1ll * a * a % p;} return x % p;}

struct node{
	int l, r;
}a[MAXN];

bool cmp(node a, node b){
	return a.r < b.r;
}

int main(){
	int n;
	scanf("%d", &n);
	rep(i, 1, n){
		int x, y;
		scanf("%d%d", &x, &y);
		a[i] = (node){x - y, x + y};
	}
	sort(a + 1, a + n + 1, cmp);
	int pre = -INF, ans = 0;
	rep(i, 1, n){
		if(a[i].l >= pre){
			pre = a[i].r;
			ans++;
		}
	}
	printf("%d\n", ans);
    return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define REP(i, n) for(llong i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(llong i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define llong long long
#define pb(a) push_back(a)
#define INF 999999999
using namespace std;
llong mod = 1000000007;
int dx[4]={1,0,-1,0},dy[4]={0,1,0,-1};


int main(){
  llong N;cin>>N;
  cout << 3* N*N <<endl;
}


Measured memory_bytes: 764
#include<bits/stdc++.h>
using namespace std;
#define fs first
#define sc second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define ALL(A) A.begin(),A.end()
#define RALL(A) A.rbegin(),A.rend()
typedef long long ll;
typedef pair<ll,ll> P;
const ll mod=1000000007;
const ll LINF=1LL<<60;
const int INF=1<<30;

int main(){
	int n;cin>>n;
	int ans = 0;
	string a,b,c;cin>>a>>b>>c;
	for(int i = 0; i < n; i++) {
		if (a[i] == b[i] && b[i] == c[i])continue;
		else if (a[i] == b[i] || a[i] == c[i] || b[i] == c[i])ans++;
		else ans += 2;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int n, a[2001];

int bf(int i, int m){
  if(m == 0) return 1;
  if(i > n || m < 0) return 0;
  return (bf(i + 1, m) ||bf(i + 1, m - a[i]));
}

int main(){
  int q, m, i;
  scanf("%d", &n);
  for(i = 0; i < n; ++i) scanf("%d", a + i);

  scanf("%d", &q);
  while(q--){
    scanf("%d", &m);
    if(bf(0, m) ) puts("yes");
    else puts("no");
  }
  return 0;
}


Measured memory_bytes: 2108
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define fsp(x) fixed << setprecision(x)
#define xout cerr
const ll inf = LLONG_MAX;
const long double pi = acosl(-1);
void Yes() {cout << "Yes" << endl;}
void No() {cout << "No" << endl;}
void YES() {cout << "YES" << endl;}
void NO() {cout << "NO" << endl;}

int main() {
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	//const ll p = 1e9 + 7;
	//const ll p = 998244353;

	char c;
	cin >> c;
	if (0 <= c - 'a' && c - 'a' <= 25) cout << "a" << endl;
	else cout << "A" << endl;
}


Measured memory_bytes: 3640
class Node:
    def __init__(self, key, parent=None, left=None, right=None):
        self.key = key
        self.parent = parent
        self.left = left
        self.right = right


root = None

def insert(k):
    global root
    y = None
    x = root
    z = Node(k)

    while x is not None:
        y = x
        if z.key < x.key:
            x = x.left
        else:
            x = x.right

    z.parent = y
    if y is None:
        root = z
    else:
        if z.key < y.key:
            y.left = z
        else:
            y.right = z


def inorder(u):
    if u is None:
        return
    inorder(u.left)
    print(' %d' % u.key, end='')
    inorder(u.right)


def preorder(u):
    if u is None:
        return
    print(' %d' % u.key, end='')
    preorder(u.left)
    preorder(u.right)


n = int(input())
for i in range(n):
    cmd = input().split()
    if cmd[0] == 'insert':
        insert(int(cmd[1]))
    elif cmd[0] == 'print':
        inorder(root)
        print()
        preorder(root)
        print()


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

int main() {
    int n, k;
    int a[200001];
    int i;
    scanf("%d %d", &n, &k);
    for (i=0;i<n;i++) scanf("%d", &a[i]);
    for (i=0;i<n-k;i++) {
        //printf("%d %d", a[i],a[i+k]);
        if(a[i]<a[i+k]) {
            printf("Yes\n");
        } else {
            printf("No\n");
        }
    }
    return 0;
}

Measured memory_bytes: 2444
#include<stdio.h>
#include<math.h>
;


int main()
{
	int x[2];
	int answer;

	scanf("%d", &x[0]);
	scanf("%d", &x[1]);

	if (x[0] + x[1] == 15)
	{
		printf("+");
	}
	else if (x[0] * x[1] == 15)
	{
		printf("*");
	}
	else
	{
		printf("x");
	}

	return 0;
}




Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define all(a) a.begin(), a.end()
#define pb push_back
#define mp make_pair
typedef long long ll;
typedef pair<ll,ll> P;
typedef pair<ll,int> pli;
typedef pair<int,int> pii;
#define rep(i,a,b) for(ll i=a ; i<b ; i++)
#define qrep(que, ite) for(auto ite=begin(que) ; ite!=end(que) ; ite++)
const int max_n = 1e5;
const ll mod = 1e9+7;
const ll INF = 1e17;
const int inf = 1e5;
//typedef long double ld;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
ll gcd(ll a, ll b) { return a ? gcd(b%a, a) : b; }
int dx[4] = {0,0,1,-1};
int dy[4] = {1,-1,0,0};
ll mo = 998244353;
struct UnionFind {
    vector<int> par;

    UnionFind(int n) : par(n, -1) { }
    void init(int n) { par.assign(n, -1); }

    int root(int x) {
        if (par[x] < 0) return x;
        else return par[x] = root(par[x]);
    }

    bool issame(int x, int y) {
        return root(x) == root(y);
    }

    bool merge(int x, int y) {
        x = root(x); y = root(y);
        if (x == y) return false;
        if (par[x] > par[y]) swap(x, y); // merge technique
        par[x] += par[y];
        par[y] = x;
        return true;
    }

    int size(int x) {
        return -par[root(x)];
    }
};
struct SegmentTree{
  int N;
  vector<int> node;
  public :
    void intit(vector<int>v){
      int sz = v.size();
      N=1;
      while(N<sz) N*=2;
      node.resize(N);
      for(int i=0 ; i<sz ; i++) node[i+N-1] = v[i];
      for(int i=N-2 ; i>=0 ; i--) node[i] = min(node[i*2+1], node[i*2+2]);
    }
    void update(int x, int val){
      x += N-1;
      node[x+N-1] = val;
      while(x>0){
        x = (x-1)/2;
        node[x] = min(node[x*2+1], node[x*2+2]);
      }
    }
    int getmin(int a, int b, int k, int l, int r){
      if(b<=l || r<=a) return inf;
      else if(a<=l && r<=b) return node[k];
      else{
        int vl = getmin(a, b, 2*k+1, l, (l+r)/2);
        int vr = getmin(a, b, 2*k+2, (l+r)/2, r);
        return min(vl, vr);
      }
    }
};

int main(){
  int N,M;  cin>>N>>M;
  ll x; cin>>x;
  vector<int> c(N);
  vector<vector<int> > v(N);
  rep(i,0,N){
    cin>>c[i];
    v[i].resize(M);
    rep(j,0,M){
      cin>>v[i][j];
    }
  }
  ll mi = INF;
  for(int bit=0 ; bit<(1<<N) ; bit++){
    ll sum =0 ;
    vector<ll> now(M, 0);
    for(int i=0 ; i<N ; i++){
      if(bit & (1<<i)){
        sum += c[i];
        for(int j=0 ; j<M ; j++){
          now[j] += v[i][j];
        }
      }
    }
    bool ok=true;
    for(int i=0 ; i<M ; i++){
      if(now[i]<x){
        ok=false;
      }
    }
    if(ok){
      chmin(mi, sum);
    }
  }
  if(mi != INF){
    cout<<mi<<endl;
  }else{
    cout<<"-1"<<endl;
  }
  return 0;
}


Measured memory_bytes: 3636
#include <cstdio>

using namespace std;

const int maxn=1e5+1e2;

#define LL long long

int h[maxn],n,A,B;
LL tem[maxn];

int getint()
{
	char ch;int b=1;
	for(ch=getchar();ch>'9'||ch<'0';ch=getchar())if(ch=='-')b=-1;
	int num=ch-'0';
	for(ch=getchar();ch>='0'&&ch<='9';ch=getchar())num=num*10+ch-'0';
	return num*b;
}

bool check(LL x)
{
	for(int i=1;i<=n;i++)tem[i]=h[i]-(LL)B*x;
	for(int i=1;i<=n;i++)
	{
		if(tem[i]>0)
		{
			LL t=tem[i]/(A-B);
			if(t*(A-B)<tem[i])t++;
			x-=t;
		}
	}
	if(x<0)return false;
	else return true;
}

int main()
{
	n=getint();A=getint(),B=getint();
	for(int i=1;i<=n;i++)h[i]=getint();
	int l=0,r=1e9,mid;
	while(l<r)
	{
		mid=(l+r)>>1;
		if(check(mid))r=mid;
		else l=mid+1;
	}
	printf("%d\n",l);
	return 0;
}

Measured memory_bytes: 1280
//#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("Ofast,no-stack-protector") 
//#pragma GCC optimize("Ofast")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
//#pragma GCC optimize("unroll-loops")
 
#include <bits/stdc++.h>
 
#define int long long
#define ll long long
#define ull unsigned long long
#define ld long double
#define rep(i, l, r) for (int i = l; i <= r; i++)
#define repb(i, r, l) for (int i = r; i >= l; i--)
#define sz(a) (int)a.size()
#define fi first
#define se second
#define all(x) x.begin(),x.end()
#define pb push_back
#define mp(a, b) make_pair(a, b)
#define ret(a) {cout << a; exit(0);}
 
using namespace std;                                                                                  
 
mt19937 mrand(random_device{}()); 
const ll mod = 1e9 + 7;
int rnd(int x) { return mrand() % x;}
ll powmod(ll a,ll b,ll mod) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
 
typedef pair < int , int > pii ;                                            
typedef pair < long long  , long long > pll ;
const int N = 2005, K = 2e9 + 1 , L = 3e5;

int n, k, m;
string s;
int W[N];
int p[N];
int get(int x){
	if(x == p[x])
		return x;
	return p[x] = get(p[x]);
}
void unite(int a , int b){	
	a = get(a);
	b = get(b);
	if(a == b)
		assert(0);
	if(rnd(2))
		swap(a , b);
	p[a] = b;
}
vector < pair < int , pii > > res;

vector < pii > gr[N];

bool was[N][N];

int df[N][N];

void dfs(int mn , int u , int p , int mx = 0){
	df[mn][u] = mx ;	
	for(pii to : gr[u]){
		if(to.fi != p)
			dfs(mn ,to.fi , u , max(mx , to.se));
	}
	return;
}

main(){
	ios::sync_with_stdio(0);
	cin.tie(0);cout.tie(0);
	cin >> n >> m;
	int mn = 0;
	cin >> mn;

	for(int i = 1; i <= m; i++){
		int u , v , w;
		cin >> u >> v >> w;
		res.pb({w , {u , v}});
	}

	sort(all(res));
	int Mst = 0;
	for(int i = 1; i <= n ; i++)
		p[i] = i;
	for(auto to : res){
		if(get(to.se.se) != get(to.se.fi))
			unite(to.se.fi, to.se.se) , Mst += to.fi , gr[to.se.se].pb({to.se.fi,to.fi}),gr[to.se.fi].pb({to.se.se,to.fi}),
			was[to.se.fi][to.se.se] = was[to.se.se][to.se.fi] = 1;
	}

	for(int i = 1; i <= n ;i++){
		dfs(i , i , -1);
	}
	int D = mn - Mst;

	if(D < 0)ret(0);
	int eq = 0, up = 0;

//	cerr << eq << ' ' << up << '\n';
	for(auto to : res){
		if(!was[to.se.fi][to.se.se]){
			if(to.fi - df[to.se.fi][to.se.se] == D)
				eq++;
			if(to.fi - df[to.se.fi][to.se.se] > D)
				up++;
		}

	}
	if(D == 0){
		cout << ((powmod(2 , n - 1 , mod) - 2)*powmod(2 , m - n + 1 , mod) % mod + 2ll * (powmod(2 , eq , mod) - 1) * powmod(2 , up , mod)%mod)%mod;
	}
	else cout << 2ll * (powmod(2 , eq , mod) - 1) * powmod(2 , up , mod)%mod;



		
}
 


Measured memory_bytes: 20480
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
	int x[51];
	int n,i,j,a,b,k;
	cin>>n;
	for(i=0;i<n;i++) cin>>x[i];
	bool flag=true;
	for(i=1;i<n;i++){
		if(x[i]<x[i-1]) {
			flag=false;
			break;
		}
	}
	if(flag) cout<<"YES";
	else{
		for(i=0;i<n-1;i++){
			if(x[i]>x[i+1]){
				a=x[i];
				j=i;
				break;
			}
		}
		for(i=n-1;i>=0;i--){
			if(x[i]<x[i-1]){
				b=x[i];
				k=i;
				break;
			}
		}
		int temp=x[j];
		x[j]=x[k];
		x[k]=temp;
		flag=true;
		for(i=1;i<n;i++){
		if(x[i]<x[i-1]) {
			flag=false;
			break;
		}
	   }
	   if(flag) cout<<"YES";
	   else cout<<"NO";
	}
	return 0;
} 

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define il inline
#define RG register
#define ll long long
#define rhl (1000000007)

using namespace std;

int f[2][4010][2],sum[4010],n,m,k,ans;

il int gi(){
  RG int x=0,q=1; RG char ch=getchar();
  while ((ch<'0' || ch>'9') && ch!='-') ch=getchar();
  if (ch=='-') q=-1,ch=getchar();
  while (ch>='0' && ch<='9') x=x*10+ch-48,ch=getchar();
  return q*x;
}

il int add(RG int x,RG int y){
  x+=y; if (x>=rhl) x-=rhl; return x;
}

int main(){
  n=gi(),m=gi(),k=gi(),--m,--k,f[1][0][0]=1;
  for (RG int i=1;i<=k;++i){
    f[1][i][1]=1; if (k-i<=m && i%k==n%k && (k-i)%k==m%k) ans++;
  }
  for (RG int i=2,pre=1,cur=0;i<=2*max(n,m);++i,pre=cur,cur^=1){
    for (RG int j=0;j<=n;++j) sum[j+1]=add(sum[j],add(f[pre][j][0],f[pre][j][1]));
    for (RG int j=0;j<=n;++j){
      f[cur][j][0]=add(f[pre][j][0],f[pre][j][1]);
      f[cur][j][1]=sum[j]-sum[max(j-k,0)];
      if (f[cur][j][1]<0) f[cur][j][1]+=rhl;
    }
    for (RG int j=0;j<=n;++j)
      if (k*i-j<=m && j%k==n%k && (k*i-j)%k==m%k) ans=add(ans,f[cur][j][1]);
  }
  cout<<ans; return 0;
}


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

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

    int H[N];
    for(int i = 0; i < N; ++i) cin >> H[i];

    int ans = 1;
    for(int i = 1; i < N; ++i){
        for(int j = 0; j < i; ++j){
            if(H[j] > H[i]){
                --ans;
                break;
            }
        }

        ++ans;
    }

    cout << ans << endl;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
using ll = long long;
using Pii = pair<int, int>;
using Pll = pair<ll, ll>;
#define rep(i, begin, n) for (int i = begin; i < n; i++)
#define repe(i, begin, n) for (int i = begin; i <= n; i++)
#define repr(i, begin, n) for (int i = begin; i > begin - n; i--)
#define repre(i, begin, end) for (int i = begin; i >= end; i--)

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

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

const int inf = INT_MAX;
const int MOD = 1000000007;
const long long INF = LLONG_MAX;
const long long MINF = LLONG_MIN;

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

const long long MAX_E = 10101;
const long long MAX_V = 10101;

struct edge {
  long long from, to, cost;
};

edge es[MAX_E];

long long dist[MAX_V];
long long V, E;

bool negloop[MAX_V];

void shortest_path(long long s) {
  for (int i = 1; i <= V; i++) dist[i] = MINF;

  dist[s] = 0;

  ll cnt = 0;

  while (true) {
    ++cnt;

    bool updated = false;
    for (int i = 1; i <= E; i++) {
      edge e = es[i];
      if (dist[e.from] != MINF && dist[e.to] < dist[e.from] + e.cost) {
        dist[e.to] = dist[e.from] + e.cost;
        updated = true;
        if (cnt >= V) {
          negloop[e.to] = true;
        }
      }
      if (negloop[e.from]) {
        negloop[e.to] = true;
      }
    }
    if (!updated) break;

    if (cnt >= 2 * V) break;
  }
}

ll N, M;

int main() {
  cin >> N >> M;
  V = N;
  E = M;
  repe(i, 1, M) {
    ll a, b, c;
    cin >> a >> b >> c;
    es[i] = edge{a, b, c};
  }

  shortest_path(1);

  if (negloop[N]) {
    cout << "inf";
  } else {
    cout << dist[N];
  }
}


Measured memory_bytes: 3656
input1 = gets.chomp.to_i
input2 = gets.chomp.split(' ').map(&:to_i)
export = 1
for i in 0..input1-1 do
    export=export*input2[i]
    break if export>1000000000000000000
end
if export<=1000000000000000000 then
    puts export
else
    if input2.include?(0) then
        puts "0"
    else
        puts "-1"
    end
end

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

int main() {
  int A,B,C,K;
  cin >> A >> B >> C >> K;
  int res = 0;
  res += min(A,K);
  K -= A;
  if(K<0){
    cout << res << endl;
    return 0;
  }
  K -= B;
  if(K<0){
    cout << res << endl;
    return 0;
  }
  res -= min(C,K);
  cout << res << endl;
  return 0;
}

Measured memory_bytes: 3196
#include<iostream>
#include<string>
#include<vector>
using namespace std;

int main() {
	int alice, bob;
	cin >> alice >> bob;
	
	if (alice == bob)
		cout << "Draw";
	else if ((alice > bob&&bob != 1) || alice == 1)
		cout << "Alice";
	else
		cout << "Bob";
}

Measured memory_bytes: 256
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        char[] s = sc.next().toCharArray();
        if (s[0] == s[1] && s[0] == s[2]) {
            System.out.println("No");
        } else {
            System.out.println("Yes");
        }
    }
}

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

const int MAX_N = 110000;

int dp[MAX_N];

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

    for (int i = 0; i < MAX_N; i++) dp[i] = -1;
    dp[0] = 0;
    queue<int> q;
    q.push(0);

    while (!q.empty()) {
        int v = q.front();
        q.pop();

        for (int pow6 = 1; v + pow6 <= N; pow6 *= 6) {
            if (dp[v + pow6] == -1) {
                dp[v + pow6] = dp[v] + 1;
                q.push(v + pow6);
            }
        }
        for (int pow9 = 1; v + pow9 <= N; pow9 *= 9) {
            if (dp[v + pow9] == -1) {
                dp[v + pow9] = dp[v] + 1;
                q.push(v + pow9);
            }
        }
    }
    cout << dp[N] << endl;
}

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

#define int long long

#define ii pair<int,int>
#define fi first
#define sc second

signed main() {
#ifdef _DEBUG
  // freopen("in" , "r", stdin );
#endif
  ios::sync_with_stdio(0); cin.tie(0);
  int a, b;
  cin >> a >> b;
  cout << ceil((double)(b - 1) / (a - 1)) << '\n';
  return 0;
}


Measured memory_bytes: 3788
#include <iostream>
#include <algorithm>
#include <cctype>
#include <cstdio>
#include <math.h>
using namespace std;

int main(){
	
	int a,b,c,m=0,n=0;
	while(scanf("%d,%d,%d",&a,&b,&c)!=EOF){
		if(a==EOF)break;
		if(a*a+b*b==c*c)m++;
		if(a==b)n++;
	}
	cout<<m<<endl<<n<<endl;
}

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

#define rep(i, N) for (int i = 0; i < N; i++)
#define pb push_back

typedef long long ll;
typedef pair<ll, int> ll_i;
struct edge { int v, w, h; };
const int INF = INT_MAX / 10;
const int MOD = 1e9 + 7;

bool pos(vector<int> a, int ma) {
	int N = a.size();
	bool ok = true;
	rep(i, N / 2) if (a[i] + a[N - 1 - i] > ma) ok = false;
	return ok;
}

int dfs(int u, int p, vector<vector<int>>& G, int ma) {
	vector<int> a;
	for (int v: G[u]) if (v != p) a.pb(dfs(v, u, G, ma));
	sort(a.begin(), a.end());
	int N = a.size();
	if (N % 2) {
		int lb = -1, ub = N;
		while (ub - lb > 1) {
			int mid = (lb + ub) / 2;
			vector<int> b = a;
			b.erase(b.begin() + mid);
			if (pos(b, ma)) ub = mid;
			else lb = mid;
		}
		return ub == N ? INF : a[ub] + 1;
	}
	if (pos(a, ma)) return 1;
	int i;
	for (i = N - 1; i >= 0; i--) if (a[i] <= ma) break;
	if (i == -1) return INF;
	a.erase(a.begin() + i);
	N = a.size();
	if (N % 2) {
		int lb = -1, ub = N;
		while (ub - lb > 1) {
			int mid = (lb + ub) / 2;
			vector<int> b = a;
			b.erase(b.begin() + mid);
			if (pos(b, ma)) ub = mid;
			else lb = mid;
		}
		return ub == N ? INF : a[ub] + 1;
	}
}

int main() {
	int N; cin >> N;
	vector<vector<int>> G(N);
	rep(i, N - 1) {
		int u, v; scanf("%d%d", &u, &v);
		u--, v--;
		G[u].pb(v), G[v].pb(u);
	}
	int A = 1;
	rep(u, N) if (G[u].size() >= 3) A += (G[u].size() - 1) / 2;
	// cout << dfs(0, -1, G, 2) << endl;
	int lb = -1, ub = N;
	int r;
	rep(u, N) if (G[u].size() == 1) r = u;
	while (ub - lb > 1) {
		int mid = (lb + ub) / 2;
		if (dfs(r, -1, G, mid) - 1 <= mid) ub = mid;
		else lb = mid;
	}
	int B = ub;
	cout << A << ' ' << B << endl;
}


Measured memory_bytes: 19840