akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
  using namespace std;
#define ll long long
#define fw(p) for(int w=0;w<(p);w++)
#define fx(p) for(int x=0;x<(p);x++)
#define fy(p) for(int y=0;y<(p);y++)
#define fz(p) for(int z=0;z<(p);z++)
#define fyg(p,g) for(int y=(g);y<(p);y++)
#define fzg(p,g) for(int z=(g);z<(p);z++)
#define ce(d) cout<<d<<endl;
#define vecp(p) int aa;cin>>aa;(p).push_back(aa);
#define vecpl(p) long long aa;cin>>aa;(p).push_back(aa);
#define vecps(p) string aa;cin>>aa;(p).push_back(aa);
#define vecp2(p) cin>>aa;(p).push_back(aa);
#define vecpl2(p) long long a	b;cin>>ab;(p).push_back(ab);
#define vecps2(p) string ab;cin>>ab;(p).push_back(ab);
#define set0(k,n) for(int nn=0;nn<(n);nn++){ (k).push_back(0); }
#define sorts(c) sort((c).begin(),(c).end());
#define reverses(c) reverse((c).begin(),(c).end());
#define vec(b) vector<int> (b);
#define vecl(b) vector<long long> (b);
#define vecs(b) vector<string> (b);
#define vecsize(b,size) vector<int> (b)((size));
#define pb(b,a) (b).push_back((a));
#define doublece(a,b) cout<<(a)<<' '<<(b)<<endl;
#define pairs(s) vector<pair<int,int>> (s);
#define pairsl(s) vector<pair<ll,ll>> (s);
#define pairss(s) vector<pair<string,string>> (s);
#define pairsp(s) int aa,bb;cin>>aa>>bb;(s).push_back(make_pair(aa,bb));
#define pairspl(s) ll aa,bb;cin>>aa>>bb;(s).push_back(make_pair(aa,bb));
#define pairsps(s) string aa,bb;cin>>aa>>bb;(s).push_back(make_pair(aa,bb));
#define pairsREV(s) (s).push_back(make_pair(bb,aa));
#define pairslREV(s) (s).push_back(make_pair(bb,aa));
#define pairssREV(s) (s).push_back(make_pair(bb,aa));
#define MOD 1000000007


int main() {
	
	int H,W,N;
	cin>>H>>W>>N;
	int field[H][W];
	vec(A)
	fx(N){
		vecp(A)
	}
	
	bool flag=true;
	int x=0,y=0;
	
	fz(N){
		while(A.at(z)>0){
			field[x][y]=z+1;
			if(flag){
				y++;
				if(y>=W){
					y=W-1;
					x++;
					flag=false;
				}
			}else{
				y--;
				if(y<0){
					y=0;
					x++;
					flag=true;
				}
			}
			A.at(z)--;
		}
	}
	
	fx(H){
		fy(W){
			cout<<field[x][y];
			if(y!=W-1){
				cout<<' ';
			}
		}
		cout<<endl;
	}

}

Measured memory_bytes: 384
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define INF 2e9
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
typedef vector<ll> vll;
typedef vector<vll> vvll;


int main()
{
    int a, b;
    cin >> a >> b;
    cout << a + b / 2 << endl;
    return 0;
}

Measured memory_bytes: 256
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.InputMismatchException;
import java.io.IOException;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author KharYusuf
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        FastReader in = new FastReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        DStringEquivalence solver = new DStringEquivalence();
        solver.solve(1, in, out);
        out.close();
    }

    static class DStringEquivalence {
        int n;

        public void solve(int testNumber, FastReader s, PrintWriter w) {
            //Credit: sparsh
            n = s.nextInt();
            int[] a = new int[n];
            print(a, 0, 0, w);
        }

        void print(int[] a, int ind, int cur, PrintWriter w) {
            if (ind == n) {
                for (int i = 0; i < n; i++) w.print((char) (a[i] + 'a'));
                w.println();
                return;
            }
            for (int i = 0; i < cur; i++) {
                a[ind] = i;
                print(a, ind + 1, cur, w);
            }
            a[ind] = cur;
            print(a, ind + 1, cur + 1, w);
        }

    }

    static class FastReader {
        private InputStream stream;
        private byte[] buf = new byte[1024];
        private int curChar;
        private int numChars;
        private FastReader.SpaceCharFilter filter;

        public FastReader(InputStream stream) {
            this.stream = stream;
        }

        public int read() {

            if (numChars == -1)
                throw new InputMismatchException();

            if (curChar >= numChars) {

                curChar = 0;

                try {
                    numChars = stream.read(buf);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }

                if (numChars <= 0)
                    return -1;
            }

            return buf[curChar++];
        }

        public int nextInt() {

            int c = read();

            while (isSpaceChar(c))
                c = read();

            int sgn = 1;

            if (c == '-') {
                sgn = -1;
                c = read();
            }

            int res = 0;

            do {
                if (c < '0' || c > '9')
                    throw new InputMismatchException();

                res *= 10;
                res += c - '0';
                c = read();
            }
            while (!isSpaceChar(c));

            return res * sgn;
        }

        public boolean isSpaceChar(int c) {

            if (filter != null)
                return filter.isSpaceChar(c);

            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

        public interface SpaceCharFilter {
            public boolean isSpaceChar(int ch);

        }

    }
}



Measured memory_bytes: 25288
#include<iostream>
#include<cmath>
#define LIMIT 50000
using namespace std;
int a, b , d, mx, my;

void update( int x, int y ){
    if ( y < 0 ) return;
    if ( x + y == mx + my && a*x + b*y < a*mx + b*my ){
	mx = x; my = y;
    } else if ( x + y < mx + my ){
	mx = x; my = y;
    }
}

main(){
    while( cin >> a >> b >> d, (a || b || d) ){
	mx = my = LIMIT;
	for ( int y, x = 0; x <= b + d; x++ )
	    if ( (a*x - d)%b == 0 ){y = (a*x - d)/b; update( x, y );}
	for ( int y, x = 0; x <= b; x++ )
	    if ( (a*x + d)%b == 0 ){y = (a*x + d)/b; update( x, y );}
	for ( int y, x = 0; x <= d; x++ )
	    if ( (d - a*x)%b == 0 ){y = (d - a*x)/b; update( x, y );}
	cout << mx << " " << my << endl;
    }
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
using namespace std;
 
int main(){
  double a,b;
  cin>>a>>b;
  int c;
  if(b/10<1){
    c=10*a+b;
  }
  if(1<b/10&&b/10<10){
    c=100*a+b;
  }
  if(b==100){
    c=1000*a+b;
  }
  for(int i=1;i<500;i++){
    if(i*i==c){
      cout<<"Yes"<<endl;
      return 0;
    }
  }
  cout<<"No"<<endl;
}

Measured memory_bytes: 3716
import math

#Maps all three inputs into a variable. N is total, A is blue balls, B is red balls
N, A, B = map(int, input().split())
leftOver = N % (A + B)
divTime = N / (A + B)
#print('leftOver: %s' % leftOver)
#print('divTime: %s' % divTime)

if divTime == 1:
  print(A)
elif divTime != 1:
  if leftOver > A:
    print(math.floor(divTime) * A + A)
  elif leftOver <= A:
    print(math.floor(divTime) * A + leftOver)



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

int main(){
    int N; cin>>N;
    vector<double> u(N);
    for(int i=0;i<N;i++)cin>>u[i];
    sort(u.begin(),u.end());
    double ans=(u[0]+u[1])/2;
    for (int i=2;i<N;i++){
        ans=(ans+u[i])/2;
        //cout<<ans<<endl;
    }
    cout<<ans<<endl;

}

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

using namespace std;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    string s;
    while (cin >> s) {
        if (s == "0000") return 0;
        vector<int> nums(4);
        for (int i = 0; i < 4; ++i) {
            nums[i] = s[i] - '0';
        }
        bool ok = false;
        for (int i = 0; i < 3; ++i) {
            if (nums[i] != nums[i + 1]) {
                ok = true;
                break;
            }
        }
        if (!ok) {
            cout << "NA" << '\n';
        } else {
            int res = 0;
            int nnow = 1000;
            for (int i = 0; i < 4; ++i) {
                res += nums[i] * nnow;
                nnow /= 10;
            }
            int cnt = 0;
            while (true) {
                if (res == 6174) break;
                vector<int> num(4);
                for (int i = 0; i < 4; ++i) {
                    num[i] = res % 10;
                    res /= 10;
                }
                sort(num.begin(), num.end());
                int large = 0, small = 0;
                int now = 1;
                for (int i = 0; i < 4; ++i) {
                    large += num[i] * now;
                    now *= 10;
                }
                now = 1;
                for (int i = 3; i >= 0; --i) {
                    small += num[i] * now;
                    now *= 10;
                }
                res = large - small;
                ++cnt;
            }
            cout << cnt << '\n';
        }
    }
    return 0;
}


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

void solve(long long N, vector<long long> A){
	map<long long, ll> mp;

	for(int i = 0; i < N; ++i) {
		mp[A[i]]++;
	}
	sort(A.begin(), A.end());
	A.erase(unique(A.begin(), A.end()), A.end());
	long long res = 0;
	for(int k = 30; k > 0; --k) {
		long long t = 1LL << k;
		for(int i = 0; i < A.size() && A[i] <= t / 2; ++i){
			ll a = A[i];
			ll b = t - a;
			if (a != b) {
				ll m = min(mp[a], mp[b]);
				mp[a] -= m;
				mp[b] -= m;
				res += m;
			} else {
				res += mp[a] / 2;
				mp[a] %= 2;
			}
		}
	}
	cout << res << endl;
}

int main(){	
	long long N;
	scanf("%lld",&N);
	vector<long long> A(N-1+1);
	for(int i = 0 ; i <= N-1 ; i++){
		scanf("%lld",&A[i]);
	}
	solve(N, A);
	return 0;
}



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

int N, K, P;
short W[100002];
int xmax, xmin, xave;


int checkMove(int mp){
        int     i, j;
        int     weight = 0;
        int tn = 1;

        for (i = 0; i < N; i++) {
                weight += W[i];
                if (weight > mp) {
                        weight = W[i];
                        if (tn++ > K) {
                                return false;
                        }
                }
        }
        if (tn > K) { return false; }
        return true;
}

int rfmid(int mid) {
        int cent;

//      cout << "mid " << mid << "; max " << xmax << ": min " << xmin << endl;
        if (xmax == mid) {
                if (checkMove(xmin) == true ) {
                        return xmin;
                } else {
                        return xmax;
                }
        }
        if (checkMove(mid) == true ) {
                xmax = mid;
        } else {
                xmin = mid;
        }
        cent = (xmax + xmin) /2;
        if (cent == xmin) cent++;
        return rfmid(cent);
}

int main(void){
        int i, j, t=0, m=0;
        int ans;

        cin >> N >> K;
        for (i = 0; i < N; i++) {
                cin >> W[i];
                t += W[i];
                m = max(m, (int)W[i]);
//              cout << "No  " << i << "  -  " << W[i] << endl;
        }
        xave = t / K;
        xmax = max(m, xave);
//      cout << "Go" << endl;
        do {
                xmin = xmax;
                xmax = xmax + xave;
//              cout << "check = " << xmax << endl;
        } while (checkMove(xmax) == false);
//      cout << "Go2" << endl;
        ans = rfmid((xmax + xmin) / 2);

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



Measured memory_bytes: 3288
N = input()
K = int(input())

dp = [[[0]*2 for k in range(K+1)] for i in range(len(N)+1)]

# dp[i][x][flg]: 上からi桁目までが確定した段階で、0でない数字がx個あるような数字の個数
#    flg 0: 今作成している数字がN未満であることが確定していない
#    flg 1: 今作成している数字がN未満であることが確定している
dp[0][0][0] = 1

for i in range(len(N)):
    num = int(N[i])  # Nの上からi桁目の数字
    for x in range(K+1):
        if num == 0:
            dp[i+1][x][0] += dp[i][x][0]
            dp[i+1][x][1] += dp[i][x][1]
            if x >= 1:
                dp[i+1][x][1] += dp[i][x-1][1]*9
        else:  # num != 0
            dp[i+1][x][1] += dp[i][x][0] + dp[i][x][1]
            if x >= 1:
                dp[i+1][x][0] += dp[i][x-1][0]
                dp[i+1][x][1] += dp[i][x-1][0]*(num-1) + dp[i][x-1][1]*9
    # print(i, dp[i+1])


print(sum(dp[len(N)][K]))


Measured memory_bytes: 3064
using System;

class Program {
    static void Main() {
        for (var i = 0; i < 9; i++) {
            var l = Console.ReadLine().Split(' ');

            var classname = l[0];
            var amVisitor = int.Parse(l[1]);
            var pmVisitor = int.Parse(l[2]);

            var sumVisitor = amVisitor + pmVisitor;
            var income = amVisitor * 200 + pmVisitor * 300;

            Console.WriteLine(classname + " " + sumVisitor + " " + income);
        }
    }
}

Measured memory_bytes: 9008
#include <iostream>
#include <iomanip>
#include <string>
#include <stack>
#include <vector>
#include <math.h>
#include <stdio.h>
#include <algorithm>
#include <utility>
#include <functional>
#include <iterator>
#include <map>
#include <set>
#include <queue>
#include <list>
#include <regex>
#include <time.h>
#include <complex>
using namespace std;
using pii = pair<int, int>;
using ll = long long;
using ld = long double;
#define pb push_back
#define mp make_pair
#define sc second
#define fr first
#define stpr setprecision
#define cYES cout<<"YES"<<endl
#define cNO cout<<"NO"<<endl
#define cYes cout<<"Yes"<<endl
#define cNo cout<<"No"<<endl
#define rep(i,n) for(ll i=0;i<(n);++i)
#define Rep(i,a,b) for(ll i=(a);i<(b);++i)
#define rrep(i,n) for(int i=n-1;i>=0;i--)
#define rRep(i,a,b) for(int i=a;i>=b;i--)
#define crep(i) for(char i='a';i<='z';++i)
#define psortsecond(A,N) sort(A,A+N,[](const pii &a, const pii &b){return a.second<b.second;});
#define ALL(x) (x).begin(),(x).end()
#define debug(v) cout<<#v<<":";for(auto x:v){cout<<x<<' ';}cout<<endl;
#define endl '\n'
typedef long long ll;

unsigned gcd(int a, int b) {
	while (1) {
		if (a < b) swap(a, b);
		if (!b) break;
		a %= b;
	}
	return a;
}

int main(){

	//int N, M, *A, *B, i, j, *W, *flag, sum=0, start, end, length, tmp;
	int i, j, k, l, m, n, len, a, b, c;
	int *A, B, C, N, M, K,num_R,num_G,num_B;
	ll sum_A = 0, sum_B = 0, sum_C = 0;
	ll **dp;
	double ans;

	scanf("%d %d", &N, &M);



	
	A= (int *)malloc(M * sizeof(int));


	for (i = 0; i < M; i++){

		scanf("%d", &C);
		N -= C;
	}
	if (N < 0)
		N = -1;

	printf("%d\n", N);

	return 0;

}
    


Measured memory_bytes: 3720
#include <bits/stdc++.h>
using namespace std;
int main(){
vector<int> vec(3);
  cin>>vec.at(0)>>vec.at(1)>>vec.at(2);
  sort(vec.begin(),vec.end());
  bool ok = false;
  if(vec.at(2)==vec.at(1)+vec.at(0)){
    ok = true;
  }
     if(ok){
       cout<<"Yes"<<endl;
     }
     else{
       cout<<"No"<<endl;
     }
     return 0;
     }

Measured memory_bytes: 256
import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc=new Scanner(System.in);
		int N=sc.nextInt();
		int L[]=new int [N];
		int sum=0;
		for(int i=0;i<N;i++) {
			L[i]=sc.nextInt();
			sum+=L[i];
		}
		int max=L[0];
		for(int i=1;i<N;i++) {
			if(max<L[i]) {
				max=L[i];
			}
		}
		sum-=max;
		if(sum>max) {
			System.out.println("Yes");
		}
		else {
			System.out.println("No");
		}
	}
}

Measured memory_bytes: 22868
def solve():
    n,m = map(int,input().split())
    a = tuple(map(int,input().split()))
    s = sum(a)
    level = (s+4*m-1)//(4*m)
    cnt = 0
    for i in a:
        if i>=level:
            cnt+=1
    if cnt>=m:
        print('Yes')
    else:
        print('No')
if __name__=='__main__':
    solve()

Measured memory_bytes: 3064
AB = input()
if len(AB) <= 2:
    ABL = [AB]
else:
    ABL= AB.replace("\n", " ").split(" ")



A = int(ABL[0])
if len(AB) <= 2:
    C = A
else:
    B = ABL[1]
    C = int(A) + int(B )
    
if C >= 24:
    C -= 24
print(C)

Measured memory_bytes: 2940
#include<bits/stdc++.h>
typedef long long ll;
typedef unsigned long long LL;
using namespace std;
const int maxn = 1007, maxm = 2007;
const int inf = 1e9 + 7;
int cnt = 1;
int head[maxn], visited[maxn], dfn[maxn], visited1[maxn];
int b[maxn];
struct edge
{
	int u, v, next;
}e[maxm];
void addedge(int u, int v)
{
	e[cnt].u = u;
	e[cnt].v = v;
	e[cnt].next = head[u];
	head[u] = cnt;
	cnt++;
}
vector<int> v;
int ans = inf;
void dfs(int x, int num)
{
	visited[x] = 1;
	dfn[x] = num;
	for (int i = head[x]; i > 0; i = e[i].next)
	{
		int y = e[i].v;
		if (visited1[y] == 1)
		{
			if (dfn[x] - dfn[y] + 1 < ans)
			{
				ans = dfn[x] - dfn[y] + 1;
				int sz = v.size();
				for (int i = 1; i <= ans; i++)
				{
					b[i] = v[sz - i];
				}
			}
		}
		if (visited[y] == 0)
		{
			visited1[y] = 1;
			v.push_back(y);
			dfs(y, num + 1);
		}
	}
	v.pop_back();
	visited1[x] = 0;
}
int main()
{
	int n, m;
	scanf("%d%d", &n, &m);
	for (int i = 1; i <= m; i++)
	{
		int x, y;
		scanf("%d%d", &x, &y);
		addedge(x, y);
	}
	for (int i = 1; i <= n; i++)
	{
		if (visited[i] == 0)
		{
			v.clear();
			v.push_back(i);
			visited1[i] = 1;
			dfs(i, 1);
		}
	}
	if (ans == inf)
		printf("-1\n");
	else
	{
		printf("%d\n", ans);
		for (int i = ans; i >= 1; i--)
		{
			printf("%d\n", b[i]);
		}
	}
	return 0;
}

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

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rept(i,k,n) for(int i = (k); i < (int)(n); i++)
typedef long long ll;
typedef pair<int,int> Pii;
typedef pair<long long,long long> Pll;
typedef tuple<int,int,int,int> tii;

template <typename T>
ostream& operator<<(ostream& s, const vector<T> &vec){
    for(int i=0;i<vec.size();i++){
        if(i) s << ',';
        else s << '{';
        s <<setw(2)<< vec[i];
    }
    s << '}' << endl;
    return s;
}

vector<tii> hg(0);
int ans =0;
int n,m,q;
void rec(int i,int ai,vector<int> A){
    int sc=0;
    if(i==n){
        rep(j,q){
            int a,b,c,d;
            tie(a,b,c,d)=hg[j];
            if(A[b]-A[a]==c) sc+=d;
        }
        ans = max(ans,sc);
        return;
    }
    rept(k,ai,m+1){
        vector<int> b = A;
        b.push_back(k);
        rec(i+1,k,b);
    }
}


int main() {

    cin>>n>>m>>q;
    rep(i,q){
        int a,b,c,d;
        cin>>a>>b>>c>>d;
        hg.push_back(tii(a-1,b-1,c,d));
    }
    vector<int> A(0);
    rec(0,1,A);
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 3632
#include<bits/stdc++.h>
#define pb push_back
#define ll long long
#define F first
#define S second
using namespace std;
bool is(string s){
	for (int i = 0; i < s.size(); i++)
		if (s[i] != s[s.size()-i-1])
		return 0;
	return 1;
	
	
}
int main(){
	ios::sync_with_stdio(0);cin.tie(0);
	string s,s1="",s2="";
	cin >> s;
	int n = s.size();
	for (int i = 0; i < (n-1)/2;i++)
		s1+=s[i];
	for (int i = (n+1)/2; i < n; i++)
		s2 += s[i];
	if (is(s1) & is(s2) & is(s))
		cout << "Yes";
	else cout << "No";
}

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

int main(void){
    int N,K;
    cin >> N >> K;
    int A[N] = {};
    for (int i = 0;i < N;i++){
        cin >> A[i];
    }
    sort(A,A + N);
    int sum = 0;
    for (int i = 0;i < K;i++){
        sum += A[i];
    }
    cout << sum << endl;
}

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

#define PI 3.1415926535897932
#define MOD 1000000007
#define INF 1e9

#define REP(i, n) for(int i = 0; i < (n); i++)
#define REP1(i, n) for(int i = 1; i <= (n); i++)
#define FOR(i, start, end) for(int i = (start); i < (end); i++)
#define ALL(v) (v).begin(), (v).end()

using namespace std;

typedef long long ll;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vi> vvi;
typedef vector<string> vs;
typedef vector<bool> vb;


void solve()
{
    string X, Y; cin >> X >> Y;
    if(X < Y) cout << '<' << endl;
    else if(X > Y) cout << '>' << endl;
    else cout << '=' << endl;
}

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

    solve();

    return 0;
}

Measured memory_bytes: 256
import sys

N = int(input())

if N // 100 == 7:
    print("Yes")
    sys.exit()
N = N % 100


if N // 10 == 7:
    print("Yes")
    sys.exit()

N = N % 10
if N == 7:
    print("Yes")
    sys.exit()

print("No")


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

int main() {
    int N, a;
    int x, y, z;
    x = y = z = 0;
    scanf("%d", &N);
    for (int i = 0; i < N; i++) {
        scanf("%d", &a);
        if (a % 4 == 0) x++;
        else if (a % 2 == 0) y++;
        else z++;
    }

    if (x >= z) printf("Yes\n");
    else if (N / 2 <= x) printf("Yes\n");
    else printf("No\n");

    return 0;
}

Measured memory_bytes: 256
N = gets.to_i
reds = []
blues = []
ans = 0

N.times do
	reds << gets.split.map(&:to_i)
end

N.times do
	blues << gets.split.map(&:to_i)
end

reds.sort_by!{|x, y| y}.reverse!
blues.sort_by!{|x, y| x}

blues.each do |b|
	rr = reds.find {|r| r[0] < b[0] && r[1] < b[1] }
	
	if rr != nil
		reds.delete(rr)
		ans += 1
	end
end

p ans

Measured memory_bytes: 3836
n = int(input())
a = list(map(int, input().split()))
for i in range(n):
    if a[i] % 2 == 0:
        if a[i] % 3 != 0:
            if a[i] % 5 != 0:
                print("DENIED")
                exit()
        if a[i] % 5 != 0:
            if a[i] % 3 != 0:
                print("DENIED")
                exit()
print("APPROVED")

Measured memory_bytes: 38256
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<ctime>
#include<cctype>
#include<climits>
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<list>
#include<queue>
#include<deque>
#include<algorithm>
#include<numeric>
#include<utility>
#include<complex>
#include<memory>
#include<functional>
#include<set>
#include <cassert>
 
using namespace std;
 
#define ALL(g) (g).begin(),(g).end()
#define REP(i, x, n) for(int i = x; i < n; i++)
#define rep(i,n) REP(i,0,n)
#define P(p) cout<<(p)<<endl;
#define PP(p) cout<<(p)<<" ";
#define INF 1e18

typedef long long ll;
#define int ll
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int, int> pi;
//int dy[8]={1,1,1,0,-1,-1,-1,0};
//int dx[8]={-1,0,1,1,1,0,-1,-1};
int dx[4]={0,1,0,-1};
int dy[4]={1,0,-1,0};
int n,x,y;


int cnt[2001];
//int a[2001][2001];
int dis(int a,int b){
    int t1 = abs(a-b);
    int t2 = abs(a-x)+1+abs(b-y);
    int t3 = abs(a-y)+1+abs(b-x);
    return min({t1,t2,t3});
}
signed main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    cin>>n>>x>>y;
    for(int i = 1; i<=n;i++){
        for(int j = i;j<=n;j++){
            int k= dis(i,j);
            cnt[k]++;
        }
    }
    for(int i = 1;i<n;i++){
        cout << cnt[i] << endl;
    }
    return 0;
}


Measured memory_bytes: 3520
import sys


def input():
    return sys.stdin.readline().strip()


sys.setrecursionlimit(20000000)

MOD = 10 ** 9 + 7
INF = float("inf")


def main():
    N = int(input())
    A = list(map(int, input().split()))
    S = 0
    for a in A:
        S = S ^ a
    answer = []
    for a in A:
        answer.append(S ^ a)
    print(*answer)


if __name__ == "__main__":
    main()


Measured memory_bytes: 31492
#include <iostream>
#include <sstream>
#include <string>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <cassert>

using namespace std;

#define FOR(i,k,n) for(int i=(k); i<(int)(n); ++i)
#define REP(i,n) FOR(i,0,n)
#define FORIT(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)

template<class T> void debug(T begin, T end){ for(T i = begin; i != end; ++i) cerr<<*i<<" "; cerr<<endl; }
inline bool valid(int x, int y, int W, int H){ return (x >= 0 && y >= 0 && x < W && y < H); }

typedef long long ll;
const int INF = 100000000;
const double EPS = 1e-8;
const int MOD = 1000000007;
int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};

int main(){
  string s;
  vector<string> lines;
  while(getline(cin, s) && s != "END_OF_TEXT"){
    lines.push_back(s);
  }
  int x = 0, y = 0;
  bool is_clear = true;
  string buffer = "";
  while(cin>>s){
    if(s == "a"){
      x = 0;
    }else if(s == "e"){
      x = lines[y].size();
    }else if(s == "p"){
      x = 0;
      if(y > 0) y--;
    }else if(s == "n"){
      x = 0;
      if(y + 1 < lines.size()) y++;
    }else if(s == "f"){
      if(x + 1 <= lines[y].size()){
        x++;
      }else if(y + 1 < lines.size()){
        x = 0;
        y++;
      }else{
      }
    }else if(s == "b"){
      if(x - 1 >= 0){
        x--;
      }else if(y - 1 >= 0){
        y--;
        x = lines[y].size();
      }else{
      }
    }else if(s == "d"){
      if(x < lines[y].size()){
        lines[y] = lines[y].erase(x, 1); //xはどうなる?
      }else if(y + 1 < lines.size()){
        lines[y] += lines[y + 1];
        lines.erase(lines.begin() + y + 1); //xはどうなる?
      }
    }else if(s == "k"){
      if(x == lines[y].size()){
        if(y + 1 < lines.size()){
          lines[y] += lines[y + 1];
          lines.erase(lines.begin() + y + 1); //xはどうなる?
          buffer = "";
          is_clear = false;
        }
      }else{
        buffer = lines[y].substr(x);
        assert(buffer != "");
        is_clear = false;
        lines[y].erase(x);
      }
    }else if(s == "y"){
      if(is_clear){
      }else if(buffer == ""){
        string a = lines[y].substr(0, x);
        string b = lines[y].substr(x);
        lines[y] = a;
        lines.insert(lines.begin() + y + 1, b);
        y++;
        x = 0;
      }else{
        string a = lines[y].substr(0, x);
        string b = lines[y].substr(x);
        lines[y] = a + buffer + b;
        x += buffer.size();
      }
    }else{
      assert(s == "-");
    }
  }
  REP(i, lines.size()) cout << lines[i] << endl;
  return 0;
}

Measured memory_bytes: 1216
#include <iostream>

using namespace std;

int main()
{
   for(int i = 1; i <= 9; i++)
   {
       for(int j = 1; j<=9; j++)
       {
           cout << i << "x" << j << "=" << i*j << endl;
       }
   }

   return (0) ;
}

Measured memory_bytes: 2996
import java.util.*;

class Main{
    public static void main(String args[]){
        Scanner sc = new Scanner(System.in);
        String b = sc.next();
        if(b.equals("A"))
        {
            System.out.println("T");
        }else if(b.equals("T"))
        {
            System.out.println("A");
        }else if(b.equals("C"))
        {
            System.out.println("G");
        }else 
        {
            System.out.println("C");
        }
    }
}

Measured memory_bytes: 20820
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0;i < n;i++)
#define ll long long
using namespace std;
//typedef vector<unsigned int>vec;
//typedef vector<ll>vec;
//typedef vector<vec> mat;
typedef pair<int, int> P;
typedef pair<ll,ll> LP;
const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
const int INF = 1000000000;
const ll LINF = 1000000000000000000;//1e18
const ll  MOD = 1000000007;
const double PI = acos(-1.0);
const double EPS = 1e-10;

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> inline void add(T &a, T b){a = ((a+b) % MOD + MOD) % MOD;};


int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N;
    string S;
    cin >> N >> S;
    vector<int> a(N);
    bool one = false;
    REP(i,N){
        a[i] = S[i] - '0';
        a[i]--;
        if(a[i] & 1) one = true;
    }
    if(!one) REP(i, N) a[i] /= 2;
    
    int ans = 0;
    REP(i,N){
        // _(n-1)C_i の偶奇
        if(a[i] == 1 && ((N-1) & i) == i) ans ^= 1;
    }
    if(!one) ans *= 2;
    cout << ans << endl;
}


Measured memory_bytes: 5276
using System;
using System.Collections.Generic;

namespace Curtain
{
    class Program
    {
        static void Main(string[] args)
        {            
            var input = Console.ReadLine().Split();
            int inputA = int.Parse(input[0]);
            int inputB = int.Parse(input[1]);
            
            if(inputA - (inputB * 2) <= 0)
            {
                Console.WriteLine("0");
            }
            else
            {
                Console.WriteLine(inputA - (inputB * 2));
            }
        }
    }
}

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

int main() {
    int x, y;
    while(true) {
        cin >> x >> y;
        if(x == 0 && y == 0) {
            break;
        }
        cout << min(x, y) << " " << max(x, y) << endl;
    }
    return 0;
}


Measured memory_bytes: 2988
#include <iostream>
#include <algorithm>
#include <cmath>
#include <vector>
#include <queue>
#include <set>
#include <map>

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

using namespace std;

struct UnionFind{
  vector<int> par,num;

  UnionFind(int N) : par(N),num(N){
    for(int i=0;i<N;i++){
      par[i] = i;
      num[i] = 1;
    }
  }

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

  void unite(int x, int y){
    int rx = root(x);
    int ry = root(y);
    if(rx == ry) return;
    par[rx] = ry;
    num[ry] = num[ry]+num[rx]; 
  }

  int get_num(int x){
    int rx = root(x);
    return num[rx];
  }

  bool same(int x, int y){
    int rx = root(x);
    int ry = root(y);
    return rx == ry;
  }
};


int main(void){
  int k;
  cin >> k;
  string s;
  cin >> s;

  if(s.length() <= k){
    cout << s << endl;
  }
  else{
    for(int i=0;i<k;i++){
      cout << s[i];
    }
    cout << "..." << endl;
  }
  return 0;
}


Measured memory_bytes: 3628
N, M = map(int, input().split())
#Nは偶数。偶数２つの場合
n = 0
for i in range(1, N):
  n = n + i
 
#Mは奇数。奇数２つの場合
m = 0
for j in range(1, M):
  m = m + j
  
print("{}".format(n + m)) 


Measured memory_bytes: 2940
import java.util.*;
import java.io.*;
import java.math.*;
 
 
import static java.lang.Math.*;
import static java.util.Arrays.*;
import static java.util.Collections.*;
 
public class Main{
    static final long mod=1000000007;
    
    public  static void main(String[] args)   throws Exception, IOException{
        Reader sc = new Reader(System.in);
        PrintWriter out=new PrintWriter(System.out);
        // int n=sc.nextInt();
        // char c[][] = new char[h][w];
        // char c[]=sc.nextString().toCharArray();
        // for(int i=0; i<n; i++) {a[i]=sc.nextInt();}
        int n=sc.nextInt();
        int d[] = new int[n];
        for (int i=0; i<n; i++) {
           d[i]=sc.nextInt();
        }
        int ans=0;
        for (int i=0; i<n; i++) {
            int e=d[i],c=0;
           while(i<n && e==d[i]){
             c++;i++;
           }
           if(i<n)i--;
           ans+=c/2;
        }


        out.println(ans);
        out.flush();
    }
    


    static void db(Object... os){
        System.err.println(Arrays.deepToString(os));
    }
     
    static boolean validpos(int x,int y,int r, int c){
        return x<r && 0<=x && y<c && 0<=y;
    }
    
    static boolean bit(long x,int k){
        // weather k-th bit (from right) be one or zero
        return  ( 0 < ( (x>>k) & 1 )  )  ? true:false;
    }    
}

class P implements Comparable<P>{
        int id, d;
        P(int  id, int d) {
            this.id=id;
            this.d=d;
        } 
          
        public int compareTo(P p){
            return d-p.d; //descend
        }
    }

class Reader
{ 
    private BufferedReader x;
    private StringTokenizer st;
    
    public Reader(InputStream in)
    {
        x = new BufferedReader(new InputStreamReader(in));
        st = null;
    }
    public String nextString() throws IOException
    {
        while( st==null || !st.hasMoreTokens() )
            st = new StringTokenizer(x.readLine());
        return st.nextToken();
    }
    public int nextInt() throws IOException
    {
        return Integer.parseInt(nextString());
    }
    public long nextLong() throws IOException
    {
        return Long.parseLong(nextString());
    }
    public double nextDouble() throws IOException
    {
        return Double.parseDouble(nextString());
    }
}

Measured memory_bytes: 21460
n=gets.to_i
c = 0 #ケーキの個数
d = 0 #ドーナツの個数
ans = "No"
0.upto(n/4) do |c|
  0.upto(n/7) do |d|
    if c*4+d*7 == n
      ans = "Yes"
    end
  end
end

puts ans

Measured memory_bytes: 3836
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <ctime>
#include <cstring>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <bitset>
#include <numeric>
#include <utility>
#include <iomanip>
#include <algorithm>
#include <functional>
#include <unordered_map>
using namespace std;

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

template<class T> vector<T> make_vec(size_t a) { return vector<T>(a); }
template<class T, class... Ts> auto make_vec(size_t a, Ts... ts) {
  return vector<decltype(make_vec<T>(ts...))>(a, make_vec<T>(ts...));
}
template<class T, class V>
typename enable_if<is_class<T>::value == 0>::type fill(T &t, const V &v) {
    t = v;
}
template<class T, class V>
typename enable_if<is_class<T>::value != 0>::type fill(T &t, const V &v){
    for (auto &e : t) fill(e, v);
}

#define COUT(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl
template<class T1, class T2> ostream& operator << (ostream &s, pair<T1,T2> P)
{ return s << '<' << P.first << ", " << P.second << '>'; }
template<class T> ostream& operator << (ostream &s, vector<T> P)
{ for (int i = 0; i < P.size(); ++i) { if (i > 0) { s << " "; } s << P[i]; } return s; }
template<class T> ostream& operator << (ostream &s, vector<vector<T> > P)
{ for (int i = 0; i < P.size(); ++i) { s << endl << P[i]; } return s << endl; }

#define EACH(i, s) for (__typeof__((s).begin()) i = (s).begin(); i != (s).end(); ++i)
template<class T> ostream& operator << (ostream &s, set<T> P)
{ EACH(it, P) { s << "<" << *it << "> "; } return s << endl; }
template<class T1, class T2> ostream& operator << (ostream &s, map<T1,T2> P)
{ EACH(it, P) { s << "<" << it->first << "->" << it->second << "> "; } return s << endl; }



string S;
int main() {
    while (cin >> S) {
        sort(S.begin(), S.end());
        if (S[0] == S[1] && S[2] == S[3] && S[1] != S[2]) puts("Yes");
        else puts("No");
    }
}


















Measured memory_bytes: 256
#include<bits/stdc++.h>
#define MAXV 100010
#define MAXLV 20
#define f first
#define s second
#define mp make_pair
#define inf 1<<29
using namespace std;

vector<int> e[MAXV];
int n,root=0;

int parent[MAXLV][MAXV];
int depth[MAXV];

void dfs(int v,int p,int d){
  parent[0][v]=p;
  depth[v]=d;
  for(int i=0;i<e[v].size();i++){
    if(e[v][i]!=p)dfs(e[v][i],v,d+1);
  }
}

void init(){
  dfs(root,-1,0);
  for(int k=0;k+1<MAXLV;k++){
    for(int v=0;v<n;v++){
      if(parent[k][v]<0)parent[k+1][v]=-1;
      else parent[k+1][v]=parent[k][parent[k][v]];
    }
  }
}

int lca(int u,int v){
  if(depth[u]>depth[v])swap(u,v);
  for(int k=0;k<MAXLV;k++){
    if((depth[v]-depth[u])>>k&1){
      v=parent[k][v];
    }
  }
  if(u==v)return u;
  for(int k=MAXLV-1;k>=0;k--){
    if(parent[k][u]!=parent[k][v]){
      u=parent[k][u];
      v=parent[k][v];
    }
  }
  return parent[0][u];
}

int main()
{
  int a;

  cin>>n;
  for(int i=1;i<n;i++){
    cin>>a;
    e[a-1].push_back(i);
  }
  init();

  vector<int> v;
  int d[MAXV];
  for(int i=0;i<MAXV;i++)d[i]=inf;
  queue<int> q;
  q.push(0);
  d[0]=0;
  while(!q.empty()){
    int u=q.front();
    q.pop();
    v.push_back(u);
    for(int i=0;i<e[u].size();i++){
      int next=e[u][i];
      if(d[next]==inf){
	d[next]=d[u]+1;
	q.push(next);
      }
    }
  }

  long long ans=0;
  for(int i=0;i<v.size()-1;i++){
    int u=lca(v[i],v[i+1]);
    ans+=(d[v[i]]-d[u]);
    ans+=(d[v[i+1]]-d[u]);
  }
  cout<<ans<<endl;

  return 0;
}

Measured memory_bytes: 20424
{-
?????????: Area of Polygon
URL: http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0079
?????°
19:17 JOI??¬?????§???????£???§????????????Dijkstra??????????£???§????????????????????\????????°????????¨C++?????????????????\???
19:18 ??¨???????????¨??§Haskell??§?????¢????????????

-}
import Data.Complex
import Control.Monad
import Control.Applicative
import System.IO

a `dot` b = realPart $ conjugate a * b
a `cross` b = imagPart $ conjugate a * b

main :: IO ()
main = do
 str <- getContents
 let cs = map lire $ lines str
 print $ (/2) $ abs $ sum $ zipWith cross (last cs:cs) cs


-- last cs : cs = [e,a,b,c,d,e]
--           cs = [a,b,c,d,e]
-- zipWith cross????????¨?????????

lire :: String -> Complex Double
lire str =
 let (a,',':b) = break (==',') str
 in (read a :+ read b)

Measured memory_bytes: 3920
# -*- coding: utf-8 -*-
from heapq import heappush, heappop

qn = int(input())

low = []
high = []
ans = 0

for i in range(qn):
    q = [int(i) for i in input().split()]
    if q[0] == 1:
        ans += q[2]
        a = q[1]

        if len(low) >= 1:
            if a < -low[0]:
                ans += -low[0] - a
            elif a > high[0]:
                ans += a - high[0]

        # lowは降順に並べたいので-aを入れる
        heappush(low, -a)
        heappush(high, a)
        if -low[0] > high[0]:
            low0 = heappop(low)
            high0 = heappop(high)
            # lowとhighで正負が逆なので注意する
            heappush(low, -high0)
            heappush(high, -low0)

    elif q[0] == 2:
        print(-low[0], ans)


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

template <typename T>
class SegmentTree {
	using func_t = function<T(const T&, const T&)>;
	const int n;
	func_t merge;
	vector<T> data;
	int size(int n) {
		int res;
		for (res = 1; res < n; res <<= 1);
		return res;
	}
	int sub(int l, int r, int node, int lb, int ub, int mi, int ma) {
		if (ub <= l || r <= lb) return 0;
		if (l <= lb && ub <= r) return (lower_bound(data[node].begin(), data[node].end(), mi) - data[node].begin()) + (data[node].end() - upper_bound(data[node].begin(), data[node].end(), ma));
		return sub(l, r, node * 2, lb, (lb + ub) / 2, mi, ma) + sub(l, r, node * 2 + 1, (lb + ub) / 2, ub, mi, ma);
	}
public:
	SegmentTree(const vector<T>& data_, func_t merge_) :
		n(size(data_.size())), merge(merge_), data(n * 2, vector<int>()) {
		for (int i = 0; i < (int)data_.size(); i++)
			data[i + n] = data_[i];
		for (int i = n - 1; i >= 0; i--)
			data[i] = merge(data[i * 2], data[i * 2 + 1]);
	}
	int Find(int l, int r, int mi, int ma) {
		return sub(l, r + 1, 1, 0, n, mi, ma);
	}
};

int main()
{
	int D, Q;
	cin >> D;
	vector<vector<int>> x(D, vector<int>(1));
	for (int i = 0; i < D; i++) {
		cin >> x[i][0];
	}
	SegmentTree<vector<int>> st(x, [](const vector<int>& l, const vector<int>& r) {
		int nl = l.size(), nr = r.size();
		vector<int> res;
		for (int i = 0, j = 0; i < nl || j < nr;) {
			if (j == nr) {
				res.push_back(l[i++]);
				continue;
			}
			if (i == nl) {
				res.push_back(r[j++]);
				continue;
			}
			if (l[i] <= r[j]) {
				res.push_back(l[i++]);
			}
			else {
				res.push_back(r[j++]);
			}
		}
		return res;
	});
	cin >> Q;
	for (int i = 0, l, r, e; i < Q; i++) {
		cin >> l >> r >> e; l--; r--;
		int mi = min(x[l][0], x[r][0]) - e;
		int ma = max(x[l][0], x[r][0]) + e;
		cout << st.Find(l, r, mi, ma) << endl;
	}
	return 0;
}

Measured memory_bytes: 27256
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
#define rep(i,a,n) for(ll i=a;i<n;i++)
int main(){
  ll x,y;
  cin>>x>>y;
  ll t=x;
  ll c=0;
  if(t*4<y&&y%2==1){
    cout<<"No"<<endl;
    return 0;
  }
  rep(i,0,x+1){
    if(t*4+c*2==y){
      cout<<"Yes"<<endl;
      return 0;
    }
    t--;
    c++;
  }
  cout<<"No"<<endl;
}

Measured memory_bytes: 3636
until (l = gets.to_i).zero?  
  ans = "NA"
  
  12.times do |i|
    m, n = gets.split.map(&:to_i)
    l = l - (m - n)
    ans = i + 1 if l <= 0 && ans == "NA"
  end
  
  puts ans
end

Measured memory_bytes: 6104
MOD = 10**9 + 7

L = input()

dp1 = [0]*100010 # dp1[k]: 先頭からk桁について，A+B < L が確定している (A,B) の数
dp2 = [0]*100010 # dp2[k]: 先頭からk桁について，A+B と L が一致している (A,B) の数
dp1[1], dp2[1] = 1, 2

for i in range(1,len(L)):
    for digit_A, digit_B in [[0,0],[0,1],[1,0]]:
            dp1[i+1] += dp1[i]

            if digit_A + digit_B == int(L[i]):
                dp2[i+1] += dp2[i]
            elif digit_A + digit_B < int(L[i]):
                dp1[i+1] += dp2[i]
            
            dp1[i+1] %= MOD
            dp2[i+1] %= MOD

ans = dp1[len(L)] + dp2[len(L)]
print(ans % MOD)

Measured memory_bytes: 75744
import java.io.*;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Scanner;

class Main {
    public static void main(String[] args) throws IOException {
       Scanner in = new Scanner(System.in);
       ArrayList<Integer> intArr = new ArrayList<Integer>();
       for(int i=0;i<3;i++) intArr.add(in.nextInt());
       Collections.sort(intArr);
       System.out.printf("%d %d %d\n",
		       intArr.get(0), intArr.get(1), intArr.get(2));
    }
}

Measured memory_bytes: 17176
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
ll MOD = 1000000007;
ll INFL = 1ll << 60;
ll INF = 1 << 30;
int dx[8] = {0, 1, 1, 1, 0, -1, -1, -1};
int dy[8] = {1, 1, 0, -1, -1, -1, 0, 1};

ll f(ll n, ll x) {
  return n != -1 ? n / x + 1 : 0;
}

int main() {
  ll a, b, x;
  cin >> a >> b >> x;
  cout << f(b, x) - f(a - 1, x) << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define N (long long)(1e9 + 7)
#define fin 61
using namespace std;

long long l, r;
long long dp[70][2][2];

long long solve();
long long cnt(long long nowl, long long nowr,
              long long dig);
bool ch(long long x, long long d);

int main() {
  cin >> l >> r;
  cout << solve() << endl;
  return 0;
}

long long solve() {
  long long ans = 0;
  for(int i = 0; i < fin; ++i) {
    long long nbase = 1LL << i, nmax = (1LL << (i + 1)) - 1;
    if(nmax < l || nbase > r) continue;
    ans +=
        cnt(max(nbase, l) - nbase, min(r, nmax) - nbase, i);
    ans %= N;
  }
  return ans;
}

long long cnt(long long nowl, long long nowr,
              long long dig) {
  for(int i = 0; i <= dig; ++i)
    for(int j = 0; j < 2; ++j)
      for(int k = 0; k < 2; ++k) dp[i][j][k] = 0;
  long long ans = 0;
  // i l r
  dp[0][0][0] = 1;
  for(int i = 0; i < dig; ++i) {
    bool flagr = ch(nowr, dig - 1 - i),
         flagl = ch(nowl, dig - 1 - i);
    if(flagr && flagl) {
      // use 1 1
      for(int j = 0; j < 2; ++j)
        for(int k = 0; k < 2; ++k)
          dp[i + 1][j][k] = dp[i][j][k];
      // // use 1 0
      // for(int j = 0; j < 2; ++j) {
      //   dp[i + 1][j][1] += (dp[i][j][1] + dp[i][j][0]) %
      //   N; dp[i + 1][j][1] %= N;
      // }
      // use 0 1
      for(int j = 0; j < 2; ++j) {
        dp[i + 1][1][j] += dp[i][1][j];
        dp[i + 1][1][j] %= N;
      }
      // use 0 0
      dp[i + 1][1][1] += (dp[i][1][0] + dp[i][1][1]) % N;
      dp[i + 1][1][1] %= N;
    }
    else if(flagr) {
      // use 1 1
      for(int j = 0; j < 2; ++j)
        dp[i + 1][1][j] = (dp[i][0][j] + dp[i][1][j]) % N;
      // use 0 1
      for(int j = 0; j < 2; ++j)
        for(int k = 0; k < 2; ++k) {
          dp[i + 1][j][k] += dp[i][j][k];
          dp[i + 1][j][k] %= N;
        }
      // use 0 0
      for(int j = 0; j < 2; ++j) {
        dp[i + 1][j][1] += (dp[i][j][1] + dp[i][j][0]) % N;
        dp[i + 1][j][1] %= N;
      }
    }
    else if(flagl) {
      // use 1 1
      for(int j = 0; j < 2; ++j)
        dp[i + 1][j][1] = dp[i][j][1];
      // use 0 1
      dp[i + 1][1][1] += dp[i][1][1];
      dp[i + 1][1][1] %= N;
      // use 0 0
      for(int j = 0; j < 2; ++j) {
        dp[i + 1][1][j] += dp[i][1][j];
        dp[i + 1][1][j] %= N;
      }
    }
    else {
      // use 1 1
      dp[i + 1][1][1] = (dp[i][1][1] + dp[i][0][1]) % N;
      // use 0 1
      for(int j = 0; j < 2; ++j) {
        dp[i + 1][j][1] += dp[i][j][1];
        dp[i + 1][j][1] %= N;
      }
      // use 0 0
      for(int j = 0; j < 2; ++j)
        for(int k = 0; k < 2; ++k) {
          dp[i + 1][j][k] += dp[i][j][k];
          dp[i + 1][j][k] %= N;
        }
    }
  }
  for(int i = 0; i < 2; ++i)
    for(int j = 0; j < 2; ++j) {
      ans += dp[dig][i][j];
      ans %= N;
    }
  return ans;
}

bool ch(long long x, long long d) { return (x >> d) & 1; }

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

using namespace std;
typedef long long ll;
#define rep(i,j,n) for (ll i = j; i < (n); i++)
#define CLR(mat,f) memset(mat, f, sizeof(mat))
#define IN(a, b, x) (a<=x&&x<b)
#define out(ans) cout << ans << endl
typedef pair<ll,ll>P;
const ll mod=1e9+7;
const int INF = 1000000;
const double PI=3.14159265359;

int main(){

  ll n,a,b;cin>>n>>a>>b;

  ll k=abs(b-a);

  if(k%2==0){
    out(k/2);
  }else{
    if(n-b>a-1){
      out(a-1+1+(b-a)/2);
    }else{
      out(n-b+1+(n-(a+n-b+1))/2);
    }
  }


  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
 int path(int i,int j,int H,int W,string M[],long long int P[][1050]){
if(i==H||j==W)return 0;
if(M[i][j]=='#')return 0;
if(P[i][j]!=-1)return P[i][j];
if(i==(H-1)&&j==(W-1)){return 1;}
P[i][j]=(path(i+1,j,H,W,M,P)+path(i,j+1,H,W,M,P));

P[i][j]=P[i][j]%1000000007;

return P[i][j];

}




main(){
long long int H,W;
cin>>H>>W;
string  M[H];
long long int P[H][1050];
for(int i=0;i<H;i++)for(int j=0;j<1050;j++)P[i][j]=-1;
for(int i=0;i<H;i++)cin>>M[i];

cout<<path(0,0,H,W,M,P);

















}


Measured memory_bytes: 9728
#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,l;
	cin >> n;
	int ans = 0;
	int sum = 0;
	vector<int> a(n);
	for(int i = 0; i < n; i++) {
		cin >> l;
		sum += l;
		a[i] = l;
	}
	vector<vector<int>> dp(n+1,vector<int>(sum+1,0));
	dp[0][0] = 1;
	for(int i = 1; i <= n; i++) {
		for(int j = 0; j <= sum; j++) {
			if (dp[i - 1][j] == 1){
				dp[i][j] = 1;
				dp[i][j+a[i - 1]] = 1;
			}
		}
	}


	for(int i = 1; i <= sum; i++) {
		if(dp[n][i] == 1 && i % 10 != 0){
			ans = max(ans,i);
		}
	}
	cout << ans << endl;
	return 0;
}

// int main(){
// 	int n,l;
// 	cin >> n;
// 	int ans = 0;
// 	vector<int> a;
// 	for(int i = 0; i < n; i++) {
// 		cin >> l;
// 		ans += l;
// 		if(l % 10 != 0){
// 			a.pb(l);
// 		}
// 	}
// 	sort(ALL(a));
// 	if(ans % 10 == 0 && a.size() == 0){
// 		ans = 0;
// 	}
// 	else if(ans % 10 == 0){
// 		ans -= a[0];
// 	}
// 	cout << ans << endl;
// 	return 0;
// }

Measured memory_bytes: 4224
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        long n = sc.nextLong();
        long b = sc.nextLong();
        long r = sc.nextLong();

        if (b == 0) {
            System.out.println(0);
        } else if (r == 0) {
            System.out.println(n);
        } else {
            long times = n / (b + r);
            long rev = n % (b + r);
            System.out.println(times * b + Math.min(rev, b));
        }
    }
}

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

int main(){
  int n;
  cin >> n;
  vector<int> v(3 * n);
  rep(i, 3*n) cin >> v[i];

  sort(v.begin(), v.end());
  v.erase(v.begin(), v.begin() + n);
  ll ans = 0;
  rep(i, 2*n){
    if ((i % 2) == 0) ans += v[i];
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 4240
#include<bits/stdc++.h>
#define     FAST            ios_base::sync_with_stdio(false); cin.tie(0), cout.tie(0);
#define ll long long
using namespace std;
int main()
{

    int n;
    cin>>n;
    ll ar[n];
    for(int i=0; i<n; i++)
    {
        cin>>ar[i];
    }


    ll sm=ar[0],ans=0;
    for(int i=1; i<n; i++)
    {
        if(ar[i]>sm)
        {
            sm=ar[i];
        }


        ans+=(sm-ar[i]);
    }

    cout<<ans<<endl;

















    return 0;
}


Measured memory_bytes: 5196