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

int main() {
    string s;
    cin >> s;
    // cout << s[0] << endl;
    // cout << atoi("1") << endl;
    // for (char x : s) {
    //     cout << x << endl;
    // }
    int ans = 0;
    for (char x : s) {
        ans += x - '0';
        if (ans >= 1000000000) ans %= 9;
    }
    if (ans%9 == 0) cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 3712
#include<iostream>
using namespace std;
int main(){
  int a,b,c,d;
  cin>>a>>b>>c>>d;
  if( a==b && c==d || a==c && b==d || a==d && b==c ){
    cout<<"yes"<<endl;
  }else{
    cout<<"no"<<endl;
  }
  return 0;
}

Measured memory_bytes: 3100
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#define REP(i, a, n) for(int i = (a); i <= (n); i++)
using namespace std;
typedef pair<int, int> PII;

int W, H;

int main(void) {
  vector<PII> v;
  REP(h, 1, 150) REP(w, h + 1, 150) v.push_back(PII(h * h + w * w, h));
  sort(v.begin(), v.end());

  while(cin >> H >> W, H || W) {
    int d = H * H + W * W, k;
    for(k = 0; k < v.size(); k++) if(d == v[k].first && H == v[k].second) break;
    cout << v[k + 1].second << " " << (int) sqrt(v[k + 1].first - v[k + 1].second * v[k + 1].second) << endl;
  }

  return 0;
}

Measured memory_bytes: 3112
N = int(input())
for h in range(1, 3500 + 1):
        for n in range(h, 3500 + 1):
                if (4 * h * n - N * n - N * h) <= 0:
                        continue
                if N * h * n % (4 * h * n - N * n - N * h) == 0:
                        w = N * h * n // (4 * h * n - N * n - N * h)
                        print("{} {} {}".format(h, n, w))
                        exit()

Measured memory_bytes: 3060
/*
problem's name:
statue:
writer:Patrick_y
*/
#include <iostream>
#include <map>
#include <vector>
#include <cstring>
#include <utility>
#include <algorithm>
#include <cstdio>
#include <queue>
#include <string>
#include <stack>
#include <set>
#include <deque>
#include <cctype>
#include <sstream>
#include <math.h>
#include <stdio.h>
#include <time.h>
#define mp make_pair
typedef long long ll;
using namespace std;
const ll INF=20050208;
/*------------main part------------*/
ll n,a,b,k;
ll mod=998244353;
ll mem[300005];
ll ans;
ll pow_(ll a,ll n,ll m)
{
	ll b,t;
	if(n==0)
	{
		return 1;
	}
	a%=m,b=a*a,b%=m;
	t=pow_(b,n/2,m);
	if(n%2!=0)
	{
		t*=a,t%=m;
	}
	return t;
}


ll C(ll x)
{
	if(n/2<x)
	{
		x=n-x;
	}
	if(x==0)
	{
		return 1;
	}
	if(mem[x]==-1)
	{
    	mem[x]=C(x-1)*(n-x+1)%mod*pow_(x,mod-2,mod)%mod;
	}
	return mem[x];
}
int main()
{
	cin>>n>>a>>b>>k;
	memset(mem,-1,sizeof(mem));
	for(ll i=0;i<=n;i++)
	{
		ll j=(k-a*i)/b;
		if(j<0 or n<j or a*i+b*j!=k)
			continue;
		ans=(ans+C(i)*C(j))%mod;
	}
	cout<<ans<<endl;
	return 0;
}


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

int main (){
	int p,cnt=0;
	string s;
	
	cin >> s;
	for(int i=0;i<s.size();i++){
		if(s[i]=='p'){
		cnt++;
		}
	}
	p = s.size()/2;
	cout << p-cnt <<endl;
	
	return 0;
}

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

int main() {
  int n;
  cin >> n;
  
  vector<double> v(n);
  for (int i = 0; i < n; i++) {
    cin >> v.at(i);
  }
  
  vector<double> v_r(n);
  for (int i = 0; i < n; i++) {
    v_r.at(i) = 1 / v.at(i);
  }
  
  double sum = 0;
  for (int i = 0; i < n; i++) {
    sum += v_r.at(i);
  }
  
  cout << 1 / sum << endl;
}

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

using vi = vector<int>;
using vvi = vector<vector<int>>;
using vvvi = vector<vector<vector<int>>>;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
using vvvll = vector<vector<vector<ll>>>;
using vd = vector<double>;
using vvd = vector<vector<double>>;
using vvvd = vector<vector<vector<double>>>;
using vb = vector<bool>;
using vvb = vector<vector<bool>>;
using vs = vector<string>;
using pint = pair<int, int>;
using Graph = vvi;

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()

int main() {
    int n;
    cin >> n;
    vi a(n);
    rep(i, n) cin >> a[i];
    
    sort(all(a));
    a.erase(unique(all(a)), a.end());

    if(a.size() == n) cout << "YES" << endl;
    else cout << "NO" << endl;

    return 0;
}

Measured memory_bytes: 1024
using System;



    class Program {
        static void Main(string[] args) {

            string[] Input = Console.ReadLine().Split(' ');

            int A = int.Parse(Input[0]);
            int B = int.Parse(Input[1]);
            int K = int.Parse(Input[2]);

            
            int res = 0;
            int i = 101;

            while (true) {
                      --i;
                      if (A % i == 0 && B % i == 0) {
                        --K;
                    res = i;
                    }
                
             if(K == 0) break;
            }

            Console.WriteLine(res);
        
        }
    }



Measured memory_bytes: 13140
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.InputMismatchException;
import java.io.IOException;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author KharYusuf
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        FastReader in = new FastReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        DMultipleOf2019 solver = new DMultipleOf2019();
        solver.solve(1, in, out);
        out.close();
    }

    static class DMultipleOf2019 {
        public void solve(int testNumber, FastReader s, PrintWriter w) {
            char[] c = s.next().toCharArray();
            int n = c.length;
            int[] d = new int[n + 1];
            int cur = 1;
            long ans = 0;
            int[] f = new int[2019];
            f[0]++;
            for (int i = n - 1; i >= 0; i--) {
                d[i] = (c[i] - '0') * cur + d[i + 1];
                cur *= 10;
                d[i] %= 2019;
                cur %= 2019;
                ans += f[d[i]];
                f[d[i]]++;
            }
            w.println(ans);
        }

    }

    static class FastReader {
        private InputStream stream;
        private byte[] buf = new byte[1024];
        private int curChar;
        private int numChars;
        private FastReader.SpaceCharFilter filter;

        public FastReader(InputStream stream) {
            this.stream = stream;
        }

        public int read() {

            if (numChars == -1)
                throw new InputMismatchException();

            if (curChar >= numChars) {

                curChar = 0;

                try {
                    numChars = stream.read(buf);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }

                if (numChars <= 0)
                    return -1;
            }

            return buf[curChar++];
        }

        public String next() {

            int c = read();

            while (isSpaceChar(c))
                c = read();

            StringBuilder res = new StringBuilder();

            do {
                res.appendCodePoint(c);
                c = read();
            }
            while (!isSpaceChar(c));

            return res.toString();
        }

        public boolean isSpaceChar(int c) {

            if (filter != null)
                return filter.isSpaceChar(c);

            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

        public interface SpaceCharFilter {
            public boolean isSpaceChar(int ch);

        }

    }
}



Measured memory_bytes: 29032
import java.util.*;
import static java.lang.Math.*;
import java.math.BigInteger;

public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		
		// 入力
		int n = sc.nextInt();
		int W = sc.nextInt();
		int[] w = new int[n];
		long[] v = new long[n];
		for(int i = 0; i < n; i++){
		    w[i] = sc.nextInt();
		    v[i] = sc.nextLong();
		}
		
		// 計算
		long result = 0;
		long[][] dp = new long[n][W+1];
		dp[0][0] = 0;
		for(int i = 0; i < n; i++){
		    for(int j = 0; j < W+1; j++){
		        if(w[i]+j < W+1 && i == 0) dp[i][w[i]+j] = v[i];
		        if(i > 0){
		            dp[i][j] = max(dp[i][j], dp[i-1][j]);
		            if(w[i]+j < W+1) dp[i][w[i]+j] = max(dp[i][w[i]+j], dp[i-1][j] + v[i]);
		        }
		    }
		}
		for(int i = 0; i < W+1; i++){
		    result = max(result, dp[n-1][i]);
		}
		
		// 出力
		System.out.println(result);
	}
}


Measured memory_bytes: 127056
import java.util.*;
 
class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
      	int ret = -1;
      	int cnt = 1;
      	while(ret <= -1){
          ret = cnt*1000 - a;
          cnt++;
        }
		
      	System.out.println(ret);
    }
}

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

typedef long long ll;

using namespace std;

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

    vector<ll> a;

    ll op, tmp;
    for (ll i=0; i<n; i++)
    {
        cin >> op;

        //for (auto k: a)
        //    cout << k << ' ';
        //cout << endl;

        switch(op)
        {
            case 0:
                cin >> tmp;
                a.push_back(tmp);
                break;
            case 1:
                cin >> tmp;
                cout << a[tmp] << endl;
                break;
            case 2:
                a.pop_back();
                break;
        }
    }

    return 0;
}



Measured memory_bytes: 4884
#include <iostream>
#include <algorithm>
#include <stdlib.h>
#include <iomanip>
#include <cmath>
#define PI 3.14159265359
using namespace std;

int main()
{
	int n;
	unsigned long long int ans = 1;
	double x = 10, y = 9;;

	cin >> n;
	for (int i = 1; i <= n; ++i) {
		ans *= i;
		ans %= (int)pow(x, y) + 7;
	}
	ans %= (int)pow(x, y) + 7;
	cout << ans << endl;
	
	return 0;
}

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

const int N=500+5;
int n,k,a[N],b[N];

void check(int F)
{
	int sum=0;
	for(int i=1;i<=n;++i){b[i]=a[i]%F;sum+=b[i];}
	int m=n-sum/F;
	nth_element(b+1,b+m,b+n+1);
	sum=0;
	for(int i=1;i<=m;++i)sum+=b[i];
	if(sum<=k){cout<<F;exit(0);}
}

int main()
{
	cin>>n>>k;
	int sum=0;
	for(int i=1;i<=n;++i){scanf("%d",a+i);sum+=a[i];}
	int x;
	for(x=1;x*x<=sum;++x)
	if(sum%x==0)check(sum/x);
	while(--x)
	if(sum%x==0)check(x);	 
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main () {
  int N;
  cin >> N;
  long long min = 1999999999;
  int mai = 0;
  long long sum = 0;
  for (int i = 0; i < N; i ++) {
    int k;
    cin >> k;
    if (k < 0) {
      mai ++;
      k = -k;
    }
    sum += k;
    if (min > k) min = k;
  }
  if (mai % 2) cout << sum - min * 2 << endl;
  else cout << sum << endl;
}
  
  

Measured memory_bytes: 256
#include<iostream>
#include<string>
using namespace std;
int main(){
	int N,del;
	string S;
	cin>>N>>S;
	for(int i=0;i<N-1;i++){
		del=0;
		for(int j=i+1;j<N;j++){
			if(S[i]!=S[j])break;
			else del++;
		}
		if(del>0){
			S.erase(i+1,del);
			N-=del;
			i--;
			
		}
	}
	cout<<S.length();
	return 0;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
using Int = long long;  // clang-format off
#define REP_(i, a_, b_, a, b, ...) for (Int i = (a), lim##i = (b); i < lim##i; i++)
#define REP(i, ...) REP_(i, __VA_ARGS__, __VA_ARGS__, 0, __VA_ARGS__)
#define ALL(v) std::begin(v), std::end(v)
struct SetupIO { SetupIO() { std::cin.tie(nullptr), std::ios::sync_with_stdio(false), std::cout << std::fixed << std::setprecision(13); } } setup_io;
#ifndef dump
#define dump(...)
#endif  // clang-format on

/**
 *    author:  knshnb
 *    created: Sat Aug 29 21:16:07 JST 2020
 **/

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

signed main() {
    std::string s, t;
    std::cin >> s >> t;
    Int ans = 1e9;
    REP(i, s.size() - t.size() + 1) {
        Int cnt = 0;
        REP(j, t.size()) { cnt += s[i + j] != t[j]; }
        chmin(ans, cnt);
    }
    std::cout << ans << std::endl;
}


Measured memory_bytes: 3640
#include<stdio.h>
#include<stdlib.h>
#include<math.h>
#include<string.h>
#include<stdbool.h>
typedef long long ll;
typedef long double ld;
#define rep(i,l,r)for(ll i=(l);i<(r);i++)
#define repp(i,l,r,k)for(ll i=(l);i<(r);i+=(k))
#define rrep(i,l,r)for(ll i=(l);i>=(r);i--)
#define INF (1LL<<60)
#define MOD1 1000000007
#define MOD2 998244353
#define MAX_N (1 << 17)
#define YES printf("Yes\n")
#define NO printf("No\n")
#define PN printf("\n")

void swap(ll *a, ll *b){ll c;c=*b;*b=*a;*a=c;}
ll max2(ll a,ll b){return a>=b?a:b;}
ll min2(ll a,ll b){return a>=b?b:a;}
ll min3(ll a, ll b, ll c){return (a<=b && a<=c) ? a : b<=c ? b : c;}
ll max3(ll a, ll b, ll c){return (a>=b && a>=c) ? a : b>=c ? b : c;}
ll minn(ll n, ll a[n]){ll b=INF;rep(i,0,n) b=min2(b,a[i]);return b;}
ll maxn(ll n, ll a[n]){ll b=-INF;rep(i,0,n) b=max2(b,a[i]);return b;}
ll ABS(ll a){return a>=0?a:(-a);}
ll POW(ll a, ll b){ll c=1;rep(i,0,b) c*=a;return c;}
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return a/gcd(a,b)*b;}
ll mod(ll n){n+= n<0?((-n)/MOD1+1)*MOD1:0; return n%=MOD1;}
int upll(const void*a, const void*b){return*(ll*)a<*(ll*)b?-1:*(ll*)a>*(ll*)b?1:0;}
int downll(const void*a, const void*b){return*(ll*)a<*(ll*)b?1:*(ll*)a>*(ll*)b?-1:0;}
void sortup(ll*a,int n){qsort(a,n,sizeof(ll),upll);}
void sortdown(ll*a,int n){qsort(a,n,sizeof(ll),downll);}

typedef struct{ ll a , b;}fr;
int cmp1( const void *p, const void *q ) { return ((fr*)p) ->a - ((fr*)q)->a;}
int cmp2( const void *p, const void *q ) { return ((fr*)q) ->a - ((fr*)p)->a;}
void strsortup(fr*a,int n){qsort(a,n,sizeof(fr),cmp1);}
void strsortdown(fr*a,int n){qsort(a,n,sizeof(fr),cmp2);}

int main(void){
    // char ;
    ll n,ans=0;
    scanf("%lld",&n);
    ll a[n];
    rep(i,0,n){
        scanf("%lld",&a[i]);
        // if(a[i]!=0)ans++;
    }
    if(a[0]!=0){
        printf("-1\n");
        return 0;
    }
    rep(i,1,n){
        if(a[i]-a[i-1]>1){
            printf("-1\n");
            return 0;
        }
    }
    // ans+=a[n-1];
    rrep(i,n-2,0){
        if(a[i+1]-1!=a[i]){
            ans+=a[i+1];
        }else{
            ans++;
        }
        // printf("%lld ",ans);
    }

    
    printf("%lld\n",ans);
    return 0;
}


Measured memory_bytes: 1792
function Main (N) {
  N = parseInt(N.split("\n")[0], 10);
  var i = N;
  while (true) {
    if (Math.sqrt(N, 2)%1 == 0) {
      console.log(N);
      break;
    }
    N--;
  }
}

Main(require("fs").readFileSync("/dev/stdin", "utf8"));

Measured memory_bytes: 21064
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n)  FOR(i,0,n)
#define req(i,n) for(int i = 1;i <=n;i++)
#define pai 3.14159265358979323846
const int INF = 1001001001;
typedef long long ll;
int A[3][3], N;
bool punched[3][3];
bool ok[3][3];
using Graph = vector<vector<int>>;
vector<vector<int>> field;
vector<bool> seen;

const int MOD = 1000000007;
typedef pair<int,int> P;

//最大公約数
int gcd(int a,int b){
	if (a%b == 0){
		return b;
	}
	else{
		return gcd(b,a%b);
	}

}

//最小公倍数
int lcm(int a,int b){
	return a /gcd(a,b) * b;
}

//素数判定
bool is_prime(long long N) {
    if (N == 1) return false;
    for (long long i = 2; i * i <= N; ++i) {
        if (N % i == 0) return false;
    }
    return true;
}

// 素因数分解
vector<pair<long long, long long> > prime_factorize(long long n) {
    vector<pair<long long, long long> > res;
    for (long long p = 2; p * p <= n; ++p) {
        if (n % p != 0) continue;
        int num = 0;
        while (n % p == 0) { ++num; n /= p; }
        res.push_back(make_pair(p, num));
    }
    if (n != 1) res.push_back(make_pair(n, 1));
    return res;
}

// 10進数から2進数
int binary(int bina){
    int ans = 0;
    for (int i = 0; bina>0 ; i++)
    {
        ans = ans+(bina%2)*pow(10,i);
        bina = bina/2;
    }
    return ans;
}






int main(){
  ll n,k;
  cin >> n >> k;
  ll a[n+1];
  rep (i,n) {
    cin >> a[i];
  }
  ll sum1,sum2;
  rep (i,n-k){
    if (a[i] < a[i+k]) cout << "Yes" << endl;
    else cout << "No" << endl;
  }
}

Measured memory_bytes: 5184
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef set<int> si;
typedef set<ll> sl;
typedef pair<int,int> pii;
#define rep(i,a,b) for(int i=(a); i<(b); ++i)
#define per(i,a,b) for(int i=(b)-1; i>=(a); --i)
#define all(x) (x).begin(),(x).end()
#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define F first
#define S second

const int INF = 1e9;
int n, ma, mb;
int a[45];
int b[45];
int c[45];
int dp[45][405][405];
int solve(int pos, int remA, int remB) {
	if(pos == n) {
		bool flag = ((remA * mb) == (remB * ma));
		flag = flag && !(remA%ma);
		flag = flag && !(remB%mb);
		flag = flag && (remA != 0) && (remB != 0);
		if(flag) {
			return 0;
		} else {
			return INF;
		} 
	}

	int& ret = dp[pos][remA][remB];
	if(ret != -1) return ret;
	ret = INF;

	ret = min(ret, solve(pos+1, remA+a[pos], remB+b[pos]) + c[pos]);
	ret = min(ret, solve(pos+1, remA, remB));
	return ret;
}

int main(void) {
	ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
	//freopen("in.txt", "r", stdin);
	cin >> n >> ma >> mb;
	rep(i,0,n) {
		cin >> a[i] >> b[i] >> c[i];
	}
	memset(dp, -1, sizeof(dp));
	int ret = solve(0,0,0);
	if(ret == INF) {
		cout << -1 << '\n';
	} else {
		cout << ret << '\n';
	}
	return 0;
}


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

typedef pair<int, int> p;

int main() {
    long n,k; cin >> n >> k;
    vector<p> ab(n);
    for(int i = 0; i < n; i ++) {
        int a,b; cin >> a >> b;
        ab[i] = make_pair(a,b);
    }
    sort(ab.begin(), ab.end());
    long ans = 0;
    long count = 0;
    for(int i = 0; i < n; i ++) {
        count += ab[i].second;
        if(count >= k) {
            ans = ab[i].first;
            break;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 1024
package main

import (
	"bufio"
	"fmt"
	"os"
	"sort"
)

var sc = bufio.NewScanner(os.Stdin)

const inf = 1 << 60
const mod int = 1e9 + 7

func ri() (n int) {
	sc.Scan()
	for _, v := range sc.Bytes() {
		n = n*10 + int(v-48)
	}
	return
}
func gcd(a, b int) int {
	for b != 0 {
		a, b = b, a%b
	}
	return a
}
func gcds(a []int) int {
	g := a[0]
	for i := 1; i < len(a); i++ {
		g = gcd(g, a[i])
	}
	return g
}
func main() {
	sc.Split(bufio.ScanWords)
	n, X := ri(), ri()
	x := make([]int, n)
	for i := 0; i < n; i++ {
		x[i] = ri()
	}
	x = append(x, X)
	sort.Ints(x)
	diffs := make([]int, 0, n)
	for i := 0; i <= len(x)-2; i++ {
		diffs = append(diffs, x[i+1]-x[i])
	}
	fmt.Println(gcds(diffs))
}


Measured memory_bytes: 3328
#include <bits/stdc++.h>
using namespace std;
#define PI 3.14159265358979323
#define ll long long int
#define vi vector <int>
#define vl vector <ll>
#define all(v) (v).begin(),(v).end()
#define pb push_back
#define MOD 1000000007
ll power(ll a, ll b) { //a^b
	ll res = 1;
	a = a % MOD;
	while (b > 0) {
		if (b & 1) {res = (res * a) % MOD; b--;}
		a = (a * a) % MOD;
		b >>= 1;
	}
	return res;
}

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

int main() {
#ifndef ONLINE_JUDGE
	// for getting input from input.txt
	freopen("input.txt", "r", stdin);
	// for writing output to output.txt
	freopen("output.txt", "w", stdout);
#endif
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	ll n,k;
	cin>>n>>k;
	vl v(n);
	for(ll i=0;i<n;i++)
		cin>>v[i];
	for(ll i=k;i<n;i++){
		if(v[i]>v[i-k])
			cout<<"Yes\n";
		else
			cout<<"No\n";
	}
}

Measured memory_bytes: 4780
# -*- coding: utf-8 -*-


def digit_plus(num):
    i=num
    sum=0
    while i != 0:
        digit = i % 10
        sum += digit
        i //= 10
    
    return sum

#----------
n = int(input().strip())
#----------
min=n
for a in range(2,n):
    b = n - a
    sum_a_b = digit_plus(a) + digit_plus(b)

    if min > sum_a_b:
        min = sum_a_b

print(min)


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

int main(){
  
  int N;
  cin >>N;
  
  vector<int> A(N),B(N),C(N-1);
  for(int i=0;i<N;i++){
    int x;
    cin >>x;
    A[i] = x;
  }
  for(int i=0;i<N;i++){
    int x;
    cin >>x;
    B[i] = x;
  }
  for(int i=0;i<N-1;i++){
    int x;
    cin >>x;
    C[i] = x;
  }
  
  int ans = 0;
  
  for(int i=0;i<N;i++){
    ans += B[i];
  }
  
  for(int i=0;i<N-1;i++){
    if(A[i+1]-A[i]==1){
      ans += C[A[i]-1];
    }
  }
  
  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(i,0,n)
#define ALL(v) (v).begin(),(v).end()
#define fi first
#define se second
template<typename A, typename B> inline bool chmax(A &a, B b) { if (a<b) { a=b; return 1; } return 0; }
template<typename A, typename B> inline bool chmin(A &a, B b) { if (a>b) { a=b; return 1; } return 0; }
typedef long long ll;
typedef pair<int, int> pii;
const ll INF = 1e9+100;
const ll MOD = 1e9+7;
const bool debug = 0;
//-----------------------------------------------//

int main() {
	int a, b, c, d;
	cin >> a >> b >> c >> d;
	cout << min(a, b) + min(c, d) << endl;
	return 0;
}


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

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

    vector<vector<string>> A(N);
    rep(i, M) {
        int p;
        string s;
        cin >> p >> s;
        p--;
        A[p].push_back(s);
    }

    int ac = 0;
    int wa = 0;
    rep(i, N) {
        int wa_i = 0;
        rep(j, A[i].size()) {
            if (A[i][j] == "WA") wa_i++;
            else if (A[i][j] == "AC") {
                ac++;
                wa += wa_i;
                break;
            }
        }
    }

    cout << ac << ' ' << wa << endl;
    return 0;
}


Measured memory_bytes: 10368
#include<bits/stdc++.h>
#define FAST ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0)
#define dofloat cout<<fixed<<setprecision(8)
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define bitcount __builtin_popcount
#define all(vec) vec.begin(),vec.end()
#define rall(vec) vec.rbegin(),vec.rend()
using namespace std;
typedef long long ll;
typedef long double ld;
typedef vector<long long> vl;
typedef pair<long long,long long> pll;
typedef vector<pair<long long,long long> > vll;
typedef vector<pair<int,int> > vii;
typedef vector<int> vi;
typedef pair<int,int> ii;
const long long MOD=1000000007;
const long long MAX=100005;
const long double PI=3.14159265359;
const long double G=9.807;
const long long INF=1e18;
const long double EPS=1e-6;
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
bool isprime(ll a){
  if(a==2)return 1;
  if(!(a&1))return 0;
  for(ll i=3;i*i<=a;i+=2)
    if(a%i==0)return 0;
  return 1;
}
ll mpow(ll base,ll exponent,ll modulus){
  if(modulus==1)return 0;
  long long result = 1;
  base=base%modulus;
  while(exponent){
    if(exponent%2 == 1)
    result=(result*base)%modulus;
    exponent=exponent>>1;
    base=(base*base)%modulus;
  }
  return result;
}
ll minv(ll a,ll mod){
  ll _gcd=gcd(a,mod);
  assert(_gcd==1);
  return mpow(a,mod-2,mod);
}


/*
ll ncr(ll N,ll K){
  if(N<K)return 0;
  if(K==0)return 1;
  if(N==0)return 0;

  ll den=1;
  for(ll i=1;i<=K;i++)den*=i;
  ll num=1;
  while(K--){
    num*=N;
    if(num%den==0){
      num/=den;
      den=1;
    }
    N--;
  }

  return num;
}
*/
map<vector<int>,int>perms;
int n;
int main(){FAST;
  cin>>n;
  vi a(n+1);
for(int i=1;i<=n;++i){
 a[i] = i; 
}
ll cur = 1;
do{
  perms[a]=cur++;
}while(next_permutation(a.begin()+1,a.begin()+n+1));
vector<int> A(n+1),B(n+1);
for(int i=1;i<=n;++i){
  cin>>A[i];
}
for(int i=1;i<=n;++i){
  cin>>B[i];
}
cout<<abs(perms[A] - perms[B]);
return 0;
}

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

#define PI 3.141592653
#define rep(i,a,n) for(int i=a;i<(int)n;++i)
#define SZ(x) ((int)(x).size())	//size() unsigned -> int
#define descSort(a) sort(a.begin(),a.end(),std::greater<int>())
using namespace std;
typedef long long ll;
const ll INF = 1e9 + 7;
ll gcd(ll x,ll y){
    if(x%y==0)return y;
    return gcd(y,x%y);
}

int main(void){
    ll n;
    cin>>n;
    vector<ll> a(n);
    map<ll,ll> mp;
    rep(i,0,n){
        cin>>a[i];
        mp[a[i]]++;
    }
    ll sum=0;
    for(auto i:mp){
        sum+=i.second*(i.second-1)/2;
    }
    rep(i,0,n){
        cout<<sum-(mp[a[i]]-1)<<endl;
    }
    return 0;
}

Measured memory_bytes: 12032
#!/usr/bin/env python3
import sys

MOD = 1000000007  # type: int


def solve(N: int, K: int):
    ct = 0
    for k in range(K, N+2):
        ct += int((N + N - k + 1) * k / 2 - (k - 1) * k / 2 + 1) % MOD

    print(ct % MOD)
    return


# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    K = int(next(tokens))  # type: int
    solve(N, K)

if __name__ == '__main__':
    main()

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

#define ll long long
#define ull unsigned long long
#define PI 6.28318530717958623200

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	int n;
	cin >> n;
	cout << fixed << setprecision(3);
	cout << PI*n;
}

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

typedef long long ll;
typedef pair<ll,ll> P;

const double PI = 3.14159265358979323846;
const double EPS = 1e-12;
const ll INF = 1LL<<29;
const ll mod = 1e9+7;

#define rep(i, a, b) for(ll (i) = (a); (i) < (b);++i)

int main()
{
  ll A, B, C, X, Y;
  cin >> A >> B >> C >> X >> Y;

  ll ans = 0;
  if (A + B > C * 2){
    ans += min(X, Y) * 2 * C;
    if (X > Y){
      ans += (X - Y) * A;
    }else{
      ans += (Y - X) * B;
    }
  }else{
    cout << A * X + B * Y << endl;
    return 0;
  }
  if (ans > C * 2 * max(X, Y))
  {
    cout << C * 2 * max(X, Y) << endl;
    return 0;
  }
  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++)
const int MOD = 1e9+7;
const long long INF = 1LL << 60;
const int inf = 1e9;
typedef long long ll;

ll hight[100050];
int main() {
    int N, K;
    cin >> N >> K;
    rep(i,N) cin >> hight[i];
    sort(hight, hight+N);
    ll ans = INF;
    for(int i=0;i<N-K+1;i++){
        ans = min(ans, hight[i+K-1]-hight[i]);
    }
    cout << ans << endl;
    /* 
    int loop;
    if(N/2-K < 0) {
        loop = 0;
    } else {
        loop = N/2-K;
    }
    int finish;
    if(N/2+K >= N) {
        finish = N;
    } else {
        finish = N/2+K;
    }
    printf("loop=%d,finsh=%d\n",loop,finish);
    for(int i=loop;i<=loop+K-1;i++){
        for(int j=i+1;j<=loop+K-1;j++){
            ans = min(abs(hight[i]-hight[j]),ans);
        }
        break;
    }
    for(int i=N/2+1;i<=finish;i++){
        ans = min(abs(hight[N/2]-hight[i]), ans);
    }
    //ans = min(abs(hight[loop]-hight[loop+K-1]),ans);
    //printf("hight[%d]=%lld,hight[%d]=%lld\n",loop,hight[loop],loop+K-1,hight[loop+K-1]);
    //ans = min(abs(hight[N/2]-hight[finish]), ans);
    cout<<ans<<endl;
    */
    /* 
    for(ll i=loop;i<finish;i++) {
        ll cnt=i;
        for(ll j=0;j<K;j++){
            cnt++;
            ans = min(abs(hight[i]-hight[cnt]), ans);
            if(j==0)printf("hight[%lld]=%lld\n",i,hight[i]);
            printf("hight[%lld]=%lld\n",cnt,hight[cnt]);
            cout<<"ans="<<ans<<endl;
        }
    }
    cout << ans << endl;
    */
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
#define rep(i,n) for(int i = 0;i<n;i++)
using namespace std;
typedef pair<int,int> P;
typedef long long ll;
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;}

int main() {
    int x,n;
    cin >> x >> n; cin.ignore();
    vector<int>p(n);
    if(n==0) {
        string s;
        getline(cin,s);
        cout << x << endl;
        return 0;
    }
    rep(i,n) cin >> p[i];
    int ans = 0;
    for(int i = 0;i<=300;i++) {
        bool ok = true;
        for(int j = 0;j<n;j++) {
            if(x+i == p[j]) {
                ok = false;
            }
        }
        if(ok) {
            ans = x+i;
            break;
        }
    }
    int ans2 = 0;
    for(int i = 0;i<=300;i++) {
        bool ok = true;
        for(int j = 0;j<n;j++) {
            if(x-i == p[j]) {
                ok = false;
            }
        }
        if(ok) {
            ans2 = x-i;
            break;
        }
    }
    if(abs(ans-x) < abs(ans2-x)) cout << ans << endl;
    else if(abs(ans-x) < abs(ans2-x)) cout << ans2 << endl;
    else cout << min(ans,ans2) << endl;
}

Measured memory_bytes: 3628
#include <stdio.h>
int main()
{
  char a[4], b[4];
  int i, j;
  j = 0;
  scanf("%s%s", a, b);
  
  for (i = 0; i<=2; i++) {
    if (a[i] == b[2-i]) {
      j++;
    }
  }
  
if (j == 3) {
    printf("YES");
  } else {
    printf("NO");
  }
  

  return 0;
}

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

typedef long long ll;
constexpr ll MOD = ll(1e9+7);

int n, m;
double dp[17][16][1<<16];  // dp[i][j][S] i番目より後の敵を倒して、現在ねこjを派遣しており、やられたねこの集合がSの最大確率
double dp2[17][1<<16];  // dp2[i][S] i番目以降の敵を倒して、やられたねこの集合がSである最大確率
double w[17][17];

void chmax(double &a, double b){
    a = max(a, b);
}

int main(){
    cin >> m >> n;
    for(int i=0;i<m;i++){
        for(int j=0;j<n;j++){
            cin >> w[i][j];
        }
    }
    for(int i=0;i<m;i++){
        for(int S=0;S<1<<m;S++){
            dp[n][i][S] = 1.0;
        }
    }
    for(int i=n-1;i>=0;i--){
        for(int S=(1<<m)-2;S>=0;S--){
            for(int j=0;j<m;j++){
                if((S>>j)&1) continue;
                dp[i][j][S] = dp[i+1][j][S] * w[j][i] + dp2[i][S|(1<<j)] * (1-w[j][i]);
                chmax(dp2[i][S], dp[i][j][S]);
            }
        }
    }

    double ans = dp2[0][0];
    printf("%.12lf\n", ans);
    return 0;
}


Measured memory_bytes: 130188
function main(input) {
    var N = input[0]-0;
    var list = input[1].split("");
    var lmap = [];
    var rmap = [];
    for(var i=0;i<N;i++){
        lmap[i] = lmap[i-1]||0;
        rmap[N-i-1] = rmap[N-i]||0;
        if(list[i] == "W"){
            lmap[i]++;
        }
        if(list[N-i-1] == "E"){
            rmap[N-i-1]++;
        }
    }
    var ans = N;
    for(var i=0;i<N;i++){
        ans = Math.min(ans, lmap[i]+rmap[i]-1);
    }
    console.log(ans);
}

main(require('fs').readFileSync('/dev/stdin', 'utf8').trim().split("\n"));


Measured memory_bytes: 21624
import sys

sys.setrecursionlimit(10 ** 6)
int1 = lambda x: int(x) - 1
p2D = lambda x: print(*x, sep="\n")
def MI(): return map(int, sys.stdin.readline().split())
def LI(): return list(map(int, sys.stdin.readline().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]

def main():
    md = 10 ** 9 + 7
    n, h, d = MI()
    sum_fact = 0
    n_fact = 1
    for x in range(1, n + 1):
        n_fact *= x
        sum_fact += n_fact
        n_fact %= md
        sum_fact %= md
    if h==1:
        print(n_fact)
        exit()
    dp = [0] * (h + 1)
    dp[0] = dp[1] = n_fact
    s = 0
    for i in range(2, h + 1):
        if i <= d:
            s += dp[i - 1]
            dp[i] = s * sum_fact + dp[0]
        elif i == d + 1:
            s += dp[i - 1]
            dp[i] = s * sum_fact
        else:
            s += dp[i - 1] - dp[i - 1 - d]
            dp[i] = s * sum_fact
        s %= md
        dp[i] %= md
    print(dp[-1])

main()


Measured memory_bytes: 42584
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <cfloat>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <fstream>
#include <functional>
#include <bitset>
#define chmin(a, b) ((a)=min((a), (b)))
#define chmax(a, b) ((a)=max((a), (b)))
#define fs first
#define sc second
#define eb emplace_back
using namespace std;

typedef long long ll;
typedef pair<int, int> P;
typedef tuple<int, int, int> T;

const ll MOD=1e9+7;
const ll INF=1e18;
const double pi=acos(-1);
const double eps=1e-10;

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

int main(){
    while(1){
        int n, m, s, g1, g2; cin>>n>>m>>s>>g1>>g2;
        s--, g1--, g2--;
        if(n == 0) return 0;

        vector<vector<int>> dist(n, vector<int>(n, 1e8));
        for(int i=0; i<n; i++) dist[i][i] = 0;
        for(int i=0; i<m; i++){
            int b1, b2, c; cin>>b1>>b2>>c;
            b1--, b2--;
            dist[b1][b2] = c;
        }

        for(int k=0; k<n; k++){
            for(int i=0; i<n; i++){
                for(int j=0; j<n; j++){
                    dist[i][j] = min(dist[i][j], dist[i][k] + dist[k][j]);
                }
            }
        }

        int ans = 1e8;
        for(int i=0; i<n; i++){
            ans = min(ans, dist[s][i] + dist[i][g1] + dist[i][g2]);
        }

        cout << ans << endl;
    }
}


Measured memory_bytes: 3156
character(100),allocatable,dimension(:)::A,B
integer N,M,check
read*,N,M
allocate(A(N))
allocate(B(M))
read*,A
read*,B
do i=1,N-M+1
 do j=1,N-M+1
 	if(A(i)(j:j+M-1)==trim(B(1)))then
     check=0
     do k=1,M
      if(A(i+k-1)(j:j+M-1)/=trim(B(k)))check=1
     end do
     if(check==0)then
      print"(A)","Yes"
      stop
     endif
    endif
 end do
end do
print"(A)","No"
end

Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
#define ll long long
const ll MOD=1000000007;
const long double PI=3.14159265358979;

ll H[1000000];
ll dp[1000000];

int main() {
  ll N,K;
  cin>>N>>K;
  for(int i=0;i<N;i++){
    cin>>H[i];
  }
  dp[0]=0;
  dp[1]=abs(H[0]-H[1]);
  for(int i=2;i<N;i++){
    ll cos=MOD;
    for(int j=1;j<=K;j++){
      if(j>i){
        continue;
      }
      cos=min(cos,dp[i-j]+abs(H[i]-H[i-j]));
    }
    dp[i]=cos;
  }
  cout<<dp[N-1];
}

Measured memory_bytes: 5120
#include <iostream>
#include <vector>
using namespace std;
typedef long long int mint_type;
const mint_type MOD = 1000000007;
const mint_type MAX = 500000;
class mint{
    public:
        static mint_type fac[MAX];
        static mint_type finv[MAX];
        static inline mint_type mod(mint_type a, mint_type mod = MOD){ return (a % mod + mod) % mod;}
        static mint_type mpow(mint_type a, mint_type n, mint_type mod = MOD);
        static mint_type extGCD(mint_type a, mint_type b, mint_type& x, mint_type& y);
        static mint_type minv(mint_type a, mint_type mod = MOD);
        static void mcinit(mint_type max = MAX, mint_type mod = MOD);
        static mint_type mchoose(mint_type n, mint_type r, mint_type mod = MOD);
};
mint_type mint::fac[MAX];
mint_type mint::finv[MAX];

mint_type mint::mpow(mint_type a, mint_type n, mint_type mod){
    mint_type result = 1;
    while(n > 0){
        if(n & 1){
            result = result * a % mod;
        }
        a = a * a % mod;
        n >>= 1;
    }
    
    return result;
}

mint_type mint::extGCD(mint_type a, mint_type b, mint_type& x, mint_type& y){
    if(a % b == 0){
        x = 0;
        y = 1;
        return b;
    }
    
    mint_type d = extGCD(b, a % b, x, y);
    mint_type tmp = -y * (a / b) + x;//
    x = y;
    y = tmp;
    return d;
}

mint_type mint::minv(mint_type a, mint_type mod){
    mint_type x, y;
    mint::extGCD(a, mod, x, y);
    //while(x < 0) x += mod;
    return mint::mod(x);
}

void mint::mcinit(mint_type max, mint_type mod){
    mint::fac[0] = 1;
    for(mint_type i = 1; i < max; i++){
        mint::fac[i] = mint::fac[i-1] * i % mod;
    }
    mint::finv[max-1] = mint::minv(fac[max-1]);
    for(mint_type i = max-1; i > 0; i--){
        mint::finv[i-1] = mint::mod(mint::finv[i] * i);
    }
}

mint_type mint::mchoose(mint_type n, mint_type r, mint_type mod){
    return mint::mod(mint::fac[n] * mint::mod(mint::finv[r] * mint::finv[n-r]));
}

int main(){
    int n, k;
    cin >> n >> k;

    mint::mcinit();

    for(int i = 1; i <= k; i++){
        long long int ans = 0;
        if(i-1 <= n-k){
            ans = mint::mchoose(k-1, i-1);
            ans *= mint::mchoose(n-k+1, i);
            ans %= MOD;
        }
        cout << ans << endl;
    }
    return 0;
}

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

int main(){
	int A,B,Soma,Soma2,Soma3;
	scanf("%d %d",&A,&B);
	
	Soma = A+B; 
	Soma2 = A+(A-1);
	Soma3 = B+(B-1); 
	
	if(Soma >= Soma2 && Soma >=  Soma3){
		printf("%d",Soma);
	}
	else{
		if(Soma2 >= Soma3){
			printf("%d",Soma2);
		}
		else{
			printf("%d",Soma3);
		}
	}
	return 0;
}

Measured memory_bytes: 128
#include <stdio.h>

int main(void)
{
	int n,a,b,c,d,x,y,e=0,f=0,i=0,j=0;
	scanf("%d %d %d %d %d",&n,&a,&b,&c,&d);
	x=b;
	y=d;
	while(n>e){
		e+=a;
		i++;
	}
	while(n>f){
		f+=c;
		j++;
	}
	x*=i;
	y*=j;
	if(x>y){
		printf("%d\n",y);
	}
	else{
		printf("%d\n",x);
	}
	return 0;
}


Measured memory_bytes: 2120
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define pb push_back
#define fr(i,n) for(int i=0;i<n;i++)
#define ifr(i,n) for(int i=n-1;i>=0;i--)


int main() {
  int n;
  cin >>n;
  int a[n];
  fr(i,n){
    cin >>a[i];
  }
  long memo = 1000000000;
  long sum=0;
  int fu = 0;
  int zero = 0;
  fr(i,n){
   sum += abs(a[i]);
   if(abs(a[i])<memo){
     memo = abs(a[i]);
   }
   if(a[i]<0)fu +=1;
   if(a[i] == 0)zero +=1;
  }
  if(fu%2 == 1){
    sum = sum-2*abs(memo);
  }
  cout << sum << endl;
}

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

// clang-format off
template <typename T> T gcd(T a, T b) { return b == 0 ? a : gcd(b, a % b); }
template <typename T> T lcm(T a, T b) { return a * b / gcd(a, b); }
template <typename T> T clamp(T val, T min, T max) { return val < min ? min : (max < val ? max : val); }
template <typename T> size_t max_index(T begin, T end) { return distance(begin, max_element(begin, end)); }
template <typename T> size_t min_index(T begin, T end) { return distance(begin, min_element(begin, end)); }
// clang-format on

#define int long long
#define YES "Yes"
#define NO  "No"

using namespace std;

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

  bool flag = true;
  int num = 0;

  int a, b, c, d; cin >> a >> b >> c >> d;

  int l = a + b;
  int r = c + d;

  if (l > r) cout << "Left";
  else if (l < r) cout << "Right";
  else cout << "Balanced";
  cout << endl;


  // cout << num << endl;
  // cout << (flag ? YES : NO) << endl;
  
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll INF = 1e18;
const ll MOD = 1e9 + 7;
#define all(v) v.begin(), v.end()
#define repi(i, n, init) for (ll i = init; i < (n); i++)
#define repd(i, n, init) for (ll i = (n); i >= init; i--)
#define repm(i, m) for (auto i = m.begin(); i != m.end(); i++)
#define repb(bit, n, init) for (ll bit = init; bit < (1 << n); ++bit)

int main()
{
    ll a, b;
    string op;
    while (cin >> a >> op >> b)
    {
        if (op == "+")
        {
            cout << a + b << endl;
        }
        else if (op == "-")
        {
            cout << a - b << endl;
        }
        else if (op == "*")
        {
            cout << a * b << endl;
        }
        else if (op == "/")
        {
            cout << a / b << endl;
        }
        else if (op == "?")
        {
            break;
        }
    }
    return 0;
}


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

int main() {
  ll A = 0,B = 0;
  cin >> A >> B;
  ll n = 100;
  rep(i,n){
    if(A * i - i + 1 >= B ){
      cout << i;
      return 0;
    }
  }
}

Measured memory_bytes: 256
N,M = map(int,input().split())
MOD = 10**9+7
ans = 1
if abs(N-M) > 1:
    ans = 0
else:
    for i in range(1,N+1):
        ans *= i
        ans %= MOD
    for i in range(1,M+1):
        ans *= i
        ans %= MOD
    if N == M:
        ans *= 2
        ans %= MOD

print(ans)


Measured memory_bytes: 38768
#include <bits/stdc++.h>
//#include <boost/array.hpp>
//#include <boost/range/numeric.hpp>
//#include <boost/range/algorithm.hpp>
//#include <boost/multiprecision/cpp_int.hpp>

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

using namespace std;
//using namespace boost::multiprecision;

constexpr long long INF = LLONG_MAX;
constexpr long long MOD = 1000000007;
constexpr long double PI = M_PI;

#define FOR(i,r,n) for(ll i = (ll)(r); i < (ll)(n); ++i)
#define RFOR(i,n,r) for(ll i = (ll)(n-1); i >= r; --i)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,n,0)
#define ALL(x) x.begin(),x.end()
#define CALL(x) x.cbegin(),x.cend()
#define RALL(x) x.rbegin(),x.rend()
#define CRALL(x) x.crbegin(),x.crend()

#define cout cout << fixed << setprecision(12)
#define dbglf cerr << '\n'

#define ACCM(arr) accumulate(ALL(arr),0LL)
#define Yes(ex) cout << ((ex) ? "Yes" : "No") << endl
#define YES(ex) cout << ((ex) ? "YES" : "NO") << endl

using ll = long long int;
using ull = unsigned long long int;
using ld = long double;
using vi = vector<ll>;
using vvi = vector<vi>;
using vp = vector<pair<ll, ll>>;
using vs = vector<string>;
using vc = vector<char>;
using lst = list<ll>;
using pq = priority_queue<ll>;

template < typename T >
inline void veccin(vector<T>& v) {
    for (auto && e : v) { cin >> e; }
}

template < typename T >
inline void dbg(T a) { cerr << a << ' '; }

ll n, m, k;
ll ans = 0, sum = 0, cnt = 0;
//ld d;
string s/*1, s2, s3*/;
char c/*1, c2, c3*/;
bool flag = false;

/*--------------------template--------------------*/

int main() {
    cin >> n;
	REP(i,n){
    	if((i+1)%3!=0&&(i+1)%5!=0)
          ans+=(i+1);
    }
    cout << ans << endl;
}


Measured memory_bytes: 3616
using namespace std;
#include<bits/stdc++.h>
#define BEGIN ios_base::sync_with_stdio(0);cin.tie(0);
#define END return EXIT_SUCCESS;
#define FOR(I,A,B) for((I)=(A);(I)<(B);(I)++)
#define REP(I,N) FOR((I),0,(N))
#define UP(I,A,B) for((I)=(A);(I)<=(B);(I)++)
#define DW(I,A,B) for((I)=(A);(I)>=(B);(I)--)
#define IN(P) cin>>(P)
#define IN2(P1,P2) cin>>(P1)>>(P2)
#define IN3(P1,P2,P3) cin>>(P1)>>(P2)>>(P3)
#define INS(I,N,V) REP((I),(N)) cin>>(V[I])
#define INS2(I,N,V1,V2) REP((I),(N)) cin>>(V1[I])>>(V2[I]);
#define INS3(I,N,V1,V2,V3) REP((I),(N)) cin>>(V1[I])>>(V2[I])>>(V3[I]);
#define OUT(P) cout<<(P)<<endl
#define OUT2(P1,P2) cout<<(P1)<<" "<<(P2)<<endl
#define OUT3(P1,P2,P3) cout<<(P1)<<" "<<(P2)<<" "<<(P3)<<endl
#define OUTS(I,N,V) REP((I),(N)) cout<<(V[i])<<endl
#define ALL(C) (C).begin(),(C).end()
#define RALL(C) (C).rbegin(),(C).rend()
#define mp make_pair
#define pb push_back
#define lb lower_bound
#define ub upper_bound
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;}

int A,B,C;
inline void solve(){
  IN3(A,B,C);
  OUT(A+B>=C?"Yes":"No");
}

int main(int argc,char**argv){
  BEGIN
  solve();
  END
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define lld long double
#define vc vector<ll>
typedef pair<ll,ll>pairs;
int main() {
	// your code goes here
	std::ios::sync_with_stdio(false);
	ll t,n,i,j,k,l,c,f;
	cin>>n;
	i=1;
	vc a(n+1);
	c=0;
	map<ll,ll>m;
	stack<ll>temp;
	while(i<=n)
	{
	    cin>>a[i];
	    c+=a[i];
	    if(m.find(a[i])==m.end())
	    m.insert({a[i],1});
	    else
	    m[a[i]]++;
	    i++;
	    //temp.pop();
	}
	ll q,ind;
	cin>>q;
	while(q--)
	{
	    cin>>j>>k;
	    /*l=m[j].size();
	    while(l>0){
	        c-=j;
	        c+=k;
	        ind=m[j].top();
	        temp.push(ind);
	        if(m.find(k)==m.end())
	        m.insert({k,temp});
	        else
	        m[k].push(ind);
	    m[j].pop();
	    temp.pop();
	    l--;
	    }*/
	    ind=m[j];
	    c-=j*m[j];
	    m.erase(j);
	    c+=ind*k;
	    if(m.find(k)==m.end())
	    m.insert({k,ind});
	    else
	    m[k]+=ind;
	    //a[j]=k;
	    cout<<c<<"\n";
	}
	return 0;
}


Measured memory_bytes: 7940
/*~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=
*$* WRITER:kakitamasziru/OxOmisosiru *$*
~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=*/
#ifdef LOCAL_JUDGE
#define _GLIBCXX_DEBUG //FOR THE DEBUG! COMMENT OUT THIS WHEN SUBMITTING!
#endif
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <iomanip>
#include <limits>//setprecision
//#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <math.h>//pow,,,
#include <cmath>//abs,,,
#include <bitset> // bitset
//It is so troublesome that I include bits/stdc++.h !
using namespace std;

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; }
const long long INF = 100100100100;
const long long MOD = 1000000007;
typedef pair<long long,long long> P;
//NのM乗を求める(繰り返し二乗法)
long long mod_pow(long long N, long long M) {
    if (M == 0) return 1;
    long long res = mod_pow((N * N) % MOD, M / 2);
    //最下位ビット(*N)が1の時は単独でNをかける
    if (M & 1) res = (res * N) % MOD;

    return res %= MOD;
}
long long nCr(long long n, long long r) {
    long long A = 1, B = 1;
    //Aが分子Bが1/r!
    for (long long i = n - r + 1; i <= n; i++) {
        A = A * i % MOD;
    }
    for (long long i = 1; i <= r; i++) {
        B = B * i % MOD;
    }
    B = mod_pow(B, MOD - 2);
    B %= MOD;
    //Bは割るのではなく掛ける
    return (A * B) % MOD;
}

long long gcd(long long a, long long b) {
    if (b == 0) return a;
    else return gcd(b, a % b);
}
 
long long lcm(long long a, long long b) {
    return a * b / gcd(a, b);
}

//long long A,B;
bool ok(long long key,long long index){
    if(index > key) return true;
    else if(index <= key) return false;
}
long long binary_search(long long key,long long size){
    //left,right,midはいずれもindex
    long long left = -1,right = size;
    while(right - left > 1){
        long long mid = left + (right-left)/2;
        long long hantei = ok(key,mid);
        if(hantei) right = mid;
        else left = mid;
    }
    if(left == -1)return 0;
    return left;
}

int main() {
    int N,K;cin >> N >> K;
    vector<bool> snuke(N,false);
    for(int i = 0;i<K;i++){
        int A;cin >> A;
        for(int j = 0;j<A;j++){
            int a;cin >> a;
            a--;
            snuke.at(a) = true;
        }
    }

    int ans = 0;
    for(int i = 0;i<N;i++){
        if(!snuke.at(i)) ans++;
    }

    cout << ans << endl;

    // PLEASE GIVE ME THE "ACCEPTED" !
}


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

int main() {

    int x = 0;
    rep(i, 3){
        char c;
        cin >> c;
        if(c == 'o'){
            x++;
        }
    }
    cout << 700 + 100 * x << endl;

}


Measured memory_bytes: 256
// inputに入力データ全体が入る
function Main(input) {
    // 1行目がinput[0], 2行目がinput[1], …に入る
    input = input.split("\n");
    tmp0 = input[0].split(" ");
    N = Number(tmp0[0])
    A = Number(tmp0[1])
    B = Number(tmp0[2])

    console.log(Math.min(A*N,B))
}
  //*この行以降は編集しないでください（標準入出力から一度に読み込み、Mainを呼び出します）
Main(require("fs").readFileSync("/dev/stdin", "utf8"));
// Main("4 2 9\n");

Measured memory_bytes: 22076
program main
implicit None
integer::a,b,c,d

read *,a,b,c

d = a*10+b+c
if (d < b*10 + a + c)then
	d = b*10 + a + c
endif

if (d < c*10 + a + b)then
	d = c*10 + a + b
endif

print 101,d

101 format(i0)
end program main

Measured memory_bytes: 640