akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define all(v) v.begin(), v.end()
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define Rep(n) for (ll _ = 0; _ < (ll)(n); _++)

template<class S>S sum(vector<S>&a){return accumulate(all(a),S());}
template<class S>S max(vector<S>&a){return *max_element(all(a));}
template<class S>S min(vector<S>&a){return *min_element(all(a));}
ll max(int a,ll b){return max((ll)a,b);} ll max(ll a,int b){return max(a,(ll)b);}
ll min(int a,ll b){return min((ll)a,b);} ll min(ll a,int b){return min(a,(ll)b);}

#define PRINT_VECTOR_MAX 100
template <class S> void print(vector<S> &v){for(ll i=0; i<(ll)min(v.size(),PRINT_VECTOR_MAX); i++){cerr << v[i] << ' ';}cerr << endl;}
template <class S> void print(vector<vector<S>> &v) {for (ll i = 0; i < (ll)min(v.size(),PRINT_VECTOR_MAX); i++) {for (ll j = 0; j < (ll)min(v[i].size(),PRINT_VECTOR_MAX); j++) {cerr << v[i][j] << ' ';}cerr << endl;}}

void Main();
int main(){
	cin.tie(nullptr);
	ios_base::sync_with_stdio(false);
	cout << fixed << setprecision(20);
	Main();
	return 0;
}

const int mod = 1000000007;
struct mint {
  ll x;  // typedef long long ll;
  mint(ll x = 0) : x((x % mod + mod) % mod) {}
  mint operator-() const { return mint(-x); }
  mint& operator+=(const mint a) {
    if ((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += mod - a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*=(const mint a) {
    (x *= a.x) %= mod;
    return *this;
  }
  mint operator+(const mint a) const { return mint(*this) += a; }
  mint operator-(const mint a) const { return mint(*this) -= a; }
  mint operator*(const mint a) const { return mint(*this) *= a; }
  mint pow(ll t) const {
    if (!t) return 1;
    mint a = pow(t >> 1);
    a *= a;
    if (t & 1) a *= *this;
    return a;
  }

  // for prime mod
  mint inv() const { return pow(mod - 2); }
  mint& operator/=(const mint a) { return *this *= a.inv(); }
  mint operator/(const mint a) const { return mint(*this) /= a; }
};
istream& operator>>(istream& is, const mint& a) { return is >> a.x; }
ostream& operator<<(ostream& os, const mint& a) { return os << a.x; }

void Main(){
	int n; cin >> n;
	if(n == 1){
		cout << 0 << endl;
	}else{
		mint ans = mint(10).pow(n) - mint(2) * mint(9).pow(n) + mint(8).pow(n);
		cout << ans << endl;
	}
}

Measured memory_bytes: 3640
#include<bits/stdc++.h> 
using namespace std;
typedef long long ll;
template<typename T1,typename T2> bool chmin(T1 &a,T2 b){if(a<=b)return 0; a=b; return 1;}
template<typename T1,typename T2> bool chmax(T1 &a,T2 b){if(a>=b)return 0; a=b; return 1;}




signed main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << fixed << setprecision(20);
 
    ll n,c;
    cin>>n>>c;
    ll x[n],v[n];
    for(int i=0;i<n;i++){
        cin>>x[i]>>v[i];
    }
    ll ans = 0;
    ll l[n+1]={};
    for(int i=0;i<n;i++){
        l[i+1] = l[i] + v[i];
        chmax(ans,l[i+1] - x[i]);
    }
    ll r[n+1] = {};
    for(int i=n-1;i>=0;i--){
        r[i] = r[i+1] + v[i];
        chmax(ans, r[i] - (c-x[i]));
    }
    cerr << "l " << ans << endl;
    ll rl[n+1]={},rr[n+1]={};
    for(int i=0;i<n;i++){
        rl[i+1] = l[i+1] - x[i]*2;
        chmax(rl[i+1],rl[i]);
    }
    for(int i=n-1;i>=0;i--){
        rr[i] = r[i] - (c - x[i])*2;
        chmax(rr[i],rr[i+1]);
    }
    for(int i=1;i<n;i++){
        ll ret = l[i+1] + rr[i+1] - x[i];
        chmax(ans,ret);
        ret = r[i] + rl[i] - (c-x[i]);
        chmax(ans,ret);
    }
    cout << ans << endl;
}

Measured memory_bytes: 4992
#include <bits/stdc++.h>
#include <cstdio>
#include <cstdlib>

#ifdef _MSC_VER
#include <Windows.h>
#else
#include <unistd.h>
#endif

using namespace std;

//conversion
//------------------------------------------
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

//math
//-------------------------------------------
template<class T> inline T sqr(T x) {return x*x;}

//typedef
//------------------------------------------
typedef pair<int, int> PII;
typedef pair<long, long> PLL;
typedef long long LL;
//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB emplace_back
#define MP make_pair
#define SZ(a) int((a).size())
#define SORT(c) sort((c).begin(),(c).end())

//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI  = acos(-1.0);
const LL MOD=(double)1e9+7;
//clear memory
#define CLR(a) memset((a), 0 ,sizeof(a))


LL a[300003],bef[300003],af[300003];
int main(){
    int N;cin>>N;
    REP(i,3*N){
        cin>>a[i];
    }
    priority_queue<LL, vector<LL>, greater<LL>>pq_min;
    priority_queue<LL>pq_max;
    LL asum=0LL,bsum=0LL;
    REP(i,N){
        asum+=a[i];
        bsum+=a[3*N-1-i];
        pq_min.push(a[i]);
        pq_max.push(a[3*N-1-i]);

    }
    bef[N-1]=asum;
    af[2*N]=bsum;
    REP(i,N){
        pq_min.push(a[i+N]);
        pq_max.push(a[2*N-1-i]);
        LL tmp=pq_min.top();pq_min.pop();
        bef[N+i]=bef[N+i-1]+a[i+N]-tmp;
        tmp=pq_max.top();pq_max.pop();
        af[2*N-1-i]=af[2*N-i]+a[2*N-1-i]-tmp;
    }
    LL res=bef[N-1]-af[N];
    REP(i,N+1){
        //cout<<bef[N-1+i]<<" "<<af[N+i]<<endl;
        res=max(bef[N-1+i]-af[N+i],res);
    }
    cout<<res<<endl;
    return 0;
}

Measured memory_bytes: 7788
#coding:utf-8

K, A, B = list(map(int, input().split()))
answer = 0

if B - A <= 2:
    answer = 1 + K


else:
    K = K - A + 1
    answer = A
    answer += int(K/2) * (B-A)
    if K % 2 ==1:
        answer += 1

print(answer)        
    


Measured memory_bytes: 2940
#include<bits/stdc++.h>
using namespace std;
int main(){
string w;
cin>>w;
map<char , int > mp;

for(int i=0 ; i<w.size() ; i++){
   char x = w[i];
   mp[x]++;
}
bool flag = 1;
for(auto v : mp){
    if(v.second % 2 == 1) flag = 0;
}

if(flag) cout<<"Yes"<<endl;
else cout<<"No"<<endl;

}


Measured memory_bytes: 3632
#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>
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;
vector<int> as;
vector<bool> ans;
vector<int> ans_;

void solve(){
    cin >> n;
    ans.resize(n,0);
    rep(i,n){
        int a;
        cin >> a;
        as.push_back(a);       
    }
    per(i,n){
        int d=2;
        int m=0;
        while (d*(i+1)<=n){
            m+=ans[d*(i+1)-1];
            d+=1;
        }
        ans[i]=!(m%2==as[i]);
        if (ans[i]) ans_.push_back(i+1);
    }
    cout << ans_.size() << endl;
    rep(i,n){
        if (ans[i]) cout << i+1 << " ";
    }

}

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

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

#define MAXN 20010
using namespace std;

int n, x, y, ans[MAXN];

int main() {	
	cin >> n >> x >> y;
	for (int i = 1; i <= n; ++i)
		for (int j = i + 1; j <= n; ++j) {
			if (i <= x) {
				if (j <= x)
					ans[j - i]++;
				else if(j <= y)
					ans[min(j - i, (x - i) + 1 + (y - j))]++;
				else
					ans[x - i  + 1 + j - y]++;
			}
			else if (i <= y)
			{
				if (j <= y)
					ans[min(j - i, i - x + 1 + y - j)]++;
				else
					ans[min(j -  i, j - y + 1 + i - x)]++;
			}
			else
				ans[j - i]++;
		}
	for(int i = 1; i < n; ++i)
		cout << ans[i] << endl;
	return 0;
}

Measured memory_bytes: 256
//AnkitCode99
#include<bits/stdc++.h>
#define endl "\n"
#define ll long long int
#define MOD 1000000007
#define mp make_pair
#define pb push_back
#define vl vector<ll>
#define all(v) (v.begin(),v.end())
#define fast ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define rep(i,a,b) for(long long int i=a;i<b;i++)
#define nrep(i,a,b) for(long long int i=a;i>=b;i--)
using namespace std;
int main()
{
	fast;
 //   #ifndef ONLINE_JUDGE
	// freopen("input.txt","r",stdin);
	// freopen("output.txt","w",stdout);
	// #endif
	
	ll n;
	cin>>n;
	ll a[n],dp[n];
	rep(i,0,n)
	{
		cin>>a[i];
	}
	dp[0]=0;
	dp[1]=abs(a[0]-a[1]);
	rep(i,2,n)
	{
		dp[i]=min(abs(a[i]-a[i-1])+dp[i-1],abs(a[i]-a[i-2])+dp[i-2]);
	}
	cout<<dp[n-1]<<endl;
}

Measured memory_bytes: 1792
#include <iostream>
#include <string>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <algorithm>
#include <sstream>
#include <cmath>
#include <set>
#include <iomanip>
#include <deque>
#include <stdio.h>
using namespace std;

#define REP(i,n) for(int (i)=0;(i)<(int)(n);(i)++)
#define RREP(i,n) for(int (i)=(int)(n)-1;i>=0;i--)
#define FILL(Itr,n) fill((Itr).begin(),(Itr).end(),n)
#define REMOVE(Itr,n) (Itr).erase(remove((Itr).begin(),(Itr).end(),n),(Itr).end())
#define UNIQUE(Itr) sort((Itr).begin(),(Itr).end()); (Itr).erase(unique((Itr).begin(),(Itr).end()),(Itr).end())
#define LBOUND(Itr,val) lower_bound((Itr).begin(),(Itr).end(),(val))
#define UBOUND(Itr,val) upper_bound((Itr).begin(),(Itr).end(),(val))
typedef long long ll;
#define MOD 1000000007

int main(){
    
    int a,b; cin>>a>>b;
    if(a==b){
        cout<<"Draw"<<endl;
    }else{
        a+=11; b+=11;
        a%=13; b%=13;
        if(a<b){
            cout<<"Bob"<<endl;
        }else{
            cout<<"Alice"<<endl;
        }
    }
    
    
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll =long long;
#define all(v) v.begin(),v.end()
 
int main() {
string S;
  cin>>S;
  string T;
  ll N=S.size();
 for(ll i=0;i<N/2;i++) {
   S.pop_back();
   S.pop_back();
   string T;
   for(ll j=0;j<S.size()/2;j++) {
T+=S[j];
   }
   
   T+=T;
   if(T==S) {
     cout<<T.size()<<endl;
     return 0;
   }
 }
}
   
   

    

Measured memory_bytes: 3604
#include <stdio.h>
 
#define MAX 500000
 
int a[MAX],n,ntc=0,pet[MAX];
 
void mg(int x[],int ll,int ri){
  int i,j,k;
  if(ll>=ri) return;
 
  mg(x,ll,(ll+ri)/2);
  mg(x,((ll+ri)/2+1),ri);
 
  for(i=ll;i<=(ll+ri)/2;i++){
    pet[i]=x[i];
  }
  for(i=((ll+ri)/2+1),j=ri;i<=ri;i++,j--){
    pet[i]=x[j];
  }
  i=ll;
  j=ri;
  for(k=ll;k<=ri;k++){
    if(pet[i]<=pet[j]) x[k]=pet[i++];
    else x[k]=pet[j--];
    ntc++;
  }
}
int main(){
  int i;
  scanf("%d",&n);
  for(i=0;i<n;i++) scanf("%d",&a[i]);
  mg(a,0,n-1);
  for(i=0;i<n-1;i++) printf("%d ",a[i]);
  printf("%d\n%d\n",a[n-1],ntc);
  return 0;
}
 

Measured memory_bytes: 4504
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define FOR(I,A,B) for(ll I = (A); I < (B); ++I)
const ll INF=1e15+7;
const ll N = 1002;
ll a,b,k;

int main(){
	cin>>a>>b>>k;
	ll o=min(a+k,b+1);
	for(ll i=a;i<o;i++){
		cout<<i<<endl;
	}
	o=max(a+k,b-k+1);
	for(ll i=o;i<b+1;i++){
		cout<<i<<endl;
	}
	return 0;
}


Measured memory_bytes: 256
#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
#pragma GCC optimization ("unroll-loops")
#include <iostream>
#include <fstream>
#include <algorithm>
#include <vector>
#include <set>
#include <stack>
#include <map>
#include <iomanip>
#include <cmath>
#include <queue>
#include <bitset>
#include <numeric>
#include <array>
#include <cstring>
#include <random>
#include <chrono>
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define make_unique(x) sort(all((x))); (x).resize(unique(all((x))) - (x).begin())
typedef long long ll;
typedef long double ld;
using namespace std;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
int main() {

  ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);

  int n = 0;

  cin >> n;

  double x,y;

  double D;

  cin >> D;

  int ans = 0;

  for(int i = 0; i < n; i++) {
    cin >> x >> y;
    if(ceil(sqrt(x * x + y * y)) <= D) ans++;
  }

  cout << ans;

  return 0;
}
/*

*/


Measured memory_bytes: 3808
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int W = sc.nextInt();
		int a = sc.nextInt();
		int b = sc.nextInt();
		if(a <= b){
			if(b - (a + W) > 0){
				System.out.println(b - (a + W));
			}
			else if(b - (a + W) <= 0){
				System.out.println(0);
			}
		}
		if(a > b){
			if(a - (b + W) > 0){
				System.out.println(a - (b + W));
			}
			else if(a - (b + W) <= 0){
				System.out.println(0);
			}
		}

	}

}


Measured memory_bytes: 21844
# include <iostream>
# include <algorithm>
# include <vector>
# include <string>
# include <set>
# include <map>
# include <cmath>
# include <iomanip>
# include <functional>
# include <utility>
# include <stack>
# include <queue>
# include <list>
# include <tuple>
# include <unordered_map>
# include <numeric>
# include <complex>
using namespace std;
using LL = long long;
using ULL = unsigned long long;
constexpr int INF = 2000000000;
constexpr int HINF = INF / 2;
constexpr double DINF = 100000000000000000.0;
constexpr long long LINF = 9223372036854775807;
constexpr long long HLINF = 4500000000000000000;
constexpr long long MMOD = 500000004;
const double PI = acos(-1);
int dx[4] = { 0,1,0,-1 }, dy[4] = { 1,0,-1,0 };
# define ALL(x)     (x).begin(),(x).end()
# define UNIQ(c)    (c).erase(unique(ALL((c))), end((c)))
# define mp         make_pair
# define eb         emplace_back
# define FOR(i,a,b) for(int i=(a);i<(b);++i)
# define REP(i,n)   FOR(i,0,n)
# define INIT       std::ios::sync_with_stdio(false);std::cin.tie(0);

LL k, a[101010];
LL l = 2,r = 2;

int main() {
	cin >> k;
	for (int i = 1; i <= k; i++) {
		cin >> a[i];
	}
	for (int i = k; i >= 1; i--) {
		LL p1 = (l + a[i] - 1) / a[i], p2 = r / a[i];
		p1 *= a[i];
		p2 *= a[i];
		if (p1 > p2) {
			cout << -1 << endl;
			return 0;
		}
		l = p1, r = p2 + a[i] - 1;
	}
	cout << l << " " << r << endl;
}

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

#undef _P
#define _P(...) (void)printf(__VA_ARGS__)
#define FOR(x,to) for(x=0;x<(to);x++)
#define FORR(x,arr) for(auto& x:arr)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define ALL(a) (a.begin()),(a.end())
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
//-------------------------------------------------------


void solve() {
    ll i,j,k,l,r,x,y; string s;
    bool exit = false;
    ll N,K,ret;
    cin>>N>>K;
    if(0==K%2){
        ll evenNum = N/(K/2) / 2;
        ll oddNum = N/(K/2) - evenNum;
        ret = evenNum*evenNum*evenNum;
        ret += oddNum*oddNum*oddNum;
    }else{
        x = N/K;
        ret = x*x*x;
    }
    cout<<ret<<endl;
    /*cin>>N;
    vector<ll> V;
    FOR(x,N+1) {
            FOR(y,N+1) {
                    ll ret=1;
                    FOR(i,x) ret*=2;
                    FOR(i,y) ret*=5;
                    V.push_back(ret);
            }
    }
    sort(ALL(V));
    FORR(v,V) cout<<v<<endl;*/
}


int main(int argc,char** argv){
	string s;int i;
	if(argc==1) ios::sync_with_stdio(false), cin.tie(0);
	FOR(i,argc-1) s+=argv[i+1],s+='\n'; FOR(i,s.size()) ungetc(s[s.size()-1-i],stdin);
	cout.tie(0); solve(); return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
#define fastIO (cin.tie(0), cout.tie(0), ios::sync_with_stdio(false))
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define precise(i) fixed << setprecision(i)
using li = long long int;
using uli = unsigned long long int;
using namespace std;

int find_mind(const vector<string> &cell, int i, int j, int height, int width) {
    int cnt = 0;
    for (auto x : {-1, 0, 1}) {
        for (auto y : {-1, 0, 1}) {
            int h = i + x;
            int w = j + y;
            if (0 <= h && h <= height - 1 && 0 <= w && w <= width - 1) {
                if (cell.at(h).at(w) == '#')
                    cnt++;
            }
        }
    }
    return cnt;
}

int main() {
    fastIO;
    int h, w;
    cin >> h >> w;
    vector<string> cells(h);
    rep(i, h) cin >> cells.at(i);

    rep(i, h) {
        rep(j, w) {
            if (cells.at(i).at(j) != '#') {
                // find mines around cell
                int num = find_mind(cells, i, j, h, w);
                cells.at(i).at(j) = (char)(num + '0');
            }
        }
    }

    // output
    rep(i, h) {
        rep(j, w) cout << cells.at(i).at(j);
        cout << endl;
    }
}

Measured memory_bytes: 3548
#include <algorithm>
#include <iostream>
 
using namespace std;
 
int main(){
 
    int DataSetNum = 0;
    int HouseNum = 0;
    int GeneNum = 0;
    int* HousePos;
    int* CableLength;
    int AllCableLength = 0;
 
    cin >> DataSetNum;
    for (int datanum = 0; datanum < DataSetNum; ++datanum){

        cin >> HouseNum;
        cin >> GeneNum;
        if (HouseNum <= GeneNum){
            int dummy = 0;//?????????????????¨???
            for (int i = 0; i < HouseNum; ++i){
                cin >> dummy;
            }
            cout << 0 << endl;
            continue;
        }
        HousePos = new int[HouseNum];
        for (int i = 0; i < HouseNum; ++i){
            cin >> HousePos[i];
        }
        CableLength = new int[HouseNum - 1];
        for (int i = 0; i < HouseNum - 1; ++i){
            CableLength[i] = HousePos[i + 1] - HousePos[i];
        }
        AllCableLength = HousePos[HouseNum - 1] - HousePos[0];

        sort(&CableLength[0], &CableLength[0]+HouseNum-1);
        for (int i = 0; i < GeneNum - 1; ++i){
            AllCableLength -= CableLength[HouseNum - i - 2];
            CableLength[HouseNum - i - 2] = 0;
        }

        cout << AllCableLength << endl;
 
        delete[] CableLength;
        delete[] HousePos;
    }
 
    return 0;
}

Measured memory_bytes: 1860
N = int(input())
A = list(map(int, input().split()))
if 0 in A:
  mul = 0
else:
  mul = 1
  for i in range(N):
    mul = mul * A[i]
    if mul > 10**18:
      break
if mul>10**18:
  print(-1)
else:
  print(mul)

Measured memory_bytes: 21652
#include<stdio.h>


int main(){
  
  int a,b,c,rest;
  scanf("%d %d %d",&a,&b,&c);
  rest = c-(a-b);
  
  if (rest <= 0)
    printf("0");
  else
    printf("%d",rest);
  
  return 0;
  
  
}

Measured memory_bytes: 128
#include <algorithm>
#include <cassert>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <vector>

using namespace std;

typedef long long ll;

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;
}

ll num_of_patty_for(const int n) {
    if (n == 1) {
        return 3LL;
    } else {
        return num_of_patty_for(n - 1) * 2LL + 1LL;
    }
}

ll size_of_hamburger_for(const int n) {
    if (n == 1) {
        return 5LL;
    } else {
        ll ans = size_of_hamburger_for(n - 1) * 2LL + 3LL;
        return ans;
    }
}

ll solve(const ll n, ll x) {
    ll res = 0;

    const ll ham_size = size_of_hamburger_for(n);

    // printf("n: %lld, x: %lld\n", n, x);

    if (x > ham_size) {
        x = ham_size;
    }

    if (n == 1) {
        assert(x >= 1 && x <= 5);
        vector<ll> tmp = {0LL, 0LL, 1LL, 2LL, 3LL, 3LL};
        return tmp[x];
    }

    if (x == 1) {
        return 0LL;
    }

    const ll center = (ham_size - 3LL) / 2LL + 2LL;
    if (x == center) {
        // at the center
        res++;
        res += num_of_patty_for(n - 1);
    } else if (2 * x > ham_size) {
        // left
        res++;
        res += num_of_patty_for(n - 1);
        res += solve(n - 1, x - center);
    } else {
        // right
        res += solve(n - 1, x - 1);
    }

    return res;
}

int main(void) {
    ll N, X;
    cin >> N >> X;

    cout << solve(N, X) << endl;

    return 0;
}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(){
int H,W;
cin>>H>>W;
while(1){
	if(H==0&&W==0)break;
for(int i=0;i<H;i++){
	for(int j=0;j<W;j++){
		if(i%2==0&&j%2==0||i%2==1&&j%2==1)
			cout<< "#";
	  else cout<< ".";
	}cout<<endl;
  }
cout<<endl;
cin>>H>>W;
}
return 0;
}


Measured memory_bytes: 3084
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        int c = b - a;
        int d = (c * (c + 1)) / 2 - b;
        System.out.println(d);
    }
}

Measured memory_bytes: 23124
#include<stdio.h>
int main(){
    int a,b,x,ans=0;
    scanf("%d%d%d",&a,&b,&x);
    if(a<b*2&&x>500&&x<=1000)ans=a;
    else if(a<b*2&&a<b&&x<=500)ans=a;
    else if(a<b*2){
        if(x%1000>0&&x%1000<=500)ans=x/1000*a+b;
        else if(x%1000>0&&x%1000>500)ans=x/1000*a+a;
        else ans=x/1000*a;
    }
    else{
        if(x%500>0)ans=x/500*b+b;
        else ans=x/500*b;
    }
    printf("%d\n",ans);
    return 0;
}


Measured memory_bytes: 2144
#include <cmath>
#include <cstdio>
#include <set>
typedef long long lld;
std::set<lld> candid;
lld N, Nsqrt, S;

lld f(lld b, lld n)
{	// TC: O(logN)
	if((b > n) || (b==1))
		return n;
	return f(b, n/b) + (n % b);
}
// Systems with Two Digits:
// p*B + q = N   p + q = S
int main()
{
	scanf(" %lld%lld", &N, &S);
	if(S >  N)
		return puts("-1"), 0;
	if(S == N)
		return printf("%lld\n", N+1) & 0;
	Nsqrt = sqrt(N);
	for(int B = 2; B <= Nsqrt; ++B)
		if(f(B, N) == S) candid.insert(B);
	for(lld P = 1; (P*P < N) && (P <= S); ++P)
	{
		lld Q = S - P;
		if((N >= Q) && !((N-Q) % P))
		{
			lld B =  (N-Q) / P;
			if((B > P) && (B > Q))
				candid.insert(B);
		}	// Base must be > Digits!
	}
	if(!candid.empty())
		printf("%lld\n", *candid.begin());
	else
		puts("-1");
	return 0;
}

Measured memory_bytes: 256
def actual(N):
    oks = []

    for idx, n in enumerate(range(4, 104, 4), start=1):
        for i in range(idx + 1):
            satisfied_value = n + (3 * i)

            if satisfied_value <= 100:
                oks.append(satisfied_value)

    oks = sorted(set(oks))

    if N in oks:
        return 'Yes'

    return 'No'
  
N = int(input())
print(actual(N))

Measured memory_bytes: 9120
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <tuple>
#include <map>
#include <queue>
#include <set>
typedef long long ll;
using namespace std;
#define rep(i, n) for (int i = 0; i < int(n); i++)
#define mod 1000000007
#define fst first
#define pb push_back

int main()
{
    int A,B;
    cin >> A >> B;
    int ans = 0;
    int tap = 1;
    while(tap < B){
        --tap;
        tap += A;
        ++ans;
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
N,M,X,Y=map(int, input().split())
x=list(map(int, input().split()))
y=list(map(int, input().split()))

if Y-X>=1:
    Z=range(X+1,Y+1)
    for z in Z:
        if max(x)<z and min(y)>=z:
            print("No War")
            exit()
print("War")

Measured memory_bytes: 3060
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cctype>
#include <cassert>
#include <climits>
#include <string>
#include <bitset>
#include <cfloat>
#include <random>
#include <iomanip>
#include <unordered_set>
using namespace std;
typedef long double ld;
typedef long long int ll;
typedef unsigned long long int ull;
typedef vector<int> vi;
typedef vector<char> vc;
typedef vector<bool> vb;
typedef vector<double> vd;
typedef vector<string> vs;
typedef vector<ll> vll;
typedef vector<pair<int,int> > vpii;
typedef vector<pair<ll,ll> > vpll;
typedef vector<vi> vvi;
typedef vector<vvi> vvvi;
typedef vector<vc> vvc;
typedef vector<vs> vvs;
typedef vector<vll> vvll;
typedef map<int,int> mii;
typedef set<int> si;
#define rep(i,n) for(ll i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define arep(i,v) for(auto i : v)
#define irep(it, stl) for(auto it = stl.begin(); it != stl.end(); it++)
#define drep(i,n) for(int i = (n) - 1; i >= 0; --i)
#define fin(ans) cout << (ans) << '\n'
#define STLL(s) strtoll(s.c_str(), NULL, 10)
#define mp(p,q) make_pair(p, q)
#define pb(n) push_back(n)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define Sort(a) sort(a.begin(), a.end())
#define Rort(a) sort(a.rbegin(), a.rend())
#define MATHPI acos(-1)
#define fi first
#define se second
constexpr int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
constexpr int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
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;}
template <class T> inline void dump(T &v){irep(i, v){cout<<*i<<((i==--v.end())?'\n':' ');}}
inline string getline(){string s; getline(cin,s); return s;}
inline void yn(const bool b){b?fin("yes"):fin("no");}
inline void Yn(const bool b){b?fin("Yes"):fin("No");}
inline void YN(const bool b){b?fin("YES"):fin("NO");}
struct io{io(){ios::sync_with_stdio(false);cin.tie(0);}};
const int INF = INT_MAX;
constexpr ll LLINF = 1LL<<60;
constexpr ll MOD = 1000000007;
constexpr ld EPS = 1e-11;



int main() {
    
    int n;
    cin>>n;
    int k;
    cin>>k;
    ll bit=0;
    rep(i,k){
        int t;
        cin>>t;
        bit|=(1LL<<t);
    }
    rep(i,1LL<<n){
        if(i>=bit&&((bit&i)==bit)){
            cout<<i<<":";
            rep(j,19){
                if((1LL<<j&i))cout<<" "<<j;
            }
            cout<<endl;
        }
    }
}


Measured memory_bytes: 3116
#include<stdio.h>

int main(void)
{
  char str[100000] = {0};
  char c;
  int i=0;//forループ
  int flag;

  scanf("%s", str);
  for(c = 'a'; c <= 'z'; c++){
    flag = 0;
    while(str[i] != '\0'){
      if(c == str[i]){
        flag = 1;
      }
      i++;
    }
    i = 0;
    if(flag == 0){
      break;
    }
  }

  if(flag == 1){
    printf("None\n");
  }else{
    printf("%c\n", c);
  }

  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(void){
  char n[3];
  cin >> n;
  for(int i=0;i<3;i++){
    if(n[i] == '1') n[i] = '9';
    else n[i] = '1';
  }
  cout << n << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<cmath>
#include<functional>
#include<map>
#include<cstdlib>
#include<complex>
#include<numeric>
#include<set>
#include<deque>
#include<queue>

using namespace std;
using Int = long long;
Int INF = 1LL << 60;
const Int MOD = 1000000000 + 7;

vector<Int> dist;
vector<vector<pair<Int,Int>>> G;

bool dfs(Int v) {
	
	for (auto e : G[v]) {
		if (dist[e.first] == INF) {//行き先が見探索の場合
			dist[e.first] = dist[v] + e.second;
			if(!dfs(e.first))return false;
		}
		else if (dist[v] + e.second != dist[e.first])return false;//矛盾する場合
	}

	return true;
}

int main() {

	cin.tie(nullptr);
	ios::sync_with_stdio(false);

	Int N, M;
	cin >> N >> M;

	dist.resize(N, INF);
	G.resize(N);

	Int L, R, D;
	for (Int i = 0; i < M; i++) {
		cin >> L >> R >> D;
		L--;
		R--;
		G[L].push_back(make_pair(R, D));
		G[R].push_back(make_pair(L, -D));
	}

	for (Int i = 0; i < N; i++) {
		if (dist[i] == INF) {
			dist[i] = 0;
			if (!dfs(i)) {
				cout << "No" << "\n";
				return 0;
			}
		}
	}

	cout << "Yes" << "\n";
}


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

int main() {
  ll n,a[2000001],count=0;
  cin>>n;
  rep(i,n) cin >> a[i];
  if (n==1){
    cout<<0<<endl;
  }
  else{
  for(int i=0;i<n-1;i++){
    if(a[i+1]<a[i]){
      count+=(a[i]-a[i+1]);
      a[i+1]=a[i];
    }
  }
  cout<<count<<endl;
  }
}


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

int main() {
	unsigned int N, K, r = 1;

	cin >> N >> K;

	for (size_t i = 0; i < N; i++)
	{
		if ((r * 2) > (r + K))
			r += K;
		else
			r *= 2;
	}
	cout << r;
	return 0;
}

Measured memory_bytes: 256
D,G = map(int,input().split())
pc = [list(map(int,input().split())) for i in range(D)]
ans = 10**9
for i in range(2**D):
  score=0
  n=0
  done=""
  for j in range(D):
    if (i>>j)&1:
      score += 100*(j+1)*pc[j][0]+pc[j][1]
      n += pc[j][0]
      done+=str(j)
  if score < G:
    for k in range(D):
      if str(D-k-1) in done:
        continue
      for l in range(pc[D-k-1][0]):
        score += 100*(D-k)
        n += 1
        if score >= G:
          break
      if score >= G:
        break
  ans = min(ans,n)
print(ans)

Measured memory_bytes: 3064
#include <iostream>
#include <algorithm>
#include <string>
#include <string.h>
#include <stdlib.h>
#include <math.h>
#include <vector>
#include <queue>
#include <stack>
#include <cmath>
#include <map>
#include <iomanip>
#include <set>
using namespace std;

#define rep(i, s) for (int i = 0; i < s; ++i)
#define all(v) (v.begin(), v.end())
#define COUT(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl
#define EACH(i, s) for (__typeof__((s).begin()) i = (s).begin(); i != (s).end(); ++i)
#define VEC(a, n) vector<int>a(n)
#define PQ(a) priority_queue<int>a
#define PQmin(a) priority_queue< int, :vector<int>, greater<int> >a
#define PAIR pair<int, int>
/*
sort(sp.begin(), sp.end(), [](PAIR l, PAIR r){
        return l.first<r.first || (l.first==r.first && l.second > r.second);
        });
*/

typedef long long  ll;

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))

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





int main() {
    int A,B,M;
    cin>>A>>B>>M;
    vector<int>a(A);
    vector<int>b(B);
    int mina=10000000;
    int minb=10000000;
    for(int i=0;i<A;i++){
        cin>>a.at(i);
        mina=min(mina,a.at(i));
    }
    for(int i=0;i<B;i++){
        cin>>b.at(i);
        minb=min(minb,b.at(i));
    }
    int ans=mina+minb;
    for(int i=0;i<M;i++){
        int x,y,c;
        cin>>x>>y>>c;
        if(a.at(x-1)+b.at(y-1)-c<=ans){
            ans=a.at(x-1)+b.at(y-1)-c;
        }
    }

    cout<<ans<<endl;


    return 0;
}


Measured memory_bytes: 1024
#include<stdio.h>
int main()
{
    int a,b,c;
    scanf("%d%d",&a,&b);
    if(a>=13)
    {
        c=b;
    }
    else if(a>=6&&a<=12)
    {
        c=b/2;
    }
    else
        c=0;
    printf("%d\n",c);
    return 0;
}


Measured memory_bytes: 128
#include <stdio.h>

int max_profit(int max, int r) {
  if (max >= r)
    return max;
  return r;
}

int min_profit(int min, int r) {
  if (min <= r)
    return min;
  return r;
}

int main(void) {
  int n;
  int i, j;
  int r[1000000];
  int max, min;

  scanf("%d", &n);

  for (i = 0; i < n; i ++) {
    scanf("%d", &r[i]);
  }

  max = r[1] - r[0];
  min = r[0];
  for (i = 1; i < n; i++) {
    max = max_profit(max, r[i] - min);
    min = min_profit(min, r[i]);
  }

  printf("%d\n", max);
  
  return 0;
}



Measured memory_bytes: 2572
#include <cassert>
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <cwchar>
#include <cwctype>
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#include <array>
#include <atomic>
#include <chrono>
#include <codecvt>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define rep2(i, n) for(int i = 1; i <= (int)(n); i++)
#define all(x) (x).begin(),(x).end()
using namespace std;
typedef int64_t ll;
typedef long double ld;
const ll INF=(1LL<<62);
const double inf=pow(10,10);
const ld pi=acosl(1);
const ll mod = 1000000007;
const int dx[4]={0,1,0,-1};
const int dy[4]={1,0,-1,0};
const int ddx[8]={1,0,-1,-1,-1,0,1,1};
const int ddy[8]={1,1,1,0,-1,-1,-1,0};

bool check(pair<ll,ll>a,pair<ll,ll>b){
	return (a.first>b.first&&a.second>b.second);
}

bool fun(pair<ll,ll>b,pair<ll,ll>a){
	if(a.first==b.first)return a.second>b.second;
	else return a.first<b.first;
}

int main(){
	ll A,B,C;cin>>A>>B>>C;
	if(A==B&&B!=C)cout<<"Yes"<<endl;
	else if(A!=B&&B==C)cout<<"Yes"<<endl;
	else if(A==C&&B!=C)cout<<"Yes"<<endl;
	else cout<<"No"<<endl;
}


Measured memory_bytes: 764
times = [int(input()) for i in range(5)]
def marume(i):
    return i-1-(i-1)%10+10 

a=0
for idx,t in enumerate(times):
  if idx == ([(t-1)%10for t in times]).index(min([(t-1)%10for t in times])):
    a += t
  else :
    a += marume(t)
    
print(a)
    


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

int main(){
  int n,a,b;
  cin >> n >> a >> b;
  int money1;
  int money2;
  money1 = n*a;
  money2 = b;
  if(money1>money2){
    cout << money2 <<endl;
  }
  else
   cout << money1 << endl;
  return 0;
}


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

using ll = long long;
const int mod = 1e9 + 7;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int X;
    cin >> X;
    int ans = (X / 500) * 1000;
    X %= 500;
    ans += (X / 5) * 5;
    cout << ans << endl;
}

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

#define rep(i,N) for(int i=0;i<N;i++)
#define rep2(i,N) for(int i=1;i<=N;i++)
using namespace std;
long long  INF=1e18;
long long mod=1e9+7;


int main(){
    int k;
    cin>>k;
    string s;
    cin>>s;
    
    
    if(s.size()<=k)cout<<s<<endl;

    else{
        rep(i,k){
            cout<<s[i];
        }
        cout<<"..."<<endl;
    }
    return 0;

}
/*

*/


Measured memory_bytes: 3620
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(ll i=0;i<n;i++)
#define repl(i,l,r) for(ll i=(l);i<(r);i++)
#define per(i,n) for(ll i=n-1;i>=0;i--)
#define lper(i,r,l) for(ll i=r-1;i>=l;i--)
#define fi first
#define se second
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define CST(x) cout<<fixed<<setprecision(x)
using ll=long long;
using vl=vector<ll>;
using vvl=vector<vector<ll>>;
using pl=pair<ll,ll>;
const ll MOD=1000000007;
const ll MOD9=998244353;
const int inf=1e9+10;
const ll INF=4e18;
const ll dy[4]={1,0,-1,0};
const ll dx[4]={0,-1,0,1};
int main(){
    string S;cin>>S;
    if(S=="AAA" or S=="BBB")cout<<"No"<<endl;
    else cout<<"Yes"<<endl;
    return 0;
}

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

#define REP(i, n) for ( int i = 0; i < (int)n; i++ )
#define GMAX 20
#define TMAX 100
#define INFTY (1<<21)

int N, M, D, sy, sx, gy, gx;
int G[GMAX][GMAX][GMAX][GMAX], S[GMAX][GMAX];
bool V[GMAX][GMAX][TMAX+1][4];

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

bool valid( int y , int x ){
   return ( 0 <= y && 0 <= x && y < N && x < M );
}

void dfs( int y, int x, int t, int d ){
   V[y][x][t][d] = true;
   
   int ny, nx, nt;
   for ( int nd = 0; nd < 4; nd++ ){
       if ( (d+2)%4 == nd ) continue;
       
       ny = y + dy[nd];
       nx = x + dx[nd];
       
       if ( !valid(ny, nx) ) continue;
       if ( G[y][x][ny][nx] == INFTY ) continue;
       
       nt = t + G[y][x][ny][nx];
       
       if ( nt > TMAX ) continue;
       
       if ( S[ny][nx] > 0 ){
           if ( nd % 2 == 0 ){
               if ( (nt/S[ny][nx])%2 != 1 ) continue;
           } else {
               if ( (nt/S[ny][nx])%2 != 0 ) continue;
           }
       }
       
       if ( V[ny][nx][nt][nd] ) continue;
       
       dfs( ny, nx, nt, nd );
   }
}

int compute(){
   REP(y, N) REP(x, M) REP(t, TMAX+1) REP(d, 4) V[y][x][t][d] = false;
   REP(d, 4) dfs( sy, sx, 0, d );
   
   REP(t, TMAX+1) REP(d, 4) if ( V[gy][gx][t][d] ) return t;
}

int getNumber( char ch ){ return ch - 'a';}

bool input(){
   cin >> N >> M;
   if ( N == 0 && M == 0 ) return false;
   cin >> D;
   
   int ny, nx;
   REP(y, N) REP(x, M){
       S[y][x] = 0;
       REP(nd, 4){
           ny = y + dy[nd];
           nx = x + dx[nd];
           if ( valid(ny, nx) ){
               G[y][x][ny][nx] = G[ny][nx][y][x] = D;
           }
       }
   }
   
   int nsignal, nconst, njam, y1, x1, y2, x2, k, d;
   char ch, tmp;
   
   cin >> nsignal;
   for ( int i = 0; i < nsignal; i++ ){
       cin >> ch  >> tmp >> x1 >> k; x1--;
       S[getNumber(ch)][x1] = k;
   }
   
   cin >> nconst;
   for ( int i = 0; i < nconst; i++ ){
       cin >> ch >> tmp >> x1; x1--;
       y1 = getNumber(ch);
       cin >> ch >> tmp >> x2; x2--;
       y2 = getNumber(ch);
       G[y1][x1][y2][x2] = G[y2][x2][y1][x1] = INFTY;
   }
   
   cin >> njam;
   for ( int i = 0; i < njam; i++ ){
       cin >> ch >> tmp >> x1; x1--;
       y1 = getNumber(ch);
       cin >> ch >> tmp >> x2 >> d; x2--;
       y2 = getNumber(ch);
       G[y1][x1][y2][x2] += d;
       G[y2][x2][y1][x1] += d;
   }
   
   cin >> ch >> tmp >> sx; sy = getNumber(ch);
   cin >> ch >> tmp >> gx; gy = getNumber(ch);
   sx--; gx--;
   return true;
}

int main(){
   while( input() ) cout << compute() << endl;
   return 0;
}

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

int main() {
    int res = 0;
    int N, M, C;
    cin >> N >> M >> C;
    vector<int> B(M);
    for (int i = 0;i < M; i++) cin >> B[i];
    for (int i = 0;i < N; i++) {
        int count = 0;
        for (int j = 0;j < M;j++){
            int A = 0; cin >> A;
            count += A * B[j];
        }
        if (count + C > 0) res++;
    }
    cout << res << endl;
    return 0;
}

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

int main(){
  int a,b,c;
  cin>>a>>b>>c;
  int count = 0;
  
  if(a == b && b == c){
    cout<<1<<endl;
    return 0;
  }
  if(a != b) count++;
  if(a != c) count++;
  if(b != c) count++;
  
  cout<<count<<endl;
  return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(void){

  int a,b;
  scanf("%d %d", &a, &b);
  int price = b;
  if (a <= 5) {
    price = 0;
  } else if (a < 13) {
    price /= 2;
  }
  printf("%d\n", price);

  return 0;
}

Measured memory_bytes: 128
/*
	ID: sixathofpain
	TASK: friday
	LANG: C++   

*/


//#pragma GCC optimize("Ofast")
//#pragma GCC optimize ("unroll-loops")
//#pragma GCC target("avx,avx2,fma")
#include <bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
#define all(x) (x).begin(), (x).end()
#define ff first
#define ss second
#define setbits(x) __builtin_popcount(x)
typedef long long ll;
typedef unsigned long long ull;
typedef double db;
typedef long double ldb;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<ll, int> pli;
typedef pair<db, db> pdd;
typedef vector<int> vi;
#define m1 make_pair
#define in insert
#define pb push_back
#define IOS                           \
    std::ios::sync_with_stdio(false); \
    cin.tie(NULL);                    \
    cout.tie(NULL);
#define endl "\n"
template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

inline ll gcd(ll a, ll b)
{
    if (a == 0)
        return b;
    return gcd(b % a, a);
}
inline ll power(ll a, ll n, ll m)
{
    if (n == 0)
        return 1;
    ll p = power(a, n / 2, m);
    p = (p * p) % m;
    if (n % 2)
        return (p * a) % m;
    else
        return p;
}
const ll MOD = 1000000007;
const int N = int(3e5) + 999;
#define int long long int

int32_t main(){
    IOS;
	
    // freopen("friday.in","r",stdin);
    // freopen("friday.out","w",stdout);

    string s;
    cin>>s;
    s="%"+s;
    if(s[3]==s[4] and s[6]==s[5]){
    	cout<<"Yes"<<endl;
    }else{
    	cout<<"No"<<endl;
    }

    return 0;
}

Measured memory_bytes: 256
package main

import (
	"fmt"
	"bufio"
	"os"
	"strings"
)

func main() {
	scanner := bufio.NewScanner(os.Stdin)
	var s string
	var ans int
	var sliced_s []string
	fmt.Scan(&s)
	for {
		scanner.Scan()
		st := scanner.Text()
		if st == "END_OF_TEXT" {
			break
		}
		st = strings.ToUpper(st)
		st = strings.ToLower(st)
		sliced_s = strings.Fields(st)
		// fmt.Println(sliced_s)
		for _, v := range sliced_s {
			if v == s {
				ans++
			}
		}
	}
	fmt.Println(ans)
}


Measured memory_bytes: 1140
#include <bits/stdc++.h>
using namespace std;
#define repr(i, a, b) for (int i = a; i < b; i++)
#define rep(i, n) for (int i = 0; i < n; i++)
typedef long long ll;
#define mod 1000000007

ll gcd(ll x,ll y) {return y ? gcd(y,x%y) : x;} 
ll lcm(ll x,ll y) {return x/gcd(x,y)*y;}

int main(){
    string s;
    cin >> s;
    int n=s.size();
    const int K=4;
    vector<vector<int>> dp(n+1,vector<int>(K+1,-1));
    dp[0][0]=0;
    for(int i=0;i<n;i++){
        for(int j=0;j<=K;j++){
            if(dp[i][j]==-1) continue;
            for(int k=1;k<=K&&i+k<=n;k++){
                if(j!=k||s.substr(i-j,j)!=s.substr(i,k)){
                    dp[i+k][k]=max(dp[i+k][k],dp[i][j]+1);
                }
            }
        }
    }
    
    int ans=0;
    for(int i=0;i<=K;i++){
        ans=max(ans,dp[n][i]);
    }
    
    cout << ans << endl;
    
    return 0;
}








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

int main() {
  int n,k; cin>>n>>k;
  vector<char> s(n);
  rep(i, n) cin>>s[i];

  int ans=0;
  rep(i, n-1) if (s[i]==s[i+1]) ans++;
  cout<<min(n-1, ans+2*k)<<endl;
}


Measured memory_bytes: 384
n,m = map(int,input().split())
d =[[float('inf') for _ in range(n)] for _ in range(n)]
edges = []
for _ in range(m):
    a,b,c = map(int,input().split())
    d[a-1][b-1] = c
    d[b-1][a-1] = c
    edges.append((a,b,c))
for i in range(n):
    d[i][i] = 0
# warshall_floyd
for k in range(n):
    for i in range(n):
        for j in range(n):
            d[i][j] = min(d[i][j],d[i][k]+d[k][j])
s = set()
for i in range(n):
    for j in range(m):
        if d[i][edges[j][0]-1] + edges[j][2] == d[i][edges[j][1]-1]:
            s.add(j)
print(m-len(s))

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

#define MAX 100

int pop();
void push(int);

int stack[MAX];
int top = 0;

int main(){

  int a, b, d;
  char c[7];

  while((scanf("%s", &c))!= EOF){

    if(c[0] == '+' || c[0] == '-' || c[0] == '*'){

      switch(c[0]){

      case '+':
      
	a = pop();
      
	b = pop();
      
	push(a + b);
      
	break;


      case '-':
      
	a = pop();
      
	b = pop();

	push(b - a);

	break;


      case '*':
     
	a = pop();
      
	b = pop();

	push(a * b);

	break;


      default:

	break;
    
      }
    }

    else{

      d = atoi(c);

      push(d);

    }

  }

  printf("%d\n", pop());
  
  return 0;

}

int pop(){

  if(top <= 0)
    return 0;
  else
    top = top - 1;


  return stack[top + 1];
 
}

void push(int data){

  top++;
  
  stack[top] = data;
  
}

Measured memory_bytes: 548
#include <iostream>
#include <cstdint>
#include <vector>

std::vector<uint32_t> a;
std::vector<uint64_t> partSum;

void input() {
	std::ios::sync_with_stdio(false);
	std::cin.tie(nullptr);

	uint32_t n;
	std::cin >> n;
	a.resize(n);
	for (uint32_t &i : a) {
		std::cin >> i;
	}
}

void precalc() {
	partSum.resize(a.size() + 1);
	partSum[0] = 0;
	for (uint32_t i = 0;i < a.size();i++) {
		partSum[i + 1] = partSum[i] + a[i];
	}
}

uint64_t sum(uint32_t i, uint32_t j) {
	return partSum[j + 1] - partSum[i];
}
uint64_t diff(uint64_t a, uint64_t b) {
	return a > b ? a - b : b - a;
}

std::pair<uint64_t, uint64_t> calc(uint32_t startI, uint32_t endI) {
	uint32_t l = startI;
	uint32_t h = endI;

	while (l + 1 < h) {
		uint32_t m = (l + h) / 2;
		uint64_t s1 = sum(startI, m);
		uint64_t s2 = sum(m + 1, endI);
		if (s1 <= s2) {
			l = m;
		} else {
			h = m;
		}
	}
	uint64_t d1 = diff(sum(startI, l), sum(l + 1, endI));
	uint64_t d2 = diff(sum(startI, l + 1), sum(l + 2, endI));
	uint64_t s1, s2;

	if (d1 < d2) {
		s1 = sum(startI, l);
		s2 = sum(l + 1, endI);
	} else {
		s1 = sum(startI, l + 1);
		s2 = sum(l + 2, endI);
	}

	return {std::max(s1, s2), std::min(s1, s2)};
}

int main() {
	input();
	precalc();
	uint64_t ans = partSum.back();
	for (uint32_t i = 1;i + 2 < a.size();i++) {
		auto a1 = calc(0, i);
		auto a2 = calc(i + 1, a.size() - 1);
		uint64_t cur = 
			std::max(a1.first, a2.first)
			- std::min(a1.second, a2.second);
		ans = std::min(ans, cur);
	}
	std::cout << ans << "\n";
}


Measured memory_bytes: 2560
import sys
input = sys.stdin.readline

n,q = map(int,input().split())
AB = [[int(x) for x in input().split()] for _ in range(n-1)]
PX = [[int(x) for x in input().split()] for _ in range(q)]

Graph = [[] for _ in range(n+1)]
for a,b in AB:
    Graph[a].append(b)
    Graph[b].append(a)

#print(Graph)
Value = [0]*(n+1)
for p,x in PX:
    Value[p] += x
#print(Value)

q = [(1,0)]
while q:
    x,parent = q.pop()
    Value[x] += Value[parent]  #親の値を子に入れる
    for y in Graph[x]:
        if y == parent:
            continue
        q.append((y,x))
print(*Value[1:])

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

#define REP(i,m,n) for(int i=(m); i<(int)(n); i++)
#define RREP(i,m,n) for(int i=(int)(n-1); i>=m; i--)
#define rep(i,n) REP(i,0,n)
#define rrep(i,n) RREP(i,0,n)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define fi first
#define se second
#define debug(...) {cerr<<"[L"<<__LINE__<<"] "; _debug(__VA_ARGS__);}

template<typename T>
string join(const vector<T>&v, string del=", "){ stringstream s;
    for(auto x : v) s << del << x; return s.str().substr(del.size());
}
template<typename T>
ostream& operator<<(ostream& o, const vector<T>&v){
    if(v.size()) o << "[" << join(v) << "]"; return o;
}
template<typename T>
ostream& operator<<(ostream& o, const vector<vector<T> >&vv){
    int l = vv.size();
    if(l){ o<<endl; rep(i,l) o << (i==0 ? "[ " : ",\n  " ) << vv[i] << (i==l-1 ? " ]" : ""); }
    return o;
}
inline void _debug(){cerr<<endl;}
template<class First, class... Rest>
void _debug(const First& first, const Rest&... rest){cerr<<first<<" ";_debug(rest...);}

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<vl> vvl;

const double PI = (1*acos(0.0));
const double EPS = 1e-9;
const int INF = 0x3f3f3f3f;
const ll INFL = 0x3f3f3f3f3f3f3f3fLL;
const ll mod = 1e9 + 7;

inline void finput(string filename) {
    freopen(filename.c_str(), "r", stdin);
}

int N, M;
vi g[100010];
vi bfs(int s){
    vi d(N, INF);
    queue<int> Q;
    Q.push(s);
    d[s] = -1;
    while(!Q.empty()){
        auto v = Q.front(); Q.pop();
        for(auto u : g[v]){
            if(d[u] == INF){
                d[u] = v;
                Q.push(u);
            }
        }
    }
    return d;
}

int main(){
    ios_base::sync_with_stdio(0);
    // finput("./input");
    cin >> N >> M;
    rep(i,M){
        int a, b; cin >> a >> b;
        a--; b--;
        g[a].push_back(b);
        g[b].push_back(a);
    }
    auto d = bfs(0);
    cout << "Yes" << endl;
    REP(i,1,N){
        cout << d[i]+1 << endl;
    }
    return 0;
}

Measured memory_bytes: 10284