akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <fstream>
#include <sstream>
#include <iomanip>
#include <vector>
#include <string>
#include <algorithm>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <unordered_set>
#include <unordered_map>
#include <bitset>
#include <limits>
#include <random>
#include <complex>
#include <cmath>
#include <cstdio>
#include <cstdlib>
using namespace std;
typedef long long ll;
#define REP(i,n) for (int i = 0; i < n; i++)

template <typename T> class LazySegmentTree {

private:

    int n;
    vector < T > node, lazy;
    
    void  lazy_eval (int l, int r, int k) {
        node[k] += lazy[k];
        if (r - l > 1) {
            lazy[2 * k + 1] += lazy[k] >> 1;
            lazy[2 * k + 2] += lazy[k] >> 1;
        }
        lazy[k] = 0;
    }
    
    void _add (int a, int b, T val, int k, int l, int r) {
        lazy_eval(l, r, k);
        if (b <= l || r <= a) return;
        if (a <= l && r <= b) {
            lazy[k] += (r - l) * val;
            lazy_eval(l, r, k);
        } else {
            _add (a, b, val, 2 * k + 1, l, (l + r) / 2);
            _add (a, b, val, 2 * k + 2, (l + r) / 2, r);
            node[k] = node[2 * k + 1] + node[2 * k + 2];
        }
    }

    T _get_sum (int a, int b, int k, int l, int r) {
        lazy_eval (l, r, k);
        if (b <= l || r <= a) return 0;
        if (a <= l && r <= b) return node[k];
        T vl = _get_sum (a, b, 2 * k + 1, l, (l + r) / 2);
        T vr = _get_sum (a, b, 2 * k + 2, (l + r) / 2, r);
        return vl + vr;
    }
    
public:
    
    LazySegmentTree (int _n) : n(1) {
        while (n < _n) n <<= 1;
        node.resize (2 * n, 0);
        lazy.resize (2 * n, 0);
    }
    
    void add (int l, int r, T val) {
        _add (l, r, val, 0, 0, n);
    }
    
    T get_sum (int l, int r) {
        return _get_sum (l, r, 0, 0, n);
    }
    
};


int main ()
{
    ll N,K,Q;
    cin >> N >> K >> Q;

    LazySegmentTree < ll > inst(100010);
    inst.add(0, 100005, K);
    vector < ll > A(Q);
    REP(i,Q) cin >> A[i];
    REP(i,Q) A[i]--;

    REP(i,Q) {
        if (A[i] > 0) {
            inst.add(0, A[i], -1);
        }
        inst.add(A[i] + 1, 100005, -1);
    }

    REP(i,N) {
        if (inst.get_sum(i, i + 1) > 0) {
            cout << "Yes" << endl;
        } else {
            cout << "No" << endl;
        }
    }

    return 0;
}


Measured memory_bytes: 7040
#include<iostream>
using namespace std;
#include<vector>
#include<set>
#include<map>
#define int long long int
#define mod 1000000007
bool prime(int x)
{
	if(x==2||x==3||x==5)
	   return true;
	if(x==1||x==4)
	   return false;
	if(x%2==0||x%3==0||x%5==0)
	    return false;
	for(int i=7;i*i<=x;i++)
	{
		if(x%i==0)
		   return false;
	}
	return true;
}
int32_t main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
    int n;
    cin>>n;
    int a;
    int b;
    cin>>a>>b;
    vector<int> v(n);
    int answer=0;
    int j;
    for(j=0;j<n;j++)
        cin>>v[j];
    for(j=0;j<n-1;j++)
    {
		int x=v[j+1]-v[j];
		answer=answer+min(a*x,b);
	}
	cout<<answer<<endl;
}	



Measured memory_bytes: 1024
#include<iostream>
#include<algorithm>
using namespace std;
int main(){
	int x[5],i,ans1=0,ans3;
	for(i=0;i<5;i++){
		cin>>x[i];
	}
	for(i=0;i<5;i++){
		if(x[i]<40){
			x[i]=40;
		}
		ans1+=x[i];
	}
	ans3=ans1/5;
	cout<<ans3<<endl;
	return 0;
}

Measured memory_bytes: 3064
A = input()
B = input()

if len(A) > len(B):
  print('GREATER')
elif len(A) < len(B):
  print('LESS')
else:
  for i in range(len(A)):
    if int(A[i]) > int(B[i]):
      print('GREATER')
      exit()
    elif int(A[i]) < int(B[i]):
      print('LESS')
      exit()
  print('EQUAL')

Measured memory_bytes: 9100
#include<bits/stdc++.h>
using namespace std;
#define REP(i,st,ed) for(register int i=st,i##end=ed;i<=i##end;++i)
#define DREP(i,st,ed) for(register int i=st,i##end=ed;i>=i##end;--i)
typedef long long ll;
template<typename T>inline bool chkmin(T &x,T y){return (y<x)?(x=y,1):0;}
template<typename T>inline bool chkmax(T &x,T y){return (y>x)?(x=y,1):0;}
inline int read(){
	int x;
	char c;
	int f=1;
	while((c=getchar())!='-' && (c>'9' || c<'0'));
	if(c=='-') f=-1,c=getchar();
	x=c^'0';
	while((c=getchar())>='0' && c<='9') x=(x<<1)+(x<<3)+(c^'0');
	return x*f;
}
inline ll readll(){
	ll x;
	char c;
	int f=1;
	while((c=getchar())!='-' && (c>'9' || c<'0'));
	if(c=='-') f=-1,c=getchar();
	x=c^'0';
	while((c=getchar())>='0' && c<='9') x=(x<<1ll)+(x<<3ll)+(c^'0');
	return x*f;
}
const int maxn=2e5+10,inf=0x3f3f3f3f,mod=1e9+7;
int idx[maxn],idx_cnt,a[maxn],b[maxn],N,dp[maxn];
inline void add(int &x,int y){
	x+=y;
	x=(x>=mod?x-mod:x);
}
struct szsz{
	int c[maxn];
	inline int lowbit(int x){
		return x&(-x);
	}
	int sum(int x){
		int res=0;
		while(x){
			add(res,c[x]);
			x-=lowbit(x);
		}
		return res;
	}
	void Add(int x,int y){
		while(x<=idx_cnt){
			add(c[x],y);
			x+=lowbit(x);
		}
	}
}bit;
struct point{
	int x,y;
	bool operator <(const point &rhs) const{
		return x<rhs.x || (x==rhs.x && y<rhs.y);
	}
	bool operator ==(const point &rhs) const{
		return x==rhs.x && y==rhs.y;
	}
}A[maxn];
int main(){
	int n=read(),m=read();
	REP(i,1,n) a[i]=read();
	REP(i,1,m) b[i]=read();
	REP(i,1,n){
		int u=lower_bound(b+1,b+m+1,a[i])-b;
		if(b[u]==a[i] || u==1 || u==m+1) continue;
		A[++N]=(point){a[i]-b[u-1],b[u]-a[i]};
		idx[++idx_cnt]=a[i]-b[u-1];
		idx[++idx_cnt]=b[u]-a[i];
	}
	idx[++idx_cnt]=0;
	idx[++idx_cnt]=inf;
	sort(idx+1,idx+idx_cnt+1);
	idx_cnt=unique(idx+1,idx+idx_cnt+1)-idx-1;
	REP(i,1,N){
		A[i].x=lower_bound(idx+1,idx+idx_cnt+1,A[i].x)-idx;
		A[i].y=lower_bound(idx+1,idx+idx_cnt+1,A[i].y)-idx;
	}
	sort(A+1,A+N+1);
	N=unique(A+1,A+N+1)-A-1;
	bit.Add(1,1);
	for(int i=1,j;i<=N;i=j+1){
		j=i;
		while(j<N && A[j+1].x==A[i].x) ++j;
		REP(k,i,j){
			dp[k]=bit.sum(A[k].y-1);
		}
		REP(k,i,j) bit.Add(A[k].y,dp[k]);
	}
	printf("%d\n",bit.sum(idx_cnt));
	return 0;
}

Measured memory_bytes: 4608
#include <iostream>
#include<string>
#include<cstring>
#include <cstdio>
#include<utility>
#include<algorithm>
#include<vector>
#include<cmath>
#include<map>
#include<bitset>
#include<queue>
#include<stack>
#include<set>
#include <limits>
#include <climits>
#include <numeric>
#include<cassert>
#include<cctype>
#include<iterator>
using namespace std;
typedef long long ll;
typedef vector<ll>VI;
typedef vector<bool>VB;
typedef pair<ll,ll>P;
typedef pair<double,double>P_D;
#define VV(T) vector<vector<T>>
#define PI 3.1415926535897932384626433832795
#define rep(i, n) for (ll i = 0; i < (ll)n; i++)
#define reprev(i, n) for (ll i = (ll)n - 1; i >= 0; i--)
#define bitrep(bit,A) for(int bit=A; ;bit=(bit-1)&A)
#define ALL(a)  (a).begin(),(a).end()
#define SZ(a) (ll)((a).size())
#define c_max(a, b) (((ll)a)>((ll)b)?(a):(b))
#define c_min(a,b) (((ll)a)<((ll)b)?(a):(b))
#define chmax(x,a) x=c_max(x,a)
#define chmin(x,a) x=c_min(x,a)
#define vmax(v) *max_element(ALL(v))
#define vmin(v) *min_element(ALL(v))
#define SORT(c) stable_sort(ALL(c))
#define $(x) {cout<<#x<<" = " <<(x)<<endl;}
#define fi first
#define se second
#define MAX 100100//5
#define MAX2 200100
#define MAX_6 1001001//6
#define MAX_7 10010010//7
#define SENTINEL 2000000000//9
#define NIL -1
#define MOD 1000000007
#define INF 1<<30
#define INFTY 1000000000000000001LL
#define MAX_INT INT_MAX
#define Endl '\n'
#define greater greater<int>()
VI findAll(string S,string pattern){VI P;ll pos=(ll)S.find(pattern);
while(pos!=string::npos){P.push_back(pos);pos=(ll)S.find(pattern,pos+1);}return P;}
inline ll GCD(ll a,ll b){return b?GCD(b,a%b):a;}
inline ll lcm(ll a,ll b){return a*b/GCD(a,b);}
bool is_prime(ll n){if(n<2)return 0;for(int i=2;i*i<n;i++)if(n%i==0)return 0;return 1;}
inline void eratosthenes(VB& p){rep(i,SZ(p))p[i]=1;p[0]=p[1]=0;
rep(i,SZ(p)/2+1){if(p[i])for(ll j=i+i;j<SZ(p);j+=i)p[j]=0;}}
inline ll mod_add(ll a,ll b){return (a+b)%MOD;}
inline ll mod_sub(ll a,ll b){return (a+MOD-b)%MOD;}
inline ll mod_mul(ll a,ll b){return ((a%MOD)*(b%MOD))%MOD;}
inline ll mod_pow(ll x,ll n,ll mod=(ll)MOD){ll res=1;while(n>0){
if(n&1)res=res*x%mod;x=x*x%mod;n>>=1;}return res;}// x^n%mod
inline ll mod_inv(ll x){return mod_pow(x,MOD-2);}
inline ll mod_div(ll a, ll b){return mod_mul(a,mod_inv(b));}
using Graph=vector<vector<int> >;//int と P
int n;
string s;
ll dp[MAX][13];//dp[i][j]:=先頭i文字として考えられるもののうち,13で割ったあまりがjであるものの数

int main(){
ll res=0;
cin>>s;
n=s.length();
dp[0][0]=1;
rep(i,n){
    int c;
    if(s[i]=='?')c=-1;
    else c=s[i]-'0';
    rep(j,10){
        if(c!=-1&&c!=j)continue;
        rep(ki,13){
            dp[i+1][(ki*10+j)%13]+=dp[i][ki];
        }
    }
    rep(j,13)dp[i+1][j]%=MOD;
}
res=dp[n][5];
cout<<res<<endl;
}

Measured memory_bytes: 10624
/*input
1000000000000000 9.99
*/
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;

#define int long long 
#define double long double
#define f first
#define s second
#define mp make_pair
#define pb push_back

#define RE(i,n) for (int i = 1; i <= n; i++)
#define RED(i,n) for (int i = n; i > 0; i--)
#define REPS(i,n) for(int i = 1; (i*i) <= n; i++)
#define REP(i,n) for (int i = 0; i < (int)n; i++)
#define FOR(i,a,b) for (int i = a; i < b; i++)
#define REPD(i,n) for (int i = n-1; i >= 0; i--)
#define FORD(i,a,b) for (int i = a; i >= b; i--)

#define all(v) v.begin(),v.end()
#define pii pair<int,int>
#define vi vector<int>
#define vvi vector<vi>
#define print(arr) for (auto it = arr.begin(); it != arr.end(); ++it) cout << *it << " "; cout << endl;
#define debug(x) cout << x << endl;
#define debug2(x,y) cout << x << " " << y << endl;
#define debug3(x,y,z) cout << x << " " << y << " " << z << endl;

typedef tree<
int,
null_type,
less<int>,
rb_tree_tag,
tree_order_statistics_node_update>
ordered_set;

const int INF = 1e18+1;
const int MOD = 1e9+7;
const double PI = 3.14159265358979323846264338;

int raise(int a,int n,int m = MOD){
  if(n == 0)return 1;
  if(n == 1)return a;
  int x = 1;
    x *= raise(a,n/2,m);
    x %= m;
    x *= x;
    x %= m;
    if(n%2)x*= a;
    x %= m;
    return x;
}

int floor1(int n,int k){
    if(n%k == 0 || n >= 0)return n/k;
    return (n/k)-1;
}

int ceil1(int n,int k){
    return floor1(n+k-1,k);
}

void solve(){
  	double a,b;
  	cin >> a >> b;
  	double c= a*b;
  	int ok = c;
  	cout << ok;
}

signed main(){
  ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
  //freopen(".in","r",stdin);freopen(".out","w",stdout);
  int t = 1;
  //cin >> t;
  while(t--){
    solve();
  }
  return 0;
}

Measured memory_bytes: 3808
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Collections;
import java.util.PriorityQueue;

public class Main {

	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

		String str[] = br.readLine().split(" ");

		int n = Integer.parseInt(str[0]);
		int m = Integer.parseInt(str[1]);

		str = br.readLine().split(" ");

		PriorityQueue<Long> pq = new PriorityQueue<>(Collections.reverseOrder());

		for (int i = 0; i < n; i++) {
			long a = Long.parseLong(str[i]);
			pq.add(a);
		}

		for (int i = 0; i < m; i++) {
			long num = pq.poll();
			pq.add(num / 2);
		}

		long ans = 0;
		while (!pq.isEmpty()) {
			ans += pq.poll();
		}

		System.out.println(ans);
	}
}

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

using namespace std;

typedef long long ll;

const ll MOD = 1000000007;
const ll INF = 1LL<<60;
//int INF = numeric_limits<int>::max();

int main(int, char**) {
	string s; cin >> s;
	for (int i=0; i<3; i++) cout << s[i];
	cout << endl;
	return 0;
}


Measured memory_bytes: 3612
#include<bits/stdc++.h>
using namespace std;
#define fs first
#define sc second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define ALL(A) A.begin(),A.end()
#define RALL(A) A.rbegin(),A.rend()
typedef long long ll;
typedef pair<ll,ll> P;
const ll mod=1000000007;
const ll LINF=1LL<<60;
const int INF=1<<30;

int main(){
	int N;
	float ans = 0.0;
	float A;
	cin >> N;
	string B;
	for (int i = 0; i< N;i++){
		cin >> A;
		cin >> B;
		if(B == "JPY"){
			ans += A;
		}
		else{
			ans += 380000.0 * A;
		}
	}
	cout << ans << endl;
	return 0;
}

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

void printv(vector<ll> v) {
  for (ll i : v)
    cout << i << endl;
}

int main() {
	ll n,m;
	cin>>n>>m;
	vector<vector<ll>> conn(n+10);
	rep(i,m){
		ll a,b;
		cin >>a>>b;
		conn[a].push_back(b);
		conn[b].push_back(a);
	}
	vector<ll> ans(n+1+10,0);
	queue<ll> q;
	q.push(1);
	ans[1]=1;
	while(q.size()){
		for(ll i:conn[q.front()]){
			if(!(ans[i])){
				ans[i]=q.front();
				q.push(i);
			}
		}
		q.pop();
	}
	cout<<"Yes"<<endl;
	rep(i,n-1){
		cout<<ans[i+2]<<endl;
	}
}


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

#define REP(i,s,n) for(int i=s;i<n;++i)
#define rep(i,n) REP(i,0,n)

using namespace std;

int n, arr[211000];

int main() {
  cin >> n;
  rep(i,n) cin >> arr[i];
  REP(len,1,n+1) if( n % len == 0 ) {
    bool check = true;
    rep(j,n) {
      if( j - len >= 0 && arr[j] != arr[j-len] ) {
        check = false;
        break;
      }
    }
    if( check ) {
      cout << n / len << endl;
      return 0;
    }
  }
  cout << 1 << endl;
  return 0;
}

Measured memory_bytes: 3868
def main():
    import sys
    input = sys.stdin.readline

    N = int(input())
    H = list(map(int, input().split()))

    inf = float("inf")
    dp = [inf]*N

    dp[0] = 0
    step1, step2 = inf, inf

    for i in range(1, N):
        step1 = abs(H[i-1]-H[i]) + dp[i-1]
        if i >= 2:
            step2 = abs(H[i-2]-H[i]) + dp[i-2]
        step = min(step1, step2)

        dp[i] = min(dp[i], step)
    print(dp[-1])


if __name__ == "__main__":
    main()


Measured memory_bytes: 52028
#include <iostream>
#include <fstream>

using namespace std;
const int nmax=200005;
string s;
int nxt[nmax][30],prc[nmax],best[nmax];
int n,i,j,cnt,poz;
char ch;
int main()
{
    ios_base::sync_with_stdio(false);
    //freopen("data.in","r",stdin);
    cin>>s;
    n=s.size();
    s=" "+s;
    for(j=0;j<26;j++)
        nxt[n][j]=n+1;
    for(i=n;i>=0;i--)
    {
        best[i]=(1<<30);
        if(i>=1)for(j=0;j<26;j++)
                   nxt[i-1][j]=nxt[i][j];
        if(i>=1)nxt[i-1][s[i]-'a']=i;
        for(j=0;j<26;j++)
        {
            if(1+best[nxt[i][j]]<best[i])
                best[i]=1+best[nxt[i][j]],prc[i]=j;
        }
    }
    cnt=best[0];poz=0;
    for(i=1;i<=cnt;i++)
    {
        ch='a'+prc[poz];
        cout<<ch;
        poz=nxt[poz][prc[poz]];
    }
    return 0;
}


Measured memory_bytes: 25680
import java.io.*;
import java.util.*;

public class Main {
    static BufferedReader in;
//    static HashMap<Pair, Integer> map;
    static int[][] dp;
    static int M = (int)1e9+7;
    public static void solve() throws IOException {
        Integer[] nums = nextArray(2);
        char[][] arr = new char[nums[0]][nums[1]];
        for(int i = 0;i<nums[0];i++){
            arr[i] = in.readLine().toCharArray();
        }
//        map = new HashMap<>();
        dp = new int[nums[0]][nums[1]];
        for(int[] row : dp){
            Arrays.fill(row,-1);
        }
        int ans = recur(0,0, nums[0]-1,nums[1]-1, arr);
        System.out.println(ans);

    }

    static int recur(int x, int y, int H, int W, char[][] arr){
        if(x < H && y < W && dp[x][y] != -1)
            return dp[x][y];

        if(x == H && y == W){
            dp[x][y] = 1;
            return 1;
        }
        if(x>H || y > W||arr[x][y] == '#'){
            if(x < H && y < W)dp[x][y] = 0;
            return 0;
        }

        dp[x][y] = (recur(x+1,y,H,W,arr)+ recur(x,y+1,H,W,arr))%M;
        return dp[x][y];
    }


    public static void main(String[] args) throws IOException {
        in = new BufferedReader(new InputStreamReader(System.in));
        solve();
    }

    static int nextInt() throws IOException {
        return Integer.parseInt(in.readLine().trim());
    }

    static long nextLong() throws IOException {
        return Long.parseLong(in.readLine().trim());
    }

    static Integer[] nextArray(int n) throws IOException {
        StringTokenizer st = new StringTokenizer(in.readLine());
        Integer[] tmp = new Integer[n];
        for (int i = 0; i < tmp.length; i++) {
            tmp[i] = Integer.parseInt(st.nextToken());
        }

        return tmp;
    }

}



Measured memory_bytes: 35768
#include <iostream>
using namespace std;
int main(){
 char C[6];
 for(int i=0;i<6;i++)cin >> C[i];
 if(C[0]==C[5]&&C[1]==C[4]&&C[2]==C[3]) cout << "YES";
 else cout << "NO";
 cout << endl;
}


Measured memory_bytes: 888
N = int(input())
A_list = [list(map(int,input().split())) for _ in range(2)]

# どこで下に移動するかだけが取得できるアメの個数を決定する
n_Candy_list = []
for i in range(N):
    n_Candy_list.append(sum(A_list[0][:i+1]) + sum(A_list[1][i:]))

print(max(n_Candy_list))

Measured memory_bytes: 3060
#include<cstdio>
using namespace std;
#define N 300050
#define M 10
#define mod 1000000007
int dp[N][M],t[M][2],as;
char s[N];
int main()
{
	t[1][1]=2;t[1][0]=8;
	t[2][1]=3;t[2][0]=4;
	t[3][1]=3;t[3][0]=3;
	t[4][1]=2;t[4][0]=5;
	t[5][1]=4;t[5][0]=4;
	t[6][1]=2;t[6][0]=7;
	t[7][1]=6;t[7][0]=9;
	t[8][1]=6;t[8][0]=9;
	t[9][1]=8;t[9][0]=8;
	scanf("%s",s+1);
	dp[0][1]=1;
	for(int i=1;s[i];i++)
	{
		if(s[i]!='0')for(int j=1;j<10;j++)dp[i][t[j][1]]=(dp[i][t[j][1]]+dp[i-1][j])%mod;
		if(s[i]!='1')for(int j=1;j<10;j++)dp[i][t[j][0]]=(dp[i][t[j][0]]+dp[i-1][j])%mod;
		as=(dp[i][3]+dp[i][2])%mod;
	}
	printf("%d\n",as);
}

Measured memory_bytes: 12160
"""
queue

dequeを使おう
stack q.pop()
queue q.popleft()
"""
from collections import deque
queue = deque([])
n,q = map(int, input().split())

for i in range(n):
    name,time = input().split()
    queue.append((name,int(time)))
ans = 0
while queue:
    name,time = queue.popleft()
    if time-q > 0:
        queue.append((name,time-q))
        ans += q   
    else:
        ans += time
        print(name,ans)



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

using namespace std;

using ll = long long;
using pii = pair<int,int>;
using pll = pair<ll,ll>;
using vi = vector<int>;
using vl = vector<ll>;

using _loop_int = int;
#define REP(i,n) for(_loop_int i=0; i<(_loop_int)(n); i++)
#define FOR(i,a,b) for(_loop_int i=(_loop_int)(a); i<(_loop_int)(b); i++)
#define FORR(i,a,b) for(_loop_int i=(_loop_int)(b)-1; i>=(_loop_int)(a); i--)

#define CHMIN(a,b) (a)=min((a),(b))
#define CHMAX(a,b) (a)=max((a),(b))
#define ALL(v) (v).begin(),(v).end()

#define DEBUG(x) cerr<<#x<<": "<<(x)<<endl
#define DEBUG_VEC(v) cerr<<#v<<": ";REP(__i,(v).size())cerr<<((v)[__i])<<", ";cerr<<endl

const ll MOD = 1000000007ll;

int main(){
    int n;
    cin>>n;
    cout << (n%2==0 ? (n/2-1) : n/2) << endl;
    return 0;
}


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

using namespace std;

typedef long long ll;

int main(){
        int N, K;
        cin>>N>>K;
        ll sum=0;
        vector <int> a(N);
        for(int i=0;i<N;i++){
                cin>>a[i];
                sum+=a[i];
        }
        sort(a.begin(), a.end());
        reverse(a.begin(), a.end());
        int res=0;
        vector <bool> dp(K);
        dp[0]=true;
        for(int i=0;i<N;i++){
                bool f=false;
                for(int j=0;j<K;j++){
                        f|=dp[j]&&j+sum>=K;
                        //cout<<a[i]<<":"<<f<<endl;
                }
                if(!f){
                        res++;
                }
                sum-=a[i];
                for(int j=K-1-a[i];j>=0;j--){
                        dp[j+a[i]]=dp[j+a[i]]|dp[j];
                }
        }
        cout<<res<<endl;
        return 0;
}


Measured memory_bytes: 256
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.List;
import java.util.Map.Entry;
import java.util.Scanner;

public class Main
{

	public static void main(String[] args)
	{
		HashMap mMap = new HashMap();

		String [] s = new String [200000];
		Scanner scan = new Scanner(System.in);
        String str = scan.nextLine();
        int n = Integer.parseInt(str);

        int index = 0;
        int max = 1;
		for (int i=0; i<n; i++) {
			str = scan.nextLine();
			if (mMap.containsKey(str)) {
				int j = (int)mMap.get(str) +1;
				mMap.put(str, j);
				if (max < j) {
					max = j;
				}
			} else {
				mMap.put(str, 1);
			}
		}

        // 2.Map.Entryのリストを作成する
        List<Entry<String, Integer>> list_entries = new ArrayList<Entry<String, Integer>>(mMap.entrySet());

        // 3.比較関数Comparatorを使用してMap.Entryの値を比較する(昇順)
        Collections.sort(list_entries, new Comparator<Entry<String, Integer>>() {
            public int compare(Entry<String, Integer> obj1, Entry<String, Integer> obj2) {
                // 4. 昇順
                return obj1.getKey().compareTo(obj2.getKey());
            }
        });

        // 5. ループで要素順に値を取得する
        for(Entry<String, Integer> entry : list_entries) {
        	if (entry.getValue() == max) {
            System.out.println(entry.getKey());
        	}
        }

	}

}

Measured memory_bytes: 181868
#include <bits/stdc++.h>
#define sz(c)      int(c.size())
#define rep(i,a,b) for (int i=a; i<(b); ++i)
#define per(i,a,b) for (int i=(b)-1; i>=(a); --i)
using namespace std;
using i64 = long long;



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

  string s;
  cin>>s;
  if (sz(s)==1) {
    cout<<s<<endl;
    return 0;
  }

  int i=1;
  while (i<sz(s) && s[i]=='9') { i+=1; }
  
  int res=0;
  if (i==sz(s)) {
    rep(j,0,sz(s)) res+=s[j]-'0';
    cout<<res<<endl;
    return 0;
  }

  res=(sz(s)-i)*9-1;
  rep(j,0,i) res+=s[j]-'0';
  cout<<res<<endl;

  return 0;
}


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

using namespace std;

int main() {
	int n;
	cin >> n;
	vector<int> v(n, 0);
	for (int i = 0; i < n; i++) {
		cin >> v[i];
	}

	sort(v.begin(), v.end());
	cout << v[v.size() / 2] - v[v.size() / 2-1] << endl;


	return 0;
}




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

typedef long long ll;

ll n,z,w;

ll a[2003];

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    cin>>n>>z>>w;
    for(int i=1; i<=n; ++i)
        cin>>a[i];
    if(n == 1)
        cout<<abs(a[1]-w)<<endl;
    else
        cout<<max(llabs(a[n-1]-a[n]), llabs(a[n]-w))<<endl;
}


Measured memory_bytes: 256
#include <stdio.h>

int main() {
  int a, b;
  char s[16] = {};
  scanf("%d %d %s", &a, &b, s);
  if (s[a] == '-') {
    int c = 0;
    for (int i=0; i<a; i++)
      if (s[i] >= '0' && s[i] <= '9')
        c++;
    for (int i=a+1; i<=a+b; i++)
      if (s[i] >= '0' && s[i] <= '9')
        c++;
    if (c == a+b) {
      puts("Yes");
      return 0;
    }
  }
  puts("No");
}

Measured memory_bytes: 128
//gcc listsirkuler.c map.c player.c mesinkata.c mesinkar.c matriks.c pcolor.c point.c stackpoint.c queue.c unit.c main.c -o main
#include <bits/stdc++.h>
#define Semangat using
#define World namespace
#define Final std;
#define WF {ios_base::sync_with_stdio(0);cin.tie(0);}
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define ll long long

const int MOD = 1e9+7;
const int MAXN = 1e5+3;
Semangat World Final

int a,b;
string s;
bool x;

int main(){
	cin>>a>>b;
	cin>>s;
	x=true;
	for(int i=0; i<a; i++){
		if(!(s[i]>='0' && s[i]<='9')) x=false;
	}
	if(s[a]!='-') x=false;
	for(int i=a+1; i<s.length(); i++){
		if(!(s[i]>='0' && s[i]<='9')) x=false;
	}
	if(x) puts("Yes");
	else puts("No");
	return 0;
}

Measured memory_bytes: 256
import Control.Applicative
import Control.Monad
import Data.Array
import Data.List (foldl')

main = do
  n <- readLn
  replicateM_ n main'

main' = do
  n <- (read :: String -> Int) <$> getLine
  s <-  map (read :: String -> Int) . words <$> getLine
  let arr = listArray (1,n) s
  let [a,b] = mini_and_max n arr
  putStrLn $ show a ++ " " ++ show (-b)

mini_and_max n arr =
  foldl' test [0,0] [2..n]
    where
      test [a,b] n =
        [max a ((arr ! n)- arr ! (n-1)),
         min b ((arr ! n)- arr ! (n-1))]

Measured memory_bytes: 4236
import bisect, copy, heapq, math, sys
from collections import *
from functools import lru_cache
from itertools import accumulate, combinations, permutations, product
def input():
    return sys.stdin.readline()[:-1]
def ruiseki(lst):
    return [0]+list(accumulate(lst))
def celi(a,b):
    return -(-a//b)
sys.setrecursionlimit(5000000)
mod=998244353
al=[chr(ord('a') + i) for i in range(26)]
direction=[[1,0],[0,1],[-1,0],[0,-1]]

n,k=map(int,input().split())
lr=[list(map(int,input().split())) for i in range(k)]

lst=[0]*(n+1)
lst[0]=1
lst[1]=-1

now=0
# print(lst)
for i in range(n):
    now+=lst[i]
    now%=mod
    for j in range(k):
        l,r=lr[j]
        if i+l<=n:
            lst[i+l]+=now
            lst[i+l]%=mod
        if i+r+1<=n:
            lst[i+r+1]-=now
            lst[i+r+1]%=mod
    # print(lst,now)
ans=0
for i in range(n):
    ans+=lst[i]
    ans%=mod
print(ans)

Measured memory_bytes: 70912
#include<iostream>
#include<vector>
using namespace std;
int main() {
	int m, n;
	cin >> m >> n;
	vector<int> s(n);
	for (int i = 0;i < n;i++) {
		cin >> s[i];
		m -= s[i];
}
	if (m >= 0) {
		cout << m;
	}
	else {
		cout << -1;
	}
}


Measured memory_bytes: 3632
from itertools import combinations_with_replacement

N, M, Q = map(int, input().split())

a, b, c, d = [0]*Q, [0]*Q, [0]*Q, [0]*Q
for i in range(Q):
  a[i], b[i], c[i], d[i] = map(int, input().split())
  a[i], b[i] = a[i]-1, b[i]-1

ans = 0
for A in combinations_with_replacement(range(M), N):
  tmp = 0
  for i in range(Q):
    if A[b[i]] - A[a[i]] == c[i]:
      tmp += d[i]
  ans = max(ans, tmp)

print(ans)

Measured memory_bytes: 9232
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>

using namespace std;

int main(){
	ios_base::sync_with_stdio(false);
	string s;
	cin >> s;
	const int n = s.size();
	int answer = 0;
	for(const int c : s){
		answer += c - '0';
	}
	answer = max(answer, (s[0] - '0' - 1) + (n - 1) * 9);
	cout << answer << endl;
	return 0;
}


Measured memory_bytes: 256
def f(x):
    if x=="r":
        return 2
    elif x=="s":
        return 0
    else:
        return 1

N,K=map(int,input().split())
L=list(map(int,input().split()))
T=["*"]+list(map(f,input()))


Z=[[0,0,0] for _ in range(N+1)]

for x in range(1,N+1):
    for a in range(3):
        if x<=K:
            Z[x][a]=L[a]*(T[x]==a)
        else:
            b=(a+1)%3
            c=(b+1)%3

            Z[x][a]=max(Z[x-K][b],Z[x-K][c])+L[a]*(T[x]==a)

X=0
for i in range(1,K+1):
    X+=max(Z[-i])
print(X)

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

using namespace std;

#define FOR(i, N) for (int i = 0; i < (int)N; i++)
#define FORIN(i, a, b) for (int i = a; i < (int)b; i++)
#define ALL(x) (x).begin(), (x).end()
#define MOD 1000000007
#define INF (1 << 29)
#define LLINF (1LL << 60)
#define DEBUG(...) debug(__LINE__, ":" __VA_ARGS__)

using Pi = pair<int, int>;
using ll = long long;

string to_string(string s) { return s; }
template <class S>
string to_string(unordered_set<S> s);
template <class S>
string to_string(set<S> s);
template <class S, class T>
string to_string(map<S, T> m);
template <class T>
string to_string(vector<T> v);

template <class S, class T>
string to_string(pair<S, T> p) {
  return "{" + to_string(p.first) + "," + to_string(p.second) + "}";
}

template <class S>
string to_string(unordered_set<S> s) {
  string ret = "{";
  for (S x : s) ret += to_string(x) + ",";
  return ret + "}";
}

template <class S>
string to_string(set<S> s) {
  string ret = "{";
  for (S x : s) ret += to_string(x) + ",";
  return ret + "}";
}

template <class S, class T>
string to_string(map<S, T> m) {
  string ret = "{";
  for (pair<S, T> x : m) ret += to_string(x) + ",";
  return ret + "}";
}

template <class T>
string to_string(vector<T> v) {
  string ret = "{";
  for (int i = 0; i < (int)v.size() - 1; ++i) {
    ret += to_string(v[i]) + ",";
  }
  if (v.size() > 0) {
    ret += to_string(v.back());
  }
  ret += "}";
  return ret;
}

void debug() { cerr << endl; }

template <class Head, class... Tail>
void debug(Head head, Tail... tail) {
  cerr << to_string(head) << " ";
  debug(tail...);
}

void print() { cout << endl; }

template <class Head, class... Tail>
void print(Head head, Tail... tail) {
  cout << to_string(head);
  print(tail...);
}

int main() {
  cin.tie(0);
  ios::sync_with_stdio(0);
  string s;
  cin >> s;
  int x, y;
  cin >> x >> y;
  int now = 0;
  vector<int> list;
  for (char c : s) {
    if (c == 'T') {
      list.push_back(now);
      now = 0;
    } else {
      now++;
    }
  }
  list.push_back(now);
  bitset<16100> dpx, dpy;
  dpx[list[0] + 8050] = 1;
  dpy[8050] = 1;
  for (int i = 1; i < list.size(); ++i) {
    if (i % 2 == 1) {
      dpy = (dpy >> list[i]) | (dpy << list[i]);
    } else {
      dpx = (dpx >> list[i]) | (dpx << list[i]);
    }
  }
  print(dpx[x + 8050] && dpy[y + 8050] ? "Yes" : "No");
  return 0;
}

Measured memory_bytes: 384
#include <cstring>
#include <cstdio>
#include <algorithm>
#include <iostream>
#include <vector>
#include <map>
#include <unordered_map>
#include <cmath>
#include <queue>
#include <set>
#include <stack>

using namespace std;
typedef long long ll;
typedef pair<int, int> P;
#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)
#define repr(i, n) for(ll i = n - 1; i >= 0; i--)
#define repone(i, n) for(ll i = 1; i <= (ll)(n); i++)
#define each(i, mp) for(auto i:mp)
#define FOR(i, m, n) for(ll i = m;i < n;i++)
const int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};
const ll mod = 1000000007;
const ll inf = ll(1e9);
const ll half_inf = ll(1e5);
const ll ll_inf = ll(1e9) * ll(1e9);

string s;

void solve() {
    rep(i, s.length() - 1) {
        if (s[i] == s[i + 1]) {
            printf("%d %d", i + 1, i + 2);
            return;
        }
    }
    rep(i, s.length() - 2) {
        if (s[i] == s[i + 2]) {
            printf("%d %d", i + 1, i + 3);
            return;
        }
    }
    printf("%d %d", -1, -1);
}

int main() {
    cin >> s;
    solve();
    return 0;
}

Measured memory_bytes: 512
using System;
using System.Collections.Generic;
using System.Collections;
using System.Collections.Specialized;
using System.Linq;
using System.Text;
using System.IO;
using System.Reflection;
using static System.Math;
using System.Numerics;
static class Program{
	const int mod=(int)1e9+7;
	static void Main(){
		Sc sc=new Sc();
		var s=sc.Ia;
		var t=new string[s[0]];
		var a=new int[s[0]][];
		int p=0,u=0;
		for(int i = 0;i<s[0];i++) {
			t[i]=sc.S;
			a[i]=new int[s[1]];
			u=0;
			for(int j = 0;j<s[1];j++) {
				if(t[i][j]=='#'){p++;u=p;}
				a[i][j]=u;
			}
			for(int j = s[1]-1;j>=0;j--) {
				if(a[i][j]==0&&j!=s[1]-1){a[i][j]=a[i][j+1];}
				if(i!=0&&a[i-1][j]==0){a[i-1][j]=a[i][j];}
			}
		}
		for(int i = 0;i<s[0]-1;i++) {
			for(int j = 0;j<s[1];j++) {
				if(a[i+1][j]==0){a[i+1][j]=a[i][j];}
			}
		}
		for(int i = s[0]-1;i>=1;i--) {
			for(int j = 0;j<s[1];j++) {
				if(a[i-1][j]==0){a[i-1][j]=a[i][j];}
			}
		}
		for(int i = 0;i<s[0];i++) {
			Console.WriteLine("{0}",String.Join(" ",a[i]));
		}
	}
}

public class Sc{
	public int I{get{return int.Parse(Console.ReadLine());}}
	public long L{get{return long.Parse(Console.ReadLine());}}
	public double D{get{return double.Parse(Console.ReadLine());}}
	public string S{get{return Console.ReadLine();}}
	public int[] Ia{get{return Array.ConvertAll(Console.ReadLine().Split(),int.Parse);}}
	public long[] La{get{return Array.ConvertAll(Console.ReadLine().Split(),long.Parse);}}
	public double[] Da{get{return Array.ConvertAll(Console.ReadLine().Split(),double.Parse);}}
	public string[] Sa{get{return Console.ReadLine().Split();}}
	public object[] Oa{get{return Console.ReadLine().Split();}}
	public int[] Ia2{get{return Array.ConvertAll(("0 "+Console.ReadLine()+" 0").Split(),int.Parse);}}
	public int[] Ia3(int a){return Array.ConvertAll((a.ToString()+" "+Console.ReadLine()).Split(),int.Parse);}
	public int[] Ia3(bool a,int b,bool c,int d){return Array.ConvertAll(((a?b.ToString()+" ":"")+Console.ReadLine()+(c?" "+d.ToString():"")).Split(),int.Parse);}
	public long[] La2{get{return Array.ConvertAll(("0 "+Console.ReadLine()+" 0").Split(),long.Parse);}}
	public long[] La3(int a){return Array.ConvertAll((a.ToString()+" "+Console.ReadLine()).Split(),long.Parse);}
	public long[] La3(bool a,int b,bool c,int d){return Array.ConvertAll(((a?b.ToString()+" ":"")+Console.ReadLine()+(c?" "+d.ToString():"")).Split(),long.Parse);}
	public T[] Arr<T>(int n,Func<T> f){var a=new T[n];for(int i=0;i<n;i++){a[i]=f();}return a;}
	public T[] Arr<T>(int n,Func<int,T> f){var a=new T[n];for(int i=0;i<n;i++){a[i]=f(i);}return a;}
	public T[] Arr<T>(int n,Func<string[],T> f){var a=new T[n];for(int i=0;i<n;i++){a[i]=f(Console.ReadLine().Split());}return a;}
	public T[] Arr<T>(int n,Func<int,string[],T> f){var a=new T[n];for(int i=0;i<n;i++){a[i]=f(i,Console.ReadLine().Split());}return a;}
}

Measured memory_bytes: 18508
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <time.h>
#include <tuple>
#include <utility>
#include <vector>
#define ll long long
#define itn int
#define endl '\n'
#define co(ans) cout<<ans<<endl
#define COYE cout<<"YES"<<endl
#define COYe cout<<"Yes"<<endl
#define COye cout<<"yes"<<endl
#define CONO cout<<"NO"<<endl
#define CONo cout<<"No"<<endl
#define COno cout<<"no"<<endl
#define FORE(i,a) for(auto &i:a)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define FFOR(i,a,b) for(int i=(a);i<=(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define RREP(i,n)  FFOR(i,1,n)
#define PB push_back
#define MP make_pair
#define ALL(V) (V).begin(),(V).end()
#define SORT(V) sort((V).begin(),(V).end())
#define REVERSE(V) reverse((V).begin(),(V).end())
#define EACH(V,i) for(typeof((V).begin()) i=(V).begin();i!=(V).end();++i)
#define equals(a,b) (fabs((a)-(b))<EPS)
#define INF ((1LL<<62)-(1LL<<31))
#define EPS 1e-10
#define PI 3.141592653589793238
#define MOD 1000000007
#define MAX 5100000
using namespace std;
using Edge=pair<ll,ll>;
using Graph=vector<vector<int>>;
inline int toInt(string s){int v;istringstream sin(s);sin>>v;return v;}
template<class T>inline string toString(T x){ostringstream sout;sout<<x;return sout.str();}
template<class T>bool chmax(T &a,const T &b){if(a<b){a=b;return 1;}return 0;}
template<class T>bool chmin(T &a,const T &b){if(b<a){a=b;return 1;}return 0;}
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;
const int dx[4]={0,1,0,-1},dy[4]={1,0,-1,0};
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;
  cin>>N;
  bool CAN=true;
  if(N==1) CAN=false;
  
  ll RUI[20],it=1;
  RUI[0]=1;
  RREP(i,20){
    RUI[i]=RUI[i-1]*2;
    if(RUI[i]==N) CAN=false;
    if(RUI[i-1]-1<=N && N<RUI[i]-1) it=i-1;
  }
  
  if(CAN){
    COYe;
    
    for(int i=1; i<RUI[it]-1; ++i){
      cout<<i<<" "<<i+1<<endl;
      cout<<i+N<<" "<<i+N+1<<endl;
    }
    cout<<RUI[it]-1<<" "<<N+1<<endl;
    
    for(int i=RUI[it]; i<=N; ++i){
      if(i%2==1){
        cout<<i-1<<" "<<i<<endl;
        cout<<i<<" "<<1<<endl;
        cout<<1<<" "<<N+i-1<<endl;
        cout<<N+i-1<<" "<<N+i<<endl;
      }
    }
    
    if(N%2==0){
      ll M=N-RUI[it],L=0,P=0;
      bool START=false;
      for(int i=20; i>=0; --i){
        if(START==true){
          if(M>=RUI[i]){
            M-=RUI[i];
          }
          else{
            L+=RUI[i];
          }
        }
        if(M>=RUI[i] && START==false){
          START=true;
          M-=RUI[i];
          P=i;
        }
      }
      
      cout<<N<<" "<<RUI[it]+L<<endl;
      cout<<RUI[P+1]-2<<" "<<2*N<<endl;
    }
  }
  else CONo;
  return 0;
}

Measured memory_bytes: 3636
#include<bits/stdc++.h>
#define ll  long long int
#define fr(i,n) for(ll i=0; i<n; i++)
#define fre(i,n) for(ll i=1; i<=n; i++)
#define pb push_back
#define mp(i,j) make_pair(i,j)
#define fi first
#define se second
#define pii pair<ll,ll>
#define ve vector
#define piii pair<pii, ll>
#define FAST ios_base::sync_with_stdio(0); cin.tie(NULL); cout.tie(NULL);
using namespace std;

ll mod = 1e9+7;
ll dp[110][100010];
ll sum[100010];
vector<ll> v;

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

   v.push_back(0);
   for(int i=0; i<n; i++){
        cin>>x;
        v.push_back(x);
   }
   
   for(int i=1; i<=k; i++)
      dp[0][i] = 0;
   dp[0][0] = 1;

   for(int i=1; i<=n; i++){
      for(int j=1; j<=k; j++){
          dp[i-1][j] += dp[i-1][j-1];
          dp[i-1][j] %= mod;
      }
      for(int j=0; j<=k; j++){
          dp[i][j] = dp[i-1][j];
          dp[i][j] -= ( j-v[i]-1 >= 0 )?dp[i-1][j-v[i]-1]:0;
          dp[i][j] += mod;
          dp[i][j] %= mod;
      }
      // for(int j=0; j<=k; j++){
      //     cout<<dp[i][j]<<" ";
      // }
      // cout<<endl;
   }

   cout<<dp[n][k]<<endl;

}

Measured memory_bytes: 82404
#include <iostream>
using namespace std;
 
int main(){
  int n,c;
 
  while(cin >> n ,n){
    int total = 0;
    for(int i = 0 ; i < n*(n-1)/2 ; i++){
      cin >> c;
      total += c;
    }
    cout << total / (n-1) << endl;
  }
 
  return 0;
}

Measured memory_bytes: 1160
#include<bits/stdc++.h>
using namespace std;
int main(){
  long n,a,b;
  cin >> n >> a >> b;
  long ans = 0;
  if(a==b)ans = 1;
  else if(a<b && n>=2){
    ans = (a+b*(n-1))-(a*(n-1)+b)+1;
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int X = sc.nextInt();
		int Y = sc.nextInt();

		if(X>=13) {
			System.out.println(Y);
		}else {
			if(X<=5) {
				System.out.println(0);
			}else {
				System.out.println(Y/2);
			}
		}
	}
}


Measured memory_bytes: 23252
#include<bits/stdc++.h>
#define pb push_back
#define ins insert
#define F first
#define S second
#define var auto
using namespace std;
typedef long long ll;
const int Max = 1e5 + 10;
const int Mod = 1e9 + 7;

int X[Max];

int main()
{
	int n;cin >> n;
	for(int i = 0; i < n ; i++)
	{
		int a;cin >> a;
		X[a - 1]++;
		X[a]++;
		X[a + 1]++;
	}
	int ans = 0;
	for(int i = 0; i < Max;i++)
	{
		ans = max(X[i] , ans);
	}
	cout << ans << '\n';
}



Measured memory_bytes: 3916
import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.stream.Collectors;

public class Main {
    public static void main(final String[] args) {
        final Scanner scanner = new Scanner(System.in);
        final int n = scanner.nextInt();

        Map<Integer, AtomicInteger> map = new HashMap<>();
        for (int i = 0; i < n; i++) {
            count(i + 1, map);
        }

        final int biggerThan3 = (int) map.entrySet().stream()
                .filter(e -> e.getValue().get() >= 2)
                .count();

        final int biggerThan5 = (int) map.entrySet().stream()
                .filter(e -> e.getValue().get() >= 4)
                .count();

        final int biggerThan15 = (int) map.entrySet().stream()
                .filter(e -> e.getValue().get() >= 14)
                .count();

        final int biggerThan25 = (int) map.entrySet().stream()
                .filter(e -> e.getValue().get() >= 24)
                .count();

        final int biggerThan75 = (int) map.entrySet().stream()
                .filter(e -> e.getValue().get() >= 74)
                .count();

        int answer = biggerThan5 * (biggerThan5 - 1) / 2 * (biggerThan3 - 2);
        answer += biggerThan15 * (biggerThan5 - 1);
        answer += biggerThan25 * (biggerThan3 - 1);
        answer += biggerThan75;

        System.out.println(answer);

    }

    private static void count(final int number, final Map<Integer, AtomicInteger> map) {
        int tmp = number;
        for (int i = 2; i <= tmp; i++) {
            if (tmp % i == 0) {
                tmp /= i;
                map.computeIfAbsent(i, v -> new AtomicInteger()).incrementAndGet();
                i--;
            }
        }
    }
}


Measured memory_bytes: 28884
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vi=vector<int>;using vvi=vector<vi>;using vl=vector<ll>;
using P=pair<int,int>;using PL=pair<ll,ll>;using vp=vector<P>;
const int INF=1<<30,MOD=1000000007;const ll LINF=1ll<<60;
#define _ol3(_1,_2,_3,name,...) name
#define _rep(i,n) _repi(i,0,n)
#define _repi(i,a,b) for(int i=a,i##_l=(b);i<i##_l;++i)
#define REP(...) _ol3(__VA_ARGS__,_repi,_rep,)(__VA_ARGS__)
#define REPR(i,n) for(int i=n-1;i>=0;--i)
#define REPA(i,v) REP(i,v.size())
#define all(v) (v).begin(),(v).end()
#define bit(n) (1ll<<(n))
#define clamp(n,mi,ma) max(min(n,ma),mi)
#define uniq(v) sort(all(v));v.erase(unique(all(v)),v.end())
#define pb push_back
#define F first
#define S second
#define endl '\n'
#define cho(n,a,b) cout<<((n)?a:b)<<endl
#define YES(n) cho(n,"YES","NO")
#define Yes(n) cho(n,"Yes","No")
#define Poss(n) cho(n,"Possible","Impossible")
template<class T>bool chmax(T&a,const T&b){if(a<b){a=b;return 1;}return 0;}
template<class T>bool chmin(T&a,const T&b){if(a>b){a=b;return 1;}return 0;}
template<class T>ostream&operator<<(ostream&o,const vector<T>&v){for(auto&&i:v)o<<i<<' ';return o;}
template<class T>istream&operator>>(istream&i,vector<T>&v){for(T&j:v)i>>j;return i;}
template<class T,class U>ostream&operator<<(ostream&o,const pair<T,U>&p){return o<<p.F<<' '<<p.S;}
template<class T,class U>istream&operator>>(istream&i,pair<T,U>&p){return i>>p.F>>p.S;}
template<class T>ostream&operator<<(ostream&o,const set<T>&v){for(auto&&i:v)o<<i<<' ';return o;}
template<class T>ostream&operator<(ostream&o,const T&t){return o<<t;}
template<class T>istream&operator>(istream&i,T&t){return i>>t;}
#ifndef LOCAL
struct ostdmy{
template<class T>ostdmy&operator<<(const T&t){return*this;}
template<class T>ostdmy&operator<(const T&t){return*this;}};ostdmy cer_;
#define cerr cer_
#endif
int main(){
    cin.tie(0);ios::sync_with_stdio(0);
    int r,g,b,n;
    cin>r>g>b>n;
    int ans=0;
    for(int i=0;i<=n;i+=r){
        for(int j=i;j<=n;j+=g){
            if((n-j)%b==0)ans++;
        }
    }
    cout<ans<endl;
    return 0;
}


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

int main(){
  int i,j,cnt=0;
  int n;
  cin>>n;
  int x[n];
  for(i=0;i<n;i++)cin>>x[i];
  int y[n];
  for(i=0;i<n;i++)y[i]=x[i];
  sort(y,y+n);
  int mi=y[n/2-1],ma=y[n/2];
  for(i=0;i<n;i++){
    if(x[i]<=mi)cout<<ma<<endl;
    else cout<<mi<<endl;
  }
}

Measured memory_bytes: 3712
#!/usr/bin/env python3
import sys
sys.setrecursionlimit(10**7)
import bisect
import heapq
import itertools
import math
import numpy as np
from collections import Counter, defaultdict, deque
from copy import deepcopy
from decimal import Decimal
from math import gcd
from operator import add, itemgetter, mul, xor
def cmb(n,r,mod):
  bunshi=1
  bunbo=1
  for i in range(r):
    bunbo = bunbo*(i+1)%mod
    bunshi = bunshi*(n-i)%mod
  return (bunshi*pow(bunbo,mod-2,mod))%mod
mod = 10**9+7
def I(): return int(input())
def LI(): return list(map(int,input().split()))
def MI(): return map(int,input().split())
def LLI(n): return [list(map(int, input().split())) for _ in range(n)]

n,m = MI()
graph = [[] for _ in range(n+1)]

for i in range(m):
    a,b = MI()
    graph[a].append(b)
    graph[b].append(a)

dist = [-1]*(n+1)
dist[0] = 0
dist[1] = 0

d = deque()
d.append(1)
ans = [0]*(n+1)
while d:
    v = d.popleft()
    for i in graph[v]:
        if dist[i] != -1:
            continue
        ans[i] = v
        dist[i] = 0
        d.append(i)
print("Yes")
for i in ans[2:]:
    print(i)

Measured memory_bytes: 52952
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        int n = sc.nextInt();
        int count = 0;
        int max = 0;
        for (int i = 0; i < n; i++) {
            int l =  sc.nextInt();
            count += l;
            if (max < l) max = l;
        }

        count -= max;

        if (count > max ) {
            System.out.println("Yes");
        } else {
            System.out.println("No");
        }
    }
}


Measured memory_bytes: 23764
#include<iostream>
#include<iomanip>
#include<string>
#include<set>
#include<vector>
#include<utility>
#include<algorithm>

using namespace std;

#define LL long long
#define MOD 1000000007

int n, a[200002], b[200002];

int main() {
	cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> a[i];
		b[i] = a[i];
	}
	sort(a, a + n);
	for (int i = 0; i < n; i++) {
		if (b[i] == a[n - 1])
			cout << a[n - 2] << endl;
		else cout << a[n - 1] << endl;
	}

	return 0;
}

Measured memory_bytes: 3200
#include <stdio.h>
#include <string.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>
#include <limits.h>
#include <math.h>
int acs(const void *a, const void *b) { return *(int *)a - *(int *)b; } /* 1,2,3,4.. */
int des(const void *a, const void *b) { return *(int *)b - *(int *)a; } /* 8,7,6,5.. */
int cmp_char(const void *a, const void *b)
{
  return *(char *)a - *(char *)b;
} /* a,b,c,d.. */
int cmp_str(const void *a, const void *b)
{
  return strcmp(*(const char **)a, *(const char **)b);
} /* aaa,aab.. */
#define min(a, b) (a < b ? a : b)
#define max(a, b) (a > b ? a : b)
#define rep(i, n) for (int i = 0; i < n; i++)
typedef long long ll;

int main(void)
{
  int n, d[100001];

  scanf("%d", &n);
  rep(i, n)
  {
    scanf("%d", &d[i]);
  }

  qsort(d, n, sizeof(int), acs);

  int half = n / 2;
  int ans = d[half] - d[half - 1];
  printf("%d\n", ans);
  return 0;
}


Measured memory_bytes: 892
import std.algorithm;
import std.array;
import std.ascii;
import std.bigint;
import std.complex;
import std.container;
import std.conv;
import std.functional;
import std.math;
import std.range;
import std.stdio;
import std.string;
import std.typecons;

auto readInts() {
	return array(map!(to!int)(readln().strip().split()));
}
auto readInt() {
	return readInts()[0];
}
auto readLongs() {
	return array(map!(to!long)(readln().strip().split()));
}
auto readLong() {
	return readLongs()[0];
}

void readlnTo(T...)(ref T t) {
    auto s = readln().split();
    assert(s.length == t.length);
    foreach(ref ti; t) {
        ti = s[0].to!(typeof(ti));
        s = s[1..$];
    }
}

const real eps = 1e-10;

const long p = 1_000_000_000 + 7;

class Tree {
    this(int i) {
        this.i = i;
        this.h = -1;
    }
    int i;
    long h;
    Tree[] c;

    void calcHeight() { 
        if(h >= 0) {
            return;
        }
        if(c.empty()) {
            h = 0;
        } else {
            long[] hs;
            foreach(ci; c) {
                ci.calcHeight();
                hs ~= ci.h;
            }
            hs.sort();
            h = reduce!(max)(0L, hs.zip(iota(hs.length).retro()).map!(a => a[0] + a[1]).array) + 1;
        }
    }
}

void main(){
    auto n = readInt();
    int[] a;
    foreach(i; iota(n-1)) {
        a ~= readInt()-1;
    }
    auto t = new Tree[](n);
    foreach(i; iota(n)) {
        t[i] = new Tree(i);
    }
    foreach(i, k; a) { 
        auto j = i+1;
        t[k].c ~= t[j];
    }
    t[0].calcHeight();
    writeln(t[0].h);
}



Measured memory_bytes: 43772
#include <algorithm>
#include <bits/stdc++.h>
#include<iostream>
#include<string>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(), (x).end()
#define ll long long
int main(){
    string s,t;
    cin>>s>>t;
    sort(all(s));
    sort(all(t),greater<int>());
    if(s<t)cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
}

Measured memory_bytes: 256