akhauriyash/Code-Regression huggingface dataset:
import java.util.HashMap;
import java.util.Scanner;

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

		int n = sc.nextInt();
		int m = sc.nextInt();
		long[] h = new long[n];
		for (int i = 0; i < n; i++) {
			h[i] = Long.parseLong(sc.next());
		}
		int a = 0;
		int b = 0;
		HashMap<Integer, Integer> map = new HashMap<Integer, Integer>();

		for (int i = 0; i < m; i++) {
			a = Integer.parseInt(sc.next()) - 1;
			b = Integer.parseInt(sc.next()) - 1;
			if (h[a] > h[b]) {
				if (!map.containsKey(b))
					map.put(b, b);
			} else if (h[a] < h[b]) {
				if (!map.containsKey(a))
					map.put(a, a);
			} else {
				if (!map.containsKey(a))
					map.put(a, a);
				if (!map.containsKey(b))
					map.put(b, b);
			}
		}

		System.out.println(n - map.size());

	}

}


Measured memory_bytes: 54600
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
 //     String[] sn=sc.nextLine().split(" ");
//int num=Integer.parseInt(sn[0]);
//int num2=Integer.parseInt(sn[1]);



      String sn=sc.nextLine();
int num=Integer.parseInt(sn);


System.out.println(num*num*num);

//System.out.println(a/b);


	}
}

Measured memory_bytes: 20692
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Volume1_0101
{
    class Program
    {
        static void Main(string[] args)
        {
            int dataNum = int.Parse(Console.ReadLine());
            var input = new Queue<string>();

            for (int i = 0; i < dataNum; i++)
            {
                input.Enqueue(Console.ReadLine());
            }

            foreach (var item in input)
            {
                Console.WriteLine(item.Replace("Hoshino", "Hoshina"));
            }
        }
    }
}

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


int main(){
    int n, temp;
    cin >> n;
    vector<int> data(n);
    rep(i, n)cin >> data[i];

    temp = distance(data.begin(), max_element(data.begin(), data.end()));

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

    rep(i, n){
        if(temp==i){
            cout << data[1] << endl;
        }else{
            cout << data[0] << endl;
        }
    }

    return 0;
}


Measured memory_bytes: 2432
#include <bits/stdc++.h>
#include<stdlib.h>
using namespace std;
 
#define ll long long
#define ld long double
#define pb push_back
#define pr pair<ll, ll>
#define prf pair<ld,ld>
#define vct vector<ll>
#define vpt vector<pr>
#define vcf vector<ld>
#define vpf vector<prf>
#define st set<ll>
#define pq priority_queue<ll>
#define mat vector<vector<ll> >
#define all(x) x.begin(),x.end()
#define F(i, n) for(i = 0; i < (1LL*n); i++)
#define Fr(i, n) for(i = n - 1; i >= 0; i--)
 
struct custom_hash{
    static uint64_t splitmix64(uint64_t x){
        x += 0x9e3779b97f4a7c15;x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
        return x ^ (x >> 31);
    }
    size_t operator()(uint64_t x) const{
        static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
        return splitmix64(x + FIXED_RANDOM);
    }
};
#define umap unordered_map<long long, long long, custom_hash>
 
void prv(vct v){for (ll i=0;i<v.size();i++)cout<<v[i]<<" ";cout << "\n";}
void prn(ll n){cout<<n<<"\n";}
void prs(string n){cout<<n<<"\n";}
void deb(string s, ll n){cout<<s<<" : "<<n<<"\n";}
void prmt(mat m){for(ll i=0;i<(1LL*m.size());i++)prv(m[i]);}
 
mat getRzMat(ll m,ll n, ll ini=0){mat mt;mt.assign(m,vector<ll>(n,ini));return mt;}
 
ll poww(ll x, ll y, ll m){
    ll res = 1;
    while (y){
        if (y%2 == 0){x = (x * x) % m;y = y / 2;}
        else{res = (res * x) % m;y--;}
    }
    return res;
}
 
vct divsors(ll n){
    vct ans;//ans.push_back(1);
    for(ll i=1;i<=sqrt(n);i++){if(n%i==0){ans.push_back(i);if(i!=(n/i))ans.push_back(n/i);}}
    sort(ans.begin(),ans.end());
    return ans;
}
vct sieve(ll n){
    vct ans(n+1,-1);
    for(ll i=2;i<=n;i++){
        if(ans[i]==-1){
            for(ll j=i;j<=n;j+=i)if(ans[j]==-1)ans[j]=i;
        }
    }
    return ans;
}
mat mt;
ll n, k, m, l, r, x, y, z, ans=0;
ll t, t1, t2;
ll q;
ll i, j;
ll a, b, c, d, w;
ll mod = 1000000007;
ld epi = 0.00000001;
ll cas=0;
ll cnt=0;

void dfs(ll nd, vct &vis, vector<st> &g){
    cnt++;
    vis[nd]=1;
    for(auto it:g[nd])if(!vis[it])dfs(it,vis,g);
}
void solve(){

    cin>>n>>m;
    vector<st>g(n+1);
    F(i,m){
        cin>>t1>>t2;
        g[t1].insert(t2);
        g[t2].insert(t1);
    }
    ans=0;
    vct vis(n+1,0);
    for(i=1;i<=n;i++){
        if(!vis[i]){
            cnt=0;
            dfs(i,vis,g);
            ans=max(ans,cnt);
        }
    }
    prn(ans);

}
int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    // cout<<fixed<<setprecision(10);
    // freopen("input.txt", "r", stdin); 
    // freopen("output.txt", "w", stdout);
    ll t = 1;
    // cin >> t;
    cas=1;
    while (t--){
        solve();
        cas++;
    }
    return 0;
}
 


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

int main()
{
    int A, B;
    cin >> A >> B;

    if (A >= 13)
    {
        cout << B;
    }
    else if (A >= 6)
    {
        cout << B / 2;
    }
    else
    {
        cout << 0;
    }
    return 0;
}


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

#define endl '\n'
#define int long long

const int N = 110, W = 1e5+9;
int cache[N][W], items[N][2], n, w;

int dp(int id, int wt) {
	if(wt < 0)
		return -1e15;
	if(id == n+1 or wt == 0)
		return 0;
	int &ans = cache[id][wt];
	if(ans != -1) 
		return ans;
	ans = max(dp(id + 1, wt), items[id][1] + dp(id+1, wt - items[id][0]));
	return ans;
}

int32_t main()
{
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);

	memset(cache, -1, sizeof cache);
	cin >> n >> w;
	for(int i = 1; i <= n; i ++) {
		for(int j = 0; j < 2; j ++) {
			cin >> items[i][j];
		}
	}
	cout << dp(1,w) << endl;

	return 0;
}

Measured memory_bytes: 89588
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;

namespace MyProject
{
    class Program
    {
        static void Main(string[] args)
        {
#if Local
            var sw = new Stopwatch();
            sw.Start();
            Console.SetIn(new StreamReader("input.in"));
#endif

            var solver = new Solver();
            solver.Solve();
#if Local
            Console.WriteLine($"{sw.ElapsedMilliseconds}ms");
#endif
        }
    }

    class Solver
    {
        public void Solve()
        {
            var item = Console.ReadLine().Split();
            Console.WriteLine(item[1] + item[0]);
        }
    }
}


Measured memory_bytes: 11092
#include <iostream>
#include <string>
#include <algorithm>
#include <map>
#include <cmath>
#include <numeric>
#include <vector>
#include <bitset>
#include <queue>
using namespace std;

int main(){
    int N;
    cin >> N;
    string s[N];
    int minaz[26];
    int tmpaz[26];
    for(int i = 0; i < 26; i++){
        minaz[i] = 100;
        tmpaz[i] = 0;
    }
    for(int i = 0; i < N; i++){
        cin >> s[i];
    }
    for(int i = 0; i < N; i++){

        for(int j = 0; j < s[i].length(); j++){
            int tmpint = s[i][j] - 'a';
            tmpaz[tmpint]++;
        }
        for(int j = 0; j < 26; j++){
            minaz[j] = min(minaz[j], tmpaz[j]);
            tmpaz[j] = 0;
        }
    }
    for(int i = 0; i < 26; i++){
        if(minaz[i] > 90){
            continue;
        }
        for(int j = 0; j < minaz[i]; j++){
            char tmp = 'a' + i;
            cout << tmp;
        }
    }
    cout << endl;

    return 0;
}

Measured memory_bytes: 256
N = int(input())
a=[int(i) for i in input().split()]

sum_a=sum(a)
ans = 10**11
x=0
for i in range(N-1):
    x += a[i]
    diff = abs(sum_a - 2 * x)
    if diff<ans:
        ans=diff


print(ans)


Measured memory_bytes: 31296
n = int(input())
d,x = map(int,input().split())
a = [int(input()) for i in range(n)]
ans = 0
count = 0
for i in range(n):
    if a[i] >= d:
        count += 1
    elif a[i] == 1:
        a[i] = d // a[i]
        ans += a[i]
    else:
        a[i] = (d-1) // a[i] + 1
        ans += a[i]
print(ans+x+count)

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

int main()
{
	long long n,b,j=0;
	cin>>n;
	long long i=n;
	char a[50]={0};
	do
	{
		b=i%26;
		i/=26;
		a[j]=b+96;
		if(a[j]==96)
		{
			a[j]=122;
			i--;
		}
		j++;
	}while(i!=0);
	for(int c=j-1;c>=0;c--)
	{
		cout<<a[c];
	}
	return 0;
}

Measured memory_bytes: 3624
#include<stdio.h>

#define N 10000

int linear(int *,int,int);

int main(){
  int pre,nex,i,cnt=0;
  int a[N],b[N];

  scanf("%d",&pre);
  for(i=0;i<pre;i++) scanf("%d",&a[i]);

  scanf("%d",&nex);
  for(i=0;i<nex;i++){
    scanf("%d",&b[i]);
    cnt += linear(a,b[i],pre);
  }

  printf("%d\n",cnt);

  return 0;
}

int linear(int *a,int b,int roop){
  int p=0,i;

  for(i=0;i<roop;i++){
    if(a[i]==b){
      p++;
      break;
    }
  }

  return p;
}

Measured memory_bytes: 644
#include <iostream>
#include <algorithm>
#include <iomanip>
#include <queue>
using namespace std;
#define INF 1000000007
#define ll long long
#define rep(i, start, end) for(ll i=(ll)start; i<(ll)end; i++)
#define print(a) cout << a << endl;
#define printarray(a, len) rep(i,0,len) cout << a[i] << " ";
 
int main(){
  char s[5];
  cin >> s;
  sort(s, s+4);
  if (s[0] == s[1] && s[2] == s[3] && s[0] != s[2]){
    print("Yes");
  }else print("No");
  
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define All(V) V.begin(), V.end()
typedef long long int ll;
typedef pair<int, int> P;
const ll MOD = 1e9+7, INF = 1e9;

int main() 
{
  char a; cin >> a;
  if(a == 'a' || a == 'i' || a == 'u'|| a == 'e' || a == 'o')
    cout << "vowel" << endl;
  else cout << "consonant" << endl;
  system("pause");
}

Measured memory_bytes: 504
#include<bits/stdc++.h>
#define ll long long
using namespace std;
stack<int>st;
vector<ll>adj[10010],Radj[10010];
int vis[10010],vis2[10010],mk[10010];
void cl()
{
    int i;
    for(i=0;i<=10000;i++)
    {
        adj[i].clear();
        Radj[i].clear();
        vis[i]=0; vis2[i]=0; mk[i]=-1;
    }
}
void dfs(int s)
{
    int i,u;
    vis[s]=1;
    for(i=0;i<adj[s].size();i++)
    {
        u=adj[s][i];
        if(vis[u]==0)
        {
            dfs(u);
        }
    }
    st.push(s);
}
void dfs2(int s,int mark)
{
    int i,u;
    vis2[s]=1; mk[s]=mark;
    for(i=0;i<Radj[s].size();i++)
    {
        u=Radj[s][i];
        if(vis2[u]==0)
        {
            dfs2(u,mark);
        }
    }
}
int main()
{
    int n,m,i,j,a,b,u,mark,q; cl();
    cin>>n>>m;
    for(i=1;i<=m;i++)
    {
        cin>>a>>b;
        adj[a].push_back(b);
        Radj[b].push_back(a);
    }

    for(i=0;i<n;i++)
    {
        if(vis[i]==0)
        {
            dfs(i);
        }
    }
    mark=0;
    while(!st.empty())
    {
        u=st.top(); st.pop();
        if(vis2[u]==0)
        {
            ++mark;
            dfs2(u,mark);
        }
    }
    cin>>q;
    for(i=1;i<=q;i++)
    {
        cin>>a>>b;
        if(mk[a]==mk[b])
        {
            printf("1\n");
        }
        else
            printf("0\n");
    }
}



Measured memory_bytes: 4648
#include <iostream>
#include <cmath>
#include <vector>
#include <algorithm>
#include <set>
#include <map>
#include <unordered_map>

using namespace std;

#define all(x) (x).begin(),(x).end()
#define ll long long
#define pii pair<int,int>
#define y1 Emilia
#define N 400400
#define dracarys ios_base :: sync_with_stdio(0);cin.tie(0);cout.tie(0);

ll n, a, b;
int main() {
    dracarys
    cin >> n >> a >> b;
    
    if (a % 2 == b % 2) {
        cout << (b - a) / 2 << "\n";
        return 0;
    }
    ll left = a - 1 + (b - a + 1) / 2;
    ll right = n - b + (b - a + 1) / 2;
    
    cout << min(left, right) << "\n";
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
typedef pair<P,P> PP;
const ll MOD = 1000000007;
const int IINF = INT_MAX;
const ll LLINF = LLONG_MAX;
const int MAX_N = int(2e5 + 5);
const double EPS = 1e-10;
const int di[] = {0, 1, 0, -1}, dj[] = {1, 0, -1, 0};
#define REP(i, n) for (int i = 0; i < n; i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define SORT(v) sort((v).begin(), (v).end())
#define ALL(v) (v).begin(), (v).end()

int w, h, a[1005][1005], dp[1005][1005];

int rec(bool turn, int i, int j){
    if(i==h && j==w) return 0;
    if(dp[i][j] != -IINF) return dp[i][j];

    int res = IINF*(turn?-1:1);
    if(i<h){
        int tmp = rec(!turn, i+1, j), sum = a[i+1][w] - a[i+1][j] - a[i][w] + a[i][j];
        if(turn) res = max(res, tmp+sum);
        else res = min(res, tmp+sum);
    }
    if(j<w){
        int tmp = rec(!turn, i, j+1), sum = a[h][j+1] - a[h][j] - a[i][j+1] + a[i][j];
        if(turn) res = max(res, tmp-sum);
        else res = min(res, tmp-sum);
    }
    return dp[i][j] = res;
}


int main() {
    cin >> w >> h;
    REP(i,h)REP(j,w) cin >> a[i+1][j+1];
    REP(i,h){
        REP(j,w){
            a[i+1][j+1] += a[i+1][j] + a[i][j+1] - a[i][j];
        }
    }
    
    REP(i,h+1) fill(dp[i],dp[i]+w+1,-IINF);
    cout << abs(rec(true,0,0)) << endl;
    return 0;
}



Measured memory_bytes: 11136
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i=0; i<(int)n; i++)
#define REPR(i, n) for(int i=(int)n-1; i>=0; i--)
#define FOR(i, m, n) for(int i=(int)m; i<(int)n; i++)
#define FORR(i, m, n) for(int i=(int)m-1; i>=(int)n; i--)
#define ASC(v) sort(v.begin(), v.end());
#define DESC(v) sort(v.begin(), v.end(), greater<int>());
#define REVERSE(v) reverse(v.begin(), v.end());
#define DEBUG(x) cout<<#x<<": "<<x<<"\n"
typedef long long ll;
struct nya{ nya(){ cin.tie(0); ios::sync_with_stdio(false); } }nyan;

int main() {
	ll N, M;
	cin >> N >> M;
	vector<ll> s(M), c(M);
	REP(i, M) cin >> s[i] >> c[i];
	REP(n, N*1000) {
		bool can = true;
		string ns = to_string(n);
		if (ns.length() != N) can = false;
		REP(i, M) {
			string cs = to_string(c[i]);
			if (ns[s[i]-1] != cs[0]) can = false;
		}
		if (can) {
			cout << n << "\n";
			return 0;
		}
	}
	cout << -1 << "\n";
}


Measured memory_bytes: 256
//organize and stay in moment - Abhinav IIIT-A
#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
#define MAXN (int)2e5+5
#define pb push_back
int mod= 1e9+7;
int mod2=998244353;
int arr[MAXN];
int as;
void input(){
  cin>>as;
  f(i,0,as) cin>>arr[i];
}
int nc2(int n){
	if(n<2)
	return 0;
	int p=n-1;
	if(n&1)
		p/=2;
	else n/=2;
	p*=n;
	return p;
}
void solve(){
	int n,m; cin>>n>>m;
	cout<<nc2(n)+nc2(m)<<"\n";
}
int32_t main()
{
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int t; t=1; //cin>>t;
  while(t--) solve();
  return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <sstream>
#include <stack>
#include <string>
#include <unordered_set>
#include <vector>

using namespace std;

#define ll long long
#define P pair<int, int>
#define FOR(i, N) for (int i = 0; i < (int)N; i++)
#define FORIN(i, a, b) for (int i = a; i < (int)b; i++)
#define ALL(x) (x).begin(), (x).end()
#define GI(name) \
  int(name);     \
  scanf("%d", &(name))
#define GI2(name1, name2) \
  int(name1), (name2);    \
  scanf("%d %d", &(name1), &(name2))
#define GI3(name1, name2, name3) \
  int(name1), (name2), (name3);  \
  scanf("%d %d %d", &(name1), &(name2), &(name3))
#define GVI(name, size)    \
  vector<int>(name)(size); \
  FOR(i, (size)) scanf("%d", &(name)[i])
#define GS(name) \
  string(name);  \
  cin >> (name);
#define MOD 1000000007
#define DEBUG(...) debug(__LINE__, ":" __VA_ARGS__)

string to_string(string s) {
  return s;
}

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

void debug() {
  cerr << endl;
}

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

void print() {
  cout << endl;
}

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

int main() {
  GI(N);
  vector<P> list(N);
  FOR(i, N) {
    GI2(A, B);
    list[i] = P(A, B);
  }
  sort(ALL(list), [](const P& l, const P& r) {
    return l.second != r.second ? l.second < r.second : l.first < r.first;
  });
  ll sum = 0;
  FOR(i, N) {
    sum += list[i].first;
    if (sum > list[i].second) {
      print("No");
      return 0;
    }
  }
  print("Yes");
  return 0;
}

Measured memory_bytes: 1792
#float型を許すな
#numpyはpythonで
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)
from collections import Counter, deque
from collections import defaultdict
from itertools import combinations, permutations, accumulate, groupby, product
from bisect import bisect_left,bisect_right
from heapq import heapify, heappop, heappush
from math import floor, ceil,pi,factorial
from operator import itemgetter
def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))
def LI2(): return [int(input()) for i in range(n)]
def MXI(): return [[LI()]for i in range(n)]
def SI(): return input().rstrip()
def printns(x): print('\n'.join(x))
def printni(x): print('\n'.join(list(map(str,x))))
inf = 10**17
mod = 10**9 + 7
n=I()
lis=LI()
zoro=[[0]*20 for i in range(n)]
for i in range(n):
    for j in range(20):
        if (lis[i]>>j) %2==1:
            zoro[i][j]=1
left=0
right=0
table=[0 for i in range(20)]
count=0
while right<n:
    #print(left,right)
    flag=True
    for i in range(20):
        table[i]+=zoro[right][i]
        if table[i]>1:
            flag=False
    if flag==False:
        for i in range(20):
            table[i]-=zoro[left][i]
            table[i]-=zoro[right][i]
        left+=1
    elif flag==True:
        #print(left,right,right-left+1)
        count+=right-left+1
        right+=1
    
print(count)
            
    
        
        
    


    

Measured memory_bytes: 132148
#include <iostream>
#include <string>

int main() {

	std::string N;

	std::cin >> N;

	if (size(N) == 3) {
		switch (N[2]) {
		case '0':
			std::cout << "pon" << std::endl;
			break;
		case '1':
			std::cout << "pon" << std::endl;
			break;
		case '2':
			std::cout << "hon" << std::endl;
			break;
		case '3':
			std::cout << "bon" << std::endl;
			break;
		case '4':
			std::cout << "hon" << std::endl;
			break;
		case '5':
			std::cout << "hon" << std::endl;
			break;
		case '6':
			std::cout << "pon" << std::endl;
			break;
		case '7':
			std::cout << "hon" << std::endl;
			break;
		case '8':
			std::cout << "pon" << std::endl;
			break;
		case '9':
			std::cout << "hon" << std::endl;
			break;
		}
	}
	else if (size(N) == 2) {
		switch (N[1]) {
		case '0':
			std::cout << "pon" << std::endl;
			break;
		case '1':
			std::cout << "pon" << std::endl;
			break;
		case '2':
			std::cout << "hon" << std::endl;
			break;
		case '3':
			std::cout << "bon" << std::endl;
			break;
		case '4':
			std::cout << "hon" << std::endl;
			break;
		case '5':
			std::cout << "hon" << std::endl;
			break;
		case '6':
			std::cout << "pon" << std::endl;
			break;
		case '7':
			std::cout << "hon" << std::endl;
			break;
		case '8':
			std::cout << "pon" << std::endl;
			break;
		case '9':
			std::cout << "hon" << std::endl;
			break;
		}
	}
	else {
		switch (N[0]) {
		case '0':
			std::cout << "pon" << std::endl;
			break;
		case '1':
			std::cout << "pon" << std::endl;
			break;
		case '2':
			std::cout << "hon" << std::endl;
			break;
		case '3':
			std::cout << "bon" << std::endl;
			break;
		case '4':
			std::cout << "hon" << std::endl;
			break;
		case '5':
			std::cout << "hon" << std::endl;
			break;
		case '6':
			std::cout << "pon" << std::endl;
			break;
		case '7':
			std::cout << "hon" << std::endl;
			break;
		case '8':
			std::cout << "pon" << std::endl;
			break;
		case '9':
			std::cout << "hon" << std::endl;
			break;
		}

	}
}

Measured memory_bytes: 3620
x, n = map(int, input().split())
p = list(map(int, input().split()))
q = []
cnt = 1000
ans = 0

for i in range(0,102):
    if not i in p:
        q.append(i)
        
for i in q:
    if cnt > abs(x-i):
        ans = i
        cnt = abs(x-i)
print(ans)

Measured memory_bytes: 9188
from collections import deque

S = deque(map(str, input().split()))
Q = int(input())
Left = True

for i in range(Q):
    TFC = input()

    if TFC[0] == "1":
        Left = not Left

    else:
        _, f, c = TFC[0], TFC[2], TFC[4]
        f = int(f)
        if Left and (f == 1):
            S.appendleft(c)
        elif Left and (f == 2):
            S.append(c)
        elif (not Left) and (f == 1):
            S.append(c)
        else:
            S.appendleft(c)

T = "".join(S)
if not Left:
    T = T[::-1]

print(T)

Measured memory_bytes: 6900
#include <bits/stdc++.h>
#define ALL(x) begin(x),end(x)
using namespace std;
typedef long long ll;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n;
    cin >> n;
    pair<int,int> arr[n];
    for(int i = 0; i< n; i++)
    {
        cin >> arr[i].first;
        arr[i].second = i+1;
    }
    sort(arr, arr+n);
    for(int i = 0; i< n; i++)
        cout << arr[i].second << " ";
    return 0;
}





Measured memory_bytes: 1664
a,b,c=map(int,input().split())
if a<b:
    if b<c:
        print('{} {} {}'.format(a,b,c))
    if b>c:
        if a>c:
            print('{} {} {}'.format(c,a,b))
        else:
            print('{} {} {}'.format(a,c,b))
if a>b:
    if a<c:
        print('{} {} {}'.format(b,a,c))
    if a>c:
        if b>c:
            print('{} {} {}'.format(c,b,a))
        else:
            print('{} {} {}'.format(b,c,a))



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


int main() {
	
	int N, d, x, sum = 0;
	cin >> N >> d >> x;
	vector<int> a(N);
	for(auto &i:a) cin >> i;
	for(int i=0; i<N; i++){
		for(int j=0; j*a.at(i)+1<=d; j++){
			sum++;
		}
	}
	cout << sum + x << endl;
	
	return 0;
}

Measured memory_bytes: 256
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.PriorityQueue;
import java.util.Scanner;
import java.util.Comparator;
import java.util.Collections;
import java.util.ArrayList;

/**
 * Built using CHelper plug-in Actual solution is at the top
 *
 * @author Silviase
 */
public class Main {

  public static void main(String[] args) {
    InputStream inputStream = System.in;
    OutputStream outputStream = System.out;
    Scanner in = new Scanner(inputStream);
    PrintWriter out = new PrintWriter(outputStream);
    DSummerVacation solver = new DSummerVacation();
    solver.solve(1, in, out);
    out.close();
  }

  static class DSummerVacation {

    public void solve(int testNumber, Scanner in, PrintWriter out) {
      int n = in.nextInt();
      int m = in.nextInt();
      int index = 0;
      int res = 0;
      ArrayList<Pair> alp = new ArrayList<>();
      for (int i = 0; i < n; i++) {
        alp.add(new Pair(in.nextInt(), in.nextInt()));
      }
      Collections.sort(alp, (x, y) -> x.compareTo(y, 1, 1));
      PriorityQueue<Integer> pqp = new PriorityQueue<>(Comparator.reverseOrder());
      for (int i = 1; i <= m; i++) {
        while (true) {
          if (index == n) {
            break;
          }
          if (alp.get(index).o1 <= i) {
            pqp.add(alp.get(index).o2);
            index++;
          } else {
            break;
          }
        }
        if (pqp.size() > 0) {
          res += pqp.poll();
        }
      }
      out.println(res);

    }

  }

  static class Pair {

    int o1;
    int o2;

    public Pair(int x, int y) {
      this.o1 = x;
      this.o2 = y;
    }

    public String toString() {
      return "(" + this.o1 + ", " + this.o2 + ")";
    }

    int compareTo(Pair p, int op1, int op2) {
      // 1: NaturalOrder, -1: Reverse Order
      if (this.o1 > p.o1) {
        return op1;
      }
      if (this.o1 < p.o1) {
        return -op1;
      }
      if (this.o2 > p.o2) {
        return op2;
      }
      if (this.o2 < p.o2) {
        return -op2;
      }
      return 0;
    }

  }
}



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

#define int         long long
#define pb          push_back
#define pii         pair<int,int>
#define vi          vector<int>
#define vii         vector<pii>
#define mi          map<int,int>
#define mii         map<pii,int>
#define all(a)      (a).begin(),(a).end()
#define x           first
#define y           second
#define sz(x)       (int)x.size()
#define endl        '\n'
#define hell        1000000007
#define rep(i,a,b)  for(int i=a;i<b;i++)
using namespace std;

void solve(){
   int a[5],b,c=0,d,e,k,n;
   cin>>n>>b>>c;
   cout<<(c/n)*b;


}

signed main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int t=1;
    // cin>>t;
    while(t--){
        solve();
    }
    return 0;
}


Measured memory_bytes: 764
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ABC125D
{
    class Program
    {
        static void Main(string[] args)
        {
            int n = int.Parse(Console.ReadLine());
            int[] A = Array.ConvertAll(Console.ReadLine().Split(' '), int.Parse);
            long ans = 0;
            bool check_Zero = false;
            int count_Minus = 0;
            int min = (int)Math.Pow(10, 9);
            for (int i = 0; i < n; i++)
            {
                if (A[i] == 0)
                {
                    check_Zero = true;//ゼロがあるか
                }
                ans += Math.Abs(A[i]);
                if (A[i]<0)
                {
                    count_Minus++;
                }
                min = Math.Min(min, Math.Abs(A[i]));
            }
            if (count_Minus % 2 == 0 || check_Zero == true)//負の数が偶数個、またはゼロがある
            {
                Console.WriteLine(ans);
            }
            else
            {
                Console.WriteLine(ans-2*min);
            }
        }
    }
}


Measured memory_bytes: 29276
n = int(input())

li1 = []
for _ in range(n):
    s = list(input())
    li1.append(sorted(s))

cnt = 0
li2 = sorted(li1)
li3 = []
for i in range(1, len(li2)):
    if li2[i] == li2[i-1]:
        cnt += 1
    else:
        li3.append(cnt)
        cnt = 0
    if i == len(li2)-1:
        li3.append(cnt)

cnt1 = 0
for i in li3:
    cnt1 += (i*(i+1))//2
    
print(cnt1)

Measured memory_bytes: 26052
#include <bits/stdc++.h>
using namespace std;
#define sd(x) scanf("%d", &x)
#define sz(v) (int) v.size()
#define pr(v) For(i, 0, sz(v)) {cout<<v[i]<<" ";} cout<<endl;
#define slld(x) scanf("%lld", &x)
#define all(x) x.begin(), x.end()
#define For(i, st, en) for(ll i=st; i<en; i++)
#define tr(x) for(auto it=x.begin(); it!=x.end(); it++)
#define fast std::ios::sync_with_stdio(false);cin.tie(NULL);
#define pb push_back
#define ll long long
#define int long long
#define mp make_pair
#define F first
#define S second
typedef pair<int, int> pii;
typedef vector<int> vi;
#define MOD 1000000007
#define INF 1000000000000000007LL

const int N = 100005;
 
// it's swapnil07 ;)
 
#ifdef SWAPNIL07
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
    cout << name << " : " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
    const char* comma = strchr(names + 1, ',');cout.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
int begtime = clock();
#define end_routine() cout << "\n\nTime elapsed: " << (clock() - begtime)*1000/CLOCKS_PER_SEC << " ms\n\n";
#else
#define endl '\n'
#define trace(...)
#define end_routine()
#endif

int dp[2005][2005];

signed main()
{
    fast
    #ifdef SWAPNIL07
        freopen("input.txt","r",stdin);
        freopen("output.txt","w",stdout);
    #endif
    int n, x; cin>>n>>x;
    int a[n];
    int ans = INF;
    for(int i=0; i<n; i++){
        cin>>a[i];
        dp[i][0]=a[i];
    }
    for(int i=0; i<n; i++){
        for(int j=1; j<n; j++){
            dp[i][j]=min(dp[i][j-1], a[(i+j)%n]);
        }
    }
    for(int i=0; i<n; i++){
        int val = 0;
        for(int j=0; j<n; j++){
            val += dp[j][i];
        }
        val += x*i;
        ans = min(ans, val);
    }
    cout<<ans;
    return 0;
}





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

int main()
{
	int n, minv=1000000000;
	cin >> n;
	int a[n+1];
	
	for(int i=1; i<=n; i++)
		cin >> a[i];
		
	int f=0, t=0;
	
	for(int i=1; i<=n; i++)
	{
		f=0;
		t=0;
		for(int j=1; j<=i; j++)
			f+=a[j];
		for(int d=i+1; d<=n; d++)
			t+=a[d];
		
		if(fabs(f-t)<minv)
			minv=fabs(f-t);
	 }
	cout << minv << endl;
	return 0; 
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int n,m;
int p[100005];
int find(int x){
	if(x!=p[x])p[x]=find(p[x]);
	return p[x];
}
int main(){
	cin>>n>>m;
	for(int i=1;i<=n;++i)p[i]=i;
	int a,b,c,f_a,f_b,ans=0;
	while(m--){
		cin>>a>>b>>c;
		f_a=find(a);
		f_b=find(b);
		if(f_a!=f_b)p[f_a]=f_b;
	}
	for(int i=1;i<=100005;i++)
	if(i==p[i])ans++;
	cout<<ans;
	return 0;
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
#define rep(i, m, n) for (int i = m; i < n; ++i)
#define rem(i, m, n) for (int i = m; i >= n; --i)

int main() {
  int N, M;
  cin >> N >> M;
  vector<int> cnt(N, 1);
  vector<bool> red(N);
  red[0] = true;
  rep(i, 0, M) {
    int x, y;
    cin >> x >> y;
    x--, y--;
    cnt[x]--, cnt[y]++;
    if(red[x]) red[y] = true;
    if(cnt[x] == 0) red[x] = false;
  }
  int ans = 0;
  rep(i, 0, N) if(red[i]) ans++;
  cout << ans << endl;
  return 0;
}


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

int main(){
	int N;
	cin >> N;
	vector<int> A(N),B(N);
	for(auto &i:A)cin >> i;
	for(auto &i:B)cin >> i;
	for(auto &i:A)i--;
	for(auto &i:B)i--;
	
	vector<int> Acount(N,0),Bcount(N,0);
	for(auto &i:A)Acount[i]++;
	for(auto &i:B)Bcount[i]++;
	
	int maxsum=0,maxi;
	for(int i=0;i<N;i++){
		if(maxsum<Acount[i]+Bcount[i]){
			maxsum=Acount[i]+Bcount[i];
			maxi=i;
		}
	}
	if(maxsum>N){
		cout << "No" << endl;
		return 0;
	}
	
	cout << "Yes" << endl;
	int diff=-N;
	for(int i=0;i<N;i++){
		if(Acount[i]+Bcount[i]==0)continue;
		
		int Apos=(int)(lower_bound(A.begin(),A.end(),i)-A.begin());
		int Bpos=(int)(lower_bound(B.begin(),B.end(),i)-B.begin());
		
		diff=max(diff,Apos-Bpos+Acount[i]);
	}
	
	for(int i=0;i<N;i++)printf("%d%c",B[(i-diff+N)%N]+1,((i==N-1)?('\n'):(' ')));
	return 0;
}

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

int N;

int DigitSum(int M) {
  int ret = 0;
  while (1) {
    if (M == 0)
      break;
    ret += M % 10;
    M /= 10;
  }
  return ret;
}

int main(int argc, char *argv[]) {
  cin >> N;
  int ans = 1000;
  for (int i = 1; i <= N / 2; i++)
    ans = min(ans, DigitSum(i) + DigitSum(N - i));
  cout << ans << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cstring>
#include<string>
#include<vector>
#include<cmath>
#include<algorithm>
#include<map>
#include<queue>
#include<deque>
#include<iomanip>
#include<tuple>
#include<cassert>
using namespace std;
typedef long long int LL;
typedef pair<int,int> P;
typedef pair<LL,int> LP;
const int INF=1<<30;
const LL MAX=1e9+7;

void array_show(int *array,int array_n,char middle=' '){
	for(int i=0;i<array_n;i++)printf("%d%c",array[i],(i!=array_n-1?middle:'\n'));
}
void array_show(LL *array,int array_n,char middle=' '){
	for(int i=0;i<array_n;i++)printf("%lld%c",array[i],(i!=array_n-1?middle:'\n'));
}
void array_show(vector<int> &vec_s,int vec_n=-1,char middle=' '){
	if(vec_n==-1)vec_n=vec_s.size();
	for(int i=0;i<vec_n;i++)printf("%d%c",vec_s[i],(i!=vec_n-1?middle:'\n'));
}
void array_show(vector<LL> &vec_s,int vec_n=-1,char middle=' '){
	if(vec_n==-1)vec_n=vec_s.size();
	for(int i=0;i<vec_n;i++)printf("%lld%c",vec_s[i],(i!=vec_n-1?middle:'\n'));
}

vector<vector<int>> v1[15];
vector<vector<int>> vs;

int main(){
	int n,m;
	int i,j,k;
	int a,b,c;
	a=0;
	string sa;
	cin>>n;
	cin>>sa;
	v1[0].push_back(vector<int>());
	for(i=0;i<sa.size();i++){
		if(sa[i]=='R')a++;
		else if(i+1<sa.size() && sa[i+1]=='S')i++;
		else{
			v1[0][0].push_back(a);
			a=0;
		}
	}
	v1[0][0].push_back(a);
	vs.push_back(vector<int>(1,0));

	for(i=0;i<n;i++){
		c=pow(3,i);
		vs.push_back(vector<int>());
		for(j=0;j<v1[i].size();j++){
			for(k=0;k<3;k++){
				v1[i+1].push_back(vector<int>());
				a=k;
				int cnt=0;
				for(auto node:v1[i][j]){
					if(cnt && a>0)a=3-a;
					a+=node,cnt++;
					b=a/3;a%=3;
					if(b==0 && !v1[i+1].back().empty() && v1[i+1].back().back()==0 && cnt!=v1[i][j].size()){
						v1[i+1].back().pop_back();
					}else v1[i+1].back().push_back(b);
				}
				vs[i+1].push_back(vs[i][j]+c*a);
			}
		}
	}


	c=pow(3,n);
	vector<int> v2(c,-1);
	vector<int> vt(n,0);
	for(i=0;i<c;i++){
		a=0;
		for(j=0;j<n;j++){
			if(vt[j]>=3)vt[j]-=3,vt[j+1]++;
			a*=3;
			a+=vt[j];
		}
		v2[a]=vs[n][i];
		vt[0]++;
	}
	array_show(v2);
	
}

Measured memory_bytes: 73884
#include <map>
#include <iostream>
#include <vector>
using namespace std;

template<long long mod>
class modint{
private:
  long long a;
public:
  constexpr modint(const long long x = 0) noexcept : a(x%mod) {}
  constexpr long long& value() noexcept { return a; }
  constexpr const long long& value() const noexcept { return a; }
  constexpr modint operator+(const modint rhs) const noexcept {
    return modint(*this) += rhs;
  }
  constexpr modint operator-(const modint rhs) const noexcept {
    return modint(*this) -= rhs;
  }
  constexpr modint operator*(const modint rhs) const noexcept {
    return modint(*this) *= rhs;
  }
  constexpr modint operator/(const modint rhs) const noexcept {
    return modint(*this) /= rhs;
  }
  constexpr modint& operator+=(const modint rhs) noexcept {
    a += rhs.a;
    if(a >= mod) a -= mod;
    return *this;
  }
  constexpr modint &operator-=(const modint rhs) noexcept {
    if(a < rhs.a) a += mod;
    a -= rhs.a;
    return *this;
  }
  constexpr modint& operator*=(const modint rhs) noexcept {
    a = a*rhs.a%mod;
    return *this;
  }
  constexpr modint& operator/=(modint rhs) noexcept {
    long long k = mod-2;
    while(k > 0){
      if(k&1){
        *this *= rhs;
      }
      rhs *= rhs;
      k /= 2;
    }
    return *this;
  }
  friend ostream& operator<<(ostream &os, const modint &X){
    return os << X.a;
  }
  friend istream& operator>>(istream &is, modint &X){
    is >> X.a;
    X.a %= mod;
    if(X.a < 0) X.a += mod;
    return is;
  }
};

using mint = modint<(int)1e9+7>;

mint dfs(long long N, map<long long,mint> &dp){
  if(dp.find(N) != dp.end()) return dp[N];
  if(!N) return 1;
  if(N < 0) return 0;
  if(N%2) return dp[N] = dfs(N/2,dp)*2 + dfs(N/2-1,dp);
  return dp[N] = dfs(N/2,dp) + dfs(N/2-1,dp)*2;
}

int main(){
  long long N;
  cin >> N;
  map<long long,mint> dp;
  cout << dfs(N,dp) << endl;
}


Measured memory_bytes: 256
//master
import java.io.*;
import java.util.*;
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int m = sc.nextInt();
        long sum = 0;
        for(int i = 0; i<m; i++) sum += sc.nextLong();
        p(Math.max(-1, n-sum));
    }
    public static <T> void p(T message) {
        System.out.println(message);
    }

    public static <T> void pe(T message) {
        System.err.println(message);
    }

    public static <T> void pp(T message) {
        System.out.print(message);
    }
}
class FastScanner {
    private final InputStream in = System.in;
    private final byte[] buffer = new byte[1024];
    private int ptr = 0;
    private int buflen = 0;
    private boolean hasNextByte() {
        if (ptr < buflen) {
            return true;
        } else {
            ptr = 0;
            try {
                buflen = in.read(buffer);
            } catch (IOException e) {
                e.printStackTrace();
            }
            if (buflen <= 0) {
                return false;
            }
        }
        return true;
    }
 
    private int readByte() {
        if (hasNextByte())
            return buffer[ptr++];
        else
            return -1;
    }
 
    private boolean isPrintableChar(int c) {
        return 33 <= c && c <= 126;
    }
 
    public boolean hasNext() {
        while (hasNextByte() && !isPrintableChar(buffer[ptr]))
            ptr++;
        return hasNextByte();
    }
 
    public String next() {
        if (!hasNext())
            throw new NoSuchElementException();
        StringBuilder sb = new StringBuilder();
        int b = readByte();
        while (isPrintableChar(b)) {
            sb.appendCodePoint(b);
            b = readByte();
        }
        return sb.toString();
    }
 
    public long nextLong() {
        if (!hasNext())
            throw new NoSuchElementException();
        long n = 0;
        boolean minus = false;
        int b = readByte();
        if (b == '-') {
            minus = true;
            b = readByte();
        }
        if (b < '0' || '9' < b) {
            throw new NumberFormatException();
        }
        while (true) {
            if ('0' <= b && b <= '9') {
                n *= 10;
                n += b - '0';
            } else if (b == -1 || !isPrintableChar(b)) {
                return minus ? -n : n;
            } else {
                throw new NumberFormatException();
            }
            b = readByte();
        }
    }
 
    public int nextInt() {
        long nl = nextLong();
        if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE)
            throw new NumberFormatException();
        return (int) nl;
    }
 
    public double nextDouble() {
        return Double.parseDouble(next());
    }
}


Measured memory_bytes: 46296
import std.stdio, std.conv, std.string, std.algorithm,
       std.math, std.array, std.container, std.typecons;

long n, k;
long[] a;
long[long] nth;

long next(long x) {
  return a[x-1];
}

void main() {
  readf("%d %d\n", &n, &k);
  a = readln.chomp.split.to!(long[]);
  long i=1;
  long c=0;
  while(nth.get(i,0)==0 && k>0) {
    nth[i] = c++;
    i = i.next;
    k--;
  }
  if(k==0) {
    writeln(i);
    return;
  }
  long looplen = c - nth[i];
  long z = k%looplen;
  for(long l=0; l<z; l++) {
    i = i.next;
  }
  i.writeln;
}


Measured memory_bytes: 19664
N, M = map(int, input().split())

# N <= M となるようにする
if N > M:
  tmp = N
  N = M
  M = tmp
  
if N == 1 and M == 1:
  print(1)
elif N == 1 and M >= 2:
  print(M-2)
elif N >= 2 and M >= 2:
  print((N-2) * (M-2))

Measured memory_bytes: 3060
#include<cstdio>
#include<iostream>
#include<algorithm>
#include<utility>
#include<vector>
#include<queue>
#include<functional>
#include<map>
#include<set>
#include<cstring>
#include<string>
#include<stack>
#include<stdlib.h>
#include<math.h>
using namespace std;
#define int long long
typedef pair<int, int> pii;
typedef pair<int, char> pic;
typedef priority_queue<pii, vector<pii>, greater<pii> > RPQ;
#define mk make_pair
#define INF (1ll << 30ll)
#define INFL (1ll << 60ll)
#define mod 1000000007

string s, t;
map<char, vector<int>> mp;
int ans, sz, tz;
bool use[100];

signed main(){
    cin >> s >> t;
    sz = (int)s.size();
    tz = (int)t.size();
    for(int i = 0; i < 26; i++){
        mp['a' + i].push_back(-1ll);
    }
    for(int i = 0; i < sz; i++){
        mp[s[i]].push_back(i);
        use[s[i] - 'a'] = true;
    }
    bool flag = false;
    for(int i = 0; i < 26; i++){
        mp['a' + i].push_back(INF);
    }
    for(int i = 0; i < tz; i++){
        if(!use[t[i] - 'a']){
            flag = true;
        }
    }
    if(flag){
        printf("-1\n");
        return 0;
    }
    //cout << *(mp['a'].begin()+1) << endl;
    int cur = -1ll;
    int pos = -1ll;
    for(int i = 0ll; i < tz; i++){
        pos = *upper_bound(mp[t[i]].begin(), mp[t[i]].end(), cur);
        if(pos == -1ll || pos == INF){
            ans += sz;
            //printf("i:%lld ans:%lld cur:%lld\n", i, ans, cur);
            cur = mp[t[i]][1];
        }
        else {
            cur = pos;
        }
    }
    ans += cur + 1ll;
    cout << ans << endl;

    return 0;
}
/*


*/

Measured memory_bytes: 1724
import java.util.Scanner;

// ALDS1_4_D
public class Main {	
	int check(int[] A, int k, int p) {
		int sum = 0;
		int n = 0;
		int v = 0;
		for (int i = 0; i < A.length; i++) {
			if (A[i] > p) break;
			if (sum + A[i] <= p) sum += A[i];
			else {
				sum = A[i];
				n++;
			}
			if (n == k) break;
			v++;
		}
		return v;
	}
	
	int binarySearch(int[] A, int k, int n, int min, int max) {
		if (max <= min + 1) return max;
		int mid = (max + min) / 2;
		if (check(A, k, mid) >= n) return binarySearch(A, k, n, min, mid);
		else return binarySearch(A, k, n, mid, max);
	}
	void run() {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int k = sc.nextInt();
		int[] A = new int[n];
		for (int i = 0; i < n; i++) {
			A[i] = sc.nextInt();
		}
		System.out.println(binarySearch(A, k, n, 0, 1000000000));
		sc.close();
	}
	
	public static void main(String[] args) {
		new Main().run();
	}
}



Measured memory_bytes: 70628
#include <iostream>
#include <vector>
#include <string>
#include <bits/stdc++.h>
#include <ctime>

#define FAST ios_base::sync_with_stdio(false); cin.tie(NULL)
#define TT int test_cases; cin >> test_cases; while(test_cases--)
#define TT1 int test_cases=1; while(test_cases--)
#define pb push_back
#define mp make_pair
#define fi first
#define se second
 
using namespace std;
typedef long long int ll;

 
int main() {
    
    FAST;
    TT1{
        
        string n;cin>>n;
        int n1=n.size();
        ll ans=0;
        for(int i=0;i<n1;i++)
        {
            ll t=int(n[i]-'0');
            ans+=t;
         
            
        }
        if(ans%9==0) cout<<"Yes"<<"\n";
        else cout<<"No"<<"\n";
    }
}

Measured memory_bytes: 3732
#include <algorithm>
#include <bitset>
#include <cassert>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <ctime>
#include <deque>
#include <fstream>
#include <functional>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>

using namespace std;

int main() {
    int n, q;
    cin >> n >> q;
    string s;
    cin >> s;

    vector<int> accum(n + 1, 0);
    for (int i = 1; i <= n; i++) {
        accum[i] = accum[i - 1];
        if (i > 1 && s[i - 2] == 'A' && s[i - 1] == 'C')
            accum[i]++;
    }
    for (int i = 0; i < q; i++) {
        int l, r;
        cin >> l >> r;
        l--, r--;
        if (l < n - 1 && s[l] == 'C')
            l++;
        cout << accum[r + 1] - accum[l] << endl;
    }
    return 0;
}


Measured memory_bytes: 1408
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <tuple>
#include <queue>
#include <bitset>
#include <unordered_map>
#include <tuple>
#include <utility>
#include <cmath>
#include <algorithm>
#include <numeric>
#include <sys/time.h>

using namespace std;

void solve(long long N, vector<long long> a){
  long long ret = 0;
  long long t = 1;
  long long b = a[0];
  for (int i = 1; i < N; i++) {
    if (b == a[i]) {
      t++;
    } else {
      ret += t/2;
      t = 1;
      b = a[i];
    }
  }
  ret += t/2;
  std::cout << ret << std::endl;
}

int main(){
  long long N;
  scanf("%lld",&N);
  vector<long long> a(N);
  for(int i = 0 ; i < N ; i++){
    scanf("%lld",&a[i]);
  }
  solve(N, a);
  return 0;
}


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

#define F first
#define S second
#define PB push_back
#define MP make_pair
#define REP(i,a,b) for (int i = a; i <= b; i++)
#define debug(i) cout << i << endl;
#define debugarr(a) for(auto i : a) cout << i << " ";

#define ll long long
#define vi vector<int>
#define vll vector<ll>
#define pi pair<int,int>
#define pll pair<ll, ll>
#define vpi vector<pi>
#define INF 1000000000000000

using namespace std;

ll n, m, l;

ll dist[310][310];

int main() {
    ios_base::sync_with_stdio(false);
    for(int i = 0; i <= 300; i++) {
        for(int j = 0; j <= 300; j++) {
            dist[i][j] = INF;
            if(i == j) dist[i][j] = 0;
        }
    }

    cin >> n >> m >> l;
    for(int i = 0; i < m; i++) {
        ll a, b, c;
        cin >> a >> b >> c;
        if(c <= l) {
            dist[a][b] = min(dist[a][b], c);
            dist[b][a] = dist[a][b];
        }
    }

    for(int k = 1; k <= n; k++) {
        for(int i = 1; i <= n; i++) {
            for(int j = 1; j <= n; j++) {
                    dist[i][j] = min(dist[i][j], dist[i][k] + dist[k][j]);
            }
        }
    }

    for(int i = 1; i <= n; i++) {
        for(int j = 1; j <= n; j++) {
            if(dist[i][j] <= l) {
                dist[i][j] = 1;
            }else {
                dist[i][j] = INF;
            }
        }
        dist[i][i] = 0;
    }

    for(int k = 1; k <= n; k++) {
        for(int i = 1; i <= n; i++) {
            for(int j = 1; j <= n; j++) {
                    dist[i][j] = min(dist[i][j], dist[i][k] + dist[k][j]);
            }
        }
    }

    int q;
    cin >> q;

    while(q--) {
        int a, b;
        cin >> a >> b;
        if(dist[a][b] >= INF) cout << -1 << "\n";
        else cout << dist[a][b] - 1 << "\n";
    }
}


Measured memory_bytes: 1280
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
  int n;
  cin >> n;
  vector<int> a;
  a.resize(n);
  bool flag = false;
  for (int i = 0; i < a.size(); i++)
  {
    cin >> a[i];
    a[i];
  }
  int count = 0, num = 1;
  while (1)
  {
    num = a[num-1];
    count++;
    if(num == 2){
      cout << count << endl;
      return 0;
    }
    if(count >99999999){
      cout << -1 << endl;
      return 0;
    }
  }



}

Measured memory_bytes: 768
#include<bits/stdc++.h>
using namespace std;
typedef long long LL;
const int N=1e5+5;
const int INF=0x3f3f3f3f;
int flag[N];
LL Cnt[N];
int main() {
#ifndef ONLINE_JUDGE
	freopen("in.txt","r",stdin);
#endif
	ios::sync_with_stdio(false);
	cin.tie(0);
	LL n,x,mod;
	cin>>n>>x>>mod;
	for(int i=1; i<=n; ++i) {
		int tmp=x%mod;
		Cnt[i]=Cnt[i-1]+tmp;
		if(flag[tmp]) {
			int &pos=flag[tmp],len=i-pos;
			cout<<Cnt[pos]
				  +(n-pos)/len*(Cnt[i]-Cnt[pos])
			      +Cnt[(n-pos)%len+pos]-Cnt[pos];
			return 0;
		}
		flag[tmp]=i;
		x=x*x%mod;
	}
	cout<<Cnt[n]<<endl;
	return 0;
}


Measured memory_bytes: 4292