akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <cmath>
#include <string>
#include <algorithm>
#include <set>
#include <vector>
#include <map>
#include <list>
#include <stack>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <queue>
#define pr(num) printf("%lld\n", num)
#define max(a, b) ((a)>(b) ? (a):(b))
#define min(a, b) ((a)<(b) ? (a):(b))
#define INF 1000000000000000000
#define MOD 1000000007LL
#define MAX 100010
#define BLACK 0
#define WHITE 1
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
typedef map<ll, ll> Map;

int main(void) {
    ll N, X;
    cin >> N >> X;
    ll i;
    ll l[60], b[60], p[60];
    ll ans=0;
    
    l[0]=1;
    b[0]=0;
    p[0]=1;
    for(i=1; i<=50; i++) {
        l[i]=2*l[i-1]+3;
        b[i]=2*b[i-1]+2;
        p[i]=2*p[i-1]+1;
    }
    
    ll len=l[N];
    i=N;
    while(i>=0) {
        if(X<=len/2) {
            len-=3;
            len/=2;
            X--;
            i--;
        }else if(X>len/2+1){
            if(i==0) {
                ans++;
            }else {
                ans+=p[i-1]+1;
            }
            
            len-=3;
            len/=2;
            X-=2;
            X-=l[i-1];
            i--;
        }else if(X==len/2+1) {
            if(i==0) {
                ans++;
            }else {
                ans+=p[i-1]+1;
            }
            break;
        }
        
    }
    
    pr(ans);
    
}

Measured memory_bytes: 256
/*
 * main.c
 *
 *  Created on: 2019/06/16
 *      Author: family
 */

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>

int L[101] = {0};

int main()
{
	int N = 0, X = 0, i = 0, ans = 1;
	int next = 0;
	scanf("%d %d", &N, &X);
	for(i = 0; i < N; i++){
		scanf("%d", &L[i]);
	}
	for(i = 0; i < N; i++) {
		next += L[i];
		if(next <= X) {
			ans++;
		}
	}
	printf("%d\n", ans);
    return 0;
}


Measured memory_bytes: 128
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int value = n / 10 * 10;
        int flag = 0;
        if (n - value == 7) {
            flag = 1;
        }

        value = n / 10;
        value = value / 10 * 10;
        if (n / 10 - value == 7) {
            flag = 1;
        }

        if (n / 100 == 7) {
            flag = 1;
        }

        if (flag == 1) {
            System.out.println("Yes");
        } else {
            System.out.println("No");
        }
    }
}

Measured memory_bytes: 35824
#define _USE_MATH_DEFINES
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<math.h>
#include<map>
#include<iomanip>
#include<functional>
#include<limits>
#include <unordered_map>
#include <numeric>
#include <array>
#include <queue>
#include <chrono>
#include <random>
#include <fstream>


using namespace std;
using  ull = unsigned long long int;

#define rep(i,n,m) for(long long int i=n;i<(long long int)(m);i++)
#define INF (1<<29)
#define MD 1000000007

int main() {
	vector<int>a(3, -1);
	vector<int>b(3, -1);
	vector<vector<int>>c(3, vector<int>(3, 0));
	int sum = 0;
	int val = 0;
	rep(i, 0, 3) {
		rep(j, 0, 3) {
			cin >> c[i][j];
			sum += c[i][j];
		}
	}

	val += c[0][0] + c[1][1] + c[2][2];

	if (sum % 3 == 0 && val*3 == sum)cout << "Yes" << endl;
	else cout << "No" << endl;


	return 0;
}

Measured memory_bytes: 256
#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;
using namespace chrono;
#define int long long
#define ld double
#define fi first
#define se second
#define pb push_back
#define pii pair<int,int>
#define sz(x) ((long long)x.size())
#define all(x) (x).begin(), (x).end()
#define popcount(x) __builtin_popcountll(x)
const int MOD =1e9+7;

mt19937_64 rng(high_resolution_clock::now().time_since_epoch().count());
template<typename T> using Tree = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
template<typename T> istream& operator >> (istream &in,vector<T> &A){ for(auto &x:A) in>>x; return in; };
template<typename T> ostream& operator << (ostream &out,vector<T> &A){ for(auto &x:A) out<<x<<" "; return out; };
template<typename T,typename W> istream& operator >> (istream &in,pair<T,W> &A){ in>>A.fi>>A.se; return in; };
const int N = 100;
// vector<int> g[N];
// bool vis[N];
void solve()
{
	// int n;
	// cin>>n;
	// string a,b;
	// cin>>a>>b;
	// for(int i=0;i<N;i++)
	// {
	// 	g[i].clear();
	// 	vis[i]=false;
	// }
	// for(int i=1;i<n;i++)
	// {
	// 	if(a[i-1]=='Y'&&b[i]=='Y')
	// 	{
	// 		g[i+1].pb(i);
	// 	}
	// 	if(b[i-1]=='Y'&&a[i]=='Y')
	// 	{
	// 		g[i].pb(i+1);
	// 	}
	// }
	int a,b,c;
	cin>>a>>b>>c;
	int ans=0;
	while(b<=a) b*=2,ans++;
	while(c<=b) c*=2,ans++;
	int k;
	cin>>k;
	// cout<<a<<" "<<b<<" "<<c<<"\n";
	if(ans<=k)
	{
		cout<<"Yes\n";
	}
	else cout<<"No\n";
}

// (1<<)
int32_t main(){
	cin.tie(0)->sync_with_stdio(0);
	#ifdef LOCAL
	freopen("input.txt", "r", stdin);
	#endif

	int t=1;
	// cin>>t;
	for(int _t=1;_t<=t;_t++){
		// cout<<"Case #"<<_t<<": ";
		solve();
	}
} 


Measured memory_bytes: 3648
using System;
using System.Linq;

class Program
{
    static void Main(string[] args)
    {
        int[] KX = Console.ReadLine().Split(' ').Select(o => int.Parse(o)).ToArray();
        int K = KX[0], X = KX[1];

        string O = 500 * K >= X ? "Yes" : "No";

        Console.WriteLine(O);
    }
}


Measured memory_bytes: 13396
#include <bits/stdc++.h>
using namespace std;
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define ll long long
#define ull unsigned long long
#define ld long double
#define vl vector<long long>
#define vvl vector<vector<long long>>
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define rep2(i, s, n) for (ll i = (s); i < (ll)(n); i++)
#define rrep(i, x) for (ll i = ((ll)(x)-1); i >= 0; i--)
#define pll pair<long long,long long>
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define vvc vector<vector<char>>
#define vc vector<char>
#define vvb vector<vector<bool>>
#define vb vector<bool>
#define maxe(x) *max_element(all(x))
#define mine(x) *min_element(all(x))
#define Size(x) ((int)(x).size())
#define umap unordered_map
const long long INF = 1LL << 60;
const long double pi = 3.1415926535897932;
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};

    template<class T> inline bool chmin(T& a, T b) {
        if (a > b) {
            a = b;
            return true;
        }
        return false;
    }
    template<class T> inline bool chmax(T& a, T b) {
        if (a < b) {
            a = b;
            return true;
        }
        return false;
    }

//lis,modpow,uf,modncr,soinsubunkai,yakusurekkyo,gyakugen
//mint,dijkstra

    signed main(){
        ios::sync_with_stdio(false);
        cin.tie(nullptr);
        ll n;
        cin>>n;
        vector<pll> AT(n);
        vl T(n);
        vl A(n);
        ll t=0;
        ll a=0;
        rep(i,n){
            ll x,y;
            cin>>x>>y;
            AT[i]=mp(x+y,i);
            T[i]=x;
            A[i]=y;
        }
        sort(rall(AT));
        rep(i,n){
            if(i%2==0)t+=T[AT[i].second];
            else a+=A[AT[i].second];
        }
        cout<<t-a<<endl;
    }

Measured memory_bytes: 3456
from sys import stdin, setrecursionlimit
#input = stdin.buffer.readline
setrecursionlimit(10 ** 7)

from heapq import heappush, heappop
from bisect import bisect_left, bisect_right
from collections import deque, defaultdict, Counter
from itertools import combinations, permutations, combinations_with_replacement
from itertools import accumulate
from math import ceil, sqrt, pi, radians, sin, cos

MOD = 10 ** 9 + 7
INF = 10 ** 18

S = sum(map(int, list(input())))
print("Yes" if S % 9 == 0 else "No")

Measured memory_bytes: 82260
mod=10**9+7
n,k=map(int,input().split())
ans=0
comb1=1 #初期値はNC0=1
comb2=1 #初期値は(N-1)C0=1
for i in range(min(k+1,n)): #0人の部屋は高々N-1個しか存在しないので操作回数は高々min(K,N-1)回となる
 ans+=comb1*comb2 #0人の部屋がi個のときの場合の数はNCi*(N-1)Ci
 ans%=mod
 comb1*=(n-i)*pow(i+1,mod-2,mod) #NC(i+1)はNCi*(N-i)/(i+1)で求められる
 comb1%=mod
 comb2*=(n-1-i)*pow(i+1,mod-2,mod) #(N-1)C(i+1)は(N-1)Ci*((N-1)-i)/(i+1)で求められる
 comb2%=mod
print(ans)

Measured memory_bytes: 3064
#include <iostream>
using namespace std;
int main(void){
    int H,W;
    while(true){
        cin>>H>>W;
        if(H==0 && W==0){
            break;
        }
        for(int i=0; i<H; i++){
            for(int j=0; j<W; j++){
                cout<<'#';
            }
            cout<<endl;
        }
        cout<<endl;
    }
}


Measured memory_bytes: 3096
n,m,l = (int(x) for x in input().split())

t1 = [[0 for i in range(m)] for j in range(n)]
t2 = [[0 for i in range(l)] for j in range(m)]
t3 = [[0 for i in range(l)] for j in range(n)]

i = 0
while i < n:
  t1[i] = list(int(x) for x in input().split())
  i += 1

i = 0
while i < m:
  t2[i] = list(int(x) for x in input().split())
  i += 1

# cal t3
i = 0
while i < n:
  j = 0
  while j < l:
    k,c = 0,0
    while k < m:
      #print(str(i) + " " + str(k))
      c += t1[i][k] * t2[k][j]
      k += 1
    if j != 0:
      print(' ', end='')
    print(c, end='')
    j += 1
  print ('')
  i += 1


Measured memory_bytes: 6648
#include"bits/stdc++.h"
using namespace std;
using ll = int64_t;

int main() {
    ll N;
    cin >> N;
    vector<ll> P(N);
    for (ll i = 0; i < N; i++) {
        cin >> P[i];
    }

    vector<ll> pos(N + 1);
    for (ll i = 0; i < N; i++) {
        pos[P[i]] = i;
    }

    multiset<pair<ll, ll>> st;
    //番兵を両端に設置
    st.insert({-1, N + 1});
    st.insert({-1, N + 1});
    st.insert({ N, N + 1});
    st.insert({ N, N + 1});

    //Nはsecondになりえないので入れる
    st.insert({pos[N], N});

    ll ans = 0;
    for (ll i = N - 1; i >= 1; i--) {
        auto right1 = st.upper_bound({pos[i], i});
        auto right2 = right1;
        right2++;
        auto left1 = right1;
        left1--;
        auto left2 = left1;
        left2--;

        //left1を含むような区間(left2, right1)で[left1, pos[i]]よりは大きい区間
        ans += i * (right1->first - pos[i]) * (left1->first - left2->first);

        //right1を含むような区間(left1, right2)で[pos[i], right1]よりは大きい区間
        ans += i * (right2->first - right1->first) * (pos[i] - left1->first);

        st.insert({pos[i], i});
    }

    cout << ans << endl;
}

Measured memory_bytes: 8064
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
#define INF 1<<30
#define LINF 1LL<<60

typedef long double ld;
typedef complex<ld> Point;
const ld eps = 1e-9, pi = acos(-1.0);
namespace std {
    bool operator<(const Point &lhs, const Point &rhs) {
        if (lhs.real() < rhs.real() - eps) return true;
        if (lhs.real() > rhs.real() + eps) return false;
        return lhs.imag() < rhs.imag();
    }
}
Point input_point() {ld x, y; cin >> x >> y; return Point(x, y);} // ????????\???
bool eq(ld a, ld b) {return (abs(a - b) < eps);} // ????????????????????????
ld dot(Point a, Point b) {return real(conj(a) * b);} // ??????
ld cross(Point a, Point b) {return imag(conj(a) * b);} // ??????

// ??´????????????
class Line {
public:
    Point a, b;
    Line() : a(Point(0, 0)), b(Point(0, 0)) {}
    Line(Point a, Point b) : a(a), b(b) {}
    Point operator[](const int _num) {
        if (_num == 0)return a;
        else if (_num == 1)return b;
        else assert(false);
    }
};

// ????????????
class Circle {
public:
    Point p;
    ld r;
    Circle() : p(Point(0, 0)), r(0) {}
    Circle(Point p, ld r) : p(p), r(r) {}
};

// ??´?????¨??´????????????
Point is_ll(Line s, Line t) {
    Point sv = s.b - s.a, tv = t.b - t.a;
    assert(cross(sv, tv) != 0);
    return s.a + sv * cross(tv, t.a - s.a) / cross(tv, sv);
}

int main(void) {
    cin.tie(0); ios::sync_with_stdio(false);
    int q; cin >> q;
    for(int i = 0;i<q;i++){
        Line s1(input_point(),input_point()), s2(input_point(),input_point());
        Point ret = is_ll(s1,s2);
        cout << fixed << setprecision(10) << ret.real() << " " << ret.imag() << endl;
    }
    return 0;
}

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

#define int long long

signed main(void){
    int V[4];
    int N;
    for (int i = 0; i < 4; i++) {
        cin >> V[i];
    }
    cin.ignore();
    cin >> N; cin.ignore();
    
    int u = 4*N;
    
    int a[4] = {};
    a[0] = u;
    for (int i = 0; i < 3; i++) {
        for (int j = 1; j < 4; j++) {
            int m = pow(2, j - i);
            if ((m * V[i]) > V[j]) {
                int k = a[i] / m;
                a[i] -= k*m;
                a[j] += k;
            }
        }
    }
    
    int ans = 0;
    for (int i = 0; i < 4; i++) {
        ans += a[i] * V[i];
    }
    cout << ans << endl;
}


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

ll solve() {
    ll N, L;
    cin >> N >> L;
    vector<ll> A(N);
    for ( int i = 0; i < N; i++ ) {
        cin >> A[i];
    }
    int p = -1;
    for ( int i = 0; i < N-1; i++ ) {
        if ( A[i] + A[i+1] >= L ) {
            p = i;
            break;
        }
    }
    if ( p < 0 ) {
        cout << "Impossible" << "\n";
        return false;
    } 
    cout << "Possible" << "\n";
    for ( int i = 0; i < p; i++ ) {
        cout << i+1 << "\n";
    }
    for ( int i = N-2; i > p; i-- ) {
        cout << i+1 << "\n";
    }
    cout << p+1 << "\n";
    return 0;
}

int main() {
    solve();
    return 0;
}

Measured memory_bytes: 1536
n = int(input())
arr = input().split()
arr = list(map(int,arr))

b = [0] * n
center = n // 2
for i in range(n):
    if i % 2 == 0:
        b[center + (i//2)] = arr[i]
    else:
        b[center - ((i+1)//2)] = arr[i]

if n % 2 == 0:
    pass
else:
    b.reverse()

for i in range(n-1):
    print(b[i], end = ' ')
print(b[-1])


Measured memory_bytes: 26180
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MOD=1000000007;
#define INF 1LL<<30
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define all(x) (x).begin(),(x).end()

int main(){
    int n;
    cin>>n;
    vector<int> a(n);
    rep(i,n) cin>>a[i];

    vector<bool> v(n,false);
    int ans=0;
    for(int i=n;i>=1;i--){
        int cnt=0;
        for(int j=2*i;j<=n;j+=i){
            if(v[j-1]) cnt++;
        }
        if(a[i-1]==1 && cnt%2==0){
            ans++;
            v[i-1]=true;
        }
        else if(a[i-1]==0 && cnt%2==1){
            ans++;
            v[i-1]=true;
        }
    }

    cout<<ans<<endl;
    if(ans==0) return 0;
    rep(i,n){
        if(v[i]) cout<<i+1<<" ";
    }
    cout<<endl;
}



Measured memory_bytes: 3980
s=input()
s1=[]
s2=[]
ans=0
for i in range(len(s)):
    if(s[i]=="\\"):
        s1.append(i)
    elif(s[i]=="/" and s1):
        j = s1.pop()
        a=i-j
        ans+=a

        while(s2 and s2[-1][0]>j):
            a+=s2.pop()[1]
        s2.append([j,a])

print(ans)
print(len(s2),*(a for j, a in s2))


Measured memory_bytes: 6512
/* ex3_2
Acro */

#include <stdio.h> 
int main(void){
    int num,num_1;
    scanf("%d",&num);
    /* 1の位を抽出 */
    num_1 = num % 10;
    /* 条件分岐、改行忘れずに */
    if(num_1 == 3)
    {
        printf("bon\n");
    }
    else if (num_1 == 0 || num_1 == 1 || num_1 == 6 || num_1 == 8)
    {
        printf("pon\n");
    }
    else
    {
        printf("hon\n");
    }
    
    return 0;
}

Measured memory_bytes: 1620
import java.math.BigInteger;
    import java.util.Scanner;

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

            String[] str;
            str = s.split(" ");
            BigInteger a = new BigInteger(str[0]);
            BigInteger b = new BigInteger(str[1]);

            BigInteger c = a.add(b);

            System.out.println(c);
        }
    }



Measured memory_bytes: 74868
A, B, K = map(int, input().split())
if 2 * K > B - A + 1:
	for i in range(A, B + 1):
		print(i)
else:
	for i in range(A, A + K):
		print(i)
	for j in range(B - K + 1, B + 1):
		print(j)

Measured memory_bytes: 3060
//
//  main.cpp
//

#include <algorithm>
#include <array>
#include <assert.h>
#include <complex>
#include <iomanip>
#include <iostream>
#include <limits>
#include <map>
#include <math.h>
#include <memory>
#include <memory>
#include <queue>
#include <random>
#include <set>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <vector>

using namespace std;

using ll = int64_t;
using ull = uint64_t;

[[maybe_unused]] constexpr ll LL_MAX = numeric_limits<ll>::max();
[[maybe_unused]] constexpr ll LL_MIN = numeric_limits<ll>::min();
[[maybe_unused]] constexpr ull ULL_MAX = numeric_limits<ull>::max();

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

template <typename T>
void chmin(T& x, T y) {
    x = min(x, y);
}

template <typename T>
void chmax(T& x, T y) {
    x = max(x, y);
}

ll csum(ll x, ll y) {
    if (x > 0 && y > 0 && x > LL_MAX - y) {
        return LL_MAX;
    }
    if (x < 0 && y < 0 && x < LL_MIN - y) {
        return LL_MIN;
    }
    return x + y;
}

template<typename T>
vector<T> make_vec_nd(T init, ll size) {
	return vector<T>(size, init);
}
template<typename T, typename... Args>
auto make_vec_nd(T init, ll size, Args... rest) {
	auto inner = make_vec_nd(init, rest...);
	return vector<decltype(inner)>(size, inner);
}

int main() {
    string S;
    string T;
    cin >> S >> T;
    rep(i,0,S.size()) {
        if (S[i] != T[i]) {
            cout << "No" << endl;
            return 0;
        }
    }
    cout << "Yes" << endl;
}


Measured memory_bytes: 3000
#include<iostream>
#include<queue>

using namespace std;
static const int N =100;
static const int INFTY = (1<<21);

int n, M[N][N];
int d[N];

void bfs(int s){
	queue<int> q;
	q.push(s);
	for (int i = 0; i < n; i++) d[i] = INFTY;
	d[s] = 0;
	int u;
	while ( !q.empty() ) {
		u = q.front(); q.pop();
		for (int v = 0; v < n; v++ ) {
			if ( M[u][v] == 0 ) continue;
			if (d[v] != INFTY ) continue;
			d[v] = d[u] + 1;
			q.push(v);
		}
	}
	for ( int i = 0; i < n; i++ ) {
		cout << i+1 << " " << ( (d[i] == INFTY) ? (-1) : d[i] ) << endl;
	}
}


int main() {
	int u, k, v;

	cin >> n;
	for ( int i = 0; i < n; i++ ) {
		for (int j = 0; j < n; j++ ) M[i][j] = 0;
	}
	
	for ( int i = 0; i < n; i++ ) {
		cin >> u >> k;
		u--;
		for (int j = 0; j < k; j++ ) {
			cin >> v;
			v--;
			M[u][v] = 1;
		}
	}

	bfs(0);

	return 0;
}


Measured memory_bytes: 3132
// C.

#include <iostream>
#include <sstream>
#include <algorithm>
#include <set>
#include <vector>

using namespace std;

int main(int argc, char *argv[]) {
	int n, k;
	cin >> n >> k;
	int pos = k, ans = 1;
	while (pos < n) {
		pos += k - 1;
		++ans;
	}
	cout << ans << endl;
	return 0;
}


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

using namespace std;

#define REP(i, N) for (int i = 0; i < (int)N; i++)
#define RREP(i, N) for (int i =(int)N-1; i >= 0; i--)
#define FOR(i, a, b) for (int i = a; i < (int)b; i++)
#define ALL(x) (x).begin(), (x).end()
#define INF (1 << 30)
#define LLINF (1LL << 62)
#define DEBUG(...) debug(__LINE__, ":" __VA_ARGS__)

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

int main(){
  int n;
  cin>>n;
  int w[n];
  int sum=0;
  REP(i,n){
    cin>>w[i];
    sum+=w[i];
  }
  int min=INF;
  int ans=0;
  REP(i,n){
    ans+=w[i];
    if(abs(2*ans-sum)<=min){
      min=abs(2*ans-sum);
    }
  }
  cout<<min<<endl;
}


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

#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)
# define MOD 1000000000+7
# define INF 1000000000
typedef long long ll;
using namespace std;
int gcd(int a, int b) { return b ? gcd(b, a%b) : a; }


int main() {
	int x, a;
	cin >> x >> a;
	if (x < a) { cout << 0 << endl; }
	else {
		cout << 10 << endl;
	}

}



Measured memory_bytes: 256
import math
from functools import reduce

def gcd_list(numbers):
    return reduce(math.gcd, numbers)

n = int(input()) + 1
ans = 0
for i in range(1,n):
    for j in range(1,i+1):
        for k in range(1,j+1):
            if i == j == k:
                m = 1
            elif i == j or j == k or k == i:
                m = 3
            else:
                m = 6
            a = [i,j,k]
            ans += gcd_list(a) * m
print(ans)

Measured memory_bytes: 75256
N=int(input())
slist=input()

def fact_mod2(n,r):
  if n==(r|(n-r)):
    return 1
  else:
    return 0

alist=[]
for s in slist:
  alist.append(int(s)-1)  
#print(alist)

parity=0
for i in range(N):
  parity+=fact_mod2(N-1,i)*alist[i]
#print(parity)

if parity%2==1:
  print(1)
else:
  if 1 in alist:
    print(0)
  else:
    for i in range(N):
      alist[i]//=2
    
    parity=0
    for i in range(N):
      parity+=fact_mod2(N-1,i)*alist[i]
    if parity%2==1:
      print(2)
    else:
      print(0)

Measured memory_bytes: 13624
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define INF 1e9;
using namespace std;
using ll = long long;
int main() {
    ll n , d , count = 0;
    cin >> n >> d;
    vector <ll> A(n) , B(n);
    for(int i = 0; i < n; i++){
        cin >> A[i] >> B[i];
        if(sqrt(A[i] * A[i] + B[i] * B[i]) <= d){
            count++;
        }
    }
    cout << count << endl;
}

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

using namespace std;

string s, f;

int main() {
    cin >> s >> f;
    int cnt = 0;
    for (int i = 0; i < 3; ++i) {
        cnt += (s[i] == f[i]);
    }
    cout << cnt;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <sstream>
#include <stack>
using namespace std;

double dbl(string s) {
    stringstream ss(s);
    double ret;
    ss >> ret;
    return ret;
}

int main() {
    string line;
    while (getline(cin, line)) {
        stringstream ss(line);
        stack<double> stk;
        string s;
        while (ss >> s) {
            if (s == "+") {
                double b = stk.top(); stk.pop();
                double a = stk.top(); stk.pop();
                stk.push(a + b);
            } else if (s == "-") {
                double b = stk.top(); stk.pop();
                double a = stk.top(); stk.pop();
                stk.push(a - b);
            } else if (s == "*") {
                double b = stk.top(); stk.pop();
                double a = stk.top(); stk.pop();
                stk.push(a * b);
            } else if (s == "/") {
                double b = stk.top(); stk.pop();
                double a = stk.top(); stk.pop();
                stk.push(a / b);
            } else {
                stk.push(dbl(s));
            }
        }
        cout.precision(6);
        cout << fixed << stk.top() << endl;
    }
    return 0;
}

Measured memory_bytes: 1308
#include <iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<map>
#include<set>
#include<stack>
#include<queue>
#include<math.h>
using namespace std;
typedef long long ll;
#define int long long
typedef vector<int> VI;
typedef pair<int, int> pii;
#define fore(i,a) for(auto &i:a)
#define REP(i,n) for(int i=0;i<n;i++)
#define eREP(i,n) for(int i=0;i<=n;i++)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define eFOR(i,a,b) for(int i=(a);i<=(b);++i)
#define SORT(c) sort((c).begin(),(c).end())
#define rSORT(c) sort((c).rbegin(),(c).rend())
#define LB(x,a) lower_bound((x).begin(),(x).end(),(a))
#define UB(x,a) upper_bound((x).begin(),(x).end(),(a))
#define INF 1000000000
#define LLINF 9223372036854775807
#define mod 1000000007
//vector<vector<int> > dp;
//vector<vector<vector<int> > > vvvi;
//dp=vector<vector<int> >(N, vector<int>(M,0));
//vector<pair<int,int> > v;
//v.push_back(make_pair(x,y));
//priority_queue<int,vector<int>, greater<int> > q2;



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

	int H, A, B;
	cin >> H >> A >> B;
	int n = H;
	map<int,bool> ret;
	for (int i = 1; i*i <= n; ++i)
	{
		if (n%i == 0)
		{
			ret[i]=true;
			if (i*i != n)
			{
				ret[n / i] = true;
			}
		}
	}
	int ans = 0;
	eFOR(i, A, B) {
		if (ret[i])ans++;
	}
	cout << ans << endl;
	return 0;
}




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

int selectionSort(vector<int>& a,int n){
    int minj;
    int cnt=0;
    for(int i=0;i<n-1;i++){
        minj=i;
        for(int j=i+1;j<n;j++){
            if(a[j]<a[minj]){
                minj=j;
            }
        }
        swap(a[i],a[minj]);
        if(minj!=i){
            cnt++;
        }
    }
    
    return cnt;
}

int main(){
    int n,cnt;
    cin>>n;
    vector<int> a(n);
    rep(i,n) cin>>a[i];
    
    cnt=selectionSort(a,n);
    
    rep(i,n-1) cout<<a[i]<<' ';
    cout<<a[n-1]<<endl;
    cout<<cnt<<endl;
    
    return 0;
}


Measured memory_bytes: 3104
#include <bits/stdc++.h>
#define REP(i, n) for(ll i = 0; i < (ll)n; i++)
#define FOR(i, a, b) for(ll i = (a); i < (ll)b; i++)
#define ALL(obj) (obj).begin(), (obj).end()
#define INF (1ll << 60)
#define sz(x) int(x.size())
using namespace std;
typedef long long ll;
typedef double db;
typedef string str;
typedef pair<ll, ll> p;
constexpr int MOD = 1000000007;
using ll = long long;
template <class T> inline bool chmin(T &a, T b) {
    if(a > b) {
        a = b;
        return true;
    }
    return false;
}
template <class T> inline bool chmax(T &a, T b) {
    if(a < b) {
        a = b;
        return true;
    }
    return false;
}

void print(const std::vector<int> &v) {
    std::for_each(v.begin(), v.end(), [](int x) { std::cout << x << " "; });
    std::cout << std::endl;
}

int main() {
    int n;
    cin >> n;
    vector<int> p(n);
    REP(i, n) { cin >> p[i]; }
    vector<int> a(n), b(n);
    int maxi = 40000;
    REP(i, n) {
        a[i] = maxi * (i + 1);
        b[i] = maxi * (n - i - 1) + 1;
    }
    REP(i, n) { a[p[i] - 1] += i; }
    print(a);
    print(b);
    return 0;
}

Measured memory_bytes: 896
from heapq import heappop, heappush, heapify
import sys
sys.setrecursionlimit(10**9)
input = lambda: sys.stdin.readline().rstrip()
inpl = lambda: list(map(int,input().split()))

N, M = inpl()
q = []
LRC = sorted([inpl() for _ in range(M)])
points = sorted(list({lrc[i] for i in range(2) for lrc in LRC}))
if points[0] != 1 or points[-1] != N:
    print(-1)
    exit()
positions = dict()
P = 0
prev = -1
for p in points:
    if p > prev:
        prev = p
        positions[p] = P
        P += 1
m = 0
dq = [(0,0)]
for i in range(P):
    while dq and dq[0][1] < i:
        heappop(dq)
    if not dq:
        print(-1)
        break
    d = dq[0][0]
    while m < M and positions[LRC[m][0]] == i:
        heappush(dq, (d+LRC[m][2], positions[LRC[m][1]]))
        m += 1
else:
    print(d)


Measured memory_bytes: 83292
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author Twinkle Twinkle Little Star
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        BIrohaLovesStringsABCEdition solver = new BIrohaLovesStringsABCEdition();
        solver.solve(1, in, out);
        out.close();
    }

    static class BIrohaLovesStringsABCEdition {
        public void solve(int testNumber, InputReader in, PrintWriter out) {
            int row = in.nextInt();
            int col = in.nextInt();
            String array[] = new String[row];
            for (int i = 0; i < row; i++) {
                array[i] = in.next();
            }
            Arrays.sort(array);
            String temp = "";
            for (int i = 0; i < row; i++) {
                temp += array[i];
            }
            out.print(temp);
        }

    }

    static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

    }
}



Measured memory_bytes: 25300
#include<stdio.h>
#include<map>
#include<utility>

using namespace std;
typedef pair<int, int> P;

P f(int a)
{
	P p;
	p.first = a%10;
	while(a >= 10){
		a /= 10;
	}
	p.second=a;
	return p;
}

int main()
{
	int n, last_a, top_a, ans=0;
	scanf("%d", &n);

	map<P,int> freq;
	for(int i=1; i<=n; i++){
		P p = f(i);
		freq[p]++;
	}

	for(int i=1; i<=n; i++){
		P p = f(i);
		P q(p.second, p.first);
		ans += freq[q];
	}

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

Measured memory_bytes: 256
#include <bits/stdc++.h>
    using namespace std;
     
    vector<int> edges[2010];
    int dist[2010][2010];
     
    void dfs(int now, int fa, int depth,int root) {
        dist[root][now] = depth;
        for(int next: edges[now]) {
            if(next == fa) {
                continue;
            }
            dfs(next, now, depth + 1, root);
        }
    }
     
    void count() {
        int n, k;
        scanf("%d%d", &n, &k);
        vector<pair<int, int>> edgePairs;
        for(int i = 1; i < n; ++ i) {
            int u, v;
            scanf("%d%d", &u, &v);
            -- u, -- v;
            edges[u].push_back(v);
            edges[v].push_back(u);
            edgePairs.push_back(make_pair(u, v));
        }
        for(int i = 0; i < n; ++ i) {
            dfs(i, i, 0, i);
        }
        int ans = 0;
        if(k & 1) {
            k >>= 1;
            for(auto edge: edgePairs) {
                int cnt = 0;
                for(int i = 0; i < n; ++ i) {
                    cnt += min(dist[edge.first][i], dist[edge.second][i]) <= k;
                }
                ans = max(ans, cnt);
            }
        } else {
            k >>= 1;
            for(int root = 0; root < n; ++ root) {
                int cnt = 0;
                for(int i = 0; i < n; ++ i) {
                    cnt += dist[root][i] <= k;
                }
                ans = max(ans, cnt);
            }
        }
        printf("%d\n", n - ans);
    }
     
    int main() {
        count();
        return 0;
    }

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

int main(){
  int n,ans=0,i;
  cin >> n;
  vector<int> v(n), c(n);
  for(i=0; i<n; i++){
    cin >> v[i];
  }
  for(i=0; i<n; i++){
    cin >> c[i];
    ans+=max(0,v[i]-c[i]);
  }
  cout << ans;
}

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

int *f[21][21];
int sum[21][1100010],nxt[1100010][21][2],n,k;
char s[21][1100010];

inline int rd()
{
	int x=0;char ch=getchar();
	for (;ch<'0'||ch>'9';ch=getchar());
	for (;ch>='0'&&ch<='9';ch=getchar()) x=x*10+ch-'0';
	return x;
}

int main()
{
	n=rd();k=rd();
	for (int i=0;i<=n;i++) scanf("%s",s[i]+1);
	for (int i=0;i<=n;i++) for (int j=0;j<=i;j++)
	{
		f[i][j]=new int[1<<i];
		memset(f[i][j],0,sizeof(int)*(1<<i));
	}
	for (int i=n;i;i--)
	{
		for (int j=0;j<(1<<i);j++) if (s[i][j+1]=='1') f[i][0][j]++;
		for (int j=0;j<(1<<i);j++)
		{
			nxt[j][i][0]=nxt[j][i][1]=i;
			for (int k=i-1;~k;k--)
			{
				nxt[j][k][0]=nxt[j][k+1][0];
				nxt[j][k][1]=nxt[j][k+1][1];
				if ((j>>k)&1) nxt[j][k][1]=k;
				else nxt[j][k][0]=k;
			}
		}
		for (int k=0;k<=i;k++) for (int j=0;j<(1<<i);j++)
		{
			if (k) sum[k][j&((1<<k)-1)]+=f[i][k][j];
			int hh=nxt[j][k][0];
			if (hh<i) f[i-(hh-k)][k+1][(j&((1<<k)-1))+(j>>(hh+1)<<(k+1))]+=f[i][k][j];
			hh=nxt[j][k][1];
			if (hh<i) f[i-(hh-k)][k+1][(j&((1<<k)-1))+(j>>(hh+1)<<(k+1))+(1<<k)]+=f[i][k][j];
		}
		for (int j=0;j<(1<<i);j++) if (sum[i][j]>=k)
		{
			for (int l=i-1;~l;l--) putchar(((j>>l)&1)+'0');
			putchar('\n');
			return 0;
		}
	}
	return 0;
}

Measured memory_bytes: 408576
#include<bits/stdc++.h>
using namespace std;
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC optimize ("-ffloat-store")  
#pragma GCC optimize ("-fno-defer-pop")
#define all(a) a.begin(),a.end()
#define bs binary_search
#define ll long long int
#define ld long double
ll power(ll a,ll b,ll m){ if(b==0) return 1; if(b==1) return a%m; ll t=power(a,b/2,m)%m; t=(t*t)%m; if(b&1) t=((t%m)*(a%m))%m; return t;}
ll modInverse(ll a, ll m) { return power(a, m-2, m); }
#define ipr pair<ll,ll>
#define ps push_back
#define fs first
#define sc second
#define mkp make_pair
#define mod 1000000007
int main(){
	
	ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
	
	ll i,j,k,l,r,n,a,b,m;
	cin>>n>>a>>b;
	ll h[n],s=0;
	for(i=0;i<n;i++){
		cin>>h[i];
		if(h[i]>s){
			s=h[i];
		}
	}
	l=1; r=s/b+1;

	ll an=-1;
	while(r>l){
		//cout<<l<<" "<<r<<endl;
		m=(r+l)/2;
		ll c=0;
		for(i=0;i<n;i++){
			k=max((ll)0,(h[i]-m*b));
			if(k%(a-b)==0) c+=(k/(a-b));
			else c+=(k/(a-b)+1);
		}
		if(c<=m){
			r=m;
		}
		else l=m+1;
	}
	cout<<r;
	return 0;
}


Measured memory_bytes: 1024
#include <algorithm>
#include <cmath>
#include <cstdint>
#include <cstdio>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
using namespace std;
#define rep(i, n) for(int(i) = 0; (i) < (n); (i)++)
#define FOR(i, m, n) for(int(i) = (m); (i) < (n); (i)++)
#define All(v) (v).begin(), (v).end()
#define pb push_back
#define MP(a, b) make_pair((a), (b))
using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
const int INF = 1 << 30;
const ll LINF = 1LL << 60;
const int MOD = 1e9 + 7;

int main() {
    int N;
    cin >> N;
    int x = N * 800;
    int y = 200 * (N / 15);
    cout << x - y << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define REV(v) reverse(v.begin(), v.end());
#define REP(i, n) for (ll i = 0; i < n; i++)
#define REPR(i, n) for (ll i = n; i >= 0; i--)
#define FOR(i, start, stop) for (ll i = start; i < stop; i++)
#define FORR(i, start, stop) for (ll i = start; i > stop; i--)
#define SORT(v, n) sort(v, v + n);
#define SORTR(v, n) sort(v, v + n,greater<ll>());
#define VSORT(v) sort(v.begin(), v.end());
#define VSORTR(v) sort(v.begin(), v.end(),greater<ll>());
#define REMOVE(v,n) remove(vector<ll> v,v+v.size(),ll n)
#define ERASE(v,n) v.erase(v.begin()+n);
#define ull unsigned long long
#define pb(a) push_back(a)
#define INF 999999999
#define V(v,i,j) vector(v.begin() + i, v.begin() + j)
#define INSERT(va,vb) va.insert(va.end(), vb.begin(), vb.end())
using namespace std;
typedef vector<ll> vll;
typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef pair<int, P> PP;
typedef pair<ll, LP> LPP;
int dy[] = {0, 0, 1, -1};
int dx[] = {1, -1, 0, 0};
const int MOD = 1000000007;
void chmin(int &a, int b) { if (a > b) a = b; }
//string al="abcdefghijklmnopqrstuvwxyz";
//vector< vector<int> > v (size1, vector<int>(size2) );

vector<pair<long long, long long> > prime_factorize(long long n) {
    vector<pair<long long, long long> > res;
    for (long long p = 2; p * p <= n; ++p) {
        if (n % p != 0) continue;
        int num = 0;
        while (n % p == 0) { ++num; n /= p; }
        res.push_back(make_pair(p, num));
    }
    if (n != 1) res.push_back(make_pair(n, 1));
    return res;
}



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

    ll A,B;
    cin>>A>>B;

    vector<pair<long long, long long> >pf = prime_factorize(A);

    ll ans=0;

    FOR(i,0,pf.size()){
        if(B%pf[i].first==0)ans++;
    }
    ans++;
    
    cout<<ans<<endl;
    
}

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

using namespace std;

int h[21];

int main(void) {
  int N; cin >> N;
  for (int i = 0; i < N; i++)
    cin >> h[i];

  int c = 0;
  for (int i = 0; i < N; i++) {
    bool flag = true;
    for (int j = 0; j < i; j++) {
      if (h[j] > h[i]) {
        flag = false;
        break;
      }
    }
    c += flag ? 1: 0;
  }

  cout << c << endl;

  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include<vector>
#include<algorithm>
#include <queue>
#include <string>
#include <set>
#include <bitset>
#include<iomanip>

using namespace std;
#define ff(ii,nn,mm) for(int ii=nn;ii<mm;ii++)
#define i64 int64_t
#define tos(x) to_string(x)

int main() {
	string a, b;;
	cin >> a >> b;
	char c[6];
	c[0] = a[0];
	c[1] = a[1];
	c[2] = a[2];
	c[3] = b[0];
	c[4] = b[1];
	c[5] = b[2];
	ff(i, 0, 3) {
		if (c[i] != c[5 - i]) {
			cout << "NO" << endl;
			return 0;
		}
	}
	cout << "YES" << endl;
	return 0;
}



Measured memory_bytes: 256
#include <algorithm>
#include <cmath>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <tuple>
#include <vector>
using namespace std;
typedef long long ll;

int main() {
  ll N, M;
  cin >> N >> M;
  vector<pair<int, int>> ans;
  if (N % 2 == 1) {
    for (int l = 1, r = N - 1; l < r; l++, r--) {
      ans.emplace_back(l, r);
    }
  } else {
    bool flag = false;
    for (int l = 1, r = N - 1; l < r; l++, r--) {
      if (!flag && r - l <= N / 2) {
        --r;
        flag = true;
      }
      ans.emplace_back(l, r);
    }
  }
  for (int i = 0; i < M; i++) {
    printf("%d %d\n", ans[i].first, ans[i].second);
  }
  return 0;
}

Measured memory_bytes: 4256
N = int(input())
A = 0
ans=0
Oans=5*(10**11)
flag=0

if N%2 == 0:
    A = N//2
else:
    A = (N-1)//2
#print(A)

for i in range(A):
    #print(N/(i+2))
    #print(i+2)
    if N%(i+2) == 0:
        
        ans = i+1 + N/(i+2)-1
        flag = 1
        if Oans < ans:
            ans = Oans
        else:
            Oans = ans
    else:
        if N/(i+2) > i+2:
            continue
        else:
            break
        
if flag == 1:
    print(int(ans))
else:
    print(N-1)


Measured memory_bytes: 3064
#include <iostream>
#include <string>
#include <cmath>
#include <cstdlib>
#include <vector>
#include <algorithm>

using namespace std;

int main()
{
	string a, b, c;
	cin >> a >> b >> c;
	string rgb = a + b + c;
	int abc = stoi(rgb);

	if (abc % 4 == 0) {
		cout << "YES" << endl;
		return 0;
	}
	cout << "NO" << endl;
	return 0;

}


Measured memory_bytes: 256
#include<iostream>
#include<iomanip>
#include<map>
#include<unordered_map>
#include<set>
#include<unordered_set>
#include<vector>
#include<array>
#include<string>
#include<stack>
#include<queue>
#include<algorithm>
#include<cassert>
#include<functional>
#include<random>
#include<complex>
//#include<boost/multiprecision/cpp_int.hpp>
#define int int64_t
#define REP(i, a, b) for (int64_t i = (int64_t)(a); i < (int64_t)(b); i++)
#define rep(i, a) REP(i, 0, a)
#define EACH(i, a) for (auto i: a)
#define ITR(x, a) for (auto x = a.begin(); x != a.end(); x++)
#define ALL(a) (a.begin()), (a.end())
#define HAS(a, x) (a.find(x) != a.end())
#define Min(x) *min_element(ALL(x))
#define Max(x) *max_element(ALL(x))
#define Unique(L) (L.erase(unique(ALL(L)), L.end()))
using namespace std;
//typedef boost::multiprecision::cpp_int bigint;
const double EPS = 1e-9;
const double PI = acos(-1.0);

int solve(int N, int K) {
	vector<int>P(N);
	rep(i, N)P[i] = i;
	int ans = 0;
	do {
		int flag = 1;
		rep(i, N)if (abs(P[i] - i) == K) { flag = 0; break; }
		ans += flag;
		ans %= 924844033;

	} while (next_permutation(ALL(P)));
	return ans;
}

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

	
	int T;
	cin >> T;
	rep(t, T) {
		int N, D;
		cin >> N >> D;
		cout << (N - 1) * 127 + (N % 2 ? D : (D ^ 127)) << endl;
	}
}

Measured memory_bytes: 256
#include <stdio.h>
 
double area3(double x1, double y1, double x2, double y2, double x3, double y3)
{
    double a, b, c, x;
 
    a = sqrt((x1-x2)*(x1-x2)+(y1-y2)*(y1-y2));
    b = sqrt((x1-x3)*(x1-x3)+(y1-y3)*(y1-y3));
    c = sqrt((x2-x3)*(x2-x3)+(y2-y3)*(y2-y3));
    x = (a+b+c)/2;
    return sqrt(x*(x-a)*(x-b)*(x-c));
}
 
int main()
{
    double x0, y0, x1, y1, x2, y2;
    double s=0;
 
    scanf("%lf,%lf", &x0, &y0);
    scanf("%lf,%lf", &x1, &y1);
    
    while (scanf("%lf,%lf", &x2,&y2)==2) {
        s+=area3(x0, y0, x1, y1, x2, y2);
        x1=x2;
        y1=y2;
    }
    printf("%lf\n", s);
    return 0;
}



Measured memory_bytes: 2108
// #define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define rep(i, n) for (int i = 0; i < n; ++i)
#define REP(i, n) for (int i = 0; i < n; ++i)
#define range(i,a,b) ((a)<=(i) && (i)<(b))
#define debug(x) cout << #x << ' ' << '=' << ' ' << (x) << endl;
#define fs first
#define sc second
#define pb push_back
#define eb emplace_back
typedef long long ll;
typedef pair<ll, ll> P;
typedef tuple<ll, ll, ll> T;
typedef vector<ll> vec;
typedef vector<P> pvec;
typedef vector<vector<ll>> vvec;
typedef vector<vector<P>> pvvec;
typedef priority_queue<ll> PQI;
typedef priority_queue<P> PQP;
const vector<int> dx = {0, -1, 0, 1, 1, 1, -1, -1};
const vector<int> dy = {1, 0, -1, 0, 1, -1, 1, -1};
const int MOD = (1000000007);
// const int MOD = (998244353);
// const int INF = (1 << 30);
const int INF = (1LL << 60);
const double EPS = (1 >> 30);
template<class T> inline bool chmin(T& a, T b) {if (a > b) {a = b; return 1;} return 0;}
template<class T> inline bool chmax(T& a, T b) {if (a < b) {a = b; return 1;} return 0;}

int n,k;
vec a;
vec f;
int ans=INF;
bool check(int mid){ // a*fがmid以下にするためにaを減らす、減らしたカウントとkを比べる
    //cout<<mid<<" ";
    int cnt=0;
    int ansmemo=0;
    rep(i,n){
        if(a[i]*f[i]<=mid){
            chmin(ansmemo,a[i]*f[i]);
            continue;
        }
        int memo=mid/f[i];
        cnt+=a[i]-memo;
        chmax(ansmemo,(a[i]-memo)*f[i]);
    }
    if(cnt>k) return false;
    else{
        chmin(ans,ansmemo);
        return true;
    }
}

signed main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << fixed << setprecision(15);
    //---------------------------------------------
    
    cin>>n>>k;
    a.resize(n);
    f.resize(n);
    rep(i,n) cin>>a[i];
    rep(i,n) cin>>f[i];
    sort(rall(a)); // 重い順
    sort(all(f)); // 軽い順
    int ng = -1, ok = INF;
    while (abs(ng-ok)>1) {
      int mid = ng+(ok-ng)/2;
      (check(mid)?ok:ng) = mid;
    }
    //debug(ng);
    //debug(ok);
    //cout<<ans<<endl;
    cout<<ok<<endl;
}

Measured memory_bytes: 3456
#include <bits/stdc++.h>
using namespace std;
int main() {
    string s; cin >> s;
    for (int i = 0; i < s.size(); i++) {
        if (i & 1) {
            if (s[i] == 'R') {
                cout << "No" << endl;
                return 0;
            }
        } else {
            if (s[i] == 'L') {
                cout << "No" << endl;
                return 0;
            }
        }
    }
    cout << "Yes" << endl;
    return 0;
}

Measured memory_bytes: 256
package main

import (
	"bufio"
	"fmt"
	"log"
	"os"
	"strconv"
)

// const abcd = "abcdefghijklmnopqrstuvwxyz"
// const ABCD = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"

// var dy = [...]int{1, 1, 0, -1, -1, -1, 0, 1}
// var dx = [...]int{0, 1, 1, 1, 0, -1, -1, -1}

// var dx = [...]int{0, 1, 0, -1}
// var dy = [...]int{1, 0, -1, 0}

var inf int = 1e13
var mod = 1000000007

// ---------------------------------------------------------
func main() {
	log.SetFlags(log.Lshortfile)
	next := newScanner()
	a := next.Int()
	b := next.Int()
	ans := "Impossible"
	if a%3 == 0 || b%3 == 0 || (a+b)%3 == 0 {
		ans = "Possible"
	}

	fmt.Println(ans)
}

// ---------------------------------------------------------

// Pair is liked C++ pair
type Pair struct {
	a, b int
}

// Pairs is sorted by []Pair struct
type Pairs []Pair

func (p Pairs) Len() int {
	return len(p)
}
func (p Pairs) Swap(i, j int) {
	p[i], p[j] = p[j], p[i]
}

func (p Pairs) Less(i, j int) bool {
	if p[i].a < p[j].a {
		return true
	} else if p[i].a == p[j].a {
		return p[i].b < p[j].b
	}
	return false
}

// -------------------------------
func in(c, a, z int) bool {
	return c >= a && c < z
}

func btoi(b bool) int {
	if b {
		return 1
	}
	return 0
}

func itob(a int) bool {
	if a == 0 {
		return false
	}
	return true
}

func max(a ...int) int {
	r := a[0]
	for i := 0; i < len(a); i++ {
		if r < a[i] {
			r = a[i]
		}
	}
	return r
}

func sum(a ...int) int {
	r := a[0]
	if len(a) > 1 {
		for i := 1; i < len(a); i++ {
			r += a[i]
		}
	}
	return r
}

func min(a ...int) int {
	r := a[0]
	for i := 0; i < len(a); i++ {
		if r > a[i] {
			r = a[i]
		}
	}
	return r
}

func minmax(a, b int) (int, int) {
	if a > b {
		return b, a
	}
	return a, b
}

func abs(a int) int {
	if a < 0 {
		return -a
	}
	return a
}

// ---------- buffered scanner -----------------------------------------
type scanner struct {
	r   *bufio.Reader
	buf []byte
	p   int
}

func newScanner() *scanner {
	rdr := bufio.NewReaderSize(os.Stdin, 10000)
	return &scanner{r: rdr}
}
func (s *scanner) next() string {
	s.pre()
	start := s.p
	for ; s.p < len(s.buf); s.p++ {
		if s.buf[s.p] == ' ' {
			break
		}
	}
	result := string(s.buf[start:s.p])
	s.p++
	return result
}
func (s *scanner) Line() string {
	s.pre()
	start := s.p
	s.p = len(s.buf)
	return string(s.buf[start:])
}
func (s *scanner) Int() int {
	v, _ := strconv.Atoi(s.next())
	return v
}
func (s *scanner) Int64() int64 {
	v, _ := strconv.ParseInt(s.next(), 10, 64)
	return v
}
func (s *scanner) pre() {
	if s.p >= len(s.buf) {
		s.readLine()
		s.p = 0
	}
}
func (s *scanner) readLine() {
	s.buf = make([]byte, 0)
	for {
		l, p, e := s.r.ReadLine()
		if e != nil {
			panic(e)
		}
		s.buf = append(s.buf, l...)
		if !p {
			break
		}
	}
}


Measured memory_bytes: 640
#include "bits/stdc++.h"
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
typedef pair<P,ll> Pll;
typedef pair<P,P> PP;
#define rep(i,a,n) for(ll i = a;i < n;i++)
#define repr(i,a,n) for(ll i = n-1;i >= a;i--)
#define LINF (ll)1e17
#define INF (int)1e9
#define MOD (ll)1e9+7
#define sMOD 1e5
#define fs first
#define sc second

ll gcd(ll a,ll b){
	if(!b) return a;
	return gcd(b,a%b);
	
}

signed main(){
	ll n;
	cin >> n;
	if(n % 2) cout << (double)(n/2+1)/(double)n << endl;
	else cout << (double)(n/2)/(double)n << endl;
    return 0;
}

Measured memory_bytes: 256
n, x = map(int, raw_input().split())
ais = map(int, raw_input().split())


q= sum([ai - min(x,ai) for ai in ais])

ais = [min(x,ai) for ai in ais]

for ii in range(1,len(ais)):
	if ais[ii] + ais[ii-1] > x:
		q += ais[ii] + ais[ii-1] - x
		ais[ii] -= ais[ii] + ais[ii-1] - x
print q

Measured memory_bytes: 89564
#include<cstdio>
#include<cstring>
#include<cmath>
typedef struct{
  int R;
  int G;
  int B;
  char name[16];
} color;
int main(void){
  char s[16], r[3], g[3], b[3];
  int rk, gk, bk, n;
  double dk, min;
  color c[8];
  c[0].R = c[0].G = c[0].B = c[1].R = c[1].G = c[2].R = c[2].B = c[3].R = c[4].G = c[4].B = c[5].G = c[6].B = 0;
  c[1].B = c[2].G = c[3].G = c[3].B = c[4].R = c[5].R = c[5].B = c[6].R = c[6].G = c[7].R = c[7].G = c[7].B = 255;
  strcpy(c[0].name, "black"); strcpy(c[1].name, "blue"); strcpy(c[2].name, "lime"); strcpy(c[3].name, "aqua"); strcpy(c[4].name, "red"); strcpy(c[5].name, "fuchsia"); strcpy(c[6].name, "yellow"); strcpy(c[7].name, "white");
  for( ; ; ){
    scanf("%s", s);
    if(s[0] == '0') break;
    r[2] = g[2] = b[2] = '\0';
    r[0] = s[1]; r[1] = s[2]; g[0] = s[3]; g[1] = s[4]; b[0] = s[5]; b[1] = s[6];
    sscanf(r, "%x", &rk); sscanf(g, "%x", &gk); sscanf(b, "%x", &bk);
    for(int i = 0;i < 8; i++){
      dk = sqrt(pow(c[i].R - rk, 2) + pow(c[i].G - gk, 2) + pow(c[i].B - bk, 2));
      if(i == 0) min = dk, n = i;
      else{
	if(dk < min)
	  min = dk, n = i;
      }
    }
    printf("%s\n", c[n].name);
  }
}


Measured memory_bytes: 1024
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <cmath>
using namespace std;
using ll = long long;

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

    cout << a + b / 2 << endl;

    return 0;
}

Measured memory_bytes: 256