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


typedef long long ll;

using namespace std;


const ll mod=1000000007;

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

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

int main(){
    int N;
    ll M;
    cin>>N;
    cin>>M;
    ll a;
    ll k=1;
    ll count=-1;
    bool judge=true;


    for(int i=0;i!=N;i++){
        ll cnt=0;
        cin>>a;
        k=lcm(a/2,k);
        
        while(a%2==0){
            a=a/2;
            ++cnt;
        }
        if(count==-1){
            count=cnt;
        }else{
            if(count!=cnt){
                judge=false;
                break;
            }
        }
    }
    //cout<<k<<endl;


    ll ans=(M-M%k)/k;
    if(judge){

    if(ans%2==1){
        cout<<(ans/2+1)<<endl;
    }else{
        cout<<ans/2<<endl;
    }
    }else{
        cout<<0<<endl;
    }
}




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

#define F first
#define S second
#define prev azaza
#define MP make_pair
#define PB push_back

using namespace std;
typedef long long ll;
typedef long double ld;

const int max_n = 200111, inf = 1000111222;

vector<int> v[max_n];
int add[max_n];
int ans[max_n];

void dfs(int cur, int pr, int sum) {
    sum += add[cur];
    ans[cur] = sum;
    for (int to : v[cur]) {
        if (to == pr) {
            continue;
        }
        dfs(to, cur, sum);
    }
    sum -= add[cur];
}

int main()
{
    //freopen("input.txt", "r", stdin);
    int n, q;
    cin >> n >> q;
    for (int i = 0; i + 1 < n; ++i) {
        int a, b;
        scanf("%d%d", &a, &b);
        --a, --b;
        v[a].PB(b);
        v[b].PB(a);
    }
    for (int i = 0; i < q; ++i) {
        int v, val;
        scanf("%d%d", &v, &val);
        --v;
        add[v] += val;
    }
    dfs(0, -1, 0);
    for (int i = 0; i < n; ++i) {
        printf("%d ", ans[i]);
    }
    return 0;
}




Measured memory_bytes: 24192
from bisect import bisect,bisect_left
N = int(input())
A = sorted(list(map(int,input().split())))
B = sorted(list(map(int,input().split())))
C = sorted(list(map(int,input().split())))
ans = 0
for b in B:
    top = bisect_left(A,b)
    bottom = N - bisect(C,b)
    ans += top*bottom
print(ans)

Measured memory_bytes: 23244
#include<cstdio>
#include<iostream>
#include<cstring>
#include<algorithm>
using namespace std;
typedef long long ll;
int main()
{
	ll a,b,c;
	ll k;
	cin>>a>>b>>c;
	cin>>k;
	ll mx=-0x3f3f3f3f;
	mx=max(mx,a);
	mx=max(mx,b);
	mx=max(mx,c);
	ll sum=0;
	if(mx==a){
		sum+=b;
		sum+=c;
	}
	else if(mx==b){
		sum+=a;
		sum+=c;
	}
	else if(mx==c){
		sum+=b;
		sum+=a;
	}	
	for(int i=0;i<k;i++)
		mx*=2;
	sum+=mx;
	cout<<sum<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main(){

	int n,s;
	long long dp[10][1001]={0};

	dp[0][0]=1;
	for(int i=0;i<=100;i++){
		for(int j=8;j>=0;j--){
			for(int k=0;k<=1000-i;k++){
				if(dp[j][k]>0){
					dp[j+1][k+i]+=dp[j][k];
				}
			}
		}
	}

	while(1){

		cin>>n>>s;
		if(n==0&&s==0) break;

		cout<<dp[n][s]<<endl;
	}
	return 0;
}

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

int main(){
	ll x;
	cin >> x;
	ll mod = x % 11;
	ll ans;
	if (mod == 0) {
		ans = 2* (x/11);
	} 
	else if(mod <= 6){
		ans = 2 * (x/11) + 1;
	}
	else {
		ans = 2 * (x/11) + 2;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 764
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
using namespace std;
using ll=long long;
using vec=vector<ll>;
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-1;i>=0;i--)
#define Pool(i, m, n) for(ll i=n-1;i>=m;i--)
#define MAX 99999999999ll
#define MIN -99999999999ll
#define setbit bitset<8>
#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 count2way(v,x) high2way(v,x)-low2way(v,x)
#define lower(v,x) low2way(v,x)-v.begin() //1番左が0、もし見つから無いならｎを出力
#define higher(v,x) high2way(v,x)-v.begin()-1 //1番左が0、もし見つからないならn-1を出力（注意）
#define putout(a) cout<<a<<endl
#define putout2(a,b) putout(a);putout(b)
#define putout3(a,b,c) putout(a);putout(b);putout(c)
#define putout4(a,b,c,d) putout(a);putout(b);putout(c);putout(d)
#define putout5(a,b,c,d,e) putout(a);putout(b);putout(c);putout(d);putout(e)
#define Gput(a,b) G[a].push_back(b)
#define cin1(a) cin>>a
#define cin2(a,b) cin>>a>>b
#define cin3(a,b,c) cin>>a>>b>>c
#define cin4(a,b,c,d) cin>>a>>b>>c>>d
#define cin5(a,b,c,d,e) cin>>a>>b>>c>>d>>e
#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;
}
ll lcm(ll x,ll y){
  ll z=gcd(x,y);
  return x*y/z;
}
int main() {
cout << fixed << setprecision(30);
  ll n;
  cin>>n;
  vec a(n);
  vec b(n);
  loop(i,n)cin>>a[i]>>b[i];
  ll ans=0;
  ll count=0;
  loop(i,n){
    ll x=n-1-i;
    a[x]+=count;
    if(a[x]%b[x]!=0){
      ll r=a[x]%b[x];
      ans+=b[x]-r;
      count+=b[x]-r;
    }
  }
  putout(ans);
}

Measured memory_bytes: 1920
R,G,B,N=map(int,input().split())
ls=(sorted([R,G,B]))
mx,md,sm=ls[2],ls[1],ls[0]
count=0

biggest_box_max=N//mx
for i in range(biggest_box_max+1):
    rest_N=N-mx*i
    middle_box_max=rest_N//md
    for j in range(middle_box_max+1):
        rest_rest_N=rest_N-md*j
        if rest_rest_N%sm==0:
            count+=1
        
print(count)

Measured memory_bytes: 3064
#include <cstdio>
#include <algorithm>
using namespace std;
int main() {
	int N;
	scanf("%d", &N);
	long long A[N], ans = 0;
	for (int i = 0; i < N; ++i) scanf("%lld", &A[i]);
	for (long long i = 1LL; i < (1LL << 60); i <<= 1) {
		long long cnt = 0;
		for (int j = 0; j < N; ++j) {
			if (A[j] & i) ++cnt;
		}
		cnt = cnt * (N - cnt) % 1000000007;
		ans += (i % 1000000007 * cnt % 1000000007);
		ans %= 1000000007;
	}
	printf("%lld", ans);
	return 0;
}


Measured memory_bytes: 2560
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define printVec(v) printf("{"); for (const auto& i : v) { std::cout << i << ", "; } printf("}\n");
#define degreeToRadian(deg) (((deg)/360)*2*M_PI)
#define radianTodegree(rad) (((rad)/2/M_PI)*360)
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
using namespace std;
using P = pair<int,int>;
using ll = long long;
const ll INF = 1LL<<60;
const int MOD = 1e9 + 7;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

//cin.tie(0);ios::sync_with_stdio(false);
//cout << fixed << setprecision(15) << y << endl;
int main() {
  ll n; cin >> n;

  string ans = "";
  while (n) {
    n--;
    char ch = 'a' + n % 26;
    ans += ch;
    n /= 26;
  }

  reverse(ans.begin(), ans.end());
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 3636
def main():
    from collections import deque
    import sys
    def input():
        return sys.stdin.readline()[:-1]
    S=input()
    Q=int(input())
    A=[input().split() for _ in range(Q)]
    d=deque(S)
    
    d_left=d.appendleft
    d_right=d.append
    j=["1","2"]
    k=0
    j_re=j.reverse
    for x in A:
        if x[0]=="1":
            j_re()
            k+=1
        else:
            if x[1]==j[0]:
                d_left(x[2])
            else:
                d_right(x[2])
    if k%2==1:
        d.reverse()
    print("".join(d))    

if __name__ == '__main__':
    main()


Measured memory_bytes: 44652
import java.util.*;

public class Main{
      public static void main(String[] args) {
            Scanner sc = new Scanner(System.in);
            String str1 = sc.next();
            String[] str2 = str1.split("");
            if("9".equals(str2[0]) || "9".equals(str2[1])){
              System.out.println("Yes");
            } else {
              System.out.println("No");
            }
          }
}

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

using namespace std;
typedef long long ll;

const ll INF = 1LL << 60;

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

    ll N;
    vector<ll> X;
    ll L;

    cin >> N;
    X.resize(N);

    for (ll i = 0; i < N; ++i) {
        cin >> X[i];
    }
    sort(X.begin(), X.end());

    cin >> L;

    vector< vector<ll> > d; // doubling
    d.resize(N);
    for (ll i = 0; i < N; ++i) {
        d[i].resize(32);
    }

    for (ll i = 0; i < N; ++i) {
        d[i][0] = upper_bound(X.begin(), X.end(), X[i] + L) - X.begin() - 1;
    }

    for (ll j = 1; j < 32; ++j) {
        for (ll i = 0; i < N; ++i) {
            d[i][j] = d[ d[i][j-1] ][j-1];
        }
    }

    //for (ll i = 0; i < N; ++i) {
    //    cout << i << " " << X[i] << " " << d[i][0] << endl;
    //}

    ll Q;
    cin >> Q;

    while (Q--) {
        ll a;
        ll b;

        cin >> a >> b;
        a--;
        b--;

        if (a > b) {
            swap(a, b);
        }

        ll s = 0;
        
        for (ll i = 31; i >= 0; --i) {
            if (d[a][i] <= b-1) {
                a = d[a][i];
                s += (1LL << i);
            }

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

        cout << s+1 << endl;
    }
}


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

using namespace std;

#pragma GCC target ("avx2")
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")

typedef long long ll;

int C[3][3];

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

    int n;
    cin >> n;

    vector<int> a(n);
    int sum = 0;

    for(int i = 0; i < n; i++) {
        cin >> a[i];
        sum += a[i];
    }

    int ans = (1 << 30), cur = 0;

    for(int i = 0; i + 1 < n; i++) {
        cur += a[i];

        ans = min(ans, abs(2 * cur - sum ) );
    }

    cout << ans << endl;
}


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

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

    vector<int> a(N);
    for (int i = 0; i < N; i++) {
        cin >> a[i];
        a[i]--;
    }

    int ans = 0;
    for (int i = 0; i < N; i++) {
        if (a[a[i]] == i) ans++;
    }
    cout << ans / 2 << endl;

    return 0;
}

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

int main() {
  int a,b,c,d,e,k;
  cin >> a >> b >> c >> d >> e >> k;
  
  if ( e - a <= k) {
    cout << "Yay!" << endl;
  }
   else {
    cout << ":(" << endl;
    }
}


Measured memory_bytes: 256
//#define _GLIBCXX_DEBUG
#include<bits/stdc++.h>
#define PI 3.14159265359
using namespace std;
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
const long long INF= 1e+18+1;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vector<ll> >vvl;
typedef pair<ll,ll> P;
typedef tuple<ll,ll,ll> T;
const ll MOD=1000000007LL;
string abc="abcdefghijklmnopqrstuvwxyz";
string ABC="ABCDEFGHIJKLMNOPQRSTUVWXYZ";
int main(){
  string s,t;cin>>s>>t;
  ll n=s.size(),m=t.size();
  ll dp[3010][3010];
  rep(i,n){
    rep(j,m){
      if(s[i]==t[j])dp[i+1][j+1]=dp[i][j]+1;
      else dp[i+1][j+1]=max(dp[i][j+1],dp[i+1][j]);
    }
  }
  ll i=n,j=m;
  string ans="";
  //rep(a,n+1){
    //rep(b,m+1)cout<<dp[a][b]<<" ";
    //cout<<endl;
  //}
  while(i>0&&j>0){
    if(dp[i][j]==dp[i][j-1])j--;
    else if(dp[i][j]==dp[i-1][j]) i--;
    else{
      ans.push_back(s[i-1]);
      i--;j--;
    }
  }
  reverse(ans.begin(),ans.end());
  cout<<ans<<endl;
}

Measured memory_bytes: 70784
#include<iostream>
#include<string>
#include<cstdio>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
#include<tuple>
using namespace std;
typedef long long ll;
typedef unsigned int ui;
const ll mod = 1000000007;
const ll INF = (ll)1000000007 * 1000000007;
typedef pair<int, int> P;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
typedef long double ld;
typedef complex<ld> Point;
const ld eps = 1e-8;
const ld pi = acos(-1.0);
typedef pair<ll, ll> LP;

int n,m;
vector<ll> a,sum_a={0},sum_c={0};
vector<LP> c={LP(0,INF)};

void solve(){
    cin >> n >> m;
    a.resize(n,0);
    rep(i,n){
        cin >> a[i];
    }
    rep(i,m){
        ll p,q;
        cin >> p >> q;
        c.push_back(LP(q,p));
    }
    sort(a.begin(),a.end());
    sort(c.begin(),c.end(),greater<LP>());
    int k=0;
    rep(i,n){
        sum_a.push_back(sum_a.back()+a[i]);
        if (c[k].second!=0){
            sum_c.push_back(sum_c.back()+c[k].first);
            c[k].second-=1;
        }
        else{
            k+=1;
            sum_c.push_back(sum_c.back()+c[k].first);
            c[k].second-=1;
        }
        //cout << a[i] << " " <<  c[k].first << endl;
        //cout << sum_a[i] << " " <<sum_c[i] << endl;
    }

    ll ans=0;
    rep(i,n+1){
        ans=max(ans,sum_a[n]-sum_a[i]+sum_c[i]);
    }

    cout << ans << endl;
}

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

Measured memory_bytes: 5488
#include <stdio.h>
void gcd(int x,int y){
  int u = x%y;
  if(u>0) gcd(y,u);
  if(u==0)printf("%d\n",y);
}
int main(){
  int x,y;
  scanf("%d %d",&x,&y);
  gcd(x,y);
  return 0;
}

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

#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
template<typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

#define F first
#define S second
#define pb push_back
#define pii pair <int, int>
#define all(a) (a).begin(), (a).end()
#define rall(a) (a).rbegin(), (a).rend()
#define reunique(a) (a).resize(unique(all(a)) - (a).begin())
#define ld long double
#define int long long

void SOLVE(){
    int n, r;
    cin >> n >> r;
    if (n >= 10){
        cout << r << '\n';
    }
    else{
        cout << r + (100 * (10 - n)) << '\n';
    }
}

signed main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    cout << fixed << setprecision(12);
    int Q = 1;
    //cin >> Q;
    while (Q--){
        SOLVE();
    }

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, m, n) for(int (i) = (m); (i) < (n); ++i)
#define rep(i, n) REP(i, 0, n)
#define all(x) (x).begin(), (x).end()
using namespace std;
using Graph = vector<vector<int>>;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
typedef long long ll;
typedef pair<ll, ll> P;
const int INF = 1e9+7;
const ll LINF = 1LL<<60;

vector<ll> enumDivisior(ll n) {
    vector<ll> res;
    for (ll i = 1; i * i <= n; ++i) {
        if (n % i) continue;
        res.push_back(i);
        if (i * i != n) res.push_back(n / i);
    }
    return res;
}

int main()
{
    cin.tie(0);
    ios_base::sync_with_stdio(0);
    ll n;
    cin >> n;
    ll ans = 0;
    for(ll x : enumDivisior(n)) {
        if (x == 1) continue;
        ll tmp = n;
        while(tmp % x == 0) tmp /= x;
        tmp %= x;
        if (tmp == 1) ++ans;
    }
    ans += enumDivisior(n - 1).size() - 1;
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 384
#define _USE_MATH_DEFINES
#include<iostream>
#include<string>
#include<vector>
#include<list>
#include<algorithm>
#include<math.h>
#include<map>
#include<iomanip>
#include<functional>
#include<limits>
#include <unordered_map>
#include <numeric>
#include <array>
#include <queue>
#include <chrono>
#include <random>
#include <fstream>


using namespace std;
using  ull = unsigned long long int;

#define rep(i,n,m) for(long long int i=n;i<(long long int)(m);i++)
#define INF (1<<29)
#define MD 1000000007

int main() {

	string str;
	int k;

	cin >> str >> k;

	vector<string>word;

	rep(i, 0, str.length()) {
		rep(j, 1, k+1) {
			if (i+j <= str.length()) {
				word.push_back(str.substr(i, j));
			}
		}
	}
	
	sort(word.begin(), word.end());
	word.erase(unique(word.begin(), word.end()), word.end());
	
	cout << word[k - 1] << endl;

	return 0;
}

Measured memory_bytes: 1660
#!/bin/usr/python

in_str = input()
flag = True

for i in range(0, len(in_str)):
  for j in range(i+1, len(in_str)):
    if in_str[i] == in_str[j]:
      print("no")
      flag = False
      break
  if flag == False:
    break

if flag == True:
  print("yes")

Measured memory_bytes: 3060
import java.io.*;
import java.math.*;
import java.util.*;

public class Main {
    private static boolean debug = false;
    private static boolean elapsed = false;

    private static PrintWriter _out = new PrintWriter(System.out);
    private static PrintWriter _err = new PrintWriter(System.err);

    private void solve(Scanner sc) {
        String s = sc.nextLine();
        _out.println(s.indexOf("9") >= 0 ? "Yes" : "No");
    }
    private static BigInteger C(long n, long r) {
        BigInteger res = BigInteger.ONE;
        for (long i = n; i > n - r; --i) {
            res = res.multiply(BigInteger.valueOf(i));
        }
        for (long i = r; i > 1; --i) {
            res = res.divide(BigInteger.valueOf(i));
        }
        return res;
    }
    private static BigInteger P(long n, long r) {
        BigInteger res = BigInteger.ONE;
        for (long i = n; i > n - r; --i) {
            res = res.multiply(BigInteger.valueOf(i));
        }
        return res;
    }
    /*
     * 10^10 > Integer.MAX_VALUE = 2147483647 > 10^9
     * 10^19 > Long.MAX_VALUE = 9223372036854775807L > 10^18
     */
    public static void main(String[] args) {
        long S = System.currentTimeMillis();

        Scanner sc = new Scanner(System.in);
        new Main().solve(sc);
        _out.flush();

        long G = System.currentTimeMillis();
        if (elapsed) {
            _err.println((G - S) + "ms");
        }
        _err.flush();
    }
}

Measured memory_bytes: 21716
#include <iostream>
using namespace std;
int main(void){
    int n,k,q;
    cin>>n>>k>>q;
    int a[q],p[n];
    for(int i=1;i<=n;i++){
        p[i]=0;
    }    
    for(int i=1;i<=q;i++){
        cin>>a[i];
        p[a[i]]++;
    }    
    
    for(int i=1;i<=n;i++){
        
        if(k-(q-p[i])>0)cout<<"Yes"<<"\n";
        else cout <<"No"<<"\n";
    }
    
}


Measured memory_bytes: 1408
#include<bits/stdc++.h>
using namespace std;
typedef unsigned long long int ll;
const int INF = 1<<30;
int main(){
  int n, l;cin>>n>>l;
  int x;
  if(0<=-l && -l<n){
  	x = 0;
  }else if(-l<0){
    x=l;
  }else{
    x=(n-1)+l;
  }
  cout<<n*l+(n*(n-1))/2-x<<endl;
}


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

using namespace std;

int action(int& A, int& B, int target){
    if(target == 1){
        action(B,A, 0);
    }else{
//        cout<<"start"<<A<<" "<<B<<endl;
        if(A % 2 != 0){
            A=A-1;
        }
    B=B+A/2;
    A=A/2;
    }
//    cout<<"end"<<A<<" "<<B<<endl;
    return 0;
}

int main(void){
    int ans[2],K;
    int i;
    cin>>ans[0]>>ans[1]>>K;

    for(i=0;i<K;i++){
        action(ans[0],ans[1],i%2);
    }

    cout<<ans[0]<<" "<<ans[1]<<endl;

    return 0;
}

Measured memory_bytes: 256
<?php
    list($a, $b, $c, $d) = explode(" ", trim(fgets(STDIN)));
    if(abs($a - $c) <= $d){
        echo "Yes";
    }
    elseif(abs($a - $b) <= $d){
        if(abs($b - $c) <= $d){
            echo "Yes";
        }else{
            echo "No";
        }
    }else{
        echo "No";
    }
?>

Measured memory_bytes: 4856
N = input('')
d = []
temp = input('')
d.append(temp)
for i in range(1, N):
    flag = 0
    temp = input('')
    for j in range(0, len(d)):
        if temp == d[j]:
            flag = 1
    if flag == 0:
        d.append(temp)
        #print('append')                                                  
print len(d)

Measured memory_bytes: 2568
import Data.List
import Data.Ord
import Data.Char
import Data.Ratio
import Data.Maybe
import Control.Monad

main = do
  getLine
  s <- getLine
  print $cutAndCount s

cutAndCount list = maximum $cutAndCount' 1 list
cutAndCount' n list
  |(length list)/=n = (length .nub .intersect left) right : cutAndCount' (n+1) list
  |otherwise = []
    where left  = take n list
          right = drop n list

Measured memory_bytes: 4696
#include <bits/stdc++.h>
using namespace std;
#define st first
#define nd second
#define pb push_back
#define pf push_front
#define ppb pop_back
#define ppf pop_front
#define ll long long
int main()
{
    int n;
    cin>>n;
    vector<int> a;
    while(n!=0)
    {
        a.pb(n%10);
        n/=10;
    }
    if((a[0]==a[1] && a[1]==a[2]) || a[1]==a[2] && a[2]==a[3])
    {
        cout<<"Yes";
    }
    else
    {
        cout<<"No";
    }
    return 0;
}


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

int main()
{
  int n;
  cin >> n;
  vector<int> a(n), b(n), c(n), dpa(n), dpb(n), dpc(n);

  for (auto i = 0; i < n; i++) {
    cin >> a[i] >> b[i] >> c[i];
  }
  dpa[0] = max(a[0], max(b[0], c[0]));
  dpb[0] = max(a[0], max(b[0], c[0]));
  dpc[0] = max(a[0], max(b[0], c[0]));
  for (auto i = 1; i < n; i++) {
    dpa[i] = a[i] + max(dpb[i - 1], dpc[i - 1]);
    dpb[i] = b[i] + max(dpa[i - 1], dpc[i - 1]);
    dpc[i] = c[i] + max(dpa[i - 1], dpb[i - 1]);
  }
  cout << max(dpa[n - 1], max(dpb[n - 1], dpc[n - 1]));
}


Measured memory_bytes: 2560
class UnionFind():
    def __init__(self, n):	#初期化
        self.n = n
        self.parents = [-1] * n
    def find(self, x):		#属すグループの根(リーダー)
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]
    def union(self, x, y):	#連結
        x = self.find(x)
        y = self.find(y)
        if x == y:
            return
        if self.parents[x] > self.parents[y]:
            x, y = y, x
        self.parents[x] += self.parents[y]
        self.parents[y] = x
    def size(self, x):		#同じグループに属す頂点数
        return -self.parents[self.find(x)]
    def same(self, x, y):	#x,yが同じグループに属しているかどうか
        return self.find(x) == self.find(y)
    def members(self, x):	#同じグループに属すメンバー
        root = self.find(x)
        return [i for i in range(self.n) if self.find(i) == root]
    def roots(self):		#全ての根(リーダー)
        return [i for i, x in enumerate(self.parents) if x < 0]
    def group_count(self):	#グループの数
        return len(self.roots())
    def all_group_members(self):#全てのグループのメンバー
        return {r: self.members(r) for r in self.roots()}
    def __str__(self):		#根：{所属しているメンバー}
        return '\n'.join('{}: {}'.format(r, self.members(r)) for r in self.roots())
n,q = map(int,input().split())
uf = UnionFind(n)
ans = []
l = 0
for i in range(q):
    t,u1,u2 = map(int,input().split())
    if(t == 0):
        uf.union(u1,u2)
    else:
        if(uf.same(u1,u2)):
            ans.append(1)
        else:
            ans.append(0)
        l += 1

for i in range(l):
    print(ans[i])



Measured memory_bytes: 12460
#include <bits/stdc++.h>
using namespace std; 
#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define ll long long
long long min(long long x,long long y){return (x<y ? x:y);}
long long max(long long x,long long y){return (x>y ? x:y);}
#define ld long double
int stoi(string s) {return atoi(s.c_str());}
int keta(long long x){ if(x<10){return 1;} else{return keta(x/10) + 1;}}
ll gcd(ll x, ll y){ll a,b; if(x>y){a=x; b=y;} else{a=y;b=x;} return (a%b==0 ? b: gcd(b,a%b));}
ll lcm(ll x, ll y){return x/gcd(x,y) * y;}

int main(){
  int N; cin >> N;
  unordered_map<ll,bool> mp_exist;
  ll A;
  int r = 0;
  REP(i,N){
    cin >> A;
    if(mp_exist[A]){r--;mp_exist[A]=false;}
    else{r++;mp_exist[A]=true;}
  }
  cout << r << "\n";
}

Measured memory_bytes: 4388
#include<bits/stdc++.h>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
#define lli long long int
#define ulli unsigned long long int
#define ld long double
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define loop(i,a,b) for(lli i=a;i<b;i++)
#define initialize(array,size,value) for(lli i=0;i<size;i++) array[i]=value
#define couta(array,size) for(lli i=0;i<size;i++) cout<<array[i]<<" "
#define vl vector<lli>
#define vp vector< pair <lli,lli> >
#define sl set<lli>
#define msp multiset < pair < long long , long long > > S;
#define pll pair<lli, lli>
#define mll map<lli, lli>            //for( map<lli, lli>::iterator i=temp.begin();i!=temp.end();i++)cout<<i->fi<<" "<<i->se<<endl;
#define mvl map<lli, vl>
#define umll unordered_map<lli, lli>
#define vt vector<pair<lli, pll >  >
#define vf vector<pair<pll,pll > >
#define qu queue<lli>
#define pq priority_queue<lli>
#define dq deque <lli>
#define ptr vector<lli>::iterator
#define bs(array,x) binary_search(array.begin(),array.end(),x) // also valid for set and multiset
#define lb(array,x) lower_bound(array.begin(),array.end(),x)
#define ub(array,x) upper_bound(array.begin(),array.end(),x)
#define nobw(array,i,j) upper_bound(array.begin(), array.end(), j)-lower_bound(array.begin(), array.end(), i) //number of numbers between i & j
#define vc clear()
#define endl '\n'
#define sp system("pause");
#define INF 9223372036854775807
#define MINF -9223372036854775808
typedef tree<lli,null_type,less<lli>,rb_tree_tag,
tree_order_statistics_node_update> indexed_set;
//string binary = bitset<32>(n).to_string();
int main() {
	ios::sync_with_stdio(0);
    cin.tie(0);
    lli n;
    cin>>n;
    lli a[n];
    for(lli i=0;i<n;i++)cin>>a[i];
    	lli sum=0;
    for(lli i=0;i<n;i++){
    	if(i%2==1)sum-=a[i];
    	else sum+=a[i];
    }
//    cout<<sum;
    lli b[n];
    b[0]=sum;
    for(lli i=1;i<n;i++)b[i]=2*a[i-1]-b[i-1];
    for(lli i=0;i<n;i++)cout<<b[i]<<" ";



	return 0;

}

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

int main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
    int a, b;
    cin >> a >> b;
    if (a > 9 || b > 9){

        cout << -1 << endl;
        return 0;
    }
    cout << a* b << endl;
    return 0;
}


Measured memory_bytes: 256
#import sys
#input→sys.stdin.readline半分の時間に
#input=sys.stdin.readline
"""
n=int(input())
s=0
for i in range(n+1):
  if i%5!=0 and i%3!=0:
    s+=i
print(s)
"""
k=int(input())
s=0
#関数を定義
def gcd(p,q):
 
  if p<q:
    p, q = q, p
#①のとき
  if q == 0:
    return p
#②のとき
  else:
    return gcd(q,p%q)
#結果を出力

for c in range (1,k+1):
  for b in range (1,c+1):
    for a in range (1,b+1):
      d=gcd(a,c)
      g=gcd(d,b)
      if a==b and b==c:
        g=g
      elif a!=b and b!=c:
        g=g*6
      else:
        g=g*3
      s+=g
print(s)

Measured memory_bytes: 9232
using System;
class Program
{
    public static void Main()
    {
        string[] imp = Console.ReadLine().Split(' ');
        int n, m;
        n = int.Parse(imp[0]);
        m = int.Parse(imp[1]);
        char[][] a = new char[n][];
        char[][] b = new char[m][];
        for (int i = 0; i < n; i++)
            a[i] = Console.ReadLine().ToCharArray();
        for (int i = 0; i < m; i++)
            b[i] = Console.ReadLine().ToCharArray();
        bool f = true;
        for (int p = 0; p <= n - m; p++)
        {
            for (int q = 0; q <= n - m; q++)
            {
                f = true;
                for (int i = 0; i < m; i++)
                    for (int j = 0; j < m; j++)
                        f = f && a[p + i][q + j] == b[i][j];
                if (f)
                    break;
            }
            if (f)
                break;
        }
        Console.WriteLine(f ? "Yes" : "No");
    }
}

Measured memory_bytes: 11220
import { readFileSync } from "fs";

const read = () =>
  readFileSync(0, "utf8")
    .split("\n")
    .map((line) => line.split(" "));

const main = (input: string[][]) => {
  const s = input[0][0]
    .split("")
    .sort((a, b) => (a === b ? 0 : a > b ? 1 : -1))
    .join("");
  const t = input[1][0]
    .split("")
    .sort((a, b) => (a === b ? 0 : a > b ? -1 : 1))
    .join("");

  return s < t ? "Yes" : "No";
};

console.log(main(read()));


Measured memory_bytes: 29636
#include <iostream>
#include "bits/stdc++.h"

using namespace std;
#define print(x) cout<<x<<endl;
#define rep(i, a, b) for(ll i=a;i<b;i++)
#define REP(i, a) for(ll i=0;i<a;i++)
#define jkl ll debug = 0;
#define RREP(i, a) for(ll i=a;i>0;i--)
#define rrep(i, a, b) for(ll i=a-1;i>=b;i--)
#define printall(n, array) {for(ll i=0;i<n;i++){cout<<array[i]<<" ";}cout<<endl;}
#define U() cout<<endl;
#define mp make_pair
typedef long long ll;
typedef pair<ll, ll> Pi;
typedef pair<ll, Pi> V;
typedef vector<ll> VE;
typedef vector<vector<ll>> VVE;
const ll mod = 1e9 + 7; //10^9+7

int main() {
    ll x, y, z, k;
    cin >> x >> y >> z >> k;
    VE a(x), b(y), c(z);
    REP(i, x) cin >> a[i];
    REP(i, y) cin >> b[i];
    REP(i, z) cin >> c[i];
    sort(a.rbegin(), a.rend());
    sort(b.rbegin(), b.rend());
    sort(c.rbegin(), c.rend());
    unsigned long abSize = x * y;
    VE ab(abSize);
    REP(i, x) {
        REP(j, y) {
            ab.push_back(a[i] + b[j]);
        }
    }
    sort(ab.rbegin(), ab.rend());
    unsigned long abcSize = k * z;
    VE abc(abcSize);
    REP(i, k) {
        REP(j, z) {
            abc.push_back(ab[i] + c[j]);
        }
    }
    sort(abc.rbegin(), abc.rend());
    REP(i, k) {
        print(abc[i]);
    }
}

Measured memory_bytes: 64760
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> pi;
#define debug(x) cout << #x << ": " << x << endl
#define repn(i, a, b) for(int i = (a); i < (b); i++)
#define rep(i, a) for(int i = 0; i < (a); i++)
#define all(v) v.begin(), v.end() 
#define mp make_pair
#define pb push_back
#define fi first
#define se second
#define endl '\n'

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	//freopen("input.in", "r", stdin);
	//freopen("output.out", "w", stdout);
	int a, b;
	cin >> a >> b;
	if(a >= 13) cout << b << endl;
	else if (a <= 5) cout << 0 << endl;
	else cout << b / 2 << endl;
	return 0;
}
/*
Things to look out for:
	- Integer overflows
	- Array bounds
	- Special cases
Be careful!
*/


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

using namespace std;
#define int long unsigned int
int32_t main() {
    string s;
    cin>>s;
    int sum=0;
    for(int i=0;i<s.length();i++)
    {
        sum+=s[i]-48;
    }
    //cout<<sum;
    if(sum%9==0)
    cout<<"Yes";
    else
    cout<<"No";
    return 0;
}

Measured memory_bytes: 3696
n=int(input())
AC=0
WA=0
TLE=0
RE=0
for i in range(n):
    s=input()
    if s=="AC":
        AC+=1
    elif s=="WA":
        WA+=1
    elif s=="TLE":
        TLE+=1
    else:
        RE+=1
print("AC x "+str(AC))
print("WA x "+str(WA))
print("TLE x "+str(TLE))
print("RE x "+str(RE))

Measured memory_bytes: 9208
from collections import deque
S = str(input())
Q = int(input())
Qer = [list(map(str,input().split())) for i in range(Q)]
flag = True
anss = deque(S)
for i in range(Q):
    if Qer[i][0] == "1":
        flag = not flag
    else:
        if flag ==True:
            if Qer[i][1] =="1":
                anss.appendleft(Qer[i][2])
            else:
                anss.append(Qer[i][2])
        else:
            if Qer[i][1] =="2":
                anss.appendleft(Qer[i][2])
            else:
                anss.append(Qer[i][2])
anss=''.join(anss)
if flag == True:
    print(anss)
else:
    anss = anss[::-1]
    print(anss)

Measured memory_bytes: 44660
#include <iostream>
#include <math.h>
#include <algorithm>
#include <vector>
#include <cstring>
#define ll long long int
#define REP(i, n) for(ll i = 0; i < n; i++)
#define REPR(i, n) for(ll i = n; i >= 0; i--)
#define FOR(i, m, n) for(ll i = m; i < n; i++)
#define INF 2e9
#define ALL(v) v.begin(), v.end()
#define PI 3.141592653589793
using namespace std;

int main() {
    ll N,K,ans=0;

    cin >> N >> K;  
    vector<ll> H(N);
    for(ll i=0; i<N; i++)  cin >> H[i];

    sort(ALL(H));
    if(N < K) ans = 0;
    else {
        for(ll i=0; i<N-K; i++)  ans += H[i];
    }
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 1792
#include<bits/stdc++.h>
#define ll long long 
#define ld long double
#define X first
#define Y second
#define pb push_back
#define max_el(x) max_element(x.begin(),x.end())-x.begin()
#define min_el(x) min_element(x.begin(),x.end())-x.begin()
#define mp make_pair
#define endl '\n'
#define fastread ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
using namespace std;
// DONT USE MEMSET, USE VECTORS

int main(){
	fastread;
	ll n,k,x,y;
	cin>>n>>k>>x>>y;

	ll ans = min(n,k)*x;
	ans += max(0ll,n-k)*y;
	cout<<ans<<endl;
	return 0;
}


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

#define max(a,b) ((a)>(b)?(a):(b))
#define min(a,b) ((a)<(b)?(a):(b))

typedef long long LL;

struct num{
  LL v;
  int id;
  bool operator<(const struct num & right) const{
    return v<right.v;
  }
};


int main(){
  int n;
  cin >> n;
  vector<LL> a(3*n);
  for(int i=0;i<3*n;i++) cin >> a[i];
  LL zenhan=0,kouhan=0;
  vector<struct num> a2(2*n);
  vector<int> idtoa(2*n);
  vector<bool> used(2*n,false);
  for(int i=0;i<2*n;i++) a2[i]={a[n+i],i};
  sort(a2.begin(),a2.end());
  for(int i=0;i<n;i++) kouhan+=a2[i].v;
  for(int i=0;i<2*n;i++) idtoa[a2[i].id]=i;
  priority_queue<LL,vector<LL>, function<bool(LL,LL)>> zen(
    [](LL a, LL b){return a>b;}
  );
  for(int i=0;i<n;i++) zen.push(a[i]),zenhan+=a[i];
  LL ans=zenhan-kouhan;
  int r=n-1,id;
  for(int i=0;i<n;i++){
    zen.push(a[n+i]);
    zenhan+=a[n+i]-zen.top();
    zen.pop();
    used[idtoa[i]]=true;
    if(idtoa[i]<=r){
      kouhan-=a[n+i];
      r++;
      while(used[r]) r++;
      kouhan+=a2[r].v;
    }
    ans=max(ans,zenhan-kouhan);
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 7676
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll pp[] = {1, 2, 4, 8};
const ll ppp[] = {8, 4, 2, 1};
struct Point {
    ll pri, ans, vol;
    bool operator < (const Point& op2) const {
        return ans < op2.ans;
    }
} p[4];

ll tot;

int main(void) {
    for(int i = 0; i < 4; ++i) {
        scanf("%I64d", &p[i].pri);
        p[i].ans = p[i].pri * ppp[i];
        p[i].vol = pp[i];
    }
    sort(p, p + 4);
    scanf("%I64d", &tot);
    tot *= (ll)4;
    ll ans = 0;
    for(int i = 0; i < 4; ++i) {
        if(tot >= p[i].vol) {
            ll tmp = tot / p[i].vol;
            ans += p[i].pri * tmp;
            tot -= tmp * p[i].vol;
        }
    }
    printf("%lld\n", ans);
}


Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>
int main(void){
  int a,i;
  char S[101],b[101] = "x",c[101] = "x";
  
  scanf("%s",S);
  
  a = strlen(S);
  
  for(i = 1; i < a; i = i + 1){
    strcat(b,c);
  }
  printf("%s",b);
  return 0;
  }

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < n; i++)
#define rep2(i, x, n) for(int i = x; i < n; i++)
#define rep3(i, n) for(int i = n-1; i >= 0; i--)
#define rep4(i, x, n) for(int i = x; i > n; i--)
#define elif else if
typedef long long ll;
typedef pair<ll, ll> P;
const ll MOD = 1e9+7;
const ll MOD2 = 998244353;
const ll INF = 1e15;

int main(){
    int N;
    cin >> N;
    int A[N];
    rep(i, N) cin >> A[i];
    int num[N+1];
    fill_n(num, N+1, 0);
    rep(i, N) num[A[i]]++;
    int cnt[N+1];
    fill_n(cnt, N+1, 0);
    rep2(i, 1, N+1) cnt[num[i]]++;
    int dp[N+1];
    int sum = N;
    dp[0] = 0;
    rep2(i, 1, N+1){
        sum -= cnt[i-1];
        dp[i] = dp[i-1] + sum;
    }
    int S[N+1];
    S[0] = N;
    S[N+1] = 0;
    rep2(i, 1, N+1) S[i] = dp[i]/i;
    rep3(i, N+1){
        rep2(j, S[i+1]+1, S[i]+1) cout << i << endl;
    }
}

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

/*
  x := 会津地鶏の購入量, y := 普通の鶏肉の購入量 として
  q1 <= x + y
  0 < x <= q2
  0 <= y
  c1 * x + c2 * y <= b 
  を満たす(x,y)の中で x が最大のものを求める, 複数あるときはその中で y が最大のもの
  
  x == 0 のときは "NA" を出力する
*/
int q1, b, c1, c2, q2;

// 上記の式を満たさない (x,y) の組のときは -1 を, そうでないときは y を返す.
int f(int x){
	int y = (b - c1 * x) / c2;
	if( x+y < q1 ) return -1;
	if( y < 0 ) return -1;
	if( b - c1 * x < 0 ) return -1;
	return y;
}

int main(){	
	
	while( cin >> q1, q1 ){
		cin >> b >> c1 >> c2 >> q2;
		
		// x について二分探索
		int low=0, high=q2;
		while( high - low > 1 ){
			int mid = (low + high) / 2;
			if( f(mid) == -1 ){
				high = mid;
			}else{
				low = mid;
			}
		}
		int x, y;
		x = (f(high) == -1)? low : high ;
		y = f(x);
		if( x == 0 ){
			cout << "NA" << endl;
		}else{
			cout << x << " " << y << endl;
		}
	}
}

Measured memory_bytes: 1160
#include <iostream>
#include <cstdio>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <iomanip>
#include <stdlib.h>
#include <string.h>
#include <cstring>
#include <cmath>
#include <map>
#include <queue>
#include <deque>
#include <stack>
#include <set>
#include <stdio.h>
#include <tuple>
#include <bitset>
#include <cfloat>
#include <fstream>
#include <limits.h>
#include <list>
#include <math.h>
#include <random>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#include <numeric>
#include <utility>
#include <sstream>
// *テンプレート*
#define int long long
#define rep(i, n) for (int i = 0; i < (n); i++)
#define P pair<int, int>
#define sz(x) x.size()
// aよりbの方が小さかったら、aの値をbの値に置き換える。(swapではない！)
template<class T> inline bool chmin(T& a, T b) {
	if (a > b) {
		a = b;
		return true;
	}
	return false;
}
// aよりbの方が大きかったら、aの値をbの値に置き換える。
template<class T> inline bool chmax(T& a, T b) {
	if (a < b) {
		a = b;
		return true;
	}
	return false;
}

using namespace std;
typedef long long ll;
using Graph = vector<vector<int>>;
//最大公約数
ll gcd(ll a, ll b) {
	if (a < b)swap(a, b);
	if (b == 0) return a;
	return gcd(b, a % b);
}
//最小公倍数
ll lcm(ll a, ll b) {
	ll g = gcd(a, b);
	return a / g * b;
}
// 素数かどうか判定
bool prime(int n) {
	for (int i = 2; i <= sqrt(n); i++) {
		if (n%i == 0)return false;
	}
	return n != 1;
}


const long long MOD = 1000000007;
const long long INF = 1LL << 60;
// *テンプレートここまで*

// pair -> vector<pair<int,int>> 
//		   AandB.push_back(make_pair(a[i],b[i]))



signed main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	int n, T; cin >> n >> T;
	int ans = INF;
	rep(i, n) {
		int c, t; cin >> c >> t;
		if (t <= T) {
			chmin(ans, c);
		}

	}
	if(ans!=INF)cout << ans << endl;
	else cout << "TLE" << endl;
	return 0;
}

Measured memory_bytes: 256
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")

#include <iostream>
#include <fstream>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <vector>
#include <string>
#include <queue>
#include <deque>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <sstream>
#include <iomanip>

using namespace std;

typedef long long ll;
typedef vector <int> vi;
typedef vector <vector <int>> vii;
typedef vector <long long> vll;
typedef vector <string> vs;
typedef vector <char> vc;
typedef set <int> si;
typedef set <string> ss;
typedef queue <int> qi;
typedef queue <long long> qll;
typedef queue <string> qs;
typedef queue <char> qc;
typedef struct board board;
typedef pair <int, int> pi;
typedef pair <long long, long long> pll;
typedef pair <int, pair<int, int>> pii;

#define eb emplace_back
#define ppb pop_back
#define clr(a) a.clear()
#define F first
#define S second
#define mkp make_pair

#define sz(x) (int)(x).size()
#define all(x) (x).begin(), (x).end()

#define left(x) x * 2
#define right(x) x * 2 + 1

#define meme(a, b, c) fill(a + 1, a + 1 + b, c)

#define max(a, b) (a > b ? a : b)
#define min(a, b) (a > b ? b : a)
#define abs(a) (a > 0? a : -(a))

#define move(s) s += "#"

#define eprintf(...) fprintf(stderr, __VA_ARGS__);

template <typename T>
void printArr(const T * arr, int s, int fn) {
    for (int i = s; i <= fn; ++ i) cout << arr[i] << " ";
    cout << '\n';
}

template <typename T>
long long minArr(const T * arr, int s, int fn) {
    ll res = 1e16 + 1;
    for (int i = s; i <= fn; ++ i) {
        res = min(res, arr[i]);
    }
    return res;
}

template <typename T>
void printVec(const T * arr) {
    for (int i = 0; i < sz(arr); ++ i) cout << arr[i] << " ";
    cout << '\n';
}

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

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

void to_pray() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    cerr << "Ready\n";
}

const int N = 4e6 + 10;
const int NN = 1e3 + 10;
const int NNN = 2e3 + 9;
const int MOD = 1e9 + 7;
const int INF = 1e9 + 7;
const ll LLINF = 1e12 + 7;
const ll P = 53;
const int EPS = 1e-9 - 8;
const int vN = 2e4 + 10;
const int sz = (1 << 22) - 1;
const double PI = acos(-1);

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

    cout << min(a + b, min(b + c, a + c));
    
    //eprintf("%.18lf seconds\n", (double)clock() / CLOCKS_PER_SEC);

    cerr << '\n';
    
    return 0;
}

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

int main(int argc, char* argv[]){
    int A, B, C, X, Y, ans = 0, m;
    cin >> A >> B >> C >> X >> Y;
    if(2*C < A+B){
        m = min(X, Y);
        ans += 2 * m * C;
        X -= m;
        Y -= m;
    }
    if(2*C < A){
        ans += X * 2 * C;
        X = 0;
    }
    if(2*C < B){
        ans += Y * 2 * C;
        Y = 0;
    }
    ans += X * A;
    ans += Y * B;
    cout << ans << endl;
}


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

using ll = long long;
using ull = unsigned long long;
using ld = long double;

#define MOD 1000000007LL

#define rep(i, n) for(ll (i) = 0LL;(i) < (ll)(n);(i)++)
#define rep2(i, s, e) for(ll (i) = (ll)(s);(i) < (ll)(e);(i)++)
#define repi(i, n) for(ll (i) = 0LL;(i) <= (ll)(n);(i)++)
#define repi2(i, s, e) for(ll (i) = (ll)(s);(i) <= (ll)(e);(i)++)
#define per(i, n) for(ll (i) = (ll)(n) - 1LL;(i) >= 0LL;(i)--)
#define per2(i, s, e) for(ll (i) = (ll)(s) - 1LL;(i) >= (ll)(e);(i)--)
#define peri(i, n) for(ll (i) = (ll)(n);(i) >= 0LL;(i)--)
#define peri2(i, s, e) for(ll (i) = (ll)(s);(i) >= (ll)(e);(i)--)
#define iter(i, it) for(auto &(i): (it))

template<typename T, typename U> ostream& operator<<(ostream &s, const pair<T, U> m) {
    cout << "(" << m.first << ", " << m.second << ")";
    return s;
}
template<typename T, typename U> ostream& operator<<(ostream &s, const map<T, U> m) {
    ll c = 0;
    cout << "{ ";
    iter(i, m) cout << i << (c++ == m.size() - 1 ? " " : ", ");
    cout << "}";
    return s;
}
template<typename T> ostream& operator<<(ostream &s, const vector<T> &v) {
    cout << "{ ";
    rep(i, v.size()) cout << v[i] << (i == v.size() - 1 ? " " : ", ");
    cout << "}";
    return s;
}
template<typename T> ostream& operator<<(ostream &s, const list<T> &v) {
    ll c = 0;
    cout << "{ ";
    iter(i, v) cout << i << (c++ == v.size() - 1 ? " " : ", ");
    cout << "}";
    return s;
}

int main(void) {
    string N;
    cin >> N;
    ll sum = 0;
    iter(c, N) sum += c - '0';
    if(sum % 9 == 0) cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}


Measured memory_bytes: 3764
#include <bits/stdc++.h>
using namespace std;
int n, m;
const int N = 16;
const int P = 40000;
const int M = 15000000;
const int INF = 1000000000;
vector <int> bi[N], ci[N];
int L[P];
int f[P][N], g[M], h[P][N];
int merge(int a, int b)
{
    int s = 0, k = 1;
    for (int i = 0; i < n; ++ i, k *= 3)
        if (a & (1 << i)) s += k;
        else if (b & (1 << i)) s += k * 2;
    return s;
}
int main()
{
    cin >> n >> m;
    for (int i = 1; i <= m; ++ i)
    {
        int a, b, c;
        cin >> a >> b >> c;
        bi[a].push_back(b); ci[a].push_back(c);
        bi[b].push_back(a); ci[b].push_back(c);
    }
    for (int i = 1; i <= n; ++ i) L[1 << (i - 1)] = i;
    for (int i = 1; i < (1 << n); ++ i)
        for (int j = 1; j <= n; ++ j)
            if (((1 << (j - 1)) & i) == 0)
                for (int k = 0; k < bi[j].size(); ++ k)
                    if ((1 << (bi[j][k] - 1)) & i)
                        f[i][j] += ci[j][k];
    for (int i = 1; i < (1 << n); ++ i)
        for (int j = i & (i - 1); j; j = i & (j - 1))
        {
            int p = L[j & (-j)];
            g[merge(i ^ j, j)] = g[merge(i ^ j, j ^ (1 << (p - 1)))] + f[i ^ j][p];
        }
    for (int i = 0; i < (1 << n); ++ i)
        for (int j = 1; j <= n; ++ j)
            h[i][j] = INF;
    h[1][1] = 0;
    for (int i = 1; i < (1 << n); ++ i)
        for (int j = 1; j <= n; ++ j)
            if (h[i][j] != INF)
            {
                for (int k = 0; k < bi[j].size(); ++ k)
                    if (((1 << (bi[j][k] - 1)) & i) == 0)
                        h[i | (1 << (bi[j][k] - 1))][bi[j][k]] = min(h[i | (1 << (bi[j][k] - 1))][bi[j][k]], h[i][j] + f[i][bi[j][k]] - ci[j][k]);
                int o = ((1 << n) - 1) ^ i;
                for (int k = o; k; k = (k - 1) & o)
                    h[i | k][j] = min(h[i | k][j], h[i][j] + g[merge(i ^ (1 << (j - 1)), k)]);
            }
    cout << h[(1 << n) - 1][n] << endl;
}


Measured memory_bytes: 63744
#include<bits/stdc++.h>
using namespace std;
int main(){
	string s;
	cin>>s;
	int l=s.size();
	bool ans=false;
	for(int i=97;i<123;i++){
		char x=i;
		for(int j=0;j<l;j++){
			if(x==s[j])break;
			if(j==l-1)ans=true;
		}
		if(ans==true){
			cout<<x<<endl;
			break;
		}
	}
	if(ans==false)puts("None");
	return 0;
}


Measured memory_bytes: 512