akhauriyash/Code-Regression huggingface dataset:
/*GOD     IS    GREAT,
  SO    AM    I*/
#include<bits/stdc++.h>
#include<numeric>
using namespace std;
#define ll long long int
#define ford(i,a,n) for(long long int i=a;i<n;++i)
#define fore(i,a,n) for(long long int i=a;i<=n;i++)
#define foru(i,a,n) for(long long int i=a;i>=n;i--)
#define test ll t;cin>>t;while(t--)
#define op(z) cout<<z<<endl
#define ops(z) cout<<z<<" "
#define fastIO ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define debug(x) cout<<#x<<" "<<x<<endl
#define pp pair<ll,ll>
#define maxe 1000000
#define MOD 1000000007
ll prime[maxe] = {0};
// TO COUNT THE DIGIT IN A NUMBER => floor(log(n)/log10+1)
void file()
{
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
}
ll sumofdigits(ll n) {
	ll sum = 0;
	while (n > 0) {
		sum += n % 10;
		n /= 10;
	}
	return sum;
}
void sieve()
{
	prime[0] = 0;
	prime[1] = 0;
	prime[2] = 1;
	ll i, j, k;
	file();
	for (i = 3; i <= maxe; i += 2)
	{
		prime[i] = 1;
	}
	for (i = 3; i <= maxe; i++)
	{
		if (prime[i])
		{
			for (j = i * i; j <= maxe; j += 2 * i)prime[j] = 0;
		}
	}
}
bool cmp(pp &a, pp &b)
{
	if (a.first != b.first)
	{
		return b.first > a.first;
	}
	else
	{
		return b.second > a.second;
	}
}
void solve()
{
	string s;cin>>s;
  	char c=s[s.length()-1];
  	if(c=='2'||c=='4'||c=='5'||c=='7'||c=='9')op("hon");
  	else if(c=='0'||c=='1'||c=='6'||c=='8')op("pon");
  	else
      op("bon");

}
int main()
{
	fastIO
	//sieve();
	//file();
	//test
	{
		solve();
	}
	return 0;
}

Measured memory_bytes: 3592
#include <cmath>
#include <iostream>
using namespace std;
int main() {
    long double a, b, c;
    while (cin >> a >> b >> c) {
        if (c < (a + b))
            cout << "No" << endl;
        else if (4 * a * b < (c - a - b) * (c - a - b))
            cout << "Yes" << endl;
        else
            cout << "No" << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <map>
#include <string>
typedef long long ll;
using namespace std;
int num[1000];
int main()
{
    int n;
    while(~scanf("%d",&n))
    {
        for(int i=1;i<=n;i++)
            scanf("%d",&num[i]);
        int ans=0;
        ll sum=0;

       while(1)
        {
            int flag=0;
            ans=0;
            for(int i=1;i<=n;i++)
            {
                if(!num[i]) continue;
                else
                {
                    flag=1;
                    if(!num[i-1]) ans++;
                    else  continue;
                }
            }
            if(!flag) break;
            sum+=ans;
            for(int i=1;i<=n;i++)
                if(num[i])
                    num[i]--;
        }
        printf("%lld\n",sum);
    }
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main() {
	int cnt(0), n;
	cin >> n;
	for(int i(0); i < n; i++) {
		int x;
		cin >> x;
		cnt += x % 2;
	}
	cout << (cnt % 2 ? "NO" : "YES") << endl;
}


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

int main(){
  long long n, a[10000];
  cin >> n;
  for(int i = 0; i < n; i++){
    cin >> a[i];
  }
  cout << *min_element( a, a + n) << " "
       << *max_element( a, a + n) << " "
       << accumulate( a, a + n, 0LL) << endl;
}



Measured memory_bytes: 3180
#include <algorithm>
#include <cmath>
#include <iostream>
#include <iomanip>
#include <map>
#include <numeric>
#include <set>
#include <string>
#include <vector>

using namespace std;
using LLONG = long long;

int main()
{
    string A, B, C;
    cin >> A >> B >> C;
    if (A.back() == B.front() && B.back() == C.front())
    {
        cout << "YES" << endl;
    }
    else
    {
        cout << "NO" << endl;
    }

    return 0;
}

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

int main(){
  long N,M;
  cin >> N >> M;
  vector<pair<long,long>> D(N);
  for(int i=0; i<N; i++){
    cin >> D.at(i).first >> D.at(i).second;
  }
  sort(D.begin(),D.end());
  long bins=0,money=0,i=0;
  while(bins<M){
    if(D.at(i).second<=M-bins){
      money+=D.at(i).first*D.at(i).second;
      bins+=D.at(i).second;
      i++;
    }
    else{
      money+=D.at(i).first*(M-bins);
      bins=M;
    }
  }
  cout << money << endl;
}

Measured memory_bytes: 1792
#include<iostream>
#include<vector>
#include<algorithm>
#include<cstdio>
#include<queue>
#include<cmath>
#include<map>
#include<set>
using namespace std;
const int INF = 1 << 29;
const double EPS = 1e-9;

typedef long long ll;

#define SORT(c) sort((c).begin(),(c).end())
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n)  FOR(i,0,n)

int N,M;
int L[201];

int main(int argc, char * argv[])
{
    ios::sync_with_stdio(false);
    cin >> N;
    rep(i,2*N) cin >> L[i];
    sort(L,L+2*N);
    int s = 0;
    rep(i,N){
        s += L[2*i];
    }
    cout << s << endl;




    return 0;
}



Measured memory_bytes: 256
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <fstream>
#include <sstream>
#include <set>
#include <map>
#include <vector>
#include <list>
#include <algorithm>
#include <cstring>
#include <cmath>
#include <string>
#include <stack>
#include <queue>
#include <bitset>     //UWAGA - w czasie kompilacji musi byc znany rozmiar wektora - nie mozna go zmienic
#include <cassert>
#include <iomanip>        //do setprecision
#include <ctime>
#include <complex>
using namespace std;

#define FOR(i,b,e) for(int i=(b);i<(e);++i)
#define FORQ(i,b,e) for(int i=(b);i<=(e);++i)
#define FORD(i,b,e) for(int i=(b)-1;i>=(e);--i)
#define REP(x, n) for(int x = 0; x < (n); ++x)

#define ST first
#define ND second
#define PB push_back
#define PF push_front
#define MP make_pair
#define LL long long
#define ULL unsigned LL
#define LD long double
#define pii pair<int,int>
#define pll pair<LL,LL>
#define vi vector<int>
#define vl vector<LL>
#define vii vector<vi>

const double pi = 3.14159265358979323846264;
const int mod=1000000007;


//mod演算ライブラリ
//mod=1000000007

LL add(LL a,LL b){
  return (a+b)%mod;
}

LL sub(LL a,LL b){
  return (a+mod-b)%mod;
}

LL mul(LL a,LL b){
  return ((a % mod) * (b % mod)) % mod;
}

LL power(LL x,LL y){//繰り返し二乗法 単品利用可
  if(y==0)return 1;
  else if(y==1)return x%mod;
  else if(y%2==0){
    LL tmp=power(x, y/2) % mod;
    return tmp*tmp%mod;
  }else {
    LL tmp=power(x, y/2) % mod;
    return ((tmp*tmp)%mod)*x%mod;
  }
}

LL dvs(LL a,LL b){
  return mul(a,power(b,mod-2));
}

const int SIZE_mod=200005;
int invfact[SIZE_mod];
int fact[SIZE_mod];

LL factset(int a){//aまでの階乗%mod表を作成
  fact[0]=1;
  FORQ(i,1,a){
    fact[i]=mul(fact[i-1],i);
  }
}

LL cmbset(int a){//1~aまでの階乗と階乗数の逆元のmod(mod)を用意 O(a)
  factset(a);
  invfact[a]=power(fact[a],mod-2);
  invfact[0]=1;
  FORD(i,a,1){
    invfact[i]=mul(invfact[i+1],i+1);
  }

}

LL cmb(int n,int r){//nCr%mod  (cmbset後に使用)
  if(n<r||r<0||n<0)return 0;
  return mul(fact[n],mul(invfact[r],invfact[n-r]));
}

LL prm(int n,int r){//nPr%mod
    return mul(cmb(n,r),fact[n]);
}

LL homo(int n,int r){//nHr%mod
  return cmb(n+r-1,r);
}


int main(){
	int n;
    cin>>n;
    vl c(n);
    LL ans=0;
    FOR(i,0,n){
        cin>>c[i];
    }
    sort(c.rbegin(),c.rend());
    if(n==1){
        cout<<mul(c[0],2);
        return 0;
    }

    LL v1=mul(1,power(2,n-1));
    LL v2=mul(1,power(2,n-2));
    ans=mul(v1,c[0]);
    FOR(i,1,n){
        v1+=v2;
        ans=add(ans,mul(c[i],v1));
    }
    cout<<mul(ans,power(2,n))<<endl;

}


Measured memory_bytes: 1792
#include<iostream>
#include<algorithm>
#include<math.h>
#include<string>
#include<vector>
#include<queue>
#include<deque>
#include<iomanip>
#include<map>
using namespace std;
typedef pair<int, pair<int, int> >PP;
typedef long long ll;
typedef pair<int, int>P;
typedef vector<int>vec;
int inf=-1;
ll mod = pow(10, 9) + 7;
 
int main(){
    int n;
    cin>>n;
    double V[55];
    for(int i=0;i<n;i++){
        cin>>V[i];
    }
    sort(V,V+n);
    double old_v,v;
    old_v=V[0];
    for(int i=1;i<n;i++){
        v=V[i];
        old_v=(old_v+v)/2;
    }
    cout<<old_v<<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++)
using ll = long long;
const ll M = 1e9 + 7;

int main() {
  int n;
  ll h, w;
  cin >> n >> h >> w;

  int ans = 0;
  rep(i,n) {
    ll a, b;
    cin >> a>> b;
    if (a < h) continue;
    if (b < w) continue; 
    ans++;
  }
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 3640
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner stdIn = new Scanner(System.in);
        while(true){
            int n = stdIn.nextInt();
            int x = stdIn.nextInt();
            if(n == 0 && x == 0)
                break;
            int answer = 0;
            for(int i = 1; i <= n; i++) {
                for(int j = i + 1; j <= n; j++) {
                    for(int k = j + 1; k <= n; k++) {
                        if(i + j + k == x) {
                            answer++;
                        }
                    }
                }
            }
            System.out.println(answer);
        }
    }
}


Measured memory_bytes: 26244
while True:
    s,cc=input().split()
    if cc=="X":
        break
    if "_" in s:
        t = s.split("_")
    else:
        t = []
        j = 0
        for i in range(1, len(s)):
            if s[i].isupper():
                t.append(s[j:i])
                j = i
        t.append(s[j:])
    if cc == "U":
        for i in range(len(t)):
            t[i] = t[i][0].upper() + t[i][1:]
        print("".join(t))
    elif cc == "L":
        t[0] = t[0].lower()
        for i in range(1, len(t)):
            t[i] = t[i][0].upper() + t[i][1:]
        print("".join(t))
    else:
        for i in range(len(t)):
            t[i] = t[i].lower()
        print("_".join(t))


Measured memory_bytes: 5560
a,b,h,m = map(int,input().split())
import math
a_t = (h*30+m*0.5) / 180
b_t = m*6 / 180
print(math.sqrt((a*math.sin(a_t*math.pi)-b*math.sin(b_t*math.pi))**2 + (a*math.cos(a_t*math.pi)-b*math.cos(b_t*math.pi))**2))

Measured memory_bytes: 9516
#include <iostream>
#include <algorithm>
#include <limits>
#include <vector>
#include <map>
#include <cmath>
#include <limits>
#include <iomanip>
#include <queue>
#include <bitset>
#define ll long long int
#define ld long double
#define rep(i,n) for(int i = 0;i < n;i++)
#define rep1(i,n) for(int i = 1;i < n;i++)
#define co(x) cout << x << endl
#define cosp(x) cout << x << " "
#define all(x) x.begin(),x.end()
#define p pair<ll,ll>
#define pb push_back
#define mp make_pair
#define MOD 1000'000'007
#define INF 1ll << 60
#define PI 3.14159265359

using namespace std;
int main(){
    int n;
    cin >> n;
    vector<int> a(n);
    rep(i,n) cin >> a[i];

    ll ans = INF;
    ll tmp = 0;
    for(int i = -100;i <= 100;i++){
        tmp =0;
        rep(j,n){
            tmp += pow(i - a[j],2);
        }
        ans = min(ans,tmp);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define sd(x) scanf("%d", &x)
#define sz(v) (int) v.size()
#define pr(v) For(i, 0, sz(v)) {cout<<v[i]<<" ";} cout<<endl;
#define slld(x) scanf("%lld", &x)
#define all(x) x.begin(), x.end()
#define For(i, st, en) for(ll i=st; i<en; i++)
#define tr(x) for(auto it=x.begin(); it!=x.end(); it++)
#define fast std::ios::sync_with_stdio(false);cin.tie(NULL);
#define pb push_back
#define ll long long
#define int long long
#define mp make_pair
#define F first
#define S second
typedef pair<int, int> pii;
typedef vector<int> vi;
#define MOD 1000000007
#define INF 1000000000000000007LL

const int N = 100005;
 
// it's swapnil07 ;)
 
#ifdef SWAPNIL07
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
    cout << name << " : " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
    const char* comma = strchr(names + 1, ',');cout.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
int begtime = clock();
#define end_routine() cout << "\n\nTime elapsed: " << (clock() - begtime)*1000/CLOCKS_PER_SEC << " ms\n\n";
#else
#define endl '\n'
#define trace(...)
#define end_routine()
#endif

vector<int> adj[N];

int dp[N][2];

int dfs(int u, int p, int col){
    int ans = 1;
    if(dp[u][col])
        return dp[u][col];
    for(int v: adj[u]){
        if(v==p)
            continue;
        if(col==1){
            ans = ans*(dfs(v, u, 1)+dfs(v, u, 0));
        }
        else{
            ans = ans*dfs(v, u, 1);
        }
        ans %= MOD;
    }
    dp[u][col]=ans;
    return ans;
}

signed main()
{
    fast
    #ifdef SWAPNIL07
        freopen("input.txt","r",stdin);
        freopen("output.txt","w",stdout);
    #endif
    int n; cin>>n;
    For(i, 0, n-1){
        int u, v; cin>>u>>v;
        adj[u].pb(v);
        adj[v].pb(u);
    }
    int ans = (dfs(1, 0, 0)+dfs(1, 0, 1)) % MOD;
    cout<<ans;
    return 0;
}





Measured memory_bytes: 14208
S = input()

if len(set(S)) == 1:
    print(0)
else:
    alpha = list(set(S))
    cnt = float("inf")
    for word in alpha:
        t = S[:]
        for i in range(1, len(S)):
            tmp = ""
            for j in range(len(t)-1):
                if t[j] == word or t[j+1] == word:
                    tmp += word
                else:
                    tmp += t[j]
            if len(set(tmp)) == 1:
                cnt = min(cnt, i)
                break
            t = tmp[:]
    print(cnt)

Measured memory_bytes: 3064
let _ = Scanf.sscanf (read_line ()) "%d/%d/%d" (fun y m d ->
  match y with
  | y when y < 2019 -> print_endline "Heisei"
  | _ -> 
    match m with 
    | m when m <= 4 -> print_endline "Heisei"
    | _ -> print_endline "TBD"
)


Measured memory_bytes: 384
#include<bits/stdc++.h>
#define int ll
using namespace std;
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("Ofast")
#pragma target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
typedef long long ll;
typedef pair<int,int> pii;
#define Rep(i,a,b) for(register int i=(a);i<=int(b);++i)
#define Dep(i,a,b) for(register int i=(a);i>=int(b);--i)
#define rep(i,a,b) for(register int i=(a);i<int(b);++i)
#define mem(x,v) memset(x,v,sizeof(x))
/*inline char gc(){
    static char buf[100000],*p1=buf,*p2=buf;
    return p1==p2&&(p2=(p1=buf)+fread(buf,1,100000,stdin),p1==p2)?EOF:*p1++;
}*/
#define gc getchar
#define pc putchar
#define fi first
#define se second
#define debug(x) cout << #x" = " << x << endl;
#define pp(x,y) cout << "pp: " << x << " " << y << endl;
#define rank __RANK
inline ll read(){
	register ll x=0,f=1;register char c=gc();
	for(;!isdigit(c);c=gc())if(c=='-')f=-1;
	for(;isdigit(c);c=gc())x=(x<<1)+(x<<3)+(c^48);
	return x*f;
}
#define rd read
void write(ll x){if(x<0)x=-x,pc('-');if(x>=10)write(x/10);putchar(x%10+'0');}
void writeln(ll x){write(x);puts("");}
const int maxn = 3e5+233;
const int mod = 998244353;
int fac[maxn],inv[maxn];
inline int C(int n,int m){
	return 1ll * fac[n] * inv[m] % mod * inv[n-m] % mod;
}
inline int qpow(int a,int b){
	int ans = 1;
	for(;b;b>>=1,a=1ll*a*a%mod)
		if(b&1) ans=1ll*ans*a%mod;
	return ans;
}
int n,A,B,K; 
signed main(){
	n = rd(),A = rd(),B = rd(),K = rd();
	fac[0] = 1;
	Rep(i,1,n) fac[i] = 1ll * fac[i-1] * i % mod;
	inv[n] = qpow(fac[n],mod-2);
	Dep(i,n-1,0) inv[i] = 1ll * inv[i+1] * (i+1) % mod; 
	ll ans = 0;
	Rep(i,0,n){
		if(A*i<=K){
			if((K-A*i)%B==0){
				int j = (K - A * i) / B;
				if(0<=j && j<=n){
//					printf("[%d %d]\n",i,j);
					ans = (ans + 1ll * C(n,i) * C(n,j) % mod) % mod;
				}
			}
		}
	} 
	writeln(ans);
}


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

int main() {
  ll h, w;
  cin >> h >> w;
  if (h == 1 || w == 1)
    cout << 1 << endl;
  else
    cout << ((h * w) + 1) / 2 << endl;
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#include<functional>
#include<queue>
#include<stack>
#include<set>
#include<map>
#include<unordered_map>
#include<climits>
#include<cstdlib>
#include<cmath>
#include<string>
#include<iomanip>
#include<bitset>

using namespace std;

#define ll long long int

ll const MOD = 1000000007;
ll const INF = (long long int)1 << 61;

ll mypow(ll x,ll n){
    ll ret = 1;
    while(n > 0){
        if(n&1){
            ret = (ret*x)%MOD;
        }
        x = (x*x)%MOD;
        n >>= 1;
    }
    return ret;
}

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

    ll ans = 0;

    bool flag = false;

    for(int i = 0; i < str.size(); i++){
        if(flag){
            if(str[i] != '0'){
                ans++;
            }
        }else{
            if(str[i] != '1'){
                ans++;
            }
        }
        flag = !flag;
    }

    ll tmp = 0;
    flag = true;

    for(int i = 0; i < str.size(); i++){
        if(flag){
            if(str[i] != '0'){
                tmp++;
            }
        }else{
            if(str[i] != '1'){
                tmp++;
            }
        }
        flag = !flag;
    }


    cout << min(ans,tmp) << endl;

    return 0;
}

Measured memory_bytes: 512
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) throws Exception {
        // Your code here!
        Scanner sc = new Scanner(System.in);
        int n =sc.nextInt();
        System.out.println(n*n*n);
        //BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        //String line = br.readLine();
    }
}



Measured memory_bytes: 26292
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
using P = pair<ll,ll>;
const ll mod = 1e9+7;
#define ALL(x) (x).begin(),(x).end()
#define REP(i,n) for(ll (i)=0;(i)<(n);(i)++)
#define REPS(i,n) for(ll (i)=1;(i)<=(n);(i)++)
#define RREP(i,n) for(ll (i)=(n-1);(i)>=0;(i)--)
#define RREPS(i,n) for(ll (i)=(n);(i)>0;(i)--)
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define UNIQUE(v) v.erase(unique(ALL(v)),v.end());

template<class T> inline void chmin(T& a, T b){
    if (a > b){
        a = b;
    }
}

template<class T> inline void chmax(T& a, T b){
    if (a < b){
        a = b;
    }
}

signed main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout<<fixed<<setprecision(12);
    int N;
    cin >> N;
    vector<ll> A(N);
    REP(i,N)cin >> A[i];
    reverse(ALL(A));
    vector<int> B(0);
    B.pb(A[0]);
    REPS(i,N-1){
        int dist = upper_bound(ALL(B),A[i]) - B.begin();
        if(dist >= B.size()){
            B.pb(A[i]);
        }else{
            B[dist] = A[i];
        }
    }
    cout << B.size() << "\n";
}

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

int main() {
  // ここにプログラムを追記
  int a, b;
  string c = "IMPOSSIBLE";
  cin >> a >> b;
  if((a+b)%2==0){
    cout << (a+b)/2 << endl;
  }else{
    cout << c << endl;
  }
}


Measured memory_bytes: 256
main = getContents >>= putStr.unlines.cnt.(\xs -> [map head xs, map (!!1) xs]).(map $(map eye).words).lines

cnt :: [[String]] -> [String]
cnt (x:y:_) = map unwords [[cntA x,cntA y], [cntB x,cntB y], [cntC x,cntC y], [cntD x,cntD y]]
  where cntA s = show.length $filter (=="A") s
        cntB s = show.length $filter (=="B") s
        cntC s = show.length $filter (=="C") s
        cntD s = show.length $filter (=="D") s

eye :: String -> String
eye n
  | n >= "1.1" = "A"
  | n >= "0.6" = "B"
  | n >= "0.2" = "C"
  | otherwise  = "D"

Measured memory_bytes: 3596
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        int a = scan.nextInt();
        int b = scan.nextInt();
        int c = scan.nextInt();

        if (a + b >= c) {
            System.out.println("Yes");
        } else {
            System.out.println("No");
        }
    }
}


Measured memory_bytes: 23760
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define inf 1001001001
typedef pair<int,int> P;
#define mod 1000000007

int main(){
    string s;
    cin >> s;
    int ans=inf;
    int x=s.length()-2;
    rep(i,x){
        int a=(s[i]-'0')*100+(s[i+1]-'0')*10+s[i+2]-'0';
        ans=min(ans,abs(753-a));
    }
    cout << ans << endl;
}


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

int main(){
    string S;
    cin >> S;
    reverse(S.begin(), S.end());
    for(int i = 0; i < S.size(); ){
        if(i >= S.size() - 4){
            cout << "NO" << endl;
            return 0;
        }else if(S.substr(i, 5) == "maerd" || S.substr(i, 5) == "esare"){
            i += 5;
        }else if(i == S.size() - 5){
            cout << "NO" << endl;
            return 0;
        }else if(S.substr(i, 6) == "resare"){
            i += 6;
        }else if(i == S.size() - 6){
            cout << "NO" << endl;
            return 0;
        }else if(S.substr(i, 7) == "remaerd"){
            i += 7;
        }else{
            cout << "NO" << endl;
            return 0;
        }
    }
    cout << "YES" << endl;
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int a, b, c;
  cin >> a >> b >> c;
  
  vector<int> v{a,b,c};
  sort(v.begin(), v.end());
  if (v[0] + v[1] == v[2]){
    cout << "Yes" << endl;
  }
  else {
    cout << "No" << endl;
  }
}

Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>

int main(void) {

    int m, f, r, s;

    while (1) {

        (void)scanf("%d %d %d", &m, &f, &r);

        if (m == -1 && f == -1 && r == -1) {
            break;
        }

        s = m + f;

        if (m == -1 || f == -1) {
            printf("F\n");
        }
        else if (s >= 80) {
            printf("A\n");
        }
        else if (s >= 65 && s < 80) {
            printf("B\n");
        }
        else if (s >= 50 && s < 65) {
            printf("C\n");
        }
        else if (s >= 30 && s < 50) {
            if (r >= 50) {
                printf("C\n");
            }
            else {
                printf("D\n");
            }
        }
        else if (s < 30) {
            printf("F\n");
        }
    }
    return 0;
}


Measured memory_bytes: 2056
import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
# from fractions import gcd
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from functools import reduce
from bisect import bisect_left, insort_left
from heapq import heapify, heappush, heappop

INPUT = lambda: sys.stdin.readline().rstrip()
INT = lambda: int(INPUT())
MAP = lambda: map(int, INPUT().split())
S_MAP = lambda: map(str, INPUT().split())
LIST = lambda: list(map(int, INPUT().split()))
S_LIST = lambda: list(map(str, INPUT().split()))

sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7


def main():
    K = INT()
    A, B = MAP()

    for i in range(A, B+1):
        if i%K == 0:
            print("OK")
            sys.exit()

    print("NG")

if __name__ == '__main__':
    main()


Measured memory_bytes: 10048
a = [1,3,5,7,8,10,12]
b = [4,6,9,11]

x, y =map(int, input().split())

if x == 2:
    print('No')
elif x in a and y in a:
    print('Yes')
elif x in b and y in b:
    print('Yes')
else:
    print('No')

Measured memory_bytes: 3060
//
//  atcoder.cpp
//
//
///
#include <bits/stdc++.h>
#include <boost/optional.hpp>
#include <boost/range/irange.hpp>
#include <boost/range/algorithm.hpp>
#include <boost/range/numeric.hpp>
#include <boost/bimap/bimap.hpp>
#include <boost/bimap/multiset_of.hpp>
#include <boost/multi_array.hpp>
#include <boost/integer/common_factor_rt.hpp>
#include <boost/algorithm/string.hpp>
#include <boost/pending/disjoint_sets.hpp>
// #include <atcoder/all>

#define REPI(i, S, N) for(int i=int(S); i<int(N); i++)
#define REP(i, N) REPI(i, 0, N)
#define REC(f, ...) (void)0; const auto f = [&](const auto f, __VA_ARGS__)
using namespace std;
using namespace boost::integer;

using ll = long long;
namespace bst = boost;
// using mint = atcoder::modint1000000007;
template<typename T> class in {
    T value;
public:
    in() { cin >> value; }
    operator const T&() const { return value; }
    operator T&() { return value; }
    in& operator=(T source) { value = source; return *this; }
};
template<> class in<string> : public string {
public:
    in() { cin >> *this; }
};
template<class T> class inseq : public T {
public:
    template<typename... Arg> inseq(Arg... arg) : T(forward<Arg>(arg)...) { for (auto&& i : *this) cin >> i; }
};
template<class T> using invec = inseq<vector<T>>;

auto solve() {
  in<ll> N, K;
  invec<ll> a(N);
  
  vector<bool> dp(K+1, false);
  REP(i, K+1)
    for (auto j : a) {
      if (i < j) break;
      else if (dp[i-j] == false) {
        dp[i] = true;
        break;
      }
    }


  return (dp[K] ? "First" : "Second");
}

template<typename T> void plot(const T& func) { cout << setprecision(9) << func() << endl; }
template<> void plot<void()>(void(&func)()) { func(); }

int main() {
  plot(solve);

  return 0;
}


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

using namespace std;
typedef long long ll;

#define MOD (long long)(1e9+7)
#define REP(i,n) for(ll i = 0; i < n; i++)
#define REP1(i,n) for(ll i = 1; i <= n; i++)

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

int main(void)
{
  string s;
  REP(i, 3) {
    cin >> s;
    cout << s[i];
  }
  cout << endl;

}


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

int main() {
  int  N, M;
  cin >> N >> M;
  if(N >= M) {
    cout << "0" << endl;
  }
  else {
  vector<int> X(M);
  for(int i = 0; i < M; i++) {
    cin >> X.at(i);
  }
  sort(X.begin(), X.end());
  int a = X.at(M-1) - X.at(0);
  vector<int> Y(M-1);
  Y.at(0) = 0;
  for(int i = 0; i < M-1; i++) {
    Y.at(i) = X.at(i+1) - X.at(i);
  } 
  sort(Y.begin(), Y.end());
  reverse(Y.begin(), Y.end());
  int b = 0;
  for(int i = 0; i < N-1; i++) {
    b = b + Y.at(i);
  }
  cout << a - b << endl;
  }
}


Measured memory_bytes: 1024
k = int(input())

ls = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]

print(ls[k-1])

Measured memory_bytes: 38256
#include <iostream>
#include <cstdio>
#include <algorithm>
using namespace std;
#define endl '\n'
#define ll long long
#define pi pair<int, int>
#define f first
#define s second

int n;
string s;

int main(){
	ios::sync_with_stdio(0);
	cin.tie(0);
	
	cin >> s;
	s += 'S';
	n = s.size();
	
	int ret = 0;
	for(int i = 0, j = 0; i < n; i++, j++){
		if(s[i] == 'S'){
			ret = max(ret, j);
			j = -1;
		}
	}
	
	cout << ret << endl;

	return 0;
}

Measured memory_bytes: 3656
#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <cctype>
#include <cmath>
#include <iostream>
#include <queue>
#include <list>
#include <stack>
#include <map>
#include <numeric>
#include <set>
#include <sstream>
#include <string>
#include <vector>
using namespace std;
#define REP(i,a,n) for(int i=(a); i<(int)(n); i++)
#define rep(i,n) REP(i,0,n)
#define FOR(it,c) for(__typeof((c).begin()) it=(c).begin(); it!=(c).end(); ++it)
#define ALLOF(c) (c).begin(), (c).end()
typedef long long ll;

#define INF 100000000
int G[105][105];

struct ST {
  int a, b, c;
};

int main(){
  ios::sync_with_stdio(false);
  int N, M;
  cin >> N >> M;

  rep(i,105) rep(j,105) G[i][j] = INF;
  rep(i,105) G[i][i] = 0;

  vector<ST> v;
  
  rep(i,M){
    int a, b, c;
    cin >> a >> b >> c;
    a--;
    b--;
    v.push_back((ST){a,b,c});
    G[a][b] = c;
    G[b][a] = c;
  }

  rep(k,N) rep(i,N) rep(j,N) G[i][j] = min(G[i][j], G[i][k]+G[k][j]);

  int ret = 0;
  rep(i,v.size()){
    if(G[v[i].a][v[i].b] < v[i].c) ret++;
  }

  cout << ret << endl;
  
  return 0;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#pragma GCC optimize("unroll-loops,no-stack-protector")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
using namespace __gnu_pbds;
using namespace std;
/*
int dx[]={-1,1,0,0};
int dy[]={0,0,-1,1};
*/
#define ull unsigned long long int
#define ll long long int
#define MAX 1000000007
//1e9+7
#define pll pair<ll,ll>
#define pii pair<int,int>
#define IO ios_base::sync_with_stdio(false); cin.tie(NULL);
#define FO ifstream fin("a.in");ofstream fout("a.out");
#define TEST int testcase;cin>>testcase;while(testcase--)
#define all(x) (x).begin(),(x).end()
#define mset0(x) memset((x), 0, sizeof((x)));
#define mset1(x) memset((x), -1, sizeof((x)));
#define endl "\n"
typedef tree<ll,null_type,less<ll>,rb_tree_tag, tree_order_statistics_node_update> indexed_set;
void solve(){
    int a,b;
    cin>>a>>b;
    cout<<a*b;
    return;
}
int main(){
    IO
    //TEST
    solve();
    return(0);
}


Measured memory_bytes: 3648
def main():
    from itertools import product
    n = int(input())
    f = [list(map(int, input().split())) for _ in range(n)]
    p = [list(map(int, input().split())) for _ in range(n)]

    l = [[0, 0], [1, 0], [0, 1], [1, 1]]
    r = range(4)
    ans = - 10 ** 9
    for c in product(r, r, r, r, r):
        v = [l[i] for i in c]
        s = sum(v, [])
        if sum(s) == 0:
            continue
        t = 0
        for x, y in zip(f, p):
            m = sum([i * j for i, j in zip(s, x)])
            t += y[m]

        ans = max(ans, t)

    print(ans)


if __name__ == '__main__':
    main()


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

using namespace std;

int f(long long int a){
    string as=to_string(a);
    return as.length();
}
int main(void){
    // Your code here!
    long long int n;
    std::cin >> n;
    
    long long int b;
    int min=10;
    for (long long int i = 1; i*i <= n; i++) {
        if(n%i==0){
            b=n/i;
            int tmp=max(f(i),f(b));
            if(min>tmp){
                min=tmp;
            }
        }
    }
    std::cout << min << std::endl;
}


Measured memory_bytes: 256
#include<iostream>
#include<cstdlib>
#include<cstring>
#include<climits>
#include<vector>
#include<list>
#include<functional>
#include<algorithm>
#include<string>
#include<cmath>
#include<complex>
#include<set>
#include<map>
#include<stack>
#include<queue>
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n) for(int i=0;i<(n);i++)
using namespace std;
typedef long long ll;
typedef pair<int, int> P;


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

	int key[4] = { 1,9,7,4 };
	int memo[10] = { 0 };
	REP(i, 4) {
		int N;
		cin >> N;
		memo[N]++;
	}
	string res = "YES";
	REP(i, 4) if (memo[key[i]] != 1) res = "NO";
	cout << res << "\n";

	return 0;
}

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

int main() {
  int H, W;
  cin >> H >> W;
  
  H += 2;
  W += 2;
  
  char c;
  for (int i = 0; i < H; i++) {
    // row = vector<W>;
    
    for (int j = 0; j < W; j++) {
      if (i == 0 || i == H - 1 || j == 0 || j == W - 1) {
        cout << '#';
        if (j == W - 1) {
          cout << endl;
        }
      } else {
        cin >> c;
        cout << c;
      }
    }
  }
}


Measured memory_bytes: 256
fun main(args: Array<String>) {
    abc046b()
}

fun abc046b() {
    val (n, k) = readLine()!!.split(" ").map { it.toLong() }

    val answer = k * if (n == 1L) 1 else Math.pow(k - 1.0, n - 1.0).toLong()

    println(answer)
}


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

using namespace std;

#define int ll
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pi;
typedef pair<ll, ll> pl;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<double> vd;
typedef vector<bool> vb;
typedef vector<char> vc;
typedef vector<string> vs;
typedef vector<pi> vp;
typedef vector<pl> vpl;

const int mod = 1e9 + 7;

signed main()
{
    ios_base::sync_with_stdio(false); 
    cin.tie(nullptr); 
    cout.tie(nullptr); 
    cerr.tie(nullptr);    

    int n, m;
    cin >> n >> m;

    int a[n][m];
    for (int i = 0; i < n; ++i){
        string s;
        cin >> s;

        for (int j = 0; j < s.length(); ++j){
            if (s[j] == '.')
                a[i][j] = 0;
            else
                a[i][j] = 1;
        }
    }

    int s[n][m];

    for (int i = 0; i < n; ++i){
        for (int j = 0; j < m; ++j)
            s[i][j] = 0;
    }

    s[0][0] = 1;
    for (int i = 0; i < n; ++i){
        if (a[i][0] == 1) break;
        s[i][0] = 1;
    }

    for (int j = 0; j < m; ++j){
        if (a[0][j] == 1) break;
        s[0][j] = 1;
    }

    for (int i = 1; i < n; ++i){
        for (int j = 1; j < m; ++j){
            if (a[i][j] == 1) continue;
            s[i][j] = (s[i - 1][j] + s[i][j - 1] + mod) % mod;
        }
    }

    cout << s[n - 1][m - 1] << '\n';
}

Measured memory_bytes: 15872
import math
N,K = map(int,input().split())

W = 10**9+7

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

for i in range(1,K+1):
    if (N-K+1) >= i and K-1 >= i-1:
        a = combinations_count(N-K+1, i) % W
        b = combinations_count(K-1, i-1) % W
        print((a*b) % W)
    else:
        print(0)




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

#define error(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }

void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
    cerr << *it << " = " << a << endl;
    err(++it, args...);
}

void code() {
    int n=5;
    int ans=0;
    vector<int> A(1+n);
    for(int i=1; i<=n; i++) {
        cin>>A[i];
    }
    for(int i=1; i<=n; i++) {
        if(A[i]!=i) {
            cout << i << '\n';
        }
    }

}

signed main() {
    std::ios_base::sync_with_stdio(false);
    int t=1;
    // cin>>t;
    for(int i=0; i<t; i++) {
        code();
    }
}


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

int main(){
    int n;
    cin >> n;
    int ans = 0; 
    rep(i, n){
        string s = to_string(i);
        if((s.size() + 1) % 2 == 0){
            ans++;
        }
    }
    cout << ans << endl;
    return 0;
}

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

int main() {
    int X; cin >> X;
    if(X >= 1800){
        cout << 1 << endl;
    } else if(X >= 1600){
        cout << 2 << endl;
    } else if(X >= 1400){
        cout << 3 << endl;
    } else if(X >= 1200){
        cout << 4 << endl;
    } else if(X >= 1000){
        cout << 5 << endl;
    } else if(X >= 800){
        cout << 6 << endl;
    } else if(X >= 600){
        cout << 7 << endl;
    } else {
        cout << 8 << endl;
    }

    return 0;
}

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

bool go() {
  int n;
  cin >> n;
  int prv = 0;
  for(int i = 0; i < n; ++i) {
    int h;
    cin >> h;
    if (h < prv) {
      return false;
    }
    prv = max(prv, h - 1);
  }
  return true;
}


int main() {
  bool ans = go();
  if (ans) {
    cout << "Yes\n";
  } else {
    cout << "No\n";
  }
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <climits>
#include <algorithm>
#include <set>
#include <unordered_map>
#include <queue>
#include <iomanip>

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

int T;

// greatest common divisor
long gcd(long a, long b) {
  long r = 1;
  while (r != 0) {
    r = a%b;
    a = b;
    b = r;
  }
  return a;
}

int main() {
  cin >> T;
  rep(i,T) {
    long a,b,c,d;
    cin >> a >> b >> c >> d;
    if (b > d || a < b) {
      cout << "No" << endl;
      continue;
    }
    if (c+1 >= b) {
      cout << "Yes" << endl;
      continue;
    }
    // c+1 < b (ex. 5, 7)
    long gcdbd = gcd(b, d);
    long num;
    long p;
    if (a-b <= c) {
      if (a-b+d < b) {
        cout << "No" << endl;
        continue;
      }
    }
    a+=b;
    num = (a-c)/gcdbd;
    p = a-num*gcdbd;
    if ((a-c)%gcdbd == 0) {
      p+=gcdbd;
    }
    if (p >= b) {
      cout << "Yes" << endl;
    } else {
      cout << "No" << endl;
    }
  }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
 
using namespace std;
#define ll long long
#define ld long double
 
int main()
{
    ios_base::sync_with_stdio(0),cin.tie(NULL),cout.tie(NULL);
    int n, k;
    cin >> n >> k;
    double a[n+1];
    memset(a, 0, sizeof(a));
    for(int i=1;i<=n;i++) {
        cin >> a[i];
        a[i] = a[i-1] + (a[i] + 1) / 2;
    }
    double sum = 0;
    for(int i=k;i<=n;i++) {
        sum = max(sum, a[i] - a[i-k]);
    }
    printf("%.13f\n", sum);
}


Measured memory_bytes: 1792
#include<iostream>
#include<vector>
#include<string>

using namespace std;

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

	double tot = 0;

	int N;

	cin >> N;

	while (N--) {
		double m;
		string s;

		cin >> m >> s;

		if (s[0] == 'J')
			tot += m;
		else
			tot += m * 380000.0;
	}

	cout.setf(ios::fixed);
	cout.precision(8);
	cout << tot;
}

Measured memory_bytes: 256
/*g++ main.cpp -o main.out*/
/*./main.out*/

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

#define LL long long
#define LD long double
#define Mod 1000000007
#define L_Mod 17100000013

const double eps = 1e-9;
const int INF = 0x3f3f3f3f;
const double PI = 3.1415926535;

#define NO_TLE std::ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);

#define ree(a,n) memset(a,n,sizeof(a));

#define rep(i,n) for(int (i)=0;(i)<(int)(n);++(i))
#define rer(i,l,u) for(int (i)=(int)(l);(i)<=(int)(u);++(i))
#define red(i,l,u) for(int (i)=(int)(l);(i)>=(int)(u);--(i))

int a[100005],b[100005];

int main()
{
    //NO_TLE
    LL n;
    cin>>n;
    rep(i,n+1)cin>>a[i];
    rep(i,n)cin>>b[i];
    LL ans=0;
    rep(i,n)
    {
        if(a[i]>=b[i])
        {
            ans+=b[i];
            b[i]=0;
        }
        else
        {
            ans+=a[i];
            b[i]-=a[i];
        }
        if(a[i+1]>=b[i])
        {
            ans+=b[i];
            a[i+1]-=b[i];
            b[i]=0;
        }
        else
        {
            ans+=a[i+1];
            b[i]-=a[i+1];
            a[i+1]=0;
        }
        //cout<<ans<<endl;
    }
    cout<<ans<<endl;
    return 0;
}







































Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

int main()
{
    int n; cin >> n;    
    
    int minValue = 2147483647;
    int cnt = 0;
    for (int i = 0; i < n; i++) {
        int tmp_p; cin >> tmp_p;
        if (chmin(minValue, tmp_p)) {
            cnt++;
        }    
    }

    cout << cnt << endl;
    return 0;
}

Measured memory_bytes: 256
#include<cstdio>
#include<vector>
#include<algorithm>
using namespace std;

typedef long long ll;
const ll INF = 10000000000;

int main(){
	int v,e;
	ll d[100][100];
	scanf("%d %d",&v,&e);
	fill(d[0],d[0]+10000,INF);
	for(int i=0;i<v;i++) d[i][i] = 0;
	for(int i=0;i<e;i++){
		int s,t;
		ll dist;
		scanf("%d %d %lld",&s,&t,&dist);
		d[s][t] = dist;
	}
	for(int k=0;k<v;k++){
		for(int i=0;i<v;i++){
			for(int j=0;j<v;j++){
				if(d[i][k]!=INF&&d[k][j]!=INF) d[i][j] = min(d[i][j],d[i][k] + d[k][j]);
			}
		}
	}
	bool flag = false;
	for(int i=0;i<v;i++){
		if(d[i][i]<0) flag = true;
	}
	if(flag){
		printf("NEGATIVE CYCLE\n");
	}else{
		for(int i=0;i<v;i++){
			for(int j=0;j<v;j++){
				if(d[i][j]==INF) printf("INF");
				else printf("%lld",d[i][j]);
				if(j==v-1) printf("\n");
				else printf(" ");
			}
		}
	}
	return 0;
}

Measured memory_bytes: 2836
#include <cstdio>
#include <algorithm>
using namespace std;
int N; pair<int, int> Xs[100001];
int main() {
  scanf("%d", &N);
  for(int i = 0, X, L; i < N; ++i) {
    scanf("%d %d", &X, &L);
    Xs[i] = {X+L, X-L};
  }
  sort(Xs, Xs+N);
  int ans = 1, l = Xs[0].second, r = Xs[0].first;
  for(int i = 1; i < N; ++i) {
    if(Xs[i].second >= r) {
      r = Xs[i].first;
      ++ans;
    }
  }
  printf("%d\n", ans);
}

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


def solve(N: int, A: int, B: int):
    if abs(A-B) % 2 == 0:
        print(abs(A-B)//2)
    else:
        if A > B:
            A, B = B, A
        print(min(N-B, A-1) + abs(A-B)//2+1)
    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
    A = int(next(tokens))  # type: int
    B = int(next(tokens))  # type: int
    solve(N, A, B)

if __name__ == '__main__':
    main()


Measured memory_bytes: 3064
#include <iostream>
#include <algorithm>
#include <string>
#include <cstring>
#include <vector>
#include <set>
#include <map>
#define fi first
#define se second
#define pb push_back
#define endl "\n"
#define fastio ios_base::sync_with_stdio(false); cin.tie(nullptr);
using namespace std;
typedef long long ll;
typedef pair<int, int> ii;
typedef vector<int> vi;
typedef vector<ii> vii;

int n;
ll s;

int main() {
	cin >> n;
	for (int i = 1; i <= n; i++) {
		if (!(i % 3 == 0 || i % 5 == 0)) {
			s += i;
		}
	}
	cout << s;
}

Measured memory_bytes: 3636
#include <bits/stdc++.h>
using namespace std;
//#include <boost/multiprecision/cpp_int.hpp>
//using multiInt = boost::multiprecision::cpp_int;

using ll = long long int;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
template<typename Q_temp>
using smaller_queue = priority_queue <Q_temp, vector<Q_temp>, greater<Q_temp> >;

const int INF = (int) 1e9;
const ll LINF = (ll) 4e18;
const ll MOD = (ll) (1e9 + 7);
const double PI = acos(-1.0);
const int limit = 100010;

#define REP(i,m,n) for(ll i = m; i < (ll)(n); ++i)
#define rep(i,n) REP(i, 0, n)
#define MP make_pair
#define MT make_tuple
#define YES(n) cout << ((n) ? "YES" : "NO") << endl
#define Yes(n) cout << ((n) ? "Yes" : "No") << endl
#define Possible(n) cout << ((n) ? "Possible" : "Impossible") << endl
#define all(v) v.begin(), v.end()
#define NP(v) next_permutation(all(v))
#define dbg(x_) cerr << #x_ << ":" << x_ << endl;
#define dbg2(x_) for(auto a_ : x_) cerr << a_ << " "; cerr << endl;
#define dbg3(x_ , sx_) rep(i, sx_) cerr << x_[i] << " "; cerr << endl;
vector<int> Dx = {0, 0, -1, 1, -1, 1, -1, 1, 0};
vector<int> Dy = {1, -1, 0, 0, -1, -1, 1, 1, 0};

inline ll CEIL(ll a, ll b) {
    return (a + b - 1) / b;
}

//------------------------------------------------------

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int h, w, n, sr, sc;
    cin >> h >> w >> n >> sr >> sc;
    sr--, sc--;
    string s, t;
    cin >> s >> t;
    int l, r;
    l = r = sr;
    int l_cnt = 0, r_cnt = 0;

    rep(i, n) {
        if (s[i] == 'D') r++;
        else if (s[i] == 'U') l--;
        if (l < 0 || r >= h) {
            if (l < 0 && r_cnt > 0 && r < h - 1) {
                l++, r++;
                r_cnt--;
            } else if (r >= h && l_cnt > 0 && l >= 1) {
                l--, r--;
                l_cnt--;
            } else {
                YES(false);
                return 0;
            }
        }
        if (t[i] == 'U') {
            if (l < r) r--;
            else l_cnt++;
        } else if (t[i] == 'D') {
            if (l < r) l++;
            else r_cnt++;
        }
    }

    l = r = sc;
    l_cnt = 0, r_cnt = 0;

    rep(i, n) {
        if (s[i] == 'R') r++;
        else if (s[i] == 'L') l--;
        if (l < 0 || r >= w) {
            if (l < 0 && r_cnt > 0 && r < w - 1) {
                l++, r++;
                r_cnt--;
            } else if (r >= w && l_cnt > 0 && l >= 1) {
                l--, r--;
                l_cnt--;
            } else {
                YES(false);
                return 0;
            }
        }
        if (t[i] == 'L') {
            if (l < r) r--;
            else l_cnt++;
        } else if (t[i] == 'R') {
            if (l < r) l++;
            else r_cnt++;
        }
    }


    YES(true);

    return 0;
}



Measured memory_bytes: 920
program ccc

implicit none
integer(8) :: l, r, i, j, ans

read*, l, r

do i=1,10000000
if(l>=2019) then
l=l-2019
r=r-2019
else
exit
end if
end do

if(r>=2019) then
write(*,'(i0)') 0
return
end if

ans=1000000

do i=l, r
 do j=i+1, r
 ans=min(ans,mod(i*j,2019))
 end do
end do

write(*,'(i0)') ans

end program

Measured memory_bytes: 256
#include<stdio.h>
#include<string.h>
#include<math.h>

int main() {
    char c[4];
    scanf("%s",c);
    int count=0;
  	int count0=0;
    for (int i=0;i<3;i++) {
        if (c[i]=='R') {
          	count=1;
            for (int j=i+1;j<3;j++) {
                if (c[j]=='R') count++;
              	else break;
            }
        }
      	if (count>count0) count0=count;
    }
    printf("%d",count0);
    return 0;
}

Measured memory_bytes: 1736
#include "bits/stdc++.h"
using namespace std;
using ll = long long; using ull = unsigned long long;
//#define int ll
using vb = vector<bool>; using vvb = vector<vb>;
using vi = vector<int>; using vvi = vector<vi>;
using vl = vector<ll>; using vvl = vector<vl>;
template<class T> using V = vector<T>;
template<class T> using vv = vector<V<T>>;
template<class T> using VV = vector<V<T>>;
#define fi first
#define se second
#define maxs(x,y) (x=max(x,y))
#define mins(x,y) (x=min(x,y))
using pii = pair<int,int>; using pll = pair<ll,ll>;
#define FOR(i,a,b) for(ll i = (a); i < (ll)(b); ++i)
#define REP(i,n) FOR(i,0,n)
#define RFOR(i,a,b) for(ll i = (ll)(b)-1;i >= a;--i)
#define RREP(i,n) RFOR(i,0,n)
#define ALL(obj) (obj).begin(), (obj).end()
#define rALL(obj) (obj).rbegin(), (obj).rend()
#define eb(val) emplace_back(val)
const double PI = acos(-1);
const double EPS = 1e-10;
const ll MOD = 1e9+7;
void cioacc(){//accelerate cin/cout
  cin.tie(0);
  ios::sync_with_stdio(false);
}
signed main(){
  int n;
  cin >> n;
  vi b(n);
  vi ans;
  REP(i,n) cin >> b[i];
  REP(i,n){
    if(b[i]>i+1){
      puts("-1");
      return 0;
    }
    ans.insert(ans.end()-b[i]+1,b[i]);
  }
  reverse(ALL(ans));
  for(auto i:ans) cout << i << endl;
}

Measured memory_bytes: 256