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

#define make_it_fast ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)

#define mp make_pair
#define pb push_back
#define all(x) (x).begin(),(x).end()
#define ll long long
#define ld long double
#define endl "\n"
#define ff first
#define ss second
#define imn INT_MIN
#define imx INT_MAX

void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}

template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}

template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}

void _print() {cerr << "]\n";}

template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}

#ifndef ONLINE_JUDGE
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define debug(x...) 20
#endif

ll power(ll a,ll b,ll m=1e9+7)
{
    a%=m;
    if(b==1)
    return a;
    if(b==0)
    return 1LL;
    ll ret=power(a,b/2);
    ret=(ret*ret)%m;
    if(b&1)
    ret=(ret*a)%m;
    return ret;
}

ll lcm(ll a,ll b)
{
    return (a*b)/(__gcd(a,b));
}

void solve()
{
    ll s,i,j,m=1e9+7;
    cin>>s;
    vector<ll> dp(s+1,1);
    dp[0]=0;
    dp[1]=0;
    dp[2]=0;
    dp[3]=1;
    for(i=4;i<=s;i++)
    {
        for(j=3;j<i-2;j++)
        dp[i]=(dp[i]+dp[i-j])%m;
    }
    cout<<dp[s]<<endl;
}

int main()
{
    make_it_fast;
    int TEST_CASES=1;
    // cin>>TEST_CASES;
    while(TEST_CASES--)
    {
        solve();
    }
    return 0;
}


Measured memory_bytes: 3624
#include <bits/stdc++.h>
// #include <iostream>
// #include <algorithm>
// #include <string>
// #include <vector>
// #include <queue>
// #include <stack>
// #include <set>
// #include <map>

#define rep(i,a,n) for(int i=a; i<n; i++)
#define repr(i,a,n) for(int i=a;i >= n;i--)
#define INF 999999999
#define pb(a) push_back(a)
#define MOD 1000000007

int dy[]={0, 0, 1, -1};
int dx[]={1, -1, 0, 0};
using namespace std;

typedef pair<int, int> pii;
typedef long long int ll;
typedef vector<pii> VP;

ll a_fact[200001];

ll fact(ll x) {
    if(x == 0) return 1;
    if(a_fact[x] != -1) return a_fact[x];
    return a_fact[x] = ((x % MOD) * (fact(x-1) % MOD)) % MOD;
}

ll mod_pow(ll x, ll n, ll mod) {
    if(n == 0) return 1;
    ll res = mod_pow((x * x) % mod, n / 2 , mod);
    if(n & 1) res = (res * x) % mod;
    return res;
}

int main(void) {
    ll h, w, a, b;
    cin >> h >> w >> a >> b;
    h; w; a; b;
    memset(a_fact, -1, sizeof(a_fact));

    ll x = h - a;
    ll ret = 0;

    for(int i = b + 1; i < w + 1; i++){
        ll y = w - i + 1;
        //printf("h = %lld, w = %lld, a = %lld, b = %d, x = %lld, y = %lld\n",h,w,a,i,x,y);
        ll A = fact(x+i-2) * mod_pow((fact(x-1) % MOD) * (fact(i-1) % MOD) % MOD, MOD-2, MOD) % MOD;
        ll C = fact(a+y-2) * mod_pow((fact(a-1) % MOD) * (fact(y-1) % MOD) % MOD, MOD-2, MOD) % MOD;
        //cout << A << " " << C << endl;
        ret = ((ret % MOD) + (A % MOD) * (C % MOD) % MOD) % MOD;
    }

    cout << ret % MOD << endl;
    return 0;
}

Measured memory_bytes: 4224
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
      	int b = sc.nextInt();
      	int c = sc.nextInt();
      	boolean delta = false;
      
      	if(a == b && b == c) delta = true;
      
      	if(delta) System.out.println("Yes");
      	else System.out.println("No");
	}
}


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

using namespace std;
typedef long long ll;
const int N= 1e6+2;
int vis[N];
int nums[N];
int main()
{
    ll n ;
    cin >> n ;

    int arr[n];
    for(int i = 0 ; i < n ;i++)
    {
        cin >> arr[i];
        nums[arr[i]]++;
    }
    int x;
    bool flag=true;
    int ff;
    for(int i =2  ; i < N ; i++ )
    {
        x=0;
        if(!vis[i])
        {
            for(int j=i ; j < N ; j+=i)
            {
                vis[j]++;
                x+=nums[j];
            }
        }
        if(x>1)
        {
            flag=false;
        }
        ff=i;
    }
    for(int i = ff+1 ; i < N ; i++ )
    {
        x=0;
        if(!vis[i])
        {
            x+=nums[i];
        }
        if(x>1)
            flag=false;
    }
    int y= __gcd(arr[0] , arr[1]);
    for(int i = 2 ; i < n ;i++)
    {
        y=__gcd(y , arr[i]);
    }
    if(flag)
    {
        cout << "pairwise coprime";
        return 0;
    }
    if(y==1)
    {
        cout << "setwise coprime";
        return 0;
    }
    cout << "not coprime";
    return 0;
}


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

// --------------------------------------------------------------------------------
#define fastio	ios_base::sync_with_stio(false),cin.tie(NULL),cout.tie(NULL)
#define ll long long 
#define mset(arr,val) memset(arr,val,sizeof(arr))
#define deb(name,value) cout <<"->>  "<<name<< "= " <<value<<" "
#define frepi(a,b,k) for(int i=a;i<=b;i+=k)
#define frepj(a,b,k) for(int j=a;j<=b;j+=k)
// --------------------------------------------------------------------------------

int arr[100][100];
int cost[100];
int n,m,k;
int ans;
void solve()
{
	int mini = INT_MAX;
	for(int i=0;i<(1<<n);++i)
	{
		int skill[m],cost_i=0;
		mset(skill,0);
		for(int j=0;j<n;++j)
		{
			if(i&(1<<j))
			{
				cost_i+=cost[j];
				for(int k=0;k<m;++k)
				{
					skill[k]+=arr[j][k];
				}
			}
		}

		bool ok =true;
		for(int j=0;j<m;++j)
		{
			if(skill[j]<k)
			{
				ok = false;
				break;
			}
		}
		if(ok)
		{
			if(mini>cost_i)
				mini = cost_i;
		}
	}
	if(mini==INT_MAX)
		cout<<"-1\n";
	else
		cout<<mini<<"\n";
}

void solve_main()
{
    cin>>n>>m>>k;
    for(int i=0;i<n;++i)
    {
    	cin>>cost[i];
    	for(int j=0;j<m;++j)
    		cin>>arr[i][j];
    }
    solve();
}

int main()
{
	#ifndef ONLINE_JUDGE
    	freopen("/home/suryakant/input.txt","r",stdin);
        freopen("/home/suryakant/output.txt","w",stdout);
    #endif
    int t=1;
    // cin>>t;
    while(t--)
    {
        solve_main();
    }
    
}

Measured memory_bytes: 3612
#include <iostream>
#include <algorithm>
#include <utility>
#include <vector>
#include <map>
#include <complex>
#include <iomanip>
#include <cmath>
#include <string>
#include <queue>
#include <stack>
#include <cstring>

#define ll long long
#define ld long double
#define HS ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define INF 0x3f3f3f3f3f3f3f3f
#define point complex <double> 
#define pi acos(-1)
#define mod 1000000007


using namespace std;


int main() {
	HS;
	int n, m;
	cin >> n >> m;
	ll sum = 0,ans=0;
	map< int, int > cnt,zer;
	cnt[0] = 1;
	for (int i = 0; i < n; i++)
	{
		int x;
		cin >> x;
		sum += x;
		ans += cnt[sum % m];
		cnt[sum % m]++;
	}
	cout << ans << endl;
	


	return 0;
}

Measured memory_bytes: 6576
import java.util.Scanner;

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

        if (n > 999) {
            System.out.println("ABD");
        } else {
            System.out.println("ABC");
        }

        sc.close();
    }
}

Measured memory_bytes: 23892
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayDeque;
import java.util.Deque;
import java.util.HashSet;

public class Main {

	public static void main(String[] args) throws IOException {
		long s = System.currentTimeMillis();
		
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

		String[] inputs = br.readLine().split(" ");
		int n = Integer.parseInt(inputs[0]);

		Deque<Integer>[] A = new Deque[n + 1];		 // A[i] → i選手の対戦順リスト
		HashSet<Integer> players = new HashSet<>(); // 全試合終了してないｐのリスト
		for ( int r = 1; r <= n; r++ ) {
			players.add(r);
			A[r] = new ArrayDeque<Integer>();
			inputs = br.readLine().split(" ");
			for ( int c = 0; c < n - 1; c++ ) {
				A[r].push(Integer.parseInt(inputs[c]));
			}
		}

		int match = n * (n - 1) / 2;
		int days = 0;

		HashSet<Integer> todayDone = new HashSet<>(); // その日の試合が成立して除外された選手をここに入れる
		HashSet<Integer> toRemove = new HashSet<>(); // 全試合終了したｐ
		do {
			long e = System.currentTimeMillis();
			if(e - s >= 1500) {
				System.out.print(n * (n - 1) / 2);
				br.close();
				return;
			}
			
			days++;
			todayDone.clear();
			toRemove.clear();

			// p:player opp:opponent
			for (Integer p : players ) {
              
				if ( todayDone.contains(p) ) continue;
				Integer opp = A[p].peek();
				if ( opp == null ) {
					toRemove.add(p);
					continue;
				}

				if ( todayDone.contains(opp) ) continue;
				Integer opps_opp = A[opp].peek();
				if ( opps_opp == null ) {
					toRemove.add(opp);
					continue;
				}

				// 対戦可能相手の対戦可能相手がｐだったら試合成立
				if ( p.equals(opps_opp) ) { // Integer(オブジェクト)型同士の比較はequalsでやる必要がある
					todayDone.add(A[p].pollFirst());
					todayDone.add(A[opp].pollFirst());
					match--;
				}
			}
			players.removeAll(toRemove);			
			
		} while ( todayDone.size() > 0);

		int result = (match == 0 ? days -1 : -1);
		System.out.println(result);
		br.close();
	}
}


Measured memory_bytes: 82248
#include <stdio.h>
#include <assert.h>
#include <stdlib.h>
#include <string.h>
#include <limits.h>

static void CountingSort(int A[], int B[], int n, int k) {
    int i, j;
    int* C = malloc(sizeof(int) * (k + 1));

    for ( i = 0; i <= k; i++ ) {
        C[i] = 0;
    }

    for ( j = 1; j <= n; j++ ) {
        C[A[j]]++;
    }

    for ( i = 1; i <=  k; i++ ) {
        C[i] = C[i] + C[i - 1];
    }

    for ( j = n ; j > 0; j-- ) {
        B[C[A[j]]] = A[j];
        C[A[j]]--;
    }

    free(C);

    return;
}

int main(void) {
    int i;
    int n;
    int k = 0;
    int *A, *B;

    scanf("%d\n", &n);
    A = malloc(sizeof(int) * (n + 1));
    B = malloc(sizeof(int) * (n + 1));

    for ( i = 1; i <= n; i++ ) {
        int d;
        scanf("%d", &d);
        A[i] = d;
        if ( d > k ) {
            k = d;
        }
        (void)fgetc(stdin);
    }

    CountingSort(A, B, n, k);

    for ( i = 1; i <= n; i++ ) {
        printf("%d", B[i]);
        if ( i < n ) {
            printf(" ");
        }
    }
    printf("\n");

    free(A);
    free(B);

    return 0;
}



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

int max(int x, int y);
int min(int x, int y);
int gcd(int x, int y);	/*最大公約数*/
int lcm(int x, int y);	/*最小公倍数*/


int main()
{
	char alp[26] = { 'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z' };

	int n;
	cin >> n;

	char s[100000];
	cin >> s;

	int count[26];

	for (int i = 0;i < 26;i++)
	{
		count[i] = 0;

		for (int j = 0;j < n;j++)
		{
			if (s[j] == alp[i])
				count[i]++;
		}
	}

	long int ans = 1;

	for (int i = 0;i < 26;i++)
	{
		ans = ans * (count[i] + 1) % 1000000007;
	}

	if (ans == 0)
		ans = 1000000006;
	else
		ans--;

	cout << ans;

	return 0;
}

/*2数の大きい方を返す*/
int max(int x, int y)
{
	int max;

	if (x < y)
		max = y;
	else
		max = x;

	return max;
}

/*2数の小さい方を返す*/
int min(int x, int y)
{
	int min;

	if (x < y)
		min = x;
	else
		min = y;

	return min;
}

/*2数の最大公約数を返す*/
int gcd(int x, int y)
{
	int m;
	int gcd = 1;

	m = min(x, y);

	for (int i = 1;i <= m; i++)
	{
		if (x%i == 0 && y%i == 0)
			gcd = i;
	}

	return gcd;
}

/*2数の最小公倍数を返す*/
int lcm(int x, int y)
{
	int m;

	for (int i = 1;i <= y;i++)
	{
		if ((x*i) % y == 0) {
			m = x * i;
			break;
		}
	}

	return m;
}

Measured memory_bytes: 384
#include<stdio.h>

#define N 100005
#define NIL -1

void print(int);
void rec(int, int);

struct Node {
  int p;
  int l;
  int r;
};

struct Node T[N];
int x,data[N];

int main() {
  int i,j,x,y,z,w,l,r;

  scanf("%d",&x);
  for(i = 0; i < x; i++) {
    T[i].p = T[i].l = T[i].r = NIL;
  }

  for(i = 0; i < x; i++) {
    scanf("%d",&y);
    scanf("%d",&z);
    for(j = 0; j < z; j++) {
      scanf("%d",&w);
      if(j == 0) {
	T[y].l = w;
      }else{
	T[l].r = w;
      }
      l = w;
      T[w].p = y;
    }
  }

  for(i = 0; i < x; i++) {
    if(T[i].p == NIL) {
      r = i;
    }
  }
  rec(r,0);
  for(i = 0; i < x; i++) {
    print(i);
  }

  return 0;
}

void rec(int a, int b) {
  data[a] = b;
  if(T[a].r != NIL) {
    rec(T[a].r,b);
  }
  if(T[a].l != NIL) {
    rec(T[a].l,b + 1);
  }
}

void print(int a) {
  int i,x;
  printf("node %d: ",a);
  printf("parent = %d, ",T[a].p);
  printf("depth = %d, ",data[a]);

  if(T[a].p == NIL) {
    printf("root, "); 
  }else if(T[a].l == NIL) {
    printf("leaf, ");
  }else{
    printf("internal node, ");
  }

  printf("[");
  for(i = 0, x = T[a].l; x != NIL; i++, x = T[x].r) {
    if(i) {
      printf(", ");
    }
    printf("%d",x);
  }
  printf("]\n");
}
  
  
  
  
  
  

  



Measured memory_bytes: 6480
a, b, c = map(int,input().split())

count = 0
if a==b==c and a%2==b%2==c%2==0:
    print(-1)
else:
    while a%2 == 0 and b%2 == 0 and c%2 == 0:
        a, b, c = b//2+c//2, c//2+a//2, a//2+b//2
        count += 1
    print(count)

Measured memory_bytes: 3064
const input = require('fs').readFileSync('/dev/stdin', 'utf8');

const s = Number(input);

const f = (n) => {
  if (n % 2 === 0) {
    return n / 2;
  } else {
    return 3 * n + 1;
  }
};

const a = (n) => {
  return f(n-1);
};

const list = [];

const listIncludes = (arr, n) => {
  return arr.indexOf(n) >=0 ? true : false;
};

for (var i = s; i < 1000000; i = f(i)) {
  if (listIncludes(list, i)) {
    console.log(list.length + 1);
    break;
  } else {
    list.push(i);
  }
};



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

using namespace std;

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

typedef long long ll;

const int Inf = 1e9 + 7;
const double EPS = 1e-9;

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

int lcm(int a, int b) {
    return a * b / gcd(a, b);
}

int bitCount(long bits) {
    bits = (bits & 0x55555555) + (bits >> 1 & 0x55555555);
    bits = (bits & 0x33333333) + (bits >> 2 & 0x33333333);
    bits = (bits & 0x0f0f0f0f) + (bits >> 4 & 0x0f0f0f0f);
    bits = (bits & 0x00ff00ff) + (bits >> 8 & 0x00ff00ff);
    return (bits & 0x0000ffff) + (bits >>16 & 0x0000ffff);
}

vector<ll> prime;

void getPrime(int n) {
  FOR (i, 2, n + 1) {
    bool f = true;
    FOR (j, 2, sqrt(i) + 1) {
      if (i % j == 0) {
        f = false;
        break;
      }
    }
    if (f) prime.push_back(i);
  }
}

ll divide(int x, int y) {
  ll cnt = 0;
  while (x % y == 0) {
    x /= y;
    cnt++;
  }
  return cnt;
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;  cin >> n;
    ll ans = 1;
    getPrime(n);
    map<int, ll> mp;
    FOR (i, 1, n + 1) {
      rep (j, prime.size()) {
        mp[prime[j]] += divide(i, prime[j]);
      }
    }
    for (auto const& entry: mp) {
      ans *= (entry.second + 1) % Inf;
      ans %= Inf;
    }
    cout << ans << '\n';

    return 0;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
#define rep(begin, i, end) for (int i = begin; i < (int)(end); i++)
#define all(v) v.begin(), v.end()
const int MOD = 1000000007;

int main()
{
    string a, b;
    cin >> a >> b;
    string s = a + b;
    int N = stoi(s);
    rep(1, i, 1000)
    {
        if (N == i * i)
        {
            cout << "Yes" << endl;
            break;
        }
        else if (N < i * i)
        {
            cout << "No" << endl;
            break;
        }
    }
}

Measured memory_bytes: 256
K = int(input())
r = [[0]*K for _ in range(K)]
def Euclid(a,b):
    if b == 0:
        return a
    else:
        return Euclid(b,a%b)
ans = 0
for i in range(K):
    for j in range(i,K):
        r[i][j] = Euclid(i+1,j+1)
        for m in range(K):    
            if i == j:
                ans += Euclid(r[i][j],m+1)
            else:
                ans += Euclid(r[i][j],m+1)*2
print(ans)

Measured memory_bytes: 9480
#include<bits/stdc++.h>
using namespace std;
int fun(int n)
{
int count=0;
while(n!=0)
{
n=n/10;
count++;
}
return count;
}
int main()
{
int n;
cin>>n;
int count=0;
for(int i=1;i<=n;i++)
{
if(fun(i)%2!=0)
	count++;
}
cout<<count;
return 0;
}


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

int main(){
  int INF = 10000;
  int N;
  cin >> N;
  vector<vector<int>> T(N, vector<int>(N, INF));
  rep(i, N){
    int Ai;
    cin >> Ai;
    rep(j, Ai){
      int x, y;
      cin >> x >> y;
      T.at(i).at(x-1) = y;
    }
  }
  
  int ans = 0;
  
  for (int bit = 0; bit < (1<<N); bit++) {
        vector<int> A(N);
        int n_honest = 0;
        for (int i = 0; i < N; i++) {
            if (bit & (1<<i)) { // i が bit に入っていた場合, iは正直者
              n_honest++;
              A.at(i) = 1;
            } else { // i が bit に入っていない場合, iは不親切
              A.at(i) = 0;
            }
        }
    
        bool flag = true;
    
        rep(i,N){
          rep(j,N){
            if(A.at(j) == 1){
              if(T.at(j).at(i) != A.at(i) && T.at(j).at(i) != INF){
                flag = false;
                break;
              }
            }
          }
          if(flag == false) break;
        }
        
    if(flag) ans = max(ans, n_honest);
  }
  
  cout << ans << endl;

}

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

int main()
{
	auto& in = cin;

	string S, T;
	in >> S >> T;
	int num = 0;
	for (int i = 0; i < (int)S.length(); ++i)
		if (S[i] != T[i])
			++num;
	cout << num;

	return 0;
}


Measured memory_bytes: 3860
n = gets.to_i
as = gets.split.map(&:to_i)

ls = Array.new(n+2, 0)
rs = Array.new(n+2, 0)

1.upto(n) do |i|
  ls[i] = ls[i-1].gcd(as[i-1])
end
n.downto(1) do |i|
  rs[i] = rs[i+1].gcd(as[i-1])
end

puts (1..n).map {|i| rs[i+1].gcd(ls[i-1])}.max


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

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

    int c[N];
    int t[N];
    for(int i = 0; i < N; i++){
        cin >> c[i] >> t[i];
    }

    int ans = 2000;
    for(int i = 0; i < N; i++){
        if(T >= t[i] && ans > c[i]){
            ans = c[i];
        }
    }

    if(ans == 2000){
        cout << "TLE" << endl;
    }else{
        cout << ans << endl;
    }
}

Measured memory_bytes: 256
N, A, B, C = map(int, input().split())
l = [int(input()) for i in range(N)]
INF = 10**9

def dfs(cur,a,b,c):
    if cur == N:
        return abs(a-A) + abs(b-B) + abs(c-C) - 30 if min(a,b,c) > 0 else INF
    ret0 = dfs(cur +1, a, b, c)
    ret1 = dfs(cur+1, a+l[cur], b, c) + 10
    ret2 = dfs(cur+1, a, b+l[cur], c) + 10
    ret3 = dfs(cur+1, a, b, c+l[cur]) + 10
    return min(ret0, ret1, ret2, ret3)

print(dfs(0,0,0,0))

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

#define Wingardium_Leviosa ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)

#define ll long long int

#define pii pair <int, int>
#define pll pair <ll, ll>

#define vi vector <int>
#define vll vector <ll>
#define vpii vector <pii>
#define vpll vector <pll>

#define mapinrev for(auto i = m.rbegin(); i != m.rend(); i++)

#define pb push_back
#define mp make_pair
#define F first
#define S second
#define line cout << "\n"

const ll mod = 1e9 + 7;

const ll N = 1e6 + 100;
ll pr[N] = {0};

ll SEr()
{   for(ll i = 2; i < N; i++){
        if(pr[i] == 0){
            for(ll j = 2*i; j < N; j += i) pr[j]++;
        }
    } return 0;
}

bool isPrime(ll n)
{
    if(pr[n] == 0) return true;
    else return false;
}

ll power(ll a, ll b){
	a %= mod; ll res = 1;
	while(b > 0)
	{
		if(b % 2) {res *= a; res %= mod;}
		a *= a; a %= mod; b /= 2;
	}
	return res;
}

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

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

/*
 ____________________________________________________________
|                                                            |
|       I solemnly swear that I am up to no good.            |
|____________________________________________________________|

*/


int main(){

    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);

    Wingardium_Leviosa;

    ll T = 1;
    //cin >> T;
    while(T--)
    {
        ll n, d, c = 0;
        cin >> n >> d;
        while(n--)
        {
            ll x, y;
            cin >> x >> y;
            if(x*x + y*y <= d*d)
                c++;
        }
        cout << c;
    }
    return 0;
}

/*
 ____________________________________________________________
|                                                            |
|                   Mischief managed!                        |
|____________________________________________________________|

*/


Measured memory_bytes: 3652
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <atcoder/string>

using namespace std;
using namespace atcoder;

int k;

string s, t;

int main(int argc, const char * argv[]) {
    cin>>k;
    s="ACL";
    for(int i = 0; i < k; ++i){
        t += s;
    }
    cout<<t<<endl;
    return 0;
}


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

using namespace std;


int main() {
    int n;
    cin >> n;
    set<int> s;
    for(int i = 0; i < n; i++) {
        int d;
        cin >> d;
        s.insert(d);
    }
    cout << s.size() << "\n";
    return 0;
}

Measured memory_bytes: 3608
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <string>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <stdio.h>
using namespace std;
#define int long long
int MOD = 1000000007;
int INF = (int)1 << 62;
int getLIS(vector<int> &a)
{
	int N = a.size();
	vector<int> dp(N, INF);
	for (int i = 0; i < N; ++i) {
		*upper_bound(dp.begin(), dp.begin() + N, a[i]) = a[i];
	}
	return lower_bound(dp.begin(), dp.begin() + N, INF) - dp.begin();
}
signed main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int N;
	cin >> N;
	vector<int> A(N);
	int res = 0;
	for (int i = 0; i < N; i++) {
		cin >> A[i];
	}
	reverse(A.begin(), A.end());
	cout << getLIS(A) << endl;
}

Measured memory_bytes: 1792
#include<iostream>
using namespace std;
#include <vector>
#define re(i,n) for(int i = 0; i < n; i++)

int main() {
	int n;
	string s;
	bool b = false;
	int cnt = 0;
	cin >> n >> s;
	re(i, n-2) {
		if (s[i] == 'A' && s[i + 1] == 'B' && s[i + 2] == 'C')cnt++;
	}
	cout << cnt << endl;
	return 0;
}

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

using namespace std;

#define ll long long
#define ull unsigned long long
#define REP(i, n) for(int i=0; i<n; i++)

bool s[50][50];
int main(){
    int H,W;
    cin >> H >> W;
    char inp;
    REP(i, H)REP(k, W){
        cin >> inp;
        if(inp == '#')
            s[i][k] = true; 
        else
            s[i][k] = false; 
    } 

    if(H == 1 && W == 1 && inp == '.')
        goto fail;

    REP(row, H){
        REP(col, W){
            if(s[row][col] == false) continue;
            else{
                if(row - 1 >= 0 && s[row-1][col]) continue; 
                else if(row + 1 < H && s[row+1][col]) continue; 
                else if(col - 1 >= 0 && s[row][col-1]) continue; 
                else if(col + 1 < W && s[row][col+1]) continue; 
                else goto fail;
            }
        }
    }
suscess:
    cout << "Yes" << endl;
    return 0;

fail:
    cout << "No" << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define ll long long
#define P pair<int,int>
#define fi first
#define se second
#define rep(i,n) for(int i=0;i<n;i++)
#define INF 1000000000000000000
#define MOD 1000000007
#define all(v) v.begin(),v.end()
#define pb push_back
int dx[]={0,1,0,-1},dy[]={1,0,-1,0};
int kaijo[2000010];
struct edge{int to,cost;};
int gcd(int a,int b){
    if(b==0)return a;
    return gcd(b,a%b);
}
int lcm(int a,int b){
    return a/gcd(a,b)*b;
}
bool prime(int a){
    if(a==1)return false;
    for(int i=2;i*i<=a;i++){
        if(a%i==0)return false;
    }
    return true;
}
void init_fact(){
    kaijo[0]=1;
    for(int i=1;i<=2000000;i++){
        kaijo[i]=kaijo[i-1]*i;
        kaijo[i]%=MOD;
    }
}
int modpow(int a,int b){
    if(b==0)return 1;
    if(b%2)return modpow(a,b-1)*a%MOD;
    int memo=modpow(a,b/2);
    return memo*memo%MOD;
}
int comb(int a,int b){
    if(!kaijo[0])init_fact();
    return kaijo[a]*modpow(kaijo[a-b],MOD-2)%MOD*modpow(kaijo[b],MOD-2)%MOD;
}
int inv(int x){
    x=modpow(x,MOD-2);
    return x;
}
bool kosa(double ax,double ay,double bx,double by,double cx,double cy,double dx,double dy){
    double ta=(cx-dx)*(ay-cy)+(cy-dy)*(cx-ax);
    double tb=(cx-dx)*(by-cy)+(cy-dy)*(cx-bx);
    double tc=(ax-bx)*(cy-ay)+(ay-by)*(ax-cx);
    double td=(ax-bx)*(dy-ay)+(ay-by)*(ax-dx);
    return tc*td<0&&ta*tb<0;
}
double dist(double ax,double ay,double bx,double by){
    return sqrt((bx-ax)*(bx-ax)+(ay-by)*(ay-by));
}
int n;
string s[1010];
signed main(){
    cin>>n;
    int ans=0;
    rep(i,n){
        cin>>s[i];
        ans+=(s[i]=="E869120");
    }
    cout<<ans<<endl;
    return 0;
}



Measured memory_bytes: 3336
#include<stdio.h>
#include<stdlib.h>
typedef struct node{
  int id, deg, dpt;
  struct node *par;
  int *chl;
}T_node;
int cntdpt(T_node *);
int main(){
  int n;
  scanf("%d", &n);
  T_node *T;
  T = (T_node *)malloc(sizeof(T_node) * n);
  int i, id;
  for(i = 0; i < n; i++)
    T[i].par = NULL;
  for(i = 0; i < n; i++){
    scanf("%d", &id);
    T[id].id = id;
    scanf("%d", &(T[id].deg));
    T[id].chl = (int *)malloc(sizeof(int) * T[id].deg);
    int j;
    for(j = 0; j < T[id].deg; j++){
      scanf("%d", &(T[id].chl[j]));
      T[T[id].chl[j]].par = &(T[id]);
    }
  }
  for(i = 0; i < n; i++){
    T[i].dpt = cntdpt(&(T[i]));
    if(!T[i].dpt)
      printf("node %d: parent = %d, depth = %d, root, [", i, -1, T[i].dpt);
    else if(T[i].deg)
      printf("node %d: parent = %d, depth = %d, internal node, [", i, T[i].par->id, T[i].dpt);
    else
      printf("node %d: parent = %d, depth = %d, leaf, [", i, T[i].par->id, T[i].dpt);
    int j;
    for(j = 0; j < T[i].deg; j++){
      if(!j)
	printf("%d", T[i].chl[j]);
      else
	printf(", %d", T[i].chl[j]);
    }
    printf("]\n");
    free(T[i].chl);
  }
  free(T);
  return 0;
}

int cntdpt(T_node *t){
  if(t->par != NULL)
    return cntdpt(t->par) + 1;
  else
    return 0;
}
  

Measured memory_bytes: 7148
N,A,B=map(int,input().split())
s=input()
kaigai=1
jyun=1
for i in range(N):
  if s[i]=="c":
    print("No")
  elif s[i]=="a":
    if jyun<=A+B:
      print("Yes")
      jyun+=1
    else:
      print("No")
  else:
    if jyun<=A+B and kaigai<=B:
      print("Yes")
      kaigai+=1
      jyun+=1
    else:
      print("No")

Measured memory_bytes: 76008
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <cstring>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <algorithm>
#include <ctime>
using namespace std;
 
#define REP(i,n) for(int i=0; i<n; ++i)
#define FOR(i,a,b) for(int i=a; i<=b; ++i)
#define FORR(i,a,b) for (int i=a; i>=b; --i)
#define ALL(c) (c).begin(), (c).end()
 
typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<VI> VVI;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;

int main() {
	string a, b;
	cin >> a >> b;
	if (a == b){
		cout << "EQUAL" << endl;
		return 0;
	}
	if (a.size() > b.size()){
		cout << "GREATER" << endl;
		return 0;
	}
	if (a.size() < b.size()){
		cout << "LESS" << endl;
		return 0;
	}
	REP(i,a.length()){
		if (a[i] == b[i]) continue;
		if (a[i] > b[i]){
			cout << "GREATER" << endl;
		}else{
			cout << "LESS" << endl;
		}
		return 0;
	}


    return 0;
}

Measured memory_bytes: 256
#include<map>
#include<iostream>
#include<stdio.h>
using namespace std;
typedef long long ll;
int a[200050];
int b[200050];
int main(void)
{
    int k, n, t;
    scanf("%d%d", &n, &k);
    for(int i = 1; i <= n; ++i)
    {
        scanf("%d", &t);
        a[i] = t;
    }
    map<ll, ll> cnt;
    ll tot = 0, s = 1;
    for(int i = 0; i <= n; ++i)
    {
        s += a[i];
        ll x = (s - i) %k;
        b[i] = x;
        if (i - k >= 0)
            cnt[b[i - k]]--;
        tot += cnt[x];
        cnt[x] += 1;
    }
    cout<<tot<<endl;
    return 0;
}


Measured memory_bytes: 14336
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

int main(void)
{
    char S[11];
    char T[12];
    int c;
    int len;
    scanf("%s", S);
    scanf("%s", T);
    len = strlen(S);
    T[len] = '\0';
    if (strcmp(S, T) == 0)
    {
        printf("Yes");
        return 0;
    }
    printf("No");
    return 0;
}

Measured memory_bytes: 1680
long B[3<<17],a,r,I;
n,h[2<<17],i,j;
sum(i){for(r=0;i;i-=i&-i)r=fmax(r,B[i]);}
main(n)
{
	for(scanf("%d",&n);i<n;)scanf("%d",h+i++);
	for(;~scanf("%d",&a);)
	{
		for(sum(I=h[j++]);I<3<<17;I+=I&-I)B[I]=fmax(B[I],a+r);
	}
	sum(n);
	printf("%ld",r);
}

Measured memory_bytes: 3840
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef vector<int> VI;

template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=int(a);i<int(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define all(x) (x).begin(),(x).end()

const int mod = 1e9+7;




int main() {
    int l, r, d;
    cin >> l >> r >> d;
    int ans = 0;
    rep (i, l, r+1) {
        if (i % d == 0) {
            ans++;
        }
    }
    cout << ans << endl;
}




Measured memory_bytes: 3620
#include<stdio.h>
#include<string.h>

int main(){
        int i, j, h, w, k, ans=0, black;
        scanf("%d%d%d", &h, &w, &k);
        char s[6][7];
        for(i=0; i<h; i++){
                scanf("%s", s[i]);
        }
        int r, c;//row=行,column=列
        for(r=0; r<(1<<h); r++){
               for(c=0; c<(1<<w); c++){
                       black=0;
                       for(i=0; i<h; i++){
                               for(j=0; j<w; j++){
                                       if(((r>>i)&1)==0 && ((c>>j)&1)==0 && s[i][j]=='#'){
                                               black++;
                                       }
                               }
                       }
                       if(black==k){
                               ans++;
                       }
               }
        }
        printf("%d", ans);
        return 0;
}


Measured memory_bytes: 1700
import java.util.*;


public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        while(true){
            int n = sc.nextInt();
            int x = sc.nextInt();
            if(n == 0 && x == 0){
                break;
            }else{
                int count = 0;
                for(int i = 1; i <= n - 2; i++){
                    for(int j = i + 1; j <= n - 1; j++){
                        for(int k = j + 1; k <= n; k++){
                            if(i + j + k == x){
                                count++;
                            }
                        }
                    }
                }
            System.out.println(count);
                
            }
            
        }
    }
}



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

const int N = 1e5 + 10;

int n;
char s[N];
char ss[4][8]={"maerd00", "remaerd", "esare00", "resare0"};
int len[4]={5,7,5,6};

bool ok(){
	bool flag;
	int m;
    for(int i=0;i<n;i++){
        flag = 0;
		for(int j=0; j<4; j++){
			m = len[j];
			flag = 1;
			for(int k=0; k<m; k++){
				if(s[i+k] != ss[j][k]){
					flag = 0;
					break;
				}
			}
			if(flag){
				i = i + m - 1;
				break;
			}
		}
		if(!flag){
			return 0;
		}
    }
    return 1;
}

int main(){
	while(~scanf("%s", s)){
        n = strlen(s);
        reverse(s, s+n);
        puts(ok()?"YES":"NO");
	}
	return 0;
}


Measured memory_bytes: 384
#include<cstdio>
#include<algorithm>
int N,a[100010],b[100010],nums[100010],cnt,fa[100010],deg[100010];
bool fe[100010];
int find(int i){return fa[i]==i?i:fa[i]=find(fa[i]);}
int main(){
	scanf("%d",&N);
	for(int i=1;i<=N;i++)scanf("%d",a+i),a[0]^=a[i];
	for(int i=1;i<=N;i++)scanf("%d",b+i),b[0]^=b[i];
	for(int i=0;i<=N;i++)nums[cnt++]=a[i];
	std::sort(nums,nums+cnt);
	cnt=std::unique(nums,nums+cnt)-nums;
	for(int i=0;i<cnt;i++)fa[i]=i;
	for(int i=0;i<=N;i++){
		a[i]=std::lower_bound(nums,nums+cnt,a[i])-nums;
		int*t=std::lower_bound(nums,nums+cnt,b[i]);
		if(t<nums+cnt&&*t==b[i])b[i]=t-nums;
		else return puts("-1"),0;
		if(find(a[i])!=find(b[i]))
			fe[fa[find(a[i])]=find(b[i])]=1;
		else if(!i)fe[find(a[i])]=1;
		deg[a[i]]++;deg[b[i]]--;
	}
	for(int i=0;i<cnt;i++)
		if(deg[i])return puts("-1"),0;
	int ans=-1;
	for(int i=1;i<=N;i++)if(a[i]!=b[i])ans++;
	for(int i=0;i<cnt;i++)if(fa[i]==i&&fe[i])ans++;
	printf("%d\n",ans);
}

Measured memory_bytes: 3712
#include <bits/stdc++.h>
#define sz(arr) (int)arr.size()
#define all(arr) arr.begin(), arr.end()

using namespace std;

void _cin() {}
template <class Head, class... Tail>
void _cin(Head&& head, Tail&&... tail) {
  cin >> head;
  _cin(forward<Tail>(tail)...);
}

#define Cin(T, ...) \
  T __VA_ARGS__;    \
  _cin(__VA_ARGS__)

int main() {
  Cin(int, n, h, w);

  cout << (n - h + 1) * (n - w + 1) << endl;

  return 0;
}

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

#define ll long long int
#define pii pair<int,int>
#define PII pair<ll,ll>

int main()
{
    ll n,m,i,j,k,p,q,x,y,a,b,c,tot;

    cin>>x>>y>>a>>b>>c;

    vector<PII> test;

    for(i=1;i<=a;i++){
        cin>>p;
        test.push_back({p,1});
    }

    for(i=1;i<=b;i++){
        cin>>p;
        test.push_back({p,2});
    }

    for(i=1;i<=c;i++){
        cin>>p;
        test.push_back({p,3});
    }

    sort(test.begin(),test.end(),greater<PII>());

    ll r=0, g=0;
    ll siz=test.size();

    ll sum=0;
    for(i=0;i<siz && i<(x+y);i++){
        sum+=test[i].first;
        if(test[i].second==1) ++r;
        else if(test[i].second==2) ++g;
    }

    if(r<=x && g<=y){
        cout<<sum<<'\n';
        return 0;
    }

    if(r>x){
       p=i;
       --i;
       tot=(x+y);
       while(i>=0 && r>x){
          if(test[i].second==1) sum-=test[i].first, --r,--tot;
          --i;
       }

       i=p;
       while(i<=siz && tot<(x+y)){
           if(test[i].second != 1) sum+=test[i].first,++tot;
           ++i;
       }
    }

    else if(g>y)
    {
       p=i;
       --i;
       tot=(x+y);
       while(i>=0 && g>y){
          if(test[i].second==2) sum-=test[i].first, --g,--tot;
          --i;
       }

       i=p;
       while(i<=siz && tot<(x+y)){
           if(test[i].second != 2) sum+=test[i].first,++tot;
           ++i;
       }
    }

    cout<<sum<<'\n';

}


Measured memory_bytes: 10476
#include <vector>
#include <iostream>
#include <utility>
#include <algorithm>
#include <string>
#include <deque>
#include <queue>
#include <tuple>
#include <queue>
#include <functional>
#include <cmath>
#include <iomanip>
#include <map>
#include <set>
#include <numeric>
#include <unordered_map>
#include <unordered_set>
#include <complex>
#include <iterator>
#include <array>
#include <memory>
#include <stack>
#define vi vector<int>
#define vvi vector<vector<int> >
#define ll long long int
#define vl vector<ll>
#define vvl vector<vector<ll>>
#define vb vector<bool>
#define vc vector<char>
#define vs vector<string>
#define ld long double
#define INF 1e9
#define EPS 0.0000000001
#define rep(i,n) for(int i=0;i<n;i++)
#define loop(i,s,n) for(int i=s;i<n;i++)
#define all(in) in.begin(), in.end()
template<class T, class S> void cmin(T &a, const S &b) { if (a > b)a = b; }
template<class T, class S> void cmax(T &a, const S &b) { if (a < b)a = b; }
#define MAX 1e5 + 100
using namespace std;

typedef pair<int, int> pii;
typedef pair<double,double>pdd;
typedef pair<ll,ll>pll;
#define int ll
vi used(MAX,0);
vi v(MAX,0);
class unionfind {
    vector<int> par, rank, size_;//テゥツ?淌・ツコツヲテ」ツ?ァテ」ツ?ッテ」ツ?ェテ」ツ?湘」ツδ。テ」ツδ「テ」ツδェテ・ツ環ケテァツ篠?」ツつ津ィツ?ε」ツ?暗」ツつ凝」ツ?ェテ」ツつ詠ankテ」ツ?ョテ」ツ?凝」ツつ湘」ツつ甘」ツ?ォsizeテ」ツつ津、ツスツソテ」ツ??
public:
    unionfind(int n) :par(n), rank(n), size_(n, 1) {
        iota(all(par), 0);
    }
    int find(int x) {
        if (par[x] == x)return x;
        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])swap(x, y);
        par[y] = x;
        size_[x] += size_[y];
        if (rank[x] == rank[y])rank[x]++;
    }
    bool same(int x, int y) {
        return find(x) == find(y);
    }
    int size(int x) {
        return size_[find(x)];
    }
};

signed main(){
    int n;cin>>n;
    unionfind uni(MAX);
    for(int i=0; i<n;i++){
        cin>>v[i];
        v[i]=(v[i]+i)%n;
        uni.unite(v[i],i);
    }
    int ans=0;
    vb var(MAX,true);
    rep(_,n){
        int i=_;
        if(var[uni.find(_)]){
            var[uni.find(_)]=false;
            used[i]=1;
            while(true){
                int now=v[i];
                if(used[now]==0)used[now]=used[i]+1;
                else{
                    ans+=used[i]-used[now]+1;
                    break;
                }
                i=now;
            }
        }
    }
    //rep(i,n)cout<<i<<" "<<uni.find(i)<<" "<<used[i]<<endl;
    cout<<ans<<endl;
}

Measured memory_bytes: 6808
import java.util.Scanner;
import java.util.Random;
import java.util.Arrays;
import java.util.Comparator;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.HashMap;
import java.time.*;
import java.time.format.DateTimeFormatter;
import java.time.temporal.ChronoUnit;

public class Main {
	
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		System.out.println(n / 3);
	}
		
}

Measured memory_bytes: 23764
using System;

class Program
{
    static public void Main(string[] args)
    {
        int n = int.Parse(Console.ReadLine());
        int[] a = new int[n];
        string[] input = Console.ReadLine().Split(' ');
        double sum = 0;
        double ave;
        double ans = 0;

        for(int i = 0; i < n; i++)
        {
            a[i] = int.Parse(input[i]);
            sum += a[i];
        }

        ave = sum / n;
        ave = Math.Round(ave,MidpointRounding.AwayFromZero);

        for (int i = 0; i < n; i++)
        {
            ans += (ave - a[i]) * (ave - a[i]);
        }

        Console.WriteLine(ans);

    }
}

Measured memory_bytes: 2648
R, G, B, N = map(int, input().split())

ans = 0
for i in range((N//R)+1):
    temp = N - i*R
    for j in range((temp//G)+1):
        temp2 = N - i*R - j*G
        if temp2 % B == 0:
            ans += 1
            
print(ans)

Measured memory_bytes: 3060
#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 eb emplace_back
#define pb push_back
#define lb(v,k) (lower_bound(all(v),k)-v.begin())
#define chmin(x,y) if(x>y)x=y
#define chmax(x,y) if(x<y)x=y
typedef long long ll;
typedef pair<ll,ll> P;
typedef tuple<ll,ll,ll> PP;
typedef priority_queue<ll> PQ;
typedef priority_queue<ll,vector<ll>,greater<ll>> SPQ;
using vi=vector<ll>;
using vvi=vector<vector<ll>>;
using vc=vector<char>;
using vvc=vector<vector<char>>;
const ll inf=100100100100;
const int Inf=1001001001;
const int mod=1000000007;

int main(){
    ll a,b;cin>>a>>b;
    ll ans=0;
    if(a%2==1){
        ans=a;
        a++;
    }
    if(b%2==0){
        ans^=b;
        b--;
    }
    ans^=((b-a+1)/2)%2;
  cout<<ans<<endl;
}

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

using lint = long long int;
using pint = pair<int, int>;
using plint = pair<lint, lint>;
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) ((lint)(x).size())
#define POW2(n) (1LL << (n))
#define FOR(i, begin, end) for (int i = (begin), i##_end_ = (end); i < i##_end_; i++)
#define IFOR(i, begin, end) for (int i = (end)-1, i##_begin_ = (begin); i >= i##_begin_; i--)
#define REP(i, n) FOR(i, 0, n)
#define IREP(i, n) IFOR(i, 0, n)
#ifdef LOCAL
#define eprintf(...) fprintf(stderr, __VA_ARGS__)
#else
#define eprintf(...) 42
#endif

#define MAX_V 2501
#define MAX_E 5001
#define INF 1000000000

struct edge
{
    int from, to, cost;
};
edge es[MAX_E];
int d[MAX_V];
int pre[MAX_V];
int V, E;

void shortest_path(int s) {
    REP(i, V+1)
    d[i]=INF;
    d[s] = 0;
    int loopcount = 0;
    while(true){
        loopcount += 1;
        bool update = false;
        REP(i,E){
            edge e = es[i];
            if (d[e.from] != INF && d[e.to] > d[e.from] + e.cost){
                d[e.to] = d[e.from] + e.cost;
                pre[e.to] = e.from;
                //if(d[e.to])
                if (loopcount > MAX_V)
                    d[e.to] += -10000000;
                update = true;
            }
        }
        if (!update || loopcount >= MAX_V * 2)
            break;
    }
}


bool loop_path(int t)
{
    int lcount = 0;
    for (; t != -1; t = pre[t])
    {
        lcount += 1;
        if (t == pre[t] || lcount > MAX_V)
        {
            return true;
        }
    }
    return false;
}

int main()
{
    fill(pre, pre + V+1, -1);
    lint n, m,c,P;
    lint ans, tmp;
    cin >> V >> E >> P;
    REP(i, E){
        struct edge add;
        //cin >> add.from >> add.to >> add.cost;
        cin >> add.from >> add.to >> c;
        add.cost =-(c - P);
        es[i]=add;
    }

    shortest_path(1);
    bool loopgoal = loop_path(V);
    if(!loopgoal){
    cout << max(-d[V],0) << "\n";
    }else{
    cout << -1 << "\n";
    }
return 0;
}

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

alias sread = () => readln.chomp();
ulong MOD = 1_000_000_007;
ulong INF = 1_000_000_000_000;
ulong MIDDLE = 100_000;
alias Pair = Tuple!(long, "flag", long, "num");

T lread(T = long)()
{
    return readln.chomp.to!T();
}

T[] aryread(T = long)()
{
    return readln.split.to!(T[])();
}

void scan(TList...)(ref TList Args)
{
    auto line = readln.split();
    foreach (i, T; TList)
    {
        T val = line[i].to!(T);
        Args[i] = val;
    }
}

void main()
{
    long n, m;
    scan(n, m);
    auto box = new long[](n);
    auto red = new long[](n);
    box[] = 1;
    red[0] = 1;
    foreach (i; iota(m))
    {
        long x, y;
        scan(x, y);
        x--, y--;
        if (box[x])
        {
            box[x]--, box[y]++;
            if(red[x])
                red[y] = 1;
            if (!box[x])
                red[x] = 0;
        }
        // box.writeln();
        // red.writeln();
    }
    red.sum.writeln();
}


Measured memory_bytes: 4348
#include <iostream>
#include <queue>
#include <vector>
#include <string>
#include <map>
#include <set>
#include <algorithm>
#include <cmath>
#include <iomanip>

using namespace std;

#define REP(i,n) for(ll (i) = (0); (i) < (n); ++i)
#define PB push_back
#define MP make_pair
#define FI first
#define SE second
#define ALL(v) v.begin(),v.end()
#define INF 1100000000
#define LLINF 1000000000000000000LL
#define MOD 1000000007
#define Decimal fixed << setpresicion(20)


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


int main()
{
  ll N, K;
  cin >> N >> K;
  ll ans = 0;
  for (ll b = K + 1; b <= N; b++) {
    ll n = N / b;
    ans += n * max(b - K, 0LL);
    if (K > 0) ans += max(N%b - K + 1, 0LL);
    else ans += max(N % b, 0LL);
  }
  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#ifdef _DEBUG
#define _GLIBCXX_DEBUG
#include "dump.hpp"
#else
#define dump(...)
#endif

//#define int long long
// typedef __int128_t Int;
#define DBG 1
#define rep(i, a, b) for (int i = (a); i < (b); i++)
#define rrep(i, a, b) for (int i = (b)-1; i >= (a); i--)
#define loop(n) rep(loop, (0), (n))
#define all(c) begin(c), end(c)
const int INF =
    sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = (int)(1e9) + 7;
const double PI = acos(-1);
const double EPS = 1e-9;
template <class T> bool chmax(T &a, const T &b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}
template <class T> bool chmin(T &a, const T &b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}

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

  int A, B;
  cin >> A >> B;
  cout << ((A <= 8) and (B <= 8) ? "Yay!" : ":(")<<endl;

  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = s; i < (int)(n); i++)
#define chmax(a, b) a = max(a, b)
#define chmin(a, b) a = min(a, b)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()

using namespace std;
using ll = long long;
using pii = pair<int, int>;

//const ll INF = 1e18L + 5;
//const int INF = 1e9 + 5;
//const double pi = 3.14159265358979323846;

void	solve()
{
	vector<int> a(5);
	rep(i, 5) cin >> a[i];
	int k;
	cin >> k;

	bool ok = true;
	rep(i, 5) {
		rep2(j, i + 1, 5) {
			if (a[j] - a[i] > k)
				ok = false;
		}
	}
	if (ok) cout << "Yay!" << endl;
	else cout << ":(" << endl;
}

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

	solve();
}


Measured memory_bytes: 256
package main

import (
	"fmt"
)

func Reverse(s string) string {
	runes := []rune(s)
	for i, j := 0, len(runes)-1; i < j; i, j = i+1, j-1 {
		runes[i], runes[j] = runes[j], runes[i]
	}
	return string(runes)
}

func reverseInts(s []int) []int {
	for i, j := 0, len(s)-1; i < j; i, j = i+1, j-1 {
		s[i], s[j] = s[j], s[i]
	}
	return s

}

func main() {
	var S string
	fmt.Scan(&S)
	var N []int = make([]int, len(S))

	for i := 0; i < 2; i++ {
		cnt := 0
		for j, s := range S {
			if string([]rune{s}) == "R" {
				cnt++
			} else {
				N[j] += cnt / 2
				N[j-1] += (cnt + 1) / 2
				cnt = 0
			}
		}
		N = reverseInts(N)
		S = Reverse(S)
		buf := make([]byte, 0)
		for _, s := range S {
			if string([]rune{s}) == "L" {
				buf = append(buf, "R"...)
			} else {
				buf = append(buf, "L"...)
			}
		}
		S = string(buf)
	}

	for _, i := range N {
		fmt.Print(i, " ")
	}
}


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

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

    int n;
    cin >> n;
    string s, t;
    cin >> s >> t;

    for(int i = 0; i < n; i++) {
        cout << s[i] << t[i];
    }

    return 0;
}


Measured memory_bytes: 3644
import java.util.*;

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

        int N = sc.nextInt();
        int K = sc.nextInt();
        sc.close();

        long sum = 0;
        if(K != 0){
        for(int b = K+1; b <= N; b++){
            int n = K;
            while(n <= N){
                if(N-n+1 >= b-K){
                    sum += (b-K);
                } else {
                    sum += N-n+1;
                }
                n += b;
            }
        }
    } else {
        sum = (long)Math.pow(N, 2);
    }
        System.out.println(sum);
    }
}

Measured memory_bytes: 21844