akhauriyash/Code-Regression huggingface dataset:
using System;

namespace AGC014A {
    public class Program {
        public static void Main(string[] args) {
            var sr = new StreamReader();
            //---------------------------------
            var A = sr.Next<int>();
            var B = sr.Next<int>();
            var C = sr.Next<int>();

            for(var i = 0; i < 114514; i++) {
                if(A % 2 == 1 || B % 2 == 1 || C % 2 == 1) {
                    Console.WriteLine(i);
                    return;
                }

                var na = (B + C) / 2;
                var nb = (C + A) / 2;
                var nc = (A + B) / 2;
                A = na;
                B = nb;
                C = nc;
            }

            Console.WriteLine(-1);
            //---------------------------------
        }
    }

    public class StreamReader {
        private readonly char[] _c = { ' ' };
        private int _index = -1;
        private string[] _input = new string[0];
        private readonly System.IO.StreamReader _sr = new System.IO.StreamReader(Console.OpenStandardInput());

        public T Next<T>() {
            if(_index == _input.Length - 1) {
                _index = -1;
                while(true) {
                    string rl = _sr.ReadLine();
                    if(rl == null) {
                        if(typeof(T).IsClass) return default(T);
                        return (T)typeof(T).GetField("MinValue").GetValue(null);
                    }
                    if(rl != "") {
                        _input = rl.Split(_c, StringSplitOptions.RemoveEmptyEntries);
                        break;
                    }
                }
            }
            return (T)Convert.ChangeType(_input[++_index], typeof(T), System.Globalization.CultureInfo.InvariantCulture);
        }

        public T[] Next<T>(int x) {
            var ret = new T[x];
            for(var i = 0; i < x; ++i) ret[i] = Next<T>();
            return ret;
        }

        public T[][] Next<T>(int y, int x) {
            var ret = new T[y][];
            for(var i = 0; i < y; ++i) ret[i] = Next<T>(x);
            return ret;
        }
    }
}

Measured memory_bytes: 13140
package main

import "fmt"

func main() {
	var s string
	var cnt int

	fmt.Scan(&s)
	if s[0] == '1' {
		cnt++
	}
	if s[1] == '1' {
		cnt++
	}
	if s[2] == '1' {
		cnt++
	}
	fmt.Println(cnt)
}


Measured memory_bytes: 512
import java.io.*;
import java.util.*;
import java.util.stream.*;

class Main{
	static final long MOD = 1_000_000_007; // 10^9+7
    static final int MAX = 2_147_483_646; // intMax 
    static final int INF = 1_000_000_000; // 10^9  
    public static void main(String[] args) throws Exception {
		hayami saori = new hayami();
		
		String s = saori.nextHayami();
	if(s.equals("ABC")){
		System.out.println("ARC");
	} else {
		System.out.println("ABC");
	}
		
		saori.close();
    }
}

class hayami implements Closeable {
	private final InputStream in = System.in;
	private final byte[] hayami = new byte[1024];
	private int Hayami = 0;
	private int saori = 0;
	private boolean HayamiSaori() {
		if (Hayami < saori) {
			return true;
		}else{
			Hayami = 0;
			try {
				saori = in.read(hayami);
			} catch (IOException e) {
				e.printStackTrace();
			}
			if (saori <= 0) {
				return false;
			}
		}
		return true;
	}
	private int SaoriHayami() { 
		if (HayamiSaori()) {
            return hayami[Hayami++];
         }else{
             return -1;
         }
	}
	private static boolean hayami_saori(int hayami) { 
		return 33 <= hayami && hayami <= 126;
	}
	public boolean hayamisaori() { 
		while(HayamiSaori() && !hayami_saori(hayami[Hayami])) Hayami++; return HayamiSaori();
	}
	public String nextHayami() {
		if (!hayamisaori()) throw new NoSuchElementException();
		StringBuilder hayamin = new StringBuilder();
		int saori = SaoriHayami();
		while(hayami_saori(saori)) {
			hayamin.appendCodePoint(saori);
			saori = SaoriHayami();
		}
		return hayamin.toString();
	}
	public long saorihayami() {//nextLong
		if (!hayamisaori()) throw new NoSuchElementException();
		long hayami = 0;
		boolean misao = false;
		int saori = SaoriHayami();
		if (saori == '-') {
			misao = true;
			saori = SaoriHayami();
		}
		if (saori < '0' || '9' < saori) {
			throw new NumberFormatException();
		}
		while(true){
			if ('0' <= saori && saori <= '9') {
				hayami *= 10;
				hayami += saori - '0';
			}else if(saori == -1 || !hayami_saori(saori)){
				return misao ? -hayami : hayami;
			}else{
				throw new NumberFormatException();
			}
			saori = SaoriHayami();
		}
	}
	public int saori_hayami() {//nextInt
		long hayami = saorihayami();
		if (hayami < Integer.MIN_VALUE || hayami > Integer.MAX_VALUE) throw new NumberFormatException();
		return (int) hayami;
	}
	public double Hayamin() { //nextDouble
		return Double.parseDouble(nextHayami());
	}
	public void close() {
		try {
			in.close();
		} catch (IOException e) {
		}
    }
    
}

Measured memory_bytes: 32416
#include <bits/stdc++.h>
using namespace std;
int main(void){
    int n,x;
    long long int ans=0;
    cin>>n>>x;
    vector<int> candy(n,0);
    for(int i=0;i<n;i++){
        cin>>candy[i];
    }
    if(candy[0]>x){
        ans+=candy[0]-x;
        candy[0]=x;
    }
    for(int i=1;i<n;i++){
        if((candy[i-1]+candy[i])>x){
            ans+=candy[i]+candy[i-1]-x;
            candy[i]-=candy[i]+candy[i-1]-x;
            
        }
    }
    cout<<ans<<endl;
}


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

int main()  {

    double lines[10], t, v1, v2, maxv, sumv, rv1;
    int idx = -1;
    while (scanf("%lf", &lines[0]) != EOF) {
        for (int i = 1; i < 10; i++) {
            scanf(",%lf", &t);
            lines[i] = lines[i-1]+t;
        }
        scanf(",%lf,%lf", &v1, &v2);
        maxv = max(v1, v2);
        sumv = v1+v2;
        while (lines[9] < maxv) {
            for (int i = 0; i < 10; i++) lines[i] *= 10;
        }
        rv1 = lines[9]*v1/sumv;
        for (int i = 0; i < 10; i++) if (lines[i] >= rv1) { idx = i+1; break; }
        printf("%d\n", idx);


    }
    return 0;
}



Measured memory_bytes: 2684
#include<bits/stdc++.h>
using namespace std;
int main(){
  string S;
  cin >> S;
  bool flag = true;
  if(S.at(2) != S.at(3)){
    flag = false;
  }
  if(S.at(4) != S.at(5)){
    flag = false;
  }
  if(flag){
    cout << "Yes" << endl;
  }
  else{
    cout << "No" << endl;
  }
}

Measured memory_bytes: 256
N, M = map(int, input().split())
c = [0] * M
for i in range(N):
    K, *A = map(int, input().split())
    # print(A)
    for j in A:
        c[j - 1] += 1
# print(c)
ans = 0
for i in range(M):
    if c[i] == N:
        ans += 1
print(ans)


Measured memory_bytes: 2940
#include<bits/stdc++.h>
using namespace std;
#define ll long long
int main()
{
    int n,a,b;
    cin >> n >> a >> b;
    int t=b/n*n;
    if(a<=t && t<=b)
        printf("OK");
    else
        printf("NG");
    return 0;
}


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

#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define ITR(x,c) for(__typeof(c.begin() x=c.begin();x!=c.end();x++)
#define RITR(x,c) for(__typeof(c.rbegin() x=c.rbegin();x!=c.rend();x++)
#define setp(n) fixed << setprecision(n)

#define lf double
#define ll long long
#define vll vector<ll>
#define vi vector<int>
#define pll pair<ll,ll>
#define pi pair<int,int>

#define all(a) (a.begin()),(a.end())
#define rall(a) (a.rbegin()),(a.rend())
#define fi first
#define se second
#define pb push_back
#define mp make_pair

using namespace std;

int main(void)
{
	cin.tie(0);
	ios::sync_with_stdio(false);
	ll a, b, q;
	cin >> a >> b >> q;
	vll s(a), t(b);
	rep(i, a) cin >> s[i];
	rep(i, b) cin >> t[i];
	s.pb(1e11);
	s.insert(s.begin(), -1e11);
	t.pb(1e11);
	t.insert(t.begin(), -1e11);
	rep(i, q){
		ll ans = LONG_LONG_MAX;
		ll x; cin>>x;
		ll S[2], T[2];
		vll::iterator left, right;
		right = upper_bound(s.begin(), s.end(), x);
		left = right-1;
		S[0] = (*left), S[1] = (*right);
		right = upper_bound(t.begin(), t.end(), x);
		left = right-1;
		T[0] = (*left), T[1] = (*right);
		rep(j, 2){
			rep(k, 2){
				ll mini, sum=0;
				mini = min(abs(x-S[j]), abs(x-T[k]));
				sum = mini + abs(S[j]-T[k]);
				ans = min(ans, sum);
			}
		}
		cout << ans << endl;
	}
	return 0;
}

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

using ll = long long;

const ll MOD = 1e9 + 7;

int N, M;
string S;

int main() {
	ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	cin >> N >> M >> S;
	if (S[0] == 'B') {
		for (char& c : S) {
			c ^= 'B' ^ 'R';
		}
	}
	assert(S[0] == 'R');

	if (S == string(M, S[0])) {
		// there are no consecutive Bs
		array<array<ll, 2>, 2> dp = {};
		dp[0][0] = dp[1][1] = 1;
		for (int i = 1; i < N; i++) {
			array<array<ll, 2>, 2> ndp = {};
			for (int a = 0; a < 2; a++) {
				for (int b = 0; b < 2; b++) {
					for (int c = 0; c < 2; c++) {
						if (b || c) {
							ndp[a][c] = (ndp[a][c] + dp[a][b]) % MOD;
						}
					}
				}
			}
			swap(dp, ndp);
		}

		ll ans = 0;
		for (int a = 0; a < 2; a++) {
			for (int b = 0; b < 2; b++) {
				if (a || b) {
					ans = (ans + dp[a][b]) % MOD;
				}
			}
		}
		cout << ans << endl;
		return 0;
	}

	if (N % 2 == 1) {
		cout << 0 << endl;
		return 0;
	}

	bool foundBlue = false;
	int maxRed = N-1;
	int cntRed = 0;
	for (char c : S) {
		if (c == 'R') {
			cntRed++;
		} else {
			assert(c == 'B');
			if (foundBlue) {
				if (cntRed % 2 == 1) {
					maxRed = min(maxRed, cntRed);
				}
			} else {
				maxRed = min(maxRed, cntRed + 1);
			}
			foundBlue = true;
			cntRed = 0;
		}
	}

	assert(maxRed >= 1);
	maxRed = (maxRed + 1) / 2;
	N /= 2;

	vector<ll> dp(N+1);
	dp[0] = 1;
	ll sum = dp[0];
	for (int i = 1; i <= N; i++) {
		if (i - maxRed - 1 >= 0) sum = (sum - dp[i - maxRed - 1] + MOD) % MOD;
		dp[i] = sum;
		sum = (sum + dp[i]) % MOD;
	}

	ll ans = 0;
	for (int i = 1; i <= maxRed; i++) {
		ans = (ans + i * dp[N - i]) % MOD;
	}
	ans = ans * 2 % MOD;
	cout << ans << endl;

	return 0;
}

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

#define N 100000

int main(void){
    vector<bool> prime(N+1,true);
    prime[0]=prime[1]=false;
    for (size_t i = 2; i*i <= N; i++)
    {
        if (prime[i])
        {
            for (size_t j = 2; i*j <= N; j++)
            {
                prime[i*j]=false;
            }
        }
    }
    int likeCnt[N+1];
    for (size_t i = 3; i <= N; i+=2)
    {
        likeCnt[i]=likeCnt[i-1];
        if (i%2==1&&prime[i]&&prime[(i+1)/2]) likeCnt[i]++;
        likeCnt[i+1]=likeCnt[i];
    }
    /**************************************/
    int q;
    scanf("%d", &q);
    int l,r;
    for (size_t i = 0; i < q; i++)
    {
        scanf("%d%d", &l, &r);
        printf("%d\n", likeCnt[r] - likeCnt[l-1]);
    }
    return 0;
}

Measured memory_bytes: 1024
#include <algorithm>
#include <array>
#include <cmath>
#include <deque>
#include <iomanip>
#include <iostream>
#include <limits>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <utility>

using namespace std;

typedef long long ll;

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

  cout << ((x >= 30) ? "Yes" : "No") << endl;

  return 0;
}


Measured memory_bytes: 3056
fun main(args: Array<String>) {
    val s = readLine()!!
    val (n, a, b, c, d) = s.split(" ").map(String::toLong)        // 3≤N≤500000, 0≤AB≤10^9, 0≤C≤D≤10^9


    val difference = b - a
    var result = false
    // n-1回値の変更がある。
    // そのうち値の増える変更がincrement回あれば減る変更は、n-1 - increment回ある。
    for (increment in 0..n-1) {
        val decrement = n - 1 - increment
        val max = increment * d - decrement * c
        val min = increment * c - decrement * d
        if (difference in min..max) {
            result = true
            break
        }
    }

    println(if (result) "YES" else "NO")
}


Measured memory_bytes: 40692
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <numeric>
#include <utility>
#include <string>

using namespace std;

const int inf = 1e9;

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

	vector<int> c(n);
	vector<vector<int>> a(n, vector<int>(m, 0));
	for (int i = 0; i < n; i++) {
		cin >> c[i];
		for (int j = 0; j < m; j++) {
			cin >> a[i][j];
		}
	}

	int ans = inf;
	int limit = 1 << n;
	for (int i = 0; i < limit; i++) {
		vector<int> v(m, 0);
		int cost = 0;
		for (int j = 0; j < n; j++) {
			if ((i >> j & 1)) {
				cost += c[j];
				for (int k = 0; k < m; k++) {
					v[k] += a[j][k];
				}
			}
		}

		bool ok = true;
		for (auto y: v) {
			if (y < x) {
				ok = false;
				break;
			}
		}
		if (ok) {
			ans = min(ans, cost);
		}
	}
	if (ans == inf) {
		ans = -1;
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 3192
#include <cstdio>
#include <algorithm>
#include <cstring>
#include <iostream>
#include <utility>

#define loop(n) for(ll i=0;i<n;i++)

using namespace std;

typedef long long int ll;

int main() {
    ll a,b,c,n;
    cin >> n;
    b=0;
    c=1000000000;
    loop(n) {
        cin>>a;
        b=max(b,a);
        c=min(c,a);
    }
    cout<<b-c;
}

Measured memory_bytes: 256
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int count = sc.nextInt();
        int maxHeight = sc.nextInt();
        int ableToRide = 0;
        for (int i = 0; i < count; i++) {
            if (sc.nextInt() >= maxHeight) {
                ableToRide++;
            }
        }
        sc.close();

        System.out.println(ableToRide);
    }
}

Measured memory_bytes: 48064
#include<bits/stdc++.h>
#define int long long
using namespace std;
signed main(){
	int a,b,k;
	cin>>a>>b>>k;
	int sum=0;
	for(int i=min(a,b);i>0;i--){
	    if(a%i==0&&b%i==0){
	        sum++;
	    }
	    if(sum==k){
	        cout<<i<<endl;
	        return 0;
	    }
	}
}

Measured memory_bytes: 256
#pragma target("avx")
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> P;
typedef vector<ll> V;
typedef unordered_map<ll, ll> U_MAP;
typedef priority_queue<ll> pq;
typedef priority_queue<ll, vector<ll>, greater<ll>> rpq;
constexpr ll INF = 1e9, MOD = 1e9 + 7, ohara = 1e6 + 10;
constexpr ll LINF = 1e18;

#define rep(i, n) for (ll(i) = 0; (i) < (int)(n); (i)++)
#define rrep(i, a, b) for (ll i = (a); i < (b); i++)
#define rrrep(i, a, b) for (ll i = (a); i >= (b); i--)
#define all(v) (v).begin(), (v).end()
#define Size(n) (n).size()
#define Cout(x) cout << (x) << endl
#define doublecout(a) cout << fixed << setprecision(15) << a << endl;
#define fi first
#define se second
#define m_p make_pair
#define p_b push_back
string to_string(string s) { return '"' + s + '"'; }
string to_string(const char* s) { return to_string((string)s); }
string to_string(bool b) { return (b ? "true" : "false"); }
template <typename A, typename B>
string to_string(pair<A, B> p) {
  return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";
}
template <typename A>
string to_string(A v) {
  bool first = true;
  string res = "{";
  for (const auto& x : v) {
    if (!first) {
      res += ", ";
    }
    first = false;
    res += to_string(x);
  }
  res += "}";
  return res;
}
void debug_out() { cerr << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cerr << " " << to_string(H);
  debug_out(T...);
}
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)

//------ Believe yourself as a genius!!!!!! ------

int dy[] = {1, 0, -1, 0};
int dx[] = {0, 1, 0, -1};
// int dy[]={-1,0,1,-1,1,-1,0,1};int dx[]={-1,-1,-1,0,0,1,1,1};
string alph("abcdefghijklmnopqrstuvwxyz"), s;
ll n, cnt, ans, a[ohara], b[ohara], c, d, tmp, m, h, w, x, y, sum, k, q;
P p[ohara];
pq que;

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

  cin >> n >> m;
  rep(i, n) { cin >> p[i].fi >> p[i].se; }
  sort(p, p + n);
  rep(i, n) a[i] = p[i].fi, b[i] = p[i].se;
  ll now = 0;
  rrrep(i, m - 1, 0) {
    tmp = m - i;
    // tmp以下を取れる
    rrep(j, now, n) {
      if (tmp >= a[j]) {
        now++;
        que.push(b[j]);
      } else
        break;
    }
    if (!que.empty()) {
      ans += que.top();
      que.pop();
    }
  }
  Cout(ans);
  return 0;
}

Measured memory_bytes: 9080
import sys
s = list(input())
t = list(input())
a = [-1 for _ in range(26)]
b = [-1 for _ in range(26)]

for i in range(len(s)):
    num0, num1 = a[ord(s[i])-97], b[ord(t[i])-97]
    if num0 >= 0:
        if chr(num0+97) != t[i]:
            print('No')
            sys.exit()
    else:
        a[ord(s[i])-97] = ord(t[i])-97
        
    if num1 >= 0:
        if chr(num1+97) != s[i]:
            print('No')
            sys.exit()
    else:
        b[ord(t[i])-97] = ord(s[i])-97
            
print('Yes')


Measured memory_bytes: 12600
function Main(input) {
	// 1行目がinput[0], 2行目がinput[1], …に入る
	input = input.split("\n");
	for(var i = 0;i<input.length;i++){
	    input[i] = input[i].split(" ");
	}
	
	var str = input[0][0];
	var strarr = str.split("");
	
	var count = {};
	for(var i = 0;i<strarr.length;i++){
	    if(!count[strarr[i]]){
	        count[strarr[i]] = 1;
	    }else{
	        count[strarr[i]]++;
	    }
	}
	var result = "Yes";
	for(key in count){
	    if(count[key] % 2 != 0){
	        result = "No";
	    }
	}
	//出力
    console.log(result);
}
//*この行以降は編集しないでください（標準入出力から一度に読み込み、Mainを呼び出します）
Main(require("fs").readFileSync("/dev/stdin", "utf8"));

Measured memory_bytes: 21364
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
using namespace std;
typedef long long LL;

int main(){
    string s;
    cin>>s;
    int a=stoi(s.substr(5,2));
    if(a<=4){
        cout<<"Heisei"<<endl;
    }else if(a>4){
        cout<<"TBD"<<endl;
    }
}


Measured memory_bytes: 256
#include<iostream>
#include <stdio.h>
#include <string.h>

using namespace std;
int main()
{
	char a[11], b[11], c[11];
	cin >> a >> b >> c;

	int ia, ib, ic;

	ia = strlen(a);
	ib = strlen(b);
	ic = strlen(c);

	char enda, firstb, endb, firstc;
	
	enda = a[ia-1];
	firstb = b[0];
	endb = b[ib - 1];
	firstc = c[0];

	if (enda == firstb && endb == firstc)
		cout << "YES";

	else
		cout << "NO";

	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(void)
{
        int a,b,i;

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

        if (b==100)
                a=a*1000;
        else if ((b<100)&&(b>9))
                a=a*100;
        else
                a=a*10;

        for (i=2;i<(a+b);i++){
                if ((a+b)==(i*i)){
                        printf("Yes\n");
                        return 0;
                }
        }
        
        printf("No\n");

 return 0;
}

Measured memory_bytes: 128
def get_i() #空白区切の入力を数値(整数)の配列で返す
  return gets.chomp.split(" ").map(&:to_i)
end
def get_f() #空白区切の入力を数値(実数)の配列で返す
  return gets.chomp.split(" ").map(&:to_f)
end
def get() #空白区切の入力を文字列の配列で返す
  return gets.chomp.split(" ")
end
def get_nsp() #入力されたものを一文字ずつに区切った文字列の配列で返す
  return gets.chomp.split("")
end
def yn_judge(bool,y="Yes",n="No") #boolに真偽を投げることで、trueならy、falseならnの値を出力する
  return bool ? y : n 
end
def array(size1,init=nil,size2=1) #size2に二次元配列時の最初の要素数、size1に次の配列の大きさ、initに初期値を投げることでその配列を返す
  if size2==1
    return Array.new(size1){init}
  else
    return Array.new(size2){Array.new(size1){init}}
  end
end

N=gets.to_i
a=get_i

negative_cnt=0
N.times do|i|
    negative_cnt+=1 if a[i]<0
    a[i]=a[i].abs
end
if negative_cnt.odd?
    puts a.inject(0){|res,x| res+x.abs}-a.min*2
else
    puts a.inject(0){|res,x| res+x.abs}
end

Measured memory_bytes: 9740
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
const int inf=1e9+7;
const ll longinf=1LL<<60 ;
const ll mod=1e9+7 ;

int main(){
    long double a, b, x;
    cin >> a >> b >> x;
    
    long double theta;
    if(x >= a*a*b/2)
        theta = atan(2*(a*a*b - x)/(a*a*a));
    else
        theta = M_PI / 2 - atan(2*x/(a*b*b));
    
    cout << fixed << setprecision(10) << theta * 180 / M_PI << "\n";
}

Measured memory_bytes: 256
import itertools

n = int(input())
p = list(map(int, input().split()))
q = list(map(int, input().split()))

list_range = list(range(1,n+1))
pattern_list = list(itertools.permutations(list_range, n))
pattern_list.sort()
ans = [0] * 2
for i in range(len(pattern_list)):
  if p == q:
    break
  elif p == list(pattern_list[i]):
    ans[0] = i + 1
  elif q == list(pattern_list[i]):
    ans[1] = i + 1
print(abs(ans[0] - ans[1]))

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

int main(){
	cin.tie(0),ios::sync_with_stdio(false);
	int q; cin>>q;
	vector<int>v;
	for(int i=0;i<q;++i){
		int query; cin>>query;
		if(query==2)v.pop_back();
		else{
			int xp; cin>>xp;
			if(query==0)v.emplace_back(xp);
			else cout<<v.at(xp)<<"\n"s;
		}
	}
}


Measured memory_bytes: 3948
#include<bits/stdc++.h>
#define ll long long int
#define ld long double
#define pb push_back
#define forn(i, n) for (int i = 0; i < int(n); i++)
#define mod 998244353
#define MAX 100009
#define endl '\n'
#define mp make_pair
#define INF 1000000000
#define fast ios_base::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL);

using namespace std;

int main() {
	fast
	ll n;
	cin>>n;
	ll a[n-1];
	forn(i,n-1)	cin>>a[i];
	ll c[n+1]={0};
	forn(i,n-1){
		c[a[i]]++;
	}
	for(ll i=1;i<=n;i++)	cout<<c[i]<<endl;
}
//cout<<"Case #"<<x<<": "<<ans<<endl;
//x++;

Measured memory_bytes: 6772
using System;
using System.Linq;

namespace ConsoleApp1
{
    class Program
    {
        static void Main(string[] args)
        {

            var a = Console.ReadLine().Split(' ');
            var b = Console.ReadLine().Split(' ');
            var c = Console.ReadLine().Split(' ');
            var d = int.Parse(Console.ReadLine());


            int[] A = a.Select(int.Parse).ToArray();
            int[] B = b.Select(int.Parse).ToArray();
            int[] C = c.Select(int.Parse).ToArray();


            for (int q = 0; q < d; q++)
            {


                var e = int.Parse(Console.ReadLine());
                if (A[0] == e)
                {
                    A[0] = 0;
                }
                else if (A[1] == e)
                {
                    A[1] = 0;

                }
                else if (A[2] == e)
                {
                    A[2] = 0;

                }
                else if (B[0] == e)
                {
                    B[0] = 0;
                }
                else if (B[1] == e)
                {
                    B[1] = 0;
                }
                else if (B[2] == e)
                {
                    B[2] = 0;

                }
                else if (C[0] == e)
                {
                    C[0] = 0;
                }
                else if (C[1] == e)
                {
                    C[1] = 0;

                }
                else if (C[2] == e)
                {
                    C[2] = 0;

                }

            }
            var E = A[0] + A[1] + A[2];
            var F = B[0] + B[1] + C[2];
            var G = C[0] + C[1] + C[2];
            var H = A[0] + B[0] + C[0];

            var I = A[1] + B[1] + C[1];

            var J = A[2] + B[2] + C[2];

            var K = A[0] + B[1] + C[2];

            var L = A[2] + B[1] + C[0];
            if (E == 0 || F == 0 || G == 0 || H == 0 || I == 0 || J == 0 || K == 0 || L == 0)
            {
                Console.WriteLine("Yes");
            }
            else
            {
                Console.WriteLine("No");
            }
        }
    }
}


Measured memory_bytes: 13396
#include <bits/stdc++.h>
#define For(i,a,b) for(int i=a;i<=b;i++)
#define F first
#define S second
#define INF 1e12
#define all(x) (x).begin(),(x).end()
#define sz(x) ((int)(x).size())
using namespace std;
typedef unsigned long long ll;
typedef pair<int,int> pii;

#define int ll

int power(int b,int p)
{
	if(p==0) return 1;
	if(p==1) return b;
	int tmp=power(b,p/2);
	if(p%2) return tmp*tmp*b;
	return tmp*tmp;
}

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

#define MAXN 100010
struct disjoint
{
	int nod[MAXN];
	int siz[MAXN];
	int n;
	disjoint(int len)
	{
		n=len;
		For(i,0,len-1)
		{
			nod[i]=i;
			siz[i]=1;
		}
	}
	int par(int a)
	{
		if(nod[a]==a) return a;
		nod[a]=par(nod[a]);
		return nod[a];
	}
	int ask(int a)
	{
		int p=par(a);
		return siz[p];
	}
	void add(int a,int b)
	{
		int pa=par(a),pb=par(b);
		nod[pa]=pb;
		siz[pb]=siz[pa]+siz[pb];
	}
};

int32_t main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	
	int n,m; cin>>n>>m;
	disjoint dj(n);
	pii edge[m];
	For(i,0,m-1)
	{
		cin>>edge[i].F>>edge[i].S;
		edge[i].F--;
		edge[i].S--;
	}
	ll now=(n*(n-1))/2;
	ll ans[m]; ans[m-1]=now;
	for(int i=m-1;i>0;i--)
	{
		if(dj.par(edge[i].F)==dj.par(edge[i].S))
		{
			ans[i-1]=ans[i];
			continue;
		}
		ll del=dj.ask(edge[i].F)*dj.ask(edge[i].S);
		if(del>now)
		{
			For(j,0,i) ans[j]=0;
			break;
		}
		now-=del;
		ans[i-1]=now;
		dj.add(edge[i].F,edge[i].S);
	}
	ll l=0;
	For(i,0,m-1) cout<<max(ans[i],l)<<"\n";
	return 0;
}











Measured memory_bytes: 4480
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main{


	public static void main(String[] args){

		BufferedReader reader=new BufferedReader(new InputStreamReader(System.in));

		try{

			String str=reader.readLine();
			String[] str_Array=str.split(" ");

			int a=Integer.parseInt(str_Array[0]);
			int b=Integer.parseInt(str_Array[1]);
			int c=Integer.parseInt(str_Array[2]);
			int count=0;
			for(int i=a;i<=b;i++){
				if(c%i==0)count++;
			}
			System.out.println(count);
			reader.close();


		}catch(IOException e){
			System.out.println("??¨??????:"+e);

		}

	}

}

Measured memory_bytes: 24408
#include<stdio.h>
int main(){
	long long t=0,sum=0,n,k[200010],s[200010];
	scanf("%lld",&n);
	for(int i=1;i<=n;i++){
		scanf("%lld%lld",&k[i],&s[i]);
		sum+=k[i]*s[i];
		t+=s[i];
	}
	if(sum%9==0) printf("%lld",sum/9+t-2);
	else printf("%lld",sum/9+t-1);
	return 0;
}

Measured memory_bytes: 3328
#include<stdio.h>
int main()
{
	int n;
	scanf("%d",&n);
	int flag=0;
	for(int i=0;i<=25;i++)
	for(int j=0;j<=15;j++)
	if(4*i+7*j==n) {
		flag=1;
		break;
		
	}
	if(flag) printf("Yes");
	else  printf("No");
	
	
	
}

Measured memory_bytes: 128
import java.util.*;

class Main {
    // 150d
    static final long MOD = 1_000_000_007;
    static final int MAX = 2000000000;
    static final int INF = 100000000;

    public static void main(String args[]) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int m = sc.nextInt();
        long ans = n - m;
        if(n == m){
            ans = modfact(n) * modfact(m) * 2 % MOD ;
        } else if(n-1 == m||n+1 == m){
            ans = modfact(n) * modfact(m) % MOD;
        } else{
            ans = 0;
        }

        System.out.println(ans);

    }

    static long modfact(long i) {
        long ans = 1;
        for(long j = i;j > 0;j--){
            ans = ans * j % MOD;
        }
        return ans;
    }

}


Measured memory_bytes: 23764
s=list(input())
s2=[]
ans=[]
x=0
for i in range(len(s)-1):
  if s[i]=='L' and s[i+1]=='R':
    s2.append(s[x:i+1])
    x=i+1
s2.append(s[x:len(s)])
for i in range(len(s2)):
  y=0
  for j in range(len(s2[i])-1):
    if s2[i][j]=='R' and s2[i][j+1]=='L':
      y=j
  zr=0
  zl=0
  for k in range(len(s2[i])):
    if s2[i][k]=='R':
      if (y-k)%2==1:
        zl+=1
      else:
        zr+=1
    else:
      if (y-k)%2==1:
        zl+=1
      else:
        zr+=1
  for m in range(len(s2[i])):
    if m==y:
      ans.append(str(zr))
    elif m==y+1:
      ans.append(str(zl))
    else:
      ans.append('0')
print(' '.join(ans))

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

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

using namespace std;
using lint=long long;

int main(){
	int n; scanf("%d",&n);
	vector<lint> a(n);
	rep(i,n) scanf("%lld",&a[i]);

	if(count(a.begin(),a.end(),0)>0) return puts("0"),0;

	lint ans=1;
	rep(i,n){
		if(ans>1000000000000000000LL/a[i]) return puts("-1"),0;
		ans*=a[i];
	}
	printf("%lld\n",ans);

	return 0;
}


Measured memory_bytes: 4056
#include <iostream>
#include <algorithm>
#include <queue>
using namespace std;

const int INF = (1<<29);

const int dy[2][6] = {{1,0,-1,-1,-1,0},{1,1,0,-1,0,1}};
const int dx[6] = {0,1,1,0,-1,-1};
int wmin,hmin,wmax,hmax;

class state{
public:
  int y,x,t,cost;
  state(int y=0, int x=0, int t=0, int c=0):y(y),x(x),t(t),cost(c){}
  bool operator < (const state &s) const {
    return cost > s.cost;
  }
};

bool check(int y, int x){
  if(y < hmin || y > hmax) return false;
  if(x < wmin || x > wmax) return false;
  return true;
}

int main(){
  int sx,sy,gx,gy;
  while(cin >> sx >> sy >> gx >> gy){
    sx += 100;
    sy += 100;
    gx += 100;
    gy += 100;
    int n, h, w, a[6][201][201], ans=INF;
    state u(sy,sx,0,0), v;
    priority_queue<state> Q;
    for(int i=0;i<6;i++) for(int j=0;j<201;j++) for(int k=0;k<201;k++) a[i][j][k] = INF;
    a[0][sy][sx] = 0;

    cin >> n;
    for(int i=0;i<n;i++){
      int x,y;
      cin >> x >> y;
      x += 100;
      y += 100;
      for(int j=0;j<6;j++) a[j][y][x] = -1;
    }
    cin >> w >> h;
    wmin = 100 - w;
    wmax = 100 + w;
    hmin = 100 - h;
    hmax = 100 + h;

    for(Q.push(u); !Q.empty();){
      u = Q.top();
      Q.pop();
      if(u.y == gy && u.x == gx){
	ans = u.cost;
	break;
      }
      
      int next = abs((u.x-100) * (u.y-100) * u.t) % 6;
      v = u;
      v.y += dy[u.x%2][next];
      v.x += dx[next];
      v.t++;
      if(check(v.y,v.x) && a[v.t%6][v.y][v.x] > v.cost){
	a[v.t%6][v.y][v.x] = v.cost;
	Q.push(v);
      }

      v = u;
      v.t++;
      v.cost++;
      if(check(v.y,v.x) && a[v.t%6][v.y][v.x] > v.cost){
	a[v.t%6][v.y][v.x] = v.cost;
	Q.push(v);
      }

      for(int i=0;i<6;i++){
	if(i == next) continue;
	v = u;
	v.y += dy[u.x%2][i];
	v.x += dx[i];
	v.t++;
	v.cost++;
	if(check(v.y,v.x) && a[v.t%6][v.y][v.x] > v.cost){
	  a[v.t%6][v.y][v.x] = v.cost;
	  Q.push(v);
	}
      }
    }

    if(ans == INF) cout << -1 << endl;
    else cout << ans << endl;
  }
}

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

int main() {
  int A,B,C,N;
  cin >> A >> B >> C >> N;
  int sum;
  for(int i=0; i<7; i++) {
    if (A >= B) {
      B = B*2;
      sum++;
    }
    else {
      break;
    }
  }
  for(int i=0; i<7; i++) {
    if (B >= C) {
      C = C*2;
      sum++;
    }
    else {
      break;
    }
  }
  if (sum > N) {
    cout << "No" << endl;
  }
  else {
    cout << "Yes" << endl;
  }
}

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

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

#define ull unsigned long long int
#define ll long long int
#define ld long double
#define pb push_back
#define eb emplace_back
#define all(x) x.begin(),x.end()
#define MOD (ull)(double)(1e9 + 7)
#define pii pair<int, int>
#define pll pair<ll, ll>
#define vi vector<int>
#define vb vector<bool>
#define vd vector<double>
#define vll vector<ll>
#define vpii vector<pii>
#define vpll vector<pll>
#define vvi vector<vi>
#define vvll vector<vll>
#define vs vector<string>
#define pull pair<ull, ull>
#define F first
#define S second
#define m_p make_pair
#define debug(x) cout << #x << " " << x << endl
#define printArr(a, start, end)for(int i=start ; i<end ; ++i)cout << a[i] << " ";cout << '\n';
#define readArr(a, start, end)for(int i=start ; i<end ; ++i)cin >> a[i];
#define read2D(mat, n, m)for(int i=0 ; i<n ; ++i)for(int j=0 ; j<m ; ++j)cin >> mat[i][j];

const long double PI = 3.141592653589793238462643383279502884197169399;

// Find Set LSB = (x&(-x)), isPowerOfTwo = (x & (x-1))

/*

*/

void solve(){
	int n, k;
	cin >> n >> k;
	
	vll a(n);
	for(ll& x : a)cin >> x;
	
	for(int i=k ; i<n ; ++i){
		if(a[i-k] >= a[i])cout << "No\n";
		else cout << "Yes\n";
	}
}

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	
	cout << fixed << setprecision(10);
	
	int tt=1;
	//cin >> tt;
	
	while(tt--){
		solve();
	}
}


Measured memory_bytes: 4780
#include <bits/stdc++.h>
using namespace std;
const int INF=1e9;

typedef pair<int,int> P;

signed main(){
  int n;cin>>n;
  vector<P> v(n);
  map<int,int> m;m[INF+INF+1]++;
  for(int i=0;i<n;i++){
    int x,l;cin>>x>>l;
    v[i]=P(x,l);
    m[x+l]++;
  }
  sort(v.begin(),v.end());
  int now=-2*INF-1,ans=0;
  for(int i=0;i<n;i++){
    if(--m[v[i].first+v[i].second]==0)m.erase(v[i].first+v[i].second);
    if(now>v[i].first-v[i].second)continue;
    if(m.begin()->first<v[i].first+v[i].second)continue;
    ans++;
    now=v[i].first+v[i].second;
    //cout<<i<<" "<<ans<<endl;
  }
  cout<<ans<<endl;
}


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

int main()
{
  int N, D;
  cin >> N >> D;
  
  int a = N % (2 * D + 1);
  
 if (a)
 {
   cout << N / (2 * D + 1) + 1 << endl;
 }
 else
 {
   {
     cout << N / (2 * D + 1) << endl;
   }
 }
 
 return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using i64 = long long;

auto calc(const std::string &a, const std::string &b) {
    const int alen = a.size(), blen = b.size();
    std::vector<int> ret { -1 };

    for (int i = 0; i <= alen + blen - 2; i++) {
        bool ok = true;
        const int offset = i - blen + 1;
        for (int j = std::max(0, offset); j < std::min(i + 1, alen); j++) {
            if (a[j] == b[j - offset] || a[j] == '?' || b[j - offset] == '?') continue;
            ok = false;
            break;
        }

        if (ok) ret.push_back(i);
    }

    ret.push_back(alen + blen - 1);

    return ret;
}

int calc2(const std::vector<int> &ab, const std::vector<int> &ac, const std::vector<int> &bc, const int alen, const int blen, const int clen) {
    constexpr int base = 10;
    std::vector<int> vv(4040);
    for (int i : bc) vv[i + base] = 1;

    int ret = alen + blen + clen;
    for (int i : ab) for (int j : ac) {
        if (!(i < j - clen + 1 || j < i - blen + 1) && !vv[base + j - i + blen - 1]) continue;
        const int lb = std::min({ 0, i - blen + 1, j - clen + 1 }),
            ub = std::max({ alen - 1, i, j });
        ret = std::min(ret, ub - lb + 1);
    }

    return ret;
}

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

    const int alen = a.size(), blen = b.size(), clen = c.size();
    const auto ab = calc(a, b), ac = calc(a, c), bc = calc(b, c), ba = calc(b, a), ca = calc(c, a), cb = calc(c, b);

    const int ret = std::min({
        calc2(ab, ac, bc, alen, blen, clen),
        calc2(ba, bc, ac, blen, alen, clen),
        calc2(ca, cb, ab, clen, alen, blen)
    });

    std::cout << ret << std::endl;

    return 0;
}


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

int main()
{
	int n, a, ans = 0;
	cin >> n;
	for (int i = 0; i < n; ++i)
	{
		cin >> a;
		while(a % 2 == 0)
		{
			++ans;
			a /= 2;
		}
	}
	cout << ans << endl;
	return 0;
}

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

#define _CRT_SECURE_NO_WARNINGS

#define REP(i, n) for(decltype(n) i = 0; i < (n); i++)
#define REP2(i, x, n) for(decltype(x) i = (x); i < (n); i++)

#define ALL(a) (a).begin(),(a).end()
#define SORT(c) sort((c).begin(),(c).end())
#define DESCSORT(c) sort(c.begin(), c.end(), greater<int>())

using namespace std;

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

using LL = long long int;
using LD = long double;

const int INF = (1 << 30) - 1;
const LL INF64 = ((LL)1 << 62) - 1;
const double PI = 3.1415926535897932384626433832795;

using pii = pair<int, int>;
using pll = pair<LL, LL>;
using pdd = pair<double, double>;
using vi = vector<int>;
using vvi = vector<vi>;
using vvvi = vector<vvi>;
using vl = vector<LL>;
using vvl = vector<vl>;
using vvvl = vector<vvl>;
using vd = vector<double>;
using vvd = vector<vd>;
using vs = vector<string>;
using vb = vector<bool>;
using vvb = vector<vb>;

int gcd(int x, int y) { return y ? gcd(y, x % y) : x; }
LL gcd(LL x, LL y) { return y ? gcd(y, x % y) : x; }

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

	int h, w;
	cin >> h >> w;

	vs s(h);
	REP(i, h) cin >> s[i];

	REP(i, w) {
		s[0][i] = 'A';
		s[h - 1][i] = 'B';
	}

	REP(i, h) {
		REP(j, w) {
			if (s[i][j] == '.') {
				s[i][j] = "AB"[j % 2];
			}
		}
	}

	REP(i, h) {
		REP(j, w) {
			cout << ((s[i][j] == 'A' || s[i][j] == '#') ? '#' : '.');
		}
		cout << endl;
	}
	cout << endl;

	REP(i, h) {
		REP(j, w) {
			cout << ((s[i][j] == 'B' || s[i][j] == '#') ? '#' : '.');
		}
		cout << endl;
	}
	return 0;
}

Measured memory_bytes: 1024
N = int(input())
A1 = list(map(str,input().split()))
A2 = A1[:]

def bubbleSort(A, N):
 flag = 0
 i = 0
 while flag == 0:
  flag = 1
  for j in range(N-1, i, -1):
   if A[j][1] < A[j-1][1]:
    A[j], A[j-1] = A[j-1], A[j]
    flag = 0
  i += 1
 return A

def selectSort(A, N):
 for i in range(N):
  minj = i
  for j in range(i, N):
   if A[j][1] < A[minj][1]:
    minj = j
  if A[i][1] != A[minj][1]:
   A[i], A[minj] = A[minj], A[i]
 return A

def stable(Ab, As, N):
 for i in range(N):
  if Ab[i] != As[i]:
   return False
 return True

bubbleSort(A1, N)
selectSort(A2, N)
print(" ".join(map(str, A1)))
print("Stable")
print(" ".join(map(str, A2)))
if stable(A1, A2, N):
 print("Stable")
else:
 print("Not stable")

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

int main(){
  int w,h,x,y;
  cin>> w >> h >> x >> y;
  
  //分割した面積の大きくない方が最大になるのは面積二等分、分割線は中心を通る
  int64_t s=(int64_t)w*h;
  if (s>pow(10,17)) cout<< s/2 <<" "; //桁数の処理は適当になってる
  else{
    cout<<fixed<<setprecision(9);
    cout<< s/2.0 <<" ";
  }
  
  int ans2=0;
  if(w/2.0==x && h/2.0==y) ans2=1;
    
  cout<< ans2 <<endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
using namespace std;
int gcd(int a,int b){
    if(a<b)swap(a,b);
    return b?gcd(b,a%b):a;
}
int main(){
    string str;
    while(cin>>str,str!="#"){
        int n=0;
        vector<int>V;
        for(int i=0;i<str.length();i++){
            if(str.substr(i,4)=="west"){
                V.push_back(1);
                n++;
            }
            if(str.substr(i,5)=="north"){
                V.push_back(0);
                n++;
            }
        }
        reverse(V.begin(),V.end());
        int a=(V[0]?90:0),b=1;
        for(int i=1;i<n;i++){
            a*=2;
            a+=90*(V[i]?1:-1);
            b*=2;
        }
        int g=gcd(a,b);
        a/=g;b/=g;
        cout<<a;
        if(b>1)cout<<"/"<<b;
        cout<<endl;

    }

    return 0;
}

Measured memory_bytes: 1224
#define _USE_MATH_DEFINES

#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <cmath>
#include <algorithm>
#include <vector>
#include <queue>
#include <map>

long long int INF = 1000000000000000000LL; // 10^18
using namespace std;

typedef pair<int, int> P;

int cnt[110][110][110] = {};

int main(){
	
	int N, K;
	cin >> N >> K;
	
	long long int x[200], y[200], z[200];
	long long int x1[200], y1[200], z1[200];
	for(int i = 0; i < N * 2; i += 2){
		cin >> x[i] >> y[i] >> z[i];
		cin >> x[i + 1] >> y[i + 1] >> z[i + 1];
	}
	
	vector<P> v;
	for(int i = 0; i < N * 2; i++){
		P p;
		p.first = x[i];
		p.second = i;
		v.push_back(p);
	}
	
	sort(v.begin(), v.end());
	
	for(int i = 0; i < N * 2; i++){
		P p = v[i];
		x1[p.second] = i;
	}
	
	v.erase(v.begin(), v.end());
	for(int i = 0; i < N * 2; i++){
		P p;
		p.first = y[i];
		p.second = i;
		v.push_back(p);
	}
	
	sort(v.begin(), v.end());
	
	for(int i = 0; i < N * 2; i++){
		P p = v[i];
		y1[p.second] = i;
	}
	
	v.erase(v.begin(), v.end());
	for(int i = 0; i < N * 2; i++){
		P p;
		p.first = z[i];
		p.second = i;
		v.push_back(p);
	}
	
	sort(v.begin(), v.end());
	
	for(int i = 0; i < N * 2; i++){
		P p = v[i];
		z1[p.second] = i;
	}
	
	v.erase(v.begin(), v.end());
	
	for(int i = 0; i < 2 * N; i += 2){
		for(int j = x1[i]; j < x1[i + 1]; j++){
			for(int k = y1[i]; k < y1[i + 1]; k++){
				cnt[j][k][z1[i]]++;
				cnt[j][k][z1[i + 1]]--;
			}
		}
	}
	
	sort(x, x + 2 * N);
	sort(y, y + 2 * N);
	sort(z, z + 2 * N);
	
	long long ans = 0;
	for(int i = 0; i < 2 * N + 1; i++){
		for(int j = 0; j < 2 * N + 1; j++){
			int num = 0;
			for(int k = 0; k < 2 * N + 1; k++){
				num += cnt[i][j][k];
				if(num >= K){
					ans += (x[i + 1] - x[i]) * (y[j + 1] - y[j]) * (z[k + 1] - z[k]);
				}
			}
		}
	}
	
	cout << ans << endl;
	
	return 0;
}


Measured memory_bytes: 7496
using System;
using System.Linq;
class c
{
    static void Main()
    {
        int n = int.Parse(Console.ReadLine());
        var d = Array.ConvertAll(Console.ReadLine().Split(), int.Parse);
        int m = int.Parse(Console.ReadLine());
        var t = Array.ConvertAll(Console.ReadLine().Split(), int.Parse);
        d = d.OrderBy(f => f).ToArray();
        t = t.OrderBy(f => f).ToArray();
        int now = 0, check = 0;
        while (check < m)
        {
            if (now == n || t[check] < d[now])
            {
                Console.WriteLine("NO");
                break;
            }
            else if (t[check] == d[now])
            {
                check++; now++;
            }
            else if (t[check] > d[now]) now++;
            if (check == m) Console.WriteLine("YES");
        }
    }
}

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

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

	vector<pair<long long, long long>> a(n + 1);
	for (int i = 1; i <= n; ++i) {
		cin >> a[i].first;
		a[i].second = i;
	}

	sort(a.begin() + 1, a.end(), greater<pair<long long, long long>>());

	vector<vector<long long>> dp(n + 1, vector<long long>(n + 1, 0));
	for (int i = 1; i <= n; ++i) {
		for (int j = 0; j < i; ++j) {
			int l = j;
			int r = i - 1 - j;
			dp[l + 1][r] = max(dp[l + 1][r], dp[l][r] + abs(l + 1 - a[i].second) * a[i].first);

			r = j;
			l = i - 1 - j;
			dp[l][r + 1] = max(dp[l][r + 1], dp[l][r] + abs(n - r - a[i].second) * a[i].first);
		}
	}

	long long ans = 0;
	for (int i = 0; i <= n; ++i) {
		ans = max(ans, dp[i][n - i]);
	}

	cout << ans;

	return 0;
}
	

Measured memory_bytes: 34612
#include <iostream>
#include <string>
#include <vector>
#include <queue>
#include <map>
#include <algorithm>

#define ll long long

using namespace std;

int main(){

    int n;
    map<string, priority_queue<pair<int,int>>> m;

    cin >> n;

    for(int i = 0; i < n; i++){
        string city;
        int point;

        cin >> city >> point;

        m[city].push(make_pair(point,i + 1));

    }

    for(auto itr = m.begin(); itr != m.end(); itr++){
        while(!(itr->second).empty()){
            cout << (itr->second).top().second << endl;
            (itr->second).pop();
        }

    }

    return 0;

}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
long long moder = 1000000007;
long long fac[300005];
long long multi(long long a,long long b){
	if(b==0) return 1;
	if(b==1) return a;
	long long ret = multi(a,b/2);
	ret*=ret;
	ret%=moder;
	if(b%2){
		ret*=a;
		ret%=moder;
	}
	return ret;
}
long long C(int n,int r){
	long long down = (fac[r]*fac[n-r])%moder;
	return (fac[n]*multi(down,moder-2))%moder;
}
long long H(int n,int r){
	return C(n+r-1,r);
}
int main(){
	fac[0] = 1;
	for(int i=1; i<=300000; i++){
		fac[i] = fac[i-1]*i;
		fac[i]%=moder;
	}
	long long n,k;
	cin>>n>>k;
	long long can_empty = min(n-1,k);
	long long ret = 0;
	for(int i=0; i<=can_empty; i++){
		ret+=(C(n,i)*H(n-i,i))%moder;
		ret%=moder;
	}
	cout<<ret;
}

Measured memory_bytes: 5936
// Undone
#include <bits/stdc++.h>
#define int long long
#define double long double
#define INF 1e18
#define MOD 1000000007
using namespace std;
signed main() {
  string S; cin >> S;
  char last = 'a';
  for (int i = 0; i < S.length(); i++) {
    if (last == S[i]) {
      cout << "Bad" << endl;
      return 0;
    }
    last = S[i];
  }
  cout << "Good" << endl;
}


Measured memory_bytes: 256
#include<deque>
#include<queue>
#include<vector>
#include<algorithm>
#include<iostream>
#include<set>
#include<cmath>
#include<tuple>
#include<string>
#include<chrono>
#include<functional>
#include<iterator>
#include<random>
#include<unordered_set>
#include<array>
#include<map>
#include<iomanip>
#include<assert.h>
#include<bitset>
#include<stack>
#include<memory>
using namespace std;
using namespace std::chrono;
typedef long long int llint;
typedef double lldo;
#define mp make_pair
#define mt make_tuple
#define pub push_back
#define puf push_front
#define pob pop_back
#define pof pop_front
#define fir first
#define sec second
#define res resize
#define ins insert
#define era erase
/*cout<<fixed<<setprecision(20);cin.tie(0);ios::sync_with_stdio(false);*/
const llint mod=1000003;
const llint big=2.19e15+1;
const long double pai=3.141592653589793238462643383279502884197;
const long double eps=1e-15;
template <class T,class U>bool mineq(T& a,U b){if(a>b){a=b;return true;}return false;}
template <class T,class U>bool maxeq(T& a,U b){if(a<b){a=b;return true;}return false;}
llint gcd(llint a,llint b){if(a%b==0){return b;}else return gcd(b,a%b);}
llint lcm(llint a,llint b){if(a==0){return b;}return a/gcd(a,b)*b;}
template<class T> void SO(T& ve){sort(ve.begin(),ve.end());}
template<class T> void REV(T& ve){reverse(ve.begin(),ve.end());}
template<class T>llint LBI(vector<T>&ar,T in){return lower_bound(ar.begin(),ar.end(),in)-ar.begin();}
template<class T>llint UBI(vector<T>&ar,T in){return upper_bound(ar.begin(),ar.end(),in)-ar.begin();}
int main(void){
	cin.tie(0);ios::sync_with_stdio(false);
	//LかUかのどちらかでいい
	llint i,n,X,wa=0;cin>>n>>X;
	vector<tuple<llint,llint,llint>>test(n);
	for(i=0;i<n;i++){
		llint B,L,U;cin>>B>>L>>U;
		wa-=L*B;
		test[i]=mt(U*(X-B)+L*B,L,U);
	}
	if(wa==0){cout<<0<<endl;return 0;}//青木君やるきがない
	SO(test);REV(test);
	int yaru=0;
	while(wa<0){
		wa+=get<0>(test[yaru]);
		yaru++;
	}
	llint ans=X*yaru;
	//cerr<<yaru<<" "<<wa<<endl;
	//yaruをすべてやると上回れる
	//半端な勉強をLかUかで場合分け
	//L
	for(i=0;i<n;i++){
		//L半端
		llint fuso;
		if(i<yaru){fuso=-wa+get<0>(test[i]);}
		else{fuso=-wa+get<0>(test[yaru-1]);}
		mineq(ans,X*(yaru-1)+(fuso+get<1>(test[i])-1)/get<1>(test[i]));
		
		llint over;//Uから手を抜く
		if(i<yaru){over=wa;}
		else{over=wa-get<0>(test[yaru-1])+get<0>(test[i]);}
		mineq(ans,X*yaru-over/get<2>(test[i]));
	}
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 2560
#include<stdio.h>
#include<string.h>
#include<stdlib.h>

typedef struct{
	int num[6];
}saikoro;



saikoro *s;
int all_num[64][6];

void n(){
	int tmp;
	tmp=s[0].num[4];
	s[0].num[4]=s[0].num[0];
	s[0].num[0]=s[0].num[1];
	s[0].num[1]=s[0].num[5];
	s[0].num[5]=tmp;
}
/*
void s(saikoro *a){
	int tmp;
	tmp=a->num[1];
	a->num[1]=a->num[0];
	a->num[0]=a->num[4];
	a->num[4]=a->num[5];
	a->num[5]=tmp;
}
*/
void e(){
	int tmp;
	tmp=s[0].num[2];
	s[0].num[2]=s[0].num[0];
	s[0].num[0]=s[0].num[3];
	s[0].num[3]=s[0].num[5];
	s[0].num[5]=tmp;
}
/*
void w(saikoro *a){
	int tmp;
	tmp=a->num[3];
	a->num[3]=a->num[0];
	a->num[0]=a->num[2];
	a->num[2]=a->num[5];
	a->num[5]=tmp;
}
*/
void rota(){
	int tmp;
	tmp=s[0].num[1];
	s[0].num[1]=s[0].num[2];
	s[0].num[2]=s[0].num[4];
	s[0].num[4]=s[0].num[3];
	s[0].num[3]=tmp;
	
}

int check(int num,int s_num){
	int i,all=0;
	for(i=0;i<6;i++){
		if(all_num[num][i]==s[s_num].num[i]){
			all++;
		}
	}
	return all;
}

int main(){
	int i,j,k,l,s_num,f_c=0;
	char input[128];
	
	fgets(input,sizeof input,stdin);
	sscanf(input,"%d",&s_num);
	
	s=malloc(sizeof(saikoro)*s_num);
	
	for(i=0;i<s_num;i++){
		fgets(input,sizeof input,stdin);
		sscanf(input,"%d %d %d %d %d %d",&s[i].num[0],&s[i].num[1]
			,&s[i].num[2],&s[i].num[3],&s[i].num[4],&s[i].num[5]);
		
	}
	
	
	
	
	
	for(i=0;i<4;i++){
		for(j=0;j<4;j++){
			for(k=0;k<4;k++){
				for(l=0;l<6;l++){
					all_num[i*16+j*4+k][l]=s[0].num[l];
				}
				rota();
			}
			e();
		}
		n();
	}
	
	for(i=1;i<s_num;i++){
		for(j=0;j<64;j++){
			if(check(j,i)==6){
				f_c=1;
				break;
			}
			
		}
		
	}
	
	
	if(f_c==1){
		printf("No\n");
	}else{
		printf("Yes\n");
	}
	
	return 0;
}

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

class Program
{
    static void Main(string[] args)
    {
        string[] str = Console.ReadLine().Split(' ');
        int n = int.Parse(str[0]);
        int m = int.Parse(str[1]);
        int[] a = new int[50];
        int[] b = new int[50];
        int ans = 0;

        for(int i = 0; i < m; i++){
            str = Console.ReadLine().Split(' ');
            a[i] = int.Parse(str[0]);
            b[i] = int.Parse(str[1]);
        }

        for(int i = 0; i < n; i++){
            for(int j = 0; j < m; j++){
                if(a[j] == i+1 || b[j] == i+1){
                    ans++;
                }
            }
            Console.WriteLine(ans);
            ans = 0;
        }
    }
}

Measured memory_bytes: 11092