akhauriyash/Code-Regression huggingface dataset:
using System;
using System.Text;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text.RegularExpressions;



    class Program
    {
        static void Main(string[] args)
        {
            while (true)
            {
                string a;
                a = Console.ReadLine();
                if (a == null) break;
                string[] b = a.Split();
                int sum, cou = 0;
                sum = int.Parse(b[0]) + int.Parse(b[1]);
                for (; ; )
                {
                    if (sum >= 10)
                    {
                        sum = sum / 10;
                        cou++;
                    }
                    else
                    {
                        cou++;
                        break;
                    }
                }
                Console.WriteLine(cou);
            }
        }
    }

Measured memory_bytes: 5632
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
#define rep(i, from, to) for (int i = from; i < (to); ++i)
#define mp(x,y) make_pair(x,y)
#define all(x) (x).begin(),(x).end()
#define sz(x) (int)(x).size()
#define pb push_back
using ll = long long;
using vin=vector<int>;
using vvin=vector<vin>;
using vll=vector<ll>;
using vvll=vector<vll>;
using vst=vector<string>;
using P = pair<ll,ll>;
const int inf=1e9+7;
const ll INF=9e18;
template <typename T> bool chmin(T &a, const T& b){if(a > b){a = b;return true;}return false;}
template <typename T> bool chmax(T &a, const T& b){if(a < b){a = b;return true;}return false;}
template<class T> inline void Yes(T condition){ if(condition) cout << "Yes" << endl; else cout << "No" << endl; }
template<class T> inline void YES(T condition){ if(condition) cout << "YES" << endl; else cout << "NO" << endl; }
const int dx[4] = { 1, 0, -1, 0 };
const int dy[4] = { 0, 1, 0, -1 };

int cnt[110000];

int main(){cout<<fixed<<setprecision(20);
		   string s;
           cin>>s;
           int n=s.size();
           int r=0,l=0;
           rep(i,0,n){
             if(s[i]=='R'){
              r++;
             }
             else{
               //cout<<r<<" "<<1<<endl;
              if(r>=1)cnt[i-1]=r;
               r=0;
             }
             //cout<<r<<endl;
           }
           for(int i=n-1;i>=0;i--){
            if(s[i]=='L')l++;
             else{
               
              if(l>=1)cnt[i+1]=l;
               l=0;
             }
           }
           
          // rep(i,0,n)cout<<cnt[i]<<endl;
           //cout<<endl;
           rep(i,0,n){
            if(cnt[i]){
             if(s[i]=='R'){
               int c=cnt[i+1];
               cout<<(cnt[i]+1)/2+c/2<<" ";
             }
              else{
                int c=cnt[i-1];
                cout<<(cnt[i]+1)/2+c/2<<" ";
              }
            }
             else{
               cout<<0<<" "; 
             }
           }
           //cout<<endl;
}



Measured memory_bytes: 4100
# include <bits/stdc++.h>
# define rep(i, n) for(int i=0, i##_len=(n); i<i##_len; ++i)
# define reps(i, n) for(int i=1, i##_len=(n); i<=i##_len; ++i)
# define rrep(i, n) for(int i=((int)(n)-1); i>=0; --i)
# define rreps(i, n) for(int i=((int)(n)); i>0; --i)
# define ALL(x) (x).begin(), (x).end()
# define RALL(x) (x).rbegin(), (x).rend()
# define SZ(x) ((int)(x).size())
# define pb push_back
# define optimize_cin() cin.tie(0); ios::sync_with_stdio(false)
# define debug(x) std::cerr<<#x<<": "<<(x)<<endl;
using namespace std;
using lint = long long;
template<class T> using grid = vector<vector<T>>;
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; }
static const lint MOD = (lint)1e9+7;

lint Sum(vector<lint> nums)
{
    lint sum = 0;
    rep (i, SZ(nums))
    {
        sum += nums[i];
    }
    return sum;
}

int main()
{
    int N;
    cin >> N;
    vector<lint> B(N-1);
    rep (i, N-1)
    {
        cin >> B[i];
    }

    vector<lint> A(N);
    A[0] = B[0];
    for (int i = N - 1; i > 0; --i)
    {
        A[i] = min(B[i-1], B[i]);
    }
    A[N-1] = B[N-2];

    lint sum = Sum(A);
    cout << sum << endl;

    return 0;
}


Measured memory_bytes: 3608
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>

#include <iostream>
#include <complex>
#include <string>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>

#include <functional>
#include <cassert>

typedef long long ll;
using namespace std;

#define debug(x) cerr << __LINE__ << " : " << #x << " = " << (x) << endl;

#define mod 1000000007 //1e9+7(prime number)
#define INF 1000000000 //1e9
#define LLINF 2000000000000000000LL //2e18
#define SIZE 100010

ll factmemo[SIZE];
ll factmemoMod = -1;
void initFactorial(int n, int M){
  factmemoMod = M;
  factmemo[0] = 1;
  for(int i=1;i<=n;i++) factmemo[i] = (factmemo[i-1] * i)%M;
}

ll factorial(int n,int M){
  if(factmemoMod == M) return factmemo[n];
  
  ll ret=1;
  if(n<=1) return 1;
  
  for(int i=1;i<=n;i++) ret = (ret*i)%M;
  
  return ret;
}

ll power(int k,int n,int M){
  if(n==0) return 1;
  if(n==1) return (ll)k;
  
  ll ret = power(k,n/2,M);
  
  ret=(ret*ret)%M;
  
  if(n%2==1) ret=(ret*k)%M;
  
  return ret;
}


//nCm nPm nHm (mod M)

/*Combination*/
int C(int n,int m,int M){
  if(n<m) return 0;
  if(m==0 || n==m) return 1;
  
  ll chi = factorial(n,M);
  ll mot = (factorial(m,M) * factorial(n-m,M))%M;
  
  mot = power((int)mot,M-2,M);
  
  ll ret = (chi*mot)%M;
  
  return (int)ret;
}

/*Permutation*/
int P(int n,int m,int M){
  if(n<m) return 0;
  if(m==0) return 1;
  
  ll chi = factorial(n,M);
  ll mot = factorial(n-m,M);
  
  mot = power((int)mot, M-2,M);
  
  ll ret = (chi*mot)%M;
  
  return (int)ret;
}

/*Combination with Repetitions*/
int H(int n,int m,int M){
  if(n==0 && m==0) return 1;
  return C(n+m-1,m,M);
}


int main(){
  int n, k;

  cin >> n >> k;

  cout << P(k, n, mod) << endl;
  
  return 0;
}



Measured memory_bytes: 3100
object Main extends App{
  val sc = new java.util.Scanner(System.in)
  var a,v= sc.nextLong()
  var b,w= sc.nextLong()
  var t= sc.nextLong()
  var av = BigInt(a+(v*t))
  var bw = BigInt(b+(w*t))
  if (a < b) {
    print(if (av >= bw) "YES" else "NO")
  }else{
    print(if (a-(v*t) <= (b-(w*t))) "YES" else "NO")
  }
}


Measured memory_bytes: 55468
#include<stdio.h>

int main() {
    
  int i,j,v,m,a,N,p;
  int A[1000];

  scanf("%d",&N);
 
  for(i=0;i<N;i++) {
    scanf("%d",&A[i]);
   
  }
for(p=0;p<N-1;p++) {
      printf("%d ",A[p]);     
    }
    printf("%d",A[p]);
    printf("\n");
  for(i=1;i<=N-1;i++) {
    v = A[i];
    j=i-1;
    while(j>=0 && A[j]>v) {
      
      A[j+1] = A[j];
      j--;
    }
    A[j+1]=v;
  

    for(p=0;p<N-1;p++) {
      printf("%d ",A[p]);     
    }
    printf("%d",A[p]);
    printf("\n");
}
  return 0;
}



Measured memory_bytes: 2068
n = int(input())
p = 2
ans = 0
while n > 1:
    if p > 10 ** 6:
        ans += 1
        break
    e = 1
    while n % (p ** e) == 0:
        n = n // (p ** e)
        e += 1
        ans += 1
    while n % p == 0:
        n = n // p
    p += 1
    
print(ans)

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

const unsigned int NUM = 200;

int main(){
	std::vector<int> buf;
	std::string str;

	int a,b;

	for(int index = 0; index < NUM; index++){
		std::cin >> a >> b;
		if(std::cin.eof()) break;
		str = std::to_string(a + b);
		buf.push_back(str.length());
	}

	for(auto&& sum : buf){
		std::cout << sum << std::endl;
	}
}

Measured memory_bytes: 3224
import sys
def input(): return sys.stdin.readline().rstrip()

def main():
    n, m = map(int, input().split())
    s = [tuple(map(int, input().split()[1:])) for _ in range(m)]
    p = tuple(map(int, input().split()))

    c = 0
    f = '0' + str(n) + 'b'
    for i in range(2 ** n):
        xi = 'x' + format(i, f)
        for j in range(m):
            if sum([int(xi[k]) for k in s[j]]) % 2 != p[j]:
                break
        else:
            c += 1
    print(c)

if __name__ == '__main__':
    main()

Measured memory_bytes: 3064
import math
x = 0.0
y = 0.0
ang = 0.5*math.pi
while True:
    d, a = map(float, input().split(","))
    if d == 0 and a == 0:
        break
    x += d*math.cos(ang)
    y += d*math.sin(ang)
    ang += math.radians(-a)
print(int(x))
print(int(y))



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

using namespace std;

typedef long long int ll;

const int N = 2e5 + 5;

vector < int > a(N), tmax(4 * N), tmin(4 * N);
int n, k;

void build(int v, int tl, int tr){
  if(tl == tr){
    tmax[v] = a[tl];
    tmin[v] = a[tl];
  }else{
    int tm = (tr - tl) / 2 + tl;
    build(2 * v, tl, tm);
    build(2 * v + 1, tm + 1, tr);
    tmax[v] = max(tmax[2 * v], tmax[2 * v + 1]);
    tmin[v] = min(tmin[2 * v], tmin[2 * v + 1]);
  }
}

int getmin(int v, int tl, int tr, int l, int r){
  if(l > r) return INT_MAX;
  if(tl == l && tr == r) return tmin[v];
  int tm = (tr - tl) / 2 + tl;
  return min(getmin(2 * v, tl, tm, l, min(r, tm)), getmin(2 * v + 1, tm + 1, tr, max(l, tm + 1), r));
}

int getmax(int v, int tl, int tr, int l, int r){
  if(l > r) return INT_MIN;
  if(tl == l && tr == r) return tmax[v];
  int tm = (tr - tl) / 2 + tl;
  return max(getmax(2 * v, tl, tm, l, min(r, tm)), getmax(2 * v + 1, tm + 1, tr, max(l, tm + 1), r));
}

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

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

  if (n == k) {
    cout << 1 << '\n';
    return 0;
  }

  build(1, 1, n);
  int ans = 1;
  for(int i = 2; i <= n - k + 1; i++){
    if(getmin(1, 1, n, i - 1, k + i - 1) == a[i - 1] && getmax(1, 1, n, i - 1, k + i - 1) == a[k + i - 1]) continue;
    ans++;
  }

  int sorted = 0, cnt = 1;
  for(int i = 2; i <= n; i++){
    if(a[i] >= a[i - 1]) cnt++;
    else{
      if(cnt >= k) sorted++;
      cnt = 1;
    }
  }
  if(cnt >= k) sorted++;

  if (sorted > 0) ans = ans - sorted + 1;

  cout << ans << '\n';
}


Measured memory_bytes: 7296
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map.Entry;
import java.util.PriorityQueue;
import java.util.Scanner;

class Main {
    static final int MOD = 1000000007;
    static final int INF = 1 << 30;
    static final int ALF = 26;

    Main() {
        Scanner sc = new Scanner(System.in);
        long ans = 0;
        String s = sc.next();
        System.out.println(s.equals("ABC")?"ARC":"ABC");
    }

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


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

#define rep(i, m, n) for(int(i) = (int)(m); i < (int)(n); ++i)
#define rep2(i, m, n) for(int(i) = (int)(n)-1; i >= (int)(m); --i)
#define REP(i, n) rep(i, 0, n)
#define REP2(i, n) rep2(i, 0, n)
#define all(hoge) (hoge).begin(), (hoge).end()
#define en '\n'
using ll = long long;
using ull = unsigned long long;
template <class T>
using vec = vector<T>;
template <class T>
using vvec = vector<vec<T>>;
typedef pair<ll, ll> P;
constexpr long long INF = 1LL << 60;
constexpr int INF_INT = 1 << 25;
constexpr long long MOD = (ll)1e9 + 7;
// constexpr long long MOD = 998244353LL;
using ld = long double;
static const ld pi = 3.141592653589793L;
typedef vector<ll> Array;
typedef vector<Array> Matrix;

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

struct Edge {
    ll to, rev;
    long double cap;
    Edge(ll _to, long double _cap, ll _rev) {
        to = _to;
        cap = _cap;
        rev = _rev;
    }
};
using Edges = vector<Edge>;
using Graph = vector<Edges>;

void add_edge(Graph &G, ll from, ll to, long double cap, bool revFlag,
              long double revCap) {
    G[from].push_back(Edge(to, cap, (ll)G[to].size()));
    if(revFlag)
        G[to].push_back(Edge(from, revCap, (ll)G[from].size() - 1));
}

void solve() {
    ll n, m;
    cin >> n >> m;
    Graph g(n);
    REP(i, n - 1 + m) {
        ll a, b;
        cin >> a >> b;
        add_edge(g, --b, --a, 1, false, 1);
    }

    Array dp(n, -1);
    Array depth(n, -1);
    auto dfs = [&](auto &&self, int v) -> void {
        if(dp[v] != -1)
            return;
        dp[v] = 0;
        depth[v] = 0;
        for(auto e : g[v]) {
            self(self, e.to);
            if(chmax(depth[v], depth[e.to] + 1)) {
                dp[v] = e.to + 1;
            }
        }
    };
    REP(i, n) {
        dfs(dfs, i);
        cout << dp[i] << en;
    }
}

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

    solve();
    // ll t;cin>>t;REP(i,t) solve();

    return 0;
}


Measured memory_bytes: 15784
k = int(input())
nums = [i for i in range(1,10)]
tmp = [i for i in range(1,10)]
if k <= 10:
    print(tmp[k-1])
    exit()
for _ in range(10**2):
    tmpp = []
    for num in tmp:
        for i in range(-1,2):
            if 10 > num%10+i >= 0 and (num*10 + (num%10+i))!= nums[-1] and abs(num%10 - (num%10+i)) <= 1:
                nums.append(num*10+(num%10+i))
                tmpp.append(num*10+(num%10+i))
                if len(nums) == k+1:
                    print(nums[k-1])
                    exit()
    tmp = tmpp

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

#define INF 1e9+7
#define pf2 pop_front
#define pb2 pop_back
#define pb push_back
#define pf push_front
#define fi first
#define se second
#define sz size
#define eps 1e-7
#define fod find_by_order
#define fastio ios::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL);
#define ofk order_of_key
#define val(x) cout << "Value dari "<< #x << " adalah " << x  << "\n"
#define tr tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update>
typedef long long ll;
using namespace __gnu_pbds;
using namespace std;

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

void readf(string x){
	freopen((x+".in").c_str(),"r",stdin);
	freopen((x+".out").c_str(),"w",stdout);
}

void pr(string x){
	freopen((x+".in").c_str(),"w",stdout);
}


int read()
{
	bool min = 0;
	int  result = 0;
	char ch;
	ch = getchar();
	while(1)
	{
		if(ch == '-') break;
		if(ch >='0' && ch <= '9') break;
		ch = getchar();
	}
	if(ch == '-') min = 1;else result = ch-'0';
	while(1)
	{
		ch =getchar();
		if(ch< '0' || ch>'9') break;
		result = result * 10 + (ch-'0');
	}
	if(min) return -result;
	return result;
}
//Reynaldo's Template

int main(){
	ll N,M;
	cin >> N >> M;
	ll ans = min(N,M/2);
	N -= ans;
	M -= 2*ans;
	cout << ans + M/4 << "\n";
}



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

int main() {
  string A;
  cin >> A;
  
  if(A == "a" || A == "i" || A == "u" || A == "e" || A == "o"){
 cout << "vowel" << endl;
  }

  else{
    cout << "consonant" << endl;
  }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
////////////////////////////////////////////////
int main()
{
    int n;
    cin >> n;
    vector<pair<int, int>> a(n);
    rep(i, n)
    {
        int ai;
        cin >> ai;
        a[i] = make_pair(ai, i);
    }
    sort(a.begin(), a.end());
    for (auto i : a)
    {
        cout << i.second + 1;
        if (i.first != n)
            cout << " ";
    }
    cout << endl;
}

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

int main(){
  int a=0,b=0,c=0,x=0,n=0,m=0;
  bool flag = false;
  string s;
  char ch;
  
  cin >> n;
  cin >> m;

  vector<int> v(m,0);
  vector<string>ss(m);
  vector<bool> boo(n,false);
  
  for( int i=0;i<m;i++){
   cin >> v.at(i) >> ss.at(i); 
  }
  
  int ac = 0;
  vector<int> wa(n,0);
  int wa_sum=0;
  
  for(int i=0;i<m;i++){
    if(ss.at(i) == "WA" && boo.at(v.at(i)-1) == false){
      wa.at(v.at(i)-1) += 1;
    }else if(ss.at(i) == "AC" && boo.at(v.at(i)-1) == false){
	  ac++;
	  boo.at(v.at(i)-1) = true;
    }
    
  }
  
  for(int i=0;i<n;i++){
    if(boo.at(i) == true){
	    wa_sum += wa.at(i);
    }
  }
//  cin >> a;
//  cin >> b;
//  cin >> c;
//  cin >> x;
//  cin >> ch;

  
  cout << ac << ' ' << wa_sum << endl;
}

Measured memory_bytes: 6528
#include <stdio.h>

int main(void) {

  int n,a,b,c,d;
  scanf("%d %d %d %d %d", &n, &a, &b, &c, &d);
  char s[n+1];
  scanf("%s", s);
  int sunuke = a-1;
  int funuke = b-1;
  if (c < d) {
    for (int i = funuke+2; i < d-1; i++) {
      if (s[i] == '#' && s[i-1] == '#') {
        printf("No\n");
        return 0;
      }
    }
    for (int i = sunuke+2; i < c-1; i++) {
      if (s[i] == '#' && s[i-1] == '#') {
        printf("No\n");
        return 0;
      }
    }
    printf("Yes\n");
    return 0;
  }
  int flag = 0;
  while (1) {
    sunuke++;
    if (sunuke >= n) {
      printf("No\n");
      return 0;
    }
    if (s[sunuke] == '#') {
      sunuke++;
      if (sunuke >= n || s[sunuke] == '#') {
        printf("No\n");
        return 0;
      } else if (sunuke == funuke) {
        funuke++;
        if (funuke >= n) {
          printf("No\n");
          return 0;
        }
        if (s[funuke] == '#') {
          funuke++;
          if (funuke >= n || s[funuke] == '#') {
            printf("No\n");
            return 0;
          }
        }
      }
    } else if (sunuke == funuke) {
      if (sunuke+1 >= n) {
        printf("No\n");
        return 0;
      }
      if (s[sunuke+1] != '#') {
        sunuke++;
        break;
      } else {
        funuke += 2;
        if (funuke >= n || s[funuke] == '#') {
          printf("No\n");
          return 0;
        }
      }
    }
    if (funuke > d-1) {
      printf("No\n");
      return 0;
    }
  }
  if (sunuke > c-1 || funuke > d-1) {
    printf("No\n");
    return 0;
  }
  for (int i = sunuke+2; i < c-1; i++) {
    if (s[i] == '#' && s[i-1] == '#') {
      printf("No\n");
      return 0;
    }
  }
  for (int i = funuke+2; i < d-1; i++) {
    if (s[i] == '#' && s[i-1] == '#') {
      printf("No\n");
      return 0;
    }
  }
  printf("Yes\n");

  return 0;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
#define FASTIO ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define ll long long
#define br cout<<"\n";
#define ull unsigned long long int
#define ld long double
#define loop1(i,a,b) for(int i=a;i<b;i++)
#define loop2(i,a,b) for(int i=a;i<=b;i++)
#define loop3(i,a,b) for(int i=a;i>b;i--)
#define loop4(i,a,b) for(int i=a;i>=b;i--)
#define all(a) a.begin(),a.end()
#define test(t) ll t; cin >> t; while(t--)
#define pb push_back
#define mp make_pair
#define pii pair<int,int>
#define pll pair<ll,ll>
#define vll vector<ll>
#define fi first
#define se second
#define line cout<<"\n********************************************\n";
///////////////////////////////////////////////////////////////////////////////////////////////////////
 ll MI( ll a , ll mod) // mod inverse (x/y) % mod --> y == a.. multiply result with x..
 {
     return ((a %= mod) < 2) ? a : ((1 - (MI(mod % a , a) * mod))/a+mod);
 }
 bool isprime(ll n);
 ll power(ll x, ll y, ll mod);
 ll fact( ll n );
 ll nCrMod(ll n, ll r, ll p);
///////////////////////////////////////////////////////////////////////////////////////////////////////
//---------------------------------------------
// H B L O R D 7 8 7
// Solution for Problem Code : 
// Contest : 
//--------------------------------------------

signed main() 
{
    FASTIO
     ll n,d;
     cin >> n >> d;
     ll x1,y1;
     int count = 0;
     while(n--)
     {
         cin >> x1 >> y1;
         if ( sqrt(x1*x1 + y1*y1) <= d )
         count++;
     }
     cout << count << "\n";
}
///////////////////////////////////////////////////////////////////////////////////////////////////////
//--------------------------------------------
bool isprime(ll n)
 {
     for(ll i = 2 ; i*i<=n ; i++)
        if( n % i == 0)
            return false;
     return true;
 }
 //--------------------------------------------
 ll fact( ll n )
{
 if( n == 1 ) return n;
 else return n*fact(n-1);
}
 //--------------------------------------------
ll power(ll x, ll y, ll mod)  // (x ^ y) % mod...
{  
    ll result = 1; 
    x = x % mod; 
    if (x == 0) return 0;
    while (y > 0)  
    {  
        if (y & 1) result = (result * x) % mod;  
        y = y >> 1; // y = y / 2
        x = (x * x) % mod;  
    }  
    return result;  
}  
 //--------------------------------------------
ll nCrMod(ll n, ll r, ll p) 
{ 
    if (r == 0) 
        return 1; 
    ull fac[n + 1]; 
    fac[0] = 1; 
    for (int i = 1; i <= n; i++) 
        fac[i] = (fac[i - 1] * i) % p; 
    return (((fac[n] * MI(fac[r], p)) % p) * (MI(fac[n - r], p) % p)) % p; 
}

Measured memory_bytes: 3672
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <cmath>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> plglg;
typedef pair<double, ll> pdlg;
typedef tuple<int, int, int> tiii;
typedef tuple<ll, ll, ll> tlglglg;
typedef tuple<double, double, double> tddd;

int main(void){
  int N;
  cin >> N;
  if(N == 1){
    cout << "Hello World" << endl;;
  } else {
    int a,b;
    cin >> a >> b;
    cout << a + b << endl;
  }

  return 0;
}

Measured memory_bytes: 384
from fractions import gcd

N, M = map(int, input().split())
A = [int(i) // 2 for i in input().split()]  

A_lcm = 1
for i in range(N):
    A_lcm *= A[i] // gcd(A_lcm, A[i])
    
for i in A:
    if A_lcm // i % 2 == 0:
        print(0)
        exit()

print((M // A_lcm + 1) // 2)

Measured memory_bytes: 16320
#include <stdio.h>

int main(void)

{

  int ai,n,i,b,s;

  double w;


  b=-1000000;


  s=1000000;


  scanf("%d",&n);

  for(i=0;i<n;i++)


  {


    scanf("%d",&ai);


    if(ai<s)


    {


      s=ai;


    }


    if(b<ai)


    {


      b=ai;


    }


    w=w+ai;


  }


  printf("%d %d %0.lf\n",s,b,w);


  return 0;


}

Measured memory_bytes: 636
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include <utility>


using namespace std;

int main(){
    int N, A, B;
    cin >> N >> A >> B;
    if(A*N > B){
        cout << B;
    }
    else{
        cout << A * N;
    }

}

Measured memory_bytes: 256
import java.math.BigInteger;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		int k = sc.nextInt();
		char[] s = sc.next().toCharArray();
		sc.close();

		int mod = 1000000007;
		int n = s.length;
		NCR ncr = new NCR(n + k, mod);
		long ans = 0;
		for (int i = n; i <= n + k; i++) {
			long val1 = ncr.calc(i - 1, n - 1);
			long val2 = power(25, i - n, mod);
			long val3 = power(26, k - (i - n), mod);
			long val = val1 * val2 % mod * val3 % mod;
			ans += val;
			ans %= mod;
		}
		System.out.println(ans);
	}

	static class NCR {
		long[] p, pi;
		int m;

		public NCR(int n, int mod) {
			n++;
			m = mod;
			p = new long[n];
			pi = new long[n];
			p[0] = 1;
			pi[0] = 1;
			for (int i = 1; i < n; i++) {
				p[i] = p[i - 1] * i % m;
			}
			pi[n - 1] = BigInteger.valueOf(p[n - 1])
					.modInverse(BigInteger.valueOf(m)).longValue();
			for (int i = n - 1; i > 1; i--) {
				pi[i - 1] = pi[i] * i % m;
			}
		}

		public long calc(int n, int r) {
			if (n < r) return 0;
			return p[n] * pi[r] % m * pi[n - r] % m;
		}
	}

	static long power(long x, long n, int m) {
		if (n == 0) {
			return 1;
		}
		long val = power(x, n / 2, m);
		val = val * val % m;
		if (n % 2 == 1) {
			val = val * x % m;
		}
		return val;
	}
}


Measured memory_bytes: 75224
#include <stdio.h>
#include <math.h>
#include <iostream>
#include <algorithm>
#include <vector>
#include <numeric>
#include <string>
#include <map>
#include <stack>
using namespace std;
typedef long long int lli;
#define urept(soeji, start, n) for (int soeji = start; soeji < n; soeji++)
#define drept(soeji, start, n) for (int soeji = start; soeji > n; soeji--)

bool IsPrime(int num)
{
    if (num < 2)
        return false;
    else if (num == 2)
        return true;
    else if (num % 2 == 0)
        return false; // 偶数はあらかじめ除く

    double sqrtNum = sqrt(num);
    for (int i = 3; i <= sqrtNum; i += 2)
    {
        if (num % i == 0)
        {
            // 素数ではない
            return false;
        }
    }

    // 素数である
    return true;
}

int main(void)
{
    int Q;
    cin >> Q;
    int l[Q], r[Q];
    for (int i = 0; i < Q; i++)
    {
        cin >> l[i] >> r[i];
    }
    int sum[100002];
    fill(sum, sum + 100002, 0);
    for (int i = 1; i <= 100001; i++)
    {
        if (i % 2 == 1)
        {
            if (IsPrime(i) == true && IsPrime((i + 1) / 2) == true)
            {
                sum[i] = sum[i - 1] + 1;
            }
            else
            {
                sum[i] = sum[i - 1];
            }
        }
        else
        {
            sum[i] = sum[i - 1];
        }
    }
    for (int i = 0; i < Q; i++)
    {
        cout << sum[r[i]] - sum[l[i] - 1] << endl;
    }
    return 0;
}


Measured memory_bytes: 4792
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define lvector vector<ll>
#define cvector vector<char>
#define svector vector<string>
#define lque queue<ll>
#define lpque priority_queue<ll>
#define dlpque priority_queue<ll,lvector,greater<ll>>
#define P pair<ll,ll>
#define ALL(a) a.begin(),a.end()
#define RALL(a) a.rbegin(),a.rend()
#define rep(i,n) for(ll i=0; i<n; ++i)
#define print(a) cout << (a) << endl

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  ll x1,y1,x2,y2;cin>>x1>>y1>>x2>>y2;
  ll x=x2-x1,y=y2-y1;
  printf("%lld %lld %lld %lld\n",x2-y,y2+x,x1-y,y1+x);
  return 0;
}

Measured memory_bytes: 3748
#include <algorithm>
#include <iostream>
#include <cstring>
#include <bitset>
#include <cstdio>
using namespace std;

inline int getint()
{
	static char c;
	while ((c = getchar()) < '0' || c > '9');

	int res = c - '0';
	while ((c = getchar()) >= '0' && c <= '9')
		res = res * 10 + c - '0';
	return res;
}

const int MaxN = 400;
const int MaxM = 100000;

int n, m;
int ex[MaxM], ey[MaxM];

bool valid[MaxN];
bitset<MaxN> live[MaxN];

int main()
{
	cin >> n >> m;
	for (int i = 0; i < m; ++i)
		ex[i] = getint() - 1, ey[i] = getint() - 1;

	for (int i = 0; i < n; ++i)
	{
		valid[i] = true;

		live[i].set(i);
		for (int j = m - 1; j >= 0; --j)
		{
			int u = ex[j], v = ey[j];
			if (live[i][u] && live[i][v])
			{
				valid[i] = false;
				break;
			}

			if (live[i][u])
				live[i].set(v);
			else if (live[i][v])
				live[i].set(u);
		}
	}

	int res = 0;
	for (int i = 0; i < n; ++i)
	{
		if (!valid[i])
			continue;

		for (int j = i + 1; j < n; ++j)
		{
			if (!valid[j])
				continue;
			if ((live[i] & live[j]).none())
				++res;
		}
	}

	cout << res << endl;

	return 0;
}

Measured memory_bytes: 1024
import fractions
n = int(input())
a = list(map(int, input().split()))
b = [0] * (n + 1)
c = [0] * (n + 1)
for i in range(len(a)):
    if i == 0:
        b[i+1] = a[i]
        c[-i-2] = a[-i-1]
    else:
        b[i+1] = fractions.gcd(a[i], b[i])
        c[-i-2] = fractions.gcd(a[-i-1], c[-i-1])
m_gcd = 0
for i in range(len(b)-1):
    m_gcd = max(fractions.gcd(c[i+1], b[i]), m_gcd)
print(m_gcd)


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

int main(){
  int N;
  cin >> N;
  vector<int> L(N);
  for(int i=0;i<N;i++){
    cin >> L[i];
  }
  sort(L.begin(),L.end());
  int count = 0;
  for(int j=0;j<N;j++){
    for(int k=j+1;k<N;k++){
      for(int l=k+1;l<N;l++){
        if(L[j]<L[k]+L[l]&&L[k]<L[j]+L[l]&&L[l]<L[j]+L[k]){
          count ++;
        }
      }
    }
  }
  cout << count << endl;
  return 0;
}

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

int main() {
    int n, m, a, b;
    cin >> n >> m;
    vector<vector<int>> city(n);
    rep(i, m) {
        cin >> a >> b;
        city.at(a - 1).push_back(b - 1);
        city.at(b - 1).push_back(a - 1);
    }
    rep(i, n) cout << city.at(i).size() << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(void){
    // Your code here!
    int N,X;
    cin>>N>>X;
    
    vector <int> m(N);
    int sum=0, tmin=1000000;
    
    for(int i=0;i<N;i++){
        cin>>m[i];
        sum+=m[i];
        tmin = min(tmin, m[i]);
    }
    
    
    if(X-sum < 0) cout<<0<<endl;
    else{
        X=X-sum;
        int ct=0;
        if(X>=tmin){ 
            while(X>0){
                X-=tmin;
                if(X<0) break;
                ct++;
            }
        }
        
        cout<<N + ct<<endl;
    }    
    
  
}


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

int main() {
  int n;
  cin >> n;
  vector<int> a(n);
  rep(i, n) cin >> a[i];
  sort(a.begin(), a.end());
  int x = a[n - 1], y;
  int min_v = 1001001001;
  rep(i, n) {
    int tmp = abs((x + 1) / 2 - a[i]);
    if (min_v > tmp) {
      y = a[i];
      min_v = tmp;
    }
  }
  cout << x << " " << y << endl;
  return 0;
}


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

#define en "\n"
#define INF (int) 9e18
#define HELL (int) (1e9 + 7)
#define int long long
#define double long double
#define uint unsigned long long
#define pii pair<int, int>
#define pb push_back
#define fs first
#define sc second
#define size(a) (int) a.size()
#define deb(x) cerr << #x << " => " << x << en
#define deba(x) cerr << #x << en; for (auto a : x) cerr << a << " "; cerr << en;
#define debp(x) cerr << #x << en; for (auto a : x)cerr<<"("<<a.fs<<", "<<a.sc<<") "; cerr << en;
#define debm(x) cerr << #x << en; for (auto a : x){for(auto b : a) cerr << b << " "; cerr << en;}
#define getMat(x, n, m, val) vector<vector<int>> x(n, vector<int> (m, val))
#define fastio ios_base :: sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr);
#define pout cout << fixed << setprecision(10)
int fastpow(int a, int b, int m = HELL) { int res = 1; a %= m;
while (b > 0) { if (b & 1) res = (res * a) % m; a = (a * a) % m; b >>= 1; } return res;}
#define inv(a) fastpow(a, HELL - 2)

int32_t main() { fastio;
	int s, w; cin >> s >> w;
	if (w >= s) {
		cout << "unsafe" << endl;
	} else {
		cout << "safe" << endl;
	}
	return 0;
}


Measured memory_bytes: 3652
#include <bits/stdc++.h>
using namespace std;
#define r(i,n) for(auto i=0;i<n;i++)
#define s(c) static_cast<int>((c).size())

int S(int N){
	return N < 10 ? N : N%10 + S(N/10);
}

int main() {
	int N;
	cin >> N;
	cout << (N%S(N) == 0 ? "Yes" : "No") << endl;
	return 0;
}

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

using namespace std;

int main() {
	int l;
	vector<int> a;
	while (cin >> l) {
		a.push_back(l);
	}
	for (int i = 1; i < a.size(); i++) {
		cout << "Case " << i << ": " << a[i - 1] << endl;
	}
	return 0;
}


Measured memory_bytes: 3132
#include <iostream>
#include <cstdlib>
#include <time.h>
#include <algorithm>
#include <map>
#include <queue>
#include <stack>
#include <vector>
#include <array>
#include <string>
#include <iomanip>
#include <cstring>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define mp make_pair
#define eb emplace_back
#define f first
#define s second
#define sz(x) (ll)x.size()
#define lnt(s) (ll)s.length()
#define mt(cnt) cnt.empty()
using namespace std;
using namespace __gnu_pbds;

typedef long long int ll;
typedef tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update> osSet;

using pll = pair<ll, ll>;
using pl = pair<ll, pll>;
using tll = tuple<ll, ll, ll>;

const ll maxN = 1e5;
const ll INF = 1e17;
const ll MOD = 1e9 + 7;

ll xs[] = {-1, 1, 0, 0, -1, 1, 1, -1};
ll ys[] = {0, 0, -1, 1, -1, 1, -1, 1};

ll segtree[maxN << 2];
ll lazy[maxN << 2];
ll A[maxN];

inline ll left(ll x){
	return x << 1;
}

inline ll right(ll x){
	return (x<<1) + 1;
}

ll func(ll x){
	return (x*(x+1))/2;
}

ll _pow(ll b, ll p){
	if(p == 0) return 1;
	if(p == 1) return b;
	ll exB = b*b;
	if(p&1) return b*_pow(exB, p/2);
	return _pow(exB, p/2);
}

int main(){
	cin.sync_with_stdio(false);
	cin.tie(0);
	string s;
	cin >> s;
	cout << "2018";
	for(ll i=4; s[i]; i++)
		cout << s[i];
	return 0;
}

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

using namespace std;

#define debug(n) cerr << #n << ':' << n << endl;
#define dline    cerr << __LINE__ << endl;

using ll = long long;
template<class T, class U> using P = pair<T,U>;
template<class T> using Heap = priority_queue<T>;
template<class T> using heaP = priority_queue<T,vector<T>,greater<T>>;
template<class T,class U> using umap = unordered_map<T,U>;
template<class T> using uset = unordered_set<T>;

template<class T>
bool ChangeMax(T&a,const T&b){
  if(a >= b) return false;
  a = b;    return true;
}

template<class T>
bool ChangeMin(T&a,const T&b){
  if(a <= b) return false;
  a = b;    return true;  
}

template<class T, size_t N, class U>
void Fill(T (&a)[N], const U&v){
    fill((U*)a,(U*)(a+N),v);
}

template<class T>
istream& operator >> (istream&is, vector<T>&v){
  for(auto&e:v)is >> e;
  return is;
}

int main(){
  int n; cin >> n;
  vector<ll> v(n+1);
  for(ll i = 1; i <= 100; ++i){
    for(ll j = 1; j <= 100; ++j){
      for(ll k = 1; k <= 100; ++k){
	ll x = i*i+j*j+k*k+i*j+i*k+j*k;
	if(x <= n)v[x]++;
	else break;
      }
    }
  }
  for(int i = 1; i <= n; ++i){
    cout << v[i] << endl;
  }
  return 0;
}


Measured memory_bytes: 3496
//abc091_b.cpp
//Sun Mar 25 15:19:05 2018

#include <iostream>
#include <string>
#include <queue>
#include <unordered_map>
#include <vector>
using namespace std;

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

	unordered_map<string, int> blue;

	string s;

	for (int i=0;i<n;i++){
		cin >> s;
		auto itr = blue.find(s);
		if (itr != blue.end()){
			blue[s]++;
		}else{
			blue[s] = 1;
		}
	}

	int m;
	cin >> m;

	string t;

	for (int i=0;i<m;i++){
		cin >> t;
		auto itr = blue.find(t);
		if (itr != blue.end()){
			blue[t]--;
		}else{
			blue[t] = -1;
		}
	}
	int ans = 0;

	for (auto itr = blue.begin(); itr != blue.end(); ++itr){
		if (ans < itr->second){
			ans = itr->second;
		}
	}

	cout << ans << endl;
}

Measured memory_bytes: 256
import java.util.Scanner;


public class Main {
	
	public static int[][] money = new int[][]
			{
				{	0,	300,	500,	600,	700,	1350,	1650},
				{	0,	0,		350,	450,	600,	1150,	1500},
				{	0,	0,		0,		250,	400,	1000,	1350},
				{	0,	0,		0,		0,		250,	850,	1300},
				{	0,	0,		0,		0,		0,		600,	1150},
				{	0,	0,		0,		0,		0,		0,		 500},
			};
	
	public static int[][] dist = new int[][]
			{
				{	0,	6,	13,	18,	23,	43,	58},
				{	0,	0,	7,	12,	17,	37,	52},
				{	0,	0,	0,	5,	10,	30,	45},
				{	0,	0,	0,	0,	5,	25,	40},
				{	0,	0,	0,	0,	0,	20,	35},
				{	0,	0,	0,	0,	0,	0,	15},
			};
	
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		while(true){
			final int start = sc.nextInt() - 1;
			
			if(start == -1){
				break;
			}
			
			final int start_h = sc.nextInt();
			final int start_m = sc.nextInt();
			final int start_t = start_h * 60 + start_m;
			
			final int end = sc.nextInt() - 1;
			final int end_h = sc.nextInt();
			final int end_m = sc.nextInt();
			final int end_t = end_h * 60 + end_m;
			
			int cost = 0;
			if(!(start_t < (17 * 60 + 30) && end_t > (19 * 60 + 30))){
				if(dist[start][end] <= 40){
					cost = (int) (Math.ceil((money[start][end] / (2.0 * 50)))) * 50;
				}else{
					cost = money[start][end];
				}
			}else{
				cost = money[start][end];
			}
			
			System.out.println(cost);
		}
		
	}

}

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

int main(){

    int n;
    int ans=0;
    cin >> n;
    for(int i=1;i<=n;i++){
        string t=to_string(i);
        if(t.size()%2==1){
            ans++;
        }
    }

    cout << ans <<endl;

    return 0;
}

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

int main() {
	
	int n; cin >>n;
	const  int p = 111;
	int tmp;
	for (int i = 1; i <= 9; i++) {
		if ( n <= i * p) {
			tmp = i;
			break;
		}
	}
	cout << tmp * p << endl;
	return 0;
}

Measured memory_bytes: 3572
let () =
  let (w, n) = Scanf.scanf "%d %d " (fun w n -> w, n) in
  let z = Array.init w (fun i -> i + 1) in
  for _ = 0 to n - 1 do
    let (a, b) = Scanf.scanf "%d,%d " (fun a b -> a, b) in
    let (a, b) = (a - 1, b - 1) in
    let t = z.(a) in
    z.(a) <- z.(b);
    z.(b) <- t;
  done;
  Array.iter (fun e-> Printf.printf "%d\n" e) z

Measured memory_bytes: 2328
using System;

namespace AtCoder
{
    class Program
    {
        static void Main(string[] args)
        {
            int N = int.Parse(Console.ReadLine());
            int result = 0;
            for (int i = 1; i <= N; i++)
            {
                int count = 0;
                if (i % 2 == 1)//奇数判定
                {
                    for (int j = 1; j <= i; j++)
                    {
                        if (i % j == 0)
                        {
                            count++;
                        }
                    }
                    if (count == 8)
                    {
                        result++;
                    }
                }
            }

            Console.WriteLine(result);
        }
    }
}

Measured memory_bytes: 11092
//QWsin
#include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
#define rep(i,x,y) for(int i=x;i<=y;++i)
#define out(i,u) for(int i=first[u];i!=-1;i=nxt[i])
#define repvc(i,vc) for(int i=0,Sz=vc.size();i<Sz;++i)
using namespace std;
inline int read()
{
	char ch=getchar();int ret=0,f=1;
	while(ch<'0' || ch>'9') {if(ch=='-')f=-1;ch=getchar();}
	for(;ch>='0' && ch<='9';ch=getchar()) ret=ret*10+ch-'0';
	return ret*f;
}

inline void print(string name,int *arr,int len){
	rep(i,1,len) printf("%s[%d]=%d\n",name.c_str(),i,arr[i]);puts("");
}
inline void print(string name,int a){
	printf("%s=%d\n",name.c_str(),a);puts("");
}

typedef long long ll;
const int INF=1<<30;

const int maxn=100+10;

char s[4][maxn];

int main()
{
	int n;cin>>n;
	rep(i,1,3) scanf("%s",s[i]+1);
	
	int sum=0;
	rep(i,1,n)
	{
		if(s[1][i]==s[2][i] && s[2][i]==s[3][i]) ;
		else if(s[1][i]==s[2][i] || s[2][i]==s[3][i] || s[3][i]==s[1][i]) ++sum;
		else sum+=2;
	}
	cout<<sum<<endl;
	return 0;
}




Measured memory_bytes: 256
/**
SXR0aXAkI0JwbXptI3FhI3Z3I293bCNqY2IjUG0jMCNicG0jVHFkcXZvLyNCcG0jQW10bjBhY2phcWFicXZvLyNNYm16dml0MSNWdyNhdGN1am16I2tpdiNhbXF9bSNQcXUjVnd6I0F0bW14MSNQcWEjaXptI2l0dCNicHF2b2EjUXYjYnBtI3BtaWRtdmEjaXZsI3d2I21pemJwMSNFcHcjcWEjYnBtem0ja2l2I3F2Ym16a21sbSNRdiNQcWEjeHptYW12a20jbXtrbXhiI0lhI3BtI3htenVxYmJtYnBHI1BtI3N2d2VtYnAjRXBpYiMraXh4bWl6bWJwI2J3I1BxYSNrem1pYmN6bWEjSWEsI0ptbnd6bSN3eiNJbmJteiN3eiNKbXBxdmwjYnBtdTEjVnd6I2FwaXR0I2JwbXwja3d1eGlhYSNJY29wYiN3biNwcWEjc3Z3ZXRtbG9tI017a214YiNpYSNQbSNlcXR0bWJwMSNQcWEjYnB6d3ZtI2x3YnAjbXtibXZsI1dkbXojYnBtI3BtaWRtdmEjSXZsI3d2I21pemJwLyNpdmwjUG0jbm1tdG1icCNWdyNuaWJxb2NtI3F2I29jaXpscXZvI0l2bCN4em1hbXpkcXZvI2JwbXUvI053eiNQbSNxYSNicG0jVXdhYiNQcW9wMSNCcG0jQWN4em11bSMrcXYjb3R3enwsMQ==
*/
#include <cstring>
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <queue>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <cassert>

#define F first
#define S second
#define endl '\n'
#define deb(x) cout<<#x<<' '<<x<<endl;
#define pb push_back

#ifdef IZI_KATKA
#define int __int64_t
#else
#define int __int64_t
#endif

const long long MOD = 1e9 + 7;
const long long MAXN = 1e6 + 1;
using namespace std;

typedef long long ll;

long long readInt() {
    bool minus1 = false;
    long long result = 0;
    char ch;
    ch = getchar();
    while (true) {
        if (ch == '-') break;
        if (ch >= '0' && ch <= '9') break;
        ch = getchar();
    }
    if (ch == '-') minus1 = true; else result = ch-'0';
    while (true) {
        ch = getchar();
        if (ch < '0' || ch > '9') break;
        result = result*10 + (ch - '0');
    }
    if (minus1)
        return -result;
    else
        return result;
}

int G(int x, ll l) {
	return (x >> l) & 1;
}

 main() {
	#ifdef IZI_KATKA
	assert(freopen("input", "r", stdin));
    assert(freopen("output", "w", stdout));
    #endif
    ll L = readInt(), R = readInt();
    if (L == R) {
    	return cout << 1, 0;
    }
    ll z = 0;
    for (int i = 60; i >= 0; i--) {
		if (G(L, i) != G(R, i)) {
			z = i;
	    	break;
		} 	
    }
	L %= (1ll << z+1);
	R %= (1ll << z+1);
	ll kek = R ^ (1ll << z);
	ll y = 0;
	for (int i = 0; i <= 60; i++) {
		if ((1ll << i) - 1 >= kek) {
			y = i;
			break;
		}
	}
	ll K = (1ll << y) - 1;
	if (K < L) {
		cout << 2ll * ((1ll << z) - L) + (1ll << y);		
	} else {
		cout << (1ll <<z+1) - L; 
	}
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
//#include <algorithm>
//#include <cstdio>
//#include <functional>
#include <iostream>
//#include <cfloat>
//#include <climits>
//#include <cstdlib>
//#include <cstring>
#include <cmath>
//#include <map>
//#include <queue>
//#include <set>
//#include <sstream>
//#include <stack>
#include <string>
//#include <time.h>
#include <vector>
//#include <random>
//#include <unordered_set>
//#include <complex>
//#include <string.h>

#define rt0 return 0
#define rep(i,n) for(int i=0;i<n;i++)
#define LL long long
#define pli pair<long long,int>
#define pb push_back
#define fi first
#define se second
#define mpr make_pair

using namespace std;

const LL MOD=1e9+7;

bool sot(LL a,LL b)
{
	return a>b;
}

int main()
{
	LL n,m;
	LL mx1=-1;
	cin>>n>>m;
	vector <LL> x(n),y(n),z(n);
	vector <LL> mx2(n);
	rep(i,n) cin>>x[i]>>y[i]>>z[i];
	for(LL j=-1;j<=1;j+=2)
		for(LL k=-1;k<=1;k+=2)
			for(LL p=-1;p<=1;p+=2)
			{
				rep(i,n)
				{
					LL tmp=x[i]*j+y[i]*k+z[i]*p;
					mx2[i]=tmp;
				}
				sort(mx2.begin(),mx2.end(),sot);
				LL sum=0;
				rep(i,m)
				{
					sum+=mx2[i];
				}
				mx1=max(mx1,sum);
			}
	cout<<mx1<<endl;
  rt0;
}

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

signed main(){
    string s, t;
    cin>>s>>t;
    int ans=1e9;
    for(int i=0;i+t.length()<=s.length();i++){
        int cnt=0;
        for(int j=i;j<i+t.length();j++){
            if(s[j]!=t[j-i])cnt++;
        }
        ans=min(ans,cnt);
    }
    cout<<ans<<endl;
}

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

using namespace std;

int main() {
  int n = 0;
  cin >> n;
  vector<long long> a(n);
  for (int i=0; i<n; i++) {
    cin >> a.at(i);
  }
  sort(a.begin(), a.end());
  vector<long long> b(n);
  b.at(0) = a.at(0);
  for (int i=1; i<n; i++) {
    b.at(i) = b.at(i-1) + a.at(i);
  }
  for (int i=n-1; i>0; i--) {
    if (b.at(i-1) * 2 < a.at(i)) {
      cout << n - i << endl;
      return 0;
    }
  }
  cout << n << endl;
  return 0;
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
#define ll long long
int main()
{
    ll i,j,k,l,m,n,a,b,c,d,cnt=0;
    long double x,y,z;
    cin>>x>>y;
    z=x*y;
    a=z;
    cout<<a<<endl;

}


Measured memory_bytes: 3732
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <vector>

using namespace std;
#define PB push_back
#define MP make_pair
#define REP(i,n) for(int i=0;i<(n);i++)
int main(){
    string a,b,c;
    cin>>a>>b>>c;
    if(a[a.size()-1]==b[0]&&b[b.size()-1]==c[0])cout<<"YES"<<endl;
    else cout<<"NO"<<endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
 
class Cube{
public:
 int f[6];
 Cube(){}
 void roll_z(){ roll(1,2,4,3);}
 void roll_y(){ roll(0,2,5,3);}
 void roll_x(){ roll(0,1,5,4);}
 void roll(int i,int j,int k,int l){
   int t=f[i]; f[i]=f[j]; f[j]=f[k]; f[k]=f[l]; f[l]=t;
 }
};
 
int getRight( Cube c1,int f1,int f2 ){
 for(int i=0;i<6;i++){
   for(int j=0;j<4;j++){
     if( c1.f[0]==f1 && c1.f[1]==f2 ) return c1.f[2];
     c1.roll_z();
   }
   if( i%2 == 0 )c1.roll_y();
   else c1.roll_x();
 }
 return -1;
}
 
int main(){
 Cube c;
 int f1,f2;
 for(int i=0;i<6;i++)cin>>c.f[i];
 int q; cin>>q;
 for(int i=0;i<q;i++){
   cin>>f1>>f2;
   cout<<getRight(c,f1,f2)<<endl;
 }
 return 0;
}


Measured memory_bytes: 3056
#!/usr/bin/env python

from collections import deque
import itertools as it
import sys
import math

sys.setrecursionlimit(10000000)

for line in sys.stdin:
    n = int(line)
    ans = 1
    for i in range(n / 2 - 1):
        ans = ans * 3 + 1
    if n == 1:
        ans = 1
    elif n % 2 == 1:
        ans = ans * 4 + 1
    else:
        ans = ans * 2
    print ans


Measured memory_bytes: 5016
#include<bits/stdc++.h>
using namespace std;
#define LL long long int

LL p5(LL x) {
    return x*x*x*x*x;
}

int main() {
    LL X;
    cin >> X;

    for (LL B = -100; ; B++) {
        LL target = p5(B) + X;
        for (LL A = -100; p5(A) <= target; A++) {
            if (p5(A) == target) {
                cout << A << " " << B << endl;
                return 0;
            }
        }
    }
}


Measured memory_bytes: 3600
#include <iostream>
#include <string.h>
#include <math.h>
#include <queue>
#include <algorithm>
#include <stdlib.h>
#include <map>
#include <set>
#include <stdio.h>
#include <time.h>
#include<complex>
#include <vector>
using namespace std;
typedef long long ll;
#define lowBit(x) ((x)&(-x))
#define rep(i,a,n) for (ll i=a;i<=n;i++)
#define per(i,a,n) for (ll i=n;i>=a;i--)
#define pb push_back
#define SZ(x) ((ll)(x).size())
typedef vector<ll> VI;
const ll N=1e6+5;
ll gcd(ll a,ll b) { return b?gcd(b,a%b):a;}
ll readn(){ll sum=0,f=1;char ch=getchar();
while(ch>'9'||ch<'0'){if(ch=='-')f=-1;ch=getchar();}
while(ch>='0'&&ch<='9'){sum=sum*10+(ch-'0');
ch=getchar();}return sum*f;}


const double epx=1e-7; 
typedef complex<double> kk;
int op(kk a,kk b,kk c)
{
    b-=a,c-=a,a=c*conj(b);
    if(a.imag()>epx) return 1;
    if(a.imag()<-epx) return -1;
    if(a.real()<-epx) return 2;
    if(abs(b)+epx<abs(c)) return -2;
    return 0;
}
bool xiangjiao(kk a,kk b,kk c,kk d)
{return (op(a,b,c)*op(a,b,d)<=0)&&(op(c,d,a)*op(c,d,b)<=0);}

int main()
{
    int _;_=readn();
    while(_--)
    {
        double x1,x2,x3,x4,y1,y2,y3,y4;
        scanf("%lf%lf%lf%lf%lf%lf%lf%lf",&x1,&y1,&x2,&y2,&x3,&y3,&x4,&y4);
        printf("%d\n",xiangjiao(kk(x1,y1),kk(x2,y2),kk(x3,y3),kk(x4,y4)));
    }
}


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

int n; string s;
vector<int> d, m, c;
int dv[1000010], cv[1000010];
long long st[1000010];

void solve() {
    int k; cin >> k;
    for (int i = 0; i < n; i++) {
        st[i] = 0;
        if (s[i] == 'D') {
            st[i] += cv[min(i+k, n)] - cv[i];
        }
        if (s[i] == 'C') {
            st[i] -= dv[i+1] - dv[max(0, i-k+1)];
        }
        if (i) st[i] += st[i-1];
    }
    long long ans = 0;
    for (auto &x: m) ans += st[x];
    cout << ans << "\n";
}

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cin >> n >> s;
    for (int i = 0; i < n; i++) {
        if (s[i] == 'D') d.emplace_back(i);
        if (s[i] == 'M') m.emplace_back(i);
        if (s[i] == 'C') c.emplace_back(i);
    }
    for (auto &x: d) dv[x+1]++;
    for (auto &x: c) cv[x+1]++;
    for (int i = 0; i < n; i++) {
        dv[i+1] += dv[i], cv[i+1] += cv[i];
    }
    int q; cin >> q;
    while (q--) solve();
    return 0;
}

Measured memory_bytes: 22932