akhauriyash/Code-Regression huggingface dataset:
//1-D Reversi
//Atcoder

#include <bits/stdc++.h>
using namespace std;
#define wl(n) while(n--)
#define fr(i,a,b) for(i=a;i<b;i++)
#define rev(i,a,b) for(i=b-1;i>=a;i--)

#define mem(a,i) memset(a,i,sizeof(a))
typedef pair<int,int> ii;
#define mp make_pair
#define ll long long
#define MOD 1000000007
#define pb push_back
#define psh push
#define nl printf("\n")
#define fi first
#define sec second

#define si(n) scanf("%d",&n);

#define ss(s) scanf("%s",s)
#define sc(c) scanf("%c",&c)
#define sf(f) scanf("%lf",&f)

#define pi(n) printf("%d\n", n)

#define ps(s) printf("%s\n", s)
#define pc(c) printf("%c\n", c)
#define pf(f) printf("%lf\n", f)
#define INF (1LL<<52)
map<int,string>CharMap;
void num2str()
{
	
	CharMap[0]="0";
	CharMap[1]="1";
	CharMap[2]="2";
	CharMap[3]="3";
	CharMap[4]="4";
	CharMap[5]="5";
	CharMap[6]="6";
	CharMap[7]="7";
	CharMap[8]="8";
	CharMap[9]="9";
}
string to_string(ll n)
{
	string s="";
	while(n>0)
	{
	   int x=n%10;
	   n/=10;
	   s=CharMap[x]+s;	
	}
	return s;
}
ll pow1(ll x,ll y)
{
    if(y==0)
    return 1;
    ll temp= pow1(x,y/2)%MOD;
    if(y%2==0)
    return (temp*temp)%MOD;
    else
    return (((temp*temp)%MOD)*x)%MOD;
}

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

int main()
{
	string s;
	int compo=1,i=0;
	num2str();
	cin>>s;
	if(s.length()==1)
	{
		cout<<"0\n";
		return 0;
	}
	char prev=s[0];
	for(i=1;i<s.length();)
	{
		while(s[i]==prev && i<s.length())
		{
			i++;
		}
		compo++;
		prev=s[i];
	}
	cout<<compo-2;nl;
	return 0;
}



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

int main(){
  int N;
  cin >>N;
  vector<int> C(N),S(N),F(N);
  for(int i=0;i<N-1;i++){
    cin >> C.at(i)>>S.at(i)>>F.at(i);
  }
  for(int j=0;j<N-1;j++){
    int t=0;
    for(int i=j;i<N-1;i++){
      t= max(S.at(i),((t-1)/F.at(i)+1)*F.at(i))+C.at(i);
    } 
    cout << t<<endl;
  }
  cout <<0<<endl;
}

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

int main() {
    int x,y;
    cin >> x >> y;
    if (x == 1 && y == 1) {
        cout << 1000000 << endl;
    } else {
        cout << (max(0,4-x)+max(0,4-y))*100000 << endl;
    }
    return 0;
}

Measured memory_bytes: 3636
//minamoto
#include<bits/stdc++.h>
#define R register
#define fp(i,a,b) for(R int i=(a),I=(b)+1;i<I;++i)
#define fd(i,a,b) for(R int i=(a),I=(b)-1;i>I;--i)
#define go(u) for(int i=head[u],v=e[i].v;i;i=e[i].nx,v=e[i].v)
using namespace std;
const int N=2e5+5;
int n;
void solve(){
	puts("Yes");
	printf("%d %d\n",1,2),printf("%d %d\n",2,3),printf("%d %d\n",3,n+1),printf("%d %d\n",n+1,n+2),printf("%d %d\n",n+2,n+3);
	for(R int i=5;i<=n;i+=2){
//		printf("%d %d\n",i,1),printf("%d %d\n",i-1,1);
//		printf("%d %d\n",i,i+n),printf("%d %d\n",i-1,i-1+n);
		printf("%d %d\n",i-1,i),printf("%d %d\n",i,n+1),
		printf("%d %d\n",n+1,n+i-1),printf("%d %d\n",n+i-1,n+i);
	}
	if(n&1^1)printf("%d %d\n",n,n-1),printf("%d %d\n",n+(n^1^(n-1)),n+n);
}
int main(){
	scanf("%d",&n);
	if(n^(n&-n))return solve(),0;
	return puts("No"),0;
}

Measured memory_bytes: 2816
using System;
using System.Collections.Generic;
class Program{
	static void Main(){
		int[] s=Array.ConvertAll(Console.ReadLine().Split(),int.Parse);
		var hs=new Dictionary<char,int>();
		string ans="No";
		for(int i=0;i<s[0];i++){
			string q=Console.ReadLine();
			for(int j=0;j<s[1];j++){
				if(hs.ContainsKey(q[j])){hs[q[j]]++;}
				else{hs.Add(q[j],1);}
			}
		}
		int a=0,b=0;
		foreach(KeyValuePair<char,int> e in hs){
			if(e.Value%2==1){
				a++;
				if((e.Value-1)%4!=0){b++;}
			}
			else if(e.Value%4!=0){b++;}
		}
		if(s[0]%2==0&&s[1]%2==0){
			if(a==0&&b==0){ans="Yes";}
		}
		else if(s[0]%2==1&&s[1]%2==1){
			if(a<=1&&b<=s[0]/2+s[1]/2){ans="Yes";}
		}
		else if(a==0){
			if(s[0]%2==1&&b<=s[1]/2+1){ans="Yes";}
			else if(s[1]%2==1&&b<=s[0]/2+1){ans="Yes";}
		}
		Console.WriteLine("{0}",ans);
	}
}

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

using ll = long long;
#define FOR(i, m, n) for (int i = (m); i < (n); i++)
#define REP(i, n) FOR(i, 0, n)
#define REP1(i, n) FOR(i, 1, (n) + 1)
#define ALL(c) (c).begin(), (c).end()
template<class T> inline bool chmin(T& a, T b) {if (a > b) {a = b; return true;} return false;}
template<class T> inline bool chmax(T& a, T b) {if (a < b) {a = b; return true;} return false;}
const int MOD = 1000000007;

int main() {
    string a;
    cin >> a;
    ll n = a.size();
    ll ans = 1;
    vector<int> c(26, 0);
    REP(i, n) c[a[i] - 'a']++;
    REP(i, n - 1) {
        c[a[i] - 'a']--;
        ans += n - (i + 1) - c[a[i] - 'a'];
    }
    cout << ans << endl;
}

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

using namespace std;

#define fst(t) std::get<0>(t)
#define snd(t) std::get<1>(t)
#define thd(t) std::get<2>(t)
#define unless(p) if(!(p))
#define until(p) while(!(p))

using ll = long long;
using P = std::tuple<int,int>;

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

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

    int N;
    std::cin >> N;

    int A[100];
    for(int i=0;i<N;++i){
        std::cin >> A[i];
    }

    ll res = 0ll;
    for(int i=1;i<(1<<N);++i){
        ll x = 1ll;
        for(int j=0;j<N;++j){
            if(i >> j & 1){
                if(A[j] % 2 == 0){
                    
                }else{
                    x *= 2;
                }
            }else{
                if(A[j] % 2 == 0){
                    x *= 2;
                }else{

                }
            }
        }

        // std::cout << i << " " << x << std::endl;

        res += x;
    }

    std::cout << res << std::endl;
}


Measured memory_bytes: 256
#define fast ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0)
#define mem(dp,i) memset(dp,i,sizeof(dp))
#define all(x) begin(x),end(x)
#define pii pair<int,int>
#include <bits/stdc++.h>
#define pll pair<ll,ll>
#define vi vector<int>
#define ld long double
#define ll long long
#define pb push_back
#define mid (l+r)/2
#define S second
#define F first
using namespace std;
const ll mod = 998244353;
int n,m;
int main(){
    fast,cin>>n>>m;
    int x = (n*(n-1))/2;
    int y = (m*(m-1))/2;
    cout<<x+y<<endl;
}


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

int main() {
    /*変数定義，入力*/
    int N;
    int K;
    int Q;

    int n_win;

    cin >> N;
    cin >> K;
    cin >> Q;

    std::vector<int> A(N, K-Q);

    rep(i, Q){
        cin >> n_win;
        A[n_win-1] += 1;
    }
    rep(i,N){
        if(A[i] > 0){
            cout << "Yes" << endl;
        }else{
            cout << "No" << endl;
        }
    }
    /*終了*/
    return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
const long long int MOD = 1e9 + 7;

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

    vector<long long int> prime_power(1001, 1LL);
    for(int i=2; i<=n; i++){
        int k = i;
        for(int p=2; p*p<=k; p++){
            if(k % p != 0) continue;// break and proceed to p+1

            int power = 0;
            while(k % p == 0){
                power += 1;
                k /= p;
            }
            prime_power[p] += power;
        }

        // n has been divided by all primes (with power) smaller than sqrt(n)
        if(k != 1){
            prime_power[k] += 1;
        }
    }
    long long int ans = 1;
    for(int p=2; p<=n; p++){
        ans = ans * prime_power[p] % MOD;
    }
    cout << ans << endl;
    return 0;
}

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

// macro
#define rep(i,n) for(i=0;i<n;i++)
#define ll long long
#define all(v) v.begin(), v.end()

// code starts
int main()
{
  string n;cin>>n;
	int i;
	bool ok=false;
	rep(i,3)if(n[i]=='7')ok=true;
	if(ok)cout<<"Yes"<<endl;
	else cout<<"No"<<endl;
}


Measured memory_bytes: 3628
#include<stdio.h>
#define max 44
void fibonacci(int );
int F[max];
int main(){

  int n;

  scanf("%d",&n);

  fibonacci(n);

  printf("%d\n",F[n]);

  return 0;

}

void fibonacci(int n){
  int i;
  F[0] = 1;
  F[1] = 1;

  for(i = 2;i <= max;i++){
    F[i] = F[i-2] + F[i - 1];
  }
}

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

int main() {
    int a,b;
    
    cin >> a >> b;
    
    if(a == b) {
        cout << "a == b" << endl;
    }else if(a > b) {
        cout << "a > b" << endl;
    }else if(a < b) {
        cout << "a < b" << endl;
    }
}


Measured memory_bytes: 3104
import numpy as np

def main():
	N=int(input())
	b=inputList()
	
	result=[]

	for i in range(N):
		key=-1
		for j in range(N-i):
			if(b[j]==j+1):
				key=j
		if(key==-1):
			print(-1)
			return
		result.append(key+1)
		del b[key]

	result=result[::-1]
	for elem in result:
		print(elem)

def inputList():
	a=list(map(int,input().split()))
	return a

def multisort(li,index):
	return sorted(li,key=lambda x: x[index])

if(__name__=='__main__'):
	main()


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

using ll = long long;

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

const ll mod = 1000000007;

ll pow(ll m,ll n) {
    if(n==1)return m;
    if(n%2==1)return pow(m, n/2)*pow(m, n/2)%mod*m%mod;
    return pow(m, n/2)*pow(m, n/2)%mod;
}

ll m, n;

int main(){
	cin.tie(0);
	
	cin>>m>>n;
	
	cout<<pow(m, n)<<endl;
	
	return 0;
}



Measured memory_bytes: 3116
#include <iostream>
#include <sstream>
#include <fstream>
#include <string>
#include <vector>
#include <deque>
#include <queue>
#include <stack>
#include <climits>
#include <set>
#include <map>
#include <algorithm>
#include <functional>
#include <utility>
#include <bitset>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <cstdio>
#include <unordered_map>
#include <unordered_set>
using namespace std;
typedef long long ll;
typedef long double ld;
#define rep(i , j , n) for(long long i = j ; i <= n ; i++)
#define per(i , j , n) for(long long i = j ; i >= n ; i--)
const long long N = 1e5 + 5;
const long long mod = 1e9 + 7;
ll MODULAR_POWER(ll a , ll b , ll MOD) {
    if(b == 0) return 1LL;
    ll d = MODULAR_POWER(a , b / 2 , MOD);
    d *= d;
    d %= MOD;
    if(b % 2) d *= a;
    d %= MOD;
    return d;
}
ll MODULAR_INVERSE(ll a , ll MOD) {
    return MODULAR_POWER(a , MOD - 2 , MOD);
}
int a[N];
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    cout.precision(8);
    cout << fixed;
    int n , x;
    cin >> n >> x;
    rep(i , 1 , n) cin >> a[i];
    int ans = 0;
    rep(i , 1 , n) {
        ans = __gcd(ans , abs(x - a[i]));
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 640
import math

a,b,C = map(float,input().split())
C = math.radians(C)
c = math.sqrt(a**2 + b**2 - 2 * a * b * math.cos(C))
L = a + b + c
h = b * math.sin(C)
S = a * h / 2

print(S)
print(L)
print(h)


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

int main() {
  
  int N,M;
  scanf("%d%d", &N , &M );

  int homework_days = N;

  for(int i=0; i<M; i++){

    int a;
    scanf("%d",&a);
    homework_days -= a;

    if( homework_days < 0 ){
      printf("%d\n", -1 );
      return 0;
    }

  }

  printf("%d\n", homework_days );

  return 0;

}

Measured memory_bytes: 3836
#include <iostream>
#include <vector>
using namespace std;
typedef long long ll;

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

    vector<ll> a(N+1);
    for (int i = 1; i <= N; i++) {
        cin >> a[i];
    }

    vector<ll> b(N+1);
    int cnt = 0;
    for (int i = N; i > 0; i--) {
        ll sum = 0;
        for (int j = 2; j <= N / i; j++) {
            sum += b[j*i];
        }
        b[i] = a[i] ^ (sum & 1);
        cnt += b[i];
    }

    if (cnt == 0) {
        cout << 0 << endl;
        return 0;
    }

    vector<ll> idx;
    for (int i = 1; i <= N; i++) {
        if (b[i] == 1) {
            idx.push_back(i);
        }
    }

    cout << cnt << endl;
    for (int i = 0; i < cnt; i++) {
        if (i == 0) {
            cout << idx[0];
        } else {
            cout << " " << idx[i];
        }
    }
    cout << endl;

    return 0;
}

Measured memory_bytes: 4980
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

//0046
int main(){
	double h;
	vector<double> height;

	while(cin >> h){

		height.push_back(h);
	}

	sort(height.begin(),height.end());
	double diff = height.back() - height.front();
	cout << diff << endl;
}

Measured memory_bytes: 0
#include<stdio.h>
#include<stdbool.h>
#include<math.h>
#define MAX 1000
#define VMAX 10000

//static const int MAX = 1000;
//static const int VMAX = 10000;

int n,A[MAX],s;
int B[MAX], T[VMAX+1];

void swap(int *a,int *b) {
  int temp;
  temp = *a;
  *a = *b;
  *b = temp;
}

void qsort(int X[], int left, int right){
  int i,j;
  int pivot;
  i=left;j=right;
  pivot = X[(left+right)/2];

  while(1) {
    while(X[i]<pivot)i++;
    while(pivot<X[j])j--;
    if(i>=j) break;

    swap(&X[i],&X[j]);
    i++;  j--;
  }
  if(left < i-1) qsort(X,left,i-1);
  if(j+1<right) qsort(X,j+1,right);
}



int solve() {
  int i;
  int ans = 0;

  bool V[MAX];
  for(i=0;i<n;i++){
    B[i] = A[i];
    V[i]=false;
  }
  qsort(B,0,n-1);
  for(i=0;i<n;i++) T[B[i]] = i;
  for(i=0;i<n;i++) {
    if(V[i]) continue;
    int cur=i;
    int S=0;
    int m=VMAX;
    int an=0;
    while(1) {
      V[cur] = true;
      an++;
      int v = A[cur];
      m = fmin(m,v);
      S+=v;
      cur=T[v];
      if(V[cur])break;
    }
    ans+=fmin(S+(an - 2) * m , m+S+(an+1)*s);

  }
  return ans;
}

int main(){
  int i;
  scanf("%d",&n);
  s=VMAX;
  for(i=0;i<n;i++) {
    scanf("%d",&A[i]);
    s=fmin(s , A[i]);
  }
  int ans = solve();
  printf("%d\n", ans);

  return 0;
}

Measured memory_bytes: 620
#include <iostream>
#include <fstream>
#include <string>
#include <algorithm>
#include <vector>
#include <list>
#include <math.h>
#define rep(i,n) for(int i=0;i<(n);i++)
using namespace std;


int main(){
  int n; cin>>n;
  int sum = 0;
  int a[100+10];
  rep(i,n){
    cin >> a[i];
    sum += a[i]; 
  } 

  int mini = 101 * n;
  int ans = -1;
  rep(i,n){
    if( abs(sum - n*a[i]) < mini){
      ans = i;
      mini = abs(sum - n*a[i]);
    }
  }

  cout << (ans);
}


Measured memory_bytes: 256
import java.util.Scanner;

class Main{
	public static void main(String[] args){
    	Scanner sc = new Scanner(System.in);
      	int P,Q,R;
      	int max = 0;
      	P = sc.nextInt();
      	Q = sc.nextInt();
      	R = sc.nextInt();

      	if(P >= Q){
        	if(P >= R){
            	max = Q + R;
            }else{
            	max = P + Q;
            }
        }else if(Q >= R){
					if(Q >= P){
							max = P + R;
					}else{
							max = Q + R;
					}
			}else if(R >= P) {
					if(R >= Q) {
							max = P + Q;
					}else {
							max = P + R;
					}
			}

      	System.out.println(max);
    }
}


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

int main() {
    int n, k, q;
    cin >> n >> k >> q;
    int scr[100000];
    rep(i, n) scr[i] = k-q;

    rep(i, q) {
        int a;
        cin >> a;
        scr[a-1]++;
    }

    rep(i, n) {
        if (scr[i] > 0) cout << "Yes" << endl;
        else cout << "No" << endl;
    }

    return 0;
}

Measured memory_bytes: 1024
n = gets.to_i
a = []
a = gets.split.map(&:to_i)
t = []
c = 0
i = -100
while i <= 100 do
  c = 0
  for j in 0..n-1
    c = c + (i-a[j])*(i-a[j])
  end
  t.push(c)
  i = i +1
end
#puts t
puts t.min


Measured memory_bytes: 1788
// 西川 宏斗(Nishikawa Hiroto)
// J4-170653
// 中央最前列

// ITP1_1_C Rectangle
// http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ITP1_1_C


#include <iostream>
using namespace std;

int main() {
  int a, b;
  cin >> a >> b;
  cout << a * b << " " << (a + b) * 2 << endl;
  return 0;
}


Measured memory_bytes: 3004
#include <bits/stdc++.h>
using namespace std;
#define int long long
typedef int ll;
typedef long double ld;
const ll N = 50005;
char en = '\n';
ll inf = 1e16;
ll mod = 1e9 + 7;
ll power(ll x, ll n, ll mod) {
  ll res = 1;
  x %= mod;
  while (n) {
    if (n & 1)
      res = (res * x) % mod;
    x = (x * x) % mod;
    n >>= 1;
  }
  return res;
}

int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);

  string s;
  cin >> s;

  ll res = 0;
  ll k = s.length();
  for (char c : s) {
    if (c == 'o')
      res++;
  }

  res += (15 - k);
  cout << ((res >= 8) ? "YES" : "NO") << en;
  return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#define swap(X, Y) {int Z; Z = Y; Y = X; X = Z;}

int main(void)

{
	int a, b;
	while (scanf ("%d %d", &a, &b) && !(a ==0 && b ==0))
	{
		if (a > b)
		{
			swap(a, b);
		} 
		printf("%d %d\n", a, b);
    }
	return 0;
 } 


Measured memory_bytes: 2564
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define intput(i) cout << i << endl
#define ll long long
#define stringput(s) cout << (string)(s) << endl

int main(){
  int N;
  cin >> N;
  for(int i = 1;i < 10;i++){
    if(N%i == 0 && N/i < 10){
      puts("Yes");
      return 0;
    }
  }
    cout << "No" << endl;
}


Measured memory_bytes: 256
/* Grand Garden */

#include <iostream>
using namespace std;

int checkblock(int array[], int n){
	int cnt = 0;

	for(int t = 1; t < n+1; t++){
		if(array[t] != 0 && array[t-1] == 0){
			cnt++;
		}
	}

	for(int k = 1; k < n+1; k++){
		if(array[k] > 0){
			array[k] -= 1;
		}
	}

	return cnt;
}

int main(){
	int n;

	int sum = 0;

	cin >> n;

	int* h = new int[n+1];
	h[0] = 0;
	for(int i = 1; i < n+1; i++){
		cin >> h[i];
	}

	int tag = -1;

	while(tag != 0){
		tag = checkblock(h,n);
		sum += tag; 
	}

	cout << sum << endl;

}

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

using namespace std;

int main() {
  long long a,v,b,w,t;
  cin>>a>>v>>b>>w>>t;
  if(a<b&&(a+t*v)>=(b+t*w)){
    cout<<"YES"<<endl;
  }
  else if(a<b){
    cout<<"NO"<<endl;
  }
  else if(a>b&&(a-t*v)<=(b-t*w)){
    cout<<"YES"<<endl;
  }
  else if(a>b){
    cout<<"NO"<<endl;
  }
 
  
  
}

Measured memory_bytes: 3636
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#define _GLIBCXX_DEBUG // check []
#define DIVISOR 1000000007

using namespace std;
typedef pair<int,int> pii;
typedef pair<int64_t, int64_t> pII;

template<typename T>
void cins(vector<T>& arr) { for(T& e: arr) cin >> e; }

template<typename T>
void p(T elem) {cout << elem << endl;}
template<typename T>
void ps(vector<T>& arr) { for(T e: arr) p(e); }

#ifdef DEBUG
#define debug(fmt, ...) \
    printf("[debug: %s] " fmt, __func__, __VA_ARGS__)
#else
#define debug(fmt, ...)
#endif

int main(void) {
    int num;
    cin >> num;
    int64_t sum = 0;
    int64_t sum_0 = 0;
    vector<int> arr(num);
    for(int i = 0; i < num; i++) {
        int val;
        cin >> val;
        arr[i] = val;
        sum += val;
        if(i%2==1) sum_0 += val;
    }
    sum /= 2;
    vector<int64_t> ans(num);
    ans[0] = sum - sum_0;
    int64_t cur = ans[0];
    for(int i = 0; i < num-1; i++) {
        ans[i+1] = arr[i] - cur;
        cur = ans[i+1];
    }

    for(int i = 0; i < num; i++) {
        cout << ans[i] * 2;
        cout << ((i == num-1) ? '\n' : ' ');
    }
    return 0;
}

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

using namespace std;

int main()
{
    int numberOfParticipant;
    int initialPoint;
    int numberOfProblems;

    cin >> numberOfParticipant;
    cin >> initialPoint;
    cin >> numberOfProblems;

    vector<int> points(numberOfParticipant, initialPoint-numberOfProblems);

    for (int p = 0; p < numberOfProblems; ++p){
        int a;
        cin >> a;
        points[a - 1]++;
    }
    for (int a = 0; a < numberOfParticipant;++a){
        if(points[a]>0){
            cout << "Yes" << endl;
        }else{
            cout << "No" << endl;
        }
    }
    return 0;
}

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

using namespace std;

const uint64_t MOD = 1e+9 + 7;
const uint64_t K = 64;

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

  vector<bitset<K>> A(N);
  for (uint64_t n = 0; n < N; ++n) {
    uint64_t a;
    cin >> a;

    A[n] = bitset<K>(a);
  }

  uint64_t S = 0;
  for (uint64_t k = 0; k < K; ++k) {
    uint64_t count1 = 0;
    for (uint64_t n = 0; n < N; ++n) {
      if (A[n][k]) { ++count1; }
    }

    uint64_t T = ((N - count1) * count1) % MOD;
    uint64_t offset = (static_cast<uint64_t>(1) << k) % MOD;
    uint64_t U = (T * offset) % MOD;
    
    S = (S + U) % MOD;
  }
  cout << S << endl;

  return 0;
}

Measured memory_bytes: 2560
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import accumulate, permutations, combinations, product
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from heapq import heappush, heappop
from functools import reduce
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 ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

K = INT()
A, B = MAP()

for i in range(A, B+1):
    if i % K == 0:
        print("OK")
        exit()
print("NG")

Measured memory_bytes: 10044
import java.util.*;

public class Main{
	public static void main(String args[]){
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		long sum = 0;
		List<Integer> list = new ArrayList<>(n);
		for(int i = 0;i < n; i++){
			list.add(sc.nextInt());
		}
		Collections.sort(list);
		for(int data: list){
			sum += data;
		}
		System.out.printf("%d %d %d\n", list.get(0), list.get(list.size() -1), sum);
	}
}




Measured memory_bytes: 41460
#include<bits/stdc++.h>
using namespace std;
#define SPEED ios::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define READ freopen("in.txt","r",stdin)
#define WRITE freopen("out.txt","w",stdout);
#define pb push_back
#define mem(arr,val) memset(arr,val,sizeof(arr))
#define sf(x) scanf("%d",&x)
#define sf2(x,y) scanf("%d %d",&x,&y)
#define sl(x) scanf("%lld",&x)
#define sl2(x,y) scanf("%lld %lld",&x,&y)
#define sl3(x,y,z) scanf("%lld %lld %lld",&x,&y,&z)
#define sd(x) scanf("%lf",&x);
#define pii pair<int,int>
#define pLL pair<long long,long long>
#define ff first
#define sn second
#define PRINT_CASE  printf("Case %d: ",tc++)
#define mx 100005
#define lnd tree[ind<<1]
#define rnd tree[(ind<<1)+1]
#define cnd tree[ind]
#define lndp b,(b+e)>>1,(ind<<1)
#define rndp ((b+e)>>1)+1,e,(ind<<1)+1
typedef long long ll;
typedef long long int lln;
ll INF=1<<28;
//typedef long long lld;
const double pi=acos(-1.0);
int fx[]={1,-1,0,0}; //direction array
int fy[]={0,0,1,-1};
int dir[4][2]={1,0,-1,0,0,-1,0,1};

//#define INF 10000
ll gcd(ll a,ll b)
{
    if(b==0)
        return a;
    else
        return gcd(b,a%b);
}
ll lcm(ll a,ll b)
{
    return a/gcd(a,b)*b;
}

bool cmp(int a, int b)
{
    return a<b;
}

struct compare
{
  bool operator()(const int& l, const int& r)
  {
      return l>r;
  }
};


int main()
{
//    READ;
    int t;
    int a,b;
    cin>>a>>b;
    cout<<a+(b/2)<<endl;

    return 0;
}




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

long long gcd(int i,int j,int k)
{
    int first=__gcd(i,j);
    int second=__gcd(first,k);

    return second;
}

int main()
{
    int n;
    cin>>n;
    int sum=0;

    for(int a=1;a<=n;a++)
        for(int b=1;b<=n;b++)
        for(int c=1;c<=n;c++)

        sum+=gcd(a,b,c);

    cout<<sum<<endl;
    exit(0);
}






















/*
#include<bits/stdc++.h>
using namespace std;

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

    return gcd(b,a%b);
}

int main()
{
    int k;
    cin>>k;
    int sum=0;

    for(int i=1; i<=k; i++)

        for(int j=1; j<=k; j++)

            for(int l=1; l<=k; l++)

                sum+=gcd(gcd(j,l),i);

    cout<<sum<<endl;
    exit(0);

}
*/


Measured memory_bytes: 3624
#include <cstdio>
#include <cctype>
#include <utility>
#include <complex>
#include <iostream>
using namespace std;

const auto gcu = getchar_unlocked;
const auto pcu = putchar_unlocked;
#define _DEF(r, n, ...) inline r n(__VA_ARGS__) noexcept
#define _T template <typename T>
#define _HT template <typename H,typename... T>
_T _DEF(T,in,int c){T n=0;int m=1;while(isspace(c)){c=gcu();}if(c=='-')m=-1,c=gcu();
	do{n=10*n+(c-'0'),c=gcu();}while(c>='0'&&c<='9');return m*n;}
_DEF(int, in){return in<int>(gcu());}
#define _SCAN(...) _DEF(bool,scan,__VA_ARGS__)
_T _SCAN(T &n){int c=gcu();return c==EOF?false:(n=in<T>(c),true);}
_DEF(bool, scan, char &c){c=gcu();gcu();return c!=EOF;}
#ifdef _GLIBCXX_STRING
_SCAN(string &s){int c;s="";
	for(;;){c=gcu();if(c=='\n'||c==' ')return true;else if(c==EOF)return false;s+=c;}}
#endif
_HT _SCAN(H &h,T&&... t){return scan(h)&&scan(t...);}
#define _OUT(...) _DEF(void,out,__VA_ARGS__)
#define _OUTL(...) _DEF(void,outl,__VA_ARGS__)
_OUT(bool b){pcu('0'+b);}
_OUT(const char *s){while(*s)pcu(*s++);}
_OUT(char c){pcu(c);}
#ifdef _GLIBCXX_STRING
_OUT(string s){for(char c:s)pcu(c);}
#endif
_T _OUT(T n){static char b[20];char *p=b,m=n<0?pcu('-'),-1:1;
	if(!n)*p++='0';else while(n)*p++=n%10*m+'0',n/=10;while(p!=b)pcu(*--p);}
_OUTL(){out('\n');}
#ifdef _GLIBCXX_VECTOR
_T _OUT(vector<T> &v){for(T &x:v)out(&x == &v[0]?"":" "),out(x);outl();}
#endif
_HT _OUT(H&& h, T&&... t){out(h);out(move(t)...);}
template <typename... T> _OUTL(T&&... t){out(move(t)...);outl();}

using P = complex<double>;

int main() {
	P p1, p2, q;
	for (;;) {
		for (P *p: {&p1, &p2, &q}) {
			double x, y;
			if (scanf("%lf,%lf,", &x, &y) == EOF)
				return 0;
			*p = {x, y};
		}
		P a = p2 - p1,
		  r = a / conj(a) * conj(q - p1) + p1;
		printf("%f %f\n", r.real(), r.imag());
	}
}


Measured memory_bytes: 3116
#include <bits/stdc++.h>
#define M                    1000000007
#define pi                   3.14159265358979323846
#define cel(x,a)             (x+a-1)/a
#define ll                   long long
#define pii                  pair<int, int>
#define pll                  pair<ll, ll>
#define vi                   vector<int>
#define vl                   vector<ll>
#define vpi                  vector<pii>
#define vpl                  vector<pll>
#define pb                   push_back
#define lb                   lower_bound
#define ub                   upper_bound
#define ps(x,y)              fixed<<setprecision(y)<<x
#define pf(x,y)              setfill('x')<<setw(y)
#define mp                   make_pair
#define F                    first
#define S                    second
/*.*Ashish_akj*.*/
#define lcm(m,n)             (m/__gcd(m,n))*n
#define all(v)               v.begin(), v.end()
using namespace std;
const int N = 2e6 + 4;
/*
int ncr(int n, int r) 
{ 
    long long p = 1, k = 1; 
    if (n - r < r) 
        r = n - r; 

    if (r != 0) { 
        while (r) { 
            p *= n; 
            k *= r; 
            long long m = __gcd(p, k); 
            p /= m; 
            k /= m; 

            n--; 
            r--;
        }
    } 

    else
        p = 1; 
    return p;
} */
/*vector<bool>visited;
 vector<vector<int>>adj;
void dfs(int v)
{visited[v]=true;
for(int i:adj[v])
{if(!visited){dfs(i);}
}}
*/
int main()
{ios::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
int n;cin>>n;
int a[n],b[n];
for(int i=0; i<n; i++)
{
    cin>>a[i]>>b[i];
}
for(int i=0; i<n-2; i++)
if((a[i]==b[i])&&(a[i+1]==b[i+1])&&(a[i+2]==b[i+2])){cout<<"Yes";return 0;}
cout<<"No";
    return 0;
}




Measured memory_bytes: 3508
using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Numerics;
using System.Security.Cryptography.X509Certificates;
using System.Text;
using System.Threading.Tasks;

namespace AtCorder
{
	public class Program
	{
		static void Main(string[] args)
		{
			var abcd = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
			int a = abcd[0];
			int b = abcd[1];
			int c = abcd[2];
			int d = abcd[3];

			if (Math.Abs(a - c) <= d) {
				Console.WriteLine("Yes");
			} else if (Math.Abs(a - b) <= d && Math.Abs(b - c) <= d) {
				Console.WriteLine("Yes");
			} else {
				Console.WriteLine("No");
			}
		}
	}
}

Measured memory_bytes: 13396
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(n);i++)
#define sz(x) int(x.size())
#define pb push_back
#define eb emplace_back
using ll=long long;
using P = pair<ll,int>;
#define chmax(x,y) x = max(x,y)
#define chmin(x,y) x = min(x,y)
const ll MOD=1000000007,MOD2=998244353;



int main() {
    int X,A;
    cin>>X>>A;
    if(X<A){cout<<0;}
    else{cout<<10;}
}

Measured memory_bytes: 256
#include <stdio.h>

int main() {
	int n, x;
	scanf("%d %d", &n, &x);
	int m[100];
	for (int i = 0; i < n; i++) scanf("%d", &m[i]);

	int min = 2000;
	for (int i = 0; i < n; i++) {
		x -= m[i];
		if (min > m[i]) min = m[i];
	}
	while (1) {
		if (x > 0) {
			x -= min;
			n++;
		}
		else if (x == 0) break;
		else if (x < 0) {
			n--;
			break;
		}
	}
	printf("%d\n", n);
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
#include<iostream>
#include<cstdio>
#include<vector>
#include<string>
#include<algorithm>
#include<map>
using namespace std;
#define rep(i,x) for(int i = 0; i < x; i++)
#define pb push_back
#define mp make_pair
typedef long long ll;
typedef long double ld;
typedef pair<int,int> P;
typedef pair<ll,ll> Pll;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<vector<vector<int>>> vvvi;
const ll MOD = 1e9+7;
const int n_max = 1e5+10;
void print() {
    cout << endl;
}

template <class Head, class... Tail>
void print(Head&& head, Tail&&... tail) {
    cout << head;
    if (sizeof...(tail) != 0) cout << ' ';
    print(forward<Tail>(tail)...);
}

template <class T>
void print(vector<T> &vec) {
    for (auto& a : vec) {
        cout << a;
        if (&a != &vec.back()) cout << ' ';
    }
    cout << endl;
}

template <class T>
void print(vector<vector<T>> &df) {
    for (auto& vec : df) {
        print(vec);
    }
}

template<typename T>
void print(T &arr){
    ll sz = sizeof(arr)/sizeof(arr[0]);
    for(int i = 0;i < sz-1;i++){cout << arr[i] << ' ';}
    cout << arr[sz-1] << endl;
}

// template <class T>
vector<ll> res;
vector<int> number = {3,5,7};
void dfs(ll n, ll x){
    if(n < x)return;
    res.push_back(x);
    for(auto i : number){
        dfs(n, x*10+i);
    }
}

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

    auto num = [](ll x, int digit) -> int{
        ll t1 = x/pow(10,digit-1);
        ll t2 = (x/pow(10,digit));
        // print(t1,t2);
        return t1 - t2 * 10;
    };
    auto check = [&](ll x) -> bool{
        int digit = 0;
        while(x/pow(10,digit) >= 1)digit++;
        bool ok = true;
        int count[3] = {};
        rep(i,digit){
            int temp = num(x,i+1);
            if(temp == 3)count[0]++;
            if(temp == 5)count[1]++;
            if(temp == 7)count[2]++;
        }
        rep(i,3)if(count[i] == 0)ok = false;
        return ok;
    };
    // cout << num(n,2) << endl;
    // cout << check(n) << endl;
    dfs(n,0);
    ll ans = 0;
    for(auto i : res){
        if(check(i))++ans;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 640
a,b,c=list(map(int,input().split()))
K=int(input())

for k in range(K+1):
    for i in range(k+1):
        for j in range(k-i+1):
            l=k-i-j

            if a*(2**i)<b*(2**j)<c*(2**l):
                print('Yes')
                exit(0)

print('No')


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

void solve()
{
    int x, y, z;
    cin >> x >> y >> z;
    swap(x, y);
    swap(x, z);
    cout << x << " " << y << " " << z << endl;
}

int main()
{
    solve();
    return 0;
}

Measured memory_bytes: 3608
#include<vector>
#include<map>
#include<algorithm>
#include<set>
#include<iostream>
#include<string>
#include<set>
#include<queue>
#include<random>
//#include<unordered_set>

using namespace std;

/*
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace __gnu_pbds;

tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> st;*/

#pragma GCC optimize("Ofast")
#pragma GCC optimize("fast-math")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,tune=native")

#define pb push_back
#define ld long double
#define int long long

mt19937 rnd(51);

int32_t main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int n;
    cin >> n;
    vector<pair<int,int>> v(n);
    vector<pair<int,int>> lol;
    for (int i = 0; i < n; i++)
    {
        cin >> v[i].first >> v[i].second;
        lol.pb({v[i].first, 0});
        lol.pb({v[i].second, 1});
    }
    if (n % 2 == 1)
    {
        int cnt1 = n;
        int mn = 1e18, mx = 0, cnt = 0;
        sort(lol.begin(), lol.end());
        for (int i = 0; i < lol.size(); i++)
        {
            if (lol[i].second == 0)
            {
                cnt++;
                if (cnt >= (n + 1) / 2 && cnt1 >= (n + 1) / 2)
                {
                    mn = min(mn, lol[i].first);
                    mx = max(mx, lol[i].first);
                }
            }
            else
            {

                if (cnt >= (n + 1) / 2 && cnt1 >= (n + 1) / 2)
                {
                    mn = min(mn, lol[i].first);
                    mx = max(mx, lol[i].first);
                }
                cnt1--;
            }
        }
        cout << max(0ll, mx - mn + 1) << endl;
    }
    else
    {
        int cnt1 = n, cnt = 0, mn = 1e18, mx = 0, mn1 = 1e18, mx1 = 0;
        sort(lol.begin(), lol.end());
        for (int i = 0; i < lol.size(); i++){
            if (lol[i].second == 0){
                cnt++;
                if (cnt >= n / 2 && cnt1 >= n / 2 + 1){
                    mn = min(mn, lol[i].first);
                    mx = max(mx, lol[i].first);
                }
                if (cnt >= n / 2 + 1 && cnt1 >= n / 2){
                    mn1 = min(mn1, lol[i].first);
                    mx1 = max(mx1, lol[i].first);
                }
            }
            else{
                if (cnt >= n / 2 && cnt1 >= n / 2 + 1){
                    mn = min(mn, lol[i].first);
                    mx = max(mx, lol[i].first);
                }
                if (cnt >= n / 2 + 1 && cnt1 >= n / 2){
                    mn1 = min(mn1, lol[i].first);
                    mx1 = max(mx1, lol[i].first);
                }
                cnt1--;
            }
        }
        cout << max(0ll, (mx + mx1) - (mn + mn1) + 1) << endl;
    }
    return 0;
}


Measured memory_bytes: 14756
#include<iostream>
#include<string>
#include <cmath>
#include <ctype.h>
#include<vector>
#include<algorithm>
using namespace std;
int N, M;
int a, b, c, d;
int W, H;
string s;
vector<int> v;
int main() {
    cin >> s;
    for(int i=0; i<s.size(); i+=2){
        cout << s[i];
    }
    cout << endl;
    return 0;
}

Measured memory_bytes: 512
use std::io::{stdin, Read};

#[allow(unused_macros)]
macro_rules! parse {
    ($it: ident ) => {};
    ($it: ident, ) => {};
    ($it: ident, $var:ident : $t:tt $($r:tt)*) => {
        let $var = parse_val!($it, $t);
        parse!($it $($r)*);
    };
    ($it: ident, mut $var:ident : $t:tt $($r:tt)*) => {
        let mut $var = parse_val!($it, $t);
        parse!($it $($r)*);
    };
}

#[allow(unused_macros)]
macro_rules! parse_val {
    ($it: ident, [$t:tt; $len:expr]) => {
        (0..$len).map(|_| parse_val!($it, $t)).collect::<Vec<_>>();
    };
    ($it: ident, ($($t: ty),*)) => {
        ($(parse_val!($it, $t)),*)
    };
    ($it: ident, $t: ty) => {
        $it.next().unwrap().parse::<$t>().unwrap()
    };
}

fn solve(s: &str) {
    let mut it = s.split_whitespace();
    parse!(it, a: f64, b: f64, h: usize, M: usize);
    let m = 60 * h + M;
    let t = 360. * (m as f64) / 720.;
    let t = t.to_radians();
    let p = 360. * ((m % 60) as f64) / 60.;
    let p = p.to_radians();
    let x = (a * t.cos(), a * t.sin());
    let y = (b * p.cos(), b * p.sin());
    let ret = ((x.0 - y.0).powi(2) + (x.1 - y.1).powi(2)).sqrt();
    println!("{}", ret);
}

fn main() {
    let mut s = String::new();
    stdin().read_to_string(&mut s).unwrap();
    solve(&s);
}

#[cfg(test)]
mod tests {
    use super::*;
    #[test]
    fn test_input() {
        let s = "
        ";
        solve(s);
    }
}


Measured memory_bytes: 2976
#include<iostream>
using namespace std;
int main() {
	int n;
	cin >> n;
	string s;
	cin >> s;
	for (int i = 0; i < s.size(); i++) {
		if (s[i] > 90 - n) {
			s[i] = s[i] - (26 - n);
		}
		else {
			s[i] = s[i] + n;
		}
	}
	cout << s << endl;
	return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <deque>
#include <list>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>

using namespace std;

//typedef
typedef long long LL;
typedef vector<LL> VL;
typedef vector<VL> VVL;
typedef vector<string> VS;
typedef pair<LL, LL> PLL;

//conversion
inline LL toLong(string s) {LL v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

//math
//-------------------------------------------
template<class T> inline T sqr(T x) {return x*x;}

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) LL((a).size())
#define EACH(i,c) for(auto i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

//repetition
#define FOR(i,a,b) for(LL i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define UNTIL(p) while(!(p))

//constant
const double EPS = 1e-5;
const double PI  = acos(-1.0);

//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

#define PUTS(x) cout << (x) << endl;

const LL MOD = 1e9 + 7;
const LL BIT_MAX = 2100000; // 2^21 = 2097152

LL dp[21][BIT_MAX] = {0};

LL a[21][21] = {0};

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

    LL n;
    cin>>n;
    REP(i,n)REP(j,n){
        cin>>a[i][j];
    }

    vector<vector<LL>> bit(n);
    REP(i,n){
        REP(j,n){
            if(a[i][j] == 1){
                bit[i].PB(1 << j);
            }
        }
    }

    for(LL b : bit[0]){
        dp[0][b] = 1;
    }
    REP(i,n-1){
        FOR(j, 1, BIT_MAX){
            if(dp[i][j] == 0)continue;
            for(LL b : bit[i+1]){
                if((j & b) != 0)continue;
                dp[i+1][j | b] += dp[i][j];
                dp[i+1][j | b] %= MOD;
            }
        }
    }

    PUTS(dp[n-1][(1 << n)-1]);
}

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

using ll = long long;
using P = pair<int, int>;

const int INF = 1e9;
const int MOD = 1e9 + 7;

// 4近傍、8近傍
int dx[] = {1, 0, -1, 0, 1, -1, -1, 1};
int dy[] = {0, 1, 0, -1, 1, 1, -1, -1};

bool used[110];

int main() {
  // 入力
  int N;
  cin >> N;
  vector<P> R;
  int a, b;
  for (int i = 0; i < N; i++) {
    cin >> a >> b;
    R.push_back(P(b, a));
  }
  vector<P> B;
  for (int i = 0; i < N; i++) {
    cin >> a >> b;
    B.push_back(P(a, b));
  }

  sort(R.begin(), R.end());
  sort(B.begin(), B.end());
  int ans = 0;
  for (int i = 0; i < N; i++) {
    int maxi = -1;
    int idx = -1;
    for (int j = 0; j < N; j++) {
      if (used[j]) continue;

      if (R[j].first < B[i].second && R[j].second < B[i].first) {
        if (maxi < R[j].first) {
          maxi = R[j].first;
          idx = j;
        }
      }
    }
    if (idx != -1) {
      ans++;
      used[idx] = true;
    }
  }

  // 解答
  cout << ans << endl;

  return 0;
}


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

void main_()
{
    ll N;
    cin >> N;

    queue<pair<string, char>> que;
    que.emplace("a", 'a');

    while ((ll)que.front().first.size() <= N) {
        auto s = que.front();
        que.pop();
        if ((ll)s.first.size() == N) {
            cout << s.first << "\n";
        }
        for (auto ch = 'a'; ch <= s.second; ch++) {
            que.emplace(s.first + ch, s.second);
        }
        que.emplace(s.first + (char)(s.second + 1), s.second + 1);
    }
}
int main()
{
    cin.tie(nullptr);
    cout.tie(nullptr);
    ios_base::sync_with_stdio(false);
    main_();
    return 0;
}


Measured memory_bytes: 55188
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
 
int main() {
	int A, B, C;
	cin >> A >> B >> C;
  
  	if (C>B && C>A){
      	cout << "No" << endl;
    }else if(C<B && C<A){
      	cout << "No" << endl;
    }else{
      	cout << "Yes" << endl;
    }
}

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


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

Measured memory_bytes: 3628
#include<cstdio>
#include<iostream>
using namespace std;
long long a,b,x,ans,ansl;
int main(){
	cin>>a>>b>>x;
	if (a%x==0) ansl=a/x;
	else ansl=a/x+1;
	ans=b/x;
	cout<<ans-ansl+1<<endl;
	//system("pause");
	return 0;
}


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

int main(void)
{
  int n = 0;
  std::cin >> n;
  if(0 != n % 2)
  {
    std::cout << "No";
    return 0;
  }
  
  std::string str;
  std::cin >> str;
  std::cout << ((str.substr(0, n / 2) == str.substr(n / 2)) ? "Yes" : "No");
}

Measured memory_bytes: 888
def enq(a,x)
  b = a[i=-1]
  until b.frozen?
    return a << x  if x >= (a=b)[-1]
    return a.unshift x  if x <= a[0]
    i = a.bsearch_index {|y| x <= (y.frozen? ? y: y[0])}
    b = a[i-=1]  if (b=a[i]).frozen? ? x<b: x<b[0]
  end  if b && b=a
  return a.insert(i+1, x)  unless a[i+9]
  i > 0 ? a[i] = [b,x] : a[1].unshift(x)  rescue a[1] = [x,a[1]]
end
def deq(a) r=a.shift; a.unshift *a.shift if !a[0].frozen?; r end
def poq(a) r=a.pop; a.push *a.pop if !a[-1].frozen?; r end
N,M,*A = $<.read.split.map{|x| x.to_i}
A.sort!
M.times { break if A[-1]==0; enq A, (poq A)/2 }
p A.flatten.inject(0,:+)

Measured memory_bytes: 15976
#include <algorithm>
#include <iostream>
#include <vector>
using namespace std;

int main() {
  vector<int> a(3, 0);
  for (int i = 0; i < 3; i++)
    cin >> a[i];

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

  int cost1 = 0, cost2 = 0, prev_cost1 = 0, prev_cost2 = 0;
  for (auto it = a.begin(); it != a.end(); it++) {
    if (it != a.begin()) {
      cost1 += *it - prev_cost1;
    }
    prev_cost1 = *it;
  }
  for (auto it = a.rbegin(); it != a.rend(); it++) {
    if (it != a.rbegin()) {
      cost2 += prev_cost2 - *it;
    }
    prev_cost2 = *it;
  }

  std::cout << std::max(cost1, cost2) << std::endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
 
  int N,x,b=1E9,j;
  cin >> N;

  for (int i=0;i<N;i++){
	cin>>x;
    j=0;
    while(x%2==0){
        x/=2;
		j+=1;
    }
    if(j<b)	b=j;
    if(b==1)break;
  } 
  	cout << b << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
#define fi                                         first
#define se                                         second
#define pb                                         push_back
#define int                                        long long int
#define mp                                         make_pair
#define pii                                        pair<int,int>
#define vi                                         vector<int>
#define mii                                        map<int,int>
#define umii                                       unordered_map<int,int>
#define pqmax                                      priority_queue<int>
#define pqmin                                      priority_queue<int,vi,greater<int>>
#define setbits(x)                                 __builtin_popcountll(x)
#define zerobits(x)                                 __builtin_ctzll(x)
#define mod                                        1000000007
#define inf                                        1e18
#define ps(x,y)                                    fixed<<setprecision(y)<<x
#define dec(arr,n,type)                             type *arr=new type[n]
#define test(t)                                    int t;cin>>t;while(t--)
#define for1(i,n)                                  for(int i=0;i<n;i++)
#define for2(i,n)                                  for(int i=1;i<=n;i++)
#define fio                                        ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define SIZE                                       1000001
#define btw(x)                                     (x).begin(),(x).end()
typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> ordered_set;
int powmod(int a,int b) {int res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
int gcd(int a,int b) { return b?gcd(b,a%b):a;}
int multiplymod(int a,int b){int res=0;while(b){if(b&1){res+=a;}a*=2;b/=2;res%=mod;a%=mod;}return res;}
int expomod(int a,int b,int  m){int res=1;while(b>0){if(b&1){res=(res*a)%m;}a=(a*a)%m;b = b>>1;}return res;}

int dp[105][100005];
int v[100005],u[100005];

int ans(int n,int w){
    if(n==0 or w==0){
        return dp[n][w]=0;
    }
    if(dp[n-1][w]!=0) return dp[n-1][w];

    if(v[n-1]<=w){
        return dp[n-1][w]=max(u[n-1]+ans(n-1,w-v[n-1]),ans(n-1,w));
    }
    else return dp[n-1][w]=ans(n-1,w);
}

void solve(){
    int n,w;
    cin>>n>>w;
    memset(dp,0,sizeof dp);
    for(int i=0;i<n;i++){
        cin>>v[i]>>u[i];
    }
    cout<<ans(n,w)<<"\n";
}
int32_t main()
{
    fio;
    solve();
}

Measured memory_bytes: 85728
#include <bits/stdc++.h>
#define le long long

using namespace std;

int main()
{
    le x, k, d;
    cin >> x >> k >> d;

    if(k < abs(x)/d)
        cout << abs(x)-k*d;
    else
    {
        le p1 = abs(x)%d, p2 = d-p1;
        if((k-abs(x)/d)%2)
            cout << p2;
        else
            cout << p1;
    }
    return 0;
}


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

using namespace std;
int main()
{
    string a ;
    cin >> a ;

    if( a[ 0 ] == a[ 1 ] ){
        cout << " No " ;
        return 0 ;
    }
    else
        if ( a[ 0 ] == a[ 2 ]){
           cout << " No " ;
           return 0 ;
        }
        else
        if ( a[ 1 ] == a[ 2 ] ){
            cout << " No " ;
            return 0 ;
        }
        else
            cout << " Yes " ;

    return 0;
}


Measured memory_bytes: 3524