akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define ll long long
#define ld long double
#define ull unsigned long long
#define yes cout << "YES" \
                 << "\n"
#define no cout << "NO" \
                << "\n"
#define MOD 1000000007
using namespace std;
const double pi = 3.14159265358979323846;
const int MAX_CHARS = 256;

template <typename T>
T Maxnun(T x, T y)
{
    return (x > y) ? x : y;
}
long long fast_power(long long base, long long power)
{
    long long result = 1;
    while (power > 0)
    {

        if (power % 2 == 1)
        { // Can also use (power & 1) to make code even faster
            result = (result * base) % MOD;
        }
        base = (base * base) % MOD;
        power = power / 2; // Can also use power >>= 1; to make code even faster
    }
    return result;
}
bool isPrime(int n)
{
    // Corner cases
    if (n <= 1)
        return false;
    if (n <= 3)
        return true;

    // This is checked so that we can skip
    // middle five numbers in below loop
    if (n % 2 == 0 || n % 3 == 0)
        return false;

    for (int i = 5; i * i <= n; i = i + 6)
        if (n % i == 0 || n % (i + 2) == 0)
            return false;

    return true;
}
template <typename T, typename X>
void pairsort(T a[], T b[], T n)
{
    pair<T, X> a_p[n];
    for (T i = 0; i < n; i++)
    {
        a_p[i].first = a[i];
        a_p[i].second = b[i];
    }
    sort(a_p, a_p + n);
    for (T i = 0; i < n; i++)
    {
        b[i] = a_p[i].second;
    }
}
ll power(ll x, ll y)
{
    ll res = 1; // Initialize result

    while (y > 0)
    {
        // If y is odd, multiply x with result
        if (y & 1)
            res = res * x;

        // y must be even now
        y = y >> 1; // y = y/2
        x = x * x;  // Change x to x^2
    }
    return res;
}
ll kthRoot(ll n, ll k)
{
    return pow(k,
               (1.0 / k) * (log(n) / log(k)));
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll x;
    cin >> x;
    if (x == 0)
        cout << 1 << "\n";
    if (x == 1)
        cout << 0 << "\n";
}


Measured memory_bytes: 3692
// see https://gist.github.com/LumaKernel/ff55d49ee1af69b7388f15b707e75c15
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <algorithm>
#include <cmath>
#include <cstring>
#include <complex>
#include <random>
#include <iomanip>

using namespace std;

typedef long long ll;
typedef pair<int, int> P;
typedef vector<int> VI;
typedef vector<P> VP;

#define omajinai ios::sync_with_stdio(false);cin.tie(0)

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

#define LFOR(i,a,b) for(ll i=(a);i<(b);++i)
#define RLFOR(i,b,a) for(ll i=(b)-1;i>=(a);--i)

#define ALL(a) (a).begin(),(a).end()
#define UNIQUE(a) (a).erase(unique((a).begin(),(a).end()),(a).end())
#define MP make_pair
#define PB push_back
#define EACH(i,c) REP(i,(int)(c).size())
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

#define dump(x) cerr << "[L " << __LINE__ << "] " << #x << " = " << (x) << "\n";
#define dump2(x,y) cerr << "[L " << __LINE__ << "] " << #x << " = " << (x)\
			<< " , " << #y << " = " << (y) << "\n";

const int INF = 1e9;
const double EPS = 1e-10;

int n,m;
VI g[50];
ll k;

bool bfs(int bannedA, int bannedB){
	queue<int> q; // point
	set<int> went;
	went.insert(bannedA);
	q.push(bannedA);
	while(!q.empty()){
		int i = q.front();
		q.pop();
		REP(j, (int)g[i].size()){
			int k = g[i][j];
			if((i==bannedA && k==bannedB) ||
				(k==bannedA && i==bannedB))
					continue;
			if(!EXIST(went, k)){
				went.insert(k);
				q.push(k);
			}
		}
	}

	return (int)went.size() == n;
}

int main() {
	cin>>n>>m;
	REP(i,m){
		int a,b;
		cin>>a>>b;
		a--;b--;
		g[a].PB(b);
		g[b].PB(a);
	}
	dump(1);
	int ans=0;
	REP(i,n){
		REP(j,(int)g[i].size()){
			if(!bfs(i, g[i][j]))ans++;
		}
	}
	cout<<ans/2<<endl;
}


Measured memory_bytes: 384
#include<bits/stdc++.h>
#define Vsort(a) sort(a.bigin(), a.end())
#define rep(i,n) for(int i = 0; i < (n); i++)

using namespace std;
using ll = long long;

int main(){
  int n, ac = 0, wa = 0, tle = 0, re = 0;
  cin >> n;
  vector<string> s(n);
  for(int i = 0; i < n; i++){
    cin >> s[i];
    if(s[i] == "AC"){
      ac++;
    }else if(s[i] == "WA"){
      wa++;
    }else if(s[i] == "TLE"){
      tle++;
    }else{
      re++;
    }
  }
  cout << "AC x " << ac << endl;
  cout << "WA x " << wa << endl;
  cout << "TLE x " << tle << endl;
  cout << "RE x " << re << endl;
  return 0;
}


Measured memory_bytes: 6432
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int n;
	cin>>n;
	vector<int> a;
	a.push_back(-1);
	for(int i=0;i<n;i++)
	{
		int q;
		cin>>q;
		a.push_back(q);
	}
	sort(a.begin(),a.end());
	int p=0;
	cout<<a[(n/2)+1]-a[(n/2)]<<endl;
	
}

Measured memory_bytes: 892
def main():
	n, ma, mb, *L = map(int, open(0).read().split())
	M = 1 << 30
	dp = [[M] * 420 for _ in range(420)]
	dp[0][0] = 0
	ua = ub = 15
	for a, b, c in zip(*[iter(L)] * 3):
		for i in range(ua, -1, -1):
			for j in range(ub, -1, -1):
				t = dp[i][j] + c
				if dp[i + a][j + b] > t:
					dp[i + a][j + b] = t
					if ua < i + a:
						ua = i + a
					if ub < j + b:
						ub = j + b
	ans = M
	_ma, _mb = ma, mb
	while _ma < 410 > _mb:
		ans = min(ans, dp[_ma][_mb])
		_ma += ma
		_mb += mb
	print(ans if ans < M else -1)


if __name__ == "__main__":
	main()


Measured memory_bytes: 4980
import numpy as np

n = int(input())
h = np.array([0] + [int(item) for item in input().split()] + [0])

count = 0
while np.count_nonzero(h) > 0:
  zid = np.where(h==0)[0]
  for item in range(len(zid)-1):
    if zid[item+1] - zid[item] > 1:
      h[zid[item]+1:zid[item+1]] -= 1
      count += 1
print(count)

Measured memory_bytes: 12448
#include <cstdio>
#include <iostream>
#include <cstring>
#include <algorithm>
#include <vector>
#define travel(x, i) for (int i = fir[x]; i; i = e[i].nxt)
#define rep(i, x, y) for (int i = (x); i <= (y); i ++)
using namespace std;

typedef long long LL;
const int N = 2e5 + 5;

namespace Graph2 {
    struct edge {
	int nxt, to;
    } e[N << 1];
    int fir[N], cnt = 0, dep[N], fa[N][18];

    inline void addedge(int x, int y) {
	e[++ cnt] = (edge){fir[x], y};
	fir[x] = cnt;
    }
    inline void Dfs(int x, int f) {
	dep[x] = dep[f] + 1;
	fa[x][0] = f;
	rep(i, 1, 17)
	    fa[x][i] = fa[fa[x][i - 1]][i - 1];
	travel(x, i)
	    if (e[i].to != f) Dfs(e[i].to, x);
    }
    inline int LCA(int x, int y) {
	if (dep[x] < dep[y]) swap(x, y);
	for (int i = 17; (~ i) && dep[x] != dep[y]; i --)
	    if (dep[fa[x][i]] >= dep[y]) x = fa[x][i];
	if (x == y) return x;
	for (int i = 17; (~ i) && fa[x][0] != fa[y][0]; i --)
	    if (fa[x][i] != fa[y][i]) {
		x = fa[x][i];
		y = fa[y][i];
	    }
	return fa[x][0];
    }
    inline int Dis(int x, int y) {
	return dep[x] + dep[y] - (dep[LCA(x, y)] << 1);
    }
}

namespace Graph1 {
    struct edge {
	int nxt, to;
    } e[N << 1];
    int fir[N], cnt = 0, dep[N], MAX;
    bool safe[N], flag;

    inline void addedge(int x, int y) {
	e[++ cnt] = (edge){fir[x], y};
	fir[x] = cnt;
    }
    inline void Dfs(int x, int f) {
	if (flag) return;
	dep[x] = dep[f] + 1;
	if (Graph2 :: dep[x] <= dep[x]) return;
	MAX = max(MAX, max(dep[x], Graph2 :: dep[x]) << 1);
	if (safe[x]) {
	    flag = 1;
	    return;
	}
	travel(x, i)
	    if (e[i].to != f) Dfs(e[i].to, x);
    }
}

using namespace Graph1;

int main() {
    int n, x, y, u, v;
    scanf("%d%d%d", &n, &x, &y);
    dep[0] = -1;
    Graph2 :: dep[0] = -1;
    rep(i, 1, n - 1) {
	scanf("%d%d", &u, &v);
	addedge(u, v);
	addedge(v, u);
    }
    rep(i, 1, n - 1) {
	scanf("%d%d", &u, &v);
	Graph2 :: addedge(u, v);
	Graph2 :: addedge(v, u);
    }
    Graph2 :: Dfs(y, 0);
    rep(i, 1, n) {
	travel(i, j) {
	    if (Graph2 :: Dis(i, e[j].to) >= 3) safe[i] = 1;
	}
    }
    Dfs(x, 0);
    if (flag) puts("-1");
    else printf("%d\n", MAX);
    return 0;
}


Measured memory_bytes: 27904
#include <iostream>
#include <vector>
#include <queue>
#include <algorithm>
#include <set>

using namespace std;

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

int N,Q;
int X[100010];

struct Event {
	int t;
	int type;
	int x;
	Event(int t, int type, int x) : t(t), type(type), x(x) {}
	bool operator<(Event &b) {
		if (t == b.t) {
			return type < b.type;
		}
		return t < b.t;
	}
};

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

	cin >> N >> Q;

	vector<Event> events;

	rep(i, N) {
		int s, t, x;
		cin >> s >> t >> x;
		events.push_back(Event(s - x, 1, x));
		events.push_back(Event(t - x, -1, x));
	}

	sort(begin(events), end(events));

	multiset<int> se;
	vector<int> ans(Q);

	int cur = 0;
	rep(i, Q) {
		int d; cin >> d;
		while (cur < events.size() and events[cur].t <= d) {
			if (events[cur].type == 1) {
				se.insert(events[cur].x);
			} else {
				auto itr = se.find(events[cur].x);
				se.erase(itr);
			}
			cur++;
		}

		if (se.empty()) {
			ans[i] = -1;
		} else {
			ans[i] = *se.begin();
		}
	}

	rep(i, Q) {
		cout << ans[i] << endl;
	}
}


Measured memory_bytes: 23528
MOD = 10**9+7
N, K = map(int, input().split())
*A, = map(int, input().split())

allm = True
for a in A:
    if a > 0:
        allm = False
        break

if N == K:
    ans = 1
    for a in A:
        ans = (ans*a) % MOD
    print(ans)
elif allm and K % 2 == 1:
    A.sort()
    A.reverse()
    ans = 1
    for a in A[:K]:
        ans = (ans*a) % MOD
    print(ans)
else:
    p, m = [], []
    for a in A:
        if a > 0:
            p.append(a)
        if a < 0:
            m.append(-a)
    p.sort(key=lambda k: -k)
    m.sort(key=lambda k: -k)

    pi, mi = 0, 0
    ans = 1

    # Kが奇数の場合はplusから最初に一つとっておく
    if K % 2 == 1:
        pi = 1
        ans = p[0]
        K -= 1

    while K > 0:
        if K == 1:
            ans = (ans*p[pi]) % MOD
            break
        elif pi < len(p)-1 or mi < len(m)-1:
            pv, mv = 0, 0
            if pi < len(p)-1:
                pv = p[pi]*p[pi+1]
            if mi < len(m)-1:
                mv = m[mi]*m[mi+1]

            if pv > mv:
                ans = (ans*pv) % MOD
                pi += 2
            else:
                ans = (ans*mv) % MOD
                mi += 2
            K -= 2
        else:
            ans = 0
            break
    print(ans)


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

int main(){
  int n, t, a;
  cin >> n >> t >> a;
  int index = 0;
  double temp = t;
  double dif = 1000;
  int times = 0;
  for (int i; i<n; i++){
    times ++;
    int h;
    cin >> h;
    double temp = t - 0.006*h;
    double dif2 = abs(temp - a);
    if (dif2<dif){
      dif = dif2;
      index = times;
    }
  }
  cout << index << endl; 
}

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

int gcd( int m, int n )
{
	while( m != n )
	{
		if ( m > n ) m = m - n;
		else         n = n - m;
	}
	return m;
}

int lcmfunction(int m, int n )
{
	return ((m / gcd(m, n)) * n);
}

int main() {
	bitset<8368800> flgs;

	while(1){
		flgs.reset();
		int m,n;
		// ?????????????????£????????°
		int loop = 0;
		cin >> m >> n;
		if(m == 0 && n == 0) break;
	  int lcm = lcmfunction(n, m);

		if(m > n){
				cout << m + n << "\n";
		}else{
			int i;
	  	for(i = m ; loop <= n ; i++){
				if(flgs.test(i)){
				}else{
					loop++;
					int lim = 7368792 / i + 1;
					for(int j = 1 ; j < lim ; j++){
						flgs.set(i * j);
					}
		//			cout << "i = " << i << " loop = " << loop << "\n";
				}
			}

			cout << i - 1 << "\n";
		}
	}
	return 0;
}

Measured memory_bytes: 4052
#include<iostream>
#include<string>
#include<algorithm>
#include<iomanip>
#define pi 3.141592653589793283462
using namespace std;
int main(){
    int m,f,r;
    while (1)
    {
        cin>>m>>f>>r;
        if(m==-1 && f==-1 && r==-1)
            break;
        else if(m==-1 || f==-1)
            cout<<"F"<<endl;
        else if(m+f>=80)
            cout<<"A"<<endl;
        else if(m+f>=65 && m+f<80)
            cout<<"B"<<endl;
        else if(m+f>=50 && m+f<65)
            cout<<"C"<<endl;
        else if(m+f>=30 && m+f<50){
            if(r>=50)
                cout<<"C"<<endl;
            else
                cout<<"D"<<endl;
        }
        else
            cout<<"F"<<endl;
    }
    return 0;
}

Measured memory_bytes: 1152
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i=0;i<n;++i)
#define rep1(i,n) for(int i=1;i<=n;++i)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout<< (x) << " "
int main(){
    map<string, ll> m;
    int n;cin>>n;
    string s;
    rep(i,n){
        cin>>s;sort(s.begin(), s.end());m[s]++;
    }
    ll ans=0;
    for(auto i = m.begin();i!=m.end();i++){
        ans+=(i->second*(i->second-1)/2);
    }
    co(ans);
}


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

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

  int minus[n+1];
  int plus[n+1];
  for(int i=0; i<n; i++) {
    minus[i] = i+1-a[i];
    plus[i] = i+1+a[i];
  }
  minus[n] = 2000000000;
  plus[n] = 2000000001;

  sort(minus, minus+n+1);
  sort(plus, plus+n+1);

  int mnow = 0;
  int pnow = 0;
  int64_t ans = 0;
  while(mnow<n && pnow<n) {
    if(minus[mnow]<plus[pnow]) {
      mnow++;
      continue;
    }
    else if(minus[mnow]>plus[pnow]) {
      pnow++;
      continue;
    }

    int64_t mcount = 1;
    int64_t pcount = 1;
    int now = minus[mnow];
    while(minus[mnow+mcount]==now) mcount++;
    while(plus[pnow+pcount]==now) pcount++;
    ans += mcount*pcount;
    mnow += mcount;
    pnow += pcount;
  }

  cout<<ans<<endl;

  return 0;
}

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

namespace ProblemD
{
    class Program
    {
        static void Main()
        {
            long N = long.Parse(Console.ReadLine());
            var list = new List<long>();

            if (N == 1)
            {
                Console.WriteLine(0);
                return;
            }
            else
            {
                foreach (long factor in PrimeFactors(N))
                {
                    list.Add(factor);
                }
                var used = new List<long>();
                long count = 0;
                long number = 1;
                for (int i = 0; i < list.Count;)
                {
                    if (number == 1 || number % list[i] == 0)
                    {
                        number *= list[i];
                    }
                    else
                    {
                        number = list[i];
                    }
                    if (used.Contains(number))
                    {
                        i++;
                    }
                    else
                    {
                        count++;
                        list.RemoveAt(i);
                        used.Add(number);
                        number = 1;
                    }
                }
                Console.WriteLine(count);
            }
            
        }

        public static IEnumerable<long> PrimeFactors(long n)
        {
            long i = 2;
            long tmp = n;

            while (i * i <= n) 
            {
                if (tmp % i == 0)
                {
                    tmp /= i;
                    yield return i;
                }
                else
                {
                    i++;
                }
            }
            if (tmp != 1) yield return tmp;
        }
    }
}

Measured memory_bytes: 27852
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <queue>
#include <algorithm>
#include <utility>
#include <cmath>
#include <bitset>
#include <map>

#define INF_LL 9000000000000000000
#define INF 2000000000

#define REP(i, n) for(int i = 0;i < (n);i++)
#define FOR(i, a, b) for(int i = (a);i < (b);i++)

using namespace std;

typedef long long ll;
typedef pair<int, int> PII;

class Union_find{
private:
	vector<int> par;
	vector<int> rank;
	int n;

public:
	Union_find(int a){
		n = a;
		for(int i = 0;i < n;i++){
			par.push_back(i);
			rank.push_back(0);
		}
	}

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

	void unite(int x, int y){
		x = find(x);
		y = find(y);
		if(x == y) return;

		if(rank[x] < rank[y]){
			par[x] = y;
		}else{
			par[y] = x;
			if(rank[x] == rank[y]) rank[x]++;
		}
	}

	bool same(int x, int y){
		return find(x) == find(y);
	}
};

int main(){
	string s;
	cin >> s;
	cout << s.substr(0, 5) << " " << s.substr(6, 7) << " " << s.substr(14, 5) << endl;
}


Measured memory_bytes: 256
import java.util.*;
public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int W = sc.nextInt();
		int a = sc.nextInt();
		int b = sc.nextInt();
		if(a+W<b) {
			System.out.println(b-a-W);
		}else if(b+W<a) {
			System.out.println(a-b-W);
		}else{
			System.out.println("0");
		}
	}
}

Measured memory_bytes: 21844
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define REP(i,m,n) for(int i=(int)(m); i<(int)(n); i++)
#define rep(i,n) REP(i,0,n)
#define RREP(i,m,n) for(int i=(int)(m); i>=(int)(n); i--)
#define rrep(i,n) RREP(i,n-1,0)
#define REPL(i,m,n) for(ll i=(ll)(m); i<(ll)(n); i++)
#define repl(i,n) REPL(i,0,n)
#define all(v) v.begin(), v.end()
const int inf = 1e9+7;
const ll longinf = 1LL<<60;
const ll mod = 1e9+7;

int main() {
  string s;
  cin >> s;
  string ans;
  for(char c: s) {
    if(c == '0') {
      ans += '0';
    } else if(c == '1') {
      ans += '1';
    } else {
      if(ans.size() > 0) ans.erase(ans.size()-1);
    }
  }
  cout << ans << endl;
  return 0;
}



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

#define ll long long
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define sc(x) scanf("%lld",&x)
#define pr(x) printf("%lld\n",x)
#define clr(x) memset(x, 0, sizeof(x))
#define all(x) x.begin(), x.end()
typedef pair<ll, ll> pii;
typedef vector< ll > vl;
typedef vector< pii > vpii;

//DONT WASTE YOUR TIME
//prove yourself
//remember....fuck ps&&as hard....show them your are better then them
//Be confident.....dont lose hope.......You can do it.....
//dimaag  khoob h tere meh ....bas concentration ki kami h
//CONCENTRATE
//A,B,C dimaag nhi ...observation h .....zyaada mat sochna unme.....bas observe karna dhyaan se aur implement kar daal jitni jaldi ho sake

//capture it

const ll N= 1e6+55,mod = 1e9+7;
int main() {
 	//freopen("task.in","r",stdin);freopen("task.out","w",stdout);
	ll i,j,c=0,x=0,y=0,f=0,k=0;
	string s;
	cin>>s;
	j=s.size();
	j--;
	i=0;
	while(i<j){
		if(s[i]==s[j]){
			i++;
			j--;
			continue;
		}
		if(s[i]!='x' && s[j]!='x'){
			cout<<"-1\n";
			return 0;
		}
		if(s[i]=='x'){
			c++;
			i++;
			continue;
		}
		if(s[j]=='x'){
			c++;
			j--;
			continue;
		}
	}
	pr(c);


}

Measured memory_bytes: 512
#include <unordered_map>
#include <unordered_set>
#include <algorithm>
#include <iostream>
#include <iostream>
#include <fstream>
#include <numeric>
#include <cstring>
#include <cassert>
#include <string>
#include <vector>
#include <queue>
#include <deque>
#include <cmath>
#include <set>
#include <map>
#include <functional>
#include <bitset>
#include <iomanip>
#include <stack>
#include <list>
#include <cstdint>
#include <chrono>

using namespace std;
#define     loop(n,i,a)     for(ll i=a;i<n;i++)
#define     loopR(n,i,a)    for(ll i=a-1;i>=n;i--)
#define     all(arr,n)      arr,arr+n
#define     allv(v)         (v).begin(),(v).end()
#define     rallv(v)        (v).rbegin(),(v).rend()
#define     m_p             make_pair
#define     ll              long long
#define     pii             pair<ll,ll>
#define     vi              vector<int>
#define     vll             vector<ll>
#define     vii             vector<pii>
#define     sz(x)           (int)x.size()
#define     pb              push_back
#define     endl            "\n"
#define     Endl            "\n"
#define     f               first
#define     s               second
#define     mem(dp,n)       memset(dp,n,sizeof dp)
template<typename T>void max_self(T &a,T b){a=max(a,b);}
template<typename T>void min_self(T &a,T b){a=min(a,b);}
int dx[] = { 1 , 0 ,-1 , 0 ,-1 ,-1 , 1 , 1 };
int dy[] = { 0 , 1 , 0 ,-1 ,-1 , 1 ,-1 , 1 };
int KnightI[] = { 2, 1, -1, -2, -2, -1, 1, 2 };
int KnightJ[] = { 1, 2, 2, 1, -1, -2, -2, -1 };
void fast(){
    std::ios_base::sync_with_stdio(0);
    cin.tie(NULL);
    cout.tie(NULL);
}
vector<string> vec_splitter(string s) {
    s += ',';
    vector<string> res;
    while(!s.empty()) {
        res.push_back(s.substr(0, s.find(',')));
        s = s.substr(s.find(',') + 1);
    }
    return res;
}
void debug_out(
        vector<string> __attribute__ ((unused)) args,
        __attribute__ ((unused)) int idx,
        __attribute__ ((unused)) int LINE_NUM) { cerr << endl; }
template <typename Head, typename... Tail>
void debug_out(vector<string> args, int idx, int LINE_NUM, Head H, Tail... T) {
    if(idx > 0) cerr << ", "; else cerr << "Line(" << LINE_NUM << ") ";
    stringstream ss; ss << H;
    cerr << args[idx] << " = " << ss.str();
    debug_out(args, idx + 1, LINE_NUM, T...);
}
#define debug(...) debug_out(vec_splitter(#__VA_ARGS__), 0, __LINE__, __VA_ARGS__)
const ll mxN=4e5+10,oo=0x3f3f3f3f,MOD=1e9+7;
const long double PI = acos(-1),eps=1.0e-14;

void solve(){
    ll a,b;
    cin>>a>>b;
    cout<<a*b/__gcd(a,b)<<endl;
}
int main() {
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
    fast();
    solve();

}


Measured memory_bytes: 3576
open System

let f (len: int) (str: string): string =
    if str.Length <= len then 
        str 
    else 
        str.ToCharArray()
        |> Array.take len
        |> Array.map string 
        |> String.concat ""
        |> fun s -> s + "..."

let K = Console.ReadLine() |> int 
let S = Console.ReadLine()

f K S 
|> printfn "%s"

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

#define rep(i,n) for(long long i=0;i<(long long)(n);i++)
#define REP(i,k,n) for(long long i=k;i<(long long)(n);i++)
#define all(a) a.begin(),a.end()
#define NP next_permutation
#define pb push_back
#define eb emplace_back
#define lb(v,k) (lower_bound(all(v),k)-v.begin())
#define ub(v,k) (upper_bound(all(v),k)-v.begin())
#define fi first
#define se second
#define pi M_PI
typedef long long ll;
typedef pair<ll,ll> P;
typedef tuple<ll,ll,ll> PP;
typedef multiset<ll> S;
typedef priority_queue<ll> PQ;
typedef priority_queue<P,vector<P>,greater<P>> SPQ;
using vi=vector<ll>;
using vvi=vector<vi>;
using vvvi=vector<vvi>;

const ll inf=1001001001001001;
const int INF=1001001001;
const int mod=1000000007;

template<class T> bool chmin(T&a,T b){if(a>b){a=b; return true;}return false;}
template<class T> bool chmax(T&a,T b){if(a<b){a=b; return true;}return false;}
template<class T> void decimal(T a){cout<<fixed<<setprecision(a);}
template<class T> void out(T a){cout<<a<<endl;}
template<class T> void outp(T a){cout<<'('<<a.fi<<','<<a.se<<')'<<endl;}
template<class T> void outvp(T v){rep(i,v.size())outp(v[i]);}
template<class T> void outv(T v){rep(i,v.size()){if(i)cout<<' ';cout<<v[i];}cout<<endl;}
template<class T> void outvv(T v){rep(i,v.size()){rep(j,v[i].size()){if(j)cout<<' ';cout<<v[i][j];}cout<<endl;}}

void YesNo(bool a){if(a) out("Yes"); else out("No");}
void yesno(bool a){if(a) out("yes"); else out("no");}
void YESNO(bool a){if(a) out("YES"); else out("NO");}
ll GCD(ll a,ll b){if(b==0) return a; return GCD(b,a%b);}
ll LCM(ll a,ll b){return(a/GCD(a,b))*(b/GCD(a,b))*GCD(a,b);}
ll POW(ll a,ll b){ll c=1; while(b>0){if(b&1){c=a*c %mod;}a=a*a %mod;b>>=1;}return c;}
vi calc(ll x){vi res; while(x>0){res.eb(x%10);x/=10;}reverse(all(res)); return res;}

void solve() {
  ll n,k;
  cin>>n>>k;
  double ans=0;
  REP(i,1,n+1){
    double cnt=1;
    ll j=i;
    while(j<k){
      j*=2; cnt/=2;
    }
    //out(j);
    ans+=cnt;
  }
  ans/=n;
  decimal(10);
  out(ans);
}

signed main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  solve();
}


Measured memory_bytes: 256
import math

X = int(input())
A, B = 0, 0

for i in range(1000):
    for j in range(-1000, 1000):
        x = int(math.pow(i, 5) - math.pow(j, 5))
        if X == x:
            A, B = i, j
            break
print(A,B)

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

int main(){
    int n,k;
    scanf("%d%d",&n,&k);
    int ans=0,tmp=1;
    for(int i=0;i<k;i++){
        int x,y;
        scanf("%d",&x);
        if(x>tmp){
            ans=x-tmp;
            tmp+=x;
            continue;
        }
        tmp+=x;
        int mi=min(ans,x);
        ans-=mi;
        //printf("%d.%d.\n",ans,tmp);
    }
    printf("%d\n",ans);
}


Measured memory_bytes: 256
N = int(input())
L = input()

Li = L.split(' ')
Li = map((lambda x: int(x)), Li)
L = [i for i in Li]

if len(L) < 3:
    L = [0,0,0]

cnt = 0
for i in range(N-2):
    for j in range(i+1,N-1):
        for k in range(j+1,N):
           if L[i] + L[j] > L[k] and L[i] + L[k] > L[j] and L[k] + L[j] > L[i]\
               and L[i] != L[j] and L[j] != L[k] and L[k] != L[i]:
                   cnt += 1
print(cnt)

Measured memory_bytes: 9160
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n)   FOR(i,0,n)
#define pb emplace_back
typedef long long ll;
typedef pair<int,int> pint;

int p[11],c[11];
int main(){
    int d,g;
    cin>>d>>g;
    rep(i,d) cin>>p[i]>>c[i];
    int mn=1000100010;
    rep(i,1<<d){
        int sum=0,cnt=0;
        rep(j,d)if(i>>j&1){
            sum+=p[j]*(j+1)*100+c[j];
            cnt+=p[j];
        }
        
        if(sum<g)for(int j=d-1;j>=0;--j)if(!(i>>j&1)){
            int tmp=min(p[j],(g-sum-1)/((j+1)*100)+1);
            cnt+=tmp;
            sum+=tmp*(j+1)*100+((tmp==p[j])?c[j]:0);
            if(sum>=g) break;
        }
        mn=min(cnt,mn);
    }
    cout<<mn<<endl;
    return 0;
}


Measured memory_bytes: 256
#include<cstdio>
#include<cstdlib>
#include<algorithm>
#include<iostream>
#include<queue>
#include<vector>
#include <bitset>
#include <cmath>
#include <limits>
#include <iostream>
#include<stack>
#include<tuple>
using namespace std;
#define INF 1100000000000
#define MAX 100000
#define MOD 100000
typedef long long ll;
typedef pair<int,int> P;
typedef pair<pair<int,int>,int> p;
typedef pair< pair<int,int>, int> p; 
#define bit(n,k) ((n>>k)&1) /*nのk bit目*/
#define rad_to_deg(rad) (((rad)/2/M_PI)*360)

ll dp[110][310000];

int main(){
    int N,W,w[110];
    ll v[110];
    cin>>N>>W;
    for(int i=0;i<N;i++) cin>>w[i]>>v[i];

    for(int i=0;i<N;i++){
        for(int j=0;j<=W;j++){
            dp[i+1][j+w[i]]=max(dp[i+1][j+w[i]],dp[i][j]+v[i]);
            dp[i+1][j]=max(dp[i+1][j],dp[i][j]);
        }
    }
    ll ans=0;
    for(int i=0;i<=W;i++){
        ans=max(ans,dp[N][i]);
    }
    cout<<ans<<endl;
}



Measured memory_bytes: 241920
s = input()
ss = set(s)
if len(ss) == 1:
  print('YES' if len(s) == 1 else 'NO')
elif len(ss) == 2:
  print('YES' if len(s) == 2 else 'NO')
else:
  counts = [s.count(c) for c in ss]
  print('YES' if max(counts) - min(counts) < 2 else 'NO')
  

Measured memory_bytes: 9192
import std.stdio, std.conv, std.functional, std.string;
import std.algorithm, std.array, std.container, std.range, std.typecons;
import std.bigint, std.numeric, std.math, std.random;
import core.bitop;

string FMT_F = "%.10f";

static File _f;
void file_io(string fn) { _f = File(fn, "r"); }
static string[] s_rd;
T _RD(T = long)() { while(!s_rd.length) s_rd = readln.chomp.split; string res = s_rd[0]; s_rd.popFront; return res.to!T; }
T _RD(T = long)(File f) { while(!s_rd.length) s_rd = f.readln.chomp.split; string res = s_rd[0]; s_rd.popFront; return res.to!T; }
T[] _RDA(T = long)(T fix = 0) { auto r = readln.chomp.split.to!(T[]); r[] += fix; return r; }
T[] _RDA(T = long)(File f, T fix = 0) { auto r = f.readln.chomp.split.to!(T[]); r[] += fix; return r; }
T RD(T = long)() { if (_f.isOpen) return _RD!T(_f); else return _RD!T; }
T[] RDA(T = long)(T fix = 0) { if (_f.isOpen)  return _RDA!T(_f, fix); else return _RDA!T(fix); }

size_t[] MAKE_IDX(alias less = "a < b", Range)(Range range) { auto idx = new size_t[](range.length); makeIndex!(less)(range, idx); return idx;}
size_t MIN_POS(alias less = "a < b", Range)(Range range) { auto r = minPos!(less)(range); return range.length - r.length; }

void chmin(T)(ref T x, T y) { x = min(x, y); } void chmax(T)(ref T x, T y) { x = max(x, y); }
bool inside(T)(T x, T b, T e) { return x >= b && x < e; }
T lcm(T)(T x, T y) { return x * (y / gcd(x, y)); }

long mod = 10^^9 + 7;
//long mod = 998_244_353;
//long mod = 1_000_003;
void moda(T)(ref T x, T y) { x = (x + y) % mod; }
void mods(T)(ref T x, T y) { x = ((x + mod) - (y % mod)) % mod; }
void modm(T)(ref T x, T y) { x = (x * y) % mod; }
void modpow(T)(ref T x, T y) { if (!y) { x = 1; return; } auto t = x; x.modpow(y>>1); x.modm(x); if (y&1) x.modm(t); }
void modd(T)(ref T x, T y) { y.modpow(mod - 2); x.modm(y); }

void main()
{
	auto N = RD;
	auto D = RD;
	auto X = new long[](N);
	auto Y = new long[](N);
	foreach (i; 0..N)
	{
		X[i] = RD;
		Y[i] = RD;
	}

	long ans;
	foreach (i; 0..N)
	{
		if(X[i]^^2 + Y[i]^^2 <= D^^2)
			++ans;
	}
	
	writeln(ans);
	stdout.flush;
	debug readln;
}

Measured memory_bytes: 14232
#pragma GCC optimize("Ofast,no-stack-protector,unroll-loops,fast-math")
#include <bits/stdc++.h>
using namespace std;
template<class t> inline t read(t &x){
	char c=getchar();bool f=0;x=0;
	while(!isdigit(c)) f|=c=='-',c=getchar();
	while(isdigit(c)) x=(x<<1)+(x<<3)+(c^48),c=getchar();
	if(f) x=-x;return x;
}
template<class t,class ...A> inline void read(t &x,A &...a){
	read(x);read(a...);
}
template<class t> inline void write(t x){
	if(x<0) putchar('-'),write(-x);
	else{if(x>9) write(x/10);putchar('0'+x%10);}
}

#define int long long

const int N=15,a[]={0,1,2,4,7,12,20,29,38,52,73};
int maxlen,n,ans[N][N],p[N];

signed main(){
	read(n);
	for(int i=1;i<=n;i++) p[i]=i;
	for(int i=2;i<=n;i++){
		for(int j=1;j<i;j++) ans[j][i]=ans[i][j]=(maxlen+1)*a[j];
		if(i==n) continue;
		do{
			int cur=ans[p[i]][p[0]];
			for(int j=2;j<=i;j++) cur+=ans[p[j-1]][p[j]];
			maxlen=max(maxlen,cur);
		}while(next_permutation(p+1,p+1+i));
	}
	for(int i=1;i<=n;i++,puts("")) for(int j=1;j<=n;j++,putchar(' ')) write(ans[i][j]);
}

Measured memory_bytes: 3592
# coding: utf-8

N, L = map(int, input().split())

apples = [L+i for i in range(N)]

allapples = sum(apples)

applepies = [sum(apples[:i]) + sum(apples[i+1:]) for i in range(N)]

diffs = [abs(allapples-applepie) for applepie in applepies]

print(applepies[diffs.index(min(diffs))])



Measured memory_bytes: 3060
(defun Lamps (n k)
    (let* ((readLamps (make-array n ))
        (dousyutuLamps (make-array `(,(1+ n)) :initial-element 0))
        (stop t)
        )
 
        (dotimes (i n) 
            (setf (aref readLamps i) (read)))
 
    (loop named main-loop
          for _ below k
          do (progn 
            (loop for i below n
                do (let ((l (max 0 (- i (aref readLamps i))))
                    (r (min (- n 1) (+ i (aref readLamps i)))))
                    (incf (aref dousyutuLamps l))
                    (if (<= (1+ r) n)
                        (decf (aref dousyutuLamps (1+ r)))
                    )
                )                    
            )
            (loop for i from 1 to n
                do (incf (aref dousyutuLamps i) (aref dousyutuLamps (- i 1)))
            )
            (loop for i below n
                 
                do (setf stop (and stop (= (aref dousyutuLamps i) n)))
                do (setf (aref readLamps i) (aref dousyutuLamps i))
                do (setf (aref dousyutuLamps i) 0)
                
            ) 
            
            (if stop
                (return-from main-loop)
                (setf stop t))
        )
    )
        (loop for i below (- n 1)
            do(format t "~A "(aref readLamps i))
        )
        (format t "~A~%" (aref readLamps (- n 1))))
    
)
(Lamps (read) (read))

Measured memory_bytes: 80160
program main
	implicit none
    integer::a,b
    read(*,*)a,b
    if(a==1 .and. b==1)then
    	write(*,*) 1000000
    else if(a+b==3)then
    	write(*,*) 500000
    else if(a+b==4)then
    	write(*,*) 400000
    else if(a==2 .and. b==3)then
    	write(*,*) 300000
    else if(a==3 .and. b==2)then
    	write(*,*) 300000
    else if (a==3 .and. b==3)then
    	write(*,*) 200000
    else if (a==1 .or. b==1)then
    	write(*,*) 300000
    else if (a==2 .or. b==2)then
    	write(*,*) 200000
    
    else if (a==3 .or. b==3)then
    	write(*,*) 100000
    else
    	write(*,*) 0
    end if
    stop
end program main

Measured memory_bytes: 2808
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <set>
using namespace std;

short h(vector<int> &id){
	short r=0,i=0;
	for(;i<6;i++)r=r*6+id[i];
	return r;
}

// http://www.prefield.com/algorithm/misc/dice.html
enum FACE { TOP, LEFT, FRONT, BACK, RIGHT, BOTTOM };
class dice {
public:
  dice(vector<int>&v):id(v) {}
  void roll_x() { roll(TOP, BACK, BOTTOM, FRONT); }
  void roll_x2() { roll(TOP, FRONT, BOTTOM, BACK); }
  void roll_y() { roll(TOP, LEFT, BOTTOM, RIGHT); }
  void roll_y2() { roll(TOP, RIGHT, BOTTOM, LEFT); }
  void roll_z() { roll(FRONT, RIGHT, BACK, LEFT); }
  void roll_z2() { roll(FRONT, LEFT, BACK, RIGHT); }
  void all_rolls(set<short>&s){
    for (int k = 0; k < 6; (k&1?roll_y():roll_x()),++k)
      for (int i = 0; i < 4; roll_z(), ++i)
        s.insert(h(id));
  }
  vector<int> id;
private:
  void roll(FACE a, FACE b, FACE c, FACE d) {
    int tmp = id[a];
    id[a] = id[b]; id[b] = id[c];
    id[c] = id[d]; id[d] = tmp;
  }
};

int main(){
	map<char,int>m;
	m['R']=0,m['Y']=1,m['B']=2,m['M']=3,m['G']=4,m['C']=5;
	string str;
	vector<int>v(6);
	int n,i,j,r;
	for(;cin>>n,n;){
		set<short>s;
		for(r=i=0;i<n;i++){
			for(j=0;j<6;j++)cin>>str,v[j]=m[str[0]];
			if(s.find(h(v))!=s.end())r++;
			else{
				dice d(v);
				d.all_rolls(s);
			}
		}
		cout<<r<<endl;
	}
}

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

int main(){
  int N; cin >> N;
  vector<vector<int> > f(N, vector<int>(10, 0) );
  vector<vector<int> > p(N, vector<int>(11, 0) );
  
  for(int i = 0; i < N; i++){
    for(int j = 0; j < 10; j++){
      cin >> f[i][j];
    }
  }
  for(int i = 0; i < N; i++){
    for(int j = 0; j <= 10; j++){
      cin >> p[i][j];
    }
  }
  
  int ans = -1e9;
  
  for(int b = 1; b < (1 << 10); b++){
    int tmp = 0;
    for(int i = 0; i < N; i++){
      int c = 0;
      for(int j = 0; j < 10; j++){
        c += ((b>>j) & f[i][j]);
      }
      tmp += p[i][c];
    }
    ans = max(ans,tmp);
  }
  
  cout << ans << endl;
}

Measured memory_bytes: 256
n = int(input())
lst = []
for _ in range(n - 1):
  lst.append([int(i) for i in input().split()])

for i in range(n):
  now = 0
  for c, s, f in lst[i:]:
    if now < s:
      now = c + s
    else:
      mod = now % f
      if mod == 0:
        now += c
      else:
        now += c + f - mod
  print(now)


Measured memory_bytes: 3188
#include<iostream>
#include<string>
#include<cmath>
#include<algorithm>
using namespace std;
int main()
{
	int a,b,n,x,y;
	cin>>n>>a>>b;
	x=fabs(n-a);
	y=fabs(n-b);
	if(x>y)
	cout<<"B"<<endl;
	if(x<y)
	cout<<"A"<<endl;
} 

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

// #include <atcoder/all>

// #LIB#

using namespace std;
// using namespace atcoder;
using ll = long long;
#define double long double
#define rep(i, n) for (long long i = 0; i < (n); ++i)
#define repr(i, a, b) for (auto i = (a); i < (b); ++i)
#define itr(x, c) for (auto&& x : (c))
#define updatemax(t, v) ((t) = std::max((t), (v)))
#define updatemin(t, v) ((t) = std::min((t), (v)))
#ifdef ONLINE_JUDGE
#define endl _endl
const char _endl = (cin.tie(0), cout.tie(0), ios::sync_with_stdio(0), cout.precision(16), '\n');
#endif

int main() {
  ll n;
  cin >> n;
  vector<ll> x(n), y(n);
  rep(i, n) cin >> x[i] >> y[i];
  ll xsum = 0, ysum = 0;
  rep(i, n) {
    xsum += x[i];
    ysum += y[i];
  }
  using pll = pair<ll, ll>;
  auto c1 = [&](const pll& a, const pll& b) { return (a.first * n - xsum) + (a.second * n - ysum) < (b.first * n - xsum) + (b.second * n - ysum); };
  auto c2 = [&](const pll& a, const pll& b) { return (a.first * n - xsum) - (a.second * n - ysum) < (b.first * n - xsum) - (b.second * n - ysum); };
  auto c3 = [&](const pll& a, const pll& b) { return -(a.first * n - xsum) + (a.second * n - ysum) < -(b.first * n - xsum) + (b.second * n - ysum); };
  auto c4 = [&](const pll& a, const pll& b) { return -(a.first * n - xsum) - (a.second * n - ysum) < -(b.first * n - xsum) - (b.second * n - ysum); };
  set<pll, decltype(c1)> s1(c1);
  set<pll, decltype(c2)> s2(c2);
  set<pll, decltype(c3)> s3(c3);
  set<pll, decltype(c4)> s4(c4);
  rep(i, n) {
    s1.emplace(x[i], y[i]);
    s2.emplace(x[i], y[i]);
    s3.emplace(x[i], y[i]);
    s4.emplace(x[i], y[i]);
  }
  vector<pll> vs({*s1.rbegin(), *s2.rbegin(), *s3.rbegin(), *s4.rbegin()});
  ll ans = 0;
  rep(i, 4) repr(j, i + 1, 4) updatemax(ans, abs(vs[i].first - vs[j].first) + abs(vs[i].second - vs[j].second));
  cout << ans << endl;
}


Measured memory_bytes: 56256
N = int(input())
h = list(map(int,input().split()))
cnt = 0
for i in range(max(h)):
    bol = 0
    for j in h:
        if j > i:
            bol = 1
        else:
            cnt += 1 if bol == 1 else 0
            bol = 0
    if bol == 0:
        cnt -= 1
print(max(h)+cnt)

Measured memory_bytes: 9144
#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define FORR(i ,m, n) for(int i = m; i >= n; i--)
#define pb(a) push_back(a)
#define mk(a,b) make_pair(a,b)
#define ll long long
#define INF 999999999
#define IOS cin.tie(0); ios::sync_with_stdio(false)
using namespace std;
typedef pair<int, int> P;
typedef pair<int, P> PP;
typedef pair<ll,ll> LP;
typedef pair<ll,LP> LPP;

int dy[] = {0, 0, 1, -1};
int dx[] = {1, -1, 0, 0};
int gcd(int a,int b){return b ? gcd(b,a%b) : a;}
int lcm(int a,int b){return a/gcd(a,b)*b;}

int main() {
    int N; cin >> N;
    int life[N+10];
    int res;
    rep(i,N) cin >> life[i];
    sort(life,life+N);
    rep(i,N-1){
        if(i==0){res=gcd(life[0],life[1]);}
        else res=gcd(res,life[i+1]);
    }
    cout << res << endl;

    return 0;
}

Measured memory_bytes: 640
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <utility>
#include <string>
#include <queue>

using namespace std;

using PII = pair<int, int>;

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

	vector<int> x(m, 0);
	for (int i = 0; i < m; i++) {
		cin >> x[i];
	}
	sort(x.begin(), x.end());

	priority_queue<int> que;
	for (int i = 0; i < m - 1; i++) {
		que.push(x[i + 1] - x[i]);
	}

	n--;
	int ans = 0;
	while (!que.empty()) {
		auto y = que.top();
		que.pop();

		if (n > 0) {
			n--;
		} else {
			ans += y;
		}
	}

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


Measured memory_bytes: 1276
#include <bits/stdc++.h>
using namespace std;
const int mx = 1e5+100;
int s[mx];
bool c[mx], p[mx];
int main(){
	memset(c, 0, sizeof c);
	memset(p, 0, sizeof p);
	p[0] = p[1] = 0;
	c[0] = c[1] = 1;
	for(int i = 2; i < mx; i++){
		if(!c[i]){
			p[i] = 1;
			for(int j = 2*i; j < mx; j+=i){
				c[j] = 1;
			}
		}
	}
	s[0] = 0;
	for(int i = 1; i < mx; i++){
		if(i%2 && p[i] && p[((i+1)/2)]){
			s[i] = s[i-1]+1;
		}else{
			s[i] = s[i-1];
		}
	}
	int q, l, r;
	cin >> q;
	while(q--){
		cin >> l >> r;
		cout << s[r] - s[l-1] << endl;
	}
}

Measured memory_bytes: 1280
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<ctime>
#include<vector>
#include<queue>
#include<algorithm>
#include<string>
#include<sstream>
#include<cctype>
#include<cmath>
#include<iomanip>
#include<map>
#include<stack>
#include<set>
#include<functional>
#define in(x) x=read()
#define qr read()
#define int ll
#define mp make_pair
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
namespace fastIO
{
    #define BUF_SIZE 100000
    bool IOerror=0;
    inline char nc()
	{
        static char buf[BUF_SIZE],*p1=buf+BUF_SIZE,*pend=buf+BUF_SIZE;
        if (p1==pend){
            p1=buf; pend=buf+fread(buf,1,BUF_SIZE,stdin);
            if (pend==p1){IOerror=1;return -1;}
        }
        return *p1++;
    }
    inline bool blank(char ch){return ch==' '||ch=='\n'||ch=='\r'||ch=='\t';}
    inline ll read()
	{
        bool sign=0; char ch=nc();ll x=0;
        for (;blank(ch);ch=nc());
        if (IOerror)return 0;
        if (ch=='-')sign=1,ch=nc();
        for (;ch>='0'&&ch<='9';ch=nc())x=x*10+ch-'0';
        if (sign)x=-x;
        return x;
    }
    #undef BUF_SIZE
};
using namespace fastIO;
signed main()
{
	//freopen(".in","r",stdin);
	//freopen(".out","w",stdout);
	int n=qr;
	int po=1;
	while(po<n)po*=2;
	if(po==n)return puts("No"),0;
	po/=2;
	puts("Yes");
	for(int i=2;i<n;i+=2)
	{
		cout<<"1 "<<i<<'\n'<<i<<" "<<i+1<<'\n'<<"1 "<<n+i+1<<"\n"<<n+i+1<<" "<<n+i<<'\n'; 
	}
	if(n%2==0)
	{
		cout<<(n^po)<<" "<<(n<<1)<<"\n"<<((po^1)+n)<<' '<<n<<'\n';
		cout<<"3 "<<n+1;
	}
	else
	{
		cout<<"3 "<<n+1;
	}
	return 0;
}

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

#define ll long long
#define ull unsigned long long

using namespace std;

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

	vector <int> x(N);
	vector <int> y(N);
	vector <ll> h(N);
	ll hmin = 100100100100;
	for (int ii = 0; ii < N; ++ii){
		cin >> x[ii] >> y[ii] >> h[ii];
		hmin = min(hmin, h[ii]);
	}

	for (int cx = 0; cx <= 100; ++cx){
		for (int cy = 0; cy <= 100; ++cy){
			for (int ch = hmin; ch <= hmin + 201; ++ch){
				bool valid = true;
				for (int ii = 0; ii < N; ++ii){
					if (h[ii] != max(ch - abs(x[ii]-cx) - abs(y[ii]-cy), 0)){
						valid = false;
						break;
					}
				}
				if (valid){
					cout << cx << " " << cy << " " << ch << "\n";
					return 0;
				}
			}
		}
	}

	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string.h>
#include <ctype.h>
using namespace std;

int main(){
  char c;
  string str;
  int len;

  getline(cin, str);
  len=str.length();
  //cout<<len;
  for(int i=0; i<len; i++){
    if(islower(str[i])){
      str[i]=toupper(str[i]);
      cout<<str[i];
    }else if(isupper(str[i])){
      str[i]=tolower(str[i]);
      cout<<str[i];
    }else{
      cout<<str[i];
    }
  }
  cout<<endl;

  return 0;

}

Measured memory_bytes: 3116
#include<iostream>
using namespace std;
long int j[200000];
int main()
{
	int i;
	cin >> i;
	for (int z=0; z < i; z++)
	{
		cin >> j[z];
	}
	if (i % 2 == 0)
	{
		for (int z = i - 1; z > 0; z = z - 2)
		{
			cout << j[z] << " ";
		}
		for (int z = 0; z < i; z = z + 2)
		{
			cout << j[z] << " ";
		}
	}
	else
	{
		for (int z = i - 1; z >= 0; z = z - 2)
		{
			cout << j[z] << " ";
		}
		for (int z = 1; z < i; z = z + 2)
		{
			cout << j[z] << " ";
		}
	}
}

Measured memory_bytes: 3712
import sys
Input = []
while True:
    try:
        a,b = list(map(int, input().split()))
        Input += a,b
    except EOFError:
        break
    if a!=0:
        for j in range(a):
            for i in range(b):
                if j%2==0 and i%2==0:
                    print('#',end='')
                elif j%2!=0 and i%2!=0:
                    print('#',end='')
                else:
                    print('.',end='')
            print()
        print()


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


int main()
{
	const int MOD=1e9+7;
	int N,M;
	cin>>N>>M;
	vector<int> dp(N+2,0);
	dp[0]=1;
	map<int,int> m;
	rep(i,M)
	{
		int a;
		cin>>a;
		m[a]=1;
	}
	rep(i,N)
	{
		if(m[i+1]!=1) (dp[i+1]+=dp[i])%=MOD;
		if(m[i+2]!=1) (dp[i+2]+=dp[i])%=MOD;
	}
	cout<<dp[N]<<endl;
	return 0;
}

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

#define rep(i,n) for (int i = 0; i < (n); ++i)

using std::cin;
using std::cout;
using std::endl;
using std::string;
using std::vector;

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

  rep(i, s.size()) {
    if (i % 2 == 0) cout << s[i];
  }
  cout << endl;

  return 0;
}


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



int32_t main(){
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr); cout.tie(nullptr);    
    
    int health, A;
    cin >> health >> A;

    int minimum_attacks = 0;
    while (health > 0){
      minimum_attacks++;
      health -= A;
    }
    cout << minimum_attacks << endl;
}


Measured memory_bytes: 256
//Date and time of submission: 
 
#include<bits/stdc++.h>
#define ll long long
using namespace std;
const ll N=1e5+5;
ll a,b,c,d;
int main() {
	ios_base::sync_with_stdio(false); 
	cin.tie(NULL);
	cin>>a>>b>>c>>d;
	cout<<(min(a,b)+min(c,d));
	return 0;
}


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

int main(){
	int N;
	char str[100005],ans[100005];
	char animal1[4]={'S','S','W','W'},animal2[4]={'S','W','S','W'};
	cin>>N;
	for(int i=0;i<N;++i) cin>>str[i];
	bool b=false;
	for(int i=0;i<4;++i){
		ans[0]=animal1[i];
		ans[1]=animal2[i];
		for(int j=1;j<N-1;++j){
			if(ans[j]=='S'){
				if(str[j]=='o') ans[j+1]=ans[j-1];
				if(str[j]=='x'){
					if(ans[j-1]=='S') ans[j+1]='W';
					if(ans[j-1]=='W') ans[j+1]='S';
				}
			}
			if(ans[j]=='W'){
				if(str[j]=='x') ans[j+1]=ans[j-1];
				if(str[j]=='o'){
					if(ans[j-1]=='S') ans[j+1]='W';
					if(ans[j-1]=='W') ans[j+1]='S';
				}
			}
		}
		b=false;
		if(ans[N-1]=='S'){
			if(str[N-1]=='o'&&ans[N-2]!=ans[0])b=true;
			if(str[N-1]=='x'&&ans[N-2]==ans[0])b=true;
		}
		if(ans[N-1]=='W'){
			if(str[N-1]=='o'&&ans[N-2]==ans[0])b=true;
			if(str[N-1]=='x'&&ans[N-2]!=ans[0])b=true;
		}
		if(ans[0]=='S'){
			if(str[0]=='o'&&ans[N-1]!=ans[1])b=true;
			if(str[0]=='x'&&ans[N-1]==ans[1])b=true;
		}
		if(ans[0]=='W'){
			if(str[0]=='o'&&ans[N-1]==ans[1])b=true;
			if(str[0]=='x'&&ans[N-1]!=ans[1])b=true;
		}
		if(!b){
			for(int k=0;k<N;++k){
				cout<<ans[k];
			}
			cout<<endl;
			break;
		}
	}
	if(b) cout<<-1<<endl;
}


Measured memory_bytes: 512
#include<iostream>
#include<iomanip>
#include<cmath>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<algorithm>
#include<set>
#include<map>
#include<queue>
#include<stack>
#include<vector>
#include<cctype>
#define SG getchar()
using namespace std;
string s;
signed main()
{
	s+=SG;SG;s+=SG;SG;s+=SG;
	sort(s.begin(),s.end());
	puts(((s=="557")?("YES"):("NO")));
	return 0;
}

Measured memory_bytes: 256
import java.io.*;
import java.util.*;
public class Main
{
	
	private void solve()throws IOException
	{
		fact();
		int h=nextInt();
		int w=nextInt();
		int a=nextInt();
		int b=nextInt();
		long ans=0;
		for(int i=b+1;i<=w;i++)
			ans=(ans+(choose(h-a-1+i-1,h-a-1)*choose(w-i+a-1,a-1))%mod)%mod;
		out.println(ans);
	}
	long choose(int n,int r)
	{
		return (((fact[n]*modinv(fact[r]))%mod)*modinv(fact[n-r]))%mod;
	}
	final int maxn=(int)(2e5);
	long fact[];
	void fact(){
		fact=new long[maxn+1];
		fact[0]=1;
		for(int i=1;i<=maxn;i++)
			fact[i]=(fact[i-1]*i)%mod;
	}
	final long mod=(long)(1e9+7);
	long modinv(long x){
	    return modpow(x,mod-2);
	}
	long modpow(long a,long b){
	    long ret=1;
	    while(b!=0)
	    {
	        if(b%2==1)
	            ret=(ret*a)%mod;
	        a=(a*a)%mod;
	        b=b/2;
	    }
	    return ret;
	} 


	 
	///////////////////////////////////////////////////////////

	public void run()throws IOException
	{
		br=new BufferedReader(new InputStreamReader(System.in));
		st=null;
		out=new PrintWriter(System.out);

		solve();
		
		br.close();
		out.close();
	}
	public static void main(String args[])throws IOException{
		new Main().run();
	}
	BufferedReader br;
	StringTokenizer st;
	PrintWriter out;
	String nextToken()throws IOException{
		while(st==null || !st.hasMoreTokens())
		st=new StringTokenizer(br.readLine());
		return st.nextToken();
	}
	String nextLine()throws IOException{
		return br.readLine();
	}
	int nextInt()throws IOException{
		return Integer.parseInt(nextToken());
	}
	long nextLong()throws IOException{
		return Long.parseLong(nextToken());
	}
	double nextDouble()throws IOException{
		return Double.parseDouble(nextToken());
	}
}

Measured memory_bytes: 24148
(setq c 0)
(dotimes(i(read))
  (setq j(1+ i))
  (setq m 0)
  (loop for k from 1 to j do(if(=(mod j k)0)(incf m)))
  (if(and(=(mod i 2)0)(= m 8))(incf c)))
(princ c)


Measured memory_bytes: 14564