akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;

#define range(i, l, r) for (int i = (int)l; i < (int)(r); ++(i))
#define rrange(i, l, r) for (int i = ((int)(r) - 1); i >= (int)l; --(i))

#define whole(f,x,...) ([&](decltype((x)) whole) { return (f)(begin(whole), end(whole), ## __VA_ARGS__); })(x)
#define rwhole(f,x,...) ([&](decltype((x)) whole) { return (f)(rbegin(whole), rend(whole), ## __VA_ARGS__); })(x)

#define debug(x) cerr << "(" << __LINE__ << ")" << #x << ": " << (x) << endl

using int32 = int;
using int64 = long long;

const int mod     = 1e9 + 7;
const int32 inf   = 1001001001;
const int64 infll = 1001001001001001001ll;

const int dx[] = {0, -1, 1, 0, -1, 1, -1, 1}, dy[] = {-1, 0, 0, 1, -1, -1, 1, 1};
const string YES = "YES", NO = "NO", Yes = "Yes", No = "No", yes = "yes", no = "no";

struct IoSetup { IoSetup(){ cin.tie(0); ios::sync_with_stdio(0); cout << fixed << setprecision(16); cerr << fixed << setprecision(16); } } iosetup;

template <typename T = int64> T input() { T x; cin >> x; return x; }

template <typename T> ostream &operator<<(ostream &os, vector<T> &v) { range(i, 0, v.size()) { os << v[i] << (i + 1 != v.size() ? " " : ""); } return os; } 
template <typename T> istream &operator>>(istream &is, vector<T> &v) { for (T &in : v) is >> in; return is; }
template <typename T1, typename T2> ostream &operator<<(ostream &os, pair<T1, T2> p) { os << p.fs << " " << p.sc; return os; }
template <typename T1, typename T2> istream &operator>>(istream &is, pair<T1, T2> &p) { is >> p.fs >> p.sc; return is; }

template <typename T> vector<T> make_v(size_t a, T b) { return vector<T>(a, b); }
template <typename... Ts> auto make_v(size_t a, Ts... ts) { return vector<decltype(make_v(ts...))>(a, make_v(ts...)); }

template <typename T1, typename T2> inline bool chmax(T1 &a, T2 b) { return a < b && (a = b, true); }
template <typename T1, typename T2> inline bool chmin(T1 &a, T2 b) { return a > b && (a = b, true); }

void solver() {
  int A = input(), B = input();

  if (A <= 5) cout << 0 << endl;
  else if (A <= 12) cout << B / 2 << endl;
  else cout << B << endl;
}

signed main(int argc, char *argv[]) {
  solver();
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cmath>
#include<cctype>
#include<math.h>
#include<string>
#include<string.h>
#include<stack>
#include<queue>
#include<vector>
#include<utility>
#include<set>
#include<map>
#include<stdlib.h>
#include<iomanip>

using namespace std;

#define ll long long
#define ld long double
#define EPS 0.000001
#define INF 1e7
#define MOD 1000000007
#define rep(i,n) for(int i=0;i<(n);i++)
#define loop(i,a,n) for(i=a;i<(n);i++)
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)

typedef vector<int> vi;
typedef vector<string> vs;
typedef pair<int,int> pii;
typedef vector<double> vd;

struct data{
    int to, cost, limit;
};

struct edge{
    int now, speed, prev;
    double cost;

    bool operator>(const edge &e) const {
      return cost + EPS > e.cost;
    }

};



int main(void) {

    int n, m;
    while(cin >> n >> m, n){
        int s,g;
        cin >> s >> g;
        s--,g--;

        vector<vector<data> > v(n);

        rep(i,m){
            int a,b;
            struct data d;
            cin >> a >> b >> d.cost >> d.limit;
            a--,b--;
            d.to = b;
            v[a].push_back(d);
            d.to = a;
            v[b].push_back(d);
        }

        double dist[35][35][35];

        rep(i,35)rep(j,35)rep(k,35){
            dist[i][j][k] = INF;
        }

        priority_queue< edge, vector<edge>, greater<edge> > q;

        struct edge e;
        e.now = s;
        e.speed = 0;
        e.cost = 0;
        e.prev = s;

        q.push(e);
        dist[e.now][e.speed][e.prev] = e.cost;

        while(q.size()){
            struct edge e = q.top();
            q.pop();

            //cout << "! " << e.now << " " << e.speed << " "<< e.cost << endl;
            if(dist[e.now][e.speed][e.prev] + EPS < e.cost)continue;

            for(int i = 0; i < v[e.now].size(); i++){
                struct edge next;
                next.now = v[e.now][i].to;
                double d = v[e.now][i].cost;
                next.prev = e.now;

                if(next.now == e.prev)continue;

                for(int j = -1; j <= 1; j++){
                    next.speed = e.speed + j;
                    if(next.speed > v[e.now][i].limit || next.speed <= 0)continue;
                    next.cost = dist[e.now][e.speed][e.prev] + d / next.speed;

                    if(dist[next.now][next.speed][next.prev] - EPS > next.cost){
                        dist[next.now][next.speed][next.prev] = next.cost;
                        q.push(next);
                    }

                }
            }
        }

        double ans = INF;
        rep(i,35)ans = min(ans, dist[g][1][i]);

        if(ans + EPS > INF){
            cout << "unreachable" << endl;
        }else{
            cout << shosu(10) << ans << endl;
        }

    }
}




Measured memory_bytes: 3984
import Control.Monad
import Data.Maybe
import qualified Data.ByteString.Char8 as BS
import Data.List
import qualified Data.Vector.Unboxed as VU
import qualified Data.Vector.Unboxed.Mutable as VUM

readInt = fst . fromJust . BS.readInt
readIntList = map readInt . BS.words
getInt = readInt <$> BS.getLine
getIntList = readIntList <$> BS.getLine

main = do
    [n,maxW] <- getIntList
    items <- replicateM n $ do
        [w,v] <- getIntList
        return (w,v)
    let mV = sum $ map snd items
    print . pred $  VU.length . VU.filter (<= maxW) . VU.scanr1 min $ solve mV items

solve mV [] = VU.create $ do
    vec <- VUM.replicate (mV+1) 1000000000
    VUM.write vec 0 0
    return vec
solve mV ((w,v):xs) 
  = let a = solve mV xs 
    in VU.generate (mV+1)
      $ \i -> if v <= i then
                  min (a VU.! i) (a VU.! (i-v) + w)
              else a VU.! i

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

int main(){
long long a,b,c,k;
  cin>>a>>b>>c>>k;
  if(k<=a){
cout<<k<<endl;
  }
  else if(k<=a+b){
cout<<a<<endl;
  }
else{
cout<<2*a+b-k<<endl;
}
}

Measured memory_bytes: 3620
N=gets.to_i
vs=gets.split.map(&:to_i)
cs=gets.split.map(&:to_i)
p (0...N).to_a.map{|i|vs[i]-cs[i]}.select{|e|e>=0}.inject(&:+).nil? ? 0 : (0...N).to_a.map{|i|vs[i]-cs[i]}.select{|e|e>=0}.inject(&:+)


Measured memory_bytes: 1788
#include <bits/stdc++.h>
//#include <boost/multiprecision/cpp_int.hpp> 
//using boost::multiprecision::cpp_int;
using namespace std;
#define ll long long int
#define F first
#define S second
//#define endl "\n"
//#define nl cout<<endl;
#define pb push_back
#define ull unsigned long long 
#define f(i,a,b) for(ll i=a;i<b;i++)
#define Knucklehead ios_base::sync_with_stdio(false);cin.tie(NULL);
//#define mod 100000007
#define mat vector<vector<ll>>
mat cn(ll n, ll m){return vector< vector<ll> >(n, vector<ll>(m));}
bool compare(char &s1,char &s2){return s1 > s2;} 
bool sortmahstyle(const pair<ll,ll> &a,  const pair<ll,ll> &b) 
{ 
    if(a.first < b.first )
        return true;
    if( a.first==b.first && a.S != b.second )
       return true;
    return false;
}
bool cmp(int n, pair<int, int> const& p)
{
    return (p.first < n);
}
//me
ll const mod = 1e9+7;//998244353;
ll const inf = 1e18;
ll const maxn = 2e5+1;

int stoint(string s)
{
     int n = s.size();
     int num = 0;
     f(i,0,n){
          num = num*10+ (int)(s[i]-'0');

     }
     return num;
}

ll fastpow(ll a, ll b)
{
     ll res = 1;
     while(b){
          if(b&1) res *= a;
          a*=a;
          b/=2;
     }
     return res;
}

void solve()
{      

     ll n,m; cin >> n >> m;

     ll cnt[n],red[n];
     fill(cnt, cnt+n,1);
     fill(red, red+n, 0);
     red[0]=1;

     f(i,0,m){
          ll x,y; cin >> x >> y;
          x--,y--;
          if(red[x] && cnt[x])
               red[y]=1;

          if(cnt[x])
               cnt[x]--, cnt[y]++;
          if(cnt[x]==0)
               red[x]=0;
     }
     ll ans = 0;
     f(i,0,n)
          ans+=red[i];
     cout << ans << endl;
}    

int main() {
Knucklehead 
//*
#ifndef ONLINE_JUDGE
freopen("input.txt", "r", stdin);
freopen("output.txt", "w", stdout);
#endif
/**/ 
          
          ll t;
          /**/t=1;
          /*/cin>>t;/**/
          f(testcases,0,t){
               //cout << "Case #" <<testcases+1<<": ";
               solve();
          }
 
 
    return 0;
}

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

//pairの比較関数を定義
bool compare(pair<ll, ll> a, pair<ll, ll> b) {
	if(a.second != b.second){
		return a.second < b.second;
	}else{
		// どちらも同じ
		return true;
	}
}

int main(){
	ll N;
	cin >> N;
	vector<pair<ll,ll>> work(N);
	rep(i,N){
		cin >> work[i].second >> work[i].first;
	}
	
	sort(work.begin(), work.end());
	
	
	ll time = 0;
	
	bool ok = true;
	
	rep(i,N){
		time += work[i].second;
		if (time > work[i].first){
			ok = false;
			break;
		}
	}
	
	if(ok){
		cout << "Yes" << endl;
	}else{
		cout << "No" << endl;
	}
}



Measured memory_bytes: 3328
#include <iostream>
#include <algorithm>
#include <string>
#include <math.h>
#include <bitset>
#include <vector>
#include <queue>
#include <map>
#include <set>

#define i64 int64_t
#define ff(ii,nn,mm) for(int ii=nn;ii<mm;ii++)
#define ffrvs(ii,nn,mm) for(int ii=nn;ii>=mm;ii--)
#define srt(vvv) sort(vvv.begin(),vvv.end())
#define srtrvs(vvv) reverse(vvv.begin(),vvv.end())
#define Graph vector<vector<int>>
int inf = 1000000007;
i64 giant = 4000000000000000037;

using namespace std;

//メモリ置き場
int n;
Graph G;

//inputします
void input() {
    cin >> n;
}

//ライブラリ置き場

vector<pair<int, int>> dat;
//グラフ生成
void build_G(Graph& GG33, int nn33, int mm33) {//GG:グラフ nn:頂点数 mm:辺の数
    GG33.resize(nn33+1);
    dat.resize(mm33);
    ff(ii33, 0, mm33) {
        int aa33, bb33;
        cin >> aa33 >> bb33;
        GG33[aa33].push_back(bb33);
        GG33[bb33].push_back(aa33);
        dat[ii33].first = aa33;
        dat[ii33].second = bb33;
    }
}

vector<int> dist36;
queue<int> que36;
map<pair<int, int>, int> ptoi;//
vector<int> upc36;
void bfs(Graph GG36, int nn36, int ss36) {
    dist36.assign(nn36+1, -1);
    upc36.assign(nn36 + 1, -1);
    dist36[ss36] = 0;
    que36.push(ss36);
    while (!que36.empty()) {
        int vv36 = que36.front();
        que36.pop();
        //到着した場所で行う操作をこの下に書く
        int aa36 = 1;
        if (aa36 == upc36[vv36])aa36++;
        for (auto nvv36 : GG36[vv36]) {
            if (!ptoi.count({ vv36, nvv36 })) {
                ptoi[{vv36, nvv36}] = aa36;
                ptoi[{nvv36, vv36}] = aa36;
                upc36[nvv36] = aa36;
                aa36++;
                if (aa36 == upc36[vv36])aa36++;
            }
            if (dist36[nvv36] == -1) {
                dist36[nvv36] = dist36[vv36] + 1;
                que36.push(nvv36);
            }
        }
    }
}

//main
int main() {
    input();
    build_G(G, n, n - 1);
    bfs(G, n, 1);
    int ans = 0;
    ff(i, 1, n+1) {
        int a = G[i].size();
        ans = max(ans,a);
    }
    cout << ans << endl;
    ff(i, 0, dat.size()) {
        cout << ptoi[dat[i]] << endl;
    }
	return 0; 
}


Measured memory_bytes: 25344
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 173_B
		Scanner sc = new Scanner(System.in);

		int c0=0,c1=0,c2=0,c3 = 0;
		int caseNo = sc.nextInt();

		for (int i=0; i<=caseNo; i++) {
			switch (sc.nextLine()) {
			case "AC":
				c0 += 1;
				break;
			case "WA":
				c1 += 1;
				break;
			case "TLE":
				c2 += 1;
				break;
			case "RE":
				c3 += 1;
				break;
			}
		}

		System.out.println("AC x " + c0);
		System.out.println("WA x " + c1);
		System.out.println("TLE x " + c2);
		System.out.println("RE x " + c3);

		// Scannerクラスのインスタンスをクローズ
		sc.close();
	}

}


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

int main(){
    int a,b,c; cin >> a >> b >> c;

    int count = 0;
    int tmp_a,tmp_b,tmp_c;
    while(a%2==0 && b%2==0 && c%2==0){
        tmp_a = b/2 + c/2;
        tmp_b = a/2 + c/2;
        tmp_c = a/2 + b/2;
        a = tmp_a;
        b = tmp_b;
        c = tmp_c;
        count++;
        //printf("a:%d b:%d  c:%d\n",a,b,c);

        if(a == b && b == c && a==c){
            count = -1;
            break;
        }
    }

    cout << count << endl;

}

Measured memory_bytes: 3632
//author:satwik_bhv1
#include<bits/stdc++.h>
//datatypes
#define ll long long 
#define ld long double
//loops
#define fr(i,z,n) for(ll i=z;i<n;i++)
#define br(i,z,n) for(ll i=z;i>n;i--)
//operations
#define mp  make_pair
#define ff  first
#define ss  second
#define pub push_back
#define all(v) v.begin(),v.end()
//map
#define mi map<ll,ll>
//vectors
#define vi vector<ll>
#define vpi vector<pair<ll,ll> >
//constants
#define pi 3.1415926535897932384626
#define mod 1000000007 
#define MAXN 100001
/*notes
    Don't use inbuilt fun for power
    Range of longlong=(-9,223,372,036,854,775,808 to 9,223,372,036,854,775,807 )
    INT_MAX = 2147483647(aprox 2*10^10)
    INT_MIN = -2147483648
    LLONG_MAX = 9223372036854775807 
    LLONG_MIN = -9223372036854775808
    __gcd is the function in built for hcf
    priority queue is max heap by default
    topological sort -> khan's algo use bfs and indegree of node  
    sssp(positive weighted edges) -> Dijkstras
    apsp -> Floydwarshall
    MST -> kruskal(DSU)
*/
using namespace std;
//functions
ll power(ll x,ll y){ll res=1;while(y){if(y%2){res*=x;}y/=2;x*=x;} return res;}
ll power(ll x,ll y,ll z){ll res=1;while(y){if(y%2){res=(res*x)%z;}y/=2;x=(x*x)%z;} return res;}
void fast() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); }
bool sortbysec(const pair<ll, ll>& a, const pair<ll, ll>& b) { return (a.second > b.second); }
ll ceil(ll x,ll y){return (x/y)+(x%y!=0);}
ll n,w;
vpi v;
ll sum;
ll ans;
vi dp(100005,-1);
void fun()
{
    for(ll pos=0;pos<n;pos++)
    {
        ll val=v[pos].ss;
        ll wt=v[pos].ff;
        for(ll i=sum;i>=val;i--)
        {
            if(dp[i-val]!=-1&&(dp[i]==-1||dp[i-val]+wt<dp[i])&&dp[i-val]+wt<=w)
            {
                dp[i]=dp[i-val]+wt;
                ans=max(ans,i);
            }
        }
    }
}
void solve()
{
    cin>>n>>w;
    fr(i,0,n)
    {
        ll a,b;
        cin>>a>>b;
        v.pub({a,b});
        sum+=b;
    }
    ans=0;
    dp[0]=0;
    fun();
    cout<<ans;
}
int main()
{
    fast();
    ll t;
    t=1;
    //cin>>t;
    fr(i,0,t)
    {
        solve();
    }
}
/*





























*/

Measured memory_bytes: 3876
#include <bits/stdc++.h>
#include <math.h>
#include <cmath>

using namespace std;
using ll =long long;
using vi = vector<int>; 
using vvi = vector<vi>; 
using vl = vector<ll>; 
using vvl = vector<vl>; 
using vs = vector<string>;
using vvs = vector<vs>; 
using vc = vector<char>;
using vvc = vector<vc>; 
using vb = vector<bool>;
using vvb = vector<vb>; 

#define rep(i,n) ;for( int i =0; i < n ; i ++)
#define all(a) a.begin(),a.end()
#define pb(a) push_back(a)
#define pd(a) printf("%.10f\n",a)
#define mem(a) memset(a,0,sizeof(a))
#define f(i,a,b) for(int i=a;i<b;i++)
#define pri(a)  printf("%.14lf\n",a);
#define sz(a) ((int)a.size())
#define MOD 1000000007
bool is_int_lround(double x){
  return std::lround(x)==x;
}
ll keta(ll x){
  ll n=0;
  while(x>0){
    x /=10 ;
    n ++;
  }
  return n;
}

ll conbi(int n,int m){
  
  cin>>n>>m;
  vector<ll> a(100);
  a[0] =1;
  for(int i=0;i<14;i++){
    a[i+1]=a[i]*(i+1);
  }
  return a[n] /(a[m] *a[n-m]);
}

long long modpow(long long a, long long n, long long mod) {
    long long res = 1;//繰り返し二乗法
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}
ll kaijoMOD(ll x){
  ll z=1;
  if(x==0){
    return 1;
  }
  while(x>0){
    z *=x;
    z %=MOD;
    x--;
  }
  return z;
}
ll div_num(ll n){
  vl div(n+1,1);
  for(ll i=2;i*i<=n;i++){ 
    while(n%i==0){
      n /=i;
      div[i]++;
    }
  }
  if(n!=1)div[n]++;
  ll num=1;
  for(ll i=0;i<=n;i++){
    num*=div[i];
  }
  return num;
}
vector<ll> divisor(ll n) {
  vector<ll> ret;
  for(ll i = 1; i * i <= n; i++) {
    if(n % i == 0) {
      ret.push_back(i);
      if(i * i != n) ret.push_back(n / i);
    }
  }
  sort(begin(ret), end(ret));
  return (ret);
}

int keta_wa(int x){
  int tot=0;
  while(x>0){
    tot +=x%10;
    x/=10;
  }
  return tot;
}
long long lopow(ll a, long long n) {
    long long res = 1;
    while (n > 0) {
        if (n & 1) res = res * a ;
        a = a * a ;
        n >>= 1;
    }
    return res;
}


//vc alp ={'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'};
//vc Alp ={'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z'};
//cout<<""<<endl;
int N;
vb arr(100002);
void Eratosthenes(){
	for(int i = 0; i <= N; i++){
		arr[i] = true;
	}
	for(int i = 2; i <= sqrt(N); i++){
                 arr[0]=false;arr[1]=false;
		if(arr[i]){
			for(int j = 0; i * (j + 2) <= N; j++){
				arr[i *(j + 2)] = false;
			}
		}
	}
}
int main(){
  N=100001;
  int Q;cin>>Q;
  vi l(Q),r(Q);rep(i,Q)cin>>l[i]>>r[i];
  Eratosthenes();
  vi ans(100001);
  for(int i=1;i <=100000;i++){ 
    if(arr[i]){
      if((i+1)%2==0&&arr[(i+1)/2]){
        ans[i]++;
      }
    }
  }
  vi ru(100001);
  for(int i=1;i<100001;i++){
    ru[i]=ru[i-1]+ans[i];
  }
  rep(i,Q){
    cout<<ru[r[i]]-ru[l[i]-1]<<endl;
  }
    
  
}






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

using namespace std;

int main() {
	int N;
	cin >> N;
	vector<int> H(N);
	for (int i = 0; i < N; i++) cin >> H[i];
	int ans = 0, move = 0;
	for (int i = 0; i < N - 1; i++) {
		if (H[i] >= H[i + 1]) move++;
		else {
			ans = max(ans, move);
			move = 0;
		}
	}
	if (move != 0) ans = max(ans, move);
	cout << ans << endl;
	return 0;
}

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

int main() {
    int a, b, c, x, y;
    cin >> a >> b >> c >> x >> y;
    
    int ans = 0;
    int mn = min(x, y);
    if(2*c < a) a = 2*c;
    if(2*c < b) b = 2*c;
    if(2*c < a + b) {
        ans += mn * 2*c;
    } else {
        ans += mn * (a + b);
    }
    
    cout << ans + (x - mn) * a + (y - mn) * b << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h> 
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define size_of_array(array) (sizeof(array)/sizeof(array[0]))
#define MAX 100005
#define DEBUG 0 
#define LIMIT (LONG_MAX / 10)
#define POSITIVE_LAST_D (LONG_MAX % 10)
using ll =long long;
using namespace std;
using Graph=vector<vector<int>>;

int main(){
    ll a;
    double b;
    cin>>a>>b;
    ll c=(b+0.001)*100;
    cout<<a*c/100<<endl;
}
    

Measured memory_bytes: 3736
#include <algorithm>
#include <bitset>
#include <cmath>
#include <functional>
#include <iomanip>
#include <iostream>
#include <limits>
#include <map>
#include <queue>
#include <set>
#include <tuple>
#include <vector>

using namespace std;

#define rep(i, n) for (int64_t i = 0; i < (n); i++)
#define irep(i, n) for (int64_t i = 0; i <= (n); i++)
#define rrep(i, n) for (int64_t i = (n)-1; i >= 0; i--)
#define rirep(i, n) for (int64_t i = n; i >= 0; i--)

template <typename F>
void forComb(unsigned int n, unsigned int k, F f) {
  if (k == 0) {
    f(0);
    return;
  }
  int comb = (1 << k) - 1;
  while (comb < (1 << n)) {
    f(comb);

    int x = comb & -comb;
    int y = comb + x;
    comb = ((comb & ~y) / x >> 1) | y;
  }
}

using P = pair<int, int>;
vector<vector<int>> incidence;
vector<P> edge;

bool find_path(vector<int> &path, int u, int v, vector<bool> &is_visited) {
  is_visited[u] = true;
  if (u == v) {
    return true;
  }

  for (auto e : incidence[u]) {
    int a, b;
    tie(a, b) = edge[e];
    int w = (a == u ? b : a);
    if (!is_visited[w]) {
      path.push_back(e);
      if (find_path(path, w, v, is_visited)) {
        return true;
      }
      path.pop_back();
    }
  }
  return false;
}

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

  incidence.resize(N);
  rep(i, N - 1) {
    int u, v;
    cin >> u >> v;
    u--;
    v--;

    edge.push_back(P(u, v));
    incidence[u].push_back(i);
    incidence[v].push_back(i);
  }

  int M;
  cin >> M;
  vector<vector<int>> path(M);
  rep(i, M) {
    int u, v;
    cin >> u >> v;
    u--;
    v--;

    vector<bool> is_visited(N, false);
    find_path(path[i], u, v, is_visited);
  }

  vector<vector<bool>> is_white(1 << M, vector<bool>(N - 1, false));
  rep(i, M) {
    forComb(M, i + 1, [&](int comb) {
      int lsb = comb & -comb;
      copy(is_white[comb ^ lsb].begin(), is_white[comb ^ lsb].end(),
           is_white[comb].begin());
      int j = bitset<20>(lsb - 1).count();
      for (int e : path[j]) {
        is_white[comb][e] = true;
      }
    });
  }

  vector<int64_t> s(1 << M);
  rep(sub, 1 << M) {
    int cnt = count(is_white[sub].begin(), is_white[sub].end(), false);
    s[sub] = ((int64_t)1 << cnt);
  }

  int64_t result = 0;
  irep(i, M) {
    forComb(M, i, [&](int comb) { result += pow(-1, i) * s[comb]; });
  }

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

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

x, n = map(int, input().split())
num_list = list(map(int, input().split()))

flag = True
i = 0

while flag:
  if x - i not in num_list:
    ans = x - i
    break
  elif x + i not in num_list:
    ans = x + i
    break
  i += 1

print(ans)

Measured memory_bytes: 9180
#include <iostream>
#include <string>
#include <map>
#include <deque>
#include <vector>
typedef unsigned int UINT;
using namespace std;

int main(void) {
    map<int, int> list;
    {
        list[1] = 1;
        list[3] = 1;
        list[5] = 1;
        list[7] = 1;
        list[8] = 1;
        list[10] = 1;
        list[12] = 1;

        list[4] = 2;
        list[6] = 2;
        list[9] = 2;
        list[11] = 2;

        list[2] = 3;
    }

    int x, y;
    cin >> x >> y;
    if (list[x] == list[y])
        cout << "Yes" << endl;
    else
        cout << "No" << endl;

    return 0;
}

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

using namespace std;

int main() {
	string s;
	cin >> s;
	int t = s.size();
	int x = 0, y = 0;

	for (int i = 0; i < t; i++) {
		x++;
		if (s[i] == 'A')break;
	}
	for (int j = t; j > 0; j--) {
		y++;
		if (s[j] == 'Z')break;
	}
	y = t - y + 1;

	cout << y - (x - 1)+1 << endl;
	
	return 0;
}

Measured memory_bytes: 640
/* Author : Aaryan Srivastava ^__^ */ 
#include <bits/stdc++.h>
#include <random>
#include <chrono>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp> 
#define pb push_back
#define popb pop_back
#define mt make_tuple 
#define eb emplace_back
#define mp make_pair
#define ff first
#define ss second 
#define ull unsigned long long  
#define pii pair<int, int>
#define piii pair<int,pii>
#define beg begin
#define rep(i,n) for(int (i) = 0 ; i < (n) ; i++)
#define repA(i,x,y) for(int i = (x) ; i <= (y) ; i++)
#define repD(i,x,y) for(int i = (x) ; i >= (y) ; i--)
#define all(c) (c).begin(),(c).end()
#define fill(a,val) memset(a,val,sizeof(a))
#define Randomize mt19937 rng(chrono::steady_clock::now().time_since_epoch().count())
#define int ll
using ll = long long;
const int N = 3*1e5 +5 ;
const int mod = 1e9 + 7 ;
const int inf = 1e18 ;
const int SZ = 101 ;
const double eps = 1e-9 ;
using namespace __gnu_pbds;
using namespace std;
using ordered_set =  tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> ;

#ifdef AaryanS
#define mycout cout
#define mycerr cerr 
#endif

#ifndef AaryanS
#define mycout if(false) cout
#define mycerr if(false) cerr
#endif


void solve()
{
	int m,k ;
	cin >> m >> k ;
	int n = (1ll << m) ;
	if(k >= n || (k && m == 1)){
		cout << -1 ;
		return ;
	}
	if(m == 1){
		cout << "0 0 1 1\n" ;
		return ;
	}
	cout << k << " " ;
	rep(i,n){
		if(i == k) continue ;
		cout << i << " " ; 
	}
	cout << k << " " ;
	repD(i,n-1,0){
		if(i == k) continue ;
		cout << i << " " ;
	}
}   

     
int32_t main(int32_t argc, char *argv[])
{
    double t1 = clock() ;
    ios::sync_with_stdio(0);    
    cin.tie(0); cout.tie(0);
    int TC = 1, t = 0;
    //cin >> TC ;
    while(t++ < TC)
    {
        //cout << "Case #" << t << ": " ;
        solve();
        //cout << endl ;
    }
    mycerr << "Time : " << 1000 *(clock() - t1)/CLOCKS_PER_SEC << " ms\n" ;
    return 0;
}

Measured memory_bytes: 1792
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxn = 1e6 + 6;
const ll mod = 1e9 + 7;
ll dp[maxn][2][2];
int n;
int main () {
    scanf("%d", &n);
    dp[0][0][0] = 1;
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < 2; j++) {
            for (int k = 0; k < 2; k++) {
                for (int t = 0; t < 10; t++) {
                    (dp[i + 1][j || (t == 0)][k || (t == 9)] += dp[i][j][k]) %= mod;
                }
            }
        }
    }
    printf("%lld\n", dp[n][1][1]);

    return 0;
}


Measured memory_bytes: 34940
#include <bits/stdc++.h>
using namespace std;
 
int gcd(int x,int y){
    if(y==0)return x;

    return gcd(y,x%y);
}
int lcm(int x,int y){
    return x*y/gcd(x,y);
}

int ctoi(char c) {
	if (c >= '0' && c <= '9') {
		return c - '0';
	}
	return 0;
}

int main(){

    char ans='=';
    string A,B;
    cin>>A>>B;

    if(A.length()>B.length()){
        ans='>';
    }else if(A.length()<B.length()){
        ans='<';
    }else{
        for(int i=0;i<A.length();i++){
            if(ctoi(A[i])>ctoi(B[i])){
                ans='>';
                break;
            }else if(ctoi(A[i])<ctoi(B[i])){
                ans='<';
                break;
            }
        }
    }

    if(ans=='>'){
        cout<< "GREATER"<<endl;
    }else if(ans=='<'){
        cout<<"LESS"<<endl;
    }else{
        cout<<"EQUAL"<<endl;
    }


    return 0;
}

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

using namespace std;
using ll = long long;

template <class T> using V = vector<T>;
template <class T> using VV = V<V<T>>;

#define DEBUG(x) cerr<<#x<<": "<<x<<endl;
#define DEBUG_V(v) cerr<<#v<<":";for(int i=0;i<v.size();i++) cerr<<" "<<v[i]; cerr<<endl;
#define DEBUG_M(v) cerr<<#v<<endl;for(int i=0;i<v.size();i++){for(int j=0;j<v[i].size();j++) {cerr<<v[i][j]<<" ";}cerr<<endl;}

int main() {
    int n;
    cin>>n;
    V<ll> b(n-1);
    for (int i = 0; i < n - 1; ++i) {
        cin>>b[i];
    }

    ll sum = b[0]+b[n-2];
    for (int i = 0; i < n - 2; ++i) {
        sum+=min(b[i], b[i+1]);
    }
    cout<<sum<<endl;

    return 0;
}

Measured memory_bytes: 256
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        long a = sc.nextLong();
        long b = sc.nextLong();
        long k = sc.nextLong();
        List<Long> list = new ArrayList<>();

        if (a + k - 1 >= b - k + 1) {
            for (long i = a; i <= b; i++) {
                System.out.println(i);
            }
            return;
        }

        for (long i = a; i < a + k; i++) {
            list.add(i);
        }
        for (long i = b - k + 1; i <= b; i++) {
            list.add(i);
        }
        Collections.sort(list);
        for (long i : list) {
            System.out.println(i);
        }
    }

}


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

int main(){
    int n,m;
    cin >> n >> m;
    if(n&1){
        rp(i,m){
            cout << i+1 << " " << n-i << endl;
        }
        return 0;
    }
    int l=1,r=m+1;
    while(r>l){
        cout << l << " " << r << endl;
        l++; r--;
    }
    r=n; l=n-m+1;
    while(r>l){
        cout << l << " " << r << endl;
        l++; r--;
    }
    return 0;
}

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

#define sc1(a)  scanf("%d",&a)

int main(){
    int n,ans=0;
    sc1(n);
    for (int i=n;i>0;i--) {
        if (i/100000>0) false;
        else if (i/10000>0) ans++;
        else if (i/1000>0) false;
        else if (i/100>0) ans++;
        else if (i/10>0) false;
        else ans++;
    }
    printf("%d\n",ans);
    return 0;
}


Measured memory_bytes: 3784
import math
#import numpy as np
import queue
from collections import deque,defaultdict
import heapq as hpq
from sys import stdin,setrecursionlimit
#from scipy.sparse.csgraph import dijkstra
#from scipy.sparse import csr_matrix
ipt = stdin.readline
setrecursionlimit(10**7)

def main():
    q = int(ipt())

    #√nまでの素数の配列を返す関数
    def primes(n):
        if n < 4:
            return []
        else:
            pri = [2]
            k = 3
            while k*k <= n:
                for i in pri:
                    if k%i == 0:
                        break
                    elif i == pri[-1]:
                        pri.append(k)
                k += 2
            return pri

    p = primes(10**10)
    sm = [0]*100001
    for pi in p[1::]:
        if (pi+1)//2 in p:
            sm[pi] += 1

    for i in range(100000):
        sm[i+1] += sm[i]

    for _ in [0]*q:
        l,r = map(int,ipt().split())
        print(sm[r]-sm[l-1])

    return


if __name__ == '__main__':
    main()


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

int main() {
	while(true){
	int H,W;
	cin >> H >> W;

	
	if(H==0 && W==0){break;}
	
	for(int i=1;i<=H;i++){
		
		for(int j=1;j<=W;j++){
			
			if((i+j)%2==0){cout<<"#";}
			else{cout<<".";}
			
			
		}
		cout<<endl;
		
	}
	
	cout<<endl;
	}
	return 0;
}

Measured memory_bytes: 1152
#include <bits/stdc++.h>
#define N 200010
using namespace std;
typedef long long ll;
inline int read()
{
	int x=0,f=1; char ch=getchar();
	while(ch<'0'||ch>'9'){if(ch=='-')f=-1; ch=getchar();}
	while(ch>='0'&&ch<='9'){x=x*10+ch-'0'; ch=getchar();}
	return x*f;
}
int n,K,L[N],R[N],A[N],sl[N],cnt,Rt,B[N];
int tree[N*20],tot,ls[N*20],rs[N*20];
ll Ans,F[N]; //问题转化后,表示在第i转移之后站在第i个区间的最右端,还需走多少步能使选择合法
inline void deal(int &x,int y)
{
	if(!x) x=++tot; tree[x]=y;
}
inline void pushdown(int x)
{
	if(tree[x])
	{
		deal(ls[x],tree[x]);
		deal(rs[x],tree[x]);
		tree[x]=0;
	}
}
inline int query(int x,int l,int r,int &rt)
{
	if(!rt) rt=++tot;
	if(l==r||tree[rt]) return tree[rt];
	int mid=(l+r)>>1; pushdown(rt);
	if(x>mid) return query(x,mid+1,r,rs[rt]);
	else return query(x,l,mid,ls[rt]); 
}
inline void updata(int L,int R,int x,int l,int r,int &rt)
{
	if(L>R) return ;
	if(!rt) rt=++tot;
	if(L<=l&&r<=R)
	{
		deal(rt,x); return ;
	}
	int mid=(l+r)>>1; pushdown(rt);
	if(R>mid) updata(L,R,x,mid+1,r,rs[rt]);
	if(L<=mid) updata(L,R,x,l,mid,ls[rt]);
}
inline int calc(int l,int r,int x)
{
	if(l<=x&&x<=r) return 0;
	return (l-x+K)%K;
}
inline void solve(int l,int r,int rt)
{
	if(tree[rt])
	{
		Ans=min(Ans,F[tree[rt]]+(tree[rt]>cnt?0: calc(l,r,R[tree[rt]])));
		return ;
	}
	if(!rt||l==r) return ;
	int mid=(l+r)>>1; 
	solve(l,mid,ls[rt]); solve(mid+1,r,rs[rt]);
}
int main()
{
	n=read(); K=read();
	ll all=0; Ans=100000000000000ll;
	for(int i=1;i<=n;i++)
	{
		int x=read(), y=read(); x<<=1;
		all+=x;
		if(y==1)
		{
			if(x>K) {puts("-1"); return 0;}
			++cnt; 
			L[cnt]=all%K; R[cnt]=((all-x)%K+K)%K;
		//	cout << L[cnt] << " " << R[cnt] << endl; 
		}
	}
	deal(Rt,cnt+1);
	for(int i=cnt;i;i--)
	{
		int tx=query(R[i],0,K-1,Rt);
		//cout << tx << endl;
		F[i]=tx>cnt? 0: F[tx]+(R[i]-R[tx]+K)%K;
		if(L[i]<=R[i])
		{
			if(L[i]) updata(0,L[i]-1,i,0,K-1,Rt);
			if(R[i]<K-1) updata(R[i]+1,K-1,i,0,K-1,Rt);
		}
		else updata(R[i]+1,L[i]-1,i,0,K-1,Rt);
		//for(int j=0;j<K;j++) printf("%d ",query(j,0,K-1,Rt)); puts("");
		//cout << F[i] << endl;
	}
	solve(0,K-1,Rt);
	cout << Ans+all << endl;
	return 0;
}

Measured memory_bytes: 38784
#include <iostream>
#include <atcoder/dsu>

using namespace std;
using namespace atcoder;

int main() {
    int n, m; cin >> n >> m;
    dsu d(n);
    for (int i = 0; i < m; ++i) {
        int a, b; cin >> a >> b;
        --a; --b;
        d.merge(a, b);
    }
    auto g = d.groups();
    cout << g.size()-1 << endl;
} 



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

int main() {
  long int a,b;
  int N;
  int y=1;
  cin >> a >> b;

  if(a==0 || b==0) {
    cout << "Zero" << endl;
    return 0;
  }    
  else if(a<0 && b>0) {
    cout << "Zero" << endl;
    return 0;
  }
  else if (a>0) {
    cout << "Positive" << endl;
    return 0;
  }
  else {
    if ((b-a)%2==0) {
      cout << "Negative" << endl;
      return 0;
    }
    else {
      cout << "Positive" << endl;
      return 0;
    }
  }
}



Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#include <algorithm>
#include <vector>
#include <boost/multiprecision/cpp_int.hpp>
namespace boost_int = boost::multiprecision;
using booint = boost_int::cpp_int;
using namespace std;
int main() {
    long long int N, A, B; cin >> N >> A >> B;
    booint ans = (B - A) * (N - 2) + 1;
    if ((N == 1 && A != B) || A > B) cout << 0 << endl;
    else if (N == 1) cout << 1 << endl;
    else cout << ans << endl;
}


Measured memory_bytes: 3612
#define _CRT_SECURE_NO_WARNINGS
#include<cstdio>
#include<cstdlib>
#include<cstring>

struct Node {
	int key;
	Node *next, *prev;
};

Node *nil;

Node* listSearch(int key) {
	Node *cur = nil->next;
	while (cur != nil&&cur->key != key) {
		cur = cur->next;
	}
	return cur;
}

void init() {
	nil = (Node*)malloc(sizeof(Node));
	nil->next = nil;
	nil->prev = nil;
}

void printList() {
	Node *cur = nil->next;
	int isf = 0;
	while (1) {
		if (cur == nil)break;
		if (isf++ > 0)printf(" ");
		printf("%d", cur->key);
		cur = cur->next;
	}
	printf("\n");
}

void deleteNode(Node*t) {
	if (t == nil)return;
	t->prev->next = t->next;
	t->next->prev = t->prev;
	free(t);
}

void deleteFirst() {
	deleteNode(nil->next);
}

void deleteLast() {
	deleteNode(nil->prev);
}

void deleteKey(int key) {
	deleteNode(listSearch(key));
}

void insert(int key) {
	Node *x = (Node*)malloc(sizeof(Node));
	x->key = key;
	x->next = nil->next;
	nil->next->prev = x;
	nil->next = x;
	x->prev = nil;
}

int main() {
	int key, n, i;
	int size = 0;
	char com[20];
	int np = 0, nd = 0;
	scanf("%d", &n);
	init();
	for (i = 0; i < n; i++) {
		scanf("%s",com);
		if (strlen(com) <= 6) {
			scanf("%d", &key);
			if (com[0] == 'i') {
				insert(key); np++; size++;
			}
			else {
				deleteKey(key); nd++; size--;
			}
		}
			else{
				if (com[6] == 'F')deleteFirst();
				else if (com[6] == 'L')deleteLast();
				nd++; size--;
		}
	}
	printList();
	
	return 0;
}

Measured memory_bytes: 33816
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
using namespace std;
using ll = long long;
using vec = vector<ll>;
using vect = vector<double>;
using Graph = vector<vector<ll>>;
#define loop(i, n) for (ll i = 0; i < n; i++)
#define Loop(i, m, n) for (ll i = m; i < n; i++)
#define pool(i, n) for (ll i = n; i >= 0; i--)
#define Pool(i, m, n) for (ll i = n; i >= m; i--)
#define mod 1000000007ll
#define flagcount __builtin_popcount
#define flag(x) (1 << x)
#define flagadd(bit, x) bit |= flag(x)
#define flagpop(bit, x) bit &= ~flag(x)
#define flagon(bit, i) bit &flag(i)
#define flagoff(bit, i) !(bit & (1 << i))
#define all(v) v.begin(), v.end()
#define low2way(v, x) lower_bound(all(v), x)
#define high2way(v, x) upper_bound(all(v), x)
#define idx_lower(v, x) (distance(v.begin(), low2way(v, x)))  //配列vでx未満の要素数を返す
#define idx_upper(v, x) (distance(v.begin(), high2way(v, x))) //配列vでx以下の要素数を返す
#define idx_lower2(v, x) (v.size() - idx_lower(v, x))         //配列vでx以上の要素数を返す
#define idx_upper2(v, x) (v.size() - idx_upper(v, x))         //配列vでxより大きい要素の数を返す
#define putout(a) cout << a << endl
#define Gput(a, b) G[a].push_back(b)
#define Sum(v) accumulate(all(v), 0ll)
#define gcd(x, y) __gcd(x, y)
ll ctoi(char c)
{
    if (c >= '0' && c <= '9')
    {
        return c - '0';
    }
    return 0;
}
template <typename T>
T lcm(T x, T y)
{
    T z = gcd(x, y);
    return x * y / z;
}
template <typename T>
bool primejudge(T n)
{
    if (n < 2)
        return false;
    else if (n == 2)
        return true;
    else if (n % 2 == 0)
        return false;
    double sqrtn = sqrt(n);
    for (T i = 3; i < sqrtn + 1; i++)
    {
        if (n % i == 0)
        {
            return false;
        }
        i++;
    }
    return true;
}
//場合によって使い分ける
//const ll dx[4]={1,0,-1,0};
//const ll dy[4]={0,1,0,-1};
const ll dx[8] = {1, 1, 0, -1, -1, -1, 0, 1};
const ll dy[8] = {0, 1, 1, 1, 0, -1, -1, -1};
//2次元配列の宣言
//vector<vector<ll>> field(h, vector<ll>(w));

int main()
{
    cout << fixed << setprecision(30);
    ll N, C;
    cin >> N >> C;
    vec x(N), v(N);
    loop(i, N) cin >> x[i] >> v[i];
    vec right(N + 1), left(N + 1); //right[i+1]:右からi番目の寿司までを取りに行く時の最善の値(right[0]=0)
    ll rnow = 0, lnow = 0;
    loop(i, N)
    {
        rnow += v[i];
        right[i + 1] = max(rnow - 2 * x[i], right[i]);
    }
    loop(i, N)
    {
        lnow += v[N - 1 - i];
        left[i + 1] = max(lnow - 2 * (C - x[N - 1 - i]), left[i]);
    }
    ll ans = 0;
    ll now = 0;
    loop(i, N)
    {
        now += v[N - 1 - i];
        ans = max(now - (C - x[N - 1 - i]) + right[N - i - 1], ans);
    }
    now = 0;
    loop(i, N)
    {
        now += v[i];
        ans = max(now - x[i] + left[N - 1 - i], ans);
    }
    putout(ans);
    return 0;
}


Measured memory_bytes: 3328
N = input()

if int(N[-1]) == 2 or  int(N[-1]) == 4 or  int(N[-1]) == 5 or int(N[-1]) == 7 or int(N[-1]) == 9:
    print('hon')
elif int(N[-1]) == 0 or  int(N[-1]) == 1 or int(N[-1]) == 6 or  int(N[-1]) == 8:
    print('pon')
else:
    print('bon')

Measured memory_bytes: 9196
def main():
    n = int(input())
    a = sorted([int(input()) for _ in range(n)])

    mid = n//2
    aa = sum(a[:mid])
    if n%2 == 0:
        ad = sum(a[mid:])
        print(2*(ad-aa)-(a[mid]-a[mid-1]))
        return 0
    ad = sum(a[mid+1:])
    tmp = min(a[mid+1]-a[mid],a[mid]-a[mid-1])
    print(2*(ad-aa)-tmp)

if __name__ == '__main__':
    main()


Measured memory_bytes: 51416
#include <bits/stdc++.h>
        using namespace std;
   #define int long long
const int MAX = 510000;
const int MOD = 1000000007;
std::vector<int> Eratosthenes( int N )
{
    std::vector<bool> is_prime( N + 1 );
    for( int i = 0; i <= N; i++ )
    {
        is_prime[ i ] = true;
    }
    std::vector<int> P;
    for( int i = 2; i <= N; i++ )
    {
        if( is_prime[ i ] )
        {
            for( int j = 2 * i; j <= N; j += i )
            {
                is_prime[ j ] = false;
            }
            P.emplace_back( i );
        }
    }
    return P;
}

     signed main(){
          cout << std::fixed << std::setprecision(15);
int n,ans=0,ans2;
cin>>n;
vector<int> v=Eratosthenes(sqrt(n+1));

for(auto&& i :v){
    int  j=i;
     while(n%j==0){n/=j;ans++;j*=i;}
while(n%i==0)n/=i;
}

if(n==1)cout<<ans<<endl;
else cout<<ans+1<<endl;


 }

 


 






    





      

        


Measured memory_bytes: 4444
#pragma region
#include <bits/stdc++.h>
using namespace std;
inline void ci(void){
  return;
}
template <typename First, typename... Rest>
void ci(First& first, Rest&... rest){
  cin >> first;
  ci(rest...);
  return;
}
inline void co(void){
  cout << "\n";
  return;
}
template <typename First, typename... Rest>
void co(First first, Rest... rest){
  cout << first << endl;
  co(rest...);
  return;
}
#define ll long long
#define ld long double
#define st string
#define dl double
#define wh while
#define ve(i) vector<i>
#define repi(i, m, n) for(int i=(int)(m);i<(int)(n);i++)
#define rep(i, n) repi(i, 0, n)
#define sz(v) ((int)(v).size()) 
#define ea(i, n) for(auto&& i: n)
#define pr(n) cout << fixed << setprecision(n)
#define mp(n, o) map<n, o>
#define so(n) sort(n.begin(), n.end())
#pragma endregion
// abs 絶対値, rtsq ルート, pow(a, n) aのn乗

int main() {
  int P, Q, R, a = 0;
  ci(P, Q, R);
  a += P + Q + R - max({P, Q, R});
  co(a);
} 


Measured memory_bytes: 256
from collections import Counter
from itertools import permutations
N, C = map(int, input().split())
D = [list(map(int, input().split())) for i in range(C)]
c_field = [list(map(int, input().split())) for i in range(N)]

mod0 = []
mod1 = []
mod2 = []

for i in range(N):
    for j in range(N):
        if (i+j+2) % 3 == 0:
            mod0.append(c_field[i][j])
        elif (i+j+1) % 3 == 1:
            mod1.append(c_field[i][j])
        else:
            mod2.append(c_field[i][j])

mod0 = Counter(mod0)
mod1 = Counter(mod1)
mod2 = Counter(mod2)

def calc(p):
    ret = 0
    for i, v in mod0.items():
        if i == p[0]: continue
        ret += D[i-1][p[0]-1] * v
    for i, v in mod1.items():
        if i == p[1]: continue
        ret += D[i-1][p[1]-1] * v
    for i, v in mod2.items():
        if i == p[2]: continue
        ret += D[i-1][p[2]-1] * v
    return ret
    

ans = 10 ** 30
for p in permutations(range(1,C+1), 3):
    ans = min(ans, calc(p))

print(ans)


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

using ll = long long;
using ld = long double;
using Graph = vector<vector<int>>;

int main(void)
{
    ll n,Wc=0,Rc=0,sikiri;
    cin >> n;
    ll mini=n;
    char c[n];
    for(int i=0;i<n;i++)
    {
        cin >> c[i];
        if(c[i]=='R')
        {
            Rc++;
        }
    }
    for(int i=0;i<=n;i++)
    {
//        mini=min(mini,Rc+Wc);
        if(Wc<=Rc)
        {
            mini=min(mini,Rc);
        }
        else if(Wc>Rc)
        {
            mini=min(mini,Wc);
        }            
        if(c[i]=='W')
        {
            Wc++;
        }
        else if(c[i]=='R')
        {
            Rc--;
        }
    }
    cout << mini << endl;
    return 0;
}


Measured memory_bytes: 3708
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <cstring>
#include <string>
#include <vector>
#include <queue>
#include <cmath>
#include <stack>
#include <set>
#include <map>
typedef long long ll;
using namespace std;

int main() {
    int a[32] = {1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
    int K;
    cin >> K;
    cout << a[K - 1] << endl;
    return 0;
}


Measured memory_bytes: 256
w=input()+"X"
n=len(w)
ans=[]
i=j=0
while True:
  while w[i]=="R":
    i+=1
  ans+=[0]*(i-j-1)
  r=(i-j+1)//2
  l=(i-j)//2
  j=i
  while w[j]=="L":
    j+=1
  r+=(j-i)//2
  l+=(j-i+1)//2
  ans.append(r)
  ans.append(l)
  ans+=[0]*(j-i-1)
  if j==n-1:
    break
  i=j
for a in ans:
  print(a,end=" ")

Measured memory_bytes: 4852
import math as m

n, d = map(int, input().split())
x = []
for i in range(n):
    x_ = list(map(int, input().split()))
    x.append(x_)

ans = 0
for i in range(n):
    for j in range(i+1, n):
        dis = 0
        for k in range(d):
            dis += (x[i][k] - x[j][k])**2
        dis = m.sqrt(dis)
        if dis - int(dis) == 0:
            ans += 1

print(ans)   

Measured memory_bytes: 3064
N, x = map(int, input().split())
a = list(map(int, input().split()))

count = 0
for i in range(N-1):
    if a[i] + a[i+1] > x:
        if a[i+1] >= a[i] + a[i+1] - x:
            count += a[i] + a[i+1] - x
            a[i+1] -= a[i] + a[i+1] - x
        else:
            count += a[i] + a[i+1] - x
            a[i+1] = 0
            a[i] = x

print (count)


Measured memory_bytes: 14252
#include <bits/stdc++.h>
using ll = long long;
using namespace std;
#define _overload3(_1, _2, _3, name, ...) name
#define _rep(i, n) repi(i, 0, n)
#define repi(i, a, b) for(int i = int(a); i < int(b); ++i)
#define rep(...) _overload3(__VA_ARGS__, repi, _rep, )(__VA_ARGS__)
#define all(x) (x).begin(), (x).end()
const long long INFLL = 1LL << 60;
const int INFINT = 1 << 30;
const long long MOD = 1e9 + 7;

template <typename T> bool chmax(T &a, const T &b) {
    if(a < b) {
        a = b;
        return true;
    }
    return false;
}

template <typename T> bool chmin(T &a, const T &b) {
    if(a > b) {
        a = b;
        return true;
    }
    return false;
}

int main() {
    int N, K;
    cin >> N >> K;
    vector<int> H(N);
    rep(i, N) cin >> H.at(i);
    sort(H.begin(), H.end());
    ll total = 0;
    if(N > K) {
        rep(i, H.size() - K) total += H.at(i);
    }
    cout << total << endl;
}


Measured memory_bytes: 3980
#include<stdio.h>
#include<stdlib.h>
#include<math.h>
#include<string.h>
#include<stdbool.h>
#include<assert.h>
typedef long long ll;
typedef long double ld;
#define rep(i,l,r)for(ll i=(l);i<(r);i++)
#define repp(i,l,r,k)for(ll i=(l);i<(r);i+=(k))
#define rrep(i,l,r)for(ll i=(l);i>=(r);i--)
#define INF (1LL<<60)
#define MOD1 1000000007
#define MOD2 998244353
#define MAX_N (1 << 17)
#define YES printf("Yes\n")
#define NO printf("No\n")
#define PN printf("\n")
#define charsize 100005 //10^5+5

void swap(ll *a, ll *b){ll c;c=*b;*b=*a;*a= c;}
// void fill(ll n, ll a[n], ll value){ rep(i,0,n) a[i] = value; }
void cin(ll *n){ scanf("%lld",&(*n)); }
void cin2(ll *a, ll *b){ scanf("%lld%lld",&(*a),&(*b)); }
void cin3(ll *a, ll *b, ll *c){ scanf("%lld%lld%lld",&(*a),&(*b),&(*c)); }
ll max2(ll a,ll b){return a>=b?a:b;}
ll min2(ll a,ll b){return a>=b?b:a;}
ll min3(ll a, ll b, ll c){return (a<=b && a<=c) ? a : b<=c ? b : c;}
ll max3(ll a, ll b, ll c){return (a>=b && a>=c) ? a : b>=c ? b : c;}
ll minn(ll n, ll a[n]){ll b=INF;rep(i,0,n) b=min2(b,a[i]);return b;}
ll maxn(ll n, ll a[n]){ll b=-INF;rep(i,0,n) b=max2(b,a[i]);return b;}
ll ABS(ll a){return a>=0?a:(-a);}
ll POW(ll a, ll b){ll c=1;rep(i,0,b) c*=a;return c;}
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return a/gcd(a,b)*b;}
ll mod_MOD1(ll n){n+= n<0?((-n)/MOD1+1)*MOD1:0; return n%=MOD1;}
ll mod_p(ll n ,ll p){n+= n<0?((-n)/p+1)*p:0; return n%=p;}
ll change_into_num(char s[] , ll len, ll p){ return !p ? 0 : POW(10,p-1)*(s[len-p]-'0') + change_into_num(s,len,p-1); }

int upll(const void*a, const void*b){return*(ll*)a<*(ll*)b?-1:*(ll*)a>*(ll*)b?1:0;}
int downll(const void*a, const void*b){return*(ll*)a<*(ll*)b?1:*(ll*)a>*(ll*)b?-1:0;}
void sortup(ll*a,int n){qsort(a,n,sizeof(ll),upll);}
void sortdown(ll*a,int n){qsort(a,n,sizeof(ll),downll);}
// int int_sort( const void * a , const void * b ) {
//   return strcmp(( char * )a , ( char * )b );
// }
//     qsort((void*)s,n,sizeof(s[0]),int_sort );

typedef struct{ ll a , b;}fr;
int cmp1( const void *p, const void *q ) { return ((fr*)p) ->a - ((fr*)q)->a;}
int cmp2( const void *p, const void *q ) { return ((fr*)q) ->a - ((fr*)p)->a;}
void strsortup(fr*a,int n){qsort(a,n,sizeof(fr),cmp1);}
void strsortdown(fr*a,int n){qsort(a,n,sizeof(fr),cmp2);}

// ll floor1(ll a,ll b){
//     return a%b? a/b+1
// }

int main(void){
    // char ;
    ll n,a,b;
    ll ans=0;
    cin2(&a,&b);
    cin(&n);
    // cin3(&,&,&);
    // ll [n];
    ll x;
    if(n<=b-1){
        x =n;
        ans = (a*x)/b -a*(x/b);
    }else{
        if(n%b==b-1) x=n;
        else x = n- n%b-1;
        ans = (a*x)/b -a*(x/b);
    }

    
    printf("%lld\n",ans);
    return 0;
}


Measured memory_bytes: 1740
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define FOR(i, a, b) for(int i = (int)a; i <= (int)b; i++)
#define DEC(i, a, b) for(int i = (int)a; i >= (int)b; i--)
typedef pair<int, int> pi;
typedef pair<pi, int> pii;
typedef pair<pi, pi> pipi;
#define f first
#define s second
typedef vector<int> vi;
typedef vector<pi> vpi;
typedef vector<pii> vpii;
#define pb push_back
#define pf push_front
#define all(v) v.begin(), v.end()
#define disc(v) sort(all(v)); v.resize(unique(all(v)) - v.begin());
#define INF (int) 1e9 + 100
#define LLINF (ll) 1e18
#define fastio ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define sandybridge __attribute__((optimize("Ofast"), target("arch=sandybridge")))
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());    //can be used by calling rng() or shuffle(A, A+n, rng)
inline ll rand(ll x, ll y) { ++y; return (rng() % (y-x)) + x; } //inclusivesss

int main() {
	fastio; int a; string s;
  cin >> a >> s;
  if (a < 3200) cout << "red";
  else cout << s;
}


Measured memory_bytes: 3612