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

using namespace std;

double value[45];
int size[45];

double get_value(string &pile){
    bool b_can_move = 0, w_can_move = 0;
    double b_max, w_min;
    double last_value = 0;
    for(int i=0;i<pile.length();i++){
        double value;
        if(pile[i]=='B'){
            if(b_can_move){
                b_max = max(b_max,last_value);
            }
            else{
                b_max = last_value;
            }
            b_can_move = 1;
            if(w_can_move){
                value = (b_max + w_min) / 2;
            }
            else{
                value = b_max + 1;
            }
        }
        if(pile[i]=='W'){
            if(w_can_move){
                w_min = min(w_min,last_value);
            }
            else{
                w_min = last_value;
            }
            w_can_move = 1;
            if(b_can_move){
                value = (b_max + w_min) / 2;
            }
            else{
                value = w_min - 1;
            }
        }
        last_value = value;
    }
    return last_value;
}

//#define map unordered_map //not neccessary

void enumerate(int st, int ed,map<double,int> &table ,double value_sum = 0, int size_sum = 0){
    if(st==ed){
        if(table.count(value_sum)){
            table[value_sum] = max(table[value_sum], size_sum);
        }
        else{
            table[value_sum] = size_sum;
        }
    }
    else{
        enumerate(st+1, ed, table, value_sum, size_sum);
        enumerate(st+1, ed, table, value_sum + value[st], size_sum + size[st]);
    }
}

int find_zero_game(int st,int ed,map<double,int> &table ,double value_sum = 0, int size_sum = 0){
    if(st==ed){
        if(table.count(-value_sum)){
            return table[-value_sum] + size_sum;
        }
        else return 0;//don't use any box;
    }
    else{
        int get1 = find_zero_game(st+1, ed, table, value_sum, size_sum);
        int get2 = find_zero_game(st+1, ed, table, value_sum + value[st], size_sum + size[st]);
        return max(get1, get2);
    }
}

map<double,int> table, table2;

int main()
{
    int n;
    scanf("%d",&n);
    for(int i=0;i<n;i++){
        string pile;
        cin>>pile;
        size[i] = pile.length();
        value[i] = get_value(pile);
    }
    if(n<=20){
        enumerate(0,n,table);
        printf("%d\n",table[0]);
    }
    else{
        enumerate(0,20,table);
        printf("%d\n",find_zero_game(20,n,table));
    }

    return 0;
}

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

int main() {
    int A, B;
    cin >> A >> B;
    if(B%A) cout << B-A << endl;
    else cout << A+B << endl;

    return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <vector>
#include <queue>
#include <map>
#include <iterator>
#include <cmath>
#include <set>
#include <deque> 
#include <string>


using namespace std;

int n;
std::string s[200010];

bool compareS(const char &a, const char &b)
{
	return a < b;
}

bool compareSS(const string &a, const string &b)
{
	return a < b;
}


int main()
{
	scanf("%d\n", &n);

	char temp[15];	
	for (int i = 0 ; i < n ; i++)
	{
		scanf("%s\n", temp);
		sort(temp, temp + 10, compareS);
		s[i] = temp;
	}
	
	sort(s, s + n, compareSS);

	string lastS = "";
	long long count;
	count = 0;
	
	int p = 0;
	while (p < n)
	{
		int l = p;
		int h = l;
		while ((h < n) && (s[l] == s[h]))
			h++;
			
		long long sectionCount = (h - l);
		count = count + sectionCount * (sectionCount - 1) / 2;
		
		p = h;
	}
	
	printf("%lld\n", count);

			
	return 0;
}


Measured memory_bytes: 6528
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Linq.Expressions;
using System.Runtime.Remoting.Messaging;
using System.Security.Principal;
using System.Text;
class Simple {
    private int N;
    private int[] s;
    void Solve() {
        //input
        N = io.Int;
        s = new int[N];
        for(int i = 0; i < N; ++i) s[i] = io.Int;
        //cal
        var dp = new bool[100 * 100 + 5]; //dp[i]:i点な得点がありえる
        dp[0] = true;
        for(int i = 0; i < N; ++i) 
            for(int j = dp.Length - 1; j >= 0; j--) 
                if(dp[j]) dp[j + s[i]] = true;
        var ans = 0;
        for(int i = dp.Length - 1; i >= 0; i--)
            if(dp[i] && i % 10 != 0) { 
                ans = i;
                break;
            }
        //ret
        Console.WriteLine(ans);
    }
    SimpleIO io = new SimpleIO();
    public static void Main(string[] args) => new Simple().Stream();
    void Stream() {
        Solve();
        io.writeFlush();
    }
}
class SimpleIO {
    string[] nextBuffer;
    int BufferCnt;
    char[] cs = new char[] {' '};
    StreamWriter sw = new StreamWriter(Console.OpenStandardOutput()) {AutoFlush = false};
    public SimpleIO() {
        nextBuffer = new string[0];
        BufferCnt = 0;
        Console.SetOut(sw);
    }
    public string Next() {
        if(BufferCnt < nextBuffer.Length) return nextBuffer[BufferCnt++];
        string st = Console.ReadLine();
        while(st == "") st = Console.ReadLine();
        nextBuffer = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
        BufferCnt = 0;
        return nextBuffer[BufferCnt++];
    }
    public string String => Next();
    public char Char => char.Parse(String);
    public int Int => int.Parse(String);
    public long Long => long.Parse(String);
    public double Double => double.Parse(String);
    public void writeFlush() { Console.Out.Flush(); }
}

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

using namespace std;

int parent_id(vector<int> &vec, int c) {
  if (vec[c] == c)
    return c;
  return vec[c] = parent_id(vec, vec[c]);
}

int main() {
  int n, m;
  cin >> n >> m;
  vector<int> vec(n+1);
  for (int i = 0; i <= n; ++i)
    vec[i] = i;

  for (int i = 0; i < m; ++i) {
    int a, b;
    cin >> a >> b;
    int parent_a = parent_id(vec, a);
    int parent_b = parent_id(vec, b);
    if (parent_a == parent_b)
      continue;
    int vmax = max(parent_a, parent_b);
    int vmin = min(parent_a, parent_b);
    vec[vmax] = vmin;
  }

  vector<int> cntvec(n+1, 0);
  for (int i = 1; i <= n; ++i) {
    int tmp = parent_id(vec, i);
    ++cntvec[tmp];
  }

  cout << *max_element(cntvec.begin(), cntvec.end()) << endl;
}


Measured memory_bytes: 4764
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
int main()
{
	int n; cin>>n;
	ll a[n],  odd =0, even = 0;
	for(int i = 0 ; i < n ; i++)
	{
		cin>>a[i];
		if(i&1)
			odd+=a[i];
		else
			even+=a[i];
	}
	ll x[n];
	x[0] = (even-odd)/2;
	for(int i = 1; i < n ;i++)
		x[i]= a[i-1]-x[i-1];
	for(int i = 0 ; i < n ; i++)
		cout<<2*x[i]<<" ";
	cout<<endl;
	
	return 0;
}

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

#define ms(s, n) memset(s, n, sizeof(s))
#define FOR(i, a, b) for (int i = (a); i <= (b); i++)
#define FORd(i, a, b) for (int i = (a) ; i >= (b); i--)
#define FORall(it, a) for (__typeof((a).begin()) it = (a).begin(); it != (a).end(); it++)
#define sz(a) int((a).size())
#define present(t, x) (t.find(x) != t.end())
#define all(a) (a).begin(), (a).end()
#define uni(a) (a).erase(unique(all(a)), (a).end())
#define pb push_back
#define pf push_front
#define mp make_pair
#define fi first
#define se second
#define sp system("pause")
#define prec(n) fixed<<setprecision(n)
#define bit(n, i) (((n) >> (i)) & 1)
#define bitcount(n) __builtin_popcountll(n)
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<int, int> pi;
typedef vector<int> vi;
typedef vector<pi> vii;
const int MOD = (int) 1e9 + 7;
const int INF = (int) 1e9;
const ll LINF = (ll) 1e18;
const ld PI = acos((ld) -1);
const ld EPS = 1e-9;
const int N = (int) 1e5 + 10;
void TimeExecution() {
    cout << "\n\n===>> Time Execution: " << clock() / (double)1000 << " sec(s).";
}
ll sqr(ll a)
{
    return ((a % MOD) * (a % MOD)) % MOD;
}
ll msub(ll a, ll b)
{
    return ((a - b) % MOD + MOD) % MOD;
}
ll madd(ll a, ll b)
{
    return (a + b) % MOD;
}
ll mmul(ll a, ll b)
{
    return ((a % MOD) * (b % MOD)) % MOD;
}
int t;
int main()
{
    ios_base::sync_with_stdio(0); cin.tie(0);
    /*
    #ifndef ONLINE_JUDGE
        freopen("in.txt", "r", stdin);
        freopen("out.txt", "w", stdout);
    #endif
    */
    ll a, b, n;
    cin >> a >> b >> n;
    ll res;
    if(n >= b)
    {
        res = b - 1;
    }
    else res = n;
    cout << ((a * res) / b - a * (res / b));
    /*
    FOR(i, 1, n)
    {
        cout << ((a * i) / b - a * (i / b)) << endl;
    }
    */
    return 0;
}


Measured memory_bytes: 3636
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pll = pair<ll, ll>;
using vl = vector<ll>;

/* short */
#define pb push_back
#define mp make_pair
#define Fi first
#define Se second
#define ALL(v) begin(v), end(v)
#define RALL(v) rbegin(v), rend(v)

/* REPmacro */
#define FOR(i, a, b) for(int i = (a); i < (b); i++)
#define FORR(i, a, b) for(int i = (a); i >= (b); i--)
#define REP(i, n) for(int i = 0; i < (n); i++)
#define FOREACH(x, a) for(auto x : a)

/* exchange */
#define CHMIN(a, b) (a) = min((ll)(a), (ll)(b))
#define CHMAX(a, b) (a) = max((ll)(a), (ll)(b))

/* function */
#define IN(x) cin >> x
#define DEBUG(x) cerr << (x) << " "
#define LN() cerr << "\n"
#define PRINT(x) cout << (x) << endl
#define BR cout << endl

/* const */
const int ARRAY = 100005;
const int INF = 1001001001; // 10^9
const ll LINF = 1001001001001001001; // 10^18
const int MOD = 1e9 + 7;

ll N = 0;
ll ret = 0;
string s;

int main(void){
  ll X;
  IN(X);
  ll y = 0;
  ll s = 100;
  while(s < X) {
    s += s / 100;
    y++;
  }

  PRINT(y);
}


Measured memory_bytes: 3636
def calc_sum_digits(n):
    sumdigit = 0
    while n > 0:
        sumdigit += n % 10
        n //= 10
    return sumdigit

N, A, B = map(int, input().split())
result = 0
for n in range(1, N+1):
    if A <= calc_sum_digits(n) <= B:
        result += n
print(result)

Measured memory_bytes: 9052
#include <iostream>
#include <string>
#include <algorithm>

using namespace std;

int main()
{
    string s, t;
    cin>>s>>t;
    sort(s.begin(), s.end());
    sort(t.begin(), t.end());
    reverse(t.begin(), t.end());
    if (s<t) cout<<"Yes\n";
    else cout<<"No\n";
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define one_peace ios::sync_with_stdio(0),ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0)
using namespace std;
ll solve(vector<ll>v,ll sum)
{
    ll e=sum,h=0;
    sum/=2;
    for(int i=0; i<v.size(); i++)
    {
        h+=v[i];
        if(h>=sum)
        {
            break;
        }
    }
    return abs((e-h)-h);
}
int main()
{
    one_peace;
    int a;
    long long sum=0,b;
    cin>>a;
    vector<long long>v;
    while(a--)
    {
        cin>>b;
        v.push_back(b);
        sum+=b;
    }
    ll ans1=solve(v,sum);
    reverse(v.begin(),v.end());
    ll ans2=solve(v,sum);
    cout<<min(ans1,ans2)<<"\n";
    return 0;
}


Measured memory_bytes: 3568
#include <bits/stdc++.h>
using namespace std;
#define MOD 1000000007
#define FOR(i, N) for (long i = 0; i < (N); i++)

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int N;
    cin >> N;
    vector<long> A(N);
    FOR(i, N) {
        cin >> A[i];
    }

    long now_height = A[0];
    long ans = 0;

    for (int i = 1; i < N; i++) {
        if (A[i] < A[i - 1]) {
            ans += now_height - A[i];
            A[i] = A[i - 1];
        } else {
            now_height = A[i];
        }
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 4748
#include<bits/stdc++.h>
#define ll long long
#define mod 1000000007ll
using namespace std;
int ara[200005];
ll bigmod(ll b, ll p)
{
    if(!p)return 1ll;
    ll ret= bigmod(b, p>>1);
    ret= (ret*ret)%mod;
    if(p&1ll)ret= (ret*b)%mod;
    return ret;
}
int main()
{
    int n, k, res= 1;
    scanf("%d %d", &n, &k);
    int neg= 0, z= 0;
    for(int i=1; i<=n; i++)
    scanf("%d", &ara[i]), z+= (ara[i]==0), neg+= (ara[i]<0);
    if(k==n || (neg==n && k&1))
    {
        sort(ara+1, ara+1+n, greater<int>());
        for(int i=1; i<=k; i++)
        res= (1LL*res*ara[i])%mod;
        if(res<0)res+= mod;
        printf("%d\n", res);
    }
    else if((n-z)<k || (z && (n-z)==k && (neg&1)) || (z && !(n-z-neg) && (k&1)))puts("0");
    else
    {
        vector<int>vp, vn;
        for(int i=1; i<=n; i++)
        if(ara[i]!=0)
        {
            if(ara[i]>0)vp.push_back(ara[i]);
            else vn.push_back(-ara[i]);
        }
        sort(vp.begin(), vp.end());
        sort(vn.begin(), vn.end());
        int lp= 0, ln= 0, c= 0;
        for(int i=1; i<=k; i++)
        {
            if(!vp.empty() && (vn.empty() || vp.back()>vn.back()))
            lp= vp.back(), vp.pop_back(), res= (1LL*res*lp)%mod;
            else ln= vn.back(), vn.pop_back(), res= (1LL*res*ln)%mod, c++;
        }
        if(c&1)
        {
            if(!vp.empty() && !vn.empty())
            {
                if(!lp)res= ((1LL*res*bigmod(ln, mod-2))%mod * 1LL*vp.back())%mod;
                else if((1LL*ln*vn.back())>(1LL*lp*vp.back()))
                res= ((1LL*res*bigmod(lp, mod-2))%mod * 1LL*vn.back())%mod;
                else res= ((1LL*res*bigmod(ln, mod-2))%mod * 1LL*vp.back())%mod;
            }
            else
            {
                if(vp.empty())res= ((1LL*res*bigmod(lp, mod-2))%mod * 1LL*vn.back())%mod;
                else res= ((1LL*res*bigmod(ln, mod-2))%mod * 1LL*vp.back())%mod;
            }
        }
        printf("%d\n", res);
    }
    return 0;
}


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

int main(){
  int e;

  while(cin>>e,e){
    int m=e;

    for(int z=0; z*z*z<=e; z++){
      const int z3 = z*z*z;
      for(int y=0; y*y+z3<=e; y++){
        int x = e - z3 - y*y;
        if(m>x+y+z&&x>=0) m=x+y+z;
      }
    }
    cout << m << endl;
  }

  return 0;
}

Measured memory_bytes: 1156
#include <algorithm>
#include <cassert>
#include <cstring>
#include <iostream>
#include <vector>

#define TRACE(x) std::cout << #x << " = " << x << "\n"
#define _ << " _ " <<

using namespace std;

vector<std::string> s[8] = {
    {},
    {},
    {},
    {"aa.", "..b", "..b"},
    {"aaef", "bbef", "ghcc", "ghdd"},
    {"..abc", "..abc", "ddeef", "ggh.f", "iihjj"},
    {"...abc", "...abc", "ddee.f", "..gghf", "iij.h.", "kkj.ll"},
    {"aabbcc.", "ddeef..", "gg..fhh", "..ij..k", "..ij..k", "....lmn",
     "....lmn"}

};

int main() {
  std::ios_base::sync_with_stdio(false);

  int N;
  cin >> N;
  if (N <= 2) {
    cout << "-1\n";
    return 0;
  }

  vector<string> a(N, string(N, '.'));

  auto insert = [&](int n, int k) {
    for (int i = n; i < n + k; ++i) {
      for (int j = n; j < n + k; ++j) {
        a[i][j] = s[k][i - n][j - n];
      }
    }
  };

  if (N == 3) {
    insert(0, 3);
  } else {
    int n = N;
    while (n > 7) {
      n -= 4;
      insert(n, 4);
    }

    assert(n >= 4);
    insert(0, n);
  }

  for (int i = 0; i < N; ++i) {
    cout << a[i] << '\n';
  }
  return 0;
}


Measured memory_bytes: 2304
#include <algorithm>
#include <cmath>
#include <deque>
#include <iostream>
#include <numeric>
#include <queue>
#include <sstream>
#include <string>
#include <string.h>
#include <tuple>
#include <vector>

#define REP(i,x) for(int i{ 0 }; i < (int)(x); i++)
#define REPC(i,x) for(int i{ 0 }; i <= (int)(x); i++)
#define RREP(i,x) for(int i{ (int)(x) - 1 }; i >= 0 ;i--)
#define RREPC(i,x) for(int i{ (int)(x)}; i >= 0; i--)
#define REP1O(i,x) for(int i{ 1 }; i < (int)(x); i++)
#define REP1C(i,x) for(int i{ 1 }; i <= (int)(x); i++)

#define PB push_back
#define MP make_pair
#define F first
#define S second
#define SZ(x) ((int)(x).size())
#define ALL(x) (x).begin(),(x).end()

using namespace std;

typedef int64_t ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vector<int>> vvi;
typedef vector<vector<ll>> vvll;
typedef pair<int, int> pii;
typedef tuple<int, int, int> tupiii;
typedef tuple<ll, ll, ll> tuplll;

const int INTMAX = 2147483647;
const ll LLMAX = 9223372036854775807;
const int MOD = 1000000007;

template<class T> inline bool chmax(T& a, const T& b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, const T& b) { if (b < a) { a = b; return 1; } return 0; }
void inline swap(ll& a, ll& b) { a ^= b; b ^= a; a ^= b; }
void inline swap(int& a, int& b) { a ^= b; b ^= a; a ^= b; }


class C {
	int a, b;
	int c, d;
	int ma;
	int cap;
public:
	C()
	{
		cin >> a >> b >> c >> d >> ma >> cap;
		a *= 100;
		b *= 100;
	}
	void solve()
	{

		double maxConc = 0;
		int maxW = 0;
		int maxS = 0;

		for (int addA = 0; addA <= cap / a; addA++)
		{
			int wat = addA * a;

			for (int addB = 0; addB * b + wat <= cap; addB++)
			{
				wat += addB * b;

				for (int addC = 0; addC * c + wat <= cap && addC * c <= (wat / 100 * ma); addC++)
				{
					int sug = addC * c;

					for (int addD = 0; addD * d + wat + sug <= cap && sug + addD * d <= (wat / 100 * ma); addD++)
					{
						sug += addD * d;

						double conc = (double)sug / ((double)wat + sug);
						if (chmax(maxConc, conc))
						{
							maxW = wat;
							maxS = sug;
						}

						sug -= addD * d;
					
					}

					sug -= addC * c;
				}

				wat -= addB * b;
			}

		}

		if (maxW)
			cout << maxW + maxS << " " << maxS << endl;
		else
			cout << a << " " << 0 << endl;
	}
};


int main()
{
	C solution;
	solution.solve();

	return 0;
}

Measured memory_bytes: 256
list1 = []
list2 = []

time = 0
for n in range(5):

    list1.append(int(input()))

for n in list1:
    q = n // 10
    mod = n % 10
    time += 10 * q
    if mod != 0:
        time += 10
        list2.append(mod)


if list2 != []:
    time = time - 10 + min(list2)
    print int(time)
else:
    print int(time)


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

int main(){
	int N;
	string S;
	cin >> S;
	N=S.size();
	int count1 =0;
	if(N%2==1){
		for(int i=0;i<(N-1)/2;i++){
			if(S.at(i)!=S.at(N-i-1)){
				count1++;
			}
		}
	}
	else{
		for(int i=0;i<N/2;i++){
			if(S.at(i)!=S.at(N-i-1)){
				count1++;
			}
		}
	}
	cout<<count1<<endl;
}






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

my $in = <STDIN>;
chomp $in;
my ($n,$d) = split / /,$in;

my $man_cov = $d *2 +1;

if ($n%$man_cov == 0 ){
    $tmp = $n/$man_cov;
    print "$tmp\n";
}
else {
    $tmp = int($n/$man_cov) +1;
    print  "$tmp\n";
}


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

#define each(i, c) for (auto& i : c)

typedef long long ll;
typedef unsigned long long ull;
const ll MOD = 1e9+7;

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

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

  vector<pair<ll, ll>> xl(n);
  for (ll i = 0; i < n; ++i) {
    ll x, l;
    cin >> x >> l;
    xl[i] = make_pair(x, l);
  }
  sort(xl.begin(), xl.end(), sort_fn);

  ll t = -1e10;
  ll ans = 0;
  for (ll i = 0; i < n; ++i) {
    ll x = xl[i].first;
    ll l = xl[i].second;

    if (t <= (x - l)) {
      ans++;
      t = x + l;
    }
  }

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

Measured memory_bytes: 1792
function main(input){

  let [A, B, H, M] = input.split(' ').map(Number);

  const minute = H*60 + M;

  const theata =  (11*minute) / 360 * Math.PI

  const a  = Math.sqrt(A*A + B*B - 2*A*B*Math.cos(theata));

  console.log(a);

}
main(require('fs').readFileSync('/dev/stdin', 'utf8').trim());


Measured memory_bytes: 30556
#include<bits/stdc++.h>
#include<vector>
#include<string>
#include<algorithm>
#include<cmath>
 
#define fast ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define int long long int
#define mod 1000000007
#define inf 1e18+42
#define endl "\n"

#define out1(a) cout<<#a<<" "<<a<<endl
#define out2(a,b) cout<<#a<<" "<<a<<" "<<#b<<" "<<b<<endl
#define out3(a,b,c) cout<<#a<<" "<<a<<" "<<#b<<" "<<b<<" "<<#c<<" "<<c<<endl

#define rep(i,a,b) for(int i=a;i<b;i++)
#define repr(i,a,b) for(int i=a;i>=b;i--)
#define fori(it,A) for(auto it=A.begin();it!=A.end();it++)

#define ft first
#define sd second
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define zero(x) memset(x,0,sizeof(x));
 
using namespace std;

int binpow(int a, int b) {
    int res = 1;
    while (b > 0) {
        if (b & 1)
            res = res * a;
        a = a * a;
        b >>= 1;
    }
    return res;
}

//START OF CODE ->->->->->->->

void solve()
{
    int a,b;
    cin>>a>>b;

    if ( b == 1 )
    {
        cout<<"0"<<endl;
        return;
    }
    int i = 1;

    while ( ((a*i) - (i-1)) < b )
    {
        // out1(a*i - (i-1));
        // out1(i);
        i++;
    }
    
    cout<<i<<endl;
}

//END OF CODE ->->->->->->->->

signed main()
{
    fast;
    int t = 1;
    // cin>>t;

    while(t--)
    {
        solve();
    }
    return 0;
}



Measured memory_bytes: 256
from collections import Counter

def main():
    n = int(input())
    a = sorted([int(i) for i in input().split()])
    table = [True for i in range(max(a))]
    res = 0
    amax = max(a)

    for i in a:
        if table[i-1] is False:
            continue
        for j in range(i*2, amax+1, i):
            table[j-1] = False

    c = Counter(a)
    for i in set(a):
        if table[i-1]:
            if c[i] == 1:
                res += 1
    print(res)

if __name__ == '__main__':
    main()



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

using namespace std;

const double PI = 3.14159265358979323846;
typedef long long ll;
const double EPS = 1e-9;
#define rep(i, n) for (int i = 0; i < (n); ++i)
//#define rep(i, n) for (ll i = 0; i < (n); ++i)
//typedef pair<ll, ll> P;
typedef pair<ll, ll> P;
const ll INF = 10e17;
#define cmin(x, y) x = min(x, y)
#define cmax(x, y) x = max(x, y)
#define ret() return 0;

double equal(double a, double b) {
    return fabs(a - b) < DBL_EPSILON;
}

std::istream &operator>>(std::istream &in, set<string> &o) {
    string a;
    in >> a;
    o.insert(a);
    return in;
}

std::istream &operator>>(std::istream &in, queue<int> &o) {
    ll a;
    in >> a;
    o.push(a);
    return in;
}

bool contain(set<int> &s, int a) { return s.find(a) != s.end(); }

//ofstream outfile("log.txt");
//outfile << setw(6) << setfill('0') << prefecture << setw(6) << setfill('0') << rank << endl;
// std::cout << std::bitset<8>(9);
//const ll mod = 1e10;

typedef priority_queue<ll, vector<ll>, greater<ll> > PQ_ASK;


int main() {
    set<string> s;
    int n;
    cin >> n;
    rep(i, n) cin >> s;
    cout << s.size() << endl;
}



Measured memory_bytes: 19256
#include<bits/stdc++.h>
using namespace std;
#define rep(i,a,b) for(int i=(a);i<=(b);i++)
#define re(i,a,b) for(int i=(a);i<(b);i++)
#define repd(i,a,b) for(int i=(a);i>=(b);i--)
#define run(a) for(int k=head[a];k;k=e[k].ne)
#define v e[k].t
#define clr(a) memset(a,0,sizeof(a));
#define il inline
#define sz(a) ((int)a.size())
#define all(a) a.begin(),a.end()
#define mp make_pair
#define pb push_back 
#define w1 first
#define w2 second
#define adm(a,b,c) {a=a+b;if(a>=c)a-=c;else if(a<0)a+=c;}
typedef double db;
typedef long long ll;typedef long double ld;typedef unsigned long long ull;
typedef pair<ll,ll> pa;
const int N=1e6+5,M=5e3+5,INF=1e9,mod=998244353;
const ll linf=1e18;const double eps=1e-8,pi=acos(-1);
il int gmin(int &a,int b){if(a>b)a=b;}il ll gmin(ll &a,ll b){if(a>b)a=b;}il int gmax(int &a,int b){if(a<b)a=b;}il ll gmax(ll &a,ll b){if(a<b)a=b;}
il void read(ll&x){ll f=1,t=0;char ch=getchar();while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}while(ch>='0'&&ch<='9'){t=t*10+ch-'0';ch=getchar();}x=t*f;}il ll read(ll&x,ll&y){read(x);read(y);}
il void read(int&x){int f=1,t=0;char ch=getchar();while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}while(ch>='0'&&ch<='9'){t=t*10+ch-'0';ch=getchar();}x=t*f;}il int read(int&x,int&y){read(x);read(y);}
il void read(int&a,int&b,int&c){read(a);read(b);read(c);}il void read(ll&a,ll&b,ll&c){read(a);read(b);read(c);}
il int read(){int x;read(x);return x;}
il ll qpow(ll a,ll b,ll p){ll ret=1;for(;b;b>>=1,a=a*a%p)if(b&1)ret=ret*a%p;return ret;}il ll qpow(ll a,ll b){ll ret=1;for(;b;b>>=1,a=a*a%mod)if(b&1)ret=ret*a%mod;return ret;}
il ll qmul(ll a,ll b,ll p){ll ret=0;for(;b;b>>=1,a=(a<<1)%p)if(b&1)adm(ret,a,p);return ret;}il ll qmul(ll a,ll b){ll ret=0;for(;b;b>>=1,a=(a<<1)%mod)if(b&1)adm(ret,a,mod);return ret;}
il void judge(){
	freopen("data.in","r",stdin);
	freopen("data.out","w",stdout);}
int n,kk,a[N],cnt,head[N],dep[N],f[N],ans;
struct edge{int t,ne;}e[N];
void adde(int a,int b){e[++cnt]=(edge){b,head[a]};head[a]=cnt;}
void dfs(int x,int f){
	dep[x]=1;
	run(x)if(v!=f){dfs(v,x);gmax(dep[x],dep[v]+1);}
	if(dep[x]>=kk&&a[x]!=1&&f){dep[x]=0;ans++;}
}
int main(){
	ans=0;
	read(n,kk);rep(i,1,n)read(a[i]);
	rep(i,2,n)adde(a[i],i);
	dfs(1,0);
	if(a[1]!=1)ans++;
	cout<<ans<<endl;
}

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

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

main()
{
    long long  a,b;
    scanf("%lld%lld",&a,&b);
    printf("%lld\n",a/gcd(a,b)*b);
    return 0;
}

Measured memory_bytes: 3748
#include <iostream>
#include <iomanip>
#include <utility>
#include <cmath>
#include <random>
#include <vector>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <string>
#include <algorithm>
using namespace std;

#define rep(i,n) for(int i = 0; i<n; ++i)
#define REP(i,n) for(int i = 1; i<=n; ++i)
#define all(x) begin(x),end(x)
#define show(obj) {for(auto x:obj)cout<<x<<' ';cout<<endl;}
#define line "----------"
typedef long long ll;
typedef pair<int,int> P;
const int inf = 1001001000;
const ll INF = 1LL<<60;
const ll MOD = 1e9 + 7;

int main(){
	ios::sync_with_stdio(false);
	std::cin.tie(nullptr);
	int N; cin>>N;
	REP(i,N){
		int e_ans = 0;
		for(int x = 1; x*x <= i; ++x){
			int dbx = x*x;
			for(int y = 1; dbx + y*y <= i; ++y){
				int dby = y*y;
				int rest = i - dbx - dby - x*y;
				double t = x+y;
				double kai = (double)(-t + sqrt(t*t + 4*rest))/2;
				if(kai == floor(kai) && kai > 0)++e_ans;
				// for(int k = 1; k*k <= rest; ++k){
				// 	if(rest % k == 0){
				// 		if(abs(k - rest/k) == x+y)++e_ans;
				// 	}
				// }
			}
		}
		cout<<e_ans<<endl;
	}
	return 0;
}

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

int main(void){
  double a,b,c,d,e,f;
  double x,y;
  while(cin >> a >> b >> c >> d >> e >> f){
    y = ((a * f - d * c)) / (a * e - d * b);
    x = (c - (b * y)) / a;
    printf("%.3lf %.3lf\n",x,y);
  }
  return 0;
}

Measured memory_bytes: 1236
#include <iostream>
#include <cmath>

using namespace std;

int A, B, C, D;

int main()
{
    cin >> A >> B >> C >> D;
    if (abs (A - C) <= D || (abs (A - B) <= D && abs (B - C) <= D))
        cout << "Yes\n";
    else
        cout << "No\n";
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <complex>
#include <cstring>
#include <cstdlib>
#include <string>
#include <cmath>
#include <queue>
#include <set>
#include <map>
using namespace std;

#define REP(i,n) for(int i=0;i<(int)n;++i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define ALL(c) (c).begin(), (c).end()
const int INF = 1<<29;

int n;
int g[500][500];
int flow[500][500];
bool visited[500];

bool aug(int s, int t) {
  visited[s] = 1;
  if (s==t) return 1;
  REP(i,n) {
    if (g[s][i]-flow[s][i]>=1 && !visited[i]) {
      if (aug(i, t)) {
        flow[s][i]++;
        flow[i][s]--;
        return 1;
      }
    }
  }
  return 0;
}
bool augment(int s, int t) {
  memset(visited,0,sizeof(visited));
  return aug(s,t);
}


int main() {
  int m,q;
  cin >> n >> m >> q;
  
  REP(i,m) {
    int f,t;
    cin >> f>>t;
    f--;t--;
    g[f][t] = 1;
    g[t][f] = 1;
  }
  int maxflow = 0;
  while(1) {
    if (!augment(0,n-1))
      break;
    maxflow++;
  }
  REP(i,q) {
    int m,a,b;
    cin >>m>>a>>b;
    a--;b--;
    if (m==1) {
      g[a][b] = 1;
      g[b][a] = 1;
      if (augment(0,n-1))
        maxflow++;
    } else {
      g[a][b] = 0; g[b][a] = 0;
      if (flow[a][b] == 0) {
      } else {
        if (flow[a][b] == 1) {
          flow[a][b] = flow[b][a] = 0;
          if (augment(a,b)) {
          } else {
            augment(n-1, b);
            augment(a, 0);
            maxflow--;
          }
        } else {
          flow[a][b] = flow[b][a] = 0;
          if (augment(b,a)) {
          } else {
            augment(n-1, a);
            augment(b, 0);
            maxflow--;
          }
        }
      }
    }
    cout << maxflow << endl;
  }
}

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

int main() {
int N,M;
cin >> N >> M;
  vector<int> vec(M*2);   
for(int i1=0;i1<N;i1++){
  int n=0;
  for(int i=0;i<M*2;i++) {
	cin>>vec.at(i);
    if(vec.at(i)==i1+1){
    n++;
    } 
  }
  cout<<n<<endl;
  }
    
}


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

int main() {
    ios::sync_with_stdio(false);
    cin.tie(NULL);
    string a, b, c, a_, b_, c_;
    cin >> a >> b >> c;
    a_ = a.substr(0,1);
    b_ = b.substr(0,1);
    c_ = c.substr(0,1);
    cout << a_ + b_ + c_ << endl;
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<cmath>
#include<algorithm>
#include<utility>
#include<map>
#include<set>
#include<string>

using namespace std;

#define ll long long

int main(){
    ll n, m;
    cin >> n >> m;
    cout << (n-1) * (m-1) << endl;
}


Measured memory_bytes: 256
#[allow(unused_macros)]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

#[allow(unused_imports)]
use std::cmp;

fn serach(aa: &[Vec<usize>], sum: &mut [Vec<usize>], i: usize, j: usize) {
    if i + 1 < 2 {
        if sum[i+1][j] < sum[i][j] + aa[i+1][j] {
            sum[i+1][j] = sum[i][j] + aa[i+1][j];
            serach(aa, sum, i+1, j);
        }
    }
    if j + 1 < aa[0].len() {
        if sum[i][j+1] < sum[i][j] + aa[i][j+1] {
            sum[i][j+1] = sum[i][j] + aa[i][j+1];
            serach(aa, sum, i, j+1);
        }
    }
}

fn main() {
    input!{
        n: usize,
        aa: [[usize; n]; 2],
    }

    let mut sum = vec![vec![0; n]; 2];
    sum[0][0] = aa[0][0];
    serach(&aa, &mut sum, 0, 0);
    println!("{}", sum[1][n-1]);
}

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

#define NDEBUG
#include <cassert>


typedef long long ll;
typedef long double Double;
typedef unsigned long long ull;
typedef pair<int,int> ii;
typedef pair<ll,ll> llll;
typedef pair<double,double> dd;

typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<ii> vii;
typedef vector<vector<ii>> vvii;
typedef vector<ll> vll;
typedef vector<string> vs;
typedef vector<double> vd;
typedef vector<long double> vD;

#define sz(a)  int((a).size())
#define pb  push_back
#define eb  emplace_back
#define FOR(var,from,to) for(int var=(from);var<=(to);++var)
#define rep(var,n)  for(int var=0;var<(n);++var)
#define rep1(var,n)  for(int var=1;var<=(n);++var)
#define repC2(vari,varj,n)  for(int vari=0;vari<(n)-1;++vari)for(int varj=vari+1;varj<(n);++varj)
#define ALL(c)  (c).begin(),(c).end()
#define RALL(c)  (c).rbegin(),(c).rend()
#define tr(i,c)  for(auto i=(c).begin(); i!=(c).end(); ++i)
#define found(s,e)  ((s).find(e)!=(s).end())
#define mset(arr,val)  memset(arr,val,sizeof(arr))
#define mid(x,y) ((x)+((y)-(x))/2)
#define IN(x,a,b) ((a)<=(x)&&(x)<=(b))
#define cons make_pair

#define PQ(T) priority_queue<T>
#define RPQ(T) priority_queue<T,vector<T>,greater<T>>

template<class T> inline void amin(T & a, T const & b) { a = min(a, b); }
template<class T> inline void amax(T & a, T const & b) { a = max(a, b); }

inline ll square(ll x) { return x * x; }
inline ll gcd(ll a, ll b) { while(a) swap(a, b%=a); return b; }
template <typename T>
inline T mod(T a, T b) { return ((a % b) + b) % b; }


const ll MOD=1000000007LL;

ll ADD(ll x, ll y) { return (x+y) % MOD; }
ll SUB(ll x, ll y) { return (x-y+MOD) % MOD; }
ll MUL(ll x, ll y) { return x*y % MOD; }
ll POW(ll x, ll e) { ll v=1; for(; e; x=MUL(x,x), e>>=1) if (e&1) v = MUL(v,x); return v; }
ll DIV(ll x, ll y) { /*assert(y%MOD!=0);*/ return MUL(x, POW(y, MOD-2)); }

#define INTSPACE 12
char _buf[INTSPACE*1000000 + 3];

int loadint() {
    if (fgets(_buf, INTSPACE+3, stdin)==NULL) return 0;
    return atoi(_buf);
}

int loadvec(vector<int>& v, int N=-1) {
    if (N == 0) {
        v.clear();
        return 0;
    }
    if (N == -1) {
        N = loadint();
        if (N==0) return 0;
    }
    int bufsize = INTSPACE*N + 3;
    if (fgets(_buf, bufsize, stdin)==NULL) return 0;
    v.resize(N);

    int i=0;
    bool last = false;
    for (char *p=&_buf[0]; ;) {
        char *q = p;
        while (*q > ' ') ++q;
        if (*q == 0x0D || *q == 0x0A) last = true;
        *q = 0;
        v[i++] = atoi(p);
        if (last || i == N) break;
        p = q+1;
    }
    return i;
}
void read_cr() {
    fgets(_buf, 256, stdin);
}

ll solve(int N, vi& a) {
    return -1LL;
}

int main() {
    vi a(3),b(3);
    vvi d(4, vi(4, 100));
    rep(i,4) d[i][i]=0;

    rep(i,3){
        cin >> a[i] >> b[i];
        --a[i]; --b[i];
        d[a[i]][b[i]] = d[b[i]][a[i]] = 1;
    }
    int N=4;
    rep(k,N) rep(i,N) rep(j,N) d[i][j] = min(d[i][j], d[i][k]+d[k][j]);
    int sc=0;
    rep(i,4){
        set<int> s(ALL(d[i]));
        if (s.size() == 4) sc++;
    }

    cout << (sc ? "YES":"NO" )<< endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <cstring>
#include <cmath>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <set>

using namespace std;

int main()
{
    string s;
    cin>>s;
    for (int i=0; i<s.size(); i++)
    {
        if (s[i]=='1') cout<<"9";
        else cout<<"1";
    }
    cout<<endl;
    return 0;
}


Measured memory_bytes: 768
#include<stdio.h>

int main(){
  int i,j,n,num=0,v;
  int a[100],minj;

  scanf("%d",&n);

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

  for(i=0;i<n-1;i++){
    minj=i;
    for(j=i;j<n;j++){
      if(a[j]<a[minj]){
	minj=j;
      }
    }

    if(i!=minj)
      num++;
      v=a[i];
      a[i]=a[minj];
      a[minj]=v;
  }

  for(i=0;i<n-1;i++)
    printf("%d ",a[i]);
  printf("%d\n",a[n-1]);
  printf("%d\n",num);

  return 0;
}


	



Measured memory_bytes: 2052
import math
def main():
    A,B = map(int, input().split())
    # 税率rate%でtaxがA円となる税抜き価格xは、ceil(a*100/rate)<=x<ceil((a+1)*100/rate)を満たす
    min1 = math.ceil(A*100/8)
    max1 = math.ceil((A+1)*100/8)-1
    min2 = math.ceil(B*100/10)
    max2 = math.ceil((B+1)*100/10)-1
    if min1<=min2 and min2<=max1:
        ans = min2
    elif min2<=min1 and min1<=max2:
        ans = min1
    else:
        ans = -1
    print(ans)


main()


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

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

const int MOD = 1e9 + 7;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n; cin >> n;
    vector<vector<pair<int, bool>>> t(n + 1);
    for(int i = 1; i < n + 1; i++)
    {
        int a; cin >> a;
        for(int j = 0; j < a; j++)
        {
            int x, y; cin >> x >> y;
            t[i].push_back({x, y});
        }
    }
    int best = 0;
    for(int b = 0; b < (1<<n); b++)
    {
        vector<bool> honest(n + 1, 0);
        int cnt = 0;
        bool ok = 1;
        for(int i = 0; i < n; i++) if(b & (1<<i))
        {
            cnt++;
            honest[i + 1] = 1;
        }
        for(int i = 1; i < n + 1; i++) for(int j = 0; j < t[i].size(); j++)
        {
            if(honest[i] && honest[t[i][j].first] != t[i][j].second)
            {
                ok = 0;
                break;
            }
        }
        if(!ok) continue;
        best = max(best, cnt);
    }
    cout << best;

    return 0;
}


Measured memory_bytes: 256
n,m=map(int,input().split())
P=[[]for _ in[0]*n]
C=[0]*n
k=0
for _ in[0]*m:
 s,t=map(int,input().split());P[s]+=[t];P[t]+=[s]
for i in range(n):
 k+=1
 if C[i]<1:
  s=[i];C[i]=k
  while s:
   u=s.pop()
   for v in P[u]:
    if C[v]<1:C[v]=k;s+=[v]
for _ in[0]*int(input()):
 a,b=map(int,input().split())
 print(['no','yes'][C[a]==C[b]])


Measured memory_bytes: 23904
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int X = Integer.parseInt(scanner.next());
        int A = Integer.parseInt(scanner.next());
        int B = Integer.parseInt(scanner.next());
        scanner.close();

        int eatingDay = B - A;

        if (eatingDay <= 0) {
            System.out.println("delicious");
        } else if (eatingDay <= X) {
            System.out.println("safe");
        } else {
            System.out.println("dangerous");
        }
    }
}


Measured memory_bytes: 21844
#include <iostream>

using namespace std;

int main(){
  int sx,sy,tx,ty;
  cin >> sx >> sy >> tx >> ty;

  for (int i = sx; i < tx; i++){
    printf("R");
  }
  for (int i = sy; i < ty; i++){
    printf("U");
  }
  for (int i = sx; i < tx; i++){
    printf("L");
  }
  for (int i = sy; i < ty; i++){
    printf("D");
  }

  printf("D");
  for (int i = sx; i < tx + 1; i++){
    printf("R");
  }
  for (int i = sy; i < ty + 1; i++){
    printf("U");
  }
  printf("L");
  printf("U");
  for (int i = sx; i < tx + 1; i++){
    printf("L");
  }
  for (int i = sy; i < ty + 1; i++){
    printf("D");
  }
  printf("R\n");
}


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

#define rep(i,n) for(int i=0; i<(n); i++)
#define reps(i,x,n) for(int i=x; i<(n); i++)
#define rrep(i,n) for(int i=(n)-1; i>=0; i--)
#define all(X) (X).begin(),(X).end()
#define X first
#define Y second
#define pb push_back
#define eb emplace_back

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

template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }

template<class A, size_t N, class T> void Fill(A (&a)[N], const T &v){ fill( (T*)a, (T*)(a+N), v ); }

const ll INF = 1e9+7;


int main(){
	//ios_base::sync_with_stdio(false);
	int N, ans=INF;

	cin >> N;

	rep(i,N-1){
		int A = i + 1;
		int B = N - A;
		int sum = 0;
		while(A){ sum += A%10; A /= 10; }
		while(B){ sum += B%10; B /= 10; }
		chmin(ans, sum);
	}

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 256
//#pragma comment(linker, "/stack:200000000") //  (UNCOMMENT WHEN HAVING LOTS OF RECURSIONS)
#pragma GCC optimize("O3")
#pragma GCC optimize("Ofast")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
//#pragma GCC optimize("unroll-loops")  // $ (UNCOMMENT WHEN TRYING TO BRUTEFORCE WITH A LOT OF LOOPS)\
 
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
 
#define fast_cin ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define endl "\n"
#define int long long
#define pb push_back
#define all(con) (con).begin(), (con).end()
#define fi first
#define se second
#define rep(i,a,b) for(int i=a;i<b;++i)
#define fre(i,a,b) for(int i=a;i<=b;i++)
#define rpe(i,a,b) for(i=a-1;i>=b;i--)
#define rp(i,n) rep(i,0,n)
#define fr(i,n) fre(i,1,n)
#define ff(i,a,b) for(int i=a;i<=b;i++)
 
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef vector<int> vi;
 
template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
// order_of_key (val): returns the no. of values less than val
// find_by_order (k): returns the iterator to kth largest element.(0-based)
 
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
 
#define TRACE
#ifndef ONLINE_JUDGE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
	cerr << name << " : " << arg1 << endl;}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
	const char* comma = strchr(names + 1, ',');cerr.write(names, comma - names) << " : " << arg1<<"  ";__f(comma+1, args...);}
#else
#define trace(...)
#endif
 
template<class S,class T> ostream& operator<<(ostream& o,const pair<S,T> &p){
	return o<<"("<<p.fs<<","<<p.sc<<")";
}
template<class T> ostream& operator<<(ostream& o,const vector<T> &vc){
	o<<"{";
	for(const T& v:vc) o<<v<<",";
	o<<"}";
	return o;
}
 
int modpow(int x, int n, int m) {
	x %= m;
	int res = 1;
	while(n > 0) {
		if(n & 1)
		res = res * x % m;
		x = x * x % m;
		n >>= 1;
	}
	return res;
}
 
const long long inf = 2e18 ;
const int mod = 1e9+7 ;
// const int mod = 998244353 ;
 
const int N = 1e5 + 10 ;
 
void solve() {
	int a,b,c;
	cin >> a >> b >> c ;
	if( a==b && b!=c ) {
		cout << "Yes" << endl;
	}
	else if( a==c && c!=b ) {
		cout << "Yes" << endl;
	}
	else if(b==c && c!=a) {
		cout << "Yes"<<endl;
	}
	else {
		cout << "No"<<endl;
	}
}
 
signed main() {
        fast_cin;
	
	srand(chrono::high_resolution_clock::now().time_since_epoch().count());
        #ifndef ONLINE_JUDGE
        // freopen("input.txt", "r", stdin);
        // freopen("output.txt", "w", stdout);
    	#endif
	
	int tests=1;
	// cin>>tests;
	while(tests--) {
		solve();
	}
 
return 0 ;
}
 

Measured memory_bytes: 256
import java.util.Scanner;

class Solver {
    public void Solve() {
        long n = sc.nextLong();
        long k = sc.nextLong();
        if (n < k) {
            long ans = Math.min(k - n, n);
            System.out.println(ans);
            return;
        }
        long ans = n % k;
        if (ans < k) {
            ans = Math.min(k - ans, ans);
            System.out.println(ans);
            return;
        }
    }

    private static long gcd(long m, long n) {
        if (m < n)
            return gcd(n, m);
        if (n == 0)
            return m;
        return gcd(n, m % n);
    }

    Scanner sc;

    Solver(Scanner in) {
        this.sc = in;
    }
}

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


Measured memory_bytes: 23124
#include <bits/stdc++.h>
#define ios ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0)
#define debug  freopen("in.txt","r",stdin),freopen("out.txt","w",stdout);
#define pb push_back
#define all(x) x.begin(),x.end()
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
const int maxn = 1e6+10;
const int maxM = 1e6+10;
const int inf = 0x3f3f3f3f;

int N;
int w[maxn];
vector<int> adj[maxn];
int ans[maxn];
int lis[maxn],tail;
void dfs(int u,int fa = -1){
	int add = 0,id = 0,val = 0;
	if(tail == 0){
		lis[++tail] = w[u];
		add = 1;
	}else{
		int idx = lower_bound(lis+1,lis+tail+1,w[u]) - lis;
		if(idx == tail+1){
			lis[++tail] = w[u];
			add = 1;
		}else{
			id = idx,val = lis[idx];
			lis[idx] = w[u];
		}
	}
	ans[u] = tail;
	for(auto v:adj[u]){
		if(v == fa) continue;
		dfs(v,u);
	}
	if(add) --tail;
	else if(id){
		lis[id] = val;
	}
}
int main(){
	// debug;
	ios;

	cin>>N;
	for(int i = 1;i<=N;i++) cin>>w[i];
	for(int i = 1;i<=N-1;i++){
		int u,v;cin>>u>>v;
		adj[u].pb(v);
		adj[v].pb(u);
	}
	dfs(1);
	for(int i = 1;i<=N;i++) cout<<ans[i]<<'\n';

	return 0;
}


Measured memory_bytes: 49104
#include<bits/stdc++.h>
using namespace std;
int main(){
	int i,j,k;
	vector <int> v;
	cin>>k;
	for(i=0;i<k;i++){
		cin>>j;
		v.push_back(j);
	}
	int *a=new int[k];
	a[0]=0;a[1]=abs(v[1]-v[0]);
	for(i=2;i<k;i++)
		a[i]=min(a[i-1]+abs(v[i-1]-v[i]),a[i-2]+abs(v[i-2]-v[i]));

	cout<<a[k-1]<<endl;
}


Measured memory_bytes: 1144
//I love Nanami Chiaki
#include<bits/stdc++.h>
using namespace std;
#define ll long long
ll n;
ll dp[507][257][257];  //i:选到第几个数 j:要选几个上限 k:已经选了几个上限 
ll sx[507],xx[507];
struct ID{
	ll fst;
	int poi;
}id[1007];
bool cmp(ID X,ID Y){
	if (X.fst==Y.fst) return sx[X.poi]<sx[Y.poi];
	return X.fst<Y.fst;
}
int mod;
int main(){
	scanf("%lld%d",&n,&mod);
	for (int i=1;i<=2*n;i++){
		sx[i]=sqrt(4*n*n-(i-1)*(i-1));
		if (sx[i]==2*n) sx[i]--;
		if (i>n){
			id[i].fst=sx[i];id[i].poi=i;
		}
	}
	for (int i=1;i<=n;i++){
		xx[i]=sqrt(n*n-(i-1)*(i-1));
		if (xx[i]*xx[i]==n*n-(i-1)*(i-1)) xx[i]--;
		id[i].fst=xx[i];id[i].poi=i;
	}
	sort(id+1,id+2*n+1,cmp);
	memset(dp,0,sizeof(dp));
	for (int i=0;i<=n;i++){
		dp[0][i][0]=1;
	}
	for (int i=1;i<=2*n;i++){
		int p=id[i].poi;
		if (p>n){
			for (int j=0;j<=n;j++){
				for (int k=0;k<=min(i-1,j);k++){
					if ((sx[p]-(i-k-1)+1)>0) dp[i][j][k]=dp[i][j][k]+1ll*dp[i-1][j][k]*(sx[p]-(i-k-1)+1)%mod;
				}
			}
		}
		else{
			for (int j=0;j<=n;j++){
				for (int k=0;k<=min(i-1,j);k++){
					if ((xx[p]-(i-k-1)+1)>0) dp[i][j][k]=(dp[i][j][k]+1ll*dp[i-1][j][k]*(xx[p]-(i-k-1)+1)%mod)%mod;
					if (k!=j && (sx[p]-(2*n-(j-k))+1)>0) dp[i][j][k+1]=(dp[i][j][k+1]+1ll*dp[i-1][j][k]*(sx[p]-(2*n-(j-k))+1)%mod)%mod;
				}
			}
		}
	}
	ll ans=0;
	for (int i=n;i>=0;i--){
		if ((n-i)&1){
			ans=((ans-dp[2*n][i][i])%mod+mod)%mod;
		}
		else{
			ans=(ans+dp[2*n][i][i])%mod;
		}
	}
	printf("%lld\n",ans);
	return 0;
}

Measured memory_bytes: 262016
from collections import defaultdict,deque
import sys,heapq,bisect,math,itertools,string,queue,datetime
sys.setrecursionlimit(10**8)
INF = float('inf')
mod = 10**9+7
def inpl(): return list(map(int, input().split()))
def inpls(): return list(input().split())

N,p = inpl()
aa = inpl()
cnt = [0]*2
for a in aa:
    cnt[a%2] += 1

def P(n, r):
	return math.factorial(n)//math.factorial(n-r)

def C(n, r):
    if r == 0: return 1
    return P(n, r)//math.factorial(r)

if p == 0:
    ans = pow(2,(cnt[0]))
    tmp = 0
    for i in range(0,cnt[1]+1,2):
        tmp += C(cnt[1],i)
    ans *= tmp
else:
    ans = pow(2,(cnt[0]))
    tmp = 0
    for i in range(1,cnt[1]+1,2):
        tmp += C(cnt[1],i)
    ans *= tmp

print(ans)


Measured memory_bytes: 4324