akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
 
typedef long long ll;
typedef unsigned long long ull;
 
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define RFOR(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define REP(i,n) for(int i=0;i<(n);i++)
#define RREP(i,n) for(int i=(n)-1;i>=0;i--)
#define VSORT(v) sort(v.begin(), v.end())
#define DVSORT(v) sort(v.begin(), v.end(),greater<int>())
#define SORT(v, n) sort(v, v+n)
#define DSORT(v,n) sort(v, v+n,greater<int>())
#define vi vector<int>
#define pb push_back
#define P pair<int,int>
#define Pll pair<ll,ll>

template <class T> void chmin(T&a,const T&b) { a = min(a,b); }
template <class T> void chmax(T&a,const T&b) { a = max(a,b); }
 
void print(){cout<<endl;}
template <class Head, class... Tail>
void print(Head&& h,Tail&&... t){ 
	if(sizeof...(t)==0)
		cout<<h;
	else
		cout<<h<<' ';
	print(move(t)...);
}
 
const double EPS =1e-9;
const int INF =2e+9;
const ll INFL =9e+18;
const long MOD =1e+9+7;
#define PI 3.14159265258979

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

int main(void){
	ll N,A[10000],B[10000],sum=0;

	cin>>N;
	REP(i,N) cin>>A[i];
	REP(i,N) cin>>B[i];
	
	REP(i,N)
		if(A[i]<=B[i]) sum+=((B[i]-A[i])/2);
		else sum-=(A[i]-B[i]);

	if(sum>=0) print("Yes");
	else print("No");
	
	
	return 0;
}




Measured memory_bytes: 384
#include <bits/stdc++.h>
#define rep(i, a, n) for (int i = (a); i < (n); ++i)
#define repr(i, a, n) for (int i = (n); i >= (a); --i)
#define ifaxb(a, x, b) if (a < x && x < b)
#define toInt(x) (x - '0')
#define vi vector<int>
#define vvi vector<vi>
#define vs vector<string>
#define vvs vector<vs>
#define all(x) x.begin(), x.end()
#define INF 2147483647
#define _INF -2147483647
#define pi 3.1415926536
#define MAXN 100004
using namespace std;
typedef long long ll;

int main() {
  int a, b;
  cin >> a >> b;
  int ans = 0;
  // 積雪の差　==　塔の高さの差　より
  // 雪の高さは
  // 東側の塔の高さと雪の埋もれていない部分の高さの差
  // 東側の塔の高さは(1+2+3+..+b-a)
  rep(i, 1, b - a + 1) { ans += i; }
  cout << ans - b << endl;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define ll long long
#define ii pair<int, int>
#define vi vector<int>
#define ld long double
#define vii vector<ii>
#define vll vector<ll>
#define maxn 111

template<typename T>
void trace(T a){ cout << a << '\n';}
template<typename T, typename... Args>
void trace(T a, Args ...args){ cout << a << ' '; trace(args...);}

ii a[maxn];
ii op = {0, 10000000};

int quad(ii a) {
	if (a.fi >= 0) 
		return a.se >= 0 ? 1 : 4;
	return a.se >= 0 ? 2 : 3;
}

int cross(ii a, ii b) {
	return a.fi*b.se - a.se*b.fi;
}

bool cmp (ii a, ii b) {
	if (quad(a) != quad(b))
		return quad(a) < quad(b);
	return cross(a, b) > 0;
}

int32_t main(){
	int n,x,y;
	cin >> n;
	for (int i = 0; i < n; ++i) {
		cin >> x >> y;
		a[i] = {x, y};
	}
	sort(a,a+n, cmp);
	int ans = 0;
	for (int i = 0; i < n; ++i) {
		int j = i, left = n, dx = 0, dy = 0;
		while (left--) {
			dx += a[j].fi;
			dy += a[j].se;
			ans = max(ans, dx*dx + dy*dy);
			j = (j+1) % n;
		}
	}
	cout << fixed << setprecision(40) << sqrt(ans) << '\n';
 	return 0;
}



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

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

  int max_type = 0;
  for (int i = 1; i < n; i++) {
    string s1 = s.substr(0, i);
    string s2 = s.substr(i);
    string s0(i, 0);
    int type = 0;
    for (int j = 0; j < i; j++) {
      for (int k = 0; k < n - i; k++) {
        if (s2[k] == s1[j]) {
          bool flag = 0;
          for (int l = 0; l < type; l++) {
            if (s0[l] == s1[j]) {
              flag = 1;
              break;
            }
          }
          if (flag == 0) {
            s0[type] = s1[j];
            type += 1;
          }
        }
      }
    }
    if (max_type < type) {
      max_type = type;
    }
  }

  cout << max_type << endl;

  return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

typedef struct {
    int top;
    int bottom;
    int right;
    int left;
    int front;
    int back;
} Dice;

void roll(Dice *d, char direction)
{
    int present_top = d->top;
    int present_bottom = d->bottom;
    int present_right = d->right;
    int present_left = d->left;
    int present_front = d->front;
    int present_back = d->back;

    if (direction == 'N') {
        d->top = present_front;
        d->bottom = present_back;
        d->front = present_bottom;
        d->back = present_top;
    } else if (direction == 'S') {
        d->top = present_back;
        d->bottom = present_front;
        d->front = present_top;
        d->back = present_bottom;
    } else if (direction == 'E') {
        d->top = present_left;
        d->bottom = present_right;
        d->right = present_top;
        d->left = present_bottom;
    } else {
        d->top = present_right;
        d->bottom = present_left;
        d->right = present_bottom;
        d->left = present_top;
    }
}

int main(void)
{
    Dice dice;
    int i;

    for (i = 0; i < 6; i++) {
        switch (i) {
            case 0 : scanf("%d", &dice.top); break;
            case 1 : scanf("%d", &dice.front); break;
            case 2 : scanf("%d", &dice.right); break;
            case 3 : scanf("%d", &dice.left); break;
            case 4 : scanf("%d", &dice.back); break;
            case 5 : scanf("%d", &dice.bottom); break;
        }
    }

    char command[100];
    scanf("%s", command);

    i = 0;
    while (command[i]) {
        roll(&dice, command[i]);
        i++;
    }

    printf("%d\n", dice.top);

    return 0;
}

Measured memory_bytes: 596
import java.util.*

fun main(args: Array<String>) {
    val sc = Scanner(System.`in`)
    val n = sc.nextInt()
    val k = sc.nextInt()

    val a = IntArray(n) { sc.nextInt() }
            .groupBy { it }
            .map { it.value.count() }
            .sorted()
    
    val sum = if (a.count() > k) a.take(a.count() - k).sum() else 0

    println(sum)
}

Measured memory_bytes: 75132
// B - Not Found
#include <bits/stdc++.h>
using namespace std;
using vi = vector<int>;
#define rp(i,s,e) for(int i=(s);i<(e);++i)

int main(){
	string S; cin>>S;
	int n = 'z'-'a';
	vi A(n+1);
	rp(i, 0, S.size()) A[S[i]-'a']++;
	int ix = -1;
	rp(i, 0, A.size()){
		if(A[i] <= 0){
			ix = i;
			break;
		}
	}
	if(ix < 0) puts("None");
	else printf("%c\n", ix+'a');
}

Measured memory_bytes: 512
import java.io.IOException;
import java.util.EmptyStackException;
import java.util.Scanner;
public class Main {

	private static Object stack[];
	private static int sp;

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

		String[] item = sc.nextLine().split(" ");
		int x = item.length;

		sp = 0;
		stack = new Object[x]; // スタックの生成

		for(int i=0;i<x;i++) {
			if(item[i].equals("+")) {
				int b = new Integer(pop().toString()).intValue();
				int a = new Integer(pop().toString()).intValue();
				push(a+b);
			}else if(item[i].equals("-")){
				int b = new Integer(pop().toString()).intValue();
				int a = new Integer(pop().toString()).intValue();
				push(a-b);
			}else if(item[i].equals("*")){
				int b = new Integer(pop().toString()).intValue();
				int a = new Integer(pop().toString()).intValue();
				push(a*b);
			}else {
				push(item[i]);
			}
		}

		System.out.println(stack[0]);
		sc.close();
	}

	/*
	 * スタックから取り出す
	 */
	public static Object pop() {
		if(sp<0) {
			throw new EmptyStackException();
		}
		Object value = stack[--sp];
		stack[sp] = null;
		return value;
	}

	/*
	 * スタックに追加する
	 */
	public static void push(Object x) {
		if(sp>=200) {
			throw new IllegalStateException("StackOverFlow");
		}
		stack[sp++] = x;
	}
}


Measured memory_bytes: 26164
import heapq
n, m = (int(i) for i in input().split())
a = [int(i) * (-1) for i in input().split()]
heapq.heapify(a)
for i in range(m):
    tmp_min = ((a[0] * (-1)) //2) * (-1)
    heapq.heappushpop(a,tmp_min)
print(abs(sum(a)))

Measured memory_bytes: 14180
#include<bits/stdc++.h>
using namespace std;
#define MAXN	100005
template <typename T> void read(T &x) {
	x = 0; int f = 1;
	char c = getchar();
	for (; !isdigit(c); c = getchar()) if (c == '-') f = -f;
	for (; isdigit(c); c = getchar()) x = x * 10 + c - '0';
	x *= f;
}
int n, m, a[MAXN];
long long ans, mx, value[MAXN];
int func(int x, int y) {
	if (y > x) return y - x;
	else return y + m - x;
}
void modify(int l, int r, int v) {
	value[l] += v;
	value[r + 1] -= v;
}
void Debug() {
	for (int i = 2; i <= m; i++)
		value[i] += value[i - 1];
}
int main() {
	read(n), read(m);
	for (int i = 1; i <= n; i++) {
		read(a[i]);
		if (i != 1) ans += func(a[i - 1], a[i]);
	}
	for (int i = 2; i <= n; i++) {
		int x = a[i - 1], y = a[i], d = func(x, y);
		if (x < y) {
			modify(x + 2, y, 1);
			modify(y + 1, y + 1, -(d - 1));
		} else {
			modify(x + 2, m, 1);
			if (x != m) {
				modify(1, 1, m - x - 1);
				modify(1, y, 1);
			} else modify(2, y, 1);
			modify(y + 1, y + 1, -(d - 1));
		}
	}
	for (int i = 2; i <= m; i++)
		value[i] += value[i - 1];
	for (int i = 2; i <= m; i++)
		value[i] += value[i - 1];
	for (int i = 1; i <= m; i++)
		mx = max(mx, value[i]);
	cout << ans - mx << endl;
	return 0;
}

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

signed main(void)
{
	long long n, m, sum;
	cin >> n >> m;
	vector<long long> a(n);
	sum = 0;
	rep(i, n) 
	{
		cin >> a.at(i);
		sum += a.at(i);
	}
	sort(a.rbegin(), a.rend());
	bool ok = true;
	rep(i, m)
	{
		if (a[i] * 4 * m < sum)
			ok = false;
	}
	if (ok)
		cout << "Yes" << endl;
	else
		cout << "No" << endl;
	return 0;
}


Measured memory_bytes: 256
import java.io.*;

public class Main{
	public static void main(String[] args) throws IOException{
		int[] data2 = new int[10000];
		BufferedReader input = new BufferedReader(new InputStreamReader(System.in));
		StringBuilder output = new StringBuilder();
		for(int i=0; i < 10001; i++){
			int data = Integer.parseInt(input.readLine());
			if( data == 0){
				break;
			}
			output.append("Case ").append(Integer.toString(i+1)).append(": ").append(Integer.toString(data)).append("\n");
		}
		System.out.print(output);
	}
}

Measured memory_bytes: 31196
N = input()

count = 0

def sitigosan(x):
    global count
    if len(x) > 2:
        if int(N) >= int(x):
            if "7" in x and "5" in x and "3" in x:
                count += 1

    if len(x) != len(N):
        y = "7" + x
        sitigosan(y)
        y = "5" + x
        sitigosan(y)
        y = "3" + x
        sitigosan(y)

sitigosan("")

print(count)


Measured memory_bytes: 3060
#include <bits/stdc++.h>
#define IOS ios::sync_with_stdio(0),cin.tie(0),cout.tie(0) 
#define X first
#define Y second 
#define nl '\n'
#define AC return 0
#define pb(a) push_back(a) 
#define mst(a,b) memset(a, b, sizeof a)
#define rep(i,n) for(int i = 0; (i)<(n); i++)
#define rep1(i,n) for(int i = 1; (i)<=(n); i++)
#define scd(a) scanf("%lld", &a)
#define scdd(a,b) scanf("%lld%lld", &a, &b)
#define scs(s) scanf("%s", s)
//#pragma GCC optimize(2)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair <int, int> pii;
typedef pair <ll, ll> pll;
const ll INF = (ll)0x3f3f3f3f3f3f3f, MAX = 9e18, MIN = -9e18;
const int N = 1e6+10, M = 2e6+10, mod = 1e9+7, inf = 0x3f3f3f;
ll p[N], f[N], cnt, v[N];

void init()
{
	for(int i = 2; i <= 1e6; i++)
		if(!f[i])
		{
			p[cnt++] = i;
			for(int j = i*2; j <= 1e6; j += i)
				f[j] = 1;
		}
}

int main()
{
	IOS;
	init();
	bool ok = 1;
	ll n, g = 0, a;
	cin>>n;
	rep1(i, n)
	{
		cin>>a;
		g = __gcd(g, a);
		if(ok)
		{
			for(int j = 0; j < cnt&&p[j] <= sqrt(a+0.5); j++)
			{
				if(a%p[j] == 0)
				{
					while(a%p[j] == 0)
						a /= p[j];
					if(v[p[j]])
						ok = 0;
					v[p[j]] = 1;
				}
			}
			if(a > 1&&v[a])
				ok = 0;
			v[a] = 1;
		}
	}
	if(ok&&g == 1)
		puts("pairwise coprime");
	else if(g == 1)
		puts("setwise coprime");
	else
		puts("not coprime");
	
	AC;
} 

Measured memory_bytes: 19924
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <map>
#include <fstream>
#include <set>
#include <stack>
#include <queue>
#include <list>
using namespace std;
typedef long long int64;
typedef vector<int> vec;
typedef vector<int64> vec64;
#define db(x) cout << "> " << #x << ": " << x << "\n";
#define ss cout << " ";
#define ct(x) cout << x;
#define nn cout << "\n";
// // // // // // // // // // // // // // // // // // //


int q, n;
int main(){
    int rs = 0;
    int n,m;
    cin >> n >> m;
    int nt = m*4;
    vec arr(10000);
    int sum = 0;
    for (int i = 0; i < n; i++){
        cin >> arr[i];
        sum+=arr[i];
    }
    double toget = 1.0 / (4*m) * (double) sum;
    for (int i = 0; i < n; i++){
        if (arr[i] >=toget)
            rs++;
        
    }
    if (rs >=m)
        cout << "Yes";
    else
        cout << "No";
    return 0;
}


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

int n, m, k;

bool prime(int a) {
    if (a > 2 && a % 2 == 0)
        return false;

    for (int i = 3; i * i <= a; i += 2)
        if (a % i == 0)
            return false;

    return true;
}

int main()
{
    while (cin >> n) {
        m = n - 1;
        k = n + 1;

        while (!prime(m))
            m--;

        while (!prime(k))
            k++;

        cout << m << " " << k << endl;
    }
}



Measured memory_bytes: 3072
#include<iostream>
#include<cmath>
#include<algorithm>
#include<string>
#include<vector>
#include<stack>
#include<queue>
#include<set>
#include<map>
#include<iomanip>
#include<bitset>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
typedef pair<ll,P> P1;
typedef pair<P,P> P2;
#define pu push
#define pb push_back
#define mp make_pair
#define eps 1e-7
#define INF 1000000000
#define fi first
#define sc second
#define rep(i,x) for(ll i=0;i<x;i++)
#define repn(i,x) for(ll i=1;i<=x;i++)
#define SORT(x) sort(x.begin(),x.end())
#define ERASE(x) x.erase(unique(x.begin(),x.end()),x.end())
#define POSL(x,v) (lower_bound(x.begin(),x.end(),v)-x.begin())
#define POSU(x,v) (upper_bound(x.begin(),x.end(),v)-x.begin())

const int MAX = 510000;
const int MOD = 1000000007;

int main(){
  ll N; cin >> N;
  string s; cin >> s;
  if(s.size() <= N) cout << s << endl;
  else{
    rep(i,N) cout << s[i];
    cout << "..." << endl;
  }


}


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

using namespace std;
using lli = int_fast64_t;
using ulli = uint_fast64_t;
#define debug(x) cerr << #x << " : " << x << endl
#define debugv(x) cerr << #x << " : {";for(auto value_of_x:x){ cerr << value_of_x << ", ";}cerr << endl
#define debugst(x) auto xt = x;cerr << #x << " : {";for(int i=0;i<x.size();i++){ cerr << xt.top() << ", ";xt.pop();}cerr << endl
#define debugvp(x) cerr << #x << " : {";for(auto value_of_x:x){ cerr << value_of_x.first << " : " << value_of_x.second << ", ";}cerr << endl

const lli MOD = 1000000007;
const lli LIMIT = 1000000000000000000 * 5;
const int tenfive = 100000;

int main() {
	lli N, K;
	cin >> N >> K;
	vector<lli> v(N);

	for (lli i = 0; i < N; i++) {
		cin >> v[i];
	}
	lli beg = 0;
	map<lli, lli> se;
	lli mm = 0;
	vector<lli> range_pair(N);
	iota(range_pair.begin(), range_pair.end(), 0);
	for (lli i = 0; i < N; i++) {
		if (se.count(v[i])) {
			beg = i + 1;
			swap(range_pair[se[v[i]]],range_pair[i]);
			se[v[i]] = i;
		}
		else {
			se[v[i]] = i;
		}
	}
	//debugv(range_pair);
	vector<lli> dp(N+1);
	dp[0] = N;
	beg = 0;
	lli moddl = 0;
	for (int i = 1; i <= N;) {
		if (range_pair[beg] <= beg) {
			dp[i] = beg;
			i++;
		}
		beg = range_pair[beg] + 1;
		if (beg == N) {
			moddl = i;
			break;
		}
	}
	K %= (moddl);
	//for (int i = 0; i < moddl; i++) {
	//	cout << "dp[" << i << "]:" << dp[i] << endl;;
	//}
	for (lli i = dp[K]; i < N; i++) {
		if (range_pair[i] > i) {
			i = range_pair[i];
			continue;
		}
		cout << v[i];
		if (i == N - 1) {
			cout << endl;
		}
		else {
			cout << " ";
		}
	}
	return 0;
}


Measured memory_bytes: 18688
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <climits>

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

#define EPS (1e-7)
#define INF (1e12)
#define PI (acos(-1))

#define amari(x) ((x) % 1000000007)

#define fillInt(xs, x)        \
  for (int i = 0; i < (x); i++) \
    scanf("%d", &xs[i]);
#define fillLong(xs, x)       \
  for (int i = 0; i < (x); i++) \
    scanf("%ld", &xs[i]);
#define fillString(xs, x)       \
  for (int i = 0; i < (x); i++) \
    cin >> xs[i];
#define sortv(xs) sort(xs.begin(), xs.end());
#define sortvdi(xs) sort(xs.begin(), xs.end(), std::greater<int>());
#define lbv(xs, x) lower_bound(xs.begin(), xs.end(), x) - xs.begin();
#define ubv(xs, x) upper_bound(xs.begin(), xs.end(), x) - xs.begin();

#define rep(i,n) for(int i=0; i<(n); i++)
#define isValidPoint(x, y, mx, my) x >= 0 && x  < mx && y >= 0 && y < my

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

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

  long a, b, c, d, e, k;

  cin >> a >> b >> c>> d>>e>>k;

  if (e - a > k) {
    cout << ":(" << endl;
  } else {
  cout << "Yay!" << endl;

  }



  return 0;
}


Measured memory_bytes: 888
#include <iostream>
#include <vector>
#include <algorithm>
#include <functional>
#include <cmath>
#include <map>

#define reps(i,s,n) for(int (i) = (s); (i) < (n); (i)++)
#define rep(i,n) reps(i,0,n)
using namespace std;
using ll = long long;
using vi = vector<int>;

int main(){
    int n;
    cin >> n;
    vi c(n),s(n),f(n);
    rep(i,n-1){
        cin >> c[i] >> s[i] >> f[i];
    }

    rep(i,n-1){
        int ans = s[i] + c[i];//i+1へ
        reps(j,i+1,n-1){
            //最初の電車が出る前につく
            if(ans < s[j]) ans = s[j]+c[j];//s[j]まで待つ
            else{//最初の電車が出た後につく
                int tmp = ans % f[j];
                if(tmp == 0)
                    ans = ans + c[j];
                else
                    ans = ans + (f[j]-tmp) + c[j];
            }
        }
        cout << ans << endl;
    }
    cout << 0 << endl;
    return 0;
}


Measured memory_bytes: 3604
#include <iostream>
#include <iomanip>
#include <stdio.h>
#include <cstring>
#include <string>
#include <algorithm>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <functional>
#include <math.h>
using namespace std;
typedef long long ll;

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

int main() {
  int N; cin >> N;
  vector<int> T(N), A(N);
  for (int i = 0; i < N; i++) cin >> T[i] >> A[i];
  ll t = T[0], a = A[0], k;
  for (int i = 0; i < N-1; i++) {
    if (t / T[i+1] > a / A[i+1]) {
      if (!(t % T[i+1])) k = t / T[i+1];
      else k = t / T[i+1] + 1;
    } else {
      if (!(a % A[i+1])) k = a / A[i+1];
      else k = a / A[i+1] + 1;
    }
    t = T[i+1] * k;
    a = A[i+1] * k;
  }
  cout << t + a << endl;
}

Measured memory_bytes: 256
#include"bits/stdc++.h"
using namespace std;
#define     uniq(x)         sort(x.begin(),x.end());x.erase(unique(x.begin(),x.end()),x.end())

typedef long long int ll;

int main()
{
    vector<ll> vv;
    ll n,q;
    cin>>n>>q;
    while(q--)
    {
        ll s;cin>>s;
        vv.emplace_back(s);
    }

    uniq(vv);

    ll sum = INT_MAX;

    for(ll i=vv.size()-1;i>0;i--)
    {
        if((n-vv[i])+vv[i-1]<sum) sum = (n-vv[i])+vv[i-1];
    }

    if(abs(vv[vv.size()-1]-vv[0])<sum) sum = abs(vv[vv.size()-1]-vv[0]);

    cout<<sum;
}


Measured memory_bytes: 2548
#include <bits/stdc++.h>
 
#define rep(i,n) for(int i=0;i<(n);i++)
#define reps(i,n) for(int i=1;i<=(n);i++)
#define lol long long
#define SUM(n) ((n)+1)*(n)/2 //1〜nまでの総和を求める式
#define mp make_pair
#define fi first
#define se second
#define pu push_back
#define SYOU(x) fixed<<setprecision(x+1) //小数点桁数を指定する
#define abs(x,y) max(x,y)-min(x,y)
#define all(v) v.begin(),v.end()
#define UPDight(a,b) (a+b-1)/b //小数点切り上げ 
const int INF = 0x3f3f3f3f;
const long long LINF = 0x3f3f3f3f3f3f3f3fLL;
const int MOD=int(1e9)+7; 
using namespace std;
using pii = pair<int, int>;
typedef vector<int> vit;

//最大公約数
lol gcd(lol x, lol y){
  if(x < y) swap(x, y);
  lol r = x % y;
  while(r != 0){
    x = y;
    y = r;
    r = x % y;
  }
  return y;
}

//最小公倍数
lol lcm(lol x, lol y){
  lol a = x * y;
  return (a / gcd(x, y));
}

signed main(void){
  cin.tie(nullptr);
  ios_base::sync_with_stdio(false);

  int n;
  string s;
  cin >> n >> s;
  map<char, int> x, y;
  rep(i, n){
    y[s[i]] ++;
  }
  int ans = 0, sum = 0;
  rep(i, n){
    sum = 0;
    x[s[i]] ++;
    y[s[i]] --;
    for(char j = 'a';j <= 'z';j ++){
      if(x[j] && y[j]){
	sum ++;
      }
    }
    ans = max(ans, sum);
  }
  cout << ans << '\n';
  return 0;
}


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

public class Main {

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



	public void run() {
		Scanner sc = new Scanner(System.in);
		int MAX = 200000;
		int n=sc.nextInt();
		int k=sc.nextInt();
		int p[] = new int[MAX];
		for(int i=0; i<n; i++) {
			p[sc.nextInt()]++;
		}
		int cnt=0;
		for(int i=0; i<MAX; i++) {
			if(p[i]>0) cnt++;
		}
		Arrays.sort(p);

		int ans = 0;
		for(int i=0; i<MAX; i++) {
			if(p[i]==0) continue;
			if(cnt<=k) break;
			ans += p[i];
			cnt--;
		}
		System.out.println(ans);
		sc.close();
	}

}


Measured memory_bytes: 66432
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define set_bits(a) __builtin_popcount(a)
#define pb push_back
#define pf push_front
#define mod 1000000007
#define M 998244353
#define fi first
#define se second
#define endl '\n'
#define INF 1e18
#define PI 3.14159265358979323846
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);


int main()
{
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    
    freopen("output.txt", "w", stdout);
    #endif

    ll n,i,j;
    cin>>n;
    unordered_map<string,ll>mp;
    for(i=0;i<n;i++)
    {
        string s;
        cin>>s;
        mp[s]++;
    }

    cout<<"AC"<<" "<<"x"<<" "<<mp["AC"]<<endl;
    cout<<"WA"<<" "<<"x"<<" "<<mp["WA"]<<endl;
    cout<<"TLE"<<" "<<"x"<<" "<<mp["TLE"]<<endl;
    cout<<"RE"<<" "<<"x"<<" "<<mp["RE"]<<endl;
}

Measured memory_bytes: 3616
x,y=map(int,input().split())

ans=10**12
if x<=y:
  ans=min(ans,y-x)
if -x<=y:
  ans=min(ans,y+x+1)
if x<=-y:
  ans=min(ans,-y-x+1)
if -x<=-y:
  ans=min(ans,-y+x+2)

print(ans)


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

using namespace std;

int f(int a, int b) {
  int a_digit, b_digit;
  string as = to_string(a);
  string bs = to_string(b);
  a_digit = as.length();
  b_digit = bs.length();
  return max(a_digit, b_digit);
}

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

  int mn = 20;
  for(int i = 1; i <= sqrt(n); i++) {
    if(n % i != 0) {
      continue;
    }
    int a = i;
    int b = n / i;
    mn = min(mn, f(a, b));
  }
  cout << mn << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(ll i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define per1(i,n) for(int i=n;i>0;i--)
#define all(v) v.begin(), v.end()
typedef long long ll;
typedef pair<ll,ll> P;
typedef vector<ll> vec;
typedef vector<vec> mat;
int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    int x;
    cin>>x;
    if(x>=30) cout<<"Yes";
    else cout<<"No";
}

Measured memory_bytes: 3636
#include<iostream>
#include<iomanip>
#include<cstdio>
#include<string>
#include<cstring>
#include<climits>
#include<algorithm>
#include<vector>
#include<cmath>
#include<map>
#include<set>
#include<stack>
#include<queue>
#include<deque>
#include<tuple>
#include<list>
#include<unordered_map>
#define ll long long
#define pii pair<int,int>
#define pll pair<ll,ll>
#define vii vector<int>
#define vll vector<ll>
#define lb lower_bound
#define pb push_back
#define mp make_pair
#define rep(i,n) for(ll i=0;i<n;i++)
#define rep2(i,a,b) for(ll i=a;i<b;i++)
#define repr(i,n) for(ll i=n-1;i>=0;i--)
#define all(x) x.begin(),x.end()
#define INF (1 << 30) - 1
#define LLINF (1LL << 61) - 1
// #define int ll
using namespace std;
const int MOD = 1000000007;
const int MAX = 510000;


int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    string s;
    cin>>s;
    ll n=s.size(),k;
    cin>>k;
    rep(i,n-1){
        if((26-(s[i]-'a'))<=k && s[i]!='a'){
            k-=(26-(s[i]-'a'));
            s[i]='a';
        }
    }
    s[n-1]=(char)('a'+(s[n-1]-'a'+k)%26);
    cout<<s<<endl;
    return 0;
}

Measured memory_bytes: 592
/*  -*- coding: utf-8 -*-
 *
 * a.cc: A: ABD
 */

#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 */

/* typedef */

/* global variables */

/* subroutines */

/* main */

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

  if (n < 1000) puts("ABC");
  else puts("ABD");
  return 0;
}


Measured memory_bytes: 256
x, k, d = map(int, input().split())
if x < 0:
    x *= -1
cnt = min(k, x//d+1)
x -= cnt * d
if abs(x) < x+d:
    x += d
    cnt -= 1
    x -= d * ((k-cnt)%2)
else:
    x += d * ((k-cnt)%2)
print(abs(x))

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

using namespace std;

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

void solve() {
  string want = "keyence";
  string s;
  cin >> s;
  bool good = false;
  for(int i = 0; i < s.size(); i++) {
    for(int j = i; j <= s.size(); j++) {
      string curr = "";
      for(int k = 0; k < s.size(); k++) {
        if(k < i || k >= j) {
          curr += s[k];
        }
      }
      good |= curr == want;
    }
  }
  if(good) cout << "YES\n";
  else cout << "NO\n";
}

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL); cout.tie(NULL);
  solve();
}


Measured memory_bytes: 256
N, M = map(int, raw_input().split())
ans = [0 for _ in xrange(M+1)]

for _ in xrange(N):
    A = map(int, raw_input().split())[1:]
    for a in A:
        ans[a] += 1

a = 0

for b in ans:
    if b == N:
        a += 1

print a


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

#define FOR(i, a, b) for (int i = (int)(a); i < (int)(b); ++i)
#define REP(i, n) FOR(i, 0, n)
#define TRACE(x) cerr << #x << " = " << x << endl
#define _ << " _ " <<

#define x first
#define y second
#define pb push_back

using namespace std;

typedef long long ll;

const int MAXN = 100100;

int N, L, A[MAXN];
ll sum[MAXN];

void untie(int idx) {
  REP(i, idx) cout << i+1 << endl;
  for (int i = N-2; i > idx; --i) cout << i+1 << endl;
  cout << idx+1 << endl;
}

int main(void) {
  ios_base::sync_with_stdio(false);

  cin >> N >> L;
  REP(i, N) cin >> A[i];
  REP(i, N-1) {
    if (A[i] + A[i+1] >= L) {
      cout << "Possible" << endl;
      untie(i);
      return 0;
    }
  }

  cout << "Impossible" << endl;

  return 0;
}


Measured memory_bytes: 1280
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using vl = vector<ll>;
template<class T> using vc = vector<T>;
template<class T> using vvc = vector<vector<T>>;

#define eb emplace_back
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define repr(i, n) for (ll i = (n)-1; i >= 0; i--)
#define repe(i, l, r) for (ll i = (l); i < (r); i++)
#define reper(i, l, r) for (ll i = (r)-1; i >= (l); i--)
#define repa(i,n) for (auto& i: n)

template<class T> inline bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> inline bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
void init() {cin.tie(0);ios::sync_with_stdio(false);cout << fixed << setprecision(15);}

#ifdef DEBUG
template <class T, class N> void verr(const T& a, const N& n) { rep(i, n) cerr << a[i] << " "; cerr << "\n" << flush; }
ll dbgt = 1; void err() { cerr << "passed " << dbgt++ << "\n" << flush; }
template<class H, class... T> void err(H&& h,T&&... t){ cerr<< h << (sizeof...(t)?" ":"\n") << flush; if(sizeof...(t)>0) err(forward<T>(t)...); }
#endif

const ll INF = 4e18;
const ld EPS = 1e-11;
const ld PI = acos(-1.0L);
const ll MOD = 1e9 + 7;
// const ll MOD = 998244353;
//--------------------------------------------------------------------------------//
ll modpow(ll a, ll n, ll mod_) {
    ll res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod_;
        a = a * a % mod_;
        n >>= 1;
    }
    return res;
}

const ll MAX_SIZE = 200005;
array<ll, MAX_SIZE> fac, inv, finv;
void finit() {
    // combination init
    fac[0] = 1;
    for (ll i = 1; i < MAX_SIZE; i++) fac[i] = fac[i - 1] * i % MOD;
    finv[MAX_SIZE - 1] = modpow(fac[MAX_SIZE - 1], MOD - 2, MOD);
    for(ll i = MAX_SIZE - 1; i > 0; i--) finv[i - 1] = finv[i] * i % MOD;
    
    //inv init
    repe(i, 1, MAX_SIZE) inv[i] = modpow(i, MOD - 2, MOD);
}

ll perm(ll a, ll b) { return fac[a] * finv[a - b] % MOD; }

ll comb(ll a, ll b) { return fac[a] * finv[b] % MOD * finv[a - b] % MOD; }

int main() {
    init();
    finit();
    ll N, K;
    cin >> N >> K;

    cout << comb(N + K - 1, N) << endl;
}


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

typedef long long ll;

int n;
ll a;

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cin >> n;
    ll res = 1;
    ll m = 1e18;

    bool ok = true;
    bool zero = false;
    for (int i = 0; i < n; ++i) {
        cin >> a;
        if (a) {
            if (m / a < res) {
                ok = false;
            }
        } else {
            zero = true;
        }
        res *= a;
    }
    if (zero || ok)
        cout << res << endl;
    else
        cout << -1 << endl;

    return 0;
}



Measured memory_bytes: 3640
//Author: A_S_M_M@sud_P@rvez
#include<bits/stdc++.h>
using namespace std;
#define    MP ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define    For(i,n) for(int i=0;i<n;i++)
#define    forn(i,n) for(int i=1;i<=n;i++)
#define    fors(i,s) for(int i=0;i<s.size();i++)
#define    Sort(s) sort(s.begin(),s.end())
#define    gcd(a, b) __gcd(a , b)
#define    lcm(a,b) (a*(b/__gcd(a,b)))
#define    test   int t;cin>>t;forn(i,t)
#define    nl     "\n"
#define    End    return 0 
#define    gt     greater<int>()
#define    ll     long long 
#define    mp     make_pair
#define    pb     push_back
#define    vi     vector<int>
#define    vl     vector<ll>
#define    mod    1000000007
#define    sp(n)  fixed<<setprecision(n)
#define    pi     acos(-1)

int main()
{
MP;
    int a,b,c,p=0;
    cin>>a>>b>>c;
    for(int i=a;i<=b;i++){
        if(i%c==0)p++;
    }
    cout<<p;

End;
}


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

long long dfs(long long i,long long n,bool a,bool b,bool c){
	if(i>n) return 0;
	long long count=0;
	if(a&&b&&c) count++;
	count+=dfs(i*10+3,n,true,b,c);
	count+=dfs(i*10+5,n,a,true,c);
	count+=dfs(i*10+7,n,a,b,true);
	return count;
}
 
int main() {
	long long n;
	cin >> n;
	long long ans=dfs(0,n,0,0,0);
	cout << ans << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
int main()
{
    ll n;
    cin>>n;
    ll i;
    ll arr[n-1];
    for(i=0;i<n-1;i++)
    cin>>arr[i];
    ll x;
    ll p[200001]={0};
    for(i=0;i<n-1;i++)
    {
        x=arr[i];
        p[x]++;
    }
    for(i=1;i<=n;i++)
    cout<<p[i]<<endl;
    return 0;
}

Measured memory_bytes: 6712
class Problem
  attr_accessor *(?a..?z).to_a.map(&:to_sym)
  def initialize
    @n = gets.to_s.to_i
    @a = gets.to_s.split.map{ |v| v.to_i }
  end

  def solve
    n4,n2,n1 = rec
    return true if n1 <= n4
    return true if n1 - 1 == n4 && n2 == 0
    false
  end
  
  def rec
    n.times.with_object([0,0,0]) do |i, dp|
      dp[query(i)] += 1
    end
  end

  def query(i)
    return 0 if a[i] % 4 == 0
    return 1 if a[i] % 2 == 0
    return 2
  end

  def show(ans)
    puts ans ? "Yes" : "No"
  end
end

Problem.new.instance_eval do
  show(solve)
end

Measured memory_bytes: 20744
import sys
import heapq

input = sys.stdin.readline
 
N, M =  map(int, input().split())
A = list(map(int, input().split()))

A = list(map(lambda x: x * (-1), A))
heapq.heapify(A)

for _ in range(M):
    mx = heapq.heappop(A)
    heapq.heappush(A, mx // 2 if mx % 2 == 0 else mx // 2 + 1)

print(sum(A) * (-1))

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


void solve(long long H, long long W){
    if(H==1 || W==1){
        cout << 1 << endl;
        return;
    }
    long long HW = H*W;
    long long ans = HW/2LL + HW%2LL;
   
    cout << ans << endl;


}

// Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
int main(){
    long long H;
    scanf("%lld",&H);
    long long W;
    scanf("%lld",&W);
    solve(H, W);
    return 0;
}


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

typedef long long ll;
ll mod = 1000000007;

int main(){
	ll n , k;

	cin>>n>>k;
	ll mini = 0;
	ll maxi = n;

	ll value[n+1];

	for(int i =0;i <= n;i++){
		value[i] = (maxi - mini + 1) % mod;
		mini = mini + i + 1;
		maxi = maxi + n - i - 1;

		//cout<<value[i]<<" ";
	}
	//cout<<endl;

	ll sum = 0;
	for(int i = k -1;i <= n;i++){
		sum = (sum + value[i])%mod;
	}

	cout<<sum<<"\n";

	return 0;
}

Measured memory_bytes: 5204
#pragma comment(linker, "/stack:20000000")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx")

#include<bits/stdc++.h>
/*#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
#include<ext/pb_ds/detail/standard_policies.hpp>*/

#define sz(s) (int)(s.size())
#define all(s) s.begin(), s.end()
#define rep(a, b, c) for(int a = b; a <= c; ++a)
#define per(a, b, c) for(int a = b; a >= c; --a)
#define _ ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);

using namespace std;
//using namespace __gnu_pbds;

typedef unsigned long long ull;
typedef long long ll;
/*typedef tree<pair<int, int>, 
null_type, less<pair<int, int>>, 
rb_tree_tag, tree_order_statistics_node_update>
ordered_set;*/
//find_by_order() order_of_key()

const double eps = 1e-7;
const int mod = 1e9+7, MXN = 1e3+17;
const int dx[] = {0,0,1,-1}, dy[] = {1,-1,0,0};

template<typename T>inline bool updmin(T &a, const T &b) {return a > b ? a = b,1 : 0;}
template<typename T>inline bool updmax(T &a, const T &b) {return a < b ? a = b,1 : 0;}

int n, l;
string s[MXN];

int32_t main() { _
#ifdef DanQQQQQ
	freopen(".in","r",stdin);
	freopen(".out","w",stdout);
#endif
	cin >> n >> l;
	rep(i,1,n) cin >> s[i];
	sort(s+1,s+n+1);
	rep(i,1,n) cout << s[i];
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <sstream>
#include <iterator>
#include <string>
#include <vector>
#include <algorithm>
#include <list>
#include <cmath>

#define YESNO(x) x ? printf("YES") : printf("NO")
#define YesNo(x) x ? printf("Yes") : printf("No")
#define scani(x) scanf("%d", &x)
#define printi(x) printf("%d", x)

using namespace std;

//ABC065B - Trained?
int Main() {
	int n;
	struct btn {
		int num;
		bool touch;
	};
	vector<btn> a;
	int ans = 0;
	int next = 0;

	scani(n);
	a.resize(n);	for (auto& btn : a) {
		scani(btn.num);
		btn.touch = false;
	}

	//check
	while (1 != next && false == a[next].touch) {
		a[next].touch = true;
		next = a[next].num - 1;
		ans++;
	}
	if (1 != next) ans = -1;

	printi(ans);

	return 0;
}


int main()
{
	Main();
	return 0;
}

Measured memory_bytes: 1024
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner stdIn = new Scanner(System.in);
		
		while(stdIn.hasNext()){
			double xa1 = stdIn.nextDouble();
			double ya1 = stdIn.nextDouble();
			double xa2 = stdIn.nextDouble();
			double ya2 = stdIn.nextDouble();
			double xb1 = stdIn.nextDouble();
			double yb1 = stdIn.nextDouble();
			double xb2 = stdIn.nextDouble();
			double yb2 = stdIn.nextDouble();
			boolean flag = true;
			if(xb2<xa1||xa2<xb1||ya2<yb1||yb2<ya1){
				flag = false;
			}
			System.out.println(flag?"YES":"NO");
		}
	}
}

Measured memory_bytes: 12000
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define vi vector<int>
#define vvi vector<vector<int>>
#define pii pair<int,int>
#define vs vector<string>
#define ll long long
#define ull unsigned long long
#define fastio ios_base::sync_with_stdio(false);cin.tie(nullptr);cout.tie(nullptr);
#define ld long double
#define mod 1000000007
#define q_type vector<ll>
using namespace std;
using namespace __gnu_pbds;

typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;



int main()
{
    ull n;
    cin>>n;
    if(n%2==1)
    {
        cout<<0<<endl;
        return 0;
    }

    ull ans = n/10;
    ull cur = 50;
    while(cur<=n)
    {
        ans += (n/cur);
        cur *= 5; 
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 256
/*{{{*/
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<string>
#include<iostream>
#include<sstream>
#include<set>
#include<map>
#include<queue>
#include<bitset>
#include<vector>
#include<limits.h>
#include<assert.h>
#define SZ(X) ((int)(X).size())
#define ALL(X) (X).begin(), (X).end()
#define REP(I, N) for (int I = 0; I < (N); ++I)
#define REPP(I, A, B) for (int I = (A); I < (B); ++I)
#define FOR(I, A, B) for (int I = (A); I <= (B); ++I)
#define FORS(I, S) for (int I = 0; S[I]; ++I)
#define RS(X) scanf("%s", (X))
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define GET_POS(c,x) (lower_bound(c.begin(),c.end(),x)-c.begin())
#define CASET int ___T; scanf("%d", &___T); for(int cs=1;cs<=___T;cs++)
#define MP make_pair
#define PB push_back
#define MS0(X) memset((X), 0, sizeof((X)))
#define MS1(X) memset((X), -1, sizeof((X)))
#define LEN(X) strlen(X)
#define F first
#define S second
using namespace std;
typedef long long LL;
typedef unsigned long long ULL;
typedef long double LD;
typedef pair<int,int> PII;
typedef vector<int> VI;
typedef vector<LL> VL;
typedef vector<PII> VPII;
typedef pair<LL,LL> PLL;
typedef vector<PLL> VPLL;
template<class T> void _R(T &x) { cin >> x; }
void _R(int &x) { scanf("%d", &x); }
void _R(LL &x) { scanf("%lld", &x); }
void _R(double &x) { scanf("%lf", &x); }
void _R(char &x) { scanf(" %c", &x); }
void _R(char *x) { scanf("%s", x); }
void R() {}
template<class T, class... U> void R(T &head, U &... tail) { _R(head); R(tail...); }
template<class T> void _W(const T &x) { cout << x; }
void _W(const int &x) { printf("%d", x); }
void _W(const LL &x) { printf("%lld", x); }
void _W(const double &x) { printf("%.16f", x); }
void _W(const char &x) { putchar(x); }
void _W(const char *x) { printf("%s", x); }
template<class T,class U> void _W(const pair<T,U> &x) {_W(x.F); putchar(' '); _W(x.S);}
template<class T> void _W(const vector<T> &x) { for (auto i = x.begin(); i != x.end(); _W(*i++)) if (i != x.cbegin()) putchar(' '); }
void W() {}
template<class T, class... U> void W(const T &head, const U &... tail) { _W(head); putchar(sizeof...(tail) ? ' ' : '\n'); W(tail...); }
#ifdef HOME
 #define DEBUG(...) {printf("# ");printf(__VA_ARGS__);puts("");}
#else
 #define DEBUG(...)
#endif
int MOD = 1e9+7;
void ADD(LL& x,LL v){x=(x+v)%MOD;if(x<0)x+=MOD;}
/*}}}*/
const int SIZE = 1e6+10;
LL f(LL x){
    if(x<=0)return 0;
    LL v=x^(x&3);
    LL AA=0;
    while(v<=x){
        AA^=v;
        v++;
    }
    return AA;
}
int main(){
    LL x,y; R(x,y);
    W(f(y)^f(x-1));
    return 0;
}


Measured memory_bytes: 256
import java.util.*;

public class Main{
    public static void main(String[] args){
        Scanner scan = new Scanner(System.in);
        int a = scan.nextInt();
        int b = scan.nextInt();
        int c = scan.nextInt();
        int d = scan.nextInt();
        int e = scan.nextInt();
        int k = scan.nextInt();
        System.out.println(e - a <= k ? "Yay!" : ":(");
        scan.close();
    }
}

Measured memory_bytes: 27024
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <string>
#include <utility>
#include <algorithm>
#include <cstdio>
#include <iomanip>
#include <queue>
#include <deque>
#include <stack>
#include <fstream>
#include <cmath>
#include <random>
#include <complex>
#include <functional>

#define ll int64_t
#define Rep(i, n) for (ll i = 0; i < n; i++)
using namespace std;
typedef vector<ll> vec;
typedef vector<vec> mat;

const ll inf = 1LL << 60;

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

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

    ll A, B;
    cin >> A >> B;
    ll ans = 0;
    for (; ans <= 100000; ans++) {
        if (ans * 8 / 100 == A and ans * 1 / 10 == B) {
            cout << ans << endl;
            return 0;
        }
    }

    cout << -1 << endl;
}

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

int main() {
  int n;
  cin >> n;
  if (1 <= n && n <= 9) cout << n;
  if (10 <= n && n <= 99) cout << 9;
  if (100 <= n && n <= 999) cout << 9 + (n - 99);
  if (1000 <= n && n <= 9999) cout << 9 + 900;
  if (10000 <= n && n <= 99999) cout << 9 + 900 + (n - 9999);
  if (n == 100000) cout << 90909;
  return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <ctime>
#include <iostream>
#include <algorithm>
#include <sstream>
#include <string>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <utility>
#include <cctype>
using namespace std;

#define rep(i,n) for(int (i)=0; (i)<(int)(n); ++(i))
#define foreach(c,i) for(__typeof((c).begin()) i=(c).begin();i!=(c).end();i++)

int N;
string in;
char type;

void solve() {
  if (type == 'X') return;
  N = in.size();
  bool is_us = false;
  vector<string> ret;
  if (in.find('_') != -1) { is_us = true; }
  if (is_us) {
    // underscore
    if (type == 'D') { printf("%s\n",in.c_str()); return; }
    int cur = 0;
    for (int i = 1; i < in.size(); ++i) {
      if (in[i] == '_') {
        ret.push_back(in.substr(cur,i-cur));
        cur = i+1;
      }
    }
    ret.push_back(in.substr(cur, in.size()-cur));
    rep(i,ret.size()) ret[i][0] = toupper(ret[i][0]);
    if (type == 'L') ret[0][0] = tolower(ret[0][0]);
    rep(i,ret.size()) printf("%s",ret[i].c_str()); puts("");
  } else {
    // L or U
    int cur = 0;
    for (int i = 1; i < in.size(); ++i) {
      if (isupper(in[i])) {
        ret.push_back(in.substr(cur, i-cur));
        cur = i;
      }
    }
    ret.push_back(in.substr(cur, in.size()-cur));
    if (type == 'D') {
      rep(i,ret.size()) ret[i][0] = tolower(ret[i][0]);
      rep(i,ret.size()) {
        if(i) putchar('_'); printf("%s",ret[i].c_str());
      } puts("");
    } else {
      if (type == 'U') ret[0][0] = toupper(ret[0][0]);
      else ret[0][0] = tolower(ret[0][0]);
      rep(i,ret.size()) printf("%s",ret[i].c_str()); puts("");
    }
  }
}

int main() {
  while (cin >> in >> type) solve();
  return 0;
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
#define ll long long

//#define int long long

using namespace std;
const int MN = 1e5+7;

int n, m, mark[MN], cnt[MN];
vector<int> g[MN];

void dfs(int now){
    mark[now] = 0;
    for(int i = 0; i < g[now].size(); i++){
        if(mark[g[now][i]] == -1){
            dfs(g[now][i]);
        }
        mark[now] = max(mark[now], mark[g[now][i]] + 1);
    }
}

signed main()
{
    memset(mark, -1, sizeof mark);
    cin >> n >> m;
    for(int i = 0; i < m; i++){
        int x, y;
        cin >> x >> y;
        x--; y--;
        g[x].push_back(y);
        cnt[y]++;
    }
    vector<int> s;
    for(int i = 0; i < n; i++){
        if(cnt[i] == 0){
            s.push_back(i);
        }
    }
    for(int i = 0; i < s.size(); i++){
        dfs(s[i]);
    }

    int maxi = 0;
    for(int i = 0; i < n; i++){
        maxi = max(maxi, mark[i]);
    }
    cout << maxi;
}


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

int main() {
    int N;
    cin >> N;
    vector<int> A(N);
    int S=0;
    for(int i = 0;i<N ;i++){
        cin >> A[i];
        S+=A[i];
    }
    int P=0,Q=0;
    bool flag=true;
    for(int i=0;i<N;i++){
        P+=A[i];
        Q=S-2*P;
        if(Q<=0){
            cout << min(-Q,Q+2*A[i]) << endl;
            break;
        }
    }
    
    return 0;
}

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

using namespace std;

#define long long long
#define INF 2e18
#define MOD (long) (1e9 + 7)
#define umap unordered_map

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

    long t = 1;
    //cin >> t;

    while (t--) {
        long a, b;
        cin >> a >> b;

        long ans = a * b / __gcd(a, b);
        printf("%lld\n", ans);
    }
}


Measured memory_bytes: 3760
W, H, x, y = map(int, input().split())
ans = W*H/2
if x == 0 or x == W or y == 0 or y == H:
    flg = 0
else:
    if x == W/2 and y == H/2:
        flg = 1
    else:
        flg = 0

print(ans, flg)


Measured memory_bytes: 2940
#include<iostream>
#include<string.h>
#include<stdio.h>
#include<string>
#include<queue>
using namespace std;

int main()
{
    int a,b,c;
    cin>>a>>b>>c;
    if(c>=a && c<=b)
        cout<<"Yes"<<endl;
    else
        cout<<"No"<<endl;

    return 0;
}



Measured memory_bytes: 256
def is_upper(c):
    return ord('A') <= ord(c) and ord(c) <= ord('Z')


def is_lower(c):
    return ord('a') <= ord(c) and ord(c) <= ord('z')


def shift(c, k):
    if is_upper(c):
        return chr((ord(c) - ord('A') + k) % 26 + ord('A'))
    elif is_lower(c):
        return chr((ord(c) - ord('a') + k) % 26 + ord('a'))
    else:
        return c


def caesar(s, k, decode=False):
    if decode:
        k = -k
    return "".join([shift(c, k) for c in s])


N = int(input())
S = str(input())
enc = caesar(S, N)
print(enc)


Measured memory_bytes: 3188
import java.io.BufferedInputStream;
import java.util.Arrays;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc=new Scanner(new BufferedInputStream(System.in));
        int m=sc.nextInt();
        int a=sc.nextInt();
        int n[]=new int[m];
        for(int i=0;i<m;i++)
            n[i]=sc.nextInt();
        Arrays.sort(n);
        long all=0;
        for(int i=0;i<m-a;i++)
            all+=n[i];
        System.out.println(all);
    }
}

Measured memory_bytes: 91124
#include "bits/stdc++.h"
using namespace std;
#define forn(i, x, n) for (int i = x; i < n; i++)
#define all(a) (a).begin(), (a).end()
#define pii pair<int, int>
#define pll pair<ll, ll>
typedef long double ld;
typedef long long ll;

int main() {
    int a, b;
    cin >> a >> b;
    int m = max(a + b, a - b);
    m = max(m, a * b);
    cout << m << endl;
    return 0;
}


Measured memory_bytes: 764
#include<bits/stdc++.h>
typedef long long ll;
using namespace std;
int main()
{
    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    string s;
    cin>>s;
    ll i,j,k;
    for(i=0;s[i];i++)
    {
        if(s[i]=='1')s[i]='9';
        else if(s[i]=='9')s[i]='1';
    }
    cout<<s;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,l,r) for(int i=l; i<(int)(r); i++)
#define rep_eq(i,l,r) for(int i=l; i<=(int)(r); i++)
#define all(vec) vec.begin(),vec.end()
using namespace std;

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

using ll=long long;

using vb=vector<bool>;
using vi=vector<int>;
using vll=vector<ll>;
using vvi=vector<vi>;
using vs=vector<string>;

const int INF=INT_MAX;

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

  int N; cin >>N;
	string S; cin >>S;
	string RS=S;
  reverse(all(RS));

  vi west={0};
  vi east={0};

  rep(i,0,N) {
    if (S[i]=='W') {
      west.push_back(west.back()+1);
    } else {
      west.push_back(west.back());
    }
  }
  west.push_back(0);

  rep(i,0,N) {
    if (RS[i]=='E') {
      east.push_back(east.back()+1);
    } else {
      east.push_back(east.back());
    }
  }
  east.push_back(0);
  reverse(all(east));

  int ans=INF;
  rep(i,1,N+1) {
    chmin(ans,west[i-1]+east[i+1]);
  }

  cout <<ans <<'\n';
  return 0;
}


Measured memory_bytes: 8112