akhauriyash/Code-Regression huggingface dataset:
#pragma GCC optimize ("O3")
#pragma GCC optimize ("unroll-loops")
#pragma comment(linker, "/STACK:2000000")

#include "bits/stdc++.h"

using namespace std;

#define pb push_back
#define F first
#define S second
#define f(i,a,b)  for(int i = a; i < b; i++)
// #define endl '\n'
using ll = long long;
using db = long double;
using ii = pair<int, int>;

const int N = 2e5+5, LG = 19, MOD = 998244353;
const int SQ =320;
const long double EPS = 1e-7;
int n, m;
vector<int> adj[100005];
set<ii>ans;
bool vis[100005];
int col[100005];
int lvl[100005];

void dfs(int node, int par){
  ///is it possible that
  vis[node] = true;
//  cout<<node<<'\n';
  for(auto v : adj[node])if(!vis[v]){
    col[node] ^= 1;
    ans.insert(ii(node,v));
    lvl[v]=lvl[node]+1;
    dfs(v,node);
  } else if(vis[node]&&lvl[node]<lvl[v]){
    col[node]^=1;
    ans.insert(ii(node,v));
  }

  if(col[node]){
    assert(ans.count(ii(par,node)));
    ans.erase(ii(par,node));
    ans.insert(ii(node,par));
    col[node]^=1;
    col[par]^=1;
  }

}
int32_t main(){
#ifdef ONLINE_JUDGE
    ios_base::sync_with_stdio(0);
    cin.tie(0);
#endif

  cin >> n >> m;

  f(i,0,m){
    int u, v;
    cin >> u>> v;
    adj[u].push_back(v);
    adj[v].push_back(u);
  }

  if(m % 2){
    cout << -1 << '\n';
    return 0;
  }

  dfs(1,1);

  for(auto x:ans)
    cout<<x.F<<' '<<x.S<<'\n';


  return 0;
}


Measured memory_bytes: 21760
#include <stdio.h>          // printf(), scanf()
#include <stdlib.h>         // abs()
#include <string.h>         // memset()
#include <stdbool.h>

#define MAX_N 15
#define MAX_S (1 << MAX_N)

const double INF = 1e10;

int n;
int s[MAX_N], l[MAX_N], p[MAX_N];
double dp[MAX_N][MAX_S];
int w[MAX_N][MAX_S];
short prev[MAX_N][MAX_S][2];
int ord[MAX_N];

int
main(int argc, char **argv)
{
	scanf("%d", &n);
	for (int i = 0; i < n; ++i)
		scanf("%d%d%d", &s[i], &l[i], &p[i]);

	memset(prev, -1, sizeof(prev));
	int S = 1;
	for (int i = 0; i < n; i++, S <<= 1)
		w[i][S] = p[i];

	int e = 1 << n;
	for (int k = 1; k < e; ++k)
	{
		S = 1;
		for (int i = 0; i < n; ++i, S <<= 1)
		{
			if (k & S)
				continue;

			int t = k | S;
			for (int j = 0; j < n; ++j)
			{
				if (i == j || w[j][k] == 0)
					continue;

				int d = abs(l[i] - l[j]);
				double x = dp[j][k] + d * ((70 + 20 * w[j][k]) / 2000.0);
				if (dp[i][t] == 0 || x < dp[i][t])
				{
					dp[i][t] = x;
					w[i][t] = w[j][k] + p[i];
					prev[i][t][0] = j;
					prev[i][t][1] = k;
				}
			}
		}
	}

	double min = INF;
	int u = 0;
	for (int i = 0; i < n; ++i)
	{
		double y = dp[i][e - 1];
		if (y == 0)
			continue;

		if (y < min)
		{
			min = y;
			u = i;
		}
	}

	ord[0] = u;
	int v = e - 1;
	for (int k = 1; k < n; ++k)
	{
		ord[k] = prev[u][v][0];
		v = prev[u][v][1];
		u = ord[k];
	}

	for (int i = n - 1; i >= 0; --i)
		printf("%d%c", s[ord[i]], (i != 0) ? ' ' : '\n');

	return 0;
}

Measured memory_bytes: 8648
#include <bits/stdc++.h>
using namespace std;
 
#define fio ios::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define int long long
// #define double long double
// #define mp make_pair
// #define pb push_back
// Upper case English alphabet to lower case ch |= ' ';
// Lower case English alphabet to upper case ch &= '_’ ;
//__builtin_popcount(x)

int M=(int)1e9+1,t=0;
int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
int digits(int n){return floor(log10(n))+1 ;}
bool ispoweroftwo (int x) { return x && (!(x&(x-1))); }
// vector<int> vis,parent,ti,tout,dis;
// vector<vector<int> > adj;
 
// void dfs(int v){
//     vis[v]=1;
//     for(int i:adj[v]){
//         if(vis[i]){
//             t=1;
//             return ;
//         }
//             //dis[i]=1+dis[v];
//             //parent[i]=v;
//             vis[i]=1;
//             dfs(i);

//     }
//     return ;
    
// }




signed main(){
    fio;
    cout<<fixed<<setprecision(4);
    int n;
    cin>>n;
    cout<<2*(M_PI)*n<<endl;
    


    

    
    
}

Measured memory_bytes: 3844
/*********************
*  Author: xuziyuan  * 
*********************/
 
#include <bits/stdc++.h>
 
#define rep(i,n) for(int i=0;i<n;i++)
#define repn(i,n) for(int i=1;i<=n;i++)
#define LL long long
#define pii pair <LL,LL>
#define fi first
#define se second
#define pb push_back
#define mpr make_pair
 
using namespace std;
 
const LL MOD=1e9+7;
 
LL n,a[300010],suml[300010],sumr[300010],sum=0,ans=-1e18;
multiset <LL> st;
 
int main()
{
	cin>>n;
	rep(i,n*3) cin>>a[i];
	rep(i,n)
	{
		st.insert(a[i]);
		sum+=a[i];
	}
	suml[n-1]=sum;
	for(int i=n;i<n*2;i++)
	{
		st.insert(a[i]);
		sum+=a[i];
		sum-=*st.begin();
		st.erase(st.begin());
		suml[i]=sum;
	}
	st.clear();
	sum=0;
	for(int i=n*3-1;i>=n*2;i--)
	{
		st.insert(a[i]);
		sum+=a[i];
	}
	sumr[n*2]=sum;
	for(int i=n*2-1;i>=n;i--)
	{
		st.insert(a[i]);
		sum+=a[i];
		sum-=*st.rbegin();
		set <LL>::iterator it=st.end();
		st.erase(--it);
		sumr[i]=sum;
	}
	for(int i=n-1;i<n*2;i++) ans=max(ans,suml[i]-sumr[i+1]);
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 10752
#include<cstdio>
#include<cmath>
#include<iostream>
#include<algorithm>
#include<set>
using namespace std;
int main(){
    while(1){
        int N,M;
        long long int moto[201];
        long long int ato[1001];
        cin>>N;
        if(N==0)break;
        for(int i=0;i<N;i++){
            long long int a,b;
            cin>>a>>b;
            moto[i]=a*1000001+b;
        }
        cin>>M;
        for(int i=0;i<M;i++){
            long long int a,b;
            cin>>a>>b;
            ato[i]=a*1000001+b;
        }
        ato[M]=1000000000000000000;
        sort(ato,ato+M+1);
        for(int i=0;i<M;i++){
            int fg=1;
            for(int j=1;j<N;j++){
                int l=0,r=M+1;
                for(int k=0;k<12;k++){
                    int mid=(l+r)/2;
                    if(moto[j]-moto[0]<=ato[mid]-ato[i])r=mid;
                    else l=mid;
                }
                if(moto[j]-moto[0]!=ato[r]-ato[i]||(moto[j]/1000001-moto[0]/1000001)!=(ato[r]/1000001-ato[i]/1000001))fg=0;
            }
            if(fg==1){
                cout<<(ato[i]/1000001-moto[0]/1000001)<<" "<<(ato[i]%1000001-moto[0]%1000001)<<endl;
                break;
            }
        }
    }
    return 0;
}

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

int main() {
    int32_t n;
    cin >> n;
    int32_t a[n];

    int32_t maxi = 0;
    int32_t mini = 0;
    for(int32_t i = 0; i < n; i++) {
        cin >> a[i];
        if (a[i] > a[maxi]) {
            maxi = i;
        }
        if (a[i] < a[mini]) {
            mini = i;
        }
    }

    if (a[maxi] > 0 && a[mini] < 0) {
        cout << 2 * n - 1 << endl;
        if (a[maxi] >= -a[mini]) {
            for (int32_t i = 0; i < n; i++) {
                cout << maxi + 1 << ' ' << i + 1 << endl;
            }
            for (int32_t i = 0; i <= n - 2; i++) {
                cout << i + 1 << ' ' << i + 2 << endl;
            }
        } else {
            for (int32_t i = 0; i < n; i++) {
                cout << mini + 1 << ' ' << i + 1 << endl;
            }
            for (int32_t i = n - 2; i >= 0; i--) {
                cout << i + 2 << ' ' << i + 1 << endl;
            }
        }
    } else {
        cout << n - 1 << endl;
        if (a[mini] >= 0) {
            for (int32_t i = 0; i <= n - 2; i++) {
                cout << i + 1 << ' ' << i + 2 << endl;
            }
        } else {
            for (int32_t i = n - 2; i >= 0; i--) {
                cout << i + 2 << ' ' << i + 1 << endl;
            }
        }
    }

    return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main{
	public static void main(String [] args){
		Scanner sc = new Scanner(System.in);
		int r = sc.nextInt();
		int c = sc.nextInt();
		int worksum = 0;
		int sheet[][] = new int[r+1][c+1];
		for(int i = 0; i < r; i++){
			for(int j = 0; j < c; j++){
				sheet[i][j] = sc.nextInt();
			}
		}
		for(int i = 0; i < r; i++){
			for(int j = 0; j < c; j++){
				worksum += sheet[i][j];
			}
			sheet[i][c] = worksum;
			worksum = 0;
		}
		for(int i = 0; i < c + 1; i++){
			for(int j = 0; j < r; j++){
				worksum += sheet[j][i];
			}
			sheet[r][i] = worksum;
			worksum = 0;
		}
		
		for(int i = 0; i < r + 1; i++){
			for(int j = 0; j < c + 1; j++){
				System.out.print(sheet[i][j]);
				if(j == c){
					System.out.println("");
				}else{
					System.out.print(" ");
				}
			}
		}
	}
}

Measured memory_bytes: 41936
#include <bits/stdc++.h>
using namespace std;
int main(){
  int n;
  cin >> n;
  n = n % 100;
  n = n % 10;
  if(n == 3){
    cout << "bon" << endl;
  }else if (n == 0 || n == 1 || n == 6 || n == 8 ){
    cout << "pon" << endl;
  }else{
    cout << "hon" << endl;
  }
  
  return 0;
}

Measured memory_bytes: 3596
#include <cstdio>  
using namespace std;  
int main() { 	
	int a,b,c,d,e; 	
	scanf("%d %d %d", &a, &b, &c); 	
	if(b-a<0){
		d=a-b;
	}
	if(b-a>0){
		d=b-a;
	}
	if(a-c<0){
	
		e=c-a;
	}
	if(a-c>0){
		e=a-c;
	}
	if(e>d){
		printf("A");
	}
	else{
		printf("B");
	}
} 


Measured memory_bytes: 128
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
using namespace std;
typedef long long unsigned int ll;

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define SZ(x) ((int)(x).size())
#define m0(x) memset(x,0,sizeof(x))
#define fill(x,y) memset(x,y,sizeof(x))
#define SIZE_OF_ARRAY(array) (sizeof(array)/sizeof(array[0]))

map<ll, ll> primeFactors(ll n)
{
    map<ll, ll> ret;
    while (n % 2 == 0)
    {
        if( ret.find(2) != ret.end() ) {
            ret[2]++;
        }
        else
        {
            ret[2] = 1;
        }
        n = n / 2;
    }
    for (ll i = 3; i <= sqrt(n); i = i+2)
    {
        while (n%i == 0)
        {
            if( ret.find(i) != ret.end() ) {
            ret[i]++;
        }
        else
        {
            ret[i] = 1;
        }
            n = n / i;
        }
    }
    if (n > 2)
        {
            if( ret.find(n) != ret.end() ) {
            ret[n]++;
        }
        else
        {
            ret[n] = 1;
        }
        }
    return ret;
}

void print_map(map<ll, ll> mp){
    for(auto itr = mp.begin(); itr != mp.end(); ++itr) {
        std::cout << "key = " << itr->first           // キーを表示
                        << ", val = " << itr->second << "\n";    // 値を表示
    }
}

// Returns nCr % p
ll nCrModp(ll n, ll r, ll p)
{
    ll C[r+1];
    memset(C, 0, sizeof(C));

    C[0] = 1;

    for (ll i = 1; i <= n; i++)
    {
        for (ll j = min(i, r); j > 0; j--)
            C[j] = (C[j] + C[j-1])%p;
    }
    return C[r];
}

int main()
{
    long long a,b;
    cin >> a >> b;
    if (a * b <= 0)
    {
        cout << "Zero" << endl;
    } else {
        if (a > 0) {
            cout << "Positive" << endl;
        } else {
            if ((b - a + 1) % 2 == 1 ) {
                cout << "Negative" << endl;
            } else {
                cout << "Positive" << endl;
            }
        }
    }

    return 0;
}


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

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

    if(s=="ABC"){
        cout<<"ARC"<<endl;
    }else{
        cout<<"ABC"<<endl;
    }
    return 0;
}


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

using namespace std;

int main(){
    int n, W;
    cin>>n>>W;
    long long int weight[n+1];
    long long int value[n+1];
    
    for (int j=1; j<=n; j++){
        cin>>weight[j];
        cin>>value[j];
    }
    
    long long int dp[W+1][n+1] = {0};
    for (int i=0; i<=W; i++){
        for (int j=1; j<=n; j++){
            if (i==0){
                dp[i][j] = 0;
            }
            else if (weight[j]<i){
                dp[i][j] = max(value[j]+dp[i-weight[j]][j-1], dp[i][j-1]); 
            }
            else if(weight[j]==i){
                dp[i][j] = max(value[j], dp[i][j-1]);
            }
            else if(weight[j]>i){
                dp[i][j] = dp[i][j-1];
            }
        }
    }
    cout<<dp[W][n];
    return 0;
}





Measured memory_bytes: 79104
# ABC 116: B – Collatz Problem
s = int(input())
a = []
b = s
m = 1

while b not in a:
    a.append(b)
    b = a[m - 1] // 2 if a[m - 1] % 2 == 0 else 3 * a[m - 1] + 1
    m += 1

print(m)

Measured memory_bytes: 2940
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<stack>
#include<string>
#include<map>
#include<set>
#include<tuple>
#include<cmath>
#include<iomanip>


#define MOD 1000000007
#define INF 1001001001
#define MIN -1001001001
#define rep(i,k,N) for(int i=k;i<N;i++)
#define MP make_pair
#define MT make_tuple //tie,make_tuple は別物
#define PB push_back
#define PF push_front
#define all(x) (x).begin(),(x).end()


using namespace std;
typedef long long ll;
typedef vector<ll> v;
typedef vector<vector<ll>> vv;

int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
void YN(bool ans){
    if(ans)cout<<"POSSIBLE"<<endl;
    else cout <<"IMPOSSIBLE"<<endl;
    return;
}
int main(){
    ll N,M;
    cin>>N>>M;
    map<ll,bool> m1,mN;
    rep(i,0,M){
        ll a,b;
        cin>>a>>b;
        if(a == 1){
            m1[b] = true;
        }
        else if(b == 1){
            m1[a] = true;
        }
        else if(a == N){
            mN[b] = true;
        }
        else if(b == N){
            mN[a] = true;
        }
    }
    bool ans = false;
    rep(i,2,200001){
        if(m1[i] && mN[i]){
            ans = true;
        }
    }
    YN(ans);
    return 0;
}

Measured memory_bytes: 25216
// Do you knOW what it feels like?

		// To be TorTured by your own MinD?
	
	// I don't wanna feel the PAIN.

// I BeG you to KILL me, pleASE...

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

#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
//#pragma GCC optimize("Os") 

#define F first
#define S second
#define pb push_back
#define SZ(x) (ll)(x.size())
#define all(x) x.begin(),x.end()
#define mp make_pair

typedef long long ll;
typedef pair<ll,ll> pll;
typedef long double ld;

//mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

const ll maxn=5e5+10, lg=23, mod=1e9+7, inf=1e18;

ll n,k;
ll a[maxn],ans[maxn],tt=0;

ll seg[maxn<<1];
void goz(ll i,ll x){ i--;
	seg[i+=n]=x;
	for(;i>1;i>>=1) seg[i>>1]=min(seg[i],seg[i^1]);
}
ll get(ll r,ll l=0){
	ll mn=inf;
	for(l+=n,r+=n;l<r;l>>=1,r>>=1){
		if(l&1) mn=min(mn,seg[l++]);
		if(r&1) mn=min(mn,seg[--r]);
	}
	return mn;
}

void sol(ll x){
	while(1){
		ll ag=get(a[x]-1);
		//cout<<x<<' '<<a[x]<<' '<<ag<<endl;
		if(ag>=x+k) break;
		sol(ag);
	}
	ans[x]=++tt;
	goz(a[x],inf);
}

int main(){
	ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);

	memset(seg,69,sizeof(seg));
	cin>>n>>k;
	for(int i=1;i<=n;i++) cin>>a[i], goz(a[i],i);
	for(int i=1;i<=n;i++){
		if(!ans[i]) sol(i);
		cout<<ans[i]<<endl;
	}

	return 0;
}








 






Measured memory_bytes: 50432
#include <stdio.h>
#include <math.h>
#include <string.h>
#include <stdbool.h>  //for bool
#include <stdlib.h> // abs,labs,llabs
#include <limits.h>
#include <ctype.h>

typedef long long int ll;
typedef unsigned long long int ull;
typedef long double ld; //%Lf

void swap (int *aa, int *bb) {
  int temp = *aa;
      *aa = *bb;
      *bb = temp;
}

int main(void) {
  int n, i, j;
  float ans;
  scanf("%d", &n);
  int a[n];
  for (i = 0; i < n; i++) {
    scanf("%d", &a[i]);
  }
  for (i = 0; i < n - 1; i++) {
    for (j = 0; j < n - i - 1; j++) {
      if (a[j] > a[j + 1]) {
        swap(&a[j], &a[j + 1]);
      }
    }
  }
  ans = a[0];
  for (i = 1; i < n; i++) {
    ans = (float)(ans + a[i]) / (float)2;
  }
  printf("%f\n", ans);
  return 0;
}


Measured memory_bytes: 128
#define lp(i,n) for(int i=0;i<n;i++)
#define pau system("pause")
#include<bits/stdc++.h>
using namespace std;
using dl=long long;

int main(){
    int w,h,n,x,y,a,cx=0,cy=0;
    cin>>w>>h>>n;
    vector<int> W(w),H(h);
    lp(i,w)
        W[i]=0;
    lp(i,h)
        H[i]=0;
    lp(i,n){
        cin>>x>>y>>a;
        switch(a){
            case 1:
                    lp(j,x)
                        W[j]=1;
                    break;
            case 2:
                    for(int j=x;j<w;j++)
                        W[j]=1;
                    break;
            case 3:
                    lp(j,y)
                        H[j]=1;
                    break;
            case 4:
                    for(int j=y;j<h;j++)
                        H[j]=1;
                    break;
        }
    }
    lp(i,w)
        if(W[i]==0)
            cx++;
    lp(i,h)
        if(H[i]==0)
            cy++;
    cout<<cx*cy<<endl;
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<queue>
#include<utility>
#include<algorithm>
#include<string>
using namespace std;
#define int long long
#define vel vector<long long>
#define vvel vector<vel>
#define vvvel vector<vvel>
int root1(vel &par, int ser, vel &path) {
	if (par[ser] == -1) {
		for (int i = 0; i < path.size(); i++) {
			par[path[i]] = ser;
		}
		return ser;
	}
	path.push_back(ser);
	return root1(par, par[ser], path);
}
int root(vel &par, int ser) {
	vel emp(0);
	return root1(par, ser, emp);
}
void uni(int x, int y, vel &par, vel &size) {
	x = root(par, x);
	y = root(par, y);
	if (x != y) {
		par[y] = x;
		size[x] += size[y];
	}
}
bool issame(int x, int y, vel &par) {
	return root(par, x) == root(par, y);
}
signed main() {
	int n; cin >> n;
	vel pa(n, -1);
	vel size(n, 1);
	int m; cin >> m;
	vel a(m); vel b(m);
	for (int i = 0; i < m; i++) { cin >> a[i] >> b[i]; a[i]--; b[i]--; }
	vel hube(m, (n*(n - 1)) / 2);
	for (int i = 0; i < m-1; i++) {
		hube[i + 1] = hube[i];
		if (!issame(a[m - 1 - i], b[m - 1 - i], pa)) {
			hube[i + 1] -= size[root(pa,a[m - 1 - i])] * size[root(pa,b[m - 1 - i])];
		}
		uni(a[m - 1 - i], b[m - 1 - i], pa, size);
	}
	for (int i = 0; i < m; i++) { cout << hube[m-1-i] << endl; }
}

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

using namespace std;
typedef long long ll;
typedef pair<ll, ll> PLL;

#define MAX 200001
priority_queue<PLL> pq;

int main(void) {
    int i, n;
    ll x, y;
    ll Rmax = -1, Rmin = 2e9, Bmax = -1, Bmin = 2e9;
    scanf("%d", &n);
    for(i=0; i<n; i++) {
        scanf("%lld%lld", &x, &y);
        if(x > y) swap(x, y);
        pq.push(make_pair(y, x));
        Rmax = max(Rmax, x);
        Bmax = max(Bmax, y);
        Rmin = min(Rmin, x);
        Bmin = min(Bmin, y);
    }
    ll ans = (Rmax - Rmin) * (Bmax - Bmin);
    while(!pq.empty()) {
        PLL u = pq.top(); pq.pop();
        if(u.second >= u.first) break;
        Rmax = max(Rmax, u.first);
        Bmin = min(Bmin, u.second);
        swap(u.first, u.second);
        pq.push(u);
        ans = min(ans, 1LL * (Rmax - Rmin) * (pq.top().first - Bmin));
    }
    printf("%lld\n", ans);
    return 0 ;
}

Measured memory_bytes: 6384
N = int(input())
XL = []
for i in range(N):
	x,l = map(int,input().split())
	S = x + l
	T = x - l
	XL.append((S,T))
XL.sort()
#print(XL)

ans = 0

min = -float("inf")
for s,t in XL:
	if min <= t:
		ans+=1
		min = s
print(ans)

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

int a, b, c;
int main()
{
	cin >> a >> b >> c;
	for (int i = 1; i <= b; i++) {
		if ((a * i) % b == c) {
			cout << "YES";
			return 0;
		}
	}
	cout << "NO";
    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++)
using ll = long long;

int main(){
  ll n;
  cin >> n;
  ll count = 0;

  for(int i = 1; i < n + 1; i++) {
    if(i % 3 != 0 && i % 5 != 0) {
      count += i;
    }
  }

  cout << count << endl;
}



Measured memory_bytes: 3596
//Insertion

#include<bits/stdc++.h>
using namespace std;
using ll = long long;
#define int long long
#define rep(i,x,y) for(ll i=x;i<y;i++)
#define nvarep(n,a) ll n;cin>>n;vector<ll>a(n);rep(i,0,n)cin>>a[i]
#define vecrep(n,a,type) vector<type>a(n);rep(i,0,n)cin>>a[i]
#define lcm(a,b) (a/__gcd(a, b)*b)
#define range(a) (a).begin(),(a).end() 
#define pb push_back
#define mp make_pair
#define nnn "\n"
#define spa " "
using p = pair<ll, string>;
using graph = vector<vector<ll>>;
const int inf = 2147483647;//2*10^9
const ll INF = 9223372036854775807;//9*10^18

signed main (){
    int n;string s;cin>>n>>s;
    int c{},ans{};
    rep(i,0,s.size()){
        if(s[i]==')'){
            if(c>=1)c--;
            else{
                s.insert(s.begin(),'(');
                i++;
            }
        }else{
            c++;
        }
    }
    rep(i,0,c)s.pb(')');
    cout<<s<<nnn;
    return 0;
}

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


signed main(){
    int N,D,X;
    int A[104];
    int Ans=0;
    cin >> N >> D >> X;
    REP(i,N){cin >> A[i];}
    REP(i,N){
        Ans+=((D-1)/A[i])+1;
    }
    cout << Ans+X << endl;
    return 0;
}


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


int main()
{
    ll a,b,c;cin>>a>>b>>c;
    ll k;cin>>k;
    ll m = max(a,b);
    m = max(m, c);
    ll n = m;
    for(int i = 0; i<k; i++) m *= 2;
    cout << m + a + b + c - n << endl;
    
    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>

int main(){
    int n, i, v, maxi = 0;
    scanf("%d ", &n);
    int p[n];
    for(i = 0; i < n; i++){
        scanf("%d ", &(p[i]));
    }
    v = p[0];
    for(i = 1; i < n; i++){
        v += p[i];
        if(p[i] > p[maxi]) maxi = i;
    }
    v -= p[maxi] / 2;
    printf("%d\n", v);
    return 0;
}

Measured memory_bytes: 128
def main():
    x_num, y_num = map(int, input().split())
    data_x = list(map(int, input().split()))
    data_y = list(map(int, input().split()))
    mod = 10 ** 9 + 7

    x_sum = 0
    for i in range(x_num):
        x_sum += (2 * i + 1 - x_num) * data_x[i]
        x_sum %= mod

    y_sum = 0
    for i in range(y_num):
        y_sum += (2 * i + 1 - y_num) * data_y[i]
        y_sum %= mod

    print((x_sum * y_sum) % mod)



if __name__ == '__main__':
    main()


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

int main(void){
    int h, w; cin >> h >> w;
    int array[110][110];
    for(int i = 0; i < h; i++){
        for(int j = 0; j < w; j++){
            char input; cin >> input;
            if(input == 'c'){
                array[i][j] = 0;
            }else{
                array[i][j] = -1;
            }
        }
    }
    for(int i = 0; i < h; i++){
        int temp = -1;
        for(int j = 0; j < w; j++){
            if(array[i][j] == 0){
                temp = 0;
            }
            array[i][j] = temp;
            if(temp != -1) temp++;
        }
    }

    for(int i = 0; i < h; i++){
        for(int j = 0; j < w; j++){
            if(j == w-1) cout << array[i][j];
            else cout << array[i][j] << " ";
        }
        cout << endl;
    }
    
}

Measured memory_bytes: 3136
use std::io::{BufRead, stdin};

fn main() {
    let stdin = stdin();
    let mut stdin = stdin.lock();

    loop {
        let mut buf = String::new();
        stdin.read_line(&mut buf).unwrap();
        let mut buf = buf.split_whitespace();

        let m: i8 = buf.next().unwrap().parse().unwrap();
        let f: i8 = buf.next().unwrap().parse().unwrap();
        let r: i8 = buf.next().unwrap().parse().unwrap();

        if m == -1 && f == -1 && r == -1 {
            break;
        }

        println!("{}",
            if m == -1 || f == -1 { "F" }
            else if m + f >= 80 { "A" }
            else if m + f >= 65 { "B" }
            else if m + f >= 50 || r >= 50 { "C" }
            else if m + f >= 30 { "D" }
            else { "F" }
        );
    }
}


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

#define mp make_pair
#define mt make_tuple
#define pb push_back
#define ff first
#define ss second
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
#define forn(i, n) for (int i = 0; i < (int)(n); i++)
#define forrn(i, a, b) for (int i = (a); i < (int)(b); i++)
#define PYMOD(A, M) ((((A) % (M)) + (M)) % (M))
typedef long long ll;

using namespace std;

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

    int n, k;
    cin >> n >> k;
    vector<int> x(n);
    forn(i, n)
        cin >> x[i];

    int ans = std::numeric_limits<int>::max();

    for (int start = 0; start + k <= n; start++) {
        int lt = x[start], rt = x[start + k - 1];
        if (lt < 0 && rt < 0) {
            ans = min(ans, -lt);
        } else if (lt < 0 && rt >= 0) {
            ans = min(ans, rt - lt + min(-lt, rt));
        } else {
            ans = min(ans, rt);
        }
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 640
class node:
    def __init__(self, parent, left, right):
        self.parent=parent
        self.left=left
        self.right=right

class tree:

    def __init__(self, datas):
        #format of datas
        #id, left, right
        self.T=[]
        self.rootID=None
        for d in datas:
            self.T.append(node(None,None, None))

        for d in datas:
            if(d[1]!=-1):
                self.T[d[0]].left=d[1]
            if(d[2]!=-1):
                self.T[d[0]].right=d[2]

        for d in datas:

            id=d[0]
            if(self.T[id].left is not None):
                self.T[self.T[id].left].parent = id
            if (self.T[id].right is not None):
                self.T[self.T[id].right].parent = id


        for d in datas:
            if(self.T[d[0]].parent is None):
                self.rootID = d[0]
                #print(rootid)

        self.Preorder = [None for _ in datas]
        self.Inorder =[None for _ in datas]
        self.Postorder=[None for _ in datas]

        self.setPreorder(self.rootID)
        self.setInorder(self.rootID)
        self.setPostorder(self.rootID)

        #print(self.Preorder)
        #print(self.Inorder)
        #print(self.Postorder)


    def setPreorder(self, id):
        if id is None:
            return
        else:
            self.Preorder.append(id)
            self.setPreorder(self.T[id].left)
            self.setPreorder(self.T[id].right)

    def setInorder(self,id):
        if id is None:
            return
        else:
            self.setInorder(self.T[id].left)
            self.Inorder.append(id)
            self.setInorder(self.T[id].right)

    def setPostorder(self,id):
        if id is None:
            return
        else:
            self.setPostorder(self.T[id].left)
            self.setPostorder(self.T[id].right)
            self.Postorder.append(id)

n=int(input())
dlist=[]
for i in range(n):
    dlist.append(list(map(int,(input().split()))))
t=tree(dlist)
print("Preorder")
print(" "+" ".join([str(_) for _ in t.Preorder if _ is not None]))
print("Inorder")
print(" "+" ".join([str(_) for _ in t.Inorder if _ is not None]))
print("Postorder")
print(" "+" ".join([str(_) for _ in t.Postorder if _ is not None]))





Measured memory_bytes: 5628
#include <stdio.h>

int main(void){
	int height,width;
	while(1){
		int i,j;
		scanf("%d %d",&height,&width);
		if(!height&&!width) break;

		for(i=0;i<height;i++){
			for(j=0;j<width;j++){
				if((i+j)%2) printf(".");
				else printf("#");
			}
			printf("\n");
		}
		printf("\n");
	}
	return 0;
}

Measured memory_bytes: 572
import java.util.*;
public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		long M = sc.nextLong();
		int V = sc.nextInt(), P = sc.nextInt();
		int A[] = new int[N];
		for(int i = 0;i<N;i++) A[i]=sc.nextInt();
		sc.close();
		rsort(A);
	
		long l = P-1;
		long r = N;
		while(l+1<r) {
			long c = (l+r)/2;
			int tar = (int)c;
			long now = A[tar];
			long line = (long)now + M;
			//A[P-1]~A[tar - 1]をline以下にできるか
			long needPlus = ((long)V-(P-1)-((long)(N-1)-tar + 1))*M;
			long sum = 0;
			for(int i=P-1;i<tar;i++) {
				sum += A[i];
			}
			long max = Math.max(A[P-1], ((long)sum+needPlus+tar-(P-1)-1)/((long)tar-(P-1)));
			if(line>=max) l=c;
			else r=c;
		}
		
		System.out.println(l+1);
	}
	static void rsort(int arr[]) {
		Arrays.sort(arr);
		int len = arr.length;
		for(int i=0;i<len/2;i++) {
			int tmp = arr[i];
			arr[i]=arr[len-1-i];
			arr[len-1-i]=tmp;
		}
	}
}

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

int A, B, C;
int main() {
    cin >> A >> B >> C;
    if (C >= A && C <= B)
    {
        cout << "Yes" << endl;
    } else
    {
        cout << "No" << endl;
    }
    
    
    cin.get();
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int p[200010],sum[200010];
inline int dsu(int x){
    return p[x]==x?x:p[x]=dsu(p[x]);
}
int main(void) {
    int n,m,mx=0;
    scanf("%d%d",&n,&m);
    for(int i=1;i<=n;i++){
    	p[i]=i;
    	sum[i]=1;
	}
    while(m--) {
        int u,v;
        scanf("%d%d",&u,&v);
        int x=dsu(u);
        int y=dsu(v);
        if(x!=y) {
            p[x]=y;
            sum[y]+=sum[x];
        }
    }
    for(int i=1;i<=n;i++) {
        if(p[i]==i) {
            mx=max(mx,sum[i]);
        }
    }
    printf("%d\n",mx);
    return 0;
}

Measured memory_bytes: 5392
n, l = map(int, input().split())

tot = 0
apple = []
mn, pl = 10**10, 0

for i in range(n):
    tot += l + i
    apple.append(l + i)

for i in range(n):
    if abs(apple[i]) < mn:
        mn = abs(apple[i])
        pl = i

print(tot - apple[pl])

Measured memory_bytes: 3064
#include <iostream>
#include <algorithm>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <tuple>

#define int long long

using namespace std;


class Solver {
};

signed main() {
	while (true) {
		int w, h;
		cin >> w >> h;
		if (w == 0)break;

		vector<vector<int>> grid(h, vector<int>(w, 0));
		for (int i = 0; i < h; i++) {
			for (int j = 0; j < w; j++) {
				char c;
				cin >> c;
				if (c != '.')grid[i][j] = (c - '0');
			}
		}

		vector<vector<int>> cnts;
		vector<vector<int>> num_grid(h, vector<int>(w, -1));
		for (int i = 0; i < h; i++) {
			for (int j = 0; j < w; j++) {
				if (grid[i][j] == 0)continue;
				if (num_grid[i][j] >= 0)continue;

				int val = grid[i][j];
				int num = cnts.size();
				vector<int> cnt(w, 0);
				queue<tuple<int, int>> que;
				que.emplace(make_tuple(i, j));
				while (que.size() > 0) {
					int y = get<0>(que.front());
					int x = get<1>(que.front());
					que.pop();
					if (num_grid[y][x] >= 0)continue;

					num_grid[y][x] = num;
					cnt[x]++;
					if (y > 0 && num_grid[y - 1][x] == -1
						&& grid[y - 1][x] == val) {
						que.emplace(make_tuple(y - 1, x));
					}
					if (y + 1 < h && num_grid[y + 1][x] == -1
						&& grid[y + 1][x] == val) {
						que.emplace(make_tuple(y + 1, x));
					}
					if (x > 0 && num_grid[y][x - 1] == -1
						&& grid[y][x - 1] == val) {
						que.emplace(make_tuple(y, x - 1));
					}
					if (x + 1 < w && num_grid[y][x + 1] == -1
						&& grid[y][x + 1] == val) {
						que.emplace(make_tuple(y, x + 1));
					}
				}
				cnts.emplace_back(cnt);
			}
		}

		vector<int> parents(cnts.size(), -1);
		for (int i = 0; i+1 < h; i++) {
			for (int j = 0; j < w; j++) {
				if (num_grid[i][j] == -1
					|| num_grid[i + 1][j] == -1)continue;
				if (num_grid[i][j] == num_grid[i + 1][j])continue;
				parents[num_grid[i][j]] = num_grid[i + 1][j];
			}
		}

		vector<tuple<int, int>> lrs(cnts.size());
		for (int i = 0; i < cnts.size(); i++) {
			lrs[i] = make_tuple(20, -1);
		}
		for (int i = h - 1; i >= 0; i--) {
			for (int j = 0; j < w; j++) {
				if (num_grid[i][j] == -1)continue;

				if (i == h - 1 || (num_grid[i + 1][j] != -1
					&& num_grid[i + 1][j] != num_grid[i][j])) {
					get<0>(lrs[num_grid[i][j]])
						= min(get<0>(lrs[num_grid[i][j]]), j);
					get<1>(lrs[num_grid[i][j]])
						= max(get<1>(lrs[num_grid[i][j]]), j);
				}
			}
		}

		bool stable = true;
		for (int i = 0; i < cnts.size(); i++) {
			int left = get<0>(lrs[i]);
			int right = get<1>(lrs[i])+1;

			double g = 0;
			int cnt = 0;
			double thres = 1e-9;
			for (int j = 0; j < w; j++) {
				cnt += cnts[i][j];
				g += cnts[i][j] * (j + 0.5);
			}
			g /= cnt;
			if (g <= left+thres || right-thres <= g) {
				stable = false;
				break;
			}
			if (parents[i] == -1)continue;
			for (int j = 0; j < w; j++) {
				cnts[parents[i]][j] += cnts[i][j];
			}
		}
		if (stable)cout << "STABLE";
		else cout << "UNSTABLE";
		cout << endl;
	}
}


Measured memory_bytes: 3160
#include<bits/stdc++.h>
#define ll long long
#define pii pair<int,int>
using namespace std;
const int mxn=1e5+5;
const int inf=1e9;
int main() {
	int a,b,c;
	cin>>a>>b>>c;
	int k;
	cin>>k;
	if(a>=b) {
		while(k>0 && a>=b) {
			k--;
			b*=2;
		}
	}
	if(b>=c) {
		while(k>0 && b>=c) {
			k--;
			c*=2;
		}
	}
	if(a<b && b<c) {
		cout<<"Yes"<<endl;
	} else cout<<"No"<<endl;
}

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

using namespace std;
int n, t, i;
float m, sum=0;
priority_queue<int> q;


int main() {
    scanf(" %d %f", &n, &m);
    for (i=0;i<n;i++) {
        scanf(" %d", &t);
        q.push(t);
        sum += t;
    }
    for (i=0;i<m;i++) {
        t = q.top();q.pop();
    }
    if (t >= sum / 4 / m) printf("Yes");
    else  printf("No");
    return 0;
}

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

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

using namespace std;

int main(void){
  int n;
  cin >> n;
  
  int a[n][n];
  rep(i, n){
    rep(j, n){
      a[i][j] = -1;
    }
  }

  rep(i, n){
    int m;
    cin >> m;
    rep(j, m){
      int x, y;
      cin >> x >> y;
      a[i][--x] = y;
    }
  }

  int ans = 0;
  rep(i, 1<<n){
    vector<int> d(n);
    rep(j, n) if(i>>j & 1){
      d[j] = 1;
    }    
    bool ok = true;
    rep(j, n){
      if(d[j]){
        rep(k, n){
          if(a[j][k] == -1) continue;
          if(a[j][k] != d[k]) ok = false;
        }
      }
    }
    if(ok) ans = max(ans, __builtin_popcount(i));
  }

  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define r(i,n) for(int i=0;i<n;i++)
using namespace std;
int n,a,b;
bool used[1000004];
int main(){
  while(cin>>n>>a>>b,n){
    int sum=0;
    memset(used,0,sizeof(used));
    for(int i=a;i<=n;i+=a)used[i]=1;
    for(int j=b;j<=n;j+=b)used[j]=1;
    r(i,n+1)if(used[i]&&i+a<=n)used[i+a]=1;
    r(i,n+1)if(used[i]&&i+b<=n)used[i+b]=1;
    r(i,n)if(!used[i+1])sum++;
    cout<<sum<<endl;
  }
}

Measured memory_bytes: 4052
#include<stdio.h>
int main(){
    int A,B,C,D,L,R;
    scanf("%d %d %d %d",&A,&B,&C,&D);
    L=A+B;
    R=C+D;
    if(L>R){
        printf("Left\n");
    }
    else if(R>L){
        printf("Right\n");
    }
    else{
        printf("Balanced\n");
    }
    return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
#define pb push_back
#define ll long long
#define f first
#define s second
using namespace std;
int n;
ll a[3001];
int main(){
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    cin >> n;ll sum = 0;
    for(int i = 1; i <= n; i++){
        cin >> a[i]; sum += a[i];
    }
    cout << sum -n << endl;
    return 0;
}


Measured memory_bytes: 3652
import java.util.Scanner;

public class Main{
  public static void main(String[] args){
    Scanner scanner = new Scanner(System.in);
    int N = scanner.nextInt();
    int K = scanner.nextInt();
    int sunukes[] = new int[N];
    
    for(int i = 0;i < K;i++){
      int d = scanner.nextInt();
      for(int j = 0;j < d;j++){
        int a = scanner.nextInt() - 1;
        sunukes[a]++;
      }
    }
    int sum = 0;
    for(int i = 0;i < sunukes.length;i++){
      if(sunukes[i] == 0){
      	sum++;
      }
    }
    System.out.println(sum);
  }
}

Measured memory_bytes: 37448
use std::io::{stdin, stdout, StdinLock, BufReader, BufWriter, BufRead, Write};

#[allow(unused_must_use)]
fn main() {
    let (std_in, std_out) = (stdin(), stdout());
    let br = &mut BufReader::new(std_in.lock());
    let bw = &mut BufWriter::new(std_out.lock());
    
    let n = rn::<i32>(br);
    writeln!(bw, "{}", n*n*n);
}



// Functions for reading inputs ///////////////////////////////////////
#[allow(dead_code)]
fn rs(br: &mut BufReader<StdinLock>) -> Vec<char> {
    let mut buf = String::new();
    br.read_line(&mut buf).ok();
    buf.trim().chars().collect()
}

#[allow(dead_code)]
fn rn<T: std::str::FromStr>(br: &mut BufReader<StdinLock>) -> T {
    let mut buf = String::new();
    br.read_line(&mut buf).ok();
    buf.trim().parse().ok().unwrap()
}

#[allow(dead_code)]
fn rvs(br: &mut BufReader<StdinLock>) -> Vec<Vec<char>> {
    let mut buf = String::new();
    br.read_line(&mut buf).ok();
    buf.trim().split_whitespace().map(|e| e.chars().collect()).collect()
}

#[allow(dead_code)]
fn rvn<T: std::str::FromStr>(br: &mut BufReader<StdinLock>) -> Vec<T> {
    let mut buf = String::new();
    br.read_line(&mut buf).ok();
    buf.trim().split_whitespace().map(|e| e.parse().ok().unwrap()).collect()
}

Measured memory_bytes: 4352
#include <iostream>
 
using namespace std;
const int s= 1e5+5;
int data[s][3];
int dp [s][3];
int n;
int vacation(int a,int i){
if(i == n) return 0;
	if(dp[i][a] != -1) return dp[i][a];
	int& ans = dp[i][a];
 
	if(a==0){
		ans=max(ans, vacation(1, i+1)+data[i][0]);
		ans=max(ans, vacation(2, i+1)+data[i][0]);
	}
	if(a==1){
		ans=max(ans, vacation(0, i+1)+data[i][1]);
		ans=max(ans, vacation(2, i+1)+data[i][1]);
	}
	if(a==2){
		ans=max(ans, vacation(0, i+1)+data[i][2]);
		ans=max(ans, vacation(1, i+1)+data[i][2]);
	}
 
	return ans;
}
 
int main()
{
 cin >> n;
    for(int i=0;i<n;i++){
        for(int j=0; j<3;j++){
            cin >> data[i][j];
            dp[i][j]=-1;
        }
 
    }
 int result = max(max(vacation(0,0),vacation(1,0)),vacation(2,0));
    cout << result << endl;
 return 0;
 
}

Measured memory_bytes: 7296
import copy
n, m, x = map( int, input().split() )
c = [ 0 ]
a = [[]]
for _ in range( n ):
    line = input().split()
    c = c + [ int( line[0] ) ]
    a = a + [ [ 0 ] + list( map( int, line[1:] ) ) ]

#print( n, m, x, c, a )

def search( understood, money, i ):
    if i > n:
        #print( understood )
        for j in range( 1, m+1 ):
            if understood[j] < x:
                return
        sum_money.append( money )
        return money
    else:
        search( understood, money, i+1 )
        next_understood = copy.deepcopy( understood )
        for j in range( 1, m + 1 ):
            next_understood[j] += a[i][j]
        next_money = money + c[i]
        search( next_understood, next_money, i+1 )

understood = [ 0 ] * ( m + 1 )
sum_money = []
search( understood, 0, 1 )
#sum_money.append( search( understood, 0, 1 ) )

try:
    print( min( sum_money ) )
except ValueError:
    print( "-1" )

Measured memory_bytes: 9360
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		for (int i = 1;; i++) {
			int x = sc.nextInt();
			if (x == 0) {
				break;
			}
			System.out.println("Case " + i + ": " + x);
		}
	}
}



Measured memory_bytes: 40772
/*
	Copyright: razouq (c)
	Author: Anass BENDARSI
	Date: 07/01/2018 12:20:55
	flamers will **** you
*/
#include<bits/stdc++.h>
//#include<flamers.h>
#define ll long long
#define ull unsigned long long
#define F first
#define S second
#define PB push_back
#define MP make_pair
#define POB pop_back
#define dist(a, b) sqrt(a*a + b*b)
using namespace std;
typedef vector<int> vi;
typedef pair<int, int> pi;
typedef vector<pair<int, int>> vipi;
bool compare(pi p1, pi p2){
	 if(1) return true;
	 return false;
}

int main(){
//	freopen("input.in", "r", stdin);
//	freopen("output.out", "w", stdout);
	ios::sync_with_stdio(0);
	cin.tie();
	long long N, Y;
	long long x = -1, y = -1, z = -1;
	bool flag = false;
	cin>>N>>Y;
	Y /= 1000;
	for(long long i = 0; i <= N; i++){
		if((Y-N-9*i) % 4 == 0) {
			x = i;
			y = (Y-N-9*i) / 4;
			z = N-x-y;
			if(x >= 0 && y>= 0 && z >= 0) {
				flag = true;
				break;
			}
		}
	}
	if(flag) cout<<x<<" "<<y<<" "<<z<<endl;
	else cout<<"-1 -1 -1"<<endl;
	return 0;
}


Measured memory_bytes: 256
a,b,x = gets.split.map(&:to_f)

if a ** 2 * b / 2 < x
    y = 2 * (a ** 2 * b - x) / (a ** 2)
    puts Math.atan(y/a) * 180 / Math::PI
else
    y = 2 * x / (a * b)
    puts 90 - Math.atan(y/b) * 180 / Math::PI
end

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

using namespace std;

typedef complex<double> Point;
const double epx = 1e-10;

bool notNorm(Point a,Point b)
{
    return imag(b*conj(a))<-epx;
}

bool isConvex(vector<Point> points,int sz)
{
    if(sz<3) return false;
    points.push_back(points[0]);
    points.push_back(points[1]);
    for(int i=1;i<=sz;i++)
    {
        if(notNorm(points[i+1]-points[i],points[i-1]-points[i])) return false;
    }
    return true;
}

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

    int n;
    cin>>n;
    vector<Point> points;
    for(int i=0;i<n;i++)
    {
        int x,y;
        cin>>x>>y;
        points.emplace_back(x,y);
    }
    cout<<isConvex(points,n)<<endl;

    return 0;
}



Measured memory_bytes: 3164
import numpy as np
k,n=map(int,input().split())
a=list(map(int,input().split()))
a=np.array(a)
a1=abs(a[1:]-a[:-1])
a2=list(a1)
a2.append(abs(a[0]+k-a[-1]))
print(sum(a2)-max(a2))

Measured memory_bytes: 34168
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n,k[51],l;
  scanf("%d %d",&n,&l);
  for(int i=0;i<n;i++){
    cin>>k[i];
  }
  for(int i=0;i<n-1;i++){
    for(int j=0;j<n-i-1;j++){
      if(k[j]<k[j+1]){
	int temp=k[j];
	k[j]=k[j+1];
	k[j+1]=temp;
      }
    }
  }
  int ans=0;
  for(int i=0;i<l;i++){
    ans+=k[i];
  }
  cout<<ans<<endl;
  return 0;
}


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

int main()
{
    int a,b,c,d;

    scanf("%d %d %d %d",&a,&b,&c,&d);

    while(1){
        c=c-b;
        if(c<=0){
            printf("Yes\n");
            break;
        }
        a=a-d;
        if(a<=0){
            printf("No\n");
            break;
        }
    }
    return 0;
}



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

#define ms(s, n) memset(s, n, sizeof(s))
#define FOR(i, a, b) for (int i = (a); i <= (b); i++)
#define FORd(i, a, b) for (int i = (a) ; i >= (b); i--)
#define FORall(it, a) for (__typeof((a).begin()) it = (a).begin(); it != (a).end(); it++)
#define sz(a) int((a).size())
#define present(t, x) (t.find(x) != t.end())
#define all(a) (a).begin(), (a).end()
#define uni(a) (a).erase(unique(all(a)), (a).end())
#define pb push_back
#define pf push_front
#define mp make_pair
#define fi first
#define se second
#define sp system("pause")
#define prec(n) fixed<<setprecision(n)
#define bit(n, i) (((n) >> (i)) & 1)
#define bitcount(n) __builtin_popcountll(n)
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<int, int> pi;
typedef vector<int> vi;
typedef vector<pi> vii;
const int MOD = (int) 1e9 + 7;
const int INF = (int) 1e9;
const ll LINF = (ll) 1e18;
const ld PI = acos((ld) -1);
const ld EPS = 1e-9;
const int N = (int) 1e5 + 10;
void TimeExecution() {
    cout << "\n\n===>> Time Execution: " << clock() / (double)1000 << " sec(s).";
}
int t;
ll cal(ll n, ll a)
{
    return (n / a);
}
ll lcm(ll a, ll b)
{
    return (a * b) / __gcd(a, b);
}
int main()
{
    ios_base::sync_with_stdio(0); cin.tie(0);
    /*
    #ifndef ONLINE_JUDGE
        freopen("in.txt", "r", stdin);
        freopen("out.txt", "w", stdout);
    #endif
    */
    ll a, b, c, d;
    cin >> a >> b >> c >> d;
    ll res = b - a + 1;
    ll r1 = cal(b, c) - cal(a - 1, c);
    ll r2 = cal(b, d) - cal(a - 1, d);
    ll e = lcm(c, d);
    ll r3 = cal(b, e) - cal(a - 1, e);
    cout << max(0LL, res - (r1 + r2 - r3));
    return 0;
}


Measured memory_bytes: 256
import std.stdio, std.string, std.algorithm, std.conv;

int[] a; 

void main(){
	string[] s;
	while (1) {
		s = split(readln());
		a = [];
		foreach (i; s) a ~= to!int(i);
		if (a[0] == 0) break;
		writeln(solve(0, 0));
	}
}

int solve(int p, int n){
	if (n > 21) return 0;
	if (p >= a.length) return n;
	if (a[p] == 1) return max(solve(p+1, n+1), solve(p+1, n+11));
	if (a[p] > 10) a[p] = 10; 
	return solve(p+1, n+a[p]);
}

Measured memory_bytes: 972
#include <bits/stdc++.h>
 
#define rep(...) overload_rep(__VA_ARGS__, rep_1, rep_0) (__VA_ARGS__)
#define rep_0(i, end) for (int i = 0; i < (end); ++i)
#define rep_1(i, fr, ba) for (int i = (fr); i <= (ba); ++i)
#define overload_rep(arg_0, arg_1, arg_2, name, ...) name
#define all(box) box.begin(), box.end()
 
template <class T, class U> inline bool chmax(T& lhs, const U& rhs) { if (lhs < rhs) { lhs = rhs; return 1; } return 0; }
template <class T, class U> inline bool chmin(T& lhs, const U& rhs) { if (lhs > rhs) { lhs = rhs; return 1; } return 0; }

int main() {

  int h, w, n;
  std::cin >> h >> w >> n;
  int t = std::max(h, w);
  std::cout << (n + t - 1) / t << '\n';

}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

int main(){
    int N; cin >> N;
    vector<long double> T(N), A(N);
    for(int i=0; i<N; i++){
        cin >> T[i] >> A[i];
    }

    ll t = 1LL, a = 1LL;
    for(int i=0; i<N; i++){

        if(t <= T[i] && a <= A[i]){
            t = T[i]; a = A[i];
        }
        else{
            ll k = max(ceil((long double)t / T[i]), ceil((long double)a / A[i]));
            t = T[i] * k;
            a = A[i] * k;
        }
        
    }

    cout << t+a << endl;

}


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

int main() 
{
	long long x,i,j,s,d,b,a,max;
	double q,e,p;
	scanf("%lld%lld%lld",&a,&b,&x);
	i=(b-1)>x?x:(b-1);
	q= (double)(a*i) / b;
	j=q;
       printf("%lld",j);
       return 0;
}

Measured memory_bytes: 1736
#include <stdio.h> 
int main(void) { int data[4][13] = {}; int i, j; char c, mark[4] = {'S', 'H', 'C', 'D'}; int n, num; scanf("%d", &n); while (n--) { scanf(" %c %d", &c, &num); num--; switch(c) { case 'S': data[0][num] = 1; break; case 'H': data[1][num] = 1; break; case 'C': data[2][num] = 1; break; case 'D': data[3][num] = 1; break; } } for (i = 0; i < 4; i++) { for (j = 0; j < 13; j++) { if (!data[i][j]) { printf("%c %d\n", mark[i], j + 1); } } } return 0; } 


Measured memory_bytes: 2072
import java.util.*;
import java.lang.*;
import java.io.*;

public class Main {
    public static void main(String args[]) throws Exception{
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        
        String[] nx = br.readLine().split(" ");
        int n = Integer.parseInt(nx[0]);
        int x = Integer.parseInt(nx[1]);
        int min = 1300;
        
        for(int i = 0; i < n; i++){
            int temp = Integer.parseInt(br.readLine());
            min = min > temp ? temp : min;
            x -= temp;
        }
        
        System.out.println(n + x/min);
    }
}


Measured memory_bytes: 21716
from collections import deque
S = input()
Q = int(input())
F=0
d=deque(S)
for i in range(Q):
  q=list(map(str,input().split()))
  if q[0]=="1":
    F+=1
    F%=2
  else:
    if q[1]=="1":
      if F==0:
        d.appendleft(q[2])
      else:
        d.append(q[2])
    else:
      if F==0:
        d.append(q[2])
      else:
        d.appendleft(q[2])  
d=list(d)
if F%2==0:
  print("".join(d))
else:
  print("".join(d[::-1]))

Measured memory_bytes: 73432
#include<stdio.h>
#include<string.h>
int main() {
	char s[100050];
	scanf ( "%s", s );
	int siz = strlen ( s );
	for ( int j = 0; j < siz - 1; j++ ) {
		if ( s[j] == s[j + 1] ) {
			printf ( "%d %d\n", j + 1, j + 2 );
			return 0;
		} else if ( j < siz - 2 && s[j] == s[j + 2] ) {
			printf ( "%d %d\n", j + 1, j + 3 );
			return 0;
		}
	}
	printf ( "-1 -1\n" );
	return 0;
}



Measured memory_bytes: 256