akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;

int main()
{
	int n,k;
	int h[200005];
	long long ans;
    cin>>n>>k;
    
    for(int i=0; i<n; i++) cin>>h[i];
    
    sort(h,h+n);
    
    for(int i=0; i<n-k; i++)
	{
        ans+=h[i];
    }
    cout<<ans<<endl;

    return 0;
}

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

int main() {
    int ab,bc,ca;
    cin >> ab >> bc >> ca;
    int maxl = max(ab,max(bc,ca));
    if(maxl == ab){
        cout << bc*ca/2;
    } else if(maxl == bc){
        cout << ab*ca/2;
    } else {
        cout << ab*bc/2;
    }
}

Measured memory_bytes: 256
n, m, x = map(int, input().split())
A = [[] for _ in range(n)]
cost = [0] * n
for i in range(n):
  c_as = list(map(int, input().split()))
  cost[i], A[i] = c_as[0], c_as[1:]
INF = 10**9
ans = INF
for s in range(0, 1 << n):
  smart = [0] * m
  cost_sum = 0
  for i in range(n):
    if (s >> i) % 2 == 0:
      continue
    cost_sum += cost[i]
    for j in range(m):
      smart[j] += A[i][j]
  ok = True
  for j in range(m):
    if smart[j] < x:
      ok = False
  if ok:
    ans = min(ans, cost_sum)
if ans == INF:
  ans = -1
print(ans)
    


Measured memory_bytes: 9212
// @iamnifer
#include <iostream>
#include <set>
#include <vector>
#include <string>
#include <algorithm>
#include <map>
#include <stack>
#include <deque>
#include <queue>
#include <iomanip>
#include <bits/stdc++.h>
#define ll long long
#define ld long double
#define ull unsigned long long
#define elif else if
#define inf (ll)1e18
#define append push_back
#define pb push_back
#define str to_string
#define gcd __gcd
#define optimise cout.tie(0);cin.tie(0);ios_base::sync_with_stdio(0);
#define all(x) x.begin(),x.end()
#define rall(x) r.rbegin(),x.rend()
#define len(x) (ll)x.size()
#define add insert
#define PI 3.14159265358979323846264338327950288419716939937510
#define lcm(a,b) a/gcd(a,b)*b
#define eps 0.0000000001
#define endl '\n'
#pragma GCC optimize("Ofast,unroll-loops")
#pragma GCC target("avx,avx2,fma")
//#pragma comment(linker,"/STACK:128777216")
//#include <ext/pb_ds/detail/standard_policies.hpp>
//#include <ext/pb_ds/assoc_container.hpp>
//using namespace __gnu_pbds;
//typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update>ordered_set;
using namespace std;
typedef vector<vector<ll>>graph;
const ll MOD = (ll)1e9+7;//998244353
const ll maxN= (ll)1e6+1;
vector<ll>p;
vector<ll>sieve(maxN,true);
void getprimes(){
    for(ll i=2;i<maxN;i++){
        if(sieve[i]){
            for(ll j=i<<1;j<maxN;j+=i){
                sieve[j]=false;
            }
        }
    }
    for(ll i=2;i<maxN;i++){
        if(sieve[i]){
            p.pb(i);
        }
    }
}
int main()
{
    optimise
    ll n;cin>>n;
    ll s[n];for(auto&i:s)cin>>i;
    getprimes();
    set<ll>facts;
    ll g=0;
    bool pairwise=true;
    for(auto&i:s){
        g=gcd(g,i);
        if(!pairwise)continue;
        for(auto&pr:p){
            if(pr*pr>i)break;
            if(i%pr==0){
                if(facts.count(pr)){
                    pairwise=false;
                    break;
                }
                facts.add(pr);
                while(i%pr==0)i/=pr;
            }
        }
        if(i>1){
            if(facts.count(i))pairwise=false;
            facts.add(i);
        }

    }
    if(pairwise)cout<<"pairwise coprime";
    else if(g==1)cout<<"setwise coprime";
    else cout<<"not coprime";
}

Measured memory_bytes: 19904
N = int(input())
S = input()
left = [0]
right = [S.count('E')]
for i in range(N):
    if S[i] == 'W':
        left.append(left[i]+1)
        right.append(right[i])
    else:
        left.append(left[i])
        right.append(right[i]-1)
ans = 1000000
for i in range(N):
    ans = min(ans, left[i]+right[i+1])
print(ans)


Measured memory_bytes: 17644
#include <iostream>

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

   while(N>0){
      if(N%10==7){
	 std::cout << "Yes" << std::endl;
	 return 0;
      }
      N /= 10;
   }
   std::cout << "No" << std::endl;
   return 0;
}


Measured memory_bytes: 3612
#include <bits/stdc++.h>
using namespace std;
#define GET_MACRO(_1, _2, _3, NAME, ...) NAME
#define _repl(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define _rep(i,n) _repl(i,0,n)
#define rep(...) GET_MACRO(__VA_ARGS__, _repl, _rep)(__VA_ARGS__)
#define mp(a,b) make_pair((a),(b))
#define pb(a) push_back((a))
#define all(x) (x).begin(),(x).end()
#define uniq(x) sort(all(x)),(x).erase(unique(all(x)),end(x))
#define fi first
#define se second
#define dbg(...) _dbg(#__VA_ARGS__, __VA_ARGS__)
void _dbg(string){cout<<endl;}
template<class H,class... T> void _dbg(string s,H h,T... t){int l=s.find(',');cout<<s.substr(0,l)<<" = "<<h<<", ";_dbg(s.substr(l+1),t...);}
template<class T,class U> ostream& operator<<(ostream &o, const pair<T,U> &p){o<<"("<<p.fi<<","<<p.se<<")";return o;}
template<class T> ostream& operator<<(ostream &o, const vector<T> &v){o<<"[";for(T t:v){o<<t<<",";}o<<"]";return o;}

#define INF 1120000000

using P = pair<int,int>;
vector<P> g[100005];

int pos[100005];
bool visited[100005];

bool solve(int v, int from){
  visited[v] = true;
  for(auto p : g[v]) if(p.first != from){
    int to = p.first;
    int nc = pos[v] + p.second;
    if(visited[to]){
      if(nc != pos[to]) return false;
    }
    else {
      pos[to] = nc;
      bool r = solve(to, v);
      if(!r) return false;
    }
  }
  return true;
}

int main(){
  int n,m;
  cin>>n>>m;
  rep(i,m){
    int l,r,d;
    cin>>l>>r>>d;
    l--;r--;
    g[l].pb(mp(r, d));
    g[r].pb(mp(l, -d));
  }

  rep(i,n) if(!visited[i]){
    pos[i] = 0;
    if(!solve(i, -1)){
      cout << "No" << endl;
      return 0;
    }
  }

  cout << "Yes" << endl;

  return 0;
}


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

// 総数を1000000007（素数）で割った余り
const long long mod = 1e9 + 7;

using ll = long long;
using pii  = pair<int, int>;
using pll = pair<ll, ll>;
#define ull unsigned long long
#define ld long double
#define vi vector<int>
#define vll vector<ll>
#define vc vector<char>
#define vs vector<string>
#define vpii vector<pii>
#define vpll vector<pll>

#define rep(i, n) for (int i = 0, i##_len = (n); i < i##_len; i++)
#define rep1(i, n) for (int i = 1, i##_len = (n); i <= i##_len; i++)
#define repr(i, n) for (int i = ((int)(n)-1); i >= 0; i--)
#define rep1r(i, n) for (int i = ((int)(n)); i >= 1; i--)

#define sz(x) ((int)(x).size())
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()

#define SORT(v, n) sort(v, v + n);
#define VSORT(v) sort(v.begin(), v.end());
#define RSORT(x) sort(rall(x));
#define pb push_back
#define mp make_pair

#define INF (1e9)
#define PI (acos(-1))
#define EPS (1e-7)

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

inline void chmax(ll& a, ll b) { a = max(a, b); }

int main(){
    int n;
    cin >> n;
    vi a(n);
    rep(i, n) cin >> a[i];
    vpii p;
    rep(i, n) p.emplace_back(a[i], i);
    RSORT(p);
    vector<vll> dp(n+1, vll(n+1, -INF));
    dp[0][0] = 0;
    rep(i, n) {
        int ai = p[i].first, bi = p[i].second;
        rep(l, i+1) {
            int r = i - l;
            chmax(dp[i+1][l+1], dp[i][l]+ll(ai)*(bi-l));
            chmax(dp[i+1][l], dp[i][l]+ll(ai)*(n-r-bi-1));
        }
    }
    ll ans = 0;
    rep(i, n+1) chmax(ans, dp[n][i]);
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 34656
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll,ll>pll;
int main()
{
     char ch;

     cin>>ch;

     if(ch>='A'&&ch<='Z')
        cout<<'A'<<endl;
     else cout<<'a'<<endl;



}



Measured memory_bytes: 3636
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
const ll INF = 100000000;
#define rep1(i, n) for (ll i=0; i<(n); i++) 
#define rep2(i, k, n) for (ll i=k; i<(n); i++)
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; }


int main() {
    ll n, t;
    cin >> n;
    ll ans = 1; 
    rep1(i, n){
        cin >> t;
        ans = lcm(ans, t);
    }
    cout << ans << endl;
    //printf("%.12f", ans);
}

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

const string YES = "Yes";
const string NO = "No";

void solve(long long N, long long K, long long Q, std::vector<long long> A){
    vector<long long> cnt_win(N, 0);
    for(auto a : A){
        cnt_win[a-1] += 1;
    }
    for(auto cnt : cnt_win){
        if(K - (Q - cnt) > 0) cout << YES << endl;
        else cout << NO << endl;
    }
}

int main(){
    long long N;
    scanf("%lld",&N);
    long long K;
    scanf("%lld",&K);
    long long Q;
    scanf("%lld",&Q);
    std::vector<long long> A(Q);
    for(int i = 0 ; i < Q ; i++){
        scanf("%lld",&A[i]);
    }
    solve(N, K, Q, std::move(A));
    return 0;
}


Measured memory_bytes: 4828
#include <bits/stdc++.h>
#define rep(i, n) repi(i, 0, n)
#define repi(i, a, b) for (int i = (int)(a) ; i < (int)(b) ; i++)


#define SZ(x) ((int)(x).size())


typedef long long ll;
typedef unsigned long long ull;
typedef unsigned int uint;
struct Vec{
    double x, y;
};

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

template<class T>
T min(T a, T b)
{
    if (a < b) return a;
    return b;
}

template<class T>
T max(T a, T b)
{
    if (a > b) return a;
    return b;
}

using namespace std;

int main()
{
    int N, M, num = 0;
    cin >> N >> M;
    vector <int> cs(N + 1, -1);
    bool bi=false;
    rep(i, M){
        int c, s;
        cin >> c >> s;
        if ((N != 1 && c == 1 && s == 0) || (cs[c] != s && cs[c] != -1)){
            bi = true;
        }
        cs[c] = s;
    }
    if (bi) {
        cout << -1 << endl;
        return 0;
    }
    repi(i, 1, N+1) {
        if (cs[i] == -1) continue;
        num += pow(10, N - i) * cs[i];
    }
    if (M == 0){
        num = 0;
    }
    if (num < pow(10, N - 1) && N > 1){
        num += pow(10, N - 1);
    }
    cout << num << endl;
    return 0;
}


Measured memory_bytes: 3696
n=int(input())
rs=[list(map(int,input().split())) for _ in range(n)]
bs=[list(map(int,input().split())) for _ in range(n)]
rs.sort(key=lambda x:x[1],reverse=True)
bs.sort()
ans=0
for c,d in bs:
    for a,b in rs:
        if a<c and b<d:
            ans+=1
            rs.remove([a,b])
            break
print(ans)


Measured memory_bytes: 9088
import std.stdio;
import std.string;
import std.conv;
import std.array;
import std.math;

void main()
{
    int N = readln.chomp.to!int;
    int[] h = readln.split.to!(int[]);

    int[] cost = new int[N];
    cost[0] = 0;
    cost[1] = abs(h[1] - h[0]);
    foreach (i; 2..N){
        int c0 = cost[i - 2] + abs(h[i] - h[i - 2]);
        int c1 = cost[i - 1] + abs(h[i] - h[i - 1]);
        if (c0 < c1) cost[i] = c0;
        else cost[i] = c1;
    }

    writeln(cost[$ - 1]);
}



Measured memory_bytes: 4252
#include <iostream>
#include <stdio.h>
#include <string.h>
#include <string>
#include <vector>
#include <deque>
#include <list>
#include <queue>
#include <math.h>
#include <assert.h>
#include <set>
#include <map>
#include <bitset>
#include <ctime>
#include <time.h>
#include <algorithm>
#include <cstdio>
#include <fstream>
#include <stack>
#include <ctype.h>
#include <numeric>
#include <sstream>
#include <unistd.h>
#include <unordered_map>
#include <limits>
#include <random>
#include <chrono>
using namespace std;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

int main(int argv, char **argc){
    cin.tie(0); ios::sync_with_stdio(0);

    int n, a[100], b[100], c = 0;
    cin >> n;
    for(int i = 0; i < n; ++i){
        cin >> a[i];
        b[i] = a[i];
    }
    sort(a, a + n);
    for(int i = 0; i < n;  ++i){
        c += (a[i] != b[i]);
    }
    printf("%s\n", c <= 2 ? "YES" : "NO");
}

Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i,n) for(ll i=0;i<n;i++)
#define repl(i,l,r) for(ll i=(l);i<(r);i++)
#define per(i,n) for(ll i=n-1;i>=0;i--)
#define perl(i,r,l) for(ll i=r-1;i>=l;i--)
#define fi first
#define se second
#define pb push_back
#define ins insert
#define all(x) (x).begin(),(x).end()
using vl=vector<ll>;
using vvl=vector<vector<ll>>;
const ll MOD=1000000007;
const ll MOD9=998244353;
const int inf=1e9+10;
const ll INF=4e18;
const ll dy[8]={1,0,-1,0,1,1,-1,-1};
const ll dx[8]={0,-1,0,1,1,-1,1,-1};
using Graph = vector<vector<int>>;
const double pi=acos(-1);
template<int MOD> struct Fp {
    long long val;
    constexpr Fp(long long v = 0) noexcept : val(v % MOD) {
        if (val < 0) val += MOD;
    }
    constexpr int getmod() { return MOD; }
    constexpr Fp operator - () const noexcept {
        return val ? MOD - val : 0;
    }
    constexpr Fp operator + (const Fp& r) const noexcept { return Fp(*this) += r; }
    constexpr Fp operator - (const Fp& r) const noexcept { return Fp(*this) -= r; }
    constexpr Fp operator * (const Fp& r) const noexcept { return Fp(*this) *= r; }
    constexpr Fp operator / (const Fp& r) const noexcept { return Fp(*this) /= r; }
    constexpr Fp& operator += (const Fp& r) noexcept {
        val += r.val;
        if (val >= MOD) val -= MOD;
        return *this;
    }
    constexpr Fp& operator -= (const Fp& r) noexcept {
        val -= r.val;
        if (val < 0) val += MOD;
        return *this;
    }
    constexpr Fp& operator *= (const Fp& r) noexcept {
        val = val * r.val % MOD;
        return *this;
    }
    constexpr Fp& operator /= (const Fp& r) noexcept {
        long long a = r.val, b = MOD, u = 1, v = 0;
        while (b) {
            long long t = a / b;
            a -= t * b; swap(a, b);
            u -= t * v; swap(u, v);
        }
        val = val * u % MOD;
        if (val < 0) val += MOD;
        return *this;
    }
    constexpr bool operator == (const Fp& r) const noexcept {
        return this->val == r.val;
    }
    constexpr bool operator != (const Fp& r) const noexcept {
        return this->val != r.val;
    }
    friend constexpr ostream& operator << (ostream &os, const Fp<MOD>& x) noexcept {
        return os << x.val;
    }
    friend constexpr Fp<MOD> modpow(const Fp<MOD> &a, long long n) noexcept {
        if (n == 0) return 1;
        auto t = modpow(a, n / 2);
        t = t * t;
        if (n & 1) t = t * a;
        return t;
    }
};
using mint = Fp<MOD>;

mint calc(long long N, long long K) {
    mint res = 1;
    for (long long n = 0; n < K; ++n) {
        res *= (N - n);
        res /= (n + 1);
    }
    return res;
}
int main() {
//cout << fixed << setprecision(12);
ll n;
cin>>n;
ll a[n]={};
ll ma = 0;
rep(i,n){
cin>>a[i];
ma += a[i];}
ll ca = 0;
ma/=2;
rep(i,n){
ll m = i -2;
ll u = i + 1;
while(m>=0){
ca+=a[m];
m--;
m--;}
while(u<=n-1){
ca+=a[u];
u++;
u++;}
cout << 2*(ma-ca) << " ";
ca = 0;}
cout << endl;}


Measured memory_bytes: 4356
#include<iostream>
#define loop(i,a,b) for(int i=a;i<b;i++)
#define rep(i,a) loop(i,0,a)
using namespace std;

int main(){
	int n,a,b,ans=0;
	cin>>n;
	int dt[100002]={};
	rep(i,n){
		cin>>a>>b;
		dt[a]++;
		dt[b+1]--;
	}
	int cnt=-1;
	loop(i,1,100002){
		dt[i]+=dt[i-1];
	}
	rep(i,n+2){
		if(dt[i]>=i-1)ans=i;
	}
	cout<<ans-1<<endl;
	return 0;
}

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

int main(){
    long long a,b,k;
    cin >> a >> b >> k;
    if(a>=k){ 
        a=a-k;
    }else if(k<=a+b){
        b=b-(k-a);
        a=0;
    }else{
        a=0;b=0;
    }
    cout << a << ' ' << b << endl;
}

Measured memory_bytes: 256
using System;

public class p0028{
	p0028 ()
	{
		string str;
		int[] a = new int[101];
		int n = 0;
		
		while ((str=Console.ReadLine())!= null)
			++a [int.Parse (str)];
		
		for (int i = 0; i < 101; ++i)
			n = Math.Max (n, a [i]);
		
		for (int i = 0; i < 101; ++i)
			if (a [i] == n)
				Console.WriteLine ("{0}", i);
	}
	
	public static int Main (string[] args)
	{
		new p0028 ();
		return 0;
	}
}

Measured memory_bytes: 5568
#include<cstdio>
#include<cmath>
#include<iostream>
#include<algorithm>
#include<queue>
using namespace std;
int main(){
    long long int N;
    long long int ans=0;
    cin>>N;
    for(long long int i=1;i<=N;i++){
        if(i%3!=0&&i%5!=0)ans+=i;
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 3632
#pragma GCC optimize "Ofast"
#pragma GCC optimize "unroll-loops"
#pragma GCC target "sse,sse2,sse3,sse4,abm,avx,mmx,popcnt,tune=native"
#include <bits/stdc++.h>
#define scan(x) do{while((x=getchar_unlocked())<'0'); for(x-='0'; '0'<=(_=getchar_unlocked()); x=(x<<3)+(x<<1)+_-'0');}while(0)
char _;
#define ll long long
#define MAXN 510
#define INF 0x3f3f3f3f
#define min(a, b) (a) < (b) ? (a) : (b)
#define max(a, b) (a) < (b) ? (b) : (a)
#define vi vector<int>
#define pb push_back
#define pii pair<int, int>
#define mp make_pair
#define f first
#define s second
#define mii map<int, int>
#define umii unordered_map<int, int>
#ifdef DEBUG
	#define D(x...) printf(x)
#else
	#define D(x...)
#endif
using namespace std;

string S;
ll K;

int main (int argc, char const *argv[]) {
	#ifdef NOT_DMOJ
	freopen("in.txt", "r", stdin);
	freopen("out.txt", "w", stdout);
	#endif // NOT_DMOJ
	cin.sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	cin >> S >> K;
	int ind = 0;
	while (ind < S.size() && S[ind] == '1') ++ind;
	if (ind < K) cout << S[ind] << "\n";
	else cout << 1 << "\n";
	return 0;
}

/* 
 * Look for:
 * the exact constraints (multiple sets are too slow for n=10^6 :( ) 
 * special cases (n=1?)
 * overflow (ll vs int?)
 * array bounds
 */

Measured memory_bytes: 384
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;

int main(){
    int n;
    cin >> n;
    vector<int> a(n);
    int ans = 0;
    for(int i=0; i<n; i++){
        cin >> a[i];
        if(a[i] < a[ans]){
            ans = i;
        }
    }
    cout << ans+1 << endl;
    return 0;
}



Measured memory_bytes: 3096
import java.util.*;

public class Main{
	public static void main(String[] args) throws Exception {
		Scanner s = new Scanner(System.in);
		String S = s.next();
      	int max = 0, n = 0;
      	for (int i = 0; i < S.length(); i++){
          	String SS = S.substring(i, i + 1);
          	//System.out.println(SS);
        	if (SS.equals("A") || SS.equals("T") || SS.equals("G") || SS.equals("C")){
            	n++;
            }
          	else {
            	n = 0;
            }
            if (max < n){
            		max = n;
            }
            //System.out.println(n + " " + max);
            
        }
        System.out.println(max);
	}
}

Measured memory_bytes: 22612
import java.lang.*;
import java.io.*;
import java.util.*;


public class Main {
	
	public static void main(String[] args) throws java.lang.Exception {
		InputStream inputStream = System.in;
		OutputStream outputStream = System.out;
		InputReader in = new InputReader(inputStream);
		PrintWriter out = new PrintWriter(outputStream);
		TaskA solver = new TaskA();
		solver.solve(in, out);
		out.close();
	}
}

class TaskA {	
	
	public void solve(InputReader in, PrintWriter out) {
		int[] a = new int[3];
		
		for (int i=0; i<3; ++i)
			a[i] = in.nextInt();
		
		Arrays.sort(a);
		
		if (a[0]+a[1] == a[2])
			out.println("Yes");
		else
			out.println("No");
	}
	
}

class InputReader {
	public BufferedReader reader;
	public StringTokenizer tokenizer;
	
	
	public InputReader(InputStream stream) {
		reader = new BufferedReader(new InputStreamReader(stream), 32768);
		tokenizer = null;
	}
	
	String next() {
		while (tokenizer==null || !tokenizer.hasMoreTokens()) {
			try {
				tokenizer = new StringTokenizer(reader.readLine());
			} catch (IOException e) {
				throw new RuntimeException(e);
			}
		}
		return tokenizer.nextToken();
	}
	
	public int nextInt() {
		return Integer.parseInt(next());
	}
	
	public long nextLong() {
		return Long.parseLong(next());
	}
	
	public double nextDouble() {
		return Double.parseDouble(next());
	}
}


Measured memory_bytes: 21716
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int K;
  cin >> K;
  
  if (K == 1 || K == 2 || K == 3 || K == 5 || K == 7 || K == 11 || K == 13 || K == 15 || K == 17 || K == 19 || K == 23 || K == 29 || K == 31){
    cout << 1 << endl;
  }
  else if (K == 4 || K == 6 || K == 9 || K == 10 || K == 14 || K == 21 || K == 22 || K == 25 || K == 26){
    cout << 2 << endl;
  }
  else if (K == 28 || K == 30){
    cout << 4 << endl;
  }
  else if (K == 8 || K == 12 || K == 18 || K == 20 || K == 27){
    cout << 5 << endl;
  }
  else if (K == 16){
    cout << 14 << endl;
  }
  else if (K == 32){
    cout << 51 << endl;
  }
  else {
    cout << 15 << endl;
  }
}

Measured memory_bytes: 3632
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, N) for (int i = 0; i < (int)N; ++i)
#define all(a) (a).begin(), (a).end()

template <typename T>
class FloydWarshall {
  bool _hasNegativeCycle;
  vector<vector<T>> distTo;

 public:
  FloydWarshall(vector<vector<T>> G) {
    int V = G.size();
    T INF = numeric_limits<T>::max() / 2;
    distTo.resize(V, vector<T>(V, INF));

    for (int u = 0; u < V; ++u) {
      for (int v = 0; v < V; ++v) {
        if (u == v) {
          distTo[u][v] = 0;
          continue;
        }

        distTo[u][v] = G[u][v];
      }
    }

    for (int w = 0; w < V; ++w) {
      for (int u = 0; u < V; ++u) {
        for (int v = 0; v < V; ++v) {
          distTo[u][v] = min(distTo[u][v], distTo[u][w] + distTo[w][v]);
        }

        if (distTo[u][u] < 0) {
          _hasNegativeCycle = true;
          return;
        }
      }
    }
  }

  bool hasNegativeCycle() { return _hasNegativeCycle; }

  T dist(int s, int t) { return distTo[s][t]; }
};

int N, M, R;

vector<int> r;
vector<vector<ll>> G;

int main() {
  cin >> N >> M >> R;
  r.resize(R);
  G.resize(N, vector<ll>(N, numeric_limits<ll>::max() / 2));

  rep(i, R) {
    cin >> r[i];
    r[i]--;
  }

  rep(i, M) {
    int A, B, C;
    cin >> A >> B >> C;
    A--, B--;
    G[A][B] = C;
    G[B][A] = C;
  }

  FloydWarshall<ll> fw(G);

  ll ans = numeric_limits<ll>::max();
  sort(all(r));
  do {
    ll c = 0;
    rep(i, R - 1) c += fw.dist(r[i], r[i + 1]);
    ans = min(ans, c);
  } while (next_permutation(all(r)));

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


Measured memory_bytes: 1152
using System;
using System.Linq;

class C
{
	static void Main()
	{
		var h = Console.ReadLine().Split().Select(int.Parse).ToArray();
		var qs = new int[h[1]].Select(_ => Console.ReadLine().Split()).GroupBy(x => x[0], x => x[1]).Where(g => g.Contains("AC")).Select(g => g.TakeWhile(x => x == "WA").Count()).ToArray();
		Console.WriteLine($"{qs.Length} {qs.Sum()}");
	}
}


Measured memory_bytes: 66232
#include <iostream>
#include <map>
#include <set>
#include <algorithm>
#include <vector>
#include <sstream>
#include <string>
#include <functional>
#include <queue>
#include <deque>
#include <stack>
#include <limits>
#include <unordered_map>
#include <unordered_set>
#include <math.h>
#include <fstream>
#include <iterator>
#include <random>
#include <chrono>
 
 
#define forr(i,start,count) for (int i = (start); i < (start)+(count); ++i)
#define set_map_includes(set, elt) (set.find((elt)) != set.end())
#define readint(i) int i; cin >> i
#define readll(i) ll i; cin >> i
#define readdouble(i) double i; cin >> i
#define readstring(s) string s; cin >> s
 
typedef long long ll;
 
using namespace std;

ll modd = 1000*1000*1000+7;

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


int main()   {

    ios_base::sync_with_stdio(false);

    cout.precision(17);
    mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
    uniform_int_distribution<int> rand_gen(0, modd);   // rand_gen(rng) gets the rand no
 
//    auto start = chrono::steady_clock::now();

   
//    readint(test_cases);
    int test_cases = 1;
    forr(t, 1, test_cases) {
        readll(n); readll(m);
        readstring(s1); readstring(s2);
        ll alpha = m/gcd(n,m), beta = n/gcd(n,m);
        bool isok = true;
        ll i = 0;
        while (i*alpha<s2.size() ) {
            isok = isok && (s1[i*beta]==s2[i*alpha]);
            ++i;
        }
        if (isok) {
            cout << (m*n)/gcd(m,n) << endl;
        } else {
            cout << -1 << endl;
        }

    }
 
//    auto end = chrono::steady_clock::now();
//    cout << chrono::duration_cast<chrono::milliseconds>(end - start).count() << endl;
 
    return 0;
}

Measured memory_bytes: 3852
X, N = map(int, input().split())
a = 102 - X
ans = 102
if N > 0:
  P = list(map(int, input().split()))
  for i in range(102):
    flag = True
    for j in P:
      if j == i:
        flag = False
    if flag == True and abs(X - i) < a:
      ans = i
      a = abs(X - i)
else:
  ans = X
print(ans)  


Measured memory_bytes: 9200
#include <iostream>
#include <string>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <vector>
#include <cmath>
#include <cstdlib>
#include <queue>
#include <stack>

using namespace std;

#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define REPO(i, n) for(int i = 1;i <= n;i++)
#define ll long long
#define INF 1999999999
#define MINF -1999999999
#define INF64 1999999999999999999
#define ALL(n) n.begin(),n.end()
#define ABS(a,b) max(a,b) - min(a,b)


int main() {
	int N, nt = 0, nx = 0, ny = 0;
	bool ans = false;
	cin >> N;
	REP(i, N) {
		int a, b, c;
		cin >> a >> b >> c;
		if ((ABS(b, nx) + ABS(c, ny)) > ABS(a, nt)) ans = true;
		if ((ABS(a,nt)) % 2 != (ABS(b,nx) + ABS(c,ny)) % 2) ans = true;
		nt = a;
		nx = b;
		ny = c;
	}
	cout << (ans ? "No" : "Yes") << endl;
}

Measured memory_bytes: 256
#include<iostream>
#define ll long long
#define MOD 1000000007
using namespace std;

int main() {
  ll n,k;
  cin>>n>>k;
  long total=0;
  //total=sum+1;
  long sum=0;
  //cout<<MOD<<endl;
  for(long i=0;i<k;i++) {
	  sum+=(n-2*i);
	  //sum=sum%MOD;
  }
  total=sum+1;
  total=total%MOD;
  //cout<<"init sum: "<<sum<<endl;
  //cout<<"aliter sum: "<<sum<<endl;
  //cout<<n<<" "<<k<<endl;
  for(long i=k;i<=n;i++) {
	// cout<<sum<<" "<<total<<endl;
	//cout<<total<<" ";
    sum+=(n-2*i);
    total+=sum+1;
    total=total%MOD;
    //cout<<sum<<" "<<total<<endl;
  }
  cout<<total<<endl;
  return 0;
}

Measured memory_bytes: 3640
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define all(x) (x).begin(),(x).end()
const int mod=1000000007,MAX=1<<20;
const ll INF=1LL<<60;

int bit[MAX+1][26],N;

//1-indexed

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

//sからtの和=sum(t)-sum(s-1)

void add(int i,int x,int k){
    while(i<=N){
        bit[i][k]+=x;
        i+=i&-i;
    }
}

int main(){
    
    std::ifstream in("text.txt");
    std::cin.rdbuf(in.rdbuf());
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    cin>>N;
    string S;cin>>S;
    for(int i=0;i<N;i++){
        add(i+1,1,int(S[i]-'a'));
    }
    int Q;cin>>Q;
    while(Q--){
        int c;cin>>c;
        if(c==1){
            int a;char b;cin>>a>>b;
            add(a,-1,int(S[a-1]-'a'));
            add(a,1,int(b-'a'));
            S[a-1]=b;
        }else{
            int ans=0;
            int l,r;cin>>l>>r;
            l--;
            for(int j=0;j<26;j++){
                if(sum(r,j)-sum(l,j)) ans++;
            }
            cout<<ans<<endl;
        }
    }
}



Measured memory_bytes: 52124
#pragma GCC optimize(2)
#pragma GCC optimize(3)
#include <bits/stdc++.h>
using namespace std;
#define rep(i,a,n) for (int i=a;i<=n;i++)
#define per(i,a,n) for (int i=n;i>=a;i--)
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define sz(x) ((int)(x).size())
typedef vector<int> vi;
typedef long long ll;
typedef pair<int,int> pii;
typedef double db;
const ll mod = 1000000007;
const int inf = 0x3f3f3f3f;
const ll inff = 0x7ffffffffff;
ll read()
{
	ll x=0,f=1;char ch=getchar();
	while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
	while(ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();}
	return x*f;
}
//head
const int N = 10;
int n, m, k, ans;
char ch[N][N];
int g[N][N];
int main() {
	cin >> n >> m >> k;
	rep(i, 1, n) {
		rep(j, 1, m) {	
			cin >> ch[i][j];
			if(ch[i][j] == '#') g[i][j] = 1;
		}
	}
	for (int i = 0; i < (1 << n); i++) {
		for (int j = 0; j < (1 << m); j++) {
			int cnt = 0;
			for (int x = 1; x <= n; x++) {
				for (int y = 1; y <= m; y++) {
					if((1 << (x - 1)) & i) continue;
					if((1 << (y - 1)) & j) continue;
					cnt += g[x][y];
				}
			}
			if(cnt == k) ++ans;
		}
	}
	printf("%d", ans);
	return 0;
}

Measured memory_bytes: 3732
#include<bits/stdc++.h>
using namespace std;
int main(){
 int a,b;
 cin>>a>>b;
 if(a%3==0||b%3==0||(a+b)%3==0){
     cout<<"Possible"<<endl;
 }
 else{
     cout<<"Impossible"<<endl;
 }
 }
      


Measured memory_bytes: 256
#include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
#define eps 1e-4
#define fo(i,l,r) for(int i=l;i<=r;i++)
#define of(i,l,r) for(int i=l;i>=r;i--)
#define fe(i,u) for(int i=head[u];i;i=e[i].next)
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
#define P(a,b) make_pair(a,b)
inline int rd()
{
	int x=0,f=1;
	char ch=getchar();
	for(;ch<'0'||ch>'9';ch=getchar())if(ch=='-')f=-1;
	for(;ch>='0'&&ch<='9';ch=getchar())x=x*10+ch-'0';
	return x*f;
}
const int N=100010,mod=1000000007;
int n,m,a[N],b[N],t=0,v[N<<1];
int ans=1;
pii p[N];

inline int pls(int a,int b){return a+b>mod?a+b-mod:a+b;}
inline bool cmp(pii a,pii b){return a.first==b.first?a.second>b.second:a.first<b.first;}

namespace TA{
#define lowbit(x) (x&-x)
int tr[N];
inline void insert(int x,int d){for(;x<=n;x+=lowbit(x))tr[x]=pls(tr[x],d);}
inline int query(int x){int res=0;for(;x;x-=lowbit(x))res=pls(res,tr[x]);return res;}

}

int main()
{
	n=rd();m=rd();
	fo(i,1,n)a[i]=rd();fo(i,1,m)b[i]=rd();
	int pos=1;
	fo(i,1,n){
		if(a[i]<=b[1])continue;
		if(a[i]>=b[m])break;
		for(;b[pos+1]<=a[i];pos++);
		if(a[i]==b[pos])continue;
//		cout<<a[i]<<' '<<b[pos]<<endl;
		p[++t].first=a[i]-b[pos];
		p[t].second=v[t]=b[pos+1]-a[i];
//		cout<<v[t]<<' ';
	}
//	cout<<endl;
	sort(v+1,v+t+1);
	n=unique(v+1,v+t+1)-v-1;
//	cout<<t<<endl<<n<<endl;
	fo(i,1,t)p[i].second=lower_bound(v+1,v+n+1,p[i].second)-v;
	sort(p+1,p+t+1,cmp);
	t=unique(p+1,p+t+1)-p-1;
//	cout<<t<<endl<<endl;
	fo(i,1,t){
		int res=pls(TA::query(p[i].second-1),1);
//		cout<<p[i].second<<' '<<res<<endl;
		ans=pls(ans,res);
		TA::insert(p[i].second,res);	
	}
//	cout<<endl;
	printf("%d\n",ans);
	return 0;
}


Measured memory_bytes: 2304
import java.util.Scanner;
import java.io.IOException;

class Main{
  public static void main(String... args)throws IOException{
    Scanner sc = new Scanner(System.in);
    int num = sc.nextInt();
    if(num /10 == 9 || num %10 == 9) System.out.println("Yes");
    else System.out.println("No");
  }
}


Measured memory_bytes: 23764
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
#define ALL(x) (x).begin(), (x).end()
#define REP(i ,n) for(int i = 0; i < (int)(n); i++)
#define pb push_back
typedef vector<int>vint;
typedef vector<ll>vll;
template<typename T> istream &operator>>(istream &is, vector<T> &vec){ for (auto &v : vec) is >> v; return is; }
template<typename A,typename B>inline void chmin(A &a,B b){if(a>b)a=b;}
template<typename A,typename B>inline void chmax(A &a,B b){if(a<b)a=b;}

int main()
{
  ll A,B,C,D;
  cin >> A >> B >> C >>D;
  
  ll CD = C / __gcd(C,D) * D;
  
  ll range = B - A + 1;
  
  ll c_low = A/C;
  if(0 != A%C || A > C*(A/C)){
    c_low++;
  }
  ll d_low = A/D;
  if(0 != A%D || A > C*(A/D)){
    d_low++;
  }
  ll cd_low = A/(CD);
  if(0 != A%(CD) || A > (CD)*(A/(CD))){
    cd_low++;
  }
  
  ll c_up = B/C;
  ll d_up = B/D;
  ll cd_up = B/(CD);

  ll c = c_up-c_low+1;
  ll d = d_up-d_low+1;
  ll cd = cd_up-cd_low+1;

  cout << range - (c+d-cd) << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define speed_up ios_base::sync_with_stdio(false); cin.tie(NULL)
#define ll long long
#define ara(A,N) sort(A,A+N)
#define rev(A,N) sort(A,A+N,greater<long long>())
using namespace std;
int main()
{   speed_up;
    ll n, m, ans = 0;
    cin>>n>>m;
    if(m>n)
    {
        m = m - n*2;
        ans += n + m/4;
    }
    else
    {
        ans += m/2;
    }
 cout<<ans<<endl;

    return 0;

}







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

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


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


int main(void)
{
	ll n;
	cin >> n;
	if (n == 1) {
		cout << 0 << endl;
		return 0;
	}
	ll sum = 0;
	vector<bool> vs(n+1, false);
	for (int i = 1; i < min(n/2+2,n); i++) {
		if (vs[i]) {
			continue;
		}
		ll d = n - i;
		if (d != i) {
			vs[i] = true;
			vs[d] = true;
			sum++;
		}
	}
	cout << sum << endl;
	return 0;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define repr(i, n) for (int i = (n); i >= 0; --i)
#define FOR(i, m, n) for (int i = (m); i < (n); ++i)
#define FORR(i, m, n) for (int i = (m); i >= (n); --i)
#define equals(a, b) (fabs((a) - (b)) < EPS)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
const ll mod = 1000000007;
//const ll mod = 998244353;
const int inf = 1e9 + 10;
const ll INF = 1e18;
const ld EPS = 1e-10;
const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }



int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout << fixed << setprecision(25);

  int n, k;
  cin >> n >> k;
  vector<bool> f(n, false);
  while (k--) {
    int d;
    cin >> d;
    while (d--) {
      int a;
      cin >> a;
      a--;
      f[a] = true;
    }
  }

  int ans = 0;
  rep(i, n) {
    if (!f[i]) ans++;
  }
  cout << ans << '\n';




  
  return 0;
}

Measured memory_bytes: 3652
#include<bits/stdc++.h>
using namespace std;
bool f[100001];
int c[100002];
int N, L, R;
int main() {
    for (int i = 2; i <= 100000; i++)
    {
        if(!f[i]){
            for (int j = i+i; j <= 100000; j+=i)
            {
                f[j] = true;
            }
        }
    }

    for (int i = 3; i <= 100000; i+=2)
    {
        if(!f[i] && !f[(i+1)/2]) c[i]++;
    }
    for (int i = 3; i <= 100000; i++)
    {
        c[i] += c[i-1];
    }

    cin >> N;
    while (N--)
    {
        cin >> L >> R;
        cout << c[R] - c[L-1] << endl;
    }

}

Measured memory_bytes: 1152
#include<bits/stdc++.h>
#define ll long long int
#define ff first
#define ss second
#define eps 1e-9

using namespace std;

int main()
{

    ll t,n,m,f,a,b,c,l,r,q,k,x,y,z,ans,mn,mx,sum=0;
    //ios_base::sync_with_stdio(false);
    //cin.tie(NULL);
    char ch;
    cin>>ch;

    if(ch>96)
    {
        cout<<'a'<<endl;
    }
    else
    {
        cout<<'A'<<endl;
    }


}


Measured memory_bytes: 3620
#include <stdio.h>
#include <math.h>
 
int main(int argc, const char * argv[]) {
    long double x1, x2, y1, y2, pow1, pow2, distance;
    scanf("%Lf %Lf %Lf %Lf", &x1, &y1, &x2, &y2);
    pow1 = powl((x1 - x2), 2);
    pow2 = powl((y1 - y2), 2);
    distance = sqrtl(pow1 + pow2);
    printf("%5Lf\n", distance);
     
    return 0;
}



  



Measured memory_bytes: 2036
using System;

class Program{
    static void Main(string[] args){
        int n = ScanOneInt();
        int[] ar = ScanIntArray(n);
        Array.Sort(ar);
        Console.WriteLine(ar[n / 2] - ar[n / 2 - 1]);
    }


    public static int ScanOneInt()
    {
        return int.Parse(Console.ReadLine());
    }

    public static int[] ScanIntArray(int n)
    {
        string[] str = Console.ReadLine().Split(' ');
        int[] ar = new int[n];
        for (int i = 0; i < n; i++)
        {
            ar[i] = int.Parse(str[i]);
        }
        return ar;
    }

}


// string[] str = Console.ReadLine().Split(' ');

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

using namespace std;

const int N = 405;

int n, a[N];
long long g[N], f[N][N];

long long calc (int l, int r) {
    if (l == r) return f[l][r] = 0;
    if (f[l][r] < 1e18) return f[l][r];
    for (int mid = l; mid < r; mid++) f[l][r] = min(f[l][r], calc(l, mid) + calc(mid + 1, r) + g[r] - g[l - 1]);
    return f[l][r];
}

int main(){
    ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
    cin >> n;
    for (int i = 1; i <= n; i++) cin >> a[i], g[i] = g[i - 1] + a[i];
    memset(f, 0x3f, sizeof(f));
    cout << calc(1, n);
    return 0;
}


Measured memory_bytes: 1536
#include <bits/stdc++.h>
#include<cstring>
using namespace std;
int main()
{
    long long int a,b,c,k;
    cin>>a>>b>>c>>k;
    if(a>=k)
        cout<<k<<endl;
   else  if(a+b<k)
    {
        cout<<(a+(k-a-b)*(-1))<<endl;
    }
    else if(a+b>=k)
    {
        cout<<a<<endl;
    }

   return 0;
}


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

using namespace std;
#define ll long long
#define pb push_back
#define mp make_pair

int main()
{
	ios::sync_with_stdio(false);
  	cin.tie(0);
	string a,b,c;
	cin >> a >> b >> c;
	cout <<(char)(a[0]-'a'+'A') << (char)(b[0]-'a'+'A') <<(char)(c[0]-'a'+'A') << "\n";	
	return 0;
}

Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.HashMap;

class Main {
	public static void main(String args[]) throws IOException {
		BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
		Solver solver = new Solver();
		solver.init();
		solver.readHead(in.readLine());
		for (; solver.hasNext();) {
			solver.readBody(in.readLine());
		}
		solver.solve();
	}
}

class Solver {
	int N;
	int cnt;

	public void init() {
		N = 0;
		cnt = 0;
	}

	public void readHead(String str) {
		String[] strArr = str.split("\\s+");
		N = Integer.parseInt(strArr[0]);
		// System.out.println(N);
		Ana = new HashMap<String, Integer>();
		Hist = new int[26];

	}

	public boolean hasNext() {
		return cnt < N;
	}

	HashMap<String, Integer> Ana;
	int[] Hist;

	public void readBody(String str) {
		// System.out.println(str);
		for (int i = 0; i < 26; i++)
			Hist[i] = 0;
		for (int i = 0; i < 10; i++)
			Hist[str.charAt(i) - 'a']++;
		String key = "";
		for (int i = 0; i < 26; i++) {
			if (Hist[i] == 0)
				continue;
			char c = (char) ('a' + i);
			key = key + c + Hist[i];
		}
		if (!Ana.containsKey(key))
			Ana.put(key, 1);
		else
			Ana.put(key, Ana.get(key) + 1);

		cnt++;
	}

	public void solve() {
		long ans = 0;
		for (String key : Ana.keySet()) {
			// System.out.println(key + " " + Ana.get(key));
			if (Ana.get(key) < 2)
				continue;
			long n = Ana.get(key);
			ans += (n * (n - 1) / 2);
		}
		System.out.println(ans);
	}
}


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

#define ll long long int

#define pb push_back
#define mp make_pair
#define F first
#define S second
#define fast_io std::ios::sync_with_stdio(false),cin.tie(NULL),cout.tie(NULL)


#define trace(x) cout << '>' << #x << ':' << x << endl;
#define trace2(x,y) cout<< '>' << #x << ':' << x << " | " << #y << ':' << y << endl;
#define trace3(x,y,z) cout<< '>' << #x << ':' << x << " | " << #y << ':' << y <<" | " << #z << ':' << z << endl;
#define trace4(x,y,z,w) cout<< '>' << #x << ':' << x << " | " << #y << ':' << y <<" | " << #z << ':' << z << " | " << #w << ':' << w << endl;

#define REP(i,n) for(ll i=0;i<(n);i++)
#define FOR(i,a,b) for(ll i=(a);i<=(b);i++)
#define FORD(i,a,b) for(ll i=(a);i>=(b);i--)
#define all(v) (v).begin(),(v).end()


using namespace std;
///////////////////////////////////////////////////////

const int N = 1e5;

int n;
int cnt[N];

int main()
{
	fast_io;

	REP(i,N) cnt[i] = 0;

	cin>>n;
	FOR(i,1,n){
		int temp; cin>>temp;
		cnt[temp]++;
	}

	int ans = -1;

	ans = max(ans , cnt[0]+cnt[1]);
	ans = max(ans , cnt[N-1]+cnt[N-2]);

	FOR(i,1,N-2){
		ans = max(ans , cnt[i-1]+cnt[i]+cnt[i+1]);
	}

	cout<<ans<<endl;
}


Measured memory_bytes: 640
<?php
  $numberCount = fgets(STDIN);
  $numbers = explode(" ",trim(fgets(STDIN)));

  echo implode(" ",$numbers) . PHP_EOL;

  for($i = 1 ; $i < $numberCount ; $i++){
    $currentNumber = $numbers[$i];
    $insertIndex = $i;
    for($y = $i - 1 ; $y >= 0 ; $y--){
      if($currentNumber < $numbers[$y]){
        $numbers[$y + 1] = $numbers[$y];
        $insertIndex = $y;
      }else{
        break;
      }
    }
    $numbers[$insertIndex] = $currentNumber;
    echo implode(" ",$numbers) . PHP_EOL;
  }

Measured memory_bytes: 15488
#include <iostream>
#include <string>
#include <vector>

using namespace std;

int main() {
    int h, w;

    cin >> h >> w;

    vector<string> c(h);

    for (int i=0; i<h; i++) {
        cin >> c[i];
    }

    for (int i=0; i<h; i++) {
        for (int j=0; j<2; j++) {
            cout << c[i] << endl;
        }
    }

    return 0;
}


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


int main () {

    int H,W; cin >> H >> W;
    int cnt=0;

    for (int i=0; i<H; ++i) {
	string s;
	cin >> s;
	for(auto c : s) {
	    if( c == '#' ) cnt++;
	}
    }
    if( cnt == H+W-1 )
	cout << "Possible" << endl;
    else
	cout << "Impossible" << endl;
    return 0;
}


Measured memory_bytes: 384
/*
author : w2sc
  date : 2019/12/22
  time : 20:09:21
*/
#include <bits/stdc++.h>
#define ull unsigned long long
#define ll long long
using namespace std;
const int INF=0x3f3f3f3f;
const double EPS=1e-10,PI=acos(-1.);
int n,ans;
int main()
{
    cin>>n;
    vector<int> a(n);
    for(int i=0;i<n;i++)
        scanf("%d",&a[i]);
    for(int i=0;i<n;i++)
        if(a[i]==ans+1)
            ans++;
    printf("%d\n",ans?n-ans:-1);

    return 0;
}


Measured memory_bytes: 1024
#include <iostream>
#include <cmath>
#include <utility>

using namespace std;

typedef pair<int,int> pii;
typedef long long ll;
#define mp make_pair
#define x first
#define y second

int main () {
	string s;
	int k;
	cin>>k;
	cin>>s;
	if(s.length()<=k) cout<<s;
	else{
		for(int i=0;i<k;i++){
			cout<<s[i];
		}
		cout<<"...";
	}



return 0;
}

Measured memory_bytes: 3624
fun main(args: Array<String>) {
    abc091b()
}

fun abc091b() {
    val n = readLine()!!.toInt()
    val sList = (1..n).map { readLine()!! }
    val m = readLine()!!.toInt()
    val tList = (1..m).map { readLine()!! }

    val counts = sList.map { s ->
        sList.count { s == it } - tList.count { s == it }
    }

    val answer = Math.max(counts.max()!!, 0)

    println(answer)
}


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

#define debug(x) cout <<"DEBUG"<<" "<< #x << ":" << x << '\n'
#define rep(i,n) for(int_fast32_t i = 0; i < ((int_fast32_t)(n)); i++)   // 0-indexed up
#define rep1(i,n) for(int_fast32_t i = 1; i <= ((int_fast32_t)(n)); i++) // 1-indexed up
#define rrep(i,n) for(int_fast32_t i = ((int_fast32_t)(n)-1); i >= 0; i--)  // 0-indexed down
#define rrep1(i,n) for(int_fast32_t i = ((int_fast32_t)(n)); i >= 1; i--)   // 1-indexed down
#define all(x) (x).begin(),(x).end()

using namespace std;

template<typename T>
using vec = vector<T>;
using i32 = int_fast32_t;
using i64 = int_fast64_t;
using u32 = uint_fast32_t;
using u64 = uint_fast64_t;
using ll = long long;
using ld = long double;
using vi = vec<int_fast32_t>;
using vl = vec<int_fast64_t>;
using vld = vec<ld>;
using vii = vec<vi>;
using PII = pair<int_fast32_t, int_fast32_t>;

template<class T>
using maxheap = std::priority_queue<T>;
template<class T>
using minheap = std::priority_queue<T, std::vector<T>, std::greater<T>>;

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

const ld Pi = std::acos(-1.0L);
constexpr ll infll = (1LL<<62)-1;
constexpr int inf = (1<<30)-1;
const int mod = 1000000007;
// const int mod = 998244353;


/*FUNCs=================================================*/


/*MAIN==================================================*/
signed main(){
    double START_TIME = clock();
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
//    cout << fixed << setprecision(15);

    i32 n, cnt = 0, tmp; cin >> n;
    rep1(m,n) if(m&1) {
        tmp = 0;
        for(i32 i = 1; i*i <= m; ++i) {
            if(m%i == 0) {
                ++tmp;
                if(i != m/i) ++tmp;
            }
        }
        if(tmp == 8) ++cnt;
    }

    cout << cnt << '\n';

//     printf("ElapsedTime: %5.3f ms\n",1000*((clock()-START_TIME)/CLOCKS_PER_SEC));
}


Measured memory_bytes: 3664
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<cmath>
#include<functional>
#include<map>
#include<cstdlib>
#include<complex>
#include<numeric>
#include<set>
#include<deque>

using namespace std;
using Int = long long;
Int INF = 1LL << 60;
const Int MOD = 1000000000 + 7;

template<int Modulo = MOD> struct Mint {
	Int val;
	constexpr Mint(Int v = 0) noexcept : val(v% Modulo) {
		if (val < 0) v += Modulo;
	}
	constexpr int getmod() { return Modulo; }
	constexpr Mint operator - () const noexcept { return val ? Modulo - val : 0; }
	constexpr Mint operator + (const Mint& r) const noexcept { return Mint(*this) += r; }
	constexpr Mint operator - (const Mint& r) const noexcept { return Mint(*this) -= r; }
	constexpr Mint operator * (const Mint& r) const noexcept { return Mint(*this) *= r; }
	constexpr Mint operator / (const Mint& r) const noexcept { return Mint(*this) /= r; }
	constexpr Mint& operator += (const Mint& r) noexcept {
		val += r.val;
		if (val >= Modulo) val -= Modulo;
		return *this;
	}
	constexpr Mint& operator -= (const Mint& r) noexcept {
		val -= r.val;
		if (val < 0) val += Modulo;
		return *this;
	}
	constexpr Mint& operator *= (const Mint& r) noexcept {
		val = val * r.val % Modulo;
		return *this;
	}
	constexpr Mint& operator /= (const Mint& r) noexcept {
		Int a = r.val, b = Modulo, u = 1, v = 0;
		while (b) {
			Int t = a / b;
			a -= t * b; swap(a, b);
			u -= t * v; swap(u, v);
		}
		val = val * u % Modulo;
		if (val < 0) val += Modulo;
		return *this;
	}
	constexpr bool operator == (const Mint& r) const noexcept {
		return this->val == r.val;
	}
	constexpr bool operator != (const Mint& r) const noexcept {
		return this->val != r.val;
	}
	friend ostream& operator << (ostream& os, const Mint<Modulo>& x) noexcept {
		return os << x.val;
	}
	friend istream& operator >> (istream& is, Mint<Modulo>& x) noexcept {
		Int tmp; is >> tmp;
		x = Mint<Modulo>(tmp);
		return is;
	}
	friend constexpr Mint<Modulo> modpow(const Mint<Modulo>& a, Int n) noexcept {
		Mint res(1), tmp = a;
		while (n > 0) {
			if (n & 1) res *= tmp;
			tmp *= tmp;
			n >>= 1;
		}
		return res;
	}
};

using mint = Mint<>;

int main() {

	cin.tie(nullptr);
	ios::sync_with_stdio(false);

	string s;
	cin >> s;

	Int len = s.size();

	//2連続
	for (Int i = 0; i < len-1; i++) {
		if (s[i] == s[i + 1]) {
			//printf("%ld %ld\n", i + 1, i + 2);
			cout << i + 1 << " " << i + 2 << "\n";
			return 0;
		}
	}

	//1つ飛ばし
	for (Int i = 0; i < len-2; i++) {
		if (s[i] == s[i + 2]) {
			//printf("%ld %ld\n", i + 1, i + 3);
			cout << i + 1 << " " << i + 3 << "\n";
			return 0;
		}
	}

	//printf("%ld %ld\n", -1, -1);
	cout << "-1 -1" << "\n";
	return 0;
}

Measured memory_bytes: 512
N=int(input())
AB=[]
for i in range(N):
    A,B,=map(int,input().split())
    AB.append([A,B])
AB.sort(key=lambda x:x[1])
t=0
for i in range(N):
    t+=AB[i][0]
    if t>AB[i][1]:
        print("No")
        quit()
print("Yes")


Measured memory_bytes: 86360