akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
using i64 = int64_t;
using vi = vector<i64>;
using vvi = vector<vi>;
constexpr i64 MOD = 1e9 + 7;

i64 modpow(i64 a, i64 n, i64 mod) {
    if (n == 0) return 1;
    if (n % 2 == 0) {
        i64 t = modpow(a, n / 2, mod);
        return t * t % mod;
    }
    return a * modpow(a, n - 1, mod) % mod;
}

i64 modinv(i64 a, i64 mod) {
    // mod is prime
    return modpow(a, mod - 2, mod);
}

struct Combination {
    const int MAX_N = 1 << 21;
    vi fact = vi(MAX_N);
    vi factinv = vi(MAX_N);

    Combination() {
        fact[0] = 1;
        for (int i = 1; i < MAX_N; i++) {
            fact[i] = fact[i - 1] * i % MOD;
        }
        factinv[MAX_N - 1] = modinv(fact[MAX_N - 1], MOD);
        for (int i = MAX_N - 2; i >= 0; i--) {
            factinv[i] = factinv[i + 1] * (i + 1) % MOD;
        }
    }

    i64 ncr(i64 n, i64 r) {
        if (r < 0 || r > n) return 0;
        return fact[n] * factinv[r] % MOD * factinv[n - r] % MOD;
    }

    i64 npr(i64 n, i64 r) {
        if (r < 0 || r > n) return 0;
        return fact[n] * factinv[n - r] % MOD;
    }

    i64 nhr(i64 n, i64 r) {
        if (n == 0 && r == 0) return 1;
        return ncr(n + r - 1, r);
    }
};

int main() {
    int n, k;
    cin >> n >> k;
    i64 ans = 0;
    Combination comb;
    for (int i = k, j = 1; i >= 1; i--, j++) {
        if (j % 2) {
            ans += comb.ncr(k, i) * modpow(i, n, MOD) % MOD;
        } else {
            ans -= comb.ncr(k, i) * modpow(i, n, MOD) % MOD;
        }
        ans %= MOD;
    }
    cout << (ans + MOD) % MOD << endl;
}


Measured memory_bytes: 35584
#include<iostream>
#include<iomanip>
#include<cstdlib>
#include<algorithm>
#include<vector>
#include<map>
#include<cmath>
#include<string>

#define rep(i,p) for(long long int i=0;i<p;i++)
#define reep(i,p) for(long long int i=1;i<=p;i++)
#define ll long long

using namespace std;

int main(){


ll int N;
cin >> N;
vector<ll int > A(N);
map<ll int , ll int> s;
rep(i,N){
	cin >> A[i];
	s[A[i]-1] = i+1;
}


rep(i,N){
	cout << s[i] << " ";
}








	return 0;

}



Measured memory_bytes: 7808
#include <iostream>
using namespace std;
int main(void){
    int t, n, s, f, total;
    while(1){
        cin >> t >> n;
        total=0;
        if(t == 0) break;
        for(int i=0; i<n; i++){
            cin >> s >> f;
            total += f-s;
        }
        if(t>total){
            cout << t-total << endl;
        }
        else cout << "OK" << endl;
    }
    return 0;
}



Measured memory_bytes: 3064
//Coded by Abhijay Mitra
#include <iostream>
#include <stdlib.h>
#include <algorithm>
#include <cstdio>
#include <numeric>
#include <cstring>
#include <numeric>
#include <vector>
#include <iterator> 
#include <map>
#include <set>
#include <climits>
#include <queue>
#include <cmath>
#include <stack>
#include <cctype>
#include <bitset>
// #include <bits/stdc++.h>
#define double long double
#define int long long int
#define ll int
#define ibs ios_base::sync_with_stdio(false)
#define cti cin.tie(0)
#define bp __builtin_popcount
#define pb push_back
#define res(v) v.resize(unique(v.begin(), v.end()) - v.begin());
#define cnt_res(v) std::distance(v.begin(),std::unique(v.begin(), v.end())); 
#define timer cerr << "Time elapsed : " << 1.0 * clock() / CLOCKS_PER_SEC << " sec \n";
using vi = std::vector<int>;
using vvi = std::vector<vi>;
using pii = std::pair<int,int>;
using vpii = std::vector<pii>;
using vvpii = std::vector<vpii>;
#define mp         make_pair
#define rep(i,a,b) for (int i = a; i <= b; i++)
#define per(i,b,a) for (int i = b; i >= a; i--)
#define all(x)     x.begin(), x.end()
using namespace std;
const int N=2e6+10;
const int inf = /*0x3f3f3f3f*/1e18+10;
// const ll M = 998244353 ; // Mulo
const int M = 1e9+7 ; // Mulo
const double Pi = 3.14159265;
#define F first
#define S second
void solve(){
  int n;cin>>n;vvi a(n,vi(n,0));vi dp(1<<n,0);
  dp[0]=1;
  rep(i,0,n-1)rep(j,0,n-1)cin>>a[i][j];
  rep(i,0,(1<<n)-1){
    //i represents woman assigned
    int k=__builtin_popcount(i);
    rep(j,0,n-1)
      if((i&(1<<j))==0)
        if(a[k][j]==1)dp[i|(1<<j)]=(dp[i]+dp[i|(1<<j)])%M;
  }
  cout<<dp[(1<<n)-1];
}
int32_t main()
{
  ibs;cti;
  solve()
  /*,cout<<"\n"*/;
  // cout<<"\n";
  int xx=0;
  // int t;cin>>t;while(t--){/*xx++;cout<<"Case "<<xx<<":\n"*/;solve();cout<<"\n";}
  return 0;
}

Measured memory_bytes: 16640
import itertools
import numpy as np
from sys import stdin
N = int(stdin.readline().rstrip())
A = np.array([int(_) for _ in stdin.readline().rstrip().split()])
products = list(itertools.product([0, 1, -1], repeat=N))
ans = 0
for p in products:
    if np.prod(A - np.array(p)) % 2 == 0:
        ans += 1
print(ans)

Measured memory_bytes: 20460
#include <stdio.h>
#include <math.h>
#define N 10000

int check_number(int);

int main()
{
  int n;
  int count=0;
  int number[N];
  int i;
  scanf("%d", &n);
  for(i=0;i<n;i++){
    scanf("%d",&number[i]);
  }
  for(i=0;i<n;i++){
    if(check_number(number[i])==1)count++;
  }
  printf("%d\n",count);
  return 0;
}

int check_number(int number){
  int i=0;
  double sqrtnumber=sqrt(number);
  for(i=1;i<=sqrtnumber;i++){

    if(number < 2) return 0;
    else if( number == 2) return 1;
    
    if(i!=1 && number%i==0){
      return 0;
    }
  }
  return 1;
}



Measured memory_bytes: 2124
#include<bits/stdc++.h>
using namespace std;
#pragma region Macros
#define ios\
    ios::sync_with_stdio(false);\
    cin.tie(nullptr);
#define VEC(type, name, size)\
    V<type> name(size);\
    IN(name)
#define VVEC(type, name, h, w)\
    VV<type> name(h, V<type>(w));\
    IN(name)
#define INT(...)\
    int __VA_ARGS__;\
    IN(__VA_ARGS__)
#define LL(...)\
    ll __VA_ARGS__;\
    IN(__VA_ARGS__)
#define STR(...)\
    string __VA_ARGS__;\
    IN(__VA_ARGS__)
#define CHAR(...)\
    char __VA_ARGS__;\
    IN(__VA_ARGS__)
#define DOUBLE(...)\
    DOUBLE __VA_ARGS__;\
    IN(__VA_ARGS__)
#define LD(...)\
    LD __VA_ARGS__;\
    IN(__VA_ARGS__)
template <class T> void scan(T &a) { cin >> a; }
template <class T> void scan(vector<T> &a) { for(auto &i : a) scan(i); }
template <class T, class L> void scan(pair<T, L> &p){ scan(p.first); scan(p.second); }
void IN() {}
template <class Head, class... Tail> void IN(Head &head, Tail &... tail) { scan(head); IN(tail...); }
template <class T> inline void print(T x){ cout << x << '\n';}
#define ll long long
#define ld long double
#define FOR(i,l,r) for(ll i=(l);i<(r);++i)
#define REP(i,n) FOR(i,0,n)
#define REPS(i,n) FOR(i,1,n+1)
#define RFOR(i,l,r) for(ll i=(l);i>=(r);--i)
#define RREP(i,n) RFOR(i,n-1,0)
#define RREPS(i,n) RFOR(i,n,1)
#define pb push_back
#define eb emplace_back
#define SZ(x) ((ll)(x).size())
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
template<class T = ll> using V = vector<T>;
template<class T = ll> using VV = V<V<T>>;
template<class T> inline bool chmin(T& a, T b) {if (a > b) {a = b; return true; }return false; }
template<class T> inline bool chmax(T& a, T b) {if (a < b) {a = b; return true; }return false; }
inline void Yes(bool b = true) {cout << (b ? "Yes" : "No") << '\n';}
inline void YES(bool b = true) {cout << (b ? "YES" : "NO") << '\n';}
inline void err(bool b = true) {if(b) {cout << -1 << '\n'; exit(0);}}
template<class T> inline void fin(bool b = true, T e = 0) {if(b) {cout << e << '\n'; exit(0);}}
template<class T> T Roundup_div(T x, T y) {return (x+(y-1))/y;}
template <typename T> T pow(T a, long long n, T e = 1) {T ret = e; while (n) {if (n & 1) ret *= a; a *= a; n >>= 1; } return ret; }
const ll INF = 1e18;
#pragma endregion

int main(){
    ios;
    INT(n);
    VEC(ll, a, n);
    sort(rall(a));
    ll res = 0;
    REP(i, n - 2) for(int j = i + 1; j < n - 1; j++) for(int k = j + 1; k < n; k++){
        if(a[i] < a[j] + a[k] and a[i] > a[j] and a[j] > a[k]) res++;
    }
    print(res);
}

Measured memory_bytes: 3660
from itertools import product
N=int(input().strip())
F=[]
for i in range(N):
    F.append(list(map(int,input().split())))
P=[]
for i in range(N):
    P.append(list(map(int,input().split())))
# 2**10で間に合う
score=-float('inf')
opt=0
for op in product(*[(0,1) for i in range(10)]):
    if sum(op)==0:
        continue
    sc=0
    for n in range(N):
        c=sum(F[n][i] and op[i] for i in range(10))
        sc+=P[n][c]
    if score<sc:
        score=sc
        opt=op
print(score)

Measured memory_bytes: 3188
#include <iostream>
#include <algorithm>
#include <vector>
#include <cmath>
#include <queue>
#include <map>
#include <numeric> //lcm


#define ERROR() cout << "ERROR!!" << endl; return 0;
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = n-1; i >= 0; --i)
#define rep1(i,n) for(int i = 1; i <= (n); ++i)

#define debug(vec) for(auto v : vec) cout << v << " "; cout << endl;

#define debug2D(vec2D) for(auto vec : vec2D) { for (auto v : vec) cout << v << " "; cout << endl; } 

using namespace std;

typedef long long ll;

const long long int INF = 1000000000; //<10^10
//const ll MOD = 998244353;
const ll MOD = 1000000007;

inline bool maxch(int &a, int b) { if (a < b) {a = b; return true;} else return false;}

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

	int ans = 1;
	while (n /= k) ans++;

	cout << ans << endl;
	
}




Measured memory_bytes: 256
#include <algorithm>
#include <cassert>
#include <chrono>
#include <cmath>
#include <complex>
#include <cstdlib>
#include <deque>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
using namespace std;
typedef long long ll;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  int n;
  cin >> n;
  n = 1000 - (n % 1000);
  if (n == 1000)
    n = 0;
  cout << n << endl;
}

Measured memory_bytes: 3628
from collections import defaultdict
MOD = 10**9+7
n, K = map(int, input().split())
A = map(int, input().split())
cnt = defaultdict(int)
for a in A:
    cnt[a] += 1


keys = sorted(cnt.keys())
key_to_idx = defaultdict(int)
for i, k in enumerate(keys):
    key_to_idx[k] = i

Acum = [0]
for k in keys:
    Acum.append(Acum[-1]+cnt[k])

U = n
fact = [0]*(U+1)
fact[0] = 1
for i in range(1, U+1):
    fact[i] = fact[i-1]*i % MOD


invfact = [0]*(U+1)
invfact[U] = pow(fact[U], MOD-2, MOD)
for i in reversed(range(U)):
    invfact[i] = invfact[i+1]*(i+1) % MOD


def nCr(n, r):
    if r < 0 or n < r:
        return 0
    return fact[n]*invfact[r]*invfact[n-r]


MAX = 0
for k in reversed(keys):
    x = Acum[key_to_idx[k]+1]
    y = Acum[key_to_idx[k]]
    c = nCr(x, K) - nCr(y, K)
    MAX += c*k
    MAX %= MOD

MIN = 0
for k in keys:
    x = n-Acum[key_to_idx[k]]
    y = n-Acum[key_to_idx[k]+1]
    c = nCr(x, K) - nCr(y, K)
    MIN += c*k
    MIN %= MOD

print((MAX-MIN) % MOD)


Measured memory_bytes: 39648
#define _CRT_SECURE_NO_WARNINGS

#include <stdio.h>
#include <iostream>
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>

#include <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
//#include <tchar.h>
//#include <intrin.h>

#define F first
#define S second
#define LL long long
#define MOD 1000000007
#define INF 200000000
#define LINF 1000000000000000000

using namespace std;

const int N = 2e5 + 10;

LL freq[N];

int main()
{
	int n;
	LL ans = 0;
	scanf("%d", &n);

	for (int i = 1;i <= n;i++) {
		int x;
		cin >> x;
		freq[x]++;
		ans += x;
	}

	int q;
	scanf("%d", &q);
	
	while (q--) {
		int x, x1;
		scanf("%d%d", &x, &x1);
		ans -= freq[x] * x;
		ans += freq[x] * x1;
		freq[x1] += freq[x];
		freq[x] = 0;
		printf("%lld\n", ans);
	}
}

Measured memory_bytes: 3988
#include<iostream>
#include<iomanip>
#include<cmath>
#include<string>
#include<cstring>
#include<vector>
#include<list>
#include<algorithm>
#include<map>
#include<set>
#include<queue>
#include<stack>
using namespace std;
typedef long long ll;
#define fi first
#define se second
#define mp make_pair
#define rep(i, n) for(int i=0;i<n;++i)
#define rrep(i, n) for(int i=n;i>=0;--i)
const int inf=1e9+7;
const ll mod=1e9+7;
const ll big=1e18;
const double PI=2*asin(1);

ll mod1 = 998244353;

ll mypow(ll a, ll b) {
  ll h = b;
  ll two;
  ll ans = 1;
  ll tmp;
  while(h>0) {
    two = 1;
    tmp = a;
    while(2*two<h) {
      two *= 2;
      tmp *= tmp;
      tmp %= mod1;
    }
    h -= two;
    ans *= tmp;
    ans %= mod1;
  }
  return ans;
}

int main() {
  int N;
  cin>>N;
  int D[N];
  map<int, int> amap;
  for(int i=0;i<N;++i) {
    cin>>D[i];
    amap[D[i]]++;
  }
  if(D[0]>0 || amap[0]>1) {
    cout<<0<<endl;
    return 0;
  }
  ll ans = 1;
  ll num = 1;
  int maxnum=0;
  bool can = true;
  bool owari = false;
  for(int i=0;i<N;++i) {
    if(amap[i]>0) {
      if(owari) can = false;
      maxnum = i;
    }
    else {
      owari = true;
    }
  }
  if(!can) {
    cout<<0<<endl;
    return 0;
  }
  for(int i=1;i<=maxnum;++i) {
    ans *= mypow(num, amap[i]);
    ans %= mod1;
    num = amap[i];
  }
  cout<<ans<<endl;
}



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

class BIT{
public:
  typedef long long ll;
  ll n;
  vector<ll> bit;
  BIT():n(-1){};
  BIT(ll n_){
    n=1;
    while(n < n_+2) n *= 2;
    bit.resize(n+1, 0);
  }
  
  //[0, i]までの総和を得る
  ll sum(ll i){
    assert( i >= 0 && i <= n );
    i++;
    
    ll s=0;
    while(i>0){
      s = (s + bit[i]);
      i -= i & -i;
    }
    return s;
  }

  //i番目の要素にx加算(0 オリジン)
  void add(ll i,ll x){
    assert( i >= 0 && i <= n );
    i+=2;
    
    while(i <= n){
      bit[i] = (bit[i] + x);
      i += i & -i;
    }
  }
  
  ll sum(int l,int r){ //[l, r) 0オリジン
    assert(l <= r);
    assert( 0 <= l && l <= n);
    assert( 0 <= r && r <= n);
    return sum(r) - sum(l);
  }
};

int N, K, a[200005];
int A[200005];

map<int,int> to;

signed main(){
  
  cin>>N>>K;

  for(int i=0;i<N;i++){
    cin>>a[i];
    a[i] -= K;
    A[i] = a[i];
    if(i) A[i] += A[i-1];
    to[A[i]] = 0;
  }
  
  auto ite = to.begin();
  
  vector<int> Num;
  
  int num = 0;
  
  while( ite != to.end() ){
    
    (*ite).second = num++;
    
    Num.push_back( (*ite).first );

    ite++;
    
  }
  
  BIT bit(N);
  
  for(int i=0;i<N;i++) bit.add( to[A[i]], 1 );
  
  int ans = 0;
  
  int x = 0;
  
  for(int i=0;i<N;i++){
    
    auto r = lower_bound( Num.begin(), Num.end(), x );
    
    if( r != Num.end() ) ans += bit.sum( to[*r], N );
    
    bit.add( to[A[i]], -1 );
    
    x += a[i];
    
  }
  
  cout<<ans<<endl;
  
  return 0;
}


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

int main(){
  long N; cin >> N;
  long count =1, ANS =0;
  vector <string> s(N);
  
  for(int i=0; i<N; i++){
    cin >> s.at(i);
    sort(s.at(i).begin(), s.at(i).end());
  }
  
  sort(s.begin(), s.end());
  
  for(int i=0; i<N-1; i++){
    if(s[i] == s[i+1]){
      count++;}
    else{ANS += (count * (count - 1))/2;
        count = 1; }
  }
  
  if(count!=1){ANS += (count * (count - 1))/2;}
  
  cout << ANS << endl;
}


Measured memory_bytes: 7296
n = int(input())
lst = []
a_sum = 0

for _ in range(n):
  a,b = map(int, input().split())
  lst.append((a,b))
  
lst = sorted(lst, key=lambda x: x[1])

for i in range(n):
  a_sum += lst[i][0]
  if lst[i][1] < a_sum:
    print('No')
    break
else:
  print('Yes')

Measured memory_bytes: 33408
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(n);i++)
using ll = long long;
using P = pair<int,int>;
int main(void) {
    char c; cin >> c;
    char v[5] = {'a', 'e', 'i', 'o', 'u'};
    bool ok = false;
    rep(i, 5) {
        if(v[i] == c) ok = true;
    }
    if(ok) cout << "vowel";
    else cout << "consonant";
}


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

using namespace std;

int ncr(int n, int k)
{
    long long ret = 1;
    
    for(int i = n - k + 1; i <= n; i++)
    {
        ret *= i;
    }
    
    for(int i = 1; i <= k; i++)
    {
        ret /= i;
    }
    
    return ret;
}

int main()
{
    string S; cin >> S;
    
    vector<int> p(26, 0);
    
    for(int i = 0; i < S.size(); i++)
    {
        p[S[i] - 97]++;
    }
    
    int kisu = 0;
    
    for(int i = 0; i < 26; i++)
    {
        if(p[i] % 2 == 1)
        {
            kisu++;
        }
    }
    
    if(kisu >= 2)
    {
        printf("0\n");
    }
    else
    {
        for(int i = 0; i < 26; i++)
        {
            p[i] >>= 1;
        }
        
        int len = S.size() / 2;
        
        long long ret = 1;
        
        for(int i = 0; i < 26; i++)
        {
            ret *= ncr(len, p[i]);
            
            len -= p[i];
        }
        
        printf("%lld\n", ret);
    }
    
    return 0;
}

Measured memory_bytes: 3352
import java.util.*;
import java.util.Scanner;

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

        StringBuffer s = new StringBuffer(sc.nextLine());

        if (s.length() == 2) {
            System.out.println(s.toString());
        } else {
            s.reverse();
            System.out.println(s.toString());
        }
    }
}

Measured memory_bytes: 25172
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
#define int long long
#define endl '\n'
#define pb push_back
#define fi first
#define se second
#define all(c) (c).begin(),(c).end()
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef vector<int> vi;

template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

#define TRACE
#ifndef ONLINE_JUDGE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
	cerr << name << " : " << arg1 << endl;
}
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
#define trace(...)
#endif

const ll inf = 2e18;
const int mod = 1e9 + 7;
const int N = 1e5 + 10;

int modpow(int x, int n, int m) {
	x %= m;
	int res = 1;
	while(n > 0) {
		if(n & 1)
			res = res * x % m;
		x = x * x % m;
		n >>= 1;
	}
	return res;
}

vi g[N];
int dp[N][2], sz[N];

void dfs(int v, int p) {
	sz[v] = 1;
	dp[v][0] = 1;
	dp[v][1] = 1;
	for(auto it : g[v]) {
		if(it != p) {
			dfs(it, v);
			sz[v] += sz[it];
			dp[v][0] = dp[v][0] * dp[it][1] % mod;
			dp[v][1] = dp[v][1] * ((dp[it][0] + dp[it][1]) % mod) % mod;
		}
	}
}

signed main() {
	ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);

	int n;
	cin >> n;
	for(int i = 0; i < n - 1; i++) {
		int u, v;
		cin >> u >> v;
		g[u].pb(v);
		g[v].pb(u);
	}
	dfs(1, -1);
	cout << (dp[1][0] + dp[1][1]) % mod;

	return 0;
}

Measured memory_bytes: 18340
import java.io.InputStream;
import java.io.IOException;
import java.io.PrintStream;
import java.util.*;

public class Main {

  public static void main(String[] args) {
    solve(System.in, System.out);
  }

  static void solve(InputStream is, PrintStream os) {
    Scanner sc = new Scanner(is);

    /* read */
    long a = sc.nextLong();
    long b = sc.nextLong();
    if (a == 0) {
      os.println(xorAll(b));
    } else {
      os.println(xorAll(b) ^ xorAll(a - 1));
    }
  }

  private static long xorAll(long a) {
    long ans = 0;

    int b;
    long seq;
    long bit;

    b = 0;
    seq = (a % (1L << b + 2)) / (1L << b);
    bit = seq == 1 ? 1 : seq == 2 ? 1 : 0;
    ans += bit * (1L << b);

    for (b = 1; b < 60; b++) {
      seq = (a % (1L << b + 2)) / (1L << b);
      bit = (a % 2 == 0 && seq % 2 == 1) ? 1L : 0L;
      ans += bit * (1L << b);
    }
    return ans;
  }

  private static class Scanner {

    private final InputStream is;
    private final byte[] buffer = new byte[1024];
    private int ptr = 0;
    private int buflen = 0;

    Scanner(InputStream is) {
      this.is = is;
    }

    private boolean hasNextByte() {
      if (ptr < buflen) {
        return true;
      } else {
        ptr = 0;
        try {
          buflen = is.read(buffer);
        } catch (IOException e) {
          e.printStackTrace();
        }
        if (buflen <= 0) {
          return false;
        }
      }
      return true;
    }

    private int readByte() {
      if (hasNextByte()) {
        return buffer[ptr++];
      } else {
        return -1;
      }
    }

    private static boolean isPrintableChar(int c) {
      return 33 <= c && c <= 126;
    }

    public boolean hasNext() {
      while (hasNextByte() && !isPrintableChar(buffer[ptr])) {
        ptr++;
      }
      return hasNextByte();
    }

    public String next() {
      if (!hasNext()) {
        throw new NoSuchElementException();
      }
      StringBuilder sb = new StringBuilder();
      int b = readByte();
      while (isPrintableChar(b)) {
        sb.appendCodePoint(b);
        b = readByte();
      }
      return sb.toString();
    }

    public long nextLong() {
      if (!hasNext()) {
        throw new NoSuchElementException();
      }
      long n = 0;
      boolean minus = false;
      int b = readByte();
      if (b == '-') {
        minus = true;
        b = readByte();
      }
      if (b < '0' || '9' < b) {
        throw new NumberFormatException();
      }
      while (true) {
        if ('0' <= b && b <= '9') {
          n *= 10;
          n += b - '0';
        } else if (b == -1 || !isPrintableChar(b)) {
          return minus ? -n : n;
        } else {
          throw new NumberFormatException();
        }
        b = readByte();
      }
    }

    public int nextInt() {
      long nl = nextLong();
      if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE) {
        throw new NumberFormatException();
      }
      return (int) nl;
    }

    public double nextDouble() {
      return Double.parseDouble(next());
    }
  }
}


Measured memory_bytes: 21076
//include,using,define等
#pragma region header
#include <algorithm>
#include <bitset>
#include <tuple>
#include <cstdint>
#include <cctype>
#include <assert.h>
#include <stdlib.h>
#include <stdio.h>
#include <cassert>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <ctime>
#include <deque>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <list>
#include <limits>
#include <map>
#include <memory>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
#include <math.h>
#include <cstring>

// ===============================================================
//using系
#pragma region header
using namespace std;
using ll = long long;
using lint = long long;
using vl = vector<long long>;
using vvl = vector<vector<long long>>;
using vvi = vector<vector<int>>;
using vs = vector<string>;
using vc = vector<char>;
using vcc = vector<vector<char>>;
using vm = vector<short>;
using vmm = vector<vector<short>>;
using pii = pair<int, int>;
using psi = pair<string, int>;
using ld = long double;
using ull = unsigned long long;
using ui = unsigned int;
using qul = queue<ll>;
using pql = priority_queue<ll>;
const int dx[] = { 1,0,-1,0 };
const int dy[] = { 0,1,0,-1 };
constexpr ll mod = 1e9 + 7;
constexpr long double pi = 3.141592653589793238462643383279;
#pragma endregion
// ========================================================================
//define
#pragma region header
//#define int long long
#define rep(i, n) for(ll i = 0; i < n; i++)
#define REP(i, n) for(ll i = 1; i <= n; i++)
#define INF (ll)10000000000000000
#define mod (ll)1000000007
#define P pair<lint,lint>
template <class T>
bool chmax(T& a, const T& b) {
	if (a < b) {
		a = b;  // aをbで更新
		return true;
	}
	return false;
}
template <class T>
bool chmin(T& a, const T& b) {
	if (a > b) {
		a = b;  // aをbで更新
		return true;
	}
	return false;
}
#pragma endregion
#pragma endregion


int main(void) {
	string s, t; cin >> s >> t;
	lint ans = INF;
	for (int i = 0; i < s.size() - t.size() + 1; i++) {
		lint cnt = 0;
		for (int j = 0; j < t.size(); j++) {
			if (s[i + j] != t[j]) {
				cnt++;
			}
		}
		ans = min(cnt, ans);
	}
	printf("%lld\n", ans);

    return 0;
}

Measured memory_bytes: 3724
use std::collections::HashMap;

fn read1<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}

fn readn<T: std::str::FromStr>(delimiter: &str) -> Vec<T> {
    let s = read1::<String>();
    s.split(delimiter).map(|e| e.parse().ok().unwrap()).collect::<Vec<T>>()
}

fn main() {
    let hwn = readn::<usize>(" ");
    let h = hwn[0];
    let w = hwn[1];
    let n = hwn[2];
    
    let mut dict = HashMap::new();

    for _ in 0..n {
        let ab = readn::<usize>(" ");
        let a = ab[0] - 1;
        let b = ab[1] - 1;
        for j in 0..3 {
            if a + j < 2 || a + j >= h { continue; }
            let y = a + j - 2;
            for k in 0..3 {
                if b + k < 2 || b + k >= w { continue; }
                let x = b + k - 2;
                let count = dict.entry((y, x)).or_insert(0);
                *count += 1;
            }
        }
    }

    let mut cnt = vec![0usize; 10];

    for (_, &v) in dict.iter() {
        cnt[v] += 1;
    }

    let zero = (h - 2) * (w - 2) - cnt.iter().sum::<usize>();
    let mut ans = zero.to_string() + "\n";
    for i in 1..10 {
        ans = ans + &(cnt[i].to_string()) + "\n";
    }

    print!("{}", ans);
}

Measured memory_bytes: 53320
def gcd(a, b):
    while b:
        a, b = b, a % b
    return a

def lcm(a, b):
    return a*b // gcd(a, b)

A, B, C, D = map(int, input().split())
CD = lcm(C, D)

divC = B//C - (A-1)//C
divD = B//D - (A-1)//D
divCD = B//CD - (A-1)//CD

cnt = B-A+1 - divC - divD + divCD
print(cnt)

Measured memory_bytes: 3064
X=int(input())
if X>=400 and X<=599:
  print('8')
if X>=600 and X<=799:
  print('7')
if X>=800 and X<=999:
  print('6')
if X>=1000 and X<=1199:
  print('5')
if X>=1200 and X<=1399:
  print('4')
if X>=1400 and X<=1599:
  print('3')
if X>=1600 and X<=1799:
  print('2')
if X>=1800 and X<=1999:
  print('1')


Measured memory_bytes: 9104
// Copyright 2019 yaito3014
#include "bits/stdc++.h"
using namespace std;
using namespace literals;

struct Pos {
  int x, y;
  Pos() = default;
  Pos(int x_, int y_)
    : x(x_), y(y_) {}
};


int main() {
  cin.tie(nullptr); ios::sync_with_stdio(false);
  int N;
  cin >> N;
  vector<Pos> cities(N);
  for (auto& v : cities)cin >> v.x >> v.y;
  vector<int> per(N);
  iota(begin(per), end(per), 0);
  auto calc = [](const Pos& a, const Pos& b) -> double {
    return sqrt((a.x - b.x) * (a.x - b.x) + (a.y - b.y) * (a.y - b.y));
  };
    double distance = 0;
  int n = 0;
  do {
    for (int i = 0; i < N - 1; ++i)
      distance += calc(cities[per[i]], cities[per[i + 1]]);
    ++n;
  } while (next_permutation(begin(per), end(per)));
  cout << fixed << setprecision(7) << distance / n << endl;
}


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

char c[6][6];

int main() {
    //freopen("input.txt", "r", stdin);
    ios::sync_with_stdio(0);
    cin.tie(NULL);

    int n, m, k;
    cin >> n >> m >> k;
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < m; j++) {
            cin >> c[i][j];
        }
    }
    int res = 0;
    for (int bit1 = 0; bit1 < (1 << n); bit1++) {
        for (int bit2 = 0; bit2 < (1 << m); bit2++) {
            vector<int> row, col;
            for (int i = 0; i < n; i++) {
                if ((1 << i) & bit1) {
                    row.push_back(i);
                }
            }
            for (int j = 0; j < m; j++) {
                if ((1 << j) & bit2) {
                    col.push_back(j);
                }
            }

            int cnt = 0;
            for (auto i: row) {
                for (auto j: col) {
                    cnt += (c[i][j] == '#');
                }
            }
            if (cnt == k) {
                res++;
            }
        }
    }

    cout << res;


    return 0;
}


Measured memory_bytes: 3632
N=int(input())
list1=list(map(int,input().split()))
#print(list1)
ans_list=[]
j=0
while True:
	ans=0
	while True:
		if j==N-1:
			break
		if list1[j]>=list1[j+1]:
			ans+=1
			j+=1
		else :
			break
	j+=1
	ans_list.append(ans)
	if j==N:
		break
print(max(ans_list))

Measured memory_bytes: 14252
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);
        String[] abt = sc.nextLine().split(" ");
        int N = Integer.parseInt(abt[0]);
        int K = Integer.parseInt(abt[1]);

        if (N == K) {
            System.out.println(1);
        } else {
            System.out.println(N + 1 - K);
        }
    }
}


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

int main(){
  // init
  // 
  int price, coin_kind, ans;
  cin >> price >> coin_kind;
  vector<int> value(coin_kind+1);
  rep(i,coin_kind) cin >> value[i+1];
  vector<vector<int>> costDP(coin_kind+1,vector<int>(price+1));

  for(int i = 0; i<=coin_kind; i++)for(int j=price; j>=0; j--){
    if(i == 0) costDP[i][j] = INF;
    else if(j == price) costDP[i][j] = 0;
    else if(j+value[i]>price) costDP[i][j] = costDP[i-1][j];
    else costDP[i][j] = min(costDP[i-1][j], min(costDP[i-1][j+value[i]], costDP[i][j+value[i]]) +1);
  }

  ans = INF;
  rep(i,coin_kind+1) ans = min(ans, costDP[i][0]);
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 7088
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<int,P> P1;
typedef pair<P,P> P2;
#define pu push
#define pb push_back
#define mp make_pair
#define eps 1e-7
#define INF 1000000000
#define mod 1000000007
#define fi first
#define sc second
#define rep(i,x) for(long long i=0;i<x;i++)
#define repn(i,x) for(long long i=1;i<=x;i++)
#define SORT(x) sort(x.begin(),x.end())
#define ERASE(x) x.erase(unique(x.begin(),x.end()),x.end())
#define POSL(x,v) (lower_bound(x.begin(),x.end(),v)-x.begin())
#define POSU(x,v) (upper_bound(x.begin(),x.end(),v)-x.begin())
vector<pair<string,P> >vec;

void solve(long long N, long long A, long long B){
	if ((B-1-A)%2 == 1) {
		cout << "Alice" << endl;
	} else {
		cout << "Borys" << endl;
	}
}

int main(){	
	long long A;
	long long N;
	long long B;
	scanf("%lld",&N);
	scanf("%lld",&A);
	scanf("%lld",&B);
	solve(N, A, B);
	return 0;
}



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

using namespace std;

#define int long long
#define all(v) (v).begin(), (v).end()
#define resz(v, ...) (v).clear(), (v).resize(__VA_ARGS__)
#define reps(i, m, n) for(int i = (int)(m); i < (int)(n); i++)
#define rep(i, n) reps(i, 0, n)

template<class T1, class T2> void chmin(T1 &a, T2 b){if(a>b)a=b;}
template<class T1, class T2> void chmax(T1 &a, T2 b){if(a<b)a=b;}

typedef pair<int, int> Pi;
typedef tuple<int, int, int> Ti;
typedef vector<int> vint;

const int inf = 1LL << 55;
const int mod = 1e9 + 7;

typedef vector<int> vec;
typedef vector<vec> mat;

mat mul(const mat& A, const mat& B)
{
  mat C(A.size(), vec(B[0].size()));
  for(int i = 0; i < (int)A.size(); i++) {
    for(int j = 0; j < (int)B.size(); j++) {
      for(int k = 0; k < (int)B[0].size(); k++) {
	(C[i][k] += A[i][j] * B[j][k]) %= 2;
      }
    }
  }
  return C;
}

mat pow(mat A, int n)
{
  mat B(A.size(), vec(A.size()));
  for(int i = 0; i < (int)A.size(); i++) B[i][i] = 1;
  while(n > 0) {
    if(n & 1) B = mul(B, A);
    A = mul(A, A);
    n >>= 1;
  }
  return B;
}

void gauss_jordan(const mat& A, const vec b)
{
  int n = A.size();
  // ?????§?????°??????
  mat B(n, vec(n + 1));
  for(int i = 0; i < n; i++) {
    for(int j = 0; j < n; j++) B[i][j] = A[i][j];
  }
  for(int i = 0; i < n; i++) B[i][n] = b[i];

  // ?§£???
  for(int i = 0; i < n; i++) {
    int pivot = i;
    for(int j = i; j < n; j++) {
      if(B[j][i]) {
	pivot = j;
	break;
      }
    }
    swap(B[i], B[pivot]);
    if(B[i][i] == 0) continue;
    // ?????????????????°??§??????
    //for(int j = i+1; j < n+1; j++) B[i][j] /= B[i][i];
    // ????????????
    for(int j = 0; j < n; j++) {
      if(i != j && B[j][i]){
	for(int k = 0; k < n+1; k++) (B[j][k] += B[i][k]) %= 2;
      }
    }
  }

  rep(i, n) {
    bool flag = false;
    rep(j, n) if(B[i][j]) flag = true;
    if(!flag) {
      if(B[i][n]) {
	cout << "none" << endl;
	return;
      }
    }
  }

  rep(i, n) {
    bool flag = false;
    rep(j, n) if(B[i][j]) flag = true;
    if(!flag) {
      if(!B[i][n]) {
	cout << "ambiguous" << endl;
	return;
      }
    }
  }

  // ?§£
  for(int i = 0; i < n; i++) {
    if(i) cout << " ";
    cout << B[i][n];
  }
  cout << endl;
}


signed main()
{
  cin.tie(0);
  ios_base::sync_with_stdio(0);
  cout << fixed << setprecision(12);

  int N;
  cin >> N;
  mat A(N, vec(N));
  rep(i, N) rep(j, N) cin >> A[i][j];

  vec b(N);
  rep(i, N) cin >> b[i];

  int T;
  cin >> T;

  gauss_jordan(pow(A, T), b);

  return 0;
}

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

int main() {
	const int last = 4280;	//???????°´?????????
		while(true) {
			int water;
			cin >> water;
			if (water < 0) return 0;
			
			int bill = 1150;	//?????¬??????
			water -= 10;	//?¬¬???????????????????°?
			
			int extra[2]{125, 140};	//?¬¬2????¬¬3???????????????
			for (int i = 0; i < 2 && water > 0; i++, water -= 10) {
				bill += extra[i] * min(water, 10);
			}
			
			if (water > 0) {	//?¬¬4??????????????????
				bill += 160 * water;
			}
			cout << last - bill << endl;	//???????°´?????????4280?????¨??????
		}
}

Measured memory_bytes: 1160
n=int(input())
A =list(map(int,input().split()))
count=0
for i in range(n-1):
	minj = i
	for j in range(i+1,n):
		if A[j]<A[minj]:
			minj=j
	A[i],A[minj]=A[minj],A[i]
	if minj != i:
		count+=1
print(' '.join(list(map(str,A))))
print(count)





Measured memory_bytes: 5600
def solve():
    s = input()
    t = input()
    hoge = 10000
    let = len(t)
    les = len(s)
    ans = 10000
    for i in range(les-let+1):
        hoge = s[i:i+let]
        piyo = 0
        for j, k in zip(hoge,t):
            if j != k:
                piyo += 1
        if piyo < ans:
            ans = piyo
    print(ans)
    return 0

if __name__ == "__main__":
    solve()


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

#define all(v) v.begin(), v.end()
#define V vector
#define P pair
typedef long long ll;
const int INT_INF = 1e9;
const ll INF = 1LL << 30;

int main() {
    ll x; cin >> x;

    ll cnt = 0;
    if(11 <= x){
        cnt = x / 11 * 2;
        ll r = x % 11;
        if(r != 0){
            if(7 <= r) cnt += 2;
            else cnt++;
        }
    }else if(7 <= x){
        cnt += 2;
    }else{
        cnt += 1;
    }
    cout << cnt << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;

typedef long long ll;
typedef pair<int,int> ii;
typedef tree<ii,null_type,less<ii>,rb_tree_tag,tree_order_statistics_node_update> indexed_set;

int main() {
	cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(0);
	int H,W; cin>>H>>W;
	vector<string> g(H);
	for (int i=0; i<H; i++)
		cin>>g[i];
	queue<ii> q;
	map<ii,int> dist;
	for (int i=0; i<H; i++)
		for (int j=0; j<W; j++)
			if(g[i][j]=='#')
				q.push({i,j}), dist[{i,j}]=0;
	int ret=0;
	while(!q.empty()) {
		ii cur=q.front(); q.pop();
		ret=dist[cur];
		for (int i=-1; i<=1; i++) {
			for (int j=-1; j<=1; j++) {
				if (abs(i)+abs(j)!=1)
					continue;
				int x=cur.first+i, y=cur.second+j;
				if (x<0||x>=H||y<0||y>=W)
					continue;
				if (g[x][y]!='.')
					continue;
				g[x][y]='#';
				dist[{x,y}]=dist[cur]+1;
				q.push({x,y});
			}
		}
	}
	cout<<ret<<"\n";
	return 0;
}

Measured memory_bytes: 71952
/* dijkstra.cpp
    ダイクストラ法で、ある頂点から各頂点への最短距離を求めるアルゴリズム
    負の辺が含まれる場合はうまく計算出来ないので、ベルマンフォード法を用いる

    verified: AOJ GRL_1_A
        http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=GRL_1_A&lang=jp
*/

#include <bits/stdc++.h>
using namespace std;

struct Edge {
    long long to;
    double cost;
};
using Graph = vector<vector<Edge>>;
using P = pair<double, int>;
const double INF = (double)(1LL << 60);

/* dijkstra(G,s,dis,prev)
    入力：グラフ G, 開始点 s, 距離を格納する dis, 最短経路の前の点を記録するprev
    計算量：O(|E|log|V|)
    副作用：dis, prevが書き換えられる
*/
void dijkstra(const Graph &G, int s, vector<double> &dis, vector<int> &prev) {
    int N = G.size();
    dis.resize(N, INF);
    prev.resize(N, -1);
    priority_queue<P, vector<P>, greater<P>> pq;  // the least element is top. first:cost, second: node
    dis[s] = 0;
    pq.emplace(dis[s], s);
    while (!pq.empty()) {
        P p = pq.top();  // the least element
        pq.pop();
        int v = p.second;
        if (dis[v] < p.first) {
            continue;
        }
        for (auto &e : G[v]) {
            if (dis[e.to] > dis[v] + e.cost) {
                dis[e.to] = dis[v] + e.cost;
                prev[e.to] = v;
                pq.emplace(dis[e.to], e.to);
            }
        }
    }
}

/* get_path(prev, t)
    入力：dijkstra で得た prev, ゴール t
    出力： t への最短路のパス
*/
vector<int> get_path(const vector<int> &prev, int t) {
    vector<int> path;
    for (int cur = t; cur != -1; cur = prev[cur]) {
        path.push_back(cur);
    }
    reverse(path.begin(), path.end());
    return path;
}

int main() {
    int N;
    pair<double, double> s, t;
    cin >> s.first >> s.second >> t.first >> t.second;
    cin >> N;
    Graph G(N + 2);

    vector<double> x(N), y(N), r(N);
    for (int i = 0; i < N; i++) {
        cin >> x.at(i) >> y.at(i) >> r.at(i);
    }

    double d;

    // s,t間
    d = sqrt((s.first - t.first) * (s.first - t.first) + (s.second - t.second) * (s.second - t.second));
    G[N + 1].push_back({0, d});
    G[0].push_back({N + 1, d});

    // sと円, tと円
    for (int i = 0; i < N; i++) {
        d = sqrt((s.first - x[i]) * (s.first - x[i]) + (s.second - y[i]) * (s.second - y[i]));
        d = max(d - r[i], 0.0);
        G[0].push_back({i + 1, d});
        G[i + 1].push_back({0, d});
        d = sqrt((t.first - x[i]) * (t.first - x[i]) + (t.second - y[i]) * (t.second - y[i]));
        d = max(d - r[i], 0.0);
        G[N + 1].push_back({i + 1, d});
        G[i + 1].push_back({N + 1, d});
    }

    // 円同士
    for (int i = 0; i < N - 1; i++) {
        for (int j = i + 1; j < N; j++) {
            d = sqrt((x[i] - x[j]) * (x[i] - x[j]) + (y[i] - y[j]) * (y[i] - y[j]));
            d = max(d - r[i] - r[j], 0.0);
            G[j + 1].push_back({i + 1, d});
            G[i + 1].push_back({j + 1, d});
        }
    }

    vector<double> dis;
    vector<int> prev;
    dijkstra(G, 0, dis, prev);
    cout << setprecision(15) << dis[N + 1] << endl;

    return 0;
}


Measured memory_bytes: 22640
#define REP(i, t, n)  for (int i = t; i < n; i++)
#define ALL(n)        (n).begin(),(n).end()
#include <limits.h>
#include <stdio.h>
#include <cmath>
#include <iostream>
#include <fstream>
#include <vector>
#include <string>
#include <map>
#include <queue>
#include <deque>
#include <functional>
#include <algorithm>
#include <cstring>
#include <unordered_map>
#include <numeric>

using namespace std;

typedef bool               BOOL;
typedef short              WORD;
typedef unsigned short     U_WORD;
typedef long               DWORD;
typedef unsigned long      U_DWORD;
typedef long long          QWORD;
typedef unsigned long long U_QWORD;


map<char, int> inputMap;

void solve_main()
{
	DWORD r;

	cin >> r;

	cout << (3 * r * r) << endl;
}

int main()
{
#ifdef FOR_IDE
	ifstream in("input.txt");
	cin.rdbuf(in.rdbuf());
#endif

	solve_main();
	return 0;
}


Measured memory_bytes: 256
//
// Created on 2020/08/04.
//


#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include <math.h>
#include <ios>
#include <iomanip>
#include <numeric>

#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
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; }
typedef long long ll;
using namespace std;
const long long LINF =1e18;
const int INF = 1e9;



int main() {
    int a,b,c;
    cin>>a>>b>>c;
    int ans = a * b / 2;
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 3604
#include<stdio.h>
 
int main(void){
int W,H,x,y,r;
scanf("%d %d %d %d %d",&W,&H,&x,&y,&r);
if(W>=x+r&&x-r>=0&&H>=y+r&&y-r>=0){
printf("Yes\n");
}
else{
printf("No\n");
}
return 0;
}

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

using namespace std;

typedef long long ll;

typedef int _loop_int;
#define REP(i,n) for(_loop_int i=0;i<(_loop_int)(n);++i)
#define FOR(i,a,b) for(_loop_int i=(_loop_int)(a);i<(_loop_int)(b);++i)
#define FORR(i,a,b) for(_loop_int i=(_loop_int)(b)-1;i>=(_loop_int)(a);--i)

#define DEBUG(x) cout<<#x<<": "<<x<<endl
#define DEBUG_VEC(v) cout<<#v<<":";REP(i,v.size())cout<<" "<<v[i];cout<<endl
#define ALL(a) (a).begin(),(a).end()

int main() {
    int res = 0;
    int num;

    cin>>num;

    vector<int> h;

    h.resize(num);

    REP(i,num) cin>>h[i];

    int maxh = -1;
    
    REP(i,num)
    {
        if (i==0)
        {
            res++;
            maxh = h[i];
            continue;
        }

        if (maxh <= h[i]) 
        {
            maxh = h[i];
            res++;
        }
    }
    cout << res << endl;
    return 0;
}

Measured memory_bytes: 256
import java.util.*
fun readint()=readLine()!!.toInt()
fun readll()=readLine()!!.toLong()
fun readstring()=readLine()!!
fun readline_int()=(readLine()!!.split(" ").map{it.toInt()}).toIntArray()
fun readline_ll()=(readLine()!!.split(" ").map{it.toLong()}).toLongArray()

fun solve() {
    val (n, k) = readline_int();
    println((n - 2)/(k - 1) + 1);
}
fun main(args: Array<String>) {
    val t = 1;
    repeat(t) {
        solve();
    }
} 

Measured memory_bytes: 35948
#include <bits/stdc++.h>
#pragma GCC optimize("Ofast", "unroll-loops")
#define ll long long 
#define pii pair<int, int>
#define ull unsigned ll
#define f first
#define s second
#define FOR(i,a,b) for (int i=(a); i<(b); i++)
#define REP(i,n) for (int i=0; i<(n); i++)
#define RREP(i,n) for (int i=(n-1); i>=0; i--)
#define ALL(x) x.begin(),x.end()
#define SZ(x) x.size()
#define MNTO(a,b) a = min(a,(__typeof__(a))(b))
#define MXTO(a,b) a = max(a,(__typeof__(a))(b))
#define pb push_back
#define debug(x) cerr<<#x<<" is "<<x<<endl
#define sq(x) (x)*(x)
using namespace std;

// #define int double
// #define double long double
const int maxn = 1e2+3;
const int iinf = 1<<29;
const ll inf = 1ll<<60;
const ll mod = 1e9+7;


void GG(){cout<<"-1\n"; exit(0);}

const int B = 1024+20;

stack<int> have;

int n;
void go(int at){
    if (at==n) return;
    if (!have.size()){
        int og = at; while (at<n) cout<<og<<' '<<++at<<'\n';
        return;
    }
    int A = have.top(); have.pop();
    int og = at;
    while (at <= n-A){
        at++; cout<<og<<' '<<at<<'\n';
    }
    go(at);
}


main(){
    ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);
     string s; cin>>s;
     n = s.length();
     if (s[n-1]=='1') GG();
     if (s[0]!='1') GG();
     REP(i, n-1) {
        if (s[i]!=s[n-i-2]) GG();
     }
     REP(i, (n+1)/2){
        if (s[i]=='1') have.push(i+1); // 1 based
     }

     go(1);
}

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

int main(){
int n;
int a[6]={500,100,50,10,5,1};
while(cin>>n){
if(n==0)break;
n=1000-n;
for(int i=0;i<20;i++){
if(n==0){cout<<i<<endl; break;}
for(int j=0;j<6;j++){
if(n>=a[j]){n-=a[j]; break;}}}}}

Measured memory_bytes: 1160
#include<iostream>
#include<cstdio>
#include<algorithm>
using namespace std;
int main(void)
{
	int L,A,B,C,D;
	scanf("%d %d %d %d %d",&L,&A,&B,&C,&D);
	if(A%C==0)
	{
		A/=C;
	}
	else
	{
		A=A/C+1;
	}
	if(B%D==0)
	{
		B/=D;
	}
	else
	{
		B=B/D+1;
	}
	C=max(A,B);
	printf("%d\n",L-C);
	return 0;
}
//13:25.249cliar!!


Measured memory_bytes: 3148
#include<algorithm>
#include<iostream>
#include<cstring>
#include<cstdio>
#include<cmath>

int a,b;

int main(){

	scanf("%d%d",&a,&b);
	if(0<a)
		printf("Positive\n");
	else if(b<0){
		if(-(b-a-1)&1)
			printf("Negative\n");
		else
			printf("Positive\n");
	}
	else
		printf("Zero\n");
	//system("pause");
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define F(i, s, t) for (int i = (s), _ = (t); i <= _; i ++)
#define Fo(i, s, t) for (int i = (s), _ = (t); i < _; i ++)
#define LL long long
const int N = 20;
const int S = 40000;
const int P = 1000000007;
int n, m, gr[N];
int p2[N*N], fu, cnt[S], edc[N][S];
int f[S];
int rd() {
	int x = 0; char c;
	do { c = getchar(); } while (!isdigit(c));
	do { x = x*10+c-'0', c = getchar(); } while (isdigit(c));
	return x;
}
int Ju(int s) { return (s & 3) == 0 || (s & 3) == 3; }
int main() {
	n = rd(), m = rd();
	F(i, 1, m) {
		int x = rd(), y = rd();
		gr[x] |= (1 << y-1);
	}
	p2[0] = 1;
	F(i, 1, n*n) p2[i] = p2[i-1] * 2 % P;
	fu = 1 << n;
	Fo(i, 1, fu) cnt[i] = cnt[i - (i & -i)] + 1;
	F(i, 1, n)
		Fo(s, 0, fu)
			edc[i][s] = cnt[gr[i] & s];
	f[0] = 1;
	Fo(s, 1, fu) if (Ju(s)) {
		for (int a = (s-1) & s; ; a = (a-1) & s) if (Ju(a) && f[a]) {
			int b = s-a, m = 1;
			F(i, 1, n)
				if (a >> i-1 & 1)
					m = (LL)m * (p2[edc[i][b]] - 1) % P;
			F(i, 1, n)
				if (b >> i-1 & 1)
					m = (LL)m * p2[edc[i][a]] % P;
			f[s] = (f[s] + (LL)f[a] * m) % P;
			if (!a) break;
		}
	}
	cout << (p2[m] - f[fu-1] + P) % P << endl;
	return 0;
}

Measured memory_bytes: 2432