akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <vector>
#include <algorithm>
#include <iomanip>
#include <string>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <tuple>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cassert>
#include <cstdint>
#include <cctype>
#include <numeric>
#include <bitset>
#include <functional>

using namespace std;

using ll =  long long;
using Pll = pair<ll, ll>;
using Pii = pair<int, int>;

constexpr ll MOD = 1000000007;

ll modpow(ll a, ll t) {
    ll ret = 1LL;
    while(t){
        if(t & 1LL){
            ret *= a;
            ret %= MOD;
        }
        a *= a;
        a %= MOD;
        t >>= 1;
    }
    return ret;
}


ll comb(ll n, ll r){
    ll ans = 1LL;
    for(ll i=n;i>=(n-r+1);--i) {
        ans *= i;
        ans %= MOD;
    }
    for(ll i=r;i>=1;--i) {
        ans *= modpow(i, MOD-2);
        ans %= MOD;
    }
    return ans;
}

int main() {
    ios::sync_with_stdio(false); cin.tie(nullptr);
    ll n, a, b;
    cin >> n >> a >> b;

    ll ans = (modpow(2LL, n) + MOD - 1) % MOD;
    ans = (ans + MOD - comb(n, a)) % MOD;
    ans = (ans + MOD - comb(n, b)) % MOD;
    cout << ans << endl;

}


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

using namespace std;

typedef long long LL;

const int N = 110;

int n, l;

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

    int sum = 0, mina = 0x3f3f3f3f;
    bool po;

    for(int i = 1; i <= n; i++)
    {
        sum += (l + i - 1);
        if(mina > abs(l + i - 1))
        {
            mina = abs(l + i - 1);
            if(l + i - 1 > 0) po = true;
            else po = false;
        }
    }

    if(po) sum -= mina;
    else sum += mina;

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


Measured memory_bytes: 256
#! env/bin/local python3
# -*- coding:utf-8 -*-

# -- submit ----

# --- fetch input ---
inputs: list = []
while True:
    try:
        inputs.append(input().strip('\n'))
    except EOFError:
        break

# --- write code below ---

n = int(inputs[0])
goods = inputs[1:]

goods_list = set(goods)
print(len(goods_list))


Measured memory_bytes: 37132
// #define _GLIBCXX_DEBUG // for STL debug (optional)
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <cfloat>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <fstream>
#include <functional>
#include <bitset>
using namespace std;
using ll = long long int;
using int64 = long long int;
 
template<typename T> void chmax(T &a, T b) {a = max(a, b);}
template<typename T> void chmin(T &a, T b) {a = min(a, b);}
template<typename T> void chadd(T &a, T b) {a = a + b;}
 
int dx[] = {0, 0, 1, -1};
int dy[] = {1, -1, 0, 0};
const int INF = 1001001001;
const ll LONGINF = 1001001001001001LL;
const ll MOD = 1000000007LL;
 
int main() {
    int N, M; cin >> N >> M;
    priority_queue<int> que;
    for(int i=0; i<N; i++) {
        int v; cin >> v;
        que.emplace(v);
    }
    
    for(int i=0; i<M; i++) {
        int v = que.top(); que.pop();
        v /= 2;
        que.push(v);
    }

    ll ans = 0;
    for(int i=0; i<N; i++) {
        ans += que.top(); que.pop();
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 892
#include <iostream>
#include <algorithm>
#include <vector>
#include <cmath>
using namespace std;
int n;
long long rez(0);
vector <int> tab;
int main() {
    cin >> n;
    int a;
    for(int i = 1 ; i <= n ; i++){
        cin >> a;
        tab.push_back(a-i);
    }
    sort(tab.begin(),tab.end());
    for(int i = 0 ; i < n ; i++){
        rez+=abs(tab[i]-tab[n/2]);
    }
    cout << rez;
}


Measured memory_bytes: 1400
import math
from collections import deque
N = int(input())
A = list(map(int,input().split()))

M = 0
L = deque([0])
R = deque([0])
for i in range(1,N+1):
    L.append(math.gcd(L[-1],A[i-1]))
    R.appendleft(math.gcd(R[0],A[N-i]))
for j in range(N):
    m = math.gcd(L[j],R[j+1])
    M = max(M,m)
print(M)

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

int main() {
  int H, N, a;
  cin>>H>>N;
  for(int i=0;i<N;i++){
    cin>>a;
    H-=a;
  }
  if(H<=0){
    cout<<"Yes"<<endl;
  }
  else{
    cout<<"No"<<endl;
  }
}

Measured memory_bytes: 256
package main

import (
    "fmt"
    "os"
    "bufio"
    "strings"
    "strconv"
)

var sc = bufio.NewScanner(os.Stdin)

func StrStdin() (stringInput string){
  sc.Scan()
  OneLineString := sc.Text()
  stringInput = strings.TrimSpace(OneLineString)
  return 
}

func IntStdin() (int, error){
  stringInput := StrStdin()
  return strconv.Atoi(stringInput)
}

// ?????????????l??????????Split()
func SplitWithoutEmpty(stringTargeted string, delim string) (stringReturned []string) {
    stringSplited := strings.Split(stringTargeted, delim)

    for _, str := range stringSplited {
        if str != "" {
            stringReturned = append(stringReturned, str)
        }
    }

    return
}

// ?f???~?^??????????????X???C?X???��
func SplitStrStdin(delim string) (stringReturned []string) {
    // ???????1?s?��
    stringInput := StrStdin()
  
    // ???????
    // stringSplited := strings.Split(stringInput, delim)
    stringReturned = SplitWithoutEmpty(stringInput, delim)

    return
}

// ?f???~?^?????????????l?X???C?X???��
func SplitIntStdin(delim string) (intSlices []int, err error) {
    // ??????X???C?X???��
    stringSplited := SplitStrStdin(delim)
	
    // ?????X???C?X????
    for i := range stringSplited {
        var iparam int
        iparam, err = strconv.Atoi(stringSplited[i])
        if err != nil {
            return
        }
        intSlices = append(intSlices, iparam)
    }
    return
}

func main(){
  fivehund, err1 := IntStdin()
  ahund, err2 := IntStdin()
  fifty, err3 := IntStdin()
  sum, err4 := IntStdin()
  
  n := 0
  
  if err1 == nil && err2 == nil && err3 == nil && err4 == nil {
    for i := 0; i <= fivehund; i++ {
      for j := 0; j <= ahund; j++ {
        for k := 0; k <= fifty; k++ {
          result_sum := i*500 + j*100 + k*50
          if result_sum == sum {
			n++
          }
        }
      }
    }
    fmt.Println(n)
  }

}

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

int main() {
	int n, d, a;
	cin >> n >> d >> a;
	vector<pair<int, int>> x(n);
	rep(i, n) {
		int p, q;
		cin >> p >> q;
		x[i] = {p, q};
	}
	sort(all(x));
	queue<pair<int, int>> damage;
	ll ans = 0;
	ll sum = 0;
	rep(i, n) {
		int now_x = x[i].first;
		int now_hp = x[i].second;
		while (!damage.empty()) {
			int bomb_x = damage.front().first;
			int bomb_damage = damage.front().second;
			if(bomb_x < now_x){
				damage.pop();
				sum -= bomb_damage;
			}
			else break;
		}
		now_hp -= sum;
		if(now_hp > 0) {
			ll bomb_cnt = (now_hp + a - 1) / a;
			ll bomb_damage = bomb_cnt * a;
			damage.push({now_x + 2 * d, bomb_damage});
			ans += bomb_cnt;
			sum += bomb_damage;
		}
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 2688
#include <stdio.h>
#include <iostream>
#include <vector>
#include <list>
#include <cmath>
#include <fstream>
#include <algorithm>
#include <string>
#include <queue>
#include <set>
#include <map>
#include <complex>
#include <iterator>
#include <cstdlib>
#include <cstring>
#include <sstream>

using namespace std;

#define EPS (1e-10)
#define EQ(a,b) (abs((a) - (b)) < EPS)
#define EQV(a,b) (EQ((a).real(),(b).real()) && EQ((a).imag(),(b).imag()))

typedef complex<double> P;
typedef long long ll;

const int MAX_M=100000;
int a[MAX_M];

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

pair<ll,ll> InclusionExclusion(ll n,ll m){
    // a1,a2,..Ì¤¿A­È­ÆàPÂÅèØêéàÌÌa
    ll sum=0;
    // ­È­ÆàPÂÅèØêéàÌÌÂ
    ll res=0;
    for(int i=1;i<(1<<m);i++){
        ll num=0;
        for(ll j = i;j!=0;j>>=1)
            num+=j&1;
        ll lcm=1;
        for(int j = 0; j <m; j++){
            if((i>>j)&1){
                lcm=lcm/gcd(lcm,a[j])*a[j];
                if(lcm>n)
                    break;
            }
        }
        if(num%2==0){
            int t=n/lcm;
            sum-=lcm*t*(t+1)/2;
            res-=n/lcm;
        }
        else{
            res+=n/lcm;
            ll t=n/lcm;
            sum+=lcm*t*(t+1)/2;
        }
    }
    sum=n*(n+1)/2-sum;
    res=n-res;
    return make_pair(res,sum);
}

void solve(){
    ll n,m;
    while(cin>>n>>m&&!(n==0&&m==0)){
        for(int i = 0; i < m; i++)
            cin>>a[i];
        pair<ll,ll> p=InclusionExclusion(n,m);
        if(p.first==0){
            p.second=0;p.first=1;
        }
        printf("%.7f\n",(double)p.second/p.first);
    }
}

int main(){solve();return 0;}

Measured memory_bytes: 0
n,x = map(int, raw_input().split())
l = map(int, raw_input().split())
cnt = 0
for i in range(1,n):
    if l[i-1] + l[i] > x:
        t = l[i-1] + l[i] - x
        if t > l[i]:
            l[i] = 0
        else:
            l[i] -= t
        cnt += t
print cnt


Measured memory_bytes: 11316
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll MOD = 1e9 + 7;
//const ll MOD = 998244353;
//const ll MOD = ;
ll mod(ll A, ll M) {return (A % M + M) % M;}
const ll INF = 1LL << 60;
template<class T> bool chmin(T& a, T b) {if (a > b) {a = b; return true;} return false;}
template<class T> bool chmax(T& a, T b) {if (a < b) {a = b; return true;} return false;}
ll divceil(ll A, ll B) {return (A + (B - 1)) / B;}
ll myctoi(char C) {return C - '0';}
char myitoc(ll N) {return '0' + N;}
#define FINALANS(A) {cout << (A) << '\n'; exit(0);}

vector<vector<ll>> G;
vector<bool> visited;
vector<ll> par;
void dfs(ll V, ll P)
{
  if (visited.at(V))
    return;
  visited.at(V) = true;

  par.at(V) = P;

  for (auto nv : G.at(V))
  {
    dfs(nv, V);
  }
}

int main()
{
  ll N;
  cin >> N;
  G.resize(N);
  map<pair<ll, ll>, ll> mp;
  for (ll i = 0; i < N - 1; i++)
  {
    ll a, b;
    cin >> a >> b;
    a--, b--;
    G.at(a).push_back(b);
    G.at(b).push_back(a);

    mp[make_pair(a, b)] = i;
    mp[make_pair(b, a)] = i;
  }

  visited.resize(N);
  par.resize(N);

  ll M;
  cin >> M;
  vector<ll> B(N - 1, 0);
  for (ll i = 0; i < M; i++)
  {
    ll u, v;
    cin >> u >> v;
    u--, v--;

    fill(visited.begin(), visited.end(), false);
    dfs(u, -1);

    ll p = v;
    while (true)
    {
      ll P = par.at(p);
      if (P == -1)
        break;
      B.at(mp.at(make_pair(P, p))) |= (1LL << i);

      p = P;
    }
  }

  vector<vector<ll>> dp(N, vector<ll>(1LL << M, 0));
  dp.at(0).at(0) = 1;
  for (ll i = 0; i < N - 1; i++)
  {
    for (ll j = 0; j < (1LL << M); j++)
    {
      dp.at(i + 1).at(j | B.at(i)) += dp.at(i).at(j);
      dp.at(i + 1).at(j) += dp.at(i).at(j);
    }
  }

  ll ans = dp.at(N - 1).at((1LL << M) - 1);
  cout << ans << endl;
}

Measured memory_bytes: 418304
#include<stdio.h>

int main(){
	unsigned int H, W;
    unsigned long long int Ans;

	scanf("%d %d", &H, &W);
    if(1==H || 1== W){
        Ans = 1;
    }else{
        Ans = (unsigned long long int)(0.5*H*W + 0.5);
    }

    printf("%lld", Ans);

  return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
#define gc getchar_unlocked
#define fo(i,n) for(i=0;i<n;i++)
#define Fo(i,k,n) for(i=k;k<n?i<n:i>n;k<n?i+=1:i-=1)
#define ll long long
#define si(x)	scanf("%d",&x)
#define sl(x)	scanf("%lld",&x)
#define ss(s)	scanf("%s",s)
#define pi(x)	printf("%d\n",x)
#define pl(x)	printf("%lld\n",x)
#define ps(s)	printf("%s\n",s)
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define all(x) x.begin(), x.end()
#define clr(x) memset(x, 0, sizeof(x))
#define sortall(x) sort(all(x))
#define tr(it, a) for(auto it = a.begin(); it != a.end(); it++)
#define PI 3.1415926535897932384626
typedef pair<int, int>	pii;
typedef pair<ll, ll>	pl;
typedef vector<int>		vi;
typedef vector<ll>		vl;
typedef vector<pii>		vpii;
typedef vector<pl>		vpl;
typedef vector<vi>		vvi;
typedef vector<vl>		vvl;
int mpow(int base, int exp); 
void ipgraph(int n, int m);
void dfs(int u, int par);
const int mod = 1000000007;
const int N = 3e5, M = N;
//=======================

vi g[N];
int a[N];

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	int i,n,k,j;
	cin>>n;
	vi A;
	fo(i, n) cin>>a[i], A.pb(a[i]);
	sortall(A);
	map<int, int> pos;
	i=0;
	for(int x: A) pos[x] = i++;
	int ans = 0;
	fo(i, n) ans += abs(i-pos[a[i]])%2;
	cout << ans/2 << endl;
	return 0;
} 

int mpow(int base, int exp) {
	base %= mod;
	int result = 1;
	while (exp > 0) {
	if (exp & 1) result = ((ll)result * base) % mod;
	base = ((ll)base * base) % mod;
	exp >>= 1;
	}
	return result;
}

void ipgraph(int m){
	int i, u, v;
	fo(i, m){
		cin>>u>>v;
		g[u-1].pb(v-1);
		g[v-1].pb(u-1);
	}
}

void dfs(int u, int par){
	for(int v:g[u]){
		if (v == par) continue;
		dfs(v, u);
	}
}

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

#define int long long
#define rep(i,l,r) for(int i=(int)(l);i<(int)(r);i++)
#define all(x) (x).begin(),(x).end()
#define sz(x) ((int)x.size())
template<class T>bool chmax(T &a,T b){if(a<b){a=b;return 1;}return 0;}
template<class T>bool chmin(T &a,T b){if(a>b){a=b;return 1;}return 0;}

typedef vector<int> vi;
typedef vector<vi> vvi;

/*{
  }*/

const int inf = 1LL<<60;

struct edge{
  int to, rev, cap;
  edge(int t, int r, int c) : to(t), rev(r), cap(c){}
};

vector<edge> es[30010];
bool vis[30010];

void add_edge(int from, int to, int cap, int rcap=0){
  es[from].emplace_back(to, sz(es[to]), cap);
  es[to].emplace_back(from, sz(es[from])-1, rcap);
}

int dfs(int v, int t, int f){
  if(v == t) return f;
  vis[v] = true;
  for(auto &e : es[v]){
    if(vis[e.to] or e.cap <= 0) continue;
    int d = dfs(e.to, t, min(f, e.cap));
    if(d > 0){
      e.cap -= d;
      es[e.to][e.rev].cap += d;
      return d;
    }
  }
  return 0;
}

int max_flow(int s, int t){
  int flow = 0;
  while(1){
    memset(vis, false, sizeof(vis));
    int f = dfs(s, t, inf);
    if(f == 0) return flow;
    flow += f;
  }
}

signed main(){
  int H, W;
  cin >> H >> W;
  string s[H];
  rep(i, 0, H) cin >> s[i];

  rep(y, 0, H) if(s[y][0] == 'X' or s[y][W-1] == 'X'){
    cout << -1 << endl;
    return 0;
  }

  rep(x, 0, W) if(s[0][x] == 'X' or s[H-1][x] == 'X'){
    cout << -1 << endl;
    return 0;
  }

  int S = 0, T = 1;
  rep(y, 0, H) rep(x, 0, W){
    if(s[y][x] == 'X'){
      add_edge(y*W+x+10000, y*W+x+20000, inf);
      add_edge(S, y*W+x+20000, inf);
    }else add_edge(y*W+x+10000, y*W+x+20000, 1);
    if(y == 0 or y == H-1 or x == 0 or x == W-1) add_edge(y*W+x+20000, T, inf);
    if(y) add_edge(y*W+x+20000, (y-1)*W+x+10000, inf);
    if(x) add_edge(y*W+x+20000, y*W+(x-1)+10000, inf);
    if(y < H-1) add_edge(y*W+x+20000, (y+1)*W+x+10000, inf);
    if(x < W-1) add_edge(y*W+x+20000, y*W+(x+1)+10000, inf);
  }

  int ans = max_flow(S, T);
  cout << ans << endl;

  return 0;
}



Measured memory_bytes: 5248
// #define _GLIBCXX_DEBUG // for STL debug (optional)
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <cfloat>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <fstream>
#include <functional>
#include <bitset>
using namespace std;
using ll = long long int;
using int64 = long long int;
 
template<typename T> void chmax(T &a, T b) {a = max(a, b);}
template<typename T> void chmin(T &a, T b) {a = min(a, b);}
template<typename T> void chadd(T &a, T b) {a = a + b;}
 
int dx[] = {0, 0, 1, -1};
int dy[] = {1, -1, 0, 0};
const int INF = 1LL << 29;
const ll LONGINF = 1LL << 60;
const ll MOD = 1000000007LL;
 
int main() {
    int A, B, C; cin >> A >> B >> C;

    bool poor = false;
    poor |= (A == B and B != C);
    poor |= (A == C and C != B);
    poor |= (B == C and C != A);

    cout << (poor ? "Yes" : "No") << endl;
    return 0;
}


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

using namespace std;

using ll = long long;
using P = pair<ll, ll>;
using Graph = vector<vector<ll>>;
#define rep(i, n) for(ll i=0;i<(ll)(n);i++)
#define rep2(i, m, n) for(ll i=m;i<(ll)(n);i++)
#define rrep(i, n, m) for(ll i=n;i>=(ll)(m);i--)
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
const int ddx[8] = {0, 1, 1, 1, 0, -1, -1, -1};
const int ddy[8] = {1, 1, 0, -1, -1, -1, 0, 1};
const ll MOD = 1000000007;
const ll INF = 1000000000000000000L;
#ifdef __DEBUG

/**
 * For DEBUG
 * https://github.com/ta7uw/cpp-pyprint
 */
#include "cpp-pyprint/pyprint.h"

#endif

void Main() {
    char a; cin >> a;
    if (toupper(a) != a){cout << 'a' << endl;}else{cout << 'A' << endl;}
}

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    Main();
    return 0;
}


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

#define int long long
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define rep(i, n) for (int i = 0; i < n; ++i)
#define REP(i, n) for (int i = 0; i < n; ++i)
#define range(i,a,b) ((a)<=(i) && (i)<(b))
#define debug(x) cout << #x << " = " << (x) << endl;
#define fs first
#define sc second
#define pb push_back
#define eb emplace_back
#define SP << " " <<

typedef long long ll;
typedef pair<int, int> P;
typedef tuple<int, int, int> T;
typedef vector<int> vec;
typedef vector<P> pvec;
typedef vector<vector<int>> vvec;
typedef vector<vector<P>> pvvec;
typedef priority_queue<int> PQI;
typedef priority_queue<P> PQP;
typedef priority_queue<int,vector<int>,greater<int>> PQIG;
typedef priority_queue<P,vector<P>,greater<P>> PQPG;

const vector<int> DX = {0, -1, 0, 1, 1, 1, -1, -1};
const vector<int> DY = {1, 0, -1, 0, 1, -1, 1, -1};
constexpr int MOD = (1000000007);
// const int MOD = (998244353);
// const int INF = (1 << 30); // 1073741824
const ll INF = (1LL << 60); // 1152921504606846976
const double PI = (3.141592653589794);
const double EPS = (0.0000000001); // 10^(-10)

template<class T> inline bool chmin(T& a, T b) {if (a > b) {a = b; return 1;} return 0;}
template<class T> inline bool chmax(T& a, T b) {if (a < b) {a = b; return 1;} return 0;}
template<class T> inline T ceil(T a, T b) {return T((a + b - 1) / b);}
template<class T> inline T round(T a, T b) {return T(a / b);}
template< typename T1, typename T2 > istream &operator>>(istream &is, pair< T1, T2 > &p) { is >> p.first >> p.second; return is; }
template <class T> inline void out(T &a) { bool flag=true; for(auto&x:a){if(flag) {flag=false;} else{ cout << ' '; } cout<<x; } cout << endl; }



//----------------------------------------------------------------
int nmax=200000; // 2*(10^5)
vvec G(nmax);





void solve4ts()
{
    
    
    string s;
    cin>>s;
    int memo=0;
    rep(i,s.size()){
        memo+=s[i]-'0';
    }
    if(memo%9==0){
        cout<<"Yes";
    }
    else{
        cout<<"No";
    }
    
    
}
//-----------------------------------------------------------------

signed main(){ ios::sync_with_stdio(false); cin.tie(0); cout << fixed << setprecision(15);
    int repeat = 1;
    // cin >> repeat;
    while(repeat--) solve4ts();
}

/*

g++ -std=c++1z code.cpp
./a.out

*/

Measured memory_bytes: 8288
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <cmath>
#include <map>
#include <queue>
#include <iomanip>
#include <set>
#define mkp make_pair
#define rep(i,n) for(int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;
const ll MOD=1e9+7;


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

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

ll L,R;

ll dp[61][2][2][2];

int main(){
  cin>>L>>R;
  
  dp[60][0][0][0]=1;
  for(int i=59;i>=0;i--){
      int lb=(L>>i)&1;
      int rb=(R>>i)&1;
      rep(j,2)rep(k,2)rep(s,2){

          rep(y,2)rep(x,2){
              if(y==0&&x==1) continue;

              int nj=j,nk=k,ns=s;

              if(lb&&j==0&&x==0) continue;
              if(rb==0&&k==0&&y==1) continue;
              if(s==0&&(y==1&&x==0)) continue;

              if(y==1&&x==1){
                  if(s==0) ns=1;
                  if(lb==0&&j==0) nj=1;
              }

              if(y==1&&x==0);

              if(y==0&&x==0){
                  if(rb&&k==0) nk=1;
              }

              add(dp[i][nj][nk][ns],dp[i+1][j][k][s]);
          }
      }
  }

  ll ans=0;
  rep(j,2)rep(k,2) add(ans,dp[0][j][k][1]);

  cout<<ans<<endl;


  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main (){
int a,b;
cin>>a>>b;

 if (a==1 && b==2|| a==2 && b==1)
     {
    cout<<"3";
     }
else if (a==3 && b==1 ||a==1 && b==3)
     {
        cout<<"2";
     }

else if (a==3 && b==2 ||a==2 && b==3)
   {
    cout<< "1";
   }

return 0;
}


Measured memory_bytes: 256
def fact(n)
    return 1 if n == 0
    (1..n).inject(:*)
end

def comb(n, k)
    fact(n) / fact(k) / fact(n-k)
end

n, m, r = gets.split.map &:to_i

r -= n * m
if r >= 0
    p comb(r + n - 1, r)
else
    p 0
end

Measured memory_bytes: 10224
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

var ar []int
var br []bool
var g map[int][]int
var qr []int

func main() {
	sc.Split(bufio.ScanWords)
	n, q := ri(), ri()
	g = map[int][]int{}
	for i := 1; i < n; i++ {
		a, b := ri(), ri()
		g[a] = append(g[a], b)
		g[b] = append(g[b], a)
	}
	qr = make([]int, n+1)
	for i := 0; i < q; i++ {
		p, x := ri(), ri()
		qr[p] += x
	}
	ar = make([]int, n+1)
	br = make([]bool, n+1)
	dfs(1, 0)
	ans := fmt.Sprint(ar)
	fmt.Println(ans[3 : len(ans)-1])
}

func dfs(key, sum int) {
	if br[key] {
		return
	}
	br[key] = true
	sum += qr[key]
	ar[key] = sum
	for _, v := range g[key] {
		dfs(v, sum)
	}
}

var sc = bufio.NewScanner(os.Stdin)

func ri() int {
	sc.Scan()
	s := sc.Text()
	a, _ := strconv.Atoi(s)
	return a
}


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

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

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

int main() {
	ll x, y; cin >> x >> y;
	int ans = 0;
	for (; x <= y; x *= 2) ans++;
	cout << ans << endl;
}


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

int main() {
    for(string s; cin >> s, s != "-"; ) {
        int m; cin >> m;
        while(m--) {
            int h; cin >> h;
            s = s.substr(h) + s.substr(0, h);
        }
        cout << s << endl;
    }
}

Measured memory_bytes: 1216
#include<stdio.h>
int main(){
  int n,i,j,k,l;
  scanf("%d",&n);
  int a[n],temp;
  for(i=0;i<n;i++){
    scanf("%d",&a[i]);
  }
  for(i=0;i<n-1;i++){
    for(j=0;j<n;j++){
      printf("%d",a[j]);
      if(j!=n-1)printf(" ");
    }
    printf("\n");//最初の出力
    for(j=0;j<n-1;j++){
      if(a[i+1-j]<a[i-j] && i-j>=0){
	temp=a[i-j];
	a[i-j]=a[i+1-j];
	a[i+1-j]=temp;
      }
      else break;
    }
  }
  for(i=0;i<n;i++){
    printf("%d",a[i]);
    if(i!=n-1)printf(" ");
  }
  printf("\n");
  return(0);
}

Measured memory_bytes: 604
#include<atcoder/all>
using namespace atcoder;

#include <bits/stdc++.h>
template<class T> inline bool chmin(T&a, T b){if(a > b){a = b; return true;}else{return false;}}
template<class T> inline bool chmax(T&a, T b){if(a < b){a = b; return true;}else{return false;}}
#define ll long long
#define double long double
#define rep(i,n) for(int i=0;i<(n);i++)
#define REP(i,n) for(int i=1;i<=(n);i++)
#define mod (ll)(1e9+7)
#define inf (ll)(3e18+7)
#define pi (double) acos(-1)
#define P pair<int,int>
#define PiP pair<int,pair<int,int>>
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
using namespace std;

using mint = modint998244353;
vector<mint> ten(300010), ones(300010);

struct S{
    mint sum; int size;
};

struct F{
    int num, time;
};

S op(S a, S b){ return S{a.sum * ten[b.size] + b.sum, a.size + b.size}; }
S e(){ return S{0, 0}; }
S mapping(F a, S b){ return (a.num == -1 ? b : S{a.num * ones[b.size], b.size}); }
F composition(F a, F b){ return (a.time > b.time ? a : b); };
F id(){ return F{-1, -1}; } 


int main() {
    rep(i, 300001)if(i){ten[i] = ten[i-1]*10;}else{ten[i] = 1;}
    rep(i, 300001)if(i){ones[i] = ones[i-1] * 10 + 1;}else{ones[i] = 0;}
    int n, q;
    cin >> n >> q;
    vector<S> a(n); rep(i, n)a[i] = S{1, 1};
    lazy_segtree<S,op,e,F,mapping,composition,id> seg(a);
    rep(i, q){
        int l, r, d;
        cin >> l >> r >> d;
        seg.apply(l-1, r, F{d, i});
        cout << seg.all_prod().sum.val() << endl;
    }
}


Measured memory_bytes: 13328
#pragma region template 2.4
#include <bits/stdc++.h>
using namespace std;
template <typename T>
using pq_asc = priority_queue<T, vector<T>, greater<T>>;
typedef long long ll;
typedef vector<ll> vi;
typedef vector<vi> vvi;
typedef pair<ll, ll> ii;
typedef vector<ii> vii;
typedef vector<string> vs;
#define REP(i, n) for (ll i = 0; i < (n); ++i)
#define REP1(i, n) for (ll i = 1; i <= (n); ++i)
#define FOR(i, a) for (auto &i : a)
#define CH(f, x, y) x = f(x, y)
#define IN(T, x) \
    T x;         \
    cin >> x;
#define AIN(T, a, n) \
    vector<T> a(n);  \
    FOR(i, a)        \
    cin >> i;
#define A2IN(T1, a, T2, b, n) \
    vector<T1> a(n);          \
    vector<T2> b(n);          \
    REP(i, n)                 \
    cin >> a[i] >> b[i];
#define OUT(x) cout << (x) << endl;
#define FOUT(x) cout << fixed << setprecision(15) << (x) << endl;
#define ALL(a) (a).begin(), (a).end()
#define SORT(a) sort(ALL(a))
#define RSORT(a) \
    SORT(a);     \
    reverse(ALL(a))
#define DUMP(x) cout << #x << " = " << (x) << endl;
#define DUMPA(a)          \
    cout << #a << " = {"; \
    JOUT(ALL(a), ", ", cout) << "}" << endl;

template <typename T>
ostream &JOUT(T s, T e, string sep = " ", ostream &os = cout)
{
    if (s != e)
    {
        os << *s;
        ++s;
    }
    while (s != e)
    {
        os << sep << *s;
        ++s;
    }
    return os;
}

ostream &YES(bool cond, string yes = "Yes", string no = "No", ostream &os = cout)
{
    if (cond)
    {
        os << yes << endl;
    }
    else
    {
        os << no << endl;
    }
    return os;
}

template <typename T1, typename T2>
ostream &operator<<(ostream &os, const pair<T1, T2> &p)
{
    os << '(' << p.first << ", " << p.second << ')';
    return os;
}

template <typename T>
ostream &operator<<(ostream &os, const vector<T> &v)
{
    os << '[';
    JOUT(ALL(v), ", ", os) << ']';
    return os;
}

const ll INF = 1e18;
const ll MOD = 1e9 + 7;
#pragma endregion template

int main()
{
    IN(ll, sx);
    IN(ll, sy);
    IN(ll, tx);
    IN(ll, ty);
    ll dx = tx - sx;
    ll dy = ty - sy;
    string ans;
    REP(i, dx)
    {
        ans.push_back('R');
    }
    REP(i, dy)
    {
        ans.push_back('U');
    }

    ans.push_back('R');
    REP(i, dy + 1)
    {
        ans.push_back('D');
    }
    REP(i, dx + 1)
    {
        ans.push_back('L');
    }
    ans.push_back('U');

    REP(i, dy)
    {
        ans.push_back('U');
    }
    REP(i, dx)
    {
        ans.push_back('R');
    }

    ans.push_back('U');
    REP(i, dx + 1)
    {
        ans.push_back('L');
    }
    REP(i, dy + 1)
    {
        ans.push_back('D');
    }
    ans.push_back('R');
    OUT(ans);
}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(void){
  int d,l,x,y;
  cin>>d>>l;
  x=d/l;
  y=d%l;
  if(d>=l){
      cout<<x+y<<endl;
  }
  else if(d<l){
      cout<<y<<endl;
  }
 
  }
  


Measured memory_bytes: 3100
#include <iostream>
#include <algorithm>
#include <queue>
#include <vector>
#include <set>
#include <cmath>
#include <string>
#define FOR(i,a,b) for(int i=a;i<b;i++)
#define ROF(i,a,b) for(int i=b-1;i>=a;i--)
#define FI first
#define SE second
#define MA(i,j) make_pair(i,j)
#define PA pair<int,int>
#define PB push_back
#define PQ priority_queue<int>
#define PGQ priority_queue<int,vector<int>,greater<int> >
#define VE vector<int>
#define VP vector<PA>
#define YES(i) cout<<(i?"YES":"NO")<<endl
#define Yes(i) cout<<(i?"Yes":"No")<<endl
using namespace std;
//
const int MOD=1e9+7;
const int INF=1e9+7;
const double PI=3.141592653589793238462643383279;
//
int main(){
  long long N,M;
  cin>>N>>M;
  long long ans=1;
  bool F=(N==M?true:false);
  if(abs(N-M)>1){
    cout<<0<<endl;
    return 0;
  }
  while(N>0){
    (ans*=N)%=MOD;
    N--;
  }
  while(M>0){
    (ans*=M)%=MOD;
    M--;
  }
  if(F){
    (ans*=2)%=MOD;
  }
  cout<<ans<<endl;
  return 0;
}


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

using namespace std;

using ll = long long;
using ld = long double;
using P = pair<int, int>;
constexpr ld EPS = 1e-12;
constexpr int INF = numeric_limits<int>::max() / 2;
constexpr int MOD = 1e9 + 7;

template <typename T>
void printv(const vector<T> &v)
{
    int sz = v.size();
    for (int i = 0; i < sz; i++)
    {
        cout << v[i] << " \n"[i == sz - 1];
    }
}

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

    int n, k;
    cin >> n >> k;
    int res = 0;
    for (int i = 1; i <= n; i += 2)
        res++;
    cout << ((res >= k) ? "YES" : "NO") << endl;
}


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

void calc(const vector<vector<int> >& G, vector<int>& D) {
    queue<int> Q1;
    D[1] = 0;
    int dim = 1;
    Q1.push(1);
    while (!Q1.empty()) {
        queue<int> Q2;
        while (!Q1.empty()) {
            int i = Q1.front();
            for (int j = 1; j < G[i].size(); j++) {
                if (G[i][j] && D[j] == -1) {
                    Q2.push(j);
                    D[j] = dim;
                }
            }
            Q1.pop();
        }
        dim++;
        Q1 = Q2;
    }

}

int main(){
    int n;
    cin >> n;
    vector<vector<int> > G(n + 1, vector<int>(n + 1, 0));
    for (int i = 0; i < n; i++) {
        int u, k;
        cin >> u >> k;
        for (int j = 0; j < k; j++) {
            int v;
            cin >> v;
            G[u][v] = 1;
        }
    }
    vector<int> D(n + 1, -1);
    calc(G, D);

    for (int i = 1; i <= n; i++) {
        cout << i << " " << D[i] << endl;
    }

    return 0;
}

Measured memory_bytes: 3160
#include <bits/stdc++.h>
using namespace std;
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define trace1(x)                cerr<<#x<<": "<<x<<endl
#define trace2(x, y)             cerr<<#x<<": "<<x<<" | "<<#y<<": "<<y<<endl
#define trace3(x, y, z)          cerr<<#x<<":" <<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl
#define trace4(a, b, c, d)       cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<endl
#define trace5(a, b, c, d, e)    cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<endl
#define trace6(a, b, c, d, e, f) cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<" | "<<#f<<": "<<f<<endl
#define int  long long
#define endl '\n'

int32_t main()
{
    char ch;
    cin>>ch;
    ch++;
    cout<<ch;
}

Measured memory_bytes: 764
S = "0" + input()

ans = 0
b = 0
c = 0
for a in S[::-1]:
    A = int(a) + b
    if A == 5 and c == 0:
        ans += 5
        b = 0
        c = 1
    elif A < 5:
        ans += A
        b = 0
        c = 0
    else:
        ans += 10 - A - c
        b = 1
        c = 0

print(ans)

Measured memory_bytes: 62960
//----------BHAVIK DIWANI(PICT_COMP)---------------
#include<bits/stdc++.h>
#define test ll t; cin>>t; while(t--)
#define fastio ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define mod 1000000007
#define ll long long
#define int long long
#define ull unsigned long long
#define MAX 1000005
#define pb push_back
#define mkp make_pair
#define vi vector<int>
#define pii pair<int,int>
#define endl '\n'
#define vs vector<string>
#define mii map<int,int>
#define msi map<string,int>
#define vpii vector< pair<int, int > >
#define vpsi vector< pair< string ,int > >
#define forci(p,q) for(int i=p;i<q;i++)
ll gcd(ll a,ll b){ if(b==0) return a;    return gcd(b,a%b);}
ll lcm(ll a,ll b) { return (a/gcd(a,b)*b);}
ull power(ull a, ull b) {a %= mod;  ull res = 1;  while (b > 0) { if (b & 1) res = res * a % mod;  a = a * a % mod;  b >>= 1; }  return res%mod; }
ll modmul(ll x, ll y){return (x*y)%mod;}
ll modadd(ll x, ll y){return (x+y)%mod;}
ll modsub(ll x, ll y){return (x-y+mod)%mod;}
ll fact[1000007]={0};
void facto() {fact[0]=1;fact[1]=1;for(int i=2;i<1000007;i++)fact[i]=(fact[i-1]*i)%mod;}
ll ncr(ll n,ll r) {ll res=1; res=fact[n]; res=(res*(power(fact[r],mod-2)))%mod; res=(res*(power(fact[n-r],mod-2)))%mod; return res;}
ll npr(ll n,ll r) {ll res=1; res=fact[n]; res=(res*(power(fact[n-r],mod-2)))%mod; return res;}
inline long long toint(const std::string &s) {std::stringstream ss; ss << s; long long x; ss >> x; return x;}
inline std::string tostring(long long number) {std::stringstream ss; ss << number; return ss.str();}
inline std::string tobin(long long x) {return std::bitset<63>(x).to_string();}
/*bool prime[MAX];
ull sieve(){memset(prime,true,sizeof(prime));for(ull p=2;p*p<MAX;p++){if(prime[p]==true){for(ull i=2*p;i<MAX;i+=p){prime[i]=false;}}}prime[0]=0;prime[1]=0;
}*/
/*int inv[1000001]={0};
void findinverse(){inv[1] = 1;for(int i = 2; i <=1e6 ; ++i)	inv[i] = (mod - (mod/i) * inv[mod%i] % mod) % mod;}
*/
using namespace std;
int solve()
{
	double w,h,x,y;
	cin>>w>>h>>x>>y;
	cout<<fixed<<setprecision(9)<<(w*h)/2<<" ";
	if(x*2==w && y*2==h){
		cout<<"1";
	}
	else
		cout<<"0";
	return 0;
}
signed main()
{
	fastio;
//	test
		solve();
}


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

#define rep(i, n) REP(i, 0, n)
#define repr(i, n) for (int i = (n); i >= 0; i--)
#define ALL(v) v.begin(), v.end()
#define MSG(a) cout << #a << " " << a << endl;
#define REP(i, x, n) for (int i = x; i < n; i++)
#define OP(m) cout << m << endl
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

int main()
{
    int n;
    cin >> n;
    int w[n];
    rep(i, n) cin >> w[i];
    int ans = 1e9;

    rep(i, n)
    {
        int s1 = 0, s2 = 0;
        rep(j, n)
        {
            if (j <= i)
                s1 += w[j];
            else
                s2 += w[j];
        }
        ans = min(ans, abs(s1 - s2));
    }

    OP(ans);
    return 0;
}

Measured memory_bytes: 256
import java.util.*;

public class Main{
  public static void main(String args[]){
    Scanner sc = new Scanner(System.in);
    String s = sc.next();
    
    if(s.replaceAll("hi", "").length() == 0){
      System.out.println("Yes");
    }else{
      System.out.println("No");
    }
  }
}

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

int main(){
  char a;
  cin >> a;
  
  if(a=='a'||a=='e'||a=='i'||a=='o'||a=='u'){
    cout << "vowel" << endl;
  }
  else{
    cout << "consonant" << endl;
  }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define repr(i,from,to) for(int (i)=(from);(i)<(to);(i)++)
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
// const bool debug=true;
const bool debug=false;
#define DEBUG if(debug==true)
#define vprint(x) for(auto a:(x)) cout << x << endl;
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
const ll MOD = 1000000007;

int main(void) {
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n;cin>>n;
    vector<ll> res(n);
    res[0]=2;
    ll now = 3;
    ll sum = 2;
    if(n==3){
        printf("2 5 63\n");
        return 0;
    }
    repr(i,1,n-1){
        while(!(now%2==0||now%3==0)){
            now++;
        }
        res[i]= now;
        sum += now;
        DEBUG{
            printf("%lld\n",now);
        }
        now++;
    }
    DEBUG{
        cout << "sum: " << sum << endl;
    }
    int odd = res[n-2]%2;
    if((sum%6)%2==0){
        if(sum%6==2){
            res[n-1]=29998;
        }else if(sum%6==0){
            res[n-1]=30000;
        }else if(odd){
            res[n-2]+=5;
            res[n-1]=30000;
        }else{
            res[n-2]+=2;
            res[n-1]=30000;
        }
    }else if(sum%6==3){
        res[n-1]=29997;
    }else if(sum%6==5){
        if(odd){
            res[n-2]++;
            res[n-1]=30000;
        }else{
            res[n-2]+=4;
            res[n-1]=29997;
        }
    }else{
        if(odd){
            res[n-2]+=5;
            res[n-1]=30000;
        }else{
            res[n-2]+=2;
            res[n-1]=29997;
        }
    }
    rep(i,n){
        cout << res[i];
        cout << (i==n-1 ? "\n" : " ");
    }
    return 0;
}


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

int main() {
  string S;
  cin >> S;
  string ans="Good";
  for (int i=0; i<3; i++) {
    if (S[i]==S[i+1]) {
      ans="Bad";
      break;
    }
  }
  cout << ans << endl;
}


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

    #define ff first
    #define ss second
    #define mp make_pair
    #define eb emplace_back
    #define trav(i,a) for(auto i: a)
    #define all(v) (v.begin(),v.end())
    #define rall(v) (v.rbegin(),v.rend())
    #define tc(t) ll t; cin>>t; while(t--)
    #define prec(n) fixed<<setprecission(n)
    #define mst(arr,value) memset(arr,value,sizeof(arr)) /* -1 or 0 */
    
    const long long sz = (long long)1e4+5;
    const long long mx = (long long)2e5+5;
    const long long inf = (long long)1e18;
    const long long mod = (long long)1e9+7;
    
    #define f(i,n)     for(ll i=0;   i<n;  i++)
    #define fab(i,a,b) for(ll i=a;   i<b;  i++)
    #define fr(i,n)    for(ll i=n-1; i>=0; i--)
    #define fba(i,b,a) for(ll i=b-1; i>=a; i--)

    long long pw(long long x,unsigned long long y) 
    { 
        if (y==0) return 1; 
        else if (y%2==0)  return pw(x,y/2)*pw(x,y/2); 
        else return x*pw(x,y/2)*pw(x,y/2);
    }

    int main() 
    {
        ios_base::sync_with_stdio(0);
        cin.tie(NULL);
        cout.tie(NULL);
        ll h,n;
        cin>>h>>n;
        vector<ll> dp(h+1,inf);
        ll a[n],b[n];
        f(i,n)
            cin>>a[i]>>b[i];
        f(i,n)
        {
            if(a[i]>=h)
                dp[h]=min(dp[h],b[i]);
            else 
                dp[a[i]]=min(dp[a[i]],b[i]);
        }
        f(i,h+1)
        {
            f(j,n)
            {
                if(dp[i]!=inf)
                {
                    if(i+a[j]>=h)
                        dp[h]=min(dp[h],dp[i]+b[j]);
                    else 
                        dp[i+a[j]]=min(dp[i+a[j]],dp[i]+b[j]);
                }
            }
        }
        cout<<dp[h];
        return 0;
    }

Measured memory_bytes: 384
fun main(args: Array<String>) {
  val N = readInt()
  val dp = Array(N + 1) { 0L }
  dp[0] = 2
  dp[1] = 1
  for (i in 2..N) {
    dp[i] = dp[i - 1] + dp[i - 2]
  }
  println(dp[N])
}

fun readString() = readLine()!!
fun readStrings() = readString().split(" ")
fun readInt() = readString().toInt()
fun readInts() = readStrings().map { it.toInt() }


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

const long long mod=998244353ll;
void ad(long long &a,long long b){a+=b;a%=mod;}
void mn(long long &a,long long b){a+=mod-b;a%=mod;}
void ml(long long &a,long long b){a*=b;a%=mod;}
const int MSIZE=10010;
long long inv[MSIZE],F[MSIZE],iF[MSIZE];

void prev(int N)
{
  inv[0]=0;
  inv[1]=1;
  for(int i=2;i<N;i++){
    inv[i]=(mod-mod/i)*inv[mod%i]%mod;
  }
  F[0]=iF[0]=1;
  for(int i=1;i<N;i++){
    F[i]=F[i-1]*i%mod;
    iF[i]=iF[i-1]*inv[i]%mod;
  }
}

int main()
{
  char A[10010],B[10010];
  scanf("%s%s",A,B);
  int X=0,Y=0;
  for(int i=0;A[i];i++){
    if(A[i]=='1'){
      if(B[i]=='0'){
	X++;
      }
      else{
	Y++;
      }
    }
  }
  prev(X+Y+1);
  static long long dp[2][10010]={0},ans=0ll;
  bool b=0;
  dp[b][0]=1;
  for(int i=0;i<=X+Y;i++){
    for(int j=max(0,i-Y);j<=i&&j<=X;j++){
      long long S=dp[b][j];
      dp[b][j]=0;
      ad(dp[!b][j],S*((X-j)*(Y-(i-j))%mod));
      ad(dp[!b][j+1],S*((X-j)*(X-j)%mod));
      if(j==X){
	ad(ans,S*F[X+Y-i]%mod*F[X+Y]%mod*iF[i]%mod);
      }
    }
    b=!b;
  }
  printf("%lld\n",ans);
  return 0;
}


Measured memory_bytes: 512
#define _USE_MATH_DEFINES
#include <cstdio>
#include <iostream>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <complex>
#include <string>
#include <vector>
#include <array>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <limits>
#include <climits>
#include <cfloat>
#include <functional>
#include <iterator>
#include <memory>
#include <regex>
using namespace std;

int main()
{
    int n, k;
    string s;
    cin >> n >> k >> s;

    s[k-1] += 'a' - 'A';
    cout << s << endl;

    return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <cmath>
#include <cstdint>
#include <cstdio>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
using namespace std;
#define rep(i, n) for(int(i) = 0; (i) < (n); (i)++)
#define FOR(i, m, n) for(int(i) = (m); (i) < (n); (i)++)
#define All(v) (v).begin(), (v).end()
#define pb push_back
#define MP(a, b) make_pair((a), (b))
using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
const int INF = 1 << 30;
const ll LINF = 1LL << 60;
const int MOD = 1e9 + 7;

int main() {
    int N, M;
    cin >> N >> M;
    vector<int> X(M);
    rep(i, M) cin >> X[i];
    sort(All(X));
    vector<int> dist;
    rep(i, M - 1) { dist.push_back(X[i + 1] - X[i]); }
    sort(All(dist));
    ll res = 0;
    for(int i = 0; i < M - N; i++) {
        res += dist[i];
    }
    cout << res << endl;
    return 0;
}

Measured memory_bytes: 1276
N,M = map(int,input().split())
if M >= 0:
    a_list = [i for i in range(M+1,M+N)]
elif N + M > 0:
    a_list = [i for i in range(M,M+N)]
else:
    a_list = [i for i in range(M,M+N-1)]
print(sum(a_list))

Measured memory_bytes: 9040
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

type Node struct {
	value  int
	parent *Node
	left   *Node
	right  *Node
}

type Tree struct {
	root *Node
}

func main() {
	sc := bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)
	n, err := nextInt(sc)
	if err != nil {
		panic(err)
	}

	tree := &Tree{}
	for i := 0; i < n; i++ {
		command := nextText(sc)
		if command == "insert" {
			x, err := nextInt(sc)
			if err != nil {
				panic(err)
			}
			insertTree(x, tree)
		} else if command == "print" {
			printTree(tree)
		} else if command == "find" {
			x, err := nextInt(sc)
			if err != nil {
				panic(err)
			}
			if findTree(x, tree) {
				fmt.Println("yes")
			} else {
				fmt.Println("no")
			}
		} else {
			panic(fmt.Errorf("unknown command: %s\n", command))
		}
	}
}

func insertTree(x int, tree *Tree) {
	if tree.root == nil {
		tree.root = &Node{x, nil, nil, nil}
	} else {
		insertNode(x, tree.root)
	}
}

func insertNode(x int, node *Node) {
	for {
		if node.value < x {
			if node.right == nil {
				node.right = &Node{x, node, nil, nil}
				break
			} else {
				node = node.right
			}
		} else {
			if node.left == nil {
				node.left = &Node{x, node, nil, nil}
				break
			} else {
				node = node.left
			}
		}
	}
}

func printTree(tree *Tree) {
	if tree.root == nil {
		fmt.Println("")
		fmt.Println("")
	} else {
		fmt.Println(inorder(tree.root))
		fmt.Println(preorder(tree.root))
	}
}

func findTree(x int, tree *Tree) bool {
	return findNode(x, tree.root)
}

func findNode(x int, node *Node) bool {
	for node != nil {
		if node.value == x {
			return true
		} else if node.value < x {
			node = node.right
		} else {
			node = node.left
		}
	}
	return false
}

func preorder(top *Node) string {
	var x string
	x += " " + strconv.Itoa(top.value)
	if top.left != nil {
		x += preorder(top.left)
	}
	if top.right != nil {
		x += preorder(top.right)
	}
	return x
}

func inorder(top *Node) string {
	var x string
	if top.left != nil {
		x += inorder(top.left)
	}
	x += " " + strconv.Itoa(top.value)
	if top.right != nil {
		x += inorder(top.right)
	}
	return x
}

func nextText(sc *bufio.Scanner) string {
	sc.Scan()
	return sc.Text()
}

func nextInt(sc *bufio.Scanner) (int, error) {
	sc.Scan()
	return strconv.Atoi(sc.Text())
}



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

#define ll long long
#define ld long double
#define db double
#define str string
#define pb push_back
#define nl '\n'
#define X first
#define Y second
#define nimble ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define all(v) (v).begin(),(v).end()
#define rall(v) rbegin(v),rend(v)
#define selp(a) for(auto i:a)cout<<i<<" ";cout<<nl;
#define mod(x,m) ((((x)%(m))+(m))%(m))
#define _sz(x) (int)x.size()
#define rep(i,a,b) for(int i=a;i<b;i++)
#define repv(v) for(int i=0;i<_sz(v);i++)
#define rep1(i,b,a) for(int i=b;i>=a;i--)
#define preci(x) fixed<<setprecision(x)
#define tc int tt=1;cin>>tt;while(tt--)
//ll MLG(ll n,ll b){ll a=0;while(n)a++,n/=b;return a-1;}

#define TRACE
#ifdef TRACE
#define see(...) __f(#__VA_ARGS__,__VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
	cerr<<name<<" : "<<arg1<<nl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
    const char* comma=strchr(names+1,',');cerr.write(names,comma-names)<<" : "<<arg1<<" | ";__f(comma+1, args...);
}
#else
#endif

int inf=0x3f3f3f3f;
ll infl=0x3f3f3f3f3f3f3f3fLL;
ld infd=1.0/0.0;
const ll MOD=1e9+7;// 998244353 // = (119<<23)+1
const db pi=2*acos(0.0);

int main(){
    nimble
    string s;
    cin>>s;
    rep(i,0,_sz(s)){
        if(s[i]=='7'){
            cout<<"Yes";
            return 0;
        }
    }
    cout<<"No";
    return 0;
}


Measured memory_bytes: 3636
#include <stdio.h>

int main(){
  int n, x;
  int i, a, y;
  unsigned long long int r;
  scanf("%d%d", &n, &x);
  r = 0;
  y = x;
  for(i=0;i<n;i++){
    scanf("%d",&a);
    if(y < a){
      r += a - y;
      y = x - y;
    }
    else y = x - a;
  }
  printf("%llu\n", r);
  return 0;
}

Measured memory_bytes: 256
var input = require('fs').readFileSync('/dev/stdin', 'utf8');
var Arr=(input.trim()).split(" ").map(Number);
var a=Arr[0];
var b=Arr[1];
var C=Arr[2];
var x=C*Math.PI/180;
var S=1/2*a*b*Math.sin(x);
var L=a+b+Math.sqrt(a*a+b*b-2*a*b*Math.cos(x));
var h=b*Math.sin(x);
console.log(S.toFixed(4));
console.log(L.toFixed(4));
console.log(h.toFixed(4));

Measured memory_bytes: 7648
#include<stdio.h>

int main (void){

int a;
int b;

scanf("%d %d", &a, &b);

if (a < b) {  printf("a < b\n");
} else if (a > b) { printf("a > b\n");
} else if (a == b) { printf("a == b\n");
}

return 0;
}

Measured memory_bytes: 1820