akhauriyash/Code-Regression huggingface dataset:
#include "iostream"
#include "climits"
#include "list"
#include "queue"
#include "stack"
#include "set"
#include "functional"
#include "algorithm"
#include "string"
#include "map"
#include "unordered_map"
#include "unordered_set"
#include "iomanip"
#include "cmath"
#include "random"
#include "bitset"
#include "cstdio"
#include "numeric"
#include "cassert"
#include "functional"

using namespace std;

//constexpr long long int MOD = 1000000007;
constexpr  int MOD = 1000000007;
//constexpr  int MOD = 998244353;
//constexpr  long long int MOD = 998244353;
constexpr double EPS = 1e-8;

// int N, M, K, H, W, L, R;
long long int N, M, K, H, W, L, R;

struct Node {
	int x, y, score;
	Node(const int a, const int b, const int c) {
		y = a, x = b, score = c;
	}
	bool operator<(const Node&n)const {
		return score < n.score;
	}
};

class UnionFind {
	vector<int>parent;
	vector<int>rank;
public:
	vector<int>index;

	UnionFind(int num) {
		num++;
		parent.resize(num);
		rank.resize(num);
		index.resize(num);
		for (int i = 0; i < num; i++) {
			parent[i] = i;
			rank[i] = 0;
			index[i] = i;
		}
	}
	int Find(int node) {
		if (parent[node] == node)return node;
		else return parent[node] = Find(parent[node]);
	}
	void Unite(int u, int v) {
		u = Find(u);
		v = Find(v);
		if (u == v)return;
		if (rank[u] < rank[v]) {
			parent[u] = v;
			index[u] = index[v] = min(index[u], index[v]);
		}
		else {
			parent[v] = u;
			index[u] = index[v] = min(index[u], index[v]);
			if (rank[u] == rank[v])rank[u]++;
		}
	}
	bool Check_Same(int u, int v) {
		return Find(u) == Find(v);
	}
};

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

	cin >> N >> H >> W;
	vector<Node>node;
	for (int i = 0; i < N; i++) {
		cin >> L >> R >> K;
		node.push_back(Node(L - 1, R - 1, K));
	}
	sort(node.begin(), node.end());
	reverse(node.begin(), node.end());
	UnionFind uf(H + W);
	vector<int>amari(H + W, 1);
	for (auto i : node) {
		if (uf.Check_Same(i.y, i.x + H)) {
			if (amari[uf.index[uf.Find(i.y)]]) {
				M += i.score;
				amari[uf.index[uf.Find(i.y)]]--;
			}
		}
		else if (amari[uf.index[uf.Find(i.y)]] + amari[uf.index[uf.Find(i.x+H)]] >= 1) {
			M += i.score;
			amari[uf.index[uf.Find(i.y)]] = amari[uf.index[uf.Find(i.x+H)]] = amari[uf.index[uf.Find(i.y)]] + amari[uf.index[uf.Find(i.x+H)]] - 1;
			uf.Unite(i.y, i.x + H);
		}
	}
	cout << M << endl;
}


Measured memory_bytes: 4724
N = int(input())
A = [2, 4 , 5, 7, 9]
B = [0, 1, 6, 8]
C = [3]

if N%10 in A:
  print("hon")
if N%10 in B:
  print("pon")
if N%10 in C:
  print("bon")
  


Measured memory_bytes: 61804
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using pii = pair<int, int>;



int main() {
    ios_base::sync_with_stdio(false);
    ll q, h, s, d;
    ll n;
    cin >> q >> h >> s >> d;
    cin >> n;
    h = min(h, 2 * q);
    s = min(s, 2 * h);
    d = min(d, 2 * s);
    ll ans = (n / 2) * d;
    n %= 2;
    if(n == 1){
        ans += s;
    }
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {

		Scanner scanner = new Scanner(System.in);
		List<Integer> tree = new ArrayList<>();

		int N = scanner.nextInt();
		int K = scanner.nextInt();

		for(int i = 0; i < N; i++) {
			tree.add(Integer.valueOf(scanner.nextInt()));
		}

		Collections.sort(tree);
		int size = tree.size();
		int min = 1000000000;

		for(int i = K-1; i < size; i++) {
			int diff = tree.get(i)-tree.get(i-(K-1));
			if(diff < min) {
				min = diff;
			}
		}

		System.out.println(min);
	}

}


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

int main() {
  int N;
  cin >> N;
  
  int a = 0;
  bool t = false;
  for (int i = 0; i < 9; i++) {
    for (int j = 0; j < 9; j++) {
      if (N == (i + 1) * (j + 1)) {
        cout << "Yes" << endl;
        a++;
        t = true;
        break;
      }
    }
    if (t)
      break;
  }
  
  if (a == 0)
    cout << "No" << endl;
}


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

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

#define FOR(k,m,n) for(ll (k)=(m);(k)<(n);(k)++)
#define REP(i,n) FOR((i),0,(n))
#define WAITING(str) int str;std::cin>>str;
#define DEBUGING(str) cout<< #str << " " str<<endl

constexpr int INF = (1 << 30);
constexpr ll INFL = (1ll << 60);
constexpr ll MOD = 1000000007;// 10^9+7
constexpr ll SIZE = 1000000000;

ll H, W, N;
set<ll> candi, obj;

ll trans(ll y, ll x) {
	return y * SIZE + x;
}

pair<ll, ll> rev(ll pos) {
	return { pos / SIZE,pos%SIZE };
}

bool isin(pair<ll, ll> p) {
	return 0 <= p.first && p.first < H-2 && 0 <= p.second && p.second < W-2;
}

int main()
{
	cin >> H >> W >> N;
	REP(i, N) {
		ll a, b;
		cin >> a >> b;
		a--; b--;

		obj.insert(trans(a, b));
		REP(dy, 3)REP(dx, 3) if (isin({ a - dy,b - dx })) {
			candi.insert(trans(a - dy, b - dx));
		}
	}

	vector<ll> cnts(10);
	for (auto pos : candi) {
		int cnt = 0;
		REP(dx, 3)REP(dy, 3) {
			ll tmp = pos + dx * SIZE + dy;
			if (obj.find(tmp) != obj.end())cnt++;
		}
		cnts[cnt]++;
	}
	cnts[0] = (H - 2)*(W - 2) - accumulate(cnts.begin(), cnts.end(), 0);
	for (auto cnt : cnts) {
		cout << cnt << endl;
	}

	return 0;
}


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

int main() {
  string s;
  cin >> s;
  
  s[3]='8';
  
  cout << s << endl;
  return 0;
}


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

#define debug(x) cout <<"DEBUG"<<" "<< #x << ":" << x << '\n'
#define rep(i,n) for(int_fast32_t i = 0; i < ((int_fast32_t)(n)); i++)   // 0-indexed up
#define rep1(i,n) for(int_fast32_t i = 1; i <= ((int_fast32_t)(n)); i++) // 1-indexed up
#define rrep(i,n) for(int_fast32_t i = ((int_fast32_t)(n)-1); i >= 0; i--)  // 0-indexed down
#define rrep1(i,n) for(int_fast32_t i = ((int_fast32_t)(n)); i >= 1; i--)   // 1-indexed down
#define all(x) (x).begin(),(x).end()

using namespace std;

template<typename T>
using vec = vector<T>;
using i32 = int_fast32_t;
using i64 = int_fast64_t;
using u32 = uint_fast32_t;
using u64 = uint_fast64_t;
using ll = long long;
using ld = long double;
using vi = vec<int_fast32_t>;
using vl = vec<int_fast64_t>;
using vld = vec<ld>;
using vii = vec<vi>;
using PII = pair<int_fast32_t, int_fast32_t>;

template<class T>
using maxheap = std::priority_queue<T>;
template<class T>
using minheap = std::priority_queue<T, std::vector<T>, std::greater<T>>;

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

const ld Pi = std::acos(-1.0L);
constexpr ll infll = (1LL<<62)-1;
constexpr int inf = (1<<30)-1;
const int mod = 1000000007;
// const int mod = 998244353;


/*FUNCs=================================================*/


/*MAIN==================================================*/
signed main(){
    int START_TIME = clock();
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
//    cout << fixed << setprecision(15);

    i32 r,g,b,n; cin >> r >> g >> b >> n;

    vec<i32> R;
    for(i32 i = 0; i <= n; i += r) {
        R.push_back(i);
    }

    vec<i32> GB;
    for(i32 i = 0; i <= n; i += g) {
        for(i32 j = 0; j <= n; j += b) {
            GB.push_back(i+j);
        }
    }
    sort(all(GB));

    i64 ans = 0;
    for(auto red : R) {
        i32 thr = n-red;
        if(thr == *lower_bound(all(GB), thr)) {
            ans += upper_bound(all(GB), thr) - lower_bound(all(GB), thr);
        }
    }

    cout << ans << '\n';

    // printf("ExecutionTime: %d /ms\n",1000*(int)((clock()-START_TIME)/CLOCKS_PER_SEC));
}


Measured memory_bytes: 131712
#include<stdio.h>
int comp(int,int);
void downheap(int,int);
void swap(int,int);
int n,l;
char c[100][101];

int main(void){
    int i;
    scanf("%d%d",&n,&l);
    for(i = 0;i < n;i++){
        scanf("%s",c[i]);
    }
    for(i = (n - 2) / 2;i >= 0;i--){
        downheap(i,n - 1);
    }
    for(i = n - 1;i > 0;i--){
        swap(0,i);
        downheap(0,i - 1);
    }
    for(i = 0;i < n;i++){
        printf("%s",c[i]);
    }
    printf("\n");
    return 0;
}

int comp(int i,int j){
    int k = 0;
    while(1){
        if(c[i][k] > c[j][k]){
            return 1;
        }
        if(c[i][k] < c[j][k]){
            return 0;
        }
        if(k == l){
            return 0;
        }
        k++;
    }
}

void downheap(int i,int j){
    int p = i,q;
    while(1){
        q = 2 * p + 1;
        if(q > j){
            break;
        }
        if(q != j){
            if(comp(q + 1,q) == 1){
                q++;
            }
        }
        if(comp(p,q) == 1){
            break;
        }else{
            swap(p,q);
        }
        p = q;
    }
}

void swap(int i,int j){
    char p;
    int q;
    for(q = 0;q < l;q++){
        p = c[i][q]; c[i][q] = c[j][q]; c[j][q] = p;
    }
    return;
}


Measured memory_bytes: 128
#include <iostream>
#include <vector>
#include <set>
#include <string>
#include <algorithm>
typedef long long ll;
using namespace std;

int main(void)
{
	string s;
	cin >> s;
	reverse(s.begin(), s.end());
	int pos = 0;
	int i;
	bool flag = false;
	bool find = false;

	vector<string> seachstrs = { "dream", "dreamer", "erase", "eraser" };
	for (int i = 0; i < 4; i++) reverse(seachstrs[i].begin(), seachstrs[i].end());

	while (1)
	{
		for (i = 0; i < 4; i++)
		{
			if (s.substr(pos, seachstrs[i].size()) == seachstrs[i])
			{
				pos += seachstrs[i].size();
				find = true;
			}
		}

		if (!find)
		{
			flag = false;
			break;
		}

		if (pos >= s.size())
		{
			flag = true;
			break;
		}

		find = false;
	}

	if (flag) cout << "YES" << endl;
	else cout << "NO" << endl;
}

Measured memory_bytes: 512
#include <cstdio>
#include <string>
#include <iostream>
#include <sstream>
#include <stdio.h>
#include <string.h>
#include <algorithm>
#include <stdlib.h>
#include <vector>
#include <map>
#include <math.h>
using namespace std;

int main() {
    int a, b, c;
    scanf("%d%d%d", &a, &b, &c);
    if (a ==b && b==c) printf("1\n");
    else if (a==b) printf("2\n");
    else if (b==c) printf("2\n");
    else if (c==a) printf("2\n");
    else printf("3\n");
}

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

void f(int &d,int p,int a){
  if(p<0)return;
  if(d<0||d>p+a)d=p+a;
}

signed main(){
  int N,M;cin>>N>>M;
  int T=1<<N;
  std::vector<int> dp(T,-1);
  dp[0]=0;
  while(M--){
    int a,b,key=0,S=T;cin>>a>>b;
    while(b--){
      int c;cin>>c;c--;
      key|=1<<c;
    }
    while(S--)f(dp[S|key],dp[S],a);
  }
  cout<<dp[T-1]<<endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;

int main() {
  cin.tie(0);
  ios_base::sync_with_stdio(false);
  cout << fixed << setprecision(2);
  
  int n, m;
  while (cin >> n >> m, n) {
    double g[110][110];
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < n; j++) {
        cin >> g[i][j];
      }
    }
    double dp[110][110] = {};
    fill_n((double*)dp, 110, 1);
    for (int i = 0; i < m - 1; i++) {
      for (int j = 0; j < n; j++) {
        for (int k = 0; k < n; k++) {
          dp[i + 1][j] = max(dp[i + 1][j], dp[i][k] * g[k][j]);
        }
      }
    }
    double ans = 0;
    for (int i = 0; i < n; i++) {
      ans = max(ans, dp[m - 1][i]);
    }
    cout << ans << endl;
  }

  return 0;
}


Measured memory_bytes: 3496
#include <iostream>
#include <iomanip>
#include <string>
#include <algorithm>
#include <vector>
#define rep(i, N) for(int i = 0; i < N; ++i)
#define MOD 1000000007ULL

typedef long long ll;
using namespace std;

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

    ll ans = 0;
    for (ll i = k; i <= n+1; i++)
    {
        ll min = i * (i - 1) / 2;
        ll max = i * n - min;
        // cout << min << ":" << max << endl;
        ans += (max - min + 1) % MOD;
    }
    cout << ans % MOD << endl;
    return 0;
}


Measured memory_bytes: 3624
// Kyoto University Programming Contest 2016
// D - 長い黒板 / Long Blackboard

#include <cstdio>
#include <deque>
#include <string>
#define R 2
using namespace std;


int N;
deque<char> d[2];

int main() {

  char c;
  char buff[256];
  bool dir, updated;

  scanf("%d", &N);
  dir = true;
  for (int n = 0; n < N; n++) {
    updated = false;
    for (int b = 0; b < (1 << R); b++) {
      for (int j = 0; j < R; j++) {
        c = (b & (1 << j)) > 0 ? '#' : '.';
        if (dir) {
          d[j].push_back(c);
        } else {
          d[j].push_front(c);
        }
        printf("%s\n", string(d[j].begin(), d[j].end()).c_str());
      }
      fflush(stdout);
      scanf("%s", buff);
      if (buff[0] == 'T') {
        updated = true;
        break;
      } else if (buff[0] != 'F') {
        return 0;
      }
      for (int j = 0; j < R; j++) {
        if (dir) {
          d[j].pop_back();
        } else {
          d[j].pop_front();
        }
      }
    }
    if (!updated) {
      dir = !dir;
      n--;
    }
  }

  return 0;

}




Measured memory_bytes: 596
n = input()
num = [i for i in map(int,input().split(" "))]

num.sort(reverse=True)

A = 0
B = 0
t=0
for i in num:
    if t%2==0:
        A+=int(i)
    else:
        B+=int(i)
    t+=1
print(A-B)


Measured memory_bytes: 3060
def main():
    s  = input()
    q  = int(input())
    inv = 1
    sfb = [0,"",""]
    for i in range(q):
        ls = list(input().split())
        if ls[0] == "1":
            inv *=-1
        else:
            f,c = ls[1:]
            if f == "1":
                sfb[inv] +=c
            else:
                sfb[-inv] +=c

    ans = sfb[1][::-1] + s + sfb[-1]
    print(ans[::inv])
if __name__ == "__main__":
    main()


Measured memory_bytes: 4636
#include <bits/stdc++.h>
using namespace std;
#define gc getchar_unlocked
#define fo(i,n) for(i=0;i<n;i++)
#define Fo(i,k,n) for(i=k;i<n;i++)
#define ll long long
#define pii pair < int , int >
#define vi vector < int >
#define pb push_back
#define F first
#define S second
#define clr(x) memset(x, 0, sizeof(x))
#define init(x, a) memset(x, a, sizeof(x))
#define vll vector < long long int >
#define sll set < long long int >
#define fastIO ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
using namespace std;
int main()
{
	fastIO;
	ll t,n,i,j,k;
	string s;
	cin>>s>>n;
	k = s.length();
	for(i=0;i<k;)
	{
		cout<<s[i];
		i+=n;
	}
	return(0);
}

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

#define fastio 			ios::sync_with_stdio(0);	cin.tie(0); cout.tie(0);  cout<<fixed;  cout<<setprecision(12);
#define randomINT 		mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());
#define	newl 			cout<<"\n"
#define DISP(as)		for(auto it : as) cout<<it<<" ";newl;
#define all(x)         	(x).begin(),(x).end()
#define mset(x,val)    	memset(x,val,sizeof(x))
#define newl           	cout<<"\n"
#define pb             	push_back
#define mp             	make_pair
#define f 				first
#define s 				second
#define dline          cerr<<"///REACHED///\n";
#define deb1(x)        cerr<<#x<<" = "<<x<<'\n';
#define deb2(x,y)      cerr<<'['<<#x<<','<<#y<<"] = "<<'['<<x<<','<<y<<']'<<'\n';
#define deb3(x,y,z)    cerr<<'['<<#x<<','<<#y<<','<<#z<<"] = "<<'['<<x<<','<<y<<','<<z<<']'<<'\n';
#define N 1000000007 // prime modulo value 

typedef long long 				ll;
typedef long double 			ld;
typedef vector<ll> 				vll;
typedef pair<ll , ll> 			pll;
typedef pair<ld, ld> 			pld;
typedef unordered_map<ll, ll> 	um;
typedef vector<pll> 			vpll;

const ll 	MAX5 	= 	1e+5 + 7;
const ll 	MAX7 	= 	1e+7 + 7;
const ll 	MAXN 	= 	5e5;
const ll   	INF   	=  	0x7f7f7f7f7f7f7f7f;
const int  	INFi 	=  	0x7f7f7f7f;
const ll 	MOD		=  	1e+9 + 7;

vll adj[MAXN]; ll vis[MAXN] = {};
/*
int dx8[]={0,1,1,1,0,-1,-1,-1}, dy8[]={1,1,0,-1,-1,-1,0,1};
int dx4[]={0,1,0,-1}, dy4[]={1,0,-1,0};
*/
// <------------- Declare Variables Here ------------> //



ll T = 1;
ll n, x, k, m, r, sum = 0, a, b, l;
string s;

// <------------- Implement Functions Here ----------> //


// <------------- Start of main() -------------------> //

void MAIN() {
	cin >> l >> r >> a;
	ll cou = 0;
	for(ll i=l;i<=r;i++) {
		if(i%a==0) cou++;
	}
	cout<<cou;
}

int main() {
	fastio; randomINT;
	//cin >> T;
	while (T--) {
		MAIN();
	}
	return 0;
}


Measured memory_bytes: 15356
#include <iostream>
using namespace std;
int main(void)
{
    int a,b;
    cin >> a >>b;

    if ((a%2)==0&&(b%2)==0){
        cout << "Even" <<endl;

    }else if ((a==1)&&(b%2==1)||((b==1)&&(a%2==1))){
        cout << "Odd" <<endl;
    }else if ((a%2==0)&&(b%2==1) ||(a%2==1)&&(b%2==0)){ 
        cout << "Even" <<endl;
    }else {
        cout <<"Odd"<<endl;
    }
}

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

using namespace std;

int main() {
    list<int> L;
    auto it = L.end();
    int q;
    cin >> q;
    while (q--) {
        int code;
        cin >> code;
        switch (code) {
            case 0: {
                int x;
                cin >> x;
                it = L.insert(it, x);
            } break;
            case 1: {
                int d;
                cin >> d;
                advance(it, d);
            } break;
            case 2: {
                it = L.erase(it);
            } break;
            default : break;
        }
    }
    for (auto i : L) cout << i << endl;
    return 0;
}


Measured memory_bytes: 18632
#include <stdio.h>

int main(void) {
	int a, b, c;
	scanf("%d%d%d", &a, &b, &c);
	if (b / a < c) {
		printf("%d\n",b/a);
	}
	else {
		printf("%d\n", c);
	}
	return 0;
}

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

int main(){
    string s;
    cin >> s;
    int n0=0,n1=0,n = s.size();
    rep(i,n){
        if(s[i] == '0') n0++;
        else n1++;
    }
    int ans = n - abs(n0-n1);
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3736
import os,io
input=io.BytesIO(os.read(0,os.fstat(0).st_size)).readline
# Python3 code to find number of  
# distinct numbers in a subarray 
MAX = 500001
  
# structure to store queries 
class Query: 
    def __init__(self, l, r, idx): 
        self.l = l 
        self.r = r 
        self.idx = idx 
  
# updating the bit array 
def update(idx, val, bit, n): 
    while idx <= n: 
        bit[idx] += val 
        idx += idx & -idx 
  
# querying the bit array 
def query(idx, bit, n): 
    summ = 0
    while idx: 
        summ += bit[idx] 
        idx -= idx & -idx 
    return summ 
  
def answeringQueries(arr, n, queries, q): 
  
    # initialising bit array 
    bit = [0] * (n + 1) 
  
    # holds the rightmost index of  
    # any number as numbers of a[i] 
    # are less than or equal to 10^6 
    last_visit = [-1] * MAX
  
    # answer for each query 
    ans = [0] * q 
  
    query_counter = 0
    for i in range(n): 
  
        # If last visit is not -1 update -1 at the 
        # idx equal to last_visit[arr[i]] 
        if last_visit[arr[i]] != -1: 
            update(last_visit[arr[i]] + 1, -1, bit, n) 
  
        # Setting last_visit[arr[i]] as i and  
        # updating the bit array accordingly 
        last_visit[arr[i]] = i 
        update(i + 1, 1, bit, n) 
  
        # If i is equal to r of any query store answer 
        # for that query in ans[] 
        while query_counter < q and queries[query_counter].r == i: 
            ans[queries[query_counter].idx] = query(queries[query_counter].r + 1, bit, n) - query(queries[query_counter].l, bit, n) 
            query_counter += 1
  
    # print answer for each query 
    for i in range(q): 
        print(ans[i]) 
  
# Driver Code 
n,q=map(int,input().split())
a=list(map(int,input().split()))
queries=[]
for i in range(q):
  c,d=map(int,input().split())

  queries.append(Query(c-1,d-1,i))
queries.sort(key = lambda x: x.r) 
answeringQueries(a, n, queries, q) 

Measured memory_bytes: 189616
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
const ll MOD = 1000000007;
const ld PI = acos(-1);  
const ld EPS = 0.0000000001;
#define REP(i, n) for(ll i=0; i<(ll)(n); i++)
#define REPD(i, n) for(ll i=n-1; 0<=i; i--)
#define FOR(i, a, b) for(ll i=a; i<(ll)(b); i++)
#define FORD(i, a, b) for(ll i=a; (ll)(b)<=i; i--)
#define ALL(x) x.begin(), x.end()
#define MAX(x) *max_element(ALL(x))
#define MIN(x) *min_element(ALL(x))


int main(){
    ll a, b;    cin >> a >> b;
    queue<ll> que;
    if(a&1){
        que.push(a);
        a = min(a+1, b);
    }
    if(b%2==0){
        que.push(b);
        b = max(b-1, a);
    }
    ll ans = ((b-a+1)/2)%2;
    
    while(!que.empty()){
        //cout << que.front() << endl;
        ans = ans^que.front();
        que.pop();
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include<iostream>

using namespace std;

int main() {
	int H, W;

	while (true) {
		cin >> H >> W;

		if (H + W == 0)break;

		for (int i = 0; i < H; i++) {
			for (int j = 0; j < W; j++) {
				cout << (((i + j) % 2 == 0) ? "#" : ".");
			}
			cout << endl;
		}
		cout << endl;
	}

	return 0;
}

Measured memory_bytes: 1152
N=int(input())
A=list(map(int, input().split()))
Q=int(input())
B=[list(map(int, input().split())) for _ in range(Q)]
D={}
ma=0
for i in A:
  ma+=i
  if i not in D:
    D[i]=1
  else:
    D[i]+=1
    
for b,c in B:
  if b in D:
    f=D[b]
    if c in D:
      t=D[c]
    else:
      t=0
    
    D[c]=f+t
    D[b]=0
    ma+=(c-b)*f
  print(ma)

Measured memory_bytes: 36060
import java.util.Scanner;
 
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int H, W;
        while (true) {
            H = sc.nextInt();
            W = sc.nextInt();
            int i, k ;
            for (i = 0; i < H; i++) {
            for (k = 0; k < W; k++) {
                System.out.print("#");}
                System.out.println("");
            }
            if(H == 0 && W == 0) 
                break;
            System.out.println("");}
            }
        }



Measured memory_bytes: 33736
#include <bits/stdc++.h>
using namespace std;
#define fast ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define test int t;cin>>t;while(t--)
#define REP(i,n) for (int i = 1; i <= n; i++)
#define MOD 1000000007
#define ll long long
#define ld long double
#define int ll
#define pb push_back
#define ii pair<int,int>
#define llll pair<ll,ll>
#define vi vector<int>
#define vl vector<ll>
#define vii vector<ii>
#define vllll vector<llll>
#define ff first
#define ss second
#define INF 1000000000
#define HINF 1000000000000000
#define mem(a,b) memset(a,b,sizeof(a))
#define arrin(x,n) int x[n]; for(int o=0;o<n;o++) cin>>x[o]
#define arrout(x,n) for(int o=0;o<n;o++) cout<<x[o]<<" "; cout<<endl
#define all(x) x.begin(),x.end()
#define deb(x) cout<<#x<<'='<<x<<endl
#define deb2(x,y) cout<<#x<<'='<<x<<" "<<#y<<'='<<y<<endl
#define deb3(x,y,z) cout<<#x<<'='<<x<<" "<<#y<<'='<<y<<" "<<#z<<'='<<z<<endl
#define debarr(arr,n) for(int o=0;o<n;o++) deb2(o,arr[o])
#define IO freopen("input.txt", "r", stdin); freopen("output.txt", "w+", stdout)
const double pi = 3.14159265358979323846;

ll power(ll a, ll b){//a^b
    ll res=1;
    //a=a%MOD;
    while(b>0){
        if(b&1)
		{res=(res*a);
		//res%=MOD;
		b--;}
        a=(a*a);
        //a%=MOD;
        b>>=1;
    }
    return res;
}
ll fermat_inv(ll y){return power(y,MOD-2);}
ll gcd(ll a, ll b){return (b==0)?a:gcd(b,a%b);}
int C(int n,int k)
{
	int ans=1;
	if(k>n-k)
	k=n-k;
	for(int i=1;i<=k;i++)
	ans*=(n-i+1),ans/=i;
	return ans;
}

void solve()
{

	int i=0,j=0,k=0,m,n,p,sum=0,cnt=0;
	float d,t,s;
	cin>>d>>t>>s;
	((d/s)>t)?cout<<"No":cout<<"Yes";
	
	
	
	
}
int32_t main() {
    fast
    //IO;
	//cout<<fixed<<setprecision(6);
    //test
    {
        
        solve();
		
		      
    }
    return 0;
}
  

Measured memory_bytes: 3736
#include <bits/stdc++.h>
using namespace std;
#define IOS ios::sync_with_stdio(false); cin.tie(0);
#define FOR(i,s,n) for(int i = (s); i < (n); i++)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) for(int i = (n); i >= 0; i--)
#define ALL(n) (n).begin(), (n).end()
#define RALL(n) (n).rbegin(), (n).rend()
#define ATYN(n) cout << ( (n) ? "Yes":"No") << '\n';
#define CFYN(n) cout << ( (n) ? "YES":"NO") << '\n';
#define OUT(n) cout << (n) << '\n';
using ll = long long;
using ull = unsigned long long;
using pii = pair<int,int>;
using pll = pair<ll,ll>;

int main(void)
{
    IOS
    int A, B;
    cin >> A >> B;
    if (B % A == 0) OUT(A+B)
    else OUT(B-A)

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define F first
#define S second
int mod;
const int A = 1e5 + 2;

int add(int x, int y) {
    return ((x + y) % mod + mod) % mod;
}
int mul(int x, int y) {
    return (1LL * x * y) % mod;
}
int fp(int x, int y) {
	if (!y) return 1;
	ll acc = fp(x, y / 2);
	acc = mul(acc, acc);
	if (y & 1) acc = mul(acc, x);
	return acc;
}
int main() {
    ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
    int n;
    cin >> n >> mod;
    int a[n];
    for (int i = 0; i < n; i++) {
        char x;
        cin >> x;
        a[i] = x - '0';
    }
    ll ans = 0;
    if (mod == 2 || mod == 5) {
        int acc = 0;
        for (int i = n - 1; i >= 0; i--) {
            if (a[i] % mod == 0)
                acc++;
            ans += acc;
        }
        cout << ans;
        return 0;
    }
    int suf[n + 1], acc[10001] = {};
    suf[n] = 0, acc[0] = 1;
    for (int i = n - 1; i >= 0; i--) {
        suf[i] = add(suf[i + 1], mul(a[i], fp(10, n - i - 1)));
        ans += acc[suf[i]]++;
    }
    cout << ans;
    return 0;
}


Measured memory_bytes: 5256
#include <iostream>
#include <algorithm>
#include <string>
using namespace std;
typedef long long ll;


ll fac[100005],inv[100005],finv[100005];
const ll mod=1e9+7;


void cominit(int n){
  int i;
  fac[0]=fac[1]=1;
  finv[0]=finv[1]=1;
  inv[1]=1;
  for (i=2;i<n+2;i++){
    fac[i]=fac[i-1]*i%mod;
    inv[i]=mod-inv[mod%i]*(mod/i)%mod;
    finv[i]=finv[i-1]*inv[i]%mod;
  }
  
}


int main(void){
  int n,k,i;
  ll a[100005],ans=0;
  
  cin >> n >> k;
  for (i=0;i<n;i++) cin >> a[i];
  
  cominit(n);
  
  sort(a,a+n);
  
  for (i=k-1;i<n;i++){
    ans+=fac[i]*finv[k-1]%mod*finv[i-k+1]%mod*a[i]%mod;
    ans%=mod;
  }
  
  for (i=0;i+k-1<n;i++){
    ans+=mod-fac[n-i-1]*finv[k-1]%mod*finv[n-k-i]%mod*a[i]%mod;
    ans%=mod;
  }
  
  cout << ans << endl;
  
  return 0;
}

Measured memory_bytes: 3328
import java.util.Scanner;
public class Main{
	
	public void solve(){
		Scanner sc = new Scanner(System.in);
		int x;
		x = sc.nextInt();
		System.out.println(x*x*x);
	}
	public static void main(String[] args){
		Main obj = new Main();
		obj.solve();
	}
}

Measured memory_bytes: 17156
#include <algorithm>
#include <iostream>
#include <vector>
#define REP(i, n) for (long long i = 0; i < (n); i++)
using namespace std;

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

    long long N;
    scanf("%lld",&N);

    long long L;
    scanf("%lld",&L);

    std::vector<std::string> S(N);
    REP(i, N)
        std::cin >> S[i];

    sort(S.begin(), S.end());

    REP(i, N)
        cout << S[i];
    cout << '\n';
    return 0;
}


Measured memory_bytes: 256
import java.util.*;
import java.lang.*;
import java.math.*;

public class Main {
	Scanner sc = new Scanner(System.in);
	void run(){
		int x = sc.nextInt();
		int debt = 100000;
		for(int i = 0; i < x; i++){
			debt *= 1.05;
			debt += 999;
			debt /= 1000;
			debt *= 1000;
		}
		System.out.println(debt);
	}
	public static void main(String[] args){
		Main m = new Main();
		m.run();
		
	}
}

Measured memory_bytes: 12000
#include <iostream>
#include <vector>

int main(int argc, char **argv)
{
    int N, M;
    std::cin >> N >> M;

    std::vector<int> A(M);
    for(int i = 0; i < M; i++){
        std::cin >> A.at(i);
    }
    int sum = 0;
    for(int i = 0; i < M; i++){
        sum += A.at(i);
    }

    if(sum > N){
        std::cout << -1 << std::endl;
    }else{
        std::cout << (N-sum) << std::endl;
    }
    
}


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

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

    string S;

    cin >> S;

    int lose_count = 0;

    for (int i = 0; i < S.size(); i++)
    {
        if (S[i] == 'x')
        {
            lose_count++;
        }
    }

    if (lose_count <= 7)
    {
        cout << "YES" << '\n';
    }
    else
    {
        cout << "NO" << '\n';
    }

    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
constexpr int Inf = 1000000000;
constexpr ll INF= 1e18;
constexpr ll MOD = 1000000007;
const double PI = 3.1415926535897;
typedef pair<int,int> P;

int main() {
    ll A,B,C;
    cin >> A >> B >> C;
    if(C - A - B <= 0) {
        cout << "No" << endl;
    }
    else {
        if((C - A - B) * (C - A - B) > 4 * A * B) {
            cout << "Yes" << endl;
        }
        else {
            cout << "No" << endl;
        }
    }
}

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

using namespace std;

#define endl '\n'
typedef long long  ll;


int main()
{
    ll pos=0;
    ll n,l,temp,p;
    cin>>n>>l;
    vector<ll>elems;
    set<pair<ll,ll>>res;
    pair<ll,ll> temp1;
    for(ll i=0;i<n;i++)
    {
        cin>>temp;
        elems.push_back(temp);
    }
    for(ll i=0;i<l;i++)
    {
        res.insert(make_pair(elems[i],i));
    }
    temp1=*(res.begin());
    if(n==l)
    {
       cout<<temp1.first<<endl;
       return 0; 
    }
        
    else
        cout<<temp1.first<<" ";
    res.erase(make_pair(elems[pos],pos));
    pos++;
    for(ll i=l;i<n;i++)
    {
        res.insert(make_pair(elems[i],i));
        temp1=*(res.begin());
        if(i!=n-1)
            cout<<temp1.first<<" ";
        else
            cout<<temp1.first<<endl;
        res.erase(make_pair(elems[pos],pos));
        pos++;
    }
    return 0;
}



Measured memory_bytes: 16912
#include<stdio.h>

int main(){
	int zs,i,j,k,b,f,r,v;
	int t[4][3][10]={0};
	
	scanf("%d",&zs);
	for(i=0;i<zs;i++){
		
		scanf("%d %d %d %d",&b ,&f ,&r ,&v);
		
		t[b-1][f-1][r-1]+=v;
		
	}
	
	for(i=0;i<4;i++){
		for(j=0;j<3;j++){
			for(k=0;k<10;k++){
				
				printf(" %d",t[i][j][k]);
			}
			printf("\n");
		}
		if(i!=3){
		printf("####################\n");
		}
	}
	
	return 0;
}

Measured memory_bytes: 612
//g++ -std=c++14 test.cpp -o test.out

#include <string.h>
#include <stdlib.h>
#include <math.h>
#include <cassert>
#include <algorithm>
#include <functional>
#include <iostream>
#include <iomanip>
#include <vector>
#include <queue>
#include <map> 
#include <unordered_map> 
#include <utility>
#include <limits.h>
#include <bitset>
#include <set>
using namespace std;
 
#define LL long long int
const LL INF = (1LL<<60);
const int INF_INT = 2147483647-1e6-1;
const LL mod = 1000000007ll;
const int mod_int = 1000000007;

LL N;

string ans = "hon";

void solve(){
    if(N%10==3) ans = "bon";
    if(N%10==0 || N%10==1 || N%10==6 || N%10==8) ans = "pon";
}

int main(){
    cin >> N;

    solve();

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

Measured memory_bytes: 3100
#include "bits/stdc++.h"

using namespace std;
using ll = long long;
using ull = unsigned long long;

typedef pair< long long, long long > P;
typedef pair< long long, P > PP;
typedef pair< P, P > PPP;

const double DINF = 5e14, eps = 1e-10;
const long long MOD = 1e9 + 7, INF = 5e18;
const int di[4] = { 1,0,-1,0 }, dj[4] = { 0,1,0,-1 };

#define fr first
#define sc second
#define pb push_back
#define eb emplace_back
#define ALL(x) (x).begin(),(x).end()

ll a, b, c, k;

int main() {
	cin >> a >> b >> c >> k;
	if (k % 2 == 1)cout << b - a << endl;
	else cout << a - b << endl;
	return 0;
}


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

int main() {
  int t=1,w;
  while(cin >> w && w!=0) {
    int n;
    cin >> n;
    int a[n][2];
    for(int i=0; i<n; i++) {
      scanf("%d%*c%d",&a[i][0],&a[i][1]);
    }
    int dp[1001];
    fill(dp,dp+1001,0);
    int ansv=0,answ=0;
    for(int i=0; i<n; i++) {
      for(int j=w; j>=0; j--) {
	if(dp[j] || j==0) {
	  if(j+a[i][1]<=w) {
	    dp[j+a[i][1]]=max(dp[j+a[i][1]],dp[j]+a[i][0]);
	  }
	}
      }
    }
    for(int i=0; i<=w; i++) {
      if(dp[i]>ansv) {
	ansv=dp[i];
	answ=i;
      }
    }
    cout << "Case " << t << ":" << endl << ansv << endl << answ << endl;
    t++;
  }
  return 0;
}


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

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

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

#define DEBUG(x) cout<<#x<<": "<<x<<endl
#define DEBUG_VEC(v) cout<<#v<<":";REP(i,v.size())cout<<" "<<v[i];cout<<endl
#define ALL(a) (a).begin(),(a).end()

#define CHMIN(a,b) a=min((a),(b))
#define CHMAX(a,b) a=max((a),(b))

// mod
const ll MOD = 1000000007ll;
#define FIX(a) ((a)%MOD+MOD)%MOD

// floating
typedef double Real;
const Real EPS = 1e-11;
#define EQ0(x) (abs(x)<EPS)
#define EQ(a,b) (abs(a-b)<EPS)
typedef complex<Real> P;

int main(){
  ll a,b;
  cin>>a>>b;
  ll ta=a, tb=b;
  ll ans = 0;
  REP(c,40){
    a = ta; b = tb;
    ll u = 1ll<<c;
    ll u2 = u<<1;
    while((a>>c) != (b>>c)){
      if((a&u)==0){
        a = (a|u) & ~(u-1);
      }else{
        ll na = (a+u) & ~(u-1);
        ll cnt = na - a;
        ans ^= u * (cnt%2);
        a = na;
        break;
      }
    }
    ll step = (c==0 ? 4ll : u2);
    ll x = (b-a)/step;
    a += x*step;
    while((a>>c) != (b>>c)){
      if((a&u)==0){
        a = (a|u) & ~(u-1);
      }else{
        ll na = (a+u) & ~(u-1);
        ll cnt = na - a;
        ans ^= u * (cnt%2);
        a = na;
      }
    }
    assert((a>>c) == (b>>c));
    if(a&u){
      ll cnt = b-a+1;
      ans ^= u * (cnt%2);
    }
  }
  printf("%lld\n", ans);
  return 0;
}


Measured memory_bytes: 256
#include <cstdio>

int main(){
    int H,W;
    for(int c = 1;; c++){
        scanf("%d %d",&H,&W);
        if(H == 0 && W == 0){
            break;
        }
        
        for(int i = 1; i <= H; i++){
            if(i % 2 == 1){
                for(int j = 1; j <= W; j++){
                    if(j % 2 == 1){
                        printf("#");
                    }else if(j % 2 == 0){
                        printf(".");
                    }
                }
                printf("\n");
            }else if(i % 2 == 0){
                for(int j = 1; j <= W; j++){
                    if(j % 2 == 1){
                        printf(".");
                    }else if(j % 2 == 0){
                        printf("#");
                    }
                }
                printf("\n");
            }
        }
        printf("\n");
    }

    return 0;
}


Measured memory_bytes: 2680
N, K, Q = map(int, input().split())
A = []
for _ in range(Q):
    A.append(int(input()))
    
pts = [K - Q]*N
for ai in A:
    pts[ai-1] += 1

for p in pts:
    if p>0:
        print('Yes')
    else:
        print('No')

Measured memory_bytes: 10448
from fractions import gcd
import sys
n, x, d = map(int, input().split())
if d < 0:
    d = -d
    x = -x
if d == 0:
    print(n+1 if x != 0 else 1)
    sys.exit()
g = gcd(d, x)
mod = abs(d//g)
hani = [[] for _ in range(n+1)]
for k in range(n+1):
    l = x*k+k*(k-1)//2*d
    r = x*k+k*(n*2-k-1)//2*d+d
    hani[k%mod].append((l, 0))
    hani[k%mod].append((r, 1))
ans = 0
for i in range(n+1):
    if not hani[i]:
        break
    hani[i].sort()
    cnt = 0
    l = None
    for a, f in hani[i]:
        if f == 0:#l
            if cnt == 0:
                l = a
            cnt+=1
        else:
            cnt-=1
            if cnt == 0:
                ans+=(a-l)//d
print(ans)

            





        

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

int main()
{
	long long int N, march[5] = { 0 };
	long long int ans = 0;

	cin >> N;

	for (int i = 0; i < N; i++) {
		string S;
		cin >> S;
		if (S[0] == 'M')march[0]++;
		if (S[0] == 'A')march[1]++;
		if (S[0] == 'R')march[2]++;
		if (S[0] == 'C')march[3]++;
		if (S[0] == 'H')march[4]++;
	}

	for (int i = 0; i < 5; i++) {
		for (int j = i + 1; j < 5; j++) {
			for (int k = j + 1; k < 5; k++) {
				ans += march[i] * march[j] * march[k];
			}
		}
	}

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
//#pragma GCC optimize(2)
#define pb push_back
#define mp make_pair
#define all(x) x.begin(),x.end()
#define rep(i,a,b) for(int i = (a);i <= (b);i++)
#define pii pair<int,int>
#define pll pair<long long, long long>
#define fi first
#define se second
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
const ll mod = 1e9 + 7;
const ll INF = 0x3f3f3f3f3f3f3f3f;
const int inf = 0x3f3f3f3f;
const int maxn = 2e5 + 5;
const double eps = 1e-8;
const double pi = acos(-1.0);
ll gcd(ll a,ll b){return !b?a:gcd(b,a%b);}
ll lcm(ll a,ll b){return a * b / gcd(a,b);}
ll poww(ll x,ll y,ll p){ll ans = 1;while(y){if(y & 1) ans = ans * x % p;x = x * x % p;y >>= 1;}return ans % p;}
bool isp(ll x){if(x < 2) return 0; for(ll i = 2;i * i <= x;i++){if(x % i == 0) return 0;}return 1;}
int n;
string s;
int main(){
	ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
	cin >> n >> s;
	for(int i = 0;i < s.size();i++) 
		s[i] = char((s[i]-'A'+n)%26+'A');
	cout << s << endl;	
	return 0;
}
//do smt instead of nothing! never give up!
//take care of long long!
//take care of upper or lower case e.g "yes" or "YES"?
//boundary condition! e.g. n = 0?
//brute force is always the first choice!
// print the ans to look for patterns in the data!

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define REP(i,x,n) for(int i=x;i<(int)n;i++)
#define rep(i,n) REP(i,0,n)
#define sp(p) cout<<setprecision(16)<<fixed<<p<<endl;
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define SORT(a) sort(all(a))
#define RSORT(a) sort(rall(a))
#define UNIQ(a) unique(all(a))
#define UNIQNUM(a) UNIQ(a)-a.begin()
#define UNIQIT(a) a.erase(UNIQ(a), a.end());
#define VOUT(v,i) cout<<#v<<": ";for(int i=0;i<(int)v.size();i++){cout<<v[i]<<" ";}cout<<"\n";
#define vout(v) VOUT(v,z);
#define vmin(v) *min_element(all(v))
#define vmax(v) *max_element(all(v))
#define vsum(v) accumulate(all(v), 0LL);
#define MOUT(m,r,c) rep(i,r){rep(j,c){cout<<m[i][j]<<" ";}cout<<endl;}
#define mout(m) MOUT(m,m.size(),m[0].size())
#define debg(a) cout<<#a<<": "<<a<<endl;
#define show(a) for(cont &y:a){for(cont &x:y){cout<<x<<" ";}cout<<endl;}
#define digit(a) to_string(a).length();
template<class T>inline int out(const T &t){ print(t); putchar('\n'); return 0; }
template<class T>inline T gcd(T a,T b){if(b==0)return a; return(gcd(b,a%b));}
template<class T>inline T lcm(T a,T b){return a/gcd(a,b)*b;}
typedef long long ll;
typedef long double ld;
typedef pair<ll,ll> P;
typedef vector<ll> V;
// const long long MOD=1000000007;
const long long INF = 1e18;
#define EPS (1e-7)
#define PI (acos(-1))
template<class T>
inline bool chmax(T &a, T b) {
    if(a < b) { a = b; return true; }
    return false;
}
template<class T>
inline bool chmin(T &a, T b) {
    if(a > b) { a = b; return true; }
    return false;
}


void solve(long long N, std::vector<long long> P, std::vector<long long> Q){
    vector<ll> v(N);
    iota(v.begin(), v.end(), 1);
    ll i=0, a=0, b=0;
    do {
        // vout(v);
        if(v==P) a=i;
        if(v==Q) b=i;
        i++;
    } while (next_permutation(v.begin(), v.end()));
    cout << abs(a-b) << "\n";
}

int main(){
    long long N;
    scanf("%lld",&N);
    std::vector<long long> P(N);
    for(int i = 0 ; i < N ; i++){
        scanf("%lld",&P[i]);
    }
    std::vector<long long> Q(N);
    for(int i = 0 ; i < N ; i++){
        scanf("%lld",&Q[i]);
    }
    solve(N, std::move(P), std::move(Q));
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <iomanip>
#include <stdlib.h>
#include <string.h>
#include <cstring>
#include <cmath>
#include <map>
#include <queue>
#include <deque>
#include <stack>
#include <set>
#include <stdio.h>
#include <tuple>
#include <bitset>
#include <cfloat>
#include <fstream>
#include <limits.h>
#include <list>
#include <math.h>
#include <random>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#include <numeric>
#include <utility>
#include <sstream>

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

using namespace std;
#define ll long long
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
#define FORR(i,a,b)for(ll i=(a);i<=(b);i++)
#define repR(i,n) for(ll i=n;i>=0;i--)
#define P pair<ll, ll>
#define sz(x) (ll)x.size()
#define ALL(x) (x).begin(),(x).end()
#define ALLR(x) (x).rbegin(),(x).rend()
#define VE vector<ll>
#define COUT(x) cout<<(x)<<endl
#define MA map<ll,ll>
#define SE set<ll>
#define PQ priority_queue<ll>
#define PQR priority_queue<ll,VE,greater<ll>>
#define COUT(x) cout<<(x)<<endl
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define EPS (1e-10)
ll gcd(ll a, ll b) {
	if (a < b)swap(a, b);
	if (b == 0) return a;
	return gcd(b, a % b);
}
ll lcm(ll a, ll b) {
	ll g = gcd(a, b);
	return a / g * b;
}
bool prime(ll n) {
	for (ll i = 2; i <= sqrt(n); i++) {
		if (n%i == 0)return false;
	}
	return n != 1;
}


const long long MOD = 998244353;
const long long INF = 1e16;
#define int long long

const int MAX_N = 1010;
const int MAX_V = 110;



signed main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);	
	string s; cin >> s;
	int n = s.size();
	int ans = 0;
	rep(i, n - 1) {
		if (s.at(i) != s.at(i + 1))ans++;
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 512
N = int(input())

S = input()
S = S.split()

P = list(map(int, S))

P_sort = sorted(P)
count = 0


for i in range(len(P)):
    if P_sort[i] != P[i]:
        count = count + 1

if count == 0:
    print("YES")
elif count == 2:
    print("YES")
else:
    print("NO")


Measured memory_bytes: 3060
N = int(input())
sp_list = []
for i in range(N):
    s, p = input().split()
    sp_list.append([i+1, s, int(p)])

sorted_list = sorted(sp_list, key=lambda x: x[2], reverse=True)
sorted_list2 = sorted(sorted_list, key=lambda x: x[1])
for i in range(N):
    print(sorted_list2[i][0])

Measured memory_bytes: 3060
n,x = map(int,input().split())

l = list(map(int,input().split()))
dis = []
for i in range(1,len(l)):
    dis.append(abs(l[i]-l[i-1]))

def gcd(a,b):
    if b==0:
        return a
    else:
        return gcd(b,a%b)

res = abs(x-l[0])

for d in dis:
    res = gcd(res,d)
print(res)


Measured memory_bytes: 14252
import java.util.Scanner;
public class Main{
    public static void main(String[] args){
        
        Scanner sc = new Scanner(System.in);
        int S = sc.nextInt();
        int h = S / (60 * 60);
        int m = S % (60 * 60) / 60;
        int s = S % (60 * 60) % 60;
        System.out.println(h + ":" + m + ":" + s);
        sc.close();
    }
}



Measured memory_bytes: 26360
#include<iostream>
#include<cstdio>
#include<cstring>
#include<vector>
#include<queue>
#include<algorithm>
#define ll long long
#define rep(i, a, b) for(int i = a; i <= b; i++)
void read(int &x) {
    x = 0; int flag = 1; char ch = ' ';
    while(ch < '0' || ch > '9') { if(ch == '-') flag = -1; ch = getchar(); }
    while(ch >= '0' && ch <= '9') x = x * 10 + ch - '0', ch = getchar();
    x *= flag;
}
void read(ll &x) {
    x = 0; int flag = 1; char ch = ' ';
    while(ch < '0' || ch > '9') { if(ch == '-') flag = -1; ch = getchar(); }
    while(ch >= '0' && ch <= '9') x = x * 10 + ch - '0', ch = getchar();
    x *= flag;
}
using namespace std;
const int maxn = 200010, inf = 100000;
int n, f[maxn], s1[maxn], s2[maxn];
int find(int x) { return f[x] == x ? f[x] : f[x] = find(f[x]); }
int main()
{
    read(n);
    rep(i, 1, inf + inf) f[i] = i;
    rep(i, 1, n) {
        int x, y;
        read(x), read(y);
        f[find(x)] = find(y + inf);
    }
    rep(i, 1, inf) s1[find(i)]++;
    rep(i, inf + 1, inf + inf) s2[find(i)]++;
    ll ans = 0;
    rep(i, 1, inf + inf) ans += 1ll * s1[i] * s2[i];
    printf("%lld\n", ans - n);
    return 0;
}

Measured memory_bytes: 2176
#include <iostream>
#include <fstream>
#include <set>
#include <map>
#include <string>
#include <vector>
#include <queue>
#include <stack>
#include <functional>
#include <algorithm>
#include <climits>
#include <cmath>
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
#define int long long
int gcd(int a, int b){
    if(b > a) return gcd(b, a);
    else if (b == 0)return a;
    else return gcd(b, a % b);
}

signed main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n; cin >> n;
    int T[110];
    rep(i, n) cin >> T[i];
    int ans = 1;
    int L = T[0];
    rep(i, n) {
        L = L / gcd(L, T[i]) * T[i];
    }
    cout << L << endl;

    return 0;
}


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

pub fn read_stdin() -> String {
    let mut s = String::new();
    ::std::io::stdin().read_to_string(&mut s).unwrap();
    s
}

fn main() {
    let source = read_stdin();
    let mut iter = source.split_whitespace();
    let s: Vec<char> = iter.next().unwrap().chars().collect::<Vec<_>>();

    let right = s.iter().enumerate().filter(|&(i, _)| i % 2 == 0).all(
        |(_, &step)| step != 'L',
    );
    let left = s.iter().enumerate().filter(|&(i, _)| i % 2 == 1).all(
        |(_, &step)| step != 'R',
    );

    println!("{}", if right && left { "Yes" } else { "No" });
}

Measured memory_bytes: 4352
#include <bits/stdc++.h>
#define rep(i,a,n)  for (int i=(int)(a); i<=(int)(n); ++i)
#define rrep(i,a,n) for (int i=(int)(a); i>=(int)(n); --i)
#define debug(x) cerr << #x << " = " << x << "\n"
#define debugv(x) rep(i, x.size()) cerr << x[i] << (i == x.size() - 1 ? "\n" : " ")
#define all(x) x.begin(),x.end()
#define int long long
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
const int INF = ((1LL << 30) + (1LL << 29));
const int MOD = 1000000007;

//=============================
int N,M,K;
string S,T;
vector<string> A;
vector<string> B;
//=============================
void input()
{
    cin>>N;
    A.resize(N);
    rep(i,0,N-1){
        cin>>A[i];
    }
    cin>>M;
    B.resize(M);
    rep(i,0,M-1){
        cin>>B[i];
    }
}
//=============================
void func(){}
//=============================
void solve()
{
    map<string,int> ma;
    map<string,int> mb;
    for (auto x : A){
        ma[x]++;
    }
    for (auto x : B){
        ma[x]--;
    }

    int ans=0;
    for (auto it:ma){
        ans=max(ans,it.second);
    }

    cout << ans << endl;
}
//=============================
signed main()
{
    input();
    solve();
    return 0;
}

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

int main() {
    long long n,x;cin>>n>>x;
    long long a[n];
    for(int i=0;i<n;i++){
        cin>>a[i];
    }
    sort(a,a+n);
    int cnt=0;
    int fin=0;
    for(int i=0;i<n;i++){
        if(x<a[i]){
            fin=1;
            break;
        }
        else{
            x-=a[i];
            cnt++;
        }
    }
    if(x>0 && cnt==0) cout<<0<<endl;
    else if(x>0 && fin==1) cout<<cnt<<endl;
    else if(x>0 && fin==0) cout<<cnt-1<<endl;
    else cout<<cnt<<endl;

}

Measured memory_bytes: 256