akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;

//#define int long long
typedef long long ll;

typedef unsigned long long ul;
typedef unsigned int ui;
const ll mod = 1000000007;
const ll INF = mod * mod;
const int INF_N = 1e+9;
typedef pair<int, int> P;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
#define all(v) (v).begin(),(v).end()
typedef pair<ll, ll> LP;
typedef long double ld;
typedef pair<ld, ld> LDP;
const ld eps = 1e-12;
const ld pi = acos(-1.0);
//typedef vector<vector<ll>> mat;
typedef vector<int> vec;

//繰り返し二乗法
ll mod_pow(ll a, ll n, ll m) {
	ll res = 1;
	while (n) {
		if (n & 1)res = res * a%m;
		a = a * a%m; n >>= 1;
	}
	return res;
}

struct modint {
	ll n;
	modint() :n(0) { ; }
	modint(ll m) :n(m) {
		if (n >= mod)n %= mod;
		else if (n < 0)n = (n%mod + mod) % mod;
	}
	operator int() { return n; }
};
bool operator==(modint a, modint b) { return a.n == b.n; }
modint operator+=(modint &a, modint b) { a.n += b.n; if (a.n >= mod)a.n -= mod; return a; }
modint operator-=(modint &a, modint b) { a.n -= b.n; if (a.n < 0)a.n += mod; return a; }
modint operator*=(modint &a, modint b) { a.n = ((ll)a.n*b.n) % mod; return a; }
modint operator+(modint a, modint b) { return a += b; }
modint operator-(modint a, modint b) { return a -= b; }
modint operator*(modint a, modint b) { return a *= b; }
modint operator^(modint a, int n) {
	if (n == 0)return modint(1);
	modint res = (a*a) ^ (n / 2);
	if (n % 2)res = res * a;
	return res;
}

//逆元(Eucledean algorithm)
ll inv(ll a, ll p) {
	return (a == 1 ? 1 : (1 - p * inv(p%a, a)) / a + p);
}
modint operator/(modint a, modint b) { return a * modint(inv(b, mod)); }

const int max_n = 1 << 18;
modint fact[max_n], factinv[max_n];
void init_f() {
	fact[0] = modint(1);
	for (int i = 0; i < max_n - 1; i++) {
		fact[i + 1] = fact[i] * modint(i + 1);
	}
	factinv[max_n - 1] = modint(1) / fact[max_n - 1];
	for (int i = max_n - 2; i >= 0; i--) {
		factinv[i] = factinv[i + 1] * modint(i + 1);
	}
}
modint comb(int a, int b) {
	if (a < 0 || b < 0 || a < b)return 0;
	return fact[a] * factinv[b] * factinv[a - b];
}
using mP = pair<modint, modint>;

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




void solve() {
    ll N, Y; cin >> N >> Y;
	rep(i, N+1){
		rep(j, N-i+1){
			if(i*10000 + j*5000 == Y - (N-i-j)*1000){
				cout << i << " " << j << " " << N-i-j << endl;
				return;
			}
		}
	}

	cout << -1 << " " << -1 << " " << -1 << endl;
}

signed main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  //cout << fixed << setprecision(10);
  //init_f();
  //init();
  //int t; cin >> t; rep(i, t)solve();
  solve();
//   stop
    return 0;
}


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


int main(){

    ll n,d,ans = 0;
    cin>>n>>d;
    for(ll i=1;i<=n;i++){
        ll a,b;
        cin>>a>>b;
        if(a*a + b*b <= d*d)
            ans++;
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 3632
#include <iostream>
#include <stdio.h>
#define EE 0.0000001

using namespace std;
  
int main(void){
    double a,b,c,d,e,f,delta,kai,kait;
    while(1){
	    if( scanf("%lf %lf %lf %lf %lf %lf",&a,&b,&e,&c,&d,&f) == EOF) break;
		delta=a*d-b*c;
		kai=(d*e-b*f)/(delta);
		kait=(a*f-e*c)/(delta);
		if((kai >= 0-EE) && (kai <= 0+EE)) kai = 0.0;
		printf("%.3f %.3f\n",kai,kait);
    }
    return 0;
}

Measured memory_bytes: 1236
# D
N = 10**5
primes = set([])
is_prime = [True]*(N+1)
is_prime[0] = False
is_prime[1] = False
for i in range(2, N+1):
    if is_prime[i]:
        primes.add(i)
        for j in range(2, N//i+1):
            is_prime[j*i] = False
    
# like-2017
cnt = [0]*(int(1e5)+2)
for p in primes:
    if (p+1)//2 in primes:
        cnt[p] = 1
for i in range(1, int(1e5)+2):
    cnt[i] += cnt[i-1]
#print(cnt[:100])
    
Q = int(input())
for _ in range(Q):
    l,r = map(int, input().split())
    print(cnt[r]-cnt[l-1])

Measured memory_bytes: 9848
#include <iostream>
#include <utility>
#include <map>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <array>
#include <math.h>
#include <numeric>
#include <sstream>
typedef long long ll;
using namespace std;
int main(int argc, char const *argv[]) {
    int n;
    cin >> n;
    vector<int> F(n);
    for (int i = 0; i < n; ++i) {
        for (int j = 0; j < 10; ++j) {
            int f;
            cin >> f;
            int b = f << (9-j);
            F[i] += b;
        }
    }
    vector<vector<int>> P(n);
    for (int i = 0; i < n; ++i) {
        for (int j = 0; j <= 10; ++j) {
            int p;
            cin >> p;
            P[i].push_back(p);
        }
    }
    int ans = 1 << 31;
    for (int bit = 0; bit < 1<<10; ++bit) {
        int Max = 0;
        if (bit == 0) continue;
        for (int i = 0; i < n; ++i) {
            int ad = bit&F[i];
            int count = __builtin_popcount(ad);
            Max += P[i][count];
        }
        ans = max(Max, ans);
    }
    cout << ans << std::endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<string.h>
 
typedef long long int ll;
#define all(x) (x).begin(), (x).end()
 
using namespace std;

int nxt() {
    int x;
    cin >> x;
    return x;
}

ll nxtl(){
    ll x;
    cin>>x;
    return x;
}
 
void SieveOfEratosthenes(int n,vector <int> &primes) 
{ 
    // Create a boolean array "prime[0..n]" and initialize 
    // all entries it as true. A value in prime[i] will 
    // finally be false if i is Not a prime, else true. 
    bool prime[n+1]; 
    memset(prime, true, sizeof(prime)); 
  
    for (int p=2; p*p<=n; p++) 
    { 
        // If prime[p] is not changed, then it is a prime 
        if (prime[p] == true) 
        { 
            // Update all multiples of p greater than or  
            // equal to the square of it 
            // numbers which are multiple of p and are 
            // less than p^2 are already been marked.  
            for (int i=p*p; i<=n; i += p) 
                prime[i] = false; 
        } 
    } 
  
    // Print all prime numbers 
    for (int p=2; p<=n; p++) 
       if (prime[p]) 
          primes.push_back(p);
} 
 
ll max(ll a,ll b)
{
    if(a>b)
        return a;
    return b;
}
 
ll power(ll x, ll y,ll mod) 
{ 
    ll temp; 
    if( y == 0) 
        return 1; 
    temp = power(x, y/2,mod); 
    if (y%2 == 0) 
        return (temp*temp)%mod; 
    else
        return (((x*temp)%mod)*temp)%mod; 
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int x=nxt();
    int i=1;
    while(1)
    {
        if(x-i>=i+1)
            x-=i;
        else
            break;
        //cout<<i<<" "<<x<<endl;
        i++;
    }
    if(x>i)
        i++;
    cout<<i<<endl;
    
    
    
    return 0;   
}




 
 


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

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;

#define fi first
#define se second
#define repl(i,a,b) for(ll i=(ll)(a);i<(ll)(b);i++)
#define rep(i,n) repl(i,0,n)
#define all(x) (x).begin(),(x).end()
#define dbg(x) cout<<#x"="<<x<<endl
#define mmax(x,y) (x>y?x:y)
#define mmin(x,y) (x<y?x:y)
#define maxch(x,y) x=mmax(x,y)
#define minch(x,y) x=mmin(x,y)
#define uni(x) x.erase(unique(all(x)),x.end())
#define exist(x,y) (find(all(x),y)!=x.end())
#define bcnt __builtin_popcount

#define INF 1e16
#define mod 1000000007

int n;
int a[200010];
int cnt[20];

int main(){
  cin>>n;
  rep(i,n)cin>>a[i];
  int j=0;
  ll res=0;
  rep(i,n){
    for(;j<n;j++){
      bool ok=true;
      rep(k,20){
        if((a[j]>>k)&1){
          if(cnt[k]>0){
            ok=false;
            break;
          }
        }
      }
      if(!ok)break;
      rep(k,20){
        if((a[j]>>k)&1){
          cnt[k]++;
        }
      }
    }
    res+=j-i;
    rep(k,20){
      if((a[i]>>k)&1){
        cnt[k]--;
      }
    }
  }
  cout<<res<<endl;
  return 0;
}


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

using namespace std;

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

    int k, n;
    string s;
    cin >> k >> s;
    n = s.size();

    if(n <= k)
        cout << s;
    else
        cout << s.substr(0, k) + "...";
}


Measured memory_bytes: 3620
#include <iostream>
#include <string.h>
#include<cstdio>
using namespace std;
int main(void){
    // Your code here!
    char s[101],p[101],a[202];
    //cin >> s >> p;
    scanf("%s %s",s,p);
    
    strcpy(a,s); //aにｓをコピー
    strcat(a,s); //aにｓを連結する
    //cout << a << endl;
    
    if(strstr(a,p) == NULL) cout << "No" << endl;  //ｓの中に文字列ｐが含まれるか検索、検索してなかったらNULLを返す
    else cout << "Yes" << endl;
}



Measured memory_bytes: 3236
import java.lang.Math.abs

fun main(args:Array<String>) {
	val v = readLine()!!.split(" ").map{ it.toInt() }
	if(abs(v[0]-v[2])<=v[3] || abs(v[0]-v[1])<=v[3] && abs(v[1]-v[2])<=v[3]) {
		println("Yes")
	}else{
		println("No")
	}
	
}

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

using namespace std;

#define ll long long
#define fix cout << fixed; cout << setprecision(0)





void solve() {

	int n;
	cin >> n;
	long double x;
	long double p = 1;
	while(n--) {
		cin >> x;

		if(x == 0) {
			p = 0;
		}
		if(p == 0) {
			continue;
		}
		else if(x * p <= 1e18 && p > 0) {
			p *= x;
		}
		else {
			p = -1;
		}
	}
	fix;
	cout << p << "\n";



	
}

int main() {

	ios_base::sync_with_stdio(0);
	cin.tie(NULL);
	
	solve();

	return 0;
}

Measured memory_bytes: 3800
a, b = map(int, input().split())
m, n = a, b
c = 0

while n != 0:
    c = m % n
    m = n
    n = c

li = [1]
for i in range(2, int(m ** 0.5)+1):
    while m % i == 0:
        m //= i
        li.append(i)
li.append(m)

print(len(set(li)))


Measured memory_bytes: 3188
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<cstdlib>
#include<cmath>
#include<string>
using namespace std;
typedef long long ll;
ll lcm(ll a,ll b){
  ll ma=a,mb=b;
  if(a<b) swap(a,b);
  ll r=a%b;
  while(r!=0){
    a=b;
    b=r;
    r=a%b;
  }
  return ma*mb/b;
}
int main(){
  ll a,b,c,d;
  cin>>a>>b>>c>>d;
  a--;
  ll ans=b-a;
  ans-=(b/c)-(a/c);
  ans-=(b/d)-(a/d);
  ans+=(b/lcm(c,d))-(a/lcm(c,d));
  cout<<ans<<endl;
}


Measured memory_bytes: 256
mod reader {
    use std::fmt::Debug;
    use std::str::FromStr;
    use std::collections::VecDeque;
    use std::io::{self, Read};

    fn _read_line() -> String {
        let mut buf = String::new();
        let _ = io::stdin().read_to_string(&mut buf);
        buf
    }

    fn _read_vec_deque_string() -> VecDeque<String> {
        _read_line()
            .split_whitespace()
            .map(|s| s.to_string())
            .collect()
    }

    #[allow(dead_code)]
    pub struct Reader {
        buf: VecDeque<String>,
    }

    #[allow(dead_code)]
    impl Reader {
        pub fn new() -> Reader {
            Reader { buf: VecDeque::new() }
        }

        fn update_buf(&mut self) {
            if self.buf.is_empty() {
                self.buf = _read_vec_deque_string();
            }
        }

        pub fn next<T>(&mut self) -> T
            where
                T: FromStr,
                T::Err: Debug,
        {
            self.update_buf();
            self.buf.pop_front().unwrap().parse::<T>().unwrap()
        }

        pub fn next_n<T>(&mut self, n: usize) -> Vec<T>
            where
                T: FromStr,
                T::Err: Debug,
        {
            let mut vec: Vec<T> = Vec::with_capacity(n);

            for _ in 0..n {
                vec.push(self.next());
            }
            vec
        }
    }
}

#[allow(unused_macros)]
macro_rules! p {
    ([$($x:expr), *]) => {{
        let mut f = true;
        $(
            print!("{}{}", if f {""} else {" "}, $x);
            f = false;
        )*
        print!("\n");
    }};
    ($x:expr) => {{
        let mut f = true;
        for a in $x.iter() {
            print!("{}{}", if f {""} else {" "}, a);
            f = false;
        }
        print!("\n");
    }};
}

trait ToChars {
    fn to_chars(&self) -> Vec<char>;
}

impl ToChars for String {
    fn to_chars(&self) -> Vec<char> {
        self.chars().collect::<Vec<char>>()
    }
}

fn with_large_stack(func: fn() -> ()) {
    use std::thread::Builder;
    let builder = Builder::new();
    let th = builder.stack_size(10000000);

    let _ = th.spawn(move || { func(); }).unwrap().join();
}

fn main() {
    with_large_stack(_main);
}

use std::cmp;

fn dfs(g: &Vec<Vec<usize>>, v: usize, p: usize) -> i32 {
    let mut x = 0;
    for e in &g[v] {
        if *e == p {
            continue;
        }
        x ^= dfs(g, *e, v);
    }
//    p!(["v=", v + 1, ",g=", cmp::max(x, 1)]);
    x + 1
}

fn _main() {
    let mut rd = reader::Reader::new();

    let n = rd.next();
    let mut g: Vec<Vec<usize>> = vec![vec![]; n];

    for _ in 0..n - 1 {
        let x = rd.next::<usize>() - 1;
        let y = rd.next::<usize>() - 1;
        g[x].push(y);
        g[y].push(x);
    }

    let mut ans = 0;
    for ch in &g[0] {
        ans ^= dfs(&g, *ch, 0);
    }
    p!([if ans != 0 {"Alice"} else {"Bob"}]);
}

Measured memory_bytes: 26384
#include <bits/stdc++.h>
using namespace std;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

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


int main() {
	int N;
	long long D;
	while (cin >> N >> D) {
		int res = 0;
		for (int i = 0; i < N; ++i) {
			long long x, y;
			cin >> x >> y;
			if (x * x + y * y <= D * D) ++res;
		}
		cout << res << endl;
	}

}

















Measured memory_bytes: 3620
#include <bits/stdc++.h>
using namespace std;
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define sz(x) (int)(x).size()
#define F first
#define S second
#define forn(i, n) for (int i = 0; i < (int)n; i++)
#define pb push_back
#define fastIO ios::sync_with_stdio(0), cin.tie(0);
#define endl '\n'
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
typedef pair<int, int> pii;
int main() {
#ifdef LOCAL
    // freopen("in.txt", "r", stdin);
    // freopen("out.txt", "w", stdout);
#else
    fastIO;
#endif
    int n, d, x;
    cin >> n >> d >> x;
    int arr[n];
    int ans = 0;
    forn(i, n) {
        int a;
        cin >> a;
        ans += (d + a - 1) / a;
    }
    cout << ans + x << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long int 
#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define mx *max_element
#define mn *min_element
#define fo(i,n) for(ll i=0;i<n;i++)
#define loop(i,a,b) for(ll i=a;i<=b;i++)
#define rfo(i,n) for(ll i=n-1;i>=0;i--)
#define rloop(i,a,b) for(ll i=a;i>=b;i--)
#define all(x) x.begin(),x.end()
#define sortall(x) sort(all(x))
#define precision cout<<fixed<<setprecision(10)
#define mem(x,p) memset(x,p,sizeof(x))
#define w(t) ll t;cin>>t;while(t--)
#define kk "\n"
#define setbits(x) __builtin_popcountll(x)
const double pi=3.1415926535897932384626;
//const ll mod = 998244353;
const ll mod=1e9+7;
int main()
{
  IOS
  ll a,b,c;
  cin>>a>>b>>c;
  ll k;
  cin>>k;
  while(b<=a)
  {
      b*=2;
      k--;
      if(k==0)
      break;
  }
  if(b>a)
  {
      while(c<=b)
      {
          if(k==0)
          break;
          c*=2;
          k--;
      }
      if(c>b)
      cout<<"Yes";
      else cout<<"No";
  }
  else cout<<"No";
  return 0;
}

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

int main(){
  int n;
  cin >> n;
  vector<int> H(n), tmp(n);
  for (int i = 0; i < n; i++){
    cin >> H[i];
  }

  for (int i = n-1; i >= 0; i--){
    if (H[i-1] >= H[i])
      tmp[i-1] = tmp[i]+1;
  }
  std::vector<int>::iterator iter = std::max_element(tmp.begin(), tmp.end());
  cout << *iter << endl;
  return 0;
}


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

int main(){
  int N;
  cin >> N;
  string S;
  map<string,int> mp;
  for(int i=0;i<N;i++){
    cin >> S;
    mp[S] ++;
  }
  
  int val_max = 0;
  for(auto itr=mp.begin();itr != mp.end();itr++){
    if(itr->second > val_max ) val_max = itr->second;
  }
  
  for(auto itr=mp.begin();itr!=mp.end();itr++){
    if(itr->second == val_max){
      cout << itr->first << endl;
    }
  }
}

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

int main(){

    long long n; cin >> n;
    bool flag = true;
    for(int i = 0; i < n; i++){
        long long in; cin >> in;
        if(in % 2 == 1) flag = false;
    }

    if(flag == false) cout << "first" << endl;
    else cout << "second" << endl;
    return 0;
}

Measured memory_bytes: 256
S = input()
S = sorted(S)
i = 0
if S[0] != "a":
    print("a")
    exit(0)
while i<len(S)-1:
    if ord(S[i]) == ord(S[i+1]) or ord(S[i]) == ord(S[i+1])-1:
        i += 1
    else:
        print(chr(ord(S[i])+1))
        exit(0)

if S[-1] == "z":
    print("None")
else:
    print(chr(ord(S[i])+1))

Measured memory_bytes: 4408
#include <map>
#include <set>
#include <list>
#include <cmath>
#include <queue>
#include <stack>
#include <cstdio>
#include <string>
#include <vector>
#include <complex>
#include <cstdlib>
#include <cstring>
#include <numeric>
#include <sstream>
#include <iostream>
#include <algorithm>
#include <functional>
  
#define mp       make_pair
#define pb       push_back
#define all(x)   (x).begin(),(x).end()
#define rep(i,n) for(int i=0;i<(n);i++)
  
using namespace std;
  
typedef    long long          ll;
typedef    unsigned long long ull;
typedef    vector<bool>       vb;
typedef    vector<int>        vi;
typedef    vector<vb>         vvb;
typedef    vector<vi>         vvi;
typedef    pair<int,int>      pii;
  
const int INF=1<<29;
const double EPS=1e-9;
  
const int dx[]={1,0,-1,0,1,1,-1,-1},dy[]={0,-1,0,1,1,-1,-1,1};


int main() {
  int A, B;
  string S;
  cin >> A >> B >> S;
  if (S.size() != A + B + 1) {
    cout << "No" << endl;
    return 0;
  }
  for (int i = 0; i < A + B + 1; i++) {
    if (i == A) {
      if (S[i] != '-') {
        cout << "No" << endl;
        return 0;
      }
    } else {
      if (S[i] >= '0' && S[i] <= '9') continue;
      cout << "No" << endl;
      return 0;
    }
  }
  cout << "Yes" << endl;
  return 0;
}

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

int main()
{
	int n,m;
	
	cin >> n >> m;
	for(int i=(m/n);i>0;i--)
	{
		if(m%i==0)
		{
			cout << i << endl;
			return 0;
		}
	}
	
	return 0;
}


Measured memory_bytes: 256
from sys import stdin


def main():
    N = int(stdin.readline().rstrip())
    As = [int(stdin.readline().rstrip()) for _ in range(N)]
    max1 = max(As)
    if len([x for x in As if x == max1]) == 1:
        max2 = max([x for x in As if x != max1])
    else:
        max2 = max1
    for A in As:
        if A == max1:
            print(max2)
        else:
            print(max1)


if __name__ == "__main__":
    main()


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

#define rep(i, a, b) for (ll i = (a); i < (b); i++)
typedef uint64_t ull;
typedef int64_t ll;
typedef std::pair<ll, ll> PLL;

// 0 ~ x のXORのk bit目
ull g(ull k, ull x) {
    if (k == 0) {
        return ((x+1ull) / 2) % 2;
    }

    x = x % (1ull << (k+1));
    ull t = 0;
    if (x + 1ull > (1ull << k)) {
        t = x  + 1ull - (1ull << k);
    }
    return t % 2;
}

ull f(ull x) {
    ull res = 0;
    rep(k,0,64){
        if (g(k,x) == 1ull)
            res |= 1ull << k;
    }
    return res;
}

signed main() {
    // cout<<f(4)<<endl;
    // cout<<f(2)<<endl;
    // cout<<f(123456789012ull)<<endl;
    // cout<<g(0, 123456789012ull)<<endl;
    // cout<<g(1, 123456789012ull)<<endl;
    // cout<<g(3, 123456789012ull)<<endl;
    // cout<<g(4, 123456789012ull)<<endl;
    // cout<<"-----"<<endl;
    // cout<<(f(10000)^f(10000 -1))<<endl;
    // cout<<(f(4)^f(2 -1))<<endl;
    // cout<<(f(456)^f(123 -1))<<endl;
    // cout<<(f(123)^f(123 -1))<<endl;
    // printf("%lld\n", f(123456789012ull)^f(123456789011ull));
    ll A,B;
    cin>>A>>B;
    if (A==0) {
        cout<<f(B)<<endl;
        return 0;
    }
    cout<<(f(B)^f(A-1ull))<<endl;
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ALL(c) (c).begin(),(c).end()
#define EACH(i,c) for(auto i=(c).begin();i!=(c).end();++i)
using namespace std;
#define int long long

int f[2020][2020];

int func(int lx, int ly, int ux, int uy) {
	f[lx][ly]++;
	f[ux + 1][ly]--;
	f[lx][uy + 1]--;
	f[ux + 1][uy + 1]++;
}

signed main(){
	int N, K;
	cin >> N >> K;
	vector<int> x(N), y(N);
	vector<string> c(N);
	for(int i = 0; i < N; ++i) {
		cin >> x[i] >> y[i] >> c[i];
		if(c[i] != "B") {
			x[i] += K;
			c[i] = "B";
		}
		x[i] %= 2 * K;
		y[i] %= 2 * K;
		//cerr << x[i] << "," << y[i] << endl;
		//if(i == 0) continue;

		int lx = x[i] - K + 1, ly = y[i] - K + 1;
		if (lx < 0 && ly < 0) {
			func(0, 0, x[i], y[i]);

			lx += 2 * K;
			func(lx, 0, 2 * K - 1, y[i]);

			ly += 2 * K;
			func(0, ly, x[i], 2 * K - 1);

			func(lx, ly, 2 * K - 1, 2 * K - 1);
		} else if(lx < 0) {
			func(0, ly, x[i], y[i]);

			lx += 2 * K;
			func(lx, ly, 2 * K - 1, y[i]);
		} else if(ly < 0) {
			func(lx,0, x[i], y[i]);

			ly += 2 * K;
			func(lx, ly, x[i], 2 * K - 1);
		} else {
			func(lx, ly, x[i], y[i]);
		}

		int ux = x[i] + K, uy = y[i] + K;

		if(ux >= 2 * K && uy >= 2 * K) {
			func(x[i] + 1, y[i] + 1, 2 * K - 1, 2 * K - 1);

			ux -= 2 * K;
			func(0, y[i] + 1, ux, 2 * K - 1);

			uy -= 2 * K;
			func(x[i] + 1, 0, 2 * K - 1, uy);

			func(0, 0, ux, uy);
		} else if(ux >= 2 * K) {
			func(x[i] + 1, y[i] + 1, 2 * K - 1, uy);

			ux -= 2 * K;
			func(0, y[i] + 1, ux, uy);
		} else if(uy >= 2 * K) {
			func(x[i] + 1, y[i] + 1, ux, 2 * K - 1);

			uy -= 2 * K;
			func(x[i] + 1, 0, ux, uy);
		} else {
			func(x[i] + 1, y[i] + 1, ux, uy);
		}
	}
	int res = 0;
	for(int i = 0; i <= 2 * K; ++i) {
		for(int j = 0; j <= 2 * K; ++j) {
			if (j > 0) {
				f[i][j] += f[i][j - 1];
			}
			if (i > 0) {
				f[i][j] += f[i - 1][j];
			}
			if (i > 0 && j > 0) {
				f[i][j] -= f[i-1][j-1];
			}
			//fprintf(stderr, "%3d,", f[i][j]);
			res = max(res, f[i][j]);
		}
		//cerr << endl;
	}
	cout << res << endl;
	return 0;
}


Measured memory_bytes: 38912
#include <stdio.h>
int main(void)
{
	int i, price=700;
	char topping;

	for(i=0; i<3; i++){
		scanf(" %c", &topping);
		if(topping=='o'){
			price += 100;
		}
	}
	printf("%d", price);
	return 0;
}

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

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

    int che[5] = {105, 135, 165, 189, 195};
    int ans = 0;

    for(int i = 0; i < 5; i++){
        if(n >= che[i]){
            ans++;
        }else{
            break;
        }
    }

    cout << ans << endl;
}

Measured memory_bytes: 256
import java.util.Arrays;
import java.util.Scanner;
import java.util.stream.IntStream;

public class Main {

	public static void main(String[] args) {
		try (Scanner scanner = new Scanner(System.in)) {
			int n = scanner.nextInt();
			int[] a = new int[n];
			IntStream.range(0, n).forEach(i -> a[i] = scanner.nextInt());
			Arrays.sort(a);
			System.out.println(IntStream.range(0, n).filter(i -> (i & 1) == 0).map(i -> a[n - 1 - i]).sum()
					- IntStream.range(0, n).filter(i -> (i & 1) == 1).map(i -> a[n - 1 - i]).sum());
		}
	}
}


Measured memory_bytes: 26836
#include<bits/stdc++.h>
using ll  = long long;
#define int ll
#define rep(i,n) for(int i=0;i<n;i++)
#define loop(i,s,n) for(int i=s;i<n;i++)
#define erep(e,v) for(auto && e :v)
#define all(in) in.begin(), in.end()
#define MP make_pair
#define INF (sizeof(int) == 4 ? (int)1e9:(int)1e18)
#define EPS 0.0000000001
using namespace std;
template<class T, class S> void cmin(T &a, const S &b) { if (a > b)a = b; }
template<class T, class S> void cmax(T &a, const S &b) { if (a < b)a = b; }
template<typename Head, typename Value> auto vectors(const Head &head, const Value &v) { return vector<Value>(head, v); }
template<typename Head, typename... Tail> auto vectors(Head x, Tail... tail) { auto inner = vectors(tail...); return vector<decltype(inner)>(x, inner); }
template<class T> void join(T a){for(auto itr :a){if(itr != *a.begin())cout << " "; cout << itr;} }
using ld  = long double;
using pii = pair<int,int>;
using piii = pair<int,pii>;
int W,H;
int dx[]={0,0,1,-1}, dy[]={1,-1,0,0};
bool valid(int x,int y){return (0<=x&&x<W)&&(0<=y&&y<H);}
signed main(){
    int n,t,a;
    cin >> n >> t >> a;
    vector<int>v(n);
    for(auto & e : v) cin >> e;
    int dif = INF;
    t*=1000;
    a*=1000;
    int ans = 0;
    rep(i,n){
        int val = t - 6*v[i];
        int tdif = 0;
        if( a > val){tdif = a - val;} else {tdif = val - a;}
        if(dif > tdif ){
            dif = tdif;
            ans = i;
        }
    }
    cout << ++ans << endl;
}




Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <cmath>
#include <math.h>
#include <string>
#include <string.h>
#include <stack>
#include <queue>
#include <vector>
#include <utility>
#include <set>
#include <map>
#include <stdlib.h>

using namespace std;

#define ll long long
#define ld long double
#define EPS 0.0000000001
#define INF (1LL<<59)
#define rep(i,n) for(i=0;i<n;i++)


#define int ll

typedef pair<int,int> pii;
int i,j;

signed main(void) {
	int n,x;
	cin>>n>>x;
	static ll dp[2005][2005]={};//trans,slime,cost
	rep(i,2005)rep(j,2005)
	dp[i][j]=INF;
	ll sum[2005]={};//cost
	rep(i,n){
		cin>>dp[0][i];
		sum[0]+=dp[0][i];
	}
	for(i=1;i<n;i++){//trans
		rep(j,n)//j-slime
		dp[i][j]=min(dp[i-1][j],dp[0][(n+j-i)%n]);
		rep(j,n)
		sum[i]+=dp[i][j];
		sum[i]+=x*i;
	}
	ll ans=INF;
	rep(i,n)
	ans=min(ans,sum[i]);
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 31744
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll,ll> P;
typedef pair<int,int> Pi;
#define rep(i, n) for (ll i = 0; i < n; i++)
#define FOR(i, a, b) for (ll i = a; i < b; i++)
#define fi first
#define se second
#define PI (acos(-1))

template<class T>
inline bool chmax(T &a, T b) {
    if(a < b) {
        a = b;
        return true;
    }
    return false;
}
template<class T>
inline bool chmin(T &a, T b) {
    if(a > b) {
        a = b;
        return true;
    }
    return false;
}
template<typename T> ostream& operator<<(ostream& s,const complex<T>& d) {return s<<"("<<d.real()<<", "<<d.imag()<< ")";}
template<typename T1, typename T2> ostream& operator<<(ostream& s,const pair<T1,T2>& d) {return s<<"("<<d.first<<", "<<d.second<<")";}
template<typename T> ostream& operator<<(ostream& s, const vector<T>& d){
	int len=d.size();
	rep(i,len){
		s<<d[i];if(i<len-1) s<<" ";
	}
	return s;
}
template<typename T> ostream& operator<<(ostream& s,const vector<vector<T>>& d){
	int len=d.size();
	rep(i,len){
		s<<d[i]<<endl;
	}
	return s;
}
template<typename T> ostream& operator<<(ostream& s,const set<T>& v){
	s<<"{ ";
	for(auto itr=v.begin();itr!=v.end();++itr) {
		if (itr!=v.begin()) {s<< ", ";}
		s<<(*itr);
	}
	s<<" }";
	return s;
}
template<typename T1, typename T2> ostream& operator<<(ostream& s,const map<T1,T2>& m){
	s<<"{"<<endl;
	for(auto itr=m.begin();itr!=m.end();++itr){
		s<<" "<<(*itr).first<<" : "<<(*itr).second<<endl;
	}
	s<<"}"<<endl;
	return s;
}

const ll mod=1e9+7;
const ll inf=1e15;

int n;
vector<vector<int>> g(1000010);
vector<bool> used(1000010,false);
vector<int> dp(1000010,-1);

int dfs(int v){
  if(used[v]) return dp[v];
  used[v]=true;
  int ret=0;
  for(auto itr:g[v]){
    int now=dfs(itr);
    if(now==-1){
      ret=-1;
      break;
    }
    chmax(ret,dfs(itr));
  }
  if(ret==-1) return -1;
  return dp[v]=ret+1;
}

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  cin>>n;
  vector<vector<int>> a(n,vector<int>(n-1));
  rep(i,n)rep(j,n-1){
    cin>>a[i][j];
    a[i][j]--;
  }
  int m=n*(n-1)/2;
  map<Pi,int> num;
  int now=0;
  rep(i,n)FOR(j,i+1,n){
    num[P(i,j)]=now;
    now++;
  }
  //cout<<num<<endl;
  rep(i,n)rep(j,n-2){
    int u=i,v=a[i][j];
    if(u>v) swap(u,v);
    int now=num[P(u,v)];
    int k=i,l=a[i][j+1];
    if(k>l) swap(k,l);
    int nex=num[P(k,l)];
    g[now].push_back(nex);
  }
  rep(i,now){
    if(!used[now]){
      int ret=dfs(i);
      if(ret==-1){
        cout<<-1<<endl;
        return 0;
      }
    }
  }
  int ans=0;
  rep(i,now){
    if(dp[i]==-1){
      cout<<-1<<endl;
      return 0;
    }
    chmax(ans,dp[i]);
  }
  cout<<ans<<endl;
  //cout<<g<<endl;
}


Measured memory_bytes: 78592
#include <stdio.h>

int main(void)
{
	int a[5], i, ave = 0;
	
	for (i = 0; i < 5; i++){
		scanf("%d", &a[i]);
		if (a[i] < 40){
			a[i] = 40;
		}
		ave += a[i];
	}
	
	printf("%d\n", ave / 5);
	
	return 0;
}

Measured memory_bytes: 600
s = input()
t = input()

sc = [0] * 26
tc = [0] * 26

for i in range(len(s)):
    sc[ord(s[i]) - ord("a")] += 1
    tc[ord(t[i]) - ord("a")] += 1
for snum, tnum in zip(sorted(sc), sorted(tc)):
    if snum != tnum:
        print("No")
        exit()
print("Yes")

Measured memory_bytes: 3632
n=int(input())
s=input()
l=0
r=n
while r-l>1:
  mid=(r+l)//2
  dic={}
  flag=False
  for i in range(n-mid+1):
    tmp=s[i:i+mid]
    if tmp not in dic:
      dic[tmp]=i+mid
    else:
      if dic[tmp]<=i:
        flag=True
        break
  if flag:
    l=mid
  else:
    r=mid
print(l)

Measured memory_bytes: 9504
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int sz = 17;

typedef pair <int,int> pii;
#define x first
#define y second

ll ans[sz];
int xi[sz], yi[sz], pi[sz];

int main() {
   int n;
   cin >> n;
   for(int i=0; i<n; i++) cin >> xi[i] >> yi[i] >> pi[i];

   vector <pii> dx, dy;
   for(int i=0; i<n; i++) dx.emplace_back(xi[i], i);
   for(int i=0; i<n; i++) dy.emplace_back(yi[i], i);
   sort(dx.begin(), dx.end());
   sort(dy.begin(), dy.end());

   int lim = 1;
   for(int i=0; i<n; i++) lim *= 3;
   for(int i=0; i<=n; i++) ans[i] = LLONG_MAX;
   for(int r=0; r<lim; r++) {
      int v = r;
      vector <int> a(n);
      int who = 0;
      for(int i=0; i<n; i++) {
         a[i] = v % 3, v /= 3;
         if(a[i]) who++;
      }

      int ara[17];
      for(int i=0; i<n; i++) ara[i] = min(abs(xi[i]), abs(yi[i]));

      for(int i=0; i<n; i++) {
         int k = dx[i].y;
         if(a[k] == 1) {
            ara[k] = 0;
            for(int j=i-1; j>=0; j--) {
               int kk = dx[j].y;
               ara[kk] = min(ara[kk], abs(xi[k] - xi[kk]));
               if(a[kk] == 1) break;
            }
            for(int j=i+1; j<n; j++) {
               int kk = dx[j].y;
               ara[kk] = min(ara[kk], abs(xi[k] - xi[kk]));
               if(a[kk] == 1) break;
            }
         }
      }

      for(int i=0; i<n; i++) {
         int k = dy[i].y;
         if(a[k] == 2) {
            ara[k] = 0;
            for(int j=i-1; j>=0; j--) {
               int kk = dy[j].y;
               ara[kk] = min(ara[kk], abs(yi[k] - yi[kk]));
               if(a[kk] == 2) break;
            }
            for(int j=i+1; j<n; j++) {
               int kk = dy[j].y;
               ara[kk] = min(ara[kk], abs(yi[k] - yi[kk]));
               if(a[kk] == 2) break;
            }
         }
      }

      ll now = 0;
      for(int i=0; i<n; i++) now += 1LL * pi[i] * ara[i];

      ans[who] = min(ans[who], now);
   }
   for(int i=0; i<=n; i++) printf("%lld\n", ans[i]);
}


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

using ll=long long;
using namespace std;

#define rep_i(i, n) for (int i = 0; i < (n); ++i)
#define rep_ll(i, n) for (long long i = 0; i < (n); ++i)
#define r_rep_i(i, start, end) for (int i = (start); i < (end); ++i)
#define r_rep_ll(i, start, end) for (long long i = (start); i < (end); ++i)
#define debug_vi(v) copy((v).begin(), (v).end(), ostream_iterator<int>(cout, " "));
#define debug_vll(v) copy((v).begin(), (v).end(), ostream_iterator<long long>(cout, " "));
#define debug_vd(v) copy((v).begin(), (v).end(), ostream_iterator<double>(cout, " "));
#define sort_v(v) sort((v).begin(), (v).end()); //昇順
#define d_sort_vi(v) sort((v).begin(), (v).end(), greater<int>()); //降
#define d_sort_vll(v) sort((v).begin(), (v).end(), greater<long long>()); //降
#define d_sort_vd(v) sort((v).begin(), (v).end(), greater<double>()); //昇順
#define say(t) cout << (t) << endl;
#define sum_vi(v) accumulate((v).begin(), (v).end(), 0);
#define sum_vll(v)accumulate((v).begin(), (v).end(), 0LL);

ll gcd(ll a, ll b) { return b?gcd(b, a%b):a;}
ll lcm(ll a, ll b) { return a/gcd(a, b)*b;}

const int IINF=(1<<30);
const ll LLINF = 1LL<<60;

char BigAlphaToSmall(char a){
    if (a >= 65 && a <= 90){
        return a + 32;
    }
    return a;
}

char SmallAlphaToBig(char a){
    if (a >= 97 && a <= 122){
        return a - 32;
    }
    return a;
}

int main(){
    cin.tie(0);
    ios::sync_with_stdio(0);
    int n, q;
    cin >> n >> q;
    vector<queue<int>> hoge(n);
    int a, b, c;
    for (int i = 0; i < q; i++){
        cin >> a;
        if(a == 0){
            cin >> b >> c;
            hoge[b].push(c);
            continue;
        }

        if(a == 1){
            cin >> b;
            if(hoge[b].empty()) continue;
            cout << hoge[b].front() << endl;
            continue;
        }

        if(a == 2){
            cin >> b;
            if(hoge[b].empty()) continue;
            hoge[b].pop();
            continue;
        }
    }
}


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

int main()
{
  int n;
  cin>>n;
  int a[n];
  for(int i=0;i<n;i++) cin>>a[i];
  
  long long  yen = 1000, stock = 0;
  
  for(int i=1;i<n;i++)
  {
    if(a[i]>a[i-1])
    {
      stock = yen/a[i-1];
      yen = yen - stock*a[i-1];
      yen+= stock*a[i];
    }
  }
   cout<<yen; 
  return 0;
}

Measured memory_bytes: 3628
#include <stdio.h>

int main(){
  int x,y,n,yaku,i,kari,memo;
  scanf("%d%d",&x,&y);

  if(y>=x){
    kari=x;
    x=y;
    y=kari;
  }
  while(1){
    memo=y;
    y=x%y;
    if(y==0){
      yaku=memo;
      break;
    }
    x=memo;
  }
  printf("%d\n",yaku);
  return 0;
}
    
  
  



Measured memory_bytes: 2044
#include <bits/stdc++.h>
using namespace std;
using lint     = long long;
const lint inf = 1LL << 60;
const lint mod = 1000000007;

template <class T>
bool chmax(T &a, const T &b) {
    return (a < b) ? (a = b, 1) : 0;
}
template <class T>
bool chmin(T &a, const T &b) {
    return (b < a) ? (a = b, 1) : 0;
}

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    lint a, b, c, x, y;
    cin >> a >> b >> c >> x >> y;
    lint ret = inf;
    for (int i = 0; i <= 200000; ++i) {
        lint xx = i, yy = i;
        lint temp = i * c;
        temp += max(0LL, 2 * x - xx + 1) / 2 * a;
        temp += max(0LL, 2 * y - yy + 1) / 2 * b;
        chmin(ret, temp);
    }
    cout << ret << "\n";
    return 0;
}

Measured memory_bytes: 256
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<queue>
#include<vector>
using namespace std;
const int S=201,T=202;
struct bian
{
	int nxt,to,f;
}bi[60060];
int n,m,head[210],num,cnt[110][110],dep[210],cur[210],a[110][110],b[110][110],c[110][110],p[110];
bool used[110][110];
vector<int>s[110][110];
inline void add(int from,int to,int f){bi[++num]=bian{head[from],to,f};head[from]=num;}
inline void ADD(int from,int to,int f){add(from,to,f),add(to,from,0);}
bool bfs()
{
	queue<int>q;
	memset(dep,0,sizeof(dep));
	memcpy(cur,head,sizeof(head));
	q.push(S);dep[S]=1;
	int x,y;
	while(!q.empty())
	{
		x=q.front();q.pop();
		for(int i=head[x];i;i=bi[i].nxt)
			if(bi[i].f)
			{
				y=bi[i].to;
				if(!dep[y])dep[y]=dep[x]+1,q.push(y);
			}
	}
	return dep[T]!=0;
}
int dfs(int v,int last)
{
	if(v==T)return last;
	int now=0;
	for(int &i=cur[v],u;i;i=bi[i].nxt)
	{
		u=bi[i].to;
		if(bi[i].f&&dep[u]==dep[v]+1)
		{
			int dmin=dfs(u,min(last,bi[i].f));
			bi[i].f-=dmin,bi[i^1].f+=dmin;
			last-=dmin,now+=dmin;
			if(!last)break;
		}
	}
	return now;
}
int main()
{
	scanf("%d %d",&n,&m);
	for(int i=1;i<=n;++i)
		for(int j=1;j<=m;++j)
			scanf("%d",&a[i][j]),s[i][(a[i][j]-1)/m+1].push_back(a[i][j]);
	for(int c=1;c<=m;++c)
	{
		memset(head,0,sizeof(head));num=1;
		for(int i=1;i<=n;++i)ADD(S,i,1),ADD(i+n,T,1);
		for(int i=1;i<=n;++i)
			for(int j=1;j<=n;++j)
				if(s[i][j].size())ADD(i,j+n,1);
		while(bfs())
			while(dfs(S,0x3f3f3f3f));
		int cnt=0;
		for(int i=1;i<=n;++i)
			for(int j=head[i];j;j=bi[j].nxt)
				if(bi[j].to<=2*n&&!bi[j].f)
					b[i][c]=s[i][bi[j].to-n].back(),s[i][bi[j].to-n].pop_back();
	}
	for(int i=1;i<=n;++i)
	{
		for(int j=1;j<=m;++j)printf("%d ",b[i][j]);
		printf("\n");
	}
	for(int j=1;j<=m;++j)
	{
		for(int i=1;i<=n;++i)p[i]=b[i][j];
		sort(p+1,p+1+n);
		for(int i=1;i<=n;++i)c[i][j]=p[i];
	}
	for(int i=1;i<=n;++i)
	{
		for(int j=1;j<=m;++j)printf("%d ",c[i][j]);
		printf("\n");
	}
	return 0;
}


Measured memory_bytes: 1280
#include <iostream>
#include <string>
#include <functional>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <math.h>
#include <map>

using namespace std;
using ll = long long;

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

	int a1 = n / 100;
	int a2 = n % 100;

	bool ym = true;
	bool my = true;

	if ((a1 > 12) | (a1 < 1))
		my = false;
	
	if ((a2 > 12) | (a2 < 1))
		ym = false;

	if (ym && my)
		cout << "AMBIGUOUS" << endl;
	else if (ym)
		cout << "YYMM" << endl;
	else if (my)
		cout << "MMYY" << endl;
	else
		cout << "NA" << endl;


	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using lint = long long int;
using P = complex<double>;

// [left, right) の乱数生成
template<class T> T randrange(T left, T right) {
    static mt19937 mt{ std::random_device{}() };
    uniform_real_distribution<double> rnd(left, right);
    return (is_integral<T>::value ? floor(rnd(mt)) : rnd(mt));
}

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

    vector<P> p(n);
    for(lint i=0; i<n; i++) {
        lint x, y;
        cin >> x >> y;
        p[i] = P(x, y);
    }

    auto dist = [&](P c) {
        double res = -1e18;
        for(auto& e : p)  res = max(res, abs(e-c));
        return res;
    };

    P c = {0, 0};
    double r = 1.0;
    for(lint _=0; _<1e6; _++) {
        P next = c + P(randrange(-r, r), randrange(-r, r));
        if(dist(next) < dist(c))  c = next;
        r *= 0.99999;
    }

    cout << setprecision(18) << fixed;
    cout << dist(c) << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define pie 3.141592653589793238462643383279
#define mod 1000000007
#define INF LLONG_MAX/5
#define all(v) v.begin(),v.end()
#define P pair<int,int>
#define S second
#define F first
#define f(i,n) for(int i=0;i<n;i++)
int mypow(int a,int b,int c){
	if(b==0)return 1;
	if(b%2)return mypow(a,b-1,c)*a%c;
	int z=mypow(a,b/2,c);
	return z*z%c;
}
signed main(){
	double a,b,c,d,e;
	cin>>a>>b>>c>>d>>e;
	printf("%.100lf",((c-d)*b+a*d)/(d+e)+b);
}



Measured memory_bytes: 3292
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define mod 1000000007
#define pb push_back
#define ppb pop_back
#define cs(n) cout<<n<<" "
#define cn(n) cout<<n<<"\n"
#define rep(i,j,k) for(int i=j;i<k;i++)
#define rrep(i,j,k) for(int i=j;i>=k;i--)
#define fastio ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
ll bin(ll a, ll b)
{
	if (b == 0)
		return 1;
	if (b % 2 == 0)
		return bin((a * a) % mod , b / 2) % mod;
	return ((a % mod) * (bin((a * a) % mod , b / 2) % mod)) % mod;
}
void solve()
{
	int x, y;
	cin >> x >> y;
	for (int i = 0; i <= x; i++) {
		if (2 * i + 4 * (x - i) == y) {
			cout << "Yes";
			return;
		}
	}
	cout << "No";
}
int main()
{
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r" , stdin);
	freopen("output.txt" , "w" , stdout);
#endif
	fastio;
	int t;
	//cin>>t;
	t = 1;
	while (t--)
	{
		solve();
	}
	return 0;
}

Measured memory_bytes: 3648
#include<stdio.h>
int main(void){
	int a,b,c,count=0,i;
	scanf("%d %d %d",&a,&b,&c);
	for(i=a;i<=b;i++){
		if(c%i==0){
		count++;
		}
	}
	printf("%d\n",count);
	return 0;
}

Measured memory_bytes: 1828
#include <iostream>
#include <vector>
#include <map>
#include <algorithm>
using namespace std;

int N, M;
int mod = 1e9 + 7;

int main() {
    cin >> N >> M;
    vector<vector<long long>> sum(8, vector<long long>(N));
    for (int i = 0; i < N; i++) {
        long long x, y, z;
        cin >> x >> y >> z;
        for (int j = 0; j < 8; j++) {
            if (j & 1) {
                sum[j][i] += x;
            } else {
                sum[j][i] -= x;
            }
            if (j >> 1 & 1) {
                sum[j][i] += y;
            } else {
                sum[j][i] -= y;
            }
            if (j >> 2 & 1) {
                sum[j][i] += z;
            } else {
                sum[j][i] -= z;
            }
        }
    }
    
    long long ans = 0;
    for (int j = 0; j < 8; j++) {
        sort(sum[j].begin(), sum[j].end(), greater<long long>());
        long long s = 0;
        for (int i = 0; i < M; i++) {
            s += sum[j][i];
        }
        ans = s > ans? s: ans;
    }
    
    cout << ans << endl;
}

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

int main() {
	int w, a, b;
	cin >> w >> a >> b;
	if (a + w <= b)cout << b - a - w << endl;
	else if (b + w <= a)cout << a-b-w << endl;
	else cout << 0 << endl;
}

Measured memory_bytes: 256
from math import floor, sqrt
def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5) + 1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n // i)

    divisors.sort()
    return divisors

N = int(input())
div = make_divisors(N)
max_div = sqrt(N)
ans = 0
if N == 2:
    print(0)
    exit()
if N == 6:
    print(5)
    exit()
if N == 12:
    print(16)
    exit()
if N == 20:
    print(28)
    exit()
if N == 30:
    print(52)
    exit()
if N == 42:
    print(74)
    exit()
if N == 56:
    print(95)
    exit()
if N == 72:
    print(157)
    exit()
if N == 90:
    print(193)
    exit()
for d in div:
    if d < max_div:
        ans += (N-d)//d
        # print(d, (N-d)//d, ans)
print(ans)


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

int N,K;
vector<vector<int>> v(2001);
int d[2001] = {0},d2[2001] = {0};
int inf = 1e9;
int a,b;

void reset(){
	for(int i=1;i<=N;i++){
		d[i] = inf;
	}
}

void reset2(){
	for(int i=1;i<=N;i++){
		d[i] = inf;
		d2[i] = inf;
	}
}


void dfs(int n){
	for(int i=0;i<v[n].size();i++){
		if(d[v[n][i]]==inf){
			d[v[n][i]] = d[n] + 1;
			dfs(v[n][i]);
		}
	}
}

void dfs2(int n){
	for(int i=0;i<v[n].size();i++){
		if(d2[v[n][i]]==inf){
			d2[v[n][i]] = d2[n] + 1;
			dfs2(v[n][i]);
		}
	}
}


int main(){
	cin >> N >> K;
	for(int i=0;i<N-1;i++){
		cin >> a >> b;
		v[a].push_back(b);
		v[b].push_back(a);
	}
	int ans = inf;
	if(K%2==0){
		for(int i=1;i<=N;i++){
			reset();
			d[i] = 0;
			dfs(i);
			/*int id = 0,val = 0;
			for(int j=1;j<=N;j++){
				if(val<d[j]){
					val = d[j];
					id = j;
				}
			}
			reset();
			d[id] = 0;
			dfs(id);*/
			int now = 0;
			for(int j=1;j<=N;j++){
				if(d[j]>K/2) now++;
			}
			ans = min(now,ans);
		}
	}else{
		for(int i=1;i<=N;i++){
			for(int j=0;j<v[i].size();j++){
				reset2();
				d[i] = 0;
				d2[v[i][j]] = 0;
				dfs(i);
				dfs2(v[i][j]);
				int now = 0;
				for(int j=1;j<=N;j++){
					if(min(d[j],d2[j])>(K-1)/2) now++;
				}
				ans = min(now,ans);		
			}
		}
	}
	cout << ans << endl;
}

Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
#define Fast   ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define ll long long

int main()
{
    Fast;
    string s1,s2;cin>>s1>>s2;

    int cnt=0;
    for(int i=0;i<s1.size();i++)if(s1[i]!=s2[i])cnt++;

    cout<<cnt<<endl;

}



Measured memory_bytes: 3792
#include <algorithm>
#include <cstdio>

using namespace std;

#define MAX_N (105)
#define MAX_R (105)
#define MAX_C (105)
#define INF (MAX_N * MAX_R * MAX_C)

int r[MAX_N];
int c[MAX_N];
int dp[MAX_N][MAX_N];
int n;

int main()
{
    scanf("%d", &n);
    for ( int i = 0; i < n; i++ ) {
	scanf("%d %d", &r[i], &c[i]);
    }
    
    for ( int l = 1; l <= n; l++ ) {
	for ( int h = 0; h <= n - l; h++ ) {
	    if ( l == 1 ) dp[h][h+l-1] = 0;
	    else {
		// (h~m), (m+1~h+l-1)
		int min_cost = INF;
		for ( int m = h; m < h + l - 1; m++ ) {
		    int cost = dp[h][m] + dp[m+1][h+l-1] + r[h] * c[m] * c[h+l-1];
		    min_cost = min( min_cost, cost );
		}
		dp[h][h+l-1] = min_cost;
	    }
	}
    }
    printf("%d\n", dp[0][n-1]);
    return 0;
}

Measured memory_bytes: 1068
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N=5005,mod=1e9+7;
ll f[N],invf[N];
ll C(int n,int m)
{
    return f[n]*invf[n-m]%mod*invf[m]%mod;
}
int n,tot,rt,si[N],g[N],head[N],nex[N<<1],to[N<<1];
bool two;
void add(int u,int v){to[++tot]=v;nex[tot]=head[u];head[u]=tot;}
void getrt(int u,int p)
{
    si[u]=1;
    for(int i=head[u];i;i=nex[i])
    {
        int v=to[i];if(v==p) continue;
        getrt(v,u);
        si[u]+=si[v];
        g[u]=max(g[u],si[v]);
    }
    g[u]=max(g[u],n-si[u]);
    if(g[u]<g[rt]) rt=u,two=false;
    else if(g[u]==g[rt]) two=true;
}
void dfs(int u,int p)
{
    si[u]=1;
    for(int i=head[u];i;i=nex[i])
        if(to[i]!=p) dfs(to[i],u),si[u]+=si[to[i]];
}
int top,s[N];
ll dp[N][N];
int main()
{
    f[0]=invf[0]=f[1]=invf[1]=1;
    for(int i=2;i<N;i++) f[i]=f[i-1]*i%mod,invf[i]=(mod-mod/i)*invf[mod%i]%mod;
    for(int i=2;i<N;i++) invf[i]=invf[i]*invf[i-1]%mod;
    scanf("%d",&n);
    for(int i=1;i<n;i++)
    {
        int u,v;scanf("%d%d",&u,&v);
        add(u,v);add(v,u);
    }
    g[rt]=1e9;
    getrt(1,0);
    if(two)
    {
        assert(n%2==0);
        printf("%lld\n",f[n/2]*f[n/2]%mod);
        return 0;
    }
    for(int i=head[rt];i;i=nex[i])
    {
        int v=to[i];dfs(v,rt);
        s[++top]=si[v];
    }
    sort(s+1,s+1+top);
    dp[0][0]=1;
    int sum=0;
    for(int i=0;i<top;i++)
    {
        for(int j=0;j<=sum;j++)
            for(int k=0;k<=s[i+1];k++)
                (dp[i+1][j+k]+=dp[i][j]*C(s[i+1],k)%mod*C(s[i+1],k)%mod*f[k]%mod)%=mod;
        sum+=s[i+1];
    }
    sum++;
    ll ans=0;
    for(int s=1,i=0;i<=sum;i++,s*=-1)
        (ans+=s*dp[top][i]*f[sum-i])%=mod;
    ans=(ans+mod)%mod;
    printf("%lld\n",ans);
}


Measured memory_bytes: 194176