akhauriyash/Code-Regression huggingface dataset:
//--------------------------------------------------------------------------------
// Code By:
//					######                  #               ######
//					##   #                  #               #
//					#####      ##       #####      ##       #   ###
//					##   #              #   #               #   # #
//					##    #	            #####               ##### #
//---------------------------------------------------------------------------------

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

                             /* ----------------------------- START of Template ---------------*/
#define ll long long int
#define FOR(x,to) for(x=0;x<(to);x++)
#define ALL(a) (a.begin()),(a.end())
#define ZERO(a) memset(a,0,sizeof(a))
#define rep(i,a,b) for(ll i=a;i<b;++i)
#define repd(i,a,b) for(ll i=a;i>=b;--i)
#define mp make_pair
#define hell 1000000007
#define vvll vector<vector<long long int> >
#define vll vector<long long int>
#define MINUS(a) memset(a,0xff,sizeof(a))
#define SZ(X) ((int)(X).size())
#define REP(I, N) for (int I = 0; I < (N); ++I)
#define REPP(I, A, B) for (int I = (A); I < (B); ++I)
#define FORS(I, S) for (int I = 0; S[I]; ++I)
#define RS(X) scanf("%s", (X))
#define MP make_pair
#define PB push_back
#define MS0(X) memset((X), 0, sizeof((X)))
#define MS1(X) memset((X), -1, sizeof((X)))
#define LEN(X) strlen(X)
#define F first
#define S second

void getZarr(string str, vll &Z)
{
    ll n = str.length();
    ll L, R, k;
    L = R = 0;
    for (ll i = 1; i < n; ++i)
    {
        if (i > R)
        {
            L = R = i;
            while (R<n && str[R-L] == str[R])
                R++;
            Z[i] = R-L;
            R--;
        }
        else
        {
            k = i-L;
            if (Z[k] < R-i+1)
                Z[i] = Z[k];
            else
            {
                L = i;
                while (R<n && str[R-L] == str[R])
                    R++;
                Z[i] = R-L;
                R--;
   } } }}
vector<ll>isprime;
void seive(ll size){
	isprime.resize(size+1,1);
	ll i,j;
	isprime[0]=0;
	isprime[1]=0;
	for(i=2;i*i<=size;i++){
		if(isprime[i]){
			for(j=2;j*i<=size;j++)isprime[i*j]=0;
		}
	}
}
ll power(ll x,unsigned ll y, ll m){
	if(y==0)return 1;
	ll p=power(x,y/2,m);
	p=(p*p)%m;
	if(y%2!=0)p=(p*x)%m;
	return p;
}
ll modinverse(ll a,ll m){
	return power(a,m-2,m);
}


                       /* ----------------------          End Of Template --------------------------------*/

ll findans(){
	ll a,b,c,k;
	cin>>a>>b>>c;
	cin>>k;
	while(b<=a){
		if(k>0){
			b*=2;
			k--;
		}
		else break;
	}
	while(c<=b){
		if(k>0){
			c*=2;
			k--;
		}
		else break;
	}
	if(b>a&&c>b)cout<<"Yes\n";
	else cout<<"No\n";
	return 0;



}

int main(){
	ios_base :: sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
	ll t,i;
//	cin>>t;
t=1;
	for(i=0;i<t;i++){
		findans();
	}
return 0;
}





Measured memory_bytes: 3636
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <climits>
#include <ctime>
#include <cassert>
using namespace std;

#define rep(i,a,n) for(int i=a; i<n; i++)
#define repq(i,a,n) for(int i=a; i<=n; i++)
#define repr(i,a,n) for(int i=a; i>=n; i--)
#define pb(a) push_back(a)
#define fr first
#define sc second
#define INF 2000000000
#define int long long int

#define X real()
#define Y imag()
#define EPS (1e-10)
#define EQ(a,b) (abs((a) - (b)) < EPS)
#define EQV(a,b) ( EQ((a).X, (b).X) && EQ((a).Y, (b).Y) )
#define LE(n, m) ((n) < (m) + EPS)
#define LEQ(n, m) ((n) <= (m) + EPS)
#define GE(n, m) ((n) + EPS > (m))
#define GEQ(n, m) ((n) + EPS >= (m))

typedef vector<int> VI;
typedef vector<VI> MAT;
typedef pair<int, int> pii;
typedef long long ll;

typedef complex<double> P;
typedef pair<P, P> L;
typedef pair<P, double> C;

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

namespace std {
    bool operator<(const P& a, const P& b) {
        return a.X != b.X ? a.X < b.X : a.Y < b.Y;
    }
}

signed main() {
    int cnt[2] = {};
    int inp;
    rep(i,0,3) {
        cin >> inp;
        if(inp == 5) cnt[0]++;
        else if(inp == 7) cnt[1]++;
    }
    if(cnt[0] == 2 && cnt[1] == 1) cout << "YES" << endl;
    else cout << "NO" << endl;
    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>

int queue[3000];
int top=0;
int bottom=0;

int vx[4]={1,0,-1,0};
int vy[4]={0,-1,0,1};

void push(int x){
	queue[bottom]=x;
	bottom++;
}

int pop(){
	if(top>=bottom)return -1;
	return queue[top++];
}

int main(){
	int H,W;
	scanf("%d%d",&H,&W);
	char s[H][W+1];
	for(int i=0;i<H;i++)scanf("%s",s[i]);
	
	int white=0;
	for(int i=0;i<H;i++)for(int j=0;j<W;j++)if(s[i][j]=='.')white++;
	
	int step[H][W];
	for(int i=0;i<H;i++)for(int j=0;j<W;j++)step[i][j]=0;
	
	push(0);
	step[0][0]=1;
	
	while(1){
		int p=pop();
		if(p==-1)break;
		
		int x=p/W;
		int y=p%W;
		
		for(int i=0;i<4;i++){
			int xx=x+vx[i];
			int yy=y+vy[i];
			if(0<=xx && xx<H && 0<=yy && yy<W && s[xx][yy]=='.' && step[xx][yy]==0){
				push(xx*W+yy);
				step[xx][yy]=step[x][y]+1;
			}
		}
		
	}
	
	if(step[H-1][W-1]==0)printf("-1\n");
	else printf("%d\n",white-step[H-1][W-1]);
	
	return 0;
}

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

int cnt[200004];

int main(){

  int i;
  int n;
  int x;

  scanf("%d", &n);

  for(i = 1;i <= n;i++) cnt[i] = 0;

  for(i = 2;i <= n;i++){
    scanf("%d", &x);
    cnt[x]++;
  }

  for(i = 1;i <= n;i++) printf("%d\n", cnt[i]);

  return 0;
}


Measured memory_bytes: 2512
import java.util.*

fun main(args: Array<String>) {
  val (n, m) = listOfInt()
  val aSet = (0 until m).map {
    nextInt()
  }.toSet()

  val dp = mutableMapOf<Int, Int>()
  dp[0] = 1
  (1..n).forEach { i ->
    if (aSet.contains(i)) {
      dp[i] = 0
    } else {
      val preConbNum = dp[i - 1] ?: 0
      val pre2ConbNum = dp[i - 2] ?: 0
      dp[i] = (preConbNum + pre2ConbNum) % 1000000007
    }
  }
  println(dp[n])
}

fun next() = readLine()!!
fun nextInt() = next().toInt()
fun listOfString() = next().split(" ")
fun listOfInt() = listOfString().map { it.toInt() }

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

class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        Task solver = new Task();
        solver.solve(in, out);
        out.close();
    }

    static class Task {
        void solve(InputReader in, PrintWriter out) {
            int N = in.nextInt();
            int A = in.nextInt();
            int B = in.nextInt();
            out.println(Math.min(A*N, B));
        }
    }

    static class InputReader {
        BufferedReader reader;
        StringTokenizer tokenizer;

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

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

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

Measured memory_bytes: 20948
#include "bits/stdc++.h"
using namespace std;
#define REP(i, n) for(ll i = 0;i < n;i++)
#define ll long long
#define MOD 1000000007
#define llMAX 9223372036854775807
#define llMIN -9223372036854775808
using vi = vector<ll>; // intの1次元の型に vi という別名をつける
using vvi = vector<vi>; // intの2次元の型に vvi という別名をつける

ll n,k,x,y;

int main(){
  ll ans=0;
  double d;
  cin >> d ;
  d*=3.14159265358979323846*2.0;

  //小数点表記
  cout << setprecision(16) << d<<endl;
  return 0;
}

Measured memory_bytes: 3784
n=int(input())
x=list(map(float,input().split()))
y=list(map(float,input().split()))

a=0
for i in range(n):
    a+=abs(x[i]-y[i])
print('{:.6f}'.format(a))

b=0
for i in range(n):
    b+=(x[i]-y[i])**2
print('{:.6f}'.format(b**(1/2)))

c=0
for i in range(n):
        c+=abs((x[i]-y[i]))**3
print('{:.6f}'.format(c**(1/3)))

d=[]
for i in range(n):
    d.append(abs(x[i]-y[i]))
print('{:.6f}'.format(max(d)))
    


Measured memory_bytes: 5668
//https://atcoder.jp/contests/dp/tasks/dp_v
//the slow solution
#include <bits/stdc++.h>
#define ll long long
using namespace std;
const int inf=1e5+9;

ll n,m,dp[inf],pre[inf],suf[inf],ans[inf],mod;
vector<int> v[inf];
void dfs(int node,int par){

    dp[node]=1;

    for(int i=0;i<v[node].size();i++){

        int o=v[node][i];
        if(o==par)
            continue;

        dfs(o,node);
        pre[o]=dp[node];

        dp[node]=(dp[node]*(dp[o]+1))%mod;
    }

    ll cnt=1;
    for(int i=v[node].size()-1;i>=0;i--){

        int o=v[node][i];
        if(o==par)
            continue;

        suf[o]=cnt;
        cnt=(cnt*(dp[o]+1)  )%mod;
    }
}

void get(int node,int par,int sum){


    ans[node]=((sum+1)*dp[node])%mod;

    for(auto o:v[node])
        if(o!=par)
            get(o,node,(( (sum+1)*pre[o])%mod *suf[o])%mod  );
}

int main(){

    cin>>n>>mod;
    for(int i=1;i<n;i++){
        int x,y;
        cin>>x>>y;
        v[x].push_back(y);
        v[y].push_back(x);
    }
    dfs(1,0);
    get(1,0,0);
    for(int i=1;i<=n;i++)
        cout<<ans[i]<<endl;
}


Measured memory_bytes: 15360
#include<stdio.h>

int main(){
  int n; scanf("%d", &n);
  
  int w[n]; for(int i = 0; i < n; i++) scanf("%d", i + w);
  
  int s[n + 1];
  s[0] = 0;
  for(int i = 1; i <= n; i++) s[i] = s[i - 1] + w[i - 1];
  
  int min = s[n];
  if(min < 0) min = -min;
  for(int i = 1; i <= n; i++){
    int s_diff = s[n] - 2 * s[i];
    
    if(s_diff < 0) s_diff = -s_diff;
    
    if(s_diff < min) min = s_diff;
  }
  
  printf("%d", min);
  
  return 0;
}


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

#define rep(i,n) for(ll i=0;i<(n);++i)
using ll = int_fast64_t;
using pll = pair<ll,ll>;
constexpr ll INF = (1LL<<60);
constexpr ll MOD = (1e9+7);
//constexpr ll MOD = (998244353);
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(a>b){a=b;return 1;}return 0;}
#if loc||local
void dump(){cerr<<endl;}
template<class T,class... Ts> void dump(T&& h, Ts&&... t){cerr<<h<<", ";dump(forward<Ts>(t)...);}
#else
void dump(){}
template<class T,class... Ts> void dump(T&& h, Ts&&... t){}
#endif
template<class T> istream &operator>>(istream&is,vector<T>&v){for(auto &elemnt:v)is>>elemnt;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> ostream &operator<<(ostream& os,vector<T>const& v){for(auto const& vi:v)os<<vi<<" ";return os;}
template<class T,class U> ostream &operator<<(ostream& os,pair<T,U>const& p){os<<p.first<<","<<p.second;return os;}
template<class T>vector<T> vec(size_t a){return vector<T>(a);}
template<class T, class... Ts>auto vec(size_t a, Ts... ts){return vector<decltype(vec<T>(ts...))>(a, vec<T>(ts...));}

signed main(){

  int n;
  cin>>n;
  vector<ll> a(n);
  cin>>a;

  ll sum = accumulate(a.begin(),a.end(),0ll);
  if(sum%10){
    cout<<sum<<endl;
    exit(0);
  }
  sort(begin(a),end(a));
  int r=-1;
  rep(i,n){
    if(a[i]%10==0)continue;
    r=a[i];
    break;
  }
  if(r==-1)cout<<0<<endl;
  else cout<<sum-r<<endl;
  

}

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

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

using namespace std;

template<class T> struct edge{
	int to;
	T wt;
	edge(int to,const T& wt):to(to),wt(wt){}
};
template<class T> using weighted_graph=vector<vector<edge<T>>>;

class union_find{
	int n;
	vector<int> p;
public:
	union_find(int n):n(n),p(n,-1){}
	int find(int u){ return p[u]<0?u:p[u]=find(p[u]); }
	void unite(int u,int v){
		u=find(u); v=find(v);
		if(u!=v){
			if(p[v]<p[u]) swap(u,v);
			p[u]+=p[v]; p[v]=u; n--;
		}
	}
	bool is_same(int u,int v){ return find(u)==find(v); }
	int size()const{ return n; }
	int size(int u){ return -p[find(u)]; }
};

weighted_graph<int> T;
int dir[100000],deg[100000];

void dfs(int u,int p){
	for(auto e:T[u]){
		int v=e.to,i=e.wt;
		if(v==p) continue;

		dfs(v,u);
		if(i>0){
			i--;
			if(deg[v]%2==0) dir[i]= 1, deg[u]++;
			else            dir[i]=-1, deg[v]++;
		}
		else{
			i=-i-1;
			if(deg[v]%2==0) dir[i]=-1, deg[u]++;
			else            dir[i]= 1, deg[v]++;
		}
	}
}

int main(){
	int n,m; scanf("%d%d",&n,&m);

	if(m%2==1) return puts("-1"),0;

	pair<int,int> E[100000];
	rep(i,m){
		int u,v; scanf("%d%d",&u,&v); u--; v--;
		E[i]={u,v};
	}

	T.resize(n);
	union_find U(n);
	rep(i,m){
		int u,v; tie(u,v)=E[i];
		if(!U.is_same(u,v)){
			U.unite(u,v);
			T[u].emplace_back(v, i+1);
			T[v].emplace_back(u,-i-1);
		}
		else{
			dir[i]=1;
			deg[u]++;
		}
	}

	dfs(0,-1);

	rep(i,m){
		int u,v; tie(u,v)=E[i];
		if(dir[i]==1) printf("%d %d\n",u+1,v+1);
		else          printf("%d %d\n",v+1,u+1);
	}

	return 0;
}


Measured memory_bytes: 15488
#include <iostream>
#include <cmath>
#include <vector>
#include <string>
#include <map>
#include <algorithm>
#include <limits>
#include <ios>
#include <iomanip>
#include <stdio.h>
#include <iomanip>
#include <queue>
using namespace std;

#define rep(i,N) for(int i=0; i<N; i++)
#define revrep(i,N) for(int i=N-1; i>=0; i--)
#define coutline cout<<"------------ ("<<__LINE__<<")"<<endl;

typedef long long ll;

int main(void)
{
    int N, M;
    cin >> N >> M;

    //vector<int> L(M), R(M);
    int L=0;
    int R=N-1;
    rep(i,M){
        int l,r;
        cin >> l >> r;
        l--;r--;
        if (l > L) L = l;
        if (r < R) R = r;
    }
    int ret = R-L+1;
    if (ret < 0) ret = 0;
    cout << ret << endl;

    return 0;
}


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

int main() {
    string s;
    cin >> s;
    int numA=0;
    int numZ=0;
    
    for (int i = 0; i < s.size(); i++){
        if (s[i]=='A') {
        numA = i;
        break;
        }
    }

    for (int i = 0; i < s.size(); i++){
        if (s[i]=='Z') numZ = i;
    }

    cout << numZ - numA + 1 << endl;
}


Measured memory_bytes: 640
#include <iostream>
using namespace std;
#include<string.h>
#include<set>
#include<stdio.h>
#include<math.h>
#include<queue>
#include<map>
#include<algorithm>
#include<cstdio>
#include<cmath>
#include<cstring>
#include <cstdio>
#include <cstdlib>
#include<stack>
#include<vector>
char a[500];
int main()
{
    cin>>a;
    int len=strlen(a);
    int temp=len;
    for(int i=len-1;i>=0;i--)
    {
        if(a[i]=='F'&&a[i+1]=='E'&&a[i+2]=='S')
            {
                temp=i;
                break;
            }
    }
    for(int i=0;i<temp;i++)
        cout<<a[i];
    cout<<endl;
    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
int main(void) {
  int N,K;
  char str[100];
  scanf("%d %d",&N,&K);
  scanf("%s",str);
  if(str[K-1] =='A')
    str[K-1] = 'a';
  if(str[K-1] =='B')
    str[K-1] = 'b'; 
  if(str[K-1] =='C')
    str[K-1] = 'c'; 
  printf("%s\n",str);
  return 0;
}


Measured memory_bytes: 1616
#include <stdio.h>
#include <string.h>
#include <math.h>
#include <stdlib.h>
typedef long long ll;

int cmp(const void*a,const void*b)
{
	return *(ll *)a-*(ll *)b; 
}
int main(void)
{
   int n,i;
   ll c,k;
   ll s[101000];
   ll count=1,l=1,start;
   scanf("%d %lld %lld",&n,&c,&k);
   for(i=0;i<n;i++)
   scanf("%lld",&s[i]);
   qsort(s,n,sizeof(s[0]),cmp); 
   start=s[0];
	for(i=1;i<n;i++)
	{
		if(s[i]<=(start+k)&&l<c)
		l++;
		else if(l==c)
		{
			count++;
			l=1;
			start=s[i];
		}
		else if(s[i]>(start+k))
		{
			count++;
			l=1;
			start=s[i];
		}
	}
	printf("%lld\n",count);
 } 

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

int main() {
    int N,K;
    string S;
    cin >> N >> K;
    cin >> S;
    
    vector<int> Nums;
    int now = 1;
    int cnt = 0;

    rep(i, N) {
        if(S[i] == (char)('0')+now) cnt++;
        else {
            Nums.push_back(cnt);
            now = 1 - now;
            cnt = 1;
        }
    }
    if (cnt!=0) Nums.push_back(cnt);
    if (Nums.size()%2==0) Nums.push_back(0);
    int Add = 2*K+1;
    int ans = 0;

    vector<int> sum(Nums.size()+1);
    rep(i, Nums.size()) {
        sum[i+1] = sum[i]+Nums[i];
    }
    
    for(int i = 0; i < (int)Nums.size(); i+=2) {
        int left = i;
        int right = min(i+Add, (int)Nums.size());
        int tmp = sum[right] - sum[left];
        ans = max(ans, tmp);
    }
    cout << ans << endl;

    return 0;
}

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

int main() {
  int n;
  cin>>n;
  int p[n], q[n];
  for (int i=0; i<n; i++) cin>>p[i];
  for (int i=0; i<n; i++) cin>>q[i];
  int r[n];
  for (int i=0; i<n; i++) {
    r[i] = i + 1;
  }
  int cnt = 0;
  int a, b;
  do {
    bool ok = true;
    for (int i=0; i<n; i++) {
      if (p[i] != r[i]) {
        ok = false;
        break;
      }
    }
    if (ok) {
      a = cnt;
    }
    ok = true;
    for (int i=0; i<n; i++) {
      if (q[i] != r[i]) {
        ok = false;
        break;
      }
    }
    if (ok) {
      b = cnt;
    }
    ++cnt;
  } while (next_permutation(r, r + n));
  cout<<abs(a - b)<<endl;
}

Measured memory_bytes: 256
n, m = map(int,input().split())
min_max = 0
max_min = 1000000

for i in range(m):
    l, r = map(int, input().split())
    if l > min_max:
        min_max = l

    if r < max_min:
        max_min = r

print(len(range(min_max, max_min + 1)))


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

typedef long long ll;
typedef long double ld;
typedef pair<int, int> ii;
typedef pair<int, ii> iii;
typedef pair<ii, int> ri3;
#define mp make_pair
#define pb push_back
#define fi first
#define sc second
#define SZ(x) (int)(x).size()
#define ALL(x) begin(x), end(x) 
#define REP(i, n) for (int i = 0; i < n; ++i) 
#define FOR(i, a, b) for (int i = a; i <= b; ++i)
#define RFOR(i, a, b) for (int i = a; i >= b; --i)

const int N = 305;
const int A = 305;
const int mod = 998244353;

int n, a[N];
int dp[N][N*A];

int main() {
    //freopen("in.txt", "r", stdin);
    ios::sync_with_stdio(false);
    cin.tie(0);

    cin >> n;
    int sum = 0;
    FOR(i,0,n-1) { 
        cin >> a[i];
        sum += a[i];
    }

    int ans = 1;
    FOR(i,0,n-1) {
        ans = (ans*3LL)%mod;
    }

    dp[n][0] = 1;
    FOR(x, 1, sum) dp[n][x] = 0;

    RFOR(i, n-1, 0) {
        FOR(x, 0, sum) {
            dp[i][x] = (dp[i][x] + (2LL*dp[i+1][x])%mod)%mod;
            if (x >= a[i]) dp[i][x] = (dp[i][x] + dp[i+1][x-a[i]])%mod;
        }
    }

    int sub = 0;
    FOR(x, (sum+1)/2, sum) {
        sub = (sub+dp[0][x])%mod;
    }

    if (sum%2 == 0) {
        dp[n][0] = 1;
        FOR(x, 1, sum) dp[n][x] = 0;

        RFOR(i, n-1, 0) {
            FOR(x, 0, sum) {
                dp[i][x] = (dp[i+1][x+a[i]] + dp[i+1][abs(x-a[i])])%mod;
            }
        }
        sub = ((ll)sub + mod - dp[0][0]) % mod;
    }

    cout << ((ll)ans + 3LL*mod - 3LL*sub) % mod << '\n';
}



Measured memory_bytes: 110848
#include<stdio.h>
#include<stdlib.h>
int main(){
    char s[100];
    int x[100],i=0;
    while(scanf("%s",s)!=EOF){
        if(s[0]=='+'){
            x[i-2]=x[i-2]+x[i-1];
            i--;
        }
        else if(s[0]=='-'){
            x[i-2]=x[i-2]-x[i-1];
            i--;
        }
        else if(s[0]=='*'){
            x[i-2]=x[i-2]*x[i-1];
            i--;
        }
        else{
        x[i]=atoi(s);
        i++;
        }
    }
    printf("%d\n",x[i-1]);
  return 0;
}


Measured memory_bytes: 2104
parseInt(x) = parse(Int, x)
parseBigInt(x) = parse(BigInt, x)
parseFloat(x) = parse(Float64, x)
parseBigFloat(x) = parse(BigFloat, x)
parseMap(x::Array{SubString{String},1}) = map(parseInt, x)

function main()
    s=readline()
    t=readline()
    if s==t[1:end-1]
        println("Yes")
    else
        println("No")
    end
end
main()

Measured memory_bytes: 155064
#include <bits/stdc++.h>
using namespace std;
#define int long long int
int32_t main(){
	string s;cin>>s;
	int ans1=0,ans2=0;
	for(int i=0;i<s.length();i++){
		if((s[i]-'0')==(i&1)) ans1++;
		else ans2++;
	}
	cout<<min(ans1,ans2);
}


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

#define DIV 1000000007
using namespace std;

int main() {
    int N, A, B;
    cin >> N >> A >> B;

    int ans = 0;
    for (int i = 1; i <= N; i++) {
       int temp = i;
       int total = 0;
       while (temp) {
           total += temp % 10;
           temp /= 10;
       }
       if (total>=A&&total <= B)
           ans+=i;
    }
    cout << ans << endl;
   
}

Measured memory_bytes: 256
#include <iostream>
#include <cstring>
#include <algorithm>
#include <vector>
#include <string>
#include <math.h>
#include <iomanip>
#include <limits>
#include <list>
#include <queue>
#include <tuple>
#include <map>
using namespace std;
#define MOD (long long int)(1e9+7)
#define ll long long int
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define reps(i,n) for(int i=1; i<=(int)(n); i++)
#define REP(i,n) for(int i=n-1; i>=0; i--)
#define REPS(i,n) for(int i=n; i>0; i--)
#define INF (int)(1123456789)
#define LINF (long long int)(112345678901234567)
#define chmax(a, b) a = (((a)<(b)) ? (b) : (a))
#define chmin(a, b) a = (((a)>(b)) ? (b) : (a))
#define all(v) v.begin(), v.end()

int main(void){
	int n,m,l,r,ml,mr;
	cin>>n>>m;
	ml = 0;
	mr = INF;
	rep(i,m){
		cin>>l>>r;
		chmax(ml,l);
		chmin(mr,r);
	}
	cout<<max(0,mr-ml+1)<<endl;
	return 0;
}


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

int main(){
  int f = 0, n, a, max;

  cin>>n;

  for(int i=0;i<n;i++){
    cin>>a;
    f += a - 1;
  }
  
  cout<<f<<endl;
  
  return 0;
}


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

using namespace std;

int main() {
    int N, M; cin >> N >> M;
    int X[M]; for(int i=0; i<M; i++) cin >> X[i]; sort(X,X+M);
    int X_diff[M-1]; for(int i=0; i<M-1; i++) X_diff[i] = X[i+1] - X[i]; sort(X_diff, X_diff+(M-1), greater<int>());

    int result = X[M-1] - X[0];
    if (N < M) { for(int i=0; i<min(N-1,M); i++) result -= X_diff[i]; } else { result = 0; }
    
    cout << result << endl;
    return 0;
}

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

using namespace std;

typedef long long ll;

int main() {
  int N, M;
  cin >> N >> M;

  priority_queue<ll> pq;

  for (int i = 0; i < N; i++) {
    ll A;
    cin >> A;
    pq.push(A);
  }

  while (M > 0) {
    ll a = pq.top();
    pq.pop();

    pq.push(a / 2);
    M--;
  }

  ll ans = 0;
  while (!pq.empty()) {
    ll a = pq.top();
    pq.pop();
    ans += a;
  }

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 1400
#include<stdio.h>

#define WHITE 0
#define GRAY 1
#define BLACK 2

int color[100],d[100],f[100],m[100][100],n,top=0,S[100],t=0,nt[100];

void push(int u){
  top++;
  S[top]=u;
}
int next(int u){
  int i;
  for(i=nt[u];i<n;i++){
    nt[u]=i+1;
    if(m[u][i]) return i;
  }
  return -1;
}

void dfs_visit(int r){
  int i,u,v;
  for(i=0;i<n;i++) nt[i]=0;
  push(r);
  color[r]=GRAY;
  d[r]=++t;
  while(top!=0){
    u=S[top];
    v=next(u);
    if(v!=-1){
      if(color[v]==WHITE){
	d[v]=++t;
	color[v]=GRAY;
	push(v);
      }
    }
      else{
	top--;
	color[u]=BLACK;
	f[u]=++t;
    }
  }
}

void dfs(){
  int i=0,u;
  for(i=0;i<n;i++){
    color[i]=WHITE;
    nt[i]=0;
  }
  t=0;
  for(u=0;u<n;u++){
    if(color[u]==WHITE) dfs_visit(u);
  }
  for(i=0;i<n;i++){
    printf("%d %d %d\n",i+1,d[i],f[i]);
  }
}

int main(){
  int i,j,u,k,v;
  scanf("%d",&n);
  for(i=0;i<n;i++){
    for(j=0;j<n;j++) m[i][j]=0;
  }
  for(i=0;i<n;i++){
    scanf("%d%d",&u,&k);
    u--;
    for(j=0;j<k;j++){
      scanf("%d",&v);
      v--;
      m[u][v]=1;
    }
  }
  dfs();
  return 0;
}




Measured memory_bytes: 2104
import scala.collection.mutable.Stack
import scala.util.control.Breaks.{breakable, break}

object Main extends App {
  val input = io.Source.stdin.getLines()
  breakable {
    while (input.hasNext) {
      val Array(w,h) = input.next().split(' ').map(_.toInt)
      if (w == 0 || h == 0) break()
      val field = Array.fill(h)(input.next().split(' ').map(_.toInt))
      var count = 0
      val visited = Array.ofDim[Boolean](w,h)
      for (i <- 0 until w; j <- 0 until h; if canVisit(i,j)) {
        count += 1
        dfs(i, j)
      }
      println(count)

      def canVisit(p: (Int, Int)): Boolean =
        p._1 >= 0 && p._1 < w && p._2 >= 0 && p._2 < h &&
          !visited(p._1)(p._2) && field(p._2)(p._1) == 1

      def dfs(start: (Int, Int)): Unit = {
        val stack = Stack[(Int, Int)]()
        stack.push(start)
        while (stack.nonEmpty) {
          val (x, y) = stack.pop()
          visited(x)(y) = true
          Seq(
            (x, y - 1), (x, y + 1),
            (x - 1, y), (x - 1, y - 1), (x - 1, y + 1),
            (x + 1, y), (x + 1, y - 1), (x + 1, y + 1)
          ).withFilter(canVisit).foreach(stack.push)
        }
      }
    }
  }
}


Measured memory_bytes: 62428
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using ull = unsigned long long;
using P = pair<int, int>;
const int INF = 1e9;

int main() {
  int n, k, x, y, res;
  cin >> n >> k >> x >> y;
  if (n > k) {
    res = x*k + y*(n-k);
  } else {
    res = x*n;
  }
  cout << res << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long int
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
static const ll MAX = 1000000000000000;
static const int NIL = -1;
using namespace std;
const long double EPS = 0.0000000001;
const long double PI = (acos(-1));
const int MOD = 1000000007;
typedef pair<int,int> pr;
#pragma GCC target("avx2")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")


int main(){
    string s; cin >> s;
    ll ans = 0;
    ll left = 0, right = s.length()-1;

    while(left < right){
        if(s[left] != 'x' && s[right] != 'x' && s[left] != s[right]){
            cout << -1;
            return 0;
        }else if(s[left] == s[right]){
            left ++;
            right --;
        }else if(s[left] == 'x'){
            left ++;
            ans ++;
        }else if(s[right] == 'x'){
            right --;
            ans ++;
        }
    }
    cout << ans;

}

Measured memory_bytes: 3720
#include <cstdio>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <vector>
using namespace std;

long long relu(long long x){
  if (x<0) return 0;
  return x;
}

int main(){
  long long n, d[5];
  scanf("%lld %lld %lld %lld %lld %lld", &n, &d[0], &d[1], &d[2], &d[3], &d[4]);
  
  //printf("%lld %lld %lld %lld %lld %lld\n", n, d[0], d[1], d[2], d[3], d[4]);
  
  // 輸送能力を変更
  long long min_num = d[0];
  for(int i=1; i<5; i++){
    min_num = min(min_num, d[i]);
    d[i] = min_num;
  }
  
  // 都市１
  unsigned long long city1_time = (n - 1) / d[0] + 1;
  //printf("%lld\n", city1_time);
  // 都市２
  unsigned long long city2_num =  relu((city1_time - 1) * (d[0] - d[1]));
  if (n % d[0] == 0) {
    city2_num += d[0];
  } else {
    city2_num += (n % d[0]);
  }
  unsigned long long city2_time = city1_time + (city2_num + d[1] - 1) / d[1];
  //printf("%lld %lld\n", city2_num, city2_time);
  // 都市３
  unsigned long long city3_num = relu((city2_time - 2) * (d[1] - d[2]));
  if (city2_num % d[1] == 0) {
    city3_num += d[1];
  } else {
    city3_num += (city2_num % d[1]);
  }
  unsigned long long city3_time = city2_time + (city3_num + d[2] - 1) / d[2];
  //printf("%lld %lld\n", city3_num, city3_time);
  // 都市４
  unsigned long long city4_num = relu((city3_time - 3) * (d[2] - d[3]));
  
  if (city3_num % d[2] == 0) {
    city4_num += d[2];
  } else {
    city4_num += (city3_num % d[2]);
  }
  unsigned long long city4_time = city3_time + (city4_num + d[3] - 1) / d[3];
  //printf("%lld %lld\n", city4_num, city4_time);
  // 都市５
  unsigned long long city5_num =  relu((city4_time - 4) * (d[3] - d[4]));
  if (city4_num % d[3] == 0) {
    city5_num += d[3];
  } else {
    city5_num += (city4_num % d[3]);
  }
  unsigned long long city5_time = city4_time + (city5_num + d[4] - 1) / d[4];
  //printf("%lld %lld\n", city5_num, city5_time);
  
  printf("%lld", city5_time);
  return 0;
}

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

#define REP(i,num) for(int i=0;i<(num);++i)
#define LOOP(i) while(i--)
#define ALL(c) c.begin(),c.end()
#define PRINTALL(c) for(auto pitr=c.begin();pitr!=c.end();++pitr){cout<<*pitr;if(next(pitr,1)!=c.end())cout<<' ';}cout<<endl;
#define PAIRCOMP(c,comp) [](const pair<ll,ll>& lhs,const pair<ll,ll>& rhs){return lhs.c comp rhs.c;}

using namespace std;
using ll = long long;

constexpr ll atcoder_mod = 1e9+7;

template<typename T=int>
T in(){T x; cin >> x; return (x);}
template<typename T=int,typename C=vector<T>>
C vecin(int N){C x(N);REP(i,N){x[i]=in<T>();}return move(x);}

void vout(){cout << endl;}
template<typename Head,typename... Tail>
void vout(Head&& h,Tail&&... t){cout << ' ' << h;vout(forward<Tail>(t)...);}
void out(){cout << endl;}
template<typename Head,typename... Tail>
void out(Head&& h,Tail&&... t){cout << h;vout(forward<Tail>(t)...);}

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	cout<<fixed<<setprecision(10);

	int H=in(),W=in(),K=in();
	vector<vector<int>> L(H,vector<int>(W,0)),M(H);
	REP(i,H){
		string S=in<string>();
		REP(j,W){
			if(S[j]=='#'){
				M[i].push_back(j);
			}
		}
	}
	int SN=1;
	REP(i,H){
		if(!M[i].empty()){
			int old=0;
			for(int j=0,ej=M[i].size()-1;j<ej;j++){
				for(int k=old;k<=M[i][j];k++){
					L[i][k]=SN;
				}
				old = M[i][j]+1;
				SN++;
			}
			for(int k=old;k<W;k++){
				L[i][k]=SN;
			}
			SN++;
		}
	}
	REP(j,W){
		int old=0,cur=0,last=0;
		while(cur<=H-1){
			if(L[cur][j]>0){
				for(int i=old;i<=cur;i++){
					L[i][j] = L[cur][j];
				}
				last = L[cur][j];
				old = cur+1;
				cur = old;
			}
			else cur++;
		}
		for(int i=old;i<H;i++){
			L[i][j] = last;
		}
	}

	REP(i,H){
		PRINTALL(L[i]);
	}
	return 0;
}


Measured memory_bytes: 1792
while line = gets
    a, b, c, d, e, f = line.chomp.split.map(&:to_f)
    detA = a * e - b * d
    detA1 = c * e - b * f
    detA2 = a * f - c * d
    printf("%.3f %.3f\n", detA1 / detA + 0, detA2 / detA + 0)
end

Measured memory_bytes: 8508
///package CodeChef;


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.StringTokenizer;

public class Main {
   public static int mod=1000000007;
   public static int minPlus=mod;
	public static void main(String[] ard)  throws IOException
	{
		BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
		PrintWriter pw=new PrintWriter(System.out);
		String[] s=br.readLine().trim().split("\\s++");
		int S=Integer.valueOf(s[0]);
		int A=Integer.valueOf(s[1]);
		int B=Integer.valueOf(s[2]);
		if(Math.abs(A-S)<Math.abs(S-B))pw.println("A");
		else pw.println("B");
		pw.close();
	}
	public  static void go (String num, String s, int sum, int i) {
	    if (i>=num.length()) {
	      int t = 0;
	      long rs = 0;
	      StringTokenizer st = new StringTokenizer(s,"+");
	      t = st.countTokens();
	      while (st.hasMoreTokens()) {
	        rs+=Long.parseLong((String)st.nextToken());
	      }
	      if (rs == sum) minPlus = Math.min(minPlus,t);
	    } else {
	      if (i == 0) go (num,""+num.charAt(i), sum, i+1);
	      else {
	        go (num,s+"+"+num.charAt(i),sum,i+1);
	        go (num,s+num.charAt(i),sum,i+1);
	      }
	 
	    }
	        
	 
	  }
	public static int pa(int n)
	{     int a=0;
	      int b=0;
		
		if(n<=0)return 1;
		System.out.println("kumar");
		 a+=pa(n-1);
		 System.out.println("prabhat");  
		 b+=pa(n-1);
		//System.out.println( callme("vikrant"));
	   
		return a+b;
	}
	public static  String callme(String s)
	{
		return s;
	}
	public static boolean palin(String s)
	{
		int i=0;
		int j=s.length()-1;
		while(i!=j)
		{
			if(s.charAt(i)!=s.charAt(j))return false;
			i++;
			j--;
		}
	   return true;	
	}
	

}


Measured memory_bytes: 21332
import java.util.*;

class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int k = sc.nextInt();
        int x = sc.nextInt();
        sc.close();

        if (500 * k >= x) {
          System.out.println("Yes");
        } else {
          System.out.println("No");
        }
    }
}

Measured memory_bytes: 21844
#include <algorithm>
#include <bitset>
#include <cctype>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
using namespace std;

void dijkstra(vector<vector<pair<int, int>>>& edges, vector<int>& ds, int start) {
    priority_queue<pair<int, int>, vector<pair<int, int>>, greater<pair<int, int>>> q;
    q.push(make_pair(0, start));
    while (!q.empty()) {
        int d = q.top().first;
        int u = q.top().second;
        q.pop();
        if (ds[u] >= 0) {
            continue;
        }
        ds[u] = d;
        for (auto p : edges[u]) {
            q.push(make_pair(d + p.second, p.first));
        }
    }
}

int main() {
    int n;
    cin >> n;
    vector<vector<pair<int, int>>> edges(n);
    for (int i = 0; i < n; i++) {
        int u, k;
        cin >> u >> k;
        for (int j = 0; j < k; j++) {
            int v, c;
            cin >> v >> c;
            edges[u].push_back(make_pair(v, c));
        }
    }

    vector<int> ds(n, -1);
    dijkstra(edges, ds, 0);

    for (int i = 0; i < n; i++) {
        cout << i << " " << ds[i] << endl;
    }
}

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

# define REP(i,n) for (int i=0;i<(n);++i)
# define rep(i,a,b) for(int i=a;i<(b);++i)
# define p(s) std::cout << s ;
# define pl(s)  std::cout << s << endl;
# define printIf(j,s1,s2) cout << (j ? s1 : s2) << endl;
# define YES(j) cout << (j ? "YES" : "NO") << endl;
# define Yes(j) std::cout << (j ? "Yes" : "No") << endl;
# define yes(j) std::cout << (j ? "yes" : "no") << endl;
# define all(v) v.begin(),v.end()
# define showVector(v) REP(i,v.size()){p(v[i]);p(" ")} pl("")
template<class T> inline bool chmin(T &a, T b){ if(a > b) { a = b; return true;} return false;}
template<class T> inline bool chmax(T &a, T b){ if(a < b) { a = b; return true;} return false;}
typedef long long int ll;
typedef pair<ll,ll> P_ii;
typedef pair<double,double> P_dd;

template<class T>
vector<T> make_vec(size_t a){
    return vector<T>(a);
}

template<class T, class... Ts>
auto make_vec(size_t a, Ts... ts){
  return vector<decltype(make_vec<T>(ts...))>(a, make_vec<T>(ts...));
}

template<typename T,typename V>
typename enable_if<is_class<T>::value==0>::type
fill_v(T &t,const V &v){t=v;}

template<typename T,typename V>
typename enable_if<is_class<T>::value!=0>::type
fill_v(T &t,const V &v){
  for(auto &e:t) fill_v(e,v);
}


const int MOD = 1000000007;
const int inf=1e9+7;
const ll longinf=1LL<<60 ;

void addM(long long &a, long long b) {
    a += b;
    if (a >= MOD) a -= MOD;
}

void mulM(long long &a, long long b) {
    a = ((a%MOD)*(b%MOD))%MOD ;
}

const int MAX = 510000;
long long fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

// 二項係数計算
long long COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

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

long long int gcd(long long int a,long long int b){
    if(a<b){
        long long int tmp=a;
        a=b;
        b=tmp;
    }

    long long int r = a % b;
    while(r!=0){
        a = b;
        b = r;
        r = a % b;
    }
    return b;
}

long long int lcm(long long int a,long long int b){
    long long int g = gcd(a,b);
    return (a/g)*b;
}


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

    vector<int> a(n);
    
    int ma=0;
    int mi=-1;
    REP(i,n) {
        cin >> a[i];
        if(ma < a[i]){
            mi = i;
            ma = a[i];
        }
    }

    int ma2=0;
    REP(i,n) {
        if(i==mi) continue;
        chmax(ma2,a[i]);
    }

    REP(i,n) {
        if(i==mi) {
            pl(ma2);
        } else {
            pl(ma);
        }
    }

    return 0;
}


Measured memory_bytes: 2432
#include <algorithm>
#include <cctype>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iostream>
#include <list>
#include <map>
#include <memory>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <utility>
#include <vector>
using namespace std;

#define EPS 1e-10
#define INF 1000000000
#define mp make_pair
#define pb push_back

typedef vector<int> vi;
typedef vector<vi> vii;
typedef pair<int,int> pii;
typedef long long ll;

int main() {
  string s;
  cin >> s;
  string str = s.substr (0,4);
  if (str == "YAKI") {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
}

Measured memory_bytes: 256
fn read_stdin() -> String {
    use std::io::Read;
    let mut input = String::new();
    std::io::stdin().read_to_string(&mut input).unwrap();
    input
}

fn scan<'a, I: Iterator<Item = &'a str>, T: std::str::FromStr>(tokens: &mut I) -> T {
    tokens.next().unwrap().parse().ok().unwrap()
}

fn main() {
    let input = read_stdin();
    let tokens = &mut input.split_whitespace();
    let s: String = scan(tokens);
    let mut s = s.into_bytes();
    s.sort();
    if s[0] == s[1] && s[1] != s[2] && s[2] == s[3] {
        println!("Yes");
    } else {
        println!("No");
    }
}


Measured memory_bytes: 4352
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
//#define ll long long
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 (a>b) { a=b; return 1; } return 0; }
#define rep(i, n) REP(i, 0, n)
#define ALL(v) v.begin(), v.end()
#define MSG(a) cout << #a << " " << a << endl;
#define REP(i, x, n) for(int i = x; i < n; i++)
#define all(x) (x).begin(),(x).end()
ll tmp1,tmp2,tmp3;
const ll mod = 1000000007;
const int INF = 1e9;
const ll INFLONG = 1e18;
void swap(ll *x,ll *y){
  ll tmp;
  tmp = *x;
  *x = *y;
  *y = tmp;
}
int main(){
  ll n;
  string s;
  cin >> n;
  cin >> s;
  ull len = s.length();
  rep(i,len){
    s[i] += n;
    if(s[i] > 'Z'){
      s[i] -= 26;
    }
  }
  cout << s << endl;
}


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

#define SPEED ios::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define read()          freopen("fibsubseq.in","r",stdin)
#define write()         freopen("fibsubseq.out","w",stdout)
#define sf(n)           scanf("%d",&n)
#define sfd(n)          scanf("%lf",&n)
#define sl(x)           scanf("%I64d",&x)
#define sfl(n)          scanf("%lld", &n)
#define sfc(n)          scanf(" %c",&n)
#define sful(n)         scanf("%llu",&n)
#define ull             unsigned long long int
#define endll           printf("\n")
#define pf              printf
#define pi              acos(-1.0)
#define eps             1e-10
#define mem(a,b)        memset(a,b,sizeof(a))
#define pb              push_back
#define xx              first
#define yy              second
#define pii             pair<int, int>
#define pll             pair<ll, ll>
#define MP make_pair
#define ll              long long
#define uniq(a)      a.erase(unique(a.begin(), a.end()), a.end())

bool Check(unsigned int  N,int pos){return (bool)(N & (1LL<<pos));}
ll  Set(unsigned int N,int pos){    return N=N | (1LL<<pos);}
#define cnd tree[idx]
#define lnd tree[idx<<1]
#define rnd tree[(idx<<1)+1]
#define lndp (idx<<1),(b),((b+e)>>1)
#define rndp ((idx<<1)+1),(((b+e)>>1)+1),(e)
#define inf 1999999999
#define MX 100005
#define mod  1000000007
#define mod1 1000000009
#define var    int ii,i,j,k,z=0,c=0,t,x,y,l,r,mid,m
//int dx[8]={0,0,1,1,-1,-1,1,-1};  //8 direction
//int dy[8]={1,-1,1,-1,1,-1,0,0};

ll n;
ll a[105],dp[100005][2];

ll fn(ll m,ll f)
{
    ll &z=dp[m][f];
    if(z!=-1)return z;
    z=0;
    for(int i=0;i<n;i++)
    {
        if(m-a[i]>=0)
        {
            if(fn(m-a[i],!f)==0)
            {
                z=1;
                return z;
            }
        }
    }
    return z;
}

int main()
{
    ll var;
    sfl(n);sfl(m);
    for(i=0;i<n;i++)sfl(a[i]);
    mem(dp,-1);
    z=fn(m,0);
    if(z==1)
        cout<<"First"<<endl;
    else cout<<"Second"<<endl;
}


Measured memory_bytes: 4992
#include<bits/stdc++.h>
using namespace std;
#define ALL(v) (v).begin(),(v).end()
#define REP(i,p,n) for(int i=p;i<(int)(n);++i)
#define rep(i,n) REP(i,0,n)
#define SZ(x) ((int)(x).size())
#define INF 999999999
typedef long long int Int;
using ll = long long;
using VI = vector<int>;

int main(){
  int n;cin >> n;
  int a[n];
  rep(i,n) cin >> a[i];
  sort(a,a+n);
  int ans = 0;
  rep(i,n-1) ans+=a[i];
  cout << ans+(a[n-1]/2) << endl;

}


Measured memory_bytes: 256
from sys import stdin


if __name__ == "__main__":
    _in = [_.rstrip() for _ in stdin.readlines()]
    N,A,B = list(map(int,_in[0].split(' ')))  # type:list(int)
    # vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
    while True:
        if A+1 != B:
            A += 1
        else:
            TF = 'Borys'
            break
        if B-1 != A:
            B -= 1
        else:
            TF = 'Alice'
            break
    # ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    print(TF)


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

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

	int ret = 0;
	for (int i = 0; i < N - 1; i++) {
		for (int j = i + 1; j < N; j++) {
			ret = max(abs(A[i] - A[j]), ret);
		}
	}
	cout << ret << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h> 
using namespace std;
int main(){
  string s,t;
  cin>>s>>t;
  int count=0;
  for(int i=0;i<s.size();i++){
    if(s.at(i)!=t.at(i)){
      count++;
    }
  }
  cout<<count<<endl;
}

Measured memory_bytes: 3928
// 2009à\ID £UI¬x
#include <iostream>
#include <vector>
#include <queue>
#include <cstring>

using namespace std;

typedef vector< vector<int> > graph;

class Node{
public:
	// p : »ÝÊu
	// v : »ÝÌXs[h
	// prev : OÉ¢½XÔ
	// cost : ±±ÜÅÌ£
	int p, v, prev; double cost;
	Node(int p, int v, int prev, double cost) : p(p), v(v), prev(prev), cost(cost) {}
	// priority_queueÅ¸\[gÉ·éÌªÊ|ÈÌÅCsðtÉè`µÄµÜ¤
	bool operator < (const Node &nd) const { return cost > nd.cost; }
};

int main(){
	int n, m, s, g;
	while(cin >> n >> m){
		if(!(n||m)) break;
		cin >> s >> g;
		graph gp(n);
		// £sñÆC§À¬xsñ(?)
		int dist[30][30];
		int limit[30][30];
		// óÔ(Êu, ¬x, OÌÊu)ª`FbNÏÝ©ð`FbN·éD
		bool visit[30][31][30];
		double len[30][31][30];
		memset(visit, false, sizeof(visit));
		for(int i=0;i<m;i++){
			int x, y, d, c;
			cin >> x >> y >> d >> c;
			gp[x-1].push_back(y-1);
			gp[y-1].push_back(x-1);
			dist[x-1][y-1] = d,  dist[y-1][x-1] = d;
			limit[x-1][y-1] = c, limit[y-1][x-1] = c;
		}
		for(int i=0;i<n;i++)
			for(int j=0;j<=30;j++)
				for(int k=0;k<n;k++) len[i][j][k] = 1e15;
		priority_queue<Node> qu; qu.push(Node(s-1,0,s-1,0.0));
		double ans = -1.0;
		// _CLXg@ÅÅZoH·ðßé
		while(!qu.empty()){
			Node nd = qu.top(); qu.pop();
			int p = nd.p, v = nd.v, prev = nd.prev;
			// `FbNÏÝÌóÔÈçcontinue
			if(visit[p][v][prev]) continue;
			visit[p][v][prev] = true;
			// S[óÔ
			if(p==g-1 && v==1){
				ans = nd.cost;
				break;
			}
			for(int i=0;i<gp[p].size();i++){
				int next = gp[p][i];
				// U^[ÍÖ~
				if(next==prev) continue;
				// ¬xðÆµ½èã°½è
				for(int j=-1;j<=1;j++){
					int nv = v+j;
					if(nv<=0||limit[p][next]<nv) continue;
					if(len[next][nv][p]-1e-8 > nd.cost+(double)dist[p][next]/nv){
						len[next][nv][p] = nd.cost+(double)dist[p][next]/nv;
						qu.push(Node(next,nv,p,len[next][nv][p]));
					}
				}
			}
		}
		if(ans < 0.0) cout << "unreachable" << endl;
		else          printf("%.5f\n", ans);
	}
}

Measured memory_bytes: 1716
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define ld long double
#define ll long long
#define P pair<int,int>
#define fi first
#define se second
#define rep(i,n) for(int i=0;i<n;i++)
#define all(v) v.begin(),v.end()
#define pb push_back
#define eb emplace_back
template<class T>void chmax(T &a,T b){if(a<b)a=b;}
template<class T>void chmin(T &a,T b){if(a>b)a=b;}
constexpr int INF=1000000000000000000;
constexpr int mod=1000000007;
constexpr double eps=1e-8;
const double pi=acos(-1);
int dx[]={0,1,0,-1},dy[]={1,0,-1,0};
int Random(int mi,int ma){
    random_device rnd;
    mt19937 mt(rnd());//32bit
    //[mi,ma]
    uniform_int_distribution<int>engine(mi,ma);
    return engine(mt);
}
int gcd(int a,int b){
    if(b==0)return a;
    return gcd(b,a%b);
}
int lcm(int a,int b){
    return a/gcd(a,b)*b;
}
bool prime(int a){
    if(a==1)return false;
    for(int i=2;i*i<=a;i++){
        if(a%i==0)return false;
    }
    return true;
}
int modpow(int a,int b){
    if(b==0)return 1;
    if(b%2)return modpow(a,b-1)*a%mod;
    int memo=modpow(a,b/2);
    return memo*memo%mod;
}
vector<int>kaijo,invkaijo;
void init_fact(int n){
    kaijo.resize(n+1);
    invkaijo.resize(n+1);
    kaijo[0]=1;
    for(int i=1;i<=n;i++){
        kaijo[i]=kaijo[i-1]*i;
        kaijo[i]%=mod;
    }
    rep(i,n+1)invkaijo[i]=modpow(kaijo[i],mod-2);
}
int comb(int a,int b){
    if(a<b)return 0;
    if(a<0||b<0)return 0;
    return kaijo[a]*invkaijo[a-b]%mod*invkaijo[b]%mod;
}
int inv(int x){
    x=modpow(x,mod-2);
    return x;
}

signed main(){
    cin.tie(0);ios::sync_with_stdio(false);
    int n,a[310],Xor=0;
    cin>>n;
    rep(i,n){
        cin>>a[i];
        if(2<=i)Xor^=a[i];
    }
    int Sum=a[0]+a[1];
    if((Sum-Xor)%2||Sum<Xor){
        puts("-1");
        return 0;
    }
    int k=(Sum-Xor)/2;
    vector<int>v;
    int memo=0;
    rep(i,40){
        if((k>>i)&1){
            if((Xor>>i)&1){
                puts("-1");
                return 0;
            }
            //(1,1)
            memo+=(1ll<<i);
        }
        else{
            if((Xor>>i)&1){
                v.pb(i);
            }
        }
    }
    reverse(all(v));
    for(int i:v){
        if((1ll<<i)+memo<=a[0]){
            memo+=(1ll<<i);
        }
    }
    if(memo==0||memo>a[0])cout<<-1<<endl;
    else cout<<a[0]-memo<<endl;
    return 0;
}

Measured memory_bytes: 3648
#include<stdio.h>
#include<stdlib.h>
#include<stdbool.h>
#include<string.h>
#include<math.h>
#include<ctype.h>

typedef long long ll;

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

ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }

ll asc(const void* a, const void* b) { return *(ll*)a - *(ll*)b; }

ll dsc(const void* a, const void* b) { return *(ll*)b - *(ll*)a; }

int main() {
    ll n,d,x,y;
    scanf("%lld%lld", &n,&d);
    ll ans = 0;
    for (int i = 0; i < n; i++) {
        scanf("%lld%lld", &x, &y);
        if (x * x + y * y <= d * d) ans++;
    }
    printf("%lld",ans);
    return 0;
}

Measured memory_bytes: 2144