akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
 
using namespace __gnu_pbds;
using namespace std;
     
#define mp make_pair
#define sz(x) (int)((x).size())
#define all(x) (x).begin(),(x).end()
#define FO(x) {freopen(#x".in","r",stdin);freopen(#x".out","w",stdout);}
#define eb emplace_back
 
typedef pair< int, int > pii;
typedef pair< long long, long long > pll;
typedef long long ll;
typedef unsigned long long ull;
typedef vector< int > vi;
typedef vector< vi > vvi;
typedef vector< ll > vll;
typedef vector< vll > vvll;
typedef vector< pii > vpii;
typedef vector< vpii > vvpii;
typedef vector< pll > vpll;
typedef long double ld;
typedef vector< ld > vld;
typedef unsigned int uint;
 
const ll MOD2 = 1e9 + 7;
const int MOD = 1e9 + 7;
 
const ull infull = numeric_limits<unsigned long long>::max();
 
void fix(int &x, ll MOD) {
    x = (x % MOD);
    if(x < 0) x += MOD;
    return;
}
 
ll lgput(ll a, ll b, ll MOD) {
    ll ret = 1;
    a %= MOD;
    while(b) {
        if(b&1) ret = ret*a % MOD;
        a = a*a % MOD;
        b >>= 1;
    }
 
    return ret;
}
 
ll inv(ll a, ll MOD) {
    return lgput(a, MOD-2, MOD);
}
 
template <uint MD> struct ModInt {
    using M = ModInt;
    const static M G;
    uint v;
    ModInt(ll _v = 0) { set_v(uint(_v % MD + MD)); }
    M& set_v(uint _v) {
        v = (_v < MD) ? _v : _v - MD;
        return *this;
    }
    explicit operator bool() const { return v != 0; }
    M operator-() const { return M() - *this; }
    M operator+(const M& r) const { return M().set_v(v + r.v); }
    M operator-(const M& r) const { return M().set_v(v + MD - r.v); }
    M operator*(const M& r) const { return M().set_v(uint(ull(v) * r.v % MD)); }
    M operator/(const M& r) const { return *this * r.inv(); }
    M& operator+=(const M& r) { return *this = *this + r; }
    M& operator-=(const M& r) { return *this = *this - r; }
    M& operator*=(const M& r) { return *this = *this * r; }
    M& operator/=(const M& r) { return *this = *this / r; }
    bool operator==(const M& r) const { return v == r.v; }
    const bool operator<(const M& o) const {return v < o.v; }
    M pow(ll n) const {
        M x = *this, r = 1;
        while (n) {
            if (n & 1) r *= x;
            x *= x;
            n >>= 1;
        }
        return r;
    }
    M inv() const { return pow(MD - 2); }
    friend ostream& operator<<(ostream& os, const M& r) { return os << r.v; }
};
 
using Mint = ModInt<(int)1e9 + 7>;
 
int main() { 
    #ifdef BLAT
        freopen("stdin", "r", stdin);
        freopen("stderr", "w", stderr);
    #endif
 
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    cout.precision(12);
    srand(time(NULL));
    
    
    string s;
    cin >> s;

    for(auto &x : s) {
        if(x == '7') return puts("Yes"), 0;
    }

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

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

using namespace std;

#define PB push_back
#define f first
#define s second

typedef long long ll;
typedef pair<ll, ll> pll;
typedef pair<int, int> pii;

//int dr1[] = {-1, 0, 1, 0};
//int dc1[] = {0, 1, 0, -1};
//int dr3[] = {0, 1, 2, 3, 2, 1, 0, -1, -2, -3, -2, -1, -1, 1, 0, 0};
//int dc3[] = {3, 2, 1, 0, -1, -2, -3, -2, -1, 0, 1, 2, 0, 0, -1, 1};
const int MOD = 1000000007;
const int INF = 1000000007;
const int MAXN = (int)3e5+1;

void setIO(string name)
{
	freopen((name+".in").c_str(),"r",stdin);
	freopen((name+".out").c_str(),"w",stdout);
}

int main()
{
    ios_base::sync_with_stdio(0); cin.tie(0);
    //setIO("");
    int n;
    cin >> n;
    map<ll, ll> cts;
    ll arr[n];
    for(int i=0; i<n; i++)
    {
        cin >> arr[i];
        cts[arr[i]]++;

    }
    ll sum = 0;
    for(auto a = cts.begin(); a != cts.end(); a++)
    {
        ll num = a->s;
        sum += num*(num-1)/2;
    }
    for(int i=0; i<n; i++)
    {
        cout << sum - (cts[arr[i]] - 1) << "\n";
    }


    return 0;
}



Measured memory_bytes: 13056
#include<bits/stdc++.h>
using namespace std;
#define N 200010
#define ll long long
const ll mod=1e9+7;

struct node
{
    int s,t,x;
    bool operator < (const node& b)const
    {
        return x>b.x;
    }
}a[N];
bool cmp(node a,node b)
{
    return a.s<b.s;
}
priority_queue<node>q;
int d[N];
int main()
{
    int n,m;
    scanf("%d%d",&n,&m);
    for(int i=1;i<=n;i++)
    {
        scanf("%d%d%d",&a[i].s,&a[i].t,&a[i].x);
        a[i].s-=a[i].x,a[i].t-=a[i].x;
    }
    for(int i=1;i<=m;i++)scanf("%d",&d[i]);
    sort(a+1,a+1+n,cmp);
    int t=1,flag;
    for(int i=1;i<=m;i++)
    {
        flag=0;
        while(d[i]>=a[t].s && t<=n)
            q.push(a[t++]);

        while(q.size())
        {
            node p=q.top();
            if(d[i]>=p.t){q.pop();continue;}
            flag=1;
            printf("%d\n",p.x);
            break;
        }
        if(!flag)printf("-1\n");
    }
    return 0;
}


Measured memory_bytes: 6896
def ii():return int(input())
def iim():return map(int,input().split())
def iil():return list(map(int,input().split()))
def ism():return map(str,input().split())
def isl():return list(map(str,input().split()))

k,a,b = iim()
if k == 1 or b-a <= 2:
    print(1+k)
else:
    rem = k-a-1
    if rem%2 == 0:
        print(b+(b-a)*(rem//2))
    else:
        print(b+(b-a)*(rem//2)+1)


Measured memory_bytes: 3064
#include <bits/stdc++.h>
template <typename T>
class SegmentTreeUpdMax {
    int n;
    const T inf_min = std::numeric_limits<T>::min();
    std::vector<T> node;
public:
    SegmentTreeUpdMax(std::vector<T> v) {
        int sz = v.size();
        n = 1; while(n < sz) n *= 2;
        node.resize(2*n, inf_min);
        for(int i=0;i<sz;++i) node[i+n-1] = v[i];
        for(int i=n-2;i>=0;--i) node[i] = std::max(node[2*i+1], node[2*i+2]);
    }
    void update(int idx, T val) {
        assert(0 <= idx && idx < n);
        node[idx + n - 1] = val;
        idx = idx + n - 1;
        while(idx > 0) {
            idx = (idx - 1) / 2;
            node[idx] = std::max(node[2*idx + 1], node[2 * idx + 2]);
        }
    }
    T query(int a, int b, int k, int l, int r) {
        if(r <= a || b <= l) return inf_min;
        if(a <= l && r <= b) return node[k];
        T vl = query(a, b, k*2+1, l, ((l+r)/2));
        T vr = query(a, b, k*2+2, (l+r)/2, r);
        return std::max(vl, vr);
    }
    T query(int a, int b) {
        return query(a, b, 0, 0, n);
    }
};
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<int, int>;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
const double eps = 1e-10;
const ll MOD = 1000000007;
const int INF = 1000000000;
const ll LINF = 1ll<<50;
template<typename T>
void printv(const vector<T>& s) {
  for(int i=0;i<(int)(s.size());++i) {
    cout << s[i];
    if(i == (int)(s.size())-1) cout << endl;
    else cout << " ";
  }
}
template<typename T1, typename T2>
ostream& operator<<(ostream &os, const pair<T1, T2> p) {
  os << p.first << ":" << p.second;
  return os;
}
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(10);
  ll n; cin >> n;
  vll x(n);
  for(int i=0;i<n;++i) {
    cin >> x[i];
  }
  vll node(n+1);
  SegmentTreeUpdMax<ll> st(node);
  for(int i=0;i<n;++i) {
    ll tmp = x[i] + st.query(0, x[i]);
    st.update(x[i], tmp);
  }
  ll mi = LINF;
  for(int i=1;i<=n+1;++i) {
    mi = min(mi, (ll)(n * (n + 1) / 2 - st.query(0, i)));
  }
  cout << mi << endl;
}



Measured memory_bytes: 7380
#include <iostream>
#include <algorithm>
#include <iomanip>
#include <vector>

using namespace std;

int main(){
  int n;
  cin >> n;
  vector <double> a(n);
  for (int i = 0; i < n; i++) cin >> a[i];
  sort(a.begin(),a.end());
  double avg = a[0];
  for (int i = 1; i < n; i++){
    avg = (avg + a[i])/2;
  }
  cout << setprecision(7) << setiosflags(ios::fixed) << setiosflags(ios::showpoint) << avg;
}

Measured memory_bytes: 256
from collections import Counter
s = input()
n = len(s)
ls = [0,int(s[-1])]
for i in range(n-1)[::-1]:
  ls.append((int(s[i])*pow(10,n-i-1,2019)+ls[-1])%2019)
c = Counter(ls)
ans = 0
for x in c.values():
  ans += x*(x-1)//2
print(ans)

Measured memory_bytes: 78368
#include<iostream>
#include<algorithm>
using lint=int64_t;
using namespace std;

int main()
{
	int N,K,Q;
	int A[100010]={};
	lint point[100010]={};

	cin >> N >> K >> Q;
	for(int i=0;i<Q;i++)
	{
		cin >> A[i];
		A[i]--;
	}

	for(int i=0;i<Q;i++)
		point[A[i]]++;
	
	for(int i=0;i<N;i++)
	{
		if(point[i]+K-Q>0)
			cout << "Yes";
		else
			cout << "No";
		cout << endl;
	}
	return 0;
}



Measured memory_bytes: 1792
#include <iostream>
#include <vector>
#include <stack>
#include <algorithm>
#include <numeric>
#include <unordered_map>
#include <cmath>
#include <iomanip>
#include <map>
#include <unordered_set>

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

using namespace std;
using ll = long long;
using P = pair<int,int>;
ll gcd(ll a, ll b) { return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b) { return a/gcd(a,b)*b;}

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;
}
template <typename T>
T GCD(T x, T y)
{
    return (y ? GCD<T>(y, x % y) : x);
}

struct Item{
    Item(ll num, unordered_set<int> us) : num(num), us(us){};
    ll num;
    unordered_set<int> us;
};

vector<Item> number;

void dfs(Item input){
    if(input.num<1e9) {
        if(input.us.count(3)!=0 and input.us.count(5)!=0 and input.us.count(7)!=0)
            number.push_back(input);
    }
    else
        return;

    unordered_set<int> tmp = input.us;
    tmp.insert(3);
    dfs(Item(10*input.num+3, tmp));
    tmp = input.us;
    tmp.insert(5);

    dfs(Item(10*input.num+5, tmp));

    tmp = input.us;
    tmp.insert(7);
    dfs(Item(10*input.num+7, tmp));
}
int main() {
    ll N;
    cin>>N;
    dfs(Item(0, unordered_set<int>{}));
    int answer=0;
    for(auto& num : number){
        if(num.num>N)
            continue;
        answer++;
    }

    cout<<answer<<endl;
}



Measured memory_bytes: 5616
fun main(args: Array<String>) {
    diverta2019b()
}

fun diverta2019b() {
    val (r, g, b, n) = readLine()!!.split(' ').map { it.toInt() }

    val answer = (0..n).map { ri ->
        (0..n).count { gi ->
            val bi = (n - r * ri - g * gi)
            bi >= 0 && bi % b == 0
        }
    }.sum()

    println(answer)
}


Measured memory_bytes: 40612
#include<cstdio>
#include<vector>
#include<queue>
using namespace std;
const int MAX = 100000 + 10;
vector<int> v[MAX];
int deg[MAX];
int par[MAX];
int main () {
    int n, m;
    scanf("%d %d", &n, &m);
    for(int i = 0 ; i < n-1+m ; i++) {
        int x, y;
        scanf("%d %d", &x, &y);
        v[x].push_back(y);
        deg[y]++;
    }
    queue<int> q;
    for(int i = 1 ; i <= n ; i++) {
        if(deg[i] == 0) q.push(i);
    }
    while(!q.empty()) {
        int tmp = q.front();
        q.pop();
        for(auto e: v[tmp]) {
            deg[e]--;
            par[e] = tmp;
            if(deg[e] == 0) q.push(e);
        }
    }
    for(int i= 1 ; i <= n ; i++) {
        printf("%d\n", par[i]);
    }
    return 0;
}


Measured memory_bytes: 7040
//
// Created by yamunaku on 2019/10/15.
//

#include <bits/stdc++.h>

using namespace std;

#define rep(i, n) for(int i = 0; i < (n); i++)
#define repl(i, l, r) for(int i = (l); i < (r); i++)
#define per(i, n) for(int i = ((n)-1); i >= 0; i--)
#define perl(i, l, r) for(int i = ((r)-1); i >= (l); i--)
#define all(x) (x).begin(),(x).end()
#define MOD9 998244353
#define MOD1 1000000007
#define IINF 1000000000
#define LINF 1000000000000000000
#define SP <<" "<<
#define CYES cout<<"Yes"<<endl
#define CNO cout<<"No"<<endl
#define CFS cin.tie(0);ios::sync_with_stdio(false)
#define CST(x) cout<<fixed<<setprecision(x)

typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<vector<int>> mti;
typedef vector<ll> vl;
typedef vector<vector<ll>> mtl;

int main(){
    int l;
    string s;
    cin >> l >> s;

    int ans = 0;
    rep(i, l){
        if(s[i]!='.') continue;
        int x = 0, y = 0;
        int xl = l, yl = 0;
        repl(k, i + 1, l){
            xl = k;
            if(s[k] == 'B'){
                x = 1;
                break;
            }else if(s[k] == '.'){
                break;
            }
        }
        per(k, i){
            yl = k;
            if(s[k] == 'B'){
                y = 1;
                break;
            }else if(s[k] == '.'){
                break;
            }
        }
        if(x == 1 && y == 1) continue;
        int tmp = 0;
        int tmp2 = 0;
        bool ok=false;
        repl(k, i+1, l){
            if(s[k]=='.'){
                tmp = 0;
                break;
            }else if(s[k]=='W'){
                ok=true;
                break;
            }
            tmp++;
        }
        if(!ok) tmp=0;
        ok=false;
        per(k, i){
            if(s[k]=='.'){
                tmp2 = 0;
                break;
            }else if(s[k]=='W'){
                ok=true;
                break;
            }
            tmp2++;
        }
        if(!ok) tmp2=0;
        ans = max(ans, tmp + tmp2);
    }
    cout << ans << endl;
    return 0;
}



Measured memory_bytes: 3192
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;

int main( ){
    int n,ipt;
    long long ans;
    vector<int> v;
    
    ans = 0;
    
    cin>>n;
    for(int i=1;i<=n;i++){
        cin>>ipt;
        v.emplace_back(ipt);
    }
    sort(v.begin(), v.end());
    for(int i=0;i<v.size()-1;i++){
        for(int j=i+1;j<v.size();j++){
            ans += lower_bound(v.begin()+j, v.end(), v[i]+v[j]) - (v.begin()+j)-1;
        }
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <ctime>
#include <cassert>
#include <complex>
#include <string>
#include <cstring>
#include <chrono>
#include <random>
#include <queue>
#include <bitset>
#include <stack>
#include <functional>

#ifdef LOCAL
    #define eprintf(...) fprintf(stderr, __VA_ARGS__)
#else
    #define eprintf(...) 42
#endif

#define MPI 3.14159265359

#define rep_(i, a_, b_, a, b, ...) for (int i = (a), i##_len = (b); i < i##_len; ++i)
#define rep(i, ...) rep_(i, __VA_ARGS__, __VA_ARGS__, 0, __VA_ARGS__)
#define reprev_(i, a_, b_, a, b, ...) for (int i = (b-1), i##_min = (a); i >= i##_min; --i)
#define reprev(i, ...) reprev_(i, __VA_ARGS__, __VA_ARGS__, 0, __VA_ARGS__)
#define all(x) (x).begin(), (x).end()
template <class T> bool chmax(T &a, const T &b) { if (a < b) { a = b; return 1; } return 0; }
template <class T> bool chmin(T &a, const T &b) { if (b < a) { a = b; return 1; } return 0; }
// template <class T> T gcd(T a, T b) { return b ? gcd(b, a % b) : a; }
using namespace std;

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

int main (void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    double a, b, h, m; cin >> a >> b >> h >> m;
    double ha, ma;
    ha = 2.0* MPI/12.0*h+MPI/6.0/60.0*m;
    ma = 2.0*MPI/60.0*m;
    double angle = abs(ha-ma);
    double ans = a*a+b*b-2*a*b*cos(angle);
    printf("%.16lf\n", sqrt(ans));
    return 0;
}

Measured memory_bytes: 4236
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cassert>
#include <complex>
#include <cmath>
#include <algorithm>
#include <vector>
#include <string>
#include <cstdlib>
#include <cstring>
#include <iomanip>
#include <numeric>
#include <sstream>
#include <ctime>
#include <cctype>
#include <set>
#include <map>
#include <queue>
#include <bitset>
#include <deque>
#include <stack>
#include <memory.h>
using namespace std;
#define ll long long 
int main()
{
int n,m;
cin>>n>>m;
n--,m--;
cout<<n*m;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#pragma GCC target("avx")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
typedef long long ll;
typedef pair<ll,ll> pr;
typedef vector<ll> vc;
typedef unordered_map<ll,ll> umap;
#define pb emplace_back
#define rep(i,a,b) for(ll i=a;i<=b;i++)
#define repr(i,a,b) for(ll i=a;i>=b;i--)
#define reps(i,v) for(ll i=0;i<v.size();i++)
template<typename T> void chmin(T &a, const T &b) { a = min(a, b); }
template<typename T> void chmax(T &a, const T &b) { a = max(a, b); }
const ll mod = 1e9+7;

int main(){
	ll n, k, a[105], sum[105]={0}, dp[105][100005]={0}, rui[105][100005];
	cin >> n >> k;
	rep(i,1,n){
		cin >> a[i];
		sum[i] = sum[i-1] + a[i];
	}
	dp[0][0] = 1;
	rep(i,1,k+1) rui[0][i] = 1;
	rep(i,1,n){
		dp[i][0] = 1;
		rui[i][1] = 1;
		rep(j,1,min(sum[i],k)){
			dp[i][j] = (rui[i-1][j+1] - rui[i-1][max(0ll,j-a[i])] + mod) % mod;
			rui[i][j+1] = (rui[i][j] + dp[i][j]) % mod;
		}
		rep(j,min(sum[i],k)+1,k+1) rui[i][j+1] = rui[i][j];
	}
	cout << dp[n][k] << endl;
    return 0;
}


Measured memory_bytes: 164352
#include<stdio.h>
int main(void)
{
	int a,b,c,d,x,y,z;
	
	scanf("%d",&a);
	scanf("%d",&b);
	scanf("%d",&c);
	scanf("%d",&d);
	x=a+b+c+d;
	y=x/60;
	z=x%60;
	printf("%d\n",y);
	printf("%d\n",z);
	return 0;
}


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

using namespace std;

int const maxsize = 100005;

int weight[maxsize], cost[maxsize];
long long int dp[103][maxsize];


int main(){
	int n, w;
	cin>>n>>w;
	for(int x=1;x<=n;x++) cin>>weight[x]>>cost[x];
	memset(dp, 63, sizeof(dp));
	int ans = 0;
	// for(int x=0;x<=100000;x++) dp[0][x] = 0;
	// for(int x=0;x<=100;x++) dp[x][0] = 0;
	dp[0][0] = 0;
	for(int x=1;x<=n;x++) {
		for(int i=0; i < maxsize;i++) {
			dp[x][i] = dp[x-1][i];
			if(i-cost[x] >= 0) {
				dp[x][i] = min(dp[x-1][i], dp[x-1][i-cost[x]] + weight[x]);
			}
			//dp[x][i] = min(d, dp[x][i]);
			
		}
	}
	for(int x=0;x< maxsize;x++) if(dp[n][x] <= w) ans = max(ans, x);
	cout<<ans;
	return 0;
}

Measured memory_bytes: 80768
///bismillah_hir_rahmanir_rahim

#include<bits/stdc++.h>
using namespace std;
#define n 999999


int i,j,p,f;

int arr [n];

void seive ()
{

    //arr[0]=arr[1]=1;
    arr[2]=0;

    for (i=4; i<=n; i=i+2)
    {
        arr[i]=1;
    }

    for(i=3; i<=sqrt(n); i=i+2)
    {
        if(arr[i]==0)
        {
            for( j=i*i; j<=n; j=j+(2*i) )
            {
                arr[j]=1;

            }
        }
    }

//printf("%d\n",arr[5]);

//    for( p=2; p<=100; p++)
//    {
//        if(arr[p]==0)
//        {
//            printf("%d ",p);
//        }
//    }


}

int main()
{

    seive();

    int num,count,p;

    while ( scanf("%d",&num)==1)
    {
        count = 0;

        for( p=2; p<=num; p++)
        {
            if(arr[p]==0)
            {
                count++;
            }
        }
        printf("%d\n",count);
    }
    return 0;
}

Measured memory_bytes: 7116
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;++i)
#define rrep(i,n) for(int i=n-1;i>=0;--i)
#define fi first
#define se second
#define sz(x) (int)(x).size()
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
using namespace std;
using ll = long long;
using P = pair<int, int>;
template<typename T> inline bool chmax(T &a,T b){if(a<b){a=b;return 1;}return 0;}
template<typename T> inline bool chmin(T &a,T b){if(b<a){a=b;return 1;}return 0;}
template<typename T> vector<T> make_vec(size_t a){return vector<T>(a);}
template<typename T,typename... Ts>
auto make_vec(size_t a,Ts... ts){return vector<decltype(make_vec<T>(ts...))>(a,make_vec<T>(ts...));}
template<typename T,typename U,typename... V>
typename enable_if<is_same<T,U>::value>::type fill_v(U &u,const V... v){u=U(v...);}
template<typename T,typename U,typename... V>
typename enable_if<!is_same<T,U>::value>::type fill_v(U &u,const V... v){for(auto &e:u)fill_v<T>(e,v...);}

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

    int n;
    cin >> n;
    string s;
    cin >> s;
    stack<int> st;
    string ans;
    rep(i, n) {
        if (s[i] == '(') {
            st.push(1);
        } else {
            if (!st.empty()) st.pop();
            else ans += '(';
        }
    }
    ans += s;
    ans += string(st.size(), ')');
    cout << ans << endl;
}


Measured memory_bytes: 3588
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<map>
#include<queue>
#include<cmath>
#include <numeric>
#include<iomanip>
#include <cstdint>
#include<deque>
typedef long long ll;

using namespace std;

int main() {
	ll n, a, b, c, d, e;
	cin >> n >> a >> b >> c >> d >> e;
	vector<ll>v(5);
	v[0] = a; v[1] = b; v[2] = c; v[3] = d; v[4] = e;
	sort(v.begin(), v.end());
	ll ans = 0;
	if (n % v[0] != 0) {
		ans = n / v[0] + 1 + 4;
	}
	else {
		ans = n / v[0] + 4;
	}
	cout << ans << endl;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main (String args[]) throws Exception{
		Scanner scan = new Scanner(System.in);
		int s = scan.nextInt();
		int w = scan.nextInt();
		String ans = "safe";
		
		if(s <= w) {
			ans = "unsafe";
		}

		System.out.println(ans);
	}
}

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

using lint = long long;

int main() {
    ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
    int n, result = 0;
    cin >> n;
    for (int i = 1; i <= n; ++i) {
        int size = log10(i) + 1;
        if (size&1) result++;
    }
    cout << result << '\n';
}


Measured memory_bytes: 256
import java.util.Arrays;
import java.util.Scanner;
 
public class Main {
	public static void main (String[] args) {
		Scanner in = new Scanner(System.in);
		int h = in.nextInt();
	if(h>=30){
      System.out.println("Yes");
    }else{
    System.out.println("No");
    
    }
    }
}

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

if x <= 6:
    print(1)
elif x <= 11:
    print(2)
else:
    ans = (x // 11) * 2
    tmp = x % 11
    if tmp == 0:
        print(ans)
    elif tmp <= 6:
        print(ans+1)
    else:
        print(ans+2)

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

int main()
{
    int a, b;
    char op;

    while (true) {
        cin >> a >> op >> b;
        switch (op) {
            case '+':
                cout << a + b << endl;
                break;
            case '-':
                cout << a - b << endl;
                break;
            case '*':
                cout << a * b << endl;
                break;
            case '/':
                cout << a / b << endl;
                break;
            case '?':
                return 0;
        }
    }
}


Measured memory_bytes: 3088
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<algorithm>
 
typedef long long LL;
 
const int N=100005;
const int MOD=1000000007;
 
int n,k,jc[N],ny[N],ans,cnt,last[N];
struct edge{int to,next;}e[N*2];
 
int A(int n,int m)
{
    return n<m?0:(LL)jc[n]*ny[n-m]%MOD;
}
 
void addedge(int u,int v)
{
    e[++cnt].to=v;e[cnt].next=last[u];last[u]=cnt;
    e[++cnt].to=u;e[cnt].next=last[v];last[v]=cnt;
}
 
void dfs(int x,int fa)
{
    int deg=0;
    for (int i=last[x];i;i=e[i].next)
    {
        if (e[i].to==fa) continue;
        dfs(e[i].to,x);
        deg++;
    }
    if (!fa) ans=(LL)ans*A(k,deg+1)%MOD;
    else ans=(LL)ans*A(k-2,deg)%MOD;
}
 
int main()
{
    scanf("%d%d",&n,&k);
    for (int i=1;i<n;i++)
    {
        int x,y;scanf("%d%d",&x,&y);
        addedge(x,y);
    }
    jc[0]=jc[1]=ny[0]=ny[1]=1;
    for (int i=2;i<=std::max(n,k);i++) jc[i]=(LL)jc[i-1]*i%MOD,ny[i]=(LL)(MOD-MOD/i)*ny[MOD%i]%MOD;
    for (int i=2;i<=std::max(n,k);i++) ny[i]=(LL)ny[i-1]*ny[i]%MOD;
    ans=1;
    dfs(1,0);
    printf("%d\n",ans);
    return 0;
}

Measured memory_bytes: 6528
/// <reference path="node.d.ts" />
/// <reference path="lib.ts" />
function main(input) {
    var n = +input.shift();
    var a = [];
    for (var i = 0; i < n; ++i)
        a.push(+input.shift());
    var s = 0;
    var b = [0];
    for (var i = 0; i < n * 2; ++i) {
        s += a[i % n];
        b.push(s);
    }
    var x = 0, y = 0, z = 0;
    function part(i) {
        if (i === 0)
            return b[y] - b[x];
        if (i === 1)
            return b[z] - b[y];
        return b[x + n] - b[z];
    }
    var ans = 0;
    while (x < n) {
        while (1) {
            ++y;
            var w = z;
            while (part(0) > part(1) && part(2) >= part(0))
                ++z;
            if (part(2) < part(0)) {
                --y;
                z = w;
                break;
            }
        }
        ans = Math.max(part(0), ans);
        ++x;
    }
    console.log(ans);
}
/// <reference path="node.d.ts" />
/// <reference path="main.ts" />
(function () {
    process.stdin.resume();
    process.stdin.setEncoding('utf8');
    var input = '';
    process.stdin.on('data', function (chunk) {
        input += chunk;
    });
    process.stdin.on('end', function (chunk) {
        main(input.split(/\s+/));
    });
})();
// based on lodash
var _;
(function (_) {
    function floor(v) {
        return Math.floor(v);
    }
    _.floor = floor;
    function min(a) {
        return Math.min.apply(Math, a);
    }
    _.min = min;
    function max(a) {
        return Math.max.apply(Math, a);
    }
    _.max = max;
    function reduce(a, func, init) {
        var result = init;
        for (var i = 0; i < a.length; ++i)
            result = func(result, a[i]);
        return result;
    }
    _.reduce = reduce;
    function sortedIndex(a, v) {
        var s = 0, t = a.length;
        while (s < t) {
            var m = _.floor((s + t) / 2);
            if (a[m] < v)
                s = m + 1;
            else
                t = m;
        }
        return s;
    }
    _.sortedIndex = sortedIndex;
    function sum(a) {
        return reduce(a, function (result, v) { return result + v; }, 0);
    }
    _.sum = sum;
})(_ || (_ = {}));

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


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

	ll K;
	cin >> K;

	co("50");
	ll low = 49 + K / 50 - K % 50;
	ll high = low + 51;

	rep(i, 50) {
		if (i < K % 50) co(high);
		else co(low);
	}

	Would you please return 0;
}

Measured memory_bytes: 256
import java.io.InputStream;
import java.io.PrintStream;
import java.util.HashSet;
import java.util.Scanner;
import java.util.Set;

public class Main {

  public static void main(String[] args) {
    resolve(System.in, System.out);
  }

  static void resolve(InputStream is, PrintStream pw) {
    Scanner sc = new Scanner(is);
    String s = sc.next();
    Set<String> company = new HashSet<>();
    for (int i = 0; i < s.length(); i++) {
      company.add(String.valueOf(s.charAt(i)));
    }
    pw.println(company.size() >= 2 ? "Yes" : "No");
  }
}


Measured memory_bytes: 21844
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n; i++) //for文マクロ
#define all(obj) obj.begin(), obj.end()
#define fast                      \
    ios_base::sync_with_stdio(0); \
    cin.tie(0);                   \
    cout.tie(0);

using namespace std;

typedef unsigned long long ull;
typedef int long long ll;
constexpr ll bigNum = 1000000007;

signed main()
{
    fast;

    int n = 0;
    cin >> n;

    vector<double> vec(n);

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

    long double sumRev = 0;

    for (int i = 0; i < n; i++)
    {
        sumRev += (1.0 / vec[i]);
    }

    cout << (1.0 / sumRev);
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <iomanip>
using namespace std;
#define reps(i,s,n) for(int i = s; i < n; i++)
#define rep(i,n) reps(i,0,n)
#define Rreps(i,n,e) for(int i = n - 1; i >= e; --i)
#define Rrep(i,n) Rreps(i,n,0)
#define ALL(a) a.begin(), a.end()
#define fi first
#define se second
typedef long long ll;
typedef vector<ll> vec;
typedef vector<vec> mat;

ll N,M,H,W,K,Q,A,B;
string S;
const ll MOD = 998244353;
//const ll MOD = (1e+9) + 7;
const ll INF = 1LL<<60;
typedef pair<ll, ll> P;


int main() {
    cin>>N;
    long double ans = N * N * N;
    cout<<fixed<<setprecision(10)<<ans / 27.0<<endl;
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using static System.Console;

namespace AtCorder
{
	public class Program
	{
		public static void Main()
		{
			var s = ReadLine();
			var t = ReadLine();

			char temp;
			bool result = false;
			for(int i = 0; i<t.Length; i++)
			{
				temp = s[0];
				s = s.Remove(0, 1) + temp;
				if(t == s)
				{
					result = true;
					break;
				}
			}
			WriteLine(result ? "Yes" : "No");
		}
	}
}


Measured memory_bytes: 13140
#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;

#define  PI acos(-1.0)
#define casePrint(t) printf("Case %d: ",t);

using vi = vector<int>;
using pi = pair<int, int>;
using ll = long long;

typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update>Order_Set;

const int mxn = 2e5+10;
const int Mod = 1e9+7;

void solve()
{
    int a;
    cin>>a;
    cout<<a+(a*a)+(a*a*a)<<endl;
}

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

    int tc = 1;
    //cin>>tc;
    while(tc--) solve();

    return 0;
}


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

int main() {
	int N;
	cin >> N;
	char S[114514];
	int flag = 0;

	for (int i = 0; i < N; i++) {
		cin >> S[i];
	}
	for (int i = 0; i < N; i++) {
		if (S[i] == 'Y') {
			flag = 1;
			break;
		}
		else {
			flag = 0;
		}
	}

	if (flag == 1) {
			cout << "Four" << endl;
		}
	else {
			cout << "Three" << endl;
		}
	
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main() {
    int A, B;
    cin >> A >> B;
    
    bool can;
    
    if  (A > 8 || B > 8) can = false;
    else can = true;
    
    if (can) cout << "Yay!" << endl;
    else cout << ":(" << endl;
}

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

using namespace std;

using Weight=long long;

struct Edge{
    int src,dst;
    Edge(int src,int dst):
    src(src),dst(dst){}
};

using Edges=vector<Edge>;
using Graph=vector<Edges>;

int memo[100001];

pair<vector<int>, Edges> bridge(const Graph& g) {
	const int n = g.size();
	int idx = 0, s = 0, t = 0, k = 0;
	vector<int>ord(n, -1), onS(n), stk(n), roots(n), cmp(n);
	Edges brdg;
	function<void(int, int)> dfs = [&](int v, int u) {
		ord[v] = idx++;
		stk[s++] = v;
		onS[v] = true;
		roots[t++] = v;
		for (auto& e : g[v]) {
			int w = e.dst;
			if (ord[w] == -1)dfs(w, v);
			else if (u != w && onS[w])
				while (ord[roots[t - 1]]>ord[w])--t;
		}
		if (v == roots[t - 1]) {
			brdg.emplace_back(u, v);
			while (true) {
				int w = stk[--s];
				onS[w] = false;
				cmp[w] = k;
				if (v == w)break;
			}
			--t;
			++k;
		}
	};
	for (int u = 0; u<n; ++u) {
		if (ord[u] == -1) {
			dfs(u, n);
			brdg.pop_back();
		}
	}
	return make_pair(cmp, brdg);
}

bool dfs0(const Graph &g,int p,int v,vector<bool> &elect,
vector<int>&elements,vector<int>&cycle){
    for(auto e:g[v]){
        if(e.dst==p)continue;
        if(elements[cycle[e.dst]]>1 || elect[e.dst])return elect[v]=1;
        if(dfs0(g,v,e.dst,elect,elements,cycle))return elect[v]=1;
    }
    return 0;
}

int dfs1(const Graph &g,int p,int v,vector<bool> &elect,
vector<int>&elements,vector<int>&cycle,vector<Weight>&node){
    if(memo[v])return memo[v];
    int res=0;
    for(auto e:g[v]){
        if(elect[e.dst]){
            return memo[v]=node[v];
        }
        if(e.dst!=p && elements[cycle[e.dst]]==1){
            res=dfs1(g,v,e.dst,elect,elements,cycle,node);
            if(res){
                return memo[v]=res+node[v];
            }
        }
    }
    return 0;
}

int main(){
    int n,m;
    cin>>n>>m;
    Graph g(n);
    vector<Weight>node(n);
    for(int i=0;i<n;++i){
        cin>>node[i];
    }
    for(int i=0;i<m;++i){
        int s,t;
        cin>>s>>t;
        --s;--t;
        g[s].emplace_back(s,t);
        g[t].emplace_back(t,s);
    }
    vector<int>cycle = bridge(g).first;
    vector<int>elements(n,0);
    for(int i=0;i<n;++i){
        elements[cycle[i]]++;
    }
    vector<bool>elect(n,false);
    elect[0]=true;
    for(int i=1;i<n;++i){
        if(elements[cycle[i]]>1){
            dfs0(g,-1,i,elect,elements,cycle);
        }
    }
    int buf=0;
    for(int i=1;i<n;++i){
        if(g[i].size()==1){
            buf=max(buf,dfs1(g,-1,g[i][0].src,elect,elements,cycle,node));
        }
    }
    int ans=0;
    for(int i=0;i<n;++i){
        if(elect[i]){
            ans+=node[i];
        }
    }
    ans+=buf;
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 21252
#include <bits/stdc++.h>
using namespace std;
using namespace std;
 
#define ll long long
#define f(i,a,b) for(int i=a;i<b;i++)
#define endl '\n'
#define spc " "
#define pb push_back
#define mp make_pair
#define mod 1000000007

int main() 

{
    ios::sync_with_stdio(0);
    cin.tie(0);
    //freopen("in.txt","r",stdin);
    //freopen("output.txt","w",stdout);
    ll k,a,b,haa=0;
    cin>>k;
    cin>>a>>b;
    f(i,a,b+1){
        if(i%k==0){
            haa=1;
            break;
        }
    }
    if(haa==1) cout<<"OK"<<endl;
    else cout<<"NG"<<endl;

}

Measured memory_bytes: 3608
object Main {
  def main(args: Array[String]): Unit = {
    val lines = io.Source.stdin.getLines().toList
    println(Solver.solve(lines.head))
  }
}

object Solver {
  val ACGT = Set('A', 'C', 'G', 'T')
  def solve(input: String): String = {
    var subCounter = 0
    var maxCache = 0
    for (s <- input) {
      if (ACGT.contains(s)) {
        subCounter += 1
      } else {
        maxCache = List(maxCache, subCounter).max
        subCounter = 0
      }
    }
    List(maxCache, subCounter).max.toString
  }
}


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

int main(){
  string s, t;
  cin>>s>>t;
  map<char,char> m, n;
  for(int i=0; i <s.size(); ++i){
    if(m.count(s[i])){
      if(m[s[i]] != t[i]){
        cout<<"No\n";
        return 0;
      }
    }
    else m[s[i]]=t[i];
    if(n.count(t[i])){
      if(n[t[i]] != s[i]){
        cout<<"No\n";
        return 0;
      }
    }
    else n[t[i]]=s[i];
  }
  cout<<"Yes\n";
  return 0;
}


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

int main(){
    double a, b, c, d, e, f, x, y, ay, aa, db, dc, ae, af;
    while (scanf("%lf %lf %lf %lf %lf %lf",&a, &b, &c, &d, &e, &f)!=EOF) {
        db = b * d;
        dc = c * d;
        ae = e * a;
        af = f * a;
    
        ay = db - ae;
        aa = dc - af;
        y = aa / ay;
    
        x = (c - (b * y)) / a;
    
        x = x * 100;
        y = y * 100;
        x = round(x);
        y = round(y);
        x = x / 100;
        y = y /100;
        printf("%.3f %.3f\n",x, y);
    }
    return 0;
}

Measured memory_bytes: 660
datasets = []

while true
  n = gets.to_i
  break if n <= 0
  data = [] 
  n.times do
    data << gets.chomp!.split.map(&:to_i)
  end
  datasets << data
end

datasets.each do |data|
  data.each do |row| 
    row.each {|n| printf("%5d", n)}
    printf("%5d\n", row.inject(0) {|s, x| s + x})
  end

  data.transpose.each do |col|
    printf("%5d", col.inject(0) {|s, x| s + x})
  end
  printf("%5d\n", data.flatten.inject(0) {|s, x| s + x})
end

Measured memory_bytes: 2596
#include<iostream>
#include<iomanip>
#include<cstring>
#include<cstdio>
#include<cmath>
#include<algorithm>
#include<set>
using namespace std;
string s;
int main() {
    cin>>s;
    int n=s.length();
    s=' '+s;
    if(s[1]==s[n]){
    	if(n%2==1)puts("Second");
    	else puts("First");
	}
	else {
		if(n%2==0)puts("Second");
    	else puts("First");
	}
    return 0;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
using Graph = vector<vector<int>>;

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

  vector<pair<long long, long long>> p(N);

  for (int i = 0; i < N; i++) {
    long long a;
    long long b;
    cin >> a >> b;
    p.at(i) = make_pair(a, b);
  }

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

  long long tot = 0;
  for (int i = 0; i < N; i++) {
    long long a;
    long long b;
    tie(a, b) = p.at(i);
    tot += b;
    if (tot >= K) {
      cout << a << endl;
      break;
    }
  }
}

Measured memory_bytes: 1792
#include<bits/stdc++.h>
using namespace std;
long long n,k,a[300005],b[67][2],ans,i,raod,j;
int main(){
	cin>>n;
	for(k=1;k<=n;k++)
	cin>>a[k];
	
		for(i=1;i<=n;i++){raod=0;
			while(a[i]){
			raod++;
				b[raod][a[i]%2]++;
				a[i]=a[i]/2;
				 
			}
			for(j=raod+1;j<=60;j++)
			b[j][0]++;
		}
	j=1;
	for(k=1;k<=63;k++){
	
	ans+=((b[k][1]%1000000007)*(b[k][0]%1000000007))%1000000007*(j%1000000007);
	ans%=1000000007;
	j*=2;
	//cout<<b[k][1]<<" "<<b[k][0]<<endl; 
	}
	
	cout<<ans%(1000000007)<<endl;
	
	
}

Measured memory_bytes: 2560
import sys
s=0
p=[list(map(float,e.split(',')))for e in sys.stdin]
x,y=p[0]
for i in range(len(p)-2):
 a,b=p[i+1];c,d=p[i+2]
 s+=(a*d-b*c+(b-d)*x+(c-a)*y)/2
print(abs(s))


Measured memory_bytes: 5592
#include <iostream>
#include <string>
#include <vector>
#include <utility>
#include <algorithm>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <climits>
using namespace std;
//typedef vector<ll> vec;
typedef long long ll;
#define MIN(a,b) (((a)<(b))?(a):(b))
#define MAX(a,b) (((a)>(b))?(a):(b))
#define N 100020
#define N2 100000020


ll a[N];
ll t[N];
//ll q[N2];

ll solve(){
    
    ll n;
    ll count=1;
    cin>>n;
    for (ll i=0; i<n; i++)
        cin>>t[i];
    for (ll i=0; i<n; i++)
        cin>>a[i];
    if (t[n-1]!=a[0]) {
        return 0;
    }
    for (ll i=1; i<n-1; i++){
        if (t[i-1]<t[i] && a[i]>a[i+1] && a[i]!=t[i])
            return 0;
        if (t[i-1]<t[i]) {
            if (t[i]>a[i]) {
                return 0;
            }
            continue;
        }
        if (a[i]>a[i+1]) {
            if (t[i]<a[i]) return 0;
            continue;
        }
        count*=(MIN(a[i],t[i]))%(1000000007);
        count=count%(1000000007);
    }
        
    return count;
}
int main() {
    cout<<solve()<<endl;
    
    return 0;
}


















Measured memory_bytes: 1920
#include<cmath>
#include<cstdio>
#include<vector>

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

using namespace std;

const double EPS=1e-8;
const double PI=acos(-1);

template<class T>
struct point{
	T x,y;
	point operator+(const point &a)const{ return (point){x+a.x,y+a.y}; }
	point operator-(const point &a)const{ return (point){x-a.x,y-a.y}; }
};

template<class T>
point<T> operator*(T c,const point<T> &a){ return (point<T>){c*a.x,c*a.y}; }

template<class T>
struct line:vector< point<T> >{
	line(){}
	line(const point<T> &a,const point<T> &b){ push_back(a), push_back(b); }
};

template<class T>
struct polygon:vector< point<T> >{
	polygon(){}
	polygon(int n):vector< point<T> >(n){}
};

template<class T>
T cross(const point<T> &a,const point<T> &b){ return a.x*b.y-a.y*b.x; }

point<double> rot(const point<double> &a,double theta){
	return (point<double>){a.x*cos(theta)-a.y*sin(theta),a.x*sin(theta)+a.y*cos(theta)};
}

enum {CCW=1,CW=-1,ON=0};
int ccw(const point<double> &a,const point<double> &b,const point<double> &c){
	double rdir=cross(b-a,c-a);
	if(rdir> EPS) return CCW;
	if(rdir<-EPS) return CW;
	return ON;
}

template<class T>
T area2(const polygon<T> &G){
	int n=G.size();
	T a=0;
	rep(i,n) a+=cross(G[i],G[(i+1)%n]);
	return abs(a);
}

template<class T>
point<double> get_intersect(const line<T> &L1,const line<T> &L2){
	double a1=cross(L1[1]-L1[0],L2[1]-L2[0]);
	double a2=cross(L1[1]-L1[0],L1[1]-L2[0]);
	if(abs(a1)<EPS) return L1[0]; // L1 == L2
	return L2[0]+a2/a1*(L2[1]-L2[0]);
}

template<class T>
polygon<double> convex_cut(const polygon<T> &G,const line<T> &L){
	int n=G.size();
	polygon<double> H;
	rep(i,n){
		int d1=ccw(L[0],L[1],G[i]);
		int d2=ccw(L[0],L[1],G[(i+1)%n]);
		if(d1!=CW) H.push_back(G[i]);
		if(d1==CCW && d2==CW || d1==CW && d2==CCW){
			H.push_back(get_intersect(L,line<T>(G[i],G[(i+1)%n])));
		}
	}
	return H;
}

int main(){
	const point<double> O={0,0},P={1,0};

	for(int n;scanf("%d",&n),n;){
		polygon<double> G(n);
		rep(i,n) scanf("%lf%lf",&G[i].x,&G[i].y);

		double A2=area2(G);
		line<double> L0(O,P);

		double lo=0,hi=PI;
		if(area2(convex_cut(G,L0))>A2/2) lo=-PI, hi=0;
		rep(_,50){
			double mi=(lo+hi)/2;
			line<double> L(O,rot(P,mi));
			if(area2(convex_cut(G,L))<A2/2) lo=mi; else hi=mi;
		}

		point<double> ans=rot(P,(lo+hi)/2);
		printf("%.15f %.15f\n",2*ans.x,2*ans.y);
	}

	return 0;
}

Measured memory_bytes: 880
#include <bits/stdc++.h>
using namespace std;
int main() {
  int A, B,C,D;
  cin >> A >> B>>C>>D;
  while(A>0&&C>0){
    C=C-B;
    A=A-D;
  }
  if (A<=0&&C>0) {
    cout << "No" << endl;
  }
  if (C<=0&&A>0) {
    cout << "Yes" << endl;
  }
  if (A<=0&&C<=0){
    cout << "Yes" << endl;
  }
}

Measured memory_bytes: 3636
#include <bits/stdc++.h>
 
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define all(obj) (obj).begin(), (obj).end()
#define bit(n) (1LL << (n))
 
typedef long long ll;

using namespace std;

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  
  int n;
  cin>>n;
  
  int sum[n];
  
  rep(i,n) {
    sum[i]=0;
  }
  
  rep(i,n-1) {
    int a;
    cin>>a;
    
    sum[a-1]+=1;
  }
  
  rep(i,n) {
    cout<<sum[i]<<endl;
  }
  
  return 0;
}

Measured memory_bytes: 4404
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
  ll n,k;
  cin>>n>>k;
  l1:
  if(n%k==0)
  {
    cout<<"0";
    return 0;
  }
  if(n<abs(n-k))
  {
    cout<<n;
    return 0;
  }
  else
  {
    if(n>k)
    n=n%k;
    else
    n=abs(n-k);
    goto l1;
  }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<string> vs;
ll llmax = LLONG_MAX;
string ALP = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
string alp = "abcdefghijklmnopqrstuvwxyz";
vi d1 = {1, 0, -1, 0}, d2 = {0, 1, 0, -1};
void Yes() {cout << "Yes" << endl;}
void No() {cout << "No" << endl;}
void YES() {cout << "YES" << endl;}
void NO() {cout << "NO" << endl;}
void neg() {cout << -1 << endl;}

int main() {
  string s;
  cin >> s;
  ll n = s.size();

  vector<vll> sep(0);//{a, b, c}
  for (ll i = 0; i < n; i++) {
    ll a, b, c;
    a = i;
    while (s[i] == 'R') i++;
    b = i - 1;
    while (s[i] == 'L') {
      i++;
      if (i == n - 1) {
        i++;
        break;
      }
    }
    c = i - 1;
    sep.push_back({a, b, c});
    i--;
  }
  ll m = sep.size();

  /*for (ll i = 0; i < m; i++) {
    cout << sep[i][0] << " " << sep[i][1] << " " << sep[i][2] << endl;
  }*/

  vll cnt1(m);
  for (ll i = 0; i < m; i++) {
    cnt1[i] = max(sep[i][2] - sep[i][1], sep[i][1] - sep[i][0] + 1) - 1;
  }
  sort(cnt1.begin(), cnt1.end());
  ll x = cnt1[m - 1];//全体が定常状態になるまで

  vector<vll> cnt2(m);//{a, b}
  for (ll i = 0; i < m; i++) {
    ll a, b, c;
    c = max(sep[i][2] - sep[i][1], sep[i][1] - sep[i][0] + 1) - 1;//i番目が定常状態になるまで
    a = (sep[i][2] - sep[i][0] + 1) / 2;
    b = sep[i][2] - sep[i][0] + 1 - a;
    if (sep[i][2] - sep[i][1] < sep[i][1] - sep[i][0] + 1) swap(a, b);
    if ((x - c) % 2 == 1) swap(a, b);
    if (x % 2 == 1) swap(a, b);
    cnt2[i] = {a, b};
  }

  vll ans(n);
  ll cnt3 = 0;
  for (ll i = 0; i < n; i++) {
    while (s[i] == 'R') i++;
    ans[i - 1] = cnt2[cnt3][0];
    ans[i] = cnt2[cnt3][1];
    while (s[i] == 'L') {
      if (i == n - 1) break;
      i++;
    }
    cnt3++;
  }

  for (ll i = 0; i < n - 1; i++) cout << ans[i] << " ";
  cout << ans[n - 1] << endl;
}

Measured memory_bytes: 7220
import sys

readline = sys.stdin.readline
MOD = 10 ** 9 + 7
INF = float('INF')
sys.setrecursionlimit(10 ** 5)


def main():
    s = input()
    t = input()
    ans = 0

    for ch1, ch2 in zip(s, t):
        if ch1 != ch2:
            ans += 1

    print(ans)


if __name__ == '__main__':
    main()


Measured memory_bytes: 68152
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
using P   = pair<ll, ll>;
using mat = vector<vector<ll>>;
typedef string::const_iterator State;
class ParseError {};

void IOS() { ios::sync_with_stdio(false), cin.tie(0); }

constexpr ll INF = 1e16;
constexpr ll INM = 114514;
constexpr ll MOD = 1e9 + 7;
constexpr ld EPS = 1e-12;

template <typename T>
void dump(T x) { cout << x << endl; }
void dumpf(ld x, int t) { cout << setprecision(t) << fixed << x << endl; }
template <typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val) {
	fill((T *)array, (T *)(array + N), val);
}
inline ll mod(ll a, ll b) {
	if (a > 0) return a % b;
	if (a % b == 0) return 0;
	ll x = -a / b + 1;
	a += x * b;
	return a % b;
}
ll powm(ll a, ll b, ll c) {
	if (b == 0)
		return 1;
	else if (b % 2 == 0) {
		ll d = powm(a, b / 2, c);
		return (d * d) % c;
	} else
		return (a * powm(a, b - 1, c)) % c;
}
ll gcd(ll a, ll b) {
	if (b == 0) return a;
	return gcd(b, a % b);
}
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }
ll dx[4] = {1, 0, -1, 0};
ll dy[4] = {0, 1, 0, -1};

int main() {
	IOS();
	ll m, d;
	cin >> m >> d;
	ll cnt = 0;
	for (int i = 1; i <= m; i++) {
		for (int j = 1; j <= d; j++) {
			int d1  = j % 10;
			int d10 = j / 10;
			if (d1 >= 2 && d10 >= 2 && d1 * d10 == i) cnt++;
		}
	}
	dump(cnt);
	return 0;
}

Measured memory_bytes: 384
#include "bits/stdc++.h"

#define MOD 1000000007
#define rep(i, n) for(ll i=0; i < (n); i++)
#define rrep(i, n) for(ll i=(n)-1; i >=0; i--)
#define ALL(v) v.begin(),v.end()
#define rALL(v) v.rbegin(),v.rend()
#define FOR(i, j, k) for(ll i=j;i<k;i++)
#define debug_print(var) cerr << #var << "=" << var <<endl;
#define DUMP(i, v)for(ll i=0;i<v.size();i++)cerr<<v[i]<<" "

using namespace std;
typedef long long int ll;
typedef vector<ll> llvec;
typedef vector<double> dvec;
typedef pair<ll, ll> P;
typedef long double ld;
struct edge{ll x, c;};

ll mod(ll a, ll mod){
  ll res = a%mod;
  if(res<0)res=res + mod;
  return res;
}

ll modpow(ll a, ll n, ll mod){
  ll res=1;
  while(n>0){
    if(n&1) res=res*a%mod;
    a=a*a%mod;
    n>>=1;
  }
  return res;
}

ll modinv(ll a, ll mod){
  return modpow(a, mod-2, mod);
}

ll gcd(ll a, ll b){
  ll r = a%b;
  if(r==0) return b;
  else return gcd(b, a%b);
}

bool is_prime(ll n){
  ll i = 2;
  if(n==1)return false;
  if(n==2)return true;
  bool res = true;
  while(i*i <n){
    if(n%i==0){
      res = false;
    }
    i = i+1;
  }

  //if(i==1)res = false;
  if(n%i==0)res=false;
  return res;
}

struct UnionFind{
  ll N;
  llvec p;
  llvec cnt;
  UnionFind(ll n){
    N = n;
    p=llvec(N);
    cnt=llvec(N, 0);
    rep(i, N){
      p[i] = i;
      cnt[i] = 1;
    }
  }

  void con(ll a, ll b){
    P at = root(a);
    P bt = root(b);
    if(at.second!=bt.second){
      if(at.first>bt.first){
        swap(at, bt);
        swap(a, b);
      }
      p[at.second] = bt.second;
      cnt[bt.second]+=cnt[at.second];
      p[a]=bt.second;
    }
  }

  P root(ll a){
    ll atmp = a;
    ll c=0;
    while(atmp!=p[atmp]){
      atmp = p[atmp];
      c++;
    }
    p[a] = atmp;
    return {c, atmp};
  }

  bool is_con(ll a, ll b){
    P at=root(a);
    P bt=root(b);
    return at.second == bt.second;
  }
  
};

struct dijkstra{
  ll N;
  llvec d;
  vector<vector<edge>> e;
  dijkstra(ll n){
    N = n;
    //d = llvec(N, 1e18);
    e = vector<vector<edge>>(N);
  }

  void add_edge(ll from, ll to, ll cost){
    e[from].push_back({to, cost});
  }

  void run(ll start){
    priority_queue<P, vector<P>, greater<P>> que;
    que.push({0, start});
    d = llvec(N, 1e18);
    d[start]=0;
    while(!que.empty()){
      P q = que.top();que.pop();
      ll dc = q.first;
      ll x = q.second;
      if(dc>d[x]){
        continue;
      }else{
        for(auto ip: e[x]){
          if(d[ip.x]<=d[x]+ip.c){
            continue;
          }else{
            d[ip.x]= d[x]+ip.c;
            que.push({d[ip.x], ip.x});
          }
        }
      }
    }
  }  
};


/**************************************
** A main function starts from here  **
***************************************/
int main(){
  string S;
  cin >> S;
  ll cnt = 0;
  ll ans = 1e18;
  rep(i, S.size()){
    if(S[i]=='0' and i%2==0)cnt++;
    if(S[i]=='1' and i%2==1)cnt++;
  }
  ans = min(ans, cnt);
  cnt = 0;
  rep(i, S.size()){
    if(S[i]=='0' and i%2==1)cnt++;
    if(S[i]=='1' and i%2==0)cnt++;
  }
  ans = min(ans, cnt);
  cout << ans;
  return 0;
}


Measured memory_bytes: 512