akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <numeric>
//#include <stdio.h>
//#include <stack>
//#include <queue>
#include <cstdio>
#include <cmath>
#include <iterator>
#include <map>
//#include <fstream>
//#include <list>
//#include <iomanip>
#include <stdlib.h>
#include <cctype>

using namespace std;

#define MOD 1000000007
#define Int int64_t
#define PI 3.14159265358979
#define ssort(z) sort(z.begin(),z.end())
#define rsort(z) sort(z.rbegin(),z.rend())
#define eerase(z) z.erase(unique(z.begin(),z.end()),z.end())
#define ccnt(z,w) count(z.begin(),z.end(),w)


void printVec(std::vector<int> & vec) {
	std::cout << "";
	for (auto it = vec.begin(); it != vec.end(); ++it) {
		std::cout << *it << " ";
	}
	std::cout << std::endl;
}
void printVec1(std::vector<string>& vec) {
	std::cout << "";
	for (auto it = vec.begin(); it != vec.end(); ++it) {
		std::cout << *it << " ";
	}
	std::cout << std::endl;
}
void printVec2(std::vector<Int>& vec) {
	std::cout << "";
	for (auto it = vec.begin(); it != vec.end(); ++it) {
		std::cout << *it << " ";
	}
	std::cout << std::endl;
}

Int gcd(Int a, Int b) {
	return b != 0 ? gcd(b, a % b) : a;
}
Int lcm(Int a, Int b) {
	return a / gcd(a, b) *b;
	//a*bは64bit integer overflow
}

bool comp(const string a, const string b) {
	return a.length() < b.length();
}

bool integer(double num) {
	return floor(num) == num;
}

string gen(int num) {
	string str = "";
	for (int i = 0; i < num; i++) str += ".";
	return str;
}
Int fact(int num) {
	if (num == 0) return 1;
	else return num * fact(num - 1);
}


int main() {
	int a, b, c; cin >> a >> b;
	//string s; cin >> s;
	if (a + b >= 24) cout << abs(24 - a - b);
	else cout << a + b;

	cout << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
int n,m;
int a[200005],b[200005];
bool V[200005];
int ans[200005];
int main(void){
    cin>>n>>m;
    vector<int> v[200005];
    for(int i=0;i<m;i++){
        cin>>a[i]>>b[i];
        v[a[i]].push_back(b[i]);
        v[b[i]].push_back(a[i]);
    }
    queue<int> q;
    q.push(1);
    V[1]=true;
    while(!q.empty()){
        int p=q.front();
        q.pop();
        for(int i=0;i<v[p].size();i++){
            int P=v[p][i];
            if(V[P]==false){
                ans[v[p][i]]=p;
                q.push(v[p][i]);
                V[P]=true;
            }
        }
    }
    cout<<"Yes"<<endl;
    for(int i=2;i<=n;i++){
        cout<<ans[i]<<endl;
    }
    
    
}


Measured memory_bytes: 14448
N = int(input())
memo = []
for i in range(N):
    if i == 0:
        memo.append(2)
    elif i == 1:
        memo.append(1)
    else:
        memo.append(memo[i-1] + memo[i-2])
if N == 1:
    print(1)
else:
    print(memo[N - 1] + memo[N - 2])


Measured memory_bytes: 3060
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <cmath>
#include <set>
#include <sstream>
#include <bitset>
#include <stack>
#include <cstdlib>

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

typedef long long ll;

using namespace std;

int main() {
    
    int n;
    cin >> n;
    
    vector<int> x(n);
    vector<int> y(n);
    FOR(i, 0, n){
        cin >> x[i];
        y[i] = x[i];
     }
    
    sort(y.begin(),y.end());
    int l,r;
    
    l = y[n/2 -1];
    r = y[n/2];
    
    FOR(i, 0, n){
        if(x[i]<=l){
            cout <<  r << endl;
        }else{
            cout << l << endl;
        }
    }
    
    return 0;
}


Measured memory_bytes: 3712
#include <stdio.h>
#include <algorithm>

using namespace std;

int partition(int A[],int p,int r){
	int x = A[r];
	int i = p-1;
	for(int j = p; j < r; j++){
		if(A[j] <= x){
			i++;
			swap(A[i],A[j]);
		}
	}
	swap(A[i+1],A[r]);
	return i+1;
}

int main(){
	int n,partition_point;
	scanf("%d",&n);
	int A[n];
	for(int i = 0; i < n; i++) scanf("%d",&A[i]);

	partition_point = partition(A,0,n-1);

	for(int i = 0; i < n-1; i++){
		if(i == partition_point){
			printf("[%d] ",A[i]);
		}else{
			printf("%d ",A[i]);
		}
	}
	if(partition_point == n-1){
		printf("[%d]\n",A[n-1]);
	}else{
		printf("%d\n",A[n-1]);
	}
}




  

 



Measured memory_bytes: 2984
#include<bits/stdc++.h>
const int N = 105;
const int mod = 1e9 + 7;
using namespace std;

int n, k, f[N][N*N], ans;

void add(int&a, int b){
    a += b; if (a >= mod) a -= mod; if (a < 0) a += mod;
}

int main(){
    ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
    cin >> n >> k;
    f[n+1][0] = 1;
    int cnt = 0;
    ans = 1LL * k * (k+1) / 2 % mod;
    for (int i = 2; i <= n; i++) ans = 1LL * ans * (k+1) % mod;
    ans = 1LL * ans * n % mod;
    for (int i = n; i >= 1; i--) {
        int cur = cnt;
        cnt += (cnt + min(i, k)) / i;
        for (int j = 0; j <= cnt; j++){
            for (int l = min(cur, j); l >= 0; l--){
                int Min = max((j - l) * i - l, 0), Max = min(min(k, i), (j-l+1)*i-1-l);
                if (l == j){
                    if (k > i) add(f[i][j], 1LL * f[i+1][j] * (k-i) % mod);
                }
                if (Max < Min) continue;
                add(f[i][j], 1LL * f[i+1][l] * (Max - Min + 1) % mod);
            }
        }
    }
    for (int i = 0; i <= cnt; i++){
        add(ans, -1LL * f[1][i] * i % mod);
    }
    cout << ans << endl;
}


Measured memory_bytes: 2560
#include <limits.h>
#include <algorithm>
#include <bitset>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>

#define int long long
#define REP(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i)
#define REPS(i, n) for (int i = 1, i##_len = (n); i <= i##_len; ++i)
#define FOR(i, a, b) for (int i = (a), i##_len = (b); i <= i##_len; ++i)
#define REV(i, a, b) for (int i = (a); i >= (b); --i)
#define CLR(a, b) memset((a), (b), sizeof(a))
#define DUMP(x) cout << #x << " = " << (x) << endl;
#define INF 1001001001001001001ll
#define fcout cout << fixed << setprecision(10)

using namespace std;

signed main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    int N;
    cin >> N;
    if (N < 10) {
        cout << N << endl;
        return 0;
    }

    int num = 0;
    int dnum = 0;
    int last = 0;
    while (N > 0) {
        num += N % 10;
        last = N % 10;
        N /= 10;
        dnum++;
    }
    cout << max(num, 9 * (dnum - 1) + last - 1) << endl;

    return 0;
}


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

using namespace std;
int dx[]={0,1,0,-1};
int dy[]={1,0,-1,0};
int vis[68][68];
string str;
string solve="";
vector<char>ak47;
int main()
{
	int a,b,c,d,e,f,g,h,i,j,k,l=0,p,q,r,s,t;
	cin>>a>>b;
	if(a>=13)
	{
	  cout<<b<<'\n';	
	}
	else if(a>=6&&a<=12)
	{
		cout<<b/2;
	}
	else if(a<=5)
    cout<<"0"<<'\n';
	
}

Measured memory_bytes: 256
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <string>
#include <cmath>
#include <bitset>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <algorithm>
#include <complex>
#include <unordered_map>
#include <unordered_set>
#include <random>
#include <cassert>
#include <fstream>
#include <utility>
#include <functional>
#include <time.h>
#include <stack>
#include <array>
#include <list>

using namespace std;

typedef long long ll;
typedef long double ld;

#define vi vector<int>
#define vl vector<ll>
#define vii vector< vector<int> >
#define vll vector< vector<ll> >
#define vs vector<string>
#define pii pair<int,int>
#define pis pair<int,string>
#define psi pair<string,int>
#define pll pair<ll,ll>
#define mii map<int,int>
#define mis map<int,string>
#define msi map<string,int>
#define mll map<ll,ll>
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define rep1(i,n) for(int i=1; i<=(int)(n); i++)
#define all(c) c.begin(),c.end()
#define srta(a) sort(all(a))
#define srtd(a) sort(all(a),greater<型>())
#define rvs(s) reverse(all(s))
#define psb push_back
#define ppb pop_back
#define isu isupper
#define isl islower
#define lb(a,k) lower_bound(all(a),k)
#define ub(a,k) upper_bound(all(a),k)
#define bs(a,k) binary_search(all(a),k)

const int I_INF = 1001001001;
const ll LL_INF = 1001001001001001001;
const ld EPS = 0.001;



int main() {
    int H, W, K;
    cin >> H >> W >> K;

    vii c(H, vi(W));
    rep (i, H) {
        rep (j, W) {
            char s;
            cin >> s;
            c[i][j] = s == '.' ? 0 : 1;
        }
    }

    int cnt = 0;
    rep (i, 1 << (H+W)) {
        vii c2 = c;
        rep (j, H) {
            if ((i >> j) & 1) {
                rep (k, W) c2[j][k] = 2;
            }
        }
        rep (j, W) {
            if ((i >> (j+H)) & 1) {
                rep (k, H) c2[k][j] = 2;
            }
        }
        int tmp_cnt = 0;
        rep (j, H) {
            rep (k, W) {
                if (c2[j][k] == 1) tmp_cnt++;
            }
        }
        if (tmp_cnt == K) cnt++;
    }

    cout << cnt << endl;
}


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

signed main(void)
{
	int n;
	cin >> n;
	bool ok= false;
	while(n)
	{
		if (n % 10 == 7)
			ok = true;
		n /= 10;
	}
	if(ok)
		cout << "Yes" << endl;
	else
		cout << "No" << endl;
	return 0;
}


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

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

    if(a % 2 == 0 || b % 2 == 0 || c % 2 == 0){
        cout << 0 << endl;
    }
    if(a % 2 != 0 && b % 2 != 0 && c % 2 != 0){
        cout << min(min(a * b, b * c), c * a) << endl;
    }
}

Measured memory_bytes: 256
package main

import (
	"fmt"
	"math"
)

func abs(x float64) float64 {
	if x < 0 {
		return -x
	}
	return x
}

func min(x, y float64) float64 {
	if x < y {
		return x
	}
	return y
}

func main() {
	var a, b, h, m float64
	fmt.Scan(&a, &b, &h, &m)

	hang := 30*h + 30*(m/60)
	mang := 360 * (m / 60)
	ang := abs(hang - mang)
	ang = min(ang, 360-ang)
	fmt.Println(math.Sqrt(a*a + b*b - 2*a*b*math.Cos(math.Pi*ang/180)))
}


Measured memory_bytes: 1824
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
#define rep(i,m,n) for(int i=m;i<n;i++)
const ll mod=1e9+7;

int main(){
  ll x,k,d;
  cin>>x>>k>>d;
  if(x<0) x=-x;
  if(x%d==0){
    if(x/d>k) cout<<x-k*d<<endl;
    else if((x/d)%2==k%2) cout<<0<<endl;
    else cout<<d<<endl;
  }
  else{
    if(x/d>k) cout<<x-k*d<<endl;
    else if((x/d)%2==k%2) cout<<x%d<<endl;
    else cout<<d-x%d<<endl;
  }
}

Measured memory_bytes: 3588
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
// Welcome to my source code!

int main() {
    int n;
    cin >> n;
    bool flag = false;
    for (int i = 1; i <= 9; i++) for (int j = 1; j <= 9; j++) {
        if (i * j == n) flag = true;
    }
    if (flag) cout << "Yes" << endl;
    else cout << "No" << endl;
}

Measured memory_bytes: 256
N,M = map(int,input().rstrip().split(" "))
A = []
B = []
ans = False
for i in range(N):
    A.append(list(input()))
for i in range(M):
    B.append(list(input()))
for i in range(N - M + 1):
    for i2 in range(N - M + 1):
        for i3 in range(M):
            if A[i3 + i][i2:i2 + M] != B[i3]:
                break
            if i3 == M -1:
                ans = True
if ans:
    print("Yes")
else:
    print("No")

Measured memory_bytes: 9092
#include <bits/stdc++.h>
using namespace std;
void Main();

using i8  = int8_t;   /* -128 ~ 127 */
using u8  = uint8_t;  /* 0 ~ 255 */
using i16 = int16_t;  /* -32,768 ~ 32,767 */
using u16 = uint16_t; /* 0 ~ 65,535 */
using i32 = int32_t;  /* -2,147,483,648 ~ 2,147,483,647 */
using u32 = uint32_t; /* 0 ~ 4,294,967,295 */
using i64 = int64_t;  /* -9,223,372,036,854,775,808 ~ 9,223,372,036,854,775,807 */
using u64 = uint64_t; /* 0 ~ 18,446,744,073,709,551,615 */
using f32 = float;    /* (-3.4 * 10^38) ~ (3.4 * 10^38) */
using f64 = double;   /* (-1.7 * 10^308) ~ (1.7 * 10^308) */
using f80 = __float80;
template <class T> using Vec = vector<T>;
constexpr i64 INF = 1010000000000000017;
constexpr i64 MOD = 1e9 + 7;
constexpr f64 EPS = 1e-12;
constexpr f64 PI = 3.14159265358979323846;
#define YN(y, n, b) (b? y : n)
#define ALL(v) v.begin(), v.end()
#define GCD(a, b) __gcd(a, b) /* 最大公約数 */
#define LCM(a, b) a / __gcd(a, b) * b /* 最小公倍数 */

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

void Main() {
    i32 N;
    cin >> N;
    Vec<i32> A(N);
    for (i32 i = 0; i < N; i++) cin >> A[i];
    Vec<i32> B(ALL(A));
    sort(ALL(B));
    for (i32 i = 0; i < N; i++) {
        if (A[i] < B[N - 1]) cout << B[N - 1] << endl;
        else cout << B[N - 2] << endl;
    }
}


Measured memory_bytes: 4748
#include<iostream>
#include<cstdio>
#include<string>
#include<algorithm>
#include<vector>
#include<cmath>
#include<map>
#include<set>
#include<queue>
#define ll long long
#define pii pair<int,int>
#define pll pair<ll,ll>
#define pb push_back
#define rep(i,n) for(ll i=0;i<n;i++)
#define INF 1e9+7
#define LLINF 1e18
using namespace std;
const ll MOD = 1e9 +7;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n;
    string s[10100];
    ll ans=0,a=0,b=0,ab=0;
    cin>>n;
    rep(i,n){
        cin>>s[i];
    }
    rep(i,n){
        rep(j,s[i].size()-1){
            if(s[i][j]=='A' && s[i][j+1]=='B'){
                ans++;
            }
        }
        if(s[i][0]=='B' && s[i][s[i].size()-1]=='A') ab++;
        else if(s[i][0]=='B') b++; 
        else if(s[i][s[i].size()-1]=='A') a++;
    }
    if(a>0 && b>0 && ab==0) ans+=min(a,b);
    else if(a==0 && b>0 && ab>0) ans+=ab;
    else if(a>0 && b==0 && ab>0) ans+=ab;
    else if(a>0 && b>0 && ab>0){
        ans+=ab+1;
        ans+=min(a-1,b-1);
    }
    else if(a==0 && b==0 && ab>0) ans += ab-1;
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 768
/**akshaykumar99**/
 
#include<bits/stdc++.h>
using namespace std;
 
#define f(i,x,n) for(i=x;i<n;i++)
#define pu push_back           
#define pp pop_back
#define mp(a,b) make_pair(a,b)
#define F first
#define S second
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
#define IOS() ios::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
 
const int MOD=1e9+7 ;
const long long INF=INT_MAX;
const long long LINF=LLONG_MAX;
const long long N=1e5+1;
 
typedef long long ll;
typedef long double ld;
typedef vector<ll> ivc;
typedef pair<ll,ll> ipr;
 
int a[N]={0};
int main()
{
      IOS();
    
    ll n,k,q,i,j;
    cin>>n>>k>>q;
    int a[q];
    map<int, int> m;
    f(i,0,q)
    { 
      int x;
      cin>>x;
      x--;
      m[x]++;
    }
    f(i,0,n)
    {
      if(k+m[i]-q<=0)
        cout<<"No\n";
      else
        cout<<"Yes\n";
    }




   return 0;

}

Measured memory_bytes: 5376
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define double long double
#define mod 1000000007 //10^9+7
#define INF 1000000000000 //10^12
#define P pair<int,int>
#define rep(i,n) for(int i=0;i<n;i++)
int h,w;
int n;
int a[20000];
char c[200][200];
int cnt=0;
vector<int>vec;
vector<int>ans(200);
signed main(){
    cin>>h>>w;
    cin>>n;
    rep(i,n){
        cin>>a[i];
        rep(j,a[i]){
            vec.push_back(i+1);
        }
    }
    rep(i,h){
        if(i%2==0){
            rep(j,w){
                cout<<vec[cnt]<<" ";
                cnt++;
            }
            cout<<endl;
        }
        else{
            rep(j,w){
                ans[w-j-1]=vec[cnt];
                cnt++;
            }
            rep(j,w)cout<<ans[j]<<" ";
            cout<<endl;
            ans.clear();
        }
    }
    return 0;
}


Measured memory_bytes: 640
const input=require('fs').readFileSync('/dev/stdin','utf8').split(/[\s]/);const tn=():number=>{const a=input[0];input.shift();return Number(a)};const tnn=(n:number):number[]=>{const a=[];for(let i=0;i<n;i++){a.push(tn())}return a};const ts=():string=>{const a=input[0];input.shift();return String(a)};const tss=(n:number):string[]=>{const a=[];for(let i=0;i<n;i++){a.push(ts())}return a};const tc=():string=>{let a=input[0].split('');const b=a[0];a.shift();if(a.length>0){input[0]=a.join('')}else{input.shift()}return String(b)};const tcc=(n:number):string[]=>{const a=[];for(let i=0;i<n;i++){a.push(tc())}return a};const to=(...arg)=>{console.log(...arg)};const abs=(a)=>{return Math.abs(a)};const min=(...a)=>{return Math.min(...a)};const max=(...a)=>{return Math.max(...a)};const floor=(a)=>{return Math.floor(a)};const ceil=(a)=>{return Math.ceil(a)};const asc=(ar:number[])=>{return ar.sort((a,b)=>{return a-b})};const desc=(ar:number[])=>{return ar.sort((a,b)=>{return b-a})};const sw=(a,arr:any[],op:'=='|'>='|'>'|'<='|'<'='==')=>{for(let i=0;i<arr.length;i+=2){if(eval(a+op+arr[i]))return arr[i+1];}return arr[arr.length-1]};const near=(n:number,arr:number[]):number=>{let ne=arr[0],ni=0;for(let i=1;i<arr.length;i++){if(Math.abs(n-ne)>Math.abs(n-arr[i])){ne=arr[i];ni=i}}return ni};const gojo=(a:number,b:number):number=>{if(a%b===0)return b;return gojo(b,a%b)};const deduplicate=(a:number[])=>{return Array.from(new Set(a))};const permutation=(arr,n)=>{var arrs,i,j,zensu,results,parts;arrs=[];zensu=arr.length;if(zensu<n){return}else if(n==1){for(i=0;i<zensu;i++){arrs[i]=[arr[i]]}}else{for(i=0;i<zensu;i++){parts=arr.slice(0);parts.splice(i,1)[0];results=permutation(parts,n-1);for(j=0;j<results.length;j++){arrs.push([arr[i]].concat(results[j]))}}}return arrs}
const main=()=>{
  let n=tn(),ans=0
  let sr=ts()
  let b=null
  for(let i=0;i<n;i++){
    let s=sr[i]
    ans+=s!=b?1:0
    b=s
  }
  to(ans)
}
main()


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

using namespace std;

int main(){
  int N;
  cin >> N;
  
  string c, d;
  cin >> c;
  
  d = c;
  sort(c.begin(), c.end());
  
  int num = 0;
  for(int i = 0; i < N; i++){
    if(c[i] != d[i]) ++num;
  }
  
  cout << num / 2 << endl;
  
  return 0;
}

Measured memory_bytes: 3916
{-# LANGUAGE BangPatterns #-}
{-# LANGUAGE BinaryLiterals #-}
{-# LANGUAGE MultiWayIf #-}
{-# LANGUAGE NumDecimals #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE TupleSections #-}

import Control.Applicative
import Control.Arrow
import Control.Monad
import Control.Monad.ST

import Data.Char
import Data.List
import Data.Maybe

import qualified Data.ByteString.Char8 as B

import Data.Array.ST.Safe
import Data.STRef

import Debug.Trace
import Text.Printf

readInt = readLn :: IO Int
readInts = map ( fst . fromJust . B.readInt ) . B.words <$> B.getLine
readNInts = readInt >>= flip replicateM readInt

which a b f = if f then a else b
mp [ a, b ] = ( a, b )

main = do
	[ n, a, b ] <- readInts
	let
		mi = min a b
		ma = max 0 ( -( n - a - b ) )
	printf "%d %d\n" mi ma

Measured memory_bytes: 508
// ARC 078E
#include<iostream>
#include<cstdio>
#include<fstream>
#include<algorithm>
#include<vector>
#include<map>
#include<set>
#include<queue>
#include<cmath>
#include<cstring>
#include<cstdlib>
using namespace std;
typedef long long LL;
const LL inf = (LL)1000*1000*1000*1000;
int a[22],t;
LL ans;
bool re(LL x)
{
	if(x==0)
		return 1;
	while(t&&x<inf){
		x*=(LL)10;
	}
	cout<<"? "<<(LL)x-t<<endl;
	char c;
	cin>>c;
	if(c=='Y')
		return 1;
	return 0;
}
int main()
{
	int i,j,l;
	LL s;
	t=0;
	s=1;
	for(j=0;j<=10;j=j+1){
		if(!re(s))
			break;
		s*=(LL)10;
	}
	if(j>10){
		s=10;
		while(!re((LL)s-1)){
			s*=(LL)10;
		}
		ans=s/10;
		cout<<"! "<<ans<<endl;
		return 0;
	}
	ans=0;
	t=1;
	l=j;
	for(i=1;i<=l;i=i+1){
		s=(LL)ans*10;
		if(re(s+5)){
			for(j=4;j>=max(1,3-i);j=j-1){
				if(!re((LL)s+j))
					break;
			}
			a[i]=j;
		}
		else{
			for(j=6;j<=9;j=j+1){
				if(re((LL)s+j))
					break;
			}
			a[i]=j-1;
		}
		ans=(LL)s+a[i];
	}
	cout<<"! "<<ans<<endl;
	return 0;
}

Measured memory_bytes: 648
#include <bits/stdc++.h>
#define all(a) (a).begin(), (a).end()
#define REP(i, n) for(int (i)=0; (i)<(n); (i)++)
#define RREP(i, n) for(int (i)=(n)-1, (i)>=0; (i)--)
#define ios() cin.tie(0), ios::sync_with_stdio(false)
typedef long long ll;
typedef unsigned long long ull;
ll const MOD = 1e9+7;
ll const INF = 1e18;
using namespace std;

int main(){
    int a, b, c;
    cin >> a >> b >> c;
    if(c >= a && c <= b){
        cout << "Yes" << endl;
    }else{
        cout << "No" << 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++)
#define rep_(i, n, m) for (int i = n; i < (int)(m); i++)
#define all(v) v.begin(), v.end()
#define int long long
#define stoi stoll
//#define _GLIBCXX_DEBUG

char game(string sa, string sb, string sc, char p) {
  //cout << sa << " " << sb << " " << sc << endl;
  if(p == 'a') {
    if(sa.size() == 0) return 'A';
    else {
      char n = sa[0];
      sa.erase(sa.begin());
      return game(sa, sb, sc, n);
    }
  }
  if(p == 'b') {
    if(sb.size() == 0) return 'B';
    else {
      char n = sb[0];
      sb.erase(sb.begin());
      return game(sa, sb, sc, n);
    }
  }
  if(p == 'c') {
    if(sc.size() == 0) return 'C';
    else {
      char n = sc[0];
      sc.erase(sc.begin());
      return game(sa, sb, sc, n);
    }
  }
}

signed main() {
  string sa, sb, sc; cin >> sa >> sb >> sc;
  
  cout << game(sa, sb, sc, 'a') << endl;
}


Measured memory_bytes: 3660
#include <algorithm>
#include <string>
#include <math.h>
#include <vector>
#include <iostream>
using namespace std;

int main() 
{
    int N;
    cin >> N;
    
    vector<int> A(N);
    for (int i = 0; i < N; i++) {
        cin >> A.at(i);
        A.at(i)--;
    }
    vector<int> B(N);
    for (int i = 0; i < N; i++) {
        cin >> B.at(i);
    }
    vector<int> C(N-1);
    for (int i = 0; i < N-1; i++) {
        cin >> C.at(i);
    }
    
    int ans = 0;
    for (int i = 0; i < N; i++) {
        ans += B.at(A.at(i));
    }
    for (int i = 0; i < N-1; i++) {
        if (A.at(i)+1 == A.at(i+1)) {
            ans += C.at(A.at(i));
        }
    }
    cout << ans << endl;
}

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

#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define REP(i, n) for (int i = 0; i < (n); i++)
#define sz(obj) ((int)(obj).size())

int main()
{
  string str;
  getline(cin, str);

  REP(i, sz(str) - 4){
    if (str.substr(i, 5) == "apple") str.replace(i, 5, "peach");
    else if (str.substr(i, 5) == "peach") str.replace(i, 5, "apple");
  }
  cout << str << endl;
}

Measured memory_bytes: 1184
#include<stdio.h>
#include<algorithm>
#include<string.h>
using namespace std;
char str[100001];
int v[100000];
int dp[100001][3][3][2];
int main(){
	while(1){
		scanf("%s",str);
		if(str[0]=='#')return 0;
		int len=strlen(str);
		if(len<=2){
			printf("0\n");
			continue;
		}
		for(int i=0;i<len;i++)v[i]=str[i]-'0';
		for(int i=0;i<=len;i++)
			for(int j=0;j<3;j++)
				for(int k=0;k<3;k++)
					dp[i][j][k][0]=dp[i][j][k][1]=99999999;
		for(int i=0;i<3;i++)
			for(int j=i;j<3;j++)
				dp[0][i][j][0]=dp[0][i][j][1]=0;
		for(int i=0;i<len;i++){
			for(int j=0;j<3;j++){
				for(int k=j;k<3;k++){
					if((v[i]+2)%3<j){
						dp[i+1][(v[i]+2)%3][k][0]=min(dp[i+1][(v[i]+2)%3][k][0],min(dp[i][j][k][0]+1,dp[i][j][k][1]));
					}
					else if((v[i]+2)%3>k){
						dp[i+1][j][(v[i]+2)%3][1]=min(dp[i+1][j][(v[i]+2)%3][1],min(dp[i][j][k][0],dp[i][j][k][1]+1));
					}else{
						dp[i+1][(v[i]+2)%3][k][0]=min(dp[i+1][(v[i]+2)%3][k][0],min(dp[i][j][k][0]+1,dp[i][j][k][1]));
						dp[i+1][j][(v[i]+2)%3][1]=min(dp[i+1][j][(v[i]+2)%3][1],min(dp[i][j][k][0],dp[i][j][k][1]+1));
					}
				}
			}
		}
		int ret=9999999;
		for(int i=0;i<3;i++)
			for(int j=0;j<3;j++)
				ret=min(ret,min(dp[len][i][j][0],dp[len][i][j][1]));
		printf("%d\n",ret);
	}
}

Measured memory_bytes: 8504
#include <iostream>
#include <vector>

using namespace std;

int main()
{
    int h, w;
    cin >> h >> w;
    vector<vector<char>> c(h, vector<char>(w));
    for (int i = 0; i < h; i++) {
        for (int j = 0; j < w; j++) cin >> c[i][j];
    }

    for (int i = 0; i < 2 * h; i++) {
        for (int j = 0; j < w; j++) cout << c[i/2][j];
        cout << endl;
    }
}

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

#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define repi(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define mp make_pair
#define mt make_tuple

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

const int inf = 1e9;
const ll linf = 1LL<<60;
const ll mod = 1e9 + 7;
const double eps = 1e-9;

/*{
}*/

int n, m;
vi g[100000];
int c[100000];
int num[100000];
bool flag;

void dfs(int cur, int col)
{
  if(c[cur] != -1){
    if(c[cur] != col){
      flag = true; 
    }
  }else{
    c[cur] = col;
    num[col]++;
    for(int e : g[cur]) dfs(e, col^1);
  }
}

int main()
{
  cin >> n >> m;
  rep(i, m){
    int a, b;
    cin >> a >> b;
    a--; b--;
    g[a].pb(b);
    g[b].pb(a);
  }

  fill(c, c+n, -1);

  dfs(0, 0);

  if(flag) cout << 1LL*n*(n-1)/2-m << endl;
  else cout << 1LL*num[0]*num[1]-m << endl;

  return 0;
}


Measured memory_bytes: 6528
#include<map>
#include<set>
#include<queue>
#include<stack>
#include<cmath>
#include<ctime>
#include<bitset>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<complex>
#include<iostream>
#include<algorithm>
#define N 500001
#define M 1<<20
#define INF 0x3f3f3f3f
#define LL long long
#define add_edge(u,v) nxt[++cnt]=head[u],head[u]=cnt,to[cnt]=v
#define open(x) freopen(#x".in","r",stdin),freopen(#x".out","w",stdout)
char ch;bool fs;void re(int& x)
{
	while(ch=getchar(),ch<33);
	if(ch=='-')fs=1,x=0;else fs=0,x=ch-48;
	while(ch=getchar(),ch>33)x=x*10+ch-48;
	if(fs)x=-x;	
}
using namespace std;
priority_queue<int , vector<int> , greater<int> > que;
int n,k,p[N],a[N],d[N],top,st[N];
int l[M],r[M],mn[M];
int cnt,head[N],nxt[N+N],to[N+N];
void upd(int k)
{
	mn[k]=min(mn[k<<1],mn[k<<1|1]);
}
void build(int k,int a,int b)
{
	l[k]=a,r[k]=b;
	if(a==b)
	{
		mn[k]=p[a];
		return;
	}
	build(k<<1,a,a+b>>1);
	build(k<<1|1,(a+b>>1)+1,b);
	upd(k);
	
}
void change(int k,int a,int b)
{
	if(l[k]==r[k])
	{
		mn[k]=b;
		return;
	}
	if(a<=(l[k]+r[k]>>1))change(k<<1,a,b);
	else change(k<<1|1,a,b);
	upd(k);
}
int query(int k,int a,int b)
{
//	cerr<<k<<" "<<a<<" "<<b<<endl;
	if(a>r[k] || b<l[k])return INF;
	if(a<=l[k] && b>=r[k])return mn[k];
	return min(query(k<<1,a,b),query(k<<1|1,a,b));
}
int main()
{
	re(n),re(k);
	for(int i=1;i<=n;++i)
		re(p[i]),a[p[i]]=i;
/*	for(int i=1;i<=n;++i)
		printf("%d ",a[i]);
	puts("");*/
	build(1,1,n);
	for(int i=1;i<=n;++i)
	{
		change(1,a[i],INF);
		int j=query(1,a[i]+1,a[i]+k-1);
		if(j<INF)
		{
			++d[a[j]];
			add_edge(a[i],a[j]);
		}
		j=query(1,a[i]-k+1,a[i]-1);
		if(j<INF)
		{
			++d[a[j]];
			add_edge(a[i],a[j]);
		}
	}
	for(int i=1;i<=n;++i)
		if(!d[i])
			que.push(i);
	while(!que.empty())
	{
		int u=que.top();que.pop();
		st[u]=++top;
		for(int i=head[u];i;i=nxt[i])
		{
			--d[to[i]];
			if(!d[to[i]])
				que.push(to[i]);
		}
	}
	for(int i=1;i<=n;++i)
		printf("%d\n",st[i]);
}

Measured memory_bytes: 34164
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main()
{
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int N;
    cin >> N;
    vector<int> b(N);

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

    int press = 0;
    cout << endl;
    for(int i = 0; i < N; true) {
        if (i == 1) {
            cout << press;
             break;
        }
        if (press == N) {
            cout << "-1";
             break;
        }
        i = b[i];
        press++;
    }
    return 0;
}


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

counter = 0
ans = 1

for i in range(len(a)):
    if a[i] % 2 == 0:
        while 1:
            a[i] /= 2
            counter += 1
            if a[i] % 2 != 0:
                break

print(counter)



Measured memory_bytes: 4268
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<long long> vll;
typedef vector<pair<int, int>> vpi;
typedef vector<pair<long long, long long>> vpl;
typedef pair<int, int> pii;
typedef pair<long long, long long> pll;
#define INF (int)(1e9)
#define MAXX 1.1529215e+18
#define inf 999999
#define EPS (1e-7)
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define REP(i, n) for (int i = 1; i <= (int)(n); i++)
#define FOR(i, k, n) for (int i = (k); i < (int)(n); i++)
#define ALL(a) a.begin(), a.end()
#define RALL(a) a.begin(), a.end(), greater<int>()
#define ROT(a) a.begin(), a.begin() + 1, a.end()
#define RROT(a) a.begin(), a.end() - 1, a.end()
#define PB push_back
#define MP make_pair
#define PI acos(-1.0)
#define sz(a) a.size()
const ll MOD = 1e9 + 7;
const int MAX = 10000000;
template <typename T1, typename T2>
inline bool chmin(T1& a, T2 b)
{
    if (a > b) {
        a = b;
        return 1;
    }
    return 0;
}
template <typename T1, typename T2>
inline bool chmax(T1& a, T2 b)
{
    if (a < b) {
        a = b;
        return 1;
    }
    return 0;
}
template <typename T>
T gcd(T a, T b)
{
    if (b == 0)
        return a;
    return gcd(b, a % b);
}
//cout << 'H' << endl;
/*--------------------------------------------*/
ll N, M;

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

    cin >> N >> M;

    vector<int> l(N);
    vector<int> r(N);

    rep(i, M)
    {
        int a, b;
        cin >> a >> b;
        --a;
        --b;

        l[a]++;
        r[b]++;
    }

    rep(i, N)
    {
        if (abs(l[i] - r[i]) % 2) {
            cout << "NO" << endl;
            return 0;
        }
    }

    cout << "YES" << endl;
}


Measured memory_bytes: 1024
N, Q = [int(x) for x in input().split()]
S = input()
R = [0]
res = 0
ans = []
for i in range(N - 1):
    if S[i:i+2] == 'AC':
        res += 1
    R.append(res)
for i in range(Q):
    l, r = [int(x) for x in input().split()]
    ans.append(R[r-1] - R[l-1])
for r in ans:
    print(r)


Measured memory_bytes: 10320
#include<iostream>
#define min(a,b) a<b?a:b
#define MAX 1000000007
using namespace std;
int a[100005][4];
int main(){
	long long int s=1;
	int n,m=0;
	int i,j,k;
	cin>>n;
	for(i=0;i<100005;i++){
		for(j=0;j<4;j++){
			a[i][j]=MAX;
		}
	}
	for(i=0;i<n;i++){
		cin>>a[i][0];
	}
	for(i=0;i<n;i++){
		cin>>a[i][1];
	}
	a[0][2]=a[0][0];
	a[0][3]=1;
	a[n-1][2]=a[n-1][1];
	a[n-1][3]=1;
	for(i=1;i<n;i++){
		if(a[i-1][0]<a[i][0]){
			if(a[i][0]>a[i][1])m=1;
			a[i][2]=a[i][0];
			a[i][3]=1;
		}else if(a[i-1][0]==a[i][0]){
			a[i][2]=min(a[i][2],a[i][0]);
		}else{
			m=1;
		}
	}
	for(i=n-2;i>=0;i--){
		if(a[i+1][1]<a[i][1]){
			if(a[i][1]>a[i][0])m=1;
			a[i][2]=a[i][1];
			a[i][3]=1;
		}else if(a[i+1][1]==a[i][1]){
			a[i][2]=min(a[i][2],a[i][1]);
		}else{
			m=1;
		}
	}
	if(a[n-1][0]!=a[0][1])m=1;
	if(m==1){
		cout<<"0"<<endl;
		return 0;
	}
	for(i=0;i<n;i++){
		if(a[i][3]==1)continue;
		s*=a[i][2];
		s%=MAX;
	}
	cout<<s<<endl;
	return 0;
}
		


Measured memory_bytes: 1920
n = int(input())
t, a = map(int, input().split())
li = list(map(int, input().split()))
answer = 0
temp = 999999999999999
for i in range(len(li)):
    if abs(a - (t - (li[i] *  0.006))) < temp:
        temp = abs(a - (t - (li[i] *  0.006)))
        answer = i + 1
print(answer)


Measured memory_bytes: 3060
/*************************************\
*           بِسْمِ اللهِ الرَّحْمٰنِ الرَّحِيْمِ             *
*             رَّبِّ زِدْنِى عِلْمًا                *
*   Mir Abdullah yousuf, KUET_EEE14   *
\*************************************/
#include <bits/stdc++.h>
#define LL              long long
#define PI              acos(-1.0)
#define PII             pair<int,int>
#define xx              first
#define yy              second
#define MS(a,b)         memset(a, b, sizeof (a))
#define MP(a,b)         make_pair(a, b)
#define pb              push_back
#define sf(a)           scanf("%d", &a)
#define sfl(a)          scanf("%lld", &a)
#define READ()          freopen("input.txt", "r", stdin)
#define WRITE()         freopen("output.txt", "w", stdout)
#define GCD(a, b)       __gcd(a, b)
#define LCM(a, b)       (a * b) / GCD(a, b)
#define sqr(a)          (a) * (a)
#define MOD             1000000007
#define MAX             1000000 + 5
#define inf             2147483647
using namespace std;

///***********-8-direction*************/
//int fx[] = {1, -1, 0, 0, 1, -1, -1, 1};
//int fy[] = {0, 0, 1, -1, 1, 1, -1, -1};
//
///***********-4-direction*************/
//int fx[] = {1, -1, 0, 0};
//int fy[] = {0, 0, 1, -1};


int main()
{
    int n; cin >> n;
    int a; cin >> a;
    cout << sqr(n) - a << endl;
    return 0;
}


Measured memory_bytes: 256
import sys
input=sys.stdin.readline
sys.setrecursionlimit(10**9)
n,m=map(int,input().split())
A=[]
for _ in range(n):
    x,y,z=map(int,input().split())
    A.append([x+y+z,-x+y+z,x-y+z,x+y-z,-x-y+z,-x+y-z,x-y-z,-x-y-z])
ans=0
for i in range(8):
    B=sorted(A,key=lambda x:x[i],reverse=True)
    B=list(map(list, zip(*B)))
    ans=max(ans,sum(B[i][:m]))
print(ans)

Measured memory_bytes: 3572
/**
 *   created: 07 September 2019  17:28:19
**/
#include<bits/stdc++.h>
using namespace std;

typedef vector<int> vi;
typedef pair<int , int> pii;
typedef vector< pair<int , int> > vii;
typedef long long ll;
typedef vector<long long> vl;
typedef pair<long long , long long> pll;
typedef vector< pair<long long , long long> > vll;

#define PB push_back
#define PPB pop_back
#define all(c) c.begin(),c.end()
#define rep(i,a,b) for(int i = (int)(a); i < (int)(b); i++)
#define rrep(i,a,b) for(int i = (int)(a-1); i>=(int)(b); i--)
#define INFLL 2000000000000000007
#define INF 2000000007
#define MOD 1000000007


#define TRACE

#ifdef TRACE
#define trace1(x)                cerr << #x << ": " << x << endl;
#define trace2(x, y)             cerr << #x << ": " << x << " | " << #y << ": " << y << endl;
#define trace3(x, y, z)          cerr << #x << ": " << x << " | " << #y << ": " << y << " | " << #z << ": " << z << endl;
#define trace4(a, b, c, d)       cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " << c << " | " << #d << ": " << d << endl;
#define trace5(a, b, c, d, e)    cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " << c << " | " << #d << ": " << d << " | " << #e << ": " << e << endl;
#define trace6(a, b, c, d, e, f) cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " << c << " | " << #d << ": " << d << " | " << #e << ": " << e << " | " << #f << ": " << f << endl;

#else

#define trace1(x)
#define trace2(x, y)
#define trace3(x, y, z)
#define trace4(a, b, c, d)
#define trace5(a, b, c, d, e)
#define trace6(a, b, c, d, e, f)

#endif


void optimizeIO()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
}

//                                        //AUTHOR: Kaushalesh Shukla

//=========================================================================================================

int main()
{
    optimizeIO();
    int tt=1;
    //cin>>tt;
    while(tt--){
        int n;
        cin>>n;
        cout<<n*n*n;
    }
    return 0;
}


Measured memory_bytes: 256
// author: pankaj_m05

#include<bits/stdc++.h>
using namespace std;

typedef long long ll;

void testcase() {
	
}

int main(void) {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
	
    int n;
    cin >> n;
    map<string, int> mp;
    for (int i = 0; i < n; ++i) {
    	string s;
    	cin >> s;
    	++mp[s];
    }
    cout << "AC x " << mp["AC"] << '\n';
	cout << "WA x " << mp["WA"] << '\n';
	cout << "TLE x " << mp["TLE"] << '\n';
	cout << "RE x " << mp["RE"] << '\n';
    return 0;
}

Measured memory_bytes: 3648
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,n) for(int i=1;i<n;i++)
#define all(v) v.begin(),v.end()
#define P pair<int,int>
#define len(s) (int)s.size()
#define pb push_back

template<class T> inline bool chmin(T &a, T b){
	if(a>b){a=b;return true;}
	return false;
}
template<class T> inline bool chmax(T &a, T b){
	if(a<b){a=b;return true;}
	return false;
}
constexpr int mod = 1e9+7;
constexpr int inf = 3e18;

signed main(){
	int a,b;cin>>a>>b;
	cout<<a*b<<endl;
}


Measured memory_bytes: 3632
//ｺｯwwｺｯwwｺｹｯwwwｺｯwwｺｹｯwwwｺｹｯｺｯwwwｺｯwwｺｯwwｺｹｯwwwｺｯwwｺｹｯwwwｺｹｯｺｯwwwｺｹｰｰｰｰｯ!!!wwwwwｺｯwwｺｯwwｺｹｯwwwｺｯwwｺｹｯwwwｺｹｯｺｯwwwｺｯwwｺｯwwｺｹｯwwwｺｯwwwｺｹｯwwwｺｹｯｺｯwwwｺｹｰｰｰｰｯ!!!wwwwwｺｹｯｺｯｯｺｰｰｰｰ!!!!!!wwwwwwwwwww
//ｺｯwwｺｯwwｺｹｯwwwｺｯwwｺｹｯwwwｺｹｯｺｯwwwｺｯwwｺｯwwｺｹｯwwwｺｯwwｺｹｯwwwｺｹｯｺｯwwwｺｹｰｰｰｰｯ!!!wwwwwｺｯwwｺｯwwｺｹｯwwwｺｯwwｺｹｯwwwｺｹｯｺｯwwwｺｯwwｺｯwwｺｹｯwwwｺｯwwwｺｹｯwwwｺｹｯｺｯwwwｺｹｰｰｰｰｯ!!!wwwwwｺｹｯｺｯｯｺｰｰｰｰ!!!!!!wwwwwwwwwww
//ｺｯwwｺｯwwｺｹｯwwwｺｯwwｺｹｯwwwｺｹｯｺｯwwwｺｯwwｺｯwwｺｹｯwwwｺｯwwｺｹｯwwwｺｹｯｺｯwwwｺｹｰｰｰｰｯ!!!wwwwwｺｯwwｺｯwwｺｹｯwwwｺｯwwｺｹｯwwwｺｹｯｺｯwwwｺｯwwｺｯwwｺｹｯwwwｺｯwwwｺｹｯwwwｺｹｯｺｯwwwｺｹｰｰｰｰｯ!!!wwwwwｺｹｯｺｯｯｺｰｰｰｰ!!!!!!wwwwwwwwwww
//ｺｯwwｺｯwwｺｹｯwwwｺｯwwｺｹｯwwwｺｹｯｺｯwwwｺｯwwｺｯwwｺｹｯwwwｺｯwwｺｹｯwwwｺｹｯｺｯwwwｺｹｰｰｰｰｯ!!!wwwwwｺｯwwｺｯwwｺｹｯwwwｺｯwwｺｹｯwwwｺｹｯｺｯwwwｺｯwwｺｯwwｺｹｯwwwｺｯwwwｺｹｯwwwｺｹｯｺｯwwwｺｹｰｰｰｰｯ!!!wwwwwｺｹｯｺｯｯｺｰｰｰｰ!!!!!!wwwwwwwwwww
//ｺｯwwｺｯwwｺｹｯwwwｺｯwwｺｹｯwwwｺｹｯｺｯwwwｺｯwwｺｯwwｺｹｯwwwｺｯwwｺｹｯwwwｺｹｯｺｯwwwｺｹｰｰｰｰｯ!!!wwwwwｺｯwwｺｯwwｺｹｯwwwｺｯwwｺｹｯwwwｺｹｯｺｯwwwｺｯwwｺｯwwｺｹｯwwwｺｯwwwｺｹｯwwwｺｹｯｺｯwwwｺｹｰｰｰｰｯ!!!wwwwwｺｹｯｺｯｯｺｰｰｰｰ!!!!!!wwwwwwwwwww
import java.util.*;
public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        sc.close();
        int yono = 1;
        boolean ebishu = true;
        int pct = 0;
        while(ebishu){
            if(yono >= b){
                ebishu = false;
            }else{
                yono--;
                pct++;
                yono += a;
            }
        }
        System.out.println(pct);
    }
}

Measured memory_bytes: 35728
#pragma GCC optimize("Ofast")
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define u unsigned
#define fast ios::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define mod 1000000007
#define f(i,n) for(int i=0;i<n;i++)
#define f1(i,n) for(int i=1;i<n;i++)
#define in(i,arr) for(auto &i:arr)cin>>i;
#define out(i,arr) for(auto &i:arr)cout<<i<<" "
#define all(x) (x).begin(), (x).end()   // sort(all(v)) instead sort(v.begin(),v.end())
#define vpii vector<pair<int,int>>
#define vpll vector<pair<ll,ll>>
#define vi vector<int>
#define vl vector<ll>
#define pb push_back
#define eb empalce_back
ll powe(ll base, ll to)
{   ll ans=1;
    while(to>0) {
        if (to & 1)
            ans =(ans*base)%mod, to--;
        else base = (base*base)%mod, to /= 2;
    }
    return ans;
}
ll gcd(ll a,ll b){return (b==0)?a:gcd(b,a%b);}
bool prime(ll n){if(n==1)return 0;for(ll i=2;i*i<=n;i++)if(n%i==0)return 0;return 1;}
bool check(vi v,int n)
{
    if(v.size()<2)return false;
    for(int i=0;i<v.size();i++)
    {
        if((v[i]+v[i+1]+1)==n)return true;
    }
    return false;
}


int main() {
    fast;
    int t = 1;
    //cin >> t;
    while (t--) {
        int n;
        cin >> n;
        if (n == 1) {
            cout << 0;
            return 0;
        }
        ll ans = (powe(10, n) % mod - (2 * powe(9, n)) % mod + powe(8, n) % mod) % mod;
        ans = (ans+mod*2)%mod;
        cout << ans;
    }

}


Measured memory_bytes: 3660
import sys
def input(): return sys.stdin.readline().strip()
def mapint(): return map(int, input().split())
sys.setrecursionlimit(10**9)

H, W, K = mapint()

rows = [0]*H
query = []
allcnt = 0
for h in range(H):
    Cs = list(input())
    query.append(Cs)
    cnt = sum([1 if i=='#' else 0 for i in Cs])
    rows[h] = cnt
    allcnt += cnt
ans = 0
for i in range(1<<H):
    skip = set()
    num = 0
    for h in range(H):
        if (i>>h)&1:
            skip.add(h)
            num += rows[h]
    for j in range(1<<W):
        num2 = num
        for w in range(W):
            if (j>>w)&1:
                for h2 in range(H):
                    if h2 in skip:
                        continue
                    if query[h2][w]=='#':
                        num2 += 1
        if allcnt-num2==K:
            ans += 1
print(ans)

Measured memory_bytes: 74084
#include <iostream>
#include <vector>

int main() {
  unsigned N, M;
  std::vector<unsigned> X(100002, 0u);
  std::cin >> N >> M;
  for (unsigned i = 0; i < N; ++i) {
    unsigned tmp;
    std::cin >> tmp;
    ++X[tmp];
  }
  std::vector<unsigned> odd(M, 0u);
  std::vector<unsigned> even(M, 0u);
  for (unsigned i = 0; i <= 100000; ++i) {
    if (M % 2 == 0 && i % M == M / 2) {
      odd[M / 2] += X[i];
      continue;
    }
    if (i % M == 0) {
      odd[0] += X[i];
      continue;
    }
    if (X[i] % 2) {
      ++odd[i % M];
    }
    even[i % M] += X[i] / 2;
  }
  unsigned ans = 0u;
  for (unsigned i = 1; i < (M + 1) / 2; ++i) {
    unsigned min_i;
    unsigned max_i;
    if (odd[i] < odd[M - i]) {
      min_i = i;
      max_i = M - i;
    } else {
      min_i = M - i;
      max_i = i;
    }
    ans += odd[min_i];
    odd[max_i] -= odd[min_i];
    if (odd[max_i] <= even[min_i] * 2) {
      ans += odd[max_i];
      even[min_i] *= 2;
      even[min_i] -= odd[max_i];
      ans += even[min_i] / 2;
      ans += even[max_i];
    } else {
      ans += even[min_i] * 2;
      ans += even[max_i];
    }
  }
  ans += odd[0] / 2;
  if (M % 2 == 0) {
    ans += odd[M / 2] / 2;
  }
  std::cout << ans;
  return 0;
}


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

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
using ll = long long;

// ABC131-A

int main() {

    int N,L;
    cin >> N >> L;
    int s = 0;
    for(int j=1; j<=N; j++){
        s+=(L+j-1);
    }

    int i;
    int a = 1-L;
    if(a > N){
        i = N;
    }else if((a >= 1) && (a <= N)){
        i = a;
    }else{
        i = 1;
    }

    cout << s-(L+i-1) << endl;

    return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <array>
#include <cmath>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>

#include <set>
#include <string>
#include <tuple>
#include <utility>
#include <vector>

#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
using namespace std;

int main() {
    int A, B, C, K;
    cin >> A >> B >> C >> K;
    int N = 0;

    int ret = 0;
    ret = min(A, K);
    K -= ret;
    if(K == 0) {
        cout << ret << endl;
        return 0;
    }

    N = min(B, K);
    K -= N;
    if(K == 0) {
        cout << ret << endl;
        return 0;
    }

    N = min(C, K);
    ret -= N;
    cout << ret << endl;

    return 0;
}


Measured memory_bytes: 3672
function main(n) {
    for (var i = 1; i <= 9; i++) {
        if (n % i === 0 && n / i < 10) {
            console.log('Yes');
            process.exit(0);
        }
    }
    console.log('No');
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));

Measured memory_bytes: 7372
#include<iostream>
#include<cmath>
#include<cstdio>
using namespace std;
int main(){
  int n;
  cin >>n;
  while(n--){
    double a[2],b[2],c[2],m[2][2],ans[2],inv[2][2],det,x,y,r;
    cin >>a[0]>>a[1]>>b[0]>>b[1]>>c[0]>>c[1];
    b[0]-=a[0];
    b[1]-=a[1];
    c[0]-=a[0];
    c[1]-=a[1];
    m[0][0] = 2*b[0];
    m[0][1] = 2*b[1];
    m[1][0] = 2*c[0];
    m[1][1] = 2*c[1];
    ans[0] = b[0]*b[0]+b[1]*b[1];
    ans[1] = c[0]*c[0]+c[1]*c[1];
    det = m[0][0]*m[1][1]-m[0][1]*m[1][0];
    inv[0][0] = m[1][1]/det;
    inv[0][1] = -m[0][1]/det;
    inv[1][0] = -m[1][0]/det;
    inv[1][1] = m[0][0]/det;
    x = ans[0]*inv[0][0]+ans[1]*inv[0][1];
    y = ans[0]*inv[1][0]+ans[1]*inv[1][1];
    r = sqrt(x*x+y*y);
    x+=a[0];
    y+=a[1];
    printf("%.3lf %.3lf %.3lf\n",x,y,r);
  }
  return 0;
}

Measured memory_bytes: 1240
#include <bits/stdc++.h>
#define rep(i,a,b) for(int i=a; i< (int)(b); ++i)
#define ALL(x) (x).begin(),(x).end()
#define rALL(x) (x).rbegin(),(x).rend()
typedef long double ld;
using ll=long long;
using namespace std;
const int mod=1e9+7;
const ll inf = 1LL << 60;
const ld pi = (acos(-1));
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 (b<a) { a=b; return 1; } return 0; }




int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(20);
  
  int n; cin >> n;
  int a[101010][3],dp[101010][3];
  rep(i,0,n){
    rep(j,0,3) cin >> a[i][j];
  }
  rep(i,0,3) dp[1][i]=a[0][i];
  rep(i,1,n) rep(lst,0,3){
    rep(nxt,0,3) if(lst!=nxt){
      chmax(dp[i+1][nxt],dp[i][lst]+a[i][nxt]);
    } 
  }
  int ans = 0;
  rep(i,0,3) chmax(ans,dp[n][i]);
  cout << ans << endl;
}

Measured memory_bytes: 2560
#include <iostream>
#include <vector>
#include <map>
#include <bitset>
#include <algorithm>
#include <string>
#include <queue>
#include <stack>
#include <cmath>
#include <set>
#include <list>
#include <sstream>
#include <numeric>

#define ll long long
#define ld long double
#define ull unsigned long long
using namespace std;

const ll mod = 1000000007;
const ll inf = 8223372036854775803;
const int maxN = 300005;

ll solve(int idx, vector<ll>& price, vector<vector<ll>>& DP, vector<ll>& know, ll x) {
    bool good = true;
    for (int i = 0; (i < know.size()) && good; i++) {
        good = know[i] >= x;
    }
    if (good) {
        return 0;
    }
    if (idx >= DP.size()) {
        return inf;
    }
    ll ans = solve(idx+1, price, DP, know, x);
    for (int i = 0; i < DP[0].size(); i++) {
        know[i] += DP[idx][i];
    }
    ll ans2 = price[idx] + solve(idx+1, price, DP, know, x);
    for (int i = 0; i < DP[0].size(); i++) {
        know[i] -= DP[idx][i];
    }

    return min(ans, ans2);
}

int main() {
//    cout.precision(10);
//    cout << fixed;
    cin.tie(0);
    ios_base::sync_with_stdio(false);
    ll n,m,x;
    cin >> n >> m >> x;
    vector<ll> C(n);
    vector<vector<ll>> DP(n, vector<ll>(m));
    for (int i = 0; i < n; i++) {
        cin >> C[i];
        for (int j = 0; j < m; j++) {
            cin >> DP[i][j];
        }
    }
    vector<ll> K(m, 0);
    ll ans = solve(0, C, DP, K, x);
    cout << (ans == inf ? -1 : ans);
    return 0;
}



Measured memory_bytes: 3660
#include <iostream>
#include <array>
#include <algorithm>
#include <vector>
#include <set>
#include <unordered_set>
#include <cmath>
#include <complex>
#include <deque>
#include <iterator>
#include <numeric>
#include <map>
#include <unordered_map>
#include <queue>
#include <stack>
#include <string>
#include <tuple>
#include <utility>
#include <limits>
#include <iomanip>
using namespace std;

using ll=long long;
template<class T> using V = vector<T>;
template<class T, class U> using P = pair<T, U>;
using vll = V<ll>;
using vvll = V<vll>;
#define rep(i, k, n) for (ll i=k; i<(ll)n; ++i)
#define REP(i, n) rep(i, 0, n)
#define ALL(v) v.begin(),v.end()
template<class T> inline bool chmax(T& a, T b) {if (a<b) {a=b; return true;} return false;}
template<class T> inline bool chmin(T& a, T b) {if (a>b) {a=b; return true;} return false;}

const ll MOD = 1000000007;
const ll HIGHINF = (ll)1e18;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll a, b; cin >> a >> b;
    ll ans = 0, tmpa=1;
    while (tmpa < b) {
        tmpa--; tmpa += a;
        ans++;
    }
    cout << ans << '\n';
    return 0;
}


Measured memory_bytes: 256