akhauriyash/Code-Regression huggingface dataset:
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define max(a, b) ((a) > (b) ? (a) : (b))
#define min(a, b) ((a) < (b) ? (a) : (b))
typedef long long ll;

int next_perm(int *p, int n)
{
    int i, j, k, tmp;

    for (i = n - 1; i > 0 && p[i - 1] >= p[i]; i--)
        ;

    if (i == 0)
        return 0;

    for (j = n - 1; j > i && p[i - 1] >= p[j]; j--)
        ;

    tmp = p[i - 1], p[i - 1] = p[j], p[j] = tmp;

    for (k = 0; k <= ((n - 1) - i) / 2; k++)
        tmp = p[i + k], p[i + k] = p[(n - 1) - k], p[(n - 1) - k] = tmp;

    return 1;
}

double dist(int i, int j, int x[], int y[])
{
    double dist;
    double dx = x[i] - x[j];
    double dy = y[i] - y[j];
    dist = sqrt((dx * dx) + (dy * dy));
    return dist;
}

int main(void)
{
    double ans = 0;

    int n;
    scanf("%d", &n);

    int x[n], y[n], p[n];
    rep(i, n)
    {
        scanf("%d", &x[i]);
        scanf("%d", &y[i]);
        p[i] = i;
    }

    int cnt = 0;
    do
    {
        rep(i, n - 1)
            ans += dist(p[i], p[i + 1], x, y);
        cnt++;
    } while (next_perm(p, n));

    printf("%.12f\n", ans / (double)cnt);

    return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
#define FOR(i,start,end) for(int i=start;i<=end;i++)
const int INF = 1001001001;
using namespace std;
typedef long long ll;

int main()
{
  int N, M;
  vector<int> ships1, shipsN;
  int res=0;
  cin >> N >> M;

  rep(i,M) {
    int a, b;
    cin >> a >> b;
    if(a==1) ships1.push_back(b);
    if(b==N) shipsN.push_back(a);
  }

  sort(ships1.begin(),ships1.end(),greater<int>());
  sort(shipsN.begin(),shipsN.end(),greater<int>());

  while(ships1.size() && shipsN.size()){
    int a, b;
    b = ships1.back();
    a = shipsN.back();
    if(a==b) {
      cout << "POSSIBLE" << endl;
      return 0;
    }
    else if(b<a) ships1.pop_back();
    else shipsN.pop_back();
  }

  cout << "IMPOSSIBLE" << endl;
}


Measured memory_bytes: 1276
#include "bits/stdc++.h"
#define MAXN 100009
#define INF 1000000007
#define mp(x,y) make_pair(x,y)
#define all(v) v.begin(),v.end()
#define pb(x) push_back(x)
#define wr cout<<"----------------"<<endl;
#define ppb() pop_back()
#define tr(ii,c) for(__typeof((c).begin()) ii=(c).begin();ii!=(c).end();ii++)
#define ff first
#define ss second
#define my_little_dodge 46
#define debug(x)  cerr<< #x <<" = "<< x<<endl;
using namespace std;

typedef long long ll;
typedef pair<int,int> PII;
template<class T>bool umin(T& a,T b){if(a>b){a=b;return 1;}return 0;}
template<class T>bool umax(T& a,T b){if(a<b){a=b;return 1;}return 0;}
int arr[MAXN];
int main(){
    //~ freopen("file.in", "r", stdin);
    int n;
    scanf("%d",&n);
    for(int i=1;i<=n;i++)
		scanf("%d",arr+i);
	int last=0,ans=0;
	for(int i=2;i<=n;i++){
		if(arr[i]==arr[i-1] and !last)
			last=1,ans++;
		else
			last=0;
	}
	printf("%d\n",ans);
	return 0;
}


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

int main(){
    ll x, y;
    cin >> x >> y;

    vector<ll> vec;
    int ans = 0;
    ll num = x;
    while (num <= y){
        num *= 2;
        ans++;

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


Measured memory_bytes: 3632
#include <iostream>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <vector>
#include <numeric> // accumulate(v.begin(), v.end(), 0)                                 

using namespace std;
#define ll long long

int main(){
  int N;
  cin >> N;
  vector<int> T;
  int sumT = 0;
  for(int i=0; i<N; i++){
    int t;
    cin >> t;
    T.push_back(t);
    sumT += t;
  }
  int M;
  cin >> M;
  for(int i=0; i<M; i++){
    int p, x;
    cin >> p >> x;
    cout << sumT - T[p-1] + x << endl;
  }
  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<utility>
#define REP(i,n) for(int i = 0;i < (n);i++)
#define pb push_back
using namespace std;
const int INF = 1e9;
typedef long long ll;

int main(){
  int n;
  cin >> n;
  /*vector <ll> t;
  vector <ll> x;
  vector <ll> y;*/
  int f,g,t = 0;
  f = 0;
  g = 0;
  bool r = true;
  REP(i,n){
    int a,b,c;
    cin >> a >> b >> c;
    int tt = a-t;
    int x = abs(b-f);
    int y = abs(g - c);
    int d = tt - (x+y);
    if(d%2 != 0 || d < 0){
      r = false;
      //break;
    }
    t = a;
    f = b;
    g = c;
    
  }
  if(r)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
  return 0;
}


Measured memory_bytes: 256
//INCLUDE
//------------------------------------------
#include <stdio.h>
#include <iostream>
#include <functional>
#include <algorithm>
#include <math.h>
#include <iomanip>
#include <string>
#include <cstring>
#include <vector>
//DEFINE
//------------------------------------------
#define ll long long
#define ALLv(a)  (a).begin(),(a).end()
#define ALL(a,n)  (a),(a)+n
#define vi vector<long long>
#define vd vector<long double>
#define vs vector<string>
//CONST
//------------------------------------------
#define INF 1010000000000000017LL
#define MOD 1000000007LL
#define EPS 1e-12
#define PI 3.14159265358979323846
//REPEAT
//------------------------------------------
#define   FOR(i,m,n) for(ll (i)=(m);   (i)<(n);  (i)++)
#define   REP(i,n)   for(ll (i)=0;     (i)<(n);  (i)++)
#define  REPS(i,x)   for(ll (i)=1;     (i)<=(x); (i)++)
#define  RREP(i,x)   for(ll (i)=(x)-1; (i)>=0;   (i)--)
#define RREPS(i,x)   for(ll (i)=(x);   (i)> 0;   (i)--)
#define  WREP(i,in,j,jn) REP(i,in)REP(j,jn)
using namespace std;
//-------------------------------------------

int main(void){
    ll a,b,c;cin>>a>>b>>c;
    ll MIN=min(a,min(b,c));
    ll MAX=max(a,max(b,c));
    ll MED=a+b+c-MIN-MAX;
    printf("%lld %lld %lld\n",MIN,MED,MAX);
    return 0;
}



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

int main() {
  int W, H, x, y, r;
  cin >> W >> H >> x >> y >> r;

  if(x >= r && y >= r && x <= W - r && y <= H - r)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
}


Measured memory_bytes: 3108
#include<bits/stdc++.h>
using namespace std;
int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n, k, q;
  cin >> n >> k >> q;
  vector<int> v(n, 0);
  for(int i = 0; i < q; i++){
    int a;
    cin >> a;
    v[a-1]++;
  }
  for(int i = 0; i < n; i++){
    if(v[i] > q-k) cout << "Yes" << endl;
    else cout << "No" << endl;
  }
  return 0;
}
    

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

//マクロ
//forループ関係
//引数は、(ループ内変数,動く範囲)か(ループ内変数,始めの数,終わりの数)、のどちらか
//Dがついてないものはループ変数は1ずつインクリメントされ、Dがついてるものはループ変数は1ずつデクリメントされる
#define REP(i,n) for(lol i=0;i<lol(n);i++)
#define REPD(i,n) for(lol i=n-1;i>=0;i--)
#define FOR(i,a,b) for(lol i=a;i<=lol(b);i++)
#define FORD(i,a,b) for(lol i=a;i>=lol(b);i--)
#define VL vector<lol>
//xにはvectorなどのコンテナ
#define ALL(x) x.begin(),x.end() //sortなどの引数を省略したい
#define SIZE(x) lol(x.size()) //sizeをsize_tからllに直しておく
//定数
#define PI 3.1415926535897932385 //pi
#define INF 1000000000000 //10^12:極めて大きい値,∞
#define MOD 1000000007 //10^9+7:合同式の法
#define MAXR 100000 //10^5:配列の最大のrange(素数列挙などで使用)
//最大値最小値
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; }
int gcd(int a,int b){return b?gcd(b,a%b):a;}

int main()
{
    cout << fixed << setprecision(7) ;
    double result{0};
    lol n; cin >> n;
    lol k; cin >> k;
    VL p(n);
    REP(i, n)
    {
        cin >> p[i];
    }
    FOR(i, 0, k-1)
    {
        double nume = (p[i]*(p[i]+1))/2;
        result += nume/p[i];
    }
    double MA = result;
    FOR(i, 1, n-k)
    {
        double nume1 = (p[i-1]*(p[i-1]+1))/2;
        MA -= nume1/p[i-1];
        double nume2 = (p[k+i-1]*(p[k+i-1]+1))/2;
        MA += nume2/p[k+i-1];
        //cout << MA << " ";
        result = max(result, MA);
    }
    //cout << endl;

    cout << result << endl;
    return 0;
}

Measured memory_bytes: 4848
//#include <bits/stdc++.h>
//#include <stdio.h>
#include<iostream>
#include<cstdio>
#include<bitset>
#include<algorithm>
#include<vector>
#include<list>
#include<queue>
#include<stack>
#include <bits/stdc++.h>
#include<string>
#include<string.h>
#include<cmath>
#include<utility>
#include<functional>
#include<map>
#include<set>
#include<cctype>
#include<fstream>
#include <numeric>
#include <iomanip>
#include <cstring> 
using namespace std;
using ll=long long;

#define FOR(i, a, b) for( int i=(a);i<=(b);i++)
#define RFOR(i, a, b) for( int i=(a);i>=(b);i--)
#define LFOR(i, a, b) for( long long int i=(a);i<=(b);i++)
#define LRFOR(i, a, b) for(long long int i=(a);i>=(b);i--)
#define MOD 1000000007


#include <iostream>
#include <cmath>
using namespace std;
 

 
bool isPrimeNum( ll x ){ // 素数である場合 true を返す
  if( x <= 1 ){ // 1以下である場合は素数でないことがすぐにわかる
    return false;
  }
  // sqrt( double型 ) は引数の平方根を double型で返すので、int型でキャスト
  int n = (int)sqrt( (double)x );
  for( int i = 2; i <= n; i++ ){
    if( x % i == 0 ){ // 割り切る整数がある場合、即判定終了
      return false;
    }
  }
  return true; // 割り切る整数がない場合、素数である
}

constexpr ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
constexpr ll lcm(int a,int b){return a*b/gcd(a,b);}
constexpr ll abs(ll a,ll b){
if(a>=b)return a-b;
if(a<b)return b-a;
}
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
 

 
int main() {
    int N,M=0;
    cin >>N;
ll count=0;
ll count1=0;
ll count2=0;
    ll a[N];
    FOR(i,0,N-1){
      cin >>a[i];
    }
    sort(a, a + N); 
    if(N%2==0){
      FOR(i,0,N/2-1){
        count = count+a[N-1-i]-a[i];
        count = count+a[N-1-i]-a[i];
      }
      count=count-(a[N/2]-a[N/2-1]);
    }else{
      FOR(i,0,N/2-1){
        count1 = count1+a[N-1-i]*2;
      }
      FOR(i,0,N/2-2){
        count1 = count1-a[i]*2;
      }
      count1=count1-a[N/2];
      count1=count1-a[N/2-1];

      FOR(i,0,N/2-2){
        count2 = count2+a[N-1-i]*2;
      }
      FOR(i,0,N/2-1){
        count2 = count2-a[i]*2;
      }
      count2=count2+a[N/2];
      count2=count2+a[N/2+1];

      if(count1>count2){count=count1;}else{count=count2;};

    }


    cout<<count<<endl;
  return 0;
}



Measured memory_bytes: 1152
// ALDS1_10_B
#include <bits/stdc++.h>
#define endl "\n"
#define rep(i,n) for(int i=0;i<int(n);i++)
#define SZ(x) ((int)(x).size())
#define all(x) (x).begin(),(x).end()
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> ipair;
typedef pair<ll,ll> lpair;
template <class T>ostream &operator<<(ostream &o,const vector<T>&v) //vectorの中身を見る
{o<<"{";for(int i=0;i<(int)v.size();i++)o<<(i>0?", ":"")<<v[i];o<<"}";return o;}

vector<int> r(110);
vector<int> c(110);
int inf=pow(10,9);
vector<vector<int>> dp(110,vector<int>(110,inf));
int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(12);
    
    int n;
    cin>>n;
    rep(i,n) cin>>r[i]>>c[i];
    rep(i,n) dp[i][i]=0; //長さ1の計算量
    for(int L=2;L<=n;L++){ //長さ 短い長さからdpテーブルを埋めていく
        for(int i=0;i<=n-2;i++){ //始点
            int j=i+L-1; //終点
            if(n-1<j) break; //範囲オーバー 
            for(int k=i;k<=j-1;k++){ //i~k,k+1~jで区切る。区切ったブロックの長さは互いにL以下なので、すでに互いのブロックの最小コストはdpテーブルにある。
                dp[i][j]=min(dp[i][j],dp[i][k]+dp[k+1][j]+r[i]*r[k+1]*c[j]);
            }
        }
    }
    cout<<dp[0][n-1]<<endl;
    return 0;
}


Measured memory_bytes: 3224
def larger(x, y):
	if x > y: return x
	return y

def euc(x, y):
	if y == 0: return x
	return euc(y, x%y)

N = int(input())
A = list(map(int, input().split()))
left = [A[0]]
for i in range(1, N):
	left.append(euc(left[-1], A[i]))
right = [A[-1]]
for i in range(1, N):
	right.append(euc(right[-1], A[-1-i]))
right.reverse()

max = larger(left[N-2], right[1])
for i in range(1, N-1):
	max = larger(max, euc(left[i-1], right[i+1]))
print(max)

Measured memory_bytes: 67052
#include <stdio.h>
#define M 1000000007
typedef long long LL;

int main()
{		
	int n, m, d, i;
	LL f, t, ans;
	
	scanf("%d%d", &n, &m);
	if(n < m) n ^= m, m ^= n, n ^= m;
	d = n - m;
	if(d > 1){
		puts("0");
		return 0;
	}
	for(i = 1, f = 1; i < n; i++){
		f = f * (LL)i % M;
	}
	t = f * (LL)n % M;
	
	if(!d) ans = t * t * 2 % M;
	else ans = t * f % M;
	printf("%lld\n", ans);	
			
	return 0;
}

Measured memory_bytes: 128
#include <algorithm>
#include <cassert>
#include <climits>
#include <cstdio>
#include <deque>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <unordered_map>
#include <utility>
#include <vector>

using namespace std;

const int INF = 1e9;
const long long LINF = 1e18;

int main() {
    string S;
    cin >> S;

    int p1 = (S[0] - '0') * 10 + (S[1] - '0');
    int p2 = (S[2] - '0') * 10 + (S[3] - '0');

    bool isYYMM = false;
    if (1 <= p2 && p2 <= 12) {
        isYYMM = true;
    }

    bool isMMYY = false;
    if (1 <= p1 && p1 <= 12) {
        isMMYY = true;
    }

    if (isYYMM && isMMYY) {
        cout << "AMBIGUOUS" << endl;
    } else if (isYYMM) {
        cout << "YYMM" << endl;
    } else if (isMMYY) {
        cout << "MMYY" << endl;
    } else {
        cout << "NA" << endl;
    }

    return 0;
}


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

typedef pair<int, int> pii;
typedef long long ll;
template<class T> using V = vector<T>;
template<class T> using VV = V<V<T>>;

#define pb push_back
#define eb emplace_back
#define mp make_pair
#define fi first
#define se second
#define rep(i,n) rep2(i,0,n)
#define rep2(i,m,n) for(int i=m;i<(n);i++)
#define ALL(c) (c).begin(),(c).end()
#define dump(x) cerr << #x << " = " << (x) << endl
constexpr ll TEN(int n) { return (n == 0) ? 1 : 10 * TEN(n-1); }

template<class T, class U> void chmin(T& t, const U& u) { if (t > u) t = u; }
template<class T, class U> void chmax(T& t, const U& u) { if (t < u) t = u; }

template<class T, class U>
ostream& operator<<(ostream& os, const pair<T, U>& p) {
	os<<"("<<p.first<<","<<p.second<<")";
	return os;
}

template<class T>
ostream& operator<<(ostream& os, const vector<T>& v) {
	os<<"{";
	rep(i, v.size()) {
		if (i) os<<",";
		os<<v[i];
	}
	os<<"}";
	return os;
}

int main() {
	int N; cin >> N;
	bool p2 = 0;
	{
		int x = N;
		while (x%2==0) {
			x/=2;
		}
		p2 = (x == 1);
	}

	if (p2) {
		puts("No");
		return 0;
	}

	puts("Yes");
	V<pii> vec;

	vec.eb(1, 2);
	vec.eb(2, 3);
	vec.eb(3, N+1);
	vec.eb(N+1, N+2);
	vec.eb(N+2, N+3);

	for (int i = 5; i <= N; i += 2) {
		vec.eb(1, i-1);
		vec.eb(1, i);
		vec.eb(i-1, i+N);
		vec.eb(i, i-1+N);
	}

	if (N % 2 == 0) {
		int a = -1, b = -1;
		for (int i = 2; i < N; ++i) {
			int to = (N ^ 1 ^ i);
			if (to >= 2 && to < N) {
				a = i, b = to;
				break;
			}
		}
		vec.eb(a, N);
		vec.eb(b, N+N);
	}

	for (auto e : vec) {
		printf("%d %d\n", e.fi, e.se);
	}

	return 0;
}

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

int main()
{
	int t=1;
//	cin>> t;
	while(t--)
	{
		int n,k;
		cin>> n >> k;
		int freq[101]={0};
		while(k--)
		{
			int d;
			cin >> d;
			while(d--)
			{
				int a;
				cin >> a;
				freq[a]++;

			}
		}
		int count=0;
		for(int i=1;i<=n;i++)
		{
			if(freq[i]==0)
			{
				count++;
			}
		}
		cout<< count<< endl;
	}
}


Measured memory_bytes: 3640
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll allscore(int i, int d, vector<vector<int>>s, vector<vector<int>>t, vector<int>c) {
	ll res = 0;
	int fury = 0;
	for (int j = 0; j < d; j++) {
		if (t.at(i).at(j) == 1) {
			res += s.at(j).at(i);
			fury = 0;
		}
		else {
			fury++;
			res -= fury * c.at(i);
		}
	}
	return res;
}
ll fastscore(vector<int>bl,int date,int fury) {
	int l = -1;
	int r = bl.size();
	for (int i = date - 1; i >= 0; i--) {
		if (bl.at(i) == 1) {
			l = i;
			break;
		}
	}
	for (int i = date + 1; i < r; i++) {
		if (bl.at(i) == 1) {
			r = i;
			break;
		}
	}
	ll ans = (r - date) * (date - l) * fury;
	return ans;
}
vector<int>greedy(int d, vector<vector<int>>s) {
	vector<int>ans(d);
	for (int i = 0; i < d; i++) {
		int res = 0;
		int tmp = -1;
		for (int j = 0; j < 26; j++) {
			if (res < s.at(i).at(j)) {
				res = s.at(i).at(j);
				tmp = j;
			}
		}
		ans.at(i) = tmp;
	}
	return ans;
}
int main() {
	//input
	int d; cin >> d;
	vector<int>c(26);
	for (int i = 0; i < 26; i++)cin >> c.at(i);
	vector<vector<int>>s(d, vector<int>(26));
	for (int i = 0; i < d; i++) {
		for (int j = 0; j < 26; j++)cin >> s.at(i).at(j);
	}
	vector<int>td = greedy(d, s);
	vector<vector<int>>t(26, vector<int>(d, 0));
	for (int i = 0; i < d; i++) {
		int x = td.at(i);
		t.at(x).at(i)++;
	}
	int m = 500000;
	vector<pair<int, int>>dq;
	for (int i = 0; i < m; i++) {
		int x = rand() % d;
		int y = rand() % 26;
		dq.push_back({ x, y });
	}
	//Q.B
	vector<int>sum(26,0);
	for (int i = 0; i < 26; i++) {
		sum.at(i) = allscore(i, d, s, t, c);
	}
	ll ans = 0;
	for (int i = 0; i < 26; i++)ans += sum.at(i);
	//Q.C
	for (int i = 0; i < m; i++) {
		int day = dq.at(i).first;
		int change = dq.at(i).second;
		if (t.at(change).at(day) == 1)continue;
		int before = td.at(day);

		//backup
		vector<vector<int>>tbu = t;
		vector<int>tdbu = td;
		//変更前と変更後について再計算、sumに反映
		t.at(before).at(day) = 0;
		t.at(change).at(day) = 1;
		td.at(day) = change;
		ll befs = fastscore(t.at(before), day, c.at(before)) + s.at(day).at(before);
		ll chgs = fastscore(t.at(change), day, c.at(change)) + s.at(day).at(change);
		if (-befs + chgs >= 0) {
			ans = ans - befs + chgs;
			sum.at(before) -= befs;
			sum.at(change) += chgs;
		}
		else{
			t = tbu;
			td = tdbu;
		}
	}
	for (int i = 0; i < d; i++)cout << td.at(i)+1 << endl;
}

Measured memory_bytes: 7560
#include <bits/stdc++.h>
using namespace std;
int main(){
  int n,a,ans=0;
  scanf("%d",&n);
  multiset <int> ms;
  multiset <int> :: iterator it;
  for(int i=0;i<n;++i){
    scanf("%d",&a);
    if(ms.empty()){
      ans++;
      ms.insert(a);
      continue;
    }
    it=ms.lower_bound(a);
      if(it!=ms.begin()){
      	--it;
        ms.erase(it);
      }
   	 else
       ans++;
      ms.insert(a);
  }
  printf("%d\n",ans);
  return 0;
}

Measured memory_bytes: 4992
#include <iostream>
#include <cstdlib>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
#include <functional>
#include <iomanip>
#include <queue>
#include <stack>
#include <stdlib.h>
using namespace std;
#define rep(i,n) for (int i = 0; i <n; i++) 

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

using namespace std;

int main(){
    int a,b;std::cin >> a>>b;
    std::cout << (b%a==0?a+b : b-a )<< std::endl;
}

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

import sys

sys.setrecursionlimit(10**7)


def read_h(typ=int):
    return list(map(typ, input().split()))


def read_v(n, m=1, typ=int):
    return [read_h() if m > 1 else typ(input()) for _ in range(n)]


def main():
    N, = read_h()
    arr = read_h()

    cnts = [0] * 100000
    for a in arr:
        cnts[a] += 1

    ans = 0
    for i in range(len(cnts) - 2):
        c = cnts[i] + cnts[i + 1] + cnts[i + 2]
        if c > ans:
            ans = c

    print(ans)


if __name__ == '__main__':
    main()


Measured memory_bytes: 14300
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> pll;
typedef pair<int, int> pii;
#define pb push_back
int main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	string s;
	cin >> s;
	if (s[0] == s[1] && s[1] == s[2]) cout << "No\n";
	else cout << "Yes\n";	
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
using namespace std;
int main(void){
    int n, k, a=0;
    string s;
    char c='a';
    cin>>n>>k>>s;
    int w=0;
    vector<int> v;
    v.push_back(0);
    for(int i=0;i<n;i++){
        if(s[i]!=c){
            if(w>0)v.push_back(w);
            c=s[i];
        }
        w++;
        if(i==n-1)v.push_back(w);
    }
    int u=v.size(), l=0, r=k*2+1;
    if(s[0]=='0'){
        a=max(a, v[min(k*2, u-1)]-v[0]);
        l=1;
        r=2*k+2;
    }
    while(l<u-1){
        r=min(r, u-1);
        a=max(a, v[r]-v[l]);
        l+=2;
        r+=2;
    }
    cout<<a<<endl;
}


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

int main() {
  int n;
  cin >> n;
  vector<int> a(n);
  rep(i, n) cin >> a[i];
  sort(a.begin(), a.end());
  int x = -1, ans = 0;
  rep(i, n) {
    
    if (a[i] != x) {
      ans++;
      x = a[i];
      continue;
    }
    
    int cnt = 1;
    while (a[i] == x) {
      cnt++;
      i++;
    }
    if (cnt%2 == 0) {
      ans--;
    }
    i--;
    
  }
  cout << ans << endl;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define gep(i,g,j) for(int i = g.head[j]; i != -1; i = g.e[i].next)
#define each(it,c) for(__typeof((c).begin()) it=(c).begin();it!=(c).end();it++)
#define rng(a) a.begin(),a.end()
#define maxs(x,y) x = max(x,y)
#define mins(x,y) x = min(x,y)
#define pb push_back
#define sz(x) (int)(x).size()
#define pcnt __builtin_popcount
#define uni(x) x.erase(unique(rng(x)),x.end())
#define snuke srand((unsigned)clock()+(unsigned)time(NULL));
#define df(x) int x = in()
#define dame { puts("0"); return 0;}
#define show(x) cout<<#x<<" = "<<x<<endl;
using namespace std;
typedef long long int ll;
typedef pair<int,int> P;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
template<typename T>istream& operator>>(istream&i,vector<T>&v)
{rep(j,sz(v))i>>v[j];return i;}
template<typename T>string join(vector<T>&v)
{stringstream s;rep(i,sz(v))s<<' '<<v[i];return s.str().substr(1);}
template<typename T>ostream& operator<<(ostream&o,vector<T>&v)
{if(sz(v))o<<join(v);return o;}
template<typename T1,typename T2>istream& operator>>(istream&i,pair<T1,T2>&v)
{return i>>v.fi>>v.se;}
template<typename T1,typename T2>ostream& operator<<(ostream&o,pair<T1,T2>&v)
{return o<<v.fi<<","<<v.se;}

const int MX = 100005, INF = 1001001001;
const ll LINF = 1e18;
const double eps = 1e-10;

// Mod int
const int mod = 1000000007;
struct mint {
  ll x;
  mint():x(0){}
  mint(ll x):x((x%mod+mod)%mod){}
  // mint(ll x):x(x){}
  mint& fix() { x = (x%mod+mod)%mod; return *this;}
  mint& operator+=(const mint& a){ if((x+=a.x)>=mod) x-=mod; return *this;}
  mint& operator-=(const mint& a){ if((x+=mod-a.x)>=mod) x-=mod; return *this;}
  mint& operator*=(const mint& a){ (x*=a.x)%=mod; return *this;}
  mint operator+(const mint& a)const{ return mint(*this) += a;}
  mint operator-(const mint& a)const{ return mint(*this) -= a;}
  mint operator*(const mint& a)const{ return mint(*this) *= a;}
  bool operator<(const mint& a)const{ return x < a.x;}
  bool operator==(const mint& a)const{ return x == a.x;}
};
istream& operator>>(istream&i,mint&a){i>>a.x;return i;}
ostream& operator<<(ostream&o,const mint&a){o<<a.x;return o;}
typedef vector<mint> vm;
//

mint dp[43][1<<18];

int main() {
  int n;
  scanf("%d",&n);
  vi a(3);
  cin >> a;
  a[1] += a[2];
  a[0] += a[1];
  int m = 18, m2 = 1<<m, m1 = 1<<(m-1);
  int z = 0;
  rep(i,3) z |= 1<<(m-1-a[i]);
  // cout<<a<<endl;
  // {bitset<18> d = z; cout<<d<<endl;}
  // {bitset<18> d = m1; cout<<d<<endl;}
  dp[0][m1] = 1;
  mint ans = 1;
  rep(i,n) ans *= 10;
  rep(i,n) {
    rep(j,m2) {
      rrep(k,10) {
        int nj = j>>k|m1;
        if ((nj&z) == z) continue;
        dp[i+1][nj] += dp[i][j];
      }
    }
  }
  rep(j,m2) ans -= dp[n][j];
  cout<<ans<<endl;
  return 0;
}





















Measured memory_bytes: 88320
A, B, C, D = list(map(int, input().split()))

t_count = A // D + (1 if A % D else 0)
a_count = C // B + (1 if C % B else 0)
ans = 'No' if t_count < a_count else 'Yes'
#  print(t_count, a_count)
print(ans)


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

int main() {
  int N;
  cin >> N;
  
  if (N == 1){
    cout << 0 << endl;
    return 0;
  }
  

  vector<long long> H(N);
  for (int i = 0; i < N; i++) {
    cin >> H.at(i);
  }
  
  vector<int> A(N-1,0);
  vector<int> B(N-1,0);
 
  for (int i = 0; i < N-1; i++) {
    if (H.at(i) >= H.at(i+1)){
      A.at(i) = 1;
    }
  }
  
  int count = 0;
  for (int i = 0; i < N-1; i++) {
    if (A.at(i) == 1 && i != N-2){
      count++;
    }
    else if (A.at(i) == 1 && i == N-2){
      count++;
      B.at(i) = count;
    }
    else {
      B.at(i) = count;
      count = 0;
    }
  }
  
  sort(B.begin(), B.end());
  reverse(B.begin(), B.end());
  cout << B.at(0) << endl;
}

Measured memory_bytes: 1792
import std.stdio, std.string, std.range, std.conv, std.array, std.algorithm, std.math, std.typecons;

void main() {
    auto tmp = readln.split.to!(long[]);
    auto K = tmp[0], A = tmp[1], B = tmp[2];
    if (B - A <= 2) {
        writeln(1 + K);
    } else {
        // A-1回最初に叩く
        const tataki = max(0, A-1);
        K -= tataki;
        long pt = 1 + tataki;
        // 残り回数が1以下になるまで2回ずつ消費し、B-Aだけ稼ぐ
        const urikai = K/2;
        K -= urikai * 2;
        pt += (B-A) * urikai;
        // 残り回数叩く
        if (K == 1) pt++;

        writeln(pt);
    }
}



Measured memory_bytes: 256
import java.util.*;
public class Main {
    public static void main(String [] args) {
        Scanner sc = new Scanner(System.in);
        String S = sc.next();
        String T = sc.next();
        int sum = 0;
        for(int i=0;i<S.length();i++)if(S.charAt(i)!=T.charAt(i))sum++;
        System.out.println(sum);
    }
}

Measured memory_bytes: 41212
#include <bits/stdc++.h>
using namespace std;
void Main();

using i8  = int8_t;   /* -128 ~ 127 */
using u8  = uint8_t;  /* 0 ~ 255 */
using i16 = int16_t;  /* -32,768 ~ 32,767 */
using u16 = uint16_t; /* 0 ~ 65,535 */
using i32 = int32_t;  /* -2,147,483,648 ~ 2,147,483,647 */
using u32 = uint32_t; /* 0 ~ 4,294,967,295 */
using i64 = int64_t;  /* -9,223,372,036,854,775,808 ~ 9,223,372,036,854,775,807 */
using u64 = uint64_t; /* 0 ~ 18,446,744,073,709,551,615 */
using f32 = float;    /* (-3.4 * 10^38) ~ (3.4 * 10^38) */
using f64 = double;   /* (-1.7 * 10^308) ~ (1.7 * 10^308) */
using f80 = __float80;
template <class T> using Vec = vector<T>;
constexpr i64 INF = 1010000000000000017;
constexpr i64 MOD = 1e9 + 7;
constexpr f64 EPS = 1e-12;
constexpr f64 PI = 3.14159265358979323846;
#define ALL(v) v.begin(), v.end()
#define YN(a, b, c) ((c)? a : b)
#define GCD(a, b) __gcd(a, b) /* 最大公約数 */
#define LCM(a, b) (i64)(a / (f64)__gcd(a, b) * b) /* 最小公倍数 */

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout << fixed << setprecision(15);
    Main();
    return 0;
}

void Main() {
    i32 N, Y;
    cin >> N >> Y;
    for (i32 i = 0; i <= N; i++) {
        for (i32 j = 0; i + j <= N; j++) {
            i32 a = 10000 * i + 5000 * j;
            if (a > Y) break;
            if ((Y - a) % 1000 == 0 && (Y - a) / 1000 == N - i - j) {
                cout << i << " " << j << " " << N - i - j << endl;
                return;
            }
        }
    }
    cout << -1 << " " << -1 << " " << -1 << endl;
}


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

int main() {
  int i, N;

  cin >> N;

  for (i = 0; i < N; ++i) {
    string a;
    cin >> a;
    if (a == "Y") break;
  }
  if (i < N) {
    cout << "Four" << endl;
  } else {
    cout << "Three" << endl;
  }
  
  return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <cmath>
#include <cstdint>
#include <cstdio>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
using namespace std;
#define rep(i, n) for(int(i) = 0; (i) < (n); (i)++)
#define FOR(i, m, n) for(int(i) = (m); (i) < (n); (i)++)
#define All(v) (v).begin(), (v).end()
#define pb push_back
#define MP(a, b) make_pair((a), (b))
using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
const int INF = 1 << 30;
const ll LINF = 1LL << 60;
const int MOD = 1e9 + 7;

int main() {
    int A, B;
    cin >> A >> B;
    cout << (A + B + 1) / 2 << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <string>
#include <math.h>
#include <cstdint>
#include <map>
 
using namespace std;
typedef long long ll;

 
ll ans,mx,sum,mn=1e8;
int main(){
	ll n;
	cin>>n;
	ll a[n];
	for(ll i=0; i<n; i++){
		cin>>a[i];
		sum+=a[i];
	}
	mn = sum/n;
	mx = mn+1;
	sum=0;
	for(ll i=0; i<n; i++){
		ans += (a[i]-mn)*(a[i]-mn);
		sum += (a[i]-mx)*(a[i]-mx);
	}
	cout<<min(ans,sum);
}


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

int main() {
	ll n; cin >> n;
	vector<ll> a(n); rep(i, 0, n) cin >> a[i];

	multiset<ll, greater<ll>> st1, st2;
	rep(i, 0, n) {
		if (st1.count(a[i])) {
			st2.insert(a[i]);
			st1.erase(a[i]);
		}
		else st1.insert(a[i]);
	}
	ll ans = 1, c = 2;
	for (auto x : st2) {
		ans *= x;
		c--;
		if (!c) break;
	}
	
	if (c) cout << 0 << endl;
	else cout << ans << endl;

	return 0;
}

Measured memory_bytes: 5760
#include <bits/stdc++.h>
#ifdef __LOCAL
    #define DBG(X) cout << #X << " = " << (X) << endl;
    #define SAY(X) cout << (X) << endl;
    #include <filesystem>
    namespace fs = std::filesystem;
#else
    #define DBG(X)
    #define SAY(X)
#endif

using namespace std;

using ll = long long int;
using ull = unsigned long long int;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;

int dx[]={1, 0, -1, 0, 1,-1, 1,-1};
int dy[]={0, 1, 0, -1, 1, 1,-1,-1};
const int INT_INF = (int)(2e9);
const ll  LL_INF = (ll)(2e18);
static mt19937 _g(time(nullptr));
 
inline ll randint(ll a, ll b) { ll w = (_g() << 31LL) ^ _g(); return a + w % (b - a + 1); }
inline void fast_io() { ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); };
template<typename T, typename S> inline ostream& operator<<(ostream& os, const pair<T, S> p) { cout << "[" << p.first << ";" << p.second << "]"; return os; }
template<typename T, typename S> inline ostream& operator<<(ostream& os, const map<T, S> p) { for (auto el : p) cout << "[" << el.first << ";" << el.second << "]"; return os; }
template<typename T> inline ostream& operator<<(ostream& os, const vector<T>& v) { for (auto el : v) cout << el << " "; return os; }
template<typename T> inline vector<T> fetch_vec(int sz) { vector<T> ret(sz); for (auto& elem : ret) cin >> elem; return ret; }

string s;
void input(){
    fast_io();
    #ifdef __LOCAL
        fs::path __p = __FILE__;
        fs::path __input, __output;
        __input = __output = __p.parent_path();
        __input += string("/input/") + string(__p.stem()) + string(".txt");
        __output += string("/output/") + string(__p.stem()) + string(".txt");
        freopen(__input.c_str(), "r", stdin);
        freopen(__output.c_str(), "w", stdout);
    #endif
    cin >> s;
}

bool solve(){
    int n=s.length();
    for (int i = 0; i < n; i++)
    {
        for (int j = i; j < n; j++)
        {
            string t = s.substr(0,i) + s.substr(j);
            if(t=="keyence") return true;
        }
        
    }
    return false;
}   

int main()
{
    input();
    cout << (solve()?"YES":"NO") << endl;
    return 0;
}


Measured memory_bytes: 256
//#include <bits/stdc++.h>
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstdlib>
#include <string>
#include <vector>
#include <map>
#include <queue>

using namespace std;

typedef long long ll;
typedef vector<int> vint;
typedef vector<vector<int> > vvint;
typedef vector<long long> vll, vLL;
typedef vector<vector<long long> > vvll, vvLL;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) for(int i=0;i<n;++i)
#define mod (ll)(1e9+7)
#define FIX(a) ((a)%mod+mod)%mod
#define ALL(obj) (obj).begin(), (obj).end()
#define rALL(obj) (obj).rbegin(), (obj).rend()
#define INF 1000000000 //1e9
#define LLINF 2000000000000000000LL //2e18
#define fi first
#define se second
#define pb push_back
int dy[]={0, 0, 1, -1};
int dx[]={1, -1, 0, 0};

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n,d;
    cin >> n >> d;
    vvint x(n,vint(d));
    REP(i,n){
        REP(j,d){
            cin >> x[i][j];
        }
    }
    int ans = 0;
    REP(i,n){
        for(int j=i+1;j<n;j++){
            int sum = 0;
            REP(k,d){
                sum+=(x[i][k]-x[j][k])*(x[i][k]-x[j][k]);
            }
            for(int k=1;k*k<=sum;k++){
                if(k*k==sum){
                    ans++;
                }
            }
        }
    }
    cout << ans << endl;
    return 0;
}

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

using namespace std;

#define rep(i, n) for(int i = 0; i < (int)n; ++i)
#define FOR(i, a, b) for(int i = a; i < (int)b; ++i)
#define rrep(i, n) for(int i = ((int)n - 1); i >= 0; --i)

using ll = long long;
using ld = long double;

const ll INF = 1e18;
const int Inf = 1e9;
const double EPS = 1e-9;
const ll MOD = 1e9 + 7;

template <typename T>
T gcd(T a, T b) {
  if (b == 0) return a;
  else return gcd(b, a % b);
}

template <typename T>
T lcm(T a, T b) {
  return a / gcd(a, b) * b;
}

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(0);
    ll a, b;
	cin >> a >> b;
	cout << lcm(a, b) << endl;
    
    return 0;
}



Measured memory_bytes: 3652
#include<iostream>
#include<cstdio>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<set>
using namespace std;
typedef long long LL;
const int INF=0x3f3f3f3f;
const int MAXN=1e5+5;
int a[MAXN];
int G[105][105];

int main()
{
    int h,mn;
    while(scanf("%d%d",&h,&mn)!=EOF)
    {
        int n;
        scanf("%d",&n);
        for(int i=1;i<=n;++i)
            scanf("%d",&a[i]);
        int cnt=1;
        for(int i=1;i<=h;++i)
        {
            if(i&1)
            {
                for(int j=1;j<=mn;++j)
                {
                   if(a[cnt]>0) {G[i][j]=cnt;--a[cnt];}
                   else if(a[cnt]==0) {++cnt;G[i][j]=cnt;--a[cnt];}
                }
            }else
            {
                for(int j=mn;j>=1;--j)
                {
                    if(a[cnt]>0) {G[i][j]=cnt;--a[cnt];}
                    else if(a[cnt]==0) {++cnt;G[i][j]=cnt;--a[cnt];}
                }
            }
        }
        for(int i=1;i<=h;++i)
        {
            for(int j=1;j<=mn;++j)
            {
                if(j!=mn) printf("%d ",G[i][j]);
                else printf("%d\n",G[i][j]);
            }
        }
    }
    return 0;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
#define int               long long
#define pb                push_back
#define ppb               pop_back
#define pf                push_front
#define ppf               pop_front
#define all(x)            (x).begin(),(x).end()
#define sz(x)             (int)((x).size())
#define fr                first
#define sc                second
#define pii               pair<int,int>
#define rep(i,a,b)        for(int i=a;i<b;i++)
#define mem1(a)           memset(a,-1,sizeof(a))
#define mem0(a)           memset(a,0,sizeof(a))
#define ppc               __builtin_popcount
#define ppcll             __builtin_popcountll

template<typename T1,typename T2>istream& operator>>(istream& in,pair<T1,T2> &a){in>>a.fr>>a.sc;return in;}
template<typename T1,typename T2>ostream& operator<<(ostream& out,pair<T1,T2> a){out<<a.fr<<" "<<a.sc;return out;}
template<typename T,typename T1>T amax(T &a,T1 b){if(b>a)a=b;return a;}
template<typename T,typename T1>T amin(T &a,T1 b){if(b<a)a=b;return a;}

const long long INF=1e18;
const int32_t M=1e9+7;
const int32_t MM=998244353;

const int N=0;



void solve(){
	int a,b,c,k;
	cin>>a>>b>>c>>k;
	int ans=0;
	ans+=min(a,k);
	k-=min(a,k);
	k-=min(b,k);
	ans-=k;
	cout<<ans;
}
signed main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);cout.tie(0);
	//freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);
	#ifdef SEIVE
		seive();
	#endif
	#ifdef NCR
		init();
	#endif
	int t=1;
	//cin>>t;
	while(t--) solve();
	return 0;
}


Measured memory_bytes: 3656
#include<bits/stdc++.h>
#define ll long long
#define ld long double
#define fi first
#define se second
#define pb push_back
#define all(v) v.begin(),v.end()
#define repf(i,a,b) for(ll i=a;i<b;i++)
#define repb(i,a,b) for(ll i=a;i>=b;i--)
#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define mod 1000000007
#define MOD 998244353 

using namespace std;

int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};

ll power(ll a, ll n, ll m)
{
    ll ans=1;
    while(n)
    {
        if(n&1) ans=(ans*a)%m;
        n>>=1;
        a=(a*a)%m;
    }
    return ans;
}

ll invmod(ll a, ll m)
{
    return power(a,m-2,m);
}

int main()
{
    int n,k,j;
    cin>>n>>k;
    int a[n],i;
    for(i=0;i<n;i++)
    {
        cin>>a[i];
    } 
    int dp[n];
    dp[0]=0;
    dp[1]=abs(a[0]-a[1]);
    for(i=2;i<n;i++)
    {
        dp[i]=INT_MAX;
        for(j=1;j<=k && j<=i;j++)
        {
            dp[i]=min(dp[i],dp[i-j]+abs(a[i]-a[i-j]));
        }
        //cout<<dp[i]<<"\n";
    }
    cout<<dp[n-1];

}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
//#include <boost/multiprecision/cpp_int.hpp>
//typedef boost::multiprecision::cpp_int ll;
typedef long double dd;
#define i_7 (ll)(1E9+7)
//#define i_7 998244353
#define i_5 i_7-2
ll mod(ll a){
    ll c=a%i_7;
    if(c>=0)return c;
    return c+i_7;
}
typedef pair<ll,ll> l_l;
ll inf=(ll)1E17;

#define rep(i,l,r) for(ll i=l;i<=r;i++)
#define pb push_back
ll max(ll a,ll b){if(a<b)return b;else return a;}
ll min(ll a,ll b){if(a>b)return b;else return a;}
void Max(ll &pos,ll val){pos=max(pos,val);}//Max(dp[n],dp[n-1]);
void Min(ll &pos,ll val){pos=min(pos,val);}
void Add(ll &pos,ll val){pos=mod(pos+val);}
dd EPS=1E-9;
#define fastio ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
///////////////////////////////////////

typedef string::const_iterator State;

#define N 600
ll dp[N][N];

string s;
bool cat(ll l,ll r){
    if(dp[l][r]!=-1){
        return dp[l][r];
    }
    if(l==r)return dp[l][r]=true;
    if(s[l]!='m'||s[r-1]!='w')return dp[l][r]=false;
    
    rep(i,l+1,r-2){
        if(s[i]=='e'){
            if(cat(l+1,i)&&cat(i+1,r-1))return dp[l][r]=true;
        }
    }
    return dp[l][r]=false;
}

int main(){fastio
    cin>>s;
    memset(dp,-1,sizeof(dp));
    if(cat(0,s.length()))cout<<"Cat"<<endl;
    else cout<<"Rabbit"<<endl;
    return 0;
}



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

int main() {
  int a[5];
  for ( int i = 0; i < 5; i++ ) { cin >> a[i]; }

  int mi = 10;
  int ct = 0;
  for ( int i = 0; i < 5; i++ ) {
    ct += ceil(a[i] / 10.0) * 10;
    if ( a[i] % 10 != 0 ) { mi = min(mi, a[i] % 10); }
  }

  cout << ct+mi-10 << endl;
  return 0;
}

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

#define rep(i, n) REP(i, 0, n)
#define repr(i, n) for (int i = (n); i >= 0; i--)
#define ALL(v) v.begin(), v.end()
#define MSG(a) cout << #a << " " << a << endl;
#define REP(i, x, n) for (int i = x; i < n; i++)
#define OP(m) cout << m << endl
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;

int main()
{
    int n, k;
    cin >> n >> k;
    set<int> d;
    rep(i, k)
    {
        int c;
        cin >> c;
        d.insert(c);
    }

    for (int i = n; i <= 100000; i++)
    {
        set<int> t, res;
        string s = to_string(i);
        rep(i, s.size()) t.insert(s[i] - '0');

        set_intersection(ALL(d), ALL(t), inserter(res, res.end()));
        if (res.empty())
        {
            OP(s);
            break;
        }
    }

    return 0;
}

Measured memory_bytes: 256
import java.util.*;
import java.io.*;
import java.math.BigInteger;
import java.nio.charset.StandardCharsets;

/*
 * K - Stone
 */
public class Main
{

public static void main( String[] args ) throws Exception
{
	new Main().run();
}


public void run() throws Exception
{
	final Scanner sc = new Scanner( getInputStream() );
	final int N = sc.nextInt();
	final int K = sc.nextInt();
	int[] result = new int[ K + 1 ];
	Arrays.fill( result, 0 ); //初期値0、負け-1、勝ち1
	int[] stones = new int[ N ];
	for( int i = 0; i < N; ++i )
	{
		stones[ i ] = sc.nextInt();
	}
	
	for( int i = 0; i <= K; ++ i )
	{
		if( i < stones[ 0 ] )
		{
			//最小のaより小さいので負ける
			result[ i ] = -1;
		}
		else
		{
			//既に調査済みなら無視
			if( result[ i ] != 0 )
			{
				continue;
			}
			
			//デフォルトは負けにしておく
			boolean win = false;
			
			//全てのaについてループ
			for( int s = 0; s < N; ++s )
			{				
				int prevIndex = i - stones[ s ];
				if( prevIndex >= 0 )
				{
					if( result[ prevIndex ] == -1 )
					{
						//1つでも負けに誘導できるなら勝ち
						win = true;
						break;
					}
				}
			}
			
			if( win )
			{
				result[ i ] = 1;
			}
			else
			{
				result[ i ] = -1;
			}
		}
	}
	
	for( int i = 0; i < result.length; ++i )
	{
		//p( i + ":" + result[ i ] );
	}
	
	if( result[ K ] == 1 )
	{
		p( "First" );
	}
	else
	{
		p( "Second" );
	}
}

public static void p( Object o )
{
	System.out.println( o );
}

public static InputStream getInputStream() throws IOException
{
	//p( System.getProperties() );
	if( System.getProperty( "test" ) != null )
	{
		return new FileInputStream( "1" );
	}
	else
	{
		return System.in;
	}
}

}


Measured memory_bytes: 37204
use std::io;
use std::cmp;
use std::collections::BTreeSet;

// read a line(without line feed)
fn read_line() -> String {
    let mut in_str = String::new();
    io::stdin().read_line(&mut in_str).unwrap();
    return in_str.trim().to_string();
}

// read wods on a line
pub fn read_words_in_line() -> Vec<String> {
    let s = read_line();
    return s.split_whitespace().map(|x| x.to_string()).collect::<Vec<String>>()
}

// read type t on a line
pub fn read_t_in_line<T : std::str::FromStr>() -> Vec<T> {
    let mut v : Vec<T> = Vec::new();
    for e in read_words_in_line().iter().map(|x| x.parse::<T>()) {
        if let Ok(r) = e {
            v.push(r);
        }
        else{
            return Vec::new();
        }
    }
    return v;
}

// sort slice
pub fn sort<T : std::cmp::Ord>(slice : &mut [T]) {
    slice.sort();
}
// sort slice by reverse order
pub fn sort_rev<T : std::cmp::Ord>(slice : &mut [T]) {
    slice.sort_by(|x, y| y.cmp(x));
}

pub fn min<T : std::cmp::Ord>(a : T, b : T) -> T{
    return cmp::min(a, b);
}

pub fn max<T : std::cmp::Ord>(a : T, b : T) -> T{
    return cmp::max(a, b);
}


fn contain(minx : i32, miny : i32, maxx : i32, maxy : i32, tx : i32, ty : i32) -> bool {
    return minx <= tx && tx <= maxx && miny <= ty && ty <= maxy;
}

fn main() {

    let n_k = read_t_in_line::<i32>();
    let (n, k) = (n_k[0], n_k[1]);

    let mut xs = vec![];
    let mut ys = vec![];

    let mut x_set : BTreeSet<i32> = BTreeSet::new();
    let mut y_set : BTreeSet<i32> = BTreeSet::new();
    
    for _ in 0..n {
        let x_y = read_t_in_line::<i32>();
        xs.push(x_y[0]);
        ys.push(x_y[1]);
    }
    for i in 0..n {
        x_set.insert(xs[i as usize]);
        y_set.insert(ys[i as usize]);
    }

    let x_vec = x_set.iter().cloned().collect::<Vec<i32>>();
    let y_vec = y_set.iter().cloned().collect::<Vec<i32>>();

    let mut ans = i64::max_value();

    for i1 in 0..(x_vec.len()) {
        for j1 in i1..(x_vec.len()) {
            let minx = x_vec[i1];
            let maxx = x_vec[j1];
            for i2 in 0..(y_vec.len()) {
                for j2 in i2..(y_vec.len()) {
                    let miny = y_vec[i2];
                    let maxy = y_vec[j2];
                    let mut cnt = 0;
                    for m in 0..n {
                        let x = xs[m as usize];
                        let y = ys[m as usize];
                        if contain(minx, miny, maxx, maxy, x, y) {
                            cnt += 1;
                        }
                    }
                    if cnt >= k {
                        ans = min(ans, (maxx - minx) as i64 * (maxy - miny) as i64);
                    }
                }
            }

        }
    }

    println!("{}", ans);

}


Measured memory_bytes: 4352
#include<bits/stdc++.h>
//#define int long long
#define FOR(i, a, b) for (int i = a; i < b; ++i)
#define rep(N) for (int i = 0; i < N; ++i)
#define Rep(a, b) for (int i = a; i < b; ++i)
#define For(i, N) for (int i = 0; i < N; ++i)
#define all(v) v.begin(), v.end()
#define rev(v) v.rbegin(), v.rend()
#define makei(N) int N; cin >> N;
#define makes(s) string s; cin >> s;
#define maked(d) double d; cin >> d;
#define makev(v, N) vi v(N); rep(N)cin >> v[i];
#define mod 1000000007

using namespace std;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vll = vector<ll>;
using vb = vector<bool>;
using vvb = vector<vector<bool>>;
using vs = vector<string>;
using pii = pair<int, int>;
using pis = pair<int, string>;
using msi = map<string, int>;

template<typename T>
void say(T s) {
	cout << s << "\n";
}

template<typename T>
void say(vector<T> s) {
	auto itr = s.begin();
	cout << *(itr++);
	while (itr != s.end()) {
		cout << " " << *(itr++);
	}
	cout << "\n";
}

template<typename T>
void say(vector<T> s, char r) {
	auto itr = s.begin();
	cout << *(itr++);
	while (itr != s.end()) {
		cout << r << *(itr++);
	}
	cout << "\n";
}

void yn(bool b) {
	if (b)say("yes");
	else say("no");
}

void Yn(bool b) {
	if (b)say("Yes");
	else say("No");
}

void YN(bool b) {
	if (b)say("YES");
	else say("NO");
}

template<typename T>
void maxi(T& a, T b) {
	a = max(a, b);
}

template<typename T>
void mini(T& a, T b) {
	a = min(a, b);
}

void exact_say(double x) {
	cout << setprecision(numeric_limits<double>::max_digits10) << x << endl;
}

template<typename T>
vector<vector<T>> fill_vector(int h, int w, T val) {
	vector<vector<T>> ret;
	vector<T> v(w, val);
	rep(h)ret.push_back(v);
	return ret;
}

template<typename T>
T maxi(vector<T> v) {
	T ret = v[0];
	Rep(1, v.size())maxi(ret, v[i]);
	return ret;
}

template<typename T>
T mini(vector<T> v) {
	T ret = v[0];
	Rep(1, v.size())mini(ret, v[i]);
	return ret;
}

signed main() {
	int red = 0;
	int blue = 0;
	makei(n);
	makes(s);
	for (char c : s) {
		if (c == 'R')red++;
		else blue++;
	}
	Yn(blue < red);
}

Measured memory_bytes: 256
#include<stdio.h>

signed main()
{
  long long l[100];
  int n;
  scanf("%d", &n);

  l[0] = 2;
  l[1] = 1;

  for ( int i = 2; i <= n; ++i ) {
    l[i] = l[i-2] + l[i-1];
  }

  printf("%lld\n", l[n]);

  return 0;
}

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


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

  double x = (a + b) / 2;
  int y = (a + b) / 2;
  double z = x - y;

  if((a + b) % 2 != 0){
    ++y;
  }
  cout << y  << endl;
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<set>
#include<math.h>
#include<vector>
#include<sstream>
#include<queue>
#include<functional>
#include<bitset>
#include<cstdio>
#include<iomanip>
#include<map>
#include<unordered_map>
#include<unordered_set>
#include <string.h>

using ll = long long;

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define reps(i, x) for(int i=1;i<=(int)(x);i++)
#define rrep(i, x) for(int i=((int)(x)-1);i>=0;i--)
#define rreps(i, x) for(int i=(int)(x);i>0;i--)
#define all(x) (x).begin(),(x).end()
#define m0(x) memset(x,0,sizeof(x))
#define vll vector<ll>
#define vi vector<int>
#define vpll vector<pair<ll,ll>>
#define vpi vector<pair<int,int>>
#define mod 1000000007
#define put2darr(arr, row, col) rep(i, row) { rep(j, col) { printf("%18d", arr[i][j]); } cout << endl; }

using namespace std;

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

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

/* 1..10
 * rep:   0 1 2 3 4 5 6 7 8 9
 * reps:  1 2 3 4 5 6 7 8 9 10
 * rrep:  9 8 7 6 5 4 3 2 1 0
 * rreps: 10 9 8 7 6 5 4 3 2 1
 */

int h[100], n;

int main() {
    cin >> n;
    rep(i, n) {
        cin >> h[i];
    }
    int ans = 0;
    while (1) {
        int i = 0;
        bool f = true;
        while (i < n && !h[i]) {
            i++;
        }
        if (i == n) {
            cout << ans << endl;
            return 0;
        }
        while (i < n && h[i]) {
            h[i]--;
            if(f) {
                f = false;
                ans++;
            }

            i++;
        }
    }

}



Measured memory_bytes: 256