akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define pb push_back
#define f(i,a,n) for(int i=a ; i<n ; i++)
#define inf 1e17
#define MAX_SIZE 1000005 

void pr(int arr[], int size) 
{ for (ll i=0; i < size; i++) {printf("%d ", arr[i]); }cout << endl;}

int main () {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  ll t = 1;
//   cin >> t;
  while(t--){
   string a , b;
   cin >> a >> b;
   ll n = a.length();
   bool x = true;
   for(ll i = 0;i < n;i++){
       if(a[i] != b[i]){
           cout << "No" << endl;
           x = false;
           break;
       }
   }
   if(x){
       cout << "Yes" << endl;
   }
   
  }
  
 
  return 0;
}


Measured memory_bytes: 3608
#include<bits/stdc++.h>
#define all(x) (x).begin(),(x).end()
typedef long long ll;
#define rep(i,n) for(ll i=0, i##_len=(n); i<i##_len; ++i)
using namespace std;
#define sz(x) ((int)(x).size())
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
#define MEMSET(v, h) memset((v), h, sizeof(v))
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; }
#define pb push_back
#define mp make_pair
#define y0 y3487465
#define y1 y8687969
#define j0 j1347829
#define j1 j234892
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
const ll INF = 1LL<<60;
 
int main() {
	ll n, m;
  	cin >> n >> m;
  	vector<tuple<ll, ll, ll>> data(m);
  rep(i,m){
    	ll p;
    	ll y;
    	cin >> p;
    	cin >> y;
    	data[i] = make_tuple(y, p, i);
  	}
 	sort(data.begin(), data.end());
  	vector<ll> cnt(n + 1);
  
  	vector<pair<ll, ll>> id(m);
  	for(ll i = 0; i < m; ++i){
      ll y, p, idx;
      tie(y, p, idx) = data[i];
      ++cnt[p];
      id[idx] = make_pair(p, cnt[p]);
    }
  	for(ll i = 0; i < m; ++i){
      cout << setw(6) << setfill('0') << id[i].first;
      cout << setw(6) << setfill('0') << id[i].second << endl;
  	}
  
}

Measured memory_bytes: 6144
#include <iostream>
#include <string>
#include<algorithm>
using namespace std;
typedef long long ll;
int main(){
ll a,b,c,x,y;
cin >>a>>b>>c>>x>>y;
ll sum=0;
if(a>=2*c){
sum+=2*c*x;
y=y-x;
if(b>=2*c){
if(y>0){
sum+=2*c*y;
}
}
}
else if(b>=2*c){
sum+=2*c*y;
x=x-y;
if(x>0){
sum+=a*x;
}
}
else if(a+b>=2*c){
if(x<y){
sum+=2*c*x;
y=y-x;
sum+=b*y;
}
else{
sum+=2*c*y;
x=x-y;
sum+=a*x;
}
}
else{
sum=a*x+b*y;
}
cout<< sum;
return 0;

}

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

int main()
{
  int n;
  cin >> n;
  int x, ans = 0;
  char s;
  for(int i = 0; i < n; i++) {
    cin >> s;
    if(s == 'I') {
      x++;
    }
    else {
      x--;
    }
    ans = max(ans, x);
  }
  cout << ans << endl;
  
  return 0;
}

Measured memory_bytes: 256
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		int n = sc.nextInt();
		List<Integer> xlist = new ArrayList<Integer>();
		List<Integer> ylist = new ArrayList<Integer>();
		for (int i = 0; i < n; i++) {
			xlist.add(Integer.parseInt(sc.next()));
		}
		for (int i = 0; i < n; i++) {
			ylist.add(Integer.parseInt(sc.next()));
		}
		double d1,d2,d3,d4;
		d1 = d2 = d3 = d4 = 0;
		for (int i = 0; i < n; i++) {
			d1 += Math.abs(xlist.get(i) - ylist.get(i));
			d2 += (xlist.get(i) - ylist.get(i))*(xlist.get(i) - ylist.get(i));
			d3 += Math.abs((xlist.get(i) - ylist.get(i))*(xlist.get(i) - ylist.get(i))*(xlist.get(i) - ylist.get(i)));
			double tmp = Math.abs(xlist.get(i) - ylist.get(i));
			if (d4 < tmp) d4=tmp;
		}
		d2 = Math.sqrt(d2);
		d3 = Math.pow(d3, 1.0/3.0);
		System.out.println(String.format("%.5f", d1));
		System.out.println(String.format("%.5f", d2));
		System.out.println(String.format("%.5f", d3));
		System.out.println(String.format("%.5f", d4));
	}
}



Measured memory_bytes: 26592
#include<iostream>
#include<vector>

int main(){
	int n;

	std::cin>>n;

	int sum=0;
	int idx=0;
	int delta;

	while(sum<=n){
		idx++;
		sum+= idx;
	}

	delta= sum-n;

	for(int i=1; i<=idx; i++){
		if(i== delta)
			continue;

		std::cout<<i<<std::endl;
	}


	return 0;
	
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long
#define pb push_back
using namespace std;
int main()
{
   ll n,q1;
   cin>>n>>q1;
   vector<vector<ll>>adj(n+1);
   for(ll i=1;i<n;i++)
   {
       ll a,b;
       cin>>a>>b;
       adj[a].pb(b);
       adj[b].pb(a);
   }
   vector<ll>vv(n+1,0),v1(n+1,0);
   for(ll i=0;i<q1;i++)
   {
       ll x,y;
       cin>>x>>y;
       vv[x]+=y;
   }
   ll z=0;
   bool vis[200001]={0};
   queue<ll>q;
   q.push(1);
   vis[1]=1;
   while(!q.empty())
   {
       ll p=q.front();
       q.pop();
       //z=vv[p];
       //v1[p]+=vv[p];
       //z+=v1[p];
       for(ll i=0;i<adj[p].size();i++)
       {
           if(!vis[adj[p][i]])
           {
               q.push(adj[p][i]);
               vv[adj[p][i]]+=vv[p];
               vis[adj[p][i]]=1;
           }
       }
   }
   for(ll i=1;i<=n;i++)
   cout<<vv[i]<<" ";

}


Measured memory_bytes: 19696
X, Y, A, B, C =map(int, input().split())
p = list(map(int, input().split()))
q = list(map(int, input().split()))
r = list(map(int, input().split()))

p.sort(reverse=True)
q.sort(reverse=True)
r.sort(reverse=True)
ate = p[0:X] +q[0:Y] + r
# print(ate)
# for i in range(len(r)):
#     if r[i] > ate[-1]:
#         ate[-1] = r[i]
#         ate.sort(reverse=True)
#     else:
#         break
# print(sum(ate))
ate.sort(reverse=True)
ate = ate[0:X+Y]
print(sum(ate))

Measured memory_bytes: 112236
#!usr/bin/env python3
from collections import defaultdict, deque
from heapq import heappush, heappop
from itertools import permutations, accumulate
import sys
import math
import bisect
def LI(): return [int(x) for x in sys.stdin.buffer.readline().split()]
def I(): return int(sys.stdin.buffer.readline())
def LS():return [list(x) for x in sys.stdin.readline().split()]
def S():
    res = list(sys.stdin.readline())
    if res[-1] == "\n":
        return res[:-1]
    return res
def IR(n):
    return [I() for i in range(n)]
def LIR(n):
    return [LI() for i in range(n)]
def SR(n):
    return [S() for i in range(n)]
def LSR(n):
    return [LS() for i in range(n)]

sys.setrecursionlimit(1000000)
mod = 1000000007

def solve():
    n,a,b,c,d = LI()
    b -= a
    n -= 1
    if b < -n*d or b > n*d:
        print("NO")
        return
    m = n*d
    x = -m
    y = n*(d-c)
    z = max(0,(n-1)*(c-d)+2*c)
    while x < m:
        if x <= b <= x+y:
            print("YES")
            return
        x += y+z
    print("NO")
    return

#Solve
if __name__ == "__main__":
    solve()


Measured memory_bytes: 38768
#include <bits/stdc++.h>
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
using namespace std;

#define ll long long
#define ld long double
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define gcd __gcd
#define lcm(a, b) ((a) * (b) / gcd((a), b))
#define all(x) x.begin(), x.end()
#define rep(i, x, n) for (ll i = x; i < n; i++)
#define fastio() ios_base::sync_with_stdio(NULL); cin.tie(0); cout.tie(0)
#define endl '\n'

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

template <class T> inline T RD(T &a) {T x; cin >> x; return a = x;}

signed main()
{
//	freopen("TEXT.inp", "r", stdin); freopen("TEXT.out", "w", stdout);
	fastio();
    
    string s; cin >> s;
    if (s == "ABC") cout << "ARC";
    else cout << "ABC";
}


Measured memory_bytes: 3636
/*Allah Vorosha*/
#include<bits/stdc++.h>
#define ll long long
#define ld long double
#define ull unsigned long long
#define pb push_back
#define n_p next_permutation
#define p_p prev_permutation
#define in insert
#define rev reverse
#define pf push_front
#define pob pop_back
#define uniq(v)         v.resize(distance(v.begin(),unique(v.begin(),v.end())))
#define all(x) (x).begin(),(x).end()
#define pof pop_front
#define ios ios_base::sync_with_stdio(0);cin.tie();cout.tie();
#define scn scanf
#define prt printf
#define rep(i, a, n) for(int i = a; i < n; i++)
#define mod 1000000007
#define yes cout << "YES\n"
#define no cout << "NO\n";
#define take for(auto &it : a) cin >> it;
#define out cout << a << "\n";
#define l_b lower_bound
#define u_b upper_bound
#define Max 100005
template<typename T> T mymax(T x, T y) {
    return (x > y ? x : y);
}

using namespace std;

const int N = 2e5 + 5;

void solve() {
    long long x, l;
    cin >> x >> l;
    ll m = x % 2019;
    ll p = x + (2019 - m);

    ll ans = 1e8;
    for(ll i = x; i < min(l, p); i++) {
        for(ll j = i + 1; j <= min(l, p); j++) {
            ll prod = ((i % 2019) * (j % 2019)) % 2019;
            ans = min(ans, prod);
        }
    }
    cout << ans;
}

int main() {

    solve();
    return 0;
}


Measured memory_bytes: 3564
/*
跳到第i个的最小花费由可以跳到i的花费决定
dp[i]=min(dp[k]+|a[i]-a[k]|)
k表示能跳到i的位置
*/
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MAXN = 1e5 + 5;
const int inf = 0x3f3f3f3f;
int n, k;
int a[MAXN], dp[MAXN];
int main()
{
    cin >> n >> k;
    for (int i = 1; i <= n; i++)
        cin >> a[i], dp[i] = inf;
    dp[1] = 0;
    for (int i = 2; i <= n; i++)
    {
        for (int j = i - 1; j >= i - k && j >= 1; j--)
            dp[i] = min(dp[i], dp[j] + abs(a[i] - a[j]));
    }
    cout << dp[n];
    return 0;
}

Measured memory_bytes: 1024
use proconio::input;

fn main() {
    input! {
        n: usize,
        m: usize,
        q: usize,
        r: [(usize, usize); m],
        queries: [(usize, usize); q],
    }

    let mut table = vec![vec![0; n + 1]; n + 1];
    
    // O(m)
    for i in 0..m {
        table[r[i].0][r[i].1] += 1;
    }
    // O(n^2)
    for i in 0..=n {
        for j in 1..=n {
            table[i][j] += table[i][j - 1];
            //println!("table[{}][{}]; {}", i, j, table[i][j]);
        }
    }

    // O(Q * n)
    for &query in &queries {
        let mut ans = 0;
        for i in query.0..=query.1 {
            ans += table[i][query.1];
        }
        println!("{}", ans);
    }
}


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

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

      cout << "No" << endl;
      return 0;

    }
  }
  cout << "No" << endl;
}

Measured memory_bytes: 256
n,k=map(int,input().split())
arr=list(map(int,input().split()))
temp=[0]*n
temp[n-2]=abs(arr[n-2]-arr[n-1])
if n>=3:
    i=n-3
    while i>=0:
        idx=i
        count=0
        temp1=[]
        for j in range(idx+1,n):
            temp1.append(abs(arr[j]-arr[idx])+temp[j])
            count+=1
            if count==k:
                break
        temp[idx]=min(temp1)
        i-=1
print(temp[0])

Measured memory_bytes: 54672
N = int(input())
A = list(map(int, input().split()))


def is_possible(C):
    res = 0
    for x in A:
        if x+C - N >= 0:
            res += (x+ C - N)//(N+1) + 1
    #print(res,C)
    return int(res <= C)

l = 0  # impossible
r = 10**30  # possible
is_possible(1234567894848)
while r - l > 1:
    M = (l+r)//2
    if is_possible(M)>0:
        r = M
    else:
        l = M
for i in range(10**5,-1,-1):
    if is_possible(r -i):
        print(r-i)
        break

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

int main(void){
    ios::sync_with_stdio(0);
    cin.tie(0);
    int H, N;
    cin >> H >> N;
    int arr[N+2];

    int sum = 0;
    for(int i = 0; i < N; i++){
        cin >> arr[i];
        sum += arr[i];
    }
    if(sum >= H) cout << "Yes";
    else cout << "No";
    return 0;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
#define y1 aaaaaaaaaaaa
#pragma GCC optimize("O3")
#define gcd(a, b) ((!a || !b) ? (a || b) : __gcd(a, b))

using namespace std;

typedef long long ll;

mt19937 rnd(1);

void solve()
{
  int h, w, n;
  cin >> h >> w >> n;
  int r, c;
  cin >> r >> c;
  r--, c--;
  string s, t;
  cin >> s >> t;
  map <char, int> a, b;
  auto f = [&] (int r, int h)
  {
     int min_bal = 0;
  int max_bal = 0;
  for (int i = 0; i < n; i++)
  {
    if (s[i] == 'R')
    {
      if (max_bal + 1 + r >= h) max_bal--;
      min_bal++;
      if (min_bal + r >= h)
      {
        cout << "NO\n";
        exit(0);
      }
    }
    if (s[i] == 'L')
    {
      if (min_bal - 1 + r < 0) min_bal++;
      max_bal--;
      if (max_bal + r < 0)
      {
        cout << "NO\n";
        exit(0);
      }
    }
    if (t[i] == 'R')
    {
      max_bal++;
      if (max_bal + r >= h) max_bal--;
    }
    if (t[i] == 'L') {
      min_bal--;
      if (min_bal + r < 0) min_bal++;
    }
  }
  };
  f(c, w);
  a.clear(), b.clear();
  for (int i = 0; i < n; i++)
  {
    if (s[i] == 'U') s[i] = 'L';
    else if (s[i] == 'D') s[i] = 'R';
    else s[i] = '-';
    if (t[i] == 'U') t[i] = 'L';
    else if (t[i] == 'D') t[i] = 'R';
    else t[i] = '-';
  }
  f(r, h);
  cout << "YES\n";
}

int main()
{
#ifdef ONPC
  freopen("a.in", "r", stdin);
#endif
  ios::sync_with_stdio(0);
  solve();
}


Measured memory_bytes: 920
#include <bits/stdc++.h>
#define ALL(obj) begin(obj), end(obj)
#define debug(x) cerr << #x << ": " << x << '\n'
using namespace std;
template <class T>
vector<T> make_vec(size_t a) {
    return vector<T>(a);
}
template <class T, class... Ts>
auto make_vec(size_t a, Ts... ts) {
    return vector<decltype(make_vec<T>(ts...))>(a, make_vec<T>(ts...));
}
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;
}

using ll = long long;
using ull = unsigned long long;
const ll INF = 1LL << 60;
//const int MOD = 1e9 + 7;

// pair
template <class T1, class T2>
ostream &operator<<(ostream &s, pair<T1, T2> p) {
    s << "(" << p.first << "->" << p.second << ") ";
    return s << endl;
}

// 1次元 vector
template <class T>
ostream &operator<<(ostream &s, vector<T> vec) {
    for (int i = 0; i < (int)vec.size(); ++i) {
        if (i > 0) {
            s << " ";
        }
        s << vec[i];
    }
    return s << endl;
}
ll N, M, K, Q, X, Y, A, B, C;
using Pair = pair<ll, ll>;
int main() {
    cin >> X >> Y >> A >> B >> C;
    vector<ll> p(A), q(B), r(C);

    for (int i = 0; i < A; i++) {
        cin >> p.at(i);
    }
    for (int i = 0; i < B; i++) {
        cin >> q.at(i);
    }
    for (int i = 0; i < C; i++) {
        cin >> r.at(i);
    }

    sort(p.begin(), p.end(), greater<ll>());
    sort(q.begin(), q.end(), greater<ll>());
    sort(r.begin(), r.end(), greater<ll>());

    vector<ll> s;
    for (int i = 0; i < X; i++) {
        s.push_back(p[i]);
    }
    for (int i = 0; i < Y; i++) {
        s.push_back(q[i]);
    }
    for (int i = 0; i < C; i++) {
        s.push_back(r[i]);
    }
    sort(s.begin(), s.end(), greater<ll>());
    cout << accumulate(s.begin(), s.begin() + X + Y, 0LL) << endl;
    return 0;
}


Measured memory_bytes: 8688
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.util.StringTokenizer;

public class Main {
    static PrintWriter out;

    public static void main(String[] args) throws IOException {
        out = new PrintWriter(new OutputStreamWriter(System.out));
        CF_Reader in = new CF_Reader();

        int n = in.intNext();
        int[] nums = in.nextIntArray(n);
        out.println(solve(nums));

        out.close();
    }

    static String solve(int[] nums) {
        for (int num: nums) {
            if (num % 2 == 0 && num % 3 != 0 && num % 5 != 0) return "DENIED";
        }
        return "APPROVED";
    }

    static class CF_Reader {
        BufferedReader br;
        StringTokenizer st;

        public CF_Reader() throws IOException {
            br = new BufferedReader(new InputStreamReader(System.in));
        }

        String next() throws IOException {
            while (st == null || !st.hasMoreTokens())
                st = new StringTokenizer(br.readLine().trim());
            return st.nextToken();
        }

        long longNext() throws IOException {
            return Long.parseLong(next());
        }

        int intNext() throws IOException {
            return Integer.parseInt(next());
        }

        double doubleNext() throws IOException {
            return Double.parseDouble(next());
        }

        char charNext() throws IOException {
            return next().charAt(0);
        }

        public int[] nextIntArray(final int n) throws IOException {
            final int[] a = new int[n];
            for (int i = 0; i < n; i++)
                a[i] = intNext();
            return a;
        }

        public long[] nextLongArray(final int n) throws IOException {
            final long[] a = new long[n];
            for (int i = 0; i < n; i++)
                a[i] = longNext();
            return a;
        }

        String line() throws IOException {
            return br.readLine().trim();
        }
    }
}


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

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

#define INF 1 << 30
#define REP(i,n) for(ll i=0; i<(int)(n); i++)
#define FOR(i,k,n) for(ll i=(k);i<(int)(n);i++)



vector<bool> gen_sosuu(vector<bool> sosuu){
  int size = sosuu.size();
  REP(i,size){
    sosuu[i] = true;
  }
  sosuu[0] = false;
  sosuu[1] = false;
  sosuu[2] = true;
  FOR(i,2,sqrt(size)+1){
    if(sosuu[i] == false) continue;
    for(int j = 2; i*j<size;j++){
      sosuu[i*j] =false;
    }
  }
  return sosuu;
}

int n;
int costb[4004][2004],costw[4004][2004],dp[4004][4004];
int b[2004],w[2004];


int main(){
  cin >> n;
  REP(i,2*n){
    char c;
    int x;
    cin >> c >> x;
    if(c=='B') b[x] = i;
    else w[x] = i;
  }
  FOR(i,1,n+1)FOR(j,1,i){
    if(b[i] < b[j]) costb[i][0]++;
    if(w[i] < w[j]) costw[i][0]++;
  }
  FOR(i,1,n+1)FOR(j,1,n+1){
    costb[i][j] = costb[i][j-1] + (b[i]<w[j]);
    costw[i][j] = costw[i][j-1] + (w[i]<b[j]);
  }
  REP(i,4004)REP(j,4004) dp[i][j] = INF;
  dp[0][0] = 0;
  REP(i,n+1)REP(j,n+1){
    dp[i+1][j] = min(dp[i+1][j],dp[i][j]+costb[i+1][j]);
    dp[i][j+1] = min(dp[i][j+1],dp[i][j]+costw[j+1][i]);
  }
  cout << dp[n][n] << endl;
}

/*
typedef pair<char,int> psi;

vector<pii> v;
int n;

int main(){
  cin >> n;
  REP(i,2*n){
    char s;
    int a;
    int k;
    cin >> s >> a;
    if(s=='B') k = 0;
    else k= 1;
    v.push_back(pii(k,a));
  }
  int in[2] = {1,1};//0:B,1:Wの番号
  int cnt = 0;
  REP(i,v.size()){
    int color = v[i].first;
    int num = v[i].second;
    if(num==in[color]){
      in[color]++;
      continue;
    }
    int k = 0;
    FOR(j,i+1,v.size()){
      cnt++;
      //cout << k <<color<< in[color] << endl;
      if(v[j].first!=color){
        //if(v[j].second < in[v[j].first]) cnt--;
        continue;
      }
      if(v[j].second!=in[color]){
        continue;
      }
      //cout << color << " " << in[color] << k  << endl;
      pii tmp = v[j];
      v.erase(v.begin()+j);
      v.insert(v.begin()+i,tmp);
      in[color]++;
      //cnt += k;
      break;
    }
  }
  cout << cnt << endl;
}
*/


Measured memory_bytes: 98560
#include <cstdio>

int main()
{
    int r,b,g;
    scanf("%d %d %d",&r,&g,&b);
    
    if((r*100 + g*10 + b)%4 == 0)
    {
        printf("YES");
    }
    else 
    {
        printf("NO");
    }
}

Measured memory_bytes: 1724
#include <iostream>
#include <vector>
#include <array>
#include <list>
#include <set>
#include <map>
#include <utility>
#include <string>
#include <sstream>
#include <algorithm>
#include <random>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <cmath>
#include <cassert>
#include <climits>

using namespace std;

static array<int, 10> kWeights = {
	{ 0, 2, 5, 5, 4, 5, 6, 3, 7, 6 }
};


struct Elem {
	uint64_t weight;
	int64_t  take_value;
	int64_t  not_take_value;
};

uint64_t seek(const vector<Elem>& elems, int kbits[40], int pos) {
	if (pos < 0) return 0;
	if (!kbits[pos]) return seek(elems, kbits, pos - 1) + elems[pos].not_take_value;

	uint64_t take     = elems[pos].take_value + seek(elems, kbits, pos - 1);
	uint64_t not_take = elems[pos].not_take_value;
	for (int i = 0; i < pos; i++) {
		not_take += max(elems[i].take_value, elems[i].not_take_value);
	}
	return max(take, not_take);
}

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

	vector<uint64_t> as(n);
	for (uint64_t& a : as) {
		cin >> a;
	}

	int64_t bits[40] = {};
	int64_t not_bits[40] = {};
	for (uint64_t a : as) {
		for (int i = 0; i < 40; i++) {
			(a & (1ULL << i)) ? bits[i]++ : not_bits[i]++;
		}
	}

	// weight - value に変換
	vector<Elem> elems(40);
	for (int i = 0; i < 40; i++) {
		elems[i].weight = (1ULL << i);
		elems[i].take_value = (1ULL << i) * not_bits[i];
		elems[i].not_take_value = (1ULL << i) * bits[i];
	}
	
	int kbits[40] = {};
	for (int i = 0; i < 40; i++) {
		if (k & (1ULL << i)) kbits[i] = 1;
	}
	uint64_t val = seek(elems, kbits, 39);
	cout << val << endl;

	return 0;
}

Measured memory_bytes: 1024
import * as fs from 'fs';

const input: string[] = fs.readFileSync("/dev/stdin", "utf8").split("\n");
const n: number = parseInt(input[0].split(' ')[0]);
let k: number = parseInt(input[0].split(' ')[1]);
const h: number[] = input[1].split(' ').map(n => parseInt(n)).sort((a, b) => b - a);

// 3 1
// 4 1 5
// 5
let result: number = 0;

if (k < h.length) {
    for (let i: number = 0; i < n; i++) {
        if (k > 0) {
            // 必殺技
            k -= 1;
            continue;
        }

        // 攻撃
        result += h[i];
    }
}
console.log(result);


Measured memory_bytes: 34692
#define _CRT_SECURE_NO_WARNINGS
#include<sstream>
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<climits>
#include<cmath>
#include<string>
#include<vector>
#include<set>
#include<map>
#include<queue>
#include<numeric>
#include<functional>
#include<algorithm>
#include<bitset>
#include<tuple>
#include<unordered_set>
#include<random>
using namespace std;
#define INF (1<<29)
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define all(v) v.begin(),v.end()
#define uniq(v) v.erase(unique(all(v)),v.end())


int main() {
	ios::sync_with_stdio(0);
	cin.tie(0);
	int a, b;
	cin >> a >> b;
	if (a <= 0 && 0 <= b)cout << "Zero" << endl;
	else if (1 <= a || (b - a + 1) % 2 == 0)cout << "Positive" << endl;
	else cout << "Negative" << endl;

	return 0;
}

Measured memory_bytes: 256
# -*- coding: utf-8 -*-
 
import math
import itertools
import sys
import copy
 
# 入力
#A, B, C, D = map(int, input().split())
#L = list(map(int, input().split()))
#S = list(str(input()))
N = int(input())
S = list(str(input()))

b = 0
w = 0
for i in range(N) :
  if S[i] == "." :
    w += 1

minN = w
for j in range(N) :
  if S[j] == "#" :
    b += 1
  else :
    w -= 1
  minN = min(minN, b+w)
print (minN)
  
    
    
    
  

Measured memory_bytes: 5352
#include <iostream>
#include <algorithm>
#include <math.h>
#include <string.h>
#include <vector>

typedef long long ll;
using namespace std;

int main()
{
    int a, b, c;
    cin >> a >> b >> c;
    if ((a < c && c < b )|| (a > c && c > b)) cout <<"Yes" <<endl;
    else cout <<"No" <<endl;
    return 0;
}


Measured memory_bytes: 256
#include<vector>
#include<cmath>
#include<map>
#include<cstdlib>
#include<iostream>
#include<sstream>
#include<fstream>
#include<string>
#include<algorithm>
#include<cstring>
#include<cstdio>
#include<set>
#include<stack>
#include<bitset>
#include<functional>
#include<ctime>
#include<queue>
#include<deque>
#include<complex>
#include<cassert>
using namespace std;
#define pb push_back
#define pf push_front
typedef long long lint;
typedef complex<double> P;
#define mp make_pair
#define fi first
#define se second
typedef pair<int,int> pint;
#define All(s) s.begin(),s.end()
#define rAll(s) s.rbegin(),s.rend()
#define REP(i,a,b) for(int i=a;i<b;i++)
#define rep(i,n) REP(i,0,n)
int out[114514],pat[114514];
string s;
string sw="SW";
int n;
int main()
{
	cin>>n;cin>>s;
	rep(i,n){
		if(s[i]=='o') pat[i]=0;else pat[i]=1;
	}
	pat[n]=pat[0];pat[n+1]=pat[1];
	rep(i,4){
		out[0]=i/2;out[1]=i%2;
		REP(j,1,n+1){
			out[j+1]=(pat[j]+out[j]+out[j-1])%2;
		}
		if(out[0]==out[n] && out[1]==out[n+1]){
			string ret="";
			rep(j,n) ret+=sw[out[j]];
			cout<<ret<<endl;
			return 0;
		}
	}
	cout<<-1<<endl;
}


Measured memory_bytes: 1408
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()   //reverse
#define strall(v) (v).cbegin(),(v).cend() //const_itterator
using namespace std;
using ll = long long;
using P = pair<int,int>;
using Graph = vector<vector<int>>;
template<class t,class u> void chmax(t&a,u b){if(a<b)a=b;}
template<class t,class u> void chmin(t&a,u b){if(b<a)a=b;}

const int INF = 1e9+5;
const ll LINF = 1e18;

int main() {
    string S, T;
    cin >> S >> T;
    bool ok = true;
    map<char,char> ma, ima;
    for (int i = 0; i < S.size(); ++i) {
        char s = S[i], t = T[i];
        if (ma.count(s)) if (ma[s] != t) ok = false;
        if (ima.count(t)) if (ima[t] != s) ok = false;
        ma[s] = t; ima[t] = s;
    }
    if (ok) puts("Yes");
    else puts("No");
}

Measured memory_bytes: 776
from collections import deque

K = int(input())
q = deque(tuple(range(1, 10)))
cnt = 0
while cnt < K:
    v = q.popleft()
    cnt += 1
    for i in [-1, 0, 1]:
        c = int(str(v)[-1]) + i
        if 0 <= c <= 9:
            q.append(v * 10 + c)

print(v)


Measured memory_bytes: 47708
#include<iostream>
#include<string>
using namespace std;
int main()
{
    string cube;
    cin >> cube;

    int zero=0;
    int one = 0;
    for(int i=0;i<cube.size();i++){
        if(cube[i] == '0'){
            zero++;
        }
        else one++;
    }
    zero>one?cout << (one*2):cout << (zero*2);

    return 0;
}

Measured memory_bytes: 512
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll,ll> P;
typedef pair<int,int> Pi;
#define rep(i,n) for(ll i=0;i<n;i++)
#define FOR(i,a,b) for(ll i=a;i<b;i++)
#define fi first
#define se second
#define endl "\n"

template<typename T> inline bool chmax(T &a, T b){if(a<b){a=b;return true;}return false;}
template<typename T> inline bool chmin(T &a, T b){if(a>b){a=b;return true;}return false;}
template<typename T> ostream& operator<<(ostream& s,const complex<T>& d) {return s<<"("<<d.real()<<", "<<d.imag()<< ")";}
template<typename T1, typename T2> ostream& operator<<(ostream& s,const pair<T1,T2>& d) {return s<<"("<<d.first<<", "<<d.second<<")";}
template<typename T> ostream& operator<<(ostream& s, const vector<T>& d){int len=d.size();rep(i,len){s<<d[i];if(i<len-1) s<<" ";}return s;}
template<typename T> ostream& operator<<(ostream& s,const vector<vector<T>>& d){int len=d.size();rep(i,len){s<<d[i]<<endl;}return s;}
template<typename T> ostream& operator<<(ostream& s,const set<T>& v){s<<"{ ";for(auto itr=v.begin();itr!=v.end();++itr) {if (itr!=v.begin()) {s<< ", ";}s<<(*itr);}s<<" }";return s;}
template<typename T1, typename T2> ostream& operator<<(ostream& s,const map<T1,T2>& m){s<<"{"<<endl;for(auto itr=m.begin();itr!=m.end();++itr){s<<" "<<(*itr).first<<" : "<<(*itr).second<<endl;}s<<"}"<<endl;return s;}

const ll mod=1e9+7;
const ll inf=1e17;
const int INF=1e9;
const double PI=acos(-1);
const double EPS=1e-10;

int main(){
	cin.tie(0);ios::sync_with_stdio(false);
	int h,w;
	cin>>h>>w;
	vector<string> g(h);
	rep(i,h){
		cin>>g[i];
	}
	rep(i,h){
		rep(j,w){
			if(g[i][j]=='#') continue;
			int cnt=0;
			for(int x=-1;x<=1;x++)for(int y=-1;y<=1;y++){
				if(!x && !y) continue;
				int nx=i+x,ny=j+y;
				if(0<=nx && nx<h && 0<=ny && ny<w){
					if(g[nx][ny]=='#') cnt++;
				}
			}
			g[i][j]=char(cnt+'0');
		}
	}
	rep(i,h){
		cout<<g[i]<<endl;
	}
}

Measured memory_bytes: 256
import sys
input = sys.stdin.buffer.readline
from collections import deque

def main():
    N,M = map(int,input().split())
    lang = [[] for _ in range(M)]
    for i in range(N):
        info = list(map(int,input().split()))
        info.pop(0)
        for num in info:
            lang[num-1].append(i)

    con = [[] for _ in range(N)]
    for s in lang:
        l = len(s)
        if l>1:
            for i in range(l-1):
                con[s[i]].append(s[i+1])
                con[s[i+1]].append(s[i])

    go = [False for _ in range(N)]
    go[0] = True
    que = deque([0])
    while que:
        now = que.pop()
        for fol in con[now]:
            if go[fol]:
                continue
            else:
                que.append(fol)
                go[fol] = True
                
    print("YES" if all(go) else "NO")

if __name__ == "__main__":
    main()

Measured memory_bytes: 27044
#include<algorithm>
#include <iostream>
#include  <cstdlib>
#include  <cstring>
#include   <string>
#include   <vector>
#include   <cstdio>
#include    <queue>
#include    <stack>
#include    <ctime>
#include    <cmath>
#include      <map>
#include      <set>
#define ll long long
#define getchar() (p1 == p2 && (p2 = (p1 = buf) + fread(buf, 1, 1<<22, stdin), p1 == p2) ? EOF : *p1++)
using namespace std;
char buf[(1 << 22)], *p1 = buf, *p2 = buf;
inline int read() {
    char c = getchar(); int x = 0, f = 1;
    while(c < '0' | c > '9') {if(c == '-') f = -1; c = getchar();}
    while(c >= '0' && c <= '9') x = x * 10 + c - '0', c = getchar();
    return x * f;
}
int main(){
    #ifdef DanDan
    freopen("in.txt","r",stdin);
    //freopen("in.txt","w",stdout);
    #endif //DanDan
    int n=read(),k=read();
    printf("%d\n",k==1?0:n-k);
    return 0;
}



Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include<cstring>
#include <stack>
#include <algorithm>
using namespace std;
#define ll long long
#define N 200005
#define INF 0x3f3f3f3f
#define eps 0.00000001//偏差值1e8
#define pi acos(-1.0)//高精度圆周率
const int maxn = 2e7+2;
const int maxp = 1010;	//点的数量
#define fori for(i=0;i<n;i++)
#define fori1 for(i=1;i<=n;i++)

int main()
{
	ll n, t, q, ret;
	ll i, j, k, x;
	ll flag = 1;
	ll sum = 0,ans=0;
	cin >> n;
	if (n % 2 == 0)
		cout << (n + 1) * (n / 2) - n << endl;
	else
		cout << (n + 1) * (n / 2) + n / 2 + 1 - n << endl;

	
}


Measured memory_bytes: 256
def chmin(a, b) a < b ? a : b end

def fin(x)
  puts x
  exit
end

L, R = gets.strip.split.map(&:to_i)

res = 3000
(L..R-1).each do |i|
  (i+1..R).each do |j|
    res = chmin((i * j) % 2019, res)
    fin(res) if res.zero?
  end
end

puts res


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

int main() {
  string S;
  cin >> S;
  int N = S.length();

  long long ans = 0;
  for (int bit = 0 ; bit < (1 << (N - 1)) ; bit++) {
    string tmp = "";
    long long sm = 0;
    long long a = S[0] - '0';
    for (int i = 0 ; i < N - 1 ; i++) {
      if ((bit >> i) & 1) {
        sm += a;
        a = 0;
      }
      a = a * 10 + S[i+1] - '0';
    }
    sm += a;
    ans += sm;
  }
  cout << ans << endl;
}


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

int coins[] = {500, 100, 50, 10, 5, 1};
int main()
{
    int sum;
    while(cin >> sum && sum) {
        int ans = 0;
        sum = 1000 - sum;
        while(sum > 0) {
            for(int i = 0; i < 6; i++) {
                ans += (int)(sum / coins[i]);
                sum %= coins[i];
            }
        }
        cout << ans << endl;
    }
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
using namespace std;
const long long INF = 1e10;

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

int main(){
    int N;
    cin >> N;
    vector<long long> H(N);
    for(int i = 0; i < N; i++)cin >> H[i];
    H.push_back(INF);
    int ans = 0;
    int cnt = 0;
    for(int i = 0; i < N; i++){
        if(H[i] >= H[i + 1])cnt++;
        else{
            chmax(ans, cnt);
            cnt = 0;
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 1792
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <utility>
#include <math.h>
#define REP(i,n) for(int i=0;i<n;i++)
#define REP2(i,n1,n2) for(int i=n1;i<n2;i++)
using namespace std;
typedef long long ll;

int main() {
    int n;
    cin >> n;
    int a[101];
    REP(i,n){
        cin >> a[i];
    }
    int m=0;
    REP(i,n){
        REP(j,n){
            m = max(m,abs(a[i]-a[j]));
        }
    }
    int res = m;
    cout << res << endl;
    return 0;
}


Measured memory_bytes: 768
N = int(input())
T, A = [int(a) for a in input().split()]
best_h = (T - A) / 0.006
H_list = [abs(int(a) - best_h) for a in input().split()]
h = min(H_list)
ret = H_list.index(h) + 1
print(str(ret))


Measured memory_bytes: 3060
#include <iostream>
#include <algorithm>
#include <map>
#include <string>
using namespace std;
int main(){
	int i,j=0,n;
	for(cin>>n;j<n;j++){
		string s,a,b;cin>>s;map<string,int> m;
		for(i=1;i<s.length();i++){
			a=s.substr(0,i),b=s.substr(i);
			m[a+b]=1;m[b+a]=1;reverse(a.begin(),a.end());
			m[a+b]=1;m[b+a]=1;reverse(b.begin(),b.end());
			m[a+b]=1;m[b+a]=1;reverse(a.begin(),a.end());
			m[a+b]=1;m[b+a]=1;reverse(b.begin(),b.end());
		}
		cout<<m.size()<<endl;
	}
}

Measured memory_bytes: 1300
/*ANKON GHOSH
  KUET,ECE 2K16*/
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define inf 1e18
#define MAX 4003
#define mod 1000000007
#define sf(a) scanf("%lld",&a)
#define sff(a,b) scanf("%lld %lld",&a,&b)
#define sfff(a,b,c) scanf("%lld %lld %lld",&a,&b,&c)
#define Case(i) cout<<"Case #"<<i<<": "
#define pf(a) printf("%lld\n",a)
#define pfsn printf("NO\n")
#define pfs  printf("YES\n")
#define pff(a,b) printf("%lld %lld\n",a,b)
#define pfff(a,b,c) printf("%lld %lld %lld\n",a,b,c)
#define pffff(a,b,c,d) printf("%lld %lld %lld %lld\n",a,b,c,d)
#define FOR(i,n) for(ll i=0;i<n;i++)
#define FOR1(i,n) for(ll i=1;i<=n;i++)
#define LOOP(x,y) for(ll r=x;r<=y;r++)
#define RFOR(i,n) for(ll i=n-1;i>=0;i--)
#define RFOR1(i,n) for(ll i=n;i>0;i--)
#define RLOOP(x,y) for(ll i=y;i>=x;i--)
#define m_p(a,b) make_pair(a,b)
#define p_b(a) push_back(a)
#define ff first
#define ss second
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL)
map<ll,ll>mp1,mp;
vector<pair<ll,pair<ll,ll> > >vpp,vpp1;
vector<pair<ll,ll> >vp,fin;
vector<ll>v1,v2,dummy;
map<pair<ll,ll>,bool>mbb;
map<ll,bool>mb;
ll n,k,a,b,c,d,ta,sum=0,cnt=0,m,l,req,sz,maxi;
bool sortbysec(const pair<pair<ll,ll>,ll> &a,const pair<pair<ll,ll>,ll> &b)
{
    return (a.second < b.second);
}
vector<ll>power;
int main()
{
    string s;
    cin>>s;
    bool flag=0;
    FOR(i,s.size())
    {
        if(i%2==0 and s[i]=='L') flag=1;
        else if(i%2==1 and s[i]=='R') flag=1;
    }
    if(flag) cout<<"No"<<endl;
    else cout<<"Yes"<<endl;
    return 0;
}
/*
5
4
3
2
3
4
4
3
3
4
2
3
*/


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

struct Edge{
    int to, id;
};

vector<vector<Edge>> g;

int main(void){
    int n;
    cin >> n;
    g.resize(n);
    for(int i=0;i<n-1;i++){
        int a,b;
        cin >> a >> b;
        g[a-1].push_back((Edge){b-1,i});
        g[b-1].push_back((Edge){a-1,i});
    }

    queue<int> q;
    vector<int> color(n-1,-1); //辺id->色番号
    vector<int> entry(n,-1);   //頂点に初到着時に使った色
    q.push(0);
    int colorsize = 0;
    while(!q.empty()){
        int k = 1;
        int pos = q.front(); q.pop();
        for(int i=0;i<g[pos].size();i++){
            int to = g[pos][i].to; int ed = g[pos][i].id;
            if(color[ed]!=-1) continue;

            if(entry[pos]==k) k++;
            color[ed] = k;
            entry[to] = k;
            q.push(to);

            colorsize = max(colorsize,k);
            k++;
        }
    }

    cout << colorsize << endl;
    for(int i=0;i<n-1;i++) cout << color[i] << endl;

}

Measured memory_bytes: 7296
#include <iostream>
#include <algorithm>
#include <string>
#include <math.h>
#include <cstdint>
#include <vector>
#include <sstream>
#include <unordered_map>

using namespace std;
typedef long long ll;


ll ans, mx, mn, flag, sum, cnt;

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

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

int main(){
	string s,t;
	cin>>s>>t;
	for(ll i=0; i<s.size(); i++){
		if(s[i]!=t[i]){
			cout<<"No";
			return 0;
		}
	}
	cout<<"Yes";
}


Measured memory_bytes: 3592
#include <bits/stdc++.h>
using namespace std;
int main() {
    int A, B, C, D;
    string ticket;
    cin >> ticket;

    A=ticket[0]-'0';
    B=ticket[1]-'0';
    C=ticket[2]-'0';
    D=ticket[3]-'0';

    int count=0;

    if (A + B + C + D == 7) {
        cout << A << '+' << B << '+' << C << '+' << D << '=' << 7 << endl;
        count++;
    }

    if (A + B + C - D == 7 && count == 0) {
        cout << A << '+' << B << '+' << C << '-' << D << '=' << 7 << endl;
        count++;
    }
    
    if (A + B - C - D == 7 && count == 0) {
        cout << A << '+' << B << '-' << C << '-' << D << '=' << 7 << endl;
        count++;
    }
    
    if (A + B - C + D == 7 && count == 0) {
        cout << A << '+' << B << '-' << C << '+' << D << '=' << 7 << endl;
        count ++;
    }
    if (A - B + C + D == 7 && count == 0) {
        cout << A << '-' << B << '+' << C << '+' << D << '=' << 7 << endl;
        count++;
    }

    if (A - B + C - D == 7 && count == 0) {
        cout << A << '-' << B << '+' << C << '-' << D << '=' << 7 << endl;
        count++;
    }

    if (A - B - C - D == 7 && count == 0) {
        cout << A << '-' << B << '-' << C << '-' << D << '=' << 7 << endl;
        count++;
    }

    if (A - B - C + D == 7 && count == 0) {
        cout << A << '-' << B << '-' << C << '+' << D << '=' << 7 << endl;
    }        

}

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

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

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

	int n,k; cin >> n >> k;
	int a[100005];
	for (int i = 0;i < n;i++){
		cin >> a[i];
	}

	sort(a,a+n);
	int MIN = INT_MAX;
	for (int i = 0;i <= n-k;i++){
		MIN = min(a[i+k-1] - a[i],MIN);
	}

	cout << MIN << endl;

	return 0;

}


Measured memory_bytes: 640
package main

import (
	"fmt"
)

func main() {
	var n int
	fmt.Scan(&n)
	li := make([]int, n)
	for i:=0; i<n ;i++ {
		fmt.Scan(&li[i])
	}
	var b int
	for i := 0; i < n-1; i++ {
		 if i == 0 {
		 	b = gcd(li[i], li[i+1])
		 } else {
		 	b = gcd(b, li[i+1])
		 }
	}
	fmt.Println(b)
}

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

Measured memory_bytes: 5504
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define all(v) (v).begin(),(v).end()
#define chmin(x,y) x = min(x,y)
#define chmax(x,y) x = max(x,y)
typedef pair<int, int> P;
typedef long long ll;
const int INF = 1001001001;
const ll LINF = 1001002003004005006ll;
const ll MOD = 1e9+7;
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() {
	int n, m;
	cin >> n >> m;
    vector<int> num(n, 1);
    vector<int> red(n, 0); red[0] = 1;

    int x, y;
    rep(i,m) {
        cin >> x >> y; --x; --y;
        if (red[x]) red[y] = 1;
        num[x]--; num[y]++;
        if (num[x] == 0) red[x] = 0;
    }

    int ans = 0;
    rep(i,n) {
        if (red[i]) ans++;
    }
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 1024
#include <cmath>
#include <cstdio>

#include <stack>
#include <queue>
#include <algorithm>
#include <iostream>
#include <vector>
#include <map>
#include <numeric>
#include <string>
#include <array>

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

using namespace std;
typedef long long int ll;

int main() {
  ll n;
  cin >> n;
  vector<ll> a(n), aa;
  rep(i, n) cin >> a.at(i);
  rep(i, n) a.push_back(a.at(i)+1);
  rep(i, n) a.push_back(a.at(i)-1);
  sort(all(a));
  aa = a;
  aa.erase(unique(all(aa)),aa.end());
  ll maxa=-1;
  for (const auto& i : aa){
    ll m = distance(lower_bound(all(a),i), upper_bound(all(a), i));
    if (m>maxa) maxa = m;
  }

  cout << maxa << endl;
}

Measured memory_bytes: 5460
#include <stdio.h>
typedef long long ll;

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

ll n, m;
ll a;
ll dp[100005];

ll solve(ll i);

int main()
{
    for (int i = 0; i < 100005; i++) {
        dp[i] = -1;
    }

    scanf("%lld %lld", &n, &m);
    for (int i = 0; i < m; i++) {
        scanf("%lld", &a);
        dp[a] = 0;
    }

    printf("%lld\n", solve(0));

    return 0;
}

ll solve(ll i)
{
    if (dp[i] != -1) {
        return dp[i];
    }
    if (i == n) {
        return 1;
    }
    if (i > n) {
        return 0;
    }

    return dp[i] = (solve(i + 1) + solve(i + 2)) % mod;
}


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

struct cdn {
    int x, y;
};

int main() {
    int N, maxRotPls, minRotPls, maxRotMns, minRotMns, ans;
    cin >> N;
    cdn cdns[N];
    for (int i = 0; i < N; i++) {
        cin >> cdns[i].x >> cdns[i].y;
    }
    
    // 初期化
    maxRotPls = minRotPls = cdns[0].x + cdns[0].y;
    maxRotMns = minRotMns = cdns[0].x - cdns[0].y;
    for (int i = 0; i < N; i++) {
        maxRotPls = max(maxRotPls, cdns[i].x + cdns[i].y);
        minRotPls = min(minRotPls, cdns[i].x + cdns[i].y);
        maxRotMns = max(maxRotMns, cdns[i].x - cdns[i].y);
        minRotMns = min(minRotMns, cdns[i].x - cdns[i].y);
    }
    ans = max(maxRotPls - minRotPls, maxRotMns - minRotMns);
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 5168
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n;
    cin >> n;
    int a[n+1],b[n+1],c[n+1];
    int dp[n+1][3];
    for(int i=1;i<=n;i++)
        cin >> a[i] >> b[i] >> c[i];
    dp[1][0] = a[1];
    dp[1][1] = b[1];
    dp[1][2] = c[1];
    for(int i=2;i<=n;i++){
        dp[i][0] = max(dp[i-1][1]+a[i],dp[i-1][2]+a[i]);
        dp[i][1] = max(dp[i-1][0]+b[i],dp[i-1][2]+b[i]);
        dp[i][2] = max(dp[i-1][0]+c[i],dp[i-1][1]+c[i]);
    }
    cout << max(dp[n][0],max(dp[n][1],dp[n][2])) << "\n";
}

Measured memory_bytes: 2560
fun main() {
    println(if (nextInt() == 0) 1 else 0)
}
// # Utils
// ## Input
fun next() = readLine()!!
fun nextInt() = next().toInt()
fun nextLong() = next().toLong()
fun nextDouble() = next().toDouble()
fun nextList() = next().split(" ")
fun nextIntList() = next().split(" ").map(String::toInt)
fun nextLongList() = next().split(" ").map(String::toLong)
fun nextDoubleList() = next().split(" ").map(String::toDouble)
// ## Array
inline fun <reified T> sizedArray(size: Int, default: T) = Array(size) { default }
inline fun <reified T> sized2DArray(row: Int, column: Int, default: T) = Array(row) { Array(column) { default } }
// ## mod^-1
//    [NOTE] CANNOT use this for 0, mod, 2mod, 3mod ...(return wrong value)
fun modinv(num: Long, mod: Long): Long {
    var a = num
    var b = mod
    var u = 1L
    var v = 0L
    while (b > 0) {
        val t = a.div(b)
        a -= t * b
        a = b.also { b = a } // swap a and b
        u -= t * v
        u = v.also { v = u } // swap u and v
    }
    u %= mod
    if (u < 0) u += mod
    return u
}

fun gcd(x: Int, y: Int): Int {
    fun innerGcd(x: Int, y: Int): Int {
        return if (x % y == 0) y else innerGcd(y, x % y)
    }
    return if (x >= y) innerGcd(x, y) else innerGcd(y, x)
}

fun gcd(x: Long, y: Long): Long {
    fun innerGcd(x: Long, y: Long): Long {
        return if (x % y == 0L) y else innerGcd(y, x % y)
    }
    return if (x >= y) innerGcd(x, y) else innerGcd(y, x)
}


Measured memory_bytes: 34524
// SeeAlso: 

#include <bits/stdc++.h>

using namespace std;

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

#define MAX 100000
#define NIL -1
#define MOD 1000000007

typedef int _loop_int;
#define rep(i,n) for(int i = 0; i < 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 debug(x) cout<<#x<<": "<<x<<endl
#define debig_vec(v) cout<<#v<<":";rep(i,v.size())cout<<" "<<v[i];cout<<endl
#define ALL(a) (a).begin(),(a).end()

// 最大公約数
inline constexpr ll gcd(ll a,ll b){if(!a||!b)return 0;while(b){ll c=b;b=a%b;a=c;}return a;}
// 最小公倍数
inline constexpr ll lcm(ll a,ll b){if(!a||!b)return 0;return a*b/gcd(a,b);}

#define print2D(h, w, arr) rep(i, h) { rep(j, w) cout << arr[i][j] << " "; cout << endl; }
template<class T> inline void print(const T& x){cout << setprecision(12) << x << endl;}
template<class T, class... A> inline void print(const T& first, const A&... rest) { cout << first << " "; print(rest...); }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

const long long INF = 1LL<<60;

int main() {
    int a; cin >> a;
    int ans = 0;
    int t = a;
    rep(i, 3) {
        ans += t;
        t *= a;
    }
    print(ans);
    return 0;
}


Measured memory_bytes: 3572
// dfmt off
T lread(T=long)(){return readln.chomp.to!T;}T[] lreads(T=long)(long n){return iota(n).map!((_)=>lread!T).array;}
T[] aryread(T=long)(){return readln.split.to!(T[]);}void arywrite(T)(T a){a.map!text.join(' ').writeln;}
void scan(L...)(ref L A){auto l=readln.split;foreach(i,T;L){A[i]=l[i].to!T;}}alias sread=()=>readln.chomp();
void dprint(L...)(lazy L A){debug{auto l=new string[](L.length);static foreach(i,a;A)l[i]=a.text;arywrite(l);}}
static immutable MOD=10^^9+7;alias PQueue(T,alias l="b<a")=BinaryHeap!(Array!T,l);import std;
// dfmt on

void main()
{
    long N = lread();
    long[long] D;
    foreach (i; 1 .. N + 1)
    {
        auto f = factorize(i);
        foreach (k; f)
            D[k] = D.get(k, 0) + 1;
    }
    long ans = 1;
    foreach (k, v; D)
        ans *= v + 1, ans %= MOD;
    writeln(ans);
}

/// 素因数分解
T[] factorize(T = long)(T x)
{
    assert(0 < x, "x is negative");
    T[] result;
    while ((x & 1) == 0)
        x /= 2, result ~= 2;
    for (T i = 3; i * i <= x; i += 2)
        while (x % i == 0)
            x /= i, result ~= i;
    if (x != 1)
        result ~= x;
    return result;
}


Measured memory_bytes: 3748
#include <bits/stdc++.h>
  
using namespace std;
  
#define rep(i,n) REP(i,0,n)
#define REP(i,s,e) for(int i=(s); i<(int)(e); i++)
#define repr(i, n) REPR(i, n, 0)
#define REPR(i, s, e) for(int i=(int)(s-1); i>=(int)(e); i--)
#define pb push_back
#define all(r) (r).begin(),(r).end()
#define rall(r) (r).rbegin(),(r).rend()
#define fi first
#define se second
  
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
 
const int INF = 1e9;
const ll MOD = 1e9 + 7;
double EPS = 1e-8;

struct UFT{    //O(loga(n))
    int n;
    vi d, r;
    UFT(int n) : n(n), d(n, -1), r(n, 0){};
    int root(int i){
        if(d[i] < 0) return i;
        return d[i] = root(d[i]);
    }
    bool same(int x, int y){
        return root(x) == root(y);
    }
    bool unite(int x, int y){
        x = root(x);
        y = root(y);
        if(x == y) return false;

        if(r[x] < r[y]) swap(x, y);
        else if(r[x] == r[y]) r[x]++;
        d[x] += d[y];
        d[y] = x;
        return true;
    }
    int size(int i){
        return -d[root(i)];
    }
};

struct Edge{
    int frm, to;
    ll cost;
    bool operator < (const Edge& e) const {
        return cost < e.cost;
    }
};

int main(){
#ifdef LOCAL_TEST
    freopen("in", "r", stdin);
    freopen("out", "w", stdout);
#endif
    int n;
    cin >> n;
    vector<vl> d(n, vl(n));
    rep(i, n) rep(j, n) cin >> d[i][j];
    rep(i, n) if(d[i][i] != 0) {
        cout << -1 << endl;
        return 0;
    }
    rep(i, n) rep(j, n) if(d[i][j] != d[j][i]) {
        cout << -1 << endl;
        return 0;
    }
    rep(i, n) rep(j, n) rep(k, n) {
        if(d[i][j] > d[i][k] + d[k][j]) {
            cout << -1 << endl;
            return 0;
        }
    }
    ll ans = 0LL;
    vector<vi> f(n, vi(n));
    rep(i, n) rep(j, i) {
        rep(k, n) {
            if(k == i || k == j) continue;
            if(d[i][k] + d[k][j] == d[i][j]) f[i][j] = 1;
        }
    }
    rep(i, n) rep(j, i) if(f[i][j] == 0) ans += d[i][j];
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 1280