akhauriyash/Code-Regression huggingface dataset:
#define _USE_MATH_DEFINES
#include <cassert>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <string>
#include <sstream>
#include <vector>
#include <queue>
#include <stack>
#include <list>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <algorithm>
#include <complex>
#include <cmath>
#include <numeric>
#include <bitset>
#include <functional>

using namespace std;

#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
  cerr << name << ": " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
  const char* comma = strchr(names + 1, ',');
  cerr.write(names, comma - names) << ": " << arg1 << " |";
  __f(comma + 1, args...);
}

typedef long long int64;
typedef pair<int64, int64> ii;
const int INF = 1 << 29;
const int MOD = 1e9 + 7;

const int N = 200;
int branch[N];
vector<int> a[N];
int maxdep;

void DFS(int u, int parent, int dep) {
  maxdep = max(maxdep, dep);
  int cnt = 0;
  for (auto& v : a[u]) {
    if (v == parent) continue;
    DFS(v, u, dep + 1);
    ++cnt;
  }
  branch[dep] = max(branch[dep], cnt);
}

ii e[N];

int main() {
  int n;
  scanf("%d", &n);
  vector<pair<int, int>> e;
  for (int i = 1; i < n; ++i) {
    int x, y;
    scanf("%d%d", &x, &y);
    --x; --y;
    e.push_back({x, y});
    a[x].push_back(y);
    a[y].push_back(x);
  }
  ii ret = {1LL << 60, 1LL << 60};
  for (int i = 0; i < n; ++i) {
    memset(branch, 0, sizeof(branch));
    maxdep = 0;
    DFS(i, -1, 0);
    int64 cur = 1;
    for (int i = 0; i < maxdep; ++i) {
      cur *= branch[i];
    }
    ret = min(ret, {maxdep, cur});
  }
  for (auto& it : e) {
    int x = it.first, y = it.second;
    memset(branch, 0, sizeof(branch));
    maxdep = 0;
    DFS(x, y, 0);
    DFS(y, x, 0);
    int64 cur = 2;
    for (int i = 0; i < maxdep; ++i) {
      cur *= branch[i];
    }
    ret = min(ret, {maxdep, cur});
  }
  printf("%lld %lld\n", ret.first + 1, ret.second);
  return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <cstdlib>
#include <cstring>
#include <functional>
#include <iostream>
#include <vector>
using namespace std;

enum FACE { TOP, BOTTOM, FRONT, BACK, LEFT, RIGHT };
const int dx[6] = {0, 0, 0, 0, -1, 1};
const int dy[6] = {0, 0, -1, 1, 0, 0};

class dice {
private:
	int num[6];

	void roll(FACE a, FACE b, FACE c, FACE d) {
		int tmp = num[a];
		num[a] = num[b];
		num[b] = num[c];
		num[c] = num[d];
		num[d] = tmp;
	}

public:
	dice() {
		num[TOP] = 1;
		num[BOTTOM] = 6;
		num[FRONT] = 3;
		num[BACK] = 4;
		num[RIGHT] = 5;
		num[LEFT] = 2;
	}

	void set(int top, int front) {
		if(num[RIGHT] == top || num[LEFT] == top)
			west();

		while(num[TOP] != top)
			north();

		while(num[FRONT] != front)
			right();
	}

	int operator[] (FACE f) const { return num[f]; }

	void north() { roll(TOP, BACK, BOTTOM, FRONT); }
	void east() { roll(TOP, LEFT, BOTTOM, RIGHT); }
	void west() { roll(TOP, RIGHT, BOTTOM, LEFT); }
	void south() { roll(TOP, FRONT, BOTTOM, BACK); }
	void right() { roll(BACK, RIGHT, FRONT, LEFT); }
	void left() { roll(BACK, LEFT, FRONT, RIGHT); }
};

const int SIZE = 50;
int top[SIZE][SIZE];
int height[SIZE][SIZE];

void drop(int x, int y, dice d) {
	vector<pair<int, FACE> > v;
	v.push_back(make_pair(d[FRONT], FRONT));
	v.push_back(make_pair(d[BACK], BACK));
	v.push_back(make_pair(d[RIGHT], RIGHT));
	v.push_back(make_pair(d[LEFT], LEFT));

	sort(v.begin(), v.end(), greater<pair<int, FACE> >());

	for(int i = 0; i < 3; ++i) {
		int num = v[i].first, dir = v[i].second;
		if(num >= 4 && height[y][x] > height[y + dy[dir]][x + dx[dir]]) {
			switch(dir) {
			case FRONT:
				d.north();
				break;
			case BACK:
				d.south();
				break;
			case RIGHT:
				d.east();
				break;
			case LEFT:
				d.west();
			}

			drop(x + dx[dir], y + dy[dir], d);
			return;
		}
	}

	top[y][x] = d[TOP];
	++height[y][x];
}

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

	const int sx = SIZE / 2, sy = SIZE / 2;

	for(int n; cin >> n, n;) {
		memset(top, 0, sizeof(top));
		memset(height, 0, sizeof(height));

		for(int i = 0; i < n; ++i) {
			int t, f;
			cin >> t >> f;

			dice d;
			d.set(t, f);

			drop(sx, sy, d);
		}

		vector<int> cnt(7, 0);
		for(int i = 0; i < SIZE; ++i)
			for(int j = 0; j < SIZE; ++j)
				++cnt[top[i][j]];

		for(int i = 1; i <= 6; ++i)
			cout << cnt[i] << (i == 6 ? "\n" : " ");
	}


	return EXIT_SUCCESS;
}

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

using namespace std;

#define INF 1001000100010001000
#define MOD 1000000007
#define EPS 1e-10
#define int long long
#define rep(i, N) for (int i = 0; i < N; i++)
#define Rep(i, N) for (int i = 1; i < N; i++)
#define For(i, a, b) for (int i = (a); i < (b); i++)
#define pb push_back
#define eb emplece_back
#define mp make_pair
#define i_i pair<int, int>
#define vi vector<int>
#define vvi vector<vi >
#define vb vector<bool>
#define vvb vector<vb >
#define vp vector< i_i >
#define all(a) (a).begin(), (a).end()
#define Int(x) int x; scanf("%lld", &x);
#define int2(x, y) int x, y; scanf("%lld %lld", &x, &y);
#define int3(x, y, z) Int(x); int2(y, z);
#define fir first
#define sec second
#define ffir first.first
#define fsec first.second
#define sfir second.first
#define ssec second.second

//int dxy[5] = {0, 1, 0, -1, 0};
// assign avl ncm dijkstra geo2 kruskal graph uf lca BIT
// matrix dinic next_combination


signed main()
{
    Int(n);

    int ret = 1;
    while (ret * 2 <= n) {
        ret *= 2;
    }

    std::cout << ret << std::endl;

    return 0;
}


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

int main(){
  int n,m,r;
  cin >> n;
  m = n;
  while(m > 0){
    r += m % 10;
    m /= 10;
  }
  if(n%r == 0){
    cout << "Yes" << endl;
  }else{
    cout << "No" << endl;
  }
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)
#define all(c) c.begin(),c.end()
#define pb push_back
#define fs first
#define sc second
#define show(x) cout << #x << " = " << (x) << endl
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)
using namespace std;
template<class S,class T> ostream& operator<<(ostream& o,const pair<S,T> &p){
	return o<<"("<<p.fs<<","<<p.sc<<")";
}
template<class T> ostream& operator<<(ostream& o,const vector<T> &vc){
	o<<"{";
	for(const T& v:vc) o<<v<<",";
	o<<"}";
	return o;
}
using ll = long long;
template<class T> using V = vector<T>;
template<class T> using VV = vector<vector<T>>;
template<class T> using VVV = vector<VV<T>>;
VVV<double> dp(301,VV<double>(301,V<double>(301,-1)));
int N;
double dfs(int i,int j,int k){
	if(dp[i][j][k] != -1) return dp[i][j][k];
	dp[i][j][k] = 0;
		if(i==0 && j==0 && k==0) return 0;
		double coef = 1;
		{
			double p = 1.0*(N-i-j-k) / N;
			coef = 1.0/(1-p);
			dp[i][j][k] += p;
		}
		if(i){
			double p = 1.0*i/N;
			dp[i][j][k] += (dfs(i-1,j,k)+1) * p;
		}
		if(j){
			double p = 1.0*j/N;
			dp[i][j][k] += (dfs(i+1,j-1,k)+1) * p;
		}
		if(k){
			double p = 1.0*k/N;
			dp[i][j][k] += (dfs(i,j+1,k-1)+1) * p;
		}
		dp[i][j][k] *= coef;
	return dp[i][j][k];
}
int main(){
	cin>>N;
	V<int> A(3);
	rep(i,N){
		int x;
		cin>>x;
		x--;
		A[x]++;
	}
	printf("%.12f\n",dfs(A[0],A[1],A[2]));
}

Measured memory_bytes: 216960
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace AtCoder.Abc
{
    class QuestionB
    {
        public static void Main(string[] args)
        {
            var sw = new System.IO.StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
            Console.SetOut(sw);

            // 整数の入力
            var n = int.Parse(Console.ReadLine());

            var w = new string[n];

            for(int i = 0; i < n; i++) {
                w[i] = Console.ReadLine();
            }

            var myHash = new HashSet<string>();
            var last = "";

            foreach(var s in w) {
                if(string.IsNullOrWhiteSpace(last) == false) {
                    if(s[0] == last.Last() == false) {
                        Console.WriteLine("No");

                        Console.Out.Flush();
                        return;
                    }
                }
                if (myHash.Contains(s)) {
                    Console.WriteLine("No");

                    Console.Out.Flush();
                    return;
                }

                myHash.Add(s);
                last = s;
            }

            Console.WriteLine("Yes");

            Console.Out.Flush();
        }
    }
}


Measured memory_bytes: 13280
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
using P = pair<int,int>;
/* ちゃんと考えてわかって実装 */

int main(void){
    int n;
    cin >> n;
    vector<int> A(n+2);
    A[0] = 0;
    for(int i=1; i<=n; i++){
        cin >> A[i];
    }
    A[n+1] = 0;

    int total = 0;
    for(int i=1; i<=n+1; i++){
        total += abs(A[i] - A[i-1]);
    }

    for(int i=1; i<=n; i++){
        int ans = total - abs(A[i+1] - A[i]) - abs(A[i] - A[i-1]);
        ans += abs(A[i+1] - A[i-1]);
        cout << ans << endl;
    }
    return 0;
}

Measured memory_bytes: 3772
s = input()
a = 'abcdefghijklmnopqrstuvwxyz'
hoge_list = list(a)
s_list = list(s)
c = 0
s_s_list = set(s_list)
for hoge in hoge_list:
  if not hoge in s_s_list:
    c += 1
    print(hoge)
    break
if c == 0:
  print('None')

Measured memory_bytes: 3956
//#include <tourist>
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> p;
const int INF = 1e9;
const ll LINF = ll(1e18);
const int MOD = 1000000007;
const int dx[4] = {0, 1, 0, -1}, dy[4] = {-1, 0, 1, 0};
const int Dx[8] = {0, 1, 1, 1, 0, -1, -1, -1}, Dy[8] = {-1, -1, 0, 1, 1, 1, 0, -1};
#define yes cout << "Yes" << endl
#define YES cout << "YES" << endl
#define no cout << "No" << endl
#define NO cout << "NO" << endl
#define rep(i, n) for (int i = 0; i < n; i++)
#define ALL(v) v.begin(), v.end()
#define debug(v)          \
    cout << #v << ":";    \
    for (auto x : v)      \
    {                     \
        cout << x << ' '; \
    }                     \
    cout << endl;
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;
}
//cout<<fixed<<setprecision(15);有効数字15桁
//-std=c++14
//-std=gnu++17
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }
int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    string s;
    cin>>s;
    map<char,int>m;
    int count=0;
    rep(i,s.size()){
        if(s[i]>='a'&&s[i]<='z')count++;
    }
    for(int i=2;i<s.size()-1;i++){
        m[s[i]]++;
    }
    if(s[0]=='A'&&m['C']==1&&count==s.size()-2)cout<<"AC"<<"\n";
    else cout<<"WA"<<"\n";
}


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

#define INF 999999999

int n;
double b, r, v, e, f;
int a[102];
double tim[10002];
double dp[102][102];

void calcTime(){
  tim[0] = 0;
  for(int x = 0; x < 10000; x++){
    double add;
    if(x >= r) add = 1.0 / ((double)v - e * (x - r));
    else       add = 1.0 / ((double)v - f * (r - x));
    tim[x + 1] = tim[x] + add;
  }
}

void solve(){
  calcTime();

  for(int i = 0; i < 102; i++){
    for(int j = 0; j < 102; j++){
      dp[i][j] = INF;
    }
  }

  dp[1][0] = 0;

  for(int i = 1; i < n; i++){
    for(int j = 0; j < i; j++){
      if(dp[i][j] == INF) continue;

      int dist = a[i] - a[j];
      double addTm = tim[dist];

      dp[i + 1][j] = min(dp[i + 1][j], dp[i][j]);
      dp[i + 1][i] = min(dp[i + 1][i], dp[i][j] + addTm + b);
    }
  }

  cout << fixed << setprecision(4) << dp[n][n - 1] - b << endl;
}

int main(){
  while(cin >> n, n){
    a[0] = 0;
    for(int i = 0; i < n; i++){
      cin >> a[i + 1];
    }
    n++;
    cin >> b >> r >> v >> e >> f;
    solve();
  }
}

Measured memory_bytes: 1444
#include<stdio.h>
#include<stdlib.h>

int main(){
	int N,i,t[100001],x[100001],y[100001],ttmp,xtmp,ytmp,frag = 0;
	scanf("%d",&N);
	t[0] = 0;
	x[0] = 0;
	y[0] = 0;
	for(i = 1; i <= N; i++){
		scanf("%d %d %d",&t[i],&x[i],&y[i]);
	}
	for(i = 1; i <= N; i++){
		ttmp = abs(t[i] - t[i - 1]);
		xtmp = abs(x[i] - x[i - 1]);
		ytmp = abs(y[i] - y[i - 1]);
		if((ttmp >= xtmp + ytmp) && ((ttmp - (xtmp + ytmp)) % 2 == 0)){
			continue;
		} else {
			frag++;
			break;
		}
	}
	if(frag == 0){
		printf("Yes");
	} else {
		printf("No");
	}



	return 0;
}

Measured memory_bytes: 2796
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vin=vector<int>;
using vll=vector<long long>;
using vvin=vector<vector<int>>;
using vvll=vector<vector<long long>>;
using vstr=vector<string>;
using vvstr=vector<vector<string>>;
using vch=vector<char>;
using vvch=vector<vector<char>>;
using vbo=vector<bool>;
using vvbo=vector<vector<bool>>;
using vpii=vector<pair<int,int>>;
using pqsin=priority_queue<int,vector<int>,greater<int>>;
#define mp make_pair
#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(v) v.begin(),v.end()
#define decp(n) cout<<fixed<<setprecision((int)n)
const ll inf=1e9+7;
const ll INF=1e18;

int main(){
    int n;ll x;cin>>n>>x;
    vll burger(n+1),patty(n+1);
    burger[0]=1;patty[0]=1;
    rep(i,n){
        burger[i+1]=2*burger[i]+3;
        patty[i+1]=2*patty[i]+1;
    }
    ll sum=0;
    for(int i=n;i>0;i--){
        if(x==burger[i]){
            sum+=patty[i];
            break;
        }
        else if(x>burger[i-1]+2){
            sum+=patty[i-1]+1;
            x-=burger[i-1]+2;
        }
        else if(x==burger[i-1]+2){
            sum+=patty[i-1]+1;
            break;
        }
        else if(x>1)x--;
        else break;
        if(i==1&&x==1)sum++;
    }
    cout<<sum<<endl;
}

Measured memory_bytes: 256
#pragma GCC optimize("Ofast,inline,unroll-loops,fast-math")
#include <cstdio>
#include <cmath>
#include <cstring>
#include <iostream>
#include <sstream>
#include <bitset>
#include <memory>
#include <string>
#include <vector>
#include <queue>
#include <list>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <stack>
#include <deque>
#include <algorithm>
#include <random>
#include <iomanip>
using namespace std;

int main(int argc, char *argv[]) {
	int n;
	cin >> n;
	vector<int> v;
	for (int i = 0; i < 2 * n; i++) {
		int t;
		cin >> t;
		v.push_back(t);
	}
	sort(v.begin(), v.end());
	int res = 0;
	for (int i = 0; i < 2 * n; i += 2) {
		res += v[i];
	}
	cout << res << endl;
}









Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
using namespace std;
int n, a, dp[100000];
int main() {
	scanf("%d",&n);
	fill(dp, dp+n, 1001001001);
	for (int i = 0; i < n; i++) {
		scanf("%d",&a);
		*lower_bound(dp, dp+n, a) = a;
	}
	printf("%d\n", (int)(lower_bound(dp, dp+n, 1001001001)-dp));
}

Measured memory_bytes: 3568
#include <bits/stdc++.h>
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
using namespace std;

int main() {
    int a, b, c;
    cin >> a >> b >> c;
    cout << (b - a == c - b ? "YES" : "NO") << endl;
    return 0;
}


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

keihin = M-1

cards = []

for _ in range(M):
    cards.append(list(map(int,input().split())))
    
ans = 0

sorted_cards = sorted(cards, key=lambda x:x[0],reverse=True)

cnt = 0

while cnt < keihin:
    if sorted_cards[cnt][0] >= N:
        cnt+=1
    else:
        ans += (N-sorted_cards[cnt][0])
        cnt+=1
print(ans)


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

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

typedef int _loop_int;
#define REP(i,n) for(_loop_int i=0;i<(_loop_int)(n);++i)
#define FOR(i,a,b) for(_loop_int i=(_loop_int)(a);i<(_loop_int)(b);++i)
#define FORR(i,a,b) for(_loop_int i=(_loop_int)(b)-1;i>=(_loop_int)(a);--i)

#define DEBUG(x) cout<<#x<<": "<<x<<endl
#define DEBUG_VEC(v) cout<<#v<<":";REP(i,v.size())cout<<" "<<v[i];cout<<endl
#define ALL(a) (a).begin(),(a).end()

#define CHMIN(a,b) a=min((a),(b))
#define CHMAX(a,b) a=max((a),(b))

// mod
const ll MOD = 1000000007ll;
#define FIX(a) ((a)%MOD+MOD)%MOD

// floating
typedef double Real;
const Real EPS = 1e-11;
#define EQ0(x) (abs(x)<EPS)
#define EQ(a,b) (abs(a-b)<EPS)
typedef complex<Real> P;

int n,m;
int x[125252];

int main(){
  scanf("%d%d",&n,&m);
  REP(i,m)scanf("%d",x+i);
  sort(x,x+m);
  if(n>=m){
    puts("0");return 0;
  }
  vi V;
  REP(i,m-1){
    V.push_back(x[i+1]-x[i]);
  }
  sort(ALL(V));
  reverse(ALL(V));
  int ans = 0;
  while(n<m){
    ans += V.back(); V.pop_back();
    n++;
  }
  printf("%d\n",ans);
  return 0;
}


Measured memory_bytes: 1276
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define REP(i,n) for(long long i=0;i<n;++i)
#define REPP(i,m,n) for(long long i=m;i<n;++i)
#define rep(i,n) for(long long i = n-1;i>=0;--i)
#define repp(i,n,m) for(long long i = n-1; i >= m; --i)
#define ALL(N) (N.begin(),N.end())
#define de cout << "line : " << __LINE__ << " debug" << endl;
#define pb push_back
#define pq priority_queue
#define Dcout(N) cout << setprecision(20) << N << endl
constexpr int MOD = 1000000007;
constexpr int INF = 2147483647;
constexpr long long INFF = 9223372036854775807;

signed main() {
    cin.tie(0);
	ios::sync_with_stdio(false);
    int N;cin >> N;
    ll A[N];REP(i,N) cin >> A[i];
    ll left = 2,right = 3;
    if(A[N-1] != 2){
        cout << -1 << endl;
        return 0;
    }
    rep(i,N){
        if(i == N-1) continue;
        if(right / A[i] == 0){
            cout << -1 << endl;
            return 0;
        }
        if(left % A[i] != 0) left = (left/A[i]+1)*A[i];
        right = (right/A[i]+1)*A[i]-1;
        if(left > right){
            cout << -1 << endl;
            return 0;
        }
    }
    cout << left << ' ' << right << endl;
}

Measured memory_bytes: 1024
#include <iostream>
#include <vector>
#include <map>
#include <unordered_map>
#include <queue>
#include <set>
#include <algorithm>
#include <string>
#include <math.h>
#include <limits.h>
#include <stack>
#include <complex>
#include <stdlib.h>
#include <stdio.h>
#include <functional>
#include <cfloat>
#include <math.h>


#define fs first
#define sc second

using namespace std;


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


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

    int t = 1;
    int res = 0;

    while(t < b){
        t += a-1;
        res++;
    }

    cout << res << endl;



    return 0;
}


Measured memory_bytes: 256
using System;

namespace abc172
{
    class Program
    {
        static int[] ReadNumList()
        {
            var line = Console.ReadLine().Split(' ');
            var numList = new int[line.Length];
            for (var i = 0; i < line.Length; ++i)
            {
                numList[i] = int.Parse(line[i]);
            }
            return numList;
        }
        static void Main(string[] args)
        {
            var nmk = ReadNumList();
            var n = nmk[0];
            var m = nmk[1];
            var k = nmk[2];
            var a = ReadNumList();
            var b = ReadNumList();

            var aPos = 0;
            var time = 0;
            while (aPos < a.Length)
            {
                if (time + a[aPos] > k)
                {
                    break;
                }
                time += a[aPos];
                ++aPos;
            }

            var abMax = aPos;
            var bPos = 0;
            while (aPos >= 0)
            {
                while (bPos < b.Length)
                {
                    if (time + b[bPos] > k)
                    {
                        break;
                    }
                    time += b[bPos];
                    ++bPos;
                }
                abMax = Math.Max(abMax, aPos + bPos);
                --aPos;
                if (aPos >= 0)
                {
                    time -= a[aPos];
                }
            }
            Console.WriteLine(abMax);
        }
    }
}


Measured memory_bytes: 67772
#include <stdio.h>

int main(void) {
  int a;
  int b;
  int k;
  int tes = 0;

  scanf("%d[^\n]", &a);
  scanf("%d[^\n]", &b);
  scanf("%d[^\n]", &k);
  
  for(int i = 0; i < k; i++) {
    tes++;
    if(i % 2 == 0) {
      if(a % 2 == 1) {
        a--;
      }
      b = b + a / 2;
      a = a / 2;
    } else {
      if(b % 2 == 1)  {
        b--;
      }
      a = a + b / 2;
      b = b / 2;
    }
  }

  printf("\n%d %d\n", a, b);

  return 0;
}

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

int main(){
    int n;
    cin >> n;
    vector<int> a(n);
    for (int i = 0; i < n; i++){
        cin >> a[i];
    }
    vector<int> c(n);
    for (int i = 0; i < n; i++){
        c[i] = a[i];
    }
    sort(c.begin(),c.end());

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

    
}

Measured memory_bytes: 4792
#include <bits/stdc++.h>
using namespace std;
int main(){
  int a,b,c,d,e,k;
  cin >> a >> b >> c >> d >> e >> k;
  if(b-a<=k&&c-a<=k&&d-a<=k&&e-a<=k&&c-b<=k&&d-b<=k&&e-b<=k&&d-c<=k&&e-c<=k&&e-d<=k){
    cout << "Yay!" << endl;
  }
  else cout << ":(" << endl;
}

Measured memory_bytes: 256
import java.util.Scanner;
public class Main{
	public static void main(String[] args){
		Scanner scan=new Scanner(System.in);
		double x1=scan.nextDouble();
		double y1=scan.nextDouble();
		double x2=scan.nextDouble();
		double y2=scan.nextDouble();
		double d=Math.pow((x1-x2),2)+Math.pow((y1-y2),2);
		System.out.printf("%.8f\n",Math.sqrt(d));
		scan.close();
	}
}

Measured memory_bytes: 19068
import java.io.*;

class Main
{
  public static void main(String args[])
  {
    int num;
    String buf;
    try {
      BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
      buf = br.readLine();
      num = Integer.parseInt(buf);
      System.out.println(num * num * num);
    } catch(Exception e) {}
  }
}

Measured memory_bytes: 24232
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
constexpr int di[] = { 0, 1, 0, -1 }, dj[] = { 1, 0, -1, 0 };
#define rep(i, n) for (int i = 0; i < n; i++)
#define repr(i, n) for (int i = n; i >= 0; i--)
#define sort(v) sort((v).begin(), (v).end())
#define sortr(v) sort((v).rbegin(), (v).rend())
#define all(v) (v).begin(), (v).end()
#define MAX 2000001
#define vmax 10000
constexpr ll inf = 1000000000000;
/*cout<<fixed<<setprecision(20);cin.tie(0);ios::sync_with_stdio(false);*/

vector<int> a(10000000,0);

void diviser(ll n){
    for (int i = 2; i <= n; i++) {
		while (n%i == 0) { 
            a[i]++;
			n/=i;
		}
	}
}

int main() {
    ll n;
    int mod=1e9+7;
    ll cnt=1;
    cin>>n;
    for(int i=2;i<=n;i++){
        diviser(i);
    }
    for(int i=2;i<=n;i++){
        cnt*=(a[i]+1);
        cnt%=mod;
    }
    cout<<cnt<<endl;
    return 0;
}












Measured memory_bytes: 39296
class Hand
  def initialize
    @card = Hash.new
  end
  def add(c, n)
    @card[c] = Array.new(13, 0) unless @card.key?(c)
    @card[c][n] += 1
  end
  def score()
  end
end

def count(card)
  return 0 if card.inject(:+) % 3 != 0
  res = 0
  for i in 1..9 do
    if card[i] > 0 && card[i + 1] > 0 && card[i + 2] > 0
      new = card
      new[i] -= 1
      new[i + 1] -= 1
      new[i + 2] -= 1
      res = [res, 1 + count(new)].max
    end
    if card[i] >= 3
      new = card
      new[i] -= 3
      res = [res, 1 + count(new)].max
    end
  end
  res
end

T = gets.to_i
T.times do
  hand = Hash.new
  n = gets.split.map(&:to_i)
  c = gets.split
  for i in 0...9 do
    hand[c[i]] = Array.new(13, 0) unless hand.key?(c[i])
    hand[c[i]][n[i]] += 1
  end
  total = 0
  hand.each do |color, card|
    total += count(card)
  end
  puts total == 3 ? "1" : "0"
end

Measured memory_bytes: 6124
import sys
from collections import Counter

def comb(n):
    return n * (n - 1) // 2

n, *a = map(int, sys.stdin.read().split())

def main():
    c = Counter(a)
    res = 0
    for v in c.values():
        res += comb(v)

    for i in a:
        yield res - comb(c[i]) + comb(c[i]-1)
        
if __name__ == "__main__":
    ans = main()
    print(*ans, sep='\n')

Measured memory_bytes: 28416
#include "bits/stdc++.h"
using namespace std;
#define Would
#define you
const long long INF = 99999999999999999;
const long long MOD = 1e9 + 7;
const double pi = acos(-1);
const int SIZE = 1 << 17;

int main() {
	int a, b, c, d;
	cin >> a >> b >> c >> d;
	cout << (a - c)*(b - d) << endl;
}

Measured memory_bytes: 764
#include <bits/stdc++.h>
using namespace std;
 
int main(){
  int n;
 
  while( cin >> n ){
    if(n == -1)break;
    vector<int>ve;
    while(1){
      ve.push_back(n%4);
      n/=4;
      if(n == 0)break;
    }
    for(int i = ve.size()-1 ; i >= 0 ; i-- )cout << ve[i];
    cout << endl;
  } 
}

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

int main(){
  int n;
  cin >> n;
  vector<int> boss_num(n-1);
  vector<int> buka_num(n+1); //初期化

  rep(i, n-1) cin >> boss_num.at(i);
  rep(i,n-1){
    buka_num.at(boss_num.at(i))++;
  }

 for (int i = 1; i < n + 1 ; ++i){
   cout << buka_num.at(i) << endl;
 }
  //TLE
  // rep(i, n){
  //   cout << count(all(boss_num), i+1) << endl;
  // }

}

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

#define mp make_pair
#define pb push_back

#define int int64_t
#define ld long double

const int MOD = 1e9+7;
const int N = 1e6+5;

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

    int n;
    cin>>n;
    ld ans=1;
    ans*=2;
    ans*=n;
    ans*=acos(-1);
    cout<<setprecision(17)<<ans;

    return 0;
}

Measured memory_bytes: 3800
use proconio::input;
use std::collections::HashSet;

fn main() {
    input! {
        n: usize,
        k: u64,
        a: [usize; n],
    }
    let (mut route, mut visited) = (vec![0usize], HashSet::new());
    let (head, tail);
    visited.insert(0);
    loop {
        let next = a[*route.last().unwrap()] - 1;
        if visited.contains(&next) {
            head = route.iter().position(|&x| x == next).unwrap();
            tail = route.len() - head;
            break;
        } else {
            route.push(next);
            visited.insert(next);
        }
    }
    println!(
        "{}",
        if k > head as u64 {
            route[head + ((k - head as u64) % tail as u64) as usize] + 1
        } else {
            route[k as usize] + 1
        }
    );
}


Measured memory_bytes: 9408
import java.util.Arrays;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int s[] = new int[n];

		int sum = 0;
		boolean can = true;
		for (int i = 0; i < n; i++) {
			s[i] = sc.nextInt();
			sum += s[i];
			if (s[i] % 10 != 0) can = false;
		}

		Arrays.sort(s);

		for (int i = 0; i < n; i++) {
			if (sum % 10 == 0 && s[i] % 10 != 0) {
				sum -= s[i];
				break;
			}
		}


		if (can) {
			System.out.println(0);
		} else {
			System.out.println(sum);
		}

		sc.close();

	}

}

Measured memory_bytes: 36084
num = int(input())
cards = [int(i) for i in input().split()]

def insertion_sort(num, cards):
	for i in range(num):
		v = cards[i]
		j = i - 1
		while j >= 0 and cards[j] > v:
			cards[j+1] = cards[j]
			j -= 1
		cards[j+1] = v
		output(cards)

def output(cards):
	sorting = [str(i) for i in cards]
	print(" ".join(sorting))

insertion_sort(num, cards)


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

const int N = 1e5 + 10;

int cnt[N], rec[N];

int main(){
	int n, m, x, y, ans;
	scanf("%d %d",&n,&m);
	memset(rec, 0, sizeof(rec));
	rec[1] = 1;
	for (int i = 1; i <= n; i++) cnt[i] = 1;
	for (int i = 1; i <= m; i++){
		scanf("%d %d",&x,&y);
		if (rec[x]) rec[y] = 1;
		cnt[x]--; cnt[y]++;
		if (!cnt[x]) rec[x] = 0;
	}
	ans = 0;
	for (int i = 1; i <= n; i++){
		if (rec[i]) ans++;
	}
	printf("%d\n", ans);
	return 0;
}

Measured memory_bytes: 1024
#include<iostream>
#include<cmath>
#include<map>
#include<deque>
#include<string>
#include<algorithm>
typedef long long ll;

#define all(x) (x).begin(),(x).end()
#define puts(x) cout<< x << endl;
#define rep(i,m,n) for(ll i=m;i<n;i++)
#define fore(i,a) for(auto i:a)

using namespace std;

int gcd(int a,int b){
 if(a<b){
  int temp=a;a=b;b=temp;
 }
 int r=a%b;
 while(r!=0){
  a=b;b=r;r=a%b;
 }
 return b;
}

ll s,t;
int main(){
    cin>>s>>t;
    ll x=s*t/gcd(s,t);
    puts(x);
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i<(n); i++)
#define pb push_back
#define all(v) v.begin(),v.end()
#define fi first
#define se second
#define bigger (char)toupper
#define smaller (char)tolower
using namespace std;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<vi> vii;
typedef vector<string> vs;
typedef vector<char> vc;
typedef long long ll;
typedef unsigned long long ull;

int main() {
    int N,M,C;
    scanf("%d%d%d",&N,&M,&C);
    vi B(M);
    rep(i,M) {
        cin>>B[i];
    }
    vii A(N,vi(M));
    rep(i,N) {
        rep(j,M) {
            cin>>A[i][j];
        }
    }
    int answer=0;
    rep(i,N) {
        int counter=0;
        rep(j,M) {
            counter+=A[i][j]*B[j];
        }
        counter+=C;
        if(counter>0) answer++;
        counter=0;
    }
    printf("%d\n",answer);
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>

using namespace std;
using namespace __gnu_pbds;
 
typedef long long ll;
typedef long double ld;
typedef complex<ld> cd;

typedef pair<int, int> pi;
typedef pair<ll,ll> pl;
typedef pair<ld,ld> pd;

typedef vector<int> vi;
typedef vector<ld> vd;
typedef vector<ll> vl;
typedef vector<pi> vpi;
typedef vector<pl> vpl;
typedef vector<cd> vcd;

template <class T> using Tree = tree<T, null_type, less<T>, rb_tree_tag,tree_order_statistics_node_update>;

#define FOR(i, a, b) for (int i=a; i<(b); i++)
#define F0R(i, a) for (int i=0; i<(a); i++)
#define FORd(i,a,b) for (int i = (b)-1; i >= a; i--)
#define F0Rd(i,a) for (int i = (a)-1; i >= 0; i--)

#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define f first
#define s second
#define lb lower_bound
#define ub upper_bound
#define all(x) x.begin(), x.end()

const int MOD = 1000000007;
const ll INF = 1e18;
const int MX = 100001;

int S;
int ans;

int ad(int a, int b) { return (a+b)%MOD; }
int sub(int a, int b) { return (a-b+MOD)%MOD; }

int getDig(int x) {
    int z = 0;
    while (x) {
        x /= 10;
        z ++;
    }
    return z;
}


ll po (ll b, ll p) { return !p?1:po(b*b%MOD,p/2)*(p&1?b:1)%MOD; }

int z = po(10,7)-po(10,6);

void tri(int x) {
    if (x < 7) return;
    int tot = sub(po(10,x),po(10,x-1));
    int need = S/x;
    // cout << "HI " << x << " " << tot << " " << need << "\n";
    if (x == 7 && need > tot) return;
    ans = ad(ans,ad(sub(tot,need),1));
}

void sing() {
    for (int i = 1; i*i <= S; ++i) if (S % i == 0) {
        tri(i);
        if (i*i != S) tri(S/i);
    }
}

void doub() {
    for (int sum = 2; ;++sum) {
        int x = S/sum;
        if (x < 7) break;
        int b = S-x*sum;
        if (b > 0 && !(x == 7 && sum-b > z)) ans = ad(ans,1);
    }
    // x*a+(x+1)*b = S where a,b > 0 
    // x >= 7
    // b = S - (a+b)*x
}

int main() {
    ios_base::sync_with_stdio(0); cin.tie(0);
    cin >> S;
    int r = 0, sum = 0;
    FOR(l,1,1000000) {
        while (sum < S) sum += getDig(++r);
        if (sum == S) ans = ad(ans,1);
        sum -= getDig(l);
    }
    // cout << ans << "\n";
    sing();
    // cout << ans << "\n";
    doub();
    cout << ans;
}

// read the question correctly (is y a vowel? what are the exact constraints?)
// look out for SPECIAL CASES (n=1?) and overflow (ll vs int?) ARRAY OUT OF BOUNDSS

Measured memory_bytes: 384
#include <cstdio>
#include <cstring>

using namespace std;
const int N = 100010;

int n, q, par[N];
int find(int x)
{
    if(par[x] == x) 
        return x;
    return find(par[x]);
}
int main()
{
    while(~scanf("%d%d", &n, &q))
    {
        if(n==0&&q==0)
            break;
        par[1] = 1;
        for(int i = 2; i <= n; ++i)
         scanf("%d", &par[i]);
        long long ans = 0;
        for(int i = 1; i <= q; ++i)
        {
            char op[2];
            int x;
            scanf("%s%d", op, &x);
            if(op[0] == 'Q')
                ans += find(x);
            else par[x] = x;
        }
        printf("%lld\n", ans);
    }
    return 0;
}

Measured memory_bytes: 2956
n,k=map(int,input().split())
p=list(map(int,input().split()))
s=[0]*(n+1)
for i in range(n):
    x=p[i]
    s[i+1]=(x+1)/2+s[i]
ans=0
for i in range(k,n+1):
    ans=max(ans,s[i]-s[i-k])
print(ans)


Measured memory_bytes: 71792
#include <bits/stdc++.h>
using namespace std;
typedef signed long long ll;

#undef _P
#define _P(...) (void)printf(__VA_ARGS__)
#define FOR(x,to) for(x=0;x<(to);x++)
#define FORR(x,arr) for(auto& x:arr)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define ALL(a) (a.begin()),(a.end())
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
//-------------------------------------------------------

int N;
ll X,A[2020];

void solve() {
	int i,j,k,l,r,x,y; string s;
	
	cin>>N>>X;
	FOR(i,N) cin>>A[i];
	ll mi=1LL<<60;
	FOR(i,2020) {
		ll tot=i*X;
		FOR(x,N) tot+=A[x];
		mi=min(mi,tot);
		y=A[N-1];
		for(x=N-1;x>0;x--) A[x]=min(A[x],A[x-1]);
		A[0]=min(A[0],(ll)y);
	}
	
	cout<<mi<<endl;
	
	
}


int main(int argc,char** argv){
	string s;int i;
	if(argc==1) ios::sync_with_stdio(false), cin.tie(0);
	FOR(i,argc-1) s+=argv[i+1],s+='\n';
	FOR(i,s.size()) ungetc(s[s.size()-1-i],stdin);
	solve(); return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);

        int N = scanner.nextInt();

        int[] X = new int[N + 1];

        int total = 0;
        for (int i = 1 ; i <= N ; i++) {
            X[i] = scanner.nextInt();
            total += X[i];
        }

        int ave = total / N;
        int ave1 = ave + 1;

        int p = 0;
        int p1 = 0;
        for (int i = 1 ; i <= N ; i++) {
            p += (X[i] - ave) * (X[i] - ave);
            p1 += (X[i] - ave1) * (X[i] - ave1);
        }

        System.out.println(Math.min(p, p1));

    }
}


Measured memory_bytes: 35728
s = input().split() 
if len(s) == 4:
    a = int(s[0]) # 1
    b = int(s[1]) # 0
    c = int(s[2]) # -1
    k = int(s[3]) # 枚数

    a_len = a if k > a else k
    b_len = b if (k-a_len) > b else (k-a_len)
    c_len = c if (k-a_len-b_len) > c else (k-a_len-b_len)

    max = 1 * a_len + 0 * b_len + (-1) * c_len

    print(max)


Measured memory_bytes: 9180
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
class Program
{
    static void Main(string[] args)
    {
            // 入力
            string[] sS = System.Console.ReadLine().Trim().Split(' ');
            int iN = int.Parse(sS[0]);
            List<decimal> lstInp = new List<decimal>();
            sS = System.Console.ReadLine().Trim().Split(' ');
            for (int i = 0; i < sS.Length; i++) { lstInp.Add(decimal.Parse(sS[i])); }

            System.Diagnostics.Stopwatch sw = new System.Diagnostics.Stopwatch();
            sw.Start();

            // 解析
            lstInp.Sort();
            decimal iOut = (lstInp[0] + lstInp[1]) / 2M;
            for (int i = 2; i < lstInp.Count; i++)
            {
                iOut =  (iOut + lstInp[i]) / 2M;
            }

            // 出力
            System.Console.WriteLine("{0}", iOut.ToString().Trim());

            sw.Stop();
#if DEBUG
            Console.WriteLine();
            Console.WriteLine("{0}", sw.Elapsed.ToString());
            Console.WriteLine("続行するには何かキーを押してください．．．");
            Console.ReadKey();
#endif
    }

}


Measured memory_bytes: 13396
#include <iostream>
#include <cmath>
#include <string>
#include <cstring>
#include <algorithm>
#include <vector>
#include <queue>
#include <functional>
#include <map>
#include <set>
#include <bitset>
//#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

#define rep(i,a,b) for(ll i=a;i<(ll)(b);i++)
#define rrep(i,a,b) for(ll i=a-1;i>=(ll)(b);i--)

#define ALL(x) (x).begin(),(x).end() //sortなどの引数を省略したい
#define RALL(x) (x).rbegin(),(x).rend() //降順ソート
#define SIZE(x) ((ll)(x).size()) //sizeをsize_tからllに直しておく
#define MAX(x) *max_element(ALL(x)) //最大値を求める
#define MIN(x) *min_element(ALL(x)) //最小値を求める

#define INF 1000000000000 //10^12:極めて大きい値,∞
#define MOD 1000000007 //10^9+7:合同式の法
#define MAXR 100000 //10^5:配列の最大のrange(素数列挙などで使用)

#define PB push_back //vectorヘの挿入
#define MP make_pair //pairのコンストラクタ
#define F first //pairの一つ目の要素
#define S second //pairの二つ目の要素

#define popcount __builtin_popcount
#define LIST(a) memset(a, 0, sizeof(a))

int main(void){
    ll n, W;
    cin >> n >> W;
    ll v[n], w[n], memo[n+1][W+1];
    LIST(v); LIST(w); LIST(memo);

    rep(i, 0, n){
        cin >> w[i] >> v[i];
    }

    rep(i, 1, n+1){
        rep(sumw, 1, W+1){
            if(w[i-1] <= sumw){
                memo[i][sumw] = max(memo[i-1][sumw], memo[i-1][sumw - w[i-1]] + v[i-1]);
            } else {
                memo[i][sumw] = max(memo[i][sumw], memo[i-1][sumw]);
            }
        }
//        cout << "----- ----- ----- ----- -----" << endl;
//        rep(i, 1, n+1){
//            cout << w[i-1]  << ':' << v[i-1] << "| ";
//            rep(j, 0, W+1){
//                cout << memo[i][j] << ' ';
//            }
//            cout << endl;
//        }
    }
    cout << memo[n][W] << endl;

    return 0;
}


Measured memory_bytes: 79104
#include<stdio.h>
int main(void)
{
	int n,pm,pe,pj,i,j,pme,pmej;
	scanf("%d",&n);
	while(n!=0){
		for(i=0;i<n;i++){
				scanf("%d %d %d",&pm,&pe,&pj);
				pme=(pm+pe)/2;
				pmej=(pm+pe+pj)/3;
				if(pm==100 || pe==100 || pj==100){
					printf("A\n");
				}
				else if(pme>=90){
					printf("A\n");
				}
				else if(pmej>=80){
					printf("A\n");
				}
				else if(pmej>=70){
					printf("B\n");
				}
				else if(pmej>=50 && pm>=80 || pe>=80){
					printf("B\n");
				}
				else {
					printf("C\n");
				}
			}
		scanf("%d",&n);
	}
	return 0;
}

Measured memory_bytes: 1012
/******************************************************************************

                              Online C++ Compiler.
               Code, Compile, Run and Debug C++ program online.
Write your code in this editor and press "Run" button to compile and execute it.

*******************************************************************************/

#include <bits/stdc++.h>

using namespace std;

int main()
{
    int n;
    double a[n];
    double ans = 0;
    cin>>n;
    for(int i=0; i<n; i++) {
        cin>>a[i];
    }
    int k=n+1;
    vector<vector<double>> dp(n,vector<double>(k,0.0));
    for(int i=0; i<n; i++) {
        if(i==0) {
            dp[i][0] = 1.0 - a[i];
            dp[i][1] = a[i];
        }
        else {
        for(int j=0; j<=n; j++) {
            if(j==0) {
                dp[i][j] = dp[i-1][j]*(1.0-a[i]);
            } else {
                dp[i][j] = dp[i-1][j]*(1.0-a[i]) + dp[i-1][j-1]*(a[i]);
            }
        }
        }
    }
    /*for(int i=0; i<n; i++) {
    //int i=n-1;
        for(int j=0; j<=n; j++) {
            cout<<dp[i][j]<<" ";
        }
        cout<<endl;
    }*/
    
    //for(int i=0; i<n; i++) {
    int i=n-1;
        for(int j=n/2+1; j<=n; j++) {
            ans+=dp[i][j];
        }
      //  cout<<endl;
    //}
    cout<<setprecision(10)<<ans;
    return 0;
}


Measured memory_bytes: 70656
// luogu-judger-enable-o2
#include <cstdlib>
#include<iostream>
#include<algorithm>
#include<bits/stdc++.h>
#include<cstdio>
#include<cstring>
#include<cmath>
#define ll long long
const ll INF=0x3f3f3f3f;
#define mod 1000000007
#define mem(a,b) memset(a,b,sizeof(a))
#define  INF 0x3f3f3f3f
//__builtin_popcount
using namespace std;
//priority_queue
const ll MAX=100000;
ll gcd(ll a,ll b)
{
    return b==0?a:gcd(b,a%b);
}
ll kc(ll a,ll b)
{
    ll c=1;
    while(b)
    {
        if(b&1)c=(c*a)%mod;
        a=(a*a)%mod;
        b>>=1;
    }
    return c;
}

ll F[100003];
ll Find(ll a)
{
    return F[a]<0?a:F[a]=Find(F[a]);
}
ll same(ll a,ll b)
{
    if(Find(a)==Find(b))return 1;
    return 0;
}
void up(ll a,ll b)
{
    ll x,y;
    x=Find(a);
    y=Find(b);//cout<<F[x]<<" "<<F[y]<<endl;
    if(x!=y)
        F[y]+=F[x],F[x]=y;


}
int main()
{
  int a,b;
  cin>>a>>b;
  cout<<(a)/(1+2*b)+(a%(1+2*b)?1:0);
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int A, B, C;
  cin >> A >> B >> C;
  int ans =0;
  if(B/A >= C) {
    ans =C;
  }
  else {
    ans = B/A;
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std::literals::string_literals;
using i64 = std::int_fast64_t;
using std::cout;
using std::cerr;
using std::endl;
using std::cin;

template<typename T>
std::vector<T> make_v(size_t a){return std::vector<T>(a);}

template<typename T,typename... Ts>
auto make_v(size_t a,Ts... ts){
  return std::vector<decltype(make_v<T>(ts...))>(a,make_v<T>(ts...));
}

int main() {
	int n, k; scanf("%d%d", &n, &k); std::vector<int> a(n);
	for(auto& v: a) scanf("%d", &v);

	int ok = 1 << 30, ng = 0;
	while(std::abs(ok - ng) > 1) {
		int mid = (ok + ng) >> 1;

		int cnt = 0;
		for(auto v: a) cnt += (v + mid - 1) / mid - 1;
		
		if(cnt <= k) ok = mid;
		else ng = mid;
	}

	printf("%d\n", ok);
	return 0;
}


Measured memory_bytes: 4036
#include<bits/stdc++.h>
#include<string.h>
using namespace std;
int main()
{
    string st;
    cin>>st;
    int i,l=st.size();
    char ch=st[l-1];
    if(ch=='s')
    {
        for(i=0;i<l;i++)
        {
            cout<<st[i];
        }
        cout<<'e'<<'s'<<endl;
    }
    else
    {
        for(i=0;i<l;i++)
        {
            cout<<st[i];
        }
        cout<<'s'<<endl;
    }
}


Measured memory_bytes: 3596
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <string>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <iomanip>
#include <utility>
#include <tuple>
#include <functional>
#include <bitset>
#include <cassert>
#define int long long
#define INF 1000000009
#define LINF 1000000000000000009
#define EPS 1e-10
#define PI 3.141592653589793238
#define all(a) a.begin(),a.end()
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
typedef pair<ll, P> PP;
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 (a > b) { a = b; return 1; } return 0; }
ll gcd(ll n, ll m) { return (m ? gcd(m, n%m) : n); }
ll lcm(ll n, ll m) { return n / gcd(n, m)*m; }

signed main() {
	int n, a, b;
	cin >> n >> a >> b;
	if (a + b > n + 1 || a * b < n) {
		cout << -1 << endl;
		return 0;
	}
	if (b == 1) {
		for (int i = 1; i <= n; i++) cout << i << ' ';
		cout << endl;
		return 0;
	}
	vector<int> ans;
	for (int i = n + 1 - a; i <= n; i++) ans.push_back(i);
	int base = (n - a) / (b - 1);
	int over = n - a - base * (b - 1);
	int c = ans[0] - base;
	if (over != 0) c--;
	for (int i = 0; i < over; i++) {
		for (int j = 0; j <= base; j++) {
			ans.push_back(c);
			c++;
		}
		c -= 2 * base + 2;
	}
	if (over != 0) c++;
	for (int i = over; i < b - 1; i++) {
		for (int j = 0; j < base; j++) {
			ans.push_back(c);
			c++;
		}
		c -= 2 * base;
	}
	//cout << base << ' ' << over << endl;
	for (int i : ans) cout << i << ' ';
	cout << endl;
}

Measured memory_bytes: 6384
#include <iostream>
#include <cmath>
#include <stdio.h>
#include <algorithm>
#include <string>
#include <vector>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <cstring>

using namespace std;

#define f first
#define s second
#define pb push_back
#define mp make_pair
#define ll long long
#define pii pair < int, int >
#define pll pair < long long, long long>
#define ull unsigned long long
#define vi vector < int >
#define vll vector < long long >
#define sz(a) (int)a.size()
#define forit(it, s) for(__typeof(s.begin()) it = s.begin(); it != s.end(); it++)
#define all(a) a.begin(), a.end()
#define sqr(x) ((x) * (x))
#define fname "searching"

const int inf = (int)1e9;
const ll INF = (ll)1e18;
const double eps = 1e-9;
const double pi = acos(-1.0);
const int mod = (int)1e9 + 7;

int main(){
	ios_base::sync_with_stdio(0);
    cin.tie(0);
	// freopen("in", "r", stdin);
    // freopen("out", "w", stdout);
    int a, b, h;
    cin >> a >> b >> h;
    cout << (a + b) * h / 2;
	return 0;
}


Measured memory_bytes: 256
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        // Your code here!
        Scanner sc = new Scanner(System.in);
        
        int N = sc.nextInt();
        int X = sc.nextInt();
        
        int D = 0;
        int cnt = 1;
        for(int i=0; i<N; i++){
            D += sc.nextInt();
            if(D > X)   break;
            cnt++;
        }
        
        System.out.println(cnt);
    }
}


Measured memory_bytes: 23764
in_n = gets.chomp.split(" ").map(&:to_i)
in_s = gets.chomp
in_l = Array.new
arr_t = Array.new(in_n[0] + 1, 0)
# puts in_s

in_n[1].times do |i|
  in_l[i] = gets.chomp.split(" ").map(&:to_i)
end

in_n[0].times do |i|
  arr_t[i + 1] = arr_t[i] + ((in_s[i , 2] == "AC") ? 1 : 0)
  # puts i
  # puts in_s[i , 2]
  # puts arr_t[i + 1]
end

in_n[1].times do |i|
  # str = in_s[(in_l[i][0] - 1)..(in_l[i][1] - 1)]
  # puts i
  # puts in_l[i][0]
  # puts in_l[i][1]
  # puts str
  # puts str.scan("AC").length
  puts (arr_t[in_l[i][1] - 1] - arr_t[in_l[i][0] - 1])
end


Measured memory_bytes: 11004
#include <bits/stdc++.h>
using namespace std;
int main(){
	ios::sync_with_stdio(0);
    cin.tie(0);
    long count = 0;
    string a;
    string b;
    cin >> a >> b ;
    for(int i = 0 ; i < a.size(); i++){
        if(a[i] == b[i]) count++;
    }
    cout << count; 
    return 0;
}


Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main(){
	string s, p;
	getline(cin, s);
	getline(cin, p);

	int ssize, psize, si = 0, pi = 0;
	ssize = static_cast<int>(s.size());
	psize = static_cast<int>(p.size());
	while(si < ssize + psize){
		int i = si < ssize ? si : si - ssize;
		if(s[i] == p[pi]){
			if(pi == psize-1){
				cout << "Yes" << endl;
				return 0;
			}
			pi++;
		}else{
			si -= pi;
			pi = 0;
		}
		si++;
	}

	cout << "No" << endl;

	return 0;
}

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

#define int long long

#define ii pair<int,int>
#define fi first
#define sc second
#define lwb lower_bound
#define upb upper_bound
#define all(x) (x).begin(),(x).end()

signed main() {
#ifdef _DEBUG
  freopen("in", "r", stdin);
#endif
  ios::sync_with_stdio(0); cin.tie(0);
  int n; cin >> n;
  string s; cin >> s;
  vector<int> r(n), g(n), b(n);
  for (int i = 0; i < n; i++) {
    if (i != 0) {
      r[i] = r[i - 1];
      g[i] = g[i - 1];
      b[i] = b[i - 1];
    }
    if (s[i] == 'R') r[i]++;
    if (s[i] == 'G') g[i]++;
    if (s[i] == 'B') b[i]++;
  }
  int ans = 0;
  for (int i = 1; i < n - 1; i++)
  for (int j = i + 1; j < n; j++) {
    if (s[i] != s[j]) {
      if (s[i] != 'R' && s[j] != 'R') ans += r[i - 1];
      if (s[i] != 'G' && s[j] != 'G') ans += g[i - 1];
      if (s[i] != 'B' && s[j] != 'B') ans += b[i - 1];
      if (i >= j - i && s[i - j + i] != s[i] && s[i - j + i] != s[j]) ans--;
    }
  }
  cout << ans << '\n';
}


Measured memory_bytes: 3688
#include<stdio.h>

int main(void)
{
  long long int a,b,x,ans=0,min,max,range=0;
  scanf("%lld %lld %lld",&a,&b,&x);
  if(a%x == 0)
    {
      min = a;
    }
  else
    {
      min = ((a/x)+1)*x;
    }
  if(b%x == 0)
    {
      max = b;
    }
  else
    {
      max = b - (b%x);
    }
  range = max - min;
  if(range < 0)
    {
      printf("0\n");
      return 0;
    }
  ans = 1 + (range/x);
  printf("%lld\n",ans);
  return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

		int a = sc.nextInt();
		int b = sc.nextInt();

		String ans;
		if (a % 2 != b % 2)
			ans = "IMPOSSIBLE";
		else
			ans = Integer.toString((a + b) / 2);

		System.out.println(ans);

		sc.close();
	}

}


Measured memory_bytes: 23636