akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include <list>
#include<stack>
#include<queue>
#include <vector>
#include <set>
#include<algorithm>
#include<math.h>
#include<stdlib.h>
#include<string>
#include <functional>
#include<fstream>

#define FOR(k,m,n) for(int (k)=(m);(k)<(n);(k)++)
#define REP(i,n) FOR((i),0,(n))
#define LL long long
#define CLR(a) memset((a),0,sizeof(a))
#define SZ(x) (int((x).size()))
#define WAITING(str) int str;std::cin>>str;
#define DEBUGING(str) cout<<str<<endl
using namespace std;

const LL MOD = 1000000007;// 10^9+7
const int INF = (1 << 30);


//変数
int A, B, C;






//サブ関数
//入力
void input()
{
	cin >> A >> B >> C;
}

//計算
void calc()
{
	int big = max(A, max(B, C));
	int ans = 0;
	int tmp;
	tmp = (big - A) / 2; ans += tmp; A += tmp * 2;
	tmp = (big - B) / 2; ans += tmp; B += tmp * 2;
	tmp = (big - C) / 2; ans += tmp; C += tmp * 2;

	if (B == big)swap(A, B);
	if (C == big)swap(A, C);

	if (B == big && C == big) {
		cout << ans << endl;
	}
	else if (B != big && C != big) {
		cout << ans + 1 << endl;
	}
	else {
		cout << ans + 2 << endl;
	}
}


//出力
void output()
{

}


//デバッグ
void debug()
{
	int N;
	cin>>N;
}


//メイン関数
int main()
{
	input();
	calc();
	output();
	debug();
	
	return 0;
}


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

int main(){
	string a,b,c;
	cin>>a>>b>>c;
	
	int sta = 0;
	int am=0;
	int bm=0;
	int cm=0;
	
	while(1){
		if(sta==0){
			if(am==a.size()){
				cout<<"A"<<endl;
				return 0;
			}
			if(a[am]=='a'){
				sta=0;
			}else if(a[am]=='b'){
				sta=1;
			}else if(a[am]=='c'){
				sta=2;
			}
			am++;
		}
		
		if(sta==1){
			if(bm==b.size()){
				cout<<"B"<<endl;
				return 0;
			}
			if(b[bm]=='a'){
				sta=0;
			}else if(b[bm]=='b'){
				sta=1;
			}else if(b[bm]=='c'){
				sta=2;
			}
			bm++;
		}
		
		if(sta==2){
			if(cm==c.size()){
				cout<<"C"<<endl;
				return 0;
			}
			if(c[cm]=='a'){
				sta=0;
			}else if(c[cm]=='b'){
				sta=1;
			}else if(c[cm]=='c'){
				sta=2;
			}
			cm++;
		}
	}
	
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
   int n;
   cin>>n;
   int a[n];
   double s=0;
   for(int i=0;i<n;i++)
   {
   	cin>>a[i];
   	s=s+(double)1/a[i];
   }
   cout<<1/s;
}

Measured memory_bytes: 256
#ifdef _MSC_VER
#include "stdc++.h"
#endif
#ifdef __GNUC__
#include<bits/stdc++.h>
#endif
using namespace std;

using ll = long long;

//vector
using vi = vector<int>;
using vii = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;

//constant
const double EPS = 1e-10;

#define REP(i, n) for (ll i = 0; i < n; i++)
#define FOR(i, s, e) for (ll i = s; i < e; i++)
#define ALL(x) (x).begin(),(x).end()
#define RALL(x) (x).rbegin(), (x).rend()

//debug
#define DUMP(x)  cerr << #x << " = " << (x) << endl;
#define DEBUG(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl;

// vector
//template<typename T> vector<vector<T>> vv(ll H, ll W, T v) { return vector<vector<T>> vec(H, vector<T>(W, v)); }

// view vector
template<typename T> void view(T e) { cout << e << endl; }
template<typename T> void view(const vector<T>& v) { for (const auto& e : v) { cout << e << " "; } cout << endl; }
template<typename T> void view(const vector<vector<T> >& vv) { for (const auto& v : vv) { view(v); } }

// DP
template<class T>bool chmax(T& a, const T& b) { if (a < b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T& a, const T& b) { if (b < a) { a = b; return 1; } return 0; }




// ***************************************


int main(){

    string S;
    cin >> S;

    ll mx = 0;
    ll cnt = 0;
    REP(i, 3){
        if (S[i] == 'R') cnt++;
        else{
            chmax(mx, cnt);
            cnt = 0;
        }
    }    
    chmax(mx, cnt);

    cout << mx << endl;

    return 0;
}


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


int main(){


    int n, m, x, y, i;

    int k = 0;

 
    cin >> n >> m;


    vector<int> a(n + 1);

    vector<int> s(n + 1, 1);


    a.at(1) = 1;


    for( i = 1 ; i < m + 1 ; i = i + 1 ){

         cin >> x >> y ;

         if( a.at(x) == 1 && s.at(x) >= 2 ){

             s.at(x) -= 1;

             if( a.at(y) < 1 ) a.at(y) += 1;

             s.at(y) += 1;

             }

         else if( a.at(x) == 1 && s.at(x) == 1 ){

                  a.at(x) -= 1;

                  s.at(x) -= 1;

                  if( a.at(y) < 1 ) a.at(y) += 1;

                  s.at(y) += 1;

                  }

         else{ 

               if( s.at(x) > 0 ) s.at(x) -= 1;

               s.at(y) += 1;

               }

         }

             
    for( i = 1 ; i < n + 1 ; i = i + 1 ){

         if( a.at(i) > 0 ) k += 1;

         }


    cout << k << endl;
         

    return 0;


    }

Measured memory_bytes: 1024
n,x,y = map(int,input().split())
x -= 1
y -= 1
dis = y-x
a = [0 for _ in range(n-1)]
for i in range(n-1):
  for j in range(i+1,n):
    if(i<j<=x or y<=i<j):
      a[j-i-1] += 1
    elif i<=x and y<=j:
      a[j-i-dis] += 1
    elif i<x and x<=j<y:
      a[min(j,y-(j-x)+1)-i-1] += 1
    elif x<i<=y and y<j:
      a[j-max(i,y-(i-x)+1)] += 1
    elif x<=i<=y and x<=j<=y:
      a[min(j-i,i+(y-x)-j+1)-1] += 1
for i in a:
  print(i)

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

int main(){

    int A,B,C,K;
    cin >> A >> B >> C >> K;

    int Max = max(A,max(B,C)),Sum = A + B + C;
    int jo = 1;
    for(int i = 0;i<K;i++) jo *= 2;
    Sum = Sum - Max + Max*jo;

    cout << Sum << endl;


    return 0;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
bool dp[100001]={};int ar[101]={},mn=1000000;
int main()
{
	int n,k;cin>>n>>k;
	for (int i=0;i<n;i++)
	{
		cin>>ar[i];mn=min(mn,ar[i]);
	}
	for (int i=0;i<mn;i++)
	{
		dp[i]=0;
	}
	for (int i=mn;i<=k;i++)
	{
		dp[i]=0;
		for (int j=0;j<n;j++)
		{
			if (i>=ar[j]) {dp[i] = dp[i] || !dp[i-ar[j]];}
		}
	}
	if (dp[k]) {cout<<"First\n";} else {cout<<"Second\n";}
	return 0;
}

Measured memory_bytes: 384
n=gets.to_i
words=[]
beforeWord=""
ruleSafed="Yes"
n.times do
  word = gets.chomp
  words << word
  if (beforeWord != "") && (beforeWord[beforeWord.length-1] != word[0])
    ruleSafed="No"
    break
  else
    beforeWord = word
  end
end
ruleSafed="No" if words.uniq.length != words.length
puts ruleSafed

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

using namespace std;
 
#define ll long long
typedef unsigned long long ull;
typedef long double ld;

#define pii         pair<ll ,ll >
#define vi          vector<ll >
#define vii         vector<pii>
#define mi          map<ll ,ll >
#define mii         map<pii,int>
#define all(a)      (a).begin(),(a).end()
#define F           first
#define S           second
#define pb          push_back
#define hell        1000000007
#define rep(i,a,b)  for(ll int i=a;i<b;i++)
#define take        rep(i,0,n) cin>>v[i];
#define MAXN        1000005


#define allr(c) (c).rbegin(),(c).rend()
int mod = 1000000007;
const int inf = 1034567891;
const ll LL_INF = 1234567890123456789ll;
#define PI 3.14159265
#define endl '\n'
#define F first
#define S second
#define debug(x) cout << #x << " = " << x << endl;
#define TRACE

#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
  cout << name << " : " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
  const char* comma = strchr(names + 1, ',');cout.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
#else
#define trace(...)
#endif
 
#define out(container) for (auto it : container) cout << it << " "; cout << endl;
 
 
template < typename T > T GCD(T a, T b)            { ll t; while(a) { t = a; a = b % a; b = t; } return b; }
template < typename T > string toString(T a)       { return to_string(a); }
template < typename T > void toInt(string s, T &x) { stringstream str(s); str >> x;}
inline int add(int x, int y){ x += y; if(x >= mod) x -= mod; return x;}
inline int sub(int x, int y){ x -= y; if(x < 0) x += mod; return x;}
inline int mul(int x, int y){ return (x * 1ll * y) % mod;}
inline int powr(int a, ll b){
  int x = 1 % mod;
  while(b){
    if(b & 1) x = mul(x, a);
    a = mul(a, a);
    b >>= 1;
  }
  return x;
}
inline int inv(int a){ return powr(a, mod - 2);}


void solve()
{
	ll n;
	cin>>n;
	vii v;
	ll mx=0;
	ll mn=LL_INF;
	for(ll i=0;i<n;i++)
	{
		ll x,y;
		cin>>x>>y;
		v.pb({x,y});
		 mx=max(mx,x+y);
		mn=min(mn,x+y);
	}
	ll t=mx-mn;
//	cout<<mx<<" "<<mn<<endl;
	for(ll i=0;i<n;i++)
	{
		
		v[i].F=abs(hell-v[i].F);
	//	cout<<v[i].F<<" y "<<v[i].S<<endl;
	//	cout<<"i="<<v[i].F<<endl;
	}
	ll mmx=0;
	ll mmn=LL_INF;
	for(ll i=0;i<n;i++)
	{
		mmx=max(mmx,v[i].F+v[i].S);
		mmn=min(mmn,v[i].F+v[i].S);
	}
	ll z=mmx-mmn;
//	cout<<mmx<<" "<<mmn<<endl;
	cout<<max(t,z)<<endl;
}
int main()
    {
    	ios::sync_with_stdio(false);
        cin.tie(0);
        cout.tie(0);
      
        ll t;
        
        t=1;
        
    
   // cin>>t;
        while(t--)
        solve();
    }

Measured memory_bytes: 7420
#pragma GCC optimize("Ofast")
#include <iostream>
#define ll long long
using namespace std;

int main(){
  int a,b,c,k;
  cin>>a>>b>>c>>k;
  int x=0;
  while(a>=b){
    b*=2;
    x++;
  }
  while(b>=c){
    c*=2;
    x++;
  }
  if(x<=k){
    cout<<"Yes"<<endl;
  }
  else{
    cout<<"No"<<endl;
  }
}

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

using namespace std;

int main()
{
    int sum=0;
    int x; cin>>x;int a[x];for(int i=0;i<x;i++) cin>>a[i],sum=sum+a[i];
    int temp=0,mini=99999;
    for(int i=0;i<x;i++){
         temp=temp+a[i];
         mini=min(mini,abs(temp-sum+temp));

     }
     cout<<mini<<endl;







    return  0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define stoi stoll
using ll=long long;
using vi=vector<int>;
using pii=pair<int,int>;
#define ALL(c) begin(c),end(c)
#define RALL(c) rbegin(c),rend(c)
#define ITR(i,b,e) for(auto i=(b);i!=(e);++i)
#define FORE(x,c) for(auto &&x:c)
#define REPF(i,a,n) for(int i=a,i##len=(int)(n);i<i##len;++i)
#define REP(i,n) REPF(i,0,n)
#define REPR(i,n) for(int i=(int)(n);i>=0;--i)
#define SZ(c) ((int)c.size())
#define CONTAIN(c,x) (c.find(x)!=end(c))
#define INSEG(l,x,r) ((l)<=(x)&&(x)<(r))
#define dump(...)
#define pb push_back
#define _ 0
const signed INF_=1001001001; const long long INF=1001001001001001001LL;
const int DX[9]={0,1,0,-1,1,1,-1,-1,0},DY[9]={-1,0,1,0,-1,1,1,-1,0};
template<class T> ostream& operator<<(ostream &os,const vector<T> &v) {
    ITR(i,begin(v),end(v))os<<*i<<(i==end(v)-1?"":" ");return os;}
template<class T> istream& operator>>(istream &is,vector<T> &v) {
    ITR(i,begin(v),end(v)) is>>*i;return is;}
template<class T,class U> istream& operator>>(istream &is, pair<T,U> &p) {
    is>>p.first>>p.second;return is;}
template<class T, class U> bool chmax(T &a,const U &b){return a<b?a=b,1:0;}
template<class T, class U> bool chmin(T &a,const U &b){return a>b?a=b,1:0;}
template <class T> void PSUM(T& c) {partial_sum(begin(c), end(c), begin(c));}
template<class T> using heap=priority_queue<T,vector<T>,greater<T>>;
struct before_main_function {
    before_main_function() {
        cin.tie(0); ios::sync_with_stdio(false);
        cout << setprecision(15) << fixed;
        #define endl "\n"
    }
} before_main_function;
//------------------8<------------------------------------8<--------------------

signed main() {
    int N, M;
    cin >> N >> M;
    vector<set<int>> g(N);
    vector<int> deg(N, 0);
    REP(i, M) {
        int a, b;
        cin >> a >> b;
        a--, b--;
        g[a].insert(b);
        deg[b]++;
    }
    stack<int> st;
    REP(i, N) if (deg[i] == 0) st.push(i);
    vector<int> sorted;
    sorted.reserve(N);
    while (!st.empty()) {
        int v = st.top(); st.pop();
        sorted.push_back(v);
        FORE(w, g[v]) {
            deg[w]--;
            if (deg[w] == 0) {
                st.push(w);
            }
        }
    }

    vector<int> dp(N + 1, 0);
    REP(i, N) {
        int v = sorted[i];
        FORE(w, g[v]) {
            chmax(dp[w], dp[v] + 1);
        }
    }

    int ans = (*max_element(ALL(dp)));
    cout << ans << endl;
    return (0^_^0);
}



Measured memory_bytes: 12288
#define _USE_MATH_DEFINES

#include <cmath>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <limits>
#include <cstring>
#include <string>
#include <queue>
#include <map>
#include <set>
#include <bitset>

using namespace std;

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

const int dx[] = {1, 0, -1, 0, 0};
const int dy[] = {0, 1, 0, -1, 0};

const int Maxn = 110;
const int MOD = (int) 1e9 + 7;

int dp[Maxn][Maxn];

int h, w, k;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cin >> h >> w >> k;
    dp[0][0] = 1;
    for (int i = 0; i < h; ++i) {
        for (int bit = 0; bit < (1 << (w - 1)); ++bit) {
            bool ok = true;
            for (int j = 1; j < w - 1; ++j) {
                if ((bit >> j) & 1 && (bit >> (j - 1)) & 1) {
                    ok = false;
                    break;
                }
            }
            if (ok) {
                for (int j = 0; j < w; ++j) {
                    if (j - 1 >= 0 && (bit >> (j - 1)) & 1) {
                        (dp[i + 1][j - 1] += dp[i][j]) %= MOD;
                    } else if (j + 1 < w && (bit >> j) & 1) {
                        (dp[i + 1][j + 1] += dp[i][j]) %= MOD;
                    } else {
                        (dp[i + 1][j] += dp[i][j]) %= MOD;
                    }
                }
            }
        }
    }

    cout << dp[h][k - 1] << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long long
typedef int ll;
typedef long double ld;
const ll N = 100005;
char en = '\n';
ll inf = 1e16;
ll mod = 1e9 + 7;
ll power(ll x, ll n, ll mod) {
  ll res = 1;
  x %= mod;
  while (n) {
    if (n & 1)
      res = (res * x) % mod;
    x = (x * x) % mod;
    n >>= 1;
  }
  return res;
}

int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);

  ll a;
  string s;
  cin >> a >> s;

  if (a >= 3200)
    cout << s << en;
  else
    cout << "red" << en;

  return 0;
}

Measured memory_bytes: 256
def mygcd(x,y):
    if y != 0:
        mygcd(y,x%y)
    else:
        print(x)

if __name__ == "__main__":
    a,b = map(int,input().split())
    if a<b:
        tmp = a
        a = b
        b = tmp
    mygcd(a,b)



Measured memory_bytes: 5600
import java.util.*;

import static java.lang.System.*;

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

        if (a <= 0 && 0 <= b) {
            out.println("Zero");
        } else if (b < 0) {
            long negaNum = b - a + 1;
            if (negaNum % 2 == 1) {
                out.println("Negative");
            } else {
                out.println("Positive");
            }
        } else {
            out.println("Positive");
        }
    }
}

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

int main() {
    ll A, B;
    cin >> A >> B;
    for(ll i=0; i<max(A,B); i++){
        if(abs(A-i)==abs(B-i)){
            cout << i;
            return 0;
        }
    }
    cout << "IMPOSSIBLE";
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#define r(i,n) for(int i=0;i<n;i++)
using namespace std;
int a[26],b[10],ans;
string s;
int main(){
  cin>>s;
  r(i,s.size())
    if(isdigit(s[i]))b[s[i]-'0']++;
    else a[s[i]-'a']++;
  r(i,10){
    while(b[i]){
      int p=i,t=0;
      while(b[p]&&p<10)p++,t++;
      for(int j=i;j<p;j++)b[j]--;
      if(t<=2)ans+=t;
      else ans+=3;
    }
  }
  r(i,26){
    while(a[i]){
      int p=i,t=0;
      while(a[p]&&p<26)p++,t++;
      for(int j=i;j<p;j++)a[j]--;
      if(t<=2)ans+=t;
      else ans+=3;
    }
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 3204
#include <iostream>
#include <fstream>
#include <sstream>
#include <string.h>
#include <algorithm>
#include <cmath>
#include <assert.h>
#include <stack>
#include <queue>
#include <list>
#include <vector>
#include <map>
#include <set>

//#define DEBUG 1

#define for0(i,n) for (int i=0; i<n; i++)
#define forr(i,n) for (int i=n-1; i>=0; i--)
#define fori(i,a,b) for (int i=a; i<=b; i++)
#define iter(c) for(auto it=c.begin(); it!=c.end(); it++)
#define vec(x) vector< x >
#define pb push_back
#define ms(a,z) memset(a,z,sizeof(a));
#define mp make_pair
#define X first
#define Y second
#define sqr(x) 1LL*(x)*(x)
#define max(a,b) ((a)>(b)?(a):(b))
#define min(a,b) ((a)<(b)?(a):(b))
#define all(a) a.begin(),a.end()
#define size(x) (int)(x).size()
#define read(x) int x; scanf("%d",&x);
#ifdef DEBUG
#define nl cout<<"\n";
#define pr(x) cout<<(x)<<" ";
#define prl(x) cout<<#x " = "<<x<<endl;
#define prp(x) cout<<"("<<(x).first<<" "<<(x).second<<") ";
#define printv(v) {for(int _=0; _<size(v); _++) cout<<v[_]<<" "; cout<<"\n";}
#define printa(a,s) {for (int _=0; _<s; _++) cout<<a[_]<<" "; cout<<"\n";}
#define print2D(a,m,n) {for (int _=0; _<m; _++) {for (int __=0; __<n; __++) cout<<a[_][__]<<" "; cout<<"\n";} cout<<"\n";}
#define debug cout<<"ok at line "<<__LINE__<<endl;
#else
#define nl
#define pr(x)
#define prl(x)
#define prp(x)
#define printv(v)
#define printa(a,s)
#define print2D(a,m,n)
#define debug
#endif

using namespace std;

typedef long long ll;

const int INF = 2147483647;
const long long INFL = 9223372036854775807LL;
const double EPSILON = 0.00000001;
const long long MOD = 1000000007;

int N;
ll a[300005], ar[300005];
ll best1[300005], best2[300005];

void compute(ll a[300005], ll best[300005])
{
    ll s = 0;
    multiset<ll> cur_items;
    for0(i,N) {
        cur_items.insert(a[i]);
        s += a[i];
    }
    //prl(s)

    best[N-1] = s;
    multiset<ll>::iterator cur = cur_items.begin();
    for (int i=N; i<2*N; i++) {
        ll prev = *cur;
        cur_items.insert(a[i]);
        if (a[i] > prev) {
            s = s-prev+a[i];
            cur++;
        }
        //pr(a[i]) pr((*cur)) pr(s) nl
        best[i] = max(best[i-1],s);
    }
}

int main()
{
    #ifdef DEBUG
    freopen("B.txt","r",stdin);
    //freopen("","w",stdout);
    #endif

    cin>>N;
    for0(i,3*N) {
        scanf("%lld",&a[i]);
        ar[3*N-i-1] = -a[i];
    }
    //printa(ar,3*N);

    compute(a,best1);
    compute(ar,best2);
    printa(best1,3*N);
    printa(best2,3*N);

    ll ans = -INFL;
    for (int i=N-1; i<2*N; i++) {
        ll val = best1[i] + best2[3*N-i-2];
        pr(best1[i]) pr(best2[3*N-i-2]) nl
        ans = max(ans,val);
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 17792
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#define PI 3.14159265358979323

//int calc1(float a,float b,float c,float d,float e,float f,float *x,float *y);
//void quick(int *,long long,long long);
//int comp(char *a,char *b);

int main(){
	
	double v,y,t;
	int n;

	while(scanf("%lf",&v)!=EOF){
		t=v/9.8;
		y=4.9*t*t;
		n=y/5+1;
		printf("%d\n",n+1);
	}
	return 0;
}

Measured memory_bytes: 628
x,n = map(int,input().split())
if n == 0:
    print(x)
else:
    l = [k for k in range(102)]
    for p in input().split():
        p = int(p)
        l[p] = 1000
    l_d = [x-k for k in l]
    l_sorted = sorted(l_d,key= lambda x: (-x+0.1, x)[x > 0])
    print(x-l_sorted[0])

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

bool isPrime(int n){
	if(n<=1||n!=2&&(n&1)==0)return false;
	for(int i=3;i*i<=n;i+=2)
		if(n%i==0)return false;
	return true;
}
int main(){
	vector<int> primes;
	for(int i=2;i<=50000;i++)
		if(isPrime(i))primes.push_back(i);
	int n,ans;
	while(cin>>n,n){
		ans=0;
		for(int i=0;i<primes.size();i++){
			if(n/2 < primes[i])break;
			if(binary_search(primes.begin(),primes.end(),n-primes[i]))ans++;
		}
		cout<<ans<<endl;
	}
	return 0;
}

Measured memory_bytes: 1272
#include<bits/stdc++.h>
#define ll long long
#define mod (ll)1000000007
using namespace std;
vector<int> adj[100005];
int dp[100005];
bool visited[100005];

void DFS(int src)
{
	visited[src] = true;
	for(auto neig:adj[src])
	{
		if(!visited[neig])
		DFS(neig);

		dp[src] = max(dp[src],1+dp[neig]);
	}
	// visited[src] = false;
}

int main()
{
	int n,m;
	cin>>n>>m;

	for(int i = 0; i < m; i++)
	{
		int x,y;
		cin>>x>>y;

		adj[x].push_back(y);
	}

	// int ans=  0;

	memset(dp,0,sizeof(dp));
	memset(visited,false,sizeof(visited));
	for(int i = 1; i <= n; i++)
	{
		if(!visited[i])				
			DFS(i);
	}
	int ans = 0;
	for(int i = 1; i <= n; i++)
		ans = max(ans, dp[i]);

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


Measured memory_bytes: 8192
#include<bits/stdc++.h>
#include<unordered_set>
#include<unordered_map>
using namespace std;
#define REP(i,m,n) for(int i=(m);i<(n);i++)
#define rep(i,n) REP(i,0,n)
#define pb push_back
#define all(a) a.begin(),a.end()
#define rall(c) (c).rbegin(),(c).rend()
#define mp make_pair
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef long double ld;
const ll inf=1e9+7;
const ll mod=1e9+7;
int main(){
    double n,m,d;cin>>n>>m>>d;
    double c;
    if(d==0)c=1.000/n;
    else c=(n-d)*2/n/n;
    cout<<fixed<<setprecision(10)<<c*(m-1.000)<<endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
int main()
{
	int a ,b , c ,x ,y;
	long long ans ,t;
	scanf("%d%d%d%d%d",&a,&b,&c,&x,&y);
	ans = a*x + b*y;
	if(x >= y)
		t = 2*y*c + (x-y)*a;
	else t = 2*x*c + (y-x)*b;
	if(ans > t)
		ans = t;
	t = x > y ? 2*x*c:2*y*c;
	printf("%lld", ans > t ? t : ans);
	return 0;
}

Measured memory_bytes: 256
program main
	implicit none
	integer n,k,x(100),i
	integer::summ=0
	read(*,*)n,k
	read(*,*)x(1:n)
	do i=1,n
		summ=summ+min(abs(x(i)),abs(x(i)-k))
	enddo
	write(*,*)summ*2
end program main


Measured memory_bytes: 640
# -*- coding: utf-8 -*-

import io
import sys
import math


def solve(n,m,k,a_lst,b_lst):
    #机ごと、読書時間の累積をリストにする。ただし、リスト化はk時間内で読める範囲とする
    aa_lst = make_sum_list(a_lst,k)
    bb_lst = make_sum_list(b_lst,k)
    len_aa = len(aa_lst)
    len_bb = len(bb_lst)

    #A,Bいずれかが一冊も読めないケースを考慮
    if len_aa == 0:   return len_bb
    elif len_bb == 0: return len_aa
    
    #全て読めるケースを考慮
    if aa_lst[-1] + bb_lst[-1] <= k: return len_aa + len_bb 
    
    #A,Bいずれかのみ読むケースを考慮
    max_read = max(len_aa,len_bb)

    #リスト範囲でA+Bの最大値を探索する。2分探索を用いる
    for i in reversed(range(len_aa)):
        limit = k - aa_lst[i]
        read = i + 1
        if read + len_bb + 1 <= max_read:
            #以後 read は増えない
            break

        imax = len_bb-1
        imin = 0
        imid = len_bb // 2
        while True:
            if bb_lst[imid] <= limit:
                #OK。大を調べる
                if imax - imid <= 1:
                    #探査終了
                    if bb_lst[imax] <= limit:
                        read += imax + 1
                    else:
                        read += imid + 1
                    break
                imin = imid
            else:
                #NG。小を調べる
                if imid - imin <= 1:
                    #探査完了
                    if bb_lst[imin] <= limit:
                        read += imin + 1
                    break
                imax = imid
            imid = (imin + imax) // 2
        max_read = max(read,max_read)
    return max_read

def make_sum_list(lst,max):
    sum_lst = []
    sum = 0
    for n in lst:
        sum += n
        if sum > max:
            break
        sum_lst.append(sum)
    return sum_lst

def main():
    n,m,k = map(int, input().split())
    a_lst = list(map(int, input().split()))
    b_lst = list(map(int, input().split()))
    ans = solve(n,m,k,a_lst,b_lst)
    print(ans)

### DEBUG I/O ###
_INPUT = """\
3 4 730
60 90 120
80 150 80 150
"""
_DEBUG = 0

if __name__ == "__main__":
    if _DEBUG:
        sys.stdin = io.StringIO(_INPUT)
        print("!! Debug Mode !!")
    main()



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

using namespace std;

constexpr int modulo = 1000000007;

template <size_t N, size_t MaxPrimeSize>
struct primes_t {
  constexpr static size_t maxPrimeSize = MaxPrimeSize;
  constexpr primes_t() : primes(), count(), notSieves() {
    primes[count++] = 2;
    notSieves[0] = notSieves[1] = true;
    for (int i = 2; i < N; i++) {
      if (notSieves[i]) {
        continue;
      }
      primes[count++] = i;
      for (int64_t j = 2; i * j < N; j++) {
        notSieves[i * j] = true;
      }
    }
  }
  int64_t primes[MaxPrimeSize];
  int count;

 private:
  bool notSieves[N];
};

static constexpr auto primes = primes_t<1001, 169>{};

std::vector<int> primeFactorization(int n) {
  std::vector<int> ret{};
  int const maxPrimteCandidate = static_cast<int>(sqrt(n));
  for (int i = 0;; i++) {
    if (n <= 1) {
      return ret;
    }
    auto const prime = primes.primes[i];
    if (prime > maxPrimteCandidate) {
      break;
    }
    while (n % prime == 0) {
      ret.push_back(prime);
      n /= prime;
    }
  }
  if (n > 1) {
    ret.push_back(n);
  }
  return ret;
}

int solve(int n) {
  if (n == 1) {
    return 1;
  }
  std::vector<int> allFactors{};
  for (int i = 2; i <= n; i++) {
    auto factors = primeFactorization(i);
    allFactors.insert(allFactors.end(), factors.begin(), factors.end());
  }
  std::sort(allFactors.begin(), allFactors.end());
  int64_t ret = 1;
  for (auto itr = allFactors.begin(); itr != allFactors.end();) {
    auto const nextItr = std::upper_bound(itr, allFactors.end(), *itr);
    ret *= ((nextItr - itr) + 1);
    ret %= modulo;
    itr = nextItr;
  }
  return static_cast<int>(ret);
}

int main() {
  int n;
  std::cin >> n;
  std::cout << solve(n) << std::endl;
  return 0;
}


Measured memory_bytes: 256
#include<cstdio>
#include<cstring>
#include<vector>
#include<queue>
#include<algorithm>
#include<cmath>
#include<climits>
#include<string>
#include<set>
#include<map>
#include<iostream>
using namespace std;
#define rep(i,n) for(int i=0;i<((int)(n));i++)
#define reg(i,a,b) for(int i=((int)(a));i<=((int)(b));i++)
#define irep(i,n) for(int i=((int)(n))-1;i>=0;i--)
#define ireg(i,a,b) for(int i=((int)(b));i>=((int)(a));i--)
typedef long long int lli;
typedef pair<int,int> mp;
#define fir first
#define sec second
#define IINF INT_MAX
#define LINF LLONG_MAX
#define eprintf(...) fprintf(stderr,__VA_ARGS__)
#define pque(type) priority_queue<type,vector<type>,greater<type> >
#define memst(a,b) memset(a,b,sizeof(a))

//00:00
//00:35 WA
int h,w,r;
int gone[105][105][5][15][15]={};
char dat[105][105];

struct qd{
	int y,x,d;
	int a,b;
	bool operator<(qd v)const{
		return (a+b)<(v.a+v.b);
	}
	bool operator>(qd v)const{
		return (v<(*this));
	}
};

int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};


int sy,sx;

int main(void){
	scanf("%d%d%d",&h,&w,&r);
	reg(y,1,h)scanf("%s",dat[y]+1);
	reg(y,0,h+1)dat[y][0]=dat[y][w+1]='#';
	reg(x,0,w+1)dat[0][x]=dat[h+1][x]='#';
	
	reg(y,1,h)reg(x,1,w){
		if(dat[y][x]=='S'){
			sy=y; sx=x;
		}
	}
	
	priority_queue<qd> que;
	
	qd da;
	da.d=1; da.x=sx; da.y=sy+1; da.a=da.b=r;
	que.push(da);
	while(!que.empty()){
		qd da = que.top();
		que.pop();
		int x=da.x,y=da.y,d=da.d,a=da.a,b=da.b;
		//printf("%d %d %d | %d %d\n",y,x,d,a,b);
		if(gone[y][x][d][a][b])continue;
		gone[y][x][d][a][b] = 1;
		if(dat[y][x]=='S' && d==3)continue;
		if(dat[y][x]=='#')continue;
		if(dat[y][x]=='G'){
			printf("%d\n",r+r-da.a-da.b);
			return 0;
		}
		reg(i,-1,1){
			int td=(d+i+4)%4;
			int tx=x+dx[td],ty=y+dy[td];
			//printf("%d %d %d\n",ty,tx,td);
			if(dat[ty][tx]=='#')continue;
			if(i!=0 && dat[y][x]=='S')continue;	
			qd db=da;
			db.x=tx; db.y=ty; db.d=td;
			if(i!=0){
				if((td+(i>0?1:0))%2==0)db.a--;
				else db.b--;
			}
			if(db.a<0 ||db.b<0)continue;
			que.push(db);
		}
	}
	
	printf("-1\n");
	return 0;
}

Measured memory_bytes: 45172
protocol InitFromString {
    init?(_ str: String)
}

extension Int: InitFromString {}
extension Int8: InitFromString {}
extension Int16: InitFromString {}
extension Int32: InitFromString {}
extension Int64: InitFromString {}
extension String: InitFromString {}

func input<T: InitFromString>() -> [T] {
    readLine()!.split(separator: " ").map(String.init).compactMap(T.init)
}

let inputLine: [Int] = input()
let count = (inputLine[0]...inputLine[1]).reduce(into: 0) { (result, i) in
    if i % inputLine[2] == 0 {
        result += 1
    }
}

print(count)


Measured memory_bytes: 7808
#include <stdlib.h>
#include <iostream>
using namespace std;


#define REP(i,n) for(int i=0; i<(int)(n); ++i)
#define FOR(i,k,n) for(int i=(k);i<(int)(n);++i)

int main(){
	int n;
	long x;

	cin >> n >> x;

	long *box = (long *)calloc((n+2), sizeof(long));
	long *sum = (long *)calloc((n+2), sizeof(long));

	long result = 0;
	long dif = 0;

	FOR(i, 1, n+1){
		cin >> box[i];
		sum[i] = box[i] + box[i-1];
		dif = sum[i] - x;
		if(dif > 0){
			if(box[i] < dif){
				dif = box[i];
			}
			box[i] -= dif;
			result += dif;
		}
	}

	cout << result << endl;
	
	return 0;
}



Measured memory_bytes: 1792
#include <stdio.h>
#include <stdlib.h>

long long int GCD2(long long int A,long long int B){
	long long int C;
	long long int gcd2;
	if (A<B){
		C=B%A;
		if (C==0){
			gcd2=A;
		}
		if (C!=0){
			gcd2=GCD2(C,A);
		}
	}
	else{
		C=A%B;
		if (C==0){
			gcd2=B;
		}
		if (C!=0){
			gcd2=GCD2(C,B);
		}
	}
	return gcd2;
}

long long int GCD(int N,long long int *T){
	int NN=N/2;
	int new_N;
	int i;
	long long int ans;
	long long int *new_T;
	if (N>1){
		if (N==NN*2){
			new_N=NN;
			new_T=malloc(new_N*sizeof(long long int));
			for (i=0;i<NN;i++){
				new_T[i]=(T[i*2]/GCD2(T[i*2],T[i*2+1]))*T[i*2+1];
			}
		}
		else{
			new_N=NN+1;
			new_T=malloc(new_N*sizeof(long long int));
			for (i=0;i<NN;i++){
				new_T[i]=(T[i*2]/GCD2(T[i*2],T[i*2+1]))*T[i*2+1];
			}
			new_T[new_N-1]=T[N-1];
		}
		ans=GCD(new_N,new_T);
	}

	if (N==1){
		ans=T[0];
	}
	return ans;
}

int main(){
	int N;
	int i;
	scanf("%d",&N);
	long long int *T=malloc(N*sizeof(long long int));
	for (i=0;i<N;i++){
		scanf("%lld",&T[i]);
	}
	long long int ans=GCD(N,T);
	printf("%lld\n",ans);
	return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define rep(i,n) for(int i=0;i<(n);++i)
#define repi(i,a,b) for(int i=int(a);i<int(b);++i)
#define all(x) (x).begin(), (x).end()
#define PI 3.14159265358979323846264338327950L
using namespace std;
typedef long long ll;
typedef long double ld;
int main() {
    int a,b;
    cin>>a>>b;
    if(a<=0&&b>=0) cout<<"Zero";
    if(a>0) cout<<"Positive";
    if(b<0){
        if((b-a)%2==0) cout<<"Negative";
        else cout<<"Positive";
    }
}

Measured memory_bytes: 3592
#include <bits/stdc++.h>
#define ALL(A) (A).begin(),(A).end()
#define ll long long
#define rep(i,n) for(int i=0;i<(n);i++)

const ll mod = 1e9+7;
const ll INF = -1*((1LL<<63)+1);
const int inf = -1*((1<<31)+1);

using namespace std;

int main(void){
	cin.tie(0);
	ios::sync_with_stdio(false);
	ll N,A,B;
    ll ans = 0;
    cin >> N >> A >> B;
    if(abs(A-B)%2==0){
        cout << abs(A-B)/2 << endl;
    }else{
        if(B<A)swap(A,B);
        //左はしによる場合
        ll l = A - 1;//A君が左端に行くまでの回数
        ll tB = B - l;//A君が左端に行った時のBの座標
        if(tB==2)ans = l + 1;
        else {
            tB --;
            ans = l + 1 + (tB-1)/2;
        }
        //右端による場合
        ll r = N - B;//bが右端に行くまでの回数
        ll tA = A + r;
        if(tA==N-1)ans = min(ans,r + 1);
        else {
            tA ++ ;
            ans = min(ans,r + 1 + (N-tA)/2);
        }
        cout << ans << endl;
    }
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;

int main() {
    int h,a; cin >> h >> a;
    if(h % a == 0){
        cout << h/a << endl;
    }
    else cout << h/a+1 << endl;
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>
#include <stdlib.h>

int stack[100];
int it = 0;

void push(int x){
	it++;
	stack[it-1]=x;
//???????????????x????????????it???1????¶????
}

int pop(){
	it--;
	return stack[it];//?????????????????????????????????????????????it??????1?????????
}

int main(void) {
	int x,y,z,t;
	char str[1000000];
	while(scanf("%s",str)!=EOF){
		if(strcmp(str,"+")==0){
			x=pop();
			y=pop();
			z=y+x;
			push(z);
		}else if(strcmp(str,"-")==0){
			x=pop();
			y=pop();
			z=y-x;
			push(z);
		}else if(strcmp(str,"*")==0){
			x=pop();
			y=pop();
			z=y*x;
			push(z);
		}else if(strcmp(str,"/")==0){
			printf("?????????\n");
		}else{
			t=atoi(str);
			push(t);
		}
	}
	printf("%d\n",stack[0]);//stack[0]?????????
	return 0;
}

Measured memory_bytes: 984
/*
 *created by Kraken on 12-05-2020 at 15:29
 */
import java.util.*;
import java.io.*;

public class Main {

  public static void main(String[] args) {
    FastReader sc = new FastReader();
    String s = sc.next(), t = sc.next();
    if (t.substring(0, t.length() - 1).equals(s))
      System.out.println("Yes");
    else
      System.out.println("No");
  }

  static class FastReader {

    BufferedReader br;

    StringTokenizer st;

    public FastReader() {
      br = new BufferedReader(new InputStreamReader(System.in));
    }

    String next() {
      while (st == null || !st.hasMoreElements()) {
        try {
          st = new StringTokenizer(br.readLine());
        }
        catch (IOException e) {
          e.printStackTrace();
        }
      }
      return st.nextToken();
    }

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

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

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

    String nextLine() {
      String str = "";
      try {
        str = br.readLine();
      }
      catch (IOException e) {
        e.printStackTrace();
      }
      return str;
    }
  }
}


Measured memory_bytes: 32684
//g++ -std=c++14 test.cpp -o test.out
#include <string.h>
#include <stdlib.h>
#include <math.h>
#include <cassert>
#include <algorithm>
#include <functional>
#include <iostream>
#include <iomanip>
#include <vector>
#include <queue>
#include <map> 
#include <utility>
#include <limits.h>
using namespace std;

int A,B,Q;
long s[100002],t[100002],x[100000];

long ans[100000];

void solve(){
    sort(s,s+A);
    sort(t,t+B);
    for(int i=0;i<Q;i++){
        int si = lower_bound(s,s+A+1,x[i])-s;
        int ti = lower_bound(t,t+B+1,x[i])-t;
        //tsxstの順
        if(t[ti-1]<=s[si-1] && s[si-1]<=x[i] && x[i]<=s[si] && s[si]<=t[ti]){
            ans[i] = min(x[i]-t[ti-1],t[ti]-x[i]);
            continue;
        }
        //stxtsの順
        if(s[si-1]<=t[ti-1] && t[ti-1]<=x[i] && x[i]<=t[ti] && t[ti]<=s[si]){
            ans[i] = min(x[i]-s[si-1],s[si]-x[i]);
            continue;
        }
        //stxstの順
        if(s[si-1]<=t[ti-1] && t[ti-1]<=x[i] && x[i]<=s[si] && s[si]<=t[ti]){
            ans[i] = min({x[i]-s[si-1],
                          t[ti]-x[i],
                          s[si]-2*t[ti-1]+x[i],
                          2*s[si]-t[ti-1]-x[i]
                        });
            continue;
        }
        //tsxtsの順
        if(t[ti-1]<=s[si-1] && s[si-1]<=x[i] && x[i]<=t[ti] && t[ti]<=s[si]){
            ans[i] = min({x[i]-t[ti-1],
                          s[si]-x[i],
                          t[ti]-2*s[si-1]+x[i],
                          2*t[ti]-s[si-1]-x[i]
                        });
            continue;
        }
    }
}
 
int main(){
	cin >> A >> B >> Q;
    s[0] = -1000000000000000000;
    s[A+1] = 1000000000000000000;
    t[0] = -1000000000000000000;
    t[B+1] = 1000000000000000000;
	for(int i=1;i<A+1;i++)cin >> s[i];
    for(int i=1;i<B+1;i++)cin >> t[i];
    for(int i=0;i<Q;i++)cin >> x[i];
 
	solve();

	for(int i=0;i<Q;i++)cout << ans[i] << endl;
	return 0;
}


Measured memory_bytes: 4480
n = int(input())
v_list = [i for i in map(int, input().split())]
c_list = [i for i in map(int, input().split())]
sum = 0
for i in range(n):
    if v_list[i] - c_list[i] > 0:
        sum += v_list[i] - c_list[i]
print(sum)

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

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

  ll a, b; string s;
  cin >> a >> s >> b;
  if (s == "+") cout << (a + b) << '\n';
  else cout << (a - b) << '\n';

  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <math.h>
#include <numeric>
#include <vector>
#include <map>
#include <algorithm>
#include <queue>
#include <tuple>
#include <functional>
#include <cstring>

#define PI 3.14159265359
#define INF 1e9
#define LINF 1e18
#define irep(i,n) for(int  i = 0; i < n; i++)
#define irep2(i,a,n) for(int i = a; i < n; i++)
#define lrep(i,n) for(long long  i = 0; i < n; i++)
#define lrep2(i,a,n) for(long long i = a; i < n; i++)

typedef long long ll;
typedef std::vector<int> v_int;
typedef std::vector<std::vector<int> > v2_int;
typedef std::vector<ll> v_ll;
typedef std::vector<std::vector<ll> > v2_ll;
typedef std::vector<std::string> v_string;
typedef std::vector<std::vector<std::string> > v2_string;
typedef std::pair<ll, ll> pll;

using namespace std;

int main() 
{
    int n,a;
    cin >> n >> a;
    cout << n*n-a << endl;

    return 0;
}


Measured memory_bytes: 256
//****************************//
/**********  main *************/
//****************************//
#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>
#include <iomanip>
#include <math.h> 

using namespace std;
typedef long long ll;

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
#define REP(i, n) for (i = 0; i < n; i++)
#define FOR(i, a, b) for (i = a; i < b; i++)
#define ALL(x) (x).begin(), (x).end()
#define SIZE(x) ((ll)(x).size())

double pi = 3.141592653589793;

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

int main()
{

    std::cin.tie(0);

    long double a,b,res;
    ll rres;
    string tmp;

    cin >> a >> b;

    res = a * b;
    rres = ll(res);
    
    tmp = to_string(rres);

    for(ll i=0;i<tmp.size();i++){
        cout << tmp[i] ;
    }

    // cout << rres << endl;

    return 0;

}



Measured memory_bytes: 3812
#include<stdio.h>
  
int main(void)
{
    int t[4][14];
    int n, i,j,c;
    char m, d;
    for(i=0; i < 4; i++){
        for(j=0; j < 14; j++){
            t[i][j]=0;
        }
    }
    scanf("%d", &c);
    for(i = 0; i < c; i++){
        scanf("%c", &d);
        scanf("%c %d", &m, &n);
        if(m == 'S'){
            t[0][n] = 1;
        }
        else if(m == 'H'){
            t[1][n] = 1;
        }
        else if(m == 'C'){
            t[2][n] = 1;
        }
        else if(m == 'D'){
            t[3][n] = 1;
        }
    }
    for(j=1; j < 14; j++){
    if(t[0][j] != 1){
      printf("S %d\n", j);
    }
  }
  
    for(j=1; j < 14; j++){
        if(t[1][j] != 1){
            printf("H %d\n", j);
        }
    }
  
    for(j=1; j < 14; j++){
        if(t[2][j] != 1){
            printf("C %d\n", j);
        }
    }
  
    for(j=1; j < 14; j++){
        if(t[3][j] != 1){
        printf("D %d\n", j);
        }
    }
    return 0;
}


Measured memory_bytes: 2140
/*
         Md.Fagun Molla
         18ICTCSE006
         BSMRSTU(SHIICT)
*/
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define shesh return 0

int main () {
    //int  T; cin >> T;
   // while (T--) {
        ll a,b,c;
        cin>>a>>b>>c;
        if(a+b<=c){
            cout<<"0"<<" "<<"0"<<endl;
        }
        else{
        ll d,e;
        if(a<=c){
            d=0;
            e=b-(c-a);
        }
        else{
            d=a-c;
            e=b;
        }
        cout<<d<<" "<<e<<endl;
        }
    //}
    shesh;
}
/* pray for me
All is well
*/


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

#define ANS_MAX 1000000000000000000

int main() {
  int n;
  long long ans=1;
  bool flag=false;

  cin >> n;

  vector<long long> a(n,0);
  for(int i=0;i<n;i++) {
    cin >> a[i];
    if(a[i]==0) flag=true;
  }

  if(flag) {
    ans=0;
  } else {
    for(int i=0;i<n;i++) {
      if(ANS_MAX/a[i]<ans) {ans=-1;break;}
      else {ans *= a[i];}
    }
  }

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 4060
#include <iostream>
#include <vector>
#include <string>
#include <time.h>
using namespace std;

int main()
{
    int N;
    //cin>>N;
    scanf("%d", &N);
    //vector<vector<bool>> A(N, vector<bool>(N));
    static bool A[2048][2048];
    for (int i=1; i<N; i++)
    {
        //string t;
        //cin>>t;
        for (int j=0; j<i; j++)
        {
            char c;
            scanf(" %c", &c);
            A[i][j] = c!='0';
            A[j][i] = !A[i][j];
        }
    }

    //vector<vector<bool>> L(N, vector<bool>(N));
    //vector<vector<bool>> R(N, vector<bool>(N));
    static bool L[2048][2048];
    static bool R[2048][2048];
    for (int i=0; i<N; i++)
        L[i][i] = R[i][i] = true;

    /*
    for (int d=1; d<N; d++)
        for (int i=0; i<N; i++)
        {
            if (i+d<N)
                for (int j=i+1; j<N; j++)
                    if (A[i][j] && L[j][i+d] && R[j][i+1])
                        L[i][i+d] = true;

            if (0<=i-d)
                for (int j=0; j<i; j++)
                    if (A[i][j] && L[j][i-1] && R[j][i-d])
                        R[i][i-d] = true;
        }

    int ans = 0;
    for (int i=0; i<N; i++)
        if (L[i][N-1] && R[i][0])
            ans += 1;
    */


    for (int d=1; d<N; d++)
        for (int i=0; i<N; i++)
        {
            if (i+d<N)
            {
                bool b = false;
                for (int j=i+1; j<=i+d; j++)
                    b |= A[i][j] & L[i+d][j] & R[i+1][j];
                L[i+d][i] = b;
            }

            if (0<=i-d)
            {
                bool b = false;
                for (int j=i-d; j<i; j++)
                    b |= A[i][j] & L[i-1][j] & R[i-d][j];
                R[i-d][i] = b;
            }
        }

    int ans = 0;
    for (int i=0; i<N; i++)
        if (L[N-1][i] && R[0][i])
            ans += 1;

    cout<<ans<<endl;

    cerr<<(double)clock()/CLOCKS_PER_SEC<<endl;
}


Measured memory_bytes: 12544
#include<map>
#include<cmath>
#include<stack>
#include<queue>
#include<cstdio>
#include<vector>
#include<cstring>
#include<iostream>
#include<algorithm>
using namespace std;
typedef long long ll;
int a,b;
char c;
int main(){
    scanf("%d%d",&a,&b);
    for(int i=1;i<=a;i++){
        cin>>c;
        if(c<'0'||c>'9'){
            puts("No");
            return 0;
        }
    }
    cin>>c;
    if(c!='-'){
        puts("No");
        return 0;
    }
    for(int i=1;i<=b;i++){
        cin>>c;
        if(c<'0'||c>'9'){
            puts("No");
            return 0;
        }
    }
    puts("Yes");
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<iomanip>
#include<cstdio>
#include<algorithm>
#include<cassert>
#include<cmath>
#include<vector>
#include<map>
#include<set>
#include<string>
#include<queue>
#include<stack>
#include<list>
#include <cstring>
#include <functional>
#include<unordered_map>
#include<unordered_set>
#include<bitset>
using namespace std;
#define MOD 1000000007
#define MOD2 998244353
#define INF ((1<<30)-1)
#define LINF ((Int)1<<60)
#define EPS (1e-10)
#define REP(i,n) for(int i=0; i<(int)(n); ++i)
#define RREP(i,n) for(int i=1; i<=(int)(n); ++i)
#define FOR(i,k,n) for(int i=(k);i<(int)(n);++i)
typedef long long Int;
typedef pair<Int, Int> PI;
typedef pair<int, int> P;
typedef vector<double> vec;
typedef vector<vec> mat;
const int N = 300005;
//////////////////////////////

Int n;
vector<Int> a(3), b(3);
Int dp[30000000];

Int calc(vector<Int> s, vector<Int> o, Int m)
{
	memset(dp, 0, sizeof dp);
	for (Int i = 0; i < s.size();i++)
		for (Int v = 0; v + s[i] <= m; v++) {
			dp[v + s[i]] = max(dp[v + s[i]], dp[v] + o[i]);
		}

	Int res = m;
	for (Int v = 0; v <= m; v++) res = max(res, dp[v] + m - v);
	return res;
}

void solve()
{
	cin >> n;
	REP(i, 3) cin >> a[i];
	REP(i, 3) cin >> b[i];
	n = calc(a, b, n);
	n = calc(b, a, n);
	cout << n << endl;
}

int main() {
	ios_base::sync_with_stdio(0); cin.tie(0); cout << fixed << setprecision(13);
	solve();
	return 0;
}



Measured memory_bytes: 238032
#include <iostream>
#include <algorithm>
#include <queue>
#include <vector>
#include <string>
using namespace std;

typedef long long int ll;

int main() {

	int key = 0;
	int N = 0;

	cin >> N;
	for (int i = 0; i < N; i++) {
		char w;
		cin >> w;
			if (w == 'Y') {
				key = 1;
				break;
			}
	}

	if (key == 1) {
		cout << "Four" << endl;
	}
	else {
		cout << "Three" << endl;
	}


	return 0;
}

Measured memory_bytes: 256
/*
 Sarthak Jain
*/
#include <bits/stdc++.h>
using namespace std;
#define endl "\n"
#define int long long
int min(int a,int b){
	return (a<b)?a:b;
}
int max(int a,int b){
	return (a>b)?a:b;
}
int mod=1e9+7;
int fp(int a,int b){
	if(b==0) return 1;
	int x=fp(a,b/2);
	x=(x*x)%mod;
	if(b&1) x=(x*a)%mod;
	return x;
}

signed main() {
 ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
 int k,n;
 cin>>k>>n;
 int mx=0,s=0;
 int a[n];
 for(int i=0;i<n;i++)
 	cin>>a[i];
 for(int i=0;i<n-1;i++){
 	s+=abs(a[i+1]-a[i]);
 	mx=max(mx,abs(a[i+1]-a[i]));
 //	cout<<abs(a[i+1]-a[i])<<" ";
 }
 s+=(k-a[n-1]+a[0]);
 mx=max(mx,k-a[n-1]+a[0]);
 cout<<s-mx;
 
}


Measured memory_bytes: 1792
import sys

sys.setrecursionlimit(10 ** 6)
int1 = lambda x: int(x) - 1
p2D = lambda x: print(*x, sep="\n")
def II(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def LI(): return list(map(int, sys.stdin.readline().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]

def gcd(x,y):
    while y:x,y=y,x%y
    return x

def lcm(x,y):
    g=gcd(x,y)
    return x*y//g

def main():
    n,m=MI()
    aa=LI()
    aa=[a>>1 for a in aa]
    l=1
    for a in aa:l=lcm(l,a)
    for a in aa:
        if l//a%2==0:
            print(0)
            exit()
    print((m//l+1)//2)

main()

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

int main()
{
  i64 n;
  cin >> n;
  vector<pair<i64, i64>> p(n);
  for (i64 i = 0; i < n; i++)
    cin >> p[i].first >> p[i].second;
  sort(p.begin(), p.end());
  double ans = 0;
  do
  {
    for (i64 i = 0; i < n - 1; i++)
      ans += sqrt((p[i].first - p[i + 1].first) * (p[i].first - p[i + 1].first) + (p[i].second - p[i + 1].second) * (p[i].second - p[i + 1].second));
  } while (next_permutation(p.begin(), p.end()));
  for (i64 i = 1; i <= n; i++)
    ans /= i;
  cout << fixed << setprecision(10) << ans << endl;
  return 0;
}


Measured memory_bytes: 256
n = int(input())
h = list(map(int,input().split()))
dp = [0]*n
dp[1] = abs(h[0]-h[1])
for i in range(2,n):
    dp[i] = min(dp[i-2]+abs(h[i-2]-h[i]), dp[i-1]+abs(h[i-1]-h[i]))
print(dp[n-1])

Measured memory_bytes: 13980
package main

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

var sc = bufio.NewScanner(os.Stdin)

func read() string {
	sc.Scan()
	return sc.Text()
}

func main() {
	sc.Split(bufio.ScanWords)
	N, _ := strconv.Atoi(read())
	order := int(math.Trunc(math.Log10(float64(N)+0.1)) + 1)
	if order%2 == 0 {
		N = int(math.Pow10(order-1)) - 1
	}
	sub := 0
	for i := 1; i < order; i++ {
		if i%2 == 0 {
			sub += int(9 * math.Pow10(i-1))
		}
	}
	fmt.Printf("%v\n", N-sub)
}


Measured memory_bytes: 640
#pragma GCC optimize(2)
#include <bits/stdc++.h>
#define mk make_pair
const int maxn=3e5+100;
const int mod=1e9+7;
typedef long long ll;
using namespace std;
int vis[100][100];
bool flag[100];
int n,m,x,y;
bool ck(){
    for(int i=0;i<n;i++){
        if(flag[i])
        {
            for(int j=0;j<n;j++){
                if(vis[i][j]==2)
                    continue;
                if(vis[i][j]==1&&!flag[j])
                {
                    return false;
                }
                if(vis[i][j]==0&&flag[j]){
                    return false;
                }
            }
        }
    }
    return true;
}
int main()
{

    int x,y,z;
    scanf("%d%d%d",&x,&y,&z);
    if(x+y+z>=22)
        cout<<"bust"<<endl;
    else
        cout<<"win"<<endl;
}
/*
17
AAAAABBBCCBBBBCCC
100 1 10
*/


Measured memory_bytes: 256