akhauriyash/Code-Regression huggingface dataset:
//shara's here
#include <bits/stdc++.h>
using namespace std;
typedef int q;
typedef double w;
typedef string s;
typedef long long ll;
typedef long double ld;
void yoinks(){
std::ios::sync_with_stdio(false);
cin.tie(0); cout.tie(0);
}
int main(){
    yoinks();
    ll a,b,k,ok;
    cin>>a>>b>>k;
    ll ansa,ansb;
    ok=a-k;
    if(a==b&&a==k){ansa=0;ansb=b;}
    else if(ok<=0){
        ansa=0;
        ansb=b-(k-a);
        if(ansb<0)ansb=0;
    }
    else {ansa=ok; ansb=b;}
    cout<<ansa<<' '<<ansb<<endl;




return 0;}
/*
███████████████████████████████████████████████████
███████████████████████████████████████████████████
██████████████████████████████████▀████████████████
██████████████████████████████████░▀███████████████
██████████████████████████████▌███░░░▀▀████████████
██▀████████████████████▐██████░▐██░░░░░░▀▀█████████
██░████████████████████▐█████▌░██▌▄░░░░▄▄░▄████▀███
█▌░███████████████████▀░█████░░░█░░░▄████░░███▀▐███
█▌░▐██████████████████░░████▌░░░▀░░▀███▀▀░▐███▄████
██░▀██████████████▌▐█▐▄▄████▌░░░░░░░░░░░░░▌████████
███░███████████████▀░▄▄██▀█▐░░░░░░░░░░░░░░▐████████
███▄░██████████████▄░░░░░░▀▀▀░░░░░░░░░░░░░█▐███████
████▄░██████████████████▄▄▄▄▄▄▐▄░░░░░░░░░░░████████
█████▄█████████████████▀▀▀▀▀▀░░░░░░░░░░░░░░████████
████████████████████████▄░░░░░░░░░░░░░░░▄░░████████
██████████████████████████▄▄▄░░░░░░░░░▄█░▄█████████
████████████████████████████████▄░░░░██▄███▀░░▀████
█████████████████████████████▀█████▄███▀▀▀░░▄▄░████
████████████████████████████▀░░▀░░▀▀░░░░▄▄▄██▀░░▀▀█
███████████████████████████▌░░░░░░░░░░░███████░░░▄█
███████████████▄░▀████████▀░░░░░░▀░░░░███████▌░░░██
███▄▄████████████▄░▀██████▄░░░░░█░░░░████████░░░▀▀
░▀█████████████████▄░▀█████░░░░██░░░░▀██████░░░░░▄█
▐█▄▀█████████████████▄░▀████░░░██▌░░░▐████▀░░░░▄███
▐███▄▀▀█████████████████▄░▀▀░░░░▀██▌▄█▀▀░░░▄▄██████
▀▀▀▀▀░░░▀▀▀▀▀░░░▀▀▀▀▀▀▀▀▀▀▀░░░░░░░▀▀░░░░░░▀▀▀▀▀▀▀▀▀
*/


Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<queue>
#include<cstring>
#define M 500010
using namespace std;
 
int n,m,num,cnt;
int head[M],c[M],in[M][2];
char s[M];bool vis[M];
struct point{int to,next;}e[M<<1];
void add(int from,int to)
{
	e[++num].next=head[from];
	e[num].to=to;
	head[from]=num;
}

queue<int>q;
int main()
{
	scanf("%d%d",&n,&m);
	scanf("%s",s+1);
	for(int i=1;i<=n;i++) c[i]=s[i]-'A';
	for(int i=1;i<=m;i++)
	{
		int x,y;scanf("%d%d",&x,&y);
		add(x,y); add(y,x);
		in[x][c[y]]++; in[y][c[x]]++;
	}
	for(int i=1;i<=n;i++)
		if(!in[i][0]||!in[i][1])
			q.push(i),cnt++,vis[i]=true;
	while(!q.empty())
	{
		int x=q.front();q.pop();
		for(int i=head[x];i;i=e[i].next)
		{
			int to=e[i].to;in[to][c[x]]--;
			if((!in[to][0]||!in[to][1])&&!vis[to])
				q.push(to),cnt++,vis[to]=true;
		}
	}
	printf(cnt==n?"No":"Yes");
	return 0;
}

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

int main() {
	string s;
	cin >> s;
	string t = "abcdefghijklmnopqrstuvwxyz";
	int num[26] = {};
	string ans = "None";
	for (int i = 0;i < s.size();i++) {
		num[s.at(i) - 'a']++;
	}
	for (int i = 0;i < 26;i++) {
		if (num[i]==0) {
			ans = t[i];
			break;
		}
	}
	cout << ans << endl;
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
int main(){
    int n;
    cin >> n;
    int t[110];
    for(int i=0; i<n; i++){
        cin >> t[i];
    }
    int m;
    cin >> m;
    for(int i=0; i<m; i++){
        int p, x;
        cin >> p >> x;
        int ans = 0;
        for(int j=0; j<n; j++){
            if(j==p-1){
                ans+=x;
            }else{
                ans+=t[j];
            }
        }
        cout << ans << endl;
    }
    return 0;
}

Measured memory_bytes: 256
def is_prime(n):
    for i in range(2, n + 1):
        if i * i > n:
            break
        if n % i == 0:
            return 0
    return 1


sl = [0, 0]
for j in range(2, 10 ** 5 + 1):
    if j % 2 == 0:
        sl.append(sl[j - 1])
    elif is_prime(j) == 1 and is_prime((j + 1) // 2) == 1:
        sl.append(sl[j - 1] + 1)
    else:
        sl.append(sl[j - 1])

q = int(input())
for _ in range(q):
    l, r = map(int, input().split())
    print(sl[r] - sl[l-1])


Measured memory_bytes: 78232
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vec;
typedef vector<vec> mat;
typedef pair<ll,ll> pll;
const ll mod=1e9+7;
//const ll mod=998244353;
const ll inf=1LL<<61;

int main() {
  ll k;
  cin >> k;
  ll cnt=1;
  ll tmp=7;
  while(tmp%k) {
    tmp=tmp*10+7;
    tmp%=k;
    cnt++;
    if(cnt>1e7) break;
  }
  if(cnt>1e7) cnt=-1;
  cout << cnt << endl;
}

Measured memory_bytes: 3628
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
#include <functional>
using namespace __gnu_pbds; 
using namespace std;



typedef tree<long long, null_type, less<long long>, rb_tree_tag, 
             tree_order_statistics_node_update> 
    new_data_set; 
 
//defines
typedef long long ll;
typedef long double ld;
#define TIME clock() * 1.0 / CLOCKS_PER_SEC
#define prev _prev
#define y0 _y0
#define kill _kill
#define MAX 10000
 #define pie 3.1415926535898

ll solve(ll t)
{
    ll a,b,c,d;
    cin>>a>>b>>c>>d;
    ld hm=0.5*(c*60+d);
    ld mm=6*d;
    hm=(pie*hm)/180.0;
    mm=(pie*mm)/180.0;
    ld ans=(a*cos(hm)-b*cos(mm))*(a*cos(hm)-b*cos(mm))+(a*sin(hm)-b*sin(mm))*(a*sin(hm)-b*sin(mm));
    ans=sqrt(ans);
    cout<<fixed<<setprecision(20)<<ans;
 if(t>0)cout<<"\n";
return 0;
}

int32_t main()
{
#ifdef ONPC
    freopen("input.txt", "r", stdin);
#endif
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    ll t=1;
   //cin>>t;
    while(t--)
    {
        solve(t);
    }
    
        
    return 0;
}


Measured memory_bytes: 4172
#include <iostream>
using namespace std;
int main(void){
    long long n,w,d[102][100002];
    cin>>n>>w;
    for(int i=0;i<=w;i++){
        d[0][i]=0;
    }
    for(int i=1;i<=n;i++){
        int q,v;
        cin>>q>>v;
        for(int j=0;j<=w;j++){
            if(j-q<0){
                d[i][j]=d[i-1][j];
            }else{
                d[i][j]=max(d[i-1][j],d[i-1][j-q]+v);
            }
        }
    }
    
    cout<<d[n][w]<<endl;
}



Measured memory_bytes: 79744
#include <bits/stdc++.h>
using ll = long long;
#define FOR(i, k, n) for(ll i = (k); i < (n); i++)
#define FORe(i, k, n) for(ll i = (k); i <= (n); i++)
#define FORr(i, k, n) for(ll i = (k)-1; i > (n); i--)
#define FORre(i, k, n) for(ll i = (k)-1; i >= (n); i--)
#define REP(i, n) FOR(i, 0, n)
#define REPr(i, n) FORre(i, n, 0)
#define ALL(x) (x).begin(), (x).end()
#define ALLr(x) (x).rbegin(), (x).rend()
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
using namespace std;

const int INF = 1001001001;

int main(void){
  int n;
  cin >> n;
  map<int, int> mp;
  int over = 0;
  REP(i, n){
    int a;
    cin >> a;
    REP(j, 8){
      if(a < 400*(j+1)){
        mp[j]++;
        break;
      }
    }
    if(a >= 3200) over++;
  }
  int m = mp.size();
  printf("%d %d\n", max(1, m), m+over);
  return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <math.h>
#include <stdbool.h>
#define LL long long
#define INF 1<<31-1
#define MIN(x,y) ((x)<(y)?(x):(y))
#define MAX(x,y) ((x)<(y)?(y):(x))
#define FOR(i,a,n) for(i=a;i<n;i++)
#define MOD 1000000007
#define NUM 100001

void swap(int* a,int* b){int tmp=*a;*a=*b;*b=tmp;}
int GCD(int a,int b){int c=1,tmp=MAX(a,b);b=MIN(a,b);a=tmp;while(c!=0){c=a%b;a=b;b=c;}return a;}
int LCM(int a,int b){return a*b/GCD(a,b);}
int POW(LL a,LL n){LL ans=1;while(n>0){if(n&1)ans=ans*a%MOD;a=a*a%MOD;n>>=1;}return (int)ans;}
int icmp(const void* a,const void* b){return *(int*)a-*(int*)b;}
int ccmp(const void* a,const void* b){return *(char*)a-*(char*)b;}
int scmp(const void* a,const void* b){return strcmp(*(char**)a,*(char**)b);}
LL fac[NUM],finv[NUM],inv[NUM];
void comi(){int i;fac[0]=fac[1]=1;finv[0]=finv[1]=1;inv[1]=1;FOR(i,2,NUM){fac[i]=fac[i-1]*i%MOD;inv[i]=MOD-inv[MOD%i]*(MOD/i)%MOD;finv[i]=finv[i-1]*inv[i]%MOD;}}
int com(int n,int k){if(n<k||n<0||k<0)return 0;return fac[n]*(finv[k]*finv[n-k]%MOD)%MOD;}


int main(){
  double a,b,x,ans;
  scanf("%lf%lf%lf",&a,&b,&x);
  if(a*a*b<x*2)ans=atanl((2.0*a*a*b-2.0*x)/(a*a*a))*180.0/3.1415926535;
  else ans=atanl((a*b*b)/(2*x))*180.0/3.1415926535;

  printf("%.10f\n",ans);
	return 0;
}


Measured memory_bytes: 128
#define _CRT_SECURE_NO_WARNINGS
#include<bits/stdc++.h>
using namespace std;
#ifndef FAST_IO
 #define IOS ios_base::sync_with_stdio(false);cin.tie(nullptr);
#endif

#define FILE_IO freopen("input.txt","r",stdin)
#define int long long
#define f first
#define s second
#define endl '\n'
#define all(c) c.begin(),c.end()
#define debug(x) cerr << #x << " = " << x << endl;

const int MOD = 1e9 + 7;
const int INF = 1e18;

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
template <typename T>void print(T t){for(auto &it : t)cout<<it<<" ";}
inline int powerexp(int a, int b, int m = MOD){ int res = 1;while(b){if(b&1)res = res * a % m;a = a * a % m,b >>= 1;}return res % m;}
inline int modinv(int a){ return powerexp(a,MOD-2,MOD);}
inline int lcm(int a, int b){ int g = __gcd(a,b);return a/g*b;}
inline int add(int x, int y){ x += y; if (x >= MOD) x -=  MOD; return x;}
inline int mul(int x, int y){ return (x * 1ll * y) % MOD;}
inline int sub(int x, int y){ x -= y; if (x<0) x += MOD; return x ;}

//-------------------< start here >-------------------------// 
void solve(){
	
	  int n, a, b;
	  cin >> n >> a >> b;
	  int ret = min(n * a, b);
	  cout << ret << endl;
}
//-----------------------------
//comment from here for TOPCODER 
int32_t main(){
   IOS;
   solve();
   //find();
   #ifdef LOCAL_DEFINE
   cerr << "time elapsed " << (double)clock()/CLOCKS_PER_SEC << endl;
   #endif
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef vector<int> vi;
typedef vector<vector<int> > vii;
typedef vector<string> vs;
#define ifr(i,n) for((i)=0;(i)<(n);i++)
#define dfr(i,n) for((i)=(n);(i)>=0;i--)
int main(){
  string str;
  cin>>str;
  str+=str;
  string search;
  cin>>search;
  for(int i=0;i<str.size();i++){
    if(search == str.substr(i,search.size())){
      cout<<"Yes"<<endl;
      break;
    }
    if(i==str.size()-1)
      cout<<"No"<<endl;
  }

  return 0;
}

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

#define mp make_pair
#define pb push_back


typedef long long ll;
typedef long long llong;
typedef long double ld;

using namespace std;

template <typename T> void dprint(T begin, T end) {
    for (auto i = begin; i != end; i++) {
        cerr << (*i) << " ";
    }
    cerr << "\n";
}
const int C = 1000;

int a[510][510];
int H, W, h, w;

void print() {
    cout << "Yes\n";
    for (int i = 0; i < H; ++i) {
        for (int j = 0; j < W; ++j)
            cout << a[i][j] << " ";
        cout << "\n";
    }
}

int main() {
    cin >> H >> W >> h >> w;
    if (H % h != 0) {
        for (int i = 0; i < H; ++i) {
            for (int j = 0; j < W; ++j) {
                if (i % h == h - 1)
                    a[i][j] = -(h - 1) * C - 1;
                else
                    a[i][j] = C;
            }
        }
        print();
    }
    else if (W % w != 0) {
        for (int i = 0; i < H; ++i) {
            for (int j = 0; j < W; ++j) {
                if (j % w == w - 1)
                    a[i][j] = -(w - 1) * C - 1;
                else
                    a[i][j] = C;
            }
        }
        print();
    }
    else {
        cout << "No\n";
    }
    return 0;
}




Measured memory_bytes: 2560
ac = 0
wa = 0
tle = 0
re = 0
for t in range(int(input())):
    s = input()
    if "AC" in s:
        ac += 1
    elif "WA" in s:
        wa += 1
    elif "TLE" in s:
        tle += 1
    else:
        re += 1
print("AC x ", ac)
print("WA x ", wa)
print("TLE x ", tle)
print("RE x ", re)


Measured memory_bytes: 9116
#include <bits/stdc++.h>
#define rep(i,n)for(int i=0;i<(n);i++)
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
typedef tuple<ll,ll,ll> T;
const long long INF = 1LL<<60;
// const int MOD = 1000000000+7;
#define rev(s) (string((s).rbegin(), (s).rend()))
// cout << fixed << setprecision(10) << ans << endl; 有効桁数指定
// *min_element(c + l, c + r) *max_element(c + l, c + r) 配列の中のmin-max
// int dx[8]={1,1,0,-1,-1,-1,0,1};
// int dy[8]={0,1,1,1,0,-1,-1,-1};
// int dx[4]={1,0,-1,0};
// int dy[4]={0,1,0,-1};
// ~ は、-1の時だけfalse

map<P,int> ma;
ll ans[10];

int main () {

    ll h,w,n;cin>>h>>w>>n;

    rep(i,n) {
        ll a,b;cin>>a>>b;
        a--;b--;
        rep(j,3) {
            rep(k,3) {
                if (a-j<0||b-k<0||a-j+2>h-1||b-k+2>w-1) continue;
                if (!ma.count(P(a-j,b-k))) {
                    ma[P(a-j,b-k)]=1;
                } else {
                    ma[P(a-j,b-k)]++;
                }
            }
        }
    }

    ll sum=0;

    for (auto it = ma.begin();it!=ma.end();it++) {
        sum++;
        ans[it->second]++;
    }

    ans[0]=(h-2)*(w-2)-sum;

    rep(i,10) {
        cout<<ans[i]<<endl;
    }


}

Measured memory_bytes: 56448
#include <bits/stdc++.h>
#define pb push_back
#define ff first
#define ss second
#define all(x) (x).begin(), (x).end()
using namespace std;
using ll = long long;
using vi = vector<int>;
using pii = pair<ll, ll>;
const int INF = 0x3f3f3f3f;
int main() {
  int h, a;
  cin >> h >> a;
  cout << h / a + (h % a != 0) << endl;
}

Measured memory_bytes: 3620
#include<bits/stdc++.h>
using namespace std;
using Int = long long;
signed main(){
  Int n,h;
  cin>>n>>h;
  vector<Int> a(n),b(n);
  for(Int i=0;i<n;i++) cin>>a[i]>>b[i];
  Int x=*max_element(a.begin(),a.end());
  Int s=0,c=0;
  for(Int i=0;i<n;i++) if(b[i]>x) s+=b[i],c++;
  using P = pair<Int, Int>;
  vector<P> v(n);
  for(Int i=0;i<n;i++) v[i]=P(b[i],a[i]);
  sort(v.rbegin(),v.rend());
  {
    Int sum=0;
    for(Int i=0;i<n;i++){
      sum+=max(v[i].first,x);
      if(sum>=h){
	cout<<i+1<<endl;
	return 0;
      }
    }
  }
  Int ans=c+((h-s)+x-1)/x;
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 3328
n, m = (int(i) for i in input().split())
a = [int(i) for i in input().split()]
bc = [[int(i) for i in input().split()] for i in range(m)]

bc = sorted(bc, key=lambda x: (x[1]), reverse=True)
count = 0
for b, c in bc:
    count += b
    a.extend([c]*b)
    if count >= n:
        break
print(sum(sorted(a,reverse=True)[:n]))

Measured memory_bytes: 31552
#include<iostream>
#include<cstdio>
#include<string>
#include<vector>
#include<queue>
#include<cmath>
#include<algorithm>
#include<iomanip>
#include<functional>
#include<set>
#include<map>
#include<climits>
#include<numeric>
#include<utility>
#define ul unsigned long long int
#define ll long long int
#define MAX 1000000+1
using namespace std;
#define F first
#define S second
#define pi 2*acos(0.0)
#define PB push_back
#define CL clear()





int main()
{

  ll n, b = 2;
  vector<ll> v;
  v.clear();
  cin >> n;
  while(n)
  {
      if(n > 0)
      {
          v.PB(n%2);
//          cout << n%2 << endl;
          n =  n/2; n = (-1)*n;


      }
      else
      {
          n = (-1)*n;
          v.PB(n%2);
//          cout << n%2 << endl;
          n = (n + n%2)/2;


      }
  }
//  cout << v.size();
if(v.size()==0)
{
    cout << 0; return 0;
}
reverse(v.begin(), v.end());
  for(ll i = 0; i < v.size(); i++) cout << v[i];

    return 0;
}



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

#define pb push_back
#define mp make_pair
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef complex<double> point;
#define xx real()
#define yy imag()

#define REP(i, a, b) for(int i = (a); i < (int)(b); i++)
#define REPN(i, a, b) for(int i = (a); i <= (int)(b); i++)
#define FA(it, x) for(__typeof((x).begin()) it = (x).begin(); it != (x).end(); it++)
#define SZ(x) (int)(x).size()
#define BE(x) (x).begin(), (x).end()
#define SORT(x) sort(BE(x))
#define _1 first
#define _2 second

#define x1 gray_cat_x1
#define y1 gray_cat_y1

template<class T> T gcd(T a, T b) { return b ? gcd(b, a % b) : a; }

#define file "I1"

const double EPS = 1e-9;
const double PI = acos(-1.);
const ll INF = 1e18;
const ll MOD = 1e9 + 7;

const int MAXN = 5e3 + 5, MAXB = 205;

int dis[MAXN];

int b[MAXN][MAXB];

ll add_val[MAXN];
ll dp[MAXN];

vector<pii> left_ends[MAXB];

void add(int l, int r, ll val){
	add_val[l] += val;
	add_val[r + 1] -= val;
}

void solve(){
	int n, m;
	scanf("%d%d", &n, &m);
	REPN(i, 2, n){
		scanf("%d", &dis[i]);
	}
	REPN(i, 1, n){
		REPN(j, 1, m){
			scanf("%d", &b[i][j]);
		}
	}
	
	ll ans = 0;
	
	REPN(i, 1, n){
		REPN(j, 1, n + 1){
			add_val[j] = 0;
		}
		
		add(1, i - 1, -dis[i]);
		
		REPN(j, 1, m){
			int last = i;
			while(!left_ends[j].empty() && left_ends[j][SZ(left_ends[j]) - 1]._1 < b[i][j]){
				add(left_ends[j][SZ(left_ends[j]) - 1]._2, last - 1, -left_ends[j][SZ(left_ends[j]) - 1]._1);
				last = left_ends[j][SZ(left_ends[j]) - 1]._2;
				left_ends[j].pop_back();
			}
			add(last, i, b[i][j]);
			left_ends[j].pb(mp(b[i][j], last));
		}
		
		REPN(j, 1, n){
			add_val[j] += add_val[j - 1];
			dp[j] += add_val[j];
		}
		
		REPN(j, 1, i){
			ans = max(ans, dp[j]);
		}
		
		/*REPN(j, 1, i){
			printf("%lld ", dp[j]);
			
		}
		putchar('\n');*/
	}
	
	printf("%lld\n", ans);
}   

int main(){

    //freopen(file".in", "r", stdin); freopen(file".out", "w", stdout);
    int t = 1;
    //cin >> t;
    while(t--){
        solve();    
    }
}


Measured memory_bytes: 4480
#include <iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<iomanip>
using namespace std;

int N, K;

int main(void) {

	cin >> N >> K;

	long double ans = 0.0;

	for (int i = 1; i <= N; i++) {
		int M = 0;
		int tmp = i;
		while (tmp <= K - 1) {
			tmp *= 2; M++;
		}
		long double val = 1.0;
		for (int j = 1; j <= M; j++) {
			val /= 2.0L;
		}

		ans += 1.0L / (1.0L*N)*val;

	}

	cout <<setprecision(15)<<fixed<< ans << endl;

	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <vector>
#include <queue>
#include <ctime>
#include <map>
#include <iomanip>
using namespace std;
 
#define FOR(i,a,b) for (ll i = (a); i < (b); i++)
#define REP(i,n) FOR(i,0,n)
 
long gcd(long long a, long long b){
	if (a%b==0){
		return b;
	}
	else{
		return gcd(b,a%b);
	}
}
 
long lcm(long long a, long long b){
	return a / gcd(a,b) * b;
}
 
template<typename A, typename B> inline bool chmax(A &a, B b) { if (a < b) { a = b; return 1; } return 0; }
template<typename A, typename B> inline bool chmin(A &a, B b) { if (a > b) { a = b; return 1; } return 0; }
 
typedef long long ll;
 
const ll INF = 1ll<<60;
const ll MOD = 1000000007;
const double EPS = 1e-10;

int n;

int main(){
	cin >> n;

	cout << (n/2)-((n+1)%2) << endl;

	return 0;
}

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

int main() {
  int N;
  cin >> N;
  int ans = 1;
  int m = 0;
  for(int i = 2; i < N + 1; i += 2) {
    int sum = 0;
    int num = i;
    int now = i;
    while(now % 2 == 0) {
      sum++; now /= 2; 

    }
    if(m < sum) { ans = num; m = sum; }
  }
 

  cout << ans;
  return 0;
}

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

int main(){
  int score[] = {0,13,1,2,3,4,5,6,7,8,9,10,11,12};
  
  int a,b;

  cin >> a >> b;

  if(score[a] > score[b]){
    cout << "Alice" << "\n";
  } else if(score[a] < score[b]){
    cout << "Bob" << "\n";
  } else {
    cout << "Draw" << "\n";
  }
  
  return 0;
}


Measured memory_bytes: 256
N = int(input())
A = list(map(int, input().split()))
M = max(A)

B = [0]*(M+1)
for i in range (0, N):
	B[A[i]]+=1

for i in range (0, M+1):
	if B[i] > 2:
		B[i] = 2-(B[i]%2)
        
count = 0

for i in range (0, M+1):
	if B[i] == 2:
		B[i] = 1
		count+=1
        
print(sum(B)-(count%2))

Measured memory_bytes: 20740
import java.util.Scanner;
 
public class Main{
 
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        String S = sc.next();
 
        int K = sc.nextInt();
 
        char c = S.charAt(K-1);
 
        StringBuilder sb  = new StringBuilder();
        for (int i = 0; i <N ; i++) {
            char c2  = S.charAt(i);
 
            if(c2 != c ){
                sb.append("*");
            }else{
                sb.append(c2);
            }
        }
 
        System.out.println(sb.toString());
    }
 
}

Measured memory_bytes: 21716
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author
 */

#include <iostream>
#include <fstream>

#include <bits/stdc++.h>

#define pb push_back
#define sz(v) ((int)(v).size())
#define all(v) (v).begin(),(v).end()
#define mp make_pair

using namespace std;

typedef long long int64;
typedef vector<int> vi;
typedef pair<int, int> ii;

const int64 MODULO = 998244353;
const int64 BASE = ((int64) 1e18) % MODULO;

class TaskC {
 public:
  vector<vector<int>> readGraph(int n, istream& in) {
    int m;
    in >> m;
    vector<vector<int>> res(n);
    for (int i = 0; i < m; ++i) {
      int a;
      int b;
      in >> a;
      in >> b;
      --a;
      --b;
      if (a < b) {
        res[a].push_back(b);
      } else {
        res[b].push_back(a);
      }
    }
    return res;
  }

  int64 mypow(int64 a, int64 k) {
    int64 r = 1;
    while (k > 0) {
      if (k & 1) {
        r = r * a % MODULO;
      }
      a = a * a % MODULO;
      k >>= 1;
    }
    return r;
  }

  void FWHT(vector<int>& P, bool inverse) {
    for (int len = 1; 2 * len <= P.size(); len <<= 1) {
      for (int i = 0; i < P.size(); i += 2 * len) {
        for (int j = 0; j < len; j++) {
          int u = P[i + j];
          int v = P[i + len + j];
          P[i + j] = u + v;
          if (P[i + j] >= MODULO) P[i + j] -= MODULO;
          P[i + len + j] = u - v;
          if (P[i + len + j] < 0) P[i + len + j] += MODULO;
        }
      }
    }

    if (inverse) {
      int64 inv = mypow(P.size(), MODULO - 2);
      for (int i = 0; i < P.size(); i++)
        P[i] = P[i] * inv % MODULO;
    }
  }

  void solveOne(istream &in, ostream &out) {
    int n;
    in >> n;
    vector<int> prod(1 << 17, 1);
    vector<int> count(n + 5);
    for (int step = 0; step < 3; ++step) {
      auto g = readGraph(n, in);
      vector<int> grundy(n);
      for (int i = n - 1; i >= 0; --i) {
        for (int x : g[i]) {
          ++count[grundy[x]];
        }
        int j = 0;
        while (count[j] > 0) ++j;
        grundy[i] = j;
        for (int x : g[i]) {
          --count[grundy[x]];
        }
      }
      vector<int> poly(1 << 17);
      int64 pow = 1;
      for (int i = 0; i < n; ++i) {
        pow = pow * BASE % MODULO;
        poly[grundy[i]] = (poly[grundy[i]] + pow) % MODULO;
      }
      FWHT(poly, false);
      for (int i = 0; i < poly.size(); ++i) {
        prod[i] = prod[i] * int64(poly[i]) % MODULO;
      }
    }
    FWHT(prod, true);
    out << prod[0] << "\n";
  }

  void solve(std::istream &in, std::ostream &out) {
    int nt = 1;
    for (int it = 0; it < nt; ++it) {
      solveOne(in, out);
    }
  }
};


int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  TaskC solver;
  std::istream& in(std::cin);
  std::ostream& out(std::cout);
  solver.solve(in, out);
  return 0;
}


Measured memory_bytes: 6272
N = int(input())
A = list(map(int,input().split()))
x = 0
for i in range(N):
    x += (-1)**i*A[i]
X = [x]
for i in range(N-1):
    x = 2*A[i]-x
    X.append(x)
X = [str(x) for x in X]
print(' '.join(X))

Measured memory_bytes: 18504
import sys
import heapq
import math
import fractions
import bisect
import itertools
from collections import Counter
from collections import deque
from operator import itemgetter
def input(): return sys.stdin.readline().strip()
def mp(): return map(int,input().split())
def lmp(): return list(map(int,input().split()))

n,k=mp()
print(n-k+1)

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

int main(){
  string s;
  cin>>s;
  string t="AC";
  if(s[0]!='A') t="WA";
  if(s[1]<'a') t="WA";
  if(s[s.size()-1]<'a') t="WA";
  int cnt=0;
  rep(i,2,s.size()-1){
    if(s[i]=='C') cnt++;
    else if(s[i]<'a') t="WA";
  }
  if(cnt!=1) t="WA";
  cout<<t<<endl;
}

Measured memory_bytes: 256
import java.io.IOException;
import java.util.NoSuchElementException;

fun main(args: Array<String>) {
    val fs = FastScanner()
    val N = fs.nextInt()
    val s = IntArray(N)
    (1..N).forEach {
        s[it - 1] = fs.nextInt()
    }

    s.sort()
    val sum = s.sum()
    if (sum % 10 != 0) {
        println(sum)
    } else {
        val num = s.find {
            it % 10 != 0
        }
        if (num == null) {
            println(0)
        } else {
            println(sum - num)
        }
    }
}
internal class FastScanner {
    private val `in` = System.`in`
    private val buffer = ByteArray(1024)
    private var ptr = 0
    private var buflen = 0
    private fun hasNextByte(): Boolean {
        if (ptr < buflen) {
            return true
        } else {
            ptr = 0
            try {
                buflen = `in`.read(buffer)
            } catch (e: IOException) {
                e.printStackTrace()
            }

            if (buflen <= 0) {
                return false
            }
        }
        return true
    }

    private fun readByte(): Int {
        return if (hasNextByte()) buffer[ptr++].toInt() else -1
    }

    private fun isPrintableChar(c: Int): Boolean {
        return 33 <= c && c <= 126
    }

    operator fun hasNext(): Boolean {
        while (hasNextByte() && !isPrintableChar(buffer[ptr].toInt())) ptr++
        return hasNextByte()
    }

    operator fun next(): String {
        if (!hasNext()) throw NoSuchElementException()
        val sb = StringBuilder()
        var b = readByte()
        while (isPrintableChar(b)) {
            sb.appendCodePoint(b)
            b = readByte()
        }
        return sb.toString()
    }

    fun nextLong(): Long {
        if (!hasNext()) throw NoSuchElementException()
        var n: Long = 0
        var minus = false
        var b = readByte()
        if (b == '-'.toInt()) {
            minus = true
            b = readByte()
        }
        if (b < '0'.toInt() || '9'.toInt() < b) {
            throw NumberFormatException()
        }
        while (true) {
            if ('0'.toInt() <= b && b <= '9'.toInt()) {
                n *= 10
                n += (b - '0'.toInt()).toLong()
            } else return if (b == -1 || !isPrintableChar(b)) {
                if (minus) -n else n
            } else {
                throw NumberFormatException()
            }
            b = readByte()
        }
    }

    fun nextInt(): Int {
        val nl = nextLong()
        if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE) throw NumberFormatException()
        return nl.toInt()
    }

    fun nextDouble(): Double {
        return java.lang.Double.parseDouble(next())
    }
}

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

#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 VAR(v, i) __typeof(i) v=(i)
#define FORE(i, c) for(VAR(i, (c).begin()); i != (c).end(); ++i)
#define all(v) (v).begin(),(v).end()

#define PII pair<int,int>
#define mp make_pair
#define st first
#define nd second
#define pb push_back
#define lint long long int
#define VI vector<int>

#define debug(x) {cout <<#x <<" = " <<x <<endl; }
#define debug2(x,y) {cerr <<#x <<" = " <<x << ", "<<#y<<" = "<< y <<endl; } 
#define debug3(x,y,z) {cerr <<#x <<" = " <<x << ", "<<#y<<" = "<< y << ", " << #z << " = " << z <<endl; } 
#define debugv(x) {{cout <<#x <<" = "; FORE(itt, (x)) cerr <<*itt <<", "; cerr <<endl; }}
#define debugt(t,n) {{cerr <<#t <<" = "; FOR(it,0,(n)) cerr <<t[it] <<", "; cerr <<endl; }}

#define make( x) int (x); scanf("%d",&(x));
#define make2( x, y) int (x), (y); scanf("%d%d",&(x),&(y));
#define make3(x, y, z) int (x), (y), (z); scanf("%d%d%d",&(x),&(y),&(z));
#define make4(x, y, z, t) int (x), (y), (z), (t); scanf("%d%d%d%d",&(x),&(y),&(z),&(t));
#define makev(v,n) VI (v); FOR(i,0,(n)) { make(a); (v).pb(a);} 
#define IOS ios_base::sync_with_stdio(0)
#define HEAP priority_queue

#define read( x) scanf("%d",&(x));
#define read2( x, y) scanf("%d%d",&(x),&(y));
#define read3(x, y, z) scanf("%d%d%d",&(x),&(y),&(z));
#define read4(x, y, z, t) scanf("%d%d%d%d",&(x),&(y),&(z),&(t));
#define readv(v,n) FOR(i,0,(n)) { make(a); (v).pb(a);}
#define jeb() fflush(stdout);

using namespace std;
const int max_n = 1e6 + 5;

int main() {
	make2(n, k);
	int ile = (n+1)/2;
	(k <= ile) ? puts("YES") : puts("NO");
}



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

ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }

int main() {
  ll n, m;
  cin >> n >> m;
  vector<int> a(n);
  for (auto& e : a) cin >> e;

  ll k = 1;
  for (auto e : a) k = lcm(k, e / 2);
  bool b = true;
  for (auto e : a) b = b && k / (e / 2) % 2 == 1;

  cout << (b ? (m / k + 1) / 2 : 0) << endl;
}


Measured memory_bytes: 640
n, l = map(int, input().split())

apples = []
for i in range(n):
    apples.append(l+(i+1)-1)

total = sum(apples)

pies = []
for j in range(n):
    pies.append(total-apples[j])

tmp = 1000000000
for k in range(n):
    if abs(total-pies[k]) < tmp:
        aji = pies[k]
        tmp = abs(total-pies[k])

print(aji)


Measured memory_bytes: 3060
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cassert>
#include <climits>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <fstream>

using namespace std;
#define TOSTRING(x) #x
#define SZ(x) (int)(x).size()
#define REP(i,n) for(int i=0;i<(n);i++)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REPR(i,n) for(int i=(n)-1;i>=0;i--)
#define ALL(s) (s).begin(), (s).end()
#define so(V) sort(ALL(V))
#define rev(V) reverse(ALL(V))
#define uni(v) v.erase( unique(ALL(v)) , v.end());
#define PAU system("pause")

typedef long long unsigned int llu;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<bool> vb;
typedef vector<vi> vvi;
typedef vector<vll> vvll;
typedef vector<vb> vvb;
const double EPS = 1e-9;
const int MOD = 1e9 + 7;
const int INF = (1 << 28);
const ll LINF = 1e18;
const double PI = acos(-1);

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int N, M;
	cin >> N >> M;
	vi A(N);
	vi B(M);
	REP(i, N)cin >> A[i];
	REP(i, M)cin >> B[i];
	vi CA = A;
	vi CB = B;
	so(A); so(B);
	bool b = false;
	REP(i, N - 1) {
		if (A[i] == A[i + 1]) {
			b = true;
			break;
		}
	}
	REP(i, M - 1) {
		if (B[i] == B[i + 1]) {
			b = true;
			break;
		}
	}
	if (b) {
		cout << 0 << endl;
		PAU;
		return 0;
	}
	ll ans = 1;
	ll now = 0;
	vi cntA(N, 0);
	vi cntB(M, 0);
	REPR(i, N * M) {
		int cur = i + 1;
		int bit = 0;
		if (*lower_bound(ALL(A), cur) == cur) {
			bit += 1;
		}
		if (*lower_bound(ALL(B), cur) == cur)bit += 2;
		if (bit == 0) {
			ans *= now;
			now--;
		}
		else if (bit == 3) {
			int dis = distance(upper_bound(ALL(B), cur), B.end());
			now += dis;
			dis = distance(upper_bound(ALL(A), cur), A.end());
			now += dis;
		}
		else if (bit == 1) {
			int dis = distance(upper_bound(ALL(B), cur), B.end());
			ans *= dis;
			now +=  dis - 1;
		}
		else if (bit == 2) {
			int dis = distance(upper_bound(ALL(A), cur), A.end());
			ans *= dis;
			now += dis - 1;
		}
		ans %= MOD;
	}
	cout << ans << endl;
	PAU;
	return 0;
}


Measured memory_bytes: 504
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower

using namespace std;



int main() {
	int r, a, b;
	cin >> r >> a >> b;

	int sum = 10 * a + b;
	if (sum % 4 == 0)cout << "YES" << endl;
	else cout << "NO" << endl;
}

Measured memory_bytes: 3572
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

func out(x ...interface{}) {
	fmt.Println(x...)
}

var sc = bufio.NewScanner(os.Stdin)

func getInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

func getString() string {
	sc.Scan()
	return sc.Text()
}

// min, max, asub, absなど基本関数
func max(a, b int) int {
	if a > b {
		return a
	}
	return b
}

func min(a, b int) int {
	if a < b {
		return a
	}
	return b
}

func asub(a, b int) int {
	if a > b {
		return a - b
	}
	return b - a
}

func abs(a int) int {
	if a >= 0 {
		return a
	}
	return -a
}

func calc(t []int) int {
	ret := 24
	cur := 0
	for i := 1; i < 24; i++ {
		if t[i] == 1 {
			x := i - cur
			ret = min(ret, x)
			cur = i
		}
	}
	ret = min(ret, 24-cur)
	return ret
}

func main() {
	sc.Split(bufio.ScanWords)
	N := getInt()
	d := make([]int, 13)
	d[0] = 1
	for i := 0; i < N; i++ {
		x := getInt()
		d[x]++
	}

	m := 0
	if d[0] >= 2 || d[12] >= 2 {
		out(0)
		return
	}
	for _, v := range d {
		m = max(m, v)
	}
	if m >= 3 {
		out(0)
		return
	}

	len := 1 << 13
	ans := 0
	for i := 0; i < len; i++ {
		a := make([]int, 13)
		idx := 0
		for n := i; n > 0; n /= 2 {
			a[12-idx] = n % 2
			idx++
		}
		// out(a)
		t := make([]int, 24)
		for i, v := range a {
			if i == 0 {
				t[0] = 1
				continue
			}
			switch d[i] {
			case 1:
				if v == 0 {
					t[i] = 1
				} else {
					if i == 12 {
						t[i] = 1
					} else {
						t[24-i] = 1
					}
				}
			case 2:
				t[i] = 1
				t[24-i] = 1
			}
		}
		l := calc(t)
		ans = max(ans, l)
		// out(t, l)
	}
	out(ans % 24)
}


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

using namespace std;

typedef long long ll;
typedef long double ld;

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

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

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

int main() {
    ll N;
    cin >> N;
    vl a(10005);
    rep1 (i, 100) {
        rep1 (j, 100) {
            rep1 (k, 100) {
                if (i*i+j*j+k*k+i*j+j*k+k*i <= 10000) a[i*i+j*j+k*k+i*j+j*k+k*i]++;
            }
        }
    }

    rep1 (i, N) cout << a[i] << endl;
}


Measured memory_bytes: 3648
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define endl "\n"
#define si(x) (ll)((x).size())
#define pb push_back
#define F first
#define S second
#define rep(i,n) for(ll i=0;i<n;i++)
#define per(i,n) for(ll i=n-1;i>=0;i--)
#define rep1(i,n) for(ll i=1;i<=n;i++)
#define per1(i,n) for(ll i=n;i>=1;i--)
#define all(x) (x).begin(), (x).end()
#define make_unique(x) (x).resize(unique(all(x))-(x).begin())
const ll inf = 1e18;
void file()
{

#ifndef ONLINE_JUDGE
    // for getting input from input.txt
    freopen("input.txt", "r", stdin);
    // for writing output to output.txt
    freopen("output.txt", "w", stdout);
   
#endif
}

ll n;;
// mask 1 swapped else 0
ll get(ll x, std::vector<ll> &a, std::vector<ll> &b )
{
    ll cost = 0;
    std::vector<ll> d(n);
    std::vector<pair<ll, ll>> c(n);

    rep(i, n)
    if(x>>i&1)
        d[i] = b[i], c[i] = {b[i], 1};
    else
        d[i] = a[i], c[i] = {a[i], 0};




    sort(all(d));

    for(ll i=n-1;i>=0;i--)
    {
        bool pos = 0;
        for(ll j = i; j >= 0; j--)
        {	
            if(d[i] == c[j].F and c[j].S == ((i - j)%2))
            {
                pos = 1;
                cost += i - j;
                for(ll k = j; k < i; k++)
                {

                    c[k+1].S ^= 1;

                    swap(c[k], c[k + 1]);
                }
                break;

            }

        }
        if(!pos)  return inf;

    }
    return cost;


}
void solve()
{
    cin >> n;
    std::vector<ll> a(n), b(n);
    rep(i, n) cin >> a[i];
    rep(i, n) cin >> b[i];
    ll limit = 1ll << n;
    ll ans = inf;
    rep(i, limit)
    ans = min(ans, get(i, a, b));

    cout << (ans == inf ? -1 : ans);


}

int main()
{
    //file();



    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int t = 1;
    // cin >> t;

    while(t--)
    {
        solve();
        // cout << endl;
    }


}




Measured memory_bytes: 256
def IsPrime(n)
    if n<2 then return false
    elsif n==2 then return true
    elsif n%2==0 then return false
    else
      i=3
      loop do
         if i>n/i then break end
         if(n%i==0)then return false end
         i+=2
      end
    end
    return true
end

n=gets.to_i
ar=Array.new(n)
for i in 0..n-1 do
    ar[i]=gets.to_i
end
cnt=0
ar.each do |x|
   if IsPrime(x)==true then cnt+=1 end
end
p cnt

Measured memory_bytes: 8804
using System;
class Program
{
    static void Main(string[] args)
    {
        string[] input = Console.ReadLine().Split(' ');
        int a = int.Parse(input[0]);
        int b = int.Parse(input[1]);
        if (a*500 >= b)
        {
            Console.WriteLine("Yes");
        } else
        {
            Console.WriteLine("No");
        }
    }
}

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

int main() {
	int a, b, c;
	//空白の入力はこのやり方
	cin >>a>>b>>c;

	if (a < b&&b < c) {
		cout << "Yes" << endl;

	}
	else {
		cout << "No" << endl;
	}
}


Measured memory_bytes: 3108
x1, y1, x2, y2 = map(int, input().split())
dx = x2 - x1
dy = y2 - y1

x3 = x2 - dy
y3 = y2 + dx
x4 = x3 - dx
y4 = y3 - dy

print(x3, y3, x4, y4)


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

using namespace std;
int x,n;
int num[105];

int find(int j){
	int low=0,high=n-1,mid;
  
  	while(low <= high){
      mid =(low + high)/2;
    	if(num[mid] == j){
        	return 1;
        }
      	else if( num[mid] < j){
        	low = mid+1;
        }
      	else
        {
        	high=mid -1;
        }
    }
  return 0;
}
int main(){
	
  	int ans1,ans2,j=0;
  
  	cin>>x >>n;
  
  	if(n == 0){ cout<<x<<endl;return 0;}
  
  	for(int a=0;a<n;a++){
    	cin>>num[a];
    }
  
  	sort(num,num + n);
	  
  	while(1){
    	 ans1=find(x+j);
      	 ans2=find(x-j);
      	  
      	 if( ans1 == 0 && ans2 == 0){
         	cout<<min(x+j,x-j);
            return 0;
         }
      	 else if(ans1 ==  0){
         	cout<<(x+j)<<endl;
            return 0;
         }
      	 else if(ans2 == 0){
         	cout<<(x-j)<<endl;
            return 0;
         }
      	 else
         {
         	j++;
         }
    }
}

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

typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int, int> ii;
typedef vector<ii> vii;

#define repa(i, a, b) for (auto i = (a); i <= (b); i++)
#define repd(i, a, b) for (auto i = (a); i >= (b); i--)
#define rep(i, n) for (int i = 0; i < n; i++)
#define all(x) (x).begin(), (x).end()
#define zero(a)  memset((a), 0, sizeof (a))
#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back

constexpr auto inf = numeric_limits<int>().max() - 1;
constexpr auto llinf = numeric_limits<ll>().max() - 1LL;

template<typename ForwardIterator>
void dump(ForwardIterator st, ForwardIterator en) {
	for (auto it = st; it != en; it++) {
		cout << *it << " ";
	}
	cout << endl;
}

template<typename ForwardIterator>
void dump_map(ForwardIterator st, ForwardIterator en) {
	for (auto it = st; it != en; it++) {
		cout << (*it).first << ":" << (*it).second << " ";
	}
	cout << endl;
}
template<typename T>
void debug(initializer_list<T> list) {
  for (auto el : list) {
    cout << el << " ";
  }
  cout << endl;
}

constexpr ll mod = ll(1e9 + 7);

ll mult(ll a, ll b) { return ((a % mod) * (b % mod)) % mod; }

ll power(ll a, ll b) {
	ll result = 1LL;
	while (b) {
		if (b % 2LL) result = mult(result, a);
		a = mult(a, a);
		b /= 2LL;
	}
	return result;
}

ll divide(ll a, ll b) { return mult(a, power(b, mod - 2)); }

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

ll subtract(ll a, ll b) { return ((a - b) % mod + mod) % mod; }

pair<ll, bool> pow5(ll n) {
  ll i = (ll) pow(n, .2);
  // debug({i});
  if (n == i * i * i * i * i) {
    return mp(i, true);
  } else {
    return mp(i, false);
  }
}

void solve() {
  ll x;
  cin >> x;
  for (ll i = 1LL; true; i++) {
    ll f = i * i * i * i * i;
    auto g = pow5(x + f);
    // debug({"HELLO"});
    if (g.second) {
      cout << g.first << " " << i;
      break;
    }
    g = pow5(x - f);
    if (g.second) {
      cout << g.first << " " << -i;
      break;
    }
  }
	cout << "\n";
}

#define REPEAT 0
#define CASE 0

int main() {
	ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	#if REPEAT
		int t;
		cin >> t;
		repa(i, 1, t) {
			#if CASE
				cout << "Case #" << i << ": ";
			#endif
			solve();
		}
	#else
		solve();
	#endif
	return 0;
}


Measured memory_bytes: 4124
#include<iostream>
#include<algorithm>
#include<math.h>
#include<vector>
#include<map>
#include<set>
#include<iomanip>

using namespace std;
using ll = long long;

const int MOD = 1e9 + 7;
const int INF = numeric_limits<int>::max();
const ll LLINF = numeric_limits<ll>::max();
const double PI = acos(-1.0);

#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rrep(i, a, n) for (int i = a; i <= (n); ++i)

int main() {
    int A, B; cin >> A >> B;

    cout << max({A + B, A - B, A * B}) << endl;
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define maxn 200005
using namespace std;
typedef long long LL;
int read()
{
    char c=getchar();int f=1,sum=0;
    while(c<'0' || c>'9'){if(c=='-')f=-1;c=getchar();}
    while(c>='0' && c<='9'){sum=sum*10+c-'0';c=getchar();}
    return sum*f;
}
const double pi=acos(-1.0);
int n,X1,X2,Y1,Y2,fx,fy,s[maxn],top;
struct point{
	int x,y;
}p[maxn];
bool cmp(point a,point b){return a.x==b.x?a.y<b.y:a.x<b.x;}
double ans;
int main()
{
	X1=read();Y1=read();X2=read();Y2=read();
	fx=X1>X2?-1:1;fy=Y1>Y2?-1:1;X1*=fx;X2*=fx;Y1*=fy;Y2*=fy;
	n=read();
	for(int i=1;i<=n;i++)
	{
		p[i].x=read()*fx,p[i].y=read()*fy;
		if(p[i].x<X1 || p[i].x>X2 || p[i].y<Y1 || p[i].y>Y2) n--,i--;
	}
	X1=X2-X1;Y1=Y2-Y1;
	sort(p+1,p+1+n,cmp);
	for(int i=1;i<=n;i++)
	if(top==0 || s[top]<p[i].y)s[++top]=p[i].y;
	else s[(lower_bound(s+1,s+1+top,p[i].y)-s)]=p[i].y;
	double ans=X1*100.0+Y1*100.0;
	ans=ans+(double)top*(pi*5.0-20.0);
	if(top==min(X1+1,Y1+1)) ans+=pi*5;
	printf("%.11lf\n",ans);
	return 0;
}

Measured memory_bytes: 2560
N, C = gets.split.map(&:to_i)

max_t = 10**5

programs =  Array.new(C){ Array.new(max_t+10, 0) }

N.times do |i|
  
  s, t, c = gets.split.map(&:to_i)
  c -= 1
  programs[c][s] += 1
  programs[c][t+1] -= 1
  
end

# p programs[0]

C.times do |i|
  
  (1..max_t+1).each do |j|
      programs[i][j] += programs[i][j-1]
      # p ?a if i == 1 && j == 7 
  end
  (1..max_t+1).each do |j|
      programs[i][j] = 1 if programs[i][j] > 1
  end
end

# p programs[0]

ans = 0
(max_t+2).times do |i|
  
  tmp = 0
  C.times do |j|
    tmp += programs[j][i]
  end
  ans = tmp if ans < tmp
  
end

puts ans


Measured memory_bytes: 25340
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
typedef long long int ll;

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

    if((a<c&&c<b)||(b<c&&c<a))
        cout<<"Yes"<<endl;
    else
        cout<<"No"<<endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
#define REP(i,m,n) for(int i=(int)(m);i<(int)(n);++i)
#define rep(i,n) REP(i,0,n)
#define rREP(i,a,n) for(int (i)=(n)-1; (i)>=(a);--(i))
#define all(x) (x).begin(),(x).end()
#define out(y,x,h,w) (y)<0||(x)<0||(y)>=(h)||(x)>=(w)
constexpr int INF = 1000000000;
constexpr ll mod = 1000000007;
constexpr double PI = 3.1415926535897932;

template<class T>inline bool chmin(T& a, T b) {
	if (a > b) {
		a = b;
		return true;
	}
	return false;
}
template<class T>inline bool chmax(T& a, T b) {
	if (a < b) {
		a = b;
		return true;
	}
	return false;
}
inline void init() {
	cin.tie(nullptr); cout.tie(nullptr);
	ios::sync_with_stdio(false);
	cout << fixed << setprecision(15);
}

int main() {
	init();

	string s;
	cin >> s;
	map<char, int>mp;
	rep(i, s.size()) {
		mp[s[i]]++;
	}
	cout << (mp.size() == 2 ? "Yes" : "No") << "\n";

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<ll, ll>;
using Pld = pair<ld, ld>;
using Vec = vector<ll>;
using VecP = vector<P>;
using VecB = vector<bool>;
using VecC = vector<char>;
using VecD = vector<ld>;
using VecS = vector<string>;
using Graph = vector<VecP>;
#define REP(i, m, n) for(ll (i) = (m); (i) < (n); ++(i))
#define REPR(i, m, n) for(ll (i) = (m); (i) > (n); --(i))
#define rep(i, n) REP(i, 0, n)
#define R cin>>
#define repr(i, n) REPR(i, n, 0)
#define all(s) (s).begin(), (s).end()
#define pb push_back
#define mp make_pair
#define fs first
#define sc second
#define in(a) insert(a)
#define P(p) cout<<(p)<<endl;
#define ALL(x) (x).begin(),(x).end()
#define ALLR(x) (x).rbegin(),(x).rend()
#define SORT(a) sort((a).begin(), (a).end())
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<long long int> vll;
typedef vector<string> vs;
typedef pair<int, int> pii;
typedef long long ll;
typedef pair<ll, ll> pll;
void sonic(){ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);}
void setp(const ll n){cout << fixed << setprecision(n);}
const ll INF = 1e9+1;
const ll LINF = 1e18+1;
const ll MOD = 1e9+7;
//const ll MOD = 998244353;
const ld PI = acos(-1);
const ld EPS = 1e-11;
template<class T>bool chmax(T &a,const T &b){if(a<b){a=b;return true;}return false;}
template<class T>bool chmin(T &a,const T &b){if(a>b){a=b;return true;}return false;}
template<typename T> void co(T e){cout << e << "\n";}
template<typename T> void co(const vector<T>& v){for(const auto& e : v)
    { cout << e << " "; } cout << "\n";}
ll gcd(ll a, ll b) {
    if (a < b)swap(a, b);
    if (b == 0) return a;
    unsigned r;
    while ((r = a % b)) {
        a = b;
        b = r;
    }
    return b;
}
ll lcm(ll a, ll b) {
    ll g = gcd(a, b);
    return a * b / g;
}
bool prime(ll n) {
    for (ll i = 2; i <= sqrt(n); i++) {
        if (n%i == 0)return false;
    }
    return n != 1;
}

Vec fac, finv;

ll PowMod(ll a, ll n){
    if(n == 1) return a;
    if(n%2 == 0) return PowMod(a*a%MOD, n/2);
    return a*PowMod(a*a%MOD, n/2)%MOD;
}

ll combi(ll n, ll k){
    if(k>n) return 0;
    return fac[n]*finv[k]%MOD*finv[n-k]%MOD;
}

int main(){
    vi A(3);
    R A[0] >> A[1] >> A[2];
    SORT(A);
    co(A[2] * 10 + A[1] + A[0]);
}


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

long int kane(int k){
	long int shakkin = 100000;
	for(int i=0;i<k;i++){
		shakkin = shakkin*1.05;
	if(shakkin%1000!=0)
		shakkin += 1000-(shakkin%1000);
	}
	return shakkin;
}

int main() {
	int n;
	cin >> n;
	cout << kane(n) << endl;
	return 0;
}


Measured memory_bytes: 3068