akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define endl '\n'
#define int long long
#define lint long long
#define pii pair<int,int>
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(),(v).end()
#define SZ(v) ((int)v.size())
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
#define MINF(a) memset(a,0x3f,sizeof(a))
#define POW(n) (1LL<<(n))
#define POPCNT(n) (__builtin_popcount(n))
#define IN(i,a,b) (a <= i && i <= b)
using namespace std;
template <typename T> inline bool CHMIN(T& a,T b) { if(a>b) { a=b; return 1; } return 0; }
template <typename T> inline bool CHMAX(T& a,T b) { if(a<b) { a=b; return 1; } return 0; }
template <typename T> inline void SORT(T& a) { sort(ALL(a)); }
template <typename T> inline void REV(T& a) { reverse(ALL(a)); }
template <typename T> inline void UNI(T& a) { sort(ALL(a)); a.erase(unique(ALL(a)),a.end()); }
template <typename T> inline T LB(vector<T>& v, T a) { return *lower_bound(ALL(v),a); }
template <typename T> inline int LBP(vector<T>& v, T a) { return lower_bound(ALL(v),a) - v.begin(); }
template <typename T> inline T UB(vector<T>& v, T a) { return *upper_bound(ALL(v),a); }
template <typename T> inline int UBP(vector<T>& v, T a) { return upper_bound(ALL(v),a) - v.begin(); }
template <typename T1, typename T2> ostream& operator<< (ostream& os, const pair<T1,T2>& p) { os << p.first << " " << p.second; return os; }
template <typename T1, typename T2> istream& operator>> (istream& is, pair<T1,T2>& p) { is >> p.first >> p.second; return is; }
template <typename T> ostream& operator<< (ostream& os, const vector<T>& v) { REP(i,v.size()) { if (i) os << " "; os << v[i]; } return os; }
template <typename T> istream& operator>> (istream& is, vector<T>& v) { for(T& in : v) is >> in; return is; }
template <typename T = int> vector<T> make_v(size_t a) { return vector<T>(a); }
template <typename T, typename... Ts> auto make_v(size_t a, Ts... ts) { return vector<decltype(make_v<T>(ts...))>(a,make_v<T>(ts...)); }
template <typename T, typename V> typename enable_if<is_class<T>::value == 0>::type fill_v(T &t, const V &v) { t = v; }
template <typename T, typename V> typename enable_if<is_class<T>::value != 0>::type fill_v(T &t, const V &v) { for(auto &e : t) fill_v(e,v); }
const lint MOD = 1000000007;
const lint INF = 0x3f3f3f3f3f3f3f3f;
const double EPS = 1e-10;

int A, B, C;

void _main() {
    cin >> A >> B >> C;
    if (A > B) swap(A, B);
    cout << (A < C && C < B ? "Yes" : "No") << endl;
}

signed main(signed argc, char **argv) {
    if (argc > 1) {
        if (strchr(argv[1], 'i'))
            freopen("input.txt", "r", stdin);
        if (strchr(argv[1], 'o'))
            freopen("output.txt", "w", stdout);
    }
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(10);
    _main();
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, a, n) for(int i = a; i < n; i++)
#define int long long
using namespace std;
typedef pair<int, int> P;
const int mod = 1000000007;
const int INF = 1e18;

struct CumulativeSum{
    vector<int> data;
    CumulativeSum(int sz) : data(sz, 0) {};
    void add(int k, int x){
        data[k] += x;
    }
    void build(){
        for(int i = 1; i < data.size(); i++){
            data[i] += data[i - 1];
        }
    }
    int query(int k){
        if(k < 0) return 0;
        return (data[min(k, (int)data.size() - 1)]);
    }
    int query(int l, int r){
        return query(r - 1) - query(l - 1);
    }
};

signed main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    vector<int> a(n);
    CumulativeSum cs(n);
    rep(i, 0, n){
        cin >> a[i];
        cs.add(i, a[i]);
    }
    cs.build();
    int ans = INF;
    rep(i, 0, n - 1){
        int l = cs.query(0, i + 1);
        int r = cs.query(i + 1, n);
        ans = min(ans, abs(l - r));
    }
    cout << ans << endl;
}

Measured memory_bytes: 3456
using System;

public class Test
{

	public static void Main()
	{
		string line = Console.ReadLine();
		string[] buffer = line.Split(' ');
		int a = int.Parse(buffer[0]);
		int b = int.Parse(buffer[1]);
		
		if(a%3==0||b%3==0||(a+b)%3==0){
			Console.WriteLine("Possible");
		} else {
			Console.WriteLine("Impossible");
		}
	}
}	

Measured memory_bytes: 11092
import heapq

N,K=map(int,input().split())
hlist=list(map(int,input().split()))

hq=[]
for h in hlist:
  heapq.heappush(hq,-h)
  
for i in range(K):
  hmax=heapq.heappop(hq)
  heapq.heappush(hq,0)
  
print(-sum(hq))

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

using namespace std;

using ll = long long;

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int H, W, K;
    cin >> H >> W >> K;
    vector<string> s(H);
    vector< vector<int> > cnt(H + 1, vector<int>(W, 0));
    for (int i = 0; i < H; ++i) {
        cin >> s[i];
        for (int j = 0; j < W; ++j) {
            cnt[i + 1][j] = cnt[i][j] + (s[i][j] - '0');
        }
    }

    int ans = 1e9;
    for (int i = (1 << (H - 1)); i < (1 << H); ++i) {
        vector<int> v = {0, 0};
        int res = -1;
        for (int j = 0; j < H; ++j) {
            ++v.back();
            if (i >> j & 1) {
                int tmp = v.back();
                v.push_back(tmp);
                ++res;
            }
        }
        v.pop_back();

        int sz = (int)v.size() - 1;
        vector<int> curs(sz, 0);

        for (int k = 0; k < W; ++k) {
            bool f = false;
            for (int j = 0; j < sz; ++j) {
                int L = v[j], R = v[j + 1];
                int x = cnt[R][k] - cnt[L][k];

                if (curs[j] + x > K) {
                    f = true;
                    break;
                }
            }

            if (f) ++res;

            for (int j = 0; j < sz; ++j) {
                int L = v[j], R = v[j + 1];
                int x = cnt[R][k] - cnt[L][k];

                if (f) {
                    curs[j] = x;
                    if (x > K) {
                        res = 1e9;
                        break;
                    }
                } else {
                    curs[j] += x;
                }
            }        

            if (res >= 1e9) break;
        }
        ans = min(ans, res);
    }
    cout << ans << "\n";
    return 0;
}

Measured memory_bytes: 384
import java.util.Scanner;
public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int x = sc.nextInt();
		boolean judge = true;

		while(judge ) {
			judge = false;
			for(int i = 2; i < x; i++) {
				if(x%i==0) {
					judge = true;
					x++;
					break;
				}
			}
		}
		System.out.println(x);
	}

}

Measured memory_bytes: 21716
#include <stdlib.h>
#include <iostream>
#include <iomanip>
#include <string>
#include <limits.h>
#include <math.h>
#include <vector>
#include <algorithm>
#include <map>
#include <numeric>
#include <cstdlib>
#include <functional>

using namespace std;

int main(int argc, char* argv[]){
	int N, K, sum=0, x;
	cin >> N >> K;
	for (int i=0; i<N; i++){
		cin >> x;
		sum += 2 * (min(x, abs(x-K)));
	}
	cout << sum << endl;

    return 0;
}


Measured memory_bytes: 256
import numpy as np
import sys
readlines = sys.stdin.readlines()

N, M, Q = map(int, readlines[0].split())
city = np.zeros((N + 2, N + 1), dtype=int)
L, R = np.array([i.split() for i in readlines[1:M + 1]], dtype=int).T
pq = [map(int, i.split()) for i in readlines[M + 1:]]

np.add.at(city, (L, R), 1)
np.cumsum(city, axis=0, out=city)
np.cumsum(city, axis=1, out=city)

for p, q in pq:
    print(city[q][q] - city[q][p - 1] - city[p - 1][q] + city[p - 1][p - 1])

Measured memory_bytes: 99788
/*
Author- Aasav Badera
Time- Sun Sep 13 17:18:29 2020
*/
#include<bits/stdc++.h> 
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp> 
using namespace std;
using namespace __gnu_pbds;
#ifdef LOCAL  
#include <sys/resource.h>
#define meminc             rlimit rlim;if (getrlimit(RLIMIT_STACK, &rlim)) return 1;rlim.rlim_cur = 268435456;if (setrlimit(RLIMIT_STACK, &rlim)) return 2;
#else
#define meminc      
#endif
#ifdef LOCAL
#define dbg(args...)       { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }
#else
#define dbg(args...)
#endif
struct custom_hash {
    static uint64_t splitmix64(uint64_t x) {
        // http://xorshift.di.unimi.it/splitmix64.c
        x += 0x9e3779b97f4a7c15;
        x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
        x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
        return x ^ (x >> 31);
    }

    size_t operator()(uint64_t x) const {
        static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
        return splitmix64(x + FIXED_RANDOM);
    }
};
void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
    cerr << *it << " = " << a << endl;
    err(++it, args...);
}
#define ll                 int
#define vi                 vector<int >
#define ordered_set        tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
// -------------------Standard Traversal Moves---------------------
// vi fx = {1 ,-1 ,0, 0}, fy = {0, 0, -1, 1};
// vi fx = {2, -2, 2, -2,  1, -1, 1, -1}, fy = {1, 1, -1, -1, 2, 2, -2, -2};
// vi fx = {1, 1, 1, -1, -1 , -1, 0, 0}, fy = {1, -1, 0, 1, -1, 0, 1, -1};
// ----------------------------------------------------------------

#define rep(i, a, b)       for(int  i=a;i<b;i++)
#define all(a)             (a).begin(),(a).end()
#define sz(x)              (int )x.size()
#define yes                cout << "YES" << endl
#define no                 cout << "NO" << endl
#define endl               '\n' 
// const int hell = (int)998244353;
const int hell = (int)1e9 + 7;
const long long int inf = 3223372036854775807;
const double PI = 3.14159265;
const int N = (int) 1e6 + 5;


int32_t main()
{
    meminc;
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cerr.precision(10);
    cout.precision(25);
    cout << fixed;
    #ifdef LOCAL
    // for getting input from input.txt
    freopen("input.txt", "r", stdin);
    // for writing output to output.txt
    freopen("output.txt", "w", stdout);
    #endif
    int tests = 1;
    // cin >> tests;
    rep(test, 1, tests+1)
    {
    	long long int a, b, c, d;
    	cin >> a >> b >> c >> d;
    	long long int ret = b * d;
    	ret = max(ret, a * c);
    	ret = max(ret, a * d);
    	ret = max(ret, b * c);
    	cout << ret;
    }
    #ifdef LOCAL
        // cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";
    #endif
    return 0;
}

Measured memory_bytes: 3648
#include <iostream>

using namespace std;

int main() {
  int n, b, f, r, v;
  int as[4][3][10] = {{{}}};
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> b >> f >> r >> v;
    as[b - 1][f - 1][r - 1] += v;
  }

  for (int i = 0; i < 4; i++) {
    if (i != 0) {
      cout << "####################" << endl;
    }
    for (int j = 0; j < 3; j++) {
      for (int k = 0; k < 10; k++) {
        cout << " " << as[i][j][k];
      }
      cout << endl;
    }
  }
}


Measured memory_bytes: 3080
#include<iostream>
#include<vector>
#include<string>
#include<math.h>
#include<stdio.h>
#include<queue>
#include<map>
#include<stack>
using namespace std;
int dx[] = { -1,0,0,1,-1,-1,1,1,0 };
int dy[] = { 0,1,-1,0,1,-1,1,-1,0 };
/*
int main()
{
int r, c;
cin >> r >> c;
int sy, sx, gy, gx;
vector<vector<char>>field(r,vector<char>(c));
sy--, sx--, gy--, gx--;
for (int i = 0; i < r; i++)
{
for (int j = 0; j < c; j++)
{
cin >> field[i][j];
}
}
queue<pair<int,int>>q;
q.push({ sx,sy });
vector<vector<int>>d(c, vector<int> (r, -1));
d[sx][sy] = 0;

while (!q.empty())
{
pair<int, int>p = q.front;
q.pop();
for (int i = 0; i < 4; i++)
{
int nx = p.first + dx[i], ny = p.second + dy[i];
if (nx < 0 || ny < 0 || nx >= c || ny >= r || d[nx][ny] != -1 || field[nx][ny] == '#')continue;
q.push({ nx,ny });
d[nx][ny] = d[p.first][p.second] + 1;
}
}

cout << d[gx][gy] << endl;
}*/


int main()
{
	int n;
	cin >> n;
	vector<int>d(n);
	for (int i = 0; i < n; i++)
	{
		cin >> d[i];
	}

	int ans = 0;

	sort(d.begin(), d.end());

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

		for (int j = 0; j < n; j++)
		{
			if (d[j] >= i)
			{
				r += 1;
			}
			else if (d[j] < i)
			{
				b += 1;
			}

			
		}

		if (r == b)
		{
			ans += 1;
		}

	}

	cout << ans << endl;

}



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

int n;
int main(){
	scanf("%d",&n);
	int cnt=0;
	for(int i=0;i<n;i++){
		int t;
		scanf("%d",&t);
		if(t&1)cnt++;
	}
	printf(cnt&1?"NO\n":"YES\n");
	return 0;
}


Measured memory_bytes: 384
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<cstring>
#include<string>
#include<stack>
#include<queue>
#include<set>
#include<map>
#include<time.h>
#include<vector>
using namespace std;
#define ll long long

ll t1,t2,t3,t4;

int main()
{
    //ios::sync_with_stdio(false);
    //cin.tie(0);
    //cout.tie(0);
    ll a,b,c,d;
    cin>>a>>b>>c>>d;

    t1 = a*c;
    t2 = a*d;
    t3 = b*c;
    t4 = b*d;
    //cout<<t1;
    //cout<<t1<<' '<<t2<<' '<<t3<<' '<<t4<<endl;
    ll t;

    if(t1<t2){
        t = t2;
    }
    else t = t1;

    if(t<t3)
        t = t3;

    if(t<t4)
        t = t4;

    cout<<t<<endl;
    return 0;
}



Measured memory_bytes: 3612
#include <bits/stdc++.h>
using namespace std;
#define int long long
typedef pair<int,int> P;
int INF = 1e16+7;
int mod = 1e9+7;
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
signed main() {
    int N;
    cin >> N;
    vector<int>A(N);
    for(int i = 0; i < N; i++) {
        cin >> A[i];
    }
    int ans = 0;
    int now = 0;
    for(int i = N-1; i >= 1; i--) {
        if(A[i] > A[i-1]+1) {
            cout << -1 << endl;
            return 0;
        }
        if(now != A[i]) {
            ans += A[i];
            if(i < A[i]) {
                cout << -1 << endl;
                return 0;
            }
            now = A[i]-1;
        }
        else {
            now--;
        }
    }
    if(A[0] != 0) {
        cout << -1 << endl;
        return 0;
    }
    cout << ans << endl;
}

Measured memory_bytes: 4824
import java.io.IOException;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) throws IOException {
		Scanner sc = new Scanner(System.in);
		int W = sc.nextInt();
		int a = sc.nextInt();
		int b = sc.nextInt();

		int answer = 0;
		sc.close();
		if( a == b ){
			System.out.println(0);
		} else {
			if( a < b ){
				answer = b - a - W;
			} else {
				answer = a - b - W;
			}

			if( answer < 0 ){
				System.out.println(0);
			} else {
				System.out.println( answer );
			}
		}

	}

}

Measured memory_bytes: 22100
#include <bits/stdc++.h>
using namespace std;
#define MAX 1400

struct Rectangle{
    int height;
    int pos;
};

int getLargestRectangle(int size,int buf[]){
    stack<Rectangle> s;
    int maxV = 0;
    buf[size] = 0;
    
    for(int i = 0;i <= size;++i){
        Rectangle rect;
        rect.height = buf[i];
        rect.pos = i;
        if(s.empty()){
            s.push(rect);
        }
        else{
            if(s.top().height < rect.height){
                s.push(rect);
            }
            else if(s.top().height > rect.height){
                int target = i;
                while(!s.empty() && s.top().height >= rect.height){
                    Rectangle pre = s.top();
                    s.pop();
                    int area = pre.height * (i - pre.pos);
                    maxV = max(maxV,area);
                    target = pre.pos;
                }
                rect.pos = target;
                s.push(rect);
            }
        }
    }
    return maxV;
}

int H,W;
int buf[MAX][MAX];
int T[MAX][MAX];

int getLargestRectangle(){
    for(int j = 0;j < W;++j){
        for(int i = 0;i < H;++i){
            if(buf[i][j]){
                T[i][j] = 0;
            }
            else{
                T[i][j] = (i > 0) ? T[i - 1][j] + 1 : 1;    
            }
        }
    }
    int maxV = 0;
    for(int i = 0;i < H;++i){
        maxV = max(maxV,getLargestRectangle(W,T[i]));
    }
    return maxV;
}

int main(){
    scanf("%d %d",&H,&W);
    for(int i = 0;i < H;++i){
        for(int j = 0;j < W;++j){
            scanf("%d",&buf[i][j]);
        }
    }
    printf("%d\n",getLargestRectangle());
}


Measured memory_bytes: 18528
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define sc(x) scanf("%lld",&(x));
#define pb push_back
#define fi first
#define se second
#define P pair<int,int>
#define endl '\n'
int _,t,a,b,n,m,k,x;

int A[500005];
const double EPS = 1e-8;
int y;
signed main()
{
  cin>>x>>y;
  for(int i=1;i<=10000;i++){
       if(((int)(i*0.08+EPS)==x)&&(int)(i*0.1+EPS)==y){
           cout<<i<<'\n';
           return 0;
       }
  }
  cout<<-1<<'\n';
}


Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <algorithm>
#include <cstdio>
#include <utility>
#include <string>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <deque>
#include <numeric>

using namespace std;

typedef uint64_t u64;
typedef int64_t s64;
typedef uint32_t u32;
typedef int32_t s32;
typedef vector<s32> vs32;
typedef vector<u32> vu32;
typedef vector<s64> vs64;
typedef vector<u64> vu64;

const double PI=3.14159265358979323846;

#define MAX(x, y) ((x) < (y) ? (y) : (x))
#define MIN(x, y) ((x) > (y) ? (y) : (x))

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

#define CEIL(x, y) (((x) + (y) - 1) / (y))
#define MOD 1000000007ULL

#define IN(l, r, x) ((l) <= (x) && (x) < (r))


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

    int n;
    cin >> n;

    vector< string > vs(n);
    rep (i, n) cin >> vs[i];

    int ans = 0;
    int a, b, c;
    a = b = c = 0;

    rep (i, n)
    {
        if (vs[i][0] == 'B' && vs[i][vs[i].size() - 1] == 'A') ++c;
        else if (vs[i][0] == 'B') ++b;
        else if (vs[i][vs[i].size() - 1] == 'A') ++a;

        rep (j, vs[i].size() - 1)
        {
            if (vs[i].substr(j, 2) == "AB") ++ans;
        }
    }

    if (a == 0 && b == 0) ans += MAX(0, c - 1);
    else if (a == 0 || b == 0) ans += c;
    else ans += MAX(0, MIN(a - 1, b - 1)) + c + 1;

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



Measured memory_bytes: 768
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define ld long double
#define ull unsigned long long
#define fastio ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define mp make_pair
#define pb push_back
#define all(v) v.begin(), v.end()
#define ub upper_bound
#define lb lower_bound
#define F first
#define S second

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

    if(k <= a) cout << k << endl;
    else if(k <= a+b) cout << a << endl;
    else cout << a-(k-a-b) << endl;

    return 0;
}   

Measured memory_bytes: 3668
H, W = map(int, input().split())
h, w = map(int, input().split())

all_cells = (H * W)
checked_as_row = (W * h)
checked_as_col = (H * w)
duplicated_check = (h * w)

# 全マス - 埋めた行 - 埋めた列 + 重複して埋めたマス
rest_cells = all_cells - checked_as_row - checked_as_col + duplicated_check

print(rest_cells)


Measured memory_bytes: 2940
N = int(input())
H = list(map(int, input().split()))
H.reverse()
check = True
for i in range(N-1):
    d = H[i+1] - H[i]
    if d >= 2:
        print('No')
        check = False
        break
    elif d == 1:
        H[i+1] = H[i+1] - 1
if check : print('Yes')


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

int main(){
  int N, K;
  cin>> N>> K;
  int ans =1;
  
  for(int i =0;i<N;i++){
  
  if(ans<=K){
    ans*=2;
  }
    else{
      ans+=K;
    }
 }
  cout<< ans;
}


Measured memory_bytes: 3548
#![allow(unused_imports)]

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

macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

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

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

macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

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

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

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

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

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

use std::cmp::{min, max};
use std::collections::{HashMap, HashSet, VecDeque, BinaryHeap};

fn main() {
    input!{
        n: usize,
        v: [usize; n]
    }
    if v.iter().any(|&x| x == 0) {
        println!("0");
        return;
    }
    let mut ans: usize = 1;
    for &x in &v {
        let res = ans.overflowing_mul(x);
        if res.1 {
            println!("-1");
            return;
        } else {
            ans = res.0;
        }
    }
    if ans > 1_000_000_000_000_000_000 {
        println!("-1");
    } else {
        println!("{}", ans);
    }
}


Measured memory_bytes: 2792
import * as fs from 'fs'
const reader = (s: string) => parseInt(s, 10)

function Main(input: string) {
  const N = reader(input)

  console.log(N % 2 === 0 ? 0.5 : 1 - (N - 1) / 2 / N)
}

Main(fs.readFileSync('/dev/stdin', 'utf8'))



Measured memory_bytes: 7372
package main

import (
	"bufio"
	"fmt"
	"math"
	"os"
	"strconv"
	"strings"
	"unsafe"
)

func main() {
	AB := sc.nextInts()
	A := AB[0]
	B := AB[1]

	if (A+B)%2 == 0 {
		fmt.Println((A + B) / 2)
		return
	}
	fmt.Println("IMPOSSIBLE")
}

var (
	sc scanner
)

func init() {
	sc = scanner{
		buf: make([]string, 0, 0),
		cur: 0,
		r:   bufio.NewReader(os.Stdin),
	}
}

type scanner struct {
	buf []string
	cur int
	r   *bufio.Reader
}

func (s *scanner) readln() {
	rbuf := make([]byte, 0, 0)
	for {
		line, prefix, err := s.r.ReadLine()
		if err != nil {
			panic(err)
		}
		rbuf = append(rbuf, line...)
		if prefix == false {
			break
		}
	}
	s.cur = 0
	s.buf = strings.Split(*(*string)(unsafe.Pointer(&rbuf)), " ")
}
func (s *scanner) isFull() bool {
	if s.cur == len(s.buf) {
		return true
	}
	return false
}
func (s *scanner) resetCur() {
	s.cur = 0
}
func (s *scanner) next() string {
	if s.cur == 0 {
		s.readln()
	}
	res := s.buf[s.cur]
	s.cur++
	if s.isFull() {
		s.resetCur()
	}
	return res
}
func (s *scanner) nexts() []string {
	s.readln()
	s.resetCur()
	return s.buf
}
func (s *scanner) nextInt() int {
	if s.cur == 0 {
		s.readln()
	}
	res, _ := strconv.Atoi(s.buf[s.cur])
	s.cur++
	if s.isFull() {
		s.resetCur()
	}
	return res
}
func (s *scanner) nextInts() []int {
	s.readln()
	res := make([]int, len(s.buf))
	for i := range s.buf {
		res[i], _ = strconv.Atoi(s.buf[i])
	}
	s.resetCur()
	return res
}
func (s *scanner) nextFloat() float64 {
	if s.cur == 0 {
		s.readln()
	}
	res, _ := strconv.ParseFloat(s.buf[s.cur],
		64)
	s.cur++
	if s.isFull() {
		s.resetCur()
	}
	return res
}
func (s *scanner) nextFloats() []float64 {
	s.readln()
	res := make([]float64, len(s.buf))
	for i := range s.buf {
		res[i], _ = strconv.ParseFloat(s.buf[i],
			64)
	}
	s.resetCur()
	return res
}
func digits(x int) int {
	return len(strconv.Itoa(x))
}
func powInt(x, p int) (result int) {
	result = 1
	for i := 0; i < p; i++ {
		result *= x
	}
	return
}
func max(x, y int) int {
	return int(math.Max(float64(x), float64(y)))
}
func min(x, y int) int {
	return int(math.Min(float64(x), float64(y)))
}
func abs(x int) int {
	return int(math.Abs(float64(x)))
}
func varDump(value ...interface{}) {
	for _, v := range value {
		fmt.Fprintf(os.Stderr, "%#v\n", v)
	}
}
func yes() {
	fmt.Println("Yes")
}
func no() {
	fmt.Println("No")
}

// Pair a
type Pair struct {
	first  int
	second int
}

// Queue a
type Queue struct {
	v []Pair
}

// Push for queue
func (q *Queue) Push(v Pair) {
	q.v = append(q.v, v)
}

// Pop for queue
func (q *Queue) Pop() Pair {
	r := q.v[0]
	q.v = q.v[1:]
	return r
}

// Front for queue
func (q Queue) Front() Pair {
	return q.v[0]
}

// Empty return true if empty
func (q Queue) Empty() bool {
	return len(q.v) == 0
}


Measured memory_bytes: 640
// abc156_b
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<map>
#include<set>
#include<unordered_map>
#include<utility>
#include<cmath>
#include<random>
#include<cstring>
#include<queue>
#include<stack>
#include<bitset>
#include<cstdio>
#include<sstream>
#include<iomanip>
#include<assert.h>
#include<typeinfo>
#define loop(i,a,b) for(int i=a;i<b;i++)
#define rep(i,a) loop(i,0,a)
#define FOR(i,a) for(auto i:a)
#define pb push_back
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)
#define show1d(v) rep(i,v.size())cout<<" "<<v[i];cout<<endl<<endl;
#define show2d(v) rep(i,v.size()){rep(j,v[i].size())cout<<" "<<v[i][j];cout<<endl;}cout<<endl;
using namespace std;
typedef long long ll;
typedef int Def;
typedef pair<Def,Def> pii;
typedef vector<Def> vi;
typedef vector<vi> vvi;
typedef vector<pii> vp;
typedef vector<vp> vvp;
typedef vector<string> vs;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef pair<Def,pii> pip;
typedef vector<pip>vip;
template<typename A,typename B>bool cmin(A &a,const B &b){return a>b?(a=b,true):false;}
template<typename A,typename B>bool cmax(A &a,const B &b){return a<b?(a=b,true):false;}
const double PI=acos(-1);
const double EPS=1e-9;
Def inf = sizeof(Def) == sizeof(long long) ? 2e18 : 1e9+10;
int dx[]={0,1,0,-1};
int dy[]={1,0,-1,0};
int main(int argc, char *argv[])
{
  int n,k,cnt=0;
  cin>>n>>k;
  while(n>0){
    n /= k;
    cnt++;
  }

  cout<<cnt<<endl;
  return 0;
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
#include<unordered_map>
#include<unordered_set>
#pragma warning(disable:4996)
using namespace std;
using ld =long double;
const ld eps = 1e-9;


struct edge {
	int from;
	int to;
	int c1;
	int c2;
};

int main()
{
	int N,M;cin>>N>>M;
	vector<vector<edge>>graph(N);
	vector<int>comes(N);
	for (int i = 0; i < M; ++i) {
		int a,b,t1,t2;cin>>a>>b>>t1>>t2;
		a--;b--;
		graph[a].push_back(edge{ a,b,t1,t2 });
		comes[b]++;
	}
	vector<int>v;
	vector<int>nums(N);
	{
		queue<int>que;
		for (int i = 0; i < N; ++i) {
			if (!comes[i])que.push(i);
		}
		while (!que.empty()) {
			int now(que.front());
			que.pop();
			v.push_back(now);
			for (auto e : graph[now]) {
				comes[e.to]--;
				if (!comes[e.to]) {
					que.push(e.to);
				}
			}
		}
		for (int i = 0; i < N; ++i) {
			nums[v[i]]=i;
		}
	}
	vector<vector<vector<int>>>memo(N,vector<vector<int>>(N,vector<int>(2,1e9)));
	memo[0][0][0]=0;

	for (int i = 0; i < N; ++i) {
		for (int j = 0; j <= i; ++j) {
			for (int k = 0; k < 2; ++k) {
				int now_u = v[j];
				int now_d = v[i];

				for (auto e : graph[now_u]) {
					if (k&&e.to == now_d)continue;
					else {
						int next_u = e.to;
						int next_d = now_d;

						if (nums[next_u]>nums[next_d])swap(next_u, next_d);

						int next_i = nums[next_d];
						int next_j = nums[next_u];

						memo[next_i][next_j][i==j] = min(memo[next_i][next_j][i==j], memo[i][j][k] + e.c1);
					}
				}
				if (now_u == now_d) {
					for (auto e : graph[now_u]) {

						int next_u = e.to;
						int next_d = e.to;


						int next_i = nums[next_d];
						int next_j = nums[next_u];

						memo[next_i][next_j][0] = min(memo[next_i][next_j][0], memo[i][j][k] + e.c1 + e.c2);

					}
				}
			}
			
		}
	}
	int ans=memo[N-1][N-1][0];
	ans=min(ans,memo[N-1][N-1][1]);
	cout<<ans<<endl;

	
	return 0;
}


Measured memory_bytes: 58012
N, K, Q = map(int, input().split())

correct_dict = {i: 0 for i in range(N)}

for _ in range(Q):
    i = int(input()) - 1
    if i in correct_dict:
        correct_dict[i] += 1
    else:
        correct_dict[i] = 1

for k, v in correct_dict.items():
    if K - Q + v > 0:
        print('Yes')
    else:
        print('No')

Measured memory_bytes: 15084
//! Framework <https://github.com/vain0x/procon>

#![allow(non_snake_case)]
#![allow(unused_imports)]

use std::collections::*;

pub struct Scan(Box<dyn Iterator<Item = &'static str>>); // '

impl Scan {
    fn new() -> Self {
        let mut buf = String::new();
        let read_line = move || {
            std::io::stdin().read_line(&mut buf).unwrap();
            Box::leak(buf.split_off(0).into_boxed_str()).split_whitespace()
        };
        Scan(Box::new(std::iter::repeat_with(read_line).flatten()))
    }

    pub fn word<T: std::str::FromStr>(&mut self) -> T {
        self.0.next().unwrap().parse().ok().unwrap()
    }

    pub fn list<T: std::str::FromStr>(&mut self, len: usize) -> Vec<T> {
        std::iter::repeat_with(|| self.word()).take(len).collect()
    }
}

fn main() {
    let mut scan = Scan::new();

    let N = scan.word::<usize>();
    let mut K = scan.word::<usize>();
    let A = scan.list::<usize>(N);

    let mut x = 0;
    let mut step = vec![N; N];
    let mut t = 0;
    let e;

    loop {
        if step[x] != N {
            e = x;
            t -= step[x];
            break;
        }

        step[x] = t;
        x = A[x] - 1;
        t += 1;
    }

    if K >= step[e] {
        K -= step[e];
        K %= t;
        x = e;
    } else {
        x = 0;
    }

    for _ in 0..K {
        x = A[x] - 1;
    }

    println!("{}", x + 1);
}


Measured memory_bytes: 7744
#include<stdio.h>

int main(void)
{
    int ch[10]={0},mo[10]={0},count[10]={0},i,j=0;
    for(i=0;i<6;i++){
        scanf("%d",&mo[i]);
        ch[i]=1000-mo[i];
        j++;
        //printf("=====%d\n",ch[i]);
        if(mo[i]==0)break;
    }

    for(i=0;i<j-1;i++){
        while(ch[i]>0){
            if(ch[i]>=500){
                count[i]+=1;
                ch[i]%=500;
                //printf("=====%d\n",ch[i]);
            }
            else if(ch[i]>=100&&ch[i]<500){
                count[i]+=ch[i]/100;
                ch[i]%=100;
                //printf("=====%d\n",ch[i]);
            }
            else if(ch[i]>=50&&ch[i]<100){
                count[i]+=ch[i]/50;
                ch[i]%=50;
                //printf("=====%d\n",ch[i]);
            }
            else if(ch[i]>=10&&ch[i]<50){
                count[i]+=ch[i]/10;
                ch[i]%=10;
                //printf("=====%d\n",ch[i]);
            }
            else if(ch[i]>=5&&ch[i]<10){
                count[i]+=ch[i]/5;
                ch[i]%=5;
                //printf("=====%d\n",ch[i]);
            }
            else if(ch[i]>=1&&ch[i]<5){
                count[i]+=ch[i];
                ch[i]%=1;
                //printf("=====%d\n",ch[i]);
            }


        }
            printf("%d\n",count[i]);
        }


    return 0;
}

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

typedef uint64_t u64;
typedef int64_t i64;
typedef uint32_t u32;
typedef int32_t i32;
typedef uint16_t u16;
typedef int16_t i16;
typedef uint8_t u8;
typedef int8_t i8;

using namespace std;

#define rep(idx, N) for (u64 idx = 0; idx < N; idx++)

int main() {
  string s, t;

  cin >> s >> t;

  u32 ans = 0;
  rep(i, s.length()) {
    if (s[i] != t[i])
      ans++;
  }
  cout << ans;

  return 0;
}


Measured memory_bytes: 3916
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <algorithm>
typedef long long ll ;
#define rep(i, a, b) for (int i = a ; i <= b; ++ i) 
const int M = 18, N = 3e5 + 5 ;
using namespace std ;

int n, v[M + 5], x[N], L[M + 1][N], R[M + 1][N], dpl[N], dpr[N], bit[N], m ;

int main() {
	scanf("%d%d", &n, &v[0]) ;
	rep(i, 1, n) scanf("%d", &x[i]) ;
	for (m = 1; ; m ++) {
		v[m] = v[m - 1] / 2 ;
		if (!v[m]) break ;
	}
	rep(j, 0, m) {
		L[j][1] = L[j][0] = 1 ;
		rep(i, 2, n) L[j][i] = (x[i] - x[i - 1] <= v[j] ? L[j][i - 1] : i) ;
		R[j][n] = R[j][n + 1] = n ;
		for (int i = n - 1; i; -- i) R[j][i] = (x[i + 1] - x[i] <= v[j] ? R[j][i + 1] : i) ;
	}
	int st = (1 << m) - 1 ;
	dpl[0] = 0, dpr[0] = n + 1 ;
	rep(i, 1, st) {
		dpl[i] = 0, dpr[i] = n + 1 ;
		rep(j, 1, m) if ((i >> (j - 1)) & 1) {
			dpl[i] = max(dpl[i], R[j][dpl[i ^ (1 << (j - 1))] + 1]) ;
			dpr[i] = min(dpr[i], L[j][dpr[i ^ (1 << (j - 1))] - 1]) ;
		}
	}
	rep(i, 0, n + 1) bit[i] = - n ;
	rep(i, 0, st) bit[dpr[i]] = max(bit[dpr[i]], dpl[st ^ i]) ;
	rep(i, 1, n + 1) bit[i] = max(bit[i], bit[i - 1]) ;
	rep(i, 1, n) puts((bit[R[0][i] + 1] >= L[0][i] - 1) ? "Possible" : "Impossible") ;
	return 0 ; 
}

Measured memory_bytes: 51200
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<long long> vll;
typedef vector<pair<int,int>> vp;
typedef pair<int,int> pii;
#define INF (int)(1e9)
#define MAXX 1.1529215e+18
#define inf 999999
#define EPS (1e-7)
#define rep(i,n) for(int i=0; i<(int)(n);i++)
#define REP(i,n) for(int i=1;i<=(int)(n);i++)
#define FOR(i,k,n) for(int i=(k);i<(int)(n);i++)
#define ALL(a)  a.begin(),a.end()
#define RALL(a) a.begin(),a.end(),greater<int>()
#define ROT(a) a.begin(),a.begin()+1,a.end()
#define RROT(a) a.begin(),a.end()-1,a.end()
#define PB push_back
#define MP make_pair
#define PI acos(-1.0)
#define sz(a) a.size()
const ll MOD = 1e9+7;
const int MAX = 10000000;
template<typename T1, typename T2> inline bool chmin(T1 &a, T2 b) { if (a > b) { a = b; return 1; } return 0; }
template<typename T1, typename T2> inline bool chmax(T1 &a, T2 b) { if (a < b) { a = b; return 1; } return 0; }
template<typename T> T gcd(T a, T b) { if (b == 0) return a; return gcd(b, a % b); }
//cout << 'H' << endl;
//next_permutation(ALL(p));
//typedef priority_queue<int> pque;//これは大きい順
//typedef priority_queue<int, vector<int>, greater<int>> pque;//これは小さい順
//factorizeは、素因数分解用の関数

int main(){
	int a,b;
	cin >> a >> b;
	int max=-1*INF;
	chmax(max, a+b);
	chmax(max, a-b);
	chmax(max, a*b);
	cout << max << endl;

  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<string>
#include<algorithm>
#include<utility>
#include<numeric>
#include<vector>
#include<map>
#include<unordered_map>
#include<set>
#include<tuple>
#include<stack>
#include<queue>
#include<functional>
#include<iterator>
#include<cmath>
#include<cctype>
#include<cassert>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> P;

const int INF = 1e9;
const ll LINF = 1e18;
const int MOD = INF+7;

#define FOR(i, a, n) for (ll i = (ll)a; i < (ll)n; ++i)
#define rep(i,n) FOR(i,0,n)

struct edge{int to,cost;};

void dump(ll *b,int n){
	for(int i=0;i<n;i++){
		cout << b[i] << " ";
	}
	cout << "\n";
}

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	
	int n,x;
	cin >> n >> x;
	if(x==1 || x==2*n-1){
		puts("No");
		return 0;
	}
	if(n==2){
		puts("Yes\n1\n2\n3");
		return 0;
	}
	int nb=2*n-1; //bottomの数
	int ans[nb];

	ans[nb/2]=x;
	ans[nb/2 -1]=1;
	ans[nb/2 +1]=nb;
	int l,r,skip;
	if(x==2){
		ans[nb/2-2]=3;
		skip=3;
		l=nb/2-2;
		r=nb/2+2;
	}else{
		ans[nb/2+2]=x-1;
		skip=x-1;
		l=nb/2-1;
		r=nb/2+3;
	}
	cout << "Yes" << "\n";
	int num=2;
	for(int i=0;i<l;i++){
		while(num==x || num==skip) num++;
		cout << num++ << "\n";
	}
	FOR(i,l,r) cout << ans[i] << "\n";
	for(int i=r;i<nb;i++){
		while(num==x || num==skip) num++;
		cout << num++ << "\n";
	}

	return 0;
}

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

typedef long long ll;

int main() {
	ios::sync_with_stdio(0);

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

	return 0;
}


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

#define ll long long
#define ull unsigned long long
#define ld long double
#define pll pair<long long,long long>
#define pcc pair<char,char>
#define vl vector<long long>
#define vvl vector<vector<long long>>
#define vvvl vector<vector<vector<long long>>>
#define vc vector<char>
#define vvc vector<vector<char>>
#define vs vector<string>
#define vb vector<bool>
#define vvb vector<vector<bool>>
#define vp vector<pair<long long,long long>>
#define umap unordered_map
#define uset unordered_set
#define Lqueue priority_queue<long long>
#define Squeue priority_queue<long long,vector<long long>,greater<long long>>
#define fi first
#define se second
#define mp make_pair
#define mt make_tuple
#define eb emplace_back

const int MOD1=1000000007;
const int MOD2=998244353;
const long double PI=3.1415926535897932;
const long long MAXLL=9223372036854775807;
const long long INF=2305843009213693951;
const int dx[]={0,1,0,-1,1,-1,1,-1};
const int dy[]={1,0,-1,0,1,1,-1,-1};

#define unless(a) if(!(a))
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define rbf(a,x) for(auto& a:x)
#define rep(i,n) for(int i=0;i<(n);i++)
#define rep2(i,s,n) for(int i=(s);i<(n);i++)
#define bitrep(i,s,n) for(int i=(s);i<(1LL<<(n));i++)
#define bitcheck(bit,i) (bit)&(1LL<<(i))
#define Maxe(x) *max_element((x).begin(),(x).end())
#define Mine(x) *min_element((x).begin(),(x).end())
#define Size(x) ((long long)(x).size())
#define Lin(s) getline(cin,(s))

void Yes(bool a){cout<<(a?"Yes":"No")<<endl;}
void YES(bool a){cout<<(a?"YES":"NO")<<endl;}
template<class T,class U> auto max(T a,U b){return a>b?a:b;}
template<class T,class U> auto min(T a,U b){return a<b?a:b;}
long long gcd(long long a,long long b){return b?gcd(b,a%b):a;}
long long lcm(long long a,long long b){return a/gcd(a,b)*b;}
long long cutup(long long a,long long b){return (a+b-1)/b;}
long long popcnt(long long a){return __builtin_popcountll(a);}
template<class T,class U> inline bool chmin(T& a,U b){if(a>b){a=b;return true;}return false;}
template<class T,class U> inline bool chmax(T& a,U b){if(a<b){a=b;return true;}return false;}

struct edge{long long to,cost;};
struct edge2{long long from,to,cost;};

signed main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    string s;
    cin>>s;
    cout<<count(all(s),'1')<<endl;
}

Measured memory_bytes: 3664
#include<iostream>
#include<list>
#include<iomanip>
#include<cmath>
using namespace std;

double pi = acos(-1);   //cos(pi)=-1

void Koch( int n, double x1, double y1, double x2, double y2, list<double>& x, list<double>& y )
{
    if( n == 1 )
    {
        for( list<double>::iterator itr1 = x.begin(), itr2 = y.begin(); itr1 != x.end(); itr1++, itr2++ )
        {
            if( *itr1 == x2 && *itr2 == y2 )
            {
                x.insert(itr1,x1+(x2-x1)/3);                                                      //sx
                y.insert(itr2,y1+(y2-y1)/3);                                                      //sy
                x.insert(itr1,(x1+(x2-x1)*2/3-(x1+(x2-x1)/3))*cos(60*pi/180)-((y1+(y2-y1)*2/3)-(y1+(y2-y1)/3))*sin(60*pi/180)+x1+(x2-x1)/3);    //ux
                y.insert(itr2,((x1+(x2-x1)*2/3)-(x1+(x2-x1)/3))*sin(60*pi/180)+((y1+(y2-y1)*2/3)-(y1+(y2-y1)/3))*cos(60*pi/180)+y1+(y2-y1)/3);  //uy
                x.insert(itr1,x1+(x2-x1)*2/3);                                                         //tx
                y.insert(itr2,y1+(y2-y1)*2/3);                                                         //ty
            }
        }
        //top[i++] = x1 + ( x2 - x1 ) / 3;                                                
        //top[i++] = y1 + ( y2 - y1 ) / 3;                                                
        //top[i++] = (tx - sx) * cos(60*pi/180) - (ty - sy) * sin(60*pi/180) + sx;        //ux 正規化+元の座標に戻す処理
        //top[i++] = (tx - sx) * sin(60*pi/180) + (ty - sy) * cos(60*pi/180) + sy;        //uy
        //top[i++] = x1 + ( x2 - x1 ) * 2 / 3;                                            
        //top[i++] = y1 + ( y2 - y1 ) * 2 / 3;                                            
        return;
    }

    Koch( n - 1, x1, y1, x2, y2, x, y );

    for( list<double>::iterator itr1 = x.begin(), itr2 = y.begin(); itr1 != x.end(); )    //n-1のコッホ曲線を作ることが出来たら、残りの処理を行う
    {
        double a = *itr1;                                                                 //listで管理してるので、値保持する必要がある
        double b = *itr2;
        itr1++;
        itr2++;
        Koch( n - ( n - 1 ), a, b, *itr1, *itr2, x, y );                                  //最後の処理なので、第一引数に与える数は常に1になるように設定
    }
    return;
}

int main()
{
    int n;
    double x1 = 0.0, y1 = 0.0, x2 = 100, y2 = 0.0;
    list<double> x;                //頂点の座標を保持するリスト
    list<double> y;

    x.push_back(x1);
    y.push_back(y1);
    x.push_back(x2);
    y.push_back(y2);

    cin >> n;

    if( n > 0 )
        Koch( n, x1, y1, x2, y2, x, y );

    for( list<double>::iterator itr1 = x.begin(), itr2 = y.begin(); itr1 != x.end(); itr1++, itr2++ )
        cout << fixed<< setprecision(8) << *itr1 << " " << *itr2 << endl;

    return 0;
}


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

using namespace std;
const int N = 1e6+100;
typedef long long ll;
int main(){
	ll n,k;
	cin>>n>>k;
	double ans=0;
	for(int i=1;i<=n;i++){
		long long re=0;
		for(int t=0;;t++){
			if(i*(long long)(1<<t)>=k){
				re=t;break;
			}
		}
		//cout<<re<<endl;
		long long sum=(long long)(1<<re);
		ans+=(1.0/sum)*(1.0/n);
	}
	printf("%.15lf\n",ans);
	return 0;
}


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

int main(int argc, char** argv){
  string S;
  cin >> S;
  
  int tmp = 0;
  for(int cnt0=0; cnt0<4; cnt0++){
    tmp = count(S.begin(), S.end(), S[cnt0]);
    if(tmp != 2) {
      cout << "No" << endl;
      return 0;
    }
  }
  
  cout << "Yes" << endl;
  return 0;
  
  
}

Measured memory_bytes: 256
n = int(input())
x = [0]*n
for i in range(n):
    a,b = map(int,input().split())
    x[i] = [a,b,a+b]
x.sort(key= lambda val : val[2],reverse=True)

c1 = 0
c2 = 0
for i,[X,Y,Z] in enumerate(x):
    if i%2 == 0:
        c1 += X
    else:
        c2 += Y
print(c1-c2)

Measured memory_bytes: 30172
#include <iostream>
#include <vector>
#include <iterator>
#include <cmath>
using namespace std;


int main(){
    long long int n, i, index = 0, input, temp;
    vector<int> v1;
    cin >> n;

    for(i = 1; i <= sqrt(n); i++){
        if(n%i == 0){
            input = i;
            v1. push_back(input);
            index++;
        }

    }
    temp = n/ v1[index-1];

    if(v1[index-1] == 1)
        cout << n - 1  << endl;

    else
        cout << (temp+v1[index-1]) - 2  << endl;


    return 0;
}


Measured memory_bytes: 3668
#include<bits/stdc++.h>
#define rep(i,a) for(int (i)=0; (i)<(a); (i)++)
#define rep2(i,a,b) for(int (i)=(a); (i)<(b); (i)++)
#define MOD 1000000007
#define all(v) v.begin(), v.end()
#define m0(x) memset(x,0,sizeof(x))
#define chmax(a,b) if(b>a) a = b
#define chmin(a,b) if(b<a) a = b
typedef long long ll;
using namespace std;

using namespace std;

int main(){
    ios_base::sync_with_stdio(false); 
    cin.tie(NULL);
    ll a, v, b, w; cin >> a >> v; 
    cin >> b >> w;
    ll t; cin >> t;
    ll d = abs(a-b);
    if(v-w>0){
          if(t * (v-w) >= d) cout << "YES";
          else cout << "NO";
    }else cout << "NO";
    return 0;
}


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

int main()
{
    string str;
    cin >> str;
    if (str == "Sunny"){
        cout << "Cloudy" << endl;
    }
    else if(str=="Cloudy"){
        cout << "Rainy" << endl;
    }
    else{
        cout << "Sunny" << endl;
    }
}

Measured memory_bytes: 256
import java.math.BigDecimal;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		long a = sc.nextLong();
		double b = sc.nextDouble();

		BigDecimal x = BigDecimal.valueOf(b);
		x.multiply(BigDecimal.valueOf(a));

		System.out.println(x.multiply(BigDecimal.valueOf(a)).longValue());
	}

}


Measured memory_bytes: 37652
#include <iostream>
#include <string>
#include <cctype>
#include <cmath>
#include <stdio.h>
#define MAXSIZE 101
#define PI 3.141592653589
using namespace std;
int main(){
  int n;

  int num[1000]={0};

  while (1) {
    std::cin >> n;
    if(0==n)break;
    long long int sum=0;
    for(int i=0;i<n;i++){
      std::cin >> num[i];
      sum+=num[i];
    }

    double ave=(double)sum/n;
    double a2before=0;
    for(int i=0;i<n;i++){
      a2before+=(num[i]-ave)*(num[i]-ave);
    }
    double a2=a2before/n;

    printf("%.8f\n",sqrt(a2));
  }

}

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

using namespace std;

void debug_out() { cerr << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cerr << " " << to_string(H);
  debug_out(T...);
}
#ifdef LOCAL
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define debug(...) 42
#endif

#define rep(i,n) for(int i=0; i<(int)(n); i++)
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

using ll = long long;
using P = pair<ll, ll>;

//constexpr ll mod = 998244353;
constexpr ll mod = 1e9+7;
const double PI = acos(-1.0);
mt19937_64 engine(chrono::steady_clock::now().time_since_epoch().count());

signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);

  int n; cin >> n;
  vector<int> vec(100005);
  rep(i, n) {
    int a, b; cin >> a >> b;
    vec[a]++;
    vec[b+1]--;
  }
  for(int i=1; i<100005; i++) {
    vec[i] += vec[i-1];
  }
  int ans = 0;
  for(int i=1; i<100005; i++) {
    if (vec[i]+1 >= i) {
      ans = i-1;
    }
  }
  cout << ans << endl;
}


Measured memory_bytes: 3364
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <map>
#include <queue>
#include <set>
#include <iomanip>
#include <deque>
#include <cassert>
#include <ctime>
#include <cstring>
#include <cstdlib>
#include <chrono>
#include <ctime>
#include <random>
#include <stack>
#include <unordered_set>
#include <unordered_map>
#include <iterator>
#include <climits>
using namespace std;

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
typedef long long ll;
typedef long double ld;
#define INF 2001001001
#define MOD 1000000007

ll ans;

int main()
{
  //ios_base::sync_with_stdio(0);cin.tie(0);
  //freopen (".in","r",stdin);
  //freopen (".out","w",stdout);
  string S;
  cin>>S;
  string T="";
  for (int i=0;i<(int)S.length();i++){
    if (S[i]=='B' && i+1<(int)S.length() && S[i+1]=='C'){
      i++;
      T+='D';
    }
    else
      T+=S[i];
  }
  int L=INF;
  for (int i=0;i<(int)T.length();i++){
    if (i+1==(int)T.length() || T[i+1]=='B' || T[i+1]=='C'){
      int d=0;
      for (int j=i;j>=L;j--){
	if (T[j]=='D')
	  d++;
	else
	  ans+=d;
      }
      L=INF;
    }
    else if (T[i]=='A' || T[i]=='D')
      L=min(L,i);
  }
  cout<<ans<<endl;
  return 0;
}


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

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rept(i,k,n) for(int i = (k); i < (int)(n); i++)
#define all(v) v.begin(), v.end()
#define Sort(v) sort(v.begin(),v.end())
#define Reverse(v) reverse(v.begin(),v.end())

typedef long long ll;

int main() {
    int aaa;
    cin>>aaa;
    string n;
    cin>>n;
    int ans=0;
    rep(i,10){
        rep(j,10){
            rep(k,10){
                char a=char(i+48),b=char(j+48),c=char(k+48);
                int l=0;
                for(;l<n.size();l++){
                    if(n[l]==a) break;
                }
                l++;
                for(;l<n.size();l++){
                    if(n[l]==b) break;
                }
                l++;
                for(;l<n.size();l++){
                    if(n[l]==c){
                        ans++;
                        break;
                    }
                }

            }
        }
    }
    cout<<ans<<endl;
    
    
    return 0;
}

Measured memory_bytes: 384