akhauriyash/Code-Regression huggingface dataset:
#include <algorithm>
#include <bitset>
#include <cstdio>
#include <functional>
#include <initializer_list>
#include <iostream>
#include <limits.h>
#include <list>
#include <map>
#include <math.h>
#include <queue>
#include <regex>
#include <set>
#include <sstream>
#include <string>
#include <tuple>
#include <utility>
#include <vector>
#define REP(i, a, n) for (int i = (a); i < (int)(n); ++i)
#define REPC(i, a, n) for (int i = (a); i <= (int)(n); ++i)
#define ALL(t) t.begin(), t.end()
#define RALL(t) t.rbegin(), t.rend()
#define Yes(cond) cout << (cond ? "Yes" : "No") << endl;
#define YES(cond) cout << (cond ? "YES" : "NO") << endl;
using namespace std;
using LL = long long;
using ULL = unsigned long long;
template <class T> using VEC = std::vector<T>;
template <class T> using MAT = std::vector<std::vector<T>>;
void DUMP() { cerr << endl; }
template <class Head, class... Tail> void DUMP(Head &&head, Tail &&... tail) {
  cerr << head << ", ";
  DUMP(std::move(tail)...);
}
template <typename T> ostream &operator<<(ostream &os, vector<T> &vec) {
  os << "{";
  for (auto v : vec)
    os << v << ",";
  os << "}";
  return os;
}

int main() {
  LL x;
  cin >> x;
  LL rem = x % 11;
  LL div = x / 11;
  LL a = rem>0?rem / 7 + 1:0;
  cout << 2*div + a << endl;

  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstring>
#include <vector>
#include <algorithm>

using namespace std;
const int N = 1001;
//n1,n2为二分图的顶点集,其中x∈n1,y∈n2
int map[N][N], vis[N], cx[N], cy[N];
//link记录n2中的点y在n1中所匹配的x点的编号
int num;

int path(int u)
{
	int v;
	for (v = 0; v < num; v++)
	{
		if (map[u][v] && !vis[v])
		{
			vis[v] = 1;
			if (cy[v] == -1 || path(cy[v]))//如果y集合中的v元素没有匹配或者是v已经匹配，但是从cy[v]中能够找到一条增广路    
			{
				cx[u] = v; //找到增广路，修改匹配M    
				cy[v] = u;
				return 1;
			}
		}
	}
	return 0;
}

struct Node
{
	int x, y;
	Node(int a = -1, int b = -1)
	{
		x = a;
		y = b;
	}
};

vector<Node> vx, vy;

void init()
{
	scanf("%d", &num);
	for (int i = 0; i <  num; i++)
	{
		int a, b;
		scanf("%d%d", &a, &b);
		vx.push_back(Node(a, b));
	}
	for (int i = 0; i < num; i++)
	{
		int a, b;
		scanf("%d%d", &a, &b);
		vy.push_back(Node(a, b));
	}

	memset(vis, false, sizeof(vis));
	memset(map, 0, sizeof(map));
	memset(cx, -1, sizeof(cx));
	memset(cy, -1, sizeof(cy));

	for (int i = 0; i < num; i++)
	{
		for (int j = 0; j < num; j++)
		{
			if (vx[i].x < vy[j].x && vx[i].y < vy[j].y)
			{
				map[i][j] = 1;
			}
		}
	}
}

int main()
{

	init();
	int res = 0;
	for (int i = 0; i < num; i++)
	{
		if (cx[i] == -1)   //还没被匹配，执行内部代码    
		{
			memset(vis, 0, sizeof(vis));  //重置标记为为访问    
			res += path(i);   //以 i 为起点开始查找增广路，返回true ，匹配数+1    
		}
	}
	printf("%d\n", res);
	return 0;
}

Measured memory_bytes: 4224
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define repe(i, n) for (int i = 0; i <= (n); ++i)
#define repr(i, n) for (int i = n - 1; i > 0; --i)
#define all(x) (x).begin(), (x).end()
#define pb(x) push_back(x);
using namespace std;
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;}
typedef long long ll;
const int INF = 1e9;
const ll mod = 1000000007;
int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
int lcm(int a, int b) { return a * b / gcd(a, b); }

int main() {
    int n,d;
    cin >> n;
    int v[110];
    int res = 0;
    rep(i,n) cin >> v[i];
    rep(i,n) rep(j, n) {
        if (i != j) {
            res += v[i]*v[j];
        }
    }
    cout << res/2 << "\n";
}


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


int main(){
    int N;
    cin >> N;
    int sum = 0;
    int tmpN = 0;
    tmpN = N;
    while(tmpN > 0){

        sum += tmpN % 10;
        tmpN /= 10;
    }

    if((N % sum) == 0){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }



}

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

int main(void){
	int n;
	cin >> n;
	vector<int> a(n);
	for(auto& x : a){
		cin >> x;
	}
	vector<vector<long long>> dp(2,vector<long long>(n+2, 0));
	dp[1][1] = a[0]; dp[0][1] = -a[0];
	for(int i = 1; i < n-1; ++i){
		dp[1][i+1] = max(dp[1][i]+a[i], dp[0][i]-a[i]);
		dp[0][i+1] = max(dp[1][i]-a[i], dp[0][i]+a[i]);
	}
	cout << max(dp[1][n-1]+a[n-1], dp[0][n-1]-a[n-1]) << endl;
}

Measured memory_bytes: 2944
import sys
from collections import deque

mod = 10**9 + 7
input = sys.stdin.readline
N, K = map(int, input().split())

paths = [[] for _ in range(N)]
for _ in range(N-1):
    a, b = map(int, input().split())
    paths[a-1].append(b-1)
    paths[b-1].append(a-1)

q = deque()
q.append((0, K, 0))

dp = 1
visited = set()
while q:
    node, count, d = q.popleft()
    if node in visited:
        continue
    dp *= count
    dp %= mod
    visited.add(node)

    res = K
    if d == 0:
        res -= 1
    else:
        res -= 2
    for n_node in paths[node]:
        if n_node not in visited:
            # print(n_node, res)
            q.append((n_node, res, d+1))
            res -= 1

print(dp)

Measured memory_bytes: 37984
#include<cstdio>
#include<algorithm>
#define rep(i,a) for( int i = 0; i != (a); ++i )

int Q;

int main()
{
	scanf( "%d", &Q );
	rep( i, Q )
	{
		int c, a, n;
		scanf( "%d%d%d", &c, &a, &n );
		
		int ans = 0;

		int mi = std::min( c, std::min( a, n ) );
		ans += mi; c -= mi; a -= mi; n -= mi;
		mi = std::min( c/2, a );
		ans += mi; c -= mi*2; a -= mi;
		ans += c/3;

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

	return 0;
}

Measured memory_bytes: 1028
#060_D
n, W = map(int, input().split())
w1, w2, w3, w4 = [], [], [], []
w, v = map(int, input().split())
w1.append(v)
for _ in range(n-1):
    a, b = map(int, input().split())
    if a == w: w1.append(b)
    if a == w+1: w2.append(b)
    if a == w+2: w3.append(b)
    if a == w+3: w4.append(b)
    
for w_ in [w1, w2, w3, w4]:
    w_.sort(reverse= True)
    
ans = 0
for i in range(0, len(w1)+1):
    for j in range(0, len(w2)+1):
        for k in range(0, len(w3)+1):
            res = W - (i * w + j * (w+1) + k * (w+2))
            if res < 0:
                continue
            tmp = sum(w1[:i])+sum(w2[:j])+sum(w3[:k])+sum(w4[:res//(w+3)])
            ans = max(tmp, ans)
            
print(ans)

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

using namespace std;

int main(void){
  int N;
  cin >> N;
  vector<int> L;
  int max = -1;
  int sum = 0;
  for(int i=0;i<N;i++){
    int l;
    cin >> l;
    if(l>max) max=l;
    sum += l;
    L.push_back(l);
  }
  sum -= max;
  if( max < sum ) cout << "Yes" << endl;
  else            cout << "No"  << endl;
  return 0;
}


Measured memory_bytes: 256
N, K = map(int, input().split())
A = list(map(int, input().split()))
MOD = 10 ** 9 + 7

inv = 0
sma = 0
for i in range(N):
    for j in range(N):
        if A[i] > A[j]:
            sma += 1
            if i < j:
                inv += 1

print((inv * K + sma * K * (K - 1) // 2) % MOD)


Measured memory_bytes: 3188
#include<iostream>
#include<iomanip>
#include<vector>
#include<string>
#include<cmath>
#define rep(i, start, end) for (int i = (int)start; i < (int)end; ++i)
#define rrep(i, start, end) for (int i = (int)start - 1; i >= (int)end; --i)
#define all(x) (x).begin(), (x).end()
using namespace std;
using ll = long long;
template<typename T> inline bool chmax(T& a, T b) {if (a < b) {a = b; return true;} return 0;}
template<typename T> inline bool chmin(T& a, T b) {if (a > b) {a = b; return true;} return 0;}

const double PI = acos(-1.0);

double deg2rad(double degree) {
    return degree * PI / 180.0;
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    double A, B, H, M;
    cin >> A >> B >> H >> M;
    double deg1 = (H * 60 + M) * 0.5;
    double deg2 = M * 6.0;
    double diff = deg1 - deg2;
    cout << fixed << setprecision(10) << sqrt(A * A + B * B - 2 * A * B * cos(deg2rad(diff))) << endl;
    return 0;
}

Measured memory_bytes: 4224
using System;

namespace ABC106C
{
    class MainClass
    {
        public static void Main(string[] args)
        {

            // N M みたいな入力
            string Sinput = Console.ReadLine();
            char[] S = Sinput.ToCharArray();

            // N M みたいな入力
            string input2 = Console.ReadLine();
            long K = long.Parse(input2);


            char ans = '1';
            //ans
            for(int i = 0; i < K; i++)
            {
                if(S[i] != '1')
                {
                    ans = S[i];
                    break;
                }
            }



            //出力
            Console.WriteLine(ans);
        }
    }
}


Measured memory_bytes: 11092
#pragma GCC target("avx2")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")

#include <algorithm>
#include <iostream>
#include <string>

using namespace std;

const int MAX_N = 100000;
const int MAX_K = 10;

int N;

int ans[MAX_N + 1];

string allocate(string s);
string translate();

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

    cin >> N;

    string s;

    cin >> s;

    cout << allocate(s) << "\n";

    return 0;
}

string allocate(string s)
{
    for (int j = 0; j < 4; j++) {
        if (j & 1) {
            ans[0] = 1;
        } else {
            ans[0] = 0;
        }

        if (j & (1 << 1)) {
            ans[1] = 1;
        } else {
            ans[1] = 0;
        }

        for (int i = 1; i < N; i++) {
            if (s[i] == 'o') {
                if (ans[i]) {
                    ans[i + 1] = !ans[i - 1];
                } else {
                    ans[i + 1] = ans[i - 1];
                }
            } else {
                if (ans[i]) {
                    ans[i + 1] = ans[i - 1];
                } else {
                    ans[i + 1] = !ans[i - 1];
                }
            }
        }

        if (ans[N] == ans[0]) {
            if ((s[0] == 'o') && ((ans[0] && ans[N - 1] == !ans[1]) || (!ans[0] && ans[N - 1] == ans[1]))) {
                return translate();
            } else if ((s[0] == 'x') && ((ans[0] && ans[N - 1] == ans[1]) || (!ans[0] && ans[N - 1] == !ans[1]))) {
                return translate();
            }
        }
    }
    return "-1";
}

string translate()
{
    string out = "";
    for (int i = 0; i < N; i++) {
        if (ans[i]) {
            out += 'W';
        } else {
            out += 'S';
        }
    }
    return out;
}

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

using namespace std;


int main(void){

	int a, b;
	string c;

	cin >> a >> c >> b;
	if (c == "+") a = a + b;
	if (c == "-") a = a - b;
	if (c == "*") a = a * b;
	if (c == "/") a = a / b;

	while (1){
		cin >> c;
		if (c == "=") break;
		cin >> b;
		if (c == "+") a = a + b;
		if (c == "-") a = a - b;
		if (c == "*") a = a * b;
		if (c == "/") a = a / b;
	}
	cout << a << endl;
	return 0;
}

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

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;

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

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI  = acos(-1.0);
const int MOD = 1000000007;
const int INF = 2147483647;

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

//myfuncs
//素数判定
template<class T> inline T isPrime(T x) {
	bool ret = true;
	if (x < 2) {
		ret = false;
	}
	for (LL i = 2; i <= sqrt(x); i++) {
		if (x%i == 0) {
			ret = false;
		}
	}
	return ret;
}

//Union FInd
struct UnionFind {
    vector<int> par; // par[i]:iの親の番号　(例) par[3] = 2 : 3の親が2

    UnionFind(int N) : par(N) { //最初は全てが根であるとして初期化
        for(int i = 0; i < N; i++) par[i] = i;
    }

    int root(int x) { // データxが属する木の根を再帰で得る：root(x) = {xの木の根}
        if (par[x] == x) return x;
        return par[x] = root(par[x]);
    }

    void unite(int x, int y) { // xとyの木を併合
        int rx = root(x); //xの根をrx
        int ry = root(y); //yの根をry
        if (rx == ry) return; //xとyの根が同じ(=同じ木にある)時はそのまま
        par[rx] = ry; //xとyの根が同じでない(=同じ木にない)時：xの根rxをyの根ryにつける
    }

    bool same(int x, int y) { // 2つのデータx, yが属する木が同じならtrueを返す
        int rx = root(x);
        int ry = root(y);
        return rx == ry;
    }
};

//main code

int main(int argc, char const* argv[])
{
    int h,w,d,q;
    cin >> h >> w >> d;
    vector<PII> v(h*w+1);
    vector<int> sum(h*w+1);
    for (int i = 0; i < h; i++) {
        for (int j = 0; j < w; j++) {
            int a;
            cin >> a;
            v[a] = make_pair(j,i);    // v[マスの数字]に(x,y)を格納
        }
    }
    for (int i = 1; i <= d; i++) {
        sum[i] = 0;
        for (int j = i+d; j <= h*w; j+=d) {
            sum[j] = sum[j-d] + abs(v[j-d].first - v[j].first) + abs(v[j-d].second - v[j].second);
        }
    }
    cin >> q;
    for (int i = 0; i < q; i++) {
        int l,r;
        cin >> l >> r;
        cout << sum[r] - sum[l] << endl;
    }
    return 0;
}


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

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

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

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI  = acos(-1.0);
const int MOD = 1000000007;

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

//main code

int main(int argc, char const* argv[])
{
	int a,b;
	cin >> a >> b;
	if (b%a == 0) {
		cout << a + b << endl;
		return 0;
	}
	cout << b - a << endl;
	return 0;
}


Measured memory_bytes: 256
// AOJ 2208: The Melancholy of Thomas Right
// 2017.11.6 bal4u@uu

#include <stdio.h>
#include <stdlib.h>
#define TM 0
#if TM
#include <time.h>
#endif

int r[10001] = {-1,0}, c[10001] = {-1,0};

char buf[60001], *p;
int getint()
{
	int n = 0;
	while (*p >= '0') n = (n<<3) + (n<<1) + (*p++ & 0xf);
	return n;
}

int des(int *a, int *b) { return *b - *a; }
int inc(int *a, int *b) { return *a - *b; }
int main()
{
	int n, i, j, k, goal, ans;

	while (fgets(p=buf, 10, stdin) && *buf != '0') {
		n = getint();
		fgets(p=buf, 60000, stdin);
		for (i = 1; i <= n; i++) r[i] = getint(), p++;
		fgets(p=buf, 60000, stdin);
		for (i = 1; i <= n; i++) c[i] = getint(), p++;
		if (n == 1) { ans = r[1] == c[1]; goto done; }

		qsort(r+1, n, sizeof(int), des);
		qsort(c+1, n, sizeof(int), inc);
		
		ans = 1;
		if (r[1] == n) k = c[0], j = 0;
		else           k = c[1], j = 1;
		while (c[j+1] == k) j++;
		goal = r[1] + j;
		if (goal > n) { ans = 0; goto done; }

		for (i = 2; i <= n; i++) {
			if (r[i] != r[i-1] && c[j+1] != c[j]) {
				k = c[j+1];
				while (j <= n && c[j+1] == k) j++;
			}
			if (r[i] + j != goal) { ans = 0; break; }
		}
done:	puts(ans ? "Yes" : "No");
	}
#if TM
	end = clock();
	printf("time %lf\n", (double)(end-start)/CLOCKS_PER_SEC);
#endif
	return 0;
}

Measured memory_bytes: 1836
#include<iostream>
#include<cmath>
#include<cstdio>
#define mes(a, b) memset(a, b, sizeof a)
#define pb push_back
using namespace std;
typedef long long ll;
const ll mod = 1e9+7;
const int maxn = 2e6+10;
const double eps = 1e-1;
int T, n, m, k, q;
int main(){
    double r, pi = acos(-1);
    scanf("%lf", &r);
    printf("%f\n", 2.0*r*pi);
    return 0;
}


Measured memory_bytes: 3828
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author cherrypi59
 */

#include <bits/stdc++.h>
#define FOR(i, a, b) for(int i=(a);i<(b);++i)
#define FFOR(i, a, b) FOR(i, a, b+1)
#define REP(i, n) FOR(i, 0, n)
#define RREP(i, n) FOR(i, 1, n+1)
#define ALL(v) (v).begin(), (v).end()
#define RALL(v) (v).rbegin(), (v).rend()
#define LEN(x) (int)(x).size()
#define DUMP(x) cerr<<__LINE__<<' '<<#x<<"="<<(x)<<endl;
#define pb push_back
#define eb emplace_back
#define mp make_pair

using namespace std;
using lint = long long;
using pii =  pair<int, int>;
using pll =  pair<lint, lint>;
template <typename T> using vc = vector<T>;
template <typename T> using vvc = vector<vector<T>>;
template <typename T> inline bool chmax(T &a, T b){if(a<b){a = b; return true;} return false;}
template <typename T> inline bool chmin(T &a, T b){if(a>b){a = b; return true;} return false;}

constexpr lint ten(int n) {return n==0 ? 1 : ten(n-1)*10;}

class CMaximumVolume {
public:
    void solve(std::istream& in, std::ostream& out){
        ios_base::sync_with_stdio(false);
        in.tie(nullptr), out.tie(nullptr);
        double L;
        in>>L;
        double len = L / 3;
        out<<fixed<<setprecision(12)<<len*len*len<<'\n';
    }
};


int main() {
	CMaximumVolume solver;
	std::istream& in(std::cin);
	std::ostream& out(std::cout);
	solver.solve(in, out);
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
using namespace std;
int main(void){
    int h,w;
    string str("#");
    while(1){
        cin>>h>>w;
        if(h==0&&w==0){
            break;
        }
        for(int i=0;i<h;i++){
            for(int i=0;i<w;i++){
            cout<<str;
            }
            cout<<endl;
        }
        cout<<endl;
    }
}

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

using namespace std;

typedef long long ll;

const int maxn=3e5+5;

const int mod=1e9+7;

int num[100];

ll a[maxn];

int main(){
	int n;
	scanf("%d",&n);
	for(int i=0;i<n;i++){
		scanf("%lld",a+i);
	}
	for(int i=0;i<n;i++){
		for(int j=0;j<60;j++){
			if(a[i]&(1LL<<j)) num[j]++;
		}
	}
	
	ll ans=0;
	for(int i=0;i<n-1;i++){
		for(int j=0;j<60;j++){ 
			if(a[i]&(1LL<<j)){
				int tmp=n-i-num[j];
				ll tt=(1LL<<j)%mod;
				ans=(ans+tt*tmp)%mod;
				num[j]--;
			}
			else{
				ll tt=(1LL<<j)%mod;
				ans=(ans+num[j]*tt)%mod;
			}
		}
//		printf("%d %d\n",i,ans);
	}
	printf("%lld\n",ans);
	return 0;
}

Measured memory_bytes: 2560
#include <stdio.h>

int main(void){
    int N, a, b;
    scanf("%d%d%d", &N, &a, &b);
    int sum = 0;
    for(int i = 1; i <= N; i++){
        int dig = 0;
        int sum1 = 0;
        int j = i;
        while(j > 0){
            dig = j % 10;
            sum1 += dig;
            j = j/10;
        }
        if(sum1 >= a && sum1 <= b){
            sum += i;
        }
    }
    printf("%d\n", sum);
    return 0; 
}


Measured memory_bytes: 128
n, a, b = map(int, input().split())
if (b-a)%2 != 0:
    if a-1 <= n-b:
        ans = (b - a -1)//2 + 1 + a-1
    else:
        ans = (b - a - 1)//2 + 1 + n-b
else:
    ans = min((b - a) // 2, b-1, n-a)
print(ans)

Measured memory_bytes: 3060
#include <iostream>
#include <cstring>
#include <algorithm>
#include <vector>
#include <string>
#include <math.h>
#include <stdio.h>
#include <iomanip>
#include <limits>
#include <list>
#include <queue>
#include <tuple>
#include <map>
#include <set>
#include <sstream>
using namespace std;
#define MOD (long long int)(1e9+7)
#define ll long long int
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define reps(i,n) for(int i=1; i<=(int)(n); i++)
#define REP(i,n) for(int i=n-1; i>=0; i--)
#define REPS(i,n) for(int i=n; i>0; i--)
#define FOR(i,a,b) for(int i=a; i<(int)(b); i++)
#define ALL(x) (x).begin(),(x).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define SORT(c) sort(ALL(x))
#define CLR(a) memset((a), 0 ,sizeof(a))
#define PB push_back
#define MP make_pair
#define SP << " " <<
const int INF = 1001001001;
const ll LINF = 100100100100100100;
const double EPS = 1e-10;
const double PI  = acos(-1.0);
typedef pair<int,int> PII;
typedef vector<int> VI;
typedef vector<VI> VVI;

template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}

__attribute__((constructor))
void initial(){
	cin.tie(nullptr);
	ios::sync_with_stdio(false);
	cout << fixed << setprecision(15);
}

signed main(){
  vector<ll> a(3); cin>>a[0]>>a[1]>>a[2];
  if(a[0]%2==0||a[1]%2==0||a[2]%2==0) cout << 0 << endl;
  else{
    sort(ALL(a));
    cout << a[0]*a[1] << endl;
  }
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstring>
#include <cmath>
#include <vector>
#include <algorithm>
#include <stdio.h>
#include <math.h>
#include <stdlib.h>
#include <set>
#include <map>
#include <iterator>
#include <stack>
#include <string.h>
#include <cstdlib>
#include <queue>
#include <list>
#include <string>

using namespace std;

int main()
{
    int n;
    
    cin >> n;
    
    if (n%2 == 0){
        printf("%.8f\n",(float)1/2);
    }
    else {
        printf("%.8f\n",(float)(n+1)/(float)(2*n));
    }
}


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

typedef long long ll;
typedef pair<int, int> Pi;
typedef pair<ll, ll> Pll;

#define Fi first
#define Se second
#define pb(x) push_back(x)
#define sz(x) (int)x.size()
#define rep(i, n) for(int i=0;i<n;i++)
#define repp(i, n) for(int i=1;i<=n;i++)
#define all(x) x.begin(), x.end()

#define geti1(X) scanf("%d",&X)
#define geti2(X,Y) scanf("%d%d",&X,&Y)
#define geti3(X,Y,Z) scanf("%d%d%d",&X,&Y,&Z)
#define geti4(X,Y,Z,W) scanf("%d%d%d%d",&X,&Y,&Z,&W)

#define GET_MACRO(_1,_2,_3,_4,NAME,...) NAME
#define geti(...) GET_MACRO(_VA_ARGS_, geti4, geti3, geti2, geti1) (_VA_ARGS_)

#define INF 987654321
#define IINF 987654321987654321

int n;
ll ca[100100];
ll x;

int main(){
    geti1(n); scanf("%lld", &x);
    repp(i,n) scanf("%lld", (ca+i));
    
    ll res = 0;
    repp(i,n-1){
        if(ca[i]+ca[i+1] <= x) continue;
        if(ca[i] >= x ){
            res += (ca[i]+ca[i+1] - x);
            ca[i] = x; ca[i+1] = 0;
        }
        else{
            res += (ca[i]+ca[i+1] - x);
            ca[i+1] = x - ca[i];
        }
    }
    printf("%lld\n", res);
    

    return 0;
}















Measured memory_bytes: 1024
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int a = scanner.nextInt();
        int b = scanner.nextInt();
        int ans = 0;
        for (int i = a; i <= b; i++) {
            String s = String.valueOf(i);
            if (new StringBuilder(s).reverse().toString().equals(s)) {
                ans++;
            }
        }
        System.out.println(ans);
    }
}

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

#define ll long long
#define mp make_pair
#define pb push_back
#define f first
#define s second
#define vi vector<int>
#define vl vector<long long>
#define sz size()
#define x first
#define y second
#define pii pair<int, int>
#define pll pair<ll, ll>
#define ld long double

using namespace std;

int a, b;

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

	if(a % 3 == 0 || b % 3 == 0 || (a + b) % 3 == 0 ) {
		cout << "Possible";
	} else {
		cout << "Impossible";
	}
	
	return 0;
}

Measured memory_bytes: 764
import kotlin.math.pow

fun longList() = readLine()?.split(" ")?.map(String::toLong) ?: TODO()
fun main() {
    val (n, k) = longList()

    if (n == k) {
        println("1")
        return
    }
    if (k % 2L == 1L) {
        val n2 = n / k
        println(n2.toDouble().pow(3.0).toLong().toString())
    } else {
        val n2 = (n / k).toDouble().pow(3)
        var n3 = 0
        1.until(n + 1).forEach {
            if (it % k == k / 2L) {
                n3++
            }
        }
        println((n2 + n3.toDouble().pow(3)).toLong().toString())
    }
}


Measured memory_bytes: 36816
#include <bits/stdc++.h>
#define ll long long
#define sz(x) (int)(x).size()
using namespace std;

int f(int x)
{
    int l=0,r=40,m;
    while (l<r)
    {
        m=l+(r-l)/2+1;
        if ((m*(m+1))/2<=x)
            l=m;
        else
            r=m-1;
    }
    return l;
}

int main()
{
    ios_base::sync_with_stdio(0); cin.tie(0);
    ll n;
    cin>>n;
    int ans=0,cur=0;
    while (n%2==0)
    {
        n/=2;
        ++cur;
    }
    ans+=f(cur);
    for (ll i=3;i*i<=n;i+=2)
    {
        if (n%i==0)
        {
            cur=0;
            while (n%i==0)
            {
                n/=i;
                ++cur;
            }
            ans+=f(cur);
        }
    }
    if (n>1)
        cout<<ans+1;
    else
        cout<<ans;
    return 0;
}

Measured memory_bytes: 3652
#include <iostream>
#include <vector>
#include <algorithm>
#include <queue>
#include <stack>
#include <algorithm>
#include <stdio.h>
#include <cassert>
#include <set>
#include <map>
#include <bitset>
#include <unordered_set>
#include <string>
#include <cstring>
#include <cmath>
#include <ctime>
#include <climits>

#define forn(x, n)             for (int x = 0; x < n; x++)
#define fore(x, a, b, c)       for (int x = a; x <= b; x += c)
#define all(container)         (container).begin(), (container).end()
#define rall(container)        (container).rbegin(), (container).rend()
#define sz(container)          (int) container.size()
#define fi                     first
#define se                     second
using namespace std;

#ifdef LOCAL_DEFINE
    #include "../DEBUG.hpp"
#else
    #define dmp(...) 0
#endif

using ll = long long;
using pll = pair<ll, ll>;
using vi = vector<int>;
using vll = vector<ll>;
using pii = pair<int, int>;
using vpii = vector<pair<int, int>>;
using vs = vector<string>;
using vb = vector<bool>;
using vvb = vector<vector<bool>>;
using vvi = vector<vector<int>>;
using vvll = vector<vector<ll>>;

template<class T> bool uin(T &a, T b) { return a > b ? (a = b, true) : false; }
template<class T> bool uax(T &a, T b) { return a < b ? (a = b, true) : false; }

bool check(ll n, ll val) {
    ll ans = (n * (n + 1)) / 2;
    return ans >= val;
}

ll solve(ll val) {
    ll l = 0, r = 1e8;
    while (l < r) {
        ll mid = (l + r) >> 1;
        if (check(mid, val)) r = mid;
        else l = mid + 1;
    }
    return l;
}

ll calculate(ll val) {
    ll ans = 0, cnt = 0;
    while (val % 2 == 0) {
        ++cnt;
        val /= 2;
    }
    ll temp = solve(cnt);
    if ((temp * (temp + 1)) / 2 != cnt) --temp;
    ans += temp;
    for (ll i = 3; i * i <= val; i += 2) {
        cnt = 0;
        while (val % i == 0) {
            ++cnt;
            val /= i;
        }
        temp = solve(cnt);
        if ((temp * (temp + 1)) / 2 != cnt) --temp;
        ans += temp;
    }
    if (val != 1) ++ans;
    return ans;
}

int main(void) {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.precision(10);
    cout << fixed;
#ifdef LOCAL_DEFINE
    freopen("in", "r", stdin);
#endif
        
    ll n;
    cin >> n;
    ll ans = calculate(n);
    cout << ans << '\n';

#ifdef LOCAL_DEFINE
    cerr << "Time elapsed : " << 1.0 * clock() / CLOCKS_PER_SEC << '\n';
#endif
    return 0;
}

Measured memory_bytes: 3636
#include <bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define R cin>>
#define Z class
#define ll long long
#define ln cout<<'\n'
#define in(a) insert(a)
#define pb(a) push_back(a)
#define pd(a) printf("%.10f\n",a)
#define mem(a) memset(a,0,sizeof(a))
#define all(c) (c).begin(),(c).end()
#define iter(c) __typeof((c).begin())
#define rrep(i,n) for(ll i=(ll)(n)-1;i>=0;i--)
#define REP(i,m,n) for(ll i=(ll)(m);i<(ll)(n);i++)
#define rep(i,n) REP(i,0,n)
#define tr(it,c) for(iter(c) it=(c).begin();it!=(c).end();it++)
template<Z A>void pr(A a){cout<<a;ln;}
template<Z A,Z B>void pr(A a,B b){cout<<a<<' ';pr(b);}
template<Z A,Z B,Z C>void pr(A a,B b,C c){cout<<a<<' ';pr(b,c);}
template<Z A,Z B,Z C,Z D>void pr(A a,B b,C c,D d){cout<<a<<' ';pr(b,c,d);}
template<Z A>void PR(A a,ll n){rep(i,n){if(i)cout<<' ';cout<<a[i];}ln;}
ll check(ll n,ll m,ll x,ll y){return x>=0&&x<n&&y>=0&&y<m;}
const ll MAX=1e9+7,MAXL=1LL<<61,dx[4]={-1,0,1,0},dy[4]={0,1,0,-1};
typedef pair<ll,ll> P;

void Main() {
  int n,m;
  cin >> n >> m;
  string s[n];
  rep(i,n) R s[i];
  int d[n][m];
  rep(i,n)rep(j,m) d[i][j]=MAX;
  queue<P> que;
  rep(i,n) {
    rep(j,m) {
      if(s[i][j]=='#') {
        que.push(P(i,j));
        d[i][j]=0;
      }
    }
  }
  while(!que.empty()) {
    P p=que.front();que.pop();
    rep(i,4) {
      int x=p.F+dx[i],y=p.S+dy[i];
      if(check(n,m,x,y)&&d[x][y]==MAX) {
        d[x][y]=d[p.F][p.S]+1;
        que.push(P(x,y));
      }
    }
  }
  int ans=0;
  rep(i,n)rep(j,m) ans=max(ans,d[i][j]);
  pr(ans);
}

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


Measured memory_bytes: 21556
#include<iostream>
#include<cstdio>
#include<cassert>
#define F first
#define S second
#define REP(i,s,n) for(int i=s;i<n;i++)
#define rep(i,n) REP(i,0,n)
using namespace std;
typedef pair<int,bool> IB;
typedef pair<IB,int> P;//P(IB(cnt,1 or 0),prev)

int main(){
  int n;
  while(true){
    scanf("%d",&n);
    if(n == 0)break;
    P p[n+2];
    int now = 1,cnt = 0;
    rep(i,n+2)p[i] = P(IB(-1,false),-1);
    bool deb[n+2];

    for(int i=1;i<=n;i++){
      bool input;
      cin >> input;
      deb[i] = input;
      if(i == 1){
	p[i] = P(IB(1,input),-1);
	now = 1;
	continue;
      }
      
      /* odd */
      if(i%2 != 0){
	if(input == p[now].F.S){
	  p[now].F.F++;
	}	
	else{
	  p[i] = P(IB(1,input),now);
	  now = i;
	}
	continue;
      }

      /* even */
     
      if(input == p[now].F.S){
	p[now].F.F++;
      }
      else {
	p[now].F.F++;
	p[now].F.S = input;

	if(-1 != p[now].S){
	  p[p[now].S].F.F += p[now].F.F;	  
	  int post = p[now].S;
	  p[now] = P(IB(-1,false),-1);
	  now = post;
	}
      }
    }

   
    for(int i=1;i<=n;i++)if(!p[i].F.S && p[i].F.F != -1)cnt += p[i].F.F;
    cout << cnt << endl;
  }
  return 0;
}

Measured memory_bytes: 2512
#include <iostream>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#include <algorithm>
#include <utility>
#include <map>
#include <climits>
#include <tuple>
#include <queue>
//#include <bits/stdc++.h>
 
using namespace std;
typedef long long ll;
#define F first
#define S second
#define PB push_back
#define MP make_pair
#define MT make_tuple
 

vector<int> m,M,br; 

int MOD = 1e9 + 7;
 
int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0); 
	ll x, k, d;
	cin >> x >> k >> d;
	if (x < 0) x = -x;
	ll p = x / d;
	

	if (p >= k){
		cout << abs(x - k * d) <<endl;
	}	else {
		k = k - p;
		ll y = x % d;
		if (k % 2){
			y = y - d; 
			cout << min({abs(y), abs(y - 2*d), abs(y + 2*d)}) <<endl;
		} else {
				cout << min({abs(y), abs(y - 2*d), abs(y + 2*d)}) <<endl;
		}
	}
    return 0;
}

Measured memory_bytes: 3196
def bubbleSort(A,N):
    for i in range(N):
        for j in range(N-1,i,-1):
            if A[j][1:] < A[j-1][1:] :
                A[j] , A[j-1] = A[j-1] , A[j]
    return A

def selectionSort(A,N):
    for i in range(N):
        minj = i
        for j in range(i,N):
            if A[j][1:] < A[minj][1:]:
                minj = j
        A[i] , A[minj] = A[minj] , A[i]
    return A

N =int(input())
cards = input().split()
bub , sel =cards[:] , cards[:]
X = bubbleSort(bub , N)
print(*X)
print("Stable")
Y = selectionSort(sel,N)
print(*Y)
print("Stable" if X == Y else "Not stable")

Measured memory_bytes: 7828
#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 = b - 1; i >= a; i--)
#define RREP(i, n) RFOR(i, 0, n)
#define rep(i, a, b) for (auto i = a; i < b; i++)
#define rrep(i, a, b) for (auto i = a; i > b; i--)
#define range(i, a, b) (a <= i && i < b)
#define ll long long
#define fi first
#define fs first
#define se second
#define sc second
using namespace std;
using vec = vector<int>;
using mat = vector<vec>;
typedef pair<int, int> P;

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


int w, h;
bool flag = false;
vector<string> p;
mat used;

double eps = 1e-8;

pair<int, int> makeTree(int x, int y)
{
	if (used[y][x]) { return pair<int, int>{0,0}; }

	vector<P> block;
	block.emplace_back(x, y);
	queue<pair<int, int>> Q;
	Q.push({ x,y });
	used[y][x] = 1;

	while (Q.size())
	{
		for (int k = 0; k < 4; ++k)
		{
			int nX = Q.front().fi + dx[k];
			int nY = Q.front().sc + dy[k];

			if (nX < 0 || nX >= w || nY < 0 || nY >= h)continue;
			if (used[nY][nX])continue;

			if (p[y][x] == p[nY][nX])
			{
				used[nY][nX] = 1;
				block.emplace_back(nX,nY);
				Q.push({ nX,nY });
			}
		}
		Q.pop();
	}

	int xr = -1, xl = 1000;;

	P now;
	
	for (auto & b : block)
	{
		now.first += b.fi;
		now.se += 1;
		if (b.se + 1 >= h || (p[b.se + 1][b.fi] != '.' && p[b.se + 1][b.fi] != p[b.se][b.fi]))
		{
			xr = max(xr, b.fi);
			xl = min(xl, b.fi);
		}
		if (b.se - 1 >= 0 && p[b.se - 1][b.fi] != '.')
		{
			auto cld = makeTree(b.first, b.second - 1);
			now.fi += cld.fi;
			now.se += cld.se;
		}
	}

	double M = 1.0*now.fi / now.se;
	
	//cout << block.size() << endl;
	//cout << now.fi <<"/"<< now.se << endl;
	//cout << xl << "-" << xr << endl;
	//cout << M << endl;
	if (xl - 0.5< M && M < xr + 0.5)
	{
		return now;
	}
	flag = false;
	return now;
}


bool solve()
{
	cin >> w >> h;
	if (w == 0)return false;
	flag = true;
	p = vector<string>(h);
	used = mat(h, vec(w));

	REP(i, h)
	{
		cin >> p[i];
	}

	REP(i, w)
	{
		if (p[h - 1][i] != '.')
		{
			makeTree(i, h - 1);
			break;
		}
	}

	if (flag)
	{
		cout << "STABLE" << endl;
	}
	else
	{
		cout << "UNSTABLE" << endl;
	}

	return true;
}

signed main() {
	while (solve())
	{
	}
}


Measured memory_bytes: 3248
ans=[]
def zen(x,q):
    return x-(x**3-q)/(3*x**2)
while True:
    q=input()
    if q==-1:
        break
    x=float(q/2)
    while (abs(x**3-q) >= 0.00001*q):
        x=zen(x,q)
    ans.append(x)
    
for i in ans:
    print ('%.6f' % i)

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

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

    int n;
    cin >> n;

    vector<vector<int>> g(n);
    vector<int> a(n-1), b(n-1);
    rep(i, n-1){
        cin >> a[i] >> b[i];
        --a[i];
        --b[i];

        g[a[i]].push_back(b[i]);
        g[b[i]].push_back(a[i]);
    }

    queue<pair<int, int>> q;
    q.push(make_pair(0, 0));

    vector<int> seen(n, 0);

    map<pair<int, int>, int> res;
    int max_color = 0;
    while(!q.empty()){
        int v = q.front().first;
        int ng_color = q.front().second;
        q.pop();

        seen[v] = 1;

        unordered_set<int> ng_colors;
        ng_colors.insert(ng_color);

        int color = 1;
        for(auto nv: g[v]){
            if(seen[nv]) continue;

            while(1){
                if(ng_colors.count(color)) ++color;
                else break;
            }
            res[make_pair(v, nv)] = color;
            q.push(make_pair(nv, color));

            max_color = max(max_color, color);
            ng_colors.insert(color);
        }
    }

    cout << max_color << endl;
    rep(i, n-1){
        cout << res[make_pair(a[i], b[i])] << endl;
    }


    return 0;
}

Measured memory_bytes: 13440
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
#define ce(x) cerr << (x) << "\n"
#define cesp(x) cerr << (x) << " "
#define pb push_back
#define mp make_pair
#define Would
#define you
#define please


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


	ll N, X;
	cin >> N >> X;
	int A[2000];
	rep(i, N) cin >> A[i];

	ll kotae = 1e18;
	rep(i, N) {
		ll kei = 0;
		rep(j, N) kei += A[j];
		kotae = min(kotae, kei + X * i);

		int saisho = A[0];
		rep(j, N - 1) {
			A[j] = min(A[j], A[j + 1]);
		}
		A[N - 1] = min(A[N - 1], saisho);
	}

	co(kotae);

	Would you please return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define syosu(x) fixed<<setprecision(x)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef pair<double,double> pdd;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<string> vs;
typedef vector<P> vp;
typedef vector<vp> vvp;
typedef vector<pll> vpll;
typedef pair<int,P> pip;
typedef vector<pip> vip;
const int inf=1<<30;
const ll INF=1ll<<60;
const double pi=acos(-1);
const double eps=1e-9;
const ll mod=1e9+7;
const int dx[4]={0,1,0,-1},dy[4]={1,0,-1,0};

string s;

int main(){
	cin>>s;
	ll n=s.size(),res=0,t=0;
	for(int i=0;i<n;i++){
		if(s[i]=='W') res+=t;
		else t++;
	}
	cout<<res<<endl;
}

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

using namespace std;

int main()
{
    string s;
    int re = 0;

    cin >> s;

    for(int i = 0;i < 3;i++)
    {
        if(s[i] == '1')
        {
            re++;
        }
    }

    cout << re;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define MOD 1000000007
#define INF 1001001001
#define LINF 1001001001001001001
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define bit(n) (1LL<<(n))
using namespace std;

typedef long long ll;
typedef pair<int, int> P;
typedef pair<ll, ll> LLP;

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

  if (K == 0) {
    cout << N * N << endl;
    return 0;
  }

  ll ans = 0;

  for (ll b = K + 1; b <= N; b++) {
    ll q = N / b;
    ans += ((b - 1) - K + 1) * q;
    if (N - (b * q + K) + 1 > 0) ans += N - (b * q + K) + 1;
  }

  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 3620
#include <iostream>
#include <cstdint>
#include <algorithm>

using namespace std;

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

    int64_t res=0;
    while (M > 3) {
        int64_t tmp=min(N, M/2);
        res += tmp;
        N -= tmp;
        M -= 2*tmp;
        if (!N) {
            res += M / 4;
            break;
        }
    }

    cout << res << endl;
    return 0;
}



Measured memory_bytes: 256
#include <stdio.h>

int main(){
    long long n,m,Q;
    scanf("%lld%lld%lld",&n,&m,&Q);
    int table[502][502]={0};
    int l[m],r[m],p[Q],q[Q];
    for(int i=0;i<m;i++){
        scanf("%d%d",&l[i],&r[i]);
       table[l[i]][r[i]]++;
    }
    for(int i=500;i>0;i--){
        for(int j=499;j>=i;j--){
            table[i][j]+=table[i][j+1];
        }
    }
    /*for(int i=1;i<=10;i++){
        for(int j=1;j<=10;j++){
            printf("%d ",table[i][j]);
        }
        printf("\n");
    }*///trainprint
    for(int i=0;i<Q;i++){
        scanf("%d%d",&p[i],&q[i]);
        
    }
    for(int i=0;i<Q;i++){
        long tmp=0;
        int chk=p[i];
        while(chk<=q[i]){
            tmp+=table[chk][chk]-table[chk][q[i]+1];
            chk++;
        }
        printf("%ld\n",tmp);
    }
    return 0;
}

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

typedef long long ll;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<double> vd;
typedef vector<ll> vl;
typedef vector<string> vs;
#define fo(i, a, b) for (int i = a; i < b; i++)
#define re(i, n) fo(i, 0, n)
#define pb push_back
#define mp make_pair
#define all(s) s.begin(), s.end()
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
ll lcm(ll a, ll b) { ll g = gcd(a, b); return a / g * b; }
int main()
{
  int n, d, x;
  cin >> n >> d >> x;
  vi a(n);
  re(i, n) {
    cin >> a[i];
  }

  int s = 0;
  re(i, n) {
    s += (d - 1) / a[i] + 1;
  }
  cout << s + x << endl;

  return 0;
}


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

int main()
{
    int N, K, tmp;
    cin >> N >> K;
    vector<int64_t> list(N + 1);
    double max = 0;

    cin >> list.at(1);

    for (int i = 2; i < N + 1; i++)
    {
        cin >> tmp;
        list.at(i) = list.at(i - 1) + tmp;
    }

    for (int i = 0; i + K < N + 1; i++)
    {
        if (list.at(i + K) - list.at(i) > max)
            max = list.at(i + K) - list.at(i);
    }

    cout << fixed << setprecision(15) << (max + K) / 2;
}

Measured memory_bytes: 1792
#include<iostream>
#include<cstdio>
#include<string>
using namespace std;
int n;//见题目
string s;//只需要一个string轮流扫
int a[27];//26个字母出现的次数
int minn[27];//出现的最少次数
int main(){
    cin>>n;
    for(int i=1;i<=26;i++)minn[i]=10086;//附一个超大的值
    for(int i=1;i<=n;i++){
        for(int j=1;j<=26;j++)a[j]=0;//归零
        cin>>s;
        for(auto j:s)a[j-'a'+1]++;//重点！auto和for-range连用是最方便的
        for(int j=1;j<=26;j++)minn[j]=min(minn[j],a[j]);//更新最小值
    }
    for(int i=1;i<=26;i++)
        for(int j=1;j<=minn[i];j++)putchar('a'+i-1);//输出
}

Measured memory_bytes: 256
// Create by JJL
#define IOS ios_base::sync_with_stdio(0); cin.tie(0);
#include <cstdio>
#include <cmath>
#include <cstring>
#include <algorithm>
#include <iostream>
#include <string>
#include <vector>
#include <unordered_map>
#include <set>
#include <queue>
#define fi first
#define se second
using namespace std;
typedef long long LL;
typedef pair<int,int> PII;

const int N=300010,mod=998244353;
int l[N],r[N],f[N];
int c[N];
#define int long long
inline int lowbit(int x){
    return x&(-x);
}
int sum(int x){
    int res=0;
    while(x){
        res+=c[x];
        res%=mod;
        x-=lowbit(x);
    }
    return res;
}
void add(int x,int y){
    while(x<N){
        c[x]=(y+mod+c[x])%mod;
        x+=lowbit(x);
    }
}
signed main(){
    IOS;
    /* START CODE */
    int n,k;
    cin>>n>>k;
    for(int i=1;i<=k;++i){
        cin>>l[i]>>r[i];
    }
    f[1]=1;
    for(int i=1;i<=n;++i){
        if(i!=1)
            f[i]=sum(i);
        for(int j=1;j<=k;++j){
            add(i+l[j],f[i]);
            add(i+r[j]+1,-f[i]);
        }
    }
    cout<<f[n]<<endl;;
    return 0;
}


Measured memory_bytes: 5080
#include <stdio.h>
int main (void){
        int a,b,c,d;
        scanf("%d",&a);
        scanf("%d",&b);
        scanf("%d",&c);
        scanf("%d",&d);
        if(a+b==c+d) {
                printf("Balanced");
        }
        if(a+b>c+d) {
                printf("Left");
        }
        if(a+b<c+d) {
                printf("Right");
        }
        return 0;
}


Measured memory_bytes: 128
n,a,b=map(int,input().split())
m=10**9+7
ALL=pow(2,n,m)-1
x=y=1

for i in range(b):
    x=x*(i+1)%m
    y=y*(n-i)%m
    if i+1==a:
        a=b
        ALL-=y*pow(x,m-2,m)

print(ALL%m)

Measured memory_bytes: 9148
#include<iostream>

using namespace std;

int main(void)
{
  string n; cin>>n;
  
  for(int i=0;i<3;i++){
    if(n[i]=='1'){n[i]='9';}
    else if(n[i]=='9'){n[i]='1';}
  }
  
  cout<<n<<endl;
  return 0;
}

Measured memory_bytes: 256
<?php

fscanf(STDIN, "%d %d", $n, $m);
$A = array_map('intval', explode(' ', trim(fgets(STDIN))));

$pq = new SplPriorityQueue();
for ($i = 0; $i < $n; ++$i) {
    $pq->insert($A[$i], $A[$i]);
}

for ($i = 0; $i < $m; ++$i) {
    $x = $pq->extract();
    $x = floor($x / 2);
    $pq->insert($x, $x);
}

$sum = 0;
while ($pq->valid()) {
    $sum += $pq->extract();
}

echo $sum;


Measured memory_bytes: 53748
k = int(input())

if k % 2 == 0 or k % 5 == 0:
  print(-1)
  exit()

a = 7
ans = 0
for i in range(10**7):
  a = a % k
  if a % k == 0:
    ans = i + 1
    break
  else:
    a = a*10 + 7
    ans = i + 1


print(ans)


Measured memory_bytes: 9116
#include<stdio.h>
#include<math.h>

int main(void){
        double x1, y1, x2, y2;
        scanf("%lf %lf %lf %lf", &x1, &y1, &x2, &y2);
        printf("%lf\n", sqrt((x1-x2)*(x1-x2)+(y1-y2)*(y1-y2)));
        return 0;
}


Measured memory_bytes: 2120
/*Lucky_Glass*/
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
int main()
{
	int A,B,C;
	scanf("%d%d%d",&A,&B,&C);
	if(A+B>=C) puts("Yes");
	else puts("No");
	return 0;
}

Measured memory_bytes: 128
a = %w|1 1 1 2 1 2 1 5 2 2 1 5 1 2 1 14 1 5 1 5 2 2 1 15 2 2 5 4 1 4 1 51|.map(&:to_i)
k = gets.to_i

puts a[k-1]


Measured memory_bytes: 1788
N=int(input())
T=list(map(int,input().split()))
M=int(input())
P=[]
X=[]
for i in range(M):
    p,x=map(int,input().split())
    P.append(p)
    X.append(x)

ans=[]
m=sum(T)
for i in range(M):
    m=sum(T)
    m=m-T[P[i]-1]
    m=m+X[i]
    ans.append(m)

for i in range(M):
    print(ans[i])

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

using namespace std;
int main() {
	int N, A, B;
	cin >> N >> A >> B;
	string S;
	cin >> S;
	int exceed = 0;
	int orderB = 0;
	for (int i = 0; i < N; i++) {
		switch(S.at(i)){
		case 'a':
			if (exceed < A + B) {
				cout << "Yes" << endl;
				exceed++;
			}
			else {
				cout << "No" << endl;
			}
			break;
		case 'b':
			orderB++;
			if (exceed < A + B && orderB <= B) {
				cout << "Yes" << endl;
				exceed++;
			}
			else{
				cout << "No" << endl;
			}
			break;
		case 'c':
			cout << "No" << endl;
			break;
		}
	}
	return 0;
}


Measured memory_bytes: 896
import java.util.*;
import java.math.*;
public class Main{
	public static void main(String[] args) {
		try{
			Scanner s1 = new Scanner(System.in);
			double h = s1.nextInt();
			double a = s1.nextInt();
			double c = Math.ceil(h/a);
			int d = (int)c;
			System.out.println(d);
		}
		catch(Exception e){
			System.out.println(e.getMessage());
		}
	}
}

Measured memory_bytes: 22996
#
# 　　  ⋀_⋀　 
#　　  (･ω･)  
# .／ Ｕ ∽ Ｕ＼
#  │＊　合　＊│
#  │＊　格　＊│ 
#  │＊　祈　＊│ 
#  │＊　願　＊│ 
#  │＊　　　＊│ 
#      ￣
#
import sys
sys.setrecursionlimit(10**6)
input=sys.stdin.readline
from math import floor,sqrt,factorial,hypot,log #log2ないｙｐ
from heapq import heappop, heappush, heappushpop
from collections import Counter,defaultdict,deque
from itertools import accumulate,permutations,combinations,product,combinations_with_replacement
from bisect import bisect_left,bisect_right
from copy import deepcopy
from fractions import gcd
from random import randint
def ceil(a,b): return (a+b-1)//b
inf=float('inf')
mod = 10**9+7
def pprint(*A): 
    for a in A:     print(*a,sep='\n')
def INT_(n): return int(n)-1
def MI(): return map(int,input().split())
def MF(): return map(float, input().split())
def MI_(): return map(INT_,input().split())
def LI(): return list(MI())
def LI_(): return [int(x) - 1 for x in input().split()]
def LF(): return list(MF())
def LIN(n:int): return [I() for _ in range(n)]
def LLIN(n: int): return [LI() for _ in range(n)]
def LLIN_(n: int): return [LI_() for _ in range(n)]
def LLI(): return [list(map(int, l.split() )) for l in input()]
def I(): return int(input())
def F(): return float(input())
def ST(): return input().replace('\n', '')
def main():
    S=ST()
    Bcount = 0
    ans = 0
    for s in S:
        Bcount += s=="B"
        if s=="W":
            ans += Bcount
    print(ans)
if __name__ == '__main__':
    main()

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

int main(){
    ios::sync_with_stdio(false), cin.tie(nullptr);
    int N; cin >> N;

    cout << 0 << endl;
    string s; cin >> s;
    map<string, int> mp;
    if(s=="Male") mp["Male"] = 0, mp["Female"] = 1;
    else if(s=="Female") mp["Male"] = 1, mp["Female"] = 0;
    else return 0;

    int left = -1, right = N;
    while(1<right-left){
        int mid = (left+right) / 2;
        cout << mid << endl;
        cin >> s;
        if(s=="Vacant") return 0;
        else if(mid%2!=mp[s]) right = mid;
        else left = mid;
    }
    cout << left << endl;
    cin >> s;
    return 0;
}

Measured memory_bytes: 852
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<cstring>
#include<vector>
#include<queue>
#include<set>
#include<map>
#include<stack>
#include<bitset>
#include<ext/pb_ds/priority_queue.hpp>
using namespace std;

int A,B,C,Ans;

int main()
{
	#ifdef DMC
		freopen("DMC.txt","r",stdin);
	#endif
	
	cin >> A >> B >> C;
	for (;;)
	{
		if ((A & 1) || (B & 1) || (C & 1)) break;
		if (A == B && B == C) {cout << -1 << endl; return 0;}
		int a = B + C >> 1,b = A + C >> 1,c = A + B >> 1;
		A = a; B = b; C = c; ++Ans;
	}
	cout << Ans << endl;
	return 0;
}

Measured memory_bytes: 256