akhauriyash/Code-Regression huggingface dataset:
#include <stdio.h>

typedef struct {
	char* name;
	int r;
	int g;
	int b;
} color_t;

int main(void) {
	color_t colors[8]={
		{"black"  ,0x00,0x00,0x00},
		{"blue"   ,0x00,0x00,0xff},
		{"lime"   ,0x00,0xff,0x00},
		{"aqua"   ,0x00,0xff,0xff},
		{"red"    ,0xff,0x00,0x00},
		{"fuchsia",0xff,0x00,0xff},
		{"yellow" ,0xff,0xff,0x00},
		{"white"  ,0xff,0xff,0xff}
	};
	int r,g,b;
	int colornum;
	int i;
	int distance;
	int nearestdist;
	int nearestnum;
	char input[100];
	while(1) {
		scanf("%s",input);
		if(input[0]=='0')break;
		sscanf(input,"#%X",&colornum);
		r=(colornum>>16)&0xff;
		g=(colornum>>8 )&0xff;
		b=(colornum    )&0xff;
		nearestdist=0x7fffffff;
		nearestnum=-1;
		for(i=0;i<8;i++) {
			distance=
				(colors[i].r-r)*(colors[i].r-r)+
				(colors[i].g-g)*(colors[i].g-g)+
				(colors[i].b-b)*(colors[i].b-b);
			if(distance<nearestdist) {
				nearestnum=i;
				nearestdist=distance;
			}
		}
		puts(colors[nearestnum].name);
	}
	return 0;
}

Measured memory_bytes: 0
#include<iostream>
#include<iomanip>
#include<climits>
#include<vector>
#include<list>
#include<functional>
#include<algorithm>
#include<string>
#include<cmath>
#include<complex>
#include<set>
#include<map>
#include<stack>
#include<queue>
#include<deque>
#include<tuple>
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n) for(int i=0;i<(n);i++)
using namespace std;
typedef long long ll;
typedef pair<int, int> P;


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

	int A, B;
	cin >> A >> B;
	if (A <= 5)B = 0;
	else if (A <= 12) B /= 2;
	cout << B << endl;

	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;
#define MOD 1000000007ULL;
#define rep(i,n) for(int i=0;i<n;i++)

int main() {
	ll N,Q;
  	cin>>N>>Q;
  	ll count[N+1]={0};
  	string S;
  	cin>>S;
  	
  	rep(i,N){
     	count[i+1]=count[i]+(S[i]=='A' && S[i+1]=='C'); 
    }
  	
  	rep(i,Q){
     	ll l,r;
      	cin>>l>>r;
      	l--; r--;
      	cout<<count[r]-count[l]<<endl;
    }
  
}

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

int main()
{
    string S;
    cin >> S;
    if(S == "SUN"){
        cout << 7 << endl;
    } else if(S == "MON"){
        cout << 6 << endl;
    } else if(S == "TUE"){
        cout << 5 << endl;
    } else if(S == "WED"){
        cout << 4 << endl;
    } else if(S == "THU"){
        cout << 3 << endl;
    } else if(S == "FRI"){
        cout << 2 << endl;
    } else if(S == "SAT"){
        cout << 1 << endl;
    }
	return 0;
}


Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#define INF 0x3f3f3f3f

#include <iostream>
#include <cstdio>
#include <sstream>
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <queue>
#include <stack>
#include <limits>
#include <map>
#include <string>
#include <cstring>
#include <set>
#include <deque>
#include <bitset>
#include <list>
#include <cctype>
#include <utility>
  
using namespace std;
  
typedef long long ll;
typedef pair <int,int> P;
typedef pair <int,P> PP;
  
static const double EPS = 1e-8;
  
int tx[] = {0,1,0,-1};
int ty[] = {-1,0,1,0};

int main(){
  ll money,rate_d,rate_r,consume_d,consume_r;
  while(~scanf("%lld %lld %lld %lld %lld",
	       &money,&rate_d,&rate_r,&consume_d,&consume_r)){
    ll x1 = consume_d*100/rate_d;
    if(rate_d * x1 % 100 != 0) x1++;
    ll x2 = consume_r*100/rate_r;
    if(rate_r * x2 % 100 != 0) x2++;
    
    printf("%lld\n",money - x1 -x2 >= 0 ? money - x1 -x2 : -1);
  }
}

Measured memory_bytes: 1192
#include <bits/stdc++.h>
using namespace std;
#define rep(i, N) for (int i=0; i < (int)(N); i++)
 
int main() {
  int N;
  cin >> N;
  
  int A[N];
  rep(i, N) {
    cin >> A[i];
  }
  bool cond = true;
  int count = 0;
  
  while (cond) {
    int sum = 0;
    rep(i, N) {
      if ((A[i] % 2) != 0){
        cond = false;
        break;
      }
      A[i] = A[i]/2;
      sum += A[i];
    }
    if (cond) {
    	count++;
    	if (sum == 0){
      	cond = false;
    	}
    }
  }
  cout << count << endl;
}

Measured memory_bytes: 256
import java.util.ArrayDeque;
import java.util.Arrays;
import java.util.Deque;
import java.util.Scanner;

public class Main {
	int time = 0;
	void run() {
		Scanner sc = new Scanner(System.in);
		Deque<Integer> Qi = new ArrayDeque<>();
		Deque<String> Qs = new ArrayDeque<>();
		int n = sc.nextInt();
		int q = sc.nextInt();
		for(int i = 0; i < n; i++) {
			Qs.addLast(sc.next());
			Qi.addLast(sc.nextInt());
		}
		while(!Qs.isEmpty()) {
			int a = Qi.poll();
			String s = Qs.poll();
			if(a <= q) {
				time += a;
				System.out.println(s + " " + time);
			}else {
				time += q;
				Qs.addLast(s);
				Qi.addLast(a - q);
			}
		}
		
		sc.close();
	}

	void debug(Object... o) {
		System.out.println(Arrays.deepToString(o));
	}

	public static void main(String[] args) {
		new Main().run();
	}
}


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

using namespace std;
int main() {
  int n;
  cin >> n;
  if (n % 2 == 0)
    cout << 0.5 << endl;
  else {
    cout << (n + 1) / 2 / (double)n << endl;
  }
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n, idx, i, j, k, ans,curr;
    scanf("%d",&n);
    int arr[n];
    int maxi = 0;
    for(i=0;i<n;i++)
    {
        scanf("%d",&arr[i]);
        if(maxi < arr[i])
        {
            maxi = arr[i];
            idx = i;
        }
    }
    ans = 0;
    for(i=0;i<n;i++)
    {
        if(idx == i)
        {
            ans += (arr[i]/2);
        }
        else
        {
            ans += arr[i];
        }
    }
    printf("%d\n",ans);
    return 0;
}


Measured memory_bytes: 256
#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 PRINT(item) cout << (item) << endl;
#define PRINT_VEC(V) \
    for (auto v : (V)) cout << v << ' ';
#define PRINT_ENTER() cout << endl;

bool is_selected(int i, vector<int>& ans) {
    for (const auto& item : ans) {
        if (item == i) return true;
    }
    return false;
}

int main() {
    /* code */
    vector<int> a_1(3), a_2(3), a_3(3);
    REP(i, 3) { cin >> a_1[i]; }
    REP(i, 3) { cin >> a_2[i]; }
    REP(i, 3) { cin >> a_3[i]; }
    int n;
    cin >> n;
    vector<int> b(n);
    REP(i, n) { cin >> b[i]; }
    if (is_selected(a_1[0], b) && is_selected(a_1[1], b) &&
        is_selected(a_1[2], b)) {
        cout << "Yes";
        return 0;
    }
    if (is_selected(a_2[0], b) && is_selected(a_2[1], b) &&
        is_selected(a_2[2], b)) {
        cout << "Yes";
        return 0;
    }
    if (is_selected(a_3[0], b) && is_selected(a_3[1], b) &&
        is_selected(a_3[2], b)) {
        cout << "Yes";
        return 0;
    }
    if (is_selected(a_1[0], b) && is_selected(a_2[0], b) &&
        is_selected(a_3[0], b)) {
        cout << "Yes";
        return 0;
    }
    if (is_selected(a_1[1], b) && is_selected(a_2[1], b) &&
        is_selected(a_3[1], b)) {
        cout << "Yes";
        return 0;
    }
    if (is_selected(a_1[2], b) && is_selected(a_2[2], b) &&
        is_selected(a_3[2], b)) {
        cout << "Yes";
        return 0;
    }
    if (is_selected(a_1[0], b) && is_selected(a_2[1], b) &&
        is_selected(a_3[2], b)) {
        cout << "Yes";
        return 0;
    }
    if (is_selected(a_1[2], b) && is_selected(a_2[1], b) &&
        is_selected(a_3[0], b)) {
        cout << "Yes";
        return 0;
    }
    cout << "No";
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>

using namespace std;
using namespace __gnu_pbds;
 
typedef long long ll;
typedef long double ld;
typedef complex<ld> cd;

typedef pair<int, int> pi;
typedef pair<ll,ll> pl;
typedef pair<ld,ld> pd;

typedef vector<int> vi;
typedef vector<ld> vd;
typedef vector<ll> vl;
typedef vector<pi> vpi;
typedef vector<pl> vpl;
typedef vector<cd> vcd;

template <class T> using Tree = tree<T, null_type, less<T>, rb_tree_tag,tree_order_statistics_node_update>;

#define FOR(i, a, b) for (int i=a; i<(b); i++)
#define F0R(i, a) for (int i=0; i<(a); i++)
#define FORd(i,a,b) for (int i = (b)-1; i >= a; i--)
#define F0Rd(i,a) for (int i = (a)-1; i >= 0; i--)

#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define f first
#define s second
#define lb lower_bound
#define ub upper_bound
#define all(x) x.begin(), x.end()

const int MOD = 1000000007;
const ll INF = 1e18;
const int MX = 100001;

int N,x;

int med(int a, int b, int c) {
    return a+b+c-min(a,min(b,c))-max(a,max(b,c));
}

void brute() {
    F0R(i,100) {
        vi v; FOR(j,1,2*N) v.pb(j);
        random_shuffle(all(v));
        while (sz(v) > 1) {
            for (int i: v) cout << i << " ";
            cout << "\n";
            vi V;
            F0R(i,sz(v)-2) V.pb(med(v[i],v[i+1],v[i+2]));
            v = V;
        }
        cout << v[0] << "\n";
        cout << "----\n";
    }
}

int main() {
    ios_base::sync_with_stdio(0); cin.tie(0);
    cin >> N >> x;
    if (x == 1 || x == 2*N-1) {
        cout << "No";
        exit(0);
    }
    vi ans(2*N-1);
    if (N == 2) {
        ans = {1,2,3};
    } else {
        queue<int> ez;
        if (x+2 <= 2*N-1) {
            ans[N-3] = x+2;
            ans[N-2] = x-1;
            ans[N-1] = x;
            ans[N] = x+1;
            FOR(i,1,2*N) {
                if (x-1 <= i && i <= x+2) continue;
                ez.push(i);
            }
        } else { // N = 3 --> 5
            ans[N-3] = x-2;
            ans[N-2] = x+1;
            ans[N-1] = x;
            ans[N] = x-1;
            FOR(i,1,2*N) {
                if (x-2 <= i && i <= x+1) continue;
                ez.push(i);
            }
        }
        F0R(i,2*N-1) if (!ans[i]) {
            ans[i] = ez.front(); ez.pop();
        }
    }
    cout << "Yes\n";
    for (int i: ans) cout << i << "\n";
}

// read the question correctly (is y a vowel? what are the exact constraints?)
// look out for SPECIAL CASES (n=1?) and overflow (ll vs int?) ARRAY OUT OF BOUNDSS

Measured memory_bytes: 2396
#include<stdio.h>
#include<math.h>
typedef struct Position{
    double x;
    double y;
}position;
void kock(int,position,position);
int main(){
    int n;
    position p1,p2;
    p1.x = 0.0;
    p1.y = 0.0;
    p2.x = 100.0;
    p2.y = 0.0;
    scanf("%d",&n);
    printf("%.8f %.8f\n",p1.x,p1.y);
    kock(n,p1,p2);
    printf("%.8f %.8f\n",p2.x,p2.y);
    return 0;
}
void kock(int n,position p1,position p2){
    position s,t,u;
    if( n==0 ) return ;
    s.x = (p1.x * 2 + p2.x * 1 ) / 3.0;
    s.y = (p1.y * 2 + p2.y * 1 ) / 3.0;
    t.x = (p1.x * 1 + p2.x * 2 ) / 3.0;
    t.y = (p1.y * 1 + p2.y * 2 ) / 3.0;
    u.x = (t.x - s.x ) / 2.0 - ( t.y - s.y ) * sqrt(3) / 2.0 + s.x;
    u.y = (t.x - s.x ) * sqrt(3) / 2.0 + ( t.y - s.y ) / 2.0 + s.y;
 
    kock(n-1,p1,s);
    printf("%.8f %.8f\n",s.x,s.y);
    kock(n-1,s,u);
    printf("%.8f %.8f\n",u.x,u.y);
    kock(n-1,u,t);
    printf("%.8f %.8f\n",t.x,t.y);
    kock(n-1,t,p2);
}


Measured memory_bytes: 2040
#include <stdio.h>

int main (void)
{
	int a, b, c;
	int i, s=0;

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

	for(i=a;i<=b;i++){
		if(c%i==0){
			s=s+1;
		}
	}

	printf("%d\n", s);

	return 0;
}

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

const int MAXN = 1000005;

int n, a[MAXN], lo[MAXN], vis[MAXN];

int main(){
	for(int i = 2; i < MAXN; i++){
		if(lo[i] != 0)continue;
		
		lo[i] = i;
		for(int j = 2 * i; j < MAXN; j += i)
			lo[j] = i;
	}
	
	scanf("%d", &n);
	
	int g = 0;
	bool ok = true;
	
	for(int i = 0; i < n; i++){
		scanf("%d", &a[i]);
		g = __gcd(g, a[i]);
		
		if(!ok)continue;
		
		while(a[i] > 1){
			if(vis[lo[a[i]]] != i + 1 && vis[lo[a[i]]] != 0){
				ok = false;
				break;
			}
			vis[lo[a[i]]] = i + 1;
			a[i] /= lo[a[i]];
		}
	}
	
	if(ok)printf("pairwise coprime\n");
	else if(g == 1)printf("setwise coprime\n");
	else printf("not coprime\n");
	
	return 0;
}


Measured memory_bytes: 11748
#include <iostream>
#include <vector>
using namespace std;
typedef long long ll;
int main(void){
   int h, w;
   cin >> h >> w;
   string board[50];
   
   for(int i = 0; i < h; i++) cin >> board[i];
   
   const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
   const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
  
   for(int i = 0; i < h; i++){
       for(int j = 0; j < w; j++){
           if(board[i][j] == '#') continue;
           
           int num = 0;
           for(int d = 0; d < 8; d++){
               const int ni = i + dy[d];
               const int nj = j + dx[d];
               
              if (ni < 0 or h <= ni) continue;
              if (nj < 0 or w <= nj) continue;
              if (board[ni][nj] == '#') num++;
           }
           
           board[i][j] = char(num + '0');
       }
   }
   
   for (int i = 0; i < h; ++i) cout << board[i] << endl;
   return 0;
}


Measured memory_bytes: 256
package main

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

func main() {

	numbers := ScanedLinetoIntSlice()
	//a, b, c

	a := numbers[0]
	b := numbers[1]
	c := numbers[2]
	var count int

	for ; a <= b; a++ {
		if (c % a) == 0 {
			count++
		}
	}
	fmt.Println(count)
}

func ScanedLinetoIntSlice() []int {

	var sc = bufio.NewScanner(os.Stdin)
	sc.Scan()
	line := sc.Text()

	words := strings.Fields(line)

	var numbers []int

	for _, v := range words {
		number, _ := strconv.Atoi(v)
		numbers = append(numbers, number)
	}

	return numbers
}



Measured memory_bytes: 1128
use proconio::input;

fn main() {
    input! {
        n: usize,
        d: i64,
        mut plan: [(i64, i64); n],  // Vec<(i32, i32, i32)>
    }

    let d2: i64 = d * d;
    let mut count = 0;
    for point in plan {
        if (point.0 * point.0 + point.1 * point.1) <= d2 {
            count += 1;
        }
    }

    println!("{}", count);
}


Measured memory_bytes: 7780
#include"bits/stdc++.h"
using namespace std;

int main(void) {
	int N, M;
	cin >> N >> M;

	vector<string> pict(N);
	for (int i = 0; i < N; i++)
	{
		cin >> pict.at(i);
	}

	for (int i = 0; i < (N + 2); i++)
	{
		if (i == 0 || i == (N + 1))
		{
			for (int i = 0; i < (M + 2); i++)
			{
				cout << '#';
			}
            cout << endl;
		}
		else
		{
			cout << '#' << pict.at(i - 1) << '#' << endl;
		}
	}

	return 0;
}

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

long long dp[100001][3]={0};
int a[100001][3];

long long fun(int n,int t){
    if(dp[n][t-1]!=0)
        return dp[n][t-1];
    if(n==1){
        dp[n][t-1]=a[0][t-1];
    }
    else{
    if(t==1)
        dp[n][t-1]=max(fun(n-1,2)+a[n-1][0],fun(n-1,3)+a[n-1][0]);
    if(t==2)
        dp[n][t-1]=max(fun(n-1,1)+a[n-1][1],fun(n-1,3)+a[n-1][1]);
    if(t==3)
        dp[n][t-1]=max(fun(n-1,1)+a[n-1][2],fun(n-1,2)+a[n-1][2]);
    }
    return dp[n][t-1];
}

int main(){
    int n;
    cin>>n;
    for(int i=0;i<n;i++) 
        cin>>a[i][0]>>a[i][1]>>a[i][2];
    if(n==1)
        cout<< max(a[0][0],max(a[0][1],a[0][2]));
    else{
    long long ans1=max(fun(n-1,2)+a[n-1][0],fun(n-1,3)+a[n-1][0]);
    long long ans2=max(fun(n-1,1)+a[n-1][1],fun(n-1,3)+a[n-1][1]);
    long long ans3=max(fun(n-1,1)+a[n-1][2],fun(n-1,2)+a[n-1][2]);
    long long ans=max(ans1,max(ans2,ans3));
    cout<<ans<<endl;
    }
    /*for(int i=0;i<=n;i++){
        for(int j=0;j<3;j++)
            cout<<dp[i][j]<<" ";
        cout<<"\n";
    }*/
    return 0;

    
}


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

const int INF = 1e9;

int main() {
  ll N, K; cin >> N >> K;
  ll M = K * (K + 1) / 2;
  ll sum = 0;
  deque<int> deq;
  int ans = INF;
  map<int, int> mp;

  for (int i = 0; i < N; ++i) {
    int a; cin >> a;
    if (a > K) a = 0;
    deq.push_back(a);
    if (mp[a] == 0) sum += a;
    ++mp[a];
    while (sum >= M) {
      if (sum == M) ans = min(ans, static_cast<int>(deq.size()));
      int b = deq.front();
      if (mp[b] == 1 && sum - b < M) break;
      deq.pop_front();
      if (mp[b] == 1) sum -= b;
      --mp[b];
    }
  }
  cout << ( (ans == INF) ? 0 : ans ) << endl;
  return 0;
}



Measured memory_bytes: 8256
lst = [x for x in input()]
n = len(lst)
ret_lst = []


def hoge(idx, currnet):

    if idx == n:
        ret_lst.append(currnet)
    else:
        hoge(idx + 1, currnet + lst[idx])
        hoge(idx + 1, currnet + "+" + lst[idx])


hoge(1, lst[0])
ret = 0
for s in ret_lst:
    ret += sum([int(x) for x in s.split("+")])
print(ret)


Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define int long long
#define rep(i, n) for (int i = 0; i < (int)(n); i++)  //  repマクロ
#define leng(n) (int)(log10(n)+1)  //  桁数
using namespace std;

signed main() {
  int N;
  cin >> N;
  vector<double> x(N);
  vector<string> u(N);
  for (int i = 0; i < N; i++) {
    cin >> x[i] >> u[i];
  }
  double ans = 0;
  for (int i = 0; i < N; i++) {
    if (u[i] == "JPY") ans += x[i];
    else ans += 380000 * x[i];
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.Scanner;

public class Main {

  private void solve(Scanner in, PrintWriter out) {
    int N = in.nextInt();
    long[] a = new long[N];
    for (int i = 0; i < N; i++) {
      a[i] = in.nextInt();
    }

    long[] d = new long[N];
    for (int i = 0; i < N; i++) {
      d[i] = a[(i + 1) % N] - a[i];
    }

    long sum = Arrays.stream(a).sum();
    if (sum % ((long) N * ((long) N + 1) / 2) != 0) {
      out.println("NO");
      return;
    }

    long k = sum / ((long) N * ((long) N + 1) / 2);
    //1-N
    long count = 0;
    for (long e : d) {
      e -= k;

      if (e > 0 || (-e) % (long) N != 0) {
        out.println("NO");
        return;
      } else {
        count += (-e) / (long) N;
      }
    }
    if (count != k) {
      out.println("NO");
    } else {
      out.println("YES");
    }
  }

  public static void main(String[] args) {
    Scanner in = new Scanner(System.in);
    PrintWriter out = new PrintWriter(System.out);
    new Main().solve(in, out);
    in.close();
    out.close();
  }
}


Measured memory_bytes: 48232
#include <bits/stdc++.h>
#define rep3(i, s, n, a) for (int i = (s); i < (int)(n); i += a)
#define rep2(i, s, n) rep3(i, s, n, 1)
#define rep(i, n) rep2(i, 0, n)

using namespace std;
using ll = long long;
using ull = unsigned long long;
using P = pair<int, int>;

int main(){
    int n;
    cin >> n;
    vector<vector<int>> x(n), y(n);
    rep(i, n){
        int a;
        cin >> a;
        rep(j, a){
            int xx, yy;
            cin >> xx >> yy;
            x[i].push_back(xx);
            y[i].push_back(yy);
        }
    }
    int total = 1<<n, tmp=0, ans=0;
    bool flag=true;
    rep(i, total){
        rep(j, n){
            if((i>>j)&1){
                tmp++;
                int len = x[j].size();
                rep(k, len){
                    if(((i>>(x[j][k]-1))&1)!=y[j][k]){
                        flag = false;
                        break;
                    }
                }
                if(!flag){
                    break;
                }
            }
        }
        if(flag){
            // cout << i << endl;
            ans = max(ans, tmp);
        }
        flag = true;
        tmp = 0;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3648
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <cstring>
#include <string>
#include <vector>
#include <queue>
#include <cmath>
#include <stack>
#include <set>
#include <map>
typedef long long ll;
using namespace std;

ll XOR(ll a, ll b){
  ll sum = 0LL;
  for(int i=0;i<=40;i++){
    if(a%2 == 1 && b%2 == 0) sum += (1LL << i);
    if(a%2 == 0 && b%2 == 1) sum += (1LL << i);

    a /= 2;
    b /= 2;
  }
  return sum;
}

int main(){
  ll A,B;
  cin >> A >> B;

  if(A%2==0 && B%2==0){
    if((B-A)%4==2){
      cout << XOR(B,1) << endl;
    }
    if((B-A)%4==0){
      cout << B << endl;
    }
  }

  if(A%2==1 && B%2==0){
    if((B-A)%4==1){
      cout << XOR(A,B) << endl;
    }
    if((B-A)%4==3){
      cout << XOR(A,XOR(B,1)) << endl;
    }
  }

  if(A%2==0 && B%2==1){
    if((B-A)%4==1){
      cout << 1 << endl;
    }
    if((B-A)%4==3){
      cout << 0 << endl;
    }
  }

  if(A%2==1 && B%2==1){
    if((B-A)%4==0){
      cout << A << endl;
    }
    if((B-A)%4==2){
      cout << XOR(A,1) << endl;
    }
  }

  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using ll = long long;
using namespace std;
#define rep(i,n) for(int i=0, i##_len=(int)(n); i<i##_len; i++)
#define reps(i,n) for(int i=1 , i##_len=(int)(n);i<=i##_len;i++)
#define rrep(i,n) for(int i=((int)(n)-1);i>=0;i--)
#define rreps(i,n) for(int i=((int)(n));i>0;i--)
#define repi(i,x) for(auto i=(x).begin(),i##_fin=(x).end();i!=i##_fin;i++)
#define all(x) (x).begin(), (x).end()
#define F first
#define S second
#define mp make_pair
#define pb push_back
#define solve(a) ((a)?"Yes":"No")
typedef vector<int> Vi;
typedef vector<Vi> VVi;
typedef pair<int , int> Pi;
typedef vector<Pi> VPi;
typedef vector<long long> V;
typedef vector<V> VV;
typedef pair<long long , long long> P;
typedef vector<P> VP;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1;} return 0;}
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1;} return 0;}
const long long INFLL = 1LL<<60;
const int INF = 1<<30;
const double PI=acos(-1);
int main(){
	int n;
	int t,x,y;
	int nt=0,nx=0,ny=0;
	bool can=true;
	cin >>n;
	rep(i,n){
		cin>>t>>x>>y;
	
	if(t-nt <abs(x-nx)+abs(y-ny) or ((t-nt)-abs(x-nx)-abs(y-ny))%2==1){
		can=false;
	}
	nt=t;
	ny=y;
	nx=x;
	}
	cout<<solve(can)<<endl;
}

Measured memory_bytes: 3644
#include <iostream>
using namespace std;
long long a[10004],n,f[3005][3005];
long long trau(int l,int r,int turn)
{
    if (r<l) return 0;
    if (r==l) return a[l]*turn;
    long long &res=f[l][r];
    if (res!=-1) return res;
    if (turn==1)
    {
        res=0;
        res=max(trau(l,r-1,-1)+a[r],trau(l+1,r,-1)+a[l]);
    } else
    {
        res=1e18;
        res=min(trau(l+1,r,1)-a[l],trau(l,r-1,1)-a[r]);
    }
    return res;
}
int main()
{
    cin>>n;
    for (long long i=1;i<=n;++i)
    {
        cin>>a[i];
    }
    for (int i=1;i<=n;++i)
        for (int j=1;j<=n;++j) f[i][j]=-1;
    cout<<trau(1,n,1);
    return 0;
}

Measured memory_bytes: 74328
#include <bits/stdc++.h>
#define rep(i, a, n) for (int i = (int)(a); i <= (int)(n); ++i)
#define rrep(i, a, n) for (int i = (int)(a); i >= (int)(n); --i)
#define debug(x) cerr << #x << " = " << x << "\n"
#define debugv(x) \
  rep(f, 0, (x.size() - 1)) cerr << x[f] << (f == (x.size() - 1) ? "\n" : " ")
#define all(x) x.begin(), x.end()
#define int long long
using namespace std;
typedef pair<int, int> pii;
typedef vector<int> vi;
const int MX = 1e5 + 5, INF = 5 << 28, MOD = 1e9 + 7;

int N, M, K;
vector<int> A, B;
string S, T;

vector<int> P;
void input() {
  int x, y, z;
  cin >> N;
  P.resize(N);
  rep(i, 0, N - 1) {
    cin >> x;
    x--;
    P[i] = x;
  }
}

int rev[MX] = {};
void solve() {
  rep(i, 0, N - 1) { rev[P[i]] = i; }

  int ans = 0;
  set<int> st;
  rrep(x, N - 1, 0) {
    int i = rev[x];
    int c = 0;
    {
      st.insert(i);
      vector<int> l(2, -1);
      vector<int> r(2, N);
      {
        auto it = st.find(i);
        rep(j, 0, 1) {
          if (it == st.begin()) break;
          it--;
          l[j] = *it;
        }
      }
      {
        auto it = st.find(i);
        rep(j, 0, 1) {
          it++;
          if (it == st.end()) break;
          r[j] = *it;
        }
      }
      vector<int> ls(2);
      ls[0] = i - l[0];
      ls[1] = l[0] - l[1];
      vector<int> rs(2);
      rs[0] = r[0] - i;
      rs[1] = r[1] - r[0];

      c = ls[0] * rs[1] + ls[1] * rs[0];
    }
    ans += c * (x + 1);
  }
  cout << ans << endl;
}
signed main() {
  input();
  solve();
  return 0;
}

Measured memory_bytes: 6528
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define repd(i,a,b) for (int i=(a);i<(b);i++)
#define rep(i,n) repd(i,0,n)
typedef long long ll;
typedef long double lb;
#define int long long
#define double long double
#define endn "\n"
typedef pair<int,int> P;
template<class T> inline bool chmin(T& a, T b){if(a>b){a = b;return 1;}return 0;}
template<class T> inline bool chmax(T& a, T b){if(a<b){a = b;return 1;}return 0;}
const int MOD = 1000000007;
//const int MOD = 998244353;
template<class T> inline int add(T& a, T b, T M = MOD){a=(a+M)%M;b=(b+M)%M;a=(a+b)%M;return a;};
template<class T> inline int mul(T& a, T b, T M = MOD){if(a>=M)a%=M;if(b>=M)b%=M;a*=b;if(a>=M)a%=M;return a;};
const ll INF = 1e16;
const double EPS = 1e-10;
const double PI = 3.141592653589793;
const string abc="abcdefghijklmnopqrstuvwxyz";
const string ABC="ABCDEFGHIJKLMNOPQRSTUVWXYZ";
const pair<int,int> fd[] = {make_pair(1,0),make_pair(-1,0),make_pair(0,1),make_pair(0,-1)}; 

////////////////////////////////////////////////////////////////////
///////////////////////___modpow___////////////////////
ll modpow(ll a,  ll n, const ll &MOD = MOD){
  ll ret = n == 0 ? 1 : modpow(a, n/2, MOD);
  (ret *= ret) %= MOD;
  if(n%2)((ret *= a) %= MOD);
  return ret;
}
///////////////////////___modinv___////////////////////
ll modinv(ll d, const ll &MOD = MOD){
  return modpow(d, MOD-2, MOD);
}
////////////////////////////////////////////////////////////////////

int a,b;
signed main(){
  cin>>a>>b;
  if(a*b % 2 == 0)cout << "No" << endl;
  else cout << "Yes" << endl;
}



Measured memory_bytes: 384
import java.util.*;

public class Main
{
	public static void main(String[] args)
	{
		Scanner sc = new Scanner(System.in);
		int a,b,c,sum=0;
		a = sc.nextInt();
		b = sc.nextInt();
		c = sc.nextInt();
		
		if((a<c && c<b) || (a>c && c>b))
			System.out.print("Yes");
		else
			System.out.print("No");

	}
}

Measured memory_bytes: 21844
/*
  author: ruruvuvu
  GitHub account: colon-ku

  created at: 2020-01-19 20:54:19
*/

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

#define all(x) (x).begin(),(x).end()
#define rep(x, y) for (int x = 0; x < y; x++)
#define MOD 1000000007

typedef long long LL;
typedef long double LD;

bool compare_by_b(pair<int, int> a, pair<int, int> b)
{
    if (a.second != b.second) {
        return a.second < b.second;
    } else {
        return a.first < b.first;
    }
}

ostringstream oss_global;
string s_global = oss_global.str();

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

    int max, min, ans;
    max = -1;
    min = INT_MAX;
    ans = 0;
    for (int i = 0; i < n; i++) {
        int ok = 1;
        if (p[i] > max) {
            if (i > 0) ok = 0;
            max = p[i];
        }
        if (p[i] > min) {
            ok = 0;
        }
        if (p[i] < min) {
            min = p[i];
        }


        if (ok) ans++;
    }

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


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

int main() {
  int a, b;
  cin >> a >> b;

  int i = 0;
  while (1) {
    if ((a - 1) * i + 1 >= b) {
      cout << i << endl;
      return 0;
    }
    i++;
  }
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<cstdio>
#include<string>
#include<algorithm>
#include<map>
#include<set>
#include<cmath>
#include<deque>
#include<queue>
using namespace std;

using ll = long long;
const int INF = 1001001001;
const ll LLINF = 1001001001001001001;
const int MOD = 1000000007;

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

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

  ll big = 1;
  for (int i = 2; i <= sqrt(n); i++) {
    if (n % i == 0) big = i;
  }
  cout << (big-1) + ((n / big) - 1) << endl;
}



Measured memory_bytes: 256
n=int(input())

a=[]
for i in range(n):
    x,y=map(int,input().split())
    a.append([x,y])

b=[]
for i in range(n):
    x,y=map(int,input().split())
    b.append([x,y])


a2=sorted(a, key=lambda x: x[1])
b2=sorted(b, key=lambda x: x[0])

ans=0
for i in range(n):
    for j in range(n):
        if b2[i][0]>a2[n-1-j][0] and b2[i][1]>a2[n-1-j][1]:
            ans+=1
            a2[n-1-j][0]=3*n
            break

print(ans)

Measured memory_bytes: 38896
#include<iostream>
#include<cstdio>
#include<cstring>
#include<string>
#include<vector>
#include<cmath>
#include<algorithm>
#include<map>
#include<queue>
#include<deque>
using namespace std;
typedef long long int LL;
typedef pair<int,int> P;
typedef pair<int,pair<int,int> > PP;
typedef pair<LL,int> LP;
const int INF=1<<30;


void array_show(int *a,int n){
	for(int i=0;i<n;i++)printf("%d%c",a[i],(i!=n-1?' ':'\n'));
}
void array_show(LL *a,int n){
	for(int i=0;i<n;i++)printf("%lld%c",a[i],(i!=n-1?' ':'\n'));
}

LL dp[100005];

int main(){
	int n,w;
	int i,j,k;
	LL a,b,c;
	memset(dp,-1,sizeof(dp));
	dp[0]=0;
	cin>>n>>w;
	for(i=0;i<n;i++){
		cin>>a>>b;
		for(j=w;j>=a;j--){
			if(dp[j-a]==-1)continue;
			dp[j]=max(dp[j],dp[j-a]+b);
		}
	}
	for(i=0,a=0;i<=w;i++){
		a=max(a,dp[i]);
	}
	cout<<a<<endl;
	return 0;
}


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

int main() {
    ll N, Y; cin >> N >> Y;
    for (int i = 0; i <= N; i++)
    {
        for (int j = 0; j <= N-i; j++)
        {
            ll k = N - i - j;
            if(i*10000LL+j*5000LL+k*1000LL==Y){
                cout << i << " " << j << " " << k << endl;
                return 0;
            }
        }
    }

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

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

#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;
typedef long long ll;

int main() {
  string s;
  cin >> s;
  reverse(s.begin(), s.end());
  vector<ll> cnt(2019, 0);
  ll x = 0, ten = 1, tot = 0, ans = 0;
  rep(i, s.size()) {
    cnt[tot]++;
    x = (s[i] - '0') * ten;
    tot += x;
    tot %= 2019;
    ans += cnt[tot];
    ten *= 10;
    ten %= 2019;
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 3772
#include <iostream>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <map>
#include <queue>

static const int MOD = 1000000007;
using ll = long long;
using u32 = unsigned;
using namespace std;

template<class T>
constexpr T INF = ::numeric_limits<T>::max() / 2 - 170;

int main() {
    int a, b, c, d;
    cin >> a >> b >> c >> d;
    vector<int> vx, vy;
    for (int i = 0; i < a; ++i) {
        int k;
        cin >> k;
        vx.emplace_back(k);
    }
    for (int i = 0; i < b; ++i) {
        int k;
        cin >> k;
        vy.emplace_back(k);
    }
    sort(vx.begin(), vx.end());
    sort(vy.begin(), vy.end());
    bool flag = false;
    for (int j = vx[a-1]+1; j <= vy[0]; ++j) {
        if(c < j && j <= d) flag = true;
    }
    cout << (flag ? "No War" : "War") << "\n";
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main() 
{
  int n,k;
  cin>>n>>k;
  
  int height[n];
  int count=0;
  for(int child=0;child<n;child++)
  {
    cin>>height[child];
   	if(height[child]>=k)
    {
      count++;
    }
  }
  cout<<count<<endl;
  
  return 0;
  
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
#define repd(i,a,b) for (int i=(a);i<(b);i++)
#define rep(i,n) repd(i,0,n)
#define int long long
typedef long long ll;
const int MOD = 1000000007;
const int INF = 10100000000000000;
const double EPS = 1e-10;
using namespace std;
const pair<int,int> fd[] = {make_pair(1,0),make_pair(-1,0),make_pair(0,1),make_pair(0,-1)}; 


signed main() {
  string s;cin>>s;
  bool c = true;
  rep(i,s.length()){
    char a = s[i];
    if(i%2 == 0){
      if(a == 'L')c = false;
    }else{
      if(a == 'R')c = false;
    }
  }
  cout << (c ? "Yes" : "No") << endl;
}



Measured memory_bytes: 256
import java.io.*;
import java.util.*;
import java.util.stream.IntStream;
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        PrintWriter out = new PrintWriter(System.out);
        
        final int N = Integer.parseInt(sc.next());
        int[] a = IntStream.range(0, N+1).map(i -> sc.nextInt()).toArray();
        int[] b = IntStream.range(0, N).map(i -> sc.nextInt()).toArray();
        long ans = 0;

        for (int i = 0; i < N; i++) {
            if (a[i] >= b[i]) {
                ans += b[i];
            } else if (a[i] < b[i] && a[i+1] >= b[i] - a[i]) {
                ans += b[i];
                a[i+1] -= (b[i] - a[i]);
            } else if (a[i] < b[i] && a[i+1] < b[i] - a[i]) {
                ans += (a[i] + a[i+1]);
                a[i+1] = 0;
            }
        }
        
        out.println(ans);
        
        out.flush();
    }
}

Measured memory_bytes: 86772
#include <bits/stdc++.h>
#include <chrono>
using namespace std::chrono;
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
#define ff first
#define ss second
#define pb push_back
#define int long long
#define ios std::ios::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL);
#define fill(x, v) memset(x, v, sizeof(x))
const ll mod = 1000000007;
const double pi = 3.14159265359; // PI
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char *name, Arg1 &&arg1)
{
    cerr << name << " : " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char *names, Arg1 &&arg1, Args &&... args)
{
    const char *comma = strchr(names + 1, ',');
    cerr.write(names, comma - names) << " : " << arg1 << " | ";
    __f(comma + 1, args...);
}
/*
std::cout << std::setprecision(9) << f << '\n';//3.141590000;
map<char,int>::reverse_iterator rit;
for(rit = mp.rbegin(); rit!=mp.rend(); rit++)
    auto start = high_resolution_clock::now();
    // Call the function, here
    auto stop = high_resolution_clock::now();
    auto duration = duration_cast<milliseconds>(stop - start);
    cout << "Time taken by function: "<< duration.count() << " milliseconds" << endl;
*/
int power(int x, unsigned int y, int p)
{
    int res = 1;

    x = x % p;

    while (y > 0)
    {
        if (y & 1)
            res = (res * x) % p;

        y = y >> 1;
        x = (x * x) % p;
    }
    return res;
}
// string parser
vector<int> parse(string s)
{
    stringstream ss(s);
    int x;
    vector<int> v;
    while (ss >> x)
    {
        v.pb(x);
    }
    return v;
}
//-----------------------------
const int N = 1e7 + 9;
int mood = 998244353;
int n;

int32_t main()
{
    ios;
    string s;
    cin >> s;
    cout << s[0] << s[1] << s[2] << endl;
}

Measured memory_bytes: 3648
#include <bits/stdc++.h>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
// const bool debug=true;
const bool debug=false;
#define DEBUG if(debug==true)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
const ll MOD = 1000000007;

int main(void) {
    string s;cin>>s;
    ll cnt[26]={};
    ll n = s.size();
    rep(i,n){
        cnt[s[i]-'a']++;
    }
    ll res = n*(n-1)/2;
    rep(i,26){
        res -= cnt[i]*(cnt[i]-1)/2;
    }
    cout << res+1 << endl;
    return 0;
}


Measured memory_bytes: 640
#include<map>
#include<set>
#include<queue>
#include<cmath>
#include<cstdio>
#include<vector>
#include<string>
#include<cstring>
#include<iostream>
#include<algorithm>
#define lc (x<<1)
#define rc (x<<1|1)
#define gc getchar()//(p1==p2&&(p2=(p1=buf)+fread(buf,1,size,stdin),p1==p2)?EOF:*p1++)
#define mk make_pair
#define pi pair<int,int>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
const int N=2e5+10,size=1<<20;

//char buf[size],*p1=buf,*p2=buf;
template<class o> void qr(o &x) {
	char c=gc; x=0; int f=1;
	while(!isdigit(c)){if(c=='-')f=-1; c=gc;}
	while(isdigit(c)) x=x*10+c-'0',c=gc;
	x*=f;
}
template<class o> void qw(o x) {
	if(x/10) qw(x/10);
	putchar(x%10+'0');
}
template<class o> void pr1(o x) {
	if(x<0)x=-x,putchar('-');
	qw(x); putchar(' ');
}
template<class o> void pr2(o x) {
	if(x<0)x=-x,putchar('-');
	qw(x); puts("");
}

int main() {
	int n; qr(n);
	printf("%.7lf\n",2*n*acos(-1.0)); 
	return 0;
}



Measured memory_bytes: 3748
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <ctime>
#include <cmath>
#include <algorithm>
#include <cassert>
#include <map>

#define dig(...) fprintf(stderr, __VA_ARGS__)

using namespace std;

template <class TAT>
inline void read(TAT &a)
{
	static char cc;
	static bool f;
	while ((cc = getchar()) != '-' && (cc < '0' || cc > '9'));
	if (cc == '-') f = 1, a = 0;
	else f = 0, a = cc - '0';
	while ((cc = getchar()) >= '0' && cc <= '9') a = a * 10 + cc - '0';
	if (f) a = -a;
}
template <class TAT>
inline void write(TAT a)
{
	static char cc[27];
	static int ct;
	if (a == 0) {
		putchar('0');
		return;
	}
	if (a < 0) {
		a = -a;
		putchar('-');
	}
	ct = 0;
	while (a) cc[++ct] = a % 10 + '0', a /= 10;
	while (ct) putchar(cc[ct--]);
}
template <class TAT>
inline void Ckmin(TAT &a, const TAT &b)
{
	if (a > b) a = b;
}
template <class TAT>
inline void Ckmax(TAT &a, const TAT &b)
{
	if (a < b) a = b;
}
void begin()
{
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
}
void end()
{
	fclose(stdin);
	fclose(stdout);
}

typedef long long LL;

const int maxn = 1e5+115;

LL H, W;
int n;
map<long long, bool> Hash;
pair<int, int> dot[maxn * 9];
int dt = 0;
LL Ans[15];

void Init()
{
    int x, y;
    read(H), read(W), read(n);
    for (int i = 1; i <= n; ++i) {
        read(x), read(y);
        Hash[x * W + y] = 1;
        for (int a = -2; a <= 0; ++a) {
            for (int b = -2; b <= 0; ++b) {
                if (x + a >= 1 && x + a + 2 <= H && y + b >= 1 && y + b + 2 <= W) {
                    dot[++dt] = make_pair(x + a, y + b);
                }
            }
        }
    }
    sort(dot + 1, dot + 1 + dt);
    dt = unique(dot + 1, dot + 1 + dt) - dot - 1;
}

void Solve()
{
    register int cnt = 0;
    Ans[0] = (LL)(H - 2) * (W - 2) - dt;
    for (int i = 1; i <= dt; ++i) {
        cnt = 0;
        for (int a = 0; a <= 2; ++a) {
            for (int b = 0; b <= 2; ++b) {
                if (Hash.count((dot[i].first + a) * (LL)W + dot[i].second + b)) {
                    ++cnt;
                }
            }
        }
        ++Ans[cnt];
    }
}

void Put()
{
    for (int i = 0; i <= 9; ++i) {
        write(Ans[i]);
        putchar('\n');
    }
}

int main()
{
    Init();
    Solve();
    Put();
	return 0;
}


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

int main() {
  int n, k; cin >> n >> k;
  vector<int> h(n); rep(i, n) cin >> h[i];
  sort(h.rbegin(), h.rend());
  ll ans = 0;
  for (int i = k; i < n; i++)
    ans += h[i];
  cout << ans;
  return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
int main() {
    int w,h,n,x,y,a,cnt=0;
    cin >> w >> h >> n;
    vector<vector<char>> sq(h,vector<char>(w,{1}));
    for(int i=0;i<n;i++){
        cin >> x >> y >> a;
        if(a==1)
            for(int i=0;i<h;i++)
                for(int j=0;j<x;j++)
                    sq.at(i).at(j) = 0;
        else if(a==2)
            for(int i=0;i<h;i++)
                for(int j=x;j<w;j++)
                    sq.at(i).at(j) = 0;
        else if(a==3)
            for(int i=0;i<y;i++)
                for(int j=0;j<w;j++)
                    sq.at(i).at(j) = 0;
        else 
            for(int i=y;i<h;i++)
                for(int j=0;j<w;j++)
                    sq.at(i).at(j) = 0;
    }
    for(int i=h-1;i>=0;i--)
        for(int j=0;j<w;j++)
            if(sq.at(i).at(j)==1)
                cnt++;
    cout << cnt << endl;
}


Measured memory_bytes: 256
using System;

namespace AOJ.intro
{
    namespace ITP_1_3_C
    {
        public static class SwappingTwoNumbers
        {
            public static void Main()
            {
                // テストケース入力部
                for (int i = 0; i < 3000; ++i)
                {
                    string[] test = Console.ReadLine().Split();
                    var inputDataX = int.Parse(test[0]);
                    var inputDataY = int.Parse(test[1]);
                    if (inputDataX == 0 && inputDataY == 0)                  
                    {
                        break;
                    }
                    else if (inputDataX != 0 || inputDataY != 0)
                    {
                        Console.WriteLine("{0} {1}", Math.Min(inputDataX, inputDataY), Math.Max(inputDataX, inputDataY));
                    }
                }
            }
        }

    }
}



Measured memory_bytes: 9408
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace contest
{
    class Program
    {
        static int Main(string[] args)
        {
                string read = Console.ReadLine();
                int dataset_num = int.Parse(read);

                int[] num_array = new int[3];

                for (int i = 0; i < dataset_num; i++)
                {
                    //一行読み込む
                    var input_line = Console.ReadLine();

                    //空白で分割する
                    var line = input_line.Split();
                    int count = 0;
                    foreach (var num in line)
                    {
                        //数字に変換
                        num_array[count++] = int.Parse(num);
                    }
                    
                    //ソート
                    Array.Sort(num_array);

                    if (num_array[2] * num_array[2] == (num_array[0] * num_array[0] + num_array[1] * num_array[1]))
                    {
                        Console.WriteLine("YES");
                    }
                    else
                    {
                        Console.WriteLine("NO");
                    }

                }


                return 0;
        }

    }
}

Measured memory_bytes: 5592
#include <bits/stdc++.h>
using namespace std;
signed main()
{
    int n , a[200000] , ans , temp , isthere[1000001] = {};
    
    cin >> n;
    for(int i=0 ;i<n ;i++){
        cin >> a[i];
        isthere[ a[i] ]++;
    }
    
    ans = n;
    for(int i=0 ;i<n ;i++ ){
        temp = 0;
        for(int j=1 ;j*j<=a[i] ;j++ ){
            if(a[i] % j == 0){
                
                if( (isthere[j] > 0 && a[i] != j) || isthere[j] > 1){
                    temp = 1;
                } else if (a[i] % (a[i]/j) == 0 && ( (isthere[ (a[i]/j) ] > 0 && a[i] != (a[i]/j) ) || isthere[ (a[i]/j)] > 1 )){
                    temp = 1;
                }
            }
        }
        ans -= temp;
    }
    
    cout << ans << endl;
    return (0);
}

Measured memory_bytes: 8328
#include<iostream>
#include<vector>
using namespace std;
#define rep(i,n) for(int i=0;i<(n);++i)
using ll = long long;
using P = pair<int, int>;
#include<algorithm>
#include<math.h>
#include<map>
#include<queue>

int main() {
	int n;
	cin >> n;
	vector<int>a(n);
	ll ans(0);
	rep(i, n) {
		cin >> a[i];
	}
	sort(a.rbegin(), a.rend());
	int t = n - 1;
	rep(i, n) {
		int lim = 2;
		if (i == 0) {
			lim = 1;
		}
		rep(j, lim) {
			if (t > 0) {
				ans += a[i];
				t--;
			}
		}
	}
	cout << ans;
	
	return 0;
}

Measured memory_bytes: 4044
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define pii pair<int,int>
#define pll pair<ll, ll>
#define pil pair<int,ll>
#define pli pair<ll,int>
#define ppi pair<pii,int>
#define pip pair<int,pii>
#define pdd pair<double, double>
#define f first
#define s second
#define MOD 1000000007
#define mkp make_pair
#define M_PI 3.14159265358979323846
#define FOR(i,l,r) for (int i=l;i<=r;i++)
#define LOR(i,l,r) for (ll i=l;i<=r;i++)
#define FORD(i,r,l) for (int i=r;i>=l;i--)
#define LORD(i,r,l) for (ll i=r;i>=l;i--)
#define INF 1000000000
#define CL(x) memset(x,0,sizeof(x))
#define DEB(x) cout << #x << " : " << x << '\n'
#define ALL(x) x.begin(), x.end()
#define SZ(x) x.size()
#define UI(x) (int)(x-'A')
#define LI(x) (int)(x-'a')
typedef long long ll;

#define MXN 10005
int N;
vector<int> G[MXN];
int C[MXN];
int now;
int val[MXN];
ll ans;

void dfs(int u, int p)
{
    for(int v : G[u])
    {
        if(v==p)continue;
        dfs(v,u);
    }
    val[u]=C[now++];
}

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

    cin>>N;
    int a,b;
    FOR(i,1,N-1)
    {
        cin>>a>>b;
        G[a].pb(b);
        G[b].pb(a);
    }
    FOR(i,0,N-1)cin>>C[i];
    sort(C,C+N);
    FOR(i,0,N-2)ans+=C[i];
    dfs(1,-1);
    cout<<ans<<'\n';
    FOR(i,1,N)cout<<val[i]<<' ';
    cout<<'\n';

    return 0;
}


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

int main() {
    int n; cin >> n;
    string s1, s2; cin >> s1 >> s2;
    auto is1 = s1.begin(), is2 = s2.begin();
    for (int i = 0; i < (n * 2); ++i) {
        if (i & 1)cout << *is2++;
        else cout << *is1++;
    }
}

Measured memory_bytes: 256
import sys
import numpy as np
from itertools import *
def S(): return sys.stdin.readline().rstrip()
def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
def LS(): return list(sys.stdin.readline().rstrip().split())

N,M,X= LI()
R = [list(map(int,input().split())) for i in range(N)]
S = [0]

R.sort(key=lambda x: x[0])
i = 1
count = 0
flag = 1
ans = 9999999
while flag:
    temp = list(combinations(R, i))
    # print(temp)
    for q in range(0,len(temp)):
        temp2 = list(np.sum(temp[q], axis=0))
        
        n = sum(temp2[x]>=X for x in range(1,len(temp2)))
        if n == M:
            ans = min(ans,temp2[0])
    i += 1
    if i>N:
        flag = 0
if ans == 9999999:
    ans = -1
print(ans)


Measured memory_bytes: 27736
/*
 * 2369.cc: CatChecker
 */

#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<set>
#include<stack>
#include<list>
#include<queue>
#include<deque>
#include<algorithm>
#include<numeric>
#include<utility>
#include<complex>
#include<functional>
 
using namespace std;

/* constant */

const int MAX_N = 500;

/* typedef */

/* global variables */

/* subroutines */

bool dp[MAX_N][MAX_N + 1];

/* main */

int main() {
  string s;
  cin >> s;
  int n = s.size();

  for (int i = 0; i < n; i++) dp[i][i] = true;

  for (int l = 3; l <= n; l++)
    for (int i = 0, j = l - 1; j < n; i++, j++)
      if (s[i] == 'm' && s[j] == 'w')
	for (int k = i + 1; k < j; k++)
	  if (s[k] == 'e' && dp[i + 1][k] && dp[k + 1][j])
	    dp[i][j + 1] = true;

  cout << (dp[0][n] ? "Cat" : "Rabbit") << endl;
  return 0;
}

Measured memory_bytes: 1424