akhauriyash/Code-Regression huggingface dataset:
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
/*#pragma GCC target ("avx2")
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")*/

using namespace std;
#define ll long long
#define ld long double
#define mp make_pair

typedef long double DOUBLE;
typedef complex<DOUBLE> COMPLEX;
typedef vector<DOUBLE> VD;
typedef vector<COMPLEX> VC;

void print(auto &a)
{
    for (auto s: a) cout<<s<<' ';
    cout<<endl;
}

void get(vector<auto> &a)
{
    for (int i = 0; i<a.size(); i++) cin>>a[i];
}

const int p = 998244353;


int mul(int a, int b) {
    return (1LL * a%p * b%p) % p;
}

int add(int a, int b) {
    int s = (a+b);
    s = s%p;
    if (s<0) s+=p; 
    return s;
}

int sub(int a, int b) {
    int s = (a-b);
    s = s%p;
    if (s<0) s+=p; 
    return s;
}

int po(int a, int deg)
{
    if (deg==0) return 1;
    if (deg%2==1) return mul(a, po(a, deg-1));
    int t = po(a, deg/2);
    return mul(t, t);
}

int inv(int n)
{
    return po(n, p-2);
}

vector<int> Z(string s)
{
int n = s.length();
vector<int> z(n);
int L = 0, R = 0;
for (int i = 1; i < n; i++) {
  if (i > R) {
    L = R = i;
    while (R < n && s[R-L] == s[R]) R++;
    z[i] = R-L; R--;
  } else {
    int k = i-L;
    if (z[k] < R-i+1) z[i] = z[k];
    else {
      L = i;
      while (R < n && s[R-L] == s[R]) R++;
      z[i] = R-L; R--;
    }
  }
}
return z;
}


int main()
{
    ios_base::sync_with_stdio(0);
    int h, w;
    cin>>h>>w;
    vector<vector<char>> a(h, vector<char>(w));
    for (int i = 0; i<h; i++)
    for (int j = 0; j<w; j++) cin>>a[i][j];
    vector<pair<int, int>> cur;
    for (int i = 0; i<h; i++)
    for (int j = 0; j<w; j++) if (a[i][j]=='#') cur.push_back(mp(i, j));
    
    int cnt = 0;
    while (true)
    {
        vector<pair<int, int>> next;
        for (auto it: cur)
        {
            if (it.first>0&&a[it.first-1][it.second]=='.') {next.push_back(mp(it.first-1, it.second)); a[it.first-1][it.second] = '#';}
            if (it.second>0&&a[it.first][it.second-1]=='.') {next.push_back(mp(it.first, it.second-1)); a[it.first][it.second-1] = '#';}
            if (it.first<h-1&&a[it.first+1][it.second]=='.') {next.push_back(mp(it.first+1, it.second)); a[it.first+1][it.second] = '#';}
            if (it.second<w-1&&a[it.first][it.second+1]=='.') {next.push_back(mp(it.first, it.second+1)); a[it.first][it.second+1] = '#';}
        }
        cur = next;
        if (cur.size()==0) break;
        cnt++;
    }
    cout<<cnt;

    
}

Measured memory_bytes: 15080
use std::io;


fn main() {
    let (a, b) = {
        let i = read::<usize>();
        (i[0], i[1])
    };

    if a + b == 15 {
        println!("+");
    } else if a * b == 15 {
        println!("*");
    } else {
        println!("x");
    }
}


#[allow(dead_code)]
fn read<T>() -> Vec<T>
where T:
    std::str::FromStr,
    T::Err: std::fmt::Debug {

    let mut buf = String::new();
    io::stdin().read_line(&mut buf).unwrap();
    buf.split_whitespace()
        .map(|s| s.trim().parse().unwrap())
        .collect()
}

#[allow(dead_code)]
fn read_one<T>() -> T
where T:
    std::str::FromStr,
    T::Err: std::fmt::Debug {

    let mut buf = String::new();
    io::stdin().read_line(&mut buf).unwrap();
    buf.trim().parse().unwrap()
}

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

#define DEBUG(x) cout << "DEBUG>" << #x << ":" << x << endl;
#define REP(i,n) for(long long i=0;i<(n);i++)
#define FOR(i,a,b) for(long long i=(a);i<=(b);i++)

int main() {
  vector<int> v(4);
  cin >> v[0] >> v[1] >> v[2] >> v[3];
  sort(v.begin(), v.end());
  if(v[0] == 1 && v[1] == 4 && v[2] == 7 && v[3] == 9) {
    cout << "YES" << endl;
  } else {
    cout << "NO" << endl;
  }
  return 0;
}


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

typedef long long ll;

#define SIZE_OF_ARRAY(array) (sizeof(array) / sizeof(array[0]))
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define AA(i) cout << i << endl;
#define AS(i) cout << i << " ";

const int INF = 1001001001;

const double PI = 3.14159;

using namespace std;

//vector<ll> memo(1000007, INF);

int main() {

    int n;
    cin >> n;
    int p[n];
    int q[n];
    int pn = 0;
    int qn = 0;
    rep(i, n) cin >> p[i];
    rep(i, n) cin >> q[i];

    int c[n];
    rep(i, n)
        c[i] = p[i];

    sort(c, c+n);

    int i = 0;

    do {
        i++;
        bool pf = true;
        bool qf = true;
        rep(i, n) {
            if (p[i] != c[i])
                pf = false;
            
            if (q[i] != c[i])
                qf = false;
        }

        if (pf) pn = i;
        if (qf) qn = i;
   } while(next_permutation(c, c+n));

    AA(abs(pn - qn));
}

Measured memory_bytes: 3532
n, m = map(int, input().split())
if n == 1:
    digits = [None for _ in range(n)]
    failflag = False
    for _ in range(m):
        s, c = map(int, input().split())
        s = s - 1
        if digits[s] is None or digits[s] == c:
            digits[s] = c
        else:
            failflag = True
            break
    if failflag:
        print(-1)
    else:
        print(''.join(str(0) if digit is None else str(digit) for digit in digits))
else:
    digits = [None for _ in range(n)]
    failflag = False
    for _ in range(m):
        s, c = map(int, input().split())
        s = s - 1
        if digits[s] is None or digits[s] == c:
            digits[s] = c
        else:
            failflag = True
            break
    if digits[0] == 0:
        failflag = True
    elif digits[0] is None:
        digits[0] = 1
    if failflag:
        print(-1)
    else:
        print(''.join(str(0) if digit is None else str(digit) for digit in digits))

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

using namespace std;

static const int maxn = 10000 + 5;

int dp[maxn];
int cut[maxn];
int cost[maxn];
int n;

int solve(int h)
{
  if (h <= 0) return 0;
  int &ret = dp[h];
  if (~ret) return ret;
  int mini = INT_MAX;
  for (int i = 1; i <= n; i++)
  {
    mini = min(mini, cost[i] + solve(h - cut[i]));
  }
  return ret = mini;
}

signed main()
{
  int h;
  cin >> h >> n;
  for (int i = 1; i <= n; i++) cin >> cut[i] >> cost[i];
  memset(dp, -1, sizeof dp);
  cout << solve(h);
}

Measured memory_bytes: 896
#include <stdio.h>

int get_uint() {
  int n = 0;
  int c = getchar_unlocked();
  if(c < 48 || 57 < c) return c;
  while(47 < c && c < 58) {
    n = 10 * n + (c & 0xf);
    c = getchar_unlocked();
  }
  return n;
}
void put_uint(int n) {
  if(!n) {
    putchar_unlocked('0');
    return;
  }
  char buf[11];
  int i = 0;
  while(n) buf[i++] = (char)(n % 10 + '0'), n /= 10;
  while(i--)putchar_unlocked(buf[i]);
}

// ret-> loadable ? 1 : 0
int loadable_num(const int cap, int qty, const int *arr, const int N) {
  int i = 0;
  // while truck exist
  while(qty--) {
    int now = 0;
    // while there is enough capacity for next package
    while(arr[i] + now <= cap) {
      now += arr[i];
      // N -> loaded all package
      if(++i == N) return 1;
    }
  }
  return 0;
}
int main(int argc, char **argv) {
  int n = get_uint();
  int k = get_uint();
  int w[100001];
  for(int i = 0; i < n; ++i) w[i] = get_uint();

  int left = 0;
  // MAX cap
  int right = 10000 * 100000;
  int mid;
  // binary search
  while(right - left > 1) {
    mid = left + (right - left) / 2;
    // enough cap
    if(loadable_num(mid, k, w, n)) right = mid;
    // couldn't load all
    else left = mid;
  }
  put_uint(right);
  putchar_unlocked('\n');
}



Measured memory_bytes: 2128
#include <bits/stdc++.h>
#define ll long long
#define rep(i, a, b) for (ll i = a; i < b; i++)
#define per(i, a, b) for (ll i = a; i > b; i--)
#define vi vector<int>
#define vii vector<vi>
#define vl vector<ll>
#define vll vector<vl>
#define pb push_back
#define pii pair<int, int>
#define pll pair<ll, ll>
#define ff first
#define ss second
#define a(v) (v.begin(), v.end())
#define intlimit 2e9 + 69
#define longlimit 8e18 + 69
#define MOD 1000000007
#define gcd(a, b) __gcd(a, b)
#define lcm(a, b) ((a) * (b) / gcd(a, b))
using namespace std;
int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int n;
    cin >> n;
    vl v(n);
    rep(i,0,n){
        cin >> v[i];
    }
    ll suf = 0,sum = 0;
    per(i,n-1,-1){
        sum += suf*v[i];
        sum%=MOD;
        suf+=v[i];
        suf%=MOD;
    }
    cout << sum;
}


Measured memory_bytes: 4776
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <cmath>
#include <map>
typedef long long ll;
#define rep(i,a,b) for(int i=a;i<b;++i)
#define rrep(i,a,b) for(int i=a;i>=b;--i)
using namespace std;
ll mod = 1e9 + 7;

int A,B;
int x[111];
ll coudp[111][111][5555];
string divide[4] = { "dream","dreamer","erase","eraser" };
int main()
{	
		int a,b,c,d;
		int cnt = 0;
		cin >> a>>b>>c>>d;
		string ans;

		if (a * b >= c * d)
		{
			cout << a * b << endl;
		}
		else
		{
			cout << c * d << endl;
		}
}

Measured memory_bytes: 256
#include<iostream>
#include<cmath>
#include<algorithm>
#include<vector>
#include<functional>
#include<string>
#include<iomanip>
#include<map>
#include<utility>
#include<string>
#include<unordered_map>
#include <queue>

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

using namespace std;

#define min_3(a, b, c) min(a, min(b, c))
#define max_3(a, b, c) max(a, max(b, c))
typedef long long ll;

int main(){
    int n; cin >> n;
    int stds[n];
    for(int i = 0; i < n; i++){
        int a; cin >> a;
        stds[a-1] = i+1;
    }
    for(int i = 0; i < n; i++) cout << stds[i] << " ";
    cout << "\n";
    return 0;
}


Measured memory_bytes: 1152
fun main(args: Array<String>) {
  val (a,b) = readLine()!!.split(" ").map(String::toLong)
  println(lcm(a, b))
}

fun gcd(a: Long, b: Long): Long = if(a < b) gcd(b, a) else if(b == 0L) a else gcd(b, a % b)
fun lcm(a: Long, b: Long): Long = (a * b) / gcd(a, b)

Measured memory_bytes: 37744
#include<iostream>
#include<algorithm>
#include<functional>
#include<cmath>
#include<string>
#include<vector>
#include<stack>
#include<queue>
#include<map>
#include<set>
#include<deque>
using namespace std;
#define ll long long
const int mod = 1000000007;
const ll INF = 1000000000000000000;
const int MOD = 998244353;

ll A[100010];
int main()
{
	int N; cin >> N;
	for (int i = 0; i < N; i++) cin >> A[i];
	ll cnt1 = 0, cnt2 = 0;
	int turn = 1;
	ll num = 0;
	for (int i = 0; i < N; i++) {
		num += A[i];
		if (num * turn <= 0) {
			cnt1 += abs(num - turn);
			num = turn;
		}
		turn *= -1;
	}
	num = 0;
	turn = -1;
	for (int i = 0; i < N; i++) {
		num += A[i];
		if (num * turn <= 0) {
			cnt2 += abs(num - turn);
			num = turn;
		}
		turn *= -1;
	}
	cout << min(cnt1, cnt2) << endl;
}


Measured memory_bytes: 1024
#include<iostream>
#include<string>
#include<algorithm>
#include<functional>
#include<bitset>
#include<iomanip>
#include<vector>
#include<set>
#include<map>
#include<list>
#include<stack>
#include<queue>
#include<deque>
#include<cstdio>
#include<cstdlib>
#include<cmath>
using namespace std;


struct dice{
    int top, bottom, center, back, right, left;
};

int main(){
    dice a;
    cin >> a.top >> a.center >> a.right >> a.left >> a.back >> a.bottom;
    int n;
    cin >> n;
    while(n--){
        int t, c;
        cin >> t >> c;
        if(t == a.left){
            int tmp = a.top;
            a.top = a.left;
            a.left = a.bottom;
            a.bottom = a.right;
            a.right = tmp;
        }
        if(t == a.right){
            int tmp = a.top;
            a.top = a.right;
            a.right = a.bottom;
            a.bottom = a.left;
            a.left = tmp;
        }
        while(t != a.top){
            int tmp = a.top;
            a.top = a.center;
            a.center = a.bottom;
            a.bottom = a.back;
            a.back = tmp;
        }
        while(c != a.center){
            int tmp = a.center;
            a.center = a.right;
            a.right = a.back;
            a.back = a.left;
            a.left = tmp;
        }
        cout << a.right << endl;
    }
}


Measured memory_bytes: 3076
#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 MV 200001
#define LMV 21
#define ff first
#define ss second
#define pb push_back
#define eb emplace_back
#define emp emplace
#define mp make_pair
#define ins insert
#define sz size
#define whoami(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); whi(_it, args); }

void whi(istream_iterator<string> it) { cerr<<"\n"; }

template<typename T, typename... Args>
void whi(istream_iterator<string> it, T a, Args... args) { cerr<<*it<<" "<<a<<" "; whi(++it, args...); }

void FLASH() {ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);}
void SETF() {cout.ios_base::setf(ios_base::fixed); cerr.ios_base::setf(ios_base::fixed);}
void UNSETF() {cout.ios_base::unsetf(ios_base::fixed); cerr.ios_base::unsetf(ios_base::fixed);}

typedef long long ll;
typedef long double ld;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef pair<int, int> PII;
typedef pair<ll, ll> PLL;
typedef pair<PII, int> PPII;
typedef pair<PLL, ll> PPLL;
typedef map<int, int> MII;

const int MOD = 1000000007;
const ll INF = 4e18;

template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
template <typename T>
using ordered_multiset = tree<T, null_type, less_equal<T>, rb_tree_tag, tree_order_statistics_node_update>;

struct h_llint {
  static uint64_t splitmix64(uint64_t x) {    // http://xorshift.di.unimi.it/splitmix64.c
    x += 0x9e3779b97f4a7c15;
    x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
    x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
    return x ^ (x >> 31);
  }
  size_t operator()(uint64_t x) const {
    static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
    return splitmix64(x + FIXED_RANDOM);
  }
};

struct h_pair{
  size_t operator()(const PLL&x)const{
    return hash<ll>()(((ll)x.ff)^(((ll)x.ss)<<32));
  }
};

typedef map<ll, ll> MLL;
typedef map<PII, int> MPII;
typedef map<PLL, ll> MPLL;
typedef set<int> SI;
typedef set<ll> SL;
//ordered_set = order_of_key(.)
//ordered_set = find_by_order(.)
typedef ordered_set<int> OSI;
typedef ordered_set<ll> OSL;
typedef ordered_multiset<int> MOSI;
typedef ordered_multiset<ll> MOSL;
typedef unordered_map<ll, int, h_llint> UMLI;
typedef unordered_map<ll, ll, h_llint> UMLL;
typedef unordered_map<PLL, int, h_pair> UMPI;
typedef unordered_map<PLL, ll, h_pair> UMPL;

int ar[MV];
ll arr[MV];

void solve(int T)
{
	VI lk(5);
	for(auto &&u : lk)
	cin>>u;
	int uy = 0;
	for(int i=0;i<5;i++)
	{
		if(!lk[i])
		{
			uy = i+1;
			break;
		}	
	}
	cout<<uy<<"\n";
	return;	
}

int main(void)
{
	FLASH();
	//freopen("cowjog.in", "r", stdin);
	//freopen("cowjog.out", "w", stdout);
	int T;
	T = 1;

#ifndef ONLINE_JUDGE
	time_t time_t1, time_t2;
	time_t1 = clock();
#endif

	//cin>>T;
	while(T--)
	solve(T);

#ifndef ONLINE_JUDGE
	time_t2 = clock();
	SETF();
	cerr<<"Time taken: "<<setprecision(7)<<(time_t2 - time_t1)/(double)CLOCKS_PER_SEC<<"\n";
	UNSETF();
#endif

	return 0;
}

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

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

using namespace std;
using ll = long long;
int mod = 1000000007;

void solve();

int main(void){
    int A, B; cin >> A >> B;
    bool rev;
    if(A > B){
        swap(A, B);
        rev = true;
    }
    else rev = false;
    //B個の箱を#で作る
    //4k行100列のグリッドを考える(ただしkは25k >= Bなる最小の整数k 制約からk<=20なので列数は80列以下、これは題意を満たす)
    // ###
    // ###
    // ###
    //これをB個作り、余った領域は.で埋める
    //すると、(1, B)が実現できる
    //あとはA-1回、上の図形の真ん中を.に変えることで(A, B)を実現する
    int k;
    if(B % 25 == 0) k = B/25;
    else k = B/25 + 1;
    int c = 4*k, r = 100;
    char grid[r][c];
    rep(i, r) rep(j, c) grid[i][j] = '.';

    int cnt = 0;
    bool cont = true;
    for(int i = 0; cont && i < r; i+=4){
        for(int j = 0; j < c; j+=4){
            if(cnt == B){
                cont = false;
                break;
            }
            for(int i2 = i; i2 < i+3; i2++){
                for(int j2 = j; j2 < j+3; j2++){
                    grid[i2][j2] = '#';
                }
            }
            cnt++;
        }
    }
    cnt = 0;
    cont = true;
    for(int i = 1; cont && i < r; i+=4){
        for(int j = 1; j < c; j+=4){
            if(cnt == A-1){
                cont = false;
                break;
            }
            grid[i][j] = '.';
            cnt++;
        }
    }

    cout << r << " " << c << endl;
    rep(i, r){
        rep(j, c){
            if(rev && grid[i][j] == '#' || !rev && grid[i][j] == '.') cout << '.';
            else cout << '#';
        }
        cout << endl;
    }
    return 0;
}

void solve(){}


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

char s[100005];
int main()
{
    int len,i,sign=0;
    cin>>s;
    len=strlen(s);
    for(i=0;i<len-1;i++)
    {
        if(s[i]==s[i+1])
        {
            cout<<i+1<<' '<<i+2<<endl;
            sign=1;break;
        }
        else if(len-2>0 && s[i]==s[i+2])
        {
            cout<<i+1<<' '<<i+3<<endl;
            sign=1;break;
        }
    }
    if(sign==0)
    {
        cout<<-1<<' '<<-1<<endl;
    }
    return 0;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int,int>;
template<typename T> void chmax(T &a, T b) { a = max(a, b); }
template<typename T> void chmin(T &a, T b) { a = min(a, b); }

int main() {
    int h, w;
    cin >> h >> w;
    vector<string> a(h);
    rep(i,h) cin >> a.at(i);

    vector<int> first(h), last(h);
    rep(i, h) {
        first.at(i) = a.at(i).find('#');
        last.at(i) = a.at(i).rfind('#');
    }
    for (int i = 1; i < h; i++) {
        if (last.at(i-1) != first.at(i)) {
            cout << "Impossible" << endl;
            return 0;
        }
    }

    cout << "Possible" << endl;
    return 0;
}

Measured memory_bytes: 3596
n = gets.to_i
a = gets.split.map(&:to_i)

b = []
b[0] = 0
1.upto(n) do |i|
  b[i] = 2 * (a[i-1] - b[i-1]/2)
end

b[0] = (b[0] + b[n])/2
1.upto(n) do |i|
  b[i] = 2 * (a[i-1] - b[i-1]/2)
end

if b[0] == b[n]
  puts b[0..-2]*" "
  exit 0
end


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

typedef long long ll;
typedef unsigned long long ull;

int main()
{
    ll N;
    cin >> N;
    ll res = 1;
    ll Ai;
    bool isZero = false;
    for(int i=0;i<N;i++){
        cin >> Ai;
        if(Ai == 0) res = 0;
        if(res < 0) continue;
        if(__builtin_mul_overflow(Ai, res, &res)){
            res = -1;
        }
        if(res > (ll)(1e+18)) res = -1;
    }
    if(isZero) cout << "0" << endl;
    else       cout << res << endl;

    return 0;
}

Measured memory_bytes: 3596
#include <stdio.h>

void main(){
  int n,m,i;
  int sum=0;
  scanf("%d",&n);
  scanf("%d",&m);
  int a[m];
  for(i=0;i<m;i++){
    scanf("%d",&a[i]);
    sum+=a[i];
  }
  if(sum<=n)
    printf("%d",n-sum);
  else
    printf("-1");
}

Measured memory_bytes: 1708
#include <bits/stdc++.h>
using namespace std;
#define FOR(i, s, n) for(int i = s; i < (int)n; i++)
#define per(i, n) for(int i = n; i >= 0; i--)
#define ROF(i, s, n) for(int i = s; i >= (int)n; i--)
#define FORIT(i, A) for (auto i : A)
#define PRINT(x) cout << (x) << "\n"
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define MP make_pair
#define EACH(i, n) for (__typeof((n).begin()) i = (n).begin(); i != (n).end(); ++i)
#define SZ(a) int((a).size())
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
#define CLR(a) memset((a), 0 ,sizeof(a))
#define dump(x) cout << #x << " = " << (x) << "\n";
#define debug(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << "\n";
#define sq(n) (n) * (n)
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;
typedef vector<LL> VLL;
typedef vector<VLL> VVLL;
typedef unsigned int uint;
typedef unsigned long long ull;
typedef priority_queue<int> maxpq;
typedef priority_queue< int, vector<int>, greater<int> > minpq;
static const double EPS = 1e-10;
static const double PI = acos( -1.0 );
static const int mod = 10007;
static const int INF = 1 << 25;
static const LL LL_INF = 1152921504606846976;
static const int dx[] = { 1, -1, 0, 0 };
static const int dy[] = { 0, 0, 1, -1 };

static int n, m;
VS ar;
string a;
bool closed = true;

int gcd( int m, int n ) {
	if ( n == 0 ) return m;
	return gcd( n, m % n );
}


int main() {
	scanf( "%d", &n );
	ar.resize( n );
	ar.reserve( n );
	for ( int i = 0; i < n; i++ ) {
		cin >> ar[ i ];
	}
	sort( ar.begin(), ar.end() );
	scanf( "%d", &m );
	for ( int i = 0; i < m; i++ ) {
		cin >> a;
		if ( binary_search( ar.begin(), ar.end(), a ) ) {
			if ( closed ) {
				printf( "Opened by " );
			}
			else {
				printf( "Closed by " );
			}
			closed = !closed;
		}
		else {
			printf( "Unknown " );
		}
		cout << a << "\n";
	}
	return 0;
}

Measured memory_bytes: 1260
#include <bits/stdc++.h>
using namespace std;
// define
#define int long long
#define UNIQUE(v) v.erase(unique(all(v)), v.end());
#define ZIP(v) sort(all(v)),UNIQUE(v)
#define ADD(a, b) a = (a + b) % mod
#define SUB(a, b) a = (a+mod-b)%mod
#define MUL(a, b) a = (((a)%mod) * ((b)%mod)) % mod
#define rollcall cout << "I'm Sucu." << endl;
#define repi(i,m,n) for(int i = m;i < n;i++)
#define drep(i,n,m) for(int i = n;i >= m;i--)
#define rep(i,n) repi(i,0,n)
#define rrep(i,n) repi(i,1,n+1)
#define chmin(x,y) x = min(x,y)
#define chmax(x,y) x = max(x,y)
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(), v.rend()
#define dmp(x,y) make_pair(x,y)
#define pb(x) push_back(x)
#define pf(x) push_front(x)
#define fi first
#define se second
// debug
template <typename T, typename U>
ostream &operator<<(ostream &os, const pair<T, U> &p){
  os << "(" << p.first << "," << p.second << ")";return os;
}
template <typename T>
ostream &operator<<(ostream &os, const vector<T> &v){
  for (auto it = v.begin();it != v.end();++it){
    if(it != v.begin())os << " ";os << *it;
  }return os;
}
template <typename T, typename U>
ostream &operator<<(ostream &os, const map<T, U> &mp){
  for(auto x: mp)os << "(" << x.first << "," << x.second << ")" << endl;
  return os;
}
template<typename T, int SIZE>
int array_length(const T (&)[SIZE]){return SIZE;}
template<typename T, int N>
void PRINTF(const T (&a)[N], int s = N, int t = -1, bool f = true){
	if(t == -1){rep(i,s){if(i)cout << " ";cout << a[i];}}
	else repi(i,s,t){if(i!=s)cout << " ";cout << a[i];}
	if(f)cout << "\n";
}
template<typename T, int N1, int N2>
void PRINTF(const T (&a)[N1][N2], int h = N1, int w = N2){
	rep(i,h){rep(j,w){cout << a[i][j] << " \n"[j==w-1];}}
}
string substr(const string &str, int S1, int S2 = -1){
  if(S2 == -1)return str.substr(S1);
  return str.substr(S1, S2-S1);
}
// typedef
typedef complex<double> Point;
typedef pair<int, int> P;
typedef pair<int, P> PP;
typedef pair<P, int> Pi;
typedef vector<int> vi;
typedef deque<int> dq;
const int inf = 1e9+7;
const int INF = 1e18+7;
// int sum = accumulate(a, a+n, 0LL);
// int mx = max_element(a, a+n);
// int mn = min_element(a, a+n);
// int cnt = count(a, a+n, k);


queue<P> q1, q2;
int cnt = 0, ans = 0, sum = 0;
// 0か1のまとまった範囲を追加する
void add(){
  pair<int, int> p = q1.front();
  sum += p.first;q2.push(p);
  if(p.second == 0)cnt++;
  q1.pop();
}

// 0か1のまとまった範囲を削除する
void erase(){
  pair<int, int> p = q2.front();
  sum -= p.first;
  if(p.second == 0)cnt--;
  q2.pop();
}

signed main(){
  int n, k;string str;
  cin >> n >> k >> str;
  
  // 文字列から数字に直してq1に入れる
  int now = 0;
  while(true){
    int pos = n;
    for(int i = now;i < n;i++)if(str[i] != str[i+1]){
      pos = i+1;break;
    }
    q1.push(make_pair(pos-now, str[now] == '1'));now = pos;
    if(pos == n)break;
  }
  
  // しゃくとり
  while(q1.size()){
    add();
    while(cnt > k)erase();
    ans = max(ans, sum);
  }
  
  cout << ans << endl;
  return 0;
}





Measured memory_bytes: 2048
N, M, K = map(int, input().split())

A = list(map(int,input().split()))
B = list(map(int,input().split()))

AD = [0]
for i in range(N):
    AD.append(AD[i]+A[i])
BD = [0]
for i in range(M):
    BD.append(BD[i]+B[i])

ans = 0
for i in range(N+1):
    if K < AD[i]:
        break
    else:
        while BD[M] > K - AD[i]:
            M -= 1
        ans = max(ans, i + M)

print(ans)


Measured memory_bytes: 47372
#include <bits/stdc++.h>
#include <stdio.h>
#include <math.h>
using namespace std;
using vi = vector<int>;
using vll = vector<long long int>;
using vb = vector<bool>;
using vvi = vector<vector<int>>;
using vvll = vector<vector<long long int>>;
using ll = long long int;

ll get(ll n, ll h){
    if(n < 6){return h + n;}
    ll j, k;
    for(int i=1; i<20; i++){
        if(powl(6,i)>n){
            j = i-1; break;
        }
    }
    for(int i=1; i<20; i++){
        if(powl(9,i)>n){
            k = i-1; break;
        }
    }
    ll s = n/powl(6,j), t = n/powl(9,k);
    ll p = powl(6,j), q = powl(9,k);
    if(k == 0){
        return get(n-p, h+1);
    }
    return min(get(n-p, h+1), get(n-q, h+1));
}

int main(){
    ll N; cin >> N;
    ll c = get(N, 0);
    cout << c;
}

Measured memory_bytes: 512
#include <cstdio>
#include <cmath>
#define P 3.141592653589
using namespace std;
int a,b,h,m;
double r(double x){
	if(x>=90)return r(x-90);
	else return x*P/180;
}
int main(){
	scanf("%d%d%d%d",&a,&b,&h,&m);
	printf("%.11f\n",sqrt(a*a+b*b-2*a*b*cos(abs(6*m-30*h-0.5*m)*P/180)));
	return 0;
}


Measured memory_bytes: 2536
#!/usr/bin/env python3

N,M = map(int,input().split())
lst = [i+1 for i in range(M)]


for _ in range(N):
    tmp = list(map(int,input().split()))
    K = tmp[0]
    A = tmp[1:]
    lst = list(filter(lambda x: x in A,lst))

print(len(lst))

Measured memory_bytes: 3060
#include <cstdio>
int main()
{
    int a, b;
    while (scanf("%d%d", &a, &b) != 0)
    {
        if (a == 0 && b == 0)
            break;
        if (a <= b)
            printf("%d %d\n", a, b);
        else
            printf("%d %d\n", b, a);
    }
    return 0;
}


Measured memory_bytes: 2692
#include<iostream>
#define D(x) cout<<"D:"<<#x<<'='<<x<<endl;
using namespace std;
typedef long long ll;
const ll p = 1e9+7;
inline int nextint(void)
{
	int k;
	cin>>k;
	return k;
}
ll qp(ll a,ll b)
{
    ll res = 1;
    while(b)
    {
        if(b & 1) res = res * a % p;
        a = a * a % p;
        b >>= 1;
    }
    return res % p;
}
ll qm(ll a, ll b)  
{  
    ll ans = 1;  
    a %= p;  
    while(b)  
    {  
        if(b & 1)  
        {  
            ans = ans * a % p;  
            b--;  
        }  
        b >>= 1;  
        a = a * a % p;  
    }  
    return ans;  
} 
ll C(ll n, ll m)
{  
    if(m > n) return 0;  
    ll ans = 1;  
    for(int i = 1; i <= m; i++)  
    {  
        ll a = (n + i - m) % p;  
        ll b = i % p;  
        ans = ans * (a * qm(b, p-2) % p) % p;  
    }  
    return ans;  
}
int main(void)
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	int n = nextint(), a = nextint(), b = nextint();
	cout<<(qp(2, n)+2*p-1-C(n, a)-C(n, b))%p<<endl;
	return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include <cmath>
#include <ctype.h>
#include<vector>
#include<algorithm>
using namespace std;
int N, K;
vector<int> v;
int main() {
    cin >> N >> K;
    for(int i=0; i<N; ++i){
        int a=0; cin >> a;
        v.push_back(a);
    }
    sort(v.begin(), v.end());
    int ans=0;
    for(int i=0; i<K; ++i){
        ans += v[N-1-i];
    }
    cout << ans << endl;
    return 0;
}

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

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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;


// dijkstra
struct edge {ll to, cost;};
typedef pair<ll, ll> P; // firstはsからの最短距離, secondは頂点の番号
const ll INF = 1e15;

void dijkstra(vector<edge> g[], vector<ll>& d, ll s){
	d[s] = 0;

	priority_queue<P,vector<P>,greater<P> > que;
	que.push(P(0,s));

	while(!que.empty()){
		P p = que.top();
		que.pop();

		ll v = p.second;
		if(d[v] < p.first) continue; //後から最短パスが見つかった場合、先にqueに入っているものはここではじかれる

		for(ll i = 0; i < g[v].size(); i++){
			edge e= g[v][i];
			if(d[e.to] > d[v] + e.cost){
				d[e.to] = d[v] + e.cost;
				que.push(P(d[e.to], e.to));
			}
		}
	}
}

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

	ll n, m, s, t;
	cin >> n >> m >> s >> t;
	s--;
	t--;

	vector<edge> g1[n];
	vector<edge> g2[n];

	rep(i, m){
		ll u, v, a, b;
		cin >> u >> v >> a >> b;
		u--;
		v--;

		g1[u].push_back((edge){v, a});
		g1[v].push_back((edge){u, a});
		g2[u].push_back((edge){v, b});
		g2[v].push_back((edge){u, b});
	}

	vector<ll> d1(n, INF);
	vector<ll> d2(n, INF);

	dijkstra(g1, d1, s);
	dijkstra(g2, d2, t);

	// rep(i, n) cout << d1[i] << (i == n-1 ? "\n" : ",");
	// rep(i, n) cout << d2[i] << (i == n-1 ? "\n" : ",");

	ll ans[n];
	rep(i, n) ans[i] = d1[i] + d2[i];
	rrep(i, n-1) ans[i] = min(ans[i], ans[i+1]);

	// rep(i, n) cout << ans[i] << (i == n-1 ? "\n" : ",");
	rep(i, n) cout << (1000000000000000 - ans[i]) << endl;
}

Measured memory_bytes: 19068
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <cmath>
#include <map>
#include <queue>
#include <functional>
#include <utility>
using namespace std;
typedef long long ll;
int main(){
  int n;
  cin >> n;
  vector<int> a(n);
  vector<int> b(n);

  for(int i = 0;i < n;i++)cin >> a[i];
  for(int i = 0;i < n;i++)cin >> b[i];

  for(int i = 0;i < n-1;i++)a[i+1] = a[i+1] + a[i];

  reverse(b.begin(),b.end());

  for(int i = 0;i < n-1;i++)b[i+1] = b[i+1] + b[i];


  int ans = 0;
  for(int i = 0;i < n;i++){
    ans = max(ans,a[i] + b[n-1-i]);
  }

  cout << ans << endl;

}

Measured memory_bytes: 256
while true
    h, w = gets.chomp.split.map(&:to_i)
    break if [h, w] == [0, 0]

    diag = h * h + w * w
    min, answer = nil, nil
    for y in (1..150).to_a.reverse
        for x in (y+1)..150
            d = x * x + y * y
            if d == diag && y > h
                min = d
                answer = [y, x]
            elsif d > diag && (min.nil? || min >= d)
                min = d
                answer = [y, x]
                break
            end
        end
    end
    puts answer.join(" ")
end


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

using namespace std;

vector<vector<int>> v;
int c[300000];

void dfs(int node, int parent, int val) {
  c[node] += val;
  for (auto x : v[node]) {
    if (x != parent) dfs(x, node, c[node]);
  }
}

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

  v.resize(n);
  for (int i = 0; i < n - 1; ++i) {
    int a, b;
    cin >> a >> b;
    v[a - 1].push_back(b - 1);
    v[b - 1].push_back(a - 1);
  }

  for (int i = 0; i < q; ++i) {
    int p, x;
    cin >> p >> x;
    c[p - 1] += x;
  }

  dfs(0, -1, 0);

  for (int i = 0; i < n; ++i) {
    cout << c[i];
    if (i == n - 1) cout << endl;
    else cout << " ";
  }
}


Measured memory_bytes: 23552
#define _USE_MATH_DEFINES
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <cstdio>
#include <complex>
#include <numeric>
#include <string.h>
#include <random>
#include <cmath>
#define rep(i,n) for (int i = 0; i < (int)n; i++)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pi;
typedef pair<pi, pi> pp;
typedef pair<ll, ll> pl;
double PI = 3.141592653589793238462643383279;
const double EPS = 1e-9;
const ll MOD = 1000000007;
//const ll MOD = 998244353
const int inf = 1 << 30;
const ll linf = 1LL << 60;

template<typename T>
struct segtree{
    int n;
    vector<T> dat;
    T unit;

    void init(int n_, T unit_) {
        unit = unit_;
        n = 1;
        while(n < n_) n *= 2;
        dat.assign(2*n-1, unit);
    }

    T get(int k) {
        return dat[k+n-1];
    }

    void update(int k, T a){
        k += n-1;
        dat[k] = a;
        while(k > 0){
            k = (k-1)/2;
            dat[k] = min(dat[k*2+1], dat[k*2+2]);
        }
    }

    //(a,b,0,0,seg.n)で呼ぶ
    T query(int a, int b, int k, int l, int r){
        if(r <= a || b <= l) return unit;
        if(a <= l && r <= b) return dat[k];
        else{
            T vl = query(a,b,k*2+1,l,(l+r)/2);
            T vr = query(a,b,k*2+2,(l+r)/2,r);
            return min(vl, vr);
        }
    }
};

int N, M;
string s;
segtree<int> seg;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cin >> N >> M;
    cin >> s;
    seg.init(N+1, inf);
    seg.update(0, 0);
    for (int i = 1; i <= N; i++) {
        if (s[N-i] == '1') continue;
        int v = seg.query(max(0, i-M), i, 0, 0, seg.n);
        if (v == inf) {
            cout << -1 << endl;
            return 0;
        }
        seg.update(i, v+1);
    }
    int val = seg.get(N);
    int pre = N;
    for (int j = N-1; j >= 0; j--) {
        if (seg.get(j)+1 == val) {
            cout << pre-j << " ";
            pre = j;
            val--;
        }
    }
    cout << endl;
}

Measured memory_bytes: 1744
#include <bits/stdc++.h>
using namespace std;
int main(){
  int X;
  cin>>X;
  int ans=1;
for(int i=2;i<32;i++){
  int N=i*i;
  for(int j=2;j<10;j++){
    if(N<=X){
      ans=max(ans,N);
    }
    else break;
    N=N*i;
  }
}
  cout<<ans<<endl;
}

Measured memory_bytes: 256
from collections import Counter
from itertools import takewhile

n = int(input())
vvv = list(map(int, input().split()))
cnt1 = Counter(vvv[0::2])
cnt2 = Counter(vvv[1::2])
mc1 = cnt1.most_common()
mc2 = cnt2.most_common()
mcs1 = list(takewhile(lambda x: x[1] == mc1[0][1], mc1))
mcs2 = list(takewhile(lambda x: x[1] == mc2[0][1], mc2))
if len(mcs1) == len(mcs2) and mcs1[0][0] == mcs2[0][0]:
    if len(mc1) > 1:
        if len(mc2) > 1:
            print(min(n - mc1[0][1] - mc2[1][1], n - mc1[1][1] - mc2[0][1]))
        else:
            print(min(n - mc1[0][1], n - mc1[1][1] - mc2[0][1]))
    else:
        if len(mc2) > 1:
            print(min(n - mc1[0][1] - mc2[1][1], n - mc2[0][1]))
        else:
            print(min(n - mc1[0][1], n - mc2[0][1]))
else:
    print(n - mc1[0][1] - mc2[0][1])


Measured memory_bytes: 21568
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define mit map<int,int>::iterator
#define sit set<int>::iterator
#define itrm(g,x) for(mit g=x.begin();g!=x.end();g++)
#define itrs(g,x) for(sit g=x.begin();g!=x.end();g++)
#define ltype int
#define rep(i,j,k) for(ltype(i)=(j);(i)<=(k);(i)++)
#define rap(i,j,k) for(ltype(i)=(j);(i)<(k);(i)++)
#define per(i,j,k) for(ltype(i)=(j);(i)>=(k);(i)--)
#define pii pair<int,int>
#define fi first
#define se second
#define mpr make_pair
#define pb push_back
#define fastio ios::sync_with_stdio(false)
const int inf=0x3f3f3f3f,mod=1000000007;
const double pi=3.1415926535897932,eps=1e-6;
void chmax(int &x,int y){if(x < y) x = y;}
void chmin(int &x,int y){if(x > y) x = y;}
ll a,b,c;
int main()
{
    cin>>a>>b>>c;
    if(c - a - b >= 0 && 4 * a * b < (c - a - b) * (c - a - b)) puts("Yes");
    else puts("No");
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <stdbool.h>

int main()
{
    int i, j, n;
    char mark;
    char marks[4] = {'S', 'H', 'C', 'D'};
    int num;
    bool cards[4][13] = {false};

    scanf("%d ", &n);
    for (i = 0; i < n; i++)
    {
        scanf("%c %d ", &mark, &num);
        for (j = 0; j < 4; j++)
        {
            if (mark == marks[j])
            {
                cards[j][num - 1] = true;
                break;
            }
        }
    }
    for (i = 0; i < 4; i++)
    {
        for (j = 0; j < 13; j++)
        {
            if (!cards[i][j])
            {
                printf("%c %d\n", marks[i], j + 1);
            }
        }
    }
    return 0;
}


Measured memory_bytes: 2680
#input an interget
k=int(input())
#input an string
str1=str(input())
#get the length of the string
x=int(len(str1))
#initialise y
y=0
#make a second string for the appending
str2="..."

#if statement about how the string will function
#if the string is the same length as k then print it
if x<=k:
    print(str1)
#if not, delete the last character of the string
else:
    while y<k:
        print(str1[y],end=(""))
        y+=1
    print(str2)


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

int main() {
 int N,D;
 cin >>N;
 cin >>D;
 vector<vector<int>> data(N, vector<int>(D));
 for (int i = 0; i < N; i++) {
    for (int j = 0; j < D; j++) {
      cin >> data.at(i).at(j);
    }
  }
  int ans = 0;
  for (int i = 0; i < N; i++) {
    for (int j = i+1; j < N; j++) {
      int norm = 0;
      for(int k = 0; k<D; k++){ 
        int diff = abs(data.at(i).at(k)-data.at(j).at(k));
        norm += diff*diff;
      }
      bool flag = false;
      for(int k=0; k<=norm; k++){
        if(k*k == norm){
          flag = true;
        }
      }
      if(flag) ++ans;
    }
  }
  cout << ans << endl;
}

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

using namespace std;

int main(){
  string s;
  cin >> s;
  string ans = "Good";
  for(int i = 0; i < 3; i++){
    if (s.at(i) == s.at(i+1)){
      ans = "Bad";
    }
  }

  cout << ans << "\n";
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
  int N;
  cin>>N;
  vector<tuple<string,int,int>> X;
  for(int i=1;i<=N;i++){
    string s;
    int p;
    cin>>s>>p;
    p=-p;
    X.push_back(tie(s,p,i));
  }
  sort(X.begin(),X.end());
  for(int i=0;i<N;i++){
    cout<<get<2>(X.at(i))<<endl;
  }
  return 0;
}


Measured memory_bytes: 256
#include <iostream>

int main()
{
	unsigned long long int N, K, X, Y;
	std::cin >> N >> K >> X >> Y;

	if(N <= K)
	{
		std::cout << (N * X) << std::endl;
	}
	else
	{
		std::cout << ((K * X) + ((N - K) * Y)) << std::endl;
	}

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define repr(i,k,n) for(int i = (k); i < (n); i++)
#define rep(i,n) repr(i,0,n)
#define ALL(a) begin(a),end(a)
const int INF = 114514810;
const int MOD = 1000000007;
typedef vector<int> vi;
typedef vector<string> vs;
typedef long long ll;
int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int A,B,C,X,Y;
	int ma,mi,sa,su;
	int yas,lap,meu;
	cin >> A >> B >> C >> X >> Y;
	if (X<Y){
		ma=Y;
		mi=X;
		sa=B;
		su=A;
	}else{
		ma=X;
		mi=Y;
		sa=A;
		su=B;
	}
	if (A+B<=C*2){
		cout << X*A+Y*B << endl;
	}else{
		yas=mi*C*2;
		if (sa>=C*2){
			yas+=2*C*abs(X-Y);
		}else{
			yas+=sa*abs(X-Y);
		}
		cout << yas << endl;
	}
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<string>
#include<array>
#include<algorithm>
#include<list>
#include<cmath>
#include<iomanip>
#include<queue>
#include<functional>
#include<climits>
#include<iterator>
#include<unordered_set>
#include<unordered_map>
#include<map>
#include<set>
#include<typeinfo>
 
#include<chrono>
#include<initializer_list>
using namespace std;
 
const double pi=4*atan(1.0);
 
constexpr long long mod=static_cast<long long>(1e9+7);
 
int main() {
	long long N,K;
	cin>>N>>K;
	long long ans=K;
	for(int i=1;i<N;++i)
		ans*=K-1;
	
	cout<<ans<<endl;
 
	//system("pause");
	return 0;
}

Measured memory_bytes: 256
N, M = map(int, input().split())
A = list(map(int, input().split()))
BC = []
for i in range(M):
    bc = list(map(int, input().split()))
    BC.append(bc)

import heapq
pq = []

for ai in A:
    pq.append([-1 * ai, 1])

for b, c in BC:
    pq.append([-1 * c, b])

heapq.heapify(pq)
# print(pq)

r = 0
for i in range(N):
    d = heapq.heappop(pq)
    r += d[0] * -1
    if d[1] >= 2:
        heapq.heappush(pq, [d[0], d[1]-1])
print(r)

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

/*大きくないほうの面積の最大値は長方形の面積の半分となるはず
面積を二分割するような直線は、指定された点と、長方形の中心を結んでできた直線が満たす、かつそれは指定された点が長方形の中心でないとき2次元平面上で一意。*/

int main(){
  double W, H, x, y;
  cin >> W >> H >> x >> y;

  printf("%.10f ", W * H / 2);       //指定された条件下では、面積の二等分線は実現できる
  if(W/2 == x && H/2 == y)
    cout << 1 << endl;
  else
    cout << 0 << endl;

  return 0;

}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define ul unsigned long int
#define ld long double
#define f(t) for(ll i =0;i<t;i++)
#define vi vector<int>
#define vl vector<ll>
#define pri pair<int,int>
#define mpi map<int,int>
#define prl pair<ll,ll>
#define mp make_pair
#define mpl map<ll,ll>
#define umpl unordered_map<ll,ll>
#define pb push_back
#define ff first
#define ss second
#define MOD 1000000007
#define inf 2e18
#define EPS 1e-3
#define PI 3.1415926535897932385
const double h = 1e-6;
const int MAX_  = 100005;
#define display(v) f(v.size())cout << v[i] << " "
#define all(v) v.begin(),v.end()

inline ll mul(ll a, ll b){ return (a * 1ll * b) % MOD; }
inline ll sub(ll a, ll b){ ll c = a - b; if(c < 0) c += MOD; return c; }
inline ll add(ll a, ll b){ ll c = a + b; if(c > MOD) c -= MOD; return c; }
 //////////////////////*********CODE***********/////////////////////
 //////////////////////////////////////////////////////////////////

int main()
{
   ios_base::sync_with_stdio(false);
   cin.tie(NULL);
   cout.tie(NULL);
   
   int n; cin>>n;
   if(n%2==0)cout << n/2;
   else cout << (n/2) + 1;   
   

   return 0;
}     

Measured memory_bytes: 256
#include "bits/stdc++.h"
#define rep(i,n) for(int i = 0; i < (n); ++i)
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    string s;
    cin >> s;
    int n = s.size();
    int ans = 0;
    for(int i = 0; i < n; i+=2){
        bool ok = true;
        for(int j = 0; j < i/2; j++){
            if(s[j] != s[j+i/2]) ok = false;
        }
        if(ok) chmax(ans, i);
    }
    cout << ans << endl;
    return 0;
}

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

int main() {
  int n;
  cin >> n;
  int ans = n / 3;
  cout << ans << endl;
}

Measured memory_bytes: 3596
#include <iostream>
#include <algorithm>
#include <vector>
#include <cstdio>
#include <string>
#include <set>
#include <queue>
#include <stack>
#include <cmath>
#include <functional>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<long long > vll;
typedef vector< vi > vvi;

int prime[1000000];
bool is_prime[1000000];
int seive(int n){
	int p=0;
	for(int i=0;i<=n;i++) is_prime[i]=true;
	is_prime[0]=is_prime[1]=false;
	for(int i=2;i<=n;i++){
		if(is_prime[i]){
			prime[p++]=i;
			for(int j=2*i;j<=n;j+=i){
				is_prime[j]=false;
			}
		}
	}
	return p;
}
//??¨????????????????????????
int main() {
	int n;
	while(cin>>n){
		cout<<seive(n)<<endl;
	}
}

Measured memory_bytes: 2444
#include <bits/stdc++.h>
using namespace std;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
using ll = long long;
using P = pair<ll, ll>;
ll GCD(ll a, ll b) { return b?GCD(b, a%b):a; }
ll LCM(ll a, ll b) { return a/GCD(a, b)*b; }


int main() {
    int t; cin >> t;
    while(t--) {
        vector<int> ball(10, 0);
        for(int i = 0; i < 10; ++i) cin >> ball.at(i);
        priority_queue<int> aque;
        priority_queue<int> bque;
        bool flg2 = true;
        for(int i = 0; i < 10; ++i) {
            bool flg = false;
            if(!aque.empty()) {
                if(aque.top() <= ball.at(i)) {
                    aque.push(ball.at(i));
                    flg = true;
                }
            }else {
                aque.push(ball.at(i));
                flg = true;
            }
            if(!flg) {
                if(!bque.empty()) {
                    if(bque.top() <= ball.at(i)) {
                        bque.push(ball.at(i));
                        flg = true;
                    }
                }else {
                    bque.push(ball.at(i));
                    flg = true;
                }
            }
            if(!flg) {
                flg2 = false;
                break;
            }
        }
        if(flg2) cout << "YES" << endl;
        else cout << "NO" << endl;
    }
}


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

using VS = vector<string>;    using LL = long long;
using VI = vector<int>;       using VVI = vector<VI>;
using PII = pair<int, int>;   using PLL = pair<LL, LL>;
using VL = vector<LL>;        using VVL = vector<VL>;

#define ALL(a)  begin((a)),end((a))
#define RALL(a) (a).rbegin(), (a).rend()
#define SZ(a) int((a).size())
#define SORT(c) sort(ALL((c)))
#define RSORT(c) sort(RALL((c)))
#define UNIQ(c) (c).erase(unique(ALL((c))), end((c)))
#define FOR(i, s, e) for (int(i) = (s); (i) < (e); (i)++)
#define FORR(i, s, e) for (int(i) = (s); (i) > (e); (i)--)
//#pragma GCC optimize ("-O3") 
#ifdef YANG33
#include "mydebug.hpp"
#else
#define DD(x) 
#endif
const int INF = 1e9;                          const LL LINF = 1e16;
const LL MOD = 1000000007;                    const double PI = acos(-1.0);
int DX[8] = { 0, 0, 1, -1, 1, 1, -1, -1 };    int DY[8] = { 1, -1, 0, 0, 1, -1, 1, -1 };

/* -----  2019/03/11  Problem: ABC 087 A / Link: http://abc087.contest.atcoder.jp/tasks/abc087_a  ----- */


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

	LL X, A, B; cin >> X >> A >> B;
	X -= A;
	LL ans  = X - (X / B) * B;
	
	
	
	cout << (ans) << "\n";

	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <cmath>
#include <vector>
#include <queue>
#include <map>
#include <unordered_map>
#include <cmath>
#include <numeric>
#include <iomanip>
#include <set>
#include <string.h>

using namespace std;

typedef long long ll;

#define REP(i,n) for(ll (i)=0;(i)<(n);(i)++)
#define REP3(i,st,en) for(ll (i)=(st);(i)<(en);(i)++)

using P = pair<ll, ll>;
const int MOD = 1e9+7;
const ll INF = 1e+14;
const double PI = 3.14159265349;



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

  string s;
  cin >> s;

  ll ans = 0;
  ll left = 0;
  ll right = s.length()-1;
  while (left<right){
    if (s[left]!=s[right]) ans++;
    left++; right--;
  }
  cout << ans << "\n";
  return 0;
}


Measured memory_bytes: 256
using System;

namespace ConsoleApp3
{
    class Program
    {
        static void Main(string[] args)
        {
            string line;

            while ((line = Console.ReadLine()) != "-")
            {
                int m = int.Parse(Console.ReadLine());

                for (int i = 0; i < m; i++)
                {
                    int h = int.Parse(Console.ReadLine());
                    line = line.Substring(h) + line.Substring(0, h);

                }
                Console.WriteLine(line);
            }

        }
    }
}


Measured memory_bytes: 15876
#include<iostream>
using namespace std;
int main(){
	int n,m;
	cin>>n>>m;
	int elevation[n];
	int check[n];
	for(int i=0;i<n;i++){
		cin>>elevation[i];
		check[i]=0;
	}
	int temp1,temp2;
	for(int i=0;i<m;i++){
		cin>>temp1>>temp2;
		if(elevation[temp1-1]>elevation[temp2-1]){
			check[temp2-1]=1; 
		}
		if(elevation[temp1-1]<elevation[temp2-1]){
			check[temp1-1]=1; 
		}
		if(elevation[temp1-1]==elevation[temp2-1]){
			check[temp1-1]=1; 
			check[temp2-1]=1; 
		}
	}
	int count=0;
	for(int i=0;i<n;i++){
		if(check[i]==0){
			count++;
		}
	}
	cout<<count;
}

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

typedef long long ll;

#define mod 1000000007
#define all(x) (x).begin(), (x).end()
#define pb push_back

const long double PI = acos(-1);

ll gcd(ll a,ll b){return b ? gcd(b,a%b) : a;}
ll lcm(ll a,ll b){return a / gcd(a,b) * b;}
ll GetDigit(ll num) {return log10(num)+1;}

int main(){
  ll n;
  cin >> n;
  if(n % 2 == 1){
    cout << 0 << endl;
    return 0;
  }

  ll ans = 0;
  while(n){
    ans += n / 10;
    n /= 5;
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(int argc, char const *argv[]) {
  int n;
  cin>>n;
  int ans=0;
  for(int i=0;i<n;i++){
    int a;
    cin>>a;
    while(a%2==0) a/=2,ans++;
  }
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 256