akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
const  long long INF = 1LL << 60;
long long dp[100010];
long long h[100010];

template<class T> void chmin(T &a, T b) {
  if (a>b) {
    a = b;
  }
}
template<class T> inline void chmax(T &a, T b) {
  if (a<b) {
    a = b;
  }
}

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

  for (int i = 0; i < 100010; i++) {
    dp[i] = -1;
  }
  int a[100010];
  for (int i = 0; i < m; i++) {
    cin >> a[i];
    dp[a[i]] = -10;
  }
  
  dp[0] = 1;
  for (int i = 1; i <= n; i++) {
    if (dp[i] == -10) continue;
    if (i == 1) dp[1] = 1;
    if (dp[i-1]==-10 && dp[i-2]==-10) {
      cout << 0 << endl;
      return 0;
    }
    else if (dp[i-1] == -10) {
      dp[i] = dp[i-2];
    }
    else if (dp[i-2] == -10) {
      dp[i] = dp[i-1];
    }
    else dp[i] = (dp[i-1]+dp[i-2])%1000000007;    
  }
  cout << dp[n] << endl;
}

Measured memory_bytes: 4672
#bit全探索の亜種(4種全探索)
#itertools.product([0,1,2,3],repeat=N)

import itertools
N,A,B,C = map(int,input().split())
l = [int(input()) for i in range(0,N,1)]

ans = 10**10
for ABCD in itertools.product([0,1,2,3],repeat=N):
    tmp = [[] for i in range(4)]
    for i in range(0,N,1):
        tmp[ABCD[i]].append(l[i])
    score = 0
    owaowari = False
    for i in range(3):#Dはくっ付ける必要なし
        if len(tmp[i])==0:
            owaowari = True
            break
        score+=10*max(len(tmp[i])-1,0)
    if owaowari: continue
    score+=abs(A-sum(tmp[0]))
    score+=abs(B-sum(tmp[1]))
    score+=abs(C-sum(tmp[2]))
    ans = min(ans,score)


print(ans)


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

int main(){
  int n,t,a,h;
  cin >> n >> t >> a;
  double m = t + 10000;
  int index;
  for(int i = 0;i < n;i++){
    cin >> h;
    if (abs(a-t+h*0.006) < m){
      m = abs(a-t+h*0.006);
      index = i+1;
    }
  }
  cout << index << endl;
} 

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
const int N = 1005;
int cnt[N];
int main() {
	int n;
	scanf("%d", &n);
	for (int i = 2; i <= n; ++ i) {
		int tmp = i;
		for (int j = 2; j * j <= tmp; ++ j) {
			while (tmp % j == 0) {
				tmp /= j;
				cnt[j] ++;
			}
		}
		if (tmp > 1) cnt[tmp] ++;
	}
	int ans = 1;
	for (int i = 2; i <= n; ++ i) ans = 1LL * (1 + cnt[i]) * ans % (int) (1e9 + 7);
	printf("%d\n", ans);
}



Measured memory_bytes: 256
import java.awt.geom.*;
import java.io.*;
import java.util.*;

public class Main{
	double EPS = 1.0e-08;
	
	private void doit(){
		Scanner sc = new Scanner(System.in);
		while(true){
			int a = sc.nextInt();
			int b = sc.nextInt();
			int c = sc.nextInt();
			if((a|b|c) == 0) break;
			int d = b * b - 4 * a * c;
			int e = (int) Math.sqrt(d + EPS);
			if(e * e != d){
				System.out.println("Impossible");
				continue;
			}
			int res1 = -b + e;
			int res2 = -b - e;
			int aa = 2 * a;
			int div = gcd(res1, aa);
			int p = aa / div;
			int q = res1 / div;
			if(p * q < 0){
				p = Math.abs(p);
				q = Math.abs(q);
			}
			else{
				p = Math.abs(p);
				q = Math.abs(q) * -1;
			}
			int div2 = gcd(res2, aa);
			int r = aa / div2;
			int s = res2 / div2;
			if(r * s < 0){
				r = Math.abs(r);
				s = Math.abs(s);
			}
			else{
				r = Math.abs(r);
				s = Math.abs(s) * -1;
			}
			
			if(p > r || (p == r && q >= s)){
				System.out.printf("%d %d %d %d\n", p,q,r,s);
			}
			else{
				System.out.printf("%d %d %d %d\n", r,s,p,q);
			}
		}
	}
	
	private int gcd(int a, int b){
		if(b == 0)  return a;
		else        return gcd(b, a%b);
	}
	
	private void debug(Object... o) { System.out.println("debug = " + Arrays.deepToString(o)); }

	public static void main(String[] args) {
		new Main().doit();
	}
}

Measured memory_bytes: 33412
class Rsum():
	def __init__(self, size):
		#the number of nodes is 2n-1
		self.n = 1
		while self.n < size:
			self.n *= 2
		self.node = [0] * (2*self.n-1)

	def Access(self, x):
		return self.node[x+self.n-1]

	def Add(self, x, val):
		x += self.n-1
		self.node[x] += val
		while x > 0:
			x = (x-1)//2
			self.node[x] = self.node[2*x+1] + self.node[2*x+2]
		return

	#[l, r)
	def Get(self, l, r):
		L, R = l+self.n, r+self.n
		s = 0
		while L<R:
			if R & 1:
				R -= 1
				s += self.node[R-1]
			if L & 1:
				s += self.node[L-1]
				L += 1
			L >>= 1
			R >>= 1
		return s

n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))

ans = 200
for bit in range(1<<n):
	if sum(list(map(int, list(bin(bit)[2:])))) %2 == 1:
		continue
	if sum([(i%2) ^ ((bit>>i)&1) for i in range(n)]) != n//2:
		continue
	c = [[b[i], i, (i%2) ^ ((bit>>i)&1)] if (bit>>i)&1 == True else [a[i], i, (i%2) ^ ((bit>>i)&1)] for i in range(n)]
	#print(bit, c)
	even = 0
	odd = 1
	c.sort(key=lambda x: (x[0], x[1]))
	#print(c)
	goal = [-1 for _ in range(n)]
	for i, p in enumerate(c):
		x, y, z = p
		if z == 0:
			goal[even] = [x, y]
			even += 2
		else:
			goal[odd] = [x, y]
			odd += 2
	#print(goal)
	ok = True
	for i in range(n-1):
		if goal[i][0] > goal[i+1][0]:
			ok = False
			break
	if not ok:
		continue

	tmp = 0
	st = Rsum(n)
	for x, y in goal:
		tmp += st.Get(y, n)
		st.Add(y, 1)
	ans = min(ans, tmp)

if ans == 200:
	print(-1)
else:
	print(ans)

Measured memory_bytes: 60892
#include <bits/stdc++.h>
using namespace std;
 
int main(){
    string s;
    cin >> s;
    
    int l = s.size(), ans = 0;    
    string substr1, substr2;
    for(int i=l-1;i>=0;i--){
        if(i % 2 == 0){
            substr1 = s.substr(0, i/2);
            substr2 = s.substr(i/2, i/2);
            // cout << substr1 << " " << substr2 << endl;
            if(substr1 == substr2){
                cout << i << endl;
                return 0;
            }
                
        }
    }

}

Measured memory_bytes: 256
#include <bits/stdc++.h>  // ver1.9.4
#define int long long
#define ALL(v) (v).begin(),(v).end()
#define Vi vector<int>
#define pb push_back
#define mp make_pair
#define cYES cout<<"YES"<<endl
#define cNO cout<<"NO"<<endl
#define cYes cout<<"Yes"<<endl
#define cNo cout<<"No"<<endl
#define rep(i,a,b) for(int i=a;i<b;i++)
#define repeq(i,a,b) for(int i=a;i<=b;i++)
#define repr(i,a,b) for(int i=a;i>b;i--)
#define repreq(i,a,b) for(int i=a;i>=b;i--)
#define leng(n) (int)(log10(n)+1)
#define Vout(a) rep(i,0,a.size()-1)cout<<a[i]<<' ';cout<<a[a.size()-1]<<endl;
#define INF 9000000000000000000  //  9.0 * 10^18
#define MOD 1000000007  //  10^9 + 7
using namespace std;

signed main() {
  cout << fixed << setprecision(8);
  int n,c,k;
  cin >> n >> c >> k;
  Vi a(n);
  rep(i,0,n) cin >> a[i];
  sort(ALL(a));
  int ans = 0,nowl=0,nowh=0;
  rep(i,0,n){
    //cout << nowl << ' '<<nowh<<' '<<ans<<endl;
    if(a[i]<=nowl && nowh < c) {nowh++;continue;}
    ans++;
    nowl = a[i]+k;
    nowh = 1;
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
#pragma GCC optimize("unroll-loops,no-stack-protector")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
using namespace std;
typedef long long ll;

int main(){
	ios_base::sync_with_stdio(false); 
	cin.tie(NULL);
	ll n;
	cin >> n;
	vector <ll> arr(n);
	ll temp = 0;
	ll count = 0;
	for (int z=0;z<n;z++){
		ll a;
		cin >> a;
		if (a >= temp){
			count++;
			temp = a;
		}
	}
	cout << count << endl;
	cin >> n;
}

Measured memory_bytes: 256
#define _USE_MATH_DEFINES

#include <iostream>
#include <iomanip>
#include <stdio.h>

#include <sstream>
#include <algorithm>
#include <iterator>
#include <cmath>
#include <complex>

#include <string>
#include <cstring>
#include <vector>
#include <bitset>

#include <queue>
#include <set>
#include <map>
#include <stack>
#include <list>

#include <ctime>
////
//#include <random>//
/////////

typedef long long LL;
typedef long double LD;
typedef unsigned long long ULL;

////定数
const int INF = (int)1e9 + 10;
const LL MOD = (LL)1e9 + 7;
const LL LINF = (LL)4e18 + 20;
const LD PI = acos(-1.0);
const double EPS = 1e-9; 
/////////
using namespace::std;
void chmax(LL& a, LL b) {
	a = max(a, b);
}
//////////////

void solve() {
	int Q;
	cin >> Q;
	LL A = 0;
	LL B = 0;
	priority_queue<LL> pqL;//降順,大きいのが先頭
	priority_queue<LL, vector<LL>, greater<LL>> pqR;//昇順
	while(Q--) {
		int c, a, b;
		cin >> c;
		if (c == 2) {
			cout << pqL.top() << " " << A + B << endl;
		}
		else {
			cin >> a >> b;
			B += b;
			pqL.push(a);
			pqR.push(a);
			if (pqL.top() > pqR.top()) {
				LL tempL = pqL.top(); pqL.pop();
				LL tempR = pqR.top(); pqR.pop();
				A += abs(tempL - tempR);
				pqL.push(tempR);
				pqR.push(tempL);
			}
		}
	}
}

signed main(void) {
	std::cin.tie(0);
	std::ios::sync_with_stdio(false);
	std::cout << std::fixed;//小数を10進数表示
	cout << setprecision(16);//小数点以下の桁数を指定//coutとcerrで別	

	solve();
}


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

#define __STDC_FORMAT_MACROS
#define p64 PRId64

#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) FOR (i, 0, n)
#define ALL(f, x, ...)                                                         \
    ([&] (decltype ((x)) ALL) {                                                \
        return (f) (begin (ALL), end (ALL), ##__VA_ARGS__);                    \
    }) (x)

using namespace std;
using ll = int64_t;

int main() {
    int K, X;
    cin >> K >> X;
    cout << (X <= 500 * K ? "Yes" : "No") << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main() {
    int N;
    cin >> N;
    vector<int> A(N+2);
    for(int i = 1; i <= N; i++) cin >> A.at(i);
    vector<int> ryohi1(N+1); // iからi+1に行くのにかかるお金(0<=i<=N)
    int sum = 0; //飛ばさずに行った場合の総額
    for(int i = 0; i <= N; i++) {
        ryohi1.at(i) = abs(A.at(i)-A.at(i+1));
        sum += ryohi1.at(i);
    }
    vector<int> ryohi2(N+1); // i-1からi+1に行くのにかかるお金(1<=i<=N)
    for(int i = 1; i <= N; i++) ryohi2.at(i) = abs(A.at(i-1)-A.at(i+1));
    for(int i = 1; i <= N; i++) cout << sum - ryohi1.at(i-1) - ryohi1.at(i) + ryohi2.at(i) << endl;
   
}


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

int main(){
  int N;
  long long D;
  cin >> N >> D ;
  long long a,b;
//  for(int i=0;i<N;i++) cin >> a[i] >> b[i];
  int mycount=0;
  for (int i=0;i<N;i++){
//    for(int j=i;j<N;j++){
      cin >> a >> b;
      if( a*a+b*b <= D*D) {
        mycount++;
//    cout << a[i]*a[i] + b[i]*b[i] << " " << D*D << endl;
      }
//    }
  }
  cout << mycount << endl;
  
  return 0;
}

Measured memory_bytes: 3576
#include <bits/stdc++.h>
 
#define _overload(_1,_2,_3,name,...) name
#define _rep(i,n) _range(i,0,n)
#define _range(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define rep(...) _overload(__VA_ARGS__,_range,_rep,)(__VA_ARGS__)
 
#define _rrep(i,n) _rrange(i,n,0)
#define _rrange(i,a,b) for(int i=(int)(a)-1;i>=(int)(b);--i)
#define rrep(...) _overload(__VA_ARGS__,_rrange,_rrep,)(__VA_ARGS__)
 
#define _all(arg) begin(arg),end(arg)
#define uniq(arg) sort(_all(arg)),(arg).erase(unique(_all(arg)),end(arg))
#define getidx(ary,key) lower_bound(_all(ary),key)-begin(ary)
#define clr(a,b) memset((a),(b),sizeof(a))
#define bit(n) (1LL<<(n))
 
// #define DEBUG
 
#ifdef DEBUG
    #define dump(...) fprintf(stderr, __VA_ARGS__)
#else
    #define dump(...)
#endif
 
template<class T>bool chmax(T &a, const T &b) { return (a<b)?(a=b,1):0;}
template<class T>bool chmin(T &a, const T &b) { return (b<a)?(a=b,1):0;}
 
using namespace std;
using ll=long long;
using vi=vector<int>;
using vll=vector<ll>;
 
const double EPS = 1e-10;
const double PI = acos(-1.0);
const ll inf =1LL << 62;
const ll mod=1000000007LL;
const int dx[4]={1,0,-1,0};
const int dy[4]={0,1,0,-1};
 
 
ll extgcd(ll a,ll b,ll& x,ll& y){x=1,y=0;ll g=a;if(b!=0) g=extgcd(b,a%b,y,x),y-=a/b*x;return g;}
ll ADD(const ll &a, const ll &b,const ll &mod) { return (a+b)%mod;}
ll SUB(const ll &a, const ll &b,const ll &mod) { return (a-b+mod)%mod;}
ll MUL(const ll &a, const ll &b,const ll &mod) { return (1LL*a*b)%mod;}
ll DIV(const ll &a, const ll &b,const ll &mod) {ll x,y; extgcd(b,mod,x,y);return MUL(a,(x+mod)%mod,mod);}
 
random_device rd;
mt19937 mt(rd());
uniform_int_distribution<int> dice(1,6);
uniform_real_distribution<double> score(0.0,10.0);

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

    int w, h, x, y; cin >> w >> h >> x >> y;
    double res = 1.0 * w * h / 2;
    int mul = 0;
    if(w % 2 == 0 and h % 2 == 0 and
       x == w / 2 and y == h / 2){
        mul = 1;
    }

    cout.precision(20);
    cout << fixed << res << " " << mul << endl;

    return 0;
}


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

int main(){
    int N, M;
    cin >> N >> M;
    int L[M], R[M];

    for(int i = 0; i < M; i++){
        cin >> L[i] >> R[i];
    }

    sort(L, L + M, greater<int>());
    sort(R, R + M);

    if(L[0] > R[0]){
        cout << 0 << endl;
    }

    else{
        cout << R[0] - L[0] + 1 << endl;
    }
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define rep(i,n) for(int i = 0; i < n; ++i)
#define rep2(i,st,ed) for(int i = st; i < ed; ++i)
#define mk(x,y) make_pair(x,y)
#define pb(x) push_back(x)
const ll mod = 1e5+3;
const ll N = 1e2 + 200;
const ll INF = 9999999999999;
const double eps = 1e-7;

int main(){
    int n;
    int g[4][4];
    int vis[4][4] = {0};
    rep(i,3){
        rep(j,3){
            cin>>g[i][j];
        }
    } 
    cin>>n;
    int x;
    rep(i,n){
        cin>>x;
        rep(j,3){
            rep(k,3){
                if(g[j][k] == x){
                    vis[j][k] = 1;
                }
            }
        }
    } 
    int flag = 0;
    int a[4] = {0};
    rep(i,3){
        a[0] = 0;
        a[1] = 0;
        rep(j,3){
            if(vis[i][j] == 1){
                a[0]++;
            }
            if(vis[j][i] == 1){
                a[1]++;
            }
        }
        if(a[0] == 3 || a[1] == 3) flag = 1;
    }
    rep(i,3){
        if(vis[i][i] == 1){
            a[3]++;
        }
        if(vis[2-i][i] == 1){
            a[2]++;
        }
    }
    if(a[3] == 3 || a[2] == 3){
        flag = 1;
    }
    if(flag)cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <queue>
#include <cstring>
#include <cstdio>
#include <cmath>
#include <set>
#include <map>
using namespace std;

int ketasuu(long long x) {

    int cnt = 1;
    while (x / 10 > 0) {
        cnt ++;
        x /= 10;
    }

    return cnt;
}

int main() {

    long long n, a, b;
    cin >> n;
    int res = ketasuu(n);

    for (long long a = 1; a*a <= n; a++) {
        if (n % a == 0) {
            b = n / a;
            res = min(res, max(ketasuu(a), ketasuu(b))); 
        }
    }
    
    cout << res << endl;

    return 0;

}


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

int n;
long a[100010], L[100010], R[100010]; // L[0, i), R[i, n)

long gcd(long a, long b) { return b==0 ? a : gcd(b, a%b); }
int main() {
    cin.tie(0); ios_base::sync_with_stdio(false);
    cin >> n;
    for(int i=0; i < n; ++i) cin >> a[i];

    for(int i=0; i < n; ++i)
        L[i+1] = gcd(L[i], a[i]);

    for(int i=n-1; i >= 0; --i)
        R[i] = gcd(R[i+1], a[i]);

    long ans = 0;
    for(int i = 0; i < n; ++i)
        ans = max(ans, gcd(L[i], R[i+1]));
    
    cout << ans << '\n';
    return 0;
}

Measured memory_bytes: 2560
#include <iostream>
#include <cmath>
using namespace std;
typedef long long int LLI;
int main()
{
	string s;
	cin >> s;
	int sum = 700;
	for(int i = 0; i < s.size(); i++)
	{
		if( s[i] == 'o' )
			sum += 100;
	}
	cout << sum;
}


Measured memory_bytes: 3588
#include <iostream>
#include <vector>
#include <queue>
#include <algorithm>
#include <cmath>
#include <bitset>
#include <iomanip>
#include <stack>
#include <list>
#include <map>
#include <unordered_map>
#include <chrono>
#include <numeric>
using namespace std;
using ll = long long;
const ll INF = (ll)1e18+1;
const ll DIV = 1000000007;
//#define TEST
int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
#ifdef TEST
    chrono::system_clock::time_point start, end;
    start = chrono::system_clock::now();
#endif
    long N, K;
    cin >> N >> K;
    map<long, vector<long>> sunuke;
    for(size_t i=0;i<K; i++)
    {
        long D;
        cin >> D;
        for(size_t d=0;d<D; d++)
        {
            long a;
            cin >> a;
            sunuke[a].push_back(i);
        }
    }
    cout << N - sunuke.size() << endl;
#ifdef TEST
    end = chrono::system_clock::now();
    cerr << static_cast<double>(chrono::duration_cast<chrono::microseconds>(end - start).count() / 1000.0) << "[ms]" << endl;
#endif
    return 0;
}

Measured memory_bytes: 3748
#include<iostream>
#include<string>
#include<vector>
using namespace std;
int main()
{
    double x[100];
    string u[100];
    double n, s = 0;
    cin >> n;
    for(int i = 0; i < n; i++)
    {
        cin >> x[i] >> u[i];
        if(u[i] == "BTC")
            s = s + x[i] * 380000;
        if(u[i] == "JPY")
            s = s + x[i];
    }
    cout << s;
    return 0;
}

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

ab = [list(map(int,input().split())) for _ in range(N)]
AB = sorted(ab, key=lambda x: x[1])

time = 0

for i in range(N):
  time += AB[i][0]
  if time > AB[i][1]:
    print("No")
    exit()
print("Yes")

Measured memory_bytes: 55196
import java.util.Scanner;

public class Main {
    
    public static void main(String... strs) {
        Scanner sc = new Scanner(System.in);
        int size = sc.nextInt();
        int[] heap = new int[size];
        for(int i = 0; i < size; i++){
            int element = sc.nextInt();
            heap[i] = element;
        }
        for(int i = 0; i < size; i++) {
            System.out.print("node " + (i+1) + ": ");
            System.out.print("key = " + heap[i] + ", ");
            if(i != 0)
                System.out.print("parent key = " + heap[(i-1)/2] + ", ");
                
            if(2 * i + 1 < size)
                System.out.print("left key = " + heap[2 * i + 1] + ", ");
                
            if(2 * i + 2 < size)
                System.out.print("right key = " + heap[2 * i + 2] + ", ");
                System.out.print("\n");
        }
    }
    
}


Measured memory_bytes: 27408
#include <iostream>
#include <stdio.h>

#include <vector>
#include <cctype>
#include <cstring>
#include <algorithm>
#include <cmath>
#include <string>
#include <map>
#include <climits>
#include <iomanip>

using namespace std;



int main() {
	int k, a, b;
	cin >> k >> a >> b;

	if (k == 1 ||a%k==0||b%k==0) {
		cout << "OK" << endl;
		return 0;
	}

	if (a / k == b / k)cout << "NG" << endl;
	if (a / k != b / k)cout << "OK" << endl;

	return 0;
}

Measured memory_bytes: 3588
#include<iostream>
#include<string>
int main(){
std::string c;
std::cin >> c;
if(c=="o"){
std::cout << "vowel" <<std::endl;
        }
 else if(c=="u"){
std::cout << "vowel" <<std::endl;
}
 else if(c=="i"){
std::cout << "vowel" <<std::endl;
    }
     else if(c=="e"){
std::cout << "vowel" <<std::endl;
}
 else if(c=="a"){
std::cout << "vowel" <<std::endl;
}
else {
std::cout << "consonant" << std::endl;
}
return 0;
}



Measured memory_bytes: 256
import math

# inputList=[]
# for i in range(6):
#     inputNum = input()
#     inputList.append(inputNum)
inputa = input().split()
# inputb = input().split()

a = int(inputa[0])
b = int(inputa[1])
# c = int(inputa[2])

# x = int(inputb[0])
# y = int(inputb[1])

# listb = []
# listb = [int(n) for n in inputb]

sum = 0

smallest = -1
idx = 0

for i in range(a):
    sum += b + i

    if smallest == -1:
        smallest = abs(b + i)
    elif smallest > abs(b + i):
        smallest = abs(b + i)
        idx = i

ans = sum - (b + idx)
print(int(ans))


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

template<typename T> void drop(const T &x){cout<<x<<'\n';exit(0);}

void solve() {
  int n;
  cin >> n;
  vector<int> a, b;
  for(int i = 0; i < n; ++i) {
    int x, y;
    cin >> x >> y;
    a.push_back(x+y);
    b.push_back(x-y);
  }
  sort(a.begin(), a.end());
  sort(b.begin(), b.end());
  long long ans = max(a.back()-a[0], b.back()-b[0]);
  cout << ans << '\n';
}

signed main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int T=1;
  //cin >> T;
  while(T--) solve();

  return 0;
}


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

using namespace std;

void solve(void)
{
	int n, m = 100010;
	cin >> n;
	vector<int> ans(m);
	for (int i = 2; i < m; i++)
	{
		int p = i*2;
		for (int f = 2; f * f <= i; f++)
		{
			if (i % f == 0)
			{
				p /= f;
				if (f * f != i)
				{
					p /= i / f;
				}
			}
		}
		if (p <= 1) ans[i] = 1;
	}
	for (int i = 0; i < m-1; i++) ans[i+1] += ans[i];
	while (n--)
	{
		int x;
		cin >> x;
		cout << ans[x] << '\n';
	}
}

int main()
{
	solve();
	//cout << "yui(*-v・)yui" << endl;
	return 0;
}



Measured memory_bytes: 3108
#include <bits/stdc++.h>
using namespace std;
int main()
{
	int n;
	string str;
	cin>>n>>str;
	int cnt = 1;
	for(int i = 1;i<str.size();i++)
	{
		if(str[i]!=str[i-1])
			cnt++;
		else
			continue;
	}
	cout<<cnt<<endl;
	return 0;
}

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

int main()
{
    #define int long long
    int N, W;
    cin >> N >> W;

    int v[N];
    int w[N];
    for (int i = 0; i < N; i++)
    {
        cin >> w[i];
        cin >> v[i];
        // cout << w[i] << " " << v[i] << "\n";
    }

    int dp[W + 1]; //dp[i]: max value with W = i (for given amount of items available)
    // cout << "\n";
    for (int i = 0; i <= W; i++)
    {
        if (i >= w[0])
            dp[i] = v[0];
        else
            dp[i] = 0;
    }
    // for (int i = 0; i <= W; i++)
    // {
    //     cout << dp[i] << " ";
    // }
    // cout << "\n";
    for (int i = 1; i < N; i++) //update dp[] for each new item
    {
        int dp_new[W + 1];
        for (int j = 0; j < w[i]; j++)
            dp_new[j] = dp[j];

        for (int j = w[i]; j <= W; j++)
        {
            dp_new[j] = max(dp[j], v[i] + dp[j - w[i]]);
        }
        for (int j = 0; j <= W; j++)
        {
            dp[j] = dp_new[j];
            // cout << dp[j] << " ";
        }
        // cout << "\n";
    }
    cout << dp[W];
}

Measured memory_bytes: 1792
#include<stdio.h>
#include<string.h>
#include<algorithm>
#include<iostream>
#define ll long long
using namespace std;
int a[60],n;
ll sum;
int main()
{
    scanf("%d",&n);
    for(int i=1; i<=n; i++)
        scanf("%d",&a[i]);
    for(int i=1; i<n; i++)
        for(int j=i+1; j<=n; j++)
            sum += a[i]*a[j];
    printf("%d\n",sum);
    return 0;
}

Measured memory_bytes: 256
// http://kmjp.hatenablog.jp/entry/2018/03/20/0900

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define FOR(I,A,B) for(int I = (A); I < (B); ++I)
#define POSL(x,v) (lower_bound(x.begin(),x.end(),v)-x.begin()) //ai>=v  x is sorted

int main(){

	ll N,ans=0;
	cin >> N;
	vector<ll> A(N),B(N);
	FOR(i,0,N)cin>>A[i];
	FOR(i,0,N)cin>>B[i];
	sort(A.begin(),A.end());
	sort(B.begin(),B.end());

	FOR(i,0,29){
		vector<ll> C(N);
		FOR(x,0,N)C[x] = B[x]%(1<<(i+1));
		sort(C.begin(),C.end());
		ll tot = 0;
		FOR(x,0,N){
			ll y = A[x]%(1<<(i+1));
			tot += POSL(C,(1<<(i+1))-y)-POSL(C,(1<<(i))-y);
			tot += POSL(C,(1<<(i+2))-y)-POSL(C,3*(1<<(i))-y);
		}
		if(tot%2) ans += 1<<i;
	}
	cout << ans << endl;

}


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

bool comp(tuple<string,char,int> a,tuple<string,char,int> b){
    if(get<0>(a) == get<0>(b)){
        return get<1>(a) > get<1>(b);
    }
    else{
        return get<0>(a) < get<0>(b);
    }
}

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

    vector<tuple<string,char,int>> SP(N);

    int index = 1;
    for(auto &t : SP){
        string s;
        cin >> s;
        int i;
        cin >> i;
        t = make_tuple(s,i,index);
        index++;
    }

    sort(SP.begin(),SP.end(),comp);

    for(auto &t : SP){
        cout << get<2>(t) << endl;
    }
}

Measured memory_bytes: 256
#include <iostream>
#include<vector>
#include <algorithm>
using namespace std;
vector<long> a;
long n,k;

bool ok(long n){
      long sum = 0;
      for(int i = 0;i < a.size();i++){
            sum += (a[i] - 1) / n;
      }
      return sum <= k;
}
int main(void){
    cin >> n >> k;
    a.resize(n);
    long bot = 0;
    long top = 1e9;
    for(int i = 0;i < n;i++){
          cin >> a[i];
    }
    
    while(top - bot > 1){
          int mid = (top + bot) / 2;
          if(ok(mid)){
                top = mid;
          }else{
                bot = mid;
          }
    }
    
    cout << top << endl;
}


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

int main()
{
    int r, c;
    cin >> r >> c;
    vector<vector<int> > spreadsheet(101, vector<int>(101));
    for (int i = 0; i < r; i++)
    {
        for(int j = 0; j < c; j++)
            cin >> spreadsheet.at(i).at(j);
    }
    for(int i = 0; i < r; i++)
    {
        int sum = 0;
        for (int j = 0; j < c; j++)
            sum += spreadsheet.at(i).at(j);
        spreadsheet.at(i).at(c) = sum;
    }
    for(int j = 0; j < c + 1; j++)
    {
        int sum = 0;
        for (int i = 0; i < r; i++)
            sum += spreadsheet.at(i).at(j);
        spreadsheet.at(r).at(j) = sum;
    }
    for(int i = 0; i < r + 1; i++)
    {
        for(int j = 0; j < c + 1; j++)
        {
            if(j != c)
                cout << spreadsheet.at(i).at(j) << " ";
            else
                cout << spreadsheet.at(i).at(j);
        }
        cout << endl;
    }
}


Measured memory_bytes: 3172
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <string>
#include <stack>
#include <queue>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <cmath>

using namespace std;
#define PI 3.1415926535897932384626433832795
#define MOD (1000000007)
#define EPS (1e-15)
#define rep(i, n) for (int i = 0; i < (n); i++)
#define repc(i, s, n) for (int i = (s); i <= (n); i++)
#define rrep(i, n) for (int i = (n) - 1; i >= 0; i--)
#define rrepc(i, s, n) for (int i = (s); i >= (n); i--)
#define bet(x, a, b) (a) <= (x) && (x) < (b)
typedef long long ll;
typedef unsigned long long ull;



int main()
{
	int N, H, W, A, B, ans = 0;

	cin >> N >> H >> W;
	rep(i, N) {
		cin >> A >> B;
		if (A >= H && B >= W) ans++;
	}

	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 256
import java.util.*;

public class Main {

    Scanner sc = new Scanner(System.in);

    int MOD = (int)998244353;

    public static void main(String[] args) {
        new Main().run();
    }

    void run() {

        int n = sc.nextInt();

        int[] arr = new int[n+2];
        for (int i=1; i<n+1; i++) arr[i] = sc.nextInt();


        int sum = 0;

        for (int i=1; i<n+2; i++) {
            sum += Math.abs(arr[i]-arr[i-1]);
        }

        
        StringBuilder sb = new StringBuilder();

//        if (!((0 <= arr[0] && arr[0] <= arr[1]) || (arr[1] <= arr[0] && arr[0] <= 0))) {
//
//        }

        for (int i=0; i<n; i++) {
            if (!((arr[i] <= arr[i+1] && arr[i+1] <= arr[i+2]) || (arr[i+2] <= arr[i+1] && arr[i+1] <= arr[i]))) {
                if (arr[i] < arr[i+2]) {
                    if (arr[i+1] < arr[i]) {
                        sb.append(sum - Math.abs(arr[i+1]-arr[i]) * 2 + "\n");
                    } else {
                        sb.append(sum - Math.abs(arr[i+2]-arr[i+1]) * 2 + "\n");
                    }
                } else {
                    if (arr[i+1] < arr[i+2]) {
                        sb.append(sum - Math.abs(arr[i+1]-arr[i+2]) * 2 + "\n");
                    } else {
                        sb.append(sum - Math.abs(arr[i+1]-arr[i]) * 2 + "\n");
                    }
                }
            } else {
                sb.append(sum + "\n");
            }
        }

        System.out.println(sb.toString());
    }
}



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

using namespace std;

const int N = 2e6 +5;

int cnt[N];

int main() {
  int n, k;
  scanf("%d %d", &n, &k);
  for (int i = 0; i < n; i++) {
    int x;
    scanf("%d", &x);
    cnt[x]++;
  }
  sort(cnt, cnt + n + 1);
  reverse(cnt, cnt + n + 1);
  int ans = 0;
  for (int i = k; i <= n; i++)
    ans += cnt[i];
  printf("%d\n", ans);
  return 0;
}

Measured memory_bytes: 1024
package main

import (
        "fmt"
)

func solution(a, b, c, d int) (x3, y3, x4, y4 int) {
        x := c - a
        y := d - b
        return c - y, d + x, a - y, b + x
}

func main() {
        var x1, y1, x2, y2 int
        fmt.Scan(&x1, &y1, &x2, &y2)
        fmt.Println(solution(x1, y1, x2, y2))
}

Measured memory_bytes: 512
#include <iostream>
using namespace std;
int _s,a,b;
int solve(int c,int n,int s){
      if(!n) return s==_s;
      if(c>=10) return 0;
      return solve(c+1,n-1,s+c) + solve(c+1,n,s);
}
int main(){
      while(cin >> a >> _s,a||_s)cout <<solve(0,a,0)<< endl;
}

Measured memory_bytes: 1156
/* ****mittal21**** */
#include<bits/stdc++.h>
#define ll          long long int 
#define ld          long double
#define pb          push_back
#define endl        '\n'
#define pii         pair<long long int,long long int>
#define vi          vector<ll>
#define all(a)      (a).begin(),(a).end()
#define F           first
#define S           second
#define sz(x)       (ll )x.size()
#define hell        1000000007
#define jell        998244353
#define rep(i,a,b)    for(ll int i=a;i<b;i++)
#define repr(i,a,b)   for(ll int i=a;i>=b;i--)
#define lbnd    lower_bound
#define ubnd        upper_bound
#define mp          make_pair
#define DEC(N)  cout << std::fixed; cout << setprecision(N);
using namespace std;
#define N  100005
void solve()
{
   ll x;
   cin>>x;
   cout<<(x^1)<<endl;
   return;
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    ll testcase=1;
    //cin>>testcase;
    while(testcase--)
    {
        solve();
    }
    return 0;
}

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

#define REP(i, n) for(int (i)=0;(i)<(n);++(i))
#define REPV(iter, v) for(auto (iter)=(v).begin(); (iter)!=(v).end();++(iter))
#define ALL(v) (v).begin(),(v).end()

#define MOD 1000000007

using namespace std;

typedef long long ll;

int main()
{
    ll H, W;
    cin >> H >> W;
    string s[H];
    REP(i, H)
    {
        cin >> s[i];
    }

    map<pair<ll, ll>, vector<pair<ll, ll>>> G;
    ll countW = 0;
    REP(i, H)
    {
        REP(j, W)
        {
            pair<ll, ll> p = make_pair(i, j);
            if (s[i][j] == '.')
            {
                countW++;
                if (j - 1 >= 0)
                {
                    if (s[i][j - 1] == '.')
                    {
                        G[p].push_back(make_pair(i, j - 1));
                    }
                }
                if (j + 1 <= W - 1)
                {
                    if (s[i][j + 1] == '.')
                    {
                        G[p].push_back(make_pair(i, j + 1));
                    }
                }
                if (i - 1 >= 0)
                {
                    if (s[i - 1][j] == '.')
                    {
                        G[p].push_back(make_pair(i - 1, j));
                    }
                }
                if (i + 1 <= H - 1)
                {
                    if (s[i + 1][j] == '.')
                    {
                        G[p].push_back(make_pair(i + 1, j));
                    }
                }
            }
        }
    }
    bool isGoal = false;
    const ll INF = LONG_MAX;
    queue<pair<ll, ll>> q;
    map<pair<ll, ll>, ll> dist;
    REP(i, H)
    {
        REP(j, W)
        {
            pair<ll, ll> p = make_pair(i, j);
            dist[p] = INF;
        }
    }
    q.push(make_pair(0, 0));
    dist[make_pair(0, 0)] = 0;
    while(!q.empty())
    {
        pair<ll, ll> p = q.front();
        q.pop();
        REPV(it, G[p])
        {
            if (dist[*it] == INF)
            {
                q.push(*it);
                dist[*it] = dist[p] + 1;
            }
        }
    }

    ll ans;
    pair<ll, ll> goal = make_pair(H - 1, W - 1);
    if (dist[goal] != INF)
    {
        ans = countW - dist[goal] - 1;
    }
    else
    {
        ans = -1;
    }
    cout << ans << endl;
}


Measured memory_bytes: 768
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<utility>
#include<set>
#include<stack>
#include<list>
#include<deque>
#include<bitset>
#include<iomanip>
#include<cstring>
#include<sstream>
#include<cstdio>
#include<cstdlib>
#include<climits>
#include<cmath>
#include<cctype>


#define pb push_back
#define mp make_pair
#define rep(i,a,b) for(int i=a;i<=b;i++)
#define ren(i,a,b) for(int i=a;i>=b;i--)
#define ff first
#define ss second
#define pll pair<long long int,long long int>
#define pii pair<int,int>
#define vll vector<long long int>
#define vii vector<int>
#define gi(n) scanf("%d",&n)
#define gll(n) scanf("%lld",&n)
#define gstr(n) scanf("%s",n)
#define gl(n) cin >> n
#define oi(n) printf("%d",n)
#define oll(n) printf("%lld",n)
#define ostr(n) printf("%s",n)
#define ol(n) cout << n
#define os cout<<" "
#define on cout<<"\n"
#define o2(a,b) cout<<a<<" "<<b
#define all(n) n.begin(),n.end()
#define present(s,x) (s.find(x) != s.end())
#define cpresent(s,x) (find(all(s),x) != s.end())
#define tr(container, it) for(__typeof(container.begin()) it = container.begin(); it != container.end(); it++)
using namespace std;

typedef unsigned long long int ull;
typedef long long int ll;
typedef long double ld;
typedef vector<vector<ll> > mat;


int main()
{ios_base::sync_with_stdio(false);
int h1,m1,h2,m2,k;
cin>>h1>>m1>>h2>>m2>>k;
int ans=(h2-h1)*60;
if(m2<m1)
{
	ans-=60;
	ans+=60-m1+m2;
}
else
{
	ans+=m2-m1;
}
ol(ans-k);
return 0;
}



Measured memory_bytes: 3584
#include <iostream>
#include <algorithm>
#include <cstring>
#include <cmath>
#include <vector>
#include <set>

#define rep(i, a, b) for ( int i = (a); i < (b); i++ )
#define per(i, a, b) for ( int i = (b)-1; i >= (a); i--)
#define pb push_back
#define mp make_pair
#define bg begin()
#define en end()


using namespace std;

typedef long long ll;

static const long long MOD = 1000000007;

int ans, K, N, A[200005];
multiset<int> ms;

int main(void) {
    scanf("%d %d", &N, &K);
    rep(i, 0, N) {
        scanf("%d", &A[i]);
    }
    sort(A, A+N);
    rep(i, 0, N) {
        int c = 1;
        while (A[i] == A[i+1]) {
            c++; i++;
            if (i == N) break;
        }
        ms.insert(c);
    }
    
    int sz = (int)ms.size();
    auto itr = ms.bg;
    while (sz > K) {
        ans += *itr;
        itr++;
        sz--;
    }
   

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

	return 0;
}


Measured memory_bytes: 10368
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll INF = 1e9;
const ll mod = 1e9+7;

int main(){
    int n;
    cin>>n;
    int cnt = 0;
    int d = 0;
    for(int i=1;i<=n;i++){
        if(i>=1&&i<10)cnt++;
        if(i>=100&&i<1000)cnt++;
        if(i>=10000&&i<1e5)cnt++;
    }
    cout<<cnt<<endl;
}

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

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

using namespace std;

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;
}

int A, B;

int MAX = 1250;

int main() {
    cin >> A >> B;

    for (int i = 1; i <= MAX; i++) {
        for (int j = 1; j <= MAX; j++) {
            if (floor(j * 0.08) == A && floor(j * 0.1) == B) {
                cout << j << endl;
                exit(0);
            } else if (floor(i * 0.08) == A && floor(i * 0.1) == B) {
                cout << i << endl;
                exit(0);
            }
        }
    }

    cout << -1 << endl;
}



Measured memory_bytes: 256
n = int(input())
dp = [0]*(n+1)
def fibo(n):
  if n <2:
    return 1
  if dp[n]  > 0:
    return dp[n]
  dp[n] = fibo(n-1) + fibo(n -2)
  return dp[n]
print(fibo(n))


Measured memory_bytes: 5600
#include <iostream>
#include <set>
#include <string>
using namespace std;
int main(void){
    int n;
    cin>>n;
    string pre="";
    set<string> used;
    string w;
    for (int i =0;i<n;i++){
        cin>>w;
        if (i>=1 && pre.back()!=w[0]){
            cout<<"No";
            exit(0);
        }
        pre=w;
        if (used.find(w)!=used.end()){
            cout<<"No";
            exit(0);
        }
        used.insert(w);
    }
    cout<<"Yes";
    
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)n;i++)
typedef long long ll;
using namespace std;
int main(void){
    int n;ll m;cin>>n>>m;
    for(int i=m/n+1;i>=1;i--){
        if(!(m%i)&&m/i>=n){
            cout<<i<<endl;
            return 0;
        }
    }
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <string.h>
#include <iomanip>
#include <math.h>
#include <string>
#include <queue>
#include <map>
#include <set>
#include <functional>

using namespace std;

typedef long long int ll;
typedef std::pair<int, int> pii;
typedef std::pair<ll, int> pli;
typedef std::pair<ll, ll> pll;

#define FOR(i,n,m) for(ll i=(ll)(m);i<(ll)(n);++i)
#define REP(i,n) FOR(i,n,0)
#define IREP(i,n) for(ll i=(ll)(n);i>=0;--i)
#define OF64 std::setprecision(10)

const ll MOD = 1000000007;
const ll INF = (ll)1e15;

int main()
{
	int N, i;
	cin >> N >> i;
	cout << N - i + 1 << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define all(x) (x).begin(),(x).end()
const int mod=1000000007,MAX=203,INF=1<<30;

int main(){
    
    std::ifstream in("text.txt");
    std::cin.rdbuf(in.rdbuf());
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    while(1){
        string S;cin>>S;
        if(S=="#") break;
        
        vector<vector<int>> A(19,vector<int>(7));
        vector<int> use={4,5,8,9,10,13,14,9};
        
        A[4][0]=0;
        A[4][1]=1;
        A[4][2]=3;
        A[4][3]=4;
        A[4][4]=5;
        A[4][5]=8;
        A[4][6]=9;
        
        A[5][0]=1;
        A[5][1]=2;
        A[5][2]=4;
        A[5][3]=5;
        A[5][4]=6;
        A[5][5]=9;
        A[5][6]=10;
        
        A[8][0]=3;
        A[8][1]=4;
        A[8][2]=7;
        A[8][3]=8;
        A[8][4]=9;
        A[8][5]=12;
        A[8][6]=13;
        
        A[9][0]=4;
        A[9][1]=5;
        A[9][2]=8;
        A[9][3]=9;
        A[9][4]=10;
        A[9][5]=13;
        A[9][6]=14;
        
        A[10][0]=5;
        A[10][1]=6;
        A[10][2]=9;
        A[10][3]=10;
        A[10][4]=11;
        A[10][5]=14;
        A[10][6]=15;
        
        A[13][0]=8;
        A[13][1]=9;
        A[13][2]=12;
        A[13][3]=13;
        A[13][4]=14;
        A[13][5]=16;
        A[13][6]=17;
        
        A[14][0]=9;
        A[14][1]=10;
        A[14][2]=13;
        A[14][3]=14;
        A[14][4]=15;
        A[14][5]=17;
        A[14][6]=18;
        
        bool ok=true;
        
        int cnt=0;
        
        for(int bit=0;bit<(1<<19);bit++){
            int now=bit;
            
            for(int i=0;i<7;i++){
                int s=0;
                for(int j=0;j<7;j++){
                    if(bit&(1<<A[use[i]][j])) s+=(1<<j);
                }
                if(now&(1<<use[i])) now-=(1<<use[i]);
                if(S[s]=='1') now+=(1<<use[i]);
            }
            int to=now;
            int i=7;
            int s=0;
            for(int j=0;j<7;j++){
                if(now&(1<<A[use[i]][j])) s+=(1<<j);
            }
            if(to&(1<<use[i])) to-=(1<<use[i]);
            if(S[s]=='1') to+=(1<<use[i]);
            
            
            if((now&(1<<9))!=(to&(1<<9))){
                ok=false;
                //cout<<bitset<19>(now)<<endl;
                //cnt++;
                
                //cout<<(bit&(1<<9))<<" "<<(now&(1<<9))<<endl;
            }
        }
        
        if(ok) cout<<"yes"<<endl;
        else cout<<"no"<<endl;
        
        //cout<<cnt<<endl;
        
        //break;
    }
}




Measured memory_bytes: 3116
#define _USE_MATH_DEFINES
#include <cstdio>
#include <iostream>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <complex>
#include <string>
#include <vector>
#include <array>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <limits>
#include <climits>
#include <cfloat>
#include <functional>
#include <iterator>
#include <memory>
#include <regex>
using namespace std;

int main()
{
    int w, h, x, y;
    cin >> w >> h >> x >> y;

    printf("%.10f ", w * (double)h / 2.0);
    if(x * 2 == w && y * 2 == h)
        cout << 1 << endl;
    else
        cout << 0 << endl;

    return 0;
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
#include <boost/range/irange.hpp>
using namespace std;
using boost::irange;

// 定義
typedef long long         ll;
typedef pair<ll, ll>      P;
#define ALL(x)            (x).begin(),(x).end()
#define REP(i, n)         for (ll i = 0 ; i < (ll)n ; ++i)
#define REPN(i, m, n)     for (ll i = m ; i < (ll)n ; ++i)
#define VL                vector<ll>
#define VLL               vector<vector<ll>>
#define VLLL              vector<vector<vector<ll>>>
#define INF               2e9
#define INF_LL            1LL<<60
#define MOD               1000000007

ll Ceil(ll val, ll div)   { return (val + div - 1) / div; }
ll CeilN(ll val, ll div)  { return Ceil(val, div) * div; }
ll FloorN(ll x, ll n)     { return (x - x % n); }
bool IsOdd(ll x)          { return ((x & 1) == 1); }
bool IsEven(ll x)         { return ((x & 1) == 0); }
template<class T> bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

// 処理
void Solve()
{
	ll N;
	cin >> N;
	vector<string> s(N);
	REP(i, N) cin >> s[i];

	ll ans = 0;
	ll aOnly = 0;
	ll bOnly = 0;
	ll abBoth = 0;
	for (auto one : s) {
		REP(i, one.size() - 1) {
			if (one.compare(i, 2, "AB") == 0) ans++;
		}
		if (one.front() == 'B' && one.back() == 'A') {
			abBoth++;
		} else {
			if (one.back() == 'A') aOnly++;
			if (one.front() == 'B') bOnly++;
		}
	}

	if (0 < abBoth) {
		ans += abBoth - 1;
		if (aOnly) ans++, aOnly--;
		if (bOnly) ans++, bOnly--;
	}
	ans += min(aOnly, bOnly);
	cout << ans << endl;
}

// メイン
int main()
{
	cin.tie(nullptr);
	ios_base::sync_with_stdio(false);
	cout << fixed << setprecision(15);
	Solve();
	return 0;
}


Measured memory_bytes: 768
#define _CRT_SECURE_NO_WARNINGS
#include <algorithm>
#include <iostream>
#include <cstdio>
using namespace std;
int a[100010];
int v[100010], p[100010], b[100010];
int main() {
	int n;
	scanf("%d", &n);
	for (int i = 1; i <= n; i++)
		scanf("%d", &a[i]);
	for (int i = 1; i <= n; i += 2)
		v[a[i]]++;
	for (int i = 2; i <= n; i += 2)
		p[a[i]]++;
	for (int i = 1; i <= 100000; i++)
		b[i] = p[i];
	sort(b + 1, b + 100000 + 1);
	int mx = 0;
	for (int i = 1; i <= 100000; i++)
		if (p[i] == b[100000])
			mx = max(mx, v[i] + b[99999]);
		else
			mx = max(mx, v[i] + b[100000]);
	printf("%d\n", n - mx);
	return 0;
}

Measured memory_bytes: 1792
#include<iostream>
#include<stdio.h>
using namespace std;
int main(){
    int W,H,i,ii;
    while(1){
        cin>>H;
        cin>>W;
        if(H==0 && W==0){break;}
        else{
            for(i=0;i<H;i=i+1){for(ii=0;ii<W;ii=ii+1){cout<<"#";}cout<<endl;}}
        cout<<endl;
    }
    
    return 0;}

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

using namespace std;

class ReconTree
{
public:
  int solve();
  void check(int& x, int l, int r, vector<int>& pre, vector<int>& in, vector<int>& po);
};

int ReconTree::solve()
{
  int n;
  cin >> n;

  vector<int> preo(n);
  vector<int> ino(n);
  vector<int> poo;

  for ( int i = 0; i < n; ++i )
    cin >> preo[i];
  
  for ( int i = 0; i < n; ++i )
    cin >> ino[i];
  
  int x = 0;
  check( x, 0, n, preo, ino, poo );

  for ( auto i = 0; i < n; ++i )
    {
      if ( i ) cout << " ";
      cout << poo[i];
    }
  cout << endl;

  return 0;
}

void ReconTree::check(int& x, int l, int r, vector<int>& pre, vector<int>& in, vector<int>& po)
{
  if ( l >= r ) return;
  
  int s = 0;
  
  for ( auto i = l; i < r; ++i )
    {
      if ( pre[x] == in[i] )
        {
          s = i;
          break;
        }
    }
  
  ++x;
  
  check(x, l, s, pre, in, po);
  check(x, s+1, r, pre, in, po);
  po.push_back(in[s]);
  return;
}

int main()
{

  ReconTree rt;

  rt.solve();

  return 0;
}

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

using namespace std;

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

typedef long long ll;
typedef long double ld;

const int Inf = 1e9;
const double EPS = 1e-9;
const int MOD = 1e9 + 7;

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(0);
    ll x, y;
    cin >> x >> y;
    ll l = y / x;
    int cnt = 0;
    ll tmp = 1;
    while (tmp <= l) {
        tmp *= 2;
        cnt++;
    }
    cout << cnt << endl;
    
    return 0;
}



Measured memory_bytes: 256
#[allow(unused_macros)]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };

    ($next:expr, mut $var:ident : $t:tt $($r:tt)*) => {
        let mut $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, [ $t:tt ]) => {
        {
            let len = read_value!($next, usize);
            (0..len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
        }
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, bytes) => {
        read_value!($next, String).into_bytes()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

fn main(){

    input!{
        mut s: chars,
    }

    s.sort();
    if s[0] == s[1] && s[1] != s[2] && s[2] == s[3]{println!("Yes");} else{println!("No");}

}

Measured memory_bytes: 4352
#include <cstdio>

using namespace std;

int main() {
    int a, b, c, ans = 0;
    
    scanf("%d %d %d", &a, &b, &c);
    
    while (1) {
        int na, nb, nc;
        
        if (a % 2 == 1 || b % 2 == 1 || c % 2 == 1) break;
        
        if (a == b && b == c) {
            puts("-1");
            
            return 0;
        }
        
        na = b / 2 + c / 2;
        nb = c / 2 + a / 2;
        nc = a / 2 + b / 2;
        
        a = na;
        b = nb;
        c = nc;
        
        ans++;
    }
    
    printf("%d\n", ans);
    
    return 0;
}


Measured memory_bytes: 128