akhauriyash/Code-Regression huggingface dataset:
#include <stdio.h>
#include <stdlib.h>

int main()
{
	int i, N, A, B, C, l[10];
	scanf("%d %d %d %d", &N, &A, &B, &C);
	for (i = 1; i <= N; i++) scanf("%d", &(l[i]));
	
	int min = 1 << 30, flag[10] = {0, 3, 2, 1}, sum[4], tmp;
	while (flag[N+1] == 0) {
		for (i = 1, tmp = -30, sum[0] = 0, sum[1] = 0, sum[2] = 0, sum[3] = 0; i <= N; i++) {
			sum[flag[i]] += l[i];
			if (flag[i] > 0) tmp += 10;
		}
		tmp += abs(sum[1] - A) + abs(sum[2] - B) + abs(sum[3] - C);
		if (tmp < min) min = tmp;
		
		while (1) {
			for (i = 1; i <= N && flag[i] == 3; i++);
			for (flag[i--]++; i >= 1; flag[i--] = 0);
			for (i = 1; i <= N; i++) if (flag[i] == 1) break;
			if (i > N) continue;
			for (i = 1; i <= N; i++) if (flag[i] == 2) break;
			if (i > N) continue;
			for (i = 1; i <= N; i++) if (flag[i] == 3) break;
			if (i <= N) break;
		}
	}
	
	printf("%d\n", min);	
	fflush(stdout);
	return 0;
}

Measured memory_bytes: 1684
program ABC115A
    implicit none
    integer(8)::D
    read(5,*)D

    if(D==25)then
        print'(A)',"Christmas"
    else if(D==24)then
        print'(A)',"Christmas Eve"
    else if(D==23)then
        print'(A)',"Christmas Eve Eve"
    else if(D==22)then
        print'(A)',"Christmas Eve Eve Eve"
    end if
end program ABC115A

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define REP(i,n) for(int i = 0; i < (int)(n); ++i)
#define DEBUG(x) cerr << #x << " = " << x << endl
#define int long long
int MOD = 2305266692540551LL;
int BASE = 4001;
signed main() {
  ios::sync_with_stdio(false);
  string S, T; cin >> S >> T;
  if(S.size() < T.size()) swap(S, T);
  int alpha[26];
  alpha[0] = 1;
  for(int i = 1; i < 26; ++i) {
    alpha[i] = (alpha[i - 1] * BASE) % MOD;
  }
  for(int l = (int)T.size(); l >= 1; --l) {
    unordered_set<int> u;
    int hash;
    hash = 0;
    REP(i,l-1) {
      hash += alpha[T[i] - 'a'];
      hash %= MOD;
    }
    // cerr << T.substr(0, l) << " => " << hash << endl;
    for(int i = 0; i < (int)T.size() - l + 1; ++i) {
      hash += alpha[T[i - 1 + l] - 'a'];
      hash %= MOD;
      u.insert(hash);
      // cerr << T.substr(i, l) << " => " << hash << endl;
      hash -= alpha[T[i] - 'a'];
      if(hash < 0) hash += MOD;
    }

    hash = 0;
    REP(i,l-1) {
      hash += alpha[S[i] - 'a'];
      hash %= MOD;
    }
    // cerr << S.substr(0, l) << " => " << hash << endl;
    for(int i = 0; i < (int)S.size() - l + 1; ++i) {
      hash += alpha[S[i - 1 + l] - 'a'];
      hash %= MOD;
      // cerr << S.substr(i, l) << " => " << hash << endl;
      if(u.count(hash)) {
        cout << l << endl;
        return 0;
      }
      hash -= alpha[S[i] - 'a'];
      if(hash < 0) hash += MOD;
    }
  }
  cout << 0 << endl;
  return 0;
}

Measured memory_bytes: 3348
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
 
public class Main {
     
    public static void main(String[] args) {
        try {
            BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
            String str = reader.readLine();
            String[] arr = str.split(" ");
            int a = Integer.parseInt(arr[0]);
            int b = Integer.parseInt(arr[1]);
            int c = Integer.parseInt(arr[2]);
             
            if(a < b && b < c) {
                System.out.println("Yes");
            } else {
                System.out.println("No");
            }
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
 
}

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

typedef unsigned long long ull;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> PII;
typedef pair<ll, int> PILL;
typedef pair<ll, ll> PLL;

const int MAX_N = 1e5+5;
const int M = 1e6;
const ll INF = (ll)(1e18);
const int inf = 1e9;
const ll MOD = 1000000007LL;

void solve() {

}



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

    int a, b;
    cin >> a >> b;
    cout << 6 - a - b;




    return 0;
}


Measured memory_bytes: 256
/* imports all std modules {{{*/
import
  std.algorithm,
  std.array,
  std.ascii,
  std.base64,
  std.bigint,
  std.bitmanip,
  std.compiler,
  std.complex,
  std.concurrency,
  std.container,
  std.conv,
  std.csv,
  std.datetime,
  std.demangle,
  std.encoding,
  std.exception,
  std.file,
  std.format,
  std.functional,
  std.getopt,
  std.json,
  std.math,
  std.mathspecial,
  std.meta,
  std.mmfile,
  std.net.curl,
  std.net.isemail,
  std.numeric,
  std.parallelism,
  std.path,
  std.process,
  std.random,
  std.range,
  std.regex,
  std.signals,
  std.socket,
  std.stdint,
  std.stdio,
  std.string,
  std.system,
  std.traits,
  std.typecons,
  std.uni,
  std.uri,
  std.utf,
  std.uuid,
  std.variant,
  std.zip,
  std.zlib;
/*}}}*/

/+---test
2 2
2 1 2
1 2
0 1
---+/
/+---test
2 3
2 1 2
1 1
1 2
0 0 1
---+/
/+---test
5 2
3 1 2 5
2 2 3
1 0
---+/

void main(string[] args) {
  long N, M;
  readf(" %d %d ", &N, &M);

  auto ltosw = new long[][](M);
  foreach (m; 0..M) {
    auto S = readln.split.map!(to!long).array;
    foreach (s; S[1..$]) {
      ltosw[m] ~= s-1;
    }
  }
  const P = readln.split.map!(to!long).array;

  long ans;

  const N2 = 2.pow(N);
  for (ushort i = 0; i < N2; ++i) {
    long lcnt;
    foreach (m; 0..M) {
      long cnt;
      foreach (sw; ltosw[m]) {
        if (i >> sw & 1) ++cnt;
      }
      if (cnt%2 == P[m]) ++lcnt;
    }
    if (lcnt == M) ++ans;
  }
  ans.writeln;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
  string s,t,u;
  cin>>s>>t;
  int a,b;
  cin>>a>>b;
  cin>>t;
  if(t==s)
     a -=1;
  else
      b -=1;
  cout<<a<<" "<<b;
  return 0;
}


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

public class Main{
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		long[] a = new long[n];
		long[] ans = new long[n];
		long sum = 0;
		for (int i = 0; i < n; i++) {
			a[i] = sc.nextLong();
			if (i % 2 == 0) {
				sum += a[i];
			} else {
				sum -= a[i];
			}
		}
		ans[0] = sum;
		for (int i = 1; i < n; i++) {
			ans[i] = 2 * a[i - 1] - ans[i - 1];
		}
		for (int i = 0; i < n - 1; i++) {
			System.out.print(ans[i] + " ");
		}
		System.out.println(ans[n - 1]);
	}
}

Measured memory_bytes: 65992
#include <stdio.h>
#include <stdlib.h>

void
insertionSort(int *data, int size)
{
    int i;
    int j;
    int key;

    for (i=1; i<size; ++i) {
        key = data[i];
        j = i - 1;
        while ((j>=0) && (data[j]>key)) {
            data[j+1] = data[j];
            --j;
        }
        data[j+1] = key;
        for (j=0; j<size-1; ++j) {
            printf("%d ", data[j]);
        }
        printf("%d\n", data[j]);
    }

}

int main(int argc, int *argv[])
{
    int size;
    int *data;
    int i;

    scanf("%d", &size);
    //printf("%d\n", size);
    data = malloc(size * sizeof(int));
    for (i=0; i<size; ++i) {
        scanf("%d", &data[i]);
    }

    for (i=0; i<size-1; ++i) {
         printf("%d ", data[i]);
    }
    printf("%d\n", data[i]);

    insertionSort(data, size);

    return 0;
}

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

map<string,int> M;

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

  rep(i,n){
    string a;
    cin >> a;
    M[a]++;
  }

  int mx = 0;
  for(const auto& it:M) mx = max(mx,it.second);
  for(const auto& it:M) if(mx == it.second) cout << it.first << endl; 

  return 0;
}


Measured memory_bytes: 25216
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<iostream>
using namespace std;
int main()
{
	int m,n;
	string s;
	cin>>s;
	n = s.length();
	m = n/2;
	for(int i = 0;i<n;i++)
	{
		if(s[i]!=s[n-1-i])
		{
			cout<<"No" <<endl;
			return 0;
		}
	}
	for(int i = 0;i<m;i++)
	{
		if(s[i]!=s[m-1-i])
		{
			cout<<"No" <<endl;
			return 0;
		}
	}
	for(int i = m+1;i<n;i++)
	{
		if(s[i]!=s[n-1-i])
		{
			cout<<"No" <<endl;
			return 0;
		}
	}
	cout<<"Yes"<<endl;
	return 0;
 } 

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<string>
#include<cmath>
using namespace std;
typedef long long ll;
#define INF 2000000000
#define pi acos(-1)
int main() {
	double r;
	cin >> r;
	printf("%.20lf", 2*pi*r);
	return 0;
}

Measured memory_bytes: 3764
import java.util.Scanner;
public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int A = Integer.parseInt(sc.next());
    int B = Integer.parseInt(sc.next());
    int C = Integer.parseInt(sc.next());
    int D = Integer.parseInt(sc.next());

    while(true){
      if(C - B > 0){
        C = C -B;
        if(A - D > 0){
          A = A - D;
        }else{
          System.out.println("No");
          return;
        }
      }else{
        System.out.println("Yes");
        return;

      }
    }

  }
}



Measured memory_bytes: 35708
<?php 
 $num = intval(fgets(STDIN));
 
 $array = explode(" ",fgets(STDIN));
 
 $num_array = [];
 foreach ($array as $v){
     $num_array[] = intval($v);
 }
 $count = 0;
 for($i = 0 ; $i < $num; $i++){
    for($n = 1 ; $n < $num ; $n++){
        if($num_array[$n - 1] > $num_array[$n]){
            $t = $num_array[$n];
            $num_array[$n] = $num_array[$n - 1];
            $num_array[$n - 1] = $t;
            $count ++;
        }
    }
 }
 print implode(' ', $num_array) . "\n";

 print $count."\n";
  
?>


Measured memory_bytes: 9320
#include <algorithm>
#include <cmath>
#include <functional>
#include <iomanip>
#include <iostream>
#include <limits>
#include <map>
#include <queue>
#include <set>
#include <tuple>
#include <vector>

using namespace std;

#define rep(i, n) for (int64_t i = 0; i < (n); i++)
#define irep(i, n) for (int64_t i = 0; i <= (n); i++)
#define rrep(i, n) for (int64_t i = (n)-1; i >= 0; i--)
#define rirep(i, n) for (int64_t i = n; i >= 0; i--)

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

  vector<int> cost(n);
  vector<vector<int>> a(n, vector<int>(m));
  rep(i, n) {
    cin >> cost[i];
    rep(j, m) { cin >> a[i][j]; }
  }

  int result = numeric_limits<int>::max();
  rep(s, 1 << n) {
    vector<int> skill(m, 0);
    int z = 0;
    rep(i, n) {
      if (((s >> i) & 1) == 1) {
        rep(j, m) { skill[j] += a[i][j]; }
        z += cost[i];
      }
    }

    bool c = true;
    rep(i, m) { c = (c && (skill[i] >= x)); }
    if (c) {
      result = min(result, z);
    }
  }

  cout << (result == numeric_limits<int>::max() ? -1 : result) << endl;
  return 0;
}

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

int main() {
  int n;
  cin >> n;
  int div[n+1];
  ll ans=0;
  for (ll i=1;i<=n;i++) {
    ll d=n/i;
    ans+=i*(d+1)*d/2;
  }
  cout << ans << endl;
}



Measured memory_bytes: 3616
#include <bits/stdc++.h>
#define ll long long
#define REP(i, n) for (ll (i) = 0; (i) < (n); (i)++)
#define REPI(i, a, b) for (ll (i) = (a); (i) < (b); (i)++)
#define int long long
using namespace std;
using P = pair<int, int>;
using VI = vector<int>;
using VVI = vector<VI>;
using VVVI = vector<VVI>;

signed main() {
  string S;
  bool a[26] = {false};
  cin >> S;
  for (char c: S) {
    a[c-'a'] = true;
  }
  REP (i, 26) {
    if (!a[i]) {
      cout << char('a'+i) << endl;
      return 0;
    }
  }
  cout << "None" << endl;
}


Measured memory_bytes: 512
import sys
def input(): return sys.stdin.readline().strip()

def resolve():
    n=int(input())
    nl=[]
    l=list(map(int,input().split()))
    for i in l:
        if i%2==0:
            nl.append(i)
    ans='APPROVED'
    for i in nl:
        if i%3!=0 and i%5!=0:
            ans='DENIED'
            break
    print(ans)
resolve()

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vl = vector<ll>;
using vvl = vector<vl>;
using pll = pair<ll, ll>;
using vb = vector<bool>;
const ll oo = 0x3f3f3f3f3f3f3f3fLL;
const double eps = 1e-9;
#define sz(c) ll((c).size())
#define all(c) begin(c), end(c)
#define mp make_pair
#define pb push_back
#define has(c, i) ((c).find(i) != end(c))
#define FOR(i,a,b) for (ll i=(a); i<(b); i++)
#define FORD(i,a,b) for (ll i=ll(b)-1; i >= a; i--)

int main() {
  cout << fixed << setprecision(8);

  ll n;
  cin >> n;

  map<pll, ll> happiness;

  vvl v(n, vl(3));

  FOR(i,0,n) {
    cin >> v[i][0] >> v[i][1] >> v[i][2];
  }
  
  happiness[{0, 0}] = v[0][0];
  happiness[{0, 1}] = v[0][1];
  happiness[{0, 2}] = v[0][2];

  FOR(i,1,n) {
    happiness[{i, 0}] = max(happiness[{i-1, 1}], happiness[{i-1, 2}]) + v[i][0];
    happiness[{i, 1}] = max(happiness[{i-1, 0}], happiness[{i-1, 2}]) + v[i][1];
    happiness[{i, 2}] = max(happiness[{i-1, 0}], happiness[{i-1, 1}]) + v[i][2];
  }

  cout << max(happiness[{n-1, 0}], max(happiness[{n-1, 1}], happiness[{n-1, 2}])) << endl;
}


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

using namespace std;

#define lli long long int
#define REP(i,s,n) for(int i=s;i<n;i++)
#define MOD 1000000007
#define NUM 2520
#define INF (1LL<<50)
#define DEBUG 0
#define mp(a,b) make_pair(a,b)
#define SORT(V) sort(V.begin(),V.end())

signed main(){

	lli h,w,a,b;
	cin>>h>>w>>a>>b;

	for(lli i=0;i<h;i++){
		for(lli j=0;j<w;j++){
			bool s0 = (i<h-b);
			bool s1 = (j>=w-a);

			if(s0^s1)cout<<1;
			else cout<<0;
		}
		cout<<endl;
	}


	return 0;
}

Measured memory_bytes: 1280
#include <iostream>

using namespace std;

int main(){
  int a,b,c,d;
  cin >> a >> b >> c >> d;
  if(abs(c-a) <= d){
    cout << "Yes" << endl;
  }else if(abs(b-a) <= d && abs(c-b) <= d){
    cout << "Yes" << endl;
  }else{
    cout << "No" << endl;
  }
  return 0;
}

Measured memory_bytes: 256
//Classic
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define vll vector<ll>
#define vi vector<int>
#define pi pair<int,int>
#define vp vector<pi>
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define For(i,a,b) for(ll i=a;i<b;i++)
#define endl "\n"
#define debug(x) cout<<"AA Baju Smit------> "<<#x<<" -> "<<x<<endl
#define all(x) x.begin(),x.end()
#define mint map<int,int>
#define mod 1000000007
#define ciN cin

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


void solve() {
	int n; ciN >> n;
	vi v(n);
	For(i, 0, n) {
		cin >> v[i];
	}
	int mx = v[0];
	ll ans = 0;
	For(i, 1, n) {
		if (mx > v[i]) {
			ans += mx - v[i];
		}
		else {
			mx = v[i];
		}
	}
	cout << ans << endl;
}




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


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

//	int t; cin >> t;
//	while (t--)
	solve();

	return 0;
}





///////////////////////////////////////////////////////////////////////////////////////////
//Kai baju bhai???



Measured memory_bytes: 3988
// -*- coding:utf-8-unix -*-

use proconio::input;

fn main() {
    input! {
        n: u32,
    }

    let mut ans: u64 = 0;
    for i in 1..n + 1 {
        if i % 3 != 0 && i % 5 != 0 {
            ans += i as u64;
        }
    }
    println!("{}", ans);
}


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

using namespace std;

#define debug(n) cerr << #n << ':' << n << endl;
#define dline    cerr << __LINE__ << endl;

using ll = long long;
template<class T, class U> using P = pair<T,U>;
template<class T> using Heap = priority_queue<T>;
template<class T> using heaP = priority_queue<T,vector<T>,greater<T>>;
template<class T,class U> using umap = unordered_map<T,U>;
template<class T> using uset = unordered_set<T>;

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

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

template<class T, size_t N, class U>
void Fill(T (&a)[N], const U&v){
    fill((U*)a,(U*)(a+N),v);
}

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

int main(){
  char c; cin >> c;
  if(c >= 'A' && c <= 'Z')cout << 'A' << endl;
  else cout << 'a' << endl;
  return 0;
}


Measured memory_bytes: 3628
def main():
    N = int(input())
    A = list(map(int,input().split()))
    ans = 0
    for i in range(1,N,1):
        if A[i-1] > A[i]:
            tmp = (A[i-1] - A[i])
            ans += tmp
            A[i] = A[i-1]
        else:
            continue

    return ans

print(main())


Measured memory_bytes: 32248
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;

int main(void){

    int N, Q; cin>>N>>Q;
    vector<int> G[N+1];
    for (int i = 1; i <= N-1; ++i) {
        int a,b; cin>>a>>b;
        G[a].push_back(b);
    }

    vector<ll> ans(N,0);
    vector<ll> kari(N,0);
    for (int i = 1; i <= Q; ++i) {
        int p,x;cin>>p>>x;
        ans[p] += x;
    }


    for (int i = 1; i <= N; ++i) {
        int p = i;
        int x = ans[i];
        for (int j=0; j<G[p].size(); j++) {
            int tmp = G[p][j];
            ans[tmp] += x;
        }
    }

    for (int i = 1; i <= N; ++i) {
        cout<<ans[i]<<endl;
    }

    return 0;
}

Measured memory_bytes: 16512
#include <bits/stdc++.h>
using namespace std;
int main() {
  string s;
  int64_t k;
  cin>>s>>k;
  for(int i=0;i<k;i++){
    if(s.at(i)!='1'){
      cout<<s.at(i);
      return 0;
    }
  }
  cout<<1;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <climits>
#include <numeric>
#include <iomanip>
#include <cmath>
#include <vector>
#include <set>
#include <unordered_set>
#include <string>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <unordered_map>
 
#define all(x) begin(x), end(x)
#define rall(x) rbegin(x), rend(x)
#define cina(s, n, a) for(int i = s; i < n; i++) cin >> a[i]
#define couta(n, a) for(int i = 0; i < n; i++) cout << a[i] << ' '
#define copy(s, n, a, b) for(int i = s; i < n; i++) b[i] = a[i]
#define yesno(ok) cout << (ok ? "Yes" : "No")
#define mod(a, b) (b + (a % b)) % b
#define MOD  (int)1e9 + 7
 
typedef long long ll;
typedef unsigned long long ull;
typedef std::vector<int> vi;
typedef std::pair <int, int> pii;
typedef std::pair <ll, ll> pll;
typedef std::vector<pii> vpii;
using namespace std;

 
void solve(){
    int n;
    cin >> n;
    int a[200500];
    cina(0, n, a);
    int cnt = 0;
    int mn = INT_MAX;
    for(int i = 0; i < n; i++){
        if(a[i] < mn){
            cnt++;
        }
        mn = min(a[i], mn);
    }
    cout << cnt;
    
}
 
int main(){
    ios::sync_with_stdio(false);
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    int q = 1;
    //cin >> q;
    for(int i = 1; i <= q; i++){
        solve();
    }
}
 


Measured memory_bytes: 1024
H, W = map(int, input().split())

if W == 1:
    print(1)
elif H == 1:
    print(1)
else:
    ans = W * (H // 2)
    if H % 2 == 1:
        if W % 2 == 0:
            ans += W // 2
        else:
            ans += W // 2 + 1
    print(ans)


Measured memory_bytes: 9112
#include <iostream>
#include <string>

int main()
{
    // input
    long N, D;
    std::cin >> N >> D;
    long X[N];
    long Y[N];

    long dSquare = D * D;
    long result = 0;

    for (int i = 0 ; i < N; i++) {
        std::cin >> X[i] >> Y[i];
        if (X[i] * X[i] + Y[i] * Y[i] <= dSquare) {
            result++;
        }
    }

    std::cout << result << std::endl;

}

Measured memory_bytes: 6280
#include <iostream>
#include <iomanip>
#include <cmath>
#include <vector>
#include <queue>
#include <limits>
#include <algorithm>
#include <string>
#include <map>
#include <set>
using namespace std;

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

	int64_t res = 1;
	for (int64_t i = 1; i <= N; i++) {
		res *= i;
		res %= 1000000007;
	}

	cout << res  << endl;

	return 0;
}

Measured memory_bytes: 256
a,b=map(int,input().split())
#排他的論理和^ 順序は入れ替え可能
#n^(n+1)=1  n^n=0
#F(a,b)=F(0,a-1)^F(0,b)=f(a-1)^f(b)
def f(x):
    if x==1:
        return 1
    elif (x+1)%2==0:
        if ((x+1)//2)%2==0:
            return 0
        else:
            return 1
    else:
        if (x//2)%2==0:
            return 0^x
        else:
            return 1^x
print(f(a-1)^f(b))

Measured memory_bytes: 3060
#ifdef HIRO
#include "../stdc++.h"
#define d(f_, ...) printf((f_), ##__VA_ARGS__)
#else
#include <bits/stdc++.h>
#define d(f_, ...)
#endif

using namespace std;
typedef long long ll;

bool check(int a) {
  int b = floor(sqrt(a));
  for(int i = 2; i <= b; i++) {
    if(a % i == 0) return false;
  }
  return true;
}

int main() {
#ifdef HIRO
  ifstream cin("input.txt");
  std::cin.rdbuf(cin.rdbuf());
#endif

  int x;
  cin >> x;
  while(!check(x)) x++;
  cout << x;
  return 0;
}



Measured memory_bytes: 256
#include<stdio.h>
int main(){
	int a,b,c,d;
  scanf("%d %d %d %d",&a,&b,&c,&d);
  int start=a,end=b;
  if(a<c)
    start=c;
  if(b>d)
    end=d;
  int ans=0;
  if(end-start>0)
    ans=end-start;
  printf("%d",ans);
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
#define N 2000010
int mn[N],d[N],h[N],v[N*2],nxt[N*2],ec,ans[N],ct,n,k,a[N],p[N];
void add(int x,int y){v[++ec]=y;nxt[ec]=h[x];h[x]=ec;}
void bd(int o,int l,int r){
	mn[o]=1e9;
	if(l==r)return;
	int md=(l+r)/2;
	bd(o*2,l,md);
	bd(o*2+1,md+1,r);
}
void mod(int o,int l,int r,int x,int y){
	if(l==r){
		mn[o]=y;
		return;
	}
	int md=(l+r)/2;
	if(x<=md)mod(o*2,l,md,x,y);
	else mod(o*2+1,md+1,r,x,y);
	mn[o]=min(mn[o*2],mn[o*2+1]);	
}
int q(int o,int l,int r,int x,int y){
	if(r<x||y<l)return 1e9;
	if(x<=l&&r<=y)return mn[o];
	int md=(l+r)/2;
	return min(q(o*2,l,md,x,y),q(o*2+1,md+1,r,x,y));
}
priority_queue<int>qu;
void tp(){
	for(int i=1;i<=n;i++)
		for(int j=h[i];j;j=nxt[j])
			d[v[j]]++;
	for(int i=1;i<=n;i++)
		if(!d[i])qu.push(i);
	while(!qu.empty()){
		int x=qu.top();
		qu.pop();
		ans[++ct]=x;
		for(int i=h[x];i;i=nxt[i]){
			d[v[i]]--;
			if(!d[v[i]])qu.push(v[i]);
		}
	}
}
int main(){
	cin>>n>>k;
	for(int i=1;i<=n;i++){
		int x;
		scanf("%d",&x);
		a[x]=i;
	}
	reverse(a+1,a+n+1);
	bd(1,1,n);
	for(int i=n;i;i--){
		int x=q(1,1,n,max(1,a[i]-k+1),a[i]);
		if(x>0&&x<=n)add(a[i],a[x]);
		x=q(1,1,n,a[i],min(n,a[i]+k-1));
		if(x>0&&x<=n)add(a[i],a[x]);
		mod(1,1,n,a[i],i);
	}
	tp();
	reverse(ans+1,ans+n+1);
	for(int i=1;i<=n;i++)p[ans[i]]=i;
	for(int i=1;i<=n;i++)
		printf("%d\n",p[i]);
}

Measured memory_bytes: 38528
// C

#include <bits/stdc++.h>
using ll = long long;
using namespace std;
ll mod=1e9+7;
#define pa(x,n) for(ll i=0;i<n;i++){cout<<(x[i])<<" \n"[i==n-1];};

int N;
ll P(0),Q(0);
int used[9]={0};
int cnt(0);
int a,b;
int x;
void dfs(int now,int num){
  used[now] = 1;
  x += pow(10,N-num)*now;
  bool all_pathed = true;
  for (int i(1);i<=N;i++){
    if (used[i] == 0){
      dfs(i,num+1);
      all_pathed = false;
    }
  }
  if (all_pathed){
    cnt++;
    //cout << x << endl;
    if (P == x) a = cnt;
    if (Q == x) b = cnt;
  }
  x -= pow(10,N-num)*now;
  used[now] = 0;
}

int main(){
  cin>>N;
  for (int i(0);i<N;i++){
    int p;
    cin>>p;
    P += pow(10,N-i-1)*p;
  }
  for (int i(0);i<N;i++) {
    int q;
    cin>>q;
    Q += pow(10,N-i-1)*q;
  }
  //cout << P <<" " <<  Q << endl;
  dfs(0,0);
  cout<< abs(a-b) << endl;
  return 0;
}


Measured memory_bytes: 256
using System;
class Program
{
    public static void Main()
    {
        int player = 1;
        char[] sa = Console.ReadLine().ToCharArray();
        char[] sb = Console.ReadLine().ToCharArray();
        char[] sc = Console.ReadLine().ToCharArray();
        int a = 0, b = 0, c = 0;
        char s;
        for (; ; )
        {
            if (player == 1)
            {
                try
                {
                    s = sa[a];
                }
                catch (IndexOutOfRangeException)
                {
                    Console.WriteLine("A");
                    break;
                }
                a++;
            }
            else if (player == 2)
            {
                try
                {
                    s = sb[b];
                }
                catch (IndexOutOfRangeException)
                {
                    Console.WriteLine("B");
                    break;
                }
                b++;
            }
            else
            {
                try
                {
                    s = sc[c];
                }
                catch (IndexOutOfRangeException)
                {
                    Console.WriteLine("C");
                    break;
                }
                c++;
            }
            if (s == 'a')
                player = 1;
            else if (s == 'b')
                player = 2;
            else
                player = 3;
        }
    }
}

Measured memory_bytes: 13140
#include<bits/stdc++.h>
using namespace std;
#define ll long long
int main()
{
  ll x,k,d;
  cin>>x>>k>>d;
  x=abs(x);
  ll c=x/d;
  if(c>=k)
  cout<<x-k*d<<endl;
  else 
  {
      x-=d*c;
      k-=c;
      if(k%2==0)
      cout<<x<<endl;
      else
      cout<<abs(x-d)<<endl;
  }
  return 0;
}

Measured memory_bytes: 3616
#include <bits/stdc++.h>
#define INF 2e9
#define MOD 1000000007
#define MOD9 998244353
#define intMAX 51000;
#define PI 3.14159265359
using namespace std;
typedef long long llong;
typedef long double ldouble;

using Graph = vector<vector<int>>;

int ctoi(const char c){
	if('0' <= c && c <= '9') return (c-'0');
	return -1;
}

int main(){
	string S;
	cin >> S;
	int ans = intMAX;
	for(int i=0; i<S.length()-2; ++i){
		int num = 0;
		num += ctoi(S[i]) * 100;
		num += ctoi(S[i+1]) * 10;
		num += ctoi(S[i+2]);
		ans = min(ans, abs(753-num));
	}
	cout << ans << endl;
}

Measured memory_bytes: 3616
#include<cstring>
#include<cstdio>
#include<iostream>
#include<algorithm>
#include<vector>
#include<cmath>
#include<map>
#include<queue>
#include<bitset>
#include<cstdlib>
#include<set>
#include<unordered_map>
#define l(x) (x<<1)
#define r(x) ((x<<1)|1)
#define low(x) (x&(-x))
#define IL inline
#define reg register
#define LL long long
#define N 500010
#define MOD 998244353
#define MO 1000000007
#define INF 0x3f3f3f3f
using namespace std;

int T,n,i,j,k,x,y,z,l,r;
int a[N],b[N];
char c[N];

struct Data{
	int x,y;
}d[N];

IL int Abs(int x){return (x<0)?-x:x;}
IL void Swap(int &a,int &b){a^=b^=a^=b;}
IL int Min(int a,int b){return (a<b)?a:b;}
IL int Max(int a,int b){return (a>b)?a:b;}
IL bool cmp(const Data a,const Data b){return a.x<b.x;}

IL LL Mi(LL x,LL y){
	LL p=x,t=1,Res=1;
	for (;t<=y;(t&y)?Res=(Res*p)%MOD:0,p=(p*p)%MOD,t<<=1);
	return Res;
}

IL int read(){
	int p=0,f=1;	char	c=getchar();
	while (c<48||c>57)	{if (c=='-')	f=-1;	c=getchar();}
	while (c>=48&&c<=57)	p=(p<<1)+(p<<3)+c-48,c=getchar();
	return p*f;
}

int main(){
	#ifdef __Marvolo
	freopen("zht.in","r",stdin);
	freopen("zht.out","w",stdout);
	#endif
	n=read();
	scanf("%s",c+1);
	for (i=1;i<=n;i++){
		if (c[i]=='W'){
			l=i;	break;
		}
	}
	for (i=n;i;i--){
		if (c[i]=='R'){
			r=i;	break;
		}
	}
	if (!l || !r)	{
		cout<<"0"<<endl;
		return 0;
	}
	int Ans=0;
	while (l<r){
		Ans++;
		l++;	r--;
		while (l<=n && c[l]=='R')	l++;
		while (r && c[r]=='W')	r--;
		if (l>n || r<0)	break;
		if (l>r)	break;
	}
	cout<<Ans<<endl;
	return 0;
}

Measured memory_bytes: 3960
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, tan, asin, acos, atan, radians, degrees, log2, gcd
from itertools import accumulate, permutations, combinations, combinations_with_replacement, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left, insort, insort_left
from heapq import heappush, heappop
from functools import reduce, lru_cache
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def TUPLE(): return tuple(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7 
#mod = 998244353
from decimal import *
#import numpy as np
#decimal.getcontext().prec = 10

N = INT()
S = input()

s1 = []
dic_s2 = defaultdict(int)

for x in product([0, 1], repeat=N):
	s1_red = ""
	s1_blue = ""
	s2_red = ""
	s2_blue = ""
	for i in range(N):
		if x[i]:
			s1_red += S[i]
			s2_red += S[N+i]
		else:
			s1_blue += S[i]
			s2_blue += S[N+i]

	s1.append((s1_red, s1_blue))
	dic_s2[(s2_blue[::-1], s2_red[::-1])] += 1

ans = 0
for x in s1:
	ans += dic_s2[x]

print(ans)



Measured memory_bytes: 143300
def saiki(n):

    if n == 0:
        return 0
    else:
        return n + saiki(n - 1)

def number(n , m):

    ans = saiki(n) + saiki(m) - n - m

    return ans

def main():
    n , m = map(int , input().split())
    print(number(n , m))

if __name__ == '__main__':
    main()

Measured memory_bytes: 3060
#include <algorithm>
#include <bitset>
#include <tuple>
#include <cstdint>
#include <cstdio>
#include <cctype>
#include <assert.h>
#include <stdlib.h>
#include <stdio.h>
#include <cassert>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <ctime>
#include <deque>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <list>
#include <limits>
#include <map>
#include <memory>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
#include <math.h>

// ===============================================================
//using系

using namespace std;
using ll = long long;
using vl = vector<long long>;
using vll = vector<vector<long long>>;
using vs = vector<string>;
using vc = vector<char>;
using vcc = vector<vector<char>>;
using vm = vector<short>;
using vmm = vector<vector<short>>;
using pii = pair<int, int>;
using psi = pair<string, int>;
using ld = long double;
using ull = unsigned long long;
using ui = unsigned int;
using qul = queue<ll>;
using pql = priority_queue<ll>;
using kaage = priority_queue<int, vector<int>, greater<int>>;

// ========================================================================
//define系

//#define int long long;
#define rep(i, n) for(ll i = 0; i < n; i++)
#define REP(i, n) for(ll i = 1; i <= n; i++)

// ========================================================================


ll gcd(ll a, ll b)
{
	if (a % b == 0)
	{
		return(b);
	}
	else
	{
		return(gcd(b, a % b));
	}
}
//最大公約数
ll lcm(ll a, ll b)
{
	return a * b / gcd(a, b);
}
//最小公倍数
ll box(double a)
{
	ll b = a;
	return b;
}
//切り捨て
ll fff(double a)
{
	ll b = a + 0.5;
	return b;
}
//四捨五入
ll mch(ll n) {
	if (n == 1) return 1;
	else return n * mch(n - 1);
}
//1から整数nまでの階乗を出す(INFで割っていない)
bool prime(ll a)//素数判定、primeならtrue,違うならfalse
{
	if (a < 2) return false;
	else if (a == 2) return true;
	else if (a % 2 == 0) return false;
	double m = sqrt(a);
	for (int i = 3; i <= m; i += 2)
	{
		if (a % i == 0)
		{
			return false;
		}
	}

	// 素数である
	return true;
}
//素数判定
ll modpow(ll a, ll n, ll mod) {
	ll hi = 1;
	while (n > 0) {
		if (n & 1) hi = hi * a % mod;
		a = a * a % mod;
		n >>= 1;
	}
	return hi;
}
//いろいろやります（ただの前座）
ll mg(ll a, ll mod) {
	return modpow(a, mod - 2, mod);
}
//割り算の10^9+7等対策で逆元を出します 




// ========================================================================


/*signed*/int main() {
	ll n; cin >> n;
	vl a(n);
	ll cnt = 0;
	ll count = 0;
	ll ans = 1000000000;
	for (int i = 0; i < n; i++)cin >> a[i];
	for (int i = 0; i <= n; i++) {
		for (int j = 0; j < n; j++) {
			if (j > i) cnt += a[j];
			else count += a[j];
		}
		ans = min(ans, abs(cnt - count));
		cnt = count = 0;
	}
	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 3616
import sys,collections as cl,bisect as bs,random
sys.setrecursionlimit(100000)
input = sys.stdin.readline
mod = 10**9+7
Max = sys.maxsize
def l(): #intのlist
	return list(map(int,input().split()))
def m(): #複数文字
	return map(int,input().split())
def onem(): #Nとかの取得
	return int(input())
def s(x): #圧縮
	a = []
	if len(x) == 0:
		return []
	aa = x[0]
	su = 1
	for i in range(len(x)-1):
		if aa != x[i+1]:
			a.append([aa,su])
			aa = x[i+1]
			su = 1
		else:
			su += 1
	a.append([aa,su])
	return a
def jo(x): #listをスペースごとに分ける
	return " ".join(map(str,x))
def max2(x): #他のときもどうように作成可能
	return max(map(max,x))
def In(x,a): #aがリスト(sorted)
    k = bs.bisect_left(a,x)
    if k != len(a) and a[k] ==  x:
        return True
    else:
        return False

def pow_k(x, n):
    ans = 1
    while n:
        if n % 2:
            ans *= x
        x *= x
        n >>= 1
    return ans

"""
def nibu(x,n,r):
	ll = 0
	rr = r
	while True:
		mid = (ll+rr)//2

	if rr == mid:
		return ll
	if (ここに評価入れる):
		rr = mid
	else:
		ll = mid+1
"""

d = onem()

c = l()

s = []
sel = [0 for i in range(365)]

day = [[0 for i in range(26)] for j in range(365)]
ans = 0
for i in range(d):
	s.append(l())
	ss = [[s[-1][i]-c[i],i+1] for i in range(26)]
	ss.sort(reverse = True)
	data = random.randrange(1,10)
	sel[i] = ss[data-1][1]
	ans += s[i][data-1]

	for j in range(26):
		if j == data - 1:
			day[i][j] = i
		else:
			day[i][j] = day[i-1][j]
			ans -= c[j] * (i - day[i][j] + 1)



for _ in range(10000):
	ima = random.randrange(365)
	
	po = [[s[ima][i]-c[i],i+1] for i in range(26)]
	po.sort(reverse = True)
	data = random.randrange(10)
	ppp = 0
	for i in range(26):
		if ima == day[ima][i]:
			now = i
	for i in range(ima+1,365):
		if day[i][data] == i:
			ppp += (i - ima) * c[data]
			break
	else:
		ppp += (364-ima) * c[data]

	for i in range(ima+1,365):
		if day[i][now] == i:
			ppp += (i - ima) * c[now]
			break
	else:
		ppp -= (364-ima) * c[now]
	if ppp > 0:
		for i in range(ima,365):
			if day[i][data] != i:
				day[i][data] = ima
			else:
				break
		po = ima - 1 if ima != 0 else 0
		for i in range(ima,365):
			if day[i][now] != i:
				day[i][now] = po
			else:
				break
		sel[ima] = data+1

for i in sel:
	print(i)

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

const int maxn = 60;
const int inf = 0x3f3f3f3f;
int dst[maxn][maxn];
pair<int,int> prv[maxn][maxn];

int h,w;
string g[maxn];

int main() {

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

  cin >> h >> w;
  for (int i = 0; i < h; i++) cin >> g[i];

  memset(dst, inf, sizeof dst);
  for (int i = 0; i < h; i++) {
    for (int j = 0; j < w; j++) {
      prv[i][j].first = -1;
      prv[i][j].second = -1;
    }
  }
  vector<pair<int,int>> moves = {{-1,0}, {1,0}, {0,-1}, {0,1}};

  queue<pair<pair<int,int>, pair<int,pair<int,int>>>> q; // (cur) , dist , (prv)
  q.push({{0,0},{0,{-1,-1}}});

  while (!q.empty()) {
    auto temp = q.front(); q.pop();
    auto current = temp.first;
    int distance = temp.second.first;
    auto previous = temp.second.second;
    prv[current.first][current.second] = previous;
    dst[current.first][current.second] = distance;
    for (int i = 0; i < 4; i++) {
      int x = current.first + moves[i].first;
      int y = current.second + moves[i].second;
      if (x < 0 || x >= h || y < 0|| y >= w || dst[x][y] <= distance + 1 || g[x][y] == '#') continue;
      dst[x][y] = distance + 1;
      q.push({{x,y}, {distance+1, current}});
    }
  }

  if (dst[h-1][w-1] == inf) {
    cout << -1 << endl;
    return 0;
  }

  int x = h-1;
  int y = w-1;
  while (x != -1 && y != -1) {
    g[x][y] = '#';
    int xt = prv[x][y].first;
    int yt = prv[x][y].second;
    x = xt;
    y = yt;
  }

  int ans = 0;
  for (int i = 0; i < h; i++) {
    for (int j = 0; j < w; j++) {
      if (g[i][j] == '.') ans++;
    }
  }

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


Measured memory_bytes: 256
#include <algorithm>
#include <cassert>
// #include <chrono>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <iostream>
#include <map>
#include <memory>
#include <queue>
// #include <random>
#include <set>
#include <stack>
#include <string>
#include <utility>
#include <vector>

/*
unsigned seed1 = std::chrono::system_clock::now().time_since_epoch().count();
mt19937 g1.seed(seed1);
*/
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef pair<pii, pii> ppiipii;
typedef pair<int, ppiipii> pippiipii;
typedef pair<int, pii> pipii;
typedef pair<pii, int> ppiii;
typedef pair<int, ppiii> pippiii;
typedef pair<int, ll> pill;
typedef pair<int, double> pid;
// note to self, the below two triggers someone
typedef pair<ll, ll> pll;
typedef pair<ll, int> plli;
typedef long double ld;

int main() {
  int a, b, h;
  scanf("%d%d%d", &a, &b, &h);
  printf("%d\n", (h/2*(a+b)));
}


Measured memory_bytes: 256
n = gets.to_i
mod_list = Array.new(n, nil)
mod_list[1] = [1, 1]
counter = 1
while mod_list[0].nil?
  bots = mod_list.select{|a| a && a[1] == counter }.map{|a| a[0]}
  until bots.empty?
    bots.each do |i|
      j = (i + 1) % n
      if mod_list[j].nil?
        mod_list[j] = [j, counter + 1]
      end
    end
    bots.map!{|bot| (bot*10)%n }
    bots = bots.select{|i|
      (mod_list[i].nil? || mod_list[i][1] > counter) && (mod_list[i] = [i, counter])
    }
  end
  counter += 1
end
puts mod_list[0][1].to_s



Measured memory_bytes: 8696
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <cmath>
#include <queue>
#include <set>
#include <map>
#include <iomanip>
#include <fstream>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
const int mod = 1000000007;

int main() {
    ios::sync_with_stdio(false);
    int n;
    ll a[200005] = {}, d[200005][3];
    cin >> n;
    for (int i = 1; i <= n; i++) cin >> a[i];
    d[0][0] = 0;
    d[0][1] = d[0][2] = d[1][1] = d[1][2] = -1ll * mod * mod;
    d[1][0] = a[1];
    for (int i = 2; i <= n; i++) {
        for (int j = 0; j <3; j++) {
            d[i][j] = -1ll * mod * mod;
            for (int k = 0; k <= j; k++) if (i - k - 2 >= 0) {
                d[i][j] = max(d[i][j], d[i - k - 2][j - k] + a[i]);
            }
            //cout << d[i][j] << " \n"[j == 2];
        }
    }
    if (n % 2) cout << max({d[n][2], d[n][1], d[n - 1][1], d[n - 1][0], d[n - 2][0]});
    else cout << max({d[n][0], d[n][1], d[n - 1][0]});
}


Measured memory_bytes: 9896
#include <bits/stdc++.h>
//#include <boost/multiprecision/cpp_int.hpp>
//namespace mp = boost::multiprecision;

using namespace std;

const double PI = 3.14159265358979323846;
typedef long long ll;
const double EPS = 1e-9;
#define rep(i, n) for (int i = 0; i < (n); ++i)
//#define rep(i, n) for (ll i = 0; i < (n); ++i)
typedef pair<ll, ll> P;
const ll INF = 10e17;
#define cmin(x, y) x = min(x, y)
#define cmax(x, y) x = max(x, y)
#define ret() return 0;

double equal(double a, double b) {
    return fabs(a - b) < DBL_EPSILON;
}

std::istream &operator>>(std::istream &in, set<int> &o) {
    int a;
    in >> a;
    o.insert(a);
    return in;
}

std::istream &operator>>(std::istream &in, queue<int> &o) {
    ll a;
    in >> a;
    o.push(a);
    return in;
}

bool contain(set<int> &s, int a) { return s.find(a) != s.end(); }

//ofstream outfile("log.txt");
//outfile << setw(6) << setfill('0') << prefecture << setw(6) << setfill('0') << rank << endl;
// std::cout << std::bitset<8>(9);
//const ll mod = 1e10;

typedef priority_queue<ll, vector<ll>, greater<ll> > PQ_ASK;

int main() {
    int n;
    ll a, b;
    cin >> n >> a >> b;
    vector<ll> monsters(n);
    rep(i, n) cin >> monsters[i];

    auto check = [&](ll k) -> bool {
        ll bk = k * b;
        vector<ll> tmp = monsters;
        rep(i, n) tmp[i] = max<ll>(tmp[i] - bk, 0);

        ll f = 0;
        rep(i, n) f += ((tmp[i] + (a - b) - 1) / (a - b));

        return f <= k;
    };

//    bool ok = check(4);

    ll floor = 0, ceil = 1e9;
//    ll floor = 0, ceil = 4;
    while (floor + 1 < ceil) {
        ll mid = (floor + ceil) / 2;
        bool ok = check(mid);
        if (ok) ceil = mid;
        else floor = mid;
    }

    cout << ceil << endl;

}


Measured memory_bytes: 4784
#include <bits/stdc++.h>
using namespace std;
 
int main(){
  int N;
  cin >>N;
  vector<int> A(N-1);
  for(int i = 0;i<N-1;i++){
    cin >>A.at(i);
  }
  vector<int> B(N);
  for(int i = 0;i<N;i++){
    B.at(i) = 0;
  }
  for(int i = 0;i<N-1;i++){
    B.at(A.at(i)-1) +=1;
  }
  for(int i = 0;i<N;i++){
    cout<<B.at(i)<<endl;
  }
}


Measured memory_bytes: 4840
module Main where

import Control.Monad
import Control.Applicative
import Data.List

showingList :: [Int] -> String
showingList (x:[]) = show x
showingList (x:xs) = (show x) ++ " " ++ (showingList xs)

solve :: ([Int], Int) -> Int
solve ([], t) = 0
solve ((x:xs), t) = if x >= t then solve (xs, x) else solve (xs, t) + t - x

main :: IO ()
main = do
    n <- getLine
    a <- map read . words <$> getLine :: IO [Int]
    putStrLn $ show ( solve (a, 0))


Measured memory_bytes: 64228
//A.cpp
#include <iostream>
#include <string>
#include <algorithm>
#include <set>
#include <map>
#include <vector>
#include <queue>
#include <math.h>
#define rep(i,n) for(int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;

int main(){
  int h,w,a,b;
  cin >> h >> w >> a >> b;
  // if(a == 0 || b == 0){
  //   printf("No\n");
  //   return 0;
  // }
  rep(i,h-b){
    rep(j,a){
      printf("1");
    }
    rep(j,w-a){
      printf("0");
    }
    printf("\n");
  }
  rep(i,b){
    rep(j,a){
      printf("0");
    }
    rep(j,w-a){
      printf("1");
    }
    printf("\n");
  }
  return 0;
}


Measured memory_bytes: 1280
n=gets.to_i
d=gets.split.map(&:to_i)
m=gets.to_i
t=gets.split.map(&:to_i)
dh=Hash.new(0)
d.each{|w|dh[w]+=1}
t.each{|w|
  dh[w]-=1
  if dh[w]<0 then
    puts 'NO'
    exit
  end
}
puts 'YES'

Measured memory_bytes: 42044
n = int(input())
l = list(map(int, input().split()))

l.sort()

if n < 3:
    print(0)
    exit()

cnt = 0
for i in range(n):
    for j in range(i+1,n):
        if l[i] == l[j]:
            continue
        for k in range(j+1,n):
            if l[j] == l[k]:
                continue
            if l[i] + l[j] > l[k]:
                cnt = cnt + 1

print(cnt)

Measured memory_bytes: 9200
#include <bits/stdc++.h>
using namespace std;
#define LL long int
#define ULL unsigned long int
#define LD long double

LL MOD = 1000000007;

int main(){
    int x;
    cin >> x;
    if(x >= 30){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }

    return 0;
}

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

int main(){
  int n; cin >> n;
  vector<int> a(n);
  rep(i, n) cin >> a[i];
  ll ans = 0;

  sort(a.begin(), a.end());
  reverse(a.begin(), a.end());

  //vector<int> v;
  //v.push_back(a[0]);
  ans += a[0];
  //v.push_back(a[1]);
  int id = 1, cnt = 0;

  for(int i = 2; i < n; i++){
    int x = a[id];
    ans += x;
    cnt++;
    if(cnt % 2 == 0){
      id++;
    }
  }
  cout << ans << endl;
  return 0;
}


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

int main() {
  int n;
  cin >> n;
  if (n % 10 == 0) cout << 10;
  else {
    int ans = 0;
    while (n) {
      ans += n % 10;
      n /= 10;
    }
    cout << ans;
  }
}

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

int main(){
    ll n,qq,i;
    map<ll,ll> mp;
    cin>>n;
    ll arr[n],sum=0,a,b;
    for(auto &x:arr){
        cin>>x;
        mp[x]++;
        sum+=x;
    }
    cin>>qq;
    while(qq--){
        cin>>a>>b;
        ll diff = b-a;
        sum+= mp[a]*diff;
        mp[b]+=mp[a];
        mp[a]=0;
        cout<<sum<<"\n";
    }

}


Measured memory_bytes: 10236
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair<ll, ll> P;
typedef vector<ll> VI;
typedef vector<VI> VVI;
const ll MOD = 1000000007;
const ll INF = 2147483647;
const ll LINF = 9223372036854775807;
#define REP(i, n) for (int i = 0; i < n; i++)
#define ALL(v) v.begin(), v.end()

int main() {
	int n; cin >> n;
	int a; ll ans=0;
	REP(i,n){
		cin >> a;
		ans+=a-1;
	}
	cout << ans << endl;
	return 0;
}


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

int main(void){
    string str;
    
    getline(cin,str);
    
    int cnt = 0, flg = 0;
    string key = "";
    for(int i = 0 ; i < str.size() ; i++){
        cnt++;
        
        if(str[i] == ' '|| str[i] == ',' || str[i] == '.'){
            if(3 <= cnt-1 && cnt-1 <= 6){
                if(!flg){
                    cout << key;
                    flg = 1;
                }
                else cout << ' ' << key;
            }
            cnt = 0;
            key = "";
        }
        else key += str[i];
    }
    cout << endl;
    
    return 0;
}

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

int main(){
    int h,w,x,y;    cin>>h>>w>>x>>y;
    if((h*w)%2!=0 && (x+y)%2!=0)cout<<"No"<<endl;
    else cout<<"Yes"<<endl;
    return 0;
}



Measured memory_bytes: 3084
#include <bits/stdc++.h>
using namespace std;
const long double PI = acos(-1);
typedef long long ll;
typedef pair<int64_t,int64_t> pll;
int dx[]={1,-1,0,0,1,-1,1,-1};
int dy[]={0,0,1,-1,1,-1,-1,1};
#define INF (2147483647)
#define mod (1000000007)
#define limit (7368791)
#define rep(i,a,b) for (int64_t i = (a); i < (b); i++)
#define REP(i,n) rep(i,0,n)
#define ALL(a) begin(a),end(a)
#define sz(s) (s).size()
#define pb push_back
#define mp make_pair
#define fi first
#define se second


void solve(){
    string s;cin>>s;
    REP(i,s.size()-1)
        if(s[i]=='B'&&s[i+1]=='C')s.replace(i,2,"D");
    ll acc=0,ans=0;
    for(int i=s.size()-1;i>=0;i--){
        if(s[i]=='A')ans+=acc;
        else if(s[i]=='D')acc++;
        else acc=0;
    }
    cout<<ans<<endl;
}
int main()
{
    cin.tie(0);
	ios::sync_with_stdio(false);
    solve();
    return 0;
}


Measured memory_bytes: 720
#include <stdio.h>

int		main(void)
{
	int		n;
	scanf("%d", &n);
	int		l[n];
	int		r[n];
	for (int i = 0; i < n; i++)
		scanf("%d %d", &l[i], &r[i]);
	if (!(1 <= n && n <= 1000))
		return (1);
	for (int i = 0; i < n; i++)
		if (!(1 <= l[i] && l[i] <= r[i] && r[i] <= 100000))
			return (1);
	int		nb = 0;
	for (int i = 0; i < n; i++)
	{
		nb += r[i] - l[i] + 1;
	}
	printf("%d\n", nb);
}

Measured memory_bytes: 128
s=list(input())

# s1 = (int)(s[0] + s[1])
s1=int(s[0])*10+int(s[1])
s2=int(s[2])*10+int(s[3])

if s1<=12 and s2<=12 and s1>0 and s2>0:
    ans='AMBIGUOUS'
elif s1<=12 and  (s2>12 or s2 == 0)and s1>0:
    ans ='MMYY'
elif (s1>12 or s1==0) and s2<=12 and s2>0:
    ans ='YYMM'
else:
    ans='NA'
print(ans)


Measured memory_bytes: 3060
N,K = map(int,input().split())
A = list(map(int,input().split()))

Ad = {key:0 for key in set(A)}
if len(set(A)) <= K:
    print(0)
else:
    count = 0
    for a in A:
        Ad[a] += 1
    Ad = sorted(Ad.items(), key=lambda x:x[1])
    for i in range(len(set(A))-K):
        count += Ad[i][1]
    print(count)

Measured memory_bytes: 50864
#include<bits/stdc++.h>
#define watch(x) cout << (#x) << " is " << (x) << endl
typedef long long ll;
using namespace std;
int static fast = [](){
  ios::sync_with_stdio(false);
  cin.tie(0); cout.tie(0); return 0;
}();

int main() {
    int X;
    cin >> X;
    if (X == 7 || X == 5 || X == 3)
        cout << "YES"<< endl;
    else
        cout << "NO" << endl;
    return 0;
}




Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#ifdef DEBUG
#define FPEN freopen("in.txt", "r", stdin);
#else
#define FPEN
#endif
const int maxn = 200009;
typedef long long i64;
typedef pair<i64, i64> pi64;
typedef pair<int, int> pi;
const i64 MOD = 119 << 23 | 1;
class {
 public:
  bool vis[11][11];
  void solve() {
    // int n = 10;
    // vector<int> a(n), b(4);
    // for (int i = 0; i < n; ++i) a[i] = i;
    // b[0] = 8;
    // b[1] = 7;
    // b[2] = 6;
    // b[3] = 5;
    // for (int i = 0; i < n; ++i) {
    //   for (int j : a) cout << j << " ";
    //   cout << endl;
    //   for (int j = 0; j < 4; ++j) {
    //     int x = a[j], y = a[b[j]];
    //     cout << x << "---" << y << endl;
    //     if (vis[x][y]) {
    //       cout << "no";
    //       return;
    //     }
    //     vis[x][y] = vis[y][x] = 1;
    //   }
    //   cout << "*****\n";
    //   int a0 = a[0];
    //   for (int j = 0; j < n - 1; ++j) {
    //     a[j] = a[j + 1];
    //   }
    //   a.back() = a0;
    // }
    int n, m;
    cin >> n >> m;
    int len1 = m / 2, len2 = m - len1;
    int l = 1, r = len2 * 2;
    while (l < r) {
      cout << l << " " << r << '\n';
      ++l, r--;
    }
    l = len2 * 2 + 1, r = l + len1 * 2;
    assert(r <= n);
    while (l < r) {
      cout << l << " " << r << '\n';
      ++l, r--;
    }
  }
} NSPACE;
int main() {
  FPEN;
  ios_base::sync_with_stdio(false);
  cout.tie(0);
  cin.tie(0);
  NSPACE.solve();
}

Measured memory_bytes: 3660