akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define pb          emplace_back
#define ll          long long
#define fi          first
#define se          second
#define mp          make_pair
#define int         int64_t

using namespace std;

typedef pair<int, int> pii;
const int N = 102;
const int logN = 17;

pii p[N], cur;
int n, res;

inline pii operator+(const pii& x, const pii& y) {
    return mp(x.fi + y.fi, x.se + y.se);
}

int32_t main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0), cout.tie(0);
    #define Task        "test"
    if(fopen(Task".inp", "r")) {
        freopen(Task".inp", "r", stdin);
        freopen(Task".out", "w", stdout);
    }
    cin >> n;
    for(int i = 1; i <= n; ++i) cin >> p[i].fi >> p[i].se;
    sort(p + 1, p + n + 1, [](const pii& x, const pii& y) {
            return atan2(x.fi, x.se) < atan2(y.fi, y.se);
         });
    for(int i = 1; i <= n; ++i) {
        cur = p[i]; res = max(res, cur.fi * cur.fi + cur.se * cur.se);
        for(int j = (i < n? i + 1: 1); j != i; j = (j < n? j + 1: 1)) {
            cur = cur + p[j];
            res = max(res, cur.fi * cur.fi + cur.se * cur.se);
        }
    }
    cout << fixed << setprecision(16);
    cout << sqrt((long double)res);
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
int main(void){
    vector<int> L(5, 0);
    int d=0;
    bool flag =true;
    for(int i=0; i <5; i++){
        cin >> L[i];
    }
    cin >> d;
    for(int i=0; i<4; i++){
        for(int j =i+1; j<5; j++){
            //cout << i << j <<endl;
            if (L[j] -L[i] >d){
                flag = false;
            }
        
        }
    }
    if(flag==true){
        cout << "Yay!";
    }else{
        cout << ":(";
    }
}


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

using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> pll;
typedef vector<ld> vd;
typedef vector<ll> vll;
typedef vector<string> vstr;
typedef vector<vector<ll>> vvll;
typedef vector<pair<ll, ll>> vpll;
typedef priority_queue<ll, vector<ll>, greater<ll>> spqll;  // 小さい順に取り出し
typedef priority_queue<ll, vector<ll>, less<ll>> bpqll;     // 大きい順に取り出し

#define REP(i, n) for (ll i = 0; i < (ll)(n); i++)
#define FOR(i, a, b) for (ll i = (ll)a; i < (ll)b; i++)
#define IREP(i, v) for (auto i = (v).begin(); i != (v).end(); i++)
#define FI first
#define SE second
#define MP make_pair
#define MT make_tuple
#define PB push_back
#define TS to_string
#define NP next_permutation
#define ALL(v) (v).begin(), (v).end()
#define SZ(x) (ll) x.size()
#define SP(x) setprecision((ll)x)


ll INF = 1e9;
ll NIL = -1;
ll MOD = 1000000007;
ll LINF = 1e18;
ld EPS = 1e-9;
ld PI = M_PI;
vll dx = {1, 0, -1, 0, 1, -1, -1, 1};
vll dy = {0, 1, 0, -1, 1, 1, -1, -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;}     //最小公倍数

void yes(){ cout << "yes" << endl;}
void no(){ cout << "no" << endl;}

//-----------------------------------------
struct Node{
  int par, rig, lef;
};

Node T[100];

int par(int i){
  return T[i].par;
}
int sib(int i){
  int p = T[i].par;
  if(p == NIL) return NIL;
  Node t = T[p];
  if(t.lef == i) return t.rig;
  return t.lef;
}
int deg(int i){
  int res = 0;
  if(T[i].lef != NIL) res++;
  if(T[i].rig != NIL) res++;
  return res;
}
int dep(int i){
  int p = T[i].par;
  if(p == NIL) return 0;
  return dep(p) + 1;
}
int hei(int i){
  if(i == NIL) return -1;
  Node t = T[i];
  return max(hei(t.lef),hei(t.rig)) + 1;
}
string tag(int i){
  if(T[i].par == NIL) return "root";
  if(T[i].lef == NIL && T[i].rig == NIL) return "leaf";
  return "internal node";
}
void print(int i){
  cout << "node " << i <<":";
  cout << " parent = " << par(i) << ",";
  cout << " sibling = " << sib(i) << ",";
  cout << " degree = " << deg(i) << ",";
  cout << " depth = " << dep(i) << ",";
  cout << " height = " << hei(i) << ", ";
  cout << tag(i) <<endl;
}

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

  int n;
  cin >> n;
  for(int i=0;i<n;i++){
    T[i].par = NIL;
    T[i].lef = NIL;
    T[i].rig = NIL;
  }
  for(int i=0;i<n;i++){
    int a, b, c;
    cin >> a >> b >> c ;
    T[a].lef = b;
    T[a].rig = c;
    if(b != NIL) T[b].par = a;
    if(c != NIL) T[c].par = a;
  }
  for(int i=0;i<n;i++){
    print(i);
  }


  return 0;
}




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

using namespace std;
using llong = long long;
using P = pair<llong, llong>;

#define BE(x) x.begin(), x.end()

const llong inf = llong(1e18)+7;
const llong mod = 1e9+7;

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

	llong ru[100];
	ru[0] = 2;
	ru[1] = 1;

	for(int i = 2; i <= 99; i++)
		ru[i] = ru[i-1] + ru[i-2];

	cout << ru[N] << endl;

	return 0;
}

Measured memory_bytes: 256
using System;
using System.IO;
using System.Linq;
using System.Numerics;
using System.Collections.Generic;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using static System.Math;
using Debug = System.Diagnostics.Debug;
using MethodImplOptions = System.Runtime.CompilerServices.MethodImplOptions;
using MethodImplAttribute = System.Runtime.CompilerServices.MethodImplAttribute;

static class P
{
    static void Main()
    {
        Console.WriteLine((int.Parse(Console.ReadLine()) - 2) * 180);
    }
}


Measured memory_bytes: 11092
N, M = [int(elem) for elem in input().split(' ')]
request_list = [[int(elem) for elem in input().split(' ')] for _ in range(M)]
assert len(request_list) == M
assert len(request_list[0]) == 2

# sort request_list in the ascending order
request_list.sort(key=lambda x: x[0])

def is_overlap(a, b):
    if max(a) <= min(b) or max(b) <= min(a):
        return False
    else:
        return True


count = 1
current_list = request_list[0]
for i in range(1, M):
    if is_overlap(current_list, request_list[i]):
        current_list = [max(current_list[0], request_list[i][0]), \
                        min(current_list[1], request_list[i][1])]
    else:
        count += 1
        current_list = request_list[i]

print(count)


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

const int MAXN = 210;
const int mod = 1000000007;
typedef long long LL;
int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
void reduce(int & x) { x += x >> 31 & mod; }
int mul(int a, int b) { return (LL) a * b % mod; }
int pow(int a, int b, int res = 1) {
	for (; b; b >>= 1, a = mul(a, a)) if (b & 1) res = mul(res, a);
	return res;
}
int C[MAXN][MAXN];
int n, m, K;
int head[MAXN], nxt[MAXN << 1], to[MAXN << 1], tot;
std::bitset<MAXN> bel[MAXN], mat[MAXN];
void addedge(int b, int e) {
	nxt[++tot] = head[b]; to[head[b] = tot] = e;
	nxt[++tot] = head[e]; to[head[e] = tot] = b;
	mat[b][e] = mat[e][b] = true;
}
int dfn[MAXN], low[MAXN], st[MAXN], top, idx, t0t;
void tarjan(int u, int fa = 0) {
	dfn[u] = low[u] = ++t0t;
	st[++top] = u;
	for (int i = head[u]; i; i = nxt[i]) if (to[i] != fa) {
		if (!dfn[to[i]]) {
			tarjan(to[i], u);
			low[u] = std::min(low[u], low[to[i]]);
			if (dfn[u] <= low[to[i]]) {
				int v; ++idx;
				do v = st[top--], bel[v][idx] = true; while (v != to[i]);
				bel[u][idx] = true;
			}
		} else low[u] = std::min(low[u], dfn[to[i]]);
	}
}
int hav[MAXN], hd[MAXN];
int main() {
	std::ios_base::sync_with_stdio(false), std::cin.tie(0);
	for (int i = 0; i != MAXN; ++i) {
		C[i][0] = 1;
		for (int j = 1; j <= i; ++j)
			reduce(C[i][j] = C[i - 1][j] + C[i - 1][j - 1] - mod);
	}
	std::cin >> n >> m >> K;
	for (int i = 1, t1, t2; i <= m; ++i)
		std::cin >> t1 >> t2, addedge(t1, t2);
	for (int i = 1; i <= n; ++i) if (!dfn[i]) top = 0, tarjan(i);
	int ans = 1;
	for (int i = 1; i <= n; ++i)
		for (int j = i + 1; j <= n; ++j)
			if (mat[i][j] && (bel[i] & bel[j]).any()) {
				int t = (bel[i] & bel[j])._Find_first();
				++hav[t];
			}
	for (int i = 1; i <= n; ++i)
		for (int j = 1; j <= idx; ++j)
			if (bel[i][j]) ++hd[j];
	for (int i = 1; i <= idx; ++i) {
		if (hav[i] == hd[i] - 1) ans = mul(ans, K);
		else if (hav[i] == hd[i]) {
			int t = 0;
			for (int j = 1; j <= hav[i]; ++j)
				reduce(t += pow(K, gcd(j, hav[i])) - mod);
			t = pow(hav[i], mod - 2, t);
			ans = mul(ans, t);
		} else ans = mul(ans, C[hav[i] + K - 1][K - 1]);
	}
	std::cout << ans << std::endl;
	return 0;
}


Measured memory_bytes: 512
#include<iostream>
using namespace std;
#include <vector>
#define re(i,n) for(int i = 0; i < n; i++)

int main() {
	int x;
	cin >> x;
	int a = 599;
	int i;
	for (i = 8; i > 0; i--) {
		if (x <= a) {
			break;
		}
		a += 200;
	}
	cout << i << endl;

	return 0;
}

Measured memory_bytes: 3632
import re
n, k = [int(i) for i in input().split()]
s = input()
cnt = sum([1 for i in range(n-1) if s[i+1] == s[i]])
flg = (s[-1] == "R") + (s[0] == "R")
s += "L"
red_ls = re.findall(r"RL", s)
if len(red_ls) > k:
    print(cnt + k * 2)
else:
    if flg > 0:
        print(cnt + (len(red_ls) - flg) * 2 + flg)
    else:
        print(cnt + len(red_ls) * 2)

Measured memory_bytes: 6516
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
typedef vector<LL> VI;
typedef vector<VI> VVI;
typedef pair<LL, LL> PII;
typedef vector<string> VS;
inline LL toInt(string s) {LL v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}
#define PB push_back
#define MP make_pair
#define SZ(a) LL((a).size())
#define EACH(x,c) for(auto x: (c))
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define ALL(c) (c).begin(), (c).end()
#define REVERSE(c) reverse(ALL(c))
#define SORT(c) sort(ALL(c))
#define RSORT(c) sort((c).rbegin(),(c).rend())
#define STABLE_SORT(c) stable_sort(ALL(c))
#define STABLE_RSORT(c) stable_sort((c).rbegin(),(c).rend())
#define UNIQUE(c) SORT(c); (c).erase(unique(ALL(c)), (c).end());
#define FOR(i,a,b) for(LL i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
const double INF = 1e7;
const double EPS = 1e-10;
const double PI  = acos(-1.0);
#define dump(x)  cerr << #x << " = " << (x) << endl;


int main() {
	LL R, G, B, N;
    cin >> R >> G >> B >> N;
    LL ans = 0;
    /*LL r = N / R;
    if (N % R == 0) {
        r++;
        }*/
    REP(i, N / R + 1) {
        REP(j, (N - i * R) / G + 1) {
            /*dump(i);
              dump(j);*/
            if ((N - i * R - j * G) % B == 0) {
                //cout << "OK\n";
                ans++;
            }
        }
    }
	cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
int main(){
	char s[100001];
	scanf("%s",&s);
	int i=0,n=strlen(s);
	while(i<n){
		cout<<s[i];
		i+=2;
	}
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
#define ALL(a) (a).begin(),(a).end()
#define rALL(a) (a).rbegin(),(a).rend()
typedef pair<int, int> Pint;
typedef pair<int64_t, int64_t> Pll;

int main() {
    int count = 0, N;
    cin >> N;
    vector<int> A(N);
    for (int i = 0; i < N; i++) {
        cin >> A.at(i);
    }
    for (int i = 0; i < N - 1; i++) {
        if (A.at(i) < A.at(i + 1)) {
            count++;
        }
    }
    cout << count << endl;
}



Measured memory_bytes: 3108
"""

https://atcoder.jp/contests/agc045/tasks/agc045_b

交互が最高
アンバランス度の定義を変えたい
1の数 = 区間和
0の数 = 区間長さ-1の数
アンバランス度 = abs(区間長さ - 区間和 * 2)
→ abs( r-l+1 - (dp[r]-dp[l])*2 )
  =abs( r-dp[r]*2 - (l-dp[l]*2) + 1 )

アンバランス度は2分探索すればよさそう
あとは、アンバランス度x以下を達成できるか？
の判定問題

連続してxこ並ぶ場所があると不可能
アンバランス度は、 (l-dp[l]*2) の最大・最小値さえ持っておけば計算できる
x以下を達成する方法は？

始めて?が来た時を考える
今までの (l-dp[l]*2) の最大・最小値 は持っている
なるべく最大・最小値は更新しない方がいい
1にする→1減らす
0にする→1増やす

1増やす・1減らすを選んで差を x-1以下にしたい問題
まず全部上にしておく
それ以降の最大値と最小値に影響する
下にすると、最大値を-2,最小値も-2できる

それ以前の最大値-それ以降の最小値 は2ふえる
それ以降の最大値-それ以前の最小値 は2へる
y=xを足してみる

====答えを見た=====

maspy氏の方針がわかりやすい
https://maspypy.com/atcoder-%E5%8F%82%E5%8A%A0%E6%84%9F%E6%83%B3-2020-06-07agc045
行ける点は連番になる(偶奇は違うので注意)
x以下が可能か → 0以上x以下の点からスタートして,維持できるか

なぜ偶奇の場合分けが必要？
→平行移動が不可能だからありえない答えを生み出す可能性があるため

ある数字以外不可能な時=幅が2になり、3つの数字の可能性が生まれるが
平行移動はできないため、存在しえない数字が生まれてしまう

偶奇をちゃんとすれば問題ない


"""

from sys import stdin

S = stdin.readline()
S = S[:-1]
N = len(S)

r = 2*10**6
l = 0
while r-l != 1:
    m = (r+l)//2
    flag = False

    #even
    nmax = m//2*2
    nmin = 0
    for i in range(N):
        if S[i] == "0":
            nmax = min(nmax+1,m)
            nmin = min(nmin+1,m)
        elif S[i] == "1":
            nmax = max(nmax-1,0)
            nmin = max(nmin-1,0)
        else:
            nmax = min(nmax+1,m)
            nmin = max(nmin-1,0)
            
        if i % 2 == 0:
            if nmax % 2 == 0:
                nmax -= 1
            if nmin % 2 == 0:
                nmin += 1
        else:
            if nmax % 2 == 1:
                nmax -= 1
            if nmin % 2 == 1:
                nmin += 1

        if nmax < nmin:
            break

    if nmax >= nmin:
        flag = True
    else:
        #odd
        nmax = (m-1)//2*2+1
        nmin = 1
        for i in range(N):
            if S[i] == "0":
                nmax = min(nmax+1,m)
                nmin = min(nmin+1,m)
            elif S[i] == "1":
                nmax = max(nmax-1,0)
                nmin = max(nmin-1,0)
            else:
                nmax = min(nmax+1,m)
                nmin = max(nmin-1,0)
                
            if i % 2 == 1:
                if nmax % 2 == 0:
                    nmax -= 1
                if nmin % 2 == 0:
                    nmin += 1
            else:
                if nmax % 2 == 1:
                    nmax -= 1
                if nmin % 2 == 1:
                    nmin += 1

            if nmax < nmin:
                break
        if nmax >= nmin:
            flag = True

    if flag:
        r = m
    else:
        l = m

print (r)


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

typedef pair<int, int> P;
#define rep(i, n) for (int i=0; i<(n); i++)
#define all(c) (c).begin(), (c).end()
#define uniq(c) c.erase(unique(all(c)), (c).end())
#define _1 first
#define _2 second
#define pb push_back
#define INF 1145141919
#define MOD 1000000007

int N;

map<vector<int>, int> bfs(vector<int> s, int depth) {
  map<vector<int>, int> dp;
  queue<vector<int> > q;
  q.push(s);
  dp[s] = 0;

  while (!q.empty()) {
    vector<int> x = q.front(); q.pop();
    int f = dp[x];
    if (f+1 >= depth) continue;

    int n = x.size();
    for (int l=0; l<n; l++) {
      for (int r=l+1; r<n; r++) {
        vector<int> t(x);
        rep(s, (r-l+1)/2) swap(t[l+s], t[r-s]);
        if (dp.find(t) == dp.end()) {
          dp[t] = f+1;
          q.push(t);
        }
      }
    }
  }
  return dp;
}

signed main() {
  ios::sync_with_stdio(false); cin.tie(0);
  cin >> N;
  vector<int> s;
  rep(i, N) {
    int a;
    cin >> a;
    a--;
    s.pb(a);
  }

  vector<int> id(N);
  rep(i, N) id[i] = i;

  int m = N-1;
  auto lp = bfs(id, 4), rp = bfs(s, 4);
  for (auto &p : lp) {
    if (rp.find(p._1) == rp.end()) continue;
    m = min(m, p._2 + rp[p._1]);
  }
  cout << m << "\n";
  return 0;
}

Measured memory_bytes: 11404
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <map>
#include <numeric>
using namespace std;
typedef long long ll;


int main(){
 
 int n,k;cin>>n>>k;
 ll ans=1e9;
 vector<ll> v(n);
 for(int i=0;i<n;i++)cin>>v[i];
 for(int i=0;i<=n-k;i++){
     ll yay;
     if(v[i]<0&&v[i+k-1]<0)yay=-min(v[i],v[i+k-1]);
     else if(v[i]>0&&v[i+k-1]>0)yay=max(v[i],v[i+k-1]);
     else {
         ll a=v[i],b=v[i+k-1];
         if(b<0)swap(a,b);
         a=abs(a);
         yay=min(a,b)*2+max(a,b);
     }
     ans=min(ans,yay);
 }
 cout<<ans;
}


Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(0);cout.tie(0);
    ll ans1=0,ans2=0,i;
    string str;
    cin>>str;
    char black[str.length()],white[str.length()];
    for(i=0;i<str.length();i++){
        if(i%2==0){
            black[i]='0';
            white[i]='1';
        }
        else{
            black[i]='1';
            white[i]='0';
        }
    }
    for(i=0;i<str.length();i++){
        if(str[i]!=black[i])
            ans1+=1;
        if(str[i]!=white[i])
            ans2+=1;
    }
    cout<<min(ans1,ans2)<<endl;
    return 0;
}


Measured memory_bytes: 720
def valid():
    S = input()
    N = len(S)
    if S != S[::-1]:
        return False

    sub = S[0:(N-1) // 2] 
    if sub != sub[::-1]:
        return False

    sub = S[(N+3)//2-1:]
    if sub != sub[::-1]:
        return False

    return True

if valid():
    print('Yes')
else:
    print('No')

Measured memory_bytes: 3060
import java.util.*;
import java.util.HashSet;
import java.util.Map;
import java.util.HashMap;
import java.util.ArrayList;
import java.util.List;
import java.util.Arrays;
import java.util.Scanner;


public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        int c = sc.nextInt();
        int d = sc.nextInt();

        while (a > 0 || c > 0){
            c -= b;
            if (c <= 0){
                System.out.println("Yes");
                break;
            }
            a -= d;
            if (a <= 0){
                System.out.println("No");
                break;
            }
        }

    }
}






Measured memory_bytes: 35748
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#define rep(i, n) for(int i=0; i<n; ++i)
using namespace std;
using ll = int64_t;
using vi = vector<int>;
using vvi = vector<vi>;



int main() {
    int n, k;
    cin >> n >> k;
    vi a(n);
    rep(i, n) {
        cin >> a[i];
    }

    vector<bool> dp(k+1, false);

    rep(i, k) {
        if(dp[i]) {
            continue;
        }
        rep(j, n) {
            if(i+a[j] < k+1) {
                dp[i+a[j]] = true;
            }
        }
    }
    if(dp[k]){ 
        cout << "First" << '\n';
    } else {
        cout << "Second" << '\n';
    }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
 int N,K;
  cin>>N>>K;
  vector<int>data(N);
  for(int i=0;i<N;i++){
  cin>>data.at(i);
  }
 sort(data.begin(),data.end());
  int count=0;
  for(int i=0;i<N;i++){
  	if(data.at(i)<=K){
   K=K-data.at(i);
   count++;
 	 }
  }
  if(count == N && K>0){
  count--;
  }
 cout<<count<<endl;
  }


Measured memory_bytes: 256
//Author:- Kishan Panchal


#include<bits/stdc++.h>
using namespace std;
    #define ll long long 
 
    #define f first
    #define s second
    #define pb push_back
    #define FAST ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0);srand(time(NULL));
    #define all(v) v.begin(),v.end()
    #define M 1000000007
    #define pii pair<int,int>
    #define pll pair<ll,ll>
    #define vll vector<ll>
    #define For(i,a,b) for(ll i=a;i<b;i++)

class component{
    public:
    	ll min3(ll a,ll b,ll c)
		{
			return min(a,min(c,b));
		}
		ll mod(ll a,ll n)
		{
			return (a%n+n)%n;
		}
		template <class T>
		void print(T a)
		{
			
			//cout << "Ans: ";
			cout << a << endl;
		}
		//friend class Ans;
};


class Ans : component {
	public:
	 
        vll BItree;
		Ans()
		{
		
		}
        void update(vll &v,int ind,int val)
        {
            ind+=1;
            while(ind<=v.size())
            {
                BItree[ind]*=val;
                ind+=(ind & -ind);
            }
        }
        void BIT(vll &v)
        {
            int n=v.size();
            BItree.resize(n+1,1);
            For (i,0,n)
            update(v,i,v[i]);
        }
        ll getSum(int ind)
        {
            if (ind<0)
            {
                return 1;
            }
            int ans=1;
            ind+=1;
            while(ind >0)
            {
                ans*=BItree[ind];
                ind-=(ind & -ind);
            }
            return ans;
        }
		void solve()
		{
            
            
            int n,x,t;
            cin>>n>>x>>t;
            int p=(n+x-1)/x;

            print<int> (t*p);
            

		}
		
};



    int main()
    {
    	int t;
    	//cin>>t;
        t=1;
    	auto time=clock();

    	for (int i=1;i<=t;i++)
    	{
    	     Ans a;   
             //cout << "Case #"<<i<<": ";// stack memory 
    		a.solve();
    		//delete(&a);
		}
        
	}


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

#define             ll                      long long
#define             si(a)                   scanf("%d",&a)
#define             sii(a,b)                scanf("%d%d",&a,&b)
#define             siii(a,b,c)             scanf("%d%d%d",&a,&b,&c)
#define             s(a)                    scanf("%s",a)
#define             ss(a,b)                 scanf("%s%s",a,b)
#define             pii                     pair<int,int>
#define             pb(a)                   push_back(a)
#define             fr(i,n)                 for(int i=0;i<n;i++)
#define             pri(a)                  printf("%d ",a)
#define             bl                      printf("\n")
#define             PI                      2*acos(0.0)
#define             inf                     1000000
#define             sz                      120
#define             MOD                     1000000007
#define             base                    2147483647
#define             vsort(a)                (a.begin(),a.end())
#define             EPS                     10E-10
#define             gcd(a, b)               __gcd(a, b)
#define             lcm(a, b)               ((a)*((b)/gcd(a,b))
#define             finput                  freopen("input.txt","r",stdin)
#define             foutput                 freopen("output.txt","w",stdout)
#define             debug(a,b)              printf("%s %d ",a,b)

using namespace std;


int main()
{


    
    
    int r,c,a,b,x,y;
    
    sii(r,c);
    sii(a,b);
    
    x = r-a;
    y = c-b;
  
    printf("%d\n",x*y);
    

    return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <vector>
#include <algorithm>
#include <utility>
#include <queue>
using namespace std;
typedef pair<int,int> pii;
typedef long long ll;
const int maxn=1e6+5;
const int mod=998244353;

int main(){
	int a,b;
	scanf("%d%d",&a,&b);
	for(int i=b-a+1;i<=b+a-1;i++) printf("%d ",i);
	return 0;
}

Measured memory_bytes: 128
x=int(input())

#ans=0
#if x>=400 and x<600:ans=8
#if x>=600 and x<800:ans=7
#if x>=800 and x<1000:ans=6
#if x>=1000 and x<1200:ans=5
#if x>=1200 and x<1400:ans=4
#if x>=1400 and x<1600:ans=3
#if x>=1600 and x<1800:ans=2
#if x>=1800 and x<2000:ans=1

ans=8-(x-400)//200
print(ans) 

Measured memory_bytes: 9152
fun main(args: Array<String>) {
    val S = next().toCharArray().map{ it - '0' }.toMutableList()
    val L = S.size
    var n = 0
    while (n < S.size - 1) {
        if (S[n] + S[n + 1] == 1) {
            S.removeAt(n); S.removeAt(n)
            if (n > 0) n -= 1
        } else n += 1
    }
    println(L - S.size)
}
fun next() = readLine()!!

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

int main(void) {
  llong N, before=0, after=0, ans=0;
  cin >> N;

  vector<llong> A(N+1);
  vector<llong> B(N);

  for(llong i=0;i<N+1;i++) {
    cin >> A.at(i);
    before += A.at(i);
  }

  for(llong i=0;i<N;i++) {
    cin >> B.at(i);
  }

  for(llong i=0;i<N;i++) {
    if(A.at(i)<=B.at(i)) {
      A.at(i+1) = A.at(i+1)-(B.at(i)-A.at(i));
      if (A.at(i+1)<0) A.at(i+1) = 0;
      A.at(i) = 0;
    }
    else { 
      A.at(i) = A.at(i) - B.at(i);
    }
  }

  for(llong i=0;i<N+1;i++) {
    after += A.at(i);
  }

  ans = before - after;
  cout << ans << endl;

  return (0);
}


Measured memory_bytes: 1920
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef vector<vvll> vvvll;
typedef vector<string> vstr;
typedef pair<ll, ll> pll;
typedef vector<pll> vp;
typedef map<ll, ll> mll;
typedef map<string, ll> mstrll;
#define pb push_back
#define mp make_pair
#define fir first
#define sec second
#define maxs(x, y) (x = max(x, y))
#define mins(x, y) (x = min(x, y))
#define all(x) begin(x), end(x)
#define rall(x) rbegin(x), rend(x)
#define _overload3(_1, _2, _3, name, ...) name
#define _rep(i, n) repi(i, 0, n)
#define repi(i, a, b) for(ll i = ll(a); i < ll(b); i++)
#define rep(...) _overload3(__VA_ARGS__, repi, _rep,)(__VA_ARGS__)
#define each(i, n) for(auto&& i: n)
#define out(x) cout << (x)
#define indent() cout << '\n'
#define print(x) cout << (x) << '\n'
#define debug(x) cerr << #x << ": " << (x) << '\n'
ll gcd(ll a, ll b){return b != 0 ? gcd(b, a % b) : a;}
ll lcm(ll a, ll b){return a / gcd(a, b) * b;}
ll factorial(ll a){return a < 2 ? 1 : factorial(a - 1) * a;}
ll summation(ll a){return a < 1 ? 0 : (a * a + a) / 2;}
const ll INF = 1e16;
const ll MOD = 1e9 + 7;
const string ALPHABETS = "abcdefghijklmnopqrstuvwxyz";
ll dx[] = {-1, 0, 1, 0}, dy[] = {0, -1, 0, 1};
//ll dx[] = {-1, 0, 1, -1, 1, -1, 0, 1}, dy[] = {-1, -1, -1, 0, 0, 1, 1, 1};
ll n, m, x, y, z, w, h;
string s, t;

signed main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    while(cin >> x >> y){
        ll ans = abs(abs(x) - abs(y)), tmp = 0, cnt = 0, mx = -INF, mn = INF;
        ll a[] = {}, b[] = {}, c[] = {};
        vll v;
        print(ans ? x == 0 ? y > 0 ? ans : ans + 1 : y == 0 ? x < 0 ? ans : ans + 1 : x > y ? x > 0 == y > 0 ? ans + 2 : ans + 1 : x > 0 != y > 0 ? ans + 1 : ans : x == y ? 0 : 1);
    }
}


Measured memory_bytes: 256
//Bismillahir rahmanir rahim
#include<bits/stdc++.h>
using namespace std;
#define ll long long
int arr[100005];
int dp[100005];
int n,k;
int solve(int pos)
{
    if(pos==n) return 0;
    int ret=dp[pos];
    if(ret!=-1) return ret;
    int ans=1e9;
    for(int i=1;i<=k;i++){
        if(pos+i<=n){
            ans=min(ans,solve(pos+i)+abs(arr[pos+i]-arr[pos]));
        }
    }
    return dp[pos]=ans;
}
int main()
{
    scanf("%d %d",&n,&k);
    for(int i=1;i<=n;i++) scanf("%d",&arr[i]);
    memset(dp,-1,sizeof(dp));
    int ans=solve(1);
    printf("%d\n",ans);
    return 0;
}


Measured memory_bytes: 5760
#!/usr/bin/env python3
import math
MOD = 10**9
def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)
    return divisors

K = int(input())

ans = 0
for i in range(1, K+1):
    for j in range(i, K+1):
        for k in range(j, K+1):
            if i==j and i==k: g = i
            elif (i==j and i!=k):
                g = math.gcd(i,math.gcd(j,k))*3
            elif (i==k and i!=j):
                g = math.gcd(i,math.gcd(j,k))*3
            elif (j==k and i!=j):
                g = math.gcd(i,math.gcd(j,k))*3
            else : g = math.gcd(i,math.gcd(j,k))*6
            ans += g
print(ans)


Measured memory_bytes: 9248
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();	
        int b = sc.nextInt();
		int c = sc.nextInt();
        int [] in = new int [a-1];
        for(int i=1;i<a;i++){ 
          for(int j=i+1;j<a+1;j++){
                                   in[Math.min(j-i,Math.max(i-b,b-i)+1+Math.max(c-j,j-c))-1]++;                                                        
                                                                                                                
                                  }
                            }     
		for(int i=0;i<a-1;i++){System.out.println(in[i]);}
	}
}


Measured memory_bytes: 22996
import bisect
N = int(input())
A = list(map(int, input().split()))
accum = [0 for i in range(N + 1)]
for i in range(N):
    accum[i + 1] = accum[i] + A[i]
total = accum[N]
#accum[i + 1] = A[0] + A[1] + ... + A[i]
#sum(A[i:j]) = A[i] + A[i+1] + ... + A[j-1] = accum[j] - accum[i]
ans = float('inf')
for i in range(2, N - 1, 1): #2番目の区切りを A[i-1]とA[i]の間に入れる
    zenhan = accum[i] #(= sum(A[:i]))
    kouhan = total - zenhan #(= accum[N] - accum[i] = sum(A[i:N]))
    index1l = bisect.bisect(accum, zenhan // 2, lo = 2, hi = i) - 1
    index1r = min(index1l + 1, i - 1)
    index3l = bisect.bisect(accum, zenhan + (kouhan // 2), lo = i + 2, hi = N) - 1
    index3r = min(index3l + 1, N - 1)
    for index1 in (index1l, index1r):
        for index3 in (index3l, index3r):
            B, C, D, E = accum[index1], zenhan - accum[index1], accum[index3] - zenhan, total - accum[index3]
            M = max(B, C, D, E)
            m = min(B, C, D, E)
            ans = min(ans, M - m)
print(ans)

Measured memory_bytes: 25676
/**
*    created: 10.07.2020 17:27:09
**/
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
// #include <boost/multiprecision/cpp_int.hpp>
// using bint = boost::multiprecision::cpp_int;
using namespace std;
#define int long long
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define pcnt(bit) __builtin_popcountll(bit)
template<class T> bool chmax(T &a, const T &b) {if (a < b) {a = b; return 1;} return 0;}
template<class T> bool chmin(T &a, const T &b) {if (b < a) {a = b; return 1;} return 0;}
const long double pi = acos(-1.0);
const int MAX = 1000010;
const int INF = 1LL << 60;
const int MOD = 1000000007;
// const int MOD = 998244353;

signed main() {

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

    int n; cin >> n;
    vector<int> t(n);
    int sum = 0;
    rep(i,n) {cin >> t[i]; sum += t[i];}
    int m; cin >> m;
    vector<pair<int,int>> mp;
    rep(i,m) {
        int p; cin >> p;
        int x; cin >> x;
        mp.push_back(make_pair(p-1,x));
    }
    for (auto p : mp) {
        cout << sum - t[p.first] + p.second << endl;
    }
    return 0;
}

Measured memory_bytes: 3604
N, M = [int(i) for i in input().split()]
switch_idx = [[int(i) for i in input().split()[1:]] for M in range(M)]
p = [int(i) for i in input().split()]

import numpy as np
n_pattern = 2**N
form = '0{0}b'.format(N)
ans = 0
from operator import itemgetter
for i in range(n_pattern):
    state = str(format(i, form))
    counter = 0
    for j,k in enumerate(switch_idx):
        if (itemgetter(*(np.array(k)-1))(state).count('1') % 2) == p[j]:
            counter += 1
        if len(switch_idx) == counter:
            ans += 1

print(ans)

Measured memory_bytes: 13396
// This file is a "Hello, world!" in C++ language by GCC for wandbox.
#include <iostream>
#include <vector>
#include <cstdlib>
using namespace std ;
int main(){
  int a,b;
  cin >> a >> b;
  if ((a+b)%2 != 0){cout<<"IMPOSSIBLE";
                  return 0;  }
  cout << (a+b)/2;
}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main() {

	int a;
	int b;
	int c;

	cin >> a;
	cin >> b;
	cin >> c;

	if (a < b and b < c) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}
	
	return 0;
}


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

using namespace std;

int main(){
    int N;
    cin >> N;
    vector<int> V;
    for(int i=0;i<N;i++){
        int tmp;
        cin >> tmp;
        V.push_back(tmp);
    }
    sort(V.begin(),V.end());
    int Min = 10000000;
    for(int P=(int)V[0];P<=(int)V[N-1];P++){
        int tmp=0;
        for(auto iter = V.begin();iter != V.end(); ++iter){
            tmp += (*iter-P)*(*iter-P);
        }
        Min = std::min(Min,tmp);
    }

    cout << Min << endl;

    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
    int main()
    {
        char S[10];
      
        scanf("%s",S);
        
        if(S[0]=='S') printf("Cloudy\n");
        else if(S[0]=='C') printf("Rainy\n");
        else printf("Sunny\n");
      
        return 0;
    }

Measured memory_bytes: 1596
#include<bits/stdc++.h>
#define pb push_back
#define pp pop_back()
#define mp make_pair
#define fr first
#define sc second
#define sz size()
#define smin(x,y) ((x)=min((x),(y)))
#define smax(x,y) ((x)=max((x),(y)))
#define all(x) x.begin(),x.end()
#define CS ios_base::sync_with_stdio(false);
#define show(x) cerr << #x << " is " << x <<endl;
using namespace std;
typedef long long ll;
typedef pair<int,int> ii;
typedef vector<int> vi; 
int32_t main()
{
	int x; cin>>x;
	string ans="ABC";
	if(x>1199) ans="ARC";
	cout<<ans<<endl;
	return 0;
}


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

using namespace std;
typedef long long ll;
typedef pair<int , int> pii;
typedef pair<ll, ll> pll;
typedef vector<pii> vii;
typedef vector<pll> vll;
using cd = complex<double>;
const double pi = acos(-1);
#define mod 998244353
#define rep(i, a, b) for(ll i = a; i < b; i++)
#define repc(i, a, b, c) for (ll i = a; (c > 0 ? i < b : i > b) and c != 0; i += c)
#define vi vector<int>
#define vl vector<ll>
#define _max(vec) (*max_element(all(vec)))
#define _min(vec) (*min_element(all(vec)))
#define fi first
#define si second
#define pb push_back
#define all(name) name.begin(), name.end()
#define ral(name) name.rbegin(), name.rend()
#define fact(n) rep(i, 1, n+1)ft.pb((ft[i-1]*i)%mod)
#define mod_in(a) power(a, mod - 2)
#define ncr(n, r) (n>=r?((ft[n]*mod_in((ft[r]*ft[(n)-(r)])%mod))%mod):0LL)
#define deb(x) cerr << "[" << #x << " " << x << "]" << endl;
#define endl '\n'  //....????
// #define int ll
vector<ll> ft(1, 1LL);

/*======================================================================*/
vi v(10000001, 0);
void solve(){
    int n;
    cin >> n;
    ll ans = 0;
    rep(i, 1, n+1){
        for(int j = i; j <= n; j+=i){
            v[j]++;
        }
        ans += v[i]*(ll)i;
    }
    cout << ans << endl;
}
signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);cout.tie(NULL);
    int t = 1;
    //cin >> t;
    while(t--){
        solve();
    }
}

Measured memory_bytes: 42124
#include <iostream>
#include <vector>
#include <set>
#include <unordered_set>
#include <map>
#include <unordered_map>
#include <cstdio>
#include <bitset>
#include <queue>
#include <deque>
#include <algorithm>
#include <numeric>
#include <cassert>
#include <functional>
#include <stack>
#include <cmath>
#include <string>

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 ALL(x) (x).begin(), (x).end()
#define INF (1 << 30)
#define LLINF (1LL << 62)
#define DEBUG(...) debug(__LINE__, ":" __VA_ARGS__)

constexpr int MOD = 1000000007;
using ll = long long;
using Pii = pair<int, int>;
using Pll = pair<ll, ll>;

inline int popcount(ll x) { return __builtin_popcountll(x); }
inline int div2num(ll x) { return __builtin_ctzll(x); }
inline bool bit(ll x, int b) { return (x >> b) & 1; }

template <class T>
string to_string(T s);
template <class S, class T>
string to_string(pair<S, T> p);
string to_string(string s) { return s; }
string to_string(const char s[]) { return to_string(string(s)); }

template <class T>
string to_string(T v) {
  if (v.empty()) return "{}";
  string ret = "{";
  for (auto x : v) ret += to_string(x) + ",";
  ret.back() = '}';
  return ret;
}

template <class S, class T>
string to_string(pair<S, T> p) {
  return "{" + to_string(p.first) + ":" + to_string(p.second) + "}";
}
void debug() { cerr << endl; }

template <class Head, class... Tail>
void debug(Head head, Tail... tail) {
  cerr << to_string(head) << " ";
  debug(tail...);
}

int main() {
  ll N, K;
  cin >> N >> K;
  vector<Pll> AB(N);
  REP(i, N) cin >> AB[i].first >> AB[i].second;
  ll ans = 0;
  REP(b, 32) {
    ll t = 0;
    ll c = K;
    if (bit(K, b)) {
      c ^= (1LL << b);
      c |= ((1LL << b) - 1);
    }
    REP(i, N) if (AB[i].first == (AB[i].first & c)) t += AB[i].second;
    ans = max(ans, t);
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 4812
#include <iostream>
using namespace std;
 
int main() {
  int h, w;
  cin >> h >> w;
  while (!(h==0 && w==0)) {
    for (int i = 0; i < h; i++){
      for (int j = 0;  j < w ; j++) {
        if ((i%2 == 0 && j%2 == 0)|| (i%2 == 1 && j%2 == 1)) { cout << "#";}
        else {cout << ".";}
      }
      cout << endl;
    }
    cout << endl;
    cin >> h >> w;
  }
}


Measured memory_bytes: 3048
while True:
    try:
        x1,y1,x2,y2,x3,y3,xp,yp = map(float,raw_input().split())
        S = lambda x1,y1,x2,y2,x3=xp,y3=yp:abs(x1*(y2-y3)+x2*(y3-y1)+x3*(y1-y2))/2.0
        print "NO" if S(x1,y1,x2,y2)+S(x1,y1,x3,y3)+S(x3,y3,x2,y2)-S(x1,y1,x2,y2,x3,y3) > 0.0000001 else "YES"
    except:
        break

Measured memory_bytes: 4240
#include <iostream>
#include <string>
#include <cstring>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <numeric>
#include <regex>
#include <climits>

#define FOR(i, f, n) for(int (i) = (f), TMPend = (n); (i) < TMPend; (i)++)
#define RFOR(i, f, n) for(int (i) = (f), TMPend = (n); (i) >= TMPend; (i)--)
#define REP(i, n) for(int (i) = 0, TMPend = (n); (i) < TMPend; (i)++)
#define RREP(i, n) for(int (i) = (n); (i) >= 0; (i)--)
#define rep(i, n) for(int (i) = 0, TMPend = (n); (i) < TMPend; (i)++)
#define rrep(i, n) for(int (i) = (n); (i) >= 0; (i)--)
#define forin(i, a) for(auto i: (a))
#define p(...) printf(__VA_ARGS__); cout << endl;
#define in(...) __VA_ARGS__; input__(__VA_ARGS__);
#define input(...) in(__VA_ARGS__)
#define out(...) output__(__VA_ARGS__);
#define output(...) out(__VA_ARGS__)
#define list_input(x, n) x[(n)]; for(int (i) = 0; (i) < (n); (i)++) cin >> x[i];
#define lambda(a, b, c) [](auto const &a, auto const &b){ return c ;}
#define key(t, x, compare) [](const t &a, const t &b){ return a x compare b x ;}
#define unless(a) if(!(a))

using namespace std;

using pii = pair<int, int>;

template <class... T>
void input__(T &...a) {
  for(auto v: {&a...}) {
    cin >> *v;
  }
}

void output__(){
  cout << endl;
}

template <class Head, class... T>
void output__(Head const &v, T const &...a) {
  if(sizeof...(a) == 0) {
    cout << v;
  } else {
    cout << v << " ";
  }
  output__(a...);
}

int n;
double dp[301][301][301];
double dfs(int n1, int n2, int n3) {
  if (n1 == 1 && n2 == 0 && n3 == 0) {
    return n;
  }

  if (dp[n1][n2][n3] > -1) {
    return dp[n1][n2][n3];
  }

  double r = n;
  if (n1 > 0) r += dfs(n1 - 1, n2, n3) * n1;
  if (n2 > 0) r += dfs(n1 + 1, n2 - 1, n3) * n2;
  if (n3 > 0) r += dfs(n1, n2 + 1, n3 - 1) * n3;
  r /= n1 + n2 + n3;
  dp[n1][n2][n3] = r;
  return r;
}

int main(){
  memset(dp, -1, sizeof(dp));
  int input(N);
  n = N;
  int list_input(a, n);
  int cnt[3 + 1] = {0};
  forin(i, a) {
    cnt[i] += 1;
  }
  printf("%.14f\n", dfs(cnt[1], cnt[2], cnt[3]));
}


Measured memory_bytes: 213376
import java.util.Arrays;
import java.util.Comparator;
import java.util.List;
import java.util.Scanner;
import java.util.stream.Collectors;

public class Main {
    public static void main(final String[] args) {
        final Scanner scanner = new Scanner(System.in);
        final int n = scanner.nextInt();
        final int m = scanner.nextInt();
        final long[][] table = new long[n][3];

        for (int i = 0; i < n; i++) {
            table[i][0] = scanner.nextLong();
            table[i][1] = scanner.nextLong();
            table[i][2] = scanner.nextLong();
        }

        long answer = calc(table, m, 1, 1, 1);
        answer = Math.max(answer, calc(table, m, 1, 1, -1));
        answer = Math.max(answer, calc(table, m, 1, -1, 1));
        answer = Math.max(answer, calc(table, m, 1, -1, -1));
        answer = Math.max(answer, calc(table, m, -1, 1, 1));
        answer = Math.max(answer, calc(table, m, -1, 1, -1));
        answer = Math.max(answer, calc(table, m, -1, -1, 1));
        answer = Math.max(answer, calc(table, m, -1, -1, -1));

        System.out.println(answer);
    }

    private static long calc(final long[][] table, final int count, final int a, final int b, final int c) {
        final List<Long> list = Arrays.stream(table)
                .map(e -> e[0] * a + e[1] * b + e[2] * c)
                .sorted(Comparator.reverseOrder())
                .collect(Collectors.toList());

        return list.subList(0, count).stream()
                .mapToLong(Long::longValue)
                .sum();
    }
}


Measured memory_bytes: 31360
import sys

sys.setrecursionlimit(10 ** 7)
rl = sys.stdin.readline


def solve():
    N = int(rl())
    a = [int(rl()) for _ in range(N)]
    
    print('second' if all(ai % 2 == 0 for ai in a) else 'first')


if __name__ == '__main__':
    solve()


Measured memory_bytes: 7072
<?php

$is_honban = true;

if ($is_honban) {
  //----------------------------------------------------------------------------------
  // Input for honban
  //----------------------------------------------------------------------------------
  $sc = new Scanner();
  $a = $sc->nextInt();
  $b = $sc->nextInt();
  $c = $sc->nextInt();
  $x = $sc->nextInt();
} else {
  //----------------------------------------------------------------------------------
  // Input for test
  //----------------------------------------------------------------------------------
  error_reporting(E_ERROR | E_WARNING | E_PARSE);

  $a = 30;
  $b = 40;
  $c = 50;
  $x = 6000;
}



//----------------------------------------------------------------------------------
// Main
//----------------------------------------------------------------------------------

$ans = 0;
for ($i = 0; $i <= $a; $i++) {
  for ($j = 0; $j <= $b; $j++) {
    for ($k = 0; $k <= $c; $k++) {
      if ($i * 500 + $j * 100 + $k * 50 == $x) { $ans++; }
    }
  }
}



//----------------------------------------------------------------------------------
// Output
//----------------------------------------------------------------------------------
out::println($ans);



//----------------------------------------------------------------------------------
// Ref: https://qiita.com/yoshikyoto/items/6924478283dbdd549e4b
//----------------------------------------------------------------------------------
class Scanner {
  private $arr = array();
  private $count = 0;
  private $pointer = 0;
  public function next() {
    if($this->pointer >= $this->count) {
      $str = trim(fgets(STDIN));
      $this->arr = explode(' ', $str);
      $this->count = count($this->arr);
      $this->pointer = 0;
    }
    $result = $this->arr[$this->pointer];
    $this->pointer++;
    return $result;
  }
  public function hasNext() {
    return $this->pointer < $this->count;
  }
  public function nextInt() {
    return (int)$this->next();
  }
  public function nextDouble() {
    return (double)$this->next();
  }
}

class out {
  public static function println($str = "") {
    echo $str . PHP_EOL;
  }
}

?>


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

#define rep1(i, a, n) for (int i = a; i < n; i++)
#define rep2(i, a, n) for (int i = n; i >= a; i--)
#define asc(v) sort(v.begin(), v.end())
#define desc(v) sort(v.begin(), v.end(), greater<int>())

using namespace std;

int main() {
  int N, K;
  double ans = 0;
  cin >> N >> K;
  rep1(i, 1, N + 1) {
    int cur = i;
    double p = 1;
    if (i >= K) {
      ans += 1.0 / N;
    } else {
      while (true) {
        cur *= 2;
        p *= 0.5;
        if (cur >= K) break;
      }
      ans += (1.0 / N) * p;
    }
  }
  cout << fixed << setprecision(12) << ans << endl;
  return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

void N(int dice[6])
{
  int holder = dice[0];
  dice[0] = dice[1];
  dice[1] = dice[5];
  dice[5] = dice[4];
  dice[4] = holder;
}

void W(int dice[6])
{
  int holder = dice[0];
  dice[0] = dice[2];
  dice[2] = dice[5];
  dice[5] = dice[3];
  dice[3] = holder;
}

void E(int dice[6])
{
  int holder = dice[0];
  dice[0] = dice[3];
  dice[3] = dice[5];
  dice[5] = dice[2];
  dice[2] = holder;
}

void S(int dice[6])
{
  int holder = dice[0];
  dice[0] = dice[4];
  dice[4] = dice[5];
  dice[5] = dice[1];
  dice[1] = holder;
}

int main(void)
{
  int dice[6], i;
  char direction;
  for (i = 0; i < 6; i++)
    scanf(" %d", dice + i);
  for (i = 0; i <= 100; i++)
    {
      scanf("%c", &direction);
      switch (direction)
	{
	case 'N':
	  N(dice);
	  break;
	case 'E':
	  E(dice);
	  break;
	case 'W':
	  W(dice);
	  break;
	case 'S':
	  S(dice);
	  break;
	}
    }
  printf("%d\n", dice[0]);
  return 0;
}



Measured memory_bytes: 2080
n,m = map(int,input().split())
h = list(map(int,input().split()))
h.insert(0,0)
ans = [True for i in range(n+1)]
for i in range(m):
    a,b = map(int,input().split())
    if(h[a] > h[b]):
        ans[b] = False
    elif(h[a] < h[b]):
        ans[a] = False
    else:
        ans[a] = ans[b] = False
print(ans.count(True)-1)


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

constexpr int inf = 0x3f3f3f3f;
constexpr ll linf = 0x3f3f3f3f3f3f3f3fLL;

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

    int x, n; cin >> x >> n;
    vector<int> p(n);
    for (int i = 0; i < n; i++) cin >> p[i];

    int ans = 0, ref = inf;
    for (int i = 0; i <= 101; i++) {
        bool flag = true;
        for (int j = 0; j < n; j++) if (i == p[j]) flag = false;
        if (flag && abs(x - i) < ref) ans = i, ref = abs(x - i);
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3656
import java.util.Scanner;
import java.util.List;
import java.util.ArrayList;
import java.util.Objects;
import java.lang.StringBuilder;

public class Main {
  public static void main(String[] args ){

    Scanner sc = new Scanner(System.in);

    int A = sc.nextInt();
    int B = sc.nextInt();
    int T = sc.nextInt();

    int biscuit = T / A * B;

    System.out.println(biscuit);

  }
}


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

LL MOD = 1000000007;


int main(){
    vector<int> ans(4,0);
    int n;
    cin >> n;
    for(int i = 0; i < n; ++i){
        string s;
        cin >> s;

        if(s == "AC")ans[0]++;
        if(s == "WA")ans[1]++;
        if(s == "TLE")ans[2]++;
        if(s == "RE")ans[3]++;
    }

    cout << "AC x " << ans[0] << endl;
    cout << "WA x " << ans[1] << endl;
    cout << "TLE x " << ans[2] << endl;
    cout << "RE x " << ans[3] << endl;

    return 0;
}

Measured memory_bytes: 3628
#include <bits/stdc++.h>
    using namespace std;
     
     
     
     
     
     
     
     
     
     
     
     
     
    int main()
    {
     
     
        long long a,b,c;
        long long k;
        cin >> a >> b >> c >> k;
     
     
       long long ans = a + b + c;
       long long mx = max(a,(max(b,c)));
     
       ans-=mx;
     
       while(k--){
       	mx = mx * 2;
       }
     
       cout << ans + mx;
     
     
       
     
    	return 0;
    }		

Measured memory_bytes: 256
package main

import (
	"fmt"
)

func main() {
	var n int
	var result uint64
	fmt.Scan(&n)
	arr := make([]uint64, n)
	for i:=0; i<n; i++ {
		fmt.Scan(&arr[i])
		if arr[i] == 0 {
			fmt.Printf("%d", 0)
			return
		}
	}
	result = 1
	for _,value := range arr {
		if result > 1e18/value {
			fmt.Printf("-1")
			return
		}
		result *= value
	}
	fmt.Printf("%d", result)
}


Measured memory_bytes: 6320
#include<iostream>
#include<vector>
#include<algorithm>
#include<iomanip>
#include<sstream>
#include<map>
#include<queue>
using namespace std;
#define int long long
int H, W, N;
int f(int a) {
	a += 2000005 * (2 * W);
	a %= 2 * W;
	if (a <= W - 1)return a;
	else return 2 * W - 1 - a;
}
signed main() {
	cin >> H >> W >> N;
	vector<pair<int, int> > A(N);
	for (int i = 0; i < N; i++) {
		cin >> A[i].first >> A[i].second;
		A[i].second--;
	}
	sort(A.begin(), A.end());
	vector<int> pm(W);
	for (int i = 0; i < pm.size(); i++) {
		pm[i] = i;
	}
	for (auto p : A) {
		int a = f(p.second + p.first);
		int b = f(p.second + 1 - p.first);
		swap(pm[a], pm[b]);
	}
	vector<int> res(W);
	for (int i = 0; i < W; i++) {
		if (i % 2 == 0) {
			res[pm[i]] = f(i + H);
			
		}
		else {
			res[pm[i]] = f(i - H);
		}
		//cerr << i << " " << res[pm[i]] << endl;
	}
	for (int i = 0; i < res.size(); i++) {
		cout << res[i] + 1 << endl;
	}
}


Measured memory_bytes: 9176