akhauriyash/Code-Regression huggingface dataset:
#include "bits/stdc++.h"
using namespace std;
using ll = long long;
#define rep(i, begin, n) for (int i = begin; i < n; i++)
#define repe(i, begin, n) for (int i = begin; i <= n; i++)
#define repr(i, begin, n) for (int i = begin; i > begin - n; i--)
#define repre(i, begin, end) for (int i = begin; i >= end; i--)

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

const int inf = 1000000007;
const int MOD = 1000000007;
const long long INF = 1000000000000000007;

// -------------------------------------------------------
ll N, A, B, C;

int main() {
  cin >> N >> A >> B >> C;
  vector<string> s(N);
  rep(i, 0, N) { cin >> s[i]; }

  if (A + B + C == 0) {
    cout << "No" << endl;
    return 0;
  }

  int cnt = 0;
  vector<char> ans;
  for (auto i : s) {
    if (i == "AB") {
      if (A == 0 && B == 0) {
        cout << "No" << endl;
        return 0;
      }
      if (A > B) {
        A--;
        B++;
        ans.push_back('B');
      } else if (A < B) {
        A++;
        B--;
        ans.push_back('A');
      } else if (s[cnt + 1] == "BC") {
        A--;
        B++;
        ans.push_back('B');
      } else {
        A++;
        B--;
        ans.push_back('A');
      }
    } else if (i == "BC") {
      if (B == 0 && C == 0) {
        cout << "No" << endl;
        return 0;
      }
      if (B > C) {
        B--;
        C++;
        ans.push_back('C');
      } else if (B < C) {
        B++;
        C--;
        ans.push_back('B');
      } else if (s[cnt + 1] == "AC") {
        B--;
        C++;
        ans.push_back('C');
      } else {
        B++;
        C--;
        ans.push_back('B');
      }
    } else {
      if (C == 0 && A == 0) {
        cout << "No" << endl;
        return 0;
      }
      if (C > A) {
        C--;
        A++;
        ans.push_back('A');
      } else if (C < A) {
        C++;
        A--;
        ans.push_back('C');
      } else if (s[cnt + 1] == "AB") {
        C--;
        A++;
        ans.push_back('A');
      } else {
        C++;
        A--;
        ans.push_back('C');
      }
    }
    cnt++;
  }

  cout << "Yes" << endl;
  for (auto i : ans) {
    cout << i << endl;
  }
}

Measured memory_bytes: 6732
//author-Abhijit Dey
//Welcome to my code. btw I hate coding 😉




#include <bits/stdc++.h>
using namespace std;
#define     ff first
#define     ss second
#define     pb push_back
#define     mp make_pair
#define     INF 1000000005
#define     MOD 1000000007
#define     ninf -1000000000
#define     all(c) c.begin(), c.end()
#define     tinput long long int t;cin>>t;
#define     mem(a,x) memset(a,x,sizeof a)
#define     for0(i,n) for(long long int i=0;i<n;i++)
#define     pi 3.141592653589793238462643383279502884
#define     fori(i,a,n) for(long long int i=a;i<n;i++)
#define     forxy(i,x,y) for(int i=x;i<=y;i++)
#define     rfor(i,n) for(long long int i=n-1;i>=0;i--)
#define     ainput for(int i=0; i<n; i++) cin>>a[i];
#define     fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);




typedef     long long int ll;
typedef     vector<long long int>vll;
typedef     vector<vector<int> >vvll;
typedef     pair<long long int,long long int>pr;
typedef     vector<pair<long long int,long long int> >vp;





inline long long  min2(long long  a, long long  b)  {return (a)<(b)?(a):(b);}
inline long long  max2(long long  a, long long  b)  {return (a)>(b)?(a):(b);}
inline long long  max3(long long  a, long long  b, long long  c)    {return (a)>(b)?((a)>(c)?(a):(c)):((b)>(c)?(b):(c));}
inline long long  min3(long long  a, long long  b, long long  c)    {return (a)<(b)?((a)<(c)?(a):(c)):((b)<(c)?(b):(c));}
using namespace std::chrono;
ll dx[4]={0,0,1,-1};
ll dy[4]={1,-1,0,0};
bool valid(ll x,ll y,ll n,ll m){if(x<0 or y<0)return false;else if(x>=n or y>=m)return false;else return true;}

void process()
{
    ll n,d;cin>>n>>d;
    ll c=0;
    for0(i,n)
    {
        ll x,y;cin>>x>>y;
        if(sqrt((x*x)+(y*y))<=d)c++;
    }
    cout<<c<<endl;
}
int main()
{
    fastio;
    //tinput;
    //while(t--)
        process();
}

Measured memory_bytes: 3684
import java.util.ArrayList;
import java.util.Scanner;

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

        int n = sc.nextInt();
        ArrayList<Integer> l = new ArrayList<>();

        for(int i = 0; i < n ; i++){
            l.add(sc.nextInt());
        }
        int t = 0;

            for (int i = 0; i < n; i++) {
                while(l.get(i) % 2 == 0){

                    t++;
                    l.set(i, l.get(i) / 2);
                }
            }
        System.out.println(t);
    }
}

Measured memory_bytes: 36556
#include  <stdio.h>

int main() {
  int x,y,s;
  
  while(1){
    scanf("%d %d", &x,&y);
    if(1<=x&&y<=1000000000) break;
  }
  if(x>=y){
    while(1){
      s=x%y;
      if(s==0) break;
      x=y;
      y=s;
    }
    printf("%d\n",y);
  }

 else if(y>x){
    while(1){
      s=y%x;
      if(s==0) break;
      y=x;
      x=s;
    }
    printf("%d\n",x);
 }


  
    
  return 0;
}



Measured memory_bytes: 2108
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<string>
#include<vector>
#include<list>
#include<set>
#include<map>
#include<queue>
#include<stack>
#include<cctype>
#include<climits>
#include<bitset>
#include<bits/stdc++.h>
#define ld long double
#define ll long long int
#define ull unsigned long long int
#define rep(i,n) for(i=0;i<n;i++)
#define fin(ans) cout<<(ans)<<endl
#define INF INT_MAX
#define vvi vector<vector<int> >
#define vvc vector<vector<char> >
#define vvs vector<vector<string> >
#define P 1000000007
using namespace std;
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;}
const long long LLINF=1LL<<60;
//set<int>::iterator it;



int main(void){ios::sync_with_stdio(false);cin.tie(0);
//////////////////////////////////////////////////////
	
	int i,n;
	string s;
	int ans=0;
	cin>>n;
	int lasta=0,firstb=0,doubleab=0;
	rep(i,n){
		cin>>s;
		while(s.find("AB")!=string::npos){
			s.replace(s.find("AB"),2,"a");
			ans++;
		}
		//cout<<s<<endl;
		if(s[0]=='B'&&s[s.length()-1]=='A')doubleab++;
		else if(s[s.length()-1]=='A')lasta++;
		else if(s[0]=='B')firstb++;
		
	}
	if(doubleab>1){
		ans+=doubleab-1;
		doubleab=1;
	}
	if(lasta>0&&doubleab==1){
		ans++;
		lasta--;
	}
	if(firstb>0&&doubleab==1){
		ans++;
		firstb--;
	}
	cout<<ans+min(lasta,firstb)<<endl;
	
	
	
	
//////////////////////////////////////////////////////
return 0;}











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

int main() {
  ios::sync_with_stdio(false), cin.tie(0);
  vector<int> nums = {
    1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51
  };
  int k;
  cin >> k;
  cout << nums[k - 1] << '\n';
  return 0;
}

Measured memory_bytes: 256
import java.util.*;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int x = sc.nextInt(), a = sc.nextInt();
		sc.close();
		int ans[] = {0, 10};
		int an = 0;
		if(x >= a)an = 1;
		System.out.println(ans[an]);
	}
}


Measured memory_bytes: 22868
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

struct Edge {
	int from, to, cost;

	Edge(int from_, int to_, int cost_)
		:from(from_), to(to_), cost(cost_)
	{}
	
	bool operator <(const Edge &e) const{
		return cost < e.cost;
	}
};

struct Unionfind {
	int n;
	vector<int> par;

	Unionfind(int n_) {
		n = n_;
		par.resize(n);
		for (int i = 0;i < n;i++) {
			par[i] = i;
		}
	}

	int root(int a) {
		if (par[a] == a)return a;
		return par[a] = root(par[a]);
	}

	bool same(int a, int b) {
		return root(a) == root(b);
	}

	void unite(int a, int b) {
		int A = root(a);
		int B = root(b);
		if (A == B)return;

		par[A] = B;
	}
};

int main(void) {
	int v, e, i, s, t, w;

	cin >> v >> e;

	vector<Edge> edge;
	edge.clear();

	Unionfind tree(v);

	for (i = 0;i < e;i++) {
		cin >> s >> t >> w;
		edge.push_back(Edge(s, t, w));
	}
	sort(edge.begin(), edge.end());

	int sum = 0, cnt = 0;
	for (i = 0;i < edge.size();i++) {
		s = edge[i].from;
		t = edge[i].to;
		w = edge[i].cost;

		if (tree.root(s) != tree.root(t)) {
			sum += w;
			cnt++;
			tree.unite(s, t);
		}

		if (cnt == v)break;
	}

	cout << sum << endl;

	return 0;
}



Measured memory_bytes: 4576
import sys

def main():

	S = 0
	N,M = map(int, input().split())
	Lists = list(map(int, input().split()))
	
	count = 0
	
	for List in Lists:
		S += List
	if N-S >= 0 :
	
		print(N-S)
	
	else:
		print("-1")
	
if __name__ == "__main__":
    main()

Measured memory_bytes: 10192
#include<stdio.h>

int main() {
    int a, b, c;
    scanf("%d %d %d", &a, &b, &c);
    
    int ab = a + b, bc = b + c, ca = a + c;
    if (ab <= bc && ab <= ca) {
       printf("%d\n", ab);
    } else if (bc <= ab && bc <= ca) {
       printf("%d\n", bc);
    } else {
       printf("%d\n", ca);
    }
    
    return 0;
}

Measured memory_bytes: 128
/*****************************************************************\
    |     IN THE NAME OF ALLAH, MOST GRACIOUS AND MOST MERCIFUL       |
    |                                                                 |
    |     Author     : Mahabub Rahman                                 |
    |     Email      : mahabubrahman618@gmail.com                     |
    |     University : Comilla University, Bangladesh		          |
    |                  Department of Computer Science & Engineering   |
    \*****************************************************************/


    /*...................................Data_Types............................................*/
    #include<bits/stdc++.h>

    using namespace std;
    #define FastIO ios::sync_with_stdio(false); cin.tie(0);cout.tie(0)
    #define       ll                  long long int
    #define       ull                  unsigned long long int
    #define       veci                 vector<int>
    #define       vecc                 vector<char>
    #define       vecs                 vector<string>
    #define       vecl                 vector<long long int>
    #define       vecp                 vector<  pair<int,int> >
    #define       mapstrint            map< string , int >
    #define       mapstrstr            map< string , string >
    #define       mapint               map< int, int >
    #define       pb                   push_back
    #define       pob                  pop_back
    #define       mp                   make_pair
    #define       pii                  pair<int, int>
    #define       F                    first
    #define       S                    second
    ////============ CONSTANT ===============////
    #define mx9   1000000007
    #define mx7   10000007
    #define mx6   1000006
    #define mx5   200005
    #define inf   1<<30                                           //infinity value
    #define eps   1e-9

    #define mod   1000000007
    ////=====================================////

    long double PI = acosl(-1);
    bool compare_int(int a, int b) //This function is use for descending order.
    {
        return (a>b);
    }
    bool compare_string (string a, string b)
    {
        return a.size() < b.size();
    }
    bool compare_pair(const pair<int,int> &a,
                  const pair<int,int> &b)
    {
        if(a.second==b.second) return a.first>b.first;
        else return (a.second > b.second);
    }
    /*ll fact(ll n)
    {
        if(n==0 || n==1) return 1;
        else return n*fact(n-1);
    }*/

    ////======================================////
    /*bool check(int n)
    {
        for(int i=2; i<=sqrt(n); i++)
        {
            if(n%i==0)
            {
                return false;
            }
        }
        return true;
    }*/
    //bool ta[mx5];
    int32_t main()
    {
        //Don't see test case until get 7/8 times wrong submission..!!
        //Try to make Corner, Even, Odd or Prime case..!!
        FastIO;
        ll ans;
        cin >> ans;
        cout << (ans*(ans-1))/2 << endl;
    }


Measured memory_bytes: 256
n = int(input())
A = sorted(list(map(int, input().split())), reverse=True)

res = A[0]
num = (n - 1) // 2
for i in range(1, num + 1):
    res += A[i] * 2

if n % 2 == 1:
    res -= A[num]

print(res)

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

#define MOD 1000000007
#define rep(i, n) for(ll i=0; i < (n); i++)
#define rrep(i, n) for(ll i=(n)-1; i >=0; i--)
#define ALL(v) v.begin(),v.end()
#define rALL(v) v.rbegin(),v.rend()
#define FOR(i, j, k) for(ll i=j;i<k;i++)
#define debug_print(var) cerr << #var << "=" << var <<endl;
#define DUMP(i, v)for(ll i=0;i<v.size();i++)cerr<<v[i]<<" "
#define fi first
#define se second

using namespace std;
typedef long long int ll;
typedef vector<ll> llvec;
typedef vector<double> dvec;
typedef pair<ll, ll> P;
typedef long double ld;
struct edge{ll x, c;};

ll mod(ll a, ll mod){
  ll res = a%mod;
  if(res<0)res=res + mod;
  return res;
}

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

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

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

bool is_prime(ll n){
  ll i = 2;
  if(n==1)return false;
  if(n==2)return true;
  bool res = true;
  while(i*i <n){
    if(n%i==0){
      res = false;
    }
    i = i+1;
  }

  //if(i==1)res = false;
  if(n%i==0)res=false;
  return res;
}

struct UnionFind{
  ll N;
  llvec p;
  llvec cnt;
  UnionFind(ll n){
    N = n;
    p=llvec(N);
    cnt=llvec(N, 0);
    rep(i, N){
      p[i] = i;
      cnt[i] = 1;
    }
  }

  void con(ll a, ll b){
    P at = root(a);
    P bt = root(b);
    if(at.second!=bt.second){
      if(at.first>bt.first){
        swap(at, bt);
        swap(a, b);
      }
      p[at.second] = bt.second;
      cnt[bt.second]+=cnt[at.second];
      p[a]=bt.second;
    }
  }

  P root(ll a){
    ll atmp = a;
    ll c=0;
    while(atmp!=p[atmp]){
      atmp = p[atmp];
      c++;
    }
    p[a] = atmp;
    return {c, atmp};
  }

  bool is_con(ll a, ll b){
    P at=root(a);
    P bt=root(b);
    return at.second == bt.second;
  }
  
};

struct dijkstra{
  ll N;
  llvec d;
  vector<vector<edge>> e;
  dijkstra(ll n){
    N = n;
    //d = llvec(N, 1e18);
    e = vector<vector<edge>>(N);
  }

  void add_edge(ll from, ll to, ll cost){
    e[from].push_back({to, cost});
  }

  void run(ll start){
    priority_queue<P, vector<P>, greater<P>> que;
    que.push({0, start});
    d = llvec(N, 1e18);
    d[start]=0;
    while(!que.empty()){
      P q = que.top();que.pop();
      ll dc = q.first;
      ll x = q.second;
      if(dc>d[x]){
        continue;
      }else{
        for(auto ip: e[x]){
          if(d[ip.x]<=d[x]+ip.c){
            continue;
          }else{
            d[ip.x]= d[x]+ip.c;
            que.push({d[ip.x], ip.x});
          }
        }
      }
    }
  }  
};


/**************************************
** A main function starts from here  **
***************************************/
int main(){
  ll N;
  cin >> N;
  bool flg = true;
  rep(i, N){
    ll a;
    cin >> a;
    flg = flg and a%2==0;
  }
  if(flg)cout << "second";
  else cout << "first";
  return 0;
}


Measured memory_bytes: 3592
#include <bits/stdc++.h>
using namespace std;
#define rep0(i,n) for(ll (i) = 0; (i) < (n); ++(i))
#define rrep0(i,n) for(ll (i) = (n) - 1; (i) >= 0; --(i))
#define rep1(i,n) for(ll (i) = 1; (i) <= (n); ++(i))
#define rrep1(i,n) for(ll (i) = (n); (i) >= 1; --(i))
#define nfor(i,a,b) for(ll (i) = (a); (i) < (b); ++(i))
#define rfor(i,a,b) for(ll (i) = (a); (i) > (b); --(i))
#define ll long long
#define mod (1000000007)
#define pf(x) cout << (x) << endl;
#define all(x) (x).begin(),(x).end()

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

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

ll factorial(ll n){
    ll t = 1;
    rep1(i, n)t *= i;
    return t;
}

ll combinations(ll n, ll k) {
    ll r = 1;
    rep1(i, k)r = r * n-- / i;
    return r;
}

int main()
{
    ll n,ans = 0;
    string s;
    cin >> n >> s;
    rep0(i, n - 2){
        if(s[i] == 'A' && s[i + 1] == 'B' && s[i + 2] == 'C')++ans;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
typedef pair<int, int> P;
typedef long long ll;
int main(){
    int n;
    cin >> n;
    string s;
    cin >> s;
    for(auto i:s){
        cout << (char)((i-'A'+n)%26+'A');
    }
    cout << endl;
    return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <cassert>
#include <cmath>
#include <iostream>
#include <map>
#include <stack>
#include <queue>
#include <vector>

static const int IINF = 1 << 30;
static const long long LINF = 1LL << 60;
static const long long MOD = 1.0e+9 + 7;

template <typename T> std::vector<T> vectors(std::size_t n, T val) {
  return std::vector<T>(n, val);
}

template <typename T, typename... Args>
auto vectors(std::size_t n, Args... args) {
  return std::vector<decltype(vectors<T>(args...))>(n, vectors<T>(args...));
}

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

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

template <class T> inline void chadd(T &a, const T &b) {
  a += b, a %= MOD;
  // TODO minus case
}

template <class T>
std::ostream &operator<<(std::ostream &s, const std::vector<T> &v) {
  if (v.empty())
    return s;
  s << *v.begin();
  for (auto iter = v.begin() + 1; iter != v.end(); ++iter)
    if (std::is_fundamental<T>::value)
      s << " " << *iter;
    else
      s << std::endl << *iter;
  return s;
}

int main() {
  int n;
  std::cin >> n;
  std::string s;
  std::cin >> s;

  int res = 0;
  char pre_c;
  for (int i = 0; i < n; ++i) {
    if (i == 0) {
      pre_c = s[i];
      res += 1;
      continue;
    }

    if (s[i] == pre_c)
      continue;
    else {
      res += 1;
      pre_c = s[i];
    }
  }

  std::cout << res << std::endl;

  return 0;
}


Measured memory_bytes: 512
# 解説を参考にした（この問題はアイデア勝負だと思うが…）
sentence = input()
ans = 0
sentence = sentence.replace("eraser", "")
sentence = sentence.replace("erase", "")
sentence = sentence.replace("dreamer", "")
sentence = sentence.replace("dream", "")

if sentence == "":
    print("YES")
else:
    print("NO")


Measured memory_bytes: 3188
#include <bits/stdc++.h>
#include <stdio.h>
#include <algorithm>
#include <map>
#include <string>
using namespace std;
#define r(i,n) for(int i=0;i<n;i++)
#define ll long long
#define rn(i,n) for(int i=1;i<=n;i++)
#define INF 1000000010

int main() {
  ll N, T;
  cin >> N >> T;
  vector<ll> A(N);
  r(i,N){
    cin>>A[i];
  }
  ll mn=INF, ans=0, submx=0;
  r(i,N){
    mn = min(A[i], mn);
    if(A[i] - mn > submx){
      submx = A[i] - mn;
      ans=1;
    }else if(A[i] - mn == submx){
      ans++;
    }
  }
  cout<<ans<<endl;

return 0;
}


Measured memory_bytes: 1024
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<math.h>
#define MaxN 100000+100
int is_prime[MaxN]={0};
int sum[MaxN]={0};
void Init()
{
    for(int i=2;i<=MaxN;i++)
        if(is_prime[i]==0)
            for(int k=i*2;k<=MaxN;k+=i)
                is_prime[k]=1;
}
int main()
{
    Init();
    is_prime[1]=1;
    for(int i=2;i<=MaxN;i++)
    {
        sum[i]=sum[i-1];
        if(i%2==1)
            if(is_prime[i]==0 && is_prime[(i+1)/2]==0)
                sum[i]++;
    }
    int Q;
    scanf("%d",&Q);
    while(Q--)
    {
        int l,r;
        scanf("%d %d",&l,&r);
        int sumq=sum[r]-sum[l];//printf("%d\n",sumq);
        if(is_prime[l]==0 && is_prime[(l+1)/2]==0)
            sumq++;
        printf("%d\n",sumq);
    }
    return 0;
}


Measured memory_bytes: 1280
# coding:utf-8

from collections import defaultdict

N, M = map(int, input().split(' '))
H = list(map(int, input().split(' ')))
H_flag = [True for _ in range(N)]
dic = defaultdict(list)

for _ in range(M):
    A, B = map(int, input().split(' '))
    dic[A-1].append(B-1)
    dic[B-1].append(A-1)

ans = 0
for k, v in dic.items():
    H_flag[k] = False
    maximum = H[k]
    for el in list(set(v)):
        if maximum <= H[el]:
            break
    else:
        ans += 1

print(ans + H_flag.count(True))


Measured memory_bytes: 35128
//Nihal Mittal - nihal_47
//Strike First , Strike Hard , No Mercy !!

/**⠀⠀⠀⠀⠀⠀⣀⣤⣤⣄⣀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⣠⣾⣿⣿⣿⣿⣿⣿⣿⣿⣿⣦⣀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⣰⣿⣿⣿⣿⠿⠿⣿⣿⣿⣿⣿⣿⣿⣧⢀⠀⠀⠀⠀
⠀⠀⠀⣿⣿⣿⠋⠀⠀⠀⠀⠀⠙⠀⠙⣿⣿⣿⣷⢳⢀⠀⠀⠀
⠀⠀⣠⣿⣿⣿⢸⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣿⣿⣿⣿⣿⢀
⠀⠀⣸⣿⣿⣿⠸⠀⠀⠀⠒⠒⠒⠐⠀⠀⢿⣿⣿⣿⣿⣿⠀⠀
⠀⣴⣿⣿⣿⡿⠀⠒⣋⣙⡒⢰⠀⠤⣖⠒⢾⣿⣿⣿⣿⣧⠀⠀
⢺⣿⣿⣿⣿⢀⠀⠀⠉⠉⠉⠸⠀⡇⠉⠉⠀⢿⣿⣿⣿⣄⠀⠀
⠀⠙⣿⣿⣧⢻⠀⠀⠀⠀⠀⠠⠀⠰⠀⠀⠀⣸⠸⣿⣿⠿⠰⠀
⠀⠀⠀⠹⣿⣿⣿⣷⠀⡠⠙⣲⣔⣅⢡⣰⣷⣿⣿⣿⣧⠀⠀⠀
⠀⠀⠀⣼⣿⣿⣿⣿⠀⡿⠭⠭⠭⠭⢿⠀⣿⢻⣿⣿⠃⠀⠀⠀
⠀⠀⠀⠙⠛⣿⢻⠹⣿⠐⠙⠛⠟⠉⢀⣴⡟⢿⣿⡏⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⡟⠀⠀⠻⣦⣤⣶⠾⠋⠀⠀⠁⡦⢄⢀⠀⠀⠀
⠀⠀⠀⠀⡠⠁⡇⠑⢄⠀⠀⠀⠀⠀⠀⠔⠀⠀⠁⠀⠀⠀⠉⠁
⠀⠔⠊⠁⠀⠀⣇⠀⠀⠀⠑⡤⠤⢎⠁⠀⠀⡘⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⢢⠠⠀⡠⢆⠀⠀⡠⠙⢄⠀⡸⠀
**/
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define ll long long
#define ld long double
#define mk make_pair
#define pb push_back
#define in insert
#define se second
#define fi first
#define mod 1000000007
#define watch(x) cout << (#x) << " is " << (x) << "\n"
#define all(v) (v).begin(),(v).end()
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(0);
#define pii pair<ll,ll>
#define vi(x) vector<x>
#define maxn 100005
#define ordered_set tree<ll, null_type,less<ll>, rb_tree_tag,tree_order_statistics_node_update> 
using namespace std;
using namespace __gnu_pbds;

signed main()
{
    fast;
   
    ll x,i,ba=100,ans=0;
    cin>>x;
    while(ba < x)
    {
    	ba += ba/100;
    	ans++;
    }
    cout<<ans;

}

Measured memory_bytes: 3652
#include <bits/stdc++.h>
using namespace std;
int n,k;
 
int main() {
	// your code goes here
    cin>>n;
    int arr[n+1][3];
    for(int i=1; i<=n;++i)
        cin>>arr[i][0]>>arr[i][1]>>arr[i][2];
    int a,b,c,A,B,C;
    A=a=arr[1][0],B=b=arr[1][1],C=c=arr[1][2];
        
    for(int i=2;i<=n;++i)
        {       
           A=max(arr[i][0]+b,arr[i][0]+c);
           B=max(arr[i][1]+c,arr[i][1]+a);
           C=max(arr[i][2]+a,arr[i][2]+b);
           a=A;
           b=B;
           c=C;
           
        }
    int ans=max(A,B);
    ans=max(ans,C);
    cout<<ans;
	return 0;
}

Measured memory_bytes: 1408
#include<bits/stdc++.h>
using namespace std;
#define int long long int
const int N = 100;
bool vis[N];
set<int> g[N];
int cc;
void dfs(int node){
    vis[node] = 1;
    for(auto x:g[node])
        if(!vis[x])
            dfs(x);
}
signed main(){
    int t = 1; //cin >> t;
    while(t--){
        int n,m; cin >> n >> m;
        vector<pair<int,int>> edges;
        for (int i = 0; i < m; ++i)
        {
            int x,y; cin >> x >> y;
            edges.push_back({x,y});
            g[x].insert(y);
            g[y].insert(x);
        }
        int ans = 0;
        for(auto x:edges)
        {
            g[x.first].erase(x.second);
            g[x.second].erase(x.first);
            cc = 0;
            memset(vis,0,sizeof(vis));
            for(int i = 1; i <= n; i++)
                if(!vis[i])
                {
                    cc++;
                    dfs(i);
                }
            if(cc > 1)
                ans++;
            g[x.first].insert(x.second);
            g[x.second].insert(x.first);
        }
        cout << ans;
    }    
}

Measured memory_bytes: 3664
#include <bits/stdc++.h>
#define endl "\n"
#define rep(i,n) for(int i=0;i<int(n);i++)
#define SZ(x) ((int)(x).size())
#define all(x) (x).begin(),(x).end()
using namespace std;
typedef long long ll;
template <class T>ostream &operator<<(ostream &o,const vector<T>&v)
{o<<"{";for(int i=0;i<(int)v.size();i++)o<<(i>0?", ":"")<<v[i];o<<"}";return o;}
 // 3の倍数か3が含まれるか
bool c(int i){
    if(i%3==0)return true;
    while(i){
        if(i%10==3)return true;
        i/=10;
    }
    return false;
}

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

    int n;
    cin>>n;
    for(int i=1;i<=n;i++){
        if(c(i))cout<<" "<<i;
    }
    cout<<endl;   
    return 0;
}


Measured memory_bytes: 3112
#include<cstdio>
#include<algorithm>
#include<cstring>
using namespace std;

#define rep(i,n) for(int i=0; i<n; i++)
const int MAX_TEAMS = 50;
const int MAX_PROBLEMS = 10;

struct Team {
	int num;
	int solved;
	int missed[MAX_PROBLEMS];
	int penalty;
	int lastTime;
	Team() : num(-1), solved(0), penalty(0), lastTime(0) {
		memset( missed, 0, sizeof(missed) );
	}
};

bool comp( const Team& l, const Team& r ) {
	if( l.solved != r.solved )  return ( l.solved > r.solved );
	else if( l.lastTime+l.penalty!=r.lastTime+r.penalty )  return ( l.lastTime+l.penalty < r.lastTime+r.penalty );
	else  return ( l.num > r.num );
}

bool compScore( const Team& l, const Team& r ) {
	if( l.solved != r.solved )  return true;
	else if( l.lastTime+l.penalty!=r.lastTime+r.penalty )  return true;
	else  return false;
}

int main() {
	int M, T, P, R;
	while( scanf("%d %d %d %d", &M, &T, &P, &R), M||T||P||R ) {
		Team teams[MAX_TEAMS];
		rep(i,T) {  teams[i].num = i+1;  }
		rep(i,R) {
			int m, t, p, j;
			scanf("%d %d %d %d", &m, &t, &p, &j);
			if(j==0) {
				teams[t-1].lastTime += m;
				teams[t-1].penalty += teams[t-1].missed[p-1] * 20;
				teams[t-1].solved++;
			}
			else{
				teams[t-1].missed[p-1]++;
			}
		}
		sort( teams, teams+T, comp );

		printf("%d", teams[0].num);
		rep(i,T-1) {
			if( compScore( teams[i], teams[i+1] ) ) {
				printf(",");
			} else {
				printf("=");
			}
			printf("%d", teams[i+1].num);
		}
		printf("\n");
	}
	return 0;
}

Measured memory_bytes: 1036
#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>;

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


int main(){
    int n, k;
    cin >> n >> k;
    vector<vector<int>> g(n);
    rep(i,n-1){
        int a, b;
        cin >> a >> b;
        a--, b--;
        g[a].push_back(b);
        g[b].push_back(a);
    }
    
    vector<bool> seen(n, false);
    queue<int> que;

    seen[0] = true;

    mint ans = k;
    for(auto p : g[0]){
        que.push(p);
        seen[p] = true;
    }
    rep(i,(int)g[0].size()) ans *= k-1-i;

    while(!que.empty()){
        int pos = que.front();
        que.pop();

        for(int p : g[pos]){
            if(seen[p]) continue;
            seen[p] = true;
            que.push(p);
        }
        rep(i,(int)g[pos].size()-1) ans *= k-2-i;
    }

    cout << ans << endl;
}

Measured memory_bytes: 9500
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int a,b,c,m=0,n=0;
	cin>>a>>b>>c;
	if(a==5)
		m++;
	if(a==7)
		n++;
	if(b==5)
		m++;
	if(b==7)
		n++;
	if(c==5)
		m++;
	if(c==7)
		n++;
	if(m==2 && n==1)
		cout<<"YES"<<endl;
	else
		cout<<"NO"<<endl;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;	
long long moder = 1000000007;
long long total_zero[61];
long long total_one[61];
long long unit = 1;
long long counter[61];

int main(){
	int n;
	cin>>n;
	vector<long long>arr(n);
	for(int i=0; i<n; i++) cin>>arr[i];
	
	for(int i=0; i<n; i++){
		for(long long j=0; j<=60; j++){
			if((unit<<j)&arr[i]) total_one[j]++;
			else total_zero[j]++;
		}
	}
	for(int j=0; j<=60; j++){
		counter[j] = total_zero[j]*total_one[j];
	}
	long long ret = 0;
	for(int i=0; i<=60; i++){
		long long curr = (unit<<i);
		curr%=moder;
		curr*=counter[i]%moder;
		ret+=curr%moder;
		ret%=moder;
	}
	cout<<ret;

}

Measured memory_bytes: 5596
#include <stdio.h>

int main() {
  int a[10];
  int i, j, index, max;
  int cnt = 0;

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

  max = a[0];
  
  while(cnt < 3) {
	for (i = 0; i < 10; i++) {
	  for (j = i + 1; j< 10; j++) {
		if(max < a[j]) {
		  max = a[j];
		  index = j;
		  break;
		}
	  }
	}
	printf("%d\n", max);
	a[index] = 0;
	max = 0;
	cnt++;
  }

  return 0;
}

Measured memory_bytes: 600
using System;



class Program
{
    static void Main(string[] args)
    {
        Input CInput = new Input();
        double input = 0;
        //int[] input = new int[(int)Input.Define.MAX_ArraySize];
        //int[,] input = new int[(int) Input.Define.MAX_ArraySize, (int) Input.Define.ArraySize2d];
        //int num = 0;
        input = CInput.Line1_double();
        //input = CInput.Multiline_int(' ' ,2, ref num);

        Console.WriteLine((Math.PI * Math.Pow(input, 2)).ToString("f5") + " " + (2.0 * Math.PI * input).ToString("f5"));

    }








    class Input
    {
        public enum Define
        {
            MAX_ArraySize = 1000000,
            ArraySize2d = 2,                // 2?¬?????????????[][?] ???????
        }

        public string Line1_string()
        {
            return Console.ReadLine();
        }

        public int Line1_int()
        {
            var input = Console.ReadLine();
            return int.Parse(input);
        }

        public double Line1_double()
        {
            var input = Console.ReadLine();
            return double.Parse(input);
        }

        public int[] Line1_int(int chr, int num)
        {
            var input = Console.ReadLine();
            var split = input.Split(' ');
            int[] spliti = new int[100];
            for (int i = 0; i < num; i++)
            {
                spliti[i] = int.Parse(split[i]);
            }
            return spliti;
        }

        public int[] Multiline_int(ref int datanum)
        {
            int i = 0;
            int[] data = new int[(int)Input.Define.MAX_ArraySize];
            while (true)
            {
                var input = Console.ReadLine();
                var value = int.Parse(input);
                if (value == 0) break;
                data[i] = value;
                i++;
            }
            datanum = i;
            return data;
        }
        /// <summary>
        /// ?????°??????int??????????????????????????????
        /// </summary>
        /// <param name="chr">???????????????</param>
        /// <param name="num">?????????????????????????????°</param>
        /// <param name="datanum">??????????????????????????°</param>
        /// <returns></returns>
        public int[,] Multiline_int(int chr, int num, ref int datanum)
        {
            int i = 0;
            int[,] data = new int[(int)Input.Define.MAX_ArraySize, (int)Input.Define.ArraySize2d];
            while (true)
            {
                var input = Console.ReadLine();
                var split = input.Split(' ');
                int[] spliti = new int[100];
                for (int j = 0; j < num; j++)
                {
                    spliti[j] = int.Parse(split[j]);
                }
                if (spliti[0] == 0 && spliti[1] == 0) break;
                data[i, 0] = spliti[0];
                data[i, 1] = spliti[1];
                i++;
            }
            datanum = i;
            return data;
        }

    }
}

Measured memory_bytes: 9360
#include<bits/stdc++.h>
#define ll long long
#define testfor(T) ll T; cin>>T; while(T--)
using namespace std;
void quickstart()
{
	ios_base::sync_with_stdio(0);
	// freopen("input.txt", "r", stdin);
	// freopen("output.txt", "w", stdout);
}
int main()
{
	quickstart();
	ll a,b;
	cin>>a>>b;
	cout<<a*b;
	return 0;
}

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

int main(){

    int N,X;
    cin >> N >> X;
    int i = 0;
    int a[N];
    int sum = 0;
    int cnt = 0;
  
    for(i=0; i<N; i++){
      cin >> a[i];
      sum += a[i];
      cnt++;
    }
    sort(a, a+N);
  
    cout << cnt+(X-sum)/a[0] << endl;
}

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

#define ln '\n'
#define REP(i, n) for (int i = 0; i < (int)(n); ++i)
#define FOR(i, a, b) for (int i = (a); i <= (int)(b); ++i)
#define FORR(i, a, b) for (int i = (a); i >= (int)(b); --i)
#define ALL(c) (c).begin(), (c).end()

typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<VI> VVI;
typedef vector<VL> VVL;
typedef pair<int, int> P;
typedef pair<ll, ll> PL;
typedef vector<P> VP;
typedef vector<PL> VPL;
typedef vector<string> VS;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int a, b;
    cin >> a >> b;
    cout << max({a + b, a - b, a * b}) << ln;
    return 0;
}


Measured memory_bytes: 3536
#include<stdio.h>
int main ()
{

    char a,b;
    scanf("%c %c",&a,&b);
    if(a=='H')
    {
        if(b=='H')
            printf("H");
        if(b=='D')
            printf("D");
    }
    if(a=='D')
    {
        if(b=='H')
            printf("D");
        if(b=='D')
            printf("H");
    }
    return 0;
}


Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
#define ll long long
int main()
{
    ll t,i,j,n,m,k,ans,cnt=0,sum=0,c=0;
    //string s,s1,s2,tmp;
    cin>>n;
    if(n==5||n==7||n==3){
        cout<<"YES"<<endl;
    }
    else{
        cout<<"NO"<<endl;
    }
    return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
#pragma GCC optimize("unroll-loops,no-stack-protector")
#pragma GCC target("sse,sse2,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#define watch(x) cout << (#x) << " is " << (x) << endl
#define debug cout << "hi" << endl

using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;

ll gcd(ll a, ll b) {return (!b ? a : gcd(b, a % b));}
bool cmp(int a,int b){return a>b;}

const ll mod = 1e9 + 7;
const int INF32 = 1<<30;
const ll INF64 = 1LL<<60;
const ld pi = 3.141592653589793;


void solve(){
     int n;cin >> n;
     ld d;cin >> d;
     int cnt = 0;
     for(int i = 0;i<n;i++){
        ld x,y;cin >> x >> y;
        if(sqrt(x*x+y*y)<=d) cnt++;
     }
     cout <<cnt;
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);cout.tie(NULL);
    solve();
    return 0;
}

Measured memory_bytes: 3864
#include <iostream>
using namespace std;
int C[26] = {0};
string S;
int main(){
  cin >> S;
  for(int i=0;i<S.size();i++){
    C[S[i]-'a']++;
  }
  char c = 'a';
  for(int i=0;i<26;i++){
    if(C[i]==0){
      cout << c << endl;
      return 0;
    }
    c++;
  }
  cout << "None" << endl;
}

Measured memory_bytes: 512
N = int(input())

t = [0]
x = [0]
y = [0]

for i in range(N):
    tt, xx, yy = map(int, input().split())
    t.append(tt)
    x.append(xx)
    y.append(yy)

suc = True

for i in range(N):
    dt = t[i+1] - t[i]
    dxy = abs(x[i+1] - x[i]) + abs(y[i+1] - y[i])
    if dt < dxy:
        suc = False
    if dxy % 2 != dt % 2:
        suc = False

if suc:
    print('Yes')
else:
    print('No')

Measured memory_bytes: 11816
#include<bits/stdc++.h>
using namespace std;
int32_t main()
{map<long long,long long>f;
  long long n;cin>>n;
 vector<long long>a(n);
 for(long long i=0;i<n-1;i++)cin>>a[i],f[a[i]]++;
 for(long long i=1;i<=n;i++)cout<<f[i]<<"\n";
  //cout<<(n*p);
  return 0;
}

Measured memory_bytes: 17204
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        List<Integer> list = new ArrayList<>();
        for (int i=0; i<3; i++)
            list.add(sc.nextInt());
        Collections.sort(list);
        System.out.println(list.get(2) - list.get(0));
    }
}


Measured memory_bytes: 20688
#include <stdio.h>
#define MAX_N (100010)
typedef struct{
    char name[12];
    int time;
} Process;



Process queue[MAX_N];
int head;
int tail;

static
void 
initialize();


static
void
enqueue( Process x );


static
Process
dequeue();


static
bool
isEmpty();


int n, q;

int main()
{
    int i;
    int time = 0;
    scanf("%d", &n);
    scanf("%d", &q);

    for ( i = 0; i < n; i++ ) {
	Process p;
	scanf("%s", p.name );
	scanf("%d", &p.time );
	enqueue( p );
    }

    while( !isEmpty() ) {
	Process p = dequeue();
	if ( p.time > q ) {
	    p.time -= q;
	    time += q;
	    enqueue( p );
	}
	else {
	    time += p.time;
	    printf("%s %d\n", p.name, time);
	}
    }
    
    return 0;
}




static
void 
initialize()
{
    head = 0;
    tail = 0;
}


static
void
enqueue( Process x )
{
    queue[tail] = x;
    tail = ( tail + 1 ) % MAX_N;
}


static
Process
dequeue()
{
    Process ret = queue[head];
    head = ( head + 1 ) % MAX_N;

    return ret;
}


static
bool
isEmpty()
{
    return ( head == tail);
}

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

static const int INF=1e9;
static const int MOD=1000000007;
typedef long long ll;
typedef pair<int,int> P;

int main(){
    int N; cin >> N;
    for(int i=1;i<=9;i++){
        for(int j=1;j<=9;j++){
            if(i*j==N){
                cout << "Yes" << endl;
                return 0;
            }
        }
    }
    cout << "No" << endl;
}


Measured memory_bytes: 256
import java.util.Scanner;
public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        String c1 = sc.next();
        String c2 = sc.next();
        boolean ok = true;
        for(int i = 0;i < 3;i++){
            if(c1.charAt(i) != c2.charAt(2-i)){
                ok = false;
            }
        }
        if(ok){
            System.out.println("YES");
        }
        else{
            System.out.println("NO");
        }
    }
}


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

const int coin[6] = {500, 100, 50, 10, 5, 1};

int solve(int v) {
  int val = 0;
  for (int kind = 0; (kind < 6) or (v > 0); kind++) {
    int n = v / coin[kind];
    v -= coin[kind] * n;
    val += n;
  }
  return val;
}

int main() {
  int v;
  while (cin >> v and v != 0) {
    cout << solve(1000 - v) << endl;
  }
}

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

#define INF INT_MAX
#define UINF UINT_MAX
#define MOD 1000000007
#define REP(i,n) for(int i=0;i<n;i++)
#define all(x) (x).begin(),(x).end()

typedef long long ll;
typedef std::pair<int,int> pii;

using namespace std;

int main() {
    
    int n;
    cin >> n;
    vector<string> s(n);
    vector<int> t(n);
    REP(i,n){
        cin >> s[i] >> t[i]; 
    }
    string X;
    cin >> X;

    int ans = 0;
    bool flag = false;
    REP(i,n){
        if(flag){
            ans += t[i];
        }

        if(s[i] == X)flag = true;
    }

    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
/*
LANG:C++
PROB:

*/
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <functional>
#include <iostream>
#define mp make_pair
#define mt make_tuple
#define fi first
#define se second
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define forn(i, n) for (int i = 0; i < (int)(n); ++i)
#define for1(i, n) for (int i = 1; i <= (int)(n); ++i)
#define ford(i, n) for (int i = (int)(n) - 1; i >= 0; --i)
#define fore(i, a, b) for (int i = (int)(a); i <= (int)(b); ++i)


using namespace __gnu_pbds;
using namespace std;


typedef tree<int, null_type, less<int>, rb_tree_tag,
            tree_order_statistics_node_update>
    ordered_set;

typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<pii> vpi;
typedef vector<vi> vvi;
typedef long long i64;
typedef vector<i64> vi64;
typedef vector<vi64> vvi64;
typedef pair<i64, i64> pi64;
typedef double ld;
typedef unsigned long long ui64;

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


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

    // ifstream fin(".in");
    // ofstream fout(".in");

i64 k,a,b,ans;
cin>>k>>a>>b;
if(b<a+2)
{
  cout<<k+1;
}
else
{

  k=max(0LL,k-a+1LL);
  if(k==0)
{
  cout<<1+k;

}
else
{ans=a;
  // cout<<k;
  i64 times=k/2;
  i64 rem=k%2;
  ans+=times*(b-a);
  ans+=rem;
}

cout<<ans;

}


    return 0;
  }


Measured memory_bytes: 256
import * as fs from "fs"

const judge = (data :number[]) => {
    let ans:number = 0
    for (let i:number = 0; i < data.length; i++){
        if ((i+1) % 2 !== 0){
            if (data[i] % 2 !== 0){
                ans ++
            }
        }
    }
    return ans
}

export const main = () => {
    const inp:string[] = fs.readFileSync('/dev/stdin', 'utf8').trim().split('\n')
    const data:number[] = inp[1].split(' ').map((val:string) => Number(val))

    return  judge(data)
}

console.log(main())


Measured memory_bytes: 29700
#include <bits/stdc++.h>
using  namespace std;
typedef long long ll;
#define RAP(i, n) for(ll i=0;i<(n);i++)
#define FOR(i, a, b) for(ll i=(a);i<(b);i++)
int main(){
    ll n,h,ans=0,a, b;
    cin >> n >> h;
    vector<ll> A(n), B(n);

    RAP(i,n){
        cin >> A[i] >> B[i];
    }
    sort(A.begin(), A.end());
    sort(B.begin(), B.end());

    auto itr = upper_bound(B.begin(),B.end(),A[n-1]);
    for(ll i = 0;i<distance(itr, B.end());i++){
        if(h<=0){
            break;
        }
        h -= B[n-1-i];
        ans++;
    }
    if(h>0){
        ans += (h+A[n-1]-1)/A[n-1];
    }
    
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 1792
#include <cstdio>
#include <iostream>
#include <cstring>
using namespace std;
int main()
{
    char s[1000];
    int i;
    cin>>s;
    int l=strlen(s);
    for( i=0;i<l/2;i++)
    {
        if(s[i]!=s[l-i-1])
        {
            printf("No\n");
            break;
        }
    }
    if(i==l/2)
        printf("Yes");
}


Measured memory_bytes: 256
// atcoder/cf17-final/B/main.cpp
// author: @___Johniel
// github: https://github.com/johniel/

#include <bits/stdc++.h>

#define each(i, c) for (auto& i : c)
#define unless(cond) if (!(cond))

using namespace std;

template<typename P, typename Q> ostream& operator << (ostream& os, pair<P, Q> p) { os << "(" << p.first << "," << p.second << ")"; return os; }
template<typename P, typename Q> istream& operator >> (istream& is, pair<P, Q>& p) { is >> p.first >> p.second; return is; }
template<typename T> ostream& operator << (ostream& os, vector<T> v) { os << "("; for (auto& i: v) os << i << ","; os << ")"; return os; }
template<typename T> istream& operator >> (istream& is, vector<T>& v) { for (auto& i: v) is >> i; return is; }
template<typename T> ostream& operator << (ostream& os, set<T> s) { os << "#{"; for (auto& i: s) os << i << ","; os << "}"; return os; }
template<typename K, typename V> ostream& operator << (ostream& os, map<K, V> m) { os << "{"; for (auto& i: m) os << i << ","; os << "}"; return os; }

template<typename T> inline T setmax(T& a, T b) { return a = std::max(a, b); }
template<typename T> inline T setmin(T& a, T b) { return a = std::min(a, b); }

using lli = long long int;
using ull = unsigned long long;
using point = complex<double>;
using str = string;
template<typename T> using vec = vector<T>;

constexpr array<int, 8> di({0, 1, -1, 0, 1, -1, 1, -1});
constexpr array<int, 8> dj({1, 0, 0, -1, 1, -1, -1, 1});
constexpr lli mod = 1e9 + 7;

int main(int argc, char *argv[])
{
  std::ios_base::sync_with_stdio(0);
  std::cin.tie(0);
  std::cout.setf(std::ios_base::fixed);
  std::cout.precision(15);

  str s;
  while (cin >> s) {
    int a = count(s.begin(), s.end(), 'a');
    int b = count(s.begin(), s.end(), 'b');
    int c = count(s.begin(), s.end(), 'c');

    vec<int> v({a, b, c});
    sort(v.begin(), v.end());

    bool f = false;
    f = f || (v.front() == v.back());
    f = f ||(v.front() + 1 == v.back());
    cout << (f ? "YES" : "NO") << endl;
  }

  return 0;
}


Measured memory_bytes: 512
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int a1 = Integer.parseInt(sc.next());
        int a2 = Integer.parseInt(sc.next());
        int a3 = Integer.parseInt(sc.next());
        System.out.println(a1 + a2 + a3 >= 22 ? "bust" : "win");
    }
}

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

int main(void) {
	int A, B, C;
	int d = 0;
	int i = 0;
	cin >> A >> B >> C;

	while (i == 0) {
		if (C > 0) {
			C -= 1;
			d += 1;
			if (B > 0) {
				B -= 1;
				d += 1;
			}
			else if (A > 0) {
				A -= 1;
			}
			else {
				break;
			}
		}
		else {
			d += B;
			i = 1;
		}
	}
	cout << d;

	return 0;
}


Measured memory_bytes: 256
//#include"pch.h"
//#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
#include<stdlib.h>
#include<cmath>
#include<math.h>
#include<string>
#include<string.h>
#include<algorithm>
#include<iostream>
using namespace std;

int main() {
	int N, K;
	cin >> N >> K;
	if (N % K == 0)cout << "0" << endl;
	else cout << "1" << endl;

	return(0);
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define pb push_back
#define ers erase
#define ins insert
#define F first
#define S second
#define all(x) x.begin(), x.end()
#define debug(x)  cerr << #x << " = " << x << endl
#define kill(x) return cout << x, 0;
#define IOS ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)

using namespace std;

typedef long long ll;
typedef long double ld;
typedef string str;
typedef pair<ll, ll> pll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<ll> vl;


const ld Pi = 3.14159265359;
const ll MOD = 1000 * 1000 * 1000 + 7;
const ll MAXN = 1e3 + 10;
const ll INF = 1e18;
ll dp[MAXN][MAXN];
ll H, W;
char a[MAXN][MAXN];
int main(){
	IOS;
	cin >> H >> W;
	for (int i = 1; i <= H; i++){
		for (int j = 1; j <= W; j++){
			cin >> a[i][j];
		}
	}
	if (a[1][1] == '#') kill(0);
	dp[1][1] = 1;
	for (int i = 1; i <= H; i++){
		for (int j = 1; j <= W; j++){
			if (i == 1 && j == 1) continue;
			if (a[i][j] != '#')dp[i][j] = (dp[i - 1][j] + dp[i][j - 1]) % MOD;
		}
	}
	cout << dp[H][W];
	
	
	
	
	return 0;
}






/*
     ,---,           ___                 ,--,
    '  .' \        ,--.'|_             ,--.'|                             ,--,
   /  ;    '.      |  | :,'            |  | :                           ,--.'|    ,---.        ,---,
  :  :       \     :  : ' :            :  : '                 .--.--.   |  |,    '   ,'\   ,-+-. /  |
  :  |   /\   \  .;__,'  /    ,--.--.  |  ' |     ,--.--.    /  /    '  `--'_   /   /   | ,--.'|'   |
  |  :  ' ;.   : |  |   |    /       \ '  | |    /       \  |  :  /`./  ,' ,'| .   ; ,. :|   |  ,"' |
  |  |  ;/  \   \:__,'| :   .--.  .-. ||  | :   .--.  .-. | |  :  ;_    '  | | '   | |: :|   | /  | |
  '  :  | \  \ ,'  '  : |__  \__\/: . .'  : |__  \__\/: . .  \  \    `. |  | : '   | .; :|   | |  | |
  |  |  '  '--'    |  | '.'| ," .--.; ||  | '.'| ," .--.; |   `----.   \'  : |_|   :    ||   | |  |/
  |  :  :          ;  :    ;/  /  ,.  |;  :    ;/  /  ,.  |  /  /`--'  /|  | '.'\   \  / |   | |--'
  |  | ,'          |  ,   /;  :   .'   \  ,   /;  :   .'   \'--'.     / ;  :    ;`----'  |   |/
  `--''             ---`-' |  ,     .-./---`-' |  ,     .-./  `--'---'  |  ,   /         '---'
                            `--`---'            `--`---'                 ---`-'
*/




Measured memory_bytes: 9088