akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <numeric>
#include <queue>
#include <vector>
#include <cmath>
#include <cctype>
#include <cstring>
#include <cstdio>
#include <set>

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

using namespace std;

typedef long long LL;
typedef pair<int, int> PII;

int main(void){
  int n;
  LL y;
  cin >> n >> y;

  int cnt = 0;
  for (int i = 0; i <= n; i++) {
    for (int j = 0; j <= n-i; j++) {
      LL remain = y - 10000 * i - 5000 * j;
      if (remain < 0) break;

      int num = remain / 1000;
      if (num + i + j == n && remain % 1000 == 0) {
        cout << i << ' ' << j << ' ' << remain / 1000 << endl;
        return 0;
      }
    }
  }

  cout << "-1 -1 -1" << endl;

  return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
#define MAX 100005
#define NIL -1

int getDepth(int);
void setDepth(int, int);
void printChildren(int);
void print(int);

struct Node{
  int parent;
  int left;
  int right;
};

struct Node T[MAX];
int n,D[MAX];

int main()
{
  int i,j,d,v,c,l,r;

  scanf("%d",&n);
  for(i = 0; i< n; i++)T[i].parent = T[i].left = T[i].right = NIL;

  for(i = 0; i < n; i++){
    scanf("%d %d",&v, &d);
    for(j = 0; j < d; j++){
      scanf("%d",&c);
      if(j == 0)T[v].left = c;
      else T[l].right = c;
      l = c;
      T[c].parent = v;
    }
  }
  for(i = 0; i < n; i++){
    if(T[i].parent == NIL)r = i;
  }

  setDepth(r, 0);

  for(i = 0; i < n; i++)print(i);
  
  return 0;
}

int getDepth(int u)
{
  int d = 0;

  while(T[u].parent != NIL){
    u = T[u].parent;
    d++;
  }
  return d;
}

void setDepth(int u, int p)
{
  D[u] = p;
  if(T[u].right != NIL){
    setDepth(T[u].right, p);
  }
  if(T[u].left != NIL){
    setDepth(T[u].left, p+1);
  }
} 

void printChildren(int u)
{
  int c;
  
  c = T[u].left;
  while(c != NIL){
    print(c);
    c = T[u].right;
  }
}

void print(int u)
{
  int i,c;

  printf("node %d: parent = %d, depth = %d, ",u,T[u].parent,D[u]);

  if(T[u].parent == NIL)printf("root, ");
  else if(T[u].left == NIL)printf("leaf, ");
  else printf("internal node, ");

  printf("[");

  for(i = 0, c = T[u].left; c != NIL; i++, c = T[c].right){
    if(i)printf(", ");
    printf("%d",c);
  }
  printf("]\n");
}



Measured memory_bytes: 6392
#include <bits/stdc++.h>
 
using namespace std;
 
#define ss second
#define ff first
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define all(a) (a).begin(),(a).end()
#define rep(i,a,b) for(int (i) = (a); (i) < (b); (i)++)
#define debug(x) cout << #x << " = " << x << endl
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
using ll = long long;
using ii = pair<int,int>;
using vi = vector<int>;
using vll = vector<ll>;
using vii = vector<pair<int,int>>;
const int INF = 0x3f3f3f3f;
const ll LINF = 0x3f3f3f3f3f3f3fLL;
const int maxn = 1e2+10;

int main(int argc,const char** argv){

	fastio;

	int n,m,s = 0;

	cin >> n >> m;

	vi v(n);

	rep(i,0,n){ cin >> v[i]; s+=v[i]; }

	sort(v.rbegin(),v.rend());

	bool ok = true;

	rep(i,0,m)
		if(v[i]*4*m < s) ok = false;

	cout << (ok ? "Yes" : "No") << '\n';

	return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <cmath>
#include <iostream>
#include <vector>
#include <string>
#include <utility>
#include <algorithm>
#include <queue>
using namespace std;
#define FOR(i,a,b) for(ll i=a;i<b;i++)
#define REP(i,n) for(ll i=0;i<n;i++)
#define REPR(i,n) for(ll i=n-1;i>=0;i--)

typedef long long ll;
#define INF 1e18

void hoge(string a,int kind,int n,int end){
	string tmp=a;
	if(n==end){
		cout<<tmp<<endl;
		return;
	}
	REP(i,kind){
		tmp[n]=i+'a';
		hoge(tmp,kind,n+1,end);
	}
	tmp[n]=kind+'a';
	hoge(tmp,kind+1,n+1,end);
	return;
}

int main(){
	ll n; cin>>n;
	string a(n,'a');
	hoge(a,1,1,n);
	return 0;
}


Measured memory_bytes: 1536
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

public class Main {
    public static void main(String args[]) throws IOException{
        process();
    }
    public static void process() throws IOException{
        BufferedReader in=new BufferedReader(new InputStreamReader(System.in));
        StringTokenizer st=new StringTokenizer(in.readLine());
        int n=Integer.parseInt(st.nextToken());
        int W= Integer.parseInt(st.nextToken());
        int w[]=new int[n+1];
        int v[]=new int[n+1];
        for(int i=1;i<=n;i++){
            st=new StringTokenizer(in.readLine()," ");
            w[i]=Integer.parseInt(st.nextToken());
            v[i]=Integer.parseInt(st.nextToken());
        }
        long dp[][]=new long[n+1][W+1];
        for(int i=1;i<=n;i++){
            for(int j=1;j<=W;j++){
                if(j<w[i])
                    dp[i][j]=dp[i-1][j];
                else
                    dp[i][j]=Math.max(dp[i-1][j],v[i]+dp[i-1][j-w[i]]);
            }
        }
        System.out.println(dp[n][W]);
    }
}


Measured memory_bytes: 127060
#include<bits/stdc++.h>
// #include <boost/lexical_cast.hpp>
using namespace std;

#define ll long long int
#define vll vector<ll>
#define vllv vector<vector<ll>> 
#define vpii vector<pair<ll,ll>>
#define sz size()
#define pb push_back
#define ff first
#define ss second
#define all(v) v.begin(),v.end()
#define allr(v) v.rbegin(),v.rend()
#define fast ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)

ll ceil1(ll n,ll m){if(n%m==0){return n/m;}return n/m +1;}
vll factor(ll n){
    vll ans;
	if(n==2)ans.pb(2);
	else
    {for(ll i=2;i*i<=n;i++){if(n%i==0 && n%i!=i){ans.pb(i);if(n/i!=i)ans.pb(n/i);}}ans.pb(n);}
    return ans;
}
ll fact(ll n){ll res = 1;for (ll i = 2; i <= n; i++)res = res * i; 
    return res; } 
  
ll nCr(ll n, ll r){ return fact(n) / (fact(r) * fact(n - r)); } 
  
void dfs(vllv &v,ll k,vll &par,vll &dis,ll p)
{
    par[k]=p;
    dis[k]=dis[p]+1;
    for(ll i=0;i<v[k].sz;i++){
        if(v[k][i]!=p){
            dfs(v,v[k][i],par,dis,k);
        }
    }
}
bool sortbysec(const pair<string,int> &a,const pair<string,int> &b){return (a.second<b.second);} 

ll pow2(ll n,ll k){ll ans=1;
    while(k>0){
        if(k%2==1)ans=ans*n;n=n*n;k/=2;
    }return ans;}
bool prime(int n){
    int i,j;
    for(i=2;i<=sqrt(n);i++){
        if(n%i==0){
            return false;
        }
    }
    return true;
}
bool bserch(vector<string> a, string s){
	ll l=0,r=a.sz-1,mid;
	while(l<=r){
		mid=(l+r)/2;
		if(a[mid]==s)return true;
		if(a[mid]<s){
			l=mid+1;
		}else{
			r=mid-1;
		}
	}
	return false;
}

bool sortcol(const vector<int>& v1, 
               const vector<int>& v2){ 
 return v1[0] < v2[0]; } 

 ll degit(ll n)
 {
 	ll t=0;
 	while(n>0)
 	{
 		t++;
 		n/=10; 	}
 		return t;
 }
void ff() {
	cout << "FastestFinger" << endl;
}
 
void aa() {
	cout << "Ashishgup" << endl;
}
 
void solve()
{
	ll n,sum=0;
	cin>>n;
	vll a(n+1),cnt(n+1);
	ll x=0;
	for(ll i=1;i<=n;i++)
		cin>>a[i],x=x^a[i];;
	
	for(ll i=1;i<=n;i++)
	{	cnt[i]=x^a[i];
	}
	for(ll i=1;i<=n;i++)
		cout<<cnt[i]<<" ";
}
int main()
{
	fast;
    ll q;
    q=1;
    // cin>>q;
    while(q--)
    {
        solve();
    }
    return 0;
}


Measured memory_bytes: 6328
double x[100],y[100],t,u,a,b,s;n,i,j,k,c;main(m){for(;m=scanf("%d",&n),j=i=n;printf("%d\n",m)){for(;j--;scanf("%lf,%lf",x+j,y+j));for(;j=--i;)for(;j--;)if(s=(u=acos(hypot(x[j]-x[i],y[j]-y[i])/2))<9)for(t=atan2(y[j]-y[i],x[j]-x[i]);c=0,s+3;s-=2)for(a=x[i]+cos(b=t+s*u),b=y[i]+sin(b),k=n;k--;)hypot(a-x[k],b-y[k])<1.1&&++c>m?m=c:0;}}

Measured memory_bytes: 0
#include <bits/stdc++.h>
#define int long long
using namespace std;

struct Matrice
{
    int tab[50][50];
};

const int MOD = pow(10, 9) + 7;
Matrice base;

int nbSommets, lenPath;
Matrice multiplication(Matrice a, Matrice b)
{
    Matrice produit;
    for (int idDebut = 0; idDebut < nbSommets; ++ idDebut)
    {
        for (int idFin = 0; idFin < nbSommets; ++ idFin)
        {
            produit.tab[idDebut][idFin] = 0;
            for (int middle = 0; middle < nbSommets; ++middle)
                produit.tab[idDebut][idFin] = (produit.tab[idDebut][idFin] + a.tab[idDebut][middle] * b.tab[middle][idFin])%MOD;
        }
    }
    return produit;
}

Matrice exponentiation(int puissance)
{
    if (puissance == 1) return base;
    Matrice res = exponentiation(puissance/2);
    Matrice toReturn = multiplication(res, res);
    if (puissance%2 == 1)
    {
        Matrice tamp = multiplication(toReturn, base);
        toReturn = tamp;
    }
    return toReturn;
}

signed main()
{
    cin >> nbSommets >> lenPath;
    for (int i = 0; i < nbSommets; ++i)
        for (int j = 0; j < nbSommets; ++j)
            cin >> base.tab[i][j];
    Matrice resultat = exponentiation(lenPath);
    int sum = 0;
    for (int i = 0; i < nbSommets; ++i)
        for (int j = 0; j < nbSommets; ++j)
            sum = (sum + resultat.tab[i][j])%MOD;
    cout << sum << endl;
    return 0;
}

Measured memory_bytes: 8192
#include <cstdio>
#include <algorithm>
#include <vector>
#include <utility>
using namespace std;

typedef long long LL;
typedef pair <LL, LL> PII;

vector<PII> a;
LL dp[2005][2005];
int n;

LL solve(int l, int r){
	if (l > r) return 0;
	if (dp[l][r]) return dp[l][r];
	int i = r - l;
	return dp[l][r] = max(solve(l, r - 1) + a[i].first * (r - a[i].second), solve(l + 1, r) + a[i].first * (a[i].second - l));
}

int main(){
	scanf("%d", &n);
	for(int i = 0; i < n; i++){
		int x;
		scanf("%d", &x);
		a.push_back({x, i});
	}
	sort(a.begin(), a.end());
	solve(0, n - 1);
	printf("%lld\n", dp[0][n - 1]);
	return 0;
}


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

int main() {
	string s,t;
	cin >> s >> t;
	int ans = 1000;
	int len_s = s.length();
	int len_t = t.length();
	rep(i,len_s-len_t+1) {
		int diff = 0;
		rep(j,len_t) {
			if (s[i+j]!=t[j]) diff++;
		}
		ans = min(ans, diff);
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 3632
#include<iostream>
//#include <bits/stdc++.h>
using namespace std;
#include<algorithm>
#include<map>
#include<vector>
#include <iomanip>
#include <set>
#include<cmath>
#define F first
#define S second
#define pii pair<int,int>
#define pb push_back
#define ll long long
#define mp make_pair
void sp(double y,int x){cout<<fixed<<setprecision(x)<<y;}
int inf=1e9+10;
int const M=2e5+10;
int const M2=1e6+10;
int const M3=1e3+10;
int mod=1e9+7;
map<pii,int>mark;
int sa(int x,int y){if(x%y==0)return x/y;return x/y+1;}
int binp(int x,int y){int ans=1;int t=x;while(y!=0){if(y%2==1){ans*=t;ans;}y/=2;t*=t;t;}return ans;}
int main(){
	ios::sync_with_stdio(0) , cin.tie(0) , cout.tie(0);
	int n,m;
	cin>>n>>m;
	int a,b;
	for(int i=1;i<=m;i++)
    {
        cin>>a>>b,mark[mp(a,b)]=1,mark[mp(b,a)]=1;
    }
    bool ans=0;
    for(int i=1;i<=n;i++)
    {
        if(mark[mp(1,i)] && mark[mp(n,i)])
            ans=1;
    }
    if(ans)
        cout<<"POSSIBLE";
    else
        cout<<"IMPOSSIBLE";
}


Measured memory_bytes: 37760
#include <algorithm>
#include <iostream>
#include <queue>
#include <string>
#include <vector>
#include <math.h>
#include <utility>
#include <map>
#include <queue>
#include <stack>
#include <initializer_list>
using namespace std;

#define INF 210000000
#define int long long

int gcd(int a, int b) {
  int amari = a % b;
  int c = b;
  if (amari == 0) {
    return b;
  } else {
    return gcd(b, amari);
  }
}

int lcm(int a, int b) { return a * b / gcd(a, b); }
void solve(){
    double a,b,h;
    cin >> a >> b >> h;
    cout << (a + b) * h / 2;
}
signed main() {
    solve();
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define fs first
#define sc second
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define ALL(A) A.begin(),A.end()
#define RALL(A) A.rbegin(),A.rend()
typedef long LL;
typedef pair<LL,LL> P;
const LL mod=1e9+7;
const LL LINF=1LL<<62;
const int INF=1000000000;



int main(){
    int N;cin >> N;
    vector<int> h(N);
    for (int i = 0; i < N; i++) {
        cin >> h[i];
    }
    int ans=0;
    for (int i = 0; i < N; ) {
        if(h[i]==0){
           i++;
           continue;
        }
        for (int j = i; j < N; j++) {
            if(h[j]==0) break;
            h[j]--;
        }
        ans++;
    }
    cout << ans << endl;
    return 0;
}





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

#define ll              long long
#define pb              push_back
#define ppb             pop_back
#define endl            '\n'
#define mii             map<ll,ll>
#define pii             pair<ll,ll>
#define vi              vector<ll>
#define vs              vector<string>
#define all(a)          (a).begin(),(a).end()
#define F               first
#define S               second
#define sz(x)           ((ll)x.size())
#define hell            (1000000007)
#define inf             ((ll)5e18 + 5)
#define PI              ((double)3.14159265358979323844)
#define DECIMAL(n)      cout << fixed << setprecision(n);
#define rep(i,a,b)      for (ll i=a;i<b;i++)
#define repr(i,a,b)     for (ll i=a-1;i>=b;i--)
#define bitcount(a)     (ll)__builtin_popcount(a)
#define lbnd            lower_bound
#define ubnd            upper_bound
#define mp              make_pair
#define ios             ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define ordered_set     tree<ll, null_type,less<ll>, rb_tree_tag,tree_order_statistics_node_update>
#define trace(...)      __f(#__VA_ARGS__, __VA_ARGS__)

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

using namespace std;
using namespace __gnu_pbds;

/*----------------------Graph Moves----------------*/
//const int fx[]={+1,-1,+0,+0};
//const int fy[]={+0,+0,+1,-1};
//const int fx[]={+0,+0,+1,-1,-1,+1,-1,+1};   // Kings Move
//const int fy[]={-1,+1,+0,+0,+1,+1,-1,-1};  // Kings Move
//const int fx[]={-2, -2, -1, -1,  1,  1,  2,  2};  // Knights Move
//const int fy[]={-1,  1, -2,  2, -2,  2, -1,  1}; // Knights Move
/*------------------------------------------------*/

//primes for hashing 937,991,1013,1409,1741

ll expo(ll base, ll exponent) {                     //return base^exponent modulo hell
    ll ans = 1;
    while(exponent !=0 ) {
        if((exponent&1) == 1) {
            ans = ans*base ;
            ans = ans%hell;
        }
        base = base*base;
        base %= hell;
        exponent>>= 1;
    }
    return ans%hell;
}

ll add(ll a,ll b) {
    return ((a%hell)+(b%hell))%hell;
}
ll sub(ll a,ll b) {
    return ((a%hell)-(b%hell)+hell)%hell;
}
ll mul(ll a,ll b) {
    return ((a%hell)*(b%hell))%hell;
}
void solve() {
    ll n;
    cin>>n;
    cout<<add(sub(expo(10, n), mul(2, expo(9, n))), expo(8, n))<<endl;
}

signed main() {
    ios
    ll test=1;
    //cin>>test;
    while (test--) solve();
    return 0;
}

Measured memory_bytes: 3652
#include <bits/stdc++.h>
using namespace std;
using LL = long long;
#define M 1000000007
int main()
{
    int N,A;cin >>N >> A;
    N%=500;
    if(N<=A){
        cout<<"Yes"<<endl;
    }else{
        cout<<"No"<<endl;
    }
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<set>
#include <bitset>
#include<queue>
#include<vector>
#include<map>
#include<stack>
#include <cstdio>
#include<algorithm>
#include <sstream>
#include<string>
#include<string.h>
#include <cmath>
#include <iomanip>
#include <string>
#include<list>
#include <limits>
#include <numeric>
#include <type_traits>
#include<bitset>
#define int long long
#define ll long long
#define mod  1000000007
#define inf 1e17
#define rep(i,j,n) for(int i=j;i<n;i++)
#define P pair<int,int>
double pi = 3.141592653589793;
using namespace std;
//ここから始めよう
signed main(){
    int n,x;cin>>n>>x;
    int a[114];
    rep(i,0,n)cin>>a[i];
    sort(a,a+n);
    int ans=0;
    int last=-1;
    rep(i,0,n){
        if(a[i]<=x){
            ans++;
            x-=a[i];
            last=i;
        }
    }
    int z=0;
    if(x&&last==n-1)cout<<max(z,ans-1)<<endl;
    else cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 256
//containing t test cases
#include<bits/stdc++.h>
#define pb push_back
#define mod 1000000007
#define mkp make_pair
#define fi first
#define se second
#define ll long long
#define scan(n) ll a[n]; for(ll i = 0 ; i<n ; i++) cin>>a[i]
#define print(a,n) for(int i = 0 ; i < n ; i++) cout<<a[i]<<' '
#define fast ios_base::sync_with_stdio(false); cin.tie(0);cout.tie(0);
#define rep(i,x,y) for(ll i=x;i<y;i++)
#define pi 3.1415926535897932384626433832795028841971
//#define int long long
using namespace std;
//typedef vector<int>vi ;
typedef vector<ll>vi ;
typedef vector<vector<ll> >vvl ; 
typedef pair<ll,ll> pll ;
typedef vector<pair<ll,ll> > vpll;
//cout<<fixed<<setprecision(15);
/*vi adj[200005];
ll vis[200005];
ll parent[200005];
ll level[200005];
ll arr[200005];
ll size[200005];*/
//endl mut bhool!!
/*set<ll> s;
void primeFactors(int n)  
{  
    // Print the number of 2s that divide n  
    while (n % 2 == 0)  
    {  
        s.insert(2);
        mp[2]++;  
        n = n/2;  
    }  
    // n must be odd at this point. So we can skip  
    // one element (Note i = i +2)  
    for (int i = 3; i <= sqrt(n); i = i + 2)  
    {  
        // While i divides n, print i and divide n  
        while (n % i == 0)  
        {  
            s.insert(i);
            mp[i]++;  
            n = n/i;  
        }  
    }  
  
    // This condition is to handle the case when n  
    // is a prime number greater than 2  
    if (n > 2)  
    {
        s.insert(n); 
        mp[n]++; 
    }
}  */
int main()
{
	fast;
	ll test=1;
	//cin>>test;
	while(test--)
	{
		set<ll> s;
		map<ll,ll> mp;
		set<ll> :: iterator it;
		ll n;
		cin>>n;
		while (n % 2 == 0)  
   		 {  
        s.insert(2);
        mp[2]++;  
        n = n/2;  
    	}  
    	for (int i = 3; i <= sqrt(n); i = i + 2)  
    	{  
       		 while (n % i == 0)  
       	 	{  
       	   		  s.insert(i);
       	   		  mp[i]++;  
       	 	   		n = n/i;  
       		 }  
    	}  
    	if (n > 2)  
   		{
       		 s.insert(n); 
      		  mp[n]++; 
   	 	}
   	 	ll ans=0;
		for( it=s.begin();it!=s.end();it++)
		{
			ll x=*it;
			ll y=mp[x];
			ll a=1;
			while(mp[x]-a>=0)
			{
				mp[x]-=a;
				a++;
				ans++;
			}
		}
		cout<<ans<<endl;
		
	}
	return 0;
}
/*
cout<<"YES"<<endl;
cout<<"NO"<<endl;
*/


Measured memory_bytes: 3676
import std.algorithm, std.container, std.conv, std.math, std.range, std.typecons, std.stdio, std.string;

auto rdsp(){return readln.splitter;}
void pick(R,T)(ref R r,ref T t){t=r.front.to!T;r.popFront;}
void readV(T...)(ref T t){auto r=rdsp;foreach(ref v;t)pick(r,v);}

void main()
{
  int a, b; readV(a, b);

  if (a == 1) a = 14;
  if (b == 1) b = 14;

  writeln(a > b ? "Alice" : a < b ? "Bob" : "Draw");
}


Measured memory_bytes: 256
import java.util.Scanner;

class Main{

	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();
		int c = sc.nextInt();
		
		if(a<b & b<c){
			System.out.println("Yes");
		}else{
			System.out.println("No");
		}
	}
}


Measured memory_bytes: 26204
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
template<class T> inline bool chmax(T& a,T b){if(a<b){a=b;return 1;} return 0;}
template<class T> inline bool chmin(T& a,T b){if(a>b){a=b;return 1;} return 0;}
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define all(vec) vec.begin(),vec.end()
typedef long long ll;
typedef pair<ll,ll> l_l;
typedef pair<int,int> i_i;
const ll mod=1e9+7;
const int inf=1<<30;

ll kiri(ll a,ll b){return a%b==0?a/b:a/b+1;}

int main(){
  ll n,d,a;
  cin >> n >> d >> a;
  vector<l_l> v(n);
  rep(i,n) cin >> v[i].first >> v[i].second;
  sort(all(v));
  ll damage=0;
  ll ans=0;
  queue<l_l> q;
  rep(i,n){
    ll x=v[i].first,h=v[i].second;
    if(q.size()&&x>q.front().first){
      while(q.size()&&x>q.front().first){
        damage-=q.front().second;
        q.pop();
      }
    }
    if(h>damage){
      q.push(l_l(x+2*d,a*kiri(h-damage,a)));
      ans+=kiri(h-damage,a);
      damage=a*kiri(h,a);
    }
  }
  cout << ans << endl;
}

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

int main() {
    int a, sum = 0;
    rep (i, 4) cin >> a, sum += a;
    cout << sum / 60 << endl; sum %= 60;
    cout << sum << endl;
    return 0;
}


Measured memory_bytes: 3108
#include <iostream>
#include <algorithm>
#include <set>
using namespace std;

signed main() {
  int a, b, k; cin >> a >> b >> k;
  set<int> s;

  for(int i = 0; i < k; i++) {
    if(a+i <= b) s.insert(a+i);
  }
  for(int i = 0; i < k; i++) {
    if(b-i >= a) s.insert(b-i);
  }

  for(auto x: s) {
    cout << x << endl;
  }
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define all(v) v.begin(),v.end()
#define mem(arr) memset(arr,0,sizeof(arr))
#define ff first
#define ss second
#define int long long int
const int MOD = 1e9 + 7;
const int INF = 1e18;
const int N = 1e6 + 20;
vector<int> g[N];
vector<int> vis(N);
int32_t main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    int tc = 1;
    while(tc--){
        int n;
        cin >> n;
        int p[n];
        for(int i = 0; i < n; i++){
            cin >> p[i];
        }
        set<int> s;
        s.insert(p[0]);
        int ans = 1;
        for(int i = 1; i < n; i++){
            if(p[i] < *s.begin()){
                ans++;
            }
            s.insert(p[i]);
        }
        cout << ans << '\n';
    } 
}

Measured memory_bytes: 42496
#include <bits/stdc++.h>
#include <vector>
#include <iostream>
#include<algorithm>
#include<string>
#include <map>
#include <queue>
#include <stack>
#include<set>
#include<tuple>

#define DIV 1000000007
#define TE 2e5
using namespace std;
using ll = long long;
using ldb = long double;

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

	vector<ll> twos(35);
	twos[0] = 1;
	for (int i = 1; i < 35; i++) {
		twos[i] = twos[i - 1] * 2;
	}

	sort(a.begin(), a.end(), greater<ll>());
	ll ans = 0, M = 34;
	for (int i = 0; i < N; i++) {
		for (int j = M; j >= 0; j--) {
			if (twos[j] > 2 * a[i]) {
				M--;
			}

			if (cnt[a[i]] > 0 && cnt[twos[j] - a[i]] > 0) {
				if (a[i] == twos[j] - a[i] && cnt[a[i]] < 2)continue;
				cnt[a[i]]--, cnt[twos[j] - a[i]]--;
				ans++;
				//cout << a[i] << " " << twos[j] - a[i] << endl;
				break;
			}

			if (twos[j] <= a[i]) {
				break;
			}
		}
	}

	cout << ans << endl;
}

Measured memory_bytes: 42236
#include<iostream>
using namespace std;
int main(){
    int A[100][100]={},B[100][100]={};
    long C[100][100]={};
    int i,j,m,l,n,k,ii;
    cin>>n>>m>>l;
    for(i=0;i<n;i++){
        for(j=0;j<m;j++){
            cin>>A[i][j];
        }
    }
    for(i=0;i<m;i++){
        for(j=0;j<l;j++){
            cin>>B[i][j];
        }
    }
    for(i=0;i<n;i++){
        for(j=0;j<l;j++){
            for(k=0;k<m;k++){
                C[i][j]+=A[i][k]*B[k][j];
            }
                   }
    }
    for(i=0;i<n;i++){
        for(ii=0;ii<l;ii++){
            cout<<C[i][ii];
            if(ii!=l-1){
                cout<<" ";
            }
        }
        cout<<endl;
    }
    return 0;
}

Measured memory_bytes: 3260
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

class Main {

    public static void main(String[] args) throws IOException {
        ReaderC.init(System.in);
        int[][] grid = new int[3][3];
        for (int i = 0; i < grid.length; i++) {
            for (int j = 0; j < grid.length; j++) {
                grid[i][j] = ReaderC.nextInt();
            }
        }

        boolean correct = false;
        for (int i = -1000000; i <= 1000000; i++) {
            int a1 = i;
            int b1 = grid[0][0] - a1;
            int b2 = grid[0][1] - a1;
            int b3 = grid[0][2] - a1;
            int a2 = grid[1][0] - b1;
            if (grid[1][1] - b2 != a2) continue;
            if (grid[1][2] - b3 != a2) continue;
            int a3 = grid[2][0] - b1;
            if (grid[2][1] - b2 != a3) continue;
            if (grid[2][2] - b3 != a3) continue;

            correct = true;
            break;
        }

        System.out.println(correct ? "Yes" : "No");
    }
}

/**
 * Reader class based on the article at "https://www.cpe.ku.ac.th/~jim/java-io.html"
 */
class ReaderC {
    private static BufferedReader reader;
    private static StringTokenizer tokenizer;

    static void init(InputStream inputStream) {
        reader = new BufferedReader(new InputStreamReader(inputStream));
        tokenizer = new StringTokenizer("");
    }

    static String next() throws IOException {
        String read;
        while (!tokenizer.hasMoreTokens()) {
            read = reader.readLine();
            if (read == null || read.equals(""))
                return "-1";
            tokenizer = new StringTokenizer(read);
        }

        return tokenizer.nextToken();
    }

    static int nextInt() throws IOException {
        return Integer.parseInt(next());
    }

    static long nextLong() throws IOException {
        return Long.parseLong(next());
    }

    //    Get a whole line.
    static String line() throws IOException {
        return reader.readLine();
    }

    static double nextDouble() throws IOException {
        return Double.parseDouble(next());
    }
}



Measured memory_bytes: 23124
from collections import defaultdict
import sys,heapq,bisect,math,itertools,string,queue,datetime
sys.setrecursionlimit(10**8)
INF = float('inf')
mod = 10**9+7
eps = 10**-7
def inpl(): return list(map(int, input().split()))
def inpl_str(): return list(input().split())

W,a,b = inpl()
al,ar = a,a+W
bl,br = b,b+W

if ar < bl:
    print(bl-ar)
elif br < al:
    print(al-br)
else:
    print(0)


Measured memory_bytes: 4212
#include "bits/stdc++.h"
using namespace std;
#define repr(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define rep(i,n) repr(i,0,n)
#define reprrev(i,a,b) for(int i=(int)(b)-1;i>=(int)(a);i--)
#define reprev(i,n) reprrev(i,0,n)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define mp make_pair
#define mt make_tuple
#define MOD 1000000007
#define PI 3.1415926535
typedef long long ll;
typedef pair<int, int> Pi;
typedef pair<ll, ll> Pll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<bool> vb;
typedef vector<char> vc;
typedef vector<string> vs;
typedef vector<double> vd;
typedef vector<Pi> vPi;
typedef vector<Pll> vPll;
typedef vector<vector<int>> vvi;
typedef vector<vector<bool>> vvb;
typedef vector<vector<ll>> vvll;
typedef vector<vector<char>> vvc;
typedef vector<vector<string>> vvs;
typedef vector<vector<double>> vvd;
typedef vector<vector<Pi>> vvPi;
typedef priority_queue<int, vector<int>, greater<int>> pqli;
typedef priority_queue<ll, vector<ll>, greater<ll>> pqlll;
typedef priority_queue<Pi, vector<Pi>, greater<Pi>> pqlP;
string YN(bool y) { return (y?"YES":"NO"); }
string yn(bool y) { return (y?"Yes":"No"); }
string ON(bool y) { return (y?"OK":"NG"); }
int main(void)
{
	int a, p;

	cin>>a>>p;

	cout<<(a*3+p)/2<<endl;
}


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

int main(){
  int a, b, c; cin >> a >> b >> c;
  int d, e, f;
  d = abs(b-a); e = abs(c-b); f = abs(a-c);
  cout << min(d+e, min(e+f, f+d)) << endl;
}

Measured memory_bytes: 3584
#include <stdio.h>
int main(){
	int i,sum;
	char c[1001];
	while (1){
		gets(c);
		if (c[0]=='0') break;
		sum=0;
		for (i=0; c[i]>='0'&&c[i]<='9'; i++)
			sum += c[i]-'0';
		printf("%d\n", sum);
	}
	return 0;
}

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

int main() {
  vector<int> card(9);
  vector<bool> map(9,false);
  rep(i,9) cin >> card[i];
  int n; cin >> n;
  int num;
  rep(i,n){
    cin >> num;
    rep(j,9) if(card[j] == num) map[j] =true;
  }

  //cout << map[0] << " " << map[1] << " " << map[2] << endl;
  //cout << map[3] << " " << map[4] << " " << map[5] << endl;
  //cout << map[6] << " " << map[7] << " " << map[8] << endl;
  string ans = "No";
  if(map[0] && map[1] && map[2]) ans = "Yes";
  if(map[3] && map[4] && map[5]) ans = "Yes";
  if(map[6] && map[7] && map[8]) ans = "Yes";

  if(map[0] && map[3] && map[6]) ans = "Yes";
  if(map[1] && map[4] && map[7]) ans = "Yes";
  if(map[2] && map[5] && map[8]) ans = "Yes";

  if(map[0] && map[4] && map[8]) ans = "Yes";
  if(map[2] && map[4] && map[6]) ans = "Yes";

  cout << ans << endl;
}


Measured memory_bytes: 3608
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG //これつけるとA[N]でもいいらしい
//for文のマクロ
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define mp(a,b) make_pair(a,b)
#define big 1000000007
#define all(a) sort((a).begin(),(a).end()) //ソートのマクロ
#define Re(a) reverse((a).begin(),(a).end())
#define YN(a) if(a){cout<<"Yes"<<endl;}else cout<<"No"<<endl;//条件によってYes、Noを出力する
int main(){
    int r,c,k;
    cin>>r>>c>>k;
    vector<vector<vector<int64_t>>> dp(r,vector<vector<int64_t>> (c,vector<int64_t> (4,-1)));
    vector<vector<int64_t>> tr(r,vector<int64_t> (c,0));
    int64_t ans=0;
    rep(i,k){
        int r,c,v;
        cin>>r>>c>>v;
        r--,c--;
        tr[r][c]=v;
    }
    rep(i,c){
        dp[0][i][0]=0;
    }
    if(tr[0][0]!=0){
        dp[0][0][1]=tr[0][0];
    }

    for(int j=0;j<c-1;j++){
        bool end=false;
        for(int cn=1;cn<=3;cn++){
            if(tr[0][j+1]==0){
                dp[0][j+1][cn] = dp[0][j][cn];
            }
            else{
                if(dp[0][j][cn-1]!=-1){
                dp[0][j+1][cn] = max(dp[0][j][cn-1]+tr[0][j+1],dp[0][j][cn]);
                }
            }
        }
    }
    for(int i=1;i<r;i++){
        rep(cn,4){
            dp[i][0][0]= max(dp[i][0][0],dp[i-1][0][cn]);
        }
        if(tr[i][0]!=0){
            dp[i][0][1]=dp[i][0][0]+tr[i][0];
        }
    }
    for(int i=1;i<r;i++){//左右
        for(int j=1;j<c;j++){//上下 
            if(tr[i][j]==0){//宝物がおいてない時、k=0(その行でまだ一個も拾ってない時)の値しか動かない
                dp[i][j][0]=dp[i][j-1][0];
                for(int cn=0;cn<=3;cn++){
                    dp[i][j][0]=max(dp[i][j][0],dp[i-1][j][cn]);
                    if(cn!=0){
                        dp[i][j][cn]=dp[i][j-1][cn];
                    }
                }

            }
            else{
               dp[i][j][0]=dp[i][j-1][0];
                for(int cn=0;cn<=3;cn++){
                    dp[i][j][0]=max(dp[i][j][0],dp[i-1][j][cn]);
                }//ここ(行が変わった時のk=0の操作は一定) 
                //後は自分自身、つまりこの宝を取るか取らないか
                for(int cn=1;cn<=3;cn++){
                    if(dp[i][j-1][cn-1]!=-1){
                        if(cn==1){
                            dp[i][j][cn]=max(dp[i][j-1][cn],dp[i][j][cn-1]+tr[i][j]);
                        }
                        else{
                        dp[i][j][cn]=max(dp[i][j-1][cn],dp[i][j-1][cn-1]+tr[i][j]);
                        }
                    }
                }         
            }
        }
    }
    /*
    rep(j,c){
        rep(i,r){
            rep(cn,4){
                cout<<dp[i][j][cn]<<" ";
            }
            cout<<"/";
        }
        cout<<endl;
    }*/
    rep(cn,4){
        ans = max(ans,dp[r-1][c-1][cn]);
    }
    cout<<ans<<endl;

}

Measured memory_bytes: 706348
#include <bits/stdc++.h>
using namespace std;
#define optimizar_io ios_base::sync_with_stdio(false);cin.tie(0);

typedef long long int ll; 

int main() {
    optimizar_io

    ll n, ans;
    
    cin >> n;
    n--;
    ans = (n * (n + 1)) / 2;
    cout << ans << "\n";
    return 0;
}

Measured memory_bytes: 256
#define _GLIBCXX_DEBUG

#include<bits/stdc++.h>
using namespace std;
const int INF= 1e9+5;
typedef long long ll;

int main(){
  
 char a,b;
  cin>>a>>b;
  int x=a-'0',y=b-'0';
  
  if(x>y)cout<<">"<<endl;
  else if(x<y)cout<<"<"<<endl;
  else cout<<"="<<endl;
}
  

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#define llint long long

using namespace std;

struct Range{
	bool ans;
	llint val;
	Range(){}
	Range(bool a, llint b){
		ans = a, val = b;
	}
};

Range merge(Range &a, Range &b)
{
	if(!a.ans || !b.ans) return Range(false, 0);
	if(a.val & b.val) return Range(false, 0);
	return Range(true, a.val | b.val);
}

struct SegTree{
	llint size;
	vector<Range> seg;
	
	SegTree(){}
	SegTree(llint size){
		this->size = size;
		seg.resize(1<<(size+1));
	}
	
	void init()
	{
		for(llint i = 0; i < (1<<(size+1)); i++) seg[i] = Range(true, 0);
	}
	
	void update(llint i, Range val)
	{
		i += (1 << size);
		seg[i] = val;
		while(i > 1){
			i /= 2;
			seg[i] = merge(seg[i*2], seg[i*2+1]);
		}
	}

	Range query(llint a, llint b, llint k, llint l, llint r)
	{
		if(b < l || r < a) return Range(true, 0);
		if(a <= l && r <= b) return seg[k];
		Range lval = query(a, b, k*2, l, (l+r)/2);
		Range rval = query(a, b, k*2+1, (l+r)/2+1, r);
		return merge(lval, rval);
	}
	Range query(llint a, llint b)
	{
		return query(a, b, 1, 0, (1<<size)-1);
	}
};

llint N;
llint A[200005];
SegTree seg(18);

int main(void)
{
	cin >> N;
	for(llint i = 0; i < N; i++){
		cin >> A[i];
	}
	
	seg.init();
	for(llint i = 0; i < N; i++) seg.update(i, Range(true, A[i]));
	
	llint ans = 0;
	for(llint i = 0; i < N; i++){
		llint ub = N, lb = i, mid;
		while(ub - lb > 1){
			mid = (ub + lb) / 2;
			if(seg.query(i, mid).ans) lb = mid;
			else ub = mid;
		}
		ans += lb - i + 1;
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 9984
#include <iostream>
using namespace std;
int main(int argc, char const *argv[])
{
	long long n,m,x=0;
	cin>>n>>m;
	long long arr[m+5];
	for (long long int i = 0; i < m; i++) {
		cin>>arr[i];
		x=x+arr[i];
	}
	if (x<=n)
	{
		cout<<n-x<<endl;
	}
	else
		cout<<"-1"<<endl;
	return 0;
}

Measured memory_bytes: 3764
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;

typedef long long ll;
typedef pair<int,int> ii;
typedef tree<ii,null_type,less<ii>,rb_tree_tag,tree_order_statistics_node_update> indexed_set;

int main() {
	cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(0);
	string s; cin>>s;
	if (s=="RRR") cout<<"3"<<endl;
	else if (s=="RRS"||s=="SRR") cout<<"2"<<endl;
	else if (s=="SSS") cout<<"0"<<endl;
	else cout<<"1"<<endl;
	return 0;
}


Measured memory_bytes: 3572
#include <stdio.h>

int main() {

	int a, b, c, rect = 0, rhom = 0;

	while ( scanf( "%d,%d,%d", &a, &b, &c ) != EOF ) {

		if ( a * a + b * b == c * c ) { rect++; }
		if ( a == b ) { rhom++; }

	}

	printf( "%d\n%d\n", rect, rhom );

	return 0;

}

Measured memory_bytes: 596
N, W = map(int, input().split())
dp = [-1] * (W+1)
dp[0] = 0

for i in range(N):
    w, v = map(int, input().split())
    for j in range(W-w, -1, -1):
        if dp[j] == -1:
            continue
        else:
            dp[j+w] = max(dp[j+w], dp[j] + v)

print(max(dp))


Measured memory_bytes: 41708
def gcd(a,b):
    if a<b:
        a,b = b,a
    elif b==0:
        return a
    return gcd(b,a%b)


K = int(input())
ans = 0
for i in range(1,K+1):
    for j in range(1,K+1):
        for k in range(1,K+1):
            mm = gcd(i,j)
            ans += gcd(mm,k)

print(ans)

Measured memory_bytes: 82272
{-# LANGUAGE NamedFieldPuns #-}
import Control.Monad (replicateM_)
import Data.Foldable (traverse_)
import Data.Functor ((<$>))
import Numeric (showFFloat)

data Point = Point { x :: Double, y :: Double }

instance Show Point where
  show (Point{x, y}) = sf x ++ " " ++ sf y
     where
     sf x = showFFloat Nothing x $ ""

readLnPoint = do
  [x, y] <- map read . words <$> getLine
  return $ Point {x, y}

dot p1 p2 = x p1 * x p2 + y p1 * y p2
psub p1 p2 = Point { x = x p1 - x p2, y = y p1 - y p2 }
norm p = sqrt $ dot p p
scale a (Point{x, y}) = Point { x = a * x, y = a * y }

projectTo a b = scale (dot a b / dot a a) a

main = do
  (p1, p2) <- do
    [x1, y1, x2, y2] <- map read . words <$> getLine
    return ( Point {x = x1, y = y1}, Point {x = x2, y = y2} )
  q <- readLn
  let originP1   p = Point { x = x p - x p1, y = y p - y p1 }
      unOriginP1 p = Point { x = x p + x p1, y = y p + y p1 }
      a = p2 `psub` p1
  replicateM_ q $ readLnPoint >>= \p -> let b = originP1 p in print $ unOriginP1 $ projectTo a b



Measured memory_bytes: 4520
#include <iostream>
using namespace std;
int main(int argc, const char * argv[])
{
    int a, b;
    cin >> a >> b;
    if(a < b)
    {
        cout << "a < b" << endl;
    }
    else if(a > b)
    {
        cout << "a > b" << endl;
    }
    else
    {
        cout << "a == b" << endl;
    }
}


Measured memory_bytes: 1160
#include <bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp>
//using namespace __gnu_pbds;
using namespace std;
#define all(x) (x).begin(),(x).end()
#define dlog(x) cerr<<#x<<'='<<x<<endl
#define f first
#define s second
#define endl '\n'
#define sq(x) (x)*(x)*1ll
//typedef tree<int,null_type,less_equal<int>,rb_tree_tag,
//      tree_order_statistics_node_update> indexed_multiset;
//typedef tree<int,null_type,less<int>,rb_tree_tag,
//      tree_order_statistics_node_update> indexed_set;
typedef long long ll;
typedef pair<int,int> pii;


int main () {
        ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
//        freopen("test_input.txt", "r", stdin);
        int n; cin >> n;
        vector<int> vec(n);
        for (int i = 0; i < n; i++) {
                cin >> vec[i];
        }

        for (int i = 0; i < n; i++) {
                for (int j = i + 1; j < n; j++) {
                        if (vec[i] > vec[j]) {
                                swap(vec[i], vec[j]);
                                if (is_sorted(all(vec))) {
                                        cout << "YES";
                                        return 0;
                                }
                                swap(vec[i], vec[j]);
                        }
                }
        }

        cout << (is_sorted(all(vec)) ? "YES" : "NO");
        return 0;
}

Measured memory_bytes: 256
import sys

input = sys.stdin.readline


class UnionFind:
    """Union Find class.

    "Path compression" and "Union by rank" are used.

    References:
        <https://en.wikipedia.org/wiki/Disjoint-set_data_structure>
    """

    def __init__(self, N):
        self.N = N
        self.__make_set()

    def __make_set(self):
        self._parent = list(range(self.N + 1))
        self._rank = [0] * (self.N + 1)
        self._size = [1] * (self.N + 1)

    def find(self, x):
        if self._parent[x] != x:
            self._parent[x] = self.find(self._parent[x])
        return self._parent[x]

    def union(self, x, y):
        x_root = self.find(x)
        y_root = self.find(y)

        if x_root == y_root:
            return

        x_rank = self._rank[x_root]
        y_rank = self._rank[y_root]
        if x_rank > y_rank:
            self._parent[y_root] = x_root
            self._size[x_root] += self._size[y_root]
        elif x_rank < y_rank:
            self._parent[x_root] = y_root
            self._size[y_root] += self._size[x_root]
        else:
            self._parent[y_root] = x_root
            self._rank[x_root] += 1
            self._size[x_root] += self._size[y_root]

    def same_set(self, x, y):
        return self.find(x) == self.find(y)

    def size(self, x):
        return self._size[self.find(x)]


def main():
    N, M = map(int, input().split())
    A = [0] * M
    B = [0] * M
    for i in range(M):
        A[i], B[i] = map(int, input().split())

    uf = UnionFind(N)
    ans = [0] * M
    ans[-1] = N * (N - 1) // 2
    for i in reversed(range(M - 1)):
        a, b = A[i + 1], B[i + 1]
        if uf.same_set(a, b):
            ans[i] = ans[i + 1]
        else:
            ans[i] = ans[i + 1] - uf.size(a) * uf.size(b)
        uf.union(a, b)

    print("\n".join(map(str, ans)))


if __name__ == "__main__":
    main()


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

int main(){
    int a[4],b[2];
    cin >>a[0]>>a[1]>>a[2]>>a[3]>>b[0]>>b[1];
    sort(a, a+4);
    sort(b, b+2);
    cout << a[1]+a[2]+a[3]+b[1] << endl;
    return 0;
}



Measured memory_bytes: 3128
import java.util.Scanner;

public class Main{
	public static void main(String[] args){
		Scanner scan = new Scanner(System.in);
		double w = scan.nextDouble();
		double h = scan.nextDouble();
		double x = scan.nextDouble();
		double y = scan.nextDouble();

		System.out.print(w * h / 2);
		System.out.print(" ");
		if(x + x == w && y + y == h) {
			System.out.println(1);
		}else {
			System.out.println(0);
		}

	}
}


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

a_list = []
c_list = []

for i in range(M):
    a,b = list(map(int,input().split()))
    a_list.append(a)
    c = list(map(int,input().split()))
    d = 0
    for cc in c:
        d += 2**(cc-1)
    c_list.append(d)

DP = [[10**27]*(2**N) for i in range(M+1)]
DP[0][0]=0
for i in range(1,M+1):
    for j in range(2**N):
        #print(c_list[i-1] | j)
        DP[i][j] = min(DP[i][j],DP[i-1][j])
        DP[i][c_list[i-1] | j] = min(DP[i][c_list[i-1] | j],DP[i-1][j] + a_list[i-1])

#print(DP)
if DP[M][2**N-1]>=10**27:
    print(-1)
else:
    print(DP[M][2**N-1])

Measured memory_bytes: 85220
import numpy as np
A, B, H, M = map(int,input().split())
a_rad = H*np.pi/6 + M*np.pi/360
b_rad = M*np.pi/30
two_vec = np.array([[A, a_rad], [B, b_rad]])
def polar2cartesian(position):
    num = position.shape[0]
    newPosition = np.empty([num,2], dtype=np.float64)
    newPosition[:,0] = position[:,0] * np.cos(position[:,1])
    newPosition[:,1] = position[:,0] * np.sin(position[:,1])
    return newPosition
ans = polar2cartesian(two_vec)
print(np.linalg.norm(ans[0]-ans[1]))

Measured memory_bytes: 27328
#include <iostream>
#include <cmath>
#include <vector>
#include <map>
#include <string>
#include <iomanip>
#include <queue>
#include <algorithm>

using namespace std;
using ll = long long int;
using dd = long double;
const ll MOD = 1e9 + 7;
const dd PI = 3.1415926535;

ll fast(ll n, ll k) {
	if (k == 0) {
		return 1;
	}
	if (k == 1) {
		return n;
	}
	if (k % 2 == 0) {
		ll tmp = fast(n, k / 2);
		return tmp * tmp % MOD;
	}
	else {
		ll tmp = fast(n, k / 2);
		tmp = tmp * tmp % MOD;
		return n * tmp % MOD;
	}
}

int main() {
	ll N, K;
	cin >> N >> K;
	vector<bool> snuke(N, 0);

	for (ll i = 0; i < K; i++)
	{
		ll di;
		cin >> di;
		for (ll j = 0; j < di; j++)
		{
			ll ai;
			cin >> ai;
			snuke[ai - 1] = true;
		}
	}

	ll ans = 0;
	for (auto&& e : snuke)
	{
		if (e == false) {
			ans++;
		}
	}
	cout << ans << endl;
}

Measured memory_bytes: 3628
def main():
    N = int(input())
    s_dict = {}
    for _ in range(N):
        s = input()
        s_sort = "".join(sorted(list(s)))
        if s_sort not in s_dict:
            s_dict[s_sort] = 0
        s_dict[s_sort] += 1

    res = 0
    for v in s_dict.values():
        res += v*(v-1)//2

    print(res)


if __name__ == "__main__":
    main()

Measured memory_bytes: 100728
#include <stdio.h>

int main(void)
{
	int s, e, m;
	int value[1000];
	int length;
	int key;
	
	while (1){
		int i;
		int ans = 0;
		scanf("%d", &length);
		if (length == 0){
			break;
		}
		for (i = 0; i < length; i++){
			scanf("%d", value + i);
		}
		
		scanf("%d", &key);
		
		s = 0;
		e = length - 1;
		do {
			m = (e + s) / 2;
			ans++;
			if (value[m] == key){
				break;
			}
			else if (value[m] < key){
				s = m + 1;
			}
			else {
				e = m - 1;
			}
		}while (s <= e);
		
		printf("%d\n", ans);
	}
	
	return (0);
}

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


int n;
long long a[100005];
int main()
{
	std::cin >> n;
	for (int i = 0; i < n; ++i)
		std::cin >> a[i];

	long long ans = 0;
	for (int i = 0; i < n - 1; ++i) {
		if (a[i] % 2 == 0)
			ans += a[i] / 2;
		else if (a[i + 1] > 0) {
			ans += a[i] / 2 + 1;
			--a[i + 1];
		}
		else
			ans += a[i] / 2;
	}

	std::cout << ans + a[n - 1] / 2 << std::endl;
	return 0;
}


Measured memory_bytes: 1024
"""
https://atcoder.jp/contests/dp/tasks/dp_a
"""
from copy import deepcopy
N = int(input())
arr = [int(i) for i in input().split(" ")]

def getMinSteps():
    dp_2 = [0, ]
    dp_1 = [abs(arr[1] - arr[0]), ]
    
    total_cost = 0
    i = 2
    
    while i < N:
        diff1 = abs(arr[i] - arr[i-1])
        diff2 = abs(arr[i] - arr[i-2])
        temp = deepcopy(dp_2)
        dp_2 = deepcopy(dp_1)

        for j in range(len(dp_1)):
            dp_1[j] += diff1

        for j in range(len(temp)):
            dp_1.append(temp[j] + diff2)
            
        dp_1 = sorted(dp_1)[0:2]
        
        i += 1
    return min(dp_1)

        
print(getMinSteps())

Measured memory_bytes: 21076
#include <bits/stdc++.h>
 
#define _overload(_1,_2,_3,name,...) name
#define _rep(i,n) _range(i,0,n)
#define _range(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define rep(...) _overload(__VA_ARGS__,_range,_rep,)(__VA_ARGS__)
 
#define _rrep(i,n) _rrange(i,n,0)
#define _rrange(i,a,b) for(int i=(int)(a)-1;i>=(int)(b);--i)
#define rrep(...) _overload(__VA_ARGS__,_rrange,_rrep,)(__VA_ARGS__)
 
#define _all(arg) begin(arg),end(arg)
#define uniq(arg) sort(_all(arg)),(arg).erase(unique(_all(arg)),end(arg))
#define bit(n) (1LL<<(n))
 
// #define DEBUG
 
#ifdef DEBUG
    #define dump(...) fprintf(stderr, __VA_ARGS__)
#else
    #define dump(...)
#endif
 
template<class T>bool chmax(T &a, const T &b) { return (a<b)?(a=b,1):0;}
template<class T>bool chmin(T &a, const T &b) { return (b<a)?(a=b,1):0;}
 
using namespace std;
using ll=long long;
using vi=vector<int>;
using vll=vector<ll>;
 
const double EPS = 1e-10;
const double PI = acos(-1.0);
const int inf = INT_MAX;
const ll INF = LLONG_MAX;
const ll MOD = 1000000007LL;
const int dx[4]={1,0,-1,0};
const int dy[4]={0,1,0,-1};
 
ll extgcd(ll a,ll b,ll& x,ll& y){x=1,y=0;ll g=a;if(b!=0) g=extgcd(b,a%b,y,x),y-=a/b*x;return g;}
ll ADD(const ll &a, const ll &b, const ll mod=MOD) { return (a+b)%mod;}
ll SUB(const ll &a, const ll &b, const ll mod=MOD) { return (a-b+mod)%mod;}
ll MUL(const ll &a, const ll &b, const ll mod=MOD) { return (1LL*a*b)%mod;}
ll DIV(const ll &a, const ll &b, const ll mod=MOD) {ll x,y; extgcd(b,mod,x,y);return MUL(a,(x+mod)%mod,mod);}
 
///////////////////////
const int N = 1e6; 
const int mod_ = MOD;

ll fact[N+1];

void set_fact() {
    fact[0] = 1;
    rep(i,N) fact[i+1] = ((((ll)i+1) % mod_) * fact[i]) % mod_;
}

ll mod_inv(ll a, ll m) {
    ll x, y;
    extgcd(a, m, x, y);
    return (m + x % m) % m;
}

// n! mod_ p 
ll mod_fact(ll n, ll p, ll &e) {
    e = 0;
    if (!n) return 1;
    ll res = mod_fact(n/p, p, e);
    e += n/p;

    if ((n/p)%2) 
        return res * (p - fact[n%p]) %p;
    else
        return res * fact[n%p] % p;
}

// nCk mod_ p ; O(log_p n)
ll mod_comb(ll n, ll k, ll p) {
    if (n<0 || k<0 || n<k) return 0;
    ll e1, e2, e3;
    ll a1 = mod_fact(n, p, e1), a2 = mod_fact(k, p, e2), a3 = mod_fact(n-k, p, e3);
    if (e1 > e2+e3) return 0;
    return a1 * mod_inv(a2*a3%p, p) % p;
}

// nHk mod_ p ;
ll mod_h_comb(ll n, ll k, ll p) {
    return mod_comb(n+k-1, k, p);
}
///////////////////////

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

    int n, B; cin >> n >> B;
    int R = n - B;

    set_fact();

    rep(i, 1, B+1){
        ll fB = B - i;
        ll fR = R - (i-1);

        ll res = 0;
        if(fR >= 0){
            ll curB = DIV(fact[fB + i - 1], MUL(fact[fB], fact[i - 1]));
            ll curR = DIV(fact[fR + i], MUL(fact[fR], fact[i]));
            res = MUL(curB, curR);
        }

        cout << res << endl;
    }

    return 0;
}


Measured memory_bytes: 8064
#include <stdio.h>
#include <stdlib.h>
#include <math.h>

int main()
{
    long N, K, i, sum;
    long j, k, m;
    double max, min;

    scanf("%ld %ld", &N, &K);

    sum = 0;
    for (i = K; i <= N + 1; i++)
    {
        max = (double)((N) + (N - (i - 1))) / 2.0 * i;
        min = (double)(i - 1) / 2.0 * i;
        sum += (max - min + 1);
    }

    printf("%ld", sum % (int)(pow(10, 9) + 7));

    return 0;
}


Measured memory_bytes: 1724