akhauriyash/Code-Regression huggingface dataset:
#include <iostream>

using namespace std;

int main() {
	int l1, l2, temp;
	int nums[3];

	cin >> nums[0] >> nums[1] >> nums[2];

	for (l1 = 0; l1 < 2; l1++) {
		for (l2 = 1; l2 <= 2; l2++) {
			if (nums[l1] > nums[l2]) {
				temp = nums[l2];
				nums[l2] = nums[l1];
				nums[l1] = temp;
			}
		}
	}

	cout << nums[0] << " " << nums[1] << " " << nums[2] << endl;
}


Measured memory_bytes: 3084
#include<bits/stdc++.h>
using namespace std;
int main() 
{
int A,B,M;
cin>>A>>B>>M;
vector<int>a(A);
vector<int>b(B);
for(int i= 0;i<A;i++) cin>>a[i];
for(int i= 0;i<B;i++) cin>>b[i];
int minA= *min_element(a.begin(),a.end());
int minB= *min_element(b.begin(),b.end());
int ans=minA+minB;
for(int i= 0;i<M;i++) 
{
int x,y,c;
cin>>x>>y>>c;
x--;
y--;
ans=min(ans,a[x] +b[y] -c);
}
cout<<ans<<endl;
return 0;
}

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

int main(){
    int n;
    string s;
    

    cin >>n >>s;
    char zetto = 'Z';

    for(int i =0; i<s.size();i++){
        if(s.at(i)+n<=zetto){
            s.at(i)=s.at(i)+n;
        }else{
            s.at(i) = s.at(i)+n-26;
        }
    }
cout << s<< endl;
}

Measured memory_bytes: 256
use std::io::Write;

#[allow(unused)]
macro_rules! debug {
    ($($format:tt)*) => (write!(std::io::stderr(), $($format)*).unwrap());
}
#[allow(unused)]
macro_rules! debugln {
    ($($format:tt)*) => (writeln!(std::io::stderr(), $($format)*).unwrap());
}

fn main() {
    let s: String = {
        let mut s = String::new();
        std::io::stdin().read_line(&mut s).unwrap();
        let s = s.trim_right().to_owned();
        s.parse().unwrap()
    };
    let c = s.chars().next().unwrap();

    println!("{}", (c as u8 + 1) as char);
}


Measured memory_bytes: 4352
using System.Collections.Generic;
using System.Linq;
using System;

public class Hello
{
    public static void Main()
    {
        var d = new Dictionary<string, List<string>>();
        var n = int.Parse(Console.ReadLine().Trim());
        var user = new List<string>();
        for (int i = 0; i < n; i++)
        {
            string[] s = Console.ReadLine().Trim().Split(' ');
            var wu = "u" + s[0];
            var wd = "d" + s[2];
            if (s[1] == "lock")
            {
                if (d.ContainsKey(wd)) d[wd].Add(wu);
                else { d[wd] = new List<string>(); d[wd].Add(wu); user.Add(wu); }
            }
            else
            {
                if (d.ContainsKey(wu)) d[wu].Add(wd);
                else { d[wu] = new List<string>(); d[wu].Add(wd); }
            }
        }
        Console.WriteLine(check(d, user) ? 1 : 0);
    }
    static bool check(Dictionary<string, List<string>> d, List<string> user)
    {
        foreach (var x in user)
        {
            var q = new Queue<string>();
            if (d.ContainsKey(x))
            {
                foreach (var y in d[x]) q.Enqueue(y);
                while (q.Count() > 0)
                {
                    var w = q.Dequeue();
                    if (w == x) return true;
                    if (d.ContainsKey(w)) foreach (var y in d[w]) q.Enqueue(y);
                }
            }
        }
        return false;
    }
}


Measured memory_bytes: 18640
#include <bits/stdc++.h>
#include <random>
#include <ctime>
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
//#pragma GCC optimize("-O3")
//#pragma GCC optimize("Ofast")
//#pragma GCC optimize("unroll-loops")
//#pragma GCC target("avx2")
#define ll long long
#define mp make_pair
#define pb push_back
#define fi first
#define se second
#define pll pair<ll,ll>
#define ld double
#define pld pair<ld,ld>
#define pii pair<int,int>
#define sqr(a) ((a)*(a))
#define all(v) v.begin(),v.end()

using namespace std;
//using namespace __gnu_pbds;

const ll MOD = 1e9+7;
const ll INF = 1e18;
const ld E = 1e-12;
const ld PI=acos(-1);
mt19937_64 rnd(time(0));
ll p1 = 31, p2 = 37, p3 = 7, p4 = rnd() % 100 + 1, md1 = MOD, md2 = 998244353, md3 = 998244357, md4 = rnd() % 1000000000;

//using ord_set=tree<T,null_type,less<T>,rb_tree_tag,tree_order_statistics_node_update>;

ll n, m, rst[200001];
vector<ll> c[200001];
bool tt[200001];

ll binpow(ll h, ll r, ll md = MOD)
{
    ll l = 1;
    while (r)
    {
        if (r & 1) l *= h, l %= md;
        h *= h;
        h %= md;
        r /= 2;
    }
    return l;
}

ll gcd(ll x, ll y)
{
    if (x < y) swap(x, y);
    while (x && y)
    {
        x %= y;
        swap(x, y);
    }
    return x + y;
}

void solve()
{
    ll x;
    cin >> x;
    cout << (360)/gcd(360,x) << "\n";
}

int main()
{
    //freopen("input.txt","r",stdin);
    //freopen("output.txt","w",stdout);
    //freopen("capitals.in","r",stdin);
    //freopen("capitals.out","w",stdout);
    ios::sync_with_stdio(0);
    cin.tie(0);
    ll t=1;
    //cin >> t;
    while (t--)
    {
        solve();
    }
    return 0;
}

/*
8 2
2 2 2 2 2 2 2 2
1 2

*/


Measured memory_bytes: 8352
//Ruthless Coding 
#include <bits/stdc++.h>

#define uni(x)      (x).resize(unique(ALL(x)) - (x).begin())
#define fprint(v)   for(auto x : v) cout << x << ' '
#define ALL(x)      (x).begin(), (x).end()
#define PI          3.14159265358979323846
#define MP(x, y)    make_pair(x, y)
#define SZ(x)       int((x).size())
#define PB(x)       push_back(x)
#define ld          long double
#define ll          long long
#define S           second 
#define F           first
#define nl          '\n'

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

template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifndef ONLINE_JUDGE
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define debug(x...)
#endif
mt19937_64 rnd;

const int N = 2e5 + 5;
void tc(){
    int c;
    cin >> c;
    if(c >= 30) cout << "Yes";
    else cout << "No";
}
int main() {
    ios_base::sync_with_stdio(0);cin.tie(0);
    int t = 1;
    // cin >> t;
    while(t--) tc();
    return 0;
}
/*
    *** Most Impo.. -> check base case always
    1. Overflow Check (*, +)
    2. Index check (0 - based or 1 - based)
    3. Check for n = 1, 2, 3, 4....
    4. Corner Cases
*/

Measured memory_bytes: 3652
#include <bits/stdc++.h>
#define loop(n) for (int ngtkana_is_genius = 0; ngtkana_is_genius < int(n); ngtkana_is_genius++)
#define rep(i, begin, end) for(int i = int(begin); i < int(end); i++)
#define all(v) v.begin(), v.end()
#define lint long long
auto cmn = [](auto& a, auto b){if (a > b) {a = b; return true;} return false;};
auto cmx = [](auto& a, auto b){if (a < b) {a = b; return true;} return false;};

template <typename T>
std::istream& operator>> (std::istream& is, std::vector<T>& v) {
  for (auto & x : v) is >> x;
  return is;
}

template <typename T>
std::ostream& operator<< (std::ostream& os, const std::vector<T>& v) {
  auto n = v.size();
  os << "{";
  for (size_t i = 0; i < n; i++)
    {os << (i > 0 ? "," : "") << v.at(i);}
  return os << "}";
}

void debug_impl() { std::cerr << std::endl; }
template <typename Head, typename... Tail>
void debug_impl(Head head, Tail... tail){
  std::cerr << " " << head;
  debug_impl(tail...);
}
#define debug(...)\
  std::cerr << std::boolalpha << "[" << #__VA_ARGS__ << "]:";\
  debug_impl(__VA_ARGS__);\
  std::cerr << std::noboolalpha;

template <typename T>
auto make_vector_impl(size_t sz, T t) {return std::vector<T>(sz, t);}

template <size_t N, typename T, typename U, std::enable_if_t<N == 1, std::nullptr_t> = nullptr>
auto make_vector(size_t sz, U u) {return make_vector_impl(sz, T(u));}

template <size_t N, typename T, std::enable_if_t<N == 1, std::nullptr_t> = nullptr>
auto make_vector(size_t sz) {return std::vector<T>(sz);}

template <size_t N, typename T, typename... Args, std::enable_if_t<N != 1, std::nullptr_t> = nullptr>
auto make_vector(size_t a, Args... args) {return make_vector_impl(a, make_vector<N - 1, T>(args...));}

template <typename T, typename Size_t>
auto& at(T& t, Size_t i) {return t.at(i);}

template <typename T, typename Size_t, typename... Args>
auto& at(T& t, Size_t i, Args... args) {return at(t.at(i), args...);}

int main() {
  std::cin.tie(0); std::cin.sync_with_stdio(false);
  int h, w, d; std::cin >> h >> w >> d;
  auto a = make_vector< 2, int >(h, w, -1);
  rep(i, 0, h) rep(j, 0, w) {
    at(a, i, j) =
        (((i + j    ) / d) % 2) * 1
      + (((i + w - j) / d) % 2) * 2;
  }
  for(auto& v : a) {
    for (auto x : v) {
      std::cout << (x == 0
        ? 'R'
        : x == 1
        ? 'Y'
        : x == 2
        ? 'G'
        : 'B'
        );
    }
    std::cout << std::endl;
  }
  return 0;
}


Measured memory_bytes: 1536
import java.util.Scanner;
import java.util.stream.IntStream;

public class Main {

	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		int N = in.nextInt();
		long[] h = new long[100010];
		IntStream.range(0, N).forEach((i) -> h[i] = in.nextLong()); 
		long[] dp = new long[100010];
		IntStream.range(0, 100010).forEach((i) -> dp[i] = Long.MAX_VALUE);
		
		dp[0] = 0;
		
		for (int i = 1; i < N; ++i) {
			long cal1 = dp[i - 1] + Math.abs(h[i] - h[i -1]);
			long cal2 = (i > 1) ? dp[i - 2] + Math.abs(h[i] - h[i - 2]) : Long.MAX_VALUE;
			dp[i] = (cal1 < cal2) ? cal1 : cal2;
		}
		System.out.println(dp[N-1]);
	}

}


Measured memory_bytes: 60808
#2019/09/30
std_input = open(0).readlines()
N, M = map(int, std_input[0].split())
#print(N, M)
A = [list(map(int, i.rstrip("\n").split())) for i in std_input[1:1+N]]
#print(A)
intersection = [i+1 for i in range(M)]
#print(intersection)
for i in A:
    intersection = set(intersection) & set(i[1:])
print(len(intersection))

Measured memory_bytes: 3060
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);

		long x = sc.nextLong();

		double m = 100;

		int i;

		for(i = 0; m < x; i++) {
			m = Math.floor(m * 1.01);
		}

		System.out.println(i);

		sc.close();

	}

}


Measured memory_bytes: 35800
#include<bits/stdc++.h>
using namespace std;
int n,m;
vector<int> g[100005];
int color[100005];
void dfs(int u,int c) {
	if (color[u]) {
		if (color[u]!=c) {
			printf("%lld\n",1ll*n*(n-1)/2-1ll*m);exit(0);
		}
		return;
	}
	color[u]=c;
	for(int i=0;i<(int)g[u].size();i++) {
		int v=g[u][i];
		dfs(v,-c);
	}
}
int main() {
	scanf("%d%d",&n,&m);
	for(int i=1;i<=m;i++) {
		int a,b;
		scanf("%d%d",&a,&b);
		g[a].push_back(b);
		g[b].push_back(a);
	}
	dfs(1,1);
	int a=0,b=0;
	for(int i=1;i<=n;i++) if (color[i]==1) a++; else b++;
	printf("%lld\n",1ll*a*b-1ll*m);
	return 0;
}

Measured memory_bytes: 6528
#include <bits/stdc++.h>
using namespace std;
#ifndef ONLINE_JUDGE
#include "debug.h"
#else
#define debug(x...)
#endif
#define int long long
#define all(c) (c).begin(),(c).end()
#define rall(c) (c).rbegin(),(c).rend()
#define rep(i,a,b) for(int i=a;i<b;i++)
#define loop(i,c) for(auto i=(c).begin();i!=(c).end();i++)
#define lb lower_bound
#define ub upper_bound
#define pb push_back
#define F first
#define S second
const int mod =  1000000007;

void solving() {
	int n, k;
	cin >> n >> k;
	int a[n];
	for (int i = 0; i < n; i++) {
		cin >> a[i];
	}
	sort(a, a + n);
	int sum = 0;
	for (int i = 0; i < k; i++) {
		sum += a[i];
	}
	cout << sum << endl;
}

int32_t main() {
	ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	// int t{}; cin >> t; while (t--)
	solving();

	return 0;
}

Measured memory_bytes: 3660
#include<bits/stdc++.h>
#include <ext/pb_ds/detail/standard_policies.hpp>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
#define fi first
#define se second
#define fastio ios_base::sync_with_stdio(false); cin.tie(0)
#define loop(i, a, b) for(lli i=a; i<b; i++)
#define loopb(i, a, b) for(lli i=a; i>=b; i--)
#define pb push_back
#define umap unordered_map
typedef long long int lli;
typedef pair<lli, lli> pii;
typedef vector<lli> vll;
typedef tree<lli, null_type, less<lli>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
// use to avoid collision
struct custom_hash {
    static uint64_t splitmix64(uint64_t x) {
        // http://xorshift.di.unimi.it/splitmix64.c
        x += 0x9e3779b97f4a7c15;
        x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
        x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
        return x ^ (x >> 31);
    }

    size_t operator()(uint64_t x) const {
        static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
        return splitmix64(x + FIXED_RANDOM);
    }
};
// for pair in unordered_map
struct hash_pair {
    template <class T1, class T2>
    size_t operator()(const pair<T1, T2>& p) const
    {
        auto hash1 = hash<T1>{}(p.first);
        auto hash2 = hash<T2>{}(p.second);
        return hash1 ^ hash2;
    }
};
lli power(lli x, lli y){
    lli res = 1;
    x = x ;
    while (y > 0) {
        if (y & 1)
            res = (res*x) ;
        y = y>>1;
        x = (x*x);
    }
    return res;
}
lli M = 1e9 + 7;
lli solve(){
	lli n;
	cin>>n;
	vll A(n);
	loop(i, 0, n)	cin>>A[i];
	lli ans = 1;
	vll id(3, 0);
	loop(i, 0, n){
		lli count = 0;
		lli d = -1;
		if(A[i] == id[0]){
			count++;
			d = 0;
		}
		if(A[i] == id[1]){
			count++;
			d = 1;
		}
		if(A[i] == id[2]){
			count++;
			d = 2;
		}
		if(count == 0){
			cout<<0<<"\n";
			return 0;
		}
		ans = (ans * count)%M;
		id[d]++;
//		if(A[i] == 0 && r == 0)
//			r++;
//		else if(A[i] == 0 && b == 0){
//			b++;
//			ans = (ans*2)%M;
//		}
//		else if(A[i] == 0 && c == 0)
//			c++;
//		else if(A[i] == r && A[i] != b && A[i] != c)
//			r++;
//		else if(A[i] == r && A[i] == b && A[i] != c){
//			r++;
//			ans = (ans * 2)%M;
//		}
//		else if(A[i] == r && A[i] != b && A[i] == c){
//			r++;
//			ans = (ans * 2)%M;
//		}
//		else if(A[i] == r && A[i] == b && A[i] == c){
//			r++;
//			ans = (ans * 3)%M;
//		}
//		else if(A[i] == b && A[i] != c){
//			b++;
//		}
//		else if(A[i] == c && A[i] != b)
//			c++;
//		else if(A[i] == b && A[i] == c){
//			b++;
//			ans = (ans*2)%M;
//		}
	}
//	ans = (ans * 3)%M;
	cout<<ans<<"\n";
	return 0;
}
int main(){
	fastio;
	lli t;
//	cin>>t;
	t = 1;
	while(t>0){
		t--;
		solve();
	}
}


Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < n; i++)
#define all(x)(x).begin(), (x).end() // 昇順ソート
#define rall(v)(v).rbegin(), (v).rend() // 降順ソート
#define INF 1LL << 60
typedef long long int LL;
typedef long long int ll;
#define pll pair < ll, ll >
#define F first
#define S second
const int MOD = 1000000007;
template < class T > bool chmax(T & a,const T & b) { if (a < b) { a = b; return true; } return false; }
template < class T > bool chmin(T & a,const T & b) { if (a > b) { a = b; return true; } return false; }
// 任意のlogは　対数の底の変換を使う    log(N) / log(任意の底)

int main() {
    LL D,T,S;cin >> D >> T >> S;
    if(T * S >= D)cout << "Yes" << endl;
    else cout << "No" << endl;
}

Measured memory_bytes: 3628
#include<bits/stdc++.h>
using namespace std;
#define forN(n, N) for(int n=0; n<N; n++)
#define res_out(ans) cout << ans << "\n";
#define ll long long

int zero[int(1e6)], one[int(1e6)];

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    string S;
    int N,  K, i = 0;
    cin >> N >> K >> S;
    forN(n, N){
        if(S[n] == '0'){
            zero[i]++;
            if(n + 1 < N && S[n+1] == '1')i++;
        }
        else one[i]++;
    }
    int num, ans = 0;
    forN(n, i+1){
        num = 0;
        for(int m=0; m<K && m + n <= i; m++){
            num += zero[n+m] + one[n+m];
        }
        if(n + K <= i)num += one[n+K];
        if(ans < num)ans = num;
    }
    res_out(ans)
    return 0;
}

Measured memory_bytes: 4816
x1,y1,x2,y2 = map(float,input().split())
det = x1 - x2
if det != 0:
    a = (y1 - y2) / det
    b = (-(y1 * x2) + y2 * x1) / det

q = int(input())
x,y = [],[]
for i in range(q):
    x_t,y_t = map(float,input().split())
    x.append(x_t)
    y.append(y_t)

if det == 0:
    for i in range(q):
        print(-x[i],y[i])
elif y2 == y1:
    for i in range(q):
        print(x[i],-y[i])
else:
    for i in range(q):
        k = y[i] + 1/a * x[i]
        s = (k - b)/(a + 1/a)
        print(s+(s-x[i]),-1/a * (s+(s-x[i])) + k)

Measured memory_bytes: 7908
#include <iostream>
#include <fstream>
#include <set>
#include <map>
#include <string>
#include <vector>
#include <queue>
#include <deque>
#include <stack>
#include <functional>
#include <algorithm>
#include <climits>
#include <cmath>
#include <iomanip>
using namespace std;
#define ll long long int
#define rep(i,n) for( int i = 0; i < n; i++ )
#define rrep(i,n) for( int i = n; i >= 0; i-- )
#define REP(i,s,t) for( int i = s; i <= t; i++ )
#define RREP(i,s,t) for( int i = s; i >= t; i-- )
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define INF 2000000000
#define mod 1000000007
#define INF2 1000000000000000000


int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int K, N;
    cin >> N >> K;
    if(K == 1) cout << 0 << endl;
    else cout << N - K << endl;

    return 0;
}


Measured memory_bytes: 3552
#include <bits/stdc++.h>
#define ff first
#define ss second
using namespace std;
#define nl '\n'
typedef long long ll;
typedef long double ld;
//////////////////////////////////////////////////////////////////////

const int N = 100100;
int n,m;
vector<int> g[N];
bool bip,vis[N],col[N];
void dfs(int x=1,bool color = 0){
  vis[x] = 1;
  col[x] = color;
  for(auto&it:g[x])
    if(!vis[it]){
      dfs(it,color xor true);
    } else {
      if( col[it] == col[x] ) {
	bip = false;
      }
    }
}

int main(){
  ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
  
  cin >> n >> m;
  
  for(int u,v,i=1;i<=m;i++){
    cin>>u>>v;
    g[u].emplace_back(v);
    g[v].emplace_back(u);
  }
  fill(vis,vis+n+1,0);
  bip = 1;
  dfs();
  
  if( !bip ) {
    cout << (n*1ll*(n-1))/2 - m << endl;
  } else {
    int cnt = 0;
    for(int i=1;i<=n;i++)if(col[i])cnt++;
    cout << ( cnt * 1ll * (n-cnt) ) - m << endl;
  }
  
  return 0;
};


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

#define rep(i, x, y) for (register int i = (x); i <= (y); ++i)
#define Rep(i, x, y) for (register int i = (x); i >= (y); --i)
#define int long long

const int _ = 1 << 21;
struct I {
	char fin[_], *p1 = fin, *p2 = fin;
	inline char gc() {
		return (p1 == p2) && (p2 = (p1 = fin) + fread(fin, 1, _, stdin), p1 == p2) ? EOF : *p1++;
	}
	inline I& operator>>(int& x) {
		bool sign = 1;
		char c = 0;
		while (c < 48) ((c = gc()) == 45) && (sign = 0);
		x = (c & 15);
		while ((c = gc()) > 47) x = (x << 1) + (x << 3) + (c & 15);
		x = sign ? x : -x;
		return *this;
	}
	inline I& operator>>(double& x) {
		bool sign = 1;
		char c = 0;
		while (c < 48) ((c = gc()) == 45) && (sign = 0);
		x = (c - 48);
		while ((c = gc()) > 47) x = x * 10 + (c - 48);
		if (c == '.') {
			double d = 1.0;
			while ((c = gc()) > 47) d = d * 0.1, x = x + (d * (c - 48));
		}
		x = sign ? x : -x;
		return *this;
	}
	inline I& operator>>(char& x) {
		do
			x = gc();
		while (isspace(x));
		return *this;
	}
	inline I& operator>>(string& s) {
		s = "";
		char c = gc();
		while (isspace(c)) c = gc();
		while (!isspace(c) && c != EOF) s += c, c = gc();
		return *this;
	}
} in;
struct O {
	char st[100], fout[_];
	signed stk = 0, top = 0;
	inline void flush() {
		fwrite(fout, 1, top, stdout), fflush(stdout), top = 0;
	}
	inline O& operator<<(int x) {
		if (top > (1 << 20)) flush();
		if (x < 0) fout[top++] = 45, x = -x;
		do
			st[++stk] = x % 10 ^ 48, x /= 10;
		while (x);
		while (stk) fout[top++] = st[stk--];
		return *this;
	}
	inline O& operator<<(char x) {
		fout[top++] = x;
		return *this;
	}
	inline O& operator<<(string s) {
		if (top > (1 << 20)) flush();
		for (char x : s) fout[top++] = x;
		return *this;
	}
} out;
#define pb emplace_back
#define fir first
#define sec second

template < class T > inline void cmax(T & x , const T & y) {
	(x < y) && (x = y) ;
}
template < class T > inline void cmin(T & x , const T & y) {
	(x > y) && (x = y) ;
}
int n , k ;
const int N = 1e5 + 10 ;
int a[N] ;
int fac[N] ;
const int mod = 1e9 + 7 ;
int ans1 = 0 , ans2 = 0 ;
int qpow(int x , int y) {
	int ans = 1 ;
	for( ; y ; y >>= 1 , x = x * x % mod) 
		if(y & 1) ans = ans * x % mod ;
	return ans ;
}
int inv(int x) {
	return qpow(x , mod - 2) ;
}
int C(int n , int m) {
	return fac[n] * (inv(fac[n - m]) * inv(fac[m]) % mod) % mod ;
}
signed main() {
#ifdef _WIN64
	freopen("testdata.in" , "r" , stdin) ;
#endif
	in >> n >> k ;
	rep(i , 1 , n) in >> a[i] ;
	sort(a + 1 , a + n + 1) ;
	fac[0] = 1 ;
	rep(i , 1 , n) fac[i] = fac[i - 1] * i % mod ;
	rep(i , 1 , n - k + 1) {
		ans1 = ((ans1 + C(n - i , k - 1) * a[i]) % mod + mod) % mod ;
	}
	reverse(a + 1 , a + n + 1) ;
	rep(i , 1 , n - k + 1) {
		ans2 = ((ans2 + C(n - i , k - 1) * a[i]) % mod + mod) % mod ;
	}
	out << (ans2 - ans1 + mod) % mod << '\n' ;
	return out.flush(), 0;
}


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

int min(int A[], int N){

    int min = A[0];
    
    for(int i=1; i<N; i++){
        min = min > A[i] ? A[i] : min;
    }
    
    return min;
    
}

int max(int A[], int N){
    
    int max = A[0];
    
    for(int i=1; i<N; i++){
        max = max < A[i] ? A[i] : max;
    }
    
    return max;
    
}

long sum(int A[], int N){
    
    long sum = 0;
    
    for(int i=0; i<N; i++){
        sum += A[i];
    }
    
    return sum;
    
}

int main() {
    
    int N;
    cin >> N;
    
    int A[N];
    for(int i=0; i<N; i++){
        cin >> A[i];
    }
    
    cout << min(A,N) << " " << max(A,N) << " " << sum(A,N) << endl;
    
    return 0;
}


Measured memory_bytes: 3144
#include <iostream>
#include <algorithm>
#include <cmath>
#include <vector>

using namespace std;

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

    int Diagram[N - 1][3];
    for (int i = 0; i < N - 1; ++i) cin >> Diagram[i][0] >> Diagram[i][1] >> Diagram[i][2];
    vector<int> times;
    for (int i = 0; i < N - 1; ++i) {
        int res = 0;
        for (int j = i; j < N - 1; ++j) {
            if (res <= Diagram[j][1]) {
                res = Diagram[j][1] + Diagram[j][0];
            } else {
                int pivot = 0;
                while (Diagram[j][2] * pivot < res) {
                    pivot++;
                }
                res += Diagram[j][2] * pivot - res + Diagram[j][0];
            }
        }
        times.emplace_back(res);
    }

    times.emplace_back(0);

    for (int i = 0; i < times.size(); ++i) {
        cout << times[i] << endl;
    }
}

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

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


int main () {
  int N, X, ans;

  cin >> N >> X;

  ans = 0;
  rep(i,N) {
    int x;
    cin >> x;
    ans = gcd(abs(x-X), ans);
  }

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


Measured memory_bytes: 256
INF = 1e12

v, e = (int(s) for s in input().split())
cost = [[INF] * v for i in range(v)]
for i in range(v):
    cost[i][i] = 0

for i in range(e):
    si, ti, di = (int(s) for s in input().split())
    cost[si][ti] = di

for k in range(v):
    for i in range(v):
        for j in range(v):
            if cost[i][k] != INF and cost[k][j] != INF:
                if cost[i][j] > cost[i][k] + cost[k][j]:
                    cost[i][j] = cost[i][k] + cost[k][j]

if any(cost[i][i] for i in range(v)):
    print('NEGATIVE CYCLE')
else:
    for di in cost:
        ldi = []
        for dij in di:
            if dij == INF:
                ldi.append('INF')
            else:
                ldi.append(str(dij))
        print(' '.join(ldi))

Measured memory_bytes: 7060
import java.io.PrintWriter;
        import java.util.*;
        import java.io.*;
        import java.util.stream.IntStream;
        import java.util.stream.Stream;

public class Main {

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

    final IO io = new IO();
    final PrintWriter out = new PrintWriter(System.out);

    void stream() {
        solve();
        out.flush();
    }

    void solve() {
        int N = io.Int();
        String S = io.String();

        char acc = S.charAt(0);
        int ans = 1;
        for(int i = 1; i < N; i++) {
            if(acc != S.charAt(i)) {
                acc = S.charAt(i);
                ans++;
            }
        }
        System.out.println("" + ans);
    }
}

class IO {
    private final InputStream in = System.in;
    private final byte[] buffer = new byte[1 << 12];
    private int ptr = 0, buffLen = 0;

    private boolean hasNextByte() {
        if (ptr < buffLen) return true;
        ptr = 0;
        try {
            buffLen = in.read(buffer);
        } catch (IOException e) {
            e.printStackTrace();
        }
        return buffLen > 0;
    }

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

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

    private void skipUnprintable() {
        while (hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++;
    }

    private boolean hasNext() {
        skipUnprintable();
        return hasNextByte();
    }

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

    public String String() {
        return next();
    }

    public char Char() {
        return next().charAt(0);
    }

    public int Int() {
        return Integer.parseInt(next());
    }

    public long Long() {
        return Long.parseLong(next());
    }

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

    public String[] StringArr(final int n) {
        final String[] arr = new String[n];
        for (int i = 0; i < n; ++i) arr[i] = String();
        return arr;
    }

    public char[] CharArr(final int n) {
        final char[] arr = new char[n];
        for (int i = 0; i < n; ++i) arr[i] = Char();
        return arr;
    }

    public int[] IntArr(final int n) {
        final int[] arr = new int[n];
        for (int i = 0; i < n; ++i) arr[i] = Int();
        return arr;
    }

    public long[] LongArr(final int n) {
        final long[] arr = new long[n];
        for (int i = 0; i < n; ++i) arr[i] = Long();
        return arr;
    }

    public double[] DoubleArr(final int n) {
        final double[] arr = new double[n];
        for (int i = 0; i < n; ++i) arr[i] = Double();
        return arr;
    }
}

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

int main() {
    int A, B, C, D;
    cin >> A >> B >> C >> D;

    if (A * B <= C * D) {
        cout << C * D << endl;
    } else {
        cout << A * B << endl;
    }

    return 0;
}

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

int gmc(int x, int y) {
  if(y == 0) return x;
  gmc(y, x%y);
}
int main(){
  int x, y;
  cin >> x >> y;
  if(x<y) swap(x, y);
  cout << gmc(x, y) << endl;
}



Measured memory_bytes: 3108
#include <bits/stdc++.h>
using namespace std;
int main()
{
	int n, x;
	cin >> n;
	vector<int> vec[n+1];
	for(int i=2;i<=n;i++)
	{
		cin >> x;
		vec[x].push_back(i);
	}
	for(int i=1;i<=n;i++)
		cout << vec[i].size() << endl;
	return 0;
}


Measured memory_bytes: 14388
#include <iostream>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <cmath>
#include <queue>
#include <numeric>

using namespace std;

typedef long long ll;

long long GCD(long long a, long long b){if(b==0)return a;return GCD(b,a%b);}

int main() {
    int res = 0;
    string s; cin >> s;
    for (int i = 0; i < s.size(); ++i) {
        if (s[i] == '+') ++res;
        else --res;
    }
    cout << res << endl;
}



Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main()
{
	int n;
	cin>>n;
	int a[100000+5]={0};
	for(int i=1;i<=n;i++)
		cin>>a[i];
	int num=0;
	for(int i=1;i<=n;i++)
	{
		if(a[i]==i)
		{
				swap(a[i],a[i+1]);
				num++;
		}
	}
	cout<<num<<endl;
	return 0;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
 
#define ll long long
#define vvi vector< vector<int> >
#define vi vector<int>
#define All(X) X.begin(),X.end()
#define FOR(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define REP(i,n) for(int i=0;i<(int)(n);i++)
#define pb push_back
#define pii pair<int,int>
#define mp make_pair
#define pi 3.14159265359
#define shosu(X) fixed << setprecision(X)
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return a/gcd(a,b)*b;}
 
int main(){
string s;
cin >> s;
int l = -1;
int r = -1;
REP(i,s.size()){
if(s[i] == 'A' && l == -1) l = i;
}
for(int i = s.size()-1; i > -1; i--){
if(s[i] == 'Z' && r == -1) r = i;
}
cout << r - l + 1 << endl;
}

Measured memory_bytes: 640
import math
from functools import reduce
from collections import deque
import sys
sys.setrecursionlimit(10**7)
import bisect

# スペース区切りの入力を読み込んで数値リストにして返します。
def get_nums_l():
    return [ int(s) for s in input().split(" ")]

# 改行区切りの入力をn行読み込んで数値リストにして返します。
def get_nums_n(n):
    return [ int(input()) for _ in range(n)]

# 改行またはスペース区切りの入力をすべて読み込んでイテレータを返します。
def get_all_int():
    return map(int, open(0).read().split())

def log(*args):
    print("DEBUG:", *args, file=sys.stderr)

class segtree:

    def __init__(self, n,operator,identity):
        nb = bin(n)[2:]
        bc = sum([int(digit) for digit in nb])
        if bc == 1:
            self.num_end_leaves = 2**(len(nb)-1)
        else:
            self.num_end_leaves = 2**(len(nb))

        self.array = [identity for i in range(self.num_end_leaves * 2)]
        self.identity = identity
        self.operator =operator

    def update(self,x,val):
        actual_x = x+self.num_end_leaves
        self.array[actual_x] = val
        while actual_x > 0 :
            actual_x = actual_x//2
            self.array[actual_x] = self.operator(self.array[actual_x*2],self.array[actual_x*2+1])

    def get(self,q_left,q_right,arr_ind=1,leaf_left=0,depth=0):
        width_of_floor = self.num_end_leaves//(2**depth)
        leaf_right = leaf_left+width_of_floor-1

        if leaf_left > q_right or leaf_right < q_left:
            return  self.identity

        elif leaf_left >= q_left and leaf_right <= q_right:
            return self.array[arr_ind]

        else:
            val_l = self.get(q_left,q_right,2*arr_ind,leaf_left,depth+1)
            val_r = self.get(q_left,q_right,2*arr_ind+1,leaf_left+width_of_floor//2,depth+1)
            return self.operator(val_l,val_r)

n = int(input())
s = [ c for c in input()]
q = int(input())
qqq = list(map(lambda s: s.strip().split(), sys.stdin.readlines()))

seg = segtree(n+1, lambda a,b:a|b, 0)

for i,c in enumerate(s):
    o = ord(c) - ord("a")
    seg.update(i, 2**o)
# log(chars)

for que in qqq:
    if que[0] == "1":
        target = int(que[1])-1
        o = ord(que[2]) - ord("a")
        seg.update(target, 2**o)

    else:
        left = int(que[1])-1
        right = int(que[2])-1

        x = seg.get(left, right)
        log("x", x)
        count = 0
        while x > 0:
            if x % 2 == 1:
                count += 1
            x = x//2
        print(count)


Measured memory_bytes: 119396
import java.util.*;
public class Main {
    public static void main(String[] args) {
        //data input
        Scanner sc = new Scanner(System.in);

        int n = sc.nextInt();

        char[] s = sc.next().toCharArray();

        long ct = 1;

        char pref = s[0];

        for (int i = 1; i < s.length; i++) {
            if (pref != s[i]) {
                ct++;
                pref = s[i];
            }
        }

        System.out.println(ct);

    }
}

Measured memory_bytes: 27208
#include<stdio.h>
#include<math.h>

int isprime(int);

int main(){
    int n, a, i, count = 0;
    
    scanf("%d", &n);
    
    for(i = 0; i < n; i++){
    	scanf("%d", &a);
    	//printf("%d ", a);
    	count += isprime(a);
    	//printf("%d\n", isprime(a));
    }
    
    printf("%d\n",count);
    
    return 0;
}

int isprime(int a){
	int i;
	if(a == 2){
		return 1;
	}
	
	if(a % 2 == 0){
		return 0;	
	}
	
	i = 3;
	while(i <= sqrt(a)){
		if(a % i == 0){
			return 0;
		}
		i += 2;
	}
	
	return 1;
}




Measured memory_bytes: 2084
fn main() {
    let (n, max_w) = read_tuple();
    let items = read_vec2::<u64>(n as u32);
    let mut dp: Vec<Vec<u64>> = Vec::new();
    for _ in 0..n+1 {
        let v = vec![0; max_w + 1];
        dp.push(v);
    }

    let mut max_v: u64 = 0;
    for i in 0..n {
        for w in 0..max_w+1 {
            if dp[i][w as usize] == u64::max_value() {
                continue;
            }
            let value = dp[i][w];
            if w + items[i][0] as usize <= max_w {
                chmax(&mut dp[i+1][w+items[i][0] as usize], value + items[i][1]);
                chmax(&mut max_v, dp[i+1][w+items[i][0] as usize]);
            }
            chmax(&mut dp[i+1][w], value);
            chmax(&mut max_v, dp[i+1][w]);
        }
    }
    println!("{}", max_v);
}

fn chmax(a: &mut u64, b: u64) {
    if *a < b {
        *a = b;
    }
}

fn read_tuple() -> (usize, usize) {
    let v = read_vec::<usize>();
    (v[0], v[1])
}

fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().split_whitespace().map(|e| e.parse().ok().unwrap()).collect()
}

fn read_vec2<T: std::str::FromStr>(n: u32) -> Vec<Vec<T>> {
    let mut v2 = Vec::new();
    for _ in 0..n {
        let mut s = String::new();
        std::io::stdin().read_line(&mut s).ok();
        let v = s.trim().split_whitespace().map(|e| e.parse().ok().unwrap()).collect();
        v2.push(v);
    }
    v2
}


Measured memory_bytes: 106748
#include <bits/stdc++.h>
#define pb push_back

typedef long long ll;
typedef long double ld;

using namespace std;

int main(){
	int a, b;
	cin >> a >> b;
	if(max(a, b) <= 8) cout << "Yay!";
	else cout << ":(";
	return 0;
}

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

long long n, t, l[222];
int main(){
    cin >> n;
    for(int i = 0; i < 2*n; i++) cin >> l[i];
    sort(l, l+2*n);
    for(int i = 0; i < 2*n; i++){
        if(i % 2 == 0) t += l[i];
    }
    cout << t;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
    using namespace std;
    typedef long long lint;
    typedef pair<int,int> pint;
    #define rep(i, n) for(int i = 0; i < n; i++)
    #define rep2(elem, vec) for(auto elem: vec)
    #define SORT(V) sort((V).begin(),(V).end())
    #define RSORT(V) sort((V).rbegin(), (V).rend())
    lint gcd(int a,int b){return b?gcd(b,a%b):a;}
    lint lcm(int a,int b){return a*b/gcd(a,b);}
    lint comb(int a,int b){return b?comb(a-1,b-1)*a/b:1;}
int main(){
    int x;
    cin >> x;
    int y = sqrt(x)+1;
    bool f=1;
    if(x == 2){
        cout <<2;
        return 0;
    }
    x--;
    while(f){
        x++;
        int i;
        for(i=1;i<y;i++){
            if(x%(i+1) == 0){
                f=1;
                break;
                } 
            f=0;
        }
    }
    cout << x;
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
 
#define ff              first
#define ss              second
#define ll              long long
#define dd              double
#define pb              push_back
#define mp              make_pair
#define pii             pair<int,int>
#define vi              vector<int>
#define vll             vector<long long>
#define vdd             vector<double>
#define vpii            vector<pair<int,int>>
#define vpll            vector<pair<long long,long long>>
#define vvi             vector<vector<int>>
#define vvl             vector<vector<long long>>
#define mii             map<int,int>
#define mll             map<long long,long long>
#define umii            unordered_map<int,int>
#define umll            unordered_map<long long,long long>
#define pqb             priority_queue<int>
#define pqs             priority_queue<int,vi,greater<int> >
#define rep(i,n)        for(int i=0;i<n;i++)
#define rep2(i,a,b)     for(int i=a;i<b;i++)
#define rev(i,n)        for(int i=n;i>=0;i--)
#define rev2(i,a,b)     for(int i=a;i>=b;i--)
#define setbits(x)      __builtin_popcountll(x)
#define zrobits(x)      __builtin_ctzll(x)
#define inf             9e18
#define ps(x,y)         fixed<<setprecision(y)<<x
#define mk(arr,n,type)  type *arr=new type[n];
#define w(x)            int x; cin>>x; while(x--)
#define fio             ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl            '\n'
#define all(x)          x.begin(),x.end()
#define d0(x)           cout <<x<<" "
#define d1(x)           cout <<x<<endl
#define d2(x,y)         cout <<x<<" "<<y<<endl
#define d3(x,y,z)       cout <<x<<" "<<y<<" "<<z<<endl
#define d4(x,y,z,w)     cout <<x<<" "<<y<<" "<<z<<" "<<w<<endl
#define read2(x,y)      cin>>x>>y
#define read3(x,y,z)    cin>>x>>y>>z
#define read4(x,y,z,w)  cin>>x>>y>>z>>w
#define read5(x,y,z,w,a)cin>>x>>y>>z>>w>>a
#define sz(a)           (int)a.size()
const ll mod=1e9+7;
const double PI = 3.14159265359;
const ll MOD=998244353;
void i_o()
{
   #ifndef ONLINE_JUDGE
   freopen("input.txt", "r", stdin);
   freopen("output.txt", "w", stdout);
   #endif
}


int main() {
   fio
   i_o();
   ll x;
   cin>>x;
   for(ll a=-125;a<=125;a++){
      for(ll b=-125;b<=125;b++){
         if(a*a*a*a*a-b*b*b*b*b==x){
            d0(a);
            d1(b);
            return 0;
         }
      }
   }

   return 0;
}



Measured memory_bytes: 3652
#include <bits/stdc++.h>
#include<cmath>
#define N 100005
#define A 1000005
#define MOD 1000000007 // //100000000 998244353 //
#define inf 1000000000000000000
#define ll long long
//#define M_PI 3.141592653589793238463

using namespace std;

#define pii pair<ll, ll>
#define piii pair<ll, pii>
#define ft first
#define sd second
#define pb push_back
#define rep(i, n) for(ll i = 0; i < n; i++)
#define repr(i, n) for(ll i = n-1; i >= 0; i--)
#define itr(it, x) for(auto it = x.begin(); it != x.end(); it++)
#define mem(a, b) memset(a, (ll)b, sizeof(a))
#define all(v) v.begin(), v.end()
#define allr(v) v.rbegin(), v.rend()
#define edge(v, x, y) v[x].pb(y); v[y].pb(x);
#define popcount __builtin_popcount
#define ANS(s) {cout << s << "\n"; return;}

//~~~~~~fancy print~~~~~~~//
#define printpii(a) cout << a.ft << " " << a.sd << endl;
#define printpiii(a) cout << a.ft << " " << a.sd.ft << " " << a.sd.sd << endl;
#define print(a, n) rep(i, n) cout << a[i] << " "; cout << endl;
#define printv(v) for(auto x: v)cout << x << " "; cout << endl;
#define printm(a, n, m) rep(i, n) { rep(j, m) cout << a[i][j] << "\t"; cout << endl;}

ll lx[4] = {0, 0, 1, -1};
ll ly[4] = {1, -1, 0, 0};
ll dx[8] = {0, 0, 1, -1, 1, -1, 1, -1};
ll dy[8] = {1, -1, 0, 0, 1, 1, -1, -1};
void fast(){ios_base::sync_with_stdio(false);cin.tie(0);cout << setprecision(12) << fixed;}
ll lcm(ll a, ll b) {return (a*b)/__gcd(a, b); }



void solve()
{
    ll n, m;
    cin >> n >> m;
    vector<ll> v[n+1];
    rep(i, m)
    {
        ll x, y; cin >> x >> y; edge(v, x, y);
    }

    rep(i, n+1)
    {
        if(i == 1 || i == n) continue;
        ll f = 0;
        for(auto x : v[i]){
            if(x == 1) f = 1;
        }
        if(f != 1) continue;
        for(auto x : v[i]){
            if(x == n) ANS("POSSIBLE");
        }
    }
    ANS("IMPOSSIBLE");

}

int main(){
    /*#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif*/
    fast();
    ll t = 1; //cin >> t;
    while(t--){
        solve();
    }
    return 0;
}


Measured memory_bytes: 12776
#include <bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define INF 120000000

using namespace std;

typedef pair<int, int> P;
typedef long long int LL;

int main() {
    int x;
    cin >> x;
    int sum = 0, i;
    for (i = 1; sum < x; i++) sum += i;
    cout << i - 1 << endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <cmath>
#include <stdio.h>
#include <queue>
#include <deque>
#include <cstdio>
#include <set>
#include <map>
#include <bitset>
#include <stack>
#include <cctype>
using namespace std;
int main() {
	long long a, b;
	cin >> a >> b;
  long long z=0;
	a = max(z, a - 1);
	long long ans, ans1;
	if (a % 4 == 0) {
		ans = a;
	}
	if (a % 4 == 1) {
		ans = 1;
	}
	if (a % 4 == 2) {
		ans = a + 1;
	}
	if (a % 4 == 3) {
		ans = 0;
	}
	if (b % 4 == 0) {
		ans1 = b;
	}
	if (b % 4 == 1) {
		ans1 = 1;
	}
	if (b % 4 == 2) {
		ans1 = b + 1;
	}
	if (b % 4 == 3) {
		ans1 = 0;
	}
	ans = ans ^ ans1;
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 3628
import std.stdio;
import std.string;
import std.conv;
import std.typecons;
import std.algorithm;
import std.functional;
import std.bigint;
import std.numeric;
import std.array;
import std.math;
import std.range;
import std.container;
import std.ascii;

void main()
{
	auto n = readln.chomp.to!int;
	auto s = readln.chomp;
	ulong c;

	foreach(i; 1..n)
	{
		auto x = s.dup.to!(dchar[]);
		auto a = x[0..i].sort().uniq.array;
		auto b = x[i..$].sort().uniq.array;
		auto d = setIntersection(a, b).array.length;
		c = max(c, d);
	}

	writeln(c);
}


//writeln("滲み出す混濁の紋章　不遜なる狂気の器　湧き上がり　否定し　痺れ　瞬き　眠りを妨げる　爬行する鉄の王女　絶えず自壊する泥の人形　結合せよ　反発せよ　地に満ち己の無力を知れ　破道の九十　黒棺")

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

using namespace std;

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

using ll = long long;
using ld = long double;

const ll INF = 1e18;
const int Inf = 1e9;
const double EPS = 1e-9;
const ll MOD = 1e9 + 7;

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(0);
	int n;
	cin >> n;
	vector<int> l(n);
	rep (i, n) cin >> l[i];
	sort(l.begin(), l.end());
	int res = 0;
	rep (i, n) {
	  FOR (j, i + 1, n) {
		if (l[i] == l[j]) continue;
		FOR (k, j + 1, n) {
		  if (l[i] == l[k] || l[j] == l[k]) continue;
		  if (l[i] < l[j] + l[j] && l[j] < l[i] + l[k] && l[k] < l[i] + l[j]) res++;
		}
	  }
	}
	cout << res << endl;
    
    return 0;
}



Measured memory_bytes: 3620
#include<stdio.h>
int main()
{
  int month,date,ans;
  while(1)
    {
      scanf("%d%d",&month,&date);
      if((month==0)&&(date==0)) break;
      ans=date;
      switch(month)
	{
	case 12:
	  ans+=30;
	case 11:
	  ans+=31;
	case 10:
	  ans+=30;
	case 9:
	  ans+=31;
	case 8:
	  ans+=31;
	case 7:
	  ans+=30;
	case 6:
	  ans+=31;
	case 5:
	  ans+=30;
	case 4:
	  ans+=31;
	case 3:
	  ans+=29;
	case 2:
	  ans+=31;
	}
      ans%=7;
      switch(ans)
	{
	case 0:
	  printf("Wednesday\n");
	  break;
	case 1:
	  printf("Thursday\n");
	  break;
	case 2:
	  printf("Friday\n");
	  break;
	case 3:
	  printf("Saturday\n");
	  break;
	case 4:
	  printf("Sunday\n");
	  break;
	case 5:
	  printf("Monday\n");
	  break;
	case 6:
	  printf("Tuesday\n");
	  break;
	}	  	  	  	  
    }
  return 0;
}

Measured memory_bytes: 2560
#include<iostream>
#include<vector>
using namespace std;
int main(){
    int n;
    cin >> n;
    vector<int> p(n);
    int cnt = 0;
    for(int i=0;i<n;i++) cin >> p.at(i);
    for(int i=1;i<n-1;i++){
        if(max(p.at(i-1),max(p.at(i),p.at(i+1)))>p.at(i)&&min(p.at(i-1),min(p.at(i),p.at(i+1)))<p.at(i)) cnt++;
    }
    cout << cnt << endl;
    return 0;
}

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

typedef long long int ll;
typedef long double ld;

//****************************************************                
#define lp(var,start,end) for (ll var = start; var <end ; ++var)
#define rlp(var,start,end) for(ll var = start; var>=end ; var--)
#define pb push_back
#define mp make_pair
#define pf push_front
#define ff first
#define ss second
#define vll vector<ll>
#define pll pair<ll,ll> 
#define vpll vector<pll>
#define all(X) X.begin(),X.end()
#define endl "\n" //comment it for interactive questions
#define trace1(a) cerr << #a << ": " << a << endl;
#define trace2(a,b) cerr << #a << ": " << a << " " << #b << ": " << b << endl;
#define trace3(a,b,c) cerr << #a << ": " << a << " " << #b << ": " << b << " " << #c << ": " << c << endl;
#define trace4(a,b,c,d) cerr << #a << ": " << a << " " << #b << ": " << b << " " << #c << ": " << c << #d << ": " << d << endl;
#define OC   
#define FAST_IO ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
        //*******************************************************
//Some Functions

const ll MOD = (ll)1e9+7; //change it for other mods

ll powmod(ll a,ll b)
{
   ll res = 1;
   while(b > 0) {
      if(b & 1) res = (res * a) % MOD;
      a = (a*a)%MOD;
      b = b >> 1; 
  }
  return res % MOD;
}

void solve(ll testnum)
{
    ll a,b,c,k;
    cin >> a >> b >> c >> k;
    ll sum = 0;
    sum += min(a, k);
    k -= sum;
    if(k > 0) {
    	k -= min(b, k);
    }
    if(k > 0) {
    	sum -= min(c, k);
    }
    cout << sum << "\n";
}

int main()
{
    FAST_IO;
    #ifdef STIO 
      freopen("input.txt" , "r", stdin);
      freopen("output.txt" , "w", stdout);
    #endif
    ll t = 1;
    // cin >> t;
    for (ll i = 1; i <= t; i++) {
        solve(i);
    }
}

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

using namespace std;

typedef pair<int, int> Pi;
typedef pair<int, Pi> Pii;

struct edge {
  int to, cost;
  edge(){}
  edge(int to, int cost):to(to), cost(cost){}
};

const int inf = 1 << 30;

vector< vector<edge> > G(111);
int minCost[111][111];
bool F[111];

int N, M, L, K, A, H;

int dijkstra()
{
  fill(minCost[0], minCost[111], inf);
  priority_queue<Pii, vector<Pii>, greater<Pii> > que;
  que.push(Pii(0, Pi(A, M)));
  minCost[A][M] = 0;
  while(!que.empty()){
    Pii p = que.top(); que.pop();
    int t = p.first, now = p.second.first, m = p.second.second;
    if(now == H) return t;
    if(t > minCost[now][m]) continue;
    if(F[now]){
      for(int i = 1; i <= M-m; i++){
	if(t + i < minCost[now][m + i]){
	  que.push(Pii(t + i, Pi(now, m + i)));
	  minCost[now][m + i] = t + i;
	}
      }
    }
    for(int i = 0; i < G[now].size(); i++){
      edge e = G[now][i];
      if(e.cost <= m && e.cost + t < minCost[e.to][m - e.cost]){
	que.push(Pii(e.cost + t, Pi(e.to, m - e.cost)));
	minCost[e.to][m - e.cost] = e.cost + t;
      }
    }
  }
  return -1;
}

int main()
{
  while(cin >> N >> M >> L >> K >> A >> H, N || M || L || K || A || H){
    G.resize(N + 1);
    fill(F, F + 111, false);
    F[A] = F[H] = true;
    for(int i = 0; i < L; i++){
      int O;
      cin >> O;
      F[O] = true;
    }
    for(int i = 0; i < K; i++){
      int X, Y, T;
      cin >> X >> Y >> T;
      G[X].push_back(edge(Y, T));
      G[Y].push_back(edge(X, T));
    }
    int ans = dijkstra();
    if(ans == -1) cout << "Help!" << endl;
    else cout << ans << endl;
    for(int i = 0; i < G.size(); i++) G[i].clear();
  }
  return 0;
}

Measured memory_bytes: 1484