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

const string YES = "Yes";
const string NO = "No";

void solve(long long N, long long M, std::vector<long long> A){

    sort(A.begin(), A.end(), std::greater<long long>());

    long long total = 0;
    for( int i = 0; i < N; i++){
        total += A[i];
    }

    long long m = 0;
    float th;
    th = float(total) / (4.0 * float(M));
    for( int i = 0; i < N; i++){
        //cout << i << " " << A[i] << " < " << th << endl;
        if( float(A[i]) < th ){
            break;
        }
        m += 1;
    }
    if(m >= M){
        cout << YES << endl;
    }else{
        cout << NO << endl;
    }
}

// Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
int main(){
    long long N;
    scanf("%lld",&N);
    long long M;
    scanf("%lld",&M);
    std::vector<long long> A(N);
    for(int i = 0 ; i < N ; i++){
        scanf("%lld",&A[i]);
    }
    solve(N, M, std::move(A));
    return 0;
}


Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;


public class Main {

	/**
	 * @param args
	 * @throws IOException 
	 */
	public static void main(String[] args) throws IOException {
		// TODO Auto-generated method stub
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

		String[] tmpArray = br.readLine().split(" ");
		
		int n = Integer.parseInt(tmpArray[0]);
		int m = Integer.parseInt(tmpArray[1]);
		int k = Integer.parseInt(tmpArray[2]);
		
		boolean possible = false;
		
		if(n*m == k){
			possible = true;
		}
		
		for(int i = 0; i < n ; i++){
			for(int j = 0; j < m; j++){
				int black = i*m - j*(i)+j*(n-i);
				
				if(black == k){
					possible = true;
				}
			}
		}
//		boolean[] possible = new boolean[k+1];
//		
//		possible[0] = true;
//		if(n == 1 || m == 1){
//			possible[1] = true;
//		}
//		
//		for(int i = 2; i <= k; i++){
//			if(k % m == 0){
//				possible[k] = true;
//			}
//			else if(k % n == 0){
//				possible[k] = true;
//			}
//		}
		
		if(possible){
			System.out.println("Yes");
		}
		else {
			System.out.println("No");
		}
	}

}


Measured memory_bytes: 21844
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author
 */

#include <iostream>
#include <fstream>

#include <iostream>
#include <string>
#include <vector>
#include <math.h>
#include <map>
#include <set>
#include <algorithm>
#include <numeric>
#include <bitset>
using namespace std;
using ll = long long;
constexpr ll INF = 1010000000000000017LL;
#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)
#define all(v) v.begin(), v.end()

class BTaxRate {
public:
	void solve(std::istream& in, std::ostream& out) {
	    double n;
	    in>>n;
	    for(ll i = (ll)(n*(100.0/108.0))-1; i <= (ll)(n*(100.0/108.0))+1; i++){
	        if((ll)(i*1.08)==n){
	            out<<i<<endl;
                return;
	        }
	    }
	    out<<":("<<endl;



	};
};


int main() {
	BTaxRate solver;
	std::istream& in(std::cin);
	std::ostream& out(std::cout);
	solver.solve(in, out);
	return 0;
}


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

int main() {
	// your code goes here
	ll n;
    cin>>n;
	ll upp=sqrt(n),c=0;
	upp+=1;
	for(ll i=0;i<n;i++){
		ll temp=1;
		while((n-((i+1)*temp))>0){
			c++;
			temp++;
		}
	}
	cout<<c<<endl;
	return 0;
}

Measured memory_bytes: 3668
{-# LANGUAGE BangPatterns #-}
import Control.Applicative((<$>))
import Control.Monad
import Data.Map ((!))
import qualified Data.Map as M
import qualified Data.List as L
import Data.Maybe (catMaybes)
-- import qualified Data.Char as C
-- import qualified Data.IntSet as I
import Debug.Trace
--------------------------------------------
readInt    = read :: String -> Int
getInt     = readInt <$> getLine
getIntList = map readInt . words <$> getLine
int2bin 0 =  []
int2bin n =  n `mod` 2 : int2bin (n `div` 2)
----------------------------------------------

main :: IO ()
main = do
  s <- getLine
  putStrLn $ map fst $ filter (\(_,b) -> odd b) $ zip s [1..]


Measured memory_bytes: 6396
#include <iostream>
#include <string>
#include <cmath>
#include <vector>
#include <algorithm>
#include <functional>
#include <cstdio>
#include <cstdlib>
#include <iomanip>
#include <cctype>

using namespace std;
// for loop
#define F(i, L, R) for(int i = L; i < R; i++)
#define FE(i, L, R) for(int i = L; i <= R; i++)
// for (reversed)
#define FR(i, L, R) for(int i = L; i > R; i--)
#define FRE(i, L, R) for(int i = L; i >= R; i--)

// data types
#define ul unsigned long
#define ll long long
#define ull unsigned long long
#define ui unsigned int
#define us unsigned shoft

// vectors
typedef vector<int> vi;
typedef vector<long> vl;
typedef vector<vi> vvi;
typedef pair<int, int> ii;
#define ALL(c) (c).begin(),(c).end()
#define last(vec) vec.size()-1
#define lastEle(vec) vec[last(vec)]
#define pb push_back

// debug
#define DBG(vari) cerr<<#vari<<" = "<<(vari)<<endl;
#define printA(a, L, R) FE(i, L, R) cout << a[i] << (i==R?'\n':' ')
#define printAF(a, L) printA(a, 0, L-1)
#define printV(a) printA(a, 0, a.size()-1)

// utils
#define char2int(c) (c-'0')
#define bit(x, i) (x&(1<<i))
#define space ' '
#define PI 3.14159265358979323

int main() {
    ll a,b;
    cin >> a >> b;
    if( a < b ) swap(a, b);
    while(1) {
        int r = a % b;
        if(r == 0)break;
        a = b;
        b = r;
    }
    cout << b << endl;
}



Measured memory_bytes: 3096
#include <bits/stdc++.h>
using namespace std;
long long dp[3001][3001][2];
int main() {
    ios::sync_with_stdio(false), cin.tie(nullptr), cout.tie(nullptr);
    int n;
    cin >> n;
    vector<long long> arr(n);
    for (auto &i: arr)
        cin >> i ;
    for (int i=0; i<n; i++)
        for (int r = 0, c = i;  c<n ; r++, c++){
            if (i==0)
                dp[r][c][0] = arr[r];
            else {
                long long first = arr[c]+dp[r][c-1][1], second = arr[r]+dp[r+1][c][1];
                if (first==second)
                    dp[r][c][0] = first, dp[r][c][1] = max(dp[r+1][c][0], dp[r][c-1][0]);
                else if (first>second)
                    dp[r][c][0] = first, dp[r][c][1] = dp[r][c-1][0];
                else dp[r][c][0] = second, dp[r][c][1] = dp[r+1][c][0];
            }
        }
    cout << dp[0][n-1][0]-dp[0][n-1][1] << "\n";
}

Measured memory_bytes: 85404
a, b, c = map(int, input().split())
i = 0
f = True
while a%2==0 and b%2==0 and c%2==0:
    at = a//2
    bt = b//2
    ct = c//2
    a = bt + ct
    b = at + ct
    c = at + bt
    i+=1
    if a == b == c:
        print(-1)
        f = False
        break
if f:
    print(i)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
#define rep(i,c) for(int i=0;i<(int)c;i++)
#define print(var) cout<<var<<endl;

const int inf = 1000000000;//10^9


int main(){
  int N;
  cin >> N;
  int ans=N/2+N%2;
  print(ans);



return 0;
}

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

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

    ll k = n;
    string ans;
    while(1){
        if(k <= 26){
            ans = (char)(k + 'a' - 1) + ans;
            break;
        }

        int a = k % 26;
        k /= 26;
        if(a == 0){
            ans = 'z' + ans;
            k--;
        }else{
            ans = (char)(a + 'a' - 1) + ans;
        }
    }

    cout << ans << endl;
}

Measured memory_bytes: 3616
fn main() {
    let v:Vec<u32> = read_vec();
    if v[0]+v[1] == v[2] || v[1]+v[2] == v[0] || v[2]+v[0] == v[1] {
        println!("Yes");
    } else {
        println!("No");
    }
}

fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}

fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    read::<String>().split_whitespace()
        .map(|e| e.parse().ok().unwrap()).collect()
}

Measured memory_bytes: 4352
#include<bits/stdc++.h>
using namespace std;
///Welcome to Nasif's Code
#define bug printf("bug\n");
#define bug2(var) cout<<#var<<" "<<var<<endl;
#define co(q) cout<<q<<endl;
typedef long long int ll;
typedef unsigned long long int ull;
const int MOD = (int)1e9+7;
const int MAX = 1e6;
#define pi acos(-1)
#define inf 1000000000000000LL
#define FastRead    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
int main()
{
    FastRead
    //freopen("output.txt", "w", stdout);
     ll a,b,k;
     cin>>a>>b>>k;
     k=min(k,(b-a)+1);
     set<int>s;
     for(int i=a;i<=a+k-1;i++)
        s.insert(i);
     for(int i=b;i>=b-k+1;i--)
        s.insert(i);
     for(auto x:s)
        cout<<x<<endl;

    return 0;
}


Measured memory_bytes: 3644
#include <bits/stdc++.h>
using namespace std;
#define pi 2*asin(1.0)


//template functions
/////////////////////////
long Comb(long N,long M){// nCm
long ans=1;
for(long i=N;i>N-M;i--){
    ans=ans*i;
}
for(long i=M;i>0;i--){
    ans=ans/i;
}
return ans;
}
long Perm(long N,long M){// nPm
long ans=1;
for(long i=N;i>N-M;i--){
    ans=ans*i;
}
return ans;
}
/////////////////////////



//Answer


int main() {

int H,W,K;
cin>>H>>W>>K;
char in;
long Answer=0;
int count=0;

vector<vector<int>> s(H,vector<int>(W));

for(int i=0;i<H;i++){
    for(int j=0;j<W;j++){
        cin>>in;
        if(in=='.'){
            s.at(i).at(j)=0;
        }else{
            s.at(i).at(j)=1;
        }

    }
}

for(int i=0;i<pow(2,H);i++){
    for(int j=0;j<pow(2,W);j++){
        count=0;
        for(int m=0;m<H;m++){
            for(int l=0;l<W;l++){
               bitset<6> ibit(i);
               bitset<6> jbit(j);
                if(ibit.test(m)&&jbit.test(l)){
                    if(s.at(m).at(l)==1){
                        count++;
                    }
                }
            }
        }
        if(count==K){
            Answer++;
        }

    }
}


cout<<Answer<<endl;


}





Measured memory_bytes: 4104
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <set>

using namespace std;

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

    int n, m, a, b;
    cin >> n >> m;
    vector<int> v(n, 0);
    for (int i = 0; i < m; ++i)
    {
        cin >> a >> b;
        ++v[a-1];
        ++v[b-1];
    }
    for (int i = 0; i < n; ++i)
    {
        cout << v[i] << endl;
    }
    
    return 0;
}

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

main() {
  int c[3][3];
  for (auto& ci : c) {
    for (auto& cij : ci) {
      cin >> cij;
    }
  }
  auto& b = c[0];
  int a[3] = { 0, c[1][0] - b[0], c[2][0] - b[0] };
  for (int i = 1; i < 3; ++i) {
    for (int j = 1; j < 3; ++j) {
      if (c[i][j] != a[i] + b[j]) {
        cout << "No" << endl;
        return 0;
      }
    }
  }
  cout << "Yes" << endl;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(){
  int kensu = 0;
  int nyukyosya[4][3][10];
  int b, f, r, v;
  for ( int tou = 0; tou < 4; tou++ ){
    for ( int huroa = 0; huroa < 3; huroa++ ){
      for ( int heya = 0; heya < 10; heya++ ){
        nyukyosya[tou][huroa][heya] = 0;
      }
    }
  }
  scanf ( "%d", &kensu );
  for ( int i = 0; i < kensu; i++ ){
    scanf ( "%d %d %d %d", &b, &f, &r, &v);
    nyukyosya[b-1][f-1][r-1] = nyukyosya[b-1][f-1][r-1] + v;
  }
  for ( int tou = 0; tou < 4; tou++ ){
    for ( int huroa = 0; huroa < 3; huroa++ ){
      for ( int heya = 0; heya < 10; heya++ ){
        printf(" %d", nyukyosya[tou][huroa][heya] );
      }
      printf("\n");
    }
    if ( tou < 3 ) printf("####################\n" );
  }
}

Measured memory_bytes: 1780
#include <algorithm>
#include <array>
#include <bitset>
#include <chrono>
#include <complex>
#include <fstream>
#include <functional>
#include <iostream>
#include <iterator>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <regex>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>

using namespace std;
typedef long long ll;

#define INT_MAX std::numeric_limits<int>().max()
#define INT_MIN std::numeric_limits<int>().min()
#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define RFOR(i,a,b) for (int i=(b)-1;i>=(a);i--)
#define REP(i,n) for (int i=0;i<(n);i++)
#define RREP(i,n) for (int i=(n)-1;i>=0;i--)

//#define _DEBUG_ 4

void run() {
	ll N, W;
	cin >> N >> W;

	vector<vector<ll>> wv(4, vector<ll>());
	ll w1, v1;
	cin >> w1 >> v1;
	wv[0].push_back(v1);
	REP(i, N-1) {
		ll tw, tv;
		cin >> tw >> tv;
		wv[tw - w1].push_back(tv);
	}

	for (auto& p : wv)
		sort(p.begin(), p.end(), greater<ll>());

	for (auto& p : wv) {
		REP(i, p.size()) {
			if (i == 0) continue;
			p[i] += p[i - 1];
		}
	}

	ll ans = 0;
	REP(i, wv[0].size()+1) {
		REP(j, wv[1].size()+1) {
			REP(k, wv[2].size()+1) {
				REP(l, wv[3].size()+1) {
					if (i * w1 + j*(w1 + 1) + k*(w1 + 2) + l*(w1 + 3) > W) continue;
					ll tmp = 0;
					if (i > 0) tmp += wv[0][i - 1];
					if (j > 0) tmp += wv[1][j - 1];
					if (k > 0) tmp += wv[2][k - 1];
					if (l > 0) tmp += wv[3][l - 1];
					ans = max(ans, tmp);
				}
			}
		}
	}

	cout << ans << endl;
	
}

int main() {
#ifdef _DEBUG_
	using std::chrono::system_clock;
	using std::chrono::duration_cast;
	system_clock::time_point  start, end;
	std::ifstream in("input.txt");
	cin.rdbuf(in.rdbuf());
	for (int i = 0; i < _DEBUG_; i++) {
		cout << "-------------------------- (cnt:" << i << ")" << endl;
		start = system_clock::now();
		run();
		end = system_clock::now();
		int elapsed = duration_cast<std::chrono::milliseconds>(end - start).count();
		cout << "-------------------------- (time:" << elapsed << "ms)" << endl << endl;
	}
#else
	run();
#endif
	return 0;
}

Measured memory_bytes: 256
n=int(input())
A=[[0 for i in range(10)] for j in range(10)]

for i in range(1,n+1):
    num=str(i)
    A[int(num[0])][int(num[-1])] +=1

ans=0
for i in range(1,10):
    for j in range(1,10):
        ans +=A[i][j]*A[j][i]
        
print(ans)

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

int main()
{
    int n;
  cin>>n;
  string s;
  cin>>s;
  for(int i=0;i<s.size();i++)
  {
    int sum=(int)(s[i]-'A')+n;
    if (sum>=26)
      sum-=26;
    cout<<(char)(sum+'A');
  }
    return 0;
}



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

using i64 = int64_t;

#define rep(i, x, y) for (i64 i = i64(x), i##_max_for_repmacro = i64(y); i < i##_max_for_repmacro; ++i)
#define debug(x) #x << "=" << (x)

#ifdef DEBUG
#define _GLIBCXX_DEBUG
#define print(x) std::cerr << debug(x) << " (L:" << __LINE__ << ")" << std::endl
#else
#define print(x)
#endif

const int inf = 1.01e9;
const i64 inf64 = 4.01e18;
const double eps = 1e-9;

template <typename T, typename U>
ostream &operator<<(ostream &os, const pair<T, U> &p) {
    os << "(" << p.first << ", " << p.second << ")";
    return os;
}

template <typename T>
ostream &operator<<(ostream &os, const vector<T> &vec) {
    os << "[";
    for (const auto &v : vec) {
        os << v << ",";
    }
    os << "]";
    return os;
}

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

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

template<typename T, size_t size> void fill(T (&ary)[size], const T& val){
    fill_n((T*)ary, size, val);
}

void solve() {
    //const i64 mod = 1'000'000'007;
    i64 N;
    cin >> N;

    vector<vector<i64>> graph(N);
    rep(i,0,N-1){
        i64 a,b;
        cin >> a >> b;
        --a;
        --b;
        graph[a].emplace_back(b);
        graph[b].emplace_back(a);
    }

    vector<i64> depth(N),height(N);
    function<void(i64,i64,i64)> calc_depth=[&](i64 u,i64 p,i64 d){
        depth[u]=d;
        for(auto v:graph[u]){
            if(v==p) continue;
            calc_depth(v,u,d+1);
            chmax(height[u],height[v]+1);
        }
    };
    calc_depth(0,-1,0);

    print(depth);
    print(height);

    vector<i64> f(N);
    function<void(i64,i64,i64)> calc_f=[&](i64 u,i64 p,i64 up){
        f[u]=up;
        for(auto v:graph[u]){
            if(v==p) continue;
            chmax(f[u],height[v]+1);
        }
        if(graph[u].empty()) return;
        vector<i64> l(graph[u].size()),r(graph[u].size());
        if(graph[u][0]!=p) l[0]=height[graph[u][0]]+1;
        if(graph[u].back()!=p) r[graph[u].size()-1]=height[graph[u].back()]+1;
        rep(i,1,graph[u].size()){
            i64 v=graph[u][i];
            l[i]=l[i-1];
            if(v==p) continue;
            chmax(l[i],height[v]+1);
        }
        for(i64 i=i64(graph[u].size())-2; i>=0; --i){
            i64 v=graph[u][i];
            r[i]=r[i+1];
            if(v==p) continue;
            chmax(r[i],height[v]+1);
        }
        rep(i,0,graph[u].size()){
            i64 v=graph[u][i];
            if(v==p) continue;
            calc_f(v,u,max({up,i==0?0:l[i-1],i==graph[u].size()-1?0:r[i+1]})+1);
        }
    };
    calc_f(0,-1,0);

    i64 x=0;
    rep(i,0,N) chmax(x,f[i]);

    x%=3;
    cout << (x==1?"Second":"First") << endl;
}

int main() {
    std::cin.tie(0);
    std::ios::sync_with_stdio(false);
    cout.setf(ios::fixed);
    cout.precision(16);
    solve();
    return 0;
}


Measured memory_bytes: 57856
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 = sc.nextInt();

        System.out.println(B / A <= C ? B / A : C);
    }
}


Measured memory_bytes: 22740
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <unordered_map>
#include <cmath>
#include <numeric>

using namespace std;

int N;
vector<string> S(10000);

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

    int64_t beginB = 0, endA = 0, bothAB = 0;
    for(int i=0;i<N;i++){
        if( S[i][0] == 'B' && S[i].back() == 'A' )  bothAB++;
        else if( S[i][0] == 'B' )  beginB++;
        else if( S[i].back() == 'A' )  endA++;
    }

    int64_t ans = 0;
    for(int i=0;i<N;i++){
        for(int j=1;j<S[i].size();j++){
            if( S[i][j-1] == 'A' && S[i][j] == 'B' )    ans++;
        }
    }

    if( endA == 0 && beginB == 0 ){
        if( 0 < bothAB )    ans += bothAB -1;
    } else{
        ans += min(beginB, endA) + bothAB;
    }
    cout << ans << endl;
}

Measured memory_bytes: 768
#include <bits/stdc++.h>
#define INF 2000000000000000000
#define ll long long
using namespace std;

// ============how it works=================
// input:
  // ll MAX_V: 頂点数の最大値
// output:
  // max_flow(s,t): s,t間の最大流を求める

//点aから点bに容量cの有向辺があるとき
  //add_edge(a, b, c);
// ========================================


//=============dinic============================
ll MAX_V = 101;
struct edge {ll to, cap, rev;};
vector<vector<edge>> G(MAX_V);
vector<ll> level(MAX_V);
vector<ll> iter(MAX_V);

void add_edge(ll from, ll to, ll cap) {
  G.at(from).push_back((edge){to, cap, (ll)G.at(to).size()});
  G.at(to).push_back((edge){from, 0ll, (ll)G.at(from).size() - 1});
}

void bfs(ll s) {
  for (ll i = 0; i < MAX_V; ++i) {
    level.at(i) = -1;
  }
  queue<ll> q;
  level.at(s) = 0;
  q.push(s);
  while (!q.empty()) {
    ll v = q.front();
    q.pop();
    for (ll i = 0; i < G.at(v).size(); ++i) {
      edge &e = G.at(v).at(i);
      if (e.cap > 0 && level.at(e.to) < 0) {
        level.at(e.to) = level.at(v) + 1;
        q.push(e.to);
      }
    }
  }
}

ll dfs(ll v, ll t, ll f) {
  if (v == t) {
    return f;
  }
  for (ll &i = iter.at(v); i < G.at(v).size(); ++i) {
    edge &e = G.at(v).at(i);
    if (e.cap > 0 && level.at(v) < level.at(e.to)) {
      ll d = dfs(e.to, t, min(f, e.cap));
      if (d > 0) {
        e.cap -= d;
        G.at(e.to).at(e.rev).cap += d;
        return d;
      }
    }
  }
  return 0;
}

ll max_flow(ll s, ll t) {
  ll flow = 0;
  while (true) {
    bfs(s);
    if (level.at(t) < 0) {
      return flow;
    }
    for (ll i = 0; i < MAX_V; ++i) {
      iter.at(i) = 0;
    }
    ll f;
    while ((f = dfs(s, t, INF)) > 0) {
      flow += f;
    }
  }
  return flow;
}
//=================================================

int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  ll V, E;
  cin >> V >> E;
  for (ll i = 0; i < E; ++i) {
    ll u, v, c;
    cin >> u >> v >> c;
    add_edge(u, v, c);
  }
  cout << max_flow(0, V - 1) << "\n";
}



Measured memory_bytes: 3280
#coding:utf-8
K,A,B=map(int,input().split())


bs = 1
yen = 0

if B-A > 2 and K >= (A-1):#まずA枚まで増やす
    K = K -(A - 1)
    numC = K//2#交換回数
    yen = A+(B-A) * numC + K%2
    print(yen)
else:#ひたすら割る
    print(1+K)





Measured memory_bytes: 38516
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<numeric>
#include<utility>

using namespace std;

typedef long long int ll;
const int INF = 1<<30;
const long long LINF = 1LL<<60;

const long long MOD = (long long)1e9 + 7;

string l;
ll dp[100010][2] = {};

ll calc(){
    for(int i = 1; i <= l.size(); i++){
        if(l[i - 1] == '0'){
            dp[i][0] = dp[i - 1][0] * 3;
            dp[i][0] %= MOD;
            dp[i][1] = dp[i - 1][1];
            dp[i][1] %= MOD;
        }else if(l[i - 1] == '1'){
            dp[i][0] = dp[i - 1][0] * 3 + dp[i - 1][1];
            dp[i][0] %= MOD;
            dp[i][1] = dp[i - 1][1] * 2;
            dp[i][1] %= MOD;
        }
    }
    return (dp[l.size()][0] + dp[l.size()][1]) % MOD;
}
int main(){
    cin >> l;
    dp[0][1] = 1;
    ll ans = calc();
    cout << ans << endl;
    return 0;
}


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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
using P = pair<ll, ll>;
using V = vector<ll>;
#define rep(i, n) for(ll i=0;i<(ll)(n);i++)
#define rep1(i, n) for(ll i=1;i<=(ll)(n);i++)
#define rep2(i, m, n) for(ll i=m;i<(ll)(n);i++)
#define rrep(i, n, m) for(ll i=n;i>=(ll)(m);i--)
#define ALL(obj) (obj).begin(), (obj).end()
#define MOD 1000000007
#define INF 1000000000

void solve_abc_d() {
	ll h, w;
	cin >> h >> w;

	ll c[101][101];
	ll n;
	cin >> n;
	V a(n);
	ll cnt = 0;
	rep(i, n) {
		cin >> a[i];
		rep(j, a[i]) {
			if (cnt / w % 2 == 0) {
				c[cnt / w][cnt % w] = i + 1;
			}
			else {
				c[cnt / w][w - 1 - cnt % w] = i + 1;
			}
			cnt++;
		}
	}

	rep(i, h){
		rep(j, w - 1) {
			cout << c[i][j] << " ";
		}
		cout << c[i][w - 1] << "\n";
	}
}

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

	solve_abc_d();

	return 0;
}


Measured memory_bytes: 512
N=int(input())
v=list(map(int,input().split()))
v.sort()
if len(v)==1:
    print(v[0])
elif len(v)==2:
    print((v[0]+v[1])/2)
else:
    s=(v[0]+v[1])/2
    for j in range(2,N):
        s=(s+v[j])/2
    print(s)

Measured memory_bytes: 38384
#include<bits/stdc++.h>
#define pb push_back
#define fi first
#define se second
#define io std::ios::sync_with_stdio(false)
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
const int P = 1e9+7, INF = 0x3f3f3f3f;
ll gcd(ll a,ll b)
{
    return b?gcd(b,a%b):a;
}
ll qpow(ll a,ll n)
{
    ll r=1%P;
    for (a%=P; n; a=a*a%P,n>>=1)
        if(n&1)
            r=r*a%P;
    return r;
}
int main()
{
 int x;
 cin>>x;
 if(x>=30)  cout<<"Yes"<<endl;
 else  cout<<"No"<<endl;
}



Measured memory_bytes: 3632
#include <vector>
#include <math.h>
#include <iostream>
#include <string>
#include <algorithm>
#include <queue>
#include <iomanip>
#include <deque>
#include <cctype>

using namespace std;
using uint = unsigned int;
using ll = long long;
using ull = unsigned long long;
using pii = pair<int,int>;
using pll = pair<long, long>;
template <class T> using V = vector<T>;
template <class T> using VV = V<V<T>>;
#define rep(i, n) for(int i = 0; i<n; i++)
#define rep_s(i, start, n) for(int i= start;  i<n; i++)
#define rep_down(i, n) for(int i = n-1; i>=0; i--)
#define rep_down_s(i, n, start) for(int i = n-1; i>=start; i--)
#define ALL(a) (a).begin(), (a).end()
#define ALL_str(a) (a).cbegin(), (a).cend()

string alphabet_upper = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
string alphabet_lower  = "abcdefghijklmnopqrstuvwxyz";
string numbers = "0123456789";

/*
using edge = struct {int to; ll cost;};
vector<edge> tree[limit];
ll depth[limit];

void dfs(int v, int p, ll d){
  depth[v] = d;
  //cout <<"v: " << v << endl;
  for (auto &e: tree[v]){
    //cout << "e.to: " << e.to << endl;
    if (e.to == p) continue;
    dfs(e.to, v, d+e.cost);
  }
}
*/
int keta_sum(int num){
  int dig, sum = 0;
  while(num){
    dig = num % 10;
    sum = sum + dig;
    num = num / 10;
  }
  return sum;
}

ll binary_search(ll left_key, ll border, ll low, ll high) {
     // 配列 a の左端と右端
    ll mid = (low+high)/2;
    while (high > low+1) {
       mid = (low+high)/2;
        if (left_key*mid>border) high = mid;
        else if (left_key*mid<border) low = mid;
        else {
          mid =mid-1;
          break;
        }
    }
    return mid;
}

bool IsPrime(ll a){
  ll b = sqrt(a);
  b++;
  while(b-->=2){
    if (a%b==0) return false;
  }
  return true;
}

struct UnionFind {
    vector<int> par; // par[i]:iの親の番号　(例) par[3] = 2 : 3の親が2

    UnionFind(int N) : par(N) { //最初は全てが根であるとして初期化
        for(int i = 0; i < N; i++) par[i] = i;
    }

    int root(int x) { // データxが属する木の根を再帰で得る：root(x) = {xの木の根}
        if (par[x] == x) return x;
        return par[x] = root(par[x]);
    }

    void unite(int x, int y) { // xとyの木を併合
        int rx = root(x); //xの根をrx
        int ry = root(y); //yの根をry
        if (rx == ry) return; //xとyの根が同じ(=同じ木にある)時はそのまま
        par[rx] = ry; //xとyの根が同じでない(=同じ木にない)時：xの根rxをyの根ryにつける
    }

    bool same(int x, int y) { // 2つのデータx, yが属する木が同じならtrueを返す
        int rx = root(x);
        int ry = root(y);
        return rx == ry;
    }
};

int main(void){
  ll N, M, A, B, C, D, K,W, H, Q, X, Y;
  ll ans;
  string S, T;
  cin >> N;
  rep(i, 16){
    if ((int)N-i*7>=0){
      if (((int)N - i*7)%4 == 0){
      cout <<"Yes" << endl;
      //cout <<"i: " << i << endl;
      return 0;
      }
    }
  }
  cout <<"No" << endl;
  return 0;
}


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

ll maxkoyakusu(ll, ll);
ll minkobaisu(ll ,ll);

int main(){
    ll A, B;
    cin >> A >> B;
    cout << minkobaisu(A, B) << endl;
}

ll maxkoyakusu(ll a, ll b){
    ll l = 1;
    while(l){
        l = a % b;
        a = b;
        b = l;
    }
    return a;
}

ll minkobaisu(ll a, ll b){
    ll x = maxkoyakusu(a, b);
    return a*b/x;
}

Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#include <vector>
#include <string>
#include <map>
#include <queue>
#include <algorithm>
#include <numeric>
#include <fstream>
#include <iomanip>

typedef long double ld;
typedef long long ll;

void print(){ std::cout << std::endl; }
template<typename H> void print(H&& head){ std::cout << head << std::endl; }
template<typename H, typename... T> void print(H&& head, T&&... tail){
  std::cout << head << " ", print(std::forward<T>(tail)...);
}

void solve()
{
  ll arr[32] = {1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};

  ll K;
  std::cin >> K;

  print(arr[K-1]);

  return;
}

int main()
{
  solve();
  return 0;
}



Measured memory_bytes: 256
ABCD = gets.chomp.chars

ans =
  Array
  .new(8) { |i| format('%03b', i).chars.map { |c| '+-'[c.to_i] } }
  .map { |ops| ABCD.zip(ops).flatten.join }
  .find { |exp| eval(exp) == 7 }

puts "#{ans}=7"


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

int main(void)
{
	int num_card;
	cin >> num_card;

	vector<int> cards;
	for (int i = 0; i < num_card; i++) {
		int no;
		cin >> no;
		cards.push_back(no);
	}

	// ソート
	sort(cards.begin(), cards.end());

	// Aliceからカードを取る
	int score_alice = 0;
	int score_bob = 0;
	for (int i = 0; i < num_card; i++) {
		int score = cards.back();
		cards.pop_back();
		if (i % 2 == 0) {
			score_alice += score;
		} else {
			score_bob += score;
		}
	}

	cout << score_alice - score_bob;

	return 0;
}

Measured memory_bytes: 256
#!/usr/bin/env python3

INF = 10 ** 9

que = [0] * 1024

def bfs(g, flow, parent, s1, s2, t1, t2):

    qf = 0
    que[0] = s1
    que[1] = s2
    ql = 2

    while qf < ql:
        u = que[qf]
        qf += 1
        for v in g[u]:
            if 0 <= flow[u][v] and parent[v] == -1:
                parent[v] = u
                if v != t1 and v != t2:
                    que[ql] = v
                    ql += 1
                else:
                    return 1, v

    return 0, 0


def solve(h, w, g, s, t):

    n = h + w
    si, sj = s
    ti, tj = t

    if si == ti or sj == tj:
        return -1

    f = 0
    flow = [[0] * n for _ in range(n)]

    while True:
        parent = [-1] * n
        parent[si] = -2
        parent[sj] = -2

        m, te = bfs(g, flow, parent, si, sj, ti, tj)
        if m == 0:
            break
        f += 1
        v = te
        while v != si and v != sj:
            u = parent[v]
            flow[u][v] -= 1
            flow[v][u] += 1
            v = u

    return f


def main():
    h, w = input().split()
    h = int(h)
    w = int(w)
    g = [[] for _ in range(h + w)]
    s = None
    t = None
    for i in range(h):
        a = input()
        for j in range(w):
            ch = a[j]
            if ch == 'o':
                g[i].append(h + j)
                g[h + j].append(i)
            elif ch == 'S':
                s = (i, h + j)
            elif ch == 'T':
                t = (i, h + j)


    print(solve(h, w, g, s, t))


if __name__ == '__main__':
    main()



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

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

  string nr = n;
  reverse(nr.begin(), nr.end());

  if (n == nr) {
    cout << "Yes" << endl;
  }
  else {
    cout << "No" << endl;
  }

  return 0;
}



Measured memory_bytes: 256
#include <iostream>

int main(){
  //nªzñ·³,countªvZñÌÂàè
  int n,count;
  while(std::cin >> n){
    //std::cout << n << std::endl;
    if(!n) {
      break;
    }
    int s[n];
    bool flag;
    int cnt[n];
    int cnt_of[n];
    int new_s[n];
    int old_s[n];
    
    //üÍtF[Y
    for(int i=0;i<n;i++){
      std::cin >> s[i];
    }

    for(int ans=0;;ans++){
      //½Â é©ð¦é
      cnt[0]=s[0];
      cnt_of[0]=1;
      int count=0;
      
      //iÔÚª¡ÜÅÉoÄ«½©mF
      for(int i=1;i<n;i++){
	for(int j=0;;j++){
	  if(cnt[j]==s[i]){
	    cnt_of[j]++;
	    break;
	  }
	  if(j==count){
	    count++;
	    cnt[count]=s[i];
	    cnt_of[count]=1;
	    //	    std::cout << count <<"count+" << i << std::endl;
	    break;
	  }
	}
      }//iÔÚ[v
      
      flag = true;
      //eiÉlðãü
      for(int i=0;i<n;i++){
	for(int j=0;j<=count;j++){
	  if(cnt[j]==s[i]){
	    new_s[i]=cnt_of[j];
	    break;
	  }
	}
	if(new_s[i]!=s[i]){
	  flag = false;
	  s[i]=new_s[i];
	}
      }
      
      //mFpoÍ

      /*      for(int i=0;i<n;i++){
	std::cout << new_s[i] << " ";
      }
      std::cout << std::endl;
      */

      if(flag){
	std::cout << ans << std::endl;
	//mFpoÍ
	for(int i=0;i<n-1;i++){
	  std::cout << new_s[i] << " ";
	}
	std::cout << new_s[n-1];
	std::cout << std::endl;
	break;
      }
    }
  }//while
}

Measured memory_bytes: 0
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;
#define ll long long
//increase stack size
#pragma comment(linker, "/STACK:16777216")

ll mxm() {return LLONG_MIN;}
template<typename... Args>
ll mxm(ll a, Args... args) { return max(a,mxm(args...)); }

ll mnm() {return LLONG_MAX;}
template<typename... Args>
ll mnm(ll a, Args... args) { return min(a,mnm(args...)); }

template<class T> ostream& operator<<(ostream& os,vector<T> V){
	os<<"[ ";for(auto v:V)os<<v<<" ";return os<<"]";
}
template<class L,class R> ostream& operator<<(ostream& os,pair<L,R> P){
	return os<<"("<<P.first<<","<<P.second<<")";
}

#define TRACE
#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__,__VA_ARGS__)
template<typename Arg1>
void __f(const char* name,Arg1&& arg1){
	cout<<name<<" : "<<arg1<<endl;
}
template <typename Arg1,typename... Args>
void __f(const char* names,Arg1&& arg1,Args&&... args){
	const char* comma=strchr(names+1,',');cout.write(names,comma-names)<<" : "<<arg1<<" | ";__f(comma+1,args...);
}
#else
#define trace(...) 1
#endif

#define ld long double
#define pll pair<ll,ll>
#define ii pair<int,int>
#define vll vector<ll>
#define vii vector<ii>
#define vi vector<int>
#define vpll vector<pll>
#define vld vector<ld>
#define vvld vector<vld>
#define vvi vector<vi>
#define vvll vector<vll>
#define vvpll vector<vpll>
#define vvii vector<vii>
#define I insert
#define F first
#define S second
#define pb push_back
#define endl "\n"
#define all(x)	x.begin(),x.end()

const int mod=1e9+7;
// 128 bit: __int128
inline int add(int a,int b){a+=b;if(a>=mod)a-=mod;return a;}
inline int sub(int a,int b){a-=b;if(a<0)a+=mod;return a;}
inline int mul(int a,int b){return (a*1ll*b)%mod;}
inline int power(int a,int b){int rt=1;while(b>0){if(b&1)rt=mul(rt,a);a=mul(a,a);b>>=1;}return rt;}
inline int inv(int a){return power(a,mod-2);}

struct compare{
	bool operator() (const int &a,const int &b) const{
		return a>b;
	}
};

const ll N = 50, M = 2500;

vector<vector<pair<ll, pll> > >  adj(N);
vvll dp(N, vll(2501, 1e18));

int main()
{
	ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);cout<<setprecision(25);
	ll n, m, s;
	cin >> n >> m >> s;
	for(ll i = 0; i < m; i++){
		ll u, v, a, b;
		cin >> u >> v >> a >> b;
		--u, --v;
		adj[u].pb({v, {a, b}});
		adj[v].pb({u, {a, b}});
	}
	vpll price(n);
	for(ll i = 0; i < n; i++)
		cin >> price[i].F >> price[i].S;
	priority_queue<pair<ll, pll> > pq;
	dp[0][min(M, s)] = 0;
	pq.push({0, {0, min(M, s)}});
	while(!pq.empty()){
		auto a = pq.top();
		pq.pop();
		ll i = a.S.F, j = a.S.S, cst = -a.F;
		if(cst != dp[i][j])
			continue;
		ll r = min(M, j + price[i].F);
		if(cst + price[i].S < dp[i][r])
			dp[i][r] = cst + price[i].S, pq.push({-cst - price[i].S, {i, r}});
		for(auto node : adj[i]){
			if(j >= node.S.F && cst + node.S.S < dp[node.F][j - node.S.F])
				dp[node.F][j - node.S.F] = cst + node.S.S, pq.push({-cst - node.S.S, {node.F, j - node.S.F}});
		}
	}
	for(ll i = 1; i < n; i++){
		ll c = 1e18;
		for(auto j : dp[i])
			c = min(c, j);
		cout << c << endl;
	}
}

Measured memory_bytes: 7376
#include<bits/stdc++.h>
using namespace std;
const int MAXN = 100005;
int A[MAXN], B[MAXN], C[MAXN];
int dp[MAXN][4];
int main(){
	int n;
	cin>>n;
	for(int i = 1; i <= n; i++){
		cin>>A[i]>>B[i]>>C[i];
	}
	dp[1][1] = A[1];
	dp[1][2] = B[1];
	dp[1][3] = C[1];
	for(int i = 2; i <= n; i++){
		dp[i][1] += max(dp[i - 1][2], dp[i - 1][3]) + A[i];
		dp[i][2] += max(dp[i - 1][1], dp[i - 1][3]) + B[i];
		dp[i][3] += max(dp[i - 1][1], dp[i - 1][2]) + C[i];
	}
	int ans = max(dp[n][1], max(dp[n][2], dp[n][3]));
	printf("%d",ans);
	return 0; 
}

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

typedef unsigned long long ull;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<double, double> pdd;
//const ull mod = 1e9 + 7;
const ll mod = 1e9 + 7;
#define REP(i,n) for(int i=0;i<(int)n;++i)

// debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

template<class S, class T> ostream& operator << (ostream& os, const pair<S, T> v){
  os << "(" << v.first << ", " << v.second << ")"; return os;
}
template<class T> ostream& operator << (ostream& os, const vector<T> v){
  for(int i = 0; i < (int)v.size(); i++){if(i > 0){os << " ";} os << v[i];} return os;
}
template<class T> ostream& operator << (ostream& os, const vector<vector<T>> v){
  for(int i = 0; i < (int)v.size(); i++){if(i > 0){os << endl;} os << v[i];} return os;
}
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }

// conversion number to bit
string num2bit(ll num, ll len){
  string bit = "";
  REP(i, len){
    bit += char('0'+(num>>i & 1));
  }
  return bit;
}

ll powLL(ll a, ll n){
    ll res = 1;
    while(n>0){
        if(n&1){
            res *= a;
            res %= mod;
        }
        a = a*a;
        a %= mod;
        n >>= 1;
    }
    return res;
}

ll modinv(ll a, ll m) {
    ll b = m, u = 1, v = 0;
    while (b) {
        ll t = a / b;
        a -= t * b; swap(a, b);
        u -= t * v; swap(u, v);
    }
    u %= m;
    if (u < 0) u += m;
    return u;
}

ll combination(ll x, ll y){
	ll res = 1;
	REP(i, y){
		res *= (x-i);
		res %= mod;
		res *= modinv(y-i, mod);
		res %= mod;
	}
	return res;
}

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

    ll n, a, b;
    cin >> n >> a >> b;

    ll res = powLL(2, n);
    res -= 1;
    res += mod;
    res %= mod;

    res -= combination(n, a);
    res += mod;
    res %= mod;

    res -= combination(n, b);
    res += mod;
    res %= mod;

    cout << res << endl;
    return 0;
}

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

using namespace std;
 
typedef long long ll;
typedef long double ld;
typedef pair<int, int> Pii;
typedef pair<int, ll> Pil;
typedef pair<ll, ll> Pll;
typedef pair<ll, int> Pli;
typedef vector < vector<ll> > Mat;

#define fi first
#define se second

const ll MOD = 1e9 + 7;
const ll MOD2 = 998244353;
const ll MOD3 = 1812447359;
const ll INF = 1ll << 62;
const double PI = 2 * asin(1);

void yes() {printf("yes\n");}
void no() {printf("no\n");}
void Yes() {printf("Yes\n");}
void No() {printf("No\n");}
void YES() {printf("YES\n");}
void NO() {printf("NO\n");}

int N, M, ans;
vector <int> Graph[55];
bool visited[55];

int Check(int s, int t){
  fill(visited, visited + N + 1, false);

  queue <int> que; que.push(s);
  visited[s] = true;
  while (!que.empty()){
    int Q = que.front(); que.pop();
    for (int j : Graph[Q]){
      if (Q == s && j == t) continue;
      if (Q == t && j == s) continue;
      if (visited[j]) continue;
      visited[j] = true; que.push(j);
    }
  }

  for (int i = 1; i <= N; i++){
    if (!visited[i]){
      ans++; return 0;
    }
  }

  return 0;
}

int main(){
  cin >> N >> M;
  for (int i = 0; i < M; i++){
    int A, B; cin >> A >> B;
    Graph[A].push_back(B);
    Graph[B].push_back(A);
  }

  for (int i = 0; i < N; i++){
    for (int j : Graph[i]){
      if (i > j) continue;
      Check(i, j);
    }
  }
  cout << ans << endl;

  return 0;
}


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

bool is_square(int n)
{
    for (int i = 0; i <= n; i++)
    {
        if (i * i == n)
        {
            return true;
        }
    }
    return false;
}
double distance(double x1, double y1, double x2, double y2)
{
    return sqrt((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2));
}

int main()
{
    int n;
    cin >> n;
    int a = 1;
    int c = 1;
    for (size_t i = 0; i < n; i++)
    {
        int b;
        cin >> b;
        if (b % 2 == 0)
        {
            a *= 2;
        }
        c *= 3;
    }
    cout << c - a << endl;

    return 0;
}

Measured memory_bytes: 256
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author TM
 */


#include <bits/stdc++.h>

using namespace std;

class DLuckyPIN {
public:
    void solve(std::istream &cin, std::ostream &cout) {
        int n;
        cin >> n;
        string s;
        cin >> s;
        vector<string> v = {"0", "1", "2", "3", "4", "5", "6", "7", "8", "9"};
        int ans = 0;
        for (auto i: v) {
            for (auto j: v) {
                for (auto k: v) {
                    string num = i + j + k;
                    int index = 2;
                    for (const auto &digit: s) {
                        if (num[index] == digit) {
                            index--;
                        }
                        if (index < 0) {
//                            cout << num << endl;
                            ans++;
                            break;
                        }
                    }
                }
            }
        }
        cout << ans << endl;
    }

};


int main() {
    DLuckyPIN solver;
    std::istream &in(std::cin);
    std::ostream &out(std::cout);
    solver.solve(in, out);
    return 0;
}


Measured memory_bytes: 256
/* {{{ Definitions */
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <ios>
#include <utility>
#ifdef _WIN32
#include "debug.hpp"
#endif
using namespace std;

#define rep(i, N)  for(int i = 0; i < (N); i++)
#define reps(i, N) for(int i = 1; i <= (N); i++)
#define repr(i, N) for(int i = (N) - 1; i >= 0; i--)
#define pub push_back

template<typename T> 
void chmax(T &a, T b){ a = max(a, b); };
template<typename T> 
void chmin(T &a, T b){ a = min(a, b); };

typedef long long ll;
typedef pair<int, int> P;
const int INF = 100000000;
const ll LINF = 10000000000000000;
const int MOD = 1000000007;
/* }}}------------------------------------------- */
string S, T;
void solve(){
	int cnt = 0;
	rep(i,3){
		if(S[i] == T[i])
			cnt++;
	}
	cout << cnt << endl;
}

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

Measured memory_bytes: 764
import java.util.Scanner;
//int[] date=new int[2];
public class Main {
int i,o,sum,h,s,e,u,ty,yu,ui,n,num,qw;
double m,t,r,j,k,f,d,g,w;
static double l;
String b,c,z,x,v,a,q;
Scanner scan =new Scanner(System.in);
//入力
	public void input() {	
	
	}
	//演算
	public void compute() {
	
		}
//出力
	public void output() {
	int[]	date=new int[2];
		for(o=0;o<2;o++) {
		date[o]=scan.nextInt();
		}
		int[] dat=new int[date[1]];
		for(h=0;h<date[1];h++) {
			dat[h]=scan.nextInt();
			sum+=dat[h];
		}
		if(date[0]-sum>-1) {
			System.out.println(date[0]-sum);
		}else {
			System.out.println("-1");
		}
		}
	public static void main(String [ ] args) {
		Main p = new  Main ();
		p.input();
		p.compute();
		p.output();
		}
	}

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

int a1,a2,a3;
int main(){
    cin >> a1 >> a2 >> a3;
    if(a1 + a2 + a3 >= 22) cout << "bust" << endl;
    else cout << "win" << endl;
    return 0;
}

Measured memory_bytes: 3588
#define DINGER_GISBAR
#include <bits/stdc++.h>
using namespace std;
const long long MOD = static_cast<int>(1e9) + 7;
//{{{TEMPLATE_BEGIN
#include <unistd.h>
using namespace std::rel_ops;
#ifdef ZEROKUGI
#include <dumper.hpp>
#define dump(x) dumper::dumper(cerr, __LINE__, (#x), (x), 50, 1, 1)
#define tick(...) dumper::tick(__VA_ARGS__)
#pragma message "Compiling " __FILE__
#else
#define dump(x)
#define tick(...)
#endif
typedef long long lint;
typedef unsigned long long ulint;
typedef long double ldouble;
typedef vector<int> vint;
#define rep(i, n) \
    for (int i = 0, i##_len = static_cast<int>(n); i < i##_len; i++)
#define all(c) begin(c), end(c)
#define perm(c)   \
    sort(all(c)); \
    for (bool c##p = 1; c##p; c##p = next_permutation(all(c)))
#define uniquenize(v) (v).erase(unique(all(v)), end(v))
#define cauto const auto&
#define memset(x, y) memset(x, y, sizeof(x))
#define popcount __builtin_popcount
#define gcd __gcd
inline lint bit(int x) { return 1LL << x; }
template <class T>
inline int size(const T& a) {
    return (int)a.size();
}
template <class T>
inline bool chmin(T& a, const T& b) {
    return a > b ? a = b, 1 : 0;
}
template <class T>
inline int clamp(T v, T lo, T hi) {
    return (v > hi) - (v < lo);
}
template <class T>
inline bool chmax(T& a, const T& b) {
    return a < b ? a = b, 1 : 0;
}
template <class T>
inline pair<vector<T>, char> operator*(const vector<T>& v, const char& c) {
    return make_pair(v, c);
}
template <class T>
inline istream& operator>>(istream& is, vector<T>& v) {
#ifdef ZEROKUGI
    if (v.empty()) {
        cerr << "Error L" << __LINE__ << ": vector size is zero." << endl;
        exit(EXIT_FAILURE);
    }
#endif
    for (auto& x : v) is >> x;
    return is;
}
template <class T>
inline ostream& operator<<(ostream& os, const pair<vector<T>, char>& v) {
    bool t = 0;
    for (const T& x : v.first) {
        if (t) os << v.second;
        os << x;
        t = 1;
    }
    return os;
}
template <class T>
inline ostream& operator<<(ostream& os, vector<T>& v) {
    return os << v * ' ';
}
struct before_main {
    before_main() {
        cin.tie(0);
        ios::sync_with_stdio(0);
        cout << fixed << setprecision(20);
        tick(0, 0);
    };
} __before_main;
//}}}TEMPLATE_END

lint n, m, k;
lint x[100001];

vector<lint> apply(const vector<lint>& v, const vector<lint>& p) {
    vector<lint> res(n);
    for (int i = 0; i < n; i++) {
        res[i] = v[p[i]];
    }

    return res;
}
int main() {
    cin >> n;
    rep(i, n) cin >> x[i];

    n--;

    vector<lint> d(n);
    rep(i, n) d[i] = x[i + 1] - x[i];

    vector<lint> p(n);
    iota(all(p), 0LL);

    cin >> m >> k;
    rep(i, m) {
        int q;
        cin >> q;
        swap(p[q - 2], p[q - 1]);
    }

    while (k) {
        if (k % 2 == 1) {
            d = apply(d, p);
        }

        p = apply(p, p);

        k /= 2;
    }

    lint ans = x[0];
    rep(i, n){
        cout << ans << endl;
        ans += d[i];
    }
    cout << ans << endl;
}


Measured memory_bytes: 4432
#include <iostream>
#include <stdio.h>
#include <string.h>

using namespace std;

int main(){
    string str1,str2,str3;
    int a, b;
    string p;
    string temp1,temp2,temp3;
    int q;
    int i,j;
    int len_str2;
    int len_temp1;
    int len_temp2;
   
    cin >> temp1;
    cin >> q;
    
    len_temp1 = temp1.length();
    
    for( i = 0; i < q; i++){
        cin >> str2;
        len_str2 = str2.length();
        str3 = str2.substr(0,3);
        //cout << str3 << endl;
        if(str3 == "rep"){
            cin >> a >> b >> p;
            temp1.replace(a,b-a+1,p);
            //cout << temp1 << endl;
        }else if(str3 == "rev"){
            cin >> a >> b;
            temp2 = temp1.substr(a,b-a+1);
            //cout << temp2 << endl;
            len_temp2 = temp2.length();
            temp3 = "";
            for (j=len_temp2-1; j >= 0; j--){
                temp3 = temp3 + temp2[j];
            }
            temp1.replace(a,b-a+1,temp3);
            //cout << temp1 << endl;
        }else{
            cin >> a >> b;
            cout << temp1.substr(a,b-a+1) << endl;
        }
    }
    
    return 0;
}

Measured memory_bytes: 3216
void main()
{
    long n, m;
    rdVals(n, m);
    long[] a = rdRow;

    max(n-a.sum, -1).writeln;
}

enum long mod = 10^^9 + 7;
enum long inf = 1L << 60;
enum double eps = 1.0e-9;

T rdElem(T = long)()
if (!is(T == struct))
{
    return readln.chomp.to!T;
}

alias rdStr = rdElem!string;
alias rdDchar = rdElem!(dchar[]);

T rdElem(T)()
if (is(T == struct))
{
    T result;
    string[] input = rdRow!string;
    assert(T.tupleof.length == input.length);
    foreach (i, ref x; result.tupleof)
    {
        x = input[i].to!(typeof(x));
    }
    return result;
}

T[] rdRow(T = long)()
{
    return readln.split.to!(T[]);
}

T[] rdCol(T = long)(long col)
{
    return iota(col).map!(x => rdElem!T).array;
}

T[][] rdMat(T = long)(long col)
{
    return iota(col).map!(x => rdRow!T).array;
}

void rdVals(T...)(ref T data)
{
    string[] input = rdRow!string;
    assert(data.length == input.length);
    foreach (i, ref x; data)
    {
        x = input[i].to!(typeof(x));
    }
}

void wrMat(T = long)(T[][] mat)
{
    foreach (row; mat)
    {
        foreach (j, compo; row)
        {
            compo.write;
            if (j == row.length - 1) writeln;
            else " ".write;
        }
    }
}

import std.stdio;
import std.string;
import std.array;
import std.conv;
import std.algorithm;
import std.range;
import std.math;
import std.numeric;
import std.mathspecial;
import std.traits;
import std.container;
import std.functional;
import std.typecons;
import std.ascii;
import std.uni;
import core.bitop;

Measured memory_bytes: 3052
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N;
  cin >> N;
  
  int mochi[N];
  for(int i=0; i<N; i++){
  cin >> mochi[i];
  }
  
  sort(mochi, mochi+N);
  
   int dan = 1;
  
  for( int i = 0; i<N-1; i++){
    if(mochi[i] < mochi[i+1]){
    	dan += 1;
    }
    else{
      	dan += 0;
    }
  }
  
  cout << dan << endl;

}

Measured memory_bytes: 256