akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<math.h>
#include<iomanip>
#include<set>
#include<numeric>
#include<cstring>
#include<cstdio>
#include<functional>
#include<bitset>
#include<limits.h>
#include<cassert>
#include<iterator>
#include<complex>
#include<stack>
#include<sstream>
using namespace std;
typedef  long long int lint;
typedef pair<int, int> IP;
typedef pair<lint, lint> LLP;
typedef pair<char, char>CP;
#define rep(i, n) for (int i = 0; i < n; i++)
#define repr(i, n) for (int i = n; i >= 0; i--)
#define sort(v) sort((v).begin(), (v).end())
#define reverse(v) reverse((v).begin(), (v).end())
#define upper(v,hoge) upper_bound(v.begin(),v.end(),hoge)
#define lower(v,hoge) lower_bound(v.begin(),v.end(),hoge)
#define llower(v,hoge) *lower_bound(v.begin(), v.end(), hoge)
#define lupper(v,hoge) *upper_bound(v.begin(), v.end(), hoge)
const lint MOD = pow(10, 9) + 7;

	const int limit = 50;
	int n, m; 
	int a[limit], b[limit];
	bool graph[limit][limit];
	bool visited[limit];

	void dfs(int v) {
		visited[v] = true; 
		for (int v2 = 0; v2 < n; ++v2) { 
			if (graph[v][v2] == false) continue; 
			if (visited[v2] == true) continue; 
			dfs(v2); 
		} 
	}

	int main(void) {
    cin >> n >> m;
    for (int i = 0; i < m; ++i) { 
		cin >> a[i] >> b[i]; 
		a[i]--, b[i]--; 
		graph[a[i]][b[i]] = graph[b[i]][a[i]] = true; 
	}
	int ans = 0;
	for (int i = 0; i < m; ++i) {
    graph[a[i]][b[i]] = graph[b[i]][a[i]] = false;
	for (int j = 0; j < n; ++j) visited[j] = false;
	dfs(0);
	bool bridge = false; 
    for (int j = 0; j < n; ++j) if (visited[j] == false) bridge = true; 
	if (bridge) ans += 1;
	graph[a[i]][b[i]] = graph[b[i]][a[i]] = true; 
		}
	cout << ans << endl;
    
    return 0; 
	}



Measured memory_bytes: 256
n = gets.to_i
maxs = gets.split.map(&:to_i)

res = Array.new(n, -1)

n.times do |i|
    maxs_idx = [0, i - 1].max
    max_num = maxs[maxs_idx]
    next_max_num = maxs[maxs_idx + 1] || 10**10
    next_max_num = 10**10 if i == 0
    res[i] = [max_num, next_max_num].min
end

puts res.inject(:+)

Measured memory_bytes: 1788
#include <iostream>
#include <algorithm>
#include <deque>

using namespace std;
typedef long long int ll;

#define rep(x, a, b) for (int x = a; x < b; x++)

bool query(const deque<int> &pohe) {
  for (auto a : pohe)
    cout << ((a & 1) ? '#' : '.');
  cout << endl;
  for (auto a : pohe)
    cout << ((a & 2) ? '#' : '.');
  cout << endl;

  string str;
  cin >> str;
  
  return str == "T";
}

int main()
{
  int n;

  cin >> n;

  deque<int> pohe;

  rep(i, 0, 4) {
    pohe.push_back(i);
    if (query(pohe))
      break;
    pohe.pop_back();
  }

  bool top = false, bot = false;

 retry:
  while (pohe.size() < (size_t)n) {
    if (!top) {
      rep(i, 0, 4) {
        pohe.push_back(i);
        if (query(pohe)) {
          goto retry;
        }
        pohe.pop_back();
      }
      top = true;
    }

    if (!bot) {
      rep(i, 0, 4) {
        pohe.push_front(i);
        if (query(pohe)) {
          goto retry;
        }
        pohe.pop_front();
      }
      bot = false;
    }
  }

  string end;
  cin >> end;
  (void) end;
  
  return 0;
}


Measured memory_bytes: 596
# Author: cr4zjh0bp
# Created: Fri Mar  6 16:01:31 UTC 2020
import sys
 
stdin = sys.stdin
inf = 1 << 60
mod = 1000000007
 
ni = lambda: int(ns())
nin = lambda y: [ni() for _ in range(y)]
na = lambda: list(map(int, stdin.readline().split()))
nan = lambda y: [na() for _ in range(y)]
nf = lambda: float(ns())
nfn = lambda y: [nf() for _ in range(y)]
nfa = lambda: list(map(float, stdin.readline().split()))
nfan = lambda y: [nfa() for _ in range(y)]
ns = lambda: stdin.readline().rstrip()
nsn = lambda y: [ns() for _ in range(y)]
ncl = lambda y: [list(ns()) for _ in range(y)]
nas = lambda: stdin.readline().split()

N, W = na()
wv = nan(N)
MAX_V = 100100
dp = [[inf] * MAX_V for _ in range(N + 1)]
dp[0][0] = 0

for i in range(N):
    for j in range(MAX_V):
        w, v = wv[i]
        if j >= v:
            dp[i + 1][j] = min(dp[i + 1][j], dp[i][j - v] + w)
        dp[i + 1][j] = min(dp[i + 1][j], dp[i][j])

ans = inf
for i in range(MAX_V):
    if dp[N][i] <= W:
        ans = i

print(ans)

Measured memory_bytes: 120284
x1,y1,x2,y2 = map(int, raw_input().split())
vx = x2-x1
vy = y2-y1
nx = -vy
ny = vx
x3 = x2 + nx
y3 = y2 + ny
nnx = -ny
nny = nx
x4 = x3 + nnx
y4 = y3 + nny
print x3, y3, x4, y4


Measured memory_bytes: 2568
n,m=map(int,input().split())
CARD=[0]*(n+1)
for i in range(m):
    L,R=map(int,input().split())
    CARD[L-1]+=1
    CARD[R]-=1
ans=0
for i in range(n):
    if CARD[i]==m:ans+=1
    CARD[i+1]=CARD[i+1]+CARD[i]

print(ans)

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

#define int long long
#define double long double

using namespace std;

#define REP(i, a, b) for (int(i) = (a); i < (b); (i)++)
#define rep(i, n) REP(i, 0, n)
#define PER(i, a, b) for (int(i) = (a - 1); i >= (b); (i)--)
#define per(i, n) PER(i, n, 0)
#define each(i, n) for (auto &i : n)
#define clr(a) memset((a), 0, sizeof(a))
#define mclr(a) memset((a), -1, sizeof(a))
#define all(a) (a).begin(), (a).end()
#define dum(val) cerr << #val " = " << val;
#define dump(val) cerr << #val " = " << val << endl;
#define FILL(a, v) fill(a, a + sizeof(a) / sizeof(*a), v)

typedef pair<int, int> P;
typedef tuple<int, int, int> T;

const int dx[8] = {+1, +0, -1, +0, +1, +1, -1, -1};
const int dy[8] = {+0, -1, +0, +1, -1, +1, -1, +1};
const int mod = 1e9 + 7;
const int INF = 1e9;

signed main() {
	int n, m;
	cin >> n >> m;

	vector<int> a(n);
	for (int i = 0; i < n; i++) {
		cin >> a[i];
		a[i]--;
	}

	int s = a[0];

	vector<vector<P>> t(m);

	auto dist = [&](int s, int t) {
		if (s <= t)
			return t - s;
		else
			return m - s + t;
	};

	REP(i, 1, n) {
		if (dist(a[i - 1], a[i]) >= 2) {
			t[(a[i - 1] + 2) % m].push_back(P(i, -1));
			t[(a[i] + 1) % m].push_back(P(i, dist(a[i - 1], a[i]) - 1));
		}
	}

	vector<int> v(m, 0);
	vector<int> mp(n, 0);
	int ad = 0;
	int sz = 0;
	rep(i, m * 3) {
		int j = i % m;
		each(k, t[j]) {
			if (mp[k.first] == 0 && k.second == -1) {
				sz++;
				mp[k.first] = 1;
			} else if (mp[k.first] == 1 && k.second != -1) {
				sz--;
				ad -= k.second;
				mp[k.first] = -1;
			}
		}
		ad += sz;
		v[j] += ad;
	}

	int best = -1;
	int ma = 0;
	rep(i, m) {
		if (ma < v[i]) {
			ma = v[i];
			best = i;
		}
	}

	int ans = 0;
	REP(i, 1, n) {
		//s -> a[i]
		ans += min(dist(a[i - 1], a[i]), dist(best, a[i]) + 1);
	}
	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 10368
import copy
import heapq
import math
import fractions

def j(n):
    if n:print("Yes")
    else:print("No")
    exit(0)
rem = 10 ** 9 + 7

"""
def ct(x,y):
    if (x>y):print("+")
    elif (x<y): print("-")
    else: print("?")
"""

def ip():
    return int(input())
def iprow():
    return [int(i) for i in input().split()]
def ips():
    return (int(i) for i in input().split())
def ipmultiplerow(n):
    a = []
    for i in range(n):
        a.append(ip())
    return a
def printmultiplerow(a):
    for i in a:
        print(i)
def printrow(a):
    for i in range(len(a)-1):
        print(a[i],end = " ")
    print(a[-1])


n = ip()
p = int(math.sqrt(n))
ans = n-1
for i in range(1,p+1):
    if n%i==0:
        l = n//i
        ans  = l+i-2
print(ans)


Measured memory_bytes: 5172
#include <bits/stdc++.h>
#define chmin(a, b) ((a)=min((a), (b)))
#define chmax(a, b) ((a)=max((a), (b)))
#define fs first
#define sc second
#define eb emplace_back
using namespace std;

typedef long long ll;
typedef pair<int, int> P;
typedef tuple<int, int, int> T;

const ll MOD=1e9+7;
const ll INF=1e18;

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

int main(){
    string s; cin>>s;
    int k; cin>>k;
    int n=s.size();
    for(int i=0; i<n; i++){
        if(s[i]=='a') continue;

        if('z'-s[i]+1<=k){
            k-='z'-s[i]+1;
            s[i]='a';
        }
    }
    
    k%=26;
    s[n-1]+=k;
    cout << s << endl;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)
#define all(c) c.begin(),c.end()
#define pb push_back
#define fs first
#define sc second
#define show(x) cout << #x << " = " << x << endl
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)
using namespace std;
template<class S,class T> ostream& operator<<(ostream& o,const pair<S,T> &p){return o<<"("<<p.fs<<","<<p.sc<<")";}
template<class T> ostream& operator<<(ostream& o,const vector<T> &vc){o<<"sz = "<<vc.size()<<endl<<"[";for(const T& v:vc) o<<v<<",";o<<"]";return o;}
int main(){
	string s;
	cin>>s;
	int N = s.size();
	vector<int> is;
	is.pb(-1);
	string t;
	rep(i,N) if(s[i]!='x') t += s[i],is.pb(i);
	is.pb(N);
	int K = t.size();
	rep(i,K) if(t[i]!=t[K-1-i]){
		puts("-1");
		return 0;
	}
	int ans = 0;
	rep(i,(K+1)/2){
		int dif = abs((is[i+1]-is[i])-(is[K+1-i]-is[K-i]));
		ans += dif;
	}
	cout<<ans<<endl;
}


Measured memory_bytes: 1148
// https://atcoder.jp/contests/

#include <bits/stdc++.h>
#define REP(i, n) for (int(i) = 0; (i) < (n); (i)++)
#define REPR(i, n) for (int(i) = (n); (i) >= 0; (i)--)
#define FOR(i, m, n) for (int(i) = (m); (i) < (n); i++)
#define INF 1e9
#define ALL(v) (v).begin(), (v).end()
using namespace std;
using ll = long long;
using pll = pair<ll, ll>;

ll N, r, c;
string S;

int main()
{
  cin >> N >> S;
  r = c = count(ALL(S), 'E');
  REP(i, N)
  {
    if (S[i] == 'E')
      r = min(r, --c);
    else
      r = min(r, c++);
  }

  cout << r << '\n';

  return 0;
}


Measured memory_bytes: 900
#include <iostream>

using namespace std;

int sum_digits (int n) {
    int sum = 0;
    while (n >0) {
        sum += n % 10;
        n /= 10;
    }
    return sum;
}

int main() {
    int N;
    cin >> N;
    
    int res = 1000000; // sufficiently large
    for (int A = 1; A < N/2 + 1; ++A) {
        int B = N - A;
        if (res > sum_digits(A) + sum_digits(B)) res = sum_digits(A) + sum_digits(B);
    }
    
    cout << res << endl;
    
}

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

using namespace std;

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

#endif
	ll s, n, temp;
	cin >> s >> n;
	std::vector<int> v;
	for (int i = 0; i < n; i++)
	{
		cin >> temp;
		v.push_back(temp);
	}
	ll ans = s - accumulate(v.begin(), v.end(), 0);
	if (ans < 0)
		cout << -1 << endl;
	else
		cout << ans << endl;
	return 0;
}

Measured memory_bytes: 3716
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;

template <typename T>
using indexed_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

#define int long long
#define ld long double
#define pb push_back
#define mp make_pair
#define in insert
#define fi first
#define se second
#define lb lower_bound
#define ub upper_bound
#define mod 1000000007
#define mod1 998244353
#define sz(v) (int)(v.size())
#define all(x) x.begin(), x.end()
#define prec fixed << setprecision(12)
#define rep(i, a, b) for (int i = a; i <= b; ++i)
#define repr(i, a, b) for(int i = a; i >= b; i--)
#define test int t; cin >> t; while(t--)

typedef vector<int> vi;
typedef pair<int, int> pii;
typedef set<int> si;
typedef map<int, int> mii;
typedef vector<pii> vpi;

int _x[] = {0, 0, -1, 1, -1, 1, -1, 1};
int _y[] = { -1, 1, 0, 0, 1, -1, -1, 1};

int go(int n) {
	int s = 0;
	while (n) {
		s += n % 10;
		n /= 10;
	}
	return s;
}

void solve() {
	int n;
	cin >> n;
	// cout << go(n);
	if (n % go(n) == 0) cout << "Yes";
	else cout << "No";
}

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


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

	// test
	solve();

	return 0;
}


Measured memory_bytes: 3648
package main

import "fmt"

func main() {
	var max int
	fmt.Scanln(&max)

	ns := make([]int, 0)
	ns = dfs(0, max, ns)

	cnt := 0
	for _, n := range ns {
		if is753(n) {
			cnt += 1
		}
	}

	fmt.Println(cnt)
}

func dfs(x, max int, ns []int) []int {
	if x > max {
		return ns
	}
	ns = append(ns, x)
	ns = dfs(10*x+3, max, ns)
	ns = dfs(10*x+5, max, ns)
	return dfs(10*x+7, max, ns)
}

func is753(x int) bool {
	ms := make([]int, 9)
	for x > 0 {
		d := x % 10
		ms[d] += 1
		x /= 10
	}
	return ms[3] > 0 && ms[5] > 0 && ms[7] > 0
}


Measured memory_bytes: 1664
#include<iostream>
#include<cstdio>
#include<cstring>
#include<string>
#include<algorithm>
#include<bitset>
#include<vector>
#include<deque>
#include<queue>
#include<map>
#include<set>
#include<stack>
#include<cmath>
#include<iomanip>
#include <functional>
using namespace std;
typedef long long ll;
const int mod = 1000000007;
const int INF = 1 << 30;
const double EPS = 1e-10;
const double pi = 3.14159265359;
//cout << fixed << std::setprecision(9)
//memset(a, 0, sizeof(a));
//--------------------------

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

	int lena, lenb, lenc;
	int ia, ib, ic;
	lena = a.size();
	lenb = b.size();
	lenc = c.size();
	ia = 0;
	ib = 0;
	ic = 0;

	char cur = 'a';
	while (1) {
		//cout << cur << endl;

		if (cur == 'a') {
			if (ia == lena) { cout << 'A' << endl;break; }
			cur = a[ia];
			ia++;
		}
		if (cur == 'b') {
			if (ib == lenb) { cout << 'B' << endl;break; }
			cur = b[ib];
			ib++;
		}
		if (cur == 'c') {
			if (ic == lenc) { cout << 'C' << endl;break; }
			cur = c[ic];
			ic++;
		}
	}

	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, j, n) for (ll i = j; i < n; i++)
#define all(x) (x).begin(),(x).end()
#define INF (1000000000)
#define MOD (1000000007)
#define MAX (500000)
#define pii pair<int, int>

/////////////////////////////////////////////////////////

class XY{
public:
  ll x, y;
  XY() {x = y = 0;}
  XY(ll u, ll v) {x = u; y = v;}
};

class e{
public:
  ll a, b;
  e() {a = b = -1;}
  e(ll u, ll v) {a = u; b = v;}
};

template<typename T1, typename T2>
void chmin(T1 &a, T2 b) {if(a > b) a = b;}
template<typename T1, typename T2>
void chmax(T1 &a, T2 b) {if(a < b) a = b;}

template<typename T1, typename T2>
ll mypow(T1 a, T2 n){
  if(n == 0) return 1;
  if(n == 1) return a;
  if(n % 2) return a * mypow(a, n - 1);
  ll tmp = mypow(a, n / 2);
  return tmp * tmp;
}

template<typename T>
int BS(vector<T> &V, int left, int right, T key){
  int mid = (left + right) / 2;
  if(V[mid] <= key) left = mid;
  else right = mid;
  if(right - mid == 1) return left;
  else return BS(V, left, right, key);
}

ll comb(ll n, ll r){
	ll res = 1;
  rep(i, 0, r){
    res *= n - i;
    res /= i + 1;
  }
  return res;
}

template<typename T>
T euclid(T a, T b){
  if(b == 0) return a;
  else return euclid(b, a % b);
}

ll fact[MAX], fact_inv[MAX];

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

void prepare_comb_mod(ll n){
	fact[0] = 1;
	for(ll i = 0; i < n; i++) fact[i+1] = fact[i] * (i + 1) % MOD;
	fact_inv[n] = pow_mod(fact[n], MOD - 2);
	for(ll i = n - 1; i >= 0; i--) fact_inv[i] = fact_inv[i + 1] * (i + 1) % MOD;
}

ll comb_mod(ll n, ll r){
	return (fact[n] * fact_inv[r]) % MOD * fact_inv[n - r] % MOD;
}

/////////////////////////////////////////////////////////


void Main() {
  int N; cin >> N;
  vector<string> S(2 * N);
  rep(i, 0, N) cin >> S[i];
  rep(i, 0, N){
    S[N + i] = S[i];
  }
  ll res = 0;
  rep(k, 0, N){
    bool ok = true;
    rep(i, 0, N){
      rep(j, 0, N){
        if(S[k + i][j] != S[k + j][i]) ok = false;
      }
    }
    if(ok) res += N;
  }
  cout << res << endl;
}

/////////////////////////////////////////////////////////

int main(){
  cin.tie(nullptr);
  ios_base::sync_with_stdio(false);
  cout << std::fixed << std::setprecision(15);

  Main();
}


Measured memory_bytes: 512
//Bismillahirrahmanirrahim
//█▀█─█──█──█▀█─█─█
//█▄█─█──█──█▄█─█▄█
//█─█─█▄─█▄─█─█─█─█

#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")

#include <bits/stdc++.h>

using namespace std;

typedef long long lo;
typedef pair< lo,lo > PII;

#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define fio() ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define FOR for(int i=1;i<=n;i++)
#define mid ((start+end)/2)
#define ort ((bas+son)/2)

const lo MAX = -1000000000000000000;
const lo MIN = 1000000000000000000;
const lo inf = 1000000000;
const lo KOK = 100000;
const lo LOG = 30;
const lo li = 500005;
const lo mod = 1000000007;

int n,m,b[li],a[li],k,flag,t;
int cev;
string s;
vector<int> v;

int main(void){
	fio();
	cin>>s;
	int n=(int)s.size();
	for(int i=0;i<(int)s.size();i++){
		if(s[i]!=s[s.size()-i-1]){cout<<"No\n";return 0;}
	}
	int bas=0;
	int son=(n-1)/2-1;
	while(bas<=son){
		if(s[bas]!=s[son]){cout<<"No\n";return 0;}
		bas++;
		son--;
	}
	bas=(n+3)/2-1;
	son=n-1;
	while(bas<=son){
		if(s[bas]!=s[son]){cout<<"No\n";return 0;}
		bas++;
		son--;
	}
	cout<<"Yes\n";
	return 0;
}



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


int H,W;
bool F[52][52]; //障害物
bool D[52][52][52][52]; //探索済みかの判定用
int inc_tx[4] = {1,-1,0,0};
int inc_ty[4] = {0,0,1,-1};
int inc_kx[4] = {-1,1,0,0};
int inc_ky[4] = {0,0,-1,1};

class Point{
public:
  int tx; //タカユキの座標
  int ty;
  int kx; //カズユキの座標
  int ky;
  int d; //ターン回数
  void set(int a,int b,int c,int d){
    tx = a;
    ty = b;
    kx = c;
    ky = d;
  }
};

bool is_out_of_area(int y,int x) //座標が範囲内か確認する関数
{
  return x < 1 || x > W || y < 1 || y > H || F[y][x];
}

int main(){

  while(1){

    Point p,q;
    int tx,ty,kx,ky;
    queue<Point> qa;
    cin >> W >> H;
    if(W == 0 && H == 0)
    break;
    cin >> tx >> ty >> kx >> ky;
    memset(F,1,sizeof(F));
    for(int y=1;y<=H;y++){
      for(int x=1;x<=W;x++){
        cin >> F[y][x];
      }
    }
    memset(D,1,sizeof(D));
    p.set(tx,ty,kx,ky);
    D[ty][tx][ky][kx] = 0;
    p.d = 0;
    qa.push(p);
    while(1){
      if(qa.empty()){
        cout << "NA" <<endl;
        break;
      }
      p = qa.front();
      qa.pop();
      if(p.d >= 100){
        cout << "NA" << endl;
        break;
      }
      if(p.tx == p.kx && p.ty == p.ky){
        cout << p.d << endl;
        break;
      }
      for(int i=0;i<4;i++){
        q.tx = p.tx + inc_tx[i]; q.ty = p.ty + inc_ty[i];
        q.kx = p.kx + inc_kx[i]; q.ky = p.ky + inc_ky[i];

        if(is_out_of_area(q.ty ,q.tx) == 0 || is_out_of_area(q.ky ,q.kx) == 0){
          if(is_out_of_area(q.ty ,q.tx)){
            q.ty = p.ty; q.tx = p.tx;
          }
          if(is_out_of_area(q.ky ,q.kx)){
            q.ky = p.ky; q.kx = p.kx;
          }
          if(D[q.ty][q.tx][q.ky][q.kx]){
            q.d = p.d + 1;
            qa.push(q);
            D[q.ty][q.tx][q.ky][q.kx] = 0;
          }
        }

      }
    }

  }
  return 0;
}



Measured memory_bytes: 10332
#![allow(non_snake_case)]

use std::io::prelude::*;
use std::io::stdin;
use std::str::FromStr;

fn main() {
    let _n: usize = read();
    let a: String = read();
    let b: String = read();
    let c: String = read();

    let mut ans = 0;

    for (a, (b, c)) in a.chars().zip(b.chars().zip(c.chars())) {
        let mut abc = vec![a, b, c];
        abc.sort();
        abc.dedup();
        ans += abc.len() - 1;
    }

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

#[allow(dead_code)]
fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let token: String = stdin
        .lock()
        .bytes()
        .map(|b| b.unwrap() as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().unwrap()
}


Measured memory_bytes: 4352
H,W=map(int,input().split())
a=[[] for i in range(0,H)]
for i in range(0,H):
    a[i]=list(map(int,input().split()))

ans=[]
for i in range(0,H):
    for j in range(0,W-1):
        if a[i][j]%2==1:
            ans.append((i,j,i,j+1))
            a[i][j+1]+=1

for i in range(0,H-1):
    if a[i][W-1]%2==1:
        ans.append((i,W-1,i+1,W-1))
        a[i+1][W-1]+=1

N=len(ans)
print(N)
for i in range(0,N):
    x,y,z,w=ans[i]
    print(x+1,y+1,z+1,w+1)

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

using namespace std;

#define FOR(i, a, b) for(int i = (a); i < (b); ++i)
#define FORR(i, a, b) for(int i = (a); i > (b); --i)
#define REP(i, n) for(int i = 0; i < (n); ++i)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOREACH(x, a) for(auto &(x) : (a))
#define VECCIN(x)                                                              \
    for(auto &youso_ : (x)) cin >> youso_
#define mp make_pair
#define bitcnt __builtin_popcount
#define All(a) (a).begin(), (a).end()
template <typename T = long long> inline T IN() {
    T x;
    cin >> x;
    return (x);
}
inline void CIN() {}
template <class Head, class... Tail>
inline void CIN(Head &&head, Tail &&... tail) {
    cin >> head;
    CIN(move(tail)...);
}
#define CINT(...)                                                              \
    int __VA_ARGS__;                                                           \
    CIN(__VA_ARGS__)
#define LCIN(...)                                                              \
    ll __VA_ARGS__;                                                            \
    CIN(__VA_ARGS__)
#define SCIN(...)                                                              \
    string __VA_ARGS__;                                                        \
    CIN(__VA_ARGS__)
#define Yes(a) cout << (a ? "Yes" : "No") << "\n"
#define YES(a) cout << (a ? "YES" : "NO") << "\n"

typedef long long ll;
typedef vector<int> V;
typedef vector<ll> VL;
typedef pair<int, int> P;
typedef pair<ll, ll> PL;
typedef priority_queue<int> PQ;
typedef priority_queue<int, V, greater<int>> PQG;

const int INF = 1e9;
const int MOD = 998244353;
const ll LINF = 1e18;

ll X, Y, Z, K;
vector<ll> A, B, C;
vector<ll> AB, ABC;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cin >> X >> Y >> Z >> K;
    A.resize(X);
    B.resize(Y);
    C.resize(Z);
    AB.resize(X * Y);
    ABC.resize(K * K);
    VECCIN(A);
    VECCIN(B);
    VECCIN(C);
    REP(i, X) REP(j, Y) { AB[i * Y + j] = A[i] + B[j]; }
    sort(All(AB), greater<ll>());
    REP(i, min(X * Y, K)) REP(j, Z) {
        ABC[i * min(X * Y, K) + j] = AB[i] + C[j];
    }
    sort(All(ABC), greater<ll>());
    REP(i, K) { cout << ABC[i] << "\n"; }
    return 0;
}


Measured memory_bytes: 78464
#include <stdio.h>
void bubbleSort(int A[],int N){ 
   int flag = 1 ;// ????????£??\????´?????????¨??????
   int n,i,j;
   int count=0;
   while(flag){
     flag = 0;
    	for(j=N-1;j>=1;j--){ 
       		if (A[j] < A[j-1]){
       			n=A[j];
         		A[j]=A[j-1];
         		A[j-1]=n;
         		count++;
         		flag = 1;
         	}
    	}
    }
    for(i=0;i<N-1;i++){
    	printf("%d ",A[i]);
    }
    printf("%d\n",A[N-1]);
    printf("%d\n",count);
}

int main()
{
	int i,n;
	int num[100];
	scanf("%d",&n);
	for(i=0;i<n;i++){
		scanf("%d",&num[i]);
	}
	bubbleSort(num,n);
	return 0;
}

Measured memory_bytes: 600
public class Main {
	public static void main(String[] args) {
		try (java.util.Scanner sc = new java.util.Scanner(System.in)) {
			while (true) {
				int x = sc.nextInt();
				int y = sc.nextInt();
				if (x == 0 && y == 0) {
					break;
				}
				System.out.println(Math.min(x, y)  + " "  + Math.max(x, y));
			}
		}
	}
}


Measured memory_bytes: 36228
#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 T; cin >> T;
    rep(i,T.size()){
        if(T[i] == '?') T[i] = 'D';
    }
    cout << T << endl;
    return 0;
}

Measured memory_bytes: 3724
import java.util.*;

public class Main {
    static int[] arr;
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int q = sc.nextInt();
        arr = new int[n + 2];
        for (int i = 0; i < n; i++) {
            arr[i] = sc.nextInt();
        }
        arr[n] = Integer.MAX_VALUE;
        arr[n + 1] = Integer.MIN_VALUE;
        Arrays.sort(arr);
        StringBuilder sb = new StringBuilder();
        for (int i = 0; i < q; i++) {
            int left = sc.nextInt();
            int right = sc.nextInt();
            sb.append(getRightIdx(right) - getLeftIdx(left) + 1).append("\n");
        }
        System.out.print(sb);
    }
    
    static int getLeftIdx(int x) {
        int left = 0;
        int right = arr.length;
        while (right - left > 1) {
            int m = (left + right) / 2;
            if (arr[m] < x) {
                left = m;
            } else {
                right = m;
            }
        }
        return right;
    }
    
    static int getRightIdx(int x) {
        int left = 0;
        int right = arr.length;
        while (right - left > 1) {
            int m = (left + right) / 2;
            if (arr[m] <= x) {
                left = m;
            } else {
                right = m;
            }
        }
        return left;
    }
}


Measured memory_bytes: 103192
a,b,c = map(int, input().split())
aa,bb,cc = a%2, b%2, c%2
res = 0
if aa==0 and bb == 1 and cc == 0:
    res += 1
    a,c = a+1, c+1
elif aa==1 and bb == 0 and cc == 0:
    res += 1
    b,c = b+1, c+1
elif aa == 0 and bb == 0 and cc == 1:
    res += 1
    b, a = b + 1, a + 1
elif aa==0 and bb == 1 and cc == 1:
    res += 1
    b,c = b+1, c+1
elif aa==1 and bb == 0 and cc == 1:
    res += 1
    a,c = a+1, c+1
elif aa == 1 and bb == 1 and cc == 0:
    res += 1
    b, a = b + 1, a + 1
l = [a,b,c]
l.sort()
res += (l[2] - l[1]) // 2
res += (l[2] - l[0]) // 2
print(res)

Measured memory_bytes: 38384
//http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=1129&lang=jp

#include <iostream>
#include <algorithm>
using namespace std;
int n,r,p,c;

int main(){
  while (cin >> n >> r && n){
    int A[n];
    for (int i=0; i<n; i++){
      A[i] = n-i;
    }
    for (int i=0; i<r; i++){
      cin >> p >> c;
      rotate(A,A+p-1,A+p+c-1);
    }
    cout << A[0] << endl;
  }
  return 0;
}



Measured memory_bytes: 3152
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
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; }
 
/* attention
    long longのシフト演算には気をつけよう
    タイポした時のデバッグが死ぬほどきつくなるので変数名は最低3字くらい使った方がいいかも
    sizeは(int)とキャストしよう
    ごちゃごちゃ場合分けを考える前に全探索は考えましたか？
*/

int main(){
    ll s; cin >> s;
    ll mod = 1e9;
    ll y, x;
    if(s%mod == 0){
        x = 0;
        y = s/mod;
    }
    else{
        y = s/mod+1;
        x = mod*y - s;
    }

    cout << "0 0 1000000000 1 " << x << " " << y << endl;

    return 0; 
}

Measured memory_bytes: 256
i=gets
a=gets.chomp.split(" ").map(&:to_i)
t=-1
ans=0
cnt=1
a.each{|i|
	if t==i then
		cnt+=1
	else 
		ans+=cnt/2
		cnt=1
	end
	t=i
}
ans+=cnt/2
puts(ans)


Measured memory_bytes: 1788
#include <stdio.h>
int main()
{
	int H,W;
	while(1){
		scanf("%d %d",&H,&W);
		if(H==0&&W==0)
			break;
		for(int i=0;i<H;i++){
			for(int j=0;j<W;j++){
				if(i%2==0){
					if(j%2==0)
						printf("#");
					else
						printf(".");
				}
				else{
					if(j%2==0)
						printf(".");
					else
						printf("#");
				}
			}
			printf("\n");
		}
		printf("\n");
	}
	return 0;
}

Measured memory_bytes: 1000
#include <algorithm>
#include <array>
#include <climits> // INT_MAX, LONG_MAX, LLONG_MAX, UINT_MAX, ULONG_MAX, ULLONG_MAX
#include <cmath>
#include <cstdint>
#include <cstring> // memset
#include <iostream>
#include <map>
#include <set>
#include <string>
#include <vector>

#define ALL(x) (x).begin(), (x).end()
#define INF 1e9
#define LOG(x) cout << #x << " = " << (x) << endl
#define REP(i, n) for (int i = 0; i < (int)(n); ++i)


using namespace std;

int s[2][1000][1000];


int main() {
    ios::sync_with_stdio(false);
    
    int n, k;
    cin >> n >> k;

    REP(i, n) {
        int xi, yi;
        string ci;
        cin >> xi >> yi >> ci;

        if (ci[0] == 'B')
            xi += k; // Do not use -= for %
        if (xi % (2 * k) >= k) {
            xi += k; // Do not use -= for %
            yi += k; // Do not use -= for %
        }

        if (yi % (2 * k) >= k)
            s[1][xi % k][yi % k]++;
        else
            s[0][xi % k][yi % k]++;
    }

    REP(p, 2) {
        for (int q = 1; q < k; q++) s[p][q][0] += s[p][q - 1][0];
        for (int r = 1; r < k; r++) s[p][0][r] += s[p][0][r - 1];
        for (int q = 1; q < k; q++) for (int r = 1; r < k; r++) s[p][q][r] += s[p][q - 1][r] + s[p][q][r - 1] - s[p][q - 1][r - 1];
    }

    int best = 0;

    REP(p, k) REP(q, k) {
        best = max(best,
                   max(s[0][k - 1][k - 1] - s[0][p][k - 1] - s[0][k - 1][q] + 2 * s[0][p][q] + s[1][p][k - 1] + s[1][k - 1][q] - 2 * s[1][p][q],
                       s[1][k - 1][k - 1] - s[1][p][k - 1] - s[1][k - 1][q] + 2 * s[1][p][q] + s[0][p][k - 1] + s[0][k - 1][q] - 2 * s[0][p][q]));
    }

    cout << best << endl;

    return 0;
}


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

#define LL long long
#define pii pair<int,int>
using namespace std;
const int inf = 2147483647;

int _max(int x, int y) {return x > y ? x : y;}
int _min(int x, int y) {return x < y ? x : y;}
inline int read() {
    int x = 0, f = 1; char ch = getchar();
    while(ch < '0' || ch > '9') {if(ch == '-') f = -1; ch = getchar();}
    while(ch >= '0' && ch <= '9') x = (x << 3) + (x << 1) + (ch ^ 48), ch = getchar();
    return x * f;
}
void put(int x) {
	if(x < 0) putchar('-'), x = -x;
	if(x >= 10) put(x / 10);
	putchar(x % 10 + '0');
}

char ss[10];

int main() {
	scanf("%s", ss + 1);
	if(ss[1] == 'S') puts("Cloudy");
	if(ss[1] == 'C') puts("Rainy");
	if(ss[1] == 'R') puts("Sunny");
	return 0;
}


Measured memory_bytes: 764
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(a) a.begin(),a.end()
#define rrng(a) a.rbegin(),a.rend()
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define limit(x,l,r) max(l,min(x,r))
#define lims(x,l,r) (x = max(l,min(x,r)))
#define isin(x,l,r) ((l) <= (x) && (x) < (r))
#define pb push_back
#define eb emplace_back
#define sz(x) (int)(x).size()
#define pcnt __builtin_popcountll
#define uni(x) x.erase(unique(rng(x)),x.end())
#define show(x) cout<<#x<<" = "<<x<<endl;
#define print(x)cout<<x<<endl;
#define PQ(T) priority_queue<T,v(T),greater<T> >
#define bn(x) ((1<<x)-1)
#define dup(x,y) (((x)+(y)-1)/(y))
#define newline puts("")
#define v(T) vector<T>
#define vv(T) v(v(T))
using namespace std;
typedef long long int ll;
typedef unsigned uint;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef tuple<int,int,int> T;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
typedef vector<T> vt;
int main(){
  int a,b;
  cin >> a >> b;
  if(a%3 ==0 || b%3 == 0|| (a+b)%3 == 0)cout<<"Possible"<<endl;
  else cout<<"Impossible"<<endl;
  return 0;
}

Measured memory_bytes: 3568
#include <bits/stdc++.h>
#define INF 1000000000
#define ll long long
#define pll pair<ll, ll>
using namespace std;

ll N, M, V, P;
vector<ll> A;
bool check(ll m)
{
  // cout << "m" << m << endl;
  if (m < P)
  {
    return true;
  }
  if (A.at(m) + M < A.at(P - 1))
  {
    return false;
  }
  ll S = 0;
  S += (P - 1) * M;
  S += (N - m) * M;
  for (ll i = P - 1; i < m; ++i)
  {
    S += min(M, max(0ll, A.at(m) - A.at(i) + M));
  }
  if (S >= M * V)
  {
    return true;
  }
  return false;
}


int main()
{
  cin >> N >> M >> V >> P;
  A = vector<ll>(N);
  for (ll i = 0; i < N; ++i)
  {
    cin >> A.at(i);
  }
  sort(A.begin(), A.end());
  reverse(A.begin(), A.end());
  // cout << "A" << endl;
  // for (ll i = 0; i < N; ++i)
  // {
  //   cout << A.at(i) << ' ';
  // }
  // cout << endl;
  ll l = -1, r = N;
  ll m;
  while (l + 1 != r)
  {
    m = (l + r) / 2;
    if (check(m))
    {
      l = m;
    }
    else
    {
      r = m;
    }
  }
  cout << l + 1 << endl;
  // cout << "l" << l << endl;
}


Measured memory_bytes: 1152
#include <string>
#include <iostream>
#define size 10000000
typedef long long int ll;
int main()
{
  char str[size];
  ll z=0,o=0;
  for(ll i=0;i<size;i++) str[i]=='\n';
  scanf("%10000000s",str);
  for(ll i=0;str[i]!='\n';i++)
  {
    if(str[i]=='0')z++;
    if(str[i]=='1')o++;
  }
  if(z<=o) printf("%lld",z*2);
  else printf("%lld",o*2);
  return 0;
}

Measured memory_bytes: 512
#include<iostream>
#include<vector>
#include<algorithm>
#include<map>
#include<cstring>
#include<math.h>
#include<bitset>
#include<queue>
#include<set>
#include<iomanip>
#include<math.h>
// #include<bits/stdc++.h>
using namespace std;
#define ll long long
constexpr long long int INFLL = 1001001001001001LL;
constexpr int INFI = 1000000007;


int main(){
  int N,K;
  cin >> N >> K;
  vector<int> A(200010,0);
  for(int i=0; i<N; i++){
    int a;
    cin >> a;
    A[a]++;
  }
  sort(A.begin(),A.end(),greater<int>());
  int count=0;
  for(int i=0; i<200010; i++){
    if(A[i] == 0){
      break;
    }
    count++;
  }
  int ans=0;
  if(count <= K){
    cout << 0 << endl;
    return 0;
  }else{
    int x = count-K;
    for(int i=0; i<200010; i++){
      if(A[i+1] == 0){
        while(x>0){
          ans += A[i];
          i--;
          x--;
        }
        break;
      }
    }
  }
  cout << ans << endl;
  return 0;
}


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

using namespace std;

typedef long long int ll;

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

  ll n, k;
  cin >> n >> k;
  vector < ll > a(n + 1);
  for(int i = 1; i <= n; i++) cin >> a[i];
  ll ans = 0;
  vector < ll > p(n + 1, 0);
  queue < ll > q;
  map < ll, ll > mp;
  for(int i = 1; i < k && i <= n; i++){
    if(a[i] % k == 1) ans++;
    p[i] = p[i - 1] + a[i];
    ans += mp[(p[i] - i + k) % k];
    mp[(p[i - 1] - (i - 1) + k) % k]++;
    q.push((p[i - 1] - (i - 1) + k) % k);
  }

  for(int i = k; i <= n; i++){
    if(a[i] % k == 1) ans++;
    if(q.size() > 0){
      mp[q.front()]--;
      q.pop();
    }
    p[i] = p[i - 1] + a[i];
    ans += mp[(p[i] - i + k) % k];
    mp[(p[i - 1] - (i - 1) + k) % k]++;
    q.push((p[i - 1] - (i - 1) + k) % k);
  }

  cout << ans << endl;
}


Measured memory_bytes: 17536
#include<bits/stdc++.h>
typedef long long ll;
typedef unsigned long long ull;
using namespace std;
#define pb push_back
int dy[]={0, 0, 1, -1, 0};
int dx[]={1, -1, 0, 0, 0};
 
#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define RFOR(i,a,b) for (int i=(b)-1;i>=(a);i--)
#define REP(i,n) for (int i=0;i<(n);i++)
#define RREP(i,n) for (int i=(n)-1;i>=0;i--)
ll n;
ll a[200000];
int main(){
    scanf("%lld",&n);
    REP(i,n)
        scanf("%lld",&a[i]);
    ll x = a[0];
    ll y = 0;
    FOR(i,1,n)
        y += a[i];
    ll mini = abs(x - y);
    FOR(i,1,n-1){
        x += a[i];y -= a[i];
        mini = min(abs(x - y),mini);
    }
    printf("%lld\n",mini);
    return 0;
}



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

int main()
{
  int N,ind=1;
  string h,A[50],B[50],C[50],D[50];

  cin >> N;
  

  for(int i=1;i<=N;i++)
    {
      cin >> A[i];

      B[i] = A[i];

      C[i] = A[i];
    }


  for(int i=1;i<=15;i++)
    {
      for(int j=1;j<=N;j++)
	{
	  if(C[j][1]-'0' == i)
	    {
	      D[ind].clear();
	      D[ind].insert(0,C[j]);
	      ind++;
	    } 
	}
    }
  



  for(int i=1;i<=N;i++)
    {
      for(int j=N;j>=i+1;j--)
	{
	    
	  if(A[j][1]-'0' < A[j-1][1]-'0')
	    {
	      h.clear();
	      h.insert(0,A[j]);
	      A[j].clear();
	      A[j].insert(0,A[j-1]);
	      A[j-1].clear();
	      A[j-1].insert(0,h);
	    }
	}
    }

  bool stable=true;
  for(int i=1;i<=N;i++)
    {
      if(A[i] != D[i])
	{
	  stable=false;
	  break;
	}
    }

  for(int i=1;i<=N;i++)
    {
      cout << A[i];
      if(i != N)cout << " ";
    }
  cout << endl;
  if(stable)cout << "Stable" << endl;
  else cout << "Not stable" << endl;


  for(int i=1;i<=N;i++)
    {
      int mini=i;
      for(int j=i;j<=N;j++)
	{
	  if(B[j][1]-'0'<B[mini][1]-'0')
	    {
	      mini = j;
	    }
	}
      h.clear();
      h.insert(0,B[i]);
      B[i].clear();
      B[i].insert(0,B[mini]);
      B[mini].clear();
      B[mini].insert(0,h);
    }
 
  stable = true;
  for(int i=1;i<=N;i++)
    {
      if(B[i] != D[i])
	{
	  stable=false;
	  break;
	}
    }

  for(int i=1;i<=N;i++)
    {
      cout << B[i];
      if(i != N)cout << " ";
    }
  cout << endl;
  if(stable)cout << "Stable" << endl;
  else cout << "Not stable" << endl;

  return 0;
}

Measured memory_bytes: 0
#include<iostream>
#include<algorithm>
#include<list>
#include<vector>
#include <cstdio>
#include<string>
//static const int	RootParentID = -1;
static const int	NIL = -1;
class node {
private:
	int Parent;
	int LeftChild;
	int RightBro;
public:
	node() {
		Parent = LeftChild = RightBro = NIL;
	}


	void AddParent(int id) {
		Parent = id;
		return;
	}
	void AddRightBro(int id) {
		RightBro = id;
		return;
	}
	void AddLeftChild(int id) {
		LeftChild = id;
		return;
	}
	int GetParent() {
		return Parent;
	}
	int GetLeftChild() {
		return LeftChild;
	}
	int GetRightBro() {
		return RightBro;
	}
	int GetSibling(const std::vector<node> & nodes) {
		if (Parent != NIL) {
			
			if (RightBro != NIL) { return RightBro; }
			else {
				//std::cout << nodes[nodes[Parent].LeftChild].RightBro << std::endl;;
				return nodes[nodes[Parent].LeftChild].RightBro == NIL ? NIL : nodes[Parent].LeftChild;
			}
			
		}
		else return NIL;
	}
	int GetDegree(const std::vector<node> & nodes) {
		return LeftChild == NIL ? 0 : (nodes[LeftChild].RightBro == NIL ? 1 : 2);
	}
	int CheckDepth(const std::vector<node> & nodes) {
		int CheckNodeParent = Parent;
		int cnt = 0;
		while (CheckNodeParent != NIL) {
			++cnt;
			CheckNodeParent = nodes[CheckNodeParent].Parent;
		}
		return cnt;
	}
	int CheckHeight(const std::vector<node> & nodes, node id) {

		int CheckChildLeft = id.LeftChild, CheckChildRight = id.LeftChild == NIL ? NIL : nodes[id.LeftChild].RightBro;

		int h1 = 0, h2 = 0;
		if (CheckChildLeft != NIL) {

			h1 = CheckHeight(nodes, nodes[CheckChildLeft]) + 1;
		}
		if (CheckChildRight != NIL) {
			h2 = CheckHeight(nodes, nodes[CheckChildRight]) + 1;
		}
		return std::max(h1, h2);
	}
};
int main(void) {
	int n;
	std::cin >> n;
	int id;
	const int k = 2;
	int child;
	std::vector<node> nodes(n + 1);
	for (int i = 0; i < n; i++) {
		std::cin >> id;
		std::vector<int> v(k + 1);

		for (int j = 0; j < k; ++j) {
			std::cin >> child;
			v[j] = child;
		}
		v[k] = NIL;
		for (int j = 0; j < k; ++j) {
			if (v[j] == NIL) {
				std::swap(v[j],v[j+1]);
			}
		}

		for (int j = 0; j < k; ++j) {			
			if (v[j] != NIL) {
				nodes[v[j]].AddParent(id);
				nodes[v[j]].AddRightBro(v[j + 1]);

			}
		}
		nodes[id].AddLeftChild(v[0]);
	}
	for (int i = 0; i < n; ++i) {
		printf("node %d: parent = %d, sibling = %d, degree = %d, depth = %d, height = %d, %s\n", i, nodes[i].GetParent(), nodes[i].GetSibling(nodes), nodes[i].GetDegree(nodes), nodes[i].CheckDepth(nodes), nodes[i].CheckHeight(nodes, nodes[i]), (nodes[i].GetParent() == NIL ? "root" : (nodes[i].GetLeftChild() == NIL ? "leaf" : "internal node")));
	}
	//system("pause");
	return 0;
}

Measured memory_bytes: 3232
from bisect import bisect_left, bisect_right

N,Q = map(int,input().split())
S = input()
A = []
L = []

for i  in range(N-1):
    if S[i]=='A' and S[i+1]=='C':
        A.append(i)
        
for i in range(Q):
    L=list(map(int,input().split()))
    minA=bisect_left(A,L[0]-1)
    maxA=bisect_left(A,L[1]-1)
    print(maxA-minA)


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

vector<vector<bool>>graph(8,vector<bool>(8));

int dfs(int v,int n,vector<bool>&visited){
  bool all_visited= true;
  for(int i:visited){
    if(i!=true){
      all_visited =false;
    }
  }
  if(all_visited){
    return 1;
  }
  int rep=0;
  for(int i=0;i<n;i++){
    if(graph.at(v).at(i) ==false){
      continue;
    }
    if(visited.at(i)){
      continue;
    }
    visited.at(i) =true;
    rep +=dfs(i,n,visited);
    visited.at(i) =false;
  }
  return rep;
}
 
int main() {
  int n,m;
  cin >>n >>m;
  for(int i=0;i<m;i++){
    int a,b;
    cin >> a >>b;
    graph.at(a-1).at(b-1)=graph.at(b-1).at(a-1)=true;
  }
  vector<bool>visited(n);
  visited.at(0)=true;
  cout << dfs(0,n,visited);
}

Measured memory_bytes: 256
import java.util.*;

public class Main {

	public static void main(
			String[] args) {
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();
		System.out.println(a % 2 == 1 && b % 2 == 1 ? "Yes" : "No");
	}
}


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

const int N = 200000;
char s[N+5];

int main(){
    scanf("%s", s);
    int sn = strlen(s);
    int sum = 0;
    for (int i = 0; i < sn; ++i){
        sum = (sum + s[i] - '0') % 9;
    }
    printf(sum ? "No\n" : "Yes\n");
    return 0;
}

Measured memory_bytes: 3872
#include <bits/stdc++.h>
using namespace std;
#define INF 1<<30
#define endl '\n'
#define maxn 100005
#define tc printf("Case %d: ", cs)
#define tcn printf("Case %d:\n", cs);
#define FASTIO ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
typedef long long ll;
const double PI = acos(-1.0);

#define dbg1(x) cerr << #x << " = " << x << endl;
#define dbg2(x, y) cerr << #x << " = " << x << ", " << #y << " = " << y << endl;
#define dbg3(x, y, z) cerr << #x << " = " << x << ", " << #y << " = " << y << ", " << #z << " = " << z << endl;
#define dbg4(w,x, y, z) cerr << #w << " = " << w << ", " <<#x << " = " << x << ", " << #y << " = " << y << ", " << #z << " = " << z << endl;

template < typename F, typename S >
ostream& operator << ( ostream& os, const pair< F, S > & p ) {
	return os << "(" << p.first << ", " << p.second << ")";
}

template < typename T >
ostream &operator << ( ostream & os, const vector< T > &v ) {
	os << "{";
	for (auto it = v.begin(); it != v.end(); ++it) {
		if ( it != v.begin() ) os << ", ";
		os << *it;
	}
	return os << "}";
}

template < typename T >
ostream &operator << ( ostream & os, const set< T > &v ) {
	os << "[";
	for (auto it = v.begin(); it != v.end(); ++it) {
		if ( it != v.begin()) os << ", ";
		os << *it;
	}
	return os << "]";
}

template < typename F, typename S >
ostream &operator << ( ostream & os, const map< F, S > &v ) {
	os << "[";
	for (auto it = v.begin(); it != v.end(); ++it) {
		if ( it != v.begin() ) os << ", ";
		os << it -> first << " = " << it -> second ;
	}
	return os << "]";
}

#define dbg(args...) do {cerr << #args << " : "; faltu(args); } while(0)

clock_t tStart = clock();
#define timeStamp dbg("Execution Time: ", (double)(clock() - tStart)/CLOCKS_PER_SEC)

void faltu () { cerr << endl; }

template <typename T>
void faltu( T a[], int n ) {
	for (int i = 0; i < n; ++i) cerr << a[i] << ' ';
	cerr << endl;
}

template <typename T, typename ... hello>
void faltu( T arg, const hello &... rest) { cerr << arg << ' '; faltu(rest...); }
// Program showing a policy-based data structure.
#include <ext/pb_ds/assoc_container.hpp> // Common file 
#include <ext/pb_ds/tree_policy.hpp>
#include <functional> // for less 
#include <iostream>
using namespace __gnu_pbds;
using namespace std;
// GNU link : https://goo.gl/WVDL6g
typedef tree<int, null_type, less_equal<int>, rb_tree_tag,
        tree_order_statistics_node_update>
        new_data_set;

/**___________________________________________________**/



int main()
{
	FASTIO
	/*
#ifndef ONLINE_JUDGE
	freopen("in.txt", "r", stdin);
	freopen("out.txt", "w", stdout);
	freopen("error.txt", "w", stderr);
#endif
//*/
	ll n, m;
	cin >> n >> m;
	priority_queue<ll> PQ;
	for (int i = 0; i < n; i++) {
		ll x;
		cin >> x;
		PQ.push(x);
	}
	while (m--) {
		ll x = PQ.top();
		PQ.pop();
		PQ.push(x / 2);
	}
	ll ans = 0;
	while (!PQ.empty()) {
		ans += PQ.top();
		PQ.pop();
	}
	cout << ans << endl;
}

Measured memory_bytes: 1400
import java.util.*;

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

    String[] s = sc.next().split("");
    int l =  s.length;
    int count =0;
    for(int i=0; i<l; i++){
      if(s[i].equals("U")||s[i].equals("D")){
        count +=1;
        continue;
      }


      if(i%2==0){
        if(s[i].equals("R")){
          count += 1;
        }
      }else{
        if(s[i].equals("L")){
          count += 1;
        }
      }
    }
    if(count == l){
      System.out.println("Yes");
    }else{
      System.out.println("No");
    }




  }
}

Measured memory_bytes: 21844
#include<bits/stdc++.h>
#define r(i,n) for(int i=0;i<n;i++)
using namespace std;
typedef pair<int,int>P;
#define F first
#define S second
int main(){
	char a,b;
	cin>>a>>b;
	if(a==b)cout<<'=';
	else if(a>b)cout<<'>';
	else cout<<'<';
}

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

using namespace std;

#define ll  long long
#define vi  vector<int>
#define vvi vector<vi>
#define pi  pair<int,int>
#define mp  make_pair
#define pb  push_back
#define MOD 1e9 + 7
#define PAI  3.1415
#define all(x) (x).begin(),(x).end()
#define chmax(x,y) x = max(x,y)
#define chmin(x,y) x = min(x,y)
#define pr(x) cout << x << endl
#define Endl endl
#define rep(i,n) for(int i = 0 ; i < n; i++)

const int dx[4] = {1,0,-1,0};
const int dy[4] = {0,1,0,-1};
const int ddx[8] = {-1,0,1,-1,1,-1,0,1};
const int ddy[8] = {-1,-1,-1,0,0,1,1,1};
const int inf = 99999999;
const ll linf = 1LL << 62;

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

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

int main(){

  int n; cin >> n;
  vi v;
  vi cv;
  rep(i,n){
    int a;cin >> a;
    v.pb(a);
  }
  cv = v;
  sort(all(v));

  int mid = n / 2;

  rep(i,v.size()){
    if(cv[i] >= v[mid])pr(v[mid - 1]);
    else pr(v[mid]);
  }

  return 0;
}


Measured memory_bytes: 3828
import { readFileSync } from "fs";

// eslint-disable-next-line no-unused-vars
const range = (n: number | bigint) => [...Array(Number(n))].map((_, i) => i);
// eslint-disable-next-line no-unused-vars
const tuple = <T extends unknown[]>(...ts: T) => ts;
// eslint-disable-next-line no-unused-vars
const [cin, nCin, biCin] = (() => {
  const inputs = readFileSync("/dev/stdin", "utf-8").split(/[\n|\s]+/);
  let count = 0;
  const cin = () => inputs[count++];
  return tuple(
    cin,
    () => Number(cin()),
    () => BigInt(cin())
  );
})();

type Result = "AC" | "WA" | "TLE" | "RE";

{
  const n = nCin();
  const ss = range(n).map(() => cin() as Result);
  const map = (() => {
    const map: {
      [R in Result]: number;
    } = {
      AC: 0,
      WA: 0,
      TLE: 0,
      RE: 0,
    };
    ss.forEach((s) => map[s]++);
    return map;
  })();
  // (Object.keys(map) as Result[]).map((s) => `${s} x ${map[s]}`).forEach((msg) => console.log(msg));
  const results: Result[] = ["AC", "WA", "TLE", "RE"];
  results.map((s) => `${s} x ${map[s]}`).forEach((msg) => console.log(msg));
}


Measured memory_bytes: 42220