akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <algorithm>
#include <climits>

typedef long long int ll;

using namespace std;

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

    vector<int> a(n), b(m);
    for (int i = 0; i < n; i++) cin >> a[i];
    for (int i = 0; i < m; i++) cin >> b[i];

    vector<ll> as(n+1), bs(m+1);
    for (int i = 1; i < n+1; i++) as[i] = as[i - 1] + a[i - 1];
    for (int i = 1; i < m+1; i++) bs[i] = bs[i - 1] + b[i - 1];

    int val = 0;
    for (int i = 0; i < n+1; i++) {
        if (k < as[i]) break;
        int j = upper_bound(bs.begin(), bs.end(), k - as[i]) - bs.begin() - 1;
//      int j = 0;
//      for (j = 0; j < m; j++) {
//          if (bs[j + 1] > k - as[i]) break;
//      }

        val = max(val, i + j);
    }

    cout << val << endl;

    return 0;
}

Measured memory_bytes: 8020
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define f(i,x,n) for(int i=x;i<n;++i)
#define ar array
void func(int n){
    for(int i=0;i<=n;++i)
        cout<<i<<" ";
    for(int i=n-1;i>=0;--i)
        cout<<i<<" ";
    cout<<endl;
}
int32_t main()
{
  int a,b; cin>>a>>b;
  int p=100*a;p/=8;
  int pp=100*b;pp/=10;
  int x=min(p,pp);
  int y=max(p,pp);
  for(int i=1;i<=10000;++i){
    int price=i;
    int ei=price*8;ei/=100;
    int ten=price*10; ten/=100;
    if(ei==a && ten==b){
      cout<<i<<"\n";
      return 0;
    }
  }
  cout<<"-1\n";
  return 0;
}


Measured memory_bytes: 256
package main

import (
	"fmt"
)

func main() {
	var n int
	fmt.Scan(&n)
	var l int
	sum := 0
	max := 0
	for i := 0; i < n; i++ {
		fmt.Scan(&l)
		sum += l
		if l > max {
			max = l
		}
	}
	if 2 * max < sum {
		fmt.Println("Yes")
	} else {
		fmt.Println("No")
	}
}


Measured memory_bytes: 512
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int a=0;
	int b=0;
	string str1;
	string str2;
	cin>>a>>b;
	for(int i=0;i<b;i++)
	{
		str1+=to_string(a);
	}
	for(int i=0;i<a;i++)
	{
		str2+=to_string(b);
	}
	if(str1<str2)
	{
		cout<<str1;
	}
	else
	{
		cout<<str2;
	}
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <cassert>

#include <algorithm>
using namespace std;

#define rep_init(i, init, n) for(int i = (init); i < n; ++i)
#define rep(i, n) rep_init(i, 0, n)

void Main()
{
	int N;
	string S;
	cin >> N >> S;

	int x = 0;
	int max_x = 0;
	rep(i, N)
	{
		if (S[i] == 'I') ++x;
		else --x;

		max_x = max(x, max_x);
	}

	cout << max_x << endl;
}

int main()
{
	std::cin.tie(nullptr);
	std::ios_base::sync_with_stdio(false);
	std::cout << std::fixed << std::setprecision(15);

	Main();
	return 0;
}

Measured memory_bytes: 3580
#include <bits/stdc++.h>
 
using namespace std;
 
#define lli long long int
#define MOD 1000000007
#define DEBUG 0
#define REP(i,n) for(int i=0;i<n;i++)
#define INF 100000000000000

int main(){

	lli n,m;
	cin>>n>>m;

	lli dp[110][110];
	REP(i,110)REP(j,110)dp[i][j]=INF;

	vector<lli> a(m),b(m),c(m);
	vector<lli> flag(m);

	REP(i,m){
		cin>>a[i]>>b[i]>>c[i];
		dp[a[i]][b[i]]=c[i];
		dp[b[i]][a[i]]=c[i];
		flag[i]=0;
	}

	REP(i,110)dp[i][i]=0;
	REP(k,110)REP(i,110)REP(j,110)dp[i][j] = min(dp[i][j],dp[i][k]+dp[k][j]);

	lli ans=0;
	/*始点,終点を決定*/
	for(lli i=1;i<=n;i++){
		for(lli j=i+1;j<=n;j++){
			/*各辺についてチェック*/
			for(lli k=0;k<m;k++){
				lli start = a[k];
				lli end   = b[k];
				if( (dp[i][j] == dp[i][start]+dp[end][j]+c[k] ) ||
					(dp[i][j] == dp[i][end  ]+dp[start][j]+c[k] )){
					flag[k]++;
				}
			}
		}
	}

	REP(i,m){
		if(flag[i]==0)ans++;
	}

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

Measured memory_bytes: 384
#include <iostream>
#include <bitset>
#include <vector>
#include <string>
#include <algorithm>
#include <set>
#include <map>
#include <cmath>
#include <regex>
#include <iomanip>
#include <climits>
#include <utility>
#include <queue>
using namespace std;
using ll = long long int;
using dd = long double;
const ll MOD = 1e9 + 7;
const dd PI = 3.1415926435;

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

ll fact(ll n)
{
    if (n == 0)
    {
        return 1;
    }
    if (n == 1)
    {
        return 1;
    }
    return n * fact(n - 1) % MOD;
}

ll pow_fast(ll n, ll k)
{
    if (k == 0)
    {
        return 1;
    }
    if (k == 1)
    {
        return n;
    }

    if (k % 2 == 0)
    {
        ll tmp = pow_fast(n, k / 2LL);
        return tmp * tmp % MOD;
    }
    else
    {
        ll tmp = pow_fast(n, k / 2LL);
        tmp *= tmp;
        tmp %= MOD;
        return tmp * n % MOD;
    }
}

map<ll, ll> sosuu(ll n)
{
    map<ll, ll> res;
    for (ll i = 2; i * i <= n; i++)
    {
        while (n % i == 0)
        {
            res[i] += 1;
            n /= i;
        }
    }
    if (n != 1)
    {
        res[n] += 1;
    }
    return res;
}

int main()
{
    string W;
    cin >> W;
    map<char, ll> mp;
    for (ll i = 0; i < W.size(); i++)
    {
        mp[W[i]] += 1;
    }
    
    bool ok = true;
    for (auto &&e : mp)
    {
        if (e.second % 2 == 1) {
            ok = false;
        }
    }
    cout << (ok ? "Yes" : "No") << endl;
}

Measured memory_bytes: 256
program november_30
  implicit none
  integer :: m(2), d(2)
  read(*,*) m(1), d(1)
  read(*,*) m(2), d(2)
  if (m(1) == m(2)) then
    write(*,'(i0)') 0
  else
    write(*,'(i0)') 1
  end if
end program november_30

Measured memory_bytes: 768
/*
 * written by Yaqi Zhang
 * University of Wisconsin-Madison
 * 2020
 */

#include<algorithm>
#include<cstring>
#include<iostream>
#include<map>
#include<queue>
#include<set>
#include<stdio.h>
#include<vector>

#define INF 0x3f3f3f3f

using namespace std;


int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    long long a, b, c;
    cin >> a >> b >> c;
    if (a % 2 == 0 || b % 2 == 0 || c % 2 == 0) cout << 0 << "\n";
    else cout << min(a * b, min(b * c, a * c)) << "\n";
    return 0;

}



Measured memory_bytes: 256
/*
title:

url:
*/

#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <functional>
#include <queue>
#include <limits>
#include <string>
#include <utility>
#include <cstring>
#include <map>
#include <cmath>
#include <iterator>

using namespace std;

#define rep(i, n) for (int i = 0; i < (n); i++)
#define INF 1000000007

typedef pair<int, int> pint;
typedef long long ll;

int main()
{
    int n;
    cin >> n;
    int ans = 0;
    vector<int> data;
    rep(i, n)
    {
        int a;
        cin >> a;
        if (data.end() != find(data.begin(), data.end(), a))
        {
            continue;
        }
        else
        {
            data.push_back(a);
            ans++;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 764
n = int(input())
l = [int(i) for i in input().split(" ")]
dp = [0 for i in range(n + 1)]
dp[1] = abs(l[0] - l[1])
for i in range(2, n):
	dp[i] = min(dp[i - 1] + abs(l[i] - l[i - 1]), dp[i - 2] + abs(l[i] - l[i - 2]))
print(dp[n - 1]) 

Measured memory_bytes: 13980
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ull unsigned long long
#define PII pair<int,int>
#define PSI pair<string,int>
#define PIII pair< int, pair<int,int> >
const int MaxN = 3005;
ll dp[MaxN][MaxN];
int arr[MaxN];
int N;

ll rec(int ii, int jj){

    if(ii==jj) return arr[ii];
    auto &ret = dp[ii][jj];
    if(ret!=-1) return ret;
    return ret = max( arr[ii]-rec(ii+1,jj) , arr[jj]-rec(ii,jj-1) );
}

void read(){

    memset(dp, -1, sizeof dp);
    cin>>N;
    for(int i=0; i<N; i++)
        cin>>arr[i];

}

void solve(){

    read();
    cout<< rec(0,N-1) << "\n";

}

int main(){

//    freopen("input.txt","r",stdin);
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    solve();
    return 0;
}


Measured memory_bytes: 74228
#include <cstdio>
#include <vector>
#include <cmath>

using namespace std;

int main() {
	vector <int> list;
	int size = 0;
	int limit = 0;
	int count = 0;

	scanf("%d", &size);
	for (int i = 0; i < size; i++) {
		scanf("%d", &limit);
		list.push_back(limit);
	}
	for (int i = 0; i < size; i++) {
		if (list[i] == 2 || list[i] == 3) {
			count++;
			continue;
		}
		limit = sqrt(list[i]);
		for (int j = 2; j <= limit; j++) {
			if (list[i]%j == 0) {
				break;
			}
			if (j == limit) {
				count++;
			}
		}
	}
	printf("%d\n", count);
}


Measured memory_bytes: 2684
#include <algorithm>
#include <cstdio>
#include <iostream>
#include <map>
#include <cmath>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
#include <stdlib.h>
#include <stdio.h>
#include <bitset>
#include <cstring>
#include <deque>
#include <iomanip>
#include <limits>
#include <fstream>
using namespace std;
#define FOR(I,A,B) for(int I = (A); I < (B); ++I)
#define CLR(mat) memset(mat, 0, sizeof(mat))
typedef long long ll;
const int mod=1e9+7;
struct Combinatorics {
  using int64 = long long;
  int64 mod;
  int64 fact[202020];
  int64 invfact[202020];
  Combinatorics(int64 mod):mod(mod) {
    fact[0] = invfact[0] = 1;
    for(int i = 1; i < 202020; ++i) {
      fact[i] = fact[i-1]*i%mod;
      invfact[i] = minv(fact[i]);
    }
  }
  int64 mpow(int64 x, int64 n) const {
    int64 res = 1;
    while(n > 0) {
      if(n&1) res = res*x%mod;
      x = x*x%mod;
      n >>= 1;
    }
    return res;
  }
  int64 minv(int64 x) const {
    return mpow(x, mod-2);
  }
  int64 mfact(int64 x) const {
    return fact[x];
  }
  int64 minvfact(int64 x) const {
    return invfact[x];
  }
  int64 C(int64 n, int64 r) const {
    if(r < 0 || n < r) return 0;
    return fact[n]*invfact[r]%mod*invfact[n-r]%mod;
  }
  int64 P(int64 n, int64 r) const {
    if(r < 0 || n < r) return 0;
    return fact[n]*invfact[n-r]%mod;
  }
};
ll dp[1010][1010];
int main()
{
  ios::sync_with_stdio(false);
  cin.tie(0);
  int N,A,B,C,D;
  cin>>N>>A>>B>>C>>D;
  Combinatorics COM(mod);
  dp[A-1][0]=1;
  FOR(i,A-1,B){
    FOR(j,0,N+1){
      dp[i+1][j]+=dp[i][j];
      dp[i+1][j]%=mod;
      ll p=1;
      for(int k=1;k<=D&&N-j-(i+1)*k>=0;k++){
        p*=COM.C(N-j-(i+1)*(k-1),i+1);
        p%=mod;
        if(k>=C){
          dp[i+1][j+(i+1)*k]+=dp[i][j]*p%mod*COM.minvfact(k)%mod;
          dp[i+1][j+(i+1)*k]%=mod;
        }
      }
    }
  }
  cout<<dp[B][N]%mod<<endl;
}

Measured memory_bytes: 11264
#include<iostream>
#include<algorithm>
#include<cmath>
#include<vector>
#define maju 1919114514
using namespace std;
int main(){
int n,i,j;
int ans=maju;
cin>>n;
vector<int>w(n),a(n);
for(i=0;i<n;i++){
cin>>w[i];
if(i==0)a[i]=w[i];
else a[i]=a[i-1]+w[i];
}
for(i=0;i<n;i++){
ans=min(ans,abs(a[n-1]-a[i]-a[i]));
}
cout<<ans<<endl;
return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define all(vec) vec.begin(),vec.end()
using namespace std;
typedef long long ll;
typedef pair<int,pair<int,int>> P;
const ll MOD=1000000007;
const ll INF=1000000010;
const ll LINF=4000000000000000010;
const double EPS=1e-9;
int dx[5]={0,1,0,-1,0};
int dy[5]={1,0,-1,0,0};
int main(){
    int a,b,c,d;cin>>a>>b>>c>>d;
    if(abs(a-b)<=d&&abs(b-c)<=d){
        cout<<"Yes"<<endl;
    }else if(abs(a-c)<=d){
        cout<<"Yes"<<endl;
    }else{
        cout<<"No"<<endl;
    }
}


Measured memory_bytes: 256
# def makelist(n, m):
# 	return [[0 for i in range(m)] for j in range(n)]

# n = int(input())
# a, b = map(int, input().split())
# s = input()

ans = 0
s = input()
for c in s:
	if ans == 0:
		if c == 'C':
			ans += 1
	else:
		if c == 'F':
			ans += 1
			break

if ans == 2:
	print("Yes")
else:
	print("No")


Measured memory_bytes: 3064
#include<iostream>
#include<stdio.h>
#include<algorithm>
#include<string.h>

using namespace std;

int main()
{
    long long int a,b,k;
    cin>>a>>b>>k;
    for(int i=1;i<=k;i++)
    {
        if(i%2==0)
        {
            if(b%2==0)
            {
                a=a+(b/2);
                b=b-(b/2);
            }
            else
            {
                a=a+(b/2);
                b=b-1-(b/2);
            }
        }
        else
        {
            if(a%2==0)
            {
                b=b+(a/2);
                a=a/2;
            }

            else
            {
                b=b+(a/2);
                a=a-1-(a/2);
            }


        }
    }

    cout<<a<<" "<<b<<endl;

    return 0;
}


Measured memory_bytes: 256
s=input()
k=int(input())

def solve(s,k):
    temp = []
    for i in range(len(s)):
        for j in range(i + 1, i + k + 1):
            if j <= len(s)+1:
                temp.append(s[i:j])
    temp = sorted(set(temp))
    ans = temp[k - 1]
    return ans

print(solve(s,k))

Measured memory_bytes: 5068
package main

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

func main() {
	scanner := bufio.NewScanner(os.Stdin)
	scanner.Split(bufio.ScanWords)
	
	N := ScanInt(scanner)
	C := ScanInt(scanner)
	K := ScanInt(scanner)
	
	T := make([]int, N)
	for i := 0; i < N; i++ {
	    T[i] = ScanInt(scanner)
	}
	sort.Ints(T)
	
	ans := 0
	for i := 0; i < N; {
	    r := T[i] + K
	    c := 1
	    
	    for j := i + 1; j < N && c < C && T[j] <= r; j++ {
	        c++
	    }
	    i += c
	    ans++
	}
	fmt.Println(ans)
}

func ScanInt(scanner *bufio.Scanner) int {
	scanner.Scan()
	i, e := strconv.Atoi(scanner.Text())
	if e != nil {
		panic(e)
	}
	return i
}

func ScanFloat64(scanner *bufio.Scanner) float64 {
	scanner.Scan()
	f, e := strconv.ParseFloat(scanner.Text(), 64)
	if e != nil {
		panic(e)
	}
	return f
}

func ScanText(scanner *bufio.Scanner) string {
	scanner.Scan()
	return scanner.Text()
}

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

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

func Abs(a int) int {
	if a < 0 {
		a *= -1
	}
	return a
}

Measured memory_bytes: 2944
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
ll power(ll a,ll b)
{ll result=1;
while(b>0)
{if(b%2==1)
 result*=a;
 a*=a;
 b/=2;
}
return result;
}
int main()
{ios_base::sync_with_stdio(false);
    cin.tie(NULL);
int x;
cin>>x;
if(x>=30)
cout<<"Yes";
else
cout<<"No";
}

Measured memory_bytes: 3548
from heapq import *
import sys

sys.setrecursionlimit(10 ** 6)
int1 = lambda x: int(x) - 1
p2D = lambda x: print(*x, sep="\n")
def II(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def LI(): return list(map(int, sys.stdin.readline().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]
def SI(): return sys.stdin.readline()[:-1]

def main():
    def cost(i,j):
        x1,y1,r1=xyr[i]
        x2, y2, r2 = xyr[j]
        res=((x1-x2)**2+(y1-y2)**2)**0.5-r1-r2
        return max(res,0)

    sx,sy,gx,gy=MI()
    n=II()
    xyr=LLI(n)
    xyr=[[sx,sy,0]]+xyr+[[gx,gy,0]]
    n+=2
    to=[[] for _ in range(n)]
    for i in range(n):
        x1,y1,r1=xyr[i]
        for j in range(i):
            x2, y2, r2 = xyr[j]
            c=cost(i,j)
            to[i].append((j,c))
            to[j].append((i,c))
    hp=[]
    fin=[False]*n
    heappush(hp,(0,0))
    while hp:
        d,u=heappop(hp)
        if fin[u]:continue
        fin[u]=True
        if u==n-1:
            print(d)
            exit()
        for v,c in to[u]:
            if fin[v]:continue
            heappush(hp,(d+c,v))

main()

Measured memory_bytes: 131252
#62a
g1=[1,3,5,7,8,10,12]
g2=[4,6,9,11]
g3=[2]
x,y=map(int,input().split())
if (x in g1 and y in g1) or (x in g2 and y in g2) :
    print('Yes')
else:
    print('No')

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

#ifdef LOCAL
#define debug(_) cerr << #_ << ": " << (_) << '\n'
#define _GLIBCXX_DEBUG
#else
#define debug(_) 0
#endif // LOCAL

int main(){
    int N;
    vector<int> ps;

    cin >> N;
    ps.resize(N);
    for (int i = 0; i < N; i++) {
        cin >> ps[i];
    }

    cout << (accumulate(ps.begin(), ps.end(), 0) - *max_element(ps.begin(), ps.end()) / 2) << '\n';
    
    return 0;
}

Measured memory_bytes: 3592
#!/usr/bin/env python

from collections import deque
import itertools as it
import sys
import math

sys.setrecursionlimit(1000000)

INF = 10 ** 18

A, B, K = map(int, raw_input().split())

cnt = 0

for i in range(1, max(A, B) + 1)[::-1]:
    if A % i == 0 and B % i == 0:
        cnt += 1
    if cnt == K:
        print i
        exit()

Measured memory_bytes: 2808
import sys
input = sys.stdin.readline

n,m = map(int, input().split())
ks = [ list(map(int,input().split())) for _ in range(m) ]
p = list(map(int,input().split()))
# print(n)
# print(m)
# print(ks)
# print(p)

# print(len(ks))
x = [ len(c) for c in ks ]
# print(x)

count = 0
for i in range(2**n):
    b = bin(i)
    b = list(b)
    b = b[2:]
    b = list(map(int,b))
    swich_list = [0]*(n - len(b))
    c = swich_list + b
    c.reverse()
    # print(c)

    lamp_list = [0]*m
    for j in range(m):
        s = 0
        for k in ks[j][1:]:
            # print(k)
            s += c[k-1]

        if s%2==p[j]:
            lamp_list[j] = 1

    if sum(lamp_list)==m:
        count += 1

print(count)

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

using namespace std;
#define all(a)a.begin(),a.end()
using ll=long long;
const int INF = 1<<30;
const ll INFll =1LL<<62;
const int mod= int(1e9)+7;
using P = pair<ll,ll>;
using ld=long double;

bool ch(ll x){
    bool flg=true;
    string s="";
    while(x>0){
        s+=(char)('0'+x%10);
        x/=10;
    }
    if(s[0]!=s[4])flg=false;
    if(s[1]!=s[3])flg=false;
    if(flg)return true;
    return false;
}

int main(){
    ll cnt=0;
    ll a,b;cin >>a>>b;
    for (int i =a; i <=b; ++i) {
        if(ch(i))cnt++;
    }
    cout <<cnt<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>
#define rep(i,st,ed) for (register int i=st;i<=ed;++i)
#define fill(x,t) memset(x,t,sizeof(x))

const int MOD=1e9+7;
const int N=200005;

int f[2][21][624288];
int lm[21][21],n;

int read() {
	int x=0,v=1; char ch=getchar();
	for (;ch<'0'||ch>'9';v=(ch=='-')?(-1):(v),ch=getchar());
	for (;ch<='9'&&ch>='0';x=x*10+ch-'0',ch=getchar());
	return x*v;
}

void upd(int &x,int v) {
	x+=v; (x>=MOD)?(x-=MOD):0;
}

int ch(int S,int x) {
	if ((S>>x)&1) return S;
	int w=((1<<n)-(1<<x))&S;
	if (w) S-=(w&-w);
	return S+(1<<x);
}

int main(void) {
	n=read()-1; int m=read(),k=read();
	rep(i,1,k) {
		int x=read(),y=read();
		lm[x][y]=read()+1;
	}
	f[1][0][0]=1;
	rep(i,1,m) {
		int now=i&1,nxt=!now;
		rep(j,0,n-1) {
			for (int S=0;S<(1<<n);++S) {
				if (!f[now][j][S]) continue;
				if (lm[i][j+1]==0) {
					if (!((S>>j)&1)) upd(f[now][j+1][S],f[now][j][S]);
					upd(f[now][j+1][ch(S,j)],f[now][j][S]);
				} else if (lm[i][j+1]==1) {
					if (!((S>>j)&1)) upd(f[now][j+1][S],f[now][j][S]);
				} else upd(f[now][j+1][ch(S,j)],f[now][j][S]);
			}
		}
		fill(f[nxt],0);
		for (int S=0;S<(1<<n);++S) upd(f[nxt][0][S],f[now][n][S]);
	}
	int ans=0;
	for (int S=0;S<(1<<n);++S) upd(ans,f[m&1][n][S]);
	printf("%d\n", ans);
	return 0;
}

Measured memory_bytes: 102528
import core.bitop, std.bitmanip;
import core.checkedint;
import std.algorithm, std.functional;
import std.array, std.container;
import std.bigint;
import std.conv;
import std.math, std.numeric;
import std.range, std.range.interfaces;
import std.stdio, std.string;
import std.typecons;

void main()
{
    int n;
    readf("%s", &n);
    readln;
    
    auto arr = readln.chomp.split.map!(to!int).array;
    
    auto s = arr.enumerate(1).array;
    
    debug { s.writeln; }
    
    s.schwartzSort!(t => t[1]);
    
    debug { s.writeln; }
    
    auto ans = s.map!(t => t[0]).array;
    
    foreach (i; 0 .. n) {
        if (i > 0) { write(' '); }
        write(ans[i]);
    }
    writeln();
}

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

int main() {
  ll a,b,k;
  cin >> a >> b >> k;
  ll temp;
  temp = min(a,k);
  a -= temp;
  k -= temp;
  if(k == 0){
    cout << a << ' ' << b << endl;
    return 0;
  }else{
    temp = min(b,k); 
    b -= temp;
    k -= temp;
    cout << a << ' ' << b << endl;
    return 0;
  }
  return 0;
}


Measured memory_bytes: 256
// Gracias, Rodolfo
// Gracias, Roman
// Gracias, Maxi
// Gracias, MarcosK
// Obrigado, Dilson
//#pragma GCC optimize ("Ofast,unroll-loops")
//#pragma GCC target ("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#include <bits/stdc++.h>
#include <unistd.h>
using namespace std;
#define fastio ios::sync_with_stdio(0);cin.tie(0)
#define For(i,a,b) for (int i = a; i < b; i++)
#define roF(i,a,b) for (int i = a; i >= b; i--)
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define all(v) (v).begin(),(v).end()
#define SZ(v) ((int)v.size())

void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}

template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifndef ONLINE_JUDGE
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define debug(x...)
#endif

typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
typedef pair<ll, ll> ii;
typedef vector<ll> vi;
typedef vector<ii> vii;

const int N = 1e6;
const ll INF = 1e18;
const ld EPS = 10e-9;

mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());
ll random(ll a, ll b) { return uniform_int_distribution<ll> (a, b) (rng); }

void solve() {
    long long x, y, a, b, c;
    cin >> x >> y >> a >> b >> c;
    long long p[a], q[b], r[c];
    for (int i = 0; i < a; i++) cin >> p[i];
    for (int j = 0; j < b; j++) cin >> q[j];
    for (int k = 0; k < c; k++) cin >> r[k];
    sort(p, p + a);
    sort(q, q + b);
    sort(r, r + c);
    vector<long long> target;
    for (int i = a - 1; i > a - 1 - x; i--) target.push_back(p[i]);
    for (int i = b - 1; i > b - 1 - y; i--) target.push_back(q[i]);
    sort(target.begin(), target.end());
    int l = min(x + y, c);
    for (int i = 0; i < l; i++) target[i] = max(target[i], r[c - 1 - i]);
    long long sum = 0;
    int sz = target.size();
    for (int i = 0; i < sz; i++) sum += target[i];
    cout << sum << endl;
}

int main() {
	fastio;
	int t = 1;
	while (t--) solve();
	return 0;
}

Measured memory_bytes: 4852
#include <bits/stdc++.h>
using namespace std;
using lint = long long int;
#define FOR(i, begin, end) for(int i=(begin),i##_end_=(end);i<i##_end_;i++)
#define IFOR(i, begin, end) for(int i=(end)-1,i##_begin_=(begin);i>=i##_begin_;i--)
#define REP(i, n) FOR(i,0,n)
#define IREP(i, n) IFOR(i,0,n)
constexpr int MOD = 1000000007;
struct Node;
vector<Node> V;
struct Node {
    vector<int> nbr;
    bool vst = false;
    lint cnt = 0;
    void dfs(lint cntplus) {
        vst = true;
        cnt += cntplus;
        for(int x : nbr) {
            if(!V[x].vst) {
                V[x].dfs(cnt);
            }
        }
    };
};
int main()
{
    int N, Q;
    cin >> N >> Q;
    V = vector<Node>(N);
    REP(i, N) {
        V[i] = Node();
    }
    REP(i, N-1) {
        int a, b;
        cin >> a >> b;
        V[a-1].nbr.push_back(b-1);
        V[b-1].nbr.push_back(a-1);
    }
    REP(i, Q) {
        int p, x;
        cin >> p >> x;
        V[p-1].cnt += x;
    }
    V[0].dfs(0);
    REP(i, N) cout << V[i].cnt << (i!=N-1 ? " " : "");
    cout << endl;
}

Measured memory_bytes: 21632
#include"bits/stdc++.h"
#include"math.h"
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
typedef long long ll;
int main(){
  int n,a,b; cin >> n >> a >> b;
  int c=(b-a-1)%2;
  if(c==0){cout << "Borys" << endl;}
  else cout << "Alice" << endl;}

Measured memory_bytes: 256
#include <iostream>
#include <stdio.h>
#include <string>
#include <map>
#include <stack>
#include <vector>
#include <string.h>
#include <set>
#include <queue>
#include <cmath>
#include <algorithm>

using namespace std;

bool vis[200][200];
char input[200][200];
int dx[4] = {- 1 , 0 , 1 , 0};
int dy[4] = {0 , 1 , 0 , - 1};

bool inArea(int x , int y , int n , int m)
{
	return x >= 0 && x < n && y >= 0 && y < m;
}

void dfs(int x , int y , int n , int m , char ch)
{
	vis[x][y] = true;

	for (int i = 0;i < 4;i ++)
	{
		int tx = x + dx[i];
		int ty = y + dy[i];
		if (inArea(tx , ty , n , m) && !vis[tx][ty] && input[tx][ty] == ch)
			dfs(tx , ty , n , m , ch);
	}
}

int main()
{
	int i , j , h , w;
	while (scanf("%d%d" , &h , &w) != EOF)
	{
		if (w == 0 && h == 0)
			break;

		int ans = 0;

		for (i = 0;i < h;i ++)
			for (j = 0;j < w;j ++)
				vis[i][j] = false;

		for (i = 0;i < h;i ++)
			scanf("%s" , input[i]);

		for (i = 0;i < h;i ++)
			for (j = 0;j < w;j ++)
			{
				if (!vis[i][j])
				{
					dfs(i , j , h , w , input[i][j]);
					ans ++;
				}
			}

		printf("%d\n" , ans);
	}
	return 0;
}

Measured memory_bytes: 2016
#include <bits/stdc++.h>
 
using namespace std;
 
int main(){
    int K;
    cin >> K;
    int a[32]={1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
    cout << a[K-1] << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N=15,M=1e6+5,inf=0x3f3f3f3f,mod=1e9+7;
#define mst(a) memset(a,0,sizeof a)
#define lx x<<1
#define rx x<<1|1
#define reg register
#define PII pair<int,int>
#define fi first 
#define se second
string c[4]={"AC","WA","TLE","RE"};
char a[N][N];
int main(){
	int n,m,k;
	cin>>n>>m>>k;
	for(int i=1;i<=n;i++)
		for(int j=1;j<=m;j++)
			cin>>a[i][j];
	int ans=0;
	for(int i=0;i<(1<<n);i++){
		for(int j=0;j<(1<<m);j++){
			int r[10]={},c[10]={},cnt=0;
			for(int k=0;k<max(n,m);k++){
				if(i&(1<<k)) r[k+1]++;
				if(j&(1<<k)) c[k+1]++;
			}
			int b[10][10]={};
			for(int i=1;i<=n;i++)
				for(int j=1;j<=m;j++)
					if(r[i]||c[j]){
						b[i][j]='.';
					}
					else b[i][j]=a[i][j];
			for(int i=1;i<=n;i++)
				for(int j=1;j<=m;j++)
					if(b[i][j]=='#') cnt++;
			if(cnt==k) ans++;
			//printf("%d %d cnt=%d\n",i,j,cnt);
		}
	}
	printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 3728
#include <iostream>
#include <math.h>
#include <algorithm>
#include <string>
using namespace std;


void b_time_limit_exceeded(void) {
	int N,T;
	int* c;
	int* t;
	bool detect = false;
	cin >> N>>T;
	c = (int*)calloc(N, sizeof(int));
	t = (int*)calloc(N, sizeof(int));
	for (int i = 0; i < N; i++) {
		cin >> c[i];
		cin >> t[i];
	}

	int min = c[0];

	for (int i = 0; i < N; i++) {
		if (t[i] > T) continue;

		if (min > c[i]) {
			min = c[i];
		}
		detect = true;
	}

	if (!detect) cout << "TLE" << endl;
	else         cout << min << endl;

}

int main()
{
    b_time_limit_exceeded();
}

Measured memory_bytes: 3576
#include <iostream>
#include <queue>
#include <utility>
#include <algorithm>
typedef long long ll;
using namespace std;

int A[200010], B[200010];
priority_queue<pair<int, int>> pq;

int main() {
	int N;
	cin >> N;
	for(int i=0; i<N; ++i) cin >> A[i];
	for(int i=0; i<N; ++i){
		cin >> B[i];
		pq.push(make_pair(B[i], i));
	}
	ll ans=0;
	while(pq.size()>0){
		int key=pq.top().second;
		pq.pop();
		if(B[key]<A[key]){
			cout << -1 << endl;
			return 0;
		}
		if(B[key]>A[key]){
			if((B[key]-A[key])%(B[(key+N-1)%N]+B[(key+1)%N])==0){
				ans += (B[key]-A[key])/(B[(key+N-1)%N]+B[(key+1)%N]);
				B[key]=A[key];
			}else{
				ans += B[key]/(B[(key+N-1)%N]+B[(key+1)%N]);
				B[key] %= (B[(key+N-1)%N]+B[(key+1)%N]);
				if(B[key]>=max(B[(key+N-1)%N], B[(key+1)%N])){
					cout << -1 << endl;
					return 0;
				}
				pq.push(make_pair(B[key], key));
			}
		}
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 3700
#include <iostream>
#include <math.h>
using namespace std;
int main(){
    int a[5];
    double sum=0;
    for(int i=0;i<5;i++){
        cin>>a[i];
        if(a[i]<40)a[i]=40;
        sum+=a[i];
    }
    cout<<sum/5.0<<endl;
}

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

int main(){
  int n,t,a,i;
  cin>>n;
  cin>>t>>a;
  int h[n];
  for(i=0;i<n;i++)cin>>h[i];
  int mi=0;
  for(i=0;i<n;i++){
    if(abs(a+h[i]*0.006-t)<abs(a+h[mi]*0.006-t)){
      mi=i;
    }
  }
  cout<<mi+1;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
#include <iostream>
#include <string.h>
#include <stdio.h>
#include <map>
#include <vector>
#include <math.h>
#include <algorithm>
#include <queue>
#include <set>
#include <tuple>
using namespace std;

#define FOR(i,init,a) for(int i=init; i<a; i++)
#define rep(i,a) FOR(i,0,a)
#define rrep(i,a) for(int i=a; i>=0; i--)
#define rep1(i,a) for(int i=1; i<=a; i++)
#define cout1(a) cout << a << endl;
#define cout2(a,b) cout << a << " " << b << endl;
#define cout3(a,b,c) cout << a << " " << b << " " << c << endl;
#define cout4(a,b,c,d) cout << a << " " << b << " " << c << " " << d << endl;
#define mem(a,n) memset( a, n, sizeof(a))
#define all(a) a.begin(),a.end()
#define chmin(a,b) a=min(a,b);
#define chmax(a,b) a=max(a,b);

typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef vector<int> V;
typedef vector<V> VV;
typedef vector<VV> VVV;
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LLINF = 1e18;
static const double pi = 3.141592653589793;

int use[30];

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    string s,t;
    cin>>s>>t;
    
    map<char,char> dic;
    int N=s.size();
    rep(i,N){
        char c=s[i];
        if(dic.count(c)){
            c=dic[c];
        }else{
            if(use[t[i]-'a']){
                c='A';
            }else{
                dic[c]=t[i];
                c=t[i];
                use[c-'a']=1;
            }
        }
        if(c!=t[i]){
            cout1("No")
            return 0;
        }
    }
    cout1("Yes")
}

Measured memory_bytes: 916
#pragma GCC target("avx")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>

#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#include <regex>
#define rep(i,n) for(int i = 0; i < n; i++)
#define reps(i,j,n) for(int i = j; i < n; i++)
#define rrep(i,j,n) for(int i = j-1; i >= n; i--)
#define prec(n) fixed << setprecision(n)
#define print_array(v) rep(__k, v.size()) { cout << v[__k]; if(__k != v.size()-1) cout << " "; else cout << endl; }
#define YesorNo(a) printf(a?"Yes\n":"No\n")
#define fi first
#define se second
#define endl "\n"
using namespace std;

constexpr int inf = 2147483647;
constexpr int64_t inf64 = 9223372036854775807;
constexpr int mod = 1e9+7;

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

  int a, b;
  cin >> a >> b;

  cout << max({a+b, a-b, a*b}) << endl;
  return 0;
}

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

int main()
{
    int N;
    cin >> N;

    int A[N];
    double bunbo = 0.0;
    for (int i = 0; i < N; i++) {
        cin >> A[i];
        bunbo += (1.0 / A[i]);
    }

    cout << (1.0 / bunbo) << endl;

    return 0;
}

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

int main()
{
    int H, W;
    cin>>H>>W;
    vector<string> A(H);
    for (string &a: A)
        cin>>a;

    vector<vector<pair<int, int>>> V(H*W);
    for (int y=0; y<H; y++)
        for (int x=0; x<W; x++)
            if (A[y][x]=='#')
                V[0].push_back(make_pair(x, y));
    int dx[] = {-1, 1, 0, 0};
    int dy[] = {0, 0, -1, 1};
    for (int d=0; d<W*H; d++)
    {
        for (auto p: V[d])
        {
            int x = p.first;
            int y = p.second;
            for (int i=0; i<4; i++)
            {
                int tx = x + dx[i];
                int ty = y + dy[i];
                if (0<=tx && tx<W && 0<=ty && ty<H && A[ty][tx]=='.')
                {
                    A[ty][tx] = '#';
                    V[d+1].push_back(make_pair(tx, ty));
                }
            }
        }
    }
    for (int d=W*H-1; d>=0; d--)
        if (!V[d].empty())
        {
            cout<<d<<endl;
            break;
        }
}


Measured memory_bytes: 36080
#include<bits/stdc++.h>
using namespace std;
#define inf 8500

int main(){
	vector<int> dp(51,inf);
	int w[] = {2,10,3,12,5,15};
	int v[] = {380,380*5*8/10,550,550*4*85/100,850,850*3*88/100};
	dp[0] = 0;
	for(int i=0;i<6;i++)
		for(int j  =0;j<51-w[i];j++)
			dp[j+w[i]] = min(dp[j+w[i]],dp[j]+v[i]);
	while(1){
	int n;
	cin>>n;
	if(n==0)break;
	cout<<dp[n/100]<<endl;
	}


	return 0;
}



Measured memory_bytes: 3020
#include <bits/stdc++.h>
#define fast ios_base::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL)
#define ll long long int
#define ld long double
using namespace std;
const int N = 1e6 + 5;
const int MOD = 1e9 + 7;

int a[N];

int main(){
	fast;
	ll n;
	cin >> n;
	string ans;
	while(n > 26){
		ll x = n % 26;
		if(x == 0){ 
			ans += 'z';
			--n;
		}
		else ans += ('a' + x - 1);
		n /= 26;
	}
	ll x = n % 26;
	if(x == 0) ans += 'z';
	else ans += ('a' + x - 1);
	reverse(ans.begin(), ans.end());
	cout << ans;
	return 0;
}


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

tmp1 = 1
tmp2 = 1

for l in L:
    i = max(1, tmp1//l[0] if tmp1%l[0] == 0 else tmp1//l[0] + 1, tmp2//l[1] if tmp2%l[1] == 0 else tmp2//l[1] + 1)
    tmp1 = i * l[0] 
    tmp2 = i * l[1] 
            
print(tmp1 + tmp2)

Measured memory_bytes: 3188
#define _USE_MATH_DEFINES
#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
#include<string>
#include<iostream>
#include<iostream>
#include<cctype>
#include<cstdio>
#include<vector>
#include<stack>
#include<queue>
#include <algorithm>
#include<math.h>
#include<set>
#include<map>
#include <sstream>
#include<iomanip>
#include <ctype.h>
using namespace std;

//#include<bits/stdc++.h>


int main() {
	long long int p = 2;
	map<int, int>x;
	int t = 1;
	while (p <= 1000000000) {
		x[p] = t;
		t++;
		p *= 2;
	}

	int n;
	int ans = 0;
	cin >> n;
	for (int i = 0; i < n; i++) {
		int a;
		cin >> a;
		int b = t;int y = pow(2, b);
		while(a%2==0){
			if (a%y == 0) {
				ans += b; a /= y;
			}
			else {
				b--; y /= 2;
			}
		}
	}
	cout << ans << endl;
	

	return 0;
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;


namespace StartFinish
{
    class Program
    {   
        static void Main(string[] args)
        {
            int[] xy = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
            int x = xy[0];
            int y = xy[1];
            int r = x % y;
            while (r != 0)
            {
                x = y;
                y = r;
                r = x % y;
            }
            Console.WriteLine(y);
        }

        

    }
}

Measured memory_bytes: 9424
#include<iostream>
#include<iomanip>
#include<cstdio>
#include<cstring>
#include<cmath>
#include<cinttypes>
#include<vector>
#include<algorithm>
#include<map>
#include<set>
#include<queue>
#include<string>
#include<stack>


#define FSCNd64 "%" SCNd64
#define FPRId64 "%" PRId64

using namespace std;

using ll=long long;
using vi=vector<int>;
using vvi=vector<vi>;
using pii=pair<int,int>;
using vll=vector<ll>;
using vvll=vector<vll>;
using vpii=vector<pii>;

#define PI 3.1415926535897932384626433832795

template<typename X>
bool max_u(X&m, X v)
{
	if(m<v)
	{
		m=v;
		return true;
	}
	return false;
}


template<typename X>
bool min_u(X&m, X v)
{
	if(m>v)
	{
		m=v;
		return true;
	}
	return false;
}


struct solve
{
	solve(){}
	ll operator()(ll k, vll&a, vll&b) {
		vll sa={0}, sb={0};
		int n=a.size();

		for(auto x:a) sa.push_back(sa.back()+x);
		for(auto x:b) sb.push_back(sb.back()+x);

		int ans=0;
		for(int i=0;i<=n;i++)
		{
			ll r=k-sa[i];
			if(r<0) break;
			auto it=upper_bound(sb.begin(), sb.end(), r);
			int idx=it-sb.begin()-1;
			if(max_u(ans, i+idx))
			{
//				cout << i << "  " << idx << "\n";
			}
		}
		return ans;
	}
};

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

	for(;;)
	{
		int n, m;
		ll k;
		cin >> n >> m >> k;
		if(cin.fail()) break;
		vll a(n), b(m);
		for(auto&vm:a) cin >> vm;
		for(auto&vm:b) cin >> vm;
		cout << solve()(k, a, b) << "\n";
	}
	return 0;
}


Measured memory_bytes: 11056
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i = 0; i < n; i++)
int main(){ 
    vector<int> a(9);
    REP(i,9) cin>>a[i];
    if((a[0]-a[1]==a[3]-a[4]&&a[3]-a[4]==a[6]-a[7])&&(a[1]-a[2]==a[4]-a[5]&&a[4]-a[5]==a[7]-a[8])){
        cout<<"Yes";
    }else{
        cout<<"No";
    }
    return 0;
}


Measured memory_bytes: 256
s = input()
t = input()
replace_s = {chr(i): '' for i in range(ord('a'), ord('z')+1)}
replace_t = {chr(i): '' for i in range(ord('a'), ord('z')+1)}
ans = 'Yes'
for i, j in zip(s, t):
    if replace_s[i] and replace_s[i] != j or replace_t[j] and replace_t[j] != i:
        ans = 'No'
        break
    if not replace_s[i]:
        replace_s[i] = j
    if not replace_t[i]:
        replace_t[j] = i
print(ans)


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

int main(){
    int N;
    cin >> N;
    long long int A[N],B[N];
    for(int i = 0; i < N; i++){
        cin >> A[i] >> B[i];
    }
    sort(A,A+N);
    sort(B,B+N);
    if(N%2 == 0){
        cout << (B[N/2 - 1] + B[N/2]) - (A[N/2 - 1] + A[N/2]) + 1;
    }else{
        cout << B[(N-1)/2] - A[(N-1)/2] + 1;
    }
}

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

#define INF 1e9
using namespace std;
typedef long long ll;

int main() {

    int n; cin >> n;

    unordered_map<int, int> mp;
    for (int i = 0; i < n; ++i) {
        int a; cin >> a;

        mp[a]++;
    }

    int ans = 0;

    for (int i = 1; i < 100000 - 1; ++i) {
        ans = max(ans, mp[i-1] + mp[i] + mp[i+1]);
    }

    cout << ans << endl;
}

Measured memory_bytes: 4388
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();

		long[][] H = new long[101][101];

		List<int[]> zeros = new ArrayList<>();
		for (int i = 0; i < n; i++) {
			int x = sc.nextInt();
			int y = sc.nextInt();
			long h = sc.nextLong();
			if (h == 0) {
				zeros.add(new int[]{x, y});
				continue;
			}

			// h = max(H - |x - cx| - |y - cy|, 0)
			// H = h + |x - cx| + |y - cy|
			for (int j = 0; j < 101; j++) {
				for (int k = 0; k < 101; k++) {
					if (H[j][k] == -1) continue;
					long height = h + Math.abs(x - j) + Math.abs(y - k);
					if (height < 1 && H[j][k] > 0) {
						H[j][k] = -1;
						continue;
					}

					if (H[j][k] == 0 || H[j][k] == height) {
						H[j][k] = height;
						continue;
					}
					H[j][k] = -1;
				}
			}
		}

		for (int[] zero : zeros) {
			int x = zero[0];
			int y = zero[1];
			for (int j = 0; j < 101; j++) {
				for (int k = 0; k < 101; k++) {
					if (H[j][k] < 1) continue;
					if (H[j][k] - Math.abs(j - x) - Math.abs(k - y) > 0) {
						H[j][k] = -1;
					}
				}
			}
		}

		for (int i = 0; i < H.length; i++) {
			for (int j = 0; j < H.length; j++) {
				if (H[i][j] > 0) {
					System.out.print(i);
					System.out.print(" ");
					System.out.print(j);
					System.out.print(" ");

					System.out.println(H[i][j]);
					return;
				}
			}
		}
	}
}


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

#define all(x) (x).begin(), (x).end()
#define dbg(x) cerr<<#x<<" = "<<x<<endl
#define fori(i,a,b) for(int i=(a);i<=(b);i++)
#define rep(n) fori(somethingStupid,1,(n))


using namespace std;

using vi = vector<int>;
using vvi = vector<vi>;
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vll>;

bool tests = false;

void solve(){
    string s, t; cin >> s >> t;
    int c = 0;
    for (int i=0; i<s.size(); i++){
        if (s[i] != t[i]){
            c++;
        }
    }cout << c << endl;
}
int main()
{
    ios::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);

    int t = 1;
    if (tests){
        cin >> t;
    }
    rep(t) solve();
    return 0;
}


Measured memory_bytes: 3764
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
#define rep(i,n) for(ll i=0;i<(ll)(n);i++)
#define all(a)  (a).begin(),(a).end()
#define pb emplace_back
#define INF (1LL<<59)

#define int ll

signed main(){
    int N,W;
    cin>>N>>W;
    vector<int> v(N),w(N);
    rep(i,N)cin>>w[i]>>v[i];
    
    vector<vector<int>> vec(4);
    
    int num = w[0];
    rep(i,N){
        int tw = w[i];
        int tv = v[i];
        vec[tw-num].pb(tv);
    }
    
    rep(i,4){
        sort(all(vec[i]));
        reverse(all(vec[i]));
    }
    
    rep(i,4){
        rep(j,vec[i].size()-1){
            vec[i][j+1]+= vec[i][j];
        }
    }
    rep(i,4){
        vec[i].insert(vec[i].begin(),0);
//        rep(j,vec[i].size())cout<<vec[i][j]<<" ";cout<<endl;
    }
    
    
    int ans = -INF;
    rep(i,vec[0].size()){
        rep(j,vec[1].size()){
            rep(k,vec[2].size()){
                rep(l,vec[3].size()){
                    if(num*i+(num+1)*j+(num+2)*k+(num+3)*l>W)continue;
                    ans = max(ans,vec[0][i]+vec[1][j]+vec[2][k]+vec[3][l]);
                }
            }
        }
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <map>
#include <vector>
#include <algorithm>
#include <map>
#include <string>
#include <queue>
#include <set>
#include <math.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
typedef pair<ll, P> Q;
const ll mod = 1000000007;
const ll INF = 1000000000000000;

ll n, p[100010], pos[100010];
ll bit[100010], ans;

bool used[100010];

ll sum(ll i)
{
	ll s = 0;
	while (i > 0)
	{
		s += bit[i];
		i -= i & -i;
	}
	return s;
}

void add(ll i, ll x)
{
	while (i <= n)
	{
		bit[i] += x;
		i += i & -i;
	}
}

ll pow_mod(ll x, ll y)
{
	ll res = 1;
	while (y > 0)
	{
		if (y % 2 == 1)
		{
			(res *= x) %= mod;
		}
		(x *= x) %= mod;
		y /= 2;
	}
	return res;
}

ll div(ll x)
{
	return pow_mod(x, mod - 2);
}



int main(void)
{
	cin >> n;

	cout << pow(n, 3) << endl;
	
	int www;
	cin >> www;
}


Measured memory_bytes: 384
#include<iostream>
#include<cstdio>
#include<string>
#include<algorithm>
#include<cmath>
#include<vector>
#include<stack>
#include<climits>
#include<cstring>
#include<queue>
using namespace std;
typedef long long ll;

const int INF = INT_MAX/3;

int main(){
    int n;
    cin >> n;

    for(int i=1;i<n+1;i++){
        if(i%3 == 0){
            cout << " " << i;
            continue;
        }

        int x = i;
        while(x){
            if(x%10 == 3){
                cout << " " <<i;
                break;
            }
            x /= 10;
        }
    }
    cout << endl;
    return 0;
}

Measured memory_bytes: 3104
S = input()
s01 = int(S[0]+S[1])
s23 = int(S[2]+S[3])
if (0 < s01 and s01 <= 12) and (0 < s23 and s23 <= 12):
    print('AMBIGUOUS')

elif (0 < s01 and s01 <= 12) and (s23 > 12 or s23 == 0):
    print('MMYY')

elif (s01 > 12 or s01 == 0) and (0 < s23 and s23 <= 12):
    print('YYMM')
else:
    print('NA')

Measured memory_bytes: 3064
n = int(input())
AC = 0
WA = 0
TLE = 0
RE = 0

for i in range(n):
    a = input()
    if a == "AC":
        AC += 1
    if a == "WA":
        WA += 1
    if a == "TLE":
        TLE += 1
    if a == "RE":
        RE += 1

print("AC x",AC)
print("WA x",WA)
print("TLE x",TLE)
print("RE x",RE)

Measured memory_bytes: 9204
from random import choice
from random import random
from time import time


class Optimizer:
    def __init__(self, C, S):
        self.C = C
        self.S = S
        X = []
        L = [-1] * 26
        for i in range(365):
            max_diff = -10**10
            best_j = 0
            for j in range(26):
                memo = L[j]
                L[j] = i
                diff = self.S[i][j] - \
                    sum([self.C[jj] * (i - L[jj]) for jj in range(26)])
                if diff > max_diff:
                    max_diff = diff
                    best_j = j
                L[j] = memo
            L[best_j] = i
            X.append(best_j)
        self.X = X

    def calc_score(self):
        score = 0
        L = [-1 for j in range(26)]
        A = [0 for j in range(26)]
        for i in range(365):
            score += self.S[i][self.X[i]]
            A[self.X[i]] += (i - L[self.X[i]]) * \
                (i - L[self.X[i]] - 1) // 2
            L[self.X[i]] = i
        for j in range(26):
            A[j] += (365 - L[j]) * (365 - L[j] - 1) // 2
            score -= self.C[j] * A[j]
        return score

    def optimize(self, temp, threp, interval, start_time, lim=1.8):
        max_score = self.calc_score()
        while True:
            t = (time() - start_time) / 2
            if random() < threp:
                i = choice(range(365))
                j = choice(range(26))
                memo = self.X[i]
                self.X[i] = j
                new_score = self.calc_score()
                if new_score > max_score:
                    max_score = new_score
                elif random() < pow(2.7, (new_score - max_score) / pow(2000, 1 - t)):
                    max_score = new_score
                else:
                    self.X[i] = memo
            else:
                a = choice(range(interval))
                i0 = choice(range(365 - a))
                i1 = i0 + a
                self.X[i0], self.X[i1] = self.X[i1], self.X[i0]
                new_score = self.calc_score()
                if new_score > max_score:
                    max_score = new_score
                elif random() < pow(2.7, (new_score - max_score) / pow(2000, 1 - t)):
                    max_score = new_score
                else:
                    self.X[i0], self.X[i1] = self.X[i1], self.X[i0]
            if time() - start_time > lim:
                break
        return max(max_score + 10**6, 0)


if __name__ == "__main__":
    d = int(input())
    *C, = map(int, input().split())
    S = [list(map(int, input().split())) for i in range(d)]
    opt = Optimizer(C, S)
    opt.optimize(700, 0.6, 13, time())
    for x in opt.X:
        print(x + 1)
    # print(opt.calc_score())


Measured memory_bytes: 90996
#include <bits/stdc++.h>
using namespace std;
long long q,h,s,t;
long long n;
int main()
{
    cin>>q>>h>>s>>t;
    cin>>n;
    long long ans1=q*4*n;
    long long ans2=h*2*n;
    long long ans3=s*n;
    long long ans4;
    if(n%2==0)
        ans4=t*(n/2);
    else
        ans4=t*(n/2)+(min(q*4,min(h*2,s)));
    cout<<min(ans1,min(ans2,min(ans3,ans4)));
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,a,n) for(int i=a;i<n;i++)
#define repb(i,a,b) for(int i=a;i>=b;i--)
#define all(a) a.begin(),a.end()
#define o(a) cout<<a<<endl
#define pb(a) push_back(a)
//#define int long long
#define fi first
#define se second
using namespace std;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int,int> pii;

signed main() {
    int m, n;
    cin >> m >> n;
    bool f[21] = {0};
    int d[21][21] = {0};
    int sum[21] = {0};
    rep(i, 0, n){
        int a, b;
        cin >> a >> b;
        a--; b--;
        d[b][a] = 1;
        sum[b]++;
    }
    int cnt = m;
    while(cnt){
        rep(i, 0, m){
            if(f[i] == false && sum[i] == 0){
                f[i] = true;
                cnt--;
                cout << i + 1 <<endl;
                rep(j, 0, m){
                    if(d[j][i]){
                        d[j][i] = 0;
                        sum[j]--;
                    }
                }
            }
        }
    }
}

Measured memory_bytes: 1160